@loaders.gl/json 3.1.0-alpha.4 → 4.0.0-alpha.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/{esm/bundle.js → bundle.js} +0 -0
- package/dist/bundle.js.map +1 -0
- package/dist/{esm/geojson-loader.js → geojson-loader.js} +1 -1
- package/dist/geojson-loader.js.map +1 -0
- package/dist/geojson-worker.js +1702 -2
- package/dist/{esm/index.js → index.js} +0 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/json-loader.js → json-loader.js} +1 -1
- package/dist/json-loader.js.map +1 -0
- package/dist/{esm/jsonl-loader.js → jsonl-loader.js} +0 -0
- package/dist/{es5/jsonl-loader.js.map → jsonl-loader.js.map} +0 -0
- package/dist/{es5/lib → lib}/clarinet/LICENSE +0 -0
- package/dist/lib/clarinet/clarinet.js +518 -0
- package/dist/lib/clarinet/clarinet.js.map +1 -0
- package/dist/{esm/lib → lib}/jsonpath/jsonpath.js +0 -0
- package/dist/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/{esm/lib → lib}/parse-json-in-batches.js +0 -0
- package/dist/lib/parse-json-in-batches.js.map +1 -0
- package/dist/{esm/lib → lib}/parse-json.js +0 -0
- package/dist/lib/parse-json.js.map +1 -0
- package/dist/{esm/lib → lib}/parse-ndjson-in-batches.js +1 -1
- package/dist/lib/parse-ndjson-in-batches.js.map +1 -0
- package/dist/{esm/lib → lib}/parse-ndjson.js +1 -1
- package/dist/lib/parse-ndjson.js.map +1 -0
- package/dist/{esm/lib → lib}/parser/json-parser.js +48 -47
- package/dist/lib/parser/json-parser.js.map +1 -0
- package/dist/{esm/lib → lib}/parser/streaming-json-parser.js +29 -34
- package/dist/lib/parser/streaming-json-parser.js.map +1 -0
- package/dist/{esm/ndjson-loader.js → ndjson-loader.js} +3 -1
- package/dist/ndjson-loader.js.map +1 -0
- package/dist/{esm/workers → workers}/geojson-worker.js +0 -0
- package/dist/workers/geojson-worker.js.map +1 -0
- package/package.json +9 -9
- package/src/lib/clarinet/clarinet.ts +539 -0
- package/src/lib/parser/json-parser.ts +52 -55
- package/src/lib/parser/streaming-json-parser.ts +28 -32
- package/src/ndjson-loader.ts +3 -1
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/geojson-loader.js +0 -209
- package/dist/es5/geojson-loader.js.map +0 -1
- package/dist/es5/index.js +0 -54
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/json-loader.js +0 -85
- package/dist/es5/json-loader.js.map +0 -1
- package/dist/es5/jsonl-loader.js +0 -2
- package/dist/es5/lib/clarinet/clarinet.js +0 -586
- package/dist/es5/lib/clarinet/clarinet.js.map +0 -1
- package/dist/es5/lib/jsonpath/jsonpath.js +0 -144
- package/dist/es5/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/es5/lib/parse-json-in-batches.js +0 -258
- package/dist/es5/lib/parse-json-in-batches.js.map +0 -1
- package/dist/es5/lib/parse-json.js +0 -46
- package/dist/es5/lib/parse-json.js.map +0 -1
- package/dist/es5/lib/parse-ndjson-in-batches.js +0 -158
- package/dist/es5/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/es5/lib/parse-ndjson.js +0 -18
- package/dist/es5/lib/parse-ndjson.js.map +0 -1
- package/dist/es5/lib/parser/json-parser.js +0 -160
- package/dist/es5/lib/parser/json-parser.js.map +0 -1
- package/dist/es5/lib/parser/streaming-json-parser.js +0 -167
- package/dist/es5/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/es5/ndjson-loader.js +0 -64
- package/dist/es5/ndjson-loader.js.map +0 -1
- package/dist/es5/workers/geojson-worker.js +0 -8
- package/dist/es5/workers/geojson-worker.js.map +0 -1
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/geojson-loader.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-loader.js.map +0 -1
- package/dist/esm/jsonl-loader.js.map +0 -1
- package/dist/esm/lib/clarinet/LICENSE +0 -28
- package/dist/esm/lib/clarinet/clarinet.js +0 -556
- package/dist/esm/lib/clarinet/clarinet.js.map +0 -1
- package/dist/esm/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/esm/lib/parse-json-in-batches.js.map +0 -1
- package/dist/esm/lib/parse-json.js.map +0 -1
- package/dist/esm/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/esm/lib/parse-ndjson.js.map +0 -1
- package/dist/esm/lib/parser/json-parser.js.map +0 -1
- package/dist/esm/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/esm/ndjson-loader.js.map +0 -1
- package/dist/esm/workers/geojson-worker.js.map +0 -1
- package/dist/geojson-worker.js.map +0 -1
- package/src/lib/clarinet/clarinet.js +0 -578
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _clarinet = _interopRequireDefault(require("../clarinet/clarinet"));
|
|
17
|
-
|
|
18
|
-
var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
|
|
19
|
-
|
|
20
|
-
var JSONParser = function () {
|
|
21
|
-
function JSONParser() {
|
|
22
|
-
(0, _classCallCheck2.default)(this, JSONParser);
|
|
23
|
-
(0, _defineProperty2.default)(this, "jsonpath", void 0);
|
|
24
|
-
(0, _defineProperty2.default)(this, "_parser", void 0);
|
|
25
|
-
this.reset();
|
|
26
|
-
|
|
27
|
-
this._initializeParser();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
(0, _createClass2.default)(JSONParser, [{
|
|
31
|
-
key: "reset",
|
|
32
|
-
value: function reset() {
|
|
33
|
-
this.result = undefined;
|
|
34
|
-
this.previousStates = [];
|
|
35
|
-
this.currentState = Object.freeze({
|
|
36
|
-
container: [],
|
|
37
|
-
key: null
|
|
38
|
-
});
|
|
39
|
-
this.jsonpath = new _jsonpath.default();
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "write",
|
|
43
|
-
value: function write(chunk) {
|
|
44
|
-
this.parser.write(chunk);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "close",
|
|
48
|
-
value: function close() {
|
|
49
|
-
this.parser.close();
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "_pushOrSet",
|
|
53
|
-
value: function _pushOrSet(value) {
|
|
54
|
-
var _this$currentState = this.currentState,
|
|
55
|
-
container = _this$currentState.container,
|
|
56
|
-
key = _this$currentState.key;
|
|
57
|
-
|
|
58
|
-
if (key !== null) {
|
|
59
|
-
container[key] = value;
|
|
60
|
-
this.currentState.key = null;
|
|
61
|
-
} else {
|
|
62
|
-
container.push(value);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "_openArray",
|
|
67
|
-
value: function _openArray() {
|
|
68
|
-
var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
69
|
-
this.jsonpath.push(null);
|
|
70
|
-
|
|
71
|
-
this._pushOrSet(newContainer);
|
|
72
|
-
|
|
73
|
-
this.previousStates.push(this.currentState);
|
|
74
|
-
this.currentState = {
|
|
75
|
-
container: newContainer,
|
|
76
|
-
isArray: true,
|
|
77
|
-
key: null
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "_closeArray",
|
|
82
|
-
value: function _closeArray() {
|
|
83
|
-
this.jsonpath.pop();
|
|
84
|
-
this.currentState = this.previousStates.pop();
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "_openObject",
|
|
88
|
-
value: function _openObject() {
|
|
89
|
-
var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90
|
-
this.jsonpath.push(null);
|
|
91
|
-
|
|
92
|
-
this._pushOrSet(newContainer);
|
|
93
|
-
|
|
94
|
-
this.previousStates.push(this.currentState);
|
|
95
|
-
this.currentState = {
|
|
96
|
-
container: newContainer,
|
|
97
|
-
isArray: false,
|
|
98
|
-
key: null
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "_closeObject",
|
|
103
|
-
value: function _closeObject() {
|
|
104
|
-
this.jsonpath.pop();
|
|
105
|
-
this.currentState = this.previousStates.pop();
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
key: "_initializeParser",
|
|
109
|
-
value: function _initializeParser() {
|
|
110
|
-
var _this = this;
|
|
111
|
-
|
|
112
|
-
this._parser = new _clarinet.default({
|
|
113
|
-
onready: function onready() {
|
|
114
|
-
_this.jsonpath = new _jsonpath.default();
|
|
115
|
-
_this.previousStates.length = 0;
|
|
116
|
-
_this.currentState.container.length = 0;
|
|
117
|
-
},
|
|
118
|
-
onopenobject: function onopenobject(name) {
|
|
119
|
-
_this._openObject({});
|
|
120
|
-
|
|
121
|
-
if (typeof name !== 'undefined') {
|
|
122
|
-
_this.parser.onkey(name);
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
onkey: function onkey(name) {
|
|
126
|
-
_this.jsonpath.set(name);
|
|
127
|
-
|
|
128
|
-
_this.currentState.key = name;
|
|
129
|
-
},
|
|
130
|
-
oncloseobject: function oncloseobject() {
|
|
131
|
-
_this._closeObject();
|
|
132
|
-
},
|
|
133
|
-
onopenarray: function onopenarray() {
|
|
134
|
-
_this._openArray();
|
|
135
|
-
},
|
|
136
|
-
onclosearray: function onclosearray() {
|
|
137
|
-
_this._closeArray();
|
|
138
|
-
},
|
|
139
|
-
onvalue: function onvalue(value) {
|
|
140
|
-
_this._pushOrSet(value);
|
|
141
|
-
},
|
|
142
|
-
onerror: function onerror(error) {
|
|
143
|
-
throw error;
|
|
144
|
-
},
|
|
145
|
-
onend: function onend() {
|
|
146
|
-
_this.result = _this.currentState.container.pop();
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
key: "parser",
|
|
152
|
-
get: function get() {
|
|
153
|
-
return this._parser;
|
|
154
|
-
}
|
|
155
|
-
}]);
|
|
156
|
-
return JSONParser;
|
|
157
|
-
}();
|
|
158
|
-
|
|
159
|
-
exports.default = JSONParser;
|
|
160
|
-
//# sourceMappingURL=json-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parser/json-parser.ts"],"names":["JSONParser","reset","_initializeParser","result","undefined","previousStates","currentState","Object","freeze","container","key","jsonpath","JSONPath","chunk","parser","write","close","value","push","newContainer","_pushOrSet","isArray","pop","_parser","ClarinetParser","onready","length","onopenobject","name","_openObject","onkey","set","oncloseobject","_closeObject","onopenarray","_openArray","onclosearray","_closeArray","onvalue","onerror","error","onend"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;IAIqBA,U;AAInB,wBAAc;AAAA;AAAA;AAAA;AACZ,SAAKC,KAAL;;AACA,SAAKC,iBAAL;AACD;;;;WAED,iBAAc;AACZ,WAAKC,MAAL,GAAcC,SAAd;AACA,WAAKC,cAAL,GAAsB,EAAtB;AACA,WAAKC,YAAL,GAAoBC,MAAM,CAACC,MAAP,CAAc;AAACC,QAAAA,SAAS,EAAE,EAAZ;AAAgBC,QAAAA,GAAG,EAAE;AAArB,OAAd,CAApB;AACA,WAAKC,QAAL,GAAgB,IAAIC,iBAAJ,EAAhB;AAC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AAW;AAClB,gBAAMA,KAAN;AACD,SArC+B;AAuChCC,QAAAA,KAAK,EAAE,iBAAM;AACX,UAAA,KAAI,CAACtC,MAAL,GAAc,KAAI,CAACG,YAAL,CAAkBG,SAAlB,CAA4Ba,GAA5B,EAAd;AACD;AAzC+B,OAAnB,CAAf;AA2CD;;;SAED,eAAuC;AACrC,aAAO,KAAKC,OAAZ;AACD","sourcesContent":["// @ts-nocheck\n\nimport ClarinetParser from '../clarinet/clarinet';\nimport JSONPath from '../jsonpath/jsonpath';\n\n// JSONParser builds a JSON object using the events emitted by the Clarinet parser\n\nexport default class JSONParser {\n jsonpath: JSONPath;\n _parser?: ClarinetParser;\n\n constructor() {\n this.reset();\n this._initializeParser();\n }\n\n reset(): void {\n this.result = undefined;\n this.previousStates = [];\n this.currentState = Object.freeze({container: [], key: null});\n this.jsonpath = new JSONPath();\n }\n\n write(chunk): void {\n this.parser.write(chunk);\n }\n\n close(): void {\n this.parser.close();\n }\n\n // PRIVATE METHODS\n\n _pushOrSet(value): void {\n const {container, key} = this.currentState;\n if (key !== null) {\n container[key] = value;\n this.currentState.key = null;\n } else {\n container.push(value);\n }\n }\n\n _openArray(newContainer = []): void {\n this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: true, key: null};\n }\n\n _closeArray(): void {\n this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n\n _openObject(newContainer = {}): void {\n this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: false, key: null};\n }\n\n _closeObject(): void {\n this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n\n _initializeParser(): void {\n this._parser = new ClarinetParser({\n onready: () => {\n this.jsonpath = new JSONPath();\n this.previousStates.length = 0;\n this.currentState.container.length = 0;\n },\n\n onopenobject: (name) => {\n this._openObject({});\n if (typeof name !== 'undefined') {\n this.parser.onkey(name);\n }\n },\n\n onkey: (name) => {\n this.jsonpath.set(name);\n this.currentState.key = name;\n },\n\n oncloseobject: () => {\n this._closeObject();\n },\n\n onopenarray: () => {\n this._openArray();\n },\n\n onclosearray: () => {\n this._closeArray();\n },\n\n onvalue: (value) => {\n this._pushOrSet(value);\n },\n\n onerror: (error) => {\n throw error;\n },\n\n onend: () => {\n this.result = this.currentState.container.pop();\n }\n });\n }\n\n protected get parser(): ClarinetParser {\n return this._parser as ClarinetParser;\n }\n}\n"],"file":"json-parser.js"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var _jsonParser = _interopRequireDefault(require("./json-parser"));
|
|
29
|
-
|
|
30
|
-
var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
|
|
31
|
-
|
|
32
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
33
|
-
|
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
-
|
|
36
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
-
|
|
38
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
39
|
-
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
-
|
|
42
|
-
var StreamingJSONParser = function (_JSONParser) {
|
|
43
|
-
(0, _inherits2.default)(StreamingJSONParser, _JSONParser);
|
|
44
|
-
|
|
45
|
-
var _super = _createSuper(StreamingJSONParser);
|
|
46
|
-
|
|
47
|
-
function StreamingJSONParser() {
|
|
48
|
-
var _this;
|
|
49
|
-
|
|
50
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
|
-
(0, _classCallCheck2.default)(this, StreamingJSONParser);
|
|
52
|
-
_this = _super.call(this);
|
|
53
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "jsonPaths", void 0);
|
|
54
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "streamingJsonPath", null);
|
|
55
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "streamingArray", null);
|
|
56
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "topLevelObject", null);
|
|
57
|
-
var jsonpaths = options.jsonpaths || [];
|
|
58
|
-
_this.jsonPaths = jsonpaths.map(function (jsonpath) {
|
|
59
|
-
return new _jsonpath.default(jsonpath);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
_this._extendParser();
|
|
63
|
-
|
|
64
|
-
return _this;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
(0, _createClass2.default)(StreamingJSONParser, [{
|
|
68
|
-
key: "write",
|
|
69
|
-
value: function write(chunk) {
|
|
70
|
-
(0, _get2.default)((0, _getPrototypeOf2.default)(StreamingJSONParser.prototype), "write", this).call(this, chunk);
|
|
71
|
-
var array = [];
|
|
72
|
-
|
|
73
|
-
if (this.streamingArray) {
|
|
74
|
-
array = (0, _toConsumableArray2.default)(this.streamingArray);
|
|
75
|
-
this.streamingArray.length = 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return array;
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "getPartialResult",
|
|
82
|
-
value: function getPartialResult() {
|
|
83
|
-
return this.topLevelObject;
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "getStreamingJsonPath",
|
|
87
|
-
value: function getStreamingJsonPath() {
|
|
88
|
-
return this.streamingJsonPath;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "getStreamingJsonPathAsString",
|
|
92
|
-
value: function getStreamingJsonPathAsString() {
|
|
93
|
-
return this.streamingJsonPath && this.streamingJsonPath.toString();
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
key: "getJsonPath",
|
|
97
|
-
value: function getJsonPath() {
|
|
98
|
-
return this.jsonpath;
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
key: "_matchJSONPath",
|
|
102
|
-
value: function _matchJSONPath() {
|
|
103
|
-
var currentPath = this.getJsonPath();
|
|
104
|
-
|
|
105
|
-
if (this.jsonPaths.length === 0) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var _iterator = _createForOfIteratorHelper(this.jsonPaths),
|
|
110
|
-
_step;
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
|
-
var jsonPath = _step.value;
|
|
115
|
-
|
|
116
|
-
if (jsonPath.equals(currentPath)) {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
_iterator.e(err);
|
|
122
|
-
} finally {
|
|
123
|
-
_iterator.f();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
}, {
|
|
129
|
-
key: "_extendParser",
|
|
130
|
-
value: function _extendParser() {
|
|
131
|
-
var _this2 = this;
|
|
132
|
-
|
|
133
|
-
this.parser.onopenarray = function () {
|
|
134
|
-
if (!_this2.streamingArray) {
|
|
135
|
-
if (_this2._matchJSONPath()) {
|
|
136
|
-
_this2.streamingJsonPath = _this2.getJsonPath().clone();
|
|
137
|
-
_this2.streamingArray = [];
|
|
138
|
-
|
|
139
|
-
_this2._openArray(_this2.streamingArray);
|
|
140
|
-
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_this2._openArray();
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
this.parser.onopenobject = function (name) {
|
|
149
|
-
if (!_this2.topLevelObject) {
|
|
150
|
-
_this2.topLevelObject = {};
|
|
151
|
-
|
|
152
|
-
_this2._openObject(_this2.topLevelObject);
|
|
153
|
-
} else {
|
|
154
|
-
_this2._openObject({});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (typeof name !== 'undefined') {
|
|
158
|
-
_this2.parser.onkey(name);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}]);
|
|
163
|
-
return StreamingJSONParser;
|
|
164
|
-
}(_jsonParser.default);
|
|
165
|
-
|
|
166
|
-
exports.default = StreamingJSONParser;
|
|
167
|
-
//# sourceMappingURL=streaming-json-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parser/streaming-json-parser.ts"],"names":["StreamingJSONParser","options","jsonpaths","jsonPaths","map","jsonpath","JSONPath","_extendParser","chunk","array","streamingArray","length","topLevelObject","streamingJsonPath","toString","currentPath","getJsonPath","jsonPath","equals","parser","onopenarray","_matchJSONPath","clone","_openArray","onopenobject","name","_openObject","onkey","JSONParser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAC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;AACD;;;WAED,yBAAgB;AAAA;;AAEd,WAAKI,MAAL,CAAYC,WAAZ,GAA0B,YAAM;AAC9B,YAAI,CAAC,MAAI,CAACV,cAAV,EAA0B;AACxB,cAAI,MAAI,CAACW,cAAL,EAAJ,EAA2B;AAEzB,YAAA,MAAI,CAACR,iBAAL,GAAyB,MAAI,CAACG,WAAL,GAAmBM,KAAnB,EAAzB;AACA,YAAA,MAAI,CAACZ,cAAL,GAAsB,EAAtB;;AACA,YAAA,MAAI,CAACa,UAAL,CAAgB,MAAI,CAACb,cAArB;;AACA;AACD;AACF;;AAED,QAAA,MAAI,CAACa,UAAL;AACD,OAZD;;AAeA,WAAKJ,MAAL,CAAYK,YAAZ,GAA2B,UAACC,IAAD,EAAU;AACnC,YAAI,CAAC,MAAI,CAACb,cAAV,EAA0B;AACxB,UAAA,MAAI,CAACA,cAAL,GAAsB,EAAtB;;AACA,UAAA,MAAI,CAACc,WAAL,CAAiB,MAAI,CAACd,cAAtB;AACD,SAHD,MAGO;AACL,UAAA,MAAI,CAACc,WAAL,CAAiB,EAAjB;AACD;;AACD,YAAI,OAAOD,IAAP,KAAgB,WAApB,EAAiC;AAC/B,UAAA,MAAI,CAACN,MAAL,CAAYQ,KAAZ,CAAkBF,IAAlB;AACD;AACF,OAVD;AAWD;;;EAvG8CG,mB","sourcesContent":["import {default as JSONParser} from './json-parser';\nimport JSONPath from '../jsonpath/jsonpath';\n\n/**\n * The `StreamingJSONParser` looks for the first array in the JSON structure.\n * and emits an array of chunks\n */\nexport default class StreamingJSONParser extends JSONParser {\n private jsonPaths: JSONPath[];\n private streamingJsonPath: JSONPath | null = null;\n private streamingArray: any[] | null = null;\n private topLevelObject: object | null = null;\n\n constructor(options: {[key: string]: any} = {}) {\n super();\n const jsonpaths = options.jsonpaths || [];\n this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));\n this._extendParser();\n }\n\n /**\n * write REDEFINITION\n * - super.write() chunk to parser\n * - get the contents (so far) of \"topmost-level\" array as batch of rows\n * - clear top-level array\n * - return the batch of rows\\\n */\n write(chunk) {\n super.write(chunk);\n let array: any[] = [];\n if (this.streamingArray) {\n array = [...this.streamingArray];\n this.streamingArray.length = 0;\n }\n return array;\n }\n\n /**\n * Returns a partially formed result object\n * Useful for returning the \"wrapper\" object when array is not top level\n * e.g. GeoJSON\n */\n getPartialResult() {\n return this.topLevelObject;\n }\n\n getStreamingJsonPath() {\n return this.streamingJsonPath;\n }\n\n getStreamingJsonPathAsString() {\n return this.streamingJsonPath && this.streamingJsonPath.toString();\n }\n\n getJsonPath() {\n return this.jsonpath;\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks is this.getJsonPath matches the jsonpaths provided in options\n */\n _matchJSONPath() {\n const currentPath = this.getJsonPath();\n // console.debug(`Testing JSONPath`, currentPath);\n\n // Backwards compatibility, match any array\n // TODO implement using wildcard once that is supported\n if (this.jsonPaths.length === 0) {\n return true;\n }\n\n for (const jsonPath of this.jsonPaths) {\n if (jsonPath.equals(currentPath)) {\n return true;\n }\n }\n\n return false;\n }\n\n _extendParser() {\n // Redefine onopenarray to locate and inject value for top-level array\n this.parser.onopenarray = () => {\n if (!this.streamingArray) {\n if (this._matchJSONPath()) {\n // @ts-ignore\n this.streamingJsonPath = this.getJsonPath().clone();\n this.streamingArray = [];\n this._openArray(this.streamingArray as []);\n return;\n }\n }\n\n this._openArray();\n };\n\n // Redefine onopenarray to inject value for top-level object\n this.parser.onopenobject = (name) => {\n if (!this.topLevelObject) {\n this.topLevelObject = {};\n this._openObject(this.topLevelObject);\n } else {\n this._openObject({});\n }\n if (typeof name !== 'undefined') {\n this.parser.onkey(name);\n }\n };\n }\n}\n"],"file":"streaming-json-parser.js"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.NDJSONLoader = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _parseNdjson = _interopRequireDefault(require("./lib/parse-ndjson"));
|
|
15
|
-
|
|
16
|
-
var _parseNdjsonInBatches = _interopRequireDefault(require("./lib/parse-ndjson-in-batches"));
|
|
17
|
-
|
|
18
|
-
var VERSION = typeof "3.1.0-alpha.4" !== 'undefined' ? "3.1.0-alpha.4" : 'latest';
|
|
19
|
-
var NDJSONLoader = {
|
|
20
|
-
name: 'NDJSON',
|
|
21
|
-
id: 'ndjson',
|
|
22
|
-
module: 'json',
|
|
23
|
-
version: VERSION,
|
|
24
|
-
extensions: ['ndjson'],
|
|
25
|
-
mimeTypes: ['application/x-ndjson'],
|
|
26
|
-
category: 'table',
|
|
27
|
-
text: true,
|
|
28
|
-
parse: parse,
|
|
29
|
-
parseTextSync: parseTextSync,
|
|
30
|
-
parseInBatches: parseInBatches,
|
|
31
|
-
options: {}
|
|
32
|
-
};
|
|
33
|
-
exports.NDJSONLoader = NDJSONLoader;
|
|
34
|
-
|
|
35
|
-
function parse(_x) {
|
|
36
|
-
return _parse.apply(this, arguments);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _parse() {
|
|
40
|
-
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
41
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer)));
|
|
46
|
-
|
|
47
|
-
case 1:
|
|
48
|
-
case "end":
|
|
49
|
-
return _context.stop();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, _callee);
|
|
53
|
-
}));
|
|
54
|
-
return _parse.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function parseTextSync(text) {
|
|
58
|
-
return (0, _parseNdjson.default)(text);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function parseInBatches(asyncIterator, options) {
|
|
62
|
-
return (0, _parseNdjsonInBatches.default)(asyncIterator, options);
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ndjson-loader.ts"],"names":["VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","arrayBuffer","TextDecoder","decode","asyncIterator"],"mappings":";;;;;;;;;;;;;AAEA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEO,IAAMC,YAA8B,GAAG;AAC5CC,EAAAA,IAAI,EAAE,QADsC;AAE5CC,EAAAA,EAAE,EAAE,QAFwC;AAG5CC,EAAAA,MAAM,EAAE,MAHoC;AAI5CC,EAAAA,OAAO,EAAEL,OAJmC;AAK5CM,EAAAA,UAAU,EAAE,CAAC,QAAD,CALgC;AAM5CC,EAAAA,SAAS,EAAE,CAAC,sBAAD,CANiC;AAO5CC,EAAAA,QAAQ,EAAE,OAPkC;AAQ5CC,EAAAA,IAAI,EAAE,IARsC;AAS5CC,EAAAA,KAAK,EAALA,KAT4C;AAU5CC,EAAAA,aAAa,EAAbA,aAV4C;AAW5CC,EAAAA,cAAc,EAAdA,cAX4C;AAY5CC,EAAAA,OAAO,EAAE;AAZmC,CAAvC;;;SAeQH,K;;;;;qEAAf,iBAAqBI,WAArB;AAAA;AAAA;AAAA;AAAA;AAAA,6CACSH,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,CADtB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAIA,SAASH,aAAT,CAAuBF,IAAvB,EAAqC;AACnC,SAAO,0BAAgBA,IAAhB,CAAP;AACD;;AAED,SAASG,cAAT,CACEK,aADF,EAEEJ,OAFF,EAGwB;AACtB,SAAO,mCAAqBI,aAArB,EAAoCJ,OAApC,CAAP;AACD","sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseNDJSONSync from './lib/parse-ndjson';\nimport parseNDJSONInBatches from './lib/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 name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson'],\n mimeTypes: ['application/x-ndjson'],\n category: 'table',\n text: true,\n parse,\n parseTextSync,\n parseInBatches,\n options: {}\n};\n\nasync function parse(arrayBuffer: ArrayBuffer) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer));\n}\n\nfunction parseTextSync(text: string) {\n return parseNDJSONSync(text);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptions\n): AsyncIterable<Batch> {\n return parseNDJSONInBatches(asyncIterator, options);\n}\n"],"file":"ndjson-loader.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/workers/geojson-worker.ts"],"names":["GeoJSONLoader"],"mappings":";;AAAA;;AACA;;AAEA,qCAAmBA,4BAAnB","sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {GeoJSONLoader} from '../geojson-loader';\n\ncreateLoaderWorker(GeoJSONLoader);\n"],"file":"geojson-worker.js"}
|
package/dist/esm/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geojson-loader.ts"],"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","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":"AAEA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,MAAMC,8BAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD4B;AAIrCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,SAAS,EAAE,CAAC,GAAD,EAAM,YAAN;AADP,GAJ+B;AAOrCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAPgC,CAAvC;AAeA,OAAO,MAAMC,mBAA2B,GAAG;AACzCC,EAAAA,I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AvC,EAAoE;AAElEA,EAAAA,OAAO,GAAG,EAAC,GAAGjB,8BAAJ;AAAoC,OAAGiB;AAAvC,GAAV;AACAA,EAAAA,OAAO,CAACd,IAAR,GAAe,EAAC,GAAGH,8BAA8B,CAACC,OAAnC;AAA4C,OAAGgB,OAAO,CAAChB;AAAvD,GAAf;AAEA,QAAMyB,eAAe,GAAG5B,kBAAkB,CAAC2B,aAAD,EAAgBR,OAAhB,CAA1C;;AAEA,UAAQA,OAAO,CAACZ,GAAR,CAAYC,MAApB;AACE,SAAK,QAAL;AACE,aAAOqB,0BAA0B,CAACD,eAAD,CAAjC;;AACF;AACE,aAAOA,eAAP;AAJJ;AAMD;;AAED,gBAAgBC,0BAAhB,CAA2CD,eAA3C,EAA4D;AAC1D,aAAW,MAAME,KAAjB,IAA0BF,eAA1B,EAA2C;AACzCE,IAAAA,KAAK,CAACC,IAAN,GAAajC,eAAe,CAACgC,KAAK,CAACC,IAAP,CAA5B;AACA,UAAMD,KAAN;AACD;AACF","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/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["JSONLoader","NDJSONLoader","GeoJSONLoader","_GeoJSONLoader","GeoJSONWorkerLoader","_GeoJSONWorkerLoader","default","_JSONPath","_ClarinetParser"],"mappings":"AACA,SAAQA,UAAR,QAAyB,eAAzB;AACA,SAAQC,YAAR,QAA2B,iBAA3B;AAIA,SACEC,aAAa,IAAIC,cADnB,EAEEC,mBAAmB,IAAIC,oBAFzB,QAGO,kBAHP;AAKA,SAAQC,OAAO,IAAIC,SAAnB,QAAmC,yBAAnC;AACA,SAAQD,OAAO,IAAIE,eAAnB,QAAyC,yBAAzC","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"],"file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json-loader.ts"],"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"],"mappings":"AAEA,OAAOA,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAcA,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,WADH;AAEJC,IAAAA,KAAK,EAAE,KAFH;AAGJC,IAAAA,SAAS,EAAE;AAHP;AAD4B,CAApC;AASA,OAAO,MAAMC,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,KAtB0C;AAuB1CC,EAAAA,aAvB0C;AAwB1CC,EAAAA,cAxB0C;AAyB1CC,EAAAA,OAAO,EAAEjB;AAzBiC,CAArC;;AA4BP,eAAec,KAAf,CAAqBI,WAArB,EAA+CD,OAA/C,EAA4E;AAC1E,SAAOF,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCD,OAAxC,CAApB;AACD;;AAED,SAASF,aAAT,CAAuBF,IAAvB,EAAqCI,OAArC,EAAkE;AAChE,QAAMI,WAAW,GAAG,EAAC,GAAGJ,OAAJ;AAAahB,IAAAA,IAAI,EAAE,EAAC,GAAGD,2BAA2B,CAACC,IAAhC;AAAsC,UAAGgB,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEhB,IAAZ;AAAtC;AAAnB,GAApB;AACA,SAAOJ,aAAa,CAACgB,IAAD,EAAOQ,WAAP,CAApB;AACD;;AAED,SAASL,cAAT,CACEM,aADF,EAEEL,OAFF,EAGwB;AACtB,QAAMI,WAAW,GAAG,EAAC,GAAGJ,OAAJ;AAAahB,IAAAA,IAAI,EAAE,EAAC,GAAGD,2BAA2B,CAACC,IAAhC;AAAsC,UAAGgB,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEhB,IAAZ;AAAtC;AAAnB,GAApB;AACA,SAAOH,kBAAkB,CAACwB,aAAD,EAAgBD,WAAhB,CAAzB;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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"jsonl-loader.js"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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.
|