@webiny/api-audit-logs 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9
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/abstractions.js +2 -3
- package/abstractions.js.map +1 -1
- package/config.js +2 -1
- package/config.js.map +1 -1
- package/context/AuditLogsContextValue.d.ts +1 -1
- package/context/AuditLogsContextValue.js +115 -125
- package/context/AuditLogsContextValue.js.map +1 -1
- package/context/index.js +23 -27
- package/context/index.js.map +1 -1
- package/events/AuditLogAfterCreateEvent.d.ts +2 -2
- package/events/AuditLogAfterCreateEvent.js +9 -6
- package/events/AuditLogAfterCreateEvent.js.map +1 -1
- package/events/AuditLogAfterUpdateEvent.d.ts +2 -2
- package/events/AuditLogAfterUpdateEvent.js +9 -6
- package/events/AuditLogAfterUpdateEvent.js.map +1 -1
- package/events/AuditLogBeforeCreateEvent.d.ts +2 -2
- package/events/AuditLogBeforeCreateEvent.js +9 -6
- package/events/AuditLogBeforeCreateEvent.js.map +1 -1
- package/events/AuditLogBeforeUpdateEvent.d.ts +2 -2
- package/events/AuditLogBeforeUpdateEvent.js +9 -6
- package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
- package/events/abstractions.d.ts +1 -1
- package/events/abstractions.js +5 -24
- package/events/abstractions.js.map +1 -1
- package/events/index.js +0 -2
- package/graphql/schema.js +37 -48
- package/graphql/schema.js.map +1 -1
- package/graphql/validation.d.ts +10 -53
- package/graphql/validation.js +26 -30
- package/graphql/validation.js.map +1 -1
- package/index.js +18 -15
- package/index.js.map +1 -1
- package/package.json +34 -30
- package/storage/AccessPatternHandler.js +31 -52
- package/storage/AccessPatternHandler.js.map +1 -1
- package/storage/Converter.d.ts +3 -3
- package/storage/Converter.js +45 -48
- package/storage/Converter.js.map +1 -1
- package/storage/Storage.d.ts +2 -2
- package/storage/Storage.js +69 -77
- package/storage/Storage.js.map +1 -1
- package/storage/abstractions/AccessPattern.js +0 -3
- package/storage/abstractions/AccessPatternHandler.js +0 -3
- package/storage/abstractions/Converter.js +0 -3
- package/storage/abstractions/Storage.js +0 -3
- package/storage/accessPatterns/AppAccessPattern.js +31 -25
- package/storage/accessPatterns/AppAccessPattern.js.map +1 -1
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +34 -28
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -1
- package/storage/accessPatterns/AppEntityAccessPattern.js +31 -25
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -1
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +31 -25
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -1
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +34 -28
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -1
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +34 -28
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -1
- package/storage/accessPatterns/BaseAccessPattern.js +47 -69
- package/storage/accessPatterns/BaseAccessPattern.js.map +1 -1
- package/storage/accessPatterns/CreatedByAccessPattern.js +34 -28
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -1
- package/storage/accessPatterns/CreatedOnAccessPattern.js +34 -26
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -1
- package/storage/accessPatterns/DefaultAccessPattern.js +31 -32
- package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -1
- package/storage/accessPatterns/EntityIdAccessPattern.js +32 -27
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -1
- package/storage/accessPatterns/index.js +44 -34
- package/storage/accessPatterns/index.js.map +1 -1
- package/storage/cursorSchema.js +15 -18
- package/storage/cursorSchema.js.map +1 -1
- package/storage/entity.js +115 -122
- package/storage/entity.js.map +1 -1
- package/storage/results/ListErrorResult.js +9 -8
- package/storage/results/ListErrorResult.js.map +1 -1
- package/storage/results/ListSuccessResult.js +13 -12
- package/storage/results/ListSuccessResult.js.map +1 -1
- package/storage/results/index.js +0 -2
- package/storage/startKey.js +4 -5
- package/storage/startKey.js.map +1 -1
- package/storage/types.js +0 -3
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +4 -4
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +27 -26
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +30 -29
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +33 -33
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
- package/subscriptions/aco/index.js +5 -4
- package/subscriptions/aco/index.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +4 -4
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +22 -21
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +22 -21
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +25 -25
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +25 -25
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/index.js +6 -8
- package/subscriptions/fileManager/index.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +26 -29
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +24 -27
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +24 -24
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +24 -24
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/index.js +16 -20
- package/subscriptions/headlessCms/index.js.map +1 -1
- package/subscriptions/index.js +8 -7
- package/subscriptions/index.js.map +1 -1
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +4 -4
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +24 -23
- package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
- package/subscriptions/mailer/index.js +3 -3
- package/subscriptions/mailer/index.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +32 -38
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +32 -38
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +36 -43
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +25 -25
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +25 -25
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +22 -21
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +25 -25
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
- package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
- package/subscriptions/security/index.js +14 -20
- package/subscriptions/security/index.js.map +1 -1
- package/subscriptions/websiteBuilder/index.js +14 -16
- package/subscriptions/websiteBuilder/index.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +24 -24
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +21 -20
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +24 -24
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +21 -20
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +21 -20
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +21 -20
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +4 -4
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +24 -24
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
- package/types.js +0 -3
- package/utils/expiresAt.js +14 -19
- package/utils/expiresAt.js.map +1 -1
- package/utils/getAuditConfig.js +79 -98
- package/utils/getAuditConfig.js.map +1 -1
- package/utils/getAuditObject.js +14 -15
- package/utils/getAuditObject.js.map +1 -1
- package/events/index.js.map +0 -1
- package/storage/abstractions/AccessPattern.js.map +0 -1
- package/storage/abstractions/AccessPatternHandler.js.map +0 -1
- package/storage/abstractions/Converter.js.map +0 -1
- package/storage/abstractions/Storage.js.map +0 -1
- package/storage/results/index.js.map +0 -1
- package/storage/types.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiKeyAfterCreateEventHandler } from "@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
|
-
declare class AuditLogApiKeyAfterCreateHandlerImpl implements
|
|
3
|
+
declare class AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogApiKeyAfterCreateHandler: typeof AuditLogApiKeyAfterCreateHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/CreateApiKey/events").ApiKeyAfterCreateEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { ApiKeyAfterCreateEventHandler } from "@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js";
|
|
3
3
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
4
4
|
import { AUDIT } from "../../../config.js";
|
|
5
5
|
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
createdBy: apiKey.createdBy,
|
|
16
|
-
createdOn: apiKey.createdOn,
|
|
17
|
-
description: apiKey.description,
|
|
18
|
-
name: apiKey.name,
|
|
19
|
-
permissions: apiKey.permissions
|
|
20
|
-
};
|
|
21
|
-
};
|
|
6
|
+
const cleanupApiKey = (apiKey)=>({
|
|
7
|
+
id: apiKey.id,
|
|
8
|
+
slug: apiKey.slug,
|
|
9
|
+
createdBy: apiKey.createdBy,
|
|
10
|
+
createdOn: apiKey.createdOn,
|
|
11
|
+
description: apiKey.description,
|
|
12
|
+
name: apiKey.name,
|
|
13
|
+
permissions: apiKey.permissions
|
|
14
|
+
});
|
|
22
15
|
class AuditLogApiKeyAfterCreateHandlerImpl {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
16
|
+
constructor(context){
|
|
17
|
+
this.context = context;
|
|
18
|
+
}
|
|
19
|
+
async handle(event) {
|
|
20
|
+
try {
|
|
21
|
+
const { apiKey: initialApiKey } = event.payload;
|
|
22
|
+
const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);
|
|
23
|
+
const apiKey = cleanupApiKey(initialApiKey);
|
|
24
|
+
await createAuditLog("API key created", apiKey, apiKey.id, this.context);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw _webiny_error.from(error, {
|
|
27
|
+
message: "Error while executing AuditLogApiKeyAfterCreateHandler",
|
|
28
|
+
code: "AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
39
31
|
}
|
|
40
|
-
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({
|
|
34
|
+
implementation: AuditLogApiKeyAfterCreateHandlerImpl,
|
|
35
|
+
dependencies: [
|
|
36
|
+
AuditLogsContext
|
|
37
|
+
]
|
|
45
38
|
});
|
|
39
|
+
export { AuditLogApiKeyAfterCreateHandler };
|
|
46
40
|
|
|
47
41
|
//# sourceMappingURL=AuditLogApiKeyAfterCreateHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterCreateEventHandler } from \"@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key created\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterCreateHandlerImpl","context","event","initialApiKey","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogApiKeyAfterCreateHandler","ApiKeyAfterCreateEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAC/C,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMP,SAASD,cAAcK;YAE7B,MAAMC,eAAe,mBAAmBL,QAAQA,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO;QAC3E,EAAE,OAAOQ,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiKeyAfterDeleteEventHandler } from "@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
|
-
declare class AuditLogApiKeyAfterDeleteHandlerImpl implements
|
|
3
|
+
declare class AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogApiKeyAfterDeleteHandler: typeof AuditLogApiKeyAfterDeleteHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/DeleteApiKey/events").ApiKeyAfterDeleteEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { ApiKeyAfterDeleteEventHandler } from "@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js";
|
|
3
3
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
4
4
|
import { AUDIT } from "../../../config.js";
|
|
5
5
|
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
createdBy: apiKey.createdBy,
|
|
16
|
-
createdOn: apiKey.createdOn,
|
|
17
|
-
description: apiKey.description,
|
|
18
|
-
name: apiKey.name,
|
|
19
|
-
permissions: apiKey.permissions
|
|
20
|
-
};
|
|
21
|
-
};
|
|
6
|
+
const cleanupApiKey = (apiKey)=>({
|
|
7
|
+
id: apiKey.id,
|
|
8
|
+
slug: apiKey.slug,
|
|
9
|
+
createdBy: apiKey.createdBy,
|
|
10
|
+
createdOn: apiKey.createdOn,
|
|
11
|
+
description: apiKey.description,
|
|
12
|
+
name: apiKey.name,
|
|
13
|
+
permissions: apiKey.permissions
|
|
14
|
+
});
|
|
22
15
|
class AuditLogApiKeyAfterDeleteHandlerImpl {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
16
|
+
constructor(context){
|
|
17
|
+
this.context = context;
|
|
18
|
+
}
|
|
19
|
+
async handle(event) {
|
|
20
|
+
try {
|
|
21
|
+
const { apiKey: initialApiKey } = event.payload;
|
|
22
|
+
const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);
|
|
23
|
+
const apiKey = cleanupApiKey(initialApiKey);
|
|
24
|
+
await createAuditLog("API key deleted", apiKey, apiKey.id, this.context);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw _webiny_error.from(error, {
|
|
27
|
+
message: "Error while executing AuditLogApiKeyAfterDeleteHandler",
|
|
28
|
+
code: "AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
39
31
|
}
|
|
40
|
-
}
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({
|
|
34
|
+
implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
|
|
35
|
+
dependencies: [
|
|
36
|
+
AuditLogsContext
|
|
37
|
+
]
|
|
45
38
|
});
|
|
39
|
+
export { AuditLogApiKeyAfterDeleteHandler };
|
|
46
40
|
|
|
47
41
|
//# sourceMappingURL=AuditLogApiKeyAfterDeleteHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterDeleteEventHandler } from \"@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key deleted\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterDeleteHandlerImpl","context","event","initialApiKey","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogApiKeyAfterDeleteHandler","ApiKeyAfterDeleteEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAC/C,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMP,SAASD,cAAcK;YAE7B,MAAMC,eAAe,mBAAmBL,QAAQA,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO;QAC3E,EAAE,OAAOQ,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
|
-
declare class AuditLogApiKeyAfterUpdateHandlerImpl implements
|
|
3
|
+
declare class AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogApiKeyAfterUpdateHandler: typeof AuditLogApiKeyAfterUpdateHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/UpdateApiKey/events").ApiKeyAfterUpdateEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js";
|
|
3
3
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
4
4
|
import { AUDIT } from "../../../config.js";
|
|
5
5
|
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
createdBy: apiKey.createdBy,
|
|
16
|
-
createdOn: apiKey.createdOn,
|
|
17
|
-
description: apiKey.description,
|
|
18
|
-
name: apiKey.name,
|
|
19
|
-
permissions: apiKey.permissions
|
|
20
|
-
};
|
|
21
|
-
};
|
|
6
|
+
const cleanupApiKey = (apiKey)=>({
|
|
7
|
+
id: apiKey.id,
|
|
8
|
+
slug: apiKey.slug,
|
|
9
|
+
createdBy: apiKey.createdBy,
|
|
10
|
+
createdOn: apiKey.createdOn,
|
|
11
|
+
description: apiKey.description,
|
|
12
|
+
name: apiKey.name,
|
|
13
|
+
permissions: apiKey.permissions
|
|
14
|
+
});
|
|
22
15
|
class AuditLogApiKeyAfterUpdateHandlerImpl {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
code: "AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER"
|
|
43
|
-
});
|
|
16
|
+
constructor(context){
|
|
17
|
+
this.context = context;
|
|
18
|
+
}
|
|
19
|
+
async handle(event) {
|
|
20
|
+
try {
|
|
21
|
+
const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;
|
|
22
|
+
const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);
|
|
23
|
+
const apiKey = cleanupApiKey(initialApiKey);
|
|
24
|
+
const original = cleanupApiKey(initialOriginalApiKey);
|
|
25
|
+
await createAuditLog("API key updated", {
|
|
26
|
+
before: original,
|
|
27
|
+
after: apiKey
|
|
28
|
+
}, apiKey.id, this.context);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
throw _webiny_error.from(error, {
|
|
31
|
+
message: "Error while executing AuditLogApiKeyAfterUpdateHandler",
|
|
32
|
+
code: "AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
44
35
|
}
|
|
45
|
-
}
|
|
46
36
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({
|
|
38
|
+
implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
|
|
39
|
+
dependencies: [
|
|
40
|
+
AuditLogsContext
|
|
41
|
+
]
|
|
50
42
|
});
|
|
43
|
+
export { AuditLogApiKeyAfterUpdateHandler };
|
|
51
44
|
|
|
52
45
|
//# sourceMappingURL=AuditLogApiKeyAfterUpdateHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterUpdateEventHandler } from \"@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n const original = cleanupApiKey(initialOriginalApiKey);\n\n await createAuditLog(\n \"API key updated\",\n {\n before: original,\n after: apiKey\n },\n apiKey.id,\n this.context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterUpdateHandlerImpl","context","event","initialApiKey","initialOriginalApiKey","createAuditLog","getAuditConfig","AUDIT","original","error","WebinyError","AuditLogApiKeyAfterUpdateHandler","ApiKeyAfterUpdateEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,SAASC,aAAa,EAAE,UAAUC,qBAAqB,EAAE,GAAGF,MAAM,OAAO;YACjF,MAAMG,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMR,SAASD,cAAcK;YAC7B,MAAMK,WAAWV,cAAcM;YAE/B,MAAMC,eACF,mBACA;gBACI,QAAQG;gBACR,OAAOT;YACX,GACAA,OAAO,EAAE,EACT,IAAI,CAAC,OAAO;QAEpB,EAAE,OAAOU,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBZ;IAChB,cAAc;QAACa;KAAiB;AACpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
2
|
-
import {
|
|
3
|
-
declare class AuditLogRoleAfterCreateHandlerImpl implements
|
|
2
|
+
import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
|
|
3
|
+
declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: RoleAfterCreateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogRoleAfterCreateHandler: typeof AuditLogRoleAfterCreateHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/CreateRole/events").RoleAfterCreateEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
3
|
import { AUDIT } from "../../../config.js";
|
|
4
4
|
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
5
|
-
import {
|
|
5
|
+
import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
|
|
6
6
|
class AuditLogRoleAfterCreateHandlerImpl {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
7
|
+
constructor(context){
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
async handle(event) {
|
|
11
|
+
try {
|
|
12
|
+
const { role } = event.payload;
|
|
13
|
+
const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);
|
|
14
|
+
await createAuditLog("Role created", role, role.id, this.context);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
throw _webiny_error.from(error, {
|
|
17
|
+
message: "Error while executing AuditLogRoleAfterCreateHandler",
|
|
18
|
+
code: "AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
}
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({
|
|
24
|
+
implementation: AuditLogRoleAfterCreateHandlerImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
AuditLogsContext
|
|
27
|
+
]
|
|
28
28
|
});
|
|
29
|
+
export { AuditLogRoleAfterCreateHandler };
|
|
29
30
|
|
|
30
31
|
//# sourceMappingURL=AuditLogRoleAfterCreateHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { RoleAfterCreateEventHandler } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\n\nclass AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);\n\n await createAuditLog(\"Role created\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({\n implementation: AuditLogRoleAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["AuditLogRoleAfterCreateHandlerImpl","context","event","role","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogRoleAfterCreateHandler","RoleAfterCreateEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAC9B,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;YAEhE,MAAMF,eAAe,gBAAgBD,MAAMA,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO;QACpE,EAAE,OAAOI,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,4BAA4B,oBAAoB,CAAC;IAC3F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
|
-
declare class AuditLogRoleAfterDeleteHandlerImpl implements
|
|
3
|
+
declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: RoleAfterDeleteEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogRoleAfterDeleteHandler: typeof AuditLogRoleAfterDeleteHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/DeleteRole/events").RoleAfterDeleteEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
|
|
3
3
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
4
4
|
import { AUDIT } from "../../../config.js";
|
|
5
5
|
import { getAuditConfig } from "../../../utils/getAuditConfig.js";
|
|
6
6
|
class AuditLogRoleAfterDeleteHandlerImpl {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
7
|
+
constructor(context){
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
async handle(event) {
|
|
11
|
+
try {
|
|
12
|
+
const { role } = event.payload;
|
|
13
|
+
const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);
|
|
14
|
+
await createAuditLog("Role deleted", role, role.id, this.context);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
throw _webiny_error.from(error, {
|
|
17
|
+
message: "Error while executing AuditLogRoleAfterDeleteHandler",
|
|
18
|
+
code: "AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
|
-
}
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({
|
|
24
|
+
implementation: AuditLogRoleAfterDeleteHandlerImpl,
|
|
25
|
+
dependencies: [
|
|
26
|
+
AuditLogsContext
|
|
27
|
+
]
|
|
28
28
|
});
|
|
29
|
+
export { AuditLogRoleAfterDeleteHandler };
|
|
29
30
|
|
|
30
31
|
//# sourceMappingURL=AuditLogRoleAfterDeleteHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterDeleteEventHandler } from \"@webiny/api-core/features/security/roles/DeleteRole/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);\n\n await createAuditLog(\"Role deleted\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogRoleAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["AuditLogRoleAfterDeleteHandlerImpl","context","event","role","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogRoleAfterDeleteHandler","RoleAfterDeleteEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAC9B,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;YAEhE,MAAMF,eAAe,gBAAgBD,MAAMA,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO;QACpE,EAAE,OAAOI,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,4BAA4B,oBAAoB,CAAC;IAC3F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RoleAfterUpdateEventHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
|
|
2
2
|
import { AuditLogsContext } from "../../../abstractions.js";
|
|
3
|
-
declare class AuditLogRoleAfterUpdateHandlerImpl implements
|
|
3
|
+
declare class AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateEventHandler.Interface {
|
|
4
4
|
private context;
|
|
5
5
|
constructor(context: AuditLogsContext.Interface);
|
|
6
|
-
handle(event:
|
|
6
|
+
handle(event: RoleAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
export declare const AuditLogRoleAfterUpdateHandler: typeof AuditLogRoleAfterUpdateHandlerImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/UpdateRole/events").RoleAfterUpdateEvent>>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|