arangojs 7.8.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -3
- package/CONTRIBUTING.md +1 -1
- package/MIGRATING.md +126 -2
- package/README.md +7 -13
- package/analyzer.d.ts +531 -253
- package/analyzer.d.ts.map +1 -1
- package/analyzer.js +9 -8
- package/analyzer.js.map +1 -1
- package/aql.d.ts +122 -139
- package/aql.d.ts.map +1 -1
- package/aql.js +146 -148
- package/aql.js.map +1 -1
- package/collection.d.ts +311 -310
- package/collection.d.ts.map +1 -1
- package/collection.js +163 -96
- package/collection.js.map +1 -1
- package/connection.d.ts +65 -52
- package/connection.d.ts.map +1 -1
- package/connection.js +142 -140
- package/connection.js.map +1 -1
- package/cursor.d.ts +108 -26
- package/cursor.d.ts.map +1 -1
- package/cursor.js +24 -23
- package/cursor.js.map +1 -1
- package/database.d.ts +298 -330
- package/database.d.ts.map +1 -1
- package/database.js +178 -252
- package/database.js.map +1 -1
- package/documents.d.ts +3 -4
- package/documents.d.ts.map +1 -1
- package/documents.js +0 -1
- package/documents.js.map +1 -1
- package/error.d.ts +3 -6
- package/error.d.ts.map +1 -1
- package/error.js +5 -7
- package/error.js.map +1 -1
- package/foxx-manifest.d.ts +7 -8
- package/foxx-manifest.d.ts.map +1 -1
- package/foxx-manifest.js +1 -1
- package/foxx-manifest.js.map +1 -1
- package/graph.d.ts +38 -56
- package/graph.d.ts.map +1 -1
- package/graph.js +59 -63
- package/graph.js.map +1 -1
- package/index.d.ts +6 -8
- package/index.d.ts.map +1 -1
- package/index.js +1 -6
- package/index.js.map +1 -1
- package/indexes.d.ts +348 -127
- package/indexes.d.ts.map +1 -1
- package/indexes.js +1 -3
- package/indexes.js.map +1 -1
- package/lib/blob.d.ts +0 -2
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +0 -1
- package/lib/blob.js.map +1 -1
- package/lib/btoa.d.ts +1 -3
- package/lib/btoa.d.ts.map +1 -1
- package/lib/btoa.js +3 -5
- package/lib/btoa.js.map +1 -1
- package/lib/btoa.web.d.ts +1 -3
- package/lib/btoa.web.d.ts.map +1 -1
- package/lib/btoa.web.js +4 -6
- package/lib/btoa.web.js.map +1 -1
- package/lib/codes.d.ts +2 -2
- package/lib/codes.d.ts.map +1 -1
- package/lib/codes.js +3 -3
- package/lib/codes.js.map +1 -1
- package/lib/errback.d.ts +0 -2
- package/lib/errback.d.ts.map +1 -1
- package/lib/errback.js.map +1 -1
- package/lib/joinPath.d.ts +0 -2
- package/lib/joinPath.d.ts.map +1 -1
- package/lib/joinPath.js +0 -2
- package/lib/joinPath.js.map +1 -1
- package/lib/joinPath.web.d.ts +1 -3
- package/lib/joinPath.web.d.ts.map +1 -1
- package/lib/joinPath.web.js +7 -4
- package/lib/joinPath.web.js.map +1 -1
- package/lib/multipart.d.ts +0 -4
- package/lib/multipart.d.ts.map +1 -1
- package/lib/multipart.js +16 -37
- package/lib/multipart.js.map +1 -1
- package/lib/multipart.web.d.ts +0 -2
- package/lib/multipart.web.d.ts.map +1 -1
- package/lib/multipart.web.js +0 -2
- package/lib/multipart.web.js.map +1 -1
- package/lib/normalizeUrl.d.ts +0 -2
- package/lib/normalizeUrl.d.ts.map +1 -1
- package/lib/normalizeUrl.js +0 -2
- package/lib/normalizeUrl.js.map +1 -1
- package/lib/omit.d.ts +1 -3
- package/lib/omit.d.ts.map +1 -1
- package/lib/omit.js +1 -2
- package/lib/omit.js.map +1 -1
- package/lib/querystringify.d.ts +4 -0
- package/lib/querystringify.d.ts.map +1 -0
- package/lib/querystringify.js +20 -0
- package/lib/querystringify.js.map +1 -0
- package/lib/querystringify.web.d.ts +2 -0
- package/lib/querystringify.web.d.ts.map +1 -0
- package/lib/querystringify.web.js +30 -0
- package/lib/querystringify.web.js.map +1 -0
- package/lib/request.d.ts +0 -1
- package/lib/request.d.ts.map +1 -1
- package/lib/request.js +6 -3
- package/lib/request.js.map +1 -1
- package/lib/request.node.d.ts +2 -8
- package/lib/request.node.d.ts.map +1 -1
- package/lib/request.node.js +16 -7
- package/lib/request.node.js.map +1 -1
- package/lib/request.web.d.ts +2 -3
- package/lib/request.web.d.ts.map +1 -1
- package/lib/request.web.js +26 -29
- package/lib/request.web.js.map +1 -1
- package/lib/xhr.d.ts +1 -3
- package/lib/xhr.d.ts.map +1 -1
- package/lib/xhr.js +0 -2
- package/lib/xhr.js.map +1 -1
- package/package.json +5 -6
- package/route.d.ts +1 -2
- package/route.d.ts.map +1 -1
- package/route.js +1 -2
- package/route.js.map +1 -1
- package/transaction.d.ts +31 -6
- package/transaction.d.ts.map +1 -1
- package/transaction.js +13 -6
- package/transaction.js.map +1 -1
- package/view.d.ts +237 -181
- package/view.d.ts.map +1 -1
- package/view.js +17 -25
- package/view.js.map +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/lib/error.d.ts +0 -18
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js +0 -18
- package/lib/error.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,266 @@ This driver uses semantic versioning:
|
|
|
14
14
|
- A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
|
|
15
15
|
changes that require changes in your code to upgrade.
|
|
16
16
|
|
|
17
|
+
## [8.0.0] - 2022-10-25
|
|
18
|
+
|
|
19
|
+
This is a major release and breaks backwards compatibility.
|
|
20
|
+
|
|
21
|
+
See [the migration guide](./MIGRATING.md#v7-to-v8) for detailed instructions
|
|
22
|
+
for upgrading your code to arangojs v8.
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
- Removed Node.js 10 and Node.js 12 support
|
|
27
|
+
|
|
28
|
+
With Node.js 10 and 12 having reached their end of life, arangojs will no
|
|
29
|
+
longer support these versions of Node.js going forward.
|
|
30
|
+
|
|
31
|
+
- Removed Internet Explorer and older browser support
|
|
32
|
+
|
|
33
|
+
As of version 8 arangojs uses the [Browserlist `defaults`](https://browsersl.ist/#q=defaults)
|
|
34
|
+
list to generate the pre-built browser bundle, which excludes older browsers
|
|
35
|
+
and specifically all versions of Internet Explorer.
|
|
36
|
+
|
|
37
|
+
You may still be able to use arangojs in some of the excluded browsers when
|
|
38
|
+
bundling arangojs yourself but this may require polyfills and additional
|
|
39
|
+
transformations.
|
|
40
|
+
|
|
41
|
+
- Removed `Dict` type from `connection` module
|
|
42
|
+
|
|
43
|
+
The `Dict<T>` type was identical to `Record<string, T>` and has been replaced
|
|
44
|
+
with this built-in type across arangojs.
|
|
45
|
+
|
|
46
|
+
- Removed workaround for ArangoDB pre-3.2.8 Foxx HTTP API responses
|
|
47
|
+
|
|
48
|
+
When fetching or modifying the configuration or dependencies of a Foxx
|
|
49
|
+
service using ArangoDB 3.2.7 and earlier, arangojs would perform additional
|
|
50
|
+
operations to convert the server response to a compatible format. All
|
|
51
|
+
affected versions of ArangoDB have reached End of Life since December 2018.
|
|
52
|
+
|
|
53
|
+
- Removed deprecated `db.useDatabase` method
|
|
54
|
+
|
|
55
|
+
The method was previously deprecated and can be replaced with `db.database`,
|
|
56
|
+
which returns a new `Database` object instead of modifying the existing one.
|
|
57
|
+
|
|
58
|
+
- Removed deprecated MMFiles methods and types
|
|
59
|
+
|
|
60
|
+
The MMFiles storage engine was removed in ArangoDB 3.7.
|
|
61
|
+
|
|
62
|
+
- Removed deprecated `minReplicationFactor` option from collection and
|
|
63
|
+
database related types
|
|
64
|
+
|
|
65
|
+
This option was renamed to `writeConcern` in ArangoDB 3.6.
|
|
66
|
+
|
|
67
|
+
- Removed deprecated `overwrite` option from `CollectionInsertOptions` type
|
|
68
|
+
|
|
69
|
+
This option was deprecated in ArangoDB 3.7 and should be replaced with the
|
|
70
|
+
`overwriteMode` option.
|
|
71
|
+
|
|
72
|
+
- Removed internal `request.host` attribute
|
|
73
|
+
|
|
74
|
+
This attribute has been replaced with `request.hostUrl`.
|
|
75
|
+
|
|
76
|
+
- Removed internal `response.arangojsHostId` attribute
|
|
77
|
+
|
|
78
|
+
This attribute has been replaced with `response.arangojsHostUrl`.
|
|
79
|
+
|
|
80
|
+
- Removed `CollectionStatus` and `CollectionType` enum re-exports
|
|
81
|
+
|
|
82
|
+
Previously these would be re-exported by the arangojs module for backwards
|
|
83
|
+
compatibility. If you still need to access these enums, you can import them
|
|
84
|
+
from the `collection` sub-module instead. Note that the `ViewType` enum
|
|
85
|
+
has been removed completely.
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
- Changed default URL to `http://127.0.0.1:8529` to match ArangoDB default
|
|
90
|
+
|
|
91
|
+
Previously arangojs would use `localhost` which on some systems resolves to
|
|
92
|
+
the IPv6 address `::1` instead, resulting in confusing connection errors.
|
|
93
|
+
|
|
94
|
+
- Changed TypeScript compilation target to ES2020
|
|
95
|
+
|
|
96
|
+
Since all evergreen browsers including Firefox ESR and all active Node.js LTS
|
|
97
|
+
releases fully support ES2020, the compilation target for the browser bundle
|
|
98
|
+
and Node.js has been moved from ES2016 and ES2018 respectively to ES2020.
|
|
99
|
+
|
|
100
|
+
- Updated TypeScript to version 4.8
|
|
101
|
+
|
|
102
|
+
This may result in type signatures that are incompatible with TypeScript 3
|
|
103
|
+
being added in future releases (including patch releases).
|
|
104
|
+
|
|
105
|
+
- Changed default behavior of _internal_ `db.request` method
|
|
106
|
+
|
|
107
|
+
Previously this method would always return the full response object if no
|
|
108
|
+
`transform` callback was provided. The method now defaults to a `transform`
|
|
109
|
+
callback that extracts the response body instead. The previous behavior can
|
|
110
|
+
still be forced by passing `false` instead of a callback function.
|
|
111
|
+
|
|
112
|
+
This change has no effect on other methods like `route.request`.
|
|
113
|
+
|
|
114
|
+
- Replaced node core module polyfills with native APIs in browser build
|
|
115
|
+
|
|
116
|
+
As part of upgrading to webpack 5, arangojs now no longer requires node core
|
|
117
|
+
modules to be polyfilled to work in the browser. This also drastically
|
|
118
|
+
reduces the file size of the pre-built browser bundle `arangojs/web`.
|
|
119
|
+
|
|
120
|
+
- `db.query` now supports a generic return type ([#764](https://github.com/arangodb/arangojs/issues/764))
|
|
121
|
+
|
|
122
|
+
This allows explictly setting the item type of the `ArrayCursor` returned by
|
|
123
|
+
the query without using a type assertion on the promise result. Note that
|
|
124
|
+
arangojs can make no guarantees that the type matches the actual data
|
|
125
|
+
returned by the query.
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
const numbers = await db.query<{ index: number; squared: number }>(aql`
|
|
129
|
+
FOR i IN 1..1000
|
|
130
|
+
RETURN {
|
|
131
|
+
index: i,
|
|
132
|
+
squared: i * i
|
|
133
|
+
}
|
|
134
|
+
`);
|
|
135
|
+
const first = await numbers.next();
|
|
136
|
+
console.log(first.index, first.squared); // 1 1
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
- Moved `aql.literal` and `aql.join` into `aql` module
|
|
140
|
+
|
|
141
|
+
Previously these were available as methods on the `aql` function. Now they
|
|
142
|
+
need to be imported from the `aql` module.
|
|
143
|
+
|
|
144
|
+
- Changed return values of `db.getUserAccessLevel` and `db.getUserDatabases`
|
|
145
|
+
to match documented return types
|
|
146
|
+
|
|
147
|
+
- Retry requests resulting in status 503 `ArangoError` ([#710](https://github.com/arangodb/arangojs/issues/710))
|
|
148
|
+
|
|
149
|
+
Unless retries are explicitly disabled by setting `config.maxRetries` to
|
|
150
|
+
`false`, requests will now also be retried if the server responded with a
|
|
151
|
+
503 `ArangoError`, which ArangoDB uses to indicate the server is running in
|
|
152
|
+
maintenance mode. Previously this would always result in an error.
|
|
153
|
+
|
|
154
|
+
- Extended `CursorExtras` type in TypeScript
|
|
155
|
+
|
|
156
|
+
The types of the attributes `plan`, `profile`, and `stats` are now defined
|
|
157
|
+
more explicitly.
|
|
158
|
+
|
|
159
|
+
- Changed behavior of `collection.removeAll` for non-string arrays
|
|
160
|
+
|
|
161
|
+
Previously `collection.removeAll` would always convert its argument into an
|
|
162
|
+
array of document IDs and fail with an error if passed any documents had an
|
|
163
|
+
ID not matching the collection name. Now the selector argument is passed
|
|
164
|
+
as-is, bypassing this validation but allowing `ignoreRevs` to be respected
|
|
165
|
+
by the server.
|
|
166
|
+
|
|
167
|
+
- Extracted type `ArangoSearchViewLinkOptions` from `ArangoSearchViewLink`
|
|
168
|
+
|
|
169
|
+
Note that `ArangoSearchViewLink` now represents the type of the value
|
|
170
|
+
returned by the server, marking several properties as required.
|
|
171
|
+
|
|
172
|
+
- Extracted type `CreateArangoSearchView` from
|
|
173
|
+
`ArangoSearchViewPropertiesOptions`
|
|
174
|
+
|
|
175
|
+
Note that `ArangoSearchViewPropertiesOptions` now includes only those options
|
|
176
|
+
that can be updated/replaced whereas `CreateArangoSearchView` also includes
|
|
177
|
+
options that can only be set during creation of a view.
|
|
178
|
+
|
|
179
|
+
- Renamed type `GraphCreateOptions` to `CreateGraphOptions`
|
|
180
|
+
|
|
181
|
+
- Renamed type `PrimarySortCompression` to `Compression`
|
|
182
|
+
|
|
183
|
+
- Replaced type `AnalyzerInfo` and all its constituent types
|
|
184
|
+
|
|
185
|
+
Previously each type of Analyzer was represented by an `AnalyzerInfo` type
|
|
186
|
+
and (where relevant) an `AnalyzerProperties` type, which were used for both
|
|
187
|
+
creating and fetching Analyzers. The new types more closely follow the
|
|
188
|
+
pattern already used for index types, providing pairs of
|
|
189
|
+
`CreateAnalyzerOptions` and `AnalyzerDescription` types.
|
|
190
|
+
|
|
191
|
+
- Removed enum `ViewType`, type `ArangoSearchView` and changed `View` class to
|
|
192
|
+
be non-generic
|
|
193
|
+
|
|
194
|
+
The `View` class now behaves analogous to the `Analyzer` class. The various
|
|
195
|
+
types related to different view types have been restructured to more closely
|
|
196
|
+
follow the pattern used for indexes and analyzers.
|
|
197
|
+
|
|
198
|
+
### Deprecated
|
|
199
|
+
|
|
200
|
+
- Deprecated `EnsureFulltextIndexOptions` and `FulltextIndex` types
|
|
201
|
+
|
|
202
|
+
Fulltext indexes have been deprecated in ArangoDB 3.10 and should be replaced
|
|
203
|
+
with ArangoSearch.
|
|
204
|
+
|
|
205
|
+
- Deprecated `BytesAccumConsolidationPolicy` type
|
|
206
|
+
|
|
207
|
+
The `bytes_accum` consolidation policy for views was deprecated in
|
|
208
|
+
ArangoDB 3.7 and should be replaced with the `tier` consolidation policy.
|
|
209
|
+
The type is also no longer supported in `ArangoSearchViewPropertiesOptions`.
|
|
210
|
+
|
|
211
|
+
### Added
|
|
212
|
+
|
|
213
|
+
- Added `toJSON` method to system errors
|
|
214
|
+
|
|
215
|
+
ArangoJS already adds the `request` object to system errors encountered
|
|
216
|
+
while attempting to make network requests. This change makes it easier
|
|
217
|
+
to serialize these error objects to JSON the same way `ArangoError` and
|
|
218
|
+
`HttpError` objects can already be serialized.
|
|
219
|
+
|
|
220
|
+
- Added `allowDirtyRead` option to `db.beginTransaction`, `trx.commit`,
|
|
221
|
+
`trx.abort`, `collection.edges`, `collection.inEdges`, `collection.outEdges`
|
|
222
|
+
|
|
223
|
+
The option is only respected by read-only requests.
|
|
224
|
+
|
|
225
|
+
- Added support for `ifMatch` and `ifNoneMatch` options ([#707](https://github.com/arangodb/arangojs/issues/707))
|
|
226
|
+
|
|
227
|
+
- Added `overwrite` option to `db.acquireHostList` ([#711](https://github.com/arangodb/arangojs/issues/711))
|
|
228
|
+
|
|
229
|
+
Setting this option to `true` will replace the current host list, removing any
|
|
230
|
+
hosts no longer present in the cluster.
|
|
231
|
+
|
|
232
|
+
- Added new ArangoDB 3.10 `legacyPolygons` option to `EnsureGeoIndexOptions`
|
|
233
|
+
and `GeoIndex` types
|
|
234
|
+
|
|
235
|
+
Geo indexes created in ArangoDB pre-3.10 will implicitly default this option
|
|
236
|
+
to `true`. ArangoDB 3.10 and later will default to `false` and use the new
|
|
237
|
+
parsing rules for geo indexes.
|
|
238
|
+
|
|
239
|
+
- Added support for new ArangoDB 3.10 `cacheEnabled` and `storedValues` options
|
|
240
|
+
in persistent indexes
|
|
241
|
+
|
|
242
|
+
- Added support for new ArangoDB 3.10 computed values in collections
|
|
243
|
+
|
|
244
|
+
- Added support for new ArangoDB 3.10 `InvertedIndex` type
|
|
245
|
+
|
|
246
|
+
- Added support for new ArangoDB 3.10 `offset` Analyzer feature
|
|
247
|
+
|
|
248
|
+
- Added support for new ArangoDB 3.10 `minhash`, `classification` and
|
|
249
|
+
`nearest_neighbors` Analyzer types
|
|
250
|
+
|
|
251
|
+
- Added missing `replicationFactor` and `writeConcern` options to
|
|
252
|
+
`CollectionPropertiesOptions` type
|
|
253
|
+
|
|
254
|
+
- Added missing `commitIntervalMsec` option to `ArangoSearchViewProperties`
|
|
255
|
+
type
|
|
256
|
+
|
|
257
|
+
- Added missing `deduplicate` option to `EnsurePersistentIndexOptions` type
|
|
258
|
+
([#771](https://github.com/arangodb/arangojs/issues/771))
|
|
259
|
+
|
|
260
|
+
- Added missing `unique` option to `EnsureZkdIndexOptions` type
|
|
261
|
+
|
|
262
|
+
- Added missing `deduplicate` and `estimates` fields to `PersistentIndex` type
|
|
263
|
+
|
|
264
|
+
- Added new ArangoDB 3.10 `db.queryRules` method
|
|
265
|
+
|
|
266
|
+
- Added support for `Analyzer` in `aql` templates
|
|
267
|
+
|
|
268
|
+
`Analyzer` objects can now be passed into `aql` templates like `View` and
|
|
269
|
+
`ArangoCollection` objects.
|
|
270
|
+
|
|
271
|
+
- Added `retryOnConflict` option to `Config`
|
|
272
|
+
|
|
273
|
+
If set to any number, this value will be used as the default value for all
|
|
274
|
+
requests unless explicitly overridden when using `db.query` or
|
|
275
|
+
`route.request`.
|
|
276
|
+
|
|
17
277
|
## [7.8.0] - 2022-05-19
|
|
18
278
|
|
|
19
279
|
### Added
|
|
@@ -100,11 +360,11 @@ This driver uses semantic versioning:
|
|
|
100
360
|
|
|
101
361
|
### Fixed
|
|
102
362
|
|
|
103
|
-
- Added missing `hex`
|
|
363
|
+
- Added missing `hex` option to `StopwordsAnalyzer` type ([#732](https://github.com/arangodb/arangojs/issues/732))
|
|
104
364
|
|
|
105
|
-
- Added missing `details`
|
|
365
|
+
- Added missing `details` option to `collection.figures` ([#728](https://github.com/arangodb/arangojs/issues/728))
|
|
106
366
|
|
|
107
|
-
- Added missing `inBackground`
|
|
367
|
+
- Added missing `inBackground` option to index options ([#734](https://github.com/arangodb/arangojs/issues/734))
|
|
108
368
|
|
|
109
369
|
## [7.5.0] - 2021-04-22
|
|
110
370
|
|
|
@@ -1292,6 +1552,7 @@ For a detailed list of changes between pre-release versions of v7 see the
|
|
|
1292
1552
|
|
|
1293
1553
|
Graph methods now only return the relevant part of the response body.
|
|
1294
1554
|
|
|
1555
|
+
[8.0.0]: https://github.com/arangodb/arangojs/compare/v7.8.0...v8.0.0
|
|
1295
1556
|
[7.8.0]: https://github.com/arangodb/arangojs/compare/v7.7.0...v7.8.0
|
|
1296
1557
|
[7.7.0]: https://github.com/arangodb/arangojs/compare/v7.6.1...v7.7.0
|
|
1297
1558
|
[7.6.1]: https://github.com/arangodb/arangojs/compare/v7.6.0...v7.6.1
|
package/CONTRIBUTING.md
CHANGED
|
@@ -20,7 +20,7 @@ yarn test
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
By default the tests will be run against a server listening on
|
|
23
|
-
`http://
|
|
23
|
+
`http://127.0.0.1:8529` (using username `root` with no password). To
|
|
24
24
|
override this, you can set the environment variable `TEST_ARANGODB_URL` to
|
|
25
25
|
something different:
|
|
26
26
|
|
package/MIGRATING.md
CHANGED
|
@@ -1,5 +1,129 @@
|
|
|
1
1
|
# Migrating
|
|
2
2
|
|
|
3
|
+
## v7 to v8
|
|
4
|
+
|
|
5
|
+
Version 8 drops support for Internet Explorer 11 and Node.js 10 and 12. If you
|
|
6
|
+
need to continue supporting Internet Explorer, you can try transpiling arangojs
|
|
7
|
+
as a dependency using Babel with the relevant polyfills.
|
|
8
|
+
|
|
9
|
+
### General
|
|
10
|
+
|
|
11
|
+
In TypeScript the type `Dict<T>` has been removed from the `connection` module.
|
|
12
|
+
The built-in type `Record<string, T>` can be used as a replacement:
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
import { Database } from "arangojs";
|
|
16
|
+
-import type { Dict } from "arangojs/connection";
|
|
17
|
+
|
|
18
|
+
const db = new Database();
|
|
19
|
+
-let deps: Dict<string | string[] | undefined>;
|
|
20
|
+
+let deps: Record<string, string | string[] | undefined>;
|
|
21
|
+
deps = await db.getServiceDependencies("/my-foxx-service", true);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Default URL
|
|
25
|
+
|
|
26
|
+
The default URL has been changed to `http://127.0.0.1:8529` to match the ArangoDB
|
|
27
|
+
default. Previously the default URL was `http://localhost:8529`, which on some
|
|
28
|
+
systems would resolve to the IPv6 address `::1` instead.
|
|
29
|
+
|
|
30
|
+
If you don't want to use the IPv4 address `127.0.0.1` and instead want to continue
|
|
31
|
+
letting the operating system resolve `localhost`, you can pass the URL explicitly:
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
import { Database } from "arangojs";
|
|
35
|
+
|
|
36
|
+
const db = new Database({
|
|
37
|
+
+ url: "http://localhost:8529"
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Databases
|
|
42
|
+
|
|
43
|
+
Previously arangojs allowed changing the database using the deprecated
|
|
44
|
+
`db.useDatabase` method. This could make it difficult to remember which
|
|
45
|
+
database you were interacting with. Instead, you should create a new `Database`
|
|
46
|
+
instance for each database you want to interact with using the `db.database`
|
|
47
|
+
method:
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
import { Database } from "arangojs";
|
|
51
|
+
|
|
52
|
+
const db = new Database();
|
|
53
|
+
-db.useDatabase("database2");
|
|
54
|
+
+const db2 = db.database("database2");
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Queries
|
|
58
|
+
|
|
59
|
+
The functions `aql.literal` and `aql.join` are no longer available as methods
|
|
60
|
+
on the `aql` template handler and need to be imported separately:
|
|
61
|
+
|
|
62
|
+
```diff
|
|
63
|
+
import { aql } from "arangojs";
|
|
64
|
+
+import { join } from "arangojs/aql";
|
|
65
|
+
|
|
66
|
+
-const filters = aql.join([
|
|
67
|
+
+const filters = join([
|
|
68
|
+
aql`FILTER size == 'big'`,
|
|
69
|
+
aql`FILTER color == 'yellow'`
|
|
70
|
+
]);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Users
|
|
74
|
+
|
|
75
|
+
The return values of `db.getUserDatabases` and `db.getUserAccessLevel` have
|
|
76
|
+
been changed to match the documented return types:
|
|
77
|
+
|
|
78
|
+
```diff
|
|
79
|
+
import { Database } from "arangojs";
|
|
80
|
+
|
|
81
|
+
const db = new Database();
|
|
82
|
+
-const dbs = (await db.getUserDatabases("ash")).result;
|
|
83
|
+
+const dbs = await db.getUserDatabases("ash");
|
|
84
|
+
for (const [db, obj] of Object.entries(dbs)) {
|
|
85
|
+
console.log(`${db}: ${obj.permission}`);
|
|
86
|
+
for (const [col, access] of Object.entries(obj.collections)) {
|
|
87
|
+
console.log(`${db}/${col}: ${access}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
-const access = (await db.getUserAccessLevel("ash", "pokemons")).result;
|
|
92
|
+
+const access = await db.getUserAccessLevel("ash", "pokemons");
|
|
93
|
+
if (access === "rw") {
|
|
94
|
+
db.collection("pokemons").save({ name: "Pikachu" });
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Graphs
|
|
99
|
+
|
|
100
|
+
In TypeScript the type `GraphCreateOptions` has been renamed to
|
|
101
|
+
`CreateGraphOptions`:
|
|
102
|
+
|
|
103
|
+
```diff
|
|
104
|
+
-import type { GraphCreateOptions } from "arangojs/graph";
|
|
105
|
+
+import type { CreateGraphOptions } from "arangojs/graph";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Enum re-exports
|
|
109
|
+
|
|
110
|
+
Previously the `CollectionStatus`, `CollectionType` and `ViewType` enums
|
|
111
|
+
were re-exported by the arangojs main module and could be imported from the
|
|
112
|
+
`arangojs` package:
|
|
113
|
+
|
|
114
|
+
```diff
|
|
115
|
+
-import { CollectionStatus, CollectionType } from "arangojs";
|
|
116
|
+
+import { CollectionStatus, CollectionType } from "arangojs/collection";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Note that the `ViewType` enum has been removed completely:
|
|
120
|
+
|
|
121
|
+
````diff
|
|
122
|
+
-import { ViewType } from "arangojs";
|
|
123
|
+
-
|
|
124
|
+
-const ArangoSearchViewType = ViewType.ARANGOSEARCH_VIEW;
|
|
125
|
+
+const ArangoSearchViewType = "arangosearch";
|
|
126
|
+
|
|
3
127
|
## v6 to v7
|
|
4
128
|
|
|
5
129
|
### Configuration changes
|
|
@@ -12,11 +136,11 @@ arangojs instance. The database name can now be specified using the
|
|
|
12
136
|
|
|
13
137
|
```diff
|
|
14
138
|
const db = new Database({
|
|
15
|
-
url: "http://
|
|
139
|
+
url: "http://127.0.0.1:8529",
|
|
16
140
|
+ databaseName: "my_database",
|
|
17
141
|
});
|
|
18
142
|
-db.useDatabase("my_database");
|
|
19
|
-
|
|
143
|
+
````
|
|
20
144
|
|
|
21
145
|
### Shared connection pool
|
|
22
146
|
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ When using modern JavaScript tooling with a bundler and compiler (e.g. Babel),
|
|
|
31
31
|
arangojs can be installed using `npm` or `yarn` like any other dependency.
|
|
32
32
|
|
|
33
33
|
For use without a compiler, the npm release comes with a precompiled browser
|
|
34
|
-
build for evergreen browsers
|
|
34
|
+
build for evergreen browsers:
|
|
35
35
|
|
|
36
36
|
```js
|
|
37
37
|
var arangojs = require("arangojs/web");
|
|
@@ -40,24 +40,19 @@ var arangojs = require("arangojs/web");
|
|
|
40
40
|
You can also use [unpkg](https://unpkg.com) during development:
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
< !-- note the path includes the version number (e.g.
|
|
44
|
-
<script src="https://unpkg.com/arangojs@
|
|
43
|
+
< !-- note the path includes the version number (e.g. 8.0.0) -- >
|
|
44
|
+
<script src="https://unpkg.com/arangojs@8.0.0/web.js"></script>
|
|
45
45
|
<script>
|
|
46
46
|
var db = new arangojs.Database();
|
|
47
47
|
// ...
|
|
48
48
|
</script>
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
If you are targetting browsers older than Internet Explorer 11 you may want to
|
|
52
|
-
use [babel](https://babeljs.io) with a
|
|
53
|
-
[polyfill](https://babeljs.io/docs/usage/polyfill) to provide missing
|
|
54
|
-
functionality needed to use arangojs.
|
|
55
|
-
|
|
56
51
|
When loading the browser build with a script tag make sure to load the polyfill first:
|
|
57
52
|
|
|
58
53
|
```html
|
|
59
54
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js"></script>
|
|
60
|
-
<script src="https://unpkg.com/arangojs@
|
|
55
|
+
<script src="https://unpkg.com/arangojs@8.0.0/web.js"></script>
|
|
61
56
|
```
|
|
62
57
|
|
|
63
58
|
## Basic usage example
|
|
@@ -94,13 +89,12 @@ Using a different database:
|
|
|
94
89
|
|
|
95
90
|
```js
|
|
96
91
|
const db = new Database({
|
|
97
|
-
url: "http://
|
|
92
|
+
url: "http://127.0.0.1:8529",
|
|
98
93
|
databaseName: "pancakes",
|
|
99
94
|
auth: { username: "root", password: "hunter2" },
|
|
100
95
|
});
|
|
101
96
|
|
|
102
|
-
// The
|
|
103
|
-
db.useDatabase("waffles");
|
|
97
|
+
// The credentials can be swapped at any time
|
|
104
98
|
db.useBasicAuth("admin", "maplesyrup");
|
|
105
99
|
```
|
|
106
100
|
|
|
@@ -175,7 +169,7 @@ receiving a response, the underlying system error will be thrown instead.
|
|
|
175
169
|
Please make sure you are using the latest version of this driver and that the
|
|
176
170
|
version of the arangojs documentation you are reading matches that version.
|
|
177
171
|
|
|
178
|
-
Changes in the major version number of arangojs (e.g.
|
|
172
|
+
Changes in the major version number of arangojs (e.g. 7.x.y -> 8.0.0) indicate
|
|
179
173
|
backwards-incompatible changes in the arangojs API that may require changes in
|
|
180
174
|
your code when upgrading your version of arangojs.
|
|
181
175
|
|