@webiny/api-audit-logs 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AuditLogsFeature.d.ts +8 -0
- package/AuditLogsFeature.js +32 -0
- package/AuditLogsFeature.js.map +1 -0
- package/abstractions.d.ts +14 -4
- package/abstractions.js +3 -3
- package/abstractions.js.map +1 -1
- package/config.js +2 -1
- package/config.js.map +1 -1
- package/domain/errors.d.ts +5 -0
- package/domain/errors.js +11 -0
- package/domain/errors.js.map +1 -0
- package/events/AuditLogAfterCreateEvent.d.ts +2 -2
- package/events/AuditLogAfterCreateEvent.js +9 -6
- package/events/AuditLogAfterCreateEvent.js.map +1 -1
- package/events/AuditLogAfterUpdateEvent.d.ts +2 -2
- package/events/AuditLogAfterUpdateEvent.js +9 -6
- package/events/AuditLogAfterUpdateEvent.js.map +1 -1
- package/events/AuditLogBeforeCreateEvent.d.ts +2 -2
- package/events/AuditLogBeforeCreateEvent.js +9 -6
- package/events/AuditLogBeforeCreateEvent.js.map +1 -1
- package/events/AuditLogBeforeUpdateEvent.d.ts +2 -2
- package/events/AuditLogBeforeUpdateEvent.js +9 -6
- package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
- package/events/abstractions.d.ts +1 -6
- package/events/abstractions.js +5 -24
- package/events/abstractions.js.map +1 -1
- package/events/index.js +0 -2
- package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
- package/features/AuditLogPermissions/abstractions.d.ts +11 -0
- package/features/AuditLogPermissions/abstractions.js +5 -0
- package/features/AuditLogPermissions/abstractions.js.map +1 -0
- package/features/AuditLogPermissions/feature.d.ts +4 -0
- package/features/AuditLogPermissions/feature.js +11 -0
- package/features/AuditLogPermissions/feature.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
- package/features/CreateAuditLog/abstractions.d.ts +42 -0
- package/features/CreateAuditLog/abstractions.js +7 -0
- package/features/CreateAuditLog/abstractions.js.map +1 -0
- package/features/CreateAuditLog/feature.d.ts +4 -0
- package/features/CreateAuditLog/feature.js +15 -0
- package/features/CreateAuditLog/feature.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
- package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
- package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
- package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
- package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
- package/features/GetAuditLog/GetAuditLogUseCase.js +32 -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 +104 -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 +10 -53
- package/graphql/validation.js +26 -30
- package/graphql/validation.js.map +1 -1
- package/index.d.ts +2 -8
- package/index.js +1 -22
- package/package.json +34 -30
- package/storage/abstractions/Storage.js +0 -3
- package/storage/types.d.ts +0 -35
- package/storage/types.js +0 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +7 -7
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +38 -28
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +54 -31
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +44 -35
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
- package/subscriptions/aco/index.d.ts +2 -2
- package/subscriptions/aco/index.js +5 -4
- package/subscriptions/aco/index.js.map +1 -1
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +45 -0
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +42 -0
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +44 -0
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
- package/subscriptions/ai/index.d.ts +2 -0
- package/subscriptions/ai/index.js +11 -0
- package/subscriptions/ai/index.js.map +1 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +7 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +28 -23
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +28 -23
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +31 -27
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +31 -27
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +6 -8
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +37 -31
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +30 -29
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +27 -25
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +30 -26
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +27 -22
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +4 -4
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +30 -26
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/index.d.ts +2 -2
- package/subscriptions/headlessCms/index.js +16 -20
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +10 -7
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +7 -7
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +33 -25
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +3 -3
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +38 -40
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +38 -40
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +42 -45
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +31 -27
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +31 -27
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +28 -23
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +31 -27
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
- package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +14 -20
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/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 -2
- package/subscriptions/websiteBuilder/index.js +16 -16
- package/subscriptions/websiteBuilder/index.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +30 -26
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +27 -22
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +30 -26
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +27 -22
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +27 -22
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +27 -22
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +7 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +30 -26
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
- package/types.d.ts +0 -23
- package/types.js +0 -3
- package/utils/expiresAt.js +14 -19
- package/utils/expiresAt.js.map +1 -1
- package/utils/getAuditObject.js +14 -15
- package/utils/getAuditObject.js.map +1 -1
- package/context/AuditLogsContextValue.d.ts +0 -10
- package/context/AuditLogsContextValue.js +0 -139
- package/context/AuditLogsContextValue.js.map +0 -1
- package/context/index.d.ts +0 -9
- package/context/index.js +0 -35
- package/context/index.js.map +0 -1
- package/events/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -3
- package/graphql/schema.js +0 -126
- package/graphql/schema.js.map +0 -1
- package/index.js.map +0 -1
- package/storage/AccessPatternHandler.d.ts +0 -14
- package/storage/AccessPatternHandler.js +0 -60
- package/storage/AccessPatternHandler.js.map +0 -1
- package/storage/Converter.d.ts +0 -16
- package/storage/Converter.js +0 -52
- package/storage/Converter.js.map +0 -1
- package/storage/Storage.d.ts +0 -18
- package/storage/Storage.js +0 -89
- package/storage/Storage.js.map +0 -1
- package/storage/abstractions/AccessPattern.d.ts +0 -24
- package/storage/abstractions/AccessPattern.js +0 -3
- package/storage/abstractions/AccessPattern.js.map +0 -1
- package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
- package/storage/abstractions/AccessPatternHandler.js +0 -3
- package/storage/abstractions/AccessPatternHandler.js.map +0 -1
- package/storage/abstractions/Converter.d.ts +0 -6
- package/storage/abstractions/Converter.js +0 -3
- package/storage/abstractions/Converter.js.map +0 -1
- package/storage/abstractions/Storage.js.map +0 -1
- package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppAccessPattern.js +0 -29
- package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityAccessPattern.js +0 -29
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -29
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
- package/storage/accessPatterns/BaseAccessPattern.js +0 -82
- package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedByAccessPattern.js +0 -32
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -30
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
- package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
- package/storage/accessPatterns/DefaultAccessPattern.js +0 -36
- package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
- package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/EntityIdAccessPattern.js +0 -33
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
- package/storage/accessPatterns/index.d.ts +0 -6
- package/storage/accessPatterns/index.js +0 -47
- package/storage/accessPatterns/index.js.map +0 -1
- package/storage/cursorSchema.d.ts +0 -4
- package/storage/cursorSchema.js +0 -25
- package/storage/cursorSchema.js.map +0 -1
- package/storage/entity.d.ts +0 -36
- package/storage/entity.js +0 -127
- package/storage/entity.js.map +0 -1
- package/storage/results/ListErrorResult.d.ts +0 -10
- package/storage/results/ListErrorResult.js +0 -11
- package/storage/results/ListErrorResult.js.map +0 -1
- package/storage/results/ListSuccessResult.d.ts +0 -14
- package/storage/results/ListSuccessResult.js +0 -16
- package/storage/results/ListSuccessResult.js.map +0 -1
- package/storage/results/index.d.ts +0 -2
- package/storage/results/index.js +0 -4
- package/storage/results/index.js.map +0 -1
- package/storage/startKey.d.ts +0 -6
- package/storage/startKey.js +0 -9
- package/storage/startKey.js.map +0 -1
- package/storage/types.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/getAuditConfig.d.ts +0 -4
- package/utils/getAuditConfig.js +0 -105
- package/utils/getAuditConfig.js.map +0 -1
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { DefaultAccessPattern } from "./DefaultAccessPattern.js";
|
|
2
|
-
import { AppAccessPattern } from "./AppAccessPattern.js";
|
|
3
|
-
import { AppCreatedByAccessPattern } from "./AppCreatedByAccessPattern.js";
|
|
4
|
-
import { AppEntityActionCreatedByAccessPattern } from "./AppEntityActionCreatedByAccessPattern.js";
|
|
5
|
-
import { AppEntityCreatedByAccessPattern } from "./AppEntityCreatedByAccessPattern.js";
|
|
6
|
-
import { AppEntityAccessPattern } from "./AppEntityAccessPattern.js";
|
|
7
|
-
import { AppEntityActionAccessPattern } from "./AppEntityActionAccessPattern.js";
|
|
8
|
-
import { EntityIdGlobalAccessPattern } from "./EntityIdAccessPattern.js";
|
|
9
|
-
import { CreatedByAccessPattern } from "./CreatedByAccessPattern.js";
|
|
10
|
-
import { CreatedOnAccessPattern } from "./CreatedOnAccessPattern.js";
|
|
11
|
-
export const createAccessPatterns = params => {
|
|
12
|
-
const {
|
|
13
|
-
entity
|
|
14
|
-
} = params;
|
|
15
|
-
return [new DefaultAccessPattern({
|
|
16
|
-
entity
|
|
17
|
-
}), new AppAccessPattern({
|
|
18
|
-
entity,
|
|
19
|
-
index: "GSI1"
|
|
20
|
-
}), new AppCreatedByAccessPattern({
|
|
21
|
-
entity,
|
|
22
|
-
index: "GSI2"
|
|
23
|
-
}), new AppEntityAccessPattern({
|
|
24
|
-
entity,
|
|
25
|
-
index: "GSI3"
|
|
26
|
-
}), new EntityIdGlobalAccessPattern({
|
|
27
|
-
entity,
|
|
28
|
-
index: "GSI4"
|
|
29
|
-
}), new AppEntityActionCreatedByAccessPattern({
|
|
30
|
-
entity,
|
|
31
|
-
index: "GSI5"
|
|
32
|
-
}), new AppEntityActionAccessPattern({
|
|
33
|
-
entity,
|
|
34
|
-
index: "GSI6"
|
|
35
|
-
}), new AppEntityCreatedByAccessPattern({
|
|
36
|
-
entity,
|
|
37
|
-
index: "GSI7"
|
|
38
|
-
}), new CreatedByAccessPattern({
|
|
39
|
-
entity,
|
|
40
|
-
index: "GSI8"
|
|
41
|
-
}), new CreatedOnAccessPattern({
|
|
42
|
-
entity,
|
|
43
|
-
index: "GSI9"
|
|
44
|
-
})];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultAccessPattern","AppAccessPattern","AppCreatedByAccessPattern","AppEntityActionCreatedByAccessPattern","AppEntityCreatedByAccessPattern","AppEntityAccessPattern","AppEntityActionAccessPattern","EntityIdGlobalAccessPattern","CreatedByAccessPattern","CreatedOnAccessPattern","createAccessPatterns","params","entity","index"],"sources":["index.ts"],"sourcesContent":["import type { IAccessPattern } from \"../abstractions/AccessPattern.js\";\nimport { DefaultAccessPattern } from \"~/storage/accessPatterns/DefaultAccessPattern.js\";\nimport { AppAccessPattern } from \"~/storage/accessPatterns/AppAccessPattern.js\";\nimport { AppCreatedByAccessPattern } from \"~/storage/accessPatterns/AppCreatedByAccessPattern.js\";\nimport { AppEntityActionCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js\";\nimport { AppEntityCreatedByAccessPattern } from \"~/storage/accessPatterns/AppEntityCreatedByAccessPattern.js\";\nimport { AppEntityAccessPattern } from \"~/storage/accessPatterns/AppEntityAccessPattern.js\";\nimport { AppEntityActionAccessPattern } from \"~/storage/accessPatterns/AppEntityActionAccessPattern.js\";\nimport { EntityIdGlobalAccessPattern } from \"~/storage/accessPatterns/EntityIdAccessPattern.js\";\nimport { CreatedByAccessPattern } from \"~/storage/accessPatterns/CreatedByAccessPattern.js\";\nimport { CreatedOnAccessPattern } from \"~/storage/accessPatterns/CreatedOnAccessPattern.js\";\nimport type { AuditLogsEntity } from \"~/storage/entity.js\";\n\nexport interface ICreateAccessPatternsParams {\n entity: AuditLogsEntity;\n}\n\nexport const createAccessPatterns = (\n params: ICreateAccessPatternsParams\n): IAccessPattern<unknown>[] => {\n const { entity } = params;\n return [\n new DefaultAccessPattern({\n entity\n }),\n new AppAccessPattern({\n entity,\n index: \"GSI1\"\n }),\n new AppCreatedByAccessPattern({\n entity,\n index: \"GSI2\"\n }),\n new AppEntityAccessPattern({\n entity,\n index: \"GSI3\"\n }),\n new EntityIdGlobalAccessPattern({\n entity,\n index: \"GSI4\"\n }),\n new AppEntityActionCreatedByAccessPattern({\n entity,\n index: \"GSI5\"\n }),\n new AppEntityActionAccessPattern({\n entity,\n index: \"GSI6\"\n }),\n new AppEntityCreatedByAccessPattern({\n entity,\n index: \"GSI7\"\n }),\n new CreatedByAccessPattern({\n entity,\n index: \"GSI8\"\n }),\n new CreatedOnAccessPattern({\n entity,\n index: \"GSI9\"\n })\n ];\n};\n"],"mappings":"AACA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,yBAAyB;AAClC,SAASC,qCAAqC;AAC9C,SAASC,+BAA+B;AACxC,SAASC,sBAAsB;AAC/B,SAASC,4BAA4B;AACrC,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAO/B,OAAO,MAAMC,oBAAoB,GAC7BC,MAAmC,IACP;EAC5B,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EACzB,OAAO,CACH,IAAIX,oBAAoB,CAAC;IACrBY;EACJ,CAAC,CAAC,EACF,IAAIX,gBAAgB,CAAC;IACjBW,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIX,yBAAyB,CAAC;IAC1BU,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIR,sBAAsB,CAAC;IACvBO,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIN,2BAA2B,CAAC;IAC5BK,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIV,qCAAqC,CAAC;IACtCS,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIP,4BAA4B,CAAC;IAC7BM,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIT,+BAA+B,CAAC;IAChCQ,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIL,sBAAsB,CAAC;IACvBI,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAIJ,sBAAsB,CAAC;IACvBG,MAAM;IACNC,KAAK,EAAE;EACX,CAAC,CAAC,CACL;AACL,CAAC","ignoreList":[]}
|
package/storage/cursorSchema.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import zod from "zod";
|
|
2
|
-
import { decodeCursor } from "@webiny/db-dynamodb";
|
|
3
|
-
const schema = zod.string().transform(value => {
|
|
4
|
-
const decoded = decodeCursor(value);
|
|
5
|
-
if (!decoded) {
|
|
6
|
-
throw new Error("Invalid cursor.");
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
return JSON.parse(decoded);
|
|
10
|
-
} catch {
|
|
11
|
-
return decoded;
|
|
12
|
-
}
|
|
13
|
-
}).pipe(zod.object({
|
|
14
|
-
PK: zod.string(),
|
|
15
|
-
SK: zod.string()
|
|
16
|
-
}));
|
|
17
|
-
export const fetchCursor = input => {
|
|
18
|
-
const result = schema.safeParse(input);
|
|
19
|
-
if (!result.success) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
return result.data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=cursorSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["zod","decodeCursor","schema","string","transform","value","decoded","Error","JSON","parse","pipe","object","PK","SK","fetchCursor","input","result","safeParse","success","undefined","data"],"sources":["cursorSchema.ts"],"sourcesContent":["import zod from \"zod\";\nimport { decodeCursor } from \"@webiny/db-dynamodb\";\n\nconst schema = zod\n .string()\n .transform(value => {\n const decoded = decodeCursor(value);\n if (!decoded) {\n throw new Error(\"Invalid cursor.\");\n }\n try {\n return JSON.parse(decoded);\n } catch {\n return decoded;\n }\n })\n .pipe(\n zod.object({\n PK: zod.string(),\n SK: zod.string()\n })\n );\n\nexport const fetchCursor = (input: unknown) => {\n const result = schema.safeParse(input);\n if (!result.success) {\n return undefined;\n }\n return result.data;\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAMC,MAAM,GAAGF,GAAG,CACbG,MAAM,CAAC,CAAC,CACRC,SAAS,CAACC,KAAK,IAAI;EAChB,MAAMC,OAAO,GAAGL,YAAY,CAACI,KAAK,CAAC;EACnC,IAAI,CAACC,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACtC;EACA,IAAI;IACA,OAAOC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAC;EAC9B,CAAC,CAAC,MAAM;IACJ,OAAOA,OAAO;EAClB;AACJ,CAAC,CAAC,CACDI,IAAI,CACDV,GAAG,CAACW,MAAM,CAAC;EACPC,EAAE,EAAEZ,GAAG,CAACG,MAAM,CAAC,CAAC;EAChBU,EAAE,EAAEb,GAAG,CAACG,MAAM,CAAC;AACnB,CAAC,CACL,CAAC;AAEL,OAAO,MAAMW,WAAW,GAAIC,KAAc,IAAK;EAC3C,MAAMC,MAAM,GAAGd,MAAM,CAACe,SAAS,CAACF,KAAK,CAAC;EACtC,IAAI,CAACC,MAAM,CAACE,OAAO,EAAE;IACjB,OAAOC,SAAS;EACpB;EACA,OAAOH,MAAM,CAACI,IAAI;AACtB,CAAC","ignoreList":[]}
|
package/storage/entity.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
-
import type { IEntity, IStandardEntityAttributes } from "@webiny/db-dynamodb";
|
|
3
|
-
import { createTable } from "@webiny/db-dynamodb";
|
|
4
|
-
import type { IStorageAuditLog } from "../storage/types.js";
|
|
5
|
-
export interface IAuditLogsEntityAttributes extends Omit<IStandardEntityAttributes<IStorageAuditLog>, "GSI1_SK" | "GSI2_SK" | "expiresAt"> {
|
|
6
|
-
GSI1_PK: string;
|
|
7
|
-
GSI1_SK: number;
|
|
8
|
-
GSI2_PK: string;
|
|
9
|
-
GSI2_SK: number;
|
|
10
|
-
GSI3_PK: string;
|
|
11
|
-
GSI3_SK: number;
|
|
12
|
-
GSI4_PK: string;
|
|
13
|
-
GSI4_SK: number;
|
|
14
|
-
GSI5_PK: string;
|
|
15
|
-
GSI5_SK: number;
|
|
16
|
-
GSI6_PK: string;
|
|
17
|
-
GSI6_SK: number;
|
|
18
|
-
GSI7_PK: string;
|
|
19
|
-
GSI7_SK: number;
|
|
20
|
-
GSI8_PK: string;
|
|
21
|
-
GSI8_SK: number;
|
|
22
|
-
GSI9_PK: string;
|
|
23
|
-
GSI9_SK: number;
|
|
24
|
-
expiresAt: number;
|
|
25
|
-
}
|
|
26
|
-
export type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;
|
|
27
|
-
export interface ICreateEntityParams {
|
|
28
|
-
client: DynamoDBDocument;
|
|
29
|
-
gsiAmount: number;
|
|
30
|
-
tableName: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
export interface ICreateEntityResult {
|
|
33
|
-
entity: AuditLogsEntity;
|
|
34
|
-
table: ReturnType<typeof createTable>;
|
|
35
|
-
}
|
|
36
|
-
export declare const createEntity: (params: ICreateEntityParams) => ICreateEntityResult;
|
package/storage/entity.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { createEntity as baseCreateEntity, createTable } from "@webiny/db-dynamodb";
|
|
2
|
-
const createTableGSIIndexes = count => {
|
|
3
|
-
const result = {};
|
|
4
|
-
for (let i = 1; i <= count; i++) {
|
|
5
|
-
result[`GSI${i}`] = {
|
|
6
|
-
partitionKey: `GSI${i}_PK`,
|
|
7
|
-
sortKey: `GSI${i}_SK`
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
export const createEntity = params => {
|
|
13
|
-
const {
|
|
14
|
-
gsiAmount,
|
|
15
|
-
client,
|
|
16
|
-
tableName
|
|
17
|
-
} = params;
|
|
18
|
-
const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;
|
|
19
|
-
if (!name) {
|
|
20
|
-
throw new Error("Missing env.DB_TABLE_AUDIT_LOGS environment variable.");
|
|
21
|
-
}
|
|
22
|
-
const table = createTable({
|
|
23
|
-
documentClient: client,
|
|
24
|
-
name,
|
|
25
|
-
indexes: {
|
|
26
|
-
...createTableGSIIndexes(gsiAmount)
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const entity = baseCreateEntity({
|
|
30
|
-
name: "AuditLogs",
|
|
31
|
-
table: table.table,
|
|
32
|
-
attributes: {
|
|
33
|
-
PK: {
|
|
34
|
-
partitionKey: true
|
|
35
|
-
},
|
|
36
|
-
SK: {
|
|
37
|
-
sortKey: true
|
|
38
|
-
},
|
|
39
|
-
GSI_TENANT: {
|
|
40
|
-
type: "string",
|
|
41
|
-
required: true
|
|
42
|
-
},
|
|
43
|
-
GSI1_PK: {
|
|
44
|
-
type: "string",
|
|
45
|
-
required: true
|
|
46
|
-
},
|
|
47
|
-
GSI1_SK: {
|
|
48
|
-
type: "number",
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
GSI2_PK: {
|
|
52
|
-
type: "string",
|
|
53
|
-
required: true
|
|
54
|
-
},
|
|
55
|
-
GSI2_SK: {
|
|
56
|
-
type: "number",
|
|
57
|
-
required: true
|
|
58
|
-
},
|
|
59
|
-
GSI3_PK: {
|
|
60
|
-
type: "string",
|
|
61
|
-
required: true
|
|
62
|
-
},
|
|
63
|
-
GSI3_SK: {
|
|
64
|
-
type: "number",
|
|
65
|
-
required: true
|
|
66
|
-
},
|
|
67
|
-
GSI4_PK: {
|
|
68
|
-
type: "string",
|
|
69
|
-
required: true
|
|
70
|
-
},
|
|
71
|
-
GSI4_SK: {
|
|
72
|
-
type: "number",
|
|
73
|
-
required: true
|
|
74
|
-
},
|
|
75
|
-
GSI5_PK: {
|
|
76
|
-
type: "string",
|
|
77
|
-
required: true
|
|
78
|
-
},
|
|
79
|
-
GSI5_SK: {
|
|
80
|
-
type: "number",
|
|
81
|
-
required: true
|
|
82
|
-
},
|
|
83
|
-
GSI6_PK: {
|
|
84
|
-
type: "string",
|
|
85
|
-
required: true
|
|
86
|
-
},
|
|
87
|
-
GSI6_SK: {
|
|
88
|
-
type: "number",
|
|
89
|
-
required: true
|
|
90
|
-
},
|
|
91
|
-
GSI7_PK: {
|
|
92
|
-
type: "string",
|
|
93
|
-
required: true
|
|
94
|
-
},
|
|
95
|
-
GSI7_SK: {
|
|
96
|
-
type: "number",
|
|
97
|
-
required: true
|
|
98
|
-
},
|
|
99
|
-
GSI8_PK: {
|
|
100
|
-
type: "string",
|
|
101
|
-
required: true
|
|
102
|
-
},
|
|
103
|
-
GSI8_SK: {
|
|
104
|
-
type: "number",
|
|
105
|
-
required: true
|
|
106
|
-
},
|
|
107
|
-
GSI9_PK: {
|
|
108
|
-
type: "string",
|
|
109
|
-
required: true
|
|
110
|
-
},
|
|
111
|
-
GSI9_SK: {
|
|
112
|
-
type: "number",
|
|
113
|
-
required: true
|
|
114
|
-
},
|
|
115
|
-
data: {
|
|
116
|
-
type: "map",
|
|
117
|
-
required: true
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return {
|
|
122
|
-
entity,
|
|
123
|
-
table
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
//# sourceMappingURL=entity.js.map
|
package/storage/entity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEntity","baseCreateEntity","createTable","createTableGSIIndexes","count","result","i","partitionKey","sortKey","params","gsiAmount","client","tableName","name","process","env","DB_TABLE_AUDIT_LOGS","Error","table","documentClient","indexes","entity","attributes","PK","SK","GSI_TENANT","type","required","GSI1_PK","GSI1_SK","GSI2_PK","GSI2_SK","GSI3_PK","GSI3_SK","GSI4_PK","GSI4_SK","GSI5_PK","GSI5_SK","GSI6_PK","GSI6_SK","GSI7_PK","GSI7_SK","GSI8_PK","GSI8_SK","GSI9_PK","GSI9_SK","data"],"sources":["entity.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport { createEntity as baseCreateEntity, createTable } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStorageAuditLog } from \"~/storage/types.js\";\n\nexport interface IAuditLogsEntityAttributes\n extends Omit<IStandardEntityAttributes<IStorageAuditLog>, \"GSI1_SK\" | \"GSI2_SK\" | \"expiresAt\"> {\n GSI1_PK: string;\n GSI1_SK: number;\n GSI2_PK: string;\n GSI2_SK: number;\n GSI3_PK: string;\n GSI3_SK: number;\n GSI4_PK: string;\n GSI4_SK: number;\n GSI5_PK: string;\n GSI5_SK: number;\n GSI6_PK: string;\n GSI6_SK: number;\n GSI7_PK: string;\n GSI7_SK: number;\n GSI8_PK: string;\n GSI8_SK: number;\n GSI9_PK: string;\n GSI9_SK: number;\n expiresAt: number;\n}\n\nexport type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;\n\nexport interface ICreateEntityParams {\n client: DynamoDBDocument;\n gsiAmount: number;\n tableName: string | undefined;\n}\n\nexport interface ICreateEntityResult {\n entity: AuditLogsEntity;\n table: ReturnType<typeof createTable>;\n}\n\nconst createTableGSIIndexes = (count: number) => {\n const result: GenericRecord = {};\n for (let i = 1; i <= count; i++) {\n result[`GSI${i}`] = {\n partitionKey: `GSI${i}_PK`,\n sortKey: `GSI${i}_SK`\n };\n }\n return result;\n};\n\nexport const createEntity = (params: ICreateEntityParams): ICreateEntityResult => {\n const { gsiAmount, client, tableName } = params;\n const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;\n if (!name) {\n throw new Error(\"Missing env.DB_TABLE_AUDIT_LOGS environment variable.\");\n }\n const table = createTable({\n documentClient: client,\n name,\n indexes: {\n ...createTableGSIIndexes(gsiAmount)\n }\n });\n\n const entity = baseCreateEntity<IAuditLogsEntityAttributes>({\n name: \"AuditLogs\",\n table: table.table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI_TENANT: {\n type: \"string\",\n required: true\n },\n GSI1_PK: {\n type: \"string\",\n required: true\n },\n GSI1_SK: {\n type: \"number\",\n required: true\n },\n GSI2_PK: {\n type: \"string\",\n required: true\n },\n GSI2_SK: {\n type: \"number\",\n required: true\n },\n GSI3_PK: {\n type: \"string\",\n required: true\n },\n GSI3_SK: {\n type: \"number\",\n required: true\n },\n GSI4_PK: {\n type: \"string\",\n required: true\n },\n GSI4_SK: {\n type: \"number\",\n required: true\n },\n GSI5_PK: {\n type: \"string\",\n required: true\n },\n GSI5_SK: {\n type: \"number\",\n required: true\n },\n GSI6_PK: {\n type: \"string\",\n required: true\n },\n GSI6_SK: {\n type: \"number\",\n required: true\n },\n GSI7_PK: {\n type: \"string\",\n required: true\n },\n GSI7_SK: {\n type: \"number\",\n required: true\n },\n GSI8_PK: {\n type: \"string\",\n required: true\n },\n GSI8_SK: {\n type: \"number\",\n required: true\n },\n GSI9_PK: {\n type: \"string\",\n required: true\n },\n GSI9_SK: {\n type: \"number\",\n required: true\n },\n data: {\n type: \"map\",\n required: true\n }\n }\n });\n\n return {\n entity,\n table\n };\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IStorageListErrorResult } from "../../storage/abstractions/Storage.js";
|
|
2
|
-
export interface IListErrorResultParams {
|
|
3
|
-
error: Error;
|
|
4
|
-
}
|
|
5
|
-
export declare class ListErrorResult implements IStorageListErrorResult {
|
|
6
|
-
readonly error: Error;
|
|
7
|
-
readonly success = false;
|
|
8
|
-
private constructor();
|
|
9
|
-
static create(params: IListErrorResultParams): IStorageListErrorResult;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ListErrorResult","success","constructor","params","error","create"],"sources":["ListErrorResult.ts"],"sourcesContent":["import type { IStorageListErrorResult } from \"~/storage/abstractions/Storage.js\";\n\nexport interface IListErrorResultParams {\n error: Error;\n}\n\nexport class ListErrorResult implements IStorageListErrorResult {\n public readonly error: Error;\n public readonly success = false;\n\n private constructor(params: IListErrorResultParams) {\n this.error = params.error;\n }\n\n public static create(params: IListErrorResultParams): IStorageListErrorResult {\n return new ListErrorResult(params);\n }\n}\n"],"mappings":"AAMA,OAAO,MAAMA,eAAe,CAAoC;EAE5CC,OAAO,GAAG,KAAK;EAEvBC,WAAWA,CAACC,MAA8B,EAAE;IAChD,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;EAC7B;EAEA,OAAcC,MAAMA,CAACF,MAA8B,EAA2B;IAC1E,OAAO,IAAIH,eAAe,CAACG,MAAM,CAAC;EACtC;AACJ","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IStorageListSuccessResult, IStorageListSuccessResultMeta } from "../../storage/abstractions/Storage.js";
|
|
2
|
-
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
-
import type { IAuditLog } from "../../storage/types.js";
|
|
4
|
-
export interface IListSuccessResultParams {
|
|
5
|
-
data: IAuditLog[];
|
|
6
|
-
lastEvaluatedKey?: GenericRecord;
|
|
7
|
-
}
|
|
8
|
-
export declare class ListSuccessResult implements IStorageListSuccessResult {
|
|
9
|
-
readonly data: IAuditLog[];
|
|
10
|
-
readonly meta: IStorageListSuccessResultMeta;
|
|
11
|
-
readonly success = true;
|
|
12
|
-
protected constructor(params: IListSuccessResultParams);
|
|
13
|
-
static create(params: IListSuccessResultParams): IStorageListSuccessResult;
|
|
14
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { encodeCursor } from "@webiny/db-dynamodb";
|
|
2
|
-
export class ListSuccessResult {
|
|
3
|
-
success = true;
|
|
4
|
-
constructor(params) {
|
|
5
|
-
this.data = params.data;
|
|
6
|
-
this.meta = {
|
|
7
|
-
after: encodeCursor(params.lastEvaluatedKey) || undefined,
|
|
8
|
-
hasMoreItems: !!params.lastEvaluatedKey
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
static create(params) {
|
|
12
|
-
return new ListSuccessResult(params);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=ListSuccessResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["encodeCursor","ListSuccessResult","success","constructor","params","data","meta","after","lastEvaluatedKey","undefined","hasMoreItems","create"],"sources":["ListSuccessResult.ts"],"sourcesContent":["import type {\n IStorageListSuccessResult,\n IStorageListSuccessResultMeta\n} from \"~/storage/abstractions/Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { encodeCursor } from \"@webiny/db-dynamodb\";\nimport type { IAuditLog } from \"~/storage/types.js\";\n\nexport interface IListSuccessResultParams {\n data: IAuditLog[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport class ListSuccessResult implements IStorageListSuccessResult {\n public readonly data: IAuditLog[];\n public readonly meta: IStorageListSuccessResultMeta;\n public readonly success = true;\n\n protected constructor(params: IListSuccessResultParams) {\n this.data = params.data;\n this.meta = {\n after: encodeCursor(params.lastEvaluatedKey) || undefined,\n hasMoreItems: !!params.lastEvaluatedKey\n };\n }\n\n public static create(params: IListSuccessResultParams): IStorageListSuccessResult {\n return new ListSuccessResult(params);\n }\n}\n"],"mappings":"AAKA,SAASA,YAAY,QAAQ,qBAAqB;AAQlD,OAAO,MAAMC,iBAAiB,CAAsC;EAGhDC,OAAO,GAAG,IAAI;EAEpBC,WAAWA,CAACC,MAAgC,EAAE;IACpD,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,IAAI,GAAG;MACRC,KAAK,EAAEP,YAAY,CAACI,MAAM,CAACI,gBAAgB,CAAC,IAAIC,SAAS;MACzDC,YAAY,EAAE,CAAC,CAACN,MAAM,CAACI;IAC3B,CAAC;EACL;EAEA,OAAcG,MAAMA,CAACP,MAAgC,EAA6B;IAC9E,OAAO,IAAIH,iBAAiB,CAACG,MAAM,CAAC;EACxC;AACJ","ignoreList":[]}
|
package/storage/results/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ListErrorResult.js\";\nexport * from \"./ListSuccessResult.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
package/storage/startKey.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IStorageListParams } from "../storage/abstractions/Storage.js";
|
|
2
|
-
export interface ICreateStartKeyResult {
|
|
3
|
-
PK: string;
|
|
4
|
-
SK: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const createStartKey: (params: Pick<IStorageListParams, "after">) => ICreateStartKeyResult | undefined;
|
package/storage/startKey.js
DELETED
package/storage/startKey.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["fetchCursor","createStartKey","params","after","undefined"],"sources":["startKey.ts"],"sourcesContent":["import type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { fetchCursor } from \"~/storage/cursorSchema.js\";\n\nexport interface ICreateStartKeyResult {\n PK: string;\n SK: string;\n}\n\nexport const createStartKey = (\n params: Pick<IStorageListParams, \"after\">\n): ICreateStartKeyResult | undefined => {\n if (!params.after) {\n return undefined;\n }\n return fetchCursor(params.after);\n};\n"],"mappings":"AACA,SAASA,WAAW;AAOpB,OAAO,MAAMC,cAAc,GACvBC,MAAyC,IACL;EACpC,IAAI,CAACA,MAAM,CAACC,KAAK,EAAE;IACf,OAAOC,SAAS;EACpB;EACA,OAAOJ,WAAW,CAACE,MAAM,CAACC,KAAK,CAAC;AACpC,CAAC","ignoreList":[]}
|
package/storage/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface IAuditLogCreatedBy {\n id: string;\n type: string;\n displayName: string;\n}\n\nexport interface IAuditLog {\n id: string;\n tenant: string;\n createdBy: IAuditLogCreatedBy;\n createdOn: Date;\n app: string;\n action: string;\n message: string;\n entity: string;\n entityId: string;\n tags: string[];\n expiresAt: Date;\n content: string;\n}\n\nexport interface IStorageAuditLog extends Omit<IAuditLog, \"createdOn\" | \"content\" | \"expiresAt\"> {\n expiresAt: string;\n createdOn: string;\n content: string;\n}\n\nexport interface IStorageItem {\n PK: string;\n SK: string;\n TYPE: string;\n GSI_TENANT: string;\n GSI1_PK: string;\n GSI1_SK: number;\n GSI2_PK: string;\n GSI2_SK: number;\n GSI3_PK: string;\n GSI3_SK: number;\n GSI4_PK: string;\n GSI4_SK: number;\n GSI5_PK: string;\n GSI5_SK: number;\n GSI6_PK: string;\n GSI6_SK: number;\n GSI7_PK: string;\n GSI7_SK: number;\n GSI8_PK: string;\n GSI8_SK: number;\n GSI9_PK: string;\n GSI9_SK: number;\n\n data: IStorageAuditLog;\n expiresAt: number;\n}\n\nexport interface IIndexStorageItem {\n PK: string;\n SK: string;\n}\n"],"mappings":"","ignoreList":[]}
|
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { Action, App, Entity } from \"@webiny/common-audit-logs/types.js\";\nimport type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\n\nexport interface AuditLogPayload\n extends Omit<IAuditLog, \"id\" | \"tenant\" | \"createdOn\" | \"createdBy\" | \"expiresAt\" | \"content\"> {\n content: GenericRecord;\n}\n\nexport interface IListAuditLogsParams extends Omit<IStorageListParams, \"tenant\" | \"limit\" | \"app\"> {\n app?: string;\n limit?: number;\n}\n\nexport interface IListAuditLogsResultMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\nexport interface IListAuditLogsSuccessResult {\n items: IAuditLog[];\n meta: IListAuditLogsResultMeta;\n error?: never;\n}\n\nexport interface IListAuditLogsErrorResult {\n items?: never;\n meta?: never;\n error: Error;\n}\n\nexport type IListAuditLogsResult = IListAuditLogsSuccessResult | IListAuditLogsErrorResult;\n\nexport interface AuditLogsContextValue {\n deleteLogsAfterDays: number | undefined;\n createAuditLog(payload: AuditLogPayload): Promise<IAuditLog>;\n updateAuditLog(original: IAuditLog, payload: Partial<AuditLogPayload>): Promise<IAuditLog>;\n getAuditLog(id: string): Promise<IAuditLog | null>;\n listAuditLogs(params: IListAuditLogsParams): Promise<IListAuditLogsResult>;\n}\n\nexport interface AuditLogsContext extends ApiCoreContext, Pick<DbContext, \"db\"> {\n auditLogs: AuditLogsContextValue;\n}\n\nexport interface AuditObject {\n [app: string]: EntityObject;\n}\n\nexport interface EntityObject {\n [entity: string]: ActionObject;\n}\n\nexport interface ActionObject {\n [action: string]: AuditAction;\n}\n\nexport interface AuditAction {\n app: App;\n entity: Entity;\n action: Action;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AuditAction, AuditLogsContext } from "../types.js";
|
|
2
|
-
import type { IAuditLog } from "../storage/types.js";
|
|
3
|
-
import type { GenericRecord } from "@webiny/api/types.js";
|
|
4
|
-
export declare const getAuditConfig: (audit: AuditAction) => (message: string, content: GenericRecord, entityId: string, context: AuditLogsContext) => Promise<IAuditLog | null>;
|
package/utils/getAuditConfig.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import WebinyError from "@webiny/error";
|
|
2
|
-
const createAuditLog = async params => {
|
|
3
|
-
const {
|
|
4
|
-
context,
|
|
5
|
-
payload
|
|
6
|
-
} = params;
|
|
7
|
-
try {
|
|
8
|
-
return await context.auditLogs.createAuditLog(payload);
|
|
9
|
-
} catch (error) {
|
|
10
|
-
throw WebinyError.from(error);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const createAuditLogDelayDate = delay => {
|
|
14
|
-
if (!delay) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const date = new Date();
|
|
18
|
-
date.setTime(date.getTime() - delay * 1000);
|
|
19
|
-
return date;
|
|
20
|
-
};
|
|
21
|
-
const createOrMergeAuditLog = async params => {
|
|
22
|
-
const {
|
|
23
|
-
context,
|
|
24
|
-
payload,
|
|
25
|
-
delay
|
|
26
|
-
} = params;
|
|
27
|
-
const results = await context.auditLogs.listAuditLogs({
|
|
28
|
-
app: payload.app,
|
|
29
|
-
entityId: payload.entityId,
|
|
30
|
-
limit: 1,
|
|
31
|
-
createdOn_gte: createAuditLogDelayDate(delay),
|
|
32
|
-
sort: "DESC"
|
|
33
|
-
});
|
|
34
|
-
if (results.error) {
|
|
35
|
-
throw WebinyError.from(results.error);
|
|
36
|
-
}
|
|
37
|
-
const original = results.items?.[0];
|
|
38
|
-
if (!original) {
|
|
39
|
-
return createAuditLog(params);
|
|
40
|
-
}
|
|
41
|
-
// Update latest audit log with new "after" payload.
|
|
42
|
-
const beforePayloadData = original.content ? JSON.parse(original.content)?.before : undefined;
|
|
43
|
-
/**
|
|
44
|
-
* We can assume that there is a possible "after" in the payload data.
|
|
45
|
-
*/
|
|
46
|
-
const afterPayloadData = payload.content?.after;
|
|
47
|
-
const updatedPayloadData = beforePayloadData ? {
|
|
48
|
-
before: beforePayloadData,
|
|
49
|
-
after: afterPayloadData
|
|
50
|
-
} : payload.content;
|
|
51
|
-
try {
|
|
52
|
-
return await context.auditLogs.updateAuditLog(original, {
|
|
53
|
-
...payload,
|
|
54
|
-
content: updatedPayloadData
|
|
55
|
-
});
|
|
56
|
-
} catch (ex) {
|
|
57
|
-
throw WebinyError.from(ex);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
export const getAuditConfig = audit => {
|
|
61
|
-
return async (message, content, entityId, context) => {
|
|
62
|
-
if (!context.auditLogs) {
|
|
63
|
-
console.log("No AuditLogs defined.");
|
|
64
|
-
return null;
|
|
65
|
-
} else if (!audit) {
|
|
66
|
-
console.log(`No Audit Action defined!`);
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
const payload = {
|
|
70
|
-
message,
|
|
71
|
-
app: audit.app.app,
|
|
72
|
-
entityId,
|
|
73
|
-
entity: audit.entity.type,
|
|
74
|
-
action: audit.action.type,
|
|
75
|
-
content,
|
|
76
|
-
tags: []
|
|
77
|
-
};
|
|
78
|
-
const delay = audit.action.newEntryDelay || 0;
|
|
79
|
-
if (!context.security.getIdentity()?.id) {
|
|
80
|
-
console.log("No identity - skipping audit log creation.");
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return await context.security.withoutAuthorization(async () => {
|
|
84
|
-
// Check if there is delay on audit log creation for this action.
|
|
85
|
-
if (delay > 0) {
|
|
86
|
-
try {
|
|
87
|
-
return await createOrMergeAuditLog({
|
|
88
|
-
context,
|
|
89
|
-
payload,
|
|
90
|
-
delay
|
|
91
|
-
});
|
|
92
|
-
} catch {
|
|
93
|
-
// Don't care at this point!
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return await createAuditLog({
|
|
98
|
-
context,
|
|
99
|
-
payload
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=getAuditConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["WebinyError","createAuditLog","params","context","payload","auditLogs","error","from","createAuditLogDelayDate","delay","undefined","date","Date","setTime","getTime","createOrMergeAuditLog","results","listAuditLogs","app","entityId","limit","createdOn_gte","sort","original","items","beforePayloadData","content","JSON","parse","before","afterPayloadData","after","updatedPayloadData","updateAuditLog","ex","getAuditConfig","audit","message","console","log","entity","type","action","tags","newEntryDelay","security","getIdentity","id","withoutAuthorization"],"sources":["getAuditConfig.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { AuditAction, AuditLogPayload, AuditLogsContext } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\ninterface CreateAuditLogParams {\n context: Pick<AuditLogsContext, \"auditLogs\">;\n payload: AuditLogPayload;\n}\n\nconst createAuditLog = async (params: CreateAuditLogParams): Promise<IAuditLog> => {\n const { context, payload } = params;\n\n try {\n return await context.auditLogs.createAuditLog(payload);\n } catch (error) {\n throw WebinyError.from(error);\n }\n};\n\ninterface CreateOrMergeAuditLogParams {\n context: AuditLogsContext;\n payload: AuditLogPayload;\n delay: number;\n}\n\nconst createAuditLogDelayDate = (delay: number | undefined) => {\n if (!delay) {\n return undefined;\n }\n const date = new Date();\n date.setTime(date.getTime() - delay * 1000);\n return date;\n};\n\nconst createOrMergeAuditLog = async (params: CreateOrMergeAuditLogParams): Promise<IAuditLog> => {\n const { context, payload, delay } = params;\n\n const results = await context.auditLogs.listAuditLogs({\n app: payload.app,\n entityId: payload.entityId,\n limit: 1,\n createdOn_gte: createAuditLogDelayDate(delay),\n sort: \"DESC\"\n });\n if (results.error) {\n throw WebinyError.from(results.error);\n }\n const original = results.items?.[0];\n if (!original) {\n return createAuditLog(params);\n }\n // Update latest audit log with new \"after\" payload.\n const beforePayloadData = original.content ? JSON.parse(original.content)?.before : undefined;\n /**\n * We can assume that there is a possible \"after\" in the payload data.\n */\n const afterPayloadData = payload.content?.after;\n const updatedPayloadData = beforePayloadData\n ? {\n before: beforePayloadData,\n after: afterPayloadData\n }\n : payload.content;\n\n try {\n return await context.auditLogs.updateAuditLog(original, {\n ...payload,\n content: updatedPayloadData\n });\n } catch (ex) {\n throw WebinyError.from(ex);\n }\n};\n\nexport const getAuditConfig = (audit: AuditAction) => {\n return async (\n message: string,\n content: GenericRecord,\n entityId: string,\n context: AuditLogsContext\n ): Promise<IAuditLog | null> => {\n if (!context.auditLogs) {\n console.log(\"No AuditLogs defined.\");\n return null;\n } else if (!audit) {\n console.log(`No Audit Action defined!`);\n return null;\n }\n\n const payload: AuditLogPayload = {\n message,\n app: audit.app.app,\n entityId,\n entity: audit.entity.type,\n action: audit.action.type,\n content,\n tags: []\n };\n\n const delay = audit.action.newEntryDelay || 0;\n\n if (!context.security.getIdentity()?.id) {\n console.log(\"No identity - skipping audit log creation.\");\n return null;\n }\n\n return await context.security.withoutAuthorization(async () => {\n // Check if there is delay on audit log creation for this action.\n if (delay > 0) {\n try {\n return await createOrMergeAuditLog({\n context,\n payload,\n delay\n });\n } catch {\n // Don't care at this point!\n }\n return null;\n }\n return await createAuditLog({\n context,\n payload\n });\n });\n };\n};\n"],"mappings":"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","ignoreList":[]}
|