@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,21 +25,44 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
25
|
};
|
|
18
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
27
|
|
|
28
|
+
// dist/worker-utils/lib/node/worker_threads-browser.js
|
|
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
|
+
"dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
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/worker-utils/index.js
|
|
21
57
|
var index_exports = {};
|
|
22
58
|
__export(index_exports, {
|
|
23
|
-
AsyncQueue: () => AsyncQueue,
|
|
24
59
|
ChildProcessProxy: () => ChildProcessProxy,
|
|
25
60
|
NullWorker: () => NullWorker,
|
|
26
|
-
WorkerBody: () => WorkerBody,
|
|
27
|
-
WorkerFarm: () => WorkerFarm,
|
|
28
|
-
WorkerJob: () => WorkerJob,
|
|
29
|
-
WorkerPool: () => WorkerPool,
|
|
30
|
-
WorkerThread: () => WorkerThread,
|
|
31
61
|
assert: () => assert,
|
|
32
62
|
canProcessOnWorker: () => canProcessOnWorker,
|
|
33
63
|
canProcessOnWorkerInBatches: () => canProcessOnWorkerInBatches,
|
|
34
64
|
createWorker: () => createWorker,
|
|
65
|
+
destroyWorkerTasks: () => destroyWorkerTasks,
|
|
35
66
|
extractLoadLibraryOptions: () => extractLoadLibraryOptions,
|
|
36
67
|
getLibraryUrl: () => getLibraryUrl,
|
|
37
68
|
getTransferList: () => getTransferList,
|
|
@@ -55,10 +86,10 @@ var NPM_TAG = "beta";
|
|
|
55
86
|
|
|
56
87
|
// dist/worker-utils/lib/env-utils/version.js
|
|
57
88
|
function getVersion() {
|
|
58
|
-
const
|
|
89
|
+
const version2 = false ? NPM_TAG : "5.0.0-beta.10";
|
|
59
90
|
globalThis._loadersgl_ = globalThis._loadersgl_ || {};
|
|
60
|
-
globalThis._loadersgl_.version ||=
|
|
61
|
-
return
|
|
91
|
+
globalThis._loadersgl_.version ||= version2;
|
|
92
|
+
return version2;
|
|
62
93
|
}
|
|
63
94
|
var VERSION = getVersion();
|
|
64
95
|
|
|
@@ -89,131 +120,119 @@ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "u
|
|
|
89
120
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
90
121
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
91
122
|
|
|
92
|
-
// dist/worker-utils/lib/worker-
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (!this.isRunning) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
this.isRunning = false;
|
|
133
|
-
this._resolve(value);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Call to reject the `result` Promise with the supplied error
|
|
137
|
-
*/
|
|
138
|
-
error(error) {
|
|
139
|
-
if (!this.isRunning) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
this.isRunning = false;
|
|
143
|
-
this._reject(error);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Terminates the worker executing this job and rejects its result.
|
|
147
|
-
* @param reason Abort reason supplied by the caller, or a cross-runtime `AbortError`.
|
|
148
|
-
*/
|
|
149
|
-
abort(reason) {
|
|
150
|
-
if (!this.isRunning) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
this.workerThread.destroy();
|
|
154
|
-
this.error(arguments.length ? reason : createAbortError(`Worker job "${this.name}" was aborted`));
|
|
123
|
+
// dist/worker-utils/lib/worker-api/process-on-worker.js
|
|
124
|
+
var import_tasks2 = require("@math.gl/tasks");
|
|
125
|
+
|
|
126
|
+
// dist/loader-utils/lib/log-utils/log.js
|
|
127
|
+
var import_log = require("probe.gl/log");
|
|
128
|
+
var VERSION2 = true ? "5.0.0-beta.10" : "latest";
|
|
129
|
+
var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
|
|
130
|
+
function createLog() {
|
|
131
|
+
const log2 = new import_log.Log({ id: "loaders.gl" });
|
|
132
|
+
globalThis.loaders ||= {};
|
|
133
|
+
globalThis.loaders.log = log2;
|
|
134
|
+
globalThis.loaders.version = version;
|
|
135
|
+
globalThis.probe ||= {};
|
|
136
|
+
globalThis.probe.loaders = log2;
|
|
137
|
+
return log2;
|
|
138
|
+
}
|
|
139
|
+
var log = createLog();
|
|
140
|
+
var NullLog = class {
|
|
141
|
+
/** Discards debug messages. */
|
|
142
|
+
log() {
|
|
143
|
+
return ignoreMessage;
|
|
144
|
+
}
|
|
145
|
+
/** Discards informational messages. */
|
|
146
|
+
info() {
|
|
147
|
+
return ignoreMessage;
|
|
148
|
+
}
|
|
149
|
+
/** Discards messages marked to be emitted once. */
|
|
150
|
+
once() {
|
|
151
|
+
return ignoreMessage;
|
|
152
|
+
}
|
|
153
|
+
/** Discards warnings. */
|
|
154
|
+
warn() {
|
|
155
|
+
return ignoreMessage;
|
|
156
|
+
}
|
|
157
|
+
/** Discards errors. */
|
|
158
|
+
error() {
|
|
159
|
+
return ignoreMessage;
|
|
155
160
|
}
|
|
156
161
|
};
|
|
157
|
-
function
|
|
158
|
-
const error = new Error(message);
|
|
159
|
-
error.name = "AbortError";
|
|
160
|
-
return error;
|
|
162
|
+
function ignoreMessage() {
|
|
161
163
|
}
|
|
164
|
+
var nullLog = new NullLog();
|
|
162
165
|
|
|
163
|
-
// dist/worker-utils/lib/
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
// dist/worker-utils/lib/worker-api/get-worker-url.js
|
|
167
|
+
var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
|
|
168
|
+
function getCustomWorkerURL(worker, options = {}) {
|
|
169
|
+
var _a, _b;
|
|
170
|
+
const workerFile = isBrowser ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
171
|
+
let url = getConfiguredWorkerURL(worker, options);
|
|
172
|
+
const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
|
|
173
|
+
if (!url && workerType === "test") {
|
|
174
|
+
if (isBrowser) {
|
|
175
|
+
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
176
|
+
} else {
|
|
177
|
+
const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
|
|
178
|
+
const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
|
|
179
|
+
url = `modules/${worker.module}/src/${workerSourceNode}`;
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
|
-
|
|
175
|
-
|
|
182
|
+
return url || null;
|
|
183
|
+
}
|
|
184
|
+
function getConfiguredWorkerURL(worker, options = {}) {
|
|
185
|
+
const workerOptions = options[worker.id] || {};
|
|
186
|
+
return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
|
|
187
|
+
}
|
|
188
|
+
function getWorkerURL(worker, options = {}) {
|
|
189
|
+
const customWorkerUrl = getCustomWorkerURL(worker, options);
|
|
190
|
+
const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
|
|
191
|
+
const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
|
|
192
|
+
assert(url);
|
|
193
|
+
return url;
|
|
194
|
+
}
|
|
195
|
+
function getDefaultWorkerURL(worker, warn = false) {
|
|
196
|
+
const workerFile = isBrowser ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
197
|
+
let version2 = worker.version;
|
|
198
|
+
if (version2 === "latest") {
|
|
199
|
+
version2 = NPM_TAG;
|
|
176
200
|
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
var workerURLCache = /* @__PURE__ */ new Map();
|
|
182
|
-
function getLoadableWorkerURL(props) {
|
|
183
|
-
assert(props.source && !props.url || !props.source && props.url);
|
|
184
|
-
let workerURL = workerURLCache.get(props.source || props.url);
|
|
185
|
-
if (!workerURL) {
|
|
186
|
-
if (props.url) {
|
|
187
|
-
workerURL = getLoadableWorkerURLFromURL(props.url);
|
|
188
|
-
workerURLCache.set(props.url, workerURL);
|
|
189
|
-
}
|
|
190
|
-
if (props.source) {
|
|
191
|
-
workerURL = getLoadableWorkerURLFromSource(props.source);
|
|
192
|
-
workerURLCache.set(props.source, workerURL);
|
|
193
|
-
}
|
|
201
|
+
const versionTag = version2 ? `@${version2}` : "";
|
|
202
|
+
const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
|
|
203
|
+
if (warn) {
|
|
204
|
+
warnIfUsingNpmTagFallback(worker, url);
|
|
194
205
|
}
|
|
195
|
-
|
|
196
|
-
return workerURL;
|
|
206
|
+
return url;
|
|
197
207
|
}
|
|
198
|
-
function
|
|
199
|
-
if (
|
|
200
|
-
return
|
|
208
|
+
function warnIfUsingNpmTagFallback(worker, url) {
|
|
209
|
+
if (worker.version !== "latest") {
|
|
210
|
+
return;
|
|
201
211
|
}
|
|
202
|
-
const
|
|
203
|
-
|
|
212
|
+
const workerId = `${worker.module}:${worker.id}`;
|
|
213
|
+
if (warnedWorkerVersionFallbacks.has(workerId)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
warnedWorkerVersionFallbacks.add(workerId);
|
|
217
|
+
log.warn(`loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`)();
|
|
204
218
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
|
|
220
|
+
// dist/worker-utils/lib/worker-api/task-runtime.js
|
|
221
|
+
var import_tasks = require("@math.gl/tasks");
|
|
222
|
+
function normalizeTaskProgress(progress) {
|
|
223
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
208
224
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
async function isWorkerThread() {
|
|
226
|
+
var _a;
|
|
227
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
228
|
+
return true;
|
|
229
|
+
if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
|
|
230
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser(), worker_threads_browser_exports));
|
|
231
|
+
return !isMainThread;
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
216
234
|
}
|
|
235
|
+
var initializeTaskWorker = import_tasks.initializeTaskWorker;
|
|
217
236
|
|
|
218
237
|
// dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
219
238
|
function getTransferList(object, recursive = true, transfers) {
|
|
@@ -255,7 +274,7 @@ function getTransferListForWriter(object) {
|
|
|
255
274
|
}
|
|
256
275
|
const clone = Object.assign({}, object);
|
|
257
276
|
Object.keys(clone).forEach((key) => {
|
|
258
|
-
if (typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
|
|
277
|
+
if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
|
|
259
278
|
clone[key] = getTransferListForWriter(object[key]);
|
|
260
279
|
} else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
|
|
261
280
|
clone[key] = {};
|
|
@@ -266,1108 +285,311 @@ function getTransferListForWriter(object) {
|
|
|
266
285
|
return clone;
|
|
267
286
|
}
|
|
268
287
|
|
|
269
|
-
// dist/worker-utils/lib/worker-farm/worker-thread.js
|
|
270
|
-
var NOOP = () => {
|
|
271
|
-
};
|
|
272
|
-
var WorkerThread = class {
|
|
273
|
-
name;
|
|
274
|
-
source;
|
|
275
|
-
url;
|
|
276
|
-
/** Lazily resolves the classic worker URL used as a fallback. */
|
|
277
|
-
getUrl;
|
|
278
|
-
/** Creates a browser Worker directly. */
|
|
279
|
-
loadWorker;
|
|
280
|
-
terminated = false;
|
|
281
|
-
worker;
|
|
282
|
-
onMessage;
|
|
283
|
-
onError;
|
|
284
|
-
_loadableURL = "";
|
|
285
|
-
/** Checks if workers are supported on this platform */
|
|
286
|
-
static isSupported() {
|
|
287
|
-
return typeof Worker !== "undefined" && isBrowser || typeof NodeWorker !== "undefined" && !isBrowser;
|
|
288
|
-
}
|
|
289
|
-
constructor(props) {
|
|
290
|
-
const { name, source, url, getUrl, loadWorker } = props;
|
|
291
|
-
assert(source || url || getUrl || loadWorker);
|
|
292
|
-
this.name = name;
|
|
293
|
-
this.source = source;
|
|
294
|
-
this.url = url;
|
|
295
|
-
this.getUrl = getUrl;
|
|
296
|
-
this.loadWorker = loadWorker;
|
|
297
|
-
this.onMessage = NOOP;
|
|
298
|
-
this.onError = (error) => console.log(error);
|
|
299
|
-
this.worker = isBrowser ? this._createBrowserWorker() : this._createNodeWorker();
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Terminate this worker thread
|
|
303
|
-
* @note Can free up significant memory
|
|
304
|
-
*/
|
|
305
|
-
destroy() {
|
|
306
|
-
this.onMessage = NOOP;
|
|
307
|
-
this.onError = NOOP;
|
|
308
|
-
this.worker.terminate();
|
|
309
|
-
this.terminated = true;
|
|
310
|
-
}
|
|
311
|
-
/** Keeps this worker from preventing Node.js process exit while idle. */
|
|
312
|
-
unref() {
|
|
313
|
-
if (!isBrowser && typeof this.worker.unref === "function") {
|
|
314
|
-
this.worker.unref();
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/** Keeps this worker alive while it is actively processing a job. */
|
|
318
|
-
ref() {
|
|
319
|
-
if (!isBrowser && typeof this.worker.ref === "function") {
|
|
320
|
-
this.worker.ref();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
get isRunning() {
|
|
324
|
-
return Boolean(this.onMessage);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Send a message to this worker thread
|
|
328
|
-
* @param data any data structure, ideally consisting mostly of transferrable objects
|
|
329
|
-
* @param transferList If not supplied, calculated automatically by traversing data
|
|
330
|
-
*/
|
|
331
|
-
postMessage(data, transferList) {
|
|
332
|
-
transferList = transferList || getTransferList(data);
|
|
333
|
-
this.worker.postMessage(data, transferList);
|
|
334
|
-
}
|
|
335
|
-
// PRIVATE
|
|
336
|
-
/**
|
|
337
|
-
* Generate a standard Error from an ErrorEvent
|
|
338
|
-
* @param event
|
|
339
|
-
*/
|
|
340
|
-
_getErrorFromErrorEvent(event) {
|
|
341
|
-
let message = "Failed to load ";
|
|
342
|
-
message += `worker ${this.name} from ${this.url || "built-in worker factory"}. `;
|
|
343
|
-
if (event.message) {
|
|
344
|
-
message += `${event.message} in `;
|
|
345
|
-
}
|
|
346
|
-
if (event.lineno) {
|
|
347
|
-
message += `:${event.lineno}:${event.colno}`;
|
|
348
|
-
}
|
|
349
|
-
return new Error(message);
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Creates a worker thread on the browser
|
|
353
|
-
*/
|
|
354
|
-
_createBrowserWorker() {
|
|
355
|
-
var _a;
|
|
356
|
-
if (this.loadWorker) {
|
|
357
|
-
try {
|
|
358
|
-
const worker2 = this.loadWorker();
|
|
359
|
-
if (worker2) {
|
|
360
|
-
return this._initializeBrowserWorker(worker2);
|
|
361
|
-
}
|
|
362
|
-
} catch (error) {
|
|
363
|
-
if (!this.source && !this.url && !this.getUrl) {
|
|
364
|
-
throw error;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
const url = this.url || ((_a = this.getUrl) == null ? void 0 : _a.call(this));
|
|
369
|
-
this._loadableURL = getLoadableWorkerURL({ source: this.source, url });
|
|
370
|
-
const worker = new Worker(this._loadableURL, { name: this.name });
|
|
371
|
-
return this._initializeBrowserWorker(worker);
|
|
372
|
-
}
|
|
373
|
-
/** Attaches protocol handlers to a browser worker. */
|
|
374
|
-
_initializeBrowserWorker(worker) {
|
|
375
|
-
worker.onmessage = (event) => {
|
|
376
|
-
if (!event.data) {
|
|
377
|
-
this.onError(new Error("No data received"));
|
|
378
|
-
} else {
|
|
379
|
-
this.onMessage(event.data);
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
worker.onerror = (error) => {
|
|
383
|
-
this.onError(this._getErrorFromErrorEvent(error));
|
|
384
|
-
this.terminated = true;
|
|
385
|
-
};
|
|
386
|
-
worker.onmessageerror = (event) => console.error(event);
|
|
387
|
-
return worker;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Creates a worker thread in node.js
|
|
391
|
-
* @todo https://nodejs.org/api/async_hooks.html#async-resource-worker-pool
|
|
392
|
-
*/
|
|
393
|
-
_createNodeWorker() {
|
|
394
|
-
let worker;
|
|
395
|
-
if (this.url) {
|
|
396
|
-
const absolute = this.url.includes(":/") || this.url.startsWith("/");
|
|
397
|
-
const url = absolute ? this.url : `./${this.url}`;
|
|
398
|
-
const workerUrl = url.startsWith("file:") ? new URL(url) : url;
|
|
399
|
-
const type = this.url.endsWith(".ts") || this.url.endsWith(".mjs") ? "module" : "commonjs";
|
|
400
|
-
worker = new NodeWorker(workerUrl, { eval: false, type });
|
|
401
|
-
} else if (this.source) {
|
|
402
|
-
worker = new NodeWorker(this.source, { eval: true });
|
|
403
|
-
} else {
|
|
404
|
-
throw new Error("no worker");
|
|
405
|
-
}
|
|
406
|
-
worker.on("message", (data) => {
|
|
407
|
-
this.onMessage(data);
|
|
408
|
-
});
|
|
409
|
-
worker.on("error", (error) => {
|
|
410
|
-
this.onError(error);
|
|
411
|
-
});
|
|
412
|
-
worker.on("exit", (_code) => {
|
|
413
|
-
});
|
|
414
|
-
return worker;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// dist/worker-utils/lib/worker-farm/worker-pool.js
|
|
419
|
-
var WorkerPool = class {
|
|
420
|
-
name = "unnamed";
|
|
421
|
-
source;
|
|
422
|
-
// | Function;
|
|
423
|
-
url;
|
|
424
|
-
/** Lazily resolves a classic worker fallback URL. */
|
|
425
|
-
getUrl;
|
|
426
|
-
/** Creates a browser Worker directly. */
|
|
427
|
-
loadWorker;
|
|
428
|
-
maxConcurrency = 1;
|
|
429
|
-
maxMobileConcurrency = 1;
|
|
430
|
-
onDebug = () => {
|
|
431
|
-
};
|
|
432
|
-
reuseWorkers = true;
|
|
433
|
-
props = {};
|
|
434
|
-
jobQueue = [];
|
|
435
|
-
idleQueue = [];
|
|
436
|
-
activeJobs = /* @__PURE__ */ new Set();
|
|
437
|
-
count = 0;
|
|
438
|
-
isDestroyed = false;
|
|
439
|
-
/** Checks if workers are supported on this platform */
|
|
440
|
-
static isSupported() {
|
|
441
|
-
return WorkerThread.isSupported();
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* @param processor - worker function
|
|
445
|
-
* @param maxConcurrency - max count of workers
|
|
446
|
-
*/
|
|
447
|
-
constructor(props) {
|
|
448
|
-
this.source = props.source;
|
|
449
|
-
this.url = props.url;
|
|
450
|
-
this.getUrl = props.getUrl;
|
|
451
|
-
this.loadWorker = props.loadWorker;
|
|
452
|
-
this.setProps(props);
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Terminates all workers in the pool and aborts active jobs.
|
|
456
|
-
* @param reason Optional error delivered to active jobs.
|
|
457
|
-
* @note Can free up significant memory
|
|
458
|
-
*/
|
|
459
|
-
destroy(reason = new Error("Worker pool was destroyed")) {
|
|
460
|
-
this.isDestroyed = true;
|
|
461
|
-
this.activeJobs.forEach((job) => job.abort(reason));
|
|
462
|
-
const queuedJobs = this.jobQueue.splice(0);
|
|
463
|
-
queuedJobs.forEach((queuedJob) => {
|
|
464
|
-
queuedJob.removeAbortListener();
|
|
465
|
-
queuedJob.onReject(reason);
|
|
466
|
-
});
|
|
467
|
-
this.idleQueue.forEach((worker) => worker.destroy());
|
|
468
|
-
this.isDestroyed = true;
|
|
469
|
-
}
|
|
470
|
-
setProps(props) {
|
|
471
|
-
this.props = { ...this.props, ...props };
|
|
472
|
-
if (props.name !== void 0) {
|
|
473
|
-
this.name = props.name;
|
|
474
|
-
}
|
|
475
|
-
if (props.maxConcurrency !== void 0) {
|
|
476
|
-
this.maxConcurrency = props.maxConcurrency;
|
|
477
|
-
}
|
|
478
|
-
if (props.maxMobileConcurrency !== void 0) {
|
|
479
|
-
this.maxMobileConcurrency = props.maxMobileConcurrency;
|
|
480
|
-
}
|
|
481
|
-
if (props.reuseWorkers !== void 0) {
|
|
482
|
-
this.reuseWorkers = props.reuseWorkers;
|
|
483
|
-
}
|
|
484
|
-
if (props.onDebug !== void 0) {
|
|
485
|
-
this.onDebug = props.onDebug;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error), signal) {
|
|
489
|
-
if (signal == null ? void 0 : signal.aborted) {
|
|
490
|
-
throw signal.reason;
|
|
491
|
-
}
|
|
492
|
-
if (this.isDestroyed) {
|
|
493
|
-
return Promise.reject(new Error("Worker pool was destroyed"));
|
|
494
|
-
}
|
|
495
|
-
const startPromise = new Promise((onStart, onReject) => {
|
|
496
|
-
const abortQueuedJob = () => {
|
|
497
|
-
const index = this.jobQueue.indexOf(queuedJob);
|
|
498
|
-
if (index >= 0) {
|
|
499
|
-
this.jobQueue.splice(index, 1);
|
|
500
|
-
queuedJob.removeAbortListener();
|
|
501
|
-
onReject(signal == null ? void 0 : signal.reason);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
const queuedJob = {
|
|
505
|
-
name,
|
|
506
|
-
onMessage: onMessage2,
|
|
507
|
-
onError,
|
|
508
|
-
onStart,
|
|
509
|
-
onReject,
|
|
510
|
-
signal,
|
|
511
|
-
removeAbortListener: () => signal == null ? void 0 : signal.removeEventListener("abort", abortQueuedJob)
|
|
512
|
-
};
|
|
513
|
-
this.jobQueue.push(queuedJob);
|
|
514
|
-
signal == null ? void 0 : signal.addEventListener("abort", abortQueuedJob, { once: true });
|
|
515
|
-
return this;
|
|
516
|
-
});
|
|
517
|
-
this._startQueuedJob();
|
|
518
|
-
return await startPromise;
|
|
519
|
-
}
|
|
520
|
-
// PRIVATE
|
|
521
|
-
/**
|
|
522
|
-
* Starts first queued job if worker is available or can be created
|
|
523
|
-
* Called when job is started and whenever a worker returns to the idleQueue
|
|
524
|
-
*/
|
|
525
|
-
async _startQueuedJob() {
|
|
526
|
-
var _a, _b, _c;
|
|
527
|
-
if (!this.jobQueue.length) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
let workerThread;
|
|
531
|
-
try {
|
|
532
|
-
workerThread = this._getAvailableWorker();
|
|
533
|
-
} catch (error) {
|
|
534
|
-
const queuedJob2 = this.jobQueue.shift();
|
|
535
|
-
queuedJob2 == null ? void 0 : queuedJob2.removeAbortListener();
|
|
536
|
-
queuedJob2 == null ? void 0 : queuedJob2.onReject(error);
|
|
537
|
-
void this._startQueuedJob();
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
if (!workerThread) {
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
const queuedJob = this.jobQueue.shift();
|
|
544
|
-
if (queuedJob) {
|
|
545
|
-
this.onDebug({
|
|
546
|
-
message: "Starting job",
|
|
547
|
-
name: queuedJob.name,
|
|
548
|
-
workerThread,
|
|
549
|
-
backlog: this.jobQueue.length
|
|
550
|
-
});
|
|
551
|
-
const job = new WorkerJob(queuedJob.name, workerThread);
|
|
552
|
-
queuedJob.removeAbortListener();
|
|
553
|
-
const abortJob = () => {
|
|
554
|
-
var _a2;
|
|
555
|
-
return job.abort((_a2 = queuedJob.signal) == null ? void 0 : _a2.reason);
|
|
556
|
-
};
|
|
557
|
-
(_a = queuedJob.signal) == null ? void 0 : _a.addEventListener("abort", abortJob, { once: true });
|
|
558
|
-
if ((_b = queuedJob.signal) == null ? void 0 : _b.aborted)
|
|
559
|
-
abortJob();
|
|
560
|
-
this.activeJobs.add(job);
|
|
561
|
-
workerThread.ref();
|
|
562
|
-
workerThread.onMessage = (data) => {
|
|
563
|
-
if (job.isRunning)
|
|
564
|
-
queuedJob.onMessage(job, data.type, data.payload);
|
|
565
|
-
};
|
|
566
|
-
workerThread.onError = (error) => queuedJob.onError(job, error);
|
|
567
|
-
queuedJob.onStart(job);
|
|
568
|
-
try {
|
|
569
|
-
await job.result;
|
|
570
|
-
} catch {
|
|
571
|
-
} finally {
|
|
572
|
-
(_c = queuedJob.signal) == null ? void 0 : _c.removeEventListener("abort", abortJob);
|
|
573
|
-
this.activeJobs.delete(job);
|
|
574
|
-
this.returnWorkerToQueue(workerThread);
|
|
575
|
-
}
|
|
576
|
-
} else {
|
|
577
|
-
this.returnWorkerToQueue(workerThread);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Returns a worker to the idle queue
|
|
582
|
-
* Destroys the worker if
|
|
583
|
-
* - pool is destroyed
|
|
584
|
-
* - if this pool doesn't reuse workers
|
|
585
|
-
* - if maxConcurrency has been lowered
|
|
586
|
-
* @param worker
|
|
587
|
-
*/
|
|
588
|
-
returnWorkerToQueue(worker) {
|
|
589
|
-
const shouldDestroyWorker = (
|
|
590
|
-
// Aborted jobs terminate their worker immediately.
|
|
591
|
-
worker.terminated || // If the pool is destroyed, there is no reason to keep the worker around
|
|
592
|
-
this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
|
|
593
|
-
!this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
|
|
594
|
-
this.count > this._getMaxConcurrency()
|
|
595
|
-
);
|
|
596
|
-
if (shouldDestroyWorker) {
|
|
597
|
-
if (!worker.terminated) {
|
|
598
|
-
worker.destroy();
|
|
599
|
-
}
|
|
600
|
-
this.count--;
|
|
601
|
-
} else {
|
|
602
|
-
worker.unref();
|
|
603
|
-
this.idleQueue.push(worker);
|
|
604
|
-
}
|
|
605
|
-
if (!this.isDestroyed) {
|
|
606
|
-
this._startQueuedJob();
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Returns idle worker or creates new worker if maxConcurrency has not been reached
|
|
611
|
-
*/
|
|
612
|
-
_getAvailableWorker() {
|
|
613
|
-
if (this.idleQueue.length > 0) {
|
|
614
|
-
return this.idleQueue.shift() || null;
|
|
615
|
-
}
|
|
616
|
-
if (this.count < this._getMaxConcurrency()) {
|
|
617
|
-
this.count++;
|
|
618
|
-
const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
|
|
619
|
-
try {
|
|
620
|
-
return new WorkerThread({
|
|
621
|
-
name,
|
|
622
|
-
source: this.source,
|
|
623
|
-
url: this.url,
|
|
624
|
-
getUrl: this.getUrl,
|
|
625
|
-
loadWorker: this.loadWorker
|
|
626
|
-
});
|
|
627
|
-
} catch (error) {
|
|
628
|
-
this.count--;
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
return null;
|
|
633
|
-
}
|
|
634
|
-
_getMaxConcurrency() {
|
|
635
|
-
return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
// dist/worker-utils/lib/worker-farm/worker-farm.js
|
|
640
|
-
var DEFAULT_PROPS = {
|
|
641
|
-
maxConcurrency: 3,
|
|
642
|
-
maxMobileConcurrency: 1,
|
|
643
|
-
reuseWorkers: true,
|
|
644
|
-
onDebug: () => {
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
var loadWorkerIds = /* @__PURE__ */ new WeakMap();
|
|
648
|
-
var nextLoadWorkerId = 1;
|
|
649
|
-
var WorkerFarm = class _WorkerFarm {
|
|
650
|
-
props;
|
|
651
|
-
workerPools = /* @__PURE__ */ new Map();
|
|
652
|
-
// singleton
|
|
653
|
-
static _workerFarm;
|
|
654
|
-
/** Checks if workers are supported on this platform */
|
|
655
|
-
static isSupported() {
|
|
656
|
-
return WorkerThread.isSupported();
|
|
657
|
-
}
|
|
658
|
-
/** Get the singleton instance of the global worker farm */
|
|
659
|
-
static getWorkerFarm(props = {}) {
|
|
660
|
-
_WorkerFarm._workerFarm = _WorkerFarm._workerFarm || new _WorkerFarm({});
|
|
661
|
-
_WorkerFarm._workerFarm.setProps(props);
|
|
662
|
-
return _WorkerFarm._workerFarm;
|
|
663
|
-
}
|
|
664
|
-
/** get global instance with WorkerFarm.getWorkerFarm() */
|
|
665
|
-
constructor(props) {
|
|
666
|
-
this.props = { ...DEFAULT_PROPS };
|
|
667
|
-
this.setProps(props);
|
|
668
|
-
this.workerPools = /* @__PURE__ */ new Map();
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Terminate all workers in the farm and abort active jobs.
|
|
672
|
-
* @param reason Optional error delivered to active jobs.
|
|
673
|
-
* @note Can free up significant memory
|
|
674
|
-
*/
|
|
675
|
-
destroy(reason) {
|
|
676
|
-
for (const workerPool of this.workerPools.values()) {
|
|
677
|
-
workerPool.destroy(reason);
|
|
678
|
-
}
|
|
679
|
-
this.workerPools = /* @__PURE__ */ new Map();
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* Set props used when initializing worker pools
|
|
683
|
-
* @param props
|
|
684
|
-
*/
|
|
685
|
-
setProps(props) {
|
|
686
|
-
this.props = { ...this.props, ...props };
|
|
687
|
-
for (const workerPool of this.workerPools.values()) {
|
|
688
|
-
workerPool.setProps(this._getWorkerPoolProps());
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* Returns a worker pool for the specified worker
|
|
693
|
-
* @param options Worker target used to identify and initialize the pool.
|
|
694
|
-
* @param options.name Worker name used as the base pool identity.
|
|
695
|
-
* @param options.url Worker script URL.
|
|
696
|
-
* @param options.source Inline worker source.
|
|
697
|
-
* @param options.loadWorker Built-in browser worker factory.
|
|
698
|
-
* @example
|
|
699
|
-
* const job = WorkerFarm.getWorkerFarm().getWorkerPool({name, url}).startJob(...);
|
|
700
|
-
*/
|
|
701
|
-
getWorkerPool(options) {
|
|
702
|
-
const { name, source, url, getUrl, loadWorker } = options;
|
|
703
|
-
const workerPoolKey = getWorkerPoolKey(options);
|
|
704
|
-
let workerPool = this.workerPools.get(workerPoolKey);
|
|
705
|
-
if (!workerPool) {
|
|
706
|
-
workerPool = new WorkerPool({
|
|
707
|
-
name,
|
|
708
|
-
source,
|
|
709
|
-
url,
|
|
710
|
-
getUrl,
|
|
711
|
-
loadWorker
|
|
712
|
-
});
|
|
713
|
-
workerPool.setProps(this._getWorkerPoolProps());
|
|
714
|
-
this.workerPools.set(workerPoolKey, workerPool);
|
|
715
|
-
}
|
|
716
|
-
return workerPool;
|
|
717
|
-
}
|
|
718
|
-
_getWorkerPoolProps() {
|
|
719
|
-
return {
|
|
720
|
-
maxConcurrency: this.props.maxConcurrency,
|
|
721
|
-
maxMobileConcurrency: this.props.maxMobileConcurrency,
|
|
722
|
-
reuseWorkers: this.props.reuseWorkers,
|
|
723
|
-
onDebug: this.props.onDebug
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
function getWorkerPoolKey(options) {
|
|
728
|
-
const { name, source, url, urlKey, loadWorker } = options;
|
|
729
|
-
const sourceKey = source ? `source:${source}` : "";
|
|
730
|
-
const urlKeyPart = url || urlKey ? `url:${url || urlKey}` : "";
|
|
731
|
-
const loadWorkerKey = loadWorker ? `loadWorker:${getLoadWorkerId(loadWorker)}` : "";
|
|
732
|
-
return [name, sourceKey, urlKeyPart, loadWorkerKey].filter(Boolean).join("|");
|
|
733
|
-
}
|
|
734
|
-
function getLoadWorkerId(loadWorker) {
|
|
735
|
-
let loadWorkerId = loadWorkerIds.get(loadWorker);
|
|
736
|
-
if (!loadWorkerId) {
|
|
737
|
-
loadWorkerId = nextLoadWorkerId++;
|
|
738
|
-
loadWorkerIds.set(loadWorker, loadWorkerId);
|
|
739
|
-
}
|
|
740
|
-
return loadWorkerId;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
// dist/worker-utils/lib/worker-farm/worker-body.js
|
|
744
|
-
async function getParentPort() {
|
|
745
|
-
return parentPort;
|
|
746
|
-
}
|
|
747
|
-
var onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
748
|
-
var WorkerBody = class {
|
|
749
|
-
/** Check that we are actually in a worker thread */
|
|
750
|
-
static async inWorkerThread() {
|
|
751
|
-
return typeof self !== "undefined" || Boolean(await getParentPort());
|
|
752
|
-
}
|
|
753
|
-
/*
|
|
754
|
-
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
755
|
-
*/
|
|
756
|
-
static set onmessage(onMessage2) {
|
|
757
|
-
async function handleMessage(message) {
|
|
758
|
-
const parentPort2 = await getParentPort();
|
|
759
|
-
const { type, payload } = parentPort2 ? message : message.data;
|
|
760
|
-
onMessage2(type, payload);
|
|
761
|
-
}
|
|
762
|
-
getParentPort().then((parentPort2) => {
|
|
763
|
-
if (parentPort2) {
|
|
764
|
-
parentPort2.on("message", (message) => {
|
|
765
|
-
handleMessage(message);
|
|
766
|
-
});
|
|
767
|
-
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
768
|
-
} else {
|
|
769
|
-
globalThis.onmessage = handleMessage;
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
static async addEventListener(onMessage2) {
|
|
774
|
-
let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
|
|
775
|
-
if (!onMessageWrapper) {
|
|
776
|
-
onMessageWrapper = (message) => {
|
|
777
|
-
const messageData = getWorkerMessageData(message);
|
|
778
|
-
if (!messageData) {
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
onMessage2(messageData.type, messageData.payload);
|
|
782
|
-
};
|
|
783
|
-
onMessageWrapperMap.set(onMessage2, onMessageWrapper);
|
|
784
|
-
}
|
|
785
|
-
const parentPort2 = await getParentPort();
|
|
786
|
-
if (parentPort2) {
|
|
787
|
-
parentPort2.on("message", onMessageWrapper);
|
|
788
|
-
} else {
|
|
789
|
-
globalThis.addEventListener("message", onMessageWrapper);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
static async removeEventListener(onMessage2) {
|
|
793
|
-
const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
|
|
794
|
-
onMessageWrapperMap.delete(onMessage2);
|
|
795
|
-
if (!onMessageWrapper) {
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
const parentPort2 = await getParentPort();
|
|
799
|
-
if (parentPort2) {
|
|
800
|
-
parentPort2.off("message", onMessageWrapper);
|
|
801
|
-
} else {
|
|
802
|
-
globalThis.removeEventListener("message", onMessageWrapper);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Send a message from a worker to creating thread (main thread)
|
|
807
|
-
* @param type
|
|
808
|
-
* @param payload
|
|
809
|
-
*/
|
|
810
|
-
static async postMessage(type, payload) {
|
|
811
|
-
const data = { source: "loaders.gl", type, payload };
|
|
812
|
-
const transferList = getTransferList(payload);
|
|
813
|
-
const parentPort2 = await getParentPort();
|
|
814
|
-
if (parentPort2) {
|
|
815
|
-
parentPort2.postMessage(data, transferList);
|
|
816
|
-
} else {
|
|
817
|
-
globalThis.postMessage(data, transferList);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
function getWorkerMessageData(message) {
|
|
822
|
-
if (!message || typeof message !== "object") {
|
|
823
|
-
return null;
|
|
824
|
-
}
|
|
825
|
-
const messageData = "data" in message && message.type === "message" ? message.data : message;
|
|
826
|
-
return messageData && typeof messageData.source === "string" && messageData.source.startsWith("loaders.gl") ? messageData : null;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// dist/worker-utils/lib/async-queue/async-queue.js
|
|
830
|
-
var AsyncQueue = class {
|
|
831
|
-
_values;
|
|
832
|
-
_settlers;
|
|
833
|
-
_closed;
|
|
834
|
-
constructor() {
|
|
835
|
-
this._values = [];
|
|
836
|
-
this._settlers = [];
|
|
837
|
-
this._closed = false;
|
|
838
|
-
}
|
|
839
|
-
/** Return an async iterator for this queue */
|
|
840
|
-
[Symbol.asyncIterator]() {
|
|
841
|
-
return this;
|
|
842
|
-
}
|
|
843
|
-
/** Push a new value - the async iterator will yield a promise resolved to this value */
|
|
844
|
-
push(value) {
|
|
845
|
-
return this.enqueue(value);
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Push a new value - the async iterator will yield a promise resolved to this value
|
|
849
|
-
* Add an error - the async iterator will yield a promise rejected with this value
|
|
850
|
-
*/
|
|
851
|
-
enqueue(value) {
|
|
852
|
-
if (this._closed) {
|
|
853
|
-
throw new Error("Closed");
|
|
854
|
-
}
|
|
855
|
-
if (this._settlers.length > 0) {
|
|
856
|
-
if (this._values.length > 0) {
|
|
857
|
-
throw new Error("Illegal internal state");
|
|
858
|
-
}
|
|
859
|
-
const settler = this._settlers.shift();
|
|
860
|
-
if (value instanceof Error) {
|
|
861
|
-
settler.reject(value);
|
|
862
|
-
} else {
|
|
863
|
-
settler.resolve({ value });
|
|
864
|
-
}
|
|
865
|
-
} else {
|
|
866
|
-
this._values.push(value);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
/** Indicate that we not waiting for more values - The async iterator will be done */
|
|
870
|
-
close() {
|
|
871
|
-
while (this._settlers.length > 0) {
|
|
872
|
-
const settler = this._settlers.shift();
|
|
873
|
-
settler.resolve({ done: true });
|
|
874
|
-
}
|
|
875
|
-
this._closed = true;
|
|
876
|
-
}
|
|
877
|
-
// ITERATOR IMPLEMENTATION
|
|
878
|
-
/** @returns a Promise for an IteratorResult */
|
|
879
|
-
next() {
|
|
880
|
-
if (this._values.length > 0) {
|
|
881
|
-
const value = this._values.shift();
|
|
882
|
-
if (value instanceof Error) {
|
|
883
|
-
return Promise.reject(value);
|
|
884
|
-
}
|
|
885
|
-
return Promise.resolve({ done: false, value });
|
|
886
|
-
}
|
|
887
|
-
if (this._closed) {
|
|
888
|
-
if (this._settlers.length > 0) {
|
|
889
|
-
throw new Error("Illegal internal state");
|
|
890
|
-
}
|
|
891
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
892
|
-
}
|
|
893
|
-
return new Promise((resolve, reject) => {
|
|
894
|
-
this._settlers.push({ resolve, reject });
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
// dist/worker-utils/lib/worker-api/get-worker-url.js
|
|
900
|
-
var warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
|
|
901
|
-
function getWorkerName(worker) {
|
|
902
|
-
const warning = worker.version !== VERSION ? ` (worker-utils@${VERSION})` : "";
|
|
903
|
-
return `${worker.name}@${worker.version}${warning}`;
|
|
904
|
-
}
|
|
905
|
-
function getCustomWorkerURL(worker, options = {}) {
|
|
906
|
-
var _a, _b;
|
|
907
|
-
const workerFile = isBrowser ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
908
|
-
let url = getConfiguredWorkerURL(worker, options);
|
|
909
|
-
const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
|
|
910
|
-
if (!url && workerType === "test") {
|
|
911
|
-
if (isBrowser) {
|
|
912
|
-
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
913
|
-
} else {
|
|
914
|
-
const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
|
|
915
|
-
const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
|
|
916
|
-
url = `modules/${worker.module}/src/${workerSourceNode}`;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
return url || null;
|
|
920
|
-
}
|
|
921
|
-
function getConfiguredWorkerURL(worker, options = {}) {
|
|
922
|
-
const workerOptions = options[worker.id] || {};
|
|
923
|
-
return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
|
|
924
|
-
}
|
|
925
|
-
function getWorkerURL(worker, options = {}) {
|
|
926
|
-
const customWorkerUrl = getCustomWorkerURL(worker, options);
|
|
927
|
-
const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
|
|
928
|
-
const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
|
|
929
|
-
assert(url);
|
|
930
|
-
return url;
|
|
931
|
-
}
|
|
932
|
-
function getDefaultWorkerURL(worker, warn = false) {
|
|
933
|
-
const workerFile = isBrowser ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
|
|
934
|
-
let version = worker.version;
|
|
935
|
-
if (version === "latest") {
|
|
936
|
-
version = NPM_TAG;
|
|
937
|
-
}
|
|
938
|
-
const versionTag = version ? `@${version}` : "";
|
|
939
|
-
const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
|
|
940
|
-
if (warn) {
|
|
941
|
-
warnIfUsingNpmTagFallback(worker, url);
|
|
942
|
-
}
|
|
943
|
-
return url;
|
|
944
|
-
}
|
|
945
|
-
function warnIfUsingNpmTagFallback(worker, url) {
|
|
946
|
-
if (worker.version !== "latest") {
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
const workerId = `${worker.module}:${worker.id}`;
|
|
950
|
-
if (warnedWorkerVersionFallbacks.has(workerId)) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
warnedWorkerVersionFallbacks.add(workerId);
|
|
954
|
-
console.warn(`loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
288
|
// dist/worker-utils/lib/worker-api/process-on-worker.js
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
const
|
|
963
|
-
return Boolean((worker.worker || worker.loadWorker || (
|
|
289
|
+
var runners = /* @__PURE__ */ new WeakMap();
|
|
290
|
+
var activeRunners = /* @__PURE__ */ new Set();
|
|
291
|
+
var moduleWorkerUrls = /* @__PURE__ */ new Map();
|
|
292
|
+
function canProcessOnWorker(worker, options = {}) {
|
|
293
|
+
const supported = isBrowser ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
|
|
294
|
+
return Boolean(supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options)));
|
|
964
295
|
}
|
|
965
296
|
function canProcessOnWorkerInBatches(worker, options = {}) {
|
|
966
297
|
if (!canProcessOnWorker(worker, options))
|
|
967
298
|
return false;
|
|
968
299
|
if (options.workerInBatches !== void 0)
|
|
969
300
|
return options.workerInBatches;
|
|
970
|
-
return Boolean(worker.workerInBatches && !
|
|
301
|
+
return Boolean(worker.workerInBatches && !getConfiguredWorkerURL(worker, options));
|
|
971
302
|
}
|
|
972
303
|
async function processOnWorker(worker, data, options = {}, context = {}, jobContext = {}) {
|
|
973
|
-
|
|
974
|
-
throwIfAborted(options.signal);
|
|
975
|
-
const name = getWorkerName(worker);
|
|
976
|
-
const workerFarm = WorkerFarm.getWorkerFarm(options);
|
|
977
|
-
const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
|
|
978
|
-
const jobName = options.jobName || worker.name;
|
|
979
|
-
const job = await workerPool.startJob(
|
|
980
|
-
jobName,
|
|
981
|
-
// eslint-disable-next-line
|
|
982
|
-
onMessage.bind(null, context, options),
|
|
983
|
-
void 0,
|
|
984
|
-
options.signal
|
|
985
|
-
);
|
|
304
|
+
const session = await openSession(worker, options, context, jobContext);
|
|
986
305
|
try {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
input: data,
|
|
995
|
-
options: transferableOptions,
|
|
996
|
-
context: transferableContext
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
const result = await job.result;
|
|
1000
|
-
return result.result;
|
|
1001
|
-
} catch (error) {
|
|
1002
|
-
job.abort(error);
|
|
1003
|
-
throw error;
|
|
306
|
+
const result = await session.handle.runTask({ value: data }, {
|
|
307
|
+
...getControls(options),
|
|
308
|
+
options: getParserOptions(options)
|
|
309
|
+
});
|
|
310
|
+
return result.value;
|
|
311
|
+
} finally {
|
|
312
|
+
await session.close();
|
|
1004
313
|
}
|
|
1005
314
|
}
|
|
1006
|
-
function processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
throwIfAborted(options.signal);
|
|
1011
|
-
const name = getWorkerName(worker);
|
|
1012
|
-
const workerFarm = WorkerFarm.getWorkerFarm(options);
|
|
1013
|
-
const workerPool = workerFarm.getWorkerPool(getWorkerPoolTarget(worker, options, name));
|
|
1014
|
-
const outputBatches = new AsyncQueue();
|
|
1015
|
-
const inputIterator = getAsyncIterator(input);
|
|
1016
|
-
let outputFinished = false;
|
|
1017
|
-
let inputFinished = false;
|
|
1018
|
-
let inputCleanupRequested = false;
|
|
1019
|
-
let inputRequest = Promise.resolve();
|
|
1020
|
-
const batchJobFailed = new Error("Worker batch job failed");
|
|
1021
|
-
const closeJobInput = () => {
|
|
1022
|
-
if (!inputFinished && !inputCleanupRequested) {
|
|
1023
|
-
inputCleanupRequested = true;
|
|
1024
|
-
closeInputIterator(inputIterator);
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
const finishOutput = () => {
|
|
1028
|
-
if (!outputFinished) {
|
|
1029
|
-
outputFinished = true;
|
|
1030
|
-
outputBatches.close();
|
|
1031
|
-
}
|
|
1032
|
-
};
|
|
1033
|
-
const failOutput = (_error) => {
|
|
1034
|
-
if (!outputFinished) {
|
|
1035
|
-
outputFinished = true;
|
|
1036
|
-
outputBatches.enqueue(batchJobFailed);
|
|
1037
|
-
outputBatches.close();
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
const job = await workerPool.startJob(options.jobName || worker.name, (activeJob, type, payload) => {
|
|
1041
|
-
switch (type) {
|
|
1042
|
-
case "progress":
|
|
1043
|
-
reportProgress(activeJob, options, payload);
|
|
1044
|
-
break;
|
|
1045
|
-
case "input-request":
|
|
1046
|
-
inputRequest = inputRequest.then(async () => {
|
|
1047
|
-
if (!activeJob.isRunning)
|
|
1048
|
-
return;
|
|
1049
|
-
const nextBatch = await inputIterator.next();
|
|
1050
|
-
if (!activeJob.isRunning) {
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
if (nextBatch.done) {
|
|
1054
|
-
inputFinished = true;
|
|
1055
|
-
activeJob.postMessage("input-done", {});
|
|
1056
|
-
} else {
|
|
1057
|
-
activeJob.postMessage("input-batch", { input: nextBatch.value });
|
|
1058
|
-
}
|
|
1059
|
-
}).catch((error) => activeJob.abort(error));
|
|
1060
|
-
break;
|
|
1061
|
-
case "output-batch":
|
|
1062
|
-
outputBatches.push(payload.result);
|
|
1063
|
-
break;
|
|
1064
|
-
case "done":
|
|
1065
|
-
activeJob.done(payload);
|
|
1066
|
-
finishOutput();
|
|
1067
|
-
break;
|
|
1068
|
-
case "error": {
|
|
1069
|
-
const error = new Error(payload.error || "Worker batch processing failed");
|
|
1070
|
-
activeJob.error(error);
|
|
1071
|
-
failOutput(error);
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
case "process":
|
|
1075
|
-
void onMessage(context, options, activeJob, type, payload);
|
|
1076
|
-
break;
|
|
1077
|
-
default: {
|
|
1078
|
-
const error = new Error(`Unexpected worker batch message: ${type}`);
|
|
1079
|
-
activeJob.error(error);
|
|
1080
|
-
failOutput(error);
|
|
1081
|
-
break;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
}, void 0, options.signal).catch((error) => {
|
|
1085
|
-
closeJobInput();
|
|
1086
|
-
throw error;
|
|
1087
|
-
});
|
|
1088
|
-
void job.result.catch((error) => {
|
|
1089
|
-
failOutput(error);
|
|
1090
|
-
closeJobInput();
|
|
1091
|
-
});
|
|
315
|
+
async function* processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
|
|
316
|
+
var _a;
|
|
317
|
+
const taskInput = wrapInput(input);
|
|
318
|
+
let session;
|
|
1092
319
|
try {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
try {
|
|
1101
|
-
for await (const outputBatch of outputBatches) {
|
|
1102
|
-
yield outputBatch;
|
|
1103
|
-
if (job.isRunning) {
|
|
1104
|
-
job.postMessage("output-ack", {});
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
} catch (error) {
|
|
1108
|
-
if (error === batchJobFailed) {
|
|
1109
|
-
await job.result;
|
|
1110
|
-
}
|
|
1111
|
-
throw error;
|
|
1112
|
-
}
|
|
1113
|
-
await job.result;
|
|
320
|
+
session = await openSession(worker, options, context, jobContext);
|
|
321
|
+
for await (const result of session.handle.runTaskInBatches(taskInput, {
|
|
322
|
+
...getControls(options),
|
|
323
|
+
options: getParserOptions(options)
|
|
324
|
+
}))
|
|
325
|
+
yield result.value;
|
|
1114
326
|
} finally {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
-
|
|
327
|
+
const closingInput = (_a = taskInput.return) == null ? void 0 : _a.call(taskInput);
|
|
328
|
+
void (closingInput == null ? void 0 : closingInput.catch(() => {
|
|
329
|
+
}));
|
|
330
|
+
await (session == null ? void 0 : session.close());
|
|
1119
331
|
}
|
|
1120
332
|
}
|
|
1121
|
-
function
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
}
|
|
1127
|
-
function getAbortReason(signal) {
|
|
1128
|
-
return signal ? signal.reason : createAbortError2("Worker job was aborted");
|
|
1129
|
-
}
|
|
1130
|
-
function createAbortError2(message) {
|
|
1131
|
-
const error = new Error(message);
|
|
1132
|
-
error.name = "AbortError";
|
|
1133
|
-
return error;
|
|
1134
|
-
}
|
|
1135
|
-
function getAsyncIterator(input) {
|
|
1136
|
-
if (Symbol.asyncIterator in input) {
|
|
1137
|
-
return input[Symbol.asyncIterator]();
|
|
1138
|
-
}
|
|
1139
|
-
return (async function* iterateSynchronously() {
|
|
1140
|
-
yield* input;
|
|
1141
|
-
})();
|
|
333
|
+
async function preloadWorker(worker, options = {}, preloadOptions = {}) {
|
|
334
|
+
await (0, import_tasks2.preloadTasks)([getTask(worker, options)], {
|
|
335
|
+
execution: "worker",
|
|
336
|
+
signal: preloadOptions.signal ?? options.signal
|
|
337
|
+
});
|
|
1142
338
|
}
|
|
1143
|
-
function
|
|
1144
|
-
|
|
339
|
+
async function destroyWorkerTasks(reason) {
|
|
340
|
+
const previous = [...activeRunners];
|
|
341
|
+
activeRunners.clear();
|
|
342
|
+
runners = /* @__PURE__ */ new WeakMap();
|
|
343
|
+
const previousUrls = [...moduleWorkerUrls.values()];
|
|
344
|
+
moduleWorkerUrls.clear();
|
|
1145
345
|
try {
|
|
1146
|
-
|
|
1147
|
-
}
|
|
346
|
+
await Promise.all(previous.map((state) => state.runner.terminate(reason)));
|
|
347
|
+
} finally {
|
|
348
|
+
for (const workerUrl of previousUrls)
|
|
349
|
+
URL.revokeObjectURL(workerUrl);
|
|
1148
350
|
}
|
|
1149
351
|
}
|
|
1150
|
-
|
|
352
|
+
function getTask(worker, options) {
|
|
1151
353
|
var _a;
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
const
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
354
|
+
if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
|
|
355
|
+
throw new Error("Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory");
|
|
356
|
+
const create = !getCustomWorkerURL(worker, options) && isBrowser ? worker.loadWorker : void 0;
|
|
357
|
+
const url = getWorkerURL(worker, options);
|
|
358
|
+
return {
|
|
359
|
+
id: `${worker.module}:${worker.id}`,
|
|
360
|
+
initialize: (state) => state,
|
|
361
|
+
worker: {
|
|
362
|
+
...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
|
|
363
|
+
capabilities: { atomic: true, streaming: true }
|
|
364
|
+
}
|
|
365
|
+
};
|
|
1162
366
|
}
|
|
1163
|
-
function
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
}
|
|
1179
|
-
return { name, url: getWorkerURL(worker, options) };
|
|
367
|
+
function getControls(options) {
|
|
368
|
+
return {
|
|
369
|
+
execution: "worker",
|
|
370
|
+
signal: options.signal,
|
|
371
|
+
inputOwnership: options.inputOwnership ?? "transfer",
|
|
372
|
+
outputOwnership: options.outputOwnership ?? "transfer",
|
|
373
|
+
onProgress: options.onProgress ? (progress) => {
|
|
374
|
+
var _a;
|
|
375
|
+
return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
|
|
376
|
+
} : void 0
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function getParserOptions(options) {
|
|
380
|
+
const { signal, onProgress, parserOptions, ...workerOptions } = options;
|
|
381
|
+
return getTransferListForWriter(parserOptions ?? workerOptions);
|
|
1180
382
|
}
|
|
1181
|
-
async function
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
383
|
+
async function openSession(worker, options, context, jobContext) {
|
|
384
|
+
var _a, _b;
|
|
385
|
+
(_a = options.signal) == null ? void 0 : _a.throwIfAborted();
|
|
386
|
+
const task = getTask(worker, options);
|
|
387
|
+
let state = runners.get(worker);
|
|
388
|
+
if (!state) {
|
|
389
|
+
state = {
|
|
390
|
+
runner: new import_tasks2.TaskRunner({
|
|
391
|
+
maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
|
|
392
|
+
}),
|
|
393
|
+
requests: 0
|
|
394
|
+
};
|
|
395
|
+
runners.set(worker, state);
|
|
396
|
+
}
|
|
397
|
+
const runnerState = state;
|
|
398
|
+
const channel = context.process ? new MessageChannel() : void 0;
|
|
399
|
+
const callbackController = new AbortController();
|
|
400
|
+
let channelClosed = false;
|
|
401
|
+
const abortCallbacks = () => {
|
|
402
|
+
var _a2;
|
|
403
|
+
return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
|
|
404
|
+
};
|
|
405
|
+
(_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
|
|
406
|
+
const closeChannel = () => {
|
|
407
|
+
var _a2;
|
|
408
|
+
channelClosed = true;
|
|
409
|
+
(_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
|
|
410
|
+
callbackController.abort();
|
|
411
|
+
channel == null ? void 0 : channel.port1.close();
|
|
412
|
+
channel == null ? void 0 : channel.port2.close();
|
|
413
|
+
};
|
|
414
|
+
if (channel) {
|
|
415
|
+
channel.port1.onmessage = async ({ data }) => {
|
|
1194
416
|
try {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
|
|
417
|
+
const value = await context.process(data.input, data.options, {
|
|
418
|
+
signal: callbackController.signal,
|
|
419
|
+
throwIfAborted: () => callbackController.signal.throwIfAborted()
|
|
420
|
+
}, data.context);
|
|
421
|
+
if (!channelClosed && !callbackController.signal.aborted)
|
|
422
|
+
channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
|
|
1201
423
|
} catch (error) {
|
|
1202
|
-
|
|
1203
|
-
|
|
424
|
+
if (channelClosed || callbackController.signal.aborted)
|
|
425
|
+
return;
|
|
426
|
+
channel.port1.postMessage({
|
|
427
|
+
identifier: data.identifier,
|
|
428
|
+
error: {
|
|
429
|
+
name: error instanceof Error ? error.name : "Error",
|
|
430
|
+
message: error instanceof Error ? error.message : String(error)
|
|
431
|
+
}
|
|
432
|
+
});
|
|
1204
433
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
console.warn(`process-on-worker: unknown message ${type}`);
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
function onPreloadMessage(job, type, payload) {
|
|
1211
|
-
switch (type) {
|
|
1212
|
-
case "done":
|
|
1213
|
-
job.done(payload);
|
|
1214
|
-
break;
|
|
1215
|
-
case "error":
|
|
1216
|
-
job.error(new Error(payload.error));
|
|
1217
|
-
break;
|
|
1218
|
-
default:
|
|
1219
|
-
console.warn(`process-on-worker: unknown preload message ${type}`);
|
|
434
|
+
};
|
|
435
|
+
channel.port1.start();
|
|
1220
436
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
437
|
+
runnerState.requests++;
|
|
438
|
+
activeRunners.add(runnerState);
|
|
439
|
+
let released = false;
|
|
440
|
+
const releaseRunner = () => {
|
|
441
|
+
if (released)
|
|
442
|
+
return;
|
|
443
|
+
released = true;
|
|
444
|
+
runnerState.requests--;
|
|
445
|
+
if (!runnerState.requests)
|
|
446
|
+
activeRunners.delete(runnerState);
|
|
447
|
+
};
|
|
448
|
+
let handle;
|
|
1226
449
|
try {
|
|
1227
|
-
|
|
450
|
+
handle = await runnerState.runner.initializeTask(
|
|
451
|
+
task,
|
|
452
|
+
{
|
|
453
|
+
context: structuredClone(jobContext),
|
|
454
|
+
...channel ? { port: channel.port2 } : {}
|
|
455
|
+
},
|
|
456
|
+
// The callback port is setup state, independent of the caller's payload ownership.
|
|
457
|
+
{ ...getControls(options), inputOwnership: "transfer" }
|
|
458
|
+
);
|
|
1228
459
|
} catch (error) {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
// dist/worker-utils/lib/worker-api/create-worker.js
|
|
1234
|
-
var requestId = 0;
|
|
1235
|
-
var activeInputBatches = null;
|
|
1236
|
-
var activeOutputAcknowledgements = null;
|
|
1237
|
-
async function createWorker(process2, processInBatches) {
|
|
1238
|
-
if (!await WorkerBody.inWorkerThread()) {
|
|
1239
|
-
return;
|
|
460
|
+
releaseRunner();
|
|
461
|
+
closeChannel();
|
|
462
|
+
throw error;
|
|
1240
463
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
464
|
+
return {
|
|
465
|
+
handle,
|
|
466
|
+
/** Releases the worker and callback channel on success, failure, and early stream return. */
|
|
467
|
+
async close() {
|
|
468
|
+
try {
|
|
469
|
+
await handle.close();
|
|
470
|
+
} finally {
|
|
471
|
+
closeChannel();
|
|
472
|
+
releaseRunner();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
1243
475
|
};
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
break;
|
|
1260
|
-
case "process-in-batches":
|
|
1261
|
-
if (!processInBatches) {
|
|
1262
|
-
throw new Error("Worker does not support batched processing");
|
|
1263
|
-
}
|
|
1264
|
-
const inputBatches = new AsyncQueue();
|
|
1265
|
-
const outputAcknowledgements = new AsyncQueue();
|
|
1266
|
-
activeInputBatches = inputBatches;
|
|
1267
|
-
activeOutputAcknowledgements = outputAcknowledgements;
|
|
1268
|
-
try {
|
|
1269
|
-
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
1270
|
-
for await (const batch of resultIterator) {
|
|
1271
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
1272
|
-
await outputAcknowledgements.next();
|
|
1273
|
-
}
|
|
1274
|
-
reporter == null ? void 0 : reporter.finish();
|
|
1275
|
-
await WorkerBody.postMessage("done", {});
|
|
1276
|
-
} finally {
|
|
1277
|
-
activeInputBatches = null;
|
|
1278
|
-
activeOutputAcknowledgements = null;
|
|
1279
|
-
}
|
|
1280
|
-
break;
|
|
1281
|
-
case "input-batch":
|
|
1282
|
-
if (!activeInputBatches) {
|
|
1283
|
-
throw new Error("Worker has no active batched processing session");
|
|
1284
|
-
}
|
|
1285
|
-
activeInputBatches.push(payload.input);
|
|
1286
|
-
break;
|
|
1287
|
-
case "input-done":
|
|
1288
|
-
if (!activeInputBatches) {
|
|
1289
|
-
throw new Error("Worker has no active batched processing session");
|
|
1290
|
-
}
|
|
1291
|
-
activeInputBatches.close();
|
|
1292
|
-
break;
|
|
1293
|
-
case "output-ack":
|
|
1294
|
-
if (!activeOutputAcknowledgements) {
|
|
1295
|
-
throw new Error("Worker has no active batched processing session");
|
|
1296
|
-
}
|
|
1297
|
-
activeOutputAcknowledgements.push(void 0);
|
|
1298
|
-
break;
|
|
1299
|
-
default:
|
|
476
|
+
}
|
|
477
|
+
function wrapInput(input) {
|
|
478
|
+
const iterator = Symbol.asyncIterator in input ? input[Symbol.asyncIterator]() : input[Symbol.iterator]();
|
|
479
|
+
let inputClosed = false;
|
|
480
|
+
return {
|
|
481
|
+
[Symbol.asyncIterator]() {
|
|
482
|
+
return this;
|
|
483
|
+
},
|
|
484
|
+
async next() {
|
|
485
|
+
if (inputClosed)
|
|
486
|
+
return { done: true, value: void 0 };
|
|
487
|
+
const next = await iterator.next();
|
|
488
|
+
if (next.done || inputClosed) {
|
|
489
|
+
inputClosed = true;
|
|
490
|
+
return { done: true, value: void 0 };
|
|
1300
491
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
492
|
+
return { done: false, value: { value: next.value } };
|
|
493
|
+
},
|
|
494
|
+
async return() {
|
|
495
|
+
var _a;
|
|
496
|
+
if (!inputClosed) {
|
|
497
|
+
inputClosed = true;
|
|
498
|
+
await ((_a = iterator.return) == null ? void 0 : _a.call(iterator));
|
|
499
|
+
}
|
|
500
|
+
return { done: true, value: void 0 };
|
|
1305
501
|
}
|
|
1306
502
|
};
|
|
1307
503
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
504
|
+
function createModuleWorker(url) {
|
|
505
|
+
var _a;
|
|
506
|
+
const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
|
|
507
|
+
let workerUrl = resolved.href;
|
|
508
|
+
if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
|
|
509
|
+
let shimUrl = moduleWorkerUrls.get(resolved.href);
|
|
510
|
+
if (!shimUrl) {
|
|
511
|
+
shimUrl = URL.createObjectURL(new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" }));
|
|
512
|
+
moduleWorkerUrls.set(resolved.href, shimUrl);
|
|
1314
513
|
}
|
|
1315
|
-
|
|
514
|
+
workerUrl = shimUrl;
|
|
1316
515
|
}
|
|
516
|
+
return new Worker(workerUrl, { type: "module" });
|
|
1317
517
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
}
|
|
1325
|
-
switch (type) {
|
|
1326
|
-
case "done":
|
|
1327
|
-
WorkerBody.removeEventListener(onMessage2);
|
|
1328
|
-
resolve(payload2.result);
|
|
1329
|
-
break;
|
|
1330
|
-
case "error":
|
|
1331
|
-
WorkerBody.removeEventListener(onMessage2);
|
|
1332
|
-
reject(payload2.error);
|
|
1333
|
-
break;
|
|
1334
|
-
default:
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
WorkerBody.addEventListener(onMessage2);
|
|
1338
|
-
const payload = { id, input: arrayBuffer, options, context: jobContext };
|
|
1339
|
-
WorkerBody.postMessage("process", payload);
|
|
1340
|
-
});
|
|
518
|
+
|
|
519
|
+
// dist/worker-utils/lib/worker-api/create-worker.js
|
|
520
|
+
async function createWorker(process2, processInBatches) {
|
|
521
|
+
if (!await isWorkerThread())
|
|
522
|
+
return;
|
|
523
|
+
await initializeTaskWorker(createWorkerTask(process2, processInBatches));
|
|
1341
524
|
}
|
|
1342
|
-
function
|
|
1343
|
-
let pending;
|
|
1344
|
-
let finished = false;
|
|
1345
|
-
let scheduled = false;
|
|
1346
|
-
const flush = () => {
|
|
1347
|
-
scheduled = false;
|
|
1348
|
-
if (pending) {
|
|
1349
|
-
WorkerBody.postMessage("progress", { progress: pending });
|
|
1350
|
-
pending = void 0;
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
525
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1353
526
|
return {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
flush();
|
|
1360
|
-
pending = { ...progress };
|
|
1361
|
-
if (!scheduled) {
|
|
1362
|
-
scheduled = true;
|
|
1363
|
-
setTimeout(flush, 0);
|
|
1364
|
-
}
|
|
527
|
+
id: "loaders.gl",
|
|
528
|
+
initialize: (state) => state,
|
|
529
|
+
destroy: (state) => {
|
|
530
|
+
var _a;
|
|
531
|
+
return (_a = state.port) == null ? void 0 : _a.close();
|
|
1365
532
|
},
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
}
|
|
533
|
+
process: async ({ value }, options, context) => {
|
|
534
|
+
if (!process2)
|
|
535
|
+
throw new Error("Worker does not support atomic processing");
|
|
536
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
537
|
+
},
|
|
538
|
+
...processInBatches ? {
|
|
539
|
+
processInBatches: async function* (inputs, options, context) {
|
|
540
|
+
async function* values() {
|
|
541
|
+
for await (const input of inputs)
|
|
542
|
+
yield input.value;
|
|
543
|
+
}
|
|
544
|
+
for await (const value of processInBatches(values(), options, createContext(context), context.state.context)) {
|
|
545
|
+
yield { value };
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
} : {}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function createContext(context) {
|
|
552
|
+
let requestIdentifier = 0;
|
|
553
|
+
const port = context.state.port;
|
|
554
|
+
return {
|
|
555
|
+
signal: context.signal,
|
|
556
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
557
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
558
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
559
|
+
context.throwIfAborted();
|
|
560
|
+
const identifier = ++requestIdentifier;
|
|
561
|
+
return new Promise((resolve, reject) => {
|
|
562
|
+
const onMessage = (event) => {
|
|
563
|
+
if (event.data.identifier !== identifier)
|
|
564
|
+
return;
|
|
565
|
+
cleanup();
|
|
566
|
+
if (event.data.error) {
|
|
567
|
+
const error = new Error(event.data.error.message);
|
|
568
|
+
error.name = event.data.error.name;
|
|
569
|
+
reject(error);
|
|
570
|
+
} else
|
|
571
|
+
resolve(event.data.value);
|
|
572
|
+
};
|
|
573
|
+
const onAbort = () => {
|
|
574
|
+
cleanup();
|
|
575
|
+
reject(context.signal.reason);
|
|
576
|
+
};
|
|
577
|
+
const cleanup = () => {
|
|
578
|
+
port.removeEventListener("message", onMessage);
|
|
579
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
580
|
+
};
|
|
581
|
+
port.addEventListener("message", onMessage);
|
|
582
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
583
|
+
port.start();
|
|
584
|
+
try {
|
|
585
|
+
const request = { identifier, input, options, context: jobContext };
|
|
586
|
+
port.postMessage(request, getTransferList(request));
|
|
587
|
+
} catch (error) {
|
|
588
|
+
cleanup();
|
|
589
|
+
reject(error);
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
} : void 0
|
|
1371
593
|
};
|
|
1372
594
|
}
|
|
1373
595
|
|
|
@@ -1470,7 +692,7 @@ async function loadLibraryFromFile(libraryUrl, moduleLibraryUrl) {
|
|
|
1470
692
|
} catch {
|
|
1471
693
|
}
|
|
1472
694
|
}
|
|
1473
|
-
|
|
695
|
+
log.error(String(error))();
|
|
1474
696
|
return null;
|
|
1475
697
|
}
|
|
1476
698
|
}
|
|
@@ -1486,6 +708,7 @@ async function loadLibraryInWorker(libraryUrl, moduleLibraryUrl = libraryUrl) {
|
|
|
1486
708
|
} catch {
|
|
1487
709
|
const moduleUrl = new URL(moduleLibraryUrl, globalThis.location.href).href;
|
|
1488
710
|
const library = await import(
|
|
711
|
+
/* webpackIgnore: true */
|
|
1489
712
|
/* @vite-ignore */
|
|
1490
713
|
moduleUrl
|
|
1491
714
|
);
|