@punks/backend-entity-manager 0.0.65 → 0.0.68
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 +220 -51
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/integrations/repository/typeorm/queryBuilder.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/auth.test-controller.d.ts +11 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/services/auth.roles.service.d.ts +12 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/{user.service.d.ts → services/auth.user.service.d.ts} +8 -8
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/services/auth.userRoles.service.d.ts +20 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.manager.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.models.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.models.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.query.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/__test__/server/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/guards/auth-guard/index.d.ts +13 -0
- package/dist/cjs/types/platforms/nest/__test__/tests/authentication/test_auth_guards.test.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/tests/authentication/test_auth_jwt.test.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +34 -12
- package/dist/cjs/types/platforms/nest/extensions/authentication/converters/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/index.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/rolesService.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/symbols.d.ts +8 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/decorators/userRolesService.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-login/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-login/types.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-password-reset-request/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-password-reset-request/types.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-register/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-register/types.d.ts +3 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-token-verify/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-token-verify/types.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-verify-request/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-verify-request/types.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/initializer/index.d.ts +5 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/middlewares/authentication/index.d.ts +10 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/module.d.ts +3 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/resolver/index.d.ts +9 -3
- package/dist/cjs/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +13 -8
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/abstractions/index.d.ts +1 -39
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/abstractions/models.d.ts +51 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/base/initializer/index.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/processors/providers.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/services/index.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/services/organization-initializer/index.d.ts +8 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/services/providers.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/services/tenant-initializer/index.d.ts +8 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/symbols/index.d.ts +10 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/types/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/types/templates.d.ts +20 -0
- package/dist/esm/index.js +215 -52
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/integrations/repository/typeorm/queryBuilder.d.ts +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/auth.test-controller.d.ts +11 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/services/auth.roles.service.d.ts +12 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/{user.service.d.ts → services/auth.user.service.d.ts} +8 -8
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/services/auth.userRoles.service.d.ts +20 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.manager.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.models.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.models.d.ts +2 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.query.d.ts +2 -1
- package/dist/esm/types/platforms/nest/__test__/server/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/guards/auth-guard/index.d.ts +13 -0
- package/dist/esm/types/platforms/nest/__test__/tests/authentication/test_auth_guards.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/authentication/test_auth_jwt.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +34 -12
- package/dist/esm/types/platforms/nest/extensions/authentication/converters/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/guards.d.ts +4 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/index.d.ts +3 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/rolesService.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/symbols.d.ts +8 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/decorators/userRolesService.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-login/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-login/types.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-password-reset-request/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-password-reset-request/types.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-register/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-register/types.d.ts +3 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-token-verify/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-token-verify/types.d.ts +3 -3
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-verify-request/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-verify-request/types.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/initializer/index.d.ts +5 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/middlewares/authentication/index.d.ts +10 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/module.d.ts +3 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/resolver/index.d.ts +9 -3
- package/dist/esm/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +13 -8
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/abstractions/index.d.ts +1 -39
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/abstractions/models.d.ts +51 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/base/initializer/index.d.ts +6 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/processors/providers.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/services/index.d.ts +2 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/services/organization-initializer/index.d.ts +8 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/services/providers.d.ts +3 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/services/tenant-initializer/index.d.ts +8 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/symbols/index.d.ts +10 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/types/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/types/templates.d.ts +20 -0
- package/dist/index.d.ts +134 -36
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OrganizationTemplate } from "../../types";
|
|
2
|
+
import { IAppCompany, IAppUser, IAppUserGroup } from "../../abstractions";
|
|
3
|
+
import { EntityManagerRegistry } from "../../../../ioc";
|
|
4
|
+
export declare class OrganizationInitializerService {
|
|
5
|
+
private readonly registry;
|
|
6
|
+
constructor(registry: EntityManagerRegistry);
|
|
7
|
+
execute<TCompany extends IAppCompany, TUser extends IAppUser, TUserGroup extends IAppUserGroup>(template: OrganizationTemplate<TCompany, TUser, TUserGroup>): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TenantTemplate } from "../../types";
|
|
2
|
+
import { IAppTenant, IAppUser } from "../../abstractions";
|
|
3
|
+
import { EntityManagerRegistry } from "../../../../ioc";
|
|
4
|
+
export declare class TenantInitializerService {
|
|
5
|
+
private readonly registry;
|
|
6
|
+
constructor(registry: EntityManagerRegistry);
|
|
7
|
+
execute<TTenant extends IAppTenant, TUser extends IAppUser>(template: TenantTemplate<TTenant, TUser>): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OrganizationAdmin, OrganizationTemplate, TenantAdmin, TenantTemplate, } from "./templates";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IAppCompany, IAppTenant, IAppUser, IAppUserGroup } from "../abstractions";
|
|
2
|
+
export type TenantAdmin<TUser extends IAppUser> = {
|
|
3
|
+
user: Partial<TUser>;
|
|
4
|
+
password: string;
|
|
5
|
+
};
|
|
6
|
+
export type TenantTemplate<TTenant extends IAppTenant, TUser extends IAppUser> = {
|
|
7
|
+
tenant: Partial<TTenant>;
|
|
8
|
+
defaultAdmin?: TenantAdmin<TUser>;
|
|
9
|
+
};
|
|
10
|
+
export type OrganizationAdmin<TUser extends IAppUser> = {
|
|
11
|
+
user: Partial<TUser>;
|
|
12
|
+
password: string;
|
|
13
|
+
};
|
|
14
|
+
export type OrganizationTemplate<TCompany extends IAppCompany, TUser extends IAppUser, TUserGroup extends IAppUserGroup> = {
|
|
15
|
+
tenant: Partial<TCompany["organization"]["tenant"]>;
|
|
16
|
+
organization: Partial<TCompany["organization"]>;
|
|
17
|
+
company: Partial<TCompany>;
|
|
18
|
+
groups: Partial<TUserGroup>[];
|
|
19
|
+
defaultAdmin?: OrganizationAdmin<TUser>;
|
|
20
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
/// <reference types="express" />
|
|
3
3
|
import * as _punks_backend_core from '@punks/backend-core';
|
|
4
|
-
import
|
|
4
|
+
import * as _nestjs_common from '@nestjs/common';
|
|
5
|
+
import { Type as Type$1, INestApplicationContext, NestModule, DynamicModule, MiddlewareConsumer, ExceptionFilter, ArgumentsHost, NestMiddleware } from '@nestjs/common';
|
|
5
6
|
import { Module } from '@nestjs/core/injector/module';
|
|
6
7
|
import { ModulesContainer } from '@nestjs/core/injector/modules-container';
|
|
7
8
|
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
|
@@ -800,18 +801,23 @@ declare class StringFacet implements IEntityFacet<string> {
|
|
|
800
801
|
items: StringFacetItem[];
|
|
801
802
|
}
|
|
802
803
|
|
|
803
|
-
interface
|
|
804
|
+
interface IAuthService {
|
|
804
805
|
}
|
|
805
|
-
interface
|
|
806
|
+
interface IAuthRole {
|
|
807
|
+
id: string;
|
|
808
|
+
uid: string;
|
|
809
|
+
name: string;
|
|
810
|
+
}
|
|
811
|
+
interface IAuthUserProfile {
|
|
806
812
|
firstName: string;
|
|
807
813
|
lastName: string;
|
|
808
814
|
}
|
|
809
|
-
interface
|
|
815
|
+
interface IAuthUserOrganization {
|
|
810
816
|
id: string;
|
|
811
817
|
uid: string;
|
|
812
818
|
name: string;
|
|
813
819
|
}
|
|
814
|
-
interface
|
|
820
|
+
interface IAuthUser {
|
|
815
821
|
id: string;
|
|
816
822
|
passwordHash: string;
|
|
817
823
|
passwordUpdateTimestamp?: Date;
|
|
@@ -821,13 +827,18 @@ interface IUser {
|
|
|
821
827
|
verified: boolean;
|
|
822
828
|
verifiedTimestamp?: Date;
|
|
823
829
|
disabled: boolean;
|
|
824
|
-
profile:
|
|
825
|
-
organization?:
|
|
830
|
+
profile: IAuthUserProfile;
|
|
831
|
+
organization?: IAuthUserOrganization;
|
|
826
832
|
}
|
|
827
|
-
interface
|
|
833
|
+
interface IAuthUserContext {
|
|
828
834
|
organizationUid?: string;
|
|
829
835
|
}
|
|
830
|
-
interface
|
|
836
|
+
interface IAuthUserTokenData<TContext extends IAuthUserContext> {
|
|
837
|
+
userId: string;
|
|
838
|
+
email: string;
|
|
839
|
+
context?: TContext;
|
|
840
|
+
}
|
|
841
|
+
interface IAuthUserService<TUser extends IAuthUser, TUserContext extends IAuthUserContext, TUserRegistrationInfo> {
|
|
831
842
|
getById(id: string): Promise<TUser>;
|
|
832
843
|
getByEmail(email: string, context?: TUserContext): Promise<TUser>;
|
|
833
844
|
getByUserName(userName: string, context?: TUserContext): Promise<TUser>;
|
|
@@ -835,18 +846,41 @@ interface IUserService<TUser extends IUser, TUserContext extends IUserContext, T
|
|
|
835
846
|
delete(id: string): Promise<void>;
|
|
836
847
|
create(email: string, data: TUserRegistrationInfo, context?: TUserContext): Promise<TUser>;
|
|
837
848
|
}
|
|
838
|
-
interface
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
849
|
+
interface IAuthRoleService<TRole extends IAuthRole> {
|
|
850
|
+
create(data: Partial<TRole>): Promise<TRole>;
|
|
851
|
+
update(id: string, data: Partial<TRole>): Promise<void>;
|
|
852
|
+
delete(id: string): Promise<void>;
|
|
853
|
+
getById(id: string): Promise<TRole | undefined>;
|
|
854
|
+
getByUid(id: string): Promise<TRole | undefined>;
|
|
855
|
+
}
|
|
856
|
+
interface IAuthUserRolesService<TUser extends IAuthUser, TRole extends IAuthRole> {
|
|
857
|
+
getRoleUsers(roleId: string): Promise<TUser[]>;
|
|
858
|
+
getUserRoles(userId: string): Promise<TRole[]>;
|
|
859
|
+
getUserRolesByUid(roleUid: string): Promise<TRole[]>;
|
|
860
|
+
addUserToRole(userId: string, roleId: string): Promise<void>;
|
|
861
|
+
addUserToRoleByUid(userId: string, roleUid: string): Promise<void>;
|
|
862
|
+
removeUserFromRole(userId: string, roleId: string): Promise<void>;
|
|
863
|
+
removeUserFromRoleByUid(userId: string, roleUid: string): Promise<void>;
|
|
864
|
+
clearUserRoles(userId: string): Promise<TRole[]>;
|
|
842
865
|
}
|
|
843
866
|
|
|
867
|
+
declare const Public: () => _nestjs_common.CustomDecorator<string>;
|
|
868
|
+
declare const Authenticated: () => _nestjs_common.CustomDecorator<string>;
|
|
869
|
+
declare const Roles: (...roles: string[]) => _nestjs_common.CustomDecorator<string>;
|
|
870
|
+
declare const MemberOf: (...groups: string[]) => _nestjs_common.CustomDecorator<string>;
|
|
871
|
+
|
|
844
872
|
declare const AuthenticationExtensionSymbols: {
|
|
845
873
|
UserService: symbol;
|
|
874
|
+
RolesService: symbol;
|
|
875
|
+
UserRolesService: symbol;
|
|
846
876
|
};
|
|
847
877
|
|
|
878
|
+
declare const WpRolesService: () => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
|
|
879
|
+
|
|
848
880
|
declare const WpUserService: () => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
|
|
849
881
|
|
|
882
|
+
declare const WpUserRolesService: () => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol | undefined, descriptor?: TypedPropertyDescriptor<Y> | undefined) => void;
|
|
883
|
+
|
|
850
884
|
declare const AuthenticationEmailTemplates: {
|
|
851
885
|
Registration: string;
|
|
852
886
|
PasswordReset: string;
|
|
@@ -922,7 +956,7 @@ interface UserEnableInput {
|
|
|
922
956
|
userId: string;
|
|
923
957
|
}
|
|
924
958
|
|
|
925
|
-
interface UserLoginInput<TUserContext extends
|
|
959
|
+
interface UserLoginInput<TUserContext extends IAuthUserContext> {
|
|
926
960
|
userName: string;
|
|
927
961
|
password: string;
|
|
928
962
|
context?: TUserContext;
|
|
@@ -948,7 +982,7 @@ type UserPasswordResetRequestCallbackTemplate = {
|
|
|
948
982
|
urlTemplate: string;
|
|
949
983
|
tokenPlaceholder: string;
|
|
950
984
|
};
|
|
951
|
-
interface UserPasswordResetRequestInput<TUserContext extends
|
|
985
|
+
interface UserPasswordResetRequestInput<TUserContext extends IAuthUserContext> {
|
|
952
986
|
email: string;
|
|
953
987
|
callback: UserPasswordResetRequestCallbackTemplate;
|
|
954
988
|
languageId: string;
|
|
@@ -980,7 +1014,7 @@ type UserRegisterCallbackTemplate = {
|
|
|
980
1014
|
urlTemplate: string;
|
|
981
1015
|
tokenPlaceholder: string;
|
|
982
1016
|
};
|
|
983
|
-
interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends
|
|
1017
|
+
interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends IAuthUserContext> {
|
|
984
1018
|
email: string;
|
|
985
1019
|
userName: string;
|
|
986
1020
|
password: string;
|
|
@@ -992,11 +1026,12 @@ interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends IUse
|
|
|
992
1026
|
interface UserRegistrationResult {
|
|
993
1027
|
success: boolean;
|
|
994
1028
|
error?: UserRegistrationError;
|
|
1029
|
+
userId?: string;
|
|
995
1030
|
}
|
|
996
1031
|
|
|
997
|
-
interface UserTokenVerifyResult<TUserContext extends
|
|
1032
|
+
interface UserTokenVerifyResult<TUserContext extends IAuthUserContext> {
|
|
998
1033
|
isValid: boolean;
|
|
999
|
-
data:
|
|
1034
|
+
data: IAuthUserTokenData<TUserContext>;
|
|
1000
1035
|
}
|
|
1001
1036
|
interface UserTokenVerifyInput {
|
|
1002
1037
|
token: string;
|
|
@@ -1006,7 +1041,7 @@ interface UserVerifyCompleteInput {
|
|
|
1006
1041
|
token: string;
|
|
1007
1042
|
}
|
|
1008
1043
|
|
|
1009
|
-
interface UserVerifyRequestInput<TUserContext extends
|
|
1044
|
+
interface UserVerifyRequestInput<TUserContext extends IAuthUserContext> {
|
|
1010
1045
|
email: string;
|
|
1011
1046
|
callback: UserVerifyRequestCallbackTemplate;
|
|
1012
1047
|
languageId: string;
|
|
@@ -1074,8 +1109,14 @@ declare class TrackingService {
|
|
|
1074
1109
|
|
|
1075
1110
|
declare class AuthenticationServicesResolver {
|
|
1076
1111
|
private usersService;
|
|
1077
|
-
|
|
1078
|
-
|
|
1112
|
+
private rolesService;
|
|
1113
|
+
private usersRolesService;
|
|
1114
|
+
registerUsersService(usersService: IAuthUserService<any, any, any>): void;
|
|
1115
|
+
registerRoleService(rolesService: IAuthRoleService<any>): void;
|
|
1116
|
+
registerUserRolesService(userRolesService: IAuthUserRolesService<any, any>): void;
|
|
1117
|
+
getUsersService<TUser extends IAuthUser, TUserRegistrationInfo>(): IAuthUserService<TUser, any, TUserRegistrationInfo>;
|
|
1118
|
+
getRoleService<TRole extends IAuthRole>(): IAuthRoleService<TRole>;
|
|
1119
|
+
getUserRoleService<TUser extends IAuthUser, TRole extends IAuthRole>(): IAuthUserRolesService<TUser, TRole>;
|
|
1079
1120
|
}
|
|
1080
1121
|
|
|
1081
1122
|
declare class JwtProvider {
|
|
@@ -1110,7 +1151,7 @@ declare class UserRegistrationHandler {
|
|
|
1110
1151
|
private readonly jwtProvider;
|
|
1111
1152
|
private readonly logger;
|
|
1112
1153
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1113
|
-
execute<TUserRegistrationInfo, TContext extends
|
|
1154
|
+
execute<TUserRegistrationInfo, TContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TContext>): Promise<UserRegistrationResult>;
|
|
1114
1155
|
private createPasswordHash;
|
|
1115
1156
|
private sendRegistrationEmail;
|
|
1116
1157
|
private generateEmailVerifyToken;
|
|
@@ -1135,7 +1176,7 @@ declare class UserLoginHandler {
|
|
|
1135
1176
|
private readonly passwordHashingProvider;
|
|
1136
1177
|
private readonly jwtProvider;
|
|
1137
1178
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, jwtProvider: JwtProvider);
|
|
1138
|
-
execute<TUserContext extends
|
|
1179
|
+
execute<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
1139
1180
|
private generateUserJwtToken;
|
|
1140
1181
|
private resolveUser;
|
|
1141
1182
|
}
|
|
@@ -1163,7 +1204,7 @@ declare class UserPasswordResetRequestHandler {
|
|
|
1163
1204
|
private readonly emailService;
|
|
1164
1205
|
private readonly jwtProvider;
|
|
1165
1206
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1166
|
-
execute<TUserContext extends
|
|
1207
|
+
execute<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
1167
1208
|
private sendPasswordResetEmail;
|
|
1168
1209
|
private generatePasswordResetToken;
|
|
1169
1210
|
private resolveUser;
|
|
@@ -1182,7 +1223,7 @@ declare class UserVerifyCompleteHandler {
|
|
|
1182
1223
|
declare class UserTokenVerifyHandler {
|
|
1183
1224
|
private readonly jwtProvider;
|
|
1184
1225
|
constructor(jwtProvider: JwtProvider);
|
|
1185
|
-
execute<TUserContext extends
|
|
1226
|
+
execute<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
1186
1227
|
private decodeUserJwtToken;
|
|
1187
1228
|
}
|
|
1188
1229
|
|
|
@@ -1191,13 +1232,13 @@ declare class UserVerifyRequestHandler {
|
|
|
1191
1232
|
private readonly emailService;
|
|
1192
1233
|
private readonly jwtProvider;
|
|
1193
1234
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1194
|
-
execute<TUserContext extends
|
|
1235
|
+
execute<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
1195
1236
|
private sendEmailVerifyEmail;
|
|
1196
1237
|
private generateEmailVerifyToken;
|
|
1197
1238
|
private resolveUser;
|
|
1198
1239
|
}
|
|
1199
1240
|
|
|
1200
|
-
declare class AuthenticationService implements
|
|
1241
|
+
declare class AuthenticationService implements IAuthService {
|
|
1201
1242
|
private readonly userDisableHandler;
|
|
1202
1243
|
private readonly userEnableHandler;
|
|
1203
1244
|
private readonly userLoginHandler;
|
|
@@ -1208,21 +1249,78 @@ declare class AuthenticationService implements IAuthenticationService {
|
|
|
1208
1249
|
private readonly userTokenVerifyHandler;
|
|
1209
1250
|
private readonly userVerifyRequestHandler;
|
|
1210
1251
|
private readonly userVerifyCompleteHandler;
|
|
1211
|
-
|
|
1252
|
+
private readonly resolver;
|
|
1253
|
+
constructor(userDisableHandler: UserDisableHandler, userEnableHandler: UserEnableHandler, userLoginHandler: UserLoginHandler, userPasswordChangeHandler: UserPasswordChangeHandler, userPasswordResetFinalizeHandler: UserPasswordResetCompleteHandler, userPasswordResetRequestHandler: UserPasswordResetRequestHandler, userRegistrationHandler: UserRegistrationHandler, userTokenVerifyHandler: UserTokenVerifyHandler, userVerifyRequestHandler: UserVerifyRequestHandler, userVerifyCompleteHandler: UserVerifyCompleteHandler, resolver: AuthenticationServicesResolver);
|
|
1212
1254
|
userDisable(input: UserDisableInput): Promise<void>;
|
|
1213
1255
|
userEnable(input: UserEnableInput): Promise<void>;
|
|
1214
|
-
userLogin<TUserContext extends
|
|
1256
|
+
userLogin<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
1215
1257
|
userPasswordChange(input: UserPasswordChangeInput): Promise<void>;
|
|
1216
1258
|
userPasswordResetFinalize(input: UserPasswordResetCompleteInput): Promise<void>;
|
|
1217
|
-
userPasswordResetRequest<TUserContext extends
|
|
1218
|
-
userRegister<TUserRegistrationInfo, TUserContext extends
|
|
1219
|
-
userVerifyRequest<TUserContext extends
|
|
1259
|
+
userPasswordResetRequest<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
1260
|
+
userRegister<TUserRegistrationInfo, TUserContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TUserContext>): Promise<UserRegistrationResult>;
|
|
1261
|
+
userVerifyRequest<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
1220
1262
|
userVerifyComplete(input: UserVerifyCompleteInput): Promise<void>;
|
|
1221
|
-
userTokenVerify<TUserContext extends
|
|
1263
|
+
userTokenVerify<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
1264
|
+
get usersService(): IAuthUserService<IAuthUser, any, unknown>;
|
|
1265
|
+
get rolesService(): IAuthRoleService<IAuthRole>;
|
|
1266
|
+
get userRolesService(): IAuthUserRolesService<IAuthUser, IAuthRole>;
|
|
1222
1267
|
}
|
|
1223
1268
|
|
|
1224
|
-
declare class AuthenticationModule {
|
|
1269
|
+
declare class AuthenticationModule implements NestModule {
|
|
1225
1270
|
static forRoot(input: AuthenticationModuleSettings): DynamicModule;
|
|
1271
|
+
configure(consumer: MiddlewareConsumer): void;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
interface IAppTenant {
|
|
1275
|
+
id: string;
|
|
1276
|
+
uid: string;
|
|
1277
|
+
name: string;
|
|
1278
|
+
}
|
|
1279
|
+
interface IAppOrganization {
|
|
1280
|
+
id: string;
|
|
1281
|
+
uid: string;
|
|
1282
|
+
name: string;
|
|
1283
|
+
tenant: IAppTenant;
|
|
1284
|
+
}
|
|
1285
|
+
interface IAppCompany {
|
|
1286
|
+
id: string;
|
|
1287
|
+
uid: string;
|
|
1288
|
+
name: string;
|
|
1289
|
+
organization: IAppOrganization;
|
|
1290
|
+
}
|
|
1291
|
+
interface IAppDivision {
|
|
1292
|
+
id: string;
|
|
1293
|
+
uid: string;
|
|
1294
|
+
name: string;
|
|
1295
|
+
company: IAppCompany;
|
|
1296
|
+
}
|
|
1297
|
+
interface IAppUserProfile {
|
|
1298
|
+
firstName: string;
|
|
1299
|
+
lastName: string;
|
|
1300
|
+
}
|
|
1301
|
+
interface IAppUser {
|
|
1302
|
+
id: string;
|
|
1303
|
+
uid?: string;
|
|
1304
|
+
userName: string;
|
|
1305
|
+
email: string;
|
|
1306
|
+
verified: boolean;
|
|
1307
|
+
disabled: boolean;
|
|
1308
|
+
profile: IAppUserProfile;
|
|
1309
|
+
tenant: IAppTenant;
|
|
1310
|
+
organization?: IAppOrganization;
|
|
1311
|
+
}
|
|
1312
|
+
interface IAppUserGroup {
|
|
1313
|
+
id: string;
|
|
1314
|
+
uid: string;
|
|
1315
|
+
name: string;
|
|
1316
|
+
disabled: boolean;
|
|
1317
|
+
isBuiltIn: boolean;
|
|
1318
|
+
organization?: IAppOrganization;
|
|
1319
|
+
}
|
|
1320
|
+
interface IAppRole {
|
|
1321
|
+
id: string;
|
|
1322
|
+
uid: string;
|
|
1323
|
+
name: string;
|
|
1226
1324
|
}
|
|
1227
1325
|
|
|
1228
1326
|
declare class MultiTenancyModule {
|
|
@@ -1265,7 +1363,7 @@ declare abstract class TypeOrmQueryBuilder<TEntity extends ObjectLiteral, TEntit
|
|
|
1265
1363
|
constructor(services: EntityServiceLocator<TEntity, unknown>);
|
|
1266
1364
|
search(request: TEntitySearchParameters, context?: IAuthenticationContext<TUserContext>): Promise<IEntitiesSearchResults<TEntitySearchParameters, TEntity, TSorting, number, TFacets>>;
|
|
1267
1365
|
protected findPagedQueryResults(request: TEntitySearchParameters, context?: IAuthenticationContext<TUserContext>): Promise<TEntity[]>;
|
|
1268
|
-
protected getRelationsToLoad(request: TEntitySearchParameters, context
|
|
1366
|
+
protected getRelationsToLoad(request: TEntitySearchParameters, context: IAuthenticationContext<TUserContext> | undefined): FindOptionsRelations<TEntity> | undefined;
|
|
1269
1367
|
protected buildPagingParameters(request: TEntitySearchParameters): {
|
|
1270
1368
|
skip: number | undefined;
|
|
1271
1369
|
take: number | undefined;
|
|
@@ -1438,4 +1536,4 @@ declare const renderHandlebarsTemplate: <TContext extends object>(input: {
|
|
|
1438
1536
|
|
|
1439
1537
|
declare const newUuid: () => string;
|
|
1440
1538
|
|
|
1441
|
-
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationModuleSettings, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, AwsSesEmailTemplateData, AwsSesSettings, BooleanFacet, BooleanFacetItem, EmailService, EmailTemplateProps, EmailVerifyEmailPayload, EmailVerifyTokenPayload, EntityActionsProps, EntityAdapterProps, EntityAuthMiddlewareProps, EntityConnectorProps, EntityConverterProps, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerProps, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntityProps, EntityQueryBuilderProps, EntityRepositoryProps, EntitySeeder, EntitySeederProps, EventsService, EventsTrackerProps, FilterExpression, HtmlEmailInput, IAuthenticationContext, IAuthenticationContextProvider,
|
|
1539
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationModuleSettings, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, AwsSesEmailTemplateData, AwsSesSettings, BooleanFacet, BooleanFacetItem, EmailService, EmailTemplateProps, EmailVerifyEmailPayload, EmailVerifyTokenPayload, EntityActionsProps, EntityAdapterProps, EntityAuthMiddlewareProps, EntityConnectorProps, EntityConverterProps, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerProps, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntityProps, EntityQueryBuilderProps, EntityRepositoryProps, EntitySeeder, EntitySeederProps, EventsService, EventsTrackerProps, FilterExpression, HtmlEmailInput, IAppCompany, IAppDivision, IAppOrganization, IAppRole, IAppTenant, IAppUser, IAppUserGroup, IAppUserProfile, IAuthRole, IAuthRoleService, IAuthService, IAuthUser, IAuthUserContext, IAuthUserOrganization, IAuthUserProfile, IAuthUserRolesService, IAuthUserService, IAuthUserTokenData, IAuthenticationContext, IAuthenticationContextProvider, IAuthorizationResult, IEmailProvider, IEmailTemplate, IEmailTemplatesCollection, IEntitiesQueryBuilder, IEntitiesSearchAction, IEntitiesSearchQuery, IEntitiesSearchResults, IEntitiesSearchResultsPaging, IEntityActions, IEntityAdapter, IEntityAuthorizationMiddleware, IEntityConverter, IEntityCreateAction, IEntityCreateCommand, IEntityDeleteAction, IEntityDeleteCommand, IEntityEventsManager, IEntityFacet, IEntityFacetItem, IEntityFacets, IEntityGetAction, IEntityGetQuery, IEntityManager, IEntityManagerServiceCollection, IEntityManagerServiceRoot, IEntityMapper, IEntityReplicaDeleteManager, IEntityReplicaSyncManager, IEntityRepository, IEntitySearchParameters, IEntitySearchResults, IEntityUpdateAction, IEntityUpdateCommand, IEntityUpsertAction, IEntityUpsertCommand, IEventLog, IEventsTracker, IReplicasConfiguration, ISearchFilters, ISearchOptions, ISearchRequestPaging, ISearchResultsPaging, ISearchSorting, ISearchSortingField, InvalidCredentialsError, LocalizedMap, LocalizedTexts, MemberOf, MessagingEmailSentPayload, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PasswordResetEmailPayload, PlatformEvents, Public, QueryBuilderBase, RegistrationEmailPayload, ReplicaConfiguration, ReplicaOptions, ReplicationMode, Roles, RuntimeErrorInformation, SendgridEmailModule, SendgridEmailTemplate, SendgridEmailTemplateData, SendgridSettings, SendgridTemplateBaseData, SendgridTemplateType, SortDirection, SortingType, StringFacet, StringFacetItem, TemplatedEmailInput, TrackingService, UserDisableInput, UserEnableInput, UserLoginEventPayload, UserLoginInput, UserLoginResult, UserPasswordChangeInput, UserPasswordResetCompleteInput, UserPasswordResetCompletedEventPayload, UserPasswordResetRequestCallbackTemplate, UserPasswordResetRequestInput, UserPasswordResetRequestResult, UserPasswordResetStartedEventPayload, UserPasswordResetTokenPayload, UserProfile, UserRegisterCallbackTemplate, UserRegistrationCompletedEventPayload, UserRegistrationError, UserRegistrationInput, UserRegistrationResult, UserRegistrationStartedEventPayload, UserTokenVerifyInput, UserTokenVerifyResult, UserVerifyCompleteInput, UserVerifyRequestCallbackTemplate, UserVerifyRequestInput, UserVerifyRequestResult as UserVerifyResetRequestResult, WpAppInitializer, WpAwsSesEmailTemplate, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEventsTracker, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, getLocalizedText, newUuid, renderHandlebarsTemplate };
|