gremlin 3.5.1 → 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 (65) hide show
  1. package/doc/AnonymousTraversalSource.html +2 -2
  2. package/doc/Authenticator.html +2 -2
  3. package/doc/Bytecode.html +2 -2
  4. package/doc/Client.html +4 -4
  5. package/doc/Connection.html +2 -2
  6. package/doc/DriverRemoteConnection.html +2 -2
  7. package/doc/EdgeLabelVerificationStrategy.html +3 -3
  8. package/doc/Graph.html +2 -2
  9. package/doc/GraphSON2Reader.html +2 -2
  10. package/doc/GraphSON2Writer.html +2 -2
  11. package/doc/GraphSON3Reader.html +2 -2
  12. package/doc/GraphSON3Writer.html +2 -2
  13. package/doc/GraphTraversal.html +2 -2
  14. package/doc/GraphTraversalSource.html +2 -2
  15. package/doc/HaltedTraverserStrategy.html +2 -2
  16. package/doc/MatchAlgorithmStrategy.html +3 -3
  17. package/doc/P.html +2 -2
  18. package/doc/PartitionStrategy.html +2 -2
  19. package/doc/Path.html +2 -2
  20. package/doc/PlainTextSaslAuthenticator.html +2 -2
  21. package/doc/ProductiveByStrategy.html +288 -0
  22. package/doc/RemoteConnection.html +2 -2
  23. package/doc/RemoteStrategy.html +2 -2
  24. package/doc/RemoteTraversal.html +2 -2
  25. package/doc/ReservedKeysVerificationStrategy.html +3 -3
  26. package/doc/ResponseError.html +2 -2
  27. package/doc/ResultSet.html +2 -2
  28. package/doc/SaslAuthenticator.html +2 -2
  29. package/doc/SaslMechanismBase.html +2 -2
  30. package/doc/SaslMechanismPlain.html +2 -2
  31. package/doc/SeedStrategy.html +288 -0
  32. package/doc/SubgraphStrategy.html +2 -2
  33. package/doc/TextP.html +2 -2
  34. package/doc/Transaction.html +2 -2
  35. package/doc/Translator.html +198 -4
  36. package/doc/TraversalStrategies.html +2 -2
  37. package/doc/TraversalStrategy.html +2 -2
  38. package/doc/TypeSerializer.html +2 -2
  39. package/doc/driver_auth_authenticator.js.html +2 -2
  40. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
  41. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
  42. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
  43. package/doc/driver_auth_sasl-authenticator.js.html +2 -2
  44. package/doc/driver_client.js.html +6 -2
  45. package/doc/driver_connection.js.html +2 -2
  46. package/doc/driver_driver-remote-connection.js.html +2 -2
  47. package/doc/driver_remote-connection.js.html +2 -2
  48. package/doc/driver_response-error.js.html +2 -2
  49. package/doc/driver_result-set.js.html +2 -2
  50. package/doc/global.html +2 -2
  51. package/doc/index.html +2 -2
  52. package/doc/process_anonymous-traversal.js.html +2 -2
  53. package/doc/process_bytecode.js.html +2 -2
  54. package/doc/process_graph-traversal.js.html +2 -2
  55. package/doc/process_transaction.js.html +2 -2
  56. package/doc/process_translator.js.html +45 -32
  57. package/doc/process_traversal-strategy.js.html +13 -2
  58. package/doc/process_traversal.js.html +2 -2
  59. package/doc/structure_graph.js.html +2 -2
  60. package/doc/structure_io_graph-serializer.js.html +2 -2
  61. package/doc/structure_io_type-serializers.js.html +2 -2
  62. package/lib/driver/client.js +4 -0
  63. package/lib/process/translator.js +43 -30
  64. package/lib/process/traversal-strategy.js +11 -0
  65. package/package.json +3 -2
@@ -289,13 +289,13 @@ module.exports = {
289
289
  </div>
290
290
 
291
291
  <nav>
292
- <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>
292
+ <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>
293
293
  </nav>
294
294
 
295
295
  <br class="clear">
296
296
 
297
297
  <footer>
298
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Mon Jul 26 2021 10:29:09 GMT+0200 (Central European Summer Time)
298
+ 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)
299
299
  </footer>
300
300
 
301
301
  <script> prettyPrint(); </script>
@@ -543,13 +543,13 @@ module.exports = {
543
543
  </div>
544
544
 
545
545
  <nav>
546
- <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>
546
+ <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>
547
547
  </nav>
548
548
 
549
549
  <br class="clear">
550
550
 
551
551
  <footer>
552
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Mon Jul 26 2021 10:29:09 GMT+0200 (Central European Summer Time)
552
+ 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)
553
553
  </footer>
554
554
 
555
555
  <script> prettyPrint(); </script>
@@ -119,6 +119,10 @@ class Client {
119
119
  * @returns {Promise}
120
120
  */
121
121
  close() {
122
+ if (this._options.session && this._options.processor === 'session') {
123
+ const args = {'session': this._options.session};
124
+ return this._connection.submit(this._options.processor, 'close', args, null).then(() => this._connection.close());
125
+ }
122
126
  return this._connection.close();
123
127
  }
124
128
 
@@ -44,6 +44,7 @@ class Translator {
44
44
  /**
45
45
  * Returns a script representation of the given bytecode instructions.
46
46
  * @param {Object} bytecodeOrTraversal The traversal or bytecode of a traversal containing step instructions.
47
+ * @param {boolean} child Determines if a traversal object should be treated as an anonymous child or if it is a spawn from "g"
47
48
  * @returns {string} Gremlin-Groovy script
48
49
  */
49
50
  translate(bytecodeOrTraversal, child = false) {
@@ -63,36 +64,7 @@ class Translator {
63
64
  script += ', ';
64
65
  }
65
66
 
66
- if (Object(params[k]) === params[k]) {
67
- if (params[k] instanceof Traversal) {
68
- script += this.translate(params[k].getBytecode(), true);
69
- } else if (params[k].toString() === '[object Object]') {
70
- Object.keys(params[k]).forEach(function (key, index) {
71
- if (index > 0) script += ', ';
72
- script += '(\'' + key + '\', ';
73
- if (params[k][key] instanceof String || typeof params[k][key] === 'string') {
74
- script += '\'' + params[k][key] + '\'';
75
- } else {
76
- script += params[k][key];
77
- }
78
- script += ')';
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(",");
86
- } else {
87
- script += params[k].toString();
88
- }
89
- } else if (params[k] === undefined) {
90
- script += '';
91
- } else if (typeof params[k] === 'number' || typeof params[k] === 'boolean') {
92
- script += params[k];
93
- } else {
94
- script += '\'' + params[k] + '\'';
95
- }
67
+ script += this.convert(params[k]);
96
68
  }
97
69
  }
98
70
 
@@ -101,6 +73,47 @@ class Translator {
101
73
 
102
74
  return script;
103
75
  }
76
+
77
+ /**
78
+ * Converts an object to a Gremlin script representation.
79
+ * @param {Object} anyObject The object to convert to a script representation
80
+ * @returns {string} The Gremlin script representation
81
+ */
82
+ convert(anyObject) {
83
+ let script = '';
84
+ if (Object(anyObject) === anyObject) {
85
+ if (anyObject instanceof Traversal) {
86
+ script += this.translate(anyObject.getBytecode(), true);
87
+ } else if (anyObject.toString() === '[object Object]') {
88
+ Object.keys(anyObject).forEach(function (key, index) {
89
+ if (index > 0) script += ', ';
90
+ script += '(\'' + key + '\', ';
91
+ if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
92
+ script += '\'' + anyObject[key] + '\'';
93
+ } else {
94
+ script += anyObject[key];
95
+ }
96
+ script += ')';
97
+ });
98
+ } else if (Array.isArray(anyObject)) {
99
+ const parts = [];
100
+ for (const item of anyObject) {
101
+ parts.push(this.convert(item));
102
+ }
103
+ script += '[' + parts.join(', ') + ']';
104
+ } else {
105
+ script += anyObject.toString();
106
+ }
107
+ } else if (anyObject === undefined) {
108
+ script += '';
109
+ } else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
110
+ script += anyObject;
111
+ } else {
112
+ script += '\'' + anyObject + '\'';
113
+ }
114
+
115
+ return script;
116
+ }
104
117
  }
105
118
 
106
119
  module.exports = Translator;
@@ -151,6 +151,16 @@ class SubgraphStrategy extends TraversalStrategy {
151
151
  }
152
152
  }
153
153
 
154
+ class ProductiveByStrategy extends TraversalStrategy {
155
+ /**
156
+ * @param {Object} [options]
157
+ * @param {Array<String>} [options.productiveKeys] set of keys that will always be productive
158
+ */
159
+ constructor(options) {
160
+ super("org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy", options);
161
+ }
162
+ }
163
+
154
164
  class VertexProgramStrategy extends TraversalStrategy {
155
165
 
156
166
  constructor(options) {
@@ -312,6 +322,7 @@ module.exports = {
312
322
  OrderLimitStrategy: OrderLimitStrategy,
313
323
  PathProcessorStrategy: PathProcessorStrategy,
314
324
  PathRetractionStrategy: PathRetractionStrategy,
325
+ ProductiveByStrategy: ProductiveByStrategy,
315
326
  CountStrategy: CountStrategy,
316
327
  RepeatUnrollStrategy: RepeatUnrollStrategy,
317
328
  GraphFilterStrategy: GraphFilterStrategy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gremlin",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "JavaScript Gremlin Language Variant",
5
5
  "author": "Apache TinkerPop team",
6
6
  "keywords": [
@@ -22,7 +22,8 @@
22
22
  "grunt": "~1.2.0",
23
23
  "grunt-cli": "~1.3.2",
24
24
  "grunt-jsdoc": "~2.4.1",
25
- "mocha": "~5.2.0"
25
+ "mocha": "~5.2.0",
26
+ "colors": "1.4.0"
26
27
  },
27
28
  "repository": {
28
29
  "type": "git",