@punks/backend-entity-manager 0.0.426 → 0.0.428
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/dist/cjs/index.js +2 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/serializer.d.ts +2 -0
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/serializer.d.ts +2 -0
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { ExcelParseOptions } from "@punks/backend-core";
|
|
2
3
|
export type EntryValidationError = {
|
|
3
4
|
errorCode: string;
|
|
4
5
|
value?: any;
|
|
@@ -52,6 +53,7 @@ export type EntitySerializerSheetOptions = {
|
|
|
52
53
|
export type EntitySerializerSheetDefinition<TSheetItem> = {
|
|
53
54
|
columns: EntitySerializerColumnDefinition<TSheetItem>[];
|
|
54
55
|
sheet?: EntitySerializerSheetOptions;
|
|
56
|
+
options?: ExcelParseOptions;
|
|
55
57
|
};
|
|
56
58
|
export type EntityExportFile = {
|
|
57
59
|
content: Buffer;
|
package/dist/esm/index.js
CHANGED
|
@@ -263,10 +263,9 @@ class EntitySerializer {
|
|
|
263
263
|
const records = excelParse(data, {
|
|
264
264
|
keysTransform: ExcelKeyTransform.Lower,
|
|
265
265
|
dateColumns: dateColumns.map((x) => x.name),
|
|
266
|
+
...(definition?.options ? definition.options : {}),
|
|
266
267
|
});
|
|
267
|
-
return
|
|
268
|
-
? records.map((x, i) => this.convertSheetRecord(x, definition, i))
|
|
269
|
-
: Object.values(records).flatMap((x, i) => this.convertSheetRecord(x, definition, i));
|
|
268
|
+
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
270
269
|
}
|
|
271
270
|
convertSheetRecord(record, definition, rowIndex) {
|
|
272
271
|
console.log("record", record);
|