@webiny/api-audit-logs 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.eb81deee7e
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/AuditLogsFeature.d.ts +8 -0
- package/AuditLogsFeature.js +32 -0
- package/AuditLogsFeature.js.map +1 -0
- package/abstractions.d.ts +14 -4
- package/abstractions.js +3 -3
- package/abstractions.js.map +1 -1
- package/config.js +2 -1
- package/config.js.map +1 -1
- package/domain/errors.d.ts +5 -0
- package/domain/errors.js +11 -0
- package/domain/errors.js.map +1 -0
- package/events/AuditLogAfterCreateEvent.js +8 -5
- package/events/AuditLogAfterCreateEvent.js.map +1 -1
- package/events/AuditLogAfterUpdateEvent.js +8 -5
- package/events/AuditLogAfterUpdateEvent.js.map +1 -1
- package/events/AuditLogBeforeCreateEvent.js +8 -5
- package/events/AuditLogBeforeCreateEvent.js.map +1 -1
- package/events/AuditLogBeforeUpdateEvent.js +8 -5
- package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
- package/events/abstractions.d.ts +0 -5
- package/events/abstractions.js +5 -24
- package/events/abstractions.js.map +1 -1
- package/events/index.js +0 -2
- package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
- package/features/AuditLogPermissions/abstractions.d.ts +11 -0
- package/features/AuditLogPermissions/abstractions.js +5 -0
- package/features/AuditLogPermissions/abstractions.js.map +1 -0
- package/features/AuditLogPermissions/feature.d.ts +4 -0
- package/features/AuditLogPermissions/feature.js +11 -0
- package/features/AuditLogPermissions/feature.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
- package/features/CreateAuditLog/abstractions.d.ts +42 -0
- package/features/CreateAuditLog/abstractions.js +7 -0
- package/features/CreateAuditLog/abstractions.js.map +1 -0
- package/features/CreateAuditLog/feature.d.ts +4 -0
- package/features/CreateAuditLog/feature.js +15 -0
- package/features/CreateAuditLog/feature.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
- package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
- package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
- package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
- package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
- package/features/GetAuditLog/GetAuditLogUseCase.js +29 -0
- package/features/GetAuditLog/GetAuditLogUseCase.js.map +1 -0
- package/features/GetAuditLog/abstractions.d.ts +42 -0
- package/features/GetAuditLog/abstractions.js +7 -0
- package/features/GetAuditLog/abstractions.js.map +1 -0
- package/features/GetAuditLog/feature.d.ts +4 -0
- package/features/GetAuditLog/feature.js +15 -0
- package/features/GetAuditLog/feature.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.d.ts +12 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.js +24 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.d.ts +17 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.js +38 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.d.ts +15 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.js +27 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.js.map +1 -0
- package/features/ListAuditLogs/abstractions.d.ts +55 -0
- package/features/ListAuditLogs/abstractions.js +7 -0
- package/features/ListAuditLogs/abstractions.js.map +1 -0
- package/features/ListAuditLogs/feature.d.ts +4 -0
- package/features/ListAuditLogs/feature.js +15 -0
- package/features/ListAuditLogs/feature.js.map +1 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.d.ts +30 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.js +108 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.js.map +1 -0
- package/features/RecordAuditLog/abstractions.d.ts +26 -0
- package/features/RecordAuditLog/abstractions.js +5 -0
- package/features/RecordAuditLog/abstractions.js.map +1 -0
- package/features/RecordAuditLog/feature.d.ts +4 -0
- package/features/RecordAuditLog/feature.js +11 -0
- package/features/RecordAuditLog/feature.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.d.ts +12 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.js +23 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.d.ts +14 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.js +25 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.d.ts +18 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.js +53 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.js.map +1 -0
- package/features/UpdateAuditLog/abstractions.d.ts +42 -0
- package/features/UpdateAuditLog/abstractions.js +7 -0
- package/features/UpdateAuditLog/abstractions.js.map +1 -0
- package/features/UpdateAuditLog/feature.d.ts +4 -0
- package/features/UpdateAuditLog/feature.js +15 -0
- package/features/UpdateAuditLog/feature.js.map +1 -0
- package/graphql/AuditLogsGraphQLSchema.d.ts +10 -0
- package/graphql/AuditLogsGraphQLSchema.js +139 -0
- package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
- package/graphql/validation.js +26 -30
- package/graphql/validation.js.map +1 -1
- package/index.d.ts +2 -8
- package/index.js +1 -22
- package/package.json +28 -28
- package/storage/abstractions/Storage.js +0 -3
- package/storage/types.d.ts +0 -35
- package/storage/types.js +0 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +37 -27
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +45 -30
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +43 -34
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
- package/subscriptions/aco/index.d.ts +2 -2
- package/subscriptions/aco/index.js +5 -4
- package/subscriptions/aco/index.js.map +1 -1
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +45 -0
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +42 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +44 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
- package/subscriptions/ai/index.d.ts +2 -0
- package/subscriptions/ai/index.js +11 -0
- package/subscriptions/ai/index.js.map +1 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +27 -22
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +27 -22
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +30 -26
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +30 -26
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +6 -8
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +37 -31
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +30 -29
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +30 -26
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +30 -26
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/index.d.ts +2 -2
- package/subscriptions/headlessCms/index.js +16 -20
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +10 -7
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +3 -3
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +29 -24
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +3 -3
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +37 -39
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +37 -39
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +41 -44
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +30 -26
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +30 -26
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +27 -22
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +30 -26
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
- package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +14 -20
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/index.d.ts +2 -2
- package/subscriptions/websiteBuilder/index.js +14 -16
- package/subscriptions/websiteBuilder/index.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +29 -25
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +26 -21
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +29 -25
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +26 -21
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +26 -21
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +26 -21
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +29 -25
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
- package/types.d.ts +0 -23
- package/types.js +0 -3
- package/utils/expiresAt.js +14 -19
- package/utils/expiresAt.js.map +1 -1
- package/utils/getAuditObject.js +14 -15
- package/utils/getAuditObject.js.map +1 -1
- package/context/AuditLogsContextValue.d.ts +0 -10
- package/context/AuditLogsContextValue.js +0 -139
- package/context/AuditLogsContextValue.js.map +0 -1
- package/context/index.d.ts +0 -9
- package/context/index.js +0 -37
- package/context/index.js.map +0 -1
- package/events/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -3
- package/graphql/schema.js +0 -126
- package/graphql/schema.js.map +0 -1
- package/index.js.map +0 -1
- package/storage/AccessPatternHandler.d.ts +0 -14
- package/storage/AccessPatternHandler.js +0 -60
- package/storage/AccessPatternHandler.js.map +0 -1
- package/storage/Converter.d.ts +0 -16
- package/storage/Converter.js +0 -52
- package/storage/Converter.js.map +0 -1
- package/storage/Storage.d.ts +0 -18
- package/storage/Storage.js +0 -89
- package/storage/Storage.js.map +0 -1
- package/storage/abstractions/AccessPattern.d.ts +0 -24
- package/storage/abstractions/AccessPattern.js +0 -3
- package/storage/abstractions/AccessPattern.js.map +0 -1
- package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
- package/storage/abstractions/AccessPatternHandler.js +0 -3
- package/storage/abstractions/AccessPatternHandler.js.map +0 -1
- package/storage/abstractions/Converter.d.ts +0 -6
- package/storage/abstractions/Converter.js +0 -3
- package/storage/abstractions/Converter.js.map +0 -1
- package/storage/abstractions/Storage.js.map +0 -1
- package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppAccessPattern.js +0 -29
- package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityAccessPattern.js +0 -29
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -29
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
- package/storage/accessPatterns/BaseAccessPattern.js +0 -83
- package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -30
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
- package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
- package/storage/accessPatterns/DefaultAccessPattern.js +0 -36
- package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
- package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/EntityIdAccessPattern.js +0 -33
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
- package/storage/accessPatterns/index.d.ts +0 -6
- package/storage/accessPatterns/index.js +0 -47
- package/storage/accessPatterns/index.js.map +0 -1
- package/storage/cursorSchema.d.ts +0 -4
- package/storage/cursorSchema.js +0 -25
- package/storage/cursorSchema.js.map +0 -1
- package/storage/entity.d.ts +0 -36
- package/storage/entity.js +0 -127
- package/storage/entity.js.map +0 -1
- package/storage/results/ListErrorResult.d.ts +0 -10
- package/storage/results/ListErrorResult.js +0 -11
- package/storage/results/ListErrorResult.js.map +0 -1
- package/storage/results/ListSuccessResult.d.ts +0 -14
- package/storage/results/ListSuccessResult.js +0 -16
- package/storage/results/ListSuccessResult.js.map +0 -1
- package/storage/results/index.d.ts +0 -2
- package/storage/results/index.js +0 -4
- package/storage/results/index.js.map +0 -1
- package/storage/startKey.d.ts +0 -6
- package/storage/startKey.js +0 -9
- package/storage/startKey.js.map +0 -1
- package/storage/types.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/getAuditConfig.d.ts +0 -4
- package/utils/getAuditConfig.js +0 -105
- package/utils/getAuditConfig.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { mdbid } from "@webiny/utils/mdbid.js";
|
|
2
|
+
import { Result } from "@webiny/feature/api";
|
|
3
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
4
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
5
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
6
|
+
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
7
|
+
import { AuditLogsConfig } from "../../abstractions.js";
|
|
8
|
+
import { AuditLogPermissions } from "../AuditLogPermissions/abstractions.js";
|
|
9
|
+
import { AuditLogAfterCreateEvent, AuditLogBeforeCreateEvent } from "../../events/index.js";
|
|
10
|
+
import { convertExpiresAtDaysToDate } from "../../utils/expiresAt.js";
|
|
11
|
+
import { CreateAuditLogRepository, CreateAuditLogUseCase } from "./abstractions.js";
|
|
12
|
+
class CreateAuditLogUseCaseImpl {
|
|
13
|
+
constructor(repository, permissions, eventPublisher, identityContext, tenantContext, config){
|
|
14
|
+
this.repository = repository;
|
|
15
|
+
this.permissions = permissions;
|
|
16
|
+
this.eventPublisher = eventPublisher;
|
|
17
|
+
this.identityContext = identityContext;
|
|
18
|
+
this.tenantContext = tenantContext;
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
async execute(payload) {
|
|
22
|
+
const identity = this.identityContext.getIdentity();
|
|
23
|
+
const expiresAt = convertExpiresAtDaysToDate(this.config.deleteLogsAfterDays);
|
|
24
|
+
const auditLog = {
|
|
25
|
+
id: mdbid(),
|
|
26
|
+
tenant: this.tenantContext.getTenant().id,
|
|
27
|
+
createdBy: {
|
|
28
|
+
id: identity.id,
|
|
29
|
+
type: identity.type,
|
|
30
|
+
displayName: identity.displayName || "unknown"
|
|
31
|
+
},
|
|
32
|
+
createdOn: new Date(),
|
|
33
|
+
...payload,
|
|
34
|
+
content: JSON.stringify(payload.content),
|
|
35
|
+
expiresAt
|
|
36
|
+
};
|
|
37
|
+
const canAccess = await this.permissions.canAccess(auditLog.action);
|
|
38
|
+
if (!canAccess) return Result.fail(new NotAuthorizedError({
|
|
39
|
+
message: "You cannot access audit logs."
|
|
40
|
+
}));
|
|
41
|
+
const beforeCreateEvent = new AuditLogBeforeCreateEvent({
|
|
42
|
+
auditLog,
|
|
43
|
+
setAuditLog (input) {
|
|
44
|
+
Object.assign(auditLog, input);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
await this.eventPublisher.publish(beforeCreateEvent);
|
|
48
|
+
const result = await this.repository.create(auditLog);
|
|
49
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
50
|
+
const afterCreateEvent = new AuditLogAfterCreateEvent({
|
|
51
|
+
auditLog
|
|
52
|
+
});
|
|
53
|
+
await this.eventPublisher.publish(afterCreateEvent);
|
|
54
|
+
return Result.ok(result.value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const CreateAuditLogUseCase_CreateAuditLogUseCase = CreateAuditLogUseCase.createImplementation({
|
|
58
|
+
implementation: CreateAuditLogUseCaseImpl,
|
|
59
|
+
dependencies: [
|
|
60
|
+
CreateAuditLogRepository,
|
|
61
|
+
AuditLogPermissions,
|
|
62
|
+
EventPublisher,
|
|
63
|
+
IdentityContext,
|
|
64
|
+
TenantContext,
|
|
65
|
+
AuditLogsConfig
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
export { CreateAuditLogUseCase_CreateAuditLogUseCase as CreateAuditLogUseCase };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=CreateAuditLogUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/CreateAuditLog/CreateAuditLogUseCase.js","sources":["../../../src/features/CreateAuditLog/CreateAuditLogUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils/mdbid.js\";\nimport { Result } from \"@webiny/feature/api\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { AuditLogsConfig } from \"~/abstractions.js\";\nimport { AuditLogPermissions } from \"~/features/AuditLogPermissions/abstractions.js\";\nimport { AuditLogBeforeCreateEvent } from \"~/events/index.js\";\nimport { AuditLogAfterCreateEvent } from \"~/events/index.js\";\nimport { convertExpiresAtDaysToDate } from \"~/utils/expiresAt.js\";\nimport type { AuditLogPayload } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { CreateAuditLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { CreateAuditLogRepository } from \"./abstractions.js\";\n\nclass CreateAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly repository: CreateAuditLogRepository.Interface,\n private readonly permissions: AuditLogPermissions.Interface,\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly identityContext: IdentityContext.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly config: AuditLogsConfig.Interface\n ) {}\n\n public async execute(\n payload: AuditLogPayload\n ): Promise<Result<IAuditLog, UseCaseAbstraction.Error>> {\n const identity = this.identityContext.getIdentity();\n const expiresAt = convertExpiresAtDaysToDate(this.config.deleteLogsAfterDays);\n\n const auditLog: IAuditLog = {\n id: mdbid(),\n tenant: this.tenantContext.getTenant().id,\n createdBy: {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName || \"unknown\"\n },\n createdOn: new Date(),\n ...payload,\n content: JSON.stringify(payload.content),\n expiresAt\n };\n\n const canAccess = await this.permissions.canAccess(auditLog.action);\n if (!canAccess) {\n return Result.fail(\n new NotAuthorizedError({ message: \"You cannot access audit logs.\" })\n );\n }\n\n const beforeCreateEvent = new AuditLogBeforeCreateEvent({\n auditLog,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeCreateEvent);\n\n const result = await this.repository.create(auditLog);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const afterCreateEvent = new AuditLogAfterCreateEvent({ auditLog });\n await this.eventPublisher.publish(afterCreateEvent);\n\n return Result.ok(result.value);\n }\n}\n\nexport const CreateAuditLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: CreateAuditLogUseCaseImpl,\n dependencies: [\n CreateAuditLogRepository,\n AuditLogPermissions,\n EventPublisher,\n IdentityContext,\n TenantContext,\n AuditLogsConfig\n ]\n});\n"],"names":["CreateAuditLogUseCaseImpl","repository","permissions","eventPublisher","identityContext","tenantContext","config","payload","identity","expiresAt","convertExpiresAtDaysToDate","auditLog","mdbid","Date","JSON","canAccess","Result","NotAuthorizedError","beforeCreateEvent","AuditLogBeforeCreateEvent","input","Object","result","afterCreateEvent","AuditLogAfterCreateEvent","CreateAuditLogUseCase","UseCaseAbstraction","CreateAuditLogRepository","AuditLogPermissions","EventPublisher","IdentityContext","TenantContext","AuditLogsConfig"],"mappings":";;;;;;;;;;;AAgBA,MAAMA;IACF,YACqBC,UAA8C,EAC9CC,WAA0C,EAC1CC,cAAwC,EACxCC,eAA0C,EAC1CC,aAAsC,EACtCC,MAAiC,CACpD;aANmBL,UAAU,GAAVA;aACAC,WAAW,GAAXA;aACAC,cAAc,GAAdA;aACAC,eAAe,GAAfA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAa,QACTC,OAAwB,EAC4B;QACpD,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,MAAMC,YAAYC,2BAA2B,IAAI,CAAC,MAAM,CAAC,mBAAmB;QAE5E,MAAMC,WAAsB;YACxB,IAAIC;YACJ,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE;YACzC,WAAW;gBACP,IAAIJ,SAAS,EAAE;gBACf,MAAMA,SAAS,IAAI;gBACnB,aAAaA,SAAS,WAAW,IAAI;YACzC;YACA,WAAW,IAAIK;YACf,GAAGN,OAAO;YACV,SAASO,KAAK,SAAS,CAACP,QAAQ,OAAO;YACvCE;QACJ;QAEA,MAAMM,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAACJ,SAAS,MAAM;QAClE,IAAI,CAACI,WACD,OAAOC,OAAO,IAAI,CACd,IAAIC,mBAAmB;YAAE,SAAS;QAAgC;QAI1E,MAAMC,oBAAoB,IAAIC,0BAA0B;YACpDR;YACA,aAAYS,KAAK;gBACbC,OAAO,MAAM,CAACV,UAAUS;YAC5B;QACJ;QACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACF;QAElC,MAAMI,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACX;QAC5C,IAAIW,OAAO,MAAM,IACb,OAAON,OAAO,IAAI,CAACM,OAAO,KAAK;QAGnC,MAAMC,mBAAmB,IAAIC,yBAAyB;YAAEb;QAAS;QACjE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACY;QAElC,OAAOP,OAAO,EAAE,CAACM,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMG,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgB1B;IAChB,cAAc;QACV2B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
3
|
+
import type { AuditLogPayload } from "../../types.js";
|
|
4
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
5
|
+
import type { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
6
|
+
/**
|
|
7
|
+
* CreateAuditLog Use Case - Creates an audit log in the current tenant, as the current identity.
|
|
8
|
+
*/
|
|
9
|
+
export interface ICreateAuditLogUseCase {
|
|
10
|
+
execute(payload: AuditLogPayload): Promise<Result<IAuditLog, UseCaseError>>;
|
|
11
|
+
}
|
|
12
|
+
export interface ICreateAuditLogUseCaseErrors {
|
|
13
|
+
notAuthorized: NotAuthorizedError;
|
|
14
|
+
persistence: AuditLogPersistenceError;
|
|
15
|
+
}
|
|
16
|
+
type UseCaseError = ICreateAuditLogUseCaseErrors[keyof ICreateAuditLogUseCaseErrors];
|
|
17
|
+
export declare const CreateAuditLogUseCase: import("@webiny/di").Abstraction<ICreateAuditLogUseCase>;
|
|
18
|
+
export declare namespace CreateAuditLogUseCase {
|
|
19
|
+
type Interface = ICreateAuditLogUseCase;
|
|
20
|
+
type Error = UseCaseError;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* CreateAuditLogRepository - Stores a new audit log.
|
|
24
|
+
*/
|
|
25
|
+
export interface ICreateAuditLogRepository {
|
|
26
|
+
create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
|
|
27
|
+
}
|
|
28
|
+
export declare const CreateAuditLogRepository: import("@webiny/di").Abstraction<ICreateAuditLogRepository>;
|
|
29
|
+
export declare namespace CreateAuditLogRepository {
|
|
30
|
+
type Interface = ICreateAuditLogRepository;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CreateAuditLogGateway - Writes a new audit log to the audit logs storage.
|
|
34
|
+
*/
|
|
35
|
+
export interface ICreateAuditLogGateway {
|
|
36
|
+
create(auditLog: IAuditLog): Promise<IAuditLog>;
|
|
37
|
+
}
|
|
38
|
+
export declare const CreateAuditLogGateway: import("@webiny/di").Abstraction<ICreateAuditLogGateway>;
|
|
39
|
+
export declare namespace CreateAuditLogGateway {
|
|
40
|
+
type Interface = ICreateAuditLogGateway;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const CreateAuditLogUseCase = createAbstraction("CreateAuditLogUseCase");
|
|
3
|
+
const CreateAuditLogRepository = createAbstraction("CreateAuditLogRepository");
|
|
4
|
+
const CreateAuditLogGateway = createAbstraction("CreateAuditLogGateway");
|
|
5
|
+
export { CreateAuditLogGateway, CreateAuditLogRepository, CreateAuditLogUseCase };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/CreateAuditLog/abstractions.js","sources":["../../../src/features/CreateAuditLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport type { AuditLogPayload } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { AuditLogPersistenceError } from \"~/domain/errors.js\";\n\n/**\n * CreateAuditLog Use Case - Creates an audit log in the current tenant, as the current identity.\n */\nexport interface ICreateAuditLogUseCase {\n execute(payload: AuditLogPayload): Promise<Result<IAuditLog, UseCaseError>>;\n}\n\nexport interface ICreateAuditLogUseCaseErrors {\n notAuthorized: NotAuthorizedError;\n persistence: AuditLogPersistenceError;\n}\n\ntype UseCaseError = ICreateAuditLogUseCaseErrors[keyof ICreateAuditLogUseCaseErrors];\n\nexport const CreateAuditLogUseCase =\n createAbstraction<ICreateAuditLogUseCase>(\"CreateAuditLogUseCase\");\n\nexport namespace CreateAuditLogUseCase {\n export type Interface = ICreateAuditLogUseCase;\n export type Error = UseCaseError;\n}\n\n/**\n * CreateAuditLogRepository - Stores a new audit log.\n */\nexport interface ICreateAuditLogRepository {\n create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;\n}\n\nexport const CreateAuditLogRepository = createAbstraction<ICreateAuditLogRepository>(\n \"CreateAuditLogRepository\"\n);\n\nexport namespace CreateAuditLogRepository {\n export type Interface = ICreateAuditLogRepository;\n}\n\n/**\n * CreateAuditLogGateway - Writes a new audit log to the audit logs storage.\n */\nexport interface ICreateAuditLogGateway {\n create(auditLog: IAuditLog): Promise<IAuditLog>;\n}\n\nexport const CreateAuditLogGateway =\n createAbstraction<ICreateAuditLogGateway>(\"CreateAuditLogGateway\");\n\nexport namespace CreateAuditLogGateway {\n export type Interface = ICreateAuditLogGateway;\n}\n"],"names":["CreateAuditLogUseCase","createAbstraction","CreateAuditLogRepository","CreateAuditLogGateway"],"mappings":";AAqBO,MAAMA,wBACTC,kBAA0C;AAcvC,MAAMC,2BAA2BD,kBACpC;AAcG,MAAME,wBACTF,kBAA0C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { CreateAuditLogUseCase } from "./CreateAuditLogUseCase.js";
|
|
3
|
+
import { CreateAuditLogRepository } from "./CreateAuditLogRepository.js";
|
|
4
|
+
import { CreateAuditLogGateway } from "./CreateAuditLogGateway.js";
|
|
5
|
+
const CreateAuditLogFeature = createFeature({
|
|
6
|
+
name: "AuditLogs/CreateAuditLog",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(CreateAuditLogUseCase);
|
|
9
|
+
container.register(CreateAuditLogRepository).inSingletonScope();
|
|
10
|
+
container.register(CreateAuditLogGateway).inSingletonScope();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { CreateAuditLogFeature };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/CreateAuditLog/feature.js","sources":["../../../src/features/CreateAuditLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateAuditLogUseCase } from \"./CreateAuditLogUseCase.js\";\nimport { CreateAuditLogRepository } from \"./CreateAuditLogRepository.js\";\nimport { CreateAuditLogGateway } from \"./CreateAuditLogGateway.js\";\n\nexport const CreateAuditLogFeature = createFeature({\n name: \"AuditLogs/CreateAuditLog\",\n register(container) {\n container.register(CreateAuditLogUseCase);\n container.register(CreateAuditLogRepository).inSingletonScope();\n container.register(CreateAuditLogGateway).inSingletonScope();\n }\n});\n"],"names":["CreateAuditLogFeature","createFeature","container","CreateAuditLogUseCase","CreateAuditLogRepository","CreateAuditLogGateway"],"mappings":";;;;AAKO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,0BAA0B,gBAAgB;QAC7DF,UAAU,QAAQ,CAACG,uBAAuB,gBAAgB;IAC9D;AACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
3
|
+
import type { IStorageFetchParams } from "../../storage/abstractions/Storage.js";
|
|
4
|
+
import { GetAuditLogGateway as Abstraction } from "./abstractions.js";
|
|
5
|
+
declare class GetAuditLogGatewayImpl implements Abstraction.Interface {
|
|
6
|
+
private readonly storage;
|
|
7
|
+
constructor(storage: AuditLogsStorage.Interface);
|
|
8
|
+
get(params: IStorageFetchParams): Promise<IAuditLog>;
|
|
9
|
+
}
|
|
10
|
+
export declare const GetAuditLogGateway: typeof GetAuditLogGatewayImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogGateway>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import { GetAuditLogGateway } from "./abstractions.js";
|
|
3
|
+
class GetAuditLogGatewayImpl {
|
|
4
|
+
constructor(storage){
|
|
5
|
+
this.storage = storage;
|
|
6
|
+
}
|
|
7
|
+
async get(params) {
|
|
8
|
+
const result = await this.storage.fetch(params);
|
|
9
|
+
if (!result.success) throw result.error;
|
|
10
|
+
return result.data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const GetAuditLogGateway_GetAuditLogGateway = GetAuditLogGateway.createImplementation({
|
|
14
|
+
implementation: GetAuditLogGatewayImpl,
|
|
15
|
+
dependencies: [
|
|
16
|
+
AuditLogsStorage
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
export { GetAuditLogGateway_GetAuditLogGateway as GetAuditLogGateway };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=GetAuditLogGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetAuditLog/GetAuditLogGateway.js","sources":["../../../src/features/GetAuditLog/GetAuditLogGateway.ts"],"sourcesContent":["import { AuditLogsStorage } from \"~/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageFetchParams } from \"~/storage/abstractions/Storage.js\";\nimport { GetAuditLogGateway as Abstraction } from \"./abstractions.js\";\n\nclass GetAuditLogGatewayImpl implements Abstraction.Interface {\n public constructor(private readonly storage: AuditLogsStorage.Interface) {}\n\n public async get(params: IStorageFetchParams): Promise<IAuditLog> {\n const result = await this.storage.fetch(params);\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n }\n}\n\nexport const GetAuditLogGateway = Abstraction.createImplementation({\n implementation: GetAuditLogGatewayImpl,\n dependencies: [AuditLogsStorage]\n});\n"],"names":["GetAuditLogGatewayImpl","storage","params","result","GetAuditLogGateway","Abstraction","AuditLogsStorage"],"mappings":";;AAKA,MAAMA;IACF,YAAoCC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1E,MAAa,IAAIC,MAA2B,EAAsB;QAC9D,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAACD;QACxC,IAAI,CAACC,OAAO,OAAO,EACf,MAAMA,OAAO,KAAK;QAEtB,OAAOA,OAAO,IAAI;IACtB;AACJ;AAEO,MAAMC,wCAAqBC,mBAAAA,oBAAgC,CAAC;IAC/D,gBAAgBL;IAChB,cAAc;QAACM;KAAiB;AACpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
4
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
5
|
+
import { GetAuditLogRepository as Abstraction } from "./abstractions.js";
|
|
6
|
+
import { GetAuditLogGateway } from "./abstractions.js";
|
|
7
|
+
declare class GetAuditLogRepositoryImpl implements Abstraction.Interface {
|
|
8
|
+
private readonly gateway;
|
|
9
|
+
private readonly tenantContext;
|
|
10
|
+
constructor(gateway: GetAuditLogGateway.Interface, tenantContext: TenantContext.Interface);
|
|
11
|
+
get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const GetAuditLogRepository: typeof GetAuditLogRepositoryImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogRepository>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
4
|
+
import { GetAuditLogGateway, GetAuditLogRepository } from "./abstractions.js";
|
|
5
|
+
class GetAuditLogRepositoryImpl {
|
|
6
|
+
constructor(gateway, tenantContext){
|
|
7
|
+
this.gateway = gateway;
|
|
8
|
+
this.tenantContext = tenantContext;
|
|
9
|
+
}
|
|
10
|
+
async get(id) {
|
|
11
|
+
try {
|
|
12
|
+
const tenant = this.tenantContext.getTenant().id;
|
|
13
|
+
const auditLog = await this.gateway.get({
|
|
14
|
+
id,
|
|
15
|
+
tenant
|
|
16
|
+
});
|
|
17
|
+
return Result.ok(auditLog);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
return Result.fail(new AuditLogPersistenceError(error));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const GetAuditLogRepository_GetAuditLogRepository = GetAuditLogRepository.createImplementation({
|
|
24
|
+
implementation: GetAuditLogRepositoryImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
GetAuditLogGateway,
|
|
27
|
+
TenantContext
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
export { GetAuditLogRepository_GetAuditLogRepository as GetAuditLogRepository };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=GetAuditLogRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetAuditLog/GetAuditLogRepository.js","sources":["../../../src/features/GetAuditLog/GetAuditLogRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { AuditLogPersistenceError } from \"~/domain/errors.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { GetAuditLogRepository as Abstraction } from \"./abstractions.js\";\nimport { GetAuditLogGateway } from \"./abstractions.js\";\n\nclass GetAuditLogRepositoryImpl implements Abstraction.Interface {\n public constructor(\n private readonly gateway: GetAuditLogGateway.Interface,\n private readonly tenantContext: TenantContext.Interface\n ) {}\n\n public async get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>> {\n try {\n const tenant = this.tenantContext.getTenant().id;\n const auditLog = await this.gateway.get({ id, tenant });\n return Result.ok(auditLog);\n } catch (error) {\n return Result.fail(new AuditLogPersistenceError(error as Error));\n }\n }\n}\n\nexport const GetAuditLogRepository = Abstraction.createImplementation({\n implementation: GetAuditLogRepositoryImpl,\n dependencies: [GetAuditLogGateway, TenantContext]\n});\n"],"names":["GetAuditLogRepositoryImpl","gateway","tenantContext","id","tenant","auditLog","Result","error","AuditLogPersistenceError","GetAuditLogRepository","Abstraction","GetAuditLogGateway","TenantContext"],"mappings":";;;;AAOA,MAAMA;IACF,YACqBC,OAAqC,EACrCC,aAAsC,CACzD;aAFmBD,OAAO,GAAPA;aACAC,aAAa,GAAbA;IAClB;IAEH,MAAa,IAAIC,EAAU,EAAwD;QAC/E,IAAI;YACA,MAAMC,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE;YAChD,MAAMC,WAAW,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;gBAAEF;gBAAIC;YAAO;YACrD,OAAOE,OAAO,EAAE,CAACD;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAOD,OAAO,IAAI,CAAC,IAAIE,yBAAyBD;QACpD;IACJ;AACJ;AAEO,MAAME,8CAAwBC,sBAAAA,oBAAgC,CAAC;IAClE,gBAAgBV;IAChB,cAAc;QAACW;QAAoBC;KAAc;AACrD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { AuditLogPermissions } from "../../features/AuditLogPermissions/abstractions.js";
|
|
3
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
4
|
+
import { GetAuditLogUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
5
|
+
import { GetAuditLogRepository } from "./abstractions.js";
|
|
6
|
+
declare class GetAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
7
|
+
private readonly repository;
|
|
8
|
+
private readonly permissions;
|
|
9
|
+
constructor(repository: GetAuditLogRepository.Interface, permissions: AuditLogPermissions.Interface);
|
|
10
|
+
execute(id: string): Promise<Result<IAuditLog, UseCaseAbstraction.Error>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const GetAuditLogUseCase: typeof GetAuditLogUseCaseImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogUseCase>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
3
|
+
import { AuditLogPermissions } from "../AuditLogPermissions/abstractions.js";
|
|
4
|
+
import { GetAuditLogRepository, GetAuditLogUseCase } from "./abstractions.js";
|
|
5
|
+
class GetAuditLogUseCaseImpl {
|
|
6
|
+
constructor(repository, permissions){
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
this.permissions = permissions;
|
|
9
|
+
}
|
|
10
|
+
async execute(id) {
|
|
11
|
+
const result = await this.repository.get(id);
|
|
12
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
13
|
+
const canAccess = await this.permissions.canAccess(result.value.action);
|
|
14
|
+
if (!canAccess) return Result.fail(new NotAuthorizedError({
|
|
15
|
+
message: "You cannot access audit logs."
|
|
16
|
+
}));
|
|
17
|
+
return Result.ok(result.value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const GetAuditLogUseCase_GetAuditLogUseCase = GetAuditLogUseCase.createImplementation({
|
|
21
|
+
implementation: GetAuditLogUseCaseImpl,
|
|
22
|
+
dependencies: [
|
|
23
|
+
GetAuditLogRepository,
|
|
24
|
+
AuditLogPermissions
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
export { GetAuditLogUseCase_GetAuditLogUseCase as GetAuditLogUseCase };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=GetAuditLogUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetAuditLog/GetAuditLogUseCase.js","sources":["../../../src/features/GetAuditLog/GetAuditLogUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { AuditLogPermissions } from \"~/features/AuditLogPermissions/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { GetAuditLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { GetAuditLogRepository } from \"./abstractions.js\";\n\nclass GetAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly repository: GetAuditLogRepository.Interface,\n private readonly permissions: AuditLogPermissions.Interface\n ) {}\n\n public async execute(id: string): Promise<Result<IAuditLog, UseCaseAbstraction.Error>> {\n const result = await this.repository.get(id);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const canAccess = await this.permissions.canAccess(result.value.action);\n if (!canAccess) {\n return Result.fail(\n new NotAuthorizedError({ message: \"You cannot access audit logs.\" })\n );\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const GetAuditLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetAuditLogUseCaseImpl,\n dependencies: [GetAuditLogRepository, AuditLogPermissions]\n});\n"],"names":["GetAuditLogUseCaseImpl","repository","permissions","id","result","Result","canAccess","NotAuthorizedError","GetAuditLogUseCase","UseCaseAbstraction","GetAuditLogRepository","AuditLogPermissions"],"mappings":";;;;AAOA,MAAMA;IACF,YACqBC,UAA2C,EAC3CC,WAA0C,CAC7D;aAFmBD,UAAU,GAAVA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,QAAQC,EAAU,EAAwD;QACnF,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAACD;QACzC,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAGnC,MAAME,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAACF,OAAO,KAAK,CAAC,MAAM;QACtE,IAAI,CAACE,WACD,OAAOD,OAAO,IAAI,CACd,IAAIE,mBAAmB;YAAE,SAAS;QAAgC;QAI1E,OAAOF,OAAO,EAAE,CAACD,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMI,wCAAqBC,mBAAAA,oBAAuC,CAAC;IACtE,gBAAgBT;IAChB,cAAc;QAACU;QAAuBC;KAAoB;AAC9D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
3
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
4
|
+
import type { IStorageFetchParams } from "../../storage/abstractions/Storage.js";
|
|
5
|
+
import type { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
6
|
+
/**
|
|
7
|
+
* GetAuditLog Use Case - Gets an audit log of the current tenant by its id.
|
|
8
|
+
*/
|
|
9
|
+
export interface IGetAuditLogUseCase {
|
|
10
|
+
execute(id: string): Promise<Result<IAuditLog, UseCaseError>>;
|
|
11
|
+
}
|
|
12
|
+
export interface IGetAuditLogUseCaseErrors {
|
|
13
|
+
notAuthorized: NotAuthorizedError;
|
|
14
|
+
persistence: AuditLogPersistenceError;
|
|
15
|
+
}
|
|
16
|
+
type UseCaseError = IGetAuditLogUseCaseErrors[keyof IGetAuditLogUseCaseErrors];
|
|
17
|
+
export declare const GetAuditLogUseCase: import("@webiny/di").Abstraction<IGetAuditLogUseCase>;
|
|
18
|
+
export declare namespace GetAuditLogUseCase {
|
|
19
|
+
type Interface = IGetAuditLogUseCase;
|
|
20
|
+
type Error = UseCaseError;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* GetAuditLogRepository - Fetches an audit log of the current tenant.
|
|
24
|
+
*/
|
|
25
|
+
export interface IGetAuditLogRepository {
|
|
26
|
+
get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
|
|
27
|
+
}
|
|
28
|
+
export declare const GetAuditLogRepository: import("@webiny/di").Abstraction<IGetAuditLogRepository>;
|
|
29
|
+
export declare namespace GetAuditLogRepository {
|
|
30
|
+
type Interface = IGetAuditLogRepository;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* GetAuditLogGateway - Reads an audit log from the audit logs storage.
|
|
34
|
+
*/
|
|
35
|
+
export interface IGetAuditLogGateway {
|
|
36
|
+
get(params: IStorageFetchParams): Promise<IAuditLog>;
|
|
37
|
+
}
|
|
38
|
+
export declare const GetAuditLogGateway: import("@webiny/di").Abstraction<IGetAuditLogGateway>;
|
|
39
|
+
export declare namespace GetAuditLogGateway {
|
|
40
|
+
type Interface = IGetAuditLogGateway;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const GetAuditLogUseCase = createAbstraction("GetAuditLogUseCase");
|
|
3
|
+
const GetAuditLogRepository = createAbstraction("GetAuditLogRepository");
|
|
4
|
+
const GetAuditLogGateway = createAbstraction("GetAuditLogGateway");
|
|
5
|
+
export { GetAuditLogGateway, GetAuditLogRepository, GetAuditLogUseCase };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetAuditLog/abstractions.js","sources":["../../../src/features/GetAuditLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageFetchParams } from \"~/storage/abstractions/Storage.js\";\nimport type { AuditLogPersistenceError } from \"~/domain/errors.js\";\n\n/**\n * GetAuditLog Use Case - Gets an audit log of the current tenant by its id.\n */\nexport interface IGetAuditLogUseCase {\n execute(id: string): Promise<Result<IAuditLog, UseCaseError>>;\n}\n\nexport interface IGetAuditLogUseCaseErrors {\n notAuthorized: NotAuthorizedError;\n persistence: AuditLogPersistenceError;\n}\n\ntype UseCaseError = IGetAuditLogUseCaseErrors[keyof IGetAuditLogUseCaseErrors];\n\nexport const GetAuditLogUseCase = createAbstraction<IGetAuditLogUseCase>(\"GetAuditLogUseCase\");\n\nexport namespace GetAuditLogUseCase {\n export type Interface = IGetAuditLogUseCase;\n export type Error = UseCaseError;\n}\n\n/**\n * GetAuditLogRepository - Fetches an audit log of the current tenant.\n */\nexport interface IGetAuditLogRepository {\n get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>>;\n}\n\nexport const GetAuditLogRepository =\n createAbstraction<IGetAuditLogRepository>(\"GetAuditLogRepository\");\n\nexport namespace GetAuditLogRepository {\n export type Interface = IGetAuditLogRepository;\n}\n\n/**\n * GetAuditLogGateway - Reads an audit log from the audit logs storage.\n */\nexport interface IGetAuditLogGateway {\n get(params: IStorageFetchParams): Promise<IAuditLog>;\n}\n\nexport const GetAuditLogGateway = createAbstraction<IGetAuditLogGateway>(\"GetAuditLogGateway\");\n\nexport namespace GetAuditLogGateway {\n export type Interface = IGetAuditLogGateway;\n}\n"],"names":["GetAuditLogUseCase","createAbstraction","GetAuditLogRepository","GetAuditLogGateway"],"mappings":";AAqBO,MAAMA,qBAAqBC,kBAAuC;AAclE,MAAMC,wBACTD,kBAA0C;AAavC,MAAME,qBAAqBF,kBAAuC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetAuditLogUseCase } from "./GetAuditLogUseCase.js";
|
|
3
|
+
import { GetAuditLogRepository } from "./GetAuditLogRepository.js";
|
|
4
|
+
import { GetAuditLogGateway } from "./GetAuditLogGateway.js";
|
|
5
|
+
const GetAuditLogFeature = createFeature({
|
|
6
|
+
name: "AuditLogs/GetAuditLog",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(GetAuditLogUseCase);
|
|
9
|
+
container.register(GetAuditLogRepository).inSingletonScope();
|
|
10
|
+
container.register(GetAuditLogGateway).inSingletonScope();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { GetAuditLogFeature };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetAuditLog/feature.js","sources":["../../../src/features/GetAuditLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetAuditLogUseCase } from \"./GetAuditLogUseCase.js\";\nimport { GetAuditLogRepository } from \"./GetAuditLogRepository.js\";\nimport { GetAuditLogGateway } from \"./GetAuditLogGateway.js\";\n\nexport const GetAuditLogFeature = createFeature({\n name: \"AuditLogs/GetAuditLog\",\n register(container) {\n container.register(GetAuditLogUseCase);\n container.register(GetAuditLogRepository).inSingletonScope();\n container.register(GetAuditLogGateway).inSingletonScope();\n }\n});\n"],"names":["GetAuditLogFeature","createFeature","container","GetAuditLogUseCase","GetAuditLogRepository","GetAuditLogGateway"],"mappings":";;;;AAKO,MAAMA,qBAAqBC,cAAc;IAC5C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,uBAAuB,gBAAgB;QAC1DF,UAAU,QAAQ,CAACG,oBAAoB,gBAAgB;IAC3D;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import type { IStorageListParams } from "../../storage/abstractions/Storage.js";
|
|
3
|
+
import { ListAuditLogsGateway as Abstraction } from "./abstractions.js";
|
|
4
|
+
declare class ListAuditLogsGatewayImpl implements Abstraction.Interface {
|
|
5
|
+
private readonly storage;
|
|
6
|
+
constructor(storage: AuditLogsStorage.Interface);
|
|
7
|
+
list(params: IStorageListParams): Promise<Abstraction.Output>;
|
|
8
|
+
}
|
|
9
|
+
export declare const ListAuditLogsGateway: typeof ListAuditLogsGatewayImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListAuditLogsGateway>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import { ListAuditLogsGateway } from "./abstractions.js";
|
|
3
|
+
class ListAuditLogsGatewayImpl {
|
|
4
|
+
constructor(storage){
|
|
5
|
+
this.storage = storage;
|
|
6
|
+
}
|
|
7
|
+
async list(params) {
|
|
8
|
+
const result = await this.storage.list(params);
|
|
9
|
+
if (!result.success) throw result.error;
|
|
10
|
+
return {
|
|
11
|
+
items: result.data,
|
|
12
|
+
meta: result.meta
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const ListAuditLogsGateway_ListAuditLogsGateway = ListAuditLogsGateway.createImplementation({
|
|
17
|
+
implementation: ListAuditLogsGatewayImpl,
|
|
18
|
+
dependencies: [
|
|
19
|
+
AuditLogsStorage
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
export { ListAuditLogsGateway_ListAuditLogsGateway as ListAuditLogsGateway };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ListAuditLogsGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListAuditLogs/ListAuditLogsGateway.js","sources":["../../../src/features/ListAuditLogs/ListAuditLogsGateway.ts"],"sourcesContent":["import { AuditLogsStorage } from \"~/abstractions.js\";\nimport type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { ListAuditLogsGateway as Abstraction } from \"./abstractions.js\";\n\nclass ListAuditLogsGatewayImpl implements Abstraction.Interface {\n public constructor(private readonly storage: AuditLogsStorage.Interface) {}\n\n public async list(params: IStorageListParams): Promise<Abstraction.Output> {\n const result = await this.storage.list(params);\n if (!result.success) {\n throw result.error;\n }\n return {\n items: result.data,\n meta: result.meta\n };\n }\n}\n\nexport const ListAuditLogsGateway = Abstraction.createImplementation({\n implementation: ListAuditLogsGatewayImpl,\n dependencies: [AuditLogsStorage]\n});\n"],"names":["ListAuditLogsGatewayImpl","storage","params","result","ListAuditLogsGateway","Abstraction","AuditLogsStorage"],"mappings":";;AAIA,MAAMA;IACF,YAAoCC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1E,MAAa,KAAKC,MAA0B,EAA+B;QACvE,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAACD;QACvC,IAAI,CAACC,OAAO,OAAO,EACf,MAAMA,OAAO,KAAK;QAEtB,OAAO;YACH,OAAOA,OAAO,IAAI;YAClB,MAAMA,OAAO,IAAI;QACrB;IACJ;AACJ;AAEO,MAAMC,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBL;IAChB,cAAc;QAACM;KAAiB;AACpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
4
|
+
import type { IListAuditLogsParams } from "../../types.js";
|
|
5
|
+
import { ListAuditLogsRepository as Abstraction } from "./abstractions.js";
|
|
6
|
+
import { ListAuditLogsGateway } from "./abstractions.js";
|
|
7
|
+
import type { ListAuditLogsOutput } from "./abstractions.js";
|
|
8
|
+
declare class ListAuditLogsRepositoryImpl implements Abstraction.Interface {
|
|
9
|
+
private readonly gateway;
|
|
10
|
+
private readonly tenantContext;
|
|
11
|
+
constructor(gateway: ListAuditLogsGateway.Interface, tenantContext: TenantContext.Interface);
|
|
12
|
+
list(params: IListAuditLogsParams): Promise<Result<ListAuditLogsOutput, AuditLogPersistenceError>>;
|
|
13
|
+
}
|
|
14
|
+
export declare const ListAuditLogsRepository: typeof ListAuditLogsRepositoryImpl & {
|
|
15
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListAuditLogsRepository>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
4
|
+
import { ListAuditLogsGateway, ListAuditLogsRepository } from "./abstractions.js";
|
|
5
|
+
class ListAuditLogsRepositoryImpl {
|
|
6
|
+
constructor(gateway, tenantContext){
|
|
7
|
+
this.gateway = gateway;
|
|
8
|
+
this.tenantContext = tenantContext;
|
|
9
|
+
}
|
|
10
|
+
async list(params) {
|
|
11
|
+
try {
|
|
12
|
+
const storageParams = {
|
|
13
|
+
...params,
|
|
14
|
+
tenant: this.tenantContext.getTenant().id
|
|
15
|
+
};
|
|
16
|
+
const { items, meta } = await this.gateway.list(storageParams);
|
|
17
|
+
return Result.ok({
|
|
18
|
+
items,
|
|
19
|
+
meta: {
|
|
20
|
+
cursor: meta.after || null,
|
|
21
|
+
hasMoreItems: meta.hasMoreItems
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
} catch (error) {
|
|
25
|
+
return Result.fail(new AuditLogPersistenceError(error));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const ListAuditLogsRepository_ListAuditLogsRepository = ListAuditLogsRepository.createImplementation({
|
|
30
|
+
implementation: ListAuditLogsRepositoryImpl,
|
|
31
|
+
dependencies: [
|
|
32
|
+
ListAuditLogsGateway,
|
|
33
|
+
TenantContext
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
export { ListAuditLogsRepository_ListAuditLogsRepository as ListAuditLogsRepository };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=ListAuditLogsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListAuditLogs/ListAuditLogsRepository.js","sources":["../../../src/features/ListAuditLogs/ListAuditLogsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { AuditLogPersistenceError } from \"~/domain/errors.js\";\nimport type { IListAuditLogsParams } from \"~/types.js\";\nimport type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { ListAuditLogsRepository as Abstraction } from \"./abstractions.js\";\nimport { ListAuditLogsGateway } from \"./abstractions.js\";\nimport type { ListAuditLogsOutput } from \"./abstractions.js\";\n\nclass ListAuditLogsRepositoryImpl implements Abstraction.Interface {\n public constructor(\n private readonly gateway: ListAuditLogsGateway.Interface,\n private readonly tenantContext: TenantContext.Interface\n ) {}\n\n public async list(\n params: IListAuditLogsParams\n ): Promise<Result<ListAuditLogsOutput, AuditLogPersistenceError>> {\n try {\n const storageParams = {\n ...params,\n tenant: this.tenantContext.getTenant().id\n } as unknown as IStorageListParams;\n\n const { items, meta } = await this.gateway.list(storageParams);\n\n return Result.ok({\n items,\n meta: {\n cursor: meta.after || null,\n hasMoreItems: meta.hasMoreItems\n }\n });\n } catch (error) {\n return Result.fail(new AuditLogPersistenceError(error as Error));\n }\n }\n}\n\nexport const ListAuditLogsRepository = Abstraction.createImplementation({\n implementation: ListAuditLogsRepositoryImpl,\n dependencies: [ListAuditLogsGateway, TenantContext]\n});\n"],"names":["ListAuditLogsRepositoryImpl","gateway","tenantContext","params","storageParams","items","meta","Result","error","AuditLogPersistenceError","ListAuditLogsRepository","Abstraction","ListAuditLogsGateway","TenantContext"],"mappings":";;;;AASA,MAAMA;IACF,YACqBC,OAAuC,EACvCC,aAAsC,CACzD;aAFmBD,OAAO,GAAPA;aACAC,aAAa,GAAbA;IAClB;IAEH,MAAa,KACTC,MAA4B,EACkC;QAC9D,IAAI;YACA,MAAMC,gBAAgB;gBAClB,GAAGD,MAAM;gBACT,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE;YAC7C;YAEA,MAAM,EAAEE,KAAK,EAAEC,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAACF;YAEhD,OAAOG,OAAO,EAAE,CAAC;gBACbF;gBACA,MAAM;oBACF,QAAQC,KAAK,KAAK,IAAI;oBACtB,cAAcA,KAAK,YAAY;gBACnC;YACJ;QACJ,EAAE,OAAOE,OAAO;YACZ,OAAOD,OAAO,IAAI,CAAC,IAAIE,yBAAyBD;QACpD;IACJ;AACJ;AAEO,MAAME,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgBX;IAChB,cAAc;QAACY;QAAsBC;KAAc;AACvD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { AuditLogPermissions } from "../../features/AuditLogPermissions/abstractions.js";
|
|
3
|
+
import type { IListAuditLogsParams } from "../../types.js";
|
|
4
|
+
import { ListAuditLogsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
5
|
+
import { ListAuditLogsRepository } from "./abstractions.js";
|
|
6
|
+
declare class ListAuditLogsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
7
|
+
private readonly repository;
|
|
8
|
+
private readonly permissions;
|
|
9
|
+
constructor(repository: ListAuditLogsRepository.Interface, permissions: AuditLogPermissions.Interface);
|
|
10
|
+
execute(params: IListAuditLogsParams): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const ListAuditLogsUseCase: typeof ListAuditLogsUseCaseImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListAuditLogsUseCase>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
3
|
+
import { AuditLogPermissions } from "../AuditLogPermissions/abstractions.js";
|
|
4
|
+
import { ListAuditLogsRepository, ListAuditLogsUseCase } from "./abstractions.js";
|
|
5
|
+
class ListAuditLogsUseCaseImpl {
|
|
6
|
+
constructor(repository, permissions){
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
this.permissions = permissions;
|
|
9
|
+
}
|
|
10
|
+
async execute(params) {
|
|
11
|
+
const canAccess = await this.permissions.canAccessAll();
|
|
12
|
+
if (!canAccess) return Result.fail(new NotAuthorizedError({
|
|
13
|
+
message: "You cannot access audit logs."
|
|
14
|
+
}));
|
|
15
|
+
return await this.repository.list(params);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const ListAuditLogsUseCase_ListAuditLogsUseCase = ListAuditLogsUseCase.createImplementation({
|
|
19
|
+
implementation: ListAuditLogsUseCaseImpl,
|
|
20
|
+
dependencies: [
|
|
21
|
+
ListAuditLogsRepository,
|
|
22
|
+
AuditLogPermissions
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
export { ListAuditLogsUseCase_ListAuditLogsUseCase as ListAuditLogsUseCase };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ListAuditLogsUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListAuditLogs/ListAuditLogsUseCase.js","sources":["../../../src/features/ListAuditLogs/ListAuditLogsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { AuditLogPermissions } from \"~/features/AuditLogPermissions/abstractions.js\";\nimport type { IListAuditLogsParams } from \"~/types.js\";\nimport { ListAuditLogsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { ListAuditLogsRepository } from \"./abstractions.js\";\n\nclass ListAuditLogsUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly repository: ListAuditLogsRepository.Interface,\n private readonly permissions: AuditLogPermissions.Interface\n ) {}\n\n public async execute(\n params: IListAuditLogsParams\n ): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>> {\n const canAccess = await this.permissions.canAccessAll();\n if (!canAccess) {\n return Result.fail(\n new NotAuthorizedError({ message: \"You cannot access audit logs.\" })\n );\n }\n\n return await this.repository.list(params);\n }\n}\n\nexport const ListAuditLogsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListAuditLogsUseCaseImpl,\n dependencies: [ListAuditLogsRepository, AuditLogPermissions]\n});\n"],"names":["ListAuditLogsUseCaseImpl","repository","permissions","params","canAccess","Result","NotAuthorizedError","ListAuditLogsUseCase","UseCaseAbstraction","ListAuditLogsRepository","AuditLogPermissions"],"mappings":";;;;AAOA,MAAMA;IACF,YACqBC,UAA6C,EAC7CC,WAA0C,CAC7D;aAFmBD,UAAU,GAAVA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,QACTC,MAA4B,EACwC;QACpE,MAAMC,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY;QACrD,IAAI,CAACA,WACD,OAAOC,OAAO,IAAI,CACd,IAAIC,mBAAmB;YAAE,SAAS;QAAgC;QAI1E,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAACH;IACtC;AACJ;AAEO,MAAMI,4CAAuBC,qBAAAA,oBAAuC,CAAC;IACxE,gBAAgBR;IAChB,cAAc;QAACS;QAAyBC;KAAoB;AAChE"}
|