@loaders.gl/json 3.1.0-beta.2 → 3.1.0
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.js +41 -7
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/geojson-loader.js +143 -29
- package/dist/es5/geojson-loader.js.map +1 -1
- package/dist/es5/index.js +14 -6
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/json-loader.js +44 -18
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/lib/clarinet/clarinet.js +359 -335
- package/dist/es5/lib/clarinet/clarinet.js.map +1 -1
- package/dist/es5/lib/jsonpath/jsonpath.js +101 -54
- package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -1
- package/dist/es5/lib/parse-json-in-batches.js +251 -72
- package/dist/es5/lib/parse-json-in-batches.js.map +1 -1
- package/dist/es5/lib/parse-json.js +9 -4
- package/dist/es5/lib/parse-json.js.map +1 -1
- package/dist/es5/lib/parse-ndjson-in-batches.js +143 -31
- package/dist/es5/lib/parse-ndjson-in-batches.js.map +1 -1
- package/dist/es5/lib/parse-ndjson.js +2 -2
- package/dist/es5/lib/parse-ndjson.js.map +1 -1
- package/dist/es5/lib/parser/json-parser.js +117 -95
- package/dist/es5/lib/parser/json-parser.js.map +1 -1
- package/dist/es5/lib/parser/streaming-json-parser.js +115 -59
- package/dist/es5/lib/parser/streaming-json-parser.js.map +1 -1
- package/dist/es5/ndjson-loader.js +30 -8
- package/dist/es5/ndjson-loader.js.map +1 -1
- package/dist/esm/geojson-loader.js +1 -1
- package/dist/esm/geojson-loader.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/dist/esm/json-loader.js.map +1 -1
- package/dist/esm/lib/parse-json-in-batches.js +18 -1
- package/dist/esm/lib/parse-json-in-batches.js.map +1 -1
- package/dist/esm/ndjson-loader.js +1 -1
- package/dist/esm/ndjson-loader.js.map +1 -1
- package/dist/geojson-worker.js +12 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/parse-json-in-batches.d.ts +1 -0
- package/dist/lib/parse-json-in-batches.d.ts.map +1 -1
- package/dist/lib/parse-json-in-batches.js +20 -0
- package/package.json +5 -5
- package/src/index.ts +2 -0
- package/src/lib/parse-json-in-batches.ts +23 -1
package/dist/bundle.js
CHANGED
|
@@ -439,6 +439,17 @@
|
|
|
439
439
|
}
|
|
440
440
|
});
|
|
441
441
|
|
|
442
|
+
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
443
|
+
function assert(condition, message) {
|
|
444
|
+
if (!condition) {
|
|
445
|
+
throw new Error(message || "loader assertion failed.");
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
var init_assert = __esm({
|
|
449
|
+
"../loader-utils/src/lib/env-utils/assert.ts"() {
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
|
|
442
453
|
// ../loader-utils/src/lib/iterators/text-iterators.ts
|
|
443
454
|
async function* makeTextDecoderIterator(arrayBufferIterator, options = {}) {
|
|
444
455
|
const textDecoder = new TextDecoder(void 0, options);
|
|
@@ -476,6 +487,7 @@
|
|
|
476
487
|
// ../loader-utils/src/index.ts
|
|
477
488
|
var init_src2 = __esm({
|
|
478
489
|
"../loader-utils/src/index.ts"() {
|
|
490
|
+
init_assert();
|
|
479
491
|
init_text_iterators();
|
|
480
492
|
}
|
|
481
493
|
});
|
|
@@ -1276,11 +1288,25 @@ Char: ${this.c}`;
|
|
|
1276
1288
|
yield finalBatch;
|
|
1277
1289
|
}
|
|
1278
1290
|
}
|
|
1291
|
+
function rebuildJsonObject(batch, data) {
|
|
1292
|
+
assert(batch.batchType === "final-result");
|
|
1293
|
+
if (batch.jsonpath === "$") {
|
|
1294
|
+
return data;
|
|
1295
|
+
}
|
|
1296
|
+
if (batch.jsonpath && batch.jsonpath.length > 1) {
|
|
1297
|
+
const topLevelObject = batch.container;
|
|
1298
|
+
const streamingPath = new JSONPath(batch.jsonpath);
|
|
1299
|
+
streamingPath.setFieldAtPath(topLevelObject, data);
|
|
1300
|
+
return topLevelObject;
|
|
1301
|
+
}
|
|
1302
|
+
return batch.container;
|
|
1303
|
+
}
|
|
1279
1304
|
var init_parse_json_in_batches = __esm({
|
|
1280
1305
|
"src/lib/parse-json-in-batches.ts"() {
|
|
1281
1306
|
init_src();
|
|
1282
1307
|
init_src2();
|
|
1283
1308
|
init_streaming_json_parser();
|
|
1309
|
+
init_jsonpath();
|
|
1284
1310
|
}
|
|
1285
1311
|
});
|
|
1286
1312
|
|
|
@@ -1431,7 +1457,7 @@ Char: ${this.c}`;
|
|
|
1431
1457
|
let polygonRingsCount = 0;
|
|
1432
1458
|
let polygonFeaturesCount = 0;
|
|
1433
1459
|
const coordLengths = new Set();
|
|
1434
|
-
const
|
|
1460
|
+
const propArrayTypes = {};
|
|
1435
1461
|
for (const feature of features) {
|
|
1436
1462
|
const geometry = feature.geometry;
|
|
1437
1463
|
switch (geometry.type) {
|
|
@@ -1491,7 +1517,7 @@ Char: ${this.c}`;
|
|
|
1491
1517
|
if (feature.properties) {
|
|
1492
1518
|
for (const key in feature.properties) {
|
|
1493
1519
|
const val = feature.properties[key];
|
|
1494
|
-
|
|
1520
|
+
propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
|
|
1495
1521
|
}
|
|
1496
1522
|
}
|
|
1497
1523
|
}
|
|
@@ -1506,7 +1532,8 @@ Char: ${this.c}`;
|
|
|
1506
1532
|
polygonObjectsCount,
|
|
1507
1533
|
polygonRingsCount,
|
|
1508
1534
|
polygonFeaturesCount,
|
|
1509
|
-
numericPropKeys: Object.keys(
|
|
1535
|
+
numericPropKeys: Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array),
|
|
1536
|
+
propArrayTypes
|
|
1510
1537
|
};
|
|
1511
1538
|
}
|
|
1512
1539
|
function secondPass(features, firstPassData, options) {
|
|
@@ -1519,6 +1546,7 @@ Char: ${this.c}`;
|
|
|
1519
1546
|
polygonPositionsCount,
|
|
1520
1547
|
polygonObjectsCount,
|
|
1521
1548
|
polygonRingsCount,
|
|
1549
|
+
propArrayTypes,
|
|
1522
1550
|
polygonFeaturesCount
|
|
1523
1551
|
} = firstPassData;
|
|
1524
1552
|
const { coordLength, numericPropKeys, PositionDataType = Float32Array } = options;
|
|
@@ -1552,7 +1580,8 @@ Char: ${this.c}`;
|
|
|
1552
1580
|
};
|
|
1553
1581
|
for (const object of [points, lines, polygons]) {
|
|
1554
1582
|
for (const propName of numericPropKeys || []) {
|
|
1555
|
-
|
|
1583
|
+
const TypedArray = propArrayTypes[propName];
|
|
1584
|
+
object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);
|
|
1556
1585
|
}
|
|
1557
1586
|
}
|
|
1558
1587
|
lines.pathIndices[linePathsCount] = linePositionsCount;
|
|
@@ -1720,8 +1749,11 @@ Char: ${this.c}`;
|
|
|
1720
1749
|
function flatten(arrays) {
|
|
1721
1750
|
return [].concat(...arrays);
|
|
1722
1751
|
}
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1752
|
+
function deduceArrayType(x, constructor) {
|
|
1753
|
+
if (constructor === Array || !Number.isFinite(x)) {
|
|
1754
|
+
return Array;
|
|
1755
|
+
}
|
|
1756
|
+
return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
|
|
1725
1757
|
}
|
|
1726
1758
|
var init_geojson_to_binary = __esm({
|
|
1727
1759
|
"../gis/src/lib/geojson-to-binary.ts"() {
|
|
@@ -1815,7 +1847,8 @@ Char: ${this.c}`;
|
|
|
1815
1847
|
_ClarinetParser: () => ClarinetParser,
|
|
1816
1848
|
_GeoJSONLoader: () => GeoJSONLoader,
|
|
1817
1849
|
_GeoJSONWorkerLoader: () => GeoJSONWorkerLoader,
|
|
1818
|
-
_JSONPath: () => JSONPath
|
|
1850
|
+
_JSONPath: () => JSONPath,
|
|
1851
|
+
_rebuildJsonObject: () => rebuildJsonObject
|
|
1819
1852
|
});
|
|
1820
1853
|
var init_src4 = __esm({
|
|
1821
1854
|
"src/index.ts"() {
|
|
@@ -1824,6 +1857,7 @@ Char: ${this.c}`;
|
|
|
1824
1857
|
init_geojson_loader();
|
|
1825
1858
|
init_jsonpath();
|
|
1826
1859
|
init_clarinet();
|
|
1860
|
+
init_parse_json_in_batches();
|
|
1827
1861
|
}
|
|
1828
1862
|
});
|
|
1829
1863
|
|
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
|
@@ -7,14 +7,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.GeoJSONLoader = exports.GeoJSONWorkerLoader = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
17
|
+
|
|
18
|
+
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
19
|
+
|
|
20
|
+
var _asyncIterator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncIterator"));
|
|
21
|
+
|
|
10
22
|
var _gis = require("@loaders.gl/gis");
|
|
11
23
|
|
|
12
24
|
var _parseJson = _interopRequireDefault(require("./lib/parse-json"));
|
|
13
25
|
|
|
14
26
|
var _parseJsonInBatches = _interopRequireDefault(require("./lib/parse-json-in-batches"));
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
var VERSION = typeof "3.1.0" !== 'undefined' ? "3.1.0" : 'latest';
|
|
33
|
+
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
18
34
|
geojson: {
|
|
19
35
|
shape: 'object-row-table'
|
|
20
36
|
},
|
|
@@ -25,7 +41,7 @@ const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
|
25
41
|
format: 'geojson'
|
|
26
42
|
}
|
|
27
43
|
};
|
|
28
|
-
|
|
44
|
+
var GeoJSONWorkerLoader = {
|
|
29
45
|
name: 'GeoJSON',
|
|
30
46
|
id: 'geojson',
|
|
31
47
|
module: 'geojson',
|
|
@@ -38,26 +54,42 @@ const GeoJSONWorkerLoader = {
|
|
|
38
54
|
options: DEFAULT_GEOJSON_LOADER_OPTIONS
|
|
39
55
|
};
|
|
40
56
|
exports.GeoJSONWorkerLoader = GeoJSONWorkerLoader;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
|
|
58
|
+
var GeoJSONLoader = _objectSpread(_objectSpread({}, GeoJSONWorkerLoader), {}, {
|
|
59
|
+
parse: parse,
|
|
60
|
+
parseTextSync: parseTextSync,
|
|
61
|
+
parseInBatches: parseInBatches
|
|
62
|
+
});
|
|
63
|
+
|
|
46
64
|
exports.GeoJSONLoader = GeoJSONLoader;
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
return
|
|
66
|
+
function parse(_x2, _x3) {
|
|
67
|
+
return _parse.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _parse() {
|
|
71
|
+
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(arrayBuffer, options) {
|
|
72
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
73
|
+
while (1) {
|
|
74
|
+
switch (_context2.prev = _context2.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
return _context2.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
|
|
77
|
+
|
|
78
|
+
case 1:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context2.stop();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, _callee2);
|
|
84
|
+
}));
|
|
85
|
+
return _parse.apply(this, arguments);
|
|
50
86
|
}
|
|
51
87
|
|
|
52
88
|
function parseTextSync(text, options) {
|
|
53
|
-
options = {
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
options.json = { ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
|
|
57
|
-
...options.geojson
|
|
58
|
-
};
|
|
89
|
+
options = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS), options);
|
|
90
|
+
options.json = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS.geojson), options.geojson);
|
|
59
91
|
options.gis = options.gis || {};
|
|
60
|
-
|
|
92
|
+
var json = (0, _parseJson.default)(text, options);
|
|
61
93
|
|
|
62
94
|
switch (options.gis.format) {
|
|
63
95
|
case 'binary':
|
|
@@ -69,13 +101,9 @@ function parseTextSync(text, options) {
|
|
|
69
101
|
}
|
|
70
102
|
|
|
71
103
|
function parseInBatches(asyncIterator, options) {
|
|
72
|
-
options = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
options.json = { ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
|
|
76
|
-
...options.geojson
|
|
77
|
-
};
|
|
78
|
-
const geojsonIterator = (0, _parseJsonInBatches.default)(asyncIterator, options);
|
|
104
|
+
options = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS), options);
|
|
105
|
+
options.json = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS.geojson), options.geojson);
|
|
106
|
+
var geojsonIterator = (0, _parseJsonInBatches.default)(asyncIterator, options);
|
|
79
107
|
|
|
80
108
|
switch (options.gis.format) {
|
|
81
109
|
case 'binary':
|
|
@@ -86,10 +114,96 @@ function parseInBatches(asyncIterator, options) {
|
|
|
86
114
|
}
|
|
87
115
|
}
|
|
88
116
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
function makeBinaryGeometryIterator(_x) {
|
|
118
|
+
return _makeBinaryGeometryIterator.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _makeBinaryGeometryIterator() {
|
|
122
|
+
_makeBinaryGeometryIterator = (0, _wrapAsyncGenerator2.default)(_regenerator.default.mark(function _callee(geojsonIterator) {
|
|
123
|
+
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, batch;
|
|
124
|
+
|
|
125
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
126
|
+
while (1) {
|
|
127
|
+
switch (_context.prev = _context.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
_iteratorNormalCompletion = true;
|
|
130
|
+
_didIteratorError = false;
|
|
131
|
+
_context.prev = 2;
|
|
132
|
+
_iterator = (0, _asyncIterator2.default)(geojsonIterator);
|
|
133
|
+
|
|
134
|
+
case 4:
|
|
135
|
+
_context.next = 6;
|
|
136
|
+
return (0, _awaitAsyncGenerator2.default)(_iterator.next());
|
|
137
|
+
|
|
138
|
+
case 6:
|
|
139
|
+
_step = _context.sent;
|
|
140
|
+
_iteratorNormalCompletion = _step.done;
|
|
141
|
+
_context.next = 10;
|
|
142
|
+
return (0, _awaitAsyncGenerator2.default)(_step.value);
|
|
143
|
+
|
|
144
|
+
case 10:
|
|
145
|
+
_value = _context.sent;
|
|
146
|
+
|
|
147
|
+
if (_iteratorNormalCompletion) {
|
|
148
|
+
_context.next = 19;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
batch = _value;
|
|
153
|
+
batch.data = (0, _gis.geojsonToBinary)(batch.data);
|
|
154
|
+
_context.next = 16;
|
|
155
|
+
return batch;
|
|
156
|
+
|
|
157
|
+
case 16:
|
|
158
|
+
_iteratorNormalCompletion = true;
|
|
159
|
+
_context.next = 4;
|
|
160
|
+
break;
|
|
161
|
+
|
|
162
|
+
case 19:
|
|
163
|
+
_context.next = 25;
|
|
164
|
+
break;
|
|
165
|
+
|
|
166
|
+
case 21:
|
|
167
|
+
_context.prev = 21;
|
|
168
|
+
_context.t0 = _context["catch"](2);
|
|
169
|
+
_didIteratorError = true;
|
|
170
|
+
_iteratorError = _context.t0;
|
|
171
|
+
|
|
172
|
+
case 25:
|
|
173
|
+
_context.prev = 25;
|
|
174
|
+
_context.prev = 26;
|
|
175
|
+
|
|
176
|
+
if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
|
|
177
|
+
_context.next = 30;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
_context.next = 30;
|
|
182
|
+
return (0, _awaitAsyncGenerator2.default)(_iterator.return());
|
|
183
|
+
|
|
184
|
+
case 30:
|
|
185
|
+
_context.prev = 30;
|
|
186
|
+
|
|
187
|
+
if (!_didIteratorError) {
|
|
188
|
+
_context.next = 33;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
throw _iteratorError;
|
|
193
|
+
|
|
194
|
+
case 33:
|
|
195
|
+
return _context.finish(30);
|
|
196
|
+
|
|
197
|
+
case 34:
|
|
198
|
+
return _context.finish(25);
|
|
199
|
+
|
|
200
|
+
case 35:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context.stop();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, _callee, null, [[2, 21, 25, 35], [26,, 30, 34]]);
|
|
206
|
+
}));
|
|
207
|
+
return _makeBinaryGeometryIterator.apply(this, arguments);
|
|
94
208
|
}
|
|
95
209
|
//# sourceMappingURL=geojson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geojson-loader.ts"],"names":["VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/geojson-loader.ts"],"names":["VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":"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","sourcesContent":["import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\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 GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\nconst DEFAULT_GEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: DEFAULT_GEOJSON_LOADER_OPTIONS\n};\n\nexport const GeoJSONLoader: LoaderWithParser = {\n ...GeoJSONWorkerLoader,\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer, options) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text, options) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const json = parseJSONSync(text, options);\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(json);\n default:\n return json;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<any> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"file":"geojson-loader.js"}
|
package/dist/es5/index.js
CHANGED
|
@@ -7,40 +7,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports, "JSONLoader", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () {
|
|
10
|
+
get: function get() {
|
|
11
11
|
return _jsonLoader.JSONLoader;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "NDJSONLoader", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () {
|
|
16
|
+
get: function get() {
|
|
17
17
|
return _ndjsonLoader.NDJSONLoader;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "_GeoJSONLoader", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () {
|
|
22
|
+
get: function get() {
|
|
23
23
|
return _geojsonLoader.GeoJSONLoader;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "_GeoJSONWorkerLoader", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () {
|
|
28
|
+
get: function get() {
|
|
29
29
|
return _geojsonLoader.GeoJSONWorkerLoader;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "_JSONPath", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () {
|
|
34
|
+
get: function get() {
|
|
35
35
|
return _jsonpath.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "_ClarinetParser", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () {
|
|
40
|
+
get: function get() {
|
|
41
41
|
return _clarinet.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(exports, "_rebuildJsonObject", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _parseJsonInBatches.rebuildJsonObject;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
|
|
45
51
|
var _jsonLoader = require("./json-loader");
|
|
46
52
|
|
|
@@ -51,4 +57,6 @@ var _geojsonLoader = require("./geojson-loader");
|
|
|
51
57
|
var _jsonpath = _interopRequireDefault(require("./lib/jsonpath/jsonpath"));
|
|
52
58
|
|
|
53
59
|
var _clarinet = _interopRequireDefault(require("./lib/clarinet/clarinet"));
|
|
60
|
+
|
|
61
|
+
var _parseJsonInBatches = require("./lib/parse-json-in-batches");
|
|
54
62
|
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AAEA","sourcesContent":["export type {JSONLoaderOptions} from './json-loader';\nexport {JSONLoader} from './json-loader';\nexport {NDJSONLoader} from './ndjson-loader';\n\n// EXPERIMENTAL EXPORTS - WARNING: MAY BE REMOVED WIHTOUT NOTICE IN FUTURE RELEASES\nexport type {GeoJSONLoaderOptions as _GeoJSONLoaderOptions} from './geojson-loader';\nexport {\n GeoJSONLoader as _GeoJSONLoader,\n GeoJSONWorkerLoader as _GeoJSONWorkerLoader\n} from './geojson-loader';\n\nexport {default as _JSONPath} from './lib/jsonpath/jsonpath';\nexport {default as _ClarinetParser} from './lib/clarinet/clarinet';\n\nexport {rebuildJsonObject as _rebuildJsonObject} from './lib/parse-json-in-batches';\n"],"file":"index.js"}
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -7,19 +7,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.JSONLoader = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
10
16
|
var _parseJson = _interopRequireDefault(require("./lib/parse-json"));
|
|
11
17
|
|
|
12
18
|
var _parseJsonInBatches = _interopRequireDefault(require("./lib/parse-json-in-batches"));
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
|
+
|
|
24
|
+
var VERSION = typeof "3.1.0" !== 'undefined' ? "3.1.0" : 'latest';
|
|
25
|
+
var DEFAULT_JSON_LOADER_OPTIONS = {
|
|
16
26
|
json: {
|
|
17
27
|
shape: 'row-table',
|
|
18
28
|
table: false,
|
|
19
29
|
jsonpaths: []
|
|
20
30
|
}
|
|
21
31
|
};
|
|
22
|
-
|
|
32
|
+
var JSONLoader = {
|
|
23
33
|
name: 'JSON',
|
|
24
34
|
id: 'json',
|
|
25
35
|
module: 'json',
|
|
@@ -28,32 +38,48 @@ const JSONLoader = {
|
|
|
28
38
|
mimeTypes: ['application/json'],
|
|
29
39
|
category: 'table',
|
|
30
40
|
text: true,
|
|
31
|
-
parse,
|
|
32
|
-
parseTextSync,
|
|
33
|
-
parseInBatches,
|
|
41
|
+
parse: parse,
|
|
42
|
+
parseTextSync: parseTextSync,
|
|
43
|
+
parseInBatches: parseInBatches,
|
|
34
44
|
options: DEFAULT_JSON_LOADER_OPTIONS
|
|
35
45
|
};
|
|
36
46
|
exports.JSONLoader = JSONLoader;
|
|
37
47
|
|
|
38
|
-
|
|
39
|
-
return
|
|
48
|
+
function parse(_x, _x2) {
|
|
49
|
+
return _parse.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function _parse() {
|
|
53
|
+
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
|
|
54
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
55
|
+
while (1) {
|
|
56
|
+
switch (_context.prev = _context.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
|
|
59
|
+
|
|
60
|
+
case 1:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
return _parse.apply(this, arguments);
|
|
40
68
|
}
|
|
41
69
|
|
|
42
70
|
function parseTextSync(text, options) {
|
|
43
|
-
|
|
44
|
-
json: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
71
|
+
var jsonOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
72
|
+
json: _objectSpread(_objectSpread({}, DEFAULT_JSON_LOADER_OPTIONS.json), options === null || options === void 0 ? void 0 : options.json)
|
|
73
|
+
});
|
|
74
|
+
|
|
48
75
|
return (0, _parseJson.default)(text, jsonOptions);
|
|
49
76
|
}
|
|
50
77
|
|
|
51
78
|
function parseInBatches(asyncIterator, options) {
|
|
52
|
-
|
|
53
|
-
json: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
79
|
+
var jsonOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
80
|
+
json: _objectSpread(_objectSpread({}, DEFAULT_JSON_LOADER_OPTIONS.json), options === null || options === void 0 ? void 0 : options.json)
|
|
81
|
+
});
|
|
82
|
+
|
|
57
83
|
return (0, _parseJsonInBatches.default)(asyncIterator, jsonOptions);
|
|
58
84
|
}
|
|
59
85
|
//# sourceMappingURL=json-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json-loader.ts"],"names":["VERSION","DEFAULT_JSON_LOADER_OPTIONS","json","shape","table","jsonpaths","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","arrayBuffer","TextDecoder","decode","jsonOptions","asyncIterator"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/json-loader.ts"],"names":["VERSION","DEFAULT_JSON_LOADER_OPTIONS","json","shape","table","jsonpaths","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","arrayBuffer","TextDecoder","decode","jsonOptions","asyncIterator"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AAcA,IAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,WADH;AAEJC,IAAAA,KAAK,EAAE,KAFH;AAGJC,IAAAA,SAAS,EAAE;AAHP;AAD4B,CAApC;AASO,IAAMC,UAA4B,GAAG;AAC1CC,EAAAA,IAAI,EAAE,MADoC;AAE1CC,EAAAA,EAAE,EAAE,MAFsC;AAG1CC,EAAAA,MAAM,EAAE,MAHkC;AAI1CC,EAAAA,OAAO,EAAEV,OAJiC;AAK1CW,EAAAA,UAAU,EAAE,CAAC,MAAD,EAAS,SAAT,CAL8B;AAM1CC,EAAAA,SAAS,EAAE,CAAC,kBAAD,CAN+B;AAoB1CC,EAAAA,QAAQ,EAAE,OApBgC;AAqB1CC,EAAAA,IAAI,EAAE,IArBoC;AAsB1CC,EAAAA,KAAK,EAALA,KAtB0C;AAuB1CC,EAAAA,aAAa,EAAbA,aAvB0C;AAwB1CC,EAAAA,cAAc,EAAdA,cAxB0C;AAyB1CC,EAAAA,OAAO,EAAEjB;AAzBiC,CAArC;;;SA4BQc,K;;;;;qEAAf,iBAAqBI,WAArB,EAA+CD,OAA/C;AAAA;AAAA;AAAA;AAAA;AAAA,6CACSF,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCD,OAAxC,CADtB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAIA,SAASF,aAAT,CAAuBF,IAAvB,EAAqCI,OAArC,EAAkE;AAChE,MAAMI,WAAW,mCAAOJ,OAAP;AAAgBhB,IAAAA,IAAI,kCAAMD,2BAA2B,CAACC,IAAlC,GAA2CgB,OAA3C,aAA2CA,OAA3C,uBAA2CA,OAAO,CAAEhB,IAApD;AAApB,IAAjB;;AACA,SAAO,wBAAcY,IAAd,EAAoBQ,WAApB,CAAP;AACD;;AAED,SAASL,cAAT,CACEM,aADF,EAEEL,OAFF,EAGwB;AACtB,MAAMI,WAAW,mCAAOJ,OAAP;AAAgBhB,IAAAA,IAAI,kCAAMD,2BAA2B,CAACC,IAAlC,GAA2CgB,OAA3C,aAA2CA,OAA3C,uBAA2CA,OAAO,CAAEhB,IAApD;AAApB,IAAjB;;AACA,SAAO,iCAAmBqB,aAAnB,EAAkCD,WAAlC,CAAP;AACD","sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\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\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: {\n shape?: 'row-table';\n table?: false;\n jsonpaths?: string[];\n };\n};\n\nconst DEFAULT_JSON_LOADER_OPTIONS = {\n json: {\n shape: 'row-table',\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n};\n\nexport const JSONLoader: LoaderWithParser = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n // TODO - support various line based JSON formats\n /*\n extensions: {\n json: null,\n jsonl: {stream: true},\n ndjson: {stream: true}\n },\n mimeTypes: {\n 'application/json': null,\n 'application/json-seq': {stream: true},\n 'application/x-ndjson': {stream: true}\n },\n */\n category: 'table',\n text: true,\n parse,\n parseTextSync,\n parseInBatches,\n options: DEFAULT_JSON_LOADER_OPTIONS\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: JSONLoaderOptions) {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONSync(text, jsonOptions as JSONLoaderOptions);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: JSONLoaderOptions\n): AsyncIterable<Batch> {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"file":"json-loader.js"}
|