gremlin 3.8.1 → 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/README.md +18 -4
- package/build/cjs/driver/auth.cjs +76 -0
- package/build/cjs/driver/auth.d.cts +9 -0
- package/build/cjs/driver/client.cjs +178 -0
- package/build/cjs/driver/client.d.cts +88 -0
- package/build/cjs/driver/connection.cjs +363 -0
- package/build/cjs/driver/connection.d.cts +106 -0
- 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 +153 -0
- package/build/cjs/driver/driver-remote-connection.d.cts +39 -0
- 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 +72 -0
- package/build/cjs/driver/remote-connection.d.cts +57 -0
- package/build/cjs/driver/request-message.cjs +246 -0
- package/build/cjs/driver/request-message.d.cts +79 -0
- package/build/cjs/driver/response-error.cjs +45 -0
- package/build/cjs/driver/response-error.d.cts +13 -0
- package/build/cjs/driver/result-set.cjs +111 -0
- package/build/cjs/driver/result-set.d.cts +29 -0
- package/build/cjs/index.cjs +146 -0
- package/build/cjs/index.d.cts +440 -0
- package/build/cjs/language/grammar/GremlinLexer.cjs +1905 -0
- package/build/cjs/language/grammar/GremlinLexer.d.cts +349 -0
- package/build/cjs/language/grammar/GremlinListener.cjs +4804 -0
- package/build/cjs/language/grammar/GremlinListener.d.cts +5239 -0
- package/build/cjs/language/grammar/GremlinParser.cjs +38146 -0
- package/build/cjs/language/grammar/GremlinParser.d.cts +6260 -0
- package/build/cjs/language/index.cjs +48 -0
- package/build/cjs/language/index.d.cts +12 -0
- package/build/cjs/language/translator/AnonymizedTranslateVisitor.cjs +166 -0
- package/build/cjs/language/translator/AnonymizedTranslateVisitor.d.cts +39 -0
- package/build/cjs/language/translator/DotNetTranslateVisitor.cjs +935 -0
- package/build/cjs/language/translator/DotNetTranslateVisitor.d.cts +166 -0
- package/build/cjs/language/translator/GoTranslateVisitor.cjs +421 -0
- package/build/cjs/language/translator/GoTranslateVisitor.d.cts +40 -0
- package/build/cjs/language/translator/GremlinTranslator.cjs +96 -0
- package/build/cjs/language/translator/GremlinTranslator.d.cts +18 -0
- package/build/cjs/language/translator/GroovyTranslateVisitor.cjs +310 -0
- package/build/cjs/language/translator/GroovyTranslateVisitor.d.cts +37 -0
- package/build/cjs/language/translator/JavaTranslateVisitor.cjs +270 -0
- package/build/cjs/language/translator/JavaTranslateVisitor.d.cts +26 -0
- package/build/cjs/language/translator/JavascriptTranslateVisitor.cjs +231 -0
- package/build/cjs/language/translator/JavascriptTranslateVisitor.d.cts +28 -0
- package/build/cjs/language/translator/PythonTranslateVisitor.cjs +340 -0
- package/build/cjs/language/translator/PythonTranslateVisitor.d.cts +31 -0
- package/build/cjs/language/translator/TranslateVisitor.cjs +398 -0
- package/build/cjs/language/translator/TranslateVisitor.d.cts +94 -0
- package/build/cjs/language/translator/Translation.cjs +47 -0
- package/build/cjs/language/translator/Translation.d.cts +13 -0
- package/build/cjs/language/translator/Translator.cjs +46 -0
- package/build/cjs/language/translator/Translator.d.cts +24 -0
- package/build/cjs/language/translator/TranslatorException.cjs +31 -0
- package/build/cjs/language/translator/TranslatorException.d.cts +6 -0
- package/build/cjs/process/anonymous-traversal.cjs +82 -0
- package/build/cjs/process/anonymous-traversal.d.cts +40 -0
- package/build/cjs/process/graph-traversal.cjs +1833 -0
- package/build/cjs/process/graph-traversal.d.cts +1215 -0
- package/build/cjs/process/gremlin-lang.cjs +308 -0
- package/build/cjs/process/gremlin-lang.d.cts +20 -0
- package/{lib/driver/response-error.js → build/cjs/process/gvalue.cjs} +23 -28
- package/build/cjs/process/gvalue.d.cts +7 -0
- package/build/cjs/process/transaction.cjs +171 -0
- package/build/cjs/process/transaction.d.cts +70 -0
- package/build/cjs/process/traversal-strategy.cjs +360 -0
- package/build/cjs/process/traversal-strategy.d.cts +211 -0
- package/build/cjs/process/traversal.cjs +539 -0
- package/build/cjs/process/traversal.d.cts +212 -0
- package/build/cjs/structure/PDTRegistry.cjs +116 -0
- package/build/cjs/structure/PDTRegistry.d.cts +34 -0
- package/build/cjs/structure/graph.cjs +500 -0
- package/build/cjs/structure/graph.d.cts +176 -0
- package/build/cjs/structure/io/binary/GraphBinary.cjs +177 -0
- package/build/cjs/structure/io/binary/GraphBinary.d.cts +105 -0
- package/build/cjs/structure/io/binary/internals/AnySerializer.cjs +97 -0
- package/build/cjs/structure/io/binary/internals/AnySerializer.d.cts +18 -0
- package/build/cjs/structure/io/binary/internals/ArraySerializer.cjs +108 -0
- package/build/cjs/structure/io/binary/internals/ArraySerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.cjs +116 -0
- package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/BinarySerializer.cjs +92 -0
- package/build/cjs/structure/io/binary/internals/BinarySerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/BooleanSerializer.cjs +79 -0
- package/build/cjs/structure/io/binary/internals/BooleanSerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/ByteSerializer.cjs +74 -0
- package/build/cjs/structure/io/binary/internals/ByteSerializer.d.cts +18 -0
- 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/DataType.cjs +63 -0
- package/build/cjs/structure/io/binary/internals/DataType.d.cts +35 -0
- package/build/cjs/structure/io/binary/internals/DateTimeSerializer.cjs +122 -0
- package/build/cjs/structure/io/binary/internals/DateTimeSerializer.d.cts +20 -0
- package/build/cjs/structure/io/binary/internals/DoubleSerializer.cjs +77 -0
- package/build/cjs/structure/io/binary/internals/DoubleSerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/EdgeSerializer.cjs +146 -0
- package/build/cjs/structure/io/binary/internals/EdgeSerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/EnumSerializer.cjs +115 -0
- package/build/cjs/structure/io/binary/internals/EnumSerializer.d.cts +39 -0
- package/build/cjs/structure/io/binary/internals/FloatSerializer.cjs +77 -0
- package/build/cjs/structure/io/binary/internals/FloatSerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/GraphBinaryReader.cjs +171 -0
- package/build/cjs/structure/io/binary/internals/GraphBinaryReader.d.cts +43 -0
- package/build/cjs/structure/io/binary/internals/GraphBinaryWriter.cjs +85 -0
- package/build/cjs/structure/io/binary/internals/GraphBinaryWriter.d.cts +9 -0
- 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 +98 -0
- package/build/cjs/structure/io/binary/internals/IntSerializer.d.cts +28 -0
- package/build/cjs/structure/io/binary/internals/LongSerializer.cjs +82 -0
- package/build/cjs/structure/io/binary/internals/LongSerializer.d.cts +20 -0
- package/build/cjs/structure/io/binary/internals/MapSerializer.cjs +110 -0
- package/build/cjs/structure/io/binary/internals/MapSerializer.d.cts +20 -0
- package/build/cjs/structure/io/binary/internals/MarkerSerializer.cjs +60 -0
- package/build/cjs/structure/io/binary/internals/MarkerSerializer.d.cts +17 -0
- package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.cjs +92 -0
- package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.d.cts +6 -0
- package/build/cjs/structure/io/binary/internals/PathSerializer.cjs +88 -0
- package/build/cjs/structure/io/binary/internals/PathSerializer.d.cts +22 -0
- 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 +93 -0
- package/build/cjs/structure/io/binary/internals/PropertySerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/SetSerializer.cjs +104 -0
- package/build/cjs/structure/io/binary/internals/SetSerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/ShortSerializer.cjs +77 -0
- package/build/cjs/structure/io/binary/internals/ShortSerializer.d.cts +19 -0
- 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 +88 -0
- package/build/cjs/structure/io/binary/internals/StringSerializer.d.cts +21 -0
- package/build/cjs/structure/io/binary/internals/StubSerializer.cjs +33 -0
- package/build/cjs/structure/io/binary/internals/StubSerializer.d.cts +7 -0
- 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 +47 -0
- package/build/cjs/structure/io/binary/internals/UnspecifiedNullSerializer.d.cts +13 -0
- package/build/cjs/structure/io/binary/internals/UuidSerializer.cjs +93 -0
- package/build/cjs/structure/io/binary/internals/UuidSerializer.d.cts +19 -0
- package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.cjs +105 -0
- package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/VertexSerializer.cjs +101 -0
- package/build/cjs/structure/io/binary/internals/VertexSerializer.d.cts +22 -0
- package/build/cjs/structure/io/binary/internals/utils.cjs +53 -0
- package/build/cjs/structure/io/binary/internals/utils.d.cts +6 -0
- package/build/cjs/utils.cjs +259 -0
- package/build/cjs/utils.d.cts +78 -0
- package/build/esm/driver/auth.d.ts +9 -0
- package/build/esm/driver/auth.js +72 -0
- package/build/esm/driver/client.d.ts +88 -0
- package/build/esm/driver/client.js +172 -0
- package/build/esm/driver/connection.d.ts +106 -0
- package/build/esm/driver/connection.js +323 -0
- 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 +39 -0
- package/build/esm/driver/driver-remote-connection.js +114 -0
- 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 +57 -0
- package/build/esm/driver/remote-connection.js +66 -0
- package/build/esm/driver/request-message.d.ts +79 -0
- package/build/esm/driver/request-message.js +238 -0
- package/build/esm/driver/response-error.d.ts +13 -0
- package/{lib/driver/auth/mechanisms/sasl-mechanism-base.js → build/esm/driver/response-error.js} +24 -34
- package/build/esm/driver/result-set.d.ts +29 -0
- package/build/esm/driver/result-set.js +75 -0
- package/build/esm/index.d.ts +440 -0
- package/{index.js → build/esm/index.js} +44 -33
- package/build/esm/language/grammar/GremlinLexer.d.ts +349 -0
- package/build/esm/language/grammar/GremlinLexer.js +1868 -0
- package/build/esm/language/grammar/GremlinListener.d.ts +5239 -0
- package/build/esm/language/grammar/GremlinListener.js +4800 -0
- package/build/esm/language/grammar/GremlinParser.d.ts +6260 -0
- package/build/esm/language/grammar/GremlinParser.js +37579 -0
- package/build/esm/language/index.d.ts +12 -0
- package/build/esm/language/index.js +30 -0
- package/build/esm/language/translator/AnonymizedTranslateVisitor.d.ts +39 -0
- package/build/esm/language/translator/AnonymizedTranslateVisitor.js +160 -0
- package/build/esm/language/translator/DotNetTranslateVisitor.d.ts +166 -0
- package/build/esm/language/translator/DotNetTranslateVisitor.js +929 -0
- package/build/esm/language/translator/GoTranslateVisitor.d.ts +40 -0
- package/build/esm/language/translator/GoTranslateVisitor.js +415 -0
- package/build/esm/language/translator/GremlinTranslator.d.ts +18 -0
- package/build/esm/language/translator/GremlinTranslator.js +89 -0
- package/build/esm/language/translator/GroovyTranslateVisitor.d.ts +37 -0
- package/build/esm/language/translator/GroovyTranslateVisitor.js +304 -0
- package/build/esm/language/translator/JavaTranslateVisitor.d.ts +26 -0
- package/build/esm/language/translator/JavaTranslateVisitor.js +264 -0
- package/build/esm/language/translator/JavascriptTranslateVisitor.d.ts +28 -0
- package/build/esm/language/translator/JavascriptTranslateVisitor.js +225 -0
- package/build/esm/language/translator/PythonTranslateVisitor.d.ts +31 -0
- package/build/esm/language/translator/PythonTranslateVisitor.js +334 -0
- package/build/esm/language/translator/TranslateVisitor.d.ts +94 -0
- package/build/esm/language/translator/TranslateVisitor.js +395 -0
- package/build/esm/language/translator/Translation.d.ts +13 -0
- package/build/esm/language/translator/Translation.js +43 -0
- package/build/esm/language/translator/Translator.d.ts +24 -0
- package/build/esm/language/translator/Translator.js +40 -0
- package/build/esm/language/translator/TranslatorException.d.ts +6 -0
- package/build/esm/language/translator/TranslatorException.js +27 -0
- package/build/esm/process/anonymous-traversal.d.ts +40 -0
- package/build/esm/process/anonymous-traversal.js +76 -0
- package/build/esm/process/graph-traversal.d.ts +1215 -0
- package/build/esm/process/graph-traversal.js +1824 -0
- package/build/esm/process/gremlin-lang.d.ts +20 -0
- package/build/esm/process/gremlin-lang.js +305 -0
- package/build/esm/process/gvalue.d.ts +7 -0
- package/{lib/driver/auth/authenticator.js → build/esm/process/gvalue.js} +19 -19
- package/build/esm/process/transaction.d.ts +70 -0
- package/build/esm/process/transaction.js +164 -0
- package/build/esm/process/traversal-strategy.d.ts +211 -0
- package/build/esm/process/traversal-strategy.js +319 -0
- package/build/esm/process/traversal.d.ts +212 -0
- package/build/esm/process/traversal.js +526 -0
- package/build/esm/structure/PDTRegistry.d.ts +34 -0
- package/build/esm/structure/PDTRegistry.js +112 -0
- package/build/esm/structure/graph.d.ts +176 -0
- package/build/esm/structure/graph.js +488 -0
- package/build/esm/structure/io/binary/GraphBinary.d.ts +105 -0
- package/build/esm/structure/io/binary/GraphBinary.js +136 -0
- package/build/esm/structure/io/binary/internals/AnySerializer.d.ts +18 -0
- package/build/esm/structure/io/binary/internals/AnySerializer.js +94 -0
- package/build/esm/structure/io/binary/internals/ArraySerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/ArraySerializer.js +105 -0
- package/build/esm/structure/io/binary/internals/BigIntegerSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/BigIntegerSerializer.js +113 -0
- package/build/esm/structure/io/binary/internals/BinarySerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/BinarySerializer.js +89 -0
- package/build/esm/structure/io/binary/internals/BooleanSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/BooleanSerializer.js +76 -0
- package/build/esm/structure/io/binary/internals/ByteSerializer.d.ts +18 -0
- package/build/esm/structure/io/binary/internals/ByteSerializer.js +71 -0
- 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/DataType.d.ts +35 -0
- package/build/esm/structure/io/binary/internals/DataType.js +61 -0
- package/build/esm/structure/io/binary/internals/DateTimeSerializer.d.ts +20 -0
- package/build/esm/structure/io/binary/internals/DateTimeSerializer.js +119 -0
- package/build/esm/structure/io/binary/internals/DoubleSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/DoubleSerializer.js +74 -0
- package/build/esm/structure/io/binary/internals/EdgeSerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/EdgeSerializer.js +143 -0
- package/build/esm/structure/io/binary/internals/EnumSerializer.d.ts +39 -0
- package/build/esm/structure/io/binary/internals/EnumSerializer.js +112 -0
- package/build/esm/structure/io/binary/internals/FloatSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/FloatSerializer.js +74 -0
- package/build/esm/structure/io/binary/internals/GraphBinaryReader.d.ts +43 -0
- package/build/esm/structure/io/binary/internals/GraphBinaryReader.js +165 -0
- package/build/esm/structure/io/binary/internals/GraphBinaryWriter.d.ts +9 -0
- package/build/esm/structure/io/binary/internals/GraphBinaryWriter.js +82 -0
- 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 +28 -0
- package/build/esm/structure/io/binary/internals/IntSerializer.js +95 -0
- package/build/esm/structure/io/binary/internals/LongSerializer.d.ts +20 -0
- package/build/esm/structure/io/binary/internals/LongSerializer.js +79 -0
- package/build/esm/structure/io/binary/internals/MapSerializer.d.ts +20 -0
- package/build/esm/structure/io/binary/internals/MapSerializer.js +107 -0
- package/build/esm/structure/io/binary/internals/MarkerSerializer.d.ts +17 -0
- package/build/esm/structure/io/binary/internals/MarkerSerializer.js +56 -0
- package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.d.ts +6 -0
- package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.js +89 -0
- package/build/esm/structure/io/binary/internals/PathSerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/PathSerializer.js +85 -0
- 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 +22 -0
- package/build/esm/structure/io/binary/internals/PropertySerializer.js +90 -0
- package/build/esm/structure/io/binary/internals/SetSerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/SetSerializer.js +101 -0
- package/build/esm/structure/io/binary/internals/ShortSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/ShortSerializer.js +74 -0
- 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 +21 -0
- package/build/esm/structure/io/binary/internals/StringSerializer.js +85 -0
- package/build/esm/structure/io/binary/internals/StubSerializer.d.ts +7 -0
- package/{.prettierrc.js → build/esm/structure/io/binary/internals/StubSerializer.js} +12 -11
- 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 +13 -0
- package/build/esm/structure/io/binary/internals/UnspecifiedNullSerializer.js +44 -0
- package/build/esm/structure/io/binary/internals/UuidSerializer.d.ts +19 -0
- package/build/esm/structure/io/binary/internals/UuidSerializer.js +90 -0
- package/build/esm/structure/io/binary/internals/VertexPropertySerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/VertexPropertySerializer.js +102 -0
- package/build/esm/structure/io/binary/internals/VertexSerializer.d.ts +22 -0
- package/build/esm/structure/io/binary/internals/VertexSerializer.js +98 -0
- package/build/esm/structure/io/binary/internals/utils.d.ts +6 -0
- package/{lib → build/esm}/structure/io/binary/internals/utils.js +23 -35
- package/build/esm/utils.d.ts +78 -0
- package/build/esm/utils.js +237 -0
- package/package.json +71 -26
- package/.nvmrc +0 -1
- package/NOTICE +0 -5
- package/doc/AnonymousTraversalSource.html +0 -793
- package/doc/Authenticator.html +0 -303
- package/doc/Bytecode.html +0 -941
- package/doc/CardinalityValue.html +0 -711
- package/doc/Client.html +0 -1869
- package/doc/Connection.html +0 -1192
- package/doc/DriverRemoteConnection.html +0 -1528
- package/doc/EdgeLabelVerificationStrategy.html +0 -238
- package/doc/Graph.html +0 -343
- package/doc/GraphSON2Reader.html +0 -407
- package/doc/GraphSON2Writer.html +0 -558
- package/doc/GraphSON3Reader.html +0 -170
- package/doc/GraphSON3Writer.html +0 -170
- package/doc/GraphTraversal.html +0 -22974
- package/doc/GraphTraversalSource.html +0 -3683
- package/doc/HaltedTraverserStrategy.html +0 -215
- package/doc/MatchAlgorithmStrategy.html +0 -210
- package/doc/P.html +0 -2020
- package/doc/PartitionStrategy.html +0 -387
- package/doc/Path.html +0 -242
- package/doc/PlainTextSaslAuthenticator.html +0 -456
- package/doc/ProductiveByStrategy.html +0 -258
- package/doc/RemoteConnection.html +0 -1086
- package/doc/RemoteStrategy.html +0 -307
- package/doc/RemoteTraversal.html +0 -170
- package/doc/ReservedKeysVerificationStrategy.html +0 -261
- package/doc/ResponseError.html +0 -360
- package/doc/ResultSet.html +0 -633
- package/doc/SaslAuthenticator.html +0 -455
- package/doc/SaslMechanismBase.html +0 -506
- package/doc/SaslMechanismPlain.html +0 -925
- package/doc/SeedStrategy.html +0 -288
- package/doc/SubgraphStrategy.html +0 -387
- package/doc/TextP.html +0 -1440
- package/doc/Transaction.html +0 -655
- package/doc/Translator.html +0 -527
- package/doc/TraversalStrategies.html +0 -652
- package/doc/TraversalStrategy.html +0 -393
- package/doc/TypeSerializer.html +0 -166
- package/doc/driver_auth_authenticator.js.html +0 -89
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +0 -103
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +0 -157
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +0 -106
- package/doc/driver_auth_sasl-authenticator.js.html +0 -100
- package/doc/driver_client.js.html +0 -250
- package/doc/driver_connection.js.html +0 -518
- package/doc/driver_driver-remote-connection.js.html +0 -193
- package/doc/driver_remote-connection.js.html +0 -198
- package/doc/driver_response-error.js.html +0 -98
- package/doc/driver_result-set.js.html +0 -134
- package/doc/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/doc/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/doc/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/doc/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/doc/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Light-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/doc/fonts/OpenSans-Light-webfont.woff +0 -0
- package/doc/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/doc/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/doc/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/doc/global.html +0 -728
- package/doc/index.html +0 -185
- package/doc/module.exports.html +0 -301
- package/doc/process_anonymous-traversal.js.html +0 -138
- package/doc/process_bytecode.js.html +0 -175
- package/doc/process_graph-traversal.js.html +0 -1936
- package/doc/process_transaction.js.html +0 -151
- package/doc/process_translator.js.html +0 -172
- package/doc/process_traversal-strategy.js.html +0 -466
- package/doc/process_traversal.js.html +0 -592
- package/doc/scripts/linenumber.js +0 -25
- package/doc/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/doc/scripts/prettify/lang-css.js +0 -2
- package/doc/scripts/prettify/prettify.js +0 -28
- package/doc/structure_graph.js.html +0 -233
- package/doc/structure_io_binary_internals_DataType.js.html +0 -151
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +0 -133
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +0 -136
- package/doc/structure_io_graph-serializer.js.html +0 -354
- package/doc/structure_io_type-serializers.js.html +0 -617
- package/doc/styles/jsdoc-default.css +0 -358
- package/doc/styles/prettify-jsdoc.css +0 -111
- package/doc/styles/prettify-tomorrow.css +0 -132
- package/doc/utils.js.html +0 -181
- package/docker-compose.yml +0 -76
- package/eslint.config.mjs +0 -143
- package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +0 -106
- package/lib/driver/auth/plain-text-sasl-authenticator.js +0 -55
- package/lib/driver/auth/sasl-authenticator.js +0 -49
- package/lib/driver/client.js +0 -199
- package/lib/driver/connection.js +0 -467
- package/lib/driver/driver-remote-connection.js +0 -142
- package/lib/driver/remote-connection.js +0 -147
- package/lib/driver/result-set.js +0 -83
- package/lib/process/anonymous-traversal.js +0 -87
- package/lib/process/bytecode.js +0 -124
- package/lib/process/graph-traversal.js +0 -1885
- package/lib/process/transaction.js +0 -100
- package/lib/process/translator.js +0 -121
- package/lib/process/traversal-strategy.js +0 -415
- package/lib/process/traversal.js +0 -541
- package/lib/structure/graph.js +0 -182
- package/lib/structure/io/binary/GraphBinary.js +0 -110
- package/lib/structure/io/binary/internals/AnySerializer.js +0 -100
- package/lib/structure/io/binary/internals/ArraySerializer.js +0 -137
- package/lib/structure/io/binary/internals/BigIntegerSerializer.js +0 -153
- package/lib/structure/io/binary/internals/BooleanSerializer.js +0 -105
- package/lib/structure/io/binary/internals/BulkSetSerializer.js +0 -126
- package/lib/structure/io/binary/internals/ByteBufferSerializer.js +0 -126
- package/lib/structure/io/binary/internals/ByteSerializer.js +0 -97
- package/lib/structure/io/binary/internals/BytecodeSerializer.js +0 -250
- package/lib/structure/io/binary/internals/ClassSerializer.js +0 -60
- package/lib/structure/io/binary/internals/DataType.js +0 -100
- package/lib/structure/io/binary/internals/DateSerializer.js +0 -105
- package/lib/structure/io/binary/internals/DoubleSerializer.js +0 -101
- package/lib/structure/io/binary/internals/EdgeSerializer.js +0 -216
- package/lib/structure/io/binary/internals/EnumSerializer.js +0 -152
- package/lib/structure/io/binary/internals/FloatSerializer.js +0 -101
- package/lib/structure/io/binary/internals/GraphBinaryReader.js +0 -82
- package/lib/structure/io/binary/internals/GraphBinaryWriter.js +0 -85
- package/lib/structure/io/binary/internals/IntSerializer.js +0 -114
- package/lib/structure/io/binary/internals/LambdaSerializer.js +0 -71
- package/lib/structure/io/binary/internals/LongSerializer.js +0 -109
- package/lib/structure/io/binary/internals/LongSerializerNg.js +0 -104
- package/lib/structure/io/binary/internals/MapSerializer.js +0 -155
- package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +0 -73
- package/lib/structure/io/binary/internals/OffsetDateTimeSerializer.js +0 -151
- package/lib/structure/io/binary/internals/PSerializer.js +0 -152
- package/lib/structure/io/binary/internals/PathSerializer.js +0 -124
- package/lib/structure/io/binary/internals/PropertySerializer.js +0 -142
- package/lib/structure/io/binary/internals/SetSerializer.js +0 -134
- package/lib/structure/io/binary/internals/ShortSerializer.js +0 -101
- package/lib/structure/io/binary/internals/StringSerializer.js +0 -116
- package/lib/structure/io/binary/internals/TextPSerializer.js +0 -146
- package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +0 -69
- package/lib/structure/io/binary/internals/TraverserSerializer.js +0 -124
- package/lib/structure/io/binary/internals/UnspecifiedNullSerializer.js +0 -77
- package/lib/structure/io/binary/internals/UuidSerializer.js +0 -121
- package/lib/structure/io/binary/internals/VertexPropertySerializer.js +0 -176
- package/lib/structure/io/binary/internals/VertexSerializer.js +0 -139
- package/lib/structure/io/graph-serializer.js +0 -303
- package/lib/structure/io/type-serializers.js +0 -566
- package/lib/utils.js +0 -130
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
/**
|
|
25
|
+
* @author Igor Ostapenko
|
|
26
|
+
*/
|
|
27
|
+
const buffer_1 = require("node:buffer");
|
|
28
|
+
const StreamReader_js_1 = __importDefault(require("./StreamReader.cjs"));
|
|
29
|
+
const MarkerSerializer_js_1 = require("./MarkerSerializer.cjs");
|
|
30
|
+
const traversal_js_1 = require("../../../../process/traversal.cjs");
|
|
31
|
+
const response_error_js_1 = __importDefault(require("../../../../driver/response-error.cjs"));
|
|
32
|
+
/** GraphBinary response status codes. */
|
|
33
|
+
const StatusCode = {
|
|
34
|
+
SUCCESS: 200,
|
|
35
|
+
NO_CONTENT: 204,
|
|
36
|
+
PARTIAL_CONTENT: 206,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* GraphBinary reader.
|
|
40
|
+
*/
|
|
41
|
+
class GraphBinaryReader {
|
|
42
|
+
constructor(ioc) {
|
|
43
|
+
this.ioc = ioc;
|
|
44
|
+
this.pdtRegistry = null;
|
|
45
|
+
}
|
|
46
|
+
get mimeType() {
|
|
47
|
+
return 'application/vnd.graphbinary-v4.0';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read a complete response from a Buffer. Used by the non-streaming submit() path.
|
|
51
|
+
* Returns the full { status, result } object after reading all data.
|
|
52
|
+
* @param {Buffer} buffer
|
|
53
|
+
* @returns {Promise<{status: {code, message, exception}, result: {data: any[], bulked: boolean}}>}
|
|
54
|
+
*/
|
|
55
|
+
async readResponse(buffer) {
|
|
56
|
+
if (buffer === undefined || buffer === null) {
|
|
57
|
+
throw new Error('Buffer is missing.');
|
|
58
|
+
}
|
|
59
|
+
if (!(buffer instanceof buffer_1.Buffer)) {
|
|
60
|
+
throw new Error('Not an instance of Buffer.');
|
|
61
|
+
}
|
|
62
|
+
if (buffer.length < 1) {
|
|
63
|
+
throw new Error('Buffer is empty.');
|
|
64
|
+
}
|
|
65
|
+
const reader = StreamReader_js_1.default.fromBuffer(buffer);
|
|
66
|
+
reader.pdtRegistry = this.pdtRegistry;
|
|
67
|
+
return await this.#readFromReader(reader);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Stream results from a StreamReader, yielding each value as it's deserialized.
|
|
71
|
+
* Used by the streaming Connection.stream() path.
|
|
72
|
+
*
|
|
73
|
+
* Note: In the GraphBinary v4 streaming protocol, the status (including error codes)
|
|
74
|
+
* is sent *after* all result data. This means values are yielded to the consumer as
|
|
75
|
+
* they arrive, and a server error is only thrown after all values have been yielded.
|
|
76
|
+
* Consumers should be aware that partial results may have been processed before a
|
|
77
|
+
* ResponseError is thrown.
|
|
78
|
+
*
|
|
79
|
+
* @param {StreamReader} reader
|
|
80
|
+
* @returns {AsyncGenerator<any>}
|
|
81
|
+
*/
|
|
82
|
+
async *readResponseStream(reader) {
|
|
83
|
+
reader.pdtRegistry = this.pdtRegistry;
|
|
84
|
+
// {version}
|
|
85
|
+
const version = await reader.readUInt8();
|
|
86
|
+
if (version !== 0x84) {
|
|
87
|
+
throw new Error(`Unsupported version '${version}'.`);
|
|
88
|
+
}
|
|
89
|
+
// {bulked}
|
|
90
|
+
const bulked = (await reader.readUInt8()) === 0x01;
|
|
91
|
+
// {result_data} stream — yield values until EndOfStream marker
|
|
92
|
+
while (true) {
|
|
93
|
+
const value = await this.ioc.anySerializer.deserialize(reader);
|
|
94
|
+
if (value === MarkerSerializer_js_1.END_OF_STREAM) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (bulked) {
|
|
98
|
+
const bulk = await this.ioc.longSerializer.deserialize(reader);
|
|
99
|
+
yield new traversal_js_1.Traverser(value, Number(bulk));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
yield value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// {status_code} {status_message} {exception}
|
|
106
|
+
const status = await this.#readStatus(reader);
|
|
107
|
+
if (status.code &&
|
|
108
|
+
status.code !== StatusCode.SUCCESS &&
|
|
109
|
+
status.code !== StatusCode.NO_CONTENT &&
|
|
110
|
+
status.code !== StatusCode.PARTIAL_CONTENT) {
|
|
111
|
+
throw new response_error_js_1.default(`Server error: ${status.message || 'Unknown error'} (${status.code})`, {
|
|
112
|
+
code: status.code,
|
|
113
|
+
message: status.message || '',
|
|
114
|
+
exception: status.exception,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Attach status to the generator's return value
|
|
118
|
+
return status;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Internal: read the full response into a collected result (non-streaming).
|
|
122
|
+
*/
|
|
123
|
+
async #readFromReader(reader) {
|
|
124
|
+
// {version}
|
|
125
|
+
const version = await reader.readUInt8();
|
|
126
|
+
if (version !== 0x84) {
|
|
127
|
+
throw new Error(`Unsupported version '${version}'.`);
|
|
128
|
+
}
|
|
129
|
+
// {bulked}
|
|
130
|
+
const bulked = (await reader.readUInt8()) === 0x01;
|
|
131
|
+
// {result_data} — collect all values
|
|
132
|
+
const data = [];
|
|
133
|
+
while (true) {
|
|
134
|
+
const value = await this.ioc.anySerializer.deserialize(reader);
|
|
135
|
+
if (value === MarkerSerializer_js_1.END_OF_STREAM) {
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
if (bulked) {
|
|
139
|
+
const bulk = await this.ioc.longSerializer.deserialize(reader);
|
|
140
|
+
data.push({ v: value, bulk: Number(bulk) });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
data.push(value);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// {status}
|
|
147
|
+
const status = await this.#readStatus(reader);
|
|
148
|
+
return {
|
|
149
|
+
status,
|
|
150
|
+
result: { data, bulked },
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Read the status block: {code:Int bare}{message:nullable String}{exception:nullable String}
|
|
155
|
+
*/
|
|
156
|
+
async #readStatus(reader) {
|
|
157
|
+
const code = await reader.readInt32BE();
|
|
158
|
+
let message = null;
|
|
159
|
+
const msgFlag = await reader.readUInt8();
|
|
160
|
+
if (msgFlag === 0x00) {
|
|
161
|
+
message = await this.ioc.stringSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.STRING);
|
|
162
|
+
}
|
|
163
|
+
let exception = null;
|
|
164
|
+
const excFlag = await reader.readUInt8();
|
|
165
|
+
if (excFlag === 0x00) {
|
|
166
|
+
exception = await this.ioc.stringSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.STRING);
|
|
167
|
+
}
|
|
168
|
+
return { code, message, exception };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.default = GraphBinaryReader;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphBinary reader.
|
|
3
|
+
*/
|
|
4
|
+
export default class GraphBinaryReader {
|
|
5
|
+
constructor(ioc: any);
|
|
6
|
+
ioc: any;
|
|
7
|
+
pdtRegistry: any;
|
|
8
|
+
get mimeType(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Read a complete response from a Buffer. Used by the non-streaming submit() path.
|
|
11
|
+
* Returns the full { status, result } object after reading all data.
|
|
12
|
+
* @param {Buffer} buffer
|
|
13
|
+
* @returns {Promise<{status: {code, message, exception}, result: {data: any[], bulked: boolean}}>}
|
|
14
|
+
*/
|
|
15
|
+
readResponse(buffer: Buffer): Promise<{
|
|
16
|
+
status: {
|
|
17
|
+
code: any;
|
|
18
|
+
message: any;
|
|
19
|
+
exception: any;
|
|
20
|
+
};
|
|
21
|
+
result: {
|
|
22
|
+
data: any[];
|
|
23
|
+
bulked: boolean;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Stream results from a StreamReader, yielding each value as it's deserialized.
|
|
28
|
+
* Used by the streaming Connection.stream() path.
|
|
29
|
+
*
|
|
30
|
+
* Note: In the GraphBinary v4 streaming protocol, the status (including error codes)
|
|
31
|
+
* is sent *after* all result data. This means values are yielded to the consumer as
|
|
32
|
+
* they arrive, and a server error is only thrown after all values have been yielded.
|
|
33
|
+
* Consumers should be aware that partial results may have been processed before a
|
|
34
|
+
* ResponseError is thrown.
|
|
35
|
+
*
|
|
36
|
+
* @param {StreamReader} reader
|
|
37
|
+
* @returns {AsyncGenerator<any>}
|
|
38
|
+
*/
|
|
39
|
+
readResponseStream(reader: StreamReader): AsyncGenerator<any>;
|
|
40
|
+
#private;
|
|
41
|
+
}
|
|
42
|
+
import { Buffer } from 'buffer';
|
|
43
|
+
import StreamReader from './StreamReader.cjs';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
/**
|
|
22
|
+
* @author Igor Ostapenko
|
|
23
|
+
*/
|
|
24
|
+
const buffer_1 = require("node:buffer");
|
|
25
|
+
/**
|
|
26
|
+
* GraphBinary writer.
|
|
27
|
+
*/
|
|
28
|
+
class GraphBinaryWriter {
|
|
29
|
+
constructor(ioc) {
|
|
30
|
+
this.ioc = ioc;
|
|
31
|
+
}
|
|
32
|
+
get mimeType() {
|
|
33
|
+
return 'application/vnd.graphbinary-v4.0';
|
|
34
|
+
}
|
|
35
|
+
writeRequest(requestMessage) {
|
|
36
|
+
const fields = new Map();
|
|
37
|
+
// Extract fields from RequestMessage if it has getter methods
|
|
38
|
+
if (typeof requestMessage.getLanguage === 'function') {
|
|
39
|
+
const language = requestMessage.getLanguage();
|
|
40
|
+
if (language) {
|
|
41
|
+
fields.set('language', language);
|
|
42
|
+
}
|
|
43
|
+
const g = requestMessage.getG();
|
|
44
|
+
if (g) {
|
|
45
|
+
fields.set('g', g);
|
|
46
|
+
}
|
|
47
|
+
const parameters = requestMessage.getParameters();
|
|
48
|
+
if (parameters && Object.keys(parameters).length > 0) {
|
|
49
|
+
fields.set('parameters', parameters);
|
|
50
|
+
}
|
|
51
|
+
const timeoutMillis = requestMessage.getTimeoutMillis();
|
|
52
|
+
if (timeoutMillis !== undefined) {
|
|
53
|
+
fields.set('timeoutMillis', timeoutMillis);
|
|
54
|
+
}
|
|
55
|
+
const materializeProperties = requestMessage.getMaterializeProperties();
|
|
56
|
+
if (materializeProperties) {
|
|
57
|
+
fields.set('materializeProperties', materializeProperties);
|
|
58
|
+
}
|
|
59
|
+
const bulkResults = requestMessage.getBulkResults();
|
|
60
|
+
if (bulkResults !== undefined) {
|
|
61
|
+
fields.set('bulkResults', bulkResults);
|
|
62
|
+
}
|
|
63
|
+
// Add any custom fields
|
|
64
|
+
const customFields = requestMessage.getFields();
|
|
65
|
+
if (customFields) {
|
|
66
|
+
customFields.forEach((v, k) => fields.set(k, v));
|
|
67
|
+
}
|
|
68
|
+
const gremlin = requestMessage.getGremlin();
|
|
69
|
+
const bufs = [
|
|
70
|
+
buffer_1.Buffer.from([0x84]),
|
|
71
|
+
this.ioc.mapSerializer.serialize(fields, false),
|
|
72
|
+
this.ioc.stringSerializer.serialize(gremlin, false),
|
|
73
|
+
];
|
|
74
|
+
return new Uint8Array(buffer_1.Buffer.concat(bufs));
|
|
75
|
+
}
|
|
76
|
+
// Legacy path: plain object with { gremlin, fields }
|
|
77
|
+
const bufs = [
|
|
78
|
+
buffer_1.Buffer.from([0x84]),
|
|
79
|
+
this.ioc.mapSerializer.serialize(requestMessage.fields || new Map(), false),
|
|
80
|
+
this.ioc.stringSerializer.serialize(requestMessage.gremlin, false),
|
|
81
|
+
];
|
|
82
|
+
return new Uint8Array(buffer_1.Buffer.concat(bufs));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = GraphBinaryWriter;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const buffer_1 = require("node:buffer");
|
|
22
|
+
const graph_js_1 = require("../../../graph.cjs");
|
|
23
|
+
class GraphSerializer {
|
|
24
|
+
constructor(ioc) {
|
|
25
|
+
this.ioc = ioc;
|
|
26
|
+
this.ioc.serializers[ioc.DataType.GRAPH] = this;
|
|
27
|
+
}
|
|
28
|
+
canBeUsedFor(value) {
|
|
29
|
+
return value instanceof graph_js_1.Graph;
|
|
30
|
+
}
|
|
31
|
+
serialize(item, fullyQualifiedFormat = true) {
|
|
32
|
+
if (item === undefined || item === null) {
|
|
33
|
+
if (fullyQualifiedFormat) {
|
|
34
|
+
return buffer_1.Buffer.from([this.ioc.DataType.GRAPH, 0x01]);
|
|
35
|
+
}
|
|
36
|
+
// value-only null fallback: zero vertices + zero edges
|
|
37
|
+
const zeroInt = [0x00, 0x00, 0x00, 0x00];
|
|
38
|
+
return buffer_1.Buffer.from([...zeroInt, ...zeroInt]);
|
|
39
|
+
}
|
|
40
|
+
const bufs = [];
|
|
41
|
+
if (fullyQualifiedFormat) {
|
|
42
|
+
bufs.push(buffer_1.Buffer.from([this.ioc.DataType.GRAPH, 0x00]));
|
|
43
|
+
}
|
|
44
|
+
const vertices = item.vertices ? Array.from(item.vertices.values()) : [];
|
|
45
|
+
const edges = item.edges ? Array.from(item.edges.values()) : [];
|
|
46
|
+
// {vertex_count}
|
|
47
|
+
bufs.push(this.ioc.intSerializer.serialize(vertices.length, false));
|
|
48
|
+
// vertices
|
|
49
|
+
for (const v of vertices) {
|
|
50
|
+
// {id}
|
|
51
|
+
bufs.push(this.ioc.anySerializer.serialize(v.id));
|
|
52
|
+
// {label} as list (value-only)
|
|
53
|
+
const vLabels = v.labels instanceof Set ? Array.from(v.labels) : [v.label];
|
|
54
|
+
bufs.push(this.ioc.listSerializer.serialize(vLabels, false));
|
|
55
|
+
const vps = Array.isArray(v.properties) ? v.properties : [];
|
|
56
|
+
// {vp_count}
|
|
57
|
+
bufs.push(this.ioc.intSerializer.serialize(vps.length, false));
|
|
58
|
+
for (const vp of vps) {
|
|
59
|
+
// {vp_id}
|
|
60
|
+
bufs.push(this.ioc.anySerializer.serialize(vp.id));
|
|
61
|
+
// {vp_label} as 1-element list (value-only)
|
|
62
|
+
bufs.push(this.ioc.listSerializer.serialize([vp.label], false));
|
|
63
|
+
// {vp_value}
|
|
64
|
+
bufs.push(this.ioc.anySerializer.serialize(vp.value));
|
|
65
|
+
// {parent} (always null)
|
|
66
|
+
bufs.push(this.ioc.unspecifiedNullSerializer.serialize(null));
|
|
67
|
+
// {meta_props} as value-only List<Property>
|
|
68
|
+
const metaProps = Array.isArray(vp.properties) ? vp.properties : [];
|
|
69
|
+
bufs.push(this.ioc.listSerializer.serialize(metaProps, false));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// {edge_count}
|
|
73
|
+
bufs.push(this.ioc.intSerializer.serialize(edges.length, false));
|
|
74
|
+
// edges
|
|
75
|
+
for (const e of edges) {
|
|
76
|
+
// {id}
|
|
77
|
+
bufs.push(this.ioc.anySerializer.serialize(e.id));
|
|
78
|
+
// {label} as list (value-only)
|
|
79
|
+
const eLabels = e.labels instanceof Set ? Array.from(e.labels) : [e.label];
|
|
80
|
+
bufs.push(this.ioc.listSerializer.serialize(eLabels, false));
|
|
81
|
+
// {inV_id}
|
|
82
|
+
bufs.push(this.ioc.anySerializer.serialize(e.inV && e.inV.id));
|
|
83
|
+
// {inV_label} (always null placeholder, fully-qualified)
|
|
84
|
+
bufs.push(this.ioc.unspecifiedNullSerializer.serialize(null));
|
|
85
|
+
// {outV_id}
|
|
86
|
+
bufs.push(this.ioc.anySerializer.serialize(e.outV && e.outV.id));
|
|
87
|
+
// {outV_label} (always null placeholder, fully-qualified)
|
|
88
|
+
bufs.push(this.ioc.unspecifiedNullSerializer.serialize(null));
|
|
89
|
+
// {parent} (always null)
|
|
90
|
+
bufs.push(this.ioc.unspecifiedNullSerializer.serialize(null));
|
|
91
|
+
// {edge_props} as value-only List<Property>
|
|
92
|
+
const props = Array.isArray(e.properties) ? e.properties : [];
|
|
93
|
+
bufs.push(this.ioc.listSerializer.serialize(props, false));
|
|
94
|
+
}
|
|
95
|
+
return buffer_1.Buffer.concat(bufs);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Async deserialization of graph value bytes from a StreamReader.
|
|
99
|
+
* @param {StreamReader} reader
|
|
100
|
+
* @param {number} valueFlag
|
|
101
|
+
* @param {number} typeCode
|
|
102
|
+
* @returns {Promise<Graph>}
|
|
103
|
+
*/
|
|
104
|
+
async deserializeValue(reader, valueFlag, typeCode) {
|
|
105
|
+
const graph = new graph_js_1.Graph();
|
|
106
|
+
// {vertex_count} bare int
|
|
107
|
+
const vertexCount = await this.ioc.intSerializer.deserializeBare(reader);
|
|
108
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
109
|
+
// {id} fully qualified
|
|
110
|
+
const vId = await this.ioc.anySerializer.deserialize(reader);
|
|
111
|
+
// {label} value-only list - full multi-label list
|
|
112
|
+
const vLabelList = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
113
|
+
const vLabels = Array.isArray(vLabelList) ? vLabelList : vLabelList ? [vLabelList] : [];
|
|
114
|
+
const vLabel = vLabels.length > 0 ? vLabels[0] : 'vertex';
|
|
115
|
+
const vertex = new graph_js_1.Vertex(vId, vLabel, [], vLabels);
|
|
116
|
+
graph.vertices.set(vId, vertex);
|
|
117
|
+
// {vp_count} bare int
|
|
118
|
+
const vpCount = await this.ioc.intSerializer.deserializeBare(reader);
|
|
119
|
+
for (let j = 0; j < vpCount; j++) {
|
|
120
|
+
// {vp_id} fully qualified
|
|
121
|
+
const vpId = await this.ioc.anySerializer.deserialize(reader);
|
|
122
|
+
// {vp_label} value-only list, first element
|
|
123
|
+
const vpLabelList = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
124
|
+
const vpLabel = Array.isArray(vpLabelList) && vpLabelList.length > 0 ? vpLabelList[0] : vpLabelList;
|
|
125
|
+
// {vp_value} fully qualified
|
|
126
|
+
const vpValue = await this.ioc.anySerializer.deserialize(reader);
|
|
127
|
+
// {parent} fully qualified (always null)
|
|
128
|
+
await this.ioc.anySerializer.deserialize(reader);
|
|
129
|
+
// {meta_props} value-only list
|
|
130
|
+
const metaProps = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
131
|
+
const vp = new graph_js_1.VertexProperty(vpId, vpLabel, vpValue, metaProps || []);
|
|
132
|
+
vertex.properties.push(vp);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// {edge_count} bare int
|
|
136
|
+
const edgeCount = await this.ioc.intSerializer.deserializeBare(reader);
|
|
137
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
138
|
+
// {id} fully qualified
|
|
139
|
+
const eId = await this.ioc.anySerializer.deserialize(reader);
|
|
140
|
+
// {label} value-only list - full multi-label list
|
|
141
|
+
const eLabelList = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
142
|
+
const eLabels = Array.isArray(eLabelList) ? eLabelList : eLabelList ? [eLabelList] : [];
|
|
143
|
+
const eLabel = eLabels.length > 0 ? eLabels[0] : 'edge';
|
|
144
|
+
// {inV_id} fully qualified
|
|
145
|
+
const inVId = await this.ioc.anySerializer.deserialize(reader);
|
|
146
|
+
// {inV_label} fully qualified (always null placeholder) — discard
|
|
147
|
+
await this.ioc.anySerializer.deserialize(reader);
|
|
148
|
+
// {outV_id} fully qualified
|
|
149
|
+
const outVId = await this.ioc.anySerializer.deserialize(reader);
|
|
150
|
+
// {outV_label} fully qualified (always null placeholder) — discard
|
|
151
|
+
await this.ioc.anySerializer.deserialize(reader);
|
|
152
|
+
// {parent} fully qualified (always null) — discard
|
|
153
|
+
await this.ioc.anySerializer.deserialize(reader);
|
|
154
|
+
// {edge_props} value-only list
|
|
155
|
+
const edgeProps = await this.ioc.listSerializer.deserializeValue(reader, 0x00, this.ioc.DataType.LIST);
|
|
156
|
+
// Reuse vertex instances already in graph.vertices, otherwise build stand-ins
|
|
157
|
+
const inV = graph.vertices.get(inVId) || new graph_js_1.Vertex(inVId, '', []);
|
|
158
|
+
const outV = graph.vertices.get(outVId) || new graph_js_1.Vertex(outVId, '', []);
|
|
159
|
+
const edge = new graph_js_1.Edge(eId, outV, eLabel, inV, edgeProps || [], eLabels);
|
|
160
|
+
graph.edges.set(eId, edge);
|
|
161
|
+
}
|
|
162
|
+
return graph;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
166
|
+
* @param {StreamReader} reader
|
|
167
|
+
* @returns {Promise<Graph|null>}
|
|
168
|
+
*/
|
|
169
|
+
async deserialize(reader) {
|
|
170
|
+
const type_code = await reader.readUInt8();
|
|
171
|
+
if (type_code !== this.ioc.DataType.GRAPH) {
|
|
172
|
+
throw new Error(`GraphSerializer: unexpected {type_code}=0x${type_code.toString(16)}`);
|
|
173
|
+
}
|
|
174
|
+
const value_flag = await reader.readUInt8();
|
|
175
|
+
if (value_flag === 0x01) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
if (value_flag !== 0x00) {
|
|
179
|
+
throw new Error(`GraphSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
180
|
+
}
|
|
181
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.default = GraphSerializer;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default class GraphSerializer {
|
|
2
|
+
constructor(ioc: any);
|
|
3
|
+
ioc: any;
|
|
4
|
+
canBeUsedFor(value: any): value is Graph;
|
|
5
|
+
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
6
|
+
/**
|
|
7
|
+
* Async deserialization of graph value bytes from a StreamReader.
|
|
8
|
+
* @param {StreamReader} reader
|
|
9
|
+
* @param {number} valueFlag
|
|
10
|
+
* @param {number} typeCode
|
|
11
|
+
* @returns {Promise<Graph>}
|
|
12
|
+
*/
|
|
13
|
+
deserializeValue(reader: StreamReader, valueFlag: number, typeCode: number): Promise<Graph>;
|
|
14
|
+
/**
|
|
15
|
+
* Async fully-qualified deserialization from a StreamReader.
|
|
16
|
+
* @param {StreamReader} reader
|
|
17
|
+
* @returns {Promise<Graph|null>}
|
|
18
|
+
*/
|
|
19
|
+
deserialize(reader: StreamReader): Promise<Graph | null>;
|
|
20
|
+
}
|
|
21
|
+
import { Graph } from '../../../graph.cjs';
|
|
22
|
+
import { Buffer } from 'buffer';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
/**
|
|
22
|
+
* @author Igor Ostapenko
|
|
23
|
+
*/
|
|
24
|
+
const buffer_1 = require("node:buffer");
|
|
25
|
+
class IntSerializer {
|
|
26
|
+
get INT32_MIN() {
|
|
27
|
+
return -2147483648;
|
|
28
|
+
}
|
|
29
|
+
get INT32_MAX() {
|
|
30
|
+
return 2147483647;
|
|
31
|
+
}
|
|
32
|
+
constructor(ioc) {
|
|
33
|
+
this.ioc = ioc;
|
|
34
|
+
this.ioc.serializers[ioc.DataType.INT] = this;
|
|
35
|
+
}
|
|
36
|
+
canBeUsedFor(value) {
|
|
37
|
+
if (typeof value !== 'number') {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (value < this.INT32_MIN || value > this.INT32_MAX) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
serialize(item, fullyQualifiedFormat = true) {
|
|
46
|
+
if (item === undefined || item === null) {
|
|
47
|
+
if (fullyQualifiedFormat) {
|
|
48
|
+
return buffer_1.Buffer.from([this.ioc.DataType.INT, 0x01]);
|
|
49
|
+
}
|
|
50
|
+
return buffer_1.Buffer.from([0x00, 0x00, 0x00, 0x00]);
|
|
51
|
+
}
|
|
52
|
+
const bufs = [];
|
|
53
|
+
if (fullyQualifiedFormat) {
|
|
54
|
+
bufs.push(buffer_1.Buffer.from([this.ioc.DataType.INT, 0x00]));
|
|
55
|
+
}
|
|
56
|
+
const v = buffer_1.Buffer.alloc(4);
|
|
57
|
+
v.writeInt32BE(item); // if item is not within int32 limits writeInt32BE will error
|
|
58
|
+
bufs.push(v);
|
|
59
|
+
return buffer_1.Buffer.concat(bufs);
|
|
60
|
+
}
|
|
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;
|
|
91
|
+
}
|
|
92
|
+
if (value_flag !== 0x00) {
|
|
93
|
+
throw new Error(`IntSerializer: unexpected {value_flag}=0x${value_flag.toString(16)}`);
|
|
94
|
+
}
|
|
95
|
+
return this.deserializeValue(reader, value_flag, type_code);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.default = IntSerializer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default class IntSerializer {
|
|
2
|
+
constructor(ioc: any);
|
|
3
|
+
get INT32_MIN(): number;
|
|
4
|
+
get INT32_MAX(): number;
|
|
5
|
+
ioc: any;
|
|
6
|
+
canBeUsedFor(value: any): boolean;
|
|
7
|
+
serialize(item: any, fullyQualifiedFormat?: boolean): Buffer<ArrayBuffer>;
|
|
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>;
|
|
27
|
+
}
|
|
28
|
+
import { Buffer } from 'buffer';
|