@sentio/sdk-bundle 4.0.1-rc.2 → 4.0.1-rc.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.
Files changed (64) hide show
  1. package/assets/chainlink-oracles-sepolia.json +21 -0
  2. package/assets/chainlink-oracles.json +219 -0
  3. package/dist/{0x1-B_N1Dd6d.js → 0x1-CWhLCIJf.js} +30 -22
  4. package/dist/0x1-CWhLCIJf.js.map +1 -0
  5. package/dist/{AbstractKeylessAccount-dvYSW9Go.js → AbstractKeylessAccount-DE1e2Glg.js} +3 -2
  6. package/dist/{AbstractKeylessAccount-dvYSW9Go.js.map → AbstractKeylessAccount-DE1e2Glg.js.map} +1 -1
  7. package/dist/_md-CZAi2AzY.js +644 -0
  8. package/dist/_md-CZAi2AzY.js.map +1 -0
  9. package/dist/aptos/builtin/0x1.js +2 -2
  10. package/dist/aptos/builtin/0x3.js +3 -3
  11. package/dist/aptos/builtin/0x3.js.map +1 -1
  12. package/dist/aptos/builtin/0x4.js +3 -3
  13. package/dist/aptos/builtin/0x4.js.map +1 -1
  14. package/dist/aptos/builtin/index.js +1 -1
  15. package/dist/aptos/ext/index.js +2 -2
  16. package/dist/aptos/index.js +2 -2
  17. package/dist/{aptos-DPeebJ9j.js → aptos-Cgfa8IQj.js} +257 -47
  18. package/dist/{aptos-DPeebJ9j.js.map → aptos-Cgfa8IQj.js.map} +1 -1
  19. package/dist/{coin-DREiK-Br.js → coin-CBrx3CpG.js} +1514 -105
  20. package/dist/coin-CBrx3CpG.js.map +1 -0
  21. package/dist/{coin-CWRVUEBa.js → coin-Mht4Jgvj.js} +803 -4
  22. package/dist/coin-Mht4Jgvj.js.map +1 -0
  23. package/dist/eth/builtin/eacaggregatorproxy.js +1 -1
  24. package/dist/eth/builtin/erc1155.js +1 -1
  25. package/dist/eth/builtin/erc20.js +1 -1
  26. package/dist/eth/builtin/erc721.js +1 -1
  27. package/dist/eth/builtin/index.js +1 -1
  28. package/dist/eth/builtin/weth9.js +1 -1
  29. package/dist/eth/index.js +1 -1
  30. package/dist/iota/builtin/0x1.js +3 -3
  31. package/dist/iota/builtin/0x2.js +168 -5
  32. package/dist/iota/builtin/0x2.js.map +1 -1
  33. package/dist/iota/builtin/0x3.js +3 -3
  34. package/dist/iota/ext/index.js +1 -1
  35. package/dist/iota/index.js +3 -3
  36. package/dist/{keyless-B3QnUmtL.js → keyless-nGiRkJjM.js} +1278 -976
  37. package/dist/keyless-nGiRkJjM.js.map +1 -0
  38. package/dist/move/index.js +1 -1
  39. package/dist/{move-Dr-DL5zT.js → move-BVvdKH2Q.js} +7 -7
  40. package/dist/{move-Dr-DL5zT.js.map → move-BVvdKH2Q.js.map} +1 -1
  41. package/dist/sui/builtin/0x1.js +1 -1
  42. package/dist/sui/builtin/0x2.js +4 -4
  43. package/dist/sui/builtin/0x3.js +4 -4
  44. package/dist/sui/builtin/index.js +1 -1
  45. package/dist/sui/ext/index.js +1 -1
  46. package/dist/sui/index.js +3 -3
  47. package/dist/{sui-BbKeYXM3.js → sui-BcHp8IsJ.js} +17 -17
  48. package/dist/{sui-BbKeYXM3.js.map → sui-BcHp8IsJ.js.map} +1 -1
  49. package/dist/testing/index.js +6 -6
  50. package/dist/utils/index.js +1 -1
  51. package/dist/{utils-Jndk-n_F.js → utils-BQ0dnllb.js} +11 -903
  52. package/dist/utils-BQ0dnllb.js.map +1 -0
  53. package/package.json +2 -2
  54. package/assets/chainlink-oracles-sepolia.csv +0 -19
  55. package/assets/chainlink-oracles.csv +0 -217
  56. package/dist/0x1-B_N1Dd6d.js.map +0 -1
  57. package/dist/base-BvfRCgEy.js +0 -959
  58. package/dist/base-BvfRCgEy.js.map +0 -1
  59. package/dist/coin-CWRVUEBa.js.map +0 -1
  60. package/dist/coin-DREiK-Br.js.map +0 -1
  61. package/dist/dist-CA96PSzE.js +0 -824
  62. package/dist/dist-CA96PSzE.js.map +0 -1
  63. package/dist/keyless-B3QnUmtL.js.map +0 -1
  64. package/dist/utils-Jndk-n_F.js.map +0 -1
@@ -17291,890 +17291,6 @@ var eacaggregatorproxy_exports = /* @__PURE__ */ __exportAll({
17291
17291
  mockOwnershipTransferredLog: () => mockOwnershipTransferredLog
17292
17292
  });
17293
17293
 
17294
- //#endregion
17295
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/CsvError.js
17296
- var CsvError = class CsvError extends Error {
17297
- constructor(code, message, options, ...contexts) {
17298
- if (Array.isArray(message)) message = message.join(" ").trim();
17299
- super(message);
17300
- if (Error.captureStackTrace !== void 0) Error.captureStackTrace(this, CsvError);
17301
- this.code = code;
17302
- for (const context of contexts) for (const key in context) {
17303
- const value = context[key];
17304
- this[key] = Buffer.isBuffer(value) ? value.toString(options.encoding) : value == null ? value : JSON.parse(JSON.stringify(value));
17305
- }
17306
- }
17307
- };
17308
-
17309
- //#endregion
17310
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/is_object.js
17311
- const is_object = function(obj) {
17312
- return typeof obj === "object" && obj !== null && !Array.isArray(obj);
17313
- };
17314
-
17315
- //#endregion
17316
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/normalize_columns_array.js
17317
- const normalize_columns_array = function(columns) {
17318
- const normalizedColumns = [];
17319
- for (let i = 0, l = columns.length; i < l; i++) {
17320
- const column = columns[i];
17321
- if (column === void 0 || column === null || column === false) normalizedColumns[i] = { disabled: true };
17322
- else if (typeof column === "string") normalizedColumns[i] = { name: column };
17323
- else if (is_object(column)) {
17324
- if (typeof column.name !== "string") throw new CsvError("CSV_OPTION_COLUMNS_MISSING_NAME", [
17325
- "Option columns missing name:",
17326
- `property "name" is required at position ${i}`,
17327
- "when column is an object literal"
17328
- ]);
17329
- normalizedColumns[i] = column;
17330
- } else throw new CsvError("CSV_INVALID_COLUMN_DEFINITION", [
17331
- "Invalid column definition:",
17332
- "expect a string or a literal object,",
17333
- `got ${JSON.stringify(column)} at position ${i}`
17334
- ]);
17335
- }
17336
- return normalizedColumns;
17337
- };
17338
-
17339
- //#endregion
17340
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/ResizeableBuffer.js
17341
- var ResizeableBuffer = class {
17342
- constructor(size = 100) {
17343
- this.size = size;
17344
- this.length = 0;
17345
- this.buf = Buffer.allocUnsafe(size);
17346
- }
17347
- prepend(val) {
17348
- if (Buffer.isBuffer(val)) {
17349
- const length = this.length + val.length;
17350
- if (length >= this.size) {
17351
- this.resize();
17352
- if (length >= this.size) throw Error("INVALID_BUFFER_STATE");
17353
- }
17354
- const buf = this.buf;
17355
- this.buf = Buffer.allocUnsafe(this.size);
17356
- val.copy(this.buf, 0);
17357
- buf.copy(this.buf, val.length);
17358
- this.length += val.length;
17359
- } else {
17360
- const length = this.length++;
17361
- if (length === this.size) this.resize();
17362
- const buf = this.clone();
17363
- this.buf[0] = val;
17364
- buf.copy(this.buf, 1, 0, length);
17365
- }
17366
- }
17367
- append(val) {
17368
- const length = this.length++;
17369
- if (length === this.size) this.resize();
17370
- this.buf[length] = val;
17371
- }
17372
- clone() {
17373
- return Buffer.from(this.buf.slice(0, this.length));
17374
- }
17375
- resize() {
17376
- const length = this.length;
17377
- this.size = this.size * 2;
17378
- const buf = Buffer.allocUnsafe(this.size);
17379
- this.buf.copy(buf, 0, 0, length);
17380
- this.buf = buf;
17381
- }
17382
- toString(encoding) {
17383
- if (encoding) return this.buf.slice(0, this.length).toString(encoding);
17384
- else return Uint8Array.prototype.slice.call(this.buf.slice(0, this.length));
17385
- }
17386
- toJSON() {
17387
- return this.toString("utf8");
17388
- }
17389
- reset() {
17390
- this.length = 0;
17391
- }
17392
- };
17393
-
17394
- //#endregion
17395
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/init_state.js
17396
- const np = 12;
17397
- const cr$1 = 13;
17398
- const nl$1 = 10;
17399
- const space = 32;
17400
- const tab = 9;
17401
- const init_state = function(options) {
17402
- return {
17403
- bomSkipped: false,
17404
- bufBytesStart: 0,
17405
- castField: options.cast_function,
17406
- commenting: false,
17407
- error: void 0,
17408
- enabled: options.from_line === 1,
17409
- escaping: false,
17410
- escapeIsQuote: Buffer.isBuffer(options.escape) && Buffer.isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0,
17411
- expectedRecordLength: Array.isArray(options.columns) ? options.columns.length : void 0,
17412
- field: new ResizeableBuffer(20),
17413
- firstLineToHeaders: options.cast_first_line_to_header,
17414
- needMoreDataSize: Math.max(options.comment !== null ? options.comment.length : 0, ...options.delimiter.map((delimiter) => delimiter.length), options.quote !== null ? options.quote.length : 0),
17415
- previousBuf: void 0,
17416
- quoting: false,
17417
- stop: false,
17418
- rawBuffer: new ResizeableBuffer(100),
17419
- record: [],
17420
- recordHasError: false,
17421
- record_length: 0,
17422
- recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 0 : Math.max(...options.record_delimiter.map((v) => v.length)),
17423
- trimChars: [Buffer.from(" ", options.encoding)[0], Buffer.from(" ", options.encoding)[0]],
17424
- wasQuoting: false,
17425
- wasRowDelimiter: false,
17426
- timchars: [
17427
- Buffer.from(Buffer.from([cr$1], "utf8").toString(), options.encoding),
17428
- Buffer.from(Buffer.from([nl$1], "utf8").toString(), options.encoding),
17429
- Buffer.from(Buffer.from([np], "utf8").toString(), options.encoding),
17430
- Buffer.from(Buffer.from([space], "utf8").toString(), options.encoding),
17431
- Buffer.from(Buffer.from([tab], "utf8").toString(), options.encoding)
17432
- ]
17433
- };
17434
- };
17435
-
17436
- //#endregion
17437
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/underscore.js
17438
- const underscore = function(str) {
17439
- return str.replace(/([A-Z])/g, function(_, match) {
17440
- return "_" + match.toLowerCase();
17441
- });
17442
- };
17443
-
17444
- //#endregion
17445
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/normalize_options.js
17446
- const normalize_options = function(opts) {
17447
- const options = {};
17448
- for (const opt in opts) options[underscore(opt)] = opts[opt];
17449
- if (options.encoding === void 0 || options.encoding === true) options.encoding = "utf8";
17450
- else if (options.encoding === null || options.encoding === false) options.encoding = null;
17451
- else if (typeof options.encoding !== "string" && options.encoding !== null) throw new CsvError("CSV_INVALID_OPTION_ENCODING", [
17452
- "Invalid option encoding:",
17453
- "encoding must be a string or null to return a buffer,",
17454
- `got ${JSON.stringify(options.encoding)}`
17455
- ], options);
17456
- if (options.bom === void 0 || options.bom === null || options.bom === false) options.bom = false;
17457
- else if (options.bom !== true) throw new CsvError("CSV_INVALID_OPTION_BOM", [
17458
- "Invalid option bom:",
17459
- "bom must be true,",
17460
- `got ${JSON.stringify(options.bom)}`
17461
- ], options);
17462
- options.cast_function = null;
17463
- if (options.cast === void 0 || options.cast === null || options.cast === false || options.cast === "") options.cast = void 0;
17464
- else if (typeof options.cast === "function") {
17465
- options.cast_function = options.cast;
17466
- options.cast = true;
17467
- } else if (options.cast !== true) throw new CsvError("CSV_INVALID_OPTION_CAST", [
17468
- "Invalid option cast:",
17469
- "cast must be true or a function,",
17470
- `got ${JSON.stringify(options.cast)}`
17471
- ], options);
17472
- if (options.cast_date === void 0 || options.cast_date === null || options.cast_date === false || options.cast_date === "") options.cast_date = false;
17473
- else if (options.cast_date === true) options.cast_date = function(value) {
17474
- const date = Date.parse(value);
17475
- return !isNaN(date) ? new Date(date) : value;
17476
- };
17477
- else if (typeof options.cast_date !== "function") throw new CsvError("CSV_INVALID_OPTION_CAST_DATE", [
17478
- "Invalid option cast_date:",
17479
- "cast_date must be true or a function,",
17480
- `got ${JSON.stringify(options.cast_date)}`
17481
- ], options);
17482
- options.cast_first_line_to_header = void 0;
17483
- if (options.columns === true) options.cast_first_line_to_header = void 0;
17484
- else if (typeof options.columns === "function") {
17485
- options.cast_first_line_to_header = options.columns;
17486
- options.columns = true;
17487
- } else if (Array.isArray(options.columns)) options.columns = normalize_columns_array(options.columns);
17488
- else if (options.columns === void 0 || options.columns === null || options.columns === false) options.columns = false;
17489
- else throw new CsvError("CSV_INVALID_OPTION_COLUMNS", [
17490
- "Invalid option columns:",
17491
- "expect an array, a function or true,",
17492
- `got ${JSON.stringify(options.columns)}`
17493
- ], options);
17494
- if (options.group_columns_by_name === void 0 || options.group_columns_by_name === null || options.group_columns_by_name === false) options.group_columns_by_name = false;
17495
- else if (options.group_columns_by_name !== true) throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [
17496
- "Invalid option group_columns_by_name:",
17497
- "expect an boolean,",
17498
- `got ${JSON.stringify(options.group_columns_by_name)}`
17499
- ], options);
17500
- else if (options.columns === false) throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", ["Invalid option group_columns_by_name:", "the `columns` mode must be activated."], options);
17501
- if (options.comment === void 0 || options.comment === null || options.comment === false || options.comment === "") options.comment = null;
17502
- else {
17503
- if (typeof options.comment === "string") options.comment = Buffer.from(options.comment, options.encoding);
17504
- if (!Buffer.isBuffer(options.comment)) throw new CsvError("CSV_INVALID_OPTION_COMMENT", [
17505
- "Invalid option comment:",
17506
- "comment must be a buffer or a string,",
17507
- `got ${JSON.stringify(options.comment)}`
17508
- ], options);
17509
- }
17510
- if (options.comment_no_infix === void 0 || options.comment_no_infix === null || options.comment_no_infix === false) options.comment_no_infix = false;
17511
- else if (options.comment_no_infix !== true) throw new CsvError("CSV_INVALID_OPTION_COMMENT", [
17512
- "Invalid option comment_no_infix:",
17513
- "value must be a boolean,",
17514
- `got ${JSON.stringify(options.comment_no_infix)}`
17515
- ], options);
17516
- const delimiter_json = JSON.stringify(options.delimiter);
17517
- if (!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter];
17518
- if (options.delimiter.length === 0) throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [
17519
- "Invalid option delimiter:",
17520
- "delimiter must be a non empty string or buffer or array of string|buffer,",
17521
- `got ${delimiter_json}`
17522
- ], options);
17523
- options.delimiter = options.delimiter.map(function(delimiter) {
17524
- if (delimiter === void 0 || delimiter === null || delimiter === false) return Buffer.from(",", options.encoding);
17525
- if (typeof delimiter === "string") delimiter = Buffer.from(delimiter, options.encoding);
17526
- if (!Buffer.isBuffer(delimiter) || delimiter.length === 0) throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [
17527
- "Invalid option delimiter:",
17528
- "delimiter must be a non empty string or buffer or array of string|buffer,",
17529
- `got ${delimiter_json}`
17530
- ], options);
17531
- return delimiter;
17532
- });
17533
- if (options.escape === void 0 || options.escape === true) options.escape = Buffer.from("\"", options.encoding);
17534
- else if (typeof options.escape === "string") options.escape = Buffer.from(options.escape, options.encoding);
17535
- else if (options.escape === null || options.escape === false) options.escape = null;
17536
- if (options.escape !== null) {
17537
- if (!Buffer.isBuffer(options.escape)) throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`);
17538
- }
17539
- if (options.from === void 0 || options.from === null) options.from = 1;
17540
- else {
17541
- if (typeof options.from === "string" && /\d+/.test(options.from)) options.from = parseInt(options.from);
17542
- if (Number.isInteger(options.from)) {
17543
- if (options.from < 0) throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`);
17544
- } else throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`);
17545
- }
17546
- if (options.from_line === void 0 || options.from_line === null) options.from_line = 1;
17547
- else {
17548
- if (typeof options.from_line === "string" && /\d+/.test(options.from_line)) options.from_line = parseInt(options.from_line);
17549
- if (Number.isInteger(options.from_line)) {
17550
- if (options.from_line <= 0) throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`);
17551
- } else throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`);
17552
- }
17553
- if (options.ignore_last_delimiters === void 0 || options.ignore_last_delimiters === null) options.ignore_last_delimiters = false;
17554
- else if (typeof options.ignore_last_delimiters === "number") {
17555
- options.ignore_last_delimiters = Math.floor(options.ignore_last_delimiters);
17556
- if (options.ignore_last_delimiters === 0) options.ignore_last_delimiters = false;
17557
- } else if (typeof options.ignore_last_delimiters !== "boolean") throw new CsvError("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS", [
17558
- "Invalid option `ignore_last_delimiters`:",
17559
- "the value must be a boolean value or an integer,",
17560
- `got ${JSON.stringify(options.ignore_last_delimiters)}`
17561
- ], options);
17562
- if (options.ignore_last_delimiters === true && options.columns === false) throw new CsvError("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS", ["The option `ignore_last_delimiters`", "requires the activation of the `columns` option"], options);
17563
- if (options.info === void 0 || options.info === null || options.info === false) options.info = false;
17564
- else if (options.info !== true) throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`);
17565
- if (options.max_record_size === void 0 || options.max_record_size === null || options.max_record_size === false) options.max_record_size = 0;
17566
- else if (Number.isInteger(options.max_record_size) && options.max_record_size >= 0) {} else if (typeof options.max_record_size === "string" && /\d+/.test(options.max_record_size)) options.max_record_size = parseInt(options.max_record_size);
17567
- else throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`);
17568
- if (options.objname === void 0 || options.objname === null || options.objname === false) options.objname = void 0;
17569
- else if (Buffer.isBuffer(options.objname)) {
17570
- if (options.objname.length === 0) throw new Error(`Invalid Option: objname must be a non empty buffer`);
17571
- if (options.encoding === null) {} else options.objname = options.objname.toString(options.encoding);
17572
- } else if (typeof options.objname === "string") {
17573
- if (options.objname.length === 0) throw new Error(`Invalid Option: objname must be a non empty string`);
17574
- } else if (typeof options.objname === "number") {} else throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`);
17575
- if (options.objname !== void 0) {
17576
- if (typeof options.objname === "number") {
17577
- if (options.columns !== false) throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field");
17578
- } else if (options.columns === false) throw Error("Invalid Option: objname field must be combined with columns or be defined as an index");
17579
- }
17580
- if (options.on_record === void 0 || options.on_record === null) options.on_record = void 0;
17581
- else if (typeof options.on_record !== "function") throw new CsvError("CSV_INVALID_OPTION_ON_RECORD", [
17582
- "Invalid option `on_record`:",
17583
- "expect a function,",
17584
- `got ${JSON.stringify(options.on_record)}`
17585
- ], options);
17586
- if (options.on_skip !== void 0 && options.on_skip !== null && typeof options.on_skip !== "function") throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(options.on_skip)}`);
17587
- if (options.quote === null || options.quote === false || options.quote === "") options.quote = null;
17588
- else {
17589
- if (options.quote === void 0 || options.quote === true) options.quote = Buffer.from("\"", options.encoding);
17590
- else if (typeof options.quote === "string") options.quote = Buffer.from(options.quote, options.encoding);
17591
- if (!Buffer.isBuffer(options.quote)) throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`);
17592
- }
17593
- if (options.raw === void 0 || options.raw === null || options.raw === false) options.raw = false;
17594
- else if (options.raw !== true) throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`);
17595
- if (options.record_delimiter === void 0) options.record_delimiter = [];
17596
- else if (typeof options.record_delimiter === "string" || Buffer.isBuffer(options.record_delimiter)) {
17597
- if (options.record_delimiter.length === 0) throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
17598
- "Invalid option `record_delimiter`:",
17599
- "value must be a non empty string or buffer,",
17600
- `got ${JSON.stringify(options.record_delimiter)}`
17601
- ], options);
17602
- options.record_delimiter = [options.record_delimiter];
17603
- } else if (!Array.isArray(options.record_delimiter)) throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
17604
- "Invalid option `record_delimiter`:",
17605
- "value must be a string, a buffer or array of string|buffer,",
17606
- `got ${JSON.stringify(options.record_delimiter)}`
17607
- ], options);
17608
- options.record_delimiter = options.record_delimiter.map(function(rd, i) {
17609
- if (typeof rd !== "string" && !Buffer.isBuffer(rd)) throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
17610
- "Invalid option `record_delimiter`:",
17611
- "value must be a string, a buffer or array of string|buffer",
17612
- `at index ${i},`,
17613
- `got ${JSON.stringify(rd)}`
17614
- ], options);
17615
- else if (rd.length === 0) throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
17616
- "Invalid option `record_delimiter`:",
17617
- "value must be a non empty string or buffer",
17618
- `at index ${i},`,
17619
- `got ${JSON.stringify(rd)}`
17620
- ], options);
17621
- if (typeof rd === "string") rd = Buffer.from(rd, options.encoding);
17622
- return rd;
17623
- });
17624
- if (typeof options.relax_column_count === "boolean") {} else if (options.relax_column_count === void 0 || options.relax_column_count === null) options.relax_column_count = false;
17625
- else throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`);
17626
- if (typeof options.relax_column_count_less === "boolean") {} else if (options.relax_column_count_less === void 0 || options.relax_column_count_less === null) options.relax_column_count_less = false;
17627
- else throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`);
17628
- if (typeof options.relax_column_count_more === "boolean") {} else if (options.relax_column_count_more === void 0 || options.relax_column_count_more === null) options.relax_column_count_more = false;
17629
- else throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`);
17630
- if (typeof options.relax_quotes === "boolean") {} else if (options.relax_quotes === void 0 || options.relax_quotes === null) options.relax_quotes = false;
17631
- else throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(options.relax_quotes)}`);
17632
- if (typeof options.skip_empty_lines === "boolean") {} else if (options.skip_empty_lines === void 0 || options.skip_empty_lines === null) options.skip_empty_lines = false;
17633
- else throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
17634
- if (typeof options.skip_records_with_empty_values === "boolean") {} else if (options.skip_records_with_empty_values === void 0 || options.skip_records_with_empty_values === null) options.skip_records_with_empty_values = false;
17635
- else throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
17636
- if (typeof options.skip_records_with_error === "boolean") {} else if (options.skip_records_with_error === void 0 || options.skip_records_with_error === null) options.skip_records_with_error = false;
17637
- else throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
17638
- if (options.rtrim === void 0 || options.rtrim === null || options.rtrim === false) options.rtrim = false;
17639
- else if (options.rtrim !== true) throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`);
17640
- if (options.ltrim === void 0 || options.ltrim === null || options.ltrim === false) options.ltrim = false;
17641
- else if (options.ltrim !== true) throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`);
17642
- if (options.trim === void 0 || options.trim === null || options.trim === false) options.trim = false;
17643
- else if (options.trim !== true) throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`);
17644
- if (options.trim === true && opts.ltrim !== false) options.ltrim = true;
17645
- else if (options.ltrim !== true) options.ltrim = false;
17646
- if (options.trim === true && opts.rtrim !== false) options.rtrim = true;
17647
- else if (options.rtrim !== true) options.rtrim = false;
17648
- if (options.to === void 0 || options.to === null) options.to = -1;
17649
- else if (options.to !== -1) {
17650
- if (typeof options.to === "string" && /\d+/.test(options.to)) options.to = parseInt(options.to);
17651
- if (Number.isInteger(options.to)) {
17652
- if (options.to <= 0) throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`);
17653
- } else throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`);
17654
- }
17655
- if (options.to_line === void 0 || options.to_line === null) options.to_line = -1;
17656
- else if (options.to_line !== -1) {
17657
- if (typeof options.to_line === "string" && /\d+/.test(options.to_line)) options.to_line = parseInt(options.to_line);
17658
- if (Number.isInteger(options.to_line)) {
17659
- if (options.to_line <= 0) throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`);
17660
- } else throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`);
17661
- }
17662
- return options;
17663
- };
17664
-
17665
- //#endregion
17666
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/index.js
17667
- const isRecordEmpty = function(record) {
17668
- return record.every((field) => field == null || field.toString && field.toString().trim() === "");
17669
- };
17670
- const cr = 13;
17671
- const nl = 10;
17672
- const boms = {
17673
- utf8: Buffer.from([
17674
- 239,
17675
- 187,
17676
- 191
17677
- ]),
17678
- utf16le: Buffer.from([255, 254])
17679
- };
17680
- const transform = function(original_options = {}) {
17681
- const info = {
17682
- bytes: 0,
17683
- comment_lines: 0,
17684
- empty_lines: 0,
17685
- invalid_field_length: 0,
17686
- lines: 1,
17687
- records: 0
17688
- };
17689
- const options = normalize_options(original_options);
17690
- return {
17691
- info,
17692
- original_options,
17693
- options,
17694
- state: init_state(options),
17695
- __needMoreData: function(i, bufLen, end) {
17696
- if (end) return false;
17697
- const { encoding, escape, quote } = this.options;
17698
- const { quoting, needMoreDataSize, recordDelimiterMaxLength } = this.state;
17699
- return bufLen - i - 1 < Math.max(needMoreDataSize, recordDelimiterMaxLength === 0 ? Buffer.from("\r\n", encoding).length : recordDelimiterMaxLength, quoting ? (escape === null ? 0 : escape.length) + quote.length : 0, quoting ? quote.length + recordDelimiterMaxLength : 0);
17700
- },
17701
- parse: function(nextBuf, end, push, close) {
17702
- const { bom, comment_no_infix, encoding, from_line, ltrim, max_record_size, raw, relax_quotes, rtrim, skip_empty_lines, to, to_line } = this.options;
17703
- let { comment, escape, quote, record_delimiter } = this.options;
17704
- const { bomSkipped, previousBuf, rawBuffer, escapeIsQuote } = this.state;
17705
- let buf;
17706
- if (previousBuf === void 0) if (nextBuf === void 0) {
17707
- close();
17708
- return;
17709
- } else buf = nextBuf;
17710
- else if (previousBuf !== void 0 && nextBuf === void 0) buf = previousBuf;
17711
- else buf = Buffer.concat([previousBuf, nextBuf]);
17712
- if (bomSkipped === false) if (bom === false) this.state.bomSkipped = true;
17713
- else if (buf.length < 3) {
17714
- if (end === false) {
17715
- this.state.previousBuf = buf;
17716
- return;
17717
- }
17718
- } else {
17719
- for (const encoding in boms) if (boms[encoding].compare(buf, 0, boms[encoding].length) === 0) {
17720
- const bomLength = boms[encoding].length;
17721
- this.state.bufBytesStart += bomLength;
17722
- buf = buf.slice(bomLength);
17723
- const options = normalize_options({
17724
- ...this.original_options,
17725
- encoding
17726
- });
17727
- for (const key in options) this.options[key] = options[key];
17728
- ({comment, escape, quote} = this.options);
17729
- break;
17730
- }
17731
- this.state.bomSkipped = true;
17732
- }
17733
- const bufLen = buf.length;
17734
- let pos;
17735
- for (pos = 0; pos < bufLen; pos++) {
17736
- if (this.__needMoreData(pos, bufLen, end)) break;
17737
- if (this.state.wasRowDelimiter === true) {
17738
- this.info.lines++;
17739
- this.state.wasRowDelimiter = false;
17740
- }
17741
- if (to_line !== -1 && this.info.lines > to_line) {
17742
- this.state.stop = true;
17743
- close();
17744
- return;
17745
- }
17746
- if (this.state.quoting === false && record_delimiter.length === 0) {
17747
- if (this.__autoDiscoverRecordDelimiter(buf, pos)) record_delimiter = this.options.record_delimiter;
17748
- }
17749
- const chr = buf[pos];
17750
- if (raw === true) rawBuffer.append(chr);
17751
- if ((chr === cr || chr === nl) && this.state.wasRowDelimiter === false) this.state.wasRowDelimiter = true;
17752
- if (this.state.escaping === true) this.state.escaping = false;
17753
- else {
17754
- if (escape !== null && this.state.quoting === true && this.__isEscape(buf, pos, chr) && pos + escape.length < bufLen) if (escapeIsQuote) {
17755
- if (this.__isQuote(buf, pos + escape.length)) {
17756
- this.state.escaping = true;
17757
- pos += escape.length - 1;
17758
- continue;
17759
- }
17760
- } else {
17761
- this.state.escaping = true;
17762
- pos += escape.length - 1;
17763
- continue;
17764
- }
17765
- if (this.state.commenting === false && this.__isQuote(buf, pos)) if (this.state.quoting === true) {
17766
- const nextChr = buf[pos + quote.length];
17767
- const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos + quote.length);
17768
- const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos + quote.length, nextChr);
17769
- const isNextChrDelimiter = this.__isDelimiter(buf, pos + quote.length, nextChr);
17770
- const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos + quote.length) : this.__isRecordDelimiter(nextChr, buf, pos + quote.length);
17771
- if (escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)) pos += escape.length - 1;
17772
- else if (!nextChr || isNextChrDelimiter || isNextChrRecordDelimiter || isNextChrComment || isNextChrTrimable) {
17773
- this.state.quoting = false;
17774
- this.state.wasQuoting = true;
17775
- pos += quote.length - 1;
17776
- continue;
17777
- } else if (relax_quotes === false) {
17778
- const err = this.__error(new CsvError("CSV_INVALID_CLOSING_QUOTE", [
17779
- "Invalid Closing Quote:",
17780
- `got "${String.fromCharCode(nextChr)}"`,
17781
- `at line ${this.info.lines}`,
17782
- "instead of delimiter, record delimiter, trimable character",
17783
- "(if activated) or comment"
17784
- ], this.options, this.__infoField()));
17785
- if (err !== void 0) return err;
17786
- } else {
17787
- this.state.quoting = false;
17788
- this.state.wasQuoting = true;
17789
- this.state.field.prepend(quote);
17790
- pos += quote.length - 1;
17791
- }
17792
- } else if (this.state.field.length !== 0) {
17793
- if (relax_quotes === false) {
17794
- const info = this.__infoField();
17795
- const bom = Object.keys(boms).map((b) => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
17796
- const err = this.__error(new CsvError("INVALID_OPENING_QUOTE", [
17797
- "Invalid Opening Quote:",
17798
- `a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
17799
- bom ? `(${bom} bom)` : void 0
17800
- ], this.options, info, { field: this.state.field }));
17801
- if (err !== void 0) return err;
17802
- }
17803
- } else {
17804
- this.state.quoting = true;
17805
- pos += quote.length - 1;
17806
- continue;
17807
- }
17808
- if (this.state.quoting === false) {
17809
- const recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos);
17810
- if (recordDelimiterLength !== 0) {
17811
- if (this.state.commenting && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) this.info.comment_lines++;
17812
- else {
17813
- if (this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1 : 0) >= from_line) {
17814
- this.state.enabled = true;
17815
- this.__resetField();
17816
- this.__resetRecord();
17817
- pos += recordDelimiterLength - 1;
17818
- continue;
17819
- }
17820
- if (skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) {
17821
- this.info.empty_lines++;
17822
- pos += recordDelimiterLength - 1;
17823
- continue;
17824
- }
17825
- this.info.bytes = this.state.bufBytesStart + pos;
17826
- const errField = this.__onField();
17827
- if (errField !== void 0) return errField;
17828
- this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength;
17829
- const errRecord = this.__onRecord(push);
17830
- if (errRecord !== void 0) return errRecord;
17831
- if (to !== -1 && this.info.records >= to) {
17832
- this.state.stop = true;
17833
- close();
17834
- return;
17835
- }
17836
- }
17837
- this.state.commenting = false;
17838
- pos += recordDelimiterLength - 1;
17839
- continue;
17840
- }
17841
- if (this.state.commenting) continue;
17842
- if (comment !== null && (comment_no_infix === false || this.state.record.length === 0 && this.state.field.length === 0)) {
17843
- if (this.__compareBytes(comment, buf, pos, chr) !== 0) {
17844
- this.state.commenting = true;
17845
- continue;
17846
- }
17847
- }
17848
- const delimiterLength = this.__isDelimiter(buf, pos, chr);
17849
- if (delimiterLength !== 0) {
17850
- this.info.bytes = this.state.bufBytesStart + pos;
17851
- const errField = this.__onField();
17852
- if (errField !== void 0) return errField;
17853
- pos += delimiterLength - 1;
17854
- continue;
17855
- }
17856
- }
17857
- }
17858
- if (this.state.commenting === false) {
17859
- if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) return this.__error(new CsvError("CSV_MAX_RECORD_SIZE", [
17860
- "Max Record Size:",
17861
- "record exceed the maximum number of tolerated bytes",
17862
- `of ${max_record_size}`,
17863
- `at line ${this.info.lines}`
17864
- ], this.options, this.__infoField()));
17865
- }
17866
- const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(buf, pos);
17867
- const rappend = rtrim === false || this.state.wasQuoting === false;
17868
- if (lappend === true && rappend === true) this.state.field.append(chr);
17869
- else if (rtrim === true && !this.__isCharTrimable(buf, pos)) return this.__error(new CsvError("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE", [
17870
- "Invalid Closing Quote:",
17871
- "found non trimable byte after quote",
17872
- `at line ${this.info.lines}`
17873
- ], this.options, this.__infoField()));
17874
- else {
17875
- if (lappend === false) pos += this.__isCharTrimable(buf, pos) - 1;
17876
- continue;
17877
- }
17878
- }
17879
- if (end === true) {
17880
- if (this.state.quoting === true) {
17881
- const err = this.__error(new CsvError("CSV_QUOTE_NOT_CLOSED", ["Quote Not Closed:", `the parsing is finished with an opening quote at line ${this.info.lines}`], this.options, this.__infoField()));
17882
- if (err !== void 0) return err;
17883
- } else if (this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0) {
17884
- this.info.bytes = this.state.bufBytesStart + pos;
17885
- const errField = this.__onField();
17886
- if (errField !== void 0) return errField;
17887
- const errRecord = this.__onRecord(push);
17888
- if (errRecord !== void 0) return errRecord;
17889
- } else if (this.state.wasRowDelimiter === true) this.info.empty_lines++;
17890
- else if (this.state.commenting === true) this.info.comment_lines++;
17891
- } else {
17892
- this.state.bufBytesStart += pos;
17893
- this.state.previousBuf = buf.slice(pos);
17894
- }
17895
- if (this.state.wasRowDelimiter === true) {
17896
- this.info.lines++;
17897
- this.state.wasRowDelimiter = false;
17898
- }
17899
- },
17900
- __onRecord: function(push) {
17901
- const { columns, group_columns_by_name, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_records_with_empty_values } = this.options;
17902
- const { enabled, record } = this.state;
17903
- if (enabled === false) return this.__resetRecord();
17904
- const recordLength = record.length;
17905
- if (columns === true) {
17906
- if (skip_records_with_empty_values === true && isRecordEmpty(record)) {
17907
- this.__resetRecord();
17908
- return;
17909
- }
17910
- return this.__firstLineToColumns(record);
17911
- }
17912
- if (columns === false && this.info.records === 0) this.state.expectedRecordLength = recordLength;
17913
- if (recordLength !== this.state.expectedRecordLength) {
17914
- const err = columns === false ? new CsvError("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH", [
17915
- "Invalid Record Length:",
17916
- `expect ${this.state.expectedRecordLength},`,
17917
- `got ${recordLength} on line ${this.info.lines}`
17918
- ], this.options, this.__infoField(), { record }) : new CsvError("CSV_RECORD_INCONSISTENT_COLUMNS", [
17919
- "Invalid Record Length:",
17920
- `columns length is ${columns.length},`,
17921
- `got ${recordLength} on line ${this.info.lines}`
17922
- ], this.options, this.__infoField(), { record });
17923
- if (relax_column_count === true || relax_column_count_less === true && recordLength < this.state.expectedRecordLength || relax_column_count_more === true && recordLength > this.state.expectedRecordLength) {
17924
- this.info.invalid_field_length++;
17925
- this.state.error = err;
17926
- } else {
17927
- const finalErr = this.__error(err);
17928
- if (finalErr) return finalErr;
17929
- }
17930
- }
17931
- if (skip_records_with_empty_values === true && isRecordEmpty(record)) {
17932
- this.__resetRecord();
17933
- return;
17934
- }
17935
- if (this.state.recordHasError === true) {
17936
- this.__resetRecord();
17937
- this.state.recordHasError = false;
17938
- return;
17939
- }
17940
- this.info.records++;
17941
- if (from === 1 || this.info.records >= from) {
17942
- const { objname } = this.options;
17943
- if (columns !== false) {
17944
- const obj = {};
17945
- for (let i = 0, l = record.length; i < l; i++) {
17946
- if (columns[i] === void 0 || columns[i].disabled) continue;
17947
- if (group_columns_by_name === true && obj[columns[i].name] !== void 0) if (Array.isArray(obj[columns[i].name])) obj[columns[i].name] = obj[columns[i].name].concat(record[i]);
17948
- else obj[columns[i].name] = [obj[columns[i].name], record[i]];
17949
- else obj[columns[i].name] = record[i];
17950
- }
17951
- if (raw === true || info === true) {
17952
- const extRecord = Object.assign({ record: obj }, raw === true ? { raw: this.state.rawBuffer.toString(encoding) } : {}, info === true ? { info: this.__infoRecord() } : {});
17953
- const err = this.__push(objname === void 0 ? extRecord : [obj[objname], extRecord], push);
17954
- if (err) return err;
17955
- } else {
17956
- const err = this.__push(objname === void 0 ? obj : [obj[objname], obj], push);
17957
- if (err) return err;
17958
- }
17959
- } else if (raw === true || info === true) {
17960
- const extRecord = Object.assign({ record }, raw === true ? { raw: this.state.rawBuffer.toString(encoding) } : {}, info === true ? { info: this.__infoRecord() } : {});
17961
- const err = this.__push(objname === void 0 ? extRecord : [record[objname], extRecord], push);
17962
- if (err) return err;
17963
- } else {
17964
- const err = this.__push(objname === void 0 ? record : [record[objname], record], push);
17965
- if (err) return err;
17966
- }
17967
- }
17968
- this.__resetRecord();
17969
- },
17970
- __firstLineToColumns: function(record) {
17971
- const { firstLineToHeaders } = this.state;
17972
- try {
17973
- const headers = firstLineToHeaders === void 0 ? record : firstLineToHeaders.call(null, record);
17974
- if (!Array.isArray(headers)) return this.__error(new CsvError("CSV_INVALID_COLUMN_MAPPING", [
17975
- "Invalid Column Mapping:",
17976
- "expect an array from column function,",
17977
- `got ${JSON.stringify(headers)}`
17978
- ], this.options, this.__infoField(), { headers }));
17979
- const normalizedHeaders = normalize_columns_array(headers);
17980
- this.state.expectedRecordLength = normalizedHeaders.length;
17981
- this.options.columns = normalizedHeaders;
17982
- this.__resetRecord();
17983
- return;
17984
- } catch (err) {
17985
- return err;
17986
- }
17987
- },
17988
- __resetRecord: function() {
17989
- if (this.options.raw === true) this.state.rawBuffer.reset();
17990
- this.state.error = void 0;
17991
- this.state.record = [];
17992
- this.state.record_length = 0;
17993
- },
17994
- __onField: function() {
17995
- const { cast, encoding, rtrim, max_record_size } = this.options;
17996
- const { enabled, wasQuoting } = this.state;
17997
- if (enabled === false) return this.__resetField();
17998
- let field = this.state.field.toString(encoding);
17999
- if (rtrim === true && wasQuoting === false) field = field.trimRight();
18000
- if (cast === true) {
18001
- const [err, f] = this.__cast(field);
18002
- if (err !== void 0) return err;
18003
- field = f;
18004
- }
18005
- this.state.record.push(field);
18006
- if (max_record_size !== 0 && typeof field === "string") this.state.record_length += field.length;
18007
- this.__resetField();
18008
- },
18009
- __resetField: function() {
18010
- this.state.field.reset();
18011
- this.state.wasQuoting = false;
18012
- },
18013
- __push: function(record, push) {
18014
- const { on_record } = this.options;
18015
- if (on_record !== void 0) {
18016
- const info = this.__infoRecord();
18017
- try {
18018
- record = on_record.call(null, record, info);
18019
- } catch (err) {
18020
- return err;
18021
- }
18022
- if (record === void 0 || record === null) return;
18023
- }
18024
- push(record);
18025
- },
18026
- __cast: function(field) {
18027
- const { columns, relax_column_count } = this.options;
18028
- if (Array.isArray(columns) === true && relax_column_count && this.options.columns.length <= this.state.record.length) return [void 0, void 0];
18029
- if (this.state.castField !== null) try {
18030
- const info = this.__infoField();
18031
- return [void 0, this.state.castField.call(null, field, info)];
18032
- } catch (err) {
18033
- return [err];
18034
- }
18035
- if (this.__isFloat(field)) return [void 0, parseFloat(field)];
18036
- else if (this.options.cast_date !== false) {
18037
- const info = this.__infoField();
18038
- return [void 0, this.options.cast_date.call(null, field, info)];
18039
- }
18040
- return [void 0, field];
18041
- },
18042
- __isCharTrimable: function(buf, pos) {
18043
- const isTrim = (buf, pos) => {
18044
- const { timchars } = this.state;
18045
- loop1: for (let i = 0; i < timchars.length; i++) {
18046
- const timchar = timchars[i];
18047
- for (let j = 0; j < timchar.length; j++) if (timchar[j] !== buf[pos + j]) continue loop1;
18048
- return timchar.length;
18049
- }
18050
- return 0;
18051
- };
18052
- return isTrim(buf, pos);
18053
- },
18054
- __isFloat: function(value) {
18055
- return value - parseFloat(value) + 1 >= 0;
18056
- },
18057
- __compareBytes: function(sourceBuf, targetBuf, targetPos, firstByte) {
18058
- if (sourceBuf[0] !== firstByte) return 0;
18059
- const sourceLength = sourceBuf.length;
18060
- for (let i = 1; i < sourceLength; i++) if (sourceBuf[i] !== targetBuf[targetPos + i]) return 0;
18061
- return sourceLength;
18062
- },
18063
- __isDelimiter: function(buf, pos, chr) {
18064
- const { delimiter, ignore_last_delimiters } = this.options;
18065
- if (ignore_last_delimiters === true && this.state.record.length === this.options.columns.length - 1) return 0;
18066
- else if (ignore_last_delimiters !== false && typeof ignore_last_delimiters === "number" && this.state.record.length === ignore_last_delimiters - 1) return 0;
18067
- loop1: for (let i = 0; i < delimiter.length; i++) {
18068
- const del = delimiter[i];
18069
- if (del[0] === chr) {
18070
- for (let j = 1; j < del.length; j++) if (del[j] !== buf[pos + j]) continue loop1;
18071
- return del.length;
18072
- }
18073
- }
18074
- return 0;
18075
- },
18076
- __isRecordDelimiter: function(chr, buf, pos) {
18077
- const { record_delimiter } = this.options;
18078
- const recordDelimiterLength = record_delimiter.length;
18079
- loop1: for (let i = 0; i < recordDelimiterLength; i++) {
18080
- const rd = record_delimiter[i];
18081
- const rdLength = rd.length;
18082
- if (rd[0] !== chr) continue;
18083
- for (let j = 1; j < rdLength; j++) if (rd[j] !== buf[pos + j]) continue loop1;
18084
- return rd.length;
18085
- }
18086
- return 0;
18087
- },
18088
- __isEscape: function(buf, pos, chr) {
18089
- const { escape } = this.options;
18090
- if (escape === null) return false;
18091
- const l = escape.length;
18092
- if (escape[0] === chr) {
18093
- for (let i = 0; i < l; i++) if (escape[i] !== buf[pos + i]) return false;
18094
- return true;
18095
- }
18096
- return false;
18097
- },
18098
- __isQuote: function(buf, pos) {
18099
- const { quote } = this.options;
18100
- if (quote === null) return false;
18101
- const l = quote.length;
18102
- for (let i = 0; i < l; i++) if (quote[i] !== buf[pos + i]) return false;
18103
- return true;
18104
- },
18105
- __autoDiscoverRecordDelimiter: function(buf, pos) {
18106
- const { encoding } = this.options;
18107
- const rds = [
18108
- Buffer.from("\r\n", encoding),
18109
- Buffer.from("\n", encoding),
18110
- Buffer.from("\r", encoding)
18111
- ];
18112
- loop: for (let i = 0; i < rds.length; i++) {
18113
- const l = rds[i].length;
18114
- for (let j = 0; j < l; j++) if (rds[i][j] !== buf[pos + j]) continue loop;
18115
- this.options.record_delimiter.push(rds[i]);
18116
- this.state.recordDelimiterMaxLength = rds[i].length;
18117
- return rds[i].length;
18118
- }
18119
- return 0;
18120
- },
18121
- __error: function(msg) {
18122
- const { encoding, raw, skip_records_with_error } = this.options;
18123
- const err = typeof msg === "string" ? new Error(msg) : msg;
18124
- if (skip_records_with_error) {
18125
- this.state.recordHasError = true;
18126
- if (this.options.on_skip !== void 0) try {
18127
- this.options.on_skip(err, raw ? this.state.rawBuffer.toString(encoding) : void 0);
18128
- } catch (err) {
18129
- return err;
18130
- }
18131
- return;
18132
- } else return err;
18133
- },
18134
- __infoDataSet: function() {
18135
- return {
18136
- ...this.info,
18137
- columns: this.options.columns
18138
- };
18139
- },
18140
- __infoRecord: function() {
18141
- const { columns, raw, encoding } = this.options;
18142
- return {
18143
- ...this.__infoDataSet(),
18144
- error: this.state.error,
18145
- header: columns === true,
18146
- index: this.state.record.length,
18147
- raw: raw ? this.state.rawBuffer.toString(encoding) : void 0
18148
- };
18149
- },
18150
- __infoField: function() {
18151
- const { columns } = this.options;
18152
- const isColumns = Array.isArray(columns);
18153
- return {
18154
- ...this.__infoRecord(),
18155
- column: isColumns === true ? columns.length > this.state.record.length ? columns[this.state.record.length].name : null : this.state.record.length,
18156
- quoting: this.state.wasQuoting
18157
- };
18158
- }
18159
- };
18160
- };
18161
-
18162
- //#endregion
18163
- //#region ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/sync.js
18164
- const parse = function(data, opts = {}) {
18165
- if (typeof data === "string") data = Buffer.from(data);
18166
- const records = opts && opts.objname ? {} : [];
18167
- const parser = transform(opts);
18168
- const push = (record) => {
18169
- if (parser.options.objname === void 0) records.push(record);
18170
- else records[record[0]] = record[1];
18171
- };
18172
- const close = () => {};
18173
- const error = parser.parse(data, true, push, close);
18174
- if (error !== void 0) throw error;
18175
- return records;
18176
- };
18177
-
18178
17294
  //#endregion
18179
17295
  //#region src/utils/dex-price.ts
18180
17296
  let PriceUnit = /* @__PURE__ */ function(PriceUnit) {
@@ -18195,29 +17311,21 @@ var DexPrice = class {
18195
17311
  BTC_ORACLE_MAP = /* @__PURE__ */ new Map();
18196
17312
  ASSETS_INFOS = /* @__PURE__ */ new Map();
18197
17313
  chainId;
18198
- constructor(csvFileName, chainId) {
17314
+ constructor(jsonFileName, chainId) {
18199
17315
  this.chainId = chainId;
18200
17316
  const packageRoot = getPackageRoot("@sentio/sdk");
18201
- const csvFilePath = path.join(packageRoot, "assets", csvFileName);
18202
- const records = parse(fs.readFileSync(csvFilePath, { encoding: "utf-8" }), {
18203
- delimiter: ",",
18204
- columns: [
18205
- "Pair",
18206
- "Asset",
18207
- "Type",
18208
- "Address"
18209
- ],
18210
- skip_empty_lines: true
18211
- });
18212
- for (const record of records) {
18213
- const pair = record.Pair.split("/");
17317
+ const jsonFilePath = path.join(packageRoot, "assets", jsonFileName);
17318
+ const fileContent = fs.readFileSync(jsonFilePath, { encoding: "utf-8" });
17319
+ const oracles = JSON.parse(fileContent);
17320
+ for (const [rawPair, rawAddress] of Object.entries(oracles)) {
17321
+ const pair = rawPair.split("/");
18214
17322
  const asset = pair[0].trim().toLowerCase();
18215
17323
  const target = pair[1].trim().toLowerCase();
18216
- const address = record.Address.toLowerCase();
17324
+ const address = rawAddress.toLowerCase();
18217
17325
  if (target === "usd") this.USD_ORACLE_MAP.set(asset, address);
18218
17326
  else if (target === "eth") this.ETH_ORACLE_MAP.set(asset, address);
18219
17327
  else if (target == "btc") this.BTC_ORACLE_MAP.set(asset, address);
18220
- else console.error("wrong asset record:" + JSON.stringify(record));
17328
+ else console.error("wrong asset record: " + JSON.stringify({ [rawPair]: rawAddress }));
18221
17329
  }
18222
17330
  }
18223
17331
  async getPrice(asset, blockTag = "latest", unit = 0) {
@@ -18248,8 +17356,8 @@ var DexPrice = class {
18248
17356
  }
18249
17357
  }
18250
17358
  };
18251
- const EthereumDexPrice = new DexPrice("chainlink-oracles.csv", EthChainId.ETHEREUM);
18252
- const SepoliaDexPrice = new DexPrice("chainlink-oracles-sepolia.csv", EthChainId.SEPOLIA);
17359
+ const EthereumDexPrice = new DexPrice("chainlink-oracles.json", EthChainId.ETHEREUM);
17360
+ const SepoliaDexPrice = new DexPrice("chainlink-oracles-sepolia.json", EthChainId.SEPOLIA);
18253
17361
 
18254
17362
  //#endregion
18255
17363
  //#region ../../node_modules/.pnpm/@sentio+api@1.0.2/node_modules/@sentio/api/dist/src/types.gen.js
@@ -19931,4 +19039,4 @@ async function ignoreEthCallException(promise, logError = false) {
19931
19039
 
19932
19040
  //#endregion
19933
19041
  export { EACAggregatorProxy__factory as $, ERC20ContractView as A, mockApprovalForAllLog as B, ERC20BytesProcessor as C, mockOwnershipTransferredLog$1 as D, mockApprovalLog$1 as E, EthChainId$1 as F, ERC721Processor as G, mockTransferLog$2 as H, makeEthCallKey as I, getERC721ContractOnContext as J, ERC721ProcessorTemplate as K, EthPlugin as L, ERC20ProcessorTemplate as M, getERC20Contract as N, mockTransferLog$1 as O, getERC20ContractOnContext as P, ERC1155__factory as Q, AccountProcessor as R, erc20bytes_exports as S, timeOrBlockToBlockNumber as St, erc20_exports as T, ERC721BoundContractView as U, mockApprovalLog$2 as V, ERC721ContractView as W, ERC721__factory as X, WETH9__factory as Y, ERC20__factory as Z, EACAggregatorProxyProcessor as _, EthContext as _t, getPriceClient as a, getProcessor as at, getEACAggregatorProxyContractOnContext as b, estimateBlockNumberAtDate as bt, SepoliaDexPrice as c, DummyProvider as ct, mockAnswerUpdatedLog as d, GlobalProcessor as dt, BaseProcessorTemplate as et, mockNewRoundLog as f, defaultPreprocessHandler as ft, EACAggregatorProxyContractView as g, ContractView as gt, EACAggregatorProxyBoundContractView as h, ContractContext as ht, getPriceByType as i, getContractByABI as it, ERC20Processor as j, ERC20BoundContractView as k, getPackageRoot as l, getProvider as lt, mockOwnershipTransferredLog as m, BoundContractView as mt, getCoinsThatHasPrice as n, addContractByABI as nt, EthereumDexPrice as o, AccountBindOptions as ot, mockOwnershipTransferRequestedLog as p, AccountContext as pt, getERC721Contract as q, getPriceBySymbol as r, addProcessor as rt, PriceUnit as s, BindOptions as st, ignoreEthCallException as t, GenericProcessor as tt, eacaggregatorproxy_exports as u, BaseProcessor as ut, EACAggregatorProxyProcessorTemplate as v, GlobalContext as vt, ERC20BytesProcessorTemplate as w, token_exports as x, estimateBlockNumberAtDateSlow as xt, getEACAggregatorProxyContract as y, bytesToBigInt as yt, erc721_exports as z };
19934
- //# sourceMappingURL=utils-Jndk-n_F.js.map
19042
+ //# sourceMappingURL=utils-BQ0dnllb.js.map