@webiny/api-audit-logs 0.0.0-unstable.0156a4c312
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/LICENSE +21 -0
- package/README.md +11 -0
- package/abstractions.d.ts +15 -0
- package/abstractions.js +6 -0
- package/abstractions.js.map +1 -0
- package/config.d.ts +1 -0
- package/config.js +6 -0
- package/config.js.map +1 -0
- 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 -0
- package/index.js +2 -0
- package/package.json +57 -0
- 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 +61 -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 -0
- package/subscriptions/aco/index.js +11 -0
- package/subscriptions/aco/index.js.map +1 -0
- 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 -0
- package/subscriptions/fileManager/index.js +13 -0
- package/subscriptions/fileManager/index.js.map +1 -0
- 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 -0
- package/subscriptions/headlessCms/index.js +33 -0
- package/subscriptions/headlessCms/index.js.map +1 -0
- package/subscriptions/index.d.ts +2 -0
- package/subscriptions/index.js +19 -0
- package/subscriptions/index.js.map +1 -0
- 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 -0
- package/subscriptions/mailer/index.js +7 -0
- package/subscriptions/mailer/index.js.map +1 -0
- 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 -0
- package/subscriptions/security/index.js +29 -0
- package/subscriptions/security/index.js.map +1 -0
- package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.d.ts +21 -0
- package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.js +63 -0
- package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.js.map +1 -0
- package/subscriptions/websiteBuilder/index.d.ts +2 -0
- package/subscriptions/websiteBuilder/index.js +31 -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 +29 -0
- package/types.js +0 -0
- 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 +3 -0
- package/utils/getAuditObject.js +17 -0
- package/utils/getAuditObject.js.map +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { resolve, resolveList } from "@webiny/api-graphql";
|
|
2
|
+
import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
|
|
3
|
+
import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
|
|
4
|
+
import { createZodError } from "@webiny/utils";
|
|
5
|
+
import { GetAuditLogUseCase } from "../features/GetAuditLog/abstractions.js";
|
|
6
|
+
import { ListAuditLogsUseCase } from "../features/ListAuditLogs/abstractions.js";
|
|
7
|
+
import { getValidationSchema, listValidationSchema } from "./validation.js";
|
|
8
|
+
const TYPE_DEFS = `
|
|
9
|
+
type AuditLogCreatedBy {
|
|
10
|
+
id: ID!
|
|
11
|
+
displayName: String
|
|
12
|
+
type: String
|
|
13
|
+
}
|
|
14
|
+
type AuditLog {
|
|
15
|
+
id: ID!
|
|
16
|
+
createdBy: AuditLogCreatedBy!
|
|
17
|
+
createdOn: DateTime!
|
|
18
|
+
app: String!
|
|
19
|
+
action: String!
|
|
20
|
+
message: String!
|
|
21
|
+
entity: String!
|
|
22
|
+
entityId: String!
|
|
23
|
+
tags: [String!]!
|
|
24
|
+
expiresAt: DateTime!
|
|
25
|
+
content: String
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type AuditLogListMeta {
|
|
29
|
+
cursor: String
|
|
30
|
+
hasMoreItems: Boolean!
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type AuditLogError {
|
|
34
|
+
code: String
|
|
35
|
+
message: String!
|
|
36
|
+
data: JSON
|
|
37
|
+
stack: String
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type AuditLogListResponse {
|
|
41
|
+
data: [AuditLog!]
|
|
42
|
+
meta: AuditLogListMeta
|
|
43
|
+
error: AuditLogError
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type AuditLogGetResponse {
|
|
47
|
+
data: AuditLog
|
|
48
|
+
error: AuditLogError
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
enum AuditLogsSort {
|
|
52
|
+
ASC
|
|
53
|
+
DESC
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input ListAuditLogsWhere {
|
|
57
|
+
app: String
|
|
58
|
+
action: String
|
|
59
|
+
createdBy: String
|
|
60
|
+
entity: String
|
|
61
|
+
entityId: String
|
|
62
|
+
createdOn_gte: DateTime
|
|
63
|
+
createdOn_lte: DateTime
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type AuditLogsQuery {
|
|
67
|
+
getAuditLog(id: ID!): AuditLogGetResponse
|
|
68
|
+
listAuditLogs(
|
|
69
|
+
where: ListAuditLogsWhere
|
|
70
|
+
sort: AuditLogsSort
|
|
71
|
+
limit: Number
|
|
72
|
+
after: String
|
|
73
|
+
): AuditLogListResponse!
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
extend type Query {
|
|
77
|
+
auditLogs: AuditLogsQuery
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
class AuditLogsGraphQLSchemaImpl {
|
|
81
|
+
async execute(builder) {
|
|
82
|
+
builder.addTypeDefs(TYPE_DEFS);
|
|
83
|
+
builder.addResolver({
|
|
84
|
+
path: "Query.auditLogs",
|
|
85
|
+
dependencies: [],
|
|
86
|
+
resolver: ()=>()=>({})
|
|
87
|
+
});
|
|
88
|
+
builder.addResolver({
|
|
89
|
+
path: "AuditLogsQuery.getAuditLog",
|
|
90
|
+
dependencies: [
|
|
91
|
+
GetAuditLogUseCase
|
|
92
|
+
],
|
|
93
|
+
resolver (getAuditLog) {
|
|
94
|
+
return async ({ args })=>resolve(async ()=>{
|
|
95
|
+
const validation = await getValidationSchema.safeParseAsync(args);
|
|
96
|
+
if (!validation.success) throw createZodError(validation.error);
|
|
97
|
+
const result = await getAuditLog.execute(validation.data.id);
|
|
98
|
+
if (result.isFail()) throw result.error;
|
|
99
|
+
return result.value;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
builder.addResolver({
|
|
104
|
+
path: "AuditLogsQuery.listAuditLogs",
|
|
105
|
+
dependencies: [
|
|
106
|
+
ListAuditLogsUseCase
|
|
107
|
+
],
|
|
108
|
+
resolver (listAuditLogs) {
|
|
109
|
+
return async ({ args })=>resolveList(async ()=>{
|
|
110
|
+
const validation = await listValidationSchema.safeParseAsync(args);
|
|
111
|
+
if (!validation.success) throw createZodError(validation.error);
|
|
112
|
+
const result = await listAuditLogs.execute({
|
|
113
|
+
...validation.data,
|
|
114
|
+
...validation.data.where
|
|
115
|
+
});
|
|
116
|
+
if (result.isFail()) throw result.error;
|
|
117
|
+
return {
|
|
118
|
+
items: result.value.items,
|
|
119
|
+
meta: {
|
|
120
|
+
...result.value.meta,
|
|
121
|
+
totalCount: 0
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return builder;
|
|
128
|
+
}
|
|
129
|
+
constructor(){
|
|
130
|
+
this.getSchemaKey = staticSchemaKey("api-audit-logs/AuditLogsGraphQLSchemaImpl");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const AuditLogsGraphQLSchema = CoreGraphQLSchemaFactory.createImplementation({
|
|
134
|
+
implementation: AuditLogsGraphQLSchemaImpl,
|
|
135
|
+
dependencies: []
|
|
136
|
+
});
|
|
137
|
+
export { AuditLogsGraphQLSchema };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=AuditLogsGraphQLSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/AuditLogsGraphQLSchema.js","sources":["../../src/graphql/AuditLogsGraphQLSchema.ts"],"sourcesContent":["import { resolve } from \"@webiny/api-graphql\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { resolveList } from \"@webiny/api-graphql\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { GraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { createZodError } from \"@webiny/utils\";\nimport { GetAuditLogUseCase } from \"~/features/GetAuditLog/abstractions.js\";\nimport { ListAuditLogsUseCase } from \"~/features/ListAuditLogs/abstractions.js\";\nimport { getValidationSchema, listValidationSchema } from \"./validation.js\";\n\ninterface IListAuditLogsWhere {\n app?: string;\n action?: string;\n createdBy?: string;\n entity?: string;\n entityId?: string;\n createdOn_gte?: Date;\n createdOn_lte?: Date;\n}\n\ninterface IListAuditLogsArgs {\n where?: IListAuditLogsWhere;\n sort?: \"ASC\" | \"DESC\";\n limit?: number;\n after?: string;\n}\n\nconst TYPE_DEFS = /* GraphQL */ `\n type AuditLogCreatedBy {\n id: ID!\n displayName: String\n type: String\n }\n type AuditLog {\n id: ID!\n createdBy: AuditLogCreatedBy!\n createdOn: DateTime!\n app: String!\n action: String!\n message: String!\n entity: String!\n entityId: String!\n tags: [String!]!\n expiresAt: DateTime!\n content: String\n }\n\n type AuditLogListMeta {\n cursor: String\n hasMoreItems: Boolean!\n }\n\n type AuditLogError {\n code: String\n message: String!\n data: JSON\n stack: String\n }\n\n type AuditLogListResponse {\n data: [AuditLog!]\n meta: AuditLogListMeta\n error: AuditLogError\n }\n\n type AuditLogGetResponse {\n data: AuditLog\n error: AuditLogError\n }\n\n enum AuditLogsSort {\n ASC\n DESC\n }\n\n input ListAuditLogsWhere {\n app: String\n action: String\n createdBy: String\n entity: String\n entityId: String\n createdOn_gte: DateTime\n createdOn_lte: DateTime\n }\n\n type AuditLogsQuery {\n getAuditLog(id: ID!): AuditLogGetResponse\n listAuditLogs(\n where: ListAuditLogsWhere\n sort: AuditLogsSort\n limit: Number\n after: String\n ): AuditLogListResponse!\n }\n\n extend type Query {\n auditLogs: AuditLogsQuery\n }\n`;\n\nclass AuditLogsGraphQLSchemaImpl implements CoreGraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"api-audit-logs/AuditLogsGraphQLSchemaImpl\");\n\n public async execute(builder: GraphQLSchemaBuilder.Interface): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(TYPE_DEFS);\n\n builder.addResolver({\n path: \"Query.auditLogs\",\n dependencies: [],\n resolver: () => () => ({})\n });\n\n builder.addResolver<{ id: string }>({\n path: \"AuditLogsQuery.getAuditLog\",\n dependencies: [GetAuditLogUseCase],\n resolver(getAuditLog: GetAuditLogUseCase.Interface) {\n return async ({ args }) => {\n return resolve(async () => {\n const validation = await getValidationSchema.safeParseAsync(args);\n\n if (!validation.success) {\n throw createZodError(validation.error);\n }\n\n const result = await getAuditLog.execute(validation.data.id);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n };\n }\n });\n\n builder.addResolver<IListAuditLogsArgs>({\n path: \"AuditLogsQuery.listAuditLogs\",\n dependencies: [ListAuditLogsUseCase],\n resolver(listAuditLogs: ListAuditLogsUseCase.Interface) {\n return async ({ args }) => {\n return resolveList(async () => {\n const validation = await listValidationSchema.safeParseAsync(args);\n if (!validation.success) {\n throw createZodError(validation.error);\n }\n const result = await listAuditLogs.execute({\n ...validation.data,\n ...validation.data.where\n });\n if (result.isFail()) {\n throw result.error;\n }\n return {\n items: result.value.items,\n meta: {\n ...result.value.meta,\n totalCount: 0\n }\n };\n });\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const AuditLogsGraphQLSchema = CoreGraphQLSchemaFactory.createImplementation({\n implementation: AuditLogsGraphQLSchemaImpl,\n dependencies: []\n});\n"],"names":["TYPE_DEFS","AuditLogsGraphQLSchemaImpl","builder","GetAuditLogUseCase","getAuditLog","args","resolve","validation","getValidationSchema","createZodError","result","ListAuditLogsUseCase","listAuditLogs","resolveList","listValidationSchema","staticSchemaKey","AuditLogsGraphQLSchema","CoreGraphQLSchemaFactory"],"mappings":";;;;;;;AA2BA,MAAMA,YAA0B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEjC,CAAC;AAED,MAAMC;IAGF,MAAa,QAAQC,OAAuC,EAAmC;QAC3FA,QAAQ,WAAW,CAACF;QAEpBE,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc,EAAE;YAChB,UAAU,IAAM,IAAO,EAAC;QAC5B;QAEAA,QAAQ,WAAW,CAAiB;YAChC,MAAM;YACN,cAAc;gBAACC;aAAmB;YAClC,UAASC,WAAyC;gBAC9C,OAAO,OAAO,EAAEC,IAAI,EAAE,GACXC,QAAQ;wBACX,MAAMC,aAAa,MAAMC,oBAAoB,cAAc,CAACH;wBAE5D,IAAI,CAACE,WAAW,OAAO,EACnB,MAAME,eAAeF,WAAW,KAAK;wBAGzC,MAAMG,SAAS,MAAMN,YAAY,OAAO,CAACG,WAAW,IAAI,CAAC,EAAE;wBAC3D,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAOA,OAAO,KAAK;oBACvB;YAER;QACJ;QAEAR,QAAQ,WAAW,CAAqB;YACpC,MAAM;YACN,cAAc;gBAACS;aAAqB;YACpC,UAASC,aAA6C;gBAClD,OAAO,OAAO,EAAEP,IAAI,EAAE,GACXQ,YAAY;wBACf,MAAMN,aAAa,MAAMO,qBAAqB,cAAc,CAACT;wBAC7D,IAAI,CAACE,WAAW,OAAO,EACnB,MAAME,eAAeF,WAAW,KAAK;wBAEzC,MAAMG,SAAS,MAAME,cAAc,OAAO,CAAC;4BACvC,GAAGL,WAAW,IAAI;4BAClB,GAAGA,WAAW,IAAI,CAAC,KAAK;wBAC5B;wBACA,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAO;4BACH,OAAOA,OAAO,KAAK,CAAC,KAAK;4BACzB,MAAM;gCACF,GAAGA,OAAO,KAAK,CAAC,IAAI;gCACpB,YAAY;4BAChB;wBACJ;oBACJ;YAER;QACJ;QAEA,OAAOR;IACX;;aA/DO,YAAY,GAAGa,gBAAgB;;AAgE1C;AAEO,MAAMC,yBAAyBC,yBAAyB,oBAAoB,CAAC;IAChF,gBAAgBhB;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
export declare const getValidationSchema: zod.ZodObject<{
|
|
3
|
+
id: zod.ZodString;
|
|
4
|
+
}, zod.core.$strip>;
|
|
5
|
+
export declare const listValidationSchema: zod.ZodObject<{
|
|
6
|
+
where: zod.ZodObject<{
|
|
7
|
+
app: zod.ZodOptional<zod.ZodString>;
|
|
8
|
+
entity: zod.ZodOptional<zod.ZodString>;
|
|
9
|
+
entityId: zod.ZodOptional<zod.ZodString>;
|
|
10
|
+
createdOn_gte: zod.ZodPreprocess<zod.ZodOptional<zod.ZodDate>, unknown>;
|
|
11
|
+
createdOn_lte: zod.ZodPreprocess<zod.ZodOptional<zod.ZodDate>, unknown>;
|
|
12
|
+
createdBy: zod.ZodOptional<zod.ZodString>;
|
|
13
|
+
action: zod.ZodOptional<zod.ZodString>;
|
|
14
|
+
}, zod.core.$strip>;
|
|
15
|
+
after: zod.ZodOptional<zod.ZodString>;
|
|
16
|
+
sort: zod.ZodOptional<zod.ZodEnum<{
|
|
17
|
+
ASC: "ASC";
|
|
18
|
+
DESC: "DESC";
|
|
19
|
+
}>>;
|
|
20
|
+
limit: zod.ZodDefault<zod.ZodPreprocess<zod.ZodOptional<zod.ZodNumber>, unknown>>;
|
|
21
|
+
}, zod.core.$strip>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
const getValidationSchema = zod.object({
|
|
3
|
+
id: zod.string().min(1, "ID is required.")
|
|
4
|
+
});
|
|
5
|
+
const listValidationSchema = zod.object({
|
|
6
|
+
where: zod.object({
|
|
7
|
+
app: zod.string().min(1, "App is required.").optional(),
|
|
8
|
+
entity: zod.string().optional(),
|
|
9
|
+
entityId: zod.string().min(1, "Entity ID is required.").optional(),
|
|
10
|
+
createdOn_gte: zod.preprocess((input)=>{
|
|
11
|
+
if ("string" == typeof input || input instanceof Date) return new Date(input);
|
|
12
|
+
}, zod.date().optional()),
|
|
13
|
+
createdOn_lte: zod.preprocess((input)=>{
|
|
14
|
+
if ("string" == typeof input || input instanceof Date) return new Date(input);
|
|
15
|
+
}, zod.date().optional()),
|
|
16
|
+
createdBy: zod.string().optional(),
|
|
17
|
+
action: zod.string().optional()
|
|
18
|
+
}),
|
|
19
|
+
after: zod.string().optional(),
|
|
20
|
+
sort: zod["enum"]([
|
|
21
|
+
"ASC",
|
|
22
|
+
"DESC"
|
|
23
|
+
]).optional(),
|
|
24
|
+
limit: zod.preprocess((input)=>{
|
|
25
|
+
if ("string" == typeof input) return parseInt(input);
|
|
26
|
+
return input;
|
|
27
|
+
}, zod.number().min(1).max(100).optional()).default(25)
|
|
28
|
+
});
|
|
29
|
+
export { getValidationSchema, listValidationSchema };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql/validation.js","sources":["../../src/graphql/validation.ts"],"sourcesContent":["import zod from \"zod\";\n\nexport const getValidationSchema = zod.object({\n id: zod.string().min(1, \"ID is required.\")\n});\n\nexport const listValidationSchema = zod.object({\n where: zod.object({\n app: zod.string().min(1, \"App is required.\").optional(),\n entity: zod.string().optional(),\n entityId: zod.string().min(1, \"Entity ID is required.\").optional(),\n createdOn_gte: zod.preprocess(input => {\n if (typeof input == \"string\" || input instanceof Date) {\n return new Date(input);\n }\n return undefined;\n }, zod.date().optional()),\n createdOn_lte: zod.preprocess(input => {\n if (typeof input == \"string\" || input instanceof Date) {\n return new Date(input);\n }\n return undefined;\n }, zod.date().optional()),\n createdBy: zod.string().optional(),\n action: zod.string().optional()\n }),\n after: zod.string().optional(),\n sort: zod.enum([\"ASC\", \"DESC\"]).optional(),\n limit: zod\n .preprocess(input => {\n if (typeof input == \"string\") {\n return parseInt(input);\n }\n return input;\n }, zod.number().min(1).max(100).optional())\n .default(25)\n});\n"],"names":["getValidationSchema","zod","listValidationSchema","input","Date","parseInt"],"mappings":";AAEO,MAAMA,sBAAsBC,IAAI,MAAM,CAAC;IAC1C,IAAIA,IAAI,MAAM,GAAG,GAAG,CAAC,GAAG;AAC5B;AAEO,MAAMC,uBAAuBD,IAAI,MAAM,CAAC;IAC3C,OAAOA,IAAI,MAAM,CAAC;QACd,KAAKA,IAAI,MAAM,GAAG,GAAG,CAAC,GAAG,oBAAoB,QAAQ;QACrD,QAAQA,IAAI,MAAM,GAAG,QAAQ;QAC7B,UAAUA,IAAI,MAAM,GAAG,GAAG,CAAC,GAAG,0BAA0B,QAAQ;QAChE,eAAeA,IAAI,UAAU,CAACE,CAAAA;YAC1B,IAAI,AAAgB,YAAhB,OAAOA,SAAqBA,iBAAiBC,MAC7C,OAAO,IAAIA,KAAKD;QAGxB,GAAGF,IAAI,IAAI,GAAG,QAAQ;QACtB,eAAeA,IAAI,UAAU,CAACE,CAAAA;YAC1B,IAAI,AAAgB,YAAhB,OAAOA,SAAqBA,iBAAiBC,MAC7C,OAAO,IAAIA,KAAKD;QAGxB,GAAGF,IAAI,IAAI,GAAG,QAAQ;QACtB,WAAWA,IAAI,MAAM,GAAG,QAAQ;QAChC,QAAQA,IAAI,MAAM,GAAG,QAAQ;IACjC;IACA,OAAOA,IAAI,MAAM,GAAG,QAAQ;IAC5B,MAAMA,GAAG,CAAHA,OAAQ,CAAC;QAAC;QAAO;KAAO,EAAE,QAAQ;IACxC,OAAOA,IAAAA,UACQ,CAACE,CAAAA;QACR,IAAI,AAAgB,YAAhB,OAAOA,OACP,OAAOE,SAASF;QAEpB,OAAOA;IACX,GAAGF,IAAI,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,QAAQ,IACvC,OAAO,CAAC;AACjB"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/api-audit-logs",
|
|
3
|
+
"version": "0.0.0-unstable.0156a4c312",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": "./index.js",
|
|
6
|
+
"./*": "./*"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/webiny/webiny-js.git",
|
|
12
|
+
"directory": "packages/api-audit-logs"
|
|
13
|
+
},
|
|
14
|
+
"description": "The API for the Audit Logs (app-audit-logs) app.",
|
|
15
|
+
"author": "Webiny Ltd.",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "node ../cli/bin.js run build",
|
|
19
|
+
"watch": "node ../cli/bin.js run watch"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@webiny/api-core-testing": "0.0.0-unstable.0156a4c312",
|
|
26
|
+
"@webiny/api-headless-cms-testing": "0.0.0-unstable.0156a4c312",
|
|
27
|
+
"@webiny/api-websockets": "0.0.0-unstable.0156a4c312",
|
|
28
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.0156a4c312",
|
|
29
|
+
"@webiny/di": "2.0.0",
|
|
30
|
+
"@webiny/event-handler-core": "0.0.0-unstable.0156a4c312",
|
|
31
|
+
"@webiny/handler": "0.0.0-unstable.0156a4c312",
|
|
32
|
+
"@webiny/plugins": "0.0.0-unstable.0156a4c312",
|
|
33
|
+
"graphql": "16.14.2",
|
|
34
|
+
"typescript": "7.0.2",
|
|
35
|
+
"vitest": "5.0.5"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@webiny/api": "0.0.0-unstable.0156a4c312",
|
|
39
|
+
"@webiny/api-aco": "0.0.0-unstable.0156a4c312",
|
|
40
|
+
"@webiny/api-core": "0.0.0-unstable.0156a4c312",
|
|
41
|
+
"@webiny/api-file-manager": "0.0.0-unstable.0156a4c312",
|
|
42
|
+
"@webiny/api-graphql": "0.0.0-unstable.0156a4c312",
|
|
43
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.0156a4c312",
|
|
44
|
+
"@webiny/api-mailer": "0.0.0-unstable.0156a4c312",
|
|
45
|
+
"@webiny/api-website-builder": "0.0.0-unstable.0156a4c312",
|
|
46
|
+
"@webiny/build-tools": "0.0.0-unstable.0156a4c312",
|
|
47
|
+
"@webiny/common-audit-logs": "0.0.0-unstable.0156a4c312",
|
|
48
|
+
"@webiny/error": "0.0.0-unstable.0156a4c312",
|
|
49
|
+
"@webiny/feature": "0.0.0-unstable.0156a4c312",
|
|
50
|
+
"@webiny/utils": "0.0.0-unstable.0156a4c312",
|
|
51
|
+
"@webiny/wcp": "0.0.0-unstable.0156a4c312",
|
|
52
|
+
"zod": "4.6.7"
|
|
53
|
+
},
|
|
54
|
+
"webiny": {
|
|
55
|
+
"publishFrom": "dist"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { IAuditLog } from "../../storage/types.js";
|
|
2
|
+
export interface IStorageFetchParams {
|
|
3
|
+
id: string;
|
|
4
|
+
tenant: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IStorageFetchErrorResult {
|
|
7
|
+
error: Error;
|
|
8
|
+
data?: never;
|
|
9
|
+
success: false;
|
|
10
|
+
}
|
|
11
|
+
export interface IStorageFetchSuccessResult {
|
|
12
|
+
data: IAuditLog;
|
|
13
|
+
success: true;
|
|
14
|
+
error?: never;
|
|
15
|
+
}
|
|
16
|
+
export type IStorageFetchResult = IStorageFetchErrorResult | IStorageFetchSuccessResult;
|
|
17
|
+
export interface IStorageStoreParams {
|
|
18
|
+
data: IAuditLog;
|
|
19
|
+
}
|
|
20
|
+
export interface IStorageStoreErrorResult {
|
|
21
|
+
error: Error;
|
|
22
|
+
data?: never;
|
|
23
|
+
success: false;
|
|
24
|
+
}
|
|
25
|
+
export interface IStorageStoreSuccessResult {
|
|
26
|
+
data: IAuditLog;
|
|
27
|
+
success: true;
|
|
28
|
+
error?: never;
|
|
29
|
+
}
|
|
30
|
+
export type IStorageStoreResult = IStorageStoreErrorResult | IStorageStoreSuccessResult;
|
|
31
|
+
export interface IStorageListDefaultParams {
|
|
32
|
+
tenant: string;
|
|
33
|
+
sort?: "ASC" | "DESC";
|
|
34
|
+
after?: string;
|
|
35
|
+
limit: number | undefined;
|
|
36
|
+
app?: never;
|
|
37
|
+
createdBy?: never;
|
|
38
|
+
action?: never;
|
|
39
|
+
entityId?: never;
|
|
40
|
+
}
|
|
41
|
+
export interface IStorageListByAppParams {
|
|
42
|
+
tenant: string;
|
|
43
|
+
app: string;
|
|
44
|
+
after?: string;
|
|
45
|
+
sort?: "ASC" | "DESC";
|
|
46
|
+
createdOn_gte?: Date;
|
|
47
|
+
createdOn_lte?: Date;
|
|
48
|
+
limit: number | undefined;
|
|
49
|
+
entity?: never;
|
|
50
|
+
createdBy?: never;
|
|
51
|
+
action?: never;
|
|
52
|
+
entityId?: never;
|
|
53
|
+
}
|
|
54
|
+
export interface IStorageListByAppCreatedByParams extends Omit<IStorageListByAppParams, "createdBy"> {
|
|
55
|
+
createdBy: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IStorageListByAppEntityParams extends Omit<IStorageListByAppParams, "entity"> {
|
|
58
|
+
entity: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IStorageListByEntityIdParams extends Omit<IStorageListByAppParams, "entityId"> {
|
|
61
|
+
entityId: string;
|
|
62
|
+
}
|
|
63
|
+
export interface IStorageListByActionParams extends Omit<IStorageListByAppParams, "action"> {
|
|
64
|
+
action: string;
|
|
65
|
+
}
|
|
66
|
+
export interface IStorageListByAppEntityActionCreatedByParams extends Omit<IStorageListByAppParams, "action" | "entity" | "createdBy"> {
|
|
67
|
+
createdBy: string;
|
|
68
|
+
entity: string;
|
|
69
|
+
action: string;
|
|
70
|
+
}
|
|
71
|
+
export interface IStorageListByAppEntityActionParams extends Omit<IStorageListByAppParams, "entity" | "action"> {
|
|
72
|
+
entity: string;
|
|
73
|
+
action: string;
|
|
74
|
+
}
|
|
75
|
+
export interface IStorageListByAppEntityCreatedByParams extends Omit<IStorageListByAppParams, "createdBy" | "entity"> {
|
|
76
|
+
createdBy: string;
|
|
77
|
+
entity: string;
|
|
78
|
+
}
|
|
79
|
+
export interface IStorageListByCreatedByParams extends Omit<IStorageListByAppParams, "createdBy"> {
|
|
80
|
+
createdBy: string;
|
|
81
|
+
}
|
|
82
|
+
export interface IStorageListByCreatedOnParams extends IStorageListByAppParams {
|
|
83
|
+
createdOn_gte?: Date;
|
|
84
|
+
createdOn_lte?: Date;
|
|
85
|
+
}
|
|
86
|
+
export type IStorageListParams = IStorageListByAppParams | IStorageListByAppCreatedByParams | IStorageListByAppEntityParams | IStorageListByEntityIdParams | IStorageListByActionParams | IStorageListByAppEntityActionCreatedByParams | IStorageListByAppEntityActionParams | IStorageListByAppEntityCreatedByParams | IStorageListByCreatedByParams | IStorageListByCreatedOnParams;
|
|
87
|
+
export interface IStorageListSuccessResultMeta {
|
|
88
|
+
after?: string;
|
|
89
|
+
hasMoreItems: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface IStorageListSuccessResult {
|
|
92
|
+
data: IAuditLog[];
|
|
93
|
+
meta: IStorageListSuccessResultMeta;
|
|
94
|
+
success: true;
|
|
95
|
+
error?: never;
|
|
96
|
+
}
|
|
97
|
+
export interface IStorageListErrorResult {
|
|
98
|
+
error: Error;
|
|
99
|
+
data?: never;
|
|
100
|
+
meta?: never;
|
|
101
|
+
success: false;
|
|
102
|
+
}
|
|
103
|
+
export type IStorageListResult = IStorageListErrorResult | IStorageListSuccessResult;
|
|
104
|
+
export interface IStorage {
|
|
105
|
+
fetch(params: IStorageFetchParams): Promise<IStorageFetchResult>;
|
|
106
|
+
store(params: IStorageStoreParams): Promise<IStorageStoreResult>;
|
|
107
|
+
list(params: IStorageListParams): Promise<IStorageListResult>;
|
|
108
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IAuditLogCreatedBy {
|
|
2
|
+
id: string;
|
|
3
|
+
type: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IAuditLog {
|
|
7
|
+
id: string;
|
|
8
|
+
tenant: string;
|
|
9
|
+
createdBy: IAuditLogCreatedBy;
|
|
10
|
+
createdOn: Date;
|
|
11
|
+
app: string;
|
|
12
|
+
action: string;
|
|
13
|
+
message: string;
|
|
14
|
+
entity: string;
|
|
15
|
+
entityId: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
expiresAt: Date;
|
|
18
|
+
content: string;
|
|
19
|
+
}
|
package/storage/types.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FolderAfterCreateEventHandler } from "@webiny/api-aco/features/folder/CreateFolder/index.js";
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
|
+
declare class AuditLogFolderAfterCreateHandlerImpl implements FolderAfterCreateEventHandler.Interface {
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
|
+
handle(event: FolderAfterCreateEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuditLogFolderAfterCreateHandler: typeof AuditLogFolderAfterCreateHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-aco/features/folder/CreateFolder/abstractions").FolderAfterCreatePayload>>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { FolderAfterCreateEventHandler } from "@webiny/api-aco/features/folder/CreateFolder/index.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
4
|
+
import { AUDIT } from "../../../config.js";
|
|
5
|
+
class AuditLogFolderAfterCreateHandlerImpl {
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
try {
|
|
11
|
+
const { folder } = event.payload;
|
|
12
|
+
if ("FmFile" === folder.type) {
|
|
13
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
14
|
+
audit: AUDIT.FILE_MANAGER.FILE_FOLDER.CREATE,
|
|
15
|
+
message: "Folder created",
|
|
16
|
+
content: folder,
|
|
17
|
+
entityId: folder.id
|
|
18
|
+
});
|
|
19
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
20
|
+
} else if (folder.type.startsWith("cms:")) {
|
|
21
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
22
|
+
audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.CREATE,
|
|
23
|
+
message: "Folder created",
|
|
24
|
+
content: folder,
|
|
25
|
+
entityId: folder.id
|
|
26
|
+
});
|
|
27
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
throw _webiny_error.from(error, {
|
|
31
|
+
message: "Error while executing AuditLogFolderAfterCreateHandler",
|
|
32
|
+
code: "AUDIT_LOGS_AFTER_FOLDER_CREATE_HANDLER"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const AuditLogFolderAfterCreateHandler = FolderAfterCreateEventHandler.createImplementation({
|
|
38
|
+
implementation: AuditLogFolderAfterCreateHandlerImpl,
|
|
39
|
+
dependencies: [
|
|
40
|
+
RecordAuditLogUseCase
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
export { AuditLogFolderAfterCreateHandler };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=AuditLogFolderAfterCreateHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js","sources":["../../../../src/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { FolderAfterCreateEventHandler } from \"@webiny/api-aco/features/folder/CreateFolder/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogFolderAfterCreateHandlerImpl implements FolderAfterCreateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: FolderAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { folder } = event.payload;\n if (folder.type === \"FmFile\") {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.FILE_MANAGER.FILE_FOLDER.CREATE,\n message: \"Folder created\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } else if (folder.type.startsWith(\"cms:\")) {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.CREATE,\n message: \"Folder created\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogFolderAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_FOLDER_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogFolderAfterCreateHandler = FolderAfterCreateEventHandler.createImplementation({\n implementation: AuditLogFolderAfterCreateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogFolderAfterCreateHandlerImpl","recordAuditLog","event","folder","recordResult","AUDIT","error","WebinyError","AuditLogFolderAfterCreateHandler","FolderAfterCreateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;YAChC,IAAIC,AAAgB,aAAhBA,OAAO,IAAI,EAAe;gBAC1B,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,WAAW,CAAC,MAAM;oBAC5C,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC,OAAO,IAAID,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS;gBACvC,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,YAAY,CAAC,MAAM;oBAC7C,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC;QACJ,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FolderAfterDeleteEventHandler } from "@webiny/api-aco/features/folder/DeleteFolder/index.js";
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
|
+
declare class AuditLogFolderAfterDeleteHandlerImpl implements FolderAfterDeleteEventHandler.Interface {
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
|
+
handle(event: FolderAfterDeleteEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuditLogFolderAfterDeleteHandler: typeof AuditLogFolderAfterDeleteHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-aco/features/folder/DeleteFolder/abstractions").FolderAfterDeletePayload>>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { FolderAfterDeleteEventHandler } from "@webiny/api-aco/features/folder/DeleteFolder/index.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
4
|
+
import { AUDIT } from "../../../config.js";
|
|
5
|
+
class AuditLogFolderAfterDeleteHandlerImpl {
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
try {
|
|
11
|
+
const { folder } = event.payload;
|
|
12
|
+
if ("FmFile" === folder.type) {
|
|
13
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
14
|
+
audit: AUDIT.FILE_MANAGER.FILE_FOLDER.DELETE,
|
|
15
|
+
message: "Folder deleted",
|
|
16
|
+
content: folder,
|
|
17
|
+
entityId: folder.id
|
|
18
|
+
});
|
|
19
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
20
|
+
} else if (folder.type.startsWith("cms:")) {
|
|
21
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
22
|
+
audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.DELETE,
|
|
23
|
+
message: "Folder deleted",
|
|
24
|
+
content: folder,
|
|
25
|
+
entityId: folder.id
|
|
26
|
+
});
|
|
27
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
28
|
+
} else if ("wb:page" === folder.type) {
|
|
29
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
30
|
+
audit: AUDIT.WEBSITE_BUILDER.PAGE_FOLDER.DELETE,
|
|
31
|
+
message: "Folder deleted",
|
|
32
|
+
content: folder,
|
|
33
|
+
entityId: folder.id
|
|
34
|
+
});
|
|
35
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
36
|
+
} else if ("wb:redirect" === folder.type) {
|
|
37
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
38
|
+
audit: AUDIT.WEBSITE_BUILDER.REDIRECT_FOLDER.DELETE,
|
|
39
|
+
message: "Folder deleted",
|
|
40
|
+
content: folder,
|
|
41
|
+
entityId: folder.id
|
|
42
|
+
});
|
|
43
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw _webiny_error.from(error, {
|
|
47
|
+
message: "Error while executing AuditLogFolderAfterDeleteHandler",
|
|
48
|
+
code: "AUDIT_LOGS_AFTER_FOLDER_DELETE_HANDLER"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const AuditLogFolderAfterDeleteHandler = FolderAfterDeleteEventHandler.createImplementation({
|
|
54
|
+
implementation: AuditLogFolderAfterDeleteHandlerImpl,
|
|
55
|
+
dependencies: [
|
|
56
|
+
RecordAuditLogUseCase
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
export { AuditLogFolderAfterDeleteHandler };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=AuditLogFolderAfterDeleteHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js","sources":["../../../../src/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { FolderAfterDeleteEventHandler } from \"@webiny/api-aco/features/folder/DeleteFolder/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogFolderAfterDeleteHandlerImpl implements FolderAfterDeleteEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: FolderAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { folder } = event.payload;\n if (folder.type === \"FmFile\") {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.FILE_MANAGER.FILE_FOLDER.DELETE,\n message: \"Folder deleted\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } else if (folder.type.startsWith(\"cms:\")) {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.DELETE,\n message: \"Folder deleted\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } else if (folder.type === \"wb:page\") {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.PAGE_FOLDER.DELETE,\n message: \"Folder deleted\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } else if (folder.type === \"wb:redirect\") {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.WEBSITE_BUILDER.REDIRECT_FOLDER.DELETE,\n message: \"Folder deleted\",\n content: folder,\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogFolderAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_FOLDER_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogFolderAfterDeleteHandler = FolderAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogFolderAfterDeleteHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogFolderAfterDeleteHandlerImpl","recordAuditLog","event","folder","recordResult","AUDIT","error","WebinyError","AuditLogFolderAfterDeleteHandler","FolderAfterDeleteEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;YAChC,IAAIC,AAAgB,aAAhBA,OAAO,IAAI,EAAe;gBAC1B,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,WAAW,CAAC,MAAM;oBAC5C,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC,OAAO,IAAID,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS;gBACvC,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,YAAY,CAAC,MAAM;oBAC7C,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC,OAAO,IAAID,AAAgB,cAAhBA,OAAO,IAAI,EAAgB;gBAClC,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,eAAe,CAAC,WAAW,CAAC,MAAM;oBAC/C,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC,OAAO,IAAID,AAAgB,kBAAhBA,OAAO,IAAI,EAAoB;gBACtC,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,eAAe,CAAC,eAAe,CAAC,MAAM;oBACnD,SAAS;oBACT,SAASF;oBACT,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC;QACJ,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FolderAfterUpdateEventHandler } from "@webiny/api-aco/features/folder/UpdateFolder/index.js";
|
|
2
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
3
|
+
declare class AuditLogFolderAfterUpdateHandlerImpl implements FolderAfterUpdateEventHandler.Interface {
|
|
4
|
+
private recordAuditLog;
|
|
5
|
+
constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
|
|
6
|
+
handle(event: FolderAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuditLogFolderAfterUpdateHandler: typeof AuditLogFolderAfterUpdateHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-aco/features/folder/UpdateFolder/abstractions").FolderAfterUpdatePayload>>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { FolderAfterUpdateEventHandler } from "@webiny/api-aco/features/folder/UpdateFolder/index.js";
|
|
3
|
+
import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
|
|
4
|
+
import { AUDIT } from "../../../config.js";
|
|
5
|
+
class AuditLogFolderAfterUpdateHandlerImpl {
|
|
6
|
+
constructor(recordAuditLog){
|
|
7
|
+
this.recordAuditLog = recordAuditLog;
|
|
8
|
+
}
|
|
9
|
+
async handle(event) {
|
|
10
|
+
try {
|
|
11
|
+
const { folder, original } = event.payload;
|
|
12
|
+
if ("FmFile" === folder.type) {
|
|
13
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
14
|
+
audit: AUDIT.FILE_MANAGER.FILE_FOLDER.UPDATE,
|
|
15
|
+
message: "Folder updated",
|
|
16
|
+
content: {
|
|
17
|
+
before: original,
|
|
18
|
+
after: folder
|
|
19
|
+
},
|
|
20
|
+
entityId: folder.id
|
|
21
|
+
});
|
|
22
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
23
|
+
} else if (folder.type.startsWith("cms:")) {
|
|
24
|
+
const recordResult = await this.recordAuditLog.execute({
|
|
25
|
+
audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.UPDATE,
|
|
26
|
+
message: "Folder updated",
|
|
27
|
+
content: {
|
|
28
|
+
before: original,
|
|
29
|
+
after: folder
|
|
30
|
+
},
|
|
31
|
+
entityId: folder.id
|
|
32
|
+
});
|
|
33
|
+
if (recordResult.isFail()) throw recordResult.error;
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
throw _webiny_error.from(error, {
|
|
37
|
+
message: "Error while executing AuditLogFolderAfterUpdateHandler",
|
|
38
|
+
code: "AUDIT_LOGS_AFTER_FOLDER_UPDATE_HANDLER"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const AuditLogFolderAfterUpdateHandler = FolderAfterUpdateEventHandler.createImplementation({
|
|
44
|
+
implementation: AuditLogFolderAfterUpdateHandlerImpl,
|
|
45
|
+
dependencies: [
|
|
46
|
+
RecordAuditLogUseCase
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
export { AuditLogFolderAfterUpdateHandler };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=AuditLogFolderAfterUpdateHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js","sources":["../../../../src/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { FolderAfterUpdateEventHandler } from \"@webiny/api-aco/features/folder/UpdateFolder/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogFolderAfterUpdateHandlerImpl implements FolderAfterUpdateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: FolderAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { folder, original } = event.payload;\n if (folder.type === \"FmFile\") {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.FILE_MANAGER.FILE_FOLDER.UPDATE,\n message: \"Folder updated\",\n content: { before: original, after: folder },\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } else if (folder.type.startsWith(\"cms:\")) {\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.HEADLESS_CMS.MODEL_FOLDER.UPDATE,\n message: \"Folder updated\",\n content: { before: original, after: folder },\n entityId: folder.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogFolderAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_FOLDER_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogFolderAfterUpdateHandler = FolderAfterUpdateEventHandler.createImplementation({\n implementation: AuditLogFolderAfterUpdateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogFolderAfterUpdateHandlerImpl","recordAuditLog","event","folder","original","recordResult","AUDIT","error","WebinyError","AuditLogFolderAfterUpdateHandler","FolderAfterUpdateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAEC,MAAM,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;YAC1C,IAAIC,AAAgB,aAAhBA,OAAO,IAAI,EAAe;gBAC1B,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,WAAW,CAAC,MAAM;oBAC5C,SAAS;oBACT,SAAS;wBAAE,QAAQF;wBAAU,OAAOD;oBAAO;oBAC3C,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIE,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC,OAAO,IAAIF,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS;gBACvC,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACnD,OAAOC,MAAM,YAAY,CAAC,YAAY,CAAC,MAAM;oBAC7C,SAAS;oBACT,SAAS;wBAAE,QAAQF;wBAAU,OAAOD;oBAAO;oBAC3C,UAAUA,OAAO,EAAE;gBACvB;gBACA,IAAIE,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;YAEhC;QACJ,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBV;IAChB,cAAc;QAACW;KAAsB;AACzC"}
|