gremlin 3.6.6 → 3.6.7

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 (75) 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 +1 -1
  7. package/doc/Connection.html +1 -1
  8. package/doc/DataType.js.html +149 -0
  9. package/doc/DriverRemoteConnection.html +1 -1
  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 +1 -1
  50. package/doc/driver_connection.js.html +1 -1
  51. package/doc/driver_driver-remote-connection.js.html +1 -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 +1 -1
  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 +1 -1
  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 -1
  73. package/lib/process/transaction.js +10 -2
  74. package/lib/utils.js +1 -1
  75. package/package.json +3 -3
@@ -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.2'; // 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 Tue Apr 09 2024 22:21:12 GMT-0700 (Pacific Daylight Time)
176
+ </footer>
177
+
178
+ <script> prettyPrint(); </script>
179
+ <script src="scripts/linenumber.js"> </script>
180
+ </body>
181
+ </html>
@@ -45,7 +45,7 @@ services:
45
45
 
46
46
  gremlin-js-integration-tests:
47
47
  container_name: gremlin-js-integration-tests
48
- image: node:16
48
+ image: node:18
49
49
  volumes:
50
50
  - .:/js_app
51
51
  - ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
@@ -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
  /**
package/lib/utils.js CHANGED
@@ -26,7 +26,7 @@
26
26
  const crypto = require('crypto');
27
27
  const os = require('os');
28
28
 
29
- const gremlinVersion = '3.6.6'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
29
+ const gremlinVersion = '3.6.7'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
30
30
 
31
31
  exports.toLong = function toLong(value) {
32
32
  return new Long(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gremlin",
3
- "version": "3.6.6",
3
+ "version": "3.6.7",
4
4
  "description": "JavaScript Gremlin Language Variant",
5
5
  "author": "Apache TinkerPop team",
6
6
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  "ws": "^8.11.0"
18
18
  },
19
19
  "devDependencies": {
20
- "chai": "~4.3.6",
20
+ "chai": "~4.4.1",
21
21
  "chai-string": "~1.5.0",
22
22
  "colors": "1.4.0",
23
23
  "cross-env": "^7.0.3",
@@ -55,6 +55,6 @@
55
55
  "lint": "eslint --ext .js ."
56
56
  },
57
57
  "engines": {
58
- "node": ">=16"
58
+ "node": ">=18"
59
59
  }
60
60
  }