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.
Files changed (455) hide show
  1. package/README.md +18 -4
  2. package/build/cjs/driver/auth.cjs +76 -0
  3. package/build/cjs/driver/auth.d.cts +9 -0
  4. package/build/cjs/driver/client.cjs +178 -0
  5. package/build/cjs/driver/client.d.cts +88 -0
  6. package/build/cjs/driver/connection.cjs +363 -0
  7. package/build/cjs/driver/connection.d.cts +106 -0
  8. package/build/cjs/driver/dispatcher.browser.cjs +57 -0
  9. package/build/cjs/driver/dispatcher.browser.d.cts +35 -0
  10. package/build/cjs/driver/dispatcher.cjs +101 -0
  11. package/build/cjs/driver/dispatcher.d.cts +48 -0
  12. package/build/cjs/driver/driver-remote-connection.cjs +153 -0
  13. package/build/cjs/driver/driver-remote-connection.d.cts +39 -0
  14. package/build/cjs/driver/http-request.cjs +64 -0
  15. package/build/cjs/driver/http-request.d.cts +28 -0
  16. package/build/cjs/driver/logger.cjs +45 -0
  17. package/build/cjs/driver/logger.d.cts +29 -0
  18. package/build/cjs/driver/remote-connection.cjs +72 -0
  19. package/build/cjs/driver/remote-connection.d.cts +57 -0
  20. package/build/cjs/driver/request-message.cjs +246 -0
  21. package/build/cjs/driver/request-message.d.cts +79 -0
  22. package/build/cjs/driver/response-error.cjs +45 -0
  23. package/build/cjs/driver/response-error.d.cts +13 -0
  24. package/build/cjs/driver/result-set.cjs +111 -0
  25. package/build/cjs/driver/result-set.d.cts +29 -0
  26. package/build/cjs/index.cjs +146 -0
  27. package/build/cjs/index.d.cts +440 -0
  28. package/build/cjs/language/grammar/GremlinLexer.cjs +1905 -0
  29. package/build/cjs/language/grammar/GremlinLexer.d.cts +349 -0
  30. package/build/cjs/language/grammar/GremlinListener.cjs +4804 -0
  31. package/build/cjs/language/grammar/GremlinListener.d.cts +5239 -0
  32. package/build/cjs/language/grammar/GremlinParser.cjs +38146 -0
  33. package/build/cjs/language/grammar/GremlinParser.d.cts +6260 -0
  34. package/build/cjs/language/index.cjs +48 -0
  35. package/build/cjs/language/index.d.cts +12 -0
  36. package/build/cjs/language/translator/AnonymizedTranslateVisitor.cjs +166 -0
  37. package/build/cjs/language/translator/AnonymizedTranslateVisitor.d.cts +39 -0
  38. package/build/cjs/language/translator/DotNetTranslateVisitor.cjs +935 -0
  39. package/build/cjs/language/translator/DotNetTranslateVisitor.d.cts +166 -0
  40. package/build/cjs/language/translator/GoTranslateVisitor.cjs +421 -0
  41. package/build/cjs/language/translator/GoTranslateVisitor.d.cts +40 -0
  42. package/build/cjs/language/translator/GremlinTranslator.cjs +96 -0
  43. package/build/cjs/language/translator/GremlinTranslator.d.cts +18 -0
  44. package/build/cjs/language/translator/GroovyTranslateVisitor.cjs +310 -0
  45. package/build/cjs/language/translator/GroovyTranslateVisitor.d.cts +37 -0
  46. package/build/cjs/language/translator/JavaTranslateVisitor.cjs +270 -0
  47. package/build/cjs/language/translator/JavaTranslateVisitor.d.cts +26 -0
  48. package/build/cjs/language/translator/JavascriptTranslateVisitor.cjs +231 -0
  49. package/build/cjs/language/translator/JavascriptTranslateVisitor.d.cts +28 -0
  50. package/build/cjs/language/translator/PythonTranslateVisitor.cjs +340 -0
  51. package/build/cjs/language/translator/PythonTranslateVisitor.d.cts +31 -0
  52. package/build/cjs/language/translator/TranslateVisitor.cjs +398 -0
  53. package/build/cjs/language/translator/TranslateVisitor.d.cts +94 -0
  54. package/build/cjs/language/translator/Translation.cjs +47 -0
  55. package/build/cjs/language/translator/Translation.d.cts +13 -0
  56. package/build/cjs/language/translator/Translator.cjs +46 -0
  57. package/build/cjs/language/translator/Translator.d.cts +24 -0
  58. package/build/cjs/language/translator/TranslatorException.cjs +31 -0
  59. package/build/cjs/language/translator/TranslatorException.d.cts +6 -0
  60. package/build/cjs/process/anonymous-traversal.cjs +82 -0
  61. package/build/cjs/process/anonymous-traversal.d.cts +40 -0
  62. package/build/cjs/process/graph-traversal.cjs +1833 -0
  63. package/build/cjs/process/graph-traversal.d.cts +1215 -0
  64. package/build/cjs/process/gremlin-lang.cjs +308 -0
  65. package/build/cjs/process/gremlin-lang.d.cts +20 -0
  66. package/{lib/driver/response-error.js → build/cjs/process/gvalue.cjs} +23 -28
  67. package/build/cjs/process/gvalue.d.cts +7 -0
  68. package/build/cjs/process/transaction.cjs +171 -0
  69. package/build/cjs/process/transaction.d.cts +70 -0
  70. package/build/cjs/process/traversal-strategy.cjs +360 -0
  71. package/build/cjs/process/traversal-strategy.d.cts +211 -0
  72. package/build/cjs/process/traversal.cjs +539 -0
  73. package/build/cjs/process/traversal.d.cts +212 -0
  74. package/build/cjs/structure/PDTRegistry.cjs +116 -0
  75. package/build/cjs/structure/PDTRegistry.d.cts +34 -0
  76. package/build/cjs/structure/graph.cjs +500 -0
  77. package/build/cjs/structure/graph.d.cts +176 -0
  78. package/build/cjs/structure/io/binary/GraphBinary.cjs +177 -0
  79. package/build/cjs/structure/io/binary/GraphBinary.d.cts +105 -0
  80. package/build/cjs/structure/io/binary/internals/AnySerializer.cjs +97 -0
  81. package/build/cjs/structure/io/binary/internals/AnySerializer.d.cts +18 -0
  82. package/build/cjs/structure/io/binary/internals/ArraySerializer.cjs +108 -0
  83. package/build/cjs/structure/io/binary/internals/ArraySerializer.d.cts +22 -0
  84. package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.cjs +116 -0
  85. package/build/cjs/structure/io/binary/internals/BigIntegerSerializer.d.cts +19 -0
  86. package/build/cjs/structure/io/binary/internals/BinarySerializer.cjs +92 -0
  87. package/build/cjs/structure/io/binary/internals/BinarySerializer.d.cts +19 -0
  88. package/build/cjs/structure/io/binary/internals/BooleanSerializer.cjs +79 -0
  89. package/build/cjs/structure/io/binary/internals/BooleanSerializer.d.cts +19 -0
  90. package/build/cjs/structure/io/binary/internals/ByteSerializer.cjs +74 -0
  91. package/build/cjs/structure/io/binary/internals/ByteSerializer.d.cts +18 -0
  92. package/build/cjs/structure/io/binary/internals/CompositePDTSerializer.cjs +81 -0
  93. package/build/cjs/structure/io/binary/internals/CompositePDTSerializer.d.cts +10 -0
  94. package/build/cjs/structure/io/binary/internals/DataType.cjs +63 -0
  95. package/build/cjs/structure/io/binary/internals/DataType.d.cts +35 -0
  96. package/build/cjs/structure/io/binary/internals/DateTimeSerializer.cjs +122 -0
  97. package/build/cjs/structure/io/binary/internals/DateTimeSerializer.d.cts +20 -0
  98. package/build/cjs/structure/io/binary/internals/DoubleSerializer.cjs +77 -0
  99. package/build/cjs/structure/io/binary/internals/DoubleSerializer.d.cts +19 -0
  100. package/build/cjs/structure/io/binary/internals/EdgeSerializer.cjs +146 -0
  101. package/build/cjs/structure/io/binary/internals/EdgeSerializer.d.cts +22 -0
  102. package/build/cjs/structure/io/binary/internals/EnumSerializer.cjs +115 -0
  103. package/build/cjs/structure/io/binary/internals/EnumSerializer.d.cts +39 -0
  104. package/build/cjs/structure/io/binary/internals/FloatSerializer.cjs +77 -0
  105. package/build/cjs/structure/io/binary/internals/FloatSerializer.d.cts +19 -0
  106. package/build/cjs/structure/io/binary/internals/GraphBinaryReader.cjs +171 -0
  107. package/build/cjs/structure/io/binary/internals/GraphBinaryReader.d.cts +43 -0
  108. package/build/cjs/structure/io/binary/internals/GraphBinaryWriter.cjs +85 -0
  109. package/build/cjs/structure/io/binary/internals/GraphBinaryWriter.d.cts +9 -0
  110. package/build/cjs/structure/io/binary/internals/GraphSerializer.cjs +184 -0
  111. package/build/cjs/structure/io/binary/internals/GraphSerializer.d.cts +22 -0
  112. package/build/cjs/structure/io/binary/internals/IntSerializer.cjs +98 -0
  113. package/build/cjs/structure/io/binary/internals/IntSerializer.d.cts +28 -0
  114. package/build/cjs/structure/io/binary/internals/LongSerializer.cjs +82 -0
  115. package/build/cjs/structure/io/binary/internals/LongSerializer.d.cts +20 -0
  116. package/build/cjs/structure/io/binary/internals/MapSerializer.cjs +110 -0
  117. package/build/cjs/structure/io/binary/internals/MapSerializer.d.cts +20 -0
  118. package/build/cjs/structure/io/binary/internals/MarkerSerializer.cjs +60 -0
  119. package/build/cjs/structure/io/binary/internals/MarkerSerializer.d.cts +17 -0
  120. package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.cjs +92 -0
  121. package/build/cjs/structure/io/binary/internals/NumberSerializationStrategy.d.cts +6 -0
  122. package/build/cjs/structure/io/binary/internals/PathSerializer.cjs +88 -0
  123. package/build/cjs/structure/io/binary/internals/PathSerializer.d.cts +22 -0
  124. package/build/cjs/structure/io/binary/internals/PrimitivePDTSerializer.cjs +80 -0
  125. package/build/cjs/structure/io/binary/internals/PrimitivePDTSerializer.d.cts +10 -0
  126. package/build/cjs/structure/io/binary/internals/PropertySerializer.cjs +93 -0
  127. package/build/cjs/structure/io/binary/internals/PropertySerializer.d.cts +22 -0
  128. package/build/cjs/structure/io/binary/internals/SetSerializer.cjs +104 -0
  129. package/build/cjs/structure/io/binary/internals/SetSerializer.d.cts +22 -0
  130. package/build/cjs/structure/io/binary/internals/ShortSerializer.cjs +77 -0
  131. package/build/cjs/structure/io/binary/internals/ShortSerializer.d.cts +19 -0
  132. package/build/cjs/structure/io/binary/internals/StreamReader.cjs +184 -0
  133. package/build/cjs/structure/io/binary/internals/StreamReader.d.cts +69 -0
  134. package/build/cjs/structure/io/binary/internals/StringSerializer.cjs +88 -0
  135. package/build/cjs/structure/io/binary/internals/StringSerializer.d.cts +21 -0
  136. package/build/cjs/structure/io/binary/internals/StubSerializer.cjs +33 -0
  137. package/build/cjs/structure/io/binary/internals/StubSerializer.d.cts +7 -0
  138. package/build/cjs/structure/io/binary/internals/TreeSerializer.cjs +139 -0
  139. package/build/cjs/structure/io/binary/internals/TreeSerializer.d.cts +54 -0
  140. package/build/cjs/structure/io/binary/internals/UnspecifiedNullSerializer.cjs +47 -0
  141. package/build/cjs/structure/io/binary/internals/UnspecifiedNullSerializer.d.cts +13 -0
  142. package/build/cjs/structure/io/binary/internals/UuidSerializer.cjs +93 -0
  143. package/build/cjs/structure/io/binary/internals/UuidSerializer.d.cts +19 -0
  144. package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.cjs +105 -0
  145. package/build/cjs/structure/io/binary/internals/VertexPropertySerializer.d.cts +22 -0
  146. package/build/cjs/structure/io/binary/internals/VertexSerializer.cjs +101 -0
  147. package/build/cjs/structure/io/binary/internals/VertexSerializer.d.cts +22 -0
  148. package/build/cjs/structure/io/binary/internals/utils.cjs +53 -0
  149. package/build/cjs/structure/io/binary/internals/utils.d.cts +6 -0
  150. package/build/cjs/utils.cjs +259 -0
  151. package/build/cjs/utils.d.cts +78 -0
  152. package/build/esm/driver/auth.d.ts +9 -0
  153. package/build/esm/driver/auth.js +72 -0
  154. package/build/esm/driver/client.d.ts +88 -0
  155. package/build/esm/driver/client.js +172 -0
  156. package/build/esm/driver/connection.d.ts +106 -0
  157. package/build/esm/driver/connection.js +323 -0
  158. package/build/esm/driver/dispatcher.browser.d.ts +35 -0
  159. package/build/esm/driver/dispatcher.browser.js +53 -0
  160. package/build/esm/driver/dispatcher.d.ts +48 -0
  161. package/build/esm/driver/dispatcher.js +94 -0
  162. package/build/esm/driver/driver-remote-connection.d.ts +39 -0
  163. package/build/esm/driver/driver-remote-connection.js +114 -0
  164. package/build/esm/driver/http-request.d.ts +28 -0
  165. package/build/esm/driver/http-request.js +60 -0
  166. package/build/esm/driver/logger.d.ts +29 -0
  167. package/build/esm/driver/logger.js +42 -0
  168. package/build/esm/driver/remote-connection.d.ts +57 -0
  169. package/build/esm/driver/remote-connection.js +66 -0
  170. package/build/esm/driver/request-message.d.ts +79 -0
  171. package/build/esm/driver/request-message.js +238 -0
  172. package/build/esm/driver/response-error.d.ts +13 -0
  173. package/{lib/driver/auth/mechanisms/sasl-mechanism-base.js → build/esm/driver/response-error.js} +24 -34
  174. package/build/esm/driver/result-set.d.ts +29 -0
  175. package/build/esm/driver/result-set.js +75 -0
  176. package/build/esm/index.d.ts +440 -0
  177. package/{index.js → build/esm/index.js} +44 -33
  178. package/build/esm/language/grammar/GremlinLexer.d.ts +349 -0
  179. package/build/esm/language/grammar/GremlinLexer.js +1868 -0
  180. package/build/esm/language/grammar/GremlinListener.d.ts +5239 -0
  181. package/build/esm/language/grammar/GremlinListener.js +4800 -0
  182. package/build/esm/language/grammar/GremlinParser.d.ts +6260 -0
  183. package/build/esm/language/grammar/GremlinParser.js +37579 -0
  184. package/build/esm/language/index.d.ts +12 -0
  185. package/build/esm/language/index.js +30 -0
  186. package/build/esm/language/translator/AnonymizedTranslateVisitor.d.ts +39 -0
  187. package/build/esm/language/translator/AnonymizedTranslateVisitor.js +160 -0
  188. package/build/esm/language/translator/DotNetTranslateVisitor.d.ts +166 -0
  189. package/build/esm/language/translator/DotNetTranslateVisitor.js +929 -0
  190. package/build/esm/language/translator/GoTranslateVisitor.d.ts +40 -0
  191. package/build/esm/language/translator/GoTranslateVisitor.js +415 -0
  192. package/build/esm/language/translator/GremlinTranslator.d.ts +18 -0
  193. package/build/esm/language/translator/GremlinTranslator.js +89 -0
  194. package/build/esm/language/translator/GroovyTranslateVisitor.d.ts +37 -0
  195. package/build/esm/language/translator/GroovyTranslateVisitor.js +304 -0
  196. package/build/esm/language/translator/JavaTranslateVisitor.d.ts +26 -0
  197. package/build/esm/language/translator/JavaTranslateVisitor.js +264 -0
  198. package/build/esm/language/translator/JavascriptTranslateVisitor.d.ts +28 -0
  199. package/build/esm/language/translator/JavascriptTranslateVisitor.js +225 -0
  200. package/build/esm/language/translator/PythonTranslateVisitor.d.ts +31 -0
  201. package/build/esm/language/translator/PythonTranslateVisitor.js +334 -0
  202. package/build/esm/language/translator/TranslateVisitor.d.ts +94 -0
  203. package/build/esm/language/translator/TranslateVisitor.js +395 -0
  204. package/build/esm/language/translator/Translation.d.ts +13 -0
  205. package/build/esm/language/translator/Translation.js +43 -0
  206. package/build/esm/language/translator/Translator.d.ts +24 -0
  207. package/build/esm/language/translator/Translator.js +40 -0
  208. package/build/esm/language/translator/TranslatorException.d.ts +6 -0
  209. package/build/esm/language/translator/TranslatorException.js +27 -0
  210. package/build/esm/process/anonymous-traversal.d.ts +40 -0
  211. package/build/esm/process/anonymous-traversal.js +76 -0
  212. package/build/esm/process/graph-traversal.d.ts +1215 -0
  213. package/build/esm/process/graph-traversal.js +1824 -0
  214. package/build/esm/process/gremlin-lang.d.ts +20 -0
  215. package/build/esm/process/gremlin-lang.js +305 -0
  216. package/build/esm/process/gvalue.d.ts +7 -0
  217. package/{lib/driver/auth/authenticator.js → build/esm/process/gvalue.js} +19 -19
  218. package/build/esm/process/transaction.d.ts +70 -0
  219. package/build/esm/process/transaction.js +164 -0
  220. package/build/esm/process/traversal-strategy.d.ts +211 -0
  221. package/build/esm/process/traversal-strategy.js +319 -0
  222. package/build/esm/process/traversal.d.ts +212 -0
  223. package/build/esm/process/traversal.js +526 -0
  224. package/build/esm/structure/PDTRegistry.d.ts +34 -0
  225. package/build/esm/structure/PDTRegistry.js +112 -0
  226. package/build/esm/structure/graph.d.ts +176 -0
  227. package/build/esm/structure/graph.js +488 -0
  228. package/build/esm/structure/io/binary/GraphBinary.d.ts +105 -0
  229. package/build/esm/structure/io/binary/GraphBinary.js +136 -0
  230. package/build/esm/structure/io/binary/internals/AnySerializer.d.ts +18 -0
  231. package/build/esm/structure/io/binary/internals/AnySerializer.js +94 -0
  232. package/build/esm/structure/io/binary/internals/ArraySerializer.d.ts +22 -0
  233. package/build/esm/structure/io/binary/internals/ArraySerializer.js +105 -0
  234. package/build/esm/structure/io/binary/internals/BigIntegerSerializer.d.ts +19 -0
  235. package/build/esm/structure/io/binary/internals/BigIntegerSerializer.js +113 -0
  236. package/build/esm/structure/io/binary/internals/BinarySerializer.d.ts +19 -0
  237. package/build/esm/structure/io/binary/internals/BinarySerializer.js +89 -0
  238. package/build/esm/structure/io/binary/internals/BooleanSerializer.d.ts +19 -0
  239. package/build/esm/structure/io/binary/internals/BooleanSerializer.js +76 -0
  240. package/build/esm/structure/io/binary/internals/ByteSerializer.d.ts +18 -0
  241. package/build/esm/structure/io/binary/internals/ByteSerializer.js +71 -0
  242. package/build/esm/structure/io/binary/internals/CompositePDTSerializer.d.ts +10 -0
  243. package/build/esm/structure/io/binary/internals/CompositePDTSerializer.js +78 -0
  244. package/build/esm/structure/io/binary/internals/DataType.d.ts +35 -0
  245. package/build/esm/structure/io/binary/internals/DataType.js +61 -0
  246. package/build/esm/structure/io/binary/internals/DateTimeSerializer.d.ts +20 -0
  247. package/build/esm/structure/io/binary/internals/DateTimeSerializer.js +119 -0
  248. package/build/esm/structure/io/binary/internals/DoubleSerializer.d.ts +19 -0
  249. package/build/esm/structure/io/binary/internals/DoubleSerializer.js +74 -0
  250. package/build/esm/structure/io/binary/internals/EdgeSerializer.d.ts +22 -0
  251. package/build/esm/structure/io/binary/internals/EdgeSerializer.js +143 -0
  252. package/build/esm/structure/io/binary/internals/EnumSerializer.d.ts +39 -0
  253. package/build/esm/structure/io/binary/internals/EnumSerializer.js +112 -0
  254. package/build/esm/structure/io/binary/internals/FloatSerializer.d.ts +19 -0
  255. package/build/esm/structure/io/binary/internals/FloatSerializer.js +74 -0
  256. package/build/esm/structure/io/binary/internals/GraphBinaryReader.d.ts +43 -0
  257. package/build/esm/structure/io/binary/internals/GraphBinaryReader.js +165 -0
  258. package/build/esm/structure/io/binary/internals/GraphBinaryWriter.d.ts +9 -0
  259. package/build/esm/structure/io/binary/internals/GraphBinaryWriter.js +82 -0
  260. package/build/esm/structure/io/binary/internals/GraphSerializer.d.ts +22 -0
  261. package/build/esm/structure/io/binary/internals/GraphSerializer.js +181 -0
  262. package/build/esm/structure/io/binary/internals/IntSerializer.d.ts +28 -0
  263. package/build/esm/structure/io/binary/internals/IntSerializer.js +95 -0
  264. package/build/esm/structure/io/binary/internals/LongSerializer.d.ts +20 -0
  265. package/build/esm/structure/io/binary/internals/LongSerializer.js +79 -0
  266. package/build/esm/structure/io/binary/internals/MapSerializer.d.ts +20 -0
  267. package/build/esm/structure/io/binary/internals/MapSerializer.js +107 -0
  268. package/build/esm/structure/io/binary/internals/MarkerSerializer.d.ts +17 -0
  269. package/build/esm/structure/io/binary/internals/MarkerSerializer.js +56 -0
  270. package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.d.ts +6 -0
  271. package/build/esm/structure/io/binary/internals/NumberSerializationStrategy.js +89 -0
  272. package/build/esm/structure/io/binary/internals/PathSerializer.d.ts +22 -0
  273. package/build/esm/structure/io/binary/internals/PathSerializer.js +85 -0
  274. package/build/esm/structure/io/binary/internals/PrimitivePDTSerializer.d.ts +10 -0
  275. package/build/esm/structure/io/binary/internals/PrimitivePDTSerializer.js +77 -0
  276. package/build/esm/structure/io/binary/internals/PropertySerializer.d.ts +22 -0
  277. package/build/esm/structure/io/binary/internals/PropertySerializer.js +90 -0
  278. package/build/esm/structure/io/binary/internals/SetSerializer.d.ts +22 -0
  279. package/build/esm/structure/io/binary/internals/SetSerializer.js +101 -0
  280. package/build/esm/structure/io/binary/internals/ShortSerializer.d.ts +19 -0
  281. package/build/esm/structure/io/binary/internals/ShortSerializer.js +74 -0
  282. package/build/esm/structure/io/binary/internals/StreamReader.d.ts +69 -0
  283. package/build/esm/structure/io/binary/internals/StreamReader.js +181 -0
  284. package/build/esm/structure/io/binary/internals/StringSerializer.d.ts +21 -0
  285. package/build/esm/structure/io/binary/internals/StringSerializer.js +85 -0
  286. package/build/esm/structure/io/binary/internals/StubSerializer.d.ts +7 -0
  287. package/{.prettierrc.js → build/esm/structure/io/binary/internals/StubSerializer.js} +12 -11
  288. package/build/esm/structure/io/binary/internals/TreeSerializer.d.ts +54 -0
  289. package/build/esm/structure/io/binary/internals/TreeSerializer.js +136 -0
  290. package/build/esm/structure/io/binary/internals/UnspecifiedNullSerializer.d.ts +13 -0
  291. package/build/esm/structure/io/binary/internals/UnspecifiedNullSerializer.js +44 -0
  292. package/build/esm/structure/io/binary/internals/UuidSerializer.d.ts +19 -0
  293. package/build/esm/structure/io/binary/internals/UuidSerializer.js +90 -0
  294. package/build/esm/structure/io/binary/internals/VertexPropertySerializer.d.ts +22 -0
  295. package/build/esm/structure/io/binary/internals/VertexPropertySerializer.js +102 -0
  296. package/build/esm/structure/io/binary/internals/VertexSerializer.d.ts +22 -0
  297. package/build/esm/structure/io/binary/internals/VertexSerializer.js +98 -0
  298. package/build/esm/structure/io/binary/internals/utils.d.ts +6 -0
  299. package/{lib → build/esm}/structure/io/binary/internals/utils.js +23 -35
  300. package/build/esm/utils.d.ts +78 -0
  301. package/build/esm/utils.js +237 -0
  302. package/package.json +71 -26
  303. package/.nvmrc +0 -1
  304. package/NOTICE +0 -5
  305. package/doc/AnonymousTraversalSource.html +0 -793
  306. package/doc/Authenticator.html +0 -303
  307. package/doc/Bytecode.html +0 -941
  308. package/doc/CardinalityValue.html +0 -711
  309. package/doc/Client.html +0 -1869
  310. package/doc/Connection.html +0 -1192
  311. package/doc/DriverRemoteConnection.html +0 -1528
  312. package/doc/EdgeLabelVerificationStrategy.html +0 -238
  313. package/doc/Graph.html +0 -343
  314. package/doc/GraphSON2Reader.html +0 -407
  315. package/doc/GraphSON2Writer.html +0 -558
  316. package/doc/GraphSON3Reader.html +0 -170
  317. package/doc/GraphSON3Writer.html +0 -170
  318. package/doc/GraphTraversal.html +0 -22974
  319. package/doc/GraphTraversalSource.html +0 -3683
  320. package/doc/HaltedTraverserStrategy.html +0 -215
  321. package/doc/MatchAlgorithmStrategy.html +0 -210
  322. package/doc/P.html +0 -2020
  323. package/doc/PartitionStrategy.html +0 -387
  324. package/doc/Path.html +0 -242
  325. package/doc/PlainTextSaslAuthenticator.html +0 -456
  326. package/doc/ProductiveByStrategy.html +0 -258
  327. package/doc/RemoteConnection.html +0 -1086
  328. package/doc/RemoteStrategy.html +0 -307
  329. package/doc/RemoteTraversal.html +0 -170
  330. package/doc/ReservedKeysVerificationStrategy.html +0 -261
  331. package/doc/ResponseError.html +0 -360
  332. package/doc/ResultSet.html +0 -633
  333. package/doc/SaslAuthenticator.html +0 -455
  334. package/doc/SaslMechanismBase.html +0 -506
  335. package/doc/SaslMechanismPlain.html +0 -925
  336. package/doc/SeedStrategy.html +0 -288
  337. package/doc/SubgraphStrategy.html +0 -387
  338. package/doc/TextP.html +0 -1440
  339. package/doc/Transaction.html +0 -655
  340. package/doc/Translator.html +0 -527
  341. package/doc/TraversalStrategies.html +0 -652
  342. package/doc/TraversalStrategy.html +0 -393
  343. package/doc/TypeSerializer.html +0 -166
  344. package/doc/driver_auth_authenticator.js.html +0 -89
  345. package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +0 -103
  346. package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +0 -157
  347. package/doc/driver_auth_plain-text-sasl-authenticator.js.html +0 -106
  348. package/doc/driver_auth_sasl-authenticator.js.html +0 -100
  349. package/doc/driver_client.js.html +0 -250
  350. package/doc/driver_connection.js.html +0 -518
  351. package/doc/driver_driver-remote-connection.js.html +0 -193
  352. package/doc/driver_remote-connection.js.html +0 -198
  353. package/doc/driver_response-error.js.html +0 -98
  354. package/doc/driver_result-set.js.html +0 -134
  355. package/doc/fonts/OpenSans-Bold-webfont.eot +0 -0
  356. package/doc/fonts/OpenSans-Bold-webfont.svg +0 -1830
  357. package/doc/fonts/OpenSans-Bold-webfont.woff +0 -0
  358. package/doc/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  359. package/doc/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  360. package/doc/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  361. package/doc/fonts/OpenSans-Italic-webfont.eot +0 -0
  362. package/doc/fonts/OpenSans-Italic-webfont.svg +0 -1830
  363. package/doc/fonts/OpenSans-Italic-webfont.woff +0 -0
  364. package/doc/fonts/OpenSans-Light-webfont.eot +0 -0
  365. package/doc/fonts/OpenSans-Light-webfont.svg +0 -1831
  366. package/doc/fonts/OpenSans-Light-webfont.woff +0 -0
  367. package/doc/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  368. package/doc/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  369. package/doc/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  370. package/doc/fonts/OpenSans-Regular-webfont.eot +0 -0
  371. package/doc/fonts/OpenSans-Regular-webfont.svg +0 -1831
  372. package/doc/fonts/OpenSans-Regular-webfont.woff +0 -0
  373. package/doc/global.html +0 -728
  374. package/doc/index.html +0 -185
  375. package/doc/module.exports.html +0 -301
  376. package/doc/process_anonymous-traversal.js.html +0 -138
  377. package/doc/process_bytecode.js.html +0 -175
  378. package/doc/process_graph-traversal.js.html +0 -1936
  379. package/doc/process_transaction.js.html +0 -151
  380. package/doc/process_translator.js.html +0 -172
  381. package/doc/process_traversal-strategy.js.html +0 -466
  382. package/doc/process_traversal.js.html +0 -592
  383. package/doc/scripts/linenumber.js +0 -25
  384. package/doc/scripts/prettify/Apache-License-2.0.txt +0 -202
  385. package/doc/scripts/prettify/lang-css.js +0 -2
  386. package/doc/scripts/prettify/prettify.js +0 -28
  387. package/doc/structure_graph.js.html +0 -233
  388. package/doc/structure_io_binary_internals_DataType.js.html +0 -151
  389. package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +0 -133
  390. package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +0 -136
  391. package/doc/structure_io_graph-serializer.js.html +0 -354
  392. package/doc/structure_io_type-serializers.js.html +0 -617
  393. package/doc/styles/jsdoc-default.css +0 -358
  394. package/doc/styles/prettify-jsdoc.css +0 -111
  395. package/doc/styles/prettify-tomorrow.css +0 -132
  396. package/doc/utils.js.html +0 -181
  397. package/docker-compose.yml +0 -76
  398. package/eslint.config.mjs +0 -143
  399. package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +0 -106
  400. package/lib/driver/auth/plain-text-sasl-authenticator.js +0 -55
  401. package/lib/driver/auth/sasl-authenticator.js +0 -49
  402. package/lib/driver/client.js +0 -199
  403. package/lib/driver/connection.js +0 -467
  404. package/lib/driver/driver-remote-connection.js +0 -142
  405. package/lib/driver/remote-connection.js +0 -147
  406. package/lib/driver/result-set.js +0 -83
  407. package/lib/process/anonymous-traversal.js +0 -87
  408. package/lib/process/bytecode.js +0 -124
  409. package/lib/process/graph-traversal.js +0 -1885
  410. package/lib/process/transaction.js +0 -100
  411. package/lib/process/translator.js +0 -121
  412. package/lib/process/traversal-strategy.js +0 -415
  413. package/lib/process/traversal.js +0 -541
  414. package/lib/structure/graph.js +0 -182
  415. package/lib/structure/io/binary/GraphBinary.js +0 -110
  416. package/lib/structure/io/binary/internals/AnySerializer.js +0 -100
  417. package/lib/structure/io/binary/internals/ArraySerializer.js +0 -137
  418. package/lib/structure/io/binary/internals/BigIntegerSerializer.js +0 -153
  419. package/lib/structure/io/binary/internals/BooleanSerializer.js +0 -105
  420. package/lib/structure/io/binary/internals/BulkSetSerializer.js +0 -126
  421. package/lib/structure/io/binary/internals/ByteBufferSerializer.js +0 -126
  422. package/lib/structure/io/binary/internals/ByteSerializer.js +0 -97
  423. package/lib/structure/io/binary/internals/BytecodeSerializer.js +0 -250
  424. package/lib/structure/io/binary/internals/ClassSerializer.js +0 -60
  425. package/lib/structure/io/binary/internals/DataType.js +0 -100
  426. package/lib/structure/io/binary/internals/DateSerializer.js +0 -105
  427. package/lib/structure/io/binary/internals/DoubleSerializer.js +0 -101
  428. package/lib/structure/io/binary/internals/EdgeSerializer.js +0 -216
  429. package/lib/structure/io/binary/internals/EnumSerializer.js +0 -152
  430. package/lib/structure/io/binary/internals/FloatSerializer.js +0 -101
  431. package/lib/structure/io/binary/internals/GraphBinaryReader.js +0 -82
  432. package/lib/structure/io/binary/internals/GraphBinaryWriter.js +0 -85
  433. package/lib/structure/io/binary/internals/IntSerializer.js +0 -114
  434. package/lib/structure/io/binary/internals/LambdaSerializer.js +0 -71
  435. package/lib/structure/io/binary/internals/LongSerializer.js +0 -109
  436. package/lib/structure/io/binary/internals/LongSerializerNg.js +0 -104
  437. package/lib/structure/io/binary/internals/MapSerializer.js +0 -155
  438. package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +0 -73
  439. package/lib/structure/io/binary/internals/OffsetDateTimeSerializer.js +0 -151
  440. package/lib/structure/io/binary/internals/PSerializer.js +0 -152
  441. package/lib/structure/io/binary/internals/PathSerializer.js +0 -124
  442. package/lib/structure/io/binary/internals/PropertySerializer.js +0 -142
  443. package/lib/structure/io/binary/internals/SetSerializer.js +0 -134
  444. package/lib/structure/io/binary/internals/ShortSerializer.js +0 -101
  445. package/lib/structure/io/binary/internals/StringSerializer.js +0 -116
  446. package/lib/structure/io/binary/internals/TextPSerializer.js +0 -146
  447. package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +0 -69
  448. package/lib/structure/io/binary/internals/TraverserSerializer.js +0 -124
  449. package/lib/structure/io/binary/internals/UnspecifiedNullSerializer.js +0 -77
  450. package/lib/structure/io/binary/internals/UuidSerializer.js +0 -121
  451. package/lib/structure/io/binary/internals/VertexPropertySerializer.js +0 -176
  452. package/lib/structure/io/binary/internals/VertexSerializer.js +0 -139
  453. package/lib/structure/io/graph-serializer.js +0 -303
  454. package/lib/structure/io/type-serializers.js +0 -566
  455. package/lib/utils.js +0 -130
@@ -0,0 +1,176 @@
1
+ /**
2
+ * @author Jorge Bay Gondra
3
+ */
4
+ /**
5
+ * An "empty" graph object to server only as a reference.
6
+ *
7
+ * Holds in-memory collections of vertices and edges so that GraphBinary
8
+ * Graph (0x10) deserialization can return a usable data container.
9
+ */
10
+ export declare class Graph {
11
+ readonly vertices: Map<any, Vertex>;
12
+ readonly edges: Map<any, Edge>;
13
+ constructor();
14
+ toString(): string;
15
+ }
16
+ declare class Element<TLabel extends string = string, TId = any> {
17
+ readonly id: TId;
18
+ readonly label: TLabel;
19
+ readonly properties: Property[];
20
+ constructor(id: TId, label: TLabel, properties?: Property[]);
21
+ /**
22
+ * Compares this instance to another and determines if they can be considered as equal.
23
+ */
24
+ equals(other: any): boolean;
25
+ }
26
+ export declare class Vertex<TLabel extends string = string, TProperties extends Record<string, any> = Record<string, any>, TId = number, TVertexProperties = {
27
+ [P in keyof TProperties]: P extends string ? VertexProperties<P, TProperties[P]> : never;
28
+ }> extends Element<TLabel, TId> {
29
+ readonly labels: Set<string>;
30
+ constructor(id: TId, label: TLabel | string[], properties?: Property[] | null, labels?: string[]);
31
+ toString(): string;
32
+ }
33
+ export declare class Edge<TOutVertex extends Vertex = Vertex, TLabel extends string = string, TInVertex extends Vertex = Vertex, TProperties extends Record<string, any> = Record<string, any>, TId = number> extends Element<TLabel, TId> {
34
+ readonly outV: TOutVertex;
35
+ readonly inV: TInVertex;
36
+ readonly labels: Set<string>;
37
+ constructor(id: TId, outV: TOutVertex, label: TLabel | string[], inV: TInVertex, properties?: Property[] | null, labels?: string[]);
38
+ toString(): string;
39
+ }
40
+ export declare class VertexProperty<TLabel extends string = string, TValue = any, TProperties extends Record<string, any> | null | undefined = Record<string, any>, TId = any> extends Element<TLabel, TId> {
41
+ readonly value: TValue;
42
+ readonly key: string;
43
+ constructor(id: TId, label: TLabel, value: TValue, properties?: Property[] | null);
44
+ toString(): string;
45
+ }
46
+ export type VertexProperties<TLabel extends string = string, TValue = any, TProperties extends Record<string, any> = Record<string, any>, TId = any> = [VertexProperty<TLabel, TValue, TProperties, TId>, ...Array<VertexProperty<TLabel, TValue, TProperties, TId>>];
47
+ export declare class Property<T = any> {
48
+ readonly key: string;
49
+ readonly value: T;
50
+ constructor(key: string, value: T);
51
+ toString(): string;
52
+ equals(other: any): boolean;
53
+ }
54
+ /**
55
+ * A tree data structure with a tree-shaped public API.
56
+ *
57
+ * Children are kept in a private, ordered array of {key, value} entries (not a
58
+ * native {@link Map}, whose reference-identity keys would break value-equality).
59
+ * Access is only through the read API; lookups use {@link treeKeysEqual}, which
60
+ * compares keys by value and treats null/undefined as a distinct key.
61
+ */
62
+ export declare class Tree {
63
+ #private;
64
+ constructor(...rootValues: any[]);
65
+ /**
66
+ * Locates the entry whose key is structurally equal to the given key.
67
+ * @returns the matching entry, or undefined if none exists.
68
+ */
69
+ private _findEntry;
70
+ /**
71
+ * Returns the keys at the root of this tree.
72
+ */
73
+ rootNodes(): any[];
74
+ /**
75
+ * Returns the child subtree for the given key.
76
+ * @throws {Error} if no child exists for the given key.
77
+ */
78
+ childAt(key: any): Tree;
79
+ /**
80
+ * Returns true if the given key is an immediate child of this tree.
81
+ */
82
+ hasChild(key: any): boolean;
83
+ /**
84
+ * Returns true if the given value appears as a key anywhere in this tree (recursive).
85
+ */
86
+ contains(value: any): boolean;
87
+ /**
88
+ * Recursively searches the tree for the first subtree rooted at key.
89
+ * @returns the matching subtree, or undefined if absent.
90
+ */
91
+ findSubtree(key: any): Tree | undefined;
92
+ /**
93
+ * Returns the existing child for key, or inserts and returns a new empty Tree if absent.
94
+ */
95
+ getOrCreateChild(key: any): Tree;
96
+ /**
97
+ * Returns true if this tree has no children. An empty tree is considered a leaf.
98
+ */
99
+ isLeaf(): boolean;
100
+ /**
101
+ * Returns the total number of nodes (keys) in the tree, counted recursively.
102
+ */
103
+ nodeCount(): number;
104
+ /**
105
+ * Returns the keys at the given depth. Depth 0 returns the root keys.
106
+ * Negative depths or depths beyond the tree's height return an empty array.
107
+ */
108
+ getNodesAtDepth(depth: number): any[];
109
+ /**
110
+ * Returns the trees at the given depth. Depth 0 returns a singleton list containing this tree.
111
+ * Negative depths or depths beyond the tree's height return an empty array.
112
+ */
113
+ getTreesAtDepth(depth: number): Tree[];
114
+ /**
115
+ * Returns all keys whose subtrees are leaves.
116
+ */
117
+ getLeafNodes(): any[];
118
+ private _collectLeafKeys;
119
+ /**
120
+ * Returns single-key trees representing each leaf key in this tree, preserving the original
121
+ * key-to-empty-subtree mapping.
122
+ */
123
+ getLeafTrees(): Tree[];
124
+ private _collectLeafTrees;
125
+ /**
126
+ * Recursively merges other into this tree. For overlapping keys, child subtrees are merged in turn.
127
+ * For keys present only in other, the corresponding subtree reference is adopted directly.
128
+ */
129
+ addTree(other: Tree): void;
130
+ /**
131
+ * Splits this tree into one tree per root key. If the tree has a single root, returns a singleton list
132
+ * containing this tree.
133
+ */
134
+ splitParents(): Tree[];
135
+ /**
136
+ * Produces a formatted string representation of the tree structure using a |-- ASCII style,
137
+ * Uses a |-- ASCII style with a 3-space indent per level and no trailing newline.
138
+ */
139
+ prettyPrint(): string;
140
+ private _prettyPrint;
141
+ /**
142
+ * Structural recursive equality. Order across siblings is irrelevant; two trees are equal if they have the
143
+ * same set of keys and each key's subtree is recursively equal.
144
+ */
145
+ equals(other: any): boolean;
146
+ toString(): string;
147
+ }
148
+ /**
149
+ * Represents a walk through a graph as defined by a traversal.
150
+ */
151
+ export declare class Path {
152
+ readonly labels: string[][];
153
+ readonly objects: any[];
154
+ constructor(labels: string[][], objects: any[]);
155
+ toString(): string;
156
+ equals(other: any): any;
157
+ }
158
+ /**
159
+ * Represents a composite Provider Defined Type (PDT).
160
+ */
161
+ export declare class CompositePDT {
162
+ readonly name: string;
163
+ readonly fields: Readonly<Record<string, any>>;
164
+ constructor(name: string, fields?: Record<string, any>);
165
+ toString(): string;
166
+ }
167
+ /**
168
+ * Represents a primitive Provider Defined Type (PDT).
169
+ */
170
+ export declare class PrimitivePDT {
171
+ readonly name: string;
172
+ readonly value: string;
173
+ constructor(name: string, value: string);
174
+ toString(): string;
175
+ }
176
+ export {};
@@ -0,0 +1,488 @@
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
+ /**
20
+ * @author Jorge Bay Gondra
21
+ */
22
+ /**
23
+ * An "empty" graph object to server only as a reference.
24
+ *
25
+ * Holds in-memory collections of vertices and edges so that GraphBinary
26
+ * Graph (0x10) deserialization can return a usable data container.
27
+ */
28
+ export class Graph {
29
+ vertices;
30
+ edges;
31
+ constructor() {
32
+ this.vertices = new Map();
33
+ this.edges = new Map();
34
+ }
35
+ toString() {
36
+ return `graph[vertices:${this.vertices.size} edges:${this.edges.size}]`;
37
+ }
38
+ }
39
+ class Element {
40
+ id;
41
+ label;
42
+ properties;
43
+ // properties are stored as list of property objects
44
+ constructor(id, label, properties = []) {
45
+ this.id = id;
46
+ this.label = label;
47
+ this.properties = properties;
48
+ this.properties = properties ?? [];
49
+ }
50
+ /**
51
+ * Compares this instance to another and determines if they can be considered as equal.
52
+ */
53
+ equals(other) {
54
+ return other instanceof Element && this.id === other.id;
55
+ }
56
+ }
57
+ export class Vertex extends Element {
58
+ labels;
59
+ constructor(id, label, properties = [], labels) {
60
+ // Determine the canonical labels array from either explicit labels param or label param
61
+ const resolvedLabels = labels
62
+ ? labels
63
+ : Array.isArray(label) ? label
64
+ : label ? [label]
65
+ : ['vertex'];
66
+ const primaryLabel = (resolvedLabels.length > 0 ? resolvedLabels[0] : 'vertex');
67
+ super(id, primaryLabel, properties ?? []);
68
+ this.labels = new Set(resolvedLabels);
69
+ }
70
+ toString() {
71
+ return `v[${this.id}]`;
72
+ }
73
+ }
74
+ export class Edge extends Element {
75
+ outV;
76
+ inV;
77
+ labels;
78
+ constructor(id, outV, label, inV, properties = [], labels) {
79
+ // Determine the canonical labels array from either explicit labels param or label param
80
+ const resolvedLabels = labels
81
+ ? labels
82
+ : Array.isArray(label) ? label
83
+ : label ? [label]
84
+ : ['edge'];
85
+ const primaryLabel = (resolvedLabels.length > 0 ? resolvedLabels[0] : 'edge');
86
+ super(id, primaryLabel, properties ?? []);
87
+ this.outV = outV;
88
+ this.inV = inV;
89
+ this.labels = new Set(resolvedLabels);
90
+ }
91
+ toString() {
92
+ const outVId = this.outV ? this.outV.id : '?';
93
+ const inVId = this.inV ? this.inV.id : '?';
94
+ return `e[${this.id}][${outVId}-${this.label}->${inVId}]`;
95
+ }
96
+ }
97
+ export class VertexProperty extends Element {
98
+ value;
99
+ key;
100
+ constructor(id, label, value, properties = []) {
101
+ super(id, label, properties ?? []);
102
+ this.value = value;
103
+ this.value = value;
104
+ this.key = this.label;
105
+ }
106
+ toString() {
107
+ return `vp[${this.label}->${summarize(this.value)}]`;
108
+ }
109
+ }
110
+ export class Property {
111
+ key;
112
+ value;
113
+ constructor(key, value) {
114
+ this.key = key;
115
+ this.value = value;
116
+ }
117
+ toString() {
118
+ return `p[${this.key}->${summarize(this.value)}]`;
119
+ }
120
+ equals(other) {
121
+ return other instanceof Property && this.key === other.key && this.value === other.value;
122
+ }
123
+ }
124
+ /**
125
+ * A tree data structure with a tree-shaped public API.
126
+ *
127
+ * Children are kept in a private, ordered array of {key, value} entries (not a
128
+ * native {@link Map}, whose reference-identity keys would break value-equality).
129
+ * Access is only through the read API; lookups use {@link treeKeysEqual}, which
130
+ * compares keys by value and treats null/undefined as a distinct key.
131
+ */
132
+ export class Tree {
133
+ #entries;
134
+ constructor(...rootValues) {
135
+ this.#entries = [];
136
+ for (const value of rootValues) {
137
+ this.#entries.push({ key: value, value: new Tree() });
138
+ }
139
+ }
140
+ /**
141
+ * Locates the entry whose key is structurally equal to the given key.
142
+ * @returns the matching entry, or undefined if none exists.
143
+ */
144
+ _findEntry(key) {
145
+ for (const entry of this.#entries) {
146
+ if (treeKeysEqual(entry.key, key)) {
147
+ return entry;
148
+ }
149
+ }
150
+ return undefined;
151
+ }
152
+ /**
153
+ * Returns the keys at the root of this tree.
154
+ */
155
+ rootNodes() {
156
+ return this.#entries.map((e) => e.key);
157
+ }
158
+ /**
159
+ * Returns the child subtree for the given key.
160
+ * @throws {Error} if no child exists for the given key.
161
+ */
162
+ childAt(key) {
163
+ const entry = this._findEntry(key);
164
+ if (entry === undefined) {
165
+ throw new Error(`Tree has no child for key: ${key}`);
166
+ }
167
+ return entry.value;
168
+ }
169
+ /**
170
+ * Returns true if the given key is an immediate child of this tree.
171
+ */
172
+ hasChild(key) {
173
+ return this._findEntry(key) !== undefined;
174
+ }
175
+ /**
176
+ * Returns true if the given value appears as a key anywhere in this tree (recursive).
177
+ */
178
+ contains(value) {
179
+ for (const entry of this.#entries) {
180
+ if (treeKeysEqual(entry.key, value)) {
181
+ return true;
182
+ }
183
+ }
184
+ for (const entry of this.#entries) {
185
+ if (entry.value.contains(value)) {
186
+ return true;
187
+ }
188
+ }
189
+ return false;
190
+ }
191
+ /**
192
+ * Recursively searches the tree for the first subtree rooted at key.
193
+ * @returns the matching subtree, or undefined if absent.
194
+ */
195
+ findSubtree(key) {
196
+ const entry = this._findEntry(key);
197
+ if (entry !== undefined) {
198
+ return entry.value;
199
+ }
200
+ for (const e of this.#entries) {
201
+ const found = e.value.findSubtree(key);
202
+ if (found !== undefined) {
203
+ return found;
204
+ }
205
+ }
206
+ return undefined;
207
+ }
208
+ /**
209
+ * Returns the existing child for key, or inserts and returns a new empty Tree if absent.
210
+ */
211
+ getOrCreateChild(key) {
212
+ const entry = this._findEntry(key);
213
+ if (entry !== undefined) {
214
+ return entry.value;
215
+ }
216
+ const child = new Tree();
217
+ this.#entries.push({ key, value: child });
218
+ return child;
219
+ }
220
+ /**
221
+ * Returns true if this tree has no children. An empty tree is considered a leaf.
222
+ */
223
+ isLeaf() {
224
+ return this.#entries.length === 0;
225
+ }
226
+ /**
227
+ * Returns the total number of nodes (keys) in the tree, counted recursively.
228
+ */
229
+ nodeCount() {
230
+ let count = this.#entries.length;
231
+ for (const entry of this.#entries) {
232
+ count += entry.value.nodeCount();
233
+ }
234
+ return count;
235
+ }
236
+ /**
237
+ * Returns the keys at the given depth. Depth 0 returns the root keys.
238
+ * Negative depths or depths beyond the tree's height return an empty array.
239
+ */
240
+ getNodesAtDepth(depth) {
241
+ const list = [];
242
+ for (const t of this.getTreesAtDepth(depth)) {
243
+ for (const entry of t.#entries) {
244
+ list.push(entry.key);
245
+ }
246
+ }
247
+ return list;
248
+ }
249
+ /**
250
+ * Returns the trees at the given depth. Depth 0 returns a singleton list containing this tree.
251
+ * Negative depths or depths beyond the tree's height return an empty array.
252
+ */
253
+ getTreesAtDepth(depth) {
254
+ if (depth < 0) {
255
+ return [];
256
+ }
257
+ let currentDepth = [this];
258
+ for (let i = 0; i < depth; i++) {
259
+ const next = [];
260
+ for (const t of currentDepth) {
261
+ for (const entry of t.#entries) {
262
+ next.push(entry.value);
263
+ }
264
+ }
265
+ if (next.length === 0) {
266
+ return [];
267
+ }
268
+ currentDepth = next;
269
+ }
270
+ return currentDepth;
271
+ }
272
+ /**
273
+ * Returns all keys whose subtrees are leaves.
274
+ */
275
+ getLeafNodes() {
276
+ const leaves = [];
277
+ this._collectLeafKeys(leaves);
278
+ return leaves;
279
+ }
280
+ _collectLeafKeys(out) {
281
+ for (const entry of this.#entries) {
282
+ if (entry.value.isLeaf()) {
283
+ out.push(entry.key);
284
+ }
285
+ else {
286
+ entry.value._collectLeafKeys(out);
287
+ }
288
+ }
289
+ }
290
+ /**
291
+ * Returns single-key trees representing each leaf key in this tree, preserving the original
292
+ * key-to-empty-subtree mapping.
293
+ */
294
+ getLeafTrees() {
295
+ const leaves = [];
296
+ this._collectLeafTrees(leaves);
297
+ return leaves;
298
+ }
299
+ _collectLeafTrees(out) {
300
+ for (const entry of this.#entries) {
301
+ if (entry.value.isLeaf()) {
302
+ const leaf = new Tree();
303
+ leaf.#entries.push({ key: entry.key, value: entry.value });
304
+ out.push(leaf);
305
+ }
306
+ else {
307
+ entry.value._collectLeafTrees(out);
308
+ }
309
+ }
310
+ }
311
+ /**
312
+ * Recursively merges other into this tree. For overlapping keys, child subtrees are merged in turn.
313
+ * For keys present only in other, the corresponding subtree reference is adopted directly.
314
+ */
315
+ addTree(other) {
316
+ for (const entry of other.#entries) {
317
+ const existing = this._findEntry(entry.key);
318
+ if (existing !== undefined) {
319
+ existing.value.addTree(entry.value);
320
+ }
321
+ else {
322
+ this.#entries.push({ key: entry.key, value: entry.value });
323
+ }
324
+ }
325
+ }
326
+ /**
327
+ * Splits this tree into one tree per root key. If the tree has a single root, returns a singleton list
328
+ * containing this tree.
329
+ */
330
+ splitParents() {
331
+ if (this.#entries.length === 1) {
332
+ return [this];
333
+ }
334
+ const parents = [];
335
+ for (const entry of this.#entries) {
336
+ const parentTree = new Tree();
337
+ parentTree.#entries.push({ key: entry.key, value: entry.value });
338
+ parents.push(parentTree);
339
+ }
340
+ return parents;
341
+ }
342
+ /**
343
+ * Produces a formatted string representation of the tree structure using a |-- ASCII style,
344
+ * Uses a |-- ASCII style with a 3-space indent per level and no trailing newline.
345
+ */
346
+ prettyPrint() {
347
+ const lines = [];
348
+ this._prettyPrint(lines, '');
349
+ return lines.join('\n');
350
+ }
351
+ _prettyPrint(lines, prefix) {
352
+ for (const entry of this.#entries) {
353
+ lines.push(`${prefix}|--${entry.key}`);
354
+ entry.value._prettyPrint(lines, `${prefix} `);
355
+ }
356
+ }
357
+ /**
358
+ * Structural recursive equality. Order across siblings is irrelevant; two trees are equal if they have the
359
+ * same set of keys and each key's subtree is recursively equal.
360
+ */
361
+ equals(other) {
362
+ if (this === other) {
363
+ return true;
364
+ }
365
+ if (!(other instanceof Tree)) {
366
+ return false;
367
+ }
368
+ if (this.#entries.length !== other.#entries.length) {
369
+ return false;
370
+ }
371
+ for (const entry of this.#entries) {
372
+ const match = other._findEntry(entry.key);
373
+ if (match === undefined) {
374
+ return false;
375
+ }
376
+ if (!entry.value.equals(match.value)) {
377
+ return false;
378
+ }
379
+ }
380
+ return true;
381
+ }
382
+ toString() {
383
+ const parts = this.#entries.map((e) => `${e.key}=${e.value.toString()}`);
384
+ return `{${parts.join(', ')}}`;
385
+ }
386
+ }
387
+ /**
388
+ * Represents a walk through a graph as defined by a traversal.
389
+ */
390
+ export class Path {
391
+ labels;
392
+ objects;
393
+ constructor(labels, objects) {
394
+ this.labels = labels;
395
+ this.objects = objects;
396
+ }
397
+ toString() {
398
+ return `path[${(this.objects || []).join(', ')}]`;
399
+ }
400
+ equals(other) {
401
+ if (!(other instanceof Path)) {
402
+ return false;
403
+ }
404
+ if (other === this) {
405
+ return true;
406
+ }
407
+ return areEqual(this.objects, other.objects) && areEqual(this.labels, other.labels);
408
+ }
409
+ }
410
+ /**
411
+ * Null-safe structural key comparison for Tree keys, built on {@link areEqual}.
412
+ * areEqual dereferences obj.equals, so null/undefined keys are handled here first.
413
+ * Element keys also require matching concrete type (the shared {@link Element.equals}
414
+ * compares by id only), so a Vertex and an Edge with the same id stay distinct keys.
415
+ */
416
+ function treeKeysEqual(a, b) {
417
+ if (a === b) {
418
+ return true;
419
+ }
420
+ if (a === null || a === undefined || b === null || b === undefined) {
421
+ return false;
422
+ }
423
+ if (a instanceof Element && b instanceof Element && a.constructor !== b.constructor) {
424
+ return false;
425
+ }
426
+ return areEqual(a, b);
427
+ }
428
+ function areEqual(obj1, obj2) {
429
+ if (obj1 === obj2) {
430
+ return true;
431
+ }
432
+ if (typeof obj1.equals === 'function') {
433
+ return obj1.equals(obj2);
434
+ }
435
+ if (Array.isArray(obj1) && Array.isArray(obj2)) {
436
+ if (obj1.length !== obj2.length) {
437
+ return false;
438
+ }
439
+ for (let i = 0; i < obj1.length; i++) {
440
+ if (!areEqual(obj1[i], obj2[i])) {
441
+ return false;
442
+ }
443
+ }
444
+ return true;
445
+ }
446
+ return false;
447
+ }
448
+ /**
449
+ * Represents a composite Provider Defined Type (PDT).
450
+ */
451
+ export class CompositePDT {
452
+ name;
453
+ fields;
454
+ constructor(name, fields) {
455
+ if (!name)
456
+ throw new Error('CompositePDT name cannot be null or empty');
457
+ this.name = name;
458
+ this.fields = Object.freeze(fields || {});
459
+ }
460
+ toString() {
461
+ return `pdt[${this.name}]${JSON.stringify(this.fields)}`;
462
+ }
463
+ }
464
+ /**
465
+ * Represents a primitive Provider Defined Type (PDT).
466
+ */
467
+ export class PrimitivePDT {
468
+ name;
469
+ value;
470
+ constructor(name, value) {
471
+ if (!name)
472
+ throw new Error('PrimitivePDT name cannot be null or empty');
473
+ if (value === null || value === undefined)
474
+ throw new Error('PrimitivePDT value cannot be null');
475
+ this.name = name;
476
+ this.value = value;
477
+ }
478
+ toString() {
479
+ return `pdt[${this.name}:${this.value}]`;
480
+ }
481
+ }
482
+ function summarize(value) {
483
+ if (value === null || value === undefined) {
484
+ return value;
485
+ }
486
+ const strValue = value.toString();
487
+ return strValue.length > 20 ? strValue.substr(0, 20) : strValue;
488
+ }