@loaders.gl/json 4.0.0-alpha.1 → 4.0.0-alpha.11
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 +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +3094 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/geojson-loader.js +157 -0
- package/dist/es5/geojson-loader.js.map +1 -0
- package/dist/es5/geojson-writer.js +27 -0
- package/dist/es5/geojson-writer.js.map +1 -0
- package/dist/es5/index.js +69 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/json-loader.js +67 -0
- package/dist/es5/json-loader.js.map +1 -0
- package/dist/es5/json-writer.js +42 -0
- package/dist/es5/json-writer.js.map +1 -0
- package/dist/es5/lib/clarinet/clarinet.js +446 -0
- package/dist/es5/lib/clarinet/clarinet.js.map +1 -0
- package/dist/es5/lib/encoders/encode-utils.js +42 -0
- package/dist/es5/lib/encoders/encode-utils.js.map +1 -0
- package/dist/es5/lib/encoders/geojson-encoder.js +178 -0
- package/dist/es5/lib/encoders/geojson-encoder.js.map +1 -0
- package/dist/es5/lib/encoders/json-encoder.js +30 -0
- package/dist/es5/lib/encoders/json-encoder.js.map +1 -0
- package/dist/es5/lib/encoders/utf8-encoder.js +54 -0
- package/dist/es5/lib/encoders/utf8-encoder.js.map +1 -0
- package/dist/es5/lib/json-parser/json-parser.js +140 -0
- package/dist/es5/lib/json-parser/json-parser.js.map +1 -0
- package/dist/es5/lib/json-parser/streaming-json-parser.js +123 -0
- package/dist/es5/lib/json-parser/streaming-json-parser.js.map +1 -0
- package/dist/es5/lib/jsonpath/jsonpath.js +119 -0
- package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/es5/lib/parsers/parse-json-in-batches.js +206 -0
- package/dist/es5/lib/parsers/parse-json-in-batches.js.map +1 -0
- package/dist/es5/lib/parsers/parse-json.js +38 -0
- package/dist/es5/lib/parsers/parse-json.js.map +1 -0
- package/dist/es5/lib/parsers/parse-ndjson-in-batches.js +114 -0
- package/dist/es5/lib/parsers/parse-ndjson-in-batches.js.map +1 -0
- package/dist/es5/lib/parsers/parse-ndjson.js +19 -0
- package/dist/es5/lib/parsers/parse-ndjson.js.map +1 -0
- package/dist/es5/ndgeoson-loader.js +54 -0
- package/dist/es5/ndgeoson-loader.js.map +1 -0
- package/dist/es5/ndjson-loader.js +44 -0
- package/dist/es5/ndjson-loader.js.map +1 -0
- package/dist/es5/workers/geojson-worker.js +6 -0
- package/dist/es5/workers/geojson-worker.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/geojson-loader.js +79 -0
- package/dist/esm/geojson-loader.js.map +1 -0
- package/dist/esm/geojson-writer.js +18 -0
- package/dist/esm/geojson-writer.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/json-loader.js +48 -0
- package/dist/esm/json-loader.js.map +1 -0
- package/dist/esm/json-writer.js +14 -0
- package/dist/esm/json-writer.js.map +1 -0
- package/dist/esm/lib/clarinet/LICENSE +28 -0
- package/dist/esm/lib/clarinet/clarinet.js +415 -0
- package/dist/esm/lib/clarinet/clarinet.js.map +1 -0
- package/dist/esm/lib/encoders/encode-utils.js +31 -0
- package/dist/esm/lib/encoders/encode-utils.js.map +1 -0
- package/dist/esm/lib/encoders/geojson-encoder.js +98 -0
- package/dist/esm/lib/encoders/geojson-encoder.js.map +1 -0
- package/dist/esm/lib/encoders/json-encoder.js +12 -0
- package/dist/esm/lib/encoders/json-encoder.js.map +1 -0
- package/dist/esm/lib/encoders/utf8-encoder.js +32 -0
- package/dist/esm/lib/encoders/utf8-encoder.js.map +1 -0
- package/dist/{lib/parser → esm/lib/json-parser}/json-parser.js +4 -22
- package/dist/esm/lib/json-parser/json-parser.js.map +1 -0
- package/dist/{lib/parser → esm/lib/json-parser}/streaming-json-parser.js +2 -23
- package/dist/esm/lib/json-parser/streaming-json-parser.js.map +1 -0
- package/dist/esm/lib/jsonpath/jsonpath.js +67 -0
- package/dist/esm/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/{lib → esm/lib/parsers}/parse-json-in-batches.js +19 -15
- package/dist/esm/lib/parsers/parse-json-in-batches.js.map +1 -0
- package/dist/{lib → esm/lib/parsers}/parse-json.js +4 -9
- package/dist/esm/lib/parsers/parse-json.js.map +1 -0
- package/dist/{lib → esm/lib/parsers}/parse-ndjson-in-batches.js +3 -6
- package/dist/esm/lib/parsers/parse-ndjson-in-batches.js.map +1 -0
- package/dist/esm/lib/parsers/parse-ndjson.js +13 -0
- package/dist/esm/lib/parsers/parse-ndjson.js.map +1 -0
- package/dist/esm/ndgeoson-loader.js +27 -0
- package/dist/esm/ndgeoson-loader.js.map +1 -0
- package/dist/esm/ndjson-loader.js +18 -0
- package/dist/esm/ndjson-loader.js.map +1 -0
- package/dist/esm/workers/geojson-worker.js +4 -0
- package/dist/esm/workers/geojson-worker.js.map +1 -0
- package/dist/geojson-loader.d.ts +16 -0
- package/dist/geojson-loader.d.ts.map +1 -0
- package/dist/geojson-loader.js +65 -69
- package/dist/geojson-worker.js +1016 -232
- package/dist/geojson-writer.d.ts +6 -0
- package/dist/geojson-writer.d.ts.map +1 -0
- package/dist/geojson-writer.js +22 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -6
- package/dist/json-loader.d.ts +17 -0
- package/dist/json-loader.d.ts.map +1 -0
- package/dist/json-loader.js +33 -38
- package/dist/json-writer.d.ts +6 -0
- package/dist/json-writer.d.ts.map +1 -0
- package/dist/json-writer.js +18 -0
- package/dist/lib/clarinet/clarinet.d.ts +74 -0
- package/dist/lib/clarinet/clarinet.d.ts.map +1 -0
- package/dist/lib/clarinet/clarinet.js +510 -493
- package/dist/lib/encoders/encode-utils.d.ts +19 -0
- package/dist/lib/encoders/encode-utils.d.ts.map +1 -0
- package/dist/lib/encoders/encode-utils.js +47 -0
- package/dist/lib/encoders/geojson-encoder.d.ts +14 -0
- package/dist/lib/encoders/geojson-encoder.d.ts.map +1 -0
- package/dist/lib/encoders/geojson-encoder.js +104 -0
- package/dist/lib/encoders/json-encoder.d.ts +16 -0
- package/dist/lib/encoders/json-encoder.d.ts.map +1 -0
- package/dist/lib/encoders/json-encoder.js +22 -0
- package/dist/lib/encoders/utf8-encoder.d.ts +12 -0
- package/dist/lib/encoders/utf8-encoder.d.ts.map +1 -0
- package/dist/lib/encoders/utf8-encoder.js +32 -0
- package/dist/lib/json-parser/json-parser.d.ts +22 -0
- package/dist/lib/json-parser/json-parser.d.ts.map +1 -0
- package/dist/lib/json-parser/json-parser.js +98 -0
- package/dist/lib/json-parser/streaming-json-parser.d.ts +37 -0
- package/dist/lib/json-parser/streaming-json-parser.d.ts.map +1 -0
- package/dist/lib/json-parser/streaming-json-parser.js +100 -0
- package/dist/lib/jsonpath/jsonpath.d.ts +32 -0
- package/dist/lib/jsonpath/jsonpath.d.ts.map +1 -0
- package/dist/lib/jsonpath/jsonpath.js +81 -78
- package/dist/lib/parsers/parse-json-in-batches.d.ts +5 -0
- package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -0
- package/dist/lib/parsers/parse-json-in-batches.js +100 -0
- package/dist/lib/parsers/parse-json.d.ts +4 -0
- package/dist/lib/parsers/parse-json.d.ts.map +1 -0
- package/dist/lib/parsers/parse-json.js +32 -0
- package/dist/lib/parsers/parse-ndjson-in-batches.d.ts +4 -0
- package/dist/lib/parsers/parse-ndjson-in-batches.d.ts.map +1 -0
- package/dist/lib/parsers/parse-ndjson-in-batches.js +36 -0
- package/dist/lib/parsers/parse-ndjson.d.ts +3 -0
- package/dist/lib/parsers/parse-ndjson.d.ts.map +1 -0
- package/dist/lib/parsers/parse-ndjson.js +17 -0
- package/dist/ndgeoson-loader.d.ts +34 -0
- package/dist/ndgeoson-loader.d.ts.map +1 -0
- package/dist/ndgeoson-loader.js +37 -0
- package/dist/ndjson-loader.d.ts +4 -0
- package/dist/ndjson-loader.d.ts.map +1 -0
- package/dist/ndjson-loader.js +26 -31
- package/dist/workers/geojson-worker.d.ts +2 -0
- package/dist/workers/geojson-worker.d.ts.map +1 -0
- package/dist/workers/geojson-worker.js +5 -4
- package/package.json +10 -10
- package/src/geojson-loader.ts +10 -6
- package/src/geojson-writer.ts +27 -0
- package/src/index.ts +10 -0
- package/src/json-loader.ts +15 -24
- package/src/json-writer.ts +24 -0
- package/src/lib/encoders/encode-utils.ts +54 -0
- package/src/lib/encoders/geojson-encoder.ts +139 -0
- package/src/lib/encoders/json-encoder.ts +30 -0
- package/src/lib/encoders/utf8-encoder.ts +35 -0
- package/src/lib/{parse-json-in-batches.ts → parsers/parse-json-in-batches.ts} +30 -8
- package/src/lib/{parse-json.ts → parsers/parse-json.ts} +7 -3
- package/src/lib/{parse-ndjson-in-batches.ts → parsers/parse-ndjson-in-batches.ts} +1 -1
- package/src/lib/parsers/parse-ndjson.ts +15 -0
- package/src/ndgeoson-loader.ts +48 -0
- package/src/ndjson-loader.ts +20 -27
- package/dist/bundle.js.map +0 -1
- package/dist/geojson-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-loader.js.map +0 -1
- package/dist/jsonl-loader.js +0 -2
- package/dist/jsonl-loader.js.map +0 -1
- package/dist/lib/clarinet/clarinet.js.map +0 -1
- package/dist/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/lib/parse-json-in-batches.js.map +0 -1
- package/dist/lib/parse-json.js.map +0 -1
- package/dist/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/lib/parse-ndjson.js +0 -11
- package/dist/lib/parse-ndjson.js.map +0 -1
- package/dist/lib/parser/json-parser.js.map +0 -1
- package/dist/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/ndjson-loader.js.map +0 -1
- package/dist/workers/geojson-worker.js.map +0 -1
- package/src/jsonl-loader.ts +0 -53
- package/src/lib/parse-ndjson.ts +0 -10
- /package/dist/{lib → es5/lib}/clarinet/LICENSE +0 -0
- /package/src/lib/{parser → json-parser}/json-parser.ts +0 -0
- /package/src/lib/{parser → json-parser}/streaming-json-parser.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndgeoson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","parseNDJSONSync","TextDecoder","decode","stop","_x","apply","arguments","parseTextSync","parseInBatches","parseNDJSONInBatches","options","exports","_typecheckNDJSONLoader"],"sources":["../../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-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 NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\nconst DEFAULT_NDGEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n};\n\nexport const NDJSONLoader = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: DEFAULT_NDGEOJSON_LOADER_OPTIONS\n};\n\nexport const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAME,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAW3E,IAAMC,gCAAgC,GAAG;EACvCC,OAAO,EAAE;IACPC,KAAK,EAAE;EACT,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE;EACV;AACF,CAAC;AAEM,IAAMC,YAAY,GAAG;EAC1BC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEV,OAAO;EAChBW,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAwB;MAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAAK,IAAAC,4BAAe,EAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACT,WAAW,CAAC,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA;IAAA,SAAAN,MAAAkB,EAAA;MAAA,OAAAjB,MAAA,CAAAkB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAApB,KAAA;EAAA;EACjGqB,aAAa,EAAEP,4BAAe;EAC9BQ,cAAc,EAAEC,0CAAoB;EACpCC,OAAO,EAAEtC;AACX,CAAC;AAACuC,OAAA,CAAAlC,YAAA,GAAAA,YAAA;AAEK,IAAMmC,sBAAwC,GAAGnC,YAAY;AAACkC,OAAA,CAAAC,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NDJSONLoader = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _parseNdjson = require("./lib/parsers/parse-ndjson");
|
|
11
|
+
var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
|
|
12
|
+
var VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
|
|
13
|
+
var NDJSONLoader = {
|
|
14
|
+
name: 'NDJSON',
|
|
15
|
+
id: 'ndjson',
|
|
16
|
+
module: 'json',
|
|
17
|
+
version: VERSION,
|
|
18
|
+
extensions: ['ndjson', 'jsonl'],
|
|
19
|
+
mimeTypes: ['application/x-ndjson', 'application/jsonlines', 'application/json-seq'],
|
|
20
|
+
category: 'table',
|
|
21
|
+
text: true,
|
|
22
|
+
parse: function () {
|
|
23
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
24
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
return _context.abrupt("return", (0, _parseNdjson.parseNDJSONSync)(new TextDecoder().decode(arrayBuffer)));
|
|
28
|
+
case 1:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
31
|
+
}
|
|
32
|
+
}, _callee);
|
|
33
|
+
}));
|
|
34
|
+
function parse(_x) {
|
|
35
|
+
return _parse.apply(this, arguments);
|
|
36
|
+
}
|
|
37
|
+
return parse;
|
|
38
|
+
}(),
|
|
39
|
+
parseTextSync: _parseNdjson.parseNDJSONSync,
|
|
40
|
+
parseInBatches: _parseNdjsonInBatches.parseNDJSONInBatches,
|
|
41
|
+
options: {}
|
|
42
|
+
};
|
|
43
|
+
exports.NDJSONLoader = NDJSONLoader;
|
|
44
|
+
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","parseNDJSONSync","TextDecoder","decode","stop","_x","apply","arguments","parseTextSync","parseInBatches","parseNDJSONInBatches","options","exports"],"sources":["../../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-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 const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":";;;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAME,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAEpE,IAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC/BC,SAAS,EAAE,CACT,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAwB;MAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAAK,IAAAC,4BAAe,EAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACT,WAAW,CAAC,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA;IAAA,SAAAN,MAAAkB,EAAA;MAAA,OAAAjB,MAAA,CAAAkB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAApB,KAAA;EAAA;EACjGqB,aAAa,EAAEP,4BAAe;EAC9BQ,cAAc,EAAEC,0CAAoB;EACpCC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAlC,YAAA,GAAAA,YAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geojson-worker.js","names":["_loaderUtils","require","_geojsonLoader","createLoaderWorker","GeoJSONLoader"],"sources":["../../../src/workers/geojson-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {GeoJSONLoader} from '../geojson-loader';\n\ncreateLoaderWorker(GeoJSONLoader);\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,+BAAkB,EAACC,4BAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
|
+
import { parseJSONSync } from './lib/parsers/parse-json';
|
|
3
|
+
import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
|
|
4
|
+
const VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
|
|
5
|
+
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
6
|
+
geojson: {
|
|
7
|
+
shape: 'object-row-table'
|
|
8
|
+
},
|
|
9
|
+
json: {
|
|
10
|
+
jsonpaths: ['$', '$.features']
|
|
11
|
+
},
|
|
12
|
+
gis: {
|
|
13
|
+
format: 'geojson'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const GeoJSONWorkerLoader = {
|
|
17
|
+
name: 'GeoJSON',
|
|
18
|
+
id: 'geojson',
|
|
19
|
+
module: 'geojson',
|
|
20
|
+
version: VERSION,
|
|
21
|
+
worker: true,
|
|
22
|
+
extensions: ['geojson'],
|
|
23
|
+
mimeTypes: ['application/geo+json'],
|
|
24
|
+
category: 'geometry',
|
|
25
|
+
text: true,
|
|
26
|
+
options: DEFAULT_GEOJSON_LOADER_OPTIONS
|
|
27
|
+
};
|
|
28
|
+
export const GeoJSONLoader = {
|
|
29
|
+
...GeoJSONWorkerLoader,
|
|
30
|
+
parse,
|
|
31
|
+
parseTextSync,
|
|
32
|
+
parseInBatches
|
|
33
|
+
};
|
|
34
|
+
async function parse(arrayBuffer, options) {
|
|
35
|
+
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
36
|
+
}
|
|
37
|
+
function parseTextSync(text, options) {
|
|
38
|
+
options = {
|
|
39
|
+
...DEFAULT_GEOJSON_LOADER_OPTIONS,
|
|
40
|
+
...options
|
|
41
|
+
};
|
|
42
|
+
options.json = {
|
|
43
|
+
...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
|
|
44
|
+
...options.geojson
|
|
45
|
+
};
|
|
46
|
+
options.gis = options.gis || {};
|
|
47
|
+
const table = parseJSONSync(text, options);
|
|
48
|
+
table.shape = 'geojson-row-table';
|
|
49
|
+
switch (options.gis.format) {
|
|
50
|
+
case 'binary':
|
|
51
|
+
return geojsonToBinary(table.data);
|
|
52
|
+
default:
|
|
53
|
+
return table;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function parseInBatches(asyncIterator, options) {
|
|
57
|
+
options = {
|
|
58
|
+
...DEFAULT_GEOJSON_LOADER_OPTIONS,
|
|
59
|
+
...options
|
|
60
|
+
};
|
|
61
|
+
options.json = {
|
|
62
|
+
...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
|
|
63
|
+
...options.geojson
|
|
64
|
+
};
|
|
65
|
+
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
66
|
+
switch (options.gis.format) {
|
|
67
|
+
case 'binary':
|
|
68
|
+
return makeBinaryGeometryIterator(geojsonIterator);
|
|
69
|
+
default:
|
|
70
|
+
return geojsonIterator;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function* makeBinaryGeometryIterator(geojsonIterator) {
|
|
74
|
+
for await (const batch of geojsonIterator) {
|
|
75
|
+
batch.data = geojsonToBinary(batch.data);
|
|
76
|
+
yield batch;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=geojson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONSync","parseJSONInBatches","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","table","data","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\nimport {GeoJSONRowTable} from '@loaders.gl/schema';\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' | 'binary';\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 table = parseJSONSync(text, options) as GeoJSONRowTable;\n table.shape = 'geojson-row-table';\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.data);\n default:\n return table;\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"],"mappings":"AAIA,SAAQA,eAAe,QAAO,iBAAiB;AAC/C,SAAQC,aAAa,QAAO,0BAA0B;AACtD,SAAQC,kBAAkB,QAAO,qCAAqC;AAKtE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAW3E,MAAMC,8BAA8B,GAAG;EACrCC,OAAO,EAAE;IACPC,KAAK,EAAE;EACT,CAAC;EACDC,IAAI,EAAE;IACJC,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY;EAC/B,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE;EACV;AACF,CAAC;AAKD,OAAO,MAAMC,mBAA2B,GAAG;EACzCC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEZ,OAAO;EAChBa,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,sBAAsB,CAAC;EACnCC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,IAAI;EACVC,OAAO,EAAEjB;AACX,CAAC;AAED,OAAO,MAAMkB,aAA+B,GAAG;EAC7C,GAAGX,mBAAmB;EACtBY,KAAK;EACLC,aAAa;EACbC;AACF,CAAC;AAED,eAAeF,KAAKA,CAACG,WAAW,EAAEL,OAAO,EAAE;EACzC,OAAOG,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEL,OAAO,CAAC;AACtE;AAEA,SAASG,aAAaA,CAACJ,IAAI,EAAEC,OAAO,EAAE;EAEpCA,OAAO,GAAG;IAAC,GAAGjB,8BAA8B;IAAE,GAAGiB;EAAO,CAAC;EACzDA,OAAO,CAACd,IAAI,GAAG;IAAC,GAAGH,8BAA8B,CAACC,OAAO;IAAE,GAAGgB,OAAO,CAAChB;EAAO,CAAC;EAC9EgB,OAAO,CAACZ,GAAG,GAAGY,OAAO,CAACZ,GAAG,IAAI,CAAC,CAAC;EAC/B,MAAMoB,KAAK,GAAG5B,aAAa,CAACmB,IAAI,EAAEC,OAAO,CAAoB;EAC7DQ,KAAK,CAACvB,KAAK,GAAG,mBAAmB;EACjC,QAAQe,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOV,eAAe,CAAC6B,KAAK,CAACC,IAAI,CAAC;IACpC;MACE,OAAOD,KAAK;EAChB;AACF;AAEA,SAASJ,cAAcA,CAACM,aAAa,EAAEV,OAAO,EAAsB;EAElEA,OAAO,GAAG;IAAC,GAAGjB,8BAA8B;IAAE,GAAGiB;EAAO,CAAC;EACzDA,OAAO,CAACd,IAAI,GAAG;IAAC,GAAGH,8BAA8B,CAACC,OAAO;IAAE,GAAGgB,OAAO,CAAChB;EAAO,CAAC;EAE9E,MAAM2B,eAAe,GAAG9B,kBAAkB,CAAC6B,aAAa,EAAEV,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOuB,0BAA0B,CAACD,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBC,0BAA0BA,CAACD,eAAe,EAAE;EAC1D,WAAW,MAAME,KAAK,IAAIF,eAAe,EAAE;IACzCE,KAAK,CAACJ,IAAI,GAAG9B,eAAe,CAACkC,KAAK,CAACJ,IAAI,CAAC;IACxC,MAAMI,KAAK;EACb;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { encodeTableAsGeojsonInBatches } from './lib/encoders/geojson-encoder';
|
|
2
|
+
export const GeoJSONWriter = {
|
|
3
|
+
id: 'geojson',
|
|
4
|
+
version: 'latest',
|
|
5
|
+
module: 'geojson',
|
|
6
|
+
name: 'GeoJSON',
|
|
7
|
+
extensions: ['geojson'],
|
|
8
|
+
mimeTypes: ['application/geo+json'],
|
|
9
|
+
options: {
|
|
10
|
+
geojson: {
|
|
11
|
+
featureArray: false,
|
|
12
|
+
geometryColumn: null
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
text: true,
|
|
16
|
+
encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=geojson-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geojson-writer.js","names":["encodeTableAsGeojsonInBatches","GeoJSONWriter","id","version","module","name","extensions","mimeTypes","options","geojson","featureArray","geometryColumn","text","encodeInBatches","tableIterator"],"sources":["../../src/geojson-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright Foursquare, Inc 20222\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {GeoJSONWriterOptions} from './lib/encoders/geojson-encoder';\nimport {encodeTableAsGeojsonInBatches} from './lib/encoders/geojson-encoder';\n\nexport type {GeoJSONWriterOptions};\n\nexport const GeoJSONWriter: Writer<Table, TableBatch, GeoJSONWriterOptions> = {\n id: 'geojson',\n version: 'latest',\n module: 'geojson',\n name: 'GeoJSON',\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n options: {\n geojson: {\n featureArray: false,\n geometryColumn: null\n }\n },\n text: true,\n encodeInBatches: (tableIterator: AsyncIterable<TableBatch>, options) =>\n encodeTableAsGeojsonInBatches(tableIterator, options)\n};\n"],"mappings":"AAMA,SAAQA,6BAA6B,QAAO,gCAAgC;AAI5E,OAAO,MAAMC,aAA8D,GAAG;EAC5EC,EAAE,EAAE,SAAS;EACbC,OAAO,EAAE,QAAQ;EACjBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,sBAAsB,CAAC;EACnCC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE;IAClB;EACF,CAAC;EACDC,IAAI,EAAE,IAAI;EACVC,eAAe,EAAEA,CAACC,aAAwC,EAAEN,OAAO,KACjER,6BAA6B,CAACc,aAAa,EAAEN,OAAO;AACxD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { JSONLoader } from './json-loader';
|
|
2
|
+
export { NDJSONLoader } from './ndjson-loader';
|
|
3
|
+
export { JSONWriter } from './json-writer';
|
|
4
|
+
export { GeoJSONLoader as _GeoJSONLoader, GeoJSONWorkerLoader as _GeoJSONWorkerLoader } from './geojson-loader';
|
|
5
|
+
export { GeoJSONWriter as _GeoJSONWriter } from './geojson-writer';
|
|
6
|
+
export { default as _JSONPath } from './lib/jsonpath/jsonpath';
|
|
7
|
+
export { default as _ClarinetParser } from './lib/clarinet/clarinet';
|
|
8
|
+
export { rebuildJsonObject as _rebuildJsonObject } from './lib/parsers/parse-json-in-batches';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["JSONLoader","NDJSONLoader","JSONWriter","GeoJSONLoader","_GeoJSONLoader","GeoJSONWorkerLoader","_GeoJSONWorkerLoader","GeoJSONWriter","_GeoJSONWriter","default","_JSONPath","_ClarinetParser","rebuildJsonObject","_rebuildJsonObject"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type {JSONLoaderOptions} from './json-loader';\nexport {JSONLoader} from './json-loader';\nexport {NDJSONLoader} from './ndjson-loader';\n\nexport type {JSONWriterOptions} from './json-writer';\nexport {JSONWriter} from './json-writer';\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 type {GeoJSONWriterOptions as _GeoJSONWriterOptions} from './geojson-writer';\nexport {GeoJSONWriter as _GeoJSONWriter} from './geojson-writer';\n\nexport {default as _JSONPath} from './lib/jsonpath/jsonpath';\nexport {default as _ClarinetParser} from './lib/clarinet/clarinet';\n\nexport {rebuildJsonObject as _rebuildJsonObject} from './lib/parsers/parse-json-in-batches';\n"],"mappings":"AAGA,SAAQA,UAAU,QAAO,eAAe;AACxC,SAAQC,YAAY,QAAO,iBAAiB;AAG5C,SAAQC,UAAU,QAAO,eAAe;AAIxC,SACEC,aAAa,IAAIC,cAAc,EAC/BC,mBAAmB,IAAIC,oBAAoB,QACtC,kBAAkB;AAGzB,SAAQC,aAAa,IAAIC,cAAc,QAAO,kBAAkB;AAEhE,SAAQC,OAAO,IAAIC,SAAS,QAAO,yBAAyB;AAC5D,SAAQD,OAAO,IAAIE,eAAe,QAAO,yBAAyB;AAElE,SAAQC,iBAAiB,IAAIC,kBAAkB,QAAO,qCAAqC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { parseJSONSync } from './lib/parsers/parse-json';
|
|
2
|
+
import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
|
|
4
|
+
const DEFAULT_JSON_LOADER_OPTIONS = {
|
|
5
|
+
json: {
|
|
6
|
+
shape: 'row-table',
|
|
7
|
+
table: false,
|
|
8
|
+
jsonpaths: []
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const JSONLoader = {
|
|
12
|
+
name: 'JSON',
|
|
13
|
+
id: 'json',
|
|
14
|
+
module: 'json',
|
|
15
|
+
version: VERSION,
|
|
16
|
+
extensions: ['json', 'geojson'],
|
|
17
|
+
mimeTypes: ['application/json'],
|
|
18
|
+
category: 'table',
|
|
19
|
+
text: true,
|
|
20
|
+
parse,
|
|
21
|
+
parseTextSync,
|
|
22
|
+
parseInBatches,
|
|
23
|
+
options: DEFAULT_JSON_LOADER_OPTIONS
|
|
24
|
+
};
|
|
25
|
+
async function parse(arrayBuffer, options) {
|
|
26
|
+
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
27
|
+
}
|
|
28
|
+
function parseTextSync(text, options) {
|
|
29
|
+
const jsonOptions = {
|
|
30
|
+
...options,
|
|
31
|
+
json: {
|
|
32
|
+
...DEFAULT_JSON_LOADER_OPTIONS.json,
|
|
33
|
+
...(options === null || options === void 0 ? void 0 : options.json)
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return parseJSONSync(text, jsonOptions);
|
|
37
|
+
}
|
|
38
|
+
function parseInBatches(asyncIterator, options) {
|
|
39
|
+
const jsonOptions = {
|
|
40
|
+
...options,
|
|
41
|
+
json: {
|
|
42
|
+
...DEFAULT_JSON_LOADER_OPTIONS.json,
|
|
43
|
+
...(options === null || options === void 0 ? void 0 : options.json)
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return parseJSONInBatches(asyncIterator, jsonOptions);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=json-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-loader.js","names":["parseJSONSync","parseJSONInBatches","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"],"sources":["../../src/json-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/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\ntype ParseJSONOptions = {\n shape?: 'row-table';\n table?: boolean;\n jsonpaths?: string[];\n};\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: ParseJSONOptions;\n};\n\nconst DEFAULT_JSON_LOADER_OPTIONS: {json: Required<ParseJSONOptions>} = {\n json: {\n shape: 'row-table',\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n};\n\nexport const JSONLoader: LoaderWithParser<Table, TableBatch, JSONLoaderOptions> = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\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<TableBatch> {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"mappings":"AAIA,SAAQA,aAAa,QAAO,0BAA0B;AACtD,SAAQC,kBAAkB,QAAO,qCAAqC;AAItE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAgB3E,MAAMC,2BAA+D,GAAG;EACtEC,IAAI,EAAE;IACJC,KAAK,EAAE,WAAW;IAClBC,KAAK,EAAE,KAAK;IACZC,SAAS,EAAE;EAEb;AACF,CAAC;AAED,OAAO,MAAMC,UAAkE,GAAG;EAChFC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEV,OAAO;EAChBW,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;EACLC,aAAa;EACbC,cAAc;EACdC,OAAO,EAAEjB;AACX,CAAC;AAED,eAAec,KAAKA,CAACI,WAAwB,EAAED,OAA2B,EAAE;EAC1E,OAAOF,aAAa,CAAC,IAAII,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAED,OAAO,CAAC;AACtE;AAEA,SAASF,aAAaA,CAACF,IAAY,EAAEI,OAA2B,EAAE;EAChE,MAAMI,WAAW,GAAG;IAAC,GAAGJ,OAAO;IAAEhB,IAAI,EAAE;MAAC,GAAGD,2BAA2B,CAACC,IAAI;MAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;IAAA;EAAC,CAAC;EAC/F,OAAOJ,aAAa,CAACgB,IAAI,EAAEQ,WAAgC,CAAC;AAC9D;AAEA,SAASL,cAAcA,CACrBM,aAAiE,EACjEL,OAA2B,EACA;EAC3B,MAAMI,WAAW,GAAG;IAAC,GAAGJ,OAAO;IAAEhB,IAAI,EAAE;MAAC,GAAGD,2BAA2B,CAACC,IAAI;MAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;IAAA;EAAC,CAAC;EAC/F,OAAOH,kBAAkB,CAACwB,aAAa,EAAED,WAAgC,CAAC;AAC5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { encodeTableAsJSON } from './lib/encoders/json-encoder';
|
|
2
|
+
export const JSONWriter = {
|
|
3
|
+
id: 'json',
|
|
4
|
+
version: 'latest',
|
|
5
|
+
module: 'json',
|
|
6
|
+
name: 'JSON',
|
|
7
|
+
extensions: ['json'],
|
|
8
|
+
mimeTypes: ['application/json'],
|
|
9
|
+
options: {},
|
|
10
|
+
text: true,
|
|
11
|
+
encode: async (table, options) => new TextEncoder().encode(encodeTableAsJSON(table, options)).buffer,
|
|
12
|
+
encodeText: (table, options) => encodeTableAsJSON(table, options)
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=json-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-writer.js","names":["encodeTableAsJSON","JSONWriter","id","version","module","name","extensions","mimeTypes","options","text","encode","table","TextEncoder","buffer","encodeText"],"sources":["../../src/json-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright 2022 Foursquare Labs, Inc.\n\n/* global TextEncoder */\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {JSONWriterOptions} from './lib/encoders/json-encoder';\nimport {encodeTableAsJSON} from './lib/encoders/json-encoder';\n\nexport type {JSONWriterOptions};\n\nexport const JSONWriter: Writer<Table, TableBatch, JSONWriterOptions> = {\n id: 'json',\n version: 'latest',\n module: 'json',\n name: 'JSON',\n extensions: ['json'],\n mimeTypes: ['application/json'],\n options: {},\n text: true,\n encode: async (table: Table, options: JSONWriterOptions) =>\n new TextEncoder().encode(encodeTableAsJSON(table, options)).buffer,\n encodeText: (table: Table, options: JSONWriterOptions) => encodeTableAsJSON(table, options)\n};\n"],"mappings":"AAOA,SAAQA,iBAAiB,QAAO,6BAA6B;AAI7D,OAAO,MAAMC,UAAwD,GAAG;EACtEC,EAAE,EAAE,MAAM;EACVC,OAAO,EAAE,QAAQ;EACjBC,MAAM,EAAE,MAAM;EACdC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,OAAO,EAAE,CAAC,CAAC;EACXC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,MAAAA,CAAOC,KAAY,EAAEH,OAA0B,KACrD,IAAII,WAAW,CAAC,CAAC,CAACF,MAAM,CAACV,iBAAiB,CAACW,KAAK,EAAEH,OAAO,CAAC,CAAC,CAACK,MAAM;EACpEC,UAAU,EAAEA,CAACH,KAAY,EAAEH,OAA0B,KAAKR,iBAAiB,CAACW,KAAK,EAAEH,OAAO;AAC5F,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright (c) Isaac Z. Schlueter ("Author")
|
|
2
|
+
Copyright (c) 2011 nuno job <nunojob.com>
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
The BSD License
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
|
8
|
+
modification, are permitted provided that the following conditions
|
|
9
|
+
are met:
|
|
10
|
+
|
|
11
|
+
1. Redistributions of source code must retain the above copyright
|
|
12
|
+
notice, this list of conditions and the following disclaimer.
|
|
13
|
+
|
|
14
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer in the
|
|
16
|
+
documentation and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
21
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
|
22
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
23
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
24
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
25
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
26
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
27
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
28
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|