@loaders.gl/schema 3.1.0-alpha.5 → 3.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +16159 -0
  4. package/dist/category/common.d.ts +1 -0
  5. package/dist/category/common.d.ts.map +1 -0
  6. package/dist/category/common.js +10 -0
  7. package/dist/category/gis.d.ts +1 -1
  8. package/dist/category/gis.d.ts.map +1 -0
  9. package/dist/category/gis.js +2 -0
  10. package/dist/category/mesh/convert-mesh.d.ts +1 -0
  11. package/dist/category/mesh/convert-mesh.d.ts.map +1 -0
  12. package/dist/category/mesh/convert-mesh.js +40 -0
  13. package/dist/category/mesh/deduce-mesh-schema.d.ts +2 -1
  14. package/dist/category/mesh/deduce-mesh-schema.d.ts.map +1 -0
  15. package/dist/category/mesh/deduce-mesh-schema.js +62 -0
  16. package/dist/category/mesh/mesh-to-arrow-table.d.ts +1 -0
  17. package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -0
  18. package/dist/category/mesh/mesh-to-arrow-table.js +34 -0
  19. package/dist/category/mesh/mesh-types.d.ts +2 -1
  20. package/dist/category/mesh/mesh-types.d.ts.map +1 -0
  21. package/dist/category/mesh/mesh-types.js +2 -0
  22. package/dist/category/mesh/mesh-utils.d.ts +1 -0
  23. package/dist/category/mesh/mesh-utils.d.ts.map +1 -0
  24. package/dist/category/mesh/mesh-utils.js +51 -0
  25. package/dist/category/table/deduce-table-schema.d.ts +2 -1
  26. package/dist/category/table/deduce-table-schema.d.ts.map +1 -0
  27. package/dist/category/table/deduce-table-schema.js +106 -0
  28. package/dist/category/table/table-types.d.ts +2 -1
  29. package/dist/category/table/table-types.d.ts.map +1 -0
  30. package/dist/category/table/table-types.js +2 -0
  31. package/dist/es5/category/mesh/deduce-mesh-schema.js +1 -1
  32. package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
  33. package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
  34. package/dist/es5/index.js +1 -1
  35. package/dist/es5/index.js.map +1 -1
  36. package/dist/es5/lib/arrow/arrow-like-type-utils.js +1 -1
  37. package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -1
  38. package/dist/es5/lib/arrow/get-type-info.js +1 -1
  39. package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
  40. package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
  41. package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  42. package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
  43. package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
  44. package/dist/es5/lib/schema/impl/schema.js.map +1 -1
  45. package/dist/es5/lib/schema/impl/type.js.map +1 -1
  46. package/dist/es5/lib/schema/{index.js → schema.js} +1 -1
  47. package/dist/es5/lib/schema/schema.js.map +1 -0
  48. package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -1
  49. package/dist/es5/lib/utils/async-queue.js.map +1 -1
  50. package/dist/esm/category/mesh/deduce-mesh-schema.js +1 -1
  51. package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -1
  52. package/dist/esm/category/table/deduce-table-schema.js.map +1 -1
  53. package/dist/esm/index.js +1 -1
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/lib/arrow/arrow-like-type-utils.js +1 -1
  56. package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -1
  57. package/dist/esm/lib/arrow/get-type-info.js +1 -1
  58. package/dist/esm/lib/arrow/get-type-info.js.map +1 -1
  59. package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -1
  60. package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
  61. package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -1
  62. package/dist/esm/lib/batches/table-batch-builder.js.map +1 -1
  63. package/dist/esm/lib/schema/impl/schema.js.map +1 -1
  64. package/dist/esm/lib/schema/impl/type.js.map +1 -1
  65. package/dist/esm/lib/schema/{index.js → schema.js} +1 -1
  66. package/dist/esm/lib/schema/schema.js.map +1 -0
  67. package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -1
  68. package/dist/esm/lib/utils/async-queue.js.map +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +75 -0
  72. package/dist/lib/arrow/arrow-like-type-utils.d.ts +2 -1
  73. package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +1 -0
  74. package/dist/lib/arrow/arrow-like-type-utils.js +27 -0
  75. package/dist/lib/arrow/arrow-type-utils.d.ts +1 -0
  76. package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -0
  77. package/dist/lib/arrow/arrow-type-utils.js +50 -0
  78. package/dist/lib/arrow/get-type-info.d.ts +2 -1
  79. package/dist/lib/arrow/get-type-info.d.ts.map +1 -0
  80. package/dist/lib/arrow/get-type-info.js +28 -0
  81. package/dist/lib/batches/base-table-batch-aggregator.d.ts +2 -1
  82. package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +1 -0
  83. package/dist/lib/batches/base-table-batch-aggregator.js +58 -0
  84. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +2 -1
  85. package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
  86. package/dist/lib/batches/columnar-table-batch-aggregator.js +90 -0
  87. package/dist/lib/batches/row-table-batch-aggregator.d.ts +2 -1
  88. package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +1 -0
  89. package/dist/lib/batches/row-table-batch-aggregator.js +79 -0
  90. package/dist/lib/batches/table-batch-aggregator.d.ts +2 -1
  91. package/dist/lib/batches/table-batch-aggregator.d.ts.map +1 -0
  92. package/dist/lib/batches/table-batch-aggregator.js +2 -0
  93. package/dist/lib/batches/table-batch-builder.d.ts +3 -2
  94. package/dist/lib/batches/table-batch-builder.d.ts.map +1 -0
  95. package/dist/lib/batches/table-batch-builder.js +153 -0
  96. package/dist/lib/schema/impl/enum.d.ts +1 -0
  97. package/dist/lib/schema/impl/enum.d.ts.map +1 -0
  98. package/dist/lib/schema/impl/enum.js +97 -0
  99. package/dist/lib/schema/impl/field.d.ts +1 -0
  100. package/dist/lib/schema/impl/field.d.ts.map +1 -0
  101. package/dist/lib/schema/impl/field.js +32 -0
  102. package/dist/lib/schema/impl/schema.d.ts +1 -0
  103. package/dist/lib/schema/impl/schema.d.ts.map +1 -0
  104. package/dist/lib/schema/impl/schema.js +83 -0
  105. package/dist/lib/schema/impl/type.d.ts +3 -2
  106. package/dist/lib/schema/impl/type.d.ts.map +1 -0
  107. package/dist/lib/schema/impl/type.js +462 -0
  108. package/dist/lib/schema/{index.d.ts → schema.d.ts} +1 -0
  109. package/dist/lib/schema/schema.d.ts.map +1 -0
  110. package/dist/lib/schema/schema.js +90 -0
  111. package/dist/lib/schema-utils/deduce-column-type.d.ts +3 -2
  112. package/dist/lib/schema-utils/deduce-column-type.d.ts.map +1 -0
  113. package/dist/lib/schema-utils/deduce-column-type.js +92 -0
  114. package/dist/lib/utils/assert.d.ts +1 -0
  115. package/dist/lib/utils/assert.d.ts.map +1 -0
  116. package/dist/lib/utils/assert.js +12 -0
  117. package/dist/lib/utils/async-queue.d.ts +1 -0
  118. package/dist/lib/utils/async-queue.d.ts.map +1 -0
  119. package/dist/lib/utils/async-queue.js +92 -0
  120. package/dist/lib/utils/row-utils.d.ts +1 -0
  121. package/dist/lib/utils/row-utils.d.ts.map +1 -0
  122. package/dist/lib/utils/row-utils.js +33 -0
  123. package/dist/types.d.ts +1 -0
  124. package/dist/types.d.ts.map +1 -0
  125. package/dist/types.js +2 -0
  126. package/package.json +3 -4
  127. package/src/category/gis.ts +0 -1
  128. package/src/category/mesh/deduce-mesh-schema.ts +1 -1
  129. package/src/category/mesh/mesh-types.ts +1 -1
  130. package/src/category/table/deduce-table-schema.ts +1 -1
  131. package/src/category/table/table-types.ts +1 -1
  132. package/src/index.ts +1 -1
  133. package/src/lib/arrow/arrow-like-type-utils.ts +11 -1
  134. package/src/lib/arrow/get-type-info.ts +1 -1
  135. package/src/lib/batches/base-table-batch-aggregator.ts +1 -1
  136. package/src/lib/batches/columnar-table-batch-aggregator.ts +1 -1
  137. package/src/lib/batches/row-table-batch-aggregator.ts +1 -1
  138. package/src/lib/batches/table-batch-aggregator.ts +1 -1
  139. package/src/lib/batches/table-batch-builder.ts +2 -2
  140. package/src/lib/schema/impl/schema.ts +2 -2
  141. package/src/lib/schema/impl/type.ts +2 -2
  142. package/src/lib/schema/{index.ts → schema.ts} +0 -0
  143. package/src/lib/schema-utils/deduce-column-type.ts +6 -2
  144. package/src/lib/utils/async-queue.ts +7 -4
  145. package/dist/dist.min.js +0 -2
  146. package/dist/dist.min.js.map +0 -1
  147. package/dist/es5/lib/schema/index.js.map +0 -1
  148. package/dist/esm/lib/schema/index.js.map +0 -1
@@ -16,3 +16,4 @@ export declare type Batch = {
16
16
  cursor?: number;
17
17
  [key: string]: any;
18
18
  };
19
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/category/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAE9C,oBAAY,KAAK,GAAG,GAAG,CAAC;AAExB,oBAAY,MAAM,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;CACtB,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,GAAG,cAAc,CAAC;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ export type Batch = {
5
+ bytesUsed?: number;
6
+ count?: number;
7
+ cursor?: number;
8
+ [key: string]: any;
9
+ }
10
+ */
@@ -43,8 +43,8 @@ export declare type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProper
43
43
  * Represent a collection of Features, similar to a GeoJSON FeatureCollection
44
44
  */
45
45
  export declare type BinaryFeatures = {
46
- type?: BinaryGeometryType;
47
46
  points?: BinaryPointFeatures;
48
47
  lines?: BinaryLineFeatures;
49
48
  polygons?: BinaryPolygonFeatures;
50
49
  };
50
+ //# sourceMappingURL=gis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gis.d.ts","sourceRoot":"","sources":["../../src/category/gis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKzC,YAAY,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAErF,YAAY,EAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAInG,oBAAY,eAAe,GAAG;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAChE,oBAAY,kBAAkB,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;AAEpE,aAAK,YAAY,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;CAAC,CAAC;AACrD,aAAK,UAAU,GAAG,MAAM,EAAE,CAAC;AAE3B;;GAEG;AACH,oBAAY,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAE9F,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,eAAe,CAAC;IAC3B,cAAc,EAAE,eAAe,CAAC;IAChC,uBAAuB,EAAE,eAAe,CAAC;CAC1C,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,eAAe,CAAC;IAC5B,gBAAgB,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,oBAAY,mBAAmB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AACzE,oBAAY,kBAAkB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AACvE,oBAAY,qBAAqB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;AAE7E;;GAEG;AACH,oBAAY,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,3 +12,4 @@ export declare function convertMesh(mesh: Mesh, shape: TargetShape, options?: an
12
12
  */
13
13
  export declare function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable;
14
14
  export {};
15
+ //# sourceMappingURL=convert-mesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-mesh.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/convert-mesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAGpE,aAAK,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE7D;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,GAAG,GACZ,IAAI,GAAG,aAAa,GAAG,UAAU,CAcnC;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,CAYpE"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertMeshToColumnarTable = exports.convertMesh = void 0;
4
+ const mesh_to_arrow_table_1 = require("./mesh-to-arrow-table");
5
+ /**
6
+ * Convert a mesh to a specific shape
7
+ */
8
+ function convertMesh(mesh, shape, options) {
9
+ switch (shape || 'mesh') {
10
+ case 'mesh':
11
+ return mesh;
12
+ case 'columnar-table':
13
+ return convertMeshToColumnarTable(mesh);
14
+ case 'arrow-table':
15
+ return {
16
+ shape: 'arrow-table',
17
+ data: (0, mesh_to_arrow_table_1.convertMeshToArrowTable)(mesh)
18
+ };
19
+ default:
20
+ throw new Error(`Unsupported shape ${options?.shape}`);
21
+ }
22
+ }
23
+ exports.convertMesh = convertMesh;
24
+ /**
25
+ * Convert a loaders.gl Mesh to a Columnar Table
26
+ * @param mesh
27
+ * @returns
28
+ */
29
+ function convertMeshToColumnarTable(mesh) {
30
+ const columns = {};
31
+ for (const [columnName, attribute] of Object.entries(mesh.attributes)) {
32
+ columns[columnName] = attribute.value;
33
+ }
34
+ return {
35
+ shape: 'columnar-table',
36
+ schema: mesh.schema,
37
+ data: columns
38
+ };
39
+ }
40
+ exports.convertMeshToColumnarTable = convertMeshToColumnarTable;
@@ -1,5 +1,5 @@
1
1
  import { MeshAttribute, MeshAttributes } from './mesh-types';
2
- import { Schema, Field } from '../../lib/schema';
2
+ import { Schema, Field } from '../../lib/schema/schema';
3
3
  /**
4
4
  * Create a schema for mesh attributes data
5
5
  * @param attributes
@@ -21,3 +21,4 @@ export declare function deduceMeshField(attributeName: string, attribute: MeshAt
21
21
  * @returns
22
22
  */
23
23
  export declare function makeMeshAttributeMetadata(attribute: MeshAttribute): Map<string, string>;
24
+ //# sourceMappingURL=deduce-mesh-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deduce-mesh-schema.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/deduce-mesh-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAE,KAAK,EAAgB,MAAM,yBAAyB,CAAC;AAGrE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,cAAc,EAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAGR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,aAAa,EACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,KAAK,CAUP;AAgBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAYvF"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeMeshAttributeMetadata = exports.deduceMeshField = exports.deduceMeshSchema = void 0;
4
+ const schema_1 = require("../../lib/schema/schema");
5
+ const arrow_like_type_utils_1 = require("../../lib/arrow/arrow-like-type-utils");
6
+ /**
7
+ * Create a schema for mesh attributes data
8
+ * @param attributes
9
+ * @param metadata
10
+ * @returns
11
+ */
12
+ function deduceMeshSchema(attributes, metadata) {
13
+ const fields = deduceMeshFields(attributes);
14
+ return new schema_1.Schema(fields, metadata);
15
+ }
16
+ exports.deduceMeshSchema = deduceMeshSchema;
17
+ /**
18
+ * Create arrow-like schema field for mesh attribute
19
+ * @param attributeName
20
+ * @param attribute
21
+ * @param optionalMetadata
22
+ * @returns
23
+ */
24
+ function deduceMeshField(attributeName, attribute, optionalMetadata) {
25
+ const type = (0, arrow_like_type_utils_1.getArrowTypeFromTypedArray)(attribute.value);
26
+ const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
27
+ const field = new schema_1.Field(attributeName, new schema_1.FixedSizeList(attribute.size, new schema_1.Field('value', type)), false, metadata);
28
+ return field;
29
+ }
30
+ exports.deduceMeshField = deduceMeshField;
31
+ /**
32
+ * Create fields array for mesh attributes
33
+ * @param attributes
34
+ * @returns
35
+ */
36
+ function deduceMeshFields(attributes) {
37
+ const fields = [];
38
+ for (const attributeName in attributes) {
39
+ const attribute = attributes[attributeName];
40
+ fields.push(deduceMeshField(attributeName, attribute));
41
+ }
42
+ return fields;
43
+ }
44
+ /**
45
+ * Make metadata by mesh attribute properties
46
+ * @param attribute
47
+ * @returns
48
+ */
49
+ function makeMeshAttributeMetadata(attribute) {
50
+ const result = new Map();
51
+ if ('byteOffset' in attribute) {
52
+ result.set('byteOffset', attribute.byteOffset.toString(10));
53
+ }
54
+ if ('byteStride' in attribute) {
55
+ result.set('byteStride', attribute.byteStride.toString(10));
56
+ }
57
+ if ('normalized' in attribute) {
58
+ result.set('normalized', attribute.normalized.toString());
59
+ }
60
+ return result;
61
+ }
62
+ exports.makeMeshAttributeMetadata = makeMeshAttributeMetadata;
@@ -8,3 +8,4 @@ import type { Mesh } from './mesh-types';
8
8
  * @returns
9
9
  */
10
10
  export declare function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table;
11
+ //# sourceMappingURL=mesh-to-arrow-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-to-arrow-table.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/mesh-to-arrow-table.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAON,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAGvC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAmB7E"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertMeshToArrowTable = void 0;
4
+ const Arrow_dom_1 = require("apache-arrow/Arrow.dom");
5
+ const arrow_type_utils_1 = require("../../lib/arrow/arrow-type-utils");
6
+ const deduce_mesh_schema_1 = require("./deduce-mesh-schema");
7
+ /**
8
+ * * Convert a loaders.gl Mesh to an Apache Arrow Table
9
+ * @param mesh
10
+ * @param metadata
11
+ * @param batchSize
12
+ * @returns
13
+ */
14
+ function convertMeshToArrowTable(mesh, batchSize) {
15
+ const vectors = [];
16
+ const fields = [];
17
+ for (const attributeKey in mesh.attributes) {
18
+ const attribute = mesh.attributes[attributeKey];
19
+ const { value, size = 1 } = attribute;
20
+ const type = (0, arrow_type_utils_1.getArrowType)(value);
21
+ const vector = (0, arrow_type_utils_1.getArrowVector)(value);
22
+ const listType = new Arrow_dom_1.FixedSizeList(size, new Arrow_dom_1.Field('value', type));
23
+ const field = new Arrow_dom_1.Field(attributeKey, listType, false, (0, deduce_mesh_schema_1.makeMeshAttributeMetadata)(attribute));
24
+ const data = new Arrow_dom_1.Data(listType, 0, value.length / size, 0, undefined, [vector]);
25
+ const listVector = new Arrow_dom_1.FixedSizeListVector(data);
26
+ vectors.push(listVector);
27
+ fields.push(field);
28
+ }
29
+ const schema = new Arrow_dom_1.Schema(fields, mesh?.schema?.metadata || new Map());
30
+ const recordBatch = new Arrow_dom_1.RecordBatch(schema, vectors[0].length, vectors);
31
+ const table = new Arrow_dom_1.Table(schema, recordBatch);
32
+ return table;
33
+ }
34
+ exports.convertMeshToArrowTable = convertMeshToArrowTable;
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../lib/schema';
1
+ import type { Schema } from '../../lib/schema/schema';
2
2
  import type { TypedArray } from '../../types';
3
3
  import type { ColumnarTable, ArrowTable } from '../table/table-types';
4
4
  /** Mesh as columnar table */
@@ -47,3 +47,4 @@ export declare type MeshAttribute = {
47
47
  export declare type MeshAttributes = {
48
48
  [attributeName: string]: MeshAttribute;
49
49
  };
50
+ //# sourceMappingURL=mesh-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-types.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/mesh-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEpE,6BAA6B;AAC7B,MAAM,WAAW,SAAU,SAAQ,aAAa;IAE9C,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0BAA0B;AAC1B,MAAM,WAAW,cAAe,SAAQ,UAAU;IAEhD,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0EAA0E;AAC1E,oBAAY,YAAY,GAAG;IACzB,UAAU,EAAE;QAAC,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAA;KAAC,CAAC;IACrD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,mFAAmF;AACnF,oBAAY,IAAI,GAAG,YAAY,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAClC,MAAM,CAAC,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;KACpC,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,oBAAY,aAAa,GAAG;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wDAAwD;AACxD,oBAAY,cAAc,GAAG;IAAC,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAA;CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,3 +20,4 @@ export declare function getMeshSize(attributes: TypedArrays): number;
20
20
  */
21
21
  export declare function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox;
22
22
  export {};
23
+ //# sourceMappingURL=mesh-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-utils.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/mesh-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAE5C,aAAK,WAAW,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAC,CAAC;AAE/C;;;GAGG;AACH,aAAK,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAU3D;AAED;;;;GAIG;AAEH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,GAAG,WAAW,CA4B1E"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMeshBoundingBox = exports.getMeshSize = void 0;
4
+ /**
5
+ * Get number of vertices in mesh
6
+ * @param attributes
7
+ */
8
+ function getMeshSize(attributes) {
9
+ let size = 0;
10
+ for (const attributeName in attributes) {
11
+ const attribute = attributes[attributeName];
12
+ if (ArrayBuffer.isView(attribute)) {
13
+ // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT
14
+ size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;
15
+ }
16
+ }
17
+ return size;
18
+ }
19
+ exports.getMeshSize = getMeshSize;
20
+ /**
21
+ * Get the (axis aligned) bounding box of a mesh
22
+ * @param attributes
23
+ * @returns array of two vectors representing the axis aligned bounding box
24
+ */
25
+ // eslint-disable-next-line complexity
26
+ function getMeshBoundingBox(attributes) {
27
+ let minX = Infinity;
28
+ let minY = Infinity;
29
+ let minZ = Infinity;
30
+ let maxX = -Infinity;
31
+ let maxY = -Infinity;
32
+ let maxZ = -Infinity;
33
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
34
+ const len = positions && positions.length;
35
+ for (let i = 0; i < len; i += 3) {
36
+ const x = positions[i];
37
+ const y = positions[i + 1];
38
+ const z = positions[i + 2];
39
+ minX = x < minX ? x : minX;
40
+ minY = y < minY ? y : minY;
41
+ minZ = z < minZ ? z : minZ;
42
+ maxX = x > maxX ? x : maxX;
43
+ maxY = y > maxY ? y : maxY;
44
+ maxZ = z > maxZ ? z : maxZ;
45
+ }
46
+ return [
47
+ [minX, minY, minZ],
48
+ [maxX, maxY, maxZ]
49
+ ];
50
+ }
51
+ exports.getMeshBoundingBox = getMeshBoundingBox;
@@ -1,4 +1,4 @@
1
- import { Schema } from '../../lib/schema';
1
+ import { Schema } from '../../lib/schema/schema';
2
2
  /**
3
3
  * SCHEMA SUPPORT - AUTODEDUCTION
4
4
  * @param {*} table
@@ -6,3 +6,4 @@ import { Schema } from '../../lib/schema';
6
6
  * @returns
7
7
  */
8
8
  export declare function deduceTableSchema(table: any, schema?: Schema): Schema;
9
+ //# sourceMappingURL=deduce-table-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deduce-table-schema.d.ts","sourceRoot":"","sources":["../../../src/category/table/deduce-table-schema.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAcP,MAAM,yBAAyB,CAAC;AAmBjC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,KAAA,EAAE,MAAM,CAAC,EAAE,MAAM,UAMvD"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deduceTableSchema = void 0;
4
+ // const TYPED_ARRAY_TO_TYPE = {
5
+ // Int8Array: new Int8(),
6
+ // Int16Array: new Int16(),
7
+ // Int32Array: new Int32(),
8
+ // Uint8Array: new Uint8(),
9
+ // Uint8ClampedArray: new Uint8(),
10
+ // Uint16Array: new Uint16(),
11
+ // Uint32Array: new Uint32(),
12
+ // Float32Array: new Float32(),
13
+ // Float64Array: new Float64()
14
+ // };
15
+ // if (typeof BigInt64Array !== 'undefined') {
16
+ // TYPED_ARRAY_TO_TYPE.BigInt64Array = new Int64();
17
+ // TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
18
+ // }
19
+ /**
20
+ * SCHEMA SUPPORT - AUTODEDUCTION
21
+ * @param {*} table
22
+ * @param {*} schema
23
+ * @returns
24
+ */
25
+ function deduceTableSchema(table, schema) {
26
+ const deducedSchema = Array.isArray(table)
27
+ ? deduceSchemaForRowTable(table)
28
+ : deduceSchemaForColumnarTable(table);
29
+ // Deduced schema will fill in missing info from partial options.schema, if provided
30
+ return Object.assign(deducedSchema, schema);
31
+ }
32
+ exports.deduceTableSchema = deduceTableSchema;
33
+ function deduceSchemaForColumnarTable(columnarTable) {
34
+ const schema = {};
35
+ for (const field in columnarTable) {
36
+ const column = columnarTable[field];
37
+ // Check if column is typed, if so we are done
38
+ if (ArrayBuffer.isView(column)) {
39
+ schema[field] = column.constructor;
40
+ // else we need data
41
+ }
42
+ else if (column.length) {
43
+ const value = column[0];
44
+ schema[field] = deduceTypeFromValue(value);
45
+ // TODO - support nested schemas?
46
+ }
47
+ // else we mark as present but unknow
48
+ schema[field] = schema[field] || null;
49
+ }
50
+ return schema;
51
+ }
52
+ function deduceSchemaForRowTable(rowTable) {
53
+ const schema = {};
54
+ if (rowTable.length) {
55
+ const row = rowTable[0];
56
+ // TODO - Could look at additional rows if nulls in first row
57
+ for (const field in row) {
58
+ const value = row[field];
59
+ schema[field] = deduceTypeFromValue(value);
60
+ }
61
+ }
62
+ return schema;
63
+ }
64
+ function deduceTypeFromValue(value) {
65
+ if (value instanceof Date) {
66
+ return Date;
67
+ }
68
+ else if (value instanceof Number) {
69
+ return Float32Array;
70
+ }
71
+ else if (typeof value === 'string') {
72
+ return String;
73
+ }
74
+ return null;
75
+ }
76
+ /*
77
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
78
+ function deduceSchema(rows) {
79
+ const row = rows[0];
80
+
81
+ const schema = {};
82
+ let i = 0;
83
+ for (const columnName in row) {
84
+ const value = row[columnName];
85
+ switch (typeof value) {
86
+ case 'number':
87
+ case 'boolean':
88
+ // TODO - booleans could be handled differently...
89
+ schema[columnName] = {name: String(columnName), index: i, type: Float32Array};
90
+ break;
91
+
92
+ case 'object':
93
+ schema[columnName] = {name: String(columnName), index: i, type: Array};
94
+ break;
95
+
96
+ case 'string':
97
+ default:
98
+ schema[columnName] = {name: String(columnName), index: i, type: Array};
99
+ // We currently only handle numeric rows
100
+ // TODO we could offer a function to map strings to numbers?
101
+ }
102
+ i++;
103
+ }
104
+ return schema;
105
+ }
106
+ */
@@ -1,4 +1,4 @@
1
- import type { Schema } from '../../lib/schema';
1
+ import type { Schema } from '../../lib/schema/schema';
2
2
  import type { Table as ApacheArrowTable, RecordBatch } from 'apache-arrow/Arrow.dom';
3
3
  import type { AnyArray } from '../../types';
4
4
  import type { Batch } from '../common';
@@ -73,3 +73,4 @@ export declare type ArrowTableBatch = TableBatch & {
73
73
  shape: 'arrow-table';
74
74
  data: RecordBatch;
75
75
  };
76
+ //# sourceMappingURL=table-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-types.d.ts","sourceRoot":"","sources":["../../../src/category/table/table-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,KAAK,IAAI,gBAAgB,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAErC,sBAAsB;AACtB,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,aAAa,CAAC;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC;AAED,4CAA4C;AAC5C,MAAM,WAAW,QAAS,SAAQ,KAAK;IACrC,KAAK,EAAE,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;IAC5D,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,4EAA4E;AAC5E,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;CACf;AAED,6FAA6F;AAC7F,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,CAAC;CACrC;AAED,8EAA8E;AAC9E,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAC,CAAC;CACxC;AAED,iDAAiD;AACjD,MAAM,WAAW,UAAW,SAAQ,KAAK;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAID,gCAAgC;AAChC,oBAAY,UAAU,GAAG,KAAK,GAAG;IAC/B,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,sDAAsD;AACtD,oBAAY,aAAa,GAAG,UAAU,GAAG;IACvC,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;CACb,CAAC;AAEF,sFAAsF;AACtF,oBAAY,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;CACf,CAAC;AAEF,uGAAuG;AACvG,oBAAY,mBAAmB,GAAG,aAAa,GAAG;IAChD,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,EAAE,CAAC;CACrC,CAAC;AAEF,wFAAwF;AACxF,oBAAY,kBAAkB,GAAG,UAAU,GAAG;IAC5C,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAC,CAAC;CACxC,CAAC;AAEF,2DAA2D;AAC3D,oBAAY,eAAe,GAAG,UAAU,GAAG;IACzC,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,7 +7,7 @@ exports.deduceMeshSchema = deduceMeshSchema;
7
7
  exports.deduceMeshField = deduceMeshField;
8
8
  exports.makeMeshAttributeMetadata = makeMeshAttributeMetadata;
9
9
 
10
- var _schema = require("../../lib/schema");
10
+ var _schema = require("../../lib/schema/schema");
11
11
 
12
12
  var _arrowLikeTypeUtils = require("../../lib/arrow/arrow-like-type-utils");
13
13
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/category/mesh/deduce-mesh-schema.ts"],"names":["deduceMeshSchema","attributes","metadata","fields","deduceMeshFields","Schema","deduceMeshField","attributeName","attribute","optionalMetadata","type","value","makeMeshAttributeMetadata","field","Field","FixedSizeList","size","push","result","Map","set","byteOffset","toString","byteStride","normalized"],"mappings":";;;;;;;;;AACA;;AACA;;AAQO,SAASA,gBAAT,CACLC,UADK,EAELC,QAFK,EAGG;AACR,QAAMC,MAAM,GAAGC,gBAAgB,CAACH,UAAD,CAA/B;AACA,SAAO,IAAII,cAAJ,CAAWF,MAAX,EAAmBD,QAAnB,CAAP;AACD;;AASM,SAASI,eAAT,CACLC,aADK,EAELC,SAFK,EAGLC,gBAHK,EAIE;AACP,QAAMC,IAAI,GAAG,oDAA2BF,SAAS,CAACG,KAArC,CAAb;AACA,QAAMT,QAAQ,GAAGO,gBAAgB,GAAGA,gBAAH,GAAsBG,yBAAyB,CAACJ,SAAD,CAAhF;AACA,QAAMK,KAAK,GAAG,IAAIC,aAAJ,CACZP,aADY,EAEZ,IAAIQ,qBAAJ,CAAkBP,SAAS,CAACQ,IAA5B,EAAkC,IAAIF,aAAJ,CAAU,OAAV,EAAmBJ,IAAnB,CAAlC,CAFY,EAGZ,KAHY,EAIZR,QAJY,CAAd;AAMA,SAAOW,KAAP;AACD;;AAOD,SAAST,gBAAT,CAA0BH,UAA1B,EAA+D;AAC7D,QAAME,MAAe,GAAG,EAAxB;;AACA,OAAK,MAAMI,aAAX,IAA4BN,UAA5B,EAAwC;AACtC,UAAMO,SAAwB,GAAGP,UAAU,CAACM,aAAD,CAA3C;AACAJ,IAAAA,MAAM,CAACc,IAAP,CAAYX,eAAe,CAACC,aAAD,EAAgBC,SAAhB,CAA3B;AACD;;AACD,SAAOL,MAAP;AACD;;AAOM,SAASS,yBAAT,CAAmCJ,SAAnC,EAAkF;AACvF,QAAMU,MAAM,GAAG,IAAIC,GAAJ,EAAf;;AACA,MAAI,gBAAgBX,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACa,UAAV,CAAsBC,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBd,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACe,UAAV,CAAsBD,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBd,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACgB,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
+ {"version":3,"sources":["../../../../src/category/mesh/deduce-mesh-schema.ts"],"names":["deduceMeshSchema","attributes","metadata","fields","deduceMeshFields","Schema","deduceMeshField","attributeName","attribute","optionalMetadata","type","value","makeMeshAttributeMetadata","field","Field","FixedSizeList","size","push","result","Map","set","byteOffset","toString","byteStride","normalized"],"mappings":";;;;;;;;;AACA;;AACA;;AAQO,SAASA,gBAAT,CACLC,UADK,EAELC,QAFK,EAGG;AACR,QAAMC,MAAM,GAAGC,gBAAgB,CAACH,UAAD,CAA/B;AACA,SAAO,IAAII,cAAJ,CAAWF,MAAX,EAAmBD,QAAnB,CAAP;AACD;;AASM,SAASI,eAAT,CACLC,aADK,EAELC,SAFK,EAGLC,gBAHK,EAIE;AACP,QAAMC,IAAI,GAAG,oDAA2BF,SAAS,CAACG,KAArC,CAAb;AACA,QAAMT,QAAQ,GAAGO,gBAAgB,GAAGA,gBAAH,GAAsBG,yBAAyB,CAACJ,SAAD,CAAhF;AACA,QAAMK,KAAK,GAAG,IAAIC,aAAJ,CACZP,aADY,EAEZ,IAAIQ,qBAAJ,CAAkBP,SAAS,CAACQ,IAA5B,EAAkC,IAAIF,aAAJ,CAAU,OAAV,EAAmBJ,IAAnB,CAAlC,CAFY,EAGZ,KAHY,EAIZR,QAJY,CAAd;AAMA,SAAOW,KAAP;AACD;;AAOD,SAAST,gBAAT,CAA0BH,UAA1B,EAA+D;AAC7D,QAAME,MAAe,GAAG,EAAxB;;AACA,OAAK,MAAMI,aAAX,IAA4BN,UAA5B,EAAwC;AACtC,UAAMO,SAAwB,GAAGP,UAAU,CAACM,aAAD,CAA3C;AACAJ,IAAAA,MAAM,CAACc,IAAP,CAAYX,eAAe,CAACC,aAAD,EAAgBC,SAAhB,CAA3B;AACD;;AACD,SAAOL,MAAP;AACD;;AAOM,SAASS,yBAAT,CAAmCJ,SAAnC,EAAkF;AACvF,QAAMU,MAAM,GAAG,IAAIC,GAAJ,EAAf;;AACA,MAAI,gBAAgBX,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACa,UAAV,CAAsBC,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBd,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACe,UAAV,CAAsBD,QAAtB,CAA+B,EAA/B,CAAzB;AACD;;AACD,MAAI,gBAAgBd,SAApB,EAA+B;AAC7BU,IAAAA,MAAM,CAACE,GAAP,CAAW,YAAX,EAAyBZ,SAAS,CAACgB,UAAV,CAAsBF,QAAtB,EAAzB;AACD;;AACD,SAAOJ,MAAP;AACD","sourcesContent":["import {MeshAttribute, MeshAttributes} from './mesh-types';\nimport {Schema, Field, FixedSizeList} from '../../lib/schema/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 +1 @@
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":";;;;;;;AAyCO,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
+ {"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":";;;;;;;AAyCO,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/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"}
package/dist/es5/index.js CHANGED
@@ -332,7 +332,7 @@ var _convertMesh = require("./category/mesh/convert-mesh");
332
332
 
333
333
  var _deduceMeshSchema = require("./category/mesh/deduce-mesh-schema");
334
334
 
335
- var _schema = require("./lib/schema");
335
+ var _schema = require("./lib/schema/schema");
336
336
 
337
337
  var _deduceColumnType = require("./lib/schema-utils/deduce-column-type");
338
338
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;;AAEA;;AACA;;AAEA;;AAYA;;AACA;;AACA;;AAmCA;;AA0CA;;AACA;;AACA;;AAEA","sourcesContent":["// COMMON CATEGORY\nexport type {TypedArray, NumberArray, AnyArray} from './types';\n\nexport type {Batch} from './category/common';\n\n// TABLE CATEGORY TYPES\n\nexport type {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n ColumnarTable,\n ArrowTable\n} from './category/table/table-types';\nexport type {\n TableBatch,\n RowArrayTableBatch,\n RowObjectTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './category/table/table-types';\n\n// TABLE CATEGORY UTILS\nexport {default as TableBatchBuilder} from './lib/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';\nexport {default as RowTableBatchAggregator} from './lib/batches/row-table-batch-aggregator';\nexport {default as ColumnarTableBatchAggregator} from './lib/batches/columnar-table-batch-aggregator';\n\nexport {convertToObjectRow, convertToArrayRow} from './lib/utils/row-utils';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './category/mesh/mesh-types';\n\nexport {getMeshSize, getMeshBoundingBox} from './category/mesh/mesh-utils';\nexport {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './category/mesh/deduce-mesh-schema';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon\n} from './category/gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './category/gis';\nexport type {\n BinaryFeatures,\n BinaryPointFeatures,\n BinaryLineFeatures,\n BinaryPolygonFeatures\n} from './category/gis';\n\n// SCHEMA\nexport {\n Schema,\n Field,\n DataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/schema';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {deduceTypeFromColumn, deduceTypeFromValue} from './lib/schema-utils/deduce-column-type';\nexport {getTypeInfo} from './lib/arrow/get-type-info';\nexport {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;;AAEA;;AACA;;AAEA;;AAYA;;AACA;;AACA;;AAmCA;;AA0CA;;AACA;;AACA;;AAEA","sourcesContent":["// COMMON CATEGORY\nexport type {TypedArray, NumberArray, AnyArray} from './types';\n\nexport type {Batch} from './category/common';\n\n// TABLE CATEGORY TYPES\n\nexport type {\n Table,\n ArrayRowTable,\n ObjectRowTable,\n ColumnarTable,\n ArrowTable\n} from './category/table/table-types';\nexport type {\n TableBatch,\n RowArrayTableBatch,\n RowObjectTableBatch,\n ColumnarTableBatch,\n ArrowTableBatch\n} from './category/table/table-types';\n\n// TABLE CATEGORY UTILS\nexport {default as TableBatchBuilder} from './lib/batches/table-batch-builder';\nexport type {TableBatchAggregator} from './lib/batches/table-batch-aggregator';\nexport {default as RowTableBatchAggregator} from './lib/batches/row-table-batch-aggregator';\nexport {default as ColumnarTableBatchAggregator} from './lib/batches/columnar-table-batch-aggregator';\n\nexport {convertToObjectRow, convertToArrayRow} from './lib/utils/row-utils';\n\n// MESH CATEGORY\nexport type {\n MeshTable,\n MeshArrowTable,\n Mesh,\n MeshGeometry,\n MeshAttribute,\n MeshAttributes\n} from './category/mesh/mesh-types';\n\nexport {getMeshSize, getMeshBoundingBox} from './category/mesh/mesh-utils';\nexport {convertMesh} from './category/mesh/convert-mesh';\nexport {\n deduceMeshSchema,\n deduceMeshField,\n makeMeshAttributeMetadata\n} from './category/mesh/deduce-mesh-schema';\n\n// TYPES\n// GIS CATEGORY - GEOJSON\nexport type {GeoJSON, Feature, Geometry, Position, GeoJsonProperties} from './category/gis';\nexport type {\n Point,\n MultiPoint,\n LineString,\n MultiLineString,\n Polygon,\n MultiPolygon\n} from './category/gis';\n\n// GIS CATEGORY - BINARY\nexport type {\n BinaryGeometryType,\n BinaryGeometry,\n BinaryPointGeometry,\n BinaryLineGeometry,\n BinaryPolygonGeometry,\n BinaryAttribute\n} from './category/gis';\nexport type {\n BinaryFeatures,\n BinaryPointFeatures,\n BinaryLineFeatures,\n BinaryPolygonFeatures\n} from './category/gis';\n\n// SCHEMA\nexport {\n Schema,\n Field,\n DataType,\n Null,\n Binary,\n Bool,\n Int,\n Int8,\n Int16,\n Int32,\n Int64,\n Uint8,\n Uint16,\n Uint32,\n Uint64,\n Float,\n Float16,\n Float32,\n Float64,\n Utf8,\n Date,\n DateDay,\n DateMillisecond,\n Time,\n TimeMillisecond,\n TimeSecond,\n Timestamp,\n TimestampSecond,\n TimestampMillisecond,\n TimestampMicrosecond,\n TimestampNanosecond,\n Interval,\n IntervalDayTime,\n IntervalYearMonth,\n FixedSizeList,\n Struct\n} from './lib/schema/schema';\n\n// EXPERIMENTAL APIs\n\n// SCHEMA UTILS\nexport {deduceTypeFromColumn, deduceTypeFromValue} from './lib/schema-utils/deduce-column-type';\nexport {getTypeInfo} from './lib/arrow/get-type-info';\nexport {getArrowTypeFromTypedArray} from './lib/arrow/arrow-like-type-utils';\n\nexport {default as AsyncQueue} from './lib/utils/async-queue';\n"],"file":"index.js"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getArrowTypeFromTypedArray = getArrowTypeFromTypedArray;
7
7
 
8
- var _schema = require("../schema");
8
+ var _schema = require("../schema/schema");
9
9
 
10
10
  function getArrowTypeFromTypedArray(array) {
11
11
  switch (array.constructor) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/arrow/arrow-like-type-utils.ts"],"names":["getArrowTypeFromTypedArray","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error"],"mappings":";;;;;;;AACA;;AAEO,SAASA,0BAAT,CAAoCC,KAApC,EAAiE;AACtE,UAAQA,KAAK,CAACC,WAAd;AACE,SAAKC,SAAL;AACE,aAAO,IAAIC,YAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF;AACE,YAAM,IAAIC,KAAJ,CAAU,0BAAV,CAAN;AAlBJ;AAoBD","sourcesContent":["import type {TypedArray} from '../../types';\nimport {DataType, Float32, Float64, Int16, Int32, Int8, Uint16, Uint32, Uint8} from '../schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n"],"file":"arrow-like-type-utils.js"}
1
+ {"version":3,"sources":["../../../../src/lib/arrow/arrow-like-type-utils.ts"],"names":["getArrowTypeFromTypedArray","array","constructor","Int8Array","Int8","Uint8Array","Uint8","Int16Array","Int16","Uint16Array","Uint16","Int32Array","Int32","Uint32Array","Uint32","Float32Array","Float32","Float64Array","Float64","Error"],"mappings":";;;;;;;AACA;;AAYO,SAASA,0BAAT,CAAoCC,KAApC,EAAiE;AACtE,UAAQA,KAAK,CAACC,WAAd;AACE,SAAKC,SAAL;AACE,aAAO,IAAIC,YAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,UAAL;AACE,aAAO,IAAIC,aAAJ,EAAP;;AACF,SAAKC,WAAL;AACE,aAAO,IAAIC,cAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF,SAAKC,YAAL;AACE,aAAO,IAAIC,eAAJ,EAAP;;AACF;AACE,YAAM,IAAIC,KAAJ,CAAU,0BAAV,CAAN;AAlBJ;AAoBD","sourcesContent":["import type {TypedArray} from '../../types';\nimport {\n DataType,\n Float32,\n Float64,\n Int16,\n Int32,\n Int8,\n Uint16,\n Uint32,\n Uint8\n} from '../schema/schema';\n\nexport function getArrowTypeFromTypedArray(array: TypedArray): DataType {\n switch (array.constructor) {\n case Int8Array:\n return new Int8();\n case Uint8Array:\n return new Uint8();\n case Int16Array:\n return new Int16();\n case Uint16Array:\n return new Uint16();\n case Int32Array:\n return new Int32();\n case Uint32Array:\n return new Uint32();\n case Float32Array:\n return new Float32();\n case Float64Array:\n return new Float64();\n default:\n throw new Error('array type not supported');\n }\n}\n"],"file":"arrow-like-type-utils.js"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getTypeInfo = getTypeInfo;
7
7
 
8
- var _schema = require("../schema");
8
+ var _schema = require("../schema/schema");
9
9
 
10
10
  function getTypeInfo(arrowTypeLike) {
11
11
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/arrow/get-type-info.ts"],"names":["getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"mappings":";;;;;;;AAAA;;AAOO,SAASA,WAAT,CAAqBC,aAArB,EAML;AACA,SAAO;AACLC,IAAAA,MAAM,EAAED,aAAa,CAACC,MADjB;AAELC,IAAAA,SAAS,EAAEF,aAAa,CAACE,SAFpB;AAGLC,IAAAA,QAAQ,EAAEH,aAAa,CAACI,QAAd,EAHL;AAILC,IAAAA,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAf,CAJnB;AAKLM,IAAAA,SAAS,EAAEP,aAAa,CAACO;AALpB,GAAP;AAOD;;AAED,IAAIC,WAA2C,GAAG,IAAlD;;AAEA,SAASF,UAAT,CAAoBG,OAApB,EAA6B;AAC3B,MAAI,CAACD,WAAL,EAAkB;AAChBA,IAAAA,WAAW,GAAG,EAAd;;AACA,SAAK,MAAME,GAAX,IAAkBC,YAAlB,EAAwB;AACtBH,MAAAA,WAAW,CAACG,aAAKD,GAAL,CAAD,CAAX,GAAyBA,GAAzB;AACD;AACF;;AAED,SAAOF,WAAW,CAACC,OAAD,CAAlB;AACD","sourcesContent":["import {Type} from '../schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"file":"get-type-info.js"}
1
+ {"version":3,"sources":["../../../../src/lib/arrow/get-type-info.ts"],"names":["getTypeInfo","arrowTypeLike","typeId","ArrayType","typeName","toString","typeEnumName","getTypeKey","precision","ReverseType","typeKey","key","Type"],"mappings":";;;;;;;AAAA;;AAOO,SAASA,WAAT,CAAqBC,aAArB,EAML;AACA,SAAO;AACLC,IAAAA,MAAM,EAAED,aAAa,CAACC,MADjB;AAELC,IAAAA,SAAS,EAAEF,aAAa,CAACE,SAFpB;AAGLC,IAAAA,QAAQ,EAAEH,aAAa,CAACI,QAAd,EAHL;AAILC,IAAAA,YAAY,EAAEC,UAAU,CAACN,aAAa,CAACC,MAAf,CAJnB;AAKLM,IAAAA,SAAS,EAAEP,aAAa,CAACO;AALpB,GAAP;AAOD;;AAED,IAAIC,WAA2C,GAAG,IAAlD;;AAEA,SAASF,UAAT,CAAoBG,OAApB,EAA6B;AAC3B,MAAI,CAACD,WAAL,EAAkB;AAChBA,IAAAA,WAAW,GAAG,EAAd;;AACA,SAAK,MAAME,GAAX,IAAkBC,YAAlB,EAAwB;AACtBH,MAAAA,WAAW,CAACG,aAAKD,GAAL,CAAD,CAAX,GAAyBA,GAAzB;AACD;AACF;;AAED,SAAOF,WAAW,CAACC,OAAD,CAAlB;AACD","sourcesContent":["import {Type} from '../schema/schema';\nimport {AnyArray} from '../../types';\n\n/**\n * Gets type information from an Arrow type object or \"mock\" Arrow type object\n * @param arrowTypeLike Arrow Type or type object of similar shape\n */\nexport function getTypeInfo(arrowTypeLike: any): {\n typeId: Type;\n ArrayType: AnyArray;\n typeName: string;\n typeEnumName?: string;\n precision?: number;\n} {\n return {\n typeId: arrowTypeLike.typeId,\n ArrayType: arrowTypeLike.ArrayType,\n typeName: arrowTypeLike.toString(),\n typeEnumName: getTypeKey(arrowTypeLike.typeId),\n precision: arrowTypeLike.precision\n };\n}\n\nlet ReverseType: {[key: string]: string} | null = null;\n\nfunction getTypeKey(typeKey) {\n if (!ReverseType) {\n ReverseType = {};\n for (const key in Type) {\n ReverseType[Type[key]] = key;\n }\n }\n\n return ReverseType[typeKey];\n}\n"],"file":"get-type-info.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","constructor","schema","options","Array","isArray","_headers","key","index","name","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data"],"mappings":";;;;;;;;;;;AAIA,MAAMA,iBAAiB,GAAG,GAA1B;;AAEe,MAAMC,uBAAN,CAA8D;AAS3EC,EAAAA,WAAW,CAACC,MAAD,EAAiBC,OAAjB,EAA6C;AAAA;AAAA;AAAA,kDALvC,CAKuC;AAAA,gDAJnC,IAImC;AAAA,kDAHvC,CAGuC;AAAA,oDAF3B,EAE2B;AACtD,SAAKA,OAAL,GAAeA,OAAf;AACA,SAAKD,MAAL,GAAcA,MAAd;;AAIA,QAAI,CAACE,KAAK,CAACC,OAAN,CAAcH,MAAd,CAAL,EAA4B;AAC1B,WAAKI,QAAL,GAAgB,EAAhB;;AACA,WAAK,MAAMC,GAAX,IAAkBL,MAAlB,EAA0B;AACxB,aAAKI,QAAL,CAAcJ,MAAM,CAACK,GAAD,CAAN,CAAYC,KAA1B,IAAmCN,MAAM,CAACK,GAAD,CAAN,CAAYE,IAA/C;AACD;AACF;AACF;;AAEDC,EAAAA,QAAQ,GAAW;AACjB,WAAO,KAAKC,MAAZ;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAaC,MAAb,EAAoC;AAC7C,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDO,EAAAA,YAAY,CAACL,GAAD,EAAmCC,MAAnC,EAA0D;AACpE,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDQ,EAAAA,QAAQ,GAAsB;AAC5B,QAAIF,IAAI,GAAG,KAAKA,IAAhB;;AACA,QAAI,CAACA,IAAL,EAAW;AACT,aAAO,IAAP;AACD;;AAEDA,IAAAA,IAAI,GAAGA,IAAI,CAACG,KAAL,CAAW,CAAX,EAAc,KAAKT,MAAnB,CAAP;AACA,SAAKM,IAAL,GAAY,IAAZ;AAEA,UAAMI,KAAiB,GAAG;AACxBC,MAAAA,KAAK,EAAE,KAAKnB,OAAL,CAAamB,KADI;AAExBC,MAAAA,SAAS,EAAE,MAFa;AAGxBC,MAAAA,IAAI,EAAEP,IAHkB;AAIxBN,MAAAA,MAAM,EAAE,KAAKA,MAJW;AAKxBT,MAAAA,MAAM,EAAE,KAAKA,MALW;AAMxBY,MAAAA,MAAM,EAAE,KAAKA;AANW,KAA1B;AASA,WAAOO,KAAP;AACD;;AAlE0E","sourcesContent":["import type {Schema} from '../schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"file":"base-table-batch-aggregator.js"}
1
+ {"version":3,"sources":["../../../../src/lib/batches/base-table-batch-aggregator.ts"],"names":["DEFAULT_ROW_COUNT","RowTableBatchAggregator","constructor","schema","options","Array","isArray","_headers","key","index","name","rowCount","length","addArrayRow","row","cursor","Number","isFinite","rows","addObjectRow","getBatch","slice","batch","shape","batchType","data"],"mappings":";;;;;;;;;;;AAIA,MAAMA,iBAAiB,GAAG,GAA1B;;AAEe,MAAMC,uBAAN,CAA8D;AAS3EC,EAAAA,WAAW,CAACC,MAAD,EAAiBC,OAAjB,EAA6C;AAAA;AAAA;AAAA,kDALvC,CAKuC;AAAA,gDAJnC,IAImC;AAAA,kDAHvC,CAGuC;AAAA,oDAF3B,EAE2B;AACtD,SAAKA,OAAL,GAAeA,OAAf;AACA,SAAKD,MAAL,GAAcA,MAAd;;AAIA,QAAI,CAACE,KAAK,CAACC,OAAN,CAAcH,MAAd,CAAL,EAA4B;AAC1B,WAAKI,QAAL,GAAgB,EAAhB;;AACA,WAAK,MAAMC,GAAX,IAAkBL,MAAlB,EAA0B;AACxB,aAAKI,QAAL,CAAcJ,MAAM,CAACK,GAAD,CAAN,CAAYC,KAA1B,IAAmCN,MAAM,CAACK,GAAD,CAAN,CAAYE,IAA/C;AACD;AACF;AACF;;AAEDC,EAAAA,QAAQ,GAAW;AACjB,WAAO,KAAKC,MAAZ;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAaC,MAAb,EAAoC;AAC7C,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDO,EAAAA,YAAY,CAACL,GAAD,EAAmCC,MAAnC,EAA0D;AACpE,QAAIC,MAAM,CAACC,QAAP,CAAgBF,MAAhB,CAAJ,EAA6B;AAC3B,WAAKA,MAAL,GAAcA,MAAd;AACD;;AAED,SAAKG,IAAL,GAAY,KAAKA,IAAL,IAAa,IAAIb,KAAJ,CAAUL,iBAAV,CAAzB;AACA,SAAKkB,IAAL,CAAU,KAAKN,MAAf,IAAyBE,GAAzB;AACA,SAAKF,MAAL;AACD;;AAEDQ,EAAAA,QAAQ,GAAsB;AAC5B,QAAIF,IAAI,GAAG,KAAKA,IAAhB;;AACA,QAAI,CAACA,IAAL,EAAW;AACT,aAAO,IAAP;AACD;;AAEDA,IAAAA,IAAI,GAAGA,IAAI,CAACG,KAAL,CAAW,CAAX,EAAc,KAAKT,MAAnB,CAAP;AACA,SAAKM,IAAL,GAAY,IAAZ;AAEA,UAAMI,KAAiB,GAAG;AACxBC,MAAAA,KAAK,EAAE,KAAKnB,OAAL,CAAamB,KADI;AAExBC,MAAAA,SAAS,EAAE,MAFa;AAGxBC,MAAAA,IAAI,EAAEP,IAHkB;AAIxBN,MAAAA,MAAM,EAAE,KAAKA,MAJW;AAKxBT,MAAAA,MAAM,EAAE,KAAKA,MALW;AAMxBY,MAAAA,MAAM,EAAE,KAAKA;AANW,KAA1B;AASA,WAAOO,KAAP;AACD;;AAlE0E","sourcesContent":["import type {Schema} from '../schema/schema';\nimport type {TableBatch} from '../../category/table/table-types';\nimport {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';\n\nconst DEFAULT_ROW_COUNT = 100;\n\nexport default class RowTableBatchAggregator implements TableBatchAggregator {\n schema: Schema;\n options: TableBatchOptions;\n\n length: number = 0;\n rows: any[] | null = null;\n cursor: number = 0;\n private _headers: string[] = [];\n\n constructor(schema: Schema, options: TableBatchOptions) {\n this.options = options;\n this.schema = schema;\n\n // schema is an array if there're no headers\n // object if there are headers\n if (!Array.isArray(schema)) {\n this._headers = [];\n for (const key in schema) {\n this._headers[schema[key].index] = schema[key].name;\n }\n }\n }\n\n rowCount(): number {\n return this.length;\n }\n\n addArrayRow(row: any[], cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {\n if (Number.isFinite(cursor)) {\n this.cursor = cursor as number;\n }\n\n this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);\n this.rows[this.length] = row;\n this.length++;\n }\n\n getBatch(): TableBatch | null {\n let rows = this.rows;\n if (!rows) {\n return null;\n }\n\n rows = rows.slice(0, this.length);\n this.rows = null;\n\n const batch: TableBatch = {\n shape: this.options.shape,\n batchType: 'data',\n data: rows,\n length: this.length,\n schema: this.schema,\n cursor: this.cursor\n };\n\n return batch;\n }\n}\n"],"file":"base-table-batch-aggregator.js"}