@webiny/api-audit-logs 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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 +9 -4
- package/abstractions.js +2 -2
- package/abstractions.js.map +1 -1
- package/domain/errors.d.ts +5 -0
- package/domain/errors.js +11 -0
- package/domain/errors.js.map +1 -0
- package/events/abstractions.d.ts +0 -5
- package/events/abstractions.js.map +1 -1
- package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
- package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
- package/features/AuditLogPermissions/abstractions.d.ts +11 -0
- package/features/AuditLogPermissions/abstractions.js +5 -0
- package/features/AuditLogPermissions/abstractions.js.map +1 -0
- package/features/AuditLogPermissions/feature.d.ts +4 -0
- package/features/AuditLogPermissions/feature.js +11 -0
- package/features/AuditLogPermissions/feature.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
- package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
- package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
- package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
- package/features/CreateAuditLog/abstractions.d.ts +42 -0
- package/features/CreateAuditLog/abstractions.js +7 -0
- package/features/CreateAuditLog/abstractions.js.map +1 -0
- package/features/CreateAuditLog/feature.d.ts +4 -0
- package/features/CreateAuditLog/feature.js +15 -0
- package/features/CreateAuditLog/feature.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
- package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
- package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
- package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
- package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
- package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
- package/features/GetAuditLog/GetAuditLogUseCase.js +29 -0
- package/features/GetAuditLog/GetAuditLogUseCase.js.map +1 -0
- package/features/GetAuditLog/abstractions.d.ts +42 -0
- package/features/GetAuditLog/abstractions.js +7 -0
- package/features/GetAuditLog/abstractions.js.map +1 -0
- package/features/GetAuditLog/feature.d.ts +4 -0
- package/features/GetAuditLog/feature.js +15 -0
- package/features/GetAuditLog/feature.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.d.ts +12 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.js +24 -0
- package/features/ListAuditLogs/ListAuditLogsGateway.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.d.ts +17 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.js +38 -0
- package/features/ListAuditLogs/ListAuditLogsRepository.js.map +1 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.d.ts +15 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.js +27 -0
- package/features/ListAuditLogs/ListAuditLogsUseCase.js.map +1 -0
- package/features/ListAuditLogs/abstractions.d.ts +55 -0
- package/features/ListAuditLogs/abstractions.js +7 -0
- package/features/ListAuditLogs/abstractions.js.map +1 -0
- package/features/ListAuditLogs/feature.d.ts +4 -0
- package/features/ListAuditLogs/feature.js +15 -0
- package/features/ListAuditLogs/feature.js.map +1 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.d.ts +30 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.js +108 -0
- package/features/RecordAuditLog/RecordAuditLogUseCase.js.map +1 -0
- package/features/RecordAuditLog/abstractions.d.ts +26 -0
- package/features/RecordAuditLog/abstractions.js +5 -0
- package/features/RecordAuditLog/abstractions.js.map +1 -0
- package/features/RecordAuditLog/feature.d.ts +4 -0
- package/features/RecordAuditLog/feature.js +11 -0
- package/features/RecordAuditLog/feature.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.d.ts +12 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.js +23 -0
- package/features/UpdateAuditLog/UpdateAuditLogGateway.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.d.ts +14 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.js +25 -0
- package/features/UpdateAuditLog/UpdateAuditLogRepository.js.map +1 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.d.ts +18 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.js +53 -0
- package/features/UpdateAuditLog/UpdateAuditLogUseCase.js.map +1 -0
- package/features/UpdateAuditLog/abstractions.d.ts +42 -0
- package/features/UpdateAuditLog/abstractions.js +7 -0
- package/features/UpdateAuditLog/abstractions.js.map +1 -0
- package/features/UpdateAuditLog/feature.d.ts +4 -0
- package/features/UpdateAuditLog/feature.js +15 -0
- package/features/UpdateAuditLog/feature.js.map +1 -0
- package/graphql/AuditLogsGraphQLSchema.d.ts +10 -0
- package/graphql/AuditLogsGraphQLSchema.js +139 -0
- package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
- package/index.d.ts +2 -5
- package/index.js +1 -23
- package/package.json +24 -21
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +18 -9
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +35 -13
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +24 -15
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
- package/subscriptions/aco/index.d.ts +2 -2
- package/subscriptions/aco/index.js +4 -4
- package/subscriptions/aco/index.js.map +1 -1
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +3 -3
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +21 -17
- package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -1
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +3 -3
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +18 -14
- package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -1
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +3 -3
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +19 -15
- package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -1
- package/subscriptions/ai/index.d.ts +2 -2
- package/subscriptions/ai/index.js +4 -4
- package/subscriptions/ai/index.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +11 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +11 -7
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +14 -10
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +14 -10
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/index.d.ts +2 -2
- package/subscriptions/fileManager/index.js +5 -5
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +18 -9
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +11 -7
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +3 -3
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +14 -10
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/index.d.ts +2 -2
- package/subscriptions/headlessCms/index.js +15 -15
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +8 -8
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +3 -3
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +13 -9
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
- package/subscriptions/mailer/index.d.ts +2 -2
- package/subscriptions/mailer/index.js +2 -2
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +11 -7
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +14 -10
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/index.d.ts +2 -2
- package/subscriptions/security/index.js +13 -13
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/index.d.ts +2 -2
- package/subscriptions/websiteBuilder/index.js +13 -13
- package/subscriptions/websiteBuilder/index.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +14 -10
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +11 -7
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +14 -10
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +11 -7
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +3 -3
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +14 -10
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
- package/types.d.ts +0 -23
- package/context/AuditLogsContextValue.d.ts +0 -10
- package/context/AuditLogsContextValue.js +0 -129
- package/context/AuditLogsContextValue.js.map +0 -1
- package/context/index.d.ts +0 -6
- package/context/index.js +0 -25
- package/context/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -3
- package/graphql/schema.js +0 -115
- package/graphql/schema.js.map +0 -1
- package/index.js.map +0 -1
- package/utils/getAuditConfig.d.ts +0 -4
- package/utils/getAuditConfig.js +0 -86
- package/utils/getAuditConfig.js.map +0 -1
package/context/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
3
|
-
import { createAuditLogsContextValue } from "./AuditLogsContextValue.js";
|
|
4
|
-
import { AuditLogsStorage } from "../abstractions.js";
|
|
5
|
-
const getDeleteLogsAfterDays = (days)=>{
|
|
6
|
-
if (days && days > 0) return days;
|
|
7
|
-
return 60;
|
|
8
|
-
};
|
|
9
|
-
const createAuditLogsContext = (params)=>{
|
|
10
|
-
const plugin = new ContextPlugin(async (context)=>{
|
|
11
|
-
const storage = context.container.resolve(AuditLogsStorage);
|
|
12
|
-
const eventPublisher = context.container.resolve(EventPublisher);
|
|
13
|
-
context.auditLogs = createAuditLogsContextValue({
|
|
14
|
-
getContext: ()=>context,
|
|
15
|
-
deleteLogsAfterDays: getDeleteLogsAfterDays(params?.deleteLogsAfterDays),
|
|
16
|
-
storage,
|
|
17
|
-
eventPublisher
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
plugin.name = "audit-logs.createContext";
|
|
21
|
-
return plugin;
|
|
22
|
-
};
|
|
23
|
-
export { createAuditLogsContext };
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
package/context/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context/index.js","sources":["../../src/context/index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { AuditLogsContext } from \"~/types.js\";\nimport { createAuditLogsContextValue } from \"./AuditLogsContextValue.js\";\nimport { AuditLogsStorage } from \"~/abstractions.js\";\n\nexport interface ISetupContextOptions {\n deleteLogsAfterDays: number | 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 = context.container.resolve(AuditLogsStorage);\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"],"names":["getDeleteLogsAfterDays","days","createAuditLogsContext","params","plugin","ContextPlugin","context","storage","AuditLogsStorage","eventPublisher","EventPublisher","createAuditLogsContextValue"],"mappings":";;;;AAUA,MAAMA,yBAAyB,CAACC;IAC5B,IAAIA,QAAQA,OAAO,GACf,OAAOA;IAKX,OAAO;AACX;AAEO,MAAMC,yBAAyB,CAACC;IACnC,MAAMC,SAAS,IAAIC,cAAgC,OAAMC;QACrD,MAAMC,UAAUD,QAAQ,SAAS,CAAC,OAAO,CAACE;QAE1C,MAAMC,iBAAiBH,QAAQ,SAAS,CAAC,OAAO,CAACI;QAEjDJ,QAAQ,SAAS,GAAGK,4BAA4B;YAC5C,YAAY,IACDL;YAEX,qBAAqBN,uBAAuBG,QAAQ;YACpDI;YACAE;QACJ;IACJ;IAEAL,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
package/graphql/schema.d.ts
DELETED
package/graphql/schema.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchemaPlugin, NotFoundError, resolve, resolveList } from "@webiny/handler-graphql";
|
|
2
|
-
import { getValidationSchema, listValidationSchema } from "./validation.js";
|
|
3
|
-
import { createZodError } from "@webiny/utils";
|
|
4
|
-
const createGraphQLSchema = ()=>new GraphQLSchemaPlugin({
|
|
5
|
-
isApplicable: (context)=>!!context.auditLogs,
|
|
6
|
-
typeDefs: `
|
|
7
|
-
type AuditLogCreatedBy {
|
|
8
|
-
id: ID!
|
|
9
|
-
displayName: String
|
|
10
|
-
type: String
|
|
11
|
-
}
|
|
12
|
-
type AuditLog {
|
|
13
|
-
id: ID!
|
|
14
|
-
createdBy: AuditLogCreatedBy!
|
|
15
|
-
createdOn: DateTime!
|
|
16
|
-
app: String!
|
|
17
|
-
action: String!
|
|
18
|
-
message: String!
|
|
19
|
-
entity: String!
|
|
20
|
-
entityId: String!
|
|
21
|
-
tags: [String!]!
|
|
22
|
-
expiresAt: DateTime!
|
|
23
|
-
content: String
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type AuditLogListMeta {
|
|
27
|
-
cursor: String
|
|
28
|
-
hasMoreItems: Boolean!
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type AuditLogError {
|
|
32
|
-
code: String
|
|
33
|
-
message: String!
|
|
34
|
-
data: JSON
|
|
35
|
-
stack: String
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type AuditLogListResponse {
|
|
39
|
-
data: [AuditLog!]
|
|
40
|
-
meta: AuditLogListMeta
|
|
41
|
-
error: AuditLogError
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type AuditLogGetResponse {
|
|
45
|
-
data: AuditLog
|
|
46
|
-
error: AuditLogError
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
enum AuditLogsSort {
|
|
50
|
-
ASC
|
|
51
|
-
DESC
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
input ListAuditLogsWhere {
|
|
55
|
-
app: String
|
|
56
|
-
action: String
|
|
57
|
-
createdBy: String
|
|
58
|
-
entity: String
|
|
59
|
-
entityId: String
|
|
60
|
-
createdOn_gte: DateTime
|
|
61
|
-
createdOn_lte: DateTime
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
type AuditLogsQuery {
|
|
65
|
-
getAuditLog(id: ID!): AuditLogGetResponse
|
|
66
|
-
listAuditLogs(
|
|
67
|
-
where: ListAuditLogsWhere
|
|
68
|
-
sort: AuditLogsSort
|
|
69
|
-
limit: Number
|
|
70
|
-
after: String
|
|
71
|
-
): AuditLogListResponse!
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
extend type Query {
|
|
75
|
-
auditLogs: AuditLogsQuery
|
|
76
|
-
}
|
|
77
|
-
`,
|
|
78
|
-
resolvers: {
|
|
79
|
-
Query: {
|
|
80
|
-
auditLogs: ()=>({})
|
|
81
|
-
},
|
|
82
|
-
AuditLogsQuery: {
|
|
83
|
-
async getAuditLog (_, args, context) {
|
|
84
|
-
return resolve(async ()=>{
|
|
85
|
-
const validation = await getValidationSchema.safeParseAsync(args);
|
|
86
|
-
if (!validation.success) throw createZodError(validation.error);
|
|
87
|
-
const result = await context.auditLogs.getAuditLog(validation.data.id);
|
|
88
|
-
if (!result) throw new NotFoundError(`Audit log with id "${validation.data.id}" not found.`);
|
|
89
|
-
return result;
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
async listAuditLogs (_, args, context) {
|
|
93
|
-
return resolveList(async ()=>{
|
|
94
|
-
const validation = await listValidationSchema.safeParseAsync(args);
|
|
95
|
-
if (!validation.success) throw createZodError(validation.error);
|
|
96
|
-
const result = await context.auditLogs.listAuditLogs({
|
|
97
|
-
...validation.data,
|
|
98
|
-
...validation.data.where
|
|
99
|
-
});
|
|
100
|
-
if (result.error) throw result.error;
|
|
101
|
-
return {
|
|
102
|
-
items: result.items,
|
|
103
|
-
meta: {
|
|
104
|
-
...result.meta,
|
|
105
|
-
totalCount: 0
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
export { createGraphQLSchema };
|
|
114
|
-
|
|
115
|
-
//# sourceMappingURL=schema.js.map
|
package/graphql/schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql/schema.js","sources":["../../src/graphql/schema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin, NotFoundError, resolve, resolveList } from \"@webiny/handler-graphql\";\nimport type { AuditLogsContext } from \"~/types.js\";\nimport { getValidationSchema, listValidationSchema } from \"./validation.js\";\nimport { createZodError } from \"@webiny/utils\";\n\ninterface IListAuditLogsWhere {\n app?: string;\n action?: string;\n createdBy?: string;\n entity?: string;\n entityId?: string;\n createdOn_gte?: Date;\n createdOn_lte?: Date;\n}\n\ninterface IListAuditLogsArgs {\n where?: IListAuditLogsWhere;\n sort?: \"ASC\" | \"DESC\";\n limit?: number;\n after?: string;\n}\n\nexport const createGraphQLSchema = () => {\n return new GraphQLSchemaPlugin<AuditLogsContext>({\n isApplicable: context => {\n return !!context.auditLogs;\n },\n typeDefs: `\n type AuditLogCreatedBy {\n id: ID!\n displayName: String\n type: String\n }\n type AuditLog {\n id: ID!\n createdBy: AuditLogCreatedBy!\n createdOn: DateTime!\n app: String!\n action: String!\n message: String!\n entity: String!\n entityId: String!\n tags: [String!]!\n expiresAt: DateTime!\n content: String\n }\n \n type AuditLogListMeta {\n cursor: String\n hasMoreItems: Boolean!\n }\n \n type AuditLogError {\n code: String\n message: String!\n data: JSON\n stack: String\n }\n \n type AuditLogListResponse {\n data: [AuditLog!]\n meta: AuditLogListMeta\n error: AuditLogError\n }\n \n type AuditLogGetResponse {\n data: AuditLog\n error: AuditLogError\n }\n \n enum AuditLogsSort {\n ASC\n DESC\n }\n \n input ListAuditLogsWhere {\n app: String\n action: String\n createdBy: String\n entity: String\n entityId: String\n createdOn_gte: DateTime\n createdOn_lte: DateTime\n }\n \n type AuditLogsQuery {\n getAuditLog(id: ID!): AuditLogGetResponse\n listAuditLogs(\n where: ListAuditLogsWhere\n sort: AuditLogsSort\n limit: Number\n after: String\n ): AuditLogListResponse!\n }\n \n extend type Query {\n auditLogs: AuditLogsQuery\n }\n `,\n resolvers: {\n Query: {\n auditLogs: () => ({})\n },\n AuditLogsQuery: {\n async getAuditLog(_, args, context) {\n return resolve(async () => {\n const validation = await getValidationSchema.safeParseAsync(args);\n\n if (!validation.success) {\n throw createZodError(validation.error);\n }\n\n const result = await context.auditLogs.getAuditLog(validation.data.id);\n if (!result) {\n throw new NotFoundError(\n `Audit log with id \"${validation.data.id}\" not found.`\n );\n }\n return result;\n });\n },\n async listAuditLogs(_, args: IListAuditLogsArgs, context) {\n return resolveList(async () => {\n const validation = await listValidationSchema.safeParseAsync(args);\n if (!validation.success) {\n throw createZodError(validation.error);\n }\n const result = await context.auditLogs.listAuditLogs({\n ...validation.data,\n ...validation.data.where\n });\n if (result.error) {\n throw result.error;\n }\n return {\n items: result.items,\n meta: {\n ...result.meta,\n totalCount: 0\n }\n };\n });\n }\n }\n }\n });\n};\n"],"names":["createGraphQLSchema","GraphQLSchemaPlugin","context","_","args","resolve","validation","getValidationSchema","createZodError","result","NotFoundError","resolveList","listValidationSchema"],"mappings":";;;AAsBO,MAAMA,sBAAsB,IACxB,IAAIC,oBAAsC;QAC7C,cAAcC,CAAAA,UACH,CAAC,CAACA,QAAQ,SAAS;QAE9B,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuEX,CAAC;QACD,WAAW;YACP,OAAO;gBACH,WAAW,IAAO,EAAC;YACvB;YACA,gBAAgB;gBACZ,MAAM,aAAYC,CAAC,EAAEC,IAAI,EAAEF,OAAO;oBAC9B,OAAOG,QAAQ;wBACX,MAAMC,aAAa,MAAMC,oBAAoB,cAAc,CAACH;wBAE5D,IAAI,CAACE,WAAW,OAAO,EACnB,MAAME,eAAeF,WAAW,KAAK;wBAGzC,MAAMG,SAAS,MAAMP,QAAQ,SAAS,CAAC,WAAW,CAACI,WAAW,IAAI,CAAC,EAAE;wBACrE,IAAI,CAACG,QACD,MAAM,IAAIC,cACN,CAAC,mBAAmB,EAAEJ,WAAW,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC;wBAG9D,OAAOG;oBACX;gBACJ;gBACA,MAAM,eAAcN,CAAC,EAAEC,IAAwB,EAAEF,OAAO;oBACpD,OAAOS,YAAY;wBACf,MAAML,aAAa,MAAMM,qBAAqB,cAAc,CAACR;wBAC7D,IAAI,CAACE,WAAW,OAAO,EACnB,MAAME,eAAeF,WAAW,KAAK;wBAEzC,MAAMG,SAAS,MAAMP,QAAQ,SAAS,CAAC,aAAa,CAAC;4BACjD,GAAGI,WAAW,IAAI;4BAClB,GAAGA,WAAW,IAAI,CAAC,KAAK;wBAC5B;wBACA,IAAIG,OAAO,KAAK,EACZ,MAAMA,OAAO,KAAK;wBAEtB,OAAO;4BACH,OAAOA,OAAO,KAAK;4BACnB,MAAM;gCACF,GAAGA,OAAO,IAAI;gCACd,YAAY;4BAChB;wBACJ;oBACJ;gBACJ;YACJ;QACJ;IACJ"}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { createSubscriptionHooks } from \"~/subscriptions/index.js\";\nimport { createAuditLogsContext } from \"~/context/index.js\";\nimport { createGraphQLSchema } from \"~/graphql/schema.js\";\nimport { AuditLogsContext } from \"./abstractions.js\";\n\nexport interface ICreateAuditLogsParams {\n deleteLogsAfterDays?: number | undefined;\n}\n\nexport const createAuditLogs = (params?: ICreateAuditLogsParams) => {\n const subscriptionsPlugin = new ContextPlugin<AuditLogsContext.Interface>(context => {\n if (!context.wcp.canUseFeature(\"auditLogs\")) {\n return;\n }\n\n context.container.registerInstance(AuditLogsContext, context);\n\n createSubscriptionHooks(context);\n });\n\n subscriptionsPlugin.name = \"auditLogs.context.subscriptions\";\n return [\n subscriptionsPlugin,\n createGraphQLSchema(),\n createAuditLogsContext({\n deleteLogsAfterDays: params?.deleteLogsAfterDays\n })\n ];\n};\nexport * from \"~/config.js\";\n"],"names":["createAuditLogs","params","subscriptionsPlugin","ContextPlugin","context","AuditLogsContext","createSubscriptionHooks","createGraphQLSchema","createAuditLogsContext"],"mappings":";;;;;;AAUO,MAAMA,kBAAkB,CAACC;IAC5B,MAAMC,sBAAsB,IAAIC,cAA0CC,CAAAA;QACtE,IAAI,CAACA,QAAQ,GAAG,CAAC,aAAa,CAAC,cAC3B;QAGJA,QAAQ,SAAS,CAAC,gBAAgB,CAACC,kBAAkBD;QAErDE,wBAAwBF;IAC5B;IAEAF,oBAAoB,IAAI,GAAG;IAC3B,OAAO;QACHA;QACAK;QACAC,uBAAuB;YACnB,qBAAqBP,QAAQ;QACjC;KACH;AACL"}
|
|
@@ -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,86 +0,0 @@
|
|
|
1
|
-
import _webiny_error from "@webiny/error";
|
|
2
|
-
const createAuditLog = async (params)=>{
|
|
3
|
-
const { context, payload } = params;
|
|
4
|
-
try {
|
|
5
|
-
return await context.auditLogs.createAuditLog(payload);
|
|
6
|
-
} catch (error) {
|
|
7
|
-
throw _webiny_error.from(error);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
const createAuditLogDelayDate = (delay)=>{
|
|
11
|
-
if (!delay) return;
|
|
12
|
-
const date = new Date();
|
|
13
|
-
date.setTime(date.getTime() - 1000 * delay);
|
|
14
|
-
return date;
|
|
15
|
-
};
|
|
16
|
-
const createOrMergeAuditLog = async (params)=>{
|
|
17
|
-
const { context, payload, delay } = params;
|
|
18
|
-
const results = await context.auditLogs.listAuditLogs({
|
|
19
|
-
app: payload.app,
|
|
20
|
-
entityId: payload.entityId,
|
|
21
|
-
limit: 1,
|
|
22
|
-
createdOn_gte: createAuditLogDelayDate(delay),
|
|
23
|
-
sort: "DESC"
|
|
24
|
-
});
|
|
25
|
-
if (results.error) throw _webiny_error.from(results.error);
|
|
26
|
-
const original = results.items?.[0];
|
|
27
|
-
if (!original) return createAuditLog(params);
|
|
28
|
-
const beforePayloadData = original.content ? JSON.parse(original.content)?.before : void 0;
|
|
29
|
-
const afterPayloadData = payload.content?.after;
|
|
30
|
-
const updatedPayloadData = beforePayloadData ? {
|
|
31
|
-
before: beforePayloadData,
|
|
32
|
-
after: afterPayloadData
|
|
33
|
-
} : payload.content;
|
|
34
|
-
try {
|
|
35
|
-
return await context.auditLogs.updateAuditLog(original, {
|
|
36
|
-
...payload,
|
|
37
|
-
content: updatedPayloadData
|
|
38
|
-
});
|
|
39
|
-
} catch (ex) {
|
|
40
|
-
throw _webiny_error.from(ex);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const getAuditConfig = (audit)=>async (message, content, entityId, context)=>{
|
|
44
|
-
if (context.auditLogs) {
|
|
45
|
-
if (!audit) {
|
|
46
|
-
console.log("No Audit Action defined!");
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
console.log("No AuditLogs defined.");
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
const payload = {
|
|
54
|
-
message,
|
|
55
|
-
app: audit.app.app,
|
|
56
|
-
entityId,
|
|
57
|
-
entity: audit.entity.type,
|
|
58
|
-
action: audit.action.type,
|
|
59
|
-
content,
|
|
60
|
-
tags: []
|
|
61
|
-
};
|
|
62
|
-
const delay = audit.action.newEntryDelay || 0;
|
|
63
|
-
if (!context.security.getIdentity()?.id) {
|
|
64
|
-
console.log("No identity - skipping audit log creation.");
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
return await context.security.withoutAuthorization(async ()=>{
|
|
68
|
-
if (delay > 0) {
|
|
69
|
-
try {
|
|
70
|
-
return await createOrMergeAuditLog({
|
|
71
|
-
context,
|
|
72
|
-
payload,
|
|
73
|
-
delay
|
|
74
|
-
});
|
|
75
|
-
} catch {}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return await createAuditLog({
|
|
79
|
-
context,
|
|
80
|
-
payload
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
export { getAuditConfig };
|
|
85
|
-
|
|
86
|
-
//# sourceMappingURL=getAuditConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils/getAuditConfig.js","sources":["../../src/utils/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"],"names":["createAuditLog","params","context","payload","error","WebinyError","createAuditLogDelayDate","delay","date","Date","createOrMergeAuditLog","results","original","beforePayloadData","JSON","undefined","afterPayloadData","updatedPayloadData","ex","getAuditConfig","audit","message","content","entityId","console"],"mappings":";AAUA,MAAMA,iBAAiB,OAAOC;IAC1B,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGF;IAE7B,IAAI;QACA,OAAO,MAAMC,QAAQ,SAAS,CAAC,cAAc,CAACC;IAClD,EAAE,OAAOC,OAAO;QACZ,MAAMC,cAAAA,IAAgB,CAACD;IAC3B;AACJ;AAQA,MAAME,0BAA0B,CAACC;IAC7B,IAAI,CAACA,OACD;IAEJ,MAAMC,OAAO,IAAIC;IACjBD,KAAK,OAAO,CAACA,KAAK,OAAO,KAAKD,AAAQ,OAARA;IAC9B,OAAOC;AACX;AAEA,MAAME,wBAAwB,OAAOT;IACjC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEI,KAAK,EAAE,GAAGN;IAEpC,MAAMU,UAAU,MAAMT,QAAQ,SAAS,CAAC,aAAa,CAAC;QAClD,KAAKC,QAAQ,GAAG;QAChB,UAAUA,QAAQ,QAAQ;QAC1B,OAAO;QACP,eAAeG,wBAAwBC;QACvC,MAAM;IACV;IACA,IAAII,QAAQ,KAAK,EACb,MAAMN,cAAAA,IAAgB,CAACM,QAAQ,KAAK;IAExC,MAAMC,WAAWD,QAAQ,KAAK,EAAE,CAAC,EAAE;IACnC,IAAI,CAACC,UACD,OAAOZ,eAAeC;IAG1B,MAAMY,oBAAoBD,SAAS,OAAO,GAAGE,KAAK,KAAK,CAACF,SAAS,OAAO,GAAG,SAASG;IAIpF,MAAMC,mBAAmBb,QAAQ,OAAO,EAAE;IAC1C,MAAMc,qBAAqBJ,oBACrB;QACI,QAAQA;QACR,OAAOG;IACX,IACAb,QAAQ,OAAO;IAErB,IAAI;QACA,OAAO,MAAMD,QAAQ,SAAS,CAAC,cAAc,CAACU,UAAU;YACpD,GAAGT,OAAO;YACV,SAASc;QACb;IACJ,EAAE,OAAOC,IAAI;QACT,MAAMb,cAAAA,IAAgB,CAACa;IAC3B;AACJ;AAEO,MAAMC,iBAAiB,CAACC,QACpB,OACHC,SACAC,SACAC,UACArB;QAEA,IAAKA,QAAQ,SAAS,EAGf;YAAA,IAAI,CAACkB,OAAO;gBACfI,QAAQ,GAAG,CAAC;gBACZ,OAAO;YACX;QAAA,OANwB;YACpBA,QAAQ,GAAG,CAAC;YACZ,OAAO;QACX;QAKA,MAAMrB,UAA2B;YAC7BkB;YACA,KAAKD,MAAM,GAAG,CAAC,GAAG;YAClBG;YACA,QAAQH,MAAM,MAAM,CAAC,IAAI;YACzB,QAAQA,MAAM,MAAM,CAAC,IAAI;YACzBE;YACA,MAAM,EAAE;QACZ;QAEA,MAAMf,QAAQa,MAAM,MAAM,CAAC,aAAa,IAAI;QAE5C,IAAI,CAAClB,QAAQ,QAAQ,CAAC,WAAW,IAAI,IAAI;YACrCsB,QAAQ,GAAG,CAAC;YACZ,OAAO;QACX;QAEA,OAAO,MAAMtB,QAAQ,QAAQ,CAAC,oBAAoB,CAAC;YAE/C,IAAIK,QAAQ,GAAG;gBACX,IAAI;oBACA,OAAO,MAAMG,sBAAsB;wBAC/BR;wBACAC;wBACAI;oBACJ;gBACJ,EAAE,OAAM,CAER;gBACA,OAAO;YACX;YACA,OAAO,MAAMP,eAAe;gBACxBE;gBACAC;YACJ;QACJ;IACJ"}
|