@punks/backend-entity-manager 0.0.388 → 0.0.390
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 +12 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/serializer.d.ts +1 -0
- package/dist/cjs/types/base/serializer.d.ts +0 -1
- package/dist/esm/index.js +12 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/serializer.d.ts +1 -0
- package/dist/esm/types/base/serializer.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -254,7 +254,7 @@ class EntitySerializer {
|
|
|
254
254
|
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
255
255
|
}
|
|
256
256
|
convertSheetRecord(record, definition, rowIndex) {
|
|
257
|
-
if (
|
|
257
|
+
if (definition.sheet?.useTypeColumn &&
|
|
258
258
|
(!record._type || record._type !== this.entityName)) {
|
|
259
259
|
throw new Error(`Invalid record type ${record._type} -> record: \n${JSON.stringify(record)}`);
|
|
260
260
|
}
|
|
@@ -325,7 +325,7 @@ class EntitySerializer {
|
|
|
325
325
|
fileName,
|
|
326
326
|
contentType: "text/csv",
|
|
327
327
|
content: Buffer.from(backendCore.csvBuild([{}], [
|
|
328
|
-
...(
|
|
328
|
+
...(definition.sheet?.useTypeColumn
|
|
329
329
|
? [
|
|
330
330
|
{
|
|
331
331
|
name: "_type",
|
|
@@ -349,7 +349,7 @@ class EntitySerializer {
|
|
|
349
349
|
data: [{}],
|
|
350
350
|
sheetName: definition?.sheet?.name ?? this.entityName,
|
|
351
351
|
columns: [
|
|
352
|
-
...(
|
|
352
|
+
...(definition.sheet?.useTypeColumn
|
|
353
353
|
? [
|
|
354
354
|
{
|
|
355
355
|
header: "_type",
|
|
@@ -391,7 +391,7 @@ class EntitySerializer {
|
|
|
391
391
|
fileName,
|
|
392
392
|
contentType: "text/csv",
|
|
393
393
|
content: Buffer.from(backendCore.csvBuild(data, [
|
|
394
|
-
...(
|
|
394
|
+
...(definition.sheet?.useTypeColumn
|
|
395
395
|
? [
|
|
396
396
|
{
|
|
397
397
|
name: "_type",
|
|
@@ -420,10 +420,14 @@ class EntitySerializer {
|
|
|
420
420
|
data,
|
|
421
421
|
sheetName: this.entityName,
|
|
422
422
|
columns: [
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
423
|
+
...(definition.sheet?.useTypeColumn
|
|
424
|
+
? [
|
|
425
|
+
{
|
|
426
|
+
header: "_type",
|
|
427
|
+
value: () => this.entityName,
|
|
428
|
+
},
|
|
429
|
+
]
|
|
430
|
+
: []),
|
|
427
431
|
...definition.columns.map((c) => ({
|
|
428
432
|
header: c.name,
|
|
429
433
|
value: (item) => {
|