Socket
Socket
Sign inDemoInstall

arangojs

Package Overview
Dependencies
Maintainers
4
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arangojs - npm Package Compare versions

Comparing version 7.1.1 to 7.2.0

10

CHANGELOG.md

@@ -17,2 +17,11 @@ # Changelog

## [7.2.0] - 2020-12-02
### Added
- Added `db.waitForPropagation` method
This method helps with setting up databases in a cluster scenario by waiting
for a request to succeed on every known coordinator.
## [7.1.1] - 2020-11-30

@@ -1121,2 +1130,3 @@

[7.2.0]: https://github.com/arangodb/arangojs/compare/v7.1.1...v7.2.0
[7.1.1]: https://github.com/arangodb/arangojs/compare/v7.1.0...v7.1.1

@@ -1123,0 +1133,0 @@ [7.1.0]: https://github.com/arangodb/arangojs/compare/v7.0.2...v7.1.0

@@ -548,2 +548,13 @@ /// <reference types="node" />

*
* Waits for propagation.
*
* See {@link Database.waitForPropagation}.
*
* @param request - Request to perform against each coordinator.
* @param timeout - Maximum number of milliseconds to wait for propagation.
*/
waitForPropagation(request: RequestOptions, timeout?: number): Promise<void>;
/**
* @internal
*
* Performs a request using the arangojs connection pool.

@@ -550,0 +561,0 @@ */

@@ -304,2 +304,39 @@ "use strict";

*
* Waits for propagation.
*
* See {@link Database.waitForPropagation}.
*
* @param request - Request to perform against each coordinator.
* @param timeout - Maximum number of milliseconds to wait for propagation.
*/
async waitForPropagation(request, timeout = Infinity) {
const numHosts = this._hosts.length;
const propagated = [];
const started = Date.now();
let host = 0;
while (true) {
if (propagated.length === numHosts) {
return;
}
while (propagated.includes(host)) {
host = (host + 1) % numHosts;
}
try {
await this.request({ ...request, host });
}
catch (e) {
if (started + timeout < Date.now()) {
throw e;
}
await new Promise((resolve) => setTimeout(resolve, 1000));
continue;
}
if (!propagated.includes(host)) {
propagated.push(host);
}
}
}
/**
* @internal
*
* Performs a request using the arangojs connection pool.

@@ -306,0 +343,0 @@ */

3

database.js

@@ -220,2 +220,5 @@ "use strict";

}
async waitForPropagation({ basePath, ...request }, timeout) {
await this._connection.waitForPropagation({ ...request, basePath: `/_db/${this.name}${basePath || ""}` }, timeout);
}
//#endregion

@@ -222,0 +225,0 @@ //#region auth

4

documents.d.ts
/**
* ```ts
* import type { Document, Edge } from "arangojs/document";
* import type { Document, Edge } from "arangojs/documents";
* ```
*
* The "document" module provides document/edge related types for TypeScript.
* The "documents" module provides document/edge related types for TypeScript.
*

@@ -8,0 +8,0 @@ * @packageDocumentation

"use strict";
/**
* ```ts
* import type { Document, Edge } from "arangojs/document";
* import type { Document, Edge } from "arangojs/documents";
* ```
*
* The "document" module provides document/edge related types for TypeScript.
* The "documents" module provides document/edge related types for TypeScript.
*

@@ -9,0 +9,0 @@ * @packageDocumentation

{
"name": "arangojs",
"version": "7.1.1",
"version": "7.2.0",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=10"

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc