@loaders.gl/json 4.2.0-alpha.5 → 4.2.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.
- package/dist/dist.dev.js +126 -99
- package/dist/dist.min.js +8 -8
- package/dist/geojson-loader.d.ts +58 -4
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +3 -1
- package/dist/geojson-worker.js +126 -100
- package/dist/geojson-writer.d.ts +18 -2
- package/dist/geojson-writer.d.ts.map +1 -1
- package/dist/index.cjs +45 -31
- package/dist/index.cjs.map +2 -2
- package/dist/json-loader.d.ts +3 -3
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-loader.js +3 -1
- package/dist/json-writer.d.ts +14 -3
- package/dist/json-writer.d.ts.map +1 -1
- package/dist/lib/clarinet/clarinet.js +22 -20
- package/dist/lib/encoder-utils/utf8-encoder.js +4 -3
- package/dist/lib/json-parser/json-parser.js +5 -4
- package/dist/lib/json-parser/streaming-json-parser.js +4 -3
- package/dist/lib/jsonpath/jsonpath.js +1 -0
- package/dist/ndgeoson-loader.d.ts +26 -2
- package/dist/ndgeoson-loader.d.ts.map +1 -1
- package/dist/ndgeoson-loader.js +3 -1
- package/dist/ndjson-loader.d.ts +18 -2
- package/dist/ndjson-loader.d.ts.map +1 -1
- package/dist/ndjson-loader.js +3 -1
- package/package.json +5 -5
- package/src/geojson-loader.ts +7 -4
- package/src/geojson-writer.ts +2 -2
- package/src/json-loader.ts +9 -6
- package/src/json-writer.ts +2 -2
- package/src/ndgeoson-loader.ts +9 -6
- package/src/ndjson-loader.ts +5 -6
package/dist/geojson-loader.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { GeoJSON, TableBatch } from '@loaders.gl/schema';
|
|
1
|
+
import type { GeoJSON, GeoJSONTable, TableBatch } from '@loaders.gl/schema';
|
|
3
2
|
import type { JSONLoaderOptions } from "./json-loader.js";
|
|
4
3
|
export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
5
4
|
geojson?: {
|
|
@@ -12,6 +11,61 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
|
12
11
|
/**
|
|
13
12
|
* GeoJSON loader
|
|
14
13
|
*/
|
|
15
|
-
export declare const GeoJSONWorkerLoader:
|
|
16
|
-
|
|
14
|
+
export declare const GeoJSONWorkerLoader: {
|
|
15
|
+
readonly dataType: GeoJSON;
|
|
16
|
+
readonly batchType: TableBatch;
|
|
17
|
+
readonly name: "GeoJSON";
|
|
18
|
+
readonly id: "geojson";
|
|
19
|
+
readonly module: "geojson";
|
|
20
|
+
readonly version: any;
|
|
21
|
+
readonly worker: true;
|
|
22
|
+
readonly extensions: ["geojson"];
|
|
23
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
24
|
+
readonly category: "geometry";
|
|
25
|
+
readonly text: true;
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly geojson: {
|
|
28
|
+
readonly shape: "object-row-table";
|
|
29
|
+
};
|
|
30
|
+
readonly json: {
|
|
31
|
+
readonly shape: "object-row-table";
|
|
32
|
+
readonly jsonpaths: ["$", "$.features"];
|
|
33
|
+
};
|
|
34
|
+
readonly gis: {
|
|
35
|
+
readonly format: "geojson";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const GeoJSONLoader: {
|
|
40
|
+
readonly parse: typeof parse;
|
|
41
|
+
readonly parseTextSync: typeof parseTextSync;
|
|
42
|
+
readonly parseInBatches: typeof parseInBatches;
|
|
43
|
+
readonly dataType: GeoJSON;
|
|
44
|
+
readonly batchType: TableBatch;
|
|
45
|
+
readonly name: "GeoJSON";
|
|
46
|
+
readonly id: "geojson";
|
|
47
|
+
readonly module: "geojson";
|
|
48
|
+
readonly version: any;
|
|
49
|
+
readonly worker: true;
|
|
50
|
+
readonly extensions: ["geojson"];
|
|
51
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
52
|
+
readonly category: "geometry";
|
|
53
|
+
readonly text: true;
|
|
54
|
+
readonly options: {
|
|
55
|
+
readonly geojson: {
|
|
56
|
+
readonly shape: "object-row-table";
|
|
57
|
+
};
|
|
58
|
+
readonly json: {
|
|
59
|
+
readonly shape: "object-row-table";
|
|
60
|
+
readonly jsonpaths: ["$", "$.features"];
|
|
61
|
+
};
|
|
62
|
+
readonly gis: {
|
|
63
|
+
readonly format: "geojson";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions): Promise<GeoJSONTable | import("@loaders.gl/schema").BinaryFeatureCollection>;
|
|
68
|
+
declare function parseTextSync(text: string, options?: GeoJSONLoaderOptions): GeoJSONTable | import("@loaders.gl/schema").BinaryFeatureCollection;
|
|
69
|
+
declare function parseInBatches(asyncIterator: any, options: any): AsyncIterable<TableBatch>;
|
|
70
|
+
export {};
|
|
17
71
|
//# sourceMappingURL=geojson-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,iBAAiB,EAAC,yBAAsB;AASrD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;CAyBsC,CAAC;AAEvE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOsD,CAAC;AAEjF,iBAAe,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,gFAE5E;AAED,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,uEA2BlE;AAED,iBAAS,cAAc,CAAC,aAAa,KAAA,EAAE,OAAO,KAAA,GAAG,aAAa,CAAC,UAAU,CAAC,CAazE"}
|
package/dist/geojson-loader.js
CHANGED
|
@@ -6,11 +6,13 @@ import { geojsonToBinary } from '@loaders.gl/gis';
|
|
|
6
6
|
import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
|
|
7
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
9
|
+
const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
|
|
10
10
|
/**
|
|
11
11
|
* GeoJSON loader
|
|
12
12
|
*/
|
|
13
13
|
export const GeoJSONWorkerLoader = {
|
|
14
|
+
dataType: null,
|
|
15
|
+
batchType: null,
|
|
14
16
|
name: 'GeoJSON',
|
|
15
17
|
id: 'geojson',
|
|
16
18
|
module: 'geojson',
|
package/dist/geojson-worker.js
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => {
|
|
6
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
return value;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
11
|
+
function _typeof(obj) {
|
|
12
|
+
"@babel/helpers - typeof";
|
|
13
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
14
|
+
return typeof obj2;
|
|
15
|
+
} : function(obj2) {
|
|
16
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
17
|
+
}, _typeof(obj);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
21
|
+
function _toPrimitive(input, hint) {
|
|
22
|
+
if (_typeof(input) !== "object" || input === null)
|
|
23
|
+
return input;
|
|
24
|
+
var prim = input[Symbol.toPrimitive];
|
|
25
|
+
if (prim !== void 0) {
|
|
26
|
+
var res = prim.call(input, hint || "default");
|
|
27
|
+
if (_typeof(res) !== "object")
|
|
28
|
+
return res;
|
|
29
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
30
|
+
}
|
|
31
|
+
return (hint === "string" ? String : Number)(input);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
35
|
+
function _toPropertyKey(arg) {
|
|
36
|
+
var key = _toPrimitive(arg, "string");
|
|
37
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
41
|
+
function _defineProperty(obj, key, value) {
|
|
42
|
+
key = _toPropertyKey(key);
|
|
43
|
+
if (key in obj) {
|
|
44
|
+
Object.defineProperty(obj, key, {
|
|
45
|
+
value,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
obj[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
|
|
3
56
|
// ../worker-utils/src/lib/node/worker_threads-browser.ts
|
|
4
57
|
var parentPort = null;
|
|
5
58
|
|
|
@@ -59,7 +112,9 @@
|
|
|
59
112
|
}
|
|
60
113
|
getParentPort().then((parentPort2) => {
|
|
61
114
|
if (parentPort2) {
|
|
62
|
-
parentPort2.on("message",
|
|
115
|
+
parentPort2.on("message", (message) => {
|
|
116
|
+
handleMessage(message);
|
|
117
|
+
});
|
|
63
118
|
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
64
119
|
} else {
|
|
65
120
|
globalThis.onmessage = handleMessage;
|
|
@@ -205,60 +260,17 @@
|
|
|
205
260
|
}
|
|
206
261
|
}
|
|
207
262
|
|
|
208
|
-
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
209
|
-
function _typeof(obj) {
|
|
210
|
-
"@babel/helpers - typeof";
|
|
211
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
212
|
-
return typeof obj2;
|
|
213
|
-
} : function(obj2) {
|
|
214
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
215
|
-
}, _typeof(obj);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
219
|
-
function _toPrimitive(input, hint) {
|
|
220
|
-
if (_typeof(input) !== "object" || input === null)
|
|
221
|
-
return input;
|
|
222
|
-
var prim = input[Symbol.toPrimitive];
|
|
223
|
-
if (prim !== void 0) {
|
|
224
|
-
var res = prim.call(input, hint || "default");
|
|
225
|
-
if (_typeof(res) !== "object")
|
|
226
|
-
return res;
|
|
227
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
228
|
-
}
|
|
229
|
-
return (hint === "string" ? String : Number)(input);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
233
|
-
function _toPropertyKey(arg) {
|
|
234
|
-
var key = _toPrimitive(arg, "string");
|
|
235
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
239
|
-
function _defineProperty(obj, key, value) {
|
|
240
|
-
key = _toPropertyKey(key);
|
|
241
|
-
if (key in obj) {
|
|
242
|
-
Object.defineProperty(obj, key, {
|
|
243
|
-
value,
|
|
244
|
-
enumerable: true,
|
|
245
|
-
configurable: true,
|
|
246
|
-
writable: true
|
|
247
|
-
});
|
|
248
|
-
} else {
|
|
249
|
-
obj[key] = value;
|
|
250
|
-
}
|
|
251
|
-
return obj;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
263
|
// ../schema/src/lib/table/batches/base-table-batch-aggregator.ts
|
|
255
264
|
var DEFAULT_ROW_COUNT = 100;
|
|
256
265
|
var BaseTableBatchAggregator = class {
|
|
266
|
+
schema;
|
|
267
|
+
options;
|
|
268
|
+
shape;
|
|
269
|
+
length = 0;
|
|
270
|
+
rows = null;
|
|
271
|
+
cursor = 0;
|
|
272
|
+
_headers = [];
|
|
257
273
|
constructor(schema, options) {
|
|
258
|
-
this.length = 0;
|
|
259
|
-
this.rows = null;
|
|
260
|
-
this.cursor = 0;
|
|
261
|
-
this._headers = [];
|
|
262
274
|
this.options = options;
|
|
263
275
|
this.schema = schema;
|
|
264
276
|
if (!Array.isArray(schema)) {
|
|
@@ -354,12 +366,14 @@
|
|
|
354
366
|
// ../schema/src/lib/table/batches/row-table-batch-aggregator.ts
|
|
355
367
|
var DEFAULT_ROW_COUNT2 = 100;
|
|
356
368
|
var RowTableBatchAggregator = class {
|
|
369
|
+
schema;
|
|
370
|
+
options;
|
|
371
|
+
length = 0;
|
|
372
|
+
objectRows = null;
|
|
373
|
+
arrayRows = null;
|
|
374
|
+
cursor = 0;
|
|
375
|
+
_headers = null;
|
|
357
376
|
constructor(schema, options) {
|
|
358
|
-
this.length = 0;
|
|
359
|
-
this.objectRows = null;
|
|
360
|
-
this.arrayRows = null;
|
|
361
|
-
this.cursor = 0;
|
|
362
|
-
this._headers = null;
|
|
363
377
|
this.options = options;
|
|
364
378
|
this.schema = schema;
|
|
365
379
|
if (schema) {
|
|
@@ -376,7 +390,7 @@
|
|
|
376
390
|
if (Number.isFinite(cursor)) {
|
|
377
391
|
this.cursor = cursor;
|
|
378
392
|
}
|
|
379
|
-
this._headers
|
|
393
|
+
this._headers ||= inferHeadersFromArrayRow(row);
|
|
380
394
|
switch (this.options.shape) {
|
|
381
395
|
case "object-row-table":
|
|
382
396
|
const rowObject = convertToObjectRow(row, this._headers);
|
|
@@ -393,7 +407,7 @@
|
|
|
393
407
|
if (Number.isFinite(cursor)) {
|
|
394
408
|
this.cursor = cursor;
|
|
395
409
|
}
|
|
396
|
-
this._headers
|
|
410
|
+
this._headers ||= inferHeadersFromObjectRow(row);
|
|
397
411
|
switch (this.options.shape) {
|
|
398
412
|
case "array-row-table":
|
|
399
413
|
const rowArray = convertToArrayRow(row, this._headers);
|
|
@@ -429,10 +443,11 @@
|
|
|
429
443
|
// ../schema/src/lib/table/batches/columnar-table-batch-aggregator.ts
|
|
430
444
|
var DEFAULT_ROW_COUNT3 = 100;
|
|
431
445
|
var ColumnarTableBatchAggregator = class {
|
|
446
|
+
schema;
|
|
447
|
+
length = 0;
|
|
448
|
+
allocated = 0;
|
|
449
|
+
columns = {};
|
|
432
450
|
constructor(schema, options) {
|
|
433
|
-
this.length = 0;
|
|
434
|
-
this.allocated = 0;
|
|
435
|
-
this.columns = {};
|
|
436
451
|
this.schema = schema;
|
|
437
452
|
this._reallocateColumns();
|
|
438
453
|
}
|
|
@@ -512,16 +527,18 @@
|
|
|
512
527
|
_limitMB: 0
|
|
513
528
|
};
|
|
514
529
|
var ERR_MESSAGE = "TableBatchBuilder";
|
|
515
|
-
var
|
|
530
|
+
var _TableBatchBuilder = class {
|
|
531
|
+
schema;
|
|
532
|
+
options;
|
|
533
|
+
aggregator = null;
|
|
534
|
+
batchCount = 0;
|
|
535
|
+
bytesUsed = 0;
|
|
536
|
+
isChunkComplete = false;
|
|
537
|
+
lastBatchEmittedMs = Date.now();
|
|
538
|
+
totalLength = 0;
|
|
539
|
+
totalBytes = 0;
|
|
540
|
+
rowBytes = 0;
|
|
516
541
|
constructor(schema, options) {
|
|
517
|
-
this.aggregator = null;
|
|
518
|
-
this.batchCount = 0;
|
|
519
|
-
this.bytesUsed = 0;
|
|
520
|
-
this.isChunkComplete = false;
|
|
521
|
-
this.lastBatchEmittedMs = Date.now();
|
|
522
|
-
this.totalLength = 0;
|
|
523
|
-
this.totalBytes = 0;
|
|
524
|
-
this.rowBytes = 0;
|
|
525
542
|
this.schema = schema;
|
|
526
543
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
527
544
|
}
|
|
@@ -628,15 +645,17 @@
|
|
|
628
645
|
case "columnar-table":
|
|
629
646
|
return ColumnarTableBatchAggregator;
|
|
630
647
|
case "arrow-table":
|
|
631
|
-
if (!
|
|
648
|
+
if (!_TableBatchBuilder.ArrowBatch) {
|
|
632
649
|
throw new Error(ERR_MESSAGE);
|
|
633
650
|
}
|
|
634
|
-
return
|
|
651
|
+
return _TableBatchBuilder.ArrowBatch;
|
|
635
652
|
default:
|
|
636
653
|
return BaseTableBatchAggregator;
|
|
637
654
|
}
|
|
638
655
|
}
|
|
639
656
|
};
|
|
657
|
+
var TableBatchBuilder = _TableBatchBuilder;
|
|
658
|
+
__publicField(TableBatchBuilder, "ArrowBatch");
|
|
640
659
|
|
|
641
660
|
// ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
|
|
642
661
|
var DimIndex = {
|
|
@@ -1704,27 +1723,29 @@
|
|
|
1704
1723
|
}
|
|
1705
1724
|
};
|
|
1706
1725
|
var ClarinetParser = class {
|
|
1726
|
+
options = DEFAULT_OPTIONS2;
|
|
1727
|
+
bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
1728
|
+
q = "";
|
|
1729
|
+
c = "";
|
|
1730
|
+
p = "";
|
|
1731
|
+
closed = false;
|
|
1732
|
+
closedRoot = false;
|
|
1733
|
+
sawRoot = false;
|
|
1734
|
+
// tag = null;
|
|
1735
|
+
error = null;
|
|
1736
|
+
state = 0 /* BEGIN */;
|
|
1737
|
+
stack = [];
|
|
1738
|
+
// mostly just for error reporting
|
|
1739
|
+
position = 0;
|
|
1740
|
+
column = 0;
|
|
1741
|
+
line = 1;
|
|
1742
|
+
slashed = false;
|
|
1743
|
+
unicodeI = 0;
|
|
1744
|
+
unicodeS = null;
|
|
1745
|
+
depth = 0;
|
|
1746
|
+
textNode;
|
|
1747
|
+
numberNode;
|
|
1707
1748
|
constructor(options = {}) {
|
|
1708
|
-
this.options = DEFAULT_OPTIONS2;
|
|
1709
|
-
this.bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
1710
|
-
this.q = "";
|
|
1711
|
-
this.c = "";
|
|
1712
|
-
this.p = "";
|
|
1713
|
-
this.closed = false;
|
|
1714
|
-
this.closedRoot = false;
|
|
1715
|
-
this.sawRoot = false;
|
|
1716
|
-
// tag = null;
|
|
1717
|
-
this.error = null;
|
|
1718
|
-
this.state = 0 /* BEGIN */;
|
|
1719
|
-
this.stack = [];
|
|
1720
|
-
// mostly just for error reporting
|
|
1721
|
-
this.position = 0;
|
|
1722
|
-
this.column = 0;
|
|
1723
|
-
this.line = 1;
|
|
1724
|
-
this.slashed = false;
|
|
1725
|
-
this.unicodeI = 0;
|
|
1726
|
-
this.unicodeS = null;
|
|
1727
|
-
this.depth = 0;
|
|
1728
1749
|
this.options = { ...DEFAULT_OPTIONS2, ...options };
|
|
1729
1750
|
this.textNode = void 0;
|
|
1730
1751
|
this.numberNode = "";
|
|
@@ -2119,6 +2140,7 @@ Char: ${this.c}`;
|
|
|
2119
2140
|
|
|
2120
2141
|
// src/lib/jsonpath/jsonpath.ts
|
|
2121
2142
|
var JSONPath = class {
|
|
2143
|
+
path;
|
|
2122
2144
|
constructor(path = null) {
|
|
2123
2145
|
this.path = ["$"];
|
|
2124
2146
|
if (path instanceof JSONPath) {
|
|
@@ -2195,11 +2217,12 @@ Char: ${this.c}`;
|
|
|
2195
2217
|
|
|
2196
2218
|
// src/lib/json-parser/json-parser.ts
|
|
2197
2219
|
var JSONParser = class {
|
|
2220
|
+
parser;
|
|
2221
|
+
result = void 0;
|
|
2222
|
+
previousStates = [];
|
|
2223
|
+
currentState = Object.freeze({ container: [], key: null });
|
|
2224
|
+
jsonpath = new JSONPath();
|
|
2198
2225
|
constructor(options) {
|
|
2199
|
-
this.result = void 0;
|
|
2200
|
-
this.previousStates = [];
|
|
2201
|
-
this.currentState = Object.freeze({ container: [], key: null });
|
|
2202
|
-
this.jsonpath = new JSONPath();
|
|
2203
2226
|
this.reset();
|
|
2204
2227
|
this.parser = new ClarinetParser({
|
|
2205
2228
|
onready: () => {
|
|
@@ -2284,6 +2307,10 @@ Char: ${this.c}`;
|
|
|
2284
2307
|
|
|
2285
2308
|
// src/lib/json-parser/streaming-json-parser.ts
|
|
2286
2309
|
var StreamingJSONParser = class extends JSONParser {
|
|
2310
|
+
jsonPaths;
|
|
2311
|
+
streamingJsonPath = null;
|
|
2312
|
+
streamingArray = null;
|
|
2313
|
+
topLevelObject = null;
|
|
2287
2314
|
constructor(options = {}) {
|
|
2288
2315
|
super({
|
|
2289
2316
|
onopenarray: () => {
|
|
@@ -2310,9 +2337,6 @@ Char: ${this.c}`;
|
|
|
2310
2337
|
}
|
|
2311
2338
|
}
|
|
2312
2339
|
});
|
|
2313
|
-
this.streamingJsonPath = null;
|
|
2314
|
-
this.streamingArray = null;
|
|
2315
|
-
this.topLevelObject = null;
|
|
2316
2340
|
const jsonpaths = options.jsonpaths || [];
|
|
2317
2341
|
this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));
|
|
2318
2342
|
}
|
|
@@ -2430,8 +2454,10 @@ Char: ${this.c}`;
|
|
|
2430
2454
|
}
|
|
2431
2455
|
|
|
2432
2456
|
// src/geojson-loader.ts
|
|
2433
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
2457
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
2434
2458
|
var GeoJSONWorkerLoader = {
|
|
2459
|
+
dataType: null,
|
|
2460
|
+
batchType: null,
|
|
2435
2461
|
name: "GeoJSON",
|
|
2436
2462
|
id: "geojson",
|
|
2437
2463
|
module: "geojson",
|
package/dist/geojson-writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { Table, TableBatch } from '@loaders.gl/schema';
|
|
3
3
|
export type GeoJSONWriterOptions = WriterOptions & {
|
|
4
4
|
geojson?: {
|
|
@@ -7,5 +7,21 @@ export type GeoJSONWriterOptions = WriterOptions & {
|
|
|
7
7
|
};
|
|
8
8
|
chunkSize?: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const GeoJSONWriter:
|
|
10
|
+
export declare const GeoJSONWriter: {
|
|
11
|
+
readonly id: "geojson";
|
|
12
|
+
readonly version: "latest";
|
|
13
|
+
readonly module: "geojson";
|
|
14
|
+
readonly name: "GeoJSON";
|
|
15
|
+
readonly extensions: ["geojson"];
|
|
16
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
17
|
+
readonly text: true;
|
|
18
|
+
readonly options: {
|
|
19
|
+
readonly geojson: {
|
|
20
|
+
readonly featureArray: false;
|
|
21
|
+
readonly geometryColumn: null;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly encode: (table: Table, options: GeoJSONWriterOptions) => Promise<ArrayBuffer>;
|
|
25
|
+
readonly encodeInBatches: (tableIterator: AsyncIterable<TableBatch> | Iterable<TableBatch>, options: GeoJSONWriterOptions | undefined) => AsyncIterable<ArrayBuffer>;
|
|
26
|
+
};
|
|
11
27
|
//# sourceMappingURL=geojson-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;6BAeJ,KAAK,WAAW,oBAAoB,KAAG,QAAQ,WAAW,CAAC;8CAM9C,cAAc,UAAU,CAAC,GAAG,SAAS,UAAU,CAAC;CAEJ,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -177,25 +177,29 @@ var DEFAULT_OPTIONS = {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
var ClarinetParser = class {
|
|
180
|
+
options = DEFAULT_OPTIONS;
|
|
181
|
+
bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
182
|
+
q = "";
|
|
183
|
+
c = "";
|
|
184
|
+
p = "";
|
|
185
|
+
closed = false;
|
|
186
|
+
closedRoot = false;
|
|
187
|
+
sawRoot = false;
|
|
188
|
+
// tag = null;
|
|
189
|
+
error = null;
|
|
190
|
+
state = STATE.BEGIN;
|
|
191
|
+
stack = [];
|
|
192
|
+
// mostly just for error reporting
|
|
193
|
+
position = 0;
|
|
194
|
+
column = 0;
|
|
195
|
+
line = 1;
|
|
196
|
+
slashed = false;
|
|
197
|
+
unicodeI = 0;
|
|
198
|
+
unicodeS = null;
|
|
199
|
+
depth = 0;
|
|
200
|
+
textNode;
|
|
201
|
+
numberNode;
|
|
180
202
|
constructor(options = {}) {
|
|
181
|
-
this.options = DEFAULT_OPTIONS;
|
|
182
|
-
this.bufferCheckPosition = MAX_BUFFER_LENGTH;
|
|
183
|
-
this.q = "";
|
|
184
|
-
this.c = "";
|
|
185
|
-
this.p = "";
|
|
186
|
-
this.closed = false;
|
|
187
|
-
this.closedRoot = false;
|
|
188
|
-
this.sawRoot = false;
|
|
189
|
-
this.error = null;
|
|
190
|
-
this.state = STATE.BEGIN;
|
|
191
|
-
this.stack = [];
|
|
192
|
-
this.position = 0;
|
|
193
|
-
this.column = 0;
|
|
194
|
-
this.line = 1;
|
|
195
|
-
this.slashed = false;
|
|
196
|
-
this.unicodeI = 0;
|
|
197
|
-
this.unicodeS = null;
|
|
198
|
-
this.depth = 0;
|
|
199
203
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
200
204
|
this.textNode = void 0;
|
|
201
205
|
this.numberNode = "";
|
|
@@ -591,6 +595,7 @@ function checkBufferLength(parser) {
|
|
|
591
595
|
|
|
592
596
|
// dist/lib/jsonpath/jsonpath.js
|
|
593
597
|
var JSONPath = class {
|
|
598
|
+
path;
|
|
594
599
|
constructor(path = null) {
|
|
595
600
|
this.path = ["$"];
|
|
596
601
|
if (path instanceof JSONPath) {
|
|
@@ -667,11 +672,12 @@ var JSONPath = class {
|
|
|
667
672
|
|
|
668
673
|
// dist/lib/json-parser/json-parser.js
|
|
669
674
|
var JSONParser = class {
|
|
675
|
+
parser;
|
|
676
|
+
result = void 0;
|
|
677
|
+
previousStates = [];
|
|
678
|
+
currentState = Object.freeze({ container: [], key: null });
|
|
679
|
+
jsonpath = new JSONPath();
|
|
670
680
|
constructor(options) {
|
|
671
|
-
this.result = void 0;
|
|
672
|
-
this.previousStates = [];
|
|
673
|
-
this.currentState = Object.freeze({ container: [], key: null });
|
|
674
|
-
this.jsonpath = new JSONPath();
|
|
675
681
|
this.reset();
|
|
676
682
|
this.parser = new ClarinetParser({
|
|
677
683
|
onready: () => {
|
|
@@ -756,6 +762,10 @@ var JSONParser = class {
|
|
|
756
762
|
|
|
757
763
|
// dist/lib/json-parser/streaming-json-parser.js
|
|
758
764
|
var StreamingJSONParser = class extends JSONParser {
|
|
765
|
+
jsonPaths;
|
|
766
|
+
streamingJsonPath = null;
|
|
767
|
+
streamingArray = null;
|
|
768
|
+
topLevelObject = null;
|
|
759
769
|
constructor(options = {}) {
|
|
760
770
|
super({
|
|
761
771
|
onopenarray: () => {
|
|
@@ -782,9 +792,6 @@ var StreamingJSONParser = class extends JSONParser {
|
|
|
782
792
|
}
|
|
783
793
|
}
|
|
784
794
|
});
|
|
785
|
-
this.streamingJsonPath = null;
|
|
786
|
-
this.streamingArray = null;
|
|
787
|
-
this.topLevelObject = null;
|
|
788
795
|
const jsonpaths = options.jsonpaths || [];
|
|
789
796
|
this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));
|
|
790
797
|
}
|
|
@@ -916,8 +923,10 @@ function rebuildJsonObject(batch, data) {
|
|
|
916
923
|
}
|
|
917
924
|
|
|
918
925
|
// dist/json-loader.js
|
|
919
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
926
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
920
927
|
var JSONLoader = {
|
|
928
|
+
dataType: null,
|
|
929
|
+
batchType: null,
|
|
921
930
|
name: "JSON",
|
|
922
931
|
id: "json",
|
|
923
932
|
module: "json",
|
|
@@ -997,8 +1006,10 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
|
997
1006
|
}
|
|
998
1007
|
|
|
999
1008
|
// dist/ndjson-loader.js
|
|
1000
|
-
var VERSION2 = true ? "4.2.0-alpha.
|
|
1009
|
+
var VERSION2 = true ? "4.2.0-alpha.6" : "latest";
|
|
1001
1010
|
var NDJSONLoader = {
|
|
1011
|
+
dataType: null,
|
|
1012
|
+
batchType: null,
|
|
1002
1013
|
name: "NDJSON",
|
|
1003
1014
|
id: "ndjson",
|
|
1004
1015
|
module: "json",
|
|
@@ -1047,8 +1058,10 @@ var JSONWriter = {
|
|
|
1047
1058
|
|
|
1048
1059
|
// dist/geojson-loader.js
|
|
1049
1060
|
var import_gis = require("@loaders.gl/gis");
|
|
1050
|
-
var VERSION3 = true ? "4.2.0-alpha.
|
|
1061
|
+
var VERSION3 = true ? "4.2.0-alpha.6" : "latest";
|
|
1051
1062
|
var GeoJSONWorkerLoader = {
|
|
1063
|
+
dataType: null,
|
|
1064
|
+
batchType: null,
|
|
1052
1065
|
name: "GeoJSON",
|
|
1053
1066
|
id: "geojson",
|
|
1054
1067
|
module: "geojson",
|
|
@@ -1197,10 +1210,11 @@ function getFeatureFromRow(table, row, geometryColumnIndex) {
|
|
|
1197
1210
|
|
|
1198
1211
|
// dist/lib/encoder-utils/utf8-encoder.js
|
|
1199
1212
|
var Utf8ArrayBufferEncoder = class {
|
|
1213
|
+
chunkSize;
|
|
1214
|
+
strings = [];
|
|
1215
|
+
totalLength = 0;
|
|
1216
|
+
textEncoder = new TextEncoder();
|
|
1200
1217
|
constructor(chunkSize) {
|
|
1201
|
-
this.strings = [];
|
|
1202
|
-
this.totalLength = 0;
|
|
1203
|
-
this.textEncoder = new TextEncoder();
|
|
1204
1218
|
this.chunkSize = chunkSize;
|
|
1205
1219
|
}
|
|
1206
1220
|
push(...strings) {
|