@sentio/sdk-bundle 2.62.1-rc.1 → 2.62.1-rc.2
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/aptos/builtin/0x1.js +5 -5
- package/lib/aptos/builtin/0x3.js +6 -6
- package/lib/aptos/builtin/0x4.js +6 -6
- package/lib/aptos/builtin/index.js +7 -7
- package/lib/aptos/ext/index.js +5 -5
- package/lib/aptos/index.js +5 -5
- package/lib/{chunk-PFY5KFQM.js → chunk-35FWRY45.js} +2 -2
- package/lib/{chunk-J6EIXHMB.js → chunk-B5DTCANS.js} +5 -5
- package/lib/{chunk-X6R7OLNU.js → chunk-BBAJWF26.js} +423 -200
- package/lib/{chunk-X6R7OLNU.js.map → chunk-BBAJWF26.js.map} +1 -1
- package/lib/{chunk-WH7VZ4UN.js → chunk-C4IWDMJP.js} +4 -4
- package/lib/{chunk-LU7Y242I.js → chunk-E6NA7NG4.js} +4577 -4327
- package/lib/chunk-E6NA7NG4.js.map +1 -0
- package/lib/{chunk-EFLNW4OX.js → chunk-EZWWCMDA.js} +21 -2
- package/lib/{chunk-EFLNW4OX.js.map → chunk-EZWWCMDA.js.map} +1 -1
- package/lib/{chunk-Q7ODO5TY.js → chunk-ITEA4P7X.js} +2 -2
- package/lib/{chunk-SMMLF2M7.js → chunk-KDONV5MN.js} +14 -14
- package/lib/{chunk-SMMLF2M7.js.map → chunk-KDONV5MN.js.map} +1 -1
- package/lib/{chunk-DYIDZUKA.js → chunk-KPSHXWBW.js} +2 -2
- package/lib/{chunk-ELPMWEYR.js → chunk-KVGG6FSO.js} +6 -6
- package/lib/{chunk-3BBCYBWP.js → chunk-N2YKY3T4.js} +3 -3
- package/lib/{chunk-MXADICA7.js → chunk-OK7JSSAW.js} +4 -4
- package/lib/{chunk-OP4CCBFE.js → chunk-QQKOOATP.js} +3 -3
- package/lib/{chunk-HUXUX4SZ.js → chunk-RZH2OJ62.js} +27 -7
- package/lib/chunk-RZH2OJ62.js.map +1 -0
- package/lib/{chunk-QUTU42TG.js → chunk-TXEQKSWM.js} +55 -5
- package/lib/chunk-TXEQKSWM.js.map +1 -0
- package/lib/{chunk-4YIX74TT.js → chunk-VGE55IGX.js} +2 -2
- package/lib/{chunk-X3SSOBOF.js → chunk-WYM4IYMI.js} +1888 -1859
- package/lib/chunk-WYM4IYMI.js.map +1 -0
- package/lib/{chunk-ONUOP6MS.js → chunk-XPAVUR3M.js} +7 -7
- package/lib/{chunk-ONUOP6MS.js.map → chunk-XPAVUR3M.js.map} +1 -1
- package/lib/{chunk-SGFYE2BW.js → chunk-ZCVHUL7O.js} +163 -6
- package/lib/{chunk-SGFYE2BW.js.map → chunk-ZCVHUL7O.js.map} +1 -1
- package/lib/{chunk-2VKG4TJH.js → chunk-ZWXYSR6T.js} +4 -4
- package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
- package/lib/eth/builtin/erc1155.js +2 -2
- package/lib/eth/builtin/erc20.js +1 -1
- package/lib/eth/builtin/erc721.js +1 -1
- package/lib/eth/builtin/index.js +3 -3
- package/lib/eth/builtin/weth9.js +2 -2
- package/lib/eth/index.js +1 -1
- package/lib/iota/builtin/0x1.js +8 -8
- package/lib/iota/builtin/0x2.js +9 -9
- package/lib/iota/builtin/0x3.js +10 -10
- package/lib/iota/builtin/index.js +10 -10
- package/lib/iota/ext/index.js +5 -5
- package/lib/iota/index.js +7 -7
- package/lib/move/index.js +1 -1
- package/lib/solana/builtin/index.js +3 -3
- package/lib/solana/index.js +3 -3
- package/lib/sui/builtin/0x1.js +8 -8
- package/lib/sui/builtin/0x2.js +11 -9
- package/lib/sui/builtin/0x3.js +10 -10
- package/lib/sui/builtin/index.js +10 -10
- package/lib/sui/ext/index.js +5 -5
- package/lib/sui/index.js +7 -7
- package/lib/testing/index.js +9 -9
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
- package/lib/chunk-HUXUX4SZ.js.map +0 -1
- package/lib/chunk-LU7Y242I.js.map +0 -1
- package/lib/chunk-QUTU42TG.js.map +0 -1
- package/lib/chunk-X3SSOBOF.js.map +0 -1
- /package/lib/{chunk-PFY5KFQM.js.map → chunk-35FWRY45.js.map} +0 -0
- /package/lib/{chunk-J6EIXHMB.js.map → chunk-B5DTCANS.js.map} +0 -0
- /package/lib/{chunk-WH7VZ4UN.js.map → chunk-C4IWDMJP.js.map} +0 -0
- /package/lib/{chunk-Q7ODO5TY.js.map → chunk-ITEA4P7X.js.map} +0 -0
- /package/lib/{chunk-DYIDZUKA.js.map → chunk-KPSHXWBW.js.map} +0 -0
- /package/lib/{chunk-ELPMWEYR.js.map → chunk-KVGG6FSO.js.map} +0 -0
- /package/lib/{chunk-3BBCYBWP.js.map → chunk-N2YKY3T4.js.map} +0 -0
- /package/lib/{chunk-MXADICA7.js.map → chunk-OK7JSSAW.js.map} +0 -0
- /package/lib/{chunk-OP4CCBFE.js.map → chunk-QQKOOATP.js.map} +0 -0
- /package/lib/{chunk-4YIX74TT.js.map → chunk-VGE55IGX.js.map} +0 -0
- /package/lib/{chunk-2VKG4TJH.js.map → chunk-ZWXYSR6T.js.map} +0 -0
|
@@ -10884,7 +10884,7 @@ import("node:process").then((p) => p.stdout.write(""));
|
|
|
10884
10884
|
// src/utils/dex-price.ts
|
|
10885
10885
|
import fs from "fs";
|
|
10886
10886
|
|
|
10887
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
10887
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/CsvError.js
|
|
10888
10888
|
var CsvError = class _CsvError extends Error {
|
|
10889
10889
|
static {
|
|
10890
10890
|
__name(this, "CsvError");
|
|
@@ -10905,12 +10905,12 @@ var CsvError = class _CsvError extends Error {
|
|
|
10905
10905
|
}
|
|
10906
10906
|
};
|
|
10907
10907
|
|
|
10908
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
10908
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/is_object.js
|
|
10909
10909
|
var is_object = /* @__PURE__ */ __name(function(obj) {
|
|
10910
10910
|
return typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
10911
10911
|
}, "is_object");
|
|
10912
10912
|
|
|
10913
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
10913
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/normalize_columns_array.js
|
|
10914
10914
|
var normalize_columns_array = /* @__PURE__ */ __name(function(columns) {
|
|
10915
10915
|
const normalizedColumns = [];
|
|
10916
10916
|
for (let i = 0, l = columns.length; i < l; i++) {
|
|
@@ -10939,7 +10939,7 @@ var normalize_columns_array = /* @__PURE__ */ __name(function(columns) {
|
|
|
10939
10939
|
return normalizedColumns;
|
|
10940
10940
|
}, "normalize_columns_array");
|
|
10941
10941
|
|
|
10942
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
10942
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/ResizeableBuffer.js
|
|
10943
10943
|
var ResizeableBuffer = class {
|
|
10944
10944
|
static {
|
|
10945
10945
|
__name(this, "ResizeableBuffer");
|
|
@@ -11006,7 +11006,7 @@ var ResizeableBuffer = class {
|
|
|
11006
11006
|
};
|
|
11007
11007
|
var ResizeableBuffer_default = ResizeableBuffer;
|
|
11008
11008
|
|
|
11009
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
11009
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/init_state.js
|
|
11010
11010
|
var np = 12;
|
|
11011
11011
|
var cr = 13;
|
|
11012
11012
|
var nl = 10;
|
|
@@ -11042,7 +11042,10 @@ var init_state = /* @__PURE__ */ __name(function(options) {
|
|
|
11042
11042
|
recordHasError: false,
|
|
11043
11043
|
record_length: 0,
|
|
11044
11044
|
recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 0 : Math.max(...options.record_delimiter.map((v) => v.length)),
|
|
11045
|
-
trimChars: [
|
|
11045
|
+
trimChars: [
|
|
11046
|
+
Buffer.from(" ", options.encoding)[0],
|
|
11047
|
+
Buffer.from(" ", options.encoding)[0]
|
|
11048
|
+
],
|
|
11046
11049
|
wasQuoting: false,
|
|
11047
11050
|
wasRowDelimiter: false,
|
|
11048
11051
|
timchars: [
|
|
@@ -11055,14 +11058,14 @@ var init_state = /* @__PURE__ */ __name(function(options) {
|
|
|
11055
11058
|
};
|
|
11056
11059
|
}, "init_state");
|
|
11057
11060
|
|
|
11058
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
11061
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/utils/underscore.js
|
|
11059
11062
|
var underscore = /* @__PURE__ */ __name(function(str) {
|
|
11060
11063
|
return str.replace(/([A-Z])/g, function(_, match) {
|
|
11061
11064
|
return "_" + match.toLowerCase();
|
|
11062
11065
|
});
|
|
11063
11066
|
}, "underscore");
|
|
11064
11067
|
|
|
11065
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
11068
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/normalize_options.js
|
|
11066
11069
|
var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
11067
11070
|
const options = {};
|
|
11068
11071
|
for (const opt in opts) {
|
|
@@ -11073,20 +11076,28 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11073
11076
|
} else if (options.encoding === null || options.encoding === false) {
|
|
11074
11077
|
options.encoding = null;
|
|
11075
11078
|
} else if (typeof options.encoding !== "string" && options.encoding !== null) {
|
|
11076
|
-
throw new CsvError(
|
|
11077
|
-
"
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11079
|
+
throw new CsvError(
|
|
11080
|
+
"CSV_INVALID_OPTION_ENCODING",
|
|
11081
|
+
[
|
|
11082
|
+
"Invalid option encoding:",
|
|
11083
|
+
"encoding must be a string or null to return a buffer,",
|
|
11084
|
+
`got ${JSON.stringify(options.encoding)}`
|
|
11085
|
+
],
|
|
11086
|
+
options
|
|
11087
|
+
);
|
|
11081
11088
|
}
|
|
11082
11089
|
if (options.bom === void 0 || options.bom === null || options.bom === false) {
|
|
11083
11090
|
options.bom = false;
|
|
11084
11091
|
} else if (options.bom !== true) {
|
|
11085
|
-
throw new CsvError(
|
|
11086
|
-
"
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11092
|
+
throw new CsvError(
|
|
11093
|
+
"CSV_INVALID_OPTION_BOM",
|
|
11094
|
+
[
|
|
11095
|
+
"Invalid option bom:",
|
|
11096
|
+
"bom must be true,",
|
|
11097
|
+
`got ${JSON.stringify(options.bom)}`
|
|
11098
|
+
],
|
|
11099
|
+
options
|
|
11100
|
+
);
|
|
11090
11101
|
}
|
|
11091
11102
|
options.cast_function = null;
|
|
11092
11103
|
if (options.cast === void 0 || options.cast === null || options.cast === false || options.cast === "") {
|
|
@@ -11095,11 +11106,15 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11095
11106
|
options.cast_function = options.cast;
|
|
11096
11107
|
options.cast = true;
|
|
11097
11108
|
} else if (options.cast !== true) {
|
|
11098
|
-
throw new CsvError(
|
|
11099
|
-
"
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11109
|
+
throw new CsvError(
|
|
11110
|
+
"CSV_INVALID_OPTION_CAST",
|
|
11111
|
+
[
|
|
11112
|
+
"Invalid option cast:",
|
|
11113
|
+
"cast must be true or a function,",
|
|
11114
|
+
`got ${JSON.stringify(options.cast)}`
|
|
11115
|
+
],
|
|
11116
|
+
options
|
|
11117
|
+
);
|
|
11103
11118
|
}
|
|
11104
11119
|
if (options.cast_date === void 0 || options.cast_date === null || options.cast_date === false || options.cast_date === "") {
|
|
11105
11120
|
options.cast_date = false;
|
|
@@ -11109,13 +11124,17 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11109
11124
|
return !isNaN(date) ? new Date(date) : value;
|
|
11110
11125
|
};
|
|
11111
11126
|
} else if (typeof options.cast_date !== "function") {
|
|
11112
|
-
throw new CsvError(
|
|
11113
|
-
"
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11127
|
+
throw new CsvError(
|
|
11128
|
+
"CSV_INVALID_OPTION_CAST_DATE",
|
|
11129
|
+
[
|
|
11130
|
+
"Invalid option cast_date:",
|
|
11131
|
+
"cast_date must be true or a function,",
|
|
11132
|
+
`got ${JSON.stringify(options.cast_date)}`
|
|
11133
|
+
],
|
|
11134
|
+
options
|
|
11135
|
+
);
|
|
11117
11136
|
}
|
|
11118
|
-
options.cast_first_line_to_header =
|
|
11137
|
+
options.cast_first_line_to_header = void 0;
|
|
11119
11138
|
if (options.columns === true) {
|
|
11120
11139
|
options.cast_first_line_to_header = void 0;
|
|
11121
11140
|
} else if (typeof options.columns === "function") {
|
|
@@ -11126,25 +11145,37 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11126
11145
|
} else if (options.columns === void 0 || options.columns === null || options.columns === false) {
|
|
11127
11146
|
options.columns = false;
|
|
11128
11147
|
} else {
|
|
11129
|
-
throw new CsvError(
|
|
11130
|
-
"
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11148
|
+
throw new CsvError(
|
|
11149
|
+
"CSV_INVALID_OPTION_COLUMNS",
|
|
11150
|
+
[
|
|
11151
|
+
"Invalid option columns:",
|
|
11152
|
+
"expect an array, a function or true,",
|
|
11153
|
+
`got ${JSON.stringify(options.columns)}`
|
|
11154
|
+
],
|
|
11155
|
+
options
|
|
11156
|
+
);
|
|
11134
11157
|
}
|
|
11135
11158
|
if (options.group_columns_by_name === void 0 || options.group_columns_by_name === null || options.group_columns_by_name === false) {
|
|
11136
11159
|
options.group_columns_by_name = false;
|
|
11137
11160
|
} else if (options.group_columns_by_name !== true) {
|
|
11138
|
-
throw new CsvError(
|
|
11139
|
-
"
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11161
|
+
throw new CsvError(
|
|
11162
|
+
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
11163
|
+
[
|
|
11164
|
+
"Invalid option group_columns_by_name:",
|
|
11165
|
+
"expect an boolean,",
|
|
11166
|
+
`got ${JSON.stringify(options.group_columns_by_name)}`
|
|
11167
|
+
],
|
|
11168
|
+
options
|
|
11169
|
+
);
|
|
11143
11170
|
} else if (options.columns === false) {
|
|
11144
|
-
throw new CsvError(
|
|
11145
|
-
"
|
|
11146
|
-
|
|
11147
|
-
|
|
11171
|
+
throw new CsvError(
|
|
11172
|
+
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
11173
|
+
[
|
|
11174
|
+
"Invalid option group_columns_by_name:",
|
|
11175
|
+
"the `columns` mode must be activated."
|
|
11176
|
+
],
|
|
11177
|
+
options
|
|
11178
|
+
);
|
|
11148
11179
|
}
|
|
11149
11180
|
if (options.comment === void 0 || options.comment === null || options.comment === false || options.comment === "") {
|
|
11150
11181
|
options.comment = null;
|
|
@@ -11153,30 +11184,43 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11153
11184
|
options.comment = Buffer.from(options.comment, options.encoding);
|
|
11154
11185
|
}
|
|
11155
11186
|
if (!Buffer.isBuffer(options.comment)) {
|
|
11156
|
-
throw new CsvError(
|
|
11157
|
-
"
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11187
|
+
throw new CsvError(
|
|
11188
|
+
"CSV_INVALID_OPTION_COMMENT",
|
|
11189
|
+
[
|
|
11190
|
+
"Invalid option comment:",
|
|
11191
|
+
"comment must be a buffer or a string,",
|
|
11192
|
+
`got ${JSON.stringify(options.comment)}`
|
|
11193
|
+
],
|
|
11194
|
+
options
|
|
11195
|
+
);
|
|
11161
11196
|
}
|
|
11162
11197
|
}
|
|
11163
11198
|
if (options.comment_no_infix === void 0 || options.comment_no_infix === null || options.comment_no_infix === false) {
|
|
11164
11199
|
options.comment_no_infix = false;
|
|
11165
11200
|
} else if (options.comment_no_infix !== true) {
|
|
11166
|
-
throw new CsvError(
|
|
11167
|
-
"
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11201
|
+
throw new CsvError(
|
|
11202
|
+
"CSV_INVALID_OPTION_COMMENT",
|
|
11203
|
+
[
|
|
11204
|
+
"Invalid option comment_no_infix:",
|
|
11205
|
+
"value must be a boolean,",
|
|
11206
|
+
`got ${JSON.stringify(options.comment_no_infix)}`
|
|
11207
|
+
],
|
|
11208
|
+
options
|
|
11209
|
+
);
|
|
11171
11210
|
}
|
|
11172
11211
|
const delimiter_json = JSON.stringify(options.delimiter);
|
|
11173
|
-
if (!Array.isArray(options.delimiter))
|
|
11212
|
+
if (!Array.isArray(options.delimiter))
|
|
11213
|
+
options.delimiter = [options.delimiter];
|
|
11174
11214
|
if (options.delimiter.length === 0) {
|
|
11175
|
-
throw new CsvError(
|
|
11176
|
-
"
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11215
|
+
throw new CsvError(
|
|
11216
|
+
"CSV_INVALID_OPTION_DELIMITER",
|
|
11217
|
+
[
|
|
11218
|
+
"Invalid option delimiter:",
|
|
11219
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
11220
|
+
`got ${delimiter_json}`
|
|
11221
|
+
],
|
|
11222
|
+
options
|
|
11223
|
+
);
|
|
11180
11224
|
}
|
|
11181
11225
|
options.delimiter = options.delimiter.map(function(delimiter) {
|
|
11182
11226
|
if (delimiter === void 0 || delimiter === null || delimiter === false) {
|
|
@@ -11186,11 +11230,15 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11186
11230
|
delimiter = Buffer.from(delimiter, options.encoding);
|
|
11187
11231
|
}
|
|
11188
11232
|
if (!Buffer.isBuffer(delimiter) || delimiter.length === 0) {
|
|
11189
|
-
throw new CsvError(
|
|
11190
|
-
"
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11233
|
+
throw new CsvError(
|
|
11234
|
+
"CSV_INVALID_OPTION_DELIMITER",
|
|
11235
|
+
[
|
|
11236
|
+
"Invalid option delimiter:",
|
|
11237
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
11238
|
+
`got ${delimiter_json}`
|
|
11239
|
+
],
|
|
11240
|
+
options
|
|
11241
|
+
);
|
|
11194
11242
|
}
|
|
11195
11243
|
return delimiter;
|
|
11196
11244
|
});
|
|
@@ -11203,7 +11251,9 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11203
11251
|
}
|
|
11204
11252
|
if (options.escape !== null) {
|
|
11205
11253
|
if (!Buffer.isBuffer(options.escape)) {
|
|
11206
|
-
throw new Error(
|
|
11254
|
+
throw new Error(
|
|
11255
|
+
`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`
|
|
11256
|
+
);
|
|
11207
11257
|
}
|
|
11208
11258
|
}
|
|
11209
11259
|
if (options.from === void 0 || options.from === null) {
|
|
@@ -11214,10 +11264,14 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11214
11264
|
}
|
|
11215
11265
|
if (Number.isInteger(options.from)) {
|
|
11216
11266
|
if (options.from < 0) {
|
|
11217
|
-
throw new Error(
|
|
11267
|
+
throw new Error(
|
|
11268
|
+
`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`
|
|
11269
|
+
);
|
|
11218
11270
|
}
|
|
11219
11271
|
} else {
|
|
11220
|
-
throw new Error(
|
|
11272
|
+
throw new Error(
|
|
11273
|
+
`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`
|
|
11274
|
+
);
|
|
11221
11275
|
}
|
|
11222
11276
|
}
|
|
11223
11277
|
if (options.from_line === void 0 || options.from_line === null) {
|
|
@@ -11228,10 +11282,14 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11228
11282
|
}
|
|
11229
11283
|
if (Number.isInteger(options.from_line)) {
|
|
11230
11284
|
if (options.from_line <= 0) {
|
|
11231
|
-
throw new Error(
|
|
11285
|
+
throw new Error(
|
|
11286
|
+
`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`
|
|
11287
|
+
);
|
|
11232
11288
|
}
|
|
11233
11289
|
} else {
|
|
11234
|
-
throw new Error(
|
|
11290
|
+
throw new Error(
|
|
11291
|
+
`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`
|
|
11292
|
+
);
|
|
11235
11293
|
}
|
|
11236
11294
|
}
|
|
11237
11295
|
if (options.ignore_last_delimiters === void 0 || options.ignore_last_delimiters === null) {
|
|
@@ -11242,22 +11300,32 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11242
11300
|
options.ignore_last_delimiters = false;
|
|
11243
11301
|
}
|
|
11244
11302
|
} else if (typeof options.ignore_last_delimiters !== "boolean") {
|
|
11245
|
-
throw new CsvError(
|
|
11246
|
-
"
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11303
|
+
throw new CsvError(
|
|
11304
|
+
"CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",
|
|
11305
|
+
[
|
|
11306
|
+
"Invalid option `ignore_last_delimiters`:",
|
|
11307
|
+
"the value must be a boolean value or an integer,",
|
|
11308
|
+
`got ${JSON.stringify(options.ignore_last_delimiters)}`
|
|
11309
|
+
],
|
|
11310
|
+
options
|
|
11311
|
+
);
|
|
11250
11312
|
}
|
|
11251
11313
|
if (options.ignore_last_delimiters === true && options.columns === false) {
|
|
11252
|
-
throw new CsvError(
|
|
11253
|
-
"
|
|
11254
|
-
|
|
11255
|
-
|
|
11314
|
+
throw new CsvError(
|
|
11315
|
+
"CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",
|
|
11316
|
+
[
|
|
11317
|
+
"The option `ignore_last_delimiters`",
|
|
11318
|
+
"requires the activation of the `columns` option"
|
|
11319
|
+
],
|
|
11320
|
+
options
|
|
11321
|
+
);
|
|
11256
11322
|
}
|
|
11257
11323
|
if (options.info === void 0 || options.info === null || options.info === false) {
|
|
11258
11324
|
options.info = false;
|
|
11259
11325
|
} else if (options.info !== true) {
|
|
11260
|
-
throw new Error(
|
|
11326
|
+
throw new Error(
|
|
11327
|
+
`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`
|
|
11328
|
+
);
|
|
11261
11329
|
}
|
|
11262
11330
|
if (options.max_record_size === void 0 || options.max_record_size === null || options.max_record_size === false) {
|
|
11263
11331
|
options.max_record_size = 0;
|
|
@@ -11265,7 +11333,9 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11265
11333
|
} else if (typeof options.max_record_size === "string" && /\d+/.test(options.max_record_size)) {
|
|
11266
11334
|
options.max_record_size = parseInt(options.max_record_size);
|
|
11267
11335
|
} else {
|
|
11268
|
-
throw new Error(
|
|
11336
|
+
throw new Error(
|
|
11337
|
+
`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`
|
|
11338
|
+
);
|
|
11269
11339
|
}
|
|
11270
11340
|
if (options.objname === void 0 || options.objname === null || options.objname === false) {
|
|
11271
11341
|
options.objname = void 0;
|
|
@@ -11283,30 +11353,42 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11283
11353
|
}
|
|
11284
11354
|
} else if (typeof options.objname === "number") {
|
|
11285
11355
|
} else {
|
|
11286
|
-
throw new Error(
|
|
11356
|
+
throw new Error(
|
|
11357
|
+
`Invalid Option: objname must be a string or a buffer, got ${options.objname}`
|
|
11358
|
+
);
|
|
11287
11359
|
}
|
|
11288
11360
|
if (options.objname !== void 0) {
|
|
11289
11361
|
if (typeof options.objname === "number") {
|
|
11290
11362
|
if (options.columns !== false) {
|
|
11291
|
-
throw Error(
|
|
11363
|
+
throw Error(
|
|
11364
|
+
"Invalid Option: objname index cannot be combined with columns or be defined as a field"
|
|
11365
|
+
);
|
|
11292
11366
|
}
|
|
11293
11367
|
} else {
|
|
11294
11368
|
if (options.columns === false) {
|
|
11295
|
-
throw Error(
|
|
11369
|
+
throw Error(
|
|
11370
|
+
"Invalid Option: objname field must be combined with columns or be defined as an index"
|
|
11371
|
+
);
|
|
11296
11372
|
}
|
|
11297
11373
|
}
|
|
11298
11374
|
}
|
|
11299
11375
|
if (options.on_record === void 0 || options.on_record === null) {
|
|
11300
11376
|
options.on_record = void 0;
|
|
11301
11377
|
} else if (typeof options.on_record !== "function") {
|
|
11302
|
-
throw new CsvError(
|
|
11303
|
-
"
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11378
|
+
throw new CsvError(
|
|
11379
|
+
"CSV_INVALID_OPTION_ON_RECORD",
|
|
11380
|
+
[
|
|
11381
|
+
"Invalid option `on_record`:",
|
|
11382
|
+
"expect a function,",
|
|
11383
|
+
`got ${JSON.stringify(options.on_record)}`
|
|
11384
|
+
],
|
|
11385
|
+
options
|
|
11386
|
+
);
|
|
11307
11387
|
}
|
|
11308
11388
|
if (options.on_skip !== void 0 && options.on_skip !== null && typeof options.on_skip !== "function") {
|
|
11309
|
-
throw new Error(
|
|
11389
|
+
throw new Error(
|
|
11390
|
+
`Invalid Option: on_skip must be a function, got ${JSON.stringify(options.on_skip)}`
|
|
11391
|
+
);
|
|
11310
11392
|
}
|
|
11311
11393
|
if (options.quote === null || options.quote === false || options.quote === "") {
|
|
11312
11394
|
options.quote = null;
|
|
@@ -11317,47 +11399,67 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11317
11399
|
options.quote = Buffer.from(options.quote, options.encoding);
|
|
11318
11400
|
}
|
|
11319
11401
|
if (!Buffer.isBuffer(options.quote)) {
|
|
11320
|
-
throw new Error(
|
|
11402
|
+
throw new Error(
|
|
11403
|
+
`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`
|
|
11404
|
+
);
|
|
11321
11405
|
}
|
|
11322
11406
|
}
|
|
11323
11407
|
if (options.raw === void 0 || options.raw === null || options.raw === false) {
|
|
11324
11408
|
options.raw = false;
|
|
11325
11409
|
} else if (options.raw !== true) {
|
|
11326
|
-
throw new Error(
|
|
11410
|
+
throw new Error(
|
|
11411
|
+
`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`
|
|
11412
|
+
);
|
|
11327
11413
|
}
|
|
11328
11414
|
if (options.record_delimiter === void 0) {
|
|
11329
11415
|
options.record_delimiter = [];
|
|
11330
11416
|
} else if (typeof options.record_delimiter === "string" || Buffer.isBuffer(options.record_delimiter)) {
|
|
11331
11417
|
if (options.record_delimiter.length === 0) {
|
|
11332
|
-
throw new CsvError(
|
|
11333
|
-
"
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11418
|
+
throw new CsvError(
|
|
11419
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
11420
|
+
[
|
|
11421
|
+
"Invalid option `record_delimiter`:",
|
|
11422
|
+
"value must be a non empty string or buffer,",
|
|
11423
|
+
`got ${JSON.stringify(options.record_delimiter)}`
|
|
11424
|
+
],
|
|
11425
|
+
options
|
|
11426
|
+
);
|
|
11337
11427
|
}
|
|
11338
11428
|
options.record_delimiter = [options.record_delimiter];
|
|
11339
11429
|
} else if (!Array.isArray(options.record_delimiter)) {
|
|
11340
|
-
throw new CsvError(
|
|
11341
|
-
"
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11430
|
+
throw new CsvError(
|
|
11431
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
11432
|
+
[
|
|
11433
|
+
"Invalid option `record_delimiter`:",
|
|
11434
|
+
"value must be a string, a buffer or array of string|buffer,",
|
|
11435
|
+
`got ${JSON.stringify(options.record_delimiter)}`
|
|
11436
|
+
],
|
|
11437
|
+
options
|
|
11438
|
+
);
|
|
11345
11439
|
}
|
|
11346
11440
|
options.record_delimiter = options.record_delimiter.map(function(rd, i) {
|
|
11347
11441
|
if (typeof rd !== "string" && !Buffer.isBuffer(rd)) {
|
|
11348
|
-
throw new CsvError(
|
|
11349
|
-
"
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11442
|
+
throw new CsvError(
|
|
11443
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
11444
|
+
[
|
|
11445
|
+
"Invalid option `record_delimiter`:",
|
|
11446
|
+
"value must be a string, a buffer or array of string|buffer",
|
|
11447
|
+
`at index ${i},`,
|
|
11448
|
+
`got ${JSON.stringify(rd)}`
|
|
11449
|
+
],
|
|
11450
|
+
options
|
|
11451
|
+
);
|
|
11354
11452
|
} else if (rd.length === 0) {
|
|
11355
|
-
throw new CsvError(
|
|
11356
|
-
"
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11453
|
+
throw new CsvError(
|
|
11454
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
11455
|
+
[
|
|
11456
|
+
"Invalid option `record_delimiter`:",
|
|
11457
|
+
"value must be a non empty string or buffer",
|
|
11458
|
+
`at index ${i},`,
|
|
11459
|
+
`got ${JSON.stringify(rd)}`
|
|
11460
|
+
],
|
|
11461
|
+
options
|
|
11462
|
+
);
|
|
11361
11463
|
}
|
|
11362
11464
|
if (typeof rd === "string") {
|
|
11363
11465
|
rd = Buffer.from(rd, options.encoding);
|
|
@@ -11368,58 +11470,78 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11368
11470
|
} else if (options.relax_column_count === void 0 || options.relax_column_count === null) {
|
|
11369
11471
|
options.relax_column_count = false;
|
|
11370
11472
|
} else {
|
|
11371
|
-
throw new Error(
|
|
11473
|
+
throw new Error(
|
|
11474
|
+
`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`
|
|
11475
|
+
);
|
|
11372
11476
|
}
|
|
11373
11477
|
if (typeof options.relax_column_count_less === "boolean") {
|
|
11374
11478
|
} else if (options.relax_column_count_less === void 0 || options.relax_column_count_less === null) {
|
|
11375
11479
|
options.relax_column_count_less = false;
|
|
11376
11480
|
} else {
|
|
11377
|
-
throw new Error(
|
|
11481
|
+
throw new Error(
|
|
11482
|
+
`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`
|
|
11483
|
+
);
|
|
11378
11484
|
}
|
|
11379
11485
|
if (typeof options.relax_column_count_more === "boolean") {
|
|
11380
11486
|
} else if (options.relax_column_count_more === void 0 || options.relax_column_count_more === null) {
|
|
11381
11487
|
options.relax_column_count_more = false;
|
|
11382
11488
|
} else {
|
|
11383
|
-
throw new Error(
|
|
11489
|
+
throw new Error(
|
|
11490
|
+
`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`
|
|
11491
|
+
);
|
|
11384
11492
|
}
|
|
11385
11493
|
if (typeof options.relax_quotes === "boolean") {
|
|
11386
11494
|
} else if (options.relax_quotes === void 0 || options.relax_quotes === null) {
|
|
11387
11495
|
options.relax_quotes = false;
|
|
11388
11496
|
} else {
|
|
11389
|
-
throw new Error(
|
|
11497
|
+
throw new Error(
|
|
11498
|
+
`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(options.relax_quotes)}`
|
|
11499
|
+
);
|
|
11390
11500
|
}
|
|
11391
11501
|
if (typeof options.skip_empty_lines === "boolean") {
|
|
11392
11502
|
} else if (options.skip_empty_lines === void 0 || options.skip_empty_lines === null) {
|
|
11393
11503
|
options.skip_empty_lines = false;
|
|
11394
11504
|
} else {
|
|
11395
|
-
throw new Error(
|
|
11505
|
+
throw new Error(
|
|
11506
|
+
`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`
|
|
11507
|
+
);
|
|
11396
11508
|
}
|
|
11397
11509
|
if (typeof options.skip_records_with_empty_values === "boolean") {
|
|
11398
11510
|
} else if (options.skip_records_with_empty_values === void 0 || options.skip_records_with_empty_values === null) {
|
|
11399
11511
|
options.skip_records_with_empty_values = false;
|
|
11400
11512
|
} else {
|
|
11401
|
-
throw new Error(
|
|
11513
|
+
throw new Error(
|
|
11514
|
+
`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`
|
|
11515
|
+
);
|
|
11402
11516
|
}
|
|
11403
11517
|
if (typeof options.skip_records_with_error === "boolean") {
|
|
11404
11518
|
} else if (options.skip_records_with_error === void 0 || options.skip_records_with_error === null) {
|
|
11405
11519
|
options.skip_records_with_error = false;
|
|
11406
11520
|
} else {
|
|
11407
|
-
throw new Error(
|
|
11521
|
+
throw new Error(
|
|
11522
|
+
`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`
|
|
11523
|
+
);
|
|
11408
11524
|
}
|
|
11409
11525
|
if (options.rtrim === void 0 || options.rtrim === null || options.rtrim === false) {
|
|
11410
11526
|
options.rtrim = false;
|
|
11411
11527
|
} else if (options.rtrim !== true) {
|
|
11412
|
-
throw new Error(
|
|
11528
|
+
throw new Error(
|
|
11529
|
+
`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`
|
|
11530
|
+
);
|
|
11413
11531
|
}
|
|
11414
11532
|
if (options.ltrim === void 0 || options.ltrim === null || options.ltrim === false) {
|
|
11415
11533
|
options.ltrim = false;
|
|
11416
11534
|
} else if (options.ltrim !== true) {
|
|
11417
|
-
throw new Error(
|
|
11535
|
+
throw new Error(
|
|
11536
|
+
`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`
|
|
11537
|
+
);
|
|
11418
11538
|
}
|
|
11419
11539
|
if (options.trim === void 0 || options.trim === null || options.trim === false) {
|
|
11420
11540
|
options.trim = false;
|
|
11421
11541
|
} else if (options.trim !== true) {
|
|
11422
|
-
throw new Error(
|
|
11542
|
+
throw new Error(
|
|
11543
|
+
`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`
|
|
11544
|
+
);
|
|
11423
11545
|
}
|
|
11424
11546
|
if (options.trim === true && opts.ltrim !== false) {
|
|
11425
11547
|
options.ltrim = true;
|
|
@@ -11433,38 +11555,48 @@ var normalize_options = /* @__PURE__ */ __name(function(opts) {
|
|
|
11433
11555
|
}
|
|
11434
11556
|
if (options.to === void 0 || options.to === null) {
|
|
11435
11557
|
options.to = -1;
|
|
11436
|
-
} else {
|
|
11558
|
+
} else if (options.to !== -1) {
|
|
11437
11559
|
if (typeof options.to === "string" && /\d+/.test(options.to)) {
|
|
11438
11560
|
options.to = parseInt(options.to);
|
|
11439
11561
|
}
|
|
11440
11562
|
if (Number.isInteger(options.to)) {
|
|
11441
11563
|
if (options.to <= 0) {
|
|
11442
|
-
throw new Error(
|
|
11564
|
+
throw new Error(
|
|
11565
|
+
`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`
|
|
11566
|
+
);
|
|
11443
11567
|
}
|
|
11444
11568
|
} else {
|
|
11445
|
-
throw new Error(
|
|
11569
|
+
throw new Error(
|
|
11570
|
+
`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`
|
|
11571
|
+
);
|
|
11446
11572
|
}
|
|
11447
11573
|
}
|
|
11448
11574
|
if (options.to_line === void 0 || options.to_line === null) {
|
|
11449
11575
|
options.to_line = -1;
|
|
11450
|
-
} else {
|
|
11576
|
+
} else if (options.to_line !== -1) {
|
|
11451
11577
|
if (typeof options.to_line === "string" && /\d+/.test(options.to_line)) {
|
|
11452
11578
|
options.to_line = parseInt(options.to_line);
|
|
11453
11579
|
}
|
|
11454
11580
|
if (Number.isInteger(options.to_line)) {
|
|
11455
11581
|
if (options.to_line <= 0) {
|
|
11456
|
-
throw new Error(
|
|
11582
|
+
throw new Error(
|
|
11583
|
+
`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`
|
|
11584
|
+
);
|
|
11457
11585
|
}
|
|
11458
11586
|
} else {
|
|
11459
|
-
throw new Error(
|
|
11587
|
+
throw new Error(
|
|
11588
|
+
`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`
|
|
11589
|
+
);
|
|
11460
11590
|
}
|
|
11461
11591
|
}
|
|
11462
11592
|
return options;
|
|
11463
11593
|
}, "normalize_options");
|
|
11464
11594
|
|
|
11465
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
11595
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/api/index.js
|
|
11466
11596
|
var isRecordEmpty = /* @__PURE__ */ __name(function(record) {
|
|
11467
|
-
return record.every(
|
|
11597
|
+
return record.every(
|
|
11598
|
+
(field) => field == null || field.toString && field.toString().trim() === ""
|
|
11599
|
+
);
|
|
11468
11600
|
}, "isRecordEmpty");
|
|
11469
11601
|
var cr2 = 13;
|
|
11470
11602
|
var nl2 = 10;
|
|
@@ -11473,11 +11605,11 @@ var boms = {
|
|
|
11473
11605
|
// Buffer.from("\ufeff")
|
|
11474
11606
|
// Buffer.from([239, 187, 191])
|
|
11475
11607
|
// Buffer.from('EFBBBF', 'hex')
|
|
11476
|
-
|
|
11608
|
+
utf8: Buffer.from([239, 187, 191]),
|
|
11477
11609
|
// Note, the following are equals:
|
|
11478
11610
|
// Buffer.from "\ufeff", 'utf16le
|
|
11479
11611
|
// Buffer.from([255, 254])
|
|
11480
|
-
|
|
11612
|
+
utf16le: Buffer.from([255, 254])
|
|
11481
11613
|
};
|
|
11482
11614
|
var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
11483
11615
|
const info = {
|
|
@@ -11517,7 +11649,20 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11517
11649
|
}, "__needMoreData"),
|
|
11518
11650
|
// Central parser implementation
|
|
11519
11651
|
parse: /* @__PURE__ */ __name(function(nextBuf, end, push, close) {
|
|
11520
|
-
const {
|
|
11652
|
+
const {
|
|
11653
|
+
bom,
|
|
11654
|
+
comment_no_infix,
|
|
11655
|
+
encoding,
|
|
11656
|
+
from_line,
|
|
11657
|
+
ltrim,
|
|
11658
|
+
max_record_size,
|
|
11659
|
+
raw,
|
|
11660
|
+
relax_quotes,
|
|
11661
|
+
rtrim,
|
|
11662
|
+
skip_empty_lines,
|
|
11663
|
+
to,
|
|
11664
|
+
to_line
|
|
11665
|
+
} = this.options;
|
|
11521
11666
|
let { comment, escape, quote, record_delimiter } = this.options;
|
|
11522
11667
|
const { bomSkipped, previousBuf, rawBuffer, escapeIsQuote } = this.state;
|
|
11523
11668
|
let buf;
|
|
@@ -11547,7 +11692,13 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11547
11692
|
const bomLength = boms[encoding2].length;
|
|
11548
11693
|
this.state.bufBytesStart += bomLength;
|
|
11549
11694
|
buf = buf.slice(bomLength);
|
|
11550
|
-
|
|
11695
|
+
const options2 = normalize_options({
|
|
11696
|
+
...this.original_options,
|
|
11697
|
+
encoding: encoding2
|
|
11698
|
+
});
|
|
11699
|
+
for (const key in options2) {
|
|
11700
|
+
this.options[key] = options2[key];
|
|
11701
|
+
}
|
|
11551
11702
|
({ comment, escape, quote } = this.options);
|
|
11552
11703
|
break;
|
|
11553
11704
|
}
|
|
@@ -11571,7 +11722,10 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11571
11722
|
return;
|
|
11572
11723
|
}
|
|
11573
11724
|
if (this.state.quoting === false && record_delimiter.length === 0) {
|
|
11574
|
-
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(
|
|
11725
|
+
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(
|
|
11726
|
+
buf,
|
|
11727
|
+
pos
|
|
11728
|
+
);
|
|
11575
11729
|
if (record_delimiterCount) {
|
|
11576
11730
|
record_delimiter = this.options.record_delimiter;
|
|
11577
11731
|
}
|
|
@@ -11604,7 +11758,11 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11604
11758
|
const nextChr = buf[pos + quote.length];
|
|
11605
11759
|
const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos + quote.length);
|
|
11606
11760
|
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos + quote.length, nextChr);
|
|
11607
|
-
const isNextChrDelimiter = this.__isDelimiter(
|
|
11761
|
+
const isNextChrDelimiter = this.__isDelimiter(
|
|
11762
|
+
buf,
|
|
11763
|
+
pos + quote.length,
|
|
11764
|
+
nextChr
|
|
11765
|
+
);
|
|
11608
11766
|
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos + quote.length) : this.__isRecordDelimiter(nextChr, buf, pos + quote.length);
|
|
11609
11767
|
if (escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)) {
|
|
11610
11768
|
pos += escape.length - 1;
|
|
@@ -11615,13 +11773,18 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11615
11773
|
continue;
|
|
11616
11774
|
} else if (relax_quotes === false) {
|
|
11617
11775
|
const err = this.__error(
|
|
11618
|
-
new CsvError(
|
|
11619
|
-
"
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11776
|
+
new CsvError(
|
|
11777
|
+
"CSV_INVALID_CLOSING_QUOTE",
|
|
11778
|
+
[
|
|
11779
|
+
"Invalid Closing Quote:",
|
|
11780
|
+
`got "${String.fromCharCode(nextChr)}"`,
|
|
11781
|
+
`at line ${this.info.lines}`,
|
|
11782
|
+
"instead of delimiter, record delimiter, trimable character",
|
|
11783
|
+
"(if activated) or comment"
|
|
11784
|
+
],
|
|
11785
|
+
this.options,
|
|
11786
|
+
this.__infoField()
|
|
11787
|
+
)
|
|
11625
11788
|
);
|
|
11626
11789
|
if (err !== void 0) return err;
|
|
11627
11790
|
} else {
|
|
@@ -11634,15 +11797,23 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11634
11797
|
if (this.state.field.length !== 0) {
|
|
11635
11798
|
if (relax_quotes === false) {
|
|
11636
11799
|
const info2 = this.__infoField();
|
|
11637
|
-
const bom2 = Object.keys(boms).map(
|
|
11800
|
+
const bom2 = Object.keys(boms).map(
|
|
11801
|
+
(b) => boms[b].equals(this.state.field.toString()) ? b : false
|
|
11802
|
+
).filter(Boolean)[0];
|
|
11638
11803
|
const err = this.__error(
|
|
11639
|
-
new CsvError(
|
|
11640
|
-
"
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11804
|
+
new CsvError(
|
|
11805
|
+
"INVALID_OPENING_QUOTE",
|
|
11806
|
+
[
|
|
11807
|
+
"Invalid Opening Quote:",
|
|
11808
|
+
`a quote is found on field ${JSON.stringify(info2.column)} at line ${info2.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
|
|
11809
|
+
bom2 ? `(${bom2} bom)` : void 0
|
|
11810
|
+
],
|
|
11811
|
+
this.options,
|
|
11812
|
+
info2,
|
|
11813
|
+
{
|
|
11814
|
+
field: this.state.field
|
|
11815
|
+
}
|
|
11816
|
+
)
|
|
11646
11817
|
);
|
|
11647
11818
|
if (err !== void 0) return err;
|
|
11648
11819
|
}
|
|
@@ -11654,9 +11825,13 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11654
11825
|
}
|
|
11655
11826
|
}
|
|
11656
11827
|
if (this.state.quoting === false) {
|
|
11657
|
-
const recordDelimiterLength = this.__isRecordDelimiter(
|
|
11828
|
+
const recordDelimiterLength = this.__isRecordDelimiter(
|
|
11829
|
+
chr,
|
|
11830
|
+
buf,
|
|
11831
|
+
pos
|
|
11832
|
+
);
|
|
11658
11833
|
if (recordDelimiterLength !== 0) {
|
|
11659
|
-
const skipCommentLine = this.state.commenting &&
|
|
11834
|
+
const skipCommentLine = this.state.commenting && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0;
|
|
11660
11835
|
if (skipCommentLine) {
|
|
11661
11836
|
this.info.comment_lines++;
|
|
11662
11837
|
} else {
|
|
@@ -11711,12 +11886,17 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11711
11886
|
if (this.state.commenting === false) {
|
|
11712
11887
|
if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) {
|
|
11713
11888
|
return this.__error(
|
|
11714
|
-
new CsvError(
|
|
11715
|
-
"
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11889
|
+
new CsvError(
|
|
11890
|
+
"CSV_MAX_RECORD_SIZE",
|
|
11891
|
+
[
|
|
11892
|
+
"Max Record Size:",
|
|
11893
|
+
"record exceed the maximum number of tolerated bytes",
|
|
11894
|
+
`of ${max_record_size}`,
|
|
11895
|
+
`at line ${this.info.lines}`
|
|
11896
|
+
],
|
|
11897
|
+
this.options,
|
|
11898
|
+
this.__infoField()
|
|
11899
|
+
)
|
|
11720
11900
|
);
|
|
11721
11901
|
}
|
|
11722
11902
|
}
|
|
@@ -11726,11 +11906,16 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11726
11906
|
this.state.field.append(chr);
|
|
11727
11907
|
} else if (rtrim === true && !this.__isCharTrimable(buf, pos)) {
|
|
11728
11908
|
return this.__error(
|
|
11729
|
-
new CsvError(
|
|
11730
|
-
"
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11909
|
+
new CsvError(
|
|
11910
|
+
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
11911
|
+
[
|
|
11912
|
+
"Invalid Closing Quote:",
|
|
11913
|
+
"found non trimable byte after quote",
|
|
11914
|
+
`at line ${this.info.lines}`
|
|
11915
|
+
],
|
|
11916
|
+
this.options,
|
|
11917
|
+
this.__infoField()
|
|
11918
|
+
)
|
|
11734
11919
|
);
|
|
11735
11920
|
} else {
|
|
11736
11921
|
if (lappend === false) {
|
|
@@ -11742,10 +11927,15 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11742
11927
|
if (end === true) {
|
|
11743
11928
|
if (this.state.quoting === true) {
|
|
11744
11929
|
const err = this.__error(
|
|
11745
|
-
new CsvError(
|
|
11746
|
-
"
|
|
11747
|
-
|
|
11748
|
-
|
|
11930
|
+
new CsvError(
|
|
11931
|
+
"CSV_QUOTE_NOT_CLOSED",
|
|
11932
|
+
[
|
|
11933
|
+
"Quote Not Closed:",
|
|
11934
|
+
`the parsing is finished with an opening quote at line ${this.info.lines}`
|
|
11935
|
+
],
|
|
11936
|
+
this.options,
|
|
11937
|
+
this.__infoField()
|
|
11938
|
+
)
|
|
11749
11939
|
);
|
|
11750
11940
|
if (err !== void 0) return err;
|
|
11751
11941
|
} else {
|
|
@@ -11771,7 +11961,18 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11771
11961
|
}
|
|
11772
11962
|
}, "parse"),
|
|
11773
11963
|
__onRecord: /* @__PURE__ */ __name(function(push) {
|
|
11774
|
-
const {
|
|
11964
|
+
const {
|
|
11965
|
+
columns,
|
|
11966
|
+
group_columns_by_name,
|
|
11967
|
+
encoding,
|
|
11968
|
+
info: info2,
|
|
11969
|
+
from,
|
|
11970
|
+
relax_column_count,
|
|
11971
|
+
relax_column_count_less,
|
|
11972
|
+
relax_column_count_more,
|
|
11973
|
+
raw,
|
|
11974
|
+
skip_records_with_empty_values
|
|
11975
|
+
} = this.options;
|
|
11775
11976
|
const { enabled, record } = this.state;
|
|
11776
11977
|
if (enabled === false) {
|
|
11777
11978
|
return this.__resetRecord();
|
|
@@ -11788,20 +11989,32 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11788
11989
|
this.state.expectedRecordLength = recordLength;
|
|
11789
11990
|
}
|
|
11790
11991
|
if (recordLength !== this.state.expectedRecordLength) {
|
|
11791
|
-
const err = columns === false ? new CsvError(
|
|
11792
|
-
"
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11992
|
+
const err = columns === false ? new CsvError(
|
|
11993
|
+
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
11994
|
+
[
|
|
11995
|
+
"Invalid Record Length:",
|
|
11996
|
+
`expect ${this.state.expectedRecordLength},`,
|
|
11997
|
+
`got ${recordLength} on line ${this.info.lines}`
|
|
11998
|
+
],
|
|
11999
|
+
this.options,
|
|
12000
|
+
this.__infoField(),
|
|
12001
|
+
{
|
|
12002
|
+
record
|
|
12003
|
+
}
|
|
12004
|
+
) : new CsvError(
|
|
12005
|
+
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
12006
|
+
[
|
|
12007
|
+
"Invalid Record Length:",
|
|
12008
|
+
`columns length is ${columns.length},`,
|
|
12009
|
+
// rename columns
|
|
12010
|
+
`got ${recordLength} on line ${this.info.lines}`
|
|
12011
|
+
],
|
|
12012
|
+
this.options,
|
|
12013
|
+
this.__infoField(),
|
|
12014
|
+
{
|
|
12015
|
+
record
|
|
12016
|
+
}
|
|
12017
|
+
);
|
|
11805
12018
|
if (relax_column_count === true || relax_column_count_less === true && recordLength < this.state.expectedRecordLength || relax_column_count_more === true && recordLength > this.state.expectedRecordLength) {
|
|
11806
12019
|
this.info.invalid_field_length++;
|
|
11807
12020
|
this.state.error = err;
|
|
@@ -11891,13 +12104,19 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
11891
12104
|
const headers = firstLineToHeaders === void 0 ? record : firstLineToHeaders.call(null, record);
|
|
11892
12105
|
if (!Array.isArray(headers)) {
|
|
11893
12106
|
return this.__error(
|
|
11894
|
-
new CsvError(
|
|
11895
|
-
"
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
12107
|
+
new CsvError(
|
|
12108
|
+
"CSV_INVALID_COLUMN_MAPPING",
|
|
12109
|
+
[
|
|
12110
|
+
"Invalid Column Mapping:",
|
|
12111
|
+
"expect an array from column function,",
|
|
12112
|
+
`got ${JSON.stringify(headers)}`
|
|
12113
|
+
],
|
|
12114
|
+
this.options,
|
|
12115
|
+
this.__infoField(),
|
|
12116
|
+
{
|
|
12117
|
+
headers
|
|
12118
|
+
}
|
|
12119
|
+
)
|
|
11901
12120
|
);
|
|
11902
12121
|
}
|
|
11903
12122
|
const normalizedHeaders = normalize_columns_array(headers);
|
|
@@ -12100,7 +12319,14 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
12100
12319
|
if (skip_records_with_error) {
|
|
12101
12320
|
this.state.recordHasError = true;
|
|
12102
12321
|
if (this.options.on_skip !== void 0) {
|
|
12103
|
-
|
|
12322
|
+
try {
|
|
12323
|
+
this.options.on_skip(
|
|
12324
|
+
err,
|
|
12325
|
+
raw ? this.state.rawBuffer.toString(encoding) : void 0
|
|
12326
|
+
);
|
|
12327
|
+
} catch (err2) {
|
|
12328
|
+
return err2;
|
|
12329
|
+
}
|
|
12104
12330
|
}
|
|
12105
12331
|
return void 0;
|
|
12106
12332
|
} else {
|
|
@@ -12135,7 +12361,7 @@ var transform = /* @__PURE__ */ __name(function(original_options = {}) {
|
|
|
12135
12361
|
};
|
|
12136
12362
|
}, "transform");
|
|
12137
12363
|
|
|
12138
|
-
// ../../node_modules/.pnpm/csv-parse@
|
|
12364
|
+
// ../../node_modules/.pnpm/csv-parse@6.1.0/node_modules/csv-parse/lib/sync.js
|
|
12139
12365
|
var parse = /* @__PURE__ */ __name(function(data, opts = {}) {
|
|
12140
12366
|
if (typeof data === "string") {
|
|
12141
12367
|
data = Buffer.from(data);
|
|
@@ -12143,18 +12369,15 @@ var parse = /* @__PURE__ */ __name(function(data, opts = {}) {
|
|
|
12143
12369
|
const records = opts && opts.objname ? {} : [];
|
|
12144
12370
|
const parser = transform(opts);
|
|
12145
12371
|
const push = /* @__PURE__ */ __name((record) => {
|
|
12146
|
-
if (parser.options.objname === void 0)
|
|
12147
|
-
records.push(record);
|
|
12372
|
+
if (parser.options.objname === void 0) records.push(record);
|
|
12148
12373
|
else {
|
|
12149
12374
|
records[record[0]] = record[1];
|
|
12150
12375
|
}
|
|
12151
12376
|
}, "push");
|
|
12152
12377
|
const close = /* @__PURE__ */ __name(() => {
|
|
12153
12378
|
}, "close");
|
|
12154
|
-
const
|
|
12155
|
-
if (
|
|
12156
|
-
const err2 = parser.parse(void 0, true, push, close);
|
|
12157
|
-
if (err2 !== void 0) throw err2;
|
|
12379
|
+
const error = parser.parse(data, true, push, close);
|
|
12380
|
+
if (error !== void 0) throw error;
|
|
12158
12381
|
return records;
|
|
12159
12382
|
}, "parse");
|
|
12160
12383
|
|
|
@@ -13821,4 +14044,4 @@ js-sha3/src/sha3.js:
|
|
|
13821
14044
|
* @license MIT
|
|
13822
14045
|
*)
|
|
13823
14046
|
*/
|
|
13824
|
-
//# sourceMappingURL=chunk-
|
|
14047
|
+
//# sourceMappingURL=chunk-BBAJWF26.js.map
|