@loaders.gl/schema 4.0.0-alpha.4 → 4.0.0-alpha.6
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/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +13589 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/index.js +406 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/mesh/convert-mesh.js +34 -0
- package/dist/es5/lib/mesh/convert-mesh.js.map +1 -0
- package/dist/es5/lib/mesh/deduce-mesh-schema.js +56 -0
- package/dist/es5/lib/mesh/deduce-mesh-schema.js.map +1 -0
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js +2 -0
- package/dist/es5/lib/mesh/mesh-to-arrow-table.js.map +1 -0
- package/dist/es5/lib/mesh/mesh-utils.js +40 -0
- package/dist/es5/lib/mesh/mesh-utils.js.map +1 -0
- package/dist/es5/lib/table/arrow/arrow-type-utils.js +30 -0
- package/dist/es5/lib/table/arrow/arrow-type-utils.js.map +1 -0
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js +179 -0
- package/dist/es5/lib/table/arrow/convert-schema-arrow.js.map +1 -0
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js +2 -0
- package/dist/es5/lib/table/arrow/convert-table-to-arrow.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js +49 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-field.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js +118 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js +80 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-table.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js +740 -0
- package/dist/es5/lib/table/arrow-api/arrow-like-type.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/enum.js +55 -0
- package/dist/es5/lib/table/arrow-api/enum.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/get-type-info.js +27 -0
- package/dist/es5/lib/table/arrow-api/get-type-info.js.map +1 -0
- package/dist/es5/lib/table/arrow-api/index.js +44 -0
- package/dist/es5/lib/table/arrow-api/index.js.map +1 -0
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js +78 -0
- package/dist/es5/lib/table/batches/base-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js +106 -0
- package/dist/es5/lib/table/batches/columnar-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js +96 -0
- package/dist/es5/lib/table/batches/row-table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/table-batch-aggregator.js +2 -0
- package/dist/es5/lib/table/batches/table-batch-aggregator.js.map +1 -0
- package/dist/es5/lib/table/batches/table-batch-builder.js +173 -0
- package/dist/es5/lib/table/batches/table-batch-builder.js.map +1 -0
- package/dist/es5/lib/table/simple-table/convert-table.js +82 -0
- package/dist/es5/lib/table/simple-table/convert-table.js.map +1 -0
- package/dist/es5/lib/table/simple-table/data-type.js +94 -0
- package/dist/es5/lib/table/simple-table/data-type.js.map +1 -0
- package/dist/es5/lib/table/simple-table/make-table.js +60 -0
- package/dist/es5/lib/table/simple-table/make-table.js.map +1 -0
- package/dist/es5/lib/table/simple-table/row-utils.js +34 -0
- package/dist/es5/lib/table/simple-table/row-utils.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-accessors.js +343 -0
- package/dist/es5/lib/table/simple-table/table-accessors.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-column.js +12 -0
- package/dist/es5/lib/table/simple-table/table-column.js.map +1 -0
- package/dist/es5/lib/table/simple-table/table-schema.js +85 -0
- package/dist/es5/lib/table/simple-table/table-schema.js.map +1 -0
- package/dist/es5/lib/utils/assert.js +12 -0
- package/dist/es5/lib/utils/assert.js.map +1 -0
- package/dist/es5/lib/utils/async-queue.js +169 -0
- package/dist/es5/lib/utils/async-queue.js.map +1 -0
- package/dist/es5/types/category-gis.js +2 -0
- package/dist/es5/types/category-gis.js.map +1 -0
- package/dist/es5/types/category-image.js +2 -0
- package/dist/es5/types/category-image.js.map +1 -0
- package/dist/es5/types/category-mesh.js +2 -0
- package/dist/es5/types/category-mesh.js.map +1 -0
- package/dist/es5/types/category-table.js +2 -0
- package/dist/es5/types/category-table.js.map +1 -0
- package/dist/es5/types/category-texture.js +2 -0
- package/dist/es5/types/category-texture.js.map +1 -0
- package/dist/es5/types/schema.js +2 -0
- package/dist/es5/types/schema.js.map +1 -0
- package/dist/es5/types/types.js +2 -0
- package/dist/es5/types/types.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/{category → esm/lib}/mesh/convert-mesh.js +0 -11
- package/dist/esm/lib/mesh/convert-mesh.js.map +1 -0
- package/dist/esm/lib/mesh/deduce-mesh-schema.js +48 -0
- package/dist/esm/lib/mesh/deduce-mesh-schema.js.map +1 -0
- package/dist/esm/lib/mesh/mesh-to-arrow-table.js +2 -0
- package/dist/esm/lib/mesh/mesh-to-arrow-table.js.map +1 -0
- package/dist/{category → esm/lib}/mesh/mesh-utils.js +0 -5
- package/dist/esm/lib/mesh/mesh-utils.js.map +1 -0
- package/dist/{lib/arrow/arrow-like-type-utils.js → esm/lib/table/arrow/arrow-type-utils.js} +3 -11
- package/dist/esm/lib/table/arrow/arrow-type-utils.js.map +1 -0
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js +158 -0
- package/dist/esm/lib/table/arrow/convert-schema-arrow.js.map +1 -0
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js +2 -0
- package/dist/esm/lib/table/arrow/convert-table-to-arrow.js.map +1 -0
- package/dist/{lib/schema/impl/field.js → esm/lib/table/arrow-api/arrow-like-field.js} +6 -13
- package/dist/esm/lib/table/arrow-api/arrow-like-field.js.map +1 -0
- package/dist/{lib/schema/impl/schema.js → esm/lib/table/arrow-api/arrow-like-schema.js} +22 -47
- package/dist/esm/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js +51 -0
- package/dist/esm/lib/table/arrow-api/arrow-like-table.js.map +1 -0
- package/dist/{lib/schema/impl/type.js → esm/lib/table/arrow-api/arrow-like-type.js} +11 -116
- package/dist/esm/lib/table/arrow-api/arrow-like-type.js.map +1 -0
- package/dist/{lib/schema/impl → esm/lib/table/arrow-api}/enum.js +3 -4
- package/dist/esm/lib/table/arrow-api/enum.js.map +1 -0
- package/dist/{lib/arrow → esm/lib/table/arrow-api}/get-type-info.js +1 -4
- package/dist/esm/lib/table/arrow-api/get-type-info.js.map +1 -0
- package/dist/esm/lib/table/arrow-api/index.js +5 -0
- package/dist/esm/lib/table/arrow-api/index.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/base-table-batch-aggregator.js +1 -18
- package/dist/esm/lib/table/batches/base-table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/columnar-table-batch-aggregator.js +1 -24
- package/dist/esm/lib/table/batches/columnar-table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/row-table-batch-aggregator.js +2 -22
- package/dist/esm/lib/table/batches/row-table-batch-aggregator.js.map +1 -0
- package/dist/esm/lib/table/batches/table-batch-aggregator.js.map +1 -0
- package/dist/{lib → esm/lib/table}/batches/table-batch-builder.js +6 -49
- package/dist/esm/lib/table/batches/table-batch-builder.js.map +1 -0
- package/dist/esm/lib/table/simple-table/convert-table.js +59 -0
- package/dist/esm/lib/table/simple-table/convert-table.js.map +1 -0
- package/dist/esm/lib/table/simple-table/data-type.js +85 -0
- package/dist/esm/lib/table/simple-table/data-type.js.map +1 -0
- package/dist/esm/lib/table/simple-table/make-table.js +50 -0
- package/dist/esm/lib/table/simple-table/make-table.js.map +1 -0
- package/dist/{lib/utils → esm/lib/table/simple-table}/row-utils.js +0 -8
- package/dist/esm/lib/table/simple-table/row-utils.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-accessors.js +262 -0
- package/dist/esm/lib/table/simple-table/table-accessors.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-column.js +6 -0
- package/dist/esm/lib/table/simple-table/table-column.js.map +1 -0
- package/dist/esm/lib/table/simple-table/table-schema.js +70 -0
- package/dist/esm/lib/table/simple-table/table-schema.js.map +1 -0
- package/dist/esm/lib/utils/assert.js +6 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/lib/utils/async-queue.js +94 -0
- package/dist/esm/lib/utils/async-queue.js.map +1 -0
- package/dist/esm/types/category-gis.js +2 -0
- package/dist/esm/types/category-gis.js.map +1 -0
- package/dist/esm/types/category-image.js +2 -0
- package/dist/esm/types/category-image.js.map +1 -0
- package/dist/esm/types/category-mesh.js +2 -0
- package/dist/esm/types/category-mesh.js.map +1 -0
- package/dist/esm/types/category-table.js +2 -0
- package/dist/esm/types/category-table.js.map +1 -0
- package/dist/esm/types/category-texture.js +2 -0
- package/dist/esm/types/category-texture.js.map +1 -0
- package/dist/esm/types/schema.js +2 -0
- package/dist/esm/types/schema.js.map +1 -0
- package/dist/esm/types/types.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -13
- package/dist/lib/mesh/convert-mesh.d.ts +15 -0
- package/dist/lib/mesh/convert-mesh.d.ts.map +1 -0
- package/dist/lib/mesh/convert-mesh.js +40 -0
- package/dist/lib/mesh/deduce-mesh-schema.d.ts +24 -0
- package/dist/lib/mesh/deduce-mesh-schema.d.ts.map +1 -0
- package/dist/lib/mesh/deduce-mesh-schema.js +66 -0
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts +1 -0
- package/dist/lib/mesh/mesh-to-arrow-table.d.ts.map +1 -0
- package/dist/lib/mesh/mesh-to-arrow-table.js +44 -0
- package/dist/lib/mesh/mesh-utils.d.ts +23 -0
- package/dist/lib/mesh/mesh-utils.d.ts.map +1 -0
- package/dist/lib/mesh/mesh-utils.js +51 -0
- package/dist/lib/table/arrow/arrow-type-utils.d.ts +4 -0
- package/dist/lib/table/arrow/arrow-type-utils.d.ts.map +1 -0
- package/dist/lib/table/arrow/arrow-type-utils.js +53 -0
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts +13 -0
- package/dist/lib/table/arrow/convert-schema-arrow.d.ts.map +1 -0
- package/dist/lib/table/arrow/convert-schema-arrow.js +187 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts +42 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.d.ts.map +1 -0
- package/dist/lib/table/arrow/convert-table-to-arrow.js +57 -0
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts +19 -0
- package/dist/lib/table/arrow-api/arrow-like-field.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-field.js +34 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts +12 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-schema.js +81 -0
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts +28 -0
- package/dist/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-table.js +53 -0
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts +177 -0
- package/dist/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/arrow-like-type.js +463 -0
- package/dist/lib/table/arrow-api/enum.d.ts +92 -0
- package/dist/lib/table/arrow-api/enum.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/enum.js +97 -0
- package/dist/lib/table/arrow-api/get-type-info.d.ts +13 -0
- package/dist/lib/table/arrow-api/get-type-info.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/get-type-info.js +29 -0
- package/dist/lib/table/arrow-api/index.d.ts +5 -0
- package/dist/lib/table/arrow-api/index.d.ts.map +1 -0
- package/dist/lib/table/arrow-api/index.js +25 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts +19 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/base-table-batch-aggregator.js +60 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts +23 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/columnar-table-batch-aggregator.js +92 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts +22 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/row-table-batch-aggregator.js +81 -0
- package/dist/lib/table/batches/table-batch-aggregator.d.ts +25 -0
- package/dist/lib/table/batches/table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/table/batches/table-batch-aggregator.js +3 -0
- package/dist/lib/table/batches/table-batch-builder.d.ts +53 -0
- package/dist/lib/table/batches/table-batch-builder.d.ts.map +1 -0
- package/dist/lib/table/batches/table-batch-builder.js +152 -0
- package/dist/lib/table/simple-table/convert-table.d.ts +8 -0
- package/dist/lib/table/simple-table/convert-table.d.ts.map +1 -0
- package/dist/lib/table/simple-table/convert-table.js +65 -0
- package/dist/lib/table/simple-table/data-type.d.ts +17 -0
- package/dist/lib/table/simple-table/data-type.d.ts.map +1 -0
- package/dist/lib/table/simple-table/data-type.js +93 -0
- package/dist/lib/table/simple-table/make-table.d.ts +65 -0
- package/dist/lib/table/simple-table/make-table.d.ts.map +1 -0
- package/dist/lib/table/simple-table/make-table.js +95 -0
- package/dist/lib/table/simple-table/row-utils.d.ts +9 -0
- package/dist/lib/table/simple-table/row-utils.d.ts.map +1 -0
- package/dist/lib/table/simple-table/row-utils.js +33 -0
- package/dist/lib/table/simple-table/table-accessors.d.ts +67 -0
- package/dist/lib/table/simple-table/table-accessors.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-accessors.js +319 -0
- package/dist/lib/table/simple-table/table-column.d.ts +7 -0
- package/dist/lib/table/simple-table/table-column.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-column.js +41 -0
- package/dist/lib/table/simple-table/table-schema.d.ts +15 -0
- package/dist/lib/table/simple-table/table-schema.d.ts.map +1 -0
- package/dist/lib/table/simple-table/table-schema.js +85 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +11 -5
- package/dist/lib/utils/async-queue.d.ts +18 -0
- package/dist/lib/utils/async-queue.d.ts.map +1 -0
- package/dist/lib/utils/async-queue.js +82 -109
- package/dist/types/category-gis.d.ts +99 -0
- package/dist/types/category-gis.d.ts.map +1 -0
- package/dist/types/category-gis.js +2 -0
- package/dist/types/category-image.d.ts +18 -0
- package/dist/types/category-image.d.ts.map +1 -0
- package/dist/types/category-image.js +2 -0
- package/dist/types/category-mesh.d.ts +48 -0
- package/dist/types/category-mesh.d.ts.map +1 -0
- package/dist/types/category-mesh.js +3 -0
- package/dist/types/category-table.d.ts +86 -0
- package/dist/types/category-table.d.ts.map +1 -0
- package/dist/types/category-table.js +3 -0
- package/dist/types/category-texture.d.ts +18 -0
- package/dist/types/category-texture.d.ts.map +1 -0
- package/dist/types/category-texture.js +3 -0
- package/dist/types/schema.d.ts +77 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +3 -0
- package/dist/types/types.d.ts +15 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/package.json +7 -8
- package/src/index.ts +82 -29
- package/src/{category → lib}/mesh/convert-mesh.ts +10 -8
- package/src/{category → lib}/mesh/deduce-mesh-schema.ts +20 -19
- package/src/{category → lib}/mesh/mesh-to-arrow-table.ts +5 -3
- package/src/{category → lib}/mesh/mesh-utils.ts +2 -2
- package/src/lib/{arrow → table/arrow}/arrow-type-utils.ts +16 -12
- package/src/lib/table/arrow/convert-schema-arrow.ts +232 -0
- package/src/lib/table/arrow/convert-table-to-arrow.ts +59 -0
- package/src/lib/{schema/impl/field.ts → table/arrow-api/arrow-like-field.ts} +6 -4
- package/src/lib/table/arrow-api/arrow-like-schema.ts +99 -0
- package/src/lib/table/arrow-api/arrow-like-table.ts +83 -0
- package/src/lib/{schema/impl/type.ts → table/arrow-api/arrow-like-type.ts} +2 -1
- package/src/lib/{arrow → table/arrow-api}/get-type-info.ts +4 -3
- package/src/lib/table/arrow-api/index.ts +6 -0
- package/src/lib/{batches → table/batches}/base-table-batch-aggregator.ts +5 -3
- package/src/lib/{batches → table/batches}/columnar-table-batch-aggregator.ts +5 -3
- package/src/lib/{batches → table/batches}/row-table-batch-aggregator.ts +6 -4
- package/src/lib/{batches → table/batches}/table-batch-aggregator.ts +4 -2
- package/src/lib/{batches → table/batches}/table-batch-builder.ts +8 -6
- package/src/lib/table/simple-table/convert-table.ts +72 -0
- package/src/lib/table/simple-table/data-type.ts +102 -0
- package/src/lib/table/simple-table/make-table.ts +108 -0
- package/src/lib/table/simple-table/table-accessors.ts +360 -0
- package/src/lib/table/simple-table/table-column.ts +47 -0
- package/src/lib/table/simple-table/table-schema.ts +97 -0
- package/src/types/category-gis.ts +136 -0
- package/src/types/category-image.ts +19 -0
- package/src/{category/mesh/mesh-types.ts → types/category-mesh.ts} +6 -4
- package/src/types/category-table.ts +104 -0
- package/src/types/category-texture.ts +30 -0
- package/src/types/schema.ts +97 -0
- package/src/types/types.ts +43 -0
- package/dist/bundle.js.map +0 -1
- package/dist/category/common.js +0 -2
- package/dist/category/common.js.map +0 -1
- package/dist/category/gis.js +0 -2
- package/dist/category/gis.js.map +0 -1
- package/dist/category/mesh/convert-mesh.js.map +0 -1
- package/dist/category/mesh/deduce-mesh-schema.js +0 -42
- package/dist/category/mesh/deduce-mesh-schema.js.map +0 -1
- package/dist/category/mesh/mesh-to-arrow-table.js +0 -31
- package/dist/category/mesh/mesh-to-arrow-table.js.map +0 -1
- package/dist/category/mesh/mesh-types.js +0 -2
- package/dist/category/mesh/mesh-types.js.map +0 -1
- package/dist/category/mesh/mesh-utils.js.map +0 -1
- package/dist/category/table/deduce-table-schema.js +0 -51
- package/dist/category/table/deduce-table-schema.js.map +0 -1
- package/dist/category/table/table-types.js +0 -2
- package/dist/category/table/table-types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.js.map +0 -1
- package/dist/lib/arrow/arrow-type-utils.js +0 -62
- package/dist/lib/arrow/arrow-type-utils.js.map +0 -1
- package/dist/lib/arrow/get-type-info.js.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-builder.js.map +0 -1
- package/dist/lib/schema/impl/enum.js.map +0 -1
- package/dist/lib/schema/impl/field.js.map +0 -1
- package/dist/lib/schema/impl/schema.js.map +0 -1
- package/dist/lib/schema/impl/type.js.map +0 -1
- package/dist/lib/schema/index.js +0 -5
- package/dist/lib/schema/index.js.map +0 -1
- package/dist/lib/schema-utils/deduce-column-type.js +0 -23
- package/dist/lib/schema-utils/deduce-column-type.js.map +0 -1
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/async-queue.js.map +0 -1
- package/dist/lib/utils/row-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/category/common.ts +0 -30
- package/src/category/gis.ts +0 -61
- package/src/category/table/deduce-table-schema.ts +0 -123
- package/src/category/table/table-types.ts +0 -81
- package/src/lib/arrow/arrow-like-type-utils.ts +0 -25
- package/src/lib/schema/impl/schema.ts +0 -99
- package/src/lib/schema/index.ts +0 -82
- package/src/lib/schema-utils/deduce-column-type.ts +0 -92
- package/src/types.ts +0 -19
- /package/dist/{lib → esm/lib/table}/batches/table-batch-aggregator.js +0 -0
- /package/dist/{types.js → esm/types/types.js} +0 -0
- /package/src/lib/{schema/impl → table/arrow-api}/enum.ts +0 -0
- /package/src/lib/{utils → table/simple-table}/row-utils.ts +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// GIS
|
|
2
|
+
import type {TypedArray} from './types';
|
|
3
|
+
import type {Feature, Geometry, Point, LineString, Polygon} from 'geojson';
|
|
4
|
+
|
|
5
|
+
// GEOJSON FORMAT GEOMETRY
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line import/no-unresolved
|
|
8
|
+
export type {
|
|
9
|
+
GeoJSON,
|
|
10
|
+
Feature,
|
|
11
|
+
FeatureCollection,
|
|
12
|
+
Geometry,
|
|
13
|
+
Position,
|
|
14
|
+
GeoJsonProperties
|
|
15
|
+
} from 'geojson';
|
|
16
|
+
// eslint-disable-next-line import/no-unresolved
|
|
17
|
+
export type {
|
|
18
|
+
Point,
|
|
19
|
+
MultiPoint,
|
|
20
|
+
LineString,
|
|
21
|
+
MultiLineString,
|
|
22
|
+
Polygon,
|
|
23
|
+
MultiPolygon,
|
|
24
|
+
GeometryCollection
|
|
25
|
+
} from 'geojson';
|
|
26
|
+
|
|
27
|
+
// Aggregate information for converting GeoJSON into other formats
|
|
28
|
+
export type GeojsonGeometryInfo = {
|
|
29
|
+
coordLength: number;
|
|
30
|
+
pointPositionsCount: number;
|
|
31
|
+
pointFeaturesCount: number;
|
|
32
|
+
linePositionsCount: number;
|
|
33
|
+
linePathsCount: number;
|
|
34
|
+
lineFeaturesCount: number;
|
|
35
|
+
polygonPositionsCount: number;
|
|
36
|
+
polygonObjectsCount: number;
|
|
37
|
+
polygonRingsCount: number;
|
|
38
|
+
polygonFeaturesCount: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// FLAT GEOJSON FORMAT GEOMETRY
|
|
42
|
+
export type FlatGeometryType = 'Point' | 'LineString' | 'Polygon';
|
|
43
|
+
type RemoveCoordinatesField<Type> = {
|
|
44
|
+
[Property in keyof Type as Exclude<Property, 'coordinates'>]: Type[Property];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generic flat geometry data storage type
|
|
49
|
+
*/
|
|
50
|
+
export type FlatIndexedGeometry = {
|
|
51
|
+
data: number[];
|
|
52
|
+
indices: number[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* GeoJSON (Multi)Point geometry with coordinate data flattened into `data` array and indexed by `indices`
|
|
57
|
+
*/
|
|
58
|
+
export type FlatPoint = RemoveCoordinatesField<Point> & FlatIndexedGeometry;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* GeoJSON (Multi)LineString geometry with coordinate data flattened into `data` array and indexed by `indices`
|
|
62
|
+
*/
|
|
63
|
+
export type FlatLineString = RemoveCoordinatesField<LineString> & FlatIndexedGeometry;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* GeoJSON (Multi)Polygon geometry with coordinate data flattened into `data` array and indexed by 2D `indices`
|
|
67
|
+
*/
|
|
68
|
+
export type FlatPolygon = RemoveCoordinatesField<Polygon> & {
|
|
69
|
+
data: number[];
|
|
70
|
+
indices: number[][];
|
|
71
|
+
areas: number[][];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type FlatGeometry = FlatPoint | FlatLineString | FlatPolygon;
|
|
75
|
+
|
|
76
|
+
type FlattenGeometry<Type> = {
|
|
77
|
+
[Property in keyof Type]: Type[Property] extends Geometry ? FlatGeometry : Type[Property];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* GeoJSON Feature with Geometry replaced by FlatGeometry
|
|
82
|
+
*/
|
|
83
|
+
export type FlatFeature = FlattenGeometry<Feature>;
|
|
84
|
+
|
|
85
|
+
// BINARY FORMAT GEOMETRY
|
|
86
|
+
|
|
87
|
+
export type BinaryAttribute = {value: TypedArray; size: number};
|
|
88
|
+
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';
|
|
89
|
+
|
|
90
|
+
type NumericProps = {[key: string]: BinaryAttribute};
|
|
91
|
+
type Properties = object[];
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Represent a single Geometry, similar to a GeoJSON Geometry
|
|
95
|
+
*/
|
|
96
|
+
export type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;
|
|
97
|
+
|
|
98
|
+
export type BinaryPointGeometry = {
|
|
99
|
+
type: 'Point';
|
|
100
|
+
positions: BinaryAttribute;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type BinaryLineGeometry = {
|
|
104
|
+
type: 'LineString';
|
|
105
|
+
positions: BinaryAttribute;
|
|
106
|
+
pathIndices: BinaryAttribute;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type BinaryPolygonGeometry = {
|
|
110
|
+
type: 'Polygon';
|
|
111
|
+
positions: BinaryAttribute;
|
|
112
|
+
polygonIndices: BinaryAttribute;
|
|
113
|
+
primitivePolygonIndices: BinaryAttribute;
|
|
114
|
+
triangles?: BinaryAttribute;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type BinaryProperties = {
|
|
118
|
+
featureIds: BinaryAttribute;
|
|
119
|
+
globalFeatureIds: BinaryAttribute;
|
|
120
|
+
numericProps: NumericProps;
|
|
121
|
+
properties: Properties;
|
|
122
|
+
fields?: Properties;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type BinaryPointFeatures = BinaryPointGeometry & BinaryProperties;
|
|
126
|
+
export type BinaryLineFeatures = BinaryLineGeometry & BinaryProperties;
|
|
127
|
+
export type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProperties;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
|
|
131
|
+
*/
|
|
132
|
+
export type BinaryFeatures = {
|
|
133
|
+
points?: BinaryPointFeatures;
|
|
134
|
+
lines?: BinaryLineFeatures;
|
|
135
|
+
polygons?: BinaryPolygonFeatures;
|
|
136
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data images
|
|
3
|
+
*/
|
|
4
|
+
export type ImageDataType = {
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
compressed?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Supported Image Types
|
|
13
|
+
*/
|
|
14
|
+
export type ImageType = ImageBitmap | typeof Image | ImageDataType;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Image type string used to control or determine the type of images returned from ImageLoader
|
|
18
|
+
*/
|
|
19
|
+
export type ImageTypeEnum = 'imagebitmap' | 'image' | 'data';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type {
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {Schema} from './schema';
|
|
4
|
+
import type {TypedArray} from './types';
|
|
5
|
+
import type {ColumnarTable, ArrowTable} from './category-table';
|
|
4
6
|
|
|
5
7
|
/** Mesh as columnar table */
|
|
6
8
|
export interface MeshTable extends ColumnarTable {
|
|
@@ -48,4 +50,4 @@ export type MeshAttribute = {
|
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
/** A map of mesh attributes keyed by attribute names */
|
|
51
|
-
export type MeshAttributes =
|
|
53
|
+
export type MeshAttributes = Record<string, MeshAttribute>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow';
|
|
4
|
+
import type {Batch, Schema} from './schema';
|
|
5
|
+
import type {Feature} from './category-gis';
|
|
6
|
+
|
|
7
|
+
// Idea was to just import types, but it seems
|
|
8
|
+
// Seems this triggers more bundling and build issues than it is worth...
|
|
9
|
+
// import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow';
|
|
10
|
+
// type ApacheArrowTable = any;
|
|
11
|
+
// type RecordBatch = any;
|
|
12
|
+
|
|
13
|
+
/** A general table */
|
|
14
|
+
export type Table =
|
|
15
|
+
| RowTable
|
|
16
|
+
| ArrayRowTable
|
|
17
|
+
| ObjectRowTable
|
|
18
|
+
| GeoJSONRowTable
|
|
19
|
+
| ColumnarTable
|
|
20
|
+
| ArrowTable;
|
|
21
|
+
|
|
22
|
+
/** A table organized as an array of rows */
|
|
23
|
+
export type RowTable = ArrayRowTable | ObjectRowTable | GeoJSONRowTable;
|
|
24
|
+
|
|
25
|
+
/** A table organized as an array of rows, each row is an array of values */
|
|
26
|
+
export type ArrayRowTable = {
|
|
27
|
+
shape: 'array-row-table';
|
|
28
|
+
schema?: Schema;
|
|
29
|
+
data: any[][];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** A table organized as an array of rows, each row is an object mapping columns to values */
|
|
33
|
+
export type ObjectRowTable = {
|
|
34
|
+
shape: 'object-row-table';
|
|
35
|
+
schema?: Schema;
|
|
36
|
+
data: {[columnName: string]: any}[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** A table organized as an array of rows, each row is a GeoJSON Feature */
|
|
40
|
+
export type GeoJSONRowTable = {
|
|
41
|
+
shape: 'geojson-row-table';
|
|
42
|
+
schema?: Schema;
|
|
43
|
+
data: Feature[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** A table organized as a map of columns, each column is an array of value */
|
|
47
|
+
export type ColumnarTable = {
|
|
48
|
+
shape: 'columnar-table';
|
|
49
|
+
schema?: Schema;
|
|
50
|
+
data: {[columnName: string]: ArrayLike<unknown>};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** A table organized as an Apache Arrow table */
|
|
54
|
+
export type ArrowTable = {
|
|
55
|
+
shape: 'arrow-table';
|
|
56
|
+
schema?: Schema;
|
|
57
|
+
data: ApacheArrowTable;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** A collection of tables */
|
|
61
|
+
export type Tables<TableType = Table> = {
|
|
62
|
+
shape: 'tables';
|
|
63
|
+
tables: {name: string; table: TableType}[];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Batches
|
|
67
|
+
|
|
68
|
+
/** Batch for a general table */
|
|
69
|
+
export type TableBatch = Batch & {
|
|
70
|
+
data: any;
|
|
71
|
+
length: number;
|
|
72
|
+
schema?: Schema;
|
|
73
|
+
schemaType?: 'explicit' | 'deduced';
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Batch for a table organized as an array of rows, each row is an array of values */
|
|
77
|
+
export type ArrayRowTableBatch = TableBatch & {
|
|
78
|
+
shape: 'array-row-table';
|
|
79
|
+
data: any[][];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** Batch for a table organized as an array of rows, each row is an object mapping columns to values */
|
|
83
|
+
export type ObjectRowTableBatch = TableBatch & {
|
|
84
|
+
shape: 'object-row-table';
|
|
85
|
+
data: {[columnName: string]: any}[];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Batch for a table organized as an array of rows, each row is an array of values */
|
|
89
|
+
export type GeoJSONRowTableBatch = TableBatch & {
|
|
90
|
+
shape: 'geojson-row-table';
|
|
91
|
+
data: Feature[];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** Batch for a table organized as a map of columns, each column is an array of value */
|
|
95
|
+
export type ColumnarTableBatch = TableBatch & {
|
|
96
|
+
shape: 'columnar-table';
|
|
97
|
+
data: {[columnName: string]: ArrayLike<unknown>};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** Batch for a table organized as an Apache Arrow table */
|
|
101
|
+
export type ArrowTableBatch = TableBatch & {
|
|
102
|
+
shape: 'arrow-table';
|
|
103
|
+
data: RecordBatch;
|
|
104
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {ImageType} from './category-image';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* These represent the main compressed texture formats
|
|
7
|
+
* Each format typically has a number of more specific subformats
|
|
8
|
+
*/
|
|
9
|
+
export type GPUTextureFormat =
|
|
10
|
+
| 'dxt'
|
|
11
|
+
| 'dxt-srgb'
|
|
12
|
+
| 'etc1'
|
|
13
|
+
| 'etc2'
|
|
14
|
+
| 'pvrtc'
|
|
15
|
+
| 'atc'
|
|
16
|
+
| 'astc'
|
|
17
|
+
| 'rgtc';
|
|
18
|
+
|
|
19
|
+
/** One mip level */
|
|
20
|
+
export type TextureLevel = {
|
|
21
|
+
compressed: boolean;
|
|
22
|
+
format?: number;
|
|
23
|
+
data: Uint8Array;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
levelSize?: number;
|
|
27
|
+
hasAlpha?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type TextureOrImage = ImageType | (TextureLevel | ImageType);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
import type {RecordBatch} from 'apache-arrow';
|
|
4
|
+
|
|
5
|
+
/** For dictionary type */
|
|
6
|
+
export type KeyType = 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32';
|
|
7
|
+
|
|
8
|
+
/** ArrowLike DataType class */
|
|
9
|
+
export type DataType =
|
|
10
|
+
| 'null'
|
|
11
|
+
// Primitive types
|
|
12
|
+
| 'bool'
|
|
13
|
+
| 'int'
|
|
14
|
+
| 'int8'
|
|
15
|
+
| 'int16'
|
|
16
|
+
| 'int32'
|
|
17
|
+
| 'int64'
|
|
18
|
+
| 'uint8'
|
|
19
|
+
| 'uint16'
|
|
20
|
+
| 'uint32'
|
|
21
|
+
| 'uint64'
|
|
22
|
+
| 'float'
|
|
23
|
+
| 'float16'
|
|
24
|
+
| 'float32'
|
|
25
|
+
| 'float64'
|
|
26
|
+
| 'binary'
|
|
27
|
+
| 'utf8'
|
|
28
|
+
| 'date-day'
|
|
29
|
+
| 'date-millisecond'
|
|
30
|
+
| 'time-second'
|
|
31
|
+
| 'time-millisecond'
|
|
32
|
+
| 'time-microsecond'
|
|
33
|
+
| 'time-nanosecond'
|
|
34
|
+
| 'timestamp-second'
|
|
35
|
+
| 'timestamp-millisecond'
|
|
36
|
+
| 'timestamp-microsecond'
|
|
37
|
+
| 'timestamp-nanosecond'
|
|
38
|
+
| 'interval-daytime'
|
|
39
|
+
| 'interval-yearmonth'
|
|
40
|
+
// Composite types
|
|
41
|
+
| {type: 'list'; children: Field[]} // one child only
|
|
42
|
+
| {type: 'struct'; children: Field[]}
|
|
43
|
+
| {
|
|
44
|
+
type: 'sparse-union';
|
|
45
|
+
typeIds: Int32Array;
|
|
46
|
+
children: Field[];
|
|
47
|
+
typeIdToChildIndex: {[key: number]: number};
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
type: 'dense-union';
|
|
51
|
+
typeIds: Int32Array;
|
|
52
|
+
children: Field[];
|
|
53
|
+
typeIdToChildIndex: {[key: number]: number};
|
|
54
|
+
}
|
|
55
|
+
| {type: 'fixed-size-binary'; byteWidth: number}
|
|
56
|
+
| {type: 'fixed-size-list'; listSize: number; children: Field[]}
|
|
57
|
+
| {type: 'map'; keysSorted: boolean; children: Field[]} // Field is "struct"
|
|
58
|
+
| {type: 'dictionary'; id: number; indices: KeyType; dictionary: DataType; isOrdered: boolean};
|
|
59
|
+
// TODO - unions etc
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* SchemaMetadata
|
|
63
|
+
*/
|
|
64
|
+
export type SchemaMetadata = Record<string, string>;
|
|
65
|
+
export type FieldMetadata = Record<string, string>;
|
|
66
|
+
|
|
67
|
+
export type Field = {
|
|
68
|
+
name: string;
|
|
69
|
+
type: DataType;
|
|
70
|
+
nullable?: boolean;
|
|
71
|
+
metadata?: FieldMetadata;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `Schema` type that that can hold all data required by an Arrow Schema
|
|
76
|
+
* but is fully serializable. Helper functions make it easy to convert to and from arrow schemas
|
|
77
|
+
* https://loaders.gl/arrowjs/docs/api-reference/schema
|
|
78
|
+
*/
|
|
79
|
+
export type Schema = {
|
|
80
|
+
fields: Field[];
|
|
81
|
+
metadata: SchemaMetadata;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type Batch = {
|
|
85
|
+
batchType: 'data' | 'metadata' | 'partial-result' | 'final-result';
|
|
86
|
+
batch?: number;
|
|
87
|
+
mimeType?: string;
|
|
88
|
+
shape: string;
|
|
89
|
+
data: any;
|
|
90
|
+
recordBatch?: RecordBatch;
|
|
91
|
+
length: number;
|
|
92
|
+
schema?: Schema;
|
|
93
|
+
bytesUsed?: number;
|
|
94
|
+
count?: number;
|
|
95
|
+
cursor?: number;
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Any typed array */
|
|
2
|
+
export type TypedArray =
|
|
3
|
+
| Int8Array
|
|
4
|
+
| Uint8Array
|
|
5
|
+
| Int16Array
|
|
6
|
+
| Uint16Array
|
|
7
|
+
| Int32Array
|
|
8
|
+
| Uint32Array
|
|
9
|
+
| Uint8ClampedArray
|
|
10
|
+
| Float32Array
|
|
11
|
+
| Float64Array;
|
|
12
|
+
|
|
13
|
+
export type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;
|
|
14
|
+
|
|
15
|
+
export type TypedArrayConstructor =
|
|
16
|
+
| Int8ArrayConstructor
|
|
17
|
+
| Uint8ArrayConstructor
|
|
18
|
+
| Int16ArrayConstructor
|
|
19
|
+
| Uint16ArrayConstructor
|
|
20
|
+
| Int32ArrayConstructor
|
|
21
|
+
| Uint32ArrayConstructor
|
|
22
|
+
| Int32ArrayConstructor
|
|
23
|
+
| Uint32ArrayConstructor
|
|
24
|
+
| Float32ArrayConstructor
|
|
25
|
+
| Float64ArrayConstructor;
|
|
26
|
+
|
|
27
|
+
export type BigTypedArrayConstructor =
|
|
28
|
+
| TypedArrayConstructor
|
|
29
|
+
| BigInt64ArrayConstructor
|
|
30
|
+
| BigUint64ArrayConstructor;
|
|
31
|
+
|
|
32
|
+
/** Any numeric array: typed array or `number[]` */
|
|
33
|
+
export type NumberArray = number[] | TypedArray;
|
|
34
|
+
|
|
35
|
+
export type NumericArray = number[] | TypedArray;
|
|
36
|
+
|
|
37
|
+
export interface ArrayType<T = unknown> {
|
|
38
|
+
readonly length: number;
|
|
39
|
+
[n: number]: T;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Any array: typed array or js array (`any[]`) */
|
|
43
|
+
export type AnyArray = any[] | TypedArray;
|
package/dist/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/category/common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"common.js"}
|
package/dist/category/gis.js
DELETED
package/dist/category/gis.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"gis.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/category/mesh/convert-mesh.ts"],"names":["convertMeshToArrowTable","convertMesh","mesh","shape","options","convertMeshToColumnarTable","data","Error","columns","columnName","attribute","Object","entries","attributes","value","schema"],"mappings":"AAEA,SAAQA,uBAAR,QAAsC,uBAAtC;AAOA,OAAO,SAASC,WAAT,CACLC,IADK,EAELC,KAFK,EAGLC,OAHK,EAI8B;AACnC,UAAQD,KAAK,IAAI,MAAjB;AACE,SAAK,MAAL;AACE,aAAOD,IAAP;;AACF,SAAK,gBAAL;AACE,aAAOG,0BAA0B,CAACH,IAAD,CAAjC;;AACF,SAAK,aAAL;AACE,aAAO;AACLC,QAAAA,KAAK,EAAE,aADF;AAELG,QAAAA,IAAI,EAAEN,uBAAuB,CAACE,IAAD;AAFxB,OAAP;;AAIF;AACE,YAAM,IAAIK,KAAJ,6BAA+BH,OAA/B,aAA+BA,OAA/B,uBAA+BA,OAAO,CAAED,KAAxC,EAAN;AAXJ;AAaD;AAOD,OAAO,SAASE,0BAAT,CAAoCH,IAApC,EAA+D;AACpE,QAAMM,OAAO,GAAG,EAAhB;;AAEA,OAAK,MAAM,CAACC,UAAD,EAAaC,SAAb,CAAX,IAAsCC,MAAM,CAACC,OAAP,CAAeV,IAAI,CAACW,UAApB,CAAtC,EAAuE;AACrEL,IAAAA,OAAO,CAACC,UAAD,CAAP,GAAsBC,SAAS,CAACI,KAAhC;AACD;;AAED,SAAO;AACLX,IAAAA,KAAK,EAAE,gBADF;AAELY,IAAAA,MAAM,EAAEb,IAAI,CAACa,MAFR;AAGLT,IAAAA,IAAI,EAAEE;AAHD,GAAP;AAKD","sourcesContent":["import type {Mesh} from './mesh-types';\nimport type {ColumnarTable, ArrowTable} from '../table/table-types';\nimport {convertMeshToArrowTable} from './mesh-to-arrow-table';\n\ntype TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';\n\n/**\n * Convert a mesh to a specific shape\n */\nexport function convertMesh(\n mesh: Mesh,\n shape: TargetShape,\n options?: any\n): Mesh | ColumnarTable | ArrowTable {\n switch (shape || 'mesh') {\n case 'mesh':\n return mesh;\n case 'columnar-table':\n return convertMeshToColumnarTable(mesh);\n case 'arrow-table':\n return {\n shape: 'arrow-table',\n data: convertMeshToArrowTable(mesh)\n };\n default:\n throw new Error(`Unsupported shape ${options?.shape}`);\n }\n}\n\n/**\n * Convert a loaders.gl Mesh to a Columnar Table\n * @param mesh\n * @returns\n */\nexport function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable {\n const columns = {};\n\n for (const [columnName, attribute] of Object.entries(mesh.attributes)) {\n columns[columnName] = attribute.value;\n }\n\n return {\n shape: 'columnar-table',\n schema: mesh.schema,\n data: columns\n };\n}\n"],"file":"convert-mesh.js"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Schema, Field, FixedSizeList } from '../../lib/schema';
|
|
2
|
-
import { getArrowTypeFromTypedArray } from '../../lib/arrow/arrow-like-type-utils';
|
|
3
|
-
export function deduceMeshSchema(attributes, metadata) {
|
|
4
|
-
const fields = deduceMeshFields(attributes);
|
|
5
|
-
return new Schema(fields, metadata);
|
|
6
|
-
}
|
|
7
|
-
export function deduceMeshField(attributeName, attribute, optionalMetadata) {
|
|
8
|
-
const type = getArrowTypeFromTypedArray(attribute.value);
|
|
9
|
-
const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
|
|
10
|
-
const field = new Field(attributeName, new FixedSizeList(attribute.size, new Field('value', type)), false, metadata);
|
|
11
|
-
return field;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function deduceMeshFields(attributes) {
|
|
15
|
-
const fields = [];
|
|
16
|
-
|
|
17
|
-
for (const attributeName in attributes) {
|
|
18
|
-
const attribute = attributes[attributeName];
|
|
19
|
-
fields.push(deduceMeshField(attributeName, attribute));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return fields;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function makeMeshAttributeMetadata(attribute) {
|
|
26
|
-
const result = new Map();
|
|
27
|
-
|
|
28
|
-
if ('byteOffset' in attribute) {
|
|
29
|
-
result.set('byteOffset', attribute.byteOffset.toString(10));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if ('byteStride' in attribute) {
|
|
33
|
-
result.set('byteStride', attribute.byteStride.toString(10));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if ('normalized' in attribute) {
|
|
37
|
-
result.set('normalized', attribute.normalized.toString());
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=deduce-mesh-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/category/mesh/deduce-mesh-schema.ts"],"names":["Schema","Field","FixedSizeList","getArrowTypeFromTypedArray","deduceMeshSchema","attributes","metadata","fields","deduceMeshFields","deduceMeshField","attributeName","attribute","optionalMetadata","type","value","makeMeshAttributeMetadata","field","size","push","result","Map","set","byteOffset","toString","byteStride","normalized"],"mappings":"AACA,SAAQA,MAAR,EAAgBC,KAAhB,EAAuBC,aAAvB,QAA2C,kBAA3C;AACA,SAAQC,0BAAR,QAAyC,uCAAzC;AAQA,OAAO,SAASC,gBAAT,CACLC,UADK,EAELC,QAFK,EAGG;AACR,QAAMC,MAAM,GAAGC,gBAAgB,CAACH,UAAD,CAA/B;AACA,SAAO,IAAIL,MAAJ,CAAWO,MAAX,EAAmBD,QAAnB,CAAP;AACD;AASD,OAAO,SAASG,eAAT,CACLC,aADK,EAELC,SAFK,EAGLC,gBAHK,EAIE;AACP,QAAMC,IAAI,GAAGV,0BAA0B,CAACQ,SAAS,CAACG,KAAX,CAAvC;AACA,QAAMR,QAAQ,GAAGM,gBAAgB,GAAGA,gBAAH,GAAsBG,yBAAyB,CAACJ,SAAD,CAAhF;AACA,QAAMK,KAAK,GAAG,IAAIf,KAAJ,CACZS,aADY,EAEZ,IAAIR,aAAJ,CAAkBS,SAAS,CAACM,IAA5B,EAAkC,IAAIhB,KAAJ,CAAU,OAAV,EAAmBY,IAAnB,CAAlC,CAFY,EAGZ,KAHY,EAIZP,QAJY,CAAd;AAMA,SAAOU,KAAP;AACD;;AAOD,SAASR,gBAAT,CAA0BH,UAA1B,EAA+D;AAC7D,QAAME,MAAe,GAAG,EAAxB;;AACA,OAAK,MAAMG,aAAX,IAA4BL,UAA5B,EAAwC;AACtC,UAAMM,SAAwB,GAAGN,UAAU,CAACK,aAAD,CAA3C;AACAH,IAAAA,MAAM,CAACW,IAAP,CAAYT,eAAe,CAACC,aAAD,EAAgBC,SAAhB,CAA3B;AACD;;AACD,SAAOJ,MAAP;AACD;;AAOD,OAAO,SAASQ,yBAAT,CAAmCJ,SAAnC,EAAkF;AACvF,QAAMQ,MAAM,GAAG,IAAIC,GAAJ,EAAf;;AACA,MAAI,gBAAgBT,SAApB,EAA+B;AAC7BQ,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBV,SAAS,CAACW,UAAV,CAAsBC,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBZ,SAApB,EAA+B;AAC7BQ,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBV,SAAS,CAACa,UAAV,CAAsBD,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBZ,SAApB,EAA+B;AAC7BQ,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBV,SAAS,CAACc,UAAV,CAAsBF,QAAtB,EAAzB;AACD;;AACD,SAAOJ,MAAP;AACD","sourcesContent":["import {MeshAttribute, MeshAttributes} from './mesh-types';\nimport {Schema, Field, FixedSizeList} from '../../lib/schema';\nimport {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils';\n\n/**\n * Create a schema for mesh attributes data\n * @param attributes\n * @param metadata\n * @returns\n */\nexport function deduceMeshSchema(\n attributes: MeshAttributes,\n metadata?: Map<string, string>\n): Schema {\n const fields = deduceMeshFields(attributes);\n return new Schema(fields, metadata);\n}\n\n/**\n * Create arrow-like schema field for mesh attribute\n * @param attributeName\n * @param attribute\n * @param optionalMetadata\n * @returns\n */\nexport function deduceMeshField(\n attributeName: string,\n attribute: MeshAttribute,\n optionalMetadata?: Map<string, string>\n): Field {\n const type = getArrowTypeFromTypedArray(attribute.value);\n const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);\n const field = new Field(\n attributeName,\n new FixedSizeList(attribute.size, new Field('value', type)),\n false,\n metadata\n );\n return field;\n}\n\n/**\n * Create fields array for mesh attributes\n * @param attributes\n * @returns\n */\nfunction deduceMeshFields(attributes: MeshAttributes): Field[] {\n const fields: Field[] = [];\n for (const attributeName in attributes) {\n const attribute: MeshAttribute = attributes[attributeName];\n fields.push(deduceMeshField(attributeName, attribute));\n }\n return fields;\n}\n\n/**\n * Make metadata by mesh attribute properties\n * @param attribute\n * @returns\n */\nexport function makeMeshAttributeMetadata(attribute: MeshAttribute): Map<string, string> {\n const result = new Map();\n if ('byteOffset' in attribute) {\n result.set('byteOffset', attribute.byteOffset!.toString(10));\n }\n if ('byteStride' in attribute) {\n result.set('byteStride', attribute.byteStride!.toString(10));\n }\n if ('normalized' in attribute) {\n result.set('normalized', attribute.normalized!.toString());\n }\n return result;\n}\n"],"file":"deduce-mesh-schema.js"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Table, Schema, RecordBatch, FixedSizeList, Field, Data, FixedSizeListVector } from 'apache-arrow/Arrow.dom';
|
|
2
|
-
import { getArrowType, getArrowVector } from '../../lib/arrow/arrow-type-utils';
|
|
3
|
-
import { makeMeshAttributeMetadata } from './deduce-mesh-schema';
|
|
4
|
-
export function convertMeshToArrowTable(mesh, batchSize) {
|
|
5
|
-
var _mesh$schema;
|
|
6
|
-
|
|
7
|
-
const vectors = [];
|
|
8
|
-
const fields = [];
|
|
9
|
-
|
|
10
|
-
for (const attributeKey in mesh.attributes) {
|
|
11
|
-
const attribute = mesh.attributes[attributeKey];
|
|
12
|
-
const {
|
|
13
|
-
value,
|
|
14
|
-
size = 1
|
|
15
|
-
} = attribute;
|
|
16
|
-
const type = getArrowType(value);
|
|
17
|
-
const vector = getArrowVector(value);
|
|
18
|
-
const listType = new FixedSizeList(size, new Field('value', type));
|
|
19
|
-
const field = new Field(attributeKey, listType, false, makeMeshAttributeMetadata(attribute));
|
|
20
|
-
const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);
|
|
21
|
-
const listVector = new FixedSizeListVector(data);
|
|
22
|
-
vectors.push(listVector);
|
|
23
|
-
fields.push(field);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const schema = new Schema(fields, (mesh === null || mesh === void 0 ? void 0 : (_mesh$schema = mesh.schema) === null || _mesh$schema === void 0 ? void 0 : _mesh$schema.metadata) || new Map());
|
|
27
|
-
const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);
|
|
28
|
-
const table = new Table(schema, recordBatch);
|
|
29
|
-
return table;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=mesh-to-arrow-table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/category/mesh/mesh-to-arrow-table.ts"],"names":["Table","Schema","RecordBatch","FixedSizeList","Field","Data","FixedSizeListVector","getArrowType","getArrowVector","makeMeshAttributeMetadata","convertMeshToArrowTable","mesh","batchSize","vectors","fields","attributeKey","attributes","attribute","value","size","type","vector","listType","field","data","length","undefined","listVector","push","schema","metadata","Map","recordBatch","table"],"mappings":"AAAA,SACEA,KADF,EAEEC,MAFF,EAGEC,WAHF,EAIEC,aAJF,EAKEC,KALF,EAMEC,IANF,EAOEC,mBAPF,QAQO,wBARP;AAUA,SAAQC,YAAR,EAAsBC,cAAtB,QAA2C,kCAA3C;AAEA,SAAQC,yBAAR,QAAwC,sBAAxC;AASA,OAAO,SAASC,uBAAT,CAAiCC,IAAjC,EAA6CC,SAA7C,EAAwE;AAAA;;AAC7E,QAAMC,OAAyB,GAAG,EAAlC;AACA,QAAMC,MAAe,GAAG,EAAxB;;AACA,OAAK,MAAMC,YAAX,IAA2BJ,IAAI,CAACK,UAAhC,EAA4C;AAC1C,UAAMC,SAAS,GAAGN,IAAI,CAACK,UAAL,CAAgBD,YAAhB,CAAlB;AACA,UAAM;AAACG,MAAAA,KAAD;AAAQC,MAAAA,IAAI,GAAG;AAAf,QAAoBF,SAA1B;AACA,UAAMG,IAAI,GAAGb,YAAY,CAACW,KAAD,CAAzB;AACA,UAAMG,MAAM,GAAGb,cAAc,CAACU,KAAD,CAA7B;AACA,UAAMI,QAAQ,GAAG,IAAInB,aAAJ,CAAkBgB,IAAlB,EAAwB,IAAIf,KAAJ,CAAU,OAAV,EAAmBgB,IAAnB,CAAxB,CAAjB;AACA,UAAMG,KAAK,GAAG,IAAInB,KAAJ,CAAUW,YAAV,EAAwBO,QAAxB,EAAkC,KAAlC,EAAyCb,yBAAyB,CAACQ,SAAD,CAAlE,CAAd;AACA,UAAMO,IAAI,GAAG,IAAInB,IAAJ,CAASiB,QAAT,EAAmB,CAAnB,EAAsBJ,KAAK,CAACO,MAAN,GAAeN,IAArC,EAA2C,CAA3C,EAA8CO,SAA9C,EAAyD,CAACL,MAAD,CAAzD,CAAb;AACA,UAAMM,UAAU,GAAG,IAAIrB,mBAAJ,CAAwBkB,IAAxB,CAAnB;AACAX,IAAAA,OAAO,CAACe,IAAR,CAAaD,UAAb;AACAb,IAAAA,MAAM,CAACc,IAAP,CAAYL,KAAZ;AACD;;AACD,QAAMM,MAAM,GAAG,IAAI5B,MAAJ,CAAWa,MAAX,EAAmB,CAAAH,IAAI,SAAJ,IAAAA,IAAI,WAAJ,4BAAAA,IAAI,CAAEkB,MAAN,8DAAcC,QAAd,KAA0B,IAAIC,GAAJ,EAA7C,CAAf;AACA,QAAMC,WAAW,GAAG,IAAI9B,WAAJ,CAAgB2B,MAAhB,EAAwBhB,OAAO,CAAC,CAAD,CAAP,CAAWY,MAAnC,EAA2CZ,OAA3C,CAApB;AACA,QAAMoB,KAAK,GAAG,IAAIjC,KAAJ,CAAU6B,MAAV,EAAkBG,WAAlB,CAAd;AACA,SAAOC,KAAP;AACD","sourcesContent":["import {\n Table,\n Schema,\n RecordBatch,\n FixedSizeList,\n Field,\n Data,\n FixedSizeListVector\n} from 'apache-arrow/Arrow.dom';\nimport {AbstractVector} from 'apache-arrow/vector';\nimport {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';\nimport type {Mesh} from './mesh-types';\nimport {makeMeshAttributeMetadata} from './deduce-mesh-schema';\n\n/**\n * * Convert a loaders.gl Mesh to an Apache Arrow Table\n * @param mesh\n * @param metadata\n * @param batchSize\n * @returns\n */\nexport function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {\n const vectors: AbstractVector[] = [];\n const fields: Field[] = [];\n for (const attributeKey in mesh.attributes) {\n const attribute = mesh.attributes[attributeKey];\n const {value, size = 1} = attribute;\n const type = getArrowType(value);\n const vector = getArrowVector(value);\n const listType = new FixedSizeList(size, new Field('value', type));\n const field = new Field(attributeKey, listType, false, makeMeshAttributeMetadata(attribute));\n const data = new Data(listType, 0, value.length / size, 0, undefined, [vector]);\n const listVector = new FixedSizeListVector(data);\n vectors.push(listVector);\n fields.push(field);\n }\n const schema = new Schema(fields, mesh?.schema?.metadata || new Map<string, string>());\n const recordBatch = new RecordBatch(schema, vectors[0].length, vectors);\n const table = new Table(schema, recordBatch);\n return table;\n}\n"],"file":"mesh-to-arrow-table.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"mesh-types.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/category/mesh/mesh-utils.ts"],"names":["getMeshSize","attributes","size","attributeName","attribute","ArrayBuffer","isView","byteLength","BYTES_PER_ELEMENT","getMeshBoundingBox","minX","Infinity","minY","minZ","maxX","maxY","maxZ","positions","POSITION","value","len","length","i","x","y","z"],"mappings":"AAiBA,OAAO,SAASA,WAAT,CAAqBC,UAArB,EAAsD;AAC3D,MAAIC,IAAI,GAAG,CAAX;;AACA,OAAK,MAAMC,aAAX,IAA4BF,UAA5B,EAAwC;AACtC,UAAMG,SAAS,GAAGH,UAAU,CAACE,aAAD,CAA5B;;AACA,QAAIE,WAAW,CAACC,MAAZ,CAAmBF,SAAnB,CAAJ,EAAmC;AAEjCF,MAAAA,IAAI,IAAIE,SAAS,CAACG,UAAV,GAAuBH,SAAS,CAACI,iBAAzC;AACD;AACF;;AACD,SAAON,IAAP;AACD;AAQD,OAAO,SAASO,kBAAT,CAA4BR,UAA5B,EAAqE;AAC1E,MAAIS,IAAI,GAAGC,QAAX;AACA,MAAIC,IAAI,GAAGD,QAAX;AACA,MAAIE,IAAI,GAAGF,QAAX;AACA,MAAIG,IAAI,GAAG,CAACH,QAAZ;AACA,MAAII,IAAI,GAAG,CAACJ,QAAZ;AACA,MAAIK,IAAI,GAAG,CAACL,QAAZ;AAEA,QAAMM,SAAS,GAAGhB,UAAU,CAACiB,QAAX,GAAsBjB,UAAU,CAACiB,QAAX,CAAoBC,KAA1C,GAAkD,EAApE;AACA,QAAMC,GAAG,GAAGH,SAAS,IAAIA,SAAS,CAACI,MAAnC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,GAApB,EAAyBE,CAAC,IAAI,CAA9B,EAAiC;AAC/B,UAAMC,CAAC,GAAGN,SAAS,CAACK,CAAD,CAAnB;AACA,UAAME,CAAC,GAAGP,SAAS,CAACK,CAAC,GAAG,CAAL,CAAnB;AACA,UAAMG,CAAC,GAAGR,SAAS,CAACK,CAAC,GAAG,CAAL,CAAnB;AAEAZ,IAAAA,IAAI,GAAGa,CAAC,GAAGb,IAAJ,GAAWa,CAAX,GAAeb,IAAtB;AACAE,IAAAA,IAAI,GAAGY,CAAC,GAAGZ,IAAJ,GAAWY,CAAX,GAAeZ,IAAtB;AACAC,IAAAA,IAAI,GAAGY,CAAC,GAAGZ,IAAJ,GAAWY,CAAX,GAAeZ,IAAtB;AAEAC,IAAAA,IAAI,GAAGS,CAAC,GAAGT,IAAJ,GAAWS,CAAX,GAAeT,IAAtB;AACAC,IAAAA,IAAI,GAAGS,CAAC,GAAGT,IAAJ,GAAWS,CAAX,GAAeT,IAAtB;AACAC,IAAAA,IAAI,GAAGS,CAAC,GAAGT,IAAJ,GAAWS,CAAX,GAAeT,IAAtB;AACD;;AACD,SAAO,CACL,CAACN,IAAD,EAAOE,IAAP,EAAaC,IAAb,CADK,EAEL,CAACC,IAAD,EAAOC,IAAP,EAAaC,IAAb,CAFK,CAAP;AAID","sourcesContent":["// Mesh category utilities\n// TODO - move to mesh category module, or to math.gl/geometry module\nimport {TypedArray} from '../../types';\nimport {MeshAttributes} from './mesh-types';\n\ntype TypedArrays = {[key: string]: TypedArray};\n\n/**\n * Holds an axis aligned bounding box\n * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)\n */\ntype BoundingBox = [[number, number, number], [number, number, number]];\n\n/**\n * Get number of vertices in mesh\n * @param attributes\n */\nexport function getMeshSize(attributes: TypedArrays): number {\n let size = 0;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (ArrayBuffer.isView(attribute)) {\n // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT\n size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;\n }\n }\n return size;\n}\n\n/**\n * Get the (axis aligned) bounding box of a mesh\n * @param attributes\n * @returns array of two vectors representing the axis aligned bounding box\n */\n// eslint-disable-next-line complexity\nexport function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox {\n let minX = Infinity;\n let minY = Infinity;\n let minZ = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n let maxZ = -Infinity;\n\n const positions = attributes.POSITION ? attributes.POSITION.value : [];\n const len = positions && positions.length;\n\n for (let i = 0; i < len; i += 3) {\n const x = positions[i];\n const y = positions[i + 1];\n const z = positions[i + 2];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n return [\n [minX, minY, minZ],\n [maxX, maxY, maxZ]\n ];\n}\n"],"file":"mesh-utils.js"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export function deduceTableSchema(table, schema) {
|
|
2
|
-
const deducedSchema = Array.isArray(table) ? deduceSchemaForRowTable(table) : deduceSchemaForColumnarTable(table);
|
|
3
|
-
return Object.assign(deducedSchema, schema);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function deduceSchemaForColumnarTable(columnarTable) {
|
|
7
|
-
const schema = {};
|
|
8
|
-
|
|
9
|
-
for (const field in columnarTable) {
|
|
10
|
-
const column = columnarTable[field];
|
|
11
|
-
|
|
12
|
-
if (ArrayBuffer.isView(column)) {
|
|
13
|
-
schema[field] = column.constructor;
|
|
14
|
-
} else if (column.length) {
|
|
15
|
-
const value = column[0];
|
|
16
|
-
schema[field] = deduceTypeFromValue(value);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
schema[field] = schema[field] || null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return schema;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function deduceSchemaForRowTable(rowTable) {
|
|
26
|
-
const schema = {};
|
|
27
|
-
|
|
28
|
-
if (rowTable.length) {
|
|
29
|
-
const row = rowTable[0];
|
|
30
|
-
|
|
31
|
-
for (const field in row) {
|
|
32
|
-
const value = row[field];
|
|
33
|
-
schema[field] = deduceTypeFromValue(value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return schema;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function deduceTypeFromValue(value) {
|
|
41
|
-
if (value instanceof Date) {
|
|
42
|
-
return Date;
|
|
43
|
-
} else if (value instanceof Number) {
|
|
44
|
-
return Float32Array;
|
|
45
|
-
} else if (typeof value === 'string') {
|
|
46
|
-
return String;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=deduce-table-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/category/table/deduce-table-schema.ts"],"names":["deduceTableSchema","table","schema","deducedSchema","Array","isArray","deduceSchemaForRowTable","deduceSchemaForColumnarTable","Object","assign","columnarTable","field","column","ArrayBuffer","isView","constructor","length","value","deduceTypeFromValue","rowTable","row","Date","Number","Float32Array","String"],"mappings":"AAyCA,OAAO,SAASA,iBAAT,CAA2BC,KAA3B,EAAkCC,MAAlC,EAAmD;AACxD,QAAMC,aAAa,GAAGC,KAAK,CAACC,OAAN,CAAcJ,KAAd,IAClBK,uBAAuB,CAACL,KAAD,CADL,GAElBM,4BAA4B,CAACN,KAAD,CAFhC;AAIA,SAAOO,MAAM,CAACC,MAAP,CAAcN,aAAd,EAA6BD,MAA7B,CAAP;AACD;;AAED,SAASK,4BAAT,CAAsCG,aAAtC,EAAqD;AACnD,QAAMR,MAAM,GAAG,EAAf;;AACA,OAAK,MAAMS,KAAX,IAAoBD,aAApB,EAAmC;AACjC,UAAME,MAAM,GAAGF,aAAa,CAACC,KAAD,CAA5B;;AAEA,QAAIE,WAAW,CAACC,MAAZ,CAAmBF,MAAnB,CAAJ,EAAgC;AAC9BV,MAAAA,MAAM,CAACS,KAAD,CAAN,GAAgBC,MAAM,CAACG,WAAvB;AAED,KAHD,MAGO,IAAIH,MAAM,CAACI,MAAX,EAAmB;AACxB,YAAMC,KAAK,GAAGL,MAAM,CAAC,CAAD,CAApB;AACAV,MAAAA,MAAM,CAACS,KAAD,CAAN,GAAgBO,mBAAmB,CAACD,KAAD,CAAnC;AAED;;AAEDf,IAAAA,MAAM,CAACS,KAAD,CAAN,GAAgBT,MAAM,CAACS,KAAD,CAAN,IAAiB,IAAjC;AACD;;AACD,SAAOT,MAAP;AACD;;AAED,SAASI,uBAAT,CAAiCa,QAAjC,EAA2C;AACzC,QAAMjB,MAAM,GAAG,EAAf;;AACA,MAAIiB,QAAQ,CAACH,MAAb,EAAqB;AACnB,UAAMI,GAAG,GAAGD,QAAQ,CAAC,CAAD,CAApB;;AAEA,SAAK,MAAMR,KAAX,IAAoBS,GAApB,EAAyB;AACvB,YAAMH,KAAK,GAAGG,GAAG,CAACT,KAAD,CAAjB;AACAT,MAAAA,MAAM,CAACS,KAAD,CAAN,GAAgBO,mBAAmB,CAACD,KAAD,CAAnC;AACD;AACF;;AACD,SAAOf,MAAP;AACD;;AAED,SAASgB,mBAAT,CAA6BD,KAA7B,EAAoC;AAClC,MAAIA,KAAK,YAAYI,IAArB,EAA2B;AACzB,WAAOA,IAAP;AACD,GAFD,MAEO,IAAIJ,KAAK,YAAYK,MAArB,EAA6B;AAClC,WAAOC,YAAP;AACD,GAFM,MAEA,IAAI,OAAON,KAAP,KAAiB,QAArB,EAA+B;AACpC,WAAOO,MAAP;AACD;;AACD,SAAO,IAAP;AACD","sourcesContent":["// Type deduction\nimport {\n Schema\n // Int,\n // Int8,\n // Int16,\n // Int32,\n // Uint8,\n // Uint16,\n // Uint32,\n // Float32,\n // Float64\n // Bool,\n // Utf8,\n // TimestampMillisecond,\n // Null\n} from '../../lib/schema';\n\n// const TYPED_ARRAY_TO_TYPE = {\n// Int8Array: new Int8(),\n// Int16Array: new Int16(),\n// Int32Array: new Int32(),\n// Uint8Array: new Uint8(),\n// Uint8ClampedArray: new Uint8(),\n// Uint16Array: new Uint16(),\n// Uint32Array: new Uint32(),\n// Float32Array: new Float32(),\n// Float64Array: new Float64()\n// };\n\n// if (typeof BigInt64Array !== 'undefined') {\n// TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();\n// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();\n// }\n\n/**\n * SCHEMA SUPPORT - AUTODEDUCTION\n * @param {*} table\n * @param {*} schema\n * @returns\n */\nexport function deduceTableSchema(table, schema?: Schema) {\n const deducedSchema = Array.isArray(table)\n ? deduceSchemaForRowTable(table)\n : deduceSchemaForColumnarTable(table);\n // Deduced schema will fill in missing info from partial options.schema, if provided\n return Object.assign(deducedSchema, schema);\n}\n\nfunction deduceSchemaForColumnarTable(columnarTable) {\n const schema = {};\n for (const field in columnarTable) {\n const column = columnarTable[field];\n // Check if column is typed, if so we are done\n if (ArrayBuffer.isView(column)) {\n schema[field] = column.constructor;\n // else we need data\n } else if (column.length) {\n const value = column[0];\n schema[field] = deduceTypeFromValue(value);\n // TODO - support nested schemas?\n }\n // else we mark as present but unknow\n schema[field] = schema[field] || null;\n }\n return schema;\n}\n\nfunction deduceSchemaForRowTable(rowTable) {\n const schema = {};\n if (rowTable.length) {\n const row = rowTable[0];\n // TODO - Could look at additional rows if nulls in first row\n for (const field in row) {\n const value = row[field];\n schema[field] = deduceTypeFromValue(value);\n }\n }\n return schema;\n}\n\nfunction deduceTypeFromValue(value) {\n if (value instanceof Date) {\n return Date;\n } else if (value instanceof Number) {\n return Float32Array;\n } else if (typeof value === 'string') {\n return String;\n }\n return null;\n}\n\n/*\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction deduceSchema(rows) {\n const row = rows[0];\n\n const schema = {};\n let i = 0;\n for (const columnName in row) {\n const value = row[columnName];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n\n case 'object':\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n break;\n\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n i++;\n }\n return schema;\n}\n*/\n"],"file":"deduce-table-schema.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"table-types.js"}
|