@sentio/sdk 2.57.12-rc.f → 2.57.12-rc.h
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/lib/{chunk-FDFFHCFA.js → chunk-2F2KNF4Z.js} +16113 -3887
- package/lib/chunk-2F2KNF4Z.js.map +1 -0
- package/lib/{chunk-QT2RHOVE.js → chunk-4HPFNKDX.js} +76 -146
- package/lib/chunk-4HPFNKDX.js.map +1 -0
- package/lib/{chunk-3NTVNR24.js → chunk-4OCWUYSJ.js} +2 -2
- package/lib/{chunk-M2LXR3BO.js → chunk-73SHERGU.js} +968 -1459
- package/lib/chunk-73SHERGU.js.map +1 -0
- package/lib/{chunk-2S4VBXER.js → chunk-7S6WQ4RL.js} +3 -3
- package/lib/{chunk-FTNDYH4A.js → chunk-AZFMPZRN.js} +200 -418
- package/lib/chunk-AZFMPZRN.js.map +1 -0
- package/lib/{chunk-QSUUYUJL.js → chunk-BZCXYTDE.js} +3 -3
- package/lib/{chunk-MNZ4WYMA.js → chunk-IWKJC3QU.js} +2898 -3010
- package/lib/chunk-IWKJC3QU.js.map +1 -0
- package/lib/{chunk-MERD27M6.js → chunk-J3I3VNTV.js} +3 -3
- package/lib/{chunk-NMHIV5TJ.js → chunk-J3QOJ2RV.js} +4 -4
- package/lib/{chunk-BRHYXWEW.js → chunk-LPSNAS2G.js} +3 -3
- package/lib/chunk-LR232ZJV.js +2593 -0
- package/lib/chunk-LR232ZJV.js.map +1 -0
- package/lib/{chunk-VWXVCB2D.js → chunk-MPJGLOUG.js} +266 -381
- package/lib/chunk-MPJGLOUG.js.map +1 -0
- package/lib/{chunk-TOXC2A6K.js → chunk-N36N7RXJ.js} +3 -3
- package/lib/{chunk-Q52U5JD3.js → chunk-NTLPIJLT.js} +10 -10
- package/lib/{chunk-Q52U5JD3.js.map → chunk-NTLPIJLT.js.map} +1 -1
- package/lib/{chunk-FLCIAA4G.js → chunk-OJG2VJ5T.js} +5 -5
- package/lib/{chunk-FLCIAA4G.js.map → chunk-OJG2VJ5T.js.map} +1 -1
- package/lib/{chunk-U5FYYK4Y.js → chunk-ONBEMKI5.js} +2 -2
- package/lib/{chunk-IGFULPWN.js → chunk-QP4FTMPU.js} +4 -4
- package/lib/{chunk-ZAY2PRBU.js → chunk-RMT2JEWA.js} +37 -37
- package/lib/{chunk-ZAY2PRBU.js.map → chunk-RMT2JEWA.js.map} +1 -1
- package/lib/{chunk-FV4WLDIZ.js → chunk-UIBPOKNT.js} +16 -16
- package/lib/chunk-UIBPOKNT.js.map +1 -0
- package/lib/{chunk-QUMTLHC5.js → chunk-ZYMBRWPA.js} +5 -5
- package/package.json +3 -3
- package/lib/chunk-FDFFHCFA.js.map +0 -1
- package/lib/chunk-FTNDYH4A.js.map +0 -1
- package/lib/chunk-FV4WLDIZ.js.map +0 -1
- package/lib/chunk-M2LXR3BO.js.map +0 -1
- package/lib/chunk-MNZ4WYMA.js.map +0 -1
- package/lib/chunk-QT2RHOVE.js.map +0 -1
- package/lib/chunk-VWXVCB2D.js.map +0 -1
- /package/lib/{chunk-3NTVNR24.js.map → chunk-4OCWUYSJ.js.map} +0 -0
- /package/lib/{chunk-2S4VBXER.js.map → chunk-7S6WQ4RL.js.map} +0 -0
- /package/lib/{chunk-QSUUYUJL.js.map → chunk-BZCXYTDE.js.map} +0 -0
- /package/lib/{chunk-MERD27M6.js.map → chunk-J3I3VNTV.js.map} +0 -0
- /package/lib/{chunk-NMHIV5TJ.js.map → chunk-J3QOJ2RV.js.map} +0 -0
- /package/lib/{chunk-BRHYXWEW.js.map → chunk-LPSNAS2G.js.map} +0 -0
- /package/lib/{chunk-TOXC2A6K.js.map → chunk-N36N7RXJ.js.map} +0 -0
- /package/lib/{chunk-U5FYYK4Y.js.map → chunk-ONBEMKI5.js.map} +0 -0
- /package/lib/{chunk-IGFULPWN.js.map → chunk-QP4FTMPU.js.map} +0 -0
- /package/lib/{chunk-QUMTLHC5.js.map → chunk-ZYMBRWPA.js.map} +0 -0
@@ -1,22 +1,22 @@
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
2
2
|
import {
|
3
3
|
getERC20BytesContract
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-J3QOJ2RV.js";
|
5
5
|
import {
|
6
6
|
getEACAggregatorProxyContract
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-BZCXYTDE.js";
|
8
8
|
import {
|
9
9
|
EthChainId,
|
10
10
|
SimpleEthersError,
|
11
11
|
getERC20Contract
|
12
|
-
} from "./chunk-
|
12
|
+
} from "./chunk-OJG2VJ5T.js";
|
13
13
|
import {
|
14
14
|
decodeBytes32String
|
15
|
-
} from "./chunk-
|
15
|
+
} from "./chunk-RMT2JEWA.js";
|
16
16
|
import {
|
17
17
|
BaseContext,
|
18
18
|
scaleDown
|
19
|
-
} from "./chunk-
|
19
|
+
} from "./chunk-2F2KNF4Z.js";
|
20
20
|
import {
|
21
21
|
__export,
|
22
22
|
__name
|
@@ -74,7 +74,7 @@ __export(token_exports, {
|
|
74
74
|
getERC20TokenInfo: () => getERC20TokenInfo
|
75
75
|
});
|
76
76
|
|
77
|
-
// ../../node_modules/.pnpm/lru-cache@11.0.
|
77
|
+
// ../../node_modules/.pnpm/lru-cache@11.0.0/node_modules/lru-cache/dist/esm/index.js
|
78
78
|
var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
79
79
|
var warned = /* @__PURE__ */ new Set();
|
80
80
|
var PROCESS = typeof process === "object" && !!process ? process : {};
|
@@ -791,7 +791,7 @@ var LRUCache = class _LRUCache {
|
|
791
791
|
}
|
792
792
|
/**
|
793
793
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
794
|
-
* passed to {@link
|
794
|
+
* passed to {@link LRLUCache#load}.
|
795
795
|
*
|
796
796
|
* The `start` fields are calculated relative to a portable `Date.now()`
|
797
797
|
* timestamp, even if `performance.now()` is available.
|
@@ -1519,7 +1519,7 @@ import("node:process").then((p) => p.stdout.write(""));
|
|
1519
1519
|
// src/utils/dex-price.ts
|
1520
1520
|
import fs from "fs";
|
1521
1521
|
|
1522
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1522
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/CsvError.js
|
1523
1523
|
var CsvError = class _CsvError extends Error {
|
1524
1524
|
static {
|
1525
1525
|
__name(this, "CsvError");
|
@@ -1540,12 +1540,12 @@ var CsvError = class _CsvError extends Error {
|
|
1540
1540
|
}
|
1541
1541
|
};
|
1542
1542
|
|
1543
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1543
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/is_object.js
|
1544
1544
|
var is_object = /* @__PURE__ */ __name(function(obj) {
|
1545
1545
|
return typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
1546
1546
|
}, "is_object");
|
1547
1547
|
|
1548
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1548
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_columns_array.js
|
1549
1549
|
var normalize_columns_array = /* @__PURE__ */ __name(function(columns) {
|
1550
1550
|
const normalizedColumns = [];
|
1551
1551
|
for (let i = 0, l = columns.length; i < l; i++) {
|
@@ -1574,7 +1574,7 @@ var normalize_columns_array = /* @__PURE__ */ __name(function(columns) {
|
|
1574
1574
|
return normalizedColumns;
|
1575
1575
|
}, "normalize_columns_array");
|
1576
1576
|
|
1577
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1577
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/ResizeableBuffer.js
|
1578
1578
|
var ResizeableBuffer = class {
|
1579
1579
|
static {
|
1580
1580
|
__name(this, "ResizeableBuffer");
|
@@ -1641,7 +1641,7 @@ var ResizeableBuffer = class {
|
|
1641
1641
|
};
|
1642
1642
|
var ResizeableBuffer_default = ResizeableBuffer;
|
1643
1643
|
|
1644
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1644
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/init_state.js
|
1645
1645
|
var np = 12;
|
1646
1646
|
var cr = 13;
|
1647
1647
|
var nl = 10;
|
@@ -1677,10 +1677,7 @@ var init_state = /* @__PURE__ */ __name(function(options) {
|
|
1677
1677
|
recordHasError: false,
|
1678
1678
|
record_length: 0,
|
1679
1679
|
recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 0 : Math.max(...options.record_delimiter.map((v) => v.length)),
|
1680
|
-
trimChars: [
|
1681
|
-
Buffer.from(" ", options.encoding)[0],
|
1682
|
-
Buffer.from(" ", options.encoding)[0]
|
1683
|
-
],
|
1680
|
+
trimChars: [Buffer.from(" ", options.encoding)[0], Buffer.from(" ", options.encoding)[0]],
|
1684
1681
|
wasQuoting: false,
|
1685
1682
|
wasRowDelimiter: false,
|
1686
1683
|
timchars: [
|
@@ -1693,14 +1690,14 @@ var init_state = /* @__PURE__ */ __name(function(options) {
|
|
1693
1690
|
};
|
1694
1691
|
}, "init_state");
|
1695
1692
|
|
1696
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1693
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/utils/underscore.js
|
1697
1694
|
var underscore = /* @__PURE__ */ __name(function(str) {
|
1698
1695
|
return str.replace(/([A-Z])/g, function(_, match) {
|
1699
1696
|
return "_" + match.toLowerCase();
|
1700
1697
|
});
|
1701
1698
|
}, "underscore");
|
1702
1699
|
|
1703
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
1700
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/normalize_options.js
|
1704
1701
|
var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
1705
1702
|
const options = {};
|
1706
1703
|
for (const opt in opts) {
|
@@ -1711,28 +1708,20 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1711
1708
|
} else if (options.encoding === null || options.encoding === false) {
|
1712
1709
|
options.encoding = null;
|
1713
1710
|
} else if (typeof options.encoding !== "string" && options.encoding !== null) {
|
1714
|
-
throw new CsvError(
|
1715
|
-
"
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
`got ${JSON.stringify(options.encoding)}`
|
1720
|
-
],
|
1721
|
-
options
|
1722
|
-
);
|
1711
|
+
throw new CsvError("CSV_INVALID_OPTION_ENCODING", [
|
1712
|
+
"Invalid option encoding:",
|
1713
|
+
"encoding must be a string or null to return a buffer,",
|
1714
|
+
`got ${JSON.stringify(options.encoding)}`
|
1715
|
+
], options);
|
1723
1716
|
}
|
1724
1717
|
if (options.bom === void 0 || options.bom === null || options.bom === false) {
|
1725
1718
|
options.bom = false;
|
1726
1719
|
} else if (options.bom !== true) {
|
1727
|
-
throw new CsvError(
|
1728
|
-
"
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
`got ${JSON.stringify(options.bom)}`
|
1733
|
-
],
|
1734
|
-
options
|
1735
|
-
);
|
1720
|
+
throw new CsvError("CSV_INVALID_OPTION_BOM", [
|
1721
|
+
"Invalid option bom:",
|
1722
|
+
"bom must be true,",
|
1723
|
+
`got ${JSON.stringify(options.bom)}`
|
1724
|
+
], options);
|
1736
1725
|
}
|
1737
1726
|
options.cast_function = null;
|
1738
1727
|
if (options.cast === void 0 || options.cast === null || options.cast === false || options.cast === "") {
|
@@ -1741,15 +1730,11 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1741
1730
|
options.cast_function = options.cast;
|
1742
1731
|
options.cast = true;
|
1743
1732
|
} else if (options.cast !== true) {
|
1744
|
-
throw new CsvError(
|
1745
|
-
"
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
`got ${JSON.stringify(options.cast)}`
|
1750
|
-
],
|
1751
|
-
options
|
1752
|
-
);
|
1733
|
+
throw new CsvError("CSV_INVALID_OPTION_CAST", [
|
1734
|
+
"Invalid option cast:",
|
1735
|
+
"cast must be true or a function,",
|
1736
|
+
`got ${JSON.stringify(options.cast)}`
|
1737
|
+
], options);
|
1753
1738
|
}
|
1754
1739
|
if (options.cast_date === void 0 || options.cast_date === null || options.cast_date === false || options.cast_date === "") {
|
1755
1740
|
options.cast_date = false;
|
@@ -1759,15 +1744,11 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1759
1744
|
return !isNaN(date) ? new Date(date) : value;
|
1760
1745
|
};
|
1761
1746
|
} else if (typeof options.cast_date !== "function") {
|
1762
|
-
throw new CsvError(
|
1763
|
-
"
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
`got ${JSON.stringify(options.cast_date)}`
|
1768
|
-
],
|
1769
|
-
options
|
1770
|
-
);
|
1747
|
+
throw new CsvError("CSV_INVALID_OPTION_CAST_DATE", [
|
1748
|
+
"Invalid option cast_date:",
|
1749
|
+
"cast_date must be true or a function,",
|
1750
|
+
`got ${JSON.stringify(options.cast_date)}`
|
1751
|
+
], options);
|
1771
1752
|
}
|
1772
1753
|
options.cast_first_line_to_header = null;
|
1773
1754
|
if (options.columns === true) {
|
@@ -1780,37 +1761,25 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1780
1761
|
} else if (options.columns === void 0 || options.columns === null || options.columns === false) {
|
1781
1762
|
options.columns = false;
|
1782
1763
|
} else {
|
1783
|
-
throw new CsvError(
|
1784
|
-
"
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
`got ${JSON.stringify(options.columns)}`
|
1789
|
-
],
|
1790
|
-
options
|
1791
|
-
);
|
1764
|
+
throw new CsvError("CSV_INVALID_OPTION_COLUMNS", [
|
1765
|
+
"Invalid option columns:",
|
1766
|
+
"expect an array, a function or true,",
|
1767
|
+
`got ${JSON.stringify(options.columns)}`
|
1768
|
+
], options);
|
1792
1769
|
}
|
1793
1770
|
if (options.group_columns_by_name === void 0 || options.group_columns_by_name === null || options.group_columns_by_name === false) {
|
1794
1771
|
options.group_columns_by_name = false;
|
1795
1772
|
} else if (options.group_columns_by_name !== true) {
|
1796
|
-
throw new CsvError(
|
1797
|
-
"
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
`got ${JSON.stringify(options.group_columns_by_name)}`
|
1802
|
-
],
|
1803
|
-
options
|
1804
|
-
);
|
1773
|
+
throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [
|
1774
|
+
"Invalid option group_columns_by_name:",
|
1775
|
+
"expect an boolean,",
|
1776
|
+
`got ${JSON.stringify(options.group_columns_by_name)}`
|
1777
|
+
], options);
|
1805
1778
|
} else if (options.columns === false) {
|
1806
|
-
throw new CsvError(
|
1807
|
-
"
|
1808
|
-
|
1809
|
-
|
1810
|
-
"the `columns` mode must be activated."
|
1811
|
-
],
|
1812
|
-
options
|
1813
|
-
);
|
1779
|
+
throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [
|
1780
|
+
"Invalid option group_columns_by_name:",
|
1781
|
+
"the `columns` mode must be activated."
|
1782
|
+
], options);
|
1814
1783
|
}
|
1815
1784
|
if (options.comment === void 0 || options.comment === null || options.comment === false || options.comment === "") {
|
1816
1785
|
options.comment = null;
|
@@ -1819,43 +1788,30 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1819
1788
|
options.comment = Buffer.from(options.comment, options.encoding);
|
1820
1789
|
}
|
1821
1790
|
if (!Buffer.isBuffer(options.comment)) {
|
1822
|
-
throw new CsvError(
|
1823
|
-
"
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
`got ${JSON.stringify(options.comment)}`
|
1828
|
-
],
|
1829
|
-
options
|
1830
|
-
);
|
1791
|
+
throw new CsvError("CSV_INVALID_OPTION_COMMENT", [
|
1792
|
+
"Invalid option comment:",
|
1793
|
+
"comment must be a buffer or a string,",
|
1794
|
+
`got ${JSON.stringify(options.comment)}`
|
1795
|
+
], options);
|
1831
1796
|
}
|
1832
1797
|
}
|
1833
1798
|
if (options.comment_no_infix === void 0 || options.comment_no_infix === null || options.comment_no_infix === false) {
|
1834
1799
|
options.comment_no_infix = false;
|
1835
1800
|
} else if (options.comment_no_infix !== true) {
|
1836
|
-
throw new CsvError(
|
1837
|
-
"
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
`got ${JSON.stringify(options.comment_no_infix)}`
|
1842
|
-
],
|
1843
|
-
options
|
1844
|
-
);
|
1801
|
+
throw new CsvError("CSV_INVALID_OPTION_COMMENT", [
|
1802
|
+
"Invalid option comment_no_infix:",
|
1803
|
+
"value must be a boolean,",
|
1804
|
+
`got ${JSON.stringify(options.comment_no_infix)}`
|
1805
|
+
], options);
|
1845
1806
|
}
|
1846
1807
|
const delimiter_json = JSON.stringify(options.delimiter);
|
1847
|
-
if (!Array.isArray(options.delimiter))
|
1848
|
-
options.delimiter = [options.delimiter];
|
1808
|
+
if (!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter];
|
1849
1809
|
if (options.delimiter.length === 0) {
|
1850
|
-
throw new CsvError(
|
1851
|
-
"
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
`got ${delimiter_json}`
|
1856
|
-
],
|
1857
|
-
options
|
1858
|
-
);
|
1810
|
+
throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [
|
1811
|
+
"Invalid option delimiter:",
|
1812
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
1813
|
+
`got ${delimiter_json}`
|
1814
|
+
], options);
|
1859
1815
|
}
|
1860
1816
|
options.delimiter = options.delimiter.map(function(delimiter) {
|
1861
1817
|
if (delimiter === void 0 || delimiter === null || delimiter === false) {
|
@@ -1865,15 +1821,11 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1865
1821
|
delimiter = Buffer.from(delimiter, options.encoding);
|
1866
1822
|
}
|
1867
1823
|
if (!Buffer.isBuffer(delimiter) || delimiter.length === 0) {
|
1868
|
-
throw new CsvError(
|
1869
|
-
"
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
`got ${delimiter_json}`
|
1874
|
-
],
|
1875
|
-
options
|
1876
|
-
);
|
1824
|
+
throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [
|
1825
|
+
"Invalid option delimiter:",
|
1826
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
1827
|
+
`got ${delimiter_json}`
|
1828
|
+
], options);
|
1877
1829
|
}
|
1878
1830
|
return delimiter;
|
1879
1831
|
});
|
@@ -1886,9 +1838,7 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1886
1838
|
}
|
1887
1839
|
if (options.escape !== null) {
|
1888
1840
|
if (!Buffer.isBuffer(options.escape)) {
|
1889
|
-
throw new Error(
|
1890
|
-
`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`
|
1891
|
-
);
|
1841
|
+
throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`);
|
1892
1842
|
}
|
1893
1843
|
}
|
1894
1844
|
if (options.from === void 0 || options.from === null) {
|
@@ -1899,14 +1849,10 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1899
1849
|
}
|
1900
1850
|
if (Number.isInteger(options.from)) {
|
1901
1851
|
if (options.from < 0) {
|
1902
|
-
throw new Error(
|
1903
|
-
`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`
|
1904
|
-
);
|
1852
|
+
throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`);
|
1905
1853
|
}
|
1906
1854
|
} else {
|
1907
|
-
throw new Error(
|
1908
|
-
`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`
|
1909
|
-
);
|
1855
|
+
throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`);
|
1910
1856
|
}
|
1911
1857
|
}
|
1912
1858
|
if (options.from_line === void 0 || options.from_line === null) {
|
@@ -1917,14 +1863,10 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1917
1863
|
}
|
1918
1864
|
if (Number.isInteger(options.from_line)) {
|
1919
1865
|
if (options.from_line <= 0) {
|
1920
|
-
throw new Error(
|
1921
|
-
`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`
|
1922
|
-
);
|
1866
|
+
throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`);
|
1923
1867
|
}
|
1924
1868
|
} else {
|
1925
|
-
throw new Error(
|
1926
|
-
`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`
|
1927
|
-
);
|
1869
|
+
throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`);
|
1928
1870
|
}
|
1929
1871
|
}
|
1930
1872
|
if (options.ignore_last_delimiters === void 0 || options.ignore_last_delimiters === null) {
|
@@ -1935,32 +1877,22 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1935
1877
|
options.ignore_last_delimiters = false;
|
1936
1878
|
}
|
1937
1879
|
} else if (typeof options.ignore_last_delimiters !== "boolean") {
|
1938
|
-
throw new CsvError(
|
1939
|
-
"
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
`got ${JSON.stringify(options.ignore_last_delimiters)}`
|
1944
|
-
],
|
1945
|
-
options
|
1946
|
-
);
|
1880
|
+
throw new CsvError("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS", [
|
1881
|
+
"Invalid option `ignore_last_delimiters`:",
|
1882
|
+
"the value must be a boolean value or an integer,",
|
1883
|
+
`got ${JSON.stringify(options.ignore_last_delimiters)}`
|
1884
|
+
], options);
|
1947
1885
|
}
|
1948
1886
|
if (options.ignore_last_delimiters === true && options.columns === false) {
|
1949
|
-
throw new CsvError(
|
1950
|
-
"
|
1951
|
-
|
1952
|
-
|
1953
|
-
"requires the activation of the `columns` option"
|
1954
|
-
],
|
1955
|
-
options
|
1956
|
-
);
|
1887
|
+
throw new CsvError("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS", [
|
1888
|
+
"The option `ignore_last_delimiters`",
|
1889
|
+
"requires the activation of the `columns` option"
|
1890
|
+
], options);
|
1957
1891
|
}
|
1958
1892
|
if (options.info === void 0 || options.info === null || options.info === false) {
|
1959
1893
|
options.info = false;
|
1960
1894
|
} else if (options.info !== true) {
|
1961
|
-
throw new Error(
|
1962
|
-
`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`
|
1963
|
-
);
|
1895
|
+
throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`);
|
1964
1896
|
}
|
1965
1897
|
if (options.max_record_size === void 0 || options.max_record_size === null || options.max_record_size === false) {
|
1966
1898
|
options.max_record_size = 0;
|
@@ -1968,9 +1900,7 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1968
1900
|
} else if (typeof options.max_record_size === "string" && /\d+/.test(options.max_record_size)) {
|
1969
1901
|
options.max_record_size = parseInt(options.max_record_size);
|
1970
1902
|
} else {
|
1971
|
-
throw new Error(
|
1972
|
-
`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`
|
1973
|
-
);
|
1903
|
+
throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`);
|
1974
1904
|
}
|
1975
1905
|
if (options.objname === void 0 || options.objname === null || options.objname === false) {
|
1976
1906
|
options.objname = void 0;
|
@@ -1988,42 +1918,30 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
1988
1918
|
}
|
1989
1919
|
} else if (typeof options.objname === "number") {
|
1990
1920
|
} else {
|
1991
|
-
throw new Error(
|
1992
|
-
`Invalid Option: objname must be a string or a buffer, got ${options.objname}`
|
1993
|
-
);
|
1921
|
+
throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`);
|
1994
1922
|
}
|
1995
1923
|
if (options.objname !== void 0) {
|
1996
1924
|
if (typeof options.objname === "number") {
|
1997
1925
|
if (options.columns !== false) {
|
1998
|
-
throw Error(
|
1999
|
-
"Invalid Option: objname index cannot be combined with columns or be defined as a field"
|
2000
|
-
);
|
1926
|
+
throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field");
|
2001
1927
|
}
|
2002
1928
|
} else {
|
2003
1929
|
if (options.columns === false) {
|
2004
|
-
throw Error(
|
2005
|
-
"Invalid Option: objname field must be combined with columns or be defined as an index"
|
2006
|
-
);
|
1930
|
+
throw Error("Invalid Option: objname field must be combined with columns or be defined as an index");
|
2007
1931
|
}
|
2008
1932
|
}
|
2009
1933
|
}
|
2010
1934
|
if (options.on_record === void 0 || options.on_record === null) {
|
2011
1935
|
options.on_record = void 0;
|
2012
1936
|
} else if (typeof options.on_record !== "function") {
|
2013
|
-
throw new CsvError(
|
2014
|
-
"
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
`got ${JSON.stringify(options.on_record)}`
|
2019
|
-
],
|
2020
|
-
options
|
2021
|
-
);
|
1937
|
+
throw new CsvError("CSV_INVALID_OPTION_ON_RECORD", [
|
1938
|
+
"Invalid option `on_record`:",
|
1939
|
+
"expect a function,",
|
1940
|
+
`got ${JSON.stringify(options.on_record)}`
|
1941
|
+
], options);
|
2022
1942
|
}
|
2023
1943
|
if (options.on_skip !== void 0 && options.on_skip !== null && typeof options.on_skip !== "function") {
|
2024
|
-
throw new Error(
|
2025
|
-
`Invalid Option: on_skip must be a function, got ${JSON.stringify(options.on_skip)}`
|
2026
|
-
);
|
1944
|
+
throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(options.on_skip)}`);
|
2027
1945
|
}
|
2028
1946
|
if (options.quote === null || options.quote === false || options.quote === "") {
|
2029
1947
|
options.quote = null;
|
@@ -2034,67 +1952,47 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
2034
1952
|
options.quote = Buffer.from(options.quote, options.encoding);
|
2035
1953
|
}
|
2036
1954
|
if (!Buffer.isBuffer(options.quote)) {
|
2037
|
-
throw new Error(
|
2038
|
-
`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`
|
2039
|
-
);
|
1955
|
+
throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`);
|
2040
1956
|
}
|
2041
1957
|
}
|
2042
1958
|
if (options.raw === void 0 || options.raw === null || options.raw === false) {
|
2043
1959
|
options.raw = false;
|
2044
1960
|
} else if (options.raw !== true) {
|
2045
|
-
throw new Error(
|
2046
|
-
`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`
|
2047
|
-
);
|
1961
|
+
throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`);
|
2048
1962
|
}
|
2049
1963
|
if (options.record_delimiter === void 0) {
|
2050
1964
|
options.record_delimiter = [];
|
2051
1965
|
} else if (typeof options.record_delimiter === "string" || Buffer.isBuffer(options.record_delimiter)) {
|
2052
1966
|
if (options.record_delimiter.length === 0) {
|
2053
|
-
throw new CsvError(
|
2054
|
-
"
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
`got ${JSON.stringify(options.record_delimiter)}`
|
2059
|
-
],
|
2060
|
-
options
|
2061
|
-
);
|
1967
|
+
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
1968
|
+
"Invalid option `record_delimiter`:",
|
1969
|
+
"value must be a non empty string or buffer,",
|
1970
|
+
`got ${JSON.stringify(options.record_delimiter)}`
|
1971
|
+
], options);
|
2062
1972
|
}
|
2063
1973
|
options.record_delimiter = [options.record_delimiter];
|
2064
1974
|
} else if (!Array.isArray(options.record_delimiter)) {
|
2065
|
-
throw new CsvError(
|
2066
|
-
"
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
`got ${JSON.stringify(options.record_delimiter)}`
|
2071
|
-
],
|
2072
|
-
options
|
2073
|
-
);
|
1975
|
+
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
1976
|
+
"Invalid option `record_delimiter`:",
|
1977
|
+
"value must be a string, a buffer or array of string|buffer,",
|
1978
|
+
`got ${JSON.stringify(options.record_delimiter)}`
|
1979
|
+
], options);
|
2074
1980
|
}
|
2075
1981
|
options.record_delimiter = options.record_delimiter.map(function(rd, i) {
|
2076
1982
|
if (typeof rd !== "string" && !Buffer.isBuffer(rd)) {
|
2077
|
-
throw new CsvError(
|
2078
|
-
"
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
`got ${JSON.stringify(rd)}`
|
2084
|
-
],
|
2085
|
-
options
|
2086
|
-
);
|
1983
|
+
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
1984
|
+
"Invalid option `record_delimiter`:",
|
1985
|
+
"value must be a string, a buffer or array of string|buffer",
|
1986
|
+
`at index ${i},`,
|
1987
|
+
`got ${JSON.stringify(rd)}`
|
1988
|
+
], options);
|
2087
1989
|
} else if (rd.length === 0) {
|
2088
|
-
throw new CsvError(
|
2089
|
-
"
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
`got ${JSON.stringify(rd)}`
|
2095
|
-
],
|
2096
|
-
options
|
2097
|
-
);
|
1990
|
+
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
1991
|
+
"Invalid option `record_delimiter`:",
|
1992
|
+
"value must be a non empty string or buffer",
|
1993
|
+
`at index ${i},`,
|
1994
|
+
`got ${JSON.stringify(rd)}`
|
1995
|
+
], options);
|
2098
1996
|
}
|
2099
1997
|
if (typeof rd === "string") {
|
2100
1998
|
rd = Buffer.from(rd, options.encoding);
|
@@ -2105,78 +2003,58 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
2105
2003
|
} else if (options.relax_column_count === void 0 || options.relax_column_count === null) {
|
2106
2004
|
options.relax_column_count = false;
|
2107
2005
|
} else {
|
2108
|
-
throw new Error(
|
2109
|
-
`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`
|
2110
|
-
);
|
2006
|
+
throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`);
|
2111
2007
|
}
|
2112
2008
|
if (typeof options.relax_column_count_less === "boolean") {
|
2113
2009
|
} else if (options.relax_column_count_less === void 0 || options.relax_column_count_less === null) {
|
2114
2010
|
options.relax_column_count_less = false;
|
2115
2011
|
} else {
|
2116
|
-
throw new Error(
|
2117
|
-
`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`
|
2118
|
-
);
|
2012
|
+
throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`);
|
2119
2013
|
}
|
2120
2014
|
if (typeof options.relax_column_count_more === "boolean") {
|
2121
2015
|
} else if (options.relax_column_count_more === void 0 || options.relax_column_count_more === null) {
|
2122
2016
|
options.relax_column_count_more = false;
|
2123
2017
|
} else {
|
2124
|
-
throw new Error(
|
2125
|
-
`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`
|
2126
|
-
);
|
2018
|
+
throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`);
|
2127
2019
|
}
|
2128
2020
|
if (typeof options.relax_quotes === "boolean") {
|
2129
2021
|
} else if (options.relax_quotes === void 0 || options.relax_quotes === null) {
|
2130
2022
|
options.relax_quotes = false;
|
2131
2023
|
} else {
|
2132
|
-
throw new Error(
|
2133
|
-
`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(options.relax_quotes)}`
|
2134
|
-
);
|
2024
|
+
throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(options.relax_quotes)}`);
|
2135
2025
|
}
|
2136
2026
|
if (typeof options.skip_empty_lines === "boolean") {
|
2137
2027
|
} else if (options.skip_empty_lines === void 0 || options.skip_empty_lines === null) {
|
2138
2028
|
options.skip_empty_lines = false;
|
2139
2029
|
} else {
|
2140
|
-
throw new Error(
|
2141
|
-
`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`
|
2142
|
-
);
|
2030
|
+
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
|
2143
2031
|
}
|
2144
2032
|
if (typeof options.skip_records_with_empty_values === "boolean") {
|
2145
2033
|
} else if (options.skip_records_with_empty_values === void 0 || options.skip_records_with_empty_values === null) {
|
2146
2034
|
options.skip_records_with_empty_values = false;
|
2147
2035
|
} else {
|
2148
|
-
throw new Error(
|
2149
|
-
`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`
|
2150
|
-
);
|
2036
|
+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
|
2151
2037
|
}
|
2152
2038
|
if (typeof options.skip_records_with_error === "boolean") {
|
2153
2039
|
} else if (options.skip_records_with_error === void 0 || options.skip_records_with_error === null) {
|
2154
2040
|
options.skip_records_with_error = false;
|
2155
2041
|
} else {
|
2156
|
-
throw new Error(
|
2157
|
-
`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`
|
2158
|
-
);
|
2042
|
+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
|
2159
2043
|
}
|
2160
2044
|
if (options.rtrim === void 0 || options.rtrim === null || options.rtrim === false) {
|
2161
2045
|
options.rtrim = false;
|
2162
2046
|
} else if (options.rtrim !== true) {
|
2163
|
-
throw new Error(
|
2164
|
-
`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`
|
2165
|
-
);
|
2047
|
+
throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`);
|
2166
2048
|
}
|
2167
2049
|
if (options.ltrim === void 0 || options.ltrim === null || options.ltrim === false) {
|
2168
2050
|
options.ltrim = false;
|
2169
2051
|
} else if (options.ltrim !== true) {
|
2170
|
-
throw new Error(
|
2171
|
-
`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`
|
2172
|
-
);
|
2052
|
+
throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`);
|
2173
2053
|
}
|
2174
2054
|
if (options.trim === void 0 || options.trim === null || options.trim === false) {
|
2175
2055
|
options.trim = false;
|
2176
2056
|
} else if (options.trim !== true) {
|
2177
|
-
throw new Error(
|
2178
|
-
`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`
|
2179
|
-
);
|
2057
|
+
throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`);
|
2180
2058
|
}
|
2181
2059
|
if (options.trim === true && opts.ltrim !== false) {
|
2182
2060
|
options.ltrim = true;
|
@@ -2196,14 +2074,10 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
2196
2074
|
}
|
2197
2075
|
if (Number.isInteger(options.to)) {
|
2198
2076
|
if (options.to <= 0) {
|
2199
|
-
throw new Error(
|
2200
|
-
`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`
|
2201
|
-
);
|
2077
|
+
throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`);
|
2202
2078
|
}
|
2203
2079
|
} else {
|
2204
|
-
throw new Error(
|
2205
|
-
`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`
|
2206
|
-
);
|
2080
|
+
throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`);
|
2207
2081
|
}
|
2208
2082
|
}
|
2209
2083
|
if (options.to_line === void 0 || options.to_line === null) {
|
@@ -2214,24 +2088,18 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
2214
2088
|
}
|
2215
2089
|
if (Number.isInteger(options.to_line)) {
|
2216
2090
|
if (options.to_line <= 0) {
|
2217
|
-
throw new Error(
|
2218
|
-
`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`
|
2219
|
-
);
|
2091
|
+
throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`);
|
2220
2092
|
}
|
2221
2093
|
} else {
|
2222
|
-
throw new Error(
|
2223
|
-
`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`
|
2224
|
-
);
|
2094
|
+
throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`);
|
2225
2095
|
}
|
2226
2096
|
}
|
2227
2097
|
return options;
|
2228
2098
|
}, "normalize_options");
|
2229
2099
|
|
2230
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
2100
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/api/index.js
|
2231
2101
|
var isRecordEmpty = /* @__PURE__ */ __name(function(record) {
|
2232
|
-
return record.every(
|
2233
|
-
(field) => field == null || field.toString && field.toString().trim() === ""
|
2234
|
-
);
|
2102
|
+
return record.every((field) => field == null || field.toString && field.toString().trim() === "");
|
2235
2103
|
}, "isRecordEmpty");
|
2236
2104
|
var cr2 = 13;
|
2237
2105
|
var nl2 = 10;
|
@@ -2240,11 +2108,11 @@ var boms = {
|
|
2240
2108
|
// Buffer.from("\ufeff")
|
2241
2109
|
// Buffer.from([239, 187, 191])
|
2242
2110
|
// Buffer.from('EFBBBF', 'hex')
|
2243
|
-
utf8: Buffer.from([239, 187, 191]),
|
2111
|
+
"utf8": Buffer.from([239, 187, 191]),
|
2244
2112
|
// Note, the following are equals:
|
2245
2113
|
// Buffer.from "\ufeff", 'utf16le
|
2246
2114
|
// Buffer.from([255, 254])
|
2247
|
-
utf16le: Buffer.from([255, 254])
|
2115
|
+
"utf16le": Buffer.from([255, 254])
|
2248
2116
|
};
|
2249
2117
|
var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
2250
2118
|
const info = {
|
@@ -2284,20 +2152,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2284
2152
|
}, "__needMoreData"),
|
2285
2153
|
// Central parser implementation
|
2286
2154
|
parse: /* @__PURE__ */ __name(function(nextBuf, end, push, close) {
|
2287
|
-
const {
|
2288
|
-
bom,
|
2289
|
-
comment_no_infix,
|
2290
|
-
encoding,
|
2291
|
-
from_line,
|
2292
|
-
ltrim,
|
2293
|
-
max_record_size,
|
2294
|
-
raw,
|
2295
|
-
relax_quotes,
|
2296
|
-
rtrim,
|
2297
|
-
skip_empty_lines,
|
2298
|
-
to,
|
2299
|
-
to_line
|
2300
|
-
} = this.options;
|
2155
|
+
const { bom, comment_no_infix, encoding, from_line, ltrim, max_record_size, raw, relax_quotes, rtrim, skip_empty_lines, to, to_line } = this.options;
|
2301
2156
|
let { comment, escape, quote, record_delimiter } = this.options;
|
2302
2157
|
const { bomSkipped, previousBuf, rawBuffer, escapeIsQuote } = this.state;
|
2303
2158
|
let buf;
|
@@ -2327,10 +2182,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2327
2182
|
const bomLength = boms[encoding2].length;
|
2328
2183
|
this.state.bufBytesStart += bomLength;
|
2329
2184
|
buf = buf.slice(bomLength);
|
2330
|
-
this.options = normalize_options({
|
2331
|
-
...this.original_options,
|
2332
|
-
encoding: encoding2
|
2333
|
-
});
|
2185
|
+
this.options = normalize_options({ ...this.original_options, encoding: encoding2 });
|
2334
2186
|
({ comment, escape, quote } = this.options);
|
2335
2187
|
break;
|
2336
2188
|
}
|
@@ -2354,10 +2206,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2354
2206
|
return;
|
2355
2207
|
}
|
2356
2208
|
if (this.state.quoting === false && record_delimiter.length === 0) {
|
2357
|
-
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(
|
2358
|
-
buf,
|
2359
|
-
pos
|
2360
|
-
);
|
2209
|
+
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(buf, pos);
|
2361
2210
|
if (record_delimiterCount) {
|
2362
2211
|
record_delimiter = this.options.record_delimiter;
|
2363
2212
|
}
|
@@ -2390,11 +2239,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2390
2239
|
const nextChr = buf[pos + quote.length];
|
2391
2240
|
const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos + quote.length);
|
2392
2241
|
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos + quote.length, nextChr);
|
2393
|
-
const isNextChrDelimiter = this.__isDelimiter(
|
2394
|
-
buf,
|
2395
|
-
pos + quote.length,
|
2396
|
-
nextChr
|
2397
|
-
);
|
2242
|
+
const isNextChrDelimiter = this.__isDelimiter(buf, pos + quote.length, nextChr);
|
2398
2243
|
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos + quote.length) : this.__isRecordDelimiter(nextChr, buf, pos + quote.length);
|
2399
2244
|
if (escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)) {
|
2400
2245
|
pos += escape.length - 1;
|
@@ -2405,18 +2250,13 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2405
2250
|
continue;
|
2406
2251
|
} else if (relax_quotes === false) {
|
2407
2252
|
const err = this.__error(
|
2408
|
-
new CsvError(
|
2409
|
-
"
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
"(if activated) or comment"
|
2416
|
-
],
|
2417
|
-
this.options,
|
2418
|
-
this.__infoField()
|
2419
|
-
)
|
2253
|
+
new CsvError("CSV_INVALID_CLOSING_QUOTE", [
|
2254
|
+
"Invalid Closing Quote:",
|
2255
|
+
`got "${String.fromCharCode(nextChr)}"`,
|
2256
|
+
`at line ${this.info.lines}`,
|
2257
|
+
"instead of delimiter, record delimiter, trimable character",
|
2258
|
+
"(if activated) or comment"
|
2259
|
+
], this.options, this.__infoField())
|
2420
2260
|
);
|
2421
2261
|
if (err !== void 0) return err;
|
2422
2262
|
} else {
|
@@ -2429,23 +2269,15 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2429
2269
|
if (this.state.field.length !== 0) {
|
2430
2270
|
if (relax_quotes === false) {
|
2431
2271
|
const info2 = this.__infoField();
|
2432
|
-
const bom2 = Object.keys(boms).map(
|
2433
|
-
(b) => boms[b].equals(this.state.field.toString()) ? b : false
|
2434
|
-
).filter(Boolean)[0];
|
2272
|
+
const bom2 = Object.keys(boms).map((b) => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
|
2435
2273
|
const err = this.__error(
|
2436
|
-
new CsvError(
|
2437
|
-
"
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2443
|
-
this.options,
|
2444
|
-
info2,
|
2445
|
-
{
|
2446
|
-
field: this.state.field
|
2447
|
-
}
|
2448
|
-
)
|
2274
|
+
new CsvError("INVALID_OPENING_QUOTE", [
|
2275
|
+
"Invalid Opening Quote:",
|
2276
|
+
`a quote is found on field ${JSON.stringify(info2.column)} at line ${info2.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
|
2277
|
+
bom2 ? `(${bom2} bom)` : void 0
|
2278
|
+
], this.options, info2, {
|
2279
|
+
field: this.state.field
|
2280
|
+
})
|
2449
2281
|
);
|
2450
2282
|
if (err !== void 0) return err;
|
2451
2283
|
}
|
@@ -2457,13 +2289,9 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2457
2289
|
}
|
2458
2290
|
}
|
2459
2291
|
if (this.state.quoting === false) {
|
2460
|
-
const recordDelimiterLength = this.__isRecordDelimiter(
|
2461
|
-
chr,
|
2462
|
-
buf,
|
2463
|
-
pos
|
2464
|
-
);
|
2292
|
+
const recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos);
|
2465
2293
|
if (recordDelimiterLength !== 0) {
|
2466
|
-
const skipCommentLine = this.state.commenting && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0;
|
2294
|
+
const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0);
|
2467
2295
|
if (skipCommentLine) {
|
2468
2296
|
this.info.comment_lines++;
|
2469
2297
|
} else {
|
@@ -2518,17 +2346,12 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2518
2346
|
if (this.state.commenting === false) {
|
2519
2347
|
if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) {
|
2520
2348
|
return this.__error(
|
2521
|
-
new CsvError(
|
2522
|
-
"
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
`at line ${this.info.lines}`
|
2528
|
-
],
|
2529
|
-
this.options,
|
2530
|
-
this.__infoField()
|
2531
|
-
)
|
2349
|
+
new CsvError("CSV_MAX_RECORD_SIZE", [
|
2350
|
+
"Max Record Size:",
|
2351
|
+
"record exceed the maximum number of tolerated bytes",
|
2352
|
+
`of ${max_record_size}`,
|
2353
|
+
`at line ${this.info.lines}`
|
2354
|
+
], this.options, this.__infoField())
|
2532
2355
|
);
|
2533
2356
|
}
|
2534
2357
|
}
|
@@ -2538,16 +2361,11 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2538
2361
|
this.state.field.append(chr);
|
2539
2362
|
} else if (rtrim === true && !this.__isCharTrimable(buf, pos)) {
|
2540
2363
|
return this.__error(
|
2541
|
-
new CsvError(
|
2542
|
-
"
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
`at line ${this.info.lines}`
|
2547
|
-
],
|
2548
|
-
this.options,
|
2549
|
-
this.__infoField()
|
2550
|
-
)
|
2364
|
+
new CsvError("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE", [
|
2365
|
+
"Invalid Closing Quote:",
|
2366
|
+
"found non trimable byte after quote",
|
2367
|
+
`at line ${this.info.lines}`
|
2368
|
+
], this.options, this.__infoField())
|
2551
2369
|
);
|
2552
2370
|
} else {
|
2553
2371
|
if (lappend === false) {
|
@@ -2559,15 +2377,10 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2559
2377
|
if (end === true) {
|
2560
2378
|
if (this.state.quoting === true) {
|
2561
2379
|
const err = this.__error(
|
2562
|
-
new CsvError(
|
2563
|
-
"
|
2564
|
-
|
2565
|
-
|
2566
|
-
`the parsing is finished with an opening quote at line ${this.info.lines}`
|
2567
|
-
],
|
2568
|
-
this.options,
|
2569
|
-
this.__infoField()
|
2570
|
-
)
|
2380
|
+
new CsvError("CSV_QUOTE_NOT_CLOSED", [
|
2381
|
+
"Quote Not Closed:",
|
2382
|
+
`the parsing is finished with an opening quote at line ${this.info.lines}`
|
2383
|
+
], this.options, this.__infoField())
|
2571
2384
|
);
|
2572
2385
|
if (err !== void 0) return err;
|
2573
2386
|
} else {
|
@@ -2593,18 +2406,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2593
2406
|
}
|
2594
2407
|
}, "parse"),
|
2595
2408
|
__onRecord: /* @__PURE__ */ __name(function(push) {
|
2596
|
-
const {
|
2597
|
-
columns,
|
2598
|
-
group_columns_by_name,
|
2599
|
-
encoding,
|
2600
|
-
info: info2,
|
2601
|
-
from,
|
2602
|
-
relax_column_count,
|
2603
|
-
relax_column_count_less,
|
2604
|
-
relax_column_count_more,
|
2605
|
-
raw,
|
2606
|
-
skip_records_with_empty_values
|
2607
|
-
} = this.options;
|
2409
|
+
const { columns, group_columns_by_name, encoding, info: info2, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_records_with_empty_values } = this.options;
|
2608
2410
|
const { enabled, record } = this.state;
|
2609
2411
|
if (enabled === false) {
|
2610
2412
|
return this.__resetRecord();
|
@@ -2621,32 +2423,20 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2621
2423
|
this.state.expectedRecordLength = recordLength;
|
2622
2424
|
}
|
2623
2425
|
if (recordLength !== this.state.expectedRecordLength) {
|
2624
|
-
const err = columns === false ? new CsvError(
|
2625
|
-
"
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
[
|
2639
|
-
"Invalid Record Length:",
|
2640
|
-
`columns length is ${columns.length},`,
|
2641
|
-
// rename columns
|
2642
|
-
`got ${recordLength} on line ${this.info.lines}`
|
2643
|
-
],
|
2644
|
-
this.options,
|
2645
|
-
this.__infoField(),
|
2646
|
-
{
|
2647
|
-
record
|
2648
|
-
}
|
2649
|
-
);
|
2426
|
+
const err = columns === false ? new CsvError("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH", [
|
2427
|
+
"Invalid Record Length:",
|
2428
|
+
`expect ${this.state.expectedRecordLength},`,
|
2429
|
+
`got ${recordLength} on line ${this.info.lines}`
|
2430
|
+
], this.options, this.__infoField(), {
|
2431
|
+
record
|
2432
|
+
}) : new CsvError("CSV_RECORD_INCONSISTENT_COLUMNS", [
|
2433
|
+
"Invalid Record Length:",
|
2434
|
+
`columns length is ${columns.length},`,
|
2435
|
+
// rename columns
|
2436
|
+
`got ${recordLength} on line ${this.info.lines}`
|
2437
|
+
], this.options, this.__infoField(), {
|
2438
|
+
record
|
2439
|
+
});
|
2650
2440
|
if (relax_column_count === true || relax_column_count_less === true && recordLength < this.state.expectedRecordLength || relax_column_count_more === true && recordLength > this.state.expectedRecordLength) {
|
2651
2441
|
this.info.invalid_field_length++;
|
2652
2442
|
this.state.error = err;
|
@@ -2736,19 +2526,13 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2736
2526
|
const headers = firstLineToHeaders === void 0 ? record : firstLineToHeaders.call(null, record);
|
2737
2527
|
if (!Array.isArray(headers)) {
|
2738
2528
|
return this.__error(
|
2739
|
-
new CsvError(
|
2740
|
-
"
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
this.options,
|
2747
|
-
this.__infoField(),
|
2748
|
-
{
|
2749
|
-
headers
|
2750
|
-
}
|
2751
|
-
)
|
2529
|
+
new CsvError("CSV_INVALID_COLUMN_MAPPING", [
|
2530
|
+
"Invalid Column Mapping:",
|
2531
|
+
"expect an array from column function,",
|
2532
|
+
`got ${JSON.stringify(headers)}`
|
2533
|
+
], this.options, this.__infoField(), {
|
2534
|
+
headers
|
2535
|
+
})
|
2752
2536
|
);
|
2753
2537
|
}
|
2754
2538
|
const normalizedHeaders = normalize_columns_array(headers);
|
@@ -2951,10 +2735,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2951
2735
|
if (skip_records_with_error) {
|
2952
2736
|
this.state.recordHasError = true;
|
2953
2737
|
if (this.options.on_skip !== void 0) {
|
2954
|
-
this.options.on_skip(
|
2955
|
-
err,
|
2956
|
-
raw ? this.state.rawBuffer.toString(encoding) : void 0
|
2957
|
-
);
|
2738
|
+
this.options.on_skip(err, raw ? this.state.rawBuffer.toString(encoding) : void 0);
|
2958
2739
|
}
|
2959
2740
|
return void 0;
|
2960
2741
|
} else {
|
@@ -2989,7 +2770,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
2989
2770
|
};
|
2990
2771
|
}, "transform");
|
2991
2772
|
|
2992
|
-
// ../../node_modules/.pnpm/csv-parse@5.6
|
2773
|
+
// ../../node_modules/.pnpm/csv-parse@5.5.6/node_modules/csv-parse/lib/sync.js
|
2993
2774
|
var parse = /* @__PURE__ */ __name(function(data, opts = {}) {
|
2994
2775
|
if (typeof data === "string") {
|
2995
2776
|
data = Buffer.from(data);
|
@@ -2997,7 +2778,8 @@ var parse = /* @__PURE__ */ __name(function(data, opts = {}) {
|
|
2997
2778
|
const records = opts && opts.objname ? {} : [];
|
2998
2779
|
const parser = transform(opts);
|
2999
2780
|
const push = /* @__PURE__ */ __name((record) => {
|
3000
|
-
if (parser.options.objname === void 0)
|
2781
|
+
if (parser.options.objname === void 0)
|
2782
|
+
records.push(record);
|
3001
2783
|
else {
|
3002
2784
|
records[record[0]] = record[1];
|
3003
2785
|
}
|
@@ -3828,4 +3610,4 @@ export {
|
|
3828
3610
|
getCoinsThatHasPrice,
|
3829
3611
|
ignoreEthCallException
|
3830
3612
|
};
|
3831
|
-
//# sourceMappingURL=chunk-
|
3613
|
+
//# sourceMappingURL=chunk-AZFMPZRN.js.map
|