@loaders.gl/schema 3.1.0-alpha.4 → 3.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +1289 -0
- package/dist/category/common.d.ts +20 -0
- package/dist/category/common.d.ts.map +1 -0
- package/dist/category/common.js +10 -0
- package/dist/category/gis.d.ts +50 -0
- package/dist/category/gis.d.ts.map +1 -0
- package/dist/category/gis.js +2 -0
- package/dist/category/mesh/convert-mesh.d.ts +15 -0
- package/dist/category/mesh/convert-mesh.d.ts.map +1 -0
- package/dist/category/mesh/convert-mesh.js +39 -0
- package/dist/category/mesh/deduce-mesh-schema.d.ts +24 -0
- package/dist/category/mesh/deduce-mesh-schema.d.ts.map +1 -0
- package/dist/category/mesh/deduce-mesh-schema.js +62 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts +1 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -0
- package/dist/category/mesh/mesh-to-arrow-table.js +44 -0
- package/dist/category/mesh/mesh-types.d.ts +50 -0
- package/dist/category/mesh/mesh-types.d.ts.map +1 -0
- package/dist/category/mesh/mesh-types.js +2 -0
- package/dist/category/mesh/mesh-utils.d.ts +23 -0
- package/dist/category/mesh/mesh-utils.d.ts.map +1 -0
- package/dist/category/mesh/mesh-utils.js +51 -0
- package/dist/category/table/deduce-table-schema.d.ts +9 -0
- package/dist/category/table/deduce-table-schema.d.ts.map +1 -0
- package/dist/category/table/deduce-table-schema.js +106 -0
- package/dist/category/table/table-types.d.ts +78 -0
- package/dist/category/table/table-types.d.ts.map +1 -0
- package/dist/category/table/table-types.js +2 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/category/mesh/convert-mesh.js +2 -18
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/deduce-mesh-schema.js +9 -9
- package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +0 -38
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/mesh/mesh-utils.js +16 -16
- package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
- package/dist/es5/category/table/deduce-table-schema.js +9 -9
- package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
- package/dist/es5/index.js +53 -53
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-like-type-utils.js +1 -1
- package/dist/es5/lib/arrow/arrow-like-type-utils.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-type-utils.js +0 -70
- package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/es5/lib/arrow/get-type-info.js +4 -4
- package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
- package/dist/es5/lib/batches/base-table-batch-aggregator.js +42 -53
- package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +71 -90
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/row-table-batch-aggregator.js +59 -70
- package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/table-batch-builder.js +113 -133
- package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/es5/lib/schema/impl/enum.js +1 -1
- package/dist/es5/lib/schema/impl/field.js +19 -32
- package/dist/es5/lib/schema/impl/field.js.map +1 -1
- package/dist/es5/lib/schema/impl/schema.js +54 -119
- package/dist/es5/lib/schema/impl/schema.js.map +1 -1
- package/dist/es5/lib/schema/impl/type.js +395 -728
- package/dist/es5/lib/schema/impl/type.js.map +1 -1
- package/dist/es5/lib/schema/{index.js → schema.js} +38 -38
- package/dist/es5/lib/schema/schema.js.map +1 -0
- package/dist/es5/lib/schema-utils/deduce-column-type.js.map +1 -1
- package/dist/es5/lib/utils/async-queue.js +81 -164
- package/dist/es5/lib/utils/async-queue.js.map +1 -1
- package/dist/es5/lib/utils/row-utils.js +4 -4
- package/dist/es5/lib/utils/row-utils.js.map +1 -1
- package/dist/esm/category/mesh/convert-mesh.js +1 -8
- package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
- package/dist/esm/category/mesh/deduce-mesh-schema.js +1 -1
- package/dist/esm/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/esm/category/mesh/mesh-to-arrow-table.js +0 -29
- package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/esm/category/table/deduce-table-schema.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-like-type-utils.js +1 -1
- package/dist/esm/lib/arrow/arrow-like-type-utils.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-type-utils.js +0 -60
- package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/esm/lib/arrow/get-type-info.js +1 -1
- package/dist/esm/lib/arrow/get-type-info.js.map +1 -1
- package/dist/esm/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/esm/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/esm/lib/schema/impl/field.js +1 -1
- package/dist/esm/lib/schema/impl/field.js.map +1 -1
- package/dist/esm/lib/schema/impl/schema.js.map +1 -1
- package/dist/esm/lib/schema/impl/type.js +8 -8
- package/dist/esm/lib/schema/impl/type.js.map +1 -1
- package/dist/esm/lib/schema/{index.js → schema.js} +1 -1
- package/dist/esm/lib/schema/schema.js.map +1 -0
- package/dist/esm/lib/schema-utils/deduce-column-type.js.map +1 -1
- package/dist/esm/lib/utils/async-queue.js.map +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -0
- package/dist/lib/arrow/arrow-like-type-utils.d.ts +4 -0
- package/dist/lib/arrow/arrow-like-type-utils.d.ts.map +1 -0
- package/dist/lib/arrow/arrow-like-type-utils.js +27 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts +1 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -0
- package/dist/lib/arrow/arrow-type-utils.js +70 -0
- package/dist/lib/arrow/get-type-info.d.ts +14 -0
- package/dist/lib/arrow/get-type-info.d.ts.map +1 -0
- package/dist/lib/arrow/get-type-info.js +28 -0
- package/dist/lib/batches/base-table-batch-aggregator.d.ts +19 -0
- package/dist/lib/batches/base-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/batches/base-table-batch-aggregator.js +58 -0
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +23 -0
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/batches/columnar-table-batch-aggregator.js +90 -0
- package/dist/lib/batches/row-table-batch-aggregator.d.ts +22 -0
- package/dist/lib/batches/row-table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/batches/row-table-batch-aggregator.js +79 -0
- package/dist/lib/batches/table-batch-aggregator.d.ts +25 -0
- package/dist/lib/batches/table-batch-aggregator.d.ts.map +1 -0
- package/dist/lib/batches/table-batch-aggregator.js +2 -0
- package/dist/lib/batches/table-batch-builder.d.ts +53 -0
- package/dist/lib/batches/table-batch-builder.d.ts.map +1 -0
- package/dist/lib/batches/table-batch-builder.js +153 -0
- package/dist/lib/schema/impl/enum.d.ts +92 -0
- package/dist/lib/schema/impl/enum.d.ts.map +1 -0
- package/dist/lib/schema/impl/enum.js +97 -0
- package/dist/lib/schema/impl/field.d.ts +19 -0
- package/dist/lib/schema/impl/field.d.ts.map +1 -0
- package/dist/lib/schema/impl/field.js +32 -0
- package/dist/lib/schema/impl/schema.d.ts +16 -0
- package/dist/lib/schema/impl/schema.d.ts.map +1 -0
- package/dist/lib/schema/impl/schema.js +83 -0
- package/dist/lib/schema/impl/type.d.ts +176 -0
- package/dist/lib/schema/impl/type.d.ts.map +1 -0
- package/dist/lib/schema/impl/type.js +462 -0
- package/dist/lib/schema/schema.d.ts +5 -0
- package/dist/lib/schema/schema.d.ts.map +1 -0
- package/dist/lib/schema/schema.js +90 -0
- package/dist/lib/schema-utils/deduce-column-type.d.ts +3 -0
- package/dist/lib/schema-utils/deduce-column-type.d.ts.map +1 -0
- package/dist/lib/schema-utils/deduce-column-type.js +92 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +12 -0
- package/dist/lib/utils/async-queue.d.ts +18 -0
- package/dist/lib/utils/async-queue.d.ts.map +1 -0
- package/dist/lib/utils/async-queue.js +92 -0
- package/dist/lib/utils/row-utils.d.ts +9 -0
- package/dist/lib/utils/row-utils.d.ts.map +1 -0
- package/dist/lib/utils/row-utils.js +33 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/package.json +5 -7
- package/src/category/common.ts +2 -1
- package/src/category/mesh/convert-mesh.ts +6 -6
- package/src/category/mesh/deduce-mesh-schema.ts +1 -1
- package/src/category/mesh/mesh-to-arrow-table.ts +4 -2
- package/src/category/mesh/mesh-types.ts +1 -1
- package/src/category/table/deduce-table-schema.ts +1 -1
- package/src/category/table/table-types.ts +5 -2
- package/src/index.ts +1 -1
- package/src/lib/arrow/arrow-like-type-utils.ts +11 -1
- package/src/lib/arrow/arrow-type-utils.ts +2 -0
- package/src/lib/arrow/get-type-info.ts +1 -1
- package/src/lib/batches/base-table-batch-aggregator.ts +1 -1
- package/src/lib/batches/columnar-table-batch-aggregator.ts +1 -1
- package/src/lib/batches/row-table-batch-aggregator.ts +1 -1
- package/src/lib/batches/table-batch-aggregator.ts +1 -1
- package/src/lib/batches/table-batch-builder.ts +2 -2
- package/src/lib/schema/impl/schema.ts +2 -2
- package/src/lib/schema/impl/type.ts +2 -2
- package/src/lib/schema/{index.ts → schema.ts} +0 -0
- package/src/lib/schema-utils/deduce-column-type.ts +6 -2
- package/src/lib/utils/async-queue.ts +7 -4
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/es5/lib/schema/index.js.map +0 -1
- package/dist/esm/lib/schema/index.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default class AsyncQueue<T> {
|
|
2
|
+
private _values;
|
|
3
|
+
private _settlers;
|
|
4
|
+
private _closed;
|
|
5
|
+
constructor();
|
|
6
|
+
close(): void;
|
|
7
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
8
|
+
enqueue(value: T | Error): void;
|
|
9
|
+
/**
|
|
10
|
+
* @returns a Promise for an IteratorResult
|
|
11
|
+
*/
|
|
12
|
+
next(): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns a Promise for an Array with the elements in `asyncIterable`
|
|
16
|
+
*/
|
|
17
|
+
export declare function takeAsync(asyncIterable: AsyncIterable<any>, count?: number): Promise<any[]>;
|
|
18
|
+
//# sourceMappingURL=async-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-queue.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/async-queue.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAA8E;IAC/F,OAAO,CAAC,OAAO,CAAU;;IAazB,KAAK,IAAI,IAAI;IAOb,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;IAI1C,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI;IAoB/B;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;CAoBrB;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,EACjC,KAAK,SAAW,GACf,OAAO,CAAC,GAAG,EAAE,CAAC,CAWhB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// From https://github.com/rauschma/async-iter-demo/tree/master/src under MIT license
|
|
3
|
+
// http://2ality.com/2016/10/asynchronous-iteration.html
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.takeAsync = void 0;
|
|
6
|
+
class ArrayQueue extends Array {
|
|
7
|
+
enqueue(value) {
|
|
8
|
+
// Add at the end
|
|
9
|
+
return this.push(value);
|
|
10
|
+
}
|
|
11
|
+
dequeue() {
|
|
12
|
+
// Remove first element
|
|
13
|
+
return this.shift();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class AsyncQueue {
|
|
17
|
+
constructor() {
|
|
18
|
+
// enqueues > dequeues
|
|
19
|
+
this._values = new ArrayQueue();
|
|
20
|
+
// dequeues > enqueues
|
|
21
|
+
this._settlers = new ArrayQueue();
|
|
22
|
+
this._closed = false;
|
|
23
|
+
}
|
|
24
|
+
close() {
|
|
25
|
+
while (this._settlers.length > 0) {
|
|
26
|
+
this._settlers.dequeue().resolve({ done: true });
|
|
27
|
+
}
|
|
28
|
+
this._closed = true;
|
|
29
|
+
}
|
|
30
|
+
[Symbol.asyncIterator]() {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
enqueue(value) {
|
|
34
|
+
if (this._closed) {
|
|
35
|
+
throw new Error('Closed');
|
|
36
|
+
}
|
|
37
|
+
if (this._settlers.length > 0) {
|
|
38
|
+
if (this._values.length > 0) {
|
|
39
|
+
throw new Error('Illegal internal state');
|
|
40
|
+
}
|
|
41
|
+
const settler = this._settlers.dequeue();
|
|
42
|
+
if (value instanceof Error) {
|
|
43
|
+
settler.reject(value);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
settler.resolve({ value });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this._values.enqueue(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @returns a Promise for an IteratorResult
|
|
55
|
+
*/
|
|
56
|
+
next() {
|
|
57
|
+
if (this._values.length > 0) {
|
|
58
|
+
const value = this._values.dequeue();
|
|
59
|
+
if (value instanceof Error) {
|
|
60
|
+
return Promise.reject(value);
|
|
61
|
+
}
|
|
62
|
+
return Promise.resolve({ value });
|
|
63
|
+
}
|
|
64
|
+
if (this._closed) {
|
|
65
|
+
if (this._settlers.length > 0) {
|
|
66
|
+
throw new Error('Illegal internal state');
|
|
67
|
+
}
|
|
68
|
+
return Promise.resolve({ done: true });
|
|
69
|
+
}
|
|
70
|
+
// Wait for new values to be enqueued
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
this._settlers.enqueue({ resolve, reject });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.default = AsyncQueue;
|
|
77
|
+
/**
|
|
78
|
+
* @returns a Promise for an Array with the elements in `asyncIterable`
|
|
79
|
+
*/
|
|
80
|
+
async function takeAsync(asyncIterable, count = Infinity) {
|
|
81
|
+
const result = [];
|
|
82
|
+
const iterator = asyncIterable[Symbol.asyncIterator]();
|
|
83
|
+
while (result.length < count) {
|
|
84
|
+
const { value, done } = await iterator.next();
|
|
85
|
+
if (done) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
result.push(value);
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
exports.takeAsync = takeAsync;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Convert an object row to an array row */
|
|
2
|
+
export declare function convertToObjectRow(arrayRow: any[], headers: string[]): {
|
|
3
|
+
[columnName: string]: any;
|
|
4
|
+
};
|
|
5
|
+
/** Convert an object row to an array row */
|
|
6
|
+
export declare function convertToArrayRow(objectRow: {
|
|
7
|
+
[columnName: string]: any;
|
|
8
|
+
}, headers: string[]): any[];
|
|
9
|
+
//# sourceMappingURL=row-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/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;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Any typed array */
|
|
2
|
+
export declare type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
|
|
3
|
+
export declare type BigTypedArray = TypedArray | BigInt64Array | BigUint64Array;
|
|
4
|
+
/** Any numeric array: typed array or `number[]` */
|
|
5
|
+
export declare type NumberArray = number[] | TypedArray;
|
|
6
|
+
/** Any array: typed array or js array (`any[]`) */
|
|
7
|
+
export declare type AnyArray = any[] | TypedArray;
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,oBAAY,UAAU,GAClB,SAAS,GACT,UAAU,GACV,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,YAAY,CAAC;AAEjB,oBAAY,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExE,mDAAmD;AACnD,oBAAY,WAAW,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC;AAEhD,mDAAmD;AACnD,oBAAY,QAAQ,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC"}
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/schema",
|
|
3
|
-
"version": "3.1.0-
|
|
3
|
+
"version": "3.1.0-beta.3",
|
|
4
4
|
"description": "Table format APIs for JSON, CSV, etc...",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"point cloud",
|
|
19
19
|
"PLY"
|
|
20
20
|
],
|
|
21
|
-
"types": "
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
22
|
"main": "dist/es5/index.js",
|
|
23
23
|
"module": "dist/esm/index.js",
|
|
24
24
|
"sideEffects": false,
|
|
@@ -29,12 +29,10 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"pre-build": "npm run build-bundle",
|
|
32
|
-
"build-bundle": "
|
|
32
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@types/geojson": "^7946.0.7"
|
|
36
|
-
"apache-arrow": "^4.0.0",
|
|
37
|
-
"d3-dsv": "^1.2.0"
|
|
35
|
+
"@types/geojson": "^7946.0.7"
|
|
38
36
|
},
|
|
39
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "3537c382b3ea4e092b24b6f94c3edee72076039c"
|
|
40
38
|
}
|
package/src/category/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {Mesh} from './mesh-types';
|
|
2
2
|
import type {ColumnarTable, ArrowTable} from '../table/table-types';
|
|
3
|
-
import {convertMeshToArrowTable} from './mesh-to-arrow-table';
|
|
3
|
+
// import {convertMeshToArrowTable} from './mesh-to-arrow-table';
|
|
4
4
|
|
|
5
5
|
type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
|
|
6
6
|
|
|
@@ -17,11 +17,11 @@ export function convertMesh(
|
|
|
17
17
|
return mesh;
|
|
18
18
|
case 'columnar-table':
|
|
19
19
|
return convertMeshToColumnarTable(mesh);
|
|
20
|
-
case 'arrow-table':
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
// case 'arrow-table':
|
|
21
|
+
// return {
|
|
22
|
+
// shape: 'arrow-table',
|
|
23
|
+
// data: convertMeshToArrowTable(mesh)
|
|
24
|
+
// };
|
|
25
25
|
default:
|
|
26
26
|
throw new Error(`Unsupported shape ${options?.shape}`);
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {MeshAttribute, MeshAttributes} from './mesh-types';
|
|
2
|
-
import {Schema, Field, FixedSizeList} from '../../lib/schema';
|
|
2
|
+
import {Schema, Field, FixedSizeList} from '../../lib/schema/schema';
|
|
3
3
|
import {getArrowTypeFromTypedArray} from '../../lib/arrow/arrow-like-type-utils';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*
|
|
1
2
|
import {
|
|
2
3
|
Table,
|
|
3
4
|
Schema,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
Field,
|
|
7
8
|
Data,
|
|
8
9
|
FixedSizeListVector
|
|
9
|
-
} from 'apache-arrow
|
|
10
|
+
} from 'apache-arrow';
|
|
10
11
|
import {AbstractVector} from 'apache-arrow/vector';
|
|
11
12
|
import {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';
|
|
12
13
|
import type {Mesh} from './mesh-types';
|
|
@@ -18,7 +19,7 @@ import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
|
18
19
|
* @param metadata
|
|
19
20
|
* @param batchSize
|
|
20
21
|
* @returns
|
|
21
|
-
|
|
22
|
+
*
|
|
22
23
|
export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
23
24
|
const vectors: AbstractVector[] = [];
|
|
24
25
|
const fields: Field[] = [];
|
|
@@ -39,3 +40,4 @@ export function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table {
|
|
|
39
40
|
const table = new Table(schema, recordBatch);
|
|
40
41
|
return table;
|
|
41
42
|
}
|
|
43
|
+
*/
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type {Schema} from '../../lib/schema';
|
|
2
|
-
import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
|
|
1
|
+
import type {Schema} from '../../lib/schema/schema';
|
|
3
2
|
import type {AnyArray} from '../../types';
|
|
4
3
|
import type {Batch} from '../common';
|
|
4
|
+
// TODO Arrow dependency causes issues
|
|
5
|
+
// import type {Table as ApacheArrowTable, RecordBatch} from 'apache-arrow/Arrow.dom';
|
|
6
|
+
type ApacheArrowTable = any;
|
|
7
|
+
type RecordBatch = any;
|
|
5
8
|
|
|
6
9
|
/** A general table */
|
|
7
10
|
export interface Table {
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type {TypedArray} from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DataType,
|
|
4
|
+
Float32,
|
|
5
|
+
Float64,
|
|
6
|
+
Int16,
|
|
7
|
+
Int32,
|
|
8
|
+
Int8,
|
|
9
|
+
Uint16,
|
|
10
|
+
Uint32,
|
|
11
|
+
Uint8
|
|
12
|
+
} from '../schema/schema';
|
|
3
13
|
|
|
4
14
|
export function getArrowTypeFromTypedArray(array: TypedArray): DataType {
|
|
5
15
|
switch (array.constructor) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Schema} from '../schema';
|
|
1
|
+
import type {Schema} from '../schema/schema';
|
|
2
2
|
import type {TableBatch} from '../../category/table/table-types';
|
|
3
3
|
// import type {ArrayRowTableBatch, ObjectRowTableBatch} from '../../category/table';
|
|
4
4
|
import {convertToArrayRow, convertToObjectRow} from '../utils/row-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Schema} from '../schema';
|
|
1
|
+
import type {Schema} from '../schema/schema';
|
|
2
2
|
import type {TableBatch} from '../../category/table/table-types';
|
|
3
3
|
import type {TableBatchAggregator, TableBatchConstructor} from './table-batch-aggregator';
|
|
4
4
|
import BaseTableBatchAggregator from './base-table-batch-aggregator';
|
|
@@ -114,7 +114,7 @@ export default class TableBatchBuilder {
|
|
|
114
114
|
|
|
115
115
|
// INTERNAL
|
|
116
116
|
|
|
117
|
-
_estimateRowMB(row) {
|
|
117
|
+
_estimateRowMB(row: any[] | object): number {
|
|
118
118
|
return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -82,8 +82,8 @@ export default class Schema {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
// Warn if any duplicated field names
|
|
85
|
-
function checkNames(fields) {
|
|
86
|
-
const usedNames = {};
|
|
85
|
+
function checkNames(fields: Field[]): void {
|
|
86
|
+
const usedNames: Record<string, boolean> = {};
|
|
87
87
|
for (const field of fields) {
|
|
88
88
|
if (usedNames[field.name]) {
|
|
89
89
|
// eslint-disable-next-line
|
|
@@ -333,10 +333,10 @@ const TimeUnit = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
export class Time extends DataType {
|
|
336
|
-
readonly unit:
|
|
336
|
+
readonly unit: any;
|
|
337
337
|
readonly bitWidth: number;
|
|
338
338
|
|
|
339
|
-
constructor(unit, bitWidth) {
|
|
339
|
+
constructor(unit: any, bitWidth: number) {
|
|
340
340
|
super();
|
|
341
341
|
this.unit = unit;
|
|
342
342
|
this.bitWidth = bitWidth;
|
|
File without changes
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
// TYPED_ARRAY_TO_TYPE.BigUint64Array = new Uint64();
|
|
34
34
|
// }
|
|
35
35
|
|
|
36
|
-
export function deduceTypeFromColumn(
|
|
36
|
+
export function deduceTypeFromColumn(
|
|
37
|
+
value: unknown
|
|
38
|
+
): StringConstructor | DateConstructor | Float32ArrayConstructor | null {
|
|
37
39
|
if (value instanceof Date) {
|
|
38
40
|
return Date;
|
|
39
41
|
} else if (value instanceof Number) {
|
|
@@ -44,7 +46,9 @@ export function deduceTypeFromColumn(value) {
|
|
|
44
46
|
return null;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
export function deduceTypeFromValue(
|
|
49
|
+
export function deduceTypeFromValue(
|
|
50
|
+
value: unknown
|
|
51
|
+
): StringConstructor | DateConstructor | Float32ArrayConstructor | null {
|
|
48
52
|
if (value instanceof Date) {
|
|
49
53
|
return Date;
|
|
50
54
|
} else if (value instanceof Number) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// http://2ality.com/2016/10/asynchronous-iteration.html
|
|
3
3
|
|
|
4
4
|
class ArrayQueue<T> extends Array<T> {
|
|
5
|
-
enqueue(value) {
|
|
5
|
+
enqueue(value: T) {
|
|
6
6
|
// Add at the end
|
|
7
7
|
return this.push(value);
|
|
8
8
|
}
|
|
@@ -13,15 +13,18 @@ class ArrayQueue<T> extends Array<T> {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default class AsyncQueue<T> {
|
|
16
|
-
private _values: ArrayQueue<T>;
|
|
17
|
-
private _settlers: ArrayQueue<{resolve; reject}>;
|
|
16
|
+
private _values: ArrayQueue<T | Error>;
|
|
17
|
+
private _settlers: ArrayQueue<{resolve: (value: any) => void; reject: (reason?: any) => void}>;
|
|
18
18
|
private _closed: boolean;
|
|
19
19
|
|
|
20
20
|
constructor() {
|
|
21
21
|
// enqueues > dequeues
|
|
22
22
|
this._values = new ArrayQueue<T>();
|
|
23
23
|
// dequeues > enqueues
|
|
24
|
-
this._settlers = new ArrayQueue<{
|
|
24
|
+
this._settlers = new ArrayQueue<{
|
|
25
|
+
resolve: (value: any) => void;
|
|
26
|
+
reject: (reason?: any) => void;
|
|
27
|
+
}>();
|
|
25
28
|
this._closed = false;
|
|
26
29
|
}
|
|
27
30
|
|