Skip to content

v10.0.0-alpha.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@pluma4345 pluma4345 released this 28 Nov 13:24
· 0 commits to main since this release
e1cd08f

This is a preview release which is not intended for use in production and has been published under the npm next tag.

To install the latest preview release, run npm install arangojs@next.

See the migration guide for detailed instructions
for upgrading your code to arangojs v10.

Removed

  • Removed unused CreateUserOptions type

    The actual type used by the db.createUser method is still UserOptions.

  • Removed unused IndexDetails type

    This type was intended to be returned by collection.indexes when the
    withStats option is set to true but the figures property is already
    included in the current return type.

Changed

  • Changed QueueTimeMetrics type to an interface

  • Changed CursorExtras and CursorStats interfaces to types

  • Changed GraphVertexCollection and GraphEdgeCollection generic types to
    take separate EntryResultType and EntryInputType type parameters

  • Changed db.collection, db.createCollection and db.createEdgeCollection
    methods to take separate EntryResultType and EntryInputType type
    parameters

    These type parameters are used to narrow the the returned collection type.

  • Renamed db.listServiceScripts method to db.getServiceScripts

  • Renamed db.listHotBackups method to db.getHotBackups

  • Renamed db.getLogMessages method to db.listLogMessages

  • Renamed db.listFunctions method to db.listUserFunctions

  • Renamed db.createFunction method to db.createUserFunction

  • Renamed db.dropFunction method to db.dropUserFunction

  • Changed db.removeUser method to return void

Module renaming

  • Renamed most modules to plural form for consistency

    The following modules were renamed:

    • arangojs/analyzer -> arangojs/analyzers
    • arangojs/collection -> arangojs/collections
    • arangojs/cursor -> arangojs/cursors
    • arangojs/database -> arangojs/databases
    • arangojs/error -> arangojs/errors
    • arangojs/graph -> arangojs/graphs
    • arangojs/job -> arangojs/jobs
    • arangojs/route -> arangojs/routes
    • arangojs/transaction -> arangojs/transactions
    • arangojs/view -> arangojs/views

Moved types

  • Moved document related types from arangojs/collection module to
    arangojs/documents module

    The following types were moved: DocumentOperationFailure,
    DocumentOperationMetadata, DocumentExistsOptions,
    CollectionReadOptions, CollectionBatchReadOptions,
    CollectionInsertOptions, CollectionReplaceOptions,
    CollectionUpdateOptions, CollectionRemoveOptions,
    CollectionImportOptions, CollectionEdgesOptions,
    CollectionImportResult and CollectionEdgesResult

  • Moved index related types from arangojs/collection module to
    arangojs/indexes module

    The following types were moved: IndexListOptions.

  • Moved transaction related types from arangojs/database module to
    arangojs/transactions module

    The following types were moved: TransactionCollections,
    TransactionOptions and TransactionDetails.

  • Moved cluster related types from arangojs/database module to new
    arangojs/clusters module

    The following types were moved: ClusterImbalanceInfo,
    ClusterRebalanceState, ClusterRebalanceOptions, ClusterRebalanceMove
    and ClusterRebalanceResult.

  • Moved hot backup related types from arangojs/database module to new
    arangojs/hot-backups module

    The following types were moved: HotBackupOptions, HotBackupResult and
    HotBackupList.

  • Moved query related types from arangojs/database module to new
    arangojs/queries module

    The following types were moved: QueryOptions, ExplainOptions,
    ExplainPlan, ExplainStats, SingleExplainResult, MultiExplainResult,
    AstNode, ParseResult, QueryOptimizerRule, QueryTracking,
    QueryTrackingOptions, QueryInfo and AqlUserFunction.

  • Moved service related types from arangojs/database module to new
    arangojs/services module

    The following types were moved: InstallServiceOptions,
    ReplaceServiceOptions, UpgradeServiceOptions, UninstallServiceOptions,
    ServiceSummary, ServiceInfo, ServiceConfiguration,
    SingleServiceDependency, MultiServiceDependency, ServiceTestStats,
    ServiceTestStreamTest, ServiceTestStreamReport, ServiceTestSuiteTest,
    ServiceTestSuite, ServiceTestSuiteReport, ServiceTestXunitTest,
    ServiceTestXunitReport, ServiceTestTapReport, ServiceTestDefaultTest,
    ServiceTestDefaultReport and SwaggerJson.

  • Moved user related types from arangojs/database module to new
    arangojs/users module

    The following types were moved: AccessLevel, ArangoUser, UserOptions,
    UserAccessLevelOptions and CreateDatabaseUser.

  • Moved server administration related types from arangojs/database module to
    new arangojs/administration module

    The following types were moved: QueueTimeMetrics and VersionInfo.

Renamed types

  • Renamed Index types to IndexDescription for consistency

    The specific index types were also renamed accordingly:

    • Index -> IndexDescription
    • GeoIndex -> GeoIndexDescription
    • PersistentIndex -> PersistentIndexDescription
    • PrimaryIndex -> PrimaryIndexDescription
    • TtlIndex -> TtlIndexDescription
    • MdiIndex -> MdiIndexDescription
    • InvertedIndex -> InvertedIndexDescription
    • InternalArangosearchIndex -> ArangosearchIndexDescription
    • InternalIndex -> InternalIndexDescription
    • HiddenIndex -> HiddenIndexDescription

    Note that the "Internal" prefix was dropped from ArangosearchIndexDescription
    to more accurately reflect the index type name. The index type still refers
    to an internal index, however.

  • Renamed various types for consistency:

    • AqlUserFunction -> UserFunctionDescription

    • CollectionMetadata -> CollectionDescription

    • DatabaseInfo -> DatabaseDescription

    • GraphInfo -> GraphDescription

    • ServiceInfo -> ServiceDescription

    • QueryInfo -> QueryDescription

    • QueryTracking -> QueryTrackingInfo

    • TransactionDetails -> TransactionInfo

    • TransactionCollections -> TransactionCollectionOptions

    • CreateDatabaseUser -> CreateDatabaseUserOptions

    • Index operations:

      • IndexListOptions -> ListIndexesOptions
    • Collection document operations:

      • DocumentExistsOptions -> DocumentExistsOptions
      • CollectionReadOptions -> ReadDocumentOptions
      • CollectionBatchReadOptions -> BulkReadDocumentsOptions
      • CollectionInsertOptions -> InsertDocumentOptions
      • CollectionReplaceOptions -> ReplaceDocumentOptions
      • CollectionUpdateOptions -> UpdateDocumentOptions
      • CollectionRemoveOptions -> RemoveDocumentOptions
      • CollectionImportOptions -> ImportDocumentsOptions
      • CollectionEdgesOptions -> DocumentEdgesOptions
      • CollectionImportResult -> ImportDocumentsResult
      • CollectionEdgesResult -> DocumentEdgesResult
    • Graph collection document operation:

      • GraphCollectionReadOptions -> ReadGraphDocumentOptions
      • GraphCollectionInsertOptions -> CreateGraphDocumentOptions
      • GraphCollectionReplaceOptions -> ReplaceGraphDocumentOptions
      • GraphCollectionRemoveOptions -> RemoveGraphDocumentOptions
      • ViewPatchPropertiesOptions -> UpdateViewPropertiesOptions
    • View operations:

      • ArangoSearchViewPatchPropertiesOptions -> UpdateArangoSearchViewPropertiesOptions
      • SearchAliasViewPatchPropertiesOptions -> UpdateSearchAliasViewPropertiesOptions
      • SearchAliasViewPatchIndexOptions -> UpdateSearchAliasViewIndexOptions
      • ArangoSearchViewStoredValueOptions -> CreateArangoSearchViewStoredValueOptions
  • Renamed ArrayCursor and BatchedArrayCursor classes to Cursor and
    BatchCursor respectively

    The previous name was misleading because it conflicted with how the ArangoDB
    distinguishes between array cursors and streaming cursors in the interactive
    shell. This distinction does not apply to the driver.

  • Renamed various types to reduce ambiguity:

    • ObjectWithId (in indexes module) -> ObjectWithIndexId
    • ObjectWithId (in documents module) -> ObjectWithDocumentId
    • ObjectWithKey (in documents module) -> ObjectWithDocumentKey

Error handling

  • Errors encountered before a request completes are now wrapped in a
    NetworkError or a subclass thereof

    This should help making it easier to diagnose network issues and distinguish
    the relevant error conditions.

    The originating error can still be accessed using the cause property of the
    NetworkError error.

  • HttpError now extends the NetworkError class

    This allows treating all non-ArangoError errors as one category of errors,
    even when there is no server response available.

  • db.waitForPropagation now throws a PropagationTimeoutError error when
    invoked with a timeout option and the timeout duration is exceeded

    The method would previously throw the most recent error encountered while
    waiting for replication. The originating error can still be accessed using
    the cause property of the PropagationTimeoutError error.

  • db.waitForPropagation now respects the timeout option more strictly

    Previously the method would only time out if the timeout duration was
    exceeded after the most recent request failed. Now the timeout is
    recalculated and passed on to each request, preventing it from exceeding
    the specified duration.

    If the propagation timed out due to an underlying request exceeding the
    timeout duration, the cause property of the PropagationTimeoutError
    error will be a ResponseTimeoutError error.

  • config.beforeRequest and config.afterResponse callbacks can now return
    promises

    If the callback returns a promise, it will be awaited before the request
    and response cycle proceeds. If either callback throws an error or returns
    a promise that is rejected, that error will be thrown instead.

  • config.afterResponse callback signature changed

    The callback signature previously used the internal ArangojsResponse type.
    The new signature uses the Response type of the Fetch API with an
    additional request property to more accurately represent the actual value
    it receives as the parsedBody property will never be present.

  • response property on ArangoError is now optional

    This property should always be present but this allows using the error in
    situations where a response might not be available.

Added

  • Added BatchCursor#itemsView property and BatchCursorItemsView interface

    This property provides a low-level interface for consuming the items of the
    cursor and is used by the regular item-wise Cursor class internally.

  • Added onError option to Config (DE-955)

    This option can be used to specify a callback function that will be invoked
    whenever a request results in an error. Unlike afterResponse, this callback
    will be invoked even if the request completed but returned an error status.
    In this case the error will be the HttpError or ArangoError representing
    the error response.

    If the onError callback throws an error or returns a promise that is
    rejected, that error will be thrown instead.

  • Added NetworkError class

    This is the common base class for all errors (including HttpError) that
    occur while making a request. The originating error can be accessed using the
    cause property. The request object can be accessed using the request
    property.

    Note that ArangoError and the new PropagationTimeoutError error type
    do not extend NetworkError but may wrap an underlying error, which can
    be accessed using the cause property.

  • Added ResponseTimeoutError class

    This error extends NetworkError and is thrown when a request deliberately
    times out using the timeout option.

  • Added RequestAbortedError class

    This error extends NetworkError and is thrown when a request is aborted
    by using the db.close method.

  • Added FetchFailedError class

    This error extends NetworkError and is thrown when a request fails because
    the underlying fetch call fails (usually with a TypeError).

    In Node.js the root cause of this error (e.g. a network failure) can often be
    found in the cause property of the originating error, i.e. the cause
    property of the cause property of this error.

    In browsers the root cause is usually not exposed directly but can often
    be diagnosed by examining the developer console or network tab.

  • Added PropagationTimeoutError class

    This error does not extend NetworkError but wraps the most recent error
    encountered while waiting for replication, which can be accessed using the
    cause property. This error is only thrown when db.waitForPropagation
    is invoked with a timeout option and the timeout duration is exceeded.

  • Added ProcessedResponse type

    This type replaces the previously internal ArangojsResponse type and
    extends the native Response type with additional properties.

  • Added optional ArangoError#request property

    This property is always present if the error has a response property. In
    normal use this should always be the case.