@punks/backend-entity-manager 0.0.72 → 0.0.73
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 +201 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/auth.dto.d.ts +6 -14
- package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/organization.controller.d.ts +5 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/index.d.ts +5 -21
- package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/models.d.ts +17 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/templates/index.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/templates/instance-initialize/index.d.ts +11 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/templates/instance-initialize/models.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/templates/tenant-initialize/index.d.ts +13 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/templates/tenant-initialize/models.d.ts +17 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/tenant.controller.d.ts +7 -1
- package/dist/cjs/types/platforms/nest/__test__/server/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/index.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/models/index.d.ts +9 -0
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/providers/index.d.ts +5 -2
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/providers/roles/index.d.ts +14 -0
- package/dist/cjs/types/platforms/nest/__test__/server/{app/auth/services/auth.userRoles.service.d.ts → infrastructure/authentication/providers/userRoles/index.d.ts} +6 -6
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/providers/users/index.d.ts +23 -0
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/roles/index.d.ts +14 -0
- package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/__test__/tests/ports.d.ts +9 -0
- package/dist/cjs/types/platforms/nest/base/entityActions.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +3 -2
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/handlers.d.ts +3 -1
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/index.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-create/index.d.ts +14 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-create/types.d.ts +16 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-delete/index.d.ts +7 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-delete/types.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +8 -1
- package/dist/cjs/types/platforms/nest/ioc/storage.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/module.d.ts +6 -1
- package/dist/cjs/types/platforms/nest/pipelines/builder/types.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/pipelines/template/errors.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/pipelines/template/index.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/pipelines/template/utils.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/session/storage.d.ts +1 -1
- package/dist/cjs/types/templates/pipelines/converters/index.d.ts +2 -1
- package/dist/cjs/types/types/pipelines.d.ts +16 -2
- package/dist/esm/index.js +202 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/auth.dto.d.ts +6 -14
- package/dist/esm/types/platforms/nest/__test__/server/app/organizations/organization.controller.d.ts +5 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/index.d.ts +5 -21
- package/dist/esm/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/models.d.ts +17 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/templates/index.d.ts +3 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/templates/instance-initialize/index.d.ts +11 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/templates/instance-initialize/models.d.ts +4 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/templates/tenant-initialize/index.d.ts +13 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/templates/tenant-initialize/models.d.ts +17 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/tenant.controller.d.ts +7 -1
- package/dist/esm/types/platforms/nest/__test__/server/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/index.d.ts +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/models/index.d.ts +9 -0
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/providers/index.d.ts +5 -2
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/providers/roles/index.d.ts +14 -0
- package/dist/esm/types/platforms/nest/__test__/server/{app/auth/services/auth.userRoles.service.d.ts → infrastructure/authentication/providers/userRoles/index.d.ts} +6 -6
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/providers/users/index.d.ts +23 -0
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/roles/index.d.ts +14 -0
- package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts +2 -1
- package/dist/esm/types/platforms/nest/__test__/tests/base/crud-actions.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/base/crud-api.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/base/crud-operations.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/base/seeder.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/base/server-session.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/pipelines/crud_pipeline_api.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/pipelines/crud_pipeline_template.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/pipelines/simple_pipeline.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/ports.d.ts +9 -0
- package/dist/esm/types/platforms/nest/base/entityActions.d.ts +1 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/abstractions/index.d.ts +3 -2
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/handlers.d.ts +3 -1
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/index.d.ts +2 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-create/index.d.ts +14 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-create/types.d.ts +16 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-delete/index.d.ts +7 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/handlers/user-delete/types.d.ts +3 -0
- package/dist/esm/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts +8 -1
- package/dist/esm/types/platforms/nest/ioc/storage.d.ts +6 -0
- package/dist/esm/types/platforms/nest/module.d.ts +6 -1
- package/dist/esm/types/platforms/nest/pipelines/builder/types.d.ts +1 -1
- package/dist/esm/types/platforms/nest/pipelines/template/errors.d.ts +6 -0
- package/dist/esm/types/platforms/nest/pipelines/template/index.d.ts +8 -3
- package/dist/esm/types/platforms/nest/pipelines/template/utils.d.ts +6 -0
- package/dist/esm/types/platforms/nest/session/storage.d.ts +1 -1
- package/dist/esm/types/templates/pipelines/converters/index.d.ts +2 -1
- package/dist/esm/types/types/pipelines.d.ts +16 -2
- package/dist/index.d.ts +68 -9
- package/package.json +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/services/auth.roles.service.d.ts +0 -12
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/services/auth.user.service.d.ts +0 -20
- package/dist/cjs/types/platforms/nest/__test__/server/app/auth/services/index.d.ts +0 -4
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/services/auth.roles.service.d.ts +0 -12
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/services/auth.user.service.d.ts +0 -20
- package/dist/esm/types/platforms/nest/__test__/server/app/auth/services/index.d.ts +0 -4
- /package/dist/cjs/types/__test__/base/{test-actions-plain.test.d.ts → actions-plain.test.d.ts} +0 -0
- /package/dist/cjs/types/__test__/base/{test-actions-with-converters.test.d.ts → actions-with-converters.test.d.ts} +0 -0
- /package/dist/cjs/types/__test__/base/{test-default-entity-manager.test.d.ts → default-entity-manager.test.d.ts} +0 -0
- /package/dist/cjs/types/__test__/providers/typeorm/{test-typeorm-actions.test.d.ts → typeorm-actions.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/{tests/authentication/test_auth_api.test.d.ts → server/app/organizations/templates/organization-register/pipeline.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/{tests/authentication/test_auth_guards.test.d.ts → server/app/tenants/templates/instance-initialize/pipeline.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/{tests/authentication/test_auth_jwt.test.d.ts → server/app/tenants/templates/tenant-initialize/pipeline.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/providers/{auth-context → context}/index.d.ts +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/{base/test_crud_actions.test.d.ts → authentication/auth-api.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/{base/test_crud_api.test.d.ts → authentication/auth-guards.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/{base/test_crud_operations.test.d.ts → authentication/auth-jwt.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/base/{test_seeder.test.d.ts → crud-actions.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/base/{test_server_session.test.d.ts → crud-api.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/{pipelines/test_crud_pipeline.test.d.ts → base/crud-operations.test.d.ts} +0 -0
- /package/dist/cjs/types/platforms/nest/__test__/tests/{pipelines/test_simple_pipeline.test.d.ts → base/seeder.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/base/test-actions-plain.test.d.ts → cjs/types/platforms/nest/__test__/tests/base/server-session.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/base/test-actions-with-converters.test.d.ts → cjs/types/platforms/nest/__test__/tests/pipelines/crud_pipeline_api.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/base/test-default-entity-manager.test.d.ts → cjs/types/platforms/nest/__test__/tests/pipelines/crud_pipeline_template.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/providers/typeorm/test-typeorm-actions.test.d.ts → cjs/types/platforms/nest/__test__/tests/pipelines/simple_pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/authentication/test_auth_api.test.d.ts → __test__/base/actions-plain.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/authentication/test_auth_guards.test.d.ts → __test__/base/actions-with-converters.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/authentication/test_auth_jwt.test.d.ts → __test__/base/default-entity-manager.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/base/test_crud_actions.test.d.ts → __test__/providers/typeorm/typeorm-actions.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/{tests/base/test_crud_api.test.d.ts → server/app/organizations/templates/organization-register/pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/{tests/base/test_crud_operations.test.d.ts → server/app/tenants/templates/instance-initialize/pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/{tests/base/test_seeder.test.d.ts → server/app/tenants/templates/tenant-initialize/pipeline.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/server/infrastructure/authentication/providers/{auth-context → context}/index.d.ts +0 -0
- /package/dist/esm/types/platforms/nest/__test__/tests/{base/test_server_session.test.d.ts → authentication/auth-api.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/tests/{pipelines/test_crud_pipeline.test.d.ts → authentication/auth-guards.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/tests/{pipelines/test_simple_pipeline.test.d.ts → authentication/auth-jwt.test.d.ts} +0 -0
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { UserRegistrationError } from "../../../../extensions";
|
|
2
|
+
import { AuthUserContext, AuthUserRegistrationData } from "../../infrastructure/authentication/models";
|
|
2
3
|
export declare class OperationCallbackTemplate {
|
|
3
4
|
urlTemplate: string;
|
|
4
5
|
tokenPlaceholder: string;
|
|
5
6
|
}
|
|
6
|
-
export declare class UserRegistrationData {
|
|
7
|
-
userName: string;
|
|
8
|
-
firstName: string;
|
|
9
|
-
lastName: string;
|
|
10
|
-
birthDate: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class UserContext {
|
|
13
|
-
organizationUid: string;
|
|
14
|
-
}
|
|
15
7
|
export declare class UserLoginRequest {
|
|
16
8
|
userName: string;
|
|
17
|
-
userContext?:
|
|
9
|
+
userContext?: AuthUserContext;
|
|
18
10
|
password: string;
|
|
19
11
|
}
|
|
20
12
|
export declare class UserLoginResponse {
|
|
@@ -25,8 +17,8 @@ export declare class UserRegisterRequest {
|
|
|
25
17
|
email: string;
|
|
26
18
|
userName: string;
|
|
27
19
|
password: string;
|
|
28
|
-
data:
|
|
29
|
-
userContext
|
|
20
|
+
data: AuthUserRegistrationData;
|
|
21
|
+
userContext?: AuthUserContext;
|
|
30
22
|
callback: OperationCallbackTemplate;
|
|
31
23
|
languageId: string;
|
|
32
24
|
}
|
|
@@ -36,7 +28,7 @@ export declare class UserRegisterResponse {
|
|
|
36
28
|
}
|
|
37
29
|
export declare class UserPasswordResetRequest {
|
|
38
30
|
userName: string;
|
|
39
|
-
userContext?:
|
|
31
|
+
userContext?: AuthUserContext;
|
|
40
32
|
callback: OperationCallbackTemplate;
|
|
41
33
|
languageId: string;
|
|
42
34
|
}
|
|
@@ -49,7 +41,7 @@ export declare class UserEmailVerifyCompleteRequest {
|
|
|
49
41
|
}
|
|
50
42
|
export declare class UserEmailVerifyRequest {
|
|
51
43
|
email: string;
|
|
52
|
-
userContext
|
|
44
|
+
userContext?: AuthUserContext;
|
|
53
45
|
callback: OperationCallbackTemplate;
|
|
54
46
|
languageId: string;
|
|
55
47
|
}
|
package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/organization.controller.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { OrganizationActions } from "./organization.actions";
|
|
2
2
|
import { OrganizationCreateDto, OrganizationDto, OrganizationSearchRequest, OrganizationSearchResponse, OrganizationUpdateDto } from "./organization.dto";
|
|
3
|
+
import { OrganizationRegisterTemplate } from "./templates/organization-register";
|
|
4
|
+
import { OrganizationRegisterRequest, OrganizationRegisterResponse } from "./templates/organization-register/models";
|
|
3
5
|
export declare class OrganizationController {
|
|
4
6
|
private readonly actions;
|
|
5
|
-
|
|
7
|
+
private readonly registerPipeline;
|
|
8
|
+
constructor(actions: OrganizationActions, registerPipeline: OrganizationRegisterTemplate);
|
|
6
9
|
item(id: string): Promise<OrganizationDto | undefined>;
|
|
7
10
|
create(data: OrganizationCreateDto): Promise<OrganizationDto>;
|
|
8
11
|
update(id: string, item: OrganizationUpdateDto): Promise<OrganizationDto>;
|
|
9
12
|
delete(id: string): Promise<void>;
|
|
10
13
|
search(request: OrganizationSearchRequest): Promise<OrganizationSearchResponse>;
|
|
14
|
+
register(request: OrganizationRegisterRequest): Promise<OrganizationRegisterResponse>;
|
|
11
15
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PipelineDefinition } from "../../../../../../../../types";
|
|
2
|
-
import { EntityManagerRegistry } from "../../../../../../ioc";
|
|
3
2
|
import { IPipelineTemplateBuilder } from "../../../../../../pipelines/builder/types";
|
|
4
3
|
import { NestPipelineTemplate } from "../../../../../../pipelines/template";
|
|
5
4
|
import { CompanyEntityManager } from "../../../../entities/companies/company.manager";
|
|
@@ -7,28 +6,13 @@ import { AppAuthContext } from "../../../../infrastructure/authentication";
|
|
|
7
6
|
import { UserGroupEntityManager } from "../../../../entities/userGroups/userGroup.manager";
|
|
8
7
|
import { OrganizationEntityManager } from "../../../../entities/organizations/organization.manager";
|
|
9
8
|
import { TenantEntityManager } from "../../../../entities/tenants/tenant.manager";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
name: string;
|
|
13
|
-
uid: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class CompanyRegistrationInfo {
|
|
16
|
-
name: string;
|
|
17
|
-
uid: string;
|
|
18
|
-
}
|
|
19
|
-
export declare class OrganizationRegisterInput {
|
|
20
|
-
organization: OrganizationRegistrationInfo;
|
|
21
|
-
company: CompanyRegistrationInfo;
|
|
22
|
-
}
|
|
23
|
-
export declare class OrganizationRegisterResult {
|
|
24
|
-
organizationId: string;
|
|
25
|
-
companyId: string;
|
|
26
|
-
}
|
|
27
|
-
export declare class OrganizationRegisterTemplate extends NestPipelineTemplate<OrganizationRegisterInput, OrganizationRegisterResult, AppAuthContext> {
|
|
9
|
+
import { OrganizationRegisterRequest, OrganizationRegisterResponse } from "./models";
|
|
10
|
+
export declare class OrganizationRegisterTemplate extends NestPipelineTemplate<OrganizationRegisterRequest, OrganizationRegisterResponse, AppAuthContext> {
|
|
28
11
|
private readonly organizations;
|
|
29
12
|
private readonly tenants;
|
|
30
13
|
private readonly companies;
|
|
31
14
|
private readonly userGroups;
|
|
32
|
-
constructor(
|
|
33
|
-
protected
|
|
15
|
+
constructor(organizations: OrganizationEntityManager, tenants: TenantEntityManager, companies: CompanyEntityManager, userGroups: UserGroupEntityManager);
|
|
16
|
+
protected isAuthorized(context: AppAuthContext): boolean;
|
|
17
|
+
protected buildTemplate(builder: IPipelineTemplateBuilder<OrganizationRegisterRequest, AppAuthContext>): PipelineDefinition<OrganizationRegisterRequest, OrganizationRegisterResponse, AppAuthContext>;
|
|
34
18
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class OrganizationRegistrationInfo {
|
|
2
|
+
tenantId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
uid: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class CompanyRegistrationInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
uid: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class OrganizationRegisterRequest {
|
|
11
|
+
organization: OrganizationRegistrationInfo;
|
|
12
|
+
company: CompanyRegistrationInfo;
|
|
13
|
+
}
|
|
14
|
+
export declare class OrganizationRegisterResponse {
|
|
15
|
+
organizationId: string;
|
|
16
|
+
companyId: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PipelineDefinition } from "../../../../../../../../types";
|
|
2
|
+
import { IPipelineTemplateBuilder } from "../../../../../../pipelines/builder/types";
|
|
3
|
+
import { NestPipelineTemplate } from "../../../../../../pipelines/template";
|
|
4
|
+
import { AppAuthContext } from "../../../../infrastructure/authentication";
|
|
5
|
+
import { AuthenticationService } from "../../../../../../extensions";
|
|
6
|
+
import { InstanceInitializeInput } from "./models";
|
|
7
|
+
export declare class InstanceInitializeTemplate extends NestPipelineTemplate<InstanceInitializeInput, void, AppAuthContext> {
|
|
8
|
+
private readonly auth;
|
|
9
|
+
constructor(auth: AuthenticationService);
|
|
10
|
+
protected buildTemplate(builder: IPipelineTemplateBuilder<InstanceInitializeInput, AppAuthContext>): PipelineDefinition<InstanceInitializeInput, void, AppAuthContext>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PipelineDefinition } from "../../../../../../../../types";
|
|
2
|
+
import { IPipelineTemplateBuilder } from "../../../../../../pipelines/builder/types";
|
|
3
|
+
import { NestPipelineTemplate } from "../../../../../../pipelines/template";
|
|
4
|
+
import { AppAuthContext } from "../../../../infrastructure/authentication";
|
|
5
|
+
import { TenantEntityManager } from "../../../../entities/tenants/tenant.manager";
|
|
6
|
+
import { TenantInitializeRequest, TenantInitializeResponse } from "./models";
|
|
7
|
+
import { AuthenticationService } from "../../../../../../extensions";
|
|
8
|
+
export declare class TenantInitializeTemplate extends NestPipelineTemplate<TenantInitializeRequest, TenantInitializeResponse, AppAuthContext> {
|
|
9
|
+
private readonly auth;
|
|
10
|
+
private readonly tenants;
|
|
11
|
+
constructor(auth: AuthenticationService, tenants: TenantEntityManager);
|
|
12
|
+
protected buildTemplate(builder: IPipelineTemplateBuilder<TenantInitializeRequest, AppAuthContext>): PipelineDefinition<TenantInitializeRequest, TenantInitializeResponse, AppAuthContext>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class TenantInitializeInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
uid: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class TenantAdmin {
|
|
6
|
+
email: string;
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
password: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class TenantInitializeRequest {
|
|
12
|
+
tenant: TenantInitializeInfo;
|
|
13
|
+
defaultAdmin: TenantAdmin;
|
|
14
|
+
}
|
|
15
|
+
export declare class TenantInitializeResponse {
|
|
16
|
+
tenantId: string;
|
|
17
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { TenantActions } from "./tenant.actions";
|
|
2
2
|
import { TenantCreateDto, TenantDto, TenantSearchRequest, TenantSearchResponse, TenantUpdateDto } from "./tenant.dto";
|
|
3
|
+
import { TenantInitializeRequest, TenantInitializeResponse } from "./templates/tenant-initialize/models";
|
|
4
|
+
import { TenantInitializeTemplate } from "./templates/tenant-initialize";
|
|
5
|
+
import { InstanceInitializeTemplate } from "./templates/instance-initialize";
|
|
3
6
|
export declare class TenantController {
|
|
4
7
|
private readonly actions;
|
|
5
|
-
|
|
8
|
+
private readonly tenantInit;
|
|
9
|
+
private readonly instanceInit;
|
|
10
|
+
constructor(actions: TenantActions, tenantInit: TenantInitializeTemplate, instanceInit: InstanceInitializeTemplate);
|
|
6
11
|
item(id: string): Promise<TenantDto | undefined>;
|
|
7
12
|
create(data: TenantCreateDto): Promise<TenantDto>;
|
|
8
13
|
update(id: string, item: TenantUpdateDto): Promise<TenantDto>;
|
|
9
14
|
delete(id: string): Promise<void>;
|
|
10
15
|
search(request: TenantSearchRequest): Promise<TenantSearchResponse>;
|
|
16
|
+
initialize(request: TenantInitializeRequest): Promise<TenantInitializeResponse>;
|
|
11
17
|
}
|
|
@@ -5,6 +5,7 @@ export declare const createTestServer: (options?: {
|
|
|
5
5
|
useAuthorization?: boolean;
|
|
6
6
|
extraControllers?: any[];
|
|
7
7
|
extraProviders?: any[];
|
|
8
|
+
enableLogging?: boolean;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
app: import("@nestjs/common").INestApplication<any>;
|
|
10
11
|
server: import("@nestjs/testing").TestingModule;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { AppAuthContextProvider } from "./
|
|
2
|
-
|
|
1
|
+
import { AppAuthContextProvider } from "./context";
|
|
2
|
+
import { AuthRolesService } from "./roles";
|
|
3
|
+
import { AuthUserRolesService } from "./userRoles";
|
|
4
|
+
import { AuthUserService } from "./users";
|
|
5
|
+
export declare const AuthProviders: (typeof AppAuthContextProvider | typeof AuthRolesService | typeof AuthUserRolesService | typeof AuthUserService)[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAuthRoleService } from "../../../../../../extensions";
|
|
2
|
+
import { RoleEntityManager } from "../../../../entities/roles/role.manager";
|
|
3
|
+
import { RoleEntity } from "../../../../database/core/entities/role.entity";
|
|
4
|
+
import { DeepPartial } from "../../../../../../../../types";
|
|
5
|
+
export declare class AuthRolesService implements IAuthRoleService<RoleEntity> {
|
|
6
|
+
private readonly rolesManager;
|
|
7
|
+
constructor(rolesManager: RoleEntityManager);
|
|
8
|
+
ensure(uid: string, data: DeepPartial<Omit<RoleEntity, "uid">>): Promise<RoleEntity>;
|
|
9
|
+
create(data: DeepPartial<RoleEntity>): Promise<RoleEntity>;
|
|
10
|
+
update(id: string, data: DeepPartial<RoleEntity>): Promise<void>;
|
|
11
|
+
delete(id: string): Promise<void>;
|
|
12
|
+
getById(id: string): Promise<RoleEntity | undefined>;
|
|
13
|
+
getByUid(uid: string): Promise<RoleEntity | undefined>;
|
|
14
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IAuthUserRolesService } from "
|
|
2
|
-
import { UserEntityManager } from "
|
|
3
|
-
import { UserRoleEntityManager } from "
|
|
4
|
-
import { RoleEntityManager } from "
|
|
5
|
-
import { RoleEntity } from "
|
|
6
|
-
import { UserEntity } from "
|
|
1
|
+
import { IAuthUserRolesService } from "../../../../../../extensions";
|
|
2
|
+
import { UserEntityManager } from "../../../../entities/users/user.manager";
|
|
3
|
+
import { UserRoleEntityManager } from "../../../../entities/userRoles/userRole.manager";
|
|
4
|
+
import { RoleEntityManager } from "../../../../entities/roles/role.manager";
|
|
5
|
+
import { RoleEntity } from "../../../../database/core/entities/role.entity";
|
|
6
|
+
import { UserEntity } from "../../../../database/core/entities/user.entity";
|
|
7
7
|
export declare class AuthUserRolesService implements IAuthUserRolesService<UserEntity, RoleEntity> {
|
|
8
8
|
private readonly rolesManager;
|
|
9
9
|
private readonly userManager;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IAuthUserService } from "../../../../../../extensions";
|
|
2
|
+
import { UserEntity } from "../../../../database/core/entities/user.entity";
|
|
3
|
+
import { UserEntityManager } from "../../../../entities/users/user.manager";
|
|
4
|
+
import { AppUserContext } from "../..";
|
|
5
|
+
import { OrganizationEntityManager } from "../../../../entities/organizations/organization.manager";
|
|
6
|
+
import { UserProfileEntityManager } from "../../../../entities/userProfiles/userProfile.manager";
|
|
7
|
+
import { AuthUserRegistrationData } from "../../models";
|
|
8
|
+
import { TenantEntityManager } from "../../../../entities/tenants/tenant.manager";
|
|
9
|
+
export declare class AuthUserService implements IAuthUserService<UserEntity, AppUserContext, AuthUserRegistrationData> {
|
|
10
|
+
private readonly userManager;
|
|
11
|
+
private readonly userProfileManager;
|
|
12
|
+
private readonly organizationsManager;
|
|
13
|
+
private readonly tenantsManager;
|
|
14
|
+
constructor(userManager: UserEntityManager, userProfileManager: UserProfileEntityManager, organizationsManager: OrganizationEntityManager, tenantsManager: TenantEntityManager);
|
|
15
|
+
getById(id: string): Promise<UserEntity>;
|
|
16
|
+
getByEmail(email: string, context?: AppUserContext | undefined): Promise<UserEntity>;
|
|
17
|
+
getByUserName(userName: string, context?: AppUserContext | undefined): Promise<UserEntity>;
|
|
18
|
+
update(id: string, data: Partial<UserEntity>): Promise<void>;
|
|
19
|
+
delete(id: string): Promise<void>;
|
|
20
|
+
create(email: string, userName: string, data: AuthUserRegistrationData, context?: AppUserContext | undefined): Promise<UserEntity>;
|
|
21
|
+
private resolveOrganization;
|
|
22
|
+
private resolveTenant;
|
|
23
|
+
}
|
package/dist/cjs/types/platforms/nest/__test__/server/infrastructure/authentication/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export type AppUserInfo = {
|
|
|
5
5
|
lastName: string;
|
|
6
6
|
};
|
|
7
7
|
export type AppUserContext = {
|
|
8
|
-
organizationUid
|
|
8
|
+
organizationUid?: string;
|
|
9
|
+
tenantUid: string;
|
|
9
10
|
};
|
|
10
11
|
export declare class AppAuthContext implements IAuthenticationContext<AppUserContext> {
|
|
11
12
|
isAuthenticated: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEntityActions, IEntityFacets, IEntitySearchParameters, SortingType } from "../../../abstractions";
|
|
2
2
|
import { IEntitiesDeleteParameters } from "../../../abstractions/commands";
|
|
3
3
|
import { EntityServiceLocator } from "../../../providers/services";
|
|
4
|
-
import { EntityManagerRegistry } from "../ioc
|
|
4
|
+
import { EntityManagerRegistry } from "../ioc";
|
|
5
5
|
export declare abstract class NestEntityActions<TEntity, TEntityId, TEntityCreateDto, TEntityUpdateDto, TEntityDto, TEntityListItemDto, TEntitiesDeleteParameters extends IEntitiesDeleteParameters<TSorting>, TEntitySearchParameters extends IEntitySearchParameters<TSorting, TCursor>, TSorting extends SortingType, TCursor, TFacets extends IEntityFacets> {
|
|
6
6
|
protected readonly services: EntityServiceLocator<TEntity, TEntityId>;
|
|
7
7
|
private actionsInstance;
|
|
@@ -41,14 +41,15 @@ export interface IAuthUserService<TUser extends IAuthUser, TUserContext extends
|
|
|
41
41
|
getByUserName(userName: string, context?: TUserContext): Promise<TUser>;
|
|
42
42
|
update(id: string, data: Partial<TUser>): Promise<void>;
|
|
43
43
|
delete(id: string): Promise<void>;
|
|
44
|
-
create(email: string, data: TUserRegistrationInfo, context?: TUserContext): Promise<TUser>;
|
|
44
|
+
create(email: string, userName: string, data: TUserRegistrationInfo, context?: TUserContext): Promise<TUser>;
|
|
45
45
|
}
|
|
46
46
|
export interface IAuthRoleService<TRole extends IAuthRole> {
|
|
47
47
|
create(data: Partial<TRole>): Promise<TRole>;
|
|
48
48
|
update(id: string, data: Partial<TRole>): Promise<void>;
|
|
49
|
+
ensure(uid: string, data: Partial<Omit<TRole, "uid">>): Promise<TRole>;
|
|
49
50
|
delete(id: string): Promise<void>;
|
|
50
51
|
getById(id: string): Promise<TRole | undefined>;
|
|
51
|
-
getByUid(
|
|
52
|
+
getByUid(uid: string): Promise<TRole | undefined>;
|
|
52
53
|
}
|
|
53
54
|
export interface IAuthUserRolesService<TUser extends IAuthUser, TRole extends IAuthRole> {
|
|
54
55
|
getRoleUsers(roleId: string): Promise<TUser[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UserCreationHandler } from "./user-create";
|
|
2
|
+
import { UserDeleteHandler } from "./user-delete";
|
|
1
3
|
import { UserDisableHandler } from "./user-disable";
|
|
2
4
|
import { UserEnableHandler } from "./user-enable";
|
|
3
5
|
import { UserLoginHandler } from "./user-login";
|
|
@@ -8,4 +10,4 @@ import { UserRegistrationHandler } from "./user-register";
|
|
|
8
10
|
import { UserTokenVerifyHandler } from "./user-token-verify";
|
|
9
11
|
import { UserVerifyCompleteHandler } from "./user-verify-complete";
|
|
10
12
|
import { UserVerifyRequestHandler } from "./user-verify-request";
|
|
11
|
-
export declare const UserHandlers: (typeof UserRegistrationHandler | typeof UserDisableHandler | typeof UserEnableHandler | typeof UserLoginHandler | typeof UserPasswordChangeHandler | typeof UserPasswordResetCompleteHandler | typeof UserPasswordResetRequestHandler | typeof UserVerifyCompleteHandler | typeof UserTokenVerifyHandler | typeof UserVerifyRequestHandler)[];
|
|
13
|
+
export declare const UserHandlers: (typeof UserRegistrationHandler | typeof UserDisableHandler | typeof UserEnableHandler | typeof UserLoginHandler | typeof UserPasswordChangeHandler | typeof UserPasswordResetCompleteHandler | typeof UserPasswordResetRequestHandler | typeof UserVerifyCompleteHandler | typeof UserTokenVerifyHandler | typeof UserVerifyRequestHandler | typeof UserCreationHandler | typeof UserDeleteHandler)[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export { UserCreationInput, UserCreationResult, UserCreationError, } from "./user-create/types";
|
|
1
2
|
export { UserDisableInput } from "./user-disable/types";
|
|
3
|
+
export { UserDeleteInput } from "./user-delete/types";
|
|
2
4
|
export { UserEnableInput } from "./user-enable/types";
|
|
3
5
|
export { UserLoginInput, UserLoginResult } from "./user-login/types";
|
|
4
6
|
export { UserPasswordChangeInput } from "./user-password-change/types";
|
package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-create/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
|
+
import { AuthenticationServicesResolver } from "../../resolver";
|
|
3
|
+
import { PasswordHashingProvider } from "../../providers/password-hasher";
|
|
4
|
+
import { UserCreationInput, UserCreationResult } from "./types";
|
|
5
|
+
export declare class UserCreationHandler {
|
|
6
|
+
private readonly services;
|
|
7
|
+
private readonly passwordHashingProvider;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
constructor(services: AuthenticationServicesResolver, passwordHashingProvider: PasswordHashingProvider);
|
|
10
|
+
execute<TUserRegistrationInfo, TContext extends IAuthUserContext>(input: UserCreationInput<TUserRegistrationInfo, TContext>): Promise<UserCreationResult>;
|
|
11
|
+
private createPasswordHash;
|
|
12
|
+
private createUser;
|
|
13
|
+
private resolveUser;
|
|
14
|
+
}
|
package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-create/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IAuthUserContext } from "../../abstractions";
|
|
2
|
+
export declare enum UserCreationError {
|
|
3
|
+
UserAlreadyExists = "userAlreadyExists"
|
|
4
|
+
}
|
|
5
|
+
export interface UserCreationInput<TUserRegistrationInfo, TUserContext extends IAuthUserContext> {
|
|
6
|
+
email: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
password: string;
|
|
9
|
+
registrationInfo: TUserRegistrationInfo;
|
|
10
|
+
context?: TUserContext;
|
|
11
|
+
}
|
|
12
|
+
export interface UserCreationResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
error?: UserCreationError;
|
|
15
|
+
userId?: string;
|
|
16
|
+
}
|
package/dist/cjs/types/platforms/nest/extensions/authentication/handlers/user-delete/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AuthenticationServicesResolver } from "../../resolver";
|
|
2
|
+
import { UserDeleteInput } from "./types";
|
|
3
|
+
export declare class UserDeleteHandler {
|
|
4
|
+
private readonly services;
|
|
5
|
+
constructor(services: AuthenticationServicesResolver);
|
|
6
|
+
execute(input: UserDeleteInput): Promise<void>;
|
|
7
|
+
}
|
package/dist/cjs/types/platforms/nest/extensions/authentication/services/authentication/index.d.ts
CHANGED
|
@@ -20,8 +20,13 @@ import { UserTokenVerifyInput, UserTokenVerifyResult } from "../../handlers/user
|
|
|
20
20
|
import { UserVerifyCompleteInput } from "../../handlers/user-verify-complete/types";
|
|
21
21
|
import { UserVerifyRequestInput, UserVerifyRequestResult } from "../../handlers/user-verify-request/types";
|
|
22
22
|
import { AuthenticationServicesResolver } from "../../resolver";
|
|
23
|
+
import { UserCreationHandler } from "../../handlers/user-create";
|
|
24
|
+
import { UserCreationInput, UserDeleteInput } from "../../handlers";
|
|
25
|
+
import { UserDeleteHandler } from "../../handlers/user-delete";
|
|
23
26
|
export declare class AuthenticationService implements IAuthService {
|
|
27
|
+
private readonly userCreationHandler;
|
|
24
28
|
private readonly userDisableHandler;
|
|
29
|
+
private readonly userDeleteHandler;
|
|
25
30
|
private readonly userEnableHandler;
|
|
26
31
|
private readonly userLoginHandler;
|
|
27
32
|
private readonly userPasswordChangeHandler;
|
|
@@ -32,8 +37,10 @@ export declare class AuthenticationService implements IAuthService {
|
|
|
32
37
|
private readonly userVerifyRequestHandler;
|
|
33
38
|
private readonly userVerifyCompleteHandler;
|
|
34
39
|
private readonly resolver;
|
|
35
|
-
constructor(userDisableHandler: UserDisableHandler, userEnableHandler: UserEnableHandler, userLoginHandler: UserLoginHandler, userPasswordChangeHandler: UserPasswordChangeHandler, userPasswordResetFinalizeHandler: UserPasswordResetCompleteHandler, userPasswordResetRequestHandler: UserPasswordResetRequestHandler, userRegistrationHandler: UserRegistrationHandler, userTokenVerifyHandler: UserTokenVerifyHandler, userVerifyRequestHandler: UserVerifyRequestHandler, userVerifyCompleteHandler: UserVerifyCompleteHandler, resolver: AuthenticationServicesResolver);
|
|
40
|
+
constructor(userCreationHandler: UserCreationHandler, userDisableHandler: UserDisableHandler, userDeleteHandler: UserDeleteHandler, userEnableHandler: UserEnableHandler, userLoginHandler: UserLoginHandler, userPasswordChangeHandler: UserPasswordChangeHandler, userPasswordResetFinalizeHandler: UserPasswordResetCompleteHandler, userPasswordResetRequestHandler: UserPasswordResetRequestHandler, userRegistrationHandler: UserRegistrationHandler, userTokenVerifyHandler: UserTokenVerifyHandler, userVerifyRequestHandler: UserVerifyRequestHandler, userVerifyCompleteHandler: UserVerifyCompleteHandler, resolver: AuthenticationServicesResolver);
|
|
41
|
+
userCreate<TUserRegistrationInfo, TUserContext extends IAuthUserContext>(input: UserCreationInput<TUserRegistrationInfo, TUserContext>): Promise<import("../../handlers").UserCreationResult>;
|
|
36
42
|
userDisable(input: UserDisableInput): Promise<void>;
|
|
43
|
+
userDelete(input: UserDeleteInput): Promise<void>;
|
|
37
44
|
userEnable(input: UserEnableInput): Promise<void>;
|
|
38
45
|
userLogin<TUserContext extends IAuthUserContext>(input: UserLoginInput<TUserContext>): Promise<UserLoginResult>;
|
|
39
46
|
userPasswordChange(input: UserPasswordChangeInput): Promise<void>;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { EntityManagerRegistry } from "./ioc/registry";
|
|
3
|
+
export declare class EntityManagerModule implements OnModuleInit {
|
|
4
|
+
private readonly registry;
|
|
5
|
+
constructor(registry: EntityManagerRegistry);
|
|
6
|
+
onModuleInit(): void;
|
|
2
7
|
}
|
|
@@ -7,7 +7,7 @@ export interface IPipelineStepOperationBuilder<TStepInput, TStepOutput, TPipelin
|
|
|
7
7
|
}
|
|
8
8
|
export interface IPipelineStepBuilder<TStepInput, TStepOutput, TPipelineInput, TContext> {
|
|
9
9
|
addStep<TNextStepOutput>(builder: (step: IPipelineStepOperationBuilder<TStepOutput, TNextStepOutput, TPipelineInput, TContext>) => void): IPipelineStepBuilder<TStepOutput, TNextStepOutput, TPipelineInput, TContext>;
|
|
10
|
-
|
|
10
|
+
complete(): PipelineDefinition<TPipelineInput, TStepOutput, TContext>;
|
|
11
11
|
}
|
|
12
12
|
export interface IPipelineTemplateBuilder<TPipelineInput, TContext> {
|
|
13
13
|
addStep<TStepOutput>(builder: (step: IPipelineStepOperationBuilder<TPipelineInput, TStepOutput, TPipelineInput, TContext>) => void): IPipelineStepBuilder<TPipelineInput, TStepOutput, TPipelineInput, TContext>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PipelineErrorType } from "../../../../types";
|
|
2
|
+
export declare class PipelineInvocationError extends Error {
|
|
3
|
+
readonly errorType: PipelineErrorType;
|
|
4
|
+
readonly innerError: Error | undefined;
|
|
5
|
+
constructor(errorType: PipelineErrorType, innerError: Error | undefined, message?: string);
|
|
6
|
+
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { PipelineDefinition, PipelineResult } from "../../../../types";
|
|
2
|
-
import { EntityManagerRegistry } from "../../ioc";
|
|
3
2
|
import { IPipelineTemplateBuilder } from "../builder/types";
|
|
3
|
+
import { PipelineUtils } from "./utils";
|
|
4
|
+
import { PipelineTemplateProps } from "../../decorators";
|
|
4
5
|
export declare abstract class NestPipelineTemplate<TPipelineInput, TPipelineOutput, TContext> {
|
|
5
|
-
|
|
6
|
+
private readonly logger;
|
|
7
|
+
protected readonly utils: PipelineUtils<TPipelineInput, TPipelineOutput, TContext>;
|
|
6
8
|
private cachedDefinition;
|
|
7
|
-
constructor(registry: EntityManagerRegistry);
|
|
8
9
|
protected abstract buildTemplate(builder: IPipelineTemplateBuilder<TPipelineInput, TContext>): PipelineDefinition<TPipelineInput, TPipelineOutput, TContext>;
|
|
9
10
|
protected isAuthorized(context: TContext): boolean;
|
|
11
|
+
invoke(input: TPipelineInput): Promise<TPipelineOutput>;
|
|
10
12
|
execute(data: {
|
|
11
13
|
input: TPipelineInput;
|
|
12
14
|
context: TContext;
|
|
13
15
|
}): Promise<PipelineResult<TPipelineInput, TPipelineOutput>>;
|
|
14
16
|
private getDefinition;
|
|
15
17
|
private buildDefinition;
|
|
18
|
+
private getContext;
|
|
16
19
|
private get controller();
|
|
20
|
+
private get registry();
|
|
21
|
+
protected get metadata(): PipelineTemplateProps;
|
|
17
22
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PipelineCompletedStepState } from "../../../../types";
|
|
2
|
+
export declare class PipelineUtils<TPipelineInput, TPipelineOutput, TContext> {
|
|
3
|
+
getStep: (step: PipelineCompletedStepState<TPipelineInput, TContext, unknown, unknown>, index: number) => PipelineCompletedStepState<TPipelineInput, TContext, unknown, unknown>;
|
|
4
|
+
getStepInput: <TStepInput>(step: PipelineCompletedStepState<TPipelineInput, TContext, unknown, unknown>, index: number) => TStepInput;
|
|
5
|
+
getStepOutput: <TStepOutput>(step: PipelineCompletedStepState<TPipelineInput, TContext, unknown, unknown>, index: number) => TStepOutput;
|
|
6
|
+
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
import { AsyncLocalStorage } from "async_hooks";
|
|
4
4
|
import { Request, Response } from "express";
|
|
5
5
|
import { AppSession } from "./session";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const sessionStorage: AsyncLocalStorage<AppSession<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, Response<any, Record<string, any>>>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PipelineOperationError, PipelineOperationResult, PipelineStepResult } from "../../../types";
|
|
1
|
+
import { PipelineErrorType, PipelineOperationError, PipelineOperationResult, PipelineStepErrorType, PipelineStepResult } from "../../../types";
|
|
2
2
|
export declare const toPipelineOperationError: (error: Error) => PipelineOperationError;
|
|
3
3
|
export declare const getStepOutput: <TStepInput, TStepOutput>(result: PipelineStepResult<TStepInput, TStepOutput>) => TStepOutput | undefined;
|
|
4
4
|
export declare const getOperationOutput: <TStepInput, TStepOutput>(result: PipelineOperationResult<TStepInput, TStepOutput>) => TStepOutput | undefined;
|
|
5
|
+
export declare const mapPipelineErrorType: (stepError: PipelineStepErrorType) => PipelineErrorType;
|
|
@@ -57,6 +57,12 @@ export type PipelineOperationRollbackResult = {
|
|
|
57
57
|
error: PipelineOperationError;
|
|
58
58
|
};
|
|
59
59
|
export type PipelineOperationRollbackResultType = PipelineOperationRollbackResult["type"];
|
|
60
|
+
export declare enum PipelineStepErrorType {
|
|
61
|
+
FailedPrecondition = "failedPrecondition",
|
|
62
|
+
OperationError = "operationError",
|
|
63
|
+
RollbackError = "rollbackError",
|
|
64
|
+
GenericError = "genericError"
|
|
65
|
+
}
|
|
60
66
|
export type PipelineStepResult<TStepInput, TStepOutput> = {
|
|
61
67
|
input: TStepInput;
|
|
62
68
|
operationResults: PipelineOperationResult<unknown, unknown>[];
|
|
@@ -65,8 +71,7 @@ export type PipelineStepResult<TStepInput, TStepOutput> = {
|
|
|
65
71
|
output: TStepOutput;
|
|
66
72
|
} | {
|
|
67
73
|
type: "error";
|
|
68
|
-
|
|
69
|
-
type: "preconditionFailed";
|
|
74
|
+
errorType: PipelineStepErrorType;
|
|
70
75
|
});
|
|
71
76
|
export type PipelineStepResultType = PipelineStepResult<unknown, unknown>["type"];
|
|
72
77
|
export type PipelineStepRollbackResult = {} & ({
|
|
@@ -75,6 +80,13 @@ export type PipelineStepRollbackResult = {} & ({
|
|
|
75
80
|
type: "error";
|
|
76
81
|
});
|
|
77
82
|
export type PipelineStepRollbackResultType = PipelineStepRollbackResult["type"];
|
|
83
|
+
export declare enum PipelineErrorType {
|
|
84
|
+
FailedPrecondition = "failedPrecondition",
|
|
85
|
+
OperationError = "operationError",
|
|
86
|
+
RollbackError = "rollbackError",
|
|
87
|
+
Unauthorized = "unauthorized",
|
|
88
|
+
GenericError = "genericError"
|
|
89
|
+
}
|
|
78
90
|
export type PipelineResult<TPipelineInput, TPipelineOutput> = {
|
|
79
91
|
stepResults: PipelineStepResult<unknown, unknown>[];
|
|
80
92
|
input: TPipelineInput;
|
|
@@ -83,6 +95,8 @@ export type PipelineResult<TPipelineInput, TPipelineOutput> = {
|
|
|
83
95
|
output: TPipelineOutput;
|
|
84
96
|
} | {
|
|
85
97
|
type: "error";
|
|
98
|
+
errorType: PipelineErrorType;
|
|
99
|
+
exception?: Error;
|
|
86
100
|
output?: TPipelineOutput;
|
|
87
101
|
});
|
|
88
102
|
export type PipelineResultType = PipelineResult<unknown, unknown>["type"];
|