gremlin 3.6.6 → 3.6.8

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 (79) 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 +2 -2
  6. package/doc/Client.html +41 -8
  7. package/doc/Connection.html +40 -7
  8. package/doc/DataType.js.html +149 -0
  9. package/doc/DriverRemoteConnection.html +44 -11
  10. package/doc/EdgeLabelVerificationStrategy.html +1 -1
  11. package/doc/Graph.html +1 -1
  12. package/doc/GraphBinaryReader.js.html +132 -0
  13. package/doc/GraphBinaryWriter.js.html +135 -0
  14. package/doc/GraphSON2Reader.html +1 -1
  15. package/doc/GraphSON2Writer.html +1 -1
  16. package/doc/GraphSON3Reader.html +1 -1
  17. package/doc/GraphSON3Writer.html +1 -1
  18. package/doc/GraphTraversal.html +1 -1
  19. package/doc/GraphTraversalSource.html +1 -1
  20. package/doc/HaltedTraverserStrategy.html +1 -1
  21. package/doc/MatchAlgorithmStrategy.html +1 -1
  22. package/doc/P.html +1 -1
  23. package/doc/PartitionStrategy.html +1 -1
  24. package/doc/Path.html +1 -1
  25. package/doc/PlainTextSaslAuthenticator.html +1 -1
  26. package/doc/ProductiveByStrategy.html +1 -1
  27. package/doc/RemoteConnection.html +1 -1
  28. package/doc/RemoteStrategy.html +1 -1
  29. package/doc/RemoteTraversal.html +1 -1
  30. package/doc/ReservedKeysVerificationStrategy.html +1 -1
  31. package/doc/ResponseError.html +1 -1
  32. package/doc/ResultSet.html +1 -1
  33. package/doc/SaslAuthenticator.html +1 -1
  34. package/doc/SaslMechanismBase.html +1 -1
  35. package/doc/SaslMechanismPlain.html +1 -1
  36. package/doc/SeedStrategy.html +1 -1
  37. package/doc/SubgraphStrategy.html +1 -1
  38. package/doc/TextP.html +1 -1
  39. package/doc/Transaction.html +4 -4
  40. package/doc/Translator.html +1 -1
  41. package/doc/TraversalStrategies.html +1 -1
  42. package/doc/TraversalStrategy.html +1 -1
  43. package/doc/TypeSerializer.html +1 -1
  44. package/doc/driver_auth_authenticator.js.html +1 -1
  45. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +1 -1
  46. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +1 -1
  47. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +1 -1
  48. package/doc/driver_auth_sasl-authenticator.js.html +1 -1
  49. package/doc/driver_client.js.html +2 -1
  50. package/doc/driver_connection.js.html +4 -1
  51. package/doc/driver_driver-remote-connection.js.html +2 -1
  52. package/doc/driver_remote-connection.js.html +1 -1
  53. package/doc/driver_response-error.js.html +1 -1
  54. package/doc/driver_result-set.js.html +1 -1
  55. package/doc/global.html +2 -2
  56. package/doc/index.html +1 -1
  57. package/doc/module.exports.html +1 -1
  58. package/doc/process_anonymous-traversal.js.html +1 -1
  59. package/doc/process_bytecode.js.html +1 -1
  60. package/doc/process_graph-traversal.js.html +1 -1
  61. package/doc/process_transaction.js.html +11 -3
  62. package/doc/process_translator.js.html +4 -4
  63. package/doc/process_traversal-strategy.js.html +1 -1
  64. package/doc/process_traversal.js.html +1 -1
  65. package/doc/structure_graph.js.html +1 -1
  66. package/doc/structure_io_binary_internals_DataType.js.html +1 -1
  67. package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +1 -1
  68. package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +1 -1
  69. package/doc/structure_io_graph-serializer.js.html +1 -1
  70. package/doc/structure_io_type-serializers.js.html +1 -1
  71. package/doc/utils.js.html +181 -0
  72. package/docker-compose.yml +1 -3
  73. package/lib/driver/client.js +1 -0
  74. package/lib/driver/connection.js +3 -0
  75. package/lib/driver/driver-remote-connection.js +1 -0
  76. package/lib/process/transaction.js +10 -2
  77. package/lib/process/translator.js +3 -3
  78. package/lib/utils.js +1 -1
  79. package/package.json +4 -4
@@ -147,7 +147,7 @@ module.exports = SaslMechanismPlain;
147
147
  <br class="clear">
148
148
 
149
149
  <footer>
150
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
150
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
151
151
  </footer>
152
152
 
153
153
  <script> prettyPrint(); </script>
@@ -97,7 +97,7 @@ module.exports = PlainTextSaslAuthenticator;
97
97
  <br class="clear">
98
98
 
99
99
  <footer>
100
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
100
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
101
101
  </footer>
102
102
 
103
103
  <script> prettyPrint(); </script>
@@ -91,7 +91,7 @@ module.exports = SaslAuthenticator;
91
91
  <br class="clear">
92
92
 
93
93
  <footer>
94
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
94
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
95
95
  </footer>
96
96
 
97
97
  <script> prettyPrint(); </script>
@@ -74,6 +74,7 @@ class Client {
74
74
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
75
75
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
76
76
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
77
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
77
78
  * @constructor
78
79
  */
79
80
  constructor(url, options = {}) {
@@ -241,7 +242,7 @@ module.exports = Client;
241
242
  <br class="clear">
242
243
 
243
244
  <footer>
244
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
245
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
245
246
  </footer>
246
247
 
247
248
  <script> prettyPrint(); </script>
@@ -98,6 +98,7 @@ class Connection extends EventEmitter {
98
98
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
99
99
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
100
100
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
101
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
101
102
  * @param {Boolean} [options.connectOnStartup] Deprecated and non-functional. Open websocket on startup.
102
103
  * @constructor
103
104
  */
@@ -169,6 +170,7 @@ class Connection extends EventEmitter {
169
170
  cert: this.options.cert,
170
171
  pfx: this.options.pfx,
171
172
  rejectUnauthorized: this.options.rejectUnauthorized,
173
+ perMessageDeflate: this.options.enableCompression,
172
174
  });
173
175
 
174
176
  this._ws.on('message', (data) => this._handleMessage(data));
@@ -372,6 +374,7 @@ class Connection extends EventEmitter {
372
374
 
373
375
  return;
374
376
  } else if (response.status.code >= 400) {
377
+ this._clearHandler(response.requestId);
375
378
  // callback in error
376
379
  return handler.callback(
377
380
  // TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
@@ -489,7 +492,7 @@ module.exports = Connection;
489
492
  <br class="clear">
490
493
 
491
494
  <footer>
492
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
495
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
493
496
  </footer>
494
497
 
495
498
  <script> prettyPrint(); </script>
@@ -80,6 +80,7 @@ class DriverRemoteConnection extends RemoteConnection {
80
80
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
81
81
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
82
82
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
83
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
83
84
  * @constructor
84
85
  */
85
86
  constructor(url, options = {}) {
@@ -178,7 +179,7 @@ module.exports = DriverRemoteConnection;
178
179
  <br class="clear">
179
180
 
180
181
  <footer>
181
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
182
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
182
183
  </footer>
183
184
 
184
185
  <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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
192
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
92
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
93
93
  </footer>
94
94
 
95
95
  <script> prettyPrint(); </script>
@@ -134,7 +134,7 @@ module.exports = ResultSet;
134
134
  <br class="clear">
135
135
 
136
136
  <footer>
137
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
137
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
138
138
  </footer>
139
139
 
140
140
  <script> prettyPrint(); </script>
package/doc/global.html CHANGED
@@ -417,7 +417,7 @@ See org.apache.tinkerpop.gremlin.structure.io.binary.DataType Java class.
417
417
 
418
418
  <dt class="tag-source">Source:</dt>
419
419
  <dd class="tag-source"><ul class="dummy"><li>
420
- <a href="driver_client.js.html">driver/client.js</a>, <a href="driver_client.js.html#line80">line 80</a>
420
+ <a href="driver_client.js.html">driver/client.js</a>, <a href="driver_client.js.html#line81">line 81</a>
421
421
  </li></ul></dd>
422
422
 
423
423
 
@@ -453,7 +453,7 @@ See org.apache.tinkerpop.gremlin.structure.io.binary.DataType Java class.
453
453
  <br class="clear">
454
454
 
455
455
  <footer>
456
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
456
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
457
457
  </footer>
458
458
 
459
459
  <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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
179
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
295
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
122
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
169
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
170
170
  </footer>
171
171
 
172
172
  <script> prettyPrint(); </script>
@@ -1589,7 +1589,7 @@ module.exports = {
1589
1589
  <br class="clear">
1590
1590
 
1591
1591
  <footer>
1592
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
1592
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
1593
1593
  </footer>
1594
1594
 
1595
1595
  <script> prettyPrint(); </script>
@@ -87,14 +87,22 @@ class Transaction {
87
87
  * @returns {Promise}
88
88
  */
89
89
  commit() {
90
- return this._sessionBasedConnection.commit().then(() => this.close());
90
+ if (!this._sessionBasedConnection) {
91
+ throw new Error('Cannot commit a transaction that is not started');
92
+ }
93
+
94
+ return this._sessionBasedConnection.commit().finally(() => this.close());
91
95
  }
92
96
 
93
97
  /**
94
98
  * @returns {Promise}
95
99
  */
96
100
  rollback() {
97
- return this._sessionBasedConnection.rollback().then(() => this.close());
101
+ if (!this._sessionBasedConnection) {
102
+ throw new Error('Cannot rollback a transaction that is not started');
103
+ }
104
+
105
+ return this._sessionBasedConnection.rollback().finally(() => this.close());
98
106
  }
99
107
 
100
108
  /**
@@ -134,7 +142,7 @@ module.exports = {
134
142
  <br class="clear">
135
143
 
136
144
  <footer>
137
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
145
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
138
146
  </footer>
139
147
 
140
148
  <script> prettyPrint(); </script>
@@ -134,12 +134,12 @@ class Translator {
134
134
  } else {
135
135
  script += anyObject.toString();
136
136
  }
137
- } else if (anyObject === undefined) {
138
- script += '';
137
+ } else if (anyObject === undefined || anyObject === null) {
138
+ script += 'null';
139
139
  } else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
140
140
  script += anyObject;
141
141
  } else {
142
- script += `'${anyObject}'`;
142
+ script += `'${`${anyObject}`.replace("'", "\\'")}'`; // 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
166
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
398
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
399
399
  </footer>
400
400
 
401
401
  <script> prettyPrint(); </script>
@@ -565,7 +565,7 @@ module.exports = {
565
565
  <br class="clear">
566
566
 
567
567
  <footer>
568
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
568
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
569
569
  </footer>
570
570
 
571
571
  <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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
235
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
236
236
  </footer>
237
237
 
238
238
  <script> prettyPrint(); </script>
@@ -140,7 +140,7 @@ module.exports = DataType;
140
140
  <br class="clear">
141
141
 
142
142
  <footer>
143
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
143
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
144
144
  </footer>
145
145
 
146
146
  <script> prettyPrint(); </script>
@@ -122,7 +122,7 @@ module.exports = class GraphBinaryReader {
122
122
  <br class="clear">
123
123
 
124
124
  <footer>
125
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
125
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
126
126
  </footer>
127
127
 
128
128
  <script> prettyPrint(); </script>
@@ -125,7 +125,7 @@ module.exports = class GraphBinaryWriter {
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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
128
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
129
129
  </footer>
130
130
 
131
131
  <script> prettyPrint(); </script>
@@ -342,7 +342,7 @@ module.exports = {
342
342
  <br class="clear">
343
343
 
344
344
  <footer>
345
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
345
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
346
346
  </footer>
347
347
 
348
348
  <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 Mon Dec 04 2023 11:42:07 GMT-0800 (Pacific Standard Time)
549
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Oct 29 2024 10:04:25 GMT-0700 (Pacific Daylight Time)
550
550
  </footer>
551
551
 
552
552
  <script> prettyPrint(); </script>
@@ -0,0 +1,181 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: utils.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: utils.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+
27
+ <section>
28
+ <article>
29
+ <pre class="prettyprint source linenums"><code>/*
30
+ * Licensed to the Apache Software Foundation (ASF) under one
31
+ * or more contributor license agreements. See the NOTICE file
32
+ * distributed with this work for additional information
33
+ * regarding copyright ownership. The ASF licenses this file
34
+ * to you under the Apache License, Version 2.0 (the
35
+ * "License"); you may not use this file except in compliance
36
+ * with the License. You may obtain a copy of the License at
37
+ *
38
+ * http://www.apache.org/licenses/LICENSE-2.0
39
+ *
40
+ * Unless required by applicable law or agreed to in writing,
41
+ * software distributed under the License is distributed on an
42
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
43
+ * KIND, either express or implied. See the License for the
44
+ * specific language governing permissions and limitations
45
+ * under the License.
46
+ */
47
+
48
+ /**
49
+ * A module containing any utility functions.
50
+ * @author Jorge Bay Gondra
51
+ */
52
+ 'use strict';
53
+
54
+ const uuid = require('uuid');
55
+
56
+ const gremlinVersion = '3.7.3'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
57
+
58
+ exports.toLong = function toLong(value) {
59
+ return new Long(value);
60
+ };
61
+
62
+ const Long = (exports.Long = function Long(value) {
63
+ if (typeof value !== 'string' &amp;&amp; typeof value !== 'number') {
64
+ throw new TypeError('The value must be a string or a number');
65
+ }
66
+ this.value = value.toString();
67
+ });
68
+
69
+ exports.getUuid = function getUuid() {
70
+ // TODO: replace with `globalThis.crypto.randomUUID` once supported Node version is bump to >=19
71
+ return uuid.v4();
72
+ };
73
+
74
+ exports.emptyArray = Object.freeze([]);
75
+
76
+ class ImmutableMap extends Map {
77
+ constructor(iterable) {
78
+ super(iterable);
79
+ }
80
+
81
+ set() {
82
+ return this;
83
+ }
84
+
85
+ ['delete']() {
86
+ return false;
87
+ }
88
+
89
+ clear() {}
90
+ }
91
+
92
+ exports.ImmutableMap = ImmutableMap;
93
+
94
+ async function generateNodeUserAgent() {
95
+ const os = await import('node:os');
96
+
97
+ const applicationName = (process?.env.npm_package_name ?? 'NotAvailable').replace('_', ' ');
98
+ let runtimeVersion;
99
+ let osName;
100
+ let osVersion;
101
+ let cpuArch;
102
+ runtimeVersion = osName = osVersion = cpuArch = 'NotAvailable';
103
+ if (process != null) {
104
+ if (process.version) {
105
+ runtimeVersion = process.version.replace(' ', '_');
106
+ }
107
+ if (process.arch) {
108
+ cpuArch = process.arch.replace(' ', '_');
109
+ }
110
+ }
111
+
112
+ if (os != null) {
113
+ osName = os.platform().replace(' ', '_');
114
+ osVersion = os.release().replace(' ', '_');
115
+ }
116
+
117
+ const userAgent = `${applicationName} Gremlin-Javascript.${gremlinVersion} ${runtimeVersion} ${osName}.${osVersion} ${cpuArch}`;
118
+
119
+ return userAgent;
120
+ }
121
+
122
+ exports.getUserAgentHeader = function getUserAgentHeader() {
123
+ return 'User-Agent';
124
+ };
125
+
126
+ exports.getUserAgent = async () => {
127
+ if ('navigator' in globalThis) {
128
+ return globalThis.navigator.userAgent;
129
+ }
130
+
131
+ if (process?.versions?.node !== undefined) {
132
+ return await generateNodeUserAgent();
133
+ }
134
+
135
+ return undefined;
136
+ };
137
+
138
+ /**
139
+ * @param {Buffer} buffer
140
+ * @returns {ArrayBuffer}
141
+ */
142
+ const toArrayBuffer = (buffer) => buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
143
+
144
+ exports.toArrayBuffer = toArrayBuffer;
145
+
146
+ const DeferredPromise = () => {
147
+ let resolve = (value) => {};
148
+ let reject = (reason) => {};
149
+
150
+ const promise = new Promise((_resolve, _reject) => {
151
+ resolve = _resolve;
152
+ reject = _reject;
153
+ });
154
+
155
+ return Object.assign(promise, { resolve, reject });
156
+ };
157
+
158
+ module.exports.DeferredPromise = DeferredPromise;
159
+ </code></pre>
160
+ </article>
161
+ </section>
162
+
163
+
164
+
165
+
166
+ </div>
167
+
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>
170
+ </nav>
171
+
172
+ <br class="clear">
173
+
174
+ <footer>
175
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Thu Oct 24 2024 13:00:02 GMT-0700 (Pacific Daylight Time)
176
+ </footer>
177
+
178
+ <script> prettyPrint(); </script>
179
+ <script src="scripts/linenumber.js"> </script>
180
+ </body>
181
+ </html>
@@ -15,8 +15,6 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- version: "3.8"
19
-
20
18
  services:
21
19
 
22
20
  gremlin-server-test-js:
@@ -45,7 +43,7 @@ services:
45
43
 
46
44
  gremlin-js-integration-tests:
47
45
  container_name: gremlin-js-integration-tests
48
- image: node:16
46
+ image: node:18
49
47
  volumes:
50
48
  - .:/js_app
51
49
  - ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
@@ -46,6 +46,7 @@ class Client {
46
46
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
47
47
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
48
48
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
49
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
49
50
  * @constructor
50
51
  */
51
52
  constructor(url, options = {}) {
@@ -70,6 +70,7 @@ class Connection extends EventEmitter {
70
70
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
71
71
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
72
72
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
73
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
73
74
  * @param {Boolean} [options.connectOnStartup] Deprecated and non-functional. Open websocket on startup.
74
75
  * @constructor
75
76
  */
@@ -141,6 +142,7 @@ class Connection extends EventEmitter {
141
142
  cert: this.options.cert,
142
143
  pfx: this.options.pfx,
143
144
  rejectUnauthorized: this.options.rejectUnauthorized,
145
+ perMessageDeflate: this.options.enableCompression,
144
146
  });
145
147
 
146
148
  this._ws.on('message', (data) => this._handleMessage(data));
@@ -344,6 +346,7 @@ class Connection extends EventEmitter {
344
346
 
345
347
  return;
346
348
  } else if (response.status.code >= 400) {
349
+ this._clearHandler(response.requestId);
347
350
  // callback in error
348
351
  return handler.callback(
349
352
  // TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
@@ -52,6 +52,7 @@ class DriverRemoteConnection extends RemoteConnection {
52
52
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
53
53
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
54
54
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
55
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
55
56
  * @constructor
56
57
  */
57
58
  constructor(url, options = {}) {
@@ -59,14 +59,22 @@ class Transaction {
59
59
  * @returns {Promise}
60
60
  */
61
61
  commit() {
62
- return this._sessionBasedConnection.commit().then(() => this.close());
62
+ if (!this._sessionBasedConnection) {
63
+ throw new Error('Cannot commit a transaction that is not started');
64
+ }
65
+
66
+ return this._sessionBasedConnection.commit().finally(() => this.close());
63
67
  }
64
68
 
65
69
  /**
66
70
  * @returns {Promise}
67
71
  */
68
72
  rollback() {
69
- return this._sessionBasedConnection.rollback().then(() => this.close());
73
+ if (!this._sessionBasedConnection) {
74
+ throw new Error('Cannot rollback a transaction that is not started');
75
+ }
76
+
77
+ return this._sessionBasedConnection.rollback().finally(() => this.close());
70
78
  }
71
79
 
72
80
  /**