gremlin 3.6.0 → 3.6.1

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 (107) hide show
  1. package/.eslintrc.js +3 -2
  2. package/doc/AnonymousTraversalSource.html +2 -2
  3. package/doc/Authenticator.html +2 -2
  4. package/doc/Bytecode.html +2 -2
  5. package/doc/Client.html +2 -2
  6. package/doc/Connection.html +10 -10
  7. package/doc/DriverRemoteConnection.html +2 -2
  8. package/doc/EdgeLabelVerificationStrategy.html +2 -2
  9. package/doc/Graph.html +2 -2
  10. package/doc/GraphSON2Reader.html +2 -2
  11. package/doc/GraphSON2Writer.html +2 -2
  12. package/doc/GraphSON3Reader.html +2 -2
  13. package/doc/GraphSON3Writer.html +2 -2
  14. package/doc/GraphTraversal.html +112 -112
  15. package/doc/GraphTraversalSource.html +19 -19
  16. package/doc/HaltedTraverserStrategy.html +2 -2
  17. package/doc/MatchAlgorithmStrategy.html +2 -2
  18. package/doc/P.html +2 -2
  19. package/doc/PartitionStrategy.html +2 -2
  20. package/doc/Path.html +2 -2
  21. package/doc/PlainTextSaslAuthenticator.html +2 -2
  22. package/doc/ProductiveByStrategy.html +2 -2
  23. package/doc/RemoteConnection.html +2 -2
  24. package/doc/RemoteStrategy.html +2 -2
  25. package/doc/RemoteTraversal.html +2 -2
  26. package/doc/ReservedKeysVerificationStrategy.html +2 -2
  27. package/doc/ResponseError.html +2 -2
  28. package/doc/ResultSet.html +2 -2
  29. package/doc/SaslAuthenticator.html +2 -2
  30. package/doc/SaslMechanismBase.html +2 -2
  31. package/doc/SaslMechanismPlain.html +2 -2
  32. package/doc/SeedStrategy.html +2 -2
  33. package/doc/SubgraphStrategy.html +2 -2
  34. package/doc/TextP.html +2 -2
  35. package/doc/Transaction.html +2 -2
  36. package/doc/Translator.html +2 -2
  37. package/doc/TraversalStrategies.html +2 -2
  38. package/doc/TraversalStrategy.html +2 -2
  39. package/doc/TypeSerializer.html +2 -2
  40. package/doc/driver_auth_authenticator.js.html +2 -2
  41. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
  42. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
  43. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
  44. package/doc/driver_auth_sasl-authenticator.js.html +2 -2
  45. package/doc/driver_client.js.html +2 -2
  46. package/doc/driver_connection.js.html +32 -9
  47. package/doc/driver_driver-remote-connection.js.html +2 -2
  48. package/doc/driver_remote-connection.js.html +2 -2
  49. package/doc/driver_response-error.js.html +2 -2
  50. package/doc/driver_result-set.js.html +2 -2
  51. package/doc/global.html +67 -3
  52. package/doc/index.html +2 -2
  53. package/doc/module.exports.html +301 -0
  54. package/doc/process_anonymous-traversal.js.html +2 -2
  55. package/doc/process_bytecode.js.html +2 -2
  56. package/doc/process_graph-traversal.js.html +25 -13
  57. package/doc/process_transaction.js.html +2 -2
  58. package/doc/process_translator.js.html +2 -2
  59. package/doc/process_traversal-strategy.js.html +3 -3
  60. package/doc/process_traversal.js.html +3 -3
  61. package/doc/structure_graph.js.html +2 -2
  62. package/doc/structure_io_binary_internals_DataType.js.html +149 -0
  63. package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +131 -0
  64. package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +134 -0
  65. package/doc/structure_io_graph-serializer.js.html +2 -2
  66. package/doc/structure_io_type-serializers.js.html +2 -2
  67. package/lib/driver/connection.js +30 -7
  68. package/lib/process/graph-traversal.js +23 -11
  69. package/lib/process/traversal-strategy.js +1 -1
  70. package/lib/process/traversal.js +1 -1
  71. package/lib/structure/io/binary/GraphBinary.js +109 -0
  72. package/lib/structure/io/binary/internals/AnySerializer.js +95 -0
  73. package/lib/structure/io/binary/internals/ArraySerializer.js +135 -0
  74. package/lib/structure/io/binary/internals/BigIntegerSerializer.js +151 -0
  75. package/lib/structure/io/binary/internals/BooleanSerializer.js +103 -0
  76. package/lib/structure/io/binary/internals/BulkSetSerializer.js +124 -0
  77. package/lib/structure/io/binary/internals/ByteBufferSerializer.js +124 -0
  78. package/lib/structure/io/binary/internals/ByteSerializer.js +95 -0
  79. package/lib/structure/io/binary/internals/BytecodeSerializer.js +249 -0
  80. package/lib/structure/io/binary/internals/DataType.js +98 -0
  81. package/lib/structure/io/binary/internals/DateSerializer.js +103 -0
  82. package/lib/structure/io/binary/internals/DoubleSerializer.js +99 -0
  83. package/lib/structure/io/binary/internals/EdgeSerializer.js +215 -0
  84. package/lib/structure/io/binary/internals/EnumSerializer.js +149 -0
  85. package/lib/structure/io/binary/internals/FloatSerializer.js +99 -0
  86. package/lib/structure/io/binary/internals/GraphBinaryReader.js +80 -0
  87. package/lib/structure/io/binary/internals/GraphBinaryWriter.js +83 -0
  88. package/lib/structure/io/binary/internals/IntSerializer.js +112 -0
  89. package/lib/structure/io/binary/internals/LambdaSerializer.js +70 -0
  90. package/lib/structure/io/binary/internals/LongSerializer.js +107 -0
  91. package/lib/structure/io/binary/internals/LongSerializerNg.js +102 -0
  92. package/lib/structure/io/binary/internals/MapSerializer.js +153 -0
  93. package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +68 -0
  94. package/lib/structure/io/binary/internals/PSerializer.js +151 -0
  95. package/lib/structure/io/binary/internals/PathSerializer.js +123 -0
  96. package/lib/structure/io/binary/internals/PropertySerializer.js +141 -0
  97. package/lib/structure/io/binary/internals/ShortSerializer.js +99 -0
  98. package/lib/structure/io/binary/internals/StringSerializer.js +114 -0
  99. package/lib/structure/io/binary/internals/TextPSerializer.js +145 -0
  100. package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +72 -0
  101. package/lib/structure/io/binary/internals/TraverserSerializer.js +123 -0
  102. package/lib/structure/io/binary/internals/UnspecifiedNullSerializer.js +75 -0
  103. package/lib/structure/io/binary/internals/UuidSerializer.js +119 -0
  104. package/lib/structure/io/binary/internals/VertexPropertySerializer.js +172 -0
  105. package/lib/structure/io/binary/internals/VertexSerializer.js +135 -0
  106. package/lib/structure/io/binary/internals/utils.js +59 -0
  107. package/package.json +11 -4
@@ -0,0 +1,149 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: structure/io/binary/internals/DataType.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: structure/io/binary/internals/DataType.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+
27
+ <section>
28
+ <article>
29
+ <pre class="prettyprint source linenums"><code>/*
30
+ * Licensed to the Apache Software Foundation (ASF) under one
31
+ * or more contributor license agreements. See the NOTICE file
32
+ * distributed with this work for additional information
33
+ * regarding copyright ownership. The ASF licenses this file
34
+ * to you under the Apache License, Version 2.0 (the
35
+ * "License"); you may not use this file except in compliance
36
+ * with the License. You may obtain a copy of the License at
37
+ *
38
+ * http://www.apache.org/licenses/LICENSE-2.0
39
+ *
40
+ * Unless required by applicable law or agreed to in writing,
41
+ * software distributed under the License is distributed on an
42
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
43
+ * KIND, either express or implied. See the License for the
44
+ * specific language governing permissions and limitations
45
+ * under the License.
46
+ */
47
+
48
+ /**
49
+ * @author Igor Ostapenko
50
+ */
51
+ 'use strict';
52
+
53
+ /**
54
+ * Represents a GraphBinary data type.
55
+ *
56
+ * See org.apache.tinkerpop.gremlin.structure.io.binary.DataType Java class.
57
+ */
58
+ const DataType = {
59
+ INT: 0x01,
60
+ LONG: 0x02,
61
+ STRING: 0x03,
62
+ DATE: 0x04,
63
+ TIMESTAMP: 0x05,
64
+ CLASS: 0x06,
65
+ DOUBLE: 0x07,
66
+ FLOAT: 0x08,
67
+ LIST: 0x09,
68
+ MAP: 0x0a,
69
+ SET: 0x0b,
70
+ UUID: 0x0c,
71
+ EDGE: 0x0d,
72
+ PATH: 0x0e,
73
+ PROPERTY: 0x0f,
74
+ GRAPH: 0x10,
75
+ VERTEX: 0x11,
76
+ VERTEXPROPERTY: 0x12,
77
+ BARRIER: 0x13,
78
+ BINDING: 0x14,
79
+ BYTECODE: 0x15,
80
+ CARDINALITY: 0x16,
81
+ COLUMN: 0x17,
82
+ DIRECTION: 0x18,
83
+ OPERATOR: 0x19,
84
+ ORDER: 0x1a,
85
+ PICK: 0x1b,
86
+ POP: 0x1c,
87
+ LAMBDA: 0x1d,
88
+ P: 0x1e,
89
+ SCOPE: 0x1f,
90
+ T: 0x20,
91
+ TRAVERSER: 0x21,
92
+ BIGDECIMAL: 0x22,
93
+ BIGINTEGER: 0x23,
94
+ BYTE: 0x24,
95
+ BYTEBUFFER: 0x25,
96
+ SHORT: 0x26,
97
+ BOOLEAN: 0x27,
98
+ TEXTP: 0x28,
99
+ TRAVERSALSTRATEGY: 0x29,
100
+ BULKSET: 0x2a,
101
+ TREE: 0x2b,
102
+ METRICS: 0x2c,
103
+ TRAVERSALMETRICS: 0x2d,
104
+ MERGE: 0x2e,
105
+
106
+ CHAR: 0x80,
107
+ DURATION: 0x81,
108
+ INETADDRESS: 0x82,
109
+ INSTANT: 0x83,
110
+ LOCALDATE: 0x84,
111
+ LOCALDATETIME: 0x85,
112
+ LOCALTIME: 0x86,
113
+ MONTHDAY: 0x87,
114
+ OFFSETDATETIME: 0x88,
115
+ OFFSETTIME: 0x89,
116
+ PERIOD: 0x8a,
117
+ YEAR: 0x8b,
118
+ YEARMONTH: 0x8c,
119
+ ZONEDATETIME: 0x8d,
120
+ ZONEOFFSET: 0x8e,
121
+
122
+ CUSTOM: 0,
123
+ UNSPECIFIED_NULL: 0xfe,
124
+ };
125
+
126
+ module.exports = DataType;
127
+ </code></pre>
128
+ </article>
129
+ </section>
130
+
131
+
132
+
133
+
134
+ </div>
135
+
136
+ <nav>
137
+ <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="SeedStrategy.html">SeedStrategy</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>
138
+ </nav>
139
+
140
+ <br class="clear">
141
+
142
+ <footer>
143
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 16:12:54 GMT-0400 (Eastern Daylight Time)
144
+ </footer>
145
+
146
+ <script> prettyPrint(); </script>
147
+ <script src="scripts/linenumber.js"> </script>
148
+ </body>
149
+ </html>
@@ -0,0 +1,131 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: structure/io/binary/internals/GraphBinaryReader.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: structure/io/binary/internals/GraphBinaryReader.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+
27
+ <section>
28
+ <article>
29
+ <pre class="prettyprint source linenums"><code>/*
30
+ * Licensed to the Apache Software Foundation (ASF) under one
31
+ * or more contributor license agreements. See the NOTICE file
32
+ * distributed with this work for additional information
33
+ * regarding copyright ownership. The ASF licenses this file
34
+ * to you under the Apache License, Version 2.0 (the
35
+ * "License"); you may not use this file except in compliance
36
+ * with the License. You may obtain a copy of the License at
37
+ *
38
+ * http://www.apache.org/licenses/LICENSE-2.0
39
+ *
40
+ * Unless required by applicable law or agreed to in writing,
41
+ * software distributed under the License is distributed on an
42
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
43
+ * KIND, either express or implied. See the License for the
44
+ * specific language governing permissions and limitations
45
+ * under the License.
46
+ */
47
+
48
+ /**
49
+ * @author Igor Ostapenko
50
+ */
51
+ 'use strict';
52
+
53
+ /**
54
+ * GraphBinary reader.
55
+ */
56
+ module.exports = class GraphBinaryReader {
57
+ constructor(ioc) {
58
+ this.ioc = ioc;
59
+ }
60
+
61
+ readResponse(buffer) {
62
+ if (buffer === undefined || buffer === null) {
63
+ throw new Error('Buffer is missing.');
64
+ }
65
+ if (!(buffer instanceof Buffer)) {
66
+ throw new Error('Not an instance of Buffer.');
67
+ }
68
+ if (buffer.length &lt; 1) {
69
+ throw new Error('Buffer is empty.');
70
+ }
71
+
72
+ const response = { status: {}, result: {} };
73
+ let cursor = buffer;
74
+ let len;
75
+
76
+ // {version} is a Byte representing the protocol version
77
+ const version = cursor[0];
78
+ if (version !== 0x81) {
79
+ throw new Error(`Unsupported version '${version}'.`);
80
+ }
81
+ cursor = cursor.slice(1); // skip version
82
+
83
+ // {request_id} is a nullable UUID
84
+ ({ v: response.requestId, len } = this.ioc.uuidSerializer.deserialize(cursor, false, true));
85
+ cursor = cursor.slice(len);
86
+
87
+ // {status_code} is an Int
88
+ ({ v: response.status.code, len } = this.ioc.intSerializer.deserialize(cursor, false));
89
+ cursor = cursor.slice(len);
90
+
91
+ // {status_message} is a nullable String
92
+ ({ v: response.status.message, len } = this.ioc.stringSerializer.deserialize(cursor, false, true));
93
+ cursor = cursor.slice(len);
94
+
95
+ // {status_attributes} is a Map
96
+ ({ v: response.status.attributes, len } = this.ioc.mapSerializer.deserialize(cursor, false));
97
+ cursor = cursor.slice(len);
98
+
99
+ // {result_meta} is a Map
100
+ ({ v: response.result.meta, len } = this.ioc.mapSerializer.deserialize(cursor, false));
101
+ cursor = cursor.slice(len);
102
+
103
+ // {result_data} is a fully qualified typed value composed of {type_code}{type_info}{value_flag}{value}
104
+ ({ v: response.result.data } = this.ioc.anySerializer.deserialize(cursor));
105
+
106
+ return response;
107
+ }
108
+ };
109
+ </code></pre>
110
+ </article>
111
+ </section>
112
+
113
+
114
+
115
+
116
+ </div>
117
+
118
+ <nav>
119
+ <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="SeedStrategy.html">SeedStrategy</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>
120
+ </nav>
121
+
122
+ <br class="clear">
123
+
124
+ <footer>
125
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 16:12:54 GMT-0400 (Eastern Daylight Time)
126
+ </footer>
127
+
128
+ <script> prettyPrint(); </script>
129
+ <script src="scripts/linenumber.js"> </script>
130
+ </body>
131
+ </html>
@@ -0,0 +1,134 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: structure/io/binary/internals/GraphBinaryWriter.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: structure/io/binary/internals/GraphBinaryWriter.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+
27
+ <section>
28
+ <article>
29
+ <pre class="prettyprint source linenums"><code>/*
30
+ * Licensed to the Apache Software Foundation (ASF) under one
31
+ * or more contributor license agreements. See the NOTICE file
32
+ * distributed with this work for additional information
33
+ * regarding copyright ownership. The ASF licenses this file
34
+ * to you under the Apache License, Version 2.0 (the
35
+ * "License"); you may not use this file except in compliance
36
+ * with the License. You may obtain a copy of the License at
37
+ *
38
+ * http://www.apache.org/licenses/LICENSE-2.0
39
+ *
40
+ * Unless required by applicable law or agreed to in writing,
41
+ * software distributed under the License is distributed on an
42
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
43
+ * KIND, either express or implied. See the License for the
44
+ * specific language governing permissions and limitations
45
+ * under the License.
46
+ */
47
+
48
+ /**
49
+ * @author Igor Ostapenko
50
+ */
51
+ 'use strict';
52
+
53
+ /**
54
+ * GraphBinary writer.
55
+ */
56
+ module.exports = class GraphBinaryWriter {
57
+ constructor(ioc) {
58
+ this.ioc = ioc;
59
+ }
60
+
61
+ writeRequest({ requestId, op, processor, args }) {
62
+ const bufs = [
63
+ // {version} 1 byte
64
+ Buffer.from([0x81]),
65
+ // {request_id} UUID
66
+ this.ioc.uuidSerializer.serialize(requestId, false),
67
+ // {op} String
68
+ this.ioc.stringSerializer.serialize(op, false),
69
+ // {processor} String
70
+ this.ioc.stringSerializer.serialize(processor, false),
71
+ // {args} Map
72
+ this.ioc.mapSerializer.serialize(args, false),
73
+ ];
74
+ return Buffer.concat(bufs);
75
+
76
+ /*// Detailed example for a quick reference:
77
+ // {version}
78
+ 0x81,
79
+ // {request_id} UUID
80
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
81
+ // {op} String
82
+ 0x00,0x00,0x00,0x08, ...Buffer.from('bytecode'),
83
+ // {processor} String
84
+ 0x00,0x00,0x00,0x09, ...Buffer.from('traversal'),
85
+ // {args} Map
86
+ 0x00,0x00,0x00,0x02,
87
+ // 1.
88
+ // args.aliases key String
89
+ 0x03,0x00, 0x00,0x00,0x00,0x07, ...Buffer.from('aliases'),
90
+ // args.aliases value Map
91
+ 0x0A,0x00, 0x00,0x00,0x00,0x01,
92
+ // aliases.g key String
93
+ 0x03,0x00, 0x00,0x00,0x00,0x01, ...Buffer.from('g'),
94
+ // aliases.g value String
95
+ 0x03,0x00, 0x00,0x00,0x00,0x01, ...Buffer.from('g'),
96
+ // 2.
97
+ // args.gremlin key String
98
+ 0x03,0x00, 0x00,0x00,0x00,0x07, ...Buffer.from('gremlin'),
99
+ // args.gremlin value Bytecode
100
+ 0x15,0x00,
101
+ // {steps_length}
102
+ 0x00,0x00,0x00,0x01,
103
+ // step 1 - {name} String
104
+ 0x00,0x00,0x00,0x01, ...Buffer.from('V'),
105
+ // step 1 - {values_length} Int
106
+ 0x00,0x00,0x00,0x00,
107
+ // {sources_length}
108
+ 0x00,0x00,0x00,0x00,
109
+ */
110
+ }
111
+ };
112
+ </code></pre>
113
+ </article>
114
+ </section>
115
+
116
+
117
+
118
+
119
+ </div>
120
+
121
+ <nav>
122
+ <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="SeedStrategy.html">SeedStrategy</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>
123
+ </nav>
124
+
125
+ <br class="clear">
126
+
127
+ <footer>
128
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 16:12:54 GMT-0400 (Eastern Daylight Time)
129
+ </footer>
130
+
131
+ <script> prettyPrint(); </script>
132
+ <script src="scripts/linenumber.js"> </script>
133
+ </body>
134
+ </html>
@@ -336,13 +336,13 @@ module.exports = {
336
336
  </div>
337
337
 
338
338
  <nav>
339
- <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="SeedStrategy.html">SeedStrategy</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>
339
+ <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="SeedStrategy.html">SeedStrategy</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>
340
340
  </nav>
341
341
 
342
342
  <br class="clear">
343
343
 
344
344
  <footer>
345
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:53:52 GMT-0400 (Eastern Daylight Time)
345
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 16:12:54 GMT-0400 (Eastern Daylight Time)
346
346
  </footer>
347
347
 
348
348
  <script> prettyPrint(); </script>
@@ -540,13 +540,13 @@ module.exports = {
540
540
  </div>
541
541
 
542
542
  <nav>
543
- <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="SeedStrategy.html">SeedStrategy</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>
543
+ <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="SeedStrategy.html">SeedStrategy</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>
544
544
  </nav>
545
545
 
546
546
  <br class="clear">
547
547
 
548
548
  <footer>
549
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 11 2022 07:53:52 GMT-0400 (Eastern Daylight Time)
549
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Jul 26 2022 16:12:54 GMT-0400 (Eastern Daylight Time)
550
550
  </footer>
551
551
 
552
552
  <script> prettyPrint(); </script>
@@ -28,6 +28,7 @@ const WebSocket = require('ws');
28
28
  const util = require('util');
29
29
  const utils = require('../utils');
30
30
  const serializer = require('../structure/io/graph-serializer');
31
+ const { graphBinaryReader, graphBinaryWriter } = require('../structure/io/binary/GraphBinary');
31
32
  const ResultSet = require('./result-set');
32
33
  const ResponseError = require('./response-error');
33
34
 
@@ -40,6 +41,7 @@ const responseStatusCode = {
40
41
 
41
42
  const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
42
43
  const graphSON2MimeType = 'application/vnd.gremlin-v2.0+json';
44
+ const graphBinaryMimeType = 'application/vnd.graphbinary-v1.0';
43
45
 
44
46
  const pingIntervalDelay = 60 * 1000;
45
47
  const pongTimeoutDelay = 30 * 1000;
@@ -65,7 +67,7 @@ class Connection extends EventEmitter {
65
67
  * @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
66
68
  * @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
67
69
  * @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
68
- * @param {Boolean} [options.connectOnStartup] Open websocket on startup. Defaults to: true.
70
+ * @param {Boolean} [options.connectOnStartup] Deprecated and non-functional. Open websocket on startup.
69
71
  * @constructor
70
72
  */
71
73
  constructor(url, options) {
@@ -101,8 +103,10 @@ class Connection extends EventEmitter {
101
103
  this._pingIntervalDelay = this.options.pingInterval || pingIntervalDelay;
102
104
  this._pongTimeoutDelay = this.options.pongTimeout || pongTimeoutDelay;
103
105
 
104
- if (this.options.connectOnStartup !== false) {
105
- this.open();
106
+ if (this.options.connectOnStartup) {
107
+ console.warn(
108
+ 'connectOnStartup is now deprecated and non-functional. To open a connection, please call open() after instantiating connection object.',
109
+ );
106
110
  }
107
111
  }
108
112
 
@@ -180,7 +184,7 @@ class Connection extends EventEmitter {
180
184
  };
181
185
 
182
186
  const request_buf = this._writer.writeRequest(request);
183
- const message = Buffer.concat([this._header_buf, request_buf], this._header_buf.length + request_buf.length);
187
+ const message = Buffer.concat([this._header_buf, request_buf]);
184
188
  this._ws.send(message);
185
189
  }),
186
190
  );
@@ -211,7 +215,7 @@ class Connection extends EventEmitter {
211
215
  };
212
216
 
213
217
  const request_buf = this._writer.writeRequest(request);
214
- const message = Buffer.concat([this._header_buf, request_buf], this._header_buf.length + request_buf.length);
218
+ const message = Buffer.concat([this._header_buf, request_buf]);
215
219
  this._ws.send(message);
216
220
  })
217
221
  .catch((err) => readableStream.destroy(err));
@@ -220,10 +224,18 @@ class Connection extends EventEmitter {
220
224
  }
221
225
 
222
226
  _getDefaultReader(mimeType) {
227
+ if (mimeType === graphBinaryMimeType) {
228
+ return graphBinaryReader;
229
+ }
230
+
223
231
  return mimeType === graphSON2MimeType ? new serializer.GraphSON2Reader() : new serializer.GraphSONReader();
224
232
  }
225
233
 
226
234
  _getDefaultWriter(mimeType) {
235
+ if (mimeType === graphBinaryMimeType) {
236
+ return graphBinaryWriter;
237
+ }
238
+
227
239
  return mimeType === graphSON2MimeType ? new serializer.GraphSON2Writer() : new serializer.GraphSONWriter();
228
240
  }
229
241
 
@@ -252,7 +264,7 @@ class Connection extends EventEmitter {
252
264
 
253
265
  _handleError(err) {
254
266
  this.emit('log', `ws error ${err}`);
255
- this._cleanupWebsocket();
267
+ this._cleanupWebsocket(err);
256
268
  this.emit('socketError', err);
257
269
  }
258
270
 
@@ -356,7 +368,7 @@ class Connection extends EventEmitter {
356
368
  /**
357
369
  * clean websocket context
358
370
  */
359
- _cleanupWebsocket() {
371
+ _cleanupWebsocket(err) {
360
372
  if (this._pingInterval) {
361
373
  clearInterval(this._pingInterval);
362
374
  }
@@ -366,6 +378,17 @@ class Connection extends EventEmitter {
366
378
  }
367
379
  this._pongTimeout = null;
368
380
 
381
+ // Invoke waiting callbacks to complete Promises when closing the websocket
382
+ Object.keys(this._responseHandlers).forEach((requestId) => {
383
+ const handler = this._responseHandlers[requestId];
384
+ const isStreamingResponse = handler.result instanceof Stream.Readable;
385
+ if (isStreamingResponse) {
386
+ handler.callback(null);
387
+ } else {
388
+ const cause = err ? err : new Error('Connection has been closed.');
389
+ handler.callback(cause);
390
+ }
391
+ });
369
392
  this._ws.removeAllListeners();
370
393
  this._openPromise = null;
371
394
  this._closePromise = null;
@@ -94,17 +94,29 @@ class GraphTraversalSource {
94
94
  * @returns {GraphTraversalSource}
95
95
  */
96
96
  withComputer(graphComputer, workers, result, persist, vertices, edges, configuration) {
97
- return this.withStrategies(
98
- new VertexProgramStrategy({
99
- graphComputer: graphComputer,
100
- workers: workers,
101
- result: result,
102
- persist: persist,
103
- vertices: vertices,
104
- edges: edges,
105
- configuration: configuration,
106
- }),
107
- );
97
+ const m = {};
98
+ if (graphComputer !== undefined) {
99
+ m.graphComputer = graphComputer;
100
+ }
101
+ if (workers !== undefined) {
102
+ m.workers = workers;
103
+ }
104
+ if (result !== undefined) {
105
+ m.result = result;
106
+ }
107
+ if (persist !== undefined) {
108
+ m.graphComputer = persist;
109
+ }
110
+ if (vertices !== undefined) {
111
+ m.vertices = vertices;
112
+ }
113
+ if (edges !== undefined) {
114
+ m.edges = edges;
115
+ }
116
+ if (configuration !== undefined) {
117
+ m.configuration = configuration;
118
+ }
119
+ return this.withStrategies(new VertexProgramStrategy(m));
108
120
  }
109
121
 
110
122
  /**
@@ -295,7 +295,7 @@ class ReservedKeysVerificationStrategy extends TraversalStrategy {
295
295
  * @param {Array<String>} keys the list of reserved keys to verify
296
296
  */
297
297
  constructor(logWarnings = false, throwException = false, keys = ['id', 'label']) {
298
- super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.EdgeLabelVerificationStrategy', {
298
+ super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy', {
299
299
  logWarnings: logWarnings,
300
300
  throwException: throwException,
301
301
  keys: keys,