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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphBinary serializer for the Tree type (0x2b).
|
|
3
|
+
*
|
|
4
|
+
* Wire format (authoritative from Java TreeSerializer):
|
|
5
|
+
* value = {int length} then length x ( {fully-qualified key} {bare child Tree} )
|
|
6
|
+
* A child Tree is written bare: just {int length}{entries...}, with no type-id
|
|
7
|
+
* and no value-flag, recursively. A leaf is length 0. The child is never null,
|
|
8
|
+
* but a key may be null.
|
|
9
|
+
*/
|
|
10
|
+
export default class TreeSerializer {
|
|
11
|
+
constructor(ioc: any);
|
|
12
|
+
ioc: any;
|
|
13
|
+
canBeUsedFor(value: any): value is Tree;
|
|
14
|
+
serialize(item: any, fullyQualifiedFormat?: boolean): any;
|
|
15
|
+
/**
|
|
16
|
+
* Serializes the bare value of a Tree: {int length} then, for each root key, a
|
|
17
|
+
* fully-qualified key followed by a bare child Tree (recursive).
|
|
18
|
+
*
|
|
19
|
+
* Uses only the public read API ({@link Tree#rootNodes} / {@link Tree#childAt})
|
|
20
|
+
* so it never touches the Tree's private backing. Keys returned by rootNodes()
|
|
21
|
+
* are already deduped, so each is written exactly once.
|
|
22
|
+
* @param {Tree} tree
|
|
23
|
+
* @returns {Buffer}
|
|
24
|
+
*/
|
|
25
|
+
_serializeValue(tree: Tree): Buffer;
|
|
26
|
+
/**
|
|
27
|
+
* Async deserialization of tree value bytes from a StreamReader.
|
|
28
|
+
* @param {StreamReader} reader
|
|
29
|
+
* @param {number} valueFlag
|
|
30
|
+
* @param {number} typeCode
|
|
31
|
+
* @returns {Promise<Tree>}
|
|
32
|
+
*/
|
|
33
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<Tree>;
|
|
34
|
+
/**
|
|
35
|
+
* Reads a bare tree value: {int length} then length x ( fully-qualified key,
|
|
36
|
+
* bare child tree ). The child recursion reads bare values (no type_code,
|
|
37
|
+
* no value_flag).
|
|
38
|
+
*
|
|
39
|
+
* Duplicate sibling keys are collapsed via {@link Tree#getOrCreateChild} +
|
|
40
|
+
* {@link Tree#addTree} (a server emitting
|
|
41
|
+
* the same sibling key twice yields a single merged entry, not duplicates).
|
|
42
|
+
* @param {StreamReader} reader
|
|
43
|
+
* @returns {Promise<Tree>}
|
|
44
|
+
*/
|
|
45
|
+
_readTreeValue(reader: StreamReader): Promise<Tree>;
|
|
46
|
+
/**
|
|
47
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
48
|
+
* @param {StreamReader} reader
|
|
49
|
+
* @returns {Promise<Tree|null>}
|
|
50
|
+
*/
|
|
51
|
+
deserialize(reader: StreamReader): Promise<Tree | null>;
|
|
52
|
+
}
|
|
53
|
+
import { Tree } from '../../../graph.js';
|
|
54
|
+
import { Buffer } from 'buffer';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { Buffer } from 'buffer';
|
|
20
|
+
import { Tree } from '../../../graph.js';
|
|
21
|
+
/**
|
|
22
|
+
* GraphBinary serializer for the Tree type (0x2b).
|
|
23
|
+
*
|
|
24
|
+
* Wire format (authoritative from Java TreeSerializer):
|
|
25
|
+
* value = {int length} then length x ( {fully-qualified key} {bare child Tree} )
|
|
26
|
+
* A child Tree is written bare: just {int length}{entries...}, with no type-id
|
|
27
|
+
* and no value-flag, recursively. A leaf is length 0. The child is never null,
|
|
28
|
+
* but a key may be null.
|
|
29
|
+
*/
|
|
30
|
+
export default class TreeSerializer {
|
|
31
|
+
constructor(ioc) {
|
|
32
|
+
this.ioc = ioc;
|
|
33
|
+
this.ioc.serializers[ioc.DataType.TREE] = this;
|
|
34
|
+
}
|
|
35
|
+
canBeUsedFor(value) {
|
|
36
|
+
return value instanceof Tree;
|
|
37
|
+
}
|
|
38
|
+
serialize(item, fullyQualifiedFormat = true) {
|
|
39
|
+
if (item === undefined || item === null) {
|
|
40
|
+
if (fullyQualifiedFormat) {
|
|
41
|
+
return Buffer.from([this.ioc.DataType.TREE, 0x01]);
|
|
42
|
+
}
|
|
43
|
+
// bare null -> empty tree (length 0)
|
|
44
|
+
return this.ioc.intSerializer.serialize(0, false);
|
|
45
|
+
}
|
|
46
|
+
const bufs = [];
|
|
47
|
+
if (fullyQualifiedFormat) {
|
|
48
|
+
bufs.push(Buffer.from([this.ioc.DataType.TREE, 0x00]));
|
|
49
|
+
}
|
|
50
|
+
bufs.push(this._serializeValue(item));
|
|
51
|
+
return Buffer.concat(bufs);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Serializes the bare value of a Tree: {int length} then, for each root key, a
|
|
55
|
+
* fully-qualified key followed by a bare child Tree (recursive).
|
|
56
|
+
*
|
|
57
|
+
* Uses only the public read API ({@link Tree#rootNodes} / {@link Tree#childAt})
|
|
58
|
+
* so it never touches the Tree's private backing. Keys returned by rootNodes()
|
|
59
|
+
* are already deduped, so each is written exactly once.
|
|
60
|
+
* @param {Tree} tree
|
|
61
|
+
* @returns {Buffer}
|
|
62
|
+
*/
|
|
63
|
+
_serializeValue(tree) {
|
|
64
|
+
const keys = tree.rootNodes();
|
|
65
|
+
let length = keys.length;
|
|
66
|
+
if (length < 0) {
|
|
67
|
+
length = 0;
|
|
68
|
+
}
|
|
69
|
+
else if (length > this.ioc.intSerializer.INT32_MAX) {
|
|
70
|
+
length = this.ioc.intSerializer.INT32_MAX;
|
|
71
|
+
}
|
|
72
|
+
const bufs = [this.ioc.intSerializer.serialize(length, false)];
|
|
73
|
+
for (let i = 0; i < length; i++) {
|
|
74
|
+
const key = keys[i];
|
|
75
|
+
// fully-qualified key
|
|
76
|
+
bufs.push(this.ioc.anySerializer.serialize(key));
|
|
77
|
+
// bare child tree (no type_code, no value_flag)
|
|
78
|
+
bufs.push(this._serializeValue(tree.childAt(key)));
|
|
79
|
+
}
|
|
80
|
+
return Buffer.concat(bufs);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Async deserialization of tree value bytes from a StreamReader.
|
|
84
|
+
* @param {StreamReader} reader
|
|
85
|
+
* @param {number} valueFlag
|
|
86
|
+
* @param {number} typeCode
|
|
87
|
+
* @returns {Promise<Tree>}
|
|
88
|
+
*/
|
|
89
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
90
|
+
return await this._readTreeValue(reader);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reads a bare tree value: {int length} then length x ( fully-qualified key,
|
|
94
|
+
* bare child tree ). The child recursion reads bare values (no type_code,
|
|
95
|
+
* no value_flag).
|
|
96
|
+
*
|
|
97
|
+
* Duplicate sibling keys are collapsed via {@link Tree#getOrCreateChild} +
|
|
98
|
+
* {@link Tree#addTree} (a server emitting
|
|
99
|
+
* the same sibling key twice yields a single merged entry, not duplicates).
|
|
100
|
+
* @param {StreamReader} reader
|
|
101
|
+
* @returns {Promise<Tree>}
|
|
102
|
+
*/
|
|
103
|
+
async _readTreeValue(reader) {
|
|
104
|
+
const length = await this.ioc.intSerializer.deserializeBare(reader);
|
|
105
|
+
const tree = new Tree();
|
|
106
|
+
for (let i = 0; i < length; i++) {
|
|
107
|
+
// {fully-qualified key} - read with type_code + value_flag.
|
|
108
|
+
const key = await this.ioc.anySerializer.deserialize(reader);
|
|
109
|
+
// {bare child tree} - never null, no type_code / value_flag
|
|
110
|
+
const child = await this._readTreeValue(reader);
|
|
111
|
+
// Merge into any existing entry for this key so duplicate sibling keys
|
|
112
|
+
// collapse into a single entry.
|
|
113
|
+
tree.getOrCreateChild(key).addTree(child);
|
|
114
|
+
}
|
|
115
|
+
return tree;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
119
|
+
* @param {StreamReader} reader
|
|
120
|
+
* @returns {Promise<Tree|null>}
|
|
121
|
+
*/
|
|
122
|
+
async deserialize(reader) {
|
|
123
|
+
const type_code = await reader.readUInt8();
|
|
124
|
+
if (type_code !== this.ioc.DataType.TREE) {
|
|
125
|
+
throw new Error(`TreeSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
126
|
+
}
|
|
127
|
+
const value_flag = await reader.readUInt8();
|
|
128
|
+
if (value_flag === 0x01) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
if (value_flag !== 0x00) {
|
|
132
|
+
throw new Error(`TreeSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
133
|
+
}
|
|
134
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -3,9 +3,11 @@ export default class UnspecifiedNullSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): boolean;
|
|
5
5
|
serialize(item: any): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {StreamReader} reader
|
|
8
|
+
* @param {number} valueFlag - already consumed by AnySerializer (always 0x01 for null)
|
|
9
|
+
* @returns {Promise<null>}
|
|
10
|
+
*/
|
|
11
|
+
deserializeValue(reader: StreamReader, valueFlag: number): Promise<null>;
|
|
10
12
|
}
|
|
11
13
|
import { Buffer } from 'buffer';
|
|
@@ -32,36 +32,13 @@ export default class UnspecifiedNullSerializer {
|
|
|
32
32
|
// fullyQualifiedFormat always is true
|
|
33
33
|
return Buffer.from([this.ioc.DataType.UNSPECIFIED_NULL, 0x01]);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (buffer.length < 1) {
|
|
44
|
-
throw new Error('buffer is empty');
|
|
45
|
-
}
|
|
46
|
-
const type_code = cursor.readUInt8();
|
|
47
|
-
len++;
|
|
48
|
-
if (type_code !== this.ioc.DataType.UNSPECIFIED_NULL) {
|
|
49
|
-
throw new Error('unexpected {type_code}');
|
|
50
|
-
}
|
|
51
|
-
cursor = cursor.slice(1);
|
|
52
|
-
if (cursor.length < 1) {
|
|
53
|
-
throw new Error('{value_flag} is missing');
|
|
54
|
-
}
|
|
55
|
-
const value_flag = cursor.readUInt8();
|
|
56
|
-
len++;
|
|
57
|
-
if (value_flag !== 1) {
|
|
58
|
-
throw new Error('unexpected {value_flag}');
|
|
59
|
-
}
|
|
60
|
-
cursor = cursor.slice(1);
|
|
61
|
-
return { v: null, len };
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
throw this.ioc.utils.des_error({ serializer: this, args: arguments, cursor, err });
|
|
65
|
-
}
|
|
35
|
+
/**
|
|
36
|
+
* @param {StreamReader} reader
|
|
37
|
+
* @param {number} valueFlag - already consumed by AnySerializer (always 0x01 for null)
|
|
38
|
+
* @returns {Promise<null>}
|
|
39
|
+
*/
|
|
40
|
+
// eslint-disable-next-line require-await
|
|
41
|
+
async deserializeValue(reader, valueFlag) {
|
|
42
|
+
throw new Error('UnspecifiedNull should always have value_flag=0x01');
|
|
66
43
|
}
|
|
67
44
|
}
|
|
@@ -3,12 +3,17 @@ export default class UuidSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): void;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {StreamReader} reader
|
|
8
|
+
* @param {number} valueFlag
|
|
9
|
+
* @param {number} typeCode
|
|
10
|
+
* @returns {Promise<string>}
|
|
11
|
+
*/
|
|
12
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* @param {StreamReader} reader
|
|
15
|
+
* @returns {Promise<string|null>}
|
|
16
|
+
*/
|
|
17
|
+
deserialize(reader: StreamReader): Promise<string | null>;
|
|
13
18
|
}
|
|
14
19
|
import { Buffer } from 'buffer';
|
|
@@ -51,56 +51,40 @@ export default class UuidSerializer {
|
|
|
51
51
|
bufs.push(v);
|
|
52
52
|
return 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
|
-
|
|
83
|
-
|
|
84
|
-
cursor = cursor.slice(1);
|
|
85
|
-
}
|
|
86
|
-
if (cursor.length < 16) {
|
|
87
|
-
throw new Error('unexpected {value} length');
|
|
88
|
-
}
|
|
89
|
-
len += 16;
|
|
90
|
-
// Example: 2075278D-F624-4B2B-960D-25D374D57C04
|
|
91
|
-
const v = cursor.slice(0, 4).toString('hex') +
|
|
92
|
-
'-' +
|
|
93
|
-
cursor.slice(4, 6).toString('hex') +
|
|
94
|
-
'-' +
|
|
95
|
-
cursor.slice(6, 8).toString('hex') +
|
|
96
|
-
'-' +
|
|
97
|
-
cursor.slice(8, 10).toString('hex') +
|
|
98
|
-
'-' +
|
|
99
|
-
cursor.slice(10, 16).toString('hex');
|
|
100
|
-
return { v, len };
|
|
54
|
+
/**
|
|
55
|
+
* @param {StreamReader} reader
|
|
56
|
+
* @param {number} valueFlag
|
|
57
|
+
* @param {number} typeCode
|
|
58
|
+
* @returns {Promise<string>}
|
|
59
|
+
*/
|
|
60
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
61
|
+
const bytes = await reader.readBytes(16);
|
|
62
|
+
return (bytes.subarray(0, 4).toString('hex') +
|
|
63
|
+
'-' +
|
|
64
|
+
bytes.subarray(4, 6).toString('hex') +
|
|
65
|
+
'-' +
|
|
66
|
+
bytes.subarray(6, 8).toString('hex') +
|
|
67
|
+
'-' +
|
|
68
|
+
bytes.subarray(8, 10).toString('hex') +
|
|
69
|
+
'-' +
|
|
70
|
+
bytes.subarray(10, 16).toString('hex'));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {StreamReader} reader
|
|
74
|
+
* @returns {Promise<string|null>}
|
|
75
|
+
*/
|
|
76
|
+
async deserialize(reader) {
|
|
77
|
+
const type_code = await reader.readUInt8();
|
|
78
|
+
if (type_code !== this.ioc.DataType.UUID) {
|
|
79
|
+
throw new Error(`UuidSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
80
|
+
}
|
|
81
|
+
const value_flag = await reader.readUInt8();
|
|
82
|
+
if (value_flag === 0x01) {
|
|
83
|
+
return null;
|
|
101
84
|
}
|
|
102
|
-
|
|
103
|
-
throw
|
|
85
|
+
if (value_flag !== 0x00) {
|
|
86
|
+
throw new Error(`UuidSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
104
87
|
}
|
|
88
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
105
89
|
}
|
|
106
90
|
}
|
|
@@ -3,13 +3,20 @@ export default class VertexPropertySerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): value is VertexProperty<any, any, any, any>;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Async deserialization of vertex property value bytes from a StreamReader.
|
|
8
|
+
* @param {StreamReader} reader
|
|
9
|
+
* @param {number} valueFlag
|
|
10
|
+
* @param {number} typeCode
|
|
11
|
+
* @returns {Promise<VertexProperty>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<VertexProperty>;
|
|
14
|
+
/**
|
|
15
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
16
|
+
* @param {StreamReader} reader
|
|
17
|
+
* @returns {Promise<VertexProperty|null>}
|
|
18
|
+
*/
|
|
19
|
+
deserialize(reader: StreamReader): Promise<VertexProperty | null>;
|
|
13
20
|
}
|
|
14
21
|
import { VertexProperty } from '../../../graph.js';
|
|
15
22
|
import { Buffer } from 'buffer';
|
|
@@ -59,102 +59,44 @@ export default class VertexPropertySerializer {
|
|
|
59
59
|
bufs.push(this.ioc.listSerializer.serialize([], true));
|
|
60
60
|
return Buffer.concat(bufs);
|
|
61
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
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
len += id_len;
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
err.message = '{id}: ' + err.message;
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
cursor = cursor.slice(id_len);
|
|
103
|
-
// {label} is a List value
|
|
104
|
-
let label, label_len;
|
|
105
|
-
try {
|
|
106
|
-
({ v: label, len: label_len } = this.ioc.listSerializer.deserialize(cursor, false));
|
|
107
|
-
label = Array.isArray(label) && label.length > 0 ? label[0] : label;
|
|
108
|
-
len += label_len;
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
err.message = '{label}: ' + err.message;
|
|
112
|
-
throw err;
|
|
113
|
-
}
|
|
114
|
-
cursor = cursor.slice(label_len);
|
|
115
|
-
// {value} is a fully qualified typed value composed of {type_code}{type_info}{value_flag}{value}
|
|
116
|
-
let value, value_len;
|
|
117
|
-
try {
|
|
118
|
-
({ v: value, len: value_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
119
|
-
len += value_len;
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
err.message = '{value}: ' + err.message;
|
|
123
|
-
throw err;
|
|
124
|
-
}
|
|
125
|
-
cursor = cursor.slice(value_len);
|
|
126
|
-
// {parent} is a fully qualified typed value composed of {type_code}{type_info}{value_flag}{value} which contains the parent Vertex.
|
|
127
|
-
// Note that as TinkerPop currently send "references" only, this value will always be null.
|
|
128
|
-
let parent_len;
|
|
129
|
-
try {
|
|
130
|
-
({ len: parent_len } = this.ioc.unspecifiedNullSerializer.deserialize(cursor));
|
|
131
|
-
len += parent_len;
|
|
132
|
-
}
|
|
133
|
-
catch (err) {
|
|
134
|
-
err.message = '{parent}: ' + err.message;
|
|
135
|
-
throw err;
|
|
136
|
-
}
|
|
137
|
-
// TODO: should we verify that parent is null?
|
|
138
|
-
cursor = cursor.slice(parent_len);
|
|
139
|
-
// {properties} is a fully qualified typed value composed of {type_code}{type_info}{value_flag}{value} which contains properties. Note that as TinkerPop currently send "references" only, this value will always be null.
|
|
140
|
-
let properties, properties_len;
|
|
141
|
-
try {
|
|
142
|
-
({ v: properties, len: properties_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
143
|
-
len += properties_len;
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
err.message = '{properties}: ' + err.message;
|
|
147
|
-
throw err;
|
|
148
|
-
}
|
|
149
|
-
// TODO: should we verify that properties is null?
|
|
150
|
-
cursor = cursor.slice(properties_len);
|
|
151
|
-
// null properties are deserialized into empty lists
|
|
152
|
-
const vp_props = properties ? properties : [];
|
|
153
|
-
const v = new VertexProperty(id, label, value, vp_props);
|
|
154
|
-
return { v, len };
|
|
62
|
+
/**
|
|
63
|
+
* Async deserialization of vertex property value bytes from a StreamReader.
|
|
64
|
+
* @param {StreamReader} reader
|
|
65
|
+
* @param {number} valueFlag
|
|
66
|
+
* @param {number} typeCode
|
|
67
|
+
* @returns {Promise<VertexProperty>}
|
|
68
|
+
*/
|
|
69
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
70
|
+
// {id} fully qualified
|
|
71
|
+
const id = await this.ioc.anySerializer.deserialize(reader);
|
|
72
|
+
// {label} bare list, extract first element
|
|
73
|
+
const labelList = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
74
|
+
const label = Array.isArray(labelList) && labelList.length > 0 ? labelList[0] : labelList;
|
|
75
|
+
// {value} fully qualified
|
|
76
|
+
const value = await this.ioc.anySerializer.deserialize(reader);
|
|
77
|
+
// {parent} fully qualified (always null in current TinkerPop)
|
|
78
|
+
await this.ioc.anySerializer.deserialize(reader);
|
|
79
|
+
// {properties} fully qualified
|
|
80
|
+
const properties = await this.ioc.anySerializer.deserialize(reader);
|
|
81
|
+
return new VertexProperty(id, label, value, properties || []);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
85
|
+
* @param {StreamReader} reader
|
|
86
|
+
* @returns {Promise<VertexProperty|null>}
|
|
87
|
+
*/
|
|
88
|
+
async deserialize(reader) {
|
|
89
|
+
const type_code = await reader.readUInt8();
|
|
90
|
+
if (type_code !== this.ioc.DataType.VERTEXPROPERTY) {
|
|
91
|
+
throw new Error(`VertexPropertySerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
92
|
+
}
|
|
93
|
+
const value_flag = await reader.readUInt8();
|
|
94
|
+
if (value_flag === 0x01) {
|
|
95
|
+
return null;
|
|
155
96
|
}
|
|
156
|
-
|
|
157
|
-
throw
|
|
97
|
+
if (value_flag !== 0x00) {
|
|
98
|
+
throw new Error(`VertexPropertySerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
158
99
|
}
|
|
100
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
159
101
|
}
|
|
160
102
|
}
|
|
@@ -3,15 +3,20 @@ export default class VertexSerializer {
|
|
|
3
3
|
ioc: any;
|
|
4
4
|
canBeUsedFor(value: any): value is Vertex<any, any, any, any>;
|
|
5
5
|
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Async deserialization of vertex value bytes from a StreamReader.
|
|
8
|
+
* @param {StreamReader} reader
|
|
9
|
+
* @param {number} valueFlag
|
|
10
|
+
* @param {number} typeCode
|
|
11
|
+
* @returns {Promise<Vertex>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<Vertex>;
|
|
14
|
+
/**
|
|
15
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
16
|
+
* @param {StreamReader} reader
|
|
17
|
+
* @returns {Promise<Vertex|null>}
|
|
18
|
+
*/
|
|
19
|
+
deserialize(reader: StreamReader): Promise<Vertex | null>;
|
|
15
20
|
}
|
|
16
21
|
import { Vertex } from '../../../graph.js';
|
|
17
22
|
import { Buffer } from 'buffer';
|