v10.0.0-rc.0
Pre-releaseThis 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
typeThe actual type used by the
db.createUser
method is stillUserOptions
. -
Removed unused
IndexDetails
typeThis type was intended to be returned by
collection.indexes
when the
withStats
option is set totrue
but thefigures
property is already
included in the current return type.
Changed
-
Closing a connection now closes all open requests
Previously in certain situations only the most recent request would be
closed per server. Note that this still merely aborts the requests but
does not guarantee the underlying connections are closed as these are
handled by Node.js or the browser natively. need to be installed
otherwise. -
Moved fetch-specific
config
options from intoconfig.fetchOptions
The following options were moved:
credentials
,headers
andkeepalive
.
Error handling
-
Errors encountered before a request completes are now wrapped in a
NetworkError
or a subclass thereofThis 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 theNetworkError
classThis allows treating all non-
ArangoError
errors as one category of errors,
even when there is no server response available. -
db.waitForPropagation
now throws aPropagationTimeoutError
error when
invoked with atimeout
option and the timeout duration is exceededThe method would previously throw the most recent error encountered while
waiting for replication. The originating error can still be accessed using
thecause
property of thePropagationTimeoutError
error. -
db.waitForPropagation
now respects thetimeout
option more strictlyPreviously 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, thecause
property of thePropagationTimeoutError
error will be aResponseTimeoutError
error. -
config.beforeRequest
andconfig.afterResponse
callbacks can now return
promisesIf 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 changedThe callback signature previously used the internal
ArangojsResponse
type.
The new signature uses theResponse
type of the Fetch API with an
additionalrequest
property to more accurately represent the actual value
it receives as theparsedBody
property will never be present. -
response
property onArangoError
is now optionalThis property should always be present but this allows using the error in
situations where a response might not be available.
General type changes
-
Changed
GraphVertexCollection
andGraphEdgeCollection
generic types to
take separateEntryResultType
andEntryInputType
type parameters -
Changed
db.collection
,db.createCollection
anddb.createEdgeCollection
methods to take separateEntryResultType
andEntryInputType
type
parametersThese type parameters are used to narrow the the returned collection type.
-
Changed
db.removeUser
method return type toPromise<void>
The previous return type served no purpose.
-
Changed
QueueTimeMetrics
type to an interface -
Changed
CursorExtras
andCursorStats
interfaces to types
Low-level request/route changes
-
Renamed
path
option topathname
inRequestOptions
typeThis affects the
db.waitForPropagation
androute.request
methods. -
Removed
basePath
option fromRequestOptions
typeThis affects the
db.waitForPropagation
androute.request
methods. -
Renamed
route.path
property toroute.pathname
Renamed methods
-
Renamed various methods for consistency:
Methods that return an array now follow the
listNouns
pattern, methods that
return a "list of nouns" wrapped in an object have been renamed to follow the
getNouns
pattern to avoid confusion:db.listServiceScripts
->db.getServiceScripts
db.listHotBackups
->db.getHotBackups
db.listFunctions
->db.listUserFunctions
db.getLogMessages
->db.listLogMessages
-
Renamed AQL user function management methods:
db.createFunction
->db.createUserFunction
db.dropFunction
->db.dropUserFunction
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 internal utility functions to new
arangojs/lib/util
moduleThese methods are all still marked as internal and should not be used
directly.
Moved types
-
Moved document related types from
arangojs/collection
module to
arangojs/documents
moduleThe following types were moved:
DocumentOperationFailure
,
DocumentOperationMetadata
,DocumentExistsOptions
,
CollectionReadOptions
,CollectionBatchReadOptions
,
CollectionInsertOptions
,CollectionReplaceOptions
,
CollectionUpdateOptions
,CollectionRemoveOptions
,
CollectionImportOptions
,CollectionEdgesOptions
,
CollectionImportResult
andCollectionEdgesResult
-
Moved index related types from
arangojs/collection
module to
arangojs/indexes
moduleThe following types were moved:
IndexListOptions
. -
Moved transaction related types from
arangojs/database
module to
arangojs/transactions
moduleThe following types were moved:
TransactionCollections
,
TransactionOptions
andTransactionDetails
. -
Moved cluster related types from
arangojs/database
module to new
arangojs/clusters
moduleThe following types were moved:
ClusterImbalanceInfo
,
ClusterRebalanceState
,ClusterRebalanceOptions
,ClusterRebalanceMove
andClusterRebalanceResult
. -
Moved hot backup related types from
arangojs/database
module to new
arangojs/hot-backups
moduleThe following types were moved:
HotBackupOptions
,HotBackupResult
and
HotBackupList
. -
Moved query related types from
arangojs/database
module to new
arangojs/queries
moduleThe following types were moved:
QueryOptions
,ExplainOptions
,
ExplainPlan
,ExplainStats
,SingleExplainResult
,MultiExplainResult
,
AstNode
,ParseResult
,QueryOptimizerRule
,QueryTracking
,
QueryTrackingOptions
,QueryInfo
andAqlUserFunction
. -
Moved service related types from
arangojs/database
module to new
arangojs/services
moduleThe following types were moved:
InstallServiceOptions
,
ReplaceServiceOptions
,UpgradeServiceOptions
,UninstallServiceOptions
,
ServiceSummary
,ServiceInfo
,ServiceConfiguration
,
SingleServiceDependency
,MultiServiceDependency
,ServiceTestStats
,
ServiceTestStreamTest
,ServiceTestStreamReport
,ServiceTestSuiteTest
,
ServiceTestSuite
,ServiceTestSuiteReport
,ServiceTestXunitTest
,
ServiceTestXunitReport
,ServiceTestTapReport
,ServiceTestDefaultTest
,
ServiceTestDefaultReport
andSwaggerJson
. -
Moved user related types from
arangojs/database
module to new
arangojs/users
moduleThe following types were moved:
AccessLevel
,ArangoUser
,UserOptions
,
UserAccessLevelOptions
andCreateDatabaseUser
. -
Moved server administration related types from
arangojs/database
module to
newarangojs/administration
moduleThe following types were moved:
QueueTimeMetrics
andVersionInfo
. -
Moved configuration related types to new
arangojs/config
moduleThe following types were moved:
Config
,LoadBalancingStrategy
,
BasicAuthCredentials
andBearerAuthCredentials
. -
Moved
ArangoErrorResponse
type toarangojs/connection
moduleThe type is now also no longer marked as internal.
-
Moved configuration related types to new
arangojs/configuration
moduleThe following types were moved:
ConfigOptions
,LoadBalancingStrategy
,
BasicAuthCredentials
andBearerAuthCredentials
.
Renamed types
-
Renamed
Index
types toIndexDescription
for consistencyThe 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:
Types representing an instance of a specific entity type in ArangoDB like a
collection, graph or query now follow theNounDescription
naming pattern:AqlUserFunction
->UserFunctionDescription
CollectionMetadata
->CollectionDescription
DatabaseInfo
->DatabaseDescription
GraphInfo
->GraphDescription
ServiceInfo
->ServiceDescription
QueryInfo
->QueryDescription
TransactionDetails
->TransactionDescription
Note that the
TransactionDescription
type used bydb.listTransactions
is slightly different from theTransactionInfo
type used by methods of
Transaction
objects due to implementation details of ArangoDB.Types representing general information rather than an instance of something
now generally follow theNounInfo
naming pattern, whereas types
representing the result of an operation generally follow theNounResult
orVerbNounResult
naming pattern:QueryTracking
->QueryTrackingInfo
CollectionImportResult
->ImportDocumentsResult
CollectionEdgesResult
->DocumentEdgesResult
Types for options passed to methods now generally follow the
NounOptions
,
VerbNounOptions
orVerbNounAttributeOptions
naming patterns:-
Config
->ConfigOptions
-
TransactionCollections
->TransactionCollectionOptions
-
CreateDatabaseUser
->CreateDatabaseUserOptions
-
CollectionDropOptions
->DropCollectionOptions
-
CollectionTruncateOptions
->TruncateCollectionOptions
-
IndexListOptions
->ListIndexesOptions
-
Collection document operations:
DocumentExistsOptions
->DocumentExistsOptions
CollectionReadOptions
->ReadDocumentOptions
CollectionBatchReadOptions
->BulkReadDocumentsOptions
CollectionInsertOptions
->InsertDocumentOptions
CollectionReplaceOptions
->ReplaceDocumentOptions
CollectionUpdateOptions
->UpdateDocumentOptions
CollectionRemoveOptions
->RemoveDocumentOptions
CollectionImportOptions
->ImportDocumentsOptions
CollectionEdgesOptions
->DocumentEdgesOptions
-
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
andBatchedArrayCursor
classes toCursor
and
BatchCursor
respectivelyThe 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
(inindexes
module) ->ObjectWithIndexId
ObjectWithId
(indocuments
module) ->ObjectWithDocumentId
ObjectWithKey
(indocuments
module) ->ObjectWithDocumentKey
Added
-
Restored support for Unix domain sockets
Using Unix domain sockets requires the
undici
library to be installed. -
Restored support for
config.agentOptions
The
config.agentOptions
option can now be used to create a customundici
agent if theundici
library is installed. -
Added
config.fetchOptions
optionThis option can now be used to specify default options for the
fetch
function used by arangojs likeheaders
,credentials
,keepalive
and
redirect
. -
Added
BatchCursor#itemsView
property andBatchCursorItemsView
interfaceThis property provides a low-level interface for consuming the items of the
cursor and is used by the regular item-wiseCursor
class internally. -
Added
ProcessedResponse
typeThis type replaces the previously internal
ArangojsResponse
type and
extends the nativeResponse
type with additional properties.
Error handling
-
Added
config.onError
option (DE-955)This option can be used to specify a callback function that will be invoked
whenever a request results in an error. UnlikeafterResponse
, this callback
will be invoked even if the request completed but returned an error status.
In this case the error will be theHttpError
orArangoError
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 support for
config.fetchOptions.redirect
option (#613)This option can now be used to specify the redirect mode for requests.
When set to
"manual"
, arangojs will throw anHttpError
wrapping the
redirect response instead of automatically following redirects.Note that when set to
"error"
, the native fetch API will throw a
non-specific error (usually aTypeError
) that arangojs will wrap in a
FetchFailedError
instead. -
Added optional
ArangoError#request
propertyThis property is always present if the error has a
response
property. In
normal use this should always be the case. -
Added
NetworkError
classThis 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 therequest
property.Note that
ArangoError
and the newPropagationTimeoutError
error type
do not extendNetworkError
but may wrap an underlying error, which can
be accessed using thecause
property. -
Added
ResponseTimeoutError
classThis error extends
NetworkError
and is thrown when a request deliberately
times out using thetimeout
option. -
Added
RequestAbortedError
classThis error extends
NetworkError
and is thrown when a request is aborted
by using thedb.close
method. -
Added
FetchFailedError
classThis error extends
NetworkError
and is thrown when a request fails because
the underlyingfetch
call fails (usually with aTypeError
).In Node.js the root cause of this error (e.g. a network failure) can often be
found in thecause
property of the originating error, i.e. thecause
property of thecause
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
classThis 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 whendb.waitForPropagation
is invoked with atimeout
option and the timeout duration is exceeded.