Skip to content

Releases: datastax/astra-db-ts

v2.0.1

16 Apr 14:29
Compare
Choose a tag to compare

Minor bug patch release

Minor patch to fix findAnd* commands not property deserializating the returned document

Note

See the https://github.com/datastax/astra-db-ts/releases/tag/v2.0.0 for the full release notes for the new 2.0.0 major version

v2.0.0

14 Apr 21:06
Compare
Choose a tag to compare

v2.0.0 - Major client overhaul

Warning

Release notes are still under construction

Table of contents

Note

Asterisks (*) by section names indicate those that include note of any breaking changes from v1.x to v2.x.

What's new?

Prerequisites*

  • Node.js v18 or higher
  • TypeScript v5.0 or higher

Data API tables support

Adds complete support for Data API tables via the Table class.

Dual types*

Classes/types such as UpdateOneOptions, FindCursor, InsertManyError, etc. have been split into two different variants of each:

  • CollectionUpdateOneOptions and TableUpdateOneOptions,
  • CollectionFindand CursorTableFindCursor,
  • CollectionInsertManyError and TableInsertManyError,
  • etc.

Collection methods on the Db class (such as db.collection(), db.createCollection(), db.listCollections(), etc.) now have sister methods for tables:

  • db.table(),
  • db.createTable(),
  • db.listTables(),
  • etc.

Indexes

Furthermore, tables necessitate indexes, which may be created through table.createIndex() (and its sister methods), and dropped through db.dropTableIndex().

Utility types

New utility types to infer the table's TS-type from its schema has been added as well:

  • InferTableSchema
  • InferTablePrimaryKey

Datatypes

Lastly, of the major additions, new datatypes have been added as well to support the new tables:

  • DataAPIBlob
  • DataAPIDate
  • DataAPITime
  • DataAPIDuration
  • DataAPIInet
  • DataAPIVector
  • BigNumber (re-exported from bignumber.js)

See DATATYPES.md for more information on the new datatypes.

findAndRerank support

Note

This is tied to the Overhaul of cursors section; please read that section as well for more information.

Preview hybrid search support has dropped via the collection.findAndRerank() method, which uses a new FindAndRerankCursor to iterate over its results.

New LexicalDoc type added as well as a sister type to VectorDoc and VectorizeDoc.

Overhaul of the logging system*

The logging system has evolved beyond a simple, immutable monitorCommands flag which would emit events only on the DataAPIClient class.

Now, logging is configured through the logging option anywhere along the options hierarchy, and adds a variety of new features:

  • Events may log to the console as well now, as opposed to just being emitted as an event
  • All classes in the client hierarchy are now event listeners
    • These all extend the HierarchicalLogger class, which implements a minimal event emitter
    • Events are bubbled up from the class they were emitted from, all the way up to the root DataAPIClient
    • Event bubbling may be cancelled through event.stop[Immediate]Propagation() like the DOM

Logging may also be enabled/disabled/reconfigured on the fly, via the .updateLoggingConfig(<config>) method on any HierarchicalLogger instance (e.g. DataAPIClient, Db, Collection, etc.).

See the logging examples for more information.

Overhaul of the timeout system*

The timeout system has been overhauled to be more flexible and descriptive than the current singular maxTimeMS.

Timeouts are now configured through the timeoutDefaults parameter on class options interfaces, and the timeout parameter on method calls.

They are represented by the TimeoutDescriptor class, which contains the six following keys:

Timeout Option Description Default
requestTimeoutMs Maximum time the client waits for a response from the server 15 seconds
generalMethodTimeoutMs Timeout for general methods without a specific override (mostly doc/row-level ops) 30 seconds
collectionAdminTimeoutMs Timeout for collection admin operations (create, drop, list, etc.) 1 minute
tableAdminTimeoutMs Timeout for table admin operations (create, drop, list, alter, create/dropIndex, etc.) 30 seconds
databaseAdminTimeoutMs Timeout for database admin operations (create, drop, list, info, findEmbeddingProviders, etc.) 10 minutes
keyspaceAdminTimeoutMs Timeout for keyspace admin operations (create, drop, list) 30 seconds

In general, the requestTimeoutMs always corresponds to a single request from the server, but the rest of the timeouts account for the entire duration of the method, which is relevant in the case of multi-call methods.

A few important notes:

  • requestTimeoutMs applies per individual HTTP request.
  • The other timeouts account for the entire duration of the method, which is relevant in the case of multi-call methods.
  • Passing a timeout value as a plain number will use the most appropriate category for the method being called.
  • Setting a timeout to 0 disables it completely.
  • The legacy maxTimeMS option has been removed—simply replace it with timeout for a quick migration path.

Overhaul of cursors*

Cursors are no longer a single FindCursor class, but are now a [hierarchy of classes](https://mermaid.live/edit#pako:eNqtWA1z2kYa_itvdW0CCeYce-zUnOOMz3GmvknijKHt3JVOtUgLbCN2NasVNpeY337P7kpCCHDcazMTQLvv1_N-y5-DSMU86AVRwrLsjWATzWZDOZTffUevtv5zVx-uB5d0_YFC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SfAUoPmGge9wKXPMECXnPFhgG...

Read more

v2.0.0-rc.1

09 Apr 20:07
Compare
Choose a tag to compare
v2.0.0-rc.1 Pre-release
Pre-release

v2.0.0-preview.5

06 Feb 17:56
Compare
Choose a tag to compare
v2.0.0-preview.5 Pre-release
Pre-release

v2.0.0-preview.4

05 Feb 15:46
Compare
Choose a tag to compare
v2.0.0-preview.4 Pre-release
Pre-release
  • ESM support & various other compat improvements (#100) caf28e7
  • Docs work + update internal parsing & tooling (#99) 30fb76f

v2.0.0-preview.3...v2.0.0-preview.4

v2.0.0-preview.3

28 Jan 16:48
Compare
Choose a tag to compare
v2.0.0-preview.3 Pre-release
Pre-release

v2.0.0-preview.2

23 Jan 02:08
Compare
Choose a tag to compare
v2.0.0-preview.2 Pre-release
Pre-release
  • fix for process.env in the browser 7517a12

v2.0.0-preview.1...v2.0.0-preview.2

v2.0.0-preview.1

21 Jan 16:26
Compare
Choose a tag to compare
v2.0.0-preview.1 Pre-release
Pre-release
  • remoaved feature-flag tables header 23245c2
  • begrudgingly added InetAddress back as DataAPIInet 6aa0594
  • DataAPIDuration massive overhaul 4ea6a97
  • work for repl scirpt 98a9e66
  • overhaul of times 9d087f2
  • overhaul of dates ce54e01
  • enhanced coll bignumbers support cbcc101
  • reexport from version file 4b86423
  • check for broken compilation when skipLibCheck: false w/ astra-db-ts as dep a8dfc4f
  • bigints & counters now use bigint 29e5805
  • killed DataAPITimestamp 344b10a
  • proper checking for Bignumbers eea4db0
  • separate scripts/check.sh file for typechecking/linting 3fc4f33
  • UnexpectedDataAPIResponseError e1c342f
  • ser-des work (#92) 60e616f
  • Expand UUID versions (#91) 04af5e3

v2.0.0-preview.0...v2.0.0-preview.1

v2.0.0-preview.0

11 Dec 14:42
Compare
Choose a tag to compare
v2.0.0-preview.0 Pre-release
Pre-release

NOTE
The release notes are still under construction
The current commit list is just temporary

v1.5.0...v2.0.0-preview.0

v1.5.0

20 Sep 21:43
Compare
Choose a tag to compare

Namespace deprecation (docs link)

  • The "namespace" terminology is now deprecated (still backwards compatible) everywhere
    • There is a new "keyspace" alternative for each parameter name or method with "namespace" in it
    • e.g. db.useNamespace(...) still works, but now prefer the db.useKeyspace(...) alternative
  • All usages of "namespace" will be removed in an upcoming major release

Other deprecations (to be removed in v2.0)

  • collection.bulkWrite() is now deprecated
    • Prefer to just manually call the functions yourself
  • db.collections() is also now deprecated
    • Equivalent to (await db.listCollections()).map(c => new Collection(c.name))

Misc improvements/fixes

  • collection.drop() will now work properly if the collection is in a non-default keyspace
    • Before, it would attempt to drop the collection from 'default_keyspace'
  • returnDocument on findOneAnd* functions are finally optional
    • Defaults to 'before' on the Data API
  • updateDbNamespace was changed to immediately set the new keyspace
    • Before, it would wait for the keyspace to be created first
      • This would lead to easier race conditions, and they keyspace wouldn't be set at all if creation errored
  • [Admin]CommandSucceededEvents now have a warnings field for any warnings the Data API may return
    • These may point out deprecated/incorrect practices, or any other issues that aren't strictly an error.
    • (e.g. using the now-deprecated (create|find|drop)Namespace admin commands on DSE/HCD)
  • Added missing DB statuses to the DatabaseStatus enum (e.g. 'HIBERNATED' and 'HIBERNATING')
    • You can check the diff here
  • Better error for if the Admin classes don't have a token set
    • (for the astra variants)
  • Various error message improvements throughout the client
    • Fixed some errors being obfuscated, improved the clarity of a few, added ' (+ more <num_errors> errors)' to the end of aggregated errors
  • Exposed FetchH2 and FetchNative fetchers to make it easier to wrap them with your own for customization purposes
    • For use with setting a 'custom' client
  • Exposed DEFAULT_KEYSPACE constant

Internal stuff

(Too many changes to list in detail, but here are the highlights)
  • MAJOR overhaul of test suite
    • Massively parallelized tests (full test suite used to take over 50 min to run.. now it barely takes 10 minutes!)
    • Majorly improved test filtering through custom filtering functionality
    • Custom test report file generated to store full errors thrown during tests
    • Test suite sets up and cleans up after itself much better now (tests much more reproducible now)
    • Custom test script CLI to make running tests super easy
    • Vectorize tests wait for providers to warm up now instead of erroring out after the first try
    • Much more info here
  • Updated ESLint + config
    • Including adding rules to add all missing semicolons/commas
  • shell.nix + nix-direnv
    • Setups up shell env w/ nodejs_20, jq, and the astra CLI
    • Also adds the scripts dir to PATH
  • repl.sh script
    • Much easier way to quickly test out astra-db-ts functionality
    • Added -light option to build script to set up REPL quicker
      • Doesn't typecheck or do any extraneous code transformations (such as stripping comments)
  • returnDocumentResponses implementation

v1.4.1...v1.5.0