gremlin 3.5.1 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +155 -0
- package/.prettierrc.js +29 -0
- package/Gruntfile.js +15 -16
- package/doc/AnonymousTraversalSource.html +5 -5
- package/doc/Authenticator.html +2 -2
- package/doc/Bytecode.html +7 -7
- package/doc/Client.html +138 -64
- package/doc/Connection.html +93 -9
- package/doc/DriverRemoteConnection.html +11 -11
- package/doc/EdgeLabelVerificationStrategy.html +3 -3
- package/doc/Graph.html +2 -2
- package/doc/GraphSON2Reader.html +4 -4
- package/doc/GraphSON2Writer.html +3 -3
- package/doc/GraphSON3Reader.html +3 -3
- package/doc/GraphSON3Writer.html +3 -3
- package/doc/GraphTraversal.html +107 -107
- package/doc/GraphTraversalSource.html +19 -19
- package/doc/HaltedTraverserStrategy.html +3 -3
- package/doc/MatchAlgorithmStrategy.html +3 -3
- package/doc/P.html +13 -13
- package/doc/PartitionStrategy.html +3 -3
- package/doc/Path.html +2 -2
- package/doc/PlainTextSaslAuthenticator.html +2 -2
- package/doc/ProductiveByStrategy.html +288 -0
- package/doc/RemoteConnection.html +10 -10
- package/doc/RemoteStrategy.html +4 -4
- package/doc/RemoteTraversal.html +3 -3
- package/doc/ReservedKeysVerificationStrategy.html +3 -3
- package/doc/ResponseError.html +2 -2
- package/doc/ResultSet.html +7 -7
- package/doc/SaslAuthenticator.html +2 -2
- package/doc/SaslMechanismBase.html +2 -2
- package/doc/SaslMechanismPlain.html +6 -6
- package/doc/SeedStrategy.html +288 -0
- package/doc/SubgraphStrategy.html +3 -3
- package/doc/TextP.html +10 -10
- package/doc/Transaction.html +6 -6
- package/doc/Translator.html +198 -4
- package/doc/TraversalStrategies.html +5 -5
- package/doc/TraversalStrategy.html +3 -3
- package/doc/TypeSerializer.html +2 -2
- package/doc/driver_auth_authenticator.js.html +4 -4
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +3 -3
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +26 -17
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +7 -7
- package/doc/driver_auth_sasl-authenticator.js.html +3 -3
- package/doc/driver_client.js.html +73 -23
- package/doc/driver_connection.js.html +134 -92
- package/doc/driver_driver-remote-connection.js.html +12 -11
- package/doc/driver_remote-connection.js.html +4 -5
- package/doc/driver_response-error.js.html +5 -4
- package/doc/driver_result-set.js.html +4 -4
- package/doc/global.html +264 -3
- package/doc/index.html +2 -2
- package/doc/module.exports.html +301 -0
- package/doc/process_anonymous-traversal.js.html +4 -4
- package/doc/process_bytecode.js.html +11 -9
- package/doc/process_graph-traversal.js.html +194 -143
- package/doc/process_transaction.js.html +16 -9
- package/doc/process_translator.js.html +53 -37
- package/doc/process_traversal-strategy.js.html +70 -53
- package/doc/process_traversal.js.html +101 -108
- package/doc/structure_graph.js.html +7 -7
- package/doc/structure_io_binary_internals_DataType.js.html +148 -0
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +131 -0
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +134 -0
- package/doc/structure_io_graph-serializer.js.html +65 -18
- package/doc/structure_io_type-serializers.js.html +86 -89
- package/index.js +5 -5
- package/lib/driver/auth/authenticator.js +2 -2
- package/lib/driver/auth/mechanisms/sasl-mechanism-base.js +1 -1
- package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +24 -15
- package/lib/driver/auth/plain-text-sasl-authenticator.js +5 -5
- package/lib/driver/auth/sasl-authenticator.js +1 -1
- package/lib/driver/client.js +71 -21
- package/lib/driver/connection.js +132 -90
- package/lib/driver/driver-remote-connection.js +10 -9
- package/lib/driver/remote-connection.js +2 -3
- package/lib/driver/response-error.js +2 -2
- package/lib/driver/result-set.js +1 -2
- package/lib/process/anonymous-traversal.js +1 -2
- package/lib/process/bytecode.js +9 -7
- package/lib/process/graph-traversal.js +191 -141
- package/lib/process/transaction.js +13 -7
- package/lib/process/translator.js +50 -35
- package/lib/process/traversal-strategy.js +67 -51
- package/lib/process/traversal.js +99 -106
- package/lib/structure/graph.js +5 -5
- package/lib/structure/io/binary/GraphBinary.js +109 -0
- package/lib/structure/io/binary/internals/AnySerializer.js +95 -0
- package/lib/structure/io/binary/internals/ArraySerializer.js +135 -0
- package/lib/structure/io/binary/internals/BigIntegerSerializer.js +151 -0
- package/lib/structure/io/binary/internals/BooleanSerializer.js +103 -0
- package/lib/structure/io/binary/internals/BulkSetSerializer.js +124 -0
- package/lib/structure/io/binary/internals/ByteBufferSerializer.js +124 -0
- package/lib/structure/io/binary/internals/ByteSerializer.js +95 -0
- package/lib/structure/io/binary/internals/BytecodeSerializer.js +249 -0
- package/lib/structure/io/binary/internals/DataType.js +97 -0
- package/lib/structure/io/binary/internals/DateSerializer.js +103 -0
- package/lib/structure/io/binary/internals/DoubleSerializer.js +99 -0
- package/lib/structure/io/binary/internals/EdgeSerializer.js +215 -0
- package/lib/structure/io/binary/internals/EnumSerializer.js +148 -0
- package/lib/structure/io/binary/internals/FloatSerializer.js +99 -0
- package/lib/structure/io/binary/internals/GraphBinaryReader.js +80 -0
- package/lib/structure/io/binary/internals/GraphBinaryWriter.js +83 -0
- package/lib/structure/io/binary/internals/IntSerializer.js +112 -0
- package/lib/structure/io/binary/internals/LambdaSerializer.js +70 -0
- package/lib/structure/io/binary/internals/LongSerializer.js +107 -0
- package/lib/structure/io/binary/internals/LongSerializerNg.js +102 -0
- package/lib/structure/io/binary/internals/MapSerializer.js +153 -0
- package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +68 -0
- package/lib/structure/io/binary/internals/PSerializer.js +151 -0
- package/lib/structure/io/binary/internals/PathSerializer.js +123 -0
- package/lib/structure/io/binary/internals/PropertySerializer.js +141 -0
- package/lib/structure/io/binary/internals/ShortSerializer.js +99 -0
- package/lib/structure/io/binary/internals/StringSerializer.js +114 -0
- package/lib/structure/io/binary/internals/TextPSerializer.js +145 -0
- package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +72 -0
- package/lib/structure/io/binary/internals/TraverserSerializer.js +123 -0
- package/lib/structure/io/binary/internals/UnspecifiedNullSerializer.js +75 -0
- package/lib/structure/io/binary/internals/UuidSerializer.js +119 -0
- package/lib/structure/io/binary/internals/VertexPropertySerializer.js +172 -0
- package/lib/structure/io/binary/internals/VertexSerializer.js +135 -0
- package/lib/structure/io/binary/internals/utils.js +59 -0
- package/lib/structure/io/graph-serializer.js +62 -16
- package/lib/structure/io/type-serializers.js +84 -87
- package/lib/utils.js +15 -10
- package/package.json +21 -8
|
@@ -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="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>
|
|
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="module.exports.html">exports</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#DataType">DataType</a></li><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.
|
|
94
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 15:51:52 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
|
-
*
|
|
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
|
-
*
|
|
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.
|
|
@@ -101,25 +100,35 @@ 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 {
|
|
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 && requestOptions.requestId
|
|
117
|
-
if (requestIdOverride)
|
|
120
|
+
const requestIdOverride = requestOptions && requestOptions.requestId;
|
|
121
|
+
if (requestIdOverride) {
|
|
122
|
+
delete requestOptions['requestId'];
|
|
123
|
+
}
|
|
118
124
|
|
|
119
|
-
const args = Object.assign(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
const args = Object.assign(
|
|
126
|
+
{
|
|
127
|
+
gremlin: message,
|
|
128
|
+
aliases: { g: this._options.traversalSource || 'g' },
|
|
129
|
+
},
|
|
130
|
+
requestOptions,
|
|
131
|
+
);
|
|
123
132
|
|
|
124
133
|
if (this._options.session && this._options.processor === 'session') {
|
|
125
134
|
args['session'] = this._options.session;
|
|
@@ -128,17 +137,54 @@ class Client {
|
|
|
128
137
|
if (message instanceof Bytecode) {
|
|
129
138
|
if (this._options.session && this._options.processor === 'session') {
|
|
130
139
|
return this._connection.submit('session', 'bytecode', args, requestIdOverride);
|
|
131
|
-
} else {
|
|
132
|
-
return this._connection.submit('traversal', 'bytecode', args, requestIdOverride);
|
|
133
140
|
}
|
|
141
|
+
return this._connection.submit('traversal', 'bytecode', args, requestIdOverride);
|
|
142
|
+
} else if (typeof message === 'string') {
|
|
143
|
+
args['bindings'] = bindings;
|
|
144
|
+
args['language'] = 'gremlin-groovy';
|
|
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
|
+
}
|
|
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 && 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 && this._options.processor === 'session') {
|
|
173
|
+
args['session'] = this._options.session;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (message instanceof Bytecode) {
|
|
177
|
+
if (this._options.session && this._options.processor === 'session') {
|
|
178
|
+
return this._connection.stream('session', 'bytecode', args, requestIdOverride);
|
|
179
|
+
}
|
|
180
|
+
return this._connection.stream('traversal', 'bytecode', args, requestIdOverride);
|
|
134
181
|
} else if (typeof message === 'string') {
|
|
135
182
|
args['bindings'] = bindings;
|
|
136
183
|
args['language'] = 'gremlin-groovy';
|
|
137
184
|
args['accept'] = this._connection.mimeType;
|
|
138
|
-
return this._connection.
|
|
139
|
-
} else {
|
|
140
|
-
throw new TypeError("message must be of type Bytecode or string");
|
|
185
|
+
return this._connection.stream(this._options.processor || '', 'eval', args, requestIdOverride);
|
|
141
186
|
}
|
|
187
|
+
throw new TypeError('message must be of type Bytecode or string');
|
|
142
188
|
}
|
|
143
189
|
|
|
144
190
|
/**
|
|
@@ -147,6 +193,10 @@ class Client {
|
|
|
147
193
|
* @returns {Promise}
|
|
148
194
|
*/
|
|
149
195
|
close() {
|
|
196
|
+
if (this._options.session && this._options.processor === 'session') {
|
|
197
|
+
const args = { session: this._options.session };
|
|
198
|
+
return this._connection.submit(this._options.processor, 'close', args, null).then(() => this._connection.close());
|
|
199
|
+
}
|
|
150
200
|
return this._connection.close();
|
|
151
201
|
}
|
|
152
202
|
|
|
@@ -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="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>
|
|
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="module.exports.html">exports</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#DataType">DataType</a></li><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.
|
|
239
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 15:51:52 GMT-0400 (Eastern Daylight Time)
|
|
190
240
|
</footer>
|
|
191
241
|
|
|
192
242
|
<script> prettyPrint(); </script>
|
|
@@ -51,23 +51,25 @@
|
|
|
51
51
|
'use strict';
|
|
52
52
|
|
|
53
53
|
const EventEmitter = require('events');
|
|
54
|
+
const Stream = require('stream');
|
|
54
55
|
const WebSocket = require('ws');
|
|
55
56
|
const util = require('util');
|
|
56
57
|
const utils = require('../utils');
|
|
57
58
|
const serializer = require('../structure/io/graph-serializer');
|
|
59
|
+
const { graphBinaryReader, graphBinaryWriter } = require('../structure/io/binary/GraphBinary');
|
|
58
60
|
const ResultSet = require('./result-set');
|
|
59
61
|
const ResponseError = require('./response-error');
|
|
60
|
-
const Bytecode = require('../process/bytecode');
|
|
61
62
|
|
|
62
63
|
const responseStatusCode = {
|
|
63
64
|
success: 200,
|
|
64
65
|
noContent: 204,
|
|
65
66
|
partialContent: 206,
|
|
66
|
-
authenticationChallenge:
|
|
67
|
+
authenticationChallenge: 407,
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
|
|
70
71
|
const graphSON2MimeType = 'application/vnd.gremlin-v2.0+json';
|
|
72
|
+
const graphBinaryMimeType = 'application/vnd.graphbinary-v1.0';
|
|
71
73
|
|
|
72
74
|
const pingIntervalDelay = 60 * 1000;
|
|
73
75
|
const pongTimeoutDelay = 30 * 1000;
|
|
@@ -76,7 +78,6 @@ const pongTimeoutDelay = 30 * 1000;
|
|
|
76
78
|
* Represents a single connection to a Gremlin Server.
|
|
77
79
|
*/
|
|
78
80
|
class Connection extends EventEmitter {
|
|
79
|
-
|
|
80
81
|
/**
|
|
81
82
|
* Creates a new instance of {@link Connection}.
|
|
82
83
|
* @param {String} url The resource uri.
|
|
@@ -94,7 +95,7 @@ class Connection extends EventEmitter {
|
|
|
94
95
|
* @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
|
|
95
96
|
* @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
|
|
96
97
|
* @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
|
|
97
|
-
* @param {Boolean} [options.connectOnStartup] Open websocket on startup.
|
|
98
|
+
* @param {Boolean} [options.connectOnStartup] Deprecated and non-functional. Open websocket on startup.
|
|
98
99
|
* @constructor
|
|
99
100
|
*/
|
|
100
101
|
constructor(url, options) {
|
|
@@ -120,7 +121,8 @@ class Connection extends EventEmitter {
|
|
|
120
121
|
this._pingInterval = null;
|
|
121
122
|
this._pongTimeout = null;
|
|
122
123
|
|
|
123
|
-
this._header = String.fromCharCode(this.mimeType.length) + this.mimeType;
|
|
124
|
+
this._header = String.fromCharCode(this.mimeType.length) + this.mimeType; // TODO: what if mimeType.length > 255
|
|
125
|
+
this._header_buf = Buffer.from(this._header);
|
|
124
126
|
this.isOpen = false;
|
|
125
127
|
this.traversalSource = options.traversalSource || 'g';
|
|
126
128
|
this._authenticator = options.authenticator;
|
|
@@ -129,8 +131,10 @@ class Connection extends EventEmitter {
|
|
|
129
131
|
this._pingIntervalDelay = this.options.pingInterval || pingIntervalDelay;
|
|
130
132
|
this._pongTimeoutDelay = this.options.pongTimeout || pongTimeoutDelay;
|
|
131
133
|
|
|
132
|
-
if (this.options.connectOnStartup
|
|
133
|
-
|
|
134
|
+
if (this.options.connectOnStartup) {
|
|
135
|
+
console.warn(
|
|
136
|
+
'connectOnStartup is now deprecated and non-functional. To open a connection, please call open() after instantiating connection object.',
|
|
137
|
+
);
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -146,14 +150,14 @@ class Connection extends EventEmitter {
|
|
|
146
150
|
return this._openPromise;
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
this.emit('log',
|
|
153
|
+
this.emit('log', 'ws open');
|
|
150
154
|
|
|
151
155
|
this._ws = new WebSocket(this.url, {
|
|
152
156
|
headers: this.options.headers,
|
|
153
157
|
ca: this.options.ca,
|
|
154
158
|
cert: this.options.cert,
|
|
155
159
|
pfx: this.options.pfx,
|
|
156
|
-
rejectUnauthorized: this.options.rejectUnauthorized
|
|
160
|
+
rejectUnauthorized: this.options.rejectUnauthorized,
|
|
157
161
|
});
|
|
158
162
|
|
|
159
163
|
this._ws.on('message', (data) => this._handleMessage(data));
|
|
@@ -171,7 +175,7 @@ class Connection extends EventEmitter {
|
|
|
171
175
|
this._ws.pong();
|
|
172
176
|
});
|
|
173
177
|
|
|
174
|
-
return this._openPromise = new Promise((resolve, reject) => {
|
|
178
|
+
return (this._openPromise = new Promise((resolve, reject) => {
|
|
175
179
|
this._ws.on('open', () => {
|
|
176
180
|
this.isOpen = true;
|
|
177
181
|
if (this._pingEnabled) {
|
|
@@ -183,59 +187,87 @@ class Connection extends EventEmitter {
|
|
|
183
187
|
this._handleError(err);
|
|
184
188
|
reject(err);
|
|
185
189
|
});
|
|
186
|
-
});
|
|
190
|
+
}));
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
/** @override */
|
|
190
194
|
submit(processor, op, args, requestId) {
|
|
191
195
|
const rid = requestId || utils.getUuid();
|
|
192
|
-
return this.open().then(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
return this.open().then(
|
|
197
|
+
() =>
|
|
198
|
+
new Promise((resolve, reject) => {
|
|
199
|
+
if (op !== 'authentication') {
|
|
200
|
+
this._responseHandlers[rid] = {
|
|
201
|
+
callback: (err, result) => (err ? reject(err) : resolve(result)),
|
|
202
|
+
result: null,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const request = {
|
|
207
|
+
requestId: rid,
|
|
208
|
+
op: op || 'bytecode',
|
|
209
|
+
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
210
|
+
processor: !processor && op !== 'eval' ? 'traversal' : processor,
|
|
211
|
+
args: args || {},
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const request_buf = this._writer.writeRequest(request);
|
|
215
|
+
const message = Buffer.concat([this._header_buf, request_buf]);
|
|
216
|
+
this._ws.send(message);
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** @override */
|
|
222
|
+
stream(processor, op, args, requestId) {
|
|
223
|
+
const rid = requestId || utils.getUuid();
|
|
224
|
+
|
|
225
|
+
const readableStream = new Stream.Readable({
|
|
226
|
+
objectMode: true,
|
|
227
|
+
read() {},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
this._responseHandlers[rid] = {
|
|
231
|
+
callback: (err) => (err ? readableStream.destroy(err) : readableStream.push(null)),
|
|
232
|
+
result: readableStream,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
this.open()
|
|
236
|
+
.then(() => {
|
|
237
|
+
const request = {
|
|
238
|
+
requestId: rid,
|
|
239
|
+
op: op || 'bytecode',
|
|
240
|
+
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
241
|
+
processor: !processor && op !== 'eval' ? 'traversal' : processor,
|
|
242
|
+
args: args || {},
|
|
197
243
|
};
|
|
198
|
-
}
|
|
199
244
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
245
|
+
const request_buf = this._writer.writeRequest(request);
|
|
246
|
+
const message = Buffer.concat([this._header_buf, request_buf]);
|
|
247
|
+
this._ws.send(message);
|
|
248
|
+
})
|
|
249
|
+
.catch((err) => readableStream.destroy(err));
|
|
250
|
+
|
|
251
|
+
return readableStream;
|
|
203
252
|
}
|
|
204
253
|
|
|
205
254
|
_getDefaultReader(mimeType) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
255
|
+
if (mimeType === graphBinaryMimeType) {
|
|
256
|
+
return graphBinaryReader;
|
|
257
|
+
}
|
|
210
258
|
|
|
211
|
-
|
|
212
|
-
return mimeType === graphSON2MimeType
|
|
213
|
-
? new serializer.GraphSON2Writer()
|
|
214
|
-
: new serializer.GraphSONWriter();
|
|
259
|
+
return mimeType === graphSON2MimeType ? new serializer.GraphSON2Reader() : new serializer.GraphSONReader();
|
|
215
260
|
}
|
|
216
261
|
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
} else {
|
|
221
|
-
args = {};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (args['gremlin'] instanceof Bytecode) {
|
|
225
|
-
args['gremlin'] = this._writer.adaptObject(args['gremlin']);
|
|
262
|
+
_getDefaultWriter(mimeType) {
|
|
263
|
+
if (mimeType === graphBinaryMimeType) {
|
|
264
|
+
return graphBinaryWriter;
|
|
226
265
|
}
|
|
227
266
|
|
|
228
|
-
return (
|
|
229
|
-
'requestId': { '@type': 'g:UUID', '@value': id },
|
|
230
|
-
'op': op || 'bytecode',
|
|
231
|
-
// if using op eval need to ensure processor stays unset if caller didn't set it.
|
|
232
|
-
'processor': (!processor && op !== 'eval') ? 'traversal' : processor,
|
|
233
|
-
'args': args
|
|
234
|
-
});
|
|
267
|
+
return mimeType === graphSON2MimeType ? new serializer.GraphSON2Writer() : new serializer.GraphSONWriter();
|
|
235
268
|
}
|
|
236
269
|
|
|
237
270
|
_pingHeartbeat() {
|
|
238
|
-
|
|
239
271
|
if (this._pingInterval) {
|
|
240
272
|
clearInterval(this._pingInterval);
|
|
241
273
|
this._pingInterval = null;
|
|
@@ -255,13 +287,12 @@ class Connection extends EventEmitter {
|
|
|
255
287
|
}, this._pongTimeoutDelay);
|
|
256
288
|
|
|
257
289
|
this._ws.ping();
|
|
258
|
-
|
|
259
290
|
}, this._pingIntervalDelay);
|
|
260
291
|
}
|
|
261
292
|
|
|
262
293
|
_handleError(err) {
|
|
263
294
|
this.emit('log', `ws error ${err}`);
|
|
264
|
-
this._cleanupWebsocket();
|
|
295
|
+
this._cleanupWebsocket(err);
|
|
265
296
|
this.emit('socketError', err);
|
|
266
297
|
}
|
|
267
298
|
|
|
@@ -275,22 +306,30 @@ class Connection extends EventEmitter {
|
|
|
275
306
|
}
|
|
276
307
|
|
|
277
308
|
_handleMessage(data) {
|
|
278
|
-
const response = this._reader.
|
|
309
|
+
const response = this._reader.readResponse(data);
|
|
279
310
|
if (response.requestId === null || response.requestId === undefined) {
|
|
280
311
|
// There was a serialization issue on the server that prevented the parsing of the request id
|
|
281
312
|
// We invoke any of the pending handlers with an error
|
|
282
|
-
Object.keys(this._responseHandlers).forEach(requestId => {
|
|
313
|
+
Object.keys(this._responseHandlers).forEach((requestId) => {
|
|
283
314
|
const handler = this._responseHandlers[requestId];
|
|
284
315
|
this._clearHandler(requestId);
|
|
285
316
|
if (response.status !== undefined && response.status.message) {
|
|
286
317
|
return handler.callback(
|
|
287
318
|
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
288
|
-
new ResponseError(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
319
|
+
new ResponseError(
|
|
320
|
+
util.format(
|
|
321
|
+
'Server error (no request information): %s (%d)',
|
|
322
|
+
response.status.message,
|
|
323
|
+
response.status.code,
|
|
324
|
+
),
|
|
325
|
+
response.status,
|
|
326
|
+
),
|
|
327
|
+
);
|
|
293
328
|
}
|
|
329
|
+
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
330
|
+
return handler.callback(
|
|
331
|
+
new ResponseError(util.format('Server error (no request information): %j', response), response.status),
|
|
332
|
+
);
|
|
294
333
|
});
|
|
295
334
|
return;
|
|
296
335
|
}
|
|
@@ -304,31 +343,49 @@ class Connection extends EventEmitter {
|
|
|
304
343
|
}
|
|
305
344
|
|
|
306
345
|
if (response.status.code === responseStatusCode.authenticationChallenge && this._authenticator) {
|
|
307
|
-
this._authenticator
|
|
308
|
-
|
|
309
|
-
|
|
346
|
+
this._authenticator
|
|
347
|
+
.evaluateChallenge(response.result.data)
|
|
348
|
+
.then((res) => this.submit(undefined, 'authentication', res, response.requestId))
|
|
349
|
+
.catch(handler.callback);
|
|
310
350
|
|
|
311
351
|
return;
|
|
312
|
-
}
|
|
313
|
-
else if (response.status.code >= 400) {
|
|
352
|
+
} else if (response.status.code >= 400) {
|
|
314
353
|
// callback in error
|
|
315
354
|
return handler.callback(
|
|
316
355
|
// TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
|
|
317
|
-
new ResponseError(
|
|
356
|
+
new ResponseError(
|
|
357
|
+
util.format('Server error: %s (%d)', response.status.message, response.status.code),
|
|
358
|
+
response.status,
|
|
359
|
+
),
|
|
360
|
+
);
|
|
318
361
|
}
|
|
362
|
+
|
|
363
|
+
const isStreamingResponse = handler.result instanceof Stream.Readable;
|
|
364
|
+
|
|
319
365
|
switch (response.status.code) {
|
|
320
366
|
case responseStatusCode.noContent:
|
|
321
367
|
this._clearHandler(response.requestId);
|
|
368
|
+
if (isStreamingResponse) {
|
|
369
|
+
handler.result.push(new ResultSet(utils.emptyArray, response.status.attributes));
|
|
370
|
+
return handler.callback(null);
|
|
371
|
+
}
|
|
322
372
|
return handler.callback(null, new ResultSet(utils.emptyArray, response.status.attributes));
|
|
323
373
|
case responseStatusCode.partialContent:
|
|
374
|
+
if (isStreamingResponse) {
|
|
375
|
+
handler.result.push(new ResultSet(response.result.data, response.status.attributes));
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
324
378
|
handler.result = handler.result || [];
|
|
325
379
|
handler.result.push.apply(handler.result, response.result.data);
|
|
326
380
|
break;
|
|
327
381
|
default:
|
|
382
|
+
if (isStreamingResponse) {
|
|
383
|
+
handler.result.push(new ResultSet(response.result.data, response.status.attributes));
|
|
384
|
+
return handler.callback(null);
|
|
385
|
+
}
|
|
328
386
|
if (handler.result) {
|
|
329
387
|
handler.result.push.apply(handler.result, response.result.data);
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
388
|
+
} else {
|
|
332
389
|
handler.result = response.result.data;
|
|
333
390
|
}
|
|
334
391
|
this._clearHandler(response.requestId);
|
|
@@ -339,7 +396,7 @@ class Connection extends EventEmitter {
|
|
|
339
396
|
/**
|
|
340
397
|
* clean websocket context
|
|
341
398
|
*/
|
|
342
|
-
_cleanupWebsocket() {
|
|
399
|
+
_cleanupWebsocket(err) {
|
|
343
400
|
if (this._pingInterval) {
|
|
344
401
|
clearInterval(this._pingInterval);
|
|
345
402
|
}
|
|
@@ -349,6 +406,17 @@ class Connection extends EventEmitter {
|
|
|
349
406
|
}
|
|
350
407
|
this._pongTimeout = null;
|
|
351
408
|
|
|
409
|
+
// Invoke waiting callbacks to complete Promises when closing the websocket
|
|
410
|
+
Object.keys(this._responseHandlers).forEach((requestId) => {
|
|
411
|
+
const handler = this._responseHandlers[requestId];
|
|
412
|
+
const isStreamingResponse = handler.result instanceof Stream.Readable;
|
|
413
|
+
if (isStreamingResponse) {
|
|
414
|
+
handler.callback(null);
|
|
415
|
+
} else {
|
|
416
|
+
const cause = err ? err : new Error('Connection has been closed.');
|
|
417
|
+
handler.callback(cause);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
352
420
|
this._ws.removeAllListeners();
|
|
353
421
|
this._openPromise = null;
|
|
354
422
|
this._closePromise = null;
|
|
@@ -364,32 +432,6 @@ class Connection extends EventEmitter {
|
|
|
364
432
|
delete this._responseHandlers[requestId];
|
|
365
433
|
}
|
|
366
434
|
|
|
367
|
-
/**
|
|
368
|
-
* Takes the given args map and ensures all arguments are passed through to _write.adaptObject
|
|
369
|
-
* @param {Object} args Map of arguments to process.
|
|
370
|
-
* @param {Boolean} protocolLevel Determines whether it's a protocol level binding.
|
|
371
|
-
* @returns {Object}
|
|
372
|
-
* @private
|
|
373
|
-
*/
|
|
374
|
-
_adaptArgs(args, protocolLevel) {
|
|
375
|
-
if (args instanceof Object) {
|
|
376
|
-
let newObj = {};
|
|
377
|
-
Object.keys(args).forEach((key) => {
|
|
378
|
-
// bindings key (at the protocol-level needs special handling. without this, it wraps the generated Map
|
|
379
|
-
// in another map for types like EnumValue. Could be a nicer way to do this but for now it's solving the
|
|
380
|
-
// problem with script submission of non JSON native types
|
|
381
|
-
if (protocolLevel && key === 'bindings')
|
|
382
|
-
newObj[key] = this._adaptArgs(args[key], false);
|
|
383
|
-
else
|
|
384
|
-
newObj[key] = this._writer.adaptObject(args[key]);
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
return newObj;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return args;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
435
|
/**
|
|
394
436
|
* Closes the Connection.
|
|
395
437
|
* @return {Promise}
|
|
@@ -399,7 +441,7 @@ class Connection extends EventEmitter {
|
|
|
399
441
|
return Promise.resolve();
|
|
400
442
|
}
|
|
401
443
|
if (!this._closePromise) {
|
|
402
|
-
this._closePromise = new Promise(resolve => {
|
|
444
|
+
this._closePromise = new Promise((resolve) => {
|
|
403
445
|
this._closeCallback = resolve;
|
|
404
446
|
this._ws.close();
|
|
405
447
|
});
|
|
@@ -419,13 +461,13 @@ module.exports = Connection;
|
|
|
419
461
|
</div>
|
|
420
462
|
|
|
421
463
|
<nav>
|
|
422
|
-
<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>
|
|
464
|
+
<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="module.exports.html">exports</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#DataType">DataType</a></li><li><a href="global.html#statics">statics</a></li></ul>
|
|
423
465
|
</nav>
|
|
424
466
|
|
|
425
467
|
<br class="clear">
|
|
426
468
|
|
|
427
469
|
<footer>
|
|
428
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.
|
|
470
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 15:51:52 GMT-0400 (Eastern Daylight Time)
|
|
429
471
|
</footer>
|
|
430
472
|
|
|
431
473
|
<script> prettyPrint(); </script>
|