gremlin 3.5.1 → 3.6.0

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 (89) hide show
  1. package/.eslintrc.js +154 -0
  2. package/.prettierrc.js +29 -0
  3. package/Gruntfile.js +15 -16
  4. package/README.md +2 -2
  5. package/doc/AnonymousTraversalSource.html +5 -5
  6. package/doc/Authenticator.html +2 -2
  7. package/doc/Bytecode.html +7 -7
  8. package/doc/Client.html +138 -64
  9. package/doc/Connection.html +89 -5
  10. package/doc/DriverRemoteConnection.html +11 -11
  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 +1025 -190
  18. package/doc/GraphTraversalSource.html +520 -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 +10 -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 +2 -2
  31. package/doc/ResultSet.html +7 -7
  32. package/doc/SaslAuthenticator.html +2 -2
  33. package/doc/SaslMechanismBase.html +2 -2
  34. package/doc/SaslMechanismPlain.html +6 -6
  35. package/doc/SeedStrategy.html +288 -0
  36. package/doc/SubgraphStrategy.html +3 -3
  37. package/doc/TextP.html +300 -10
  38. package/doc/Transaction.html +6 -6
  39. package/doc/Translator.html +198 -4
  40. package/doc/TraversalStrategies.html +5 -5
  41. package/doc/TraversalStrategy.html +3 -3
  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 +73 -23
  49. package/doc/driver_connection.js.html +108 -89
  50. package/doc/driver_driver-remote-connection.js.html +12 -11
  51. package/doc/driver_remote-connection.js.html +4 -5
  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 +4 -4
  56. package/doc/process_anonymous-traversal.js.html +4 -4
  57. package/doc/process_bytecode.js.html +11 -9
  58. package/doc/process_graph-traversal.js.html +277 -143
  59. package/doc/process_transaction.js.html +16 -9
  60. package/doc/process_translator.js.html +53 -37
  61. package/doc/process_traversal-strategy.js.html +83 -53
  62. package/doc/process_traversal.js.html +111 -107
  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 +71 -21
  73. package/lib/driver/connection.js +106 -87
  74. package/lib/driver/driver-remote-connection.js +10 -9
  75. package/lib/driver/remote-connection.js +2 -3
  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 +1 -2
  79. package/lib/process/bytecode.js +9 -7
  80. package/lib/process/graph-traversal.js +274 -141
  81. package/lib/process/transaction.js +13 -7
  82. package/lib/process/translator.js +50 -35
  83. package/lib/process/traversal-strategy.js +80 -51
  84. package/lib/process/traversal.js +109 -105
  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 -4
@@ -34,7 +34,6 @@ const OptionsStrategy = require('../process/traversal-strategy').OptionsStrategy
34
34
  * Represents the default {@link RemoteConnection} implementation.
35
35
  */
36
36
  class DriverRemoteConnection extends RemoteConnection {
37
-
38
37
  /**
39
38
  * Creates a new instance of {@link DriverRemoteConnection}.
40
39
  * @param {String} url The resource uri.
@@ -68,28 +67,30 @@ class DriverRemoteConnection extends RemoteConnection {
68
67
 
69
68
  /** @override */
70
69
  submit(bytecode) {
71
- let optionsStrategy = bytecode.sourceInstructions.find(
72
- i => i[0] === "withStrategies" && i[1] instanceof OptionsStrategy);
70
+ const optionsStrategy = bytecode.sourceInstructions.find(
71
+ (i) => i[0] === 'withStrategies' && i[1] instanceof OptionsStrategy,
72
+ );
73
73
  const allowedKeys = ['evaluationTimeout', 'scriptEvaluationTimeout', 'batchSize', 'requestId', 'userAgent'];
74
74
 
75
75
  let requestOptions = undefined;
76
76
  if (optionsStrategy !== undefined) {
77
77
  requestOptions = {};
78
78
  const conf = optionsStrategy[1].configuration;
79
- for (let key in conf) {
79
+ for (const key in conf) {
80
80
  if (conf.hasOwnProperty(key) && allowedKeys.indexOf(key) > -1) {
81
81
  requestOptions[key] = conf[key];
82
82
  }
83
83
  }
84
84
  }
85
85
 
86
- return this._client.submit(bytecode, null, requestOptions).then(result => new RemoteTraversal(result.toArray()));
86
+ return this._client.submit(bytecode, null, requestOptions).then((result) => new RemoteTraversal(result.toArray()));
87
87
  }
88
88
 
89
89
  /** @override */
90
90
  createSession() {
91
- if (this.isSessionBound)
92
- throw new Error("Connection is already bound to a session - child sessions are not allowed");
91
+ if (this.isSessionBound) {
92
+ throw new Error('Connection is already bound to a session - child sessions are not allowed');
93
+ }
93
94
 
94
95
  // make sure a fresh session is used when starting a new transaction
95
96
  const copiedOptions = Object.assign({}, this.options);
@@ -104,12 +105,12 @@ class DriverRemoteConnection extends RemoteConnection {
104
105
 
105
106
  /** @override */
106
107
  commit() {
107
- return this._client.submit(Bytecode.GraphOp.commit, null)
108
+ return this._client.submit(Bytecode.GraphOp.commit, null);
108
109
  }
109
110
 
110
111
  /** @override */
111
112
  rollback() {
112
- return this._client.submit(Bytecode.GraphOp.rollback, null)
113
+ return this._client.submit(Bytecode.GraphOp.rollback, null);
113
114
  }
114
115
 
115
116
  /** @override */
@@ -30,7 +30,6 @@ const TraversalStrategy = require('../process/traversal-strategy').TraversalStra
30
30
  * returning results.
31
31
  */
32
32
  class RemoteConnection {
33
-
34
33
  /**
35
34
  * @param {String} url The resource uri.
36
35
  * @param {Object} [options] The connection options.
@@ -73,7 +72,7 @@ class RemoteConnection {
73
72
  */
74
73
  submit(bytecode) {
75
74
  throw new Error('submit() must be implemented');
76
- };
75
+ }
77
76
 
78
77
  /**
79
78
  * Create a new <code>RemoteConnection</code> that is bound to a session using the configuration from this one.
@@ -128,7 +127,7 @@ class RemoteStrategy extends TraversalStrategy {
128
127
  // gave this a fqcn that has a local "js:" prefix since this strategy isn't sent as bytecode to the server.
129
128
  // this is a sort of local-only strategy that actually executes client side. not sure if this prefix is the
130
129
  // right way to name this or not, but it should have a name to identify it.
131
- super("js:RemoteStrategy");
130
+ super('js:RemoteStrategy');
132
131
  this.connection = connection;
133
132
  }
134
133
 
@@ -25,7 +25,7 @@
25
25
  class ResponseError extends Error {
26
26
  constructor(message, responseStatus) {
27
27
  super(message);
28
- this.name = "ResponseError";
28
+ this.name = 'ResponseError';
29
29
 
30
30
  /**
31
31
  * Gets the server status code.
@@ -44,4 +44,4 @@ class ResponseError extends Error {
44
44
  }
45
45
  }
46
46
 
47
- module.exports = ResponseError;
47
+ module.exports = ResponseError;
@@ -31,7 +31,6 @@ const emptyMap = Object.freeze(new utils.ImmutableMap());
31
31
  * Represents the response returned from the execution of a Gremlin traversal or script.
32
32
  */
33
33
  class ResultSet {
34
-
35
34
  /**
36
35
  * Creates a new instance of {@link ResultSet}.
37
36
  * @param {Array} items
@@ -90,4 +89,4 @@ class ResultSet {
90
89
  }
91
90
  }
92
91
 
93
- module.exports = ResultSet;
92
+ module.exports = ResultSet;
@@ -30,7 +30,6 @@ const Graph = require('../structure/graph').Graph;
30
30
  * instance or a <code>RemoteConnection</code>.
31
31
  */
32
32
  class AnonymousTraversalSource {
33
-
34
33
  /**
35
34
  * Creates a new instance of {@code AnonymousTraversalSource}.
36
35
  * @param {Function} [traversalSourceClass] Optional {@code GraphTraversalSource} constructor.
@@ -75,4 +74,4 @@ class AnonymousTraversalSource {
75
74
  }
76
75
  }
77
76
 
78
- module.exports = AnonymousTraversalSource;
77
+ module.exports = AnonymousTraversalSource;
@@ -33,8 +33,7 @@ class Bytecode {
33
33
  if (!toClone) {
34
34
  this.sourceInstructions = [];
35
35
  this.stepInstructions = [];
36
- }
37
- else {
36
+ } else {
38
37
  this.sourceInstructions = [...toClone.sourceInstructions];
39
38
  this.stepInstructions = [...toClone.stepInstructions];
40
39
  }
@@ -79,9 +78,12 @@ class Bytecode {
79
78
  instruction[0] = name;
80
79
  for (let i = 1; i < length; i++) {
81
80
  const val = values[i - 1];
82
- if (val instanceof Traversal && val.graph != null)
83
- throw new Error(`The child traversal of ${val} was not spawned anonymously - use ` +
84
- `the __ class rather than a TraversalSource to construct the child traversal`);
81
+ if (val instanceof Traversal && val.graph != null) {
82
+ throw new Error(
83
+ `The child traversal of ${val} was not spawned anonymously - use ` +
84
+ 'the __ class rather than a TraversalSource to construct the child traversal',
85
+ );
86
+ }
85
87
  instruction[i] = val;
86
88
  }
87
89
  return instruction;
@@ -113,8 +115,8 @@ class Bytecode {
113
115
  */
114
116
  static get GraphOp() {
115
117
  return {
116
- commit: Bytecode._createGraphOp("tx", ["commit"]),
117
- rollback: Bytecode._createGraphOp("tx", ["rollback"])
118
+ commit: Bytecode._createGraphOp('tx', ['commit']),
119
+ rollback: Bytecode._createGraphOp('tx', ['rollback']),
118
120
  };
119
121
  }
120
122
  }