@punks/backend-entity-manager 0.0.65 → 0.0.67
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 +9 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/user.service.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +9 -9
- package/dist/cjs/types/platforms/nest/extensions/authentication/converters/index.d.ts +2 -2
- 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 +2 -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/resolver/index.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +7 -7
- 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 +49 -0
- package/dist/cjs/types/platforms/nest/extensions/multi-tenancy/index.d.ts +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/user.service.d.ts +2 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +9 -9
- package/dist/esm/types/platforms/nest/extensions/authentication/converters/index.d.ts +2 -2
- 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 +2 -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/resolver/index.d.ts +3 -3
- package/dist/esm/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +7 -7
- 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 +49 -0
- package/dist/esm/types/platforms/nest/extensions/multi-tenancy/index.d.ts +1 -0
- package/dist/index.d.ts +79 -29
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUserService } from "../../../../extensions";
|
|
2
2
|
import { UserEntity } from "../../database/core/entities/user.entity";
|
|
3
3
|
import { UserEntityManager } from "../../entities/users/user.manager";
|
|
4
4
|
import { AppUserContext } from "../../infrastructure/authentication";
|
|
5
5
|
import { UserRegistrationData } from "./auth.dto";
|
|
6
6
|
import { OrganizationEntityManager } from "../../entities/organizations/organization.manager";
|
|
7
7
|
import { UserProfileEntityManager } from "../../entities/userProfiles/userProfile.manager";
|
|
8
|
-
export declare class AuthUserService implements
|
|
8
|
+
export declare class AuthUserService implements IAuthUserService<UserEntity, AppUserContext, UserRegistrationData> {
|
|
9
9
|
private readonly userManager;
|
|
10
10
|
private readonly userProfileManager;
|
|
11
11
|
private readonly organizationsManager;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface IAuthService {
|
|
2
2
|
}
|
|
3
|
-
export interface
|
|
3
|
+
export interface IAuthUserProfile {
|
|
4
4
|
firstName: string;
|
|
5
5
|
lastName: string;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface IAuthUserOrganization {
|
|
8
8
|
id: string;
|
|
9
9
|
uid: string;
|
|
10
10
|
name: string;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface IAuthUser {
|
|
13
13
|
id: string;
|
|
14
14
|
passwordHash: string;
|
|
15
15
|
passwordUpdateTimestamp?: Date;
|
|
@@ -19,13 +19,13 @@ export interface IUser {
|
|
|
19
19
|
verified: boolean;
|
|
20
20
|
verifiedTimestamp?: Date;
|
|
21
21
|
disabled: boolean;
|
|
22
|
-
profile:
|
|
23
|
-
organization?:
|
|
22
|
+
profile: IAuthUserProfile;
|
|
23
|
+
organization?: IAuthUserOrganization;
|
|
24
24
|
}
|
|
25
|
-
export interface
|
|
25
|
+
export interface IAuthUserContext {
|
|
26
26
|
organizationUid?: string;
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
28
|
+
export interface IAuthUserService<TUser extends IAuthUser, TUserContext extends IAuthUserContext, TUserRegistrationInfo> {
|
|
29
29
|
getById(id: string): Promise<TUser>;
|
|
30
30
|
getByEmail(email: string, context?: TUserContext): Promise<TUser>;
|
|
31
31
|
getByUserName(userName: string, context?: TUserContext): Promise<TUser>;
|
|
@@ -33,7 +33,7 @@ export interface IUserService<TUser extends IUser, TUserContext extends IUserCon
|
|
|
33
33
|
delete(id: string): Promise<void>;
|
|
34
34
|
create(email: string, data: TUserRegistrationInfo, context?: TUserContext): Promise<TUser>;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
36
|
+
export interface IAuthUserTokenData<TContext extends IAuthUserContext> {
|
|
37
37
|
userId: string;
|
|
38
38
|
email: string;
|
|
39
39
|
context?: TContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const extractUserTokenData: <TContext extends
|
|
1
|
+
import { IAuthUser, IAuthUserContext, IAuthUserTokenData } from "../abstractions";
|
|
2
|
+
export declare const extractUserTokenData: <TContext extends IAuthUserContext>(user: IAuthUser, context?: TContext | undefined) => IAuthUserTokenData<TContext>;
|
package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-login/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PasswordHashingProvider } from "../../providers/password-hasher";
|
|
2
2
|
import { AuthenticationServicesResolver } from "../../resolver";
|
|
3
3
|
import { JwtProvider } from "../../providers/jwt";
|
|
4
|
-
import {
|
|
4
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
5
5
|
import { UserLoginInput, UserLoginResult } from "./types";
|
|
6
6
|
export declare class UserLoginHandler {
|
|
7
7
|
private readonly services;
|
|
8
8
|
private readonly passwordHashingProvider;
|
|
9
9
|
private readonly jwtProvider;
|
|
10
10
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, jwtProvider: JwtProvider);
|
|
11
|
-
execute<TUserContext extends
|
|
11
|
+
execute<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
12
12
|
private generateUserJwtToken;
|
|
13
13
|
private resolveUser;
|
|
14
14
|
}
|
package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-login/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface UserLoginInput<TUserContext extends
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
|
+
export interface UserLoginInput<TUserContext extends IAuthUserContext> {
|
|
3
3
|
userName: string;
|
|
4
4
|
password: string;
|
|
5
5
|
context?: TUserContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmailService } from "../../../../services";
|
|
2
|
-
import {
|
|
2
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
3
3
|
import { AuthenticationServicesResolver } from "../../resolver";
|
|
4
4
|
import { JwtProvider } from "../../providers/jwt";
|
|
5
5
|
import { UserPasswordResetRequestInput, UserPasswordResetRequestResult } from "./types";
|
|
@@ -8,7 +8,7 @@ export declare class UserPasswordResetRequestHandler {
|
|
|
8
8
|
private readonly emailService;
|
|
9
9
|
private readonly jwtProvider;
|
|
10
10
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
11
|
-
execute<TUserContext extends
|
|
11
|
+
execute<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
12
12
|
private sendPasswordResetEmail;
|
|
13
13
|
private generatePasswordResetToken;
|
|
14
14
|
private resolveUser;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
2
|
export type UserPasswordResetRequestCallbackTemplate = {
|
|
3
3
|
urlTemplate: string;
|
|
4
4
|
tokenPlaceholder: string;
|
|
5
5
|
};
|
|
6
|
-
export interface UserPasswordResetRequestInput<TUserContext extends
|
|
6
|
+
export interface UserPasswordResetRequestInput<TUserContext extends IAuthUserContext> {
|
|
7
7
|
email: string;
|
|
8
8
|
callback: UserPasswordResetRequestCallbackTemplate;
|
|
9
9
|
languageId: string;
|
package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-register/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
2
|
import { EmailService } from "../../../../services";
|
|
3
3
|
import { AuthenticationServicesResolver } from "../../resolver";
|
|
4
4
|
import { JwtProvider } from "../../providers/jwt";
|
|
@@ -11,7 +11,7 @@ export declare class UserRegistrationHandler {
|
|
|
11
11
|
private readonly jwtProvider;
|
|
12
12
|
private readonly logger;
|
|
13
13
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, emailService: EmailService, jwtProvider: JwtProvider);
|
|
14
|
-
execute<TUserRegistrationInfo, TContext extends
|
|
14
|
+
execute<TUserRegistrationInfo, TContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TContext>): Promise<UserRegistrationResult>;
|
|
15
15
|
private createPasswordHash;
|
|
16
16
|
private sendRegistrationEmail;
|
|
17
17
|
private generateEmailVerifyToken;
|
package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-register/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
2
|
import { UserRegistrationError } from "../../types";
|
|
3
3
|
export type UserRegisterCallbackTemplate = {
|
|
4
4
|
urlTemplate: string;
|
|
5
5
|
tokenPlaceholder: string;
|
|
6
6
|
};
|
|
7
|
-
export interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends
|
|
7
|
+
export interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends IAuthUserContext> {
|
|
8
8
|
email: string;
|
|
9
9
|
userName: string;
|
|
10
10
|
password: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { JwtProvider } from "../../providers/jwt";
|
|
2
|
-
import {
|
|
2
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
3
3
|
import { UserTokenVerifyInput, UserTokenVerifyResult } from "./types";
|
|
4
4
|
export declare class UserTokenVerifyHandler {
|
|
5
5
|
private readonly jwtProvider;
|
|
6
6
|
constructor(jwtProvider: JwtProvider);
|
|
7
|
-
execute<TUserContext extends
|
|
7
|
+
execute<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
8
8
|
private decodeUserJwtToken;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface UserTokenVerifyResult<TUserContext extends
|
|
1
|
+
import { IAuthUserContext, IAuthUserTokenData } from "../../abstractions";
|
|
2
|
+
export interface UserTokenVerifyResult<TUserContext extends IAuthUserContext> {
|
|
3
3
|
isValid: boolean;
|
|
4
|
-
data:
|
|
4
|
+
data: IAuthUserTokenData<TUserContext>;
|
|
5
5
|
}
|
|
6
6
|
export interface UserTokenVerifyInput {
|
|
7
7
|
token: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
2
|
import { EmailService } from "../../../../services";
|
|
3
3
|
import { JwtProvider } from "../../providers/jwt";
|
|
4
4
|
import { AuthenticationServicesResolver } from "../../resolver";
|
|
@@ -8,7 +8,7 @@ export declare class UserVerifyRequestHandler {
|
|
|
8
8
|
private readonly emailService;
|
|
9
9
|
private readonly jwtProvider;
|
|
10
10
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
11
|
-
execute<TUserContext extends
|
|
11
|
+
execute<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
12
12
|
private sendEmailVerifyEmail;
|
|
13
13
|
private generateEmailVerifyToken;
|
|
14
14
|
private resolveUser;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface UserVerifyRequestInput<TUserContext extends
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
|
+
export interface UserVerifyRequestInput<TUserContext extends IAuthUserContext> {
|
|
3
3
|
email: string;
|
|
4
4
|
callback: UserVerifyRequestCallbackTemplate;
|
|
5
5
|
languageId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthUser, IAuthUserService } from "../abstractions";
|
|
2
2
|
export declare class AuthenticationServicesResolver {
|
|
3
3
|
private usersService;
|
|
4
|
-
registerUsersService(usersService:
|
|
5
|
-
getUsersService<TUser extends
|
|
4
|
+
registerUsersService(usersService: IAuthUserService<any, any, any>): void;
|
|
5
|
+
getUsersService<TUser extends IAuthUser, TUserRegistrationInfo>(): IAuthUserService<TUser, any, TUserRegistrationInfo>;
|
|
6
6
|
}
|
package/dist/esm/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAuthService, IAuthUserContext } from "../../abstractions";
|
|
2
2
|
import { UserRegistrationHandler } from "../../handlers/user-register";
|
|
3
3
|
import { UserDisableHandler } from "../../handlers/user-disable";
|
|
4
4
|
import { UserEnableHandler } from "../../handlers/user-enable";
|
|
@@ -19,7 +19,7 @@ import { UserRegistrationInput, UserRegistrationResult } from "../../handlers/us
|
|
|
19
19
|
import { UserTokenVerifyInput, UserTokenVerifyResult } from "../../handlers/user-token-verify/types";
|
|
20
20
|
import { UserVerifyCompleteInput } from "../../handlers/user-verify-complete/types";
|
|
21
21
|
import { UserVerifyRequestInput, UserVerifyRequestResult } from "../../handlers/user-verify-request/types";
|
|
22
|
-
export declare class AuthenticationService implements
|
|
22
|
+
export declare class AuthenticationService implements IAuthService {
|
|
23
23
|
private readonly userDisableHandler;
|
|
24
24
|
private readonly userEnableHandler;
|
|
25
25
|
private readonly userLoginHandler;
|
|
@@ -33,12 +33,12 @@ export declare class AuthenticationService implements IAuthenticationService {
|
|
|
33
33
|
constructor(userDisableHandler: UserDisableHandler, userEnableHandler: UserEnableHandler, userLoginHandler: UserLoginHandler, userPasswordChangeHandler: UserPasswordChangeHandler, userPasswordResetFinalizeHandler: UserPasswordResetCompleteHandler, userPasswordResetRequestHandler: UserPasswordResetRequestHandler, userRegistrationHandler: UserRegistrationHandler, userTokenVerifyHandler: UserTokenVerifyHandler, userVerifyRequestHandler: UserVerifyRequestHandler, userVerifyCompleteHandler: UserVerifyCompleteHandler);
|
|
34
34
|
userDisable(input: UserDisableInput): Promise<void>;
|
|
35
35
|
userEnable(input: UserEnableInput): Promise<void>;
|
|
36
|
-
userLogin<TUserContext extends
|
|
36
|
+
userLogin<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
37
37
|
userPasswordChange(input: UserPasswordChangeInput): Promise<void>;
|
|
38
38
|
userPasswordResetFinalize(input: UserPasswordResetCompleteInput): Promise<void>;
|
|
39
|
-
userPasswordResetRequest<TUserContext extends
|
|
40
|
-
userRegister<TUserRegistrationInfo, TUserContext extends
|
|
41
|
-
userVerifyRequest<TUserContext extends
|
|
39
|
+
userPasswordResetRequest<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
40
|
+
userRegister<TUserRegistrationInfo, TUserContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TUserContext>): Promise<UserRegistrationResult>;
|
|
41
|
+
userVerifyRequest<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
42
42
|
userVerifyComplete(input: UserVerifyCompleteInput): Promise<void>;
|
|
43
|
-
userTokenVerify<TUserContext extends
|
|
43
|
+
userTokenVerify<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
44
44
|
}
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: string;
|
|
3
|
-
uid: string;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IDivision {
|
|
7
|
-
id: string;
|
|
8
|
-
uid: string;
|
|
9
|
-
name: string;
|
|
10
|
-
}
|
|
11
|
-
export interface IUser {
|
|
12
|
-
id: string;
|
|
13
|
-
uid: string;
|
|
14
|
-
}
|
|
15
|
-
export interface IModule {
|
|
16
|
-
id: string;
|
|
17
|
-
uid: string;
|
|
18
|
-
name: string;
|
|
19
|
-
}
|
|
20
|
-
export interface IOrganization {
|
|
21
|
-
id: string;
|
|
22
|
-
uid: string;
|
|
23
|
-
name: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ISubscription {
|
|
26
|
-
id: string;
|
|
27
|
-
uid: string;
|
|
28
|
-
name: string;
|
|
29
|
-
}
|
|
30
|
-
export interface ITenant {
|
|
31
|
-
id: string;
|
|
32
|
-
uid: string;
|
|
33
|
-
name: string;
|
|
34
|
-
}
|
|
35
|
-
export interface IUserGroup {
|
|
36
|
-
id: string;
|
|
37
|
-
uid: string;
|
|
38
|
-
name: string;
|
|
39
|
-
}
|
|
1
|
+
export * from "./models";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface IAppTenant {
|
|
2
|
+
id: string;
|
|
3
|
+
uid: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IAppOrganization {
|
|
7
|
+
id: string;
|
|
8
|
+
uid: string;
|
|
9
|
+
name: string;
|
|
10
|
+
tenant: IAppTenant;
|
|
11
|
+
}
|
|
12
|
+
export interface IAppCompany {
|
|
13
|
+
id: string;
|
|
14
|
+
uid: string;
|
|
15
|
+
name: string;
|
|
16
|
+
organization: IAppOrganization;
|
|
17
|
+
}
|
|
18
|
+
export interface IAppDivision {
|
|
19
|
+
id: string;
|
|
20
|
+
uid: string;
|
|
21
|
+
name: string;
|
|
22
|
+
company: IAppCompany;
|
|
23
|
+
}
|
|
24
|
+
export interface IAppUserProfile {
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IAppUser {
|
|
29
|
+
id: string;
|
|
30
|
+
uid?: string;
|
|
31
|
+
userName: string;
|
|
32
|
+
email: string;
|
|
33
|
+
verified: boolean;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
profile: IAppUserProfile;
|
|
36
|
+
}
|
|
37
|
+
export interface IAppUserGroup {
|
|
38
|
+
id: string;
|
|
39
|
+
uid: string;
|
|
40
|
+
name: string;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
isBuiltIn: boolean;
|
|
43
|
+
organization?: IAppOrganization;
|
|
44
|
+
}
|
|
45
|
+
export interface IAppRole {
|
|
46
|
+
id: string;
|
|
47
|
+
uid: string;
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -800,18 +800,18 @@ declare class StringFacet implements IEntityFacet<string> {
|
|
|
800
800
|
items: StringFacetItem[];
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
-
interface
|
|
803
|
+
interface IAuthService {
|
|
804
804
|
}
|
|
805
|
-
interface
|
|
805
|
+
interface IAuthUserProfile {
|
|
806
806
|
firstName: string;
|
|
807
807
|
lastName: string;
|
|
808
808
|
}
|
|
809
|
-
interface
|
|
809
|
+
interface IAuthUserOrganization {
|
|
810
810
|
id: string;
|
|
811
811
|
uid: string;
|
|
812
812
|
name: string;
|
|
813
813
|
}
|
|
814
|
-
interface
|
|
814
|
+
interface IAuthUser {
|
|
815
815
|
id: string;
|
|
816
816
|
passwordHash: string;
|
|
817
817
|
passwordUpdateTimestamp?: Date;
|
|
@@ -821,13 +821,13 @@ interface IUser {
|
|
|
821
821
|
verified: boolean;
|
|
822
822
|
verifiedTimestamp?: Date;
|
|
823
823
|
disabled: boolean;
|
|
824
|
-
profile:
|
|
825
|
-
organization?:
|
|
824
|
+
profile: IAuthUserProfile;
|
|
825
|
+
organization?: IAuthUserOrganization;
|
|
826
826
|
}
|
|
827
|
-
interface
|
|
827
|
+
interface IAuthUserContext {
|
|
828
828
|
organizationUid?: string;
|
|
829
829
|
}
|
|
830
|
-
interface
|
|
830
|
+
interface IAuthUserService<TUser extends IAuthUser, TUserContext extends IAuthUserContext, TUserRegistrationInfo> {
|
|
831
831
|
getById(id: string): Promise<TUser>;
|
|
832
832
|
getByEmail(email: string, context?: TUserContext): Promise<TUser>;
|
|
833
833
|
getByUserName(userName: string, context?: TUserContext): Promise<TUser>;
|
|
@@ -835,7 +835,7 @@ interface IUserService<TUser extends IUser, TUserContext extends IUserContext, T
|
|
|
835
835
|
delete(id: string): Promise<void>;
|
|
836
836
|
create(email: string, data: TUserRegistrationInfo, context?: TUserContext): Promise<TUser>;
|
|
837
837
|
}
|
|
838
|
-
interface
|
|
838
|
+
interface IAuthUserTokenData<TContext extends IAuthUserContext> {
|
|
839
839
|
userId: string;
|
|
840
840
|
email: string;
|
|
841
841
|
context?: TContext;
|
|
@@ -922,7 +922,7 @@ interface UserEnableInput {
|
|
|
922
922
|
userId: string;
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
interface UserLoginInput<TUserContext extends
|
|
925
|
+
interface UserLoginInput<TUserContext extends IAuthUserContext> {
|
|
926
926
|
userName: string;
|
|
927
927
|
password: string;
|
|
928
928
|
context?: TUserContext;
|
|
@@ -948,7 +948,7 @@ type UserPasswordResetRequestCallbackTemplate = {
|
|
|
948
948
|
urlTemplate: string;
|
|
949
949
|
tokenPlaceholder: string;
|
|
950
950
|
};
|
|
951
|
-
interface UserPasswordResetRequestInput<TUserContext extends
|
|
951
|
+
interface UserPasswordResetRequestInput<TUserContext extends IAuthUserContext> {
|
|
952
952
|
email: string;
|
|
953
953
|
callback: UserPasswordResetRequestCallbackTemplate;
|
|
954
954
|
languageId: string;
|
|
@@ -980,7 +980,7 @@ type UserRegisterCallbackTemplate = {
|
|
|
980
980
|
urlTemplate: string;
|
|
981
981
|
tokenPlaceholder: string;
|
|
982
982
|
};
|
|
983
|
-
interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends
|
|
983
|
+
interface UserRegistrationInput<TUserRegistrationInfo, TUserContext extends IAuthUserContext> {
|
|
984
984
|
email: string;
|
|
985
985
|
userName: string;
|
|
986
986
|
password: string;
|
|
@@ -994,9 +994,9 @@ interface UserRegistrationResult {
|
|
|
994
994
|
error?: UserRegistrationError;
|
|
995
995
|
}
|
|
996
996
|
|
|
997
|
-
interface UserTokenVerifyResult<TUserContext extends
|
|
997
|
+
interface UserTokenVerifyResult<TUserContext extends IAuthUserContext> {
|
|
998
998
|
isValid: boolean;
|
|
999
|
-
data:
|
|
999
|
+
data: IAuthUserTokenData<TUserContext>;
|
|
1000
1000
|
}
|
|
1001
1001
|
interface UserTokenVerifyInput {
|
|
1002
1002
|
token: string;
|
|
@@ -1006,7 +1006,7 @@ interface UserVerifyCompleteInput {
|
|
|
1006
1006
|
token: string;
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
1009
|
-
interface UserVerifyRequestInput<TUserContext extends
|
|
1009
|
+
interface UserVerifyRequestInput<TUserContext extends IAuthUserContext> {
|
|
1010
1010
|
email: string;
|
|
1011
1011
|
callback: UserVerifyRequestCallbackTemplate;
|
|
1012
1012
|
languageId: string;
|
|
@@ -1074,8 +1074,8 @@ declare class TrackingService {
|
|
|
1074
1074
|
|
|
1075
1075
|
declare class AuthenticationServicesResolver {
|
|
1076
1076
|
private usersService;
|
|
1077
|
-
registerUsersService(usersService:
|
|
1078
|
-
getUsersService<TUser extends
|
|
1077
|
+
registerUsersService(usersService: IAuthUserService<any, any, any>): void;
|
|
1078
|
+
getUsersService<TUser extends IAuthUser, TUserRegistrationInfo>(): IAuthUserService<TUser, any, TUserRegistrationInfo>;
|
|
1079
1079
|
}
|
|
1080
1080
|
|
|
1081
1081
|
declare class JwtProvider {
|
|
@@ -1110,7 +1110,7 @@ declare class UserRegistrationHandler {
|
|
|
1110
1110
|
private readonly jwtProvider;
|
|
1111
1111
|
private readonly logger;
|
|
1112
1112
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1113
|
-
execute<TUserRegistrationInfo, TContext extends
|
|
1113
|
+
execute<TUserRegistrationInfo, TContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TContext>): Promise<UserRegistrationResult>;
|
|
1114
1114
|
private createPasswordHash;
|
|
1115
1115
|
private sendRegistrationEmail;
|
|
1116
1116
|
private generateEmailVerifyToken;
|
|
@@ -1135,7 +1135,7 @@ declare class UserLoginHandler {
|
|
|
1135
1135
|
private readonly passwordHashingProvider;
|
|
1136
1136
|
private readonly jwtProvider;
|
|
1137
1137
|
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider, jwtProvider: JwtProvider);
|
|
1138
|
-
execute<TUserContext extends
|
|
1138
|
+
execute<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
1139
1139
|
private generateUserJwtToken;
|
|
1140
1140
|
private resolveUser;
|
|
1141
1141
|
}
|
|
@@ -1163,7 +1163,7 @@ declare class UserPasswordResetRequestHandler {
|
|
|
1163
1163
|
private readonly emailService;
|
|
1164
1164
|
private readonly jwtProvider;
|
|
1165
1165
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1166
|
-
execute<TUserContext extends
|
|
1166
|
+
execute<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
1167
1167
|
private sendPasswordResetEmail;
|
|
1168
1168
|
private generatePasswordResetToken;
|
|
1169
1169
|
private resolveUser;
|
|
@@ -1182,7 +1182,7 @@ declare class UserVerifyCompleteHandler {
|
|
|
1182
1182
|
declare class UserTokenVerifyHandler {
|
|
1183
1183
|
private readonly jwtProvider;
|
|
1184
1184
|
constructor(jwtProvider: JwtProvider);
|
|
1185
|
-
execute<TUserContext extends
|
|
1185
|
+
execute<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
1186
1186
|
private decodeUserJwtToken;
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
@@ -1191,13 +1191,13 @@ declare class UserVerifyRequestHandler {
|
|
|
1191
1191
|
private readonly emailService;
|
|
1192
1192
|
private readonly jwtProvider;
|
|
1193
1193
|
constructor(services: AuthenticationServicesResolver, emailService: EmailService, jwtProvider: JwtProvider);
|
|
1194
|
-
execute<TUserContext extends
|
|
1194
|
+
execute<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
1195
1195
|
private sendEmailVerifyEmail;
|
|
1196
1196
|
private generateEmailVerifyToken;
|
|
1197
1197
|
private resolveUser;
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
-
declare class AuthenticationService implements
|
|
1200
|
+
declare class AuthenticationService implements IAuthService {
|
|
1201
1201
|
private readonly userDisableHandler;
|
|
1202
1202
|
private readonly userEnableHandler;
|
|
1203
1203
|
private readonly userLoginHandler;
|
|
@@ -1211,20 +1211,70 @@ declare class AuthenticationService implements IAuthenticationService {
|
|
|
1211
1211
|
constructor(userDisableHandler: UserDisableHandler, userEnableHandler: UserEnableHandler, userLoginHandler: UserLoginHandler, userPasswordChangeHandler: UserPasswordChangeHandler, userPasswordResetFinalizeHandler: UserPasswordResetCompleteHandler, userPasswordResetRequestHandler: UserPasswordResetRequestHandler, userRegistrationHandler: UserRegistrationHandler, userTokenVerifyHandler: UserTokenVerifyHandler, userVerifyRequestHandler: UserVerifyRequestHandler, userVerifyCompleteHandler: UserVerifyCompleteHandler);
|
|
1212
1212
|
userDisable(input: UserDisableInput): Promise<void>;
|
|
1213
1213
|
userEnable(input: UserEnableInput): Promise<void>;
|
|
1214
|
-
userLogin<TUserContext extends
|
|
1214
|
+
userLogin<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
1215
1215
|
userPasswordChange(input: UserPasswordChangeInput): Promise<void>;
|
|
1216
1216
|
userPasswordResetFinalize(input: UserPasswordResetCompleteInput): Promise<void>;
|
|
1217
|
-
userPasswordResetRequest<TUserContext extends
|
|
1218
|
-
userRegister<TUserRegistrationInfo, TUserContext extends
|
|
1219
|
-
userVerifyRequest<TUserContext extends
|
|
1217
|
+
userPasswordResetRequest<TUserContext extends IAuthUserContext>(input: UserPasswordResetRequestInput<TUserContext>): Promise<UserPasswordResetRequestResult>;
|
|
1218
|
+
userRegister<TUserRegistrationInfo, TUserContext extends IAuthUserContext>(input: UserRegistrationInput<TUserRegistrationInfo, TUserContext>): Promise<UserRegistrationResult>;
|
|
1219
|
+
userVerifyRequest<TUserContext extends IAuthUserContext>(input: UserVerifyRequestInput<TUserContext>): Promise<UserVerifyRequestResult>;
|
|
1220
1220
|
userVerifyComplete(input: UserVerifyCompleteInput): Promise<void>;
|
|
1221
|
-
userTokenVerify<TUserContext extends
|
|
1221
|
+
userTokenVerify<TUserContext extends IAuthUserContext>(input: UserTokenVerifyInput): Promise<UserTokenVerifyResult<TUserContext>>;
|
|
1222
1222
|
}
|
|
1223
1223
|
|
|
1224
1224
|
declare class AuthenticationModule {
|
|
1225
1225
|
static forRoot(input: AuthenticationModuleSettings): DynamicModule;
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
|
+
interface IAppTenant {
|
|
1229
|
+
id: string;
|
|
1230
|
+
uid: string;
|
|
1231
|
+
name: string;
|
|
1232
|
+
}
|
|
1233
|
+
interface IAppOrganization {
|
|
1234
|
+
id: string;
|
|
1235
|
+
uid: string;
|
|
1236
|
+
name: string;
|
|
1237
|
+
tenant: IAppTenant;
|
|
1238
|
+
}
|
|
1239
|
+
interface IAppCompany {
|
|
1240
|
+
id: string;
|
|
1241
|
+
uid: string;
|
|
1242
|
+
name: string;
|
|
1243
|
+
organization: IAppOrganization;
|
|
1244
|
+
}
|
|
1245
|
+
interface IAppDivision {
|
|
1246
|
+
id: string;
|
|
1247
|
+
uid: string;
|
|
1248
|
+
name: string;
|
|
1249
|
+
company: IAppCompany;
|
|
1250
|
+
}
|
|
1251
|
+
interface IAppUserProfile {
|
|
1252
|
+
firstName: string;
|
|
1253
|
+
lastName: string;
|
|
1254
|
+
}
|
|
1255
|
+
interface IAppUser {
|
|
1256
|
+
id: string;
|
|
1257
|
+
uid?: string;
|
|
1258
|
+
userName: string;
|
|
1259
|
+
email: string;
|
|
1260
|
+
verified: boolean;
|
|
1261
|
+
disabled: boolean;
|
|
1262
|
+
profile: IAppUserProfile;
|
|
1263
|
+
}
|
|
1264
|
+
interface IAppUserGroup {
|
|
1265
|
+
id: string;
|
|
1266
|
+
uid: string;
|
|
1267
|
+
name: string;
|
|
1268
|
+
disabled: boolean;
|
|
1269
|
+
isBuiltIn: boolean;
|
|
1270
|
+
organization?: IAppOrganization;
|
|
1271
|
+
}
|
|
1272
|
+
interface IAppRole {
|
|
1273
|
+
id: string;
|
|
1274
|
+
uid: string;
|
|
1275
|
+
name: string;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1228
1278
|
declare class MultiTenancyModule {
|
|
1229
1279
|
}
|
|
1230
1280
|
|
|
@@ -1438,4 +1488,4 @@ declare const renderHandlebarsTemplate: <TContext extends object>(input: {
|
|
|
1438
1488
|
|
|
1439
1489
|
declare const newUuid: () => string;
|
|
1440
1490
|
|
|
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,
|
|
1491
|
+
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, IAppCompany, IAppDivision, IAppOrganization, IAppRole, IAppTenant, IAppUser, IAppUserGroup, IAppUserProfile, IAuthService, IAuthUser, IAuthUserContext, IAuthUserOrganization, IAuthUserProfile, 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, MessagingEmailSentPayload, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PasswordResetEmailPayload, PlatformEvents, QueryBuilderBase, RegistrationEmailPayload, ReplicaConfiguration, ReplicaOptions, ReplicationMode, 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, WpSendgridEmailTemplate, WpUserService, getLocalizedText, newUuid, renderHandlebarsTemplate };
|