@punks/backend-entity-manager 0.0.181 → 0.0.183
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 +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +4 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/index.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/types/index.d.ts +4 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +4 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/index.d.ts +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/types/index.d.ts +4 -0
- package/dist/index.d.ts +9 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2532,11 +2532,13 @@ const AuthenticationGuardsSymbols = {
|
|
|
2532
2532
|
|
|
2533
2533
|
const Public = () => common.SetMetadata(AuthenticationGuardsSymbols.Public, true);
|
|
2534
2534
|
const Authenticated = () => common.SetMetadata(AuthenticationGuardsSymbols.Authenticated, true);
|
|
2535
|
+
const Permissions = (...permissions) => common.SetMetadata(AuthenticationGuardsSymbols.Permissions, permissions);
|
|
2535
2536
|
const Roles = (...roles) => common.SetMetadata(AuthenticationGuardsSymbols.Roles, roles);
|
|
2536
2537
|
const MemberOf = (...groups) => common.SetMetadata(AuthenticationGuardsSymbols.MemberOf, groups);
|
|
2537
2538
|
const buildRolesGuard = ({ mainRole, secondaryRoles, }, options) => Roles(mainRole.uid, ...(!options?.exact && secondaryRoles
|
|
2538
2539
|
? secondaryRoles.map((role) => role.uid)
|
|
2539
2540
|
: []));
|
|
2541
|
+
const buildPermissionsGuard = ({ permissions, }) => Permissions(...permissions.map((x) => x.uid));
|
|
2540
2542
|
|
|
2541
2543
|
const WpPermissionsService = () => common.applyDecorators(common.Injectable(), common.SetMetadata(AuthenticationExtensionSymbols.PermissionsService, true));
|
|
2542
2544
|
|
|
@@ -2644,7 +2646,7 @@ exports.AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
2644
2646
|
}
|
|
2645
2647
|
const allowedPermissions = this.getAllowedPermissions(context);
|
|
2646
2648
|
if (allowedPermissions) {
|
|
2647
|
-
const isAllowed = this.isPermissionMatching(allowedPermissions, auth?.
|
|
2649
|
+
const isAllowed = this.isPermissionMatching(allowedPermissions, auth?.permissions ?? []);
|
|
2648
2650
|
this.logger.debug(`Authorized:${isAllowed} -> authorization permission guard`, {
|
|
2649
2651
|
...this.getContextInfo({
|
|
2650
2652
|
context,
|
|
@@ -28442,6 +28444,7 @@ exports.NestTypeOrmQueryBuilder = NestTypeOrmQueryBuilder;
|
|
|
28442
28444
|
exports.NestTypeOrmRepository = NestTypeOrmRepository;
|
|
28443
28445
|
exports.OperationTokenMismatchError = OperationTokenMismatchError;
|
|
28444
28446
|
exports.PLATFORM_EVENT_NAMESPACE = PLATFORM_EVENT_NAMESPACE;
|
|
28447
|
+
exports.Permissions = Permissions;
|
|
28445
28448
|
exports.PipelineController = PipelineController;
|
|
28446
28449
|
exports.PipelineInvocationError = PipelineInvocationError;
|
|
28447
28450
|
exports.PlatformEvents = PlatformEvents;
|
|
@@ -28477,6 +28480,7 @@ exports.WpRolesService = WpRolesService;
|
|
|
28477
28480
|
exports.WpSendgridEmailTemplate = WpSendgridEmailTemplate;
|
|
28478
28481
|
exports.WpUserRolesService = WpUserRolesService;
|
|
28479
28482
|
exports.WpUserService = WpUserService;
|
|
28483
|
+
exports.buildPermissionsGuard = buildPermissionsGuard;
|
|
28480
28484
|
exports.buildRolesGuard = buildRolesGuard;
|
|
28481
28485
|
exports.createContainer = createContainer;
|
|
28482
28486
|
exports.createExpressFileResponse = createExpressFileResponse;
|