@loaders.gl/core 5.0.0-beta.1 → 5.0.0-beta.10

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 (850) hide show
  1. package/GEOARROW-README.md +1 -1
  2. package/README.md +4 -2
  3. package/SCAN-README.md +1 -1
  4. package/SCHEMA-UTILS-README.md +1 -1
  5. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
  6. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
  7. package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
  8. package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
  9. package/dist/arrow-geometry/feature-collection-to-arrow.cjs +5 -1
  10. package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
  11. package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
  12. package/dist/arrow-geometry/feature-collection-to-arrow.js +5 -1
  13. package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
  14. package/dist/arrow-geometry/feature-table.cjs +6 -2
  15. package/dist/arrow-geometry/feature-table.cjs.map +2 -2
  16. package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
  17. package/dist/arrow-geometry/feature-table.js +6 -2
  18. package/dist/arrow-geometry/feature-table.js.map +1 -1
  19. package/dist/arrow-geometry/geojson-table.cjs +295 -18
  20. package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
  21. package/dist/arrow-geometry/geojson-table.d.ts +10 -3
  22. package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
  23. package/dist/arrow-geometry/geojson-table.js +23 -13
  24. package/dist/arrow-geometry/geojson-table.js.map +1 -1
  25. package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
  26. package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
  27. package/dist/arrow-geometry/geometry-codecs.js +1 -1
  28. package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
  29. package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
  30. package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
  31. package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
  32. package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
  33. package/dist/arrow-geometry/index.cjs +0 -11
  34. package/dist/arrow-geometry/index.cjs.map +2 -2
  35. package/dist/arrow-geometry/index.d.ts +0 -1
  36. package/dist/arrow-geometry/index.d.ts.map +1 -1
  37. package/dist/arrow-geometry/index.js +0 -1
  38. package/dist/arrow-geometry/index.js.map +1 -1
  39. package/dist/arrow-geometry/wkb-builder.cjs +3 -3
  40. package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
  41. package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
  42. package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
  43. package/dist/arrow-geometry/wkb-builder.js +1 -1
  44. package/dist/arrow-geometry/wkb-builder.js.map +1 -1
  45. package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
  46. package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
  47. package/dist/arrow-geometry/wkb-statistics.js +1 -1
  48. package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
  49. package/dist/arrow-worker-transport.cjs +173 -0
  50. package/dist/arrow-worker-transport.cjs.map +6 -0
  51. package/dist/arrow-worker-transport.d.ts +15 -0
  52. package/dist/arrow-worker-transport.d.ts.map +1 -0
  53. package/dist/arrow-worker-transport.js +151 -0
  54. package/dist/arrow-worker-transport.js.map +1 -0
  55. package/dist/cluster-source.cjs +6874 -0
  56. package/dist/cluster-source.cjs.map +6 -0
  57. package/dist/cluster-source.d.ts +2 -0
  58. package/dist/cluster-source.d.ts.map +1 -0
  59. package/dist/cluster-source.js +2 -0
  60. package/dist/cluster-source.js.map +1 -0
  61. package/dist/dist.dev.js +3035 -823
  62. package/dist/dist.min.js +3 -3
  63. package/dist/federated-table-scan-source.cjs +2447 -0
  64. package/dist/federated-table-scan-source.cjs.map +6 -0
  65. package/dist/federated-table-scan-source.d.ts +2 -0
  66. package/dist/federated-table-scan-source.d.ts.map +1 -0
  67. package/dist/federated-table-scan-source.js +2 -0
  68. package/dist/federated-table-scan-source.js.map +1 -0
  69. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
  70. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
  71. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
  72. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
  73. package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
  74. package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
  75. package/dist/geoarrow/clustering/cluster-source.cjs +4 -7
  76. package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
  77. package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
  78. package/dist/geoarrow/clustering/cluster-source.js +1 -4
  79. package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
  80. package/dist/geoarrow/convert-table-to-geoarrow.cjs +1 -0
  81. package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
  82. package/dist/geoarrow/convert-table-to-geoarrow.d.ts +1 -1
  83. package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
  84. package/dist/geoarrow/convert-table-to-geoarrow.js +2 -0
  85. package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
  86. package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
  87. package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
  88. package/dist/geoarrow/geoarrow-bounds.js +3 -3
  89. package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
  90. package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
  91. package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
  92. package/dist/geoarrow/geoarrow-capabilities.js +1 -1
  93. package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
  94. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
  95. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
  96. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
  97. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
  98. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
  99. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
  100. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
  101. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
  102. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
  103. package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
  104. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +6 -4
  105. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
  106. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
  107. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
  108. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +6 -4
  109. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
  110. package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
  111. package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
  112. package/dist/geoarrow/geoarrow-inspection.js +1 -1
  113. package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
  114. package/dist/geoarrow/geoarrow-stream.cjs +1 -1
  115. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  116. package/dist/geoarrow/geoarrow-stream.js +1 -1
  117. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  118. package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
  119. package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
  120. package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
  121. package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
  122. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
  123. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
  124. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
  125. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
  126. package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
  127. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
  128. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
  129. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
  130. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
  131. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
  132. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
  133. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
  134. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
  135. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
  136. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
  137. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
  138. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
  139. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
  140. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
  141. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +2 -3
  142. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
  143. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
  144. package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
  145. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
  146. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
  147. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
  148. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
  149. package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
  150. package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
  151. package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
  152. package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
  153. package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
  154. package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
  155. package/dist/index.cjs +738 -1372
  156. package/dist/index.cjs.map +3 -3
  157. package/dist/index.d.ts +1 -3
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +1 -4
  160. package/dist/index.js.map +1 -1
  161. package/dist/lib/api/create-data-source.d.ts +20 -9
  162. package/dist/lib/api/create-data-source.d.ts.map +1 -1
  163. package/dist/lib/api/create-data-source.js +55 -45
  164. package/dist/lib/api/create-data-source.js.map +1 -1
  165. package/dist/lib/api/encode.d.ts +1 -1
  166. package/dist/lib/api/encode.d.ts.map +1 -1
  167. package/dist/lib/api/encode.js +11 -2
  168. package/dist/lib/api/encode.js.map +1 -1
  169. package/dist/lib/api/load-in-batches.d.ts +3 -2
  170. package/dist/lib/api/load-in-batches.d.ts.map +1 -1
  171. package/dist/lib/api/load-in-batches.js.map +1 -1
  172. package/dist/lib/api/load-loader.d.ts +3 -3
  173. package/dist/lib/api/load-loader.d.ts.map +1 -1
  174. package/dist/lib/api/load-loader.js +15 -19
  175. package/dist/lib/api/load-loader.js.map +1 -1
  176. package/dist/lib/api/load.d.ts +7 -3
  177. package/dist/lib/api/load.d.ts.map +1 -1
  178. package/dist/lib/api/load.js +17 -67
  179. package/dist/lib/api/load.js.map +1 -1
  180. package/dist/lib/api/parse-file.d.ts +5 -3
  181. package/dist/lib/api/parse-file.d.ts.map +1 -1
  182. package/dist/lib/api/parse-file.js +12 -7
  183. package/dist/lib/api/parse-file.js.map +1 -1
  184. package/dist/lib/api/parse-in-batches.d.ts +5 -3
  185. package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
  186. package/dist/lib/api/parse-in-batches.js +61 -6
  187. package/dist/lib/api/parse-in-batches.js.map +1 -1
  188. package/dist/lib/api/parse-sync.d.ts +5 -3
  189. package/dist/lib/api/parse-sync.d.ts.map +1 -1
  190. package/dist/lib/api/parse-sync.js +8 -6
  191. package/dist/lib/api/parse-sync.js.map +1 -1
  192. package/dist/lib/api/parse.d.ts +5 -3
  193. package/dist/lib/api/parse.d.ts.map +1 -1
  194. package/dist/lib/api/parse.js +26 -15
  195. package/dist/lib/api/parse.js.map +1 -1
  196. package/dist/lib/api/select-loader.d.ts +4 -2
  197. package/dist/lib/api/select-loader.d.ts.map +1 -1
  198. package/dist/lib/api/select-loader.js +47 -53
  199. package/dist/lib/api/select-loader.js.map +1 -1
  200. package/dist/lib/api/select-source.d.ts.map +1 -1
  201. package/dist/lib/api/select-source.js +1 -1
  202. package/dist/lib/api/select-source.js.map +1 -1
  203. package/dist/lib/init.js +1 -1
  204. package/dist/lib/init.js.map +1 -1
  205. package/dist/lib/loader-utils/get-fetch-function.js +2 -2
  206. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
  207. package/dist/lib/loader-utils/loggers.d.ts +2 -37
  208. package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
  209. package/dist/lib/loader-utils/loggers.js +2 -63
  210. package/dist/lib/loader-utils/loggers.js.map +1 -1
  211. package/dist/lib/loader-utils/native-arrow.d.ts +16 -0
  212. package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
  213. package/dist/lib/loader-utils/native-arrow.js +84 -0
  214. package/dist/lib/loader-utils/native-arrow.js.map +1 -0
  215. package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
  216. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
  217. package/dist/lib/loader-utils/option-defaults.js +9 -10
  218. package/dist/lib/loader-utils/option-defaults.js.map +1 -1
  219. package/dist/lib/loader-utils/option-utils.d.ts +0 -6
  220. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  221. package/dist/lib/loader-utils/option-utils.js +31 -114
  222. package/dist/lib/loader-utils/option-utils.js.map +1 -1
  223. package/dist/loader-utils/format-types.d.ts +3 -0
  224. package/dist/loader-utils/format-types.d.ts.map +1 -1
  225. package/dist/loader-utils/index.cjs +838 -1284
  226. package/dist/loader-utils/index.cjs.map +3 -3
  227. package/dist/loader-utils/index.d.ts +16 -7
  228. package/dist/loader-utils/index.d.ts.map +1 -1
  229. package/dist/loader-utils/index.js +8 -4
  230. package/dist/loader-utils/index.js.map +1 -1
  231. package/dist/loader-utils/json-loader.js +1 -1
  232. package/dist/loader-utils/json-loader.js.map +1 -1
  233. package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
  234. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
  235. package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
  236. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
  237. package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
  238. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
  239. package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
  240. package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
  241. package/dist/loader-utils/lib/files/read-range-response.js +62 -0
  242. package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
  243. package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
  244. package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
  245. package/dist/loader-utils/lib/log-utils/log.js +32 -1
  246. package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
  247. package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
  248. package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
  249. package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
  250. package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
  251. package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
  252. package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
  253. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
  254. package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
  255. package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
  256. package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
  257. package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
  258. package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
  259. package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
  260. package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
  261. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +54 -18
  262. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
  263. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +16 -6
  264. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
  265. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
  266. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
  267. package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
  268. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
  269. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +6 -3
  270. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
  271. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +33 -18
  272. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
  273. package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
  274. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
  275. package/dist/loader-utils/lib/sources/data-source.js +53 -14
  276. package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
  277. package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
  278. package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
  279. package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
  280. package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
  281. package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
  282. package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
  283. package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
  284. package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
  285. package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
  286. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +3 -2
  287. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
  288. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
  289. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
  290. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
  291. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
  292. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
  293. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
  294. package/dist/loader-utils/loader-types.d.ts +120 -91
  295. package/dist/loader-utils/loader-types.d.ts.map +1 -1
  296. package/dist/loader-utils/loader-types.js.map +1 -1
  297. package/dist/loader-utils/source-types.d.ts +7 -5
  298. package/dist/loader-utils/source-types.d.ts.map +1 -1
  299. package/dist/loader-utils/source-types.js +9 -1
  300. package/dist/loader-utils/source-types.js.map +1 -1
  301. package/dist/null-loader.d.ts +0 -18
  302. package/dist/null-loader.d.ts.map +1 -1
  303. package/dist/null-loader.js +1 -19
  304. package/dist/null-loader.js.map +1 -1
  305. package/dist/null-worker-node.js +771 -82
  306. package/dist/null-worker.js +742 -81
  307. package/dist/polyfills/images/encode-image-node.d.ts +18 -15
  308. package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
  309. package/dist/polyfills/images/encode-image-node.js +19 -33
  310. package/dist/polyfills/images/encode-image-node.js.map +1 -1
  311. package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
  312. package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
  313. package/dist/polyfills/images/image-codecs-node.js +2 -24
  314. package/dist/polyfills/images/image-codecs-node.js.map +1 -1
  315. package/dist/polyfills/images/load-sharp.d.ts +3 -0
  316. package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
  317. package/dist/polyfills/images/load-sharp.js +11 -0
  318. package/dist/polyfills/images/load-sharp.js.map +1 -0
  319. package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
  320. package/dist/polyfills/images/node-image-bitmap.js +1 -1
  321. package/dist/polyfills/images/node-image-formats.d.ts +1 -1
  322. package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
  323. package/dist/polyfills/images/node-image-formats.js +10 -4
  324. package/dist/polyfills/images/node-image-formats.js.map +1 -1
  325. package/dist/polyfills/images/parse-image-node.d.ts +10 -2
  326. package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
  327. package/dist/polyfills/images/parse-image-node.js +20 -32
  328. package/dist/polyfills/images/parse-image-node.js.map +1 -1
  329. package/dist/polyfills/index.cjs +76 -151
  330. package/dist/polyfills/index.d.ts.map +1 -1
  331. package/dist/polyfills/index.js +2 -2
  332. package/dist/polyfills/index.js.map +1 -1
  333. package/dist/scan/arrow-execution/expressions.cjs +134 -0
  334. package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
  335. package/dist/scan/arrow-execution/expressions.d.ts +11 -0
  336. package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
  337. package/dist/scan/arrow-execution/expressions.js +86 -0
  338. package/dist/scan/arrow-execution/expressions.js.map +1 -0
  339. package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
  340. package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
  341. package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
  342. package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
  343. package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
  344. package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
  345. package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
  346. package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
  347. package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
  348. package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
  349. package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
  350. package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
  351. package/dist/scan/arrow-execution.cjs +34 -0
  352. package/dist/scan/arrow-execution.cjs.map +7 -0
  353. package/dist/scan/arrow-execution.d.ts +4 -0
  354. package/dist/scan/arrow-execution.d.ts.map +1 -0
  355. package/dist/scan/arrow-execution.js +6 -0
  356. package/dist/scan/arrow-execution.js.map +1 -0
  357. package/dist/scan/arrow-query.cjs.map +1 -1
  358. package/dist/scan/arrow-query.d.ts +1 -1
  359. package/dist/scan/arrow-query.d.ts.map +1 -1
  360. package/dist/scan/catalog-query-source.cjs +122 -0
  361. package/dist/scan/catalog-query-source.cjs.map +7 -0
  362. package/dist/scan/catalog-query-source.d.ts +6 -0
  363. package/dist/scan/catalog-query-source.d.ts.map +1 -0
  364. package/dist/scan/catalog-query-source.js +115 -0
  365. package/dist/scan/catalog-query-source.js.map +1 -0
  366. package/dist/scan/federated-table-scan-source.cjs +38 -38
  367. package/dist/scan/federated-table-scan-source.cjs.map +2 -2
  368. package/dist/scan/federated-table-scan-source.d.ts +6 -10
  369. package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
  370. package/dist/scan/federated-table-scan-source.js +35 -35
  371. package/dist/scan/federated-table-scan-source.js.map +1 -1
  372. package/dist/scan/index.cjs +208 -4
  373. package/dist/scan/index.cjs.map +4 -4
  374. package/dist/scan/index.d.ts +13 -3
  375. package/dist/scan/index.d.ts.map +1 -1
  376. package/dist/scan/index.js +6 -1
  377. package/dist/scan/index.js.map +1 -1
  378. package/dist/scan/parse-sql-predicate.cjs +3 -294
  379. package/dist/scan/parse-sql-predicate.cjs.map +3 -3
  380. package/dist/scan/parse-sql-predicate.d.ts +6 -9
  381. package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
  382. package/dist/scan/parse-sql-predicate.js +5 -314
  383. package/dist/scan/parse-sql-predicate.js.map +1 -1
  384. package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
  385. package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
  386. package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
  387. package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
  388. package/dist/scan/query-arrow-table-in-batches.js +54 -0
  389. package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
  390. package/dist/scan/query-arrow-table.cjs +65 -202
  391. package/dist/scan/query-arrow-table.cjs.map +3 -3
  392. package/dist/scan/query-arrow-table.d.ts +7 -40
  393. package/dist/scan/query-arrow-table.d.ts.map +1 -1
  394. package/dist/scan/query-arrow-table.js +51 -211
  395. package/dist/scan/query-arrow-table.js.map +1 -1
  396. package/dist/scan/query-open-source.cjs +52 -0
  397. package/dist/scan/query-open-source.cjs.map +7 -0
  398. package/dist/scan/query-open-source.d.ts +4 -0
  399. package/dist/scan/query-open-source.d.ts.map +1 -0
  400. package/dist/scan/query-open-source.js +26 -0
  401. package/dist/scan/query-open-source.js.map +1 -0
  402. package/dist/scan/query-progressive.cjs +190 -0
  403. package/dist/scan/query-progressive.cjs.map +7 -0
  404. package/dist/scan/query-progressive.d.ts +39 -0
  405. package/dist/scan/query-progressive.d.ts.map +1 -0
  406. package/dist/scan/query-progressive.js +173 -0
  407. package/dist/scan/query-progressive.js.map +1 -0
  408. package/dist/scan/query-pushdown.cjs +140 -0
  409. package/dist/scan/query-pushdown.cjs.map +7 -0
  410. package/dist/scan/query-pushdown.d.ts +14 -0
  411. package/dist/scan/query-pushdown.d.ts.map +1 -0
  412. package/dist/scan/query-pushdown.js +136 -0
  413. package/dist/scan/query-pushdown.js.map +1 -0
  414. package/dist/scan/query.cjs +381 -0
  415. package/dist/scan/query.cjs.map +7 -0
  416. package/dist/scan/query.d.ts +64 -0
  417. package/dist/scan/query.d.ts.map +1 -0
  418. package/dist/scan/query.js +419 -0
  419. package/dist/scan/query.js.map +1 -0
  420. package/dist/scan/resolve-query-source.cjs +59 -0
  421. package/dist/scan/resolve-query-source.cjs.map +7 -0
  422. package/dist/scan/resolve-query-source.d.ts +6 -0
  423. package/dist/scan/resolve-query-source.d.ts.map +1 -0
  424. package/dist/scan/resolve-query-source.js +37 -0
  425. package/dist/scan/resolve-query-source.js.map +1 -0
  426. package/dist/scan/rows-to-arrow.cjs +1 -28
  427. package/dist/scan/rows-to-arrow.cjs.map +2 -2
  428. package/dist/scan/rows-to-arrow.d.ts +3 -3
  429. package/dist/scan/rows-to-arrow.d.ts.map +1 -1
  430. package/dist/scan/rows-to-arrow.js +2 -32
  431. package/dist/scan/rows-to-arrow.js.map +1 -1
  432. package/dist/scan/scan-engine.cjs.map +2 -2
  433. package/dist/scan/scan-engine.d.ts +5 -5
  434. package/dist/scan/scan-engine.d.ts.map +1 -1
  435. package/dist/scan/scan-engine.js.map +1 -1
  436. package/dist/scan/sql-catalog.cjs +110 -0
  437. package/dist/scan/sql-catalog.cjs.map +7 -0
  438. package/dist/scan/sql-catalog.d.ts +47 -0
  439. package/dist/scan/sql-catalog.d.ts.map +1 -0
  440. package/dist/scan/sql-catalog.js +97 -0
  441. package/dist/scan/sql-catalog.js.map +1 -0
  442. package/dist/scan/table-query.cjs.map +2 -2
  443. package/dist/scan/table-query.d.ts +4 -1
  444. package/dist/scan/table-query.d.ts.map +1 -1
  445. package/dist/scan/table-query.js.map +1 -1
  446. package/dist/scan/vector-table-scan-source.cjs +14 -13
  447. package/dist/scan/vector-table-scan-source.cjs.map +3 -3
  448. package/dist/scan/vector-table-scan-source.d.ts +6 -5
  449. package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
  450. package/dist/scan/vector-table-scan-source.js +17 -14
  451. package/dist/scan/vector-table-scan-source.js.map +1 -1
  452. package/dist/schema/geometry/geoarrow.d.ts +3 -6
  453. package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
  454. package/dist/schema/index.cjs +11 -7
  455. package/dist/schema/index.cjs.map +2 -2
  456. package/dist/schema/index.d.ts +2 -2
  457. package/dist/schema/index.d.ts.map +1 -1
  458. package/dist/schema/index.js +2 -2
  459. package/dist/schema/index.js.map +1 -1
  460. package/dist/schema-utils/index.cjs +690 -823
  461. package/dist/schema-utils/index.cjs.map +3 -3
  462. package/dist/schema-utils/index.d.ts +6 -5
  463. package/dist/schema-utils/index.d.ts.map +1 -1
  464. package/dist/schema-utils/index.js +6 -4
  465. package/dist/schema-utils/index.js.map +1 -1
  466. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +17 -0
  467. package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
  468. package/dist/schema-utils/lib/arrow/arrow-metadata.js +106 -0
  469. package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
  470. package/dist/schema-utils/lib/converters/convert.js +9 -2
  471. package/dist/schema-utils/lib/converters/convert.js.map +1 -1
  472. package/dist/schema-utils/lib/converters/types.d.ts +2 -0
  473. package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
  474. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +4 -3
  475. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
  476. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +4 -4
  477. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
  478. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +4 -3
  479. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
  480. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +9 -2
  481. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
  482. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
  483. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
  484. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
  485. package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
  486. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
  487. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
  488. package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
  489. package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
  490. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts +2 -2
  491. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
  492. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
  493. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
  494. package/dist/schema-utils/lib/schema/deduce-table-schema.js +4 -2
  495. package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
  496. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
  497. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
  498. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
  499. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
  500. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
  501. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
  502. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
  503. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
  504. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
  505. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
  506. package/dist/schema-utils/lib/table/batches/convert-batches.js +30 -9
  507. package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
  508. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
  509. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
  510. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +26 -15
  511. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
  512. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
  513. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
  514. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +33 -9
  515. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
  516. package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
  517. package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
  518. package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
  519. package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
  520. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts +27 -0
  521. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts.map +1 -0
  522. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js +23 -0
  523. package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js.map +1 -0
  524. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +12 -10
  525. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
  526. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +15 -26
  527. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
  528. package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
  529. package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
  530. package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
  531. package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
  532. package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
  533. package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
  534. package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
  535. package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
  536. package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
  537. package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
  538. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
  539. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
  540. package/dist/schema-utils/lib/table/tables/table-accessors.js +42 -31
  541. package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
  542. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
  543. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
  544. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
  545. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
  546. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +3 -3
  547. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
  548. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +7 -4
  549. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
  550. package/dist/vector-table-scan-source.cjs +1760 -0
  551. package/dist/vector-table-scan-source.cjs.map +6 -0
  552. package/dist/vector-table-scan-source.d.ts +2 -0
  553. package/dist/vector-table-scan-source.d.ts.map +1 -0
  554. package/dist/vector-table-scan-source.js +2 -0
  555. package/dist/vector-table-scan-source.js.map +1 -0
  556. package/dist/worker-utils/index.cjs +407 -1184
  557. package/dist/worker-utils/index.cjs.map +3 -3
  558. package/dist/worker-utils/index.d.ts +2 -8
  559. package/dist/worker-utils/index.d.ts.map +1 -1
  560. package/dist/worker-utils/index.js +1 -10
  561. package/dist/worker-utils/index.js.map +1 -1
  562. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  563. package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
  564. package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
  565. package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
  566. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
  567. package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
  568. package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
  569. package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
  570. package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
  571. package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
  572. package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
  573. package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
  574. package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
  575. package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
  576. package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
  577. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
  578. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
  579. package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
  580. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
  581. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
  582. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
  583. package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
  584. package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
  585. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
  586. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
  587. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
  588. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
  589. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
  590. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
  591. package/dist/worker-utils/null-worker-node.js +836 -147
  592. package/dist/worker-utils/null-worker-node.js.map +4 -4
  593. package/dist/worker-utils/null-worker.js +804 -143
  594. package/dist/worker-utils/null-worker.js.map +4 -4
  595. package/dist/worker-utils/types.d.ts +55 -72
  596. package/dist/worker-utils/types.d.ts.map +1 -1
  597. package/package.json +126 -35
  598. package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
  599. package/src/arrow-geometry/feature-collection-to-arrow.ts +5 -1
  600. package/src/arrow-geometry/feature-table.ts +6 -2
  601. package/src/arrow-geometry/geojson-table.ts +32 -21
  602. package/src/arrow-geometry/geometry-codecs.ts +2 -2
  603. package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
  604. package/src/arrow-geometry/index.ts +0 -9
  605. package/src/arrow-geometry/wkb-builder.ts +2 -2
  606. package/src/arrow-geometry/wkb-statistics.ts +2 -2
  607. package/src/arrow-worker-transport.ts +225 -0
  608. package/src/cluster-source.ts +1 -0
  609. package/src/federated-table-scan-source.ts +1 -0
  610. package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
  611. package/src/geoarrow/clustering/cluster-source.ts +4 -7
  612. package/src/geoarrow/convert-table-to-geoarrow.ts +3 -1
  613. package/src/geoarrow/geoarrow-bounds.ts +3 -3
  614. package/src/geoarrow/geoarrow-capabilities.ts +1 -1
  615. package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
  616. package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
  617. package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +9 -6
  618. package/src/geoarrow/geoarrow-inspection.ts +2 -2
  619. package/src/geoarrow/geoarrow-stream.ts +1 -1
  620. package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
  621. package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
  622. package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
  623. package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
  624. package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
  625. package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +8 -10
  626. package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
  627. package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
  628. package/src/index.ts +1 -5
  629. package/src/lib/api/create-data-source.ts +148 -58
  630. package/src/lib/api/encode.ts +14 -3
  631. package/src/lib/api/load-in-batches.ts +15 -7
  632. package/src/lib/api/load-loader.ts +22 -21
  633. package/src/lib/api/load.ts +61 -127
  634. package/src/lib/api/parse-file.ts +42 -23
  635. package/src/lib/api/parse-in-batches.ts +122 -17
  636. package/src/lib/api/parse-sync.ts +37 -19
  637. package/src/lib/api/parse.ts +51 -30
  638. package/src/lib/api/select-loader.ts +54 -69
  639. package/src/lib/api/select-source.ts +7 -1
  640. package/src/lib/loader-utils/get-fetch-function.ts +2 -2
  641. package/src/lib/loader-utils/loggers.ts +2 -70
  642. package/src/lib/loader-utils/native-arrow.ts +109 -0
  643. package/src/lib/loader-utils/option-defaults.ts +9 -10
  644. package/src/lib/loader-utils/option-utils.ts +33 -122
  645. package/src/loader-utils/format-types.ts +4 -0
  646. package/src/loader-utils/index.ts +50 -9
  647. package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
  648. package/src/loader-utils/lib/files/http-file-types.ts +2 -0
  649. package/src/loader-utils/lib/files/read-range-response.ts +66 -0
  650. package/src/loader-utils/lib/log-utils/log.ts +36 -1
  651. package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
  652. package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
  653. package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
  654. package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
  655. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +80 -28
  656. package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
  657. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +54 -29
  658. package/src/loader-utils/lib/sources/data-source.ts +57 -16
  659. package/src/loader-utils/lib/sources/image-source.ts +1 -1
  660. package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
  661. package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
  662. package/src/loader-utils/lib/sources/vector-source.ts +3 -3
  663. package/src/loader-utils/lib/sources/vector-tile-source.ts +3 -2
  664. package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
  665. package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
  666. package/src/loader-utils/loader-types.ts +190 -111
  667. package/src/loader-utils/source-types.ts +17 -6
  668. package/src/null-loader.ts +1 -20
  669. package/src/polyfills/README.md +2 -2
  670. package/src/polyfills/images/encode-image-node.ts +44 -37
  671. package/src/polyfills/images/image-codecs-node.ts +2 -37
  672. package/src/polyfills/images/load-sharp.ts +13 -0
  673. package/src/polyfills/images/node-image-bitmap.ts +1 -1
  674. package/src/polyfills/images/node-image-formats.ts +10 -4
  675. package/src/polyfills/images/parse-image-node.ts +31 -40
  676. package/src/polyfills/index.ts +3 -3
  677. package/src/scan/arrow-execution/expressions.ts +116 -0
  678. package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
  679. package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
  680. package/src/scan/arrow-execution.ts +7 -0
  681. package/src/scan/arrow-query.ts +3 -0
  682. package/src/scan/catalog-query-source.ts +132 -0
  683. package/src/scan/federated-table-scan-source.ts +64 -72
  684. package/src/scan/index.ts +57 -5
  685. package/src/scan/parse-sql-predicate.ts +14 -367
  686. package/src/scan/query-arrow-table-in-batches.ts +55 -0
  687. package/src/scan/query-arrow-table.ts +81 -271
  688. package/src/scan/query-open-source.ts +39 -0
  689. package/src/scan/query-progressive.ts +229 -0
  690. package/src/scan/query-pushdown.ts +184 -0
  691. package/src/scan/query.ts +597 -0
  692. package/src/scan/resolve-query-source.ts +47 -0
  693. package/src/scan/rows-to-arrow.ts +3 -39
  694. package/src/scan/scan-engine.ts +6 -6
  695. package/src/scan/sql-catalog.ts +167 -0
  696. package/src/scan/table-query.ts +6 -1
  697. package/src/scan/vector-table-scan-source.ts +22 -18
  698. package/src/schema/geometry/geoarrow.ts +8 -19
  699. package/src/schema/index.ts +3 -2
  700. package/src/schema-utils/index.ts +23 -8
  701. package/src/schema-utils/lib/arrow/arrow-metadata.ts +136 -0
  702. package/src/schema-utils/lib/converters/convert.ts +7 -2
  703. package/src/schema-utils/lib/converters/types.ts +2 -0
  704. package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +7 -9
  705. package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +10 -4
  706. package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
  707. package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
  708. package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +18 -8
  709. package/src/schema-utils/lib/schema/deduce-table-schema.ts +4 -2
  710. package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
  711. package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
  712. package/src/schema-utils/lib/table/batches/convert-batches.ts +41 -21
  713. package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +33 -19
  714. package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +48 -7
  715. package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
  716. package/src/schema-utils/lib/table/tables/convert-arrow-table-wrapper.ts +54 -0
  717. package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +30 -35
  718. package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
  719. package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
  720. package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
  721. package/src/schema-utils/lib/table/tables/table-accessors.ts +66 -49
  722. package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
  723. package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +13 -10
  724. package/src/vector-table-scan-source.ts +1 -0
  725. package/src/worker-utils/index.ts +2 -18
  726. package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
  727. package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
  728. package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
  729. package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
  730. package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
  731. package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
  732. package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
  733. package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
  734. package/src/worker-utils/types.ts +74 -109
  735. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
  736. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
  737. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
  738. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
  739. package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
  740. package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
  741. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
  742. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
  743. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
  744. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
  745. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
  746. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
  747. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
  748. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
  749. package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
  750. package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
  751. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
  752. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
  753. package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
  754. package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
  755. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
  756. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
  757. package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
  758. package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
  759. package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
  760. package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
  761. package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
  762. package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
  763. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
  764. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
  765. package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
  766. package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
  767. package/dist/schema/deprecated/mesh-utils.js +0 -37
  768. package/dist/schema/deprecated/mesh-utils.js.map +0 -1
  769. package/dist/schema-utils/arrow-transport.cjs +0 -691
  770. package/dist/schema-utils/arrow-transport.cjs.map +0 -6
  771. package/dist/schema-utils/arrow-transport.d.ts +0 -4
  772. package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
  773. package/dist/schema-utils/arrow-transport.js +0 -7
  774. package/dist/schema-utils/arrow-transport.js.map +0 -1
  775. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
  776. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
  777. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
  778. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
  779. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
  780. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
  781. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
  782. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
  783. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
  784. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
  785. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
  786. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
  787. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
  788. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
  789. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
  790. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
  791. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
  792. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
  793. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
  794. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
  795. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
  796. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
  797. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
  798. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
  799. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
  800. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
  801. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
  802. package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
  803. package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
  804. package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
  805. package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
  806. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
  807. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
  808. package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
  809. package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
  810. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
  811. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
  812. package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
  813. package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
  814. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
  815. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
  816. package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
  817. package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
  818. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
  819. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
  820. package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
  821. package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
  822. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
  823. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
  824. package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
  825. package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
  826. package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
  827. package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
  828. package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
  829. package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
  830. package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
  831. package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
  832. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
  833. package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
  834. package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
  835. package/src/schema/deprecated/mesh-utils.ts +0 -46
  836. package/src/schema-utils/arrow-transport.ts +0 -7
  837. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
  838. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
  839. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
  840. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
  841. package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
  842. package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
  843. package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
  844. package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
  845. package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
  846. package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
  847. package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
  848. package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
  849. package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
  850. package/src/worker-utils/lib/worker-farm/worker-thread.ts +0 -206
@@ -3,6 +3,14 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res, err) => function __init() {
7
+ if (err) throw err[0];
8
+ try {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ } catch (e) {
11
+ throw err = [e], e;
12
+ }
13
+ };
6
14
  var __export = (target, all) => {
7
15
  for (var name in all)
8
16
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +25,34 @@ var __copyProps = (to, from, except, desc) => {
17
25
  };
18
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
27
 
28
+ // src/worker-utils/lib/node/worker_threads-browser.ts
29
+ var worker_threads_browser_exports = {};
30
+ __export(worker_threads_browser_exports, {
31
+ NodeWorker: () => NodeWorker,
32
+ parentPort: () => parentPort
33
+ });
34
+ var NodeWorker, parentPort;
35
+ var init_worker_threads_browser = __esm({
36
+ "src/worker-utils/lib/node/worker_threads-browser.ts"() {
37
+ "use strict";
38
+ NodeWorker = class {
39
+ /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
40
+ constructor(...arguments_) {
41
+ var _a;
42
+ const runtimeProcess = globalThis.process;
43
+ const WorkerConstructor = (_a = runtimeProcess == null ? void 0 : runtimeProcess.getBuiltinModule) == null ? void 0 : _a.call(runtimeProcess, "node:worker_threads").Worker;
44
+ if (WorkerConstructor) {
45
+ return new WorkerConstructor(...arguments_);
46
+ }
47
+ }
48
+ /** No-op browser fallback matching the native Worker API. */
49
+ terminate() {
50
+ }
51
+ };
52
+ parentPort = null;
53
+ }
54
+ });
55
+
20
56
  // dist/loader-utils/index.js
21
57
  var index_exports = {};
22
58
  __export(index_exports, {
@@ -68,6 +104,7 @@ __export(index_exports, {
68
104
  createLAZChunkDecoderCursor: () => createLAZChunkDecoderCursor,
69
105
  createLAZChunkEncoder: () => createLAZChunkEncoder,
70
106
  createLoaderWorker: () => createLoaderWorker,
107
+ createQueryMetadata: () => createQueryMetadata,
71
108
  createQueryParameterCredential: () => createQueryParameterCredential,
72
109
  createRangeStats: () => createRangeStats,
73
110
  createScanQueryMetadata: () => createScanQueryMetadata,
@@ -79,7 +116,7 @@ __export(index_exports, {
79
116
  decodeLAZChunkInBatches: () => decodeLAZChunkInBatches,
80
117
  decodeLAZChunkTable: () => decodeLAZChunkTable,
81
118
  document: () => document_,
82
- emitScanExecutionTelemetry: () => emitScanExecutionTelemetry,
119
+ emitQueryComplete: () => emitQueryComplete,
83
120
  encodeArrayBufferToBase64: () => encodeArrayBufferToBase64,
84
121
  encodeHex: () => encodeHex,
85
122
  encodeLASzipVLR: () => encodeLASzipVLR,
@@ -105,6 +142,7 @@ __export(index_exports, {
105
142
  getLAZChunkByteLength: () => getLAZChunkByteLength,
106
143
  getLAZChunkDeclaredByteLength: () => getLAZChunkDeclaredByteLength,
107
144
  getLAZChunkHeaderByteLength: () => getLAZChunkHeaderByteLength,
145
+ getLoaderLog: () => getLoaderLog,
108
146
  getMagicString: () => getMagicString,
109
147
  getPathPrefix: () => getPathPrefix,
110
148
  getRangeStats: () => getRangeStats,
@@ -151,6 +189,8 @@ __export(index_exports, {
151
189
  makeTextEncoderIterator: () => makeTextEncoderIterator,
152
190
  mergeOptions: () => mergeOptions,
153
191
  nodeVersion: () => nodeVersion,
192
+ normalizeTableQuery: () => normalizeTableQuery,
193
+ paceBatchIterator: () => paceBatchIterator,
154
194
  padStringToByteAlignment: () => padStringToByteAlignment,
155
195
  padToNBytes: () => padToNBytes,
156
196
  parseContentType: () => parseContentType,
@@ -161,6 +201,7 @@ __export(index_exports, {
161
201
  parseWithWorker: () => parseWithWorker,
162
202
  parseWithWorkerInBatches: () => parseWithWorkerInBatches,
163
203
  path: () => path_exports,
204
+ planLogicalTableQuery: () => planLogicalTableQuery,
164
205
  planRelationalQuery: () => planRelationalQuery,
165
206
  planTableQuery: () => planTableQuery,
166
207
  processLoaderWorkerBatches: () => processLoaderWorkerBatches,
@@ -169,6 +210,7 @@ __export(index_exports, {
169
210
  promisify1: () => promisify1,
170
211
  promisify2: () => promisify2,
171
212
  rasterCoordinateToPixel: () => rasterCoordinateToPixel,
213
+ readRangeResponse: () => readRangeResponse,
172
214
  redactCredentialURL: () => redactCredentialURL,
173
215
  registerJSModules: () => registerJSModules,
174
216
  resolveAuthenticationOptions: () => resolveAuthenticationOptions,
@@ -184,17 +226,20 @@ __export(index_exports, {
184
226
  shouldParseWithWorker: () => shouldParseWithWorker,
185
227
  sliceArrayBuffer: () => sliceArrayBuffer,
186
228
  stream: () => stream_browser_exports,
229
+ supportsSourceCreation: () => supportsSourceCreation,
187
230
  toArrayBuffer: () => toArrayBuffer2,
188
231
  toArrayBufferIterator: () => toArrayBufferIterator,
189
232
  toArrayBufferView: () => toArrayBufferView,
190
233
  toBuffer: () => toBuffer2,
191
234
  truncateTableBatch: () => truncateTableBatch,
235
+ validateBatchDeliveryRate: () => validateBatchDeliveryRate,
192
236
  validateColumnarPredicate: () => validateColumnarPredicate,
193
237
  validatePointCloudQueryOptions: () => validatePointCloudQueryOptions,
194
238
  validateRasterQueryOptions: () => validateRasterQueryOptions,
195
239
  validateRasterRegion: () => validateRasterRegion,
196
240
  validateTableQueryLimit: () => validateTableQueryLimit,
197
241
  validateTableQueryOptions: () => validateTableQueryOptions,
242
+ validateTableReference: () => validateTableReference,
198
243
  validateTileGrid: () => validateTileGrid,
199
244
  validateTileGridLimits: () => validateTileGridLimits,
200
245
  waitForPromiseWithSignal: () => waitForPromiseWithSignal,
@@ -248,18 +293,48 @@ var nodeVersion = matches && parseFloat(matches[1]) || 0;
248
293
 
249
294
  // dist/loader-utils/lib/log-utils/log.js
250
295
  var import_log = require("probe.gl/log");
251
- var VERSION = true ? "5.0.0-beta.1" : "latest";
296
+ var VERSION = true ? "5.0.0-beta.10" : "latest";
252
297
  var version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
253
298
  function createLog() {
254
- const log2 = new import_log.Log({ id: "loaders.gl" });
299
+ const log3 = new import_log.Log({ id: "loaders.gl" });
255
300
  globalThis.loaders ||= {};
256
- globalThis.loaders.log = log2;
301
+ globalThis.loaders.log = log3;
257
302
  globalThis.loaders.version = version;
258
303
  globalThis.probe ||= {};
259
- globalThis.probe.loaders = log2;
260
- return log2;
304
+ globalThis.probe.loaders = log3;
305
+ return log3;
261
306
  }
262
307
  var log = createLog();
308
+ var NullLog = class {
309
+ /** Discards debug messages. */
310
+ log() {
311
+ return ignoreMessage;
312
+ }
313
+ /** Discards informational messages. */
314
+ info() {
315
+ return ignoreMessage;
316
+ }
317
+ /** Discards messages marked to be emitted once. */
318
+ once() {
319
+ return ignoreMessage;
320
+ }
321
+ /** Discards warnings. */
322
+ warn() {
323
+ return ignoreMessage;
324
+ }
325
+ /** Discards errors. */
326
+ error() {
327
+ return ignoreMessage;
328
+ }
329
+ };
330
+ function ignoreMessage() {
331
+ }
332
+ var nullLog = new NullLog();
333
+ function getLoaderLog(options) {
334
+ var _a;
335
+ const logger = (_a = options == null ? void 0 : options.core) == null ? void 0 : _a.log;
336
+ return logger === null ? nullLog : logger || log;
337
+ }
263
338
 
264
339
  // dist/loader-utils/lib/javascript-utils/is-type.js
265
340
  var isBoolean = (value) => typeof value === "boolean";
@@ -368,15 +443,6 @@ var LOADERS_GL_RAW_FIXTURE_URL = `https://raw.githubusercontent.com/visgl/loader
368
443
  var LOADERS_GL_REDIRECTING_FIXTURE_URL = `https://github.com/visgl/loaders.gl/raw/${LOADERS_GL_FIXTURE_BRANCH}/`;
369
444
  var NPM_TAG = "beta";
370
445
 
371
- // src/worker-utils/lib/env-utils/version.ts
372
- function getVersion() {
373
- const version2 = typeof __VERSION__ === "undefined" ? NPM_TAG : __VERSION__;
374
- globalThis._loadersgl_ = globalThis._loadersgl_ || {};
375
- globalThis._loadersgl_.version ||= version2;
376
- return version2;
377
- }
378
- var VERSION2 = getVersion();
379
-
380
446
  // src/worker-utils/lib/env-utils/assert.ts
381
447
  function assert2(condition, message) {
382
448
  if (!condition) {
@@ -403,818 +469,51 @@ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "u
403
469
  var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
404
470
  var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
405
471
 
406
- // src/worker-utils/lib/worker-farm/worker-job.ts
407
- var WorkerJob = class {
408
- name;
409
- workerThread;
410
- isRunning = true;
411
- /** Promise that resolves when Job is done */
412
- result;
413
- _resolve = () => {
414
- };
415
- _reject = () => {
416
- };
417
- constructor(jobName, workerThread) {
418
- this.name = jobName;
419
- this.workerThread = workerThread;
420
- this.result = new Promise((resolve2, reject) => {
421
- this._resolve = resolve2;
422
- this._reject = reject;
423
- });
424
- }
425
- /**
426
- * Send a message to the job's worker thread
427
- * @param data any data structure, ideally consisting mostly of transferrable objects
428
- */
429
- postMessage(type, payload) {
430
- if (!this.isRunning) return;
431
- this.workerThread.postMessage({
432
- source: "loaders.gl",
433
- // Lets worker ignore unrelated messages
434
- type,
435
- payload
436
- });
437
- }
438
- /**
439
- * Call to resolve the `result` Promise with the supplied value
440
- */
441
- done(value) {
442
- if (!this.isRunning) {
443
- return;
444
- }
445
- this.isRunning = false;
446
- this._resolve(value);
447
- }
448
- /**
449
- * Call to reject the `result` Promise with the supplied error
450
- */
451
- error(error) {
452
- if (!this.isRunning) {
453
- return;
454
- }
455
- this.isRunning = false;
456
- this._reject(error);
457
- }
458
- /**
459
- * Terminates the worker executing this job and rejects its result.
460
- * @param reason Abort reason supplied by the caller, or a cross-runtime `AbortError`.
461
- */
462
- abort(reason) {
463
- if (!this.isRunning) {
464
- return;
465
- }
466
- this.workerThread.destroy();
467
- this.error(
468
- arguments.length ? reason : createAbortError(`Worker job "${this.name}" was aborted`)
469
- );
470
- }
471
- };
472
- function createAbortError(message) {
473
- const error = new Error(message);
474
- error.name = "AbortError";
475
- return error;
476
- }
477
-
478
- // src/worker-utils/lib/node/worker_threads-browser.ts
479
- var NodeWorker = class {
480
- /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
481
- constructor(...arguments_) {
482
- var _a;
483
- const runtimeProcess = globalThis.process;
484
- const WorkerConstructor = (_a = runtimeProcess == null ? void 0 : runtimeProcess.getBuiltinModule) == null ? void 0 : _a.call(runtimeProcess, "node:worker_threads").Worker;
485
- if (WorkerConstructor) {
486
- return new WorkerConstructor(...arguments_);
487
- }
488
- }
489
- /** No-op browser fallback matching the native Worker API. */
490
- terminate() {
491
- }
492
- };
493
- var parentPort = null;
494
-
495
- // src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts
496
- var workerURLCache = /* @__PURE__ */ new Map();
497
- function getLoadableWorkerURL(props) {
498
- assert2(props.source && !props.url || !props.source && props.url);
499
- let workerURL = workerURLCache.get(props.source || props.url);
500
- if (!workerURL) {
501
- if (props.url) {
502
- workerURL = getLoadableWorkerURLFromURL(props.url);
503
- workerURLCache.set(props.url, workerURL);
504
- }
505
- if (props.source) {
506
- workerURL = getLoadableWorkerURLFromSource(props.source);
507
- workerURLCache.set(props.source, workerURL);
508
- }
509
- }
510
- assert2(workerURL);
511
- return workerURL;
512
- }
513
- function getLoadableWorkerURLFromURL(url) {
514
- if (!url.startsWith("http")) {
515
- return url;
516
- }
517
- const workerSource = buildScriptSource(url);
518
- return getLoadableWorkerURLFromSource(workerSource);
519
- }
520
- function getLoadableWorkerURLFromSource(workerSource) {
521
- const blob = new Blob([workerSource], { type: "application/javascript" });
522
- return URL.createObjectURL(blob);
523
- }
524
- function buildScriptSource(workerUrl) {
525
- return `try {
526
- importScripts('${workerUrl}');
527
- } catch (error) {
528
- console.error(error);
529
- throw error;
530
- }`;
531
- }
532
-
533
- // src/worker-utils/lib/worker-utils/get-transfer-list.ts
534
- function getTransferList(object, recursive = true, transfers) {
535
- const transfersSet = transfers || /* @__PURE__ */ new Set();
536
- if (!object) {
537
- } else if (isTransferable(object)) {
538
- transfersSet.add(object);
539
- } else if (isTransferable(object.buffer)) {
540
- transfersSet.add(object.buffer);
541
- } else if (ArrayBuffer.isView(object)) {
542
- } else if (recursive && typeof object === "object") {
543
- for (const key in object) {
544
- getTransferList(object[key], recursive, transfersSet);
545
- }
546
- }
547
- return transfers === void 0 ? Array.from(transfersSet) : [];
548
- }
549
- function isTransferable(object) {
550
- if (!object) {
551
- return false;
552
- }
553
- if (object instanceof ArrayBuffer) {
554
- return true;
555
- }
556
- if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
557
- return true;
558
- }
559
- if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
560
- return true;
561
- }
562
- if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
563
- return true;
564
- }
565
- return false;
566
- }
567
- function getTransferListForWriter(object) {
568
- if (object === null) {
569
- return {};
570
- }
571
- const clone = Object.assign({}, object);
572
- Object.keys(clone).forEach((key) => {
573
- if (typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
574
- clone[key] = getTransferListForWriter(object[key]);
575
- } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
576
- clone[key] = {};
577
- } else {
578
- clone[key] = object[key];
579
- }
580
- });
581
- return clone;
582
- }
583
-
584
- // src/worker-utils/lib/worker-farm/worker-thread.ts
585
- var NOOP = () => {
586
- };
587
- var WorkerThread = class {
588
- name;
589
- source;
590
- url;
591
- /** Lazily resolves the classic worker URL used as a fallback. */
592
- getUrl;
593
- /** Creates a browser Worker directly. */
594
- loadWorker;
595
- terminated = false;
596
- worker;
597
- onMessage;
598
- onError;
599
- _loadableURL = "";
600
- /** Checks if workers are supported on this platform */
601
- static isSupported() {
602
- return typeof Worker !== "undefined" && isBrowser2 || typeof NodeWorker !== "undefined" && !isBrowser2;
603
- }
604
- constructor(props) {
605
- const { name, source, url, getUrl, loadWorker } = props;
606
- assert2(source || url || getUrl || loadWorker);
607
- this.name = name;
608
- this.source = source;
609
- this.url = url;
610
- this.getUrl = getUrl;
611
- this.loadWorker = loadWorker;
612
- this.onMessage = NOOP;
613
- this.onError = (error) => console.log(error);
614
- this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
615
- }
616
- /**
617
- * Terminate this worker thread
618
- * @note Can free up significant memory
619
- */
620
- destroy() {
621
- this.onMessage = NOOP;
622
- this.onError = NOOP;
623
- this.worker.terminate();
624
- this.terminated = true;
625
- }
626
- /** Keeps this worker from preventing Node.js process exit while idle. */
627
- unref() {
628
- if (!isBrowser2 && typeof this.worker.unref === "function") {
629
- this.worker.unref();
630
- }
631
- }
632
- /** Keeps this worker alive while it is actively processing a job. */
633
- ref() {
634
- if (!isBrowser2 && typeof this.worker.ref === "function") {
635
- this.worker.ref();
636
- }
637
- }
638
- get isRunning() {
639
- return Boolean(this.onMessage);
640
- }
641
- /**
642
- * Send a message to this worker thread
643
- * @param data any data structure, ideally consisting mostly of transferrable objects
644
- * @param transferList If not supplied, calculated automatically by traversing data
645
- */
646
- postMessage(data, transferList) {
647
- transferList = transferList || getTransferList(data);
648
- this.worker.postMessage(data, transferList);
649
- }
650
- // PRIVATE
651
- /**
652
- * Generate a standard Error from an ErrorEvent
653
- * @param event
654
- */
655
- _getErrorFromErrorEvent(event) {
656
- let message = "Failed to load ";
657
- message += `worker ${this.name} from ${this.url || "built-in worker factory"}. `;
658
- if (event.message) {
659
- message += `${event.message} in `;
660
- }
661
- if (event.lineno) {
662
- message += `:${event.lineno}:${event.colno}`;
663
- }
664
- return new Error(message);
665
- }
666
- /**
667
- * Creates a worker thread on the browser
668
- */
669
- _createBrowserWorker() {
670
- var _a;
671
- if (this.loadWorker) {
672
- try {
673
- const worker2 = this.loadWorker();
674
- if (worker2) {
675
- return this._initializeBrowserWorker(worker2);
676
- }
677
- } catch (error) {
678
- if (!this.source && !this.url && !this.getUrl) {
679
- throw error;
680
- }
681
- }
682
- }
683
- const url = this.url || ((_a = this.getUrl) == null ? void 0 : _a.call(this));
684
- this._loadableURL = getLoadableWorkerURL({ source: this.source, url });
685
- const worker = new Worker(this._loadableURL, { name: this.name });
686
- return this._initializeBrowserWorker(worker);
687
- }
688
- /** Attaches protocol handlers to a browser worker. */
689
- _initializeBrowserWorker(worker) {
690
- worker.onmessage = (event) => {
691
- if (!event.data) {
692
- this.onError(new Error("No data received"));
693
- } else {
694
- this.onMessage(event.data);
695
- }
696
- };
697
- worker.onerror = (error) => {
698
- this.onError(this._getErrorFromErrorEvent(error));
699
- this.terminated = true;
700
- };
701
- worker.onmessageerror = (event) => console.error(event);
702
- return worker;
703
- }
704
- /**
705
- * Creates a worker thread in node.js
706
- * @todo https://nodejs.org/api/async_hooks.html#async-resource-worker-pool
707
- */
708
- _createNodeWorker() {
709
- let worker;
710
- if (this.url) {
711
- const absolute = this.url.includes(":/") || this.url.startsWith("/");
712
- const url = absolute ? this.url : `./${this.url}`;
713
- const workerUrl = url.startsWith("file:") ? new URL(url) : url;
714
- const type = this.url.endsWith(".ts") || this.url.endsWith(".mjs") ? "module" : "commonjs";
715
- worker = new NodeWorker(workerUrl, { eval: false, type });
716
- } else if (this.source) {
717
- worker = new NodeWorker(this.source, { eval: true });
718
- } else {
719
- throw new Error("no worker");
720
- }
721
- worker.on("message", (data) => {
722
- this.onMessage(data);
723
- });
724
- worker.on("error", (error) => {
725
- this.onError(error);
726
- });
727
- worker.on("exit", (_code) => {
728
- });
729
- return worker;
730
- }
731
- };
732
-
733
- // src/worker-utils/lib/worker-farm/worker-pool.ts
734
- var WorkerPool = class {
735
- name = "unnamed";
736
- source;
737
- // | Function;
738
- url;
739
- /** Lazily resolves a classic worker fallback URL. */
740
- getUrl;
741
- /** Creates a browser Worker directly. */
742
- loadWorker;
743
- maxConcurrency = 1;
744
- maxMobileConcurrency = 1;
745
- onDebug = () => {
746
- };
747
- reuseWorkers = true;
748
- props = {};
749
- jobQueue = [];
750
- idleQueue = [];
751
- activeJobs = /* @__PURE__ */ new Set();
752
- count = 0;
753
- isDestroyed = false;
754
- /** Checks if workers are supported on this platform */
755
- static isSupported() {
756
- return WorkerThread.isSupported();
757
- }
758
- /**
759
- * @param processor - worker function
760
- * @param maxConcurrency - max count of workers
761
- */
762
- constructor(props) {
763
- this.source = props.source;
764
- this.url = props.url;
765
- this.getUrl = props.getUrl;
766
- this.loadWorker = props.loadWorker;
767
- this.setProps(props);
768
- }
769
- /**
770
- * Terminates all workers in the pool and aborts active jobs.
771
- * @param reason Optional error delivered to active jobs.
772
- * @note Can free up significant memory
773
- */
774
- destroy(reason = new Error("Worker pool was destroyed")) {
775
- this.isDestroyed = true;
776
- this.activeJobs.forEach((job) => job.abort(reason));
777
- const queuedJobs = this.jobQueue.splice(0);
778
- queuedJobs.forEach((queuedJob) => {
779
- queuedJob.removeAbortListener();
780
- queuedJob.onReject(reason);
781
- });
782
- this.idleQueue.forEach((worker) => worker.destroy());
783
- this.isDestroyed = true;
784
- }
785
- setProps(props) {
786
- this.props = { ...this.props, ...props };
787
- if (props.name !== void 0) {
788
- this.name = props.name;
789
- }
790
- if (props.maxConcurrency !== void 0) {
791
- this.maxConcurrency = props.maxConcurrency;
792
- }
793
- if (props.maxMobileConcurrency !== void 0) {
794
- this.maxMobileConcurrency = props.maxMobileConcurrency;
795
- }
796
- if (props.reuseWorkers !== void 0) {
797
- this.reuseWorkers = props.reuseWorkers;
798
- }
799
- if (props.onDebug !== void 0) {
800
- this.onDebug = props.onDebug;
801
- }
802
- }
803
- async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error), signal) {
804
- if (signal == null ? void 0 : signal.aborted) {
805
- throw signal.reason;
806
- }
807
- if (this.isDestroyed) {
808
- return Promise.reject(new Error("Worker pool was destroyed"));
809
- }
810
- const startPromise = new Promise((onStart, onReject) => {
811
- const abortQueuedJob = () => {
812
- const index = this.jobQueue.indexOf(queuedJob);
813
- if (index >= 0) {
814
- this.jobQueue.splice(index, 1);
815
- queuedJob.removeAbortListener();
816
- onReject(signal == null ? void 0 : signal.reason);
817
- }
818
- };
819
- const queuedJob = {
820
- name,
821
- onMessage: onMessage2,
822
- onError,
823
- onStart,
824
- onReject,
825
- signal,
826
- removeAbortListener: () => signal == null ? void 0 : signal.removeEventListener("abort", abortQueuedJob)
827
- };
828
- this.jobQueue.push(queuedJob);
829
- signal == null ? void 0 : signal.addEventListener("abort", abortQueuedJob, { once: true });
830
- return this;
831
- });
832
- this._startQueuedJob();
833
- return await startPromise;
834
- }
835
- // PRIVATE
836
- /**
837
- * Starts first queued job if worker is available or can be created
838
- * Called when job is started and whenever a worker returns to the idleQueue
839
- */
840
- async _startQueuedJob() {
841
- var _a, _b, _c;
842
- if (!this.jobQueue.length) {
843
- return;
844
- }
845
- let workerThread;
846
- try {
847
- workerThread = this._getAvailableWorker();
848
- } catch (error) {
849
- const queuedJob2 = this.jobQueue.shift();
850
- queuedJob2 == null ? void 0 : queuedJob2.removeAbortListener();
851
- queuedJob2 == null ? void 0 : queuedJob2.onReject(error);
852
- void this._startQueuedJob();
853
- return;
854
- }
855
- if (!workerThread) {
856
- return;
857
- }
858
- const queuedJob = this.jobQueue.shift();
859
- if (queuedJob) {
860
- this.onDebug({
861
- message: "Starting job",
862
- name: queuedJob.name,
863
- workerThread,
864
- backlog: this.jobQueue.length
865
- });
866
- const job = new WorkerJob(queuedJob.name, workerThread);
867
- queuedJob.removeAbortListener();
868
- const abortJob = () => {
869
- var _a2;
870
- return job.abort((_a2 = queuedJob.signal) == null ? void 0 : _a2.reason);
871
- };
872
- (_a = queuedJob.signal) == null ? void 0 : _a.addEventListener("abort", abortJob, { once: true });
873
- if ((_b = queuedJob.signal) == null ? void 0 : _b.aborted) abortJob();
874
- this.activeJobs.add(job);
875
- workerThread.ref();
876
- workerThread.onMessage = (data) => {
877
- if (job.isRunning) queuedJob.onMessage(job, data.type, data.payload);
878
- };
879
- workerThread.onError = (error) => queuedJob.onError(job, error);
880
- queuedJob.onStart(job);
881
- try {
882
- await job.result;
883
- } catch {
884
- } finally {
885
- (_c = queuedJob.signal) == null ? void 0 : _c.removeEventListener("abort", abortJob);
886
- this.activeJobs.delete(job);
887
- this.returnWorkerToQueue(workerThread);
888
- }
889
- } else {
890
- this.returnWorkerToQueue(workerThread);
891
- }
892
- }
893
- /**
894
- * Returns a worker to the idle queue
895
- * Destroys the worker if
896
- * - pool is destroyed
897
- * - if this pool doesn't reuse workers
898
- * - if maxConcurrency has been lowered
899
- * @param worker
900
- */
901
- returnWorkerToQueue(worker) {
902
- const shouldDestroyWorker = (
903
- // Aborted jobs terminate their worker immediately.
904
- worker.terminated || // If the pool is destroyed, there is no reason to keep the worker around
905
- this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
906
- !this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
907
- this.count > this._getMaxConcurrency()
908
- );
909
- if (shouldDestroyWorker) {
910
- if (!worker.terminated) {
911
- worker.destroy();
912
- }
913
- this.count--;
914
- } else {
915
- worker.unref();
916
- this.idleQueue.push(worker);
917
- }
918
- if (!this.isDestroyed) {
919
- this._startQueuedJob();
920
- }
921
- }
922
- /**
923
- * Returns idle worker or creates new worker if maxConcurrency has not been reached
924
- */
925
- _getAvailableWorker() {
926
- if (this.idleQueue.length > 0) {
927
- return this.idleQueue.shift() || null;
928
- }
929
- if (this.count < this._getMaxConcurrency()) {
930
- this.count++;
931
- const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
932
- try {
933
- return new WorkerThread({
934
- name,
935
- source: this.source,
936
- url: this.url,
937
- getUrl: this.getUrl,
938
- loadWorker: this.loadWorker
939
- });
940
- } catch (error) {
941
- this.count--;
942
- throw error;
943
- }
944
- }
945
- return null;
946
- }
947
- _getMaxConcurrency() {
948
- return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
949
- }
950
- };
472
+ // src/worker-utils/lib/worker-api/process-on-worker.ts
473
+ var import_tasks2 = require("@math.gl/tasks");
951
474
 
952
- // src/worker-utils/lib/worker-farm/worker-farm.ts
953
- var DEFAULT_PROPS = {
954
- maxConcurrency: 3,
955
- maxMobileConcurrency: 1,
956
- reuseWorkers: true,
957
- onDebug: () => {
958
- }
959
- };
960
- var loadWorkerIds = /* @__PURE__ */ new WeakMap();
961
- var nextLoadWorkerId = 1;
962
- var WorkerFarm = class _WorkerFarm {
963
- props;
964
- workerPools = /* @__PURE__ */ new Map();
965
- // singleton
966
- static _workerFarm;
967
- /** Checks if workers are supported on this platform */
968
- static isSupported() {
969
- return WorkerThread.isSupported();
970
- }
971
- /** Get the singleton instance of the global worker farm */
972
- static getWorkerFarm(props = {}) {
973
- _WorkerFarm._workerFarm = _WorkerFarm._workerFarm || new _WorkerFarm({});
974
- _WorkerFarm._workerFarm.setProps(props);
975
- return _WorkerFarm._workerFarm;
976
- }
977
- /** get global instance with WorkerFarm.getWorkerFarm() */
978
- constructor(props) {
979
- this.props = { ...DEFAULT_PROPS };
980
- this.setProps(props);
981
- this.workerPools = /* @__PURE__ */ new Map();
982
- }
983
- /**
984
- * Terminate all workers in the farm and abort active jobs.
985
- * @param reason Optional error delivered to active jobs.
986
- * @note Can free up significant memory
987
- */
988
- destroy(reason) {
989
- for (const workerPool of this.workerPools.values()) {
990
- workerPool.destroy(reason);
991
- }
992
- this.workerPools = /* @__PURE__ */ new Map();
993
- }
994
- /**
995
- * Set props used when initializing worker pools
996
- * @param props
997
- */
998
- setProps(props) {
999
- this.props = { ...this.props, ...props };
1000
- for (const workerPool of this.workerPools.values()) {
1001
- workerPool.setProps(this._getWorkerPoolProps());
1002
- }
1003
- }
1004
- /**
1005
- * Returns a worker pool for the specified worker
1006
- * @param options Worker target used to identify and initialize the pool.
1007
- * @param options.name Worker name used as the base pool identity.
1008
- * @param options.url Worker script URL.
1009
- * @param options.source Inline worker source.
1010
- * @param options.loadWorker Built-in browser worker factory.
1011
- * @example
1012
- * const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
1013
- */
1014
- getWorkerPool(options) {
1015
- const { name, source, url, getUrl, loadWorker } = options;
1016
- const workerPoolKey = getWorkerPoolKey(options);
1017
- let workerPool = this.workerPools.get(workerPoolKey);
1018
- if (!workerPool) {
1019
- workerPool = new WorkerPool({
1020
- name,
1021
- source,
1022
- url,
1023
- getUrl,
1024
- loadWorker
1025
- });
1026
- workerPool.setProps(this._getWorkerPoolProps());
1027
- this.workerPools.set(workerPoolKey, workerPool);
1028
- }
1029
- return workerPool;
1030
- }
1031
- _getWorkerPoolProps() {
1032
- return {
1033
- maxConcurrency: this.props.maxConcurrency,
1034
- maxMobileConcurrency: this.props.maxMobileConcurrency,
1035
- reuseWorkers: this.props.reuseWorkers,
1036
- onDebug: this.props.onDebug
1037
- };
1038
- }
1039
- };
1040
- function getWorkerPoolKey(options) {
1041
- const { name, source, url, urlKey, loadWorker } = options;
1042
- const sourceKey = source ? `source:${source}` : "";
1043
- const urlKeyPart = url || urlKey ? `url:${url || urlKey}` : "";
1044
- const loadWorkerKey = loadWorker ? `loadWorker:${getLoadWorkerId(loadWorker)}` : "";
1045
- return [name, sourceKey, urlKeyPart, loadWorkerKey].filter(Boolean).join("|");
475
+ // src/loader-utils/lib/log-utils/log.ts
476
+ var import_log3 = require("probe.gl/log");
477
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
478
+ var version2 = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
479
+ function createLog2() {
480
+ const log3 = new import_log3.Log({ id: "loaders.gl" });
481
+ globalThis.loaders ||= {};
482
+ globalThis.loaders.log = log3;
483
+ globalThis.loaders.version = version2;
484
+ globalThis.probe ||= {};
485
+ globalThis.probe.loaders = log3;
486
+ return log3;
1046
487
  }
1047
- function getLoadWorkerId(loadWorker) {
1048
- let loadWorkerId = loadWorkerIds.get(loadWorker);
1049
- if (!loadWorkerId) {
1050
- loadWorkerId = nextLoadWorkerId++;
1051
- loadWorkerIds.set(loadWorker, loadWorkerId);
488
+ var log2 = createLog2();
489
+ var NullLog2 = class {
490
+ /** Discards debug messages. */
491
+ log() {
492
+ return ignoreMessage2;
1052
493
  }
1053
- return loadWorkerId;
1054
- }
1055
-
1056
- // src/worker-utils/lib/worker-farm/worker-body.ts
1057
- async function getParentPort() {
1058
- return parentPort;
1059
- }
1060
- var onMessageWrapperMap = /* @__PURE__ */ new Map();
1061
- var WorkerBody = class {
1062
- /** Check that we are actually in a worker thread */
1063
- static async inWorkerThread() {
1064
- return typeof self !== "undefined" || Boolean(await getParentPort());
1065
- }
1066
- /*
1067
- * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
1068
- */
1069
- static set onmessage(onMessage2) {
1070
- async function handleMessage(message) {
1071
- const parentPort2 = await getParentPort();
1072
- const { type, payload } = parentPort2 ? message : message.data;
1073
- onMessage2(type, payload);
1074
- }
1075
- getParentPort().then((parentPort2) => {
1076
- if (parentPort2) {
1077
- parentPort2.on("message", (message) => {
1078
- handleMessage(message);
1079
- });
1080
- parentPort2.on("exit", () => console.debug("Node worker closing"));
1081
- } else {
1082
- globalThis.onmessage = handleMessage;
1083
- }
1084
- });
494
+ /** Discards informational messages. */
495
+ info() {
496
+ return ignoreMessage2;
1085
497
  }
1086
- static async addEventListener(onMessage2) {
1087
- let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
1088
- if (!onMessageWrapper) {
1089
- onMessageWrapper = (message) => {
1090
- const messageData = getWorkerMessageData(message);
1091
- if (!messageData) {
1092
- return;
1093
- }
1094
- onMessage2(messageData.type, messageData.payload);
1095
- };
1096
- onMessageWrapperMap.set(onMessage2, onMessageWrapper);
1097
- }
1098
- const parentPort2 = await getParentPort();
1099
- if (parentPort2) {
1100
- parentPort2.on("message", onMessageWrapper);
1101
- } else {
1102
- globalThis.addEventListener("message", onMessageWrapper);
1103
- }
498
+ /** Discards messages marked to be emitted once. */
499
+ once() {
500
+ return ignoreMessage2;
1104
501
  }
1105
- static async removeEventListener(onMessage2) {
1106
- const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
1107
- onMessageWrapperMap.delete(onMessage2);
1108
- if (!onMessageWrapper) {
1109
- return;
1110
- }
1111
- const parentPort2 = await getParentPort();
1112
- if (parentPort2) {
1113
- parentPort2.off("message", onMessageWrapper);
1114
- } else {
1115
- globalThis.removeEventListener("message", onMessageWrapper);
1116
- }
502
+ /** Discards warnings. */
503
+ warn() {
504
+ return ignoreMessage2;
1117
505
  }
1118
- /**
1119
- * Send a message from a worker to creating thread (main thread)
1120
- * @param type
1121
- * @param payload
1122
- */
1123
- static async postMessage(type, payload) {
1124
- const data = { source: "loaders.gl", type, payload };
1125
- const transferList = getTransferList(payload);
1126
- const parentPort2 = await getParentPort();
1127
- if (parentPort2) {
1128
- parentPort2.postMessage(data, transferList);
1129
- } else {
1130
- globalThis.postMessage(data, transferList);
1131
- }
506
+ /** Discards errors. */
507
+ error() {
508
+ return ignoreMessage2;
1132
509
  }
1133
510
  };
1134
- function getWorkerMessageData(message) {
1135
- if (!message || typeof message !== "object") {
1136
- return null;
1137
- }
1138
- const messageData = "data" in message && message.type === "message" ? message.data : message;
1139
- return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
511
+ function ignoreMessage2() {
1140
512
  }
1141
-
1142
- // src/worker-utils/lib/async-queue/async-queue.ts
1143
- var AsyncQueue = class {
1144
- _values;
1145
- _settlers;
1146
- _closed;
1147
- constructor() {
1148
- this._values = [];
1149
- this._settlers = [];
1150
- this._closed = false;
1151
- }
1152
- /** Return an async iterator for this queue */
1153
- [Symbol.asyncIterator]() {
1154
- return this;
1155
- }
1156
- /** Push a new value - the async iterator will yield a promise resolved to this value */
1157
- push(value) {
1158
- return this.enqueue(value);
1159
- }
1160
- /**
1161
- * Push a new value - the async iterator will yield a promise resolved to this value
1162
- * Add an error - the async iterator will yield a promise rejected with this value
1163
- */
1164
- enqueue(value) {
1165
- if (this._closed) {
1166
- throw new Error("Closed");
1167
- }
1168
- if (this._settlers.length > 0) {
1169
- if (this._values.length > 0) {
1170
- throw new Error("Illegal internal state");
1171
- }
1172
- const settler = this._settlers.shift();
1173
- if (value instanceof Error) {
1174
- settler.reject(value);
1175
- } else {
1176
- settler.resolve({ value });
1177
- }
1178
- } else {
1179
- this._values.push(value);
1180
- }
1181
- }
1182
- /** Indicate that we not waiting for more values - The async iterator will be done */
1183
- close() {
1184
- while (this._settlers.length > 0) {
1185
- const settler = this._settlers.shift();
1186
- settler.resolve({ done: true });
1187
- }
1188
- this._closed = true;
1189
- }
1190
- // ITERATOR IMPLEMENTATION
1191
- /** @returns a Promise for an IteratorResult */
1192
- next() {
1193
- if (this._values.length > 0) {
1194
- const value = this._values.shift();
1195
- if (value instanceof Error) {
1196
- return Promise.reject(value);
1197
- }
1198
- return Promise.resolve({ done: false, value });
1199
- }
1200
- if (this._closed) {
1201
- if (this._settlers.length > 0) {
1202
- throw new Error("Illegal internal state");
1203
- }
1204
- return Promise.resolve({ done: true, value: void 0 });
1205
- }
1206
- return new Promise((resolve2, reject) => {
1207
- this._settlers.push({ resolve: resolve2, reject });
1208
- });
1209
- }
1210
- };
513
+ var nullLog2 = new NullLog2();
1211
514
 
1212
515
  // src/worker-utils/lib/worker-api/get-worker-url.ts
1213
516
  var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
1214
- function getWorkerName(worker) {
1215
- const warning = worker.version !== VERSION2 ? ` (worker-utils@${VERSION2})` : "";
1216
- return `${worker.name}@${worker.version}${warning}`;
1217
- }
1218
517
  function getCustomWorkerURL(worker, options = {}) {
1219
518
  var _a, _b;
1220
519
  const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
@@ -1244,11 +543,11 @@ function getWorkerURL(worker, options = {}) {
1244
543
  }
1245
544
  function getDefaultWorkerURL(worker, warn = false) {
1246
545
  const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
1247
- let version2 = worker.version;
1248
- if (version2 === "latest") {
1249
- version2 = NPM_TAG;
546
+ let version3 = worker.version;
547
+ if (version3 === "latest") {
548
+ version3 = NPM_TAG;
1250
549
  }
1251
- const versionTag = version2 ? `@${version2}` : "";
550
+ const versionTag = version3 ? `@${version3}` : "";
1252
551
  const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
1253
552
  if (warn) {
1254
553
  warnIfUsingNpmTagFallback(worker, url);
@@ -1264,417 +563,373 @@ function warnIfUsingNpmTagFallback(worker, url) {
1264
563
  return;
1265
564
  }
1266
565
  warnedWorkerVersionFallbacks.add(workerId);
1267
- console.warn(
566
+ log2.warn(
1268
567
  `loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
1269
- );
568
+ )();
1270
569
  }
1271
570
 
1272
- // src/worker-utils/lib/worker-api/process-on-worker.ts
1273
- function canProcessOnWorker(worker, options) {
1274
- if (!WorkerFarm.isSupported()) {
1275
- return false;
1276
- }
1277
- const workerOptions = options == null ? void 0 : options[worker.id];
1278
- return Boolean(
1279
- (worker.worker || worker.loadWorker || (workerOptions == null ? void 0 : workerOptions.workerUrl)) && (options == null ? void 0 : options.worker)
1280
- );
571
+ // src/worker-utils/lib/worker-api/task-runtime.ts
572
+ var import_tasks = require("@math.gl/tasks");
573
+ function normalizeTaskProgress(progress) {
574
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
1281
575
  }
1282
- function canProcessOnWorkerInBatches(worker, options = {}) {
1283
- if (!canProcessOnWorker(worker, options)) return false;
1284
- if (options.workerInBatches !== void 0) return options.workerInBatches;
1285
- return Boolean(
1286
- worker.workerInBatches && !options.source && !getConfiguredWorkerURL(worker, options)
1287
- );
1288
- }
1289
- async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
576
+ async function isWorkerThread() {
1290
577
  var _a;
1291
- throwIfAborted(options.signal);
1292
- const name = getWorkerName(worker);
1293
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1294
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1295
- const jobName = options.jobName || worker.name;
1296
- const job = await workerPool.startJob(
1297
- jobName,
1298
- // eslint-disable-next-line
1299
- onMessage.bind(null, context, options),
1300
- void 0,
1301
- options.signal
1302
- );
1303
- try {
1304
- if ((_a = options.signal) == null ? void 0 : _a.aborted) job.abort(getAbortReason(options.signal));
1305
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1306
- const transferableOptions = getTransferListForWriter(workerOptions);
1307
- const transferableContext = getTransferListForWriter(jobContext);
1308
- if (job.isRunning) {
1309
- job.postMessage("process", {
1310
- input: data,
1311
- options: transferableOptions,
1312
- context: transferableContext
1313
- });
1314
- }
1315
- const result = await job.result;
1316
- return result.result;
1317
- } catch (error) {
1318
- job.abort(error);
1319
- throw error;
578
+ if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
579
+ return true;
580
+ if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
581
+ const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser(), worker_threads_browser_exports));
582
+ return !isMainThread;
1320
583
  }
584
+ return false;
1321
585
  }
1322
- function processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
1323
- return processOnWorkerInBatchesIterator(worker, input, options, context, jobContext);
1324
- }
1325
- async function* processOnWorkerInBatchesIterator(worker, input, options, context, jobContext) {
1326
- throwIfAborted(options.signal);
1327
- const name = getWorkerName(worker);
1328
- const workerFarm = WorkerFarm.getWorkerFarm(options);
1329
- const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
1330
- const outputBatches = new AsyncQueue();
1331
- const inputIterator = getAsyncIterator(input);
1332
- let outputFinished = false;
1333
- let inputFinished = false;
1334
- let inputCleanupRequested = false;
1335
- let inputRequest = Promise.resolve();
1336
- const batchJobFailed = new Error("Worker batch job failed");
1337
- const closeJobInput = () => {
1338
- if (!inputFinished && !inputCleanupRequested) {
1339
- inputCleanupRequested = true;
1340
- closeInputIterator(inputIterator);
1341
- }
1342
- };
1343
- const finishOutput = () => {
1344
- if (!outputFinished) {
1345
- outputFinished = true;
1346
- outputBatches.close();
1347
- }
1348
- };
1349
- const failOutput = (_error) => {
1350
- if (!outputFinished) {
1351
- outputFinished = true;
1352
- outputBatches.enqueue(batchJobFailed);
1353
- outputBatches.close();
1354
- }
1355
- };
1356
- const job = await workerPool.startJob(
1357
- options.jobName || worker.name,
1358
- (activeJob, type, payload) => {
1359
- switch (type) {
1360
- case "progress":
1361
- reportProgress(activeJob, options, payload);
1362
- break;
1363
- case "input-request":
1364
- inputRequest = inputRequest.then(async () => {
1365
- if (!activeJob.isRunning) return;
1366
- const nextBatch = await inputIterator.next();
1367
- if (!activeJob.isRunning) {
1368
- return;
1369
- }
1370
- if (nextBatch.done) {
1371
- inputFinished = true;
1372
- activeJob.postMessage("input-done", {});
1373
- } else {
1374
- activeJob.postMessage("input-batch", { input: nextBatch.value });
1375
- }
1376
- }).catch((error) => activeJob.abort(error));
1377
- break;
1378
- case "output-batch":
1379
- outputBatches.push(payload.result);
1380
- break;
1381
- case "done":
1382
- activeJob.done(payload);
1383
- finishOutput();
1384
- break;
1385
- case "error": {
1386
- const error = new Error(payload.error || "Worker batch processing failed");
1387
- activeJob.error(error);
1388
- failOutput(error);
1389
- break;
1390
- }
1391
- case "process":
1392
- void onMessage(context, options, activeJob, type, payload);
1393
- break;
1394
- default: {
1395
- const error = new Error(`Unexpected worker batch message: ${type}`);
1396
- activeJob.error(error);
1397
- failOutput(error);
1398
- break;
1399
- }
1400
- }
1401
- },
1402
- void 0,
1403
- options.signal
1404
- ).catch((error) => {
1405
- closeJobInput();
1406
- throw error;
1407
- });
1408
- void job.result.catch((error) => {
1409
- failOutput(error);
1410
- closeJobInput();
1411
- });
1412
- try {
1413
- const { signal: _signal, onProgress: _onProgress, ...workerOptions } = options;
1414
- if (job.isRunning) {
1415
- job.postMessage("process-in-batches", {
1416
- options: getTransferListForWriter(workerOptions),
1417
- context: getTransferListForWriter(jobContext)
1418
- });
1419
- }
1420
- try {
1421
- for await (const outputBatch of outputBatches) {
1422
- yield outputBatch;
1423
- if (job.isRunning) {
1424
- job.postMessage("output-ack", {});
1425
- }
1426
- }
1427
- } catch (error) {
1428
- if (error === batchJobFailed) {
1429
- await job.result;
1430
- }
1431
- throw error;
1432
- }
1433
- await job.result;
1434
- } finally {
1435
- if (job.isRunning) {
1436
- job.abort(createAbortError2("Worker batch iterator was closed"));
586
+ var initializeTaskWorker = import_tasks.initializeTaskWorker;
587
+
588
+ // src/worker-utils/lib/worker-utils/get-transfer-list.ts
589
+ function getTransferList(object, recursive = true, transfers) {
590
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
591
+ if (!object) {
592
+ } else if (isTransferable(object)) {
593
+ transfersSet.add(object);
594
+ } else if (isTransferable(object.buffer)) {
595
+ transfersSet.add(object.buffer);
596
+ } else if (ArrayBuffer.isView(object)) {
597
+ } else if (recursive && typeof object === "object") {
598
+ for (const key in object) {
599
+ getTransferList(object[key], recursive, transfersSet);
1437
600
  }
1438
- closeJobInput();
1439
601
  }
602
+ return transfers === void 0 ? Array.from(transfersSet) : [];
603
+ }
604
+ function isTransferable(object) {
605
+ if (!object) {
606
+ return false;
607
+ }
608
+ if (object instanceof ArrayBuffer) {
609
+ return true;
610
+ }
611
+ if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
612
+ return true;
613
+ }
614
+ if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
615
+ return true;
616
+ }
617
+ if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
618
+ return true;
619
+ }
620
+ return false;
1440
621
  }
1441
- function throwIfAborted(signal) {
1442
- if (!(signal == null ? void 0 : signal.aborted)) {
1443
- return;
622
+ function getTransferListForWriter(object) {
623
+ if (object === null) {
624
+ return {};
1444
625
  }
1445
- throw getAbortReason(signal);
626
+ const clone = Object.assign({}, object);
627
+ Object.keys(clone).forEach((key) => {
628
+ if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
629
+ clone[key] = getTransferListForWriter(object[key]);
630
+ } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
631
+ clone[key] = {};
632
+ } else {
633
+ clone[key] = object[key];
634
+ }
635
+ });
636
+ return clone;
1446
637
  }
1447
- function getAbortReason(signal) {
1448
- return signal ? signal.reason : createAbortError2("Worker job was aborted");
638
+
639
+ // src/worker-utils/lib/worker-api/process-on-worker.ts
640
+ var runners = /* @__PURE__ */ new WeakMap();
641
+ var activeRunners = /* @__PURE__ */ new Set();
642
+ var moduleWorkerUrls = /* @__PURE__ */ new Map();
643
+ function canProcessOnWorker(worker, options = {}) {
644
+ const supported = isBrowser2 ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
645
+ return Boolean(
646
+ supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options))
647
+ );
1449
648
  }
1450
- function createAbortError2(message) {
1451
- const error = new Error(message);
1452
- error.name = "AbortError";
1453
- return error;
649
+ function canProcessOnWorkerInBatches(worker, options = {}) {
650
+ if (!canProcessOnWorker(worker, options)) return false;
651
+ if (options.workerInBatches !== void 0) return options.workerInBatches;
652
+ return Boolean(worker.workerInBatches && !getConfiguredWorkerURL(worker, options));
1454
653
  }
1455
- function getAsyncIterator(input) {
1456
- if (Symbol.asyncIterator in input) {
1457
- return input[Symbol.asyncIterator]();
654
+ async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
655
+ const session = await openSession(worker, options, context, jobContext);
656
+ try {
657
+ const result = await session.handle.runTask(
658
+ { value: data },
659
+ {
660
+ ...getControls(options),
661
+ options: getParserOptions(options)
662
+ }
663
+ );
664
+ return result.value;
665
+ } finally {
666
+ await session.close();
1458
667
  }
1459
- return (async function* iterateSynchronously() {
1460
- yield* input;
1461
- })();
1462
668
  }
1463
- function closeInputIterator(inputIterator) {
669
+ async function* processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
1464
670
  var _a;
671
+ const taskInput = wrapInput(input);
672
+ let session;
1465
673
  try {
1466
- void Promise.resolve((_a = inputIterator.return) == null ? void 0 : _a.call(inputIterator)).catch(() => void 0);
1467
- } catch {
674
+ session = await openSession(worker, options, context, jobContext);
675
+ for await (const result of session.handle.runTaskInBatches(taskInput, {
676
+ ...getControls(options),
677
+ options: getParserOptions(options)
678
+ }))
679
+ yield result.value;
680
+ } finally {
681
+ const closingInput = (_a = taskInput.return) == null ? void 0 : _a.call(taskInput);
682
+ void (closingInput == null ? void 0 : closingInput.catch(() => {
683
+ }));
684
+ await (session == null ? void 0 : session.close());
1468
685
  }
1469
686
  }
1470
- function getWorkerPoolTarget(worker, options, name) {
1471
- if (options.source) {
1472
- return { name, source: options.source };
1473
- }
1474
- const customWorkerUrl = getCustomWorkerURL(worker, options);
1475
- if (customWorkerUrl) {
1476
- return { name, url: customWorkerUrl };
1477
- }
1478
- if (isBrowser2 && worker.loadWorker) {
1479
- return {
1480
- name,
1481
- loadWorker: worker.loadWorker,
1482
- getUrl: () => getWorkerURL(worker, options),
1483
- urlKey: getDefaultWorkerURL(worker)
687
+ function getTask(worker, options) {
688
+ var _a;
689
+ if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
690
+ throw new Error(
691
+ "Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory"
692
+ );
693
+ const create = !getCustomWorkerURL(worker, options) && isBrowser2 ? worker.loadWorker : void 0;
694
+ const url = getWorkerURL(worker, options);
695
+ return {
696
+ id: `${worker.module}:${worker.id}`,
697
+ initialize: (state) => state,
698
+ worker: {
699
+ ...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
700
+ capabilities: { atomic: true, streaming: true }
701
+ }
702
+ };
703
+ }
704
+ function getControls(options) {
705
+ return {
706
+ execution: "worker",
707
+ signal: options.signal,
708
+ inputOwnership: options.inputOwnership ?? "transfer",
709
+ outputOwnership: options.outputOwnership ?? "transfer",
710
+ onProgress: options.onProgress ? (progress) => {
711
+ var _a;
712
+ return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
713
+ } : void 0
714
+ };
715
+ }
716
+ function getParserOptions(options) {
717
+ const { signal, onProgress, parserOptions, ...workerOptions } = options;
718
+ return getTransferListForWriter(parserOptions ?? workerOptions);
719
+ }
720
+ async function openSession(worker, options, context, jobContext) {
721
+ var _a, _b;
722
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
723
+ const task = getTask(worker, options);
724
+ let state = runners.get(worker);
725
+ if (!state) {
726
+ state = {
727
+ runner: new import_tasks2.TaskRunner({
728
+ maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
729
+ }),
730
+ requests: 0
1484
731
  };
732
+ runners.set(worker, state);
1485
733
  }
1486
- return { name, url: getWorkerURL(worker, options) };
1487
- }
1488
- async function onMessage(context, options, job, type, payload) {
1489
- switch (type) {
1490
- case "progress":
1491
- reportProgress(job, options, payload);
1492
- break;
1493
- case "done":
1494
- job.done(payload);
1495
- break;
1496
- case "error":
1497
- job.error(new Error(payload.error));
1498
- break;
1499
- case "process":
1500
- const { id, input, options: processOptions } = payload;
734
+ const runnerState = state;
735
+ const channel = context.process ? new MessageChannel() : void 0;
736
+ const callbackController = new AbortController();
737
+ let channelClosed = false;
738
+ const abortCallbacks = () => {
739
+ var _a2;
740
+ return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
741
+ };
742
+ (_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
743
+ const closeChannel = () => {
744
+ var _a2;
745
+ channelClosed = true;
746
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
747
+ callbackController.abort();
748
+ channel == null ? void 0 : channel.port1.close();
749
+ channel == null ? void 0 : channel.port2.close();
750
+ };
751
+ if (channel) {
752
+ channel.port1.onmessage = async ({ data }) => {
1501
753
  try {
1502
- if (!context.process) {
1503
- job.postMessage("error", { id, error: "Worker not set up to process on main thread" });
1504
- return;
1505
- }
1506
- const result = await context.process(
1507
- input,
1508
- { ...processOptions, signal: options.signal, onProgress: options.onProgress },
1509
- void 0,
1510
- payload.context || {}
754
+ const value = await context.process(
755
+ data.input,
756
+ data.options,
757
+ {
758
+ signal: callbackController.signal,
759
+ throwIfAborted: () => callbackController.signal.throwIfAborted()
760
+ },
761
+ data.context
1511
762
  );
1512
- job.postMessage("done", { id, result });
763
+ if (!channelClosed && !callbackController.signal.aborted)
764
+ channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
1513
765
  } catch (error) {
1514
- const message = error instanceof Error ? error.message : "unknown error";
1515
- job.postMessage("error", { id, error: message });
766
+ if (channelClosed || callbackController.signal.aborted) return;
767
+ channel.port1.postMessage({
768
+ identifier: data.identifier,
769
+ error: {
770
+ name: error instanceof Error ? error.name : "Error",
771
+ message: error instanceof Error ? error.message : String(error)
772
+ }
773
+ });
1516
774
  }
1517
- break;
1518
- default:
1519
- console.warn(`process-on-worker: unknown message ${type}`);
1520
- }
1521
- }
1522
- function reportProgress(job, options, payload) {
1523
- var _a;
1524
- if (!job.isRunning || !payload.progress) return;
775
+ };
776
+ channel.port1.start();
777
+ }
778
+ runnerState.requests++;
779
+ activeRunners.add(runnerState);
780
+ let released = false;
781
+ const releaseRunner = () => {
782
+ if (released) return;
783
+ released = true;
784
+ runnerState.requests--;
785
+ if (!runnerState.requests) activeRunners.delete(runnerState);
786
+ };
787
+ let handle;
1525
788
  try {
1526
- (_a = options.onProgress) == null ? void 0 : _a.call(options, payload.progress);
789
+ handle = await runnerState.runner.initializeTask(
790
+ task,
791
+ {
792
+ context: structuredClone(jobContext),
793
+ ...channel ? { port: channel.port2 } : {}
794
+ },
795
+ // The callback port is setup state, independent of the caller's payload ownership.
796
+ { ...getControls(options), inputOwnership: "transfer" }
797
+ );
1527
798
  } catch (error) {
1528
- job.abort(error);
1529
- }
1530
- }
1531
-
1532
- // src/worker-utils/lib/worker-api/create-worker.ts
1533
- var requestId = 0;
1534
- var activeInputBatches = null;
1535
- var activeOutputAcknowledgements = null;
1536
- async function createWorker(process2, processInBatches) {
1537
- if (!await WorkerBody.inWorkerThread()) {
1538
- return;
799
+ releaseRunner();
800
+ closeChannel();
801
+ throw error;
1539
802
  }
1540
- const context = {
1541
- process: processOnMainThread
803
+ return {
804
+ handle,
805
+ /** Releases the worker and callback channel on success, failure, and early stream return. */
806
+ async close() {
807
+ try {
808
+ await handle.close();
809
+ } finally {
810
+ closeChannel();
811
+ releaseRunner();
812
+ }
813
+ }
1542
814
  };
1543
- WorkerBody.onmessage = async (type, payload) => {
1544
- const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
1545
- const jobContext = { ...context, reportProgress: reporter == null ? void 0 : reporter.report };
1546
- try {
1547
- switch (type) {
1548
- case "preload":
1549
- WorkerBody.postMessage("done", {});
1550
- break;
1551
- case "process":
1552
- if (!process2) {
1553
- throw new Error("Worker does not support atomic processing");
1554
- }
1555
- const result = await process2(
1556
- payload.input,
1557
- payload.options || {},
1558
- jobContext,
1559
- payload.context || {}
1560
- );
1561
- reporter == null ? void 0 : reporter.finish();
1562
- WorkerBody.postMessage("done", { result });
1563
- break;
1564
- case "process-in-batches":
1565
- if (!processInBatches) {
1566
- throw new Error("Worker does not support batched processing");
1567
- }
1568
- const inputBatches = new AsyncQueue();
1569
- const outputAcknowledgements = new AsyncQueue();
1570
- activeInputBatches = inputBatches;
1571
- activeOutputAcknowledgements = outputAcknowledgements;
1572
- try {
1573
- const resultIterator = processInBatches(
1574
- createDemandDrivenIterator(inputBatches),
1575
- payload.options || {},
1576
- jobContext,
1577
- payload.context || {}
1578
- );
1579
- for await (const batch of resultIterator) {
1580
- await WorkerBody.postMessage("output-batch", { result: batch });
1581
- await outputAcknowledgements.next();
1582
- }
1583
- reporter == null ? void 0 : reporter.finish();
1584
- await WorkerBody.postMessage("done", {});
1585
- } finally {
1586
- activeInputBatches = null;
1587
- activeOutputAcknowledgements = null;
1588
- }
1589
- break;
1590
- case "input-batch":
1591
- if (!activeInputBatches) {
1592
- throw new Error("Worker has no active batched processing session");
1593
- }
1594
- activeInputBatches.push(payload.input);
1595
- break;
1596
- case "input-done":
1597
- if (!activeInputBatches) {
1598
- throw new Error("Worker has no active batched processing session");
1599
- }
1600
- activeInputBatches.close();
1601
- break;
1602
- case "output-ack":
1603
- if (!activeOutputAcknowledgements) {
1604
- throw new Error("Worker has no active batched processing session");
1605
- }
1606
- activeOutputAcknowledgements.push(void 0);
1607
- break;
1608
- default:
815
+ }
816
+ function wrapInput(input) {
817
+ const iterator = Symbol.asyncIterator in input ? input[Symbol.asyncIterator]() : input[Symbol.iterator]();
818
+ let inputClosed = false;
819
+ return {
820
+ [Symbol.asyncIterator]() {
821
+ return this;
822
+ },
823
+ async next() {
824
+ if (inputClosed) return { done: true, value: void 0 };
825
+ const next = await iterator.next();
826
+ if (next.done || inputClosed) {
827
+ inputClosed = true;
828
+ return { done: true, value: void 0 };
829
+ }
830
+ return { done: false, value: { value: next.value } };
831
+ },
832
+ async return() {
833
+ var _a;
834
+ if (!inputClosed) {
835
+ inputClosed = true;
836
+ await ((_a = iterator.return) == null ? void 0 : _a.call(iterator));
1609
837
  }
1610
- } catch (error) {
1611
- reporter == null ? void 0 : reporter.finish();
1612
- const message = error instanceof Error ? error.message : "";
1613
- WorkerBody.postMessage("error", { error: message });
838
+ return { done: true, value: void 0 };
1614
839
  }
1615
840
  };
1616
841
  }
1617
- async function* createDemandDrivenIterator(inputBatches) {
1618
- while (true) {
1619
- await WorkerBody.postMessage("input-request", {});
1620
- const nextBatch = await inputBatches.next();
1621
- if (nextBatch.done) {
1622
- return;
842
+ function createModuleWorker(url) {
843
+ var _a;
844
+ const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
845
+ let workerUrl = resolved.href;
846
+ if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
847
+ let shimUrl = moduleWorkerUrls.get(resolved.href);
848
+ if (!shimUrl) {
849
+ shimUrl = URL.createObjectURL(
850
+ new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" })
851
+ );
852
+ moduleWorkerUrls.set(resolved.href, shimUrl);
1623
853
  }
1624
- yield nextBatch.value;
854
+ workerUrl = shimUrl;
1625
855
  }
856
+ return new Worker(workerUrl, { type: "module" });
1626
857
  }
1627
- function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
1628
- return new Promise((resolve2, reject) => {
1629
- const id = requestId++;
1630
- const onMessage2 = (type, payload2) => {
1631
- if (payload2.id !== id) {
1632
- return;
1633
- }
1634
- switch (type) {
1635
- case "done":
1636
- WorkerBody.removeEventListener(onMessage2);
1637
- resolve2(payload2.result);
1638
- break;
1639
- case "error":
1640
- WorkerBody.removeEventListener(onMessage2);
1641
- reject(payload2.error);
1642
- break;
1643
- default:
1644
- }
1645
- };
1646
- WorkerBody.addEventListener(onMessage2);
1647
- const payload = { id, input: arrayBuffer, options, context: jobContext };
1648
- WorkerBody.postMessage("process", payload);
1649
- });
858
+
859
+ // src/worker-utils/lib/worker-api/create-worker.ts
860
+ async function createWorker(process2, processInBatches) {
861
+ if (!await isWorkerThread()) return;
862
+ await initializeTaskWorker(createWorkerTask(process2, processInBatches));
1650
863
  }
1651
- function createProgressReporter() {
1652
- let pending;
1653
- let finished = false;
1654
- let scheduled = false;
1655
- const flush = () => {
1656
- scheduled = false;
1657
- if (pending) {
1658
- WorkerBody.postMessage("progress", { progress: pending });
1659
- pending = void 0;
1660
- }
1661
- };
864
+ function createWorkerTask(process2, processInBatches) {
1662
865
  return {
1663
- /** Records progress while retaining phase transitions. */
1664
- report(progress) {
1665
- if (finished) return;
1666
- if (pending && pending.phase !== progress.phase) flush();
1667
- pending = { ...progress };
1668
- if (!scheduled) {
1669
- scheduled = true;
1670
- setTimeout(flush, 0);
1671
- }
866
+ id: "loaders.gl",
867
+ initialize: (state) => state,
868
+ destroy: (state) => {
869
+ var _a;
870
+ return (_a = state.port) == null ? void 0 : _a.close();
1672
871
  },
1673
- /** Flushes final progress and suppresses reports from stale callbacks. */
1674
- finish() {
1675
- flush();
1676
- finished = true;
1677
- }
872
+ process: async ({ value }, options, context) => {
873
+ if (!process2) throw new Error("Worker does not support atomic processing");
874
+ return { value: await process2(value, options, createContext(context), context.state.context) };
875
+ },
876
+ ...processInBatches ? {
877
+ processInBatches: async function* (inputs, options, context) {
878
+ async function* values() {
879
+ for await (const input of inputs) yield input.value;
880
+ }
881
+ for await (const value of processInBatches(
882
+ values(),
883
+ options,
884
+ createContext(context),
885
+ context.state.context
886
+ )) {
887
+ yield { value };
888
+ }
889
+ }
890
+ } : {}
891
+ };
892
+ }
893
+ function createContext(context) {
894
+ let requestIdentifier = 0;
895
+ const port = context.state.port;
896
+ return {
897
+ signal: context.signal,
898
+ throwIfAborted: () => context.throwIfAborted(),
899
+ reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
900
+ process: port ? (input, options = {}, jobContext = {}) => {
901
+ context.throwIfAborted();
902
+ const identifier = ++requestIdentifier;
903
+ return new Promise((resolve2, reject) => {
904
+ const onMessage = (event) => {
905
+ if (event.data.identifier !== identifier) return;
906
+ cleanup();
907
+ if (event.data.error) {
908
+ const error = new Error(event.data.error.message);
909
+ error.name = event.data.error.name;
910
+ reject(error);
911
+ } else resolve2(event.data.value);
912
+ };
913
+ const onAbort = () => {
914
+ cleanup();
915
+ reject(context.signal.reason);
916
+ };
917
+ const cleanup = () => {
918
+ port.removeEventListener("message", onMessage);
919
+ context.signal.removeEventListener("abort", onAbort);
920
+ };
921
+ port.addEventListener("message", onMessage);
922
+ context.signal.addEventListener("abort", onAbort, { once: true });
923
+ port.start();
924
+ try {
925
+ const request = { identifier, input, options, context: jobContext };
926
+ port.postMessage(request, getTransferList(request));
927
+ } catch (error) {
928
+ cleanup();
929
+ reject(error);
930
+ }
931
+ });
932
+ } : void 0
1678
933
  };
1679
934
  }
1680
935
 
@@ -1725,13 +980,13 @@ function createWorkerCoreApi() {
1725
980
  loadInBatches: unavailable("loadInBatches")
1726
981
  };
1727
982
  }
1728
- function createParseOnMainThread(processOnMainThread2) {
983
+ function createParseOnMainThread(processOnMainThread) {
1729
984
  return (arrayBuffer, loaders, options, context) => {
1730
- if (!processOnMainThread2) {
985
+ if (!processOnMainThread) {
1731
986
  throw new Error("Worker not set up to parse on main thread");
1732
987
  }
1733
988
  const parseArguments = getMainThreadParseArguments(loaders, options, context);
1734
- return processOnMainThread2(arrayBuffer, parseArguments.options, {
989
+ return processOnMainThread(arrayBuffer, parseArguments.options, {
1735
990
  ...parseArguments.context,
1736
991
  ...Array.isArray(loaders) || loaders && isLoaderObject(loaders) ? {
1737
992
  _loaderIsArray: Array.isArray(loaders),
@@ -1759,7 +1014,7 @@ function getSerializableLoaderContext(context) {
1759
1014
  if (!context) {
1760
1015
  return void 0;
1761
1016
  }
1762
- const { fetch: fetch2, loaders, coreApi, signal, reportProgress: reportProgress2, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1017
+ const { fetch: fetch2, loaders, coreApi, signal, reportProgress, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1763
1018
  return JSON.parse(JSON.stringify(serializableContext));
1764
1019
  }
1765
1020
  async function parseData({ loader, arrayBuffer, options, context }) {
@@ -1795,7 +1050,7 @@ function canParseWithWorker(loader, options) {
1795
1050
  return false;
1796
1051
  if ((_d = (_c = options == null ? void 0 : options.core) == null ? void 0 : _c.credentials) == null ? void 0 : _d.some((credential) => credential.type === "request" || "token" in credential && typeof credential.token === "function"))
1797
1052
  return false;
1798
- if (loader.id === "shapefile" && (typeof (options == null ? void 0 : options.fetch) === "function" || typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function"))
1053
+ if (loader.id === "shapefile" && typeof ((_e = options == null ? void 0 : options.core) == null ? void 0 : _e.fetch) === "function")
1799
1054
  return false;
1800
1055
  const workerOptions = getWorkerOptions(options);
1801
1056
  const nodeWorkers = workerOptions._nodeWorkers;
@@ -1839,12 +1094,16 @@ async function parseWithWorker(loader, data, options, context, parseOnMainThread
1839
1094
  signal: workerSignal,
1840
1095
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1841
1096
  }, {
1842
- process: async (input, processOptions, _workerContext, parseContext) => {
1097
+ process: async (input, processOptions, workerContext, parseContext) => {
1843
1098
  if (!parseOnMainThread) {
1844
1099
  throw new Error("Worker not set up to parse on main thread");
1845
1100
  }
1846
1101
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1847
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
1102
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
1103
+ ...context,
1104
+ ...workerParseContext,
1105
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
1106
+ } : void 0;
1848
1107
  return await callParseOnMainThread(parseOnMainThread, input, processOptions, mainThreadContext, resolveWorkerLoaders(loader, _loaderIds, _loaderIsArray, context, options));
1849
1108
  }
1850
1109
  }, getSerializableLoaderContext2(context));
@@ -1857,12 +1116,16 @@ async function* parseWithWorkerInBatches(loader, inputIterator, options, context
1857
1116
  signal: workerSignal,
1858
1117
  onProgress: (options == null ? void 0 : options.onProgress) || (context == null ? void 0 : context.reportProgress)
1859
1118
  }, {
1860
- process: async (input, processOptions, _workerContext, parseContext) => {
1119
+ process: async (input, processOptions, workerContext, parseContext) => {
1861
1120
  if (!parseOnMainThread) {
1862
1121
  throw new Error("Worker not set up to parse on main thread");
1863
1122
  }
1864
1123
  const { _loaderIds, _loaderIsArray, ...workerParseContext } = parseContext || {};
1865
- const mainThreadContext = context || parseContext ? { ...context, ...workerParseContext } : void 0;
1124
+ const mainThreadContext = context || parseContext || (workerContext == null ? void 0 : workerContext.signal) ? {
1125
+ ...context,
1126
+ ...workerParseContext,
1127
+ signal: (workerContext == null ? void 0 : workerContext.signal) ?? (context == null ? void 0 : context.signal)
1128
+ } : void 0;
1866
1129
  return await callParseOnMainThread(parseOnMainThread, input, processOptions, mainThreadContext, resolveWorkerLoaders(loader, _loaderIds, _loaderIsArray, context, options));
1867
1130
  }
1868
1131
  }, getSerializableLoaderContext2(context));
@@ -1916,13 +1179,19 @@ function resolveWorkerLoaders(loader, loaderIds, loaderIsArray, context, options
1916
1179
  }
1917
1180
  }
1918
1181
  function getWorkerOptions(options = {}, loader) {
1919
- var _a;
1182
+ var _a, _b;
1920
1183
  const portableOptions = ((_a = loader == null ? void 0 : loader.serializeWorkerOptions) == null ? void 0 : _a.call(loader, options)) || options;
1921
1184
  const optionsToSerialize = {
1922
1185
  ...portableOptions,
1923
1186
  signal: void 0,
1924
1187
  onProgress: void 0,
1925
- ...portableOptions.core ? { core: { ...portableOptions.core, authentications: void 0 } } : {}
1188
+ ...portableOptions.core ? {
1189
+ core: {
1190
+ ...portableOptions.core,
1191
+ authentications: void 0,
1192
+ log: isDisabledLog(portableOptions.core.log) ? null : void 0
1193
+ }
1194
+ } : {}
1926
1195
  };
1927
1196
  const serializedOptions = JSON.parse(JSON.stringify(optionsToSerialize, (_key, value) => {
1928
1197
  if (typeof Headers !== "undefined" && value instanceof Headers)
@@ -1932,17 +1201,17 @@ function getWorkerOptions(options = {}, loader) {
1932
1201
  return typeof value === "bigint" ? null : value;
1933
1202
  }));
1934
1203
  restoreBigIntOptions(optionsToSerialize, serializedOptions);
1935
- const workerOptions = {
1936
- ...serializedOptions.core,
1937
- ...serializedOptions
1938
- };
1939
- if (workerOptions.worker === "auto") {
1940
- workerOptions.worker = true;
1204
+ if (((_b = serializedOptions.core) == null ? void 0 : _b.worker) === "auto") {
1205
+ serializedOptions.core.worker = true;
1941
1206
  }
1942
1207
  if (loader) {
1943
- workerOptions._workerLoaderId = loader.id;
1208
+ serializedOptions._workerLoaderId = loader.id;
1944
1209
  }
1945
- return workerOptions;
1210
+ return {
1211
+ ...serializedOptions,
1212
+ ...serializedOptions.core,
1213
+ parserOptions: serializedOptions
1214
+ };
1946
1215
  }
1947
1216
  function restoreBigIntOptions(original, serialized) {
1948
1217
  if (!serialized || typeof serialized !== "object")
@@ -1959,30 +1228,30 @@ function getSerializableLoaderContext2(context) {
1959
1228
  if (!context) {
1960
1229
  return {};
1961
1230
  }
1962
- const { fetch: fetch2, loaders, coreApi, signal, reportProgress: reportProgress2, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1231
+ const { fetch: fetch2, loaders, coreApi, signal, reportProgress, _parse, _parseSync, _parseInBatches, ...serializableContext } = context;
1963
1232
  return JSON.parse(JSON.stringify(serializableContext));
1964
1233
  }
1965
1234
  function shouldParseCSVWithWorker(options) {
1966
1235
  var _a, _b;
1967
1236
  const csvOptions = options;
1968
- return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow-table";
1237
+ return (((_a = csvOptions == null ? void 0 : csvOptions.csv) == null ? void 0 : _a.shape) ?? ((_b = csvOptions == null ? void 0 : csvOptions.core) == null ? void 0 : _b.shape)) === "arrow";
1969
1238
  }
1970
1239
  function isLoaderWithWorkerResultDeserializer(loader) {
1971
1240
  return typeof loader.deserializeWorkerResult === "function";
1972
1241
  }
1242
+ function isDisabledLog(logger) {
1243
+ return logger === null || logger instanceof NullLog;
1244
+ }
1973
1245
 
1974
1246
  // dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js
1975
1247
  function canEncodeWithWorker(writer, options) {
1976
1248
  var _a, _b;
1977
- if (!WorkerFarm.isSupported()) {
1978
- return false;
1979
- }
1980
1249
  const nodeWorkers = (options == null ? void 0 : options._nodeWorkers) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._nodeWorkers);
1981
1250
  const useWorkers = (options == null ? void 0 : options.worker) ?? ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.worker);
1982
1251
  if (!isBrowser && !nodeWorkers) {
1983
1252
  return false;
1984
1253
  }
1985
- return Boolean(writer.worker && useWorkers);
1254
+ return canProcessOnWorker({ ...writer, options: writer.options || {} }, { worker: Boolean(useWorkers), _nodeWorkers: Boolean(nodeWorkers) });
1986
1255
  }
1987
1256
 
1988
1257
  // dist/loader-utils/lib/binary-utils/get-first-characters.js
@@ -2507,7 +1776,7 @@ var STAT_ACTIVE_REQUESTS = "Active Requests";
2507
1776
  var STAT_CANCELLED_REQUESTS = "Cancelled Requests";
2508
1777
  var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
2509
1778
  var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
2510
- var DEFAULT_PROPS2 = {
1779
+ var DEFAULT_PROPS = {
2511
1780
  id: "request-scheduler",
2512
1781
  /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
2513
1782
  throttleRequests: true,
@@ -2529,7 +1798,7 @@ var RequestScheduler = class {
2529
1798
  /** Pending arrival debounce or next-tick refill; only new arrivals replace this timer. */
2530
1799
  updateTimer = null;
2531
1800
  constructor(props = {}) {
2532
- this.props = { ...DEFAULT_PROPS2, ...props };
1801
+ this.props = { ...DEFAULT_PROPS, ...props };
2533
1802
  this.stats = new import_stats.Stats({ id: this.props.id });
2534
1803
  this.stats.get(STAT_QUEUED_REQUESTS);
2535
1804
  this.stats.get(STAT_ACTIVE_REQUESTS);
@@ -2789,7 +2058,7 @@ var RequestCache = class {
2789
2058
  return cached;
2790
2059
  }
2791
2060
  if (signal == null ? void 0 : signal.aborted) {
2792
- return Promise.reject(createAbortError3());
2061
+ return Promise.reject(createAbortError());
2793
2062
  }
2794
2063
  const controller = new AbortController();
2795
2064
  let resolveRequest;
@@ -2847,7 +2116,7 @@ var RequestCache = class {
2847
2116
  }
2848
2117
  waitForEntry(key, entry, signal) {
2849
2118
  if (signal == null ? void 0 : signal.aborted) {
2850
- return Promise.reject(createAbortError3());
2119
+ return Promise.reject(createAbortError());
2851
2120
  }
2852
2121
  if (!entry.pending) {
2853
2122
  return entry.promise;
@@ -2866,7 +2135,7 @@ var RequestCache = class {
2866
2135
  if (!waiting)
2867
2136
  return;
2868
2137
  finishWaiting();
2869
- reject(createAbortError3());
2138
+ reject(createAbortError());
2870
2139
  if (entry.pending && entry.waiterCount === 0 && this.entries.get(key) === entry) {
2871
2140
  this.removeEntry(key, "abort");
2872
2141
  }
@@ -2919,7 +2188,7 @@ var RequestCache = class {
2919
2188
  return true;
2920
2189
  }
2921
2190
  };
2922
- function createAbortError3() {
2191
+ function createAbortError() {
2923
2192
  const error = new Error("Request aborted");
2924
2193
  error.name = "AbortError";
2925
2194
  return error;
@@ -3092,7 +2361,7 @@ function createAuthenticatedFetch(options) {
3092
2361
  }
3093
2362
  function getAuthenticatedFetch(options = {}) {
3094
2363
  var _a, _b, _c;
3095
- const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
2364
+ const fetchOption = (_a = options.core) == null ? void 0 : _a.fetch;
3096
2365
  let fetchFunction;
3097
2366
  if (typeof fetchOption === "function") {
3098
2367
  fetchFunction = fetchOption;
@@ -3275,7 +2544,7 @@ var RANGE_STATS_KEYS = {
3275
2544
  abortedLogicalRanges: "Aborted Logical Range Requests",
3276
2545
  fullResponseFallbacks: "Full Response Fallbacks"
3277
2546
  };
3278
- var DEFAULT_PROPS3 = {
2547
+ var DEFAULT_PROPS2 = {
3279
2548
  batchDelayMs: 50,
3280
2549
  maxGapBytes: 65536,
3281
2550
  rangeExpansionBytes: 65536,
@@ -3314,16 +2583,16 @@ var RangeRequestScheduler = class {
3314
2583
  flushTimer = null;
3315
2584
  /** Creates a scheduler for one group of byte-range-addressable resources. */
3316
2585
  constructor(props = {}) {
3317
- const rangeExpansionBytes = props.rangeExpansionBytes ?? props.maxGapBytes ?? DEFAULT_PROPS3.rangeExpansionBytes;
2586
+ const rangeExpansionBytes = props.rangeExpansionBytes ?? props.maxGapBytes ?? DEFAULT_PROPS2.rangeExpansionBytes;
3318
2587
  this.props = {
3319
- batchDelayMs: props.batchDelayMs ?? DEFAULT_PROPS3.batchDelayMs,
2588
+ batchDelayMs: props.batchDelayMs ?? DEFAULT_PROPS2.batchDelayMs,
3320
2589
  maxGapBytes: props.maxGapBytes ?? rangeExpansionBytes,
3321
2590
  rangeExpansionBytes,
3322
- maxMergedBytes: props.maxMergedBytes ?? DEFAULT_PROPS3.maxMergedBytes,
2591
+ maxMergedBytes: props.maxMergedBytes ?? DEFAULT_PROPS2.maxMergedBytes,
3323
2592
  maxConcurrency: props.maxConcurrency ?? 6,
3324
2593
  maxQueueSize: props.maxQueueSize ?? 4096,
3325
2594
  maxRangeBytes: props.maxRangeBytes ?? 64 * 1024 * 1024,
3326
- maxTotalBytes: props.maxTotalBytes ?? DEFAULT_PROPS3.maxTotalBytes
2595
+ maxTotalBytes: props.maxTotalBytes ?? DEFAULT_PROPS2.maxTotalBytes
3327
2596
  };
3328
2597
  for (const value of [
3329
2598
  this.props.maxConcurrency,
@@ -3353,7 +2622,7 @@ var RangeRequestScheduler = class {
3353
2622
  return Promise.reject(new Error("Byte range length cannot be negative"));
3354
2623
  }
3355
2624
  if ((_a = request.signal) == null ? void 0 : _a.aborted) {
3356
- return Promise.reject(request.signal.reason ?? createAbortError4());
2625
+ return Promise.reject(request.signal.reason ?? createAbortError2());
3357
2626
  }
3358
2627
  if (request.length === 0) {
3359
2628
  return Promise.resolve(new ArrayBuffer(0));
@@ -3618,7 +2887,7 @@ var RangeRequestScheduler = class {
3618
2887
  }
3619
2888
  }
3620
2889
  this.transportQueue = this.transportQueue.filter((group) => group.requests.length > 0);
3621
- request.reject(((_a = request.signal) == null ? void 0 : _a.reason) ?? createAbortError4());
2890
+ request.reject(((_a = request.signal) == null ? void 0 : _a.reason) ?? createAbortError2());
3622
2891
  this.trackEvent({
3623
2892
  type: "abort",
3624
2893
  sourceId: request.sourceId,
@@ -3849,7 +3118,7 @@ function getTimestamp() {
3849
3118
  var _a;
3850
3119
  return ((_a = globalThis.performance) == null ? void 0 : _a.now()) ?? Date.now();
3851
3120
  }
3852
- function createAbortError4() {
3121
+ function createAbortError2() {
3853
3122
  if (typeof DOMException !== "undefined") {
3854
3123
  return new DOMException("Request aborted", "AbortError");
3855
3124
  }
@@ -3931,7 +3200,7 @@ var RangeRequestCache = class {
3931
3200
  (_a = this.onEvent) == null ? void 0 : _a.call(this, { type: "miss", sourceId, offset, length });
3932
3201
  if (this.cache.maxEntries === 0 || length > this.cache.maxBytes) {
3933
3202
  if (signal == null ? void 0 : signal.aborted) {
3934
- throw createAbortError5();
3203
+ throw createAbortError3();
3935
3204
  }
3936
3205
  const arrayBuffer = await fetchRange(offset, length, signal || new AbortController().signal);
3937
3206
  validateResponseLength(arrayBuffer, length);
@@ -4042,7 +3311,7 @@ function validateResponseLength(arrayBuffer, expectedLength) {
4042
3311
  throw new Error(`Range request returned ${arrayBuffer.byteLength} bytes; expected ${expectedLength}`);
4043
3312
  }
4044
3313
  }
4045
- function createAbortError5() {
3314
+ function createAbortError3() {
4046
3315
  const error = new Error("Request aborted");
4047
3316
  error.name = "AbortError";
4048
3317
  return error;
@@ -6213,14 +5482,14 @@ var Byte14Decompressor = class {
6213
5482
  };
6214
5483
  function createPointDecompressor(stream, metadata, outputMode, selection) {
6215
5484
  const extraByteCount = getExtraByteCount(metadata);
6216
- for (const version2 of [
5485
+ for (const version3 of [
6217
5486
  metadata.point10ItemVersion,
6218
5487
  metadata.gpsTime11ItemVersion,
6219
5488
  metadata.rgb12ItemVersion,
6220
5489
  metadata.byteItemVersion
6221
5490
  ]) {
6222
- if (version2 !== void 0 && version2 !== 1 && version2 !== 2) {
6223
- throw new Error(`Unsupported legacy LASzip item version ${version2}`);
5491
+ if (version3 !== void 0 && version3 !== 1 && version3 !== 2) {
5492
+ throw new Error(`Unsupported legacy LASzip item version ${version3}`);
6224
5493
  }
6225
5494
  }
6226
5495
  switch (metadata.pointDataRecordFormat) {
@@ -9524,7 +8793,7 @@ function validateMetadata(rawBytes, metadata) {
9524
8793
  metadata.gpsTime11ItemVersion,
9525
8794
  metadata.rgb12ItemVersion,
9526
8795
  metadata.byteItemVersion
9527
- ].some((version2) => version2 !== void 0 && version2 !== 2)) {
8796
+ ].some((version3) => version3 !== void 0 && version3 !== 2)) {
9528
8797
  throw new Error("TypeScript LAZ encoder only supports legacy item version 2");
9529
8798
  }
9530
8799
  if (!Number.isInteger(metadata.pointCount) || metadata.pointCount < 0) {
@@ -9941,7 +9210,7 @@ var CachedUriResolver = class {
9941
9210
  };
9942
9211
 
9943
9212
  // dist/loader-utils/json-loader.js
9944
- var VERSION3 = true ? "5.0.0-beta.1" : "latest";
9213
+ var VERSION3 = true ? "5.0.0-beta.10" : "latest";
9945
9214
  var JSONLoader = {
9946
9215
  dataType: null,
9947
9216
  batchType: null,
@@ -10180,6 +9449,8 @@ var HttpFileTransport = class {
10180
9449
  identityHints;
10181
9450
  /** Failure objects already included in telemetry. */
10182
9451
  countedFailures = /* @__PURE__ */ new WeakSet();
9452
+ /** Observer for cumulative transport counters, including asynchronous cancellation. */
9453
+ onTelemetry;
10183
9454
  /** Mutable counters backing immutable telemetry snapshots. */
10184
9455
  telemetry = {
10185
9456
  requestedBytes: 0,
@@ -10193,6 +9464,7 @@ var HttpFileTransport = class {
10193
9464
  constructor(url, options) {
10194
9465
  validateKnownByteLength(options.byteLength);
10195
9466
  this.url = url;
9467
+ this.onTelemetry = options.onTelemetry;
10196
9468
  this.fetchFunction = options.fetch || ((input, init) => globalThis.fetch(input, init));
10197
9469
  this.fetchOptions = options.fetchOptions ? { ...options.fetchOptions, headers: new Headers(options.fetchOptions.headers) } : void 0;
10198
9470
  this.consistency = options.consistency || "best-effort";
@@ -10219,6 +9491,7 @@ var HttpFileTransport = class {
10219
9491
  }
10220
9492
  /** Counts each failure object once even when it passes through several async layers. */
10221
9493
  trackFailure(error) {
9494
+ var _a;
10222
9495
  if (typeof error === "object" && error !== null) {
10223
9496
  if (this.countedFailures.has(error)) {
10224
9497
  return;
@@ -10230,10 +9503,11 @@ var HttpFileTransport = class {
10230
9503
  } else {
10231
9504
  this.telemetry.errorCount++;
10232
9505
  }
9506
+ (_a = this.onTelemetry) == null ? void 0 : _a.call(this, this.getTelemetry(), error);
10233
9507
  }
10234
9508
  /** Performs and validates one exact HTTP range request. */
10235
9509
  async requestRange(offset, length, signal, expectedIdentity) {
10236
- var _a;
9510
+ var _a, _b;
10237
9511
  const requestStartTime = getTimestamp2();
10238
9512
  const abortContext = createCombinedAbortContext(signal, (_a = this.fetchOptions) == null ? void 0 : _a.signal);
10239
9513
  this.telemetry.requestCount++;
@@ -10247,7 +9521,7 @@ var HttpFileTransport = class {
10247
9521
  await cancelResponse(response);
10248
9522
  throw new Error(`HTTP byte-range request expected 206, received ${response.status}`);
10249
9523
  }
10250
- const contentRange = await readContentRange(response);
9524
+ const contentRange = response.headers.has("Content-Range") ? await readContentRange(response) : await this.inferContentRange(response, offset, length, expectedIdentity, abortContext.signal);
10251
9525
  const responseIdentity = getResponseIdentity(response, contentRange.byteLength);
10252
9526
  const responseError = getIdentityError(expectedIdentity, responseIdentity, this.identityHints, this.consistency) || getRangeError(contentRange, offset, length);
10253
9527
  if (responseError) {
@@ -10274,6 +9548,39 @@ var HttpFileTransport = class {
10274
9548
  } finally {
10275
9549
  abortContext.removeAbortListeners();
10276
9550
  this.telemetry.networkTimeMs += getTimestamp2() - requestStartTime;
9551
+ (_b = this.onTelemetry) == null ? void 0 : _b.call(this, this.getTelemetry());
9552
+ }
9553
+ }
9554
+ /** Infers bounds for a CORS-filtered 206; the caller still validates the body length. */
9555
+ async inferContentRange(response, offset, length, expectedIdentity, signal) {
9556
+ var _a;
9557
+ try {
9558
+ let byteLength = (expectedIdentity == null ? void 0 : expectedIdentity.byteLength) ?? this.identityHints.byteLength;
9559
+ if (byteLength === void 0) {
9560
+ const headers = new Headers((_a = this.fetchOptions) == null ? void 0 : _a.headers);
9561
+ headers.delete("Range");
9562
+ this.telemetry.requestCount++;
9563
+ const metadata = await this.fetchFunction(this.url, {
9564
+ ...this.fetchOptions,
9565
+ method: "HEAD",
9566
+ body: void 0,
9567
+ headers,
9568
+ signal
9569
+ });
9570
+ await cancelResponse(metadata);
9571
+ const value = metadata.headers.get("Content-Length");
9572
+ byteLength = value && /^\d+$/.test(value) ? Number(value) : NaN;
9573
+ if (metadata.status !== 200 || !Number.isSafeInteger(byteLength) || byteLength < offset + length) {
9574
+ throw new Error("HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length");
9575
+ }
9576
+ const identityError = getIdentityError(getResponseIdentity(metadata, byteLength), getResponseIdentity(response, byteLength), this.identityHints, this.consistency);
9577
+ if (identityError)
9578
+ throw new Error(identityError);
9579
+ }
9580
+ return { offset, endOffset: offset + length - 1, byteLength };
9581
+ } catch (error) {
9582
+ await cancelResponse(response);
9583
+ throw error;
10277
9584
  }
10278
9585
  }
10279
9586
  /** Validates and consumes the special empty-object identity response. */
@@ -10459,7 +9766,7 @@ var HttpFile = class _HttpFile {
10459
9766
  async open(signal) {
10460
9767
  this.assertOpen();
10461
9768
  if (signal == null ? void 0 : signal.aborted) {
10462
- const error = createAbortError6();
9769
+ const error = createAbortError4();
10463
9770
  this.transport.trackFailure(error);
10464
9771
  throw error;
10465
9772
  }
@@ -10501,7 +9808,7 @@ var HttpFile = class _HttpFile {
10501
9808
  async read(offset = 0, length = 0, signal) {
10502
9809
  this.assertOpen();
10503
9810
  if (signal == null ? void 0 : signal.aborted) {
10504
- const error = createAbortError6();
9811
+ const error = createAbortError4();
10505
9812
  this.transport.trackFailure(error);
10506
9813
  throw error;
10507
9814
  }
@@ -10609,7 +9916,7 @@ function validateRange2(offset, length, byteLength) {
10609
9916
  throw new Error("HTTP byte range extends beyond the end of the file");
10610
9917
  }
10611
9918
  }
10612
- function createAbortError6() {
9919
+ function createAbortError4() {
10613
9920
  if (typeof DOMException !== "undefined") {
10614
9921
  return new DOMException("Request aborted", "AbortError");
10615
9922
  }
@@ -10702,7 +10009,10 @@ var NodeFileSystemFacade = class {
10702
10009
 
10703
10010
  // dist/loader-utils/source-types.js
10704
10011
  function isSourceLoader(loader) {
10705
- return Boolean(loader && typeof loader === "object" && "createDataSource" in loader);
10012
+ return Boolean(loader && typeof loader === "object" && "createDataSourceSync" in loader && "fromUrl" in loader && "testURL" in loader);
10013
+ }
10014
+ function supportsSourceCreation(loader) {
10015
+ return Boolean(loader.createDataSourceSync || loader.preload && loader.fromUrl !== void 0);
10706
10016
  }
10707
10017
 
10708
10018
  // dist/loader-utils/lib/sources/data-source.js
@@ -10728,6 +10038,8 @@ var DataSource = class _DataSource {
10728
10038
  options;
10729
10039
  data;
10730
10040
  url;
10041
+ /** Stable query-visible name, resolved without fetching source data. */
10042
+ name;
10731
10043
  /** Shared parser options derived from the source options, excluding source-only core controls. */
10732
10044
  loadOptions;
10733
10045
  /** A resolved fetch function extracted from the shared core options. */
@@ -10741,6 +10053,7 @@ var DataSource = class _DataSource {
10741
10053
  this.options = mergeOptions(mergeOptions(_DataSource.defaultOptions, defaultOptions || {}), options);
10742
10054
  this.data = data;
10743
10055
  this.url = typeof data === "string" ? resolvePath(data) : "";
10056
+ this.name = getDataSourceName(data, this.options);
10744
10057
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
10745
10058
  this.loadOptions = loadOptions;
10746
10059
  const fetch2 = getFetchFunction(loadOptions);
@@ -10749,6 +10062,9 @@ var DataSource = class _DataSource {
10749
10062
  this.fetch = fetch2;
10750
10063
  }
10751
10064
  setProps(options) {
10065
+ var _a;
10066
+ if (((_a = options.core) == null ? void 0 : _a.name) !== void 0 && options.core.name !== this.name)
10067
+ throw new Error("Data source names are fixed at creation.");
10752
10068
  const mergedOptions = mergeOptions(this.options, options);
10753
10069
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
10754
10070
  this.options = mergedOptions;
@@ -10779,7 +10095,7 @@ var DataSource = class _DataSource {
10779
10095
  if (callback) {
10780
10096
  callback(normalizedError, this);
10781
10097
  } else {
10782
- log.warn(`${this.constructor.name}: ${normalizedError.message}`)();
10098
+ getLoaderLog(this.options).warn(`${this.constructor.name}: ${normalizedError.message}`)();
10783
10099
  }
10784
10100
  return normalizedError;
10785
10101
  }
@@ -10796,23 +10112,13 @@ function getSourceLoaderOptions(options) {
10796
10112
  if (options == null ? void 0 : options.core) {
10797
10113
  loadOptions.core = { ...options.core };
10798
10114
  const parserCore = loadOptions.core;
10799
- for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
10115
+ for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
10800
10116
  delete parserCore[key];
10801
10117
  }
10802
10118
  if (Object.keys(parserCore).length === 0) {
10803
10119
  delete loadOptions.core;
10804
10120
  }
10805
10121
  }
10806
- const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
10807
- const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
10808
- if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
10809
- loadOptions.core ||= {};
10810
- if (loadOptions.core.baseUrl === void 0) {
10811
- loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
10812
- }
10813
- delete loadOptions.baseUri;
10814
- delete loadOptions.baseUrl;
10815
- }
10816
10122
  return loadOptions;
10817
10123
  }
10818
10124
  function normalizeError(error, message) {
@@ -10826,9 +10132,48 @@ function normalizeError(error, message) {
10826
10132
  }
10827
10133
  function unavailableCoreApiMethod(methodName) {
10828
10134
  return () => {
10829
- throw new Error(`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSource().`);
10135
+ throw new Error(`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSourceSync().`);
10830
10136
  };
10831
10137
  }
10138
+ function getDataSourceName(data, options) {
10139
+ var _a, _b, _c;
10140
+ const explicitName = (_a = options.core) == null ? void 0 : _a.name;
10141
+ if (explicitName !== void 0) {
10142
+ if (typeof explicitName !== "string" || !explicitName.trim())
10143
+ throw new Error("Data source name must be a non-empty string.");
10144
+ return explicitName;
10145
+ }
10146
+ if (data && typeof data === "object") {
10147
+ const named = data;
10148
+ if (typeof named.name === "string" && named.name.trim())
10149
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
10150
+ const metadata = (_b = named.schema) == null ? void 0 : _b.metadata;
10151
+ const embeddedName = metadata instanceof Map ? metadata.get("name") : metadata == null ? void 0 : metadata.name;
10152
+ if (typeof embeddedName === "string" && embeddedName.trim())
10153
+ return embeddedName;
10154
+ }
10155
+ if (typeof data === "string") {
10156
+ try {
10157
+ const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
10158
+ if (!["data:", "blob:"].includes(url.protocol)) {
10159
+ let basename = url.pathname.split("/").filter(Boolean).pop();
10160
+ if (basename) {
10161
+ try {
10162
+ basename = decodeURIComponent(basename);
10163
+ } catch {
10164
+ }
10165
+ return removeFileExtension(basename);
10166
+ }
10167
+ }
10168
+ } catch {
10169
+ }
10170
+ }
10171
+ return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
10172
+ }
10173
+ function removeFileExtension(name) {
10174
+ const extension = name.lastIndexOf(".");
10175
+ return extension > 0 ? name.slice(0, extension) : name;
10176
+ }
10832
10177
 
10833
10178
  // dist/loader-utils/lib/sources/data-source-manager.js
10834
10179
  var DataSourceManager = class {
@@ -10937,8 +10282,8 @@ var DataSourceManager = class {
10937
10282
  unsubscribe({ consumerId }) {
10938
10283
  const consumer = this.consumers[consumerId];
10939
10284
  if (consumer) {
10940
- for (const requestId2 in consumer) {
10941
- const request = consumer[requestId2];
10285
+ for (const requestId in consumer) {
10286
+ const request = consumer[requestId];
10942
10287
  const dataSourceEntry = this.dataSources[request.dataSourceId];
10943
10288
  dataSourceEntry == null ? void 0 : dataSourceEntry.unsubscribe(request);
10944
10289
  }
@@ -10947,13 +10292,13 @@ var DataSourceManager = class {
10947
10292
  }
10948
10293
  }
10949
10294
  /** Subscribes a consumer to a managed DataSource. */
10950
- subscribe({ dataSourceId, onChange, consumerId, requestId: requestId2 = "default" }) {
10295
+ subscribe({ dataSourceId, onChange, consumerId, requestId = "default" }) {
10951
10296
  const normalizedDataSourceId = this.normalizeDataSourceId(dataSourceId);
10952
10297
  if (dataSourceId.startsWith(this.protocol) && !this.dataSources[normalizedDataSourceId]) {
10953
10298
  this.add({ dataSourceId: normalizedDataSourceId, dataSource: null, persistent: false });
10954
10299
  }
10955
10300
  const dataSourceEntry = this.dataSources[normalizedDataSourceId];
10956
- this.track(consumerId, requestId2, dataSourceEntry, onChange);
10301
+ this.track(consumerId, requestId, dataSourceEntry, onChange);
10957
10302
  return dataSourceEntry == null ? void 0 : dataSourceEntry.getDataSource();
10958
10303
  }
10959
10304
  /** Schedules pruning of unused non-persistent DataSources. */
@@ -10996,10 +10341,10 @@ var DataSourceManager = class {
10996
10341
  throw new Error("DataSourceManager.getOrCreate requires dataSourceId or data.");
10997
10342
  }
10998
10343
  /** Tracks one consumer request against one managed DataSource entry. */
10999
- track(consumerId, requestId2, dataSourceEntry, onChange) {
10344
+ track(consumerId, requestId, dataSourceEntry, onChange) {
11000
10345
  this.consumers[consumerId] = this.consumers[consumerId] || /* @__PURE__ */ Object.create(null);
11001
10346
  const consumer = this.consumers[consumerId];
11002
- let request = consumer[requestId2];
10347
+ let request = consumer[requestId];
11003
10348
  const oldDataSourceEntry = (request == null ? void 0 : request.dataSourceId) && this.dataSources[request.dataSourceId];
11004
10349
  if (oldDataSourceEntry) {
11005
10350
  oldDataSourceEntry.unsubscribe(request);
@@ -11012,7 +10357,7 @@ var DataSourceManager = class {
11012
10357
  } else {
11013
10358
  request = { onChange, dataSourceId: dataSourceEntry.id };
11014
10359
  }
11015
- consumer[requestId2] = request;
10360
+ consumer[requestId] = request;
11016
10361
  dataSourceEntry.subscribe(request);
11017
10362
  }
11018
10363
  }
@@ -11570,11 +10915,11 @@ function throwIfScanAborted(signal) {
11570
10915
 
11571
10916
  // dist/loader-utils/lib/scan-utils/scan-query-metadata.js
11572
10917
  var import_crs = require("@math.gl/geospatial/crs");
11573
- function emitScanExecutionTelemetry(callback, telemetry) {
10918
+ function emitQueryComplete(callback, summary) {
11574
10919
  if (!callback)
11575
10920
  return;
11576
10921
  try {
11577
- callback(telemetry);
10922
+ callback(summary);
11578
10923
  } catch {
11579
10924
  }
11580
10925
  }
@@ -11596,6 +10941,7 @@ function createScanQueryMetadata(options) {
11596
10941
  metadata: field.metadata || Object.freeze({})
11597
10942
  });
11598
10943
  });
10944
+ const queryCapabilities = Object.freeze({ ...options.capabilities });
11599
10945
  return Object.freeze({
11600
10946
  sourceType: options.sourceType,
11601
10947
  queryType: options.queryType,
@@ -11604,7 +10950,8 @@ function createScanQueryMetadata(options) {
11604
10950
  description: options.description,
11605
10951
  schema,
11606
10952
  columns: Object.freeze(columns),
11607
- capabilities: Object.freeze({ ...options.capabilities }),
10953
+ capabilities: queryCapabilities,
10954
+ queryCapabilities,
11608
10955
  spatial: options.spatial ? Object.freeze({
11609
10956
  ...options.spatial,
11610
10957
  bounds: options.spatial.bounds ? Object.freeze({
@@ -11641,6 +10988,13 @@ function getNonEmptyMetadataValue(metadata, key) {
11641
10988
  const value = metadata == null ? void 0 : metadata[key];
11642
10989
  return value || void 0;
11643
10990
  }
10991
+ function createQueryMetadata(options) {
10992
+ const { queryCapabilities, ...metadataOptions } = options;
10993
+ return createScanQueryMetadata({
10994
+ ...metadataOptions,
10995
+ capabilities: queryCapabilities
10996
+ });
10997
+ }
11644
10998
 
11645
10999
  // dist/loader-utils/lib/scan-utils/table-query.js
11646
11000
  function planTableQuery(sourceColumnNames, options = {}) {
@@ -11684,14 +11038,21 @@ function validateTableQueryLimit(limit) {
11684
11038
  throw new Error("Table query limit must be a non-negative safe integer.");
11685
11039
  }
11686
11040
  }
11041
+ function validateTableQueryOffset(offset) {
11042
+ if (offset !== void 0 && (!Number.isSafeInteger(offset) || offset < 0)) {
11043
+ throw new Error("Table query offset must be a non-negative safe integer.");
11044
+ }
11045
+ }
11687
11046
 
11688
11047
  // dist/loader-utils/lib/scan-utils/table-scan-batch.js
11689
11048
  function makeTableScanBatch(table) {
11690
11049
  return { ...table, batchType: "data", length: table.data.numRows };
11691
11050
  }
11692
11051
  async function* executeTableScanBatches(readBatches, options = {}, operators = {}) {
11693
- var _a;
11052
+ var _a, _b, _c, _d, _e;
11694
11053
  validateTableQueryLimit(options.limit);
11054
+ validateTableQueryOffset(options.offset);
11055
+ let skip = options.offset ?? 0;
11695
11056
  const startedAt = Date.now();
11696
11057
  let sourcesRead = 0;
11697
11058
  let batchesRead = 0;
@@ -11705,6 +11066,7 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11705
11066
  let executionError;
11706
11067
  let remaining = options.limit === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, options.limit);
11707
11068
  try {
11069
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
11708
11070
  if (remaining <= 0) {
11709
11071
  earlyTerminationReason = "limit";
11710
11072
  return;
@@ -11715,36 +11077,42 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11715
11077
  earlyTerminationReason = "limit";
11716
11078
  return;
11717
11079
  }
11080
+ (_b = options.signal) == null ? void 0 : _b.throwIfAborted();
11718
11081
  batchesRead++;
11719
11082
  rowsRead += batch.length;
11720
- const filteredBatch = (operators.filter || filterTableBatch)(batch, options.predicate);
11083
+ const filteredBatch = await (operators.filter || filterTableBatch)(batch, options.predicate, options.signal);
11084
+ (_c = options.signal) == null ? void 0 : _c.throwIfAborted();
11721
11085
  if (options.predicate) {
11722
11086
  rowsTested += batch.length;
11723
11087
  rowsRetained += filteredBatch.length;
11724
11088
  }
11725
- const projectedBatch = (operators.project || projectTableBatch)(filteredBatch, options.columns);
11726
- if (projectedBatch.length <= remaining) {
11727
- remaining -= projectedBatch.length;
11728
- rowsReturned += projectedBatch.length;
11729
- yield projectedBatch;
11730
- } else {
11731
- const outputBatch = truncateTableBatch(projectedBatch, remaining);
11732
- rowsReturned += outputBatch.length;
11089
+ if (skip >= filteredBatch.length && (skip > 0 || options.skipEmptyBatches)) {
11090
+ skip -= filteredBatch.length;
11091
+ continue;
11092
+ }
11093
+ const end = Math.min(filteredBatch.length, skip + remaining);
11094
+ const window2 = skip || end < filteredBatch.length ? sliceTableBatch(filteredBatch, skip, end) : filteredBatch;
11095
+ skip = 0;
11096
+ const output = (operators.project || projectTableBatch)(window2, options.columns);
11097
+ remaining -= window2.length;
11098
+ rowsReturned += output.length;
11099
+ if (remaining === 0)
11733
11100
  earlyTerminationReason = "limit";
11734
- yield outputBatch;
11101
+ yield output;
11102
+ if (remaining === 0)
11735
11103
  return;
11736
- }
11104
+ (_d = options.signal) == null ? void 0 : _d.throwIfAborted();
11737
11105
  }
11738
11106
  status = "completed";
11739
11107
  } catch (error) {
11740
- status = ((_a = options.signal) == null ? void 0 : _a.aborted) ? "cancelled" : "failed";
11108
+ status = ((_e = options.signal) == null ? void 0 : _e.aborted) ? "cancelled" : "failed";
11741
11109
  executionError = error;
11742
11110
  throw error;
11743
11111
  } finally {
11744
11112
  if (status === "early-terminated" && !earlyTerminationReason) {
11745
11113
  earlyTerminationReason = "consumer-return";
11746
11114
  }
11747
- emitScanExecutionTelemetry(options.onTelemetry, Object.freeze({
11115
+ emitQueryComplete(options.onQueryComplete, Object.freeze({
11748
11116
  status,
11749
11117
  sourcesPlanned: 1,
11750
11118
  sourcesRead,
@@ -11765,22 +11133,26 @@ async function* executeTableScanBatches(readBatches, options = {}, operators = {
11765
11133
  }
11766
11134
  }
11767
11135
  function truncateTableBatch(batch, length) {
11136
+ return sliceTableBatch(batch, 0, length);
11137
+ }
11138
+ function sliceTableBatch(batch, start, end) {
11139
+ const length = end - start;
11768
11140
  if (batch.shape === "object-row-table" || batch.shape === "array-row-table") {
11769
- return { ...batch, data: batch.data.slice(0, length), length };
11141
+ return { ...batch, data: batch.data.slice(start, end), length };
11770
11142
  }
11771
11143
  if (batch.shape === "columnar-table") {
11772
11144
  return {
11773
11145
  ...batch,
11774
11146
  data: Object.fromEntries(Object.entries(batch.data).map(([name, values]) => [
11775
11147
  name,
11776
- Array.from(values).slice(0, length)
11148
+ Array.from(values).slice(start, end)
11777
11149
  ])),
11778
11150
  length
11779
11151
  };
11780
11152
  }
11781
11153
  if (batch.shape === "arrow-table")
11782
- return { ...batch, data: batch.data.slice(0, length), length };
11783
- return { ...batch, features: batch.features.slice(0, length), length };
11154
+ return { ...batch, data: batch.data.slice(start, end), length };
11155
+ return { ...batch, features: batch.features.slice(start, end), length };
11784
11156
  }
11785
11157
  function projectTableBatch(batch, columns) {
11786
11158
  if (columns === void 0)
@@ -12761,4 +12133,186 @@ function getXYZTileGridOptions(metadata) {
12761
12133
  function isClose(actual, expected) {
12762
12134
  return Number.isFinite(actual) && Math.abs(actual - expected) <= Math.abs(expected) * 1e-10;
12763
12135
  }
12136
+
12137
+ // dist/loader-utils/lib/scan-utils/logical-table-query.js
12138
+ function normalizeTableQuery(sourceColumnNames, query = {}) {
12139
+ if (!query || typeof query !== "object" || Array.isArray(query)) {
12140
+ throw new Error("Table query must be an object.");
12141
+ }
12142
+ for (const key of Object.keys(query)) {
12143
+ if (!["from", "select", "where", "offset", "limit"].includes(key)) {
12144
+ throw new Error(`Unsupported table query option: ${key}`);
12145
+ }
12146
+ }
12147
+ if (query.select !== void 0 && (!Array.isArray(query.select) || query.select.length === 0)) {
12148
+ throw new Error("Table query select must be a non-empty array.");
12149
+ }
12150
+ validateTableReference(query.from);
12151
+ validateTableQueryOffset(query.offset);
12152
+ validateTableQueryLimit(query.limit);
12153
+ if (query.where !== void 0) {
12154
+ validateColumnarPredicate(query.where, new Set(sourceColumnNames));
12155
+ }
12156
+ const outputNames = /* @__PURE__ */ new Set();
12157
+ const select = (query.select ?? sourceColumnNames).map((selection) => {
12158
+ if (typeof selection !== "string" && (!selection || typeof selection !== "object" || Array.isArray(selection))) {
12159
+ throw new Error("Table query selection must be a column name or {column, as}.");
12160
+ }
12161
+ if (typeof selection !== "string" && Object.keys(selection).some((key) => key !== "column" && key !== "as")) {
12162
+ throw new Error("Unsupported table query selection field.");
12163
+ }
12164
+ const column = typeof selection === "string" ? selection : selection.column;
12165
+ const outputName = typeof selection === "string" ? selection : selection.as === void 0 ? column : selection.as;
12166
+ if (typeof column !== "string" || !sourceColumnNames.includes(column)) {
12167
+ throw new Error(`Table query column not found: ${column}`);
12168
+ }
12169
+ if (typeof outputName !== "string" || outputName.length === 0) {
12170
+ throw new Error("Table query output name must be a non-empty string.");
12171
+ }
12172
+ if (outputNames.has(outputName)) {
12173
+ throw new Error(`Duplicate table query output name: ${outputName}`);
12174
+ }
12175
+ outputNames.add(outputName);
12176
+ return Object.freeze({ column, as: outputName });
12177
+ });
12178
+ planTableQuery(sourceColumnNames, {
12179
+ columns: [...new Set(select.map((selection) => selection.column))],
12180
+ predicate: query.where,
12181
+ limit: query.limit
12182
+ });
12183
+ return Object.freeze({
12184
+ select: Object.freeze(select),
12185
+ ...query.from === void 0 ? {} : { from: typeof query.from === "string" ? query.from : Object.freeze({ ...query.from }) },
12186
+ ...query.where === void 0 ? {} : { where: query.where },
12187
+ ...query.offset === void 0 ? {} : { offset: query.offset },
12188
+ ...query.limit === void 0 ? {} : { limit: query.limit }
12189
+ });
12190
+ }
12191
+ function planLogicalTableQuery(sourceColumnNames, query = {}) {
12192
+ const normalized = normalizeTableQuery(sourceColumnNames, query);
12193
+ const plan = planTableQuery(sourceColumnNames, {
12194
+ columns: [...new Set(normalized.select.map((selection) => selection.column))],
12195
+ predicate: normalized.where,
12196
+ limit: normalized.limit
12197
+ });
12198
+ const steps = [];
12199
+ for (const step of plan) {
12200
+ if (step.kind === "limit" && normalized.offset !== void 0)
12201
+ steps.push(Object.freeze({ kind: "offset", offset: normalized.offset }));
12202
+ steps.push(step.kind === "project" ? Object.freeze({ kind: "project", select: normalized.select }) : step);
12203
+ }
12204
+ if (normalized.limit === void 0 && normalized.offset !== void 0)
12205
+ steps.push(Object.freeze({ kind: "offset", offset: normalized.offset }));
12206
+ return Object.freeze(steps);
12207
+ }
12208
+ function validateTableReference(reference) {
12209
+ if (reference === void 0)
12210
+ return;
12211
+ if (typeof reference === "string" && reference.trim())
12212
+ return;
12213
+ if (reference && typeof reference === "object" && !Array.isArray(reference)) {
12214
+ const value = reference;
12215
+ if (Object.keys(value).every((key) => key === "source" || key === "table") && typeof value.source === "string" && value.source.trim() && typeof value.table === "string" && value.table.trim())
12216
+ return;
12217
+ }
12218
+ throw new Error("FROM must be a source name or {source, table} with non-empty names.");
12219
+ }
12220
+
12221
+ // dist/loader-utils/lib/files/read-range-response.js
12222
+ async function readRangeResponse(response, offset, length, signal) {
12223
+ var _a, _b, _c;
12224
+ if (typeof offset === "number" && (!Number.isSafeInteger(offset) || offset < 0) || typeof offset === "bigint" && offset < 0n || !Number.isSafeInteger(length) || length <= 0) {
12225
+ await ((_a = response.body) == null ? void 0 : _a.cancel().catch(() => {
12226
+ }));
12227
+ throw new RangeError("Invalid HTTP byte range");
12228
+ }
12229
+ const start = BigInt(offset);
12230
+ const end = start + BigInt(length) - 1n;
12231
+ const value = response.headers.get("Content-Range");
12232
+ const match = value === null ? null : /^bytes (\d+)-(\d+)\/(\d+|\*)$/.exec(value);
12233
+ if (response.status !== 206 || value !== null && (!match || BigInt(match[1]) !== start || BigInt(match[2]) !== end || match[3] !== "*" && BigInt(match[3]) <= end)) {
12234
+ await ((_b = response.body) == null ? void 0 : _b.cancel().catch(() => {
12235
+ }));
12236
+ throw new Error("HTTP range requires 206 and matching Content-Range when visible");
12237
+ }
12238
+ const reader = (_c = response.body) == null ? void 0 : _c.getReader();
12239
+ if (!reader)
12240
+ throw new Error("HTTP range response has no body");
12241
+ let received = 0;
12242
+ const abort = () => {
12243
+ void reader.cancel(signal == null ? void 0 : signal.reason).catch(() => {
12244
+ });
12245
+ };
12246
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
12247
+ try {
12248
+ signal == null ? void 0 : signal.throwIfAborted();
12249
+ const bytes = new Uint8Array(length);
12250
+ for (; ; ) {
12251
+ const chunk = await reader.read();
12252
+ signal == null ? void 0 : signal.throwIfAborted();
12253
+ if (chunk.done)
12254
+ break;
12255
+ if (received + chunk.value.byteLength > length)
12256
+ throw new Error("HTTP range body exceeds requested length");
12257
+ bytes.set(chunk.value, received);
12258
+ received += chunk.value.byteLength;
12259
+ }
12260
+ if (received !== length)
12261
+ throw new Error("HTTP range body has truncated length");
12262
+ return bytes;
12263
+ } catch (error) {
12264
+ await reader.cancel(error).catch(() => {
12265
+ });
12266
+ throw error;
12267
+ } finally {
12268
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12269
+ reader.releaseLock();
12270
+ }
12271
+ }
12272
+
12273
+ // dist/loader-utils/lib/pace-batch-iterator.js
12274
+ function validateBatchDeliveryRate(rate) {
12275
+ if (!Number.isFinite(rate) || rate < 0) {
12276
+ throw new RangeError("core.batchMaxRowsPerSecond must be a finite nonnegative number");
12277
+ }
12278
+ }
12279
+ async function* paceBatchIterator(batches, { batchMaxRowsPerSecond = 0, getRowCount, signal }) {
12280
+ validateBatchDeliveryRate(batchMaxRowsPerSecond);
12281
+ signal == null ? void 0 : signal.throwIfAborted();
12282
+ if (batchMaxRowsPerSecond === 0) {
12283
+ yield* batches;
12284
+ return;
12285
+ }
12286
+ let deadline = 0;
12287
+ for await (const batch of batches) {
12288
+ signal == null ? void 0 : signal.throwIfAborted();
12289
+ const rowCount = getRowCount(batch);
12290
+ if (rowCount !== void 0 && rowCount > 0) {
12291
+ let remaining = deadline - performance.now();
12292
+ while (remaining > 0) {
12293
+ await waitForBatch(Math.min(Math.ceil(remaining), 2 ** 31 - 1), signal);
12294
+ remaining = deadline - performance.now();
12295
+ }
12296
+ signal == null ? void 0 : signal.throwIfAborted();
12297
+ deadline = performance.now() + rowCount / batchMaxRowsPerSecond * 1e3;
12298
+ }
12299
+ yield batch;
12300
+ signal == null ? void 0 : signal.throwIfAborted();
12301
+ }
12302
+ }
12303
+ function waitForBatch(delay, signal) {
12304
+ signal == null ? void 0 : signal.throwIfAborted();
12305
+ return new Promise((resolve2, reject) => {
12306
+ const timer = setTimeout(() => {
12307
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12308
+ resolve2();
12309
+ }, delay);
12310
+ function abort() {
12311
+ clearTimeout(timer);
12312
+ signal == null ? void 0 : signal.removeEventListener("abort", abort);
12313
+ reject(signal == null ? void 0 : signal.reason);
12314
+ }
12315
+ signal == null ? void 0 : signal.addEventListener("abort", abort, { once: true });
12316
+ });
12317
+ }
12764
12318
  //# sourceMappingURL=index.cjs.map