@punks/backend-entity-manager 0.0.114 → 0.0.116
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 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/authentication.d.ts +0 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/{setup/setup.controller.d.ts → appAdmin/appAdmin.controller.d.ts} +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/appAdmin/appAdmin.module.d.ts +2 -0
- package/dist/{esm/types/platforms/nest/__test__/server/app/setup → cjs/types/platforms/nest/__test__/server/app/appAdmin}/templates/index.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/index.d.ts +15 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/models.d.ts +12 -0
- package/dist/cjs/types/platforms/nest/__test__/server/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/__test__/server/testing/authentication/index.d.ts +10 -0
- package/dist/cjs/types/platforms/nest/__test__/server/testing/authentication/types.d.ts +8 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/types/index.d.ts +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/authentication.d.ts +0 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/{setup/setup.controller.d.ts → appAdmin/appAdmin.controller.d.ts} +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/appAdmin/appAdmin.module.d.ts +2 -0
- package/dist/{cjs/types/platforms/nest/__test__/server/app/setup → esm/types/platforms/nest/__test__/server/app/appAdmin}/templates/index.d.ts +2 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/appAdmin/templates/tenant-initialize/tenant-initialize.pipeline.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/index.d.ts +15 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/models.d.ts +12 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/user-update.pipeline.spec.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts +4 -0
- package/dist/esm/types/platforms/nest/__test__/server/testing/authentication/index.d.ts +10 -0
- package/dist/esm/types/platforms/nest/__test__/server/testing/authentication/types.d.ts +8 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/types/index.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/package.json +2 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/setup/setup.module.d.ts +0 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/setup/setup.module.d.ts +0 -2
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/instance-initialize/index.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/instance-initialize/instance-initialize.pipeline.test.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/instance-initialize/models.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/organization-register/index.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/organization-register/models.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/organization-register/organization-register.pipeline.test.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/tenant-initialize/index.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/tenant-initialize/models.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/tenant-initialize/tenant-initialize.pipeline.test.d.ts +0 -0
- /package/dist/{esm/types/platforms/nest/__test__/server/app/setup/templates/instance-initialize/instance-initialize.pipeline.test.d.ts → cjs/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/user-update.pipeline.spec.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/instance-initialize/index.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup/templates/organization-register/organization-register.pipeline.test.d.ts → appAdmin/templates/instance-initialize/instance-initialize.pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/instance-initialize/models.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/organization-register/index.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/organization-register/models.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup/templates/tenant-initialize/tenant-initialize.pipeline.test.d.ts → appAdmin/templates/organization-register/organization-register.pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/tenant-initialize/index.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/app/{setup → appAdmin}/templates/tenant-initialize/models.d.ts +0 -0
|
@@ -3,7 +3,7 @@ import { TenantInitializeTemplate } from "./templates/tenant-initialize";
|
|
|
3
3
|
import { InstanceInitializeTemplate } from "./templates/instance-initialize";
|
|
4
4
|
import { OrganizationInitializeRequest, OrganizationInitializeResponse } from "./templates/organization-register/models";
|
|
5
5
|
import { OrganizationRegisterTemplate } from "./templates/organization-register";
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class AppAdminController {
|
|
7
7
|
private readonly tenantInit;
|
|
8
8
|
private readonly instanceInit;
|
|
9
9
|
private readonly organizationInit;
|
|
@@ -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
|
-
|
|
4
|
+
import { UserUpdateTemplate } from "./user-update";
|
|
5
|
+
export declare const SetupTemplates: (typeof InstanceInitializeTemplate | typeof OrganizationRegisterTemplate | typeof TenantInitializeTemplate | typeof UserUpdateTemplate)[];
|
package/dist/cjs/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PipelineDefinition } from "../../../../../../../../types";
|
|
2
|
+
import { AuthenticationService } from "../../../../../../extensions";
|
|
3
|
+
import { IPipelineTemplateBuilder, NestPipelineTemplate } from "../../../../../../pipelines";
|
|
4
|
+
import { AppUserProfileEntityManager } from "../../../../entities/appUserProfiles/appUserProfile.manager";
|
|
5
|
+
import { AppUserEntityManager } from "../../../../entities/appUsers/appUser.manager";
|
|
6
|
+
import { AppAuthContext } from "../../../../infrastructure/authentication";
|
|
7
|
+
import { UserUpdatePipelineInput } from "./models";
|
|
8
|
+
export declare class UserUpdateTemplate extends NestPipelineTemplate<UserUpdatePipelineInput, void, AppAuthContext> {
|
|
9
|
+
private readonly auth;
|
|
10
|
+
private readonly users;
|
|
11
|
+
private readonly userProfiles;
|
|
12
|
+
constructor(auth: AuthenticationService, users: AppUserEntityManager, userProfiles: AppUserProfileEntityManager);
|
|
13
|
+
protected isAuthorized(context: AppAuthContext): boolean;
|
|
14
|
+
protected buildTemplate(builder: IPipelineTemplateBuilder<UserUpdatePipelineInput, AppAuthContext>): PipelineDefinition<UserUpdatePipelineInput, void, AppAuthContext>;
|
|
15
|
+
}
|
package/dist/cjs/types/platforms/nest/__test__/server/app/appAdmin/templates/user-update/models.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class UserUpdateRequest {
|
|
2
|
+
email: string;
|
|
3
|
+
userName: string;
|
|
4
|
+
fistName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
roleUid: string;
|
|
7
|
+
birthDate?: string;
|
|
8
|
+
}
|
|
9
|
+
export type UserUpdatePipelineInput = {
|
|
10
|
+
userId: string;
|
|
11
|
+
data: UserUpdateRequest;
|
|
12
|
+
};
|
package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts
CHANGED
|
@@ -10,10 +10,14 @@ export type AppUserContext = {
|
|
|
10
10
|
tenantId: string;
|
|
11
11
|
tenantUid: string;
|
|
12
12
|
};
|
|
13
|
+
export type AppUserRole = {
|
|
14
|
+
uid: string;
|
|
15
|
+
};
|
|
13
16
|
export declare class AppAuthContext implements IAuthenticationContext<AppUserContext> {
|
|
14
17
|
isAuthenticated: boolean;
|
|
15
18
|
isAnonymous: boolean;
|
|
16
19
|
userId?: string;
|
|
17
20
|
userContext?: AppUserContext;
|
|
18
21
|
userInfo?: AppUserInfo;
|
|
22
|
+
userRoles?: AppUserRole[];
|
|
19
23
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { INestApplication } from "@nestjs/common";
|
|
2
|
+
import { DataSource } from "typeorm";
|
|
3
|
+
import { ApplicationAuthenticationContext } from "./types";
|
|
4
|
+
import { AppAuthContextProvider } from "../../infrastructure/authentication";
|
|
5
|
+
import { AuthGuard } from "../../../../extensions";
|
|
6
|
+
export declare const mockAuthenticatedUser: (auth: AppAuthContextProvider, guard: AuthGuard) => void;
|
|
7
|
+
export declare const createAuthenticationContext: (app: INestApplication<any>, dataSource: DataSource) => Promise<ApplicationAuthenticationContext>;
|
|
8
|
+
export declare const createUser: (app: INestApplication<any>, context: ApplicationAuthenticationContext, data: {
|
|
9
|
+
roleUid?: string;
|
|
10
|
+
}) => Promise<import("../../../../extensions").IAuthUser>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppDirectoryEntity } from "../../database/core/entities/appDirectory.entity";
|
|
2
|
+
import { AppOrganizationEntity } from "../../database/core/entities/appOrganization.entity";
|
|
3
|
+
import { AppTenantEntity } from "../../database/core/entities/appTenant.entity";
|
|
4
|
+
export type ApplicationAuthenticationContext = {
|
|
5
|
+
tenant: AppTenantEntity;
|
|
6
|
+
organization: AppOrganizationEntity;
|
|
7
|
+
directory: AppDirectoryEntity;
|
|
8
|
+
};
|
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?.
|
|
2366
|
+
const buildRolesGuard = ({ mainRole, inheritedRoles, }, options) => Roles(mainRole.uid, ...(!options?.exact && inheritedRoles
|
|
2367
2367
|
? inheritedRoles.map((role) => role.uid)
|
|
2368
2368
|
: []));
|
|
2369
2369
|
|
|
@@ -22019,6 +22019,11 @@ class TypeOrmRepository {
|
|
|
22019
22019
|
throw new Error("Invalid 'id' parameter.");
|
|
22020
22020
|
}
|
|
22021
22021
|
this.logger.debug("Updating entity", { id, entity });
|
|
22022
|
+
// await this.innerRepository.preload(id as any)
|
|
22023
|
+
// await this.innerRepository.save({
|
|
22024
|
+
// id,
|
|
22025
|
+
// ...entity,
|
|
22026
|
+
// } as unknown as TEntity)
|
|
22022
22027
|
await this.innerRepository.update(id, entity);
|
|
22023
22028
|
const current = await this.get(id);
|
|
22024
22029
|
if (!current) {
|