@punks/backend-entity-manager 0.0.356 → 0.0.358
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 +36 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/email.d.ts +10 -0
- package/dist/cjs/types/abstractions/serializer.d.ts +14 -2
- package/dist/cjs/types/base/serializer.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/models/parsing.d.ts +5 -0
- package/dist/cjs/types/utils/validators.d.ts +2 -2
- package/dist/esm/index.js +36 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/email.d.ts +10 -0
- package/dist/esm/types/abstractions/serializer.d.ts +14 -2
- package/dist/esm/types/base/serializer.d.ts +1 -0
- package/dist/esm/types/platforms/nest/models/parsing.d.ts +5 -0
- package/dist/esm/types/utils/validators.d.ts +2 -2
- package/dist/index.d.ts +31 -4
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -242,10 +242,12 @@ class EntitySerializer {
|
|
|
242
242
|
for (const column of definition.columns) {
|
|
243
243
|
if (column.parseAction) {
|
|
244
244
|
column.parseAction(record[column.name], entity);
|
|
245
|
+
continue;
|
|
245
246
|
}
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
if (typeof column.selector === "function") {
|
|
248
|
+
throw new Error("Function selectors are not supported with parseAction specified");
|
|
248
249
|
}
|
|
250
|
+
entity[column.selector] = this.parseColumnValue(record, column);
|
|
249
251
|
}
|
|
250
252
|
const validationErrors = [];
|
|
251
253
|
for (const column of definition.columns) {
|
|
@@ -254,13 +256,19 @@ class EntitySerializer {
|
|
|
254
256
|
if (!result.isValid) {
|
|
255
257
|
validationErrors.push({
|
|
256
258
|
errorCode: validator.key,
|
|
259
|
+
column: {
|
|
260
|
+
name: column.name,
|
|
261
|
+
key: column.key,
|
|
262
|
+
},
|
|
257
263
|
});
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
266
|
}
|
|
261
267
|
const idField = definition.columns.find((x) => x.idColumn || x.selector === "id");
|
|
262
268
|
return {
|
|
263
|
-
id: idField
|
|
269
|
+
id: idField
|
|
270
|
+
? this.selectColumnValue(entity, idField.selector)
|
|
271
|
+
: undefined,
|
|
264
272
|
item: entity,
|
|
265
273
|
rowIndex,
|
|
266
274
|
status: {
|
|
@@ -400,11 +408,14 @@ class EntitySerializer {
|
|
|
400
408
|
}
|
|
401
409
|
}
|
|
402
410
|
getColumnValue(item, definition) {
|
|
403
|
-
const rawValue = item
|
|
411
|
+
const rawValue = this.selectColumnValue(item, definition.selector);
|
|
404
412
|
return definition.converter
|
|
405
413
|
? definition.converter(rawValue, item)
|
|
406
414
|
: rawValue;
|
|
407
415
|
}
|
|
416
|
+
selectColumnValue(item, selector) {
|
|
417
|
+
return typeof selector === "function" ? selector(item) : item[selector];
|
|
418
|
+
}
|
|
408
419
|
buildExportFileName(input) {
|
|
409
420
|
return `${input.refDate.toISOString().replaceAll(":", "_")}_${this.entityName}.${input.format}`;
|
|
410
421
|
}
|
|
@@ -34846,12 +34857,26 @@ class AppExceptionsFilterBase {
|
|
|
34846
34857
|
}
|
|
34847
34858
|
}
|
|
34848
34859
|
|
|
34860
|
+
class EntityParseValidationColumn {
|
|
34861
|
+
}
|
|
34862
|
+
__decorate([
|
|
34863
|
+
swagger.ApiProperty(),
|
|
34864
|
+
__metadata("design:type", String)
|
|
34865
|
+
], EntityParseValidationColumn.prototype, "name", void 0);
|
|
34866
|
+
__decorate([
|
|
34867
|
+
swagger.ApiProperty(),
|
|
34868
|
+
__metadata("design:type", String)
|
|
34869
|
+
], EntityParseValidationColumn.prototype, "key", void 0);
|
|
34849
34870
|
class EntityParseValidationError {
|
|
34850
34871
|
}
|
|
34851
34872
|
__decorate([
|
|
34852
34873
|
swagger.ApiProperty(),
|
|
34853
34874
|
__metadata("design:type", String)
|
|
34854
34875
|
], EntityParseValidationError.prototype, "errorCode", void 0);
|
|
34876
|
+
__decorate([
|
|
34877
|
+
swagger.ApiProperty(),
|
|
34878
|
+
__metadata("design:type", EntityParseValidationColumn)
|
|
34879
|
+
], EntityParseValidationError.prototype, "column", void 0);
|
|
34855
34880
|
class EntityParseStatus {
|
|
34856
34881
|
}
|
|
34857
34882
|
__decorate([
|
|
@@ -40375,6 +40400,7 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
|
|
|
40375
40400
|
bcc: input.bcc ?? templateData.bcc,
|
|
40376
40401
|
cc: input.cc ?? templateData.cc,
|
|
40377
40402
|
from: input.from ?? templateData.from,
|
|
40403
|
+
attachments: input.attachments,
|
|
40378
40404
|
});
|
|
40379
40405
|
}
|
|
40380
40406
|
async sendHtmlEmail(input) {
|
|
@@ -40501,6 +40527,12 @@ let SendgridEmailProvider = class SendgridEmailProvider {
|
|
|
40501
40527
|
...processedPayload,
|
|
40502
40528
|
},
|
|
40503
40529
|
templateId: templateData.sendgridTemplateId,
|
|
40530
|
+
attachments: input.attachments?.map((attachment) => ({
|
|
40531
|
+
...attachment,
|
|
40532
|
+
content: attachment.content instanceof Buffer
|
|
40533
|
+
? attachment.content.toString("utf-8")
|
|
40534
|
+
: attachment.content,
|
|
40535
|
+
})),
|
|
40504
40536
|
});
|
|
40505
40537
|
if (sendgridSettings.value.loggingEnabled) {
|
|
40506
40538
|
this.logger.info("Sending templated email", {
|