@punks/backend-entity-manager 0.0.435 → 0.0.437
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 +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/serializer.d.ts +1 -0
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/serializer.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ export type EntitySerializerSheetCustomParser = "date";
|
|
|
32
32
|
export type EntitySerializerColumnModifier = "trim" | "lowercase" | "uppercase";
|
|
33
33
|
export type EntitySerializerColumnDefinition<TSheetItem> = {
|
|
34
34
|
name: string;
|
|
35
|
+
aliases?: string[];
|
|
35
36
|
key: string;
|
|
36
37
|
selector: keyof TSheetItem | ((item: TSheetItem) => any);
|
|
37
38
|
colSpan?: number;
|
package/dist/esm/index.js
CHANGED
|
@@ -274,11 +274,13 @@ class EntitySerializer {
|
|
|
274
274
|
}
|
|
275
275
|
const entity = (definition.autoColumns ? { ...record } : {});
|
|
276
276
|
for (const column of definition.columns) {
|
|
277
|
-
const columnName =
|
|
278
|
-
|
|
277
|
+
const columnName = [column.name, ...(column?.aliases ?? [])].find((x) => x in record) ?? "";
|
|
278
|
+
console.log("name", columnName);
|
|
279
|
+
console.log("record", entity);
|
|
280
|
+
if (!columnName)
|
|
279
281
|
continue;
|
|
280
282
|
if (column.parseAction) {
|
|
281
|
-
column.parseAction(record[columnName], entity);
|
|
283
|
+
column.parseAction(record[normalizeSheetColumn(columnName)], entity);
|
|
282
284
|
continue;
|
|
283
285
|
}
|
|
284
286
|
if (typeof column.selector === "function") {
|