@webiny/api-audit-logs 0.0.0-unstable.eb196ccd2f → 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/README.md +11 -1
  5. package/abstractions.d.ts +15 -0
  6. package/abstractions.js +6 -0
  7. package/abstractions.js.map +1 -0
  8. package/config.d.ts +0 -13
  9. package/config.js +4 -291
  10. package/config.js.map +1 -1
  11. package/domain/errors.d.ts +5 -0
  12. package/domain/errors.js +11 -0
  13. package/domain/errors.js.map +1 -0
  14. package/events/AuditLogAfterCreateEvent.d.ts +6 -0
  15. package/events/AuditLogAfterCreateEvent.js +13 -0
  16. package/events/AuditLogAfterCreateEvent.js.map +1 -0
  17. package/events/AuditLogAfterUpdateEvent.d.ts +6 -0
  18. package/events/AuditLogAfterUpdateEvent.js +13 -0
  19. package/events/AuditLogAfterUpdateEvent.js.map +1 -0
  20. package/events/AuditLogBeforeCreateEvent.d.ts +6 -0
  21. package/events/AuditLogBeforeCreateEvent.js +13 -0
  22. package/events/AuditLogBeforeCreateEvent.js.map +1 -0
  23. package/events/AuditLogBeforeUpdateEvent.d.ts +6 -0
  24. package/events/AuditLogBeforeUpdateEvent.js +13 -0
  25. package/events/AuditLogBeforeUpdateEvent.js.map +1 -0
  26. package/events/abstractions.d.ts +38 -0
  27. package/events/abstractions.js +8 -0
  28. package/events/abstractions.js.map +1 -0
  29. package/events/index.d.ts +5 -0
  30. package/events/index.js +5 -0
  31. package/features/AuditLogPermissions/AuditLogPermissions.d.ts +15 -0
  32. package/features/AuditLogPermissions/AuditLogPermissions.js +24 -0
  33. package/features/AuditLogPermissions/AuditLogPermissions.js.map +1 -0
  34. package/features/AuditLogPermissions/abstractions.d.ts +11 -0
  35. package/features/AuditLogPermissions/abstractions.js +5 -0
  36. package/features/AuditLogPermissions/abstractions.js.map +1 -0
  37. package/features/AuditLogPermissions/feature.d.ts +4 -0
  38. package/features/AuditLogPermissions/feature.js +11 -0
  39. package/features/AuditLogPermissions/feature.js.map +1 -0
  40. package/features/CreateAuditLog/CreateAuditLogGateway.d.ts +12 -0
  41. package/features/CreateAuditLog/CreateAuditLogGateway.js +23 -0
  42. package/features/CreateAuditLog/CreateAuditLogGateway.js.map +1 -0
  43. package/features/CreateAuditLog/CreateAuditLogRepository.d.ts +14 -0
  44. package/features/CreateAuditLog/CreateAuditLogRepository.js +25 -0
  45. package/features/CreateAuditLog/CreateAuditLogRepository.js.map +1 -0
  46. package/features/CreateAuditLog/CreateAuditLogUseCase.d.ts +24 -0
  47. package/features/CreateAuditLog/CreateAuditLogUseCase.js +70 -0
  48. package/features/CreateAuditLog/CreateAuditLogUseCase.js.map +1 -0
  49. package/features/CreateAuditLog/abstractions.d.ts +42 -0
  50. package/features/CreateAuditLog/abstractions.js +7 -0
  51. package/features/CreateAuditLog/abstractions.js.map +1 -0
  52. package/features/CreateAuditLog/feature.d.ts +4 -0
  53. package/features/CreateAuditLog/feature.js +15 -0
  54. package/features/CreateAuditLog/feature.js.map +1 -0
  55. package/features/GetAuditLog/GetAuditLogGateway.d.ts +13 -0
  56. package/features/GetAuditLog/GetAuditLogGateway.js +21 -0
  57. package/features/GetAuditLog/GetAuditLogGateway.js.map +1 -0
  58. package/features/GetAuditLog/GetAuditLogRepository.d.ts +16 -0
  59. package/features/GetAuditLog/GetAuditLogRepository.js +32 -0
  60. package/features/GetAuditLog/GetAuditLogRepository.js.map +1 -0
  61. package/features/GetAuditLog/GetAuditLogUseCase.d.ts +15 -0
  62. package/features/GetAuditLog/GetAuditLogUseCase.js +29 -0
  63. package/features/GetAuditLog/GetAuditLogUseCase.js.map +1 -0
  64. package/features/GetAuditLog/abstractions.d.ts +42 -0
  65. package/features/GetAuditLog/abstractions.js +7 -0
  66. package/features/GetAuditLog/abstractions.js.map +1 -0
  67. package/features/GetAuditLog/feature.d.ts +4 -0
  68. package/features/GetAuditLog/feature.js +15 -0
  69. package/features/GetAuditLog/feature.js.map +1 -0
  70. package/features/ListAuditLogs/ListAuditLogsGateway.d.ts +12 -0
  71. package/features/ListAuditLogs/ListAuditLogsGateway.js +24 -0
  72. package/features/ListAuditLogs/ListAuditLogsGateway.js.map +1 -0
  73. package/features/ListAuditLogs/ListAuditLogsRepository.d.ts +17 -0
  74. package/features/ListAuditLogs/ListAuditLogsRepository.js +38 -0
  75. package/features/ListAuditLogs/ListAuditLogsRepository.js.map +1 -0
  76. package/features/ListAuditLogs/ListAuditLogsUseCase.d.ts +15 -0
  77. package/features/ListAuditLogs/ListAuditLogsUseCase.js +27 -0
  78. package/features/ListAuditLogs/ListAuditLogsUseCase.js.map +1 -0
  79. package/features/ListAuditLogs/abstractions.d.ts +55 -0
  80. package/features/ListAuditLogs/abstractions.js +7 -0
  81. package/features/ListAuditLogs/abstractions.js.map +1 -0
  82. package/features/ListAuditLogs/feature.d.ts +4 -0
  83. package/features/ListAuditLogs/feature.js +15 -0
  84. package/features/ListAuditLogs/feature.js.map +1 -0
  85. package/features/RecordAuditLog/RecordAuditLogUseCase.d.ts +30 -0
  86. package/features/RecordAuditLog/RecordAuditLogUseCase.js +108 -0
  87. package/features/RecordAuditLog/RecordAuditLogUseCase.js.map +1 -0
  88. package/features/RecordAuditLog/abstractions.d.ts +26 -0
  89. package/features/RecordAuditLog/abstractions.js +5 -0
  90. package/features/RecordAuditLog/abstractions.js.map +1 -0
  91. package/features/RecordAuditLog/feature.d.ts +4 -0
  92. package/features/RecordAuditLog/feature.js +11 -0
  93. package/features/RecordAuditLog/feature.js.map +1 -0
  94. package/features/UpdateAuditLog/UpdateAuditLogGateway.d.ts +12 -0
  95. package/features/UpdateAuditLog/UpdateAuditLogGateway.js +23 -0
  96. package/features/UpdateAuditLog/UpdateAuditLogGateway.js.map +1 -0
  97. package/features/UpdateAuditLog/UpdateAuditLogRepository.d.ts +14 -0
  98. package/features/UpdateAuditLog/UpdateAuditLogRepository.js +25 -0
  99. package/features/UpdateAuditLog/UpdateAuditLogRepository.js.map +1 -0
  100. package/features/UpdateAuditLog/UpdateAuditLogUseCase.d.ts +18 -0
  101. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js +53 -0
  102. package/features/UpdateAuditLog/UpdateAuditLogUseCase.js.map +1 -0
  103. package/features/UpdateAuditLog/abstractions.d.ts +42 -0
  104. package/features/UpdateAuditLog/abstractions.js +7 -0
  105. package/features/UpdateAuditLog/abstractions.js.map +1 -0
  106. package/features/UpdateAuditLog/feature.d.ts +4 -0
  107. package/features/UpdateAuditLog/feature.js +15 -0
  108. package/features/UpdateAuditLog/feature.js.map +1 -0
  109. package/graphql/AuditLogsGraphQLSchema.d.ts +10 -0
  110. package/graphql/AuditLogsGraphQLSchema.js +139 -0
  111. package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
  112. package/graphql/validation.d.ts +21 -0
  113. package/graphql/validation.js +31 -0
  114. package/graphql/validation.js.map +1 -0
  115. package/index.d.ts +3 -5
  116. package/index.js +2 -49
  117. package/package.json +34 -26
  118. package/storage/abstractions/Storage.d.ts +108 -0
  119. package/storage/abstractions/Storage.js +0 -0
  120. package/storage/types.d.ts +19 -0
  121. package/storage/types.js +0 -0
  122. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +11 -0
  123. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +45 -0
  124. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -0
  125. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +11 -0
  126. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +53 -0
  127. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -0
  128. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +11 -0
  129. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +51 -0
  130. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -0
  131. package/subscriptions/aco/index.d.ts +2 -2
  132. package/subscriptions/aco/index.js +8 -15
  133. package/subscriptions/aco/index.js.map +1 -1
  134. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
  135. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +45 -0
  136. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
  137. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
  138. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +42 -0
  139. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
  140. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
  141. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +44 -0
  142. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
  143. package/subscriptions/ai/index.d.ts +2 -0
  144. package/subscriptions/ai/index.js +11 -0
  145. package/subscriptions/ai/index.js.map +1 -0
  146. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +11 -0
  147. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +35 -0
  148. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -0
  149. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +11 -0
  150. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +35 -0
  151. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -0
  152. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +11 -0
  153. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +38 -0
  154. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -0
  155. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +11 -0
  156. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +38 -0
  157. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -0
  158. package/subscriptions/fileManager/index.d.ts +2 -2
  159. package/subscriptions/fileManager/index.js +10 -14
  160. package/subscriptions/fileManager/index.js.map +1 -1
  161. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +11 -0
  162. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +36 -0
  163. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -0
  164. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +11 -0
  165. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +46 -0
  166. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -0
  167. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +11 -0
  168. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +36 -0
  169. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -0
  170. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +11 -0
  171. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +36 -0
  172. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -0
  173. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +11 -0
  174. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +36 -0
  175. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -0
  176. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +11 -0
  177. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +39 -0
  178. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -0
  179. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +11 -0
  180. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +36 -0
  181. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -0
  182. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +11 -0
  183. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +36 -0
  184. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -0
  185. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +11 -0
  186. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +35 -0
  187. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -0
  188. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +11 -0
  189. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +35 -0
  190. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -0
  191. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +11 -0
  192. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +38 -0
  193. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -0
  194. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +11 -0
  195. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +35 -0
  196. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -0
  197. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +11 -0
  198. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +35 -0
  199. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -0
  200. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +11 -0
  201. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +38 -0
  202. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -0
  203. package/subscriptions/headlessCms/index.d.ts +2 -2
  204. package/subscriptions/headlessCms/index.js +30 -28
  205. package/subscriptions/headlessCms/index.js.map +1 -1
  206. package/subscriptions/index.d.ts +2 -2
  207. package/subscriptions/index.js +16 -22
  208. package/subscriptions/index.js.map +1 -1
  209. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +11 -0
  210. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +37 -0
  211. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -0
  212. package/subscriptions/mailer/index.d.ts +2 -2
  213. package/subscriptions/mailer/index.js +4 -10
  214. package/subscriptions/mailer/index.js.map +1 -1
  215. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +11 -0
  216. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +45 -0
  217. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -0
  218. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +11 -0
  219. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +45 -0
  220. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -0
  221. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +11 -0
  222. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +49 -0
  223. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -0
  224. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +11 -0
  225. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +35 -0
  226. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -0
  227. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +11 -0
  228. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +35 -0
  229. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -0
  230. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +11 -0
  231. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +38 -0
  232. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -0
  233. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +11 -0
  234. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +35 -0
  235. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -0
  236. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +11 -0
  237. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +35 -0
  238. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -0
  239. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +11 -0
  240. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +38 -0
  241. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -0
  242. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +11 -0
  243. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +35 -0
  244. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -0
  245. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +11 -0
  246. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +35 -0
  247. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -0
  248. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +11 -0
  249. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +38 -0
  250. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -0
  251. package/subscriptions/security/handlers/cleanupApiKey.d.ts +7 -0
  252. package/subscriptions/security/handlers/cleanupApiKey.js +12 -0
  253. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -0
  254. package/subscriptions/security/index.d.ts +2 -2
  255. package/subscriptions/security/index.js +26 -24
  256. package/subscriptions/security/index.js.map +1 -1
  257. package/subscriptions/websiteBuilder/index.d.ts +2 -0
  258. package/subscriptions/websiteBuilder/index.js +29 -0
  259. package/subscriptions/websiteBuilder/index.js.map +1 -0
  260. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +11 -0
  261. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +35 -0
  262. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -0
  263. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +11 -0
  264. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +35 -0
  265. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -0
  266. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +11 -0
  267. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +35 -0
  268. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -0
  269. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +11 -0
  270. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +38 -0
  271. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -0
  272. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +11 -0
  273. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +35 -0
  274. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -0
  275. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +11 -0
  276. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +35 -0
  277. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -0
  278. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +11 -0
  279. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +35 -0
  280. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -0
  281. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +11 -0
  282. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +38 -0
  283. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -0
  284. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +11 -0
  285. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +35 -0
  286. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -0
  287. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +11 -0
  288. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +35 -0
  289. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -0
  290. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +11 -0
  291. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +35 -0
  292. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -0
  293. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +11 -0
  294. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +38 -0
  295. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -0
  296. package/types.d.ts +14 -38
  297. package/types.js +0 -18
  298. package/utils/expiresAt.d.ts +4 -0
  299. package/utils/expiresAt.js +20 -0
  300. package/utils/expiresAt.js.map +1 -0
  301. package/utils/getAuditObject.d.ts +2 -1
  302. package/utils/getAuditObject.js +14 -22
  303. package/utils/getAuditObject.js.map +1 -1
  304. package/app/app.d.ts +0 -2
  305. package/app/app.js +0 -119
  306. package/app/app.js.map +0 -1
  307. package/app/contants.d.ts +0 -2
  308. package/app/contants.js +0 -10
  309. package/app/contants.js.map +0 -1
  310. package/app/createAppModifier.d.ts +0 -4
  311. package/app/createAppModifier.js +0 -14
  312. package/app/createAppModifier.js.map +0 -1
  313. package/app/index.d.ts +0 -4
  314. package/app/index.js +0 -43
  315. package/app/index.js.map +0 -1
  316. package/app/types.d.ts +0 -7
  317. package/app/types.js +0 -7
  318. package/app/types.js.map +0 -1
  319. package/index.js.map +0 -1
  320. package/subscriptions/aco/folders.d.ts +0 -4
  321. package/subscriptions/aco/folders.js +0 -94
  322. package/subscriptions/aco/folders.js.map +0 -1
  323. package/subscriptions/apw/changeRequests.d.ts +0 -4
  324. package/subscriptions/apw/changeRequests.js +0 -80
  325. package/subscriptions/apw/changeRequests.js.map +0 -1
  326. package/subscriptions/apw/comments.d.ts +0 -2
  327. package/subscriptions/apw/comments.js +0 -28
  328. package/subscriptions/apw/comments.js.map +0 -1
  329. package/subscriptions/apw/contentReviews.d.ts +0 -2
  330. package/subscriptions/apw/contentReviews.js +0 -28
  331. package/subscriptions/apw/contentReviews.js.map +0 -1
  332. package/subscriptions/apw/index.d.ts +0 -2
  333. package/subscriptions/apw/index.js +0 -26
  334. package/subscriptions/apw/index.js.map +0 -1
  335. package/subscriptions/apw/workflows.d.ts +0 -4
  336. package/subscriptions/apw/workflows.js +0 -64
  337. package/subscriptions/apw/workflows.js.map +0 -1
  338. package/subscriptions/fileManager/files.d.ts +0 -4
  339. package/subscriptions/fileManager/files.js +0 -64
  340. package/subscriptions/fileManager/files.js.map +0 -1
  341. package/subscriptions/fileManager/settings.d.ts +0 -2
  342. package/subscriptions/fileManager/settings.js +0 -32
  343. package/subscriptions/fileManager/settings.js.map +0 -1
  344. package/subscriptions/headlessCms/entries.d.ts +0 -9
  345. package/subscriptions/headlessCms/entries.js +0 -183
  346. package/subscriptions/headlessCms/entries.js.map +0 -1
  347. package/subscriptions/headlessCms/groups.d.ts +0 -4
  348. package/subscriptions/headlessCms/groups.js +0 -64
  349. package/subscriptions/headlessCms/groups.js.map +0 -1
  350. package/subscriptions/headlessCms/models.d.ts +0 -4
  351. package/subscriptions/headlessCms/models.js +0 -64
  352. package/subscriptions/headlessCms/models.js.map +0 -1
  353. package/subscriptions/headlessCms/utils/isSearchModelEntry.d.ts +0 -1
  354. package/subscriptions/headlessCms/utils/isSearchModelEntry.js +0 -13
  355. package/subscriptions/headlessCms/utils/isSearchModelEntry.js.map +0 -1
  356. package/subscriptions/i18n/index.d.ts +0 -2
  357. package/subscriptions/i18n/index.js +0 -15
  358. package/subscriptions/i18n/index.js.map +0 -1
  359. package/subscriptions/i18n/locales.d.ts +0 -4
  360. package/subscriptions/i18n/locales.js +0 -64
  361. package/subscriptions/i18n/locales.js.map +0 -1
  362. package/subscriptions/mailer/settings.d.ts +0 -2
  363. package/subscriptions/mailer/settings.js +0 -32
  364. package/subscriptions/mailer/settings.js.map +0 -1
  365. package/subscriptions/security/apiKeys.d.ts +0 -4
  366. package/subscriptions/security/apiKeys.js +0 -85
  367. package/subscriptions/security/apiKeys.js.map +0 -1
  368. package/subscriptions/security/roles.d.ts +0 -4
  369. package/subscriptions/security/roles.js +0 -64
  370. package/subscriptions/security/roles.js.map +0 -1
  371. package/subscriptions/security/teams.d.ts +0 -4
  372. package/subscriptions/security/teams.js +0 -64
  373. package/subscriptions/security/teams.js.map +0 -1
  374. package/subscriptions/security/users.d.ts +0 -4
  375. package/subscriptions/security/users.js +0 -64
  376. package/subscriptions/security/users.js.map +0 -1
  377. package/types.js.map +0 -1
  378. package/utils/getAuditConfig.d.ts +0 -36
  379. package/utils/getAuditConfig.js +0 -149
  380. package/utils/getAuditConfig.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events/abstractions.js","sources":["../../src/events/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { DomainEvent, IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\n\n// ============================================================================\n// AuditLogBeforeCreate Event\n// ============================================================================\n\nexport interface AuditLogBeforeCreatePayload {\n auditLog: IAuditLog;\n setAuditLog(auditLog: Partial<IAuditLog>): void;\n}\n\nexport const AuditLogBeforeCreateHandler = createAbstraction<\n IEventHandler<DomainEvent<AuditLogBeforeCreatePayload>>\n>(\"AuditLogBeforeCreateHandler\");\n\nexport namespace AuditLogBeforeCreateHandler {\n export type Interface = IEventHandler<DomainEvent<AuditLogBeforeCreatePayload>>;\n export type Event = DomainEvent<AuditLogBeforeCreatePayload>;\n}\n\n// ============================================================================\n// AuditLogAfterCreate Event\n// ============================================================================\n\nexport interface AuditLogAfterCreatePayload {\n auditLog: IAuditLog;\n}\n\nexport const AuditLogAfterCreateHandler = createAbstraction<\n IEventHandler<DomainEvent<AuditLogAfterCreatePayload>>\n>(\"AuditLogAfterCreateHandler\");\n\nexport namespace AuditLogAfterCreateHandler {\n export type Interface = IEventHandler<DomainEvent<AuditLogAfterCreatePayload>>;\n export type Event = DomainEvent<AuditLogAfterCreatePayload>;\n}\n\n// ============================================================================\n// AuditLogBeforeUpdate Event\n// ============================================================================\n\nexport interface AuditLogBeforeUpdatePayload {\n auditLog: IAuditLog;\n original: IAuditLog;\n setAuditLog(auditLog: Partial<IAuditLog>): void;\n}\n\nexport const AuditLogBeforeUpdateHandler = createAbstraction<\n IEventHandler<DomainEvent<AuditLogBeforeUpdatePayload>>\n>(\"AuditLogBeforeUpdateHandler\");\n\nexport namespace AuditLogBeforeUpdateHandler {\n export type Interface = IEventHandler<DomainEvent<AuditLogBeforeUpdatePayload>>;\n export type Event = DomainEvent<AuditLogBeforeUpdatePayload>;\n}\n\n// ============================================================================\n// AuditLogAfterUpdate Event\n// ============================================================================\n\nexport interface AuditLogAfterUpdatePayload {\n auditLog: IAuditLog;\n original: IAuditLog;\n}\n\nexport const AuditLogAfterUpdateHandler = createAbstraction<\n IEventHandler<DomainEvent<AuditLogAfterUpdatePayload>>\n>(\"AuditLogAfterUpdateHandler\");\n\nexport namespace AuditLogAfterUpdateHandler {\n export type Interface = IEventHandler<DomainEvent<AuditLogAfterUpdatePayload>>;\n export type Event = DomainEvent<AuditLogAfterUpdatePayload>;\n}\n"],"names":["AuditLogBeforeCreateHandler","createAbstraction","AuditLogAfterCreateHandler","AuditLogBeforeUpdateHandler","AuditLogAfterUpdateHandler"],"mappings":";AAaO,MAAMA,8BAA8BC,kBAEzC;AAeK,MAAMC,6BAA6BD,kBAExC;AAiBK,MAAME,8BAA8BF,kBAEzC;AAgBK,MAAMG,6BAA6BH,kBAExC"}
@@ -0,0 +1,5 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./AuditLogBeforeCreateEvent.js";
3
+ export * from "./AuditLogAfterCreateEvent.js";
4
+ export * from "./AuditLogBeforeUpdateEvent.js";
5
+ export * from "./AuditLogAfterUpdateEvent.js";
@@ -0,0 +1,5 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./AuditLogBeforeCreateEvent.js";
3
+ export * from "./AuditLogAfterCreateEvent.js";
4
+ export * from "./AuditLogBeforeUpdateEvent.js";
5
+ export * from "./AuditLogAfterUpdateEvent.js";
@@ -0,0 +1,15 @@
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
2
+ import { AuditLogPermissions as Abstraction } from "./abstractions.js";
3
+ /**
4
+ * Full access ("*"), access to all audit logs ("al.*"), or access to the action ("al.<action>").
5
+ */
6
+ declare class AuditLogPermissionsImpl implements Abstraction.Interface {
7
+ private readonly identityContext;
8
+ constructor(identityContext: IdentityContext.Interface);
9
+ canAccessAll(): Promise<boolean>;
10
+ canAccess(action: string): Promise<boolean>;
11
+ }
12
+ export declare const AuditLogPermissions: typeof AuditLogPermissionsImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IAuditLogPermissions>;
14
+ };
15
+ export {};
@@ -0,0 +1,24 @@
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
2
+ import { AuditLogPermissions } from "./abstractions.js";
3
+ class AuditLogPermissionsImpl {
4
+ constructor(identityContext){
5
+ this.identityContext = identityContext;
6
+ }
7
+ async canAccessAll() {
8
+ const permissions = await this.identityContext.getPermissions("al.*");
9
+ return permissions.some((permission)=>"*" === permission.name || "al.*" === permission.name);
10
+ }
11
+ async canAccess(action) {
12
+ const permissions = await this.identityContext.getPermissions("al.*");
13
+ return permissions.some((permission)=>"*" === permission.name || "al.*" === permission.name || permission.name === `al.${action}`);
14
+ }
15
+ }
16
+ const AuditLogPermissions_AuditLogPermissions = AuditLogPermissions.createImplementation({
17
+ implementation: AuditLogPermissionsImpl,
18
+ dependencies: [
19
+ IdentityContext
20
+ ]
21
+ });
22
+ export { AuditLogPermissions_AuditLogPermissions as AuditLogPermissions };
23
+
24
+ //# sourceMappingURL=AuditLogPermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/AuditLogPermissions/AuditLogPermissions.js","sources":["../../../src/features/AuditLogPermissions/AuditLogPermissions.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { AuditLogPermissions as Abstraction } from \"./abstractions.js\";\n\n/**\n * Full access (\"*\"), access to all audit logs (\"al.*\"), or access to the action (\"al.<action>\").\n */\nclass AuditLogPermissionsImpl implements Abstraction.Interface {\n public constructor(private readonly identityContext: IdentityContext.Interface) {}\n\n public async canAccessAll(): Promise<boolean> {\n const permissions = await this.identityContext.getPermissions(\"al.*\");\n\n return permissions.some(permission => {\n return permission.name === \"*\" || permission.name === \"al.*\";\n });\n }\n\n public async canAccess(action: string): Promise<boolean> {\n const permissions = await this.identityContext.getPermissions(\"al.*\");\n\n return permissions.some(permission => {\n return (\n permission.name === \"*\" ||\n permission.name === \"al.*\" ||\n permission.name === `al.${action}`\n );\n });\n }\n}\n\nexport const AuditLogPermissions = Abstraction.createImplementation({\n implementation: AuditLogPermissionsImpl,\n dependencies: [IdentityContext]\n});\n"],"names":["AuditLogPermissionsImpl","identityContext","permissions","permission","action","AuditLogPermissions","Abstraction","IdentityContext"],"mappings":";;AAMA,MAAMA;IACF,YAAoCC,eAA0C,CAAE;aAA5CA,eAAe,GAAfA;IAA6C;IAEjF,MAAa,eAAiC;QAC1C,MAAMC,cAAc,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC;QAE9D,OAAOA,YAAY,IAAI,CAACC,CAAAA,aACbA,AAAoB,QAApBA,WAAW,IAAI,IAAYA,AAAoB,WAApBA,WAAW,IAAI;IAEzD;IAEA,MAAa,UAAUC,MAAc,EAAoB;QACrD,MAAMF,cAAc,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC;QAE9D,OAAOA,YAAY,IAAI,CAACC,CAAAA,aAEhBA,AAAoB,QAApBA,WAAW,IAAI,IACfA,AAAoB,WAApBA,WAAW,IAAI,IACfA,WAAW,IAAI,KAAK,CAAC,GAAG,EAAEC,QAAQ;IAG9C;AACJ;AAEO,MAAMC,0CAAsBC,oBAAAA,oBAAgC,CAAC;IAChE,gBAAgBN;IAChB,cAAc;QAACO;KAAgB;AACnC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * AuditLogPermissions - Whether the current identity may access audit logs.
3
+ */
4
+ export interface IAuditLogPermissions {
5
+ canAccess(action: string): Promise<boolean>;
6
+ canAccessAll(): Promise<boolean>;
7
+ }
8
+ export declare const AuditLogPermissions: import("@webiny/di").Abstraction<IAuditLogPermissions>;
9
+ export declare namespace AuditLogPermissions {
10
+ type Interface = IAuditLogPermissions;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const AuditLogPermissions = createAbstraction("AuditLogPermissions");
3
+ export { AuditLogPermissions };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/AuditLogPermissions/abstractions.js","sources":["../../../src/features/AuditLogPermissions/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * AuditLogPermissions - Whether the current identity may access audit logs.\n */\nexport interface IAuditLogPermissions {\n // Access to audit logs of one action.\n canAccess(action: string): Promise<boolean>;\n // Access to audit logs of every action.\n canAccessAll(): Promise<boolean>;\n}\n\nexport const AuditLogPermissions = createAbstraction<IAuditLogPermissions>(\"AuditLogPermissions\");\n\nexport namespace AuditLogPermissions {\n export type Interface = IAuditLogPermissions;\n}\n"],"names":["AuditLogPermissions","createAbstraction"],"mappings":";AAYO,MAAMA,sBAAsBC,kBAAwC"}
@@ -0,0 +1,4 @@
1
+ export declare const AuditLogPermissionsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { AuditLogPermissions } from "./AuditLogPermissions.js";
3
+ const AuditLogPermissionsFeature = createFeature({
4
+ name: "AuditLogs/AuditLogPermissions",
5
+ register (container) {
6
+ container.register(AuditLogPermissions);
7
+ }
8
+ });
9
+ export { AuditLogPermissionsFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/AuditLogPermissions/feature.js","sources":["../../../src/features/AuditLogPermissions/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AuditLogPermissions } from \"./AuditLogPermissions.js\";\n\nexport const AuditLogPermissionsFeature = createFeature({\n name: \"AuditLogs/AuditLogPermissions\",\n register(container) {\n container.register(AuditLogPermissions);\n }\n});\n"],"names":["AuditLogPermissionsFeature","createFeature","container","AuditLogPermissions"],"mappings":";;AAGO,MAAMA,6BAA6BC,cAAc;IACpD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,12 @@
1
+ import { AuditLogsStorage } from "../../abstractions.js";
2
+ import type { IAuditLog } from "../../storage/types.js";
3
+ import { CreateAuditLogGateway as Abstraction } from "./abstractions.js";
4
+ declare class CreateAuditLogGatewayImpl implements Abstraction.Interface {
5
+ private readonly storage;
6
+ constructor(storage: AuditLogsStorage.Interface);
7
+ create(auditLog: IAuditLog): Promise<IAuditLog>;
8
+ }
9
+ export declare const CreateAuditLogGateway: typeof CreateAuditLogGatewayImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateAuditLogGateway>;
11
+ };
12
+ export {};
@@ -0,0 +1,23 @@
1
+ import { AuditLogsStorage } from "../../abstractions.js";
2
+ import { CreateAuditLogGateway } from "./abstractions.js";
3
+ class CreateAuditLogGatewayImpl {
4
+ constructor(storage){
5
+ this.storage = storage;
6
+ }
7
+ async create(auditLog) {
8
+ const result = await this.storage.store({
9
+ data: auditLog
10
+ });
11
+ if (!result.success) throw result.error;
12
+ return result.data;
13
+ }
14
+ }
15
+ const CreateAuditLogGateway_CreateAuditLogGateway = CreateAuditLogGateway.createImplementation({
16
+ implementation: CreateAuditLogGatewayImpl,
17
+ dependencies: [
18
+ AuditLogsStorage
19
+ ]
20
+ });
21
+ export { CreateAuditLogGateway_CreateAuditLogGateway as CreateAuditLogGateway };
22
+
23
+ //# sourceMappingURL=CreateAuditLogGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateAuditLog/CreateAuditLogGateway.js","sources":["../../../src/features/CreateAuditLog/CreateAuditLogGateway.ts"],"sourcesContent":["import { AuditLogsStorage } from \"~/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { CreateAuditLogGateway as Abstraction } from \"./abstractions.js\";\n\nclass CreateAuditLogGatewayImpl implements Abstraction.Interface {\n public constructor(private readonly storage: AuditLogsStorage.Interface) {}\n\n public async create(auditLog: IAuditLog): Promise<IAuditLog> {\n const result = await this.storage.store({ data: auditLog });\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n }\n}\n\nexport const CreateAuditLogGateway = Abstraction.createImplementation({\n implementation: CreateAuditLogGatewayImpl,\n dependencies: [AuditLogsStorage]\n});\n"],"names":["CreateAuditLogGatewayImpl","storage","auditLog","result","CreateAuditLogGateway","Abstraction","AuditLogsStorage"],"mappings":";;AAIA,MAAMA;IACF,YAAoCC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1E,MAAa,OAAOC,QAAmB,EAAsB;QACzD,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,MAAMD;QAAS;QACzD,IAAI,CAACC,OAAO,OAAO,EACf,MAAMA,OAAO,KAAK;QAEtB,OAAOA,OAAO,IAAI;IACtB;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAgC,CAAC;IAClE,gBAAgBL;IAChB,cAAc;QAACM;KAAiB;AACpC"}
@@ -0,0 +1,14 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { AuditLogPersistenceError } from "../../domain/errors.js";
3
+ import type { IAuditLog } from "../../storage/types.js";
4
+ import { CreateAuditLogRepository as Abstraction } from "./abstractions.js";
5
+ import { CreateAuditLogGateway } from "./abstractions.js";
6
+ declare class CreateAuditLogRepositoryImpl implements Abstraction.Interface {
7
+ private readonly gateway;
8
+ constructor(gateway: CreateAuditLogGateway.Interface);
9
+ create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
10
+ }
11
+ export declare const CreateAuditLogRepository: typeof CreateAuditLogRepositoryImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateAuditLogRepository>;
13
+ };
14
+ export {};
@@ -0,0 +1,25 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { AuditLogPersistenceError } from "../../domain/errors.js";
3
+ import { CreateAuditLogGateway, CreateAuditLogRepository } from "./abstractions.js";
4
+ class CreateAuditLogRepositoryImpl {
5
+ constructor(gateway){
6
+ this.gateway = gateway;
7
+ }
8
+ async create(auditLog) {
9
+ try {
10
+ const created = await this.gateway.create(auditLog);
11
+ return Result.ok(created);
12
+ } catch (error) {
13
+ return Result.fail(new AuditLogPersistenceError(error));
14
+ }
15
+ }
16
+ }
17
+ const CreateAuditLogRepository_CreateAuditLogRepository = CreateAuditLogRepository.createImplementation({
18
+ implementation: CreateAuditLogRepositoryImpl,
19
+ dependencies: [
20
+ CreateAuditLogGateway
21
+ ]
22
+ });
23
+ export { CreateAuditLogRepository_CreateAuditLogRepository as CreateAuditLogRepository };
24
+
25
+ //# sourceMappingURL=CreateAuditLogRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateAuditLog/CreateAuditLogRepository.js","sources":["../../../src/features/CreateAuditLog/CreateAuditLogRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { AuditLogPersistenceError } from \"~/domain/errors.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { CreateAuditLogRepository as Abstraction } from \"./abstractions.js\";\nimport { CreateAuditLogGateway } from \"./abstractions.js\";\n\nclass CreateAuditLogRepositoryImpl implements Abstraction.Interface {\n public constructor(private readonly gateway: CreateAuditLogGateway.Interface) {}\n\n public async create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>> {\n try {\n const created = await this.gateway.create(auditLog);\n return Result.ok(created);\n } catch (error) {\n return Result.fail(new AuditLogPersistenceError(error as Error));\n }\n }\n}\n\nexport const CreateAuditLogRepository = Abstraction.createImplementation({\n implementation: CreateAuditLogRepositoryImpl,\n dependencies: [CreateAuditLogGateway]\n});\n"],"names":["CreateAuditLogRepositoryImpl","gateway","auditLog","created","Result","error","AuditLogPersistenceError","CreateAuditLogRepository","Abstraction","CreateAuditLogGateway"],"mappings":";;;AAMA,MAAMA;IACF,YAAoCC,OAAwC,CAAE;aAA1CA,OAAO,GAAPA;IAA2C;IAE/E,MAAa,OAAOC,QAAmB,EAAwD;QAC3F,IAAI;YACA,MAAMC,UAAU,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAACD;YAC1C,OAAOE,OAAO,EAAE,CAACD;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAOD,OAAO,IAAI,CAAC,IAAIE,yBAAyBD;QACpD;IACJ;AACJ;AAEO,MAAME,oDAA2BC,yBAAAA,oBAAgC,CAAC;IACrE,gBAAgBR;IAChB,cAAc;QAACS;KAAsB;AACzC"}
@@ -0,0 +1,24 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
3
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
4
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
5
+ import { AuditLogsConfig } from "../../abstractions.js";
6
+ import { AuditLogPermissions } from "../../features/AuditLogPermissions/abstractions.js";
7
+ import type { AuditLogPayload } from "../../types.js";
8
+ import type { IAuditLog } from "../../storage/types.js";
9
+ import { CreateAuditLogUseCase as UseCaseAbstraction } from "./abstractions.js";
10
+ import { CreateAuditLogRepository } from "./abstractions.js";
11
+ declare class CreateAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {
12
+ private readonly repository;
13
+ private readonly permissions;
14
+ private readonly eventPublisher;
15
+ private readonly identityContext;
16
+ private readonly tenantContext;
17
+ private readonly config;
18
+ constructor(repository: CreateAuditLogRepository.Interface, permissions: AuditLogPermissions.Interface, eventPublisher: EventPublisher.Interface, identityContext: IdentityContext.Interface, tenantContext: TenantContext.Interface, config: AuditLogsConfig.Interface);
19
+ execute(payload: AuditLogPayload): Promise<Result<IAuditLog, UseCaseAbstraction.Error>>;
20
+ }
21
+ export declare const CreateAuditLogUseCase: typeof CreateAuditLogUseCaseImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateAuditLogUseCase>;
23
+ };
24
+ export {};
@@ -0,0 +1,70 @@
1
+ import { mdbid } from "@webiny/utils/mdbid.js";
2
+ import { Result } from "@webiny/feature/api";
3
+ import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
4
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
5
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
6
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
7
+ import { AuditLogsConfig } from "../../abstractions.js";
8
+ import { AuditLogPermissions } from "../AuditLogPermissions/abstractions.js";
9
+ import { AuditLogAfterCreateEvent, AuditLogBeforeCreateEvent } from "../../events/index.js";
10
+ import { convertExpiresAtDaysToDate } from "../../utils/expiresAt.js";
11
+ import { CreateAuditLogRepository, CreateAuditLogUseCase } from "./abstractions.js";
12
+ class CreateAuditLogUseCaseImpl {
13
+ constructor(repository, permissions, eventPublisher, identityContext, tenantContext, config){
14
+ this.repository = repository;
15
+ this.permissions = permissions;
16
+ this.eventPublisher = eventPublisher;
17
+ this.identityContext = identityContext;
18
+ this.tenantContext = tenantContext;
19
+ this.config = config;
20
+ }
21
+ async execute(payload) {
22
+ const identity = this.identityContext.getIdentity();
23
+ const expiresAt = convertExpiresAtDaysToDate(this.config.deleteLogsAfterDays);
24
+ const auditLog = {
25
+ id: mdbid(),
26
+ tenant: this.tenantContext.getTenant().id,
27
+ createdBy: {
28
+ id: identity.id,
29
+ type: identity.type,
30
+ displayName: identity.displayName || "unknown"
31
+ },
32
+ createdOn: new Date(),
33
+ ...payload,
34
+ content: JSON.stringify(payload.content),
35
+ expiresAt
36
+ };
37
+ const canAccess = await this.permissions.canAccess(auditLog.action);
38
+ if (!canAccess) return Result.fail(new NotAuthorizedError({
39
+ message: "You cannot access audit logs."
40
+ }));
41
+ const beforeCreateEvent = new AuditLogBeforeCreateEvent({
42
+ auditLog,
43
+ setAuditLog (input) {
44
+ Object.assign(auditLog, input);
45
+ }
46
+ });
47
+ await this.eventPublisher.publish(beforeCreateEvent);
48
+ const result = await this.repository.create(auditLog);
49
+ if (result.isFail()) return Result.fail(result.error);
50
+ const afterCreateEvent = new AuditLogAfterCreateEvent({
51
+ auditLog
52
+ });
53
+ await this.eventPublisher.publish(afterCreateEvent);
54
+ return Result.ok(result.value);
55
+ }
56
+ }
57
+ const CreateAuditLogUseCase_CreateAuditLogUseCase = CreateAuditLogUseCase.createImplementation({
58
+ implementation: CreateAuditLogUseCaseImpl,
59
+ dependencies: [
60
+ CreateAuditLogRepository,
61
+ AuditLogPermissions,
62
+ EventPublisher,
63
+ IdentityContext,
64
+ TenantContext,
65
+ AuditLogsConfig
66
+ ]
67
+ });
68
+ export { CreateAuditLogUseCase_CreateAuditLogUseCase as CreateAuditLogUseCase };
69
+
70
+ //# sourceMappingURL=CreateAuditLogUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateAuditLog/CreateAuditLogUseCase.js","sources":["../../../src/features/CreateAuditLog/CreateAuditLogUseCase.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils/mdbid.js\";\nimport { Result } from \"@webiny/feature/api\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport { AuditLogsConfig } from \"~/abstractions.js\";\nimport { AuditLogPermissions } from \"~/features/AuditLogPermissions/abstractions.js\";\nimport { AuditLogBeforeCreateEvent } from \"~/events/index.js\";\nimport { AuditLogAfterCreateEvent } from \"~/events/index.js\";\nimport { convertExpiresAtDaysToDate } from \"~/utils/expiresAt.js\";\nimport type { AuditLogPayload } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { CreateAuditLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { CreateAuditLogRepository } from \"./abstractions.js\";\n\nclass CreateAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly repository: CreateAuditLogRepository.Interface,\n private readonly permissions: AuditLogPermissions.Interface,\n private readonly eventPublisher: EventPublisher.Interface,\n private readonly identityContext: IdentityContext.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly config: AuditLogsConfig.Interface\n ) {}\n\n public async execute(\n payload: AuditLogPayload\n ): Promise<Result<IAuditLog, UseCaseAbstraction.Error>> {\n const identity = this.identityContext.getIdentity();\n const expiresAt = convertExpiresAtDaysToDate(this.config.deleteLogsAfterDays);\n\n const auditLog: IAuditLog = {\n id: mdbid(),\n tenant: this.tenantContext.getTenant().id,\n createdBy: {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName || \"unknown\"\n },\n createdOn: new Date(),\n ...payload,\n content: JSON.stringify(payload.content),\n expiresAt\n };\n\n const canAccess = await this.permissions.canAccess(auditLog.action);\n if (!canAccess) {\n return Result.fail(\n new NotAuthorizedError({ message: \"You cannot access audit logs.\" })\n );\n }\n\n const beforeCreateEvent = new AuditLogBeforeCreateEvent({\n auditLog,\n setAuditLog(input) {\n Object.assign(auditLog, input);\n }\n });\n await this.eventPublisher.publish(beforeCreateEvent);\n\n const result = await this.repository.create(auditLog);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const afterCreateEvent = new AuditLogAfterCreateEvent({ auditLog });\n await this.eventPublisher.publish(afterCreateEvent);\n\n return Result.ok(result.value);\n }\n}\n\nexport const CreateAuditLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: CreateAuditLogUseCaseImpl,\n dependencies: [\n CreateAuditLogRepository,\n AuditLogPermissions,\n EventPublisher,\n IdentityContext,\n TenantContext,\n AuditLogsConfig\n ]\n});\n"],"names":["CreateAuditLogUseCaseImpl","repository","permissions","eventPublisher","identityContext","tenantContext","config","payload","identity","expiresAt","convertExpiresAtDaysToDate","auditLog","mdbid","Date","JSON","canAccess","Result","NotAuthorizedError","beforeCreateEvent","AuditLogBeforeCreateEvent","input","Object","result","afterCreateEvent","AuditLogAfterCreateEvent","CreateAuditLogUseCase","UseCaseAbstraction","CreateAuditLogRepository","AuditLogPermissions","EventPublisher","IdentityContext","TenantContext","AuditLogsConfig"],"mappings":";;;;;;;;;;;AAgBA,MAAMA;IACF,YACqBC,UAA8C,EAC9CC,WAA0C,EAC1CC,cAAwC,EACxCC,eAA0C,EAC1CC,aAAsC,EACtCC,MAAiC,CACpD;aANmBL,UAAU,GAAVA;aACAC,WAAW,GAAXA;aACAC,cAAc,GAAdA;aACAC,eAAe,GAAfA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAa,QACTC,OAAwB,EAC4B;QACpD,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,MAAMC,YAAYC,2BAA2B,IAAI,CAAC,MAAM,CAAC,mBAAmB;QAE5E,MAAMC,WAAsB;YACxB,IAAIC;YACJ,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE;YACzC,WAAW;gBACP,IAAIJ,SAAS,EAAE;gBACf,MAAMA,SAAS,IAAI;gBACnB,aAAaA,SAAS,WAAW,IAAI;YACzC;YACA,WAAW,IAAIK;YACf,GAAGN,OAAO;YACV,SAASO,KAAK,SAAS,CAACP,QAAQ,OAAO;YACvCE;QACJ;QAEA,MAAMM,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAACJ,SAAS,MAAM;QAClE,IAAI,CAACI,WACD,OAAOC,OAAO,IAAI,CACd,IAAIC,mBAAmB;YAAE,SAAS;QAAgC;QAI1E,MAAMC,oBAAoB,IAAIC,0BAA0B;YACpDR;YACA,aAAYS,KAAK;gBACbC,OAAO,MAAM,CAACV,UAAUS;YAC5B;QACJ;QACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACF;QAElC,MAAMI,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACX;QAC5C,IAAIW,OAAO,MAAM,IACb,OAAON,OAAO,IAAI,CAACM,OAAO,KAAK;QAGnC,MAAMC,mBAAmB,IAAIC,yBAAyB;YAAEb;QAAS;QACjE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACY;QAElC,OAAOP,OAAO,EAAE,CAACM,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMG,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgB1B;IAChB,cAAc;QACV2B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,42 @@
1
+ import type { Result } from "@webiny/feature/api";
2
+ import type { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
3
+ import type { AuditLogPayload } from "../../types.js";
4
+ import type { IAuditLog } from "../../storage/types.js";
5
+ import type { AuditLogPersistenceError } from "../../domain/errors.js";
6
+ /**
7
+ * CreateAuditLog Use Case - Creates an audit log in the current tenant, as the current identity.
8
+ */
9
+ export interface ICreateAuditLogUseCase {
10
+ execute(payload: AuditLogPayload): Promise<Result<IAuditLog, UseCaseError>>;
11
+ }
12
+ export interface ICreateAuditLogUseCaseErrors {
13
+ notAuthorized: NotAuthorizedError;
14
+ persistence: AuditLogPersistenceError;
15
+ }
16
+ type UseCaseError = ICreateAuditLogUseCaseErrors[keyof ICreateAuditLogUseCaseErrors];
17
+ export declare const CreateAuditLogUseCase: import("@webiny/di").Abstraction<ICreateAuditLogUseCase>;
18
+ export declare namespace CreateAuditLogUseCase {
19
+ type Interface = ICreateAuditLogUseCase;
20
+ type Error = UseCaseError;
21
+ }
22
+ /**
23
+ * CreateAuditLogRepository - Stores a new audit log.
24
+ */
25
+ export interface ICreateAuditLogRepository {
26
+ create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
27
+ }
28
+ export declare const CreateAuditLogRepository: import("@webiny/di").Abstraction<ICreateAuditLogRepository>;
29
+ export declare namespace CreateAuditLogRepository {
30
+ type Interface = ICreateAuditLogRepository;
31
+ }
32
+ /**
33
+ * CreateAuditLogGateway - Writes a new audit log to the audit logs storage.
34
+ */
35
+ export interface ICreateAuditLogGateway {
36
+ create(auditLog: IAuditLog): Promise<IAuditLog>;
37
+ }
38
+ export declare const CreateAuditLogGateway: import("@webiny/di").Abstraction<ICreateAuditLogGateway>;
39
+ export declare namespace CreateAuditLogGateway {
40
+ type Interface = ICreateAuditLogGateway;
41
+ }
42
+ export {};
@@ -0,0 +1,7 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CreateAuditLogUseCase = createAbstraction("CreateAuditLogUseCase");
3
+ const CreateAuditLogRepository = createAbstraction("CreateAuditLogRepository");
4
+ const CreateAuditLogGateway = createAbstraction("CreateAuditLogGateway");
5
+ export { CreateAuditLogGateway, CreateAuditLogRepository, CreateAuditLogUseCase };
6
+
7
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateAuditLog/abstractions.js","sources":["../../../src/features/CreateAuditLog/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport type { AuditLogPayload } from \"~/types.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { AuditLogPersistenceError } from \"~/domain/errors.js\";\n\n/**\n * CreateAuditLog Use Case - Creates an audit log in the current tenant, as the current identity.\n */\nexport interface ICreateAuditLogUseCase {\n execute(payload: AuditLogPayload): Promise<Result<IAuditLog, UseCaseError>>;\n}\n\nexport interface ICreateAuditLogUseCaseErrors {\n notAuthorized: NotAuthorizedError;\n persistence: AuditLogPersistenceError;\n}\n\ntype UseCaseError = ICreateAuditLogUseCaseErrors[keyof ICreateAuditLogUseCaseErrors];\n\nexport const CreateAuditLogUseCase =\n createAbstraction<ICreateAuditLogUseCase>(\"CreateAuditLogUseCase\");\n\nexport namespace CreateAuditLogUseCase {\n export type Interface = ICreateAuditLogUseCase;\n export type Error = UseCaseError;\n}\n\n/**\n * CreateAuditLogRepository - Stores a new audit log.\n */\nexport interface ICreateAuditLogRepository {\n create(auditLog: IAuditLog): Promise<Result<IAuditLog, AuditLogPersistenceError>>;\n}\n\nexport const CreateAuditLogRepository = createAbstraction<ICreateAuditLogRepository>(\n \"CreateAuditLogRepository\"\n);\n\nexport namespace CreateAuditLogRepository {\n export type Interface = ICreateAuditLogRepository;\n}\n\n/**\n * CreateAuditLogGateway - Writes a new audit log to the audit logs storage.\n */\nexport interface ICreateAuditLogGateway {\n create(auditLog: IAuditLog): Promise<IAuditLog>;\n}\n\nexport const CreateAuditLogGateway =\n createAbstraction<ICreateAuditLogGateway>(\"CreateAuditLogGateway\");\n\nexport namespace CreateAuditLogGateway {\n export type Interface = ICreateAuditLogGateway;\n}\n"],"names":["CreateAuditLogUseCase","createAbstraction","CreateAuditLogRepository","CreateAuditLogGateway"],"mappings":";AAqBO,MAAMA,wBACTC,kBAA0C;AAcvC,MAAMC,2BAA2BD,kBACpC;AAcG,MAAME,wBACTF,kBAA0C"}
@@ -0,0 +1,4 @@
1
+ export declare const CreateAuditLogFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,15 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { CreateAuditLogUseCase } from "./CreateAuditLogUseCase.js";
3
+ import { CreateAuditLogRepository } from "./CreateAuditLogRepository.js";
4
+ import { CreateAuditLogGateway } from "./CreateAuditLogGateway.js";
5
+ const CreateAuditLogFeature = createFeature({
6
+ name: "AuditLogs/CreateAuditLog",
7
+ register (container) {
8
+ container.register(CreateAuditLogUseCase);
9
+ container.register(CreateAuditLogRepository).inSingletonScope();
10
+ container.register(CreateAuditLogGateway).inSingletonScope();
11
+ }
12
+ });
13
+ export { CreateAuditLogFeature };
14
+
15
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/CreateAuditLog/feature.js","sources":["../../../src/features/CreateAuditLog/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateAuditLogUseCase } from \"./CreateAuditLogUseCase.js\";\nimport { CreateAuditLogRepository } from \"./CreateAuditLogRepository.js\";\nimport { CreateAuditLogGateway } from \"./CreateAuditLogGateway.js\";\n\nexport const CreateAuditLogFeature = createFeature({\n name: \"AuditLogs/CreateAuditLog\",\n register(container) {\n container.register(CreateAuditLogUseCase);\n container.register(CreateAuditLogRepository).inSingletonScope();\n container.register(CreateAuditLogGateway).inSingletonScope();\n }\n});\n"],"names":["CreateAuditLogFeature","createFeature","container","CreateAuditLogUseCase","CreateAuditLogRepository","CreateAuditLogGateway"],"mappings":";;;;AAKO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,0BAA0B,gBAAgB;QAC7DF,UAAU,QAAQ,CAACG,uBAAuB,gBAAgB;IAC9D;AACJ"}
@@ -0,0 +1,13 @@
1
+ import { AuditLogsStorage } from "../../abstractions.js";
2
+ import type { IAuditLog } from "../../storage/types.js";
3
+ import type { IStorageFetchParams } from "../../storage/abstractions/Storage.js";
4
+ import { GetAuditLogGateway as Abstraction } from "./abstractions.js";
5
+ declare class GetAuditLogGatewayImpl implements Abstraction.Interface {
6
+ private readonly storage;
7
+ constructor(storage: AuditLogsStorage.Interface);
8
+ get(params: IStorageFetchParams): Promise<IAuditLog>;
9
+ }
10
+ export declare const GetAuditLogGateway: typeof GetAuditLogGatewayImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogGateway>;
12
+ };
13
+ export {};
@@ -0,0 +1,21 @@
1
+ import { AuditLogsStorage } from "../../abstractions.js";
2
+ import { GetAuditLogGateway } from "./abstractions.js";
3
+ class GetAuditLogGatewayImpl {
4
+ constructor(storage){
5
+ this.storage = storage;
6
+ }
7
+ async get(params) {
8
+ const result = await this.storage.fetch(params);
9
+ if (!result.success) throw result.error;
10
+ return result.data;
11
+ }
12
+ }
13
+ const GetAuditLogGateway_GetAuditLogGateway = GetAuditLogGateway.createImplementation({
14
+ implementation: GetAuditLogGatewayImpl,
15
+ dependencies: [
16
+ AuditLogsStorage
17
+ ]
18
+ });
19
+ export { GetAuditLogGateway_GetAuditLogGateway as GetAuditLogGateway };
20
+
21
+ //# sourceMappingURL=GetAuditLogGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/GetAuditLog/GetAuditLogGateway.js","sources":["../../../src/features/GetAuditLog/GetAuditLogGateway.ts"],"sourcesContent":["import { AuditLogsStorage } from \"~/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageFetchParams } from \"~/storage/abstractions/Storage.js\";\nimport { GetAuditLogGateway as Abstraction } from \"./abstractions.js\";\n\nclass GetAuditLogGatewayImpl implements Abstraction.Interface {\n public constructor(private readonly storage: AuditLogsStorage.Interface) {}\n\n public async get(params: IStorageFetchParams): Promise<IAuditLog> {\n const result = await this.storage.fetch(params);\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n }\n}\n\nexport const GetAuditLogGateway = Abstraction.createImplementation({\n implementation: GetAuditLogGatewayImpl,\n dependencies: [AuditLogsStorage]\n});\n"],"names":["GetAuditLogGatewayImpl","storage","params","result","GetAuditLogGateway","Abstraction","AuditLogsStorage"],"mappings":";;AAKA,MAAMA;IACF,YAAoCC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1E,MAAa,IAAIC,MAA2B,EAAsB;QAC9D,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAACD;QACxC,IAAI,CAACC,OAAO,OAAO,EACf,MAAMA,OAAO,KAAK;QAEtB,OAAOA,OAAO,IAAI;IACtB;AACJ;AAEO,MAAMC,wCAAqBC,mBAAAA,oBAAgC,CAAC;IAC/D,gBAAgBL;IAChB,cAAc;QAACM;KAAiB;AACpC"}
@@ -0,0 +1,16 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
3
+ import { AuditLogPersistenceError } from "../../domain/errors.js";
4
+ import type { IAuditLog } from "../../storage/types.js";
5
+ import { GetAuditLogRepository as Abstraction } from "./abstractions.js";
6
+ import { GetAuditLogGateway } from "./abstractions.js";
7
+ declare class GetAuditLogRepositoryImpl implements Abstraction.Interface {
8
+ private readonly gateway;
9
+ private readonly tenantContext;
10
+ constructor(gateway: GetAuditLogGateway.Interface, tenantContext: TenantContext.Interface);
11
+ get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
12
+ }
13
+ export declare const GetAuditLogRepository: typeof GetAuditLogRepositoryImpl & {
14
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogRepository>;
15
+ };
16
+ export {};
@@ -0,0 +1,32 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
3
+ import { AuditLogPersistenceError } from "../../domain/errors.js";
4
+ import { GetAuditLogGateway, GetAuditLogRepository } from "./abstractions.js";
5
+ class GetAuditLogRepositoryImpl {
6
+ constructor(gateway, tenantContext){
7
+ this.gateway = gateway;
8
+ this.tenantContext = tenantContext;
9
+ }
10
+ async get(id) {
11
+ try {
12
+ const tenant = this.tenantContext.getTenant().id;
13
+ const auditLog = await this.gateway.get({
14
+ id,
15
+ tenant
16
+ });
17
+ return Result.ok(auditLog);
18
+ } catch (error) {
19
+ return Result.fail(new AuditLogPersistenceError(error));
20
+ }
21
+ }
22
+ }
23
+ const GetAuditLogRepository_GetAuditLogRepository = GetAuditLogRepository.createImplementation({
24
+ implementation: GetAuditLogRepositoryImpl,
25
+ dependencies: [
26
+ GetAuditLogGateway,
27
+ TenantContext
28
+ ]
29
+ });
30
+ export { GetAuditLogRepository_GetAuditLogRepository as GetAuditLogRepository };
31
+
32
+ //# sourceMappingURL=GetAuditLogRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/GetAuditLog/GetAuditLogRepository.js","sources":["../../../src/features/GetAuditLog/GetAuditLogRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { AuditLogPersistenceError } from \"~/domain/errors.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { GetAuditLogRepository as Abstraction } from \"./abstractions.js\";\nimport { GetAuditLogGateway } from \"./abstractions.js\";\n\nclass GetAuditLogRepositoryImpl implements Abstraction.Interface {\n public constructor(\n private readonly gateway: GetAuditLogGateway.Interface,\n private readonly tenantContext: TenantContext.Interface\n ) {}\n\n public async get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>> {\n try {\n const tenant = this.tenantContext.getTenant().id;\n const auditLog = await this.gateway.get({ id, tenant });\n return Result.ok(auditLog);\n } catch (error) {\n return Result.fail(new AuditLogPersistenceError(error as Error));\n }\n }\n}\n\nexport const GetAuditLogRepository = Abstraction.createImplementation({\n implementation: GetAuditLogRepositoryImpl,\n dependencies: [GetAuditLogGateway, TenantContext]\n});\n"],"names":["GetAuditLogRepositoryImpl","gateway","tenantContext","id","tenant","auditLog","Result","error","AuditLogPersistenceError","GetAuditLogRepository","Abstraction","GetAuditLogGateway","TenantContext"],"mappings":";;;;AAOA,MAAMA;IACF,YACqBC,OAAqC,EACrCC,aAAsC,CACzD;aAFmBD,OAAO,GAAPA;aACAC,aAAa,GAAbA;IAClB;IAEH,MAAa,IAAIC,EAAU,EAAwD;QAC/E,IAAI;YACA,MAAMC,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE;YAChD,MAAMC,WAAW,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;gBAAEF;gBAAIC;YAAO;YACrD,OAAOE,OAAO,EAAE,CAACD;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAOD,OAAO,IAAI,CAAC,IAAIE,yBAAyBD;QACpD;IACJ;AACJ;AAEO,MAAME,8CAAwBC,sBAAAA,oBAAgC,CAAC;IAClE,gBAAgBV;IAChB,cAAc;QAACW;QAAoBC;KAAc;AACrD"}
@@ -0,0 +1,15 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { AuditLogPermissions } from "../../features/AuditLogPermissions/abstractions.js";
3
+ import type { IAuditLog } from "../../storage/types.js";
4
+ import { GetAuditLogUseCase as UseCaseAbstraction } from "./abstractions.js";
5
+ import { GetAuditLogRepository } from "./abstractions.js";
6
+ declare class GetAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {
7
+ private readonly repository;
8
+ private readonly permissions;
9
+ constructor(repository: GetAuditLogRepository.Interface, permissions: AuditLogPermissions.Interface);
10
+ execute(id: string): Promise<Result<IAuditLog, UseCaseAbstraction.Error>>;
11
+ }
12
+ export declare const GetAuditLogUseCase: typeof GetAuditLogUseCaseImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetAuditLogUseCase>;
14
+ };
15
+ export {};
@@ -0,0 +1,29 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
3
+ import { AuditLogPermissions } from "../AuditLogPermissions/abstractions.js";
4
+ import { GetAuditLogRepository, GetAuditLogUseCase } from "./abstractions.js";
5
+ class GetAuditLogUseCaseImpl {
6
+ constructor(repository, permissions){
7
+ this.repository = repository;
8
+ this.permissions = permissions;
9
+ }
10
+ async execute(id) {
11
+ const result = await this.repository.get(id);
12
+ if (result.isFail()) return Result.fail(result.error);
13
+ const canAccess = await this.permissions.canAccess(result.value.action);
14
+ if (!canAccess) return Result.fail(new NotAuthorizedError({
15
+ message: "You cannot access audit logs."
16
+ }));
17
+ return Result.ok(result.value);
18
+ }
19
+ }
20
+ const GetAuditLogUseCase_GetAuditLogUseCase = GetAuditLogUseCase.createImplementation({
21
+ implementation: GetAuditLogUseCaseImpl,
22
+ dependencies: [
23
+ GetAuditLogRepository,
24
+ AuditLogPermissions
25
+ ]
26
+ });
27
+ export { GetAuditLogUseCase_GetAuditLogUseCase as GetAuditLogUseCase };
28
+
29
+ //# sourceMappingURL=GetAuditLogUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/GetAuditLog/GetAuditLogUseCase.js","sources":["../../../src/features/GetAuditLog/GetAuditLogUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { AuditLogPermissions } from \"~/features/AuditLogPermissions/abstractions.js\";\nimport type { IAuditLog } from \"~/storage/types.js\";\nimport { GetAuditLogUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { GetAuditLogRepository } from \"./abstractions.js\";\n\nclass GetAuditLogUseCaseImpl implements UseCaseAbstraction.Interface {\n public constructor(\n private readonly repository: GetAuditLogRepository.Interface,\n private readonly permissions: AuditLogPermissions.Interface\n ) {}\n\n public async execute(id: string): Promise<Result<IAuditLog, UseCaseAbstraction.Error>> {\n const result = await this.repository.get(id);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const canAccess = await this.permissions.canAccess(result.value.action);\n if (!canAccess) {\n return Result.fail(\n new NotAuthorizedError({ message: \"You cannot access audit logs.\" })\n );\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const GetAuditLogUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetAuditLogUseCaseImpl,\n dependencies: [GetAuditLogRepository, AuditLogPermissions]\n});\n"],"names":["GetAuditLogUseCaseImpl","repository","permissions","id","result","Result","canAccess","NotAuthorizedError","GetAuditLogUseCase","UseCaseAbstraction","GetAuditLogRepository","AuditLogPermissions"],"mappings":";;;;AAOA,MAAMA;IACF,YACqBC,UAA2C,EAC3CC,WAA0C,CAC7D;aAFmBD,UAAU,GAAVA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,QAAQC,EAAU,EAAwD;QACnF,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAACD;QACzC,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAGnC,MAAME,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAACF,OAAO,KAAK,CAAC,MAAM;QACtE,IAAI,CAACE,WACD,OAAOD,OAAO,IAAI,CACd,IAAIE,mBAAmB;YAAE,SAAS;QAAgC;QAI1E,OAAOF,OAAO,EAAE,CAACD,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMI,wCAAqBC,mBAAAA,oBAAuC,CAAC;IACtE,gBAAgBT;IAChB,cAAc;QAACU;QAAuBC;KAAoB;AAC9D"}
@@ -0,0 +1,42 @@
1
+ import type { Result } from "@webiny/feature/api";
2
+ import type { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
3
+ import type { IAuditLog } from "../../storage/types.js";
4
+ import type { IStorageFetchParams } from "../../storage/abstractions/Storage.js";
5
+ import type { AuditLogPersistenceError } from "../../domain/errors.js";
6
+ /**
7
+ * GetAuditLog Use Case - Gets an audit log of the current tenant by its id.
8
+ */
9
+ export interface IGetAuditLogUseCase {
10
+ execute(id: string): Promise<Result<IAuditLog, UseCaseError>>;
11
+ }
12
+ export interface IGetAuditLogUseCaseErrors {
13
+ notAuthorized: NotAuthorizedError;
14
+ persistence: AuditLogPersistenceError;
15
+ }
16
+ type UseCaseError = IGetAuditLogUseCaseErrors[keyof IGetAuditLogUseCaseErrors];
17
+ export declare const GetAuditLogUseCase: import("@webiny/di").Abstraction<IGetAuditLogUseCase>;
18
+ export declare namespace GetAuditLogUseCase {
19
+ type Interface = IGetAuditLogUseCase;
20
+ type Error = UseCaseError;
21
+ }
22
+ /**
23
+ * GetAuditLogRepository - Fetches an audit log of the current tenant.
24
+ */
25
+ export interface IGetAuditLogRepository {
26
+ get(id: string): Promise<Result<IAuditLog, AuditLogPersistenceError>>;
27
+ }
28
+ export declare const GetAuditLogRepository: import("@webiny/di").Abstraction<IGetAuditLogRepository>;
29
+ export declare namespace GetAuditLogRepository {
30
+ type Interface = IGetAuditLogRepository;
31
+ }
32
+ /**
33
+ * GetAuditLogGateway - Reads an audit log from the audit logs storage.
34
+ */
35
+ export interface IGetAuditLogGateway {
36
+ get(params: IStorageFetchParams): Promise<IAuditLog>;
37
+ }
38
+ export declare const GetAuditLogGateway: import("@webiny/di").Abstraction<IGetAuditLogGateway>;
39
+ export declare namespace GetAuditLogGateway {
40
+ type Interface = IGetAuditLogGateway;
41
+ }
42
+ export {};