@loaders.gl/schema 3.1.0-alpha.4 → 3.1.0-alpha.5
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 +1 -0
- package/dist/category/common.d.ts +18 -0
- package/dist/category/gis.d.ts +50 -0
- package/dist/category/mesh/convert-mesh.d.ts +14 -0
- package/dist/category/mesh/deduce-mesh-schema.d.ts +23 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts +10 -0
- package/dist/category/mesh/mesh-types.d.ts +49 -0
- package/dist/category/mesh/mesh-utils.d.ts +22 -0
- package/dist/category/table/deduce-table-schema.d.ts +8 -0
- package/dist/category/table/table-types.d.ts +75 -0
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/category/mesh/convert-mesh.js +2 -10
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/deduce-mesh-schema.js +8 -8
- package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +18 -17
- 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 +52 -52
- package/dist/es5/lib/arrow/get-type-info.js +3 -3
- 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 +37 -37
- 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 -1
- package/dist/esm/category/mesh/convert-mesh.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/type.js +8 -8
- package/dist/esm/lib/schema/impl/type.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/lib/arrow/arrow-like-type-utils.d.ts +3 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts +5 -0
- package/dist/lib/arrow/get-type-info.d.ts +13 -0
- package/dist/lib/batches/base-table-batch-aggregator.d.ts +18 -0
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +22 -0
- package/dist/lib/batches/row-table-batch-aggregator.d.ts +21 -0
- package/dist/lib/batches/table-batch-aggregator.d.ts +24 -0
- package/dist/lib/batches/table-batch-builder.d.ts +52 -0
- package/dist/lib/schema/impl/enum.d.ts +91 -0
- package/dist/lib/schema/impl/field.d.ts +18 -0
- package/dist/lib/schema/impl/schema.d.ts +15 -0
- package/dist/lib/schema/impl/type.d.ts +175 -0
- package/dist/lib/schema/index.d.ts +4 -0
- package/dist/lib/schema-utils/deduce-column-type.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts +1 -0
- package/dist/lib/utils/async-queue.d.ts +17 -0
- package/dist/lib/utils/row-utils.d.ts +8 -0
- package/dist/types.d.ts +7 -0
- package/package.json +5 -5
- package/src/category/gis.ts +1 -0
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const moduleExports: any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RecordBatch } from 'apache-arrow';
|
|
2
|
+
export declare type Field = any;
|
|
3
|
+
export declare type Schema = {
|
|
4
|
+
[key: string]: Field;
|
|
5
|
+
};
|
|
6
|
+
export declare type Batch = {
|
|
7
|
+
batchType: 'data' | 'metadata' | 'partial-result' | 'final-result';
|
|
8
|
+
mimeType?: string;
|
|
9
|
+
shape: string;
|
|
10
|
+
data: any;
|
|
11
|
+
recordBatch?: RecordBatch;
|
|
12
|
+
length: number;
|
|
13
|
+
schema?: Schema;
|
|
14
|
+
bytesUsed?: number;
|
|
15
|
+
count?: number;
|
|
16
|
+
cursor?: number;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TypedArray } from '../types';
|
|
2
|
+
export type { GeoJSON, Feature, Geometry, Position, GeoJsonProperties } from 'geojson';
|
|
3
|
+
export type { Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon } from 'geojson';
|
|
4
|
+
export declare type BinaryAttribute = {
|
|
5
|
+
value: TypedArray;
|
|
6
|
+
size: number;
|
|
7
|
+
};
|
|
8
|
+
export declare type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon';
|
|
9
|
+
declare type NumericProps = {
|
|
10
|
+
[key: string]: BinaryAttribute;
|
|
11
|
+
};
|
|
12
|
+
declare type Properties = object[];
|
|
13
|
+
/**
|
|
14
|
+
* Represent a single Geometry, similar to a GeoJSON Geometry
|
|
15
|
+
*/
|
|
16
|
+
export declare type BinaryGeometry = BinaryPointGeometry | BinaryLineGeometry | BinaryPolygonGeometry;
|
|
17
|
+
export declare type BinaryPointGeometry = {
|
|
18
|
+
type: 'Point';
|
|
19
|
+
positions: BinaryAttribute;
|
|
20
|
+
};
|
|
21
|
+
export declare type BinaryLineGeometry = {
|
|
22
|
+
type: 'LineString';
|
|
23
|
+
positions: BinaryAttribute;
|
|
24
|
+
pathIndices: BinaryAttribute;
|
|
25
|
+
};
|
|
26
|
+
export declare type BinaryPolygonGeometry = {
|
|
27
|
+
type: 'Polygon';
|
|
28
|
+
positions: BinaryAttribute;
|
|
29
|
+
polygonIndices: BinaryAttribute;
|
|
30
|
+
primitivePolygonIndices: BinaryAttribute;
|
|
31
|
+
};
|
|
32
|
+
export declare type BinaryProperties = {
|
|
33
|
+
featureIds: BinaryAttribute;
|
|
34
|
+
globalFeatureIds: BinaryAttribute;
|
|
35
|
+
numericProps: NumericProps;
|
|
36
|
+
properties: Properties;
|
|
37
|
+
fields?: Properties;
|
|
38
|
+
};
|
|
39
|
+
export declare type BinaryPointFeatures = BinaryPointGeometry & BinaryProperties;
|
|
40
|
+
export declare type BinaryLineFeatures = BinaryLineGeometry & BinaryProperties;
|
|
41
|
+
export declare type BinaryPolygonFeatures = BinaryPolygonGeometry & BinaryProperties;
|
|
42
|
+
/**
|
|
43
|
+
* Represent a collection of Features, similar to a GeoJSON FeatureCollection
|
|
44
|
+
*/
|
|
45
|
+
export declare type BinaryFeatures = {
|
|
46
|
+
type?: BinaryGeometryType;
|
|
47
|
+
points?: BinaryPointFeatures;
|
|
48
|
+
lines?: BinaryLineFeatures;
|
|
49
|
+
polygons?: BinaryPolygonFeatures;
|
|
50
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Mesh } from './mesh-types';
|
|
2
|
+
import type { ColumnarTable, ArrowTable } from '../table/table-types';
|
|
3
|
+
declare type TargetShape = 'mesh' | 'columnar-table' | 'arrow-table';
|
|
4
|
+
/**
|
|
5
|
+
* Convert a mesh to a specific shape
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertMesh(mesh: Mesh, shape: TargetShape, options?: any): Mesh | ColumnarTable | ArrowTable;
|
|
8
|
+
/**
|
|
9
|
+
* Convert a loaders.gl Mesh to a Columnar Table
|
|
10
|
+
* @param mesh
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function convertMeshToColumnarTable(mesh: Mesh): ColumnarTable;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MeshAttribute, MeshAttributes } from './mesh-types';
|
|
2
|
+
import { Schema, Field } from '../../lib/schema';
|
|
3
|
+
/**
|
|
4
|
+
* Create a schema for mesh attributes data
|
|
5
|
+
* @param attributes
|
|
6
|
+
* @param metadata
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function deduceMeshSchema(attributes: MeshAttributes, metadata?: Map<string, string>): Schema;
|
|
10
|
+
/**
|
|
11
|
+
* Create arrow-like schema field for mesh attribute
|
|
12
|
+
* @param attributeName
|
|
13
|
+
* @param attribute
|
|
14
|
+
* @param optionalMetadata
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function deduceMeshField(attributeName: string, attribute: MeshAttribute, optionalMetadata?: Map<string, string>): Field;
|
|
18
|
+
/**
|
|
19
|
+
* Make metadata by mesh attribute properties
|
|
20
|
+
* @param attribute
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function makeMeshAttributeMetadata(attribute: MeshAttribute): Map<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Schema } from '../../lib/schema';
|
|
2
|
+
import type { TypedArray } from '../../types';
|
|
3
|
+
import type { ColumnarTable, ArrowTable } from '../table/table-types';
|
|
4
|
+
/** Mesh as columnar table */
|
|
5
|
+
export interface MeshTable extends ColumnarTable {
|
|
6
|
+
topology: 'point-list' | 'triangle-list' | 'triangle-strip';
|
|
7
|
+
indices?: MeshAttribute;
|
|
8
|
+
}
|
|
9
|
+
/** Mesh as arrow table */
|
|
10
|
+
export interface MeshArrowTable extends ArrowTable {
|
|
11
|
+
topology: 'point-list' | 'triangle-list' | 'triangle-strip';
|
|
12
|
+
indices?: MeshAttribute;
|
|
13
|
+
}
|
|
14
|
+
/** Geometry part of a Mesh (compatible with a standard luma.gl "mesh") */
|
|
15
|
+
export declare type MeshGeometry = {
|
|
16
|
+
attributes: {
|
|
17
|
+
[attributeName: string]: MeshAttribute;
|
|
18
|
+
};
|
|
19
|
+
indices?: MeshAttribute;
|
|
20
|
+
topology: 'point-list' | 'triangle-list' | 'triangle-strip';
|
|
21
|
+
mode: number;
|
|
22
|
+
};
|
|
23
|
+
/** Geometry and metadata for a Mesh (compatible with a standard luma.gl "mesh") */
|
|
24
|
+
export declare type Mesh = MeshGeometry & {
|
|
25
|
+
loader?: string;
|
|
26
|
+
loaderData?: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
header?: {
|
|
30
|
+
vertexCount: number;
|
|
31
|
+
boundingBox?: [number[], number[]];
|
|
32
|
+
};
|
|
33
|
+
schema: Schema;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* luma.gl compatible attribute descriptors
|
|
37
|
+
* Can be mapped to any WebGL framework
|
|
38
|
+
*/
|
|
39
|
+
export declare type MeshAttribute = {
|
|
40
|
+
value: TypedArray;
|
|
41
|
+
size: number;
|
|
42
|
+
byteOffset?: number;
|
|
43
|
+
byteStride?: number;
|
|
44
|
+
normalized?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/** A map of mesh attributes keyed by attribute names */
|
|
47
|
+
export declare type MeshAttributes = {
|
|
48
|
+
[attributeName: string]: MeshAttribute;
|
|
49
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TypedArray } from '../../types';
|
|
2
|
+
import { MeshAttributes } from './mesh-types';
|
|
3
|
+
declare type TypedArrays = {
|
|
4
|
+
[key: string]: TypedArray;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Holds an axis aligned bounding box
|
|
8
|
+
* TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)
|
|
9
|
+
*/
|
|
10
|
+
declare type BoundingBox = [[number, number, number], [number, number, number]];
|
|
11
|
+
/**
|
|
12
|
+
* Get number of vertices in mesh
|
|
13
|
+
* @param attributes
|
|
14
|
+
*/
|
|
15
|
+
export declare function getMeshSize(attributes: TypedArrays): number;
|
|
16
|
+
/**
|
|
17
|
+
* Get the (axis aligned) bounding box of a mesh
|
|
18
|
+
* @param attributes
|
|
19
|
+
* @returns array of two vectors representing the axis aligned bounding box
|
|
20
|
+
*/
|
|
21
|
+
export declare function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Schema } from '../../lib/schema';
|
|
2
|
+
import type { Table as ApacheArrowTable, RecordBatch } from 'apache-arrow/Arrow.dom';
|
|
3
|
+
import type { AnyArray } from '../../types';
|
|
4
|
+
import type { Batch } from '../common';
|
|
5
|
+
/** A general table */
|
|
6
|
+
export interface Table {
|
|
7
|
+
shape: 'row-table' | 'array-row-table' | 'object-row-table' | 'columnar-table' | 'arrow-table';
|
|
8
|
+
schema?: Schema;
|
|
9
|
+
schemaType?: 'explicit' | 'deduced';
|
|
10
|
+
}
|
|
11
|
+
/** A table organized as an array of rows */
|
|
12
|
+
export interface RowTable extends Table {
|
|
13
|
+
shape: 'row-table' | 'array-row-table' | 'object-row-table';
|
|
14
|
+
data: any[];
|
|
15
|
+
}
|
|
16
|
+
/** A table organized as an array of rows, each row is an array of values */
|
|
17
|
+
export interface ArrayRowTable extends RowTable {
|
|
18
|
+
shape: 'array-row-table';
|
|
19
|
+
data: any[][];
|
|
20
|
+
}
|
|
21
|
+
/** A table organized as an array of rows, each row is an object mapping columns to values */
|
|
22
|
+
export interface ObjectRowTable extends RowTable {
|
|
23
|
+
shape: 'object-row-table';
|
|
24
|
+
data: {
|
|
25
|
+
[columnName: string]: any;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
/** A table organized as a map of columns, each column is an array of value */
|
|
29
|
+
export interface ColumnarTable extends Table {
|
|
30
|
+
shape: 'columnar-table';
|
|
31
|
+
data: {
|
|
32
|
+
[columnName: string]: AnyArray;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** A table organized as an Apache Arrow table */
|
|
36
|
+
export interface ArrowTable extends Table {
|
|
37
|
+
shape: 'arrow-table';
|
|
38
|
+
data: ApacheArrowTable;
|
|
39
|
+
}
|
|
40
|
+
/** Batch for a general table */
|
|
41
|
+
export declare type TableBatch = Batch & {
|
|
42
|
+
data: any;
|
|
43
|
+
length: number;
|
|
44
|
+
schema?: Schema;
|
|
45
|
+
schemaType?: 'explicit' | 'deduced';
|
|
46
|
+
};
|
|
47
|
+
/** Batch for a table organized as an array of rows */
|
|
48
|
+
export declare type RowTableBatch = TableBatch & {
|
|
49
|
+
shape: 'row-table';
|
|
50
|
+
data: any[];
|
|
51
|
+
};
|
|
52
|
+
/** Batch for a table organized as an array of rows, each row is an array of values */
|
|
53
|
+
export declare type RowArrayTableBatch = RowTableBatch & {
|
|
54
|
+
shape: 'array-row-table';
|
|
55
|
+
data: any[][];
|
|
56
|
+
};
|
|
57
|
+
/** Batch for a table organized as an array of rows, each row is an object mapping columns to values */
|
|
58
|
+
export declare type RowObjectTableBatch = RowTableBatch & {
|
|
59
|
+
shape: 'object-row-table';
|
|
60
|
+
data: {
|
|
61
|
+
[columnName: string]: any;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
/** Batch for a table organized as a map of columns, each column is an array of value */
|
|
65
|
+
export declare type ColumnarTableBatch = TableBatch & {
|
|
66
|
+
shape: 'columnar-table';
|
|
67
|
+
data: {
|
|
68
|
+
[columnName: string]: AnyArray;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** Batch for a table organized as an Apache Arrow table */
|
|
72
|
+
export declare type ArrowTableBatch = TableBatch & {
|
|
73
|
+
shape: 'arrow-table';
|
|
74
|
+
data: RecordBatch;
|
|
75
|
+
};
|