gremlin 3.5.2 → 3.5.3
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.
- package/.eslintrc.js +154 -0
- package/.prettierrc.js +29 -0
- package/Gruntfile.js +15 -16
- package/doc/AnonymousTraversalSource.html +4 -4
- package/doc/Authenticator.html +1 -1
- package/doc/Bytecode.html +6 -6
- package/doc/Client.html +137 -63
- package/doc/Connection.html +88 -4
- package/doc/DriverRemoteConnection.html +10 -10
- package/doc/EdgeLabelVerificationStrategy.html +1 -1
- package/doc/Graph.html +1 -1
- package/doc/GraphSON2Reader.html +3 -3
- package/doc/GraphSON2Writer.html +2 -2
- package/doc/GraphSON3Reader.html +2 -2
- package/doc/GraphSON3Writer.html +2 -2
- package/doc/GraphTraversal.html +106 -106
- package/doc/GraphTraversalSource.html +18 -18
- package/doc/HaltedTraverserStrategy.html +2 -2
- package/doc/MatchAlgorithmStrategy.html +2 -2
- package/doc/P.html +12 -12
- package/doc/PartitionStrategy.html +2 -2
- package/doc/Path.html +1 -1
- package/doc/PlainTextSaslAuthenticator.html +1 -1
- package/doc/ProductiveByStrategy.html +1 -1
- package/doc/RemoteConnection.html +9 -9
- package/doc/RemoteStrategy.html +3 -3
- package/doc/RemoteTraversal.html +2 -2
- package/doc/ReservedKeysVerificationStrategy.html +2 -2
- package/doc/ResponseError.html +1 -1
- package/doc/ResultSet.html +6 -6
- package/doc/SaslAuthenticator.html +1 -1
- package/doc/SaslMechanismBase.html +1 -1
- package/doc/SaslMechanismPlain.html +5 -5
- package/doc/SeedStrategy.html +2 -2
- package/doc/SubgraphStrategy.html +2 -2
- package/doc/TextP.html +9 -9
- package/doc/Transaction.html +5 -5
- package/doc/Translator.html +1 -1
- package/doc/TraversalStrategies.html +4 -4
- package/doc/TraversalStrategy.html +2 -2
- package/doc/TypeSerializer.html +1 -1
- package/doc/driver_auth_authenticator.js.html +3 -3
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +25 -16
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +6 -6
- package/doc/driver_auth_sasl-authenticator.js.html +2 -2
- package/doc/driver_client.js.html +69 -23
- package/doc/driver_connection.js.html +107 -88
- package/doc/driver_driver-remote-connection.js.html +11 -10
- package/doc/driver_remote-connection.js.html +3 -4
- package/doc/driver_response-error.js.html +4 -3
- package/doc/driver_result-set.js.html +3 -3
- package/doc/global.html +199 -2
- package/doc/index.html +1 -1
- package/doc/process_anonymous-traversal.js.html +3 -3
- package/doc/process_bytecode.js.html +10 -8
- package/doc/process_graph-traversal.js.html +193 -142
- package/doc/process_transaction.js.html +15 -8
- package/doc/process_translator.js.html +13 -10
- package/doc/process_traversal-strategy.js.html +59 -53
- package/doc/process_traversal.js.html +100 -107
- package/doc/structure_graph.js.html +6 -6
- package/doc/structure_io_graph-serializer.js.html +64 -17
- package/doc/structure_io_type-serializers.js.html +85 -88
- package/index.js +5 -5
- package/lib/driver/auth/authenticator.js +2 -2
- package/lib/driver/auth/mechanisms/sasl-mechanism-base.js +1 -1
- package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +24 -15
- package/lib/driver/auth/plain-text-sasl-authenticator.js +5 -5
- package/lib/driver/auth/sasl-authenticator.js +1 -1
- package/lib/driver/client.js +68 -22
- package/lib/driver/connection.js +106 -87
- package/lib/driver/driver-remote-connection.js +10 -9
- package/lib/driver/remote-connection.js +2 -3
- package/lib/driver/response-error.js +2 -2
- package/lib/driver/result-set.js +1 -2
- package/lib/process/anonymous-traversal.js +1 -2
- package/lib/process/bytecode.js +9 -7
- package/lib/process/graph-traversal.js +191 -141
- package/lib/process/transaction.js +13 -7
- package/lib/process/translator.js +11 -9
- package/lib/process/traversal-strategy.js +57 -52
- package/lib/process/traversal.js +99 -106
- package/lib/structure/graph.js +5 -5
- package/lib/structure/io/graph-serializer.js +62 -16
- package/lib/structure/io/type-serializers.js +84 -87
- package/lib/utils.js +15 -10
- package/package.json +10 -5
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
'use strict';
|
|
52
52
|
|
|
53
53
|
const EventEmitter = require('events');
|
|
54
|
+
const Stream = require('stream');
|
|
54
55
|
const WebSocket = require('ws');
|
|
55
56
|
const util = require('util');
|
|
56
57
|
const utils = require('../utils');
|
|
57
58
|
const serializer = require('../structure/io/graph-serializer');
|
|
58
59
|
const ResultSet = require('./result-set');
|
|
59
60
|
const ResponseError = require('./response-error');
|
|
60
|
-
const Bytecode = require('../process/bytecode');
|
|
61
61
|
|
|
62
62
|
const responseStatusCode = {
|
|
63
63
|
success: 200,
|
|
64
64
|
noContent: 204,
|
|
65
65
|
partialContent: 206,
|
|
66
|
-
authenticationChallenge:
|
|
66
|
+
authenticationChallenge: 407,
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
|
|
@@ -76,7 +76,6 @@ const pongTimeoutDelay = 30 * 1000;
|
|
|
76
76
|
* Represents a single connection to a Gremlin Server.
|
|
77
77
|
*/
|
|
78
78
|
class Connection extends EventEmitter {
|
|
79
|
-
|
|
80
79
|
/**
|
|
81
80
|
* Creates a new instance of {@link Connection}.
|
|
82
81
|
* @param {String} url The resource uri.
|
|
@@ -120,7 +119,8 @@ class Connection extends EventEmitter {
|
|
|
120
119
|
this._pingInterval = null;
|
|
121
120
|
this._pongTimeout = null;
|
|
122
121
|
|
|
123
|
-
this._header = String.fromCharCode(this.mimeType.length) + this.mimeType;
|
|
122
|
+
this._header = String.fromCharCode(this.mimeType.length) + this.mimeType; // TODO: what if mimeType.length > 255
|
|
123
|
+
this._header_buf = Buffer.from(this._header);
|
|
124
124
|
this.isOpen = false;
|
|
125
125
|
this.traversalSource = options.traversalSource || 'g';
|
|
126
126
|
this._authenticator = options.authenticator;
|
|
@@ -146,14 +146,14 @@ class Connection extends EventEmitter {
|
|
|
146
146
|
return this._openPromise;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
this.emit('log',
|
|
149
|
+
this.emit('log', 'ws open');
|
|
150
150
|
|
|
151
151
|
this._ws = new WebSocket(this.url, {
|
|
152
152
|
headers: this.options.headers,
|
|
153
153
|
ca: this.options.ca,
|
|
154
154
|
cert: this.options.cert,
|
|
155
155
|
pfx: this.options.pfx,
|
|
156
|
-
rejectUnauthorized: this.options.rejectUnauthorized
|
|
156
|
+
rejectUnauthorized: this.options.rejectUnauthorized,
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
this._ws.on('message', (data) => this._handleMessage(data));
|
|
@@ -171,7 +171,7 @@ class Connection extends EventEmitter {
|
|
|
171
171
|
this._ws.pong();
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
return this._openPromise = new Promise((resolve, reject) => {
|
|
174
|
+
return (this._openPromise = new Promise((resolve, reject) => {
|
|
175
175
|
this._ws.on('open', () => {
|
|
176
176
|
this.isOpen = true;
|
|
177
177
|
if (this._pingEnabled) {
|
|
@@ -183,59 +183,79 @@ class Connection extends EventEmitter {
|
|
|
183
183
|
this._handleError(err);
|
|
184
184
|
reject(err);
|
|
185
185
|
});
|
|
186
|
-
});
|
|
186
|
+
}));
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/** @override */
|
|
190
190
|
submit(processor, op, args, requestId) {
|
|
191
191
|
const rid = requestId || utils.getUuid();
|
|
192
|
-
return this.open().then(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
return this.open().then(
|
|
193
|
+
() =>
|
|
194
|
+
new Promise((resolve, reject) => {
|
|
195
|
+
if (op !== 'authentication') {
|
|
196
|
+
this._responseHandlers[rid] = {
|
|
197
|
+
callback: (err, result) => (err ? reject(err) : resolve(result)),
|
|
198
|
+
result: null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const request = {
|
|
203
|
+
requestId: rid,
|
|
204
|
+
op: op || 'bytecode',
|
|
205
|
+
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
206
|
+
processor: !processor && op !== 'eval' ? 'traversal' : processor,
|
|
207
|
+
args: args || {},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const request_buf = this._writer.writeRequest(request);
|
|
211
|
+
const message = Buffer.concat([this._header_buf, request_buf], this._header_buf.length + request_buf.length);
|
|
212
|
+
this._ws.send(message);
|
|
213
|
+
}),
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** @override */
|
|
218
|
+
stream(processor, op, args, requestId) {
|
|
219
|
+
const rid = requestId || utils.getUuid();
|
|
220
|
+
|
|
221
|
+
const readableStream = new Stream.Readable({
|
|
222
|
+
objectMode: true,
|
|
223
|
+
read() {},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
this._responseHandlers[rid] = {
|
|
227
|
+
callback: (err) => (err ? readableStream.destroy(err) : readableStream.push(null)),
|
|
228
|
+
result: readableStream,
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
this.open()
|
|
232
|
+
.then(() => {
|
|
233
|
+
const request = {
|
|
234
|
+
requestId: rid,
|
|
235
|
+
op: op || 'bytecode',
|
|
236
|
+
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
237
|
+
processor: !processor && op !== 'eval' ? 'traversal' : processor,
|
|
238
|
+
args: args || {},
|
|
197
239
|
};
|
|
198
|
-
}
|
|
199
240
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
241
|
+
const request_buf = this._writer.writeRequest(request);
|
|
242
|
+
const message = Buffer.concat([this._header_buf, request_buf], this._header_buf.length + request_buf.length);
|
|
243
|
+
this._ws.send(message);
|
|
244
|
+
})
|
|
245
|
+
.catch((err) => readableStream.destroy(err));
|
|
246
|
+
|
|
247
|
+
return readableStream;
|
|
203
248
|
}
|
|
204
249
|
|
|
205
250
|
_getDefaultReader(mimeType) {
|
|
206
|
-
return mimeType === graphSON2MimeType
|
|
207
|
-
? new serializer.GraphSON2Reader()
|
|
208
|
-
: new serializer.GraphSONReader();
|
|
251
|
+
return mimeType === graphSON2MimeType ? new serializer.GraphSON2Reader() : new serializer.GraphSONReader();
|
|
209
252
|
}
|
|
210
253
|
|
|
211
254
|
_getDefaultWriter(mimeType) {
|
|
212
|
-
return mimeType === graphSON2MimeType
|
|
213
|
-
? new serializer.GraphSON2Writer()
|
|
214
|
-
: new serializer.GraphSONWriter();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
_getRequest(id, op, args, processor) {
|
|
218
|
-
if (args) {
|
|
219
|
-
args = this._adaptArgs(args, true);
|
|
220
|
-
} else {
|
|
221
|
-
args = {};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (args['gremlin'] instanceof Bytecode) {
|
|
225
|
-
args['gremlin'] = this._writer.adaptObject(args['gremlin']);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return ({
|
|
229
|
-
'requestId': { '@type': 'g:UUID', '@value': id },
|
|
230
|
-
'op': op || 'bytecode',
|
|
231
|
-
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
232
|
-
'processor': (!processor && op !== 'eval') ? 'traversal' : processor,
|
|
233
|
-
'args': args
|
|
234
|
-
});
|
|
255
|
+
return mimeType === graphSON2MimeType ? new serializer.GraphSON2Writer() : new serializer.GraphSONWriter();
|
|
235
256
|
}
|
|
236
257
|
|
|
237
258
|
_pingHeartbeat() {
|
|
238
|
-
|
|
239
259
|
if (this._pingInterval) {
|
|
240
260
|
clearInterval(this._pingInterval);
|
|
241
261
|
this._pingInterval = null;
|
|
@@ -255,7 +275,6 @@ class Connection extends EventEmitter {
|
|
|
255
275
|
}, this._pongTimeoutDelay);
|
|
256
276
|
|
|
257
277
|
this._ws.ping();
|
|
258
|
-
|
|
259
278
|
}, this._pingIntervalDelay);
|
|
260
279
|
}
|
|
261
280
|
|
|
@@ -275,22 +294,30 @@ class Connection extends EventEmitter {
|
|
|
275
294
|
}
|
|
276
295
|
|
|
277
296
|
_handleMessage(data) {
|
|
278
|
-
const response = this._reader.
|
|
297
|
+
const response = this._reader.readResponse(data);
|
|
279
298
|
if (response.requestId === null || response.requestId === undefined) {
|
|
280
299
|
// There was a serialization issue on the server that prevented the parsing of the request id
|
|
281
300
|
// We invoke any of the pending handlers with an error
|
|
282
|
-
Object.keys(this._responseHandlers).forEach(requestId => {
|
|
301
|
+
Object.keys(this._responseHandlers).forEach((requestId) => {
|
|
283
302
|
const handler = this._responseHandlers[requestId];
|
|
284
303
|
this._clearHandler(requestId);
|
|
285
304
|
if (response.status !== undefined && response.status.message) {
|
|
286
305
|
return handler.callback(
|
|
287
306
|
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
288
|
-
new ResponseError(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
307
|
+
new ResponseError(
|
|
308
|
+
util.format(
|
|
309
|
+
'Server error (no request information): %s (%d)',
|
|
310
|
+
response.status.message,
|
|
311
|
+
response.status.code,
|
|
312
|
+
),
|
|
313
|
+
response.status,
|
|
314
|
+
),
|
|
315
|
+
);
|
|
293
316
|
}
|
|
317
|
+
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
318
|
+
return handler.callback(
|
|
319
|
+
new ResponseError(util.format('Server error (no request information): %j', response), response.status),
|
|
320
|
+
);
|
|
294
321
|
});
|
|
295
322
|
return;
|
|
296
323
|
}
|
|
@@ -304,31 +331,49 @@ class Connection extends EventEmitter {
|
|
|
304
331
|
}
|
|
305
332
|
|
|
306
333
|
if (response.status.code === responseStatusCode.authenticationChallenge && this._authenticator) {
|
|
307
|
-
this._authenticator
|
|
308
|
-
|
|
309
|
-
|
|
334
|
+
this._authenticator
|
|
335
|
+
.evaluateChallenge(response.result.data)
|
|
336
|
+
.then((res) => this.submit(undefined, 'authentication', res, response.requestId))
|
|
337
|
+
.catch(handler.callback);
|
|
310
338
|
|
|
311
339
|
return;
|
|
312
|
-
}
|
|
313
|
-
else if (response.status.code >= 400) {
|
|
340
|
+
} else if (response.status.code >= 400) {
|
|
314
341
|
// callback in error
|
|
315
342
|
return handler.callback(
|
|
316
343
|
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
317
|
-
new ResponseError(
|
|
344
|
+
new ResponseError(
|
|
345
|
+
util.format('Server error: %s (%d)', response.status.message, response.status.code),
|
|
346
|
+
response.status,
|
|
347
|
+
),
|
|
348
|
+
);
|
|
318
349
|
}
|
|
350
|
+
|
|
351
|
+
const isStreamingResponse = handler.result instanceof Stream.Readable;
|
|
352
|
+
|
|
319
353
|
switch (response.status.code) {
|
|
320
354
|
case responseStatusCode.noContent:
|
|
321
355
|
this._clearHandler(response.requestId);
|
|
356
|
+
if (isStreamingResponse) {
|
|
357
|
+
handler.result.push(new ResultSet(utils.emptyArray, response.status.attributes));
|
|
358
|
+
return handler.callback(null);
|
|
359
|
+
}
|
|
322
360
|
return handler.callback(null, new ResultSet(utils.emptyArray, response.status.attributes));
|
|
323
361
|
case responseStatusCode.partialContent:
|
|
362
|
+
if (isStreamingResponse) {
|
|
363
|
+
handler.result.push(new ResultSet(response.result.data, response.status.attributes));
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
324
366
|
handler.result = handler.result || [];
|
|
325
367
|
handler.result.push.apply(handler.result, response.result.data);
|
|
326
368
|
break;
|
|
327
369
|
default:
|
|
370
|
+
if (isStreamingResponse) {
|
|
371
|
+
handler.result.push(new ResultSet(response.result.data, response.status.attributes));
|
|
372
|
+
return handler.callback(null);
|
|
373
|
+
}
|
|
328
374
|
if (handler.result) {
|
|
329
375
|
handler.result.push.apply(handler.result, response.result.data);
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
376
|
+
} else {
|
|
332
377
|
handler.result = response.result.data;
|
|
333
378
|
}
|
|
334
379
|
this._clearHandler(response.requestId);
|
|
@@ -364,32 +409,6 @@ class Connection extends EventEmitter {
|
|
|
364
409
|
delete this._responseHandlers[requestId];
|
|
365
410
|
}
|
|
366
411
|
|
|
367
|
-
/**
|
|
368
|
-
* Takes the given args map and ensures all arguments are passed through to _write.adaptObject
|
|
369
|
-
* @param {Object} args Map of arguments to process.
|
|
370
|
-
* @param {Boolean} protocolLevel Determines whether it's a protocol level binding.
|
|
371
|
-
* @returns {Object}
|
|
372
|
-
* @private
|
|
373
|
-
*/
|
|
374
|
-
_adaptArgs(args, protocolLevel) {
|
|
375
|
-
if (args instanceof Object) {
|
|
376
|
-
let newObj = {};
|
|
377
|
-
Object.keys(args).forEach((key) => {
|
|
378
|
-
// bindings key (at the protocol-level needs special handling. without this, it wraps the generated Map
|
|
379
|
-
// in another map for types like EnumValue. Could be a nicer way to do this but for now it's solving the
|
|
380
|
-
// problem with script submission of non JSON native types
|
|
381
|
-
if (protocolLevel && key === 'bindings')
|
|
382
|
-
newObj[key] = this._adaptArgs(args[key], false);
|
|
383
|
-
else
|
|
384
|
-
newObj[key] = this._writer.adaptObject(args[key]);
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
return newObj;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return args;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
412
|
/**
|
|
394
413
|
* Closes the Connection.
|
|
395
414
|
* @return {Promise}
|
|
@@ -399,7 +418,7 @@ class Connection extends EventEmitter {
|
|
|
399
418
|
return Promise.resolve();
|
|
400
419
|
}
|
|
401
420
|
if (!this._closePromise) {
|
|
402
|
-
this._closePromise = new Promise(resolve => {
|
|
421
|
+
this._closePromise = new Promise((resolve) => {
|
|
403
422
|
this._closeCallback = resolve;
|
|
404
423
|
this._ws.close();
|
|
405
424
|
});
|
|
@@ -425,7 +444,7 @@ module.exports = Connection;
|
|
|
425
444
|
<br class="clear">
|
|
426
445
|
|
|
427
446
|
<footer>
|
|
428
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
447
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
|
|
429
448
|
</footer>
|
|
430
449
|
|
|
431
450
|
<script> prettyPrint(); </script>
|
|
@@ -62,7 +62,6 @@ const OptionsStrategy = require('../process/traversal-strategy').OptionsStrategy
|
|
|
62
62
|
* Represents the default {@link RemoteConnection} implementation.
|
|
63
63
|
*/
|
|
64
64
|
class DriverRemoteConnection extends RemoteConnection {
|
|
65
|
-
|
|
66
65
|
/**
|
|
67
66
|
* Creates a new instance of {@link DriverRemoteConnection}.
|
|
68
67
|
* @param {String} url The resource uri.
|
|
@@ -96,28 +95,30 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
96
95
|
|
|
97
96
|
/** @override */
|
|
98
97
|
submit(bytecode) {
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
const optionsStrategy = bytecode.sourceInstructions.find(
|
|
99
|
+
(i) => i[0] === 'withStrategies' && i[1] instanceof OptionsStrategy,
|
|
100
|
+
);
|
|
101
101
|
const allowedKeys = ['evaluationTimeout', 'scriptEvaluationTimeout', 'batchSize', 'requestId', 'userAgent'];
|
|
102
102
|
|
|
103
103
|
let requestOptions = undefined;
|
|
104
104
|
if (optionsStrategy !== undefined) {
|
|
105
105
|
requestOptions = {};
|
|
106
106
|
const conf = optionsStrategy[1].configuration;
|
|
107
|
-
for (
|
|
107
|
+
for (const key in conf) {
|
|
108
108
|
if (conf.hasOwnProperty(key) && allowedKeys.indexOf(key) > -1) {
|
|
109
109
|
requestOptions[key] = conf[key];
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
return this._client.submit(bytecode, null, requestOptions).then(result => new RemoteTraversal(result.toArray()));
|
|
114
|
+
return this._client.submit(bytecode, null, requestOptions).then((result) => new RemoteTraversal(result.toArray()));
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/** @override */
|
|
118
118
|
createSession() {
|
|
119
|
-
if (this.isSessionBound)
|
|
120
|
-
throw new Error(
|
|
119
|
+
if (this.isSessionBound) {
|
|
120
|
+
throw new Error('Connection is already bound to a session - child sessions are not allowed');
|
|
121
|
+
}
|
|
121
122
|
|
|
122
123
|
// make sure a fresh session is used when starting a new transaction
|
|
123
124
|
const copiedOptions = Object.assign({}, this.options);
|
|
@@ -132,12 +133,12 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
132
133
|
|
|
133
134
|
/** @override */
|
|
134
135
|
commit() {
|
|
135
|
-
return this._client.submit(Bytecode.GraphOp.commit, null)
|
|
136
|
+
return this._client.submit(Bytecode.GraphOp.commit, null);
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
/** @override */
|
|
139
140
|
rollback() {
|
|
140
|
-
return this._client.submit(Bytecode.GraphOp.rollback, null)
|
|
141
|
+
return this._client.submit(Bytecode.GraphOp.rollback, null);
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/** @override */
|
|
@@ -173,7 +174,7 @@ module.exports = DriverRemoteConnection;
|
|
|
173
174
|
<br class="clear">
|
|
174
175
|
|
|
175
176
|
<footer>
|
|
176
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
177
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
|
|
177
178
|
</footer>
|
|
178
179
|
|
|
179
180
|
<script> prettyPrint(); </script>
|
|
@@ -58,7 +58,6 @@ const TraversalStrategy = require('../process/traversal-strategy').TraversalStra
|
|
|
58
58
|
* returning results.
|
|
59
59
|
*/
|
|
60
60
|
class RemoteConnection {
|
|
61
|
-
|
|
62
61
|
/**
|
|
63
62
|
* @param {String} url The resource uri.
|
|
64
63
|
* @param {Object} [options] The connection options.
|
|
@@ -101,7 +100,7 @@ class RemoteConnection {
|
|
|
101
100
|
*/
|
|
102
101
|
submit(bytecode) {
|
|
103
102
|
throw new Error('submit() must be implemented');
|
|
104
|
-
}
|
|
103
|
+
}
|
|
105
104
|
|
|
106
105
|
/**
|
|
107
106
|
* Create a new <code>RemoteConnection</code> that is bound to a session using the configuration from this one.
|
|
@@ -156,7 +155,7 @@ class RemoteStrategy extends TraversalStrategy {
|
|
|
156
155
|
// gave this a fqcn that has a local "js:" prefix since this strategy isn't sent as bytecode to the server.
|
|
157
156
|
// this is a sort of local-only strategy that actually executes client side. not sure if this prefix is the
|
|
158
157
|
// right way to name this or not, but it should have a name to identify it.
|
|
159
|
-
super(
|
|
158
|
+
super('js:RemoteStrategy');
|
|
160
159
|
this.connection = connection;
|
|
161
160
|
}
|
|
162
161
|
|
|
@@ -190,7 +189,7 @@ module.exports = { RemoteConnection, RemoteStrategy, RemoteTraversal };
|
|
|
190
189
|
<br class="clear">
|
|
191
190
|
|
|
192
191
|
<footer>
|
|
193
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
192
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
|
|
194
193
|
</footer>
|
|
195
194
|
|
|
196
195
|
<script> prettyPrint(); </script>
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
class ResponseError extends Error {
|
|
54
54
|
constructor(message, responseStatus) {
|
|
55
55
|
super(message);
|
|
56
|
-
this.name =
|
|
56
|
+
this.name = 'ResponseError';
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Gets the server status code.
|
|
@@ -72,7 +72,8 @@ class ResponseError extends Error {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
module.exports = ResponseError
|
|
75
|
+
module.exports = ResponseError;
|
|
76
|
+
</code></pre>
|
|
76
77
|
</article>
|
|
77
78
|
</section>
|
|
78
79
|
|
|
@@ -88,7 +89,7 @@ module.exports = ResponseError;</code></pre>
|
|
|
88
89
|
<br class="clear">
|
|
89
90
|
|
|
90
91
|
<footer>
|
|
91
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
92
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
|
|
92
93
|
</footer>
|
|
93
94
|
|
|
94
95
|
<script> prettyPrint(); </script>
|
|
@@ -59,7 +59,6 @@ const emptyMap = Object.freeze(new utils.ImmutableMap());
|
|
|
59
59
|
* Represents the response returned from the execution of a Gremlin traversal or script.
|
|
60
60
|
*/
|
|
61
61
|
class ResultSet {
|
|
62
|
-
|
|
63
62
|
/**
|
|
64
63
|
* Creates a new instance of {@link ResultSet}.
|
|
65
64
|
* @param {Array} items
|
|
@@ -118,7 +117,8 @@ class ResultSet {
|
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
module.exports = ResultSet
|
|
120
|
+
module.exports = ResultSet;
|
|
121
|
+
</code></pre>
|
|
122
122
|
</article>
|
|
123
123
|
</section>
|
|
124
124
|
|
|
@@ -134,7 +134,7 @@ module.exports = ResultSet;</code></pre>
|
|
|
134
134
|
<br class="clear">
|
|
135
135
|
|
|
136
136
|
<footer>
|
|
137
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
137
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
|
|
138
138
|
</footer>
|
|
139
139
|
|
|
140
140
|
<script> prettyPrint(); </script>
|