@nu-art/ts-common 0.201.23 → 0.201.24
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/db/types.d.ts +1 -0
- package/modules/CSVModule.d.ts +9 -9
- package/modules/CSVModule.js +1 -1
- package/package.json +1 -1
package/db/types.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export type DBDef<T extends DB_Object, Ks extends keyof T = Default_UniqueKey> =
|
|
|
30
30
|
entityName: string;
|
|
31
31
|
lockKeys?: (keyof T)[];
|
|
32
32
|
uniqueKeys?: Ks[];
|
|
33
|
+
upgradeChunksSize?: number;
|
|
33
34
|
/**
|
|
34
35
|
* First item in the array is the latest version. Last item in the array is the oldest version.
|
|
35
36
|
*/
|
package/modules/CSVModule.d.ts
CHANGED
|
@@ -16,11 +16,11 @@ export type ReadOptions<T extends Partial<StringMap> = {}> = {
|
|
|
16
16
|
quote?: string;
|
|
17
17
|
headers?: string[];
|
|
18
18
|
};
|
|
19
|
-
export type ReadPropsMap<
|
|
20
|
-
[s: string]: keyof
|
|
19
|
+
export type ReadPropsMap<T extends TS_Object = TS_Object> = {
|
|
20
|
+
[s: string]: keyof T;
|
|
21
21
|
};
|
|
22
|
-
export type WritePropsMap<
|
|
23
|
-
[P in keyof
|
|
22
|
+
export type WritePropsMap<T extends TS_Object = TS_Object> = {
|
|
23
|
+
[P in keyof T]: string;
|
|
24
24
|
};
|
|
25
25
|
declare class CSVModule_Class extends Module<Config> {
|
|
26
26
|
private csvExporter;
|
|
@@ -30,11 +30,11 @@ declare class CSVModule_Class extends Module<Config> {
|
|
|
30
30
|
updateExporterSettings(options: Options): void;
|
|
31
31
|
export<T>(items: T[], returnCsv?: boolean): any;
|
|
32
32
|
saveToFile<T extends TS_Object>(outputFile: string, items: T[], columnsToProps?: WritePropsMap<T>): Promise<void>;
|
|
33
|
-
readCsvFromFile<T extends
|
|
34
|
-
readCsvFromBuffer<T extends
|
|
35
|
-
readCsvFromStream<T extends
|
|
36
|
-
forEachCsvRowFromStreamAsync<T extends
|
|
37
|
-
forEachCsvRowFromStreamSync<T extends
|
|
33
|
+
readCsvFromFile<T extends TS_Object>(inputFile: string, readOptions?: ReadOptions<T>): Promise<T[]>;
|
|
34
|
+
readCsvFromBuffer<T extends TS_Object>(buffer: Buffer, readOptions?: ReadOptions<T>): Promise<T[]>;
|
|
35
|
+
readCsvFromStream<T extends TS_Object>(stream: Readable, readOptions?: ReadOptions<T>): Promise<T[]>;
|
|
36
|
+
forEachCsvRowFromStreamAsync<T extends TS_Object>(stream: Readable, callback: (instance: T) => Promise<void>, readOptions?: ReadOptions, queueCount?: number): Promise<void>;
|
|
37
|
+
forEachCsvRowFromStreamSync<T extends TS_Object>(stream: Readable, callback: (instance: T, index: number) => void, readOptions?: ReadOptions): Promise<void>;
|
|
38
38
|
private createReadParserOptions;
|
|
39
39
|
}
|
|
40
40
|
export declare const CSVModule: CSVModule_Class;
|
package/modules/CSVModule.js
CHANGED
|
@@ -131,7 +131,7 @@ class CSVModule_Class extends module_1.Module {
|
|
|
131
131
|
return {
|
|
132
132
|
mapHeaders: (args) => {
|
|
133
133
|
var _a, _b;
|
|
134
|
-
return (_b = (_a = readOptions.columnsToProps) === null || _a === void 0 ? void 0 : _a[args.header]) !== null && _b !== void 0 ? _b : args.header;
|
|
134
|
+
return ((_b = (_a = readOptions.columnsToProps) === null || _a === void 0 ? void 0 : _a[args.header]) !== null && _b !== void 0 ? _b : args.header);
|
|
135
135
|
},
|
|
136
136
|
mapValues: (args) => {
|
|
137
137
|
var _a;
|