@webiny/api-audit-logs 6.0.0-beta.0 → 6.0.0-rc.1

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 (413) hide show
  1. package/README.md +11 -1
  2. package/abstractions.d.ts +5 -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 +3 -291
  7. package/config.js.map +1 -1
  8. package/context/AuditLogsContextValue.d.ts +10 -0
  9. package/context/AuditLogsContextValue.js +139 -0
  10. package/context/AuditLogsContextValue.js.map +1 -0
  11. package/context/index.d.ts +9 -0
  12. package/context/index.js +35 -0
  13. package/context/index.js.map +1 -0
  14. package/events/AuditLogAfterCreateEvent.d.ts +6 -0
  15. package/events/AuditLogAfterCreateEvent.js +10 -0
  16. package/events/AuditLogAfterCreateEvent.js.map +1 -0
  17. package/events/AuditLogAfterUpdateEvent.d.ts +6 -0
  18. package/events/AuditLogAfterUpdateEvent.js +10 -0
  19. package/events/AuditLogAfterUpdateEvent.js.map +1 -0
  20. package/events/AuditLogBeforeCreateEvent.d.ts +6 -0
  21. package/events/AuditLogBeforeCreateEvent.js +10 -0
  22. package/events/AuditLogBeforeCreateEvent.js.map +1 -0
  23. package/events/AuditLogBeforeUpdateEvent.d.ts +6 -0
  24. package/events/AuditLogBeforeUpdateEvent.js +10 -0
  25. package/events/AuditLogBeforeUpdateEvent.js.map +1 -0
  26. package/events/abstractions.d.ts +43 -0
  27. package/events/abstractions.js +27 -0
  28. package/events/abstractions.js.map +1 -0
  29. package/events/index.d.ts +5 -0
  30. package/events/index.js +7 -0
  31. package/events/index.js.map +1 -0
  32. package/graphql/schema.d.ts +3 -0
  33. package/graphql/schema.js +126 -0
  34. package/graphql/schema.js.map +1 -0
  35. package/graphql/validation.d.ts +64 -0
  36. package/graphql/validation.js +35 -0
  37. package/graphql/validation.js.map +1 -0
  38. package/index.d.ts +8 -4
  39. package/index.js +15 -41
  40. package/index.js.map +1 -1
  41. package/package.json +30 -34
  42. package/storage/AccessPatternHandler.d.ts +14 -0
  43. package/storage/AccessPatternHandler.js +60 -0
  44. package/storage/AccessPatternHandler.js.map +1 -0
  45. package/storage/Converter.d.ts +16 -0
  46. package/storage/Converter.js +52 -0
  47. package/storage/Converter.js.map +1 -0
  48. package/storage/Storage.d.ts +18 -0
  49. package/storage/Storage.js +89 -0
  50. package/storage/Storage.js.map +1 -0
  51. package/storage/abstractions/AccessPattern.d.ts +24 -0
  52. package/storage/abstractions/AccessPattern.js +3 -0
  53. package/storage/abstractions/AccessPattern.js.map +1 -0
  54. package/storage/abstractions/AccessPatternHandler.d.ts +13 -0
  55. package/storage/abstractions/AccessPatternHandler.js +3 -0
  56. package/storage/abstractions/AccessPatternHandler.js.map +1 -0
  57. package/storage/abstractions/Converter.d.ts +6 -0
  58. package/storage/abstractions/Converter.js +3 -0
  59. package/storage/abstractions/Converter.js.map +1 -0
  60. package/storage/abstractions/Storage.d.ts +108 -0
  61. package/storage/abstractions/Storage.js +3 -0
  62. package/storage/abstractions/Storage.js.map +1 -0
  63. package/storage/accessPatterns/AppAccessPattern.d.ts +9 -0
  64. package/storage/accessPatterns/AppAccessPattern.js +29 -0
  65. package/storage/accessPatterns/AppAccessPattern.js.map +1 -0
  66. package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +9 -0
  67. package/storage/accessPatterns/AppCreatedByAccessPattern.js +32 -0
  68. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -0
  69. package/storage/accessPatterns/AppEntityAccessPattern.d.ts +9 -0
  70. package/storage/accessPatterns/AppEntityAccessPattern.js +29 -0
  71. package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -0
  72. package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +9 -0
  73. package/storage/accessPatterns/AppEntityActionAccessPattern.js +29 -0
  74. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -0
  75. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +9 -0
  76. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +32 -0
  77. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -0
  78. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +9 -0
  79. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +32 -0
  80. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -0
  81. package/storage/accessPatterns/BaseAccessPattern.d.ts +32 -0
  82. package/storage/accessPatterns/BaseAccessPattern.js +82 -0
  83. package/storage/accessPatterns/BaseAccessPattern.js.map +1 -0
  84. package/storage/accessPatterns/CreatedByAccessPattern.d.ts +9 -0
  85. package/storage/accessPatterns/CreatedByAccessPattern.js +32 -0
  86. package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -0
  87. package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +9 -0
  88. package/storage/accessPatterns/CreatedOnAccessPattern.js +30 -0
  89. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -0
  90. package/storage/accessPatterns/DefaultAccessPattern.d.ts +15 -0
  91. package/storage/accessPatterns/DefaultAccessPattern.js +36 -0
  92. package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -0
  93. package/storage/accessPatterns/EntityIdAccessPattern.d.ts +9 -0
  94. package/storage/accessPatterns/EntityIdAccessPattern.js +33 -0
  95. package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -0
  96. package/storage/accessPatterns/index.d.ts +6 -0
  97. package/storage/accessPatterns/index.js +47 -0
  98. package/storage/accessPatterns/index.js.map +1 -0
  99. package/storage/cursorSchema.d.ts +4 -0
  100. package/storage/cursorSchema.js +25 -0
  101. package/storage/cursorSchema.js.map +1 -0
  102. package/storage/entity.d.ts +36 -0
  103. package/storage/entity.js +127 -0
  104. package/storage/entity.js.map +1 -0
  105. package/storage/results/ListErrorResult.d.ts +10 -0
  106. package/storage/results/ListErrorResult.js +11 -0
  107. package/storage/results/ListErrorResult.js.map +1 -0
  108. package/storage/results/ListSuccessResult.d.ts +14 -0
  109. package/storage/results/ListSuccessResult.js +16 -0
  110. package/storage/results/ListSuccessResult.js.map +1 -0
  111. package/storage/results/index.d.ts +2 -0
  112. package/storage/results/index.js +4 -0
  113. package/storage/results/index.js.map +1 -0
  114. package/storage/startKey.d.ts +6 -0
  115. package/storage/startKey.js +9 -0
  116. package/storage/startKey.js.map +1 -0
  117. package/storage/types.d.ts +54 -0
  118. package/storage/types.js +3 -0
  119. package/storage/types.js.map +1 -0
  120. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +11 -0
  121. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +35 -0
  122. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -0
  123. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +11 -0
  124. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +38 -0
  125. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -0
  126. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +11 -0
  127. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +42 -0
  128. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -0
  129. package/subscriptions/aco/index.d.ts +1 -1
  130. package/subscriptions/aco/index.js +7 -15
  131. package/subscriptions/aco/index.js.map +1 -1
  132. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +11 -0
  133. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +30 -0
  134. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -0
  135. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +11 -0
  136. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +30 -0
  137. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -0
  138. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +11 -0
  139. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +34 -0
  140. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -0
  141. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +11 -0
  142. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +34 -0
  143. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -0
  144. package/subscriptions/fileManager/index.d.ts +2 -2
  145. package/subscriptions/fileManager/index.js +11 -13
  146. package/subscriptions/fileManager/index.js.map +1 -1
  147. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +11 -0
  148. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +34 -0
  149. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -0
  150. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +11 -0
  151. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +40 -0
  152. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -0
  153. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +11 -0
  154. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +34 -0
  155. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -0
  156. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +11 -0
  157. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +34 -0
  158. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -0
  159. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +11 -0
  160. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +34 -0
  161. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -0
  162. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +11 -0
  163. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +38 -0
  164. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -0
  165. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +11 -0
  166. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +34 -0
  167. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -0
  168. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +11 -0
  169. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +34 -0
  170. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -0
  171. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +11 -0
  172. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +30 -0
  173. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -0
  174. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +11 -0
  175. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +30 -0
  176. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -0
  177. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +11 -0
  178. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +34 -0
  179. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -0
  180. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +11 -0
  181. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +30 -0
  182. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -0
  183. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +11 -0
  184. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +30 -0
  185. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -0
  186. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +11 -0
  187. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +34 -0
  188. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -0
  189. package/subscriptions/headlessCms/index.d.ts +1 -1
  190. package/subscriptions/headlessCms/index.js +33 -27
  191. package/subscriptions/headlessCms/index.js.map +1 -1
  192. package/subscriptions/index.d.ts +1 -1
  193. package/subscriptions/index.js +13 -26
  194. package/subscriptions/index.js.map +1 -1
  195. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +11 -0
  196. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +32 -0
  197. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -0
  198. package/subscriptions/mailer/index.d.ts +2 -2
  199. package/subscriptions/mailer/index.js +4 -10
  200. package/subscriptions/mailer/index.js.map +1 -1
  201. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +11 -0
  202. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +47 -0
  203. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -0
  204. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +11 -0
  205. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +47 -0
  206. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -0
  207. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +11 -0
  208. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +52 -0
  209. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -0
  210. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +11 -0
  211. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +30 -0
  212. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -0
  213. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +11 -0
  214. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +30 -0
  215. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -0
  216. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +11 -0
  217. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +34 -0
  218. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -0
  219. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +11 -0
  220. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +30 -0
  221. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -0
  222. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +11 -0
  223. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +30 -0
  224. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -0
  225. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +11 -0
  226. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +34 -0
  227. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -0
  228. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +11 -0
  229. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +30 -0
  230. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -0
  231. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +11 -0
  232. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +30 -0
  233. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -0
  234. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +11 -0
  235. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +34 -0
  236. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -0
  237. package/subscriptions/security/handlers/cleanupApiKey.d.ts +7 -0
  238. package/subscriptions/security/handlers/cleanupApiKey.js +18 -0
  239. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -0
  240. package/subscriptions/security/index.d.ts +2 -2
  241. package/subscriptions/security/index.js +31 -23
  242. package/subscriptions/security/index.js.map +1 -1
  243. package/subscriptions/websiteBuilder/index.d.ts +2 -0
  244. package/subscriptions/websiteBuilder/index.js +31 -0
  245. package/subscriptions/websiteBuilder/index.js.map +1 -0
  246. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +11 -0
  247. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +30 -0
  248. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -0
  249. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +11 -0
  250. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +30 -0
  251. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -0
  252. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +11 -0
  253. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +30 -0
  254. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -0
  255. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +11 -0
  256. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +34 -0
  257. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -0
  258. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +11 -0
  259. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +30 -0
  260. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -0
  261. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +11 -0
  262. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +30 -0
  263. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -0
  264. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +11 -0
  265. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +30 -0
  266. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -0
  267. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +11 -0
  268. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +34 -0
  269. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -0
  270. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +11 -0
  271. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +30 -0
  272. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -0
  273. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +11 -0
  274. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +30 -0
  275. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -0
  276. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +11 -0
  277. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +30 -0
  278. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -0
  279. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +11 -0
  280. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +34 -0
  281. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -0
  282. package/types.d.ts +37 -43
  283. package/types.js +1 -16
  284. package/types.js.map +1 -1
  285. package/utils/expiresAt.d.ts +4 -0
  286. package/utils/expiresAt.js +25 -0
  287. package/utils/expiresAt.js.map +1 -0
  288. package/utils/getAuditConfig.d.ts +4 -36
  289. package/utils/getAuditConfig.js +77 -113
  290. package/utils/getAuditConfig.js.map +1 -1
  291. package/utils/getAuditObject.d.ts +2 -1
  292. package/utils/getAuditObject.js +1 -8
  293. package/utils/getAuditObject.js.map +1 -1
  294. package/app/app.d.ts +0 -2
  295. package/app/app.js +0 -120
  296. package/app/app.js.map +0 -1
  297. package/app/contants.d.ts +0 -2
  298. package/app/contants.js +0 -10
  299. package/app/contants.js.map +0 -1
  300. package/app/createAppModifier.d.ts +0 -4
  301. package/app/createAppModifier.js +0 -14
  302. package/app/createAppModifier.js.map +0 -1
  303. package/app/index.d.ts +0 -4
  304. package/app/index.js +0 -43
  305. package/app/index.js.map +0 -1
  306. package/app/types.d.ts +0 -7
  307. package/app/types.js +0 -7
  308. package/app/types.js.map +0 -1
  309. package/subscriptions/aco/folders.d.ts +0 -4
  310. package/subscriptions/aco/folders.js +0 -94
  311. package/subscriptions/aco/folders.js.map +0 -1
  312. package/subscriptions/apw/changeRequests.d.ts +0 -4
  313. package/subscriptions/apw/changeRequests.js +0 -80
  314. package/subscriptions/apw/changeRequests.js.map +0 -1
  315. package/subscriptions/apw/comments.d.ts +0 -2
  316. package/subscriptions/apw/comments.js +0 -28
  317. package/subscriptions/apw/comments.js.map +0 -1
  318. package/subscriptions/apw/contentReviews.d.ts +0 -2
  319. package/subscriptions/apw/contentReviews.js +0 -28
  320. package/subscriptions/apw/contentReviews.js.map +0 -1
  321. package/subscriptions/apw/index.d.ts +0 -2
  322. package/subscriptions/apw/index.js +0 -26
  323. package/subscriptions/apw/index.js.map +0 -1
  324. package/subscriptions/apw/workflows.d.ts +0 -4
  325. package/subscriptions/apw/workflows.js +0 -64
  326. package/subscriptions/apw/workflows.js.map +0 -1
  327. package/subscriptions/fileManager/files.d.ts +0 -4
  328. package/subscriptions/fileManager/files.js +0 -64
  329. package/subscriptions/fileManager/files.js.map +0 -1
  330. package/subscriptions/fileManager/settings.d.ts +0 -2
  331. package/subscriptions/fileManager/settings.js +0 -32
  332. package/subscriptions/fileManager/settings.js.map +0 -1
  333. package/subscriptions/formBuilder/formRevisions.d.ts +0 -6
  334. package/subscriptions/formBuilder/formRevisions.js +0 -96
  335. package/subscriptions/formBuilder/formRevisions.js.map +0 -1
  336. package/subscriptions/formBuilder/formSubmissions.d.ts +0 -2
  337. package/subscriptions/formBuilder/formSubmissions.js +0 -28
  338. package/subscriptions/formBuilder/formSubmissions.js.map +0 -1
  339. package/subscriptions/formBuilder/forms.d.ts +0 -5
  340. package/subscriptions/formBuilder/forms.js +0 -76
  341. package/subscriptions/formBuilder/forms.js.map +0 -1
  342. package/subscriptions/formBuilder/index.d.ts +0 -2
  343. package/subscriptions/formBuilder/index.js +0 -26
  344. package/subscriptions/formBuilder/index.js.map +0 -1
  345. package/subscriptions/formBuilder/settings.d.ts +0 -2
  346. package/subscriptions/formBuilder/settings.js +0 -32
  347. package/subscriptions/formBuilder/settings.js.map +0 -1
  348. package/subscriptions/headlessCms/entries.d.ts +0 -9
  349. package/subscriptions/headlessCms/entries.js +0 -183
  350. package/subscriptions/headlessCms/entries.js.map +0 -1
  351. package/subscriptions/headlessCms/groups.d.ts +0 -4
  352. package/subscriptions/headlessCms/groups.js +0 -64
  353. package/subscriptions/headlessCms/groups.js.map +0 -1
  354. package/subscriptions/headlessCms/models.d.ts +0 -4
  355. package/subscriptions/headlessCms/models.js +0 -64
  356. package/subscriptions/headlessCms/models.js.map +0 -1
  357. package/subscriptions/headlessCms/utils/isSearchModelEntry.d.ts +0 -1
  358. package/subscriptions/headlessCms/utils/isSearchModelEntry.js +0 -13
  359. package/subscriptions/headlessCms/utils/isSearchModelEntry.js.map +0 -1
  360. package/subscriptions/i18n/index.d.ts +0 -2
  361. package/subscriptions/i18n/index.js +0 -15
  362. package/subscriptions/i18n/index.js.map +0 -1
  363. package/subscriptions/i18n/locales.d.ts +0 -4
  364. package/subscriptions/i18n/locales.js +0 -64
  365. package/subscriptions/i18n/locales.js.map +0 -1
  366. package/subscriptions/mailer/settings.d.ts +0 -2
  367. package/subscriptions/mailer/settings.js +0 -32
  368. package/subscriptions/mailer/settings.js.map +0 -1
  369. package/subscriptions/pageBuilder/blockCategories.d.ts +0 -4
  370. package/subscriptions/pageBuilder/blockCategories.js +0 -64
  371. package/subscriptions/pageBuilder/blockCategories.js.map +0 -1
  372. package/subscriptions/pageBuilder/blocks.d.ts +0 -6
  373. package/subscriptions/pageBuilder/blocks.js +0 -96
  374. package/subscriptions/pageBuilder/blocks.js.map +0 -1
  375. package/subscriptions/pageBuilder/categories.d.ts +0 -4
  376. package/subscriptions/pageBuilder/categories.js +0 -64
  377. package/subscriptions/pageBuilder/categories.js.map +0 -1
  378. package/subscriptions/pageBuilder/index.d.ts +0 -2
  379. package/subscriptions/pageBuilder/index.js +0 -51
  380. package/subscriptions/pageBuilder/index.js.map +0 -1
  381. package/subscriptions/pageBuilder/menus.d.ts +0 -4
  382. package/subscriptions/pageBuilder/menus.js +0 -64
  383. package/subscriptions/pageBuilder/menus.js.map +0 -1
  384. package/subscriptions/pageBuilder/pageElements.d.ts +0 -4
  385. package/subscriptions/pageBuilder/pageElements.js +0 -64
  386. package/subscriptions/pageBuilder/pageElements.js.map +0 -1
  387. package/subscriptions/pageBuilder/pageRevisions.d.ts +0 -6
  388. package/subscriptions/pageBuilder/pageRevisions.js +0 -101
  389. package/subscriptions/pageBuilder/pageRevisions.js.map +0 -1
  390. package/subscriptions/pageBuilder/pages.d.ts +0 -4
  391. package/subscriptions/pageBuilder/pages.js +0 -60
  392. package/subscriptions/pageBuilder/pages.js.map +0 -1
  393. package/subscriptions/pageBuilder/settings.d.ts +0 -2
  394. package/subscriptions/pageBuilder/settings.js +0 -32
  395. package/subscriptions/pageBuilder/settings.js.map +0 -1
  396. package/subscriptions/pageBuilder/templates.d.ts +0 -6
  397. package/subscriptions/pageBuilder/templates.js +0 -96
  398. package/subscriptions/pageBuilder/templates.js.map +0 -1
  399. package/subscriptions/security/apiKeys.d.ts +0 -4
  400. package/subscriptions/security/apiKeys.js +0 -85
  401. package/subscriptions/security/apiKeys.js.map +0 -1
  402. package/subscriptions/security/roles.d.ts +0 -4
  403. package/subscriptions/security/roles.js +0 -64
  404. package/subscriptions/security/roles.js.map +0 -1
  405. package/subscriptions/security/teams.d.ts +0 -4
  406. package/subscriptions/security/teams.js +0 -64
  407. package/subscriptions/security/teams.js.map +0 -1
  408. package/subscriptions/security/users.d.ts +0 -4
  409. package/subscriptions/security/users.js +0 -64
  410. package/subscriptions/security/users.js.map +0 -1
  411. package/utils/compressor.d.ts +0 -11
  412. package/utils/compressor.js +0 -109
  413. package/utils/compressor.js.map +0 -1
@@ -0,0 +1,60 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ export class AccessPatternHandler {
3
+ constructor(params) {
4
+ if (params.patterns.length === 0) {
5
+ throw new WebinyError({
6
+ message: "At least one access pattern must be provided.",
7
+ code: "ACCESS_PATTERN_NOT_PROVIDED"
8
+ });
9
+ }
10
+ this.patterns = params.patterns;
11
+ }
12
+ async handle(params) {
13
+ const pattern = this.find(params);
14
+ if (!pattern) {
15
+ throw new WebinyError({
16
+ message: "No access pattern found for the given parameters.",
17
+ code: "ACCESS_PATTERN_NOT_FOUND",
18
+ data: {
19
+ ...params
20
+ }
21
+ });
22
+ }
23
+ return await pattern.list(params);
24
+ }
25
+ getDefaultPattern() {
26
+ const pattern = this.patterns.find(pattern => {
27
+ return pattern.index === undefined;
28
+ });
29
+ if (!pattern) {
30
+ throw new WebinyError({
31
+ message: "No default access pattern found.",
32
+ code: "DEFAULT_ACCESS_PATTERN_NOT_FOUND"
33
+ });
34
+ }
35
+ return pattern;
36
+ }
37
+ listIndexPatterns() {
38
+ return this.patterns.filter(pattern => {
39
+ return pattern.index !== undefined;
40
+ });
41
+ }
42
+ find(params) {
43
+ /**
44
+ * First we need to go through all the patterns and find the one that can handle the given params.
45
+ */
46
+ for (const pattern of this.patterns) {
47
+ if (pattern.canHandle(params)) {
48
+ return pattern;
49
+ }
50
+ }
51
+ /**
52
+ * If none can handle, let's find one which has index set to undefined (default pattern).
53
+ */
54
+ return this.patterns.find(pattern => {
55
+ return pattern.index === undefined;
56
+ });
57
+ }
58
+ }
59
+
60
+ //# sourceMappingURL=AccessPatternHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WebinyError","AccessPatternHandler","constructor","params","patterns","length","message","code","handle","pattern","find","data","list","getDefaultPattern","index","undefined","listIndexPatterns","filter","canHandle"],"sources":["AccessPatternHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport type {\n IAccessPatternHandler,\n IAccessPatternHandlerHandleResult\n} from \"~/storage/abstractions/AccessPatternHandler.js\";\nimport type { IAccessPattern } from \"~/storage/abstractions/AccessPattern.js\";\n\nexport interface IAccessPatternHandlerParams {\n patterns: IAccessPattern<unknown>[];\n}\n\nexport class AccessPatternHandler implements IAccessPatternHandler {\n private readonly patterns;\n\n public constructor(params: IAccessPatternHandlerParams) {\n if (params.patterns.length === 0) {\n throw new WebinyError({\n message: \"At least one access pattern must be provided.\",\n code: \"ACCESS_PATTERN_NOT_PROVIDED\"\n });\n }\n this.patterns = params.patterns;\n }\n\n public async handle(params: IStorageListParams): Promise<IAccessPatternHandlerHandleResult> {\n const pattern = this.find(params);\n if (!pattern) {\n throw new WebinyError({\n message: \"No access pattern found for the given parameters.\",\n code: \"ACCESS_PATTERN_NOT_FOUND\",\n data: {\n ...params\n }\n });\n }\n\n return await pattern.list(params);\n }\n\n public getDefaultPattern(): IAccessPattern<unknown> {\n const pattern = this.patterns.find(pattern => {\n return pattern.index === undefined;\n });\n if (!pattern) {\n throw new WebinyError({\n message: \"No default access pattern found.\",\n code: \"DEFAULT_ACCESS_PATTERN_NOT_FOUND\"\n });\n }\n return pattern;\n }\n\n public listIndexPatterns(): IAccessPattern<unknown>[] {\n return this.patterns.filter(pattern => {\n return pattern.index !== undefined;\n });\n }\n\n private find(params: IStorageListParams): IAccessPattern<unknown> | undefined {\n /**\n * First we need to go through all the patterns and find the one that can handle the given params.\n */\n for (const pattern of this.patterns) {\n if (pattern.canHandle(params)) {\n return pattern;\n }\n }\n /**\n * If none can handle, let's find one which has index set to undefined (default pattern).\n */\n return this.patterns.find(pattern => {\n return pattern.index === undefined;\n });\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAY3C,OAAO,MAAMC,oBAAoB,CAAkC;EAGxDC,WAAWA,CAACC,MAAmC,EAAE;IACpD,IAAIA,MAAM,CAACC,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;MAC9B,MAAM,IAAIL,WAAW,CAAC;QAClBM,OAAO,EAAE,+CAA+C;QACxDC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;IACA,IAAI,CAACH,QAAQ,GAAGD,MAAM,CAACC,QAAQ;EACnC;EAEA,MAAaI,MAAMA,CAACL,MAA0B,EAA8C;IACxF,MAAMM,OAAO,GAAG,IAAI,CAACC,IAAI,CAACP,MAAM,CAAC;IACjC,IAAI,CAACM,OAAO,EAAE;MACV,MAAM,IAAIT,WAAW,CAAC;QAClBM,OAAO,EAAE,mDAAmD;QAC5DC,IAAI,EAAE,0BAA0B;QAChCI,IAAI,EAAE;UACF,GAAGR;QACP;MACJ,CAAC,CAAC;IACN;IAEA,OAAO,MAAMM,OAAO,CAACG,IAAI,CAACT,MAAM,CAAC;EACrC;EAEOU,iBAAiBA,CAAA,EAA4B;IAChD,MAAMJ,OAAO,GAAG,IAAI,CAACL,QAAQ,CAACM,IAAI,CAACD,OAAO,IAAI;MAC1C,OAAOA,OAAO,CAACK,KAAK,KAAKC,SAAS;IACtC,CAAC,CAAC;IACF,IAAI,CAACN,OAAO,EAAE;MACV,MAAM,IAAIT,WAAW,CAAC;QAClBM,OAAO,EAAE,kCAAkC;QAC3CC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;IACA,OAAOE,OAAO;EAClB;EAEOO,iBAAiBA,CAAA,EAA8B;IAClD,OAAO,IAAI,CAACZ,QAAQ,CAACa,MAAM,CAACR,OAAO,IAAI;MACnC,OAAOA,OAAO,CAACK,KAAK,KAAKC,SAAS;IACtC,CAAC,CAAC;EACN;EAEQL,IAAIA,CAACP,MAA0B,EAAuC;IAC1E;AACR;AACA;IACQ,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACL,QAAQ,EAAE;MACjC,IAAIK,OAAO,CAACS,SAAS,CAACf,MAAM,CAAC,EAAE;QAC3B,OAAOM,OAAO;MAClB;IACJ;IACA;AACR;AACA;IACQ,OAAO,IAAI,CAACL,QAAQ,CAACM,IAAI,CAACD,OAAO,IAAI;MACjC,OAAOA,OAAO,CAACK,KAAK,KAAKC,SAAS;IACtC,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import type { IConverter } from "../storage/abstractions/Converter.js";
2
+ import type { ICompressor } from "@webiny/utils/compression/index.js";
3
+ import type { IAuditLog, IStorageItem } from "../storage/types.js";
4
+ import type { IAccessPatternHandler } from "../storage/abstractions/AccessPatternHandler.js";
5
+ export interface IConverterParams {
6
+ compressor: ICompressor;
7
+ patternHandler: IAccessPatternHandler;
8
+ }
9
+ export declare class Converter implements IConverter {
10
+ private readonly compressor;
11
+ private readonly patternHandler;
12
+ constructor(params: IConverterParams);
13
+ oneFromStorage(item: IStorageItem): Promise<IAuditLog>;
14
+ listFromStorage(items: IStorageItem[]): Promise<IAuditLog[]>;
15
+ oneToStorage(auditLog: IAuditLog): Promise<IStorageItem>;
16
+ }
@@ -0,0 +1,52 @@
1
+ import { convertExpiresAtToUnixTimestamp } from "../utils/expiresAt.js";
2
+ const convertToDateTime = value => {
3
+ return new Date(value);
4
+ };
5
+ export class Converter {
6
+ constructor(params) {
7
+ this.compressor = params.compressor;
8
+ this.patternHandler = params.patternHandler;
9
+ }
10
+ async oneFromStorage(item) {
11
+ return {
12
+ ...item.data,
13
+ expiresAt: convertToDateTime(item.data.expiresAt),
14
+ content: await this.compressor.decompress(JSON.parse(item.data.content)),
15
+ createdOn: new Date(item.data.createdOn)
16
+ };
17
+ }
18
+ async listFromStorage(items) {
19
+ return await Promise.all(items.map(async item => {
20
+ return await this.oneFromStorage(item);
21
+ }));
22
+ }
23
+ async oneToStorage(auditLog) {
24
+ const defaultPattern = this.patternHandler.getDefaultPattern();
25
+ const defaultKeys = defaultPattern.createKeys(auditLog);
26
+ const patterns = this.patternHandler.listIndexPatterns();
27
+ const keys = patterns.reduce((output, pattern) => {
28
+ const patternKeys = pattern.createKeys(auditLog);
29
+ return {
30
+ ...output,
31
+ [`${pattern.index}_PK`]: patternKeys.partitionKey,
32
+ [`${pattern.index}_SK`]: patternKeys.sortKey
33
+ };
34
+ }, {});
35
+ return {
36
+ PK: defaultKeys.partitionKey,
37
+ SK: defaultKeys.sortKey,
38
+ ...keys,
39
+ TYPE: "auditLog.log",
40
+ GSI_TENANT: auditLog.tenant,
41
+ data: {
42
+ ...auditLog,
43
+ expiresAt: auditLog.expiresAt.toISOString(),
44
+ content: JSON.stringify(await this.compressor.compress(auditLog.content)),
45
+ createdOn: auditLog.createdOn.toISOString()
46
+ },
47
+ expiresAt: convertExpiresAtToUnixTimestamp(auditLog.expiresAt)
48
+ };
49
+ }
50
+ }
51
+
52
+ //# sourceMappingURL=Converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertExpiresAtToUnixTimestamp","convertToDateTime","value","Date","Converter","constructor","params","compressor","patternHandler","oneFromStorage","item","data","expiresAt","content","decompress","JSON","parse","createdOn","listFromStorage","items","Promise","all","map","oneToStorage","auditLog","defaultPattern","getDefaultPattern","defaultKeys","createKeys","patterns","listIndexPatterns","keys","reduce","output","pattern","patternKeys","index","partitionKey","sortKey","PK","SK","TYPE","GSI_TENANT","tenant","toISOString","stringify","compress"],"sources":["Converter.ts"],"sourcesContent":["import type { IConverter } from \"~/storage/abstractions/Converter.js\";\nimport type { ICompressor } from \"@webiny/utils/compression/index.js\";\nimport type { IAuditLog, IStorageItem } from \"~/storage/types.js\";\nimport type { IAccessPatternHandler } from \"~/storage/abstractions/AccessPatternHandler.js\";\nimport { convertExpiresAtToUnixTimestamp } from \"~/utils/expiresAt.js\";\n\nconst convertToDateTime = (value: string): Date => {\n return new Date(value);\n};\n\nexport interface IConverterParams {\n compressor: ICompressor;\n patternHandler: IAccessPatternHandler;\n}\n\ntype PickOnlyGSIKeys<T> = {\n [K in keyof T]: K extends `GSI${string}` ? K : never;\n}[keyof T];\n\ntype PickedGSIKeys = Pick<IStorageItem, PickOnlyGSIKeys<IStorageItem>>;\n\nexport class Converter implements IConverter {\n private readonly compressor;\n private readonly patternHandler;\n\n public constructor(params: IConverterParams) {\n this.compressor = params.compressor;\n this.patternHandler = params.patternHandler;\n }\n\n public async oneFromStorage(item: IStorageItem): Promise<IAuditLog> {\n return {\n ...item.data,\n expiresAt: convertToDateTime(item.data.expiresAt),\n content: await this.compressor.decompress(JSON.parse(item.data.content)),\n createdOn: new Date(item.data.createdOn)\n };\n }\n\n public async listFromStorage(items: IStorageItem[]): Promise<IAuditLog[]> {\n return await Promise.all(\n items.map(async item => {\n return await this.oneFromStorage(item);\n })\n );\n }\n\n public async oneToStorage(auditLog: IAuditLog): Promise<IStorageItem> {\n const defaultPattern = this.patternHandler.getDefaultPattern();\n\n const defaultKeys = defaultPattern.createKeys(auditLog);\n\n const patterns = this.patternHandler.listIndexPatterns();\n\n const keys = patterns.reduce<PickedGSIKeys>((output, pattern) => {\n const patternKeys = pattern.createKeys(auditLog);\n return {\n ...output,\n [`${pattern.index}_PK`]: patternKeys.partitionKey,\n [`${pattern.index}_SK`]: patternKeys.sortKey\n };\n }, {} as PickedGSIKeys);\n\n return {\n PK: defaultKeys.partitionKey,\n SK: defaultKeys.sortKey as unknown as string,\n ...keys,\n TYPE: \"auditLog.log\",\n GSI_TENANT: auditLog.tenant,\n data: {\n ...auditLog,\n expiresAt: auditLog.expiresAt.toISOString(),\n content: JSON.stringify(await this.compressor.compress(auditLog.content)),\n createdOn: auditLog.createdOn.toISOString()\n },\n expiresAt: convertExpiresAtToUnixTimestamp(auditLog.expiresAt)\n };\n }\n}\n"],"mappings":"AAIA,SAASA,+BAA+B;AAExC,MAAMC,iBAAiB,GAAIC,KAAa,IAAW;EAC/C,OAAO,IAAIC,IAAI,CAACD,KAAK,CAAC;AAC1B,CAAC;AAaD,OAAO,MAAME,SAAS,CAAuB;EAIlCC,WAAWA,CAACC,MAAwB,EAAE;IACzC,IAAI,CAACC,UAAU,GAAGD,MAAM,CAACC,UAAU;IACnC,IAAI,CAACC,cAAc,GAAGF,MAAM,CAACE,cAAc;EAC/C;EAEA,MAAaC,cAAcA,CAACC,IAAkB,EAAsB;IAChE,OAAO;MACH,GAAGA,IAAI,CAACC,IAAI;MACZC,SAAS,EAAEX,iBAAiB,CAACS,IAAI,CAACC,IAAI,CAACC,SAAS,CAAC;MACjDC,OAAO,EAAE,MAAM,IAAI,CAACN,UAAU,CAACO,UAAU,CAACC,IAAI,CAACC,KAAK,CAACN,IAAI,CAACC,IAAI,CAACE,OAAO,CAAC,CAAC;MACxEI,SAAS,EAAE,IAAId,IAAI,CAACO,IAAI,CAACC,IAAI,CAACM,SAAS;IAC3C,CAAC;EACL;EAEA,MAAaC,eAAeA,CAACC,KAAqB,EAAwB;IACtE,OAAO,MAAMC,OAAO,CAACC,GAAG,CACpBF,KAAK,CAACG,GAAG,CAAC,MAAMZ,IAAI,IAAI;MACpB,OAAO,MAAM,IAAI,CAACD,cAAc,CAACC,IAAI,CAAC;IAC1C,CAAC,CACL,CAAC;EACL;EAEA,MAAaa,YAAYA,CAACC,QAAmB,EAAyB;IAClE,MAAMC,cAAc,GAAG,IAAI,CAACjB,cAAc,CAACkB,iBAAiB,CAAC,CAAC;IAE9D,MAAMC,WAAW,GAAGF,cAAc,CAACG,UAAU,CAACJ,QAAQ,CAAC;IAEvD,MAAMK,QAAQ,GAAG,IAAI,CAACrB,cAAc,CAACsB,iBAAiB,CAAC,CAAC;IAExD,MAAMC,IAAI,GAAGF,QAAQ,CAACG,MAAM,CAAgB,CAACC,MAAM,EAAEC,OAAO,KAAK;MAC7D,MAAMC,WAAW,GAAGD,OAAO,CAACN,UAAU,CAACJ,QAAQ,CAAC;MAChD,OAAO;QACH,GAAGS,MAAM;QACT,CAAC,GAAGC,OAAO,CAACE,KAAK,KAAK,GAAGD,WAAW,CAACE,YAAY;QACjD,CAAC,GAAGH,OAAO,CAACE,KAAK,KAAK,GAAGD,WAAW,CAACG;MACzC,CAAC;IACL,CAAC,EAAE,CAAC,CAAkB,CAAC;IAEvB,OAAO;MACHC,EAAE,EAAEZ,WAAW,CAACU,YAAY;MAC5BG,EAAE,EAAEb,WAAW,CAACW,OAA4B;MAC5C,GAAGP,IAAI;MACPU,IAAI,EAAE,cAAc;MACpBC,UAAU,EAAElB,QAAQ,CAACmB,MAAM;MAC3BhC,IAAI,EAAE;QACF,GAAGa,QAAQ;QACXZ,SAAS,EAAEY,QAAQ,CAACZ,SAAS,CAACgC,WAAW,CAAC,CAAC;QAC3C/B,OAAO,EAAEE,IAAI,CAAC8B,SAAS,CAAC,MAAM,IAAI,CAACtC,UAAU,CAACuC,QAAQ,CAACtB,QAAQ,CAACX,OAAO,CAAC,CAAC;QACzEI,SAAS,EAAEO,QAAQ,CAACP,SAAS,CAAC2B,WAAW,CAAC;MAC9C,CAAC;MACDhC,SAAS,EAAEZ,+BAA+B,CAACwB,QAAQ,CAACZ,SAAS;IACjE,CAAC;EACL;AACJ","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
2
+ import type { IStorage, IStorageFetchParams, IStorageFetchResult, IStorageListParams, IStorageListResult, IStorageStoreParams, IStorageStoreResult } from "../storage/abstractions/Storage.js";
3
+ import type { ICompressor } from "@webiny/utils/compression/index.js";
4
+ export interface IStorageParams {
5
+ compressor: ICompressor;
6
+ client: DynamoDBDocument;
7
+ tableName: string | undefined;
8
+ }
9
+ export declare class Storage implements IStorage {
10
+ private readonly entity;
11
+ private readonly converter;
12
+ private readonly patternHandler;
13
+ constructor(params: IStorageParams);
14
+ fetch(params: IStorageFetchParams): Promise<IStorageFetchResult>;
15
+ store(params: IStorageStoreParams): Promise<IStorageStoreResult>;
16
+ list(params: IStorageListParams): Promise<IStorageListResult>;
17
+ }
18
+ export declare const createStorage: (params: IStorageParams) => IStorage;
@@ -0,0 +1,89 @@
1
+ import { createEntity } from "./entity.js";
2
+ import { Converter } from "./Converter.js";
3
+ import { createAccessPatterns } from "./accessPatterns/index.js";
4
+ import { AccessPatternHandler } from "./AccessPatternHandler.js";
5
+ import { ListSuccessResult } from "./results/index.js";
6
+ export class Storage {
7
+ constructor(params) {
8
+ const {
9
+ entity
10
+ } = createEntity({
11
+ client: params.client,
12
+ tableName: params.tableName,
13
+ gsiAmount: 10
14
+ });
15
+ this.entity = entity;
16
+ const patterns = createAccessPatterns({
17
+ entity
18
+ });
19
+ this.patternHandler = new AccessPatternHandler({
20
+ patterns
21
+ });
22
+ this.converter = new Converter({
23
+ compressor: params.compressor,
24
+ patternHandler: this.patternHandler
25
+ });
26
+ }
27
+ async fetch(params) {
28
+ const {
29
+ id,
30
+ tenant
31
+ } = params;
32
+ try {
33
+ const result = await this.entity.get({
34
+ PK: `T#${tenant}#AUDIT_LOG`,
35
+ SK: `${id}`
36
+ });
37
+ if (!result) {
38
+ return {
39
+ error: new Error(`Audit log entry "${id}" not found.`),
40
+ success: false
41
+ };
42
+ }
43
+ return {
44
+ data: await this.converter.oneFromStorage(result),
45
+ success: true
46
+ };
47
+ } catch (ex) {
48
+ return {
49
+ error: ex,
50
+ success: false
51
+ };
52
+ }
53
+ }
54
+ async store(params) {
55
+ const auditLog = structuredClone(params.data);
56
+ try {
57
+ const item = await this.converter.oneToStorage(auditLog);
58
+ await this.entity.put(item);
59
+ } catch (ex) {
60
+ return {
61
+ error: ex,
62
+ success: false
63
+ };
64
+ }
65
+ return {
66
+ success: true,
67
+ data: auditLog
68
+ };
69
+ }
70
+ async list(params) {
71
+ try {
72
+ const result = await this.patternHandler.handle(params);
73
+ return ListSuccessResult.create({
74
+ data: await this.converter.listFromStorage(result.items),
75
+ lastEvaluatedKey: result.lastEvaluatedKey
76
+ });
77
+ } catch (ex) {
78
+ return {
79
+ error: ex,
80
+ success: false
81
+ };
82
+ }
83
+ }
84
+ }
85
+ export const createStorage = params => {
86
+ return new Storage(params);
87
+ };
88
+
89
+ //# sourceMappingURL=Storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createEntity","Converter","createAccessPatterns","AccessPatternHandler","ListSuccessResult","Storage","constructor","params","entity","client","tableName","gsiAmount","patterns","patternHandler","converter","compressor","fetch","id","tenant","result","get","PK","SK","error","Error","success","data","oneFromStorage","ex","store","auditLog","structuredClone","item","oneToStorage","put","list","handle","create","listFromStorage","items","lastEvaluatedKey","createStorage"],"sources":["Storage.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createEntity } from \"~/storage/entity.js\";\nimport type {\n IStorage,\n IStorageFetchParams,\n IStorageFetchResult,\n IStorageListParams,\n IStorageListResult,\n IStorageStoreParams,\n IStorageStoreResult\n} from \"~/storage/abstractions/Storage.js\";\nimport type { ICompressor } from \"@webiny/utils/compression/index.js\";\nimport { Converter } from \"~/storage/Converter.js\";\nimport { createAccessPatterns } from \"~/storage/accessPatterns/index.js\";\nimport { AccessPatternHandler } from \"~/storage/AccessPatternHandler.js\";\nimport { ListSuccessResult } from \"~/storage/results/index.js\";\n\nexport interface IStorageParams {\n compressor: ICompressor;\n client: DynamoDBDocument;\n tableName: string | undefined;\n}\n\nexport class Storage implements IStorage {\n private readonly entity;\n private readonly converter;\n private readonly patternHandler;\n\n public constructor(params: IStorageParams) {\n const { entity } = createEntity({\n client: params.client,\n tableName: params.tableName,\n gsiAmount: 10\n });\n\n this.entity = entity;\n\n const patterns = createAccessPatterns({\n entity\n });\n this.patternHandler = new AccessPatternHandler({\n patterns\n });\n\n this.converter = new Converter({\n compressor: params.compressor,\n patternHandler: this.patternHandler\n });\n }\n\n public async fetch(params: IStorageFetchParams): Promise<IStorageFetchResult> {\n const { id, tenant } = params;\n\n try {\n const result = await this.entity.get({\n PK: `T#${tenant}#AUDIT_LOG`,\n SK: `${id}`\n });\n if (!result) {\n return {\n error: new Error(`Audit log entry \"${id}\" not found.`),\n success: false\n };\n }\n return {\n data: await this.converter.oneFromStorage(result),\n success: true\n };\n } catch (ex) {\n return {\n error: ex,\n success: false\n };\n }\n }\n\n public async store(params: IStorageStoreParams): Promise<IStorageStoreResult> {\n const auditLog = structuredClone(params.data);\n\n try {\n const item = await this.converter.oneToStorage(auditLog);\n await this.entity.put(item);\n } catch (ex) {\n return {\n error: ex,\n success: false\n };\n }\n\n return {\n success: true,\n data: auditLog\n };\n }\n\n public async list(params: IStorageListParams): Promise<IStorageListResult> {\n try {\n const result = await this.patternHandler.handle(params);\n\n return ListSuccessResult.create({\n data: await this.converter.listFromStorage(result.items),\n lastEvaluatedKey: result.lastEvaluatedKey\n });\n } catch (ex) {\n return {\n error: ex,\n success: false\n };\n }\n }\n}\n\nexport const createStorage = (params: IStorageParams): IStorage => {\n return new Storage(params);\n};\n"],"mappings":"AACA,SAASA,YAAY;AAWrB,SAASC,SAAS;AAClB,SAASC,oBAAoB;AAC7B,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAQ1B,OAAO,MAAMC,OAAO,CAAqB;EAK9BC,WAAWA,CAACC,MAAsB,EAAE;IACvC,MAAM;MAAEC;IAAO,CAAC,GAAGR,YAAY,CAAC;MAC5BS,MAAM,EAAEF,MAAM,CAACE,MAAM;MACrBC,SAAS,EAAEH,MAAM,CAACG,SAAS;MAC3BC,SAAS,EAAE;IACf,CAAC,CAAC;IAEF,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,MAAMI,QAAQ,GAAGV,oBAAoB,CAAC;MAClCM;IACJ,CAAC,CAAC;IACF,IAAI,CAACK,cAAc,GAAG,IAAIV,oBAAoB,CAAC;MAC3CS;IACJ,CAAC,CAAC;IAEF,IAAI,CAACE,SAAS,GAAG,IAAIb,SAAS,CAAC;MAC3Bc,UAAU,EAAER,MAAM,CAACQ,UAAU;MAC7BF,cAAc,EAAE,IAAI,CAACA;IACzB,CAAC,CAAC;EACN;EAEA,MAAaG,KAAKA,CAACT,MAA2B,EAAgC;IAC1E,MAAM;MAAEU,EAAE;MAAEC;IAAO,CAAC,GAAGX,MAAM;IAE7B,IAAI;MACA,MAAMY,MAAM,GAAG,MAAM,IAAI,CAACX,MAAM,CAACY,GAAG,CAAC;QACjCC,EAAE,EAAE,KAAKH,MAAM,YAAY;QAC3BI,EAAE,EAAE,GAAGL,EAAE;MACb,CAAC,CAAC;MACF,IAAI,CAACE,MAAM,EAAE;QACT,OAAO;UACHI,KAAK,EAAE,IAAIC,KAAK,CAAC,oBAAoBP,EAAE,cAAc,CAAC;UACtDQ,OAAO,EAAE;QACb,CAAC;MACL;MACA,OAAO;QACHC,IAAI,EAAE,MAAM,IAAI,CAACZ,SAAS,CAACa,cAAc,CAACR,MAAM,CAAC;QACjDM,OAAO,EAAE;MACb,CAAC;IACL,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,OAAO;QACHL,KAAK,EAAEK,EAAE;QACTH,OAAO,EAAE;MACb,CAAC;IACL;EACJ;EAEA,MAAaI,KAAKA,CAACtB,MAA2B,EAAgC;IAC1E,MAAMuB,QAAQ,GAAGC,eAAe,CAACxB,MAAM,CAACmB,IAAI,CAAC;IAE7C,IAAI;MACA,MAAMM,IAAI,GAAG,MAAM,IAAI,CAAClB,SAAS,CAACmB,YAAY,CAACH,QAAQ,CAAC;MACxD,MAAM,IAAI,CAACtB,MAAM,CAAC0B,GAAG,CAACF,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAOJ,EAAE,EAAE;MACT,OAAO;QACHL,KAAK,EAAEK,EAAE;QACTH,OAAO,EAAE;MACb,CAAC;IACL;IAEA,OAAO;MACHA,OAAO,EAAE,IAAI;MACbC,IAAI,EAAEI;IACV,CAAC;EACL;EAEA,MAAaK,IAAIA,CAAC5B,MAA0B,EAA+B;IACvE,IAAI;MACA,MAAMY,MAAM,GAAG,MAAM,IAAI,CAACN,cAAc,CAACuB,MAAM,CAAC7B,MAAM,CAAC;MAEvD,OAAOH,iBAAiB,CAACiC,MAAM,CAAC;QAC5BX,IAAI,EAAE,MAAM,IAAI,CAACZ,SAAS,CAACwB,eAAe,CAACnB,MAAM,CAACoB,KAAK,CAAC;QACxDC,gBAAgB,EAAErB,MAAM,CAACqB;MAC7B,CAAC,CAAC;IACN,CAAC,CAAC,OAAOZ,EAAE,EAAE;MACT,OAAO;QACHL,KAAK,EAAEK,EAAE;QACTH,OAAO,EAAE;MACb,CAAC;IACL;EACJ;AACJ;AAEA,OAAO,MAAMgB,aAAa,GAAIlC,MAAsB,IAAe;EAC/D,OAAO,IAAIF,OAAO,CAACE,MAAM,CAAC;AAC9B,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ import type { IAuditLog, IStorageItem } from "../../storage/types.js";
2
+ import type { IStorageListParams } from "./Storage.js";
3
+ import type { GenericRecord } from "@webiny/api/types.js";
4
+ export interface IAccessPatternCreateKeysResult {
5
+ partitionKey: string;
6
+ sortKey: string | number;
7
+ }
8
+ export interface IAccessPatternListResult {
9
+ items: IStorageItem[];
10
+ lastEvaluatedKey?: GenericRecord;
11
+ }
12
+ export type IAccessPatternHandlesKeys = keyof IStorageListParams;
13
+ export interface IAccessPatternHandles {
14
+ shouldInclude?: IAccessPatternHandlesKeys[];
15
+ mustInclude: IAccessPatternHandlesKeys[];
16
+ mustNotInclude: IAccessPatternHandlesKeys[];
17
+ }
18
+ export interface IAccessPattern<T> {
19
+ index: string | undefined;
20
+ handles(): IAccessPatternHandles;
21
+ canHandle(params: IStorageListParams): boolean;
22
+ list(params: T): Promise<IAccessPatternListResult>;
23
+ createKeys(item: IAuditLog): IAccessPatternCreateKeysResult;
24
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=AccessPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["AccessPattern.ts"],"sourcesContent":["import type { IAuditLog, IStorageItem } from \"~/storage/types.js\";\nimport type { IStorageListParams } from \"./Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface IAccessPatternCreateKeysResult {\n partitionKey: string;\n sortKey: string | number;\n}\n\nexport interface IAccessPatternListResult {\n items: IStorageItem[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport type IAccessPatternHandlesKeys = keyof IStorageListParams;\n\nexport interface IAccessPatternHandles {\n shouldInclude?: IAccessPatternHandlesKeys[];\n mustInclude: IAccessPatternHandlesKeys[];\n mustNotInclude: IAccessPatternHandlesKeys[];\n}\n\nexport interface IAccessPattern<T> {\n index: string | undefined;\n handles(): IAccessPatternHandles;\n canHandle(params: IStorageListParams): boolean;\n list(params: T): Promise<IAccessPatternListResult>;\n createKeys(item: IAuditLog): IAccessPatternCreateKeysResult;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { GenericRecord } from "@webiny/api/types.js";
2
+ import type { IStorageItem } from "../types.js";
3
+ import type { IAccessPattern } from "./AccessPattern.js";
4
+ import type { IStorageListParams } from "./Storage.js";
5
+ export interface IAccessPatternHandlerHandleResult {
6
+ items: IStorageItem[];
7
+ lastEvaluatedKey?: GenericRecord;
8
+ }
9
+ export interface IAccessPatternHandler {
10
+ handle(params: IStorageListParams): Promise<IAccessPatternHandlerHandleResult>;
11
+ getDefaultPattern(): IAccessPattern<unknown>;
12
+ listIndexPatterns(): IAccessPattern<unknown>[];
13
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=AccessPatternHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["AccessPatternHandler.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStorageItem } from \"../types.js\";\nimport type { IAccessPattern } from \"./AccessPattern.js\";\nimport type { IStorageListParams } from \"./Storage.js\";\n\nexport interface IAccessPatternHandlerHandleResult {\n items: IStorageItem[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport interface IAccessPatternHandler {\n handle(params: IStorageListParams): Promise<IAccessPatternHandlerHandleResult>;\n getDefaultPattern(): IAccessPattern<unknown>;\n listIndexPatterns(): IAccessPattern<unknown>[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { IAuditLog, IStorageItem } from "../../storage/types.js";
2
+ export interface IConverter {
3
+ oneFromStorage(item: IStorageItem): Promise<IAuditLog>;
4
+ listFromStorage(items: IStorageItem[]): Promise<IAuditLog[]>;
5
+ oneToStorage(auditLog: IAuditLog): Promise<IStorageItem>;
6
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=Converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Converter.ts"],"sourcesContent":["import type { IAuditLog, IStorageItem } from \"~/storage/types.js\";\n\nexport interface IConverter {\n oneFromStorage(item: IStorageItem): Promise<IAuditLog>;\n listFromStorage(items: IStorageItem[]): Promise<IAuditLog[]>;\n oneToStorage(auditLog: IAuditLog): Promise<IStorageItem>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,108 @@
1
+ import type { IAuditLog } from "../../storage/types.js";
2
+ export interface IStorageFetchParams {
3
+ id: string;
4
+ tenant: string;
5
+ }
6
+ export interface IStorageFetchErrorResult {
7
+ error: Error;
8
+ data?: never;
9
+ success: false;
10
+ }
11
+ export interface IStorageFetchSuccessResult {
12
+ data: IAuditLog;
13
+ success: true;
14
+ error?: never;
15
+ }
16
+ export type IStorageFetchResult = IStorageFetchErrorResult | IStorageFetchSuccessResult;
17
+ export interface IStorageStoreParams {
18
+ data: IAuditLog;
19
+ }
20
+ export interface IStorageStoreErrorResult {
21
+ error: Error;
22
+ data?: never;
23
+ success: false;
24
+ }
25
+ export interface IStorageStoreSuccessResult {
26
+ data: IAuditLog;
27
+ success: true;
28
+ error?: never;
29
+ }
30
+ export type IStorageStoreResult = IStorageStoreErrorResult | IStorageStoreSuccessResult;
31
+ export interface IStorageListDefaultParams {
32
+ tenant: string;
33
+ sort?: "ASC" | "DESC";
34
+ after?: string;
35
+ limit: number | undefined;
36
+ app?: never;
37
+ createdBy?: never;
38
+ action?: never;
39
+ entityId?: never;
40
+ }
41
+ export interface IStorageListByAppParams {
42
+ tenant: string;
43
+ app: string;
44
+ after?: string;
45
+ sort?: "ASC" | "DESC";
46
+ createdOn_gte?: Date;
47
+ createdOn_lte?: Date;
48
+ limit: number | undefined;
49
+ entity?: never;
50
+ createdBy?: never;
51
+ action?: never;
52
+ entityId?: never;
53
+ }
54
+ export interface IStorageListByAppCreatedByParams extends Omit<IStorageListByAppParams, "createdBy"> {
55
+ createdBy: string;
56
+ }
57
+ export interface IStorageListByAppEntityParams extends Omit<IStorageListByAppParams, "entity"> {
58
+ entity: string;
59
+ }
60
+ export interface IStorageListByEntityIdParams extends Omit<IStorageListByAppParams, "entityId"> {
61
+ entityId: string;
62
+ }
63
+ export interface IStorageListByActionParams extends Omit<IStorageListByAppParams, "action"> {
64
+ action: string;
65
+ }
66
+ export interface IStorageListByAppEntityActionCreatedByParams extends Omit<IStorageListByAppParams, "action" | "entity" | "createdBy"> {
67
+ createdBy: string;
68
+ entity: string;
69
+ action: string;
70
+ }
71
+ export interface IStorageListByAppEntityActionParams extends Omit<IStorageListByAppParams, "entity" | "action"> {
72
+ entity: string;
73
+ action: string;
74
+ }
75
+ export interface IStorageListByAppEntityCreatedByParams extends Omit<IStorageListByAppParams, "createdBy" | "entity"> {
76
+ createdBy: string;
77
+ entity: string;
78
+ }
79
+ export interface IStorageListByCreatedByParams extends Omit<IStorageListByAppParams, "createdBy"> {
80
+ createdBy: string;
81
+ }
82
+ export interface IStorageListByCreatedOnParams extends IStorageListByAppParams {
83
+ createdOn_gte?: Date;
84
+ createdOn_lte?: Date;
85
+ }
86
+ export type IStorageListParams = IStorageListByAppParams | IStorageListByAppCreatedByParams | IStorageListByAppEntityParams | IStorageListByEntityIdParams | IStorageListByActionParams | IStorageListByAppEntityActionCreatedByParams | IStorageListByAppEntityActionParams | IStorageListByAppEntityCreatedByParams | IStorageListByCreatedByParams | IStorageListByCreatedOnParams;
87
+ export interface IStorageListSuccessResultMeta {
88
+ after?: string;
89
+ hasMoreItems: boolean;
90
+ }
91
+ export interface IStorageListSuccessResult {
92
+ data: IAuditLog[];
93
+ meta: IStorageListSuccessResultMeta;
94
+ success: true;
95
+ error?: never;
96
+ }
97
+ export interface IStorageListErrorResult {
98
+ error: Error;
99
+ data?: never;
100
+ meta?: never;
101
+ success: false;
102
+ }
103
+ export type IStorageListResult = IStorageListErrorResult | IStorageListSuccessResult;
104
+ export interface IStorage {
105
+ fetch(params: IStorageFetchParams): Promise<IStorageFetchResult>;
106
+ store(params: IStorageStoreParams): Promise<IStorageStoreResult>;
107
+ list(params: IStorageListParams): Promise<IStorageListResult>;
108
+ }
@@ -0,0 +1,3 @@
1
+ export {};
2
+
3
+ //# sourceMappingURL=Storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Storage.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\n\nexport interface IStorageFetchParams {\n id: string;\n tenant: string;\n}\n\nexport interface IStorageFetchErrorResult {\n error: Error;\n data?: never;\n success: false;\n}\n\nexport interface IStorageFetchSuccessResult {\n data: IAuditLog;\n success: true;\n error?: never;\n}\n\nexport type IStorageFetchResult = IStorageFetchErrorResult | IStorageFetchSuccessResult;\n\nexport interface IStorageStoreParams {\n data: IAuditLog;\n}\n\nexport interface IStorageStoreErrorResult {\n error: Error;\n data?: never;\n success: false;\n}\n\nexport interface IStorageStoreSuccessResult {\n data: IAuditLog;\n success: true;\n error?: never;\n}\n\nexport type IStorageStoreResult = IStorageStoreErrorResult | IStorageStoreSuccessResult;\n\n// PK / SK\nexport interface IStorageListDefaultParams {\n tenant: string;\n sort?: \"ASC\" | \"DESC\";\n after?: string;\n limit: number | undefined;\n\n app?: never;\n createdBy?: never;\n action?: never;\n entityId?: never;\n}\n\n// GSI1_PK / GSI1_SK\nexport interface IStorageListByAppParams {\n tenant: string;\n app: string;\n after?: string;\n sort?: \"ASC\" | \"DESC\";\n createdOn_gte?: Date;\n createdOn_lte?: Date;\n limit: number | undefined;\n\n entity?: never;\n createdBy?: never;\n action?: never;\n entityId?: never;\n}\n\n// GSI2_PK / GSI2_SK\nexport interface IStorageListByAppCreatedByParams\n extends Omit<IStorageListByAppParams, \"createdBy\"> {\n createdBy: string;\n}\n\n// GSI3_PK / GSI3_SK\nexport interface IStorageListByAppEntityParams extends Omit<IStorageListByAppParams, \"entity\"> {\n entity: string;\n}\n// GSI4_PK / GSI4_SK\nexport interface IStorageListByEntityIdParams extends Omit<IStorageListByAppParams, \"entityId\"> {\n entityId: string;\n}\n// GSI5_PK / GSI5_SK\nexport interface IStorageListByActionParams extends Omit<IStorageListByAppParams, \"action\"> {\n action: string;\n}\n\n// GSI6_PK / GSI6_SK\nexport interface IStorageListByAppEntityActionCreatedByParams\n extends Omit<IStorageListByAppParams, \"action\" | \"entity\" | \"createdBy\"> {\n createdBy: string;\n entity: string;\n action: string;\n}\n// GSI7_PK / GSI7_SK\nexport interface IStorageListByAppEntityActionParams\n extends Omit<IStorageListByAppParams, \"entity\" | \"action\"> {\n entity: string;\n action: string;\n}\n// GSI8_PK / GSI8_SK\nexport interface IStorageListByAppEntityCreatedByParams\n extends Omit<IStorageListByAppParams, \"createdBy\" | \"entity\"> {\n createdBy: string;\n entity: string;\n}\n\n// GSI9_PK / GSI9_SK\nexport interface IStorageListByCreatedByParams extends Omit<IStorageListByAppParams, \"createdBy\"> {\n createdBy: string;\n}\n\n// GSI10_PK / GSI10_SK\nexport interface IStorageListByCreatedOnParams extends IStorageListByAppParams {\n createdOn_gte?: Date;\n createdOn_lte?: Date;\n}\n\nexport type IStorageListParams =\n | IStorageListByAppParams\n | IStorageListByAppCreatedByParams\n | IStorageListByAppEntityParams\n | IStorageListByEntityIdParams\n | IStorageListByActionParams\n | IStorageListByAppEntityActionCreatedByParams\n | IStorageListByAppEntityActionParams\n | IStorageListByAppEntityCreatedByParams\n | IStorageListByCreatedByParams\n | IStorageListByCreatedOnParams;\n\nexport interface IStorageListSuccessResultMeta {\n after?: string;\n hasMoreItems: boolean;\n}\n\nexport interface IStorageListSuccessResult {\n data: IAuditLog[];\n meta: IStorageListSuccessResultMeta;\n success: true;\n error?: never;\n}\n\nexport interface IStorageListErrorResult {\n error: Error;\n data?: never;\n meta?: never;\n success: false;\n}\n\nexport type IStorageListResult = IStorageListErrorResult | IStorageListSuccessResult;\n\nexport interface IStorage {\n fetch(params: IStorageFetchParams): Promise<IStorageFetchResult>;\n store(params: IStorageStoreParams): Promise<IStorageStoreResult>;\n list(params: IStorageListParams): Promise<IStorageListResult>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { IAuditLog } from "../../storage/types.js";
2
+ import type { IStorageListByAppParams } from "../../storage/abstractions/Storage.js";
3
+ import { BaseAccessPattern } from "../../storage/accessPatterns/BaseAccessPattern.js";
4
+ import type { IAccessPatternCreateKeysResult, IAccessPatternHandles, IAccessPatternListResult } from "../../storage/abstractions/AccessPattern.js";
5
+ export declare class AppAccessPattern<T extends IStorageListByAppParams = IStorageListByAppParams> extends BaseAccessPattern<T> {
6
+ handles(): IAccessPatternHandles;
7
+ list(params: T): Promise<IAccessPatternListResult>;
8
+ createKeys(item: IAuditLog): IAccessPatternCreateKeysResult;
9
+ }
@@ -0,0 +1,29 @@
1
+ import { BaseAccessPattern } from "./BaseAccessPattern.js";
2
+ const createPartitionKey = params => {
3
+ return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}`;
4
+ };
5
+ export class AppAccessPattern extends BaseAccessPattern {
6
+ handles() {
7
+ return {
8
+ mustInclude: ["app"],
9
+ mustNotInclude: ["createdBy", "action", "entityId", "entity"]
10
+ };
11
+ }
12
+ async list(params) {
13
+ const options = this.createOptions(params);
14
+ const result = await this.query({
15
+ partitionKey: createPartitionKey(params),
16
+ options
17
+ });
18
+ return this.populateResult(result);
19
+ }
20
+ createKeys(item) {
21
+ const time = item.createdOn.getTime();
22
+ return {
23
+ partitionKey: createPartitionKey(item),
24
+ sortKey: time
25
+ };
26
+ }
27
+ }
28
+
29
+ //# sourceMappingURL=AppAccessPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseAccessPattern","createPartitionKey","params","tenant","app","AppAccessPattern","handles","mustInclude","mustNotInclude","list","options","createOptions","result","query","partitionKey","populateResult","createKeys","item","time","createdOn","getTime","sortKey"],"sources":["AppAccessPattern.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListByAppParams } from \"~/storage/abstractions/Storage.js\";\nimport { BaseAccessPattern } from \"~/storage/accessPatterns/BaseAccessPattern.js\";\nimport type {\n IAccessPatternCreateKeysResult,\n IAccessPatternHandles,\n IAccessPatternListResult\n} from \"~/storage/abstractions/AccessPattern.js\";\n\ninterface ICreatePartitionKeyParams {\n tenant: string;\n app: string;\n}\n\nconst createPartitionKey = (params: ICreatePartitionKeyParams) => {\n return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}`;\n};\n\nexport class AppAccessPattern<\n T extends IStorageListByAppParams = IStorageListByAppParams\n> extends BaseAccessPattern<T> {\n public override handles(): IAccessPatternHandles {\n return {\n mustInclude: [\"app\"],\n mustNotInclude: [\"createdBy\", \"action\", \"entityId\", \"entity\"]\n };\n }\n\n public async list(params: T): Promise<IAccessPatternListResult> {\n const options = this.createOptions(params);\n\n const result = await this.query({\n partitionKey: createPartitionKey(params),\n options\n });\n return this.populateResult(result);\n }\n\n public createKeys(item: IAuditLog): IAccessPatternCreateKeysResult {\n const time = item.createdOn.getTime();\n return {\n partitionKey: createPartitionKey(item),\n sortKey: time\n };\n }\n}\n"],"mappings":"AAEA,SAASA,iBAAiB;AAY1B,MAAMC,kBAAkB,GAAIC,MAAiC,IAAK;EAC9D,OAAO,KAAKA,MAAM,CAACC,MAAM,kBAAkBD,MAAM,CAACE,GAAG,EAAE;AAC3D,CAAC;AAED,OAAO,MAAMC,gBAAgB,SAEnBL,iBAAiB,CAAI;EACXM,OAAOA,CAAA,EAA0B;IAC7C,OAAO;MACHC,WAAW,EAAE,CAAC,KAAK,CAAC;MACpBC,cAAc,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ;IAChE,CAAC;EACL;EAEA,MAAaC,IAAIA,CAACP,MAAS,EAAqC;IAC5D,MAAMQ,OAAO,GAAG,IAAI,CAACC,aAAa,CAACT,MAAM,CAAC;IAE1C,MAAMU,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAAC;MAC5BC,YAAY,EAAEb,kBAAkB,CAACC,MAAM,CAAC;MACxCQ;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,CAACK,cAAc,CAACH,MAAM,CAAC;EACtC;EAEOI,UAAUA,CAACC,IAAe,EAAkC;IAC/D,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAACC,OAAO,CAAC,CAAC;IACrC,OAAO;MACHN,YAAY,EAAEb,kBAAkB,CAACgB,IAAI,CAAC;MACtCI,OAAO,EAAEH;IACb,CAAC;EACL;AACJ","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { IAuditLog } from "../../storage/types.js";
2
+ import { BaseAccessPattern } from "../../storage/accessPatterns/BaseAccessPattern.js";
3
+ import type { IAccessPatternCreateKeysResult, IAccessPatternHandles, IAccessPatternListResult } from "../../storage/abstractions/AccessPattern.js";
4
+ import type { IStorageListByAppCreatedByParams } from "../../storage/abstractions/Storage.js";
5
+ export declare class AppCreatedByAccessPattern<T extends IStorageListByAppCreatedByParams = IStorageListByAppCreatedByParams> extends BaseAccessPattern<T> {
6
+ handles(): IAccessPatternHandles;
7
+ list(params: T): Promise<IAccessPatternListResult>;
8
+ createKeys(item: IAuditLog): IAccessPatternCreateKeysResult;
9
+ }
@@ -0,0 +1,32 @@
1
+ import { BaseAccessPattern } from "./BaseAccessPattern.js";
2
+ const createPartitionKey = params => {
3
+ return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}#CREATEDBY#${params.createdBy}`;
4
+ };
5
+ export class AppCreatedByAccessPattern extends BaseAccessPattern {
6
+ handles() {
7
+ return {
8
+ mustInclude: ["app", "createdBy"],
9
+ mustNotInclude: ["action", "entityId", "entity"]
10
+ };
11
+ }
12
+ async list(params) {
13
+ const options = this.createOptions(params);
14
+ const result = await this.query({
15
+ partitionKey: createPartitionKey(params),
16
+ options
17
+ });
18
+ return this.populateResult(result);
19
+ }
20
+ createKeys(item) {
21
+ const time = item.createdOn.getTime();
22
+ return {
23
+ partitionKey: createPartitionKey({
24
+ ...item,
25
+ createdBy: item.createdBy.id
26
+ }),
27
+ sortKey: time
28
+ };
29
+ }
30
+ }
31
+
32
+ //# sourceMappingURL=AppCreatedByAccessPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseAccessPattern","createPartitionKey","params","tenant","app","createdBy","AppCreatedByAccessPattern","handles","mustInclude","mustNotInclude","list","options","createOptions","result","query","partitionKey","populateResult","createKeys","item","time","createdOn","getTime","id","sortKey"],"sources":["AppCreatedByAccessPattern.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\nimport { BaseAccessPattern } from \"~/storage/accessPatterns/BaseAccessPattern.js\";\nimport type {\n IAccessPatternCreateKeysResult,\n IAccessPatternHandles,\n IAccessPatternListResult\n} from \"~/storage/abstractions/AccessPattern.js\";\nimport type { IStorageListByAppCreatedByParams } from \"~/storage/abstractions/Storage.js\";\n\ninterface ICreatePartitionKeyParams {\n tenant: string;\n app: string;\n createdBy: string;\n}\n\nconst createPartitionKey = (params: ICreatePartitionKeyParams) => {\n return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}#CREATEDBY#${params.createdBy}`;\n};\n\nexport class AppCreatedByAccessPattern<\n T extends IStorageListByAppCreatedByParams = IStorageListByAppCreatedByParams\n> extends BaseAccessPattern<T> {\n public override handles(): IAccessPatternHandles {\n return {\n mustInclude: [\"app\", \"createdBy\"],\n mustNotInclude: [\"action\", \"entityId\", \"entity\"]\n };\n }\n\n public async list(params: T): Promise<IAccessPatternListResult> {\n const options = this.createOptions(params);\n\n const result = await this.query({\n partitionKey: createPartitionKey(params),\n options\n });\n return this.populateResult(result);\n }\n\n public createKeys(item: IAuditLog): IAccessPatternCreateKeysResult {\n const time = item.createdOn.getTime();\n\n return {\n partitionKey: createPartitionKey({\n ...item,\n createdBy: item.createdBy.id\n }),\n sortKey: time\n };\n }\n}\n"],"mappings":"AACA,SAASA,iBAAiB;AAc1B,MAAMC,kBAAkB,GAAIC,MAAiC,IAAK;EAC9D,OAAO,KAAKA,MAAM,CAACC,MAAM,kBAAkBD,MAAM,CAACE,GAAG,cAAcF,MAAM,CAACG,SAAS,EAAE;AACzF,CAAC;AAED,OAAO,MAAMC,yBAAyB,SAE5BN,iBAAiB,CAAI;EACXO,OAAOA,CAAA,EAA0B;IAC7C,OAAO;MACHC,WAAW,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC;MACjCC,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ;IACnD,CAAC;EACL;EAEA,MAAaC,IAAIA,CAACR,MAAS,EAAqC;IAC5D,MAAMS,OAAO,GAAG,IAAI,CAACC,aAAa,CAACV,MAAM,CAAC;IAE1C,MAAMW,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAAC;MAC5BC,YAAY,EAAEd,kBAAkB,CAACC,MAAM,CAAC;MACxCS;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,CAACK,cAAc,CAACH,MAAM,CAAC;EACtC;EAEOI,UAAUA,CAACC,IAAe,EAAkC;IAC/D,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAACC,OAAO,CAAC,CAAC;IAErC,OAAO;MACHN,YAAY,EAAEd,kBAAkB,CAAC;QAC7B,GAAGiB,IAAI;QACPb,SAAS,EAAEa,IAAI,CAACb,SAAS,CAACiB;MAC9B,CAAC,CAAC;MACFC,OAAO,EAAEJ;IACb,CAAC;EACL;AACJ","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { IAuditLog } from "../../storage/types.js";
2
+ import type { IStorageListByAppEntityParams } from "../../storage/abstractions/Storage.js";
3
+ import { BaseAccessPattern } from "../../storage/accessPatterns/BaseAccessPattern.js";
4
+ import type { IAccessPatternCreateKeysResult, IAccessPatternHandles, IAccessPatternListResult } from "../../storage/abstractions/AccessPattern.js";
5
+ export declare class AppEntityAccessPattern<T extends IStorageListByAppEntityParams = IStorageListByAppEntityParams> extends BaseAccessPattern<T> {
6
+ handles(): IAccessPatternHandles;
7
+ list(params: T): Promise<IAccessPatternListResult>;
8
+ createKeys(item: IAuditLog): IAccessPatternCreateKeysResult;
9
+ }
@@ -0,0 +1,29 @@
1
+ import { BaseAccessPattern } from "./BaseAccessPattern.js";
2
+ const createPartitionKey = params => {
3
+ return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}#ENTITY#${params.entity}`;
4
+ };
5
+ export class AppEntityAccessPattern extends BaseAccessPattern {
6
+ handles() {
7
+ return {
8
+ mustInclude: ["app", "entity"],
9
+ mustNotInclude: ["createdBy", "action", "entityId"]
10
+ };
11
+ }
12
+ async list(params) {
13
+ const options = this.createOptions(params);
14
+ const result = await this.query({
15
+ partitionKey: createPartitionKey(params),
16
+ options
17
+ });
18
+ return this.populateResult(result);
19
+ }
20
+ createKeys(item) {
21
+ const time = item.createdOn.getTime();
22
+ return {
23
+ partitionKey: createPartitionKey(item),
24
+ sortKey: time
25
+ };
26
+ }
27
+ }
28
+
29
+ //# sourceMappingURL=AppEntityAccessPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseAccessPattern","createPartitionKey","params","tenant","app","entity","AppEntityAccessPattern","handles","mustInclude","mustNotInclude","list","options","createOptions","result","query","partitionKey","populateResult","createKeys","item","time","createdOn","getTime","sortKey"],"sources":["AppEntityAccessPattern.ts"],"sourcesContent":["import type { IAuditLog } from \"~/storage/types.js\";\nimport type { IStorageListByAppEntityParams } from \"~/storage/abstractions/Storage.js\";\nimport { BaseAccessPattern } from \"~/storage/accessPatterns/BaseAccessPattern.js\";\nimport type {\n IAccessPatternCreateKeysResult,\n IAccessPatternHandles,\n IAccessPatternListResult\n} from \"~/storage/abstractions/AccessPattern.js\";\n\ninterface ICreatePartitionKeyParams {\n tenant: string;\n app: string;\n entity: string;\n}\n\nconst createPartitionKey = (params: ICreatePartitionKeyParams) => {\n return `T#${params.tenant}#AUDIT_LOG#APP#${params.app}#ENTITY#${params.entity}`;\n};\nexport class AppEntityAccessPattern<\n T extends IStorageListByAppEntityParams = IStorageListByAppEntityParams\n> extends BaseAccessPattern<T> {\n public override handles(): IAccessPatternHandles {\n return {\n mustInclude: [\"app\", \"entity\"],\n mustNotInclude: [\"createdBy\", \"action\", \"entityId\"]\n };\n }\n\n public async list(params: T): Promise<IAccessPatternListResult> {\n const options = this.createOptions(params);\n\n const result = await this.query({\n partitionKey: createPartitionKey(params),\n options\n });\n return this.populateResult(result);\n }\n\n public createKeys(item: IAuditLog): IAccessPatternCreateKeysResult {\n const time = item.createdOn.getTime();\n\n return {\n partitionKey: createPartitionKey(item),\n sortKey: time\n };\n }\n}\n"],"mappings":"AAEA,SAASA,iBAAiB;AAa1B,MAAMC,kBAAkB,GAAIC,MAAiC,IAAK;EAC9D,OAAO,KAAKA,MAAM,CAACC,MAAM,kBAAkBD,MAAM,CAACE,GAAG,WAAWF,MAAM,CAACG,MAAM,EAAE;AACnF,CAAC;AACD,OAAO,MAAMC,sBAAsB,SAEzBN,iBAAiB,CAAI;EACXO,OAAOA,CAAA,EAA0B;IAC7C,OAAO;MACHC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;MAC9BC,cAAc,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU;IACtD,CAAC;EACL;EAEA,MAAaC,IAAIA,CAACR,MAAS,EAAqC;IAC5D,MAAMS,OAAO,GAAG,IAAI,CAACC,aAAa,CAACV,MAAM,CAAC;IAE1C,MAAMW,MAAM,GAAG,MAAM,IAAI,CAACC,KAAK,CAAC;MAC5BC,YAAY,EAAEd,kBAAkB,CAACC,MAAM,CAAC;MACxCS;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,CAACK,cAAc,CAACH,MAAM,CAAC;EACtC;EAEOI,UAAUA,CAACC,IAAe,EAAkC;IAC/D,MAAMC,IAAI,GAAGD,IAAI,CAACE,SAAS,CAACC,OAAO,CAAC,CAAC;IAErC,OAAO;MACHN,YAAY,EAAEd,kBAAkB,CAACiB,IAAI,CAAC;MACtCI,OAAO,EAAEH;IACb,CAAC;EACL;AACJ","ignoreList":[]}