@loaders.gl/json 3.1.0-beta.3 → 3.1.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/bundle.js +885 -181
- 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 +781 -180
- 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
|
@@ -7,14 +7,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
10
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
15
|
|
|
12
16
|
var _clarinet = _interopRequireDefault(require("../clarinet/clarinet"));
|
|
13
17
|
|
|
14
18
|
var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
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 JSONParser = function () {
|
|
25
|
+
function JSONParser(options) {
|
|
26
|
+
var _this = this;
|
|
27
|
+
|
|
28
|
+
(0, _classCallCheck2.default)(this, JSONParser);
|
|
18
29
|
(0, _defineProperty2.default)(this, "parser", void 0);
|
|
19
30
|
(0, _defineProperty2.default)(this, "result", undefined);
|
|
20
31
|
(0, _defineProperty2.default)(this, "previousStates", []);
|
|
@@ -24,114 +35,125 @@ class JSONParser {
|
|
|
24
35
|
}));
|
|
25
36
|
(0, _defineProperty2.default)(this, "jsonpath", new _jsonpath.default());
|
|
26
37
|
this.reset();
|
|
27
|
-
this.parser = new _clarinet.default({
|
|
28
|
-
onready: ()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
this.parser = new _clarinet.default(_objectSpread({
|
|
39
|
+
onready: function onready() {
|
|
40
|
+
_this.jsonpath = new _jsonpath.default();
|
|
41
|
+
_this.previousStates.length = 0;
|
|
42
|
+
_this.currentState.container.length = 0;
|
|
32
43
|
},
|
|
33
|
-
onopenobject: name
|
|
34
|
-
|
|
44
|
+
onopenobject: function onopenobject(name) {
|
|
45
|
+
_this._openObject({});
|
|
35
46
|
|
|
36
47
|
if (typeof name !== 'undefined') {
|
|
37
|
-
|
|
48
|
+
_this.parser.emit('onkey', name);
|
|
38
49
|
}
|
|
39
50
|
},
|
|
40
|
-
onkey: name
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
onkey: function onkey(name) {
|
|
52
|
+
_this.jsonpath.set(name);
|
|
53
|
+
|
|
54
|
+
_this.currentState.key = name;
|
|
43
55
|
},
|
|
44
|
-
oncloseobject: ()
|
|
45
|
-
|
|
56
|
+
oncloseobject: function oncloseobject() {
|
|
57
|
+
_this._closeObject();
|
|
46
58
|
},
|
|
47
|
-
onopenarray: ()
|
|
48
|
-
|
|
59
|
+
onopenarray: function onopenarray() {
|
|
60
|
+
_this._openArray();
|
|
49
61
|
},
|
|
50
|
-
onclosearray: ()
|
|
51
|
-
|
|
62
|
+
onclosearray: function onclosearray() {
|
|
63
|
+
_this._closeArray();
|
|
52
64
|
},
|
|
53
|
-
onvalue: value
|
|
54
|
-
|
|
65
|
+
onvalue: function onvalue(value) {
|
|
66
|
+
_this._pushOrSet(value);
|
|
55
67
|
},
|
|
56
|
-
onerror: error
|
|
68
|
+
onerror: function onerror(error) {
|
|
57
69
|
throw error;
|
|
58
70
|
},
|
|
59
|
-
onend: ()
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
});
|
|
71
|
+
onend: function onend() {
|
|
72
|
+
_this.result = _this.currentState.container.pop();
|
|
73
|
+
}
|
|
74
|
+
}, options));
|
|
64
75
|
}
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
write(chunk) {
|
|
77
|
-
this.parser.write(chunk);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
close() {
|
|
81
|
-
this.parser.close();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_pushOrSet(value) {
|
|
85
|
-
const {
|
|
86
|
-
container,
|
|
87
|
-
key
|
|
88
|
-
} = this.currentState;
|
|
89
|
-
|
|
90
|
-
if (key !== null) {
|
|
91
|
-
container[key] = value;
|
|
92
|
-
this.currentState.key = null;
|
|
93
|
-
} else {
|
|
94
|
-
container.push(value);
|
|
77
|
+
(0, _createClass2.default)(JSONParser, [{
|
|
78
|
+
key: "reset",
|
|
79
|
+
value: function reset() {
|
|
80
|
+
this.result = undefined;
|
|
81
|
+
this.previousStates = [];
|
|
82
|
+
this.currentState = Object.freeze({
|
|
83
|
+
container: [],
|
|
84
|
+
key: null
|
|
85
|
+
});
|
|
86
|
+
this.jsonpath = new _jsonpath.default();
|
|
95
87
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "write",
|
|
90
|
+
value: function write(chunk) {
|
|
91
|
+
this.parser.write(chunk);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "close",
|
|
95
|
+
value: function close() {
|
|
96
|
+
this.parser.close();
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "_pushOrSet",
|
|
100
|
+
value: function _pushOrSet(value) {
|
|
101
|
+
var _this$currentState = this.currentState,
|
|
102
|
+
container = _this$currentState.container,
|
|
103
|
+
key = _this$currentState.key;
|
|
104
|
+
|
|
105
|
+
if (key !== null) {
|
|
106
|
+
container[key] = value;
|
|
107
|
+
this.currentState.key = null;
|
|
108
|
+
} else {
|
|
109
|
+
container.push(value);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "_openArray",
|
|
114
|
+
value: function _openArray() {
|
|
115
|
+
var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
116
|
+
this.jsonpath.push(null);
|
|
117
|
+
|
|
118
|
+
this._pushOrSet(newContainer);
|
|
119
|
+
|
|
120
|
+
this.previousStates.push(this.currentState);
|
|
121
|
+
this.currentState = {
|
|
122
|
+
container: newContainer,
|
|
123
|
+
isArray: true,
|
|
124
|
+
key: null
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
key: "_closeArray",
|
|
129
|
+
value: function _closeArray() {
|
|
130
|
+
this.jsonpath.pop();
|
|
131
|
+
this.currentState = this.previousStates.pop();
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "_openObject",
|
|
135
|
+
value: function _openObject() {
|
|
136
|
+
var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
137
|
+
this.jsonpath.push(null);
|
|
138
|
+
|
|
139
|
+
this._pushOrSet(newContainer);
|
|
140
|
+
|
|
141
|
+
this.previousStates.push(this.currentState);
|
|
142
|
+
this.currentState = {
|
|
143
|
+
container: newContainer,
|
|
144
|
+
isArray: false,
|
|
145
|
+
key: null
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "_closeObject",
|
|
150
|
+
value: function _closeObject() {
|
|
151
|
+
this.jsonpath.pop();
|
|
152
|
+
this.currentState = this.previousStates.pop();
|
|
153
|
+
}
|
|
154
|
+
}]);
|
|
155
|
+
return JSONParser;
|
|
156
|
+
}();
|
|
135
157
|
|
|
136
158
|
exports.default = JSONParser;
|
|
137
159
|
//# sourceMappingURL=json-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parser/json-parser.ts"],"names":["JSONParser","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/parser/json-parser.ts"],"names":["JSONParser","options","undefined","Object","freeze","container","key","JSONPath","reset","parser","ClarinetParser","onready","jsonpath","previousStates","length","currentState","onopenobject","name","_openObject","emit","onkey","set","oncloseobject","_closeObject","onopenarray","_openArray","onclosearray","_closeArray","onvalue","value","_pushOrSet","onerror","error","onend","result","pop","chunk","write","close","push","newContainer","isArray"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;;;;;IAIqBA,U;AAOnB,sBAAYC,OAAZ,EA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,GAAoB;AAACV,QAAAA,SAAS,EAAEmC,YAAZ;AAA0BC,QAAAA,OAAO,EAAE,IAAnC;AAAyCnC,QAAAA,GAAG,EAAE;AAA9C,OAApB;AACD;;;WAED,uBAAoB;AAClB,WAAKM,QAAL,CAAcuB,GAAd;AACA,WAAKpB,YAAL,GAAoB,KAAKF,cAAL,CAAoBsB,GAApB,EAApB;AACD;;;WAED,uBAAqC;AAAA,UAAzBK,YAAyB,uEAAV,EAAU;AACnC,WAAK5B,QAAL,CAAc2B,IAAd,CAAmB,IAAnB;;AACA,WAAKT,UAAL,CAAgBU,YAAhB;;AACA,WAAK3B,cAAL,CAAoB0B,IAApB,CAAyB,KAAKxB,YAA9B;AACA,WAAKA,YAAL,GAAoB;AAACV,QAAAA,SAAS,EAAEmC,YAAZ;AAA0BC,QAAAA,OAAO,EAAE,KAAnC;AAA0CnC,QAAAA,GAAG,EAAE;AAA/C,OAApB;AACD;;;WAED,wBAAqB;AACnB,WAAKM,QAAL,CAAcuB,GAAd;AACA,WAAKpB,YAAL,GAAoB,KAAKF,cAAL,CAAoBsB,GAApB,EAApB;AACD","sourcesContent":["// @ts-nocheck\n\nimport ClarinetParser, {ClarinetParserOptions} 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 readonly parser: ClarinetParser;\n result = undefined;\n previousStates = [];\n currentState = Object.freeze({container: [], key: null});\n jsonpath: JSONPath = new JSONPath();\n\n constructor(options: ClarinetParserOptions) {\n this.reset();\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.emit('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 ...options\n });\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"],"file":"json-parser.js"}
|
|
@@ -7,96 +7,152 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
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
|
+
|
|
10
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
27
|
|
|
12
28
|
var _jsonParser = _interopRequireDefault(require("./json-parser"));
|
|
13
29
|
|
|
14
30
|
var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
|
|
15
31
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.streamingArray = [];
|
|
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); }; }
|
|
24
39
|
|
|
25
|
-
|
|
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
|
+
onopenarray: function onopenarray() {
|
|
54
|
+
if (!_this.streamingArray) {
|
|
55
|
+
if (_this._matchJSONPath()) {
|
|
56
|
+
_this.streamingJsonPath = _this.getJsonPath().clone();
|
|
57
|
+
_this.streamingArray = [];
|
|
58
|
+
|
|
59
|
+
_this._openArray(_this.streamingArray);
|
|
26
60
|
|
|
27
61
|
return;
|
|
28
62
|
}
|
|
29
63
|
}
|
|
30
64
|
|
|
31
|
-
|
|
65
|
+
_this._openArray();
|
|
32
66
|
},
|
|
33
|
-
onopenobject: name
|
|
34
|
-
if (!
|
|
35
|
-
|
|
67
|
+
onopenobject: function onopenobject(name) {
|
|
68
|
+
if (!_this.topLevelObject) {
|
|
69
|
+
_this.topLevelObject = {};
|
|
36
70
|
|
|
37
|
-
|
|
71
|
+
_this._openObject(_this.topLevelObject);
|
|
38
72
|
} else {
|
|
39
|
-
|
|
73
|
+
_this._openObject({});
|
|
40
74
|
}
|
|
41
75
|
|
|
42
76
|
if (typeof name !== 'undefined') {
|
|
43
|
-
|
|
77
|
+
_this.parser.emit('onkey', name);
|
|
44
78
|
}
|
|
45
79
|
}
|
|
46
80
|
});
|
|
47
|
-
(0, _defineProperty2.default)(
|
|
48
|
-
(0, _defineProperty2.default)(
|
|
49
|
-
(0, _defineProperty2.default)(
|
|
50
|
-
(0, _defineProperty2.default)(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
super.write(chunk);
|
|
57
|
-
let array = [];
|
|
58
|
-
|
|
59
|
-
if (this.streamingArray) {
|
|
60
|
-
array = [...this.streamingArray];
|
|
61
|
-
this.streamingArray.length = 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return array;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getPartialResult() {
|
|
68
|
-
return this.topLevelObject;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getStreamingJsonPath() {
|
|
72
|
-
return this.streamingJsonPath;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getStreamingJsonPathAsString() {
|
|
76
|
-
return this.streamingJsonPath && this.streamingJsonPath.toString();
|
|
81
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "jsonPaths", void 0);
|
|
82
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "streamingJsonPath", null);
|
|
83
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "streamingArray", null);
|
|
84
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "topLevelObject", null);
|
|
85
|
+
var jsonpaths = options.jsonpaths || [];
|
|
86
|
+
_this.jsonPaths = jsonpaths.map(function (jsonpath) {
|
|
87
|
+
return new _jsonpath.default(jsonpath);
|
|
88
|
+
});
|
|
89
|
+
return _this;
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
(0, _createClass2.default)(StreamingJSONParser, [{
|
|
93
|
+
key: "write",
|
|
94
|
+
value: function write(chunk) {
|
|
95
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(StreamingJSONParser.prototype), "write", this).call(this, chunk);
|
|
96
|
+
var array = [];
|
|
82
97
|
|
|
83
|
-
|
|
84
|
-
|
|
98
|
+
if (this.streamingArray) {
|
|
99
|
+
array = (0, _toConsumableArray2.default)(this.streamingArray);
|
|
100
|
+
this.streamingArray.length = 0;
|
|
101
|
+
}
|
|
85
102
|
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
return array;
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "getPartialResult",
|
|
107
|
+
value: function getPartialResult() {
|
|
108
|
+
return this.topLevelObject;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "getStreamingJsonPath",
|
|
112
|
+
value: function getStreamingJsonPath() {
|
|
113
|
+
return this.streamingJsonPath;
|
|
88
114
|
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "getStreamingJsonPathAsString",
|
|
117
|
+
value: function getStreamingJsonPathAsString() {
|
|
118
|
+
return this.streamingJsonPath && this.streamingJsonPath.toString();
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "getJsonPath",
|
|
122
|
+
value: function getJsonPath() {
|
|
123
|
+
return this.jsonpath;
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "_matchJSONPath",
|
|
127
|
+
value: function _matchJSONPath() {
|
|
128
|
+
var currentPath = this.getJsonPath();
|
|
89
129
|
|
|
90
|
-
|
|
91
|
-
if (jsonPath.equals(currentPath)) {
|
|
130
|
+
if (this.jsonPaths.length === 0) {
|
|
92
131
|
return true;
|
|
93
132
|
}
|
|
94
|
-
}
|
|
95
133
|
|
|
96
|
-
|
|
97
|
-
|
|
134
|
+
var _iterator = _createForOfIteratorHelper(this.jsonPaths),
|
|
135
|
+
_step;
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
139
|
+
var jsonPath = _step.value;
|
|
98
140
|
|
|
99
|
-
|
|
141
|
+
if (jsonPath.equals(currentPath)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
} catch (err) {
|
|
146
|
+
_iterator.e(err);
|
|
147
|
+
} finally {
|
|
148
|
+
_iterator.f();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}]);
|
|
154
|
+
return StreamingJSONParser;
|
|
155
|
+
}(_jsonParser.default);
|
|
100
156
|
|
|
101
157
|
exports.default = StreamingJSONParser;
|
|
102
158
|
//# sourceMappingURL=streaming-json-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parser/streaming-json-parser.ts"],"names":["StreamingJSONParser","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/parser/streaming-json-parser.ts"],"names":["StreamingJSONParser","options","onopenarray","streamingArray","_matchJSONPath","streamingJsonPath","getJsonPath","clone","_openArray","onopenobject","name","topLevelObject","_openObject","parser","emit","jsonpaths","jsonPaths","map","jsonpath","JSONPath","chunk","array","length","toString","currentPath","jsonPath","equals","JSONParser"],"mappings":";;;;;;;;;;;;;;;;;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cAAL,CAAoBmB,MAApB,GAA6B,CAA7B;AACD;;AACD,aAAOD,KAAP;AACD;;;WAOD,4BAAmB;AACjB,aAAO,KAAKV,cAAZ;AACD;;;WAED,gCAAuB;AACrB,aAAO,KAAKN,iBAAZ;AACD;;;WAED,wCAA+B;AAC7B,aAAO,KAAKA,iBAAL,IAA0B,KAAKA,iBAAL,CAAuBkB,QAAvB,EAAjC;AACD;;;WAED,uBAAc;AACZ,aAAO,KAAKL,QAAZ;AACD;;;WAOD,0BAAiB;AACf,UAAMM,WAAW,GAAG,KAAKlB,WAAL,EAApB;;AAKA,UAAI,KAAKU,SAAL,CAAeM,MAAf,KAA0B,CAA9B,EAAiC;AAC/B,eAAO,IAAP;AACD;;AARc,iDAUQ,KAAKN,SAVb;AAAA;;AAAA;AAUf,4DAAuC;AAAA,cAA5BS,QAA4B;;AACrC,cAAIA,QAAQ,CAACC,MAAT,CAAgBF,WAAhB,CAAJ,EAAkC;AAChC,mBAAO,IAAP;AACD;AACF;AAdc;AAAA;AAAA;AAAA;AAAA;;AAgBf,aAAO,KAAP;AACD;;;EAnG8CG,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 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 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.emit('onkey', name);\n }\n }\n });\n const jsonpaths = options.jsonpaths || [];\n this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));\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"],"file":"streaming-json-parser.js"}
|
|
@@ -7,12 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports._typecheckNDJSONLoader = exports.NDJSONLoader = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _parseNdjson = _interopRequireDefault(require("./lib/parse-ndjson"));
|
|
11
15
|
|
|
12
16
|
var _parseNdjsonInBatches = _interopRequireDefault(require("./lib/parse-ndjson-in-batches"));
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
var VERSION = typeof "3.1.1" !== 'undefined' ? "3.1.1" : 'latest';
|
|
19
|
+
var NDJSONLoader = {
|
|
16
20
|
name: 'NDJSON',
|
|
17
21
|
id: 'ndjson',
|
|
18
22
|
module: 'json',
|
|
@@ -21,15 +25,33 @@ const NDJSONLoader = {
|
|
|
21
25
|
mimeTypes: ['application/x-ndjson'],
|
|
22
26
|
category: 'table',
|
|
23
27
|
text: true,
|
|
24
|
-
parse,
|
|
25
|
-
parseTextSync,
|
|
26
|
-
parseInBatches,
|
|
28
|
+
parse: parse,
|
|
29
|
+
parseTextSync: parseTextSync,
|
|
30
|
+
parseInBatches: parseInBatches,
|
|
27
31
|
options: {}
|
|
28
32
|
};
|
|
29
33
|
exports.NDJSONLoader = NDJSONLoader;
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
return
|
|
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);
|
|
33
55
|
}
|
|
34
56
|
|
|
35
57
|
function parseTextSync(text) {
|
|
@@ -40,6 +62,6 @@ function parseInBatches(asyncIterator, options) {
|
|
|
40
62
|
return (0, _parseNdjsonInBatches.default)(asyncIterator, options);
|
|
41
63
|
}
|
|
42
64
|
|
|
43
|
-
|
|
65
|
+
var _typecheckNDJSONLoader = NDJSONLoader;
|
|
44
66
|
exports._typecheckNDJSONLoader = _typecheckNDJSONLoader;
|
|
45
67
|
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
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","_typecheckNDJSONLoader"],"mappings":"
|
|
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","_typecheckNDJSONLoader"],"mappings":";;;;;;;;;;;;;AAEA;;AACA;;AAIA,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AAEO,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEL,OAJiB;AAK1BM,EAAAA,UAAU,EAAE,CAAC,QAAD,CALc;AAM1BC,EAAAA,SAAS,EAAE,CAAC,sBAAD,CANe;AAO1BC,EAAAA,QAAQ,EAAE,OAPgB;AAQ1BC,EAAAA,IAAI,EAAE,IARoB;AAS1BC,EAAAA,KAAK,EAALA,KAT0B;AAU1BC,EAAAA,aAAa,EAAbA,aAV0B;AAW1BC,EAAAA,cAAc,EAAdA,cAX0B;AAY1BC,EAAAA,OAAO,EAAE;AAZiB,CAArB;;;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;;AAEM,IAAMK,sBAAwC,GAAGjB,YAAjD","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 = {\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\nexport const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;\n"],"file":"ndjson-loader.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import parseJSONSync from './lib/parse-json';
|
|
3
3
|
import parseJSONInBatches from './lib/parse-json-in-batches';
|
|
4
|
-
const VERSION = typeof "3.1.
|
|
4
|
+
const VERSION = typeof "3.1.1" !== 'undefined' ? "3.1.1" : 'latest';
|
|
5
5
|
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
6
6
|
geojson: {
|
|
7
7
|
shape: 'object-row-table'
|