@haybarn/node-api 1.5.6-rc1 → 2.0.0-rc5

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 (285) hide show
  1. package/README.md +315 -21
  2. package/lib/DuckDBAppender.d.ts +8 -2
  3. package/lib/DuckDBAppender.js +19 -1
  4. package/lib/DuckDBConnection.d.ts +2 -0
  5. package/lib/DuckDBConnection.js +4 -1
  6. package/lib/DuckDBDataChunk.d.ts +30 -0
  7. package/lib/DuckDBDataChunk.js +94 -1
  8. package/lib/DuckDBDataChunkWriter.d.ts +74 -0
  9. package/lib/DuckDBDataChunkWriter.js +109 -0
  10. package/lib/DuckDBLogicalType.d.ts +5 -1
  11. package/lib/DuckDBLogicalType.js +18 -1
  12. package/lib/DuckDBMaterializedResult.d.ts +8 -1
  13. package/lib/DuckDBMaterializedResult.js +22 -2
  14. package/lib/DuckDBPendingResult.d.ts +16 -1
  15. package/lib/DuckDBPendingResult.js +19 -2
  16. package/lib/DuckDBPreparedStatement.d.ts +4 -1
  17. package/lib/DuckDBPreparedStatement.js +17 -4
  18. package/lib/DuckDBResult.d.ts +21 -1
  19. package/lib/DuckDBResult.js +87 -5
  20. package/lib/DuckDBResultReader.d.ts +5 -0
  21. package/lib/DuckDBResultReader.js +9 -2
  22. package/lib/DuckDBScalarFunction.d.ts +9 -5
  23. package/lib/DuckDBScalarFunction.js +14 -5
  24. package/lib/DuckDBScalarFunctionBindInfo.d.ts +16 -0
  25. package/lib/{DuckDBBindInfo.js → DuckDBScalarFunctionBindInfo.js} +5 -3
  26. package/lib/DuckDBScalarFunctionInfo.d.ts +16 -0
  27. package/lib/{DuckDBFunctionInfo.js → DuckDBScalarFunctionInfo.js} +11 -3
  28. package/lib/{DuckDBBindInfo.d.ts → DuckDBScalarFunctionInitInfo.d.ts} +6 -4
  29. package/lib/DuckDBScalarFunctionInitInfo.js +39 -0
  30. package/lib/DuckDBTableFunction.d.ts +41 -0
  31. package/lib/DuckDBTableFunction.js +83 -0
  32. package/lib/DuckDBTableFunctionBindInfo.d.ts +21 -0
  33. package/lib/DuckDBTableFunctionBindInfo.js +54 -0
  34. package/lib/DuckDBTableFunctionInfo.d.ts +15 -0
  35. package/lib/DuckDBTableFunctionInfo.js +42 -0
  36. package/lib/DuckDBTableFunctionInitInfo.d.ts +22 -0
  37. package/lib/DuckDBTableFunctionInitInfo.js +58 -0
  38. package/lib/DuckDBType.d.ts +1 -373
  39. package/lib/DuckDBType.js +14 -927
  40. package/lib/DuckDBTypeId.d.ts +4 -1
  41. package/lib/DuckDBTypeId.js +3 -0
  42. package/lib/DuckDBValueConverter.d.ts +10 -0
  43. package/lib/DuckDBValueConverters.d.ts +27 -0
  44. package/lib/DuckDBValueConverters.js +128 -1
  45. package/lib/DuckDBVector.d.ts +1 -596
  46. package/lib/DuckDBVector.js +14 -2522
  47. package/lib/JSDuckDBValueConverter.d.ts +1 -2
  48. package/lib/JSDuckDBValueConverter.js +5 -2
  49. package/lib/JSInputTypeForTypeId.d.ts +104 -0
  50. package/lib/JSInputTypeForTypeId.js +3 -0
  51. package/lib/JSToDuckDBValueConverter.d.ts +30 -0
  52. package/lib/JSToDuckDBValueConverter.js +83 -0
  53. package/lib/JSTypeForTypeId.d.ts +91 -0
  54. package/lib/JSTypeForTypeId.js +3 -0
  55. package/lib/JsonDuckDBValueConverter.d.ts +1 -2
  56. package/lib/JsonDuckDBValueConverter.js +4 -1
  57. package/lib/JsonTypeForTypeId.d.ts +96 -0
  58. package/lib/JsonTypeForTypeId.js +3 -0
  59. package/lib/ToDuckDBValueConverter.d.ts +41 -0
  60. package/lib/ToDuckDBValueConverter.js +27 -0
  61. package/lib/ToDuckDBValueConverters.d.ts +54 -0
  62. package/lib/ToDuckDBValueConverters.js +199 -0
  63. package/lib/conversion/dateTimeStringConversion.d.ts +2 -2
  64. package/lib/conversion/dateTimeStringConversion.js +20 -7
  65. package/lib/conversion/varintDecode.d.ts +18 -0
  66. package/lib/conversion/varintDecode.js +42 -0
  67. package/lib/convertColumnsFromChunks.d.ts +1 -1
  68. package/lib/convertColumnsFromChunks.js +2 -2
  69. package/lib/createResult.d.ts +2 -1
  70. package/lib/createResult.js +3 -3
  71. package/lib/createValue.js +63 -5
  72. package/lib/duckdb.d.ts +15 -2
  73. package/lib/duckdb.js +15 -2
  74. package/lib/getColumnsFromChunks.d.ts +1 -1
  75. package/lib/getColumnsFromChunks.js +2 -2
  76. package/lib/getColumnsObjectFromChunks.js +3 -0
  77. package/lib/readValue.d.ts +22 -0
  78. package/lib/readValue.js +35 -0
  79. package/lib/typeForValue.js +21 -2
  80. package/lib/types/BaseDuckDBType.d.ts +11 -0
  81. package/lib/types/BaseDuckDBType.js +34 -0
  82. package/lib/types/DuckDBAnyType.d.ts +8 -0
  83. package/lib/types/DuckDBAnyType.js +16 -0
  84. package/lib/types/DuckDBArrayType.d.ts +14 -0
  85. package/lib/types/DuckDBArrayType.js +38 -0
  86. package/lib/types/DuckDBBigIntType.d.ts +12 -0
  87. package/lib/types/DuckDBBigIntType.js +24 -0
  88. package/lib/types/DuckDBBigNumType.d.ts +12 -0
  89. package/lib/types/DuckDBBigNumType.js +24 -0
  90. package/lib/types/DuckDBBitType.d.ts +8 -0
  91. package/lib/types/DuckDBBitType.js +16 -0
  92. package/lib/types/DuckDBBlobType.d.ts +8 -0
  93. package/lib/types/DuckDBBlobType.js +16 -0
  94. package/lib/types/DuckDBBooleanType.d.ts +8 -0
  95. package/lib/types/DuckDBBooleanType.js +16 -0
  96. package/lib/types/DuckDBDateType.d.ts +14 -0
  97. package/lib/types/DuckDBDateType.js +32 -0
  98. package/lib/types/DuckDBDecimalType.d.ts +14 -0
  99. package/lib/types/DuckDBDecimalType.js +45 -0
  100. package/lib/types/DuckDBDoubleType.d.ts +12 -0
  101. package/lib/types/DuckDBDoubleType.js +24 -0
  102. package/lib/types/DuckDBEnumType.d.ts +29 -0
  103. package/lib/types/DuckDBEnumType.js +100 -0
  104. package/lib/types/DuckDBFloatType.d.ts +12 -0
  105. package/lib/types/DuckDBFloatType.js +24 -0
  106. package/lib/types/DuckDBGeometryType.d.ts +19 -0
  107. package/lib/types/DuckDBGeometryType.js +38 -0
  108. package/lib/types/DuckDBHugeIntType.d.ts +12 -0
  109. package/lib/types/DuckDBHugeIntType.js +24 -0
  110. package/lib/types/DuckDBIntegerLiteralType.d.ts +8 -0
  111. package/lib/types/DuckDBIntegerLiteralType.js +16 -0
  112. package/lib/types/DuckDBIntegerType.d.ts +12 -0
  113. package/lib/types/DuckDBIntegerType.js +24 -0
  114. package/lib/types/DuckDBIntervalType.d.ts +8 -0
  115. package/lib/types/DuckDBIntervalType.js +16 -0
  116. package/lib/types/DuckDBListType.d.ts +13 -0
  117. package/lib/types/DuckDBListType.js +35 -0
  118. package/lib/types/DuckDBMapType.d.ts +14 -0
  119. package/lib/types/DuckDBMapType.js +38 -0
  120. package/lib/types/DuckDBSQLNullType.d.ts +10 -0
  121. package/lib/types/DuckDBSQLNullType.js +20 -0
  122. package/lib/types/DuckDBSmallIntType.d.ts +12 -0
  123. package/lib/types/DuckDBSmallIntType.js +24 -0
  124. package/lib/types/DuckDBStringLiteralType.d.ts +8 -0
  125. package/lib/types/DuckDBStringLiteralType.js +16 -0
  126. package/lib/types/DuckDBStructType.d.ts +29 -0
  127. package/lib/types/DuckDBStructType.js +86 -0
  128. package/lib/types/DuckDBTimeNSType.d.ts +11 -0
  129. package/lib/types/DuckDBTimeNSType.js +23 -0
  130. package/lib/types/DuckDBTimeTZType.d.ts +12 -0
  131. package/lib/types/DuckDBTimeTZType.js +26 -0
  132. package/lib/types/DuckDBTimeType.d.ts +11 -0
  133. package/lib/types/DuckDBTimeType.js +23 -0
  134. package/lib/types/DuckDBTimestampMillisecondsType.d.ts +14 -0
  135. package/lib/types/DuckDBTimestampMillisecondsType.js +32 -0
  136. package/lib/types/DuckDBTimestampNanosecondsType.d.ts +14 -0
  137. package/lib/types/DuckDBTimestampNanosecondsType.js +32 -0
  138. package/lib/types/DuckDBTimestampSecondsType.d.ts +14 -0
  139. package/lib/types/DuckDBTimestampSecondsType.js +32 -0
  140. package/lib/types/DuckDBTimestampTZNanosecondsType.d.ts +15 -0
  141. package/lib/types/DuckDBTimestampTZNanosecondsType.js +35 -0
  142. package/lib/types/DuckDBTimestampTZType.d.ts +15 -0
  143. package/lib/types/DuckDBTimestampTZType.js +35 -0
  144. package/lib/types/DuckDBTimestampType.d.ts +16 -0
  145. package/lib/types/DuckDBTimestampType.js +33 -0
  146. package/lib/types/DuckDBTinyIntType.d.ts +12 -0
  147. package/lib/types/DuckDBTinyIntType.js +24 -0
  148. package/lib/types/DuckDBType.d.ts +43 -0
  149. package/lib/types/DuckDBType.js +2 -0
  150. package/lib/types/DuckDBUBigIntType.d.ts +12 -0
  151. package/lib/types/DuckDBUBigIntType.js +24 -0
  152. package/lib/types/DuckDBUHugeIntType.d.ts +12 -0
  153. package/lib/types/DuckDBUHugeIntType.js +24 -0
  154. package/lib/types/DuckDBUIntegerType.d.ts +12 -0
  155. package/lib/types/DuckDBUIntegerType.js +24 -0
  156. package/lib/types/DuckDBUSmallIntType.d.ts +12 -0
  157. package/lib/types/DuckDBUSmallIntType.js +24 -0
  158. package/lib/types/DuckDBUTinyIntType.d.ts +12 -0
  159. package/lib/types/DuckDBUTinyIntType.js +24 -0
  160. package/lib/types/DuckDBUUIDType.d.ts +11 -0
  161. package/lib/types/DuckDBUUIDType.js +23 -0
  162. package/lib/types/DuckDBUnionType.d.ts +18 -0
  163. package/lib/types/DuckDBUnionType.js +64 -0
  164. package/lib/types/DuckDBVarCharType.d.ts +8 -0
  165. package/lib/types/DuckDBVarCharType.js +16 -0
  166. package/lib/types/DuckDBVariantType.d.ts +8 -0
  167. package/lib/types/DuckDBVariantType.js +16 -0
  168. package/lib/types/index.d.ts +44 -0
  169. package/lib/types/index.js +60 -0
  170. package/lib/values/DuckDBGeometryValue.d.ts +12 -0
  171. package/lib/values/DuckDBGeometryValue.js +30 -0
  172. package/lib/values/DuckDBTimestampTZNanosecondsValue.d.ts +14 -0
  173. package/lib/values/DuckDBTimestampTZNanosecondsValue.js +33 -0
  174. package/lib/values/DuckDBTupleValue.d.ts +11 -0
  175. package/lib/values/DuckDBTupleValue.js +22 -0
  176. package/lib/values/DuckDBUUIDValue.js +5 -1
  177. package/lib/values/DuckDBValue.d.ts +5 -1
  178. package/lib/values/DuckDBVariantValue.d.ts +19 -0
  179. package/lib/values/DuckDBVariantValue.js +30 -0
  180. package/lib/values/index.d.ts +4 -0
  181. package/lib/values/index.js +4 -0
  182. package/lib/vectors/DuckDBArrayVector.d.ts +21 -0
  183. package/lib/vectors/DuckDBArrayVector.js +79 -0
  184. package/lib/vectors/DuckDBBigIntVector.d.ts +17 -0
  185. package/lib/vectors/DuckDBBigIntVector.js +58 -0
  186. package/lib/vectors/DuckDBBigNumVector.d.ts +21 -0
  187. package/lib/vectors/DuckDBBigNumVector.js +70 -0
  188. package/lib/vectors/DuckDBBitVector.d.ts +22 -0
  189. package/lib/vectors/DuckDBBitVector.js +74 -0
  190. package/lib/vectors/DuckDBBlobVector.d.ts +32 -0
  191. package/lib/vectors/DuckDBBlobVector.js +83 -0
  192. package/lib/vectors/DuckDBBooleanVector.d.ts +18 -0
  193. package/lib/vectors/DuckDBBooleanVector.js +58 -0
  194. package/lib/vectors/DuckDBDateVector.d.ts +18 -0
  195. package/lib/vectors/DuckDBDateVector.js +64 -0
  196. package/lib/vectors/DuckDBDecimal128Vector.d.ts +21 -0
  197. package/lib/vectors/DuckDBDecimal128Vector.js +64 -0
  198. package/lib/vectors/DuckDBDecimal16Vector.d.ts +21 -0
  199. package/lib/vectors/DuckDBDecimal16Vector.js +64 -0
  200. package/lib/vectors/DuckDBDecimal32Vector.d.ts +21 -0
  201. package/lib/vectors/DuckDBDecimal32Vector.js +64 -0
  202. package/lib/vectors/DuckDBDecimal64Vector.d.ts +21 -0
  203. package/lib/vectors/DuckDBDecimal64Vector.js +64 -0
  204. package/lib/vectors/DuckDBDoubleVector.d.ts +17 -0
  205. package/lib/vectors/DuckDBDoubleVector.js +54 -0
  206. package/lib/vectors/DuckDBEnum16Vector.d.ts +18 -0
  207. package/lib/vectors/DuckDBEnum16Vector.js +57 -0
  208. package/lib/vectors/DuckDBEnum32Vector.d.ts +18 -0
  209. package/lib/vectors/DuckDBEnum32Vector.js +57 -0
  210. package/lib/vectors/DuckDBEnum8Vector.d.ts +18 -0
  211. package/lib/vectors/DuckDBEnum8Vector.js +57 -0
  212. package/lib/vectors/DuckDBFloatVector.d.ts +17 -0
  213. package/lib/vectors/DuckDBFloatVector.js +54 -0
  214. package/lib/vectors/DuckDBGeometryVector.d.ts +22 -0
  215. package/lib/vectors/DuckDBGeometryVector.js +69 -0
  216. package/lib/vectors/DuckDBHugeIntVector.d.ts +19 -0
  217. package/lib/vectors/DuckDBHugeIntVector.js +63 -0
  218. package/lib/vectors/DuckDBIntegerVector.d.ts +17 -0
  219. package/lib/vectors/DuckDBIntegerVector.js +61 -0
  220. package/lib/vectors/DuckDBIntervalVector.d.ts +19 -0
  221. package/lib/vectors/DuckDBIntervalVector.js +67 -0
  222. package/lib/vectors/DuckDBListVector.d.ts +35 -0
  223. package/lib/vectors/DuckDBListVector.js +151 -0
  224. package/lib/vectors/DuckDBMapVector.d.ts +17 -0
  225. package/lib/vectors/DuckDBMapVector.js +60 -0
  226. package/lib/vectors/DuckDBSQLNullVector.d.ts +18 -0
  227. package/lib/vectors/DuckDBSQLNullVector.js +44 -0
  228. package/lib/vectors/DuckDBSmallIntVector.d.ts +17 -0
  229. package/lib/vectors/DuckDBSmallIntVector.js +61 -0
  230. package/lib/vectors/DuckDBStructVector.d.ts +35 -0
  231. package/lib/vectors/DuckDBStructVector.js +105 -0
  232. package/lib/vectors/DuckDBTimeNSVector.d.ts +18 -0
  233. package/lib/vectors/DuckDBTimeNSVector.js +61 -0
  234. package/lib/vectors/DuckDBTimeTZVector.d.ts +18 -0
  235. package/lib/vectors/DuckDBTimeTZVector.js +61 -0
  236. package/lib/vectors/DuckDBTimeVector.d.ts +18 -0
  237. package/lib/vectors/DuckDBTimeVector.js +61 -0
  238. package/lib/vectors/DuckDBTimestampMillisecondsVector.d.ts +18 -0
  239. package/lib/vectors/DuckDBTimestampMillisecondsVector.js +61 -0
  240. package/lib/vectors/DuckDBTimestampNanosecondsVector.d.ts +18 -0
  241. package/lib/vectors/DuckDBTimestampNanosecondsVector.js +61 -0
  242. package/lib/vectors/DuckDBTimestampSecondsVector.d.ts +18 -0
  243. package/lib/vectors/DuckDBTimestampSecondsVector.js +61 -0
  244. package/lib/vectors/DuckDBTimestampTZNanosecondsVector.d.ts +18 -0
  245. package/lib/vectors/DuckDBTimestampTZNanosecondsVector.js +61 -0
  246. package/lib/vectors/DuckDBTimestampTZVector.d.ts +18 -0
  247. package/lib/vectors/DuckDBTimestampTZVector.js +61 -0
  248. package/lib/vectors/DuckDBTimestampVector.d.ts +18 -0
  249. package/lib/vectors/DuckDBTimestampVector.js +61 -0
  250. package/lib/vectors/DuckDBTinyIntVector.d.ts +17 -0
  251. package/lib/vectors/DuckDBTinyIntVector.js +61 -0
  252. package/lib/vectors/DuckDBTupleVector.d.ts +26 -0
  253. package/lib/vectors/DuckDBTupleVector.js +91 -0
  254. package/lib/vectors/DuckDBUBigIntVector.d.ts +17 -0
  255. package/lib/vectors/DuckDBUBigIntVector.js +58 -0
  256. package/lib/vectors/DuckDBUHugeIntVector.d.ts +19 -0
  257. package/lib/vectors/DuckDBUHugeIntVector.js +63 -0
  258. package/lib/vectors/DuckDBUIntegerVector.d.ts +17 -0
  259. package/lib/vectors/DuckDBUIntegerVector.js +61 -0
  260. package/lib/vectors/DuckDBUSmallIntVector.d.ts +17 -0
  261. package/lib/vectors/DuckDBUSmallIntVector.js +61 -0
  262. package/lib/vectors/DuckDBUTinyIntVector.d.ts +17 -0
  263. package/lib/vectors/DuckDBUTinyIntVector.js +61 -0
  264. package/lib/vectors/DuckDBUUIDVector.d.ts +19 -0
  265. package/lib/vectors/DuckDBUUIDVector.js +59 -0
  266. package/lib/vectors/DuckDBUnionVector.d.ts +17 -0
  267. package/lib/vectors/DuckDBUnionVector.js +70 -0
  268. package/lib/vectors/DuckDBValidity.d.ts +12 -0
  269. package/lib/vectors/DuckDBValidity.js +91 -0
  270. package/lib/vectors/DuckDBVarCharVector.d.ts +21 -0
  271. package/lib/vectors/DuckDBVarCharVector.js +74 -0
  272. package/lib/vectors/DuckDBVariantVector.d.ts +42 -0
  273. package/lib/vectors/DuckDBVariantVector.js +461 -0
  274. package/lib/vectors/DuckDBVector.d.ts +14 -0
  275. package/lib/vectors/DuckDBVector.js +27 -0
  276. package/lib/vectors/createVector.d.ts +1 -0
  277. package/lib/vectors/createVector.js +201 -0
  278. package/lib/vectors/dataAccessors.d.ts +45 -0
  279. package/lib/vectors/dataAccessors.js +344 -0
  280. package/lib/vectors/index.d.ts +47 -0
  281. package/lib/vectors/index.js +65 -0
  282. package/lib/vectors/vectorRegistry.d.ts +20 -0
  283. package/lib/vectors/vectorRegistry.js +16 -0
  284. package/package.json +3 -2
  285. package/lib/DuckDBFunctionInfo.d.ts +0 -10
@@ -0,0 +1,461 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DuckDBVariantVector = void 0;
4
+ const varintDecode_1 = require("../conversion/varintDecode");
5
+ const DuckDBType_1 = require("../DuckDBType");
6
+ const DuckDBTypeId_1 = require("../DuckDBTypeId");
7
+ const values_1 = require("../values");
8
+ const DuckDBVector_1 = require("./DuckDBVector");
9
+ const dataAccessors_1 = require("./dataAccessors");
10
+ const DuckDBStructVector_1 = require("./DuckDBStructVector");
11
+ // ---------------------------------------------------------------------------
12
+ // VARIANT
13
+ // ---------------------------------------------------------------------------
14
+ //
15
+ // VARIANT is a self-describing tagged value type whose physical layout is a
16
+ // STRUCT of four children: `keys` (LIST(VARCHAR)), `children`
17
+ // (LIST(STRUCT(keys_index, values_index))), `values`
18
+ // (LIST(STRUCT(type_id, byte_offset))), and `data` (BLOB). Each row's root
19
+ // node sits at index 0 of its `values` slice; primitive payloads live at
20
+ // `byte_offsets[...]` inside the row's blob, and OBJECT/ARRAY nodes
21
+ // reference their children through the row's `children` slice.
22
+ //
23
+ // Reading reuses the existing DuckDBStructVector / DuckDBListVector /
24
+ // DuckDBBlobVector construction plus the byte-readers above for primitive
25
+ // payloads. Writing is not yet supported.
26
+ /**
27
+ * On-disk tag for a single VARIANT node. Mirrors DuckDB's
28
+ * `VariantLogicalType` enum.
29
+ */
30
+ var VariantLogicalType;
31
+ (function (VariantLogicalType) {
32
+ VariantLogicalType[VariantLogicalType["VARIANT_NULL"] = 0] = "VARIANT_NULL";
33
+ VariantLogicalType[VariantLogicalType["BOOL_TRUE"] = 1] = "BOOL_TRUE";
34
+ VariantLogicalType[VariantLogicalType["BOOL_FALSE"] = 2] = "BOOL_FALSE";
35
+ VariantLogicalType[VariantLogicalType["INT8"] = 3] = "INT8";
36
+ VariantLogicalType[VariantLogicalType["INT16"] = 4] = "INT16";
37
+ VariantLogicalType[VariantLogicalType["INT32"] = 5] = "INT32";
38
+ VariantLogicalType[VariantLogicalType["INT64"] = 6] = "INT64";
39
+ VariantLogicalType[VariantLogicalType["INT128"] = 7] = "INT128";
40
+ VariantLogicalType[VariantLogicalType["UINT8"] = 8] = "UINT8";
41
+ VariantLogicalType[VariantLogicalType["UINT16"] = 9] = "UINT16";
42
+ VariantLogicalType[VariantLogicalType["UINT32"] = 10] = "UINT32";
43
+ VariantLogicalType[VariantLogicalType["UINT64"] = 11] = "UINT64";
44
+ VariantLogicalType[VariantLogicalType["UINT128"] = 12] = "UINT128";
45
+ VariantLogicalType[VariantLogicalType["FLOAT"] = 13] = "FLOAT";
46
+ VariantLogicalType[VariantLogicalType["DOUBLE"] = 14] = "DOUBLE";
47
+ VariantLogicalType[VariantLogicalType["DECIMAL"] = 15] = "DECIMAL";
48
+ VariantLogicalType[VariantLogicalType["VARCHAR"] = 16] = "VARCHAR";
49
+ VariantLogicalType[VariantLogicalType["BLOB"] = 17] = "BLOB";
50
+ VariantLogicalType[VariantLogicalType["UUID"] = 18] = "UUID";
51
+ VariantLogicalType[VariantLogicalType["DATE"] = 19] = "DATE";
52
+ VariantLogicalType[VariantLogicalType["TIME_MICROS"] = 20] = "TIME_MICROS";
53
+ VariantLogicalType[VariantLogicalType["TIME_NANOS"] = 21] = "TIME_NANOS";
54
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_SEC"] = 22] = "TIMESTAMP_SEC";
55
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_MILIS"] = 23] = "TIMESTAMP_MILIS";
56
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_MICROS"] = 24] = "TIMESTAMP_MICROS";
57
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_NANOS"] = 25] = "TIMESTAMP_NANOS";
58
+ VariantLogicalType[VariantLogicalType["TIME_MICROS_TZ"] = 26] = "TIME_MICROS_TZ";
59
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_MICROS_TZ"] = 27] = "TIMESTAMP_MICROS_TZ";
60
+ VariantLogicalType[VariantLogicalType["INTERVAL"] = 28] = "INTERVAL";
61
+ VariantLogicalType[VariantLogicalType["OBJECT"] = 29] = "OBJECT";
62
+ VariantLogicalType[VariantLogicalType["ARRAY"] = 30] = "ARRAY";
63
+ VariantLogicalType[VariantLogicalType["BIGNUM"] = 31] = "BIGNUM";
64
+ VariantLogicalType[VariantLogicalType["BITSTRING"] = 32] = "BITSTRING";
65
+ VariantLogicalType[VariantLogicalType["GEOMETRY"] = 33] = "GEOMETRY";
66
+ VariantLogicalType[VariantLogicalType["TIMESTAMP_NANOS_TZ"] = 34] = "TIMESTAMP_NANOS_TZ";
67
+ })(VariantLogicalType || (VariantLogicalType = {}));
68
+ /** Physical STRUCT layout of a VARIANT column. Mirrors `LogicalType::VARIANT()`. */
69
+ const VARIANT_PHYSICAL_TYPE = (0, DuckDBType_1.STRUCT)({
70
+ keys: (0, DuckDBType_1.LIST)(DuckDBType_1.VARCHAR),
71
+ children: (0, DuckDBType_1.LIST)((0, DuckDBType_1.STRUCT)({ keys_index: DuckDBType_1.UINTEGER, values_index: DuckDBType_1.UINTEGER })),
72
+ values: (0, DuckDBType_1.LIST)((0, DuckDBType_1.STRUCT)({ type_id: DuckDBType_1.UTINYINT, byte_offset: DuckDBType_1.UINTEGER })),
73
+ data: DuckDBType_1.BLOB,
74
+ });
75
+ class DuckDBVariantVector extends DuckDBVector_1.DuckDBVector {
76
+ structVec;
77
+ keysList;
78
+ childrenList;
79
+ valuesList;
80
+ dataBlob;
81
+ keysEntry;
82
+ keysIdxVec;
83
+ valuesIdxVec;
84
+ typeIdVec;
85
+ byteOffsetVec;
86
+ constructor(structVec) {
87
+ super();
88
+ this.structVec = structVec;
89
+ this.keysList = structVec.entryVectorAt(0);
90
+ this.childrenList = structVec.entryVectorAt(1);
91
+ this.valuesList = structVec.entryVectorAt(2);
92
+ this.dataBlob = structVec.entryVectorAt(3);
93
+ this.keysEntry = this.keysList.childVector;
94
+ const childrenInner = this.childrenList.childVector;
95
+ const valuesInner = this.valuesList.childVector;
96
+ this.keysIdxVec = childrenInner.entryVectorAt(0);
97
+ this.valuesIdxVec = childrenInner.entryVectorAt(1);
98
+ this.typeIdVec = valuesInner.entryVectorAt(0);
99
+ this.byteOffsetVec = valuesInner.entryVectorAt(1);
100
+ }
101
+ static fromRawVector(vector, itemCount) {
102
+ const structVec = DuckDBStructVector_1.DuckDBStructVector.fromRawVector(VARIANT_PHYSICAL_TYPE, vector, itemCount);
103
+ return new DuckDBVariantVector(structVec);
104
+ }
105
+ get type() {
106
+ return DuckDBType_1.DuckDBVariantType.instance;
107
+ }
108
+ get itemCount() {
109
+ return this.structVec.itemCount;
110
+ }
111
+ getItem(itemIndex) {
112
+ // Top-level validity is the canonical SQL-NULL indicator. Child rows
113
+ // may still carry data when the row is SQL-NULL; the inverse — that a
114
+ // non-NULL row has non-NULL children — is the only direction
115
+ // guaranteed by the format.
116
+ if (!this.structVec.isItemValid(itemIndex)) {
117
+ return null;
118
+ }
119
+ const blob = this.dataBlob.getItemBytes(itemIndex);
120
+ if (blob === null) {
121
+ // Defensive: a valid row's data BLOB is expected to be present.
122
+ return null;
123
+ }
124
+ const row = {
125
+ blob,
126
+ view: new DataView(blob.buffer, blob.byteOffset, blob.byteLength),
127
+ valuesOffset: this.valuesList.getEntryOffset(itemIndex),
128
+ valuesLength: this.valuesList.getEntryLength(itemIndex),
129
+ childrenOffset: this.childrenList.getEntryOffset(itemIndex),
130
+ childrenLength: this.childrenList.getEntryLength(itemIndex),
131
+ keysOffset: this.keysList.getEntryOffset(itemIndex),
132
+ keysLength: this.keysList.getEntryLength(itemIndex),
133
+ };
134
+ const root = this.decodeNode(0, row);
135
+ return new values_1.DuckDBVariantValue(root.value, root.type);
136
+ }
137
+ setItem(_itemIndex, value) {
138
+ // Writing a VARIANT value isn't supported yet. setItem(null) is
139
+ // tolerated as a no-op so a parent struct/list/array can iterate
140
+ // every child and call setItem(null) on this column without failing
141
+ // — the read path remains usable inside arbitrary container types.
142
+ if (value !== null) {
143
+ throw new Error('Setting VARIANT values is not yet supported.');
144
+ }
145
+ }
146
+ flush() {
147
+ // No-op: VARIANT is read-only, but a parent vector's flush() will
148
+ // still call this on every child. Nothing to write back.
149
+ }
150
+ slice(offset, length) {
151
+ return new DuckDBVariantVector(this.structVec.slice(offset, length));
152
+ }
153
+ /**
154
+ * Decode one variant node identified by its row-local `valueIndex`
155
+ * (an index into the row's `values` list). Per-row state is bundled in
156
+ * `row`: the data blob plus the row-local list slice extents and the
157
+ * absolute backing-array offsets they begin at. All recursive calls
158
+ * share the same `row`; only `valueIndex` changes.
159
+ *
160
+ * Returns both the decoded value and the `DuckDBType` corresponding to
161
+ * the node's on-disk tag, so the top-level caller can attach the type
162
+ * to the resulting `DuckDBVariantValue` for round-trip fidelity.
163
+ *
164
+ * Throws if any index decoded from the blob falls outside its row-local
165
+ * list slice — guards against malformed or hostile VARIANT payloads.
166
+ */
167
+ decodeNode(valueIndex, row) {
168
+ if (valueIndex >= row.valuesLength) {
169
+ throw new Error(`Malformed VARIANT: value_index ${valueIndex} out of bounds (row values length ${row.valuesLength})`);
170
+ }
171
+ const nodeAbs = row.valuesOffset + valueIndex;
172
+ const tag = this.typeIdVec.getItem(nodeAbs);
173
+ const byteOffset = this.byteOffsetVec.getItem(nodeAbs);
174
+ const { blob, view } = row;
175
+ switch (tag) {
176
+ case VariantLogicalType.VARIANT_NULL:
177
+ return { value: null, type: DuckDBType_1.SQLNULL };
178
+ case VariantLogicalType.BOOL_TRUE:
179
+ return { value: true, type: DuckDBType_1.BOOLEAN };
180
+ case VariantLogicalType.BOOL_FALSE:
181
+ return { value: false, type: DuckDBType_1.BOOLEAN };
182
+ case VariantLogicalType.INT8:
183
+ return { value: view.getInt8(byteOffset), type: DuckDBType_1.TINYINT };
184
+ case VariantLogicalType.INT16:
185
+ return { value: (0, dataAccessors_1.getInt16)(view, byteOffset), type: DuckDBType_1.SMALLINT };
186
+ case VariantLogicalType.INT32:
187
+ return { value: (0, dataAccessors_1.getInt32)(view, byteOffset), type: DuckDBType_1.INTEGER };
188
+ case VariantLogicalType.INT64:
189
+ return { value: (0, dataAccessors_1.getInt64)(view, byteOffset), type: DuckDBType_1.BIGINT };
190
+ case VariantLogicalType.INT128:
191
+ return { value: (0, dataAccessors_1.getInt128)(view, byteOffset), type: DuckDBType_1.HUGEINT };
192
+ case VariantLogicalType.UINT8:
193
+ return { value: (0, dataAccessors_1.getUInt8)(view, byteOffset), type: DuckDBType_1.UTINYINT };
194
+ case VariantLogicalType.UINT16:
195
+ return { value: (0, dataAccessors_1.getUInt16)(view, byteOffset), type: DuckDBType_1.USMALLINT };
196
+ case VariantLogicalType.UINT32:
197
+ return { value: (0, dataAccessors_1.getUInt32)(view, byteOffset), type: DuckDBType_1.UINTEGER };
198
+ case VariantLogicalType.UINT64:
199
+ return { value: (0, dataAccessors_1.getUInt64)(view, byteOffset), type: DuckDBType_1.UBIGINT };
200
+ case VariantLogicalType.UINT128:
201
+ return { value: (0, dataAccessors_1.getUInt128)(view, byteOffset), type: DuckDBType_1.UHUGEINT };
202
+ case VariantLogicalType.FLOAT:
203
+ return {
204
+ value: view.getFloat32(byteOffset, dataAccessors_1.littleEndian),
205
+ type: DuckDBType_1.FLOAT,
206
+ };
207
+ case VariantLogicalType.DOUBLE:
208
+ return {
209
+ value: view.getFloat64(byteOffset, dataAccessors_1.littleEndian),
210
+ type: DuckDBType_1.DOUBLE,
211
+ };
212
+ case VariantLogicalType.UUID:
213
+ return {
214
+ value: values_1.DuckDBUUIDValue.fromStoredHugeInt((0, dataAccessors_1.getInt128)(view, byteOffset)),
215
+ type: DuckDBType_1.UUID,
216
+ };
217
+ case VariantLogicalType.DATE:
218
+ return {
219
+ value: new values_1.DuckDBDateValue((0, dataAccessors_1.getInt32)(view, byteOffset)),
220
+ type: DuckDBType_1.DATE,
221
+ };
222
+ case VariantLogicalType.TIME_MICROS:
223
+ return {
224
+ value: new values_1.DuckDBTimeValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
225
+ type: DuckDBType_1.TIME,
226
+ };
227
+ case VariantLogicalType.TIME_NANOS:
228
+ return {
229
+ value: new values_1.DuckDBTimeNSValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
230
+ type: DuckDBType_1.TIME_NS,
231
+ };
232
+ case VariantLogicalType.TIME_MICROS_TZ:
233
+ return {
234
+ value: values_1.DuckDBTimeTZValue.fromBits((0, dataAccessors_1.getUInt64)(view, byteOffset)),
235
+ type: DuckDBType_1.TIMETZ,
236
+ };
237
+ case VariantLogicalType.TIMESTAMP_SEC:
238
+ return {
239
+ value: new values_1.DuckDBTimestampSecondsValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
240
+ type: DuckDBType_1.TIMESTAMP_S,
241
+ };
242
+ case VariantLogicalType.TIMESTAMP_MILIS:
243
+ return {
244
+ value: new values_1.DuckDBTimestampMillisecondsValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
245
+ type: DuckDBType_1.TIMESTAMP_MS,
246
+ };
247
+ case VariantLogicalType.TIMESTAMP_MICROS:
248
+ return {
249
+ value: new values_1.DuckDBTimestampValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
250
+ type: DuckDBType_1.TIMESTAMP,
251
+ };
252
+ case VariantLogicalType.TIMESTAMP_NANOS:
253
+ return {
254
+ value: new values_1.DuckDBTimestampNanosecondsValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
255
+ type: DuckDBType_1.TIMESTAMP_NS,
256
+ };
257
+ case VariantLogicalType.TIMESTAMP_MICROS_TZ:
258
+ return {
259
+ value: new values_1.DuckDBTimestampTZValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
260
+ type: DuckDBType_1.TIMESTAMPTZ,
261
+ };
262
+ case VariantLogicalType.TIMESTAMP_NANOS_TZ:
263
+ return {
264
+ value: new values_1.DuckDBTimestampTZNanosecondsValue((0, dataAccessors_1.getInt64)(view, byteOffset)),
265
+ type: DuckDBType_1.TIMESTAMPTZ_NS,
266
+ };
267
+ case VariantLogicalType.INTERVAL:
268
+ return {
269
+ value: new values_1.DuckDBIntervalValue((0, dataAccessors_1.getInt32)(view, byteOffset), (0, dataAccessors_1.getInt32)(view, byteOffset + 4), (0, dataAccessors_1.getInt64)(view, byteOffset + 8)),
270
+ type: DuckDBType_1.INTERVAL,
271
+ };
272
+ case VariantLogicalType.VARCHAR: {
273
+ const bytes = readVarintBytes(view, byteOffset, blob);
274
+ return { value: dataAccessors_1.textDecoder.decode(bytes), type: DuckDBType_1.VARCHAR };
275
+ }
276
+ case VariantLogicalType.BLOB: {
277
+ // Copy out — the bytes alias the underlying vector storage, which
278
+ // we don't want to share through to user code.
279
+ const bytes = readVarintBytes(view, byteOffset, blob);
280
+ return {
281
+ value: new values_1.DuckDBBlobValue(new Uint8Array(bytes)),
282
+ type: DuckDBType_1.BLOB,
283
+ };
284
+ }
285
+ case VariantLogicalType.BITSTRING: {
286
+ const bytes = readVarintBytes(view, byteOffset, blob);
287
+ return {
288
+ value: new values_1.DuckDBBitValue(new Uint8Array(bytes)),
289
+ type: DuckDBType_1.BIT,
290
+ };
291
+ }
292
+ case VariantLogicalType.BIGNUM: {
293
+ const bytes = readVarintBytes(view, byteOffset, blob);
294
+ return { value: (0, dataAccessors_1.getBigNumFromBytes)(bytes), type: DuckDBType_1.BIGNUM };
295
+ }
296
+ case VariantLogicalType.GEOMETRY: {
297
+ const bytes = readVarintBytes(view, byteOffset, blob);
298
+ return {
299
+ value: new values_1.DuckDBGeometryValue(new Uint8Array(bytes)),
300
+ type: DuckDBType_1.GEOMETRY,
301
+ };
302
+ }
303
+ case VariantLogicalType.DECIMAL: {
304
+ const wParse = (0, varintDecode_1.varintDecode)(view, byteOffset);
305
+ const sParse = (0, varintDecode_1.varintDecode)(view, wParse.nextOffset);
306
+ const width = wParse.value;
307
+ const scale = sParse.value;
308
+ const valueOffset = sParse.nextOffset;
309
+ let intValue;
310
+ if (width <= 4) {
311
+ intValue = BigInt((0, dataAccessors_1.getInt16)(view, valueOffset));
312
+ }
313
+ else if (width <= 9) {
314
+ intValue = BigInt((0, dataAccessors_1.getInt32)(view, valueOffset));
315
+ }
316
+ else if (width <= 18) {
317
+ intValue = (0, dataAccessors_1.getInt64)(view, valueOffset);
318
+ }
319
+ else if (width <= 38) {
320
+ intValue = (0, dataAccessors_1.getInt128)(view, valueOffset);
321
+ }
322
+ else {
323
+ throw new Error(`VARIANT DECIMAL width too large: ${width}`);
324
+ }
325
+ return {
326
+ value: new values_1.DuckDBDecimalValue(intValue, width, scale),
327
+ type: (0, DuckDBType_1.DECIMAL)(width, scale),
328
+ };
329
+ }
330
+ case VariantLogicalType.OBJECT: {
331
+ const { childCount, childrenIdx } = readNestedHeader(view, byteOffset);
332
+ this.checkChildrenSlice(childrenIdx, childCount, row);
333
+ const entries = {};
334
+ const fields = {};
335
+ for (let k = 0; k < childCount; k++) {
336
+ const entryAbs = row.childrenOffset + childrenIdx + k;
337
+ const keyIdx = this.keysIdxVec.getItem(entryAbs);
338
+ if (keyIdx >= row.keysLength) {
339
+ throw new Error(`Malformed VARIANT: keys_index ${keyIdx} out of bounds (row keys length ${row.keysLength})`);
340
+ }
341
+ const keyStr = this.keysEntry.getItem(row.keysOffset + keyIdx);
342
+ const valIdx = this.valuesIdxVec.getItem(entryAbs);
343
+ const child = this.decodeNode(valIdx, row);
344
+ entries[keyStr] = child.value;
345
+ fields[keyStr] = child.type;
346
+ }
347
+ return {
348
+ value: new values_1.DuckDBStructValue(entries),
349
+ type: (0, DuckDBType_1.STRUCT)(fields),
350
+ };
351
+ }
352
+ case VariantLogicalType.ARRAY: {
353
+ const { childCount, childrenIdx } = readNestedHeader(view, byteOffset);
354
+ this.checkChildrenSlice(childrenIdx, childCount, row);
355
+ // Decode all children first so we can decide whether their types
356
+ // are uniform. If they are (treating SQLNULL as compatible with
357
+ // any sibling, so e.g. [1, 2, null] reads as LIST(UBIGINT)), use
358
+ // `LIST(commonType)` with bare items — that's a Value the C API's
359
+ // create_list_value will accept, and it round-trips through
360
+ // bind/append cleanly. Otherwise fall back to `LIST(VARIANT)`
361
+ // with non-null items wrapped to preserve their type; null items
362
+ // remain bare to match how column-level LIST(VARIANT) decodes a
363
+ // null element.
364
+ const children = [];
365
+ for (let k = 0; k < childCount; k++) {
366
+ const entryAbs = row.childrenOffset + childrenIdx + k;
367
+ const valIdx = this.valuesIdxVec.getItem(entryAbs);
368
+ children.push(this.decodeNode(valIdx, row));
369
+ }
370
+ const commonType = uniformVariantChildType(children);
371
+ if (commonType !== null) {
372
+ return {
373
+ value: new values_1.DuckDBListValue(children.map((c) => c.value)),
374
+ type: (0, DuckDBType_1.LIST)(commonType),
375
+ };
376
+ }
377
+ return {
378
+ value: new values_1.DuckDBListValue(children.map((c) => c.value === null
379
+ ? null
380
+ : new values_1.DuckDBVariantValue(c.value, c.type))),
381
+ type: (0, DuckDBType_1.LIST)(DuckDBType_1.VARIANT),
382
+ };
383
+ }
384
+ default:
385
+ throw new Error(`Unknown VARIANT type id: ${tag}`);
386
+ }
387
+ }
388
+ /** Bounds-check an OBJECT / ARRAY's `[childrenIdx, childrenIdx+childCount)` range. */
389
+ checkChildrenSlice(childrenIdx, childCount, row) {
390
+ if (childrenIdx + childCount > row.childrenLength) {
391
+ throw new Error(`Malformed VARIANT: children slice [${childrenIdx}, ${childrenIdx + childCount}) out of bounds (row children length ${row.childrenLength})`);
392
+ }
393
+ }
394
+ }
395
+ exports.DuckDBVariantVector = DuckDBVariantVector;
396
+ /**
397
+ * Returns the shared DuckDBType if every non-null child has the same type,
398
+ * or `null` if non-null children differ. Used to pick between
399
+ * `LIST(commonType)` and `LIST(VARIANT)` for a decoded ARRAY.
400
+ *
401
+ * SQLNULL children are treated as compatible with any sibling — that way a
402
+ * very common JSON shape like `[1, 2, null]` decodes as `LIST(UBIGINT)`
403
+ * with a bare null element rather than `LIST(VARIANT)`. An array whose
404
+ * children are all SQLNULL (including the empty array) collapses to
405
+ * SQLNULL itself — DuckDB casts `LIST(SQLNULL)` to VARIANT for round-trip,
406
+ * but a `LIST(VARIANT)` of nulls or an empty `LIST(VARIANT)` doesn't
407
+ * survive `create_list_value`.
408
+ */
409
+ function uniformVariantChildType(children) {
410
+ let common = null;
411
+ let commonKey = null;
412
+ for (const child of children) {
413
+ if (child.type.typeId === DuckDBTypeId_1.DuckDBTypeId.SQLNULL) {
414
+ continue;
415
+ }
416
+ const key = typeKey(child.type);
417
+ if (common === null) {
418
+ common = child.type;
419
+ commonKey = key;
420
+ }
421
+ else if (key !== commonKey) {
422
+ return null;
423
+ }
424
+ }
425
+ // All children (if any) are SQLNULL: collapse to SQLNULL.
426
+ return common ?? DuckDBType_1.SQLNULL;
427
+ }
428
+ /**
429
+ * Returns a canonical string for a DuckDBType, suitable for equality
430
+ * comparison between types produced by the same decode pass. Uses the
431
+ * structured `toJson()` representation rather than the SQL-syntactic
432
+ * `toString()` so nested types compare structurally.
433
+ */
434
+ function typeKey(type) {
435
+ return JSON.stringify(type.toJson());
436
+ }
437
+ /**
438
+ * Reads a length-prefixed payload (`<varint length><length bytes>`) from a
439
+ * variant data blob. Returns a (possibly aliased) Uint8Array view over the
440
+ * payload bytes — callers that need to retain the data should copy.
441
+ * Throws if the prefix length would read past the row's blob.
442
+ */
443
+ function readVarintBytes(view, offset, blob) {
444
+ const { value: length, nextOffset } = (0, varintDecode_1.varintDecode)(view, offset);
445
+ if (nextOffset + length > blob.byteLength) {
446
+ throw new Error(`Malformed VARIANT payload: length-prefixed read of ${length} bytes at offset ${nextOffset} exceeds row blob size ${blob.byteLength}`);
447
+ }
448
+ return new Uint8Array(blob.buffer, blob.byteOffset + nextOffset, length);
449
+ }
450
+ /**
451
+ * Reads an OBJECT / ARRAY header: `<varint child_count>` followed by
452
+ * `<varint children_idx>` iff `child_count > 0`.
453
+ */
454
+ function readNestedHeader(view, offset) {
455
+ const cParse = (0, varintDecode_1.varintDecode)(view, offset);
456
+ if (cParse.value === 0) {
457
+ return { childCount: 0, childrenIdx: 0 };
458
+ }
459
+ const iParse = (0, varintDecode_1.varintDecode)(view, cParse.nextOffset);
460
+ return { childCount: cParse.value, childrenIdx: iParse.value };
461
+ }
@@ -0,0 +1,14 @@
1
+ import duckdb from '@haybarn/node-bindings';
2
+ import { DuckDBType } from '../DuckDBType';
3
+ import { DuckDBValue } from '../values';
4
+ export declare abstract class DuckDBVector<TValue extends DuckDBValue = DuckDBValue> {
5
+ static standardSize(): number;
6
+ static create(vector: duckdb.Vector, itemCount: number, knownType?: DuckDBType): DuckDBVector;
7
+ abstract get type(): DuckDBType;
8
+ abstract get itemCount(): number;
9
+ abstract getItem(itemIndex: number): TValue | null;
10
+ abstract setItem(itemIndex: number, value: TValue | null): void;
11
+ abstract flush(): void;
12
+ abstract slice(offset: number, length: number): DuckDBVector<TValue>;
13
+ toArray(): (TValue | null)[];
14
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DuckDBVector = void 0;
7
+ const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
8
+ const vectorRegistry_1 = require("./vectorRegistry");
9
+ class DuckDBVector {
10
+ static standardSize() {
11
+ return node_bindings_1.default.vector_size();
12
+ }
13
+ static create(vector, itemCount, knownType) {
14
+ if (!vectorRegistry_1.vectorRegistry.create) {
15
+ throw new Error('DuckDBVector factory has not been registered');
16
+ }
17
+ return vectorRegistry_1.vectorRegistry.create(vector, itemCount, knownType);
18
+ }
19
+ toArray() {
20
+ const items = [];
21
+ for (let i = 0; i < this.itemCount; i++) {
22
+ items.push(this.getItem(i));
23
+ }
24
+ return items;
25
+ }
26
+ }
27
+ exports.DuckDBVector = DuckDBVector;
@@ -0,0 +1 @@
1
+ export {};