gremlin 4.0.0-beta.2 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/driver/auth.cjs +11 -4
- package/build/cjs/driver/auth.d.cts +1 -1
- package/build/cjs/driver/client.cjs +82 -38
- package/build/cjs/driver/client.d.cts +30 -27
- package/build/cjs/driver/connection.cjs +173 -60
- package/build/cjs/driver/connection.d.cts +69 -26
- package/build/cjs/driver/dispatcher.browser.cjs +57 -0
- package/build/cjs/driver/dispatcher.browser.d.cts +35 -0
- package/build/cjs/driver/dispatcher.cjs +101 -0
- package/build/cjs/driver/dispatcher.d.cts +48 -0
- package/build/cjs/driver/driver-remote-connection.cjs +27 -15
- package/build/cjs/driver/driver-remote-connection.d.cts +10 -4
- package/build/cjs/driver/http-request.cjs +64 -0
- package/build/cjs/driver/http-request.d.cts +28 -0
- package/build/cjs/driver/logger.cjs +45 -0
- package/build/cjs/driver/logger.d.cts +29 -0
- package/build/cjs/driver/remote-connection.cjs +5 -8
- package/build/cjs/driver/remote-connection.d.cts +6 -21
- package/build/cjs/driver/request-message.cjs +110 -21
- package/build/cjs/driver/request-message.d.cts +38 -8
- package/build/cjs/driver/response-error.cjs +3 -3
- package/build/cjs/driver/response-error.d.cts +2 -2
- package/build/cjs/index.cjs +21 -0
- package/build/cjs/index.d.cts +47 -0
- package/build/cjs/language/grammar/GremlinLexer.cjs +1669 -1615
- package/build/cjs/language/grammar/GremlinLexer.d.cts +325 -316
- package/build/cjs/language/grammar/GremlinListener.cjs +322 -8
- package/build/cjs/language/grammar/GremlinListener.d.cts +351 -10
- package/build/cjs/language/grammar/GremlinParser.cjs +8700 -5798
- package/build/cjs/language/grammar/GremlinParser.d.cts +998 -619
- package/build/cjs/language/translator/AnonymizedTranslateVisitor.cjs +9 -0
- package/build/cjs/language/translator/AnonymizedTranslateVisitor.d.cts +3 -0
- package/build/cjs/language/translator/DotNetTranslateVisitor.cjs +113 -4
- package/build/cjs/language/translator/DotNetTranslateVisitor.d.cts +13 -2
- package/build/cjs/language/translator/GoTranslateVisitor.cjs +82 -0
- package/build/cjs/language/translator/GoTranslateVisitor.d.cts +9 -0
- package/build/cjs/language/translator/GroovyTranslateVisitor.cjs +23 -0
- package/build/cjs/language/translator/GroovyTranslateVisitor.d.cts +3 -0
- package/build/cjs/language/translator/JavaTranslateVisitor.cjs +23 -0
- package/build/cjs/language/translator/JavaTranslateVisitor.d.cts +3 -0
- package/build/cjs/language/translator/JavascriptTranslateVisitor.cjs +11 -0
- package/build/cjs/language/translator/JavascriptTranslateVisitor.d.cts +3 -0
- package/build/cjs/language/translator/PythonTranslateVisitor.cjs +39 -3
- package/build/cjs/language/translator/PythonTranslateVisitor.d.cts +3 -0
- package/build/cjs/language/translator/TranslateVisitor.cjs +9 -0
- package/build/cjs/language/translator/TranslateVisitor.d.cts +3 -0
- package/build/cjs/process/anonymous-traversal.cjs +5 -1
- package/build/cjs/process/graph-traversal.cjs +139 -8
- package/build/cjs/process/graph-traversal.d.cts +84 -3
- package/build/cjs/process/gremlin-lang.cjs +119 -7
- package/build/cjs/process/gremlin-lang.d.cts +6 -1
- package/build/cjs/process/gvalue.cjs +42 -0
- package/build/cjs/process/gvalue.d.cts +7 -0
- package/build/cjs/process/transaction.cjs +125 -23
- package/build/cjs/process/transaction.d.cts +50 -14
- package/build/cjs/process/traversal.cjs +105 -48
- package/build/cjs/process/traversal.d.cts +36 -10
- package/build/cjs/structure/PDTRegistry.cjs +116 -0
- package/build/cjs/structure/PDTRegistry.d.cts +34 -0
- package/build/cjs/structure/graph.cjs +351 -8
- package/build/cjs/structure/graph.d.cts +122 -3
- package/build/cjs/structure/io/binary/GraphBinary.cjs +68 -39
- package/build/cjs/structure/io/binary/GraphBinary.d.cts +15 -1
- package/build/cjs/structure/io/binary/internals/AnySerializer.cjs +34 -17
- package/build/cjs/structure/io/binary/internals/AnySerializer.d.cts +12 -2
- package/build/cjs/structure/io/binary/internals/ArraySerializer.cjs +41 -72
- package/build/cjs/structure/io/binary/internals/ArraySerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.cjs +34 -54
- package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.d.cts +12 -7
- package/build/cjs/structure/io/binary/internals/BinarySerializer.cjs +31 -51
- package/build/cjs/structure/io/binary/internals/BinarySerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/BooleanSerializer.cjs +28 -42
- package/build/cjs/structure/io/binary/internals/BooleanSerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/ByteSerializer.cjs +24 -38
- package/build/cjs/structure/io/binary/internals/ByteSerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/CompositePDTSerializer.cjs +81 -0
- package/build/cjs/structure/io/binary/internals/CompositePDTSerializer.d.cts +10 -0
- package/build/cjs/structure/io/binary/internals/DateTimeSerializer.cjs +52 -69
- package/build/cjs/structure/io/binary/internals/DateTimeSerializer.d.cts +12 -7
- package/build/cjs/structure/io/binary/internals/DoubleSerializer.cjs +24 -38
- package/build/cjs/structure/io/binary/internals/DoubleSerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/EdgeSerializer.cjs +69 -124
- package/build/cjs/structure/io/binary/internals/EdgeSerializer.d.cts +14 -12
- package/build/cjs/structure/io/binary/internals/EnumSerializer.cjs +47 -59
- package/build/cjs/structure/io/binary/internals/EnumSerializer.d.cts +19 -4
- package/build/cjs/structure/io/binary/internals/FloatSerializer.cjs +24 -38
- package/build/cjs/structure/io/binary/internals/FloatSerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/GraphBinaryReader.cjs +111 -37
- package/build/cjs/structure/io/binary/internals/GraphBinaryReader.d.cts +26 -2
- package/build/cjs/structure/io/binary/internals/GraphBinaryWriter.cjs +6 -6
- package/build/cjs/structure/io/binary/internals/GraphSerializer.cjs +184 -0
- package/build/cjs/structure/io/binary/internals/GraphSerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/IntSerializer.cjs +33 -38
- package/build/cjs/structure/io/binary/internals/IntSerializer.d.cts +19 -4
- package/build/cjs/structure/io/binary/internals/LongSerializer.cjs +29 -42
- package/build/cjs/structure/io/binary/internals/LongSerializer.d.cts +13 -4
- package/build/cjs/structure/io/binary/internals/MapSerializer.cjs +36 -70
- package/build/cjs/structure/io/binary/internals/MapSerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/MarkerSerializer.cjs +30 -33
- package/build/cjs/structure/io/binary/internals/MarkerSerializer.d.cts +13 -4
- package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.cjs +28 -2
- package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.d.cts +0 -3
- package/build/cjs/structure/io/binary/internals/PathSerializer.cjs +30 -55
- package/build/cjs/structure/io/binary/internals/PathSerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/PrimitivePDTSerializer.cjs +80 -0
- package/build/cjs/structure/io/binary/internals/PrimitivePDTSerializer.d.cts +10 -0
- package/build/cjs/structure/io/binary/internals/PropertySerializer.cjs +32 -69
- package/build/cjs/structure/io/binary/internals/PropertySerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/SetSerializer.cjs +39 -73
- package/build/cjs/structure/io/binary/internals/SetSerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/ShortSerializer.cjs +24 -38
- package/build/cjs/structure/io/binary/internals/ShortSerializer.d.cts +12 -4
- package/build/cjs/structure/io/binary/internals/StreamReader.cjs +184 -0
- package/build/cjs/structure/io/binary/internals/StreamReader.d.cts +69 -0
- package/build/cjs/structure/io/binary/internals/StringSerializer.cjs +34 -53
- package/build/cjs/structure/io/binary/internals/StringSerializer.d.cts +14 -4
- package/build/cjs/structure/io/binary/internals/StubSerializer.cjs +2 -1
- package/build/cjs/structure/io/binary/internals/StubSerializer.d.cts +1 -1
- package/build/cjs/structure/io/binary/internals/TreeSerializer.cjs +139 -0
- package/build/cjs/structure/io/binary/internals/TreeSerializer.d.cts +54 -0
- package/build/cjs/structure/io/binary/internals/UnspecifiedNullSerializer.cjs +8 -31
- package/build/cjs/structure/io/binary/internals/UnspecifiedNullSerializer.d.cts +6 -4
- package/build/cjs/structure/io/binary/internals/UuidSerializer.cjs +33 -49
- package/build/cjs/structure/io/binary/internals/UuidSerializer.d.cts +12 -7
- package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.cjs +37 -95
- package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.d.cts +14 -7
- package/build/cjs/structure/io/binary/internals/VertexSerializer.cjs +41 -68
- package/build/cjs/structure/io/binary/internals/VertexSerializer.d.cts +14 -9
- package/build/cjs/utils.cjs +157 -40
- package/build/cjs/utils.d.cts +62 -4
- package/build/esm/driver/auth.d.ts +1 -1
- package/build/esm/driver/auth.js +11 -4
- package/build/esm/driver/client.d.ts +30 -27
- package/build/esm/driver/client.js +82 -38
- package/build/esm/driver/connection.d.ts +69 -26
- package/build/esm/driver/connection.js +172 -60
- package/build/esm/driver/dispatcher.browser.d.ts +35 -0
- package/build/esm/driver/dispatcher.browser.js +53 -0
- package/build/esm/driver/dispatcher.d.ts +48 -0
- package/build/esm/driver/dispatcher.js +94 -0
- package/build/esm/driver/driver-remote-connection.d.ts +10 -4
- package/build/esm/driver/driver-remote-connection.js +27 -15
- package/build/esm/driver/http-request.d.ts +28 -0
- package/build/esm/driver/http-request.js +60 -0
- package/build/esm/driver/logger.d.ts +29 -0
- package/build/esm/driver/logger.js +42 -0
- package/build/esm/driver/remote-connection.d.ts +6 -21
- package/build/esm/driver/remote-connection.js +5 -8
- package/build/esm/driver/request-message.d.ts +38 -8
- package/build/esm/driver/request-message.js +107 -21
- package/build/esm/driver/response-error.d.ts +2 -2
- package/build/esm/driver/response-error.js +3 -3
- package/build/esm/index.d.ts +47 -0
- package/build/esm/index.js +21 -0
- package/build/esm/language/grammar/GremlinLexer.d.ts +325 -316
- package/build/esm/language/grammar/GremlinLexer.js +1669 -1615
- package/build/esm/language/grammar/GremlinListener.d.ts +351 -10
- package/build/esm/language/grammar/GremlinListener.js +322 -8
- package/build/esm/language/grammar/GremlinParser.d.ts +998 -619
- package/build/esm/language/grammar/GremlinParser.js +8646 -5778
- package/build/esm/language/translator/AnonymizedTranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/AnonymizedTranslateVisitor.js +9 -0
- package/build/esm/language/translator/DotNetTranslateVisitor.d.ts +13 -2
- package/build/esm/language/translator/DotNetTranslateVisitor.js +113 -4
- package/build/esm/language/translator/GoTranslateVisitor.d.ts +9 -0
- package/build/esm/language/translator/GoTranslateVisitor.js +82 -0
- package/build/esm/language/translator/GroovyTranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/GroovyTranslateVisitor.js +23 -0
- package/build/esm/language/translator/JavaTranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/JavaTranslateVisitor.js +23 -0
- package/build/esm/language/translator/JavascriptTranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/JavascriptTranslateVisitor.js +11 -0
- package/build/esm/language/translator/PythonTranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/PythonTranslateVisitor.js +39 -3
- package/build/esm/language/translator/TranslateVisitor.d.ts +3 -0
- package/build/esm/language/translator/TranslateVisitor.js +9 -0
- package/build/esm/process/anonymous-traversal.js +5 -1
- package/build/esm/process/graph-traversal.d.ts +84 -3
- package/build/esm/process/graph-traversal.js +139 -8
- package/build/esm/process/gremlin-lang.d.ts +6 -1
- package/build/esm/process/gremlin-lang.js +121 -9
- package/build/esm/process/gvalue.d.ts +7 -0
- package/build/esm/process/gvalue.js +38 -0
- package/build/esm/process/transaction.d.ts +50 -14
- package/build/esm/process/transaction.js +122 -23
- package/build/esm/process/traversal.d.ts +36 -10
- package/build/esm/process/traversal.js +104 -47
- package/build/esm/structure/PDTRegistry.d.ts +34 -0
- package/build/esm/structure/PDTRegistry.js +112 -0
- package/build/esm/structure/graph.d.ts +122 -3
- package/build/esm/structure/graph.js +347 -7
- package/build/esm/structure/io/binary/GraphBinary.d.ts +15 -1
- package/build/esm/structure/io/binary/GraphBinary.js +66 -38
- package/build/esm/structure/io/binary/internals/AnySerializer.d.ts +12 -2
- package/build/esm/structure/io/binary/internals/AnySerializer.js +34 -17
- package/build/esm/structure/io/binary/internals/ArraySerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/ArraySerializer.js +41 -72
- package/build/esm/structure/io/binary/internals/BigIntegerSerializer.d.ts +12 -7
- package/build/esm/structure/io/binary/internals/BigIntegerSerializer.js +34 -54
- package/build/esm/structure/io/binary/internals/BinarySerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/BinarySerializer.js +31 -51
- package/build/esm/structure/io/binary/internals/BooleanSerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/BooleanSerializer.js +28 -42
- package/build/esm/structure/io/binary/internals/ByteSerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/ByteSerializer.js +24 -38
- package/build/esm/structure/io/binary/internals/CompositePDTSerializer.d.ts +10 -0
- package/build/esm/structure/io/binary/internals/CompositePDTSerializer.js +78 -0
- package/build/esm/structure/io/binary/internals/DateTimeSerializer.d.ts +12 -7
- package/build/esm/structure/io/binary/internals/DateTimeSerializer.js +52 -69
- package/build/esm/structure/io/binary/internals/DoubleSerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/DoubleSerializer.js +24 -38
- package/build/esm/structure/io/binary/internals/EdgeSerializer.d.ts +14 -12
- package/build/esm/structure/io/binary/internals/EdgeSerializer.js +69 -124
- package/build/esm/structure/io/binary/internals/EnumSerializer.d.ts +19 -4
- package/build/esm/structure/io/binary/internals/EnumSerializer.js +47 -59
- package/build/esm/structure/io/binary/internals/FloatSerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/FloatSerializer.js +24 -38
- package/build/esm/structure/io/binary/internals/GraphBinaryReader.d.ts +26 -2
- package/build/esm/structure/io/binary/internals/GraphBinaryReader.js +108 -37
- package/build/esm/structure/io/binary/internals/GraphBinaryWriter.js +6 -6
- package/build/esm/structure/io/binary/internals/GraphSerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/GraphSerializer.js +181 -0
- package/build/esm/structure/io/binary/internals/IntSerializer.d.ts +19 -4
- package/build/esm/structure/io/binary/internals/IntSerializer.js +33 -38
- package/build/esm/structure/io/binary/internals/LongSerializer.d.ts +13 -4
- package/build/esm/structure/io/binary/internals/LongSerializer.js +29 -42
- package/build/esm/structure/io/binary/internals/MapSerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/MapSerializer.js +36 -70
- package/build/esm/structure/io/binary/internals/MarkerSerializer.d.ts +13 -4
- package/build/esm/structure/io/binary/internals/MarkerSerializer.js +29 -33
- package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.d.ts +0 -3
- package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.js +28 -2
- package/build/esm/structure/io/binary/internals/PathSerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/PathSerializer.js +30 -55
- package/build/esm/structure/io/binary/internals/PrimitivePDTSerializer.d.ts +10 -0
- package/build/esm/structure/io/binary/internals/PrimitivePDTSerializer.js +77 -0
- package/build/esm/structure/io/binary/internals/PropertySerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/PropertySerializer.js +32 -69
- package/build/esm/structure/io/binary/internals/SetSerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/SetSerializer.js +39 -73
- package/build/esm/structure/io/binary/internals/ShortSerializer.d.ts +12 -4
- package/build/esm/structure/io/binary/internals/ShortSerializer.js +24 -38
- package/build/esm/structure/io/binary/internals/StreamReader.d.ts +69 -0
- package/build/esm/structure/io/binary/internals/StreamReader.js +181 -0
- package/build/esm/structure/io/binary/internals/StringSerializer.d.ts +14 -4
- package/build/esm/structure/io/binary/internals/StringSerializer.js +34 -53
- package/build/esm/structure/io/binary/internals/StubSerializer.d.ts +1 -1
- package/build/esm/structure/io/binary/internals/StubSerializer.js +2 -1
- package/build/esm/structure/io/binary/internals/TreeSerializer.d.ts +54 -0
- package/build/esm/structure/io/binary/internals/TreeSerializer.js +136 -0
- package/build/esm/structure/io/binary/internals/UnspecifiedNullSerializer.d.ts +6 -4
- package/build/esm/structure/io/binary/internals/UnspecifiedNullSerializer.js +8 -31
- package/build/esm/structure/io/binary/internals/UuidSerializer.d.ts +12 -7
- package/build/esm/structure/io/binary/internals/UuidSerializer.js +33 -49
- package/build/esm/structure/io/binary/internals/VertexPropertySerializer.d.ts +14 -7
- package/build/esm/structure/io/binary/internals/VertexPropertySerializer.js +37 -95
- package/build/esm/structure/io/binary/internals/VertexSerializer.d.ts +14 -9
- package/build/esm/structure/io/binary/internals/VertexSerializer.js +41 -68
- package/build/esm/utils.d.ts +62 -4
- package/build/esm/utils.js +145 -6
- package/package.json +27 -18
|
@@ -58,46 +58,41 @@ class IntSerializer {
|
|
|
58
58
|
bufs.push(v);
|
|
59
59
|
return buffer_1.Buffer.concat(bufs);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (cursor.length < 4) {
|
|
92
|
-
throw new Error('unexpected {value} length');
|
|
93
|
-
}
|
|
94
|
-
len += 4;
|
|
95
|
-
const v = cursor.readInt32BE();
|
|
96
|
-
return { v, len };
|
|
61
|
+
/**
|
|
62
|
+
* Read a bare int32 value from the StreamReader (no type_code or value_flag).
|
|
63
|
+
* @param {StreamReader} reader
|
|
64
|
+
* @returns {Promise<number>}
|
|
65
|
+
*/
|
|
66
|
+
async deserializeBare(reader) {
|
|
67
|
+
return await reader.readInt32BE();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @param {StreamReader} reader
|
|
71
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
72
|
+
* @param {number} typeCode
|
|
73
|
+
* @returns {Promise<number>}
|
|
74
|
+
*/
|
|
75
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
76
|
+
return await reader.readInt32BE();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Read a fully-qualified int from the StreamReader (type_code + value_flag + value).
|
|
80
|
+
* @param {StreamReader} reader
|
|
81
|
+
* @returns {Promise<number|null>}
|
|
82
|
+
*/
|
|
83
|
+
async deserialize(reader) {
|
|
84
|
+
const type_code = await reader.readUInt8();
|
|
85
|
+
if (type_code !== this.ioc.DataType.INT) {
|
|
86
|
+
throw new Error(`IntSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
87
|
+
}
|
|
88
|
+
const value_flag = await reader.readUInt8();
|
|
89
|
+
if (value_flag === 0x01) {
|
|
90
|
+
return null;
|
|
97
91
|
}
|
|
98
|
-
|
|
99
|
-
throw
|
|
92
|
+
if (value_flag !== 0x00) {
|
|
93
|
+
throw new Error(`IntSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
100
94
|
}
|
|
95
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
exports.default = IntSerializer;
|
|
@@ -5,9 +5,24 @@ export default class IntSerializer {
|
|
|
5
5
|
ioc: any;
|
|
6
6
|
canBeUsedFor(value: any): boolean;
|
|
7
7
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Read a bare int32 value from the StreamReader (no type_code or value_flag).
|
|
10
|
+
* @param {StreamReader} reader
|
|
11
|
+
* @returns {Promise<number>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeBare(reader: StreamReader): Promise<number>;
|
|
14
|
+
/**
|
|
15
|
+
* @param {StreamReader} reader
|
|
16
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
17
|
+
* @param {number} typeCode
|
|
18
|
+
* @returns {Promise<number>}
|
|
19
|
+
*/
|
|
20
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Read a fully-qualified int from the StreamReader (type_code + value_flag + value).
|
|
23
|
+
* @param {StreamReader} reader
|
|
24
|
+
* @returns {Promise<number|null>}
|
|
25
|
+
*/
|
|
26
|
+
deserialize(reader: StreamReader): Promise<number | null>;
|
|
12
27
|
}
|
|
13
28
|
import { Buffer } from 'buffer';
|
|
@@ -46,50 +46,37 @@ class LongSerializer {
|
|
|
46
46
|
bufs.push(v);
|
|
47
47
|
return buffer_1.Buffer.concat(bufs);
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
throw new Error('unexpected {value_flag}');
|
|
76
|
-
}
|
|
77
|
-
cursor = cursor.slice(1);
|
|
78
|
-
}
|
|
79
|
-
if (cursor.length < 8) {
|
|
80
|
-
throw new Error('unexpected {value} length');
|
|
81
|
-
}
|
|
82
|
-
len += 8;
|
|
83
|
-
let v = cursor.readBigInt64BE();
|
|
84
|
-
if (v >= Number.MIN_SAFE_INTEGER && v <= Number.MAX_SAFE_INTEGER) {
|
|
85
|
-
v = Number(v);
|
|
86
|
-
}
|
|
87
|
-
// Values outside safe integer range stay as BigInt to preserve precision.
|
|
88
|
-
return { v, len };
|
|
49
|
+
/**
|
|
50
|
+
* @param {StreamReader} reader
|
|
51
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
52
|
+
* @param {number} typeCode
|
|
53
|
+
* @returns {Promise<number|bigint>}
|
|
54
|
+
*/
|
|
55
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
56
|
+
let v = await reader.readBigInt64BE();
|
|
57
|
+
if (v >= Number.MIN_SAFE_INTEGER && v <= Number.MAX_SAFE_INTEGER) {
|
|
58
|
+
v = Number(v);
|
|
59
|
+
}
|
|
60
|
+
return v;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read a fully-qualified long from the StreamReader.
|
|
64
|
+
* @param {StreamReader} reader
|
|
65
|
+
* @returns {Promise<number|bigint|null>}
|
|
66
|
+
*/
|
|
67
|
+
async deserialize(reader) {
|
|
68
|
+
const type_code = await reader.readUInt8();
|
|
69
|
+
if (type_code !== this.ioc.DataType.LONG) {
|
|
70
|
+
throw new Error(`LongSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
71
|
+
}
|
|
72
|
+
const value_flag = await reader.readUInt8();
|
|
73
|
+
if (value_flag === 0x01) {
|
|
74
|
+
return null;
|
|
89
75
|
}
|
|
90
|
-
|
|
91
|
-
throw
|
|
76
|
+
if (value_flag !== 0x00) {
|
|
77
|
+
throw new Error(`LongSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
92
78
|
}
|
|
79
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
exports.default = LongSerializer;
|
|
@@ -3,9 +3,18 @@ export default class LongSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(): void;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {StreamReader} reader
|
|
8
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
9
|
+
* @param {number} typeCode
|
|
10
|
+
* @returns {Promise<number|bigint>}
|
|
11
|
+
*/
|
|
12
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<number | bigint>;
|
|
13
|
+
/**
|
|
14
|
+
* Read a fully-qualified long from the StreamReader.
|
|
15
|
+
* @param {StreamReader} reader
|
|
16
|
+
* @returns {Promise<number|bigint|null>}
|
|
17
|
+
*/
|
|
18
|
+
deserialize(reader: StreamReader): Promise<number | bigint | null>;
|
|
10
19
|
}
|
|
11
20
|
import { Buffer } from 'buffer';
|
|
@@ -67,78 +67,44 @@ class MapSerializer {
|
|
|
67
67
|
}
|
|
68
68
|
return buffer_1.Buffer.concat(bufs);
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
len += length_len;
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
err.message = '{length}: ' + err.message;
|
|
107
|
-
throw err;
|
|
108
|
-
}
|
|
109
|
-
if (length < 0) {
|
|
110
|
-
throw new Error('{length} is less than zero');
|
|
111
|
-
}
|
|
112
|
-
cursor = cursor.slice(length_len);
|
|
113
|
-
const v = new Map();
|
|
114
|
-
for (let i = 0; i < length; i++) {
|
|
115
|
-
let key, key_len;
|
|
116
|
-
try {
|
|
117
|
-
({ v: key, len: key_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
118
|
-
len += key_len;
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
err.message = `{item_${i}} key: ` + err.message;
|
|
122
|
-
throw err;
|
|
123
|
-
}
|
|
124
|
-
cursor = cursor.slice(key_len);
|
|
125
|
-
let value, value_len;
|
|
126
|
-
try {
|
|
127
|
-
({ v: value, len: value_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
128
|
-
len += value_len;
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
err.message = `{item_${i}} value: ` + err.message;
|
|
132
|
-
throw err;
|
|
133
|
-
}
|
|
134
|
-
cursor = cursor.slice(value_len);
|
|
135
|
-
v.set(key, value);
|
|
136
|
-
}
|
|
137
|
-
return { v, len };
|
|
70
|
+
/**
|
|
71
|
+
* Async deserialization of map value bytes from a StreamReader.
|
|
72
|
+
* @param {StreamReader} reader
|
|
73
|
+
* @param {number} valueFlag
|
|
74
|
+
* @param {number} typeCode
|
|
75
|
+
* @returns {Promise<Map>}
|
|
76
|
+
*/
|
|
77
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
78
|
+
const length = await this.ioc.intSerializer.deserializeBare(reader);
|
|
79
|
+
if (length < 0) {
|
|
80
|
+
throw new Error(`MapSerializer: {length}=${length} is less than zero`);
|
|
81
|
+
}
|
|
82
|
+
const v = new Map();
|
|
83
|
+
for (let i = 0; i < length; i++) {
|
|
84
|
+
const key = await this.ioc.anySerializer.deserialize(reader);
|
|
85
|
+
const value = await this.ioc.anySerializer.deserialize(reader);
|
|
86
|
+
v.set(key, value);
|
|
87
|
+
}
|
|
88
|
+
return v;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
92
|
+
* @param {StreamReader} reader
|
|
93
|
+
* @returns {Promise<Map|null>}
|
|
94
|
+
*/
|
|
95
|
+
async deserialize(reader) {
|
|
96
|
+
const type_code = await reader.readUInt8();
|
|
97
|
+
if (type_code !== this.ioc.DataType.MAP) {
|
|
98
|
+
throw new Error(`MapSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
99
|
+
}
|
|
100
|
+
const value_flag = await reader.readUInt8();
|
|
101
|
+
if (value_flag === 0x01) {
|
|
102
|
+
return null;
|
|
138
103
|
}
|
|
139
|
-
|
|
140
|
-
throw
|
|
104
|
+
if (value_flag !== 0x00 && value_flag !== 0x02) {
|
|
105
|
+
throw new Error(`MapSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
141
106
|
}
|
|
107
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
142
108
|
}
|
|
143
109
|
}
|
|
144
110
|
exports.default = MapSerializer;
|
|
@@ -3,11 +3,18 @@ export default class MapSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): boolean;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): any;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Async deserialization of map value bytes from a StreamReader.
|
|
8
|
+
* @param {StreamReader} reader
|
|
9
|
+
* @param {number} valueFlag
|
|
10
|
+
* @param {number} typeCode
|
|
11
|
+
* @returns {Promise<Map>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<Map<any, any>>;
|
|
14
|
+
/**
|
|
15
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
16
|
+
* @param {StreamReader} reader
|
|
17
|
+
* @returns {Promise<Map|null>}
|
|
18
|
+
*/
|
|
19
|
+
deserialize(reader: StreamReader): Promise<Map<any, any> | null>;
|
|
13
20
|
}
|
|
@@ -18,46 +18,43 @@
|
|
|
18
18
|
* under the License.
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
|
|
21
|
+
exports.END_OF_STREAM = void 0;
|
|
22
|
+
exports.END_OF_STREAM = Symbol('EndOfStream');
|
|
22
23
|
class MarkerSerializer {
|
|
23
24
|
constructor(ioc) {
|
|
24
25
|
this.ioc = ioc;
|
|
25
26
|
this.ioc.serializers[ioc.DataType.MARKER] = this;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
if (fullyQualifiedFormat) {
|
|
38
|
-
const type_code = cursor.readUInt8();
|
|
39
|
-
len++;
|
|
40
|
-
if (type_code !== this.ioc.DataType.MARKER) {
|
|
41
|
-
throw new Error('unexpected {type_code}');
|
|
42
|
-
}
|
|
43
|
-
cursor = cursor.slice(1);
|
|
44
|
-
const value_flag = cursor.readUInt8();
|
|
45
|
-
len++;
|
|
46
|
-
if (value_flag !== 0) {
|
|
47
|
-
throw new Error('unexpected {value_flag}');
|
|
48
|
-
}
|
|
49
|
-
cursor = cursor.slice(1);
|
|
50
|
-
}
|
|
51
|
-
const value = cursor.readUInt8();
|
|
52
|
-
len++;
|
|
53
|
-
if (value !== 0) {
|
|
54
|
-
throw new Error('unexpected marker value');
|
|
55
|
-
}
|
|
56
|
-
return { v: 'marker', len };
|
|
28
|
+
/**
|
|
29
|
+
* @param {StreamReader} reader
|
|
30
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
31
|
+
* @returns {Promise<symbol>}
|
|
32
|
+
*/
|
|
33
|
+
async deserializeValue(reader, valueFlag) {
|
|
34
|
+
const value = await reader.readUInt8();
|
|
35
|
+
if (value !== 0) {
|
|
36
|
+
throw new Error(`unexpected marker value: ${value}`);
|
|
57
37
|
}
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
return exports.END_OF_STREAM;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
42
|
+
* @param {StreamReader} reader
|
|
43
|
+
* @returns {Promise<symbol|null>}
|
|
44
|
+
*/
|
|
45
|
+
async deserialize(reader) {
|
|
46
|
+
const type_code = await reader.readUInt8();
|
|
47
|
+
if (type_code !== this.ioc.DataType.MARKER) {
|
|
48
|
+
throw new Error(`MarkerSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
49
|
+
}
|
|
50
|
+
const value_flag = await reader.readUInt8();
|
|
51
|
+
if (value_flag === 0x01) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (value_flag !== 0x00) {
|
|
55
|
+
throw new Error(`MarkerSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
60
56
|
}
|
|
57
|
+
return this.deserializeValue(reader, value_flag);
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
60
|
exports.default = MarkerSerializer;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
export const END_OF_STREAM: unique symbol;
|
|
1
2
|
export default class MarkerSerializer {
|
|
2
3
|
constructor(ioc: any);
|
|
3
4
|
ioc: any;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @param {StreamReader} reader
|
|
7
|
+
* @param {number} valueFlag - already consumed by AnySerializer
|
|
8
|
+
* @returns {Promise<symbol>}
|
|
9
|
+
*/
|
|
10
|
+
deserializeValue(reader: StreamReader, valueFlag: number): Promise<symbol>;
|
|
11
|
+
/**
|
|
12
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
13
|
+
* @param {StreamReader} reader
|
|
14
|
+
* @returns {Promise<symbol|null>}
|
|
15
|
+
*/
|
|
16
|
+
deserialize(reader: StreamReader): Promise<symbol | null>;
|
|
8
17
|
}
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
/**
|
|
22
22
|
* @author Igor Ostapenko
|
|
23
23
|
*/
|
|
24
|
+
const utils_js_1 = require("../../../../utils.cjs");
|
|
24
25
|
// Based on GraphSON NumberSerializer.serialize().
|
|
25
26
|
// It's tested by AnySerializer.serialize() tests.
|
|
26
27
|
class NumberSerializationStrategy {
|
|
@@ -28,6 +29,14 @@ class NumberSerializationStrategy {
|
|
|
28
29
|
this.ioc = ioc;
|
|
29
30
|
}
|
|
30
31
|
canBeUsedFor(value) {
|
|
32
|
+
if (value instanceof utils_js_1.Long ||
|
|
33
|
+
value instanceof utils_js_1.Int ||
|
|
34
|
+
value instanceof utils_js_1.Float ||
|
|
35
|
+
value instanceof utils_js_1.Double ||
|
|
36
|
+
value instanceof utils_js_1.Short ||
|
|
37
|
+
value instanceof utils_js_1.Byte) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
31
40
|
if (Number.isNaN(value) || value === Number.POSITIVE_INFINITY || value === Number.NEGATIVE_INFINITY) {
|
|
32
41
|
return true;
|
|
33
42
|
}
|
|
@@ -40,6 +49,24 @@ class NumberSerializationStrategy {
|
|
|
40
49
|
return false;
|
|
41
50
|
}
|
|
42
51
|
serialize(item, fullyQualifiedFormat = true) {
|
|
52
|
+
if (item instanceof utils_js_1.Float) {
|
|
53
|
+
return this.ioc.floatSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
54
|
+
}
|
|
55
|
+
if (item instanceof utils_js_1.Double) {
|
|
56
|
+
return this.ioc.doubleSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
57
|
+
}
|
|
58
|
+
if (item instanceof utils_js_1.Int) {
|
|
59
|
+
return this.ioc.intSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
60
|
+
}
|
|
61
|
+
if (item instanceof utils_js_1.Long) {
|
|
62
|
+
return this.ioc.longSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
63
|
+
}
|
|
64
|
+
if (item instanceof utils_js_1.Short) {
|
|
65
|
+
return this.ioc.shortSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
66
|
+
}
|
|
67
|
+
if (item instanceof utils_js_1.Byte) {
|
|
68
|
+
return this.ioc.byteSerializer.serialize(item.value, fullyQualifiedFormat);
|
|
69
|
+
}
|
|
43
70
|
if (typeof item === 'number') {
|
|
44
71
|
if (Number.isNaN(item) ||
|
|
45
72
|
item === Number.POSITIVE_INFINITY ||
|
|
@@ -48,8 +75,7 @@ class NumberSerializationStrategy {
|
|
|
48
75
|
Object.is(item, -0)) {
|
|
49
76
|
return this.ioc.doubleSerializer.serialize(item, fullyQualifiedFormat);
|
|
50
77
|
}
|
|
51
|
-
if (item >=
|
|
52
|
-
// INT32_MIN/MAX
|
|
78
|
+
if (item >= utils_js_1.INT32_MIN && item <= utils_js_1.INT32_MAX) {
|
|
53
79
|
return this.ioc.intSerializer.serialize(item, fullyQualifiedFormat);
|
|
54
80
|
}
|
|
55
81
|
if (item >= Number.MIN_SAFE_INTEGER && item <= Number.MAX_SAFE_INTEGER) {
|
|
@@ -51,63 +51,38 @@ class PathSerializer {
|
|
|
51
51
|
bufs.push(this.ioc.listSerializer.serialize(item.objects));
|
|
52
52
|
return buffer_1.Buffer.concat(bufs);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
cursor = cursor.slice(1);
|
|
83
|
-
}
|
|
84
|
-
let labels, labels_len;
|
|
85
|
-
try {
|
|
86
|
-
({ v: labels, len: labels_len } = this.ioc.listSerializer.deserialize(cursor));
|
|
87
|
-
len += labels_len;
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
err.message = '{labels}: ' + err.message;
|
|
91
|
-
throw err;
|
|
92
|
-
}
|
|
93
|
-
// TODO: should we check content of labels to make sure it's List< Set<String> > ?
|
|
94
|
-
cursor = cursor.slice(labels_len);
|
|
95
|
-
let objects, objects_len;
|
|
96
|
-
try {
|
|
97
|
-
({ v: objects, len: objects_len } = this.ioc.listSerializer.deserialize(cursor));
|
|
98
|
-
len += objects_len;
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
err.message = '{objects}: ' + err.message;
|
|
102
|
-
throw err;
|
|
103
|
-
}
|
|
104
|
-
cursor = cursor.slice(objects_len);
|
|
105
|
-
const v = new graph_js_1.Path(labels, objects);
|
|
106
|
-
return { v, len };
|
|
54
|
+
/**
|
|
55
|
+
* Async deserialization of path value bytes from a StreamReader.
|
|
56
|
+
* @param {StreamReader} reader
|
|
57
|
+
* @param {number} valueFlag
|
|
58
|
+
* @param {number} typeCode
|
|
59
|
+
* @returns {Promise<Path>}
|
|
60
|
+
*/
|
|
61
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
62
|
+
// {labels} fully qualified list
|
|
63
|
+
const labels = await this.ioc.anySerializer.deserialize(reader);
|
|
64
|
+
// {objects} fully qualified list
|
|
65
|
+
const objects = await this.ioc.anySerializer.deserialize(reader);
|
|
66
|
+
return new graph_js_1.Path(labels, objects);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
70
|
+
* @param {StreamReader} reader
|
|
71
|
+
* @returns {Promise<Path|null>}
|
|
72
|
+
*/
|
|
73
|
+
async deserialize(reader) {
|
|
74
|
+
const type_code = await reader.readUInt8();
|
|
75
|
+
if (type_code !== this.ioc.DataType.PATH) {
|
|
76
|
+
throw new Error(`PathSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
77
|
+
}
|
|
78
|
+
const value_flag = await reader.readUInt8();
|
|
79
|
+
if (value_flag === 0x01) {
|
|
80
|
+
return null;
|
|
107
81
|
}
|
|
108
|
-
|
|
109
|
-
throw
|
|
82
|
+
if (value_flag !== 0x00) {
|
|
83
|
+
throw new Error(`PathSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
110
84
|
}
|
|
85
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
111
86
|
}
|
|
112
87
|
}
|
|
113
88
|
exports.default = PathSerializer;
|
|
@@ -3,13 +3,20 @@ export default class PathSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): value is Path;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Async deserialization of path value bytes from a StreamReader.
|
|
8
|
+
* @param {StreamReader} reader
|
|
9
|
+
* @param {number} valueFlag
|
|
10
|
+
* @param {number} typeCode
|
|
11
|
+
* @returns {Promise<Path>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<Path>;
|
|
14
|
+
/**
|
|
15
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
16
|
+
* @param {StreamReader} reader
|
|
17
|
+
* @returns {Promise<Path|null>}
|
|
18
|
+
*/
|
|
19
|
+
deserialize(reader: StreamReader): Promise<Path | null>;
|
|
13
20
|
}
|
|
14
21
|
import { Path } from '../../../graph.cjs';
|
|
15
22
|
import { Buffer } from 'buffer';
|