gremlin 3.7.2 → 3.7.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.
Files changed (81) hide show
  1. package/NOTICE +1 -1
  2. package/doc/AnonymousTraversalSource.html +1 -1
  3. package/doc/Authenticator.html +1 -1
  4. package/doc/Bytecode.html +1 -1
  5. package/doc/CardinalityValue.html +1 -1
  6. package/doc/Client.html +41 -8
  7. package/doc/Connection.html +39 -6
  8. package/doc/DriverRemoteConnection.html +44 -11
  9. package/doc/EdgeLabelVerificationStrategy.html +1 -1
  10. package/doc/Graph.html +1 -1
  11. package/doc/GraphSON2Reader.html +1 -1
  12. package/doc/GraphSON2Writer.html +1 -1
  13. package/doc/GraphSON3Reader.html +1 -1
  14. package/doc/GraphSON3Writer.html +1 -1
  15. package/doc/GraphTraversal.html +1 -1
  16. package/doc/GraphTraversalSource.html +1 -1
  17. package/doc/HaltedTraverserStrategy.html +1 -1
  18. package/doc/MatchAlgorithmStrategy.html +1 -1
  19. package/doc/P.html +1 -1
  20. package/doc/PartitionStrategy.html +1 -1
  21. package/doc/Path.html +1 -1
  22. package/doc/PlainTextSaslAuthenticator.html +1 -1
  23. package/doc/ProductiveByStrategy.html +1 -1
  24. package/doc/RemoteConnection.html +1 -1
  25. package/doc/RemoteStrategy.html +1 -1
  26. package/doc/RemoteTraversal.html +1 -1
  27. package/doc/ReservedKeysVerificationStrategy.html +1 -1
  28. package/doc/ResponseError.html +1 -1
  29. package/doc/ResultSet.html +1 -1
  30. package/doc/SaslAuthenticator.html +1 -1
  31. package/doc/SaslMechanismBase.html +1 -1
  32. package/doc/SaslMechanismPlain.html +1 -1
  33. package/doc/SeedStrategy.html +1 -1
  34. package/doc/SubgraphStrategy.html +1 -1
  35. package/doc/TextP.html +1 -1
  36. package/doc/Transaction.html +1 -1
  37. package/doc/Translator.html +1 -1
  38. package/doc/TraversalStrategies.html +1 -1
  39. package/doc/TraversalStrategy.html +1 -1
  40. package/doc/TypeSerializer.html +1 -1
  41. package/doc/driver_auth_authenticator.js.html +1 -1
  42. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +1 -1
  43. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +1 -1
  44. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +1 -1
  45. package/doc/driver_auth_sasl-authenticator.js.html +1 -1
  46. package/doc/driver_client.js.html +2 -1
  47. package/doc/driver_connection.js.html +51 -4
  48. package/doc/driver_driver-remote-connection.js.html +2 -1
  49. package/doc/driver_remote-connection.js.html +1 -1
  50. package/doc/driver_response-error.js.html +1 -1
  51. package/doc/driver_result-set.js.html +1 -1
  52. package/doc/global.html +2 -2
  53. package/doc/index.html +1 -1
  54. package/doc/module.exports.html +1 -1
  55. package/doc/process_anonymous-traversal.js.html +1 -1
  56. package/doc/process_bytecode.js.html +1 -1
  57. package/doc/process_graph-traversal.js.html +3 -1
  58. package/doc/process_transaction.js.html +1 -1
  59. package/doc/process_translator.js.html +5 -5
  60. package/doc/process_traversal-strategy.js.html +1 -1
  61. package/doc/process_traversal.js.html +1 -1
  62. package/doc/structure_graph.js.html +1 -1
  63. package/doc/structure_io_binary_internals_DataType.js.html +1 -1
  64. package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +1 -1
  65. package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +1 -1
  66. package/doc/structure_io_graph-serializer.js.html +1 -1
  67. package/doc/structure_io_type-serializers.js.html +1 -1
  68. package/doc/utils.js.html +2 -2
  69. package/docker-compose.yml +1 -3
  70. package/lib/driver/client.js +1 -0
  71. package/lib/driver/connection.js +50 -3
  72. package/lib/driver/driver-remote-connection.js +1 -0
  73. package/lib/process/graph-traversal.js +2 -0
  74. package/lib/process/translator.js +4 -4
  75. package/lib/structure/io/binary/internals/VertexPropertySerializer.js +4 -1
  76. package/lib/structure/io/binary/internals/VertexSerializer.js +4 -1
  77. package/lib/utils.js +1 -1
  78. package/package.json +5 -5
  79. package/doc/DataType.js.html +0 -149
  80. package/doc/GraphBinaryReader.js.html +0 -132
  81. package/doc/GraphBinaryWriter.js.html +0 -135
@@ -65,6 +65,7 @@ class Connection extends EventEmitter {
65
65
  * @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
66
66
  * @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
67
67
  * @param {http.Agent} [options.agent] The http.Agent implementation to use.
68
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
68
69
  * @constructor
69
70
  */
70
71
  constructor(url, options) {
@@ -94,6 +95,7 @@ class Connection extends EventEmitter {
94
95
  this.traversalSource = options.traversalSource || 'g';
95
96
  this._authenticator = options.authenticator;
96
97
  this._enableUserAgentOnConnect = options.enableUserAgentOnConnect !== false;
98
+ this._enableCompression = this.options.enableCompression || false;
97
99
  }
98
100
 
99
101
  /**
@@ -122,12 +124,27 @@ class Connection extends EventEmitter {
122
124
  headers[utils.getUserAgentHeader()] = await utils.getUserAgent();
123
125
  }
124
126
  }
125
-
126
- const WebSocket = globalThis.WebSocket ?? (await import('ws')).default;
127
+ // All these options are available to the `ws` package's constructor, but not the global WebSocket class
128
+ const wsSpecificOptions = new Set([
129
+ 'headers',
130
+ 'ca',
131
+ 'cert',
132
+ 'pfx',
133
+ 'rejectUnauthorized',
134
+ 'agent',
135
+ 'perMessageDeflate',
136
+ ]);
137
+ // Check if any `ws` specific options are provided and are non-null / non-undefined
138
+ const hasWsSpecificOptions = Object.entries(this.options).some(
139
+ ([key, value]) => wsSpecificOptions.has(key) && ![null, undefined].includes(value),
140
+ );
141
+ // Only use the global websocket if we don't have any unsupported options
142
+ const useGlobalWebSocket = !hasWsSpecificOptions && globalThis.WebSocket;
143
+ const WebSocket = useGlobalWebSocket || (await import('ws')).default;
127
144
 
128
145
  this._ws = new WebSocket(
129
146
  this.url,
130
- globalThis.WebSocket === undefined
147
+ !useGlobalWebSocket
131
148
  ? {
132
149
  headers: headers,
133
150
  ca: this.options.ca,
@@ -135,6 +152,7 @@ class Connection extends EventEmitter {
135
152
  pfx: this.options.pfx,
136
153
  rejectUnauthorized: this.options.rejectUnauthorized,
137
154
  agent: this.options.agent,
155
+ perMessageDeflate: this._enableCompression,
138
156
  }
139
157
  : undefined,
140
158
  );
@@ -145,6 +163,7 @@ class Connection extends EventEmitter {
145
163
 
146
164
  this._ws.addEventListener('open', this.#handleOpen);
147
165
  this._ws.addEventListener('error', this.#handleError);
166
+ this._ws.on('unexpected-response', this.#handleUnexpectedResponse);
148
167
  this._ws.addEventListener('message', this.#handleMessage);
149
168
  this._ws.addEventListener('close', this.#handleClose);
150
169
 
@@ -242,6 +261,32 @@ class Connection extends EventEmitter {
242
261
  this.isOpen = true;
243
262
  };
244
263
 
264
+ /**
265
+ * @param {ClientRequest} _req
266
+ * @param {IncomingMessage} res
267
+ */
268
+ #handleUnexpectedResponse = async (_req, res) => {
269
+ const body = await new Promise((resolve, reject) => {
270
+ const chunks = [];
271
+ res.on('data', (data) => {
272
+ chunks.push(data instanceof Buffer ? data : Buffer.from(data));
273
+ });
274
+ res.on('end', () => {
275
+ resolve(chunks.length ? Buffer.concat(chunks) : null);
276
+ });
277
+ res.on('error', reject);
278
+ });
279
+ const statusCodeErrorMessage = `Unexpected server response code ${res.statusCode}`;
280
+ const errorMessage = body ? `${statusCodeErrorMessage} with body:\n${body.toString()}` : statusCodeErrorMessage;
281
+ const error = new Error(errorMessage);
282
+ this.#handleError({
283
+ error,
284
+ message: errorMessage,
285
+ type: 'unexpected-response',
286
+ target: this._ws,
287
+ });
288
+ };
289
+
245
290
  /**
246
291
  * @param {Event} event
247
292
  */
@@ -312,6 +357,7 @@ class Connection extends EventEmitter {
312
357
 
313
358
  return;
314
359
  } else if (response.status.code >= 400) {
360
+ this.#clearHandler(response.requestId);
315
361
  // callback in error
316
362
  return handler.callback(
317
363
  // TINKERPOP-2285: keep the old server error message in case folks are parsing that - fix in a future breaking version
@@ -369,6 +415,7 @@ class Connection extends EventEmitter {
369
415
  });
370
416
  this._ws.removeEventListener('open', this.#handleOpen);
371
417
  this._ws.removeEventListener('error', this.#handleError);
418
+ this._ws.off('unexpected-response', this.#handleUnexpectedResponse);
372
419
  this._ws.removeEventListener('message', this.#handleMessage);
373
420
  this._ws.removeEventListener('close', this.#handleClose);
374
421
  this._openPromise = null;
@@ -50,6 +50,7 @@ class DriverRemoteConnection extends RemoteConnection {
50
50
  * @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
51
51
  * @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
52
52
  * @param {http.Agent} [options.agent] The http.Agent implementation to use.
53
+ * @param {Boolean} [options.enableCompression] Enable per-message deflate compression. Defaults to: false.
53
54
  * @constructor
54
55
  */
55
56
  constructor(url, options = {}) {
@@ -1780,6 +1780,7 @@ const statics = {
1780
1780
  dateAdd: (...args) => callOnEmptyTraversal('dateAdd', args),
1781
1781
  dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
1782
1782
  dedup: (...args) => callOnEmptyTraversal('dedup', args),
1783
+ disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
1783
1784
  drop: (...args) => callOnEmptyTraversal('drop', args),
1784
1785
  element: (...args) => callOnEmptyTraversal('element', args),
1785
1786
  elementMap: (...args) => callOnEmptyTraversal('elementMap', args),
@@ -1820,6 +1821,7 @@ const statics = {
1820
1821
  mergeE: (...args) => callOnEmptyTraversal('mergeE', args),
1821
1822
  mergeV: (...args) => callOnEmptyTraversal('mergeV', args),
1822
1823
  min: (...args) => callOnEmptyTraversal('min', args),
1824
+ none: (...args) => callOnEmptyTraversal('none', args),
1823
1825
  not: (...args) => callOnEmptyTraversal('not', args),
1824
1826
  optional: (...args) => callOnEmptyTraversal('optional', args),
1825
1827
  or: (...args) => callOnEmptyTraversal('or', args),
@@ -91,7 +91,7 @@ class Translator {
91
91
  }
92
92
  script += `('${key}', `;
93
93
  if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
94
- script += `'${anyObject[key]}'`;
94
+ script += `'${`${anyObject[key]}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
95
95
  } else {
96
96
  script += anyObject[key];
97
97
  }
@@ -106,12 +106,12 @@ class Translator {
106
106
  } else {
107
107
  script += anyObject.toString();
108
108
  }
109
- } else if (anyObject === undefined) {
110
- script += '';
109
+ } else if (anyObject === undefined || anyObject === null) {
110
+ script += 'null';
111
111
  } else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
112
112
  script += anyObject;
113
113
  } else {
114
- script += `'${anyObject}'`;
114
+ script += `'${`${anyObject}`.replaceAll("'", "\\'")}'`; // eslint-disable-line quotes
115
115
  }
116
116
 
117
117
  return script;
@@ -164,7 +164,10 @@ module.exports = class VertexPropertySerializer {
164
164
  // TODO: should we verify that properties is null?
165
165
  cursor = cursor.slice(properties_len);
166
166
 
167
- const v = new g.VertexProperty(id, label, value, properties);
167
+ // null properties are deserialized into empty lists
168
+ const vp_props = properties ? properties : [];
169
+
170
+ const v = new g.VertexProperty(id, label, value, vp_props);
168
171
  return { v, len };
169
172
  } catch (err) {
170
173
  throw this.ioc.utils.des_error({ serializer: this, args: arguments, cursor, err });
@@ -127,7 +127,10 @@ module.exports = class VertexSerializer {
127
127
  }
128
128
  cursor = cursor.slice(properties_len);
129
129
 
130
- const v = new g.Vertex(id, label, properties);
130
+ // null properties are deserialized into empty lists
131
+ const vertex_props = properties ? properties : [];
132
+
133
+ const v = new g.Vertex(id, label, vertex_props);
131
134
  return { v, len };
132
135
  } catch (err) {
133
136
  throw this.ioc.utils.des_error({ serializer: this, args: arguments, cursor, err });
package/lib/utils.js CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  const uuid = require('uuid');
27
27
 
28
- const gremlinVersion = '3.7.2'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
28
+ const gremlinVersion = '3.7.4'; // DO NOT MODIFY - Configured automatically by Maven Replacer Plugin
29
29
 
30
30
  exports.toLong = function toLong(value) {
31
31
  return new Long(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gremlin",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "JavaScript Gremlin Language Variant",
5
5
  "author": "Apache TinkerPop team",
6
6
  "keywords": [
@@ -21,16 +21,16 @@
21
21
  "ws": "^8.16.0"
22
22
  },
23
23
  "devDependencies": {
24
- "chai": "~4.4.1",
24
+ "chai": "~4.5.0",
25
25
  "chai-string": "~1.5.0",
26
26
  "colors": "1.4.0",
27
27
  "cross-env": "^7.0.3",
28
28
  "cucumber": "~6.0.7",
29
29
  "eslint": "^8.42.0",
30
- "eslint-config-prettier": "^9.0.0",
30
+ "eslint-config-prettier": "^10.0.1",
31
31
  "eslint-plugin-prettier": "^5.0.0",
32
32
  "grunt": "^1.5.3",
33
- "grunt-cli": "~1.4.3",
33
+ "grunt-cli": "~1.5.0",
34
34
  "grunt-jsdoc": "~2.4.1",
35
35
  "mocha": "^10.2.0",
36
36
  "prettier": "^3.0.0"
@@ -59,6 +59,6 @@
59
59
  "lint": "eslint --ext .js ."
60
60
  },
61
61
  "engines": {
62
- "node": ">=18"
62
+ "node": ">=20"
63
63
  }
64
64
  }
@@ -1,149 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JSDoc: Source: 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: 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
-
52
- /**
53
- * Represents a GraphBinary data type.
54
- *
55
- * See org.apache.tinkerpop.gremlin.structure.io.binary.DataType Java class.
56
- */
57
- const DataType = {
58
- INT: 0x01,
59
- LONG: 0x02,
60
- STRING: 0x03,
61
- DATE: 0x04,
62
- TIMESTAMP: 0x05,
63
- CLASS: 0x06,
64
- DOUBLE: 0x07,
65
- FLOAT: 0x08,
66
- LIST: 0x09,
67
- MAP: 0x0a,
68
- SET: 0x0b,
69
- UUID: 0x0c,
70
- EDGE: 0x0d,
71
- PATH: 0x0e,
72
- PROPERTY: 0x0f,
73
- GRAPH: 0x10,
74
- VERTEX: 0x11,
75
- VERTEXPROPERTY: 0x12,
76
- BARRIER: 0x13,
77
- BINDING: 0x14,
78
- BYTECODE: 0x15,
79
- CARDINALITY: 0x16,
80
- COLUMN: 0x17,
81
- DIRECTION: 0x18,
82
- OPERATOR: 0x19,
83
- ORDER: 0x1a,
84
- PICK: 0x1b,
85
- POP: 0x1c,
86
- LAMBDA: 0x1d,
87
- P: 0x1e,
88
- SCOPE: 0x1f,
89
- T: 0x20,
90
- TRAVERSER: 0x21,
91
- BIGDECIMAL: 0x22,
92
- BIGINTEGER: 0x23,
93
- BYTE: 0x24,
94
- BYTEBUFFER: 0x25,
95
- SHORT: 0x26,
96
- BOOLEAN: 0x27,
97
- TEXTP: 0x28,
98
- TRAVERSALSTRATEGY: 0x29,
99
- BULKSET: 0x2a,
100
- TREE: 0x2b,
101
- METRICS: 0x2c,
102
- TRAVERSALMETRICS: 0x2d,
103
- MERGE: 0x2e,
104
- DT: 0x2f,
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
- export default 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="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</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 Mon Apr 08 2024 22:33:46 GMT-0700 (Pacific Daylight Time)
144
- </footer>
145
-
146
- <script> prettyPrint(); </script>
147
- <script src="scripts/linenumber.js"> </script>
148
- </body>
149
- </html>
@@ -1,132 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JSDoc: Source: 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: 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
-
52
- import { Buffer } from 'buffer';
53
-
54
- /**
55
- * GraphBinary reader.
56
- */
57
- export default class GraphBinaryReader {
58
- constructor(ioc) {
59
- this.ioc = ioc;
60
- }
61
-
62
- readResponse(buffer) {
63
- if (buffer === undefined || buffer === null) {
64
- throw new Error('Buffer is missing.');
65
- }
66
- if (!(buffer instanceof Buffer)) {
67
- throw new Error('Not an instance of Buffer.');
68
- }
69
- if (buffer.length &lt; 1) {
70
- throw new Error('Buffer is empty.');
71
- }
72
-
73
- const response = { status: {}, result: {} };
74
- let cursor = buffer;
75
- let len;
76
-
77
- // {version} is a Byte representing the protocol version
78
- const version = cursor[0];
79
- if (version !== 0x81) {
80
- throw new Error(`Unsupported version '${version}'.`);
81
- }
82
- cursor = cursor.slice(1); // skip version
83
-
84
- // {request_id} is a nullable UUID
85
- ({ v: response.requestId, len } = this.ioc.uuidSerializer.deserialize(cursor, false, true));
86
- cursor = cursor.slice(len);
87
-
88
- // {status_code} is an Int
89
- ({ v: response.status.code, len } = this.ioc.intSerializer.deserialize(cursor, false));
90
- cursor = cursor.slice(len);
91
-
92
- // {status_message} is a nullable String
93
- ({ v: response.status.message, len } = this.ioc.stringSerializer.deserialize(cursor, false, true));
94
- cursor = cursor.slice(len);
95
-
96
- // {status_attributes} is a Map
97
- ({ v: response.status.attributes, len } = this.ioc.mapSerializer.deserialize(cursor, false));
98
- cursor = cursor.slice(len);
99
-
100
- // {result_meta} is a Map
101
- ({ v: response.result.meta, len } = this.ioc.mapSerializer.deserialize(cursor, false));
102
- cursor = cursor.slice(len);
103
-
104
- // {result_data} is a fully qualified typed value composed of {type_code}{type_info}{value_flag}{value}
105
- ({ v: response.result.data } = this.ioc.anySerializer.deserialize(cursor));
106
-
107
- return response;
108
- }
109
- }
110
- </code></pre>
111
- </article>
112
- </section>
113
-
114
-
115
-
116
-
117
- </div>
118
-
119
- <nav>
120
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li></ul>
121
- </nav>
122
-
123
- <br class="clear">
124
-
125
- <footer>
126
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 08 2024 22:33:46 GMT-0700 (Pacific Daylight Time)
127
- </footer>
128
-
129
- <script> prettyPrint(); </script>
130
- <script src="scripts/linenumber.js"> </script>
131
- </body>
132
- </html>
@@ -1,135 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JSDoc: Source: 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: 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
-
52
- import { Buffer } from 'buffer';
53
-
54
- /**
55
- * GraphBinary writer.
56
- */
57
- export default class GraphBinaryWriter {
58
- constructor(ioc) {
59
- this.ioc = ioc;
60
- }
61
-
62
- writeRequest({ requestId, op, processor, args }) {
63
- const bufs = [
64
- // {version} 1 byte
65
- Buffer.from([0x81]),
66
- // {request_id} UUID
67
- this.ioc.uuidSerializer.serialize(requestId, false),
68
- // {op} String
69
- this.ioc.stringSerializer.serialize(op, false),
70
- // {processor} String
71
- this.ioc.stringSerializer.serialize(processor, false),
72
- // {args} Map
73
- this.ioc.mapSerializer.serialize(args, false),
74
- ];
75
- return Buffer.concat(bufs);
76
-
77
- /*// Detailed example for a quick reference:
78
- // {version}
79
- 0x81,
80
- // {request_id} UUID
81
- 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
82
- // {op} String
83
- 0x00,0x00,0x00,0x08, ...Buffer.from('bytecode'),
84
- // {processor} String
85
- 0x00,0x00,0x00,0x09, ...Buffer.from('traversal'),
86
- // {args} Map
87
- 0x00,0x00,0x00,0x02,
88
- // 1.
89
- // args.aliases key String
90
- 0x03,0x00, 0x00,0x00,0x00,0x07, ...Buffer.from('aliases'),
91
- // args.aliases value Map
92
- 0x0A,0x00, 0x00,0x00,0x00,0x01,
93
- // aliases.g key String
94
- 0x03,0x00, 0x00,0x00,0x00,0x01, ...Buffer.from('g'),
95
- // aliases.g value String
96
- 0x03,0x00, 0x00,0x00,0x00,0x01, ...Buffer.from('g'),
97
- // 2.
98
- // args.gremlin key String
99
- 0x03,0x00, 0x00,0x00,0x00,0x07, ...Buffer.from('gremlin'),
100
- // args.gremlin value Bytecode
101
- 0x15,0x00,
102
- // {steps_length}
103
- 0x00,0x00,0x00,0x01,
104
- // step 1 - {name} String
105
- 0x00,0x00,0x00,0x01, ...Buffer.from('V'),
106
- // step 1 - {values_length} Int
107
- 0x00,0x00,0x00,0x00,
108
- // {sources_length}
109
- 0x00,0x00,0x00,0x00,
110
- */
111
- }
112
- }
113
- </code></pre>
114
- </article>
115
- </section>
116
-
117
-
118
-
119
-
120
- </div>
121
-
122
- <nav>
123
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#DataType">DataType</a></li></ul>
124
- </nav>
125
-
126
- <br class="clear">
127
-
128
- <footer>
129
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Apr 08 2024 22:33:46 GMT-0700 (Pacific Daylight Time)
130
- </footer>
131
-
132
- <script> prettyPrint(); </script>
133
- <script src="scripts/linenumber.js"> </script>
134
- </body>
135
- </html>