@punks/backend-entity-manager 0.0.343 → 0.0.346
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 +18 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/converters.d.ts +4 -4
- package/dist/esm/index.js +19 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/converters.d.ts +4 -4
- package/dist/index.d.ts +4 -4
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -413,7 +413,7 @@ class EntityCreateAction {
|
|
|
413
413
|
if (!entity) {
|
|
414
414
|
throw new Error(`Newly created entity not found with id ${ref.id}`);
|
|
415
415
|
}
|
|
416
|
-
const result = converter?.toEntityDto(entity) ?? entity;
|
|
416
|
+
const result = (await converter?.toEntityDto(entity)) ?? entity;
|
|
417
417
|
this.logger.debug("Create action completed", { input, result });
|
|
418
418
|
return result;
|
|
419
419
|
}
|
|
@@ -481,7 +481,7 @@ class EntityGetAction {
|
|
|
481
481
|
const entity = await this.services.resolveGetQuery().execute(id);
|
|
482
482
|
const converter = this.services.resolveConverter();
|
|
483
483
|
return entity
|
|
484
|
-
? converter?.toEntityDto(entity) ?? entity
|
|
484
|
+
? (await converter?.toEntityDto(entity)) ?? entity
|
|
485
485
|
: undefined;
|
|
486
486
|
}
|
|
487
487
|
}
|
|
@@ -523,7 +523,7 @@ class EntitiesSearchAction {
|
|
|
523
523
|
const results = await searchQuery.execute(request);
|
|
524
524
|
const converter = this.services.resolveConverter();
|
|
525
525
|
return {
|
|
526
|
-
items: results.items
|
|
526
|
+
items: await backendCore.mapAsync(results.items, async (x) => ((await converter?.toListItemDto(x)) ?? x)),
|
|
527
527
|
paging: results.paging,
|
|
528
528
|
childrenMap: results.childrenMap,
|
|
529
529
|
facets: results.facets,
|
|
@@ -550,7 +550,7 @@ class EntityUpdateAction {
|
|
|
550
550
|
if (!entity) {
|
|
551
551
|
throw new Error(`Newly created entity not found with id ${id}`);
|
|
552
552
|
}
|
|
553
|
-
const result = converter?.toEntityDto(entity) ?? entity;
|
|
553
|
+
const result = (await converter?.toEntityDto(entity)) ?? entity;
|
|
554
554
|
this.logger.debug("Update action started", { id, input, result });
|
|
555
555
|
return result;
|
|
556
556
|
}
|
|
@@ -582,7 +582,7 @@ class EntityUpsertAction {
|
|
|
582
582
|
if (!entity) {
|
|
583
583
|
throw new Error(`Newly created entity not found with id ${id}`);
|
|
584
584
|
}
|
|
585
|
-
const result = converter?.toEntityDto(entity) ?? entity;
|
|
585
|
+
const result = (await converter?.toEntityDto(entity)) ?? entity;
|
|
586
586
|
this.logger.debug("Upsert action started", { id, input, result });
|
|
587
587
|
return result;
|
|
588
588
|
}
|
|
@@ -4236,6 +4236,19 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
4236
4236
|
return false;
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
4239
|
+
const isForAllAuthenticated = this.getIsForAllAuthenticated(context);
|
|
4240
|
+
if (isForAllAuthenticated) {
|
|
4241
|
+
const isAuthenticated = !!auth?.user;
|
|
4242
|
+
this.logger.debug(`Authorized:${isAuthenticated} -> authentication guard`, {
|
|
4243
|
+
...this.getContextInfo({
|
|
4244
|
+
context,
|
|
4245
|
+
roles: auth?.roles,
|
|
4246
|
+
user: auth?.user,
|
|
4247
|
+
permissions: auth?.permissions,
|
|
4248
|
+
}),
|
|
4249
|
+
});
|
|
4250
|
+
return isAuthenticated;
|
|
4251
|
+
}
|
|
4239
4252
|
const allowedRoles = this.getAllowedRoles(context);
|
|
4240
4253
|
if (allowedRoles) {
|
|
4241
4254
|
const isAllowed = this.isRoleMatching(allowedRoles, auth?.roles ?? []);
|
|
@@ -4268,19 +4281,6 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
4268
4281
|
return false;
|
|
4269
4282
|
}
|
|
4270
4283
|
}
|
|
4271
|
-
const isForAllAuthenticated = this.getIsForAllAuthenticated(context);
|
|
4272
|
-
if (isForAllAuthenticated) {
|
|
4273
|
-
const isAuthenticated = !!auth?.user;
|
|
4274
|
-
this.logger.debug(`Authorized:${isAuthenticated} -> authentication guard`, {
|
|
4275
|
-
...this.getContextInfo({
|
|
4276
|
-
context,
|
|
4277
|
-
roles: auth?.roles,
|
|
4278
|
-
user: auth?.user,
|
|
4279
|
-
permissions: auth?.permissions,
|
|
4280
|
-
}),
|
|
4281
|
-
});
|
|
4282
|
-
return isAuthenticated;
|
|
4283
|
-
}
|
|
4284
4284
|
const isAuthenticated = !!auth?.user;
|
|
4285
4285
|
this.logger.debug(`Authorized:${isAuthenticated} -> auth guard`, {
|
|
4286
4286
|
...this.getContextInfo({
|