@punks/backend-entity-manager 0.0.115 → 0.0.117

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.
@@ -1,4 +1,5 @@
1
1
  import { InstanceInitializeTemplate } from "./instance-initialize";
2
2
  import { OrganizationRegisterTemplate } from "./organization-register";
3
3
  import { TenantInitializeTemplate } from "./tenant-initialize";
4
- export declare const SetupTemplates: (typeof InstanceInitializeTemplate | typeof OrganizationRegisterTemplate | typeof TenantInitializeTemplate)[];
4
+ import { UserUpdateTemplate } from "./user-update";
5
+ export declare const SetupTemplates: (typeof InstanceInitializeTemplate | typeof OrganizationRegisterTemplate | typeof TenantInitializeTemplate | typeof UserUpdateTemplate)[];
@@ -1,13 +1,15 @@
1
1
  import { PipelineDefinition } from "../../../../../../../../types";
2
2
  import { AuthenticationService } from "../../../../../../extensions";
3
3
  import { IPipelineTemplateBuilder, NestPipelineTemplate } from "../../../../../../pipelines";
4
+ import { AppUserProfileEntityManager } from "../../../../entities/appUserProfiles/appUserProfile.manager";
4
5
  import { AppUserEntityManager } from "../../../../entities/appUsers/appUser.manager";
5
6
  import { AppAuthContext } from "../../../../infrastructure/authentication";
6
7
  import { UserUpdatePipelineInput } from "./models";
7
8
  export declare class UserUpdateTemplate extends NestPipelineTemplate<UserUpdatePipelineInput, void, AppAuthContext> {
8
9
  private readonly auth;
9
10
  private readonly users;
10
- constructor(auth: AuthenticationService, users: AppUserEntityManager);
11
+ private readonly userProfiles;
12
+ constructor(auth: AuthenticationService, users: AppUserEntityManager, userProfiles: AppUserProfileEntityManager);
11
13
  protected isAuthorized(context: AppAuthContext): boolean;
12
14
  protected buildTemplate(builder: IPipelineTemplateBuilder<UserUpdatePipelineInput, AppAuthContext>): PipelineDefinition<UserUpdatePipelineInput, void, AppAuthContext>;
13
15
  }
@@ -20,5 +20,5 @@ export type AppRole = {
20
20
  name: string;
21
21
  };
22
22
  export type RolesGuardOptions = {
23
- inheritRoles?: boolean;
23
+ exact?: boolean;
24
24
  };
package/dist/esm/index.js CHANGED
@@ -2363,7 +2363,7 @@ 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, inheritedRoles, }, options) => Roles(mainRole.uid, ...(options?.inheritRoles && inheritedRoles
2366
+ const buildRolesGuard = ({ mainRole, inheritedRoles, }, options) => Roles(mainRole.uid, ...(!options?.exact && inheritedRoles
2367
2367
  ? inheritedRoles.map((role) => role.uid)
2368
2368
  : []));
2369
2369
 
@@ -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
  : {}),
@@ -22019,6 +22015,11 @@ class TypeOrmRepository {
22019
22015
  throw new Error("Invalid 'id' parameter.");
22020
22016
  }
22021
22017
  this.logger.debug("Updating entity", { id, entity });
22018
+ // await this.innerRepository.preload(id as any)
22019
+ // await this.innerRepository.save({
22020
+ // id,
22021
+ // ...entity,
22022
+ // } as unknown as TEntity)
22022
22023
  await this.innerRepository.update(id, entity);
22023
22024
  const current = await this.get(id);
22024
22025
  if (!current) {