@loaders.gl/schema 4.0.0-alpha.5 → 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.js +2 -2
- package/dist/dist.min.js +11362 -13932
- 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 +27 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -13
- package/dist/{category → lib}/mesh/convert-mesh.d.ts +3 -3
- package/dist/lib/mesh/convert-mesh.d.ts.map +1 -0
- package/dist/lib/mesh/convert-mesh.js +40 -0
- package/dist/{category → lib}/mesh/deduce-mesh-schema.d.ts +5 -5
- 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/{category → lib}/mesh/mesh-utils.d.ts +4 -4
- 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/{schema/impl/field.d.ts → table/arrow-api/arrow-like-field.d.ts} +4 -4
- 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/{schema/impl/type.d.ts → table/arrow-api/arrow-like-type.d.ts} +7 -6
- 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.map +1 -0
- package/dist/lib/table/arrow-api/enum.js +97 -0
- package/dist/lib/{arrow → table/arrow-api}/get-type-info.d.ts +2 -3
- 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/{batches → table/batches}/base-table-batch-aggregator.d.ts +3 -3
- 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/{batches → table/batches}/columnar-table-batch-aggregator.d.ts +4 -4
- 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/{batches → table/batches}/row-table-batch-aggregator.d.ts +3 -3
- 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/{batches → table/batches}/table-batch-aggregator.d.ts +2 -2
- 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/{batches → table/batches}/table-batch-builder.d.ts +5 -5
- 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.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.js +11 -5
- package/dist/lib/utils/async-queue.js +82 -109
- package/dist/{category/gis.d.ts → types/category-gis.d.ts} +26 -26
- package/dist/types/category-gis.d.ts.map +1 -0
- package/dist/types/category-gis.js +2 -0
- package/dist/{category/image/image.d.ts → types/category-image.d.ts} +4 -4
- package/dist/types/category-image.d.ts.map +1 -0
- package/dist/types/category-image.js +2 -0
- package/dist/{category/mesh/mesh-types.d.ts → types/category-mesh.d.ts} +8 -10
- package/dist/types/category-mesh.d.ts.map +1 -0
- package/dist/types/category-mesh.js +3 -0
- package/dist/{category/table/table-types.d.ts → types/category-table.d.ts} +44 -34
- 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 +5 -6
- package/src/index.ts +65 -31
- 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/{category/gis.ts → types/category-gis.ts} +9 -2
- package/src/{category/mesh/mesh-types.ts → types/category-mesh.ts} +6 -4
- package/src/types/category-table.ts +104 -0
- package/src/{category/texture/texture.ts → types/category-texture.ts} +3 -1
- 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.d.ts +0 -19
- package/dist/category/common.d.ts.map +0 -1
- package/dist/category/common.js +0 -2
- package/dist/category/common.js.map +0 -1
- package/dist/category/gis.d.ts.map +0 -1
- package/dist/category/gis.js +0 -2
- package/dist/category/gis.js.map +0 -1
- package/dist/category/image/image.d.ts.map +0 -1
- package/dist/category/image/image.js +0 -2
- package/dist/category/image/image.js.map +0 -1
- package/dist/category/mesh/convert-mesh.d.ts.map +0 -1
- package/dist/category/mesh/convert-mesh.js.map +0 -1
- package/dist/category/mesh/deduce-mesh-schema.d.ts.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.d.ts +0 -11
- package/dist/category/mesh/mesh-to-arrow-table.d.ts.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.d.ts.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.d.ts.map +0 -1
- package/dist/category/mesh/mesh-utils.js.map +0 -1
- package/dist/category/table/deduce-table-schema.d.ts +0 -9
- package/dist/category/table/deduce-table-schema.d.ts.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.d.ts.map +0 -1
- package/dist/category/table/table-types.js +0 -2
- package/dist/category/table/table-types.js.map +0 -1
- package/dist/category/texture/texture.d.ts +0 -18
- package/dist/category/texture/texture.d.ts.map +0 -1
- package/dist/category/texture/texture.js +0 -2
- package/dist/category/texture/texture.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.d.ts +0 -4
- package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +0 -1
- package/dist/lib/arrow/arrow-like-type-utils.js.map +0 -1
- package/dist/lib/arrow/arrow-type-utils.d.ts +0 -6
- package/dist/lib/arrow/arrow-type-utils.d.ts.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.d.ts.map +0 -1
- package/dist/lib/arrow/get-type-info.js.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/base-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/columnar-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/row-table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.d.ts.map +0 -1
- package/dist/lib/batches/table-batch-aggregator.js.map +0 -1
- package/dist/lib/batches/table-batch-builder.d.ts.map +0 -1
- package/dist/lib/batches/table-batch-builder.js.map +0 -1
- package/dist/lib/schema/impl/enum.d.ts.map +0 -1
- package/dist/lib/schema/impl/enum.js.map +0 -1
- package/dist/lib/schema/impl/field.d.ts.map +0 -1
- package/dist/lib/schema/impl/field.js.map +0 -1
- package/dist/lib/schema/impl/schema.d.ts +0 -16
- package/dist/lib/schema/impl/schema.d.ts.map +0 -1
- package/dist/lib/schema/impl/schema.js.map +0 -1
- package/dist/lib/schema/impl/type.d.ts.map +0 -1
- package/dist/lib/schema/impl/type.js.map +0 -1
- package/dist/lib/schema/schema.d.ts +0 -5
- package/dist/lib/schema/schema.d.ts.map +0 -1
- package/dist/lib/schema/schema.js +0 -5
- package/dist/lib/schema/schema.js.map +0 -1
- package/dist/lib/schema-utils/deduce-column-type.d.ts +0 -3
- package/dist/lib/schema-utils/deduce-column-type.d.ts.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.d.ts.map +0 -1
- package/dist/lib/utils/row-utils.js.map +0 -1
- package/dist/types.d.ts +0 -8
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/category/common.ts +0 -30
- 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 -35
- package/src/lib/schema/impl/schema.ts +0 -99
- package/src/lib/schema/schema.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/dist/lib/{schema/impl → table/arrow-api}/enum.d.ts +0 -0
- /package/dist/lib/{utils → table/simple-table}/row-utils.d.ts +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
- /package/src/{category/image/image.ts → types/category-image.ts} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ArrayRowTable, ObjectRowTable, ColumnarTable } from '../../../types/category-table';
|
|
2
|
+
/**
|
|
3
|
+
* Makes a typed table from data.
|
|
4
|
+
* @throws Row tables must contain at least one row. Columnar tables must contain empty arrays
|
|
5
|
+
*/
|
|
6
|
+
export declare function makeTableFromData(data: unknown[][]): ArrayRowTable;
|
|
7
|
+
export declare function makeTableFromData(data: {
|
|
8
|
+
[column: string]: unknown;
|
|
9
|
+
}[]): ObjectRowTable;
|
|
10
|
+
export declare function makeTableFromData(data: {
|
|
11
|
+
[column: string]: ArrayLike<unknown>;
|
|
12
|
+
}): ColumnarTable;
|
|
13
|
+
/** Convert any table into object row format *
|
|
14
|
+
export function makeColumnarTable(table: Table): ColumnarTable {
|
|
15
|
+
if (table.shape === 'columnar-table') {
|
|
16
|
+
return table;
|
|
17
|
+
}
|
|
18
|
+
const length = getTableLength(table);
|
|
19
|
+
const data = new Array<{[key: string]: unknown}>(length);
|
|
20
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
21
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
shape: 'columnar-table',
|
|
25
|
+
schema: table.schema,
|
|
26
|
+
data
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/** Convert any table into array row format *
|
|
32
|
+
export function makeArrayRowTable(table: TableLike): ArrayRowTable {
|
|
33
|
+
if (table.shape === 'array-row-table') {
|
|
34
|
+
return table;
|
|
35
|
+
}
|
|
36
|
+
const length = getTableLength(table);
|
|
37
|
+
const data = new Array<unknown[]>(length);
|
|
38
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
39
|
+
data[rowIndex] = getTableRowAsArray(table, rowIndex);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
shape: 'array-row-table',
|
|
43
|
+
schema: table.schema,
|
|
44
|
+
data
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Convert any table into object row format *
|
|
49
|
+
export function makeObjectRowTable(table: Table): ObjectRowTable {
|
|
50
|
+
if (table.shape === 'object-row-table') {
|
|
51
|
+
return table;
|
|
52
|
+
}
|
|
53
|
+
const length = getTableLength(table);
|
|
54
|
+
const data = new Array<{[key: string]: unknown}>(length);
|
|
55
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
56
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
shape: 'object-row-table',
|
|
60
|
+
schema: table.schema,
|
|
61
|
+
data
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
*/
|
|
65
|
+
//# sourceMappingURL=make-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-table.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/make-table.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,aAAa,EAAE,cAAc,EAAE,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAGlG;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,aAAa,CAAC;AACpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EAAE,GAAG,cAAc,CAAC;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAC,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;CAAC,GAAG,aAAa,CAAC;AA8C/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTableFromData = void 0;
|
|
4
|
+
const table_schema_1 = require("./table-schema");
|
|
5
|
+
function makeTableFromData(data) {
|
|
6
|
+
let table;
|
|
7
|
+
switch (getTableShapeFromData(data)) {
|
|
8
|
+
case 'array-row-table':
|
|
9
|
+
table = { shape: 'array-row-table', data: data };
|
|
10
|
+
break;
|
|
11
|
+
case 'object-row-table':
|
|
12
|
+
table = { shape: 'object-row-table', data: data };
|
|
13
|
+
break;
|
|
14
|
+
case 'columnar-table':
|
|
15
|
+
table = { shape: 'columnar-table', data: data };
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
throw new Error('table');
|
|
19
|
+
}
|
|
20
|
+
const schema = (0, table_schema_1.deduceTableSchema)(table);
|
|
21
|
+
return { ...table, schema };
|
|
22
|
+
}
|
|
23
|
+
exports.makeTableFromData = makeTableFromData;
|
|
24
|
+
/** Helper function to get shape of data */
|
|
25
|
+
function getTableShapeFromData(data) {
|
|
26
|
+
if (Array.isArray(data)) {
|
|
27
|
+
if (data.length === 0) {
|
|
28
|
+
throw new Error('cannot deduce type of empty table');
|
|
29
|
+
}
|
|
30
|
+
// Deduce the table shape from the first row
|
|
31
|
+
const firstRow = data[0];
|
|
32
|
+
if (Array.isArray(firstRow)) {
|
|
33
|
+
return 'array-row-table';
|
|
34
|
+
}
|
|
35
|
+
if (firstRow && typeof firstRow === 'object') {
|
|
36
|
+
return 'object-row-table';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (data && typeof data === 'object') {
|
|
40
|
+
return 'columnar-table';
|
|
41
|
+
}
|
|
42
|
+
throw new Error('invalid table');
|
|
43
|
+
}
|
|
44
|
+
/** Convert any table into object row format *
|
|
45
|
+
export function makeColumnarTable(table: Table): ColumnarTable {
|
|
46
|
+
if (table.shape === 'columnar-table') {
|
|
47
|
+
return table;
|
|
48
|
+
}
|
|
49
|
+
const length = getTableLength(table);
|
|
50
|
+
const data = new Array<{[key: string]: unknown}>(length);
|
|
51
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
52
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
shape: 'columnar-table',
|
|
56
|
+
schema: table.schema,
|
|
57
|
+
data
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/** Convert any table into array row format *
|
|
63
|
+
export function makeArrayRowTable(table: TableLike): ArrayRowTable {
|
|
64
|
+
if (table.shape === 'array-row-table') {
|
|
65
|
+
return table;
|
|
66
|
+
}
|
|
67
|
+
const length = getTableLength(table);
|
|
68
|
+
const data = new Array<unknown[]>(length);
|
|
69
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
70
|
+
data[rowIndex] = getTableRowAsArray(table, rowIndex);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
shape: 'array-row-table',
|
|
74
|
+
schema: table.schema,
|
|
75
|
+
data
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Convert any table into object row format *
|
|
80
|
+
export function makeObjectRowTable(table: Table): ObjectRowTable {
|
|
81
|
+
if (table.shape === 'object-row-table') {
|
|
82
|
+
return table;
|
|
83
|
+
}
|
|
84
|
+
const length = getTableLength(table);
|
|
85
|
+
const data = new Array<{[key: string]: unknown}>(length);
|
|
86
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
87
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
shape: 'object-row-table',
|
|
91
|
+
schema: table.schema,
|
|
92
|
+
data
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/row-utils.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,GAAG,EAAE,EACf,OAAO,EAAE,MAAM,EAAE,GAChB;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,CAY7B;AAED,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,EACtC,OAAO,EAAE,MAAM,EAAE,GAChB,GAAG,EAAE,CAYP"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToArrayRow = exports.convertToObjectRow = void 0;
|
|
4
|
+
/** Convert an object row to an array row */
|
|
5
|
+
function convertToObjectRow(arrayRow, headers) {
|
|
6
|
+
if (!arrayRow) {
|
|
7
|
+
throw new Error('null row');
|
|
8
|
+
}
|
|
9
|
+
if (!headers) {
|
|
10
|
+
throw new Error('no headers');
|
|
11
|
+
}
|
|
12
|
+
const objectRow = {};
|
|
13
|
+
for (let i = 0; i < headers.length; i++) {
|
|
14
|
+
objectRow[headers[i]] = arrayRow[i];
|
|
15
|
+
}
|
|
16
|
+
return objectRow;
|
|
17
|
+
}
|
|
18
|
+
exports.convertToObjectRow = convertToObjectRow;
|
|
19
|
+
/** Convert an object row to an array row */
|
|
20
|
+
function convertToArrayRow(objectRow, headers) {
|
|
21
|
+
if (!objectRow) {
|
|
22
|
+
throw new Error('null row');
|
|
23
|
+
}
|
|
24
|
+
if (!headers) {
|
|
25
|
+
throw new Error('no headers');
|
|
26
|
+
}
|
|
27
|
+
const arrayRow = new Array(headers.length);
|
|
28
|
+
for (let i = 0; i < headers.length; i++) {
|
|
29
|
+
arrayRow[i] = objectRow[headers[i]];
|
|
30
|
+
}
|
|
31
|
+
return arrayRow;
|
|
32
|
+
}
|
|
33
|
+
exports.convertToArrayRow = convertToArrayRow;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Table, ArrayRowTable, ObjectRowTable } from '../../../types/category-table';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the length of the table (i.e. the number of rows)
|
|
4
|
+
*/
|
|
5
|
+
export declare function getTableLength(table: Table): number;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the number of columns in the table
|
|
8
|
+
* @throws Fails to deduce number of columns if the table has no schema and is empty
|
|
9
|
+
*/
|
|
10
|
+
export declare function getTableNumCols(table: Table): number;
|
|
11
|
+
/** Get a table cell value at row index and column name */
|
|
12
|
+
export declare function getTableCell(table: Table, rowIndex: number, columnName: string): unknown;
|
|
13
|
+
/** Get a table cell value at row index and column name */
|
|
14
|
+
export declare function getTableCellAt(table: Table, rowIndex: number, columnIndex: number): unknown;
|
|
15
|
+
/** Deduce the table row shape */
|
|
16
|
+
export declare function getTableRowShape(table: Table): 'array-row-table' | 'object-row-table';
|
|
17
|
+
/** Get the index of a named table column. Requires the table to have a schema */
|
|
18
|
+
export declare function getTableColumnIndex(table: Table, columnName: string): number;
|
|
19
|
+
/** Get the name of a table column by index. Requires the table to have a schema */
|
|
20
|
+
export declare function getTableColumnName(table: Table, columnIndex: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Returns one row of the table in object format.
|
|
23
|
+
* @param target Optional parameter will be used if needed to store the row. Can be reused between calls to improve performance
|
|
24
|
+
* @returns an array representing the row. May be the original array in the row, a new object, or the target parameter
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTableRowAsObject(table: Table, rowIndex: number, target?: {
|
|
27
|
+
[columnName: string]: unknown;
|
|
28
|
+
}, copy?: 'copy'): {
|
|
29
|
+
[columnName: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Returns one row of the table in array format.
|
|
33
|
+
* @param target Optional parameter will be used if needed to store the row. Can be reused between calls to improve performance.
|
|
34
|
+
* @returns an array representing the row. May be the original array in the row, a new object, or the target parameter
|
|
35
|
+
*/
|
|
36
|
+
export declare function getTableRowAsArray(table: Table, rowIndex: number, target?: unknown[], copy?: 'copy'): unknown[];
|
|
37
|
+
/** Convert any table into array row format */
|
|
38
|
+
export declare function makeArrayRowTable(table: Table): ArrayRowTable;
|
|
39
|
+
/** Convert any table into object row format */
|
|
40
|
+
export declare function makeObjectRowTable(table: Table): ObjectRowTable;
|
|
41
|
+
/** Convert any table into object row format */
|
|
42
|
+
export declare function makeColumnarTable(table: Table): ObjectRowTable;
|
|
43
|
+
/**
|
|
44
|
+
* Iterate over table rows
|
|
45
|
+
* @param table
|
|
46
|
+
* @param shape
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeRowIterator(table: Table, shape: 'object-row-table' | 'array-row-table'): Iterable<unknown[] | {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Streaming processing: Iterate over table, yielding array rows
|
|
53
|
+
* @param table
|
|
54
|
+
* @param shape
|
|
55
|
+
*/
|
|
56
|
+
export declare function makeArrayRowIterator(table: Table, target?: unknown[]): Iterable<unknown[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Streaming processing: Iterate over table, yielding object rows
|
|
59
|
+
* @param table
|
|
60
|
+
* @param shape
|
|
61
|
+
*/
|
|
62
|
+
export declare function makeObjectRowIterator(table: Table, target?: {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}): Iterable<{
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}>;
|
|
67
|
+
//# sourceMappingURL=table-accessors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-accessors.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/table-accessors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAEnF;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAkBnD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAsBpD;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAuBxF;AAED,0DAA0D;AAC1D,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAqB3F;AAED,iCAAiC;AACjC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,GAAG,kBAAkB,CAarF;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED;;;;GAIG;AAEH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,GACZ;IAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CA6CjC;AAED;;;;GAIG;AAEH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,OAAO,EAAE,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,EAAE,CA+CX;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAc7D;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAc/D;AAED,+CAA+C;AAC/C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAc9D;AAID;;;;GAIG;AACH,wBAAiB,eAAe,CAC9B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,kBAAkB,GAAG,iBAAiB,GAC5C,QAAQ,CAAC,OAAO,EAAE,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC,CAYhD;AAED;;;;GAIG;AACH,wBAAiB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAK/F;AAED;;;;GAIG;AACH,wBAAiB,qBAAqB,CACpC,KAAK,EAAE,KAAK,EACZ,MAAM,GAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAM,GACpC,QAAQ,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC,CAKpC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeObjectRowIterator = exports.makeArrayRowIterator = exports.makeRowIterator = exports.makeColumnarTable = exports.makeObjectRowTable = exports.makeArrayRowTable = exports.getTableRowAsArray = exports.getTableRowAsObject = exports.getTableColumnName = exports.getTableColumnIndex = exports.getTableRowShape = exports.getTableCellAt = exports.getTableCell = exports.getTableNumCols = exports.getTableLength = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the length of the table (i.e. the number of rows)
|
|
7
|
+
*/
|
|
8
|
+
function getTableLength(table) {
|
|
9
|
+
switch (table.shape) {
|
|
10
|
+
case 'array-row-table':
|
|
11
|
+
case 'object-row-table':
|
|
12
|
+
case 'geojson-row-table':
|
|
13
|
+
return table.data.length;
|
|
14
|
+
case 'arrow-table':
|
|
15
|
+
return table.data.numRows;
|
|
16
|
+
case 'columnar-table':
|
|
17
|
+
for (const column of Object.values(table.data)) {
|
|
18
|
+
return column.length || 0;
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
default:
|
|
22
|
+
throw new Error('table');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.getTableLength = getTableLength;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the number of columns in the table
|
|
28
|
+
* @throws Fails to deduce number of columns if the table has no schema and is empty
|
|
29
|
+
*/
|
|
30
|
+
function getTableNumCols(table) {
|
|
31
|
+
if (table.schema) {
|
|
32
|
+
return table.schema.fields.length;
|
|
33
|
+
}
|
|
34
|
+
if (getTableLength(table) === 0) {
|
|
35
|
+
throw new Error('empty table');
|
|
36
|
+
}
|
|
37
|
+
switch (table.shape) {
|
|
38
|
+
case 'array-row-table':
|
|
39
|
+
return table.data[0].length;
|
|
40
|
+
case 'object-row-table':
|
|
41
|
+
case 'geojson-row-table':
|
|
42
|
+
return Object.keys(table.data[0]).length;
|
|
43
|
+
case 'columnar-table':
|
|
44
|
+
return Object.keys(table.data).length;
|
|
45
|
+
case 'arrow-table':
|
|
46
|
+
return table.data.numCols;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error('table');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.getTableNumCols = getTableNumCols;
|
|
52
|
+
/** Get a table cell value at row index and column name */
|
|
53
|
+
function getTableCell(table, rowIndex, columnName) {
|
|
54
|
+
switch (table.shape) {
|
|
55
|
+
case 'array-row-table':
|
|
56
|
+
const columnIndex = getTableColumnIndex(table, columnName);
|
|
57
|
+
return table.data[rowIndex][columnIndex];
|
|
58
|
+
case 'object-row-table':
|
|
59
|
+
case 'geojson-row-table':
|
|
60
|
+
return table.data[rowIndex][columnName];
|
|
61
|
+
case 'columnar-table':
|
|
62
|
+
const column = table.data[columnName];
|
|
63
|
+
return column[rowIndex];
|
|
64
|
+
case 'arrow-table':
|
|
65
|
+
const arrowColumnIndex = table.data.schema.fields.findIndex((field) => field.name === columnName);
|
|
66
|
+
return table.data.getChildAt(arrowColumnIndex)?.get(rowIndex);
|
|
67
|
+
default:
|
|
68
|
+
throw new Error('todo');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.getTableCell = getTableCell;
|
|
72
|
+
/** Get a table cell value at row index and column name */
|
|
73
|
+
function getTableCellAt(table, rowIndex, columnIndex) {
|
|
74
|
+
switch (table.shape) {
|
|
75
|
+
case 'array-row-table':
|
|
76
|
+
return table.data[rowIndex][columnIndex];
|
|
77
|
+
case 'object-row-table':
|
|
78
|
+
case 'geojson-row-table':
|
|
79
|
+
let columnName = getTableColumnName(table, columnIndex);
|
|
80
|
+
return table.data[rowIndex][columnName];
|
|
81
|
+
case 'columnar-table':
|
|
82
|
+
columnName = getTableColumnName(table, columnIndex);
|
|
83
|
+
const column = table.data[columnName];
|
|
84
|
+
return column[rowIndex];
|
|
85
|
+
case 'arrow-table':
|
|
86
|
+
return table.data.getChildAt(columnIndex)?.get(rowIndex);
|
|
87
|
+
default:
|
|
88
|
+
throw new Error('todo');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.getTableCellAt = getTableCellAt;
|
|
92
|
+
/** Deduce the table row shape */
|
|
93
|
+
function getTableRowShape(table) {
|
|
94
|
+
switch (table.shape) {
|
|
95
|
+
case 'array-row-table':
|
|
96
|
+
case 'object-row-table':
|
|
97
|
+
return table.shape;
|
|
98
|
+
case 'geojson-row-table':
|
|
99
|
+
return 'object-row-table';
|
|
100
|
+
case 'columnar-table':
|
|
101
|
+
default:
|
|
102
|
+
throw new Error('Not a row table');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.getTableRowShape = getTableRowShape;
|
|
106
|
+
/** Get the index of a named table column. Requires the table to have a schema */
|
|
107
|
+
function getTableColumnIndex(table, columnName) {
|
|
108
|
+
const columnIndex = table.schema?.fields.findIndex((field) => field.name === columnName);
|
|
109
|
+
if (columnIndex === undefined) {
|
|
110
|
+
throw new Error(columnName);
|
|
111
|
+
}
|
|
112
|
+
return columnIndex;
|
|
113
|
+
}
|
|
114
|
+
exports.getTableColumnIndex = getTableColumnIndex;
|
|
115
|
+
/** Get the name of a table column by index. Requires the table to have a schema */
|
|
116
|
+
function getTableColumnName(table, columnIndex) {
|
|
117
|
+
const columnName = table.schema?.fields[columnIndex]?.name;
|
|
118
|
+
if (!columnName) {
|
|
119
|
+
throw new Error(`${columnIndex}`);
|
|
120
|
+
}
|
|
121
|
+
return columnName;
|
|
122
|
+
}
|
|
123
|
+
exports.getTableColumnName = getTableColumnName;
|
|
124
|
+
/**
|
|
125
|
+
* Returns one row of the table in object format.
|
|
126
|
+
* @param target Optional parameter will be used if needed to store the row. Can be reused between calls to improve performance
|
|
127
|
+
* @returns an array representing the row. May be the original array in the row, a new object, or the target parameter
|
|
128
|
+
*/
|
|
129
|
+
// eslint-disable-next-line complexity
|
|
130
|
+
function getTableRowAsObject(table, rowIndex, target, copy) {
|
|
131
|
+
switch (table.shape) {
|
|
132
|
+
case 'object-row-table':
|
|
133
|
+
return copy ? Object.fromEntries(Object.entries(table.data[rowIndex])) : table.data[rowIndex];
|
|
134
|
+
case 'array-row-table':
|
|
135
|
+
case 'geojson-row-table':
|
|
136
|
+
if (table.schema) {
|
|
137
|
+
const objectRow = target || {};
|
|
138
|
+
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
139
|
+
objectRow[table.schema.fields[i].name] = table.data[rowIndex][i];
|
|
140
|
+
}
|
|
141
|
+
return objectRow;
|
|
142
|
+
}
|
|
143
|
+
throw new Error('no schema');
|
|
144
|
+
case 'columnar-table':
|
|
145
|
+
if (table.schema) {
|
|
146
|
+
const objectRow = target || {};
|
|
147
|
+
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
148
|
+
objectRow[table.schema.fields[i].name] =
|
|
149
|
+
table.data[table.schema.fields[i].name][rowIndex];
|
|
150
|
+
}
|
|
151
|
+
return objectRow;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// eslint-disable-line no-else-return
|
|
155
|
+
const objectRow = target || {};
|
|
156
|
+
for (const [name, column] of Object.entries(table.data)) {
|
|
157
|
+
objectRow[name] = column[rowIndex];
|
|
158
|
+
}
|
|
159
|
+
return objectRow;
|
|
160
|
+
}
|
|
161
|
+
case 'arrow-table':
|
|
162
|
+
const objectRow = target || {};
|
|
163
|
+
const row = table.data.get(rowIndex);
|
|
164
|
+
const schema = table.data.schema;
|
|
165
|
+
for (let i = 0; i < schema.fields.length; i++) {
|
|
166
|
+
objectRow[schema.fields[i].name] = row?.[schema.fields[i].name];
|
|
167
|
+
}
|
|
168
|
+
return objectRow;
|
|
169
|
+
default:
|
|
170
|
+
throw new Error('shape');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.getTableRowAsObject = getTableRowAsObject;
|
|
174
|
+
/**
|
|
175
|
+
* Returns one row of the table in array format.
|
|
176
|
+
* @param target Optional parameter will be used if needed to store the row. Can be reused between calls to improve performance.
|
|
177
|
+
* @returns an array representing the row. May be the original array in the row, a new object, or the target parameter
|
|
178
|
+
*/
|
|
179
|
+
// eslint-disable-next-line complexity
|
|
180
|
+
function getTableRowAsArray(table, rowIndex, target, copy) {
|
|
181
|
+
switch (table.shape) {
|
|
182
|
+
case 'array-row-table':
|
|
183
|
+
return copy ? Array.from(table.data[rowIndex]) : table.data[rowIndex];
|
|
184
|
+
case 'object-row-table':
|
|
185
|
+
case 'geojson-row-table':
|
|
186
|
+
if (table.schema) {
|
|
187
|
+
const arrayRow = target || [];
|
|
188
|
+
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
189
|
+
arrayRow[i] = table.data[rowIndex][table.schema.fields[i].name];
|
|
190
|
+
}
|
|
191
|
+
return arrayRow;
|
|
192
|
+
}
|
|
193
|
+
// Warning: just slap on the values, this risks mismatches between rows
|
|
194
|
+
return Object.values(table.data[rowIndex]);
|
|
195
|
+
case 'columnar-table':
|
|
196
|
+
if (table.schema) {
|
|
197
|
+
const arrayRow = target || [];
|
|
198
|
+
for (let i = 0; i < table.schema.fields.length; i++) {
|
|
199
|
+
arrayRow[i] = table.data[table.schema.fields[i].name][rowIndex];
|
|
200
|
+
}
|
|
201
|
+
return arrayRow;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// eslint-disable-line no-else-return
|
|
205
|
+
const arrayRow = target || [];
|
|
206
|
+
let i = 0;
|
|
207
|
+
for (const column of Object.values(table.data)) {
|
|
208
|
+
arrayRow[i] = column[rowIndex];
|
|
209
|
+
i++;
|
|
210
|
+
}
|
|
211
|
+
return arrayRow;
|
|
212
|
+
}
|
|
213
|
+
case 'arrow-table':
|
|
214
|
+
const arrayRow = target || [];
|
|
215
|
+
const row = table.data.get(rowIndex);
|
|
216
|
+
const schema = table.data.schema;
|
|
217
|
+
for (let i = 0; i < schema.fields.length; i++) {
|
|
218
|
+
arrayRow[i] = row?.[schema.fields[i].name];
|
|
219
|
+
}
|
|
220
|
+
return arrayRow;
|
|
221
|
+
default:
|
|
222
|
+
throw new Error('shape');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.getTableRowAsArray = getTableRowAsArray;
|
|
226
|
+
/** Convert any table into array row format */
|
|
227
|
+
function makeArrayRowTable(table) {
|
|
228
|
+
if (table.shape === 'array-row-table') {
|
|
229
|
+
return table;
|
|
230
|
+
}
|
|
231
|
+
const length = getTableLength(table);
|
|
232
|
+
const data = new Array(length);
|
|
233
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
234
|
+
data[rowIndex] = getTableRowAsArray(table, rowIndex);
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
shape: 'array-row-table',
|
|
238
|
+
schema: table.schema,
|
|
239
|
+
data
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
exports.makeArrayRowTable = makeArrayRowTable;
|
|
243
|
+
/** Convert any table into object row format */
|
|
244
|
+
function makeObjectRowTable(table) {
|
|
245
|
+
if (table.shape === 'object-row-table') {
|
|
246
|
+
return table;
|
|
247
|
+
}
|
|
248
|
+
const length = getTableLength(table);
|
|
249
|
+
const data = new Array(length);
|
|
250
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
251
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
shape: 'object-row-table',
|
|
255
|
+
schema: table.schema,
|
|
256
|
+
data
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
exports.makeObjectRowTable = makeObjectRowTable;
|
|
260
|
+
/** Convert any table into object row format */
|
|
261
|
+
function makeColumnarTable(table) {
|
|
262
|
+
if (table.shape === 'object-row-table') {
|
|
263
|
+
return table;
|
|
264
|
+
}
|
|
265
|
+
const length = getTableLength(table);
|
|
266
|
+
const data = new Array(length);
|
|
267
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
268
|
+
data[rowIndex] = getTableRowAsObject(table, rowIndex);
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
shape: 'object-row-table',
|
|
272
|
+
schema: table.schema,
|
|
273
|
+
data
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
exports.makeColumnarTable = makeColumnarTable;
|
|
277
|
+
// Row Iterators
|
|
278
|
+
/**
|
|
279
|
+
* Iterate over table rows
|
|
280
|
+
* @param table
|
|
281
|
+
* @param shape
|
|
282
|
+
*/
|
|
283
|
+
function* makeRowIterator(table, shape) {
|
|
284
|
+
switch (shape) {
|
|
285
|
+
case 'array-row-table':
|
|
286
|
+
yield* makeArrayRowIterator(table);
|
|
287
|
+
break;
|
|
288
|
+
case 'object-row-table':
|
|
289
|
+
yield* makeObjectRowIterator(table);
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
throw new Error(`Unknown row type ${shape}`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.makeRowIterator = makeRowIterator;
|
|
296
|
+
/**
|
|
297
|
+
* Streaming processing: Iterate over table, yielding array rows
|
|
298
|
+
* @param table
|
|
299
|
+
* @param shape
|
|
300
|
+
*/
|
|
301
|
+
function* makeArrayRowIterator(table, target = []) {
|
|
302
|
+
const length = getTableLength(table);
|
|
303
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
304
|
+
yield getTableRowAsArray(table, rowIndex, target);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
exports.makeArrayRowIterator = makeArrayRowIterator;
|
|
308
|
+
/**
|
|
309
|
+
* Streaming processing: Iterate over table, yielding object rows
|
|
310
|
+
* @param table
|
|
311
|
+
* @param shape
|
|
312
|
+
*/
|
|
313
|
+
function* makeObjectRowIterator(table, target = {}) {
|
|
314
|
+
const length = getTableLength(table);
|
|
315
|
+
for (let rowIndex = 0; rowIndex < length; rowIndex++) {
|
|
316
|
+
yield getTableRowAsObject(table, rowIndex, target);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
exports.makeObjectRowIterator = makeObjectRowIterator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Field } from '../../../types/schema';
|
|
2
|
+
export interface ArrayType<T = unknown> {
|
|
3
|
+
readonly length: number;
|
|
4
|
+
[n: number]: T;
|
|
5
|
+
}
|
|
6
|
+
export declare function makeColumnFromField(field: Field, length: number): ArrayType;
|
|
7
|
+
//# sourceMappingURL=table-column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-column.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/table-column.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeColumnFromField = void 0;
|
|
5
|
+
const data_type_1 = require("./data-type");
|
|
6
|
+
function makeColumnFromField(field, length) {
|
|
7
|
+
const ArrayType = (0, data_type_1.getArrayTypeFromDataType)(field.type, field.nullable);
|
|
8
|
+
return new ArrayType(length);
|
|
9
|
+
}
|
|
10
|
+
exports.makeColumnFromField = makeColumnFromField;
|
|
11
|
+
/*
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
function deduceSchema(rows) {
|
|
14
|
+
const row = rows[0];
|
|
15
|
+
|
|
16
|
+
const schema = {};
|
|
17
|
+
let i = 0;
|
|
18
|
+
for (const columnName in row) {
|
|
19
|
+
const value = row[columnName];
|
|
20
|
+
switch (typeof value) {
|
|
21
|
+
case 'number':
|
|
22
|
+
case 'boolean':
|
|
23
|
+
// TODO - booleans could be handled differently...
|
|
24
|
+
schema[columnName] = {name: String(columnName), index: i, type: Float32Array};
|
|
25
|
+
break;
|
|
26
|
+
|
|
27
|
+
case 'object':
|
|
28
|
+
schema[columnName] = {name: String(columnName), index: i, type: Array};
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case 'string':
|
|
32
|
+
default:
|
|
33
|
+
schema[columnName] = {name: String(columnName), index: i, type: Array};
|
|
34
|
+
// We currently only handle numeric rows
|
|
35
|
+
// TODO we could offer a function to map strings to numbers?
|
|
36
|
+
}
|
|
37
|
+
i++;
|
|
38
|
+
}
|
|
39
|
+
return schema;
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from '../../../types/schema';
|
|
2
|
+
import { Table } from '../../../types/category-table';
|
|
3
|
+
/**
|
|
4
|
+
* SCHEMA SUPPORT - AUTODEDUCTION
|
|
5
|
+
* @param {*} table
|
|
6
|
+
* @param {*} schema
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function deduceTableSchema(table: Table): Schema;
|
|
10
|
+
export declare function deduceSchema(data: unknown[][] | {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}[] | {
|
|
13
|
+
[key: string]: unknown[];
|
|
14
|
+
}): Schema;
|
|
15
|
+
//# sourceMappingURL=table-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-schema.d.ts","sourceRoot":"","sources":["../../../../src/lib/table/simple-table/table-schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAQ,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAC,KAAK,EAAC,MAAM,+BAA+B,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAatD;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EAAE,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;CAAC,GAC1E,MAAM,CAER"}
|