gremlin 3.4.9 → 3.4.13
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/doc/AnonymousTraversalSource.html +1 -1
- package/doc/Authenticator.html +1 -1
- package/doc/Bytecode.html +1 -1
- package/doc/Client.html +1 -1
- package/doc/Connection.html +1 -1
- package/doc/DriverRemoteConnection.html +1 -1
- 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 +213 -48
- package/doc/GraphTraversalSource.html +1 -1
- package/doc/HaltedTraverserStrategy.html +1 -1
- package/doc/MatchAlgorithmStrategy.html +1 -1
- package/doc/P.html +12 -12
- package/doc/PartitionStrategy.html +2 -2
- package/doc/Path.html +1 -1
- package/doc/PlainTextSaslAuthenticator.html +1 -1
- package/doc/ProductiveByStrategy.html +288 -0
- package/doc/RemoteConnection.html +1 -1
- package/doc/RemoteStrategy.html +1 -1
- package/doc/RemoteTraversal.html +1 -1
- package/doc/ReservedKeysVerificationStrategy.html +2 -2
- 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/{GraphSONReader.html → SeedStrategy.html} +12 -15
- package/doc/SubgraphStrategy.html +1 -1
- package/doc/TextP.html +9 -9
- package/doc/Transaction.html +655 -0
- package/doc/Translator.html +6 -6
- package/doc/TraversalStrategies.html +1 -1
- package/doc/TraversalStrategy.html +1 -1
- package/doc/TypeSerializer.html +1 -1
- package/doc/driver_auth_authenticator.js.html +1 -1
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +1 -1
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +1 -1
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +1 -1
- package/doc/driver_auth_sasl-authenticator.js.html +1 -1
- package/doc/driver_client.js.html +1 -1
- package/doc/driver_connection.js.html +1 -1
- package/doc/driver_driver-remote-connection.js.html +1 -1
- package/doc/driver_remote-connection.js.html +1 -1
- package/doc/driver_response-error.js.html +1 -1
- package/doc/driver_result-set.js.html +1 -1
- package/doc/global.html +2 -2
- package/doc/index.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 +11 -1
- package/doc/process_transaction.js.html +136 -0
- package/doc/process_translator.js.html +14 -5
- package/doc/process_traversal-strategy.js.html +1 -1
- package/doc/process_traversal.js.html +9 -2
- package/doc/structure_graph.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/lib/process/graph-traversal.js +10 -0
- package/lib/process/translator.js +13 -4
- package/lib/process/traversal.js +8 -1
- package/package.json +7 -6
- package/.npmignore +0 -26
- package/doc/GraphSONWriter.html +0 -436
- package/gremlin-javascript.iml +0 -9
- package/package-lock.json +0 -2598
package/doc/TypeSerializer.html
CHANGED
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
<br class="clear">
|
|
156
156
|
|
|
157
157
|
<footer>
|
|
158
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
158
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
159
159
|
</footer>
|
|
160
160
|
|
|
161
161
|
<script> prettyPrint(); </script>
|
|
@@ -80,7 +80,7 @@ module.exports = Authenticator;
|
|
|
80
80
|
<br class="clear">
|
|
81
81
|
|
|
82
82
|
<footer>
|
|
83
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
83
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
84
84
|
</footer>
|
|
85
85
|
|
|
86
86
|
<script> prettyPrint(); </script>
|
|
@@ -94,7 +94,7 @@ module.exports = SaslMechanismBase;
|
|
|
94
94
|
<br class="clear">
|
|
95
95
|
|
|
96
96
|
<footer>
|
|
97
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
97
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
98
98
|
</footer>
|
|
99
99
|
|
|
100
100
|
<script> prettyPrint(); </script>
|
|
@@ -138,7 +138,7 @@ module.exports = SaslMechanismPlain;
|
|
|
138
138
|
<br class="clear">
|
|
139
139
|
|
|
140
140
|
<footer>
|
|
141
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
141
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
142
142
|
</footer>
|
|
143
143
|
|
|
144
144
|
<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/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
100
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard 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/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
94
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
95
95
|
</footer>
|
|
96
96
|
|
|
97
97
|
<script> prettyPrint(); </script>
|
|
@@ -178,7 +178,7 @@ module.exports = Client;
|
|
|
178
178
|
<br class="clear">
|
|
179
179
|
|
|
180
180
|
<footer>
|
|
181
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
181
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
182
182
|
</footer>
|
|
183
183
|
|
|
184
184
|
<script> prettyPrint(); </script>
|
|
@@ -425,7 +425,7 @@ module.exports = Connection;
|
|
|
425
425
|
<br class="clear">
|
|
426
426
|
|
|
427
427
|
<footer>
|
|
428
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
428
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
429
429
|
</footer>
|
|
430
430
|
|
|
431
431
|
<script> prettyPrint(); </script>
|
|
@@ -139,7 +139,7 @@ module.exports = DriverRemoteConnection;
|
|
|
139
139
|
<br class="clear">
|
|
140
140
|
|
|
141
141
|
<footer>
|
|
142
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
142
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
143
143
|
</footer>
|
|
144
144
|
|
|
145
145
|
<script> prettyPrint(); </script>
|
|
@@ -140,7 +140,7 @@ module.exports = { RemoteConnection, RemoteStrategy, RemoteTraversal };
|
|
|
140
140
|
<br class="clear">
|
|
141
141
|
|
|
142
142
|
<footer>
|
|
143
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
143
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
144
144
|
</footer>
|
|
145
145
|
|
|
146
146
|
<script> prettyPrint(); </script>
|
|
@@ -88,7 +88,7 @@ module.exports = ResponseError;</code></pre>
|
|
|
88
88
|
<br class="clear">
|
|
89
89
|
|
|
90
90
|
<footer>
|
|
91
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
91
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
92
92
|
</footer>
|
|
93
93
|
|
|
94
94
|
<script> prettyPrint(); </script>
|
|
@@ -134,7 +134,7 @@ module.exports = ResultSet;</code></pre>
|
|
|
134
134
|
<br class="clear">
|
|
135
135
|
|
|
136
136
|
<footer>
|
|
137
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
137
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
138
138
|
</footer>
|
|
139
139
|
|
|
140
140
|
<script> prettyPrint(); </script>
|
package/doc/global.html
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
|
|
153
153
|
<dt class="tag-source">Source:</dt>
|
|
154
154
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
155
|
-
<a href="process_graph-traversal.js.html">process/graph-traversal.js</a>, <a href="process_graph-traversal.js.html#
|
|
155
|
+
<a href="process_graph-traversal.js.html">process/graph-traversal.js</a>, <a href="process_graph-traversal.js.html#line1286">line 1286</a>
|
|
156
156
|
</li></ul></dd>
|
|
157
157
|
|
|
158
158
|
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
<br class="clear">
|
|
193
193
|
|
|
194
194
|
<footer>
|
|
195
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
195
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
196
196
|
</footer>
|
|
197
197
|
|
|
198
198
|
<script> prettyPrint(); </script>
|
package/doc/index.html
CHANGED
|
@@ -159,7 +159,7 @@ thus for early testing purposes only.</p></article>
|
|
|
159
159
|
<br class="clear">
|
|
160
160
|
|
|
161
161
|
<footer>
|
|
162
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
162
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
163
163
|
</footer>
|
|
164
164
|
|
|
165
165
|
<script> prettyPrint(); </script>
|
|
@@ -119,7 +119,7 @@ module.exports = AnonymousTraversalSource;</code></pre>
|
|
|
119
119
|
<br class="clear">
|
|
120
120
|
|
|
121
121
|
<footer>
|
|
122
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
122
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
123
123
|
</footer>
|
|
124
124
|
|
|
125
125
|
<script> prettyPrint(); </script>
|
|
@@ -135,7 +135,7 @@ module.exports = Bytecode;
|
|
|
135
135
|
<br class="clear">
|
|
136
136
|
|
|
137
137
|
<footer>
|
|
138
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
138
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
139
139
|
</footer>
|
|
140
140
|
|
|
141
141
|
<script> prettyPrint(); </script>
|
|
@@ -820,6 +820,16 @@ class GraphTraversal extends Traversal {
|
|
|
820
820
|
return this;
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
+
/**
|
|
824
|
+
* Graph traversal none method.
|
|
825
|
+
* @param {...Object} args
|
|
826
|
+
* @returns {GraphTraversal}
|
|
827
|
+
*/
|
|
828
|
+
none(...args) {
|
|
829
|
+
this.bytecode.addStep('none', args);
|
|
830
|
+
return this;
|
|
831
|
+
}
|
|
832
|
+
|
|
823
833
|
/**
|
|
824
834
|
* Graph traversal not method.
|
|
825
835
|
* @param {...Object} args
|
|
@@ -1414,7 +1424,7 @@ module.exports = {
|
|
|
1414
1424
|
<br class="clear">
|
|
1415
1425
|
|
|
1416
1426
|
<footer>
|
|
1417
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
1427
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
1418
1428
|
</footer>
|
|
1419
1429
|
|
|
1420
1430
|
<script> prettyPrint(); </script>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: process/transaction.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: process/transaction.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
|
+
'use strict';
|
|
48
|
+
|
|
49
|
+
const remote = require('../driver/remote-connection');
|
|
50
|
+
const Bytecode = require('./bytecode');
|
|
51
|
+
const { TraversalStrategies } = require('./traversal-strategy');
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A controller for a remote transaction that is constructed from <code>g.tx()</code>. Calling <code>begin()</code>
|
|
55
|
+
* on this object will produce a new <code>GraphTraversalSource</code> that is bound to a remote transaction over which
|
|
56
|
+
* multiple traversals may be executed in that context. Calling <code>commit()</code> or <code>rollback()</code> will
|
|
57
|
+
* then close the transaction and thus, the session. This feature only works with transaction enabled graphs.
|
|
58
|
+
*/
|
|
59
|
+
class Transaction {
|
|
60
|
+
constructor(g) {
|
|
61
|
+
this._g = g;
|
|
62
|
+
this._sessionBasedConnection = undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Spawns a <code>GraphTraversalSource</code> that is bound to a remote session which enables a transaction.
|
|
67
|
+
* @returns {*}
|
|
68
|
+
*/
|
|
69
|
+
begin() {
|
|
70
|
+
if (this._sessionBasedConnection) {
|
|
71
|
+
throw new Error("Transaction already started on this object");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this._sessionBasedConnection = this._g.remoteConnection.createSession();
|
|
75
|
+
const traversalStrategy = new TraversalStrategies();
|
|
76
|
+
traversalStrategy.addStrategy(new remote.RemoteStrategy(this._sessionBasedConnection));
|
|
77
|
+
return new this._g.graphTraversalSourceClass(this._g.graph, traversalStrategy, new Bytecode(this._g.bytecode),
|
|
78
|
+
this._g.graphTraversalSourceClass, this._g.graphTraversalClass);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @returns {Promise}
|
|
83
|
+
*/
|
|
84
|
+
commit() {
|
|
85
|
+
return this._sessionBasedConnection.commit().then(() => this.close());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @returns {Promise}
|
|
90
|
+
*/
|
|
91
|
+
rollback() {
|
|
92
|
+
return this._sessionBasedConnection.rollback().then(() => this.close());
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns true if transaction is open.
|
|
97
|
+
* @returns {Boolean}
|
|
98
|
+
*/
|
|
99
|
+
get isOpen() {
|
|
100
|
+
this._sessionBasedConnection.isOpen;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @returns {Promise}
|
|
105
|
+
*/
|
|
106
|
+
close() {
|
|
107
|
+
if (this._sessionBasedConnection)
|
|
108
|
+
this._sessionBasedConnection.close();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = {
|
|
113
|
+
Transaction
|
|
114
|
+
};</code></pre>
|
|
115
|
+
</article>
|
|
116
|
+
</section>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<nav>
|
|
124
|
+
<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="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="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#statics">statics</a></li></ul>
|
|
125
|
+
</nav>
|
|
126
|
+
|
|
127
|
+
<br class="clear">
|
|
128
|
+
|
|
129
|
+
<footer>
|
|
130
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 07:15:59 GMT-0500 (Eastern Standard Time)
|
|
131
|
+
</footer>
|
|
132
|
+
|
|
133
|
+
<script> prettyPrint(); </script>
|
|
134
|
+
<script src="scripts/linenumber.js"> </script>
|
|
135
|
+
</body>
|
|
136
|
+
</html>
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
'use strict';
|
|
48
48
|
|
|
49
49
|
const Traversal = require('./traversal').Traversal;
|
|
50
|
+
const Bytecode = require('./bytecode');
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
53
|
* Class to translate glv bytecode steps into executable Gremlin-Groovy script
|
|
@@ -70,12 +71,14 @@ class Translator {
|
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
73
|
* Returns a script representation of the given bytecode instructions.
|
|
73
|
-
* @param {Object}
|
|
74
|
+
* @param {Object} bytecodeOrTraversal The traversal or bytecode of a traversal containing step instructions.
|
|
74
75
|
* @returns {string} Gremlin-Groovy script
|
|
75
76
|
*/
|
|
76
|
-
translate(
|
|
77
|
+
translate(bytecodeOrTraversal, child = false) {
|
|
77
78
|
let script = child ? "__" : this._traversalSource;
|
|
78
|
-
|
|
79
|
+
const bc = bytecodeOrTraversal instanceof Bytecode ? bytecodeOrTraversal : bytecodeOrTraversal.getBytecode();
|
|
80
|
+
|
|
81
|
+
let instructions = bc.stepInstructions;
|
|
79
82
|
|
|
80
83
|
// build the script from the glv instructions.
|
|
81
84
|
for (let i = 0; i < instructions.length; i++) {
|
|
@@ -102,12 +105,18 @@ class Translator {
|
|
|
102
105
|
}
|
|
103
106
|
script += ')';
|
|
104
107
|
});
|
|
108
|
+
} else if (Array.isArray(params[k])) {
|
|
109
|
+
const parts = [];
|
|
110
|
+
for (const param of params[k]) {
|
|
111
|
+
parts.push(translate(param.getBytecode(), true));
|
|
112
|
+
}
|
|
113
|
+
script += parts.join(",");
|
|
105
114
|
} else {
|
|
106
115
|
script += params[k].toString();
|
|
107
116
|
}
|
|
108
117
|
} else if (params[k] === undefined) {
|
|
109
118
|
script += '';
|
|
110
|
-
} else if (typeof params[k] === 'number') {
|
|
119
|
+
} else if (typeof params[k] === 'number' || typeof params[k] === 'boolean') {
|
|
111
120
|
script += params[k];
|
|
112
121
|
} else {
|
|
113
122
|
script += '\'' + params[k] + '\'';
|
|
@@ -138,7 +147,7 @@ module.exports = Translator;</code></pre>
|
|
|
138
147
|
<br class="clear">
|
|
139
148
|
|
|
140
149
|
<footer>
|
|
141
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
150
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
142
151
|
</footer>
|
|
143
152
|
|
|
144
153
|
<script> prettyPrint(); </script>
|
|
@@ -355,7 +355,7 @@ module.exports = {
|
|
|
355
355
|
<br class="clear">
|
|
356
356
|
|
|
357
357
|
<footer>
|
|
358
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
358
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
359
359
|
</footer>
|
|
360
360
|
|
|
361
361
|
<script> prettyPrint(); </script>
|
|
@@ -282,13 +282,20 @@ class P {
|
|
|
282
282
|
*/
|
|
283
283
|
toString() {
|
|
284
284
|
function formatValue(value){
|
|
285
|
+
if (Array.isArray(value)) {
|
|
286
|
+
let acc = [];
|
|
287
|
+
for (const item of value) {
|
|
288
|
+
acc.push(formatValue(item));
|
|
289
|
+
}
|
|
290
|
+
return acc;
|
|
291
|
+
}
|
|
285
292
|
if (value && typeof value === "string"){
|
|
286
293
|
return "'" + value + "'";
|
|
287
294
|
}
|
|
288
295
|
return value;
|
|
289
296
|
}
|
|
290
297
|
|
|
291
|
-
if (this.other === undefined) {
|
|
298
|
+
if (this.other === undefined || this.other === null) {
|
|
292
299
|
return this.operator + '(' + formatValue(this.value) + ')';
|
|
293
300
|
}
|
|
294
301
|
return this.operator + '(' + formatValue(this.value) + ', ' + formatValue(this.other) + ')';
|
|
@@ -540,7 +547,7 @@ module.exports = {
|
|
|
540
547
|
<br class="clear">
|
|
541
548
|
|
|
542
549
|
<footer>
|
|
543
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
550
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
544
551
|
</footer>
|
|
545
552
|
|
|
546
553
|
<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/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
235
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
236
236
|
</footer>
|
|
237
237
|
|
|
238
238
|
<script> prettyPrint(); </script>
|
|
@@ -295,7 +295,7 @@ module.exports = {
|
|
|
295
295
|
<br class="clear">
|
|
296
296
|
|
|
297
297
|
<footer>
|
|
298
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
298
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
299
299
|
</footer>
|
|
300
300
|
|
|
301
301
|
<script> prettyPrint(); </script>
|
|
@@ -549,7 +549,7 @@ module.exports = {
|
|
|
549
549
|
<br class="clear">
|
|
550
550
|
|
|
551
551
|
<footer>
|
|
552
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri
|
|
552
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Jan 14 2022 08:27:43 GMT-0500 (Eastern Standard Time)
|
|
553
553
|
</footer>
|
|
554
554
|
|
|
555
555
|
<script> prettyPrint(); </script>
|
|
@@ -792,6 +792,16 @@ class GraphTraversal extends Traversal {
|
|
|
792
792
|
return this;
|
|
793
793
|
}
|
|
794
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Graph traversal none method.
|
|
797
|
+
* @param {...Object} args
|
|
798
|
+
* @returns {GraphTraversal}
|
|
799
|
+
*/
|
|
800
|
+
none(...args) {
|
|
801
|
+
this.bytecode.addStep('none', args);
|
|
802
|
+
return this;
|
|
803
|
+
}
|
|
804
|
+
|
|
795
805
|
/**
|
|
796
806
|
* Graph traversal not method.
|
|
797
807
|
* @param {...Object} args
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
21
|
const Traversal = require('./traversal').Traversal;
|
|
22
|
+
const Bytecode = require('./bytecode');
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Class to translate glv bytecode steps into executable Gremlin-Groovy script
|
|
@@ -42,12 +43,14 @@ class Translator {
|
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Returns a script representation of the given bytecode instructions.
|
|
45
|
-
* @param {Object}
|
|
46
|
+
* @param {Object} bytecodeOrTraversal The traversal or bytecode of a traversal containing step instructions.
|
|
46
47
|
* @returns {string} Gremlin-Groovy script
|
|
47
48
|
*/
|
|
48
|
-
translate(
|
|
49
|
+
translate(bytecodeOrTraversal, child = false) {
|
|
49
50
|
let script = child ? "__" : this._traversalSource;
|
|
50
|
-
|
|
51
|
+
const bc = bytecodeOrTraversal instanceof Bytecode ? bytecodeOrTraversal : bytecodeOrTraversal.getBytecode();
|
|
52
|
+
|
|
53
|
+
let instructions = bc.stepInstructions;
|
|
51
54
|
|
|
52
55
|
// build the script from the glv instructions.
|
|
53
56
|
for (let i = 0; i < instructions.length; i++) {
|
|
@@ -74,12 +77,18 @@ class Translator {
|
|
|
74
77
|
}
|
|
75
78
|
script += ')';
|
|
76
79
|
});
|
|
80
|
+
} else if (Array.isArray(params[k])) {
|
|
81
|
+
const parts = [];
|
|
82
|
+
for (const param of params[k]) {
|
|
83
|
+
parts.push(translate(param.getBytecode(), true));
|
|
84
|
+
}
|
|
85
|
+
script += parts.join(",");
|
|
77
86
|
} else {
|
|
78
87
|
script += params[k].toString();
|
|
79
88
|
}
|
|
80
89
|
} else if (params[k] === undefined) {
|
|
81
90
|
script += '';
|
|
82
|
-
} else if (typeof params[k] === 'number') {
|
|
91
|
+
} else if (typeof params[k] === 'number' || typeof params[k] === 'boolean') {
|
|
83
92
|
script += params[k];
|
|
84
93
|
} else {
|
|
85
94
|
script += '\'' + params[k] + '\'';
|
package/lib/process/traversal.js
CHANGED
|
@@ -254,13 +254,20 @@ class P {
|
|
|
254
254
|
*/
|
|
255
255
|
toString() {
|
|
256
256
|
function formatValue(value){
|
|
257
|
+
if (Array.isArray(value)) {
|
|
258
|
+
let acc = [];
|
|
259
|
+
for (const item of value) {
|
|
260
|
+
acc.push(formatValue(item));
|
|
261
|
+
}
|
|
262
|
+
return acc;
|
|
263
|
+
}
|
|
257
264
|
if (value && typeof value === "string"){
|
|
258
265
|
return "'" + value + "'";
|
|
259
266
|
}
|
|
260
267
|
return value;
|
|
261
268
|
}
|
|
262
269
|
|
|
263
|
-
if (this.other === undefined) {
|
|
270
|
+
if (this.other === undefined || this.other === null) {
|
|
264
271
|
return this.operator + '(' + formatValue(this.value) + ')';
|
|
265
272
|
}
|
|
266
273
|
return this.operator + '(' + formatValue(this.value) + ', ' + formatValue(this.other) + ')';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gremlin",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.13",
|
|
4
4
|
"description": "JavaScript Gremlin Language Variant",
|
|
5
5
|
"author": "Apache TinkerPop team",
|
|
6
6
|
"keywords": [
|
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"ws": "^6.2.
|
|
17
|
+
"ws": "^6.2.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"chai": "~4.1.2",
|
|
21
|
+
"colors": "1.4.0",
|
|
21
22
|
"cucumber": "~4.2.1",
|
|
22
|
-
"grunt": "
|
|
23
|
+
"grunt": "^1.4.1",
|
|
23
24
|
"grunt-cli": "~1.3.2",
|
|
24
|
-
"grunt-jsdoc": "
|
|
25
|
-
"mocha": "
|
|
25
|
+
"grunt-jsdoc": "^2.4.1",
|
|
26
|
+
"mocha": "^9.1.3"
|
|
26
27
|
},
|
|
27
28
|
"repository": {
|
|
28
29
|
"type": "git",
|
|
@@ -40,4 +41,4 @@
|
|
|
40
41
|
"engines": {
|
|
41
42
|
"node": ">=6"
|
|
42
43
|
}
|
|
43
|
-
}
|
|
44
|
+
}
|
package/.npmignore
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
*.gz
|
|
19
|
-
*.tgz
|
|
20
|
-
test/
|
|
21
|
-
.DS_Store
|
|
22
|
-
.idea
|
|
23
|
-
node_modules/
|
|
24
|
-
npm-debug.log
|
|
25
|
-
# maven plugin com.github.eirslett frontend-maven-plugin installs node.js runtime in "node" folder
|
|
26
|
-
node/
|