@loaders.gl/json 4.2.0-alpha.5 → 4.2.0-alpha.6
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 +74 -53
- package/dist/dist.min.js +8 -8
- package/dist/geojson-loader.js +1 -1
- package/dist/geojson-worker.js +78 -54
- package/dist/index.cjs +39 -31
- package/dist/index.cjs.map +2 -2
- package/dist/json-loader.js +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.js +1 -1
- package/dist/ndjson-loader.js +1 -1
- package/package.json +5 -5
package/dist/geojson-worker.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
// ../worker-utils/src/lib/node/worker_threads-browser.ts
|
|
4
11
|
var parentPort = null;
|
|
5
12
|
|
|
@@ -59,7 +66,9 @@
|
|
|
59
66
|
}
|
|
60
67
|
getParentPort().then((parentPort2) => {
|
|
61
68
|
if (parentPort2) {
|
|
62
|
-
parentPort2.on("message",
|
|
69
|
+
parentPort2.on("message", (message) => {
|
|
70
|
+
handleMessage(message);
|
|
71
|
+
});
|
|
63
72
|
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
64
73
|
} else {
|
|
65
74
|
globalThis.onmessage = handleMessage;
|
|
@@ -254,11 +263,14 @@
|
|
|
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,7 +2454,7 @@ 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.5" : "latest";
|
|
2434
2458
|
var GeoJSONWorkerLoader = {
|
|
2435
2459
|
name: "GeoJSON",
|
|
2436
2460
|
id: "geojson",
|
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,7 +923,7 @@ 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.5" : "latest";
|
|
920
927
|
var JSONLoader = {
|
|
921
928
|
name: "JSON",
|
|
922
929
|
id: "json",
|
|
@@ -997,7 +1004,7 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
|
997
1004
|
}
|
|
998
1005
|
|
|
999
1006
|
// dist/ndjson-loader.js
|
|
1000
|
-
var VERSION2 = true ? "4.2.0-alpha.
|
|
1007
|
+
var VERSION2 = true ? "4.2.0-alpha.5" : "latest";
|
|
1001
1008
|
var NDJSONLoader = {
|
|
1002
1009
|
name: "NDJSON",
|
|
1003
1010
|
id: "ndjson",
|
|
@@ -1047,7 +1054,7 @@ var JSONWriter = {
|
|
|
1047
1054
|
|
|
1048
1055
|
// dist/geojson-loader.js
|
|
1049
1056
|
var import_gis = require("@loaders.gl/gis");
|
|
1050
|
-
var VERSION3 = true ? "4.2.0-alpha.
|
|
1057
|
+
var VERSION3 = true ? "4.2.0-alpha.5" : "latest";
|
|
1051
1058
|
var GeoJSONWorkerLoader = {
|
|
1052
1059
|
name: "GeoJSON",
|
|
1053
1060
|
id: "geojson",
|
|
@@ -1197,10 +1204,11 @@ function getFeatureFromRow(table, row, geometryColumnIndex) {
|
|
|
1197
1204
|
|
|
1198
1205
|
// dist/lib/encoder-utils/utf8-encoder.js
|
|
1199
1206
|
var Utf8ArrayBufferEncoder = class {
|
|
1207
|
+
chunkSize;
|
|
1208
|
+
strings = [];
|
|
1209
|
+
totalLength = 0;
|
|
1210
|
+
textEncoder = new TextEncoder();
|
|
1200
1211
|
constructor(chunkSize) {
|
|
1201
|
-
this.strings = [];
|
|
1202
|
-
this.totalLength = 0;
|
|
1203
|
-
this.textEncoder = new TextEncoder();
|
|
1204
1212
|
this.chunkSize = chunkSize;
|
|
1205
1213
|
}
|
|
1206
1214
|
push(...strings) {
|