@loaders.gl/json 3.3.0-alpha.5 → 3.3.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/dist.min.js +16 -10
  2. package/dist/es5/bundle.js +0 -1
  3. package/dist/es5/bundle.js.map +1 -1
  4. package/dist/es5/geojson-loader.js +34 -82
  5. package/dist/es5/geojson-loader.js.map +1 -1
  6. package/dist/es5/index.js +6 -13
  7. package/dist/es5/index.js.map +1 -1
  8. package/dist/es5/json-loader.js +4 -18
  9. package/dist/es5/json-loader.js.map +1 -1
  10. package/dist/es5/lib/clarinet/clarinet.js +19 -91
  11. package/dist/es5/lib/clarinet/clarinet.js.map +1 -1
  12. package/dist/es5/lib/jsonpath/jsonpath.js +8 -28
  13. package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -1
  14. package/dist/es5/lib/parse-json-in-batches.js +59 -126
  15. package/dist/es5/lib/parse-json-in-batches.js.map +1 -1
  16. package/dist/es5/lib/parse-json.js +0 -10
  17. package/dist/es5/lib/parse-json.js.map +1 -1
  18. package/dist/es5/lib/parse-ndjson-in-batches.js +41 -83
  19. package/dist/es5/lib/parse-ndjson-in-batches.js.map +1 -1
  20. package/dist/es5/lib/parse-ndjson.js +0 -1
  21. package/dist/es5/lib/parse-ndjson.js.map +1 -1
  22. package/dist/es5/lib/parser/json-parser.js +8 -24
  23. package/dist/es5/lib/parser/json-parser.js.map +1 -1
  24. package/dist/es5/lib/parser/streaming-json-parser.js +10 -37
  25. package/dist/es5/lib/parser/streaming-json-parser.js.map +1 -1
  26. package/dist/es5/ndjgeoson-loader.js +3 -11
  27. package/dist/es5/ndjgeoson-loader.js.map +1 -1
  28. package/dist/es5/ndjson-loader.js +3 -11
  29. package/dist/es5/ndjson-loader.js.map +1 -1
  30. package/dist/es5/workers/geojson-worker.js +0 -2
  31. package/dist/es5/workers/geojson-worker.js.map +1 -1
  32. package/dist/esm/bundle.js +1 -1
  33. package/dist/esm/bundle.js.map +1 -1
  34. package/dist/esm/geojson-loader.js +13 -14
  35. package/dist/esm/geojson-loader.js.map +1 -1
  36. package/dist/esm/index.js +1 -0
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/json-loader.js +12 -8
  39. package/dist/esm/json-loader.js.map +1 -1
  40. package/dist/esm/lib/clarinet/clarinet.js +19 -108
  41. package/dist/esm/lib/clarinet/clarinet.js.map +1 -1
  42. package/dist/esm/lib/jsonpath/jsonpath.js +2 -18
  43. package/dist/esm/lib/jsonpath/jsonpath.js.map +1 -1
  44. package/dist/esm/lib/parse-json-in-batches.js +5 -10
  45. package/dist/esm/lib/parse-json-in-batches.js.map +1 -1
  46. package/dist/esm/lib/parse-json.js +0 -7
  47. package/dist/esm/lib/parse-json.js.map +1 -1
  48. package/dist/esm/lib/parse-ndjson-in-batches.js +2 -5
  49. package/dist/esm/lib/parse-ndjson-in-batches.js.map +1 -1
  50. package/dist/esm/lib/parse-ndjson.js.map +1 -1
  51. package/dist/esm/lib/parser/json-parser.js +6 -21
  52. package/dist/esm/lib/parser/json-parser.js.map +1 -1
  53. package/dist/esm/lib/parser/streaming-json-parser.js +3 -19
  54. package/dist/esm/lib/parser/streaming-json-parser.js.map +1 -1
  55. package/dist/esm/ndjgeoson-loader.js +4 -2
  56. package/dist/esm/ndjgeoson-loader.js.map +1 -1
  57. package/dist/esm/ndjson-loader.js +4 -2
  58. package/dist/esm/ndjson-loader.js.map +1 -1
  59. package/dist/esm/workers/geojson-worker.js.map +1 -1
  60. package/dist/geojson-worker.js +10 -11
  61. package/package.json +5 -5
@@ -1,38 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = parseNDJSONInBatches;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
15
-
16
11
  var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
17
-
18
- var _asyncIterator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncIterator"));
19
-
20
12
  var _schema = require("@loaders.gl/schema");
21
-
22
13
  var _loaderUtils = require("@loaders.gl/loader-utils");
23
-
24
- 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; }
25
-
26
- 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; }
27
-
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
+ function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
17
+ function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
28
18
  function parseNDJSONInBatches(_x, _x2) {
29
19
  return _parseNDJSONInBatches.apply(this, arguments);
30
20
  }
31
-
32
21
  function _parseNDJSONInBatches() {
33
22
  _parseNDJSONInBatches = (0, _wrapAsyncGenerator2.default)(_regenerator.default.mark(function _callee(binaryAsyncIterator, options) {
34
- var textIterator, lineIterator, numberedLineIterator, schema, shape, tableBatchBuilder, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, _value2, counter, line, row, _batch, batch;
35
-
23
+ var textIterator, lineIterator, numberedLineIterator, schema, shape, tableBatchBuilder, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, counter, line, row, _batch, batch;
36
24
  return _regenerator.default.wrap(function _callee$(_context) {
37
25
  while (1) {
38
26
  switch (_context.prev = _context.next) {
@@ -45,113 +33,83 @@ function _parseNDJSONInBatches() {
45
33
  tableBatchBuilder = new _schema.TableBatchBuilder(schema, _objectSpread(_objectSpread({}, options), {}, {
46
34
  shape: shape
47
35
  }));
48
- _iteratorNormalCompletion = true;
36
+ _iteratorAbruptCompletion = false;
49
37
  _didIteratorError = false;
50
38
  _context.prev = 8;
51
- _iterator = (0, _asyncIterator2.default)(numberedLineIterator);
52
-
39
+ _iterator = _asyncIterator(numberedLineIterator);
53
40
  case 10:
54
41
  _context.next = 12;
55
42
  return (0, _awaitAsyncGenerator2.default)(_iterator.next());
56
-
57
43
  case 12:
58
- _step = _context.sent;
59
- _iteratorNormalCompletion = _step.done;
60
- _context.next = 16;
61
- return (0, _awaitAsyncGenerator2.default)(_step.value);
62
-
63
- case 16:
64
- _value = _context.sent;
65
-
66
- if (_iteratorNormalCompletion) {
67
- _context.next = 35;
44
+ if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
45
+ _context.next = 30;
68
46
  break;
69
47
  }
70
-
71
- _value2 = _value, counter = _value2.counter, line = _value2.line;
72
- _context.prev = 19;
48
+ _step$value = _step.value, counter = _step$value.counter, line = _step$value.line;
49
+ _context.prev = 14;
73
50
  row = JSON.parse(line);
74
51
  tableBatchBuilder.addRow(row);
75
52
  tableBatchBuilder.chunkComplete(line);
76
53
  _batch = tableBatchBuilder.getFullBatch();
77
-
78
54
  if (!_batch) {
79
- _context.next = 27;
55
+ _context.next = 22;
80
56
  break;
81
57
  }
82
-
83
- _context.next = 27;
58
+ _context.next = 22;
84
59
  return _batch;
85
-
86
- case 27:
87
- _context.next = 32;
60
+ case 22:
61
+ _context.next = 27;
88
62
  break;
89
-
90
- case 29:
91
- _context.prev = 29;
92
- _context.t0 = _context["catch"](19);
63
+ case 24:
64
+ _context.prev = 24;
65
+ _context.t0 = _context["catch"](14);
93
66
  throw new Error("NDJSONLoader: failed to parse JSON on line ".concat(counter));
94
-
95
- case 32:
96
- _iteratorNormalCompletion = true;
67
+ case 27:
68
+ _iteratorAbruptCompletion = false;
97
69
  _context.next = 10;
98
70
  break;
99
-
100
- case 35:
101
- _context.next = 41;
71
+ case 30:
72
+ _context.next = 36;
102
73
  break;
103
-
104
- case 37:
105
- _context.prev = 37;
74
+ case 32:
75
+ _context.prev = 32;
106
76
  _context.t1 = _context["catch"](8);
107
77
  _didIteratorError = true;
108
78
  _iteratorError = _context.t1;
109
-
110
- case 41:
111
- _context.prev = 41;
112
- _context.prev = 42;
113
-
114
- if (!(!_iteratorNormalCompletion && _iterator.return != null)) {
115
- _context.next = 46;
79
+ case 36:
80
+ _context.prev = 36;
81
+ _context.prev = 37;
82
+ if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
83
+ _context.next = 41;
116
84
  break;
117
85
  }
118
-
119
- _context.next = 46;
86
+ _context.next = 41;
120
87
  return (0, _awaitAsyncGenerator2.default)(_iterator.return());
121
-
122
- case 46:
123
- _context.prev = 46;
124
-
88
+ case 41:
89
+ _context.prev = 41;
125
90
  if (!_didIteratorError) {
126
- _context.next = 49;
91
+ _context.next = 44;
127
92
  break;
128
93
  }
129
-
130
94
  throw _iteratorError;
131
-
132
- case 49:
133
- return _context.finish(46);
134
-
135
- case 50:
95
+ case 44:
136
96
  return _context.finish(41);
137
-
138
- case 51:
97
+ case 45:
98
+ return _context.finish(36);
99
+ case 46:
139
100
  batch = tableBatchBuilder.getFinalBatch();
140
-
141
101
  if (!batch) {
142
- _context.next = 55;
102
+ _context.next = 50;
143
103
  break;
144
104
  }
145
-
146
- _context.next = 55;
105
+ _context.next = 50;
147
106
  return batch;
148
-
149
- case 55:
107
+ case 50:
150
108
  case "end":
151
109
  return _context.stop();
152
110
  }
153
111
  }
154
- }, _callee, null, [[8, 37, 41, 51], [19, 29], [42,, 46, 50]]);
112
+ }, _callee, null, [[8, 32, 36, 46], [14, 24], [37,, 41, 45]]);
155
113
  }));
156
114
  return _parseNDJSONInBatches.apply(this, arguments);
157
115
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/parse-ndjson-in-batches.ts"],"names":["parseNDJSONInBatches","binaryAsyncIterator","options","textIterator","lineIterator","numberedLineIterator","schema","shape","tableBatchBuilder","TableBatchBuilder","counter","line","row","JSON","parse","addRow","chunkComplete","batch","getFullBatch","Error","getFinalBatch"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;;;;;SAO+BA,oB;;;;;sFAAhB,iBACbC,mBADa,EAEbC,OAFa;AAAA;;AAAA;AAAA;AAAA;AAAA;AAIPC,YAAAA,YAJO,GAIQ,0CAAwBF,mBAAxB,CAJR;AAKPG,YAAAA,YALO,GAKQ,mCAAiBD,YAAjB,CALR;AAMPE,YAAAA,oBANO,GAMgB,2CAAyBD,YAAzB,CANhB;AAQPE,YAAAA,MARO,GAQE,IARF;AASPC,YAAAA,KATO,GASC,WATD;AAWPC,YAAAA,iBAXO,GAWa,IAAIC,yBAAJ,CAAsBH,MAAtB,kCACrBJ,OADqB;AAExBK,cAAAA,KAAK,EAALA;AAFwB,eAXb;AAAA;AAAA;AAAA;AAAA,qDAgBuBF,oBAhBvB;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA,8BAgBKK,OAhBL,WAgBKA,OAhBL,EAgBcC,IAhBd,WAgBcA,IAhBd;AAAA;AAkBHC,YAAAA,GAlBG,GAkBGC,IAAI,CAACC,KAAL,CAAWH,IAAX,CAlBH;AAmBTH,YAAAA,iBAAiB,CAACO,MAAlB,CAAyBH,GAAzB;AACAJ,YAAAA,iBAAiB,CAACQ,aAAlB,CAAgCL,IAAhC;AACMM,YAAAA,MArBG,GAqBKT,iBAAiB,CAACU,YAAlB,EArBL;;AAAA,iBAsBLD,MAtBK;AAAA;AAAA;AAAA;;AAAA;AAuBP,mBAAMA,MAAN;;AAvBO;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA,kBA0BH,IAAIE,KAAJ,sDAAwDT,OAAxD,EA1BG;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AA8BPO,YAAAA,KA9BO,GA8BCT,iBAAiB,CAACY,aAAlB,EA9BD;;AAAA,iBA+BTH,KA/BS;AAAA;AAAA;AAAA;;AAAA;AAgCX,mBAAMA,KAAN;;AAhCW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {\n LoaderOptions,\n makeLineIterator,\n makeNumberedLineIterator,\n makeTextDecoderIterator\n} from '@loaders.gl/loader-utils';\n\nexport default async function* parseNDJSONInBatches(\n binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptions\n): AsyncIterable<Batch> {\n const textIterator = makeTextDecoderIterator(binaryAsyncIterator);\n const lineIterator = makeLineIterator(textIterator);\n const numberedLineIterator = makeNumberedLineIterator(lineIterator);\n\n const schema = null;\n const shape = 'row-table';\n // @ts-ignore\n const tableBatchBuilder = new TableBatchBuilder(schema, {\n ...options,\n shape\n });\n\n for await (const {counter, line} of numberedLineIterator) {\n try {\n const row = JSON.parse(line);\n tableBatchBuilder.addRow(row);\n tableBatchBuilder.chunkComplete(line);\n const batch = tableBatchBuilder.getFullBatch();\n if (batch) {\n yield batch;\n }\n } catch (error) {\n throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter}`);\n }\n }\n\n const batch = tableBatchBuilder.getFinalBatch();\n if (batch) {\n yield batch;\n }\n}\n"],"file":"parse-ndjson-in-batches.js"}
1
+ {"version":3,"file":"parse-ndjson-in-batches.js","names":["parseNDJSONInBatches","binaryAsyncIterator","options","textIterator","makeTextDecoderIterator","lineIterator","makeLineIterator","numberedLineIterator","makeNumberedLineIterator","schema","shape","tableBatchBuilder","TableBatchBuilder","counter","line","row","JSON","parse","addRow","chunkComplete","batch","getFullBatch","Error","getFinalBatch"],"sources":["../../../src/lib/parse-ndjson-in-batches.ts"],"sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport {TableBatchBuilder} from '@loaders.gl/schema';\nimport {\n LoaderOptions,\n makeLineIterator,\n makeNumberedLineIterator,\n makeTextDecoderIterator\n} from '@loaders.gl/loader-utils';\n\nexport default async function* parseNDJSONInBatches(\n binaryAsyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptions\n): AsyncIterable<Batch> {\n const textIterator = makeTextDecoderIterator(binaryAsyncIterator);\n const lineIterator = makeLineIterator(textIterator);\n const numberedLineIterator = makeNumberedLineIterator(lineIterator);\n\n const schema = null;\n const shape = 'row-table';\n // @ts-ignore\n const tableBatchBuilder = new TableBatchBuilder(schema, {\n ...options,\n shape\n });\n\n for await (const {counter, line} of numberedLineIterator) {\n try {\n const row = JSON.parse(line);\n tableBatchBuilder.addRow(row);\n tableBatchBuilder.chunkComplete(line);\n const batch = tableBatchBuilder.getFullBatch();\n if (batch) {\n yield batch;\n }\n } catch (error) {\n throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter}`);\n }\n }\n\n const batch = tableBatchBuilder.getFinalBatch();\n if (batch) {\n yield batch;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;AACA;AAKkC;AAAA;AAAA;AAAA;AAAA,SAEHA,oBAAoB;EAAA;AAAA;AAAA;EAAA,oFAApC,iBACbC,mBAAuE,EACvEC,OAAuB;IAAA;IAAA;MAAA;QAAA;UAAA;YAEjBC,YAAY,GAAG,IAAAC,oCAAuB,EAACH,mBAAmB,CAAC;YAC3DI,YAAY,GAAG,IAAAC,6BAAgB,EAACH,YAAY,CAAC;YAC7CI,oBAAoB,GAAG,IAAAC,qCAAwB,EAACH,YAAY,CAAC;YAE7DI,MAAM,GAAG,IAAI;YACbC,KAAK,GAAG,WAAW;YAEnBC,iBAAiB,GAAG,IAAIC,yBAAiB,CAACH,MAAM,kCACjDP,OAAO;cACVQ,KAAK,EAALA;YAAK,GACL;YAAA;YAAA;YAAA;YAAA,2BAEkCH,oBAAoB;UAAA;YAAA;YAAA;UAAA;YAAA;cAAA;cAAA;YAAA;YAAA,2BAAtCM,OAAO,eAAPA,OAAO,EAAEC,IAAI,eAAJA,IAAI;YAAA;YAErBC,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;YAC5BH,iBAAiB,CAACO,MAAM,CAACH,GAAG,CAAC;YAC7BJ,iBAAiB,CAACQ,aAAa,CAACL,IAAI,CAAC;YAC/BM,MAAK,GAAGT,iBAAiB,CAACU,YAAY,EAAE;YAAA,KAC1CD,MAAK;cAAA;cAAA;YAAA;YAAA;YACP,OAAMA,MAAK;UAAA;YAAA;YAAA;UAAA;YAAA;YAAA;YAAA,MAGP,IAAIE,KAAK,sDAA+CT,OAAO,EAAG;UAAA;YAAA;YAAA;YAAA;UAAA;YAAA;YAAA;UAAA;YAAA;YAAA;YAAA;YAAA;UAAA;YAAA;YAAA;YAAA;cAAA;cAAA;YAAA;YAAA;YAAA;UAAA;YAAA;YAAA;cAAA;cAAA;YAAA;YAAA;UAAA;YAAA;UAAA;YAAA;UAAA;YAItEO,KAAK,GAAGT,iBAAiB,CAACY,aAAa,EAAE;YAAA,KAC3CH,KAAK;cAAA;cAAA;YAAA;YAAA;YACP,OAAMA,KAAK;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAEd;EAAA;AAAA"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = parseNDJSONSync;
7
-
8
7
  function parseNDJSONSync(ndjsonText) {
9
8
  var lines = ndjsonText.trim().split('\n');
10
9
  return lines.map(function (line, counter) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/parse-ndjson.ts"],"names":["parseNDJSONSync","ndjsonText","lines","trim","split","map","line","counter","JSON","parse","error","Error"],"mappings":";;;;;;;AAAe,SAASA,eAAT,CAAyBC,UAAzB,EAA6C;AAC1D,MAAMC,KAAK,GAAGD,UAAU,CAACE,IAAX,GAAkBC,KAAlB,CAAwB,IAAxB,CAAd;AACA,SAAOF,KAAK,CAACG,GAAN,CAAU,UAACC,IAAD,EAAOC,OAAP,EAAmB;AAClC,QAAI;AACF,aAAOC,IAAI,CAACC,KAAL,CAAWH,IAAX,CAAP;AACD,KAFD,CAEE,OAAOI,KAAP,EAAc;AACd,YAAM,IAAIC,KAAJ,sDAAwDJ,OAAO,GAAG,CAAlE,EAAN;AACD;AACF,GANM,CAAP;AAOD","sourcesContent":["export default function parseNDJSONSync(ndjsonText: string) {\n const lines = ndjsonText.trim().split('\\n');\n return lines.map((line, counter) => {\n try {\n return JSON.parse(line);\n } catch (error) {\n throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter + 1}`);\n }\n });\n}\n"],"file":"parse-ndjson.js"}
1
+ {"version":3,"file":"parse-ndjson.js","names":["parseNDJSONSync","ndjsonText","lines","trim","split","map","line","counter","JSON","parse","error","Error"],"sources":["../../../src/lib/parse-ndjson.ts"],"sourcesContent":["export default function parseNDJSONSync(ndjsonText: string) {\n const lines = ndjsonText.trim().split('\\n');\n return lines.map((line, counter) => {\n try {\n return JSON.parse(line);\n } catch (error) {\n throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter + 1}`);\n }\n });\n}\n"],"mappings":";;;;;;AAAe,SAASA,eAAe,CAACC,UAAkB,EAAE;EAC1D,IAAMC,KAAK,GAAGD,UAAU,CAACE,IAAI,EAAE,CAACC,KAAK,CAAC,IAAI,CAAC;EAC3C,OAAOF,KAAK,CAACG,GAAG,CAAC,UAACC,IAAI,EAAEC,OAAO,EAAK;IAClC,IAAI;MACF,OAAOC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOI,KAAK,EAAE;MACd,MAAM,IAAIC,KAAK,sDAA+CJ,OAAO,GAAG,CAAC,EAAG;IAC9E;EACF,CAAC,CAAC;AACJ"}
@@ -1,30 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
11
  var _clarinet = _interopRequireDefault(require("../clarinet/clarinet"));
17
-
18
12
  var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
19
-
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
-
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
15
  var JSONParser = function () {
25
16
  function JSONParser(options) {
26
17
  var _this = this;
27
-
28
18
  (0, _classCallCheck2.default)(this, JSONParser);
29
19
  (0, _defineProperty2.default)(this, "parser", void 0);
30
20
  (0, _defineProperty2.default)(this, "result", undefined);
@@ -43,14 +33,12 @@ var JSONParser = function () {
43
33
  },
44
34
  onopenobject: function onopenobject(name) {
45
35
  _this._openObject({});
46
-
47
36
  if (typeof name !== 'undefined') {
48
37
  _this.parser.emit('onkey', name);
49
38
  }
50
39
  },
51
40
  onkey: function onkey(name) {
52
41
  _this.jsonpath.set(name);
53
-
54
42
  _this.currentState.key = name;
55
43
  },
56
44
  oncloseobject: function oncloseobject() {
@@ -73,7 +61,6 @@ var JSONParser = function () {
73
61
  }
74
62
  }, options));
75
63
  }
76
-
77
64
  (0, _createClass2.default)(JSONParser, [{
78
65
  key: "reset",
79
66
  value: function reset() {
@@ -95,13 +82,15 @@ var JSONParser = function () {
95
82
  value: function close() {
96
83
  this.parser.close();
97
84
  }
85
+
98
86
  }, {
99
87
  key: "_pushOrSet",
100
- value: function _pushOrSet(value) {
101
- var _this$currentState = this.currentState,
102
- container = _this$currentState.container,
103
- key = _this$currentState.key;
88
+ value:
104
89
 
90
+ function _pushOrSet(value) {
91
+ var _this$currentState = this.currentState,
92
+ container = _this$currentState.container,
93
+ key = _this$currentState.key;
105
94
  if (key !== null) {
106
95
  container[key] = value;
107
96
  this.currentState.key = null;
@@ -114,9 +103,7 @@ var JSONParser = function () {
114
103
  value: function _openArray() {
115
104
  var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
116
105
  this.jsonpath.push(null);
117
-
118
106
  this._pushOrSet(newContainer);
119
-
120
107
  this.previousStates.push(this.currentState);
121
108
  this.currentState = {
122
109
  container: newContainer,
@@ -135,9 +122,7 @@ var JSONParser = function () {
135
122
  value: function _openObject() {
136
123
  var newContainer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
137
124
  this.jsonpath.push(null);
138
-
139
125
  this._pushOrSet(newContainer);
140
-
141
126
  this.previousStates.push(this.currentState);
142
127
  this.currentState = {
143
128
  container: newContainer,
@@ -154,6 +139,5 @@ var JSONParser = function () {
154
139
  }]);
155
140
  return JSONParser;
156
141
  }();
157
-
158
142
  exports.default = JSONParser;
159
143
  //# sourceMappingURL=json-parser.js.map
@@ -1 +1 @@
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,EAA4C;AAAA;;AAAA;AAAA;AAAA,kDALnCC,SAKmC;AAAA,0DAJ3B,EAI2B;AAAA,wDAH7BC,MAAM,CAACC,MAAP,CAAc;AAACC,MAAAA,SAAS,EAAE,EAAZ;AAAgBC,MAAAA,GAAG,EAAE;AAArB,KAAd,CAG6B;AAAA,oDAFvB,IAAIC,iBAAJ,EAEuB;AAC1C,SAAKC,KAAL;AACA,SAAKC,MAAL,GAAc,IAAIC,iBAAJ;AACZC,MAAAA,OAAO,EAAE,mBAAM;AACb,QAAA,KAAI,CAACC,QAAL,GAAgB,IAAIL,iBAAJ,EAAhB;AAC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A,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"}
1
+ {"version":3,"file":"json-parser.js","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"],"sources":["../../../../src/lib/parser/json-parser.ts"],"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"],"mappings":";;;;;;;;;;AAEA;AACA;AAA4C;AAAA;AAAA,IAIvBA,UAAU;EAO7B,oBAAYC,OAA8B,EAAE;IAAA;IAAA;IAAA;IAAA,8CALnCC,SAAS;IAAA,sDACD,EAAE;IAAA,oDACJC,MAAM,CAACC,MAAM,CAAC;MAACC,SAAS,EAAE,EAAE;MAAEC,GAAG,EAAE;IAAI,CAAC,CAAC;IAAA,gDACnC,IAAIC,iBAAQ,EAAE;IAGjC,IAAI,CAACC,KAAK,EAAE;IACZ,IAAI,CAACC,MAAM,GAAG,IAAIC,iBAAc;MAC9BC,OAAO,EAAE,mBAAM;QACb,KAAI,CAACC,QAAQ,GAAG,IAAIL,iBAAQ,EAAE;QAC9B,KAAI,CAACM,cAAc,CAACC,MAAM,GAAG,CAAC;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7B,IAAI,CAAC3B,cAAc,CAAC0B,IAAI,CAAC,IAAI,CAACxB,YAAY,CAAC;MAC3C,IAAI,CAACA,YAAY,GAAG;QAACV,SAAS,EAAEmC,YAAY;QAAEC,OAAO,EAAE,KAAK;QAAEnC,GAAG,EAAE;MAAI,CAAC;IAC1E;EAAC;IAAA;IAAA,OAED,wBAAqB;MACnB,IAAI,CAACM,QAAQ,CAACuB,GAAG,EAAE;MACnB,IAAI,CAACpB,YAAY,GAAG,IAAI,CAACF,cAAc,CAACsB,GAAG,EAAE;IAC/C;EAAC;EAAA;AAAA;AAAA"}
@@ -1,52 +1,31 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
12
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
-
20
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
-
22
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
-
24
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
-
26
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
17
  var _jsonParser = _interopRequireDefault(require("./json-parser"));
29
-
30
18
  var _jsonpath = _interopRequireDefault(require("../jsonpath/jsonpath"));
31
-
32
19
  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
20
  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
21
  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
22
  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
23
  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
24
  var StreamingJSONParser = function (_JSONParser) {
43
25
  (0, _inherits2.default)(StreamingJSONParser, _JSONParser);
44
-
45
26
  var _super = _createSuper(StreamingJSONParser);
46
-
47
27
  function StreamingJSONParser() {
48
28
  var _this;
49
-
50
29
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
51
30
  (0, _classCallCheck2.default)(this, StreamingJSONParser);
52
31
  _this = _super.call(this, {
@@ -55,24 +34,19 @@ var StreamingJSONParser = function (_JSONParser) {
55
34
  if (_this._matchJSONPath()) {
56
35
  _this.streamingJsonPath = _this.getJsonPath().clone();
57
36
  _this.streamingArray = [];
58
-
59
37
  _this._openArray(_this.streamingArray);
60
-
61
38
  return;
62
39
  }
63
40
  }
64
-
65
41
  _this._openArray();
66
42
  },
67
43
  onopenobject: function onopenobject(name) {
68
44
  if (!_this.topLevelObject) {
69
45
  _this.topLevelObject = {};
70
-
71
46
  _this._openObject(_this.topLevelObject);
72
47
  } else {
73
48
  _this._openObject({});
74
49
  }
75
-
76
50
  if (typeof name !== 'undefined') {
77
51
  _this.parser.emit('onkey', name);
78
52
  }
@@ -91,20 +65,21 @@ var StreamingJSONParser = function (_JSONParser) {
91
65
 
92
66
  (0, _createClass2.default)(StreamingJSONParser, [{
93
67
  key: "write",
94
- value: function write(chunk) {
68
+ value:
69
+ function write(chunk) {
95
70
  (0, _get2.default)((0, _getPrototypeOf2.default)(StreamingJSONParser.prototype), "write", this).call(this, chunk);
96
71
  var array = [];
97
-
98
72
  if (this.streamingArray) {
99
73
  array = (0, _toConsumableArray2.default)(this.streamingArray);
100
74
  this.streamingArray.length = 0;
101
75
  }
102
-
103
76
  return array;
104
77
  }
78
+
105
79
  }, {
106
80
  key: "getPartialResult",
107
- value: function getPartialResult() {
81
+ value:
82
+ function getPartialResult() {
108
83
  return this.topLevelObject;
109
84
  }
110
85
  }, {
@@ -122,22 +97,22 @@ var StreamingJSONParser = function (_JSONParser) {
122
97
  value: function getJsonPath() {
123
98
  return this.jsonpath;
124
99
  }
100
+
125
101
  }, {
126
102
  key: "_matchJSONPath",
127
- value: function _matchJSONPath() {
103
+ value:
104
+
105
+ function _matchJSONPath() {
128
106
  var currentPath = this.getJsonPath();
129
107
 
130
108
  if (this.jsonPaths.length === 0) {
131
109
  return true;
132
110
  }
133
-
134
111
  var _iterator = _createForOfIteratorHelper(this.jsonPaths),
135
- _step;
136
-
112
+ _step;
137
113
  try {
138
114
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
139
115
  var jsonPath = _step.value;
140
-
141
116
  if (jsonPath.equals(currentPath)) {
142
117
  return true;
143
118
  }
@@ -147,12 +122,10 @@ var StreamingJSONParser = function (_JSONParser) {
147
122
  } finally {
148
123
  _iterator.f();
149
124
  }
150
-
151
125
  return false;
152
126
  }
153
127
  }]);
154
128
  return StreamingJSONParser;
155
129
  }(_jsonParser.default);
156
-
157
130
  exports.default = StreamingJSONParser;
158
131
  //# sourceMappingURL=streaming-json-parser.js.map
@@ -1 +1 @@
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;;;;;;;IAMqBA,mB;;;;;AAMnB,iCAAgD;AAAA;;AAAA,QAApCC,OAAoC,uEAAJ,EAAI;AAAA;AAC9C,8BAAM;AACJC,MAAAA,WAAW,EAAE,uBAAM;AACjB,YAAI,CAAC,MAAKC,cAAV,EAA0B;AACxB,cAAI,MAAKC,cAAL,EAAJ,EAA2B;AAEzB,kBAAKC,iBAAL,GAAyB,MAAKC,WAAL,GAAmBC,KAAnB,EAAzB;AACA,kBAAKJ,cAAL,GAAsB,EAAtB;;AACA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,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"}
1
+ {"version":3,"file":"streaming-json-parser.js","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"],"sources":["../../../../src/lib/parser/streaming-json-parser.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AAA4C;AAAA;AAAA;AAAA;AAAA;AAAA,IAMvBA,mBAAmB;EAAA;EAAA;EAMtC,+BAAgD;IAAA;IAAA,IAApCC,OAA6B,uEAAG,CAAC,CAAC;IAAA;IAC5C,0BAAM;MACJC,WAAW,EAAE,uBAAM;QACjB,IAAI,CAAC,MAAKC,cAAc,EAAE;UACxB,IAAI,MAAKC,cAAc,EAAE,EAAE;YAEzB,MAAKC,iBAAiB,GAAG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,iBAAiB,IAAI,IAAI,CAACA,iBAAiB,CAACkB,QAAQ,EAAE;IACpE;EAAC;IAAA;IAAA,OAED,uBAAc;MACZ,OAAO,IAAI,CAACL,QAAQ;IACtB;;EAAC;IAAA;IAAA;;IAOD,0BAAiB;MACf,IAAMM,WAAW,GAAG,IAAI,CAAClB,WAAW,EAAE;;MAKtC,IAAI,IAAI,CAACU,SAAS,CAACM,MAAM,KAAK,CAAC,EAAE;QAC/B,OAAO,IAAI;MACb;MAAC,2CAEsB,IAAI,CAACN,SAAS;QAAA;MAAA;QAArC,oDAAuC;UAAA,IAA5BS,QAAQ;UACjB,IAAIA,QAAQ,CAACC,MAAM,CAACF,WAAW,CAAC,EAAE;YAChC,OAAO,IAAI;UACb;QACF;MAAC;QAAA;MAAA;QAAA;MAAA;MAED,OAAO,KAAK;IACd;EAAC;EAAA;AAAA,EAnG8CG,mBAAU;AAAA"}
@@ -1,21 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports._typecheckNDJSONLoader = exports.NDJSONLoader = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _parseNdjson = _interopRequireDefault(require("./lib/parse-ndjson"));
15
-
16
11
  var _parseNdjsonInBatches = _interopRequireDefault(require("./lib/parse-ndjson-in-batches"));
17
-
18
- var VERSION = typeof "3.3.0-alpha.5" !== 'undefined' ? "3.3.0-alpha.5" : 'latest';
12
+ var VERSION = typeof "3.3.0-alpha.6" !== 'undefined' ? "3.3.0-alpha.6" : 'latest';
19
13
  var DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
20
14
  geojson: {
21
15
  shape: 'object-row-table'
@@ -30,7 +24,8 @@ var NDJSONLoader = {
30
24
  module: 'json',
31
25
  version: VERSION,
32
26
  extensions: ['ndjson', 'ndgeojson'],
33
- mimeTypes: ['application/geo+x-ndjson', 'application/geo+x-ldjson', 'application/jsonlines', 'application/geo+json-seq', 'application/x-ndjson'],
27
+ mimeTypes: ['application/geo+x-ndjson', 'application/geo+x-ldjson', 'application/jsonlines',
28
+ 'application/geo+json-seq', 'application/x-ndjson'],
34
29
  category: 'table',
35
30
  text: true,
36
31
  parse: function () {
@@ -40,7 +35,6 @@ var NDJSONLoader = {
40
35
  switch (_context.prev = _context.next) {
41
36
  case 0:
42
37
  return _context.abrupt("return", (0, _parseNdjson.default)(new TextDecoder().decode(arrayBuffer)));
43
-
44
38
  case 1:
45
39
  case "end":
46
40
  return _context.stop();
@@ -48,11 +42,9 @@ var NDJSONLoader = {
48
42
  }
49
43
  }, _callee);
50
44
  }));
51
-
52
45
  function parse(_x) {
53
46
  return _parse.apply(this, arguments);
54
47
  }
55
-
56
48
  return parse;
57
49
  }(),
58
50
  parseTextSync: _parseNdjson.default,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ndjgeoson-loader.ts"],"names":["VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseNDJSONSync","parseInBatches","parseNDJSONInBatches","options","_typecheckNDJSONLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,IAAMC,gCAAgC,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD8B;AAIvCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAJkC,CAAzC;AASO,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEV,OAJiB;AAK1BW,EAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,WAAX,CALc;AAM1BC,EAAAA,SAAS,EAAE,CACT,0BADS,EAET,0BAFS,EAGT,uBAHS,EAIT,0BAJS,EAKT,sBALS,CANe;AAa1BC,EAAAA,QAAQ,EAAE,OAbgB;AAc1BC,EAAAA,IAAI,EAAE,IAdoB;AAe1BC,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAoC,0BAAgB,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAhB,CAApC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KAfqB;AAgB1BG,EAAAA,aAAa,EAAEC,oBAhBW;AAiB1BC,EAAAA,cAAc,EAAEC,6BAjBU;AAkB1BC,EAAAA,OAAO,EAAEtB;AAlBiB,CAArB;;AAqBA,IAAMuB,sBAAwC,GAAGlB,YAAjD","sourcesContent":["import 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 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"],"file":"ndjgeoson-loader.js"}
1
+ {"version":3,"file":"ndjgeoson-loader.js","names":["VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","parseNDJSONSync","TextDecoder","decode","parseTextSync","parseInBatches","parseNDJSONInBatches","options","_typecheckNDJSONLoader"],"sources":["../../src/ndjgeoson-loader.ts"],"sourcesContent":["import 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 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;AACA;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,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,uEAAE,iBAAOC,WAAwB;MAAA;QAAA;UAAA;YAAA;cAAA,iCAAK,IAAAC,oBAAe,EAAC,IAAIC,WAAW,EAAE,CAACC,MAAM,CAACH,WAAW,CAAC,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA;IAAA;MAAA;IAAA;IAAA;EAAA;EACjGI,aAAa,EAAEH,oBAAe;EAC9BI,cAAc,EAAEC,6BAAoB;EACpCC,OAAO,EAAEtB;AACX,CAAC;AAAC;AAEK,IAAMuB,sBAAwC,GAAGlB,YAAY;AAAC"}