@datapos/datapos-tool-csv-parse 0.0.72 → 0.0.73
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.
|
@@ -3389,10 +3389,10 @@ class ri {
|
|
|
3389
3389
|
* Determine schema configuration.
|
|
3390
3390
|
*/
|
|
3391
3391
|
async determineSchemaConfig(e, r) {
|
|
3392
|
-
const n = Xn(e), {
|
|
3392
|
+
const n = Xn(e), { records: i, valueDelimiterId: o } = await Kn(e, r);
|
|
3393
3393
|
return {
|
|
3394
3394
|
recordDelimiterId: n,
|
|
3395
|
-
|
|
3395
|
+
records: i,
|
|
3396
3396
|
valueDelimiterId: o
|
|
3397
3397
|
};
|
|
3398
3398
|
}
|
|
@@ -3483,7 +3483,7 @@ async function Kn(t, e) {
|
|
|
3483
3483
|
});
|
|
3484
3484
|
} catch {
|
|
3485
3485
|
}
|
|
3486
|
-
return {
|
|
3486
|
+
return { records: o, valueDelimiterId: r ?? "," };
|
|
3487
3487
|
}
|
|
3488
3488
|
function ei(t) {
|
|
3489
3489
|
const e = Math.max(1, Math.floor(t.chunkSize)), r = [];
|
|
@@ -2,15 +2,15 @@ import { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
|
2
2
|
import { RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared';
|
|
3
3
|
import { RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Parse record and parsed record buffer.
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
type ParsedRecord = string[];
|
|
8
8
|
/**
|
|
9
9
|
* Schema configuration.
|
|
10
10
|
*/
|
|
11
11
|
interface SchemaConfig {
|
|
12
12
|
recordDelimiterId: RecordDelimiterId;
|
|
13
|
-
|
|
13
|
+
records: ParsedRecord[];
|
|
14
14
|
valueDelimiterId: ValueDelimiterId;
|
|
15
15
|
}
|
|
16
16
|
/** Tool. */
|
|
@@ -27,4 +27,4 @@ declare class Tool {
|
|
|
27
27
|
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records: (string[] | Record<string, unknown>)[]) => void): Promise<RetrieveRecordsSummary>;
|
|
28
28
|
}
|
|
29
29
|
export type { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
30
|
-
export { type
|
|
30
|
+
export { type ParsedRecord, type SchemaConfig, Tool };
|