@punks/backend-entity-manager 0.0.435 → 0.0.436
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 +3 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/serializer.d.ts +1 -0
- package/dist/esm/index.js +3 -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,11 @@ class EntitySerializer {
|
|
|
274
274
|
}
|
|
275
275
|
const entity = (definition.autoColumns ? { ...record } : {});
|
|
276
276
|
for (const column of definition.columns) {
|
|
277
|
-
const columnName =
|
|
278
|
-
if (!
|
|
277
|
+
const columnName = [column.name, ...(column?.aliases ?? [])].find((x) => x in record) ?? "";
|
|
278
|
+
if (!columnName)
|
|
279
279
|
continue;
|
|
280
280
|
if (column.parseAction) {
|
|
281
|
-
column.parseAction(record[columnName], entity);
|
|
281
|
+
column.parseAction(record[normalizeSheetColumn(columnName)], entity);
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
284
|
if (typeof column.selector === "function") {
|