@webiny/api-audit-logs 6.3.0 → 6.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/abstractions.js +2 -3
  2. package/abstractions.js.map +1 -1
  3. package/config.js +2 -1
  4. package/config.js.map +1 -1
  5. package/context/AuditLogsContextValue.js +115 -125
  6. package/context/AuditLogsContextValue.js.map +1 -1
  7. package/context/index.js +21 -27
  8. package/context/index.js.map +1 -1
  9. package/events/AuditLogAfterCreateEvent.js +8 -5
  10. package/events/AuditLogAfterCreateEvent.js.map +1 -1
  11. package/events/AuditLogAfterUpdateEvent.js +8 -5
  12. package/events/AuditLogAfterUpdateEvent.js.map +1 -1
  13. package/events/AuditLogBeforeCreateEvent.js +8 -5
  14. package/events/AuditLogBeforeCreateEvent.js.map +1 -1
  15. package/events/AuditLogBeforeUpdateEvent.js +8 -5
  16. package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
  17. package/events/abstractions.js +5 -24
  18. package/events/abstractions.js.map +1 -1
  19. package/events/index.js +0 -2
  20. package/graphql/schema.js +37 -48
  21. package/graphql/schema.js.map +1 -1
  22. package/graphql/validation.d.ts +3 -3
  23. package/graphql/validation.js +26 -30
  24. package/graphql/validation.js.map +1 -1
  25. package/index.js +18 -15
  26. package/index.js.map +1 -1
  27. package/package.json +26 -26
  28. package/storage/AccessPatternHandler.js +31 -52
  29. package/storage/AccessPatternHandler.js.map +1 -1
  30. package/storage/Converter.js +45 -48
  31. package/storage/Converter.js.map +1 -1
  32. package/storage/Storage.js +69 -77
  33. package/storage/Storage.js.map +1 -1
  34. package/storage/abstractions/AccessPattern.js +0 -3
  35. package/storage/abstractions/AccessPatternHandler.js +0 -3
  36. package/storage/abstractions/Converter.js +0 -3
  37. package/storage/abstractions/Storage.js +0 -3
  38. package/storage/accessPatterns/AppAccessPattern.js +31 -25
  39. package/storage/accessPatterns/AppAccessPattern.js.map +1 -1
  40. package/storage/accessPatterns/AppCreatedByAccessPattern.js +34 -28
  41. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -1
  42. package/storage/accessPatterns/AppEntityAccessPattern.js +31 -25
  43. package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -1
  44. package/storage/accessPatterns/AppEntityActionAccessPattern.js +31 -25
  45. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -1
  46. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +34 -28
  47. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -1
  48. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +34 -28
  49. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -1
  50. package/storage/accessPatterns/BaseAccessPattern.js +47 -70
  51. package/storage/accessPatterns/BaseAccessPattern.js.map +1 -1
  52. package/storage/accessPatterns/CreatedByAccessPattern.js +34 -28
  53. package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -1
  54. package/storage/accessPatterns/CreatedOnAccessPattern.js +34 -26
  55. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -1
  56. package/storage/accessPatterns/DefaultAccessPattern.js +31 -32
  57. package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -1
  58. package/storage/accessPatterns/EntityIdAccessPattern.js +32 -27
  59. package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -1
  60. package/storage/accessPatterns/index.js +44 -34
  61. package/storage/accessPatterns/index.js.map +1 -1
  62. package/storage/cursorSchema.js +15 -18
  63. package/storage/cursorSchema.js.map +1 -1
  64. package/storage/entity.js +115 -122
  65. package/storage/entity.js.map +1 -1
  66. package/storage/results/ListErrorResult.js +9 -8
  67. package/storage/results/ListErrorResult.js.map +1 -1
  68. package/storage/results/ListSuccessResult.js +13 -12
  69. package/storage/results/ListSuccessResult.js.map +1 -1
  70. package/storage/results/index.js +0 -2
  71. package/storage/startKey.js +4 -5
  72. package/storage/startKey.js.map +1 -1
  73. package/storage/types.js +0 -3
  74. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +26 -25
  75. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
  76. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +29 -28
  77. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
  78. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +32 -32
  79. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
  80. package/subscriptions/aco/index.js +5 -4
  81. package/subscriptions/aco/index.js.map +1 -1
  82. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +21 -20
  83. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
  84. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +21 -20
  85. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
  86. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +24 -24
  87. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
  88. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +24 -24
  89. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
  90. package/subscriptions/fileManager/index.js +6 -8
  91. package/subscriptions/fileManager/index.js.map +1 -1
  92. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +21 -23
  93. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
  94. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +26 -29
  95. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
  96. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +21 -23
  97. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
  98. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +21 -23
  99. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
  100. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +21 -23
  101. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
  102. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +24 -27
  103. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
  104. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +21 -23
  105. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
  106. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +21 -23
  107. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
  108. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +21 -20
  109. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
  110. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +21 -20
  111. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
  112. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +24 -24
  113. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
  114. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +21 -20
  115. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
  116. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +21 -20
  117. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
  118. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +24 -24
  119. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
  120. package/subscriptions/headlessCms/index.js +16 -20
  121. package/subscriptions/headlessCms/index.js.map +1 -1
  122. package/subscriptions/index.js +8 -7
  123. package/subscriptions/index.js.map +1 -1
  124. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +23 -22
  125. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
  126. package/subscriptions/mailer/index.js +3 -3
  127. package/subscriptions/mailer/index.js.map +1 -1
  128. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +31 -37
  129. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
  130. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +31 -37
  131. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
  132. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +35 -42
  133. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
  134. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +21 -20
  135. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
  136. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +21 -20
  137. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
  138. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +24 -24
  139. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
  140. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +21 -20
  141. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
  142. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +21 -20
  143. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
  144. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +24 -24
  145. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
  146. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +21 -20
  147. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
  148. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +21 -20
  149. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
  150. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +24 -24
  151. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
  152. package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
  153. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
  154. package/subscriptions/security/index.js +14 -20
  155. package/subscriptions/security/index.js.map +1 -1
  156. package/subscriptions/websiteBuilder/index.js +14 -16
  157. package/subscriptions/websiteBuilder/index.js.map +1 -1
  158. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +20 -19
  159. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
  160. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +20 -19
  161. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
  162. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +20 -19
  163. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
  164. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +23 -23
  165. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
  166. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +20 -19
  167. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
  168. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +20 -19
  169. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
  170. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +20 -19
  171. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
  172. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +23 -23
  173. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
  174. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +20 -19
  175. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
  176. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +20 -19
  177. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
  178. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +20 -19
  179. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
  180. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +23 -23
  181. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
  182. package/types.js +0 -3
  183. package/utils/expiresAt.js +14 -19
  184. package/utils/expiresAt.js.map +1 -1
  185. package/utils/getAuditConfig.js +79 -98
  186. package/utils/getAuditConfig.js.map +1 -1
  187. package/utils/getAuditObject.js +14 -15
  188. package/utils/getAuditObject.js.map +1 -1
  189. package/events/index.js.map +0 -1
  190. package/storage/abstractions/AccessPattern.js.map +0 -1
  191. package/storage/abstractions/AccessPatternHandler.js.map +0 -1
  192. package/storage/abstractions/Converter.js.map +0 -1
  193. package/storage/abstractions/Storage.js.map +0 -1
  194. package/storage/results/index.js.map +0 -1
  195. package/storage/types.js.map +0 -1
  196. 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
- export const createHeadlessCmsHooks = context => {
16
- // Register entry handlers
17
- context.container.register(AuditLogEntryAfterCreateEventHandler);
18
- context.container.register(AuditLogEntryAfterUpdateEventHandler);
19
- context.container.register(AuditLogEntryAfterDeleteEventHandler);
20
- context.container.register(AuditLogEntryAfterPublishEventHandler);
21
- context.container.register(AuditLogEntryAfterUnpublishEventHandler);
22
- context.container.register(AuditLogEntryAfterRestoreFromBinEventHandler);
23
- context.container.register(AuditLogEntryRevisionAfterCreateEventHandler);
24
- context.container.register(AuditLogEntryRevisionAfterDeleteEventHandler);
25
-
26
- // Register model handlers
27
- context.container.register(AuditLogModelAfterCreateEventHandler);
28
- context.container.register(AuditLogModelAfterUpdateEventHandler);
29
- context.container.register(AuditLogModelAfterDeleteEventHandler);
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,"names":["AuditLogEntryAfterCreateEventHandler","AuditLogEntryAfterUpdateEventHandler","AuditLogEntryAfterDeleteEventHandler","AuditLogEntryAfterPublishEventHandler","AuditLogEntryAfterUnpublishEventHandler","AuditLogEntryAfterRestoreFromBinEventHandler","AuditLogEntryRevisionAfterCreateEventHandler","AuditLogEntryRevisionAfterDeleteEventHandler","AuditLogModelAfterCreateEventHandler","AuditLogModelAfterUpdateEventHandler","AuditLogModelAfterDeleteEventHandler","AuditLogGroupAfterCreateEventHandler","AuditLogGroupAfterUpdateEventHandler","AuditLogGroupAfterDeleteEventHandler","createHeadlessCmsHooks","context","container","register"],"sources":["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"],"mappings":"AACA,SAASA,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,qCAAqC;AAC9C,SAASC,uCAAuC;AAChD,SAASC,4CAA4C;AACrD,SAASC,4CAA4C;AACrD,SAASC,4CAA4C;AACrD,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,oCAAoC;AAE7C,OAAO,MAAMC,sBAAsB,GAAIC,OAAyB,IAAK;EACjE;EACAA,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACjB,oCAAoC,CAAC;EAChEe,OAAO,CAACC,SAAS,CAACC,QAAQ,CAAChB,oCAAoC,CAAC;EAChEc,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACf,oCAAoC,CAAC;EAChEa,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACd,qCAAqC,CAAC;EACjEY,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACb,uCAAuC,CAAC;EACnEW,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACZ,4CAA4C,CAAC;EACxEU,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACX,4CAA4C,CAAC;EACxES,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACV,4CAA4C,CAAC;;EAExE;EACAQ,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACT,oCAAoC,CAAC;EAChEO,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACR,oCAAoC,CAAC;EAChEM,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACP,oCAAoC,CAAC;;EAEhE;EACAK,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACN,oCAAoC,CAAC;EAChEI,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACL,oCAAoC,CAAC;EAChEG,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACJ,oCAAoC,CAAC;AACpE,CAAC","ignoreList":[]}
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"}
@@ -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
- export const createSubscriptionHooks = context => {
8
- createFileManagerHooks(context);
9
- createHeadlessCmsHooks(context);
10
- createSecurityHooks(context);
11
- createMailerHooks(context);
12
- createAcoHooks(context);
13
- createWebsiteBuilderHooks(context);
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,"names":["createFileManagerHooks","createHeadlessCmsHooks","createSecurityHooks","createMailerHooks","createAcoHooks","createWebsiteBuilderHooks","createSubscriptionHooks","context"],"sources":["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"],"mappings":"AAAA,SAASA,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,yBAAyB;AAGlC,OAAO,MAAMC,uBAAuB,GAAIC,OAAyB,IAAK;EAClEP,sBAAsB,CAACO,OAAO,CAAC;EAC/BN,sBAAsB,CAACM,OAAO,CAAC;EAC/BL,mBAAmB,CAACK,OAAO,CAAC;EAC5BJ,iBAAiB,CAACI,OAAO,CAAC;EAC1BH,cAAc,CAACG,OAAO,CAAC;EACvBF,yBAAyB,CAACE,OAAO,CAAC;AACtC,CAAC","ignoreList":[]}
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 WebinyError from "@webiny/error";
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
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- settings
14
- } = event.payload;
15
- const createAuditLog = getAuditConfig(AUDIT.MAILER.SETTINGS.UPDATE);
16
- await createAuditLog("Settings updated", {
17
- after: settings
18
- }, "-", this.context);
19
- } catch (error) {
20
- throw WebinyError.from(error, {
21
- message: "Error while executing AuditLogMailerSettingsAfterSaveHandler",
22
- code: "AUDIT_LOGS_AFTER_MAILER_SETTINGS_SAVE_HANDLER"
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
- export const AuditLogMailerSettingsAfterSaveHandler = MailerSettingsAfterSaveEventHandler.createImplementation({
28
- implementation: AuditLogMailerSettingsAfterSaveHandlerImpl,
29
- dependencies: [AuditLogsContext]
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,"names":["WebinyError","MailerSettingsAfterSaveEventHandler","AuditLogsContext","AUDIT","getAuditConfig","AuditLogMailerSettingsAfterSaveHandlerImpl","constructor","context","handle","event","settings","payload","createAuditLog","MAILER","SETTINGS","UPDATE","after","error","from","message","code","AuditLogMailerSettingsAfterSaveHandler","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,mCAAmC,QAAQ,mDAAmD;AACvG,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAEvB,MAAMC,0CAA0C,CAEhD;EACIC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAgD,EAAiB;IAC1E,IAAI;MACA,MAAM;QAAEC;MAAS,CAAC,GAAGD,KAAK,CAACE,OAAO;MAClC,MAAMC,cAAc,GAAGR,cAAc,CAACD,KAAK,CAACU,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAC;MAEnE,MAAMH,cAAc,CAAC,kBAAkB,EAAE;QAAEI,KAAK,EAAEN;MAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAACH,OAAO,CAAC;IACpF,CAAC,CAAC,OAAOU,KAAK,EAAE;MACZ,MAAMjB,WAAW,CAACkB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,8DAA8D;QACvEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,sCAAsC,GAC/CpB,mCAAmC,CAACqB,oBAAoB,CAAC;EACrDC,cAAc,EAAElB,0CAA0C;EAC1DmB,YAAY,EAAE,CAACtB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
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
- export const createMailerHooks = context => {
3
- // Register mailer settings event handlers
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,"names":["AuditLogMailerSettingsAfterSaveHandler","createMailerHooks","context","container","register"],"sources":["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"],"mappings":"AAAA,SAASA,sCAAsC;AAG/C,OAAO,MAAMC,iBAAiB,GAAIC,OAAmC,IAAK;EACtE;EACAA,OAAO,CAACC,SAAS,CAACC,QAAQ,CAACJ,sCAAsC,CAAC;AACtE,CAAC","ignoreList":[]}
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 WebinyError from "@webiny/error";
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
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * 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.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
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
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- apiKey: initialApiKey
30
- } = event.payload;
31
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);
32
- const apiKey = cleanupApiKey(initialApiKey);
33
- await createAuditLog("API key created", apiKey, apiKey.id, this.context);
34
- } catch (error) {
35
- throw WebinyError.from(error, {
36
- message: "Error while executing AuditLogApiKeyAfterCreateHandler",
37
- code: "AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER"
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
- export const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterCreateHandlerImpl,
44
- dependencies: [AuditLogsContext]
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,"names":["WebinyError","ApiKeyAfterCreateEventHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterCreateHandlerImpl","constructor","context","handle","event","initialApiKey","payload","createAuditLog","SECURITY","API_KEY","CREATE","error","from","message","code","AuditLogApiKeyAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,6BAA6B,QAAQ,kEAAkE;AAChH,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAAoD;EAC1FC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAA0C,EAAiB;IACpE,IAAI;MACA,MAAM;QAAEZ,MAAM,EAAEa;MAAc,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC/C,MAAMC,cAAc,GAAGjB,cAAc,CAACD,KAAK,CAACmB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMlB,MAAM,GAAGD,aAAa,CAACc,aAAa,CAAC;MAE3C,MAAME,cAAc,CAAC,iBAAiB,EAAEf,MAAM,EAAEA,MAAM,CAACC,EAAE,EAAE,IAAI,CAACS,OAAO,CAAC;IAC5E,CAAC,CAAC,OAAOS,KAAK,EAAE;MACZ,MAAMzB,WAAW,CAAC0B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAG5B,6BAA6B,CAAC6B,oBAAoB,CAAC;EAC/FC,cAAc,EAAEjB,oCAAoC;EACpDkB,YAAY,EAAE,CAAC9B,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
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 WebinyError from "@webiny/error";
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
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * 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.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
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
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- apiKey: initialApiKey
30
- } = event.payload;
31
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);
32
- const apiKey = cleanupApiKey(initialApiKey);
33
- await createAuditLog("API key deleted", apiKey, apiKey.id, this.context);
34
- } catch (error) {
35
- throw WebinyError.from(error, {
36
- message: "Error while executing AuditLogApiKeyAfterDeleteHandler",
37
- code: "AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER"
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
- export const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
44
- dependencies: [AuditLogsContext]
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,"names":["WebinyError","ApiKeyAfterDeleteEventHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterDeleteHandlerImpl","constructor","context","handle","event","initialApiKey","payload","createAuditLog","SECURITY","API_KEY","DELETE","error","from","message","code","AuditLogApiKeyAfterDeleteHandler","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,6BAA6B,QAAQ,kEAAkE;AAChH,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAAoD;EAC1FC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAA0C,EAAiB;IACpE,IAAI;MACA,MAAM;QAAEZ,MAAM,EAAEa;MAAc,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC/C,MAAMC,cAAc,GAAGjB,cAAc,CAACD,KAAK,CAACmB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMlB,MAAM,GAAGD,aAAa,CAACc,aAAa,CAAC;MAE3C,MAAME,cAAc,CAAC,iBAAiB,EAAEf,MAAM,EAAEA,MAAM,CAACC,EAAE,EAAE,IAAI,CAACS,OAAO,CAAC;IAC5E,CAAC,CAAC,OAAOS,KAAK,EAAE;MACZ,MAAMzB,WAAW,CAAC0B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAG5B,6BAA6B,CAAC6B,oBAAoB,CAAC;EAC/FC,cAAc,EAAEjB,oCAAoC;EACpDkB,YAAY,EAAE,CAAC9B,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
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 WebinyError from "@webiny/error";
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
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * 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.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
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
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- updated: initialApiKey,
30
- original: initialOriginalApiKey
31
- } = event.payload;
32
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);
33
- const apiKey = cleanupApiKey(initialApiKey);
34
- const original = cleanupApiKey(initialOriginalApiKey);
35
- await createAuditLog("API key updated", {
36
- before: original,
37
- after: apiKey
38
- }, apiKey.id, this.context);
39
- } catch (error) {
40
- throw WebinyError.from(error, {
41
- message: "Error while executing AuditLogApiKeyAfterUpdateHandler",
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
- export const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({
48
- implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
49
- dependencies: [AuditLogsContext]
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,"names":["WebinyError","ApiKeyAfterUpdateEventHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterUpdateHandlerImpl","constructor","context","handle","event","updated","initialApiKey","original","initialOriginalApiKey","payload","createAuditLog","SECURITY","API_KEY","UPDATE","before","after","error","from","message","code","AuditLogApiKeyAfterUpdateHandler","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,6BAA6B,QAAQ,kEAAkE;AAChH,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAAoD;EAC1FC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAA0C,EAAiB;IACpE,IAAI;MACA,MAAM;QAAEC,OAAO,EAAEC,aAAa;QAAEC,QAAQ,EAAEC;MAAsB,CAAC,GAAGJ,KAAK,CAACK,OAAO;MACjF,MAAMC,cAAc,GAAGpB,cAAc,CAACD,KAAK,CAACsB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMrB,MAAM,GAAGD,aAAa,CAACe,aAAa,CAAC;MAC3C,MAAMC,QAAQ,GAAGhB,aAAa,CAACiB,qBAAqB,CAAC;MAErD,MAAME,cAAc,CAChB,iBAAiB,EACjB;QACII,MAAM,EAAEP,QAAQ;QAChBQ,KAAK,EAAEvB;MACX,CAAC,EACDA,MAAM,CAACC,EAAE,EACT,IAAI,CAACS,OACT,CAAC;IACL,CAAC,CAAC,OAAOc,KAAK,EAAE;MACZ,MAAM9B,WAAW,CAAC+B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAGjC,6BAA6B,CAACkC,oBAAoB,CAAC;EAC/FC,cAAc,EAAEtB,oCAAoC;EACpDuB,YAAY,EAAE,CAACnC,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
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 WebinyError from "@webiny/error";
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
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- role
14
- } = event.payload;
15
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);
16
- await createAuditLog("Role created", role, role.id, this.context);
17
- } catch (error) {
18
- throw WebinyError.from(error, {
19
- message: "Error while executing AuditLogRoleAfterCreateHandler",
20
- code: "AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER"
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
- export const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({
26
- implementation: AuditLogRoleAfterCreateHandlerImpl,
27
- dependencies: [AuditLogsContext]
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,"names":["WebinyError","AuditLogsContext","AUDIT","getAuditConfig","RoleAfterCreateEventHandler","AuditLogRoleAfterCreateHandlerImpl","constructor","context","handle","event","role","payload","createAuditLog","SECURITY","ROLE","CREATE","id","error","from","message","code","AuditLogRoleAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["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"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AACvB,SAASC,2BAA2B,QAAQ,8DAA8D;AAE1G,MAAMC,kCAAkC,CAAkD;EACtFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAwC,EAAiB;IAClE,IAAI;MACA,MAAM;QAAEC;MAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC9B,MAAMC,cAAc,GAAGT,cAAc,CAACD,KAAK,CAACW,QAAQ,CAACC,IAAI,CAACC,MAAM,CAAC;MAEjE,MAAMH,cAAc,CAAC,cAAc,EAAEF,IAAI,EAAEA,IAAI,CAACM,EAAE,EAAE,IAAI,CAACT,OAAO,CAAC;IACrE,CAAC,CAAC,OAAOU,KAAK,EAAE;MACZ,MAAMjB,WAAW,CAACkB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,sDAAsD;QAC/DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,8BAA8B,GAAGjB,2BAA2B,CAACkB,oBAAoB,CAAC;EAC3FC,cAAc,EAAElB,kCAAkC;EAClDmB,YAAY,EAAE,CAACvB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
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"}