Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 #90

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fc26224
Deprecated features removal (#74)
toptobes Sep 30, 2024
432c807
Initial tables implementation (#75)
toptobes Oct 6, 2024
4cca38f
Cursor refactors & alignment (#76)
toptobes Oct 22, 2024
bee45ab
Initial logging implementation (#77)
toptobes Oct 26, 2024
d0c6e0b
Rough, complete, roughly complete `Table` implementation (#78)
toptobes Nov 9, 2024
68873cb
Admin class overhauls (#79)
toptobes Nov 10, 2024
605d9ff
minor-ish tweaks/fixes
toptobes Nov 12, 2024
50361dd
Cursor split + tests (#80)
toptobes Nov 14, 2024
c8dc9fa
Timeouts overhaul (#81)
toptobes Nov 18, 2024
9b26268
Initial tables tests (#82)
toptobes Nov 19, 2024
09d1d66
Various 2.0 cleanups/tweaks (#83)
toptobes Nov 20, 2024
9a933f7
Various minor tweaks & cleanups for 2.0 (#84)
toptobes Nov 30, 2024
f31127b
TSDoc progress + other minor fixes (#86)
toptobes Dec 3, 2024
95f8a41
Added complex r/w-aware `Table` & `Collection` types (#87)
toptobes Dec 3, 2024
cfcf437
Switch to codec-based ser/des system (#88)
toptobes Dec 6, 2024
0faa849
TSDoc + typing improvements + tweaks (#89)
toptobes Dec 11, 2024
e86b308
slgihtly updated readme
toptobes Dec 11, 2024
adab55d
2.0.0-preview.0
toptobes Dec 11, 2024
04af5e3
Expand UUID versions (#91)
toptobes Dec 16, 2024
60e616f
ser-des work (#92)
toptobes Dec 17, 2024
8ee74e2
Documentation work (#93)
toptobes Dec 22, 2024
b6c13bf
A LOT of misc 2.0 work (#97)
toptobes Jan 22, 2025
7517a12
fix for process.env in the browser
toptobes Jan 23, 2025
614ed4f
2.0.0-preview.2
toptobes Jan 23, 2025
ae2bd71
Major serdes changes (#98)
toptobes Jan 28, 2025
3e10eca
2.0.0-preview.3
toptobes Jan 28, 2025
30fb76f
Docs work + update internal parsing & tooling (#99)
toptobes Feb 4, 2025
caf28e7
ESM support & various other compat improvements (#100)
toptobes Feb 5, 2025
d5f2a30
2.0.0-preview.4
toptobes Feb 5, 2025
a1c3838
ESM update hotfix (#101)
toptobes Feb 6, 2025
9d25663
2.0.0-preview.5
toptobes Feb 6, 2025
59bc694
Logging overhaul (#102)
toptobes Feb 11, 2025
f9a2b24
Docs work + various improvements (#103)
toptobes Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 13 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@

## Quickstart

Use your preferred package manager to install `@datastax/astra-db-ts`. Note that this is not supported in browsers.
Use your preferred package manager to install `@datastax/astra-db-ts`.

```bash
npm i @datastax/astra-db-ts # or your favorite package manager's equivalent
````

If you're using TypeScript, you must use at least version 5.0.0 to use `astra-db-ts 2.0`, as it uses modern TypeScript features such as `const` type parameters.

```bash
npm i typescript@^5.0.0
```

Get the *API endpoint* and your *application token* for your Astra DB instance @ [astra.datastax.com](https://astra.datastax.com).

Expand Down Expand Up @@ -169,56 +179,6 @@ type Dream = InferTableSchema<typeof DreamsTableSchema>;
})();
```

<details>
<summary><i>Inferring the table schema pre-TS v5.0</i></summary>

Before TypeScript 5.0, there was no support for "const type parameters" (e.g. `f<const T>(t: T): T`) which `Table.schema` relies on.

No worries though—if you're using TypeScript 4.x or below, you can still infer the schema automatically, albeit with less language server support.

Schema object type errors may be non-local and harder to debug, but the code will still work as expected.

```ts
const DreamsTableSchema = <const>{
columns: {
id: 'int',
summary: 'text',
tags: { type: 'set', valueType: 'text' },
vector: { type: 'vector', dimension: 3 },
},
primaryKey: 'id',
};

// Still works, but you need to ensure DreamsTableSchema is a properly typed const object
type Dream = InferTableSchema<typeof DreamsTableSchema>;
type DreamPK = InferTablePrimaryKey<typeof DreamsTableSchema>;

(async () => {
// Necessary to explicitly set the type of the table schema and primary key here
const table = await db.createTable<Dream, DreamPK>('dreams', {
definition: DreamsTableSchema,
ifNotExists: true,
});
})();
```

If you're using TypeScript 4.9, you can at least use the `satisfies` operator to localize any definition type errors.

```ts
const DreamsTableSchema = <const>{
columns: {
id: 'int',
summary: 'text',
tags: { type: 'set', valueType: 'text' },
vector: { type: 'vector', dimension: 3 },
},
primaryKey: 'id',
} satisfies CreateTableDefinition;

type Dream = InferTableSchema<typeof DreamsTableSchema>;
```
</details>

### Next steps

- More info and usage patterns are given in the ts-doc of classes and methods
Expand Down Expand Up @@ -263,9 +223,9 @@ const admin = client.admin();
const dbInfo = databases[0];
console.log(dbInfo.info.name, dbInfo.id, dbInfo.info.region);

// list namespaces for the first database
// list keyspaces for the first database
const dbAdmin = admin.dbAdmin(dbInfo.id, dbInfo.info.region);
console.log(await dbAdmin.listNamespaces());
console.log(await dbAdmin.listKeyspaces());
})();
```

Expand Down
Loading