@punks/backend-entity-manager 0.0.441 → 0.0.444
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 +8 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/actions.d.ts +2 -2
- package/dist/cjs/types/abstractions/serializer.d.ts +1 -1
- package/dist/cjs/types/base/serializer.d.ts +2 -2
- package/dist/cjs/types/commands/import.d.ts +1 -1
- package/dist/esm/index.js +8 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/actions.d.ts +2 -2
- package/dist/esm/types/abstractions/serializer.d.ts +1 -1
- package/dist/esm/types/base/serializer.d.ts +2 -2
- package/dist/esm/types/commands/import.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -257,9 +257,9 @@ class EntitySerializer {
|
|
|
257
257
|
}
|
|
258
258
|
this.logger.info(`Entities import -> completed (${items.length} items)`);
|
|
259
259
|
}
|
|
260
|
-
async parse(data, format) {
|
|
260
|
+
async parse(data, format, payload) {
|
|
261
261
|
const context = await this.getContext();
|
|
262
|
-
const definition = await this.getDefinition(context);
|
|
262
|
+
const definition = await this.getDefinition(context, payload);
|
|
263
263
|
switch (format) {
|
|
264
264
|
case exports.EntitySerializationFormat.Csv:
|
|
265
265
|
return this.parseCsv(data, definition);
|
|
@@ -280,7 +280,6 @@ class EntitySerializer {
|
|
|
280
280
|
dateColumns: dateColumns.map((x) => x.name),
|
|
281
281
|
...(definition?.options ? definition.options : {}),
|
|
282
282
|
});
|
|
283
|
-
console.log("records", records);
|
|
284
283
|
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
285
284
|
}
|
|
286
285
|
convertSheetRecord(record, definition, rowIndex) {
|
|
@@ -966,7 +965,7 @@ class EntitiesImportCommand {
|
|
|
966
965
|
contentType: input.file.contentType,
|
|
967
966
|
fileName: input.file.fileName,
|
|
968
967
|
});
|
|
969
|
-
const importEntities = await this.parseImportFile(input.file.content, input.format);
|
|
968
|
+
const importEntities = await this.parseImportFile(input.file.content, input.format, input?.payload);
|
|
970
969
|
const validEntities = importEntities.filter((x) => x.status.isValid);
|
|
971
970
|
const invalidEntities = importEntities.filter((x) => !x.status.isValid);
|
|
972
971
|
if (invalidEntities.length > 0 &&
|
|
@@ -975,7 +974,7 @@ class EntitiesImportCommand {
|
|
|
975
974
|
.map((x) => x.id)
|
|
976
975
|
.join(", ")}`);
|
|
977
976
|
}
|
|
978
|
-
await this.services.resolveSerializer().import(validEntities.map((x) => x.item), input
|
|
977
|
+
await this.services.resolveSerializer().import(validEntities.map((x) => x.item), input?.payload);
|
|
979
978
|
return {
|
|
980
979
|
statistics: {
|
|
981
980
|
importedCount: validEntities.length,
|
|
@@ -986,8 +985,10 @@ class EntitiesImportCommand {
|
|
|
986
985
|
},
|
|
987
986
|
};
|
|
988
987
|
}
|
|
989
|
-
async parseImportFile(content, format) {
|
|
990
|
-
return await this.services
|
|
988
|
+
async parseImportFile(content, format, payload) {
|
|
989
|
+
return await this.services
|
|
990
|
+
.resolveSerializer()
|
|
991
|
+
.parse(content, format, payload);
|
|
991
992
|
}
|
|
992
993
|
async uploadImportFile(file) {
|
|
993
994
|
await this.bucket.fileUpload({
|