Comparing version 8.0.0-rc.1 to 8.0.0
@@ -17,4 +17,9 @@ # Changelog | ||
## [8.0.0-rc.1] | ||
## [8.0.0] - 2022-10-25 | ||
This is a major release and breaks backwards compatibility. | ||
See [the migration guide](./MIGRATING.md#v7-to-v8) for detailed instructions | ||
for upgrading your code to arangojs v8. | ||
### Removed | ||
@@ -27,8 +32,12 @@ | ||
- Removed Internet Explorer support | ||
- Removed Internet Explorer and older browser support | ||
As of version 8 arangojs no longer maintains compatibility for IE11 in the | ||
pre-built browser bundle. You may still be able to use arangojs in IE11 when | ||
bundling arangojs yourself but this may require polyfills and transformation. | ||
As of version 8 arangojs uses the [Browserlist `defaults`](https://browsersl.ist/#q=defaults) | ||
list to generate the pre-built browser bundle, which excludes older browsers | ||
and specifically all versions of Internet Explorer. | ||
You may still be able to use arangojs in some of the excluded browsers when | ||
bundling arangojs yourself but this may require polyfills and additional | ||
transformations. | ||
- Removed `Dict` type from `connection` module | ||
@@ -55,7 +64,2 @@ | ||
- Removed `BytesAccumConsolidationPolicy` type | ||
The `bytes_accum` consolidation policy for views was deprecated in | ||
ArangoDB 3.7 and should be replaced with the `tier` consolidation policy. | ||
- Removed deprecated `minReplicationFactor` option from collection and | ||
@@ -204,2 +208,8 @@ database related types | ||
- Deprecated `BytesAccumConsolidationPolicy` type | ||
The `bytes_accum` consolidation policy for views was deprecated in | ||
ArangoDB 3.7 and should be replaced with the `tier` consolidation policy. | ||
The type is also no longer supported in `ArangoSearchViewPropertiesOptions`. | ||
### Added | ||
@@ -265,2 +275,8 @@ | ||
- Added `retryOnConflict` option to `Config` | ||
If set to any number, this value will be used as the default value for all | ||
requests unless explicitly overridden when using `db.query` or | ||
`route.request`. | ||
## [7.8.0] - 2022-05-19 | ||
@@ -1544,3 +1560,3 @@ | ||
[8.0.0-rc.1]: https://github.com/arangodb/arangojs/compare/v7.8.0...v8.0.0-rc.1 | ||
[8.0.0]: https://github.com/arangodb/arangojs/compare/v7.8.0...v8.0.0 | ||
[7.8.0]: https://github.com/arangodb/arangojs/compare/v7.7.0...v7.8.0 | ||
@@ -1547,0 +1563,0 @@ [7.7.0]: https://github.com/arangodb/arangojs/compare/v7.6.1...v7.7.0 |
@@ -200,3 +200,3 @@ /// <reference types="node" /> | ||
* | ||
* Default: `0` | ||
* Default: `config.retryOnConflict` | ||
*/ | ||
@@ -353,3 +353,3 @@ retryOnConflict?: number; | ||
* - any other number: the request is retried until a server can be reached | ||
* the request has been retried a total of `maxRetries` number of times | ||
* or the request has been retried a total of `maxRetries` number of times | ||
* (not including the initial failed request). | ||
@@ -365,2 +365,5 @@ * | ||
* | ||
* **Note**: To set the number of retries when a write-write conflict is | ||
* encountered, see `retryOnConflict` instead. | ||
* | ||
* Default: `0` | ||
@@ -370,2 +373,9 @@ */ | ||
/** | ||
* If set to a positive number, requests will automatically be retried at | ||
* most this many times if they result in a write-write conflict. | ||
* | ||
* Default: `0` | ||
*/ | ||
retryOnConflict?: number; | ||
/** | ||
* An http `Agent` instance to use for connections. | ||
@@ -453,2 +463,3 @@ * | ||
protected _maxRetries: number | false; | ||
protected _retryOnConflict: number; | ||
protected _maxTasks: number; | ||
@@ -455,0 +466,0 @@ protected _queue: LinkedList<Task>; |
@@ -89,2 +89,3 @@ "use strict"; | ||
this._responseQueueTimeSamples = config.responseQueueTimeSamples ?? 10; | ||
this._retryOnConflict = config.retryOnConflict ?? 0; | ||
if (this._responseQueueTimeSamples < 0) { | ||
@@ -435,3 +436,3 @@ this._responseQueueTimeSamples = Infinity; | ||
*/ | ||
request({ hostUrl, method = "GET", body, expectBinary = false, isBinary = false, allowDirtyRead = false, retryOnConflict = 0, timeout = 0, headers, ...urlInfo }, transform) { | ||
request({ hostUrl, method = "GET", body, expectBinary = false, isBinary = false, allowDirtyRead = false, retryOnConflict = this._retryOnConflict, timeout = 0, headers, ...urlInfo }, transform) { | ||
return new Promise((resolve, reject) => { | ||
@@ -438,0 +439,0 @@ let contentType = "text/plain"; |
@@ -91,9 +91,25 @@ /** | ||
/** | ||
* Runtime statistics per query execution node. | ||
* Total number of cluster-internal HTTP requests performed. | ||
*/ | ||
httpRequests: number; | ||
/** | ||
* Runtime statistics per query execution node if `profile` was set to `2` or greater. | ||
*/ | ||
nodes?: { | ||
/** | ||
* Execution node ID to correlate this node with nodes in the `extra.plan`. | ||
*/ | ||
id: number; | ||
/** | ||
* Number of calls in this node. | ||
*/ | ||
calls: number; | ||
/** | ||
* Number of temporary result items returned by this node. | ||
*/ | ||
items: number; | ||
filter: number; | ||
/** | ||
* Execution time of this node in seconds. | ||
*/ | ||
runtime: number; | ||
@@ -100,0 +116,0 @@ }[]; |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export { join as joinPath } from "path"; | ||
export declare function joinPath(...path: string[]): string; | ||
//# sourceMappingURL=joinPath.web.d.ts.map |
@@ -10,7 +10,11 @@ "use strict"; | ||
exports.joinPath = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { join } = require("path-browserify"); | ||
/** | ||
* @internal | ||
*/ | ||
var path_1 = require("path"); | ||
Object.defineProperty(exports, "joinPath", { enumerable: true, get: function () { return path_1.join; } }); | ||
function joinPath(...path) { | ||
return join(...path); | ||
} | ||
exports.joinPath = joinPath; | ||
//# sourceMappingURL=joinPath.web.js.map |
@@ -16,40 +16,21 @@ "use strict"; | ||
*/ | ||
function toForm(fields) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
const form = new Multipart(); | ||
for (const key of Object.keys(fields)) { | ||
let value = fields[key]; | ||
if (value === undefined) | ||
continue; | ||
if (!(value instanceof stream_1.Readable) && | ||
!(value instanceof global.Buffer) && | ||
(typeof value === "object" || typeof value === "function")) { | ||
value = JSON.stringify(value); | ||
} | ||
form.append(key, value); | ||
} | ||
const stream = form.stream(); | ||
const bufs = []; | ||
stream.on("data", (buf) => bufs.push(buf)); | ||
stream.on("end", () => { | ||
bufs.push(Buffer.from("\r\n")); | ||
const body = Buffer.concat(bufs); | ||
const boundary = form.getBoundary(); | ||
const headers = { | ||
"content-type": `multipart/form-data; boundary=${boundary}`, | ||
"content-length": String(body.length), | ||
}; | ||
resolve({ body, headers }); | ||
}); | ||
stream.on("error", (e) => { | ||
reject(e); | ||
}); | ||
async function toForm(fields) { | ||
const form = new Multipart(); | ||
for (const key of Object.keys(fields)) { | ||
let value = fields[key]; | ||
if (value === undefined) | ||
continue; | ||
if (!(value instanceof stream_1.Readable) && | ||
!(value instanceof global.Buffer) && | ||
(typeof value === "object" || typeof value === "function")) { | ||
value = JSON.stringify(value); | ||
} | ||
catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
form.append(key, value); | ||
} | ||
const body = await form.buffer(); | ||
const headers = form.getHeaders(); | ||
delete headers["transfer-encoding"]; | ||
return { body, headers }; | ||
} | ||
exports.toForm = toForm; | ||
//# sourceMappingURL=multipart.js.map |
@@ -1,4 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { ParsedUrlQueryInput } from "querystring"; | ||
export declare function querystringify(obj: ParsedUrlQueryInput): string; | ||
export declare function querystringify(obj: Record<string, string | number | boolean | null | undefined | readonly (string | number | boolean | null | undefined)[]>): string; | ||
//# sourceMappingURL=querystringify.web.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
function querystringify(obj) { | ||
const result = []; | ||
let result = ""; | ||
for (let [key, value] of Object.entries(obj)) { | ||
@@ -16,19 +16,17 @@ if (value === undefined) | ||
value = encodeURIComponent(String(value)); | ||
result.push(`${key}=${value}`); | ||
result += `&${key}=${value}`; | ||
} | ||
else { | ||
for (let item of value) { | ||
if (item === undefined) | ||
continue; | ||
if (item === null) | ||
if (item == null) | ||
item = ""; | ||
else | ||
item = encodeURIComponent(String(item)); | ||
result.push(`${key}=${item}`); | ||
result += `&${key}=${item}`; | ||
} | ||
} | ||
} | ||
return result.join(`&`); | ||
return result.slice(1); | ||
} | ||
exports.querystringify = querystringify; | ||
//# sourceMappingURL=querystringify.web.js.map |
@@ -19,3 +19,3 @@ # Migrating | ||
const db = new Database(); | ||
-let deps: Dict<string, string[], undefined>; | ||
-let deps: Dict<string | string[] | undefined>; | ||
+let deps: Record<string, string | string[] | undefined>; | ||
@@ -109,2 +109,21 @@ deps = await db.getServiceDependencies("/my-foxx-service", true); | ||
### Enum re-exports | ||
Previously the `CollectionStatus`, `CollectionType` and `ViewType` enums | ||
were re-exported by the arangojs main module and could be imported from the | ||
`arangojs` package: | ||
```diff | ||
-import { CollectionStatus, CollectionType } from "arangojs"; | ||
+import { CollectionStatus, CollectionType } from "arangojs/collection"; | ||
``` | ||
Note that the `ViewType` enum has been removed completely: | ||
````diff | ||
-import { ViewType } from "arangojs"; | ||
- | ||
-const ArangoSearchViewType = ViewType.ARANGOSEARCH_VIEW; | ||
+const ArangoSearchViewType = "arangosearch"; | ||
## v6 to v7 | ||
@@ -126,3 +145,3 @@ | ||
-db.useDatabase("my_database"); | ||
``` | ||
```` | ||
@@ -129,0 +148,0 @@ ### Shared connection pool |
{ | ||
"name": "arangojs", | ||
"version": "8.0.0-rc.1", | ||
"version": "8.0.0", | ||
"engines": { | ||
@@ -36,3 +36,2 @@ "node": ">=14" | ||
"main": "index.js", | ||
"typings": "index.d.ts", | ||
"browser": { | ||
@@ -50,4 +49,5 @@ "./lib/btoa.js": "./lib/btoa.web.js", | ||
"dependencies": { | ||
"@types/node": ">=13.13.4", | ||
"multi-part": "^3.0.0", | ||
"@types/node": ">=14", | ||
"multi-part": "^4.0.0", | ||
"path-browserify": "^1.0.1", | ||
"x3-linkedlist": "1.2.0", | ||
@@ -54,0 +54,0 @@ "xhr": "^2.4.1" |
@@ -23,2 +23,19 @@ /** | ||
/** | ||
* Policy to consolidate based on segment byte size and live document count as | ||
* dictated by the customization attributes. | ||
* | ||
* @deprecated The `bytes_accum` consolidation policy was deprecated in | ||
* ArangoDB 3.7 and should be replaced with the `tier` consolidation policy. | ||
*/ | ||
export declare type BytesAccumConsolidationPolicy = { | ||
/** | ||
* Type of consolidation policy. | ||
*/ | ||
type: "bytes_accum"; | ||
/** | ||
* Must be in the range of `0.0` to `1.0`. | ||
*/ | ||
threshold?: number; | ||
}; | ||
/** | ||
* Policy to consolidate if the sum of all candidate segment byte size is less | ||
@@ -350,3 +367,3 @@ * than the total segment byte size multiplied by a given threshold. | ||
writebufferSizeMax: number; | ||
consolidationPolicy: TierConsolidationPolicy; | ||
consolidationPolicy: TierConsolidationPolicy | BytesAccumConsolidationPolicy; | ||
primarySort: { | ||
@@ -353,0 +370,0 @@ field: string; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
2
2164143
5
135
20114
+ Addedpath-browserify@^1.0.1
+ Added@tokenizer/token@0.3.0(transitive)
+ Addedfile-type@16.5.4(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedmime-kind@4.0.0(transitive)
+ Addedmulti-part@4.0.0(transitive)
+ Addedpath-browserify@1.0.1(transitive)
+ Addedpeek-readable@4.1.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedreadable-web-to-node-stream@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrtok3@6.3.0(transitive)
+ Addedtoken-types@4.2.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedfile-type@12.4.2(transitive)
- Removedmime-kind@3.0.0(transitive)
- Removedmulti-part@3.0.0(transitive)
Updated@types/node@>=14
Updatedmulti-part@^4.0.0