@punks/backend-entity-manager 0.0.116 → 0.0.118
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 +6 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +2 -2
- package/dist/esm/index.js +6 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ export declare const Public: () => import("@nestjs/common").CustomDecorator<stri
|
|
|
3
3
|
export declare const Authenticated: () => import("@nestjs/common").CustomDecorator<string>;
|
|
4
4
|
export declare const Roles: (...roles: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
5
5
|
export declare const MemberOf: (...groups: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
6
|
-
export declare const buildRolesGuard: ({ mainRole,
|
|
6
|
+
export declare const buildRolesGuard: ({ mainRole, secondaryRoles, }: {
|
|
7
7
|
mainRole: AppRole;
|
|
8
|
-
|
|
8
|
+
secondaryRoles?: AppRole[] | undefined;
|
|
9
9
|
}, options?: RolesGuardOptions) => import("@nestjs/common").CustomDecorator<string>;
|
package/dist/esm/index.js
CHANGED
|
@@ -2363,8 +2363,8 @@ const Public = () => SetMetadata(AuthenticationGuardsSymbols.Public, true);
|
|
|
2363
2363
|
const Authenticated = () => SetMetadata(AuthenticationGuardsSymbols.Authenticated, true);
|
|
2364
2364
|
const Roles = (...roles) => SetMetadata(AuthenticationGuardsSymbols.Roles, roles);
|
|
2365
2365
|
const MemberOf = (...groups) => SetMetadata(AuthenticationGuardsSymbols.MemberOf, groups);
|
|
2366
|
-
const buildRolesGuard = ({ mainRole,
|
|
2367
|
-
?
|
|
2366
|
+
const buildRolesGuard = ({ mainRole, secondaryRoles, }, options) => Roles(mainRole.uid, ...(!options?.exact && secondaryRoles
|
|
2367
|
+
? secondaryRoles.map((role) => role.uid)
|
|
2368
2368
|
: []));
|
|
2369
2369
|
|
|
2370
2370
|
const WpRolesService = () => applyDecorators(Injectable(), SetMetadata(AuthenticationExtensionSymbols.RolesService, true));
|
|
@@ -2496,11 +2496,7 @@ let AuthGuard = AuthGuard_1 = class AuthGuard {
|
|
|
2496
2496
|
id: user.id,
|
|
2497
2497
|
userName: user.userName,
|
|
2498
2498
|
email: user.email,
|
|
2499
|
-
roles: roles?.map((role) =>
|
|
2500
|
-
id: role.id,
|
|
2501
|
-
name: role.name,
|
|
2502
|
-
uid: role.uid,
|
|
2503
|
-
})),
|
|
2499
|
+
roles: roles?.map((role) => role.uid),
|
|
2504
2500
|
},
|
|
2505
2501
|
}
|
|
2506
2502
|
: {}),
|
|
@@ -21170,7 +21166,9 @@ let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerI
|
|
|
21170
21166
|
const adapterDict = toDict(adapters, (a) => a.meta.entityName);
|
|
21171
21167
|
const authDict = toDict(auth, (a) => a.meta.entityName);
|
|
21172
21168
|
const sortedEntities = lodash.exports.orderBy(entities, (x) => x.meta.name);
|
|
21173
|
-
this.logger.log(`Discovered entities: \n${sortedEntities
|
|
21169
|
+
this.logger.log(`Discovered entities: \n${sortedEntities
|
|
21170
|
+
.map((x) => x.discoveredClass.name)
|
|
21171
|
+
.join(" \n")}`);
|
|
21174
21172
|
for (const entity of sortedEntities) {
|
|
21175
21173
|
const entityName = entity.meta.name;
|
|
21176
21174
|
const repository = repositoriesDict[entityName];
|