@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.
- package/GEOARROW-README.md +1 -1
- package/README.md +4 -2
- package/SCAN-README.md +1 -1
- package/SCHEMA-UTILS-README.md +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
- package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
- package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.cjs +5 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.cjs.map +2 -2
- package/dist/arrow-geometry/feature-collection-to-arrow.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js +5 -1
- package/dist/arrow-geometry/feature-collection-to-arrow.js.map +1 -1
- package/dist/arrow-geometry/feature-table.cjs +6 -2
- package/dist/arrow-geometry/feature-table.cjs.map +2 -2
- package/dist/arrow-geometry/feature-table.d.ts.map +1 -1
- package/dist/arrow-geometry/feature-table.js +6 -2
- package/dist/arrow-geometry/feature-table.js.map +1 -1
- package/dist/arrow-geometry/geojson-table.cjs +295 -18
- package/dist/arrow-geometry/geojson-table.cjs.map +3 -3
- package/dist/arrow-geometry/geojson-table.d.ts +10 -3
- package/dist/arrow-geometry/geojson-table.d.ts.map +1 -1
- package/dist/arrow-geometry/geojson-table.js +23 -13
- package/dist/arrow-geometry/geojson-table.js.map +1 -1
- package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
- package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-codecs.js +1 -1
- package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
- package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
- package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
- package/dist/arrow-geometry/index.cjs +0 -11
- package/dist/arrow-geometry/index.cjs.map +2 -2
- package/dist/arrow-geometry/index.d.ts +0 -1
- package/dist/arrow-geometry/index.d.ts.map +1 -1
- package/dist/arrow-geometry/index.js +0 -1
- package/dist/arrow-geometry/index.js.map +1 -1
- package/dist/arrow-geometry/wkb-builder.cjs +3 -3
- package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
- package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
- package/dist/arrow-geometry/wkb-builder.js +1 -1
- package/dist/arrow-geometry/wkb-builder.js.map +1 -1
- package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
- package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
- package/dist/arrow-geometry/wkb-statistics.js +1 -1
- package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
- package/dist/arrow-worker-transport.cjs +173 -0
- package/dist/arrow-worker-transport.cjs.map +6 -0
- package/dist/arrow-worker-transport.d.ts +15 -0
- package/dist/arrow-worker-transport.d.ts.map +1 -0
- package/dist/arrow-worker-transport.js +151 -0
- package/dist/arrow-worker-transport.js.map +1 -0
- package/dist/cluster-source.cjs +6874 -0
- package/dist/cluster-source.cjs.map +6 -0
- package/dist/cluster-source.d.ts +2 -0
- package/dist/cluster-source.d.ts.map +1 -0
- package/dist/cluster-source.js +2 -0
- package/dist/cluster-source.js.map +1 -0
- package/dist/dist.dev.js +3035 -823
- package/dist/dist.min.js +3 -3
- package/dist/federated-table-scan-source.cjs +2447 -0
- package/dist/federated-table-scan-source.cjs.map +6 -0
- package/dist/federated-table-scan-source.d.ts +2 -0
- package/dist/federated-table-scan-source.d.ts.map +1 -0
- package/dist/federated-table-scan-source.js +2 -0
- package/dist/federated-table-scan-source.js.map +1 -0
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
- package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.cjs +4 -7
- package/dist/geoarrow/clustering/cluster-source.cjs.map +2 -2
- package/dist/geoarrow/clustering/cluster-source.d.ts.map +1 -1
- package/dist/geoarrow/clustering/cluster-source.js +1 -4
- package/dist/geoarrow/clustering/cluster-source.js.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.cjs +1 -0
- package/dist/geoarrow/convert-table-to-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/convert-table-to-geoarrow.js +2 -0
- package/dist/geoarrow/convert-table-to-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
- package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-bounds.js +3 -3
- package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
- package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
- package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-capabilities.js +1 -1
- package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs +6 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js +9 -4
- package/dist/geoarrow/geoarrow-converter/convert-geoarrow.js.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs +6 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +3 -3
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts.map +1 -1
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js +6 -4
- package/dist/geoarrow/geoarrow-converter/geoarrow-converter.js.map +1 -1
- package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
- package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-inspection.js +1 -1
- package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs +1 -1
- package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
- package/dist/geoarrow/geoarrow-stream.js +1 -1
- package/dist/geoarrow/geoarrow-stream.js.map +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
- package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
- package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.cjs.map +2 -2
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.d.ts.map +1 -1
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js +4 -8
- package/dist/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
- package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
- package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.cjs.map +2 -2
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts +2 -3
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.d.ts.map +1 -1
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js +0 -6
- package/dist/geoarrow/lib/table-converters/convert-geoarrow-table.js.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.cjs.map +2 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.d.ts.map +1 -1
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js +3 -2
- package/dist/geoarrow/mesharrow/arrow-fixed-size-list-utils.js.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs +44 -2
- package/dist/geoarrow/metadata/geoarrow-metadata.cjs.map +4 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.d.ts.map +1 -1
- package/dist/geoarrow/metadata/geoarrow-metadata.js +3 -4
- package/dist/geoarrow/metadata/geoarrow-metadata.js.map +1 -1
- package/dist/index.cjs +738 -1372
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/api/create-data-source.d.ts +20 -9
- package/dist/lib/api/create-data-source.d.ts.map +1 -1
- package/dist/lib/api/create-data-source.js +55 -45
- package/dist/lib/api/create-data-source.js.map +1 -1
- package/dist/lib/api/encode.d.ts +1 -1
- package/dist/lib/api/encode.d.ts.map +1 -1
- package/dist/lib/api/encode.js +11 -2
- package/dist/lib/api/encode.js.map +1 -1
- package/dist/lib/api/load-in-batches.d.ts +3 -2
- package/dist/lib/api/load-in-batches.d.ts.map +1 -1
- package/dist/lib/api/load-in-batches.js.map +1 -1
- package/dist/lib/api/load-loader.d.ts +3 -3
- package/dist/lib/api/load-loader.d.ts.map +1 -1
- package/dist/lib/api/load-loader.js +15 -19
- package/dist/lib/api/load-loader.js.map +1 -1
- package/dist/lib/api/load.d.ts +7 -3
- package/dist/lib/api/load.d.ts.map +1 -1
- package/dist/lib/api/load.js +17 -67
- package/dist/lib/api/load.js.map +1 -1
- package/dist/lib/api/parse-file.d.ts +5 -3
- package/dist/lib/api/parse-file.d.ts.map +1 -1
- package/dist/lib/api/parse-file.js +12 -7
- package/dist/lib/api/parse-file.js.map +1 -1
- package/dist/lib/api/parse-in-batches.d.ts +5 -3
- package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
- package/dist/lib/api/parse-in-batches.js +61 -6
- package/dist/lib/api/parse-in-batches.js.map +1 -1
- package/dist/lib/api/parse-sync.d.ts +5 -3
- package/dist/lib/api/parse-sync.d.ts.map +1 -1
- package/dist/lib/api/parse-sync.js +8 -6
- package/dist/lib/api/parse-sync.js.map +1 -1
- package/dist/lib/api/parse.d.ts +5 -3
- package/dist/lib/api/parse.d.ts.map +1 -1
- package/dist/lib/api/parse.js +26 -15
- package/dist/lib/api/parse.js.map +1 -1
- package/dist/lib/api/select-loader.d.ts +4 -2
- package/dist/lib/api/select-loader.d.ts.map +1 -1
- package/dist/lib/api/select-loader.js +47 -53
- package/dist/lib/api/select-loader.js.map +1 -1
- package/dist/lib/api/select-source.d.ts.map +1 -1
- package/dist/lib/api/select-source.js +1 -1
- package/dist/lib/api/select-source.js.map +1 -1
- package/dist/lib/init.js +1 -1
- package/dist/lib/init.js.map +1 -1
- package/dist/lib/loader-utils/get-fetch-function.js +2 -2
- package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
- package/dist/lib/loader-utils/loggers.d.ts +2 -37
- package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
- package/dist/lib/loader-utils/loggers.js +2 -63
- package/dist/lib/loader-utils/loggers.js.map +1 -1
- package/dist/lib/loader-utils/native-arrow.d.ts +16 -0
- package/dist/lib/loader-utils/native-arrow.d.ts.map +1 -0
- package/dist/lib/loader-utils/native-arrow.js +84 -0
- package/dist/lib/loader-utils/native-arrow.js.map +1 -0
- package/dist/lib/loader-utils/option-defaults.d.ts +3 -2
- package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-defaults.js +9 -10
- package/dist/lib/loader-utils/option-defaults.js.map +1 -1
- package/dist/lib/loader-utils/option-utils.d.ts +0 -6
- package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-utils.js +31 -114
- package/dist/lib/loader-utils/option-utils.js.map +1 -1
- package/dist/loader-utils/format-types.d.ts +3 -0
- package/dist/loader-utils/format-types.d.ts.map +1 -1
- package/dist/loader-utils/index.cjs +838 -1284
- package/dist/loader-utils/index.cjs.map +3 -3
- package/dist/loader-utils/index.d.ts +16 -7
- package/dist/loader-utils/index.d.ts.map +1 -1
- package/dist/loader-utils/index.js +8 -4
- package/dist/loader-utils/index.js.map +1 -1
- package/dist/loader-utils/json-loader.js +1 -1
- package/dist/loader-utils/json-loader.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.d.ts +4 -0
- package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/http-file-transport.js +45 -1
- package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -1
- package/dist/loader-utils/lib/files/http-file-types.d.ts +2 -0
- package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -1
- package/dist/loader-utils/lib/files/read-range-response.d.ts +3 -0
- package/dist/loader-utils/lib/files/read-range-response.d.ts.map +1 -0
- package/dist/loader-utils/lib/files/read-range-response.js +62 -0
- package/dist/loader-utils/lib/files/read-range-response.js.map +1 -0
- package/dist/loader-utils/lib/log-utils/log.d.ts +23 -1
- package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -1
- package/dist/loader-utils/lib/log-utils/log.js +32 -1
- package/dist/loader-utils/lib/log-utils/log.js.map +1 -1
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts +14 -0
- package/dist/loader-utils/lib/pace-batch-iterator.d.ts.map +1 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js +51 -0
- package/dist/loader-utils/lib/pace-batch-iterator.js.map +1 -0
- package/dist/loader-utils/lib/request-utils/request-credentials.js +1 -1
- package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts +43 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.d.ts.map +1 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js +104 -0
- package/dist/loader-utils/lib/scan-utils/logical-table-query.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/{experimental-scan-options.d.ts → query-options.d.ts} +5 -8
- package/dist/loader-utils/lib/scan-utils/query-options.d.ts.map +1 -0
- package/dist/{schema-utils/lib/table/batch-builder/table-batch-aggregator.js → loader-utils/lib/scan-utils/query-options.js} +1 -1
- package/dist/loader-utils/lib/scan-utils/query-options.js.map +1 -0
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +54 -18
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +16 -6
- package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts +54 -3
- package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-query.js +6 -0
- package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +6 -3
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -1
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +33 -18
- package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.d.ts +4 -0
- package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/data-source.js +53 -14
- package/dist/loader-utils/lib/sources/data-source.js.map +1 -1
- package/dist/loader-utils/lib/sources/image-source.d.ts +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts +30 -0
- package/dist/loader-utils/lib/sources/table-source-collection.d.ts.map +1 -0
- package/dist/loader-utils/lib/{scan-utils/experimental-scan-options.js → sources/table-source-collection.js} +1 -1
- package/dist/loader-utils/lib/sources/table-source-collection.js.map +1 -0
- package/dist/loader-utils/lib/sources/utils/utils.js +1 -1
- package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -1
- package/dist/loader-utils/lib/sources/vector-source.d.ts +4 -3
- package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +3 -2
- package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +2 -5
- package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -1
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +40 -21
- package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -1
- package/dist/loader-utils/loader-types.d.ts +120 -91
- package/dist/loader-utils/loader-types.d.ts.map +1 -1
- package/dist/loader-utils/loader-types.js.map +1 -1
- package/dist/loader-utils/source-types.d.ts +7 -5
- package/dist/loader-utils/source-types.d.ts.map +1 -1
- package/dist/loader-utils/source-types.js +9 -1
- package/dist/loader-utils/source-types.js.map +1 -1
- package/dist/null-loader.d.ts +0 -18
- package/dist/null-loader.d.ts.map +1 -1
- package/dist/null-loader.js +1 -19
- package/dist/null-loader.js.map +1 -1
- package/dist/null-worker-node.js +771 -82
- package/dist/null-worker.js +742 -81
- package/dist/polyfills/images/encode-image-node.d.ts +18 -15
- package/dist/polyfills/images/encode-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/encode-image-node.js +19 -33
- package/dist/polyfills/images/encode-image-node.js.map +1 -1
- package/dist/polyfills/images/image-codecs-node.d.ts +2 -6
- package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -1
- package/dist/polyfills/images/image-codecs-node.js +2 -24
- package/dist/polyfills/images/image-codecs-node.js.map +1 -1
- package/dist/polyfills/images/load-sharp.d.ts +3 -0
- package/dist/polyfills/images/load-sharp.d.ts.map +1 -0
- package/dist/polyfills/images/load-sharp.js +11 -0
- package/dist/polyfills/images/load-sharp.js.map +1 -0
- package/dist/polyfills/images/node-image-bitmap.d.ts +1 -1
- package/dist/polyfills/images/node-image-bitmap.js +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts +1 -1
- package/dist/polyfills/images/node-image-formats.d.ts.map +1 -1
- package/dist/polyfills/images/node-image-formats.js +10 -4
- package/dist/polyfills/images/node-image-formats.js.map +1 -1
- package/dist/polyfills/images/parse-image-node.d.ts +10 -2
- package/dist/polyfills/images/parse-image-node.d.ts.map +1 -1
- package/dist/polyfills/images/parse-image-node.js +20 -32
- package/dist/polyfills/images/parse-image-node.js.map +1 -1
- package/dist/polyfills/index.cjs +76 -151
- package/dist/polyfills/index.d.ts.map +1 -1
- package/dist/polyfills/index.js +2 -2
- package/dist/polyfills/index.js.map +1 -1
- package/dist/scan/arrow-execution/expressions.cjs +134 -0
- package/dist/scan/arrow-execution/expressions.cjs.map +7 -0
- package/dist/scan/arrow-execution/expressions.d.ts +11 -0
- package/dist/scan/arrow-execution/expressions.d.ts.map +1 -0
- package/dist/scan/arrow-execution/expressions.js +86 -0
- package/dist/scan/arrow-execution/expressions.js.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs +255 -0
- package/dist/scan/arrow-execution/filter-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts +18 -0
- package/dist/scan/arrow-execution/filter-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js +224 -0
- package/dist/scan/arrow-execution/filter-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs +70 -0
- package/dist/scan/arrow-execution/project-arrow-table.cjs.map +7 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts +8 -0
- package/dist/scan/arrow-execution/project-arrow-table.d.ts.map +1 -0
- package/dist/scan/arrow-execution/project-arrow-table.js +39 -0
- package/dist/scan/arrow-execution/project-arrow-table.js.map +1 -0
- package/dist/scan/arrow-execution.cjs +34 -0
- package/dist/scan/arrow-execution.cjs.map +7 -0
- package/dist/scan/arrow-execution.d.ts +4 -0
- package/dist/scan/arrow-execution.d.ts.map +1 -0
- package/dist/scan/arrow-execution.js +6 -0
- package/dist/scan/arrow-execution.js.map +1 -0
- package/dist/scan/arrow-query.cjs.map +1 -1
- package/dist/scan/arrow-query.d.ts +1 -1
- package/dist/scan/arrow-query.d.ts.map +1 -1
- package/dist/scan/catalog-query-source.cjs +122 -0
- package/dist/scan/catalog-query-source.cjs.map +7 -0
- package/dist/scan/catalog-query-source.d.ts +6 -0
- package/dist/scan/catalog-query-source.d.ts.map +1 -0
- package/dist/scan/catalog-query-source.js +115 -0
- package/dist/scan/catalog-query-source.js.map +1 -0
- package/dist/scan/federated-table-scan-source.cjs +38 -38
- package/dist/scan/federated-table-scan-source.cjs.map +2 -2
- package/dist/scan/federated-table-scan-source.d.ts +6 -10
- package/dist/scan/federated-table-scan-source.d.ts.map +1 -1
- package/dist/scan/federated-table-scan-source.js +35 -35
- package/dist/scan/federated-table-scan-source.js.map +1 -1
- package/dist/scan/index.cjs +208 -4
- package/dist/scan/index.cjs.map +4 -4
- package/dist/scan/index.d.ts +13 -3
- package/dist/scan/index.d.ts.map +1 -1
- package/dist/scan/index.js +6 -1
- package/dist/scan/index.js.map +1 -1
- package/dist/scan/parse-sql-predicate.cjs +3 -294
- package/dist/scan/parse-sql-predicate.cjs.map +3 -3
- package/dist/scan/parse-sql-predicate.d.ts +6 -9
- package/dist/scan/parse-sql-predicate.d.ts.map +1 -1
- package/dist/scan/parse-sql-predicate.js +5 -314
- package/dist/scan/parse-sql-predicate.js.map +1 -1
- package/dist/scan/query-arrow-table-in-batches.cjs +75 -0
- package/dist/scan/query-arrow-table-in-batches.cjs.map +7 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts +8 -0
- package/dist/scan/query-arrow-table-in-batches.d.ts.map +1 -0
- package/dist/scan/query-arrow-table-in-batches.js +54 -0
- package/dist/scan/query-arrow-table-in-batches.js.map +1 -0
- package/dist/scan/query-arrow-table.cjs +65 -202
- package/dist/scan/query-arrow-table.cjs.map +3 -3
- package/dist/scan/query-arrow-table.d.ts +7 -40
- package/dist/scan/query-arrow-table.d.ts.map +1 -1
- package/dist/scan/query-arrow-table.js +51 -211
- package/dist/scan/query-arrow-table.js.map +1 -1
- package/dist/scan/query-open-source.cjs +52 -0
- package/dist/scan/query-open-source.cjs.map +7 -0
- package/dist/scan/query-open-source.d.ts +4 -0
- package/dist/scan/query-open-source.d.ts.map +1 -0
- package/dist/scan/query-open-source.js +26 -0
- package/dist/scan/query-open-source.js.map +1 -0
- package/dist/scan/query-progressive.cjs +190 -0
- package/dist/scan/query-progressive.cjs.map +7 -0
- package/dist/scan/query-progressive.d.ts +39 -0
- package/dist/scan/query-progressive.d.ts.map +1 -0
- package/dist/scan/query-progressive.js +173 -0
- package/dist/scan/query-progressive.js.map +1 -0
- package/dist/scan/query-pushdown.cjs +140 -0
- package/dist/scan/query-pushdown.cjs.map +7 -0
- package/dist/scan/query-pushdown.d.ts +14 -0
- package/dist/scan/query-pushdown.d.ts.map +1 -0
- package/dist/scan/query-pushdown.js +136 -0
- package/dist/scan/query-pushdown.js.map +1 -0
- package/dist/scan/query.cjs +381 -0
- package/dist/scan/query.cjs.map +7 -0
- package/dist/scan/query.d.ts +64 -0
- package/dist/scan/query.d.ts.map +1 -0
- package/dist/scan/query.js +419 -0
- package/dist/scan/query.js.map +1 -0
- package/dist/scan/resolve-query-source.cjs +59 -0
- package/dist/scan/resolve-query-source.cjs.map +7 -0
- package/dist/scan/resolve-query-source.d.ts +6 -0
- package/dist/scan/resolve-query-source.d.ts.map +1 -0
- package/dist/scan/resolve-query-source.js +37 -0
- package/dist/scan/resolve-query-source.js.map +1 -0
- package/dist/scan/rows-to-arrow.cjs +1 -28
- package/dist/scan/rows-to-arrow.cjs.map +2 -2
- package/dist/scan/rows-to-arrow.d.ts +3 -3
- package/dist/scan/rows-to-arrow.d.ts.map +1 -1
- package/dist/scan/rows-to-arrow.js +2 -32
- package/dist/scan/rows-to-arrow.js.map +1 -1
- package/dist/scan/scan-engine.cjs.map +2 -2
- package/dist/scan/scan-engine.d.ts +5 -5
- package/dist/scan/scan-engine.d.ts.map +1 -1
- package/dist/scan/scan-engine.js.map +1 -1
- package/dist/scan/sql-catalog.cjs +110 -0
- package/dist/scan/sql-catalog.cjs.map +7 -0
- package/dist/scan/sql-catalog.d.ts +47 -0
- package/dist/scan/sql-catalog.d.ts.map +1 -0
- package/dist/scan/sql-catalog.js +97 -0
- package/dist/scan/sql-catalog.js.map +1 -0
- package/dist/scan/table-query.cjs.map +2 -2
- package/dist/scan/table-query.d.ts +4 -1
- package/dist/scan/table-query.d.ts.map +1 -1
- package/dist/scan/table-query.js.map +1 -1
- package/dist/scan/vector-table-scan-source.cjs +14 -13
- package/dist/scan/vector-table-scan-source.cjs.map +3 -3
- package/dist/scan/vector-table-scan-source.d.ts +6 -5
- package/dist/scan/vector-table-scan-source.d.ts.map +1 -1
- package/dist/scan/vector-table-scan-source.js +17 -14
- package/dist/scan/vector-table-scan-source.js.map +1 -1
- package/dist/schema/geometry/geoarrow.d.ts +3 -6
- package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
- package/dist/schema/index.cjs +11 -7
- package/dist/schema/index.cjs.map +2 -2
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -2
- package/dist/schema/index.js.map +1 -1
- package/dist/schema-utils/index.cjs +690 -823
- package/dist/schema-utils/index.cjs.map +3 -3
- package/dist/schema-utils/index.d.ts +6 -5
- package/dist/schema-utils/index.d.ts.map +1 -1
- package/dist/schema-utils/index.js +6 -4
- package/dist/schema-utils/index.js.map +1 -1
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts +17 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.d.ts.map +1 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js +106 -0
- package/dist/schema-utils/lib/arrow/arrow-metadata.js.map +1 -0
- package/dist/schema-utils/lib/converters/convert.js +9 -2
- package/dist/schema-utils/lib/converters/convert.js.map +1 -1
- package/dist/schema-utils/lib/converters/types.d.ts +2 -0
- package/dist/schema-utils/lib/converters/types.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +4 -3
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +4 -4
- package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +4 -3
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +9 -2
- package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -1
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts +14 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.d.ts.map +1 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js +39 -0
- package/dist/schema-utils/lib/mesh/get-mesh-bounding-box.js.map +1 -0
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +2 -14
- package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/mesh-utils.js +1 -35
- package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts +2 -2
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -1
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +6 -5
- package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -1
- package/dist/schema-utils/lib/schema/deduce-table-schema.js +4 -2
- package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +9 -9
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +13 -46
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +9 -20
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +61 -73
- package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +4 -3
- package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/convert-batches.js +30 -9
- package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +6 -9
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +26 -15
- package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +4 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +33 -9
- package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts +3 -3
- package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/query-arrow-table.js +9 -23
- package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts +27 -0
- package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.d.ts.map +1 -0
- package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js +23 -0
- package/dist/schema-utils/lib/table/tables/convert-arrow-table-wrapper.js.map +1 -0
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +12 -10
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +15 -26
- package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts +6 -36
- package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/convert-table.js +5 -42
- package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.d.ts +3 -55
- package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/make-table.js +3 -59
- package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/row-utils.js +2 -2
- package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +18 -16
- package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-accessors.js +42 -31
- package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +6 -5
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +2 -2
- package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +3 -3
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -1
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +7 -4
- package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -1
- package/dist/vector-table-scan-source.cjs +1760 -0
- package/dist/vector-table-scan-source.cjs.map +6 -0
- package/dist/vector-table-scan-source.d.ts +2 -0
- package/dist/vector-table-scan-source.d.ts.map +1 -0
- package/dist/vector-table-scan-source.js +2 -0
- package/dist/vector-table-scan-source.js.map +1 -0
- package/dist/worker-utils/index.cjs +407 -1184
- package/dist/worker-utils/index.cjs.map +3 -3
- package/dist/worker-utils/index.d.ts +2 -8
- package/dist/worker-utils/index.d.ts.map +1 -1
- package/dist/worker-utils/index.js +1 -10
- package/dist/worker-utils/index.js.map +1 -1
- package/dist/worker-utils/lib/env-utils/version.js +1 -1
- package/dist/worker-utils/lib/env-utils/version.js.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -1
- package/dist/worker-utils/lib/library-utils/library-utils.js +3 -2
- package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -1
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js +8 -7
- package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts +5 -7
- package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/create-worker.js +76 -146
- package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/get-worker-url.js +5 -2
- package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +17 -45
- package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-api/process-on-worker.js +214 -312
- package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +36 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js +23 -0
- package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -0
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +1 -6
- package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +1 -0
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +3 -1
- package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -1
- package/dist/worker-utils/null-worker-node.js +836 -147
- package/dist/worker-utils/null-worker-node.js.map +4 -4
- package/dist/worker-utils/null-worker.js +804 -143
- package/dist/worker-utils/null-worker.js.map +4 -4
- package/dist/worker-utils/types.d.ts +55 -72
- package/dist/worker-utils/types.d.ts.map +1 -1
- package/package.json +126 -35
- package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
- package/src/arrow-geometry/feature-collection-to-arrow.ts +5 -1
- package/src/arrow-geometry/feature-table.ts +6 -2
- package/src/arrow-geometry/geojson-table.ts +32 -21
- package/src/arrow-geometry/geometry-codecs.ts +2 -2
- package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
- package/src/arrow-geometry/index.ts +0 -9
- package/src/arrow-geometry/wkb-builder.ts +2 -2
- package/src/arrow-geometry/wkb-statistics.ts +2 -2
- package/src/arrow-worker-transport.ts +225 -0
- package/src/cluster-source.ts +1 -0
- package/src/federated-table-scan-source.ts +1 -0
- package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
- package/src/geoarrow/clustering/cluster-source.ts +4 -7
- package/src/geoarrow/convert-table-to-geoarrow.ts +3 -1
- package/src/geoarrow/geoarrow-bounds.ts +3 -3
- package/src/geoarrow/geoarrow-capabilities.ts +1 -1
- package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
- package/src/geoarrow/geoarrow-converter/convert-geoarrow.ts +14 -9
- package/src/geoarrow/geoarrow-converter/geoarrow-converter.ts +9 -6
- package/src/geoarrow/geoarrow-inspection.ts +2 -2
- package/src/geoarrow/geoarrow-stream.ts +1 -1
- package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
- package/src/geoarrow/lib/feature-collection-converters/convert-geometry-column-to-binary-feature-collection.ts +4 -11
- package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
- package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
- package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
- package/src/geoarrow/lib/table-converters/convert-geoarrow-table.ts +8 -10
- package/src/geoarrow/mesharrow/arrow-fixed-size-list-utils.ts +3 -2
- package/src/geoarrow/metadata/geoarrow-metadata.ts +3 -4
- package/src/index.ts +1 -5
- package/src/lib/api/create-data-source.ts +148 -58
- package/src/lib/api/encode.ts +14 -3
- package/src/lib/api/load-in-batches.ts +15 -7
- package/src/lib/api/load-loader.ts +22 -21
- package/src/lib/api/load.ts +61 -127
- package/src/lib/api/parse-file.ts +42 -23
- package/src/lib/api/parse-in-batches.ts +122 -17
- package/src/lib/api/parse-sync.ts +37 -19
- package/src/lib/api/parse.ts +51 -30
- package/src/lib/api/select-loader.ts +54 -69
- package/src/lib/api/select-source.ts +7 -1
- package/src/lib/loader-utils/get-fetch-function.ts +2 -2
- package/src/lib/loader-utils/loggers.ts +2 -70
- package/src/lib/loader-utils/native-arrow.ts +109 -0
- package/src/lib/loader-utils/option-defaults.ts +9 -10
- package/src/lib/loader-utils/option-utils.ts +33 -122
- package/src/loader-utils/format-types.ts +4 -0
- package/src/loader-utils/index.ts +50 -9
- package/src/loader-utils/lib/files/http-file-transport.ts +65 -1
- package/src/loader-utils/lib/files/http-file-types.ts +2 -0
- package/src/loader-utils/lib/files/read-range-response.ts +66 -0
- package/src/loader-utils/lib/log-utils/log.ts +36 -1
- package/src/loader-utils/lib/pace-batch-iterator.ts +66 -0
- package/src/loader-utils/lib/request-utils/request-credentials.ts +1 -1
- package/src/loader-utils/lib/scan-utils/logical-table-query.ts +174 -0
- package/src/loader-utils/lib/scan-utils/query-options.ts +44 -0
- package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +80 -28
- package/src/loader-utils/lib/scan-utils/table-query.ts +76 -8
- package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +54 -29
- package/src/loader-utils/lib/sources/data-source.ts +57 -16
- package/src/loader-utils/lib/sources/image-source.ts +1 -1
- package/src/loader-utils/lib/sources/table-source-collection.ts +38 -0
- package/src/loader-utils/lib/sources/utils/utils.ts +1 -1
- package/src/loader-utils/lib/sources/vector-source.ts +3 -3
- package/src/loader-utils/lib/sources/vector-tile-source.ts +3 -2
- package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +5 -6
- package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +41 -24
- package/src/loader-utils/loader-types.ts +190 -111
- package/src/loader-utils/source-types.ts +17 -6
- package/src/null-loader.ts +1 -20
- package/src/polyfills/README.md +2 -2
- package/src/polyfills/images/encode-image-node.ts +44 -37
- package/src/polyfills/images/image-codecs-node.ts +2 -37
- package/src/polyfills/images/load-sharp.ts +13 -0
- package/src/polyfills/images/node-image-bitmap.ts +1 -1
- package/src/polyfills/images/node-image-formats.ts +10 -4
- package/src/polyfills/images/parse-image-node.ts +31 -40
- package/src/polyfills/index.ts +3 -3
- package/src/scan/arrow-execution/expressions.ts +116 -0
- package/src/scan/arrow-execution/filter-arrow-table.ts +298 -0
- package/src/scan/arrow-execution/project-arrow-table.ts +53 -0
- package/src/scan/arrow-execution.ts +7 -0
- package/src/scan/arrow-query.ts +3 -0
- package/src/scan/catalog-query-source.ts +132 -0
- package/src/scan/federated-table-scan-source.ts +64 -72
- package/src/scan/index.ts +57 -5
- package/src/scan/parse-sql-predicate.ts +14 -367
- package/src/scan/query-arrow-table-in-batches.ts +55 -0
- package/src/scan/query-arrow-table.ts +81 -271
- package/src/scan/query-open-source.ts +39 -0
- package/src/scan/query-progressive.ts +229 -0
- package/src/scan/query-pushdown.ts +184 -0
- package/src/scan/query.ts +597 -0
- package/src/scan/resolve-query-source.ts +47 -0
- package/src/scan/rows-to-arrow.ts +3 -39
- package/src/scan/scan-engine.ts +6 -6
- package/src/scan/sql-catalog.ts +167 -0
- package/src/scan/table-query.ts +6 -1
- package/src/scan/vector-table-scan-source.ts +22 -18
- package/src/schema/geometry/geoarrow.ts +8 -19
- package/src/schema/index.ts +3 -2
- package/src/schema-utils/index.ts +23 -8
- package/src/schema-utils/lib/arrow/arrow-metadata.ts +136 -0
- package/src/schema-utils/lib/converters/convert.ts +7 -2
- package/src/schema-utils/lib/converters/types.ts +2 -0
- package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +7 -9
- package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +10 -4
- package/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts +52 -0
- package/src/schema-utils/lib/mesh/mesh-utils.ts +3 -49
- package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +18 -8
- package/src/schema-utils/lib/schema/deduce-table-schema.ts +4 -2
- package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +21 -51
- package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +68 -83
- package/src/schema-utils/lib/table/batches/convert-batches.ts +41 -21
- package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +33 -19
- package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +48 -7
- package/src/schema-utils/lib/table/query-arrow-table.ts +14 -32
- package/src/schema-utils/lib/table/tables/convert-arrow-table-wrapper.ts +54 -0
- package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +30 -35
- package/src/schema-utils/lib/table/tables/convert-table.ts +11 -57
- package/src/schema-utils/lib/table/tables/make-table.ts +6 -70
- package/src/schema-utils/lib/table/tables/row-utils.ts +2 -2
- package/src/schema-utils/lib/table/tables/table-accessors.ts +66 -49
- package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +12 -14
- package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +13 -10
- package/src/vector-table-scan-source.ts +1 -0
- package/src/worker-utils/index.ts +2 -18
- package/src/worker-utils/lib/library-utils/library-utils.ts +3 -2
- package/src/worker-utils/lib/process-utils/child-process-proxy.ts +8 -7
- package/src/worker-utils/lib/worker-api/create-worker.ts +89 -188
- package/src/worker-utils/lib/worker-api/get-worker-url.ts +4 -3
- package/src/worker-utils/lib/worker-api/process-on-worker.ts +246 -402
- package/src/worker-utils/lib/worker-api/task-runtime.ts +66 -0
- package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +1 -6
- package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +2 -0
- package/src/worker-utils/types.ts +74 -109
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
- package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
- package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
- package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
- package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +0 -40
- package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/data-view-file.js +0 -68
- package/dist/loader-utils/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +0 -54
- package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-handle-file.js +0 -102
- package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +0 -45
- package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js +0 -13
- package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts +0 -57
- package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +0 -1
- package/dist/loader-utils/lib/file-provider/file-provider.js +0 -114
- package/dist/loader-utils/lib/file-provider/file-provider.js.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +0 -1
- package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +0 -1
- package/dist/schema/deprecated/mesh-utils.d.ts +0 -12
- package/dist/schema/deprecated/mesh-utils.d.ts.map +0 -1
- package/dist/schema/deprecated/mesh-utils.js +0 -37
- package/dist/schema/deprecated/mesh-utils.js.map +0 -1
- package/dist/schema-utils/arrow-transport.cjs +0 -691
- package/dist/schema-utils/arrow-transport.cjs.map +0 -6
- package/dist/schema-utils/arrow-transport.d.ts +0 -4
- package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
- package/dist/schema-utils/arrow-transport.js +0 -7
- package/dist/schema-utils/arrow-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
- package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
- package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
- package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +0 -10
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +0 -71
- package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +0 -19
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +0 -64
- package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +0 -20
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +0 -83
- package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +0 -21
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +0 -86
- package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +0 -24
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +0 -1
- package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts +0 -32
- package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +0 -1
- package/dist/worker-utils/lib/async-queue/async-queue.js +0 -91
- package/dist/worker-utils/lib/async-queue/async-queue.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +0 -20
- package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-body.js +0 -131
- package/dist/worker-utils/lib/worker-farm/worker-body.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +0 -58
- package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-farm.js +0 -116
- package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +0 -34
- package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-job.js +0 -74
- package/dist/worker-utils/lib/worker-farm/worker-job.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +0 -94
- package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-pool.js +0 -246
- package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +0 -67
- package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +0 -1
- package/dist/worker-utils/lib/worker-farm/worker-thread.js +0 -175
- package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +0 -1
- package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
- package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
- package/src/loader-utils/lib/file-provider/data-view-file.ts +0 -83
- package/src/loader-utils/lib/file-provider/file-handle-file.ts +0 -114
- package/src/loader-utils/lib/file-provider/file-provider-interface.ts +0 -60
- package/src/loader-utils/lib/file-provider/file-provider.ts +0 -130
- package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +0 -46
- package/src/polyfills/images/encode-image.node.ts.disabled +0 -41
- package/src/polyfills/images/parse-image.node.ts.disabled +0 -55
- package/src/schema/deprecated/mesh-utils.ts +0 -46
- package/src/schema-utils/arrow-transport.ts +0 -7
- package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
- package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +0 -190
- package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +0 -85
- package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +0 -82
- package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +0 -103
- package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +0 -108
- package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +0 -28
- package/src/worker-utils/lib/async-queue/async-queue.ts +0 -100
- package/src/worker-utils/lib/worker-farm/worker-body.ts +0 -145
- package/src/worker-utils/lib/worker-farm/worker-farm.ts +0 -144
- package/src/worker-utils/lib/worker-farm/worker-job.ts +0 -85
- package/src/worker-utils/lib/worker-farm/worker-pool.ts +0 -316
- 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
|
-
|
|
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.
|
|
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
|
|
299
|
+
const log3 = new import_log.Log({ id: "loaders.gl" });
|
|
255
300
|
globalThis.loaders ||= {};
|
|
256
|
-
globalThis.loaders.log =
|
|
301
|
+
globalThis.loaders.log = log3;
|
|
257
302
|
globalThis.loaders.version = version;
|
|
258
303
|
globalThis.probe ||= {};
|
|
259
|
-
globalThis.probe.loaders =
|
|
260
|
-
return
|
|
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-
|
|
407
|
-
var
|
|
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/
|
|
953
|
-
var
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
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
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
488
|
+
var log2 = createLog2();
|
|
489
|
+
var NullLog2 = class {
|
|
490
|
+
/** Discards debug messages. */
|
|
491
|
+
log() {
|
|
492
|
+
return ignoreMessage2;
|
|
1052
493
|
}
|
|
1053
|
-
|
|
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
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
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
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
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
|
-
|
|
1120
|
-
|
|
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
|
|
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
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
546
|
+
let version3 = worker.version;
|
|
547
|
+
if (version3 === "latest") {
|
|
548
|
+
version3 = NPM_TAG;
|
|
1250
549
|
}
|
|
1251
|
-
const versionTag =
|
|
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
|
-
|
|
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/
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
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
|
|
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
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
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
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
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
|
|
1442
|
-
if (
|
|
1443
|
-
return;
|
|
622
|
+
function getTransferListForWriter(object) {
|
|
623
|
+
if (object === null) {
|
|
624
|
+
return {};
|
|
1444
625
|
}
|
|
1445
|
-
|
|
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
|
-
|
|
1448
|
-
|
|
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
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
return
|
|
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
|
|
1456
|
-
|
|
1457
|
-
|
|
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
|
|
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
|
-
|
|
1467
|
-
|
|
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
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
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
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
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
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
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
|
-
|
|
763
|
+
if (!channelClosed && !callbackController.signal.aborted)
|
|
764
|
+
channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
|
|
1513
765
|
} catch (error) {
|
|
1514
|
-
|
|
1515
|
-
|
|
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
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1541
|
-
|
|
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
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
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
|
-
|
|
854
|
+
workerUrl = shimUrl;
|
|
1625
855
|
}
|
|
856
|
+
return new Worker(workerUrl, { type: "module" });
|
|
1626
857
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
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
|
|
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
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
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
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
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(
|
|
983
|
+
function createParseOnMainThread(processOnMainThread) {
|
|
1729
984
|
return (arrayBuffer, loaders, options, context) => {
|
|
1730
|
-
if (!
|
|
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
|
|
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
|
|
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" &&
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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 ? {
|
|
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
|
-
|
|
1936
|
-
|
|
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
|
-
|
|
1208
|
+
serializedOptions._workerLoaderId = loader.id;
|
|
1944
1209
|
}
|
|
1945
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 = { ...
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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 =
|
|
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
|
|
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 ??
|
|
2586
|
+
const rangeExpansionBytes = props.rangeExpansionBytes ?? props.maxGapBytes ?? DEFAULT_PROPS2.rangeExpansionBytes;
|
|
3318
2587
|
this.props = {
|
|
3319
|
-
batchDelayMs: props.batchDelayMs ??
|
|
2588
|
+
batchDelayMs: props.batchDelayMs ?? DEFAULT_PROPS2.batchDelayMs,
|
|
3320
2589
|
maxGapBytes: props.maxGapBytes ?? rangeExpansionBytes,
|
|
3321
2590
|
rangeExpansionBytes,
|
|
3322
|
-
maxMergedBytes: props.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 ??
|
|
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 ??
|
|
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) ??
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
6223
|
-
throw new Error(`Unsupported legacy LASzip item version ${
|
|
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((
|
|
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.
|
|
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 =
|
|
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 =
|
|
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
|
|
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" && "
|
|
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
|
-
|
|
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.
|
|
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
|
|
10941
|
-
const request = consumer[
|
|
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
|
|
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,
|
|
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,
|
|
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[
|
|
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[
|
|
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
|
|
10918
|
+
function emitQueryComplete(callback, summary) {
|
|
11574
10919
|
if (!callback)
|
|
11575
10920
|
return;
|
|
11576
10921
|
try {
|
|
11577
|
-
callback(
|
|
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:
|
|
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
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
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
|
-
|
|
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 = ((
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
11783
|
-
return { ...batch, features: batch.features.slice(
|
|
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
|