arangojs 9.2.0 → 10.0.0-alpha.1

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 (369) hide show
  1. package/CHANGELOG.md +395 -0
  2. package/MIGRATING.md +50 -0
  3. package/README.md +91 -27
  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} +35 -9
  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} +395 -865
  27. package/cjs/collections.d.ts.map +1 -0
  28. package/cjs/{collection.js → collections.js} +89 -62
  29. package/cjs/collections.js.map +1 -0
  30. package/cjs/configuration.d.ts +181 -0
  31. package/cjs/configuration.d.ts.map +1 -0
  32. package/cjs/configuration.js +12 -0
  33. package/cjs/configuration.js.map +1 -0
  34. package/cjs/connection.d.ts +240 -227
  35. package/cjs/connection.d.ts.map +1 -1
  36. package/cjs/connection.js +435 -208
  37. package/cjs/connection.js.map +1 -1
  38. package/{esm/cursor.d.ts → cjs/cursors.d.ts} +69 -62
  39. package/cjs/cursors.d.ts.map +1 -0
  40. package/cjs/{cursor.js → cursors.js} +57 -48
  41. package/cjs/cursors.js.map +1 -0
  42. package/cjs/{database.d.ts → databases.d.ts} +285 -2096
  43. package/cjs/databases.d.ts.map +1 -0
  44. package/cjs/{database.js → databases.js} +212 -242
  45. package/cjs/databases.js.map +1 -0
  46. package/cjs/documents.d.ts +445 -13
  47. package/cjs/documents.d.ts.map +1 -1
  48. package/cjs/documents.js +2 -1
  49. package/cjs/documents.js.map +1 -1
  50. package/cjs/errors.d.ts +207 -0
  51. package/cjs/errors.d.ts.map +1 -0
  52. package/cjs/errors.js +320 -0
  53. package/cjs/errors.js.map +1 -0
  54. package/cjs/foxx-manifest.d.ts +1 -1
  55. package/cjs/foxx-manifest.d.ts.map +1 -1
  56. package/cjs/foxx-manifest.js +1 -1
  57. package/cjs/foxx-manifest.js.map +1 -1
  58. package/cjs/{graph.d.ts → graphs.d.ts} +125 -112
  59. package/cjs/graphs.d.ts.map +1 -0
  60. package/cjs/{graph.js → graphs.js} +110 -81
  61. package/cjs/graphs.js.map +1 -0
  62. package/cjs/hot-backups.d.ts +68 -0
  63. package/cjs/hot-backups.d.ts.map +1 -0
  64. package/cjs/hot-backups.js +12 -0
  65. package/cjs/hot-backups.js.map +1 -0
  66. package/cjs/index.d.ts +9 -9
  67. package/cjs/index.d.ts.map +1 -1
  68. package/cjs/index.js +28 -5
  69. package/cjs/index.js.map +1 -1
  70. package/cjs/indexes.d.ts +267 -327
  71. package/cjs/indexes.d.ts.map +1 -1
  72. package/cjs/indexes.js +2 -1
  73. package/cjs/indexes.js.map +1 -1
  74. package/{esm/job.d.ts → cjs/jobs.d.ts} +24 -13
  75. package/cjs/jobs.d.ts.map +1 -0
  76. package/cjs/{job.js → jobs.js} +8 -6
  77. package/cjs/jobs.js.map +1 -0
  78. package/cjs/lib/util.d.ts +50 -0
  79. package/cjs/lib/util.d.ts.map +1 -0
  80. package/cjs/lib/util.js +108 -0
  81. package/cjs/lib/util.js.map +1 -0
  82. package/cjs/lib/{linkedList.d.ts → x3-linkedlist.d.ts} +1 -1
  83. package/cjs/lib/x3-linkedlist.d.ts.map +1 -0
  84. package/cjs/lib/{linkedList.js → x3-linkedlist.js} +1 -1
  85. package/cjs/lib/x3-linkedlist.js.map +1 -0
  86. package/cjs/logs.d.ts +92 -0
  87. package/cjs/logs.d.ts.map +1 -0
  88. package/cjs/logs.js +26 -0
  89. package/cjs/logs.js.map +1 -0
  90. package/cjs/queries.d.ts +502 -0
  91. package/cjs/queries.d.ts.map +1 -0
  92. package/cjs/queries.js +13 -0
  93. package/cjs/queries.js.map +1 -0
  94. package/cjs/{route.d.ts → routes.d.ts} +33 -33
  95. package/cjs/routes.d.ts.map +1 -0
  96. package/cjs/routes.js +143 -0
  97. package/cjs/routes.js.map +1 -0
  98. package/cjs/services.d.ts +514 -0
  99. package/cjs/services.d.ts.map +1 -0
  100. package/cjs/services.js +4 -0
  101. package/cjs/services.js.map +1 -0
  102. package/{esm/transaction.d.ts → cjs/transactions.d.ts} +118 -15
  103. package/cjs/transactions.d.ts.map +1 -0
  104. package/cjs/{transaction.js → transactions.js} +83 -9
  105. package/cjs/transactions.js.map +1 -0
  106. package/cjs/users.d.ts +96 -0
  107. package/cjs/users.d.ts.map +1 -0
  108. package/cjs/users.js +4 -0
  109. package/cjs/users.js.map +1 -0
  110. package/{view.d.ts → cjs/views.d.ts} +209 -202
  111. package/cjs/views.d.ts.map +1 -0
  112. package/cjs/{view.js → views.js} +44 -13
  113. package/cjs/views.js.map +1 -0
  114. package/cluster.d.ts +178 -0
  115. package/cluster.d.ts.map +1 -0
  116. package/{collection.d.ts → collections.d.ts} +395 -865
  117. package/collections.d.ts.map +1 -0
  118. package/configuration.d.ts +181 -0
  119. package/configuration.d.ts.map +1 -0
  120. package/connection.d.ts +240 -227
  121. package/connection.d.ts.map +1 -1
  122. package/{cursor.d.ts → cursors.d.ts} +69 -62
  123. package/cursors.d.ts.map +1 -0
  124. package/{database.d.ts → databases.d.ts} +285 -2096
  125. package/databases.d.ts.map +1 -0
  126. package/documents.d.ts +445 -13
  127. package/documents.d.ts.map +1 -1
  128. package/errors.d.ts +207 -0
  129. package/errors.d.ts.map +1 -0
  130. package/esm/administration.d.ts +346 -0
  131. package/esm/administration.d.ts.map +1 -0
  132. package/esm/administration.js +12 -0
  133. package/esm/administration.js.map +1 -0
  134. package/esm/analyzers.d.ts +711 -0
  135. package/esm/analyzers.d.ts.map +1 -0
  136. package/esm/{analyzer.js → analyzers.js} +12 -9
  137. package/esm/analyzers.js.map +1 -0
  138. package/esm/aql.d.ts +5 -5
  139. package/esm/aql.d.ts.map +1 -1
  140. package/esm/aql.js +10 -10
  141. package/esm/aql.js.map +1 -1
  142. package/esm/cluster.d.ts +178 -0
  143. package/esm/cluster.d.ts.map +1 -0
  144. package/esm/cluster.js +12 -0
  145. package/esm/cluster.js.map +1 -0
  146. package/esm/{collection.d.ts → collections.d.ts} +395 -865
  147. package/esm/collections.d.ts.map +1 -0
  148. package/esm/{collection.js → collections.js} +66 -62
  149. package/esm/collections.js.map +1 -0
  150. package/esm/configuration.d.ts +181 -0
  151. package/esm/configuration.d.ts.map +1 -0
  152. package/esm/configuration.js +8 -0
  153. package/esm/configuration.js.map +1 -0
  154. package/esm/connection.d.ts +240 -227
  155. package/esm/connection.d.ts.map +1 -1
  156. package/esm/connection.js +406 -205
  157. package/esm/connection.js.map +1 -1
  158. package/{cjs/cursor.d.ts → esm/cursors.d.ts} +69 -62
  159. package/esm/cursors.d.ts.map +1 -0
  160. package/esm/{cursor.js → cursors.js} +52 -43
  161. package/esm/cursors.js.map +1 -0
  162. package/esm/{database.d.ts → databases.d.ts} +285 -2096
  163. package/esm/databases.d.ts.map +1 -0
  164. package/esm/{database.js → databases.js} +188 -241
  165. package/esm/databases.js.map +1 -0
  166. package/esm/documents.d.ts +445 -13
  167. package/esm/documents.d.ts.map +1 -1
  168. package/esm/documents.js +2 -1
  169. package/esm/documents.js.map +1 -1
  170. package/esm/errors.d.ts +207 -0
  171. package/esm/errors.d.ts.map +1 -0
  172. package/esm/errors.js +283 -0
  173. package/esm/errors.js.map +1 -0
  174. package/esm/foxx-manifest.d.ts +1 -1
  175. package/esm/foxx-manifest.d.ts.map +1 -1
  176. package/esm/foxx-manifest.js +1 -1
  177. package/esm/foxx-manifest.js.map +1 -1
  178. package/esm/{graph.d.ts → graphs.d.ts} +125 -112
  179. package/esm/graphs.d.ts.map +1 -0
  180. package/esm/{graph.js → graphs.js} +85 -79
  181. package/esm/graphs.js.map +1 -0
  182. package/esm/hot-backups.d.ts +68 -0
  183. package/esm/hot-backups.d.ts.map +1 -0
  184. package/esm/hot-backups.js +11 -0
  185. package/esm/hot-backups.js.map +1 -0
  186. package/esm/index.d.ts +9 -9
  187. package/esm/index.d.ts.map +1 -1
  188. package/esm/index.js +4 -4
  189. package/esm/index.js.map +1 -1
  190. package/esm/indexes.d.ts +267 -327
  191. package/esm/indexes.d.ts.map +1 -1
  192. package/esm/indexes.js +2 -1
  193. package/esm/indexes.js.map +1 -1
  194. package/{job.d.ts → esm/jobs.d.ts} +24 -13
  195. package/esm/jobs.d.ts.map +1 -0
  196. package/esm/{job.js → jobs.js} +8 -6
  197. package/esm/jobs.js.map +1 -0
  198. package/esm/lib/util.d.ts +50 -0
  199. package/esm/lib/util.d.ts.map +1 -0
  200. package/esm/lib/util.js +99 -0
  201. package/esm/lib/util.js.map +1 -0
  202. package/{lib/linkedList.d.ts → esm/lib/x3-linkedlist.d.ts} +1 -1
  203. package/esm/lib/x3-linkedlist.d.ts.map +1 -0
  204. package/esm/lib/{linkedList.js → x3-linkedlist.js} +1 -1
  205. package/esm/lib/x3-linkedlist.js.map +1 -0
  206. package/esm/logs.d.ts +92 -0
  207. package/esm/logs.d.ts.map +1 -0
  208. package/esm/logs.js +23 -0
  209. package/esm/logs.js.map +1 -0
  210. package/esm/queries.d.ts +502 -0
  211. package/esm/queries.d.ts.map +1 -0
  212. package/esm/queries.js +12 -0
  213. package/esm/queries.js.map +1 -0
  214. package/esm/{route.d.ts → routes.d.ts} +33 -33
  215. package/esm/routes.d.ts.map +1 -0
  216. package/esm/routes.js +116 -0
  217. package/esm/routes.js.map +1 -0
  218. package/esm/services.d.ts +514 -0
  219. package/esm/services.d.ts.map +1 -0
  220. package/esm/services.js +3 -0
  221. package/esm/services.js.map +1 -0
  222. package/{transaction.d.ts → esm/transactions.d.ts} +118 -15
  223. package/esm/transactions.d.ts.map +1 -0
  224. package/esm/{transaction.js → transactions.js} +58 -8
  225. package/esm/transactions.js.map +1 -0
  226. package/esm/users.d.ts +96 -0
  227. package/esm/users.d.ts.map +1 -0
  228. package/esm/users.js +3 -0
  229. package/esm/users.js.map +1 -0
  230. package/esm/{view.d.ts → views.d.ts} +209 -202
  231. package/esm/views.d.ts.map +1 -0
  232. package/esm/{view.js → views.js} +21 -13
  233. package/esm/views.js.map +1 -0
  234. package/foxx-manifest.d.ts +1 -1
  235. package/foxx-manifest.d.ts.map +1 -1
  236. package/{graph.d.ts → graphs.d.ts} +125 -112
  237. package/graphs.d.ts.map +1 -0
  238. package/hot-backups.d.ts +68 -0
  239. package/hot-backups.d.ts.map +1 -0
  240. package/index.d.ts +9 -9
  241. package/index.d.ts.map +1 -1
  242. package/indexes.d.ts +267 -327
  243. package/indexes.d.ts.map +1 -1
  244. package/{cjs/job.d.ts → jobs.d.ts} +24 -13
  245. package/jobs.d.ts.map +1 -0
  246. package/lib/util.d.ts +50 -0
  247. package/lib/util.d.ts.map +1 -0
  248. package/{esm/lib/linkedList.d.ts → lib/x3-linkedlist.d.ts} +1 -1
  249. package/lib/x3-linkedlist.d.ts.map +1 -0
  250. package/logs.d.ts +92 -0
  251. package/logs.d.ts.map +1 -0
  252. package/package.json +4 -1
  253. package/queries.d.ts +502 -0
  254. package/queries.d.ts.map +1 -0
  255. package/{route.d.ts → routes.d.ts} +33 -33
  256. package/routes.d.ts.map +1 -0
  257. package/services.d.ts +514 -0
  258. package/services.d.ts.map +1 -0
  259. package/{cjs/transaction.d.ts → transactions.d.ts} +118 -15
  260. package/transactions.d.ts.map +1 -0
  261. package/users.d.ts +96 -0
  262. package/users.d.ts.map +1 -0
  263. package/{cjs/view.d.ts → views.d.ts} +209 -202
  264. package/views.d.ts.map +1 -0
  265. package/analyzer.d.ts +0 -954
  266. package/analyzer.d.ts.map +0 -1
  267. package/cjs/analyzer.d.ts +0 -954
  268. package/cjs/analyzer.d.ts.map +0 -1
  269. package/cjs/analyzer.js.map +0 -1
  270. package/cjs/collection.d.ts.map +0 -1
  271. package/cjs/collection.js.map +0 -1
  272. package/cjs/cursor.d.ts.map +0 -1
  273. package/cjs/cursor.js.map +0 -1
  274. package/cjs/database.d.ts.map +0 -1
  275. package/cjs/database.js.map +0 -1
  276. package/cjs/error.d.ts +0 -94
  277. package/cjs/error.d.ts.map +0 -1
  278. package/cjs/error.js +0 -189
  279. package/cjs/error.js.map +0 -1
  280. package/cjs/graph.d.ts.map +0 -1
  281. package/cjs/graph.js.map +0 -1
  282. package/cjs/job.d.ts.map +0 -1
  283. package/cjs/job.js.map +0 -1
  284. package/cjs/lib/joinPath.d.ts +0 -11
  285. package/cjs/lib/joinPath.d.ts.map +0 -1
  286. package/cjs/lib/joinPath.js +0 -23
  287. package/cjs/lib/joinPath.js.map +0 -1
  288. package/cjs/lib/linkedList.d.ts.map +0 -1
  289. package/cjs/lib/linkedList.js.map +0 -1
  290. package/cjs/lib/mergeHeaders.d.ts +0 -12
  291. package/cjs/lib/mergeHeaders.d.ts.map +0 -1
  292. package/cjs/lib/mergeHeaders.js +0 -22
  293. package/cjs/lib/mergeHeaders.js.map +0 -1
  294. package/cjs/lib/normalizeUrl.d.ts +0 -11
  295. package/cjs/lib/normalizeUrl.d.ts.map +0 -1
  296. package/cjs/lib/normalizeUrl.js +0 -23
  297. package/cjs/lib/normalizeUrl.js.map +0 -1
  298. package/cjs/lib/request.d.ts +0 -66
  299. package/cjs/lib/request.d.ts.map +0 -1
  300. package/cjs/lib/request.js +0 -100
  301. package/cjs/lib/request.js.map +0 -1
  302. package/cjs/route.d.ts.map +0 -1
  303. package/cjs/route.js +0 -128
  304. package/cjs/route.js.map +0 -1
  305. package/cjs/transaction.d.ts.map +0 -1
  306. package/cjs/transaction.js.map +0 -1
  307. package/cjs/view.d.ts.map +0 -1
  308. package/cjs/view.js.map +0 -1
  309. package/collection.d.ts.map +0 -1
  310. package/cursor.d.ts.map +0 -1
  311. package/database.d.ts.map +0 -1
  312. package/error.d.ts +0 -94
  313. package/error.d.ts.map +0 -1
  314. package/esm/analyzer.d.ts +0 -954
  315. package/esm/analyzer.d.ts.map +0 -1
  316. package/esm/analyzer.js.map +0 -1
  317. package/esm/collection.d.ts.map +0 -1
  318. package/esm/collection.js.map +0 -1
  319. package/esm/cursor.d.ts.map +0 -1
  320. package/esm/cursor.js.map +0 -1
  321. package/esm/database.d.ts.map +0 -1
  322. package/esm/database.js.map +0 -1
  323. package/esm/error.d.ts +0 -94
  324. package/esm/error.d.ts.map +0 -1
  325. package/esm/error.js +0 -181
  326. package/esm/error.js.map +0 -1
  327. package/esm/graph.d.ts.map +0 -1
  328. package/esm/graph.js.map +0 -1
  329. package/esm/job.d.ts.map +0 -1
  330. package/esm/job.js.map +0 -1
  331. package/esm/lib/joinPath.d.ts +0 -11
  332. package/esm/lib/joinPath.d.ts.map +0 -1
  333. package/esm/lib/joinPath.js +0 -19
  334. package/esm/lib/joinPath.js.map +0 -1
  335. package/esm/lib/linkedList.d.ts.map +0 -1
  336. package/esm/lib/linkedList.js.map +0 -1
  337. package/esm/lib/mergeHeaders.d.ts +0 -12
  338. package/esm/lib/mergeHeaders.d.ts.map +0 -1
  339. package/esm/lib/mergeHeaders.js +0 -18
  340. package/esm/lib/mergeHeaders.js.map +0 -1
  341. package/esm/lib/normalizeUrl.d.ts +0 -11
  342. package/esm/lib/normalizeUrl.d.ts.map +0 -1
  343. package/esm/lib/normalizeUrl.js +0 -19
  344. package/esm/lib/normalizeUrl.js.map +0 -1
  345. package/esm/lib/request.d.ts +0 -66
  346. package/esm/lib/request.d.ts.map +0 -1
  347. package/esm/lib/request.js +0 -96
  348. package/esm/lib/request.js.map +0 -1
  349. package/esm/route.d.ts.map +0 -1
  350. package/esm/route.js +0 -124
  351. package/esm/route.js.map +0 -1
  352. package/esm/transaction.d.ts.map +0 -1
  353. package/esm/transaction.js.map +0 -1
  354. package/esm/view.d.ts.map +0 -1
  355. package/esm/view.js.map +0 -1
  356. package/graph.d.ts.map +0 -1
  357. package/job.d.ts.map +0 -1
  358. package/lib/joinPath.d.ts +0 -11
  359. package/lib/joinPath.d.ts.map +0 -1
  360. package/lib/linkedList.d.ts.map +0 -1
  361. package/lib/mergeHeaders.d.ts +0 -12
  362. package/lib/mergeHeaders.d.ts.map +0 -1
  363. package/lib/normalizeUrl.d.ts +0 -11
  364. package/lib/normalizeUrl.d.ts.map +0 -1
  365. package/lib/request.d.ts +0 -66
  366. package/lib/request.d.ts.map +0 -1
  367. package/route.d.ts.map +0 -1
  368. package/transaction.d.ts.map +0 -1
  369. package/view.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,397 @@ 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.1] - 2024-12-09
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
+ ### Changed
25
+
26
+ - Renamed `CollectionDropOptions` type to `DropCollectionOptions`
27
+
28
+ - Renamed `CollectionTruncateOptions` type to `TruncateCollectionOptions`
29
+
30
+ - Renamed `Config` type to `ConfigOptions`
31
+
32
+ - Renamed `path` option to `pathname` in `RequestOptions` type
33
+
34
+ This affects the `db.waitForPropagation` and `route.request` methods.
35
+
36
+ - Removed `basePath` option from `RequestOptions` type
37
+
38
+ This affects the `db.waitForPropagation` and `route.request` methods.
39
+
40
+ - Renamed `route.path` property to `route.pathname`
41
+
42
+ - Changed error type constructor signatures
43
+
44
+ The `request` property is now always positional and the `options` property
45
+ is always optional.
46
+
47
+ - Moved configuration related types to new `config` module
48
+
49
+ The following types were moved: `Config`, `LoadBalancingStrategy`,
50
+ `BasicAuthCredentials` and `BearerAuthCredentials`.
51
+
52
+ - Moved `ArangoErrorResponse` type to `connection` module
53
+
54
+ The type is now also no longer marked as internal.
55
+
56
+ - Moved configuration related types to new `configuration` module
57
+
58
+ The following types were moved: `ConfigOptions`, `LoadBalancingStrategy`,
59
+ `BasicAuthCredentials` and `BearerAuthCredentials`.
60
+
61
+ - Moved internal utility functions to new `lib/util` module
62
+
63
+ These methods are all still marked as internal and should not be used
64
+ directly.
65
+
66
+ - Closing a connection now closes all open requests
67
+
68
+ Previously in certain situations only the most recent request would be
69
+ closed per server. Note that this still merely aborts the requests but
70
+ does not guarantee the underlying connections are closed as these are
71
+ handled by Node.js or the browser natively.
72
+
73
+ ### Added
74
+
75
+ - Restored support for Unix domain sockets
76
+
77
+ Using Unix domain sockets requires the `undici` library to be installed.
78
+
79
+ - Restored support for `config.agentOptions`
80
+
81
+ The `config.agentOptions` option can now be used to create a custom `undici`
82
+ agent if the `undici` library is installed.
83
+
84
+ ## [10.0.0-alpha.0] - 2024-11-28
85
+
86
+ This is a major release and breaks backwards compatibility.
87
+
88
+ See [the migration guide](./MIGRATING.md#v9-to-v10) for detailed instructions
89
+ for upgrading your code to arangojs v10.
90
+
91
+ ### Removed
92
+
93
+ - Removed unused `CreateUserOptions` type
94
+
95
+ The actual type used by the `db.createUser` method is still `UserOptions`.
96
+
97
+ - Removed unused `IndexDetails` type
98
+
99
+ This type was intended to be returned by `collection.indexes` when the
100
+ `withStats` option is set to `true` but the `figures` property is already
101
+ included in the current return type.
102
+
103
+ ### Changed
104
+
105
+ - Changed `QueueTimeMetrics` type to an interface
106
+
107
+ - Changed `CursorExtras` and `CursorStats` interfaces to types
108
+
109
+ - Changed `GraphVertexCollection` and `GraphEdgeCollection` generic types to
110
+ take separate `EntryResultType` and `EntryInputType` type parameters
111
+
112
+ - Changed `db.collection`, `db.createCollection` and `db.createEdgeCollection`
113
+ methods to take separate `EntryResultType` and `EntryInputType` type
114
+ parameters
115
+
116
+ These type parameters are used to narrow the the returned collection type.
117
+
118
+ - Renamed `db.listServiceScripts` method to `db.getServiceScripts`
119
+ - Renamed `db.listHotBackups` method to `db.getHotBackups`
120
+ - Renamed `db.getLogMessages` method to `db.listLogMessages`
121
+ - Renamed `db.listFunctions` method to `db.listUserFunctions`
122
+ - Renamed `db.createFunction` method to `db.createUserFunction`
123
+ - Renamed `db.dropFunction` method to `db.dropUserFunction`
124
+ - Changed `db.removeUser` method to return `void`
125
+
126
+ #### Module renaming
127
+
128
+ - Renamed most modules to plural form for consistency
129
+
130
+ The following modules were renamed:
131
+
132
+ - `arangojs/analyzer` -> `arangojs/analyzers`
133
+ - `arangojs/collection` -> `arangojs/collections`
134
+ - `arangojs/cursor` -> `arangojs/cursors`
135
+ - `arangojs/database` -> `arangojs/databases`
136
+ - `arangojs/error` -> `arangojs/errors`
137
+ - `arangojs/graph` -> `arangojs/graphs`
138
+ - `arangojs/job` -> `arangojs/jobs`
139
+ - `arangojs/route` -> `arangojs/routes`
140
+ - `arangojs/transaction` -> `arangojs/transactions`
141
+ - `arangojs/view` -> `arangojs/views`
142
+
143
+ #### Moved types
144
+
145
+ - Moved document related types from `arangojs/collection` module to
146
+ `arangojs/documents` module
147
+
148
+ The following types were moved: `DocumentOperationFailure`,
149
+ `DocumentOperationMetadata`, `DocumentExistsOptions`,
150
+ `CollectionReadOptions`, `CollectionBatchReadOptions`,
151
+ `CollectionInsertOptions`, `CollectionReplaceOptions`,
152
+ `CollectionUpdateOptions`, `CollectionRemoveOptions`,
153
+ `CollectionImportOptions`, `CollectionEdgesOptions`,
154
+ `CollectionImportResult` and `CollectionEdgesResult`
155
+
156
+ - Moved index related types from `arangojs/collection` module to
157
+ `arangojs/indexes` module
158
+
159
+ The following types were moved: `IndexListOptions`.
160
+
161
+ - Moved transaction related types from `arangojs/database` module to
162
+ `arangojs/transactions` module
163
+
164
+ The following types were moved: `TransactionCollections`,
165
+ `TransactionOptions` and `TransactionDetails`.
166
+
167
+ - Moved cluster related types from `arangojs/database` module to new
168
+ `arangojs/clusters` module
169
+
170
+ The following types were moved: `ClusterImbalanceInfo`,
171
+ `ClusterRebalanceState`, `ClusterRebalanceOptions`, `ClusterRebalanceMove`
172
+ and `ClusterRebalanceResult`.
173
+
174
+ - Moved hot backup related types from `arangojs/database` module to new
175
+ `arangojs/hot-backups` module
176
+
177
+ The following types were moved: `HotBackupOptions`, `HotBackupResult` and
178
+ `HotBackupList`.
179
+
180
+ - Moved query related types from `arangojs/database` module to new
181
+ `arangojs/queries` module
182
+
183
+ The following types were moved: `QueryOptions`, `ExplainOptions`,
184
+ `ExplainPlan`, `ExplainStats`, `SingleExplainResult`, `MultiExplainResult`,
185
+ `AstNode`, `ParseResult`, `QueryOptimizerRule`, `QueryTracking`,
186
+ `QueryTrackingOptions`, `QueryInfo` and `AqlUserFunction`.
187
+
188
+ - Moved service related types from `arangojs/database` module to new
189
+ `arangojs/services` module
190
+
191
+ The following types were moved: `InstallServiceOptions`,
192
+ `ReplaceServiceOptions`, `UpgradeServiceOptions`, `UninstallServiceOptions`,
193
+ `ServiceSummary`, `ServiceInfo`, `ServiceConfiguration`,
194
+ `SingleServiceDependency`, `MultiServiceDependency`, `ServiceTestStats`,
195
+ `ServiceTestStreamTest`, `ServiceTestStreamReport`, `ServiceTestSuiteTest`,
196
+ `ServiceTestSuite`, `ServiceTestSuiteReport`, `ServiceTestXunitTest`,
197
+ `ServiceTestXunitReport`, `ServiceTestTapReport`, `ServiceTestDefaultTest`,
198
+ `ServiceTestDefaultReport` and `SwaggerJson`.
199
+
200
+ - Moved user related types from `arangojs/database` module to new
201
+ `arangojs/users` module
202
+
203
+ The following types were moved: `AccessLevel`, `ArangoUser`, `UserOptions`,
204
+ `UserAccessLevelOptions` and `CreateDatabaseUser`.
205
+
206
+ - Moved server administration related types from `arangojs/database` module to
207
+ new `arangojs/administration` module
208
+
209
+ The following types were moved: `QueueTimeMetrics` and `VersionInfo`.
210
+
211
+ #### Renamed types
212
+
213
+ - Renamed `Index` types to `IndexDescription` for consistency
214
+
215
+ The specific index types were also renamed accordingly:
216
+
217
+ - `Index` -> `IndexDescription`
218
+ - `GeoIndex` -> `GeoIndexDescription`
219
+ - `PersistentIndex` -> `PersistentIndexDescription`
220
+ - `PrimaryIndex` -> `PrimaryIndexDescription`
221
+ - `TtlIndex` -> `TtlIndexDescription`
222
+ - `MdiIndex` -> `MdiIndexDescription`
223
+ - `InvertedIndex` -> `InvertedIndexDescription`
224
+ - `InternalArangosearchIndex` -> `ArangosearchIndexDescription`
225
+ - `InternalIndex` -> `InternalIndexDescription`
226
+ - `HiddenIndex` -> `HiddenIndexDescription`
227
+
228
+ Note that the "Internal" prefix was dropped from `ArangosearchIndexDescription`
229
+ to more accurately reflect the index type name. The index type still refers
230
+ to an internal index, however.
231
+
232
+ - Renamed various types for consistency:
233
+
234
+ - `AqlUserFunction` -> `UserFunctionDescription`
235
+ - `CollectionMetadata` -> `CollectionDescription`
236
+ - `DatabaseInfo` -> `DatabaseDescription`
237
+ - `GraphInfo` -> `GraphDescription`
238
+ - `ServiceInfo` -> `ServiceDescription`
239
+ - `QueryInfo` -> `QueryDescription`
240
+ - `QueryTracking` -> `QueryTrackingInfo`
241
+ - `TransactionDetails` -> `TransactionInfo`
242
+ - `TransactionCollections` -> `TransactionCollectionOptions`
243
+ - `CreateDatabaseUser` -> `CreateDatabaseUserOptions`
244
+
245
+ - Index operations:
246
+ - `IndexListOptions` -> `ListIndexesOptions`
247
+
248
+ - Collection document operations:
249
+ - `DocumentExistsOptions` -> `DocumentExistsOptions`
250
+ - `CollectionReadOptions` -> `ReadDocumentOptions`
251
+ - `CollectionBatchReadOptions` -> `BulkReadDocumentsOptions`
252
+ - `CollectionInsertOptions` -> `InsertDocumentOptions`
253
+ - `CollectionReplaceOptions` -> `ReplaceDocumentOptions`
254
+ - `CollectionUpdateOptions` -> `UpdateDocumentOptions`
255
+ - `CollectionRemoveOptions` -> `RemoveDocumentOptions`
256
+ - `CollectionImportOptions` -> `ImportDocumentsOptions`
257
+ - `CollectionEdgesOptions` -> `DocumentEdgesOptions`
258
+ - `CollectionImportResult` -> `ImportDocumentsResult`
259
+ - `CollectionEdgesResult` -> `DocumentEdgesResult`
260
+
261
+ - Graph collection document operation:
262
+ - `GraphCollectionReadOptions` -> `ReadGraphDocumentOptions`
263
+ - `GraphCollectionInsertOptions` -> `CreateGraphDocumentOptions`
264
+ - `GraphCollectionReplaceOptions` -> `ReplaceGraphDocumentOptions`
265
+ - `GraphCollectionRemoveOptions` -> `RemoveGraphDocumentOptions`
266
+ - `ViewPatchPropertiesOptions` -> `UpdateViewPropertiesOptions`
267
+
268
+ - View operations:
269
+ - `ArangoSearchViewPatchPropertiesOptions` -> `UpdateArangoSearchViewPropertiesOptions`
270
+ - `SearchAliasViewPatchPropertiesOptions` -> `UpdateSearchAliasViewPropertiesOptions`
271
+ - `SearchAliasViewPatchIndexOptions` -> `UpdateSearchAliasViewIndexOptions`
272
+ - `ArangoSearchViewStoredValueOptions` -> `CreateArangoSearchViewStoredValueOptions`
273
+
274
+ - Renamed `ArrayCursor` and `BatchedArrayCursor` classes to `Cursor` and
275
+ `BatchCursor` respectively
276
+
277
+ The previous name was misleading because it conflicted with how the ArangoDB
278
+ distinguishes between array cursors and streaming cursors in the interactive
279
+ shell. This distinction does not apply to the driver.
280
+
281
+ - Renamed various types to reduce ambiguity:
282
+
283
+ - `ObjectWithId` (in `indexes` module) -> `ObjectWithIndexId`
284
+ - `ObjectWithId` (in `documents` module) -> `ObjectWithDocumentId`
285
+ - `ObjectWithKey` (in `documents` module) -> `ObjectWithDocumentKey`
286
+
287
+ #### Error handling
288
+
289
+ - Errors encountered before a request completes are now wrapped in a
290
+ `NetworkError` or a subclass thereof
291
+
292
+ This should help making it easier to diagnose network issues and distinguish
293
+ the relevant error conditions.
294
+
295
+ The originating error can still be accessed using the `cause` property of the
296
+ `NetworkError` error.
297
+
298
+ - `HttpError` now extends the `NetworkError` class
299
+
300
+ This allows treating all non-`ArangoError` errors as one category of errors,
301
+ even when there is no server response available.
302
+
303
+ - `db.waitForPropagation` now throws a `PropagationTimeoutError` error when
304
+ invoked with a `timeout` option and the timeout duration is exceeded
305
+
306
+ The method would previously throw the most recent error encountered while
307
+ waiting for replication. The originating error can still be accessed using
308
+ the `cause` property of the `PropagationTimeoutError` error.
309
+
310
+ - `db.waitForPropagation` now respects the `timeout` option more strictly
311
+
312
+ Previously the method would only time out if the timeout duration was
313
+ exceeded after the most recent request failed. Now the timeout is
314
+ recalculated and passed on to each request, preventing it from exceeding
315
+ the specified duration.
316
+
317
+ If the propagation timed out due to an underlying request exceeding the
318
+ timeout duration, the `cause` property of the `PropagationTimeoutError`
319
+ error will be a `ResponseTimeoutError` error.
320
+
321
+ - `config.beforeRequest` and `config.afterResponse` callbacks can now return
322
+ promises
323
+
324
+ If the callback returns a promise, it will be awaited before the request
325
+ and response cycle proceeds. If either callback throws an error or returns
326
+ a promise that is rejected, that error will be thrown instead.
327
+
328
+ - `config.afterResponse` callback signature changed
329
+
330
+ The callback signature previously used the internal `ArangojsResponse` type.
331
+ The new signature uses the `Response` type of the Fetch API with an
332
+ additional `request` property to more accurately represent the actual value
333
+ it receives as the `parsedBody` property will never be present.
334
+
335
+ - `response` property on `ArangoError` is now optional
336
+
337
+ This property should always be present but this allows using the error in
338
+ situations where a response might not be available.
339
+
340
+ ### Added
341
+
342
+ - Added `BatchCursor#itemsView` property and `BatchCursorItemsView` interface
343
+
344
+ This property provides a low-level interface for consuming the items of the
345
+ cursor and is used by the regular item-wise `Cursor` class internally.
346
+
347
+ - Added `onError` option to `Config` (DE-955)
348
+
349
+ This option can be used to specify a callback function that will be invoked
350
+ whenever a request results in an error. Unlike `afterResponse`, this callback
351
+ will be invoked even if the request completed but returned an error status.
352
+ In this case the error will be the `HttpError` or `ArangoError` representing
353
+ the error response.
354
+
355
+ If the `onError` callback throws an error or returns a promise that is
356
+ rejected, that error will be thrown instead.
357
+
358
+ - Added `NetworkError` class
359
+
360
+ This is the common base class for all errors (including `HttpError`) that
361
+ occur while making a request. The originating error can be accessed using the
362
+ `cause` property. The request object can be accessed using the `request`
363
+ property.
364
+
365
+ Note that `ArangoError` and the new `PropagationTimeoutError` error type
366
+ do not extend `NetworkError` but may wrap an underlying error, which can
367
+ be accessed using the `cause` property.
368
+
369
+ - Added `ResponseTimeoutError` class
370
+
371
+ This error extends `NetworkError` and is thrown when a request deliberately
372
+ times out using the `timeout` option.
373
+
374
+ - Added `RequestAbortedError` class
375
+
376
+ This error extends `NetworkError` and is thrown when a request is aborted
377
+ by using the `db.close` method.
378
+
379
+ - Added `FetchFailedError` class
380
+
381
+ This error extends `NetworkError` and is thrown when a request fails because
382
+ the underlying `fetch` call fails (usually with a `TypeError`).
383
+
384
+ In Node.js the root cause of this error (e.g. a network failure) can often be
385
+ found in the `cause` property of the originating error, i.e. the `cause`
386
+ property of the `cause` property of this error.
387
+
388
+ In browsers the root cause is usually not exposed directly but can often
389
+ be diagnosed by examining the developer console or network tab.
390
+
391
+ - Added `PropagationTimeoutError` class
392
+
393
+ This error does not extend `NetworkError` but wraps the most recent error
394
+ encountered while waiting for replication, which can be accessed using the
395
+ `cause` property. This error is only thrown when `db.waitForPropagation`
396
+ is invoked with a `timeout` option and the timeout duration is exceeded.
397
+
398
+ - Added `ProcessedResponse` type
399
+
400
+ This type replaces the previously internal `ArangojsResponse` type and
401
+ extends the native `Response` type with additional properties.
402
+
403
+ - Added optional `ArangoError#request` property
404
+
405
+ This property is always present if the error has a `response` property. In
406
+ normal use this should always be the case.
407
+
17
408
  ## [9.2.0] - 2024-11-27
18
409
 
19
410
  ### Added
@@ -66,6 +457,8 @@ This driver uses semantic versioning:
66
457
  This property is only available when fetching indexes with the `withHidden`
67
458
  option set to `true`.
68
459
 
460
+ ### Added
461
+
69
462
  - Added `HiddenIndex` type (DE-849)
70
463
 
71
464
  This type is used to represent an index returned by `collection.indexes` when
@@ -1962,6 +2355,8 @@ For a detailed list of changes between pre-release versions of v7 see the
1962
2355
 
1963
2356
  Graph methods now only return the relevant part of the response body.
1964
2357
 
2358
+ [10.0.0-alpha.1]: https://github.com/arangodb/arangojs/compare/v10.0.0-alpha.0...v10.0.0-alpha.1
2359
+ [10.0.0-alpha.0]: https://github.com/arangodb/arangojs/compare/v9.2.0...v10.0.0-alpha.0
1965
2360
  [9.2.0]: https://github.com/arangodb/arangojs/compare/v9.1.0...v9.2.0
1966
2361
  [9.1.0]: https://github.com/arangodb/arangojs/compare/v9.0.0...v9.1.0
1967
2362
  [9.0.0]: https://github.com/arangodb/arangojs/compare/v8.8.1...v9.0.0
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
@@ -139,21 +139,42 @@ 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
 
@@ -170,6 +191,15 @@ 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
 
194
+ You can install an older version of arangojs using `npm` or `yarn`:
195
+
196
+ ```sh
197
+ # for version 8.x.x
198
+ yarn add arangojs@8
199
+ # - or -
200
+ npm install --save arangojs@8
201
+ ```
202
+
173
203
  ### No code intelligence when using require instead of import
174
204
 
175
205
  If you are using `require` to import the `arangojs` module in JavaScript, the
@@ -225,7 +255,7 @@ allowing arangojs to provide more meaningful stack traces at the cost of an
225
255
  impact to performance even when no error occurs.
226
256
 
227
257
  ```diff
228
- const { Database } = require("arangojs");
258
+ import { Database } from "arangojs";
229
259
 
230
260
  const db = new Database({
231
261
  url: ARANGODB_SERVER,
@@ -239,15 +269,47 @@ that do not support the `stack` property on error objects, this option will
239
269
  still impact performance but not result in any additional information becoming
240
270
  available.
241
271
 
272
+ ### Unix domain sockets
273
+
274
+ If you want to use Unix domain sockets, you need to install the `undici` module,
275
+ which is an optional dependency of arangojs.
276
+
277
+ ```sh
278
+ npm install --save undici
279
+ ```
280
+
281
+ If the `undici` module is not installed and arangojs attempts to make a request
282
+ over a Unix domain socket, the request will fail with a plain `Error` with a
283
+ message indicating that the `undici` module is unavailable.
284
+
242
285
  ### Node.js with self-signed HTTPS certificates
243
286
 
244
- If you need to support self-signed HTTPS certificates in Node.js, you may have
245
- to override the global fetch agent. At the time of this writing, there is no
246
- official way to do this for the native `fetch` implementation in Node.js.
287
+ If you need to support self-signed HTTPS certificates in Node.js, you will need
288
+ to install the `undici` module, which is an optional dependency of arangojs.
247
289
 
248
- However as Node.js uses the `undici` module for its `fetch` implementation
249
- internally, you can override the global agent by adding `undici` as a
250
- dependency to your project and using its `setGlobalDispatcher` as follows:
290
+ ```sh
291
+ npm install --save undici
292
+ ```
293
+
294
+ You can instruct arangojs to use the `undici` module by setting the
295
+ `config.agentOptions` option:
296
+
297
+ ```diff
298
+ import { Database } from "arangojs";
299
+
300
+ const db = new Database({
301
+ url: ARANGODB_SERVER,
302
+ + agentOptions: {
303
+ + ca: [
304
+ + fs.readFileSync(".ssl/sub.class1.server.ca.pem"),
305
+ + fs.readFileSync(".ssl/ca.pem"),
306
+ + ],
307
+ + },
308
+ });
309
+ ```
310
+
311
+ To override the global fetch agent instead, you can use the `undici` module's
312
+ `setGlobalDispatcher` method as follows:
251
313
 
252
314
  ```js
253
315
  import { Agent, setGlobalDispatcher } from "undici";
@@ -263,20 +325,22 @@ setGlobalDispatcher(
263
325
  ```
264
326
 
265
327
  Although this is **strongly discouraged**, it's also possible to disable
266
- HTTPS certificate validation entirely, but note this has
328
+ HTTPS certificate validation entirely this way, but note this has
267
329
  **extremely dangerous** security implications:
268
330
 
269
- ```js
270
- import { Agent, setGlobalDispatcher } from "undici";
331
+ ```diff
332
+ import { Database } from "arangojs";
271
333
 
272
- setGlobalDispatcher(
273
- new Agent({
274
- rejectUnauthorized: false,
275
- })
276
- );
334
+ const db = new Database({
335
+ url: ARANGODB_SERVER,
336
+ + agentOptions: {
337
+ + rejectUnauthorized: false,
338
+ + },
339
+ });
277
340
  ```
278
341
 
279
- This is a [known limitation](https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073)
342
+ The requirement to use the `undici` module to override these settings is a
343
+ [known limitation](https://github.com/orgs/nodejs/discussions/44038#discussioncomment-5701073)
280
344
  of Node.js at the time of this writing.
281
345
 
282
346
  When using arangojs in the browser, self-signed HTTPS certificates need to