@webiny/api-audit-logs 0.0.0-unstable.eb196ccd2f → 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/README.md +11 -1
- package/abstractions.d.ts +15 -0
- package/abstractions.js +6 -0
- package/abstractions.js.map +1 -0
- package/config.d.ts +0 -13
- package/config.js +4 -291
- 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.d.ts +6 -0
- package/events/AuditLogAfterCreateEvent.js +13 -0
- package/events/AuditLogAfterCreateEvent.js.map +1 -0
- package/events/AuditLogAfterUpdateEvent.d.ts +6 -0
- package/events/AuditLogAfterUpdateEvent.js +13 -0
- package/events/AuditLogAfterUpdateEvent.js.map +1 -0
- package/events/AuditLogBeforeCreateEvent.d.ts +6 -0
- package/events/AuditLogBeforeCreateEvent.js +13 -0
- package/events/AuditLogBeforeCreateEvent.js.map +1 -0
- package/events/AuditLogBeforeUpdateEvent.d.ts +6 -0
- package/events/AuditLogBeforeUpdateEvent.js +13 -0
- package/events/AuditLogBeforeUpdateEvent.js.map +1 -0
- package/events/abstractions.d.ts +38 -0
- package/events/abstractions.js +8 -0
- package/events/abstractions.js.map +1 -0
- package/events/index.d.ts +5 -0
- package/events/index.js +5 -0
- 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.d.ts +21 -0
- package/graphql/validation.js +31 -0
- package/graphql/validation.js.map +1 -0
- package/index.d.ts +3 -5
- package/index.js +2 -49
- package/package.json +34 -26
- package/storage/abstractions/Storage.d.ts +108 -0
- package/storage/abstractions/Storage.js +0 -0
- package/storage/types.d.ts +19 -0
- package/storage/types.js +0 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +11 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +45 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +53 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +51 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -0
- package/subscriptions/aco/index.d.ts +2 -2
- package/subscriptions/aco/index.js +8 -15
- 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 +11 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +35 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +35 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +38 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -0
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +38 -0
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -0
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +10 -14
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +46 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +39 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +36 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +35 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +35 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +38 -0
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +35 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +35 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +38 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/index.d.ts +2 -2
- package/subscriptions/headlessCms/index.js +30 -28
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +16 -22
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +11 -0
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +37 -0
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -0
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +4 -10
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +45 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +45 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +49 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +38 -0
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +38 -0
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +35 -0
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -0
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +38 -0
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -0
- package/subscriptions/security/handlers/cleanupApiKey.d.ts +7 -0
- package/subscriptions/security/handlers/cleanupApiKey.js +12 -0
- package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -0
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +26 -24
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/index.d.ts +2 -0
- package/subscriptions/websiteBuilder/index.js +29 -0
- package/subscriptions/websiteBuilder/index.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +38 -0
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +35 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +38 -0
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +35 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +35 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +35 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +11 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +38 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -0
- package/types.d.ts +14 -38
- package/types.js +0 -18
- package/utils/expiresAt.d.ts +4 -0
- package/utils/expiresAt.js +20 -0
- package/utils/expiresAt.js.map +1 -0
- package/utils/getAuditObject.d.ts +2 -1
- package/utils/getAuditObject.js +14 -22
- package/utils/getAuditObject.js.map +1 -1
- package/app/app.d.ts +0 -2
- package/app/app.js +0 -119
- package/app/app.js.map +0 -1
- package/app/contants.d.ts +0 -2
- package/app/contants.js +0 -10
- package/app/contants.js.map +0 -1
- package/app/createAppModifier.d.ts +0 -4
- package/app/createAppModifier.js +0 -14
- package/app/createAppModifier.js.map +0 -1
- package/app/index.d.ts +0 -4
- package/app/index.js +0 -43
- package/app/index.js.map +0 -1
- package/app/types.d.ts +0 -7
- package/app/types.js +0 -7
- package/app/types.js.map +0 -1
- package/index.js.map +0 -1
- package/subscriptions/aco/folders.d.ts +0 -4
- package/subscriptions/aco/folders.js +0 -94
- package/subscriptions/aco/folders.js.map +0 -1
- package/subscriptions/apw/changeRequests.d.ts +0 -4
- package/subscriptions/apw/changeRequests.js +0 -80
- package/subscriptions/apw/changeRequests.js.map +0 -1
- package/subscriptions/apw/comments.d.ts +0 -2
- package/subscriptions/apw/comments.js +0 -28
- package/subscriptions/apw/comments.js.map +0 -1
- package/subscriptions/apw/contentReviews.d.ts +0 -2
- package/subscriptions/apw/contentReviews.js +0 -28
- package/subscriptions/apw/contentReviews.js.map +0 -1
- package/subscriptions/apw/index.d.ts +0 -2
- package/subscriptions/apw/index.js +0 -26
- package/subscriptions/apw/index.js.map +0 -1
- package/subscriptions/apw/workflows.d.ts +0 -4
- package/subscriptions/apw/workflows.js +0 -64
- package/subscriptions/apw/workflows.js.map +0 -1
- package/subscriptions/fileManager/files.d.ts +0 -4
- package/subscriptions/fileManager/files.js +0 -64
- package/subscriptions/fileManager/files.js.map +0 -1
- package/subscriptions/fileManager/settings.d.ts +0 -2
- package/subscriptions/fileManager/settings.js +0 -32
- package/subscriptions/fileManager/settings.js.map +0 -1
- package/subscriptions/headlessCms/entries.d.ts +0 -9
- package/subscriptions/headlessCms/entries.js +0 -183
- package/subscriptions/headlessCms/entries.js.map +0 -1
- package/subscriptions/headlessCms/groups.d.ts +0 -4
- package/subscriptions/headlessCms/groups.js +0 -64
- package/subscriptions/headlessCms/groups.js.map +0 -1
- package/subscriptions/headlessCms/models.d.ts +0 -4
- package/subscriptions/headlessCms/models.js +0 -64
- package/subscriptions/headlessCms/models.js.map +0 -1
- package/subscriptions/headlessCms/utils/isSearchModelEntry.d.ts +0 -1
- package/subscriptions/headlessCms/utils/isSearchModelEntry.js +0 -13
- package/subscriptions/headlessCms/utils/isSearchModelEntry.js.map +0 -1
- package/subscriptions/i18n/index.d.ts +0 -2
- package/subscriptions/i18n/index.js +0 -15
- package/subscriptions/i18n/index.js.map +0 -1
- package/subscriptions/i18n/locales.d.ts +0 -4
- package/subscriptions/i18n/locales.js +0 -64
- package/subscriptions/i18n/locales.js.map +0 -1
- package/subscriptions/mailer/settings.d.ts +0 -2
- package/subscriptions/mailer/settings.js +0 -32
- package/subscriptions/mailer/settings.js.map +0 -1
- package/subscriptions/security/apiKeys.d.ts +0 -4
- package/subscriptions/security/apiKeys.js +0 -85
- package/subscriptions/security/apiKeys.js.map +0 -1
- package/subscriptions/security/roles.d.ts +0 -4
- package/subscriptions/security/roles.js +0 -64
- package/subscriptions/security/roles.js.map +0 -1
- package/subscriptions/security/teams.d.ts +0 -4
- package/subscriptions/security/teams.js +0 -64
- package/subscriptions/security/teams.js.map +0 -1
- package/subscriptions/security/users.d.ts +0 -4
- package/subscriptions/security/users.js +0 -64
- package/subscriptions/security/users.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/getAuditConfig.d.ts +0 -36
- package/utils/getAuditConfig.js +0 -149
- package/utils/getAuditConfig.js.map +0 -1
|
@@ -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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
3
|
+
import type { IListAuditLogsParams } from "../../types.js";
|
|
4
|
+
import type { IListAuditLogsResultMeta } from "../../types.js";
|
|
5
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
6
|
+
import type { IStorageListParams } from "../../storage/abstractions/Storage.js";
|
|
7
|
+
import type { IStorageListSuccessResultMeta } from "../../storage/abstractions/Storage.js";
|
|
8
|
+
import type { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
9
|
+
export interface ListAuditLogsOutput {
|
|
10
|
+
items: IAuditLog[];
|
|
11
|
+
meta: IListAuditLogsResultMeta;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* ListAuditLogs Use Case - Lists audit logs of the current tenant. Needs access to all audit logs.
|
|
15
|
+
*/
|
|
16
|
+
export interface IListAuditLogsUseCase {
|
|
17
|
+
execute(params: IListAuditLogsParams): Promise<Result<ListAuditLogsOutput, UseCaseError>>;
|
|
18
|
+
}
|
|
19
|
+
export interface IListAuditLogsUseCaseErrors {
|
|
20
|
+
notAuthorized: NotAuthorizedError;
|
|
21
|
+
persistence: AuditLogPersistenceError;
|
|
22
|
+
}
|
|
23
|
+
type UseCaseError = IListAuditLogsUseCaseErrors[keyof IListAuditLogsUseCaseErrors];
|
|
24
|
+
export declare const ListAuditLogsUseCase: import("@webiny/di").Abstraction<IListAuditLogsUseCase>;
|
|
25
|
+
export declare namespace ListAuditLogsUseCase {
|
|
26
|
+
type Interface = IListAuditLogsUseCase;
|
|
27
|
+
type Output = ListAuditLogsOutput;
|
|
28
|
+
type Error = UseCaseError;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* ListAuditLogsRepository - Lists audit logs of the current tenant.
|
|
32
|
+
*/
|
|
33
|
+
export interface IListAuditLogsRepository {
|
|
34
|
+
list(params: IListAuditLogsParams): Promise<Result<ListAuditLogsOutput, AuditLogPersistenceError>>;
|
|
35
|
+
}
|
|
36
|
+
export declare const ListAuditLogsRepository: import("@webiny/di").Abstraction<IListAuditLogsRepository>;
|
|
37
|
+
export declare namespace ListAuditLogsRepository {
|
|
38
|
+
type Interface = IListAuditLogsRepository;
|
|
39
|
+
}
|
|
40
|
+
export interface ListAuditLogsGatewayOutput {
|
|
41
|
+
items: IAuditLog[];
|
|
42
|
+
meta: IStorageListSuccessResultMeta;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ListAuditLogsGateway - Lists audit logs from the audit logs storage.
|
|
46
|
+
*/
|
|
47
|
+
export interface IListAuditLogsGateway {
|
|
48
|
+
list(params: IStorageListParams): Promise<ListAuditLogsGatewayOutput>;
|
|
49
|
+
}
|
|
50
|
+
export declare const ListAuditLogsGateway: import("@webiny/di").Abstraction<IListAuditLogsGateway>;
|
|
51
|
+
export declare namespace ListAuditLogsGateway {
|
|
52
|
+
type Interface = IListAuditLogsGateway;
|
|
53
|
+
type Output = ListAuditLogsGatewayOutput;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const ListAuditLogsUseCase = createAbstraction("ListAuditLogsUseCase");
|
|
3
|
+
const ListAuditLogsRepository = createAbstraction("ListAuditLogsRepository");
|
|
4
|
+
const ListAuditLogsGateway = createAbstraction("ListAuditLogsGateway");
|
|
5
|
+
export { ListAuditLogsGateway, ListAuditLogsRepository, ListAuditLogsUseCase };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListAuditLogs/abstractions.js","sources":["../../../src/features/ListAuditLogs/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 { IListAuditLogsParams } from \"~/types.js\";\nimport type { IListAuditLogsResultMeta } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport type { IStorageListSuccessResultMeta } from \"~/storage/abstractions/Storage.js\";\nimport type { AuditLogPersistenceError } from \"~/domain/errors.js\";\n\nexport interface ListAuditLogsOutput {\n items: IAuditLog[];\n meta: IListAuditLogsResultMeta;\n}\n\n/**\n * ListAuditLogs Use Case - Lists audit logs of the current tenant. Needs access to all audit logs.\n */\nexport interface IListAuditLogsUseCase {\n execute(params: IListAuditLogsParams): Promise<Result<ListAuditLogsOutput, UseCaseError>>;\n}\n\nexport interface IListAuditLogsUseCaseErrors {\n notAuthorized: NotAuthorizedError;\n persistence: AuditLogPersistenceError;\n}\n\ntype UseCaseError = IListAuditLogsUseCaseErrors[keyof IListAuditLogsUseCaseErrors];\n\nexport const ListAuditLogsUseCase =\n createAbstraction<IListAuditLogsUseCase>(\"ListAuditLogsUseCase\");\n\nexport namespace ListAuditLogsUseCase {\n export type Interface = IListAuditLogsUseCase;\n export type Output = ListAuditLogsOutput;\n export type Error = UseCaseError;\n}\n\n/**\n * ListAuditLogsRepository - Lists audit logs of the current tenant.\n */\nexport interface IListAuditLogsRepository {\n list(\n params: IListAuditLogsParams\n ): Promise<Result<ListAuditLogsOutput, AuditLogPersistenceError>>;\n}\n\nexport const ListAuditLogsRepository =\n createAbstraction<IListAuditLogsRepository>(\"ListAuditLogsRepository\");\n\nexport namespace ListAuditLogsRepository {\n export type Interface = IListAuditLogsRepository;\n}\n\nexport interface ListAuditLogsGatewayOutput {\n items: IAuditLog[];\n meta: IStorageListSuccessResultMeta;\n}\n\n/**\n * ListAuditLogsGateway - Lists audit logs from the audit logs storage.\n */\nexport interface IListAuditLogsGateway {\n list(params: IStorageListParams): Promise<ListAuditLogsGatewayOutput>;\n}\n\nexport const ListAuditLogsGateway =\n createAbstraction<IListAuditLogsGateway>(\"ListAuditLogsGateway\");\n\nexport namespace ListAuditLogsGateway {\n export type Interface = IListAuditLogsGateway;\n export type Output = ListAuditLogsGatewayOutput;\n}\n"],"names":["ListAuditLogsUseCase","createAbstraction","ListAuditLogsRepository","ListAuditLogsGateway"],"mappings":";AA6BO,MAAMA,uBACTC,kBAAyC;AAiBtC,MAAMC,0BACTD,kBAA4C;AAkBzC,MAAME,uBACTF,kBAAyC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListAuditLogsUseCase } from "./ListAuditLogsUseCase.js";
|
|
3
|
+
import { ListAuditLogsRepository } from "./ListAuditLogsRepository.js";
|
|
4
|
+
import { ListAuditLogsGateway } from "./ListAuditLogsGateway.js";
|
|
5
|
+
const ListAuditLogsFeature = createFeature({
|
|
6
|
+
name: "AuditLogs/ListAuditLogs",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(ListAuditLogsUseCase);
|
|
9
|
+
container.register(ListAuditLogsRepository).inSingletonScope();
|
|
10
|
+
container.register(ListAuditLogsGateway).inSingletonScope();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export { ListAuditLogsFeature };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListAuditLogs/feature.js","sources":["../../../src/features/ListAuditLogs/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListAuditLogsUseCase } from \"./ListAuditLogsUseCase.js\";\nimport { ListAuditLogsRepository } from \"./ListAuditLogsRepository.js\";\nimport { ListAuditLogsGateway } from \"./ListAuditLogsGateway.js\";\n\nexport const ListAuditLogsFeature = createFeature({\n name: \"AuditLogs/ListAuditLogs\",\n register(container) {\n container.register(ListAuditLogsUseCase);\n container.register(ListAuditLogsRepository).inSingletonScope();\n container.register(ListAuditLogsGateway).inSingletonScope();\n }\n});\n"],"names":["ListAuditLogsFeature","createFeature","container","ListAuditLogsUseCase","ListAuditLogsRepository","ListAuditLogsGateway"],"mappings":";;;;AAKO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,yBAAyB,gBAAgB;QAC5DF,UAAU,QAAQ,CAACG,sBAAsB,gBAAgB;IAC7D;AACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
4
|
+
import { CreateAuditLogUseCase } from "../../features/CreateAuditLog/abstractions.js";
|
|
5
|
+
import { ListAuditLogsUseCase } from "../../features/ListAuditLogs/abstractions.js";
|
|
6
|
+
import { UpdateAuditLogUseCase } from "../../features/UpdateAuditLog/abstractions.js";
|
|
7
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
8
|
+
import { RecordAuditLogUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
9
|
+
/**
|
|
10
|
+
* Records audit logs for things the current identity did. Writes happen without authorization,
|
|
11
|
+
* because the identity doing the audited action doesn't need audit log permissions.
|
|
12
|
+
*
|
|
13
|
+
* An action with a `newEntryDelay` merges into the entity's latest audit log when that log is
|
|
14
|
+
* newer than the delay, instead of creating a new one. A failure on that path is logged and
|
|
15
|
+
* nothing is recorded.
|
|
16
|
+
*/
|
|
17
|
+
declare class RecordAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
18
|
+
private readonly createAuditLog;
|
|
19
|
+
private readonly listAuditLogs;
|
|
20
|
+
private readonly updateAuditLog;
|
|
21
|
+
private readonly identityContext;
|
|
22
|
+
private readonly logger;
|
|
23
|
+
constructor(createAuditLog: CreateAuditLogUseCase.Interface, listAuditLogs: ListAuditLogsUseCase.Interface, updateAuditLog: UpdateAuditLogUseCase.Interface, identityContext: IdentityContext.Interface, logger: Logger.Interface);
|
|
24
|
+
execute(input: UseCaseAbstraction.Input): Promise<Result<IAuditLog | null, UseCaseAbstraction.Error>>;
|
|
25
|
+
private createOrMergeAuditLog;
|
|
26
|
+
}
|
|
27
|
+
export declare const RecordAuditLogUseCase: typeof RecordAuditLogUseCaseImpl & {
|
|
28
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRecordAuditLogUseCase>;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
4
|
+
import { CreateAuditLogUseCase } from "../CreateAuditLog/abstractions.js";
|
|
5
|
+
import { ListAuditLogsUseCase } from "../ListAuditLogs/abstractions.js";
|
|
6
|
+
import { UpdateAuditLogUseCase } from "../UpdateAuditLog/abstractions.js";
|
|
7
|
+
import { RecordAuditLogUseCase } from "./abstractions.js";
|
|
8
|
+
const createAuditLogDelayDate = (delay)=>{
|
|
9
|
+
const date = new Date();
|
|
10
|
+
date.setTime(date.getTime() - 1000 * delay);
|
|
11
|
+
return date;
|
|
12
|
+
};
|
|
13
|
+
class RecordAuditLogUseCaseImpl {
|
|
14
|
+
constructor(createAuditLog, listAuditLogs, updateAuditLog, identityContext, logger){
|
|
15
|
+
this.createAuditLog = createAuditLog;
|
|
16
|
+
this.listAuditLogs = listAuditLogs;
|
|
17
|
+
this.updateAuditLog = updateAuditLog;
|
|
18
|
+
this.identityContext = identityContext;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
}
|
|
21
|
+
async execute(input) {
|
|
22
|
+
const { audit, message, content, entityId } = input;
|
|
23
|
+
if (!this.identityContext.getIdentity()?.id) {
|
|
24
|
+
this.logger.debug("No identity, skipping audit log creation.");
|
|
25
|
+
return Result.ok(null);
|
|
26
|
+
}
|
|
27
|
+
const payload = {
|
|
28
|
+
message,
|
|
29
|
+
app: audit.app.app,
|
|
30
|
+
entityId,
|
|
31
|
+
entity: audit.entity.type,
|
|
32
|
+
action: audit.action.type,
|
|
33
|
+
content,
|
|
34
|
+
tags: []
|
|
35
|
+
};
|
|
36
|
+
const delay = audit.action.newEntryDelay || 0;
|
|
37
|
+
return await this.identityContext.withoutAuthorization(async ()=>{
|
|
38
|
+
if (delay > 0) try {
|
|
39
|
+
return await this.createOrMergeAuditLog(payload, delay);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
this.logger.warn({
|
|
42
|
+
error
|
|
43
|
+
}, "Could not create or merge an audit log.");
|
|
44
|
+
return Result.ok(null);
|
|
45
|
+
}
|
|
46
|
+
return await this.createAuditLog.execute(payload);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async createOrMergeAuditLog(payload, delay) {
|
|
50
|
+
const createdOnGte = createAuditLogDelayDate(delay);
|
|
51
|
+
const listResult = await this.listAuditLogs.execute({
|
|
52
|
+
app: payload.app,
|
|
53
|
+
entityId: payload.entityId,
|
|
54
|
+
limit: 1,
|
|
55
|
+
createdOn_gte: createdOnGte,
|
|
56
|
+
sort: "DESC"
|
|
57
|
+
});
|
|
58
|
+
if (listResult.isFail()) {
|
|
59
|
+
this.logger.warn({
|
|
60
|
+
error: listResult.error
|
|
61
|
+
}, "Could not list audit logs to merge into.");
|
|
62
|
+
return Result.ok(null);
|
|
63
|
+
}
|
|
64
|
+
const original = listResult.value.items[0];
|
|
65
|
+
if (!original) {
|
|
66
|
+
const createResult = await this.createAuditLog.execute(payload);
|
|
67
|
+
if (createResult.isFail()) {
|
|
68
|
+
this.logger.warn({
|
|
69
|
+
error: createResult.error
|
|
70
|
+
}, "Could not create an audit log.");
|
|
71
|
+
return Result.ok(null);
|
|
72
|
+
}
|
|
73
|
+
return Result.ok(createResult.value);
|
|
74
|
+
}
|
|
75
|
+
let content = payload.content;
|
|
76
|
+
if (original.content) {
|
|
77
|
+
const beforePayloadData = JSON.parse(original.content)?.before;
|
|
78
|
+
if (beforePayloadData) content = {
|
|
79
|
+
before: beforePayloadData,
|
|
80
|
+
after: payload.content?.after
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const updateResult = await this.updateAuditLog.execute(original, {
|
|
84
|
+
message: payload.message,
|
|
85
|
+
content
|
|
86
|
+
});
|
|
87
|
+
if (updateResult.isFail()) {
|
|
88
|
+
this.logger.warn({
|
|
89
|
+
error: updateResult.error
|
|
90
|
+
}, "Could not merge an audit log.");
|
|
91
|
+
return Result.ok(null);
|
|
92
|
+
}
|
|
93
|
+
return Result.ok(updateResult.value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const RecordAuditLogUseCase_RecordAuditLogUseCase = RecordAuditLogUseCase.createImplementation({
|
|
97
|
+
implementation: RecordAuditLogUseCaseImpl,
|
|
98
|
+
dependencies: [
|
|
99
|
+
CreateAuditLogUseCase,
|
|
100
|
+
ListAuditLogsUseCase,
|
|
101
|
+
UpdateAuditLogUseCase,
|
|
102
|
+
IdentityContext,
|
|
103
|
+
Logger
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
export { RecordAuditLogUseCase_RecordAuditLogUseCase as RecordAuditLogUseCase };
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=RecordAuditLogUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/RecordAuditLog/RecordAuditLogUseCase.js","sources":["../../../src/features/RecordAuditLog/RecordAuditLogUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { CreateAuditLogUseCase } from \"~/features/CreateAuditLog/abstractions.js\";\nimport { ListAuditLogsUseCase } from \"~/features/ListAuditLogs/abstractions.js\";\nimport { UpdateAuditLogUseCase } from \"~/features/UpdateAuditLog/abstractions.js\";\nimport type { AuditLogPayload } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { RecordAuditLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\nconst createAuditLogDelayDate = (delay: number): Date => {\n const date = new Date();\n date.setTime(date.getTime() - delay * 1000);\n return date;\n};\n\n/**\n * Records audit logs for things the current identity did. Writes happen without authorization,\n * because the identity doing the audited action doesn't need audit log permissions.\n *\n * An action with a `newEntryDelay` merges into the entity's latest audit log when that log is\n * newer than the delay, instead of creating a new one. A failure on that path is logged and\n * nothing is recorded.\n */\nclass RecordAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly createAuditLog: CreateAuditLogUseCase.Interface,\n private readonly listAuditLogs: ListAuditLogsUseCase.Interface,\n private readonly updateAuditLog: UpdateAuditLogUseCase.Interface,\n private readonly identityContext: IdentityContext.Interface,\n private readonly logger: Logger.Interface\n ) {}\n\n public async execute(\n input: UseCaseAbstraction.Input\n ): Promise<Result<IAuditLog | null, UseCaseAbstraction.Error>> {\n const { audit, message, content, entityId } = input;\n\n if (!this.identityContext.getIdentity()?.id) {\n this.logger.debug(\"No identity, skipping audit log creation.\");\n return Result.ok(null);\n }\n\n const payload: AuditLogPayload = {\n message,\n app: audit.app.app,\n entityId,\n entity: audit.entity.type,\n action: audit.action.type,\n content,\n tags: []\n };\n\n const delay = audit.action.newEntryDelay || 0;\n\n return await this.identityContext.withoutAuthorization(async () => {\n if (delay > 0) {\n try {\n return await this.createOrMergeAuditLog(payload, delay);\n } catch (error) {\n this.logger.warn({ error }, \"Could not create or merge an audit log.\");\n return Result.ok(null);\n }\n }\n return await this.createAuditLog.execute(payload);\n });\n }\n\n private async createOrMergeAuditLog(\n payload: AuditLogPayload,\n delay: number\n ): Promise<Result<IAuditLog | null, UseCaseAbstraction.Error>> {\n const createdOnGte = createAuditLogDelayDate(delay);\n const listResult = await this.listAuditLogs.execute({\n app: payload.app,\n entityId: payload.entityId,\n limit: 1,\n createdOn_gte: createdOnGte,\n sort: \"DESC\"\n });\n if (listResult.isFail()) {\n this.logger.warn(\n { error: listResult.error },\n \"Could not list audit logs to merge into.\"\n );\n return Result.ok(null);\n }\n\n const original = listResult.value.items[0];\n if (!original) {\n const createResult = await this.createAuditLog.execute(payload);\n if (createResult.isFail()) {\n this.logger.warn({ error: createResult.error }, \"Could not create an audit log.\");\n return Result.ok(null);\n }\n return Result.ok(createResult.value);\n }\n\n // Update the latest audit log with the new \"after\" payload, keeping its original \"before\".\n // Only the message and the content change: the original log keeps everything else,\n // including any tags it was created with.\n let content = payload.content;\n if (original.content) {\n const beforePayloadData = JSON.parse(original.content)?.before;\n if (beforePayloadData) {\n content = {\n before: beforePayloadData,\n after: payload.content?.after\n };\n }\n }\n\n const updateResult = await this.updateAuditLog.execute(original, {\n message: payload.message,\n content\n });\n if (updateResult.isFail()) {\n this.logger.warn({ error: updateResult.error }, \"Could not merge an audit log.\");\n return Result.ok(null);\n }\n\n return Result.ok(updateResult.value);\n }\n}\n\nexport const RecordAuditLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: RecordAuditLogUseCaseImpl,\n dependencies: [\n CreateAuditLogUseCase,\n ListAuditLogsUseCase,\n UpdateAuditLogUseCase,\n IdentityContext,\n Logger\n ]\n});\n"],"names":["createAuditLogDelayDate","delay","date","Date","RecordAuditLogUseCaseImpl","createAuditLog","listAuditLogs","updateAuditLog","identityContext","logger","input","audit","message","content","entityId","Result","payload","error","createdOnGte","listResult","original","createResult","beforePayloadData","JSON","updateResult","RecordAuditLogUseCase","UseCaseAbstraction","CreateAuditLogUseCase","ListAuditLogsUseCase","UpdateAuditLogUseCase","IdentityContext","Logger"],"mappings":";;;;;;;AAUA,MAAMA,0BAA0B,CAACC;IAC7B,MAAMC,OAAO,IAAIC;IACjBD,KAAK,OAAO,CAACA,KAAK,OAAO,KAAKD,AAAQ,OAARA;IAC9B,OAAOC;AACX;AAUA,MAAME;IACF,YACqBC,cAA+C,EAC/CC,aAA6C,EAC7CC,cAA+C,EAC/CC,eAA0C,EAC1CC,MAAwB,CAC3C;aALmBJ,cAAc,GAAdA;aACAC,aAAa,GAAbA;aACAC,cAAc,GAAdA;aACAC,eAAe,GAAfA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAa,QACTC,KAA+B,EAC4B;QAC3D,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;QAE9C,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI,IAAI;YACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAClB,OAAOK,OAAO,EAAE,CAAC;QACrB;QAEA,MAAMC,UAA2B;YAC7BJ;YACA,KAAKD,MAAM,GAAG,CAAC,GAAG;YAClBG;YACA,QAAQH,MAAM,MAAM,CAAC,IAAI;YACzB,QAAQA,MAAM,MAAM,CAAC,IAAI;YACzBE;YACA,MAAM,EAAE;QACZ;QAEA,MAAMZ,QAAQU,MAAM,MAAM,CAAC,aAAa,IAAI;QAE5C,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YACnD,IAAIV,QAAQ,GACR,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,qBAAqB,CAACe,SAASf;YACrD,EAAE,OAAOgB,OAAO;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBAAEA;gBAAM,GAAG;gBAC5B,OAAOF,OAAO,EAAE,CAAC;YACrB;YAEJ,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACC;QAC7C;IACJ;IAEA,MAAc,sBACVA,OAAwB,EACxBf,KAAa,EAC8C;QAC3D,MAAMiB,eAAelB,wBAAwBC;QAC7C,MAAMkB,aAAa,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YAChD,KAAKH,QAAQ,GAAG;YAChB,UAAUA,QAAQ,QAAQ;YAC1B,OAAO;YACP,eAAeE;YACf,MAAM;QACV;QACA,IAAIC,WAAW,MAAM,IAAI;YACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ;gBAAE,OAAOA,WAAW,KAAK;YAAC,GAC1B;YAEJ,OAAOJ,OAAO,EAAE,CAAC;QACrB;QAEA,MAAMK,WAAWD,WAAW,KAAK,CAAC,KAAK,CAAC,EAAE;QAC1C,IAAI,CAACC,UAAU;YACX,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACL;YACvD,IAAIK,aAAa,MAAM,IAAI;gBACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBAAE,OAAOA,aAAa,KAAK;gBAAC,GAAG;gBAChD,OAAON,OAAO,EAAE,CAAC;YACrB;YACA,OAAOA,OAAO,EAAE,CAACM,aAAa,KAAK;QACvC;QAKA,IAAIR,UAAUG,QAAQ,OAAO;QAC7B,IAAII,SAAS,OAAO,EAAE;YAClB,MAAME,oBAAoBC,KAAK,KAAK,CAACH,SAAS,OAAO,GAAG;YACxD,IAAIE,mBACAT,UAAU;gBACN,QAAQS;gBACR,OAAON,QAAQ,OAAO,EAAE;YAC5B;QAER;QAEA,MAAMQ,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACJ,UAAU;YAC7D,SAASJ,QAAQ,OAAO;YACxBH;QACJ;QACA,IAAIW,aAAa,MAAM,IAAI;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,OAAOA,aAAa,KAAK;YAAC,GAAG;YAChD,OAAOT,OAAO,EAAE,CAAC;QACrB;QAEA,OAAOA,OAAO,EAAE,CAACS,aAAa,KAAK;IACvC;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBtB;IAChB,cAAc;QACVuB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
import type { AuditAction } from "../../types.js";
|
|
4
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
5
|
+
import type { CreateAuditLogUseCase } from "../../features/CreateAuditLog/abstractions.js";
|
|
6
|
+
export interface RecordAuditLogInput {
|
|
7
|
+
audit: AuditAction;
|
|
8
|
+
message: string;
|
|
9
|
+
content: GenericRecord;
|
|
10
|
+
entityId: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* RecordAuditLog Use Case - Records an audit log for something the current identity did. Returns
|
|
14
|
+
* null when nothing was recorded: there's no identity, or merging into an earlier log failed.
|
|
15
|
+
*/
|
|
16
|
+
export interface IRecordAuditLogUseCase {
|
|
17
|
+
execute(input: RecordAuditLogInput): Promise<Result<IAuditLog | null, UseCaseError>>;
|
|
18
|
+
}
|
|
19
|
+
type UseCaseError = CreateAuditLogUseCase.Error;
|
|
20
|
+
export declare const RecordAuditLogUseCase: import("@webiny/di").Abstraction<IRecordAuditLogUseCase>;
|
|
21
|
+
export declare namespace RecordAuditLogUseCase {
|
|
22
|
+
type Interface = IRecordAuditLogUseCase;
|
|
23
|
+
type Input = RecordAuditLogInput;
|
|
24
|
+
type Error = UseCaseError;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/RecordAuditLog/abstractions.js","sources":["../../../src/features/RecordAuditLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { AuditAction } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { CreateAuditLogUseCase } from \"~/features/CreateAuditLog/abstractions.js\";\n\nexport interface RecordAuditLogInput {\n audit: AuditAction;\n message: string;\n content: GenericRecord;\n entityId: string;\n}\n\n/**\n * RecordAuditLog Use Case - Records an audit log for something the current identity did. Returns\n * null when nothing was recorded: there's no identity, or merging into an earlier log failed.\n */\nexport interface IRecordAuditLogUseCase {\n execute(input: RecordAuditLogInput): Promise<Result<IAuditLog | null, UseCaseError>>;\n}\n\ntype UseCaseError = CreateAuditLogUseCase.Error;\n\nexport const RecordAuditLogUseCase =\n createAbstraction<IRecordAuditLogUseCase>(\"RecordAuditLogUseCase\");\n\nexport namespace RecordAuditLogUseCase {\n export type Interface = IRecordAuditLogUseCase;\n export type Input = RecordAuditLogInput;\n export type Error = UseCaseError;\n}\n"],"names":["RecordAuditLogUseCase","createAbstraction"],"mappings":";AAwBO,MAAMA,wBACTC,kBAA0C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { RecordAuditLogUseCase } from "./RecordAuditLogUseCase.js";
|
|
3
|
+
const RecordAuditLogFeature = createFeature({
|
|
4
|
+
name: "AuditLogs/RecordAuditLog",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(RecordAuditLogUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { RecordAuditLogFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/RecordAuditLog/feature.js","sources":["../../../src/features/RecordAuditLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { RecordAuditLogUseCase } from \"./RecordAuditLogUseCase.js\";\n\nexport const RecordAuditLogFeature = createFeature({\n name: \"AuditLogs/RecordAuditLog\",\n register(container) {\n container.register(RecordAuditLogUseCase);\n }\n});\n"],"names":["RecordAuditLogFeature","createFeature","container","RecordAuditLogUseCase"],"mappings":";;AAGO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
3
|
+
import { UpdateAuditLogGateway as Abstraction } from "./abstractions.js";
|
|
4
|
+
declare class UpdateAuditLogGatewayImpl implements Abstraction.Interface {
|
|
5
|
+
private readonly storage;
|
|
6
|
+
constructor(storage: AuditLogsStorage.Interface);
|
|
7
|
+
update(auditLog: IAuditLog): Promise<IAuditLog>;
|
|
8
|
+
}
|
|
9
|
+
export declare const UpdateAuditLogGateway: typeof UpdateAuditLogGatewayImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IUpdateAuditLogGateway>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AuditLogsStorage } from "../../abstractions.js";
|
|
2
|
+
import { UpdateAuditLogGateway } from "./abstractions.js";
|
|
3
|
+
class UpdateAuditLogGatewayImpl {
|
|
4
|
+
constructor(storage){
|
|
5
|
+
this.storage = storage;
|
|
6
|
+
}
|
|
7
|
+
async update(auditLog) {
|
|
8
|
+
const result = await this.storage.store({
|
|
9
|
+
data: auditLog
|
|
10
|
+
});
|
|
11
|
+
if (!result.success) throw result.error;
|
|
12
|
+
return result.data;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const UpdateAuditLogGateway_UpdateAuditLogGateway = UpdateAuditLogGateway.createImplementation({
|
|
16
|
+
implementation: UpdateAuditLogGatewayImpl,
|
|
17
|
+
dependencies: [
|
|
18
|
+
AuditLogsStorage
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
export { UpdateAuditLogGateway_UpdateAuditLogGateway as UpdateAuditLogGateway };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=UpdateAuditLogGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/UpdateAuditLog/UpdateAuditLogGateway.js","sources":["../../../src/features/UpdateAuditLog/UpdateAuditLogGateway.ts"],"sourcesContent":["import { AuditLogsStorage } from \"~/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { UpdateAuditLogGateway as Abstraction } from \"./abstractions.js\";\n\nclass UpdateAuditLogGatewayImpl implements Abstraction.Interface {\n public constructor(private readonly storage: AuditLogsStorage.Interface) {}\n\n public async update(auditLog: IAuditLog): Promise<IAuditLog> {\n const result = await this.storage.store({ data: auditLog });\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n }\n}\n\nexport const UpdateAuditLogGateway = Abstraction.createImplementation({\n implementation: UpdateAuditLogGatewayImpl,\n dependencies: [AuditLogsStorage]\n});\n"],"names":["UpdateAuditLogGatewayImpl","storage","auditLog","result","UpdateAuditLogGateway","Abstraction","AuditLogsStorage"],"mappings":";;AAIA,MAAMA;IACF,YAAoCC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1E,MAAa,OAAOC,QAAmB,EAAsB;QACzD,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,MAAMD;QAAS;QACzD,IAAI,CAACC,OAAO,OAAO,EACf,MAAMA,OAAO,KAAK;QAEtB,OAAOA,OAAO,IAAI;IACtB;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAgC,CAAC;IAClE,gBAAgBL;IAChB,cAAc;QAACM;KAAiB;AACpC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
3
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
4
|
+
import { UpdateAuditLogRepository as Abstraction } from "./abstractions.js";
|
|
5
|
+
import { UpdateAuditLogGateway } from "./abstractions.js";
|
|
6
|
+
declare class UpdateAuditLogRepositoryImpl implements Abstraction.Interface {
|
|
7
|
+
private readonly gateway;
|
|
8
|
+
constructor(gateway: UpdateAuditLogGateway.Interface);
|
|
9
|
+
update(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const UpdateAuditLogRepository: typeof UpdateAuditLogRepositoryImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IUpdateAuditLogRepository>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { AuditLogPersistenceError } from "../../domain/errors.js";
|
|
3
|
+
import { UpdateAuditLogGateway, UpdateAuditLogRepository } from "./abstractions.js";
|
|
4
|
+
class UpdateAuditLogRepositoryImpl {
|
|
5
|
+
constructor(gateway){
|
|
6
|
+
this.gateway = gateway;
|
|
7
|
+
}
|
|
8
|
+
async update(auditLog) {
|
|
9
|
+
try {
|
|
10
|
+
const updated = await this.gateway.update(auditLog);
|
|
11
|
+
return Result.ok(updated);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
return Result.fail(new AuditLogPersistenceError(error));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const UpdateAuditLogRepository_UpdateAuditLogRepository = UpdateAuditLogRepository.createImplementation({
|
|
18
|
+
implementation: UpdateAuditLogRepositoryImpl,
|
|
19
|
+
dependencies: [
|
|
20
|
+
UpdateAuditLogGateway
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
export { UpdateAuditLogRepository_UpdateAuditLogRepository as UpdateAuditLogRepository };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=UpdateAuditLogRepository.js.map
|