@webiny/api-audit-logs 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.eb81deee7e

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 (380) hide show
  1. package/AuditLogsFeature.d.ts +8 -0
  2. package/AuditLogsFeature.js +32 -0
  3. package/AuditLogsFeature.js.map +1 -0
  4. package/abstractions.d.ts +14 -4
  5. package/abstractions.js +3 -3
  6. package/abstractions.js.map +1 -1
  7. package/config.js +2 -1
  8. package/config.js.map +1 -1
  9. package/domain/errors.d.ts +5 -0
  10. package/domain/errors.js +11 -0
  11. package/domain/errors.js.map +1 -0
  12. package/events/AuditLogAfterCreateEvent.js +8 -5
  13. package/events/AuditLogAfterCreateEvent.js.map +1 -1
  14. package/events/AuditLogAfterUpdateEvent.js +8 -5
  15. package/events/AuditLogAfterUpdateEvent.js.map +1 -1
  16. package/events/AuditLogBeforeCreateEvent.js +8 -5
  17. package/events/AuditLogBeforeCreateEvent.js.map +1 -1
  18. package/events/AuditLogBeforeUpdateEvent.js +8 -5
  19. package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
  20. package/events/abstractions.d.ts +0 -5
  21. package/events/abstractions.js +5 -24
  22. package/events/abstractions.js.map +1 -1
  23. package/events/index.js +0 -2
  24. package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
  25. package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
  26. package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
  27. package/features/AuditLogPermissions/abstractions.d.ts +11 -0
  28. package/features/AuditLogPermissions/abstractions.js +5 -0
  29. package/features/AuditLogPermissions/abstractions.js.map +1 -0
  30. package/features/AuditLogPermissions/feature.d.ts +4 -0
  31. package/features/AuditLogPermissions/feature.js +11 -0
  32. package/features/AuditLogPermissions/feature.js.map +1 -0
  33. package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
  34. package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
  35. package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
  36. package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
  37. package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
  38. package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
  39. package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
  40. package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
  41. package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
  42. package/features/CreateAuditLog/abstractions.d.ts +42 -0
  43. package/features/CreateAuditLog/abstractions.js +7 -0
  44. package/features/CreateAuditLog/abstractions.js.map +1 -0
  45. package/features/CreateAuditLog/feature.d.ts +4 -0
  46. package/features/CreateAuditLog/feature.js +15 -0
  47. package/features/CreateAuditLog/feature.js.map +1 -0
  48. package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
  49. package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
  50. package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
  51. package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
  52. package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
  53. package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
  54. package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
  55. package/features/GetAuditLog/GetAuditLogUseCase.js +29 -0
  56. package/features/GetAuditLog/GetAuditLogUseCase.js.map +1 -0
  57. package/features/GetAuditLog/abstractions.d.ts +42 -0
  58. package/features/GetAuditLog/abstractions.js +7 -0
  59. package/features/GetAuditLog/abstractions.js.map +1 -0
  60. package/features/GetAuditLog/feature.d.ts +4 -0
  61. package/features/GetAuditLog/feature.js +15 -0
  62. package/features/GetAuditLog/feature.js.map +1 -0
  63. package/features/ListAuditLogs/ListAuditLogsGateway.d.ts +12 -0
  64. package/features/ListAuditLogs/ListAuditLogsGateway.js +24 -0
  65. package/features/ListAuditLogs/ListAuditLogsGateway.js.map +1 -0
  66. package/features/ListAuditLogs/ListAuditLogsRepository.d.ts +17 -0
  67. package/features/ListAuditLogs/ListAuditLogsRepository.js +38 -0
  68. package/features/ListAuditLogs/ListAuditLogsRepository.js.map +1 -0
  69. package/features/ListAuditLogs/ListAuditLogsUseCase.d.ts +15 -0
  70. package/features/ListAuditLogs/ListAuditLogsUseCase.js +27 -0
  71. package/features/ListAuditLogs/ListAuditLogsUseCase.js.map +1 -0
  72. package/features/ListAuditLogs/abstractions.d.ts +55 -0
  73. package/features/ListAuditLogs/abstractions.js +7 -0
  74. package/features/ListAuditLogs/abstractions.js.map +1 -0
  75. package/features/ListAuditLogs/feature.d.ts +4 -0
  76. package/features/ListAuditLogs/feature.js +15 -0
  77. package/features/ListAuditLogs/feature.js.map +1 -0
  78. package/features/RecordAuditLog/RecordAuditLogUseCase.d.ts +30 -0
  79. package/features/RecordAuditLog/RecordAuditLogUseCase.js +108 -0
  80. package/features/RecordAuditLog/RecordAuditLogUseCase.js.map +1 -0
  81. package/features/RecordAuditLog/abstractions.d.ts +26 -0
  82. package/features/RecordAuditLog/abstractions.js +5 -0
  83. package/features/RecordAuditLog/abstractions.js.map +1 -0
  84. package/features/RecordAuditLog/feature.d.ts +4 -0
  85. package/features/RecordAuditLog/feature.js +11 -0
  86. package/features/RecordAuditLog/feature.js.map +1 -0
  87. package/features/UpdateAuditLog/UpdateAuditLogGateway.d.ts +12 -0
  88. package/features/UpdateAuditLog/UpdateAuditLogGateway.js +23 -0
  89. package/features/UpdateAuditLog/UpdateAuditLogGateway.js.map +1 -0
  90. package/features/UpdateAuditLog/UpdateAuditLogRepository.d.ts +14 -0
  91. package/features/UpdateAuditLog/UpdateAuditLogRepository.js +25 -0
  92. package/features/UpdateAuditLog/UpdateAuditLogRepository.js.map +1 -0
  93. package/features/UpdateAuditLog/UpdateAuditLogUseCase.d.ts +18 -0
  94. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js +53 -0
  95. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js.map +1 -0
  96. package/features/UpdateAuditLog/abstractions.d.ts +42 -0
  97. package/features/UpdateAuditLog/abstractions.js +7 -0
  98. package/features/UpdateAuditLog/abstractions.js.map +1 -0
  99. package/features/UpdateAuditLog/feature.d.ts +4 -0
  100. package/features/UpdateAuditLog/feature.js +15 -0
  101. package/features/UpdateAuditLog/feature.js.map +1 -0
  102. package/graphql/AuditLogsGraphQLSchema.d.ts +10 -0
  103. package/graphql/AuditLogsGraphQLSchema.js +139 -0
  104. package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
  105. package/graphql/validation.js +26 -30
  106. package/graphql/validation.js.map +1 -1
  107. package/index.d.ts +2 -8
  108. package/index.js +1 -22
  109. package/package.json +28 -28
  110. package/storage/abstractions/Storage.js +0 -3
  111. package/storage/types.d.ts +0 -35
  112. package/storage/types.js +0 -3
  113. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +3 -3
  114. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +37 -27
  115. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
  116. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +3 -3
  117. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +45 -30
  118. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
  119. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +3 -3
  120. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +43 -34
  121. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
  122. package/subscriptions/aco/index.d.ts +2 -2
  123. package/subscriptions/aco/index.js +5 -4
  124. package/subscriptions/aco/index.js.map +1 -1
  125. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
  126. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +45 -0
  127. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
  128. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
  129. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +42 -0
  130. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
  131. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
  132. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +44 -0
  133. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
  134. package/subscriptions/ai/index.d.ts +2 -0
  135. package/subscriptions/ai/index.js +11 -0
  136. package/subscriptions/ai/index.js.map +1 -0
  137. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +3 -3
  138. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +27 -22
  139. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
  140. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +3 -3
  141. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +27 -22
  142. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
  143. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +3 -3
  144. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +30 -26
  145. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
  146. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +3 -3
  147. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +30 -26
  148. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
  149. package/subscriptions/fileManager/index.d.ts +2 -2
  150. package/subscriptions/fileManager/index.js +6 -8
  151. package/subscriptions/fileManager/index.js.map +1 -1
  152. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +3 -3
  153. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +27 -25
  154. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
  155. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +3 -3
  156. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +37 -31
  157. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
  158. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +3 -3
  159. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +27 -25
  160. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
  161. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +3 -3
  162. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +27 -25
  163. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
  164. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +3 -3
  165. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +27 -25
  166. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
  167. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +3 -3
  168. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +30 -29
  169. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
  170. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +3 -3
  171. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +27 -25
  172. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
  173. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +3 -3
  174. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +27 -25
  175. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
  176. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +3 -3
  177. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +27 -22
  178. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
  179. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +3 -3
  180. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +27 -22
  181. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
  182. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +3 -3
  183. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +30 -26
  184. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
  185. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +3 -3
  186. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +27 -22
  187. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
  188. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +3 -3
  189. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +27 -22
  190. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
  191. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +3 -3
  192. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +30 -26
  193. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
  194. package/subscriptions/headlessCms/index.d.ts +2 -2
  195. package/subscriptions/headlessCms/index.js +16 -20
  196. package/subscriptions/headlessCms/index.js.map +1 -1
  197. package/subscriptions/index.d.ts +2 -2
  198. package/subscriptions/index.js +10 -7
  199. package/subscriptions/index.js.map +1 -1
  200. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +3 -3
  201. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +29 -24
  202. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
  203. package/subscriptions/mailer/index.d.ts +2 -2
  204. package/subscriptions/mailer/index.js +3 -3
  205. package/subscriptions/mailer/index.js.map +1 -1
  206. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +3 -3
  207. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +37 -39
  208. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
  209. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +3 -3
  210. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +37 -39
  211. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
  212. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +3 -3
  213. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +41 -44
  214. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
  215. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +3 -3
  216. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +27 -22
  217. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
  218. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +3 -3
  219. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +27 -22
  220. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
  221. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +3 -3
  222. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +30 -26
  223. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
  224. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +3 -3
  225. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +27 -22
  226. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
  227. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +3 -3
  228. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +27 -22
  229. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
  230. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +3 -3
  231. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +30 -26
  232. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
  233. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +3 -3
  234. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +27 -22
  235. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
  236. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +3 -3
  237. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +27 -22
  238. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
  239. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +3 -3
  240. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +30 -26
  241. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
  242. package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
  243. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
  244. package/subscriptions/security/index.d.ts +2 -2
  245. package/subscriptions/security/index.js +14 -20
  246. package/subscriptions/security/index.js.map +1 -1
  247. package/subscriptions/websiteBuilder/index.d.ts +2 -2
  248. package/subscriptions/websiteBuilder/index.js +14 -16
  249. package/subscriptions/websiteBuilder/index.js.map +1 -1
  250. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +3 -3
  251. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +26 -21
  252. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
  253. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +3 -3
  254. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +26 -21
  255. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
  256. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +3 -3
  257. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +26 -21
  258. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
  259. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +3 -3
  260. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +29 -25
  261. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
  262. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +3 -3
  263. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +26 -21
  264. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
  265. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +3 -3
  266. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +26 -21
  267. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
  268. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +3 -3
  269. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +26 -21
  270. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
  271. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +3 -3
  272. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +29 -25
  273. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
  274. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +3 -3
  275. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +26 -21
  276. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
  277. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +3 -3
  278. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +26 -21
  279. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
  280. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +3 -3
  281. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +26 -21
  282. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
  283. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +3 -3
  284. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +29 -25
  285. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
  286. package/types.d.ts +0 -23
  287. package/types.js +0 -3
  288. package/utils/expiresAt.js +14 -19
  289. package/utils/expiresAt.js.map +1 -1
  290. package/utils/getAuditObject.js +14 -15
  291. package/utils/getAuditObject.js.map +1 -1
  292. package/context/AuditLogsContextValue.d.ts +0 -10
  293. package/context/AuditLogsContextValue.js +0 -139
  294. package/context/AuditLogsContextValue.js.map +0 -1
  295. package/context/index.d.ts +0 -9
  296. package/context/index.js +0 -37
  297. package/context/index.js.map +0 -1
  298. package/events/index.js.map +0 -1
  299. package/graphql/schema.d.ts +0 -3
  300. package/graphql/schema.js +0 -126
  301. package/graphql/schema.js.map +0 -1
  302. package/index.js.map +0 -1
  303. package/storage/AccessPatternHandler.d.ts +0 -14
  304. package/storage/AccessPatternHandler.js +0 -60
  305. package/storage/AccessPatternHandler.js.map +0 -1
  306. package/storage/Converter.d.ts +0 -16
  307. package/storage/Converter.js +0 -52
  308. package/storage/Converter.js.map +0 -1
  309. package/storage/Storage.d.ts +0 -18
  310. package/storage/Storage.js +0 -89
  311. package/storage/Storage.js.map +0 -1
  312. package/storage/abstractions/AccessPattern.d.ts +0 -24
  313. package/storage/abstractions/AccessPattern.js +0 -3
  314. package/storage/abstractions/AccessPattern.js.map +0 -1
  315. package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
  316. package/storage/abstractions/AccessPatternHandler.js +0 -3
  317. package/storage/abstractions/AccessPatternHandler.js.map +0 -1
  318. package/storage/abstractions/Converter.d.ts +0 -6
  319. package/storage/abstractions/Converter.js +0 -3
  320. package/storage/abstractions/Converter.js.map +0 -1
  321. package/storage/abstractions/Storage.js.map +0 -1
  322. package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
  323. package/storage/accessPatterns/AppAccessPattern.js +0 -29
  324. package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
  325. package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
  326. package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -32
  327. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
  328. package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
  329. package/storage/accessPatterns/AppEntityAccessPattern.js +0 -29
  330. package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
  331. package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
  332. package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -29
  333. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
  334. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
  335. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -32
  336. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
  337. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
  338. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -32
  339. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
  340. package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
  341. package/storage/accessPatterns/BaseAccessPattern.js +0 -83
  342. package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
  343. package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
  344. package/storage/accessPatterns/CreatedByAccessPattern.js +0 -32
  345. package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
  346. package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
  347. package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -30
  348. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
  349. package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
  350. package/storage/accessPatterns/DefaultAccessPattern.js +0 -36
  351. package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
  352. package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
  353. package/storage/accessPatterns/EntityIdAccessPattern.js +0 -33
  354. package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
  355. package/storage/accessPatterns/index.d.ts +0 -6
  356. package/storage/accessPatterns/index.js +0 -47
  357. package/storage/accessPatterns/index.js.map +0 -1
  358. package/storage/cursorSchema.d.ts +0 -4
  359. package/storage/cursorSchema.js +0 -25
  360. package/storage/cursorSchema.js.map +0 -1
  361. package/storage/entity.d.ts +0 -36
  362. package/storage/entity.js +0 -127
  363. package/storage/entity.js.map +0 -1
  364. package/storage/results/ListErrorResult.d.ts +0 -10
  365. package/storage/results/ListErrorResult.js +0 -11
  366. package/storage/results/ListErrorResult.js.map +0 -1
  367. package/storage/results/ListSuccessResult.d.ts +0 -14
  368. package/storage/results/ListSuccessResult.js +0 -16
  369. package/storage/results/ListSuccessResult.js.map +0 -1
  370. package/storage/results/index.d.ts +0 -2
  371. package/storage/results/index.js +0 -4
  372. package/storage/results/index.js.map +0 -1
  373. package/storage/startKey.d.ts +0 -6
  374. package/storage/startKey.js +0 -9
  375. package/storage/startKey.js.map +0 -1
  376. package/storage/types.js.map +0 -1
  377. package/types.js.map +0 -1
  378. package/utils/getAuditConfig.d.ts +0 -4
  379. package/utils/getAuditConfig.js +0 -105
  380. package/utils/getAuditConfig.js.map +0 -1
@@ -1,32 +1,37 @@
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
- import { AuditLogsContext } from "../../../abstractions.js";
3
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
5
- import { getAuditConfig } from "../../../utils/getAuditConfig.js";
6
5
  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
- });
6
+ constructor(recordAuditLog){
7
+ this.recordAuditLog = recordAuditLog;
8
+ }
9
+ async handle(event) {
10
+ try {
11
+ const { settings } = event.payload;
12
+ const recordResult = await this.recordAuditLog.execute({
13
+ audit: AUDIT.MAILER.SETTINGS.UPDATE,
14
+ message: "Settings updated",
15
+ content: {
16
+ after: settings
17
+ },
18
+ entityId: "-"
19
+ });
20
+ if (recordResult.isFail()) throw recordResult.error;
21
+ } catch (error) {
22
+ throw _webiny_error.from(error, {
23
+ message: "Error while executing AuditLogMailerSettingsAfterSaveHandler",
24
+ code: "AUDIT_LOGS_AFTER_MAILER_SETTINGS_SAVE_HANDLER"
25
+ });
26
+ }
24
27
  }
25
- }
26
28
  }
27
- export const AuditLogMailerSettingsAfterSaveHandler = MailerSettingsAfterSaveEventHandler.createImplementation({
28
- implementation: AuditLogMailerSettingsAfterSaveHandlerImpl,
29
- dependencies: [AuditLogsContext]
29
+ const AuditLogMailerSettingsAfterSaveHandler = MailerSettingsAfterSaveEventHandler.createImplementation({
30
+ implementation: AuditLogMailerSettingsAfterSaveHandlerImpl,
31
+ dependencies: [
32
+ RecordAuditLogUseCase
33
+ ]
30
34
  });
35
+ export { AuditLogMailerSettingsAfterSaveHandler };
31
36
 
32
37
  //# 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 { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogMailerSettingsAfterSaveHandlerImpl\n implements MailerSettingsAfterSaveEventHandler.Interface\n{\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: MailerSettingsAfterSaveEventHandler.Event): Promise<void> {\n try {\n const { settings } = event.payload;\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.MAILER.SETTINGS.UPDATE,\n message: \"Settings updated\",\n content: { after: settings },\n entityId: \"-\"\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\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: [RecordAuditLogUseCase]\n });\n"],"names":["AuditLogMailerSettingsAfterSaveHandlerImpl","recordAuditLog","event","settings","recordResult","AUDIT","error","WebinyError","AuditLogMailerSettingsAfterSaveHandler","MailerSettingsAfterSaveEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IAGF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAAgD,EAAiB;QAC1E,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAElC,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM;gBACnC,SAAS;gBACT,SAAS;oBAAE,OAAOF;gBAAS;gBAC3B,UAAU;YACd;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,yCACTC,oCAAoC,oBAAoB,CAAC;IACrD,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
@@ -1,2 +1,2 @@
1
- import { AuditLogsContext } from "../../abstractions.js";
2
- export declare const createMailerHooks: (context: AuditLogsContext.Interface) => void;
1
+ import type { Container } from "@webiny/di";
2
+ export declare const createMailerHooks: (container: Container) => void;
@@ -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 = (container)=>{
3
+ 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 type { Container } from \"@webiny/di\";\n\nexport const createMailerHooks = (container: Container) => {\n // Register mailer settings event handlers\n container.register(AuditLogMailerSettingsAfterSaveHandler);\n};\n"],"names":["createMailerHooks","container","AuditLogMailerSettingsAfterSaveHandler"],"mappings":";AAGO,MAAMA,oBAAoB,CAACC;IAE9BA,UAAU,QAAQ,CAACC;AACvB"}
@@ -1,8 +1,8 @@
1
1
  import { ApiKeyAfterCreateEventHandler } from "@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
3
  declare class AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateEventHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
6
  handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterCreateHandler: typeof AuditLogApiKeyAfterCreateHandlerImpl & {
@@ -1,47 +1,45 @@
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
- import { AuditLogsContext } from "../../../abstractions.js";
3
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
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
- };
5
+ const cleanupApiKey = (apiKey)=>({
6
+ id: apiKey.id,
7
+ slug: apiKey.slug,
8
+ createdBy: apiKey.createdBy,
9
+ createdOn: apiKey.createdOn,
10
+ description: apiKey.description,
11
+ name: apiKey.name,
12
+ permissions: apiKey.permissions
13
+ });
22
14
  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
- });
15
+ constructor(recordAuditLog){
16
+ this.recordAuditLog = recordAuditLog;
17
+ }
18
+ async handle(event) {
19
+ try {
20
+ const { apiKey: initialApiKey } = event.payload;
21
+ const apiKey = cleanupApiKey(initialApiKey);
22
+ const recordResult = await this.recordAuditLog.execute({
23
+ audit: AUDIT.SECURITY.API_KEY.CREATE,
24
+ message: "API key created",
25
+ content: apiKey,
26
+ entityId: apiKey.id
27
+ });
28
+ if (recordResult.isFail()) throw recordResult.error;
29
+ } catch (error) {
30
+ throw _webiny_error.from(error, {
31
+ message: "Error while executing AuditLogApiKeyAfterCreateHandler",
32
+ code: "AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER"
33
+ });
34
+ }
39
35
  }
40
- }
41
36
  }
42
- export const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterCreateHandlerImpl,
44
- dependencies: [AuditLogsContext]
37
+ const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({
38
+ implementation: AuditLogApiKeyAfterCreateHandlerImpl,
39
+ dependencies: [
40
+ RecordAuditLogUseCase
41
+ ]
45
42
  });
43
+ export { AuditLogApiKeyAfterCreateHandler };
46
44
 
47
45
  //# 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 { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.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 recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.API_KEY.CREATE,\n message: \"API key created\",\n content: apiKey,\n entityId: apiKey.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\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: [RecordAuditLogUseCase]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterCreateHandlerImpl","recordAuditLog","event","initialApiKey","recordResult","AUDIT","error","WebinyError","AuditLogApiKeyAfterCreateHandler","ApiKeyAfterCreateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAWA,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,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAE/C,MAAMH,SAASD,cAAcK;YAE7B,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;gBACpC,SAAS;gBACT,SAASN;gBACT,UAAUA,OAAO,EAAE;YACvB;YACA,IAAIK,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
@@ -1,8 +1,8 @@
1
1
  import { ApiKeyAfterDeleteEventHandler } from "@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
3
  declare class AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteEventHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
6
  handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterDeleteHandler: typeof AuditLogApiKeyAfterDeleteHandlerImpl & {
@@ -1,47 +1,45 @@
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
- import { AuditLogsContext } from "../../../abstractions.js";
3
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
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
- };
5
+ const cleanupApiKey = (apiKey)=>({
6
+ id: apiKey.id,
7
+ slug: apiKey.slug,
8
+ createdBy: apiKey.createdBy,
9
+ createdOn: apiKey.createdOn,
10
+ description: apiKey.description,
11
+ name: apiKey.name,
12
+ permissions: apiKey.permissions
13
+ });
22
14
  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
- });
15
+ constructor(recordAuditLog){
16
+ this.recordAuditLog = recordAuditLog;
17
+ }
18
+ async handle(event) {
19
+ try {
20
+ const { apiKey: initialApiKey } = event.payload;
21
+ const apiKey = cleanupApiKey(initialApiKey);
22
+ const recordResult = await this.recordAuditLog.execute({
23
+ audit: AUDIT.SECURITY.API_KEY.DELETE,
24
+ message: "API key deleted",
25
+ content: apiKey,
26
+ entityId: apiKey.id
27
+ });
28
+ if (recordResult.isFail()) throw recordResult.error;
29
+ } catch (error) {
30
+ throw _webiny_error.from(error, {
31
+ message: "Error while executing AuditLogApiKeyAfterDeleteHandler",
32
+ code: "AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER"
33
+ });
34
+ }
39
35
  }
40
- }
41
36
  }
42
- export const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
44
- dependencies: [AuditLogsContext]
37
+ const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({
38
+ implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
39
+ dependencies: [
40
+ RecordAuditLogUseCase
41
+ ]
45
42
  });
43
+ export { AuditLogApiKeyAfterDeleteHandler };
46
44
 
47
45
  //# 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 { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.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 recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.API_KEY.DELETE,\n message: \"API key deleted\",\n content: apiKey,\n entityId: apiKey.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\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: [RecordAuditLogUseCase]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterDeleteHandlerImpl","recordAuditLog","event","initialApiKey","recordResult","AUDIT","error","WebinyError","AuditLogApiKeyAfterDeleteHandler","ApiKeyAfterDeleteEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAWA,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,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAE/C,MAAMH,SAASD,cAAcK;YAE7B,MAAMC,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;gBACpC,SAAS;gBACT,SAASN;gBACT,UAAUA,OAAO,EAAE;YACvB;YACA,IAAIK,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
@@ -1,8 +1,8 @@
1
1
  import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
3
  declare class AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateEventHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
6
  handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterUpdateHandler: typeof AuditLogApiKeyAfterUpdateHandlerImpl & {
@@ -1,52 +1,49 @@
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
- import { AuditLogsContext } from "../../../abstractions.js";
3
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
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
- };
5
+ const cleanupApiKey = (apiKey)=>({
6
+ id: apiKey.id,
7
+ slug: apiKey.slug,
8
+ createdBy: apiKey.createdBy,
9
+ createdOn: apiKey.createdOn,
10
+ description: apiKey.description,
11
+ name: apiKey.name,
12
+ permissions: apiKey.permissions
13
+ });
22
14
  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
- });
15
+ constructor(recordAuditLog){
16
+ this.recordAuditLog = recordAuditLog;
17
+ }
18
+ async handle(event) {
19
+ try {
20
+ const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;
21
+ const apiKey = cleanupApiKey(initialApiKey);
22
+ const original = cleanupApiKey(initialOriginalApiKey);
23
+ const recordResult = await this.recordAuditLog.execute({
24
+ audit: AUDIT.SECURITY.API_KEY.UPDATE,
25
+ message: "API key updated",
26
+ content: {
27
+ before: original,
28
+ after: apiKey
29
+ },
30
+ entityId: apiKey.id
31
+ });
32
+ if (recordResult.isFail()) throw recordResult.error;
33
+ } catch (error) {
34
+ throw _webiny_error.from(error, {
35
+ message: "Error while executing AuditLogApiKeyAfterUpdateHandler",
36
+ code: "AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER"
37
+ });
38
+ }
44
39
  }
45
- }
46
40
  }
47
- export const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({
48
- implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
49
- dependencies: [AuditLogsContext]
41
+ const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({
42
+ implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
43
+ dependencies: [
44
+ RecordAuditLogUseCase
45
+ ]
50
46
  });
47
+ export { AuditLogApiKeyAfterUpdateHandler };
51
48
 
52
49
  //# 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 { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.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 recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;\n\n const apiKey = cleanupApiKey(initialApiKey);\n const original = cleanupApiKey(initialOriginalApiKey);\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.API_KEY.UPDATE,\n message: \"API key updated\",\n content: {\n before: original,\n after: apiKey\n },\n entityId: apiKey.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\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: [RecordAuditLogUseCase]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterUpdateHandlerImpl","recordAuditLog","event","initialApiKey","initialOriginalApiKey","original","recordResult","AUDIT","error","WebinyError","AuditLogApiKeyAfterUpdateHandler","ApiKeyAfterUpdateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAWA,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,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,SAASC,aAAa,EAAE,UAAUC,qBAAqB,EAAE,GAAGF,MAAM,OAAO;YAEjF,MAAMH,SAASD,cAAcK;YAC7B,MAAME,WAAWP,cAAcM;YAE/B,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;gBACpC,SAAS;gBACT,SAAS;oBACL,QAAQF;oBACR,OAAON;gBACX;gBACA,UAAUA,OAAO,EAAE;YACvB;YACA,IAAIO,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBX;IAChB,cAAc;QAACY;KAAsB;AACzC"}
@@ -1,8 +1,8 @@
1
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
2
2
  import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
3
3
  declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
6
  handle(event: RoleAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterCreateHandler: typeof AuditLogRoleAfterCreateHandlerImpl & {
@@ -1,30 +1,35 @@
1
- import WebinyError from "@webiny/error";
2
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
3
  import { AUDIT } from "../../../config.js";
4
- import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
4
  import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
6
5
  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
- });
6
+ constructor(recordAuditLog){
7
+ this.recordAuditLog = recordAuditLog;
8
+ }
9
+ async handle(event) {
10
+ try {
11
+ const { role } = event.payload;
12
+ const recordResult = await this.recordAuditLog.execute({
13
+ audit: AUDIT.SECURITY.ROLE.CREATE,
14
+ message: "Role created",
15
+ content: role,
16
+ entityId: role.id
17
+ });
18
+ if (recordResult.isFail()) throw recordResult.error;
19
+ } catch (error) {
20
+ throw _webiny_error.from(error, {
21
+ message: "Error while executing AuditLogRoleAfterCreateHandler",
22
+ code: "AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER"
23
+ });
24
+ }
22
25
  }
23
- }
24
26
  }
25
- export const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({
26
- implementation: AuditLogRoleAfterCreateHandlerImpl,
27
- dependencies: [AuditLogsContext]
27
+ const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({
28
+ implementation: AuditLogRoleAfterCreateHandlerImpl,
29
+ dependencies: [
30
+ RecordAuditLogUseCase
31
+ ]
28
32
  });
33
+ export { AuditLogRoleAfterCreateHandler };
29
34
 
30
35
  //# 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 { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { RoleAfterCreateEventHandler } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\n\nclass AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RoleAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.ROLE.CREATE,\n message: \"Role created\",\n content: role,\n entityId: role.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\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: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogRoleAfterCreateHandlerImpl","recordAuditLog","event","role","recordResult","AUDIT","error","WebinyError","AuditLogRoleAfterCreateHandler","RoleAfterCreateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAE9B,MAAME,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;gBACjC,SAAS;gBACT,SAASF;gBACT,UAAUA,KAAK,EAAE;YACrB;YACA,IAAIC,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAEhC,EAAE,OAAOE,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,4BAA4B,oBAAoB,CAAC;IAC3F,gBAAgBT;IAChB,cAAc;QAACU;KAAsB;AACzC"}
@@ -1,8 +1,8 @@
1
1
  import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
3
  declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
6
  handle(event: RoleAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterDeleteHandler: typeof AuditLogRoleAfterDeleteHandlerImpl & {