@punks/backend-entity-manager 0.0.292 → 0.0.293
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 +17 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/errors.d.ts +6 -1
- package/dist/esm/index.js +17 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/errors.d.ts +6 -1
- package/dist/index.d.ts +6 -1
- package/package.json +1 -1
|
@@ -22,8 +22,13 @@ export declare class EntityOperationUnauthorizedException<TEntity> extends Entit
|
|
|
22
22
|
}
|
|
23
23
|
export declare class EntityNotFoundException<TEntityId> extends EntityManagerException {
|
|
24
24
|
private readonly entityId;
|
|
25
|
-
|
|
25
|
+
private readonly entityType;
|
|
26
|
+
constructor(entityData: {
|
|
27
|
+
id: TEntityId;
|
|
28
|
+
type: string;
|
|
29
|
+
});
|
|
26
30
|
getEntityId(): TEntityId | undefined;
|
|
31
|
+
getEntityType(): string | undefined;
|
|
27
32
|
}
|
|
28
33
|
export declare class MultipleEntitiesFoundException extends EntityManagerException {
|
|
29
34
|
constructor();
|
package/dist/esm/index.js
CHANGED
|
@@ -90,13 +90,19 @@ class EntityOperationUnauthorizedException extends EntityManagerUnauthorizedExce
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
class EntityNotFoundException extends EntityManagerException {
|
|
93
|
-
constructor(
|
|
94
|
-
super(
|
|
95
|
-
|
|
93
|
+
constructor(entityData) {
|
|
94
|
+
super(entityData
|
|
95
|
+
? `Entity ${entityData.type} with id ${entityData.id} not found`
|
|
96
|
+
: "Entity not found");
|
|
97
|
+
this.entityId = entityData.id;
|
|
98
|
+
this.entityType = entityData.type;
|
|
96
99
|
}
|
|
97
100
|
getEntityId() {
|
|
98
101
|
return this.entityId;
|
|
99
102
|
}
|
|
103
|
+
getEntityType() {
|
|
104
|
+
return this.entityType;
|
|
105
|
+
}
|
|
100
106
|
}
|
|
101
107
|
class MultipleEntitiesFoundException extends EntityManagerException {
|
|
102
108
|
constructor() {
|
|
@@ -672,7 +678,10 @@ class EntityDeleteCommand {
|
|
|
672
678
|
}
|
|
673
679
|
const entity = await this.services.resolveRepository().get(id);
|
|
674
680
|
if (entity == null) {
|
|
675
|
-
throw new EntityNotFoundException(
|
|
681
|
+
throw new EntityNotFoundException({
|
|
682
|
+
id,
|
|
683
|
+
type: this.services.getEntityName(),
|
|
684
|
+
});
|
|
676
685
|
}
|
|
677
686
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
678
687
|
const context = await contextService?.getContext();
|
|
@@ -897,7 +906,10 @@ class EntityUpdateCommand {
|
|
|
897
906
|
}
|
|
898
907
|
const currentEntity = await this.services.resolveRepository().get(id);
|
|
899
908
|
if (currentEntity == null) {
|
|
900
|
-
throw new EntityNotFoundException(
|
|
909
|
+
throw new EntityNotFoundException({
|
|
910
|
+
id,
|
|
911
|
+
type: this.services.getEntityName(),
|
|
912
|
+
});
|
|
901
913
|
}
|
|
902
914
|
const context = await this.getContext();
|
|
903
915
|
if (!context) {
|