@dpuse/dpuse-tool-streamparser-json-parser 1.0.2 → 1.0.4
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/README.md +16 -16
- package/dist/dpuse-tool-streamparser-json-parser.es.js +596 -293
- package/dist/dpuse-tool-streamparser-json-parser.es.js.map +1 -1
- package/dist/shipped-packages.json +1 -1
- package/dist/types/src/index.d.ts +12 -8
- package/dist/types/src/itemRecords.d.ts +1 -1
- package/dist/types/src/structureWalker.d.ts +10 -2
- package/dist/types/src/textPosition.d.ts +11 -0
- package/package.json +2 -2
|
@@ -201,18 +201,18 @@ function m(e) {
|
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
/* @__NO_SIDE_EFFECTS__ */
|
|
204
|
-
function
|
|
204
|
+
function ee(e) {
|
|
205
205
|
let t;
|
|
206
206
|
if (e) for (let n of e) if (t) for (let e of n.issues) t.push(e);
|
|
207
207
|
else t = n.issues;
|
|
208
208
|
return t;
|
|
209
209
|
}
|
|
210
210
|
/* @__NO_SIDE_EFFECTS__ */
|
|
211
|
-
function
|
|
211
|
+
function h(e, t) {
|
|
212
212
|
return o({
|
|
213
213
|
kind: "schema",
|
|
214
214
|
type: "union",
|
|
215
|
-
reference:
|
|
215
|
+
reference: h,
|
|
216
216
|
expects: /* @__PURE__ */ a(e.map((e) => e.expects), "|"),
|
|
217
217
|
async: !1,
|
|
218
218
|
options: e,
|
|
@@ -232,14 +232,14 @@ function g(e, t) {
|
|
|
232
232
|
if (n) return n;
|
|
233
233
|
if (i) {
|
|
234
234
|
if (i.length === 1) return i[0];
|
|
235
|
-
r(this, "type", e, t, { issues: /* @__PURE__ */
|
|
235
|
+
r(this, "type", e, t, { issues: /* @__PURE__ */ ee(i) }), e.typed = !0;
|
|
236
236
|
} else if (a?.length === 1) return a[0];
|
|
237
|
-
else r(this, "type", e, t, { issues: /* @__PURE__ */
|
|
237
|
+
else r(this, "type", e, t, { issues: /* @__PURE__ */ ee(a) });
|
|
238
238
|
return e;
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
var
|
|
242
|
+
var te = {
|
|
243
243
|
id: /* @__PURE__ */ m(),
|
|
244
244
|
label: /* @__PURE__ */ p({
|
|
245
245
|
en: /* @__PURE__ */ f(/* @__PURE__ */ m()),
|
|
@@ -251,7 +251,7 @@ var ee = {
|
|
|
251
251
|
}),
|
|
252
252
|
icon: /* @__PURE__ */ u(/* @__PURE__ */ m()),
|
|
253
253
|
iconDark: /* @__PURE__ */ u(/* @__PURE__ */ m())
|
|
254
|
-
},
|
|
254
|
+
}, g = (e) => /* @__PURE__ */ h(e.map((e) => /* @__PURE__ */ l(e))), ne = g([
|
|
255
255
|
"app",
|
|
256
256
|
"connector",
|
|
257
257
|
"connectorConnection",
|
|
@@ -273,31 +273,125 @@ var ee = {
|
|
|
273
273
|
"presenter",
|
|
274
274
|
"presenterPresentation",
|
|
275
275
|
"tool"
|
|
276
|
-
]),
|
|
276
|
+
]), re = g([
|
|
277
277
|
"danger",
|
|
278
278
|
"success",
|
|
279
279
|
"warning"
|
|
280
|
-
]),
|
|
280
|
+
]), ie = g([
|
|
281
281
|
"alpha",
|
|
282
282
|
"beta",
|
|
283
283
|
"releaseCandidate",
|
|
284
284
|
"generalAvailability"
|
|
285
|
-
]),
|
|
286
|
-
color:
|
|
285
|
+
]), ae = /* @__PURE__ */ p({
|
|
286
|
+
color: re,
|
|
287
287
|
label: /* @__PURE__ */ m()
|
|
288
|
-
}),
|
|
289
|
-
...
|
|
290
|
-
typeId:
|
|
288
|
+
}), _ = {
|
|
289
|
+
...te,
|
|
290
|
+
typeId: ne
|
|
291
291
|
};
|
|
292
|
-
({ ...
|
|
293
|
-
var
|
|
294
|
-
...
|
|
292
|
+
({ ..._ });
|
|
293
|
+
var v = {
|
|
294
|
+
..._,
|
|
295
295
|
firstCreatedAt: /* @__PURE__ */ u(/* @__PURE__ */ d()),
|
|
296
296
|
lastUpdatedAt: /* @__PURE__ */ u(/* @__PURE__ */ d()),
|
|
297
|
-
status: /* @__PURE__ */ u(
|
|
298
|
-
statusId: /* @__PURE__ */ u(
|
|
297
|
+
status: /* @__PURE__ */ u(ae),
|
|
298
|
+
statusId: /* @__PURE__ */ u(ie)
|
|
299
299
|
};
|
|
300
|
-
({ ...
|
|
300
|
+
({ ...v });
|
|
301
|
+
var oe = [
|
|
302
|
+
{
|
|
303
|
+
id: "arrow",
|
|
304
|
+
isStructured: !1,
|
|
305
|
+
isTable: !1,
|
|
306
|
+
isText: !1,
|
|
307
|
+
supportId: "planned"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: "avro",
|
|
311
|
+
isStructured: !1,
|
|
312
|
+
isTable: !1,
|
|
313
|
+
isText: !1,
|
|
314
|
+
supportId: "planned"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: "dtv",
|
|
318
|
+
isStructured: !1,
|
|
319
|
+
isTable: !0,
|
|
320
|
+
isText: !0,
|
|
321
|
+
supportId: "supported"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "json",
|
|
325
|
+
isStructured: !0,
|
|
326
|
+
isTable: !0,
|
|
327
|
+
isText: !0,
|
|
328
|
+
supportId: "supported"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "jsonl",
|
|
332
|
+
isStructured: !0,
|
|
333
|
+
isTable: !0,
|
|
334
|
+
isText: !0,
|
|
335
|
+
supportId: "supported"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: "markdown",
|
|
339
|
+
isStructured: !1,
|
|
340
|
+
isTable: !1,
|
|
341
|
+
isText: !0,
|
|
342
|
+
supportId: "unsupported"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
id: "ods",
|
|
346
|
+
isStructured: !0,
|
|
347
|
+
isTable: !1,
|
|
348
|
+
isText: !1,
|
|
349
|
+
supportId: "planned"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: "parquet",
|
|
353
|
+
isStructured: !1,
|
|
354
|
+
isTable: !1,
|
|
355
|
+
isText: !1,
|
|
356
|
+
supportId: "planned"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "sav",
|
|
360
|
+
isStructured: !1,
|
|
361
|
+
isTable: !1,
|
|
362
|
+
isText: !1,
|
|
363
|
+
supportId: "planned"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: "sqlite",
|
|
367
|
+
isStructured: !1,
|
|
368
|
+
isTable: !1,
|
|
369
|
+
isText: !1,
|
|
370
|
+
supportId: "planned"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
id: "xlsx",
|
|
374
|
+
isStructured: !0,
|
|
375
|
+
isTable: !1,
|
|
376
|
+
isText: !1,
|
|
377
|
+
supportId: "planned"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
id: "xml",
|
|
381
|
+
isStructured: !0,
|
|
382
|
+
isTable: !1,
|
|
383
|
+
isText: !1,
|
|
384
|
+
supportId: "planned"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "unknown",
|
|
388
|
+
isStructured: !1,
|
|
389
|
+
isTable: !1,
|
|
390
|
+
isText: !1,
|
|
391
|
+
supportId: "unsupported"
|
|
392
|
+
}
|
|
393
|
+
];
|
|
394
|
+
g([
|
|
301
395
|
"app",
|
|
302
396
|
"engine",
|
|
303
397
|
"connector",
|
|
@@ -305,14 +399,14 @@ var y = {
|
|
|
305
399
|
"presenter",
|
|
306
400
|
"tool"
|
|
307
401
|
]);
|
|
308
|
-
var
|
|
309
|
-
...
|
|
402
|
+
var y = {
|
|
403
|
+
...v,
|
|
310
404
|
vendorAccountURL: /* @__PURE__ */ u(/* @__PURE__ */ m()),
|
|
311
405
|
vendorDocumentationURL: /* @__PURE__ */ u(/* @__PURE__ */ m()),
|
|
312
406
|
vendorHomeURL: /* @__PURE__ */ u(/* @__PURE__ */ m()),
|
|
313
407
|
version: /* @__PURE__ */ m()
|
|
314
408
|
};
|
|
315
|
-
({ ...
|
|
409
|
+
({ ...y }), g([
|
|
316
410
|
"auditObjectContent",
|
|
317
411
|
"closeStore",
|
|
318
412
|
"createObject",
|
|
@@ -322,7 +416,9 @@ var b = {
|
|
|
322
416
|
"getInfo",
|
|
323
417
|
"getReadableStream",
|
|
324
418
|
"getRecord",
|
|
419
|
+
"indexObjectStructure",
|
|
325
420
|
"listNodes",
|
|
421
|
+
"listObjectStructureEntries",
|
|
326
422
|
"loadObjectRecords",
|
|
327
423
|
"openStore",
|
|
328
424
|
"previewObject",
|
|
@@ -330,26 +426,31 @@ var b = {
|
|
|
330
426
|
"removeRecords",
|
|
331
427
|
"retrieveRecords",
|
|
332
428
|
"upsertRecords"
|
|
333
|
-
]),
|
|
429
|
+
]), g([
|
|
334
430
|
"application",
|
|
335
431
|
"curatedDataset",
|
|
336
432
|
"database",
|
|
337
433
|
"fileStore"
|
|
338
|
-
]),
|
|
434
|
+
]), g([
|
|
339
435
|
"apiEndpoint",
|
|
340
436
|
"file",
|
|
341
437
|
"table"
|
|
342
|
-
]),
|
|
438
|
+
]), g([
|
|
343
439
|
"bidirectional",
|
|
344
440
|
"destination",
|
|
345
441
|
"source",
|
|
346
442
|
"unknown"
|
|
347
|
-
]),
|
|
443
|
+
]), g([
|
|
348
444
|
"apiKey",
|
|
349
445
|
"disabled",
|
|
350
446
|
"oAuth2",
|
|
351
447
|
"none"
|
|
352
|
-
]), { ...
|
|
448
|
+
]), { ...y };
|
|
449
|
+
function b(e) {
|
|
450
|
+
try {
|
|
451
|
+
e();
|
|
452
|
+
} catch {}
|
|
453
|
+
}
|
|
353
454
|
var x = {
|
|
354
455
|
"armscii-8": {
|
|
355
456
|
id: "armscii-8",
|
|
@@ -1143,18 +1244,13 @@ var x = {
|
|
|
1143
1244
|
iconvLiteDecoderId: "windows1257"
|
|
1144
1245
|
}
|
|
1145
1246
|
};
|
|
1146
|
-
function
|
|
1247
|
+
function se(e) {
|
|
1147
1248
|
return Object.hasOwn(x, e);
|
|
1148
1249
|
}
|
|
1149
|
-
function
|
|
1150
|
-
return
|
|
1250
|
+
function ce(e) {
|
|
1251
|
+
return se(e) ? x[e].textDecoderId ?? e : e;
|
|
1151
1252
|
}
|
|
1152
|
-
|
|
1153
|
-
try {
|
|
1154
|
-
e();
|
|
1155
|
-
} catch {}
|
|
1156
|
-
}
|
|
1157
|
-
_([
|
|
1253
|
+
g([
|
|
1158
1254
|
"arrow",
|
|
1159
1255
|
"avro",
|
|
1160
1256
|
"dtv",
|
|
@@ -1167,13 +1263,13 @@ _([
|
|
|
1167
1263
|
"sqlite",
|
|
1168
1264
|
"xlsx",
|
|
1169
1265
|
"xml"
|
|
1170
|
-
]), { ...
|
|
1266
|
+
]), { ...y }, new Set(oe.filter(({ isStructured: e }) => e).map(({ id: e }) => e)), g(["list"]), { ...y }, g([
|
|
1171
1267
|
"list",
|
|
1172
1268
|
"render",
|
|
1173
1269
|
"setColorMode"
|
|
1174
|
-
]), { ...
|
|
1270
|
+
]), { ...y };
|
|
1175
1271
|
// node_modules/@streamparser/json/dist/mjs/utils/bufferedString.js
|
|
1176
|
-
var
|
|
1272
|
+
var le = class {
|
|
1177
1273
|
constructor() {
|
|
1178
1274
|
this.decoder = new TextDecoder("utf-8", { fatal: !0 }), this.pending = [], this.string = "", this.byteLength = 0;
|
|
1179
1275
|
}
|
|
@@ -1192,7 +1288,7 @@ var C = class {
|
|
|
1192
1288
|
toString() {
|
|
1193
1289
|
return this.pending.length > 0 && (this.string += this.pending.join(""), this.pending = []), this.string;
|
|
1194
1290
|
}
|
|
1195
|
-
},
|
|
1291
|
+
}, ue = class {
|
|
1196
1292
|
constructor(e) {
|
|
1197
1293
|
this.decoder = new TextDecoder("utf-8", { fatal: !0 }), this.bufferOffset = 0, this.string = "", this.byteLength = 0, this.buffer = new Uint8Array(e);
|
|
1198
1294
|
}
|
|
@@ -1215,15 +1311,15 @@ var C = class {
|
|
|
1215
1311
|
toString() {
|
|
1216
1312
|
return this.flushStringBuffer(), this.string;
|
|
1217
1313
|
}
|
|
1218
|
-
},
|
|
1314
|
+
}, de;
|
|
1219
1315
|
(function(e) {
|
|
1220
1316
|
e[e.LEFT_BRACE = 0] = "LEFT_BRACE", e[e.RIGHT_BRACE = 1] = "RIGHT_BRACE", e[e.LEFT_BRACKET = 2] = "LEFT_BRACKET", e[e.RIGHT_BRACKET = 3] = "RIGHT_BRACKET", e[e.COLON = 4] = "COLON", e[e.COMMA = 5] = "COMMA", e[e.TRUE = 6] = "TRUE", e[e.FALSE = 7] = "FALSE", e[e.NULL = 8] = "NULL", e[e.STRING = 9] = "STRING", e[e.NUMBER = 10] = "NUMBER", e[e.SEPARATOR = 11] = "SEPARATOR";
|
|
1221
|
-
})(
|
|
1222
|
-
var
|
|
1317
|
+
})(de ||= {});
|
|
1318
|
+
var S = de, fe;
|
|
1223
1319
|
(function(e) {
|
|
1224
1320
|
e[e.BACKSPACE = 8] = "BACKSPACE", e[e.FORM_FEED = 12] = "FORM_FEED", e[e.NEWLINE = 10] = "NEWLINE", e[e.CARRIAGE_RETURN = 13] = "CARRIAGE_RETURN", e[e.TAB = 9] = "TAB", e[e.SPACE = 32] = "SPACE", e[e.EXCLAMATION_MARK = 33] = "EXCLAMATION_MARK", e[e.QUOTATION_MARK = 34] = "QUOTATION_MARK", e[e.NUMBER_SIGN = 35] = "NUMBER_SIGN", e[e.DOLLAR_SIGN = 36] = "DOLLAR_SIGN", e[e.PERCENT_SIGN = 37] = "PERCENT_SIGN", e[e.AMPERSAND = 38] = "AMPERSAND", e[e.APOSTROPHE = 39] = "APOSTROPHE", e[e.LEFT_PARENTHESIS = 40] = "LEFT_PARENTHESIS", e[e.RIGHT_PARENTHESIS = 41] = "RIGHT_PARENTHESIS", e[e.ASTERISK = 42] = "ASTERISK", e[e.PLUS_SIGN = 43] = "PLUS_SIGN", e[e.COMMA = 44] = "COMMA", e[e.HYPHEN_MINUS = 45] = "HYPHEN_MINUS", e[e.FULL_STOP = 46] = "FULL_STOP", e[e.SOLIDUS = 47] = "SOLIDUS", e[e.DIGIT_ZERO = 48] = "DIGIT_ZERO", e[e.DIGIT_ONE = 49] = "DIGIT_ONE", e[e.DIGIT_TWO = 50] = "DIGIT_TWO", e[e.DIGIT_THREE = 51] = "DIGIT_THREE", e[e.DIGIT_FOUR = 52] = "DIGIT_FOUR", e[e.DIGIT_FIVE = 53] = "DIGIT_FIVE", e[e.DIGIT_SIX = 54] = "DIGIT_SIX", e[e.DIGIT_SEVEN = 55] = "DIGIT_SEVEN", e[e.DIGIT_EIGHT = 56] = "DIGIT_EIGHT", e[e.DIGIT_NINE = 57] = "DIGIT_NINE", e[e.COLON = 58] = "COLON", e[e.SEMICOLON = 59] = "SEMICOLON", e[e.LESS_THAN_SIGN = 60] = "LESS_THAN_SIGN", e[e.EQUALS_SIGN = 61] = "EQUALS_SIGN", e[e.GREATER_THAN_SIGN = 62] = "GREATER_THAN_SIGN", e[e.QUESTION_MARK = 63] = "QUESTION_MARK", e[e.COMMERCIAL_AT = 64] = "COMMERCIAL_AT", e[e.LATIN_CAPITAL_LETTER_A = 65] = "LATIN_CAPITAL_LETTER_A", e[e.LATIN_CAPITAL_LETTER_B = 66] = "LATIN_CAPITAL_LETTER_B", e[e.LATIN_CAPITAL_LETTER_C = 67] = "LATIN_CAPITAL_LETTER_C", e[e.LATIN_CAPITAL_LETTER_D = 68] = "LATIN_CAPITAL_LETTER_D", e[e.LATIN_CAPITAL_LETTER_E = 69] = "LATIN_CAPITAL_LETTER_E", e[e.LATIN_CAPITAL_LETTER_F = 70] = "LATIN_CAPITAL_LETTER_F", e[e.LATIN_CAPITAL_LETTER_G = 71] = "LATIN_CAPITAL_LETTER_G", e[e.LATIN_CAPITAL_LETTER_H = 72] = "LATIN_CAPITAL_LETTER_H", e[e.LATIN_CAPITAL_LETTER_I = 73] = "LATIN_CAPITAL_LETTER_I", e[e.LATIN_CAPITAL_LETTER_J = 74] = "LATIN_CAPITAL_LETTER_J", e[e.LATIN_CAPITAL_LETTER_K = 75] = "LATIN_CAPITAL_LETTER_K", e[e.LATIN_CAPITAL_LETTER_L = 76] = "LATIN_CAPITAL_LETTER_L", e[e.LATIN_CAPITAL_LETTER_M = 77] = "LATIN_CAPITAL_LETTER_M", e[e.LATIN_CAPITAL_LETTER_N = 78] = "LATIN_CAPITAL_LETTER_N", e[e.LATIN_CAPITAL_LETTER_O = 79] = "LATIN_CAPITAL_LETTER_O", e[e.LATIN_CAPITAL_LETTER_P = 80] = "LATIN_CAPITAL_LETTER_P", e[e.LATIN_CAPITAL_LETTER_Q = 81] = "LATIN_CAPITAL_LETTER_Q", e[e.LATIN_CAPITAL_LETTER_R = 82] = "LATIN_CAPITAL_LETTER_R", e[e.LATIN_CAPITAL_LETTER_S = 83] = "LATIN_CAPITAL_LETTER_S", e[e.LATIN_CAPITAL_LETTER_T = 84] = "LATIN_CAPITAL_LETTER_T", e[e.LATIN_CAPITAL_LETTER_U = 85] = "LATIN_CAPITAL_LETTER_U", e[e.LATIN_CAPITAL_LETTER_V = 86] = "LATIN_CAPITAL_LETTER_V", e[e.LATIN_CAPITAL_LETTER_W = 87] = "LATIN_CAPITAL_LETTER_W", e[e.LATIN_CAPITAL_LETTER_X = 88] = "LATIN_CAPITAL_LETTER_X", e[e.LATIN_CAPITAL_LETTER_Y = 89] = "LATIN_CAPITAL_LETTER_Y", e[e.LATIN_CAPITAL_LETTER_Z = 90] = "LATIN_CAPITAL_LETTER_Z", e[e.LEFT_SQUARE_BRACKET = 91] = "LEFT_SQUARE_BRACKET", e[e.REVERSE_SOLIDUS = 92] = "REVERSE_SOLIDUS", e[e.RIGHT_SQUARE_BRACKET = 93] = "RIGHT_SQUARE_BRACKET", e[e.CIRCUMFLEX_ACCENT = 94] = "CIRCUMFLEX_ACCENT", e[e.LOW_LINE = 95] = "LOW_LINE", e[e.GRAVE_ACCENT = 96] = "GRAVE_ACCENT", e[e.LATIN_SMALL_LETTER_A = 97] = "LATIN_SMALL_LETTER_A", e[e.LATIN_SMALL_LETTER_B = 98] = "LATIN_SMALL_LETTER_B", e[e.LATIN_SMALL_LETTER_C = 99] = "LATIN_SMALL_LETTER_C", e[e.LATIN_SMALL_LETTER_D = 100] = "LATIN_SMALL_LETTER_D", e[e.LATIN_SMALL_LETTER_E = 101] = "LATIN_SMALL_LETTER_E", e[e.LATIN_SMALL_LETTER_F = 102] = "LATIN_SMALL_LETTER_F", e[e.LATIN_SMALL_LETTER_G = 103] = "LATIN_SMALL_LETTER_G", e[e.LATIN_SMALL_LETTER_H = 104] = "LATIN_SMALL_LETTER_H", e[e.LATIN_SMALL_LETTER_I = 105] = "LATIN_SMALL_LETTER_I", e[e.LATIN_SMALL_LETTER_J = 106] = "LATIN_SMALL_LETTER_J", e[e.LATIN_SMALL_LETTER_K = 107] = "LATIN_SMALL_LETTER_K", e[e.LATIN_SMALL_LETTER_L = 108] = "LATIN_SMALL_LETTER_L", e[e.LATIN_SMALL_LETTER_M = 109] = "LATIN_SMALL_LETTER_M", e[e.LATIN_SMALL_LETTER_N = 110] = "LATIN_SMALL_LETTER_N", e[e.LATIN_SMALL_LETTER_O = 111] = "LATIN_SMALL_LETTER_O", e[e.LATIN_SMALL_LETTER_P = 112] = "LATIN_SMALL_LETTER_P", e[e.LATIN_SMALL_LETTER_Q = 113] = "LATIN_SMALL_LETTER_Q", e[e.LATIN_SMALL_LETTER_R = 114] = "LATIN_SMALL_LETTER_R", e[e.LATIN_SMALL_LETTER_S = 115] = "LATIN_SMALL_LETTER_S", e[e.LATIN_SMALL_LETTER_T = 116] = "LATIN_SMALL_LETTER_T", e[e.LATIN_SMALL_LETTER_U = 117] = "LATIN_SMALL_LETTER_U", e[e.LATIN_SMALL_LETTER_V = 118] = "LATIN_SMALL_LETTER_V", e[e.LATIN_SMALL_LETTER_W = 119] = "LATIN_SMALL_LETTER_W", e[e.LATIN_SMALL_LETTER_X = 120] = "LATIN_SMALL_LETTER_X", e[e.LATIN_SMALL_LETTER_Y = 121] = "LATIN_SMALL_LETTER_Y", e[e.LATIN_SMALL_LETTER_Z = 122] = "LATIN_SMALL_LETTER_Z", e[e.LEFT_CURLY_BRACKET = 123] = "LEFT_CURLY_BRACKET", e[e.VERTICAL_LINE = 124] = "VERTICAL_LINE", e[e.RIGHT_CURLY_BRACKET = 125] = "RIGHT_CURLY_BRACKET", e[e.TILDE = 126] = "TILDE";
|
|
1225
|
-
})(
|
|
1226
|
-
var
|
|
1321
|
+
})(fe ||= {});
|
|
1322
|
+
var pe = {
|
|
1227
1323
|
34: 34,
|
|
1228
1324
|
92: 92,
|
|
1229
1325
|
47: 47,
|
|
@@ -1232,41 +1328,41 @@ var ce = {
|
|
|
1232
1328
|
110: 10,
|
|
1233
1329
|
114: 13,
|
|
1234
1330
|
116: 9
|
|
1235
|
-
},
|
|
1331
|
+
}, me;
|
|
1236
1332
|
(function(e) {
|
|
1237
1333
|
e[e.START = 0] = "START", e[e.ENDED = 1] = "ENDED", e[e.ERROR = 2] = "ERROR", e[e.TRUE1 = 3] = "TRUE1", e[e.TRUE2 = 4] = "TRUE2", e[e.TRUE3 = 5] = "TRUE3", e[e.FALSE1 = 6] = "FALSE1", e[e.FALSE2 = 7] = "FALSE2", e[e.FALSE3 = 8] = "FALSE3", e[e.FALSE4 = 9] = "FALSE4", e[e.NULL1 = 10] = "NULL1", e[e.NULL2 = 11] = "NULL2", e[e.NULL3 = 12] = "NULL3", e[e.STRING_DEFAULT = 13] = "STRING_DEFAULT", e[e.STRING_AFTER_BACKSLASH = 14] = "STRING_AFTER_BACKSLASH", e[e.STRING_UNICODE_DIGIT_1 = 15] = "STRING_UNICODE_DIGIT_1", e[e.STRING_UNICODE_DIGIT_2 = 16] = "STRING_UNICODE_DIGIT_2", e[e.STRING_UNICODE_DIGIT_3 = 17] = "STRING_UNICODE_DIGIT_3", e[e.STRING_UNICODE_DIGIT_4 = 18] = "STRING_UNICODE_DIGIT_4", e[e.STRING_INCOMPLETE_CHAR = 19] = "STRING_INCOMPLETE_CHAR", e[e.NUMBER_AFTER_INITIAL_MINUS = 20] = "NUMBER_AFTER_INITIAL_MINUS", e[e.NUMBER_AFTER_INITIAL_ZERO = 21] = "NUMBER_AFTER_INITIAL_ZERO", e[e.NUMBER_AFTER_INITIAL_NON_ZERO = 22] = "NUMBER_AFTER_INITIAL_NON_ZERO", e[e.NUMBER_AFTER_FULL_STOP = 23] = "NUMBER_AFTER_FULL_STOP", e[e.NUMBER_AFTER_DECIMAL = 24] = "NUMBER_AFTER_DECIMAL", e[e.NUMBER_AFTER_E = 25] = "NUMBER_AFTER_E", e[e.NUMBER_AFTER_E_AND_SIGN = 26] = "NUMBER_AFTER_E_AND_SIGN", e[e.NUMBER_AFTER_E_AND_DIGIT = 27] = "NUMBER_AFTER_E_AND_DIGIT", e[e.SEPARATOR = 28] = "SEPARATOR", e[e.BOM_OR_START = 29] = "BOM_OR_START", e[e.BOM = 30] = "BOM";
|
|
1238
|
-
})(
|
|
1239
|
-
function
|
|
1334
|
+
})(me ||= {});
|
|
1335
|
+
function he(e) {
|
|
1240
1336
|
return (/* @__PURE__ */ "START.ENDED.ERROR.TRUE1.TRUE2.TRUE3.FALSE1.FALSE2.FALSE3.FALSE4.NULL1.NULL2.NULL3.STRING_DEFAULT.STRING_AFTER_BACKSLASH.STRING_UNICODE_DIGIT_1.STRING_UNICODE_DIGIT_2.STRING_UNICODE_DIGIT_3.STRING_UNICODE_DIGIT_4.STRING_INCOMPLETE_CHAR.NUMBER_AFTER_INITIAL_MINUS.NUMBER_AFTER_INITIAL_ZERO.NUMBER_AFTER_INITIAL_NON_ZERO.NUMBER_AFTER_FULL_STOP.NUMBER_AFTER_DECIMAL.NUMBER_AFTER_E.NUMBER_AFTER_E_AND_SIGN.NUMBER_AFTER_E_AND_DIGIT.SEPARATOR.BOM_OR_START.BOM".split("."))[e];
|
|
1241
1337
|
}
|
|
1242
|
-
var
|
|
1338
|
+
var ge = {
|
|
1243
1339
|
stringBufferSize: 0,
|
|
1244
1340
|
numberBufferSize: 0,
|
|
1245
1341
|
separator: void 0,
|
|
1246
1342
|
emitPartialTokens: !1
|
|
1247
|
-
},
|
|
1343
|
+
}, C = class e extends Error {
|
|
1248
1344
|
constructor(t) {
|
|
1249
1345
|
super(t), Object.setPrototypeOf(this, e.prototype);
|
|
1250
1346
|
}
|
|
1251
1347
|
};
|
|
1252
|
-
function
|
|
1253
|
-
if (t !== void 0 && (!Number.isInteger(t) || t < 0)) throw new
|
|
1348
|
+
function w(e, t) {
|
|
1349
|
+
if (t !== void 0 && (!Number.isInteger(t) || t < 0)) throw new C(`Invalid "${e}": ${t}. Expected a non-negative integer.`);
|
|
1254
1350
|
}
|
|
1255
|
-
function
|
|
1351
|
+
function T(e) {
|
|
1256
1352
|
return e >= 194 && e <= 223 ? 2 : e <= 239 ? 3 : 4;
|
|
1257
1353
|
}
|
|
1258
|
-
function
|
|
1354
|
+
function _e(e, t) {
|
|
1259
1355
|
let n = t;
|
|
1260
1356
|
for (; n < e.length && e[n] >= 128;) {
|
|
1261
|
-
let t =
|
|
1357
|
+
let t = T(e[n]);
|
|
1262
1358
|
if (n + t > e.length) break;
|
|
1263
1359
|
n += t;
|
|
1264
1360
|
}
|
|
1265
1361
|
return n;
|
|
1266
1362
|
}
|
|
1267
|
-
var
|
|
1363
|
+
var ve = class {
|
|
1268
1364
|
constructor(e) {
|
|
1269
|
-
this.state = 29, this.bomIndex = 0, this.separatorIndex = 0, this.escapedCharsByteLength = 0, this.bytes_remaining = 0, this.bytes_in_sequence = 0, this.char_split_buffer = /* @__PURE__ */ new Uint8Array(4), this.encoder = new TextEncoder(), this.offset = -1, this.streamByteLength = 0, e = Object.assign(Object.assign({},
|
|
1365
|
+
this.state = 29, this.bomIndex = 0, this.separatorIndex = 0, this.escapedCharsByteLength = 0, this.bytes_remaining = 0, this.bytes_in_sequence = 0, this.char_split_buffer = /* @__PURE__ */ new Uint8Array(4), this.encoder = new TextEncoder(), this.offset = -1, this.streamByteLength = 0, e = Object.assign(Object.assign({}, ge), e), w("stringBufferSize", e.stringBufferSize), w("numberBufferSize", e.numberBufferSize), this.emitPartialTokens = e.emitPartialTokens === !0, this.bufferedString = e.stringBufferSize && e.stringBufferSize > 4 ? new ue(e.stringBufferSize) : new le(), this.bufferedNumber = e.numberBufferSize && e.numberBufferSize > 0 ? new ue(e.numberBufferSize) : new le(), this.separator = e.separator, this.separatorBytes = e.separator ? this.encoder.encode(e.separator) : void 0;
|
|
1270
1366
|
}
|
|
1271
1367
|
get isEnded() {
|
|
1272
1368
|
return this.state === 1;
|
|
@@ -1295,7 +1391,7 @@ var fe = class {
|
|
|
1295
1391
|
this.highSurrogate !== void 0 && (this.bufferedString.appendCharCode(this.highSurrogate), this.highSurrogate = void 0);
|
|
1296
1392
|
}
|
|
1297
1393
|
startIncompleteChar(e, t) {
|
|
1298
|
-
this.bytes_in_sequence =
|
|
1394
|
+
this.bytes_in_sequence = T(e[t]), this.bytes_remaining = t + this.bytes_in_sequence - e.length, this.char_split_buffer.set(e.subarray(t)), this.state = 19;
|
|
1299
1395
|
}
|
|
1300
1396
|
write(e) {
|
|
1301
1397
|
try {
|
|
@@ -1354,7 +1450,7 @@ var fe = class {
|
|
|
1354
1450
|
if (this.offset += 1, this.separatorBytes && r === this.separatorBytes[0]) {
|
|
1355
1451
|
if (this.separatorBytes.length === 1) {
|
|
1356
1452
|
this.state = 0, this.onToken({
|
|
1357
|
-
token:
|
|
1453
|
+
token: S.SEPARATOR,
|
|
1358
1454
|
value: this.separator,
|
|
1359
1455
|
offset: this.offset + this.separatorBytes.length - 1
|
|
1360
1456
|
});
|
|
@@ -1366,7 +1462,7 @@ var fe = class {
|
|
|
1366
1462
|
if (r === 32 || r === 10 || r === 13 || r === 9) continue;
|
|
1367
1463
|
if (r === 123) {
|
|
1368
1464
|
this.onToken({
|
|
1369
|
-
token:
|
|
1465
|
+
token: S.LEFT_BRACE,
|
|
1370
1466
|
value: "{",
|
|
1371
1467
|
offset: this.offset
|
|
1372
1468
|
});
|
|
@@ -1374,7 +1470,7 @@ var fe = class {
|
|
|
1374
1470
|
}
|
|
1375
1471
|
if (r === 125) {
|
|
1376
1472
|
this.onToken({
|
|
1377
|
-
token:
|
|
1473
|
+
token: S.RIGHT_BRACE,
|
|
1378
1474
|
value: "}",
|
|
1379
1475
|
offset: this.offset
|
|
1380
1476
|
});
|
|
@@ -1382,7 +1478,7 @@ var fe = class {
|
|
|
1382
1478
|
}
|
|
1383
1479
|
if (r === 91) {
|
|
1384
1480
|
this.onToken({
|
|
1385
|
-
token:
|
|
1481
|
+
token: S.LEFT_BRACKET,
|
|
1386
1482
|
value: "[",
|
|
1387
1483
|
offset: this.offset
|
|
1388
1484
|
});
|
|
@@ -1390,7 +1486,7 @@ var fe = class {
|
|
|
1390
1486
|
}
|
|
1391
1487
|
if (r === 93) {
|
|
1392
1488
|
this.onToken({
|
|
1393
|
-
token:
|
|
1489
|
+
token: S.RIGHT_BRACKET,
|
|
1394
1490
|
value: "]",
|
|
1395
1491
|
offset: this.offset
|
|
1396
1492
|
});
|
|
@@ -1398,7 +1494,7 @@ var fe = class {
|
|
|
1398
1494
|
}
|
|
1399
1495
|
if (r === 58) {
|
|
1400
1496
|
this.onToken({
|
|
1401
|
-
token:
|
|
1497
|
+
token: S.COLON,
|
|
1402
1498
|
value: ":",
|
|
1403
1499
|
offset: this.offset
|
|
1404
1500
|
});
|
|
@@ -1406,7 +1502,7 @@ var fe = class {
|
|
|
1406
1502
|
}
|
|
1407
1503
|
if (r === 44) {
|
|
1408
1504
|
this.onToken({
|
|
1409
|
-
token:
|
|
1505
|
+
token: S.COMMA,
|
|
1410
1506
|
value: ",",
|
|
1411
1507
|
offset: this.offset
|
|
1412
1508
|
});
|
|
@@ -1446,7 +1542,7 @@ var fe = class {
|
|
|
1446
1542
|
this.flushPendingHighSurrogate();
|
|
1447
1543
|
let e = this.bufferedString.toString();
|
|
1448
1544
|
this.state = 0, this.onToken({
|
|
1449
|
-
token:
|
|
1545
|
+
token: S.STRING,
|
|
1450
1546
|
value: e,
|
|
1451
1547
|
offset: this.offset
|
|
1452
1548
|
}), this.offset += this.escapedCharsByteLength + this.bufferedString.byteLength + 1;
|
|
@@ -1458,7 +1554,7 @@ var fe = class {
|
|
|
1458
1554
|
}
|
|
1459
1555
|
if (r >= 128) {
|
|
1460
1556
|
this.flushPendingHighSurrogate();
|
|
1461
|
-
let e =
|
|
1557
|
+
let e = _e(t, n);
|
|
1462
1558
|
e > n && (this.bufferedString.appendBuf(t, n, e), n = e - 1), e < t.length && t[e] >= 128 && (this.startIncompleteChar(t, e), n = t.length - 1);
|
|
1463
1559
|
continue;
|
|
1464
1560
|
}
|
|
@@ -1486,7 +1582,7 @@ var fe = class {
|
|
|
1486
1582
|
continue;
|
|
1487
1583
|
}
|
|
1488
1584
|
case 14: {
|
|
1489
|
-
let e =
|
|
1585
|
+
let e = pe[r];
|
|
1490
1586
|
if (e) {
|
|
1491
1587
|
this.flushPendingHighSurrogate(), this.bufferedString.appendChar(e), this.escapedCharsByteLength += 1, this.state = 13;
|
|
1492
1588
|
continue;
|
|
@@ -1597,7 +1693,7 @@ var fe = class {
|
|
|
1597
1693
|
case 5:
|
|
1598
1694
|
if (r === 101) {
|
|
1599
1695
|
this.state = 0, this.onToken({
|
|
1600
|
-
token:
|
|
1696
|
+
token: S.TRUE,
|
|
1601
1697
|
value: !0,
|
|
1602
1698
|
offset: this.offset
|
|
1603
1699
|
}), this.offset += 3;
|
|
@@ -1625,7 +1721,7 @@ var fe = class {
|
|
|
1625
1721
|
case 9:
|
|
1626
1722
|
if (r === 101) {
|
|
1627
1723
|
this.state = 0, this.onToken({
|
|
1628
|
-
token:
|
|
1724
|
+
token: S.FALSE,
|
|
1629
1725
|
value: !1,
|
|
1630
1726
|
offset: this.offset
|
|
1631
1727
|
}), this.offset += 4;
|
|
@@ -1647,7 +1743,7 @@ var fe = class {
|
|
|
1647
1743
|
case 12:
|
|
1648
1744
|
if (r === 108) {
|
|
1649
1745
|
this.state = 0, this.onToken({
|
|
1650
|
-
token:
|
|
1746
|
+
token: S.NULL,
|
|
1651
1747
|
value: null,
|
|
1652
1748
|
offset: this.offset
|
|
1653
1749
|
}), this.offset += 3;
|
|
@@ -1657,7 +1753,7 @@ var fe = class {
|
|
|
1657
1753
|
case 28:
|
|
1658
1754
|
if (this.separatorIndex += 1, !this.separatorBytes || r !== this.separatorBytes[this.separatorIndex]) break;
|
|
1659
1755
|
this.separatorIndex === this.separatorBytes.length - 1 && (this.state = 0, this.onToken({
|
|
1660
|
-
token:
|
|
1756
|
+
token: S.SEPARATOR,
|
|
1661
1757
|
value: this.separator,
|
|
1662
1758
|
offset: this.offset + this.separatorIndex
|
|
1663
1759
|
}), this.separatorIndex = 0);
|
|
@@ -1674,14 +1770,14 @@ var fe = class {
|
|
|
1674
1770
|
break;
|
|
1675
1771
|
case 1: if (r === 32 || r === 10 || r === 13 || r === 9) continue;
|
|
1676
1772
|
}
|
|
1677
|
-
throw new
|
|
1773
|
+
throw new C(`Unexpected "${String.fromCharCode(r)}" at chunk position "${n}" (absolute position "${this.streamByteLength + n}") in state ${he(this.state)}`);
|
|
1678
1774
|
}
|
|
1679
1775
|
if (this.streamByteLength += t.length, this.emitPartialTokens) switch (this.state) {
|
|
1680
1776
|
case 3:
|
|
1681
1777
|
case 4:
|
|
1682
1778
|
case 5:
|
|
1683
1779
|
this.onToken({
|
|
1684
|
-
token:
|
|
1780
|
+
token: S.TRUE,
|
|
1685
1781
|
value: !0,
|
|
1686
1782
|
offset: this.offset,
|
|
1687
1783
|
partial: !0
|
|
@@ -1692,7 +1788,7 @@ var fe = class {
|
|
|
1692
1788
|
case 8:
|
|
1693
1789
|
case 9:
|
|
1694
1790
|
this.onToken({
|
|
1695
|
-
token:
|
|
1791
|
+
token: S.FALSE,
|
|
1696
1792
|
value: !1,
|
|
1697
1793
|
offset: this.offset,
|
|
1698
1794
|
partial: !0
|
|
@@ -1702,7 +1798,7 @@ var fe = class {
|
|
|
1702
1798
|
case 11:
|
|
1703
1799
|
case 12:
|
|
1704
1800
|
this.onToken({
|
|
1705
|
-
token:
|
|
1801
|
+
token: S.NULL,
|
|
1706
1802
|
value: null,
|
|
1707
1803
|
offset: this.offset,
|
|
1708
1804
|
partial: !0
|
|
@@ -1711,7 +1807,7 @@ var fe = class {
|
|
|
1711
1807
|
case 13: {
|
|
1712
1808
|
let e = this.bufferedString.toString();
|
|
1713
1809
|
this.onToken({
|
|
1714
|
-
token:
|
|
1810
|
+
token: S.STRING,
|
|
1715
1811
|
value: e,
|
|
1716
1812
|
offset: this.offset,
|
|
1717
1813
|
partial: !0
|
|
@@ -1723,7 +1819,7 @@ var fe = class {
|
|
|
1723
1819
|
case 24:
|
|
1724
1820
|
case 27: try {
|
|
1725
1821
|
this.onToken({
|
|
1726
|
-
token:
|
|
1822
|
+
token: S.NUMBER,
|
|
1727
1823
|
value: this.parseNumber(this.bufferedNumber.toString()),
|
|
1728
1824
|
offset: this.offset,
|
|
1729
1825
|
partial: !0
|
|
@@ -1736,7 +1832,7 @@ var fe = class {
|
|
|
1736
1832
|
}
|
|
1737
1833
|
emitNumber() {
|
|
1738
1834
|
this.onToken({
|
|
1739
|
-
token:
|
|
1835
|
+
token: S.NUMBER,
|
|
1740
1836
|
value: this.parseNumber(this.bufferedNumber.toString()),
|
|
1741
1837
|
offset: this.offset
|
|
1742
1838
|
}), this.offset += this.bufferedNumber.byteLength - 1;
|
|
@@ -1760,114 +1856,127 @@ var fe = class {
|
|
|
1760
1856
|
case 2:
|
|
1761
1857
|
this.state = 1, this.onEnd();
|
|
1762
1858
|
break;
|
|
1763
|
-
default: this.error(new
|
|
1859
|
+
default: this.error(new C(`Tokenizer ended in the middle of a token (state: ${he(this.state)}). Either not all the data was received or the data was invalid.`));
|
|
1764
1860
|
}
|
|
1765
1861
|
}
|
|
1766
1862
|
onToken(e) {
|
|
1767
|
-
throw new
|
|
1863
|
+
throw new C("Can't emit tokens before the \"onToken\" callback has been set up.");
|
|
1768
1864
|
}
|
|
1769
1865
|
onError(e) {
|
|
1770
1866
|
throw e;
|
|
1771
1867
|
}
|
|
1772
1868
|
onEnd() {}
|
|
1773
|
-
},
|
|
1869
|
+
}, ye;
|
|
1774
1870
|
(function(e) {
|
|
1775
1871
|
e[e.VALUE = 0] = "VALUE", e[e.KEY = 1] = "KEY", e[e.COLON = 2] = "COLON", e[e.COMMA = 3] = "COMMA", e[e.ENDED = 4] = "ENDED", e[e.ERROR = 5] = "ERROR", e[e.SEPARATOR = 6] = "SEPARATOR";
|
|
1776
|
-
})(
|
|
1872
|
+
})(ye ||= {});
|
|
1777
1873
|
// node_modules/@streamparser/json/dist/mjs/utils/types/stackElement.js
|
|
1778
|
-
var
|
|
1874
|
+
var be;
|
|
1779
1875
|
(function(e) {
|
|
1780
1876
|
e[e.OBJECT = 0] = "OBJECT", e[e.ARRAY = 1] = "ARRAY";
|
|
1781
|
-
})(
|
|
1877
|
+
})(be ||= {});
|
|
1782
1878
|
// src/structureWalker.ts
|
|
1783
|
-
var
|
|
1879
|
+
var E = [
|
|
1784
1880
|
239,
|
|
1785
1881
|
187,
|
|
1786
1882
|
191
|
|
1787
|
-
],
|
|
1788
|
-
[
|
|
1789
|
-
|
|
1883
|
+
], xe = {
|
|
1884
|
+
[S.LEFT_BRACE]: (e, t, n) => {
|
|
1885
|
+
F(e, "object", n);
|
|
1790
1886
|
},
|
|
1791
|
-
[
|
|
1792
|
-
|
|
1887
|
+
[S.RIGHT_BRACE]: (e, t, n) => {
|
|
1888
|
+
I(e, "object", n);
|
|
1793
1889
|
},
|
|
1794
|
-
[
|
|
1795
|
-
|
|
1890
|
+
[S.LEFT_BRACKET]: (e, t, n) => {
|
|
1891
|
+
F(e, "list", n);
|
|
1796
1892
|
},
|
|
1797
|
-
[
|
|
1798
|
-
|
|
1893
|
+
[S.RIGHT_BRACKET]: (e, t, n) => {
|
|
1894
|
+
I(e, "list", n);
|
|
1799
1895
|
},
|
|
1800
|
-
[
|
|
1801
|
-
|
|
1896
|
+
[S.COLON]: (e, t, n) => {
|
|
1897
|
+
Se(e.state, n);
|
|
1802
1898
|
},
|
|
1803
|
-
[
|
|
1804
|
-
|
|
1899
|
+
[S.COMMA]: (e, t, n) => {
|
|
1900
|
+
Ce(e.state, n);
|
|
1805
1901
|
},
|
|
1806
|
-
[
|
|
1807
|
-
|
|
1902
|
+
[S.TRUE]: (e, t, n) => {
|
|
1903
|
+
L(e, "boolean", !0, n);
|
|
1808
1904
|
},
|
|
1809
|
-
[
|
|
1810
|
-
|
|
1905
|
+
[S.FALSE]: (e, t, n) => {
|
|
1906
|
+
L(e, "boolean", !1, n);
|
|
1811
1907
|
},
|
|
1812
|
-
[
|
|
1813
|
-
|
|
1908
|
+
[S.NULL]: (e, t, n) => {
|
|
1909
|
+
L(e, "null", null, n);
|
|
1814
1910
|
},
|
|
1815
|
-
[
|
|
1816
|
-
|
|
1911
|
+
[S.STRING]: (e, t, n) => {
|
|
1912
|
+
we(e, t, n);
|
|
1817
1913
|
},
|
|
1818
|
-
[
|
|
1819
|
-
|
|
1914
|
+
[S.NUMBER]: (e, t, n) => {
|
|
1915
|
+
L(e, "number", t, n);
|
|
1820
1916
|
},
|
|
1821
|
-
[
|
|
1917
|
+
[S.SEPARATOR]: () => {}
|
|
1822
1918
|
};
|
|
1823
|
-
function
|
|
1824
|
-
let n = new
|
|
1919
|
+
function D(e, t) {
|
|
1920
|
+
let n = new ve(e.isJsonLines ? { separator: "\n" } : void 0);
|
|
1825
1921
|
Object.assign(n, { parseNumber: (e) => ({ numberText: e }) });
|
|
1826
1922
|
let r = {
|
|
1827
1923
|
byteCount: 0,
|
|
1828
1924
|
byteOffset: 0,
|
|
1829
1925
|
current: void 0,
|
|
1830
|
-
isFirstWrite: !0,
|
|
1831
1926
|
isRootClosed: !1,
|
|
1832
1927
|
isStarted: !1
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1928
|
+
}, i = e.startInside ?? (e.isJsonLines ? {
|
|
1929
|
+
firstIndex: 0,
|
|
1930
|
+
kindId: "list"
|
|
1931
|
+
} : void 0);
|
|
1932
|
+
if (i != null) {
|
|
1933
|
+
let n = j({
|
|
1836
1934
|
depth: 0,
|
|
1837
1935
|
isVirtual: !0,
|
|
1838
1936
|
key: void 0,
|
|
1839
|
-
kindId:
|
|
1937
|
+
kindId: i.kindId,
|
|
1840
1938
|
parent: void 0,
|
|
1841
1939
|
path: e.rootPath,
|
|
1842
1940
|
startOffset: e.baseOffset
|
|
1843
1941
|
});
|
|
1844
|
-
n.childCount =
|
|
1942
|
+
n.childCount = i.firstIndex, n.positionId = !e.isJsonLines && i.firstIndex > 0 ? "afterComma" : "start", r.current = n, t.onContainerStart?.(n);
|
|
1845
1943
|
}
|
|
1846
|
-
let
|
|
1944
|
+
let a = {
|
|
1847
1945
|
handlers: t,
|
|
1848
1946
|
options: e,
|
|
1849
1947
|
state: r
|
|
1850
1948
|
};
|
|
1851
|
-
return n.onToken = ({ offset: n, token:
|
|
1949
|
+
return n.onToken = ({ offset: n, token: i, value: o }) => {
|
|
1852
1950
|
let s = e.baseOffset + r.byteOffset + n;
|
|
1853
|
-
r.isStarted = !0, t.onTokenStart?.(s),
|
|
1951
|
+
r.isStarted = !0, t.onTokenStart?.(s), xe[i](a, o, s);
|
|
1854
1952
|
}, {
|
|
1953
|
+
byteCount: () => r.byteCount,
|
|
1855
1954
|
end: () => {
|
|
1856
|
-
|
|
1955
|
+
let i = e.baseOffset + r.byteCount;
|
|
1956
|
+
if (N(() => {
|
|
1957
|
+
n.end();
|
|
1958
|
+
}, e.baseOffset + r.byteOffset), !e.isJsonLines && !r.isStarted) throw M("The JSON is empty", e.baseOffset);
|
|
1959
|
+
if (r.current != null && !(e.isJsonLines && r.current.isVirtual)) throw M("The JSON ends before it is complete", i);
|
|
1960
|
+
r.current != null && t.onContainerEnd?.(r.current, i);
|
|
1857
1961
|
},
|
|
1858
1962
|
write: (t) => {
|
|
1859
|
-
let i = t;
|
|
1860
|
-
r.byteCount += t.length,
|
|
1963
|
+
let i = t, a = r.byteCount === 0;
|
|
1964
|
+
r.byteCount += t.length, a && e.baseOffset === 0 && E.every((e, t) => i[t] === e) && (i = i.subarray(E.length), r.byteOffset = E.length), N(() => {
|
|
1965
|
+
n.write(i);
|
|
1966
|
+
}, e.baseOffset + r.byteOffset);
|
|
1861
1967
|
}
|
|
1862
1968
|
};
|
|
1863
1969
|
}
|
|
1864
|
-
function
|
|
1970
|
+
function O(e) {
|
|
1865
1971
|
return typeof e == "object" && !!e && "numberText" in e;
|
|
1866
1972
|
}
|
|
1867
|
-
function
|
|
1868
|
-
return
|
|
1973
|
+
function k(e) {
|
|
1974
|
+
return e instanceof Error && "offset" in e && typeof e.offset == "number";
|
|
1975
|
+
}
|
|
1976
|
+
function A(e) {
|
|
1977
|
+
return typeof e != "object" || !e ? JSON.stringify(e) : O(e) ? e.numberText : Array.isArray(e) ? `[${e.map((e) => A(e)).join(",")}]` : `{${Object.entries(e).map(([e, t]) => `${JSON.stringify(e)}:${A(t)}`).join(",")}}`;
|
|
1869
1978
|
}
|
|
1870
|
-
function
|
|
1979
|
+
function j(e) {
|
|
1871
1980
|
return {
|
|
1872
1981
|
...e,
|
|
1873
1982
|
childCount: 0,
|
|
@@ -1875,16 +1984,36 @@ function F(e) {
|
|
|
1875
1984
|
positionId: "start"
|
|
1876
1985
|
};
|
|
1877
1986
|
}
|
|
1878
|
-
function
|
|
1879
|
-
|
|
1987
|
+
function M(e, t) {
|
|
1988
|
+
return Object.assign(/* @__PURE__ */ Error(`${e}.`), { offset: t });
|
|
1989
|
+
}
|
|
1990
|
+
function N(e, t) {
|
|
1991
|
+
try {
|
|
1992
|
+
e();
|
|
1993
|
+
} catch (e) {
|
|
1994
|
+
if (!(e instanceof C)) throw e;
|
|
1995
|
+
let n = /^Unexpected "(.*)" at chunk position "\d+" \(absolute position "(\d+)"\)/su.exec(e.message);
|
|
1996
|
+
throw n?.[2] == null ? M("The JSON ends before it is complete", t) : M(`Unexpected '${n[1] ?? ""}'`, t + Number(n[2]));
|
|
1997
|
+
}
|
|
1880
1998
|
}
|
|
1881
|
-
function
|
|
1999
|
+
function P(e, t, n) {
|
|
1882
2000
|
let r = e.current;
|
|
1883
|
-
|
|
2001
|
+
if (r == null) {
|
|
2002
|
+
if (e.isRootClosed) throw M("Unexpected content after the end of the JSON", n);
|
|
2003
|
+
return { key: void 0 };
|
|
2004
|
+
}
|
|
2005
|
+
if (r.kindId === "object") {
|
|
2006
|
+
if (r.positionId === "afterKey") throw M("Expected ':'", n);
|
|
2007
|
+
if (r.positionId === "afterValue") throw M("Expected ',' or '}'", n);
|
|
2008
|
+
if (r.positionId !== "afterColon") throw M("Expected a key", n);
|
|
2009
|
+
return r.positionId = "afterValue", r.childCount++, { key: r.pendingKey };
|
|
2010
|
+
}
|
|
2011
|
+
if (!(r.isVirtual && t.isJsonLines) && r.positionId === "afterValue") throw M("Expected ','", n);
|
|
2012
|
+
return r.positionId = "afterValue", { key: r.childCount++ };
|
|
1884
2013
|
}
|
|
1885
|
-
function
|
|
1886
|
-
let { key: a } =
|
|
1887
|
-
n.current =
|
|
2014
|
+
function F({ handlers: e, options: t, state: n }, r, i) {
|
|
2015
|
+
let { key: a } = P(n, t, i), o = n.current, s = o == null ? t.rootPath : [...o.path, a ?? ""];
|
|
2016
|
+
n.current = j({
|
|
1888
2017
|
depth: o == null ? 0 : o.depth + 1,
|
|
1889
2018
|
isVirtual: !1,
|
|
1890
2019
|
key: a,
|
|
@@ -1894,23 +2023,25 @@ function R({ handlers: e, options: t, state: n }, r, i) {
|
|
|
1894
2023
|
startOffset: i
|
|
1895
2024
|
}), e.onContainerStart?.(n.current);
|
|
1896
2025
|
}
|
|
1897
|
-
function
|
|
2026
|
+
function I({ handlers: e, state: t }, n, r) {
|
|
1898
2027
|
let i = t.current, a = n === "object" ? "}" : "]";
|
|
1899
|
-
if (i?.kindId !== n || i.positionId !== "start" && i.positionId !== "afterValue")
|
|
1900
|
-
e.onContainerEnd?.(i,
|
|
2028
|
+
if (i?.kindId !== n || i.positionId !== "start" && i.positionId !== "afterValue") throw M(`Unexpected '${a}'`, r);
|
|
2029
|
+
e.onContainerEnd?.(i, r + 1), t.current = i.isVirtual ? void 0 : i.parent, t.current ?? (t.isRootClosed = !0);
|
|
1901
2030
|
}
|
|
1902
|
-
function
|
|
1903
|
-
e.current?.positionId === "afterKey"
|
|
2031
|
+
function Se(e, t) {
|
|
2032
|
+
if (e.current?.positionId === "afterKey") e.current.positionId = "afterColon";
|
|
2033
|
+
else throw M("Unexpected ':'", t);
|
|
1904
2034
|
}
|
|
1905
|
-
function
|
|
1906
|
-
e.current?.positionId === "afterValue"
|
|
2035
|
+
function Ce(e, t) {
|
|
2036
|
+
if (e.current?.positionId === "afterValue") e.current.positionId = "afterComma";
|
|
2037
|
+
else throw M("Unexpected ','", t);
|
|
1907
2038
|
}
|
|
1908
|
-
function
|
|
2039
|
+
function we(e, t, n) {
|
|
1909
2040
|
let r = e.state.current;
|
|
1910
|
-
r?.kindId === "object" && (r.positionId === "start" || r.positionId === "afterComma") ? (r.pendingKey = t, r.positionId = "afterKey", e.handlers.onKey?.(r, t)) :
|
|
2041
|
+
r?.kindId === "object" && (r.positionId === "start" || r.positionId === "afterComma") ? (r.pendingKey = t, r.positionId = "afterKey", e.handlers.onKey?.(r, t)) : L(e, "string", t, n);
|
|
1911
2042
|
}
|
|
1912
|
-
function
|
|
1913
|
-
let o = n.current, { key: s } =
|
|
2043
|
+
function L({ handlers: e, options: t, state: n }, r, i, a) {
|
|
2044
|
+
let o = n.current, { key: s } = P(n, t, a);
|
|
1914
2045
|
e.onScalar?.({
|
|
1915
2046
|
key: s,
|
|
1916
2047
|
kindId: r,
|
|
@@ -1920,27 +2051,27 @@ function B({ handlers: e, options: t, state: n }, r, i, a) {
|
|
|
1920
2051
|
}), n.current ?? (n.isRootClosed = !0);
|
|
1921
2052
|
}
|
|
1922
2053
|
// src/itemRecords.ts
|
|
1923
|
-
var
|
|
1924
|
-
function
|
|
2054
|
+
var Te = "value";
|
|
2055
|
+
function R(e, t) {
|
|
1925
2056
|
let n = [], r, i = !1, a = !1, o = (e, t, r) => {
|
|
1926
2057
|
let i = n.at(-1);
|
|
1927
2058
|
i?.container === e && (Array.isArray(i.value) ? i.value.push(r) : i.value[String(t)] = r);
|
|
1928
2059
|
};
|
|
1929
2060
|
return {
|
|
1930
2061
|
handlers: {
|
|
1931
|
-
onContainerEnd: (e) => {
|
|
2062
|
+
onContainerEnd: (e, i) => {
|
|
1932
2063
|
e === r && (a = !0, r = void 0);
|
|
1933
|
-
let i = n.at(-1);
|
|
1934
|
-
if (i?.container !== e) return;
|
|
1935
|
-
n.pop();
|
|
1936
2064
|
let s = n.at(-1);
|
|
1937
|
-
|
|
2065
|
+
if (s?.container !== e) return;
|
|
2066
|
+
n.pop();
|
|
2067
|
+
let c = n.at(-1);
|
|
2068
|
+
c == null ? t(s.value, i) : o(c.container, e.key, s.value);
|
|
1938
2069
|
},
|
|
1939
2070
|
onContainerStart: (t) => {
|
|
1940
|
-
let a = !i &&
|
|
2071
|
+
let a = !i && U(t.path, e);
|
|
1941
2072
|
a && (i = !0, r = t), (a && t.kindId === "object" || r != null && t.parent === r && r.kindId === "list" || n.length > 0) && n.push({
|
|
1942
2073
|
container: t,
|
|
1943
|
-
value: t.kindId === "list" ? [] :
|
|
2074
|
+
value: t.kindId === "list" ? [] : Ee()
|
|
1944
2075
|
});
|
|
1945
2076
|
},
|
|
1946
2077
|
onScalar: (s) => {
|
|
@@ -1949,26 +2080,26 @@ function V(e, t) {
|
|
|
1949
2080
|
o(c, s.key, s.value);
|
|
1950
2081
|
return;
|
|
1951
2082
|
}
|
|
1952
|
-
let l = c?.kindId === "list" && c === r, u = !i &&
|
|
1953
|
-
u && (i = !0, a = !0), (l || u) && t(s.value);
|
|
2083
|
+
let l = c?.kindId === "list" && c === r, u = !i && U(c == null ? [] : [...c.path, s.key ?? ""], e);
|
|
2084
|
+
u && (i = !0, a = !0), (l || u) && t(s.value, s.startOffset);
|
|
1954
2085
|
}
|
|
1955
2086
|
},
|
|
1956
2087
|
isTargetClosed: () => a,
|
|
1957
2088
|
isTargetFound: () => i
|
|
1958
2089
|
};
|
|
1959
2090
|
}
|
|
1960
|
-
function
|
|
2091
|
+
function z(e) {
|
|
1961
2092
|
let t = /* @__PURE__ */ new Map();
|
|
1962
|
-
if (!
|
|
2093
|
+
if (!De(e)) return t.set(Te, e), t;
|
|
1963
2094
|
let n = (e, r) => {
|
|
1964
2095
|
for (let [i, a] of Object.entries(e)) {
|
|
1965
2096
|
let e = r === "" ? i : `${r}.${i}`;
|
|
1966
|
-
|
|
2097
|
+
De(a) && Object.keys(a).length > 0 ? n(a, e) : t.set(e, a);
|
|
1967
2098
|
}
|
|
1968
2099
|
};
|
|
1969
2100
|
return n(e, ""), t;
|
|
1970
2101
|
}
|
|
1971
|
-
function
|
|
2102
|
+
function B(e) {
|
|
1972
2103
|
let t = /* @__PURE__ */ new Map();
|
|
1973
2104
|
for (let n of e) for (let e of n.keys()) t.has(e) || t.set(e, t.size);
|
|
1974
2105
|
return {
|
|
@@ -1976,36 +2107,36 @@ function U(e) {
|
|
|
1976
2107
|
columnNames: t.keys().toArray()
|
|
1977
2108
|
};
|
|
1978
2109
|
}
|
|
1979
|
-
function
|
|
2110
|
+
function V(e) {
|
|
1980
2111
|
return e.columnNames.map((e) => ({
|
|
1981
2112
|
value: e,
|
|
1982
2113
|
valueWasQuoted: !0
|
|
1983
2114
|
}));
|
|
1984
2115
|
}
|
|
1985
|
-
function
|
|
2116
|
+
function H(e, t) {
|
|
1986
2117
|
let n = t.columnNames.map(() => ({
|
|
1987
2118
|
value: null,
|
|
1988
2119
|
valueWasQuoted: !1
|
|
1989
2120
|
})), r = !1;
|
|
1990
2121
|
for (let [i, a] of e) {
|
|
1991
2122
|
let e = t.columnIndexes.get(i);
|
|
1992
|
-
e == null ? r = !0 : n[e] =
|
|
2123
|
+
e == null ? r = !0 : n[e] = Oe(a);
|
|
1993
2124
|
}
|
|
1994
2125
|
return {
|
|
1995
2126
|
hasUnknownField: r,
|
|
1996
2127
|
record: n
|
|
1997
2128
|
};
|
|
1998
2129
|
}
|
|
1999
|
-
function
|
|
2130
|
+
function U(e, t) {
|
|
2000
2131
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
2001
2132
|
}
|
|
2002
|
-
function
|
|
2133
|
+
function Ee() {
|
|
2003
2134
|
return Object.create(null);
|
|
2004
2135
|
}
|
|
2005
|
-
function
|
|
2006
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && !
|
|
2136
|
+
function De(e) {
|
|
2137
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && !O(e);
|
|
2007
2138
|
}
|
|
2008
|
-
function
|
|
2139
|
+
function Oe(e) {
|
|
2009
2140
|
return e == null ? {
|
|
2010
2141
|
value: null,
|
|
2011
2142
|
valueWasQuoted: !1
|
|
@@ -2015,217 +2146,335 @@ function xe(e) {
|
|
|
2015
2146
|
} : typeof e == "boolean" ? {
|
|
2016
2147
|
value: String(e),
|
|
2017
2148
|
valueWasQuoted: !1
|
|
2018
|
-
} :
|
|
2149
|
+
} : O(e) ? {
|
|
2019
2150
|
value: e.numberText,
|
|
2020
2151
|
valueWasQuoted: !1
|
|
2021
2152
|
} : {
|
|
2022
|
-
value:
|
|
2153
|
+
value: A(e),
|
|
2023
2154
|
valueWasQuoted: !0
|
|
2024
2155
|
};
|
|
2025
2156
|
}
|
|
2157
|
+
// src/textPosition.ts
|
|
2158
|
+
var W = 10, ke = 4096, Ae = 20;
|
|
2159
|
+
function G(e) {
|
|
2160
|
+
let t = new TextDecoder(), n = /* @__PURE__ */ new Uint8Array(), r = 0, i = 0, a = /* @__PURE__ */ new Uint8Array();
|
|
2161
|
+
return {
|
|
2162
|
+
locate: (o) => {
|
|
2163
|
+
let s = Math.min(Math.max(o - r, 0), n.length), c = n.subarray(0, s), l = c.lastIndexOf(W), u = l === -1 ? je(a, c) : c.subarray(l + 1), d = n.subarray(s, s + Ae), f = d.indexOf(W), p = t.decode(u ?? c.subarray(l + 1)), m = t.decode(f === -1 ? d : d.subarray(0, f));
|
|
2164
|
+
return {
|
|
2165
|
+
columnNumber: u == null ? void 0 : p.length + 1,
|
|
2166
|
+
excerpt: `${p.slice(-40)}${m}`,
|
|
2167
|
+
lineNumber: e ? i + K(c) + 1 : void 0
|
|
2168
|
+
};
|
|
2169
|
+
},
|
|
2170
|
+
take: (e, t) => {
|
|
2171
|
+
let o = n.lastIndexOf(W);
|
|
2172
|
+
i += K(n), o === -1 ? a != null && (a = Me(a, n)) : a = new Uint8Array(n.subarray(o + 1)), a != null && a.length > ke && (a = void 0), n = e, r = t;
|
|
2173
|
+
}
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
function K(e) {
|
|
2177
|
+
let t = 0;
|
|
2178
|
+
for (let n = e.indexOf(W); n !== -1; n = e.indexOf(W, n + 1)) t++;
|
|
2179
|
+
return t;
|
|
2180
|
+
}
|
|
2181
|
+
function je(e, t) {
|
|
2182
|
+
return e == null ? void 0 : Me(e, t);
|
|
2183
|
+
}
|
|
2184
|
+
function Me(e, t) {
|
|
2185
|
+
let n = new Uint8Array(e.length + t.length);
|
|
2186
|
+
return n.set(e), n.set(t, e.length), n;
|
|
2187
|
+
}
|
|
2026
2188
|
// src/index.ts
|
|
2027
|
-
var
|
|
2189
|
+
var Ne = 4, Pe = 200, Fe = 1e4, Ie = 1e3, Le = 1, Re = 200, ze = "JSON must be encoded as UTF-8.", q = 1048576, J = /* @__PURE__ */ Error("Reading stopped once enough was known."), Be = class {
|
|
2028
2190
|
async buildStructureIndex(e, t) {
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2191
|
+
if (!X(t.encodingId)) return await e.cancel(), {
|
|
2192
|
+
byteCount: 0,
|
|
2193
|
+
isComplete: !1,
|
|
2194
|
+
issues: [$("JSON_ENCODING", ze, void 0)],
|
|
2195
|
+
nodes: [],
|
|
2196
|
+
suggestedStructurePath: void 0,
|
|
2197
|
+
tableCandidateCount: 0
|
|
2198
|
+
};
|
|
2199
|
+
let n = t.maxDepth ?? Ne, r = /* @__PURE__ */ new Map(), i = [], a = (e) => e.depth > n ? !1 : e.parent == null || (e.parent.kindId !== "list" || typeof e.key == "number" && e.key < Le) && r.has(e.parent), o = (e, t, n, i) => {
|
|
2200
|
+
let a = e == null ? void 0 : r.get(e);
|
|
2201
|
+
typeof t == "number" && a?.node.kindId === "list" && (t % Ie === 0 && a.node.checkpoints.push({
|
|
2032
2202
|
itemIndex: t,
|
|
2033
|
-
|
|
2034
|
-
}),
|
|
2035
|
-
}, s =
|
|
2203
|
+
locator: Xe(n, "list", t)
|
|
2204
|
+
}), i || (a.hasNonObjectItem = !0));
|
|
2205
|
+
}, s = {
|
|
2036
2206
|
onContainerEnd: (e, t) => {
|
|
2037
2207
|
let n = r.get(e);
|
|
2038
|
-
n != null && (n.node.endOffset = t, n.node.
|
|
2208
|
+
n != null && (n.node.locator.endOffset = t, n.node.isComplete = !0, Je(n), r.delete(e));
|
|
2039
2209
|
},
|
|
2040
2210
|
onContainerStart: (e) => {
|
|
2041
|
-
if (o(e.parent, e.key, e.startOffset, e.kindId === "object"), !
|
|
2211
|
+
if (o(e.parent, e.key, e.startOffset, e.kindId === "object"), !a(e)) return;
|
|
2042
2212
|
let t = {
|
|
2043
2213
|
checkpoints: [],
|
|
2044
2214
|
childCount: 0,
|
|
2045
|
-
|
|
2215
|
+
isComplete: !1,
|
|
2046
2216
|
isTableCandidate: !1,
|
|
2047
2217
|
keys: [],
|
|
2048
2218
|
kindId: e.kindId,
|
|
2049
|
-
|
|
2050
|
-
|
|
2219
|
+
locator: {
|
|
2220
|
+
endOffset: void 0,
|
|
2221
|
+
startOffset: e.startOffset,
|
|
2222
|
+
state: void 0
|
|
2223
|
+
},
|
|
2224
|
+
path: e.path
|
|
2051
2225
|
};
|
|
2052
2226
|
i.push(t), r.set(e, {
|
|
2227
|
+
container: e,
|
|
2053
2228
|
hasNonObjectItem: !1,
|
|
2054
2229
|
keySet: /* @__PURE__ */ new Set(),
|
|
2055
2230
|
node: t
|
|
2056
2231
|
});
|
|
2057
2232
|
},
|
|
2058
2233
|
onKey: (e, t) => {
|
|
2059
|
-
|
|
2060
|
-
let n =
|
|
2061
|
-
n?.node.kindId === "list" &&
|
|
2234
|
+
qe(r.get(e), t);
|
|
2235
|
+
let n = e.parent == null ? void 0 : r.get(e.parent);
|
|
2236
|
+
n?.node.kindId === "list" && qe(n, t);
|
|
2062
2237
|
},
|
|
2063
2238
|
onScalar: (e) => {
|
|
2064
2239
|
o(e.parent, e.key, e.startOffset, !1);
|
|
2065
2240
|
}
|
|
2066
|
-
}), l =
|
|
2067
|
-
|
|
2241
|
+
}, c = G(!0), l = D(Y(t.dataFormatId), s), u = await Ve(e, {
|
|
2242
|
+
abortSignal: t.abortSignal,
|
|
2243
|
+
isEnded: t.isComplete,
|
|
2244
|
+
onProgress: t.onProgress,
|
|
2245
|
+
tracker: c,
|
|
2246
|
+
walker: l
|
|
2247
|
+
});
|
|
2248
|
+
for (let e of r.values()) Je(e);
|
|
2249
|
+
for (let e of i) for (let t of e.checkpoints) t.locator.endOffset = e.locator.endOffset;
|
|
2250
|
+
let d = u.error == null ? [] : [Q(u.error, c)];
|
|
2068
2251
|
return {
|
|
2069
|
-
byteCount:
|
|
2070
|
-
|
|
2252
|
+
byteCount: u.byteCount,
|
|
2253
|
+
isComplete: t.isComplete && u.error == null,
|
|
2254
|
+
issues: d,
|
|
2255
|
+
nodes: i,
|
|
2256
|
+
...Ye(i, t.dataFormatId)
|
|
2071
2257
|
};
|
|
2072
2258
|
}
|
|
2073
2259
|
async listStructureEntries(e, t) {
|
|
2074
|
-
let n = t.maxValueLength ??
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
},
|
|
2260
|
+
let n = t.maxValueLength ?? Pe, { locator: r } = t, i = [], a, o, s = 0, c = 0, l = (e, n) => {
|
|
2261
|
+
if (i.length >= t.entryCount) {
|
|
2262
|
+
let t = n?.kindId === "object", i = typeof e.key == "number" ? e.key : (n?.childCount ?? 1) - 1;
|
|
2263
|
+
throw a = {
|
|
2264
|
+
...Xe(t ? c : e.locator.startOffset, t ? "object" : "list", i),
|
|
2265
|
+
endOffset: r.endOffset
|
|
2266
|
+
}, J;
|
|
2267
|
+
}
|
|
2268
|
+
i.push(e);
|
|
2269
|
+
}, u = D({
|
|
2270
|
+
baseOffset: r.startOffset,
|
|
2271
|
+
isJsonLines: t.dataFormatId === "jsonl" && t.path.length === 0,
|
|
2272
|
+
rootPath: t.path,
|
|
2273
|
+
startInside: Ze(r.state)
|
|
2274
|
+
}, {
|
|
2084
2275
|
onContainerEnd: (e, t) => {
|
|
2085
|
-
if (e.depth === 0) throw
|
|
2276
|
+
if (e.depth === 0) throw J;
|
|
2086
2277
|
if (e.depth !== 1) return;
|
|
2087
|
-
let n =
|
|
2088
|
-
n != null && (n.endOffset = t, n.childCount = e.childCount);
|
|
2278
|
+
let n = i.at(-1);
|
|
2279
|
+
n != null && (n.locator.endOffset = t, n.childCount = e.childCount);
|
|
2089
2280
|
},
|
|
2090
2281
|
onContainerStart: (e) => {
|
|
2091
|
-
e.depth
|
|
2282
|
+
if (e.depth !== 1) return;
|
|
2283
|
+
let t = {
|
|
2284
|
+
endOffset: void 0,
|
|
2285
|
+
startOffset: e.startOffset,
|
|
2286
|
+
state: void 0
|
|
2287
|
+
};
|
|
2288
|
+
l({
|
|
2092
2289
|
childCount: 0,
|
|
2093
|
-
endOffset: NaN,
|
|
2094
2290
|
isValueCut: !1,
|
|
2095
2291
|
key: e.key ?? "",
|
|
2096
2292
|
kindId: e.kindId,
|
|
2097
|
-
|
|
2293
|
+
locator: t,
|
|
2098
2294
|
value: void 0
|
|
2099
|
-
});
|
|
2295
|
+
}, e.parent);
|
|
2296
|
+
},
|
|
2297
|
+
onKey: (e) => {
|
|
2298
|
+
e.depth === 0 && (c = s);
|
|
2100
2299
|
},
|
|
2101
2300
|
onScalar: (e) => {
|
|
2102
2301
|
if (e.parent?.depth !== 0) return;
|
|
2103
|
-
let t =
|
|
2104
|
-
a = {
|
|
2302
|
+
let t = Qe(e.value), r = t != null && t.length > n, i = {
|
|
2105
2303
|
childCount: void 0,
|
|
2106
|
-
endOffset: NaN,
|
|
2107
2304
|
isValueCut: r,
|
|
2108
2305
|
key: e.key ?? "",
|
|
2109
2306
|
kindId: e.kindId,
|
|
2110
|
-
|
|
2307
|
+
locator: {
|
|
2308
|
+
endOffset: void 0,
|
|
2309
|
+
startOffset: e.startOffset,
|
|
2310
|
+
state: void 0
|
|
2311
|
+
},
|
|
2111
2312
|
value: r ? t.slice(0, n) : t
|
|
2112
|
-
}
|
|
2313
|
+
};
|
|
2314
|
+
l(i, e.parent), o = i;
|
|
2113
2315
|
},
|
|
2114
2316
|
onTokenStart: (e) => {
|
|
2115
|
-
|
|
2317
|
+
s = e, o != null && (o.locator.endOffset = e, o = void 0);
|
|
2116
2318
|
}
|
|
2117
|
-
}),
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2319
|
+
}), d = G(r.startOffset === 0), f = await Ve(e, {
|
|
2320
|
+
abortSignal: t.abortSignal,
|
|
2321
|
+
isEnded: !0,
|
|
2322
|
+
onProgress: void 0,
|
|
2323
|
+
tracker: d,
|
|
2324
|
+
walker: u
|
|
2325
|
+
});
|
|
2326
|
+
return o != null && (o.locator.endOffset = r.startOffset + f.byteCount), {
|
|
2327
|
+
entries: i,
|
|
2328
|
+
issues: f.error == null ? [] : [Q(f.error, d)],
|
|
2329
|
+
nextLocator: a
|
|
2121
2330
|
};
|
|
2122
2331
|
}
|
|
2123
2332
|
async *parseStream(e, t) {
|
|
2124
|
-
t.abortSignal.throwIfAborted();
|
|
2125
|
-
let n = Math.max(1, Math.floor(t.chunkSize ??
|
|
2333
|
+
if (t.abortSignal.throwIfAborted(), !X(t.encodingId)) throw Error(ze);
|
|
2334
|
+
let n = Math.max(1, Math.floor(t.chunkSize ?? Fe)), r = {
|
|
2126
2335
|
isHeaderSent: !1,
|
|
2127
2336
|
itemFields: [],
|
|
2128
2337
|
nonUniformRecordCount: 0,
|
|
2129
2338
|
recordCount: 0,
|
|
2130
2339
|
shape: void 0
|
|
2131
|
-
}, i =
|
|
2132
|
-
r.itemFields.push(
|
|
2133
|
-
}), a =
|
|
2134
|
-
|
|
2340
|
+
}, i = { isStopped: !1 }, a = R(t.structurePath ?? [], (e, n) => {
|
|
2341
|
+
if (r.itemFields.push(z(e)), t.byteLimit != null && n >= t.byteLimit || t.stopSignal?.aborted === !0) throw i.isStopped = !0, J;
|
|
2342
|
+
}), o = () => !i.isStopped && !a.isTargetClosed(), s = D(Y(t.dataFormatId), a.handlers), c = G(!0), l = e.getReader(), u = () => {
|
|
2343
|
+
b(() => void l.cancel(t.abortSignal.reason));
|
|
2135
2344
|
};
|
|
2136
|
-
t.abortSignal.addEventListener("abort",
|
|
2137
|
-
let
|
|
2345
|
+
t.abortSignal.addEventListener("abort", u, { once: !0 });
|
|
2346
|
+
let d = 0;
|
|
2138
2347
|
try {
|
|
2139
|
-
let e = await
|
|
2140
|
-
for (; !e.done &&
|
|
2141
|
-
|
|
2142
|
-
for (let
|
|
2143
|
-
|
|
2348
|
+
let e = await l.read();
|
|
2349
|
+
for (; !e.done && o();) {
|
|
2350
|
+
d += K(e.value);
|
|
2351
|
+
for (let i = 0; i < e.value.length && o(); i += q) t.abortSignal.throwIfAborted(), He(s, c, e.value.subarray(i, i + q)), yield* Ke(r, n, !1);
|
|
2352
|
+
o() && (e = await l.read());
|
|
2144
2353
|
}
|
|
2145
|
-
if (t.abortSignal.throwIfAborted(),
|
|
2146
|
-
|
|
2147
|
-
|
|
2354
|
+
if (t.abortSignal.throwIfAborted(), o() && Ue(() => {
|
|
2355
|
+
s.end();
|
|
2356
|
+
}, c), !a.isTargetFound()) throw Error(`Nothing found at ${$e(t.structurePath ?? [])}.`);
|
|
2357
|
+
return yield* Ke(r, n, !0), {
|
|
2358
|
+
byteCount: s.byteCount(),
|
|
2148
2359
|
commentLineCount: 0,
|
|
2149
2360
|
emptyLineCount: 0,
|
|
2150
|
-
|
|
2361
|
+
isComplete: !i.isStopped,
|
|
2362
|
+
lineCount: d,
|
|
2151
2363
|
nonUniformRecordCount: r.nonUniformRecordCount,
|
|
2152
2364
|
recordCount: r.recordCount
|
|
2153
2365
|
};
|
|
2154
2366
|
} finally {
|
|
2155
|
-
t.abortSignal.removeEventListener("abort",
|
|
2367
|
+
t.abortSignal.removeEventListener("abort", u), b(() => void l.cancel());
|
|
2156
2368
|
}
|
|
2157
2369
|
}
|
|
2158
2370
|
parseText(e, t) {
|
|
2159
|
-
let n = [], r =
|
|
2160
|
-
n.push(H(e));
|
|
2161
|
-
}), i = M(Z(t.dataFormatId), r.handlers), a = [], o = new TextEncoder().encode(e);
|
|
2162
|
-
try {
|
|
2163
|
-
i.write(o), t.isComplete && i.end(), t.isComplete && !r.isTargetFound() && a.push(Fe(`Nothing found at ${Ne(t.structurePath ?? [])}.`, o, void 0));
|
|
2164
|
-
} catch (e) {
|
|
2165
|
-
t.isComplete && a.push(Fe(e instanceof Error ? e.message : String(e), o, Pe(e)));
|
|
2166
|
-
}
|
|
2167
|
-
let s = U(n), c = n.length === 0 ? [] : [W(s), ...n.map((e) => G(e, s).record)];
|
|
2371
|
+
let n = [], r = t.dataFormatId === "jsonl" ? Ge(e, t.isComplete, n) : We(e, t, n), i = B(n), a = n.length === 0 ? [] : [V(i), ...n.map((e) => H(e, i).record)], o = n.length !== 0 || void 0;
|
|
2168
2372
|
return Promise.resolve({
|
|
2169
|
-
|
|
2170
|
-
|
|
2373
|
+
hasHeaders: o,
|
|
2374
|
+
issues: r,
|
|
2375
|
+
parsedRecords: a,
|
|
2171
2376
|
recordDelimiterId: "\n",
|
|
2172
2377
|
valueDelimiterId: void 0
|
|
2173
2378
|
});
|
|
2174
2379
|
}
|
|
2175
2380
|
};
|
|
2176
|
-
function
|
|
2381
|
+
function Y(e) {
|
|
2177
2382
|
return {
|
|
2178
2383
|
baseOffset: 0,
|
|
2179
|
-
firstItemIndex: 0,
|
|
2180
2384
|
isJsonLines: e === "jsonl",
|
|
2181
|
-
|
|
2182
|
-
|
|
2385
|
+
rootPath: [],
|
|
2386
|
+
startInside: void 0
|
|
2183
2387
|
};
|
|
2184
2388
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2389
|
+
function X(e) {
|
|
2390
|
+
return ce(e) === "utf-8";
|
|
2391
|
+
}
|
|
2392
|
+
async function Ve(e, t) {
|
|
2393
|
+
let { abortSignal: n, isEnded: r, onProgress: i, tracker: a, walker: o } = t;
|
|
2394
|
+
n.throwIfAborted();
|
|
2395
|
+
let s = e.getReader(), c = () => {
|
|
2396
|
+
b(() => void s.cancel(n.reason));
|
|
2189
2397
|
};
|
|
2190
|
-
|
|
2191
|
-
let o = 0;
|
|
2398
|
+
n.addEventListener("abort", c, { once: !0 });
|
|
2192
2399
|
try {
|
|
2193
|
-
let e = await
|
|
2400
|
+
let e = await s.read();
|
|
2194
2401
|
for (; !e.done;) {
|
|
2195
|
-
for (let
|
|
2196
|
-
|
|
2197
|
-
let
|
|
2198
|
-
o
|
|
2402
|
+
for (let t = 0; t < e.value.length; t += q) {
|
|
2403
|
+
n.throwIfAborted();
|
|
2404
|
+
let r = e.value.subarray(t, t + q);
|
|
2405
|
+
a.take(r, o.byteCount()), o.write(r);
|
|
2199
2406
|
}
|
|
2200
|
-
|
|
2407
|
+
i?.(o.byteCount()), e = await s.read();
|
|
2201
2408
|
}
|
|
2202
|
-
return
|
|
2409
|
+
return n.throwIfAborted(), r && o.end(), {
|
|
2410
|
+
byteCount: o.byteCount(),
|
|
2411
|
+
error: void 0
|
|
2412
|
+
};
|
|
2203
2413
|
} catch (e) {
|
|
2204
|
-
if (e ===
|
|
2414
|
+
if (e === J) return {
|
|
2415
|
+
byteCount: o.byteCount(),
|
|
2416
|
+
error: void 0
|
|
2417
|
+
};
|
|
2418
|
+
if (k(e)) return {
|
|
2419
|
+
byteCount: o.byteCount(),
|
|
2420
|
+
error: e
|
|
2421
|
+
};
|
|
2205
2422
|
throw e;
|
|
2206
2423
|
} finally {
|
|
2207
|
-
|
|
2424
|
+
n.removeEventListener("abort", c), b(() => void s.cancel());
|
|
2208
2425
|
}
|
|
2209
2426
|
}
|
|
2210
|
-
function
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
return (e, t) => r.encode(n.decode(e, { stream: !t }));
|
|
2427
|
+
function He(e, t, n) {
|
|
2428
|
+
t.take(n, e.byteCount()), Ue(() => {
|
|
2429
|
+
e.write(n);
|
|
2430
|
+
}, t);
|
|
2215
2431
|
}
|
|
2216
|
-
function
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2432
|
+
function Ue(e, t) {
|
|
2433
|
+
try {
|
|
2434
|
+
e();
|
|
2435
|
+
} catch (e) {
|
|
2436
|
+
if (e === J) return;
|
|
2437
|
+
throw k(e) ? Error(Z(e, t), { cause: e }) : e;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
function We(e, t, n) {
|
|
2441
|
+
let r = R(t.structurePath ?? [], (e) => {
|
|
2442
|
+
n.push(z(e));
|
|
2443
|
+
}), i = D(Y("json"), r.handlers), a = G(!0), o = new TextEncoder().encode(e);
|
|
2444
|
+
a.take(o, 0);
|
|
2445
|
+
try {
|
|
2446
|
+
i.write(o), t.isComplete && i.end();
|
|
2447
|
+
} catch (e) {
|
|
2448
|
+
if (!k(e)) throw e;
|
|
2449
|
+
return [Q(e, a)];
|
|
2450
|
+
}
|
|
2451
|
+
return t.isComplete && !r.isTargetFound() ? [$("JSON_NOT_FOUND", `Nothing found at ${$e(t.structurePath ?? [])}.`, void 0)] : [];
|
|
2220
2452
|
}
|
|
2221
|
-
function
|
|
2453
|
+
function Ge(e, t, n) {
|
|
2454
|
+
let r = [], i = e.split("\n");
|
|
2455
|
+
for (let [e, a] of i.entries()) {
|
|
2456
|
+
if (a.trim() === "") continue;
|
|
2457
|
+
let o = [], s = R([], (e) => {
|
|
2458
|
+
o.push(e);
|
|
2459
|
+
}), c = D(Y("json"), s.handlers), l = new TextEncoder().encode(a);
|
|
2460
|
+
try {
|
|
2461
|
+
c.write(l), c.end();
|
|
2462
|
+
for (let e of o) n.push(z(e));
|
|
2463
|
+
} catch (n) {
|
|
2464
|
+
if (!k(n)) throw n;
|
|
2465
|
+
(t || e !== i.length - 1) && r.push(et(n, l, e + 1));
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
return r;
|
|
2469
|
+
}
|
|
2470
|
+
function* Ke(e, t, n) {
|
|
2222
2471
|
for (; e.itemFields.length >= t || n && e.itemFields.length > 0;) {
|
|
2223
2472
|
let n = e.itemFields.splice(0, t);
|
|
2224
|
-
e.shape ??=
|
|
2473
|
+
e.shape ??= B(n);
|
|
2225
2474
|
let r = [];
|
|
2226
|
-
e.isHeaderSent ||= (r.push(
|
|
2475
|
+
e.isHeaderSent ||= (r.push(V(e.shape)), !0);
|
|
2227
2476
|
for (let t of n) {
|
|
2228
|
-
let { hasUnknownField: n, record: i } =
|
|
2477
|
+
let { hasUnknownField: n, record: i } = H(t, e.shape);
|
|
2229
2478
|
n && e.nonUniformRecordCount++, r.push(i);
|
|
2230
2479
|
}
|
|
2231
2480
|
e.recordCount += r.length, yield {
|
|
@@ -2234,29 +2483,83 @@ function* $(e, t, n) {
|
|
|
2234
2483
|
};
|
|
2235
2484
|
}
|
|
2236
2485
|
}
|
|
2237
|
-
function
|
|
2238
|
-
e != null && e.keySet.size <
|
|
2486
|
+
function qe(e, t) {
|
|
2487
|
+
e != null && e.keySet.size < Re && e.keySet.add(t);
|
|
2239
2488
|
}
|
|
2240
|
-
function
|
|
2241
|
-
|
|
2489
|
+
function Je(e) {
|
|
2490
|
+
e.node.childCount = e.container.childCount, e.node.isTableCandidate = e.node.kindId === "list" && e.container.childCount > 0 && !e.hasNonObjectItem, e.node.keys = e.keySet.values().toArray();
|
|
2242
2491
|
}
|
|
2243
|
-
function
|
|
2492
|
+
function Ye(e, t) {
|
|
2493
|
+
let n = e.filter((e) => e.isTableCandidate && e.path.every((e) => typeof e == "string"));
|
|
2494
|
+
return t === "jsonl" ? {
|
|
2495
|
+
suggestedStructurePath: e.length > 0 ? [] : void 0,
|
|
2496
|
+
tableCandidateCount: n.length
|
|
2497
|
+
} : {
|
|
2498
|
+
suggestedStructurePath: n.length === 1 ? n[0]?.path : void 0,
|
|
2499
|
+
tableCandidateCount: n.length
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
function Xe(e, t, n) {
|
|
2503
|
+
return {
|
|
2504
|
+
endOffset: void 0,
|
|
2505
|
+
startOffset: e,
|
|
2506
|
+
state: JSON.stringify({
|
|
2507
|
+
firstIndex: n,
|
|
2508
|
+
kindId: t
|
|
2509
|
+
})
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
function Ze(e) {
|
|
2513
|
+
if (e == null) return;
|
|
2514
|
+
let t = JSON.parse(e);
|
|
2515
|
+
return {
|
|
2516
|
+
firstIndex: t.firstIndex,
|
|
2517
|
+
kindId: t.kindId
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
function Qe(e) {
|
|
2521
|
+
if (e != null) return typeof e == "string" ? e : typeof e == "boolean" ? String(e) : O(e) ? e.numberText : void 0;
|
|
2522
|
+
}
|
|
2523
|
+
function $e(e) {
|
|
2244
2524
|
return e.length === 0 ? "the top of the item" : `'${e.join(" › ")}'`;
|
|
2245
2525
|
}
|
|
2246
|
-
function
|
|
2247
|
-
let
|
|
2248
|
-
return
|
|
2526
|
+
function Z(e, t) {
|
|
2527
|
+
let { columnNumber: n, lineNumber: r } = t.locate(e.offset), i = e.message.replace(/\.$/u, "");
|
|
2528
|
+
return r == null ? `${i} at byte ${String(e.offset)}.` : n == null ? `${i} on line ${String(r)}.` : `${i} on line ${String(r)}, column ${String(n)}.`;
|
|
2529
|
+
}
|
|
2530
|
+
function Q(e, t) {
|
|
2531
|
+
let { columnNumber: n, excerpt: r, lineNumber: i } = t.locate(e.offset);
|
|
2532
|
+
return {
|
|
2533
|
+
...$("JSON_INVALID", Z(e, t), r),
|
|
2534
|
+
columnNumber: n,
|
|
2535
|
+
lineNumber: i
|
|
2536
|
+
};
|
|
2537
|
+
}
|
|
2538
|
+
function et(e, t, n) {
|
|
2539
|
+
let r = G(!0);
|
|
2540
|
+
r.take(t, 0);
|
|
2541
|
+
let { columnNumber: i, excerpt: a } = r.locate(e.offset);
|
|
2542
|
+
return {
|
|
2543
|
+
...$("JSON_INVALID", i == null ? `${e.message.replace(/\.$/u, "")} on line ${String(n)}.` : tt(e, n, i), a),
|
|
2544
|
+
columnNumber: i,
|
|
2545
|
+
lineNumber: n,
|
|
2546
|
+
recordNumber: n
|
|
2547
|
+
};
|
|
2548
|
+
}
|
|
2549
|
+
function tt(e, t, n) {
|
|
2550
|
+
return `${e.message.replace(/\.$/u, "")} on line ${String(t)}, column ${String(n)}.`;
|
|
2249
2551
|
}
|
|
2250
|
-
function
|
|
2552
|
+
function $(e, t, n) {
|
|
2251
2553
|
return {
|
|
2554
|
+
columnNumber: void 0,
|
|
2252
2555
|
endLineNumber: void 0,
|
|
2253
2556
|
fieldNumber: void 0,
|
|
2254
|
-
id:
|
|
2255
|
-
lineNumber:
|
|
2256
|
-
message:
|
|
2557
|
+
id: e,
|
|
2558
|
+
lineNumber: void 0,
|
|
2559
|
+
message: t,
|
|
2257
2560
|
recordNumber: void 0,
|
|
2258
2561
|
severityId: "error",
|
|
2259
|
-
value:
|
|
2562
|
+
value: n
|
|
2260
2563
|
};
|
|
2261
2564
|
}
|
|
2262
|
-
export {
|
|
2565
|
+
export { Be as Tool };
|