arangojs 9.1.0 → 10.0.0-alpha.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.
Files changed (302) hide show
  1. package/CHANGELOG.md +371 -0
  2. package/MIGRATING.md +50 -0
  3. package/README.md +43 -41
  4. package/administration.d.ts +346 -0
  5. package/administration.d.ts.map +1 -0
  6. package/analyzers.d.ts +711 -0
  7. package/analyzers.d.ts.map +1 -0
  8. package/aql.d.ts +5 -5
  9. package/aql.d.ts.map +1 -1
  10. package/cjs/administration.d.ts +346 -0
  11. package/cjs/administration.d.ts.map +1 -0
  12. package/cjs/administration.js +13 -0
  13. package/cjs/administration.js.map +1 -0
  14. package/cjs/analyzers.d.ts +711 -0
  15. package/cjs/analyzers.d.ts.map +1 -0
  16. package/cjs/{analyzer.js → analyzers.js} +38 -6
  17. package/cjs/analyzers.js.map +1 -0
  18. package/cjs/aql.d.ts +5 -5
  19. package/cjs/aql.d.ts.map +1 -1
  20. package/cjs/aql.js +33 -10
  21. package/cjs/aql.js.map +1 -1
  22. package/cjs/cluster.d.ts +178 -0
  23. package/cjs/cluster.d.ts.map +1 -0
  24. package/cjs/cluster.js +13 -0
  25. package/cjs/cluster.js.map +1 -0
  26. package/cjs/{collection.d.ts → collections.d.ts} +400 -830
  27. package/cjs/collections.d.ts.map +1 -0
  28. package/cjs/{collection.js → collections.js} +72 -41
  29. package/cjs/collections.js.map +1 -0
  30. package/cjs/connection.d.ts +61 -31
  31. package/cjs/connection.d.ts.map +1 -1
  32. package/cjs/connection.js +116 -91
  33. package/cjs/connection.js.map +1 -1
  34. package/{esm/cursor.d.ts → cjs/cursors.d.ts} +82 -59
  35. package/cjs/cursors.d.ts.map +1 -0
  36. package/cjs/{cursor.js → cursors.js} +76 -43
  37. package/cjs/cursors.js.map +1 -0
  38. package/cjs/{database.d.ts → databases.d.ts} +382 -1841
  39. package/cjs/databases.d.ts.map +1 -0
  40. package/cjs/{database.js → databases.js} +272 -220
  41. package/cjs/databases.js.map +1 -0
  42. package/cjs/documents.d.ts +445 -13
  43. package/cjs/documents.d.ts.map +1 -1
  44. package/cjs/documents.js +2 -1
  45. package/cjs/documents.js.map +1 -1
  46. package/cjs/errors.d.ts +192 -0
  47. package/cjs/errors.d.ts.map +1 -0
  48. package/cjs/errors.js +334 -0
  49. package/cjs/errors.js.map +1 -0
  50. package/cjs/foxx-manifest.d.ts +1 -1
  51. package/cjs/foxx-manifest.d.ts.map +1 -1
  52. package/cjs/foxx-manifest.js +1 -1
  53. package/cjs/foxx-manifest.js.map +1 -1
  54. package/cjs/{graph.d.ts → graphs.d.ts} +134 -109
  55. package/cjs/graphs.d.ts.map +1 -0
  56. package/cjs/{graph.js → graphs.js} +120 -73
  57. package/cjs/graphs.js.map +1 -0
  58. package/cjs/hot-backups.d.ts +68 -0
  59. package/cjs/hot-backups.d.ts.map +1 -0
  60. package/cjs/hot-backups.js +12 -0
  61. package/cjs/hot-backups.js.map +1 -0
  62. package/cjs/index.d.ts +8 -8
  63. package/cjs/index.d.ts.map +1 -1
  64. package/cjs/index.js +28 -5
  65. package/cjs/index.js.map +1 -1
  66. package/cjs/indexes.d.ts +267 -327
  67. package/cjs/indexes.d.ts.map +1 -1
  68. package/cjs/indexes.js +2 -1
  69. package/cjs/indexes.js.map +1 -1
  70. package/{esm/job.d.ts → cjs/jobs.d.ts} +27 -12
  71. package/cjs/jobs.d.ts.map +1 -0
  72. package/cjs/{job.js → jobs.js} +10 -2
  73. package/cjs/jobs.js.map +1 -0
  74. package/cjs/lib/request.d.ts +9 -18
  75. package/cjs/lib/request.d.ts.map +1 -1
  76. package/cjs/lib/request.js +50 -34
  77. package/cjs/lib/request.js.map +1 -1
  78. package/cjs/logs.d.ts +92 -0
  79. package/cjs/logs.d.ts.map +1 -0
  80. package/cjs/logs.js +26 -0
  81. package/cjs/logs.js.map +1 -0
  82. package/cjs/queries.d.ts +502 -0
  83. package/cjs/queries.d.ts.map +1 -0
  84. package/cjs/queries.js +13 -0
  85. package/cjs/queries.js.map +1 -0
  86. package/cjs/{route.d.ts → routes.d.ts} +33 -21
  87. package/cjs/routes.d.ts.map +1 -0
  88. package/cjs/{route.js → routes.js} +19 -1
  89. package/cjs/routes.js.map +1 -0
  90. package/cjs/services.d.ts +514 -0
  91. package/cjs/services.d.ts.map +1 -0
  92. package/cjs/services.js +4 -0
  93. package/cjs/services.js.map +1 -0
  94. package/{esm/transaction.d.ts → cjs/transactions.d.ts} +121 -14
  95. package/cjs/transactions.d.ts.map +1 -0
  96. package/cjs/{transaction.js → transactions.js} +86 -6
  97. package/cjs/transactions.js.map +1 -0
  98. package/cjs/users.d.ts +96 -0
  99. package/cjs/users.d.ts.map +1 -0
  100. package/cjs/users.js +4 -0
  101. package/cjs/users.js.map +1 -0
  102. package/{esm/view.d.ts → cjs/views.d.ts} +212 -201
  103. package/cjs/views.d.ts.map +1 -0
  104. package/cjs/{view.js → views.js} +44 -7
  105. package/cjs/views.js.map +1 -0
  106. package/cluster.d.ts +178 -0
  107. package/cluster.d.ts.map +1 -0
  108. package/{collection.d.ts → collections.d.ts} +400 -830
  109. package/collections.d.ts.map +1 -0
  110. package/connection.d.ts +61 -31
  111. package/connection.d.ts.map +1 -1
  112. package/{cursor.d.ts → cursors.d.ts} +82 -59
  113. package/cursors.d.ts.map +1 -0
  114. package/{database.d.ts → databases.d.ts} +382 -1841
  115. package/databases.d.ts.map +1 -0
  116. package/documents.d.ts +445 -13
  117. package/documents.d.ts.map +1 -1
  118. package/errors.d.ts +192 -0
  119. package/errors.d.ts.map +1 -0
  120. package/esm/administration.d.ts +346 -0
  121. package/esm/administration.d.ts.map +1 -0
  122. package/esm/administration.js +12 -0
  123. package/esm/administration.js.map +1 -0
  124. package/esm/analyzers.d.ts +711 -0
  125. package/esm/analyzers.d.ts.map +1 -0
  126. package/esm/{analyzer.js → analyzers.js} +15 -6
  127. package/esm/analyzers.js.map +1 -0
  128. package/esm/aql.d.ts +5 -5
  129. package/esm/aql.d.ts.map +1 -1
  130. package/esm/aql.js +10 -10
  131. package/esm/aql.js.map +1 -1
  132. package/esm/cluster.d.ts +178 -0
  133. package/esm/cluster.d.ts.map +1 -0
  134. package/esm/cluster.js +12 -0
  135. package/esm/cluster.js.map +1 -0
  136. package/esm/{collection.d.ts → collections.d.ts} +400 -830
  137. package/esm/collections.d.ts.map +1 -0
  138. package/esm/{collection.js → collections.js} +49 -41
  139. package/esm/collections.js.map +1 -0
  140. package/esm/connection.d.ts +61 -31
  141. package/esm/connection.d.ts.map +1 -1
  142. package/esm/connection.js +94 -92
  143. package/esm/connection.js.map +1 -1
  144. package/{cjs/cursor.d.ts → esm/cursors.d.ts} +82 -59
  145. package/esm/cursors.d.ts.map +1 -0
  146. package/esm/{cursor.js → cursors.js} +73 -40
  147. package/esm/cursors.js.map +1 -0
  148. package/esm/{database.d.ts → databases.d.ts} +382 -1841
  149. package/esm/databases.d.ts.map +1 -0
  150. package/esm/{database.js → databases.js} +248 -219
  151. package/esm/databases.js.map +1 -0
  152. package/esm/documents.d.ts +445 -13
  153. package/esm/documents.d.ts.map +1 -1
  154. package/esm/documents.js +2 -1
  155. package/esm/documents.js.map +1 -1
  156. package/esm/errors.d.ts +192 -0
  157. package/esm/errors.d.ts.map +1 -0
  158. package/esm/errors.js +321 -0
  159. package/esm/errors.js.map +1 -0
  160. package/esm/foxx-manifest.d.ts +1 -1
  161. package/esm/foxx-manifest.d.ts.map +1 -1
  162. package/esm/foxx-manifest.js +1 -1
  163. package/esm/foxx-manifest.js.map +1 -1
  164. package/esm/{graph.d.ts → graphs.d.ts} +134 -109
  165. package/esm/graphs.d.ts.map +1 -0
  166. package/esm/{graph.js → graphs.js} +95 -71
  167. package/esm/graphs.js.map +1 -0
  168. package/esm/hot-backups.d.ts +68 -0
  169. package/esm/hot-backups.d.ts.map +1 -0
  170. package/esm/hot-backups.js +11 -0
  171. package/esm/hot-backups.js.map +1 -0
  172. package/esm/index.d.ts +8 -8
  173. package/esm/index.d.ts.map +1 -1
  174. package/esm/index.js +4 -4
  175. package/esm/index.js.map +1 -1
  176. package/esm/indexes.d.ts +267 -327
  177. package/esm/indexes.d.ts.map +1 -1
  178. package/esm/indexes.js +2 -1
  179. package/esm/indexes.js.map +1 -1
  180. package/{job.d.ts → esm/jobs.d.ts} +27 -12
  181. package/esm/jobs.d.ts.map +1 -0
  182. package/esm/{job.js → jobs.js} +10 -2
  183. package/esm/jobs.js.map +1 -0
  184. package/esm/lib/request.d.ts +9 -18
  185. package/esm/lib/request.d.ts.map +1 -1
  186. package/esm/lib/request.js +49 -33
  187. package/esm/lib/request.js.map +1 -1
  188. package/esm/logs.d.ts +92 -0
  189. package/esm/logs.d.ts.map +1 -0
  190. package/esm/logs.js +23 -0
  191. package/esm/logs.js.map +1 -0
  192. package/esm/queries.d.ts +502 -0
  193. package/esm/queries.d.ts.map +1 -0
  194. package/esm/queries.js +12 -0
  195. package/esm/queries.js.map +1 -0
  196. package/esm/{route.d.ts → routes.d.ts} +33 -21
  197. package/esm/routes.d.ts.map +1 -0
  198. package/esm/{route.js → routes.js} +19 -1
  199. package/esm/routes.js.map +1 -0
  200. package/esm/services.d.ts +514 -0
  201. package/esm/services.d.ts.map +1 -0
  202. package/esm/services.js +3 -0
  203. package/esm/services.js.map +1 -0
  204. package/{transaction.d.ts → esm/transactions.d.ts} +121 -14
  205. package/esm/transactions.d.ts.map +1 -0
  206. package/esm/{transaction.js → transactions.js} +61 -5
  207. package/esm/transactions.js.map +1 -0
  208. package/esm/users.d.ts +96 -0
  209. package/esm/users.d.ts.map +1 -0
  210. package/esm/users.js +3 -0
  211. package/esm/users.js.map +1 -0
  212. package/{cjs/view.d.ts → esm/views.d.ts} +212 -201
  213. package/esm/views.d.ts.map +1 -0
  214. package/esm/{view.js → views.js} +21 -7
  215. package/esm/views.js.map +1 -0
  216. package/foxx-manifest.d.ts +1 -1
  217. package/foxx-manifest.d.ts.map +1 -1
  218. package/{graph.d.ts → graphs.d.ts} +134 -109
  219. package/graphs.d.ts.map +1 -0
  220. package/hot-backups.d.ts +68 -0
  221. package/hot-backups.d.ts.map +1 -0
  222. package/index.d.ts +8 -8
  223. package/index.d.ts.map +1 -1
  224. package/indexes.d.ts +267 -327
  225. package/indexes.d.ts.map +1 -1
  226. package/{cjs/job.d.ts → jobs.d.ts} +27 -12
  227. package/jobs.d.ts.map +1 -0
  228. package/lib/request.d.ts +9 -18
  229. package/lib/request.d.ts.map +1 -1
  230. package/logs.d.ts +92 -0
  231. package/logs.d.ts.map +1 -0
  232. package/package.json +1 -1
  233. package/queries.d.ts +502 -0
  234. package/queries.d.ts.map +1 -0
  235. package/{route.d.ts → routes.d.ts} +33 -21
  236. package/routes.d.ts.map +1 -0
  237. package/services.d.ts +514 -0
  238. package/services.d.ts.map +1 -0
  239. package/{cjs/transaction.d.ts → transactions.d.ts} +121 -14
  240. package/transactions.d.ts.map +1 -0
  241. package/users.d.ts +96 -0
  242. package/users.d.ts.map +1 -0
  243. package/{view.d.ts → views.d.ts} +212 -201
  244. package/views.d.ts.map +1 -0
  245. package/analyzer.d.ts +0 -950
  246. package/analyzer.d.ts.map +0 -1
  247. package/cjs/analyzer.d.ts +0 -950
  248. package/cjs/analyzer.d.ts.map +0 -1
  249. package/cjs/analyzer.js.map +0 -1
  250. package/cjs/collection.d.ts.map +0 -1
  251. package/cjs/collection.js.map +0 -1
  252. package/cjs/cursor.d.ts.map +0 -1
  253. package/cjs/cursor.js.map +0 -1
  254. package/cjs/database.d.ts.map +0 -1
  255. package/cjs/database.js.map +0 -1
  256. package/cjs/error.d.ts +0 -94
  257. package/cjs/error.d.ts.map +0 -1
  258. package/cjs/error.js +0 -189
  259. package/cjs/error.js.map +0 -1
  260. package/cjs/graph.d.ts.map +0 -1
  261. package/cjs/graph.js.map +0 -1
  262. package/cjs/job.d.ts.map +0 -1
  263. package/cjs/job.js.map +0 -1
  264. package/cjs/route.d.ts.map +0 -1
  265. package/cjs/route.js.map +0 -1
  266. package/cjs/transaction.d.ts.map +0 -1
  267. package/cjs/transaction.js.map +0 -1
  268. package/cjs/view.d.ts.map +0 -1
  269. package/cjs/view.js.map +0 -1
  270. package/collection.d.ts.map +0 -1
  271. package/cursor.d.ts.map +0 -1
  272. package/database.d.ts.map +0 -1
  273. package/error.d.ts +0 -94
  274. package/error.d.ts.map +0 -1
  275. package/esm/analyzer.d.ts +0 -950
  276. package/esm/analyzer.d.ts.map +0 -1
  277. package/esm/analyzer.js.map +0 -1
  278. package/esm/collection.d.ts.map +0 -1
  279. package/esm/collection.js.map +0 -1
  280. package/esm/cursor.d.ts.map +0 -1
  281. package/esm/cursor.js.map +0 -1
  282. package/esm/database.d.ts.map +0 -1
  283. package/esm/database.js.map +0 -1
  284. package/esm/error.d.ts +0 -94
  285. package/esm/error.d.ts.map +0 -1
  286. package/esm/error.js +0 -181
  287. package/esm/error.js.map +0 -1
  288. package/esm/graph.d.ts.map +0 -1
  289. package/esm/graph.js.map +0 -1
  290. package/esm/job.d.ts.map +0 -1
  291. package/esm/job.js.map +0 -1
  292. package/esm/route.d.ts.map +0 -1
  293. package/esm/route.js.map +0 -1
  294. package/esm/transaction.d.ts.map +0 -1
  295. package/esm/transaction.js.map +0 -1
  296. package/esm/view.d.ts.map +0 -1
  297. package/esm/view.js.map +0 -1
  298. package/graph.d.ts.map +0 -1
  299. package/job.d.ts.map +0 -1
  300. package/route.d.ts.map +0 -1
  301. package/transaction.d.ts.map +0 -1
  302. package/view.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,373 @@ 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
+ ## [10.0.0-alpha.0] - 2024-11-28
18
+
19
+ This is a major release and breaks backwards compatibility.
20
+
21
+ See [the migration guide](./MIGRATING.md#v9-to-v10) for detailed instructions
22
+ for upgrading your code to arangojs v10.
23
+
24
+ ### Removed
25
+
26
+ - Removed unused `CreateUserOptions` type
27
+
28
+ The actual type used by the `db.createUser` method is still `UserOptions`.
29
+
30
+ - Removed unused `IndexDetails` type
31
+
32
+ This type was intended to be returned by `collection.indexes` when the
33
+ `withStats` option is set to `true` but the `figures` property is already
34
+ included in the current return type.
35
+
36
+ ### Changed
37
+
38
+ - Changed `QueueTimeMetrics` type to an interface
39
+
40
+ - Changed `CursorExtras` and `CursorStats` interfaces to types
41
+
42
+ - Changed `GraphVertexCollection` and `GraphEdgeCollection` generic types to
43
+ take separate `EntryResultType` and `EntryInputType` type parameters
44
+
45
+ - Changed `db.collection`, `db.createCollection` and `db.createEdgeCollection`
46
+ methods to take separate `EntryResultType` and `EntryInputType` type
47
+ parameters
48
+
49
+ These type parameters are used to narrow the the returned collection type.
50
+
51
+ - Renamed `db.listServiceScripts` method to `db.getServiceScripts`
52
+ - Renamed `db.listHotBackups` method to `db.getHotBackups`
53
+ - Renamed `db.getLogMessages` method to `db.listLogMessages`
54
+ - Renamed `db.listFunctions` method to `db.listUserFunctions`
55
+ - Renamed `db.createFunction` method to `db.createUserFunction`
56
+ - Renamed `db.dropFunction` method to `db.dropUserFunction`
57
+ - Changed `db.removeUser` method to return `void`
58
+
59
+ #### Module renaming
60
+
61
+ - Renamed most modules to plural form for consistency
62
+
63
+ The following modules were renamed:
64
+
65
+ - `arangojs/analyzer` -> `arangojs/analyzers`
66
+ - `arangojs/collection` -> `arangojs/collections`
67
+ - `arangojs/cursor` -> `arangojs/cursors`
68
+ - `arangojs/database` -> `arangojs/databases`
69
+ - `arangojs/error` -> `arangojs/errors`
70
+ - `arangojs/graph` -> `arangojs/graphs`
71
+ - `arangojs/job` -> `arangojs/jobs`
72
+ - `arangojs/route` -> `arangojs/routes`
73
+ - `arangojs/transaction` -> `arangojs/transactions`
74
+ - `arangojs/view` -> `arangojs/views`
75
+
76
+ #### Moved types
77
+
78
+ - Moved document related types from `arangojs/collection` module to
79
+ `arangojs/documents` module
80
+
81
+ The following types were moved: `DocumentOperationFailure`,
82
+ `DocumentOperationMetadata`, `DocumentExistsOptions`,
83
+ `CollectionReadOptions`, `CollectionBatchReadOptions`,
84
+ `CollectionInsertOptions`, `CollectionReplaceOptions`,
85
+ `CollectionUpdateOptions`, `CollectionRemoveOptions`,
86
+ `CollectionImportOptions`, `CollectionEdgesOptions`,
87
+ `CollectionImportResult` and `CollectionEdgesResult`
88
+
89
+ - Moved index related types from `arangojs/collection` module to
90
+ `arangojs/indexes` module
91
+
92
+ The following types were moved: `IndexListOptions`.
93
+
94
+ - Moved transaction related types from `arangojs/database` module to
95
+ `arangojs/transactions` module
96
+
97
+ The following types were moved: `TransactionCollections`,
98
+ `TransactionOptions` and `TransactionDetails`.
99
+
100
+ - Moved cluster related types from `arangojs/database` module to new
101
+ `arangojs/clusters` module
102
+
103
+ The following types were moved: `ClusterImbalanceInfo`,
104
+ `ClusterRebalanceState`, `ClusterRebalanceOptions`, `ClusterRebalanceMove`
105
+ and `ClusterRebalanceResult`.
106
+
107
+ - Moved hot backup related types from `arangojs/database` module to new
108
+ `arangojs/hot-backups` module
109
+
110
+ The following types were moved: `HotBackupOptions`, `HotBackupResult` and
111
+ `HotBackupList`.
112
+
113
+ - Moved query related types from `arangojs/database` module to new
114
+ `arangojs/queries` module
115
+
116
+ The following types were moved: `QueryOptions`, `ExplainOptions`,
117
+ `ExplainPlan`, `ExplainStats`, `SingleExplainResult`, `MultiExplainResult`,
118
+ `AstNode`, `ParseResult`, `QueryOptimizerRule`, `QueryTracking`,
119
+ `QueryTrackingOptions`, `QueryInfo` and `AqlUserFunction`.
120
+
121
+ - Moved service related types from `arangojs/database` module to new
122
+ `arangojs/services` module
123
+
124
+ The following types were moved: `InstallServiceOptions`,
125
+ `ReplaceServiceOptions`, `UpgradeServiceOptions`, `UninstallServiceOptions`,
126
+ `ServiceSummary`, `ServiceInfo`, `ServiceConfiguration`,
127
+ `SingleServiceDependency`, `MultiServiceDependency`, `ServiceTestStats`,
128
+ `ServiceTestStreamTest`, `ServiceTestStreamReport`, `ServiceTestSuiteTest`,
129
+ `ServiceTestSuite`, `ServiceTestSuiteReport`, `ServiceTestXunitTest`,
130
+ `ServiceTestXunitReport`, `ServiceTestTapReport`, `ServiceTestDefaultTest`,
131
+ `ServiceTestDefaultReport` and `SwaggerJson`.
132
+
133
+ - Moved user related types from `arangojs/database` module to new
134
+ `arangojs/users` module
135
+
136
+ The following types were moved: `AccessLevel`, `ArangoUser`, `UserOptions`,
137
+ `UserAccessLevelOptions` and `CreateDatabaseUser`.
138
+
139
+ - Moved server administration related types from `arangojs/database` module to
140
+ new `arangojs/administration` module
141
+
142
+ The following types were moved: `QueueTimeMetrics` and `VersionInfo`.
143
+
144
+ #### Renamed types
145
+
146
+ - Renamed `Index` types to `IndexDescription` for consistency
147
+
148
+ The specific index types were also renamed accordingly:
149
+
150
+ - `Index` -> `IndexDescription`
151
+ - `GeoIndex` -> `GeoIndexDescription`
152
+ - `PersistentIndex` -> `PersistentIndexDescription`
153
+ - `PrimaryIndex` -> `PrimaryIndexDescription`
154
+ - `TtlIndex` -> `TtlIndexDescription`
155
+ - `MdiIndex` -> `MdiIndexDescription`
156
+ - `InvertedIndex` -> `InvertedIndexDescription`
157
+ - `InternalArangosearchIndex` -> `ArangosearchIndexDescription`
158
+ - `InternalIndex` -> `InternalIndexDescription`
159
+ - `HiddenIndex` -> `HiddenIndexDescription`
160
+
161
+ Note that the "Internal" prefix was dropped from `ArangosearchIndexDescription`
162
+ to more accurately reflect the index type name. The index type still refers
163
+ to an internal index, however.
164
+
165
+ - Renamed various types for consistency:
166
+
167
+ - `AqlUserFunction` -> `UserFunctionDescription`
168
+ - `CollectionMetadata` -> `CollectionDescription`
169
+ - `DatabaseInfo` -> `DatabaseDescription`
170
+ - `GraphInfo` -> `GraphDescription`
171
+ - `ServiceInfo` -> `ServiceDescription`
172
+ - `QueryInfo` -> `QueryDescription`
173
+ - `QueryTracking` -> `QueryTrackingInfo`
174
+ - `TransactionDetails` -> `TransactionInfo`
175
+ - `TransactionCollections` -> `TransactionCollectionOptions`
176
+ - `CreateDatabaseUser` -> `CreateDatabaseUserOptions`
177
+
178
+ - Index operations:
179
+ - `IndexListOptions` -> `ListIndexesOptions`
180
+
181
+ - Collection document operations:
182
+ - `DocumentExistsOptions` -> `DocumentExistsOptions`
183
+ - `CollectionReadOptions` -> `ReadDocumentOptions`
184
+ - `CollectionBatchReadOptions` -> `BulkReadDocumentsOptions`
185
+ - `CollectionInsertOptions` -> `InsertDocumentOptions`
186
+ - `CollectionReplaceOptions` -> `ReplaceDocumentOptions`
187
+ - `CollectionUpdateOptions` -> `UpdateDocumentOptions`
188
+ - `CollectionRemoveOptions` -> `RemoveDocumentOptions`
189
+ - `CollectionImportOptions` -> `ImportDocumentsOptions`
190
+ - `CollectionEdgesOptions` -> `DocumentEdgesOptions`
191
+ - `CollectionImportResult` -> `ImportDocumentsResult`
192
+ - `CollectionEdgesResult` -> `DocumentEdgesResult`
193
+
194
+ - Graph collection document operation:
195
+ - `GraphCollectionReadOptions` -> `ReadGraphDocumentOptions`
196
+ - `GraphCollectionInsertOptions` -> `CreateGraphDocumentOptions`
197
+ - `GraphCollectionReplaceOptions` -> `ReplaceGraphDocumentOptions`
198
+ - `GraphCollectionRemoveOptions` -> `RemoveGraphDocumentOptions`
199
+ - `ViewPatchPropertiesOptions` -> `UpdateViewPropertiesOptions`
200
+
201
+ - View operations:
202
+ - `ArangoSearchViewPatchPropertiesOptions` -> `UpdateArangoSearchViewPropertiesOptions`
203
+ - `SearchAliasViewPatchPropertiesOptions` -> `UpdateSearchAliasViewPropertiesOptions`
204
+ - `SearchAliasViewPatchIndexOptions` -> `UpdateSearchAliasViewIndexOptions`
205
+ - `ArangoSearchViewStoredValueOptions` -> `CreateArangoSearchViewStoredValueOptions`
206
+
207
+ - Renamed `ArrayCursor` and `BatchedArrayCursor` classes to `Cursor` and
208
+ `BatchCursor` respectively
209
+
210
+ The previous name was misleading because it conflicted with how the ArangoDB
211
+ distinguishes between array cursors and streaming cursors in the interactive
212
+ shell. This distinction does not apply to the driver.
213
+
214
+ - Renamed various types to reduce ambiguity:
215
+
216
+ - `ObjectWithId` (in `indexes` module) -> `ObjectWithIndexId`
217
+ - `ObjectWithId` (in `documents` module) -> `ObjectWithDocumentId`
218
+ - `ObjectWithKey` (in `documents` module) -> `ObjectWithDocumentKey`
219
+
220
+ #### Error handling
221
+
222
+ - Errors encountered before a request completes are now wrapped in a
223
+ `NetworkError` or a subclass thereof
224
+
225
+ This should help making it easier to diagnose network issues and distinguish
226
+ the relevant error conditions.
227
+
228
+ The originating error can still be accessed using the `cause` property of the
229
+ `NetworkError` error.
230
+
231
+ - `HttpError` now extends the `NetworkError` class
232
+
233
+ This allows treating all non-`ArangoError` errors as one category of errors,
234
+ even when there is no server response available.
235
+
236
+ - `db.waitForPropagation` now throws a `PropagationTimeoutError` error when
237
+ invoked with a `timeout` option and the timeout duration is exceeded
238
+
239
+ The method would previously throw the most recent error encountered while
240
+ waiting for replication. The originating error can still be accessed using
241
+ the `cause` property of the `PropagationTimeoutError` error.
242
+
243
+ - `db.waitForPropagation` now respects the `timeout` option more strictly
244
+
245
+ Previously the method would only time out if the timeout duration was
246
+ exceeded after the most recent request failed. Now the timeout is
247
+ recalculated and passed on to each request, preventing it from exceeding
248
+ the specified duration.
249
+
250
+ If the propagation timed out due to an underlying request exceeding the
251
+ timeout duration, the `cause` property of the `PropagationTimeoutError`
252
+ error will be a `ResponseTimeoutError` error.
253
+
254
+ - `config.beforeRequest` and `config.afterResponse` callbacks can now return
255
+ promises
256
+
257
+ If the callback returns a promise, it will be awaited before the request
258
+ and response cycle proceeds. If either callback throws an error or returns
259
+ a promise that is rejected, that error will be thrown instead.
260
+
261
+ - `config.afterResponse` callback signature changed
262
+
263
+ The callback signature previously used the internal `ArangojsResponse` type.
264
+ The new signature uses the `Response` type of the Fetch API with an
265
+ additional `request` property to more accurately represent the actual value
266
+ it receives as the `parsedBody` property will never be present.
267
+
268
+ - `response` property on `ArangoError` is now optional
269
+
270
+ This property should always be present but this allows using the error in
271
+ situations where a response might not be available.
272
+
273
+ ### Added
274
+
275
+ - Added `BatchCursor#itemsView` property and `BatchCursorItemsView` interface
276
+
277
+ This property provides a low-level interface for consuming the items of the
278
+ cursor and is used by the regular item-wise `Cursor` class internally.
279
+
280
+ - Added `onError` option to `Config` (DE-955)
281
+
282
+ This option can be used to specify a callback function that will be invoked
283
+ whenever a request results in an error. Unlike `afterResponse`, this callback
284
+ will be invoked even if the request completed but returned an error status.
285
+ In this case the error will be the `HttpError` or `ArangoError` representing
286
+ the error response.
287
+
288
+ If the `onError` callback throws an error or returns a promise that is
289
+ rejected, that error will be thrown instead.
290
+
291
+ - Added `NetworkError` class
292
+
293
+ This is the common base class for all errors (including `HttpError`) that
294
+ occur while making a request. The originating error can be accessed using the
295
+ `cause` property. The request object can be accessed using the `request`
296
+ property.
297
+
298
+ Note that `ArangoError` and the new `PropagationTimeoutError` error type
299
+ do not extend `NetworkError` but may wrap an underlying error, which can
300
+ be accessed using the `cause` property.
301
+
302
+ - Added `ResponseTimeoutError` class
303
+
304
+ This error extends `NetworkError` and is thrown when a request deliberately
305
+ times out using the `timeout` option.
306
+
307
+ - Added `RequestAbortedError` class
308
+
309
+ This error extends `NetworkError` and is thrown when a request is aborted
310
+ by using the `db.close` method.
311
+
312
+ - Added `FetchFailedError` class
313
+
314
+ This error extends `NetworkError` and is thrown when a request fails because
315
+ the underlying `fetch` call fails (usually with a `TypeError`).
316
+
317
+ In Node.js the root cause of this error (e.g. a network failure) can often be
318
+ found in the `cause` property of the originating error, i.e. the `cause`
319
+ property of the `cause` property of this error.
320
+
321
+ In browsers the root cause is usually not exposed directly but can often
322
+ be diagnosed by examining the developer console or network tab.
323
+
324
+ - Added `PropagationTimeoutError` class
325
+
326
+ This error does not extend `NetworkError` but wraps the most recent error
327
+ encountered while waiting for replication, which can be accessed using the
328
+ `cause` property. This error is only thrown when `db.waitForPropagation`
329
+ is invoked with a `timeout` option and the timeout duration is exceeded.
330
+
331
+ - Added `ProcessedResponse` type
332
+
333
+ This type replaces the previously internal `ArangojsResponse` type and
334
+ extends the native `Response` type with additional properties.
335
+
336
+ - Added optional `ArangoError#request` property
337
+
338
+ This property is always present if the error has a `response` property. In
339
+ normal use this should always be the case.
340
+
341
+ ## [9.2.0] - 2024-11-27
342
+
343
+ ### Added
344
+
345
+ - Added `database.availability` method
346
+
347
+ - Added `database.engine` method (DE-931)
348
+
349
+ - Added `database.status` method ([#811](https://github.com/arangodb/arangojs/issues/811))
350
+
351
+ - Added `database.supportInfo` method
352
+
353
+ - Added `keepNull` option to `CollectionInsertOptions` type (DE-946)
354
+
355
+ This option was previously missing from the type.
356
+
357
+ - Added `allowDirtyRead` option to `DocumentExistsOptions` type (DE-945)
358
+
359
+ This option was previously missing from the type.
360
+
361
+ - Added `ignoreRevs` option to `CollectionBatchReadOptions` type (DE-947)
362
+
363
+ This option was previously missing from the type.
364
+
365
+ - Added `options` argument to `CollectionTruncateOptions` type (DE-940)
366
+
367
+ There was previously no way to pass options to the `truncate` method.
368
+
369
+ - Added `database` property to `Analyzer`, `ArrayCursor`, `BatchedArrayCursor`,
370
+ `Collection`, `Graph`, `Job`, `Route`, `Transaction` and `View` (DE-935)
371
+
372
+ This property can be used to access the database instance a given object
373
+ belongs to.
374
+
375
+ - Added `Route#headers` and `Route#path` properties
376
+
377
+ These properties can be used to access the headers and path used when creating
378
+ the route.
379
+
380
+ - Added `ArrayCursor#id` and `BatchedArrayCursor#id` properties (DE-936)
381
+
382
+ This property can be used to access the ID of the cursor.
383
+
17
384
  ## [9.1.0] - 2024-09-25
18
385
 
19
386
  ### Changed
@@ -23,6 +390,8 @@ This driver uses semantic versioning:
23
390
  This property is only available when fetching indexes with the `withHidden`
24
391
  option set to `true`.
25
392
 
393
+ ### Added
394
+
26
395
  - Added `HiddenIndex` type (DE-849)
27
396
 
28
397
  This type is used to represent an index returned by `collection.indexes` when
@@ -1919,6 +2288,8 @@ For a detailed list of changes between pre-release versions of v7 see the
1919
2288
 
1920
2289
  Graph methods now only return the relevant part of the response body.
1921
2290
 
2291
+ [10.0.0-alpha.0]: https://github.com/arangodb/arangojs/compare/v9.2.0...v10.0.0-alpha.0
2292
+ [9.2.0]: https://github.com/arangodb/arangojs/compare/v9.1.0...v9.2.0
1922
2293
  [9.1.0]: https://github.com/arangodb/arangojs/compare/v9.0.0...v9.1.0
1923
2294
  [9.0.0]: https://github.com/arangodb/arangojs/compare/v8.8.1...v9.0.0
1924
2295
  [8.8.1]: https://github.com/arangodb/arangojs/compare/v8.8.0...v8.8.1
package/MIGRATING.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Migrating
2
2
 
3
+ ## v9 to v10
4
+
5
+ Version 10 changes the error handling to make it easier to diagnose network
6
+ issues and distinguish between different error conditions.
7
+
8
+ If you previously inspected errors other than `ArangoError` and `HttpError`
9
+ directly, you should now expect to see `NetworkError` or a subclass thereof
10
+ instead. The originating error can be found using the `cause` property of the
11
+ `NetworkError` error:
12
+
13
+ ```js
14
+ try {
15
+ await db.collection("my-collection").get();
16
+ } catch (err) {
17
+ if (err instanceof NetworkError) console.log(err.cause);
18
+ }
19
+ ```
20
+
21
+ ### Module name changes
22
+
23
+ Module names referring to resource types such as analyzers, collections,
24
+ databases, or views have been changed to use the plural form:
25
+
26
+ ```diff
27
+ -import { Database } from "arangojs/database";
28
+ +import { Database } from "arangojs/databases";
29
+ ```
30
+
31
+ Note that the `aql` module and `foxx-manifest` modules have not been renamed
32
+ as these are utility modules.
33
+
34
+ ### Type imports
35
+
36
+ Types that were previously exported by the `database` module but are not
37
+ related to managing databases have been moved to separate modules:
38
+
39
+ ```diff
40
+ -import type {
41
+ - ParseResult,
42
+ - TransactionOptions,
43
+ - VersionInfo
44
+ -} from "arangojs/database";
45
+ +import type { VersionInfo } from "arangojs/administration";
46
+ +import type { TransactionOptions } from "arangojs/transactions";
47
+ +import type { ParseResult } from "arangojs/queries";
48
+ ```
49
+
50
+ Additionally, some types were renamed. For a full list of changes, see the
51
+ [changelog](./CHANGELOG.md).
52
+
3
53
  ## v8 to v9
4
54
 
5
55
  Version 9 reverts the automatic NFC normalization introduced in v7.7.0. This
package/README.md CHANGED
@@ -36,7 +36,7 @@ You can also use [jsDelivr CDN](https://www.jsdelivr.com) during development:
36
36
  <script type="importmap">
37
37
  {
38
38
  "imports": {
39
- "arangojs": "https://cdn.jsdelivr.net/npm/arangojs@9.0.0-preview.1/esm/index.js?+esm"
39
+ "arangojs": "https://cdn.jsdelivr.net/npm/arangojs@9.0.0/esm/index.js?+esm"
40
40
  }
41
41
  }
42
42
  </script>
@@ -139,30 +139,51 @@ and [the `db` object](https://www.arangodb.com/docs/stable/appendix-references-d
139
139
 
140
140
  ## Error responses
141
141
 
142
- If arangojs encounters an API error, it will throw an `ArangoError` with
143
- an `errorNum` property indicating the ArangoDB error code and the `code`
144
- property indicating the HTTP status code from the response body.
142
+ If the server returns an ArangoDB error response, arangojs will throw an
143
+ `ArangoError` with an `errorNum` property indicating the ArangoDB error code
144
+ and expose the response body as the `response` property of the error object.
145
145
 
146
- For any other non-ArangoDB error responses (4xx/5xx status code), it will throw
147
- an `HttpError` error with the status code indicated by the `code` property.
146
+ For all other errors during the request/response cycle, arangojs will throw a
147
+ `NetworkError` or a more specific subclass thereof and expose the originating
148
+ request object as the `request` property of the error object.
148
149
 
149
- If the server response did not indicate an error but the response body could
150
- not be parsed, a regular `SyntaxError` may be thrown instead.
150
+ If the server responded with a non-2xx status code, this `NetworkError` will
151
+ be an `HttpError` with a `code` property indicating the HTTP status code of the
152
+ response and a `response` property containing the response object itself.
151
153
 
152
- In all of these cases the server response object will be exposed as the
153
- `response` property on the error object.
154
+ If the error is caused by an exception, the originating exception will be
155
+ available as the `cause` property of the error object thrown by arangojs. For
156
+ network errors, this will often be a `TypeError`.
154
157
 
155
- If the request failed at a network level or the connection was closed without
156
- receiving a response, the underlying system error will be thrown instead.
158
+ ### Node.js network errors
159
+
160
+ In Node.js, network errors caused by a `TypeError` will often have a `cause`
161
+ property containing a more detailed exception.
162
+
163
+ Specifically, these are often either system errors (represented by regular
164
+ `Error` objects with additional properties) or errors from the `undici` module
165
+ Node.js uses internally for its native `fetch` implementation.
166
+
167
+ Node.js system error objects provide a `code` property containing the specific
168
+ string error code, a `syscall` property identifying the underlying system call
169
+ that triggered the error (e.g. `connect`), as well as other helpful properties.
170
+
171
+ For more details on Node.js system errors, see the Node.js documentation of the
172
+ [`SystemError` interface](https://nodejs.org/api/errors.html#class-systemerror)
173
+ as well as the section on
174
+ [Node.js error codes](https://nodejs.org/api/errors.html#nodejs-error-codes).
175
+
176
+ For more details on the errors thrown by `undici`, see the
177
+ [undici errors documentation](https://undici.nodejs.org/#/docs/api/Errors.md).
157
178
 
158
179
  ## Common issues
159
180
 
160
- ### Missing functions or unexpected server errors
181
+ ### Unexpected server errors
161
182
 
162
183
  Please make sure you are using the latest version of this driver and that the
163
184
  version of the arangojs documentation you are reading matches that version.
164
185
 
165
- Changes in the major version number of arangojs (e.g. 7.x.y -> 8.0.0) indicate
186
+ Changes in the major version number of arangojs (e.g. 8.x.y -> 9.0.0) indicate
166
187
  backwards-incompatible changes in the arangojs API that may require changes in
167
188
  your code when upgrading your version of arangojs.
168
189
 
@@ -170,19 +191,13 @@ Additionally please ensure that your version of Node.js (or browser) and
170
191
  ArangoDB are supported by the version of arangojs you are trying to use. See
171
192
  the [compatibility section](#compatibility) for additional information.
172
193
 
173
- **Note**: As of June 2018 ArangoDB 2.8 has reached its End of Life and is no
174
- longer supported in arangojs 7 and later. If your code needs to work with
175
- ArangoDB 2.8 you can continue using arangojs 6 and enable ArangoDB 2.8
176
- compatibility mode by setting the config option `arangoVersion: 20800` to
177
- enable the ArangoDB 2.8 compatibility mode in arangojs 6.
178
-
179
194
  You can install an older version of arangojs using `npm` or `yarn`:
180
195
 
181
196
  ```sh
182
- # for version 6.x.x
183
- yarn add arangojs@6
197
+ # for version 8.x.x
198
+ yarn add arangojs@8
184
199
  # - or -
185
- npm install --save arangojs@6
200
+ npm install --save arangojs@8
186
201
  ```
187
202
 
188
203
  ### No code intelligence when using require instead of import
@@ -254,23 +269,6 @@ that do not support the `stack` property on error objects, this option will
254
269
  still impact performance but not result in any additional information becoming
255
270
  available.
256
271
 
257
- ### Node.js `ReferenceError: window is not defined`
258
-
259
- If you compile your Node project using a build tool like Webpack, you may need
260
- to tell it to
261
- [target the correct environment](https://webpack.js.org/configuration/target/):
262
-
263
- ```diff
264
- // webpack.config.js
265
- + "target": "node",
266
- ```
267
-
268
- To support use in both browser and Node environments arangojs uses the
269
- [`package.json` `browser` field](https://github.com/defunctzombie/package-browser-field-spec),
270
- to substitute browser-specific implementations for certain modules.
271
- Build tools like Webpack will respect this field when targetting a browser
272
- environment and may need to be explicitly told you are targetting Node instead.
273
-
274
272
  ### Node.js with self-signed HTTPS certificates
275
273
 
276
274
  If you need to support self-signed HTTPS certificates in Node.js, you may have
@@ -308,6 +306,9 @@ setGlobalDispatcher(
308
306
  );
309
307
  ```
310
308
 
309
+ This is a [known limitation](https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073)
310
+ of Node.js at the time of this writing.
311
+
311
312
  When using arangojs in the browser, self-signed HTTPS certificates need to
312
313
  be trusted by the browser or use a trusted root certificate.
313
314
 
@@ -331,7 +332,8 @@ await trx.step(() => collection.save(doc1));
331
332
  await trx.step(() => collection.save(doc2));
332
333
  ```
333
334
 
334
- Please refer to the documentation of this method for additional examples.
335
+ Please refer to the [documentation of the `transaction.step` method](https://arangodb.github.io/arangojs/latest/classes/transaction.Transaction.html#step)
336
+ for additional examples.
335
337
 
336
338
  ### Streaming transactions timeout in cluster
337
339