gremlin 3.4.12 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/NOTICE +1 -1
  2. package/doc/AnonymousTraversalSource.html +11 -3
  3. package/doc/Authenticator.html +6 -2
  4. package/doc/Bytecode.html +258 -6
  5. package/doc/Client.html +84 -6
  6. package/doc/Connection.html +12 -2
  7. package/doc/DriverRemoteConnection.html +392 -8
  8. package/doc/EdgeLabelVerificationStrategy.html +5 -3
  9. package/doc/Graph.html +6 -2
  10. package/doc/GraphSON2Reader.html +6 -2
  11. package/doc/GraphSON2Writer.html +8 -2
  12. package/doc/GraphSON3Reader.html +4 -2
  13. package/doc/GraphSON3Writer.html +4 -2
  14. package/doc/GraphTraversal.html +317 -107
  15. package/doc/GraphTraversalSource.html +164 -19
  16. package/doc/HaltedTraverserStrategy.html +5 -3
  17. package/doc/MatchAlgorithmStrategy.html +5 -3
  18. package/doc/P.html +28 -2
  19. package/doc/PartitionStrategy.html +5 -3
  20. package/doc/Path.html +4 -2
  21. package/doc/PlainTextSaslAuthenticator.html +6 -2
  22. package/doc/ProductiveByStrategy.html +288 -0
  23. package/doc/RemoteConnection.html +561 -13
  24. package/doc/RemoteStrategy.html +8 -4
  25. package/doc/RemoteTraversal.html +5 -3
  26. package/doc/ReservedKeysVerificationStrategy.html +5 -3
  27. package/doc/ResponseError.html +4 -2
  28. package/doc/ResultSet.html +10 -2
  29. package/doc/SaslAuthenticator.html +6 -2
  30. package/doc/SaslMechanismBase.html +8 -2
  31. package/doc/SaslMechanismPlain.html +10 -2
  32. package/doc/SeedStrategy.html +288 -0
  33. package/doc/SubgraphStrategy.html +5 -3
  34. package/doc/TextP.html +18 -2
  35. package/doc/Transaction.html +2 -2
  36. package/doc/Translator.html +202 -4
  37. package/doc/TraversalStrategies.html +142 -3
  38. package/doc/TraversalStrategy.html +8 -4
  39. package/doc/TypeSerializer.html +4 -2
  40. package/doc/driver_auth_authenticator.js.html +2 -2
  41. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
  42. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
  43. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
  44. package/doc/driver_auth_sasl-authenticator.js.html +2 -2
  45. package/doc/driver_client.js.html +20 -8
  46. package/doc/driver_connection.js.html +2 -2
  47. package/doc/driver_driver-remote-connection.js.html +38 -4
  48. package/doc/driver_remote-connection.js.html +55 -5
  49. package/doc/driver_response-error.js.html +2 -2
  50. package/doc/driver_result-set.js.html +2 -2
  51. package/doc/global.html +3 -3
  52. package/doc/index.html +35 -18
  53. package/doc/process_anonymous-traversal.js.html +3 -3
  54. package/doc/process_bytecode.js.html +32 -3
  55. package/doc/process_graph-traversal.js.html +25 -6
  56. package/doc/process_transaction.js.html +2 -2
  57. package/doc/process_translator.js.html +45 -32
  58. package/doc/process_traversal-strategy.js.html +23 -2
  59. package/doc/process_traversal.js.html +3 -3
  60. package/doc/scripts/linenumber.js +9 -9
  61. package/doc/structure_graph.js.html +2 -2
  62. package/doc/structure_io_graph-serializer.js.html +2 -2
  63. package/doc/structure_io_type-serializers.js.html +2 -2
  64. package/doc/styles/jsdoc-default.css +2 -2
  65. package/lib/driver/client.js +18 -6
  66. package/lib/driver/driver-remote-connection.js +36 -2
  67. package/lib/driver/remote-connection.js +53 -3
  68. package/lib/process/anonymous-traversal.js +1 -1
  69. package/lib/process/bytecode.js +30 -1
  70. package/lib/process/graph-traversal.js +23 -4
  71. package/lib/process/transaction.js +86 -0
  72. package/lib/process/translator.js +43 -30
  73. package/lib/process/traversal-strategy.js +21 -0
  74. package/lib/process/traversal.js +1 -1
  75. package/package.json +6 -5
  76. package/.npmignore +0 -26
  77. package/package-lock.json +0 -5828
package/doc/index.html CHANGED
@@ -63,36 +63,45 @@
63
63
  under the License.
64
64
 
65
65
  -->
66
- <h1>JavaScript Gremlin Language Variant</h1><p><a href="https://tinkerpop.apache.org">Apache TinkerPop™</a> is a graph computing framework for both graph databases (OLTP) and graph analytic systems
66
+ <h1>JavaScript Gremlin Language Variant</h1>
67
+ <p><a href="https://tinkerpop.apache.org">Apache TinkerPop™</a> is a graph computing framework for both graph databases (OLTP) and graph analytic systems
67
68
  (OLAP). <a href="https://tinkerpop.apache.org/gremlin.html">Gremlin</a> is the graph traversal language of TinkerPop. It can be described as a functional,
68
69
  data-flow language that enables users to succinctly express complex traversals on (or queries of) their application's
69
70
  property graph.</p>
70
71
  <p>Gremlin-Javascript implements Gremlin within the JavaScript language and can be used on Node.js.</p>
71
- <pre class="prettyprint source lang-bash"><code>npm install gremlin</code></pre><p>Gremlin-Javascript is designed to connect to a &quot;server&quot; that is hosting a TinkerPop-enabled graph system. That &quot;server&quot;
72
- could be <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-server">Gremlin Server</a> or a <a href="https://tinkerpop.apache.org/docs/current/reference/#connecting-rgp">remote Gremlin provider</a> that exposes protocols by which Gremlin-Javascript
72
+ <pre class="prettyprint source lang-bash"><code>npm install gremlin
73
+ </code></pre>
74
+ <p>Gremlin-Javascript is designed to connect to a &quot;server&quot; that is hosting a TinkerPop-enabled graph system. That &quot;server&quot;
75
+ could be <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-server">Gremlin Server</a> or a <a href="https://tinkerpop.apache.org/docs/current/reference/#connecting-rgp">remote Gremlin provider</a> that exposes protocols by which Gremlin-Javascript
73
76
  can connect.</p>
74
- <p>A typical connection to a server running on &quot;localhost&quot; that supports the Gremlin Server protocol using websockets
77
+ <p>A typical connection to a server running on &quot;localhost&quot; that supports the Gremlin Server protocol using websockets
75
78
  looks like this:</p>
76
79
  <pre class="prettyprint source lang-javascript"><code>const gremlin = require('gremlin');
77
80
  const traversal = gremlin.process.AnonymousTraversalSource.traversal;
78
81
  const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
79
82
 
80
- const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));</code></pre><p>Once &quot;g&quot; has been created using a connection, it is then possible to start writing Gremlin traversals to query the
83
+ const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));
84
+ </code></pre>
85
+ <p>Once &quot;g&quot; has been created using a connection, it is then possible to start writing Gremlin traversals to query the
81
86
  remote graph:</p>
82
87
  <pre class="prettyprint source lang-javascript"><code>g.V().hasLabel('person').values('name').toList()
83
88
  .then(names => console.log(names));
84
89
 
85
90
  const names = await g.V().hasLabel('person').values('name').toList();
86
- console.log(names);</code></pre><h1>Sample Traversals</h1><p>The Gremlin language allows users to write highly expressive graph traversals and has a broad list of functions that
87
- cover a wide body of features. The <a href="https://tinkerpop.apache.org/docs/current/reference/#graph-traversal-steps">Reference Documentation</a> describes these functions and other aspects of the
88
- TinkerPop ecosystem including some specifics on <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript">Gremlin in Javascript</a> itself. Most of the examples found in the
91
+ console.log(names);
92
+ </code></pre>
93
+ <h1>Sample Traversals</h1>
94
+ <p>The Gremlin language allows users to write highly expressive graph traversals and has a broad list of functions that
95
+ cover a wide body of features. The <a href="https://tinkerpop.apache.org/docs/current/reference/#graph-traversal-steps">Reference Documentation</a> describes these functions and other aspects of the
96
+ TinkerPop ecosystem including some specifics on <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript">Gremlin in Javascript</a> itself. Most of the examples found in the
89
97
  documentation use Groovy language syntax in the <a href="https://tinkerpop.apache.org/docs/current/tutorials/the-gremlin-console/">Gremlin Console</a>. For the most part, these examples
90
- should generally translate to Javascript with <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-differences">little modification</a>. Given the strong correspondence
91
- between canonical Gremlin in Java and its variants like Javascript, there is a limited amount of Javascript-specific
92
- documentation and examples. This strong correspondence among variants ensures that the general Gremlin reference
93
- documentation is applicable to all variants and that users moving between development languages can easily adopt the
98
+ should generally translate to Javascript with <a href="https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-differences">little modification</a>. Given the strong correspondence
99
+ between canonical Gremlin in Java and its variants like Javascript, there is a limited amount of Javascript-specific
100
+ documentation and examples. This strong correspondence among variants ensures that the general Gremlin reference
101
+ documentation is applicable to all variants and that users moving between development languages can easily adopt the
94
102
  Gremlin variant for that language.</p>
95
- <h2>Create Vertex</h2><pre class="prettyprint source lang-javascript"><code>/* if we want to assign our own ID and properties to this vertex */
103
+ <h2>Create Vertex</h2>
104
+ <pre class="prettyprint source lang-javascript"><code>/* if we want to assign our own ID and properties to this vertex */
96
105
  const { t: { id } } = gremlin.process;
97
106
  const { cardinality: { single } } = gremlin.process;
98
107
 
@@ -109,7 +118,10 @@ const createVertex = async (vertexId, vlabel) => {
109
118
  .next();
110
119
 
111
120
  return vertex.value;
112
- };</code></pre><h2>Find Vertices</h2><pre class="prettyprint source lang-javascript"><code>/**
121
+ };
122
+ </code></pre>
123
+ <h2>Find Vertices</h2>
124
+ <pre class="prettyprint source lang-javascript"><code>/**
113
125
  * List all vertexes in db
114
126
  * @param {Number} limit
115
127
  */
@@ -131,7 +143,10 @@ const findVertex = async (vertexId) => {
131
143
  */
132
144
  const listByLabelAndName = async (vlabel, name) => {
133
145
  return g.V().has(vlabel, 'name', name).elementMap().toList();
134
- };</code></pre><h2>Update Vertex</h2><pre class="prettyprint source lang-javascript"><code>const { cardinality: { single } } = gremlin.process;
146
+ };
147
+ </code></pre>
148
+ <h2>Update Vertex</h2>
149
+ <pre class="prettyprint source lang-javascript"><code>const { cardinality: { single } } = gremlin.process;
135
150
 
136
151
  /**
137
152
  * Update Vertex Properties
@@ -141,7 +156,9 @@ const listByLabelAndName = async (vlabel, name) => {
141
156
  const updateVertex = async (vertexId, label, name) => {
142
157
  const vertex = await g.V(vertexId).property(single, 'name', name).next();
143
158
  return vertex.value;
144
- };</code></pre><p>NOTE that versions suffixed with &quot;-rc&quot; are considered release candidates (i.e. pre-alpha, alpha, beta, etc.) and
159
+ };
160
+ </code></pre>
161
+ <p>NOTE that versions suffixed with &quot;-rc&quot; are considered release candidates (i.e. pre-alpha, alpha, beta, etc.) and
145
162
  thus for early testing purposes only.</p></article>
146
163
  </section>
147
164
 
@@ -153,13 +170,13 @@ thus for early testing purposes only.</p></article>
153
170
  </div>
154
171
 
155
172
  <nav>
156
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
173
+ <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="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>
157
174
  </nav>
158
175
 
159
176
  <br class="clear">
160
177
 
161
178
  <footer>
162
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
179
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
163
180
  </footer>
164
181
 
165
182
  <script> prettyPrint(); </script>
@@ -80,7 +80,7 @@ class AnonymousTraversalSource {
80
80
  /**
81
81
  * Creates a {@link GraphTraversalSource} binding a {@link RemoteConnection} to a remote {@link Graph} instances as its
82
82
  * reference so that traversals spawned from it will execute over that reference.
83
- * @param {GraphTraversalSource} remoteConnection
83
+ * @param {RemoteConnection} remoteConnection
84
84
  * @return {GraphTraversalSource}
85
85
  */
86
86
  withRemote(remoteConnection) {
@@ -113,13 +113,13 @@ module.exports = AnonymousTraversalSource;</code></pre>
113
113
  </div>
114
114
 
115
115
  <nav>
116
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
116
+ <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="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>
117
117
  </nav>
118
118
 
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 Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
122
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
123
123
  </footer>
124
124
 
125
125
  <script> prettyPrint(); </script>
@@ -50,6 +50,8 @@
50
50
  */
51
51
  'use strict';
52
52
 
53
+ const { Traversal } = require('./traversal');
54
+
53
55
  class Bytecode {
54
56
  /**
55
57
  * Creates a new instance of Bytecode
@@ -104,7 +106,11 @@ class Bytecode {
104
106
  const instruction = new Array(length);
105
107
  instruction[0] = name;
106
108
  for (let i = 1; i &lt; length; i++) {
107
- instruction[i] = values[i - 1];
109
+ const val = values[i - 1];
110
+ if (val instanceof Traversal &amp;&amp; val.graph != null)
111
+ throw new Error(`The child traversal of ${val} was not spawned anonymously - use ` +
112
+ `the __ class rather than a TraversalSource to construct the child traversal`);
113
+ instruction[i] = val;
108
114
  }
109
115
  return instruction;
110
116
  }
@@ -116,6 +122,29 @@ class Bytecode {
116
122
  toString() {
117
123
  return JSON.stringify([this.sourceInstructions, this.stepInstructions]);
118
124
  }
125
+
126
+ /**
127
+ * Adds a new source instructions
128
+ * @param {String} name
129
+ * @param {Array} values
130
+ * @returns {Bytecode}
131
+ */
132
+ static _createGraphOp(name, values) {
133
+ const bc = new Bytecode();
134
+ bc.addSource(name, values);
135
+ return bc;
136
+ }
137
+
138
+ /**
139
+ * Gets the &lt;code>Bytecode&lt;/code> that is meant to be sent as "graph operations" to the server.
140
+ * @returns {{rollback: Bytecode, commit: Bytecode}}
141
+ */
142
+ static get GraphOp() {
143
+ return {
144
+ commit: Bytecode._createGraphOp("tx", ["commit"]),
145
+ rollback: Bytecode._createGraphOp("tx", ["rollback"])
146
+ };
147
+ }
119
148
  }
120
149
 
121
150
  module.exports = Bytecode;
@@ -129,13 +158,13 @@ module.exports = Bytecode;
129
158
  </div>
130
159
 
131
160
  <nav>
132
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
161
+ <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="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>
133
162
  </nav>
134
163
 
135
164
  <br class="clear">
136
165
 
137
166
  <footer>
138
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
167
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
139
168
  </footer>
140
169
 
141
170
  <script> prettyPrint(); </script>
@@ -51,12 +51,11 @@
51
51
  'use strict';
52
52
 
53
53
  const { Traversal } = require('./traversal');
54
+ const { Transaction } = require('./transaction');
54
55
  const remote = require('../driver/remote-connection');
55
- const utils = require('../utils');
56
56
  const Bytecode = require('./bytecode');
57
57
  const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy } = require('./traversal-strategy');
58
58
 
59
-
60
59
  /**
61
60
  * Represents the primary DSL of the Gremlin traversal machine.
62
61
  */
@@ -76,16 +75,36 @@ class GraphTraversalSource {
76
75
  this.bytecode = bytecode || new Bytecode();
77
76
  this.graphTraversalSourceClass = graphTraversalSourceClass || GraphTraversalSource;
78
77
  this.graphTraversalClass = graphTraversalClass || GraphTraversal;
78
+
79
+ // in order to keep the constructor unchanged within 3.5.x we can try to pop the RemoteConnection out of the
80
+ // TraversalStrategies. keeping this unchanged will allow user DSLs to not take a break.
81
+ // TODO: refactor this to be nicer in 3.6.0 when we can take a breaking change
82
+ const strat = traversalStrategies.strategies.find(ts => ts.fqcn === "js:RemoteStrategy");
83
+ this.remoteConnection = strat !== undefined ? strat.connection : undefined;
79
84
  }
80
85
 
81
86
  /**
82
- * @param remoteConnection
87
+ * @param {RemoteConnection} remoteConnection
83
88
  * @returns {GraphTraversalSource}
84
89
  */
85
90
  withRemote(remoteConnection) {
86
91
  const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
87
92
  traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
88
- return new this.graphTraversalSourceClass(this.graph, traversalStrategy, new Bytecode(this.bytecode), this.graphTraversalSourceClass, this.graphTraversalClass);
93
+ return new this.graphTraversalSourceClass(this.graph, traversalStrategy, new Bytecode(this.bytecode),
94
+ this.graphTraversalSourceClass, this.graphTraversalClass);
95
+ }
96
+
97
+ /**
98
+ * Spawn a new &lt;code>Transaction&lt;/code> object that can then start and stop a transaction.
99
+ * @returns {Transaction}
100
+ */
101
+ tx() {
102
+ // you can't do g.tx().begin().tx() - no child transactions
103
+ if (this.remoteConnection &amp;&amp; this.remoteConnection.isSessionBound) {
104
+ throw new Error("This TraversalSource is already bound to a transaction - child transactions are not supported")
105
+ }
106
+
107
+ return new Transaction(this);
89
108
  }
90
109
 
91
110
  /**
@@ -1418,13 +1437,13 @@ module.exports = {
1418
1437
  </div>
1419
1438
 
1420
1439
  <nav>
1421
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
1440
+ <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="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>
1422
1441
  </nav>
1423
1442
 
1424
1443
  <br class="clear">
1425
1444
 
1426
1445
  <footer>
1427
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
1446
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
1428
1447
  </footer>
1429
1448
 
1430
1449
  <script> prettyPrint(); </script>
@@ -121,13 +121,13 @@ module.exports = {
121
121
  </div>
122
122
 
123
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="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="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>
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="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
125
  </nav>
126
126
 
127
127
  <br class="clear">
128
128
 
129
129
  <footer>
130
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Wed Jul 21 2021 15:43:18 GMT+0200 (Central European Summer Time)
130
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
131
131
  </footer>
132
132
 
133
133
  <script> prettyPrint(); </script>
@@ -72,6 +72,7 @@ class Translator {
72
72
  /**
73
73
  * Returns a script representation of the given bytecode instructions.
74
74
  * @param {Object} bytecodeOrTraversal The traversal or bytecode of a traversal containing step instructions.
75
+ * @param {boolean} child Determines if a traversal object should be treated as an anonymous child or if it is a spawn from "g"
75
76
  * @returns {string} Gremlin-Groovy script
76
77
  */
77
78
  translate(bytecodeOrTraversal, child = false) {
@@ -91,36 +92,7 @@ class Translator {
91
92
  script += ', ';
92
93
  }
93
94
 
94
- if (Object(params[k]) === params[k]) {
95
- if (params[k] instanceof Traversal) {
96
- script += this.translate(params[k].getBytecode(), true);
97
- } else if (params[k].toString() === '[object Object]') {
98
- Object.keys(params[k]).forEach(function (key, index) {
99
- if (index > 0) script += ', ';
100
- script += '(\'' + key + '\', ';
101
- if (params[k][key] instanceof String || typeof params[k][key] === 'string') {
102
- script += '\'' + params[k][key] + '\'';
103
- } else {
104
- script += params[k][key];
105
- }
106
- script += ')';
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(",");
114
- } else {
115
- script += params[k].toString();
116
- }
117
- } else if (params[k] === undefined) {
118
- script += '';
119
- } else if (typeof params[k] === 'number' || typeof params[k] === 'boolean') {
120
- script += params[k];
121
- } else {
122
- script += '\'' + params[k] + '\'';
123
- }
95
+ script += this.convert(params[k]);
124
96
  }
125
97
  }
126
98
 
@@ -129,6 +101,47 @@ class Translator {
129
101
 
130
102
  return script;
131
103
  }
104
+
105
+ /**
106
+ * Converts an object to a Gremlin script representation.
107
+ * @param {Object} anyObject The object to convert to a script representation
108
+ * @returns {string} The Gremlin script representation
109
+ */
110
+ convert(anyObject) {
111
+ let script = '';
112
+ if (Object(anyObject) === anyObject) {
113
+ if (anyObject instanceof Traversal) {
114
+ script += this.translate(anyObject.getBytecode(), true);
115
+ } else if (anyObject.toString() === '[object Object]') {
116
+ Object.keys(anyObject).forEach(function (key, index) {
117
+ if (index > 0) script += ', ';
118
+ script += '(\'' + key + '\', ';
119
+ if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
120
+ script += '\'' + anyObject[key] + '\'';
121
+ } else {
122
+ script += anyObject[key];
123
+ }
124
+ script += ')';
125
+ });
126
+ } else if (Array.isArray(anyObject)) {
127
+ const parts = [];
128
+ for (const item of anyObject) {
129
+ parts.push(this.convert(item));
130
+ }
131
+ script += '[' + parts.join(', ') + ']';
132
+ } else {
133
+ script += anyObject.toString();
134
+ }
135
+ } else if (anyObject === undefined) {
136
+ script += '';
137
+ } else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
138
+ script += anyObject;
139
+ } else {
140
+ script += '\'' + anyObject + '\'';
141
+ }
142
+
143
+ return script;
144
+ }
132
145
  }
133
146
 
134
147
  module.exports = Translator;</code></pre>
@@ -141,13 +154,13 @@ module.exports = Translator;</code></pre>
141
154
  </div>
142
155
 
143
156
  <nav>
144
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
157
+ <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="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>
145
158
  </nav>
146
159
 
147
160
  <br class="clear">
148
161
 
149
162
  <footer>
150
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
163
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
151
164
  </footer>
152
165
 
153
166
  <script> prettyPrint(); </script>
@@ -73,6 +73,16 @@ class TraversalStrategies {
73
73
  this.strategies.push(strategy);
74
74
  }
75
75
 
76
+ /** @param {TraversalStrategy} strategy */
77
+ removeStrategy(strategy) {
78
+ const idx = this.strategies.findIndex(s => s.fqcn === strategy.fqcn);
79
+ if (idx !== -1) {
80
+ return this.strategies.splice(idx, 1)[0];
81
+ }
82
+
83
+ return undefined;
84
+ }
85
+
76
86
  /**
77
87
  * @param {Traversal} traversal
78
88
  * @returns {Promise}
@@ -169,6 +179,16 @@ class SubgraphStrategy extends TraversalStrategy {
169
179
  }
170
180
  }
171
181
 
182
+ class ProductiveByStrategy extends TraversalStrategy {
183
+ /**
184
+ * @param {Object} [options]
185
+ * @param {Array&lt;String>} [options.productiveKeys] set of keys that will always be productive
186
+ */
187
+ constructor(options) {
188
+ super("org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy", options);
189
+ }
190
+ }
191
+
172
192
  class VertexProgramStrategy extends TraversalStrategy {
173
193
 
174
194
  constructor(options) {
@@ -330,6 +350,7 @@ module.exports = {
330
350
  OrderLimitStrategy: OrderLimitStrategy,
331
351
  PathProcessorStrategy: PathProcessorStrategy,
332
352
  PathRetractionStrategy: PathRetractionStrategy,
353
+ ProductiveByStrategy: ProductiveByStrategy,
333
354
  CountStrategy: CountStrategy,
334
355
  RepeatUnrollStrategy: RepeatUnrollStrategy,
335
356
  GraphFilterStrategy: GraphFilterStrategy,
@@ -349,13 +370,13 @@ module.exports = {
349
370
  </div>
350
371
 
351
372
  <nav>
352
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
373
+ <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="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>
353
374
  </nav>
354
375
 
355
376
  <br class="clear">
356
377
 
357
378
  <footer>
358
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
379
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
359
380
  </footer>
360
381
 
361
382
  <script> prettyPrint(); </script>
@@ -525,7 +525,7 @@ module.exports = {
525
525
  graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0'),
526
526
  gryoVersion: toEnum('GryoVersion', 'V1_0 V3_0'),
527
527
  operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
528
- order: toEnum('Order', 'asc decr desc incr shuffle'),
528
+ order: toEnum('Order', 'asc desc shuffle'),
529
529
  pick: toEnum('Pick', 'any none'),
530
530
  pop: toEnum('Pop', 'all first last mixed'),
531
531
  scope: toEnum('Scope', 'global local'),
@@ -541,13 +541,13 @@ module.exports = {
541
541
  </div>
542
542
 
543
543
  <nav>
544
- <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="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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</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>
544
+ <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="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>
545
545
  </nav>
546
546
 
547
547
  <br class="clear">
548
548
 
549
549
  <footer>
550
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jul 26 2021 08:59:15 GMT+0200 (CEST)
550
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
551
551
  </footer>
552
552
 
553
553
  <script> prettyPrint(); </script>