gremlin 3.7.4 → 3.8.0
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/README.md +1 -1
- package/doc/AnonymousTraversalSource.html +82 -20
- package/doc/Authenticator.html +2 -2
- package/doc/Bytecode.html +2 -2
- package/doc/CardinalityValue.html +6 -6
- package/doc/Client.html +2 -2
- package/doc/Connection.html +5 -5
- package/doc/DataType.js.html +150 -0
- package/doc/DriverRemoteConnection.html +2 -2
- package/doc/EdgeLabelVerificationStrategy.html +3 -17
- package/doc/Graph.html +2 -2
- package/doc/GraphBinaryReader.js.html +132 -0
- package/doc/GraphBinaryWriter.js.html +135 -0
- package/doc/GraphSON2Reader.html +2 -2
- package/doc/GraphSON2Writer.html +2 -2
- package/doc/GraphSON3Reader.html +2 -2
- package/doc/GraphSON3Writer.html +2 -2
- package/doc/GraphTraversal.html +667 -333
- package/doc/GraphTraversalSource.html +23 -174
- package/doc/HaltedTraverserStrategy.html +2 -2
- package/doc/MatchAlgorithmStrategy.html +3 -3
- package/doc/P.html +147 -2
- package/doc/PartitionStrategy.html +3 -3
- package/doc/Path.html +3 -3
- package/doc/PlainTextSaslAuthenticator.html +2 -2
- package/doc/ProductiveByStrategy.html +7 -37
- package/doc/RemoteConnection.html +2 -2
- package/doc/RemoteStrategy.html +2 -2
- package/doc/RemoteTraversal.html +2 -2
- package/doc/ReservedKeysVerificationStrategy.html +3 -21
- package/doc/ResponseError.html +2 -2
- package/doc/ResultSet.html +2 -2
- package/doc/SaslAuthenticator.html +2 -2
- package/doc/SaslMechanismBase.html +2 -2
- package/doc/SaslMechanismPlain.html +2 -2
- package/doc/SeedStrategy.html +3 -3
- package/doc/SubgraphStrategy.html +3 -3
- package/doc/TextP.html +12 -12
- package/doc/Transaction.html +2 -2
- package/doc/Translator.html +2 -2
- package/doc/TraversalStrategies.html +2 -2
- package/doc/TraversalStrategy.html +2 -2
- package/doc/TypeSerializer.html +2 -2
- package/doc/driver_auth_authenticator.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
- package/doc/driver_auth_sasl-authenticator.js.html +2 -2
- package/doc/driver_client.js.html +2 -2
- package/doc/driver_connection.js.html +23 -9
- package/doc/driver_driver-remote-connection.js.html +2 -2
- package/doc/driver_remote-connection.js.html +2 -2
- package/doc/driver_response-error.js.html +2 -2
- package/doc/driver_result-set.js.html +2 -2
- package/doc/global.html +91 -3
- package/doc/index.html +3 -3
- package/doc/module.exports.html +2 -2
- package/doc/process_anonymous-traversal.js.html +28 -18
- package/doc/process_bytecode.js.html +2 -2
- package/doc/process_graph-traversal.js.html +41 -34
- package/doc/process_transaction.js.html +2 -2
- package/doc/process_translator.js.html +2 -2
- package/doc/process_traversal-strategy.js.html +95 -33
- package/doc/process_traversal.js.html +21 -4
- package/doc/structure_graph.js.html +11 -19
- package/doc/structure_io_binary_internals_DataType.js.html +3 -2
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +2 -2
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +2 -2
- package/doc/structure_io_graph-serializer.js.html +5 -3
- package/doc/structure_io_type-serializers.js.html +70 -8
- package/doc/utils.js.html +3 -3
- package/docker-compose.yml +2 -1
- package/lib/driver/connection.js +21 -7
- package/lib/process/anonymous-traversal.js +26 -16
- package/lib/process/graph-traversal.js +39 -32
- package/lib/process/traversal-strategy.js +93 -31
- package/lib/process/traversal.js +19 -2
- package/lib/structure/graph.js +9 -17
- package/lib/structure/io/binary/GraphBinary.js +3 -2
- package/lib/structure/io/binary/internals/AnySerializer.js +3 -0
- package/lib/structure/io/binary/internals/ClassSerializer.js +60 -0
- package/lib/structure/io/binary/internals/DataType.js +1 -0
- package/lib/structure/io/binary/internals/EnumSerializer.js +1 -0
- package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +6 -1
- package/lib/structure/io/binary/internals/OffsetDateTimeSerializer.js +151 -0
- package/lib/structure/io/binary/internals/SetSerializer.js +134 -0
- package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +1 -6
- package/lib/structure/io/graph-serializer.js +3 -1
- package/lib/structure/io/type-serializers.js +68 -6
- package/lib/utils.js +1 -1
- package/package.json +10 -6
|
@@ -115,10 +115,18 @@ class NumberSerializer extends TypeSerializer {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
class DateSerializer extends TypeSerializer {
|
|
118
|
+
// only deserialize g:Date objects
|
|
119
|
+
deserialize(obj) {
|
|
120
|
+
return new Date(obj[valueKey]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class OffsetDateTimeSerializer extends TypeSerializer {
|
|
125
|
+
// Date objects are serialized as OffsetDateTime by default
|
|
118
126
|
serialize(item) {
|
|
119
127
|
return {
|
|
120
|
-
[typeKey]: '
|
|
121
|
-
[valueKey]: item.
|
|
128
|
+
[typeKey]: 'gx:OffsetDateTime',
|
|
129
|
+
[valueKey]: item.toISOString(),
|
|
122
130
|
};
|
|
123
131
|
}
|
|
124
132
|
|
|
@@ -131,6 +139,24 @@ class DateSerializer extends TypeSerializer {
|
|
|
131
139
|
}
|
|
132
140
|
}
|
|
133
141
|
|
|
142
|
+
class ClassSerializer extends TypeSerializer {
|
|
143
|
+
serialize(item) {
|
|
144
|
+
return {
|
|
145
|
+
[typeKey]: 'g:Class',
|
|
146
|
+
[valueKey]: new item().fqcn,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
canBeUsedFor(value) {
|
|
151
|
+
return (
|
|
152
|
+
typeof value === 'function' &&
|
|
153
|
+
!!value.prototype &&
|
|
154
|
+
!!value.prototype.constructor.name &&
|
|
155
|
+
new value() instanceof ts.TraversalStrategy
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
134
160
|
class LongSerializer extends TypeSerializer {
|
|
135
161
|
serialize(item) {
|
|
136
162
|
return {
|
|
@@ -304,7 +330,7 @@ class TraversalStrategySerializer extends TypeSerializer {
|
|
|
304
330
|
|
|
305
331
|
return {
|
|
306
332
|
[typeKey]: 'g:' + item.constructor.name,
|
|
307
|
-
[valueKey]: conf,
|
|
333
|
+
[valueKey]: { ['fqcn']: item.fqcn, ['conf']: conf },
|
|
308
334
|
};
|
|
309
335
|
}
|
|
310
336
|
|
|
@@ -313,10 +339,29 @@ class TraversalStrategySerializer extends TypeSerializer {
|
|
|
313
339
|
}
|
|
314
340
|
}
|
|
315
341
|
|
|
342
|
+
/**
|
|
343
|
+
* Helper function to deserialize properties into arrays of VertexProperty or Property according to graphSONV3.
|
|
344
|
+
*/
|
|
345
|
+
function deserializeProperties(value, reader) {
|
|
346
|
+
let properties = [];
|
|
347
|
+
if ('properties' in value) {
|
|
348
|
+
const props = reader.read(value['properties']);
|
|
349
|
+
if (props !== null && props !== undefined) {
|
|
350
|
+
properties = Object.entries(props).flatMap(([key, values]) => {
|
|
351
|
+
if (Array.isArray(values) && values.length > 0 && values[0] instanceof g.VertexProperty) {
|
|
352
|
+
return values; // Flatten VertexProperty arrays
|
|
353
|
+
}
|
|
354
|
+
return values instanceof g.Property ? values : new g.Property(key, values); // create Property object when needed
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return properties;
|
|
359
|
+
}
|
|
360
|
+
|
|
316
361
|
class VertexSerializer extends TypeSerializer {
|
|
317
362
|
deserialize(obj) {
|
|
318
363
|
const value = obj[valueKey];
|
|
319
|
-
return new g.Vertex(this.reader.read(value['id']), value['label'], this.reader
|
|
364
|
+
return new g.Vertex(this.reader.read(value['id']), value['label'], deserializeProperties(value, this.reader));
|
|
320
365
|
}
|
|
321
366
|
|
|
322
367
|
/** @param {Vertex} item */
|
|
@@ -342,7 +387,7 @@ class VertexPropertySerializer extends TypeSerializer {
|
|
|
342
387
|
this.reader.read(value['id']),
|
|
343
388
|
value['label'],
|
|
344
389
|
this.reader.read(value['value']),
|
|
345
|
-
this.reader
|
|
390
|
+
deserializeProperties(value, this.reader),
|
|
346
391
|
);
|
|
347
392
|
}
|
|
348
393
|
}
|
|
@@ -362,7 +407,7 @@ class EdgeSerializer extends TypeSerializer {
|
|
|
362
407
|
new g.Vertex(this.reader.read(value['outV']), this.reader.read(value['outVLabel'])),
|
|
363
408
|
value['label'],
|
|
364
409
|
new g.Vertex(this.reader.read(value['inV']), this.reader.read(value['inVLabel'])),
|
|
365
|
-
this.reader
|
|
410
|
+
deserializeProperties(value, this.reader),
|
|
366
411
|
);
|
|
367
412
|
}
|
|
368
413
|
|
|
@@ -502,12 +547,29 @@ class SetSerializer extends ArraySerializer {
|
|
|
502
547
|
constructor() {
|
|
503
548
|
super('g:Set');
|
|
504
549
|
}
|
|
550
|
+
|
|
551
|
+
deserialize(obj) {
|
|
552
|
+
return new Set(super.deserialize(obj));
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
serialize(item) {
|
|
556
|
+
return {
|
|
557
|
+
[typeKey]: this.typeKey,
|
|
558
|
+
[valueKey]: [...item].map((x) => this.writer.adaptObject(x)),
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
canBeUsedFor(value) {
|
|
563
|
+
return value instanceof Set;
|
|
564
|
+
}
|
|
505
565
|
}
|
|
506
566
|
|
|
507
567
|
module.exports = {
|
|
508
568
|
BulkSetSerializer,
|
|
509
569
|
BytecodeSerializer,
|
|
570
|
+
ClassSerializer,
|
|
510
571
|
DateSerializer,
|
|
572
|
+
OffsetDateTimeSerializer,
|
|
511
573
|
DirectionSerializer,
|
|
512
574
|
EdgeSerializer,
|
|
513
575
|
EnumSerializer,
|
|
@@ -540,13 +602,13 @@ module.exports = {
|
|
|
540
602
|
</div>
|
|
541
603
|
|
|
542
604
|
<nav>
|
|
543
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="CardinalityValue.html">CardinalityValue</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="module.exports.html">exports</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</a></li><li><a href="ResultSet.html">ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="SeedStrategy.html">SeedStrategy</a></li><li><a href="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li><li><a href="global.html#statics">statics</a></li><li><a href="global.html#toArrayBuffer">toArrayBuffer</a></li></ul>
|
|
605
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="CardinalityValue.html">CardinalityValue</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="module.exports.html">exports</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</a></li><li><a href="ResultSet.html">ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="SeedStrategy.html">SeedStrategy</a></li><li><a href="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li><li><a href="global.html#deserializeProperties">deserializeProperties</a></li><li><a href="global.html#statics">statics</a></li><li><a href="global.html#toArrayBuffer">toArrayBuffer</a></li></ul>
|
|
544
606
|
</nav>
|
|
545
607
|
|
|
546
608
|
<br class="clear">
|
|
547
609
|
|
|
548
610
|
<footer>
|
|
549
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
611
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 15:09:27 GMT-0800 (Pacific Standard Time)
|
|
550
612
|
</footer>
|
|
551
613
|
|
|
552
614
|
<script> prettyPrint(); </script>
|
package/doc/utils.js.html
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
const uuid = require('uuid');
|
|
55
55
|
|
|
56
|
-
const gremlinVersion = '3.
|
|
56
|
+
const gremlinVersion = '3.8.0'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
|
|
57
57
|
|
|
58
58
|
exports.toLong = function toLong(value) {
|
|
59
59
|
return new Long(value);
|
|
@@ -166,13 +166,13 @@ module.exports.DeferredPromise = DeferredPromise;
|
|
|
166
166
|
</div>
|
|
167
167
|
|
|
168
168
|
<nav>
|
|
169
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="CardinalityValue.html">CardinalityValue</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="module.exports.html">exports</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</a></li><li><a href="ResultSet.html">ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="SeedStrategy.html">SeedStrategy</a></li><li><a href="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li><li><a href="global.html#statics">statics</a></li><li><a href="global.html#toArrayBuffer">toArrayBuffer</a></li></ul>
|
|
169
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="CardinalityValue.html">CardinalityValue</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="module.exports.html">exports</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</a></li><li><a href="ResultSet.html">ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="SeedStrategy.html">SeedStrategy</a></li><li><a href="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li><li><a href="global.html#deserializeProperties">deserializeProperties</a></li><li><a href="global.html#statics">statics</a></li><li><a href="global.html#toArrayBuffer">toArrayBuffer</a></li></ul>
|
|
170
170
|
</nav>
|
|
171
171
|
|
|
172
172
|
<br class="clear">
|
|
173
173
|
|
|
174
174
|
<footer>
|
|
175
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
175
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 15:09:27 GMT-0800 (Pacific Standard Time)
|
|
176
176
|
</footer>
|
|
177
177
|
|
|
178
178
|
<script> prettyPrint(); </script>
|
package/docker-compose.yml
CHANGED
|
@@ -43,7 +43,7 @@ services:
|
|
|
43
43
|
|
|
44
44
|
gremlin-js-integration-tests:
|
|
45
45
|
container_name: gremlin-js-integration-tests
|
|
46
|
-
image: node
|
|
46
|
+
image: node:${NODE_VERSION:-20}
|
|
47
47
|
volumes:
|
|
48
48
|
- .:/js_app
|
|
49
49
|
- ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
|
|
@@ -58,6 +58,7 @@ services:
|
|
|
58
58
|
depends_on:
|
|
59
59
|
gremlin-server-test-js:
|
|
60
60
|
condition: service_healthy
|
|
61
|
+
|
|
61
62
|
gremlin-socket-server:
|
|
62
63
|
container_name: gremlin-socket-server-js
|
|
63
64
|
image: tinkerpop/gremlin-socket-server:${GREMLIN_SERVER}
|
package/lib/driver/connection.js
CHANGED
|
@@ -39,7 +39,7 @@ const responseStatusCode = {
|
|
|
39
39
|
authenticationChallenge: 407,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const defaultMimeType = 'application/vnd.
|
|
42
|
+
const defaultMimeType = 'application/vnd.graphbinary-v1.0';
|
|
43
43
|
const graphSON2MimeType = 'application/vnd.gremlin-v2.0+json';
|
|
44
44
|
const graphBinaryMimeType = 'application/vnd.graphbinary-v1.0';
|
|
45
45
|
|
|
@@ -135,9 +135,12 @@ class Connection extends EventEmitter {
|
|
|
135
135
|
'perMessageDeflate',
|
|
136
136
|
]);
|
|
137
137
|
// Check if any `ws` specific options are provided and are non-null / non-undefined
|
|
138
|
-
const hasWsSpecificOptions =
|
|
139
|
-
(
|
|
140
|
-
|
|
138
|
+
const hasWsSpecificOptions =
|
|
139
|
+
Object.entries(this.options).some(
|
|
140
|
+
([key, value]) => wsSpecificOptions.has(key) && ![null, undefined].includes(value),
|
|
141
|
+
) ||
|
|
142
|
+
this._enableCompression || // we need to check the presence of this variable and pass this into ws
|
|
143
|
+
this._enableUserAgentOnConnect; // global websocket will send "node" as user agent by default which doesn't comply with Gremlin
|
|
141
144
|
// Only use the global websocket if we don't have any unsupported options
|
|
142
145
|
const useGlobalWebSocket = !hasWsSpecificOptions && globalThis.WebSocket;
|
|
143
146
|
const WebSocket = useGlobalWebSocket || (await import('ws')).default;
|
|
@@ -163,10 +166,15 @@ class Connection extends EventEmitter {
|
|
|
163
166
|
|
|
164
167
|
this._ws.addEventListener('open', this.#handleOpen);
|
|
165
168
|
this._ws.addEventListener('error', this.#handleError);
|
|
166
|
-
|
|
169
|
+
// Only attach unexpected-response listener if WebSocket supports .on() method
|
|
170
|
+
// Browser WebSocket does not have this event and .on() method
|
|
171
|
+
if (this._ws && 'on' in this._ws) {
|
|
172
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
173
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
174
|
+
this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
|
|
175
|
+
}
|
|
167
176
|
this._ws.addEventListener('message', this.#handleMessage);
|
|
168
177
|
this._ws.addEventListener('close', this.#handleClose);
|
|
169
|
-
|
|
170
178
|
return await this._openPromise;
|
|
171
179
|
}
|
|
172
180
|
|
|
@@ -415,7 +423,13 @@ class Connection extends EventEmitter {
|
|
|
415
423
|
});
|
|
416
424
|
this._ws.removeEventListener('open', this.#handleOpen);
|
|
417
425
|
this._ws.removeEventListener('error', this.#handleError);
|
|
418
|
-
|
|
426
|
+
// Only remove unexpected-response listener for Node.js WebSocket (ws package)
|
|
427
|
+
// Browser WebSocket does not have this event and .off() method
|
|
428
|
+
if (this._ws && 'off' in this._ws) {
|
|
429
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
430
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
431
|
+
this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
|
|
432
|
+
}
|
|
419
433
|
this._ws.removeEventListener('message', this.#handleMessage);
|
|
420
434
|
this._ws.removeEventListener('close', this.#handleClose);
|
|
421
435
|
this._openPromise = null;
|
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
22
|
const graphTraversalModule = require('./graph-traversal');
|
|
23
|
+
const remote = require('../driver/remote-connection');
|
|
23
24
|
const TraversalStrategies = require('./traversal-strategy').TraversalStrategies;
|
|
24
25
|
const GraphTraversalSource = graphTraversalModule.GraphTraversalSource;
|
|
26
|
+
const GraphTraversal = graphTraversalModule.GraphTraversal;
|
|
27
|
+
const Bytecode = require('./bytecode');
|
|
25
28
|
const Graph = require('../structure/graph').Graph;
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -33,44 +36,51 @@ class AnonymousTraversalSource {
|
|
|
33
36
|
/**
|
|
34
37
|
* Creates a new instance of {@code AnonymousTraversalSource}.
|
|
35
38
|
* @param {Function} [traversalSourceClass] Optional {@code GraphTraversalSource} constructor.
|
|
39
|
+
* @param {Function} [traversalClass] Optional {@code GraphTraversal} constructor.
|
|
36
40
|
*/
|
|
37
|
-
constructor(traversalSourceClass) {
|
|
41
|
+
constructor(traversalSourceClass, traversalClass) {
|
|
38
42
|
this.traversalSourceClass = traversalSourceClass;
|
|
43
|
+
this.traversalClass = traversalClass;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
42
47
|
* Constructs an {@code AnonymousTraversalSource} which will then be configured to spawn a
|
|
43
48
|
* {@link GraphTraversalSource}.
|
|
44
49
|
* @param {Function} [traversalSourceClass] Optional {@code GraphTraversalSource} constructor.
|
|
50
|
+
* @param {Function} [traversalClass] Optional {@code GraphTraversalSource} constructor.
|
|
45
51
|
* @returns {AnonymousTraversalSource}.
|
|
46
52
|
*/
|
|
47
|
-
static traversal(traversalSourceClass) {
|
|
48
|
-
return new AnonymousTraversalSource(traversalSourceClass || GraphTraversalSource);
|
|
53
|
+
static traversal(traversalSourceClass, traversalClass) {
|
|
54
|
+
return new AnonymousTraversalSource(traversalSourceClass || GraphTraversalSource, traversalClass || GraphTraversal);
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* Creates a {@link GraphTraversalSource} binding a {@link RemoteConnection} to a remote {@link Graph} instances as its
|
|
53
59
|
* reference so that traversals spawned from it will execute over that reference.
|
|
54
|
-
* @param {RemoteConnection}
|
|
60
|
+
* @param {RemoteConnection} connection
|
|
55
61
|
* @return {GraphTraversalSource}
|
|
56
62
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
with_(connection) {
|
|
64
|
+
const traversalStrategies = new TraversalStrategies();
|
|
65
|
+
traversalStrategies.addStrategy(new remote.RemoteStrategy(connection));
|
|
66
|
+
return new this.traversalSourceClass(
|
|
67
|
+
new Graph(),
|
|
68
|
+
traversalStrategies,
|
|
69
|
+
new Bytecode(),
|
|
70
|
+
this.traversalSourceClass,
|
|
71
|
+
this.traversalClass,
|
|
72
|
+
);
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
/**
|
|
62
|
-
* Creates
|
|
63
|
-
* traversals spawned from it will execute over that reference.
|
|
64
|
-
*
|
|
65
|
-
* with a {@link Graph} instance (which is only a reference to a graph and is not capable of holding data). As a
|
|
66
|
-
* result, the {@link GraphTraversalSource} will do nothing unless a "remote" is then assigned to it later.
|
|
67
|
-
* @param {Graph} graph
|
|
76
|
+
* Creates a {@link GraphTraversalSource} binding a {@link RemoteConnection} to a remote {@link Graph} instances as its
|
|
77
|
+
* reference so that traversals spawned from it will execute over that reference.
|
|
78
|
+
* @param {RemoteConnection} remoteConnection
|
|
68
79
|
* @return {GraphTraversalSource}
|
|
69
|
-
* @deprecated As of release 3.
|
|
70
|
-
* at which point there will be support for {@code withEmbedded} which is part of the canonical Java API.
|
|
80
|
+
* @deprecated As of release 3.8.0, prefer {@link with_}.
|
|
71
81
|
*/
|
|
72
|
-
|
|
73
|
-
return
|
|
82
|
+
withRemote(remoteConnection) {
|
|
83
|
+
return this.with_(remoteConnection);
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
86
|
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
const { Traversal, cardinality } = require('./traversal');
|
|
26
26
|
const { Transaction } = require('./transaction');
|
|
27
|
-
const remote = require('../driver/remote-connection');
|
|
28
27
|
const Bytecode = require('./bytecode');
|
|
29
28
|
const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy } = require('./traversal-strategy');
|
|
30
29
|
|
|
@@ -46,30 +45,10 @@ class GraphTraversalSource {
|
|
|
46
45
|
this.bytecode = bytecode || new Bytecode();
|
|
47
46
|
this.graphTraversalSourceClass = graphTraversalSourceClass || GraphTraversalSource;
|
|
48
47
|
this.graphTraversalClass = graphTraversalClass || GraphTraversal;
|
|
49
|
-
|
|
50
|
-
// in order to keep the constructor unchanged within 3.5.x we can try to pop the RemoteConnection out of the
|
|
51
|
-
// TraversalStrategies. keeping this unchanged will allow user DSLs to not take a break.
|
|
52
|
-
// TODO: refactor this to be nicer in 3.6.0 when we can take a breaking change
|
|
53
48
|
const strat = traversalStrategies.strategies.find((ts) => ts.fqcn === 'js:RemoteStrategy');
|
|
54
49
|
this.remoteConnection = strat !== undefined ? strat.connection : undefined;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
/**
|
|
58
|
-
* @param {RemoteConnection} remoteConnection
|
|
59
|
-
* @returns {GraphTraversalSource}
|
|
60
|
-
*/
|
|
61
|
-
withRemote(remoteConnection) {
|
|
62
|
-
const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
|
|
63
|
-
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
|
|
64
|
-
return new this.graphTraversalSourceClass(
|
|
65
|
-
this.graph,
|
|
66
|
-
traversalStrategy,
|
|
67
|
-
new Bytecode(this.bytecode),
|
|
68
|
-
this.graphTraversalSourceClass,
|
|
69
|
-
this.graphTraversalClass,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
52
|
/**
|
|
74
53
|
* Spawn a new <code>Transaction</code> object that can then start and stop a transaction.
|
|
75
54
|
* @returns {Transaction}
|
|
@@ -454,6 +433,16 @@ class GraphTraversal extends Traversal {
|
|
|
454
433
|
return this;
|
|
455
434
|
}
|
|
456
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Graph traversal asBool method.
|
|
438
|
+
* @param {...Object} args
|
|
439
|
+
* @returns {GraphTraversal}
|
|
440
|
+
*/
|
|
441
|
+
asBool(...args) {
|
|
442
|
+
this.bytecode.addStep('asBool', args);
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
|
|
457
446
|
/**
|
|
458
447
|
* Graph traversal asDate method.
|
|
459
448
|
* @param {...Object} args
|
|
@@ -464,6 +453,16 @@ class GraphTraversal extends Traversal {
|
|
|
464
453
|
return this;
|
|
465
454
|
}
|
|
466
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Graph traversal asNumber method.
|
|
458
|
+
* @param {...Object} args
|
|
459
|
+
* @returns {GraphTraversal}
|
|
460
|
+
*/
|
|
461
|
+
asNumber(...args) {
|
|
462
|
+
this.bytecode.addStep('asNumber', args);
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
|
|
467
466
|
/**
|
|
468
467
|
* Graph traversal asString method.
|
|
469
468
|
* @param {...Object} args
|
|
@@ -693,6 +692,16 @@ class GraphTraversal extends Traversal {
|
|
|
693
692
|
return this;
|
|
694
693
|
}
|
|
695
694
|
|
|
695
|
+
/**
|
|
696
|
+
* Graph traversal discard method.
|
|
697
|
+
* @param {...Object} args
|
|
698
|
+
* @returns {GraphTraversal}
|
|
699
|
+
*/
|
|
700
|
+
discard(...args) {
|
|
701
|
+
this.bytecode.addStep('discard', args);
|
|
702
|
+
return this;
|
|
703
|
+
}
|
|
704
|
+
|
|
696
705
|
/**
|
|
697
706
|
* Graph traversal disjunct method.
|
|
698
707
|
* @param {...Object} args
|
|
@@ -1472,16 +1481,6 @@ class GraphTraversal extends Traversal {
|
|
|
1472
1481
|
return this;
|
|
1473
1482
|
}
|
|
1474
1483
|
|
|
1475
|
-
/**
|
|
1476
|
-
* Graph traversal store method.
|
|
1477
|
-
* @param {...Object} args
|
|
1478
|
-
* @returns {GraphTraversal}
|
|
1479
|
-
*/
|
|
1480
|
-
store(...args) {
|
|
1481
|
-
this.bytecode.addStep('store', args);
|
|
1482
|
-
return this;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
1484
|
/**
|
|
1486
1485
|
* Graph traversal subgraph method.
|
|
1487
1486
|
* @param {...Object} args
|
|
@@ -1761,7 +1760,9 @@ const statics = {
|
|
|
1761
1760
|
and: (...args) => callOnEmptyTraversal('and', args),
|
|
1762
1761
|
any: (...args) => callOnEmptyTraversal('any', args),
|
|
1763
1762
|
as: (...args) => callOnEmptyTraversal('as', args),
|
|
1763
|
+
asBool: (...args) => callOnEmptyTraversal('asBool', args),
|
|
1764
1764
|
asDate: (...args) => callOnEmptyTraversal('asDate', args),
|
|
1765
|
+
asNumber: (...args) => callOnEmptyTraversal('asNumber', args),
|
|
1765
1766
|
asString: (...args) => callOnEmptyTraversal('asString', args),
|
|
1766
1767
|
barrier: (...args) => callOnEmptyTraversal('barrier', args),
|
|
1767
1768
|
both: (...args) => callOnEmptyTraversal('both', args),
|
|
@@ -1773,13 +1774,17 @@ const statics = {
|
|
|
1773
1774
|
choose: (...args) => callOnEmptyTraversal('choose', args),
|
|
1774
1775
|
coalesce: (...args) => callOnEmptyTraversal('coalesce', args),
|
|
1775
1776
|
coin: (...args) => callOnEmptyTraversal('coin', args),
|
|
1777
|
+
combine: (...args) => callOnEmptyTraversal('combine', args),
|
|
1776
1778
|
concat: (...args) => callOnEmptyTraversal('concat', args),
|
|
1779
|
+
conjoin: (...args) => callOnEmptyTraversal('conjoin', args),
|
|
1777
1780
|
constant: (...args) => callOnEmptyTraversal('constant', args),
|
|
1778
1781
|
count: (...args) => callOnEmptyTraversal('count', args),
|
|
1779
1782
|
cyclicPath: (...args) => callOnEmptyTraversal('cyclicPath', args),
|
|
1780
1783
|
dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
|
|
1781
1784
|
dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
|
|
1782
1785
|
dedup: (...args) => callOnEmptyTraversal('dedup', args),
|
|
1786
|
+
difference: (...args) => callOnEmptyTraversal('difference', args),
|
|
1787
|
+
discard: (...args) => callOnEmptyTraversal('discard', args),
|
|
1783
1788
|
disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
|
|
1784
1789
|
drop: (...args) => callOnEmptyTraversal('drop', args),
|
|
1785
1790
|
element: (...args) => callOnEmptyTraversal('element', args),
|
|
@@ -1805,6 +1810,7 @@ const statics = {
|
|
|
1805
1810
|
inV: (...args) => callOnEmptyTraversal('inV', args),
|
|
1806
1811
|
index: (...args) => callOnEmptyTraversal('index', args),
|
|
1807
1812
|
inject: (...args) => callOnEmptyTraversal('inject', args),
|
|
1813
|
+
intersect: (...args) => callOnEmptyTraversal('intersect', args),
|
|
1808
1814
|
is: (...args) => callOnEmptyTraversal('is', args),
|
|
1809
1815
|
key: (...args) => callOnEmptyTraversal('key', args),
|
|
1810
1816
|
label: (...args) => callOnEmptyTraversal('label', args),
|
|
@@ -1818,6 +1824,7 @@ const statics = {
|
|
|
1818
1824
|
math: (...args) => callOnEmptyTraversal('math', args),
|
|
1819
1825
|
max: (...args) => callOnEmptyTraversal('max', args),
|
|
1820
1826
|
mean: (...args) => callOnEmptyTraversal('mean', args),
|
|
1827
|
+
merge: (...args) => callOnEmptyTraversal('merge', args),
|
|
1821
1828
|
mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
|
|
1822
1829
|
mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
|
|
1823
1830
|
min: (...args) => callOnEmptyTraversal('min', args),
|
|
@@ -1831,6 +1838,7 @@ const statics = {
|
|
|
1831
1838
|
outE: (...args) => callOnEmptyTraversal('outE', args),
|
|
1832
1839
|
outV: (...args) => callOnEmptyTraversal('outV', args),
|
|
1833
1840
|
path: (...args) => callOnEmptyTraversal('path', args),
|
|
1841
|
+
product: (...args) => callOnEmptyTraversal('product', args),
|
|
1834
1842
|
project: (...args) => callOnEmptyTraversal('project', args),
|
|
1835
1843
|
properties: (...args) => callOnEmptyTraversal('properties', args),
|
|
1836
1844
|
property: (...args) => callOnEmptyTraversal('property', args),
|
|
@@ -1847,7 +1855,6 @@ const statics = {
|
|
|
1847
1855
|
simplePath: (...args) => callOnEmptyTraversal('simplePath', args),
|
|
1848
1856
|
skip: (...args) => callOnEmptyTraversal('skip', args),
|
|
1849
1857
|
split: (...args) => callOnEmptyTraversal('split', args),
|
|
1850
|
-
store: (...args) => callOnEmptyTraversal('store', args),
|
|
1851
1858
|
subgraph: (...args) => callOnEmptyTraversal('subgraph', args),
|
|
1852
1859
|
substring: (...args) => callOnEmptyTraversal('substring', args),
|
|
1853
1860
|
sum: (...args) => callOnEmptyTraversal('sum', args),
|