@webiny/api-audit-logs 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
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 -2
- package/abstractions.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/abstractions.d.ts +0 -5
- package/events/abstractions.js.map +1 -1
- 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/index.d.ts +2 -8
- package/index.js +1 -25
- package/package.json +26 -25
- package/storage/types.d.ts +0 -35
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +18 -9
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +35 -13
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +24 -15
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
- package/subscriptions/aco/index.d.ts +2 -2
- package/subscriptions/aco/index.js +4 -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 +11 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +11 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +14 -10
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +14 -10
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +5 -5
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +18 -9
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/index.d.ts +2 -2
- package/subscriptions/headlessCms/index.js +15 -15
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +9 -7
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +3 -3
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +13 -9
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +2 -2
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +13 -13
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/index.d.ts +2 -2
- package/subscriptions/websiteBuilder/index.js +13 -13
- package/subscriptions/websiteBuilder/index.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +14 -10
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +14 -10
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +14 -10
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
- package/types.d.ts +0 -23
- package/context/AuditLogsContextValue.d.ts +0 -10
- package/context/AuditLogsContextValue.js +0 -129
- package/context/AuditLogsContextValue.js.map +0 -1
- package/context/index.d.ts +0 -9
- package/context/index.js +0 -31
- package/context/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -3
- package/graphql/schema.js +0 -115
- 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 -39
- package/storage/AccessPatternHandler.js.map +0 -1
- package/storage/Converter.d.ts +0 -16
- package/storage/Converter.js +0 -49
- package/storage/Converter.js.map +0 -1
- package/storage/Storage.d.ts +0 -18
- package/storage/Storage.js +0 -81
- package/storage/Storage.js.map +0 -1
- package/storage/abstractions/AccessPattern.d.ts +0 -24
- package/storage/abstractions/AccessPattern.js +0 -0
- package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
- package/storage/abstractions/AccessPatternHandler.js +0 -0
- package/storage/abstractions/Converter.d.ts +0 -6
- package/storage/abstractions/Converter.js +0 -0
- package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppAccessPattern.js +0 -35
- package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityAccessPattern.js +0 -35
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -35
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
- package/storage/accessPatterns/BaseAccessPattern.js +0 -60
- package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -38
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
- package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
- package/storage/accessPatterns/DefaultAccessPattern.js +0 -35
- package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
- package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/EntityIdAccessPattern.js +0 -38
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
- package/storage/accessPatterns/index.d.ts +0 -6
- package/storage/accessPatterns/index.js +0 -57
- package/storage/accessPatterns/index.js.map +0 -1
- package/storage/cursorSchema.d.ts +0 -4
- package/storage/cursorSchema.js +0 -22
- package/storage/cursorSchema.js.map +0 -1
- package/storage/entity.d.ts +0 -36
- package/storage/entity.js +0 -120
- package/storage/entity.js.map +0 -1
- package/storage/results/ListErrorResult.d.ts +0 -10
- package/storage/results/ListErrorResult.js +0 -12
- package/storage/results/ListErrorResult.js.map +0 -1
- package/storage/results/ListSuccessResult.d.ts +0 -14
- package/storage/results/ListSuccessResult.js +0 -17
- package/storage/results/ListSuccessResult.js.map +0 -1
- package/storage/results/index.d.ts +0 -2
- package/storage/results/index.js +0 -2
- package/storage/startKey.d.ts +0 -6
- package/storage/startKey.js +0 -8
- package/storage/startKey.js.map +0 -1
- package/utils/getAuditConfig.d.ts +0 -4
- package/utils/getAuditConfig.js +0 -86
- package/utils/getAuditConfig.js.map +0 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { PageAfterUnpublishEventHandler } from "@webiny/api-website-builder/features/pages/UnpublishPage/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class PageAfterUnpublishHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { page } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.PAGE.UNPUBLISH,
|
|
14
|
+
message: "Website Page Unpublished",
|
|
15
|
+
content: page,
|
|
16
|
+
entityId: page.id
|
|
17
|
+
});
|
|
18
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
15
19
|
} catch (error) {
|
|
16
20
|
throw WebinyError.from(error, {
|
|
17
21
|
message: "Error while executing PageAfterUnpublishEventHandler",
|
|
@@ -23,7 +27,7 @@ class PageAfterUnpublishHandlerImpl {
|
|
|
23
27
|
const PageAfterUnpublishAuditHandler = PageAfterUnpublishEventHandler.createImplementation({
|
|
24
28
|
implementation: PageAfterUnpublishHandlerImpl,
|
|
25
29
|
dependencies: [
|
|
26
|
-
|
|
30
|
+
RecordAuditLogUseCase
|
|
27
31
|
]
|
|
28
32
|
});
|
|
29
33
|
export { PageAfterUnpublishAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageAfterUnpublishEventHandler } from \"@webiny/api-website-builder/features/pages/UnpublishPage/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageAfterUnpublishEventHandler } from \"@webiny/api-website-builder/features/pages/UnpublishPage/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass PageAfterUnpublishHandlerImpl implements PageAfterUnpublishEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: PageAfterUnpublishEventHandler.Event): Promise<void> {\n try {\n const { page } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.PAGE.UNPUBLISH,\n message: \"Website Page Unpublished\",\n content: page,\n entityId: page.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing PageAfterUnpublishEventHandler\",\n code: \"AUDIT_LOGS_AFTER_PAGE_UNPUBLISH_HANDLER\"\n });\n }\n }\n}\n\nexport const PageAfterUnpublishAuditHandler = PageAfterUnpublishEventHandler.createImplementation({\n implementation: PageAfterUnpublishHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["PageAfterUnpublishHandlerImpl","recordAuditLog","event","page","recordResult","AUDIT","error","WebinyError","PageAfterUnpublishAuditHandler","PageAfterUnpublishEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA2C,EAAiB;QACrE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAC9B,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,IAAI,CAAC,SAAS;gBAC3C,SAAS;gBACT,SAASF;gBACT,UAAUA,KAAK,EAAE;YACrB;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,+BAA+B,oBAAoB,CAAC;IAC9F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PageAfterUpdateEventHandler } from "@webiny/api-website-builder/features/pages/UpdatePage/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
3
|
declare class PageAfterUpdateHandlerImpl implements PageAfterUpdateEventHandler.Interface {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
6
|
handle(event: PageAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const PageAfterUpdateAuditHandler: typeof PageAfterUpdateHandlerImpl & {
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { PageAfterUpdateEventHandler } from "@webiny/api-website-builder/features/pages/UpdatePage/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class PageAfterUpdateHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { page, original } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.PAGE.UPDATE,
|
|
14
|
+
message: "Website Page Updated",
|
|
15
|
+
content: {
|
|
16
|
+
before: original,
|
|
17
|
+
after: page
|
|
18
|
+
},
|
|
19
|
+
entityId: page.id
|
|
20
|
+
});
|
|
21
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
18
22
|
} catch (error) {
|
|
19
23
|
throw WebinyError.from(error, {
|
|
20
24
|
message: "Error while executing PageAfterUpdateEventHandler",
|
|
@@ -26,7 +30,7 @@ class PageAfterUpdateHandlerImpl {
|
|
|
26
30
|
const PageAfterUpdateAuditHandler = PageAfterUpdateEventHandler.createImplementation({
|
|
27
31
|
implementation: PageAfterUpdateHandlerImpl,
|
|
28
32
|
dependencies: [
|
|
29
|
-
|
|
33
|
+
RecordAuditLogUseCase
|
|
30
34
|
]
|
|
31
35
|
});
|
|
32
36
|
export { PageAfterUpdateAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageAfterUpdateEventHandler } from \"@webiny/api-website-builder/features/pages/UpdatePage/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageAfterUpdateEventHandler } from \"@webiny/api-website-builder/features/pages/UpdatePage/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass PageAfterUpdateHandlerImpl implements PageAfterUpdateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: PageAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { page, original } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.PAGE.UPDATE,\n message: \"Website Page Updated\",\n content: { before: original, after: page },\n entityId: page.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing PageAfterUpdateEventHandler\",\n code: \"AUDIT_LOGS_AFTER_PAGE_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const PageAfterUpdateAuditHandler = PageAfterUpdateEventHandler.createImplementation({\n implementation: PageAfterUpdateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["PageAfterUpdateHandlerImpl","recordAuditLog","event","page","original","recordResult","AUDIT","error","WebinyError","PageAfterUpdateAuditHandler","PageAfterUpdateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;YACxC,MAAMG,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,IAAI,CAAC,MAAM;gBACxC,SAAS;gBACT,SAAS;oBAAE,QAAQF;oBAAU,OAAOD;gBAAK;gBACzC,UAAUA,KAAK,EAAE;YACrB;YACA,IAAIE,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,8BAA8BC,4BAA4B,oBAAoB,CAAC;IACxF,gBAAgBV;IAChB,cAAc;QAACW;KAAsB;AACzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RedirectAfterCreateEventHandler } from "@webiny/api-website-builder/features/redirects/CreateRedirect/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
3
|
declare class RedirectAfterCreateHandlerImpl implements RedirectAfterCreateEventHandler.Interface {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
6
|
handle(event: RedirectAfterCreateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const RedirectAfterCreateAuditHandler: typeof RedirectAfterCreateHandlerImpl & {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { RedirectAfterCreateEventHandler } from "@webiny/api-website-builder/features/redirects/CreateRedirect/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class RedirectAfterCreateHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { redirect } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.REDIRECT.CREATE,
|
|
14
|
+
message: "Website Redirect Created",
|
|
15
|
+
content: redirect,
|
|
16
|
+
entityId: redirect.id
|
|
17
|
+
});
|
|
18
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
15
19
|
} catch (error) {
|
|
16
20
|
throw WebinyError.from(error, {
|
|
17
21
|
message: "Error while executing RedirectAfterCreateEventHandler",
|
|
@@ -23,7 +27,7 @@ class RedirectAfterCreateHandlerImpl {
|
|
|
23
27
|
const RedirectAfterCreateAuditHandler = RedirectAfterCreateEventHandler.createImplementation({
|
|
24
28
|
implementation: RedirectAfterCreateHandlerImpl,
|
|
25
29
|
dependencies: [
|
|
26
|
-
|
|
30
|
+
RecordAuditLogUseCase
|
|
27
31
|
]
|
|
28
32
|
});
|
|
29
33
|
export { RedirectAfterCreateAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterCreateEventHandler } from \"@webiny/api-website-builder/features/redirects/CreateRedirect/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterCreateEventHandler } from \"@webiny/api-website-builder/features/redirects/CreateRedirect/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterCreateHandlerImpl implements RedirectAfterCreateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RedirectAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.REDIRECT.CREATE,\n message: \"Website Redirect Created\",\n content: redirect,\n entityId: redirect.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterCreateEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterCreateAuditHandler = RedirectAfterCreateEventHandler.createImplementation(\n {\n implementation: RedirectAfterCreateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n }\n);\n"],"names":["RedirectAfterCreateHandlerImpl","recordAuditLog","event","redirect","recordResult","AUDIT","error","WebinyError","RedirectAfterCreateAuditHandler","RedirectAfterCreateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;gBAC5C,SAAS;gBACT,SAASF;gBACT,UAAUA,SAAS,EAAE;YACzB;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RedirectAfterDeleteEventHandler } from "@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
3
|
declare class RedirectAfterDeleteHandlerImpl implements RedirectAfterDeleteEventHandler.Interface {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
6
|
handle(event: RedirectAfterDeleteEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const RedirectAfterDeleteAuditHandler: typeof RedirectAfterDeleteHandlerImpl & {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { RedirectAfterDeleteEventHandler } from "@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class RedirectAfterDeleteHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { redirect } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.REDIRECT.DELETE,
|
|
14
|
+
message: "Website Redirect Deleted",
|
|
15
|
+
content: redirect,
|
|
16
|
+
entityId: redirect.id
|
|
17
|
+
});
|
|
18
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
15
19
|
} catch (error) {
|
|
16
20
|
throw WebinyError.from(error, {
|
|
17
21
|
message: "Error while executing RedirectAfterDeleteEventHandler",
|
|
@@ -23,7 +27,7 @@ class RedirectAfterDeleteHandlerImpl {
|
|
|
23
27
|
const RedirectAfterDeleteAuditHandler = RedirectAfterDeleteEventHandler.createImplementation({
|
|
24
28
|
implementation: RedirectAfterDeleteHandlerImpl,
|
|
25
29
|
dependencies: [
|
|
26
|
-
|
|
30
|
+
RecordAuditLogUseCase
|
|
27
31
|
]
|
|
28
32
|
});
|
|
29
33
|
export { RedirectAfterDeleteAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterDeleteEventHandler } from \"@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterDeleteEventHandler } from \"@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterDeleteHandlerImpl implements RedirectAfterDeleteEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RedirectAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.REDIRECT.DELETE,\n message: \"Website Redirect Deleted\",\n content: redirect,\n entityId: redirect.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterDeleteEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterDeleteAuditHandler = RedirectAfterDeleteEventHandler.createImplementation(\n {\n implementation: RedirectAfterDeleteHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n }\n);\n"],"names":["RedirectAfterDeleteHandlerImpl","recordAuditLog","event","redirect","recordResult","AUDIT","error","WebinyError","RedirectAfterDeleteAuditHandler","RedirectAfterDeleteEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;gBAC5C,SAAS;gBACT,SAASF;gBACT,UAAUA,SAAS,EAAE;YACzB;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RedirectAfterMoveEventHandler } from "@webiny/api-website-builder/features/redirects/MoveRedirect/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
3
|
declare class RedirectAfterMoveHandlerImpl implements RedirectAfterMoveEventHandler.Interface {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
6
|
handle(event: RedirectAfterMoveEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const RedirectAfterMoveAuditHandler: typeof RedirectAfterMoveHandlerImpl & {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { RedirectAfterMoveEventHandler } from "@webiny/api-website-builder/features/redirects/MoveRedirect/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class RedirectAfterMoveHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { redirect } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.REDIRECT.MOVE,
|
|
14
|
+
message: "Website Redirect Moved",
|
|
15
|
+
content: redirect,
|
|
16
|
+
entityId: redirect.id
|
|
17
|
+
});
|
|
18
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
15
19
|
} catch (error) {
|
|
16
20
|
throw WebinyError.from(error, {
|
|
17
21
|
message: "Error while executing RedirectAfterMoveEventHandler",
|
|
@@ -23,7 +27,7 @@ class RedirectAfterMoveHandlerImpl {
|
|
|
23
27
|
const RedirectAfterMoveAuditHandler = RedirectAfterMoveEventHandler.createImplementation({
|
|
24
28
|
implementation: RedirectAfterMoveHandlerImpl,
|
|
25
29
|
dependencies: [
|
|
26
|
-
|
|
30
|
+
RecordAuditLogUseCase
|
|
27
31
|
]
|
|
28
32
|
});
|
|
29
33
|
export { RedirectAfterMoveAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterMoveEventHandler } from \"@webiny/api-website-builder/features/redirects/MoveRedirect/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterMoveEventHandler } from \"@webiny/api-website-builder/features/redirects/MoveRedirect/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterMoveHandlerImpl implements RedirectAfterMoveEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RedirectAfterMoveEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.REDIRECT.MOVE,\n message: \"Website Redirect Moved\",\n content: redirect,\n entityId: redirect.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterMoveEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_MOVE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterMoveAuditHandler = RedirectAfterMoveEventHandler.createImplementation({\n implementation: RedirectAfterMoveHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["RedirectAfterMoveHandlerImpl","recordAuditLog","event","redirect","recordResult","AUDIT","error","WebinyError","RedirectAfterMoveAuditHandler","RedirectAfterMoveEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,QAAQ,CAAC,IAAI;gBAC1C,SAAS;gBACT,SAASF;gBACT,UAAUA,SAAS,EAAE;YACzB;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,gCAAgCC,8BAA8B,oBAAoB,CAAC;IAC5F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RedirectAfterUpdateEventHandler } from "@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
3
|
declare class RedirectAfterUpdateHandlerImpl implements RedirectAfterUpdateEventHandler.Interface {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
6
|
handle(event: RedirectAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const RedirectAfterUpdateAuditHandler: typeof RedirectAfterUpdateHandlerImpl & {
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { WebinyError } from "@webiny/error";
|
|
2
2
|
import { RedirectAfterUpdateEventHandler } from "@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
5
4
|
import { AUDIT } from "../../../config.js";
|
|
6
5
|
class RedirectAfterUpdateHandlerImpl {
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
9
8
|
}
|
|
10
9
|
async handle(event) {
|
|
11
10
|
try {
|
|
12
11
|
const { redirect, original } = event.payload;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
13
|
+
audit: AUDIT.WEBSITE_BUILDER.REDIRECT.UPDATE,
|
|
14
|
+
message: "Website Redirect Updated",
|
|
15
|
+
content: {
|
|
16
|
+
before: original,
|
|
17
|
+
after: redirect
|
|
18
|
+
},
|
|
19
|
+
entityId: redirect.id
|
|
20
|
+
});
|
|
21
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
18
22
|
} catch (error) {
|
|
19
23
|
throw WebinyError.from(error, {
|
|
20
24
|
message: "Error while executing RedirectAfterUpdateEventHandler",
|
|
@@ -26,7 +30,7 @@ class RedirectAfterUpdateHandlerImpl {
|
|
|
26
30
|
const RedirectAfterUpdateAuditHandler = RedirectAfterUpdateEventHandler.createImplementation({
|
|
27
31
|
implementation: RedirectAfterUpdateHandlerImpl,
|
|
28
32
|
dependencies: [
|
|
29
|
-
|
|
33
|
+
RecordAuditLogUseCase
|
|
30
34
|
]
|
|
31
35
|
});
|
|
32
36
|
export { RedirectAfterUpdateAuditHandler };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterUpdateEventHandler } from \"@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterUpdateEventHandler } from \"@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterUpdateHandlerImpl implements RedirectAfterUpdateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RedirectAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { redirect, original } = event.payload;\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.REDIRECT.UPDATE,\n message: \"Website Redirect Updated\",\n content: { before: original, after: redirect },\n entityId: redirect.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterUpdateEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterUpdateAuditHandler = RedirectAfterUpdateEventHandler.createImplementation(\n {\n implementation: RedirectAfterUpdateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n }\n);\n"],"names":["RedirectAfterUpdateHandlerImpl","recordAuditLog","event","redirect","original","recordResult","AUDIT","error","WebinyError","RedirectAfterUpdateAuditHandler","RedirectAfterUpdateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;YAC5C,MAAMG,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;gBAC5C,SAAS;gBACT,SAAS;oBAAE,QAAQF;oBAAU,OAAOD;gBAAS;gBAC7C,UAAUA,SAAS,EAAE;YACzB;YACA,IAAIE,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBV;IAChB,cAAc;QAACW;KAAsB;AACzC"}
|
package/types.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { GenericRecord } from "@webiny/api/types.js";
|
|
2
2
|
import type { Action, App, Entity } from "@webiny/common-audit-logs/types.js";
|
|
3
|
-
import type { DbContext } from "@webiny/handler-db/types.js";
|
|
4
|
-
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
5
3
|
import type { IAuditLog } from "./storage/types.js";
|
|
6
4
|
import type { IStorageListParams } from "./storage/abstractions/Storage.js";
|
|
7
5
|
export interface AuditLogPayload extends Omit<IAuditLog, "id" | "tenant" | "createdOn" | "createdBy" | "expiresAt" | "content"> {
|
|
@@ -15,27 +13,6 @@ export interface IListAuditLogsResultMeta {
|
|
|
15
13
|
cursor: string | null;
|
|
16
14
|
hasMoreItems: boolean;
|
|
17
15
|
}
|
|
18
|
-
export interface IListAuditLogsSuccessResult {
|
|
19
|
-
items: IAuditLog[];
|
|
20
|
-
meta: IListAuditLogsResultMeta;
|
|
21
|
-
error?: never;
|
|
22
|
-
}
|
|
23
|
-
export interface IListAuditLogsErrorResult {
|
|
24
|
-
items?: never;
|
|
25
|
-
meta?: never;
|
|
26
|
-
error: Error;
|
|
27
|
-
}
|
|
28
|
-
export type IListAuditLogsResult = IListAuditLogsSuccessResult | IListAuditLogsErrorResult;
|
|
29
|
-
export interface AuditLogsContextValue {
|
|
30
|
-
deleteLogsAfterDays: number | undefined;
|
|
31
|
-
createAuditLog(payload: AuditLogPayload): Promise<IAuditLog>;
|
|
32
|
-
updateAuditLog(original: IAuditLog, payload: Partial<AuditLogPayload>): Promise<IAuditLog>;
|
|
33
|
-
getAuditLog(id: string): Promise<IAuditLog | null>;
|
|
34
|
-
listAuditLogs(params: IListAuditLogsParams): Promise<IListAuditLogsResult>;
|
|
35
|
-
}
|
|
36
|
-
export interface AuditLogsContext extends ApiCoreContext, Pick<DbContext, "db"> {
|
|
37
|
-
auditLogs: AuditLogsContextValue;
|
|
38
|
-
}
|
|
39
16
|
export interface AuditObject {
|
|
40
17
|
[app: string]: EntityObject;
|
|
41
18
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AuditLogsContext, AuditLogsContextValue } from "../types.js";
|
|
2
|
-
import type { IStorage } from "../storage/abstractions/Storage.js";
|
|
3
|
-
import type { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
4
|
-
export interface IAuditLogsContextValueParams {
|
|
5
|
-
getContext: () => AuditLogsContext;
|
|
6
|
-
deleteLogsAfterDays: number;
|
|
7
|
-
storage: IStorage;
|
|
8
|
-
eventPublisher: EventPublisher.Interface;
|
|
9
|
-
}
|
|
10
|
-
export declare const createAuditLogsContextValue: (params: IAuditLogsContextValueParams) => AuditLogsContextValue;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { convertExpiresAtDaysToDate } from "../utils/expiresAt.js";
|
|
2
|
-
import { mdbid } from "@webiny/utils/mdbid.js";
|
|
3
|
-
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/index.js";
|
|
4
|
-
import { AuditLogAfterCreateEvent, AuditLogAfterUpdateEvent, AuditLogBeforeCreateEvent, AuditLogBeforeUpdateEvent } from "../events/index.js";
|
|
5
|
-
class AuditLogsContextValueImpl {
|
|
6
|
-
constructor(params){
|
|
7
|
-
this.getContext = params.getContext;
|
|
8
|
-
this.deleteLogsAfterDays = params.deleteLogsAfterDays;
|
|
9
|
-
this.storage = params.storage;
|
|
10
|
-
this.eventPublisher = params.eventPublisher;
|
|
11
|
-
}
|
|
12
|
-
async createAuditLog(payload) {
|
|
13
|
-
const context = this.getContext();
|
|
14
|
-
const expiresAt = convertExpiresAtDaysToDate(this.deleteLogsAfterDays);
|
|
15
|
-
const auditLog = {
|
|
16
|
-
id: mdbid(),
|
|
17
|
-
tenant: this.getTenantId(),
|
|
18
|
-
createdBy: this.getIdentity(),
|
|
19
|
-
createdOn: new Date(),
|
|
20
|
-
...payload,
|
|
21
|
-
content: JSON.stringify(payload.content),
|
|
22
|
-
expiresAt
|
|
23
|
-
};
|
|
24
|
-
await this.checkPermissions(auditLog);
|
|
25
|
-
const beforeCreateEvent = new AuditLogBeforeCreateEvent({
|
|
26
|
-
auditLog: auditLog,
|
|
27
|
-
context,
|
|
28
|
-
setAuditLog (input) {
|
|
29
|
-
Object.assign(auditLog, input);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
await this.eventPublisher.publish(beforeCreateEvent);
|
|
33
|
-
const result = await this.storage.store({
|
|
34
|
-
data: auditLog
|
|
35
|
-
});
|
|
36
|
-
if (result.success) {
|
|
37
|
-
const afterCreateEvent = new AuditLogAfterCreateEvent({
|
|
38
|
-
auditLog: auditLog,
|
|
39
|
-
context
|
|
40
|
-
});
|
|
41
|
-
await this.eventPublisher.publish(afterCreateEvent);
|
|
42
|
-
return result.data;
|
|
43
|
-
}
|
|
44
|
-
throw result.error;
|
|
45
|
-
}
|
|
46
|
-
async updateAuditLog(original, payload) {
|
|
47
|
-
const context = this.getContext();
|
|
48
|
-
const auditLog = {
|
|
49
|
-
...original,
|
|
50
|
-
...payload,
|
|
51
|
-
content: payload.content ? JSON.stringify(payload.content) : original.content
|
|
52
|
-
};
|
|
53
|
-
await this.checkPermissions(auditLog);
|
|
54
|
-
const beforeUpdateEvent = new AuditLogBeforeUpdateEvent({
|
|
55
|
-
original,
|
|
56
|
-
auditLog,
|
|
57
|
-
context,
|
|
58
|
-
setAuditLog (input) {
|
|
59
|
-
Object.assign(auditLog, input);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
await this.eventPublisher.publish(beforeUpdateEvent);
|
|
63
|
-
const result = await this.storage.store({
|
|
64
|
-
data: auditLog
|
|
65
|
-
});
|
|
66
|
-
if (result.success) {
|
|
67
|
-
const afterUpdateEvent = new AuditLogAfterUpdateEvent({
|
|
68
|
-
original: original,
|
|
69
|
-
auditLog: auditLog,
|
|
70
|
-
context
|
|
71
|
-
});
|
|
72
|
-
await this.eventPublisher.publish(afterUpdateEvent);
|
|
73
|
-
return result.data;
|
|
74
|
-
}
|
|
75
|
-
throw result.error;
|
|
76
|
-
}
|
|
77
|
-
async getAuditLog(id) {
|
|
78
|
-
const result = await this.storage.fetch({
|
|
79
|
-
id,
|
|
80
|
-
tenant: this.getTenantId()
|
|
81
|
-
});
|
|
82
|
-
if (result.success) {
|
|
83
|
-
await this.checkPermissions(result.data);
|
|
84
|
-
return result.data;
|
|
85
|
-
}
|
|
86
|
-
throw result.error;
|
|
87
|
-
}
|
|
88
|
-
async listAuditLogs(params) {
|
|
89
|
-
const result = await this.storage.list({
|
|
90
|
-
...params,
|
|
91
|
-
tenant: this.getTenantId()
|
|
92
|
-
});
|
|
93
|
-
if (result.success) return {
|
|
94
|
-
items: result.data,
|
|
95
|
-
meta: {
|
|
96
|
-
cursor: result.meta.after || null,
|
|
97
|
-
hasMoreItems: result.meta.hasMoreItems
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
throw result.error;
|
|
101
|
-
}
|
|
102
|
-
async checkPermissions(auditLog) {
|
|
103
|
-
if (!auditLog.action) throw new Error("Audit log action is not defined. Cannot check permissions.");
|
|
104
|
-
const permissions = await this.getContext().security.getPermissions("al.*");
|
|
105
|
-
for (const permission of permissions){
|
|
106
|
-
if ("*" === permission.name) return;
|
|
107
|
-
if ("al.*" === permission.name) return;
|
|
108
|
-
if (permission.name === `al.${auditLog.action}`) return;
|
|
109
|
-
}
|
|
110
|
-
throw new NotAuthorizedError({
|
|
111
|
-
message: "You cannot access audit logs."
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
getTenantId() {
|
|
115
|
-
return this.getContext().tenancy.getCurrentTenant().id;
|
|
116
|
-
}
|
|
117
|
-
getIdentity() {
|
|
118
|
-
const identity = this.getContext().security.getIdentity();
|
|
119
|
-
return {
|
|
120
|
-
id: identity.id,
|
|
121
|
-
type: identity.type,
|
|
122
|
-
displayName: identity.displayName || "unknown"
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const createAuditLogsContextValue = (params)=>new AuditLogsContextValueImpl(params);
|
|
127
|
-
export { createAuditLogsContextValue };
|
|
128
|
-
|
|
129
|
-
//# sourceMappingURL=AuditLogsContextValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context/AuditLogsContextValue.js","sources":["../../src/context/AuditLogsContextValue.ts"],"sourcesContent":["import type {\n AuditLogPayload,\n AuditLogsContext,\n AuditLogsContextValue,\n IListAuditLogsParams,\n IListAuditLogsResult\n} from \"~/types.js\";\nimport { convertExpiresAtDaysToDate } from \"~/utils/expiresAt.js\";\nimport type { IAuditLog, IAuditLogCreatedBy } from \"~/storage/types.js\";\nimport { mdbid } from \"@webiny/utils/mdbid.js\";\nimport type { IStorage, IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport type { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport {\n AuditLogBeforeCreateEvent,\n AuditLogAfterCreateEvent,\n AuditLogBeforeUpdateEvent,\n AuditLogAfterUpdateEvent\n} from \"~/events/index.js\";\n\nexport interface IAuditLogsContextValueParams {\n getContext: () => AuditLogsContext;\n deleteLogsAfterDays: number;\n storage: IStorage;\n eventPublisher: EventPublisher.Interface;\n}\n\nclass AuditLogsContextValueImpl implements AuditLogsContextValue {\n private readonly getContext;\n public readonly deleteLogsAfterDays;\n private readonly storage: IStorage;\n private readonly eventPublisher: EventPublisher.Interface;\n\n public constructor(params: IAuditLogsContextValueParams) {\n this.getContext = params.getContext;\n this.deleteLogsAfterDays = params.deleteLogsAfterDays;\n this.storage = params.storage;\n this.eventPublisher = params.eventPublisher;\n }\n\n public async createAuditLog(payload: AuditLogPayload): Promise<IAuditLog> {\n const context = this.getContext();\n const expiresAt = convertExpiresAtDaysToDate(this.deleteLogsAfterDays);\n\n const auditLog: IAuditLog = {\n id: mdbid(),\n tenant: this.getTenantId(),\n createdBy: this.getIdentity(),\n createdOn: new Date(),\n ...payload,\n content: JSON.stringify(payload.content),\n expiresAt\n };\n await this.checkPermissions(auditLog);\n\n const beforeCreateEvent = new AuditLogBeforeCreateEvent({\n auditLog: auditLog,\n context,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeCreateEvent);\n\n const result = await this.storage.store({\n data: auditLog\n });\n if (result.success) {\n const afterCreateEvent = new AuditLogAfterCreateEvent({\n auditLog: auditLog,\n context\n });\n await this.eventPublisher.publish(afterCreateEvent);\n return result.data;\n }\n throw result.error;\n }\n\n public async updateAuditLog(\n original: IAuditLog,\n payload: Partial<AuditLogPayload>\n ): Promise<IAuditLog> {\n const context = this.getContext();\n const auditLog: IAuditLog = {\n ...original,\n ...payload,\n content: payload.content ? JSON.stringify(payload.content) : original.content\n };\n await this.checkPermissions(auditLog);\n\n const beforeUpdateEvent = new AuditLogBeforeUpdateEvent({\n original,\n auditLog,\n context,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeUpdateEvent);\n\n const result = await this.storage.store({\n data: auditLog\n });\n if (result.success) {\n const afterUpdateEvent = new AuditLogAfterUpdateEvent({\n original: original,\n auditLog: auditLog,\n context\n });\n await this.eventPublisher.publish(afterUpdateEvent);\n return result.data;\n }\n throw result.error;\n }\n\n public async getAuditLog(id: string): Promise<IAuditLog | null> {\n const result = await this.storage.fetch({\n id,\n tenant: this.getTenantId()\n });\n if (result.success) {\n await this.checkPermissions(result.data);\n return result.data;\n }\n throw result.error;\n }\n\n public async listAuditLogs(params: IListAuditLogsParams): Promise<IListAuditLogsResult> {\n const result = await this.storage.list({\n ...params,\n tenant: this.getTenantId()\n } as unknown as IStorageListParams);\n if (result.success) {\n return {\n items: result.data,\n meta: {\n cursor: result.meta.after || null,\n hasMoreItems: result.meta.hasMoreItems\n }\n };\n }\n throw result.error;\n }\n\n private async checkPermissions(auditLog: Pick<IAuditLog, \"action\">): Promise<void> {\n if (!auditLog.action) {\n throw new Error(\"Audit log action is not defined. Cannot check permissions.\");\n }\n const permissions = await this.getContext().security.getPermissions(\"al.*\");\n for (const permission of permissions) {\n if (permission.name === \"*\") {\n return;\n }\n if (permission.name === \"al.*\") {\n return;\n } else if (permission.name === `al.${auditLog.action}`) {\n return;\n }\n }\n\n throw new NotAuthorizedError({\n message: \"You cannot access audit logs.\"\n });\n }\n\n private getTenantId(): string {\n return this.getContext().tenancy.getCurrentTenant().id;\n }\n\n private getIdentity(): IAuditLogCreatedBy {\n const identity = this.getContext().security.getIdentity();\n return {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName || \"unknown\"\n };\n }\n}\n\nexport const createAuditLogsContextValue = (\n params: IAuditLogsContextValueParams\n): AuditLogsContextValue => {\n return new AuditLogsContextValueImpl(params);\n};\n"],"names":["AuditLogsContextValueImpl","params","payload","context","expiresAt","convertExpiresAtDaysToDate","auditLog","mdbid","Date","JSON","beforeCreateEvent","AuditLogBeforeCreateEvent","input","Object","result","afterCreateEvent","AuditLogAfterCreateEvent","original","beforeUpdateEvent","AuditLogBeforeUpdateEvent","afterUpdateEvent","AuditLogAfterUpdateEvent","id","Error","permissions","permission","NotAuthorizedError","identity","createAuditLogsContextValue"],"mappings":";;;;AA2BA,MAAMA;IAMF,YAAmBC,MAAoC,CAAE;QACrD,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,mBAAmB,GAAGA,OAAO,mBAAmB;QACrD,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,cAAc,GAAGA,OAAO,cAAc;IAC/C;IAEA,MAAa,eAAeC,OAAwB,EAAsB;QACtE,MAAMC,UAAU,IAAI,CAAC,UAAU;QAC/B,MAAMC,YAAYC,2BAA2B,IAAI,CAAC,mBAAmB;QAErE,MAAMC,WAAsB;YACxB,IAAIC;YACJ,QAAQ,IAAI,CAAC,WAAW;YACxB,WAAW,IAAI,CAAC,WAAW;YAC3B,WAAW,IAAIC;YACf,GAAGN,OAAO;YACV,SAASO,KAAK,SAAS,CAACP,QAAQ,OAAO;YACvCE;QACJ;QACA,MAAM,IAAI,CAAC,gBAAgB,CAACE;QAE5B,MAAMI,oBAAoB,IAAIC,0BAA0B;YACpD,UAAUL;YACVH;YACA,aAAYS,KAAK;gBACbC,OAAO,MAAM,CAACP,UAAUM;YAC5B;QACJ;QACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACF;QAElC,MAAMI,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACpC,MAAMR;QACV;QACA,IAAIQ,OAAO,OAAO,EAAE;YAChB,MAAMC,mBAAmB,IAAIC,yBAAyB;gBAClD,UAAUV;gBACVH;YACJ;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACY;YAClC,OAAOD,OAAO,IAAI;QACtB;QACA,MAAMA,OAAO,KAAK;IACtB;IAEA,MAAa,eACTG,QAAmB,EACnBf,OAAiC,EACf;QAClB,MAAMC,UAAU,IAAI,CAAC,UAAU;QAC/B,MAAMG,WAAsB;YACxB,GAAGW,QAAQ;YACX,GAAGf,OAAO;YACV,SAASA,QAAQ,OAAO,GAAGO,KAAK,SAAS,CAACP,QAAQ,OAAO,IAAIe,SAAS,OAAO;QACjF;QACA,MAAM,IAAI,CAAC,gBAAgB,CAACX;QAE5B,MAAMY,oBAAoB,IAAIC,0BAA0B;YACpDF;YACAX;YACAH;YACA,aAAYS,KAAK;gBACbC,OAAO,MAAM,CAACP,UAAUM;YAC5B;QACJ;QACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACM;QAElC,MAAMJ,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACpC,MAAMR;QACV;QACA,IAAIQ,OAAO,OAAO,EAAE;YAChB,MAAMM,mBAAmB,IAAIC,yBAAyB;gBAClD,UAAUJ;gBACV,UAAUX;gBACVH;YACJ;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACiB;YAClC,OAAON,OAAO,IAAI;QACtB;QACA,MAAMA,OAAO,KAAK;IACtB;IAEA,MAAa,YAAYQ,EAAU,EAA6B;QAC5D,MAAMR,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACpCQ;YACA,QAAQ,IAAI,CAAC,WAAW;QAC5B;QACA,IAAIR,OAAO,OAAO,EAAE;YAChB,MAAM,IAAI,CAAC,gBAAgB,CAACA,OAAO,IAAI;YACvC,OAAOA,OAAO,IAAI;QACtB;QACA,MAAMA,OAAO,KAAK;IACtB;IAEA,MAAa,cAAcb,MAA4B,EAAiC;QACpF,MAAMa,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACnC,GAAGb,MAAM;YACT,QAAQ,IAAI,CAAC,WAAW;QAC5B;QACA,IAAIa,OAAO,OAAO,EACd,OAAO;YACH,OAAOA,OAAO,IAAI;YAClB,MAAM;gBACF,QAAQA,OAAO,IAAI,CAAC,KAAK,IAAI;gBAC7B,cAAcA,OAAO,IAAI,CAAC,YAAY;YAC1C;QACJ;QAEJ,MAAMA,OAAO,KAAK;IACtB;IAEA,MAAc,iBAAiBR,QAAmC,EAAiB;QAC/E,IAAI,CAACA,SAAS,MAAM,EAChB,MAAM,IAAIiB,MAAM;QAEpB,MAAMC,cAAc,MAAM,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC;QACpE,KAAK,MAAMC,cAAcD,YAAa;YAClC,IAAIC,AAAoB,QAApBA,WAAW,IAAI,EACf;YAEJ,IAAIA,AAAoB,WAApBA,WAAW,IAAI,EACf;YACG,IAAIA,WAAW,IAAI,KAAK,CAAC,GAAG,EAAEnB,SAAS,MAAM,EAAE,EAClD;QAER;QAEA,MAAM,IAAIoB,mBAAmB;YACzB,SAAS;QACb;IACJ;IAEQ,cAAsB;QAC1B,OAAO,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,gBAAgB,GAAG,EAAE;IAC1D;IAEQ,cAAkC;QACtC,MAAMC,WAAW,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,WAAW;QACvD,OAAO;YACH,IAAIA,SAAS,EAAE;YACf,MAAMA,SAAS,IAAI;YACnB,aAAaA,SAAS,WAAW,IAAI;QACzC;IACJ;AACJ;AAEO,MAAMC,8BAA8B,CACvC3B,SAEO,IAAID,0BAA0BC"}
|
package/context/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
3
|
-
import type { AuditLogsContext } from "../types.js";
|
|
4
|
-
export interface ISetupContextOptions {
|
|
5
|
-
deleteLogsAfterDays: number | undefined;
|
|
6
|
-
tableName: string | undefined;
|
|
7
|
-
documentClient: DynamoDBDocument | undefined;
|
|
8
|
-
}
|
|
9
|
-
export declare const createAuditLogsContext: (params?: ISetupContextOptions) => ContextPlugin<AuditLogsContext>;
|