@loaders.gl/schema 3.1.8 → 3.2.0-alpha.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.
- package/dist/category/common.d.ts +1 -2
- package/dist/category/common.d.ts.map +1 -1
- package/dist/category/image/image.d.ts +18 -0
- package/dist/category/image/image.d.ts.map +1 -0
- package/dist/category/image/image.js +2 -0
- package/dist/category/mesh/convert-mesh.js +6 -5
- package/dist/category/mesh/mesh-to-arrow-table.d.ts +10 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts.map +1 -1
- package/dist/category/mesh/mesh-to-arrow-table.js +26 -36
- package/dist/category/table/table-types.d.ts +9 -3
- package/dist/category/table/table-types.d.ts.map +1 -1
- package/dist/category/texture/texture.d.ts +18 -0
- package/dist/category/texture/texture.d.ts.map +1 -0
- package/dist/category/texture/texture.js +2 -0
- package/dist/dist.min.js +15078 -208
- package/dist/es5/category/image/image.js +2 -0
- package/dist/es5/category/image/image.js.map +1 -0
- package/dist/es5/category/mesh/convert-mesh.js +8 -0
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +38 -0
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/texture/texture.js +2 -0
- package/dist/es5/category/texture/texture.js.map +1 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/arrow/arrow-type-utils.js +70 -0
- package/dist/es5/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/esm/category/image/image.js +2 -0
- package/dist/esm/category/image/image.js.map +1 -0
- package/dist/esm/category/mesh/convert-mesh.js +7 -0
- package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
- package/dist/esm/category/mesh/mesh-to-arrow-table.js +29 -0
- package/dist/esm/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/esm/category/texture/texture.js +2 -0
- package/dist/esm/category/texture/texture.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/arrow/arrow-type-utils.js +60 -0
- package/dist/esm/lib/arrow/arrow-type-utils.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/arrow/arrow-type-utils.d.ts +5 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts.map +1 -1
- package/dist/lib/arrow/arrow-type-utils.js +47 -67
- package/package.json +4 -3
- package/src/category/common.ts +1 -2
- package/src/category/image/image.ts +19 -0
- package/src/category/mesh/convert-mesh.ts +6 -6
- package/src/category/mesh/mesh-to-arrow-table.ts +2 -4
- package/src/category/table/table-types.ts +7 -4
- package/src/category/texture/texture.ts +28 -0
- package/src/index.ts +8 -2
- package/src/lib/arrow/arrow-type-utils.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { RecordBatch } from 'apache-arrow';
|
|
2
2
|
export declare type Field = any;
|
|
3
3
|
export declare type Schema = {
|
|
4
4
|
[key: string]: Field;
|
|
@@ -16,5 +16,4 @@ export declare type Batch = {
|
|
|
16
16
|
cursor?: number;
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
};
|
|
19
|
-
export {};
|
|
20
19
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/category/common.ts"],"names":[],"mappings":"
|
|
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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* data images
|
|
3
|
+
*/
|
|
4
|
+
export declare type ImageDataType = {
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
compressed?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Supported Image Types
|
|
12
|
+
*/
|
|
13
|
+
export declare type ImageType = ImageBitmap | typeof Image | ImageDataType;
|
|
14
|
+
/**
|
|
15
|
+
* Image type string used to control or determine the type of images returned from ImageLoader
|
|
16
|
+
*/
|
|
17
|
+
export declare type ImageTypeEnum = 'imagebitmap' | 'image' | 'data';
|
|
18
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/category/image/image.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS,GAAG,WAAW,GAAG,OAAO,KAAK,GAAG,aAAa,CAAC;AAEnE;;GAEG;AACH,oBAAY,aAAa,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertMeshToColumnarTable = exports.convertMesh = void 0;
|
|
4
|
+
const mesh_to_arrow_table_1 = require("./mesh-to-arrow-table");
|
|
4
5
|
/**
|
|
5
6
|
* Convert a mesh to a specific shape
|
|
6
7
|
*/
|
|
@@ -10,11 +11,11 @@ function convertMesh(mesh, shape, options) {
|
|
|
10
11
|
return mesh;
|
|
11
12
|
case 'columnar-table':
|
|
12
13
|
return convertMeshToColumnarTable(mesh);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
case 'arrow-table':
|
|
15
|
+
return {
|
|
16
|
+
shape: 'arrow-table',
|
|
17
|
+
data: (0, mesh_to_arrow_table_1.convertMeshToArrowTable)(mesh)
|
|
18
|
+
};
|
|
18
19
|
default:
|
|
19
20
|
throw new Error(`Unsupported shape ${options?.shape}`);
|
|
20
21
|
}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { Table } from 'apache-arrow/Arrow.dom';
|
|
2
|
+
import type { Mesh } from './mesh-types';
|
|
3
|
+
/**
|
|
4
|
+
* * Convert a loaders.gl Mesh to an Apache Arrow Table
|
|
5
|
+
* @param mesh
|
|
6
|
+
* @param metadata
|
|
7
|
+
* @param batchSize
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function convertMeshToArrowTable(mesh: Mesh, batchSize?: number): Table;
|
|
1
11
|
//# sourceMappingURL=mesh-to-arrow-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-to-arrow-table.d.ts","sourceRoot":"","sources":["../../../src/category/mesh/mesh-to-arrow-table.ts"],"names":[],"mappings":""}
|
|
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"}
|
|
@@ -1,44 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
FixedSizeList,
|
|
8
|
-
Field,
|
|
9
|
-
Data,
|
|
10
|
-
FixedSizeListVector
|
|
11
|
-
} from 'apache-arrow';
|
|
12
|
-
import {AbstractVector} from 'apache-arrow/vector';
|
|
13
|
-
import {getArrowType, getArrowVector} from '../../lib/arrow/arrow-type-utils';
|
|
14
|
-
import type {Mesh} from './mesh-types';
|
|
15
|
-
import {makeMeshAttributeMetadata} from './deduce-mesh-schema';
|
|
16
|
-
|
|
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");
|
|
17
7
|
/**
|
|
18
8
|
* * Convert a loaders.gl Mesh to an Apache Arrow Table
|
|
19
9
|
* @param mesh
|
|
20
10
|
* @param metadata
|
|
21
11
|
* @param batchSize
|
|
22
12
|
* @returns
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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;
|
|
43
33
|
}
|
|
44
|
-
|
|
34
|
+
exports.convertMeshToArrowTable = convertMeshToArrowTable;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Schema } from '../../lib/schema/schema';
|
|
2
|
+
import type { Table as ApacheArrowTable, RecordBatch } from 'apache-arrow/Arrow.dom';
|
|
2
3
|
import type { AnyArray } from '../../types';
|
|
3
4
|
import type { Batch } from '../common';
|
|
4
|
-
declare type ApacheArrowTable = any;
|
|
5
|
-
declare type RecordBatch = any;
|
|
6
5
|
/** A general table */
|
|
7
6
|
export interface Table {
|
|
8
7
|
shape: 'row-table' | 'array-row-table' | 'object-row-table' | 'columnar-table' | 'arrow-table';
|
|
@@ -38,6 +37,14 @@ export interface ArrowTable extends Table {
|
|
|
38
37
|
shape: 'arrow-table';
|
|
39
38
|
data: ApacheArrowTable;
|
|
40
39
|
}
|
|
40
|
+
/** A collection of tables */
|
|
41
|
+
export declare type Tables<TableType extends Table = Table> = {
|
|
42
|
+
shape: 'tables';
|
|
43
|
+
tables: {
|
|
44
|
+
name: string;
|
|
45
|
+
table: TableType;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
41
48
|
/** Batch for a general table */
|
|
42
49
|
export declare type TableBatch = Batch & {
|
|
43
50
|
data: any;
|
|
@@ -74,5 +81,4 @@ export declare type ArrowTableBatch = TableBatch & {
|
|
|
74
81
|
shape: 'arrow-table';
|
|
75
82
|
data: RecordBatch;
|
|
76
83
|
};
|
|
77
|
-
export {};
|
|
78
84
|
//# sourceMappingURL=table-types.d.ts.map
|
|
@@ -1 +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,
|
|
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,MAA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C,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,18 @@
|
|
|
1
|
+
import type { ImageType } from '../image/image';
|
|
2
|
+
/**
|
|
3
|
+
* These represent the main compressed texture formats
|
|
4
|
+
* Each format typically has a number of more specific subformats
|
|
5
|
+
*/
|
|
6
|
+
export declare type GPUTextureFormat = 'dxt' | 'dxt-srgb' | 'etc1' | 'etc2' | 'pvrtc' | 'atc' | 'astc' | 'rgtc';
|
|
7
|
+
/** One mip level */
|
|
8
|
+
export declare type TextureLevel = {
|
|
9
|
+
compressed: boolean;
|
|
10
|
+
format?: number;
|
|
11
|
+
data: Uint8Array;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
levelSize?: number;
|
|
15
|
+
hasAlpha?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare type TextureOrImage = ImageType | (TextureLevel | ImageType);
|
|
18
|
+
//# sourceMappingURL=texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/category/texture/texture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,oBAAY,gBAAgB,GACxB,KAAK,GACL,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,CAAC;AAEX,oBAAoB;AACpB,oBAAY,YAAY,GAAG;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,oBAAY,cAAc,GAAG,SAAS,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC"}
|