Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.6.1 to 7.7.0

56

analyzer.d.ts

@@ -42,3 +42,3 @@ /**

*/
export declare type AnalyzerInfo = IdentityAnalyzerInfo | DelimiterAnalyzerInfo | StemAnalyzerInfo | NormAnalyzerInfo | NgramAnalyzerInfo | TextAnalyzerInfo | PipelineAnalyzer | AqlAnalyzer | GeoJsonAnalyzer | GeoPointAnalyzer | StopwordsAnalyzer;
export declare type AnalyzerInfo = IdentityAnalyzerInfo | DelimiterAnalyzerInfo | StemAnalyzerInfo | NormAnalyzerInfo | NgramAnalyzerInfo | TextAnalyzerInfo | PipelineAnalyzer | AqlAnalyzer | GeoJsonAnalyzer | GeoPointAnalyzer | StopwordsAnalyzer | SegmentationAnalyzer | CollationAnalyzer;
/**

@@ -406,2 +406,56 @@ * Analyzer type and type-specific properties for an Identity Analyzer.

/**
* Properties of a Segmentation Analyzer.
*/
export declare type SegmentationAnalyzerProperties = {
/**
* Which tokens should be returned.
*
* Default: `"alpha"`
*/
break?: "all" | "alpha" | "graphic";
/**
* What case all returned tokens should be converted to if applicable.
*
* Default: `"none"`
*/
case?: "lower" | "upper" | "none";
};
/**
* Analyzer type and type-specific properties for a Segmentation Analyzer
*/
export declare type SegmentationAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "segmentation";
/**
* Additional properties for the Analyzer.
*/
properties: SegmentationAnalyzerProperties;
};
/**
* Properties of a Collation Analyzer.
*/
export declare type CollationAnalyzerProperties = {
/**
* Text locale.
*
* Format: `language[_COUNTRY][.encoding][@variant]`
*/
locale: string;
};
/**
* Analyzer type and type-specific properties for a Collation Analyzer
*/
export declare type CollationAnalyzer = {
/**
* Type of the Analyzer.
*/
type: "collation";
/**
* Additional properties for the Analyzer.
*/
properties: CollationAnalyzerProperties;
};
/**
* Represents an Analyzer in a {@link Database}.

@@ -408,0 +462,0 @@ */

8

analyzer.js

@@ -25,3 +25,3 @@ "use strict";

this._db = db;
this._name = name;
this._name = name.normalize("NFC");
}

@@ -79,3 +79,3 @@ /**

get() {
return this._db.request({ path: `/_api/analyzer/${this.name}` }, (res) => res.body);
return this._db.request({ path: `/_api/analyzer/${encodeURIComponent(this._name)}` }, (res) => res.body);
}

@@ -101,3 +101,3 @@ /**

path: "/_api/analyzer",
body: { name: this.name, ...options },
body: { name: this._name, ...options },
}, (res) => res.body);

@@ -122,3 +122,3 @@ }

method: "DELETE",
path: `/_api/analyzer/${this.name}`,
path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
qs: { force },

@@ -125,0 +125,0 @@ }, (res) => res.body);

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

## [7.7.0] - 2022-01-26
### Changed
- Unicode names are now automatically NFC normalized
This change affects all database, collection, graph, view and analyzer names
using unicode characters. **The change has no effect when using non-unicode
(ASCII) names.** At this time, ArangoDB does not support unicode characters
in any of these names but experimental support for unicode database names is
available in ArangoDB 3.9 using the `--database.extended-names-databases`
startup option.
Any names used to create `Database`, `Collection`, etc instances or passed to
methods will automatically be NFC normalized. Additionally the collection
name part of any value passed as a `DocumentSelector` and the collection name
part of values returned by `collection.documentId` will automatically be NFC
normalized.
### Deprecated
- Deprecated `EnsureHashIndexOptions` and `EnsureSkiplistIndexOptions` types
The hash and skiplist index types have been deprecated in ArangoDB 3.9 and
should be replaced with persistent indexes which behave identically.
- Deprecated all MMFiles related options and methods
The MMFiles storage engine was removed in ArangoDB 3.7.
### Added
- Added support for new ArangoDB 3.9 `CollationAnalyzer` and
`SegmentationAnalyzer` types
- Added support for new ArangoDB 3.9 (multi-dimensional) `ZkdIndex` type
- Added support for new ArangoDB 3.9 Hybrid SmartGraphs graph options
- Added support for new ArangoDB 3.9 response queue time reporting
This adds the `db.queueTime` property, which provides methods for accessing
queue time metrics reported by the most recently received server responses if
the server supports this feature.
- Added `ArangoSearchViewLink#inBackground` ([#759](https://github.com/arangodb/arangojs/issues/759))
- Added `collection.compact` ([#630](https://github.com/arangodb/arangojs/issues/630))
## [7.6.1] - 2021-10-26

@@ -22,3 +71,3 @@

- Changed all uses of `Record<string, unknown>` to `Record<string, any>` [#750](https://github.com/arangodb/arangojs/issues/750)
- Changed all uses of `Record<string, unknown>` to `Record<string, any>` ([#750](https://github.com/arangodb/arangojs/issues/750))

@@ -36,7 +85,7 @@ This should allow using more specific types without having to implement

- Added support for passing `Graph` objects in AQL queries [#740](https://github.com/arangodb/arangojs/issues/740)
- Added support for passing `Graph` objects in AQL queries ([#740](https://github.com/arangodb/arangojs/issues/740))
This also adds the `isArangoGraph` helper function for type checking.
- Added User Management API [#664](https://github.com/arangodb/arangojs/issues/664)
- Added User Management API ([#664](https://github.com/arangodb/arangojs/issues/664))

@@ -48,7 +97,7 @@ This implements the endpoints of the

- Added missing `hex` flag to `StopwordsAnalyzer` type [#732](https://github.com/arangodb/arangojs/issues/732)
- Added missing `hex` flag to `StopwordsAnalyzer` type ([#732](https://github.com/arangodb/arangojs/issues/732))
- Added missing `details` flag to `collection.figures` [#728](https://github.com/arangodb/arangojs/issues/728)
- Added missing `details` flag to `collection.figures` ([#728](https://github.com/arangodb/arangojs/issues/728))
- Added missing `inBackground` flag to index options [#734](https://github.com/arangodb/arangojs/issues/734)
- Added missing `inBackground` flag to index options ([#734](https://github.com/arangodb/arangojs/issues/734))

@@ -1241,2 +1290,3 @@ ## [7.5.0] - 2021-04-22

[7.7.0]: https://github.com/arangodb/arangojs/compare/v7.6.1...v7.7.0
[7.6.1]: https://github.com/arangodb/arangojs/compare/v7.6.0...v7.6.1

@@ -1243,0 +1293,0 @@ [7.6.0]: https://github.com/arangodb/arangojs/compare/v7.5.0...v7.6.0

@@ -29,3 +29,3 @@ "use strict";

else
return String(collection);
return String(collection).normalize("NFC");
}

@@ -64,3 +64,3 @@ exports.collectionToString = collectionToString;

constructor(db, name) {
this._name = name;
this._name = name.normalize("NFC");
this._db = db;

@@ -70,3 +70,6 @@ }

_get(path, qs) {
return this._db.request({ path: `/_api/collection/${this._name}/${path}`, qs }, (res) => res.body);
return this._db.request({
path: `/_api/collection/${encodeURIComponent(this._name)}/${path}`,
qs,
}, (res) => res.body);
}

@@ -76,3 +79,3 @@ _put(path, body) {

method: "PUT",
path: `/_api/collection/${this._name}/${path}`,
path: `/_api/collection/${encodeURIComponent(this._name)}/${path}`,
body,

@@ -90,3 +93,3 @@ }, (res) => res.body);

get() {
return this._db.request({ path: `/_api/collection/${this._name}` }, (res) => res.body);
return this._db.request({ path: `/_api/collection/${encodeURIComponent(this._name)}` }, (res) => res.body);
}

@@ -120,3 +123,3 @@ async exists() {

...opts,
name: this.name,
name: this._name,
},

@@ -139,3 +142,3 @@ }, (res) => res.body);

return this._db.request({
path: `/_api/collection/${this._name}/figures`,
path: `/_api/collection/${encodeURIComponent(this._name)}/figures`,
qs: { details },

@@ -162,3 +165,3 @@ });

const result = await this._db.renameCollection(this._name, newName);
this._name = newName;
this._name = newName.normalize("NFC");
return result;

@@ -176,3 +179,3 @@ }

method: "DELETE",
path: `/_api/collection/${this._name}`,
path: `/_api/collection/${encodeURIComponent(this._name)}`,
qs: options,

@@ -186,3 +189,3 @@ }, (res) => res.body);

method: "PUT",
path: `/_api/collection/${this.name}/responsibleShard`,
path: `/_api/collection/${encodeURIComponent(this._name)}/responsibleShard`,
body: document,

@@ -198,3 +201,3 @@ }, (res) => res.body.shardId);

method: "HEAD",
path: `/_api/document/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/document/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
}, () => true);

@@ -213,3 +216,3 @@ }

method: "PUT",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
qs: { onlyget: true },

@@ -226,3 +229,3 @@ allowDirtyRead,

const result = this._db.request({
path: `/_api/document/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/document/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
allowDirtyRead,

@@ -245,3 +248,3 @@ }, (res) => res.body);

method: "POST",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: data,

@@ -254,3 +257,3 @@ qs: options,

method: "POST",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: data,

@@ -263,3 +266,3 @@ qs: options,

method: "PUT",
path: `/_api/document/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/document/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newData,

@@ -272,3 +275,3 @@ qs: options,

method: "PUT",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: newData,

@@ -281,3 +284,3 @@ qs: options,

method: "PATCH",
path: `/_api/document/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/document/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newData,

@@ -290,3 +293,3 @@ qs: options,

method: "PATCH",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: newData,

@@ -299,3 +302,3 @@ qs: options,

method: "DELETE",
path: `/_api/document/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/document/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
qs: options,

@@ -307,3 +310,3 @@ }, (res) => (options && options.silent ? undefined : res.body));

method: "DELETE",
path: `/_api/document/${this._name}`,
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: selectors.map((selector) => documents_1._documentHandle(selector, this._name)),

@@ -332,3 +335,3 @@ qs: options,

return this._db.request({
path: `/_api/edges/${this._name}`,
path: `/_api/edges/${encodeURIComponent(this._name)}`,
qs: {

@@ -472,3 +475,5 @@ direction,

index(selector) {
return this._db.request({ path: `/_api/index/${indexes_1._indexHandle(selector, this._name)}` }, (res) => res.body);
return this._db.request({
path: `/_api/index/${encodeURI(indexes_1._indexHandle(selector, this._name))}`,
}, (res) => res.body);
}

@@ -486,3 +491,3 @@ ensureIndex(options) {

method: "DELETE",
path: `/_api/index/${indexes_1._indexHandle(selector, this._name)}`,
path: `/_api/index/${encodeURI(indexes_1._indexHandle(selector, this._name))}`,
}, (res) => res.body);

@@ -503,4 +508,10 @@ }

}
compact() {
return this._db.request({
method: "PUT",
path: `/_api/collection/${this._name}/compact`,
}, (res) => res.body);
}
}
exports.Collection = Collection;
//# sourceMappingURL=collection.js.map

@@ -411,2 +411,11 @@ /// <reference types="node" />

precaptureStackTraces?: boolean;
/**
* Limits the number of values of server-reported response queue times that
* will be stored and accessible using {@link Database.queueTime}. If set to
* a finite value, older values will be discarded to make room for new values
* when that limit is reached.
*
* Default: `10`
*/
responseQueueTimeSamples?: number;
};

@@ -449,2 +458,4 @@ /**

protected _precaptureStackTraces: boolean;
protected _responseQueueTimeSamples: number;
protected _queueTimes: LinkedList<[number, number]>;
/**

@@ -466,2 +477,7 @@ * @internal

get isArangoConnection(): true;
get queueTime(): {
getLatest: () => number | undefined;
getValues: () => [number, number][];
getAvg: () => number;
};
protected _runQueue(): void;

@@ -477,2 +493,3 @@ protected _buildUrl({ basePath, path, qs }: UrlInfo): {

setBasicAuth(auth: BasicAuthCredentials): void;
setResponseQueueTimeSamples(responseQueueTimeSamples: number): void;
/**

@@ -479,0 +496,0 @@ * @internal

@@ -70,3 +70,3 @@ "use strict";

constructor(config = {}) {
var _a, _b;
var _a, _b, _c;
this._activeTasks = 0;

@@ -79,2 +79,3 @@ this._arangoVersion = 30400;

this._transactionId = null;
this._queueTimes = new x3_linkedlist_1.LinkedList();
const URLS = config.url

@@ -104,2 +105,6 @@ ? Array.isArray(config.url)

this._precaptureStackTraces = Boolean(config.precaptureStackTraces);
this._responseQueueTimeSamples = (_b = config.responseQueueTimeSamples) !== null && _b !== void 0 ? _b : 10;
if (this._responseQueueTimeSamples < 0) {
this._responseQueueTimeSamples = Infinity;
}
if (config.maxRetries === false) {

@@ -111,3 +116,3 @@ this._shouldRetry = false;

this._shouldRetry = true;
this._maxRetries = (_b = config.maxRetries) !== null && _b !== void 0 ? _b : 0;
this._maxRetries = (_c = config.maxRetries) !== null && _c !== void 0 ? _c : 0;
}

@@ -140,2 +145,15 @@ this.addToHostList(URLS);

}
get queueTime() {
return {
getLatest: () => { var _a; return (_a = this._queueTimes.last) === null || _a === void 0 ? void 0 : _a.value[1]; },
getValues: () => Array.from(this._queueTimes.values()),
getAvg: () => {
let avg = 0;
for (const [, [, value]] of this._queueTimes) {
avg += value / this._queueTimes.length;
}
return avg;
},
};
}
_runQueue() {

@@ -226,2 +244,11 @@ if (!this._queue.length || this._activeTasks >= this._maxTasks)

}
setResponseQueueTimeSamples(responseQueueTimeSamples) {
if (responseQueueTimeSamples < 0) {
responseQueueTimeSamples = Infinity;
}
this._responseQueueTimeSamples = responseQueueTimeSamples;
while (this._responseQueueTimeSamples < this._queueTimes.length) {
this._queueTimes.shift();
}
}
database(databaseName, database) {

@@ -388,2 +415,9 @@ if (database === null) {

const contentType = res.headers["content-type"];
const queueTime = res.headers["x-arango-queue-time-seconds"];
if (queueTime) {
this._queueTimes.push([Date.now(), Number(queueTime)]);
while (this._responseQueueTimeSamples < this._queueTimes.length) {
this._queueTimes.shift();
}
}
let parsedBody = undefined;

@@ -390,0 +424,0 @@ if (res.body.length && contentType && contentType.match(MIME_JSON)) {

@@ -84,3 +84,3 @@ "use strict";

method: "PUT",
path: `/_api/cursor/${this._id}`,
path: `/_api/cursor/${encodeURIComponent(this._id)}`,
host: this._host,

@@ -444,3 +444,3 @@ allowDirtyRead: this._allowDirtyRead,

method: "DELETE",
path: `/_api/cursor/${this._id}`,
path: `/_api/cursor/${encodeURIComponent(this._id)}`,
}, () => {

@@ -447,0 +447,0 @@ this._hasMore = false;

@@ -28,6 +28,8 @@ "use strict";

if (selector.includes("/")) {
if (strict && !selector.startsWith(`${collectionName}/`)) {
const [head, ...tail] = selector.split("/");
const normalizedHead = head.normalize("NFC");
if (strict && normalizedHead !== collectionName) {
throw new Error(`Document ID "${selector}" does not match collection name "${collectionName}"`);
}
return selector;
return [normalizedHead, ...tail].join("/");
}

@@ -34,0 +36,0 @@ return `${collectionName}/${selector}`;

@@ -314,3 +314,29 @@ /**

isDisjoint?: boolean;
/**
* (Enterprise Edition cluster only.) Collections to be included in a Hybrid
* SmartGraph.
*/
satellites?: (string | ArangoCollection)[];
};
export declare type AddVertexCollectionOptions = {
/**
* (Enterprise Edition cluster only.) Collections to be included in a Hybrid
* SmartGraph.
*/
satellites?: (string | ArangoCollection)[];
};
export declare type AddEdgeDefinitionOptions = {
/**
* (Enterprise Edition cluster only.) Collections to be included in a Hybrid
* SmartGraph.
*/
satellites?: (string | ArangoCollection)[];
};
export declare type ReplaceEdgeDefinitionOptions = {
/**
* (Enterprise Edition cluster only.) Collections to be included in a Hybrid
* SmartGraph.
*/
satellites?: string[];
};
/**

@@ -941,3 +967,3 @@ * Represents a {@link DocumentCollection} of vertices in a {@link Graph}.

*/
addVertexCollection(collection: string | ArangoCollection): Promise<GraphInfo>;
addVertexCollection(collection: string | ArangoCollection, options?: AddVertexCollectionOptions): Promise<GraphInfo>;
/**

@@ -1054,3 +1080,3 @@ * Removes the given collection from this graph as a vertex collection.

*/
addEdgeDefinition(edgeDefinition: EdgeDefinitionOptions): Promise<GraphInfo>;
addEdgeDefinition(edgeDefinition: EdgeDefinitionOptions, options?: AddEdgeDefinitionOptions): Promise<GraphInfo>;
/**

@@ -1081,3 +1107,3 @@ * Replaces an edge definition in this graph. The existing edge definition

*/
replaceEdgeDefinition(edgeDefinition: EdgeDefinitionOptions): Promise<GraphInfo>;
replaceEdgeDefinition(edgeDefinition: EdgeDefinitionOptions, options?: ReplaceEdgeDefinitionOptions): Promise<GraphInfo>;
/**

@@ -1109,3 +1135,3 @@ * Replaces an edge definition in this graph. The existing edge definition

*/
replaceEdgeDefinition(collection: string | ArangoCollection, edgeDefinition: EdgeDefinitionOptions): Promise<GraphInfo>;
replaceEdgeDefinition(collection: string | ArangoCollection, edgeDefinition: EdgeDefinitionOptions, options?: ReplaceEdgeDefinitionOptions): Promise<GraphInfo>;
/**

@@ -1112,0 +1138,0 @@ * Removes the edge definition for the given edge collection from this graph.

@@ -71,5 +71,5 @@ "use strict";

this._db = db;
this._name = name;
this._collection = db.collection(name);
this._name = this._collection.name;
this._graph = graph;
this._collection = db.collection(name);
}

@@ -126,3 +126,3 @@ /**

method: "HEAD",
path: `/_api/gharial/${this.graph.name}/vertex/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
}, () => true);

@@ -146,3 +146,3 @@ }

const result = this._db.request({
path: `/_api/gharial/${this.graph.name}/vertex/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
headers,

@@ -167,3 +167,3 @@ qs,

method: "POST",
path: `/_api/gharial/${this.graph.name}/vertex/${this._name}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURIComponent(this._name)}`,
body: data,

@@ -183,3 +183,3 @@ qs: options,

method: "PUT",
path: `/_api/gharial/${this.graph.name}/vertex/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newValue,

@@ -200,3 +200,3 @@ qs,

method: "PATCH",
path: `/_api/gharial/${this.graph.name}/vertex/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newValue,

@@ -217,3 +217,3 @@ qs,

method: "DELETE",
path: `/_api/gharial/${this.graph.name}/vertex/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/vertex/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
qs,

@@ -237,5 +237,5 @@ headers,

this._db = db;
this._name = name;
this._collection = db.collection(name);
this._name = this._collection.name;
this._graph = graph;
this._collection = db.collection(name);
}

@@ -292,3 +292,3 @@ /**

method: "HEAD",
path: `/_api/gharial/${this.graph.name}/edge/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
}, () => true);

@@ -312,3 +312,3 @@ }

const result = this._db.request({
path: `/_api/gharial/${this.graph.name}/edge/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
qs,

@@ -332,3 +332,3 @@ allowDirtyRead,

method: "POST",
path: `/_api/gharial/${this.graph.name}/edge/${this._name}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURIComponent(this._name)}`,
body: data,

@@ -348,3 +348,3 @@ qs: options,

method: "PUT",
path: `/_api/gharial/${this.graph.name}/edge/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newValue,

@@ -365,3 +365,3 @@ qs,

method: "PATCH",
path: `/_api/gharial/${this.graph.name}/edge/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
body: newValue,

@@ -382,3 +382,3 @@ qs,

method: "DELETE",
path: `/_api/gharial/${this.graph.name}/edge/${documents_1._documentHandle(selector, this._name)}`,
path: `/_api/gharial/${encodeURIComponent(this.graph.name)}/edge/${encodeURI(documents_1._documentHandle(selector, this._name))}`,
qs,

@@ -399,3 +399,3 @@ headers,

constructor(db, name) {
this._name = name;
this._name = name.normalize("NFC");
this._db = db;

@@ -452,3 +452,3 @@ }

get() {
return this._db.request({ path: `/_api/gharial/${this._name}` }, (res) => res.body.graph);
return this._db.request({ path: `/_api/gharial/${encodeURIComponent(this._name)}` }, (res) => res.body.graph);
}

@@ -477,3 +477,3 @@ /**

create(edgeDefinitions, options) {
const { orphanCollections, waitForSync, isSmart, isDisjoint, ...opts } = options || {};
const { orphanCollections, satellites, waitForSync, isSmart, isDisjoint, ...opts } = options !== null && options !== void 0 ? options : {};
return this._db.request({

@@ -491,3 +491,3 @@ method: "POST",

name: this._name,
options: opts,
options: { ...opts, satellites: satellites === null || satellites === void 0 ? void 0 : satellites.map(collection_1.collectionToString) },
},

@@ -514,3 +514,3 @@ qs: { waitForSync },

method: "DELETE",
path: `/_api/gharial/${this._name}`,
path: `/_api/gharial/${encodeURIComponent(this._name)}`,
qs: { dropCollections },

@@ -527,6 +527,3 @@ }, (res) => res.body.removed);

vertexCollection(collection) {
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
return new GraphVertexCollection(this._db, collection, this);
return new GraphVertexCollection(this._db, collection_1.collectionToString(collection), this);
}

@@ -555,3 +552,3 @@ /**

listVertexCollections() {
return this._db.request({ path: `/_api/gharial/${this._name}/vertex` }, (res) => res.body.collections);
return this._db.request({ path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex` }, (res) => res.body.collections);
}

@@ -603,10 +600,11 @@ /**

*/
addVertexCollection(collection) {
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
addVertexCollection(collection, options) {
const { satellites, ...opts } = options !== null && options !== void 0 ? options : {};
return this._db.request({
method: "POST",
path: `/_api/gharial/${this._name}/vertex`,
body: { collection },
path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex`,
body: {
collection: collection_1.collectionToString(collection),
options: { ...opts, satellites: satellites === null || satellites === void 0 ? void 0 : satellites.map(collection_1.collectionToString) },
},
}, (res) => res.body.graph);

@@ -637,8 +635,5 @@ }

removeVertexCollection(collection, dropCollection = false) {
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
return this._db.request({
method: "DELETE",
path: `/_api/gharial/${this._name}/vertex/${collection}`,
path: `/_api/gharial/${encodeURIComponent(this._name)}/vertex/${encodeURIComponent(collection_1.collectionToString(collection))}`,
qs: {

@@ -673,6 +668,3 @@ dropCollection,

edgeCollection(collection) {
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
return new GraphEdgeCollection(this._db, collection, this);
return new GraphEdgeCollection(this._db, collection_1.collectionToString(collection), this);
}

@@ -701,3 +693,3 @@ /**

listEdgeCollections() {
return this._db.request({ path: `/_api/gharial/${this._name}/edge` }, (res) => res.body.collections);
return this._db.request({ path: `/_api/gharial/${encodeURIComponent(this._name)}/edge` }, (res) => res.body.collections);
}

@@ -749,21 +741,34 @@ /**

*/
addEdgeDefinition(edgeDefinition) {
addEdgeDefinition(edgeDefinition, options) {
const { satellites, ...opts } = options !== null && options !== void 0 ? options : {};
return this._db.request({
method: "POST",
path: `/_api/gharial/${this._name}/edge`,
body: coerceEdgeDefinition(edgeDefinition),
path: `/_api/gharial/${encodeURIComponent(this._name)}/edge`,
body: {
...coerceEdgeDefinition(edgeDefinition),
options: { ...opts, satellites: satellites === null || satellites === void 0 ? void 0 : satellites.map(collection_1.collectionToString) },
},
}, (res) => res.body.graph);
}
replaceEdgeDefinition(collection, edgeDefinition) {
if (!edgeDefinition) {
edgeDefinition = collection;
replaceEdgeDefinition(collectionOrEdgeDefinitionOptions, edgeDefinitionOrOptions, options) {
let collection = collectionOrEdgeDefinitionOptions;
let edgeDefinition = edgeDefinitionOrOptions;
if (edgeDefinitionOrOptions &&
!edgeDefinitionOrOptions.hasOwnProperty("collection")) {
options = edgeDefinitionOrOptions;
edgeDefinitionOrOptions = undefined;
}
if (!edgeDefinitionOrOptions) {
edgeDefinition =
collectionOrEdgeDefinitionOptions;
collection = edgeDefinition.collection;
}
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
const { satellites, ...opts } = options !== null && options !== void 0 ? options : {};
return this._db.request({
method: "PUT",
path: `/_api/gharial/${this._name}/edge/${collection}`,
body: coerceEdgeDefinition(edgeDefinition),
path: `/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent(collection_1.collectionToString(collection))}`,
body: {
...coerceEdgeDefinition(edgeDefinition),
options: { ...opts, satellites: satellites === null || satellites === void 0 ? void 0 : satellites.map(collection_1.collectionToString) },
},
}, (res) => res.body.graph);

@@ -794,8 +799,5 @@ }

removeEdgeDefinition(collection, dropCollection = false) {
if (collection_1.isArangoCollection(collection)) {
collection = collection.name;
}
return this._db.request({
method: "DELETE",
path: `/_api/gharial/${this._name}/edge/${collection}`,
path: `/_api/gharial/${encodeURIComponent(this._name)}/edge/${encodeURIComponent(collection_1.collectionToString(collection))}`,
qs: {

@@ -802,0 +804,0 @@ dropCollection,

@@ -23,2 +23,5 @@ /**

* to {@link EnsurePersistentIndexOptions}.
*
* @deprecated Hash indexes have been deprecated in ArangoDB 3.9 and should be
* replaced with persistent indexes.
*/

@@ -78,2 +81,5 @@ export declare type EnsureHashIndexOptions = {

* to {@link EnsurePersistentIndexOptions}.
*
* @deprecated Skiplist indexes have been deprecated in ArangoDB 3.9 and should
* be replaced with persistent indexes.
*/

@@ -290,2 +296,30 @@ export declare type EnsureSkiplistIndexOptions = {

/**
* Options for creating a ZKD index.
*/
export declare type EnsureZkdIndexOptions = {
/**
* Type of this index.
*/
type: "zkd";
/**
* An array containing attribute paths for the dimensions.
*/
fields: string[];
/**
* Data type of the dimension attributes.
*/
fieldValueTypes: "double";
/**
* A unique name for this index.
*/
name?: string;
/**
* If set to `true`, the index will be created in the background to reduce
* the write-lock duration for the collection during index creation.
*
* Default: `false`
*/
inBackground?: boolean;
};
/**
* Shared attributes of all index types.

@@ -371,5 +405,13 @@ */

/**
* An object representing a TTL index.
*/
export declare type ZkdIndex = GenericIndex & {
type: "zkd";
fields: string[];
fieldValueTypes: "double";
};
/**
* An object representing an index.
*/
export declare type Index = GeoIndex | FulltextIndex | PersistentIndex | PrimaryIndex | HashIndex | SkiplistIndex | TtlIndex;
export declare type Index = GeoIndex | FulltextIndex | PersistentIndex | PrimaryIndex | HashIndex | SkiplistIndex | TtlIndex | ZkdIndex;
export declare type ObjectWithId = {

@@ -376,0 +418,0 @@ [key: string]: any;

@@ -33,6 +33,8 @@ "use strict";

if (selector.includes("/")) {
if (!selector.startsWith(`${collectionName}/`)) {
const [head, ...tail] = selector.split("/");
const normalizedHead = head.normalize("NFC");
if (normalizedHead !== collectionName) {
throw new Error(`Index ID "${selector}" does not match collection name "${collectionName}"`);
}
return selector;
return [normalizedHead, ...tail].join("/");
}

@@ -39,0 +41,0 @@ return `${collectionName}/${selector}`;

{
"name": "arangojs",
"version": "7.6.1",
"version": "7.7.0",
"engines": {

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

@@ -117,4 +117,4 @@ # ArangoDB JavaScript Driver

db.query({
query: "FOR p IN @@c FILTER p.type === 'fire' RETURN p",
bindVars: { c: pokemons },
query: "FOR p IN @@c FILTER p.type == 'fire' RETURN p",
bindVars: { "@c": "pokemons" },
})

@@ -121,0 +121,0 @@ .then(function (cursor) {

@@ -81,3 +81,3 @@ "use strict";

return this._db.request({
path: `/_api/transaction/${this.id}`,
path: `/_api/transaction/${encodeURIComponent(this.id)}`,
}, (res) => res.body.result);

@@ -101,3 +101,3 @@ }

method: "PUT",
path: `/_api/transaction/${this.id}`,
path: `/_api/transaction/${encodeURIComponent(this.id)}`,
}, (res) => res.body.result);

@@ -121,3 +121,3 @@ }

method: "DELETE",
path: `/_api/transaction/${this.id}`,
path: `/_api/transaction/${encodeURIComponent(this.id)}`,
}, (res) => res.body.result);

@@ -124,0 +124,0 @@ }

@@ -79,2 +79,9 @@ /**

storeValues?: "none" | "id";
/**
* If set to `true`, then no exclusive lock is used on the source collection
* during View index creation, so that it remains basically available.
*
* Default: `false`
*/
inBackground?: boolean;
};

@@ -81,0 +88,0 @@ /**

@@ -35,3 +35,3 @@ "use strict";

this._db = db;
this._name = name;
this._name = name.normalize("NFC");
}

@@ -64,3 +64,3 @@ /**

get() {
return this._db.request({ path: `/_api/view/${this.name}` }, (res) => res.body);
return this._db.request({ path: `/_api/view/${encodeURIComponent(this._name)}` }, (res) => res.body);
}

@@ -110,3 +110,3 @@ /**

...(options || {}),
name: this.name,
name: this._name,
},

@@ -139,3 +139,3 @@ }, (res) => res.body);

const result = this._db.renameView(this._name, newName);
this._name = newName;
this._name = newName.normalize("NFC");
return result;

@@ -155,3 +155,3 @@ }

properties() {
return this._db.request({ path: `/_api/view/${this.name}/properties` }, (res) => res.body);
return this._db.request({ path: `/_api/view/${encodeURIComponent(this._name)}/properties` }, (res) => res.body);
}

@@ -176,3 +176,3 @@ /**

method: "PATCH",
path: `/_api/view/${this.name}/properties`,
path: `/_api/view/${encodeURIComponent(this._name)}/properties`,
body: properties || {},

@@ -199,3 +199,3 @@ }, (res) => res.body);

method: "PUT",
path: `/_api/view/${this.name}/properties`,
path: `/_api/view/${encodeURIComponent(this._name)}/properties`,
body: properties || {},

@@ -219,3 +219,3 @@ }, (res) => res.body);

method: "DELETE",
path: `/_api/view/${this.name}`,
path: `/_api/view/${encodeURIComponent(this._name)}`,
}, (res) => res.body.result);

@@ -222,0 +222,0 @@ }

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 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 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 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