gremlin 3.6.1 → 3.6.3
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/.eslintrc.js +1 -1
- package/NOTICE +1 -1
- package/doc/AnonymousTraversalSource.html +1 -1
- package/doc/Authenticator.html +1 -1
- package/doc/Bytecode.html +1 -1
- package/doc/Client.html +173 -8
- package/doc/Connection.html +40 -7
- package/doc/DriverRemoteConnection.html +143 -11
- package/doc/EdgeLabelVerificationStrategy.html +1 -1
- package/doc/Graph.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 +1 -1
- 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 +6 -1
- package/doc/driver_connection.js.html +18 -5
- package/doc/driver_driver-remote-connection.js.html +5 -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 +2 -2
- 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 +1 -1
- package/doc/process_transaction.js.html +1 -1
- package/doc/process_translator.js.html +1 -1
- package/doc/process_traversal-strategy.js.html +1 -1
- package/doc/process_traversal.js.html +17 -3
- package/doc/structure_graph.js.html +1 -1
- 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/docker-compose.yml +62 -0
- package/index.js +1 -0
- package/lib/driver/client.js +5 -0
- package/lib/driver/connection.js +17 -4
- package/lib/driver/driver-remote-connection.js +4 -0
- package/lib/process/traversal.js +16 -2
- package/lib/utils.js +43 -0
- package/package.json +16 -13
|
@@ -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 Fri May 05 2023 13:20:20 GMT-0700 (Pacific Daylight Time)
|
|
399
399
|
</footer>
|
|
400
400
|
|
|
401
401
|
<script> prettyPrint(); </script>
|
|
@@ -501,6 +501,20 @@ function toEnum(typeName, keys) {
|
|
|
501
501
|
return result;
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
+
const directionAlias = {
|
|
505
|
+
from_: 'out',
|
|
506
|
+
to: 'in',
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
// for direction enums, maps the same EnumValue object to the enum aliases after creating them
|
|
510
|
+
function toDirectionEnum(typeName, keys) {
|
|
511
|
+
const result = toEnum(typeName, keys);
|
|
512
|
+
Object.keys(directionAlias).forEach((k) => {
|
|
513
|
+
result[k] = result[directionAlias[k]];
|
|
514
|
+
});
|
|
515
|
+
return result;
|
|
516
|
+
}
|
|
517
|
+
|
|
504
518
|
class EnumValue {
|
|
505
519
|
constructor(typeName, elementName) {
|
|
506
520
|
this.typeName = typeName;
|
|
@@ -524,10 +538,10 @@ module.exports = {
|
|
|
524
538
|
barrier: toEnum('Barrier', 'normSack'),
|
|
525
539
|
cardinality: toEnum('Cardinality', 'list set single'),
|
|
526
540
|
column: toEnum('Column', 'keys values'),
|
|
527
|
-
direction:
|
|
541
|
+
direction: toDirectionEnum('Direction', 'BOTH IN OUT from_ to'),
|
|
528
542
|
graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0'),
|
|
529
543
|
gryoVersion: toEnum('GryoVersion', 'V1_0 V3_0'),
|
|
530
|
-
merge: toEnum('Merge', 'onCreate onMatch'),
|
|
544
|
+
merge: toEnum('Merge', 'onCreate onMatch outV inV'),
|
|
531
545
|
operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
|
|
532
546
|
order: toEnum('Order', 'asc desc shuffle'),
|
|
533
547
|
pick: toEnum('Pick', 'any none'),
|
|
@@ -551,7 +565,7 @@ module.exports = {
|
|
|
551
565
|
<br class="clear">
|
|
552
566
|
|
|
553
567
|
<footer>
|
|
554
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
568
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 GMT-0700 (Pacific Daylight Time)
|
|
555
569
|
</footer>
|
|
556
570
|
|
|
557
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
|
|
235
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 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
|
|
143
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 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
|
|
125
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 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
|
|
128
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 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
|
|
345
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 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
|
|
549
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri May 05 2023 13:20:20 GMT-0700 (Pacific Daylight Time)
|
|
550
550
|
</footer>
|
|
551
551
|
|
|
552
552
|
<script> prettyPrint(); </script>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
version: "3.8"
|
|
19
|
+
|
|
20
|
+
services:
|
|
21
|
+
|
|
22
|
+
gremlin-server-test-js:
|
|
23
|
+
container_name: gremlin-server-test-js
|
|
24
|
+
image: tinkerpop/gremlin-server-test:${GREMLIN_SERVER}
|
|
25
|
+
build:
|
|
26
|
+
context: ../../../../../
|
|
27
|
+
dockerfile: docker/gremlin-test-server/Dockerfile
|
|
28
|
+
args:
|
|
29
|
+
- GREMLIN_SERVER=${GREMLIN_SERVER}
|
|
30
|
+
ports:
|
|
31
|
+
- "45940:45940"
|
|
32
|
+
- "45941:45941"
|
|
33
|
+
- "45942:45942"
|
|
34
|
+
- "4588:4588"
|
|
35
|
+
volumes:
|
|
36
|
+
- ${HOME}/.groovy:/root/.groovy
|
|
37
|
+
- ${HOME}/.m2:/root/.m2
|
|
38
|
+
- ${ABS_PROJECT_HOME}/gremlin-test/target:/opt/gremlin-test
|
|
39
|
+
healthcheck:
|
|
40
|
+
test: [ "CMD-SHELL", "apk add curl && curl -f http://localhost:45940?gremlin=100-1" ]
|
|
41
|
+
interval: 30s
|
|
42
|
+
timeout: 10s
|
|
43
|
+
retries: 30
|
|
44
|
+
start_period: 30s
|
|
45
|
+
|
|
46
|
+
gremlin-js-integration-tests:
|
|
47
|
+
container_name: gremlin-js-integration-tests
|
|
48
|
+
image: node:16
|
|
49
|
+
volumes:
|
|
50
|
+
- .:/js_app
|
|
51
|
+
- ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/gremlin-test
|
|
52
|
+
- ../../../../../docker/gremlin-test-server:/js_app/gremlin-test-server
|
|
53
|
+
environment:
|
|
54
|
+
- DOCKER_ENVIRONMENT=true
|
|
55
|
+
- TEST_TRANSACTIONS=true
|
|
56
|
+
working_dir: /js_app
|
|
57
|
+
command: >
|
|
58
|
+
bash -c "npm config set cache /tmp --global
|
|
59
|
+
&& npm ci && npm run test && npm run features-docker"
|
|
60
|
+
depends_on:
|
|
61
|
+
gremlin-server-test-js:
|
|
62
|
+
condition: service_healthy
|
package/index.js
CHANGED
package/lib/driver/client.js
CHANGED
|
@@ -39,8 +39,13 @@ class Client {
|
|
|
39
39
|
* @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'.
|
|
40
40
|
* @param {GraphSONWriter} [options.writer] The writer to use.
|
|
41
41
|
* @param {Authenticator} [options.authenticator] The authentication handler to use.
|
|
42
|
+
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
|
|
43
|
+
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
|
|
42
44
|
* @param {String} [options.processor] The name of the opProcessor to use, leave it undefined or set 'session' when session mode.
|
|
43
45
|
* @param {String} [options.session] The sessionId of Client in session mode. Defaults to null means session-less Client.
|
|
46
|
+
* @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
|
|
47
|
+
* @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
|
|
48
|
+
* @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
|
|
44
49
|
* @constructor
|
|
45
50
|
*/
|
|
46
51
|
constructor(url, options = {}) {
|
package/lib/driver/connection.js
CHANGED
|
@@ -64,6 +64,7 @@ class Connection extends EventEmitter {
|
|
|
64
64
|
* @param {GraphSONWriter} [options.writer] The writer to use.
|
|
65
65
|
* @param {Authenticator} [options.authenticator] The authentication handler to use.
|
|
66
66
|
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
|
|
67
|
+
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
|
|
67
68
|
* @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
|
|
68
69
|
* @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
|
|
69
70
|
* @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
|
|
@@ -82,7 +83,7 @@ class Connection extends EventEmitter {
|
|
|
82
83
|
*/
|
|
83
84
|
this.mimeType = options.mimeType || defaultMimeType;
|
|
84
85
|
|
|
85
|
-
// A map containing the request id and the handler
|
|
86
|
+
// A map containing the request id and the handler. The id should be in lower case to prevent string comparison issues.
|
|
86
87
|
this._responseHandlers = {};
|
|
87
88
|
this._reader = options.reader || this._getDefaultReader(this.mimeType);
|
|
88
89
|
this._writer = options.writer || this._getDefaultWriter(this.mimeType);
|
|
@@ -98,6 +99,7 @@ class Connection extends EventEmitter {
|
|
|
98
99
|
this.isOpen = false;
|
|
99
100
|
this.traversalSource = options.traversalSource || 'g';
|
|
100
101
|
this._authenticator = options.authenticator;
|
|
102
|
+
this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
|
|
101
103
|
|
|
102
104
|
this._pingEnabled = this.options.pingEnabled === false ? false : true;
|
|
103
105
|
this._pingIntervalDelay = this.options.pingInterval || pingIntervalDelay;
|
|
@@ -123,9 +125,16 @@ class Connection extends EventEmitter {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
this.emit('log', 'ws open');
|
|
128
|
+
let headers = this.options.headers;
|
|
129
|
+
if (this._enableUserAgentOnConnect) {
|
|
130
|
+
if (!headers) {
|
|
131
|
+
headers = [];
|
|
132
|
+
}
|
|
133
|
+
headers[utils.getUserAgentHeader()] = utils.getUserAgent();
|
|
134
|
+
}
|
|
126
135
|
|
|
127
136
|
this._ws = new WebSocket(this.url, {
|
|
128
|
-
headers:
|
|
137
|
+
headers: headers,
|
|
129
138
|
ca: this.options.ca,
|
|
130
139
|
cert: this.options.cert,
|
|
131
140
|
pfx: this.options.pfx,
|
|
@@ -164,7 +173,8 @@ class Connection extends EventEmitter {
|
|
|
164
173
|
|
|
165
174
|
/** @override */
|
|
166
175
|
submit(processor, op, args, requestId) {
|
|
167
|
-
|
|
176
|
+
// TINKERPOP-2847: Use lower case to prevent string comparison issues.
|
|
177
|
+
const rid = (requestId || utils.getUuid()).toLowerCase();
|
|
168
178
|
return this.open().then(
|
|
169
179
|
() =>
|
|
170
180
|
new Promise((resolve, reject) => {
|
|
@@ -192,7 +202,8 @@ class Connection extends EventEmitter {
|
|
|
192
202
|
|
|
193
203
|
/** @override */
|
|
194
204
|
stream(processor, op, args, requestId) {
|
|
195
|
-
|
|
205
|
+
// TINKERPOP-2847: Use lower case to prevent string comparison issues.
|
|
206
|
+
const rid = (requestId || utils.getUuid()).toLowerCase();
|
|
196
207
|
|
|
197
208
|
const readableStream = new Stream.Readable({
|
|
198
209
|
objectMode: true,
|
|
@@ -306,6 +317,8 @@ class Connection extends EventEmitter {
|
|
|
306
317
|
return;
|
|
307
318
|
}
|
|
308
319
|
|
|
320
|
+
// TINKERPOP-2847: Use lower case to prevent string comparison issues.
|
|
321
|
+
response.requestId = response.requestId.toLowerCase();
|
|
309
322
|
const handler = this._responseHandlers[response.requestId];
|
|
310
323
|
|
|
311
324
|
if (!handler) {
|
|
@@ -48,6 +48,10 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
48
48
|
* @param {GraphSONWriter} [options.writer] The writer to use.
|
|
49
49
|
* @param {Authenticator} [options.authenticator] The authentication handler to use.
|
|
50
50
|
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
|
|
51
|
+
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
|
|
52
|
+
* @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
|
|
53
|
+
* @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
|
|
54
|
+
* @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
|
|
51
55
|
* @constructor
|
|
52
56
|
*/
|
|
53
57
|
constructor(url, options = {}) {
|
package/lib/process/traversal.js
CHANGED
|
@@ -473,6 +473,20 @@ function toEnum(typeName, keys) {
|
|
|
473
473
|
return result;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
const directionAlias = {
|
|
477
|
+
from_: 'out',
|
|
478
|
+
to: 'in',
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// for direction enums, maps the same EnumValue object to the enum aliases after creating them
|
|
482
|
+
function toDirectionEnum(typeName, keys) {
|
|
483
|
+
const result = toEnum(typeName, keys);
|
|
484
|
+
Object.keys(directionAlias).forEach((k) => {
|
|
485
|
+
result[k] = result[directionAlias[k]];
|
|
486
|
+
});
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
489
|
+
|
|
476
490
|
class EnumValue {
|
|
477
491
|
constructor(typeName, elementName) {
|
|
478
492
|
this.typeName = typeName;
|
|
@@ -496,10 +510,10 @@ module.exports = {
|
|
|
496
510
|
barrier: toEnum('Barrier', 'normSack'),
|
|
497
511
|
cardinality: toEnum('Cardinality', 'list set single'),
|
|
498
512
|
column: toEnum('Column', 'keys values'),
|
|
499
|
-
direction:
|
|
513
|
+
direction: toDirectionEnum('Direction', 'BOTH IN OUT from_ to'),
|
|
500
514
|
graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0'),
|
|
501
515
|
gryoVersion: toEnum('GryoVersion', 'V1_0 V3_0'),
|
|
502
|
-
merge: toEnum('Merge', 'onCreate onMatch'),
|
|
516
|
+
merge: toEnum('Merge', 'onCreate onMatch outV inV'),
|
|
503
517
|
operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
|
|
504
518
|
order: toEnum('Order', 'asc desc shuffle'),
|
|
505
519
|
pick: toEnum('Pick', 'any none'),
|
package/lib/utils.js
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
'use strict';
|
|
25
25
|
|
|
26
26
|
const crypto = require('crypto');
|
|
27
|
+
const os = require('os');
|
|
28
|
+
const { readFileSync } = require('fs');
|
|
27
29
|
|
|
28
30
|
exports.toLong = function toLong(value) {
|
|
29
31
|
return new Long(value);
|
|
@@ -79,3 +81,44 @@ class ImmutableMap extends Map {
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
exports.ImmutableMap = ImmutableMap;
|
|
84
|
+
|
|
85
|
+
function generateUserAgent() {
|
|
86
|
+
const applicationName = (process.env.npm_package_name || 'NotAvailable').replace('_', ' ');
|
|
87
|
+
let driverVersion;
|
|
88
|
+
try {
|
|
89
|
+
driverVersion = JSON.parse(readFileSync(__dirname + '/../package.json')).version.replace('_', ' ');
|
|
90
|
+
} catch (e) {
|
|
91
|
+
driverVersion = 'NotAvailable';
|
|
92
|
+
}
|
|
93
|
+
let runtimeVersion;
|
|
94
|
+
let osName;
|
|
95
|
+
let osVersion;
|
|
96
|
+
let cpuArch;
|
|
97
|
+
runtimeVersion = osName = osVersion = cpuArch = 'NotAvailable';
|
|
98
|
+
if (process != null) {
|
|
99
|
+
if (process.version) {
|
|
100
|
+
runtimeVersion = process.version.replace(' ', '_');
|
|
101
|
+
}
|
|
102
|
+
if (process.arch) {
|
|
103
|
+
cpuArch = process.arch.replace(' ', '_');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (os != null) {
|
|
107
|
+
osName = os.platform().replace(' ', '_');
|
|
108
|
+
osVersion = os.release().replace(' ', '_');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const userAgent = `${applicationName} Gremlin-Javascript.${driverVersion} ${runtimeVersion} ${osName}.${osVersion} ${cpuArch}`;
|
|
112
|
+
|
|
113
|
+
return userAgent;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
exports.getUserAgentHeader = function getUserAgentHeader() {
|
|
117
|
+
return 'User-Agent';
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const userAgent = generateUserAgent();
|
|
121
|
+
|
|
122
|
+
exports.getUserAgent = function getUserAgent() {
|
|
123
|
+
return userAgent;
|
|
124
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gremlin",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"description": "JavaScript Gremlin Language Variant",
|
|
5
5
|
"author": "Apache TinkerPop team",
|
|
6
6
|
"keywords": [
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"ws": "^
|
|
17
|
+
"ws": "^8.11.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"chai": "~4.
|
|
20
|
+
"chai": "~4.3.6",
|
|
21
21
|
"chai-string": "~1.5.0",
|
|
22
22
|
"colors": "1.4.0",
|
|
23
23
|
"cross-env": "^7.0.3",
|
|
24
|
-
"cucumber": "~
|
|
25
|
-
"eslint": "^
|
|
24
|
+
"cucumber": "~6.0.7",
|
|
25
|
+
"eslint": "^8.30.0",
|
|
26
26
|
"eslint-config-prettier": "^8.5.0",
|
|
27
27
|
"eslint-plugin-prettier": "^4.0.0",
|
|
28
|
-
"grunt": "^1.
|
|
29
|
-
"grunt-cli": "~1.3
|
|
28
|
+
"grunt": "^1.5.3",
|
|
29
|
+
"grunt-cli": "~1.4.3",
|
|
30
30
|
"grunt-jsdoc": "~2.4.1",
|
|
31
|
-
"mocha": "^
|
|
32
|
-
"prettier": "^2.
|
|
31
|
+
"mocha": "^10.2.0",
|
|
32
|
+
"prettier": "^2.7.1"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
@@ -43,12 +43,15 @@
|
|
|
43
43
|
"test": "npm run unit-test && npm run integration-test",
|
|
44
44
|
"unit-test": "mocha test/unit/*",
|
|
45
45
|
"integration-test": "npm run integration-test-graphson30 && npm run integration-test-graphbinary",
|
|
46
|
-
"integration-test-graphson30": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' ./node_modules/mocha/bin/mocha test/integration -t 5000",
|
|
47
|
-
"integration-test-graphbinary": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' ./node_modules/mocha/bin/mocha test/integration -t 5000",
|
|
46
|
+
"integration-test-graphson30": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' ./node_modules/mocha/bin/mocha.js test/integration -t 5000",
|
|
47
|
+
"integration-test-graphbinary": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' ./node_modules/mocha/bin/mocha.js test/integration -t 5000",
|
|
48
48
|
"TODO": "# test other mime types like graphbinary stringd",
|
|
49
49
|
"features": "npm run features-graphson30 && npm run features-graphbinary",
|
|
50
|
-
"features-graphson30": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' cucumber-js --require test/cucumber ../../../../../gremlin-test/features/",
|
|
51
|
-
"features-graphbinary": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' cucumber-js --require test/cucumber ../../../../../gremlin-test/features/",
|
|
50
|
+
"features-graphson30": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' cucumber-js --require test/cucumber ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/",
|
|
51
|
+
"features-graphbinary": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' cucumber-js --require test/cucumber ../../../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/",
|
|
52
|
+
"features-docker": "npm run features-graphson30-docker && npm run features-graphbinary-docker",
|
|
53
|
+
"features-graphson30-docker": "cross-env CLIENT_MIMETYPE='application/vnd.gremlin-v3.0+json' cucumber-js --require test/cucumber ../gremlin-test/",
|
|
54
|
+
"features-graphbinary-docker": "cross-env CLIENT_MIMETYPE='application/vnd.graphbinary-v1.0' cucumber-js --require test/cucumber ../gremlin-test/",
|
|
52
55
|
"lint": "eslint --ext .js ."
|
|
53
56
|
},
|
|
54
57
|
"engines": {
|