@webiny/api-audit-logs 0.0.0-unstable.a4637c5ce6 → 0.0.0-unstable.a4f3e4ea8b

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 (302) hide show
  1. package/README.md +11 -1
  2. package/abstractions.d.ts +10 -0
  3. package/abstractions.js +6 -0
  4. package/abstractions.js.map +1 -0
  5. package/config.d.ts +0 -13
  6. package/config.js +4 -291
  7. package/config.js.map +1 -1
  8. package/context/AuditLogsContextValue.d.ts +10 -0
  9. package/context/AuditLogsContextValue.js +129 -0
  10. package/context/AuditLogsContextValue.js.map +1 -0
  11. package/context/index.d.ts +6 -0
  12. package/context/index.js +25 -0
  13. package/context/index.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 +43 -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/graphql/schema.d.ts +3 -0
  32. package/graphql/schema.js +115 -0
  33. package/graphql/schema.js.map +1 -0
  34. package/graphql/validation.d.ts +21 -0
  35. package/graphql/validation.js +31 -0
  36. package/graphql/validation.js.map +1 -0
  37. package/index.d.ts +5 -4
  38. package/index.js +21 -46
  39. package/index.js.map +1 -1
  40. package/package.json +33 -26
  41. package/storage/abstractions/Storage.d.ts +108 -0
  42. package/storage/abstractions/Storage.js +0 -0
  43. package/storage/types.d.ts +19 -0
  44. package/storage/types.js +0 -0
  45. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +11 -0
  46. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +36 -0
  47. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -0
  48. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +11 -0
  49. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +39 -0
  50. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -0
  51. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +11 -0
  52. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +42 -0
  53. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -0
  54. package/subscriptions/aco/index.d.ts +1 -1
  55. package/subscriptions/aco/index.js +8 -15
  56. package/subscriptions/aco/index.js.map +1 -1
  57. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.d.ts +11 -0
  58. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js +41 -0
  59. package/subscriptions/ai/handlers/AuditLogAiAfterGenerateTextHandler.js.map +1 -0
  60. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.d.ts +11 -0
  61. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js +38 -0
  62. package/subscriptions/ai/handlers/AuditLogAiBeforeGenerateTextHandler.js.map +1 -0
  63. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.d.ts +11 -0
  64. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js +40 -0
  65. package/subscriptions/ai/handlers/AuditLogAiGenerateTextErrorHandler.js.map +1 -0
  66. package/subscriptions/ai/index.d.ts +2 -0
  67. package/subscriptions/ai/index.js +11 -0
  68. package/subscriptions/ai/index.js.map +1 -0
  69. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +11 -0
  70. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +31 -0
  71. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -0
  72. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +11 -0
  73. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +31 -0
  74. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -0
  75. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +11 -0
  76. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +34 -0
  77. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -0
  78. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +11 -0
  79. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +34 -0
  80. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -0
  81. package/subscriptions/fileManager/index.d.ts +2 -2
  82. package/subscriptions/fileManager/index.js +10 -14
  83. package/subscriptions/fileManager/index.js.map +1 -1
  84. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +11 -0
  85. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +32 -0
  86. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -0
  87. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +11 -0
  88. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +37 -0
  89. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -0
  90. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +11 -0
  91. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +32 -0
  92. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -0
  93. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +11 -0
  94. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +32 -0
  95. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -0
  96. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +11 -0
  97. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +32 -0
  98. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -0
  99. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +11 -0
  100. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +35 -0
  101. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -0
  102. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +11 -0
  103. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +32 -0
  104. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -0
  105. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +11 -0
  106. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +32 -0
  107. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -0
  108. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +11 -0
  109. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +31 -0
  110. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -0
  111. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +11 -0
  112. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +31 -0
  113. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -0
  114. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +11 -0
  115. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +34 -0
  116. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -0
  117. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +11 -0
  118. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +31 -0
  119. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -0
  120. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +11 -0
  121. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +31 -0
  122. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -0
  123. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +11 -0
  124. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +34 -0
  125. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -0
  126. package/subscriptions/headlessCms/index.d.ts +1 -1
  127. package/subscriptions/headlessCms/index.js +30 -28
  128. package/subscriptions/headlessCms/index.js.map +1 -1
  129. package/subscriptions/index.d.ts +1 -1
  130. package/subscriptions/index.js +16 -22
  131. package/subscriptions/index.js.map +1 -1
  132. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +11 -0
  133. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +33 -0
  134. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -0
  135. package/subscriptions/mailer/index.d.ts +2 -2
  136. package/subscriptions/mailer/index.js +4 -10
  137. package/subscriptions/mailer/index.js.map +1 -1
  138. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +11 -0
  139. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +41 -0
  140. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -0
  141. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +11 -0
  142. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +41 -0
  143. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -0
  144. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +11 -0
  145. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +45 -0
  146. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -0
  147. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +11 -0
  148. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +31 -0
  149. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -0
  150. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +11 -0
  151. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +31 -0
  152. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -0
  153. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +11 -0
  154. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +34 -0
  155. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -0
  156. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +11 -0
  157. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +31 -0
  158. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -0
  159. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +11 -0
  160. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +31 -0
  161. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -0
  162. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +11 -0
  163. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +34 -0
  164. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -0
  165. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +11 -0
  166. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +31 -0
  167. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -0
  168. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +11 -0
  169. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +31 -0
  170. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -0
  171. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +11 -0
  172. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +34 -0
  173. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -0
  174. package/subscriptions/security/handlers/cleanupApiKey.d.ts +7 -0
  175. package/subscriptions/security/handlers/cleanupApiKey.js +12 -0
  176. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -0
  177. package/subscriptions/security/index.d.ts +2 -2
  178. package/subscriptions/security/index.js +26 -24
  179. package/subscriptions/security/index.js.map +1 -1
  180. package/subscriptions/websiteBuilder/index.d.ts +2 -0
  181. package/subscriptions/websiteBuilder/index.js +29 -0
  182. package/subscriptions/websiteBuilder/index.js.map +1 -0
  183. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +11 -0
  184. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +31 -0
  185. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -0
  186. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +11 -0
  187. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +31 -0
  188. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -0
  189. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +11 -0
  190. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +31 -0
  191. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -0
  192. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +11 -0
  193. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +34 -0
  194. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -0
  195. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +11 -0
  196. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +31 -0
  197. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -0
  198. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +11 -0
  199. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +31 -0
  200. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -0
  201. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +11 -0
  202. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +31 -0
  203. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -0
  204. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +11 -0
  205. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +34 -0
  206. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -0
  207. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +11 -0
  208. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +31 -0
  209. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -0
  210. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +11 -0
  211. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +31 -0
  212. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -0
  213. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +11 -0
  214. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +31 -0
  215. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -0
  216. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +11 -0
  217. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +34 -0
  218. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -0
  219. package/types.d.ts +37 -38
  220. package/types.js +0 -18
  221. package/utils/expiresAt.d.ts +4 -0
  222. package/utils/expiresAt.js +20 -0
  223. package/utils/expiresAt.js.map +1 -0
  224. package/utils/getAuditConfig.d.ts +4 -36
  225. package/utils/getAuditConfig.js +75 -138
  226. package/utils/getAuditConfig.js.map +1 -1
  227. package/utils/getAuditObject.d.ts +2 -1
  228. package/utils/getAuditObject.js +14 -22
  229. package/utils/getAuditObject.js.map +1 -1
  230. package/app/app.d.ts +0 -2
  231. package/app/app.js +0 -119
  232. package/app/app.js.map +0 -1
  233. package/app/contants.d.ts +0 -2
  234. package/app/contants.js +0 -10
  235. package/app/contants.js.map +0 -1
  236. package/app/createAppModifier.d.ts +0 -4
  237. package/app/createAppModifier.js +0 -14
  238. package/app/createAppModifier.js.map +0 -1
  239. package/app/index.d.ts +0 -4
  240. package/app/index.js +0 -43
  241. package/app/index.js.map +0 -1
  242. package/app/types.d.ts +0 -7
  243. package/app/types.js +0 -7
  244. package/app/types.js.map +0 -1
  245. package/subscriptions/aco/folders.d.ts +0 -4
  246. package/subscriptions/aco/folders.js +0 -94
  247. package/subscriptions/aco/folders.js.map +0 -1
  248. package/subscriptions/apw/changeRequests.d.ts +0 -4
  249. package/subscriptions/apw/changeRequests.js +0 -80
  250. package/subscriptions/apw/changeRequests.js.map +0 -1
  251. package/subscriptions/apw/comments.d.ts +0 -2
  252. package/subscriptions/apw/comments.js +0 -28
  253. package/subscriptions/apw/comments.js.map +0 -1
  254. package/subscriptions/apw/contentReviews.d.ts +0 -2
  255. package/subscriptions/apw/contentReviews.js +0 -28
  256. package/subscriptions/apw/contentReviews.js.map +0 -1
  257. package/subscriptions/apw/index.d.ts +0 -2
  258. package/subscriptions/apw/index.js +0 -26
  259. package/subscriptions/apw/index.js.map +0 -1
  260. package/subscriptions/apw/workflows.d.ts +0 -4
  261. package/subscriptions/apw/workflows.js +0 -64
  262. package/subscriptions/apw/workflows.js.map +0 -1
  263. package/subscriptions/fileManager/files.d.ts +0 -4
  264. package/subscriptions/fileManager/files.js +0 -64
  265. package/subscriptions/fileManager/files.js.map +0 -1
  266. package/subscriptions/fileManager/settings.d.ts +0 -2
  267. package/subscriptions/fileManager/settings.js +0 -32
  268. package/subscriptions/fileManager/settings.js.map +0 -1
  269. package/subscriptions/headlessCms/entries.d.ts +0 -9
  270. package/subscriptions/headlessCms/entries.js +0 -183
  271. package/subscriptions/headlessCms/entries.js.map +0 -1
  272. package/subscriptions/headlessCms/groups.d.ts +0 -4
  273. package/subscriptions/headlessCms/groups.js +0 -64
  274. package/subscriptions/headlessCms/groups.js.map +0 -1
  275. package/subscriptions/headlessCms/models.d.ts +0 -4
  276. package/subscriptions/headlessCms/models.js +0 -64
  277. package/subscriptions/headlessCms/models.js.map +0 -1
  278. package/subscriptions/headlessCms/utils/isSearchModelEntry.d.ts +0 -1
  279. package/subscriptions/headlessCms/utils/isSearchModelEntry.js +0 -13
  280. package/subscriptions/headlessCms/utils/isSearchModelEntry.js.map +0 -1
  281. package/subscriptions/i18n/index.d.ts +0 -2
  282. package/subscriptions/i18n/index.js +0 -15
  283. package/subscriptions/i18n/index.js.map +0 -1
  284. package/subscriptions/i18n/locales.d.ts +0 -4
  285. package/subscriptions/i18n/locales.js +0 -64
  286. package/subscriptions/i18n/locales.js.map +0 -1
  287. package/subscriptions/mailer/settings.d.ts +0 -2
  288. package/subscriptions/mailer/settings.js +0 -32
  289. package/subscriptions/mailer/settings.js.map +0 -1
  290. package/subscriptions/security/apiKeys.d.ts +0 -4
  291. package/subscriptions/security/apiKeys.js +0 -85
  292. package/subscriptions/security/apiKeys.js.map +0 -1
  293. package/subscriptions/security/roles.d.ts +0 -4
  294. package/subscriptions/security/roles.js +0 -64
  295. package/subscriptions/security/roles.js.map +0 -1
  296. package/subscriptions/security/teams.d.ts +0 -4
  297. package/subscriptions/security/teams.js +0 -64
  298. package/subscriptions/security/teams.js.map +0 -1
  299. package/subscriptions/security/users.d.ts +0 -4
  300. package/subscriptions/security/users.js +0 -64
  301. package/subscriptions/security/users.js.map +0 -1
  302. package/types.js.map +0 -1
@@ -0,0 +1,31 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { RedirectAfterCreateEventHandler } from "@webiny/api-website-builder/features/redirects/CreateRedirect/index.js";
3
+ import { AuditLogsContext } from "../../../abstractions.js";
4
+ import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
+ import { AUDIT } from "../../../config.js";
6
+ class RedirectAfterCreateHandlerImpl {
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { redirect } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.CREATE);
14
+ await createAuditLog("Website Redirect Created", redirect, redirect.id, this.context);
15
+ } catch (error) {
16
+ throw WebinyError.from(error, {
17
+ message: "Error while executing RedirectAfterCreateEventHandler",
18
+ code: "AUDIT_LOGS_AFTER_REDIRECT_CREATE_HANDLER"
19
+ });
20
+ }
21
+ }
22
+ }
23
+ const RedirectAfterCreateAuditHandler = RedirectAfterCreateEventHandler.createImplementation({
24
+ implementation: RedirectAfterCreateHandlerImpl,
25
+ dependencies: [
26
+ AuditLogsContext
27
+ ]
28
+ });
29
+ export { RedirectAfterCreateAuditHandler };
30
+
31
+ //# sourceMappingURL=RedirectAfterCreateHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterCreateEventHandler } from \"@webiny/api-website-builder/features/redirects/CreateRedirect/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterCreateHandlerImpl implements RedirectAfterCreateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RedirectAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.CREATE);\n await createAuditLog(\"Website Redirect Created\", redirect, redirect.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterCreateEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterCreateAuditHandler = RedirectAfterCreateEventHandler.createImplementation(\n {\n implementation: RedirectAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n }\n);\n"],"names":["RedirectAfterCreateHandlerImpl","context","event","redirect","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","RedirectAfterCreateAuditHandler","RedirectAfterCreateEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,iBAAiBC,eAAeC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;YAC3E,MAAMF,eAAe,4BAA4BD,UAAUA,SAAS,EAAE,EAAE,IAAI,CAAC,OAAO;QACxF,EAAE,OAAOI,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -0,0 +1,11 @@
1
+ import { RedirectAfterDeleteEventHandler } from "@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js";
2
+ import { AuditLogsContext } from "../../../abstractions.js";
3
+ declare class RedirectAfterDeleteHandlerImpl implements RedirectAfterDeleteEventHandler.Interface {
4
+ private context;
5
+ constructor(context: AuditLogsContext.Interface);
6
+ handle(event: RedirectAfterDeleteEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const RedirectAfterDeleteAuditHandler: typeof RedirectAfterDeleteHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-website-builder/features/redirects/DeleteRedirect/abstractions").RedirectAfterDeletePayload>>>;
10
+ };
11
+ export {};
@@ -0,0 +1,31 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { RedirectAfterDeleteEventHandler } from "@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js";
3
+ import { AuditLogsContext } from "../../../abstractions.js";
4
+ import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
+ import { AUDIT } from "../../../config.js";
6
+ class RedirectAfterDeleteHandlerImpl {
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { redirect } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.DELETE);
14
+ await createAuditLog("Website Redirect Deleted", redirect, redirect.id, this.context);
15
+ } catch (error) {
16
+ throw WebinyError.from(error, {
17
+ message: "Error while executing RedirectAfterDeleteEventHandler",
18
+ code: "AUDIT_LOGS_AFTER_REDIRECT_DELETE_HANDLER"
19
+ });
20
+ }
21
+ }
22
+ }
23
+ const RedirectAfterDeleteAuditHandler = RedirectAfterDeleteEventHandler.createImplementation({
24
+ implementation: RedirectAfterDeleteHandlerImpl,
25
+ dependencies: [
26
+ AuditLogsContext
27
+ ]
28
+ });
29
+ export { RedirectAfterDeleteAuditHandler };
30
+
31
+ //# sourceMappingURL=RedirectAfterDeleteHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterDeleteEventHandler } from \"@webiny/api-website-builder/features/redirects/DeleteRedirect/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterDeleteHandlerImpl implements RedirectAfterDeleteEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RedirectAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.DELETE);\n await createAuditLog(\"Website Redirect Deleted\", redirect, redirect.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterDeleteEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterDeleteAuditHandler = RedirectAfterDeleteEventHandler.createImplementation(\n {\n implementation: RedirectAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n }\n);\n"],"names":["RedirectAfterDeleteHandlerImpl","context","event","redirect","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","RedirectAfterDeleteAuditHandler","RedirectAfterDeleteEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,iBAAiBC,eAAeC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;YAC3E,MAAMF,eAAe,4BAA4BD,UAAUA,SAAS,EAAE,EAAE,IAAI,CAAC,OAAO;QACxF,EAAE,OAAOI,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -0,0 +1,11 @@
1
+ import { RedirectAfterMoveEventHandler } from "@webiny/api-website-builder/features/redirects/MoveRedirect/index.js";
2
+ import { AuditLogsContext } from "../../../abstractions.js";
3
+ declare class RedirectAfterMoveHandlerImpl implements RedirectAfterMoveEventHandler.Interface {
4
+ private context;
5
+ constructor(context: AuditLogsContext.Interface);
6
+ handle(event: RedirectAfterMoveEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const RedirectAfterMoveAuditHandler: typeof RedirectAfterMoveHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-website-builder/features/redirects/MoveRedirect/abstractions").RedirectAfterMovePayload>>>;
10
+ };
11
+ export {};
@@ -0,0 +1,31 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { RedirectAfterMoveEventHandler } from "@webiny/api-website-builder/features/redirects/MoveRedirect/index.js";
3
+ import { AuditLogsContext } from "../../../abstractions.js";
4
+ import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
+ import { AUDIT } from "../../../config.js";
6
+ class RedirectAfterMoveHandlerImpl {
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { redirect } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.MOVE);
14
+ await createAuditLog("Website Redirect Moved", redirect, redirect.id, this.context);
15
+ } catch (error) {
16
+ throw WebinyError.from(error, {
17
+ message: "Error while executing RedirectAfterMoveEventHandler",
18
+ code: "AUDIT_LOGS_AFTER_REDIRECT_MOVE_HANDLER"
19
+ });
20
+ }
21
+ }
22
+ }
23
+ const RedirectAfterMoveAuditHandler = RedirectAfterMoveEventHandler.createImplementation({
24
+ implementation: RedirectAfterMoveHandlerImpl,
25
+ dependencies: [
26
+ AuditLogsContext
27
+ ]
28
+ });
29
+ export { RedirectAfterMoveAuditHandler };
30
+
31
+ //# sourceMappingURL=RedirectAfterMoveHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterMoveEventHandler } from \"@webiny/api-website-builder/features/redirects/MoveRedirect/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterMoveHandlerImpl implements RedirectAfterMoveEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RedirectAfterMoveEventHandler.Event): Promise<void> {\n try {\n const { redirect } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.MOVE);\n await createAuditLog(\"Website Redirect Moved\", redirect, redirect.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterMoveEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_MOVE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterMoveAuditHandler = RedirectAfterMoveEventHandler.createImplementation({\n implementation: RedirectAfterMoveHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["RedirectAfterMoveHandlerImpl","context","event","redirect","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","RedirectAfterMoveAuditHandler","RedirectAfterMoveEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAE,GAAGD,MAAM,OAAO;YAClC,MAAME,iBAAiBC,eAAeC,MAAM,eAAe,CAAC,QAAQ,CAAC,IAAI;YACzE,MAAMF,eAAe,0BAA0BD,UAAUA,SAAS,EAAE,EAAE,IAAI,CAAC,OAAO;QACtF,EAAE,OAAOI,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,gCAAgCC,8BAA8B,oBAAoB,CAAC;IAC5F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -0,0 +1,11 @@
1
+ import { RedirectAfterUpdateEventHandler } from "@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js";
2
+ import { AuditLogsContext } from "../../../abstractions.js";
3
+ declare class RedirectAfterUpdateHandlerImpl implements RedirectAfterUpdateEventHandler.Interface {
4
+ private context;
5
+ constructor(context: AuditLogsContext.Interface);
6
+ handle(event: RedirectAfterUpdateEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const RedirectAfterUpdateAuditHandler: typeof RedirectAfterUpdateHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/eventPublisher").DomainEvent<import("@webiny/api-website-builder/features/redirects/UpdateRedirect/abstractions").RedirectAfterUpdatePayload>>>;
10
+ };
11
+ export {};
@@ -0,0 +1,34 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ import { RedirectAfterUpdateEventHandler } from "@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js";
3
+ import { AuditLogsContext } from "../../../abstractions.js";
4
+ import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
+ import { AUDIT } from "../../../config.js";
6
+ class RedirectAfterUpdateHandlerImpl {
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { redirect, original } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.UPDATE);
14
+ await createAuditLog("Website Redirect Updated", {
15
+ before: original,
16
+ after: redirect
17
+ }, redirect.id, this.context);
18
+ } catch (error) {
19
+ throw WebinyError.from(error, {
20
+ message: "Error while executing RedirectAfterUpdateEventHandler",
21
+ code: "AUDIT_LOGS_AFTER_REDIRECT_UPDATE_HANDLER"
22
+ });
23
+ }
24
+ }
25
+ }
26
+ const RedirectAfterUpdateAuditHandler = RedirectAfterUpdateEventHandler.createImplementation({
27
+ implementation: RedirectAfterUpdateHandlerImpl,
28
+ dependencies: [
29
+ AuditLogsContext
30
+ ]
31
+ });
32
+ export { RedirectAfterUpdateAuditHandler };
33
+
34
+ //# sourceMappingURL=RedirectAfterUpdateHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js","sources":["../../../../src/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { RedirectAfterUpdateEventHandler } from \"@webiny/api-website-builder/features/redirects/UpdateRedirect/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { AUDIT } from \"~/config.js\";\n\nclass RedirectAfterUpdateHandlerImpl implements RedirectAfterUpdateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RedirectAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { redirect, original } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.WEBSITE_BUILDER.REDIRECT.UPDATE);\n await createAuditLog(\n \"Website Redirect Updated\",\n { before: original, after: redirect },\n redirect.id,\n this.context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing RedirectAfterUpdateEventHandler\",\n code: \"AUDIT_LOGS_AFTER_REDIRECT_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const RedirectAfterUpdateAuditHandler = RedirectAfterUpdateEventHandler.createImplementation(\n {\n implementation: RedirectAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n }\n);\n"],"names":["RedirectAfterUpdateHandlerImpl","context","event","redirect","original","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","RedirectAfterUpdateAuditHandler","RedirectAfterUpdateEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA4C,EAAiB;QACtE,IAAI;YACA,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGF,MAAM,OAAO;YAC5C,MAAMG,iBAAiBC,eAAeC,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM;YAC3E,MAAMF,eACF,4BACA;gBAAE,QAAQD;gBAAU,OAAOD;YAAS,GACpCA,SAAS,EAAE,EACX,IAAI,CAAC,OAAO;QAEpB,EAAE,OAAOK,OAAO;YACZ,MAAMC,YAAY,IAAI,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,kCAAkCC,gCAAgC,oBAAoB,CAC/F;IACI,gBAAgBX;IAChB,cAAc;QAACY;KAAiB;AACpC"}
package/types.d.ts CHANGED
@@ -1,41 +1,40 @@
1
- import type { AcoContext } from "@webiny/api-aco/types";
2
- import type { MailerContext } from "@webiny/api-mailer/types";
3
- import type { SecurityContext } from "@webiny/api-security/types";
4
- import type { ApwContext } from "@webiny/api-apw/types";
5
- import type { Context as BaseContext } from "@webiny/handler/types";
6
- export * from "./app/types";
7
- export interface Action {
8
- type: string;
9
- displayName: string;
10
- /**
11
- * Delay in seconds before a new audit log can be created.
12
- * During this delay actions will update existing audit log instead of creating new ones.
13
- */
14
- newEntryDelay?: number;
15
- }
16
- export interface Entity {
17
- type: string;
18
- displayName: string;
19
- linkToEntity?: (id: string) => string;
20
- actions: Action[];
21
- }
22
- export interface App {
23
- app: string;
24
- displayName: string;
25
- entities: Entity[];
26
- }
27
- export interface AuditLog {
28
- id: string;
29
- message: string;
30
- app: string;
31
- entity: string;
32
- entityId: string;
33
- action: string;
34
- data: JSON;
35
- timestamp: Date;
36
- initiator: string;
37
- }
38
- export interface AuditLogsContext extends BaseContext, AcoContext, MailerContext, SecurityContext, ApwContext {
1
+ import type { GenericRecord } from "@webiny/api/types.js";
2
+ import type { Action, App, Entity } from "@webiny/common-audit-logs/types.js";
3
+ import type { DbContext } from "@webiny/handler-db/types.js";
4
+ import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
5
+ import type { IAuditLog } from "./storage/types.js";
6
+ import type { IStorageListParams } from "./storage/abstractions/Storage.js";
7
+ export interface AuditLogPayload extends Omit<IAuditLog, "id" | "tenant" | "createdOn" | "createdBy" | "expiresAt" | "content"> {
8
+ content: GenericRecord;
9
+ }
10
+ export interface IListAuditLogsParams extends Omit<IStorageListParams, "tenant" | "limit" | "app"> {
11
+ app?: string;
12
+ limit?: number;
13
+ }
14
+ export interface IListAuditLogsResultMeta {
15
+ cursor: string | null;
16
+ hasMoreItems: boolean;
17
+ }
18
+ export interface IListAuditLogsSuccessResult {
19
+ items: IAuditLog[];
20
+ meta: IListAuditLogsResultMeta;
21
+ error?: never;
22
+ }
23
+ export interface IListAuditLogsErrorResult {
24
+ items?: never;
25
+ meta?: never;
26
+ error: Error;
27
+ }
28
+ export type IListAuditLogsResult = IListAuditLogsSuccessResult | IListAuditLogsErrorResult;
29
+ export interface AuditLogsContextValue {
30
+ deleteLogsAfterDays: number | undefined;
31
+ createAuditLog(payload: AuditLogPayload): Promise<IAuditLog>;
32
+ updateAuditLog(original: IAuditLog, payload: Partial<AuditLogPayload>): Promise<IAuditLog>;
33
+ getAuditLog(id: string): Promise<IAuditLog | null>;
34
+ listAuditLogs(params: IListAuditLogsParams): Promise<IListAuditLogsResult>;
35
+ }
36
+ export interface AuditLogsContext extends ApiCoreContext, Pick<DbContext, "db"> {
37
+ auditLogs: AuditLogsContextValue;
39
38
  }
40
39
  export interface AuditObject {
41
40
  [app: string]: EntityObject;
package/types.js CHANGED
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _types = require("./app/types");
7
- Object.keys(_types).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _types[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _types[key];
14
- }
15
- });
16
- });
17
-
18
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,4 @@
1
+ export declare const convertExpiresAtDaysToDate: (days: number) => Date;
2
+ export declare const convertExpiresAtToUnixTimestamp: (expiresAt: Date | string) => number;
3
+ export declare const convertUnixTimestampToDate: (expiresAt: number | undefined | null) => Date | undefined;
4
+ export declare const convertUnixTimestampToISODateString: (expiresAt: number | undefined | null) => string | undefined;
@@ -0,0 +1,20 @@
1
+ const convertExpiresAtDaysToDate = (days)=>{
2
+ const date = new Date();
3
+ date.setTime(24 * days * 3600000 + date.getTime());
4
+ return date;
5
+ };
6
+ const convertExpiresAtToUnixTimestamp = (expiresAt)=>{
7
+ if ("string" == typeof expiresAt) expiresAt = new Date(expiresAt);
8
+ return Math.floor(expiresAt.getTime() / 1000);
9
+ };
10
+ const convertUnixTimestampToDate = (expiresAt)=>{
11
+ if (!expiresAt) return;
12
+ return new Date(1000 * expiresAt);
13
+ };
14
+ const convertUnixTimestampToISODateString = (expiresAt)=>{
15
+ if (!expiresAt) return;
16
+ return convertUnixTimestampToDate(expiresAt)?.toISOString();
17
+ };
18
+ export { convertExpiresAtDaysToDate, convertExpiresAtToUnixTimestamp, convertUnixTimestampToDate, convertUnixTimestampToISODateString };
19
+
20
+ //# sourceMappingURL=expiresAt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/expiresAt.js","sources":["../../src/utils/expiresAt.ts"],"sourcesContent":["export const convertExpiresAtDaysToDate = (days: number): Date => {\n const date = new Date();\n date.setTime(days * 24 * 60 * 60 * 1000 + date.getTime());\n return date;\n};\n\nexport const convertExpiresAtToUnixTimestamp = (expiresAt: Date | string): number => {\n if (typeof expiresAt === \"string\") {\n expiresAt = new Date(expiresAt);\n }\n return Math.floor(expiresAt.getTime() / 1000);\n};\n\nexport const convertUnixTimestampToDate = (\n expiresAt: number | undefined | null\n): Date | undefined => {\n if (!expiresAt) {\n return undefined;\n }\n return new Date(expiresAt * 1000);\n};\n\nexport const convertUnixTimestampToISODateString = (\n expiresAt: number | undefined | null\n): string | undefined => {\n if (!expiresAt) {\n return undefined;\n }\n return convertUnixTimestampToDate(expiresAt)?.toISOString();\n};\n"],"names":["convertExpiresAtDaysToDate","days","date","Date","convertExpiresAtToUnixTimestamp","expiresAt","Math","convertUnixTimestampToDate","convertUnixTimestampToISODateString"],"mappings":"AAAO,MAAMA,6BAA6B,CAACC;IACvC,MAAMC,OAAO,IAAIC;IACjBD,KAAK,OAAO,CAACD,AAAO,KAAPA,OAAAA,UAA6BC,KAAK,OAAO;IACtD,OAAOA;AACX;AAEO,MAAME,kCAAkC,CAACC;IAC5C,IAAI,AAAqB,YAArB,OAAOA,WACPA,YAAY,IAAIF,KAAKE;IAEzB,OAAOC,KAAK,KAAK,CAACD,UAAU,OAAO,KAAK;AAC5C;AAEO,MAAME,6BAA6B,CACtCF;IAEA,IAAI,CAACA,WACD;IAEJ,OAAO,IAAIF,KAAKE,AAAY,OAAZA;AACpB;AAEO,MAAMG,sCAAsC,CAC/CH;IAEA,IAAI,CAACA,WACD;IAEJ,OAAOE,2BAA2BF,YAAY;AAClD"}
@@ -1,36 +1,4 @@
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
+ import type { AuditAction, AuditLogsContext } from "../types.js";
2
+ import type { IAuditLog } from "../storage/types.js";
3
+ import type { GenericRecord } from "@webiny/api/types.js";
4
+ export declare const getAuditConfig: (audit: AuditAction) => (message: string, content: GenericRecord, entityId: string, context: AuditLogsContext) => Promise<IAuditLog | null>;
@@ -1,149 +1,86 @@
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
- }
1
+ import _webiny_error from "@webiny/error";
2
+ const createAuditLog = async (params)=>{
3
+ const { context, payload } = params;
4
+ try {
5
+ return await context.auditLogs.createAuditLog(payload);
6
+ } catch (error) {
7
+ throw _webiny_error.from(error);
8
+ }
47
9
  };
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: {
10
+ const createAuditLogDelayDate = (delay)=>{
11
+ if (!delay) return;
12
+ const date = new Date();
13
+ date.setTime(date.getTime() - 1000 * delay);
14
+ return date;
15
+ };
16
+ const createOrMergeAuditLog = async (params)=>{
17
+ const { context, payload, delay } = params;
18
+ const results = await context.auditLogs.listAuditLogs({
19
+ app: payload.app,
60
20
  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({
21
+ limit: 1,
22
+ createdOn_gte: createAuditLogDelayDate(delay),
23
+ sort: "DESC"
24
+ });
25
+ if (results.error) throw _webiny_error.from(results.error);
26
+ const original = results.items?.[0];
27
+ if (!original) return createAuditLog(params);
28
+ const beforePayloadData = original.content ? JSON.parse(original.content)?.before : void 0;
29
+ const afterPayloadData = payload.content?.after;
30
+ const updatedPayloadData = beforePayloadData ? {
78
31
  before: beforePayloadData,
79
32
  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: {
33
+ } : payload.content;
34
+ try {
35
+ return await context.auditLogs.updateAuditLog(original, {
85
36
  ...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"
37
+ content: updatedPayloadData
97
38
  });
98
- }
39
+ } catch (ex) {
40
+ throw _webiny_error.from(ex);
99
41
  }
100
- }
101
- return createAuditLog(params);
102
42
  };
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
43
+ const getAuditConfig = (audit)=>async (message, content, entityId, context)=>{
44
+ if (context.auditLogs) {
45
+ if (!audit) {
46
+ console.log("No Audit Action defined!");
47
+ return null;
48
+ }
49
+ } else {
50
+ console.log("No AuditLogs defined.");
51
+ return null;
52
+ }
53
+ const payload = {
54
+ message,
55
+ app: audit.app.app,
56
+ entityId,
57
+ entity: audit.entity.type,
58
+ action: audit.action.type,
59
+ content,
60
+ tags: []
61
+ };
62
+ const delay = audit.action.newEntryDelay || 0;
63
+ if (!context.security.getIdentity()?.id) {
64
+ console.log("No identity - skipping audit log creation.");
65
+ return null;
66
+ }
67
+ return await context.security.withoutAuthorization(async ()=>{
68
+ if (delay > 0) {
69
+ try {
70
+ return await createOrMergeAuditLog({
71
+ context,
72
+ payload,
73
+ delay
74
+ });
75
+ } catch {}
76
+ return null;
77
+ }
78
+ return await createAuditLog({
79
+ context,
80
+ payload
81
+ });
134
82
  });
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;
83
+ };
84
+ export { getAuditConfig };
148
85
 
149
86
  //# sourceMappingURL=getAuditConfig.js.map