gremlin 3.5.0 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/.eslintrc.js +154 -0
  2. package/.prettierrc.js +29 -0
  3. package/Gruntfile.js +15 -16
  4. package/NOTICE +1 -1
  5. package/doc/AnonymousTraversalSource.html +7 -7
  6. package/doc/Authenticator.html +3 -3
  7. package/doc/Bytecode.html +249 -5
  8. package/doc/Client.html +139 -65
  9. package/doc/Connection.html +90 -6
  10. package/doc/DriverRemoteConnection.html +380 -8
  11. package/doc/EdgeLabelVerificationStrategy.html +3 -3
  12. package/doc/Graph.html +2 -2
  13. package/doc/GraphSON2Reader.html +4 -4
  14. package/doc/GraphSON2Writer.html +3 -3
  15. package/doc/GraphSON3Reader.html +3 -3
  16. package/doc/GraphSON3Writer.html +3 -3
  17. package/doc/GraphTraversal.html +107 -107
  18. package/doc/GraphTraversalSource.html +130 -19
  19. package/doc/HaltedTraverserStrategy.html +3 -3
  20. package/doc/MatchAlgorithmStrategy.html +3 -3
  21. package/doc/P.html +13 -13
  22. package/doc/PartitionStrategy.html +3 -3
  23. package/doc/Path.html +2 -2
  24. package/doc/PlainTextSaslAuthenticator.html +2 -2
  25. package/doc/ProductiveByStrategy.html +288 -0
  26. package/doc/RemoteConnection.html +484 -10
  27. package/doc/RemoteStrategy.html +4 -4
  28. package/doc/RemoteTraversal.html +3 -3
  29. package/doc/ReservedKeysVerificationStrategy.html +3 -3
  30. package/doc/ResponseError.html +3 -3
  31. package/doc/ResultSet.html +8 -8
  32. package/doc/SaslAuthenticator.html +2 -2
  33. package/doc/SaslMechanismBase.html +3 -3
  34. package/doc/SaslMechanismPlain.html +6 -6
  35. package/doc/{GraphSONReader.html → SeedStrategy.html} +12 -15
  36. package/doc/SubgraphStrategy.html +3 -3
  37. package/doc/TextP.html +10 -10
  38. package/doc/Transaction.html +655 -0
  39. package/doc/Translator.html +200 -6
  40. package/doc/TraversalStrategies.html +137 -4
  41. package/doc/TraversalStrategy.html +4 -4
  42. package/doc/TypeSerializer.html +2 -2
  43. package/doc/driver_auth_authenticator.js.html +4 -4
  44. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +3 -3
  45. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +26 -17
  46. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +7 -7
  47. package/doc/driver_auth_sasl-authenticator.js.html +3 -3
  48. package/doc/driver_client.js.html +75 -25
  49. package/doc/driver_connection.js.html +108 -89
  50. package/doc/driver_driver-remote-connection.js.html +40 -9
  51. package/doc/driver_remote-connection.js.html +47 -6
  52. package/doc/driver_response-error.js.html +5 -4
  53. package/doc/driver_result-set.js.html +4 -4
  54. package/doc/global.html +200 -3
  55. package/doc/index.html +2 -2
  56. package/doc/process_anonymous-traversal.js.html +5 -5
  57. package/doc/process_bytecode.js.html +32 -7
  58. package/doc/process_graph-traversal.js.html +213 -143
  59. package/doc/process_transaction.js.html +143 -0
  60. package/doc/process_translator.js.html +58 -39
  61. package/doc/process_traversal-strategy.js.html +79 -52
  62. package/doc/process_traversal.js.html +101 -108
  63. package/doc/structure_graph.js.html +7 -7
  64. package/doc/structure_io_graph-serializer.js.html +65 -18
  65. package/doc/structure_io_type-serializers.js.html +86 -89
  66. package/index.js +5 -5
  67. package/lib/driver/auth/authenticator.js +2 -2
  68. package/lib/driver/auth/mechanisms/sasl-mechanism-base.js +1 -1
  69. package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +24 -15
  70. package/lib/driver/auth/plain-text-sasl-authenticator.js +5 -5
  71. package/lib/driver/auth/sasl-authenticator.js +1 -1
  72. package/lib/driver/client.js +73 -23
  73. package/lib/driver/connection.js +106 -87
  74. package/lib/driver/driver-remote-connection.js +38 -7
  75. package/lib/driver/remote-connection.js +45 -4
  76. package/lib/driver/response-error.js +2 -2
  77. package/lib/driver/result-set.js +1 -2
  78. package/lib/process/anonymous-traversal.js +2 -3
  79. package/lib/process/bytecode.js +30 -5
  80. package/lib/process/graph-traversal.js +210 -141
  81. package/lib/process/transaction.js +92 -0
  82. package/lib/process/translator.js +55 -37
  83. package/lib/process/traversal-strategy.js +76 -50
  84. package/lib/process/traversal.js +99 -106
  85. package/lib/structure/graph.js +5 -5
  86. package/lib/structure/io/graph-serializer.js +62 -16
  87. package/lib/structure/io/type-serializers.js +84 -87
  88. package/lib/utils.js +15 -10
  89. package/package.json +11 -5
  90. package/doc/GraphSONWriter.html +0 -436
  91. package/gremlin-javascript.iml +0 -9
@@ -60,12 +60,13 @@ class SaslMechanismPlain extends SaslMechanismBase {
60
60
  constructor(options) {
61
61
  super(options);
62
62
 
63
- if (this._options.username === undefined
64
- || this._options.username === null
65
- || this._options.username.length == 0
66
- || this._options.password === undefined
67
- || this._options.password === null
68
- || this._options.password.length == 0
63
+ if (
64
+ this._options.username === undefined ||
65
+ this._options.username === null ||
66
+ this._options.username.length === 0 ||
67
+ this._options.password === undefined ||
68
+ this._options.password === null ||
69
+ this._options.password.length === 0
69
70
  ) {
70
71
  throw new Error('Missing credentials for SASL PLAIN mechanism');
71
72
  }
@@ -77,7 +78,7 @@ class SaslMechanismPlain extends SaslMechanismBase {
77
78
  get name() {
78
79
  return 'PLAIN';
79
80
  }
80
-
81
+
81
82
  /**
82
83
  * Evaluates the challenge from the server and returns appropriate response.
83
84
  * @param {String} challenge Challenge string presented by the server.
@@ -86,12 +87,14 @@ class SaslMechanismPlain extends SaslMechanismBase {
86
87
  evaluateChallenge(challenge) {
87
88
  if (this._hasInitialResponse(challenge)) {
88
89
  return Promise.resolve({
89
- 'saslMechanism': this.name,
90
- 'sasl': this._saslArgument(this._options.authzid, this._options.username, this._options.password)
90
+ saslMechanism: this.name,
91
+ sasl: this._saslArgument(this._options.authzid, this._options.username, this._options.password),
91
92
  });
92
93
  }
93
-
94
- return Promise.resolve({ 'sasl': this._saslArgument(this._options.authzid, this._options.username, this._options.password) });
94
+
95
+ return Promise.resolve({
96
+ sasl: this._saslArgument(this._options.authzid, this._options.username, this._options.password),
97
+ });
95
98
  }
96
99
 
97
100
  /**
@@ -101,11 +104,17 @@ class SaslMechanismPlain extends SaslMechanismBase {
101
104
  * @param {String} password The password of user with access to server.
102
105
  */
103
106
  _saslArgument(authzid, username, password) {
104
- if (authzid === undefined || authzid === null) authzid = '';
105
- if (username === undefined || username === null) username = '';
106
- if (password === undefined || password.length === null) password = '';
107
+ if (authzid === undefined || authzid === null) {
108
+ authzid = '';
109
+ }
110
+ if (username === undefined || username === null) {
111
+ username = '';
112
+ }
113
+ if (password === undefined || password.length === null) {
114
+ password = '';
115
+ }
107
116
 
108
- return new Buffer(`${authzid}\0${username}\0${password}`).toString('base64');
117
+ return Buffer.from(`${authzid}\0${username}\0${password}`).toString('base64');
109
118
  }
110
119
 
111
120
  /**
@@ -132,13 +141,13 @@ module.exports = SaslMechanismPlain;
132
141
  </div>
133
142
 
134
143
  <nav>
135
- <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>
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="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>
136
145
  </nav>
137
146
 
138
147
  <br class="clear">
139
148
 
140
149
  <footer>
141
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon May 10 2021 08:06:59 GMT-0400 (Eastern Daylight Time)
150
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
142
151
  </footer>
143
152
 
144
153
  <script> prettyPrint(); </script>
@@ -61,15 +61,15 @@ class PlainTextSaslAuthenticator extends Authenticator {
61
61
  constructor(username, password, authzid) {
62
62
  const options = {
63
63
  mechanism: new SaslMechanismPlain({
64
- 'username': username,
65
- 'password': password,
66
- 'authzid': authzid
67
- })
64
+ username: username,
65
+ password: password,
66
+ authzid: authzid,
67
+ }),
68
68
  };
69
69
 
70
70
  super(options);
71
71
  }
72
-
72
+
73
73
  /**
74
74
  * Evaluates the challenge from the server and returns appropriate response.
75
75
  * @param {String} challenge Challenge string presented by the server.
@@ -91,13 +91,13 @@ module.exports = PlainTextSaslAuthenticator;
91
91
  </div>
92
92
 
93
93
  <nav>
94
- <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>
94
+ <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>
95
95
  </nav>
96
96
 
97
97
  <br class="clear">
98
98
 
99
99
  <footer>
100
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon May 10 2021 08:06:59 GMT-0400 (Eastern Daylight Time)
100
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
101
101
  </footer>
102
102
 
103
103
  <script> prettyPrint(); </script>
@@ -63,7 +63,7 @@ class SaslAuthenticator extends Authenticator {
63
63
  throw new Error('No Sasl Mechanism Specified');
64
64
  }
65
65
  }
66
-
66
+
67
67
  /**
68
68
  * Evaluates the challenge from the server and returns appropriate response.
69
69
  * @param {String} challenge Challenge string presented by the server.
@@ -85,13 +85,13 @@ module.exports = SaslAuthenticator;
85
85
  </div>
86
86
 
87
87
  <nav>
88
- <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>
88
+ <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>
89
89
  </nav>
90
90
 
91
91
  <br class="clear">
92
92
 
93
93
  <footer>
94
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon May 10 2021 08:06:59 GMT-0400 (Eastern Daylight Time)
94
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
95
95
  </footer>
96
96
 
97
97
  <script> prettyPrint(); </script>
@@ -32,14 +32,14 @@
32
32
  * distributed with this work for additional information
33
33
  * regarding copyright ownership. The ASF licenses this file
34
34
  * to you under the Apache License, Version 2.0 (the
35
- * "License"); you may not use this file except in compliance
35
+ * 'License'); you may not use this file except in compliance
36
36
  * with the License. You may obtain a copy of the License at
37
37
  *
38
38
  * http://www.apache.org/licenses/LICENSE-2.0
39
39
  *
40
40
  * Unless required by applicable law or agreed to in writing,
41
41
  * software distributed under the License is distributed on an
42
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
42
+ * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
43
43
  * KIND, either express or implied. See the License for the
44
44
  * specific language governing permissions and limitations
45
45
  * under the License.
@@ -54,7 +54,6 @@ const Bytecode = require('../process/bytecode');
54
54
  * A {@link Client} contains methods to send messages to a Gremlin Server.
55
55
  */
56
56
  class Client {
57
-
58
57
  /**
59
58
  * Creates a new instance of {@link Client}.
60
59
  * @param {String} url The resource uri.
@@ -76,7 +75,7 @@ class Client {
76
75
  this._options = options;
77
76
  if (this._options.processor === 'session') {
78
77
  // compatibility with old 'session' processor setting
79
- this._options.session = options.session || utils.getUuid()
78
+ this._options.session = options.session || utils.getUuid();
80
79
  }
81
80
  if (this._options.session) {
82
81
  // re-assign processor to 'session' when in session mode
@@ -101,40 +100,91 @@ class Client {
101
100
  return this._connection.isOpen;
102
101
  }
103
102
 
103
+ /**
104
+ * Configuration specific to the current request.
105
+ * @typedef {Object} RequestOptions
106
+ * @property {String} requestId - User specified request identifier which must be a UUID.
107
+ * @property {Number} batchSize - Indicates whether the Power component is present.
108
+ * @property {String} userAgent - The size in which the result of a request is to be 'batched' back to the client
109
+ * @property {Number} evaluationTimeout - The timeout for the evaluation of the request.
110
+ */
111
+
104
112
  /**
105
113
  * Send a request to the Gremlin Server, can send a script or bytecode steps.
106
114
  * @param {Bytecode|string} message The bytecode or script to send
107
115
  * @param {Object} [bindings] The script bindings, if any.
108
- * @param {Object} [requestOptions] Configuration specific to the current request.
109
- * @param {String} [requestOptions.requestId] User specified request identifier which must be a UUID.
110
- * @param {Number} [requestOptions.batchSize] The size in which the result of a request is to be "batched" back to the client
111
- * @param {String} [requestOptions.userAgent] A custom string that specifies to the server where the request came from.
112
- * @param {Number} [requestOptions.evaluationTimeout] The timeout for the evaluation of the request.
116
+ * @param {RequestOptions} [requestOptions] Configuration specific to the current request.
113
117
  * @returns {Promise}
114
118
  */
115
119
  submit(message, bindings, requestOptions) {
116
- const requestIdOverride = requestOptions &amp;&amp; requestOptions.requestId
117
- if (requestIdOverride) delete requestOptions['requestId'];
120
+ const requestIdOverride = requestOptions &amp;&amp; requestOptions.requestId;
121
+ if (requestIdOverride) {
122
+ delete requestOptions['requestId'];
123
+ }
124
+
125
+ const args = Object.assign(
126
+ {
127
+ gremlin: message,
128
+ aliases: { g: this._options.traversalSource || 'g' },
129
+ },
130
+ requestOptions,
131
+ );
118
132
 
119
- const args = Object.assign({
120
- gremlin: message,
121
- aliases: { 'g': this._options.traversalSource || 'g' }
122
- }, requestOptions)
133
+ if (this._options.session &amp;&amp; this._options.processor === 'session') {
134
+ args['session'] = this._options.session;
135
+ }
123
136
 
124
137
  if (message instanceof Bytecode) {
125
- return this._connection.submit('traversal','bytecode', args, requestIdOverride);
138
+ if (this._options.session &amp;&amp; this._options.processor === 'session') {
139
+ return this._connection.submit('session', 'bytecode', args, requestIdOverride);
140
+ }
141
+ return this._connection.submit('traversal', 'bytecode', args, requestIdOverride);
126
142
  } else if (typeof message === 'string') {
127
143
  args['bindings'] = bindings;
128
144
  args['language'] = 'gremlin-groovy';
129
145
  args['accept'] = this._connection.mimeType;
146
+ return this._connection.submit(this._options.processor || '', 'eval', args, requestIdOverride);
147
+ }
148
+ throw new TypeError('message must be of type Bytecode or string');
149
+ }
130
150
 
151
+ /**
152
+ * Send a request to the Gremlin Server and receive a stream for the results, can send a script or bytecode steps.
153
+ * @param {Bytecode|string} message The bytecode or script to send
154
+ * @param {Object} [bindings] The script bindings, if any.
155
+ * @param {RequestOptions} [requestOptions] Configuration specific to the current request.
156
+ * @returns {ReadableStream}
157
+ */
158
+ stream(message, bindings, requestOptions) {
159
+ const requestIdOverride = requestOptions &amp;&amp; requestOptions.requestId;
160
+ if (requestIdOverride) {
161
+ delete requestOptions['requestId'];
162
+ }
163
+
164
+ const args = Object.assign(
165
+ {
166
+ gremlin: message,
167
+ aliases: { g: this._options.traversalSource || 'g' },
168
+ },
169
+ requestOptions,
170
+ );
171
+
172
+ if (this._options.session &amp;&amp; this._options.processor === 'session') {
173
+ args['session'] = this._options.session;
174
+ }
175
+
176
+ if (message instanceof Bytecode) {
131
177
  if (this._options.session &amp;&amp; this._options.processor === 'session') {
132
- args['session'] = this._options.session;
178
+ return this._connection.stream('session', 'bytecode', args, requestIdOverride);
133
179
  }
134
- return this._connection.submit(this._options.processor || '','eval', args, requestIdOverride);
135
- } else {
136
- throw new TypeError("message must be of type Bytecode or string");
180
+ return this._connection.stream('traversal', 'bytecode', args, requestIdOverride);
181
+ } else if (typeof message === 'string') {
182
+ args['bindings'] = bindings;
183
+ args['language'] = 'gremlin-groovy';
184
+ args['accept'] = this._connection.mimeType;
185
+ return this._connection.stream(this._options.processor || '', 'eval', args, requestIdOverride);
137
186
  }
187
+ throw new TypeError('message must be of type Bytecode or string');
138
188
  }
139
189
 
140
190
  /**
@@ -144,7 +194,7 @@ class Client {
144
194
  */
145
195
  close() {
146
196
  if (this._options.session &amp;&amp; this._options.processor === 'session') {
147
- const args = {'session': this._options.session};
197
+ const args = { session: this._options.session };
148
198
  return this._connection.submit(this._options.processor, 'close', args, null).then(() => this._connection.close());
149
199
  }
150
200
  return this._connection.close();
@@ -156,7 +206,7 @@ class Client {
156
206
  * @param {Function} handler The callback to be called when the event occurs.
157
207
  */
158
208
  addListener(event, handler) {
159
- this._connection.on(event, handler)
209
+ this._connection.on(event, handler);
160
210
  }
161
211
 
162
212
  /**
@@ -165,7 +215,7 @@ class Client {
165
215
  * @param {Function} handler The event handler to be removed.
166
216
  */
167
217
  removeListener(event, handler) {
168
- this._connection.removeListener(event, handler)
218
+ this._connection.removeListener(event, handler);
169
219
  }
170
220
  }
171
221
 
@@ -180,13 +230,13 @@ module.exports = Client;
180
230
  </div>
181
231
 
182
232
  <nav>
183
- <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>
233
+ <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>
184
234
  </nav>
185
235
 
186
236
  <br class="clear">
187
237
 
188
238
  <footer>
189
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon May 10 2021 08:06:59 GMT-0400 (Eastern Daylight Time)
239
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:21:14 GMT-0400 (Eastern Daylight Time)
190
240
  </footer>
191
241
 
192
242
  <script> prettyPrint(); </script>