@loaders.gl/parquet 5.0.0-alpha.2 → 5.0.0-alpha.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 (326) hide show
  1. package/LICENSE +1 -1
  2. package/dist/bundled.d.ts +1 -1
  3. package/dist/bundled.d.ts.map +1 -1
  4. package/dist/bundled.js.map +1 -1
  5. package/dist/delta-format.d.ts +9 -0
  6. package/dist/delta-format.d.ts.map +1 -0
  7. package/dist/delta-format.js +12 -0
  8. package/dist/delta-format.js.map +1 -0
  9. package/dist/delta-source-loader-types.d.ts +27 -0
  10. package/dist/delta-source-loader-types.d.ts.map +1 -0
  11. package/dist/delta-source-loader-types.js +28 -0
  12. package/dist/delta-source-loader-types.js.map +1 -0
  13. package/dist/delta-source.d.ts +48 -0
  14. package/dist/delta-source.d.ts.map +1 -0
  15. package/dist/delta-source.js +222 -0
  16. package/dist/delta-source.js.map +1 -0
  17. package/dist/delta-types.d.ts +38 -0
  18. package/dist/delta-types.d.ts.map +1 -0
  19. package/dist/delta-types.js +5 -0
  20. package/dist/delta-types.js.map +1 -0
  21. package/dist/geoparquet-loader.js +1 -1
  22. package/dist/iceberg-rest-catalog.d.ts +49 -0
  23. package/dist/iceberg-rest-catalog.d.ts.map +1 -0
  24. package/dist/iceberg-rest-catalog.js +78 -0
  25. package/dist/iceberg-rest-catalog.js.map +1 -0
  26. package/dist/iceberg-table-source.d.ts +63 -0
  27. package/dist/iceberg-table-source.d.ts.map +1 -0
  28. package/dist/iceberg-table-source.js +797 -0
  29. package/dist/iceberg-table-source.js.map +1 -0
  30. package/dist/iceberg-types.d.ts +150 -0
  31. package/dist/iceberg-types.d.ts.map +1 -0
  32. package/dist/iceberg-types.js +5 -0
  33. package/dist/iceberg-types.js.map +1 -0
  34. package/dist/index.cjs +15005 -3143
  35. package/dist/index.cjs.map +3 -3
  36. package/dist/index.d.ts +7 -3
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +5 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/lib/arrow/convert-schema-from-parquet.d.ts +3 -1
  41. package/dist/lib/arrow/convert-schema-from-parquet.d.ts.map +1 -1
  42. package/dist/lib/arrow/convert-schema-from-parquet.js +94 -19
  43. package/dist/lib/arrow/convert-schema-from-parquet.js.map +1 -1
  44. package/dist/lib/arrow/create-nested-arrow-vector.js +89 -0
  45. package/dist/lib/arrow/create-nested-arrow-vector.js.map +1 -1
  46. package/dist/lib/constants.js +1 -1
  47. package/dist/lib/encoders/encode-table-to-parquet-js.d.ts.map +1 -1
  48. package/dist/lib/encoders/encode-table-to-parquet-js.js +202 -7
  49. package/dist/lib/encoders/encode-table-to-parquet-js.js.map +1 -1
  50. package/dist/lib/geo/geoparquet-covering.d.ts +19 -0
  51. package/dist/lib/geo/geoparquet-covering.d.ts.map +1 -0
  52. package/dist/lib/geo/geoparquet-covering.js +137 -0
  53. package/dist/lib/geo/geoparquet-covering.js.map +1 -0
  54. package/dist/lib/geo/geospatial-metadata.d.ts.map +1 -1
  55. package/dist/lib/geo/geospatial-metadata.js +39 -13
  56. package/dist/lib/geo/geospatial-metadata.js.map +1 -1
  57. package/dist/lib/parquet-bloom-filter-planner.d.ts +16 -0
  58. package/dist/lib/parquet-bloom-filter-planner.d.ts.map +1 -0
  59. package/dist/lib/parquet-bloom-filter-planner.js +57 -0
  60. package/dist/lib/parquet-bloom-filter-planner.js.map +1 -0
  61. package/dist/lib/parquet-bloom-filter.d.ts +30 -0
  62. package/dist/lib/parquet-bloom-filter.d.ts.map +1 -0
  63. package/dist/lib/parquet-bloom-filter.js +289 -0
  64. package/dist/lib/parquet-bloom-filter.js.map +1 -0
  65. package/dist/lib/parquet-encryption.d.ts +80 -0
  66. package/dist/lib/parquet-encryption.d.ts.map +1 -0
  67. package/dist/lib/parquet-encryption.js +190 -0
  68. package/dist/lib/parquet-encryption.js.map +1 -0
  69. package/dist/lib/parquet-page-index.d.ts +34 -5
  70. package/dist/lib/parquet-page-index.d.ts.map +1 -1
  71. package/dist/lib/parquet-page-index.js +114 -28
  72. package/dist/lib/parquet-page-index.js.map +1 -1
  73. package/dist/lib/parquet-predicate.d.ts +5 -1
  74. package/dist/lib/parquet-predicate.d.ts.map +1 -1
  75. package/dist/lib/parquet-predicate.js +42 -14
  76. package/dist/lib/parquet-predicate.js.map +1 -1
  77. package/dist/lib/parquet-source-worker-decoder.d.ts +4 -1
  78. package/dist/lib/parquet-source-worker-decoder.d.ts.map +1 -1
  79. package/dist/lib/parquet-source-worker-decoder.js +83 -17
  80. package/dist/lib/parquet-source-worker-decoder.js.map +1 -1
  81. package/dist/lib/parquet-source-worker-types.d.ts +24 -0
  82. package/dist/lib/parquet-source-worker-types.d.ts.map +1 -1
  83. package/dist/lib/parsers/get-parquet-schema.d.ts.map +1 -1
  84. package/dist/lib/parsers/get-parquet-schema.js +3 -1
  85. package/dist/lib/parsers/get-parquet-schema.js.map +1 -1
  86. package/dist/lib/parsers/parse-parquet-to-arrow-js.d.ts.map +1 -1
  87. package/dist/lib/parsers/parse-parquet-to-arrow-js.js +327 -18
  88. package/dist/lib/parsers/parse-parquet-to-arrow-js.js.map +1 -1
  89. package/dist/lib/parsers/parse-parquet-to-arrow.d.ts.map +1 -1
  90. package/dist/lib/parsers/parse-parquet-to-arrow.js +5 -5
  91. package/dist/lib/parsers/parse-parquet-to-arrow.js.map +1 -1
  92. package/dist/lib/parsers/parse-parquet-to-columns.d.ts.map +1 -1
  93. package/dist/lib/parsers/parse-parquet-to-columns.js +3 -1
  94. package/dist/lib/parsers/parse-parquet-to-columns.js.map +1 -1
  95. package/dist/lib/parsers/parse-parquet-to-json.d.ts.map +1 -1
  96. package/dist/lib/parsers/parse-parquet-to-json.js +18 -2
  97. package/dist/lib/parsers/parse-parquet-to-json.js.map +1 -1
  98. package/dist/lib/slice-parquet-batch.d.ts +9 -0
  99. package/dist/lib/slice-parquet-batch.d.ts.map +1 -0
  100. package/dist/lib/slice-parquet-batch.js +28 -0
  101. package/dist/lib/slice-parquet-batch.js.map +1 -0
  102. package/dist/lib/sources/parquet-range-file.d.ts +1 -1
  103. package/dist/lib/sources/parquet-range-file.d.ts.map +1 -1
  104. package/dist/lib/sources/parquet-range-file.js +28 -22
  105. package/dist/lib/sources/parquet-range-file.js.map +1 -1
  106. package/dist/lib/utils/normalize-parquet-options.d.ts.map +1 -1
  107. package/dist/lib/utils/normalize-parquet-options.js +15 -1
  108. package/dist/lib/utils/normalize-parquet-options.js.map +1 -1
  109. package/dist/parquet-dataset-source.cjs +15766 -4896
  110. package/dist/parquet-dataset-source.cjs.map +3 -3
  111. package/dist/parquet-dataset-source.d.ts +31 -4
  112. package/dist/parquet-dataset-source.d.ts.map +1 -1
  113. package/dist/parquet-dataset-source.js +296 -74
  114. package/dist/parquet-dataset-source.js.map +1 -1
  115. package/dist/parquet-js-loader-types.d.ts +2 -0
  116. package/dist/parquet-js-loader-types.d.ts.map +1 -1
  117. package/dist/parquet-js-loader-types.js +2 -1
  118. package/dist/parquet-js-loader-types.js.map +1 -1
  119. package/dist/parquet-js-loader.d.ts +1 -0
  120. package/dist/parquet-js-loader.d.ts.map +1 -1
  121. package/dist/parquet-js-loader.js +2 -1
  122. package/dist/parquet-js-loader.js.map +1 -1
  123. package/dist/parquet-js-writer.d.ts +23 -2
  124. package/dist/parquet-js-writer.d.ts.map +1 -1
  125. package/dist/parquet-js-writer.js +1 -1
  126. package/dist/parquet-js-writer.js.map +1 -1
  127. package/dist/parquet-loader-base.js +1 -1
  128. package/dist/parquet-loader-options.d.ts +11 -0
  129. package/dist/parquet-loader-options.d.ts.map +1 -1
  130. package/dist/parquet-loader-options.js.map +1 -1
  131. package/dist/parquet-source-capabilities.d.ts +8 -1
  132. package/dist/parquet-source-capabilities.d.ts.map +1 -1
  133. package/dist/parquet-source-capabilities.js +10 -0
  134. package/dist/parquet-source-capabilities.js.map +1 -1
  135. package/dist/parquet-source-loader-types.d.ts +10 -0
  136. package/dist/parquet-source-loader-types.d.ts.map +1 -1
  137. package/dist/parquet-source-loader-types.js +11 -1
  138. package/dist/parquet-source-loader-types.js.map +1 -1
  139. package/dist/parquet-source-loader.cjs +14911 -4316
  140. package/dist/parquet-source-loader.cjs.map +3 -3
  141. package/dist/parquet-source-loader.d.ts +42 -4
  142. package/dist/parquet-source-loader.d.ts.map +1 -1
  143. package/dist/parquet-source-loader.js +585 -38
  144. package/dist/parquet-source-loader.js.map +1 -1
  145. package/dist/parquet-source-types.d.ts +180 -30
  146. package/dist/parquet-source-types.d.ts.map +1 -1
  147. package/dist/parquet-source-worker.js +7055 -6989
  148. package/dist/parquet-source-worker.js.map +4 -4
  149. package/dist/parquet-worker-node.cjs +8505 -1041
  150. package/dist/parquet-worker-node.cjs.map +4 -4
  151. package/dist/parquet-worker-url.js +5 -1
  152. package/dist/parquet-worker-url.js.map +1 -1
  153. package/dist/parquet-worker.js +289 -218
  154. package/dist/parquet-worker.js.map +4 -4
  155. package/dist/parquetjs/codecs/declare.d.ts +15 -0
  156. package/dist/parquetjs/codecs/declare.d.ts.map +1 -1
  157. package/dist/parquetjs/codecs/declare.js +10 -0
  158. package/dist/parquetjs/codecs/declare.js.map +1 -1
  159. package/dist/parquetjs/codecs/delta.d.ts.map +1 -1
  160. package/dist/parquetjs/codecs/delta.js +356 -7
  161. package/dist/parquetjs/codecs/delta.js.map +1 -1
  162. package/dist/parquetjs/codecs/index.d.ts.map +1 -1
  163. package/dist/parquetjs/codecs/index.js +4 -0
  164. package/dist/parquetjs/codecs/index.js.map +1 -1
  165. package/dist/parquetjs/codecs/plain.d.ts +1 -1
  166. package/dist/parquetjs/codecs/plain.d.ts.map +1 -1
  167. package/dist/parquetjs/codecs/plain.js +153 -12
  168. package/dist/parquetjs/codecs/plain.js.map +1 -1
  169. package/dist/parquetjs/codecs/rle.d.ts +4 -0
  170. package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
  171. package/dist/parquetjs/codecs/rle.js +406 -3
  172. package/dist/parquetjs/codecs/rle.js.map +1 -1
  173. package/dist/parquetjs/compression.d.ts +9 -0
  174. package/dist/parquetjs/compression.d.ts.map +1 -1
  175. package/dist/parquetjs/compression.js +86 -67
  176. package/dist/parquetjs/compression.js.map +1 -1
  177. package/dist/parquetjs/encoder/dictionary-planner.d.ts.map +1 -1
  178. package/dist/parquetjs/encoder/dictionary-planner.js +5 -2
  179. package/dist/parquetjs/encoder/dictionary-planner.js.map +1 -1
  180. package/dist/parquetjs/encoder/parquet-encoder.d.ts +43 -1
  181. package/dist/parquetjs/encoder/parquet-encoder.d.ts.map +1 -1
  182. package/dist/parquetjs/encoder/parquet-encoder.js +691 -34
  183. package/dist/parquetjs/encoder/parquet-encoder.js.map +1 -1
  184. package/dist/parquetjs/parquet-thrift/BoundingBox.d.ts +29 -0
  185. package/dist/parquetjs/parquet-thrift/BoundingBox.d.ts.map +1 -0
  186. package/dist/parquetjs/parquet-thrift/BoundingBox.js +85 -0
  187. package/dist/parquetjs/parquet-thrift/BoundingBox.js.map +1 -0
  188. package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts +5 -0
  189. package/dist/parquetjs/parquet-thrift/ColumnChunk.d.ts.map +1 -1
  190. package/dist/parquetjs/parquet-thrift/ColumnChunk.js +35 -0
  191. package/dist/parquetjs/parquet-thrift/ColumnChunk.js.map +1 -1
  192. package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.d.ts +35 -0
  193. package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.d.ts.map +1 -0
  194. package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.js +135 -0
  195. package/dist/parquetjs/parquet-thrift/ColumnCryptoMetaData.js.map +1 -0
  196. package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts +10 -0
  197. package/dist/parquetjs/parquet-thrift/ColumnMetaData.d.ts.map +1 -1
  198. package/dist/parquetjs/parquet-thrift/ColumnMetaData.js +73 -0
  199. package/dist/parquetjs/parquet-thrift/ColumnMetaData.js.map +1 -1
  200. package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.d.ts +22 -0
  201. package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.d.ts.map +1 -0
  202. package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.js +111 -0
  203. package/dist/parquetjs/parquet-thrift/EncryptionAlgorithm.js.map +1 -0
  204. package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.d.ts +16 -0
  205. package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.d.ts.map +1 -0
  206. package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.js +57 -0
  207. package/dist/parquetjs/parquet-thrift/FileCryptoMetaData.js.map +1 -0
  208. package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts +5 -0
  209. package/dist/parquetjs/parquet-thrift/FileMetaData.d.ts.map +1 -1
  210. package/dist/parquetjs/parquet-thrift/FileMetaData.js +35 -0
  211. package/dist/parquetjs/parquet-thrift/FileMetaData.js.map +1 -1
  212. package/dist/parquetjs/parquet-thrift/GeospatialStatistics.d.ts +18 -0
  213. package/dist/parquetjs/parquet-thrift/GeospatialStatistics.d.ts.map +1 -0
  214. package/dist/parquetjs/parquet-thrift/GeospatialStatistics.js +62 -0
  215. package/dist/parquetjs/parquet-thrift/GeospatialStatistics.js.map +1 -0
  216. package/dist/parquetjs/parquet-thrift/SizeStatistics.d.ts +26 -0
  217. package/dist/parquetjs/parquet-thrift/SizeStatistics.d.ts.map +1 -0
  218. package/dist/parquetjs/parquet-thrift/SizeStatistics.js +85 -0
  219. package/dist/parquetjs/parquet-thrift/SizeStatistics.js.map +1 -0
  220. package/dist/parquetjs/parquet-thrift/index.d.ts +6 -0
  221. package/dist/parquetjs/parquet-thrift/index.d.ts.map +1 -1
  222. package/dist/parquetjs/parquet-thrift/index.js +6 -0
  223. package/dist/parquetjs/parquet-thrift/index.js.map +1 -1
  224. package/dist/parquetjs/parser/decoders.d.ts +10 -1
  225. package/dist/parquetjs/parser/decoders.d.ts.map +1 -1
  226. package/dist/parquetjs/parser/decoders.js +318 -14
  227. package/dist/parquetjs/parser/decoders.js.map +1 -1
  228. package/dist/parquetjs/parser/parquet-reader.d.ts +78 -12
  229. package/dist/parquetjs/parser/parquet-reader.d.ts.map +1 -1
  230. package/dist/parquetjs/parser/parquet-reader.js +605 -66
  231. package/dist/parquetjs/parser/parquet-reader.js.map +1 -1
  232. package/dist/parquetjs/schema/declare.d.ts +22 -3
  233. package/dist/parquetjs/schema/declare.d.ts.map +1 -1
  234. package/dist/parquetjs/schema/declare.js.map +1 -1
  235. package/dist/parquetjs/schema/schema.d.ts.map +1 -1
  236. package/dist/parquetjs/schema/schema.js +10 -0
  237. package/dist/parquetjs/schema/schema.js.map +1 -1
  238. package/dist/parquetjs/schema/shred.d.ts.map +1 -1
  239. package/dist/parquetjs/schema/shred.js +219 -11
  240. package/dist/parquetjs/schema/shred.js.map +1 -1
  241. package/dist/parquetjs/schema/types.js +19 -21
  242. package/dist/parquetjs/schema/types.js.map +1 -1
  243. package/dist/parquetjs/schema/variant.d.ts +3 -0
  244. package/dist/parquetjs/schema/variant.d.ts.map +1 -0
  245. package/dist/parquetjs/schema/variant.js +248 -0
  246. package/dist/parquetjs/schema/variant.js.map +1 -0
  247. package/dist/parquetjs/utils/crc32.d.ts +3 -0
  248. package/dist/parquetjs/utils/crc32.d.ts.map +1 -0
  249. package/dist/parquetjs/utils/crc32.js +15 -0
  250. package/dist/parquetjs/utils/crc32.js.map +1 -0
  251. package/dist/parquetjs/utils/read-utils.d.ts +11 -1
  252. package/dist/parquetjs/utils/read-utils.d.ts.map +1 -1
  253. package/dist/parquetjs/utils/read-utils.js +21 -1
  254. package/dist/parquetjs/utils/read-utils.js.map +1 -1
  255. package/dist/unbundled.d.ts +2 -1
  256. package/dist/unbundled.d.ts.map +1 -1
  257. package/dist/unbundled.js +1 -0
  258. package/dist/unbundled.js.map +1 -1
  259. package/package.json +36 -11
  260. package/src/bundled.ts +3 -0
  261. package/src/delta-format.ts +12 -0
  262. package/src/delta-source-loader-types.ts +40 -0
  263. package/src/delta-source.ts +305 -0
  264. package/src/delta-types.ts +40 -0
  265. package/src/iceberg-rest-catalog.ts +122 -0
  266. package/src/iceberg-table-source.ts +1037 -0
  267. package/src/iceberg-types.ts +165 -0
  268. package/src/index.ts +50 -1
  269. package/src/lib/arrow/convert-schema-from-parquet.ts +113 -19
  270. package/src/lib/arrow/create-nested-arrow-vector.ts +116 -0
  271. package/src/lib/encoders/encode-table-to-parquet-js.ts +268 -7
  272. package/src/lib/geo/geoparquet-covering.ts +201 -0
  273. package/src/lib/geo/geospatial-metadata.ts +42 -15
  274. package/src/lib/parquet-bloom-filter-planner.ts +86 -0
  275. package/src/lib/parquet-bloom-filter.ts +345 -0
  276. package/src/lib/parquet-encryption.ts +344 -0
  277. package/src/lib/parquet-page-index.ts +180 -34
  278. package/src/lib/parquet-predicate.ts +52 -16
  279. package/src/lib/parquet-source-worker-decoder.ts +116 -20
  280. package/src/lib/parquet-source-worker-types.ts +25 -0
  281. package/src/lib/parsers/get-parquet-schema.ts +3 -1
  282. package/src/lib/parsers/parse-parquet-to-arrow-js.ts +397 -17
  283. package/src/lib/parsers/parse-parquet-to-arrow.ts +4 -5
  284. package/src/lib/parsers/parse-parquet-to-columns.ts +3 -1
  285. package/src/lib/parsers/parse-parquet-to-json.ts +18 -2
  286. package/src/lib/slice-parquet-batch.ts +32 -0
  287. package/src/lib/sources/parquet-range-file.ts +35 -29
  288. package/src/lib/utils/normalize-parquet-options.ts +17 -1
  289. package/src/parquet-dataset-source.ts +397 -85
  290. package/src/parquet-js-loader-types.ts +1 -0
  291. package/src/parquet-js-loader.ts +2 -1
  292. package/src/parquet-js-writer.ts +30 -0
  293. package/src/parquet-loader-options.ts +11 -0
  294. package/src/parquet-source-capabilities.ts +18 -1
  295. package/src/parquet-source-loader-types.ts +10 -0
  296. package/src/parquet-source-loader.ts +929 -52
  297. package/src/parquet-source-types.ts +197 -28
  298. package/src/parquet-worker-url.ts +6 -1
  299. package/src/parquetjs/codecs/declare.ts +27 -0
  300. package/src/parquetjs/codecs/delta.ts +466 -6
  301. package/src/parquetjs/codecs/index.ts +4 -0
  302. package/src/parquetjs/codecs/plain.ts +177 -11
  303. package/src/parquetjs/codecs/rle.ts +573 -3
  304. package/src/parquetjs/compression.ts +102 -76
  305. package/src/parquetjs/encoder/dictionary-planner.ts +7 -2
  306. package/src/parquetjs/encoder/parquet-encoder.ts +1016 -38
  307. package/src/parquetjs/parquet-thrift/BoundingBox.ts +108 -0
  308. package/src/parquetjs/parquet-thrift/ColumnChunk.ts +35 -0
  309. package/src/parquetjs/parquet-thrift/ColumnCryptoMetaData.ts +139 -0
  310. package/src/parquetjs/parquet-thrift/ColumnMetaData.ts +73 -0
  311. package/src/parquetjs/parquet-thrift/EncryptionAlgorithm.ts +127 -0
  312. package/src/parquetjs/parquet-thrift/FileCryptoMetaData.ts +60 -0
  313. package/src/parquetjs/parquet-thrift/FileMetaData.ts +35 -0
  314. package/src/parquetjs/parquet-thrift/GeospatialStatistics.ts +68 -0
  315. package/src/parquetjs/parquet-thrift/SizeStatistics.ts +98 -0
  316. package/src/parquetjs/parquet-thrift/index.ts +6 -0
  317. package/src/parquetjs/parser/decoders.ts +451 -26
  318. package/src/parquetjs/parser/parquet-reader.ts +935 -87
  319. package/src/parquetjs/schema/declare.ts +22 -2
  320. package/src/parquetjs/schema/schema.ts +10 -0
  321. package/src/parquetjs/schema/shred.ts +238 -11
  322. package/src/parquetjs/schema/types.ts +16 -25
  323. package/src/parquetjs/schema/variant.ts +313 -0
  324. package/src/parquetjs/utils/crc32.ts +15 -0
  325. package/src/parquetjs/utils/read-utils.ts +26 -1
  326. package/src/unbundled.ts +14 -0
@@ -114,9 +114,12 @@ var global=globalThis;
114
114
  async function getParentPort() {
115
115
  return parentPort;
116
116
  }
117
- function isKnownMessage(message) {
118
- const { type, data } = message;
119
- return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
117
+ function getWorkerMessageData(message) {
118
+ if (!message || typeof message !== "object") {
119
+ return null;
120
+ }
121
+ const messageData = "data" in message && message.type === "message" ? message.data : message;
122
+ return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
120
123
  }
121
124
  var onMessageWrapperMap, WorkerBody;
122
125
  var init_worker_body = __esm({
@@ -154,18 +157,18 @@ var global=globalThis;
154
157
  static async addEventListener(onMessage) {
155
158
  let onMessageWrapper = onMessageWrapperMap.get(onMessage);
156
159
  if (!onMessageWrapper) {
157
- onMessageWrapper = async (message) => {
158
- if (!isKnownMessage(message)) {
160
+ onMessageWrapper = (message) => {
161
+ const messageData = getWorkerMessageData(message);
162
+ if (!messageData) {
159
163
  return;
160
164
  }
161
- const parentPort3 = await getParentPort();
162
- const { type, payload } = parentPort3 ? message : message.data;
163
- onMessage(type, payload);
165
+ onMessage(messageData.type, messageData.payload);
164
166
  };
167
+ onMessageWrapperMap.set(onMessage, onMessageWrapper);
165
168
  }
166
169
  const parentPort2 = await getParentPort();
167
170
  if (parentPort2) {
168
- console.error("not implemented");
171
+ parentPort2.on("message", onMessageWrapper);
169
172
  } else {
170
173
  globalThis.addEventListener("message", onMessageWrapper);
171
174
  }
@@ -173,9 +176,12 @@ var global=globalThis;
173
176
  static async removeEventListener(onMessage) {
174
177
  const onMessageWrapper = onMessageWrapperMap.get(onMessage);
175
178
  onMessageWrapperMap.delete(onMessage);
179
+ if (!onMessageWrapper) {
180
+ return;
181
+ }
176
182
  const parentPort2 = await getParentPort();
177
183
  if (parentPort2) {
178
- console.error("not implemented");
184
+ parentPort2.off("message", onMessageWrapper);
179
185
  } else {
180
186
  globalThis.removeEventListener("message", onMessageWrapper);
181
187
  }
@@ -306,24 +312,44 @@ var global=globalThis;
306
312
  if (!processInBatches) {
307
313
  throw new Error("Worker does not support batched processing");
308
314
  }
309
- inputBatches = new AsyncQueue();
310
- options = payload.options || {};
311
- const resultIterator = processInBatches(
312
- inputBatches,
313
- options,
314
- context,
315
- payload.context || {}
316
- );
317
- for await (const batch of resultIterator) {
318
- WorkerBody.postMessage("output-batch", { result: batch });
315
+ const inputBatches = new AsyncQueue();
316
+ const outputAcknowledgements = new AsyncQueue();
317
+ activeInputBatches = inputBatches;
318
+ activeOutputAcknowledgements = outputAcknowledgements;
319
+ try {
320
+ const resultIterator = processInBatches(
321
+ createDemandDrivenIterator(inputBatches),
322
+ payload.options || {},
323
+ context,
324
+ payload.context || {}
325
+ );
326
+ for await (const batch of resultIterator) {
327
+ await WorkerBody.postMessage("output-batch", { result: batch });
328
+ await outputAcknowledgements.next();
329
+ }
330
+ await WorkerBody.postMessage("done", {});
331
+ } finally {
332
+ activeInputBatches = null;
333
+ activeOutputAcknowledgements = null;
319
334
  }
320
- WorkerBody.postMessage("done", {});
321
335
  break;
322
336
  case "input-batch":
323
- inputBatches.push(payload.input);
337
+ if (!activeInputBatches) {
338
+ throw new Error("Worker has no active batched processing session");
339
+ }
340
+ activeInputBatches.push(payload.input);
324
341
  break;
325
342
  case "input-done":
326
- inputBatches.close();
343
+ if (!activeInputBatches) {
344
+ throw new Error("Worker has no active batched processing session");
345
+ }
346
+ activeInputBatches.close();
347
+ break;
348
+ case "output-ack":
349
+ if (!activeOutputAcknowledgements) {
350
+ throw new Error("Worker has no active batched processing session");
351
+ }
352
+ activeOutputAcknowledgements.push(void 0);
327
353
  break;
328
354
  default:
329
355
  }
@@ -333,7 +359,17 @@ var global=globalThis;
333
359
  }
334
360
  };
335
361
  }
336
- function processOnMainThread(arrayBuffer, options2 = {}, jobContext = {}) {
362
+ async function* createDemandDrivenIterator(inputBatches) {
363
+ while (true) {
364
+ await WorkerBody.postMessage("input-request", {});
365
+ const nextBatch = await inputBatches.next();
366
+ if (nextBatch.done) {
367
+ return;
368
+ }
369
+ yield nextBatch.value;
370
+ }
371
+ }
372
+ function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
337
373
  return new Promise((resolve, reject) => {
338
374
  const id = requestId++;
339
375
  const onMessage = (type, payload2) => {
@@ -353,11 +389,11 @@ var global=globalThis;
353
389
  }
354
390
  };
355
391
  WorkerBody.addEventListener(onMessage);
356
- const payload = { id, input: arrayBuffer, options: options2, context: jobContext };
392
+ const payload = { id, input: arrayBuffer, options, context: jobContext };
357
393
  WorkerBody.postMessage("process", payload);
358
394
  });
359
395
  }
360
- var requestId, inputBatches, options;
396
+ var requestId, activeInputBatches, activeOutputAcknowledgements;
361
397
  var init_create_worker = __esm({
362
398
  "../worker-utils/src/lib/worker-api/create-worker.ts"() {
363
399
  "use strict";
@@ -365,6 +401,8 @@ var global=globalThis;
365
401
  init_async_queue();
366
402
  init_worker_body();
367
403
  requestId = 0;
404
+ activeInputBatches = null;
405
+ activeOutputAcknowledgements = null;
368
406
  }
369
407
  });
370
408
 
@@ -380,21 +418,22 @@ var global=globalThis;
380
418
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
381
419
  async function createLoaderWorker(loader) {
382
420
  await createWorker(
383
- async (input, options2 = {}, workerContext, loaderContext = {}) => {
384
- const result = await parseData({
385
- loader,
386
- arrayBuffer: input,
387
- options: options2,
388
- context: {
389
- ...loaderContext,
390
- coreApi: createWorkerCoreApi(),
391
- _parse: createParseOnMainThread(workerContext?.process)
392
- }
393
- });
394
- return loader.serializeWorkerResult ? loader.serializeWorkerResult(result, options2, loaderContext) : result;
395
- }
421
+ (input, options, workerContext, loaderContext) => processLoaderWorkerData(loader, input, options, workerContext, loaderContext)
396
422
  );
397
423
  }
424
+ async function processLoaderWorkerData(loader, input, options = {}, workerContext, loaderContext = {}) {
425
+ const result = await parseData({
426
+ loader,
427
+ arrayBuffer: input,
428
+ options,
429
+ context: {
430
+ ...loaderContext,
431
+ coreApi: createWorkerCoreApi(),
432
+ _parse: createParseOnMainThread(workerContext?.process)
433
+ }
434
+ });
435
+ return loader.serializeWorkerResult ? loader.serializeWorkerResult(result, options, loaderContext) : result;
436
+ }
398
437
  function createWorkerCoreApi() {
399
438
  const unavailable = (methodName) => () => {
400
439
  throw new Error(`context.coreApi.${methodName} is unavailable inside worker loaders.`);
@@ -410,17 +449,17 @@ var global=globalThis;
410
449
  };
411
450
  }
412
451
  function createParseOnMainThread(processOnMainThread2) {
413
- return (arrayBuffer, loaders, options2, context) => {
452
+ return (arrayBuffer, loaders, options, context) => {
414
453
  if (!processOnMainThread2) {
415
454
  throw new Error("Worker not set up to parse on main thread");
416
455
  }
417
- const parseArguments = getMainThreadParseArguments(loaders, options2, context);
456
+ const parseArguments = getMainThreadParseArguments(loaders, options, context);
418
457
  return processOnMainThread2(arrayBuffer, parseArguments.options, parseArguments.context);
419
458
  };
420
459
  }
421
- function getMainThreadParseArguments(loaders, options2, context) {
422
- if (options2) {
423
- return { options: options2, context: getSerializableLoaderContext(context) };
460
+ function getMainThreadParseArguments(loaders, options, context) {
461
+ if (options) {
462
+ return { options, context: getSerializableLoaderContext(context) };
424
463
  }
425
464
  if (Array.isArray(loaders) || loaders && isLoaderObject(loaders)) {
426
465
  return { options: void 0, context: getSerializableLoaderContext(context) };
@@ -443,7 +482,7 @@ var global=globalThis;
443
482
  async function parseData({
444
483
  loader,
445
484
  arrayBuffer,
446
- options: options2,
485
+ options,
447
486
  context
448
487
  }) {
449
488
  let data;
@@ -458,15 +497,18 @@ var global=globalThis;
458
497
  } else {
459
498
  throw new Error(`Could not load data with ${loader.name} loader`);
460
499
  }
461
- options2 = {
462
- ...options2,
463
- modules: loader && loader.options && loader.options.modules || {},
500
+ options = {
501
+ ...options,
502
+ modules: {
503
+ ...loader && loader.options && loader.options.modules || {},
504
+ ...options.modules || {}
505
+ },
464
506
  core: {
465
- ...options2.core,
507
+ ...options.core,
466
508
  worker: false
467
509
  }
468
510
  };
469
- return await parser(data, { ...options2 }, context, loader);
511
+ return await parser(data, { ...options }, context, loader);
470
512
  }
471
513
  var init_create_loader_worker = __esm({
472
514
  "../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts"() {
@@ -572,6 +614,17 @@ var global=globalThis;
572
614
  }
573
615
  });
574
616
 
617
+ // ../loader-utils/src/lib/scan-utils/table-scan-batch.ts
618
+ function makeTableScanBatch(table) {
619
+ return { ...table, batchType: "data", length: table.data.numRows };
620
+ }
621
+ var init_table_scan_batch = __esm({
622
+ "../loader-utils/src/lib/scan-utils/table-scan-batch.ts"() {
623
+ "use strict";
624
+ init_process();
625
+ }
626
+ });
627
+
575
628
  // ../loader-utils/src/index.ts
576
629
  var init_src2 = __esm({
577
630
  "../loader-utils/src/index.ts"() {
@@ -581,6 +634,7 @@ var global=globalThis;
581
634
  init_create_loader_worker();
582
635
  init_async_iteration();
583
636
  init_blob_file();
637
+ init_table_scan_batch();
584
638
  }
585
639
  });
586
640
 
@@ -1292,11 +1346,11 @@ var global=globalThis;
1292
1346
  return pump2(fromNodeStream(stream));
1293
1347
  },
1294
1348
  // @ts-ignore
1295
- toDOMStream(source, options2) {
1349
+ toDOMStream(source, options) {
1296
1350
  throw new Error(`"toDOMStream" not available in this environment`);
1297
1351
  },
1298
1352
  // @ts-ignore
1299
- toNodeStream(source, options2) {
1353
+ toNodeStream(source, options) {
1300
1354
  throw new Error(`"toNodeStream" not available in this environment`);
1301
1355
  }
1302
1356
  };
@@ -8170,12 +8224,12 @@ return true;`);
8170
8224
  Builder2 = class {
8171
8225
  /** @nocollapse */
8172
8226
  // @ts-ignore
8173
- static throughNode(options2) {
8227
+ static throughNode(options) {
8174
8228
  throw new Error(`"throughNode" not available in this environment`);
8175
8229
  }
8176
8230
  /** @nocollapse */
8177
8231
  // @ts-ignore
8178
- static throughDOM(options2) {
8232
+ static throughDOM(options) {
8179
8233
  throw new Error(`"throughDOM" not available in this environment`);
8180
8234
  }
8181
8235
  /**
@@ -9914,14 +9968,14 @@ return true;`);
9914
9968
  tee() {
9915
9969
  return this._getDOMStream().tee();
9916
9970
  }
9917
- pipe(writable, options2) {
9918
- return this._getNodeStream().pipe(writable, options2);
9971
+ pipe(writable, options) {
9972
+ return this._getNodeStream().pipe(writable, options);
9919
9973
  }
9920
- pipeTo(writable, options2) {
9921
- return this._getDOMStream().pipeTo(writable, options2);
9974
+ pipeTo(writable, options) {
9975
+ return this._getDOMStream().pipeTo(writable, options);
9922
9976
  }
9923
- pipeThrough(duplex, options2) {
9924
- return this._getDOMStream().pipeThrough(duplex, options2);
9977
+ pipeThrough(duplex, options) {
9978
+ return this._getDOMStream().pipeThrough(duplex, options);
9925
9979
  }
9926
9980
  _getDOMStream() {
9927
9981
  return this._DOMStream || (this._DOMStream = this.toDOMStream());
@@ -9968,11 +10022,11 @@ return true;`);
9968
10022
  [Symbol.asyncIterator]() {
9969
10023
  return this;
9970
10024
  }
9971
- toDOMStream(options2) {
9972
- return adapters_default.toDOMStream(this._closedPromiseResolve || this._error ? this : this._values, options2);
10025
+ toDOMStream(options) {
10026
+ return adapters_default.toDOMStream(this._closedPromiseResolve || this._error ? this : this._values, options);
9973
10027
  }
9974
- toNodeStream(options2) {
9975
- return adapters_default.toNodeStream(this._closedPromiseResolve || this._error ? this : this._values, options2);
10028
+ toNodeStream(options) {
10029
+ return adapters_default.toNodeStream(this._closedPromiseResolve || this._error ? this : this._values, options);
9976
10030
  }
9977
10031
  throw(_) {
9978
10032
  return __awaiter(this, void 0, void 0, function* () {
@@ -11097,8 +11151,8 @@ return true;`);
11097
11151
  init_buffer3();
11098
11152
  init_builder2();
11099
11153
  BoolBuilder = class extends Builder2 {
11100
- constructor(options2) {
11101
- super(options2);
11154
+ constructor(options) {
11155
+ super(options);
11102
11156
  this._values = new BitmapBufferBuilder();
11103
11157
  }
11104
11158
  setValue(index, value) {
@@ -11621,11 +11675,11 @@ return true;`);
11621
11675
  init_builder2();
11622
11676
  init_type2();
11623
11677
  UnionBuilder = class extends Builder2 {
11624
- constructor(options2) {
11625
- super(options2);
11678
+ constructor(options) {
11679
+ super(options);
11626
11680
  this._typeIds = new DataBufferBuilder(Int8Array, 0, 1);
11627
- if (typeof options2["valueToChildTypeId"] === "function") {
11628
- this._valueToChildTypeId = options2["valueToChildTypeId"];
11681
+ if (typeof options["valueToChildTypeId"] === "function") {
11682
+ this._valueToChildTypeId = options["valueToChildTypeId"];
11629
11683
  }
11630
11684
  }
11631
11685
  get typeIdToChildIndex() {
@@ -11664,8 +11718,8 @@ return true;`);
11664
11718
  SparseUnionBuilder = class extends UnionBuilder {
11665
11719
  };
11666
11720
  DenseUnionBuilder = class extends UnionBuilder {
11667
- constructor(options2) {
11668
- super(options2);
11721
+ constructor(options) {
11722
+ super(options);
11669
11723
  this._offsets = new DataBufferBuilder(Int32Array);
11670
11724
  }
11671
11725
  /** @ignore */
@@ -12219,12 +12273,12 @@ return true;`);
12219
12273
  });
12220
12274
 
12221
12275
  // ../../node_modules/apache-arrow/factories.mjs
12222
- function makeBuilder(options2) {
12223
- const type = options2.type;
12224
- const builder = new (instance6.getVisitFn(type)())(options2);
12276
+ function makeBuilder(options) {
12277
+ const type = options.type;
12278
+ const builder = new (instance6.getVisitFn(type)())(options);
12225
12279
  if (type.children && type.children.length > 0) {
12226
- const children = options2["children"] || [];
12227
- const defaultOptions = { "nullValues": options2["nullValues"] };
12280
+ const children = options["children"] || [];
12281
+ const defaultOptions = { "nullValues": options["nullValues"] };
12228
12282
  const getChildOptions = Array.isArray(children) ? ((_, i) => children[i] || defaultOptions) : (({ name }) => children[name] || defaultOptions);
12229
12283
  for (const [index, field] of type.children.entries()) {
12230
12284
  const { type: type2 } = field;
@@ -12238,8 +12292,8 @@ return true;`);
12238
12292
  if (init instanceof Data || init instanceof Vector || init.type instanceof DataType || ArrayBuffer.isView(init)) {
12239
12293
  return makeVector(init);
12240
12294
  }
12241
- const options2 = { type: type !== null && type !== void 0 ? type : inferType(init), nullValues: [null] };
12242
- const chunks = [...builderThroughIterable(options2)(init)];
12295
+ const options = { type: type !== null && type !== void 0 ? type : inferType(init), nullValues: [null] };
12296
+ const chunks = [...builderThroughIterable(options)(init)];
12243
12297
  const vector = chunks.length === 1 ? chunks[0] : chunks.reduce((a, b) => a.concat(b));
12244
12298
  if (DataType.isDictionary(vector.type)) {
12245
12299
  return vector.memoize();
@@ -12322,13 +12376,13 @@ return true;`);
12322
12376
  }
12323
12377
  throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.");
12324
12378
  }
12325
- function builderThroughIterable(options2) {
12326
- const { ["queueingStrategy"]: queueingStrategy = "count" } = options2;
12327
- const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options2;
12379
+ function builderThroughIterable(options) {
12380
+ const { ["queueingStrategy"]: queueingStrategy = "count" } = options;
12381
+ const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options;
12328
12382
  const sizeProperty = queueingStrategy !== "bytes" ? "length" : "byteLength";
12329
12383
  return function* (source) {
12330
12384
  let numChunks = 0;
12331
- const builder = makeBuilder(options2);
12385
+ const builder = makeBuilder(options);
12332
12386
  for (const value of source) {
12333
12387
  if (builder.append(value)[sizeProperty] >= highWaterMark) {
12334
12388
  ++numChunks && (yield builder.toVector());
@@ -12339,15 +12393,15 @@ return true;`);
12339
12393
  }
12340
12394
  };
12341
12395
  }
12342
- function builderThroughAsyncIterable(options2) {
12343
- const { ["queueingStrategy"]: queueingStrategy = "count" } = options2;
12344
- const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options2;
12396
+ function builderThroughAsyncIterable(options) {
12397
+ const { ["queueingStrategy"]: queueingStrategy = "count" } = options;
12398
+ const { ["highWaterMark"]: highWaterMark = queueingStrategy !== "bytes" ? Number.POSITIVE_INFINITY : Math.pow(2, 14) } = options;
12345
12399
  const sizeProperty = queueingStrategy !== "bytes" ? "length" : "byteLength";
12346
12400
  return function(source) {
12347
12401
  return __asyncGenerator(this, arguments, function* () {
12348
12402
  var _a5, e_1, _b2, _c2;
12349
12403
  let numChunks = 0;
12350
- const builder = makeBuilder(options2);
12404
+ const builder = makeBuilder(options);
12351
12405
  try {
12352
12406
  for (var _d2 = true, source_1 = __asyncValues(source), source_1_1; source_1_1 = yield __await(source_1.next()), _a5 = source_1_1.done, !_a5; _d2 = true) {
12353
12407
  _c2 = source_1_1.value;
@@ -13461,8 +13515,8 @@ return true;`);
13461
13515
  });
13462
13516
 
13463
13517
  // ../../node_modules/apache-arrow/ipc/reader.mjs
13464
- function shouldAutoDestroy(self2, options2) {
13465
- return options2 && typeof options2["autoDestroy"] === "boolean" ? options2["autoDestroy"] : self2["autoDestroy"];
13518
+ function shouldAutoDestroy(self2, options) {
13519
+ return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
13466
13520
  }
13467
13521
  function* readAllSync(source) {
13468
13522
  const reader = RecordBatchReader.from(source);
@@ -13596,8 +13650,8 @@ return true;`);
13596
13650
  this._nodeStream = void 0;
13597
13651
  return this;
13598
13652
  }
13599
- open(options2) {
13600
- const opening = this._impl.open(options2);
13653
+ open(options) {
13654
+ const opening = this._impl.open(options);
13601
13655
  return isPromise(opening) ? opening.then(() => this) : this;
13602
13656
  }
13603
13657
  readRecordBatch(index) {
@@ -13617,7 +13671,7 @@ return true;`);
13617
13671
  }
13618
13672
  /** @nocollapse */
13619
13673
  // @ts-ignore
13620
- static throughNode(options2) {
13674
+ static throughNode(options) {
13621
13675
  throw new Error(`"throughNode" not available in this environment`);
13622
13676
  }
13623
13677
  /** @nocollapse */
@@ -13838,9 +13892,9 @@ return true;`);
13838
13892
  this.dictionaries = null;
13839
13893
  }
13840
13894
  }
13841
- open(options2) {
13895
+ open(options) {
13842
13896
  if (!this.closed) {
13843
- this.autoDestroy = shouldAutoDestroy(this, options2);
13897
+ this.autoDestroy = shouldAutoDestroy(this, options);
13844
13898
  if (!(this.schema || (this.schema = this._reader.readSchema()))) {
13845
13899
  this.cancel();
13846
13900
  }
@@ -13915,10 +13969,10 @@ return true;`);
13915
13969
  }
13916
13970
  });
13917
13971
  }
13918
- open(options2) {
13972
+ open(options) {
13919
13973
  return __awaiter(this, void 0, void 0, function* () {
13920
13974
  if (!this.closed) {
13921
- this.autoDestroy = shouldAutoDestroy(this, options2);
13975
+ this.autoDestroy = shouldAutoDestroy(this, options);
13922
13976
  if (!(this.schema || (this.schema = yield this._reader.readSchema()))) {
13923
13977
  yield this.cancel();
13924
13978
  }
@@ -13998,14 +14052,14 @@ return true;`);
13998
14052
  isFile() {
13999
14053
  return true;
14000
14054
  }
14001
- open(options2) {
14055
+ open(options) {
14002
14056
  if (!this.closed && !this._footer) {
14003
14057
  this.schema = (this._footer = this._readFooter()).schema;
14004
14058
  for (const block of this._footer.dictionaryBatches()) {
14005
14059
  block && this._readDictionaryBatch(this._dictionaryIndex++);
14006
14060
  }
14007
14061
  }
14008
- return super.open(options2);
14062
+ return super.open(options);
14009
14063
  }
14010
14064
  readRecordBatch(index) {
14011
14065
  var _a5;
@@ -14082,7 +14136,7 @@ return true;`);
14082
14136
  isAsync() {
14083
14137
  return true;
14084
14138
  }
14085
- open(options2) {
14139
+ open(options) {
14086
14140
  const _super = Object.create(null, {
14087
14141
  open: { get: () => super.open }
14088
14142
  });
@@ -14093,7 +14147,7 @@ return true;`);
14093
14147
  block && (yield this._readDictionaryBatch(this._dictionaryIndex++));
14094
14148
  }
14095
14149
  }
14096
- return yield _super.open.call(this, options2);
14150
+ return yield _super.open.call(this, options);
14097
14151
  });
14098
14152
  }
14099
14153
  readRecordBatch(index) {
@@ -14716,14 +14770,14 @@ return true;`);
14716
14770
  RecordBatchWriter = class extends ReadableInterop {
14717
14771
  /** @nocollapse */
14718
14772
  // @ts-ignore
14719
- static throughNode(options2) {
14773
+ static throughNode(options) {
14720
14774
  throw new Error(`"throughNode" not available in this environment`);
14721
14775
  }
14722
14776
  /** @nocollapse */
14723
14777
  static throughDOM(writableStrategy, readableStrategy) {
14724
14778
  throw new Error(`"throughDOM" not available in this environment`);
14725
14779
  }
14726
- constructor(options2) {
14780
+ constructor(options) {
14727
14781
  super();
14728
14782
  this._position = 0;
14729
14783
  this._started = false;
@@ -14734,18 +14788,18 @@ return true;`);
14734
14788
  this._recordBatchBlocks = [];
14735
14789
  this._seenDictionaries = /* @__PURE__ */ new Map();
14736
14790
  this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
14737
- isObject(options2) || (options2 = { autoDestroy: true, writeLegacyIpcFormat: false, compressionType: null });
14738
- this._autoDestroy = typeof options2.autoDestroy === "boolean" ? options2.autoDestroy : true;
14739
- this._writeLegacyIpcFormat = typeof options2.writeLegacyIpcFormat === "boolean" ? options2.writeLegacyIpcFormat : false;
14740
- if (options2.compressionType != null) {
14791
+ isObject(options) || (options = { autoDestroy: true, writeLegacyIpcFormat: false, compressionType: null });
14792
+ this._autoDestroy = typeof options.autoDestroy === "boolean" ? options.autoDestroy : true;
14793
+ this._writeLegacyIpcFormat = typeof options.writeLegacyIpcFormat === "boolean" ? options.writeLegacyIpcFormat : false;
14794
+ if (options.compressionType != null) {
14741
14795
  if (this._writeLegacyIpcFormat) {
14742
14796
  throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");
14743
14797
  }
14744
- if (Object.values(CompressionType).includes(options2.compressionType)) {
14745
- this._compression = new BodyCompression2(options2.compressionType);
14798
+ if (Object.values(CompressionType).includes(options.compressionType)) {
14799
+ this._compression = new BodyCompression2(options.compressionType);
14746
14800
  } else {
14747
14801
  const validCompressionTypes = Object.values(CompressionType).filter((v) => typeof v === "string");
14748
- throw new Error(`Unsupported compressionType: ${options2.compressionType} Available types: ${validCompressionTypes.join(", ")}`);
14802
+ throw new Error(`Unsupported compressionType: ${options.compressionType} Available types: ${validCompressionTypes.join(", ")}`);
14749
14803
  }
14750
14804
  } else {
14751
14805
  this._compression = null;
@@ -14771,11 +14825,11 @@ return true;`);
14771
14825
  [Symbol.asyncIterator]() {
14772
14826
  return this._sink[Symbol.asyncIterator]();
14773
14827
  }
14774
- toDOMStream(options2) {
14775
- return this._sink.toDOMStream(options2);
14828
+ toDOMStream(options) {
14829
+ return this._sink.toDOMStream(options);
14776
14830
  }
14777
- toNodeStream(options2) {
14778
- return this._sink.toNodeStream(options2);
14831
+ toNodeStream(options) {
14832
+ return this._sink.toNodeStream(options);
14779
14833
  }
14780
14834
  close() {
14781
14835
  return this.reset()._sink.close();
@@ -14983,8 +15037,8 @@ return true;`);
14983
15037
  };
14984
15038
  RecordBatchStreamWriter = class _RecordBatchStreamWriter extends RecordBatchWriter {
14985
15039
  /** @nocollapse */
14986
- static writeAll(input, options2) {
14987
- const writer = new _RecordBatchStreamWriter(options2);
15040
+ static writeAll(input, options) {
15041
+ const writer = new _RecordBatchStreamWriter(options);
14988
15042
  if (isPromise(input)) {
14989
15043
  return input.then((x) => writer.writeAll(x));
14990
15044
  } else if (isAsyncIterable(input)) {
@@ -14995,8 +15049,8 @@ return true;`);
14995
15049
  };
14996
15050
  RecordBatchFileWriter = class _RecordBatchFileWriter extends RecordBatchWriter {
14997
15051
  /** @nocollapse */
14998
- static writeAll(input, options2) {
14999
- const writer = new _RecordBatchFileWriter(options2);
15052
+ static writeAll(input, options) {
15053
+ const writer = new _RecordBatchFileWriter(options);
15000
15054
  if (isPromise(input)) {
15001
15055
  return input.then((x) => writer.writeAll(x));
15002
15056
  } else if (isAsyncIterable(input)) {
@@ -15004,8 +15058,8 @@ return true;`);
15004
15058
  }
15005
15059
  return writeAll(writer, input);
15006
15060
  }
15007
- constructor(options2) {
15008
- super(options2);
15061
+ constructor(options) {
15062
+ super(options);
15009
15063
  this._autoDestroy = true;
15010
15064
  this._writeLegacyIpcFormat = false;
15011
15065
  }
@@ -15100,20 +15154,20 @@ return true;`);
15100
15154
  });
15101
15155
 
15102
15156
  // ../../node_modules/apache-arrow/io/whatwg/iterable.mjs
15103
- function toDOMStream(source, options2) {
15157
+ function toDOMStream(source, options) {
15104
15158
  if (isAsyncIterable(source)) {
15105
- return asyncIterableAsReadableDOMStream(source, options2);
15159
+ return asyncIterableAsReadableDOMStream(source, options);
15106
15160
  }
15107
15161
  if (isIterable(source)) {
15108
- return iterableAsReadableDOMStream(source, options2);
15162
+ return iterableAsReadableDOMStream(source, options);
15109
15163
  }
15110
15164
  throw new Error(`toDOMStream() must be called with an Iterable or AsyncIterable`);
15111
15165
  }
15112
- function iterableAsReadableDOMStream(source, options2) {
15166
+ function iterableAsReadableDOMStream(source, options) {
15113
15167
  let it = null;
15114
- const bm = (options2 === null || options2 === void 0 ? void 0 : options2.type) === "bytes" || false;
15115
- const hwm = (options2 === null || options2 === void 0 ? void 0 : options2.highWaterMark) || Math.pow(2, 24);
15116
- return new ReadableStream(Object.assign(Object.assign({}, options2), {
15168
+ const bm = (options === null || options === void 0 ? void 0 : options.type) === "bytes" || false;
15169
+ const hwm = (options === null || options === void 0 ? void 0 : options.highWaterMark) || Math.pow(2, 24);
15170
+ return new ReadableStream(Object.assign(Object.assign({}, options), {
15117
15171
  start(controller) {
15118
15172
  next(controller, it || (it = source[Symbol.iterator]()));
15119
15173
  },
@@ -15124,7 +15178,7 @@ return true;`);
15124
15178
  (it === null || it === void 0 ? void 0 : it.return) && it.return();
15125
15179
  it = null;
15126
15180
  }
15127
- }), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options2));
15181
+ }), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options));
15128
15182
  function next(controller, it2) {
15129
15183
  let buf;
15130
15184
  let r = null;
@@ -15142,11 +15196,11 @@ return true;`);
15142
15196
  controller.close();
15143
15197
  }
15144
15198
  }
15145
- function asyncIterableAsReadableDOMStream(source, options2) {
15199
+ function asyncIterableAsReadableDOMStream(source, options) {
15146
15200
  let it = null;
15147
- const bm = (options2 === null || options2 === void 0 ? void 0 : options2.type) === "bytes" || false;
15148
- const hwm = (options2 === null || options2 === void 0 ? void 0 : options2.highWaterMark) || Math.pow(2, 24);
15149
- return new ReadableStream(Object.assign(Object.assign({}, options2), {
15201
+ const bm = (options === null || options === void 0 ? void 0 : options.type) === "bytes" || false;
15202
+ const hwm = (options === null || options === void 0 ? void 0 : options.highWaterMark) || Math.pow(2, 24);
15203
+ return new ReadableStream(Object.assign(Object.assign({}, options), {
15150
15204
  start(controller) {
15151
15205
  return __awaiter(this, void 0, void 0, function* () {
15152
15206
  yield next(controller, it || (it = source[Symbol.asyncIterator]()));
@@ -15163,7 +15217,7 @@ return true;`);
15163
15217
  it = null;
15164
15218
  });
15165
15219
  }
15166
- }), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options2));
15220
+ }), Object.assign({ highWaterMark: bm ? hwm : void 0 }, options));
15167
15221
  function next(controller, it2) {
15168
15222
  return __awaiter(this, void 0, void 0, function* () {
15169
15223
  let buf;
@@ -15193,8 +15247,8 @@ return true;`);
15193
15247
  });
15194
15248
 
15195
15249
  // ../../node_modules/apache-arrow/io/whatwg/builder.mjs
15196
- function builderThroughDOMStream(options2) {
15197
- return new BuilderTransform(options2);
15250
+ function builderThroughDOMStream(options) {
15251
+ return new BuilderTransform(options);
15198
15252
  }
15199
15253
  var BuilderTransform, chunkLength, chunkByteLength;
15200
15254
  var init_builder3 = __esm({
@@ -15203,11 +15257,11 @@ return true;`);
15203
15257
  init_tslib_es6();
15204
15258
  init_factories();
15205
15259
  BuilderTransform = class {
15206
- constructor(options2) {
15260
+ constructor(options) {
15207
15261
  this._numChunks = 0;
15208
15262
  this._finished = false;
15209
15263
  this._bufferedSize = 0;
15210
- const { ["readableStrategy"]: readableStrategy, ["writableStrategy"]: writableStrategy, ["queueingStrategy"]: queueingStrategy = "count" } = options2, builderOptions = __rest(options2, ["readableStrategy", "writableStrategy", "queueingStrategy"]);
15264
+ const { ["readableStrategy"]: readableStrategy, ["writableStrategy"]: writableStrategy, ["queueingStrategy"]: queueingStrategy = "count" } = options, builderOptions = __rest(options, ["readableStrategy", "writableStrategy", "queueingStrategy"]);
15211
15265
  this._controller = null;
15212
15266
  this._builder = makeBuilder(builderOptions);
15213
15267
  this._getSize = queueingStrategy !== "bytes" ? chunkLength : chunkByteLength;
@@ -15710,8 +15764,8 @@ return true;`);
15710
15764
  function convertArrowToSchema(arrowSchema) {
15711
15765
  return serializeArrowSchema(arrowSchema);
15712
15766
  }
15713
- function convertSchemaToArrow(schema, options2) {
15714
- return deserializeArrowSchema(schema, options2);
15767
+ function convertSchemaToArrow(schema, options) {
15768
+ return deserializeArrowSchema(schema, options);
15715
15769
  }
15716
15770
  function serializeArrowSchema(arrowSchema) {
15717
15771
  return {
@@ -15719,9 +15773,9 @@ return true;`);
15719
15773
  metadata: serializeArrowMetadata(arrowSchema.metadata)
15720
15774
  };
15721
15775
  }
15722
- function deserializeArrowSchema(schema, options2) {
15776
+ function deserializeArrowSchema(schema, options) {
15723
15777
  return new Schema2(
15724
- schema.fields.map((field) => deserializeArrowField(field, options2)),
15778
+ schema.fields.map((field) => deserializeArrowField(field, options)),
15725
15779
  deserializeArrowMetadata(schema.metadata)
15726
15780
  );
15727
15781
  }
@@ -15739,10 +15793,10 @@ return true;`);
15739
15793
  metadata: serializeArrowMetadata(field.metadata)
15740
15794
  };
15741
15795
  }
15742
- function deserializeArrowField(field, options2) {
15796
+ function deserializeArrowField(field, options) {
15743
15797
  return new Field2(
15744
15798
  field.name,
15745
- deserializeArrowType(field.type, options2),
15799
+ deserializeArrowType(field.type, options),
15746
15800
  field.nullable,
15747
15801
  deserializeArrowMetadata(field.metadata)
15748
15802
  );
@@ -15768,7 +15822,7 @@ return true;`);
15768
15822
  return "bool";
15769
15823
  case Int_:
15770
15824
  const intType = arrowType;
15771
- return `${intType.isSigned ? "u" : ""}int${intType.bitWidth}`;
15825
+ return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
15772
15826
  case Int8:
15773
15827
  return "int8";
15774
15828
  case Int16:
@@ -15918,36 +15972,36 @@ return true;`);
15918
15972
  throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
15919
15973
  }
15920
15974
  }
15921
- function deserializeArrowType(dataType, options2) {
15975
+ function deserializeArrowType(dataType, options) {
15922
15976
  if (typeof dataType === "object") {
15923
15977
  switch (dataType.type) {
15924
15978
  case "decimal":
15925
15979
  return new Decimal2(dataType.scale, dataType.precision, dataType.bitWidth);
15926
15980
  case "map": {
15927
15981
  const children = dataType.children.map(
15928
- (arrowField) => deserializeArrowField(arrowField, options2)
15982
+ (arrowField) => deserializeArrowField(arrowField, options)
15929
15983
  );
15930
- return new Map_(children, dataType.keysSorted);
15984
+ return new Map_(children[0], dataType.keysSorted);
15931
15985
  }
15932
15986
  case "list": {
15933
- const field = deserializeArrowField(dataType.children[0], options2);
15987
+ const field = deserializeArrowField(dataType.children[0], options);
15934
15988
  return new List2(field);
15935
15989
  }
15936
15990
  case "fixed-size-list": {
15937
- const child = deserializeArrowField(dataType.children[0], options2);
15991
+ const child = deserializeArrowField(dataType.children[0], options);
15938
15992
  return new FixedSizeList2(dataType.listSize, child);
15939
15993
  }
15940
15994
  case "fixed-size-binary":
15941
15995
  return new FixedSizeBinary2(dataType.byteWidth);
15942
15996
  case "struct": {
15943
15997
  const children = dataType.children.map(
15944
- (arrowField) => deserializeArrowField(arrowField, options2)
15998
+ (arrowField) => deserializeArrowField(arrowField, options)
15945
15999
  );
15946
16000
  return new Struct(children);
15947
16001
  }
15948
16002
  case "dictionary": {
15949
16003
  return new Dictionary(
15950
- deserializeArrowType(dataType.dictionary, options2),
16004
+ deserializeArrowType(dataType.dictionary, options),
15951
16005
  deserializeArrowDictionaryKeyType(dataType.indices),
15952
16006
  dataType.id,
15953
16007
  dataType.isOrdered
@@ -15961,7 +16015,7 @@ return true;`);
15961
16015
  case "null":
15962
16016
  return new Null2();
15963
16017
  case "binary":
15964
- return makeVariableWidthArrowType("BinaryView", new Binary2(), options2);
16018
+ return makeVariableWidthArrowType("BinaryView", new Binary2(), options);
15965
16019
  case "binary-view":
15966
16020
  return makeRequiredArrowViewType("BinaryView");
15967
16021
  case "bool":
@@ -15989,7 +16043,7 @@ return true;`);
15989
16043
  case "float64":
15990
16044
  return new Float64();
15991
16045
  case "utf8":
15992
- return makeVariableWidthArrowType("Utf8View", new Utf82(), options2);
16046
+ return makeVariableWidthArrowType("Utf8View", new Utf82(), options);
15993
16047
  case "utf8-view":
15994
16048
  return makeRequiredArrowViewType("Utf8View");
15995
16049
  case "date-day":
@@ -16032,8 +16086,8 @@ return true;`);
16032
16086
  const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
16033
16087
  return Boolean(guard?.(arrowType));
16034
16088
  }
16035
- function makeVariableWidthArrowType(viewTypeName, fallbackType, options2) {
16036
- const viewTypeMode = options2?.viewTypes || "never";
16089
+ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
16090
+ const viewTypeMode = options?.viewTypes || "never";
16037
16091
  if (viewTypeMode === "never") {
16038
16092
  return fallbackType;
16039
16093
  }
@@ -16312,7 +16366,7 @@ return true;`);
16312
16366
  if (table.schema) {
16313
16367
  const objectRow2 = target || {};
16314
16368
  for (let i = 0; i < table.schema.fields.length; i++) {
16315
- objectRow2[table.schema.fields[i].name] = table.features[rowIndex][i];
16369
+ objectRow2[table.schema.fields[i].name] = table.features[rowIndex][table.schema.fields[i].name];
16316
16370
  }
16317
16371
  return objectRow2;
16318
16372
  }
@@ -16416,11 +16470,11 @@ return true;`);
16416
16470
  });
16417
16471
 
16418
16472
  // ../schema-utils/src/lib/table/batches/make-arrow-batch-iterator.ts
16419
- function* makeArrowRecordBatchIterator(table, options2) {
16473
+ function* makeArrowRecordBatchIterator(table, options) {
16420
16474
  const arrowSchema = convertSchemaToArrow(table.schema);
16421
16475
  const length = getTableLength(table);
16422
16476
  const numColumns = getTableNumCols(table);
16423
- const batchSize = options2?.batchSize || length;
16477
+ const batchSize = options?.batchSize || length;
16424
16478
  const builders = arrowSchema?.fields.map(
16425
16479
  (arrowField) => makeBuilder({
16426
16480
  type: arrowField.type,
@@ -16462,7 +16516,7 @@ return true;`);
16462
16516
  });
16463
16517
 
16464
16518
  // ../schema-utils/src/lib/table/tables/convert-arrow-table.ts
16465
- function convertTableToArrow(table, options2) {
16519
+ function convertTableToArrow(table, options) {
16466
16520
  switch (table.shape) {
16467
16521
  case "arrow-table":
16468
16522
  return table.data;
@@ -16471,7 +16525,7 @@ return true;`);
16471
16525
  // return convertColumnarTableToArrow(table, options);
16472
16526
  // fall through
16473
16527
  default:
16474
- const arrowBatchIterator = makeArrowRecordBatchIterator(table, options2);
16528
+ const arrowBatchIterator = makeArrowRecordBatchIterator(table, options);
16475
16529
  return new Table(arrowBatchIterator);
16476
16530
  }
16477
16531
  }
@@ -16562,7 +16616,7 @@ return true;`);
16562
16616
  }
16563
16617
  function convertToColumnarTable(table) {
16564
16618
  const schema = table.schema || deduceTableSchema(table);
16565
- const fields = table.schema?.fields || [];
16619
+ const fields = schema.fields;
16566
16620
  if (table.shape === "columnar-table") {
16567
16621
  return { ...table, schema };
16568
16622
  }
@@ -16826,14 +16880,15 @@ return true;`);
16826
16880
  return null;
16827
16881
  }
16828
16882
  const extensionMetadata = {};
16829
- if (columnMetadata.crs !== void 0) {
16883
+ if (columnMetadata.crs === void 0) {
16884
+ extensionMetadata.crs = "OGC:CRS84";
16885
+ extensionMetadata.crs_type = "authority_code";
16886
+ } else if (columnMetadata.crs !== null) {
16830
16887
  extensionMetadata.crs = columnMetadata.crs;
16888
+ extensionMetadata.crs_type = "projjson";
16831
16889
  }
16832
- if (columnMetadata.crs_type !== void 0) {
16833
- extensionMetadata.crs_type = columnMetadata.crs_type;
16834
- }
16835
- if (columnMetadata.edges === "spherical") {
16836
- extensionMetadata.edges = "spherical";
16890
+ if (columnMetadata.edges && columnMetadata.edges !== "planar") {
16891
+ extensionMetadata.edges = columnMetadata.edges;
16837
16892
  }
16838
16893
  return Object.keys(extensionMetadata).length > 0 ? { extensionName, extensionMetadata } : { extensionName };
16839
16894
  }
@@ -17140,10 +17195,10 @@ ${val.stack}`;
17140
17195
  WASM_VECTOR_LEN = arg.length;
17141
17196
  return ptr;
17142
17197
  }
17143
- function readParquet(parquet_file, options2) {
17198
+ function readParquet(parquet_file, options) {
17144
17199
  const ptr0 = passArray8ToWasm0(parquet_file, wasm.__wbindgen_malloc);
17145
17200
  const len0 = WASM_VECTOR_LEN;
17146
- const ret = wasm.readParquet(ptr0, len0, isLikeNone(options2) ? 0 : addToExternrefTable0(options2));
17201
+ const ret = wasm.readParquet(ptr0, len0, isLikeNone(options) ? 0 : addToExternrefTable0(options));
17147
17202
  if (ret[2]) {
17148
17203
  throw takeFromExternrefTable0(ret[1]);
17149
17204
  }
@@ -18579,8 +18634,8 @@ ${val.stack}`;
18579
18634
  * @param {ReaderOptions | null} [options]
18580
18635
  * @returns {Promise<Table>}
18581
18636
  */
18582
- read(options2) {
18583
- const ret = wasm.parquetfile_read(this.__wbg_ptr, isLikeNone(options2) ? 0 : addToExternrefTable0(options2));
18637
+ read(options) {
18638
+ const ret = wasm.parquetfile_read(this.__wbg_ptr, isLikeNone(options) ? 0 : addToExternrefTable0(options));
18584
18639
  return ret;
18585
18640
  }
18586
18641
  /**
@@ -18612,8 +18667,8 @@ ${val.stack}`;
18612
18667
  * @param {ReaderOptions | null} [options]
18613
18668
  * @returns {Promise<ReadableStream>}
18614
18669
  */
18615
- stream(options2) {
18616
- const ret = wasm.parquetfile_stream(this.__wbg_ptr, isLikeNone(options2) ? 0 : addToExternrefTable0(options2));
18670
+ stream(options) {
18671
+ const ret = wasm.parquetfile_stream(this.__wbg_ptr, isLikeNone(options) ? 0 : addToExternrefTable0(options));
18617
18672
  return ret;
18618
18673
  }
18619
18674
  /**
@@ -19449,15 +19504,15 @@ ${val.stack}`;
19449
19504
  });
19450
19505
 
19451
19506
  // src/lib/utils/make-stream-iterator.ts
19452
- function makeStreamIterator(stream, options2) {
19453
- return isBrowser || isReadableStream(stream) ? makeBrowserStreamIterator(stream, options2) : makeNodeStreamIterator(stream, options2);
19507
+ function makeStreamIterator(stream, options) {
19508
+ return isBrowser || isReadableStream(stream) ? makeBrowserStreamIterator(stream, options) : makeNodeStreamIterator(stream, options);
19454
19509
  }
19455
19510
  function isReadableStream(stream) {
19456
19511
  return typeof stream.getReader === "function";
19457
19512
  }
19458
- async function* makeBrowserStreamIterator(stream, options2) {
19513
+ async function* makeBrowserStreamIterator(stream, options) {
19459
19514
  const reader = stream.getReader();
19460
- const signal = options2?.signal;
19515
+ const signal = options?.signal;
19461
19516
  const abortListener = () => {
19462
19517
  void reader.cancel(signal?.reason).catch(() => {
19463
19518
  });
@@ -19485,7 +19540,7 @@ ${val.stack}`;
19485
19540
  streamFinished = true;
19486
19541
  return;
19487
19542
  }
19488
- if (options2?._streamReadAhead) {
19543
+ if (options?._streamReadAhead) {
19489
19544
  nextBatchPromise = reader.read();
19490
19545
  void nextBatchPromise.catch(() => {
19491
19546
  });
@@ -19517,9 +19572,9 @@ ${val.stack}`;
19517
19572
  }
19518
19573
  }
19519
19574
  }
19520
- async function* makeNodeStreamIterator(stream, options2) {
19575
+ async function* makeNodeStreamIterator(stream, options) {
19521
19576
  const iterator = stream[Symbol.asyncIterator]();
19522
- const signal = options2?.signal;
19577
+ const signal = options?.signal;
19523
19578
  let abortListener;
19524
19579
  const abortPromise = signal ? new Promise((_resolve, reject) => {
19525
19580
  abortListener = () => reject(getAbortReason(signal));
@@ -19583,9 +19638,9 @@ ${val.stack}`;
19583
19638
  });
19584
19639
 
19585
19640
  // src/lib/parsers/parse-parquet-to-arrow.ts
19586
- async function parseParquetFileToArrow(file, options2) {
19587
- const wasmUrl = options2?.wasmUrl;
19588
- const readerOptions = getReaderOptions(options2);
19641
+ async function parseParquetFileToArrow(file, options) {
19642
+ const wasmUrl = options?.wasmUrl;
19643
+ const readerOptions = getReaderOptions(options);
19589
19644
  const wasm2 = await loadWasm(wasmUrl);
19590
19645
  const parquetFile = await createParquetFile(file, wasm2);
19591
19646
  try {
@@ -19603,9 +19658,9 @@ ${val.stack}`;
19603
19658
  parquetFile.free();
19604
19659
  }
19605
19660
  }
19606
- async function* parseParquetFileToArrowInBatches(file, options2) {
19607
- const wasmUrl = options2?.wasmUrl;
19608
- const readerOptions = getReaderOptions(options2);
19661
+ async function* parseParquetFileToArrowInBatches(file, options) {
19662
+ const wasmUrl = options?.wasmUrl;
19663
+ const readerOptions = getReaderOptions(options);
19609
19664
  const wasm2 = await loadWasm(wasmUrl);
19610
19665
  const parquetFile = await createParquetFile(file, wasm2);
19611
19666
  try {
@@ -19621,13 +19676,11 @@ ${val.stack}`;
19621
19676
  schemaMetadata
19622
19677
  );
19623
19678
  schema ||= normalizedArrowTable.schema;
19624
- yield {
19625
- batchType: "data",
19679
+ yield makeTableScanBatch({
19626
19680
  shape: "arrow-table",
19627
19681
  schema,
19628
- data: normalizedArrowTable.data,
19629
- length: normalizedArrowTable.data.numRows
19630
- };
19682
+ data: normalizedArrowTable.data
19683
+ });
19631
19684
  }
19632
19685
  } finally {
19633
19686
  parquetFile.free();
@@ -19639,14 +19692,15 @@ ${val.stack}`;
19639
19692
  }
19640
19693
  return await wasm2.ParquetFile.fromUrl(file.url);
19641
19694
  }
19642
- function getReaderOptions(options2) {
19643
- const { wasmUrl, ...readerOptions } = options2 || {};
19695
+ function getReaderOptions(options) {
19696
+ const { wasmUrl, ...readerOptions } = options || {};
19644
19697
  return readerOptions;
19645
19698
  }
19646
19699
  var init_parse_parquet_to_arrow = __esm({
19647
19700
  "src/lib/parsers/parse-parquet-to-arrow.ts"() {
19648
19701
  "use strict";
19649
19702
  init_process();
19703
+ init_src2();
19650
19704
  init_Arrow_dom();
19651
19705
  init_geospatial_metadata();
19652
19706
  init_load_wasm();
@@ -19655,10 +19709,24 @@ ${val.stack}`;
19655
19709
  });
19656
19710
 
19657
19711
  // src/lib/utils/normalize-parquet-options.ts
19658
- function normalizeParquetOptions(options2, parquetDefaults) {
19712
+ function normalizeParquetOptions(options, parquetDefaults) {
19713
+ const scanOptions = options?._scan;
19714
+ if (scanOptions) {
19715
+ for (const key of Object.keys(scanOptions)) {
19716
+ if (key !== "columns" && key !== "limit") {
19717
+ throw new Error(`Parquet _scan option "${key}" is not supported`);
19718
+ }
19719
+ }
19720
+ }
19721
+ const parquetOptions = options?.parquet || {};
19659
19722
  return {
19660
- ...options2,
19661
- parquet: { ...parquetDefaults, ...options2?.parquet }
19723
+ ...options,
19724
+ parquet: {
19725
+ ...parquetDefaults,
19726
+ ...parquetOptions,
19727
+ ...scanOptions?.columns !== void 0 ? { columns: [...scanOptions.columns] } : {},
19728
+ ...scanOptions?.limit !== void 0 ? { limit: scanOptions.limit } : {}
19729
+ }
19662
19730
  };
19663
19731
  }
19664
19732
  var init_normalize_parquet_options = __esm({
@@ -19779,7 +19847,7 @@ ${val.stack}`;
19779
19847
  init_process();
19780
19848
  init_parquet_format();
19781
19849
  init_parquet_loader_options();
19782
- VERSION = true ? "5.0.0-alpha.2" : "latest";
19850
+ VERSION = true ? "5.0.0-alpha.3" : "latest";
19783
19851
  PARQUET_LOADER_BASE = {
19784
19852
  ...ParquetFormat,
19785
19853
  dataType: null,
@@ -19797,6 +19865,9 @@ ${val.stack}`;
19797
19865
  });
19798
19866
 
19799
19867
  // src/parquet-worker-url.ts
19868
+ function getParquetWorkerUrl(moduleUrl) {
19869
+ return `${moduleUrl.slice(0, moduleUrl.lastIndexOf("/") + 1)}${getParquetWorkerFile()}`;
19870
+ }
19800
19871
  function getParquetWorkerFile() {
19801
19872
  const isNode = Boolean(
19802
19873
  globalThis.process?.versions?.node
@@ -19809,7 +19880,7 @@ ${val.stack}`;
19809
19880
  "use strict";
19810
19881
  init_process();
19811
19882
  import_meta3 = {};
19812
- PARQUET_WORKER_URL = import_meta3.url ? new URL(getParquetWorkerFile(), import_meta3.url).toString() : typeof __dirname === "string" ? `${__dirname}/parquet-worker-node.cjs` : true;
19883
+ PARQUET_WORKER_URL = import_meta3.url ? getParquetWorkerUrl(import_meta3.url) : typeof __dirname === "string" ? `${__dirname}/parquet-worker-node.cjs` : true;
19813
19884
  }
19814
19885
  });
19815
19886
 
@@ -19839,16 +19910,16 @@ ${val.stack}`;
19839
19910
  ParquetLoaderWithParser: () => ParquetLoaderWithParser,
19840
19911
  getParquetOptions: () => getParquetOptions
19841
19912
  });
19842
- async function parseParquetTable(file, options2) {
19843
- const parquetOptions = getParquetOptions(options2);
19913
+ async function parseParquetTable(file, options) {
19914
+ const parquetOptions = getParquetOptions(options);
19844
19915
  if (parquetOptions.parquet?.shape === "arrow-table") {
19845
19916
  return await parseParquetFileToArrow(file, parquetOptions.parquet);
19846
19917
  }
19847
19918
  const arrowTable = await parseParquetFileToArrow(file, parquetOptions.parquet);
19848
19919
  return convertArrowTableToObjectRows(arrowTable);
19849
19920
  }
19850
- async function* parseParquetTableInBatches(file, options2) {
19851
- const parquetOptions = getParquetOptions(options2);
19921
+ async function* parseParquetTableInBatches(file, options) {
19922
+ const parquetOptions = getParquetOptions(options);
19852
19923
  if (parquetOptions.parquet?.shape === "arrow-table") {
19853
19924
  yield* parseParquetFileToArrowInBatches(file, parquetOptions.parquet);
19854
19925
  return;
@@ -19857,8 +19928,8 @@ ${val.stack}`;
19857
19928
  yield convertArrowBatchToObjectRows(batch);
19858
19929
  }
19859
19930
  }
19860
- function getParquetOptions(options2) {
19861
- return normalizeParquetOptions(options2, ParquetLoaderWithParser.options.parquet);
19931
+ function getParquetOptions(options) {
19932
+ return normalizeParquetOptions(options, ParquetLoaderWithParser.options.parquet);
19862
19933
  }
19863
19934
  var _ParquetLoaderPreload, ParquetLoaderMetadataWithoutPreload, ParquetLoaderWithParser;
19864
19935
  var init_parquet_loader = __esm({
@@ -19874,18 +19945,18 @@ ${val.stack}`;
19874
19945
  ({ preload: _ParquetLoaderPreload, ...ParquetLoaderMetadataWithoutPreload } = ParquetLoader);
19875
19946
  ParquetLoaderWithParser = {
19876
19947
  ...ParquetLoaderMetadataWithoutPreload,
19877
- parse(arrayBuffer, options2) {
19878
- return parseParquetTable(new BlobFile(arrayBuffer), options2);
19948
+ parse(arrayBuffer, options) {
19949
+ return parseParquetTable(new BlobFile(arrayBuffer), options);
19879
19950
  },
19880
- parseFile(file, options2) {
19881
- return parseParquetTable(file, options2);
19951
+ parseFile(file, options) {
19952
+ return parseParquetTable(file, options);
19882
19953
  },
19883
- parseFileInBatches(file, options2) {
19884
- return parseParquetTableInBatches(file, options2);
19954
+ parseFileInBatches(file, options) {
19955
+ return parseParquetTableInBatches(file, options);
19885
19956
  },
19886
- async *parseInBatches(asyncIterator, options2, _context) {
19957
+ async *parseInBatches(asyncIterator, options, _context) {
19887
19958
  const arrayBuffer = await concatenateArrayBuffersAsync(asyncIterator);
19888
- yield* parseParquetTableInBatches(new BlobFile(arrayBuffer), options2);
19959
+ yield* parseParquetTableInBatches(new BlobFile(arrayBuffer), options);
19889
19960
  },
19890
19961
  serializeWorkerResult: serializeParquetWorkerResult,
19891
19962
  deserializeWorkerResult: deserializeParquetWorkerResult
@@ -19899,18 +19970,18 @@ ${val.stack}`;
19899
19970
  init_parquet_loader();
19900
19971
  var ParquetWorkerLoader = {
19901
19972
  ...ParquetLoaderWithParser,
19902
- parse(arrayBuffer, options2) {
19903
- return ParquetLoaderWithParser.parse(arrayBuffer, addWorkerWasmUrl(options2));
19973
+ parse(arrayBuffer, options) {
19974
+ return ParquetLoaderWithParser.parse(arrayBuffer, addWorkerWasmUrl(options));
19904
19975
  }
19905
19976
  };
19906
- function addWorkerWasmUrl(options2) {
19907
- if (options2?.parquet?.wasmUrl || typeof globalThis.location?.href !== "string") {
19908
- return options2;
19977
+ function addWorkerWasmUrl(options) {
19978
+ if (options?.parquet?.wasmUrl || typeof globalThis.location?.href !== "string") {
19979
+ return options;
19909
19980
  }
19910
19981
  return {
19911
- ...options2,
19982
+ ...options,
19912
19983
  parquet: {
19913
- ...options2?.parquet,
19984
+ ...options?.parquet,
19914
19985
  wasmUrl: new URL("parquet_wasm_bg.wasm", globalThis.location.href).toString()
19915
19986
  }
19916
19987
  };