@webiny/api-audit-logs 6.3.0-beta.4 → 6.4.0-beta.0
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.js +115 -125
- package/context/AuditLogsContextValue.js.map +1 -1
- package/context/index.js +21 -27
- package/context/index.js.map +1 -1
- package/events/AuditLogAfterCreateEvent.js +8 -5
- package/events/AuditLogAfterCreateEvent.js.map +1 -1
- package/events/AuditLogAfterUpdateEvent.js +8 -5
- package/events/AuditLogAfterUpdateEvent.js.map +1 -1
- package/events/AuditLogBeforeCreateEvent.js +8 -5
- package/events/AuditLogBeforeCreateEvent.js.map +1 -1
- package/events/AuditLogBeforeUpdateEvent.js +8 -5
- package/events/AuditLogBeforeUpdateEvent.js.map +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 +3 -3
- 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 +26 -26
- package/storage/AccessPatternHandler.js +31 -52
- package/storage/AccessPatternHandler.js.map +1 -1
- package/storage/Converter.js +45 -48
- package/storage/Converter.js.map +1 -1
- 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 -70
- 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.js +26 -25
- package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +29 -28
- package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
- package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +32 -32
- 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.js +21 -20
- package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +21 -20
- package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +24 -24
- package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
- package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +24 -24
- 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.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +26 -29
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +24 -27
- package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +21 -23
- package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +24 -24
- package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +21 -20
- package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +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.js +23 -22
- 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.js +31 -37
- package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +31 -37
- package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +35 -42
- package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +24 -24
- package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +24 -24
- package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +21 -20
- package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
- package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +24 -24
- 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.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +23 -23
- package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +20 -19
- package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +23 -23
- package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +20 -19
- package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +20 -19
- package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +20 -19
- package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
- package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +23 -23
- 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
|
@@ -12,26 +12,22 @@ import { AuditLogModelAfterDeleteEventHandler } from "./handlers/AuditLogModelAf
|
|
|
12
12
|
import { AuditLogGroupAfterCreateEventHandler } from "./handlers/AuditLogGroupAfterCreateEventHandler.js";
|
|
13
13
|
import { AuditLogGroupAfterUpdateEventHandler } from "./handlers/AuditLogGroupAfterUpdateEventHandler.js";
|
|
14
14
|
import { AuditLogGroupAfterDeleteEventHandler } from "./handlers/AuditLogGroupAfterDeleteEventHandler.js";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// Register group handlers
|
|
32
|
-
context.container.register(AuditLogGroupAfterCreateEventHandler);
|
|
33
|
-
context.container.register(AuditLogGroupAfterUpdateEventHandler);
|
|
34
|
-
context.container.register(AuditLogGroupAfterDeleteEventHandler);
|
|
15
|
+
const createHeadlessCmsHooks = (context)=>{
|
|
16
|
+
context.container.register(AuditLogEntryAfterCreateEventHandler);
|
|
17
|
+
context.container.register(AuditLogEntryAfterUpdateEventHandler);
|
|
18
|
+
context.container.register(AuditLogEntryAfterDeleteEventHandler);
|
|
19
|
+
context.container.register(AuditLogEntryAfterPublishEventHandler);
|
|
20
|
+
context.container.register(AuditLogEntryAfterUnpublishEventHandler);
|
|
21
|
+
context.container.register(AuditLogEntryAfterRestoreFromBinEventHandler);
|
|
22
|
+
context.container.register(AuditLogEntryRevisionAfterCreateEventHandler);
|
|
23
|
+
context.container.register(AuditLogEntryRevisionAfterDeleteEventHandler);
|
|
24
|
+
context.container.register(AuditLogModelAfterCreateEventHandler);
|
|
25
|
+
context.container.register(AuditLogModelAfterUpdateEventHandler);
|
|
26
|
+
context.container.register(AuditLogModelAfterDeleteEventHandler);
|
|
27
|
+
context.container.register(AuditLogGroupAfterCreateEventHandler);
|
|
28
|
+
context.container.register(AuditLogGroupAfterUpdateEventHandler);
|
|
29
|
+
context.container.register(AuditLogGroupAfterDeleteEventHandler);
|
|
35
30
|
};
|
|
31
|
+
export { createHeadlessCmsHooks };
|
|
36
32
|
|
|
37
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/headlessCms/index.js","sources":["../../../src/subscriptions/headlessCms/index.ts"],"sourcesContent":["import type { AuditLogsContext } from \"~/types.js\";\nimport { AuditLogEntryAfterCreateEventHandler } from \"./handlers/AuditLogEntryAfterCreateEventHandler.js\";\nimport { AuditLogEntryAfterUpdateEventHandler } from \"./handlers/AuditLogEntryAfterUpdateEventHandler.js\";\nimport { AuditLogEntryAfterDeleteEventHandler } from \"./handlers/AuditLogEntryAfterDeleteEventHandler.js\";\nimport { AuditLogEntryAfterPublishEventHandler } from \"./handlers/AuditLogEntryAfterPublishEventHandler.js\";\nimport { AuditLogEntryAfterUnpublishEventHandler } from \"./handlers/AuditLogEntryAfterUnpublishEventHandler.js\";\nimport { AuditLogEntryAfterRestoreFromBinEventHandler } from \"./handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js\";\nimport { AuditLogEntryRevisionAfterCreateEventHandler } from \"./handlers/AuditLogEntryRevisionAfterCreateEventHandler.js\";\nimport { AuditLogEntryRevisionAfterDeleteEventHandler } from \"./handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js\";\nimport { AuditLogModelAfterCreateEventHandler } from \"./handlers/AuditLogModelAfterCreateEventHandler.js\";\nimport { AuditLogModelAfterUpdateEventHandler } from \"./handlers/AuditLogModelAfterUpdateEventHandler.js\";\nimport { AuditLogModelAfterDeleteEventHandler } from \"./handlers/AuditLogModelAfterDeleteEventHandler.js\";\nimport { AuditLogGroupAfterCreateEventHandler } from \"./handlers/AuditLogGroupAfterCreateEventHandler.js\";\nimport { AuditLogGroupAfterUpdateEventHandler } from \"./handlers/AuditLogGroupAfterUpdateEventHandler.js\";\nimport { AuditLogGroupAfterDeleteEventHandler } from \"./handlers/AuditLogGroupAfterDeleteEventHandler.js\";\n\nexport const createHeadlessCmsHooks = (context: AuditLogsContext) => {\n // Register entry handlers\n context.container.register(AuditLogEntryAfterCreateEventHandler);\n context.container.register(AuditLogEntryAfterUpdateEventHandler);\n context.container.register(AuditLogEntryAfterDeleteEventHandler);\n context.container.register(AuditLogEntryAfterPublishEventHandler);\n context.container.register(AuditLogEntryAfterUnpublishEventHandler);\n context.container.register(AuditLogEntryAfterRestoreFromBinEventHandler);\n context.container.register(AuditLogEntryRevisionAfterCreateEventHandler);\n context.container.register(AuditLogEntryRevisionAfterDeleteEventHandler);\n\n // Register model handlers\n context.container.register(AuditLogModelAfterCreateEventHandler);\n context.container.register(AuditLogModelAfterUpdateEventHandler);\n context.container.register(AuditLogModelAfterDeleteEventHandler);\n\n // Register group handlers\n context.container.register(AuditLogGroupAfterCreateEventHandler);\n context.container.register(AuditLogGroupAfterUpdateEventHandler);\n context.container.register(AuditLogGroupAfterDeleteEventHandler);\n};\n"],"names":["createHeadlessCmsHooks","context","AuditLogEntryAfterCreateEventHandler","AuditLogEntryAfterUpdateEventHandler","AuditLogEntryAfterDeleteEventHandler","AuditLogEntryAfterPublishEventHandler","AuditLogEntryAfterUnpublishEventHandler","AuditLogEntryAfterRestoreFromBinEventHandler","AuditLogEntryRevisionAfterCreateEventHandler","AuditLogEntryRevisionAfterDeleteEventHandler","AuditLogModelAfterCreateEventHandler","AuditLogModelAfterUpdateEventHandler","AuditLogModelAfterDeleteEventHandler","AuditLogGroupAfterCreateEventHandler","AuditLogGroupAfterUpdateEventHandler","AuditLogGroupAfterDeleteEventHandler"],"mappings":";;;;;;;;;;;;;;AAgBO,MAAMA,yBAAyB,CAACC;IAEnCA,QAAQ,SAAS,CAAC,QAAQ,CAACC;IAC3BD,QAAQ,SAAS,CAAC,QAAQ,CAACE;IAC3BF,QAAQ,SAAS,CAAC,QAAQ,CAACG;IAC3BH,QAAQ,SAAS,CAAC,QAAQ,CAACI;IAC3BJ,QAAQ,SAAS,CAAC,QAAQ,CAACK;IAC3BL,QAAQ,SAAS,CAAC,QAAQ,CAACM;IAC3BN,QAAQ,SAAS,CAAC,QAAQ,CAACO;IAC3BP,QAAQ,SAAS,CAAC,QAAQ,CAACQ;IAG3BR,QAAQ,SAAS,CAAC,QAAQ,CAACS;IAC3BT,QAAQ,SAAS,CAAC,QAAQ,CAACU;IAC3BV,QAAQ,SAAS,CAAC,QAAQ,CAACW;IAG3BX,QAAQ,SAAS,CAAC,QAAQ,CAACY;IAC3BZ,QAAQ,SAAS,CAAC,QAAQ,CAACa;IAC3Bb,QAAQ,SAAS,CAAC,QAAQ,CAACc;AAC/B"}
|
package/subscriptions/index.js
CHANGED
|
@@ -4,13 +4,14 @@ import { createSecurityHooks } from "./security/index.js";
|
|
|
4
4
|
import { createMailerHooks } from "./mailer/index.js";
|
|
5
5
|
import { createAcoHooks } from "./aco/index.js";
|
|
6
6
|
import { createWebsiteBuilderHooks } from "./websiteBuilder/index.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const createSubscriptionHooks = (context)=>{
|
|
8
|
+
createFileManagerHooks(context);
|
|
9
|
+
createHeadlessCmsHooks(context);
|
|
10
|
+
createSecurityHooks(context);
|
|
11
|
+
createMailerHooks(context);
|
|
12
|
+
createAcoHooks(context);
|
|
13
|
+
createWebsiteBuilderHooks(context);
|
|
14
14
|
};
|
|
15
|
+
export { createSubscriptionHooks };
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/index.js","sources":["../../src/subscriptions/index.ts"],"sourcesContent":["import { createFileManagerHooks } from \"./fileManager/index.js\";\nimport { createHeadlessCmsHooks } from \"./headlessCms/index.js\";\nimport { createSecurityHooks } from \"./security/index.js\";\nimport { createMailerHooks } from \"./mailer/index.js\";\nimport { createAcoHooks } from \"./aco/index.js\";\nimport { createWebsiteBuilderHooks } from \"~/subscriptions/websiteBuilder/index.js\";\nimport type { AuditLogsContext } from \"~/types.js\";\n\nexport const createSubscriptionHooks = (context: AuditLogsContext) => {\n createFileManagerHooks(context);\n createHeadlessCmsHooks(context);\n createSecurityHooks(context);\n createMailerHooks(context);\n createAcoHooks(context);\n createWebsiteBuilderHooks(context);\n};\n"],"names":["createSubscriptionHooks","context","createFileManagerHooks","createHeadlessCmsHooks","createSecurityHooks","createMailerHooks","createAcoHooks","createWebsiteBuilderHooks"],"mappings":";;;;;;AAQO,MAAMA,0BAA0B,CAACC;IACpCC,uBAAuBD;IACvBE,uBAAuBF;IACvBG,oBAAoBH;IACpBI,kBAAkBJ;IAClBK,eAAeL;IACfM,0BAA0BN;AAC9B"}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
2
|
import { MailerSettingsAfterSaveEventHandler } from "@webiny/api-mailer/features/SaveSettings/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 AuditLogMailerSettingsAfterSaveHandlerImpl {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
7
|
+
constructor(context){
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
async handle(event) {
|
|
11
|
+
try {
|
|
12
|
+
const { settings } = event.payload;
|
|
13
|
+
const createAuditLog = getAuditConfig(AUDIT.MAILER.SETTINGS.UPDATE);
|
|
14
|
+
await createAuditLog("Settings updated", {
|
|
15
|
+
after: settings
|
|
16
|
+
}, "-", this.context);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
throw _webiny_error.from(error, {
|
|
19
|
+
message: "Error while executing AuditLogMailerSettingsAfterSaveHandler",
|
|
20
|
+
code: "AUDIT_LOGS_AFTER_MAILER_SETTINGS_SAVE_HANDLER"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
24
23
|
}
|
|
25
|
-
}
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const AuditLogMailerSettingsAfterSaveHandler = MailerSettingsAfterSaveEventHandler.createImplementation({
|
|
26
|
+
implementation: AuditLogMailerSettingsAfterSaveHandlerImpl,
|
|
27
|
+
dependencies: [
|
|
28
|
+
AuditLogsContext
|
|
29
|
+
]
|
|
30
30
|
});
|
|
31
|
+
export { AuditLogMailerSettingsAfterSaveHandler };
|
|
31
32
|
|
|
32
33
|
//# sourceMappingURL=AuditLogMailerSettingsAfterSaveHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js","sources":["../../../../src/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { MailerSettingsAfterSaveEventHandler } from \"@webiny/api-mailer/features/SaveSettings/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogMailerSettingsAfterSaveHandlerImpl\n implements MailerSettingsAfterSaveEventHandler.Interface\n{\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: MailerSettingsAfterSaveEventHandler.Event): Promise<void> {\n try {\n const { settings } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.MAILER.SETTINGS.UPDATE);\n\n await createAuditLog(\"Settings updated\", { after: settings }, \"-\", this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogMailerSettingsAfterSaveHandler\",\n code: \"AUDIT_LOGS_AFTER_MAILER_SETTINGS_SAVE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogMailerSettingsAfterSaveHandler =\n MailerSettingsAfterSaveEventHandler.createImplementation({\n implementation: AuditLogMailerSettingsAfterSaveHandlerImpl,\n dependencies: [AuditLogsContext]\n });\n"],"names":["AuditLogMailerSettingsAfterSaveHandlerImpl","context","event","settings","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogMailerSettingsAfterSaveHandler","MailerSettingsAfterSaveEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IAGF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAAgD,EAAiB;QAC1E,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,iBAAiBC,eAAeC,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM;YAElE,MAAMF,eAAe,oBAAoB;gBAAE,OAAOD;YAAS,GAAG,KAAK,IAAI,CAAC,OAAO;QACnF,EAAE,OAAOI,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,yCACTC,oCAAoC,oBAAoB,CAAC;IACrD,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuditLogMailerSettingsAfterSaveHandler } from "./handlers/AuditLogMailerSettingsAfterSaveHandler.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
context.container.register(AuditLogMailerSettingsAfterSaveHandler);
|
|
2
|
+
const createMailerHooks = (context)=>{
|
|
3
|
+
context.container.register(AuditLogMailerSettingsAfterSaveHandler);
|
|
5
4
|
};
|
|
5
|
+
export { createMailerHooks };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"subscriptions/mailer/index.js","sources":["../../../src/subscriptions/mailer/index.ts"],"sourcesContent":["import { AuditLogMailerSettingsAfterSaveHandler } from \"./handlers/AuditLogMailerSettingsAfterSaveHandler.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\n\nexport const createMailerHooks = (context: AuditLogsContext.Interface) => {\n // Register mailer settings event handlers\n context.container.register(AuditLogMailerSettingsAfterSaveHandler);\n};\n"],"names":["createMailerHooks","context","AuditLogMailerSettingsAfterSaveHandler"],"mappings":";AAGO,MAAMA,oBAAoB,CAACC;IAE9BA,QAAQ,SAAS,CAAC,QAAQ,CAACC;AAC/B"}
|
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
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,47 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
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,52 +1,45 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
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,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
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"}
|