@punks/backend-entity-manager 0.0.469 → 0.0.471
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 +22 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/errors.d.ts +1 -1
- package/dist/cjs/types/abstractions/pipelines.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/decorators/pipelines.d.ts +9 -0
- package/dist/cjs/types/platforms/nest/pipelines/template/template.d.ts +6 -1
- package/dist/esm/index.js +22 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/errors.d.ts +1 -1
- package/dist/esm/types/abstractions/pipelines.d.ts +1 -0
- package/dist/esm/types/platforms/nest/decorators/pipelines.d.ts +9 -0
- package/dist/esm/types/platforms/nest/pipelines/template/template.d.ts +6 -1
- package/dist/index.d.ts +15 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -124,8 +124,10 @@ class EntityNotFoundException extends EntityManagerException {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
class MultipleEntitiesFoundException extends EntityManagerException {
|
|
127
|
-
constructor() {
|
|
128
|
-
super(
|
|
127
|
+
constructor(params, items) {
|
|
128
|
+
super(`Multiple entities found: ${items
|
|
129
|
+
.map((item) => item.id)
|
|
130
|
+
.join(", ")} - params: ${JSON.stringify(params)}`);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
class EntityManagerConfigurationError extends EntityManagerException {
|
|
@@ -1263,7 +1265,7 @@ class EntitiesUpsertByCommand {
|
|
|
1263
1265
|
};
|
|
1264
1266
|
}
|
|
1265
1267
|
if (items.length > 1) {
|
|
1266
|
-
throw new
|
|
1268
|
+
throw new MultipleEntitiesFoundException(params, items);
|
|
1267
1269
|
}
|
|
1268
1270
|
// todo: parametrize id field
|
|
1269
1271
|
const id = items[0].id;
|
|
@@ -35594,7 +35596,7 @@ class NestPipelineTemplate {
|
|
|
35594
35596
|
return result.output;
|
|
35595
35597
|
}
|
|
35596
35598
|
async execute(data) {
|
|
35597
|
-
if (this.
|
|
35599
|
+
if (this.concurrency === "sequential") {
|
|
35598
35600
|
return await this.operationsLockService.executeSequential({
|
|
35599
35601
|
lockUid: this.getConcurrencyKey(data.input),
|
|
35600
35602
|
operation: async () => {
|
|
@@ -35602,7 +35604,7 @@ class NestPipelineTemplate {
|
|
|
35602
35604
|
},
|
|
35603
35605
|
});
|
|
35604
35606
|
}
|
|
35605
|
-
if (this.
|
|
35607
|
+
if (this.concurrency === "exclusive") {
|
|
35606
35608
|
const result = await this.operationsLockService.executeExclusive({
|
|
35607
35609
|
lockUid: this.getConcurrencyKey(data.input),
|
|
35608
35610
|
operation: async () => {
|
|
@@ -35620,9 +35622,9 @@ class NestPipelineTemplate {
|
|
|
35620
35622
|
context: data.context,
|
|
35621
35623
|
instanceId,
|
|
35622
35624
|
};
|
|
35623
|
-
this.logger.debug(`[START] | ${this.metadata.name}`, logMetadata);
|
|
35625
|
+
this.logger.debug(`[START] | ${this.metadata.name}`, this.processLogMetadata(logMetadata));
|
|
35624
35626
|
if (!this.isAuthorized(data.context)) {
|
|
35625
|
-
this.logger.debug(`[ERROR] | ${this.metadata.name} -> Unauthorized`, logMetadata);
|
|
35627
|
+
this.logger.debug(`[ERROR] | ${this.metadata.name} -> Unauthorized`, this.processLogMetadata(logMetadata));
|
|
35626
35628
|
return {
|
|
35627
35629
|
type: "error",
|
|
35628
35630
|
errorType: exports.PipelineErrorType.Unauthorized,
|
|
@@ -35635,19 +35637,25 @@ class NestPipelineTemplate {
|
|
|
35635
35637
|
if (result.type === "error") {
|
|
35636
35638
|
this.logger.error(`[ERROR] | ${this.metadata.name} -> ${result.exception
|
|
35637
35639
|
? `exception: ${result.exception.name}\n${result.exception.stack}`
|
|
35638
|
-
: ""}`, {
|
|
35640
|
+
: ""}`, this.processLogMetadata({
|
|
35639
35641
|
...logMetadata,
|
|
35640
35642
|
result,
|
|
35641
|
-
});
|
|
35643
|
+
}));
|
|
35642
35644
|
}
|
|
35643
35645
|
else {
|
|
35644
|
-
this.logger.debug(`[COMPLETED] | ${this.metadata.name}`, {
|
|
35646
|
+
this.logger.debug(`[COMPLETED] | ${this.metadata.name}`, this.processLogMetadata({
|
|
35645
35647
|
...logMetadata,
|
|
35646
35648
|
result,
|
|
35647
|
-
});
|
|
35649
|
+
}));
|
|
35648
35650
|
}
|
|
35649
35651
|
return result;
|
|
35650
35652
|
}
|
|
35653
|
+
processLogMetadata(meta) {
|
|
35654
|
+
if (this.metadata.options?.logging?.ignoreMeta) {
|
|
35655
|
+
return undefined;
|
|
35656
|
+
}
|
|
35657
|
+
return meta;
|
|
35658
|
+
}
|
|
35651
35659
|
getDefinition() {
|
|
35652
35660
|
if (!this.cachedDefinition) {
|
|
35653
35661
|
this.cachedDefinition = this.buildDefinition();
|
|
@@ -35664,6 +35672,9 @@ class NestPipelineTemplate {
|
|
|
35664
35672
|
.resolveAuthenticationContextProvider();
|
|
35665
35673
|
return (await contextService?.getContext());
|
|
35666
35674
|
}
|
|
35675
|
+
get concurrency() {
|
|
35676
|
+
return this.options?.concurrency ?? this.metadata.concurrency;
|
|
35677
|
+
}
|
|
35667
35678
|
get operationsLockService() {
|
|
35668
35679
|
return this.registry
|
|
35669
35680
|
.getContainer()
|
|
@@ -41318,9 +41329,6 @@ let SendgridEmailProvider = class SendgridEmailProvider {
|
|
|
41318
41329
|
: {}),
|
|
41319
41330
|
...(options?.forceDelivery || sendgridSettings.value.forceDelivery
|
|
41320
41331
|
? {
|
|
41321
|
-
bypassListManagement: {
|
|
41322
|
-
enable: true,
|
|
41323
|
-
},
|
|
41324
41332
|
bypassBounceManagement: {
|
|
41325
41333
|
enable: true,
|
|
41326
41334
|
},
|
|
@@ -41392,9 +41400,6 @@ let SendgridEmailProvider = class SendgridEmailProvider {
|
|
|
41392
41400
|
: {}),
|
|
41393
41401
|
...(options?.forceDelivery || sendgridSettings.value.forceDelivery
|
|
41394
41402
|
? {
|
|
41395
|
-
// bypassListManagement: {
|
|
41396
|
-
// enable: true,
|
|
41397
|
-
// },
|
|
41398
41403
|
bypassBounceManagement: {
|
|
41399
41404
|
enable: true,
|
|
41400
41405
|
},
|