@webiny/api-audit-logs 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e1999482d0

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 (388) 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.d.ts +2 -2
  13. package/events/AuditLogAfterCreateEvent.js +9 -6
  14. package/events/AuditLogAfterCreateEvent.js.map +1 -1
  15. package/events/AuditLogAfterUpdateEvent.d.ts +2 -2
  16. package/events/AuditLogAfterUpdateEvent.js +9 -6
  17. package/events/AuditLogAfterUpdateEvent.js.map +1 -1
  18. package/events/AuditLogBeforeCreateEvent.d.ts +2 -2
  19. package/events/AuditLogBeforeCreateEvent.js +9 -6
  20. package/events/AuditLogBeforeCreateEvent.js.map +1 -1
  21. package/events/AuditLogBeforeUpdateEvent.d.ts +2 -2
  22. package/events/AuditLogBeforeUpdateEvent.js +9 -6
  23. package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
  24. package/events/abstractions.d.ts +1 -6
  25. package/events/abstractions.js +5 -24
  26. package/events/abstractions.js.map +1 -1
  27. package/events/index.js +0 -2
  28. package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
  29. package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
  30. package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
  31. package/features/AuditLogPermissions/abstractions.d.ts +11 -0
  32. package/features/AuditLogPermissions/abstractions.js +5 -0
  33. package/features/AuditLogPermissions/abstractions.js.map +1 -0
  34. package/features/AuditLogPermissions/feature.d.ts +4 -0
  35. package/features/AuditLogPermissions/feature.js +11 -0
  36. package/features/AuditLogPermissions/feature.js.map +1 -0
  37. package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
  38. package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
  39. package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
  40. package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
  41. package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
  42. package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
  43. package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
  44. package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
  45. package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
  46. package/features/CreateAuditLog/abstractions.d.ts +42 -0
  47. package/features/CreateAuditLog/abstractions.js +7 -0
  48. package/features/CreateAuditLog/abstractions.js.map +1 -0
  49. package/features/CreateAuditLog/feature.d.ts +4 -0
  50. package/features/CreateAuditLog/feature.js +15 -0
  51. package/features/CreateAuditLog/feature.js.map +1 -0
  52. package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
  53. package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
  54. package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
  55. package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
  56. package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
  57. package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
  58. package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
  59. package/features/GetAuditLog/GetAuditLogUseCase.js +32 -0
  60. package/features/GetAuditLog/GetAuditLogUseCase.js.map +1 -0
  61. package/features/GetAuditLog/abstractions.d.ts +42 -0
  62. package/features/GetAuditLog/abstractions.js +7 -0
  63. package/features/GetAuditLog/abstractions.js.map +1 -0
  64. package/features/GetAuditLog/feature.d.ts +4 -0
  65. package/features/GetAuditLog/feature.js +15 -0
  66. package/features/GetAuditLog/feature.js.map +1 -0
  67. package/features/ListAuditLogs/ListAuditLogsGateway.d.ts +12 -0
  68. package/features/ListAuditLogs/ListAuditLogsGateway.js +24 -0
  69. package/features/ListAuditLogs/ListAuditLogsGateway.js.map +1 -0
  70. package/features/ListAuditLogs/ListAuditLogsRepository.d.ts +17 -0
  71. package/features/ListAuditLogs/ListAuditLogsRepository.js +38 -0
  72. package/features/ListAuditLogs/ListAuditLogsRepository.js.map +1 -0
  73. package/features/ListAuditLogs/ListAuditLogsUseCase.d.ts +15 -0
  74. package/features/ListAuditLogs/ListAuditLogsUseCase.js +27 -0
  75. package/features/ListAuditLogs/ListAuditLogsUseCase.js.map +1 -0
  76. package/features/ListAuditLogs/abstractions.d.ts +55 -0
  77. package/features/ListAuditLogs/abstractions.js +7 -0
  78. package/features/ListAuditLogs/abstractions.js.map +1 -0
  79. package/features/ListAuditLogs/feature.d.ts +4 -0
  80. package/features/ListAuditLogs/feature.js +15 -0
  81. package/features/ListAuditLogs/feature.js.map +1 -0
  82. package/features/RecordAuditLog/RecordAuditLogUseCase.d.ts +30 -0
  83. package/features/RecordAuditLog/RecordAuditLogUseCase.js +104 -0
  84. package/features/RecordAuditLog/RecordAuditLogUseCase.js.map +1 -0
  85. package/features/RecordAuditLog/abstractions.d.ts +26 -0
  86. package/features/RecordAuditLog/abstractions.js +5 -0
  87. package/features/RecordAuditLog/abstractions.js.map +1 -0
  88. package/features/RecordAuditLog/feature.d.ts +4 -0
  89. package/features/RecordAuditLog/feature.js +11 -0
  90. package/features/RecordAuditLog/feature.js.map +1 -0
  91. package/features/UpdateAuditLog/UpdateAuditLogGateway.d.ts +12 -0
  92. package/features/UpdateAuditLog/UpdateAuditLogGateway.js +23 -0
  93. package/features/UpdateAuditLog/UpdateAuditLogGateway.js.map +1 -0
  94. package/features/UpdateAuditLog/UpdateAuditLogRepository.d.ts +14 -0
  95. package/features/UpdateAuditLog/UpdateAuditLogRepository.js +25 -0
  96. package/features/UpdateAuditLog/UpdateAuditLogRepository.js.map +1 -0
  97. package/features/UpdateAuditLog/UpdateAuditLogUseCase.d.ts +18 -0
  98. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js +53 -0
  99. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js.map +1 -0
  100. package/features/UpdateAuditLog/abstractions.d.ts +42 -0
  101. package/features/UpdateAuditLog/abstractions.js +7 -0
  102. package/features/UpdateAuditLog/abstractions.js.map +1 -0
  103. package/features/UpdateAuditLog/feature.d.ts +4 -0
  104. package/features/UpdateAuditLog/feature.js +15 -0
  105. package/features/UpdateAuditLog/feature.js.map +1 -0
  106. package/graphql/AuditLogsGraphQLSchema.d.ts +10 -0
  107. package/graphql/AuditLogsGraphQLSchema.js +139 -0
  108. package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
  109. package/graphql/validation.d.ts +10 -53
  110. package/graphql/validation.js +26 -30
  111. package/graphql/validation.js.map +1 -1
  112. package/index.d.ts +2 -8
  113. package/index.js +1 -22
  114. package/package.json +34 -30
  115. package/storage/abstractions/Storage.js +0 -3
  116. package/storage/types.d.ts +0 -35
  117. package/storage/types.js +0 -3
  118. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +7 -7
  119. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +38 -28
  120. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
  121. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +7 -7
  122. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +54 -31
  123. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
  124. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +7 -7
  125. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +44 -35
  126. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
  127. package/subscriptions/aco/index.d.ts +2 -2
  128. package/subscriptions/aco/index.js +5 -4
  129. package/subscriptions/aco/index.js.map +1 -1
  130. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
  131. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +45 -0
  132. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
  133. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
  134. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +42 -0
  135. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
  136. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
  137. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +44 -0
  138. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
  139. package/subscriptions/ai/index.d.ts +2 -0
  140. package/subscriptions/ai/index.js +11 -0
  141. package/subscriptions/ai/index.js.map +1 -0
  142. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +7 -7
  143. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +28 -23
  144. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
  145. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +7 -7
  146. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +28 -23
  147. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
  148. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +7 -7
  149. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +31 -27
  150. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
  151. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +7 -7
  152. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +31 -27
  153. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
  154. package/subscriptions/fileManager/index.d.ts +2 -2
  155. package/subscriptions/fileManager/index.js +6 -8
  156. package/subscriptions/fileManager/index.js.map +1 -1
  157. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +4 -4
  158. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +27 -25
  159. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
  160. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +4 -4
  161. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +37 -31
  162. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
  163. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +4 -4
  164. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +27 -25
  165. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
  166. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +4 -4
  167. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +27 -25
  168. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
  169. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +4 -4
  170. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +27 -25
  171. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
  172. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +4 -4
  173. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +30 -29
  174. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
  175. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +4 -4
  176. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +27 -25
  177. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
  178. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +4 -4
  179. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +27 -25
  180. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
  181. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +4 -4
  182. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +27 -22
  183. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
  184. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +4 -4
  185. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +27 -22
  186. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
  187. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +4 -4
  188. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +30 -26
  189. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
  190. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +4 -4
  191. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +27 -22
  192. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
  193. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +4 -4
  194. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +27 -22
  195. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
  196. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +4 -4
  197. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +30 -26
  198. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
  199. package/subscriptions/headlessCms/index.d.ts +2 -2
  200. package/subscriptions/headlessCms/index.js +16 -20
  201. package/subscriptions/headlessCms/index.js.map +1 -1
  202. package/subscriptions/index.d.ts +2 -2
  203. package/subscriptions/index.js +10 -7
  204. package/subscriptions/index.js.map +1 -1
  205. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +7 -7
  206. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +33 -25
  207. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
  208. package/subscriptions/mailer/index.d.ts +2 -2
  209. package/subscriptions/mailer/index.js +3 -3
  210. package/subscriptions/mailer/index.js.map +1 -1
  211. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +7 -7
  212. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +38 -40
  213. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
  214. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +7 -7
  215. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +38 -40
  216. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
  217. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +7 -7
  218. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +42 -45
  219. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
  220. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +7 -7
  221. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +28 -23
  222. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
  223. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +7 -7
  224. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +28 -23
  225. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
  226. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +7 -7
  227. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +31 -27
  228. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
  229. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +7 -7
  230. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +28 -23
  231. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
  232. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +7 -7
  233. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +28 -23
  234. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
  235. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +7 -7
  236. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +31 -27
  237. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
  238. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +7 -7
  239. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +28 -23
  240. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
  241. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +7 -7
  242. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +28 -23
  243. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
  244. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +7 -7
  245. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +31 -27
  246. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
  247. package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
  248. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
  249. package/subscriptions/security/index.d.ts +2 -2
  250. package/subscriptions/security/index.js +14 -20
  251. package/subscriptions/security/index.js.map +1 -1
  252. package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.d.ts +21 -0
  253. package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.js +63 -0
  254. package/subscriptions/websiteBuilder/globalComponents/SaveGlobalComponentWithAuditLog.js.map +1 -0
  255. package/subscriptions/websiteBuilder/index.d.ts +2 -2
  256. package/subscriptions/websiteBuilder/index.js +16 -16
  257. package/subscriptions/websiteBuilder/index.js.map +1 -1
  258. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +7 -7
  259. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +27 -22
  260. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
  261. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +7 -7
  262. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +27 -22
  263. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
  264. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +7 -7
  265. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +27 -22
  266. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
  267. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +7 -7
  268. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +30 -26
  269. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
  270. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +7 -7
  271. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +27 -22
  272. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
  273. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +7 -7
  274. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +27 -22
  275. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
  276. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +7 -7
  277. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +27 -22
  278. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
  279. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +7 -7
  280. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +30 -26
  281. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
  282. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +7 -7
  283. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +27 -22
  284. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
  285. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +7 -7
  286. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +27 -22
  287. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
  288. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +7 -7
  289. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +27 -22
  290. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
  291. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +7 -7
  292. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +30 -26
  293. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
  294. package/types.d.ts +0 -23
  295. package/types.js +0 -3
  296. package/utils/expiresAt.js +14 -19
  297. package/utils/expiresAt.js.map +1 -1
  298. package/utils/getAuditObject.js +14 -15
  299. package/utils/getAuditObject.js.map +1 -1
  300. package/context/AuditLogsContextValue.d.ts +0 -10
  301. package/context/AuditLogsContextValue.js +0 -139
  302. package/context/AuditLogsContextValue.js.map +0 -1
  303. package/context/index.d.ts +0 -9
  304. package/context/index.js +0 -35
  305. package/context/index.js.map +0 -1
  306. package/events/index.js.map +0 -1
  307. package/graphql/schema.d.ts +0 -3
  308. package/graphql/schema.js +0 -126
  309. package/graphql/schema.js.map +0 -1
  310. package/index.js.map +0 -1
  311. package/storage/AccessPatternHandler.d.ts +0 -14
  312. package/storage/AccessPatternHandler.js +0 -60
  313. package/storage/AccessPatternHandler.js.map +0 -1
  314. package/storage/Converter.d.ts +0 -16
  315. package/storage/Converter.js +0 -52
  316. package/storage/Converter.js.map +0 -1
  317. package/storage/Storage.d.ts +0 -18
  318. package/storage/Storage.js +0 -89
  319. package/storage/Storage.js.map +0 -1
  320. package/storage/abstractions/AccessPattern.d.ts +0 -24
  321. package/storage/abstractions/AccessPattern.js +0 -3
  322. package/storage/abstractions/AccessPattern.js.map +0 -1
  323. package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
  324. package/storage/abstractions/AccessPatternHandler.js +0 -3
  325. package/storage/abstractions/AccessPatternHandler.js.map +0 -1
  326. package/storage/abstractions/Converter.d.ts +0 -6
  327. package/storage/abstractions/Converter.js +0 -3
  328. package/storage/abstractions/Converter.js.map +0 -1
  329. package/storage/abstractions/Storage.js.map +0 -1
  330. package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
  331. package/storage/accessPatterns/AppAccessPattern.js +0 -29
  332. package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
  333. package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
  334. package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -32
  335. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
  336. package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
  337. package/storage/accessPatterns/AppEntityAccessPattern.js +0 -29
  338. package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
  339. package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
  340. package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -29
  341. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
  342. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
  343. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -32
  344. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
  345. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
  346. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -32
  347. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
  348. package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
  349. package/storage/accessPatterns/BaseAccessPattern.js +0 -82
  350. package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
  351. package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
  352. package/storage/accessPatterns/CreatedByAccessPattern.js +0 -32
  353. package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
  354. package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
  355. package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -30
  356. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
  357. package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
  358. package/storage/accessPatterns/DefaultAccessPattern.js +0 -36
  359. package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
  360. package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
  361. package/storage/accessPatterns/EntityIdAccessPattern.js +0 -33
  362. package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
  363. package/storage/accessPatterns/index.d.ts +0 -6
  364. package/storage/accessPatterns/index.js +0 -47
  365. package/storage/accessPatterns/index.js.map +0 -1
  366. package/storage/cursorSchema.d.ts +0 -4
  367. package/storage/cursorSchema.js +0 -25
  368. package/storage/cursorSchema.js.map +0 -1
  369. package/storage/entity.d.ts +0 -36
  370. package/storage/entity.js +0 -127
  371. package/storage/entity.js.map +0 -1
  372. package/storage/results/ListErrorResult.d.ts +0 -10
  373. package/storage/results/ListErrorResult.js +0 -11
  374. package/storage/results/ListErrorResult.js.map +0 -1
  375. package/storage/results/ListSuccessResult.d.ts +0 -14
  376. package/storage/results/ListSuccessResult.js +0 -16
  377. package/storage/results/ListSuccessResult.js.map +0 -1
  378. package/storage/results/index.d.ts +0 -2
  379. package/storage/results/index.js +0 -4
  380. package/storage/results/index.js.map +0 -1
  381. package/storage/startKey.d.ts +0 -6
  382. package/storage/startKey.js +0 -9
  383. package/storage/startKey.js.map +0 -1
  384. package/storage/types.js.map +0 -1
  385. package/types.js.map +0 -1
  386. package/utils/getAuditConfig.d.ts +0 -4
  387. package/utils/getAuditConfig.js +0 -105
  388. package/utils/getAuditConfig.js.map +0 -1
@@ -1,52 +1,49 @@
1
- import WebinyError from "@webiny/error";
2
- import { ApiKeyAfterUpdateHandler } from "@webiny/api-core/features/UpdateApiKey";
3
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.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 = ApiKeyAfterUpdateHandler.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","ApiKeyAfterUpdateHandler","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 { ApiKeyAfterUpdateHandler } from \"@webiny/api-core/features/UpdateApiKey\";\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 ApiKeyAfterUpdateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterUpdateHandler.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 = ApiKeyAfterUpdateHandler.createImplementation({\n implementation: AuditLogApiKeyAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,wBAAwB,QAAQ,wCAAwC;AACjF,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,CAA+C;EACrFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAqC,EAAiB;IAC/D,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,wBAAwB,CAACkC,oBAAoB,CAAC;EAC1FC,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,11 +1,11 @@
1
- import { AuditLogsContext } from "../../../abstractions.js";
2
- import { RoleAfterCreateHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
3
- declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterCreateHandler.Event): Promise<void>;
1
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
2
+ import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
3
+ declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
+ handle(event: RoleAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterCreateHandler: typeof AuditLogRoleAfterCreateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/CreateRole/events").RoleAfterCreateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/CreateRole/events").RoleAfterCreateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,30 +1,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
- import { RoleAfterCreateHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
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 = RoleAfterCreateHandler.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","RoleAfterCreateHandler","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 { RoleAfterCreateHandler } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\n\nclass AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterCreateHandler.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 = RoleAfterCreateHandler.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,sBAAsB,QAAQ,8DAA8D;AAErG,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,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,sBAAsB,CAACkB,oBAAoB,CAAC;EACtFC,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,11 +1,11 @@
1
- import { RoleAfterDeleteHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterDeleteHandler.Event): Promise<void>;
1
+ import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
+ declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
+ handle(event: RoleAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterDeleteHandler: typeof AuditLogRoleAfterDeleteHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/DeleteRole/events").RoleAfterDeleteEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/DeleteRole/events").RoleAfterDeleteEvent>>;
10
10
  };
11
11
  export {};
@@ -1,30 +1,35 @@
1
- import WebinyError from "@webiny/error";
2
- import { RoleAfterDeleteHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
3
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.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 AuditLogRoleAfterDeleteHandlerImpl {
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.DELETE);
16
- await createAuditLog("Role deleted", role, role.id, this.context);
17
- } catch (error) {
18
- throw WebinyError.from(error, {
19
- message: "Error while executing AuditLogRoleAfterDeleteHandler",
20
- code: "AUDIT_LOGS_AFTER_ROLE_DELETE_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.DELETE,
14
+ message: "Role deleted",
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 AuditLogRoleAfterDeleteHandler",
22
+ code: "AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER"
23
+ });
24
+ }
22
25
  }
23
- }
24
26
  }
25
- export const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteHandler.createImplementation({
26
- implementation: AuditLogRoleAfterDeleteHandlerImpl,
27
- dependencies: [AuditLogsContext]
27
+ const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({
28
+ implementation: AuditLogRoleAfterDeleteHandlerImpl,
29
+ dependencies: [
30
+ RecordAuditLogUseCase
31
+ ]
28
32
  });
33
+ export { AuditLogRoleAfterDeleteHandler };
29
34
 
30
35
  //# sourceMappingURL=AuditLogRoleAfterDeleteHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","RoleAfterDeleteHandler","AuditLogsContext","AUDIT","getAuditConfig","AuditLogRoleAfterDeleteHandlerImpl","constructor","context","handle","event","role","payload","createAuditLog","SECURITY","ROLE","DELETE","id","error","from","message","code","AuditLogRoleAfterDeleteHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogRoleAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterDeleteHandler } from \"@webiny/api-core/features/security/roles/DeleteRole/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterDeleteHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);\n\n await createAuditLog(\"Role deleted\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteHandler.createImplementation({\n implementation: AuditLogRoleAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,8DAA8D;AACrG,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAEvB,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,IAAI;MACA,MAAM;QAAEC;MAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC9B,MAAMC,cAAc,GAAGR,cAAc,CAACD,KAAK,CAACU,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,GAAGpB,sBAAsB,CAACqB,oBAAoB,CAAC;EACtFC,cAAc,EAAElB,kCAAkC;EAClDmB,YAAY,EAAE,CAACtB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterDeleteEventHandler } from \"@webiny/api-core/features/security/roles/DeleteRole/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RoleAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.ROLE.DELETE,\n message: \"Role deleted\",\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 AuditLogRoleAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogRoleAfterDeleteHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogRoleAfterDeleteHandlerImpl","recordAuditLog","event","role","recordResult","AUDIT","error","WebinyError","AuditLogRoleAfterDeleteHandler","RoleAfterDeleteEventHandler","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,11 +1,11 @@
1
- import { RoleAfterUpdateHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
2
- import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterUpdateHandler.Event): Promise<void>;
1
+ import { RoleAfterUpdateEventHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
+ declare class AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateEventHandler.Interface {
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
+ handle(event: RoleAfterUpdateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterUpdateHandler: typeof AuditLogRoleAfterUpdateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/UpdateRole/events").RoleAfterUpdateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/UpdateRole/events").RoleAfterUpdateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,34 +1,38 @@
1
- import WebinyError from "@webiny/error";
2
- import { RoleAfterUpdateHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
3
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { RoleAfterUpdateEventHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.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 AuditLogRoleAfterUpdateHandlerImpl {
7
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- updated,
14
- original
15
- } = event.payload;
16
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.UPDATE);
17
- await createAuditLog("Role updated", {
18
- before: original,
19
- after: updated
20
- }, updated.id, this.context);
21
- } catch (error) {
22
- throw WebinyError.from(error, {
23
- message: "Error while executing AuditLogRoleAfterUpdateHandler",
24
- code: "AUDIT_LOGS_AFTER_ROLE_UPDATE_HANDLER"
25
- });
6
+ constructor(recordAuditLog){
7
+ this.recordAuditLog = recordAuditLog;
8
+ }
9
+ async handle(event) {
10
+ try {
11
+ const { updated, original } = event.payload;
12
+ const recordResult = await this.recordAuditLog.execute({
13
+ audit: AUDIT.SECURITY.ROLE.UPDATE,
14
+ message: "Role updated",
15
+ content: {
16
+ before: original,
17
+ after: updated
18
+ },
19
+ entityId: updated.id
20
+ });
21
+ if (recordResult.isFail()) throw recordResult.error;
22
+ } catch (error) {
23
+ throw _webiny_error.from(error, {
24
+ message: "Error while executing AuditLogRoleAfterUpdateHandler",
25
+ code: "AUDIT_LOGS_AFTER_ROLE_UPDATE_HANDLER"
26
+ });
27
+ }
26
28
  }
27
- }
28
29
  }
29
- export const AuditLogRoleAfterUpdateHandler = RoleAfterUpdateHandler.createImplementation({
30
- implementation: AuditLogRoleAfterUpdateHandlerImpl,
31
- dependencies: [AuditLogsContext]
30
+ const AuditLogRoleAfterUpdateHandler = RoleAfterUpdateEventHandler.createImplementation({
31
+ implementation: AuditLogRoleAfterUpdateHandlerImpl,
32
+ dependencies: [
33
+ RecordAuditLogUseCase
34
+ ]
32
35
  });
36
+ export { AuditLogRoleAfterUpdateHandler };
33
37
 
34
38
  //# sourceMappingURL=AuditLogRoleAfterUpdateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","RoleAfterUpdateHandler","AuditLogsContext","AUDIT","getAuditConfig","AuditLogRoleAfterUpdateHandlerImpl","constructor","context","handle","event","updated","original","payload","createAuditLog","SECURITY","ROLE","UPDATE","before","after","id","error","from","message","code","AuditLogRoleAfterUpdateHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogRoleAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterUpdateHandler } from \"@webiny/api-core/features/security/roles/UpdateRole/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterUpdateHandler.Event): Promise<void> {\n try {\n const { updated, original } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.UPDATE);\n\n await createAuditLog(\n \"Role updated\",\n { before: original, after: updated },\n updated.id,\n this.context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterUpdateHandler = RoleAfterUpdateHandler.createImplementation({\n implementation: AuditLogRoleAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,8DAA8D;AACrG,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAEvB,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,IAAI;MACA,MAAM;QAAEC,OAAO;QAAEC;MAAS,CAAC,GAAGF,KAAK,CAACG,OAAO;MAC3C,MAAMC,cAAc,GAAGT,cAAc,CAACD,KAAK,CAACW,QAAQ,CAACC,IAAI,CAACC,MAAM,CAAC;MAEjE,MAAMH,cAAc,CAChB,cAAc,EACd;QAAEI,MAAM,EAAEN,QAAQ;QAAEO,KAAK,EAAER;MAAQ,CAAC,EACpCA,OAAO,CAACS,EAAE,EACV,IAAI,CAACZ,OACT,CAAC;IACL,CAAC,CAAC,OAAOa,KAAK,EAAE;MACZ,MAAMpB,WAAW,CAACqB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,sDAAsD;QAC/DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,8BAA8B,GAAGvB,sBAAsB,CAACwB,oBAAoB,CAAC;EACtFC,cAAc,EAAErB,kCAAkC;EAClDsB,YAAY,EAAE,CAACzB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterUpdateEventHandler } from \"@webiny/api-core/features/security/roles/UpdateRole/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: RoleAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { updated, original } = event.payload;\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.ROLE.UPDATE,\n message: \"Role updated\",\n content: { before: original, after: updated },\n entityId: updated.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterUpdateHandler = RoleAfterUpdateEventHandler.createImplementation({\n implementation: AuditLogRoleAfterUpdateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogRoleAfterUpdateHandlerImpl","recordAuditLog","event","updated","original","recordResult","AUDIT","error","WebinyError","AuditLogRoleAfterUpdateHandler","RoleAfterUpdateEventHandler","RecordAuditLogUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoBC,cAA+C,CAAE;aAAjDA,cAAc,GAAdA;IAAkD;IAEtE,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;YAE3C,MAAMG,eAAe,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBACnD,OAAOC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;gBACjC,SAAS;gBACT,SAAS;oBAAE,QAAQF;oBAAU,OAAOD;gBAAQ;gBAC5C,UAAUA,QAAQ,EAAE;YACxB;YACA,IAAIE,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,gBAAgBV;IAChB,cAAc;QAACW;KAAsB;AACzC"}
@@ -1,11 +1,11 @@
1
- import { TeamAfterCreateHandler } from "@webiny/api-core/features/CreateTeam";
2
- import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogTeamAfterCreateHandlerImpl implements TeamAfterCreateHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
6
- handle(event: TeamAfterCreateHandler.Event): Promise<void>;
1
+ import { TeamAfterCreateEventHandler } from "@webiny/api-core/features/security/teams/CreateTeam/index.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
+ declare class AuditLogTeamAfterCreateHandlerImpl implements TeamAfterCreateEventHandler.Interface {
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
+ handle(event: TeamAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogTeamAfterCreateHandler: typeof AuditLogTeamAfterCreateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/teams/CreateTeam/events").TeamAfterCreateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/teams/CreateTeam/events").TeamAfterCreateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,30 +1,35 @@
1
- import WebinyError from "@webiny/error";
2
- import { TeamAfterCreateHandler } from "@webiny/api-core/features/CreateTeam";
3
- import { AuditLogsContext } from "../../../abstractions.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { TeamAfterCreateEventHandler } from "@webiny/api-core/features/security/teams/CreateTeam/index.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 AuditLogTeamAfterCreateHandlerImpl {
7
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- team
14
- } = event.payload;
15
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.TEAM.CREATE);
16
- await createAuditLog("Team created", team, team.id, this.context);
17
- } catch (error) {
18
- throw WebinyError.from(error, {
19
- message: "Error while executing AuditLogTeamAfterCreateHandler",
20
- code: "AUDIT_LOGS_AFTER_TEAM_CREATE_HANDLER"
21
- });
6
+ constructor(recordAuditLog){
7
+ this.recordAuditLog = recordAuditLog;
8
+ }
9
+ async handle(event) {
10
+ try {
11
+ const { team } = event.payload;
12
+ const recordResult = await this.recordAuditLog.execute({
13
+ audit: AUDIT.SECURITY.TEAM.CREATE,
14
+ message: "Team created",
15
+ content: team,
16
+ entityId: team.id
17
+ });
18
+ if (recordResult.isFail()) throw recordResult.error;
19
+ } catch (error) {
20
+ throw _webiny_error.from(error, {
21
+ message: "Error while executing AuditLogTeamAfterCreateHandler",
22
+ code: "AUDIT_LOGS_AFTER_TEAM_CREATE_HANDLER"
23
+ });
24
+ }
22
25
  }
23
- }
24
26
  }
25
- export const AuditLogTeamAfterCreateHandler = TeamAfterCreateHandler.createImplementation({
26
- implementation: AuditLogTeamAfterCreateHandlerImpl,
27
- dependencies: [AuditLogsContext]
27
+ const AuditLogTeamAfterCreateHandler = TeamAfterCreateEventHandler.createImplementation({
28
+ implementation: AuditLogTeamAfterCreateHandlerImpl,
29
+ dependencies: [
30
+ RecordAuditLogUseCase
31
+ ]
28
32
  });
33
+ export { AuditLogTeamAfterCreateHandler };
29
34
 
30
35
  //# sourceMappingURL=AuditLogTeamAfterCreateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","TeamAfterCreateHandler","AuditLogsContext","AUDIT","getAuditConfig","AuditLogTeamAfterCreateHandlerImpl","constructor","context","handle","event","team","payload","createAuditLog","SECURITY","TEAM","CREATE","id","error","from","message","code","AuditLogTeamAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogTeamAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { TeamAfterCreateHandler } from \"@webiny/api-core/features/CreateTeam\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogTeamAfterCreateHandlerImpl implements TeamAfterCreateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: TeamAfterCreateHandler.Event): Promise<void> {\n try {\n const { team } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.TEAM.CREATE);\n\n await createAuditLog(\"Team created\", team, team.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogTeamAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_TEAM_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogTeamAfterCreateHandler = TeamAfterCreateHandler.createImplementation({\n implementation: AuditLogTeamAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,sCAAsC;AAC7E,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAEvB,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,IAAI;MACA,MAAM;QAAEC;MAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC9B,MAAMC,cAAc,GAAGR,cAAc,CAACD,KAAK,CAACU,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,GAAGpB,sBAAsB,CAACqB,oBAAoB,CAAC;EACtFC,cAAc,EAAElB,kCAAkC;EAClDmB,YAAY,EAAE,CAACtB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { TeamAfterCreateEventHandler } from \"@webiny/api-core/features/security/teams/CreateTeam/index.js\";\nimport { RecordAuditLogUseCase } from \"~/features/RecordAuditLog/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass AuditLogTeamAfterCreateHandlerImpl implements TeamAfterCreateEventHandler.Interface {\n constructor(private recordAuditLog: RecordAuditLogUseCase.Interface) {}\n\n async handle(event: TeamAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { team } = event.payload;\n\n const recordResult = await this.recordAuditLog.execute({\n audit: AUDIT.SECURITY.TEAM.CREATE,\n message: \"Team created\",\n content: team,\n entityId: team.id\n });\n if (recordResult.isFail()) {\n throw recordResult.error;\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogTeamAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_TEAM_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogTeamAfterCreateHandler = TeamAfterCreateEventHandler.createImplementation({\n implementation: AuditLogTeamAfterCreateHandlerImpl,\n dependencies: [RecordAuditLogUseCase]\n});\n"],"names":["AuditLogTeamAfterCreateHandlerImpl","recordAuditLog","event","team","recordResult","AUDIT","error","WebinyError","AuditLogTeamAfterCreateHandler","TeamAfterCreateEventHandler","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,11 +1,11 @@
1
- import { TeamAfterDeleteHandler } from "@webiny/api-core/features/DeleteTeam";
2
- import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogTeamAfterDeleteHandlerImpl implements TeamAfterDeleteHandler.Interface {
4
- private context;
5
- constructor(context: AuditLogsContext.Interface);
6
- handle(event: TeamAfterDeleteHandler.Event): Promise<void>;
1
+ import { TeamAfterDeleteEventHandler } from "@webiny/api-core/features/security/teams/DeleteTeam/index.js";
2
+ import { RecordAuditLogUseCase } from "../../../features/RecordAuditLog/abstractions.js";
3
+ declare class AuditLogTeamAfterDeleteHandlerImpl implements TeamAfterDeleteEventHandler.Interface {
4
+ private recordAuditLog;
5
+ constructor(recordAuditLog: RecordAuditLogUseCase.Interface);
6
+ handle(event: TeamAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogTeamAfterDeleteHandler: typeof AuditLogTeamAfterDeleteHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/DeleteTeam").TeamAfterDeleteEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/teams/DeleteTeam/events").TeamAfterDeleteEvent>>;
10
10
  };
11
11
  export {};