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