@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/esm/index.js
CHANGED
|
@@ -114,12 +114,11 @@ class NestEntityActions {
|
|
|
114
114
|
constructor(entityName, registry) {
|
|
115
115
|
this.services = registry.resolveEntityServicesCollection(entityName);
|
|
116
116
|
}
|
|
117
|
-
get
|
|
117
|
+
get manager() {
|
|
118
118
|
if (!this.actionsInstance) {
|
|
119
119
|
this.actionsInstance =
|
|
120
120
|
this.services.resolveEntityActions();
|
|
121
121
|
}
|
|
122
|
-
this.services.resolveEntityActions;
|
|
123
122
|
return this.actionsInstance;
|
|
124
123
|
}
|
|
125
124
|
}
|
|
@@ -129,7 +128,7 @@ class NestEntityManager {
|
|
|
129
128
|
constructor(entityName, registry) {
|
|
130
129
|
this.services = registry.resolveEntityServicesCollection(entityName);
|
|
131
130
|
}
|
|
132
|
-
get
|
|
131
|
+
get manager() {
|
|
133
132
|
if (!this.managerInstance) {
|
|
134
133
|
this.managerInstance =
|
|
135
134
|
this.services.resolveEntityManager();
|
|
@@ -153,6 +152,7 @@ const EntityManagerSymbols = {
|
|
|
153
152
|
EntitySeeder: Symbol.for("WP:ENTITY_SEEDER"),
|
|
154
153
|
EmailProvider: Symbol.for("WP:EMAIL_PROVIDER"),
|
|
155
154
|
EmailTemplate: Symbol.for("WP:EMAIL_TEMPLATE"),
|
|
155
|
+
PipelineTemplate: Symbol.for("WP:PIPELINE_TEMPLATE"),
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
const WpEntityAuthMiddleware = (entityName, props = {}) => applyDecorators(Injectable(), SetMetadata(EntityManagerSymbols.EntityAuthMiddleware, {
|
|
@@ -209,6 +209,11 @@ const WpEntityQueryBuilder = (entityName, props = {}) => applyDecorators(Injecta
|
|
|
209
209
|
...props,
|
|
210
210
|
}));
|
|
211
211
|
|
|
212
|
+
const WpPipeline = (name, props = {}) => applyDecorators(Injectable(), SetMetadata(EntityManagerSymbols.PipelineTemplate, {
|
|
213
|
+
name,
|
|
214
|
+
...props,
|
|
215
|
+
}));
|
|
216
|
+
|
|
212
217
|
const WpEntitySeeder = (entityName, props = {}) => applyDecorators(Injectable(), SetMetadata(EntityManagerSymbols.EntitySeeder, {
|
|
213
218
|
entityName,
|
|
214
219
|
...props,
|
|
@@ -420,7 +425,12 @@ AuthGuard = __decorate([
|
|
|
420
425
|
__metadata("design:paramtypes", [Reflector])
|
|
421
426
|
], AuthGuard);
|
|
422
427
|
|
|
423
|
-
|
|
428
|
+
var UserCreationError;
|
|
429
|
+
(function (UserCreationError) {
|
|
430
|
+
UserCreationError["UserAlreadyExists"] = "userAlreadyExists";
|
|
431
|
+
})(UserCreationError || (UserCreationError = {}));
|
|
432
|
+
|
|
433
|
+
const sessionStorage = new AsyncLocalStorage();
|
|
424
434
|
|
|
425
435
|
let AppSessionService = class AppSessionService {
|
|
426
436
|
getValue(key) {
|
|
@@ -436,7 +446,7 @@ let AppSessionService = class AppSessionService {
|
|
|
436
446
|
return this.getSession().request;
|
|
437
447
|
}
|
|
438
448
|
getSession() {
|
|
439
|
-
const store =
|
|
449
|
+
const store = sessionStorage.getStore();
|
|
440
450
|
if (!store) {
|
|
441
451
|
throw new Error("No active context found");
|
|
442
452
|
}
|
|
@@ -459,6 +469,15 @@ AppHashingService = __decorate([
|
|
|
459
469
|
Injectable()
|
|
460
470
|
], AppHashingService);
|
|
461
471
|
|
|
472
|
+
class EntitiesCountAction {
|
|
473
|
+
constructor(services) {
|
|
474
|
+
this.services = services;
|
|
475
|
+
}
|
|
476
|
+
async execute(filters) {
|
|
477
|
+
return await this.services.resolveCountQuery().execute(filters);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
462
481
|
class EntityCreateAction {
|
|
463
482
|
constructor(services) {
|
|
464
483
|
this.services = services;
|
|
@@ -486,6 +505,24 @@ class EntityDeleteAction {
|
|
|
486
505
|
}
|
|
487
506
|
}
|
|
488
507
|
|
|
508
|
+
class EntitiesDeleteAction {
|
|
509
|
+
constructor(services) {
|
|
510
|
+
this.services = services;
|
|
511
|
+
}
|
|
512
|
+
async execute(params) {
|
|
513
|
+
await this.services.resolveDeleteItemsCommand().execute(params);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
class EntityExistsAction {
|
|
518
|
+
constructor(services) {
|
|
519
|
+
this.services = services;
|
|
520
|
+
}
|
|
521
|
+
async execute(filters) {
|
|
522
|
+
return await this.services.resolveExistsQuery().execute(filters);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
489
526
|
class EntityGetAction {
|
|
490
527
|
constructor(services) {
|
|
491
528
|
this.services = services;
|
|
@@ -570,7 +607,10 @@ class EntityCreateCommand {
|
|
|
570
607
|
return;
|
|
571
608
|
}
|
|
572
609
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
573
|
-
const context = await contextService
|
|
610
|
+
const context = await contextService?.getContext();
|
|
611
|
+
if (!context) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
574
614
|
const authorizationResult = await authorization.canCreate(entity, context);
|
|
575
615
|
if (!authorizationResult.isAuthorized)
|
|
576
616
|
throw new EntityOperationUnauthorizedException(EntityOperationType.Create, this.services.getEntityName(), entity);
|
|
@@ -596,13 +636,53 @@ class EntityDeleteCommand {
|
|
|
596
636
|
throw new EntityNotFoundException(id);
|
|
597
637
|
}
|
|
598
638
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
599
|
-
const context = await contextService
|
|
639
|
+
const context = await contextService?.getContext();
|
|
640
|
+
if (!context) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
600
643
|
const authorizationResult = await authorization.canDelete(entity, context);
|
|
601
644
|
if (!authorizationResult.isAuthorized)
|
|
602
645
|
throw new EntityOperationUnauthorizedException(EntityOperationType.Delete, this.services.getEntityName(), entity);
|
|
603
646
|
}
|
|
604
647
|
}
|
|
605
648
|
|
|
649
|
+
class EntitiesDeleteCommand {
|
|
650
|
+
constructor(services) {
|
|
651
|
+
this.services = services;
|
|
652
|
+
}
|
|
653
|
+
async execute(params) {
|
|
654
|
+
await this.authorize();
|
|
655
|
+
const context = await this.getContext();
|
|
656
|
+
const deleteResult = await this.services
|
|
657
|
+
.resolveQueryBuilder()
|
|
658
|
+
.delete(params.filters, context);
|
|
659
|
+
// todo: add entities deleted event
|
|
660
|
+
return deleteResult;
|
|
661
|
+
}
|
|
662
|
+
async getContext() {
|
|
663
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
664
|
+
if (!authorization) {
|
|
665
|
+
return undefined;
|
|
666
|
+
}
|
|
667
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
668
|
+
return await contextService.getContext();
|
|
669
|
+
}
|
|
670
|
+
async authorize() {
|
|
671
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
672
|
+
if (!authorization) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
676
|
+
const context = await contextService?.getContext();
|
|
677
|
+
if (!context) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const authorizationResult = await authorization.canDeleteItems(context);
|
|
681
|
+
if (!authorizationResult.isAuthorized)
|
|
682
|
+
throw new EntityOperationUnauthorizedException(EntityOperationType.Delete, this.services.getEntityName());
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
606
686
|
class EntityUpdateCommand {
|
|
607
687
|
constructor(services) {
|
|
608
688
|
this.services = services;
|
|
@@ -634,7 +714,10 @@ class EntityUpdateCommand {
|
|
|
634
714
|
throw new EntityNotFoundException();
|
|
635
715
|
}
|
|
636
716
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
637
|
-
const context = await contextService
|
|
717
|
+
const context = await contextService?.getContext();
|
|
718
|
+
if (!context) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
638
721
|
const authorizationResult = await authorization.canUpdate(currentEntity, context);
|
|
639
722
|
if (!authorizationResult.isAuthorized)
|
|
640
723
|
throw new EntityOperationUnauthorizedException(EntityOperationType.Create, this.services.getEntityName(), currentEntity);
|
|
@@ -670,7 +753,10 @@ class EntityUpsertCommand {
|
|
|
670
753
|
}
|
|
671
754
|
const currentEntity = await this.services.resolveRepository().get(id);
|
|
672
755
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
673
|
-
const context = await contextService
|
|
756
|
+
const context = await contextService?.getContext();
|
|
757
|
+
if (!context) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
674
760
|
if (currentEntity) {
|
|
675
761
|
const updateResult = await authorization.canUpdate(currentEntity, context);
|
|
676
762
|
if (!updateResult.isAuthorized)
|
|
@@ -687,23 +773,31 @@ class EntityManager {
|
|
|
687
773
|
constructor(services) {
|
|
688
774
|
this.services = services;
|
|
689
775
|
}
|
|
690
|
-
get() {
|
|
776
|
+
get exists() {
|
|
777
|
+
return this.services.resolveExistsQuery();
|
|
778
|
+
}
|
|
779
|
+
get count() {
|
|
780
|
+
return this.services.resolveCountQuery();
|
|
781
|
+
}
|
|
782
|
+
get deleteItems() {
|
|
783
|
+
return this.services.resolveDeleteItemsCommand();
|
|
784
|
+
}
|
|
785
|
+
get get() {
|
|
691
786
|
return this.services.resolveGetQuery();
|
|
692
787
|
}
|
|
693
|
-
|
|
694
|
-
search() {
|
|
788
|
+
get search() {
|
|
695
789
|
return this.services.resolveSearchQuery();
|
|
696
790
|
}
|
|
697
|
-
create() {
|
|
791
|
+
get create() {
|
|
698
792
|
return this.services.resolveCreateCommand();
|
|
699
793
|
}
|
|
700
|
-
update() {
|
|
794
|
+
get update() {
|
|
701
795
|
return this.services.resolveUpdateCommand();
|
|
702
796
|
}
|
|
703
|
-
upsert() {
|
|
797
|
+
get upsert() {
|
|
704
798
|
return this.services.resolveUpsertCommand();
|
|
705
799
|
}
|
|
706
|
-
delete() {
|
|
800
|
+
get delete() {
|
|
707
801
|
return this.services.resolveDeleteCommand();
|
|
708
802
|
}
|
|
709
803
|
}
|
|
@@ -711,22 +805,31 @@ class EntityActions {
|
|
|
711
805
|
constructor(services) {
|
|
712
806
|
this.services = services;
|
|
713
807
|
}
|
|
714
|
-
get() {
|
|
808
|
+
get exists() {
|
|
809
|
+
return this.services.resolveExistsAction();
|
|
810
|
+
}
|
|
811
|
+
get count() {
|
|
812
|
+
return this.services.resolveCountAction();
|
|
813
|
+
}
|
|
814
|
+
get deleteItems() {
|
|
815
|
+
return this.services.resolveDeleteItemsAction();
|
|
816
|
+
}
|
|
817
|
+
get get() {
|
|
715
818
|
return this.services.resolveGetAction();
|
|
716
819
|
}
|
|
717
|
-
search() {
|
|
820
|
+
get search() {
|
|
718
821
|
return this.services.resolveSearchAction();
|
|
719
822
|
}
|
|
720
|
-
create() {
|
|
823
|
+
get create() {
|
|
721
824
|
return this.services.resolveCreateAction();
|
|
722
825
|
}
|
|
723
|
-
update() {
|
|
826
|
+
get update() {
|
|
724
827
|
return this.services.resolveUpdateAction();
|
|
725
828
|
}
|
|
726
|
-
upsert() {
|
|
829
|
+
get upsert() {
|
|
727
830
|
return this.services.resolveUpsertAction();
|
|
728
831
|
}
|
|
729
|
-
delete() {
|
|
832
|
+
get delete() {
|
|
730
833
|
return this.services.resolveDeleteAction();
|
|
731
834
|
}
|
|
732
835
|
}
|
|
@@ -772,6 +875,9 @@ class ServiceLocator {
|
|
|
772
875
|
const EntityServices = {
|
|
773
876
|
Actions: {
|
|
774
877
|
IEntityGetAction: "IEntityGetAction",
|
|
878
|
+
IEntityExistsAction: "IEntityExistsAction",
|
|
879
|
+
IEntitiesCountAction: "IEntitiesCountAction",
|
|
880
|
+
IEntitiesDeleteAction: "IEntitiesDeleteAction",
|
|
775
881
|
IEntitiesSearchAction: "IEntitiesSearchAction",
|
|
776
882
|
IEntityCreateAction: "IEntityCreateAction",
|
|
777
883
|
IEntityUpdateAction: "IEntityUpdateAction",
|
|
@@ -788,6 +894,7 @@ const EntityServices = {
|
|
|
788
894
|
IEntityUpsertCommand: "IEntityUpsertCommand",
|
|
789
895
|
IEntityMergeCommand: "IEntityMergeCommand",
|
|
790
896
|
IEntityDeleteCommand: "IEntityDeleteCommand",
|
|
897
|
+
IEntitiesDeleteCommand: "IEntitiesDeleteCommand",
|
|
791
898
|
},
|
|
792
899
|
Converters: {
|
|
793
900
|
IEntityAdapter: "IEntityAdapter",
|
|
@@ -802,6 +909,8 @@ const EntityServices = {
|
|
|
802
909
|
IEntityEventsManager: "IEntityEventsManager",
|
|
803
910
|
},
|
|
804
911
|
Queries: {
|
|
912
|
+
IEntityCountQuery: "IEntityCountQuery",
|
|
913
|
+
IEntityExistsQuery: "IEntityExistsQuery",
|
|
805
914
|
IEntityGetQuery: "IEntityGetQuery",
|
|
806
915
|
IEntitiesSearchQuery: "IEntitiesSearchQuery",
|
|
807
916
|
IEntitiesQueryBuilder: "IEntitiesQueryBuilder",
|
|
@@ -831,6 +940,9 @@ const GlobalServices = {
|
|
|
831
940
|
IEmailProvider: "IEmailProvider",
|
|
832
941
|
IEmailTemplatesCollection: "IEmailTemplatesCollection",
|
|
833
942
|
},
|
|
943
|
+
Pipelines: {
|
|
944
|
+
IPipelineController: "IPipelineController",
|
|
945
|
+
},
|
|
834
946
|
};
|
|
835
947
|
|
|
836
948
|
class EntityServiceLocator {
|
|
@@ -886,6 +998,12 @@ class EntityServiceLocator {
|
|
|
886
998
|
resolveGetQuery() {
|
|
887
999
|
return this.services.resolveGetQuery(this.entityName);
|
|
888
1000
|
}
|
|
1001
|
+
resolveExistsQuery() {
|
|
1002
|
+
return this.services.resolveExistsQuery(this.entityName);
|
|
1003
|
+
}
|
|
1004
|
+
resolveCountQuery() {
|
|
1005
|
+
return this.services.resolveCountQuery(this.entityName);
|
|
1006
|
+
}
|
|
889
1007
|
resolveSearchQuery() {
|
|
890
1008
|
return this.services.resolveSearchQuery(this.entityName);
|
|
891
1009
|
}
|
|
@@ -904,9 +1022,18 @@ class EntityServiceLocator {
|
|
|
904
1022
|
resolveDeleteCommand() {
|
|
905
1023
|
return this.services.resolveDeleteCommand(this.entityName);
|
|
906
1024
|
}
|
|
1025
|
+
resolveDeleteItemsCommand() {
|
|
1026
|
+
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
1027
|
+
}
|
|
907
1028
|
resolveGetAction() {
|
|
908
1029
|
return this.services.resolveGetAction(this.entityName);
|
|
909
1030
|
}
|
|
1031
|
+
resolveExistsAction() {
|
|
1032
|
+
return this.services.resolveExistsAction(this.entityName);
|
|
1033
|
+
}
|
|
1034
|
+
resolveCountAction() {
|
|
1035
|
+
return this.services.resolveCountAction(this.entityName);
|
|
1036
|
+
}
|
|
910
1037
|
resolveSearchAction() {
|
|
911
1038
|
return this.services.resolveSearchAction(this.entityName);
|
|
912
1039
|
}
|
|
@@ -922,6 +1049,9 @@ class EntityServiceLocator {
|
|
|
922
1049
|
resolveDeleteAction() {
|
|
923
1050
|
return this.services.resolveDeleteAction(this.entityName);
|
|
924
1051
|
}
|
|
1052
|
+
resolveDeleteItemsAction() {
|
|
1053
|
+
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
1054
|
+
}
|
|
925
1055
|
resolveQueryBuilder() {
|
|
926
1056
|
return this.services.resolveQueryBuilder(this.entityName);
|
|
927
1057
|
}
|
|
@@ -962,8 +1092,16 @@ class EntitiesServiceLocator {
|
|
|
962
1092
|
registerEmailTemplatesCollection(instance) {
|
|
963
1093
|
this.provider.register(GlobalServices.Messaging.IEmailTemplatesCollection, instance);
|
|
964
1094
|
}
|
|
1095
|
+
resolvePipelinesController() {
|
|
1096
|
+
return this.provider.resolve(GlobalServices.Pipelines.IPipelineController);
|
|
1097
|
+
}
|
|
1098
|
+
registerPipelinesController(instance) {
|
|
1099
|
+
this.provider.register(GlobalServices.Pipelines.IPipelineController, instance);
|
|
1100
|
+
}
|
|
965
1101
|
resolveAuthenticationContextProvider() {
|
|
966
|
-
return this.provider.resolve(GlobalServices.Authentication.IAuthenticationContextProvider
|
|
1102
|
+
return this.provider.resolve(GlobalServices.Authentication.IAuthenticationContextProvider, {
|
|
1103
|
+
optional: true,
|
|
1104
|
+
});
|
|
967
1105
|
}
|
|
968
1106
|
registerAuthenticationContextProvider(instance) {
|
|
969
1107
|
this.provider.register(GlobalServices.Authentication.IAuthenticationContextProvider, instance);
|
|
@@ -1064,6 +1202,18 @@ class EntitiesServiceLocator {
|
|
|
1064
1202
|
registerSearchQuery(entityName, instance) {
|
|
1065
1203
|
this.provider.registerEntityService(EntityServices.Queries.IEntitiesSearchQuery, entityName, instance);
|
|
1066
1204
|
}
|
|
1205
|
+
resolveExistsQuery(entityName) {
|
|
1206
|
+
return this.provider.resolveEntityService(EntityServices.Queries.IEntityExistsQuery, entityName);
|
|
1207
|
+
}
|
|
1208
|
+
registerExistsQuery(entityName, instance) {
|
|
1209
|
+
this.provider.registerEntityService(EntityServices.Queries.IEntityExistsQuery, entityName, instance);
|
|
1210
|
+
}
|
|
1211
|
+
resolveCountQuery(entityName) {
|
|
1212
|
+
return this.provider.resolveEntityService(EntityServices.Queries.IEntityCountQuery, entityName);
|
|
1213
|
+
}
|
|
1214
|
+
registerCountQuery(entityName, instance) {
|
|
1215
|
+
this.provider.registerEntityService(EntityServices.Queries.IEntityCountQuery, entityName, instance);
|
|
1216
|
+
}
|
|
1067
1217
|
resolveCreateCommand(entityName) {
|
|
1068
1218
|
return this.provider.resolveEntityService(EntityServices.Commands.IEntityCreateCommand, entityName);
|
|
1069
1219
|
}
|
|
@@ -1082,6 +1232,12 @@ class EntitiesServiceLocator {
|
|
|
1082
1232
|
registerUpsertCommand(entityName, instance) {
|
|
1083
1233
|
this.provider.registerEntityService(EntityServices.Commands.IEntityUpsertCommand, entityName, instance);
|
|
1084
1234
|
}
|
|
1235
|
+
resolveDeleteItemsCommand(entityName) {
|
|
1236
|
+
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesDeleteCommand, entityName);
|
|
1237
|
+
}
|
|
1238
|
+
registerDeleteItemsCommand(entityName, instance) {
|
|
1239
|
+
this.provider.registerEntityService(EntityServices.Commands.IEntitiesDeleteCommand, entityName, instance);
|
|
1240
|
+
}
|
|
1085
1241
|
// resolveMergeCommand<TEntity>(
|
|
1086
1242
|
// entityName: string
|
|
1087
1243
|
// ): IEntityMergeCommand<TEntity> {
|
|
@@ -1122,6 +1278,18 @@ class EntitiesServiceLocator {
|
|
|
1122
1278
|
registerGetAction(entityName, instance) {
|
|
1123
1279
|
this.provider.registerEntityService(EntityServices.Actions.IEntityGetAction, entityName, instance);
|
|
1124
1280
|
}
|
|
1281
|
+
resolveExistsAction(entityName) {
|
|
1282
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntityExistsAction, entityName);
|
|
1283
|
+
}
|
|
1284
|
+
registerExistsAction(entityName, instance) {
|
|
1285
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntityExistsAction, entityName, instance);
|
|
1286
|
+
}
|
|
1287
|
+
resolveCountAction(entityName) {
|
|
1288
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesCountAction, entityName);
|
|
1289
|
+
}
|
|
1290
|
+
registerCountAction(entityName, instance) {
|
|
1291
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesCountAction, entityName, instance);
|
|
1292
|
+
}
|
|
1125
1293
|
resolveSearchAction(entityName) {
|
|
1126
1294
|
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesSearchAction, entityName);
|
|
1127
1295
|
}
|
|
@@ -1152,6 +1320,12 @@ class EntitiesServiceLocator {
|
|
|
1152
1320
|
registerDeleteAction(entityName, instance) {
|
|
1153
1321
|
this.provider.registerEntityService(EntityServices.Actions.IEntityDeleteAction, entityName, instance);
|
|
1154
1322
|
}
|
|
1323
|
+
resolveDeleteItemsAction(entityName) {
|
|
1324
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesDeleteAction, entityName);
|
|
1325
|
+
}
|
|
1326
|
+
registerDeleteItemsAction(entityName, instance) {
|
|
1327
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesDeleteAction, entityName, instance);
|
|
1328
|
+
}
|
|
1155
1329
|
resolveQueryBuilder(entityName) {
|
|
1156
1330
|
return this.provider.resolveEntityService(EntityServices.Queries.IEntitiesQueryBuilder, entityName);
|
|
1157
1331
|
}
|
|
@@ -1160,12 +1334,74 @@ class EntitiesServiceLocator {
|
|
|
1160
1334
|
}
|
|
1161
1335
|
}
|
|
1162
1336
|
|
|
1337
|
+
class EntitiesCountQuery {
|
|
1338
|
+
constructor(services) {
|
|
1339
|
+
this.services = services;
|
|
1340
|
+
}
|
|
1341
|
+
async execute(filters) {
|
|
1342
|
+
const context = await this.getContext();
|
|
1343
|
+
await this.authorizeSearch(context);
|
|
1344
|
+
return await this.services
|
|
1345
|
+
.resolveQueryBuilder()
|
|
1346
|
+
.count(filters, context);
|
|
1347
|
+
}
|
|
1348
|
+
async getContext() {
|
|
1349
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1350
|
+
if (!authorization) {
|
|
1351
|
+
return undefined;
|
|
1352
|
+
}
|
|
1353
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1354
|
+
return await contextService.getContext();
|
|
1355
|
+
}
|
|
1356
|
+
async authorizeSearch(context) {
|
|
1357
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1358
|
+
if (!authorization) {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
const { isAuthorized } = await authorization.canSearch(context);
|
|
1362
|
+
if (!isAuthorized) {
|
|
1363
|
+
throw new EntityOperationUnauthorizedException(EntityOperationType.Search, this.services.getEntityName());
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
class EntityExistsQuery {
|
|
1369
|
+
constructor(services) {
|
|
1370
|
+
this.services = services;
|
|
1371
|
+
}
|
|
1372
|
+
async execute(filters) {
|
|
1373
|
+
const context = await this.getContext();
|
|
1374
|
+
await this.authorizeSearch(context);
|
|
1375
|
+
return await this.services
|
|
1376
|
+
.resolveQueryBuilder()
|
|
1377
|
+
.exists(filters, context);
|
|
1378
|
+
}
|
|
1379
|
+
async getContext() {
|
|
1380
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1381
|
+
if (!authorization) {
|
|
1382
|
+
return undefined;
|
|
1383
|
+
}
|
|
1384
|
+
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1385
|
+
return await contextService.getContext();
|
|
1386
|
+
}
|
|
1387
|
+
async authorizeSearch(context) {
|
|
1388
|
+
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
1389
|
+
if (!authorization) {
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
const { isAuthorized } = await authorization.canSearch(context);
|
|
1393
|
+
if (!isAuthorized) {
|
|
1394
|
+
throw new EntityOperationUnauthorizedException(EntityOperationType.Search, this.services.getEntityName());
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1163
1399
|
class EntityGetQuery {
|
|
1164
1400
|
constructor(services) {
|
|
1165
1401
|
this.services = services;
|
|
1166
1402
|
}
|
|
1167
1403
|
async execute(id) {
|
|
1168
|
-
|
|
1404
|
+
const entity = await this.services.resolveRepository().get(id);
|
|
1169
1405
|
if (entity) {
|
|
1170
1406
|
await this.authorize(entity);
|
|
1171
1407
|
}
|
|
@@ -1177,7 +1413,10 @@ class EntityGetQuery {
|
|
|
1177
1413
|
return;
|
|
1178
1414
|
}
|
|
1179
1415
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1180
|
-
const context = await contextService
|
|
1416
|
+
const context = await contextService?.getContext();
|
|
1417
|
+
if (!context) {
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1181
1420
|
const authorizationResult = await authorization.canRead(entity, context);
|
|
1182
1421
|
if (!authorizationResult.isAuthorized)
|
|
1183
1422
|
throw new EntityOperationUnauthorizedException(EntityOperationType.Read, this.services.getEntityName(), entity);
|
|
@@ -1188,7 +1427,6 @@ class EntitiesSearchQuery {
|
|
|
1188
1427
|
constructor(services) {
|
|
1189
1428
|
this.services = services;
|
|
1190
1429
|
}
|
|
1191
|
-
// @ts-ignore
|
|
1192
1430
|
async execute(request) {
|
|
1193
1431
|
const context = await this.getContext();
|
|
1194
1432
|
await this.authorizeSearch(context);
|
|
@@ -1213,7 +1451,7 @@ class EntitiesSearchQuery {
|
|
|
1213
1451
|
return undefined;
|
|
1214
1452
|
}
|
|
1215
1453
|
const contextService = this.services.resolveAuthenticationContextProvider();
|
|
1216
|
-
return await contextService
|
|
1454
|
+
return await contextService?.getContext();
|
|
1217
1455
|
}
|
|
1218
1456
|
async filterAllowedEntities(entities, context) {
|
|
1219
1457
|
const authorization = this.services.resolveAuthorizationMiddleware();
|
|
@@ -1483,6 +1721,8 @@ class EntityManagerServiceCollection {
|
|
|
1483
1721
|
}
|
|
1484
1722
|
mapCrudOperations({ queryBuilder, }) {
|
|
1485
1723
|
this.mapGet();
|
|
1724
|
+
this.mapCount();
|
|
1725
|
+
this.mapExists();
|
|
1486
1726
|
this.mapSearch({
|
|
1487
1727
|
queryBuilder,
|
|
1488
1728
|
});
|
|
@@ -1496,6 +1736,16 @@ class EntityManagerServiceCollection {
|
|
|
1496
1736
|
this.locator.registerGetAction(this.entityName, new EntityGetAction(this.resolver));
|
|
1497
1737
|
return this;
|
|
1498
1738
|
}
|
|
1739
|
+
mapCount() {
|
|
1740
|
+
this.locator.registerCountQuery(this.entityName, new EntitiesCountQuery(this.resolver));
|
|
1741
|
+
this.locator.registerCountAction(this.entityName, new EntitiesCountAction(this.resolver));
|
|
1742
|
+
return this;
|
|
1743
|
+
}
|
|
1744
|
+
mapExists() {
|
|
1745
|
+
this.locator.registerExistsQuery(this.entityName, new EntityExistsQuery(this.resolver));
|
|
1746
|
+
this.locator.registerExistsAction(this.entityName, new EntityExistsAction(this.resolver));
|
|
1747
|
+
return this;
|
|
1748
|
+
}
|
|
1499
1749
|
mapSearch({ queryBuilder, }) {
|
|
1500
1750
|
this.locator.registerSearchQuery(this.entityName, new EntitiesSearchQuery(this.resolver));
|
|
1501
1751
|
this.locator.registerSearchAction(this.entityName, new EntitiesSearchAction(this.resolver));
|
|
@@ -1525,6 +1775,8 @@ class EntityManagerServiceCollection {
|
|
|
1525
1775
|
mapDelete() {
|
|
1526
1776
|
this.locator.registerDeleteCommand(this.entityName, new EntityDeleteCommand(this.resolver));
|
|
1527
1777
|
this.locator.registerDeleteAction(this.entityName, new EntityDeleteAction(this.resolver));
|
|
1778
|
+
this.locator.registerDeleteItemsCommand(this.entityName, new EntitiesDeleteCommand(this.resolver));
|
|
1779
|
+
this.locator.registerDeleteAction(this.entityName, new EntitiesDeleteAction(this.resolver));
|
|
1528
1780
|
return this;
|
|
1529
1781
|
}
|
|
1530
1782
|
addAdapter(adapter) {
|
|
@@ -19278,7 +19530,7 @@ let UserRegistrationHandler = class UserRegistrationHandler {
|
|
|
19278
19530
|
userId: user.id,
|
|
19279
19531
|
};
|
|
19280
19532
|
}
|
|
19281
|
-
const newUser = await this.createUser(input.email, input.registrationInfo, input.context);
|
|
19533
|
+
const newUser = await this.createUser(input.email, input.userName, input.registrationInfo, input.context);
|
|
19282
19534
|
const passwordHash = await this.createPasswordHash(input.password, newUser.id);
|
|
19283
19535
|
await this.services.getUsersService().update(newUser.id, {
|
|
19284
19536
|
passwordHash,
|
|
@@ -19319,8 +19571,10 @@ let UserRegistrationHandler = class UserRegistrationHandler {
|
|
|
19319
19571
|
timestamp: Date.now(),
|
|
19320
19572
|
});
|
|
19321
19573
|
}
|
|
19322
|
-
async createUser(email, info, context) {
|
|
19323
|
-
return await this.services
|
|
19574
|
+
async createUser(email, userName, info, context) {
|
|
19575
|
+
return await this.services
|
|
19576
|
+
.getUsersService()
|
|
19577
|
+
.create(email, userName, info, context);
|
|
19324
19578
|
}
|
|
19325
19579
|
async resolveUser(userName, context) {
|
|
19326
19580
|
return ((await this.services
|
|
@@ -19654,9 +19908,92 @@ UserVerifyRequestHandler = __decorate([
|
|
|
19654
19908
|
JwtProvider])
|
|
19655
19909
|
], UserVerifyRequestHandler);
|
|
19656
19910
|
|
|
19911
|
+
let UserCreationHandler = class UserCreationHandler {
|
|
19912
|
+
constructor(services, passwordHashingProvider) {
|
|
19913
|
+
this.services = services;
|
|
19914
|
+
this.passwordHashingProvider = passwordHashingProvider;
|
|
19915
|
+
this.logger = Log.getLogger("UserCreation");
|
|
19916
|
+
}
|
|
19917
|
+
async execute(input) {
|
|
19918
|
+
const user = (await this.resolveUser(input.email, input.context)) ??
|
|
19919
|
+
(await this.resolveUser(input.userName, input.context));
|
|
19920
|
+
if (user && user.verified) {
|
|
19921
|
+
this.logger.debug(`User already exists: ${input.email} - ${input.userName}`, { user });
|
|
19922
|
+
return {
|
|
19923
|
+
success: false,
|
|
19924
|
+
error: UserCreationError.UserAlreadyExists,
|
|
19925
|
+
};
|
|
19926
|
+
}
|
|
19927
|
+
if (user && !user.verified) {
|
|
19928
|
+
const passwordHash = await this.createPasswordHash(input.password, user.id);
|
|
19929
|
+
await this.services.getUsersService().update(user.id, {
|
|
19930
|
+
passwordHash,
|
|
19931
|
+
passwordUpdateTimestamp: new Date(),
|
|
19932
|
+
verified: true,
|
|
19933
|
+
});
|
|
19934
|
+
this.logger.debug(`User already exists but not verified. Updating password and marking as verified: ${input.email} - ${input.userName}`, { user });
|
|
19935
|
+
return {
|
|
19936
|
+
success: true,
|
|
19937
|
+
userId: user.id,
|
|
19938
|
+
};
|
|
19939
|
+
}
|
|
19940
|
+
const newUser = await this.createUser(input.email, input.userName, input.registrationInfo, input.context);
|
|
19941
|
+
const passwordHash = await this.createPasswordHash(input.password, newUser.id);
|
|
19942
|
+
await this.services.getUsersService().update(newUser.id, {
|
|
19943
|
+
passwordHash,
|
|
19944
|
+
passwordUpdateTimestamp: new Date(),
|
|
19945
|
+
verified: true,
|
|
19946
|
+
});
|
|
19947
|
+
this.logger.debug(`New user created: ${input.email} - ${input.userName}`, {
|
|
19948
|
+
user: newUser,
|
|
19949
|
+
});
|
|
19950
|
+
return {
|
|
19951
|
+
success: true,
|
|
19952
|
+
userId: newUser.id,
|
|
19953
|
+
};
|
|
19954
|
+
}
|
|
19955
|
+
async createPasswordHash(password, userId) {
|
|
19956
|
+
return await this.passwordHashingProvider.hashPassword({
|
|
19957
|
+
password,
|
|
19958
|
+
userId,
|
|
19959
|
+
});
|
|
19960
|
+
}
|
|
19961
|
+
async createUser(email, userName, info, context) {
|
|
19962
|
+
return await this.services
|
|
19963
|
+
.getUsersService()
|
|
19964
|
+
.create(email, userName, info, context);
|
|
19965
|
+
}
|
|
19966
|
+
async resolveUser(userName, context) {
|
|
19967
|
+
return ((await this.services
|
|
19968
|
+
.getUsersService()
|
|
19969
|
+
.getByUserName(userName, context)) ??
|
|
19970
|
+
(await this.services.getUsersService().getByEmail(userName, context)));
|
|
19971
|
+
}
|
|
19972
|
+
};
|
|
19973
|
+
UserCreationHandler = __decorate([
|
|
19974
|
+
Injectable(),
|
|
19975
|
+
__metadata("design:paramtypes", [AuthenticationServicesResolver,
|
|
19976
|
+
PasswordHashingProvider])
|
|
19977
|
+
], UserCreationHandler);
|
|
19978
|
+
|
|
19979
|
+
let UserDeleteHandler = class UserDeleteHandler {
|
|
19980
|
+
constructor(services) {
|
|
19981
|
+
this.services = services;
|
|
19982
|
+
}
|
|
19983
|
+
async execute(input) {
|
|
19984
|
+
await this.services.getUsersService().delete(input.userId);
|
|
19985
|
+
}
|
|
19986
|
+
};
|
|
19987
|
+
UserDeleteHandler = __decorate([
|
|
19988
|
+
Injectable(),
|
|
19989
|
+
__metadata("design:paramtypes", [AuthenticationServicesResolver])
|
|
19990
|
+
], UserDeleteHandler);
|
|
19991
|
+
|
|
19657
19992
|
let AuthenticationService = class AuthenticationService {
|
|
19658
|
-
constructor(userDisableHandler, userEnableHandler, userLoginHandler, userPasswordChangeHandler, userPasswordResetFinalizeHandler, userPasswordResetRequestHandler, userRegistrationHandler, userTokenVerifyHandler, userVerifyRequestHandler, userVerifyCompleteHandler, resolver) {
|
|
19993
|
+
constructor(userCreationHandler, userDisableHandler, userDeleteHandler, userEnableHandler, userLoginHandler, userPasswordChangeHandler, userPasswordResetFinalizeHandler, userPasswordResetRequestHandler, userRegistrationHandler, userTokenVerifyHandler, userVerifyRequestHandler, userVerifyCompleteHandler, resolver) {
|
|
19994
|
+
this.userCreationHandler = userCreationHandler;
|
|
19659
19995
|
this.userDisableHandler = userDisableHandler;
|
|
19996
|
+
this.userDeleteHandler = userDeleteHandler;
|
|
19660
19997
|
this.userEnableHandler = userEnableHandler;
|
|
19661
19998
|
this.userLoginHandler = userLoginHandler;
|
|
19662
19999
|
this.userPasswordChangeHandler = userPasswordChangeHandler;
|
|
@@ -19668,9 +20005,15 @@ let AuthenticationService = class AuthenticationService {
|
|
|
19668
20005
|
this.userVerifyCompleteHandler = userVerifyCompleteHandler;
|
|
19669
20006
|
this.resolver = resolver;
|
|
19670
20007
|
}
|
|
20008
|
+
async userCreate(input) {
|
|
20009
|
+
return await this.userCreationHandler.execute(input);
|
|
20010
|
+
}
|
|
19671
20011
|
async userDisable(input) {
|
|
19672
20012
|
await this.userDisableHandler.execute(input);
|
|
19673
20013
|
}
|
|
20014
|
+
async userDelete(input) {
|
|
20015
|
+
await this.userDeleteHandler.execute(input);
|
|
20016
|
+
}
|
|
19674
20017
|
async userEnable(input) {
|
|
19675
20018
|
await this.userEnableHandler.execute(input);
|
|
19676
20019
|
}
|
|
@@ -19710,7 +20053,9 @@ let AuthenticationService = class AuthenticationService {
|
|
|
19710
20053
|
};
|
|
19711
20054
|
AuthenticationService = __decorate([
|
|
19712
20055
|
Injectable(),
|
|
19713
|
-
__metadata("design:paramtypes", [
|
|
20056
|
+
__metadata("design:paramtypes", [UserCreationHandler,
|
|
20057
|
+
UserDisableHandler,
|
|
20058
|
+
UserDeleteHandler,
|
|
19714
20059
|
UserEnableHandler,
|
|
19715
20060
|
UserLoginHandler,
|
|
19716
20061
|
UserPasswordChangeHandler,
|
|
@@ -19771,6 +20116,239 @@ const orderByPriority = (items, priorityFieldSelector, nameFieldSelector) => {
|
|
|
19771
20116
|
return sort(items, byField((x) => priorityFieldSelector(x) ?? Number.MAX_VALUE), byField((x) => nameFieldSelector(x)));
|
|
19772
20117
|
};
|
|
19773
20118
|
|
|
20119
|
+
var PipelineStepErrorType;
|
|
20120
|
+
(function (PipelineStepErrorType) {
|
|
20121
|
+
PipelineStepErrorType["FailedPrecondition"] = "failedPrecondition";
|
|
20122
|
+
PipelineStepErrorType["OperationError"] = "operationError";
|
|
20123
|
+
PipelineStepErrorType["RollbackError"] = "rollbackError";
|
|
20124
|
+
PipelineStepErrorType["GenericError"] = "genericError";
|
|
20125
|
+
})(PipelineStepErrorType || (PipelineStepErrorType = {}));
|
|
20126
|
+
var PipelineErrorType;
|
|
20127
|
+
(function (PipelineErrorType) {
|
|
20128
|
+
PipelineErrorType["FailedPrecondition"] = "failedPrecondition";
|
|
20129
|
+
PipelineErrorType["OperationError"] = "operationError";
|
|
20130
|
+
PipelineErrorType["RollbackError"] = "rollbackError";
|
|
20131
|
+
PipelineErrorType["Unauthorized"] = "unauthorized";
|
|
20132
|
+
PipelineErrorType["GenericError"] = "genericError";
|
|
20133
|
+
})(PipelineErrorType || (PipelineErrorType = {}));
|
|
20134
|
+
var PipelineStatus;
|
|
20135
|
+
(function (PipelineStatus) {
|
|
20136
|
+
PipelineStatus["Initializing"] = "initializing";
|
|
20137
|
+
PipelineStatus["Running"] = "running";
|
|
20138
|
+
PipelineStatus["RollbackInProgress"] = "rollbackInProgress";
|
|
20139
|
+
PipelineStatus["Completed"] = "completed";
|
|
20140
|
+
PipelineStatus["Failed"] = "failed";
|
|
20141
|
+
})(PipelineStatus || (PipelineStatus = {}));
|
|
20142
|
+
|
|
20143
|
+
const toPipelineOperationError = (error) => ({
|
|
20144
|
+
message: error.message,
|
|
20145
|
+
exception: error,
|
|
20146
|
+
});
|
|
20147
|
+
const getStepOutput = (result) => {
|
|
20148
|
+
return result.type === "success" ? result.output : undefined;
|
|
20149
|
+
};
|
|
20150
|
+
const getOperationOutput = (result) => {
|
|
20151
|
+
return result.type === "success" ? result.output : undefined;
|
|
20152
|
+
};
|
|
20153
|
+
const mapPipelineErrorType = (stepError) => {
|
|
20154
|
+
switch (stepError) {
|
|
20155
|
+
case PipelineStepErrorType.FailedPrecondition:
|
|
20156
|
+
return PipelineErrorType.FailedPrecondition;
|
|
20157
|
+
case PipelineStepErrorType.OperationError:
|
|
20158
|
+
return PipelineErrorType.OperationError;
|
|
20159
|
+
case PipelineStepErrorType.RollbackError:
|
|
20160
|
+
return PipelineErrorType.RollbackError;
|
|
20161
|
+
case PipelineStepErrorType.GenericError:
|
|
20162
|
+
return PipelineErrorType.GenericError;
|
|
20163
|
+
}
|
|
20164
|
+
};
|
|
20165
|
+
|
|
20166
|
+
class PipelineInstance {
|
|
20167
|
+
constructor(definition, input, context) {
|
|
20168
|
+
this.definition = definition;
|
|
20169
|
+
this.input = input;
|
|
20170
|
+
this.context = context;
|
|
20171
|
+
this.status = PipelineStatus.Initializing;
|
|
20172
|
+
}
|
|
20173
|
+
async execute() {
|
|
20174
|
+
this.status = PipelineStatus.Running;
|
|
20175
|
+
const executedSteps = [];
|
|
20176
|
+
const stepResults = [];
|
|
20177
|
+
let state = this.buildInitialStepState();
|
|
20178
|
+
for (const [i, step] of this.definition.steps.entries()) {
|
|
20179
|
+
executedSteps.push(step);
|
|
20180
|
+
const stepResult = await this.executeStep(step, i > 0 ? getStepOutput(stepResults[i - 1]) : this.input, state);
|
|
20181
|
+
stepResults.push(stepResult);
|
|
20182
|
+
state = this.buildNextStepState(state, stepResult);
|
|
20183
|
+
if (stepResult.type !== "success") {
|
|
20184
|
+
this.status = PipelineStatus.RollbackInProgress;
|
|
20185
|
+
await this.rollbackSteps(executedSteps, stepResults, state);
|
|
20186
|
+
return {
|
|
20187
|
+
type: "error",
|
|
20188
|
+
errorType: mapPipelineErrorType(stepResult.errorType),
|
|
20189
|
+
input: this.input,
|
|
20190
|
+
stepResults,
|
|
20191
|
+
};
|
|
20192
|
+
}
|
|
20193
|
+
}
|
|
20194
|
+
this.status = PipelineStatus.Completed;
|
|
20195
|
+
return {
|
|
20196
|
+
type: "success",
|
|
20197
|
+
input: this.input,
|
|
20198
|
+
output: getStepOutput(stepResults[stepResults.length - 1]),
|
|
20199
|
+
stepResults,
|
|
20200
|
+
};
|
|
20201
|
+
}
|
|
20202
|
+
buildInitialStepState() {
|
|
20203
|
+
return {
|
|
20204
|
+
stepInput: this.input,
|
|
20205
|
+
context: this.context,
|
|
20206
|
+
pipelineInput: this.input,
|
|
20207
|
+
};
|
|
20208
|
+
}
|
|
20209
|
+
buildNextStepState(state, stepResult) {
|
|
20210
|
+
return {
|
|
20211
|
+
stepInput: getStepOutput(stepResult),
|
|
20212
|
+
context: this.context,
|
|
20213
|
+
pipelineInput: this.input,
|
|
20214
|
+
previousStep: {
|
|
20215
|
+
stepInput: state.stepInput,
|
|
20216
|
+
stepOutput: getStepOutput(stepResult),
|
|
20217
|
+
context: this.context,
|
|
20218
|
+
pipelineInput: this.input,
|
|
20219
|
+
previousStep: state.previousStep,
|
|
20220
|
+
},
|
|
20221
|
+
};
|
|
20222
|
+
}
|
|
20223
|
+
async rollbackSteps(executedSteps, stepsResults, state) {
|
|
20224
|
+
const rollbackSteps = executedSteps
|
|
20225
|
+
.map((x, i) => ({
|
|
20226
|
+
step: x,
|
|
20227
|
+
result: stepsResults[i],
|
|
20228
|
+
}))
|
|
20229
|
+
.reverse();
|
|
20230
|
+
let rollbackState = state;
|
|
20231
|
+
for (const step of rollbackSteps) {
|
|
20232
|
+
await this.rollbackStep(step.step, step.result, rollbackState);
|
|
20233
|
+
rollbackState = state.previousStep;
|
|
20234
|
+
}
|
|
20235
|
+
}
|
|
20236
|
+
async rollbackStep(step, stepResults, state) {
|
|
20237
|
+
const completedOperations = stepResults.operationResults.map((x, i) => ({
|
|
20238
|
+
result: x,
|
|
20239
|
+
operation: step.operations[i],
|
|
20240
|
+
}));
|
|
20241
|
+
// .filter((x) => x.result.type === "success")
|
|
20242
|
+
const rollbackOperations = completedOperations.map((x) => this.rollbackOperations(x.operation, x.result.input, getOperationOutput(x.result), state));
|
|
20243
|
+
const rollbackResults = await Promise.all(rollbackOperations);
|
|
20244
|
+
const isRollbackError = rollbackResults.some((x) => x.type === "error");
|
|
20245
|
+
if (isRollbackError) {
|
|
20246
|
+
return {
|
|
20247
|
+
type: "error",
|
|
20248
|
+
};
|
|
20249
|
+
}
|
|
20250
|
+
return {
|
|
20251
|
+
type: "success",
|
|
20252
|
+
};
|
|
20253
|
+
}
|
|
20254
|
+
async validateStepPrecondition(step, input, state) {
|
|
20255
|
+
const preconditionOperations = step.operations
|
|
20256
|
+
.filter((x) => x.operation.precondition)
|
|
20257
|
+
.map((x) => x.operation.precondition(input, state));
|
|
20258
|
+
const preconditionResults = await Promise.all(preconditionOperations);
|
|
20259
|
+
return {
|
|
20260
|
+
hasValidPrecondition: preconditionResults.every((x) => x),
|
|
20261
|
+
};
|
|
20262
|
+
}
|
|
20263
|
+
async executeStep(step, input, state) {
|
|
20264
|
+
const preconditionResult = await this.validateStepPrecondition(step, input, state);
|
|
20265
|
+
if (!preconditionResult.hasValidPrecondition) {
|
|
20266
|
+
return {
|
|
20267
|
+
operationResults: [],
|
|
20268
|
+
type: "error",
|
|
20269
|
+
errorType: PipelineStepErrorType.FailedPrecondition,
|
|
20270
|
+
input,
|
|
20271
|
+
};
|
|
20272
|
+
}
|
|
20273
|
+
const stepOperations = step.operations.map((x) => this.executeOperation(x, input, state));
|
|
20274
|
+
const operationResults = await Promise.all(stepOperations);
|
|
20275
|
+
const isSuccess = operationResults.every((x) => x.type === "success");
|
|
20276
|
+
if (isSuccess) {
|
|
20277
|
+
const output = step.outputsReducer
|
|
20278
|
+
? step.outputsReducer(operationResults.map((x) => getOperationOutput(x)))
|
|
20279
|
+
: operationResults.map((x) => getOperationOutput(x));
|
|
20280
|
+
return {
|
|
20281
|
+
type: "success",
|
|
20282
|
+
operationResults,
|
|
20283
|
+
input,
|
|
20284
|
+
output: output,
|
|
20285
|
+
};
|
|
20286
|
+
}
|
|
20287
|
+
return {
|
|
20288
|
+
type: "error",
|
|
20289
|
+
errorType: PipelineStepErrorType.OperationError,
|
|
20290
|
+
operationResults,
|
|
20291
|
+
input,
|
|
20292
|
+
};
|
|
20293
|
+
}
|
|
20294
|
+
async executeOperation(operation, input, state) {
|
|
20295
|
+
try {
|
|
20296
|
+
const operationResult = await operation.operation.action(input, state);
|
|
20297
|
+
return {
|
|
20298
|
+
type: "success",
|
|
20299
|
+
input,
|
|
20300
|
+
output: operationResult,
|
|
20301
|
+
};
|
|
20302
|
+
}
|
|
20303
|
+
catch (error) {
|
|
20304
|
+
return {
|
|
20305
|
+
type: "error",
|
|
20306
|
+
input,
|
|
20307
|
+
error: toPipelineOperationError(error),
|
|
20308
|
+
};
|
|
20309
|
+
}
|
|
20310
|
+
}
|
|
20311
|
+
async rollbackOperations(operation, operationInput, operationOutput, state) {
|
|
20312
|
+
if (!operation.rollbackOperations?.length) {
|
|
20313
|
+
return {
|
|
20314
|
+
type: "skipped",
|
|
20315
|
+
};
|
|
20316
|
+
}
|
|
20317
|
+
for (const rollbackOperation of operation.rollbackOperations) {
|
|
20318
|
+
const rollbackResult = await this.rollbackOperation(rollbackOperation, operationInput, operationOutput, state);
|
|
20319
|
+
if (rollbackResult.type === "error") {
|
|
20320
|
+
return {
|
|
20321
|
+
type: "error",
|
|
20322
|
+
error: rollbackResult.error,
|
|
20323
|
+
};
|
|
20324
|
+
}
|
|
20325
|
+
}
|
|
20326
|
+
return {
|
|
20327
|
+
type: "success",
|
|
20328
|
+
};
|
|
20329
|
+
}
|
|
20330
|
+
async rollbackOperation(rollbackOperation, operationInput, operationOutput, state) {
|
|
20331
|
+
try {
|
|
20332
|
+
await rollbackOperation.action(operationInput, operationOutput, state);
|
|
20333
|
+
return {
|
|
20334
|
+
type: "success",
|
|
20335
|
+
};
|
|
20336
|
+
}
|
|
20337
|
+
catch (error) {
|
|
20338
|
+
return {
|
|
20339
|
+
type: "error",
|
|
20340
|
+
error: toPipelineOperationError(error),
|
|
20341
|
+
};
|
|
20342
|
+
}
|
|
20343
|
+
}
|
|
20344
|
+
}
|
|
20345
|
+
|
|
20346
|
+
class PipelineController {
|
|
20347
|
+
async createInstance(definition, input, context) {
|
|
20348
|
+
return new PipelineInstance(definition, input, context);
|
|
20349
|
+
}
|
|
20350
|
+
}
|
|
20351
|
+
|
|
19774
20352
|
var EntityManagerInitializer_1;
|
|
19775
20353
|
let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerInitializer {
|
|
19776
20354
|
constructor(discover, registry, eventEmitter) {
|
|
@@ -19792,6 +20370,7 @@ let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerI
|
|
|
19792
20370
|
await this.registerAuthentication(staticProviders.authenticationProvider);
|
|
19793
20371
|
this.logger.log("Entity manager authentication initialized 🔑");
|
|
19794
20372
|
}
|
|
20373
|
+
await this.registerPipelinesServices();
|
|
19795
20374
|
await this.registerEmailTemplates();
|
|
19796
20375
|
await this.registerEmailProviders();
|
|
19797
20376
|
await this.registerEventTrackingProviders();
|
|
@@ -19896,6 +20475,12 @@ let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerI
|
|
|
19896
20475
|
.getEntitiesServicesLocator()
|
|
19897
20476
|
.registerEmailTemplatesCollection(collection);
|
|
19898
20477
|
}
|
|
20478
|
+
async registerPipelinesServices() {
|
|
20479
|
+
this.registry
|
|
20480
|
+
.getContainer()
|
|
20481
|
+
.getEntitiesServicesLocator()
|
|
20482
|
+
.registerPipelinesController(new PipelineController());
|
|
20483
|
+
}
|
|
19899
20484
|
async initializeProviders(app, staticProviders) {
|
|
19900
20485
|
app
|
|
19901
20486
|
.get(ModulesContainerProvider)
|
|
@@ -19943,18 +20528,148 @@ const Processors = [EntityManagerInitializer];
|
|
|
19943
20528
|
|
|
19944
20529
|
const Providers = [NestEventEmitter];
|
|
19945
20530
|
|
|
20531
|
+
class PipelineStepOperationOptionsBuilder {
|
|
20532
|
+
constructor(operation) {
|
|
20533
|
+
this.operation = operation;
|
|
20534
|
+
this.rollbackOperations = [];
|
|
20535
|
+
}
|
|
20536
|
+
withRollback(definition) {
|
|
20537
|
+
this.rollbackOperations.push(definition);
|
|
20538
|
+
return this;
|
|
20539
|
+
}
|
|
20540
|
+
build() {
|
|
20541
|
+
return {
|
|
20542
|
+
name: this.operation.name,
|
|
20543
|
+
operation: this.operation,
|
|
20544
|
+
rollbackOperations: this.rollbackOperations,
|
|
20545
|
+
};
|
|
20546
|
+
}
|
|
20547
|
+
}
|
|
20548
|
+
class PipelineStepOperationsBuilder {
|
|
20549
|
+
constructor() {
|
|
20550
|
+
this.operationBuilders = [];
|
|
20551
|
+
}
|
|
20552
|
+
addOperation(operation) {
|
|
20553
|
+
const operationBuilder = new PipelineStepOperationOptionsBuilder(operation);
|
|
20554
|
+
this.operationBuilders.push(operationBuilder);
|
|
20555
|
+
return operationBuilder;
|
|
20556
|
+
}
|
|
20557
|
+
buildOperations() {
|
|
20558
|
+
return this.operationBuilders.map((builder) => builder.build());
|
|
20559
|
+
}
|
|
20560
|
+
}
|
|
20561
|
+
class PipelineStepBuilder {
|
|
20562
|
+
constructor(previousSteps, currentStepOperationsBuilder) {
|
|
20563
|
+
this.previousSteps = previousSteps;
|
|
20564
|
+
this.currentStep = this.buildCurrentStep(currentStepOperationsBuilder);
|
|
20565
|
+
}
|
|
20566
|
+
addStep(builder) {
|
|
20567
|
+
return new PipelineStepBuilder(this.currentSteps, builder);
|
|
20568
|
+
}
|
|
20569
|
+
buildCurrentStep(currentStepOperationsBuilder) {
|
|
20570
|
+
const operationsBuilder = new PipelineStepOperationsBuilder();
|
|
20571
|
+
currentStepOperationsBuilder(operationsBuilder);
|
|
20572
|
+
return {
|
|
20573
|
+
name: `Step ${this.previousSteps.length + 1}`,
|
|
20574
|
+
operations: operationsBuilder.buildOperations(),
|
|
20575
|
+
// TODO: add support for multiple operation outputs
|
|
20576
|
+
outputsReducer: (outputs) => {
|
|
20577
|
+
if (outputs.length === 0) {
|
|
20578
|
+
throw new Error("Empty pipeline step found");
|
|
20579
|
+
}
|
|
20580
|
+
if (outputs.length !== 1) {
|
|
20581
|
+
throw new Error("Multiple outputs are not supported yet");
|
|
20582
|
+
}
|
|
20583
|
+
return outputs[0];
|
|
20584
|
+
},
|
|
20585
|
+
};
|
|
20586
|
+
}
|
|
20587
|
+
complete() {
|
|
20588
|
+
return {
|
|
20589
|
+
steps: this.currentSteps,
|
|
20590
|
+
};
|
|
20591
|
+
}
|
|
20592
|
+
get currentSteps() {
|
|
20593
|
+
return [
|
|
20594
|
+
...this.previousSteps,
|
|
20595
|
+
this.currentStep,
|
|
20596
|
+
];
|
|
20597
|
+
}
|
|
20598
|
+
}
|
|
20599
|
+
class PipelineTemplateBuilder {
|
|
20600
|
+
addStep(builder) {
|
|
20601
|
+
return new PipelineStepBuilder([], builder);
|
|
20602
|
+
}
|
|
20603
|
+
}
|
|
20604
|
+
|
|
20605
|
+
let PipelinesBuilder = class PipelinesBuilder {
|
|
20606
|
+
constructor(registry) {
|
|
20607
|
+
this.registry = registry;
|
|
20608
|
+
}
|
|
20609
|
+
createTemplate() {
|
|
20610
|
+
return new PipelineTemplateBuilder();
|
|
20611
|
+
}
|
|
20612
|
+
};
|
|
20613
|
+
PipelinesBuilder = __decorate([
|
|
20614
|
+
Injectable(),
|
|
20615
|
+
__metadata("design:paramtypes", [EntityManagerRegistry])
|
|
20616
|
+
], PipelinesBuilder);
|
|
20617
|
+
|
|
20618
|
+
let PipelinesRunner = class PipelinesRunner {
|
|
20619
|
+
constructor(registry) {
|
|
20620
|
+
this.registry = registry;
|
|
20621
|
+
}
|
|
20622
|
+
async invokePipeline(definition, data) {
|
|
20623
|
+
const instance = await this.controller.createInstance(definition, data.input, data.context);
|
|
20624
|
+
return await instance.execute();
|
|
20625
|
+
}
|
|
20626
|
+
get controller() {
|
|
20627
|
+
return this.registry
|
|
20628
|
+
.getContainer()
|
|
20629
|
+
.getEntitiesServicesLocator()
|
|
20630
|
+
.resolvePipelinesController();
|
|
20631
|
+
}
|
|
20632
|
+
};
|
|
20633
|
+
PipelinesRunner = __decorate([
|
|
20634
|
+
Injectable(),
|
|
20635
|
+
__metadata("design:paramtypes", [EntityManagerRegistry])
|
|
20636
|
+
], PipelinesRunner);
|
|
20637
|
+
|
|
20638
|
+
const PipelineProviders = [PipelinesBuilder, PipelinesRunner];
|
|
20639
|
+
|
|
20640
|
+
// export const iocStorage = new AsyncLocalStorage<IocContext>()
|
|
20641
|
+
const initializeIoCContext = (context) => {
|
|
20642
|
+
};
|
|
20643
|
+
|
|
19946
20644
|
let EntityManagerModule = class EntityManagerModule {
|
|
20645
|
+
constructor(registry) {
|
|
20646
|
+
this.registry = registry;
|
|
20647
|
+
}
|
|
20648
|
+
onModuleInit() {
|
|
20649
|
+
initializeIoCContext({
|
|
20650
|
+
registry: this.registry,
|
|
20651
|
+
});
|
|
20652
|
+
}
|
|
19947
20653
|
};
|
|
19948
20654
|
EntityManagerModule = __decorate([
|
|
19949
20655
|
Module({
|
|
19950
20656
|
imports: [CustomDiscoveryModule, EventEmitterModule],
|
|
19951
|
-
providers: [
|
|
20657
|
+
providers: [
|
|
20658
|
+
...IoC,
|
|
20659
|
+
...Providers,
|
|
20660
|
+
...Processors,
|
|
20661
|
+
...Services$1,
|
|
20662
|
+
...PipelineProviders,
|
|
20663
|
+
],
|
|
19952
20664
|
exports: [EntityManagerRegistry, ...Services$1],
|
|
19953
|
-
})
|
|
20665
|
+
}),
|
|
20666
|
+
__metadata("design:paramtypes", [EntityManagerRegistry])
|
|
19954
20667
|
], EntityManagerModule);
|
|
19955
20668
|
|
|
19956
20669
|
const UserHandlers = [
|
|
20670
|
+
UserCreationHandler,
|
|
19957
20671
|
UserDisableHandler,
|
|
20672
|
+
UserDeleteHandler,
|
|
19958
20673
|
UserEnableHandler,
|
|
19959
20674
|
UserLoginHandler,
|
|
19960
20675
|
UserPasswordChangeHandler,
|
|
@@ -20049,7 +20764,7 @@ class AppSession {
|
|
|
20049
20764
|
|
|
20050
20765
|
let AppSessionMiddleware = class AppSessionMiddleware {
|
|
20051
20766
|
use(req, res, next) {
|
|
20052
|
-
|
|
20767
|
+
sessionStorage.run(new AppSession(req, res), () => {
|
|
20053
20768
|
next();
|
|
20054
20769
|
});
|
|
20055
20770
|
}
|
|
@@ -20058,7 +20773,7 @@ AppSessionMiddleware = __decorate([
|
|
|
20058
20773
|
Injectable()
|
|
20059
20774
|
], AppSessionMiddleware);
|
|
20060
20775
|
function appSessionMiddleware(req, res, next) {
|
|
20061
|
-
|
|
20776
|
+
sessionStorage.run(new AppSession(req, res), () => {
|
|
20062
20777
|
next();
|
|
20063
20778
|
});
|
|
20064
20779
|
}
|
|
@@ -20195,6 +20910,24 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
|
|
|
20195
20910
|
super();
|
|
20196
20911
|
this.services = services;
|
|
20197
20912
|
}
|
|
20913
|
+
async exists(filters, context) {
|
|
20914
|
+
return (await this.count(filters, context)) > 0;
|
|
20915
|
+
}
|
|
20916
|
+
async count(filters, context) {
|
|
20917
|
+
const request = {
|
|
20918
|
+
filters,
|
|
20919
|
+
};
|
|
20920
|
+
return await this.countQueryResults(request, context);
|
|
20921
|
+
}
|
|
20922
|
+
async delete(filters, context) {
|
|
20923
|
+
const request = {
|
|
20924
|
+
filters,
|
|
20925
|
+
};
|
|
20926
|
+
return await this.getRepository().deleteBy({
|
|
20927
|
+
...(context ? this.buildContextFilter(context) : {}),
|
|
20928
|
+
...this.buildWhereClause(request),
|
|
20929
|
+
});
|
|
20930
|
+
}
|
|
20198
20931
|
async search(request, context) {
|
|
20199
20932
|
// todo: execute inside read transaction in order to perform the three queries on the same dataset
|
|
20200
20933
|
const queryResults = await this.countQueryResults(request, context);
|
|
@@ -20312,7 +21045,10 @@ class TypeOrmRepository {
|
|
|
20312
21045
|
});
|
|
20313
21046
|
}
|
|
20314
21047
|
async deleteBy(condition) {
|
|
20315
|
-
await this.innerRepository.delete(condition);
|
|
21048
|
+
const result = await this.innerRepository.delete(condition);
|
|
21049
|
+
return {
|
|
21050
|
+
deletedCount: result.affected,
|
|
21051
|
+
};
|
|
20316
21052
|
}
|
|
20317
21053
|
async create(entity) {
|
|
20318
21054
|
const createResult = await this.innerRepository.insert(entity);
|
|
@@ -20393,6 +21129,14 @@ class NestTypeOrmEntitySeeder extends TypeOrmEntitySeeder {
|
|
|
20393
21129
|
}
|
|
20394
21130
|
}
|
|
20395
21131
|
|
|
21132
|
+
class PipelineInvocationError extends Error {
|
|
21133
|
+
constructor(errorType, innerError, message) {
|
|
21134
|
+
super(message ?? innerError?.message);
|
|
21135
|
+
this.errorType = errorType;
|
|
21136
|
+
this.innerError = innerError;
|
|
21137
|
+
}
|
|
21138
|
+
}
|
|
21139
|
+
|
|
20396
21140
|
class AppExceptionsFilterBase {
|
|
20397
21141
|
catch(exception, host) {
|
|
20398
21142
|
const ctx = host.switchToHttp();
|
|
@@ -20428,6 +21172,16 @@ class AppExceptionsFilterBase {
|
|
|
20428
21172
|
if (exception instanceof HttpException) {
|
|
20429
21173
|
return exception.getStatus();
|
|
20430
21174
|
}
|
|
21175
|
+
if (exception instanceof PipelineInvocationError) {
|
|
21176
|
+
switch (exception.errorType) {
|
|
21177
|
+
case PipelineErrorType.Unauthorized:
|
|
21178
|
+
return HttpStatus.UNAUTHORIZED;
|
|
21179
|
+
case PipelineErrorType.FailedPrecondition:
|
|
21180
|
+
return HttpStatus.PRECONDITION_FAILED;
|
|
21181
|
+
default:
|
|
21182
|
+
return HttpStatus.INTERNAL_SERVER_ERROR;
|
|
21183
|
+
}
|
|
21184
|
+
}
|
|
20431
21185
|
return HttpStatus.INTERNAL_SERVER_ERROR;
|
|
20432
21186
|
}
|
|
20433
21187
|
}
|
|
@@ -25646,5 +26400,5 @@ SendgridEmailModule = SendgridEmailModule_1 = __decorate([
|
|
|
25646
26400
|
})
|
|
25647
26401
|
], SendgridEmailModule);
|
|
25648
26402
|
|
|
25649
|
-
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, BooleanFacet, BooleanFacetItem, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EventsService, InvalidCredentialsError, MemberOf, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PlatformEvents, Public, QueryBuilderBase, ReplicationMode, Roles, SendgridEmailModule, SendgridEmailTemplate, SortDirection, StringFacet, StringFacetItem, TrackingService, UserRegistrationError, WpAppInitializer, WpAwsSesEmailTemplate, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEventsTracker, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, getLocalizedText, newUuid, renderHandlebarsTemplate };
|
|
26403
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, BooleanFacet, BooleanFacetItem, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EventsService, InvalidCredentialsError, MemberOf, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PipelineController, PipelineErrorType, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, ReplicationMode, Roles, SendgridEmailModule, SendgridEmailTemplate, SortDirection, StringFacet, StringFacetItem, TrackingService, UserCreationError, UserRegistrationError, WpAppInitializer, WpAwsSesEmailTemplate, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEventsTracker, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, getLocalizedText, newUuid, renderHandlebarsTemplate };
|
|
25650
26404
|
//# sourceMappingURL=index.js.map
|