@webiny/api-audit-logs 6.0.0-beta.0 → 6.0.0-rc.1
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/README.md +11 -1
- package/abstractions.d.ts +5 -0
- package/abstractions.js +6 -0
- package/abstractions.js.map +1 -0
- package/config.d.ts +0 -13
- package/config.js +3 -291
- package/config.js.map +1 -1
- package/context/AuditLogsContextValue.d.ts +10 -0
- package/context/AuditLogsContextValue.js +139 -0
- package/context/AuditLogsContextValue.js.map +1 -0
- package/context/index.d.ts +9 -0
- package/context/index.js +35 -0
- package/context/index.js.map +1 -0
- package/events/AuditLogAfterCreateEvent.d.ts +6 -0
- package/events/AuditLogAfterCreateEvent.js +10 -0
- package/events/AuditLogAfterCreateEvent.js.map +1 -0
- package/events/AuditLogAfterUpdateEvent.d.ts +6 -0
- package/events/AuditLogAfterUpdateEvent.js +10 -0
- package/events/AuditLogAfterUpdateEvent.js.map +1 -0
- package/events/AuditLogBeforeCreateEvent.d.ts +6 -0
- package/events/AuditLogBeforeCreateEvent.js +10 -0
- package/events/AuditLogBeforeCreateEvent.js.map +1 -0
- package/events/AuditLogBeforeUpdateEvent.d.ts +6 -0
- package/events/AuditLogBeforeUpdateEvent.js +10 -0
- package/events/AuditLogBeforeUpdateEvent.js.map +1 -0
- package/events/abstractions.d.ts +43 -0
- package/events/abstractions.js +27 -0
- package/events/abstractions.js.map +1 -0
- package/events/index.d.ts +5 -0
- package/events/index.js +7 -0
- package/events/index.js.map +1 -0
- package/graphql/schema.d.ts +3 -0
- package/graphql/schema.js +126 -0
- package/graphql/schema.js.map +1 -0
- package/graphql/validation.d.ts +64 -0
- package/graphql/validation.js +35 -0
- package/graphql/validation.js.map +1 -0
- package/index.d.ts +8 -4
- package/index.js +15 -41
- package/index.js.map +1 -1
- package/package.json +30 -34
- package/storage/AccessPatternHandler.d.ts +14 -0
- package/storage/AccessPatternHandler.js +60 -0
- package/storage/AccessPatternHandler.js.map +1 -0
- package/storage/Converter.d.ts +16 -0
- package/storage/Converter.js +52 -0
- package/storage/Converter.js.map +1 -0
- package/storage/Storage.d.ts +18 -0
- package/storage/Storage.js +89 -0
- package/storage/Storage.js.map +1 -0
- package/storage/abstractions/AccessPattern.d.ts +24 -0
- package/storage/abstractions/AccessPattern.js +3 -0
- package/storage/abstractions/AccessPattern.js.map +1 -0
- package/storage/abstractions/AccessPatternHandler.d.ts +13 -0
- package/storage/abstractions/AccessPatternHandler.js +3 -0
- package/storage/abstractions/AccessPatternHandler.js.map +1 -0
- package/storage/abstractions/Converter.d.ts +6 -0
- package/storage/abstractions/Converter.js +3 -0
- package/storage/abstractions/Converter.js.map +1 -0
- package/storage/abstractions/Storage.d.ts +108 -0
- package/storage/abstractions/Storage.js +3 -0
- package/storage/abstractions/Storage.js.map +1 -0
- package/storage/accessPatterns/AppAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppAccessPattern.js +29 -0
- package/storage/accessPatterns/AppAccessPattern.js.map +1 -0
- package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +32 -0
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -0
- package/storage/accessPatterns/AppEntityAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppEntityAccessPattern.js +29 -0
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -0
- package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +29 -0
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -0
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +32 -0
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -0
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +32 -0
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -0
- package/storage/accessPatterns/BaseAccessPattern.d.ts +32 -0
- package/storage/accessPatterns/BaseAccessPattern.js +82 -0
- package/storage/accessPatterns/BaseAccessPattern.js.map +1 -0
- package/storage/accessPatterns/CreatedByAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/CreatedByAccessPattern.js +32 -0
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -0
- package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/CreatedOnAccessPattern.js +30 -0
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -0
- package/storage/accessPatterns/DefaultAccessPattern.d.ts +15 -0
- package/storage/accessPatterns/DefaultAccessPattern.js +36 -0
- package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -0
- package/storage/accessPatterns/EntityIdAccessPattern.d.ts +9 -0
- package/storage/accessPatterns/EntityIdAccessPattern.js +33 -0
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -0
- package/storage/accessPatterns/index.d.ts +6 -0
- package/storage/accessPatterns/index.js +47 -0
- package/storage/accessPatterns/index.js.map +1 -0
- package/storage/cursorSchema.d.ts +4 -0
- package/storage/cursorSchema.js +25 -0
- package/storage/cursorSchema.js.map +1 -0
- package/storage/entity.d.ts +36 -0
- package/storage/entity.js +127 -0
- package/storage/entity.js.map +1 -0
- package/storage/results/ListErrorResult.d.ts +10 -0
- package/storage/results/ListErrorResult.js +11 -0
- package/storage/results/ListErrorResult.js.map +1 -0
- package/storage/results/ListSuccessResult.d.ts +14 -0
- package/storage/results/ListSuccessResult.js +16 -0
- package/storage/results/ListSuccessResult.js.map +1 -0
- package/storage/results/index.d.ts +2 -0
- package/storage/results/index.js +4 -0
- package/storage/results/index.js.map +1 -0
- package/storage/startKey.d.ts +6 -0
- package/storage/startKey.js +9 -0
- package/storage/startKey.js.map +1 -0
- package/storage/types.d.ts +54 -0
- package/storage/types.js +3 -0
- package/storage/types.js.map +1 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +11 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +35 -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 +38 -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 +42 -0
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -0
- package/subscriptions/aco/index.d.ts +1 -1
- package/subscriptions/aco/index.js +7 -15
- package/subscriptions/aco/index.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +11 -0
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +30 -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 +30 -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 +34 -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 +34 -0
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -0
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +11 -13
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +11 -0
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +34 -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 +40 -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 +34 -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 +34 -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 +34 -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 +38 -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 +34 -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 +34 -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 +30 -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 +30 -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 +34 -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 +30 -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 +30 -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 +34 -0
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -0
- package/subscriptions/headlessCms/index.d.ts +1 -1
- package/subscriptions/headlessCms/index.js +33 -27
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +1 -1
- package/subscriptions/index.js +13 -26
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +11 -0
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +32 -0
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -0
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +4 -10
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +11 -0
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +47 -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 +47 -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 +52 -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 +30 -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 +30 -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 +34 -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 +30 -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 +30 -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 +34 -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 +30 -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 +30 -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 +34 -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 +18 -0
- package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -0
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +31 -23
- package/subscriptions/security/index.js.map +1 -1
- 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 +30 -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 +30 -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 +30 -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 +34 -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 +30 -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 +30 -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 +30 -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 +34 -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 +30 -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 +30 -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 +30 -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 +34 -0
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -0
- package/types.d.ts +37 -43
- package/types.js +1 -16
- package/types.js.map +1 -1
- package/utils/expiresAt.d.ts +4 -0
- package/utils/expiresAt.js +25 -0
- package/utils/expiresAt.js.map +1 -0
- package/utils/getAuditConfig.d.ts +4 -36
- package/utils/getAuditConfig.js +77 -113
- package/utils/getAuditConfig.js.map +1 -1
- package/utils/getAuditObject.d.ts +2 -1
- package/utils/getAuditObject.js +1 -8
- package/utils/getAuditObject.js.map +1 -1
- package/app/app.d.ts +0 -2
- package/app/app.js +0 -120
- package/app/app.js.map +0 -1
- package/app/contants.d.ts +0 -2
- package/app/contants.js +0 -10
- package/app/contants.js.map +0 -1
- package/app/createAppModifier.d.ts +0 -4
- package/app/createAppModifier.js +0 -14
- package/app/createAppModifier.js.map +0 -1
- package/app/index.d.ts +0 -4
- package/app/index.js +0 -43
- package/app/index.js.map +0 -1
- package/app/types.d.ts +0 -7
- package/app/types.js +0 -7
- package/app/types.js.map +0 -1
- package/subscriptions/aco/folders.d.ts +0 -4
- package/subscriptions/aco/folders.js +0 -94
- package/subscriptions/aco/folders.js.map +0 -1
- package/subscriptions/apw/changeRequests.d.ts +0 -4
- package/subscriptions/apw/changeRequests.js +0 -80
- package/subscriptions/apw/changeRequests.js.map +0 -1
- package/subscriptions/apw/comments.d.ts +0 -2
- package/subscriptions/apw/comments.js +0 -28
- package/subscriptions/apw/comments.js.map +0 -1
- package/subscriptions/apw/contentReviews.d.ts +0 -2
- package/subscriptions/apw/contentReviews.js +0 -28
- package/subscriptions/apw/contentReviews.js.map +0 -1
- package/subscriptions/apw/index.d.ts +0 -2
- package/subscriptions/apw/index.js +0 -26
- package/subscriptions/apw/index.js.map +0 -1
- package/subscriptions/apw/workflows.d.ts +0 -4
- package/subscriptions/apw/workflows.js +0 -64
- package/subscriptions/apw/workflows.js.map +0 -1
- package/subscriptions/fileManager/files.d.ts +0 -4
- package/subscriptions/fileManager/files.js +0 -64
- package/subscriptions/fileManager/files.js.map +0 -1
- package/subscriptions/fileManager/settings.d.ts +0 -2
- package/subscriptions/fileManager/settings.js +0 -32
- package/subscriptions/fileManager/settings.js.map +0 -1
- package/subscriptions/formBuilder/formRevisions.d.ts +0 -6
- package/subscriptions/formBuilder/formRevisions.js +0 -96
- package/subscriptions/formBuilder/formRevisions.js.map +0 -1
- package/subscriptions/formBuilder/formSubmissions.d.ts +0 -2
- package/subscriptions/formBuilder/formSubmissions.js +0 -28
- package/subscriptions/formBuilder/formSubmissions.js.map +0 -1
- package/subscriptions/formBuilder/forms.d.ts +0 -5
- package/subscriptions/formBuilder/forms.js +0 -76
- package/subscriptions/formBuilder/forms.js.map +0 -1
- package/subscriptions/formBuilder/index.d.ts +0 -2
- package/subscriptions/formBuilder/index.js +0 -26
- package/subscriptions/formBuilder/index.js.map +0 -1
- package/subscriptions/formBuilder/settings.d.ts +0 -2
- package/subscriptions/formBuilder/settings.js +0 -32
- package/subscriptions/formBuilder/settings.js.map +0 -1
- package/subscriptions/headlessCms/entries.d.ts +0 -9
- package/subscriptions/headlessCms/entries.js +0 -183
- package/subscriptions/headlessCms/entries.js.map +0 -1
- package/subscriptions/headlessCms/groups.d.ts +0 -4
- package/subscriptions/headlessCms/groups.js +0 -64
- package/subscriptions/headlessCms/groups.js.map +0 -1
- package/subscriptions/headlessCms/models.d.ts +0 -4
- package/subscriptions/headlessCms/models.js +0 -64
- package/subscriptions/headlessCms/models.js.map +0 -1
- package/subscriptions/headlessCms/utils/isSearchModelEntry.d.ts +0 -1
- package/subscriptions/headlessCms/utils/isSearchModelEntry.js +0 -13
- package/subscriptions/headlessCms/utils/isSearchModelEntry.js.map +0 -1
- package/subscriptions/i18n/index.d.ts +0 -2
- package/subscriptions/i18n/index.js +0 -15
- package/subscriptions/i18n/index.js.map +0 -1
- package/subscriptions/i18n/locales.d.ts +0 -4
- package/subscriptions/i18n/locales.js +0 -64
- package/subscriptions/i18n/locales.js.map +0 -1
- package/subscriptions/mailer/settings.d.ts +0 -2
- package/subscriptions/mailer/settings.js +0 -32
- package/subscriptions/mailer/settings.js.map +0 -1
- package/subscriptions/pageBuilder/blockCategories.d.ts +0 -4
- package/subscriptions/pageBuilder/blockCategories.js +0 -64
- package/subscriptions/pageBuilder/blockCategories.js.map +0 -1
- package/subscriptions/pageBuilder/blocks.d.ts +0 -6
- package/subscriptions/pageBuilder/blocks.js +0 -96
- package/subscriptions/pageBuilder/blocks.js.map +0 -1
- package/subscriptions/pageBuilder/categories.d.ts +0 -4
- package/subscriptions/pageBuilder/categories.js +0 -64
- package/subscriptions/pageBuilder/categories.js.map +0 -1
- package/subscriptions/pageBuilder/index.d.ts +0 -2
- package/subscriptions/pageBuilder/index.js +0 -51
- package/subscriptions/pageBuilder/index.js.map +0 -1
- package/subscriptions/pageBuilder/menus.d.ts +0 -4
- package/subscriptions/pageBuilder/menus.js +0 -64
- package/subscriptions/pageBuilder/menus.js.map +0 -1
- package/subscriptions/pageBuilder/pageElements.d.ts +0 -4
- package/subscriptions/pageBuilder/pageElements.js +0 -64
- package/subscriptions/pageBuilder/pageElements.js.map +0 -1
- package/subscriptions/pageBuilder/pageRevisions.d.ts +0 -6
- package/subscriptions/pageBuilder/pageRevisions.js +0 -101
- package/subscriptions/pageBuilder/pageRevisions.js.map +0 -1
- package/subscriptions/pageBuilder/pages.d.ts +0 -4
- package/subscriptions/pageBuilder/pages.js +0 -60
- package/subscriptions/pageBuilder/pages.js.map +0 -1
- package/subscriptions/pageBuilder/settings.d.ts +0 -2
- package/subscriptions/pageBuilder/settings.js +0 -32
- package/subscriptions/pageBuilder/settings.js.map +0 -1
- package/subscriptions/pageBuilder/templates.d.ts +0 -6
- package/subscriptions/pageBuilder/templates.js +0 -96
- package/subscriptions/pageBuilder/templates.js.map +0 -1
- package/subscriptions/security/apiKeys.d.ts +0 -4
- package/subscriptions/security/apiKeys.js +0 -85
- package/subscriptions/security/apiKeys.js.map +0 -1
- package/subscriptions/security/roles.d.ts +0 -4
- package/subscriptions/security/roles.js +0 -64
- package/subscriptions/security/roles.js.map +0 -1
- package/subscriptions/security/teams.d.ts +0 -4
- package/subscriptions/security/teams.js +0 -64
- package/subscriptions/security/teams.js.map +0 -1
- package/subscriptions/security/users.d.ts +0 -4
- package/subscriptions/security/users.js +0 -64
- package/subscriptions/security/users.js.map +0 -1
- package/utils/compressor.d.ts +0 -11
- package/utils/compressor.js +0 -109
- package/utils/compressor.js.map +0 -1
package/README.md
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
# @webiny/api-audit-logs
|
|
1
|
+
# @webiny/api-audit-logs
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/abstractions.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
// TODO: this is a bridge for legacy context; needs review and refactor of code that uses it.
|
|
3
|
+
|
|
4
|
+
export const AuditLogsContext = createAbstraction("AuditLogsContext");
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","AuditLogsContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { AuditLogsContext as Context } from \"~/types.js\";\n\n// TODO: this is a bridge for legacy context; needs review and refactor of code that uses it.\n\nexport const AuditLogsContext = createAbstraction<Context>(\"AuditLogsContext\");\n\nexport namespace AuditLogsContext {\n export type Interface = Context;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAGvD;;AAEA,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAU,kBAAkB,CAAC","ignoreList":[]}
|
package/config.d.ts
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import { App } from "./types";
|
|
2
|
-
export declare enum ActionType {
|
|
3
|
-
CREATE = "CREATE",
|
|
4
|
-
UPDATE = "UPDATE",
|
|
5
|
-
DELETE = "DELETE",
|
|
6
|
-
MOVE_TO_TRASH = "MOVE_TO_TRASH",
|
|
7
|
-
RESTORE_FROM_TRASH = "RESTORE_FROM_TRASH",
|
|
8
|
-
PUBLISH = "PUBLISH",
|
|
9
|
-
UNPUBLISH = "UNPUBLISH",
|
|
10
|
-
IMPORT = "IMPORT",
|
|
11
|
-
EXPORT = "EXPORT"
|
|
12
|
-
}
|
|
13
|
-
export declare const auditLogsApps: App[];
|
|
14
1
|
export declare const AUDIT: import("./types").AuditObject;
|
package/config.js
CHANGED
|
@@ -1,293 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.auditLogsApps = exports.ActionType = exports.AUDIT = void 0;
|
|
7
|
-
var _getAuditObject = require("./utils/getAuditObject");
|
|
8
|
-
let ActionType = exports.ActionType = /*#__PURE__*/function (ActionType) {
|
|
9
|
-
ActionType["CREATE"] = "CREATE";
|
|
10
|
-
ActionType["UPDATE"] = "UPDATE";
|
|
11
|
-
ActionType["DELETE"] = "DELETE";
|
|
12
|
-
ActionType["MOVE_TO_TRASH"] = "MOVE_TO_TRASH";
|
|
13
|
-
ActionType["RESTORE_FROM_TRASH"] = "RESTORE_FROM_TRASH";
|
|
14
|
-
ActionType["PUBLISH"] = "PUBLISH";
|
|
15
|
-
ActionType["UNPUBLISH"] = "UNPUBLISH";
|
|
16
|
-
ActionType["IMPORT"] = "IMPORT";
|
|
17
|
-
ActionType["EXPORT"] = "EXPORT";
|
|
18
|
-
return ActionType;
|
|
19
|
-
}({});
|
|
20
|
-
const commonActions = {
|
|
21
|
-
CREATE: {
|
|
22
|
-
type: ActionType.CREATE,
|
|
23
|
-
displayName: "Create"
|
|
24
|
-
},
|
|
25
|
-
UPDATE: {
|
|
26
|
-
type: ActionType.UPDATE,
|
|
27
|
-
displayName: "Update"
|
|
28
|
-
},
|
|
29
|
-
DELETE: {
|
|
30
|
-
type: ActionType.DELETE,
|
|
31
|
-
displayName: "Delete"
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const publishActions = {
|
|
35
|
-
PUBLISH: {
|
|
36
|
-
type: ActionType.PUBLISH,
|
|
37
|
-
displayName: "Publish"
|
|
38
|
-
},
|
|
39
|
-
UNPUBLISH: {
|
|
40
|
-
type: ActionType.UNPUBLISH,
|
|
41
|
-
displayName: "Unpublish"
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const importExportActions = {
|
|
45
|
-
IMPORT: {
|
|
46
|
-
type: ActionType.IMPORT,
|
|
47
|
-
displayName: "Import"
|
|
48
|
-
},
|
|
49
|
-
EXPORT: {
|
|
50
|
-
type: ActionType.EXPORT,
|
|
51
|
-
displayName: "Export"
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const trashBinActions = {
|
|
55
|
-
MOVE_TO_TRASH: {
|
|
56
|
-
type: ActionType.MOVE_TO_TRASH,
|
|
57
|
-
displayName: "Move to trash"
|
|
58
|
-
},
|
|
59
|
-
RESTORE_FROM_TRASH: {
|
|
60
|
-
type: ActionType.RESTORE_FROM_TRASH,
|
|
61
|
-
displayName: "Restore from trash"
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const auditLogsApps = exports.auditLogsApps = [{
|
|
65
|
-
app: "APW",
|
|
66
|
-
displayName: "APW",
|
|
67
|
-
entities: [{
|
|
68
|
-
type: "CHANGE_REQUEST",
|
|
69
|
-
displayName: "Change Request",
|
|
70
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE, {
|
|
71
|
-
type: "MARK_RESOLVED",
|
|
72
|
-
displayName: "Mark resolved"
|
|
73
|
-
}, {
|
|
74
|
-
type: "MARK_UNRESOLVED",
|
|
75
|
-
displayName: "Mark unresolved"
|
|
76
|
-
}]
|
|
77
|
-
}, {
|
|
78
|
-
type: "COMMENT",
|
|
79
|
-
displayName: "Comment",
|
|
80
|
-
actions: [commonActions.CREATE]
|
|
81
|
-
}, {
|
|
82
|
-
type: "CONTENT_REVIEW",
|
|
83
|
-
displayName: "Content Review",
|
|
84
|
-
linkToEntity(id) {
|
|
85
|
-
return `/apw/content-reviews/${id}`;
|
|
86
|
-
},
|
|
87
|
-
actions: [commonActions.CREATE]
|
|
88
|
-
}, {
|
|
89
|
-
type: "WORKFLOW",
|
|
90
|
-
displayName: "Workflow",
|
|
91
|
-
linkToEntity(id) {
|
|
92
|
-
return `/apw/publishing-workflows?id=${id}`;
|
|
93
|
-
},
|
|
94
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
95
|
-
}]
|
|
96
|
-
}, {
|
|
97
|
-
app: "FILE_MANAGER",
|
|
98
|
-
displayName: "File Manager",
|
|
99
|
-
entities: [{
|
|
100
|
-
type: "FILE",
|
|
101
|
-
displayName: "File",
|
|
102
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
103
|
-
}, {
|
|
104
|
-
type: "FILE_FOLDER",
|
|
105
|
-
displayName: "File folder",
|
|
106
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
107
|
-
}, {
|
|
108
|
-
type: "SETTINGS",
|
|
109
|
-
displayName: "Settings",
|
|
110
|
-
actions: [commonActions.UPDATE]
|
|
111
|
-
}]
|
|
112
|
-
}, {
|
|
113
|
-
app: "FORM_BUILDER",
|
|
114
|
-
displayName: "Form Builder",
|
|
115
|
-
entities: [{
|
|
116
|
-
type: "FORM",
|
|
117
|
-
displayName: "Form",
|
|
118
|
-
linkToEntity(id) {
|
|
119
|
-
return `/form-builder/forms?id=${id}`;
|
|
120
|
-
},
|
|
121
|
-
actions: [commonActions.CREATE, commonActions.DELETE, importExportActions.EXPORT, importExportActions.IMPORT]
|
|
122
|
-
}, {
|
|
123
|
-
type: "FORM_REVISION",
|
|
124
|
-
displayName: "Form revision",
|
|
125
|
-
linkToEntity(id) {
|
|
126
|
-
return `/form-builder/forms?id=${id}`;
|
|
127
|
-
},
|
|
128
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE, publishActions.PUBLISH, publishActions.UNPUBLISH]
|
|
129
|
-
}, {
|
|
130
|
-
type: "FORM_SUBMISSION",
|
|
131
|
-
displayName: "Form submission",
|
|
132
|
-
actions: [importExportActions.EXPORT]
|
|
133
|
-
}, {
|
|
134
|
-
type: "SETTINGS",
|
|
135
|
-
displayName: "Settings",
|
|
136
|
-
actions: [commonActions.UPDATE]
|
|
137
|
-
}]
|
|
138
|
-
}, {
|
|
139
|
-
app: "HEADLESS_CMS",
|
|
140
|
-
displayName: "Headless CMS",
|
|
141
|
-
entities: [{
|
|
142
|
-
type: "ENTRY",
|
|
143
|
-
displayName: "Entry",
|
|
144
|
-
actions: [commonActions.CREATE, commonActions.DELETE, trashBinActions.MOVE_TO_TRASH, trashBinActions.RESTORE_FROM_TRASH]
|
|
145
|
-
}, {
|
|
146
|
-
type: "ENTRY_REVISION",
|
|
147
|
-
displayName: "Entry revision",
|
|
148
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE, publishActions.PUBLISH, publishActions.UNPUBLISH]
|
|
149
|
-
}, {
|
|
150
|
-
type: "GROUP",
|
|
151
|
-
displayName: "Group",
|
|
152
|
-
linkToEntity(id) {
|
|
153
|
-
return `/cms/content-model-groups?id=${id}`;
|
|
154
|
-
},
|
|
155
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
156
|
-
}, {
|
|
157
|
-
type: "MODEL",
|
|
158
|
-
displayName: "Model",
|
|
159
|
-
linkToEntity(modelId) {
|
|
160
|
-
return `/cms/content-models/${modelId}`;
|
|
161
|
-
},
|
|
162
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
163
|
-
}, {
|
|
164
|
-
type: "MODEL_FOLDER",
|
|
165
|
-
displayName: "Model folder",
|
|
166
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
167
|
-
}]
|
|
168
|
-
}, {
|
|
169
|
-
app: "I18N",
|
|
170
|
-
displayName: "i18n",
|
|
171
|
-
entities: [{
|
|
172
|
-
type: "LOCALE",
|
|
173
|
-
displayName: "Locale",
|
|
174
|
-
linkToEntity(id) {
|
|
175
|
-
return `/i18n/locales?code=${id}`;
|
|
176
|
-
},
|
|
177
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
178
|
-
}]
|
|
179
|
-
}, {
|
|
180
|
-
app: "MAILER",
|
|
181
|
-
displayName: "Mailer",
|
|
182
|
-
entities: [{
|
|
183
|
-
type: "SETTINGS",
|
|
184
|
-
displayName: "Settings",
|
|
185
|
-
actions: [commonActions.UPDATE]
|
|
186
|
-
}]
|
|
187
|
-
}, {
|
|
188
|
-
app: "PAGE_BUILDER",
|
|
189
|
-
displayName: "Page Builder",
|
|
190
|
-
entities: [{
|
|
191
|
-
type: "BLOCK",
|
|
192
|
-
displayName: "Block",
|
|
193
|
-
linkToEntity(id) {
|
|
194
|
-
return `/page-builder/block-editor/${id}`;
|
|
195
|
-
},
|
|
196
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE, importExportActions.EXPORT, importExportActions.IMPORT]
|
|
197
|
-
}, {
|
|
198
|
-
type: "BLOCK_CATEGORY",
|
|
199
|
-
displayName: "Block category",
|
|
200
|
-
linkToEntity(slug) {
|
|
201
|
-
return `/page-builder/block-categories?slug=${slug}`;
|
|
202
|
-
},
|
|
203
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
204
|
-
}, {
|
|
205
|
-
type: "CATEGORY",
|
|
206
|
-
displayName: "Category",
|
|
207
|
-
linkToEntity(slug) {
|
|
208
|
-
return `/page-builder/categories?slug=${slug}`;
|
|
209
|
-
},
|
|
210
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
211
|
-
}, {
|
|
212
|
-
type: "MENU",
|
|
213
|
-
displayName: "Menu",
|
|
214
|
-
linkToEntity(slug) {
|
|
215
|
-
return `/page-builder/menus?slug=${slug}`;
|
|
216
|
-
},
|
|
217
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
218
|
-
}, {
|
|
219
|
-
type: "PAGE",
|
|
220
|
-
displayName: "Page",
|
|
221
|
-
linkToEntity(id) {
|
|
222
|
-
return `/page-builder/editor/${id}`;
|
|
223
|
-
},
|
|
224
|
-
actions: [commonActions.CREATE, commonActions.DELETE, importExportActions.EXPORT, importExportActions.IMPORT]
|
|
225
|
-
}, {
|
|
226
|
-
type: "PAGE_ELEMENT",
|
|
227
|
-
displayName: "Page element",
|
|
228
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
229
|
-
}, {
|
|
230
|
-
type: "PAGE_FOLDER",
|
|
231
|
-
displayName: "Page folder",
|
|
232
|
-
linkToEntity(id) {
|
|
233
|
-
return `/page-builder/pages?folderId=${id}`;
|
|
234
|
-
},
|
|
235
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
236
|
-
}, {
|
|
237
|
-
type: "PAGE_REVISION",
|
|
238
|
-
displayName: "Page revision",
|
|
239
|
-
linkToEntity(id) {
|
|
240
|
-
return `/page-builder/editor/${id}`;
|
|
241
|
-
},
|
|
242
|
-
actions: [commonActions.CREATE, {
|
|
243
|
-
...commonActions.UPDATE,
|
|
244
|
-
newEntryDelay: 60
|
|
245
|
-
}, commonActions.DELETE, publishActions.PUBLISH, publishActions.UNPUBLISH]
|
|
246
|
-
}, {
|
|
247
|
-
type: "SETTINGS",
|
|
248
|
-
displayName: "Settings",
|
|
249
|
-
actions: [commonActions.UPDATE]
|
|
250
|
-
}, {
|
|
251
|
-
type: "TEMPLATE",
|
|
252
|
-
displayName: "Template",
|
|
253
|
-
linkToEntity(id) {
|
|
254
|
-
return `/page-builder/page-templates?id=${id}`;
|
|
255
|
-
},
|
|
256
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE, importExportActions.EXPORT, importExportActions.IMPORT]
|
|
257
|
-
}]
|
|
258
|
-
}, {
|
|
259
|
-
app: "SECURITY",
|
|
260
|
-
displayName: "Security",
|
|
261
|
-
entities: [{
|
|
262
|
-
type: "API_KEY",
|
|
263
|
-
displayName: "API Key",
|
|
264
|
-
linkToEntity(id) {
|
|
265
|
-
return `/access-management/api-keys?id=${id}`;
|
|
266
|
-
},
|
|
267
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
268
|
-
}, {
|
|
269
|
-
type: "ROLE",
|
|
270
|
-
displayName: "Role",
|
|
271
|
-
linkToEntity(id) {
|
|
272
|
-
return `/access-management/roles?id=${id}`;
|
|
273
|
-
},
|
|
274
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
275
|
-
}, {
|
|
276
|
-
type: "TEAM",
|
|
277
|
-
displayName: "Team",
|
|
278
|
-
linkToEntity(id) {
|
|
279
|
-
return `/access-management/teams?id=${id}`;
|
|
280
|
-
},
|
|
281
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
282
|
-
}, {
|
|
283
|
-
type: "USER",
|
|
284
|
-
displayName: "User",
|
|
285
|
-
linkToEntity(id) {
|
|
286
|
-
return `/admin-users?id=${id}`;
|
|
287
|
-
},
|
|
288
|
-
actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]
|
|
289
|
-
}]
|
|
290
|
-
}];
|
|
291
|
-
const AUDIT = exports.AUDIT = (0, _getAuditObject.getAuditObject)(auditLogsApps);
|
|
1
|
+
import { getAuditObject } from "./utils/getAuditObject.js";
|
|
2
|
+
import { apps } from "@webiny/common-audit-logs";
|
|
3
|
+
export const AUDIT = getAuditObject(apps);
|
|
292
4
|
|
|
293
5
|
//# sourceMappingURL=config.js.map
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getAuditObject","require","ActionType","exports","commonActions","CREATE","type","displayName","UPDATE","DELETE","publishActions","PUBLISH","UNPUBLISH","importExportActions","IMPORT","EXPORT","trashBinActions","MOVE_TO_TRASH","RESTORE_FROM_TRASH","auditLogsApps","app","entities","actions","linkToEntity","id","modelId","slug","newEntryDelay","AUDIT","getAuditObject"],"sources":["config.ts"],"sourcesContent":["import { getAuditObject } from \"~/utils/getAuditObject\";\nimport { App } from \"~/types\";\n\nexport enum ActionType {\n CREATE = \"CREATE\",\n UPDATE = \"UPDATE\",\n DELETE = \"DELETE\",\n MOVE_TO_TRASH = \"MOVE_TO_TRASH\",\n RESTORE_FROM_TRASH = \"RESTORE_FROM_TRASH\",\n PUBLISH = \"PUBLISH\",\n UNPUBLISH = \"UNPUBLISH\",\n IMPORT = \"IMPORT\",\n EXPORT = \"EXPORT\"\n}\n\nconst commonActions = {\n CREATE: { type: ActionType.CREATE, displayName: \"Create\" },\n UPDATE: { type: ActionType.UPDATE, displayName: \"Update\" },\n DELETE: { type: ActionType.DELETE, displayName: \"Delete\" }\n};\n\nconst publishActions = {\n PUBLISH: { type: ActionType.PUBLISH, displayName: \"Publish\" },\n UNPUBLISH: { type: ActionType.UNPUBLISH, displayName: \"Unpublish\" }\n};\n\nconst importExportActions = {\n IMPORT: { type: ActionType.IMPORT, displayName: \"Import\" },\n EXPORT: { type: ActionType.EXPORT, displayName: \"Export\" }\n};\n\nconst trashBinActions = {\n MOVE_TO_TRASH: { type: ActionType.MOVE_TO_TRASH, displayName: \"Move to trash\" },\n RESTORE_FROM_TRASH: { type: ActionType.RESTORE_FROM_TRASH, displayName: \"Restore from trash\" }\n};\n\nexport const auditLogsApps: App[] = [\n {\n app: \"APW\",\n displayName: \"APW\",\n entities: [\n {\n type: \"CHANGE_REQUEST\",\n displayName: \"Change Request\",\n actions: [\n commonActions.CREATE,\n commonActions.UPDATE,\n commonActions.DELETE,\n { type: \"MARK_RESOLVED\", displayName: \"Mark resolved\" },\n { type: \"MARK_UNRESOLVED\", displayName: \"Mark unresolved\" }\n ]\n },\n {\n type: \"COMMENT\",\n displayName: \"Comment\",\n actions: [commonActions.CREATE]\n },\n {\n type: \"CONTENT_REVIEW\",\n displayName: \"Content Review\",\n linkToEntity(id) {\n return `/apw/content-reviews/${id}`;\n },\n actions: [commonActions.CREATE]\n },\n {\n type: \"WORKFLOW\",\n displayName: \"Workflow\",\n linkToEntity(id) {\n return `/apw/publishing-workflows?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n }\n ]\n },\n {\n app: \"FILE_MANAGER\",\n displayName: \"File Manager\",\n entities: [\n {\n type: \"FILE\",\n displayName: \"File\",\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"FILE_FOLDER\",\n displayName: \"File folder\",\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"SETTINGS\",\n displayName: \"Settings\",\n actions: [commonActions.UPDATE]\n }\n ]\n },\n {\n app: \"FORM_BUILDER\",\n displayName: \"Form Builder\",\n entities: [\n {\n type: \"FORM\",\n displayName: \"Form\",\n linkToEntity(id) {\n return `/form-builder/forms?id=${id}`;\n },\n actions: [\n commonActions.CREATE,\n commonActions.DELETE,\n importExportActions.EXPORT,\n importExportActions.IMPORT\n ]\n },\n {\n type: \"FORM_REVISION\",\n displayName: \"Form revision\",\n linkToEntity(id) {\n return `/form-builder/forms?id=${id}`;\n },\n actions: [\n commonActions.CREATE,\n commonActions.UPDATE,\n commonActions.DELETE,\n publishActions.PUBLISH,\n publishActions.UNPUBLISH\n ]\n },\n {\n type: \"FORM_SUBMISSION\",\n displayName: \"Form submission\",\n actions: [importExportActions.EXPORT]\n },\n {\n type: \"SETTINGS\",\n displayName: \"Settings\",\n actions: [commonActions.UPDATE]\n }\n ]\n },\n {\n app: \"HEADLESS_CMS\",\n displayName: \"Headless CMS\",\n entities: [\n {\n type: \"ENTRY\",\n displayName: \"Entry\",\n actions: [\n commonActions.CREATE,\n commonActions.DELETE,\n trashBinActions.MOVE_TO_TRASH,\n trashBinActions.RESTORE_FROM_TRASH\n ]\n },\n {\n type: \"ENTRY_REVISION\",\n displayName: \"Entry revision\",\n actions: [\n commonActions.CREATE,\n commonActions.UPDATE,\n commonActions.DELETE,\n publishActions.PUBLISH,\n publishActions.UNPUBLISH\n ]\n },\n {\n type: \"GROUP\",\n displayName: \"Group\",\n linkToEntity(id) {\n return `/cms/content-model-groups?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"MODEL\",\n displayName: \"Model\",\n linkToEntity(modelId) {\n return `/cms/content-models/${modelId}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"MODEL_FOLDER\",\n displayName: \"Model folder\",\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n }\n ]\n },\n {\n app: \"I18N\",\n displayName: \"i18n\",\n entities: [\n {\n type: \"LOCALE\",\n displayName: \"Locale\",\n linkToEntity(id) {\n return `/i18n/locales?code=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n }\n ]\n },\n {\n app: \"MAILER\",\n displayName: \"Mailer\",\n entities: [\n {\n type: \"SETTINGS\",\n displayName: \"Settings\",\n actions: [commonActions.UPDATE]\n }\n ]\n },\n {\n app: \"PAGE_BUILDER\",\n displayName: \"Page Builder\",\n entities: [\n {\n type: \"BLOCK\",\n displayName: \"Block\",\n linkToEntity(id) {\n return `/page-builder/block-editor/${id}`;\n },\n actions: [\n commonActions.CREATE,\n commonActions.UPDATE,\n commonActions.DELETE,\n importExportActions.EXPORT,\n importExportActions.IMPORT\n ]\n },\n {\n type: \"BLOCK_CATEGORY\",\n displayName: \"Block category\",\n linkToEntity(slug) {\n return `/page-builder/block-categories?slug=${slug}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"CATEGORY\",\n displayName: \"Category\",\n linkToEntity(slug) {\n return `/page-builder/categories?slug=${slug}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"MENU\",\n displayName: \"Menu\",\n linkToEntity(slug) {\n return `/page-builder/menus?slug=${slug}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"PAGE\",\n displayName: \"Page\",\n linkToEntity(id) {\n return `/page-builder/editor/${id}`;\n },\n actions: [\n commonActions.CREATE,\n commonActions.DELETE,\n importExportActions.EXPORT,\n importExportActions.IMPORT\n ]\n },\n {\n type: \"PAGE_ELEMENT\",\n displayName: \"Page element\",\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"PAGE_FOLDER\",\n displayName: \"Page folder\",\n linkToEntity(id) {\n return `/page-builder/pages?folderId=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"PAGE_REVISION\",\n displayName: \"Page revision\",\n linkToEntity(id) {\n return `/page-builder/editor/${id}`;\n },\n actions: [\n commonActions.CREATE,\n { ...commonActions.UPDATE, newEntryDelay: 60 },\n commonActions.DELETE,\n publishActions.PUBLISH,\n publishActions.UNPUBLISH\n ]\n },\n {\n type: \"SETTINGS\",\n displayName: \"Settings\",\n actions: [commonActions.UPDATE]\n },\n {\n type: \"TEMPLATE\",\n displayName: \"Template\",\n linkToEntity(id) {\n return `/page-builder/page-templates?id=${id}`;\n },\n actions: [\n commonActions.CREATE,\n commonActions.UPDATE,\n commonActions.DELETE,\n importExportActions.EXPORT,\n importExportActions.IMPORT\n ]\n }\n ]\n },\n {\n app: \"SECURITY\",\n displayName: \"Security\",\n entities: [\n {\n type: \"API_KEY\",\n displayName: \"API Key\",\n linkToEntity(id) {\n return `/access-management/api-keys?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"ROLE\",\n displayName: \"Role\",\n linkToEntity(id) {\n return `/access-management/roles?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"TEAM\",\n displayName: \"Team\",\n linkToEntity(id) {\n return `/access-management/teams?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n },\n {\n type: \"USER\",\n displayName: \"User\",\n linkToEntity(id) {\n return `/admin-users?id=${id}`;\n },\n actions: [commonActions.CREATE, commonActions.UPDATE, commonActions.DELETE]\n }\n ]\n }\n];\n\nexport const AUDIT = getAuditObject(auditLogsApps);\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAAwD,IAG5CC,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAYtB,MAAME,aAAa,GAAG;EAClBC,MAAM,EAAE;IAAEC,IAAI,EAAEJ,UAAU,CAACG,MAAM;IAAEE,WAAW,EAAE;EAAS,CAAC;EAC1DC,MAAM,EAAE;IAAEF,IAAI,EAAEJ,UAAU,CAACM,MAAM;IAAED,WAAW,EAAE;EAAS,CAAC;EAC1DE,MAAM,EAAE;IAAEH,IAAI,EAAEJ,UAAU,CAACO,MAAM;IAAEF,WAAW,EAAE;EAAS;AAC7D,CAAC;AAED,MAAMG,cAAc,GAAG;EACnBC,OAAO,EAAE;IAAEL,IAAI,EAAEJ,UAAU,CAACS,OAAO;IAAEJ,WAAW,EAAE;EAAU,CAAC;EAC7DK,SAAS,EAAE;IAAEN,IAAI,EAAEJ,UAAU,CAACU,SAAS;IAAEL,WAAW,EAAE;EAAY;AACtE,CAAC;AAED,MAAMM,mBAAmB,GAAG;EACxBC,MAAM,EAAE;IAAER,IAAI,EAAEJ,UAAU,CAACY,MAAM;IAAEP,WAAW,EAAE;EAAS,CAAC;EAC1DQ,MAAM,EAAE;IAAET,IAAI,EAAEJ,UAAU,CAACa,MAAM;IAAER,WAAW,EAAE;EAAS;AAC7D,CAAC;AAED,MAAMS,eAAe,GAAG;EACpBC,aAAa,EAAE;IAAEX,IAAI,EAAEJ,UAAU,CAACe,aAAa;IAAEV,WAAW,EAAE;EAAgB,CAAC;EAC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OAAO,EAAE,CAAClB,aAAa,CAACC,MAAM,EAAED,aAAa,CAACI,MAAM,EAAEJ,aAAa,CAACK,MAAM;EAC9E,CAAC,EACD;IACIH,IAAI,EAAE,MAAM;IACZC,WAAW,EAAE,MAAM;IACnBgB,YAAYA,CAACC,EAAE,EAAE;MACb,OAAQ,mBAAkBA,EAAG,EAAC;IAClC,CAAC;IACDF,OAAO,EAAE,CAAClB,aAAa,CAACC,MAAM,EAAED,aAAa,CAACI,MAAM,EAAEJ,aAAa,CAACK,MAAM;EAC9E,CAAC;AAET,CAAC,CACJ;AAEM,MAAMmB,KAAK,GAAAzB,OAAA,CAAAyB,KAAA,GAAG,IAAAC,8BAAc,EAACV,aAAa,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["getAuditObject","apps","AUDIT"],"sources":["config.ts"],"sourcesContent":["import { getAuditObject } from \"~/utils/getAuditObject.js\";\nimport { apps } from \"@webiny/common-audit-logs\";\n\nexport const AUDIT = getAuditObject(apps);\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SAASC,IAAI,QAAQ,2BAA2B;AAEhD,OAAO,MAAMC,KAAK,GAAGF,cAAc,CAACC,IAAI,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuditLogsContext, AuditLogsContextValue } from "../types.js";
|
|
2
|
+
import type { IStorage } from "../storage/abstractions/Storage.js";
|
|
3
|
+
import type { EventPublisher } from "@webiny/api-core/features/EventPublisher";
|
|
4
|
+
export interface IAuditLogsContextValueParams {
|
|
5
|
+
getContext: () => AuditLogsContext;
|
|
6
|
+
deleteLogsAfterDays: number;
|
|
7
|
+
storage: IStorage;
|
|
8
|
+
eventPublisher: EventPublisher.Interface;
|
|
9
|
+
}
|
|
10
|
+
export declare const createAuditLogsContextValue: (params: IAuditLogsContextValueParams) => AuditLogsContextValue;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { convertExpiresAtDaysToDate } from "../utils/expiresAt.js";
|
|
2
|
+
import { mdbid } from "@webiny/utils/mdbid.js";
|
|
3
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/index.js";
|
|
4
|
+
import { AuditLogBeforeCreateEvent, AuditLogAfterCreateEvent, AuditLogBeforeUpdateEvent, AuditLogAfterUpdateEvent } from "../events/index.js";
|
|
5
|
+
class AuditLogsContextValueImpl {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
this.getContext = params.getContext;
|
|
8
|
+
this.deleteLogsAfterDays = params.deleteLogsAfterDays;
|
|
9
|
+
this.storage = params.storage;
|
|
10
|
+
this.eventPublisher = params.eventPublisher;
|
|
11
|
+
}
|
|
12
|
+
async createAuditLog(payload) {
|
|
13
|
+
const context = this.getContext();
|
|
14
|
+
const expiresAt = convertExpiresAtDaysToDate(this.deleteLogsAfterDays);
|
|
15
|
+
const auditLog = {
|
|
16
|
+
id: mdbid(),
|
|
17
|
+
tenant: this.getTenantId(),
|
|
18
|
+
createdBy: this.getIdentity(),
|
|
19
|
+
createdOn: new Date(),
|
|
20
|
+
...payload,
|
|
21
|
+
content: JSON.stringify(payload.content),
|
|
22
|
+
expiresAt
|
|
23
|
+
};
|
|
24
|
+
await this.checkPermissions(auditLog);
|
|
25
|
+
const beforeCreateEvent = new AuditLogBeforeCreateEvent({
|
|
26
|
+
auditLog: auditLog,
|
|
27
|
+
context,
|
|
28
|
+
setAuditLog(input) {
|
|
29
|
+
Object.assign(auditLog, input);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
await this.eventPublisher.publish(beforeCreateEvent);
|
|
33
|
+
const result = await this.storage.store({
|
|
34
|
+
data: auditLog
|
|
35
|
+
});
|
|
36
|
+
if (result.success) {
|
|
37
|
+
const afterCreateEvent = new AuditLogAfterCreateEvent({
|
|
38
|
+
auditLog: auditLog,
|
|
39
|
+
context
|
|
40
|
+
});
|
|
41
|
+
await this.eventPublisher.publish(afterCreateEvent);
|
|
42
|
+
return result.data;
|
|
43
|
+
}
|
|
44
|
+
throw result.error;
|
|
45
|
+
}
|
|
46
|
+
async updateAuditLog(original, payload) {
|
|
47
|
+
const context = this.getContext();
|
|
48
|
+
const auditLog = {
|
|
49
|
+
...original,
|
|
50
|
+
...payload,
|
|
51
|
+
content: payload.content ? JSON.stringify(payload.content) : original.content
|
|
52
|
+
};
|
|
53
|
+
await this.checkPermissions(auditLog);
|
|
54
|
+
const beforeUpdateEvent = new AuditLogBeforeUpdateEvent({
|
|
55
|
+
original,
|
|
56
|
+
auditLog,
|
|
57
|
+
context,
|
|
58
|
+
setAuditLog(input) {
|
|
59
|
+
Object.assign(auditLog, input);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
await this.eventPublisher.publish(beforeUpdateEvent);
|
|
63
|
+
const result = await this.storage.store({
|
|
64
|
+
data: auditLog
|
|
65
|
+
});
|
|
66
|
+
if (result.success) {
|
|
67
|
+
const afterUpdateEvent = new AuditLogAfterUpdateEvent({
|
|
68
|
+
original: original,
|
|
69
|
+
auditLog: auditLog,
|
|
70
|
+
context
|
|
71
|
+
});
|
|
72
|
+
await this.eventPublisher.publish(afterUpdateEvent);
|
|
73
|
+
return result.data;
|
|
74
|
+
}
|
|
75
|
+
throw result.error;
|
|
76
|
+
}
|
|
77
|
+
async getAuditLog(id) {
|
|
78
|
+
const result = await this.storage.fetch({
|
|
79
|
+
id,
|
|
80
|
+
tenant: this.getTenantId()
|
|
81
|
+
});
|
|
82
|
+
if (result.success) {
|
|
83
|
+
await this.checkPermissions(result.data);
|
|
84
|
+
return result.data;
|
|
85
|
+
}
|
|
86
|
+
throw result.error;
|
|
87
|
+
}
|
|
88
|
+
async listAuditLogs(params) {
|
|
89
|
+
const result = await this.storage.list({
|
|
90
|
+
...params,
|
|
91
|
+
tenant: this.getTenantId()
|
|
92
|
+
});
|
|
93
|
+
if (result.success) {
|
|
94
|
+
return {
|
|
95
|
+
items: result.data,
|
|
96
|
+
meta: {
|
|
97
|
+
cursor: result.meta.after || null,
|
|
98
|
+
hasMoreItems: result.meta.hasMoreItems
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
throw result.error;
|
|
103
|
+
}
|
|
104
|
+
async checkPermissions(auditLog) {
|
|
105
|
+
if (!auditLog.action) {
|
|
106
|
+
throw new Error("Audit log action is not defined. Cannot check permissions.");
|
|
107
|
+
}
|
|
108
|
+
const permissions = await this.getContext().security.getPermissions("al.*");
|
|
109
|
+
for (const permission of permissions) {
|
|
110
|
+
if (permission.name === "*") {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (permission.name === "al.*") {
|
|
114
|
+
return;
|
|
115
|
+
} else if (permission.name === `al.${auditLog.action}`) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
throw new NotAuthorizedError({
|
|
120
|
+
message: "You cannot access audit logs."
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
getTenantId() {
|
|
124
|
+
return this.getContext().tenancy.getCurrentTenant().id;
|
|
125
|
+
}
|
|
126
|
+
getIdentity() {
|
|
127
|
+
const identity = this.getContext().security.getIdentity();
|
|
128
|
+
return {
|
|
129
|
+
id: identity.id,
|
|
130
|
+
type: identity.type,
|
|
131
|
+
displayName: identity.displayName || "unknown"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export const createAuditLogsContextValue = params => {
|
|
136
|
+
return new AuditLogsContextValueImpl(params);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=AuditLogsContextValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["convertExpiresAtDaysToDate","mdbid","NotAuthorizedError","AuditLogBeforeCreateEvent","AuditLogAfterCreateEvent","AuditLogBeforeUpdateEvent","AuditLogAfterUpdateEvent","AuditLogsContextValueImpl","constructor","params","getContext","deleteLogsAfterDays","storage","eventPublisher","createAuditLog","payload","context","expiresAt","auditLog","id","tenant","getTenantId","createdBy","getIdentity","createdOn","Date","content","JSON","stringify","checkPermissions","beforeCreateEvent","setAuditLog","input","Object","assign","publish","result","store","data","success","afterCreateEvent","error","updateAuditLog","original","beforeUpdateEvent","afterUpdateEvent","getAuditLog","fetch","listAuditLogs","list","items","meta","cursor","after","hasMoreItems","action","Error","permissions","security","getPermissions","permission","name","message","tenancy","getCurrentTenant","identity","type","displayName","createAuditLogsContextValue"],"sources":["AuditLogsContextValue.ts"],"sourcesContent":["import type {\n AuditLogPayload,\n AuditLogsContext,\n AuditLogsContextValue,\n IListAuditLogsParams,\n IListAuditLogsResult\n} from \"~/types.js\";\nimport { convertExpiresAtDaysToDate } from \"~/utils/expiresAt.js\";\nimport type { IAuditLog, IAuditLogCreatedBy } from \"~/storage/types.js\";\nimport { mdbid } from \"@webiny/utils/mdbid.js\";\nimport type { IStorage, IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport type { EventPublisher } from \"@webiny/api-core/features/EventPublisher\";\nimport {\n AuditLogBeforeCreateEvent,\n AuditLogAfterCreateEvent,\n AuditLogBeforeUpdateEvent,\n AuditLogAfterUpdateEvent\n} from \"~/events/index.js\";\n\nexport interface IAuditLogsContextValueParams {\n getContext: () => AuditLogsContext;\n deleteLogsAfterDays: number;\n storage: IStorage;\n eventPublisher: EventPublisher.Interface;\n}\n\nclass AuditLogsContextValueImpl implements AuditLogsContextValue {\n private readonly getContext;\n public readonly deleteLogsAfterDays;\n private readonly storage: IStorage;\n private readonly eventPublisher: EventPublisher.Interface;\n\n public constructor(params: IAuditLogsContextValueParams) {\n this.getContext = params.getContext;\n this.deleteLogsAfterDays = params.deleteLogsAfterDays;\n this.storage = params.storage;\n this.eventPublisher = params.eventPublisher;\n }\n\n public async createAuditLog(payload: AuditLogPayload): Promise<IAuditLog> {\n const context = this.getContext();\n const expiresAt = convertExpiresAtDaysToDate(this.deleteLogsAfterDays);\n\n const auditLog: IAuditLog = {\n id: mdbid(),\n tenant: this.getTenantId(),\n createdBy: this.getIdentity(),\n createdOn: new Date(),\n ...payload,\n content: JSON.stringify(payload.content),\n expiresAt\n };\n await this.checkPermissions(auditLog);\n\n const beforeCreateEvent = new AuditLogBeforeCreateEvent({\n auditLog: auditLog,\n context,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeCreateEvent);\n\n const result = await this.storage.store({\n data: auditLog\n });\n if (result.success) {\n const afterCreateEvent = new AuditLogAfterCreateEvent({\n auditLog: auditLog,\n context\n });\n await this.eventPublisher.publish(afterCreateEvent);\n return result.data;\n }\n throw result.error;\n }\n\n public async updateAuditLog(\n original: IAuditLog,\n payload: Partial<AuditLogPayload>\n ): Promise<IAuditLog> {\n const context = this.getContext();\n const auditLog: IAuditLog = {\n ...original,\n ...payload,\n content: payload.content ? JSON.stringify(payload.content) : original.content\n };\n await this.checkPermissions(auditLog);\n\n const beforeUpdateEvent = new AuditLogBeforeUpdateEvent({\n original,\n auditLog,\n context,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeUpdateEvent);\n\n const result = await this.storage.store({\n data: auditLog\n });\n if (result.success) {\n const afterUpdateEvent = new AuditLogAfterUpdateEvent({\n original: original,\n auditLog: auditLog,\n context\n });\n await this.eventPublisher.publish(afterUpdateEvent);\n return result.data;\n }\n throw result.error;\n }\n\n public async getAuditLog(id: string): Promise<IAuditLog | null> {\n const result = await this.storage.fetch({\n id,\n tenant: this.getTenantId()\n });\n if (result.success) {\n await this.checkPermissions(result.data);\n return result.data;\n }\n throw result.error;\n }\n\n public async listAuditLogs(params: IListAuditLogsParams): Promise<IListAuditLogsResult> {\n const result = await this.storage.list({\n ...params,\n tenant: this.getTenantId()\n } as unknown as IStorageListParams);\n if (result.success) {\n return {\n items: result.data,\n meta: {\n cursor: result.meta.after || null,\n hasMoreItems: result.meta.hasMoreItems\n }\n };\n }\n throw result.error;\n }\n\n private async checkPermissions(auditLog: Pick<IAuditLog, \"action\">): Promise<void> {\n if (!auditLog.action) {\n throw new Error(\"Audit log action is not defined. Cannot check permissions.\");\n }\n const permissions = await this.getContext().security.getPermissions(\"al.*\");\n for (const permission of permissions) {\n if (permission.name === \"*\") {\n return;\n }\n if (permission.name === \"al.*\") {\n return;\n } else if (permission.name === `al.${auditLog.action}`) {\n return;\n }\n }\n\n throw new NotAuthorizedError({\n message: \"You cannot access audit logs.\"\n });\n }\n\n private getTenantId(): string {\n return this.getContext().tenancy.getCurrentTenant().id;\n }\n\n private getIdentity(): IAuditLogCreatedBy {\n const identity = this.getContext().security.getIdentity();\n return {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName || \"unknown\"\n };\n }\n}\n\nexport const createAuditLogsContextValue = (\n params: IAuditLogsContextValueParams\n): AuditLogsContextValue => {\n return new AuditLogsContextValueImpl(params);\n};\n"],"mappings":"AAOA,SAASA,0BAA0B;AAEnC,SAASC,KAAK,QAAQ,wBAAwB;AAE9C,SAASC,kBAAkB,QAAQ,oDAAoD;AAEvF,SACIC,yBAAyB,EACzBC,wBAAwB,EACxBC,yBAAyB,EACzBC,wBAAwB;AAU5B,MAAMC,yBAAyB,CAAkC;EAMtDC,WAAWA,CAACC,MAAoC,EAAE;IACrD,IAAI,CAACC,UAAU,GAAGD,MAAM,CAACC,UAAU;IACnC,IAAI,CAACC,mBAAmB,GAAGF,MAAM,CAACE,mBAAmB;IACrD,IAAI,CAACC,OAAO,GAAGH,MAAM,CAACG,OAAO;IAC7B,IAAI,CAACC,cAAc,GAAGJ,MAAM,CAACI,cAAc;EAC/C;EAEA,MAAaC,cAAcA,CAACC,OAAwB,EAAsB;IACtE,MAAMC,OAAO,GAAG,IAAI,CAACN,UAAU,CAAC,CAAC;IACjC,MAAMO,SAAS,GAAGjB,0BAA0B,CAAC,IAAI,CAACW,mBAAmB,CAAC;IAEtE,MAAMO,QAAmB,GAAG;MACxBC,EAAE,EAAElB,KAAK,CAAC,CAAC;MACXmB,MAAM,EAAE,IAAI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AAE8C,QAAQ,CAAC9C,EAAE;MACf+C,IAAI,EAAED,QAAQ,CAACC,IAAI;MACnBC,WAAW,EAAEF,QAAQ,CAACE,WAAW,IAAI;IACzC,CAAC;EACL;AACJ;AAEA,OAAO,MAAMC,2BAA2B,GACpC3D,MAAoC,IACZ;EACxB,OAAO,IAAIF,yBAAyB,CAACE,MAAM,CAAC;AAChD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContextPlugin } from "@webiny/api";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
3
|
+
import type { AuditLogsContext } from "../types.js";
|
|
4
|
+
export interface ISetupContextOptions {
|
|
5
|
+
deleteLogsAfterDays: number | undefined;
|
|
6
|
+
tableName: string | undefined;
|
|
7
|
+
documentClient: DynamoDBDocument | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare const createAuditLogsContext: (params?: ISetupContextOptions) => ContextPlugin<AuditLogsContext>;
|
package/context/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ContextPlugin } from "@webiny/api";
|
|
2
|
+
import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
|
|
3
|
+
import { createAuditLogsContextValue } from "./AuditLogsContextValue.js";
|
|
4
|
+
import { createStorage } from "../storage/Storage.js";
|
|
5
|
+
const getDeleteLogsAfterDays = days => {
|
|
6
|
+
if (days && days > 0) {
|
|
7
|
+
return days;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Default days to delete logs after.
|
|
11
|
+
*/
|
|
12
|
+
return 60;
|
|
13
|
+
};
|
|
14
|
+
export const createAuditLogsContext = params => {
|
|
15
|
+
const plugin = new ContextPlugin(async context => {
|
|
16
|
+
const storage = createStorage({
|
|
17
|
+
tableName: params?.tableName,
|
|
18
|
+
client: params?.documentClient || context.db.driver.getClient(),
|
|
19
|
+
compressor: context.compressor
|
|
20
|
+
});
|
|
21
|
+
const eventPublisher = context.container.resolve(EventPublisher);
|
|
22
|
+
context.auditLogs = createAuditLogsContextValue({
|
|
23
|
+
getContext: () => {
|
|
24
|
+
return context;
|
|
25
|
+
},
|
|
26
|
+
deleteLogsAfterDays: getDeleteLogsAfterDays(params?.deleteLogsAfterDays),
|
|
27
|
+
storage,
|
|
28
|
+
eventPublisher
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
plugin.name = "audit-logs.createContext";
|
|
32
|
+
return plugin;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ContextPlugin","EventPublisher","createAuditLogsContextValue","createStorage","getDeleteLogsAfterDays","days","createAuditLogsContext","params","plugin","context","storage","tableName","client","documentClient","db","driver","getClient","compressor","eventPublisher","container","resolve","auditLogs","getContext","deleteLogsAfterDays","name"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { EventPublisher } from \"@webiny/api-core/features/EventPublisher\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { AuditLogsContext } from \"~/types.js\";\nimport { createAuditLogsContextValue } from \"./AuditLogsContextValue.js\";\nimport { createStorage } from \"~/storage/Storage.js\";\n\nexport interface ISetupContextOptions {\n deleteLogsAfterDays: number | undefined;\n tableName: string | undefined;\n documentClient: DynamoDBDocument | undefined;\n}\n\nconst getDeleteLogsAfterDays = (days?: number): number => {\n if (days && days > 0) {\n return days;\n }\n /**\n * Default days to delete logs after.\n */\n return 60;\n};\n\nexport const createAuditLogsContext = (params?: ISetupContextOptions) => {\n const plugin = new ContextPlugin<AuditLogsContext>(async context => {\n const storage = createStorage({\n tableName: params?.tableName,\n client: params?.documentClient || (context.db.driver.getClient() as DynamoDBDocument),\n compressor: context.compressor\n });\n\n const eventPublisher = context.container.resolve(EventPublisher);\n\n context.auditLogs = createAuditLogsContextValue({\n getContext: () => {\n return context;\n },\n deleteLogsAfterDays: getDeleteLogsAfterDays(params?.deleteLogsAfterDays),\n storage,\n eventPublisher\n });\n });\n\n plugin.name = \"audit-logs.createContext\";\n\n return plugin;\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,cAAc,QAAQ,0CAA0C;AAGzE,SAASC,2BAA2B;AACpC,SAASC,aAAa;AAQtB,MAAMC,sBAAsB,GAAIC,IAAa,IAAa;EACtD,IAAIA,IAAI,IAAIA,IAAI,GAAG,CAAC,EAAE;IAClB,OAAOA,IAAI;EACf;EACA;AACJ;AACA;EACI,OAAO,EAAE;AACb,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAIC,MAA6B,IAAK;EACrE,MAAMC,MAAM,GAAG,IAAIR,aAAa,CAAmB,MAAMS,OAAO,IAAI;IAChE,MAAMC,OAAO,GAAGP,aAAa,CAAC;MAC1BQ,SAAS,EAAEJ,MAAM,EAAEI,SAAS;MAC5BC,MAAM,EAAEL,MAAM,EAAEM,cAAc,IAAKJ,OAAO,CAACK,EAAE,CAACC,MAAM,CAACC,SAAS,CAAC,CAAsB;MACrFC,UAAU,EAAER,OAAO,CAACQ;IACxB,CAAC,CAAC;IAEF,MAAMC,cAAc,GAAGT,OAAO,CAACU,SAAS,CAACC,OAAO,CAACnB,cAAc,CAAC;IAEhEQ,OAAO,CAACY,SAAS,GAAGnB,2BAA2B,CAAC;MAC5CoB,UAAU,EAAEA,CAAA,KAAM;QACd,OAAOb,OAAO;MAClB,CAAC;MACDc,mBAAmB,EAAEnB,sBAAsB,CAACG,MAAM,EAAEgB,mBAAmB,CAAC;MACxEb,OAAO;MACPQ;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFV,MAAM,CAACgB,IAAI,GAAG,0BAA0B;EAExC,OAAOhB,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
|
|
2
|
+
import { AuditLogAfterCreatePayload } from "./abstractions.js";
|
|
3
|
+
export declare class AuditLogAfterCreateEvent extends DomainEvent<AuditLogAfterCreatePayload> {
|
|
4
|
+
eventType: "auditLog.afterCreate";
|
|
5
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<AuditLogAfterCreatePayload>>>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
|
|
2
|
+
import { AuditLogAfterCreateHandler } from "./abstractions.js";
|
|
3
|
+
export class AuditLogAfterCreateEvent extends DomainEvent {
|
|
4
|
+
eventType = "auditLog.afterCreate";
|
|
5
|
+
getHandlerAbstraction() {
|
|
6
|
+
return AuditLogAfterCreateHandler;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=AuditLogAfterCreateEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DomainEvent","AuditLogAfterCreateHandler","AuditLogAfterCreateEvent","eventType","getHandlerAbstraction"],"sources":["AuditLogAfterCreateEvent.ts"],"sourcesContent":["import { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport { AuditLogAfterCreateHandler, AuditLogAfterCreatePayload } from \"./abstractions.js\";\n\nexport class AuditLogAfterCreateEvent extends DomainEvent<AuditLogAfterCreatePayload> {\n eventType = \"auditLog.afterCreate\" as const;\n\n getHandlerAbstraction() {\n return AuditLogAfterCreateHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0CAA0C;AACtE,SAASC,0BAA0B;AAEnC,OAAO,MAAMC,wBAAwB,SAASF,WAAW,CAA6B;EAClFG,SAAS,GAAG,sBAAsB;EAElCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOH,0BAA0B;EACrC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
|
|
2
|
+
import { AuditLogAfterUpdatePayload } from "./abstractions.js";
|
|
3
|
+
export declare class AuditLogAfterUpdateEvent extends DomainEvent<AuditLogAfterUpdatePayload> {
|
|
4
|
+
eventType: "auditLog.afterUpdate";
|
|
5
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<DomainEvent<AuditLogAfterUpdatePayload>>>;
|
|
6
|
+
}
|