rl-core-api 0.1.0
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/README.md +99 -0
- package/dist/app.module.d.ts +2 -0
- package/dist/app.module.js +19 -0
- package/dist/core/auth/authenticatedUser.interface.d.ts +16 -0
- package/dist/core/auth/authenticatedUser.interface.js +2 -0
- package/dist/core/auth/cookie.util.d.ts +9 -0
- package/dist/core/auth/cookie.util.js +28 -0
- package/dist/core/auth/decorators/currentUser.decorator.d.ts +2 -0
- package/dist/core/auth/decorators/currentUser.decorator.js +9 -0
- package/dist/core/auth/decorators/public.decorator.d.ts +3 -0
- package/dist/core/auth/decorators/public.decorator.js +7 -0
- package/dist/core/auth/decorators/requirePermission.decorator.d.ts +5 -0
- package/dist/core/auth/decorators/requirePermission.decorator.js +10 -0
- package/dist/core/auth/guards/appThrottler.guard.d.ts +5 -0
- package/dist/core/auth/guards/appThrottler.guard.js +23 -0
- package/dist/core/auth/guards/csrf.guard.d.ts +8 -0
- package/dist/core/auth/guards/csrf.guard.js +55 -0
- package/dist/core/auth/guards/jwtAuth.guard.d.ts +10 -0
- package/dist/core/auth/guards/jwtAuth.guard.js +37 -0
- package/dist/core/auth/guards/permissions.guard.d.ts +7 -0
- package/dist/core/auth/guards/permissions.guard.js +42 -0
- package/dist/core/bootstrap/bootstrapCore.util.d.ts +9 -0
- package/dist/core/bootstrap/bootstrapCore.util.js +67 -0
- package/dist/core/config/config.module.d.ts +8 -0
- package/dist/core/config/config.module.js +34 -0
- package/dist/core/config/env.schema.d.ts +65 -0
- package/dist/core/config/env.schema.js +94 -0
- package/dist/core/config/env.service.d.ts +7 -0
- package/dist/core/config/env.service.js +27 -0
- package/dist/core/context/auditContext.d.ts +7 -0
- package/dist/core/context/auditContext.js +5 -0
- package/dist/core/core.module.d.ts +11 -0
- package/dist/core/core.module.js +73 -0
- package/dist/core/database/base.schema.d.ts +7 -0
- package/dist/core/database/base.schema.js +49 -0
- package/dist/core/database/createDataSource.util.d.ts +8 -0
- package/dist/core/database/createDataSource.util.js +27 -0
- package/dist/core/database/migrations/1710000000000-InitialSchema.d.ts +6 -0
- package/dist/core/database/migrations/1710000000000-InitialSchema.js +272 -0
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.d.ts +6 -0
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.js +19 -0
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.d.ts +6 -0
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.js +15 -0
- package/dist/core/database/migrations/1786233600000-Notifications.d.ts +6 -0
- package/dist/core/database/migrations/1786233600000-Notifications.js +59 -0
- package/dist/core/database/migrations/index.d.ts +3 -0
- package/dist/core/database/migrations/index.js +13 -0
- package/dist/core/database/seeds/runSeeds.d.ts +1 -0
- package/dist/core/database/seeds/runSeeds.js +20 -0
- package/dist/core/database/seeds/seedAdmin.d.ts +2 -0
- package/dist/core/database/seeds/seedAdmin.js +44 -0
- package/dist/core/database/seeds/seedPermissions.d.ts +2 -0
- package/dist/core/database/seeds/seedPermissions.js +93 -0
- package/dist/core/events/appEvent.enum.d.ts +31 -0
- package/dist/core/events/appEvent.enum.js +12 -0
- package/dist/core/filters/allExceptions.filter.d.ts +5 -0
- package/dist/core/filters/allExceptions.filter.js +61 -0
- package/dist/core/filters/appErrorCode.enum.d.ts +9 -0
- package/dist/core/filters/appErrorCode.enum.js +13 -0
- package/dist/core/health/health.controller.d.ts +11 -0
- package/dist/core/health/health.controller.js +56 -0
- package/dist/core/logger/winston.config.d.ts +2 -0
- package/dist/core/logger/winston.config.js +74 -0
- package/dist/core/mailer/mailer.module.d.ts +2 -0
- package/dist/core/mailer/mailer.module.js +21 -0
- package/dist/core/mailer/mailer.service.d.ts +14 -0
- package/dist/core/mailer/mailer.service.js +148 -0
- package/dist/core/openapi/exportOpenapi.d.ts +1 -0
- package/dist/core/openapi/exportOpenapi.js +25 -0
- package/dist/core/query/applyFilter.util.d.ts +11 -0
- package/dist/core/query/applyFilter.util.js +122 -0
- package/dist/core/query/filter.constants.d.ts +7 -0
- package/dist/core/query/filter.constants.js +64 -0
- package/dist/core/query/filterField.interface.d.ts +35 -0
- package/dist/core/query/filterField.interface.js +2 -0
- package/dist/core/query/filterFieldType.enum.d.ts +10 -0
- package/dist/core/query/filterFieldType.enum.js +14 -0
- package/dist/core/query/filterOperator.enum.d.ts +23 -0
- package/dist/core/query/filterOperator.enum.js +28 -0
- package/dist/core/query/filterSchema.response.d.ts +17 -0
- package/dist/core/query/filterSchema.response.js +82 -0
- package/dist/core/query/filterSort.util.d.ts +7 -0
- package/dist/core/query/filterSort.util.js +11 -0
- package/dist/core/query/paginateWithFilter.util.d.ts +11 -0
- package/dist/core/query/paginateWithFilter.util.js +37 -0
- package/dist/core/query/parseFilter.util.d.ts +2 -0
- package/dist/core/query/parseFilter.util.js +220 -0
- package/dist/core/utils/codedError.util.d.ts +5 -0
- package/dist/core/utils/codedError.util.js +23 -0
- package/dist/core/utils/crypto.util.d.ts +2 -0
- package/dist/core/utils/crypto.util.js +39 -0
- package/dist/core/utils/hash.util.d.ts +6 -0
- package/dist/core/utils/hash.util.js +67 -0
- package/dist/core/utils/ip.util.d.ts +1 -0
- package/dist/core/utils/ip.util.js +15 -0
- package/dist/core/utils/pagination.util.d.ts +21 -0
- package/dist/core/utils/pagination.util.js +98 -0
- package/dist/core/utils/paginationMeta.response.d.ts +7 -0
- package/dist/core/utils/paginationMeta.response.js +32 -0
- package/dist/core/utils/password.constants.d.ts +2 -0
- package/dist/core/utils/password.constants.js +5 -0
- package/dist/core/websocket/baseGateway.d.ts +21 -0
- package/dist/core/websocket/baseGateway.js +63 -0
- package/dist/core/websocket/socket.constants.d.ts +4 -0
- package/dist/core/websocket/socket.constants.js +9 -0
- package/dist/core/websocket/socketEvent.envelope.d.ts +8 -0
- package/dist/core/websocket/socketEvent.envelope.js +11 -0
- package/dist/core/websocket/socketOrigin.util.d.ts +2 -0
- package/dist/core/websocket/socketOrigin.util.js +15 -0
- package/dist/core/websocket/wsAuth.service.d.ts +20 -0
- package/dist/core/websocket/wsAuth.service.js +97 -0
- package/dist/core/websocket/wsUserResolver.interface.d.ts +5 -0
- package/dist/core/websocket/wsUserResolver.interface.js +4 -0
- package/dist/coreEntities.d.ts +12 -0
- package/dist/coreEntities.js +35 -0
- package/dist/dataSource.d.ts +3 -0
- package/dist/dataSource.js +13 -0
- package/dist/features/audit/audit.module.d.ts +2 -0
- package/dist/features/audit/audit.module.js +44 -0
- package/dist/features/audit/domain/audit.service.d.ts +34 -0
- package/dist/features/audit/domain/audit.service.js +93 -0
- package/dist/features/audit/domain/classifyError.util.d.ts +2 -0
- package/dist/features/audit/domain/classifyError.util.js +24 -0
- package/dist/features/audit/domain/index.d.ts +2 -0
- package/dist/features/audit/domain/index.js +18 -0
- package/dist/features/audit/infra/auditData.subscriber.d.ts +17 -0
- package/dist/features/audit/infra/auditData.subscriber.js +139 -0
- package/dist/features/audit/infra/index.d.ts +7 -0
- package/dist/features/audit/infra/index.js +23 -0
- package/dist/features/audit/infra/repositories/auditChange.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/auditChange.repository.js +35 -0
- package/dist/features/audit/infra/repositories/auditDataChange.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/auditDataChange.repository.js +35 -0
- package/dist/features/audit/infra/repositories/errorLog.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/errorLog.repository.js +35 -0
- package/dist/features/audit/infra/schema/auditChange.schema.d.ts +14 -0
- package/dist/features/audit/infra/schema/auditChange.schema.js +68 -0
- package/dist/features/audit/infra/schema/auditDataChange.schema.d.ts +15 -0
- package/dist/features/audit/infra/schema/auditDataChange.schema.js +56 -0
- package/dist/features/audit/infra/schema/errorLog.schema.d.ts +21 -0
- package/dist/features/audit/infra/schema/errorLog.schema.js +69 -0
- package/dist/features/audit/presentation/audit.controller.d.ts +16 -0
- package/dist/features/audit/presentation/audit.controller.js +107 -0
- package/dist/features/audit/presentation/audit.interceptor.d.ts +8 -0
- package/dist/features/audit/presentation/audit.interceptor.js +78 -0
- package/dist/features/audit/presentation/filters/audit.filters.d.ts +4 -0
- package/dist/features/audit/presentation/filters/audit.filters.js +154 -0
- package/dist/features/audit/presentation/index.d.ts +2 -0
- package/dist/features/audit/presentation/index.js +18 -0
- package/dist/features/audit/presentation/responses/auditDataChange.response.d.ts +25 -0
- package/dist/features/audit/presentation/responses/auditDataChange.response.js +96 -0
- package/dist/features/audit/presentation/responses/log.response.d.ts +45 -0
- package/dist/features/audit/presentation/responses/log.response.js +164 -0
- package/dist/features/auth/auth.module.d.ts +2 -0
- package/dist/features/auth/auth.module.js +55 -0
- package/dist/features/auth/domain/auth.service.d.ts +66 -0
- package/dist/features/auth/domain/auth.service.js +289 -0
- package/dist/features/auth/domain/index.d.ts +5 -0
- package/dist/features/auth/domain/index.js +21 -0
- package/dist/features/auth/domain/jwtPayload.interface.d.ts +11 -0
- package/dist/features/auth/domain/jwtPayload.interface.js +2 -0
- package/dist/features/auth/domain/token.service.d.ts +56 -0
- package/dist/features/auth/domain/token.service.js +205 -0
- package/dist/features/auth/domain/twoFactor.service.d.ts +19 -0
- package/dist/features/auth/domain/twoFactor.service.js +103 -0
- package/dist/features/auth/domain/wsUserResolver.service.d.ts +10 -0
- package/dist/features/auth/domain/wsUserResolver.service.js +34 -0
- package/dist/features/auth/infra/index.d.ts +2 -0
- package/dist/features/auth/infra/index.js +18 -0
- package/dist/features/auth/infra/repositories/authToken.repository.d.ts +5 -0
- package/dist/features/auth/infra/repositories/authToken.repository.js +25 -0
- package/dist/features/auth/infra/schema/authToken.schema.d.ts +21 -0
- package/dist/features/auth/infra/schema/authToken.schema.js +73 -0
- package/dist/features/auth/presentation/auth.controller.d.ts +56 -0
- package/dist/features/auth/presentation/auth.controller.js +242 -0
- package/dist/features/auth/presentation/commands/clientType.enum.d.ts +4 -0
- package/dist/features/auth/presentation/commands/clientType.enum.js +8 -0
- package/dist/features/auth/presentation/commands/login.command.d.ts +4 -0
- package/dist/features/auth/presentation/commands/login.command.js +28 -0
- package/dist/features/auth/presentation/commands/password.command.d.ts +7 -0
- package/dist/features/auth/presentation/commands/password.command.js +37 -0
- package/dist/features/auth/presentation/commands/refreshToken.command.d.ts +3 -0
- package/dist/features/auth/presentation/commands/refreshToken.command.js +26 -0
- package/dist/features/auth/presentation/commands/twoFactor.command.d.ts +12 -0
- package/dist/features/auth/presentation/commands/twoFactor.command.js +68 -0
- package/dist/features/auth/presentation/index.d.ts +7 -0
- package/dist/features/auth/presentation/index.js +23 -0
- package/dist/features/auth/presentation/responses/sessionUser.response.d.ts +19 -0
- package/dist/features/auth/presentation/responses/sessionUser.response.js +90 -0
- package/dist/features/auth/presentation/strategies/jwt.strategy.d.ts +18 -0
- package/dist/features/auth/presentation/strategies/jwt.strategy.js +59 -0
- package/dist/features/auth/token.module.d.ts +2 -0
- package/dist/features/auth/token.module.js +23 -0
- package/dist/features/maintenance/domain/cleanup.service.d.ts +22 -0
- package/dist/features/maintenance/domain/cleanup.service.js +142 -0
- package/dist/features/maintenance/maintenance.module.d.ts +2 -0
- package/dist/features/maintenance/maintenance.module.js +24 -0
- package/dist/features/notifications/domain/enums/channelType.enum.d.ts +7 -0
- package/dist/features/notifications/domain/enums/channelType.enum.js +11 -0
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.d.ts +8 -0
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.js +12 -0
- package/dist/features/notifications/domain/enums/notificationType.enum.d.ts +6 -0
- package/dist/features/notifications/domain/enums/notificationType.enum.js +10 -0
- package/dist/features/notifications/domain/enums/scopeType.enum.d.ts +5 -0
- package/dist/features/notifications/domain/enums/scopeType.enum.js +9 -0
- package/dist/features/notifications/domain/notifications.service.d.ts +45 -0
- package/dist/features/notifications/domain/notifications.service.js +101 -0
- package/dist/features/notifications/infra/repositories/notification.repository.d.ts +14 -0
- package/dist/features/notifications/infra/repositories/notification.repository.js +74 -0
- package/dist/features/notifications/infra/repositories/notificationRead.repository.d.ts +6 -0
- package/dist/features/notifications/infra/repositories/notificationRead.repository.js +40 -0
- package/dist/features/notifications/infra/repositories/notificationScope.repository.d.ts +5 -0
- package/dist/features/notifications/infra/repositories/notificationScope.repository.js +25 -0
- package/dist/features/notifications/infra/schema/notification.schema.d.ts +13 -0
- package/dist/features/notifications/infra/schema/notification.schema.js +52 -0
- package/dist/features/notifications/infra/schema/notificationRead.schema.d.ts +7 -0
- package/dist/features/notifications/infra/schema/notificationRead.schema.js +38 -0
- package/dist/features/notifications/infra/schema/notificationScope.schema.d.ts +9 -0
- package/dist/features/notifications/infra/schema/notificationScope.schema.js +43 -0
- package/dist/features/notifications/notifications.module.d.ts +2 -0
- package/dist/features/notifications/notifications.module.js +45 -0
- package/dist/features/notifications/presentation/commands/createNotification.command.d.ts +13 -0
- package/dist/features/notifications/presentation/commands/createNotification.command.js +72 -0
- package/dist/features/notifications/presentation/domainEvents.listener.d.ts +13 -0
- package/dist/features/notifications/presentation/domainEvents.listener.js +121 -0
- package/dist/features/notifications/presentation/notifications.controller.d.ts +16 -0
- package/dist/features/notifications/presentation/notifications.controller.js +108 -0
- package/dist/features/notifications/presentation/notifications.gateway.d.ts +13 -0
- package/dist/features/notifications/presentation/notifications.gateway.js +58 -0
- package/dist/features/notifications/presentation/notifications.publisher.d.ts +9 -0
- package/dist/features/notifications/presentation/notifications.publisher.js +42 -0
- package/dist/features/notifications/presentation/responses/notification.response.d.ts +18 -0
- package/dist/features/notifications/presentation/responses/notification.response.js +72 -0
- package/dist/features/rbac/domain/index.d.ts +2 -0
- package/dist/features/rbac/domain/index.js +18 -0
- package/dist/features/rbac/domain/rbac.catalog.d.ts +21 -0
- package/dist/features/rbac/domain/rbac.catalog.js +153 -0
- package/dist/features/rbac/domain/rbac.service.d.ts +68 -0
- package/dist/features/rbac/domain/rbac.service.js +436 -0
- package/dist/features/rbac/infra/index.d.ts +12 -0
- package/dist/features/rbac/infra/index.js +28 -0
- package/dist/features/rbac/infra/repositories/action.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/action.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/group.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/group.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/permission.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/permission.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/resource.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/resource.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/role.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/role.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/scope.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/scope.repository.js +25 -0
- package/dist/features/rbac/infra/schema/action.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/action.schema.js +36 -0
- package/dist/features/rbac/infra/schema/group.schema.d.ts +12 -0
- package/dist/features/rbac/infra/schema/group.schema.js +60 -0
- package/dist/features/rbac/infra/schema/permission.schema.d.ts +15 -0
- package/dist/features/rbac/infra/schema/permission.schema.js +66 -0
- package/dist/features/rbac/infra/schema/resource.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/resource.schema.js +36 -0
- package/dist/features/rbac/infra/schema/role.schema.d.ts +8 -0
- package/dist/features/rbac/infra/schema/role.schema.js +46 -0
- package/dist/features/rbac/infra/schema/scope.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/scope.schema.js +36 -0
- package/dist/features/rbac/presentation/commands/createAction.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createAction.command.js +32 -0
- package/dist/features/rbac/presentation/commands/createGroup.command.d.ts +7 -0
- package/dist/features/rbac/presentation/commands/createGroup.command.js +54 -0
- package/dist/features/rbac/presentation/commands/createPermission.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createPermission.command.js +35 -0
- package/dist/features/rbac/presentation/commands/createResource.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createResource.command.js +32 -0
- package/dist/features/rbac/presentation/commands/createRole.command.d.ts +5 -0
- package/dist/features/rbac/presentation/commands/createRole.command.js +38 -0
- package/dist/features/rbac/presentation/commands/createScope.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createScope.command.js +32 -0
- package/dist/features/rbac/presentation/commands/updateAction.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateAction.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateGroup.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateGroup.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updatePermission.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updatePermission.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateResource.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateResource.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateRole.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateRole.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateScope.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateScope.command.js +24 -0
- package/dist/features/rbac/presentation/index.d.ts +13 -0
- package/dist/features/rbac/presentation/index.js +29 -0
- package/dist/features/rbac/presentation/rbac.controller.d.ts +54 -0
- package/dist/features/rbac/presentation/rbac.controller.js +413 -0
- package/dist/features/rbac/presentation/responses/rbac.response.d.ts +47 -0
- package/dist/features/rbac/presentation/responses/rbac.response.js +161 -0
- package/dist/features/rbac/rbac.module.d.ts +2 -0
- package/dist/features/rbac/rbac.module.js +55 -0
- package/dist/features/users/domain/avatar.service.d.ts +4 -0
- package/dist/features/users/domain/avatar.service.js +61 -0
- package/dist/features/users/domain/index.d.ts +2 -0
- package/dist/features/users/domain/index.js +18 -0
- package/dist/features/users/domain/users.service.d.ts +46 -0
- package/dist/features/users/domain/users.service.js +291 -0
- package/dist/features/users/infra/index.d.ts +4 -0
- package/dist/features/users/infra/index.js +20 -0
- package/dist/features/users/infra/repositories/passwordHistory.repository.d.ts +5 -0
- package/dist/features/users/infra/repositories/passwordHistory.repository.js +25 -0
- package/dist/features/users/infra/repositories/user.repository.d.ts +8 -0
- package/dist/features/users/infra/repositories/user.repository.js +56 -0
- package/dist/features/users/infra/schema/passwordHistory.schema.d.ts +5 -0
- package/dist/features/users/infra/schema/passwordHistory.schema.js +29 -0
- package/dist/features/users/infra/schema/user.schema.d.ts +28 -0
- package/dist/features/users/infra/schema/user.schema.js +153 -0
- package/dist/features/users/presentation/commands/changePassword.command.d.ts +4 -0
- package/dist/features/users/presentation/commands/changePassword.command.js +29 -0
- package/dist/features/users/presentation/commands/createUser.command.d.ts +8 -0
- package/dist/features/users/presentation/commands/createUser.command.js +56 -0
- package/dist/features/users/presentation/commands/updateProfile.command.d.ts +5 -0
- package/dist/features/users/presentation/commands/updateProfile.command.js +38 -0
- package/dist/features/users/presentation/commands/updateUser.command.d.ts +5 -0
- package/dist/features/users/presentation/commands/updateUser.command.js +8 -0
- package/dist/features/users/presentation/filters/users.filters.d.ts +3 -0
- package/dist/features/users/presentation/filters/users.filters.js +62 -0
- package/dist/features/users/presentation/index.d.ts +5 -0
- package/dist/features/users/presentation/index.js +21 -0
- package/dist/features/users/presentation/responses/user.response.d.ts +25 -0
- package/dist/features/users/presentation/responses/user.response.js +95 -0
- package/dist/features/users/presentation/users.controller.d.ts +30 -0
- package/dist/features/users/presentation/users.controller.js +247 -0
- package/dist/features/users/users.module.d.ts +2 -0
- package/dist/features/users/users.module.js +42 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +149 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +5 -0
- package/dist/rlCore.module.d.ts +10 -0
- package/dist/rlCore.module.js +42 -0
- package/package.json +139 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RbacService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const action_repository_1 = require("../infra/repositories/action.repository");
|
|
16
|
+
const group_repository_1 = require("../infra/repositories/group.repository");
|
|
17
|
+
const permission_repository_1 = require("../infra/repositories/permission.repository");
|
|
18
|
+
const resource_repository_1 = require("../infra/repositories/resource.repository");
|
|
19
|
+
const role_repository_1 = require("../infra/repositories/role.repository");
|
|
20
|
+
const scope_repository_1 = require("../infra/repositories/scope.repository");
|
|
21
|
+
const user_repository_1 = require("../../users/infra/repositories/user.repository");
|
|
22
|
+
let RbacService = class RbacService {
|
|
23
|
+
constructor(resourceRepo, actionRepo, scopeRepo, permissionRepo, roleRepo, groupRepo, userRepo) {
|
|
24
|
+
this.resourceRepo = resourceRepo;
|
|
25
|
+
this.actionRepo = actionRepo;
|
|
26
|
+
this.scopeRepo = scopeRepo;
|
|
27
|
+
this.permissionRepo = permissionRepo;
|
|
28
|
+
this.roleRepo = roleRepo;
|
|
29
|
+
this.groupRepo = groupRepo;
|
|
30
|
+
this.userRepo = userRepo;
|
|
31
|
+
}
|
|
32
|
+
async getUserPermissionCodes(userId) {
|
|
33
|
+
const user = await this.userRepo.findOne({
|
|
34
|
+
where: { id: userId },
|
|
35
|
+
relations: {
|
|
36
|
+
directPermissions: true,
|
|
37
|
+
roles: { permissions: true },
|
|
38
|
+
groups: { roles: { permissions: true } },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
if (!user) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const codes = new Set();
|
|
45
|
+
user.directPermissions?.forEach((p) => codes.add(p.code));
|
|
46
|
+
user.roles?.forEach((r) => r.permissions?.forEach((p) => codes.add(p.code)));
|
|
47
|
+
user.groups?.forEach((g) => g.roles?.forEach((r) => r.permissions?.forEach((p) => codes.add(p.code))));
|
|
48
|
+
return [...codes];
|
|
49
|
+
}
|
|
50
|
+
async getUserRoleNames(userId) {
|
|
51
|
+
const user = await this.userRepo.findOne({
|
|
52
|
+
where: { id: userId },
|
|
53
|
+
relations: { roles: true },
|
|
54
|
+
});
|
|
55
|
+
return user?.roles?.map((r) => r.name) ?? [];
|
|
56
|
+
}
|
|
57
|
+
listResources() {
|
|
58
|
+
return this.resourceRepo.find({ order: { name: "ASC" } });
|
|
59
|
+
}
|
|
60
|
+
async createResource(dto) {
|
|
61
|
+
const exists = await this.resourceRepo.findOne({
|
|
62
|
+
where: { name: dto.name },
|
|
63
|
+
withDeleted: true,
|
|
64
|
+
});
|
|
65
|
+
if (exists) {
|
|
66
|
+
throw new common_1.ConflictException("Já existe um resource com esse nome");
|
|
67
|
+
}
|
|
68
|
+
return this.resourceRepo.save(this.resourceRepo.create(dto));
|
|
69
|
+
}
|
|
70
|
+
async updateResource(id, dto) {
|
|
71
|
+
const resource = await this.resourceRepo.findOneBy({ id });
|
|
72
|
+
if (!resource) {
|
|
73
|
+
throw new common_1.NotFoundException("Resource não encontrado");
|
|
74
|
+
}
|
|
75
|
+
if (dto.name && dto.name !== resource.name) {
|
|
76
|
+
const taken = await this.resourceRepo.findOne({
|
|
77
|
+
where: { name: dto.name },
|
|
78
|
+
withDeleted: true,
|
|
79
|
+
});
|
|
80
|
+
if (taken) {
|
|
81
|
+
throw new common_1.ConflictException("Já existe um resource com esse nome");
|
|
82
|
+
}
|
|
83
|
+
resource.name = dto.name;
|
|
84
|
+
}
|
|
85
|
+
if (dto.description !== undefined) {
|
|
86
|
+
resource.description = dto.description;
|
|
87
|
+
}
|
|
88
|
+
if (dto.isActive !== undefined) {
|
|
89
|
+
resource.isActive = dto.isActive;
|
|
90
|
+
}
|
|
91
|
+
return this.resourceRepo.save(resource);
|
|
92
|
+
}
|
|
93
|
+
async deleteResource(id) {
|
|
94
|
+
const resource = await this.resourceRepo.findOneBy({ id });
|
|
95
|
+
if (!resource) {
|
|
96
|
+
throw new common_1.NotFoundException("Resource não encontrado");
|
|
97
|
+
}
|
|
98
|
+
await this.resourceRepo.softRemove(resource);
|
|
99
|
+
}
|
|
100
|
+
listActions() {
|
|
101
|
+
return this.actionRepo.find({ order: { name: "ASC" } });
|
|
102
|
+
}
|
|
103
|
+
async createAction(dto) {
|
|
104
|
+
const exists = await this.actionRepo.findOne({
|
|
105
|
+
where: { name: dto.name },
|
|
106
|
+
withDeleted: true,
|
|
107
|
+
});
|
|
108
|
+
if (exists) {
|
|
109
|
+
throw new common_1.ConflictException("Já existe uma action com esse nome");
|
|
110
|
+
}
|
|
111
|
+
return this.actionRepo.save(this.actionRepo.create(dto));
|
|
112
|
+
}
|
|
113
|
+
async updateAction(id, dto) {
|
|
114
|
+
const action = await this.actionRepo.findOneBy({ id });
|
|
115
|
+
if (!action) {
|
|
116
|
+
throw new common_1.NotFoundException("Action não encontrada");
|
|
117
|
+
}
|
|
118
|
+
if (dto.name && dto.name !== action.name) {
|
|
119
|
+
const taken = await this.actionRepo.findOne({
|
|
120
|
+
where: { name: dto.name },
|
|
121
|
+
withDeleted: true,
|
|
122
|
+
});
|
|
123
|
+
if (taken) {
|
|
124
|
+
throw new common_1.ConflictException("Já existe uma action com esse nome");
|
|
125
|
+
}
|
|
126
|
+
action.name = dto.name;
|
|
127
|
+
}
|
|
128
|
+
if (dto.description !== undefined) {
|
|
129
|
+
action.description = dto.description;
|
|
130
|
+
}
|
|
131
|
+
if (dto.isActive !== undefined) {
|
|
132
|
+
action.isActive = dto.isActive;
|
|
133
|
+
}
|
|
134
|
+
return this.actionRepo.save(action);
|
|
135
|
+
}
|
|
136
|
+
async deleteAction(id) {
|
|
137
|
+
const action = await this.actionRepo.findOneBy({ id });
|
|
138
|
+
if (!action) {
|
|
139
|
+
throw new common_1.NotFoundException("Action não encontrada");
|
|
140
|
+
}
|
|
141
|
+
await this.actionRepo.softRemove(action);
|
|
142
|
+
}
|
|
143
|
+
listScopes() {
|
|
144
|
+
return this.scopeRepo.find({ order: { name: "ASC" } });
|
|
145
|
+
}
|
|
146
|
+
async createScope(dto) {
|
|
147
|
+
const exists = await this.scopeRepo.findOne({
|
|
148
|
+
where: { name: dto.name },
|
|
149
|
+
withDeleted: true,
|
|
150
|
+
});
|
|
151
|
+
if (exists) {
|
|
152
|
+
throw new common_1.ConflictException("Já existe um scope com esse nome");
|
|
153
|
+
}
|
|
154
|
+
return this.scopeRepo.save(this.scopeRepo.create(dto));
|
|
155
|
+
}
|
|
156
|
+
async updateScope(id, dto) {
|
|
157
|
+
const scope = await this.scopeRepo.findOneBy({ id });
|
|
158
|
+
if (!scope) {
|
|
159
|
+
throw new common_1.NotFoundException("Scope não encontrado");
|
|
160
|
+
}
|
|
161
|
+
if (dto.name && dto.name !== scope.name) {
|
|
162
|
+
const taken = await this.scopeRepo.findOne({
|
|
163
|
+
where: { name: dto.name },
|
|
164
|
+
withDeleted: true,
|
|
165
|
+
});
|
|
166
|
+
if (taken) {
|
|
167
|
+
throw new common_1.ConflictException("Já existe um scope com esse nome");
|
|
168
|
+
}
|
|
169
|
+
scope.name = dto.name;
|
|
170
|
+
}
|
|
171
|
+
if (dto.description !== undefined) {
|
|
172
|
+
scope.description = dto.description;
|
|
173
|
+
}
|
|
174
|
+
if (dto.isActive !== undefined) {
|
|
175
|
+
scope.isActive = dto.isActive;
|
|
176
|
+
}
|
|
177
|
+
return this.scopeRepo.save(scope);
|
|
178
|
+
}
|
|
179
|
+
async deleteScope(id) {
|
|
180
|
+
const scope = await this.scopeRepo.findOneBy({ id });
|
|
181
|
+
if (!scope) {
|
|
182
|
+
throw new common_1.NotFoundException("Scope não encontrado");
|
|
183
|
+
}
|
|
184
|
+
await this.scopeRepo.softRemove(scope);
|
|
185
|
+
}
|
|
186
|
+
listPermissions() {
|
|
187
|
+
return this.permissionRepo.find({ order: { code: "ASC" } });
|
|
188
|
+
}
|
|
189
|
+
async createPermission(dto) {
|
|
190
|
+
const exists = await this.permissionRepo.findOne({
|
|
191
|
+
where: { code: dto.code },
|
|
192
|
+
withDeleted: true,
|
|
193
|
+
});
|
|
194
|
+
if (exists) {
|
|
195
|
+
throw new common_1.ConflictException("Já existe uma permissão com esse código");
|
|
196
|
+
}
|
|
197
|
+
const [resourceName, actionName, scopeName] = dto.code.split(":");
|
|
198
|
+
const [resource, action, scope] = await Promise.all([
|
|
199
|
+
this.resourceRepo.findOneBy({ name: resourceName }),
|
|
200
|
+
this.actionRepo.findOneBy({ name: actionName }),
|
|
201
|
+
this.scopeRepo.findOneBy({ name: scopeName }),
|
|
202
|
+
]);
|
|
203
|
+
if (!resource || !action || !scope) {
|
|
204
|
+
throw new common_1.NotFoundException("resource, action ou scope do código não existe (cadastre-os antes)");
|
|
205
|
+
}
|
|
206
|
+
const permission = this.permissionRepo.create({
|
|
207
|
+
code: dto.code,
|
|
208
|
+
description: dto.description,
|
|
209
|
+
resourceId: resource.id,
|
|
210
|
+
actionId: action.id,
|
|
211
|
+
scopeId: scope.id,
|
|
212
|
+
});
|
|
213
|
+
return this.permissionRepo.save(permission);
|
|
214
|
+
}
|
|
215
|
+
async updatePermission(id, dto) {
|
|
216
|
+
const permission = await this.permissionRepo.findOneBy({ id });
|
|
217
|
+
if (!permission) {
|
|
218
|
+
throw new common_1.NotFoundException("Permissão não encontrada");
|
|
219
|
+
}
|
|
220
|
+
if (dto.code && dto.code !== permission.code) {
|
|
221
|
+
const taken = await this.permissionRepo.findOne({
|
|
222
|
+
where: { code: dto.code },
|
|
223
|
+
withDeleted: true,
|
|
224
|
+
});
|
|
225
|
+
if (taken) {
|
|
226
|
+
throw new common_1.ConflictException("Já existe uma permissão com esse código");
|
|
227
|
+
}
|
|
228
|
+
const [resourceName, actionName, scopeName] = dto.code.split(":");
|
|
229
|
+
const [resource, action, scope] = await Promise.all([
|
|
230
|
+
this.resourceRepo.findOneBy({ name: resourceName }),
|
|
231
|
+
this.actionRepo.findOneBy({ name: actionName }),
|
|
232
|
+
this.scopeRepo.findOneBy({ name: scopeName }),
|
|
233
|
+
]);
|
|
234
|
+
if (!resource || !action || !scope) {
|
|
235
|
+
throw new common_1.NotFoundException("resource, action ou scope do código não existe");
|
|
236
|
+
}
|
|
237
|
+
permission.code = dto.code;
|
|
238
|
+
permission.resourceId = resource.id;
|
|
239
|
+
permission.actionId = action.id;
|
|
240
|
+
permission.scopeId = scope.id;
|
|
241
|
+
}
|
|
242
|
+
if (dto.description !== undefined) {
|
|
243
|
+
permission.description = dto.description;
|
|
244
|
+
}
|
|
245
|
+
if (dto.isActive !== undefined) {
|
|
246
|
+
permission.isActive = dto.isActive;
|
|
247
|
+
}
|
|
248
|
+
return this.permissionRepo.save(permission);
|
|
249
|
+
}
|
|
250
|
+
async deletePermission(id) {
|
|
251
|
+
const permission = await this.permissionRepo.findOneBy({ id });
|
|
252
|
+
if (!permission) {
|
|
253
|
+
throw new common_1.NotFoundException("Permissão não encontrada");
|
|
254
|
+
}
|
|
255
|
+
await this.permissionRepo.softRemove(permission);
|
|
256
|
+
}
|
|
257
|
+
listRoles() {
|
|
258
|
+
return this.roleRepo.find({
|
|
259
|
+
relations: { permissions: true },
|
|
260
|
+
order: { name: "ASC" },
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async getRole(id) {
|
|
264
|
+
const role = await this.roleRepo.findOne({
|
|
265
|
+
where: { id },
|
|
266
|
+
relations: { permissions: true },
|
|
267
|
+
});
|
|
268
|
+
if (!role) {
|
|
269
|
+
throw new common_1.NotFoundException("Papel não encontrado");
|
|
270
|
+
}
|
|
271
|
+
return role;
|
|
272
|
+
}
|
|
273
|
+
async createRole(dto) {
|
|
274
|
+
const exists = await this.roleRepo.findOne({
|
|
275
|
+
where: { name: dto.name },
|
|
276
|
+
withDeleted: true,
|
|
277
|
+
});
|
|
278
|
+
if (exists) {
|
|
279
|
+
throw new common_1.ConflictException("Já existe um papel com esse nome");
|
|
280
|
+
}
|
|
281
|
+
const permissions = dto.permissionIds?.length
|
|
282
|
+
? await this.permissionRepo.findBy({ id: (0, typeorm_1.In)(dto.permissionIds) })
|
|
283
|
+
: [];
|
|
284
|
+
const role = this.roleRepo.create({
|
|
285
|
+
name: dto.name,
|
|
286
|
+
description: dto.description,
|
|
287
|
+
permissions,
|
|
288
|
+
});
|
|
289
|
+
return this.roleRepo.save(role);
|
|
290
|
+
}
|
|
291
|
+
async updateRole(id, dto, actorPermissions) {
|
|
292
|
+
const role = await this.getRole(id);
|
|
293
|
+
if (dto.name !== undefined) {
|
|
294
|
+
role.name = dto.name;
|
|
295
|
+
}
|
|
296
|
+
if (dto.description !== undefined) {
|
|
297
|
+
role.description = dto.description;
|
|
298
|
+
}
|
|
299
|
+
if (dto.isActive !== undefined) {
|
|
300
|
+
role.isActive = dto.isActive;
|
|
301
|
+
}
|
|
302
|
+
if (dto.permissionIds) {
|
|
303
|
+
const permissions = await this.permissionRepo.findBy({
|
|
304
|
+
id: (0, typeorm_1.In)(dto.permissionIds),
|
|
305
|
+
});
|
|
306
|
+
this.assertGrantableByActor(permissions, actorPermissions);
|
|
307
|
+
role.permissions = permissions;
|
|
308
|
+
}
|
|
309
|
+
return this.roleRepo.save(role);
|
|
310
|
+
}
|
|
311
|
+
assertGrantableByActor(permissions, actorPermissions) {
|
|
312
|
+
const granted = new Set(actorPermissions ?? []);
|
|
313
|
+
const ungrantable = permissions.filter((p) => !granted.has(p.code));
|
|
314
|
+
if (ungrantable.length) {
|
|
315
|
+
throw new common_1.ForbiddenException(`Você não pode conceder permissões que não possui: ${ungrantable
|
|
316
|
+
.map((p) => p.code)
|
|
317
|
+
.join(", ")}`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async deleteRole(id) {
|
|
321
|
+
const role = await this.getRole(id);
|
|
322
|
+
await this.roleRepo.softRemove(role);
|
|
323
|
+
}
|
|
324
|
+
async addPermissionToRole(roleId, permissionId, actorPermissions) {
|
|
325
|
+
const role = await this.getRole(roleId);
|
|
326
|
+
const permission = await this.permissionRepo.findOneBy({
|
|
327
|
+
id: permissionId,
|
|
328
|
+
});
|
|
329
|
+
if (!permission) {
|
|
330
|
+
throw new common_1.NotFoundException("Permissão não encontrada");
|
|
331
|
+
}
|
|
332
|
+
this.assertGrantableByActor([permission], actorPermissions);
|
|
333
|
+
if (!role.permissions.some((p) => p.id === permissionId)) {
|
|
334
|
+
role.permissions = [...role.permissions, permission];
|
|
335
|
+
await this.roleRepo.save(role);
|
|
336
|
+
}
|
|
337
|
+
return this.getRole(roleId);
|
|
338
|
+
}
|
|
339
|
+
async removePermissionFromRole(roleId, permissionId) {
|
|
340
|
+
const role = await this.getRole(roleId);
|
|
341
|
+
role.permissions = role.permissions.filter((p) => p.id !== permissionId);
|
|
342
|
+
await this.roleRepo.save(role);
|
|
343
|
+
return this.getRole(roleId);
|
|
344
|
+
}
|
|
345
|
+
listGroups() {
|
|
346
|
+
return this.groupRepo.find({
|
|
347
|
+
relations: { roles: true },
|
|
348
|
+
order: { name: "ASC" },
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
async getGroup(id) {
|
|
352
|
+
const group = await this.groupRepo.findOne({
|
|
353
|
+
where: { id },
|
|
354
|
+
relations: { roles: true },
|
|
355
|
+
});
|
|
356
|
+
if (!group) {
|
|
357
|
+
throw new common_1.NotFoundException("Grupo não encontrado");
|
|
358
|
+
}
|
|
359
|
+
return group;
|
|
360
|
+
}
|
|
361
|
+
async createGroup(dto) {
|
|
362
|
+
const roles = dto.roleIds?.length
|
|
363
|
+
? await this.roleRepo.findBy({ id: (0, typeorm_1.In)(dto.roleIds) })
|
|
364
|
+
: [];
|
|
365
|
+
const group = this.groupRepo.create({
|
|
366
|
+
name: dto.name,
|
|
367
|
+
description: dto.description,
|
|
368
|
+
type: dto.type ?? "team",
|
|
369
|
+
parentId: dto.parentId ?? null,
|
|
370
|
+
roles,
|
|
371
|
+
});
|
|
372
|
+
return this.groupRepo.save(group);
|
|
373
|
+
}
|
|
374
|
+
async updateGroup(id, dto) {
|
|
375
|
+
const group = await this.getGroup(id);
|
|
376
|
+
if (dto.name !== undefined) {
|
|
377
|
+
group.name = dto.name;
|
|
378
|
+
}
|
|
379
|
+
if (dto.description !== undefined) {
|
|
380
|
+
group.description = dto.description;
|
|
381
|
+
}
|
|
382
|
+
if (dto.type !== undefined) {
|
|
383
|
+
group.type = dto.type;
|
|
384
|
+
}
|
|
385
|
+
if (dto.parentId !== undefined) {
|
|
386
|
+
group.parentId = dto.parentId;
|
|
387
|
+
}
|
|
388
|
+
if (dto.isActive !== undefined) {
|
|
389
|
+
group.isActive = dto.isActive;
|
|
390
|
+
}
|
|
391
|
+
if (dto.roleIds) {
|
|
392
|
+
group.roles = await this.roleRepo.findBy({ id: (0, typeorm_1.In)(dto.roleIds) });
|
|
393
|
+
}
|
|
394
|
+
return this.groupRepo.save(group);
|
|
395
|
+
}
|
|
396
|
+
async deleteGroup(id) {
|
|
397
|
+
const group = await this.getGroup(id);
|
|
398
|
+
await this.groupRepo.softRemove(group);
|
|
399
|
+
}
|
|
400
|
+
async addUserToGroup(groupId, userId) {
|
|
401
|
+
const group = await this.getGroup(groupId);
|
|
402
|
+
const user = await this.userRepo.findOne({
|
|
403
|
+
where: { id: userId },
|
|
404
|
+
relations: { groups: true },
|
|
405
|
+
});
|
|
406
|
+
if (!user) {
|
|
407
|
+
throw new common_1.NotFoundException("Usuário não encontrado");
|
|
408
|
+
}
|
|
409
|
+
if (!user.groups?.some((g) => g.id === group.id)) {
|
|
410
|
+
user.groups = [...(user.groups ?? []), group];
|
|
411
|
+
await this.userRepo.save(user);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
async removeUserFromGroup(groupId, userId) {
|
|
415
|
+
const user = await this.userRepo.findOne({
|
|
416
|
+
where: { id: userId },
|
|
417
|
+
relations: { groups: true },
|
|
418
|
+
});
|
|
419
|
+
if (!user) {
|
|
420
|
+
throw new common_1.NotFoundException("Usuário não encontrado");
|
|
421
|
+
}
|
|
422
|
+
user.groups = (user.groups ?? []).filter((g) => g.id !== groupId);
|
|
423
|
+
await this.userRepo.save(user);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
exports.RbacService = RbacService;
|
|
427
|
+
exports.RbacService = RbacService = __decorate([
|
|
428
|
+
(0, common_1.Injectable)(),
|
|
429
|
+
__metadata("design:paramtypes", [resource_repository_1.ResourceRepository,
|
|
430
|
+
action_repository_1.ActionRepository,
|
|
431
|
+
scope_repository_1.ScopeRepository,
|
|
432
|
+
permission_repository_1.PermissionRepository,
|
|
433
|
+
role_repository_1.RoleRepository,
|
|
434
|
+
group_repository_1.GroupRepository,
|
|
435
|
+
user_repository_1.UserRepository])
|
|
436
|
+
], RbacService);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./repositories/action.repository";
|
|
2
|
+
export * from "./repositories/group.repository";
|
|
3
|
+
export * from "./repositories/permission.repository";
|
|
4
|
+
export * from "./repositories/resource.repository";
|
|
5
|
+
export * from "./repositories/role.repository";
|
|
6
|
+
export * from "./repositories/scope.repository";
|
|
7
|
+
export * from "./schema/action.schema";
|
|
8
|
+
export * from "./schema/group.schema";
|
|
9
|
+
export * from "./schema/permission.schema";
|
|
10
|
+
export * from "./schema/resource.schema";
|
|
11
|
+
export * from "./schema/role.schema";
|
|
12
|
+
export * from "./schema/scope.schema";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./repositories/action.repository"), exports);
|
|
18
|
+
__exportStar(require("./repositories/group.repository"), exports);
|
|
19
|
+
__exportStar(require("./repositories/permission.repository"), exports);
|
|
20
|
+
__exportStar(require("./repositories/resource.repository"), exports);
|
|
21
|
+
__exportStar(require("./repositories/role.repository"), exports);
|
|
22
|
+
__exportStar(require("./repositories/scope.repository"), exports);
|
|
23
|
+
__exportStar(require("./schema/action.schema"), exports);
|
|
24
|
+
__exportStar(require("./schema/group.schema"), exports);
|
|
25
|
+
__exportStar(require("./schema/permission.schema"), exports);
|
|
26
|
+
__exportStar(require("./schema/resource.schema"), exports);
|
|
27
|
+
__exportStar(require("./schema/role.schema"), exports);
|
|
28
|
+
__exportStar(require("./schema/scope.schema"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ActionRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const action_schema_1 = require("../schema/action.schema");
|
|
16
|
+
let ActionRepository = class ActionRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(action_schema_1.Action, dataSource.createEntityManager());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.ActionRepository = ActionRepository;
|
|
22
|
+
exports.ActionRepository = ActionRepository = __decorate([
|
|
23
|
+
(0, common_1.Injectable)(),
|
|
24
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
25
|
+
], ActionRepository);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GroupRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const group_schema_1 = require("../schema/group.schema");
|
|
16
|
+
let GroupRepository = class GroupRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(group_schema_1.Group, dataSource.createEntityManager());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.GroupRepository = GroupRepository;
|
|
22
|
+
exports.GroupRepository = GroupRepository = __decorate([
|
|
23
|
+
(0, common_1.Injectable)(),
|
|
24
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
25
|
+
], GroupRepository);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PermissionRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const permission_schema_1 = require("../schema/permission.schema");
|
|
16
|
+
let PermissionRepository = class PermissionRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(permission_schema_1.Permission, dataSource.createEntityManager());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.PermissionRepository = PermissionRepository;
|
|
22
|
+
exports.PermissionRepository = PermissionRepository = __decorate([
|
|
23
|
+
(0, common_1.Injectable)(),
|
|
24
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
25
|
+
], PermissionRepository);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ResourceRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const resource_schema_1 = require("../schema/resource.schema");
|
|
16
|
+
let ResourceRepository = class ResourceRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(resource_schema_1.Resource, dataSource.createEntityManager());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.ResourceRepository = ResourceRepository;
|
|
22
|
+
exports.ResourceRepository = ResourceRepository = __decorate([
|
|
23
|
+
(0, common_1.Injectable)(),
|
|
24
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
25
|
+
], ResourceRepository);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RoleRepository = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const role_schema_1 = require("../schema/role.schema");
|
|
16
|
+
let RoleRepository = class RoleRepository extends typeorm_1.Repository {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super(role_schema_1.Role, dataSource.createEntityManager());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.RoleRepository = RoleRepository;
|
|
22
|
+
exports.RoleRepository = RoleRepository = __decorate([
|
|
23
|
+
(0, common_1.Injectable)(),
|
|
24
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
25
|
+
], RoleRepository);
|