@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
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_config","_getAuditConfig","onTeamAfterCreateHook","context","security","onTeamAfterCreate","subscribe","team","createAuditLog","getAuditConfig","AUDIT","SECURITY","TEAM","CREATE","id","error","WebinyError","from","message","code","exports","onTeamAfterUpdateHook","onTeamAfterUpdate","original","UPDATE","before","after","onTeamAfterDeleteHook","onTeamAfterDelete","DELETE"],"sources":["teams.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { AUDIT } from \"~/config\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig\";\nimport type { AuditLogsContext } from \"~/types\";\n\nexport const onTeamAfterCreateHook = (context: AuditLogsContext) => {\n context.security.onTeamAfterCreate.subscribe(async ({ team }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.TEAM.CREATE);\n\n await createAuditLog(\"Team created\", team, team.id, context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onTeamAfterCreateHook hook\",\n code: \"AUDIT_LOGS_AFTER_TEAM_CREATE_HOOK\"\n });\n }\n });\n};\n\nexport const onTeamAfterUpdateHook = (context: AuditLogsContext) => {\n context.security.onTeamAfterUpdate.subscribe(async ({ team, original }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.TEAM.UPDATE);\n\n await createAuditLog(\n \"Team updated\",\n { before: original, after: team },\n team.id,\n context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onTeamAfterUpdateHook hook\",\n code: \"AUDIT_LOGS_AFTER_TEAM_UPDATE_HOOK\"\n });\n }\n });\n};\n\nexport const onTeamAfterDeleteHook = (context: AuditLogsContext) => {\n context.security.onTeamAfterDelete.subscribe(async ({ team }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.TEAM.DELETE);\n\n await createAuditLog(\"Team deleted\", team, team.id, context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onTeamAfterDeleteHook hook\",\n code: \"AUDIT_LOGS_AFTER_TEAM_DELETE_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAGO,MAAMG,qBAAqB,GAAIC,OAAyB,IAAK;EAChEA,OAAO,CAACC,QAAQ,CAACC,iBAAiB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAC7D,IAAI;MACA,MAAMC,cAAc,GAAG,IAAAC,8BAAc,EAACC,aAAK,CAACC,QAAQ,CAACC,IAAI,CAACC,MAAM,CAAC;MAEjE,MAAML,cAAc,CAAC,cAAc,EAAED,IAAI,EAAEA,IAAI,CAACO,EAAE,EAAEX,OAAO,CAAC;IAChE,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAlB,qBAAA,GAAAA,qBAAA;AAEK,MAAMmB,qBAAqB,GAAIlB,OAAyB,IAAK;EAChEA,OAAO,CAACC,QAAQ,CAACkB,iBAAiB,CAAChB,SAAS,CAAC,OAAO;IAAEC,IAAI;IAAEgB;EAAS,CAAC,KAAK;IACvE,IAAI;MACA,MAAMf,cAAc,GAAG,IAAAC,8BAAc,EAACC,aAAK,CAACC,QAAQ,CAACC,IAAI,CAACY,MAAM,CAAC;MAEjE,MAAMhB,cAAc,CAChB,cAAc,EACd;QAAEiB,MAAM,EAAEF,QAAQ;QAAEG,KAAK,EAAEnB;MAAK,CAAC,EACjCA,IAAI,CAACO,EAAE,EACPX,OACJ,CAAC;IACL,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAEK,MAAMM,qBAAqB,GAAIxB,OAAyB,IAAK;EAChEA,OAAO,CAACC,QAAQ,CAACwB,iBAAiB,CAACtB,SAAS,CAAC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAC7D,IAAI;MACA,MAAMC,cAAc,GAAG,IAAAC,8BAAc,EAACC,aAAK,CAACC,QAAQ,CAACC,IAAI,CAACiB,MAAM,CAAC;MAEjE,MAAMrB,cAAc,CAAC,cAAc,EAAED,IAAI,EAAEA,IAAI,CAACO,EAAE,EAAEX,OAAO,CAAC;IAChE,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAO,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import type { AuditLogsContext } from "../../types";
2
- export declare const onUserAfterCreateHook: (context: AuditLogsContext) => void;
3
- export declare const onUserAfterUpdateHook: (context: AuditLogsContext) => void;
4
- export declare const onUserAfterDeleteHook: (context: AuditLogsContext) => void;
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.onUserAfterUpdateHook = exports.onUserAfterDeleteHook = exports.onUserAfterCreateHook = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _config = require("../../config");
10
- var _getAuditConfig = require("../../utils/getAuditConfig");
11
- const onUserAfterCreateHook = context => {
12
- context.adminUsers.onUserAfterCreate.subscribe(async ({
13
- user
14
- }) => {
15
- try {
16
- const createAuditLog = (0, _getAuditConfig.getAuditConfig)(_config.AUDIT.SECURITY.USER.CREATE);
17
- await createAuditLog("User created", user, user.id, context);
18
- } catch (error) {
19
- throw _error.default.from(error, {
20
- message: "Error while executing onUserAfterCreateHook hook",
21
- code: "AUDIT_LOGS_AFTER_USER_CREATE_HOOK"
22
- });
23
- }
24
- });
25
- };
26
- exports.onUserAfterCreateHook = onUserAfterCreateHook;
27
- const onUserAfterUpdateHook = context => {
28
- context.adminUsers.onUserAfterUpdate.subscribe(async ({
29
- updatedUser,
30
- originalUser
31
- }) => {
32
- try {
33
- const createAuditLog = (0, _getAuditConfig.getAuditConfig)(_config.AUDIT.SECURITY.USER.UPDATE);
34
- await createAuditLog("User updated", {
35
- before: originalUser,
36
- after: updatedUser
37
- }, updatedUser.id, context);
38
- } catch (error) {
39
- throw _error.default.from(error, {
40
- message: "Error while executing onUserAfterUpdateHook hook",
41
- code: "AUDIT_LOGS_AFTER_USER_UPDATE_HOOK"
42
- });
43
- }
44
- });
45
- };
46
- exports.onUserAfterUpdateHook = onUserAfterUpdateHook;
47
- const onUserAfterDeleteHook = context => {
48
- context.adminUsers.onUserAfterDelete.subscribe(async ({
49
- user
50
- }) => {
51
- try {
52
- const createAuditLog = (0, _getAuditConfig.getAuditConfig)(_config.AUDIT.SECURITY.USER.DELETE);
53
- await createAuditLog("User deleted", user, user.id, context);
54
- } catch (error) {
55
- throw _error.default.from(error, {
56
- message: "Error while executing onUserAfterDeleteHook hook",
57
- code: "AUDIT_LOGS_AFTER_USER_DELETE_HOOK"
58
- });
59
- }
60
- });
61
- };
62
- exports.onUserAfterDeleteHook = onUserAfterDeleteHook;
63
-
64
- //# sourceMappingURL=users.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_config","_getAuditConfig","onUserAfterCreateHook","context","adminUsers","onUserAfterCreate","subscribe","user","createAuditLog","getAuditConfig","AUDIT","SECURITY","USER","CREATE","id","error","WebinyError","from","message","code","exports","onUserAfterUpdateHook","onUserAfterUpdate","updatedUser","originalUser","UPDATE","before","after","onUserAfterDeleteHook","onUserAfterDelete","DELETE"],"sources":["users.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nimport { AUDIT } from \"~/config\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig\";\nimport type { AuditLogsContext } from \"~/types\";\n\nexport const onUserAfterCreateHook = (context: AuditLogsContext) => {\n context.adminUsers.onUserAfterCreate.subscribe(async ({ user }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.USER.CREATE);\n\n await createAuditLog(\"User created\", user, user.id, context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onUserAfterCreateHook hook\",\n code: \"AUDIT_LOGS_AFTER_USER_CREATE_HOOK\"\n });\n }\n });\n};\n\nexport const onUserAfterUpdateHook = (context: AuditLogsContext) => {\n context.adminUsers.onUserAfterUpdate.subscribe(async ({ updatedUser, originalUser }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.USER.UPDATE);\n\n await createAuditLog(\n \"User updated\",\n { before: originalUser, after: updatedUser },\n updatedUser.id,\n context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing onUserAfterUpdateHook hook\",\n code: \"AUDIT_LOGS_AFTER_USER_UPDATE_HOOK\"\n });\n }\n });\n};\n\nexport const onUserAfterDeleteHook = (context: AuditLogsContext) => {\n context.adminUsers.onUserAfterDelete.subscribe(async ({ user }) => {\n try {\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.USER.DELETE);\n\n await createAuditLog(\"User deleted\", user, user.id, context);\n } catch (error) {\n throw WebinyError.from(error, {\n message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C,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAEK,MAAMO,qBAAqB,GAAIzB,OAAyB,IAAK;EAChEA,OAAO,CAACC,UAAU,CAACyB,iBAAiB,CAACvB,SAAS,CAAC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAC/D,IAAI;MACA,MAAMC,cAAc,GAAG,IAAAC,8BAAc,EAACC,aAAK,CAACC,QAAQ,CAACC,IAAI,CAACkB,MAAM,CAAC;MAEjE,MAAMtB,cAAc,CAAC,cAAc,EAAED,IAAI,EAAEA,IAAI,CAACO,EAAE,EAAEX,OAAO,CAAC;IAChE,CAAC,CAAC,OAAOY,KAAK,EAAE;MACZ,MAAMC,cAAW,CAACC,IAAI,CAACF,KAAK,EAAE;QAC1BG,OAAO,EAAE,kDAAkD;QAC3DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAQ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
package/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["types.ts"],"sourcesContent":["import type { AcoContext } from \"@webiny/api-aco/types\";\nimport type { MailerContext } from \"@webiny/api-mailer/types\";\nimport type { SecurityContext } from \"@webiny/api-security/types\";\nimport type { ApwContext } from \"@webiny/api-apw/types\";\nimport type { Context as BaseContext } from \"@webiny/handler/types\";\n\nexport * from \"~/app/types\";\n\nexport interface Action {\n type: string;\n displayName: string;\n /**\n * Delay in seconds before a new audit log can be created.\n * During this delay actions will update existing audit log instead of creating new ones.\n */\n newEntryDelay?: number;\n}\n\nexport interface Entity {\n type: string;\n displayName: string;\n linkToEntity?: (id: string) => string;\n actions: Action[];\n}\n\nexport interface App {\n app: string;\n displayName: string;\n entities: Entity[];\n}\n\nexport interface AuditLog {\n id: string;\n message: string;\n app: string;\n entity: string;\n entityId: string;\n action: string;\n data: JSON;\n timestamp: Date;\n initiator: string;\n}\n\nexport interface AuditLogsContext\n extends BaseContext,\n AcoContext,\n MailerContext,\n SecurityContext,\n ApwContext {}\n\nexport interface AuditObject {\n [app: string]: EntityObject;\n}\n\nexport interface EntityObject {\n [entity: string]: ActionObject;\n}\n\nexport interface ActionObject {\n [action: string]: AuditAction;\n}\n\nexport interface AuditAction {\n app: App;\n entity: Entity;\n action: Action;\n}\n"],"mappings":";;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,36 +0,0 @@
1
- import type { AuditAction, AuditLogsContext } from "../types";
2
- export declare const getAuditConfig: (audit: AuditAction) => (message: string, data: Record<string, any>, entityId: string, context: AuditLogsContext) => Promise<string | {
3
- id: string;
4
- title: string;
5
- content: string;
6
- tags: never[];
7
- type: string;
8
- location: {
9
- folderId: string;
10
- };
11
- data: {
12
- data: string;
13
- message: string;
14
- app: string;
15
- entity: string;
16
- entityId: string;
17
- action: string;
18
- timestamp: Date;
19
- initiator: string;
20
- };
21
- } | {
22
- data: string;
23
- type: string;
24
- title: string;
25
- content?: string | undefined;
26
- location: import("@webiny/api-aco/types").Location;
27
- tags: string[];
28
- id: string;
29
- entryId: string;
30
- createdOn: string;
31
- modifiedOn: string | null;
32
- savedOn: string;
33
- createdBy: import("@webiny/api-aco/types").User;
34
- modifiedBy: import("@webiny/api-aco/types").User | null;
35
- savedBy: import("@webiny/api-aco/types").User;
36
- } | undefined>;
@@ -1,149 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.getAuditConfig = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _utils = require("@webiny/utils");
10
- const createAuditLog = async params => {
11
- const {
12
- app,
13
- payload
14
- } = params;
15
- const compressor = app.context.compressor;
16
- const payloadData = JSON.stringify(payload.data);
17
- try {
18
- const entry = {
19
- id: (0, _utils.mdbid)(),
20
- title: payload.message,
21
- content: payload.message,
22
- tags: [],
23
- type: "AuditLogs",
24
- location: {
25
- folderId: "root"
26
- },
27
- data: {
28
- ...payload,
29
- data: payloadData
30
- }
31
- };
32
- const data = await compressor.compress(entry.data.data);
33
- await app.search.create({
34
- ...entry,
35
- data: {
36
- ...entry.data,
37
- data: JSON.stringify(data)
38
- }
39
- });
40
- return entry;
41
- } catch (error) {
42
- throw _error.default.from(error, {
43
- message: "Error while creating new audit log",
44
- code: "CREATE_AUDIT_LOG"
45
- });
46
- }
47
- };
48
- const createOrMergeAuditLog = async params => {
49
- const {
50
- app,
51
- payload,
52
- delay
53
- } = params;
54
- const compressor = app.context.compressor;
55
- // Get the latest audit log of this entry.
56
- const [records] = await app.search.list({
57
- where: {
58
- type: "AuditLogs",
59
- data: {
60
- entityId: payload.entityId,
61
- initiator: payload.initiator
62
- }
63
- },
64
- limit: 1
65
- });
66
- const existingLog = records?.[0];
67
- if (existingLog) {
68
- const existingLogDate = Date.parse(existingLog.savedOn);
69
- const newLogDate = payload.timestamp.getTime();
70
-
71
- // Check if the latest audit log is saved within delay range.
72
- if (newLogDate - existingLogDate < delay * 1000) {
73
- const existingLogData = await compressor.decompress(existingLog.data);
74
- // Update latest audit log with new "after" payload.
75
- const beforePayloadData = JSON.parse(existingLogData?.data.data)?.before;
76
- const afterPayloadData = payload.data?.after;
77
- const updatedPayloadData = beforePayloadData ? JSON.stringify({
78
- before: beforePayloadData,
79
- after: afterPayloadData
80
- }) : JSON.stringify(payload.data);
81
- const data = await compressor.compress(updatedPayloadData);
82
- try {
83
- await app.search.update(existingLog.id, {
84
- data: {
85
- ...payload,
86
- data
87
- }
88
- });
89
- return {
90
- ...existingLog,
91
- data: updatedPayloadData
92
- };
93
- } catch (error) {
94
- throw _error.default.from(error, {
95
- message: "Error while updating audit log",
96
- code: "UPDATE_AUDIT_LOG"
97
- });
98
- }
99
- }
100
- }
101
- return createAuditLog(params);
102
- };
103
- const getAuditConfig = audit => {
104
- return async (message, data, entityId, context) => {
105
- const {
106
- aco,
107
- security
108
- } = context;
109
- if (!aco) {
110
- console.log("No ACO defined.");
111
- return;
112
- }
113
- const identity = security.getIdentity();
114
- const auditLogPayload = {
115
- message,
116
- app: audit.app.app,
117
- entity: audit.entity.type,
118
- entityId,
119
- action: audit.action.type,
120
- data,
121
- timestamp: new Date(),
122
- initiator: identity?.id
123
- };
124
- const app = aco.getApp("AuditLogs");
125
- const delay = audit.action.newEntryDelay;
126
-
127
- // Check if there is delay on audit log creation for this action.
128
- if (delay) {
129
- try {
130
- return await createOrMergeAuditLog({
131
- app,
132
- payload: auditLogPayload,
133
- delay
134
- });
135
- } catch {
136
- // Don't care at this point!
137
- } finally {
138
- return JSON.stringify({});
139
- }
140
- }
141
- return await createAuditLog({
142
- app,
143
- payload: auditLogPayload
144
- });
145
- };
146
- };
147
- exports.getAuditConfig = getAuditConfig;
148
-
149
- //# sourceMappingURL=getAuditConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_utils","createAuditLog","params","app","payload","compressor","context","payloadData","JSON","stringify","data","entry","id","mdbid","title","message","content","tags","type","location","folderId","compress","search","create","error","WebinyError","from","code","createOrMergeAuditLog","delay","records","list","where","entityId","initiator","limit","existingLog","existingLogDate","Date","parse","savedOn","newLogDate","timestamp","getTime","existingLogData","decompress","beforePayloadData","before","afterPayloadData","after","updatedPayloadData","update","getAuditConfig","audit","aco","security","console","log","identity","getIdentity","auditLogPayload","entity","action","getApp","newEntryDelay","exports"],"sources":["getAuditConfig.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { mdbid } from \"@webiny/utils\";\nimport type { IAcoApp } from \"@webiny/api-aco/types\";\nimport type { AuditAction, AuditLog, AuditLogsContext } from \"~/types\";\nimport type { GenericRecord } from \"@webiny/api/types\";\n\ninterface AuditLogPayload extends Omit<AuditLog, \"id\" | \"data\"> {\n data: Record<string, any>;\n}\n\ninterface CreateAuditLogParams {\n app: IAcoApp;\n payload: AuditLogPayload;\n}\n\nconst createAuditLog = async (params: CreateAuditLogParams) => {\n const { app, payload } = params;\n\n const compressor = app.context.compressor;\n\n const payloadData = JSON.stringify(payload.data);\n\n try {\n const entry = {\n id: mdbid(),\n title: payload.message,\n content: payload.message,\n tags: [],\n type: \"AuditLogs\",\n location: { folderId: \"root\" },\n data: {\n ...payload,\n data: payloadData\n }\n };\n const data = await compressor.compress(entry.data.data);\n await app.search.create({\n ...entry,\n data: {\n ...entry.data,\n data: JSON.stringify(data)\n }\n });\n return entry;\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while creating new audit log\",\n code: \"CREATE_AUDIT_LOG\"\n });\n }\n};\n\ninterface CreateOrMergeAuditLogParams {\n app: IAcoApp;\n payload: AuditLogPayload;\n delay: number;\n}\n\nconst createOrMergeAuditLog = async (params: CreateOrMergeAuditLogParams) => {\n const { app, payload, delay } = params;\n\n const compressor = app.context.compressor;\n // Get the latest audit log of this entry.\n const [records] = await app.search.list({\n where: {\n type: \"AuditLogs\",\n data: {\n entityId: payload.entityId,\n initiator: payload.initiator\n }\n },\n limit: 1\n });\n const existingLog = records?.[0];\n\n if (existingLog) {\n const existingLogDate = Date.parse(existingLog.savedOn);\n const newLogDate = payload.timestamp.getTime();\n\n // Check if the latest audit log is saved within delay range.\n if (newLogDate - existingLogDate < delay * 1000) {\n const existingLogData = (await compressor.decompress(\n existingLog.data\n )) as unknown as GenericRecord;\n // Update latest audit log with new \"after\" payload.\n const beforePayloadData = JSON.parse(existingLogData?.data.data)?.before;\n const afterPayloadData = payload.data?.after;\n const updatedPayloadData = beforePayloadData\n ? JSON.stringify({ before: beforePayloadData, after: afterPayloadData })\n : JSON.stringify(payload.data);\n\n const data = await compressor.compress(updatedPayloadData);\n try {\n await app.search.update(existingLog.id, {\n data: {\n ...payload,\n data\n }\n });\n\n return {\n ...existingLog,\n data: updatedPayloadData\n };\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while updating audit log\",\n code: \"UPDATE_AUDIT_LOG\"\n });\n }\n }\n }\n\n return createAuditLog(params);\n};\n\nexport const getAuditConfig = (audit: AuditAction) => {\n return async (\n message: string,\n data: Record<string, any>,\n entityId: string,\n context: AuditLogsContext\n ) => {\n const { aco, security } = context;\n\n if (!aco) {\n console.log(\"No ACO defined.\");\n return;\n }\n\n const identity = security.getIdentity();\n\n const auditLogPayload = {\n message,\n app: audit.app.app,\n entity: audit.entity.type,\n entityId,\n action: audit.action.type,\n data,\n timestamp: new Date(),\n initiator: identity?.id\n };\n\n const app = aco.getApp(\"AuditLogs\");\n const delay = audit.action.newEntryDelay;\n\n // Check if there is delay on audit log creation for this action.\n if (delay) {\n try {\n return await createOrMergeAuditLog({\n app,\n payload: auditLogPayload,\n delay\n });\n } catch {\n // Don't care at this point!\n } finally {\n return JSON.stringify({});\n }\n }\n return await createAuditLog({\n app,\n payload: auditLogPayload\n });\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAcA,MAAME,cAAc,GAAG,MAAOC,MAA4B,IAAK;EAC3D,MAAM;IAAEC,GAAG;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAE/B,MAAMG,UAAU,GAAGF,GA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