gremlin 3.7.3 → 3.7.4

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.
Files changed (77) hide show
  1. package/NOTICE +1 -1
  2. package/doc/AnonymousTraversalSource.html +1 -1
  3. package/doc/Authenticator.html +1 -1
  4. package/doc/Bytecode.html +1 -1
  5. package/doc/CardinalityValue.html +1 -1
  6. package/doc/Client.html +1 -1
  7. package/doc/Connection.html +5 -5
  8. package/doc/DriverRemoteConnection.html +1 -1
  9. package/doc/EdgeLabelVerificationStrategy.html +1 -1
  10. package/doc/Graph.html +1 -1
  11. package/doc/GraphSON2Reader.html +1 -1
  12. package/doc/GraphSON2Writer.html +1 -1
  13. package/doc/GraphSON3Reader.html +1 -1
  14. package/doc/GraphSON3Writer.html +1 -1
  15. package/doc/GraphTraversal.html +1 -1
  16. package/doc/GraphTraversalSource.html +1 -1
  17. package/doc/HaltedTraverserStrategy.html +1 -1
  18. package/doc/MatchAlgorithmStrategy.html +1 -1
  19. package/doc/P.html +1 -1
  20. package/doc/PartitionStrategy.html +1 -1
  21. package/doc/Path.html +1 -1
  22. package/doc/PlainTextSaslAuthenticator.html +1 -1
  23. package/doc/ProductiveByStrategy.html +1 -1
  24. package/doc/RemoteConnection.html +1 -1
  25. package/doc/RemoteStrategy.html +1 -1
  26. package/doc/RemoteTraversal.html +1 -1
  27. package/doc/ReservedKeysVerificationStrategy.html +1 -1
  28. package/doc/ResponseError.html +1 -1
  29. package/doc/ResultSet.html +1 -1
  30. package/doc/SaslAuthenticator.html +1 -1
  31. package/doc/SaslMechanismBase.html +1 -1
  32. package/doc/SaslMechanismPlain.html +1 -1
  33. package/doc/SeedStrategy.html +1 -1
  34. package/doc/SubgraphStrategy.html +1 -1
  35. package/doc/TextP.html +1 -1
  36. package/doc/Transaction.html +1 -1
  37. package/doc/Translator.html +1 -1
  38. package/doc/TraversalStrategies.html +1 -1
  39. package/doc/TraversalStrategy.html +1 -1
  40. package/doc/TypeSerializer.html +1 -1
  41. package/doc/driver_auth_authenticator.js.html +1 -1
  42. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +1 -1
  43. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +1 -1
  44. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +1 -1
  45. package/doc/driver_auth_sasl-authenticator.js.html +1 -1
  46. package/doc/driver_client.js.html +1 -1
  47. package/doc/driver_connection.js.html +49 -5
  48. package/doc/driver_driver-remote-connection.js.html +1 -1
  49. package/doc/driver_remote-connection.js.html +1 -1
  50. package/doc/driver_response-error.js.html +1 -1
  51. package/doc/driver_result-set.js.html +1 -1
  52. package/doc/global.html +1 -1
  53. package/doc/index.html +1 -1
  54. package/doc/module.exports.html +1 -1
  55. package/doc/process_anonymous-traversal.js.html +1 -1
  56. package/doc/process_bytecode.js.html +1 -1
  57. package/doc/process_graph-traversal.js.html +3 -1
  58. package/doc/process_transaction.js.html +1 -1
  59. package/doc/process_translator.js.html +3 -3
  60. package/doc/process_traversal-strategy.js.html +1 -1
  61. package/doc/process_traversal.js.html +1 -1
  62. package/doc/structure_graph.js.html +1 -1
  63. package/doc/structure_io_binary_internals_DataType.js.html +1 -1
  64. package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +1 -1
  65. package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +1 -1
  66. package/doc/structure_io_graph-serializer.js.html +1 -1
  67. package/doc/structure_io_type-serializers.js.html +1 -1
  68. package/doc/utils.js.html +2 -2
  69. package/docker-compose.yml +1 -1
  70. package/lib/driver/connection.js +48 -4
  71. package/lib/process/graph-traversal.js +2 -0
  72. package/lib/process/translator.js +2 -2
  73. package/lib/utils.js +1 -1
  74. package/package.json +3 -3
  75. package/doc/DataType.js.html +0 -149
  76. package/doc/GraphBinaryReader.js.html +0 -132
  77. package/doc/GraphBinaryWriter.js.html +0 -135
@@ -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 WebSocket = globalThis.WebSocket ?? (await import('ws')).default;
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
- globalThis.WebSocket === undefined
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.options.enableCompression,
183
+ perMessageDeflate: this._enableCompression,
168
184
  }
169
185
  : undefined,
170
186
  );
@@ -175,6 +191,7 @@ class Connection extends EventEmitter {
175
191
 
176
192
  this._ws.addEventListener('open', this.#handleOpen);
177
193
  this._ws.addEventListener('error', this.#handleError);
194
+ this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
178
195
  this._ws.addEventListener('message', this.#handleMessage);
179
196
  this._ws.addEventListener('close', this.#handleClose);
180
197
 
@@ -272,6 +289,32 @@ class Connection extends EventEmitter {
272
289
  this.isOpen = true;
273
290
  };
274
291
 
292
+ /**
293
+ * @param {ClientRequest} _req
294
+ * @param {IncomingMessage} res
295
+ */
296
+ #handleUnexpectedResponse = async (_req, res) => {
297
+ const body = await new Promise((resolve, reject) => {
298
+ const chunks = [];
299
+ res.on('data', (data) => {
300
+ chunks.push(data instanceof Buffer ? data : Buffer.from(data));
301
+ });
302
+ res.on('end', () => {
303
+ resolve(chunks.length ? Buffer.concat(chunks) : null);
304
+ });
305
+ res.on('error', reject);
306
+ });
307
+ const statusCodeErrorMessage = `Unexpected server response code ${res.statusCode}`;
308
+ const errorMessage = body ? `${statusCodeErrorMessage} with body:\n${body.toString()}` : statusCodeErrorMessage;
309
+ const error = new Error(errorMessage);
310
+ this.#handleError({
311
+ error,
312
+ message: errorMessage,
313
+ type: 'unexpected-response',
314
+ target: this._ws,
315
+ });
316
+ };
317
+
275
318
  /**
276
319
  * @param {Event} event
277
320
  */
@@ -400,6 +443,7 @@ class Connection extends EventEmitter {
400
443
  });
401
444
  this._ws.removeEventListener('open', this.#handleOpen);
402
445
  this._ws.removeEventListener('error', this.#handleError);
446
+ this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
403
447
  this._ws.removeEventListener('message', this.#handleMessage);
404
448
  this._ws.removeEventListener('close', this.#handleClose);
405
449
  this._openPromise = null;
@@ -451,7 +495,7 @@ module.exports = Connection;
451
495
  <br class="clear">
452
496
 
453
497
  <footer>
454
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
498
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
455
499
  </footer>
456
500
 
457
501
  <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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
187
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
192
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
92
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
128
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
634
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:43 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
179
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:43 GMT-0700 (Pacific Daylight Time)
180
180
  </footer>
181
181
 
182
182
  <script> prettyPrint(); </script>
@@ -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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
295
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:43 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
122
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
169
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
170
170
  </footer>
171
171
 
172
172
  <script> prettyPrint(); </script>
@@ -1808,6 +1808,7 @@ const statics = {
1808
1808
  dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
1809
1809
  dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
1810
1810
  dedup: (...args) => callOnEmptyTraversal('dedup', args),
1811
+ disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
1811
1812
  drop: (...args) => callOnEmptyTraversal('drop', args),
1812
1813
  element: (...args) => callOnEmptyTraversal('element', args),
1813
1814
  elementMap: (...args) => callOnEmptyTraversal('elementMap', args),
@@ -1848,6 +1849,7 @@ const statics = {
1848
1849
  mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
1849
1850
  mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
1850
1851
  min: (...args) => callOnEmptyTraversal('min', args),
1852
+ none: (...args) => callOnEmptyTraversal('none', args),
1851
1853
  not: (...args) => callOnEmptyTraversal('not', args),
1852
1854
  optional: (...args) => callOnEmptyTraversal('optional', args),
1853
1855
  or: (...args) => callOnEmptyTraversal('or', args),
@@ -1918,7 +1920,7 @@ module.exports = {
1918
1920
  <br class="clear">
1919
1921
 
1920
1922
  <footer>
1921
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
1923
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
1922
1924
  </footer>
1923
1925
 
1924
1926
  <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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
145
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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}`.replace("'", "\\'")}'`; // eslint-disable-line quotes
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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
166
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
398
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
569
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
570
570
  </footer>
571
571
 
572
572
  <script> prettyPrint(); </script>
@@ -232,7 +232,7 @@ module.exports = {
232
232
  <br class="clear">
233
233
 
234
234
  <footer>
235
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
235
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
236
236
  </footer>
237
237
 
238
238
  <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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
144
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
127
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
130
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
346
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
549
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight 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.3'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
56
+ const gremlinVersion = '3.7.4'; // 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 Tue Oct 29 2024 10:43:41 GMT-0700 (Pacific Daylight Time)
175
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Aug 08 2025 09:56:42 GMT-0700 (Pacific Daylight Time)
176
176
  </footer>
177
177
 
178
178
  <script> prettyPrint(); </script>
@@ -43,7 +43,7 @@ services:
43
43
 
44
44
  gremlin-js-integration-tests:
45
45
  container_name: gremlin-js-integration-tests
46
- image: node:18
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
@@ -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 WebSocket = globalThis.WebSocket ?? (await import('ws')).default;
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
- globalThis.WebSocket === undefined
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.options.enableCompression,
155
+ perMessageDeflate: this._enableCompression,
140
156
  }
141
157
  : undefined,
142
158
  );
@@ -147,6 +163,7 @@ class Connection extends EventEmitter {
147
163
 
148
164
  this._ws.addEventListener('open', this.#handleOpen);
149
165
  this._ws.addEventListener('error', this.#handleError);
166
+ this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
150
167
  this._ws.addEventListener('message', this.#handleMessage);
151
168
  this._ws.addEventListener('close', this.#handleClose);
152
169
 
@@ -244,6 +261,32 @@ class Connection extends EventEmitter {
244
261
  this.isOpen = true;
245
262
  };
246
263
 
264
+ /**
265
+ * @param {ClientRequest} _req
266
+ * @param {IncomingMessage} res
267
+ */
268
+ #handleUnexpectedResponse = async (_req, res) => {
269
+ const body = await new Promise((resolve, reject) => {
270
+ const chunks = [];
271
+ res.on('data', (data) => {
272
+ chunks.push(data instanceof Buffer ? data : Buffer.from(data));
273
+ });
274
+ res.on('end', () => {
275
+ resolve(chunks.length ? Buffer.concat(chunks) : null);
276
+ });
277
+ res.on('error', reject);
278
+ });
279
+ const statusCodeErrorMessage = `Unexpected server response code ${res.statusCode}`;
280
+ const errorMessage = body ? `${statusCodeErrorMessage} with body:\n${body.toString()}` : statusCodeErrorMessage;
281
+ const error = new Error(errorMessage);
282
+ this.#handleError({
283
+ error,
284
+ message: errorMessage,
285
+ type: 'unexpected-response',
286
+ target: this._ws,
287
+ });
288
+ };
289
+
247
290
  /**
248
291
  * @param {Event} event
249
292
  */
@@ -372,6 +415,7 @@ class Connection extends EventEmitter {
372
415
  });
373
416
  this._ws.removeEventListener('open', this.#handleOpen);
374
417
  this._ws.removeEventListener('error', this.#handleError);
418
+ this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
375
419
  this._ws.removeEventListener('message', this.#handleMessage);
376
420
  this._ws.removeEventListener('close', this.#handleClose);
377
421
  this._openPromise = null;
@@ -1780,6 +1780,7 @@ const statics = {
1780
1780
  dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
1781
1781
  dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
1782
1782
  dedup: (...args) => callOnEmptyTraversal('dedup', args),
1783
+ disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
1783
1784
  drop: (...args) => callOnEmptyTraversal('drop', args),
1784
1785
  element: (...args) => callOnEmptyTraversal('element', args),
1785
1786
  elementMap: (...args) => callOnEmptyTraversal('elementMap', args),
@@ -1820,6 +1821,7 @@ const statics = {
1820
1821
  mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
1821
1822
  mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
1822
1823
  min: (...args) => callOnEmptyTraversal('min', args),
1824
+ none: (...args) => callOnEmptyTraversal('none', args),
1823
1825
  not: (...args) => callOnEmptyTraversal('not', args),
1824
1826
  optional: (...args) => callOnEmptyTraversal('optional', args),
1825
1827
  or: (...args) => callOnEmptyTraversal('or', 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}`.replace("'", "\\'")}'`; // eslint-disable-line quotes
114
+ script += `'${`${anyObject}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
115
115
  }
116
116
 
117
117
  return script;
package/lib/utils.js CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  const uuid = require('uuid');
27
27
 
28
- const gremlinVersion = '3.7.3'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
28
+ const gremlinVersion = '3.7.4'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
29
29
 
30
30
  exports.toLong = function toLong(value) {
31
31
  return new Long(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gremlin",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "description": "JavaScript Gremlin Language Variant",
5
5
  "author": "Apache TinkerPop team",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "cross-env": "^7.0.3",
28
28
  "cucumber": "~6.0.7",
29
29
  "eslint": "^8.42.0",
30
- "eslint-config-prettier": "^9.0.0",
30
+ "eslint-config-prettier": "^10.0.1",
31
31
  "eslint-plugin-prettier": "^5.0.0",
32
32
  "grunt": "^1.5.3",
33
33
  "grunt-cli": "~1.5.0",
@@ -59,6 +59,6 @@
59
59
  "lint": "eslint --ext .js ."
60
60
  },
61
61
  "engines": {
62
- "node": ">=18"
62
+ "node": ">=20"
63
63
  }
64
64
  }