Comparing version 6.11.1 to 6.12.0
@@ -8,2 +8,18 @@ # Changelog | ||
## [6.12.0] - 2019-10-16 | ||
## Added | ||
- Added `cursor.kill` method | ||
Cursors that have not yet been fully depleted can now be killed using the | ||
`cursor.kill` method. Note that this method has no effect if the cursor | ||
is already depleted. | ||
- Added `cursor.nextBatch` method | ||
Cursors normally fetch additional batches as necessary while iterating | ||
over the individual results, this method allows consuming an entire batch | ||
at a time. | ||
## [6.11.1] - 2019-08-30 | ||
@@ -480,2 +496,3 @@ | ||
[6.12.0]: https://github.com/arangodb/arangojs/compare/v6.11.1...v6.12.0 | ||
[6.11.1]: https://github.com/arangodb/arangojs/compare/v6.11.0...v6.11.1 | ||
@@ -482,0 +499,0 @@ [6.11.0]: https://github.com/arangodb/arangojs/compare/v6.10.0...v6.11.0 |
@@ -17,2 +17,3 @@ import { Connection } from "./connection"; | ||
hasNext(): boolean; | ||
nextBatch(): Promise<any[] | undefined>; | ||
each(fn: (value: any, index: number, self: ArrayCursor) => boolean | void): Promise<boolean>; | ||
@@ -23,3 +24,4 @@ every(fn: (value: any, index: number, self: ArrayCursor) => boolean): Promise<boolean>; | ||
reduce<T>(fn: (accu: T, value: any, index: number, self: ArrayCursor) => T, accu?: T): Promise<T | undefined>; | ||
kill(): Promise<void>; | ||
} | ||
//# sourceMappingURL=cursor.d.ts.map |
@@ -8,4 +8,4 @@ "use strict"; | ||
this._result = body.result; | ||
this._hasMore = Boolean(body.hasMore); | ||
this._id = body.id; | ||
this._hasMore = Boolean(body.id && body.hasMore); | ||
this._host = host; | ||
@@ -53,2 +53,11 @@ this.count = body.count; | ||
} | ||
async nextBatch() { | ||
while (!this._result.length && this._hasMore) { | ||
await this._more(); | ||
} | ||
if (!this._result.length) { | ||
return undefined; | ||
} | ||
return this._result.splice(0, this._result.length); | ||
} | ||
async each(fn) { | ||
@@ -131,4 +140,15 @@ let index = 0; | ||
} | ||
async kill() { | ||
if (!this._hasMore) | ||
return undefined; | ||
return this._connection.request({ | ||
method: "DELETE", | ||
path: `/_api/cursor/${this._id}` | ||
}, () => { | ||
this._hasMore = false; | ||
return undefined; | ||
}); | ||
} | ||
} | ||
exports.ArrayCursor = ArrayCursor; | ||
//# sourceMappingURL=cursor.js.map |
import { ArangoCollection, BaseCollection, CollectionType, DocumentHandle, DocumentReadOptions, EdgeCollection } from "./collection"; | ||
import { Connection } from "./connection"; | ||
export interface InsertOptions { | ||
waitForSync?: boolean; | ||
returnNew?: boolean; | ||
} | ||
export interface ReplaceOptions extends InsertOptions { | ||
waitForSync?: boolean; | ||
keepNull?: boolean; | ||
returnOld?: boolean; | ||
returnNew?: boolean; | ||
rev?: string; | ||
} | ||
export interface RemoveOptions { | ||
waitForSync?: boolean; | ||
returnOld?: boolean; | ||
rev?: string; | ||
} | ||
export interface UpdateOptions extends ReplaceOptions { | ||
} | ||
export declare class GraphVertexCollection extends BaseCollection { | ||
@@ -11,8 +29,6 @@ type: CollectionType; | ||
vertex(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: any): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: InsertOptions): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: ReplaceOptions | string): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: UpdateOptions | string): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: RemoveOptions | string): Promise<any>; | ||
} | ||
@@ -25,11 +41,7 @@ export declare class GraphEdgeCollection extends EdgeCollection { | ||
document(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
save(data: Object | Array<Object>, fromId: DocumentHandle, toId: DocumentHandle, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: any): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: InsertOptions): Promise<any>; | ||
save(data: Object | Array<Object>, fromId: DocumentHandle, toId: DocumentHandle, opts?: InsertOptions): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: ReplaceOptions | string): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: UpdateOptions | string): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: RemoveOptions | string): Promise<any>; | ||
} | ||
@@ -36,0 +48,0 @@ export declare class Graph { |
@@ -17,2 +17,3 @@ import { Connection } from "./connection"; | ||
hasNext(): boolean; | ||
nextBatch(): Promise<any[] | undefined>; | ||
each(fn: (value: any, index: number, self: ArrayCursor) => boolean | void): Promise<boolean>; | ||
@@ -23,3 +24,4 @@ every(fn: (value: any, index: number, self: ArrayCursor) => boolean): Promise<boolean>; | ||
reduce<T>(fn: (accu: T, value: any, index: number, self: ArrayCursor) => T, accu?: T): Promise<T | undefined>; | ||
kill(): Promise<void>; | ||
} | ||
//# sourceMappingURL=cursor.d.ts.map |
@@ -16,4 +16,4 @@ "use strict"; | ||
this._result = body.result; | ||
this._hasMore = Boolean(body.hasMore); | ||
this._id = body.id; | ||
this._hasMore = Boolean(body.id && body.hasMore); | ||
this._host = host; | ||
@@ -69,2 +69,13 @@ this.count = body.count; | ||
} | ||
nextBatch() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
while (!this._result.length && this._hasMore) { | ||
yield this._more(); | ||
} | ||
if (!this._result.length) { | ||
return undefined; | ||
} | ||
return this._result.splice(0, this._result.length); | ||
}); | ||
} | ||
each(fn) { | ||
@@ -157,4 +168,17 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
kill() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this._hasMore) | ||
return undefined; | ||
return this._connection.request({ | ||
method: "DELETE", | ||
path: `/_api/cursor/${this._id}` | ||
}, () => { | ||
this._hasMore = false; | ||
return undefined; | ||
}); | ||
}); | ||
} | ||
} | ||
exports.ArrayCursor = ArrayCursor; | ||
//# sourceMappingURL=cursor.js.map |
import { ArangoCollection, BaseCollection, CollectionType, DocumentHandle, DocumentReadOptions, EdgeCollection } from "./collection"; | ||
import { Connection } from "./connection"; | ||
export interface InsertOptions { | ||
waitForSync?: boolean; | ||
returnNew?: boolean; | ||
} | ||
export interface ReplaceOptions extends InsertOptions { | ||
waitForSync?: boolean; | ||
keepNull?: boolean; | ||
returnOld?: boolean; | ||
returnNew?: boolean; | ||
rev?: string; | ||
} | ||
export interface RemoveOptions { | ||
waitForSync?: boolean; | ||
returnOld?: boolean; | ||
rev?: string; | ||
} | ||
export interface UpdateOptions extends ReplaceOptions { | ||
} | ||
export declare class GraphVertexCollection extends BaseCollection { | ||
@@ -11,8 +29,6 @@ type: CollectionType; | ||
vertex(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: any): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: InsertOptions): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: ReplaceOptions | string): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: UpdateOptions | string): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: RemoveOptions | string): Promise<any>; | ||
} | ||
@@ -25,11 +41,7 @@ export declare class GraphEdgeCollection extends EdgeCollection { | ||
document(documentHandle: DocumentHandle, opts?: DocumentReadOptions): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
save(data: Object | Array<Object>, fromId: DocumentHandle, toId: DocumentHandle, opts?: { | ||
waitForSync?: boolean; | ||
}): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: any): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: any): Promise<any>; | ||
save(data: Object | Array<Object>, opts?: InsertOptions): Promise<any>; | ||
save(data: Object | Array<Object>, fromId: DocumentHandle, toId: DocumentHandle, opts?: InsertOptions): Promise<any>; | ||
replace(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: ReplaceOptions | string): Promise<any>; | ||
update(documentHandle: DocumentHandle, newValue: Object | Array<Object>, opts?: UpdateOptions | string): Promise<any>; | ||
remove(documentHandle: DocumentHandle, opts?: RemoveOptions | string): Promise<any>; | ||
} | ||
@@ -36,0 +48,0 @@ export declare class Graph { |
{ | ||
"name": "arangojs", | ||
"version": "6.11.1", | ||
"version": "6.12.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "description": "The official ArangoDB JavaScript driver.", |
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
1680178
8007