@punks/backend-entity-manager 0.0.71 → 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 +793 -37
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/__test__/entity/foo.d.ts +7 -2
- package/dist/cjs/types/__test__/providers/typeorm/entity/foo.d.ts +14 -2
- package/dist/cjs/types/abstractions/actions.d.ts +21 -8
- package/dist/cjs/types/abstractions/adapters.d.ts +3 -2
- package/dist/cjs/types/abstractions/authorization.d.ts +6 -4
- package/dist/cjs/types/abstractions/commands.d.ts +11 -0
- package/dist/cjs/types/abstractions/errors.d.ts +3 -2
- package/dist/cjs/types/abstractions/index.d.ts +2 -1
- package/dist/cjs/types/abstractions/manager.d.ts +12 -9
- package/dist/cjs/types/abstractions/pipelines.d.ts +10 -0
- package/dist/cjs/types/abstractions/queries.d.ts +11 -1
- package/dist/cjs/types/abstractions/repository.d.ts +9 -5
- package/dist/cjs/types/actions/count.d.ts +8 -0
- package/dist/cjs/types/actions/deleteItems.d.ts +8 -0
- package/dist/cjs/types/actions/exists.d.ts +8 -0
- package/dist/cjs/types/authorization/allowAll.d.ts +1 -0
- package/dist/cjs/types/commands/deleteItems.d.ts +9 -0
- package/dist/cjs/types/concrete/index.d.ts +23 -17
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/integrations/repository/typeorm/queryBuilder.d.ts +4 -0
- package/dist/cjs/types/integrations/repository/typeorm/repository.d.ts +4 -4
- 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/companies/company.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/divisions/division.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/organization.actions.d.ts +2 -2
- 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/index.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/index.d.ts +18 -0
- 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/roles/role.actions.d.ts +2 -2
- 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.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/tenants/tenant.controller.d.ts +7 -1
- package/dist/cjs/types/platforms/nest/__test__/server/app/userGroupMembers/userGroupMember.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/userGroups/userGroup.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/userProfiles/userProfile.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/userRoles/userRole.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/users/user.actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/companies/company.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/companies/company.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/companies/company.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/companies/company.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/divisions/division.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/divisions/division.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/divisions/division.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/divisions/division.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/actions.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/models.d.ts +13 -1
- package/dist/cjs/types/platforms/nest/__test__/server/entities/organizations/organization.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/organizations/organization.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/organizations/organization.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/organizations/organization.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/roles/role.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/tenants/tenant.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/tenants/tenant.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/tenants/tenant.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/tenants/tenant.models.d.ts +10 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.models.d.ts +5 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroups/userGroup.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroups/userGroup.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroups/userGroup.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userGroups/userGroup.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/userRoles/userRole.models.d.ts +8 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/users/user.adapter.d.ts +3 -3
- package/dist/cjs/types/platforms/nest/__test__/server/entities/users/user.authentication.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/__test__/server/entities/users/user.manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/users/user.models.d.ts +8 -3
- 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/processors/entity-auth/index.d.ts +1 -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/authentication/entityAuthorizationMiddleware.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/base/entityActions.d.ts +4 -3
- package/dist/cjs/types/platforms/nest/base/entityManager.d.ts +3 -2
- package/dist/cjs/types/platforms/nest/decorators/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/decorators/pipelines.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/decorators/symbols.d.ts +1 -0
- 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/index.d.ts +1 -0
- 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/concrete.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/pipelines/builder/index.d.ts +7 -0
- package/dist/cjs/types/platforms/nest/pipelines/builder/types.d.ts +14 -0
- package/dist/cjs/types/platforms/nest/pipelines/index.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/pipelines/providers.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/pipelines/runner/index.d.ts +11 -0
- package/dist/cjs/types/platforms/nest/pipelines/template/errors.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/pipelines/template/index.d.ts +22 -0
- package/dist/cjs/types/platforms/nest/pipelines/template/utils.d.ts +6 -0
- package/dist/cjs/types/platforms/nest/processors/initializer/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/services/manager/index.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/session/storage.d.ts +1 -1
- package/dist/cjs/types/providers/services.d.ts +31 -10
- package/dist/cjs/types/queries/count.d.ts +10 -0
- package/dist/cjs/types/queries/exists.d.ts +10 -0
- package/dist/cjs/types/symbols/ioc.d.ts +9 -0
- package/dist/cjs/types/templates/index.d.ts +1 -0
- package/dist/cjs/types/templates/pipelines/controller/index.d.ts +5 -0
- package/dist/cjs/types/templates/pipelines/converters/index.d.ts +5 -0
- package/dist/cjs/types/templates/pipelines/index.d.ts +1 -0
- package/dist/cjs/types/templates/pipelines/instance/index.d.ts +19 -0
- package/dist/{esm/types/templates/queryBuilder.d.ts → cjs/types/templates/queryBuilder/index.d.ts} +7 -3
- package/dist/cjs/types/testing/mocks/repository.d.ts +2 -2
- package/dist/cjs/types/types/index.d.ts +2 -0
- package/dist/cjs/types/types/objects.d.ts +4 -0
- package/dist/cjs/types/types/pipelines.d.ts +109 -0
- package/dist/esm/index.js +792 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/__test__/entity/foo.d.ts +7 -2
- package/dist/esm/types/__test__/providers/typeorm/entity/foo.d.ts +14 -2
- package/dist/esm/types/abstractions/actions.d.ts +21 -8
- package/dist/esm/types/abstractions/adapters.d.ts +3 -2
- package/dist/esm/types/abstractions/authorization.d.ts +6 -4
- package/dist/esm/types/abstractions/commands.d.ts +11 -0
- package/dist/esm/types/abstractions/errors.d.ts +3 -2
- package/dist/esm/types/abstractions/index.d.ts +2 -1
- package/dist/esm/types/abstractions/manager.d.ts +12 -9
- package/dist/esm/types/abstractions/pipelines.d.ts +10 -0
- package/dist/esm/types/abstractions/queries.d.ts +11 -1
- package/dist/esm/types/abstractions/repository.d.ts +9 -5
- package/dist/esm/types/actions/count.d.ts +8 -0
- package/dist/esm/types/actions/deleteItems.d.ts +8 -0
- package/dist/esm/types/actions/exists.d.ts +8 -0
- package/dist/esm/types/authorization/allowAll.d.ts +1 -0
- package/dist/esm/types/commands/deleteItems.d.ts +9 -0
- package/dist/esm/types/concrete/index.d.ts +23 -17
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/integrations/repository/typeorm/queryBuilder.d.ts +4 -0
- package/dist/esm/types/integrations/repository/typeorm/repository.d.ts +4 -4
- 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/companies/company.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/divisions/division.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/organizations/organization.actions.d.ts +2 -2
- 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/index.d.ts +2 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/organizations/templates/organization-register/index.d.ts +18 -0
- 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/roles/role.actions.d.ts +2 -2
- 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/templates/tenant-initialize/pipeline.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/tenant.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/tenants/tenant.controller.d.ts +7 -1
- package/dist/esm/types/platforms/nest/__test__/server/app/userGroupMembers/userGroupMember.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/userGroups/userGroup.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/userProfiles/userProfile.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/userRoles/userRole.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/users/user.actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/companies/company.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/companies/company.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/companies/company.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/companies/company.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/divisions/division.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/divisions/division.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/divisions/division.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/divisions/division.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/actions.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/models.d.ts +13 -1
- package/dist/esm/types/platforms/nest/__test__/server/entities/organizations/organization.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/organizations/organization.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/organizations/organization.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/organizations/organization.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/roles/role.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/tenants/tenant.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/tenants/tenant.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/tenants/tenant.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/tenants/tenant.models.d.ts +10 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroupMembers/userGroupMember.models.d.ts +5 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroups/userGroup.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroups/userGroup.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroups/userGroup.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/userGroups/userGroup.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/userProfiles/userProfile.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/userRoles/userRole.models.d.ts +8 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/users/user.adapter.d.ts +3 -3
- package/dist/esm/types/platforms/nest/__test__/server/entities/users/user.authentication.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/server/entities/users/user.manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/users/user.models.d.ts +8 -3
- 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/processors/entity-auth/index.d.ts +1 -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/authentication/auth-api.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/authentication/auth-guards.test.d.ts +1 -0
- package/dist/esm/types/platforms/nest/__test__/tests/authentication/auth-jwt.test.d.ts +1 -0
- 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/authentication/entityAuthorizationMiddleware.d.ts +1 -0
- package/dist/esm/types/platforms/nest/base/entityActions.d.ts +4 -3
- package/dist/esm/types/platforms/nest/base/entityManager.d.ts +3 -2
- package/dist/esm/types/platforms/nest/decorators/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/decorators/pipelines.d.ts +4 -0
- package/dist/esm/types/platforms/nest/decorators/symbols.d.ts +1 -0
- 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/index.d.ts +1 -0
- 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/concrete.d.ts +4 -0
- package/dist/esm/types/platforms/nest/pipelines/builder/index.d.ts +7 -0
- package/dist/esm/types/platforms/nest/pipelines/builder/types.d.ts +14 -0
- package/dist/esm/types/platforms/nest/pipelines/index.d.ts +2 -0
- package/dist/esm/types/platforms/nest/pipelines/providers.d.ts +3 -0
- package/dist/esm/types/platforms/nest/pipelines/runner/index.d.ts +11 -0
- package/dist/esm/types/platforms/nest/pipelines/template/errors.d.ts +6 -0
- package/dist/esm/types/platforms/nest/pipelines/template/index.d.ts +22 -0
- package/dist/esm/types/platforms/nest/pipelines/template/utils.d.ts +6 -0
- package/dist/esm/types/platforms/nest/processors/initializer/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/services/manager/index.d.ts +2 -2
- package/dist/esm/types/platforms/nest/session/storage.d.ts +1 -1
- package/dist/esm/types/providers/services.d.ts +31 -10
- package/dist/esm/types/queries/count.d.ts +10 -0
- package/dist/esm/types/queries/exists.d.ts +10 -0
- package/dist/esm/types/symbols/ioc.d.ts +9 -0
- package/dist/esm/types/templates/index.d.ts +1 -0
- package/dist/esm/types/templates/pipelines/controller/index.d.ts +5 -0
- package/dist/esm/types/templates/pipelines/converters/index.d.ts +5 -0
- package/dist/esm/types/templates/pipelines/index.d.ts +1 -0
- package/dist/esm/types/templates/pipelines/instance/index.d.ts +19 -0
- package/dist/{cjs/types/templates/queryBuilder.d.ts → esm/types/templates/queryBuilder/index.d.ts} +7 -3
- package/dist/esm/types/testing/mocks/repository.d.ts +2 -2
- package/dist/esm/types/types/index.d.ts +2 -0
- package/dist/esm/types/types/objects.d.ts +4 -0
- package/dist/esm/types/types/pipelines.d.ts +109 -0
- package/dist/index.d.ts +342 -69
- 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/{esm/types/__test__/base/test-actions-plain.test.d.ts → cjs/types/platforms/nest/__test__/tests/base/crud-operations.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/base/test-actions-with-converters.test.d.ts → cjs/types/platforms/nest/__test__/tests/base/seeder.test.d.ts} +0 -0
- /package/dist/{esm/types/__test__/base/test-default-entity-manager.test.d.ts → cjs/types/platforms/nest/__test__/tests/base/server-session.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/crud_pipeline_api.test.d.ts} +0 -0
- /package/dist/{esm/types/platforms/nest/__test__/tests/authentication/test_auth_api.test.d.ts → cjs/types/platforms/nest/__test__/tests/pipelines/crud_pipeline_template.test.d.ts} +0 -0
- /package/dist/{esm/types/platforms/nest/__test__/tests/authentication/test_auth_guards.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_jwt.test.d.ts → __test__/base/actions-plain.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/base/test_crud_actions.test.d.ts → __test__/base/actions-with-converters.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/base/test_crud_api.test.d.ts → __test__/base/default-entity-manager.test.d.ts} +0 -0
- /package/dist/esm/types/{platforms/nest/__test__/tests/base/test_crud_operations.test.d.ts → __test__/providers/typeorm/typeorm-actions.test.d.ts} +0 -0
- /package/dist/esm/types/platforms/nest/__test__/{tests/base/test_seeder.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_server_session.test.d.ts → server/app/tenants/templates/instance-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/cjs/index.js
CHANGED
|
@@ -122,12 +122,11 @@ class NestEntityActions {
|
|
|
122
122
|
constructor(entityName, registry) {
|
|
123
123
|
this.services = registry.resolveEntityServicesCollection(entityName);
|
|
124
124
|
}
|
|
125
|
-
get
|
|
125
|
+
get manager() {
|
|
126
126
|
if (!this.actionsInstance) {
|
|
127
127
|
this.actionsInstance =
|
|
128
128
|
this.services.resolveEntityActions();
|
|
129
129
|
}
|
|
130
|
-
this.services.resolveEntityActions;
|
|
131
130
|
return this.actionsInstance;
|
|
132
131
|
}
|
|
133
132
|
}
|
|
@@ -137,7 +136,7 @@ class NestEntityManager {
|
|
|
137
136
|
constructor(entityName, registry) {
|
|
138
137
|
this.services = registry.resolveEntityServicesCollection(entityName);
|
|
139
138
|
}
|
|
140
|
-
get
|
|
139
|
+
get manager() {
|
|
141
140
|
if (!this.managerInstance) {
|
|
142
141
|
this.managerInstance =
|
|
143
142
|
this.services.resolveEntityManager();
|
|
@@ -161,6 +160,7 @@ const EntityManagerSymbols = {
|
|
|
161
160
|
EntitySeeder: Symbol.for("WP:ENTITY_SEEDER"),
|
|
162
161
|
EmailProvider: Symbol.for("WP:EMAIL_PROVIDER"),
|
|
163
162
|
EmailTemplate: Symbol.for("WP:EMAIL_TEMPLATE"),
|
|
163
|
+
PipelineTemplate: Symbol.for("WP:PIPELINE_TEMPLATE"),
|
|
164
164
|
};
|
|
165
165
|
|
|
166
166
|
const WpEntityAuthMiddleware = (entityName, props = {}) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.EntityAuthMiddleware, {
|
|
@@ -217,6 +217,11 @@ const WpEntityQueryBuilder = (entityName, props = {}) => common.applyDecorators(
|
|
|
217
217
|
...props,
|
|
218
218
|
}));
|
|
219
219
|
|
|
220
|
+
const WpPipeline = (name, props = {}) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.PipelineTemplate, {
|
|
221
|
+
name,
|
|
222
|
+
...props,
|
|
223
|
+
}));
|
|
224
|
+
|
|
220
225
|
const WpEntitySeeder = (entityName, props = {}) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.EntitySeeder, {
|
|
221
226
|
entityName,
|
|
222
227
|
...props,
|
|
@@ -428,7 +433,12 @@ exports.AuthGuard = __decorate([
|
|
|
428
433
|
__metadata("design:paramtypes", [core.Reflector])
|
|
429
434
|
], exports.AuthGuard);
|
|
430
435
|
|
|
431
|
-
|
|
436
|
+
exports.UserCreationError = void 0;
|
|
437
|
+
(function (UserCreationError) {
|
|
438
|
+
UserCreationError["UserAlreadyExists"] = "userAlreadyExists";
|
|
439
|
+
})(exports.UserCreationError || (exports.UserCreationError = {}));
|
|
440
|
+
|
|
441
|
+
const sessionStorage = new async_hooks.AsyncLocalStorage();
|
|
432
442
|
|
|
433
443
|
exports.AppSessionService = class AppSessionService {
|
|
434
444
|
getValue(key) {
|
|
@@ -444,7 +454,7 @@ exports.AppSessionService = class AppSessionService {
|
|
|
444
454
|
return this.getSession().request;
|
|
445
455
|
}
|
|
446
456
|
getSession() {
|
|
447
|
-
const store =
|
|
457
|
+
const store = sessionStorage.getStore();
|
|
448
458
|
if (!store) {
|
|
449
459
|
throw new Error("No active context found");
|
|
450
460
|
}
|
|
@@ -467,6 +477,15 @@ exports.AppHashingService = __decorate([
|
|
|
467
477
|
common.Injectable()
|
|
468
478
|
], exports.AppHashingService);
|
|
469
479
|
|
|
480
|
+
class EntitiesCountAction {
|
|
481
|
+
constructor(services) {
|
|
482
|
+
this.services = services;
|
|
483
|
+
}
|
|
484
|
+
async execute(filters) {
|
|
485
|
+
return await this.services.resolveCountQuery().execute(filters);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
470
489
|
class EntityCreateAction {
|
|
471
490
|
constructor(services) {
|
|
472
491
|
this.services = services;
|
|
@@ -494,6 +513,24 @@ class EntityDeleteAction {
|
|
|
494
513
|
}
|
|
495
514
|
}
|
|
496
515
|
|
|
516
|
+
class EntitiesDeleteAction {
|
|
517
|
+
constructor(services) {
|
|
518
|
+
this.services = services;
|
|
519
|
+
}
|
|
520
|
+
async execute(params) {
|
|
521
|
+
await this.services.resolveDeleteItemsCommand().execute(params);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
class EntityExistsAction {
|
|
526
|
+
constructor(services) {
|
|
527
|
+
this.services = services;
|
|
528
|
+
}
|
|
529
|
+
async execute(filters) {
|
|
530
|
+
return await this.services.resolveExistsQuery().execute(filters);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
497
534
|
class EntityGetAction {
|
|
498
535
|
constructor(services) {
|
|
499
536
|
this.services = services;
|
|
@@ -578,7 +615,10 @@ class EntityCreateCommand {
|
|
|
578
615
|
return;
|
|
579
616
|
}
|
|
580
617
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
581
|
-
const context = await contextService
|
|
618
|
+
const context = await contextService?.getContext();
|
|
619
|
+
if (!context) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
582
622
|
const authorizationResult = await authorization.canCreate(entity, context);
|
|
583
623
|
if (!authorizationResult.isAuthorized)
|
|
584
624
|
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Create, this.services.getEntityName(), entity);
|
|
@@ -604,13 +644,53 @@ class EntityDeleteCommand {
|
|
|
604
644
|
throw new EntityNotFoundException(id);
|
|
605
645
|
}
|
|
606
646
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
607
|
-
const context = await contextService
|
|
647
|
+
const context = await contextService?.getContext();
|
|
648
|
+
if (!context) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
608
651
|
const authorizationResult = await authorization.canDelete(entity, context);
|
|
609
652
|
if (!authorizationResult.isAuthorized)
|
|
610
653
|
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Delete, this.services.getEntityName(), entity);
|
|
611
654
|
}
|
|
612
655
|
}
|
|
613
656
|
|
|
657
|
+
class EntitiesDeleteCommand {
|
|
658
|
+
constructor(services) {
|
|
659
|
+
this.services = services;
|
|
660
|
+
}
|
|
661
|
+
async execute(params) {
|
|
662
|
+
await this.authorize();
|
|
663
|
+
const context = await this.getContext();
|
|
664
|
+
const deleteResult = await this.services
|
|
665
|
+
.resolveQueryBuilder()
|
|
666
|
+
.delete(params.filters, context);
|
|
667
|
+
// todo: add entities deleted event
|
|
668
|
+
return deleteResult;
|
|
669
|
+
}
|
|
670
|
+
async getContext() {
|
|
671
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
672
|
+
if (!authorization) {
|
|
673
|
+
return undefined;
|
|
674
|
+
}
|
|
675
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
676
|
+
return await contextService.getContext();
|
|
677
|
+
}
|
|
678
|
+
async authorize() {
|
|
679
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
680
|
+
if (!authorization) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
684
|
+
const context = await contextService?.getContext();
|
|
685
|
+
if (!context) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const authorizationResult = await authorization.canDeleteItems(context);
|
|
689
|
+
if (!authorizationResult.isAuthorized)
|
|
690
|
+
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Delete, this.services.getEntityName());
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
614
694
|
class EntityUpdateCommand {
|
|
615
695
|
constructor(services) {
|
|
616
696
|
this.services = services;
|
|
@@ -642,7 +722,10 @@ class EntityUpdateCommand {
|
|
|
642
722
|
throw new EntityNotFoundException();
|
|
643
723
|
}
|
|
644
724
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
645
|
-
const context = await contextService
|
|
725
|
+
const context = await contextService?.getContext();
|
|
726
|
+
if (!context) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
646
729
|
const authorizationResult = await authorization.canUpdate(currentEntity, context);
|
|
647
730
|
if (!authorizationResult.isAuthorized)
|
|
648
731
|
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Create, this.services.getEntityName(), currentEntity);
|
|
@@ -678,7 +761,10 @@ class EntityUpsertCommand {
|
|
|
678
761
|
}
|
|
679
762
|
const currentEntity = await this.services.resolveRepository().get(id);
|
|
680
763
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
681
|
-
const context = await contextService
|
|
764
|
+
const context = await contextService?.getContext();
|
|
765
|
+
if (!context) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
682
768
|
if (currentEntity) {
|
|
683
769
|
const updateResult = await authorization.canUpdate(currentEntity, context);
|
|
684
770
|
if (!updateResult.isAuthorized)
|
|
@@ -695,23 +781,31 @@ class EntityManager {
|
|
|
695
781
|
constructor(services) {
|
|
696
782
|
this.services = services;
|
|
697
783
|
}
|
|
698
|
-
get() {
|
|
784
|
+
get exists() {
|
|
785
|
+
return this.services.resolveExistsQuery();
|
|
786
|
+
}
|
|
787
|
+
get count() {
|
|
788
|
+
return this.services.resolveCountQuery();
|
|
789
|
+
}
|
|
790
|
+
get deleteItems() {
|
|
791
|
+
return this.services.resolveDeleteItemsCommand();
|
|
792
|
+
}
|
|
793
|
+
get get() {
|
|
699
794
|
return this.services.resolveGetQuery();
|
|
700
795
|
}
|
|
701
|
-
|
|
702
|
-
search() {
|
|
796
|
+
get search() {
|
|
703
797
|
return this.services.resolveSearchQuery();
|
|
704
798
|
}
|
|
705
|
-
create() {
|
|
799
|
+
get create() {
|
|
706
800
|
return this.services.resolveCreateCommand();
|
|
707
801
|
}
|
|
708
|
-
update() {
|
|
802
|
+
get update() {
|
|
709
803
|
return this.services.resolveUpdateCommand();
|
|
710
804
|
}
|
|
711
|
-
upsert() {
|
|
805
|
+
get upsert() {
|
|
712
806
|
return this.services.resolveUpsertCommand();
|
|
713
807
|
}
|
|
714
|
-
delete() {
|
|
808
|
+
get delete() {
|
|
715
809
|
return this.services.resolveDeleteCommand();
|
|
716
810
|
}
|
|
717
811
|
}
|
|
@@ -719,22 +813,31 @@ class EntityActions {
|
|
|
719
813
|
constructor(services) {
|
|
720
814
|
this.services = services;
|
|
721
815
|
}
|
|
722
|
-
get() {
|
|
816
|
+
get exists() {
|
|
817
|
+
return this.services.resolveExistsAction();
|
|
818
|
+
}
|
|
819
|
+
get count() {
|
|
820
|
+
return this.services.resolveCountAction();
|
|
821
|
+
}
|
|
822
|
+
get deleteItems() {
|
|
823
|
+
return this.services.resolveDeleteItemsAction();
|
|
824
|
+
}
|
|
825
|
+
get get() {
|
|
723
826
|
return this.services.resolveGetAction();
|
|
724
827
|
}
|
|
725
|
-
search() {
|
|
828
|
+
get search() {
|
|
726
829
|
return this.services.resolveSearchAction();
|
|
727
830
|
}
|
|
728
|
-
create() {
|
|
831
|
+
get create() {
|
|
729
832
|
return this.services.resolveCreateAction();
|
|
730
833
|
}
|
|
731
|
-
update() {
|
|
834
|
+
get update() {
|
|
732
835
|
return this.services.resolveUpdateAction();
|
|
733
836
|
}
|
|
734
|
-
upsert() {
|
|
837
|
+
get upsert() {
|
|
735
838
|
return this.services.resolveUpsertAction();
|
|
736
839
|
}
|
|
737
|
-
delete() {
|
|
840
|
+
get delete() {
|
|
738
841
|
return this.services.resolveDeleteAction();
|
|
739
842
|
}
|
|
740
843
|
}
|
|
@@ -780,6 +883,9 @@ class ServiceLocator {
|
|
|
780
883
|
const EntityServices = {
|
|
781
884
|
Actions: {
|
|
782
885
|
IEntityGetAction: "IEntityGetAction",
|
|
886
|
+
IEntityExistsAction: "IEntityExistsAction",
|
|
887
|
+
IEntitiesCountAction: "IEntitiesCountAction",
|
|
888
|
+
IEntitiesDeleteAction: "IEntitiesDeleteAction",
|
|
783
889
|
IEntitiesSearchAction: "IEntitiesSearchAction",
|
|
784
890
|
IEntityCreateAction: "IEntityCreateAction",
|
|
785
891
|
IEntityUpdateAction: "IEntityUpdateAction",
|
|
@@ -796,6 +902,7 @@ const EntityServices = {
|
|
|
796
902
|
IEntityUpsertCommand: "IEntityUpsertCommand",
|
|
797
903
|
IEntityMergeCommand: "IEntityMergeCommand",
|
|
798
904
|
IEntityDeleteCommand: "IEntityDeleteCommand",
|
|
905
|
+
IEntitiesDeleteCommand: "IEntitiesDeleteCommand",
|
|
799
906
|
},
|
|
800
907
|
Converters: {
|
|
801
908
|
IEntityAdapter: "IEntityAdapter",
|
|
@@ -810,6 +917,8 @@ const EntityServices = {
|
|
|
810
917
|
IEntityEventsManager: "IEntityEventsManager",
|
|
811
918
|
},
|
|
812
919
|
Queries: {
|
|
920
|
+
IEntityCountQuery: "IEntityCountQuery",
|
|
921
|
+
IEntityExistsQuery: "IEntityExistsQuery",
|
|
813
922
|
IEntityGetQuery: "IEntityGetQuery",
|
|
814
923
|
IEntitiesSearchQuery: "IEntitiesSearchQuery",
|
|
815
924
|
IEntitiesQueryBuilder: "IEntitiesQueryBuilder",
|
|
@@ -839,6 +948,9 @@ const GlobalServices = {
|
|
|
839
948
|
IEmailProvider: "IEmailProvider",
|
|
840
949
|
IEmailTemplatesCollection: "IEmailTemplatesCollection",
|
|
841
950
|
},
|
|
951
|
+
Pipelines: {
|
|
952
|
+
IPipelineController: "IPipelineController",
|
|
953
|
+
},
|
|
842
954
|
};
|
|
843
955
|
|
|
844
956
|
class EntityServiceLocator {
|
|
@@ -894,6 +1006,12 @@ class EntityServiceLocator {
|
|
|
894
1006
|
resolveGetQuery() {
|
|
895
1007
|
return this.services.resolveGetQuery(this.entityName);
|
|
896
1008
|
}
|
|
1009
|
+
resolveExistsQuery() {
|
|
1010
|
+
return this.services.resolveExistsQuery(this.entityName);
|
|
1011
|
+
}
|
|
1012
|
+
resolveCountQuery() {
|
|
1013
|
+
return this.services.resolveCountQuery(this.entityName);
|
|
1014
|
+
}
|
|
897
1015
|
resolveSearchQuery() {
|
|
898
1016
|
return this.services.resolveSearchQuery(this.entityName);
|
|
899
1017
|
}
|
|
@@ -912,9 +1030,18 @@ class EntityServiceLocator {
|
|
|
912
1030
|
resolveDeleteCommand() {
|
|
913
1031
|
return this.services.resolveDeleteCommand(this.entityName);
|
|
914
1032
|
}
|
|
1033
|
+
resolveDeleteItemsCommand() {
|
|
1034
|
+
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
1035
|
+
}
|
|
915
1036
|
resolveGetAction() {
|
|
916
1037
|
return this.services.resolveGetAction(this.entityName);
|
|
917
1038
|
}
|
|
1039
|
+
resolveExistsAction() {
|
|
1040
|
+
return this.services.resolveExistsAction(this.entityName);
|
|
1041
|
+
}
|
|
1042
|
+
resolveCountAction() {
|
|
1043
|
+
return this.services.resolveCountAction(this.entityName);
|
|
1044
|
+
}
|
|
918
1045
|
resolveSearchAction() {
|
|
919
1046
|
return this.services.resolveSearchAction(this.entityName);
|
|
920
1047
|
}
|
|
@@ -930,6 +1057,9 @@ class EntityServiceLocator {
|
|
|
930
1057
|
resolveDeleteAction() {
|
|
931
1058
|
return this.services.resolveDeleteAction(this.entityName);
|
|
932
1059
|
}
|
|
1060
|
+
resolveDeleteItemsAction() {
|
|
1061
|
+
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
1062
|
+
}
|
|
933
1063
|
resolveQueryBuilder() {
|
|
934
1064
|
return this.services.resolveQueryBuilder(this.entityName);
|
|
935
1065
|
}
|
|
@@ -970,8 +1100,16 @@ class EntitiesServiceLocator {
|
|
|
970
1100
|
registerEmailTemplatesCollection(instance) {
|
|
971
1101
|
this.provider.register(GlobalServices.Messaging.IEmailTemplatesCollection, instance);
|
|
972
1102
|
}
|
|
1103
|
+
resolvePipelinesController() {
|
|
1104
|
+
return this.provider.resolve(GlobalServices.Pipelines.IPipelineController);
|
|
1105
|
+
}
|
|
1106
|
+
registerPipelinesController(instance) {
|
|
1107
|
+
this.provider.register(GlobalServices.Pipelines.IPipelineController, instance);
|
|
1108
|
+
}
|
|
973
1109
|
resolveAuthenticationContextProvider() {
|
|
974
|
-
return this.provider.resolve(GlobalServices.Authentication.IAuthenticationContextProvider
|
|
1110
|
+
return this.provider.resolve(GlobalServices.Authentication.IAuthenticationContextProvider, {
|
|
1111
|
+
optional: true,
|
|
1112
|
+
});
|
|
975
1113
|
}
|
|
976
1114
|
registerAuthenticationContextProvider(instance) {
|
|
977
1115
|
this.provider.register(GlobalServices.Authentication.IAuthenticationContextProvider, instance);
|
|
@@ -1072,6 +1210,18 @@ class EntitiesServiceLocator {
|
|
|
1072
1210
|
registerSearchQuery(entityName, instance) {
|
|
1073
1211
|
this.provider.registerEntityService(EntityServices.Queries.IEntitiesSearchQuery, entityName, instance);
|
|
1074
1212
|
}
|
|
1213
|
+
resolveExistsQuery(entityName) {
|
|
1214
|
+
return this.provider.resolveEntityService(EntityServices.Queries.IEntityExistsQuery, entityName);
|
|
1215
|
+
}
|
|
1216
|
+
registerExistsQuery(entityName, instance) {
|
|
1217
|
+
this.provider.registerEntityService(EntityServices.Queries.IEntityExistsQuery, entityName, instance);
|
|
1218
|
+
}
|
|
1219
|
+
resolveCountQuery(entityName) {
|
|
1220
|
+
return this.provider.resolveEntityService(EntityServices.Queries.IEntityCountQuery, entityName);
|
|
1221
|
+
}
|
|
1222
|
+
registerCountQuery(entityName, instance) {
|
|
1223
|
+
this.provider.registerEntityService(EntityServices.Queries.IEntityCountQuery, entityName, instance);
|
|
1224
|
+
}
|
|
1075
1225
|
resolveCreateCommand(entityName) {
|
|
1076
1226
|
return this.provider.resolveEntityService(EntityServices.Commands.IEntityCreateCommand, entityName);
|
|
1077
1227
|
}
|
|
@@ -1090,6 +1240,12 @@ class EntitiesServiceLocator {
|
|
|
1090
1240
|
registerUpsertCommand(entityName, instance) {
|
|
1091
1241
|
this.provider.registerEntityService(EntityServices.Commands.IEntityUpsertCommand, entityName, instance);
|
|
1092
1242
|
}
|
|
1243
|
+
resolveDeleteItemsCommand(entityName) {
|
|
1244
|
+
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesDeleteCommand, entityName);
|
|
1245
|
+
}
|
|
1246
|
+
registerDeleteItemsCommand(entityName, instance) {
|
|
1247
|
+
this.provider.registerEntityService(EntityServices.Commands.IEntitiesDeleteCommand, entityName, instance);
|
|
1248
|
+
}
|
|
1093
1249
|
// resolveMergeCommand<TEntity>(
|
|
1094
1250
|
// entityName: string
|
|
1095
1251
|
// ): IEntityMergeCommand<TEntity> {
|
|
@@ -1130,6 +1286,18 @@ class EntitiesServiceLocator {
|
|
|
1130
1286
|
registerGetAction(entityName, instance) {
|
|
1131
1287
|
this.provider.registerEntityService(EntityServices.Actions.IEntityGetAction, entityName, instance);
|
|
1132
1288
|
}
|
|
1289
|
+
resolveExistsAction(entityName) {
|
|
1290
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntityExistsAction, entityName);
|
|
1291
|
+
}
|
|
1292
|
+
registerExistsAction(entityName, instance) {
|
|
1293
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntityExistsAction, entityName, instance);
|
|
1294
|
+
}
|
|
1295
|
+
resolveCountAction(entityName) {
|
|
1296
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesCountAction, entityName);
|
|
1297
|
+
}
|
|
1298
|
+
registerCountAction(entityName, instance) {
|
|
1299
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesCountAction, entityName, instance);
|
|
1300
|
+
}
|
|
1133
1301
|
resolveSearchAction(entityName) {
|
|
1134
1302
|
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesSearchAction, entityName);
|
|
1135
1303
|
}
|
|
@@ -1160,6 +1328,12 @@ class EntitiesServiceLocator {
|
|
|
1160
1328
|
registerDeleteAction(entityName, instance) {
|
|
1161
1329
|
this.provider.registerEntityService(EntityServices.Actions.IEntityDeleteAction, entityName, instance);
|
|
1162
1330
|
}
|
|
1331
|
+
resolveDeleteItemsAction(entityName) {
|
|
1332
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesDeleteAction, entityName);
|
|
1333
|
+
}
|
|
1334
|
+
registerDeleteItemsAction(entityName, instance) {
|
|
1335
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesDeleteAction, entityName, instance);
|
|
1336
|
+
}
|
|
1163
1337
|
resolveQueryBuilder(entityName) {
|
|
1164
1338
|
return this.provider.resolveEntityService(EntityServices.Queries.IEntitiesQueryBuilder, entityName);
|
|
1165
1339
|
}
|
|
@@ -1168,12 +1342,74 @@ class EntitiesServiceLocator {
|
|
|
1168
1342
|
}
|
|
1169
1343
|
}
|
|
1170
1344
|
|
|
1345
|
+
class EntitiesCountQuery {
|
|
1346
|
+
constructor(services) {
|
|
1347
|
+
this.services = services;
|
|
1348
|
+
}
|
|
1349
|
+
async execute(filters) {
|
|
1350
|
+
const context = await this.getContext();
|
|
1351
|
+
await this.authorizeSearch(context);
|
|
1352
|
+
return await this.services
|
|
1353
|
+
.resolveQueryBuilder()
|
|
1354
|
+
.count(filters, context);
|
|
1355
|
+
}
|
|
1356
|
+
async getContext() {
|
|
1357
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1358
|
+
if (!authorization) {
|
|
1359
|
+
return undefined;
|
|
1360
|
+
}
|
|
1361
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1362
|
+
return await contextService.getContext();
|
|
1363
|
+
}
|
|
1364
|
+
async authorizeSearch(context) {
|
|
1365
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1366
|
+
if (!authorization) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
const { isAuthorized } = await authorization.canSearch(context);
|
|
1370
|
+
if (!isAuthorized) {
|
|
1371
|
+
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Search, this.services.getEntityName());
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
class EntityExistsQuery {
|
|
1377
|
+
constructor(services) {
|
|
1378
|
+
this.services = services;
|
|
1379
|
+
}
|
|
1380
|
+
async execute(filters) {
|
|
1381
|
+
const context = await this.getContext();
|
|
1382
|
+
await this.authorizeSearch(context);
|
|
1383
|
+
return await this.services
|
|
1384
|
+
.resolveQueryBuilder()
|
|
1385
|
+
.exists(filters, context);
|
|
1386
|
+
}
|
|
1387
|
+
async getContext() {
|
|
1388
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1389
|
+
if (!authorization) {
|
|
1390
|
+
return undefined;
|
|
1391
|
+
}
|
|
1392
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1393
|
+
return await contextService.getContext();
|
|
1394
|
+
}
|
|
1395
|
+
async authorizeSearch(context) {
|
|
1396
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1397
|
+
if (!authorization) {
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
const { isAuthorized } = await authorization.canSearch(context);
|
|
1401
|
+
if (!isAuthorized) {
|
|
1402
|
+
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Search, this.services.getEntityName());
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1171
1407
|
class EntityGetQuery {
|
|
1172
1408
|
constructor(services) {
|
|
1173
1409
|
this.services = services;
|
|
1174
1410
|
}
|
|
1175
1411
|
async execute(id) {
|
|
1176
|
-
|
|
1412
|
+
const entity = await this.services.resolveRepository().get(id);
|
|
1177
1413
|
if (entity) {
|
|
1178
1414
|
await this.authorize(entity);
|
|
1179
1415
|
}
|
|
@@ -1185,7 +1421,10 @@ class EntityGetQuery {
|
|
|
1185
1421
|
return;
|
|
1186
1422
|
}
|
|
1187
1423
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1188
|
-
const context = await contextService
|
|
1424
|
+
const context = await contextService?.getContext();
|
|
1425
|
+
if (!context) {
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1189
1428
|
const authorizationResult = await authorization.canRead(entity, context);
|
|
1190
1429
|
if (!authorizationResult.isAuthorized)
|
|
1191
1430
|
throw new EntityOperationUnauthorizedException(exports.EntityOperationType.Read, this.services.getEntityName(), entity);
|
|
@@ -1196,7 +1435,6 @@ class EntitiesSearchQuery {
|
|
|
1196
1435
|
constructor(services) {
|
|
1197
1436
|
this.services = services;
|
|
1198
1437
|
}
|
|
1199
|
-
// @ts-ignore
|
|
1200
1438
|
async execute(request) {
|
|
1201
1439
|
const context = await this.getContext();
|
|
1202
1440
|
await this.authorizeSearch(context);
|
|
@@ -1221,7 +1459,7 @@ class EntitiesSearchQuery {
|
|
|
1221
1459
|
return undefined;
|
|
1222
1460
|
}
|
|
1223
1461
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1224
|
-
return await contextService
|
|
1462
|
+
return await contextService?.getContext();
|
|
1225
1463
|
}
|
|
1226
1464
|
async filterAllowedEntities(entities, context) {
|
|
1227
1465
|
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
@@ -1491,6 +1729,8 @@ class EntityManagerServiceCollection {
|
|
|
1491
1729
|
}
|
|
1492
1730
|
mapCrudOperations({ queryBuilder, }) {
|
|
1493
1731
|
this.mapGet();
|
|
1732
|
+
this.mapCount();
|
|
1733
|
+
this.mapExists();
|
|
1494
1734
|
this.mapSearch({
|
|
1495
1735
|
queryBuilder,
|
|
1496
1736
|
});
|
|
@@ -1504,6 +1744,16 @@ class EntityManagerServiceCollection {
|
|
|
1504
1744
|
this.locator.registerGetAction(this.entityName, new EntityGetAction(this.resolver));
|
|
1505
1745
|
return this;
|
|
1506
1746
|
}
|
|
1747
|
+
mapCount() {
|
|
1748
|
+
this.locator.registerCountQuery(this.entityName, new EntitiesCountQuery(this.resolver));
|
|
1749
|
+
this.locator.registerCountAction(this.entityName, new EntitiesCountAction(this.resolver));
|
|
1750
|
+
return this;
|
|
1751
|
+
}
|
|
1752
|
+
mapExists() {
|
|
1753
|
+
this.locator.registerExistsQuery(this.entityName, new EntityExistsQuery(this.resolver));
|
|
1754
|
+
this.locator.registerExistsAction(this.entityName, new EntityExistsAction(this.resolver));
|
|
1755
|
+
return this;
|
|
1756
|
+
}
|
|
1507
1757
|
mapSearch({ queryBuilder, }) {
|
|
1508
1758
|
this.locator.registerSearchQuery(this.entityName, new EntitiesSearchQuery(this.resolver));
|
|
1509
1759
|
this.locator.registerSearchAction(this.entityName, new EntitiesSearchAction(this.resolver));
|
|
@@ -1533,6 +1783,8 @@ class EntityManagerServiceCollection {
|
|
|
1533
1783
|
mapDelete() {
|
|
1534
1784
|
this.locator.registerDeleteCommand(this.entityName, new EntityDeleteCommand(this.resolver));
|
|
1535
1785
|
this.locator.registerDeleteAction(this.entityName, new EntityDeleteAction(this.resolver));
|
|
1786
|
+
this.locator.registerDeleteItemsCommand(this.entityName, new EntitiesDeleteCommand(this.resolver));
|
|
1787
|
+
this.locator.registerDeleteAction(this.entityName, new EntitiesDeleteAction(this.resolver));
|
|
1536
1788
|
return this;
|
|
1537
1789
|
}
|
|
1538
1790
|
addAdapter(adapter) {
|
|
@@ -19286,7 +19538,7 @@ let UserRegistrationHandler = class UserRegistrationHandler {
|
|
|
19286
19538
|
userId: user.id,
|
|
19287
19539
|
};
|
|
19288
19540
|
}
|
|
19289
|
-
const newUser = await this.createUser(input.email, input.registrationInfo, input.context);
|
|
19541
|
+
const newUser = await this.createUser(input.email, input.userName, input.registrationInfo, input.context);
|
|
19290
19542
|
const passwordHash = await this.createPasswordHash(input.password, newUser.id);
|
|
19291
19543
|
await this.services.getUsersService().update(newUser.id, {
|
|
19292
19544
|
passwordHash,
|
|
@@ -19327,8 +19579,10 @@ let UserRegistrationHandler = class UserRegistrationHandler {
|
|
|
19327
19579
|
timestamp: Date.now(),
|
|
19328
19580
|
});
|
|
19329
19581
|
}
|
|
19330
|
-
async createUser(email, info, context) {
|
|
19331
|
-
return await this.services
|
|
19582
|
+
async createUser(email, userName, info, context) {
|
|
19583
|
+
return await this.services
|
|
19584
|
+
.getUsersService()
|
|
19585
|
+
.create(email, userName, info, context);
|
|
19332
19586
|
}
|
|
19333
19587
|
async resolveUser(userName, context) {
|
|
19334
19588
|
return ((await this.services
|
|
@@ -19662,9 +19916,92 @@ UserVerifyRequestHandler = __decorate([
|
|
|
19662
19916
|
JwtProvider])
|
|
19663
19917
|
], UserVerifyRequestHandler);
|
|
19664
19918
|
|
|
19919
|
+
let UserCreationHandler = class UserCreationHandler {
|
|
19920
|
+
constructor(services, passwordHashingProvider) {
|
|
19921
|
+
this.services = services;
|
|
19922
|
+
this.passwordHashingProvider = passwordHashingProvider;
|
|
19923
|
+
this.logger = backendCore.Log.getLogger("UserCreation");
|
|
19924
|
+
}
|
|
19925
|
+
async execute(input) {
|
|
19926
|
+
const user = (await this.resolveUser(input.email, input.context)) ??
|
|
19927
|
+
(await this.resolveUser(input.userName, input.context));
|
|
19928
|
+
if (user && user.verified) {
|
|
19929
|
+
this.logger.debug(`User already exists: ${input.email} - ${input.userName}`, { user });
|
|
19930
|
+
return {
|
|
19931
|
+
success: false,
|
|
19932
|
+
error: exports.UserCreationError.UserAlreadyExists,
|
|
19933
|
+
};
|
|
19934
|
+
}
|
|
19935
|
+
if (user && !user.verified) {
|
|
19936
|
+
const passwordHash = await this.createPasswordHash(input.password, user.id);
|
|
19937
|
+
await this.services.getUsersService().update(user.id, {
|
|
19938
|
+
passwordHash,
|
|
19939
|
+
passwordUpdateTimestamp: new Date(),
|
|
19940
|
+
verified: true,
|
|
19941
|
+
});
|
|
19942
|
+
this.logger.debug(`User already exists but not verified. Updating password and marking as verified: ${input.email} - ${input.userName}`, { user });
|
|
19943
|
+
return {
|
|
19944
|
+
success: true,
|
|
19945
|
+
userId: user.id,
|
|
19946
|
+
};
|
|
19947
|
+
}
|
|
19948
|
+
const newUser = await this.createUser(input.email, input.userName, input.registrationInfo, input.context);
|
|
19949
|
+
const passwordHash = await this.createPasswordHash(input.password, newUser.id);
|
|
19950
|
+
await this.services.getUsersService().update(newUser.id, {
|
|
19951
|
+
passwordHash,
|
|
19952
|
+
passwordUpdateTimestamp: new Date(),
|
|
19953
|
+
verified: true,
|
|
19954
|
+
});
|
|
19955
|
+
this.logger.debug(`New user created: ${input.email} - ${input.userName}`, {
|
|
19956
|
+
user: newUser,
|
|
19957
|
+
});
|
|
19958
|
+
return {
|
|
19959
|
+
success: true,
|
|
19960
|
+
userId: newUser.id,
|
|
19961
|
+
};
|
|
19962
|
+
}
|
|
19963
|
+
async createPasswordHash(password, userId) {
|
|
19964
|
+
return await this.passwordHashingProvider.hashPassword({
|
|
19965
|
+
password,
|
|
19966
|
+
userId,
|
|
19967
|
+
});
|
|
19968
|
+
}
|
|
19969
|
+
async createUser(email, userName, info, context) {
|
|
19970
|
+
return await this.services
|
|
19971
|
+
.getUsersService()
|
|
19972
|
+
.create(email, userName, info, context);
|
|
19973
|
+
}
|
|
19974
|
+
async resolveUser(userName, context) {
|
|
19975
|
+
return ((await this.services
|
|
19976
|
+
.getUsersService()
|
|
19977
|
+
.getByUserName(userName, context)) ??
|
|
19978
|
+
(await this.services.getUsersService().getByEmail(userName, context)));
|
|
19979
|
+
}
|
|
19980
|
+
};
|
|
19981
|
+
UserCreationHandler = __decorate([
|
|
19982
|
+
common.Injectable(),
|
|
19983
|
+
__metadata("design:paramtypes", [AuthenticationServicesResolver,
|
|
19984
|
+
PasswordHashingProvider])
|
|
19985
|
+
], UserCreationHandler);
|
|
19986
|
+
|
|
19987
|
+
let UserDeleteHandler = class UserDeleteHandler {
|
|
19988
|
+
constructor(services) {
|
|
19989
|
+
this.services = services;
|
|
19990
|
+
}
|
|
19991
|
+
async execute(input) {
|
|
19992
|
+
await this.services.getUsersService().delete(input.userId);
|
|
19993
|
+
}
|
|
19994
|
+
};
|
|
19995
|
+
UserDeleteHandler = __decorate([
|
|
19996
|
+
common.Injectable(),
|
|
19997
|
+
__metadata("design:paramtypes", [AuthenticationServicesResolver])
|
|
19998
|
+
], UserDeleteHandler);
|
|
19999
|
+
|
|
19665
20000
|
exports.AuthenticationService = class AuthenticationService {
|
|
19666
|
-
constructor(userDisableHandler, userEnableHandler, userLoginHandler, userPasswordChangeHandler, userPasswordResetFinalizeHandler, userPasswordResetRequestHandler, userRegistrationHandler, userTokenVerifyHandler, userVerifyRequestHandler, userVerifyCompleteHandler, resolver) {
|
|
20001
|
+
constructor(userCreationHandler, userDisableHandler, userDeleteHandler, userEnableHandler, userLoginHandler, userPasswordChangeHandler, userPasswordResetFinalizeHandler, userPasswordResetRequestHandler, userRegistrationHandler, userTokenVerifyHandler, userVerifyRequestHandler, userVerifyCompleteHandler, resolver) {
|
|
20002
|
+
this.userCreationHandler = userCreationHandler;
|
|
19667
20003
|
this.userDisableHandler = userDisableHandler;
|
|
20004
|
+
this.userDeleteHandler = userDeleteHandler;
|
|
19668
20005
|
this.userEnableHandler = userEnableHandler;
|
|
19669
20006
|
this.userLoginHandler = userLoginHandler;
|
|
19670
20007
|
this.userPasswordChangeHandler = userPasswordChangeHandler;
|
|
@@ -19676,9 +20013,15 @@ exports.AuthenticationService = class AuthenticationService {
|
|
|
19676
20013
|
this.userVerifyCompleteHandler = userVerifyCompleteHandler;
|
|
19677
20014
|
this.resolver = resolver;
|
|
19678
20015
|
}
|
|
20016
|
+
async userCreate(input) {
|
|
20017
|
+
return await this.userCreationHandler.execute(input);
|
|
20018
|
+
}
|
|
19679
20019
|
async userDisable(input) {
|
|
19680
20020
|
await this.userDisableHandler.execute(input);
|
|
19681
20021
|
}
|
|
20022
|
+
async userDelete(input) {
|
|
20023
|
+
await this.userDeleteHandler.execute(input);
|
|
20024
|
+
}
|
|
19682
20025
|
async userEnable(input) {
|
|
19683
20026
|
await this.userEnableHandler.execute(input);
|
|
19684
20027
|
}
|
|
@@ -19718,7 +20061,9 @@ exports.AuthenticationService = class AuthenticationService {
|
|
|
19718
20061
|
};
|
|
19719
20062
|
exports.AuthenticationService = __decorate([
|
|
19720
20063
|
common.Injectable(),
|
|
19721
|
-
__metadata("design:paramtypes", [
|
|
20064
|
+
__metadata("design:paramtypes", [UserCreationHandler,
|
|
20065
|
+
UserDisableHandler,
|
|
20066
|
+
UserDeleteHandler,
|
|
19722
20067
|
UserEnableHandler,
|
|
19723
20068
|
UserLoginHandler,
|
|
19724
20069
|
UserPasswordChangeHandler,
|
|
@@ -19779,6 +20124,239 @@ const orderByPriority = (items, priorityFieldSelector, nameFieldSelector) => {
|
|
|
19779
20124
|
return backendCore.sort(items, backendCore.byField((x) => priorityFieldSelector(x) ?? Number.MAX_VALUE), backendCore.byField((x) => nameFieldSelector(x)));
|
|
19780
20125
|
};
|
|
19781
20126
|
|
|
20127
|
+
exports.PipelineStepErrorType = void 0;
|
|
20128
|
+
(function (PipelineStepErrorType) {
|
|
20129
|
+
PipelineStepErrorType["FailedPrecondition"] = "failedPrecondition";
|
|
20130
|
+
PipelineStepErrorType["OperationError"] = "operationError";
|
|
20131
|
+
PipelineStepErrorType["RollbackError"] = "rollbackError";
|
|
20132
|
+
PipelineStepErrorType["GenericError"] = "genericError";
|
|
20133
|
+
})(exports.PipelineStepErrorType || (exports.PipelineStepErrorType = {}));
|
|
20134
|
+
exports.PipelineErrorType = void 0;
|
|
20135
|
+
(function (PipelineErrorType) {
|
|
20136
|
+
PipelineErrorType["FailedPrecondition"] = "failedPrecondition";
|
|
20137
|
+
PipelineErrorType["OperationError"] = "operationError";
|
|
20138
|
+
PipelineErrorType["RollbackError"] = "rollbackError";
|
|
20139
|
+
PipelineErrorType["Unauthorized"] = "unauthorized";
|
|
20140
|
+
PipelineErrorType["GenericError"] = "genericError";
|
|
20141
|
+
})(exports.PipelineErrorType || (exports.PipelineErrorType = {}));
|
|
20142
|
+
exports.PipelineStatus = void 0;
|
|
20143
|
+
(function (PipelineStatus) {
|
|
20144
|
+
PipelineStatus["Initializing"] = "initializing";
|
|
20145
|
+
PipelineStatus["Running"] = "running";
|
|
20146
|
+
PipelineStatus["RollbackInProgress"] = "rollbackInProgress";
|
|
20147
|
+
PipelineStatus["Completed"] = "completed";
|
|
20148
|
+
PipelineStatus["Failed"] = "failed";
|
|
20149
|
+
})(exports.PipelineStatus || (exports.PipelineStatus = {}));
|
|
20150
|
+
|
|
20151
|
+
const toPipelineOperationError = (error) => ({
|
|
20152
|
+
message: error.message,
|
|
20153
|
+
exception: error,
|
|
20154
|
+
});
|
|
20155
|
+
const getStepOutput = (result) => {
|
|
20156
|
+
return result.type === "success" ? result.output : undefined;
|
|
20157
|
+
};
|
|
20158
|
+
const getOperationOutput = (result) => {
|
|
20159
|
+
return result.type === "success" ? result.output : undefined;
|
|
20160
|
+
};
|
|
20161
|
+
const mapPipelineErrorType = (stepError) => {
|
|
20162
|
+
switch (stepError) {
|
|
20163
|
+
case exports.PipelineStepErrorType.FailedPrecondition:
|
|
20164
|
+
return exports.PipelineErrorType.FailedPrecondition;
|
|
20165
|
+
case exports.PipelineStepErrorType.OperationError:
|
|
20166
|
+
return exports.PipelineErrorType.OperationError;
|
|
20167
|
+
case exports.PipelineStepErrorType.RollbackError:
|
|
20168
|
+
return exports.PipelineErrorType.RollbackError;
|
|
20169
|
+
case exports.PipelineStepErrorType.GenericError:
|
|
20170
|
+
return exports.PipelineErrorType.GenericError;
|
|
20171
|
+
}
|
|
20172
|
+
};
|
|
20173
|
+
|
|
20174
|
+
class PipelineInstance {
|
|
20175
|
+
constructor(definition, input, context) {
|
|
20176
|
+
this.definition = definition;
|
|
20177
|
+
this.input = input;
|
|
20178
|
+
this.context = context;
|
|
20179
|
+
this.status = exports.PipelineStatus.Initializing;
|
|
20180
|
+
}
|
|
20181
|
+
async execute() {
|
|
20182
|
+
this.status = exports.PipelineStatus.Running;
|
|
20183
|
+
const executedSteps = [];
|
|
20184
|
+
const stepResults = [];
|
|
20185
|
+
let state = this.buildInitialStepState();
|
|
20186
|
+
for (const [i, step] of this.definition.steps.entries()) {
|
|
20187
|
+
executedSteps.push(step);
|
|
20188
|
+
const stepResult = await this.executeStep(step, i > 0 ? getStepOutput(stepResults[i - 1]) : this.input, state);
|
|
20189
|
+
stepResults.push(stepResult);
|
|
20190
|
+
state = this.buildNextStepState(state, stepResult);
|
|
20191
|
+
if (stepResult.type !== "success") {
|
|
20192
|
+
this.status = exports.PipelineStatus.RollbackInProgress;
|
|
20193
|
+
await this.rollbackSteps(executedSteps, stepResults, state);
|
|
20194
|
+
return {
|
|
20195
|
+
type: "error",
|
|
20196
|
+
errorType: mapPipelineErrorType(stepResult.errorType),
|
|
20197
|
+
input: this.input,
|
|
20198
|
+
stepResults,
|
|
20199
|
+
};
|
|
20200
|
+
}
|
|
20201
|
+
}
|
|
20202
|
+
this.status = exports.PipelineStatus.Completed;
|
|
20203
|
+
return {
|
|
20204
|
+
type: "success",
|
|
20205
|
+
input: this.input,
|
|
20206
|
+
output: getStepOutput(stepResults[stepResults.length - 1]),
|
|
20207
|
+
stepResults,
|
|
20208
|
+
};
|
|
20209
|
+
}
|
|
20210
|
+
buildInitialStepState() {
|
|
20211
|
+
return {
|
|
20212
|
+
stepInput: this.input,
|
|
20213
|
+
context: this.context,
|
|
20214
|
+
pipelineInput: this.input,
|
|
20215
|
+
};
|
|
20216
|
+
}
|
|
20217
|
+
buildNextStepState(state, stepResult) {
|
|
20218
|
+
return {
|
|
20219
|
+
stepInput: getStepOutput(stepResult),
|
|
20220
|
+
context: this.context,
|
|
20221
|
+
pipelineInput: this.input,
|
|
20222
|
+
previousStep: {
|
|
20223
|
+
stepInput: state.stepInput,
|
|
20224
|
+
stepOutput: getStepOutput(stepResult),
|
|
20225
|
+
context: this.context,
|
|
20226
|
+
pipelineInput: this.input,
|
|
20227
|
+
previousStep: state.previousStep,
|
|
20228
|
+
},
|
|
20229
|
+
};
|
|
20230
|
+
}
|
|
20231
|
+
async rollbackSteps(executedSteps, stepsResults, state) {
|
|
20232
|
+
const rollbackSteps = executedSteps
|
|
20233
|
+
.map((x, i) => ({
|
|
20234
|
+
step: x,
|
|
20235
|
+
result: stepsResults[i],
|
|
20236
|
+
}))
|
|
20237
|
+
.reverse();
|
|
20238
|
+
let rollbackState = state;
|
|
20239
|
+
for (const step of rollbackSteps) {
|
|
20240
|
+
await this.rollbackStep(step.step, step.result, rollbackState);
|
|
20241
|
+
rollbackState = state.previousStep;
|
|
20242
|
+
}
|
|
20243
|
+
}
|
|
20244
|
+
async rollbackStep(step, stepResults, state) {
|
|
20245
|
+
const completedOperations = stepResults.operationResults.map((x, i) => ({
|
|
20246
|
+
result: x,
|
|
20247
|
+
operation: step.operations[i],
|
|
20248
|
+
}));
|
|
20249
|
+
// .filter((x) => x.result.type === "success")
|
|
20250
|
+
const rollbackOperations = completedOperations.map((x) => this.rollbackOperations(x.operation, x.result.input, getOperationOutput(x.result), state));
|
|
20251
|
+
const rollbackResults = await Promise.all(rollbackOperations);
|
|
20252
|
+
const isRollbackError = rollbackResults.some((x) => x.type === "error");
|
|
20253
|
+
if (isRollbackError) {
|
|
20254
|
+
return {
|
|
20255
|
+
type: "error",
|
|
20256
|
+
};
|
|
20257
|
+
}
|
|
20258
|
+
return {
|
|
20259
|
+
type: "success",
|
|
20260
|
+
};
|
|
20261
|
+
}
|
|
20262
|
+
async validateStepPrecondition(step, input, state) {
|
|
20263
|
+
const preconditionOperations = step.operations
|
|
20264
|
+
.filter((x) => x.operation.precondition)
|
|
20265
|
+
.map((x) => x.operation.precondition(input, state));
|
|
20266
|
+
const preconditionResults = await Promise.all(preconditionOperations);
|
|
20267
|
+
return {
|
|
20268
|
+
hasValidPrecondition: preconditionResults.every((x) => x),
|
|
20269
|
+
};
|
|
20270
|
+
}
|
|
20271
|
+
async executeStep(step, input, state) {
|
|
20272
|
+
const preconditionResult = await this.validateStepPrecondition(step, input, state);
|
|
20273
|
+
if (!preconditionResult.hasValidPrecondition) {
|
|
20274
|
+
return {
|
|
20275
|
+
operationResults: [],
|
|
20276
|
+
type: "error",
|
|
20277
|
+
errorType: exports.PipelineStepErrorType.FailedPrecondition,
|
|
20278
|
+
input,
|
|
20279
|
+
};
|
|
20280
|
+
}
|
|
20281
|
+
const stepOperations = step.operations.map((x) => this.executeOperation(x, input, state));
|
|
20282
|
+
const operationResults = await Promise.all(stepOperations);
|
|
20283
|
+
const isSuccess = operationResults.every((x) => x.type === "success");
|
|
20284
|
+
if (isSuccess) {
|
|
20285
|
+
const output = step.outputsReducer
|
|
20286
|
+
? step.outputsReducer(operationResults.map((x) => getOperationOutput(x)))
|
|
20287
|
+
: operationResults.map((x) => getOperationOutput(x));
|
|
20288
|
+
return {
|
|
20289
|
+
type: "success",
|
|
20290
|
+
operationResults,
|
|
20291
|
+
input,
|
|
20292
|
+
output: output,
|
|
20293
|
+
};
|
|
20294
|
+
}
|
|
20295
|
+
return {
|
|
20296
|
+
type: "error",
|
|
20297
|
+
errorType: exports.PipelineStepErrorType.OperationError,
|
|
20298
|
+
operationResults,
|
|
20299
|
+
input,
|
|
20300
|
+
};
|
|
20301
|
+
}
|
|
20302
|
+
async executeOperation(operation, input, state) {
|
|
20303
|
+
try {
|
|
20304
|
+
const operationResult = await operation.operation.action(input, state);
|
|
20305
|
+
return {
|
|
20306
|
+
type: "success",
|
|
20307
|
+
input,
|
|
20308
|
+
output: operationResult,
|
|
20309
|
+
};
|
|
20310
|
+
}
|
|
20311
|
+
catch (error) {
|
|
20312
|
+
return {
|
|
20313
|
+
type: "error",
|
|
20314
|
+
input,
|
|
20315
|
+
error: toPipelineOperationError(error),
|
|
20316
|
+
};
|
|
20317
|
+
}
|
|
20318
|
+
}
|
|
20319
|
+
async rollbackOperations(operation, operationInput, operationOutput, state) {
|
|
20320
|
+
if (!operation.rollbackOperations?.length) {
|
|
20321
|
+
return {
|
|
20322
|
+
type: "skipped",
|
|
20323
|
+
};
|
|
20324
|
+
}
|
|
20325
|
+
for (const rollbackOperation of operation.rollbackOperations) {
|
|
20326
|
+
const rollbackResult = await this.rollbackOperation(rollbackOperation, operationInput, operationOutput, state);
|
|
20327
|
+
if (rollbackResult.type === "error") {
|
|
20328
|
+
return {
|
|
20329
|
+
type: "error",
|
|
20330
|
+
error: rollbackResult.error,
|
|
20331
|
+
};
|
|
20332
|
+
}
|
|
20333
|
+
}
|
|
20334
|
+
return {
|
|
20335
|
+
type: "success",
|
|
20336
|
+
};
|
|
20337
|
+
}
|
|
20338
|
+
async rollbackOperation(rollbackOperation, operationInput, operationOutput, state) {
|
|
20339
|
+
try {
|
|
20340
|
+
await rollbackOperation.action(operationInput, operationOutput, state);
|
|
20341
|
+
return {
|
|
20342
|
+
type: "success",
|
|
20343
|
+
};
|
|
20344
|
+
}
|
|
20345
|
+
catch (error) {
|
|
20346
|
+
return {
|
|
20347
|
+
type: "error",
|
|
20348
|
+
error: toPipelineOperationError(error),
|
|
20349
|
+
};
|
|
20350
|
+
}
|
|
20351
|
+
}
|
|
20352
|
+
}
|
|
20353
|
+
|
|
20354
|
+
class PipelineController {
|
|
20355
|
+
async createInstance(definition, input, context) {
|
|
20356
|
+
return new PipelineInstance(definition, input, context);
|
|
20357
|
+
}
|
|
20358
|
+
}
|
|
20359
|
+
|
|
19782
20360
|
var EntityManagerInitializer_1;
|
|
19783
20361
|
exports.EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerInitializer {
|
|
19784
20362
|
constructor(discover, registry, eventEmitter) {
|
|
@@ -19800,6 +20378,7 @@ exports.EntityManagerInitializer = EntityManagerInitializer_1 = class EntityMana
|
|
|
19800
20378
|
await this.registerAuthentication(staticProviders.authenticationProvider);
|
|
19801
20379
|
this.logger.log("Entity manager authentication initialized 🔑");
|
|
19802
20380
|
}
|
|
20381
|
+
await this.registerPipelinesServices();
|
|
19803
20382
|
await this.registerEmailTemplates();
|
|
19804
20383
|
await this.registerEmailProviders();
|
|
19805
20384
|
await this.registerEventTrackingProviders();
|
|
@@ -19904,6 +20483,12 @@ exports.EntityManagerInitializer = EntityManagerInitializer_1 = class EntityMana
|
|
|
19904
20483
|
.getEntitiesServicesLocator()
|
|
19905
20484
|
.registerEmailTemplatesCollection(collection);
|
|
19906
20485
|
}
|
|
20486
|
+
async registerPipelinesServices() {
|
|
20487
|
+
this.registry
|
|
20488
|
+
.getContainer()
|
|
20489
|
+
.getEntitiesServicesLocator()
|
|
20490
|
+
.registerPipelinesController(new PipelineController());
|
|
20491
|
+
}
|
|
19907
20492
|
async initializeProviders(app, staticProviders) {
|
|
19908
20493
|
app
|
|
19909
20494
|
.get(exports.ModulesContainerProvider)
|
|
@@ -19951,18 +20536,148 @@ const Processors = [exports.EntityManagerInitializer];
|
|
|
19951
20536
|
|
|
19952
20537
|
const Providers = [NestEventEmitter];
|
|
19953
20538
|
|
|
20539
|
+
class PipelineStepOperationOptionsBuilder {
|
|
20540
|
+
constructor(operation) {
|
|
20541
|
+
this.operation = operation;
|
|
20542
|
+
this.rollbackOperations = [];
|
|
20543
|
+
}
|
|
20544
|
+
withRollback(definition) {
|
|
20545
|
+
this.rollbackOperations.push(definition);
|
|
20546
|
+
return this;
|
|
20547
|
+
}
|
|
20548
|
+
build() {
|
|
20549
|
+
return {
|
|
20550
|
+
name: this.operation.name,
|
|
20551
|
+
operation: this.operation,
|
|
20552
|
+
rollbackOperations: this.rollbackOperations,
|
|
20553
|
+
};
|
|
20554
|
+
}
|
|
20555
|
+
}
|
|
20556
|
+
class PipelineStepOperationsBuilder {
|
|
20557
|
+
constructor() {
|
|
20558
|
+
this.operationBuilders = [];
|
|
20559
|
+
}
|
|
20560
|
+
addOperation(operation) {
|
|
20561
|
+
const operationBuilder = new PipelineStepOperationOptionsBuilder(operation);
|
|
20562
|
+
this.operationBuilders.push(operationBuilder);
|
|
20563
|
+
return operationBuilder;
|
|
20564
|
+
}
|
|
20565
|
+
buildOperations() {
|
|
20566
|
+
return this.operationBuilders.map((builder) => builder.build());
|
|
20567
|
+
}
|
|
20568
|
+
}
|
|
20569
|
+
class PipelineStepBuilder {
|
|
20570
|
+
constructor(previousSteps, currentStepOperationsBuilder) {
|
|
20571
|
+
this.previousSteps = previousSteps;
|
|
20572
|
+
this.currentStep = this.buildCurrentStep(currentStepOperationsBuilder);
|
|
20573
|
+
}
|
|
20574
|
+
addStep(builder) {
|
|
20575
|
+
return new PipelineStepBuilder(this.currentSteps, builder);
|
|
20576
|
+
}
|
|
20577
|
+
buildCurrentStep(currentStepOperationsBuilder) {
|
|
20578
|
+
const operationsBuilder = new PipelineStepOperationsBuilder();
|
|
20579
|
+
currentStepOperationsBuilder(operationsBuilder);
|
|
20580
|
+
return {
|
|
20581
|
+
name: `Step ${this.previousSteps.length + 1}`,
|
|
20582
|
+
operations: operationsBuilder.buildOperations(),
|
|
20583
|
+
// TODO: add support for multiple operation outputs
|
|
20584
|
+
outputsReducer: (outputs) => {
|
|
20585
|
+
if (outputs.length === 0) {
|
|
20586
|
+
throw new Error("Empty pipeline step found");
|
|
20587
|
+
}
|
|
20588
|
+
if (outputs.length !== 1) {
|
|
20589
|
+
throw new Error("Multiple outputs are not supported yet");
|
|
20590
|
+
}
|
|
20591
|
+
return outputs[0];
|
|
20592
|
+
},
|
|
20593
|
+
};
|
|
20594
|
+
}
|
|
20595
|
+
complete() {
|
|
20596
|
+
return {
|
|
20597
|
+
steps: this.currentSteps,
|
|
20598
|
+
};
|
|
20599
|
+
}
|
|
20600
|
+
get currentSteps() {
|
|
20601
|
+
return [
|
|
20602
|
+
...this.previousSteps,
|
|
20603
|
+
this.currentStep,
|
|
20604
|
+
];
|
|
20605
|
+
}
|
|
20606
|
+
}
|
|
20607
|
+
class PipelineTemplateBuilder {
|
|
20608
|
+
addStep(builder) {
|
|
20609
|
+
return new PipelineStepBuilder([], builder);
|
|
20610
|
+
}
|
|
20611
|
+
}
|
|
20612
|
+
|
|
20613
|
+
exports.PipelinesBuilder = class PipelinesBuilder {
|
|
20614
|
+
constructor(registry) {
|
|
20615
|
+
this.registry = registry;
|
|
20616
|
+
}
|
|
20617
|
+
createTemplate() {
|
|
20618
|
+
return new PipelineTemplateBuilder();
|
|
20619
|
+
}
|
|
20620
|
+
};
|
|
20621
|
+
exports.PipelinesBuilder = __decorate([
|
|
20622
|
+
common.Injectable(),
|
|
20623
|
+
__metadata("design:paramtypes", [exports.EntityManagerRegistry])
|
|
20624
|
+
], exports.PipelinesBuilder);
|
|
20625
|
+
|
|
20626
|
+
exports.PipelinesRunner = class PipelinesRunner {
|
|
20627
|
+
constructor(registry) {
|
|
20628
|
+
this.registry = registry;
|
|
20629
|
+
}
|
|
20630
|
+
async invokePipeline(definition, data) {
|
|
20631
|
+
const instance = await this.controller.createInstance(definition, data.input, data.context);
|
|
20632
|
+
return await instance.execute();
|
|
20633
|
+
}
|
|
20634
|
+
get controller() {
|
|
20635
|
+
return this.registry
|
|
20636
|
+
.getContainer()
|
|
20637
|
+
.getEntitiesServicesLocator()
|
|
20638
|
+
.resolvePipelinesController();
|
|
20639
|
+
}
|
|
20640
|
+
};
|
|
20641
|
+
exports.PipelinesRunner = __decorate([
|
|
20642
|
+
common.Injectable(),
|
|
20643
|
+
__metadata("design:paramtypes", [exports.EntityManagerRegistry])
|
|
20644
|
+
], exports.PipelinesRunner);
|
|
20645
|
+
|
|
20646
|
+
const PipelineProviders = [exports.PipelinesBuilder, exports.PipelinesRunner];
|
|
20647
|
+
|
|
20648
|
+
// export const iocStorage = new AsyncLocalStorage<IocContext>()
|
|
20649
|
+
const initializeIoCContext = (context) => {
|
|
20650
|
+
};
|
|
20651
|
+
|
|
19954
20652
|
exports.EntityManagerModule = class EntityManagerModule {
|
|
20653
|
+
constructor(registry) {
|
|
20654
|
+
this.registry = registry;
|
|
20655
|
+
}
|
|
20656
|
+
onModuleInit() {
|
|
20657
|
+
initializeIoCContext({
|
|
20658
|
+
registry: this.registry,
|
|
20659
|
+
});
|
|
20660
|
+
}
|
|
19955
20661
|
};
|
|
19956
20662
|
exports.EntityManagerModule = __decorate([
|
|
19957
20663
|
common.Module({
|
|
19958
20664
|
imports: [CustomDiscoveryModule, eventEmitter.EventEmitterModule],
|
|
19959
|
-
providers: [
|
|
20665
|
+
providers: [
|
|
20666
|
+
...IoC,
|
|
20667
|
+
...Providers,
|
|
20668
|
+
...Processors,
|
|
20669
|
+
...Services$1,
|
|
20670
|
+
...PipelineProviders,
|
|
20671
|
+
],
|
|
19960
20672
|
exports: [exports.EntityManagerRegistry, ...Services$1],
|
|
19961
|
-
})
|
|
20673
|
+
}),
|
|
20674
|
+
__metadata("design:paramtypes", [exports.EntityManagerRegistry])
|
|
19962
20675
|
], exports.EntityManagerModule);
|
|
19963
20676
|
|
|
19964
20677
|
const UserHandlers = [
|
|
20678
|
+
UserCreationHandler,
|
|
19965
20679
|
UserDisableHandler,
|
|
20680
|
+
UserDeleteHandler,
|
|
19966
20681
|
UserEnableHandler,
|
|
19967
20682
|
UserLoginHandler,
|
|
19968
20683
|
UserPasswordChangeHandler,
|
|
@@ -20057,7 +20772,7 @@ class AppSession {
|
|
|
20057
20772
|
|
|
20058
20773
|
exports.AppSessionMiddleware = class AppSessionMiddleware {
|
|
20059
20774
|
use(req, res, next) {
|
|
20060
|
-
|
|
20775
|
+
sessionStorage.run(new AppSession(req, res), () => {
|
|
20061
20776
|
next();
|
|
20062
20777
|
});
|
|
20063
20778
|
}
|
|
@@ -20066,7 +20781,7 @@ exports.AppSessionMiddleware = __decorate([
|
|
|
20066
20781
|
common.Injectable()
|
|
20067
20782
|
], exports.AppSessionMiddleware);
|
|
20068
20783
|
function appSessionMiddleware(req, res, next) {
|
|
20069
|
-
|
|
20784
|
+
sessionStorage.run(new AppSession(req, res), () => {
|
|
20070
20785
|
next();
|
|
20071
20786
|
});
|
|
20072
20787
|
}
|
|
@@ -20203,6 +20918,24 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
|
|
|
20203
20918
|
super();
|
|
20204
20919
|
this.services = services;
|
|
20205
20920
|
}
|
|
20921
|
+
async exists(filters, context) {
|
|
20922
|
+
return (await this.count(filters, context)) > 0;
|
|
20923
|
+
}
|
|
20924
|
+
async count(filters, context) {
|
|
20925
|
+
const request = {
|
|
20926
|
+
filters,
|
|
20927
|
+
};
|
|
20928
|
+
return await this.countQueryResults(request, context);
|
|
20929
|
+
}
|
|
20930
|
+
async delete(filters, context) {
|
|
20931
|
+
const request = {
|
|
20932
|
+
filters,
|
|
20933
|
+
};
|
|
20934
|
+
return await this.getRepository().deleteBy({
|
|
20935
|
+
...(context ? this.buildContextFilter(context) : {}),
|
|
20936
|
+
...this.buildWhereClause(request),
|
|
20937
|
+
});
|
|
20938
|
+
}
|
|
20206
20939
|
async search(request, context) {
|
|
20207
20940
|
// todo: execute inside read transaction in order to perform the three queries on the same dataset
|
|
20208
20941
|
const queryResults = await this.countQueryResults(request, context);
|
|
@@ -20320,7 +21053,10 @@ class TypeOrmRepository {
|
|
|
20320
21053
|
});
|
|
20321
21054
|
}
|
|
20322
21055
|
async deleteBy(condition) {
|
|
20323
|
-
await this.innerRepository.delete(condition);
|
|
21056
|
+
const result = await this.innerRepository.delete(condition);
|
|
21057
|
+
return {
|
|
21058
|
+
deletedCount: result.affected,
|
|
21059
|
+
};
|
|
20324
21060
|
}
|
|
20325
21061
|
async create(entity) {
|
|
20326
21062
|
const createResult = await this.innerRepository.insert(entity);
|
|
@@ -20401,6 +21137,14 @@ class NestTypeOrmEntitySeeder extends TypeOrmEntitySeeder {
|
|
|
20401
21137
|
}
|
|
20402
21138
|
}
|
|
20403
21139
|
|
|
21140
|
+
class PipelineInvocationError extends Error {
|
|
21141
|
+
constructor(errorType, innerError, message) {
|
|
21142
|
+
super(message ?? innerError?.message);
|
|
21143
|
+
this.errorType = errorType;
|
|
21144
|
+
this.innerError = innerError;
|
|
21145
|
+
}
|
|
21146
|
+
}
|
|
21147
|
+
|
|
20404
21148
|
class AppExceptionsFilterBase {
|
|
20405
21149
|
catch(exception, host) {
|
|
20406
21150
|
const ctx = host.switchToHttp();
|
|
@@ -20436,6 +21180,16 @@ class AppExceptionsFilterBase {
|
|
|
20436
21180
|
if (exception instanceof common.HttpException) {
|
|
20437
21181
|
return exception.getStatus();
|
|
20438
21182
|
}
|
|
21183
|
+
if (exception instanceof PipelineInvocationError) {
|
|
21184
|
+
switch (exception.errorType) {
|
|
21185
|
+
case exports.PipelineErrorType.Unauthorized:
|
|
21186
|
+
return common.HttpStatus.UNAUTHORIZED;
|
|
21187
|
+
case exports.PipelineErrorType.FailedPrecondition:
|
|
21188
|
+
return common.HttpStatus.PRECONDITION_FAILED;
|
|
21189
|
+
default:
|
|
21190
|
+
return common.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
21191
|
+
}
|
|
21192
|
+
}
|
|
20439
21193
|
return common.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
20440
21194
|
}
|
|
20441
21195
|
}
|
|
@@ -25685,6 +26439,7 @@ exports.NumericFacet = NumericFacet;
|
|
|
25685
26439
|
exports.NumericFacetItem = NumericFacetItem;
|
|
25686
26440
|
exports.OperationTokenMismatchError = OperationTokenMismatchError;
|
|
25687
26441
|
exports.PLATFORM_EVENT_NAMESPACE = PLATFORM_EVENT_NAMESPACE;
|
|
26442
|
+
exports.PipelineController = PipelineController;
|
|
25688
26443
|
exports.PlatformEvents = PlatformEvents;
|
|
25689
26444
|
exports.Public = Public;
|
|
25690
26445
|
exports.QueryBuilderBase = QueryBuilderBase;
|
|
@@ -25706,6 +26461,7 @@ exports.WpEntityQueryBuilder = WpEntityQueryBuilder;
|
|
|
25706
26461
|
exports.WpEntityRepository = WpEntityRepository;
|
|
25707
26462
|
exports.WpEntitySeeder = WpEntitySeeder;
|
|
25708
26463
|
exports.WpEventsTracker = WpEventsTracker;
|
|
26464
|
+
exports.WpPipeline = WpPipeline;
|
|
25709
26465
|
exports.WpRolesService = WpRolesService;
|
|
25710
26466
|
exports.WpSendgridEmailTemplate = WpSendgridEmailTemplate;
|
|
25711
26467
|
exports.WpUserRolesService = WpUserRolesService;
|