@loaders.gl/arrow 4.0.0 → 4.0.2
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/arrow-loader.d.ts.map +1 -1
- package/dist/arrow-loader.js.map +1 -1
- package/dist/arrow-worker.js +34 -26
- package/dist/arrow-writer.d.ts.map +1 -1
- package/dist/arrow-writer.js +6 -3
- package/dist/arrow-writer.js.map +1 -1
- package/dist/dist.dev.js +658 -6
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.d.ts +40 -0
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +1 -0
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js +189 -0
- package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js.map +1 -0
- package/dist/geoarrow/convert-geoarrow-to-geojson.d.ts +19 -0
- package/dist/geoarrow/convert-geoarrow-to-geojson.d.ts.map +1 -0
- package/dist/geoarrow/convert-geoarrow-to-geojson.js +138 -0
- package/dist/geoarrow/convert-geoarrow-to-geojson.js.map +1 -0
- package/dist/geoarrow/get-arrow-bounds.d.ts +11 -0
- package/dist/geoarrow/get-arrow-bounds.d.ts.map +1 -0
- package/dist/geoarrow/get-arrow-bounds.js +24 -0
- package/dist/geoarrow/get-arrow-bounds.js.map +1 -0
- package/dist/index.cjs +627 -32
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/arrow-table-batch.d.ts +2 -2
- package/dist/lib/arrow-table-batch.d.ts.map +1 -1
- package/dist/lib/arrow-table-batch.js +7 -7
- package/dist/lib/arrow-table-batch.js.map +1 -1
- package/dist/lib/arrow-table.d.ts +3 -3
- package/dist/lib/arrow-table.d.ts.map +1 -1
- package/dist/lib/arrow-table.js.map +1 -1
- package/dist/lib/encode-arrow.js +5 -5
- package/dist/lib/encode-arrow.js.map +1 -1
- package/dist/lib/parse-arrow-in-batches.js +3 -3
- package/dist/lib/parse-arrow-in-batches.js.map +1 -1
- package/dist/lib/parse-arrow-sync.d.ts.map +1 -1
- package/dist/lib/parse-arrow-sync.js +3 -3
- package/dist/lib/parse-arrow-sync.js.map +1 -1
- package/dist/schema/arrow-type-utils.d.ts +3 -2
- package/dist/schema/arrow-type-utils.d.ts.map +1 -1
- package/dist/schema/arrow-type-utils.js +9 -9
- package/dist/schema/arrow-type-utils.js.map +1 -1
- package/dist/schema/convert-arrow-schema.d.ts +19 -0
- package/dist/schema/convert-arrow-schema.d.ts.map +1 -0
- package/dist/schema/convert-arrow-schema.js +232 -0
- package/dist/schema/convert-arrow-schema.js.map +1 -0
- package/dist/{lib/convert-table.d.ts → tables/convert-arrow-to-table.d.ts} +4 -4
- package/dist/tables/convert-arrow-to-table.d.ts.map +1 -0
- package/dist/{lib/convert-table.js → tables/convert-arrow-to-table.js} +1 -1
- package/dist/tables/convert-arrow-to-table.js.map +1 -0
- package/dist/{schema → tables}/convert-table-to-arrow.d.ts.map +1 -1
- package/dist/{schema → tables}/convert-table-to-arrow.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/workers/arrow-worker.js.map +1 -1
- package/package.json +5 -4
- package/src/arrow-loader.ts +1 -0
- package/src/arrow-writer.ts +7 -3
- package/src/geoarrow/convert-geoarrow-to-binary-geometry.ts +260 -0
- package/src/geoarrow/convert-geoarrow-to-geojson.ts +192 -0
- package/src/geoarrow/get-arrow-bounds.ts +40 -0
- package/src/index.ts +33 -4
- package/src/lib/arrow-table-batch.ts +13 -23
- package/src/lib/arrow-table.ts +3 -3
- package/src/lib/encode-arrow.ts +8 -8
- package/src/lib/parse-arrow-in-batches.ts +4 -4
- package/src/lib/parse-arrow-sync.ts +6 -3
- package/src/schema/arrow-type-utils.ts +11 -29
- package/src/schema/convert-arrow-schema.ts +265 -0
- package/src/{lib/convert-table.ts → tables/convert-arrow-to-table.ts} +4 -3
- package/src/types.ts +3 -0
- package/src/workers/arrow-worker.ts +3 -0
- package/dist/lib/convert-table.d.ts.map +0 -1
- package/dist/lib/convert-table.js.map +0 -1
- package/dist/schema/convert-schema-arrow.d.ts +0 -13
- package/dist/schema/convert-schema-arrow.d.ts.map +0 -1
- package/dist/schema/convert-schema-arrow.js +0 -158
- package/dist/schema/convert-schema-arrow.js.map +0 -1
- package/src/schema/convert-schema-arrow.ts +0 -233
- /package/dist/{schema → tables}/convert-table-to-arrow.d.ts +0 -0
- /package/dist/{schema → tables}/convert-table-to-arrow.js +0 -0
- /package/src/{schema → tables}/convert-table-to-arrow.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arrow-loader.d.ts","sourceRoot":"","sources":["../src/arrow-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAMlD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,WAAW,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;KAChG,CAAC;CACH,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAoBrE,CAAC"}
|
package/dist/arrow-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-loader.js","names":["VERSION","__VERSION__","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape"],"sources":["../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from './lib/arrow-table';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"arrow-loader.js","names":["VERSION","__VERSION__","ArrowLoader","name","id","module","version","category","extensions","mimeTypes","binary","tests","options","arrow","shape"],"sources":["../src/arrow-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ArrowTable} from './lib/arrow-table';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type ArrowLoaderOptions = LoaderOptions & {\n arrow?: {\n shape: 'arrow-table' | 'columnar-table' | 'row-table' | 'array-row-table' | 'object-row-table';\n };\n};\n\n/** ArrowJS table loader */\nexport const ArrowLoader: Loader<ArrowTable, never, ArrowLoaderOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n // worker: true,\n category: 'table',\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n tests: ['ARROW'],\n options: {\n arrow: {\n shape: 'columnar-table'\n }\n }\n};\n"],"mappings":"AAQA,MAAMA,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAS3E,OAAO,MAAMC,WAA0D,GAAG;EACxEC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEN,OAAO;EAEhBO,QAAQ,EAAE,OAAO;EACjBC,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,KAAK,EAAE,CAAC,OAAO,CAAC;EAChBC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE;IACT;EACF;AACF,CAAC"}
|
package/dist/arrow-worker.js
CHANGED
|
@@ -42,61 +42,69 @@
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// ../worker-utils/src/lib/worker-farm/worker-body.ts
|
|
45
|
-
function getParentPort() {
|
|
45
|
+
async function getParentPort() {
|
|
46
46
|
let parentPort;
|
|
47
47
|
try {
|
|
48
48
|
eval("globalThis.parentPort = require('worker_threads').parentPort");
|
|
49
49
|
parentPort = globalThis.parentPort;
|
|
50
50
|
} catch {
|
|
51
|
+
try {
|
|
52
|
+
eval("globalThis.workerThreadsPromise = import('worker_threads')");
|
|
53
|
+
const workerThreads = await globalThis.workerThreadsPromise;
|
|
54
|
+
parentPort = workerThreads.parentPort;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(error.message);
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
59
|
return parentPort;
|
|
53
60
|
}
|
|
54
61
|
var onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
55
62
|
var WorkerBody = class {
|
|
56
63
|
/** Check that we are actually in a worker thread */
|
|
57
|
-
static inWorkerThread() {
|
|
58
|
-
return typeof self !== "undefined" || Boolean(getParentPort());
|
|
64
|
+
static async inWorkerThread() {
|
|
65
|
+
return typeof self !== "undefined" || Boolean(await getParentPort());
|
|
59
66
|
}
|
|
60
67
|
/*
|
|
61
68
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
62
69
|
*/
|
|
63
70
|
static set onmessage(onMessage) {
|
|
64
|
-
function handleMessage(message) {
|
|
65
|
-
const
|
|
66
|
-
const { type, payload } =
|
|
71
|
+
async function handleMessage(message) {
|
|
72
|
+
const parentPort2 = await getParentPort();
|
|
73
|
+
const { type, payload } = parentPort2 ? message : message.data;
|
|
67
74
|
onMessage(type, payload);
|
|
68
75
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
getParentPort().then((parentPort2) => {
|
|
77
|
+
if (parentPort2) {
|
|
78
|
+
parentPort2.on("message", handleMessage);
|
|
79
|
+
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
80
|
+
} else {
|
|
81
|
+
globalThis.onmessage = handleMessage;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
76
84
|
}
|
|
77
|
-
static addEventListener(onMessage) {
|
|
85
|
+
static async addEventListener(onMessage) {
|
|
78
86
|
let onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
79
87
|
if (!onMessageWrapper) {
|
|
80
|
-
onMessageWrapper = (message) => {
|
|
88
|
+
onMessageWrapper = async (message) => {
|
|
81
89
|
if (!isKnownMessage(message)) {
|
|
82
90
|
return;
|
|
83
91
|
}
|
|
84
|
-
const parentPort3 = getParentPort();
|
|
92
|
+
const parentPort3 = await getParentPort();
|
|
85
93
|
const { type, payload } = parentPort3 ? message : message.data;
|
|
86
94
|
onMessage(type, payload);
|
|
87
95
|
};
|
|
88
96
|
}
|
|
89
|
-
const parentPort2 = getParentPort();
|
|
97
|
+
const parentPort2 = await getParentPort();
|
|
90
98
|
if (parentPort2) {
|
|
91
99
|
console.error("not implemented");
|
|
92
100
|
} else {
|
|
93
101
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
94
102
|
}
|
|
95
103
|
}
|
|
96
|
-
static removeEventListener(onMessage) {
|
|
104
|
+
static async removeEventListener(onMessage) {
|
|
97
105
|
const onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
98
106
|
onMessageWrapperMap.delete(onMessage);
|
|
99
|
-
const parentPort2 = getParentPort();
|
|
107
|
+
const parentPort2 = await getParentPort();
|
|
100
108
|
if (parentPort2) {
|
|
101
109
|
console.error("not implemented");
|
|
102
110
|
} else {
|
|
@@ -108,10 +116,10 @@
|
|
|
108
116
|
* @param type
|
|
109
117
|
* @param payload
|
|
110
118
|
*/
|
|
111
|
-
static postMessage(type, payload) {
|
|
119
|
+
static async postMessage(type, payload) {
|
|
112
120
|
const data = { source: "loaders.gl", type, payload };
|
|
113
121
|
const transferList = getTransferList(payload);
|
|
114
|
-
const parentPort2 = getParentPort();
|
|
122
|
+
const parentPort2 = await getParentPort();
|
|
115
123
|
if (parentPort2) {
|
|
116
124
|
parentPort2.postMessage(data, transferList);
|
|
117
125
|
} else {
|
|
@@ -126,8 +134,8 @@
|
|
|
126
134
|
|
|
127
135
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
128
136
|
var requestId = 0;
|
|
129
|
-
function createLoaderWorker(loader) {
|
|
130
|
-
if (!WorkerBody.inWorkerThread()) {
|
|
137
|
+
async function createLoaderWorker(loader) {
|
|
138
|
+
if (!await WorkerBody.inWorkerThread()) {
|
|
131
139
|
return;
|
|
132
140
|
}
|
|
133
141
|
WorkerBody.onmessage = async (type, payload) => {
|
|
@@ -886,7 +894,7 @@
|
|
|
886
894
|
}
|
|
887
895
|
}
|
|
888
896
|
function makeArrowTable(table) {
|
|
889
|
-
const _makeArrowTable = globalThis.
|
|
897
|
+
const _makeArrowTable = globalThis.__loaders?._makeArrowTable;
|
|
890
898
|
if (!_makeArrowTable) {
|
|
891
899
|
throw new Error("");
|
|
892
900
|
}
|
|
@@ -945,7 +953,7 @@
|
|
|
945
953
|
}
|
|
946
954
|
|
|
947
955
|
// src/arrow-loader.ts
|
|
948
|
-
var VERSION = true ? "4.0.
|
|
956
|
+
var VERSION = true ? "4.0.2" : "latest";
|
|
949
957
|
var ArrowLoader = {
|
|
950
958
|
name: "Apache Arrow",
|
|
951
959
|
id: "arrow",
|
|
@@ -12334,7 +12342,7 @@ return true;`);
|
|
|
12334
12342
|
RecordBatchFileWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
|
|
12335
12343
|
RecordBatchStreamWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
|
|
12336
12344
|
|
|
12337
|
-
// src/
|
|
12345
|
+
// src/tables/convert-arrow-to-table.ts
|
|
12338
12346
|
function convertApacheArrowToArrowTable(arrowTable) {
|
|
12339
12347
|
return {
|
|
12340
12348
|
shape: "arrow-table",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-writer.d.ts","sourceRoot":"","sources":["../src/arrow-writer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arrow-writer.d.ts","sourceRoot":"","sources":["../src/arrow-writer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAOjD,KAAK,kBAAkB,GAAG,aAAa,GAAG;IACxC,KAAK,CAAC,EAAE,EAAE,CAAC;CACZ,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,kBAAkB,CAmBxE,CAAC"}
|
package/dist/arrow-writer.js
CHANGED
|
@@ -7,10 +7,13 @@ export const ArrowWriter = {
|
|
|
7
7
|
version: VERSION,
|
|
8
8
|
extensions: ['arrow', 'feather'],
|
|
9
9
|
mimeTypes: ['application/vnd.apache.arrow.file', 'application/vnd.apache.arrow.stream', 'application/octet-stream'],
|
|
10
|
-
|
|
10
|
+
binary: true,
|
|
11
|
+
options: {},
|
|
12
|
+
encode: async function encodeArrow(data, options) {
|
|
11
13
|
return encodeArrowSync(data);
|
|
12
14
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
encodeSync(data, options) {
|
|
16
|
+
return encodeArrowSync(data);
|
|
17
|
+
}
|
|
15
18
|
};
|
|
16
19
|
//# sourceMappingURL=arrow-writer.js.map
|
package/dist/arrow-writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-writer.js","names":["encodeArrowSync","VERSION","__VERSION__","ArrowWriter","name","id","module","version","extensions","mimeTypes","
|
|
1
|
+
{"version":3,"file":"arrow-writer.js","names":["encodeArrowSync","VERSION","__VERSION__","ArrowWriter","name","id","module","version","extensions","mimeTypes","binary","options","encode","encodeArrow","data","encodeSync"],"sources":["../src/arrow-writer.ts"],"sourcesContent":["// import type {} from '@loaders.gl/loader-utils';\n\nimport type {Writer, WriterOptions} from '@loaders.gl/loader-utils';\nimport {ColumnarTable} from './lib/encode-arrow';\nimport {encodeArrowSync} from './lib/encode-arrow';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\ntype ArrowWriterOptions = WriterOptions & {\n arrow?: {};\n};\n\n/** Apache Arrow writer */\nexport const ArrowWriter: Writer<ColumnarTable, never, ArrowWriterOptions> = {\n name: 'Apache Arrow',\n id: 'arrow',\n module: 'arrow',\n version: VERSION,\n extensions: ['arrow', 'feather'],\n mimeTypes: [\n 'application/vnd.apache.arrow.file',\n 'application/vnd.apache.arrow.stream',\n 'application/octet-stream'\n ],\n binary: true,\n options: {},\n encode: async function encodeArrow(data, options?): Promise<ArrayBuffer> {\n return encodeArrowSync(data);\n },\n encodeSync(data, options?) {\n return encodeArrowSync(data);\n }\n};\n"],"mappings":"SAIQA,eAAe;AAIvB,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAO3E,OAAO,MAAMC,WAA6D,GAAG;EAC3EC,IAAI,EAAE,cAAc;EACpBC,EAAE,EAAE,OAAO;EACXC,MAAM,EAAE,OAAO;EACfC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;EAChCC,SAAS,EAAE,CACT,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,CAC3B;EACDC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,eAAeC,WAAWA,CAACC,IAAI,EAAEH,OAAQ,EAAwB;IACvE,OAAOX,eAAe,CAACc,IAAI,CAAC;EAC9B,CAAC;EACDC,UAAUA,CAACD,IAAI,EAAEH,OAAQ,EAAE;IACzB,OAAOX,eAAe,CAACc,IAAI,CAAC;EAC9B;AACF,CAAC"}
|