gremlin 3.7.3 → 3.7.5
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/NOTICE +1 -1
- package/doc/AnonymousTraversalSource.html +1 -1
- package/doc/Authenticator.html +1 -1
- package/doc/Bytecode.html +1 -1
- package/doc/CardinalityValue.html +1 -1
- package/doc/Client.html +1 -1
- package/doc/Connection.html +5 -5
- package/doc/DataType.js.html +2 -1
- package/doc/DriverRemoteConnection.html +1 -1
- package/doc/EdgeLabelVerificationStrategy.html +1 -1
- package/doc/Graph.html +1 -1
- package/doc/GraphBinaryReader.js.html +1 -1
- package/doc/GraphBinaryWriter.js.html +1 -1
- package/doc/GraphSON2Reader.html +1 -1
- package/doc/GraphSON2Writer.html +1 -1
- package/doc/GraphSON3Reader.html +1 -1
- package/doc/GraphSON3Writer.html +1 -1
- package/doc/GraphTraversal.html +1 -1
- package/doc/GraphTraversalSource.html +1 -1
- package/doc/HaltedTraverserStrategy.html +1 -1
- package/doc/MatchAlgorithmStrategy.html +1 -1
- package/doc/P.html +1 -1
- package/doc/PartitionStrategy.html +1 -1
- package/doc/Path.html +2 -2
- package/doc/PlainTextSaslAuthenticator.html +1 -1
- package/doc/ProductiveByStrategy.html +1 -1
- package/doc/RemoteConnection.html +1 -1
- package/doc/RemoteStrategy.html +1 -1
- package/doc/RemoteTraversal.html +1 -1
- package/doc/ReservedKeysVerificationStrategy.html +1 -1
- package/doc/ResponseError.html +1 -1
- package/doc/ResultSet.html +1 -1
- package/doc/SaslAuthenticator.html +1 -1
- package/doc/SaslMechanismBase.html +1 -1
- package/doc/SaslMechanismPlain.html +1 -1
- package/doc/SeedStrategy.html +1 -1
- package/doc/SubgraphStrategy.html +1 -1
- package/doc/TextP.html +1 -1
- package/doc/Transaction.html +1 -1
- package/doc/Translator.html +1 -1
- package/doc/TraversalStrategies.html +1 -1
- package/doc/TraversalStrategy.html +1 -1
- package/doc/TypeSerializer.html +1 -1
- package/doc/driver_auth_authenticator.js.html +1 -1
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +1 -1
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +1 -1
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +1 -1
- package/doc/driver_auth_sasl-authenticator.js.html +1 -1
- package/doc/driver_client.js.html +1 -1
- package/doc/driver_connection.js.html +61 -6
- package/doc/driver_driver-remote-connection.js.html +1 -1
- package/doc/driver_remote-connection.js.html +1 -1
- package/doc/driver_response-error.js.html +1 -1
- package/doc/driver_result-set.js.html +1 -1
- package/doc/global.html +1 -1
- package/doc/index.html +1 -1
- package/doc/module.exports.html +1 -1
- package/doc/process_anonymous-traversal.js.html +1 -1
- package/doc/process_bytecode.js.html +1 -1
- package/doc/process_graph-traversal.js.html +9 -1
- package/doc/process_transaction.js.html +1 -1
- package/doc/process_translator.js.html +3 -3
- package/doc/process_traversal-strategy.js.html +1 -1
- package/doc/process_traversal.js.html +1 -1
- package/doc/structure_graph.js.html +7 -5
- package/doc/structure_io_binary_internals_DataType.js.html +1 -1
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +1 -1
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +1 -1
- package/doc/structure_io_graph-serializer.js.html +1 -1
- package/doc/structure_io_type-serializers.js.html +1 -1
- package/doc/utils.js.html +2 -2
- package/docker-compose.yml +1 -1
- package/lib/driver/connection.js +60 -5
- package/lib/process/graph-traversal.js +8 -0
- package/lib/process/translator.js +2 -2
- package/lib/structure/graph.js +6 -4
- package/lib/utils.js +1 -1
- package/package.json +3 -3
|
@@ -123,6 +123,7 @@ class Connection extends EventEmitter {
|
|
|
123
123
|
this.traversalSource = options.traversalSource || 'g';
|
|
124
124
|
this._authenticator = options.authenticator;
|
|
125
125
|
this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
|
|
126
|
+
this._enableCompression = this.options.enableCompression || false;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
/**
|
|
@@ -151,12 +152,27 @@ class Connection extends EventEmitter {
|
|
|
151
152
|
headers[utils.getUserAgentHeader()] = await utils.getUserAgent();
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
-
const
|
|
155
|
+
// All these options are available to the `ws` package's constructor, but not the global WebSocket class
|
|
156
|
+
const wsSpecificOptions = new Set([
|
|
157
|
+
'headers',
|
|
158
|
+
'ca',
|
|
159
|
+
'cert',
|
|
160
|
+
'pfx',
|
|
161
|
+
'rejectUnauthorized',
|
|
162
|
+
'agent',
|
|
163
|
+
'perMessageDeflate',
|
|
164
|
+
]);
|
|
165
|
+
// Check if any `ws` specific options are provided and are non-null / non-undefined
|
|
166
|
+
const hasWsSpecificOptions = Object.entries(this.options).some(
|
|
167
|
+
([key, value]) => wsSpecificOptions.has(key) && ![null, undefined].includes(value),
|
|
168
|
+
);
|
|
169
|
+
// Only use the global websocket if we don't have any unsupported options
|
|
170
|
+
const useGlobalWebSocket = !hasWsSpecificOptions && globalThis.WebSocket;
|
|
171
|
+
const WebSocket = useGlobalWebSocket || (await import('ws')).default;
|
|
156
172
|
|
|
157
173
|
this._ws = new WebSocket(
|
|
158
174
|
this.url,
|
|
159
|
-
|
|
175
|
+
!useGlobalWebSocket
|
|
160
176
|
? {
|
|
161
177
|
headers: headers,
|
|
162
178
|
ca: this.options.ca,
|
|
@@ -164,7 +180,7 @@ class Connection extends EventEmitter {
|
|
|
164
180
|
pfx: this.options.pfx,
|
|
165
181
|
rejectUnauthorized: this.options.rejectUnauthorized,
|
|
166
182
|
agent: this.options.agent,
|
|
167
|
-
perMessageDeflate: this.
|
|
183
|
+
perMessageDeflate: this._enableCompression,
|
|
168
184
|
}
|
|
169
185
|
: undefined,
|
|
170
186
|
);
|
|
@@ -175,9 +191,15 @@ class Connection extends EventEmitter {
|
|
|
175
191
|
|
|
176
192
|
this._ws.addEventListener('open', this.#handleOpen);
|
|
177
193
|
this._ws.addEventListener('error', this.#handleError);
|
|
194
|
+
// Only attach unexpected-response listener if WebSocket supports .on() method
|
|
195
|
+
// Browser WebSocket does not have this event and .on() method
|
|
196
|
+
if (this._ws && 'on' in this._ws) {
|
|
197
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
198
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
199
|
+
this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
|
|
200
|
+
}
|
|
178
201
|
this._ws.addEventListener('message', this.#handleMessage);
|
|
179
202
|
this._ws.addEventListener('close', this.#handleClose);
|
|
180
|
-
|
|
181
203
|
return await this._openPromise;
|
|
182
204
|
}
|
|
183
205
|
|
|
@@ -272,6 +294,32 @@ class Connection extends EventEmitter {
|
|
|
272
294
|
this.isOpen = true;
|
|
273
295
|
};
|
|
274
296
|
|
|
297
|
+
/**
|
|
298
|
+
* @param {ClientRequest} _req
|
|
299
|
+
* @param {IncomingMessage} res
|
|
300
|
+
*/
|
|
301
|
+
#handleUnexpectedResponse = async (_req, res) => {
|
|
302
|
+
const body = await new Promise((resolve, reject) => {
|
|
303
|
+
const chunks = [];
|
|
304
|
+
res.on('data', (data) => {
|
|
305
|
+
chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
306
|
+
});
|
|
307
|
+
res.on('end', () => {
|
|
308
|
+
resolve(chunks.length ? Buffer.concat(chunks) : null);
|
|
309
|
+
});
|
|
310
|
+
res.on('error', reject);
|
|
311
|
+
});
|
|
312
|
+
const statusCodeErrorMessage = `Unexpected server response code ${res.statusCode}`;
|
|
313
|
+
const errorMessage = body ? `${statusCodeErrorMessage} with body:\n${body.toString()}` : statusCodeErrorMessage;
|
|
314
|
+
const error = new Error(errorMessage);
|
|
315
|
+
this.#handleError({
|
|
316
|
+
error,
|
|
317
|
+
message: errorMessage,
|
|
318
|
+
type: 'unexpected-response',
|
|
319
|
+
target: this._ws,
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
275
323
|
/**
|
|
276
324
|
* @param {Event} event
|
|
277
325
|
*/
|
|
@@ -400,6 +448,13 @@ class Connection extends EventEmitter {
|
|
|
400
448
|
});
|
|
401
449
|
this._ws.removeEventListener('open', this.#handleOpen);
|
|
402
450
|
this._ws.removeEventListener('error', this.#handleError);
|
|
451
|
+
// Only remove unexpected-response listener for Node.js WebSocket (ws package)
|
|
452
|
+
// Browser WebSocket does not have this event and .off() method
|
|
453
|
+
if (this._ws && 'off' in this._ws) {
|
|
454
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
455
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
456
|
+
this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
|
|
457
|
+
}
|
|
403
458
|
this._ws.removeEventListener('message', this.#handleMessage);
|
|
404
459
|
this._ws.removeEventListener('close', this.#handleClose);
|
|
405
460
|
this._openPromise = null;
|
|
@@ -451,7 +506,7 @@ module.exports = Connection;
|
|
|
451
506
|
<br class="clear">
|
|
452
507
|
|
|
453
508
|
<footer>
|
|
454
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
509
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
455
510
|
</footer>
|
|
456
511
|
|
|
457
512
|
<script> prettyPrint(); </script>
|
|
@@ -184,7 +184,7 @@ module.exports = DriverRemoteConnection;
|
|
|
184
184
|
<br class="clear">
|
|
185
185
|
|
|
186
186
|
<footer>
|
|
187
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
187
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
188
188
|
</footer>
|
|
189
189
|
|
|
190
190
|
<script> prettyPrint(); </script>
|
|
@@ -189,7 +189,7 @@ module.exports = { RemoteConnection, RemoteStrategy, RemoteTraversal };
|
|
|
189
189
|
<br class="clear">
|
|
190
190
|
|
|
191
191
|
<footer>
|
|
192
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
192
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
193
193
|
</footer>
|
|
194
194
|
|
|
195
195
|
<script> prettyPrint(); </script>
|
|
@@ -89,7 +89,7 @@ module.exports = ResponseError;
|
|
|
89
89
|
<br class="clear">
|
|
90
90
|
|
|
91
91
|
<footer>
|
|
92
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
92
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
93
93
|
</footer>
|
|
94
94
|
|
|
95
95
|
<script> prettyPrint(); </script>
|
|
@@ -125,7 +125,7 @@ module.exports = ResultSet;
|
|
|
125
125
|
<br class="clear">
|
|
126
126
|
|
|
127
127
|
<footer>
|
|
128
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
128
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
129
129
|
</footer>
|
|
130
130
|
|
|
131
131
|
<script> prettyPrint(); </script>
|
package/doc/global.html
CHANGED
|
@@ -631,7 +631,7 @@ See org.apache.tinkerpop.gremlin.structure.io.binary.DataType Java class.
|
|
|
631
631
|
<br class="clear">
|
|
632
632
|
|
|
633
633
|
<footer>
|
|
634
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
634
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
635
635
|
</footer>
|
|
636
636
|
|
|
637
637
|
<script> prettyPrint(); </script>
|
package/doc/index.html
CHANGED
|
@@ -176,7 +176,7 @@ for early testing purposes only. These releases are not suitable for production.
|
|
|
176
176
|
<br class="clear">
|
|
177
177
|
|
|
178
178
|
<footer>
|
|
179
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
179
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
180
180
|
</footer>
|
|
181
181
|
|
|
182
182
|
<script> prettyPrint(); </script>
|
package/doc/module.exports.html
CHANGED
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
<br class="clear">
|
|
293
293
|
|
|
294
294
|
<footer>
|
|
295
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
295
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
296
296
|
</footer>
|
|
297
297
|
|
|
298
298
|
<script> prettyPrint(); </script>
|
|
@@ -119,7 +119,7 @@ module.exports = AnonymousTraversalSource;
|
|
|
119
119
|
<br class="clear">
|
|
120
120
|
|
|
121
121
|
<footer>
|
|
122
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
122
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
123
123
|
</footer>
|
|
124
124
|
|
|
125
125
|
<script> prettyPrint(); </script>
|
|
@@ -166,7 +166,7 @@ module.exports = Bytecode;
|
|
|
166
166
|
<br class="clear">
|
|
167
167
|
|
|
168
168
|
<footer>
|
|
169
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
169
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
170
170
|
</footer>
|
|
171
171
|
|
|
172
172
|
<script> prettyPrint(); </script>
|
|
@@ -1801,13 +1801,17 @@ const statics = {
|
|
|
1801
1801
|
choose: (...args) => callOnEmptyTraversal('choose', args),
|
|
1802
1802
|
coalesce: (...args) => callOnEmptyTraversal('coalesce', args),
|
|
1803
1803
|
coin: (...args) => callOnEmptyTraversal('coin', args),
|
|
1804
|
+
combine: (...args) => callOnEmptyTraversal('combine', args),
|
|
1804
1805
|
concat: (...args) => callOnEmptyTraversal('concat', args),
|
|
1806
|
+
conjoin: (...args) => callOnEmptyTraversal('conjoin', args),
|
|
1805
1807
|
constant: (...args) => callOnEmptyTraversal('constant', args),
|
|
1806
1808
|
count: (...args) => callOnEmptyTraversal('count', args),
|
|
1807
1809
|
cyclicPath: (...args) => callOnEmptyTraversal('cyclicPath', args),
|
|
1808
1810
|
dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
|
|
1809
1811
|
dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
|
|
1810
1812
|
dedup: (...args) => callOnEmptyTraversal('dedup', args),
|
|
1813
|
+
difference: (...args) => callOnEmptyTraversal('difference', args),
|
|
1814
|
+
disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
|
|
1811
1815
|
drop: (...args) => callOnEmptyTraversal('drop', args),
|
|
1812
1816
|
element: (...args) => callOnEmptyTraversal('element', args),
|
|
1813
1817
|
elementMap: (...args) => callOnEmptyTraversal('elementMap', args),
|
|
@@ -1832,6 +1836,7 @@ const statics = {
|
|
|
1832
1836
|
inV: (...args) => callOnEmptyTraversal('inV', args),
|
|
1833
1837
|
index: (...args) => callOnEmptyTraversal('index', args),
|
|
1834
1838
|
inject: (...args) => callOnEmptyTraversal('inject', args),
|
|
1839
|
+
intersect: (...args) => callOnEmptyTraversal('intersect', args),
|
|
1835
1840
|
is: (...args) => callOnEmptyTraversal('is', args),
|
|
1836
1841
|
key: (...args) => callOnEmptyTraversal('key', args),
|
|
1837
1842
|
label: (...args) => callOnEmptyTraversal('label', args),
|
|
@@ -1845,9 +1850,11 @@ const statics = {
|
|
|
1845
1850
|
math: (...args) => callOnEmptyTraversal('math', args),
|
|
1846
1851
|
max: (...args) => callOnEmptyTraversal('max', args),
|
|
1847
1852
|
mean: (...args) => callOnEmptyTraversal('mean', args),
|
|
1853
|
+
merge: (...args) => callOnEmptyTraversal('merge', args),
|
|
1848
1854
|
mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
|
|
1849
1855
|
mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
|
|
1850
1856
|
min: (...args) => callOnEmptyTraversal('min', args),
|
|
1857
|
+
none: (...args) => callOnEmptyTraversal('none', args),
|
|
1851
1858
|
not: (...args) => callOnEmptyTraversal('not', args),
|
|
1852
1859
|
optional: (...args) => callOnEmptyTraversal('optional', args),
|
|
1853
1860
|
or: (...args) => callOnEmptyTraversal('or', args),
|
|
@@ -1857,6 +1864,7 @@ const statics = {
|
|
|
1857
1864
|
outE: (...args) => callOnEmptyTraversal('outE', args),
|
|
1858
1865
|
outV: (...args) => callOnEmptyTraversal('outV', args),
|
|
1859
1866
|
path: (...args) => callOnEmptyTraversal('path', args),
|
|
1867
|
+
product: (...args) => callOnEmptyTraversal('product', args),
|
|
1860
1868
|
project: (...args) => callOnEmptyTraversal('project', args),
|
|
1861
1869
|
properties: (...args) => callOnEmptyTraversal('properties', args),
|
|
1862
1870
|
property: (...args) => callOnEmptyTraversal('property', args),
|
|
@@ -1918,7 +1926,7 @@ module.exports = {
|
|
|
1918
1926
|
<br class="clear">
|
|
1919
1927
|
|
|
1920
1928
|
<footer>
|
|
1921
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
1929
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
1922
1930
|
</footer>
|
|
1923
1931
|
|
|
1924
1932
|
<script> prettyPrint(); </script>
|
|
@@ -142,7 +142,7 @@ module.exports = {
|
|
|
142
142
|
<br class="clear">
|
|
143
143
|
|
|
144
144
|
<footer>
|
|
145
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
145
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
146
146
|
</footer>
|
|
147
147
|
|
|
148
148
|
<script> prettyPrint(); </script>
|
|
@@ -119,7 +119,7 @@ class Translator {
|
|
|
119
119
|
}
|
|
120
120
|
script += `('${key}', `;
|
|
121
121
|
if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
|
|
122
|
-
script += `'${anyObject[key]}'`;
|
|
122
|
+
script += `'${`${anyObject[key]}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
|
|
123
123
|
} else {
|
|
124
124
|
script += anyObject[key];
|
|
125
125
|
}
|
|
@@ -139,7 +139,7 @@ class Translator {
|
|
|
139
139
|
} else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
|
|
140
140
|
script += anyObject;
|
|
141
141
|
} else {
|
|
142
|
-
script += `'${`${anyObject}`.
|
|
142
|
+
script += `'${`${anyObject}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return script;
|
|
@@ -163,7 +163,7 @@ module.exports = Translator;
|
|
|
163
163
|
<br class="clear">
|
|
164
164
|
|
|
165
165
|
<footer>
|
|
166
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
166
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
167
167
|
</footer>
|
|
168
168
|
|
|
169
169
|
<script> prettyPrint(); </script>
|
|
@@ -395,7 +395,7 @@ module.exports = {
|
|
|
395
395
|
<br class="clear">
|
|
396
396
|
|
|
397
397
|
<footer>
|
|
398
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
398
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
399
399
|
</footer>
|
|
400
400
|
|
|
401
401
|
<script> prettyPrint(); </script>
|
|
@@ -566,7 +566,7 @@ module.exports = {
|
|
|
566
566
|
<br class="clear">
|
|
567
567
|
|
|
568
568
|
<footer>
|
|
569
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
569
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
570
570
|
</footer>
|
|
571
571
|
|
|
572
572
|
<script> prettyPrint(); </script>
|
|
@@ -107,10 +107,12 @@ class Edge extends Element {
|
|
|
107
107
|
this.inV = inV;
|
|
108
108
|
this.properties = {};
|
|
109
109
|
if (properties) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (Array.isArray(properties)) {
|
|
111
|
+
// Handle array of Property objects
|
|
112
|
+
properties.forEach((prop) => (this.properties[prop.key] = prop.value));
|
|
113
|
+
} else {
|
|
114
|
+
// Handle object format as before
|
|
115
|
+
Object.keys(properties).forEach((k) => (this.properties[k] = properties[k].value));
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
}
|
|
@@ -232,7 +234,7 @@ module.exports = {
|
|
|
232
234
|
<br class="clear">
|
|
233
235
|
|
|
234
236
|
<footer>
|
|
235
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
237
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
236
238
|
</footer>
|
|
237
239
|
|
|
238
240
|
<script> prettyPrint(); </script>
|
|
@@ -141,7 +141,7 @@ module.exports = DataType;
|
|
|
141
141
|
<br class="clear">
|
|
142
142
|
|
|
143
143
|
<footer>
|
|
144
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
144
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
145
145
|
</footer>
|
|
146
146
|
|
|
147
147
|
<script> prettyPrint(); </script>
|
|
@@ -124,7 +124,7 @@ module.exports = class GraphBinaryReader {
|
|
|
124
124
|
<br class="clear">
|
|
125
125
|
|
|
126
126
|
<footer>
|
|
127
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
127
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
128
128
|
</footer>
|
|
129
129
|
|
|
130
130
|
<script> prettyPrint(); </script>
|
|
@@ -127,7 +127,7 @@ module.exports = class GraphBinaryWriter {
|
|
|
127
127
|
<br class="clear">
|
|
128
128
|
|
|
129
129
|
<footer>
|
|
130
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
130
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
131
131
|
</footer>
|
|
132
132
|
|
|
133
133
|
<script> prettyPrint(); </script>
|
|
@@ -343,7 +343,7 @@ module.exports = {
|
|
|
343
343
|
<br class="clear">
|
|
344
344
|
|
|
345
345
|
<footer>
|
|
346
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
346
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
347
347
|
</footer>
|
|
348
348
|
|
|
349
349
|
<script> prettyPrint(); </script>
|
|
@@ -546,7 +546,7 @@ module.exports = {
|
|
|
546
546
|
<br class="clear">
|
|
547
547
|
|
|
548
548
|
<footer>
|
|
549
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
549
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Nov 17 2025 10:18:37 GMT-0800 (Pacific Standard Time)
|
|
550
550
|
</footer>
|
|
551
551
|
|
|
552
552
|
<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.7.
|
|
56
|
+
const gremlinVersion = '3.7.5'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
|
|
57
57
|
|
|
58
58
|
exports.toLong = function toLong(value) {
|
|
59
59
|
return new Long(value);
|
|
@@ -172,7 +172,7 @@ module.exports.DeferredPromise = DeferredPromise;
|
|
|
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 10:18:37 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:20
|
|
47
47
|
volumes:
|
|
48
48
|
- .:/js_app
|
|
49
49
|
- ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
|
package/lib/driver/connection.js
CHANGED
|
@@ -95,6 +95,7 @@ class Connection extends EventEmitter {
|
|
|
95
95
|
this.traversalSource = options.traversalSource || 'g';
|
|
96
96
|
this._authenticator = options.authenticator;
|
|
97
97
|
this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
|
|
98
|
+
this._enableCompression = this.options.enableCompression || false;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -123,12 +124,27 @@ class Connection extends EventEmitter {
|
|
|
123
124
|
headers[utils.getUserAgentHeader()] = await utils.getUserAgent();
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
-
const
|
|
127
|
+
// All these options are available to the `ws` package's constructor, but not the global WebSocket class
|
|
128
|
+
const wsSpecificOptions = new Set([
|
|
129
|
+
'headers',
|
|
130
|
+
'ca',
|
|
131
|
+
'cert',
|
|
132
|
+
'pfx',
|
|
133
|
+
'rejectUnauthorized',
|
|
134
|
+
'agent',
|
|
135
|
+
'perMessageDeflate',
|
|
136
|
+
]);
|
|
137
|
+
// Check if any `ws` specific options are provided and are non-null / non-undefined
|
|
138
|
+
const hasWsSpecificOptions = Object.entries(this.options).some(
|
|
139
|
+
([key, value]) => wsSpecificOptions.has(key) && ![null, undefined].includes(value),
|
|
140
|
+
);
|
|
141
|
+
// Only use the global websocket if we don't have any unsupported options
|
|
142
|
+
const useGlobalWebSocket = !hasWsSpecificOptions && globalThis.WebSocket;
|
|
143
|
+
const WebSocket = useGlobalWebSocket || (await import('ws')).default;
|
|
128
144
|
|
|
129
145
|
this._ws = new WebSocket(
|
|
130
146
|
this.url,
|
|
131
|
-
|
|
147
|
+
!useGlobalWebSocket
|
|
132
148
|
? {
|
|
133
149
|
headers: headers,
|
|
134
150
|
ca: this.options.ca,
|
|
@@ -136,7 +152,7 @@ class Connection extends EventEmitter {
|
|
|
136
152
|
pfx: this.options.pfx,
|
|
137
153
|
rejectUnauthorized: this.options.rejectUnauthorized,
|
|
138
154
|
agent: this.options.agent,
|
|
139
|
-
perMessageDeflate: this.
|
|
155
|
+
perMessageDeflate: this._enableCompression,
|
|
140
156
|
}
|
|
141
157
|
: undefined,
|
|
142
158
|
);
|
|
@@ -147,9 +163,15 @@ class Connection extends EventEmitter {
|
|
|
147
163
|
|
|
148
164
|
this._ws.addEventListener('open', this.#handleOpen);
|
|
149
165
|
this._ws.addEventListener('error', this.#handleError);
|
|
166
|
+
// Only attach unexpected-response listener if WebSocket supports .on() method
|
|
167
|
+
// Browser WebSocket does not have this event and .on() method
|
|
168
|
+
if (this._ws && 'on' in this._ws) {
|
|
169
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
170
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
171
|
+
this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
|
|
172
|
+
}
|
|
150
173
|
this._ws.addEventListener('message', this.#handleMessage);
|
|
151
174
|
this._ws.addEventListener('close', this.#handleClose);
|
|
152
|
-
|
|
153
175
|
return await this._openPromise;
|
|
154
176
|
}
|
|
155
177
|
|
|
@@ -244,6 +266,32 @@ class Connection extends EventEmitter {
|
|
|
244
266
|
this.isOpen = true;
|
|
245
267
|
};
|
|
246
268
|
|
|
269
|
+
/**
|
|
270
|
+
* @param {ClientRequest} _req
|
|
271
|
+
* @param {IncomingMessage} res
|
|
272
|
+
*/
|
|
273
|
+
#handleUnexpectedResponse = async (_req, res) => {
|
|
274
|
+
const body = await new Promise((resolve, reject) => {
|
|
275
|
+
const chunks = [];
|
|
276
|
+
res.on('data', (data) => {
|
|
277
|
+
chunks.push(data instanceof Buffer ? data : Buffer.from(data));
|
|
278
|
+
});
|
|
279
|
+
res.on('end', () => {
|
|
280
|
+
resolve(chunks.length ? Buffer.concat(chunks) : null);
|
|
281
|
+
});
|
|
282
|
+
res.on('error', reject);
|
|
283
|
+
});
|
|
284
|
+
const statusCodeErrorMessage = `Unexpected server response code ${res.statusCode}`;
|
|
285
|
+
const errorMessage = body ? `${statusCodeErrorMessage} with body:\n${body.toString()}` : statusCodeErrorMessage;
|
|
286
|
+
const error = new Error(errorMessage);
|
|
287
|
+
this.#handleError({
|
|
288
|
+
error,
|
|
289
|
+
message: errorMessage,
|
|
290
|
+
type: 'unexpected-response',
|
|
291
|
+
target: this._ws,
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
|
|
247
295
|
/**
|
|
248
296
|
* @param {Event} event
|
|
249
297
|
*/
|
|
@@ -372,6 +420,13 @@ class Connection extends EventEmitter {
|
|
|
372
420
|
});
|
|
373
421
|
this._ws.removeEventListener('open', this.#handleOpen);
|
|
374
422
|
this._ws.removeEventListener('error', this.#handleError);
|
|
423
|
+
// Only remove unexpected-response listener for Node.js WebSocket (ws package)
|
|
424
|
+
// Browser WebSocket does not have this event and .off() method
|
|
425
|
+
if (this._ws && 'off' in this._ws) {
|
|
426
|
+
// The following listener needs to use `.on` and `.off` because the `ws` package's addEventListener only accepts certain event types
|
|
427
|
+
// Ref: https://github.com/websockets/ws/blob/8.16.0/lib/event-target.js#L202-L241
|
|
428
|
+
this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
|
|
429
|
+
}
|
|
375
430
|
this._ws.removeEventListener('message', this.#handleMessage);
|
|
376
431
|
this._ws.removeEventListener('close', this.#handleClose);
|
|
377
432
|
this._openPromise = null;
|
|
@@ -1773,13 +1773,17 @@ const statics = {
|
|
|
1773
1773
|
choose: (...args) => callOnEmptyTraversal('choose', args),
|
|
1774
1774
|
coalesce: (...args) => callOnEmptyTraversal('coalesce', args),
|
|
1775
1775
|
coin: (...args) => callOnEmptyTraversal('coin', args),
|
|
1776
|
+
combine: (...args) => callOnEmptyTraversal('combine', args),
|
|
1776
1777
|
concat: (...args) => callOnEmptyTraversal('concat', args),
|
|
1778
|
+
conjoin: (...args) => callOnEmptyTraversal('conjoin', args),
|
|
1777
1779
|
constant: (...args) => callOnEmptyTraversal('constant', args),
|
|
1778
1780
|
count: (...args) => callOnEmptyTraversal('count', args),
|
|
1779
1781
|
cyclicPath: (...args) => callOnEmptyTraversal('cyclicPath', args),
|
|
1780
1782
|
dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
|
|
1781
1783
|
dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
|
|
1782
1784
|
dedup: (...args) => callOnEmptyTraversal('dedup', args),
|
|
1785
|
+
difference: (...args) => callOnEmptyTraversal('difference', args),
|
|
1786
|
+
disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
|
|
1783
1787
|
drop: (...args) => callOnEmptyTraversal('drop', args),
|
|
1784
1788
|
element: (...args) => callOnEmptyTraversal('element', args),
|
|
1785
1789
|
elementMap: (...args) => callOnEmptyTraversal('elementMap', args),
|
|
@@ -1804,6 +1808,7 @@ const statics = {
|
|
|
1804
1808
|
inV: (...args) => callOnEmptyTraversal('inV', args),
|
|
1805
1809
|
index: (...args) => callOnEmptyTraversal('index', args),
|
|
1806
1810
|
inject: (...args) => callOnEmptyTraversal('inject', args),
|
|
1811
|
+
intersect: (...args) => callOnEmptyTraversal('intersect', args),
|
|
1807
1812
|
is: (...args) => callOnEmptyTraversal('is', args),
|
|
1808
1813
|
key: (...args) => callOnEmptyTraversal('key', args),
|
|
1809
1814
|
label: (...args) => callOnEmptyTraversal('label', args),
|
|
@@ -1817,9 +1822,11 @@ const statics = {
|
|
|
1817
1822
|
math: (...args) => callOnEmptyTraversal('math', args),
|
|
1818
1823
|
max: (...args) => callOnEmptyTraversal('max', args),
|
|
1819
1824
|
mean: (...args) => callOnEmptyTraversal('mean', args),
|
|
1825
|
+
merge: (...args) => callOnEmptyTraversal('merge', args),
|
|
1820
1826
|
mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
|
|
1821
1827
|
mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
|
|
1822
1828
|
min: (...args) => callOnEmptyTraversal('min', args),
|
|
1829
|
+
none: (...args) => callOnEmptyTraversal('none', args),
|
|
1823
1830
|
not: (...args) => callOnEmptyTraversal('not', args),
|
|
1824
1831
|
optional: (...args) => callOnEmptyTraversal('optional', args),
|
|
1825
1832
|
or: (...args) => callOnEmptyTraversal('or', args),
|
|
@@ -1829,6 +1836,7 @@ const statics = {
|
|
|
1829
1836
|
outE: (...args) => callOnEmptyTraversal('outE', args),
|
|
1830
1837
|
outV: (...args) => callOnEmptyTraversal('outV', args),
|
|
1831
1838
|
path: (...args) => callOnEmptyTraversal('path', args),
|
|
1839
|
+
product: (...args) => callOnEmptyTraversal('product', args),
|
|
1832
1840
|
project: (...args) => callOnEmptyTraversal('project', args),
|
|
1833
1841
|
properties: (...args) => callOnEmptyTraversal('properties', args),
|
|
1834
1842
|
property: (...args) => callOnEmptyTraversal('property', args),
|
|
@@ -91,7 +91,7 @@ class Translator {
|
|
|
91
91
|
}
|
|
92
92
|
script += `('${key}', `;
|
|
93
93
|
if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
|
|
94
|
-
script += `'${anyObject[key]}'`;
|
|
94
|
+
script += `'${`${anyObject[key]}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
|
|
95
95
|
} else {
|
|
96
96
|
script += anyObject[key];
|
|
97
97
|
}
|
|
@@ -111,7 +111,7 @@ class Translator {
|
|
|
111
111
|
} else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
|
|
112
112
|
script += anyObject;
|
|
113
113
|
} else {
|
|
114
|
-
script += `'${`${anyObject}`.
|
|
114
|
+
script += `'${`${anyObject}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
return script;
|
package/lib/structure/graph.js
CHANGED
|
@@ -79,10 +79,12 @@ class Edge extends Element {
|
|
|
79
79
|
this.inV = inV;
|
|
80
80
|
this.properties = {};
|
|
81
81
|
if (properties) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
if (Array.isArray(properties)) {
|
|
83
|
+
// Handle array of Property objects
|
|
84
|
+
properties.forEach((prop) => (this.properties[prop.key] = prop.value));
|
|
85
|
+
} else {
|
|
86
|
+
// Handle object format as before
|
|
87
|
+
Object.keys(properties).forEach((k) => (this.properties[k] = properties[k].value));
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
}
|