@webiny/api-audit-logs 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9

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 (250) hide show
  1. package/abstractions.js +2 -3
  2. package/abstractions.js.map +1 -1
  3. package/config.js +2 -1
  4. package/config.js.map +1 -1
  5. package/context/AuditLogsContextValue.d.ts +1 -1
  6. package/context/AuditLogsContextValue.js +115 -125
  7. package/context/AuditLogsContextValue.js.map +1 -1
  8. package/context/index.js +23 -27
  9. package/context/index.js.map +1 -1
  10. package/events/AuditLogAfterCreateEvent.d.ts +2 -2
  11. package/events/AuditLogAfterCreateEvent.js +9 -6
  12. package/events/AuditLogAfterCreateEvent.js.map +1 -1
  13. package/events/AuditLogAfterUpdateEvent.d.ts +2 -2
  14. package/events/AuditLogAfterUpdateEvent.js +9 -6
  15. package/events/AuditLogAfterUpdateEvent.js.map +1 -1
  16. package/events/AuditLogBeforeCreateEvent.d.ts +2 -2
  17. package/events/AuditLogBeforeCreateEvent.js +9 -6
  18. package/events/AuditLogBeforeCreateEvent.js.map +1 -1
  19. package/events/AuditLogBeforeUpdateEvent.d.ts +2 -2
  20. package/events/AuditLogBeforeUpdateEvent.js +9 -6
  21. package/events/AuditLogBeforeUpdateEvent.js.map +1 -1
  22. package/events/abstractions.d.ts +1 -1
  23. package/events/abstractions.js +5 -24
  24. package/events/abstractions.js.map +1 -1
  25. package/events/index.js +0 -2
  26. package/graphql/schema.js +37 -48
  27. package/graphql/schema.js.map +1 -1
  28. package/graphql/validation.d.ts +10 -53
  29. package/graphql/validation.js +26 -30
  30. package/graphql/validation.js.map +1 -1
  31. package/index.js +18 -15
  32. package/index.js.map +1 -1
  33. package/package.json +34 -30
  34. package/storage/AccessPatternHandler.js +31 -52
  35. package/storage/AccessPatternHandler.js.map +1 -1
  36. package/storage/Converter.d.ts +3 -3
  37. package/storage/Converter.js +45 -48
  38. package/storage/Converter.js.map +1 -1
  39. package/storage/Storage.d.ts +2 -2
  40. package/storage/Storage.js +69 -77
  41. package/storage/Storage.js.map +1 -1
  42. package/storage/abstractions/AccessPattern.js +0 -3
  43. package/storage/abstractions/AccessPatternHandler.js +0 -3
  44. package/storage/abstractions/Converter.js +0 -3
  45. package/storage/abstractions/Storage.js +0 -3
  46. package/storage/accessPatterns/AppAccessPattern.js +31 -25
  47. package/storage/accessPatterns/AppAccessPattern.js.map +1 -1
  48. package/storage/accessPatterns/AppCreatedByAccessPattern.js +34 -28
  49. package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +1 -1
  50. package/storage/accessPatterns/AppEntityAccessPattern.js +31 -25
  51. package/storage/accessPatterns/AppEntityAccessPattern.js.map +1 -1
  52. package/storage/accessPatterns/AppEntityActionAccessPattern.js +31 -25
  53. package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +1 -1
  54. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +34 -28
  55. package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -1
  56. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +34 -28
  57. package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -1
  58. package/storage/accessPatterns/BaseAccessPattern.js +47 -69
  59. package/storage/accessPatterns/BaseAccessPattern.js.map +1 -1
  60. package/storage/accessPatterns/CreatedByAccessPattern.js +34 -28
  61. package/storage/accessPatterns/CreatedByAccessPattern.js.map +1 -1
  62. package/storage/accessPatterns/CreatedOnAccessPattern.js +34 -26
  63. package/storage/accessPatterns/CreatedOnAccessPattern.js.map +1 -1
  64. package/storage/accessPatterns/DefaultAccessPattern.js +31 -32
  65. package/storage/accessPatterns/DefaultAccessPattern.js.map +1 -1
  66. package/storage/accessPatterns/EntityIdAccessPattern.js +32 -27
  67. package/storage/accessPatterns/EntityIdAccessPattern.js.map +1 -1
  68. package/storage/accessPatterns/index.js +44 -34
  69. package/storage/accessPatterns/index.js.map +1 -1
  70. package/storage/cursorSchema.js +15 -18
  71. package/storage/cursorSchema.js.map +1 -1
  72. package/storage/entity.js +115 -122
  73. package/storage/entity.js.map +1 -1
  74. package/storage/results/ListErrorResult.js +9 -8
  75. package/storage/results/ListErrorResult.js.map +1 -1
  76. package/storage/results/ListSuccessResult.js +13 -12
  77. package/storage/results/ListSuccessResult.js.map +1 -1
  78. package/storage/results/index.js +0 -2
  79. package/storage/startKey.js +4 -5
  80. package/storage/startKey.js.map +1 -1
  81. package/storage/types.js +0 -3
  82. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.d.ts +4 -4
  83. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js +27 -26
  84. package/subscriptions/aco/handlers/AuditLogFolderAfterCreateHandler.js.map +1 -1
  85. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.d.ts +4 -4
  86. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js +30 -29
  87. package/subscriptions/aco/handlers/AuditLogFolderAfterDeleteHandler.js.map +1 -1
  88. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.d.ts +4 -4
  89. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js +33 -33
  90. package/subscriptions/aco/handlers/AuditLogFolderAfterUpdateHandler.js.map +1 -1
  91. package/subscriptions/aco/index.js +5 -4
  92. package/subscriptions/aco/index.js.map +1 -1
  93. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.d.ts +4 -4
  94. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js +22 -21
  95. package/subscriptions/fileManager/handlers/AuditLogFileAfterCreateHandler.js.map +1 -1
  96. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.d.ts +4 -4
  97. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js +22 -21
  98. package/subscriptions/fileManager/handlers/AuditLogFileAfterDeleteHandler.js.map +1 -1
  99. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.d.ts +4 -4
  100. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js +25 -25
  101. package/subscriptions/fileManager/handlers/AuditLogFileAfterUpdateHandler.js.map +1 -1
  102. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.d.ts +4 -4
  103. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js +25 -25
  104. package/subscriptions/fileManager/handlers/AuditLogSettingsAfterUpdateHandler.js.map +1 -1
  105. package/subscriptions/fileManager/index.js +6 -8
  106. package/subscriptions/fileManager/index.js.map +1 -1
  107. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.d.ts +1 -1
  108. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js +21 -23
  109. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterCreateEventHandler.js.map +1 -1
  110. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.d.ts +1 -1
  111. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js +26 -29
  112. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterDeleteEventHandler.js.map +1 -1
  113. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.d.ts +1 -1
  114. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js +21 -23
  115. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterPublishEventHandler.js.map +1 -1
  116. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.d.ts +1 -1
  117. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js +21 -23
  118. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterRestoreFromBinEventHandler.js.map +1 -1
  119. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.d.ts +1 -1
  120. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js +21 -23
  121. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUnpublishEventHandler.js.map +1 -1
  122. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.d.ts +1 -1
  123. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js +24 -27
  124. package/subscriptions/headlessCms/handlers/AuditLogEntryAfterUpdateEventHandler.js.map +1 -1
  125. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.d.ts +1 -1
  126. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js +21 -23
  127. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterCreateEventHandler.js.map +1 -1
  128. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.d.ts +1 -1
  129. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js +21 -23
  130. package/subscriptions/headlessCms/handlers/AuditLogEntryRevisionAfterDeleteEventHandler.js.map +1 -1
  131. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.d.ts +1 -1
  132. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js +21 -20
  133. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterCreateEventHandler.js.map +1 -1
  134. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.d.ts +1 -1
  135. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js +21 -20
  136. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterDeleteEventHandler.js.map +1 -1
  137. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.d.ts +1 -1
  138. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js +24 -24
  139. package/subscriptions/headlessCms/handlers/AuditLogGroupAfterUpdateEventHandler.js.map +1 -1
  140. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.d.ts +1 -1
  141. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js +21 -20
  142. package/subscriptions/headlessCms/handlers/AuditLogModelAfterCreateEventHandler.js.map +1 -1
  143. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.d.ts +1 -1
  144. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js +21 -20
  145. package/subscriptions/headlessCms/handlers/AuditLogModelAfterDeleteEventHandler.js.map +1 -1
  146. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.d.ts +1 -1
  147. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js +24 -24
  148. package/subscriptions/headlessCms/handlers/AuditLogModelAfterUpdateEventHandler.js.map +1 -1
  149. package/subscriptions/headlessCms/index.js +16 -20
  150. package/subscriptions/headlessCms/index.js.map +1 -1
  151. package/subscriptions/index.js +8 -7
  152. package/subscriptions/index.js.map +1 -1
  153. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.d.ts +4 -4
  154. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js +24 -23
  155. package/subscriptions/mailer/handlers/AuditLogMailerSettingsAfterSaveHandler.js.map +1 -1
  156. package/subscriptions/mailer/index.js +3 -3
  157. package/subscriptions/mailer/index.js.map +1 -1
  158. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.d.ts +4 -4
  159. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js +32 -38
  160. package/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js.map +1 -1
  161. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.d.ts +4 -4
  162. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js +32 -38
  163. package/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js.map +1 -1
  164. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.d.ts +4 -4
  165. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js +36 -43
  166. package/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js.map +1 -1
  167. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.d.ts +4 -4
  168. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js +22 -21
  169. package/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js.map +1 -1
  170. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.d.ts +4 -4
  171. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js +22 -21
  172. package/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js.map +1 -1
  173. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.d.ts +4 -4
  174. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js +25 -25
  175. package/subscriptions/security/handlers/AuditLogRoleAfterUpdateHandler.js.map +1 -1
  176. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.d.ts +4 -4
  177. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js +22 -21
  178. package/subscriptions/security/handlers/AuditLogTeamAfterCreateHandler.js.map +1 -1
  179. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.d.ts +4 -4
  180. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js +22 -21
  181. package/subscriptions/security/handlers/AuditLogTeamAfterDeleteHandler.js.map +1 -1
  182. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.d.ts +4 -4
  183. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js +25 -25
  184. package/subscriptions/security/handlers/AuditLogTeamAfterUpdateHandler.js.map +1 -1
  185. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.d.ts +4 -4
  186. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js +22 -21
  187. package/subscriptions/security/handlers/AuditLogUserAfterCreateHandler.js.map +1 -1
  188. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.d.ts +4 -4
  189. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js +22 -21
  190. package/subscriptions/security/handlers/AuditLogUserAfterDeleteHandler.js.map +1 -1
  191. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.d.ts +4 -4
  192. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js +25 -25
  193. package/subscriptions/security/handlers/AuditLogUserAfterUpdateHandler.js.map +1 -1
  194. package/subscriptions/security/handlers/cleanupApiKey.js +10 -16
  195. package/subscriptions/security/handlers/cleanupApiKey.js.map +1 -1
  196. package/subscriptions/security/index.js +14 -20
  197. package/subscriptions/security/index.js.map +1 -1
  198. package/subscriptions/websiteBuilder/index.js +14 -16
  199. package/subscriptions/websiteBuilder/index.js.map +1 -1
  200. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.d.ts +4 -4
  201. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js +21 -20
  202. package/subscriptions/websiteBuilder/pages/PageAfterCreateHandler.js.map +1 -1
  203. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.d.ts +4 -4
  204. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js +21 -20
  205. package/subscriptions/websiteBuilder/pages/PageAfterCreateRevisionFromHandler.js.map +1 -1
  206. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.d.ts +4 -4
  207. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js +21 -20
  208. package/subscriptions/websiteBuilder/pages/PageAfterDeleteHandler.js.map +1 -1
  209. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.d.ts +4 -4
  210. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js +24 -24
  211. package/subscriptions/websiteBuilder/pages/PageAfterDuplicateHandler.js.map +1 -1
  212. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.d.ts +4 -4
  213. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js +21 -20
  214. package/subscriptions/websiteBuilder/pages/PageAfterMoveHandler.js.map +1 -1
  215. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.d.ts +4 -4
  216. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js +21 -20
  217. package/subscriptions/websiteBuilder/pages/PageAfterPublishHandler.js.map +1 -1
  218. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.d.ts +4 -4
  219. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js +21 -20
  220. package/subscriptions/websiteBuilder/pages/PageAfterUnpublishHandler.js.map +1 -1
  221. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.d.ts +4 -4
  222. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js +24 -24
  223. package/subscriptions/websiteBuilder/pages/PageAfterUpdateHandler.js.map +1 -1
  224. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.d.ts +4 -4
  225. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js +21 -20
  226. package/subscriptions/websiteBuilder/redirects/RedirectAfterCreateHandler.js.map +1 -1
  227. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.d.ts +4 -4
  228. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js +21 -20
  229. package/subscriptions/websiteBuilder/redirects/RedirectAfterDeleteHandler.js.map +1 -1
  230. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.d.ts +4 -4
  231. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js +21 -20
  232. package/subscriptions/websiteBuilder/redirects/RedirectAfterMoveHandler.js.map +1 -1
  233. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.d.ts +4 -4
  234. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js +24 -24
  235. package/subscriptions/websiteBuilder/redirects/RedirectAfterUpdateHandler.js.map +1 -1
  236. package/types.js +0 -3
  237. package/utils/expiresAt.js +14 -19
  238. package/utils/expiresAt.js.map +1 -1
  239. package/utils/getAuditConfig.js +79 -98
  240. package/utils/getAuditConfig.js.map +1 -1
  241. package/utils/getAuditObject.js +14 -15
  242. package/utils/getAuditObject.js.map +1 -1
  243. package/events/index.js.map +0 -1
  244. package/storage/abstractions/AccessPattern.js.map +0 -1
  245. package/storage/abstractions/AccessPatternHandler.js.map +0 -1
  246. package/storage/abstractions/Converter.js.map +0 -1
  247. package/storage/abstractions/Storage.js.map +0 -1
  248. package/storage/results/index.js.map +0 -1
  249. package/storage/types.js.map +0 -1
  250. package/types.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import { ApiKeyAfterCreateHandler } from "@webiny/api-core/features/CreateApiKey";
1
+ import { ApiKeyAfterCreateEventHandler } from "@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateHandler.Interface {
3
+ declare class AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: ApiKeyAfterCreateHandler.Event): Promise<void>;
6
+ handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterCreateHandler: typeof AuditLogApiKeyAfterCreateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/CreateApiKey").ApiKeyAfterCreateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/CreateApiKey/events").ApiKeyAfterCreateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,47 +1,41 @@
1
- import WebinyError from "@webiny/error";
2
- import { ApiKeyAfterCreateHandler } from "@webiny/api-core/features/CreateApiKey";
1
+ import _webiny_error from "@webiny/error";
2
+ import { ApiKeyAfterCreateEventHandler } from "@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js";
3
3
  import { AuditLogsContext } from "../../../abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
5
5
  import { getAuditConfig } from "../../../utils/getAuditConfig.js";
6
- /**
7
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
15
- createdBy: apiKey.createdBy,
16
- createdOn: apiKey.createdOn,
17
- description: apiKey.description,
18
- name: apiKey.name,
19
- permissions: apiKey.permissions
20
- };
21
- };
6
+ const cleanupApiKey = (apiKey)=>({
7
+ id: apiKey.id,
8
+ slug: apiKey.slug,
9
+ createdBy: apiKey.createdBy,
10
+ createdOn: apiKey.createdOn,
11
+ description: apiKey.description,
12
+ name: apiKey.name,
13
+ permissions: apiKey.permissions
14
+ });
22
15
  class AuditLogApiKeyAfterCreateHandlerImpl {
23
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- apiKey: initialApiKey
30
- } = event.payload;
31
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);
32
- const apiKey = cleanupApiKey(initialApiKey);
33
- await createAuditLog("API key created", apiKey, apiKey.id, this.context);
34
- } catch (error) {
35
- throw WebinyError.from(error, {
36
- message: "Error while executing AuditLogApiKeyAfterCreateHandler",
37
- code: "AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER"
38
- });
16
+ constructor(context){
17
+ this.context = context;
18
+ }
19
+ async handle(event) {
20
+ try {
21
+ const { apiKey: initialApiKey } = event.payload;
22
+ const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);
23
+ const apiKey = cleanupApiKey(initialApiKey);
24
+ await createAuditLog("API key created", apiKey, apiKey.id, this.context);
25
+ } catch (error) {
26
+ throw _webiny_error.from(error, {
27
+ message: "Error while executing AuditLogApiKeyAfterCreateHandler",
28
+ code: "AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER"
29
+ });
30
+ }
39
31
  }
40
- }
41
32
  }
42
- export const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterCreateHandlerImpl,
44
- dependencies: [AuditLogsContext]
33
+ const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({
34
+ implementation: AuditLogApiKeyAfterCreateHandlerImpl,
35
+ dependencies: [
36
+ AuditLogsContext
37
+ ]
45
38
  });
39
+ export { AuditLogApiKeyAfterCreateHandler };
46
40
 
47
41
  //# sourceMappingURL=AuditLogApiKeyAfterCreateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","ApiKeyAfterCreateHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterCreateHandlerImpl","constructor","context","handle","event","initialApiKey","payload","createAuditLog","SECURITY","API_KEY","CREATE","error","from","message","code","AuditLogApiKeyAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogApiKeyAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterCreateHandler } from \"@webiny/api-core/features/CreateApiKey\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterCreateHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key created\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateHandler.createImplementation({\n implementation: AuditLogApiKeyAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,wBAAwB,QAAQ,wCAAwC;AACjF,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAA+C;EACrFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAqC,EAAiB;IAC/D,IAAI;MACA,MAAM;QAAEZ,MAAM,EAAEa;MAAc,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC/C,MAAMC,cAAc,GAAGjB,cAAc,CAACD,KAAK,CAACmB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMlB,MAAM,GAAGD,aAAa,CAACc,aAAa,CAAC;MAE3C,MAAME,cAAc,CAAC,iBAAiB,EAAEf,MAAM,EAAEA,MAAM,CAACC,EAAE,EAAE,IAAI,CAACS,OAAO,CAAC;IAC5E,CAAC,CAAC,OAAOS,KAAK,EAAE;MACZ,MAAMzB,WAAW,CAAC0B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAG5B,wBAAwB,CAAC6B,oBAAoB,CAAC;EAC1FC,cAAc,EAAEjB,oCAAoC;EACpDkB,YAAY,EAAE,CAAC9B,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterCreateEventHandler } from \"@webiny/api-core/features/security/apiKeys/CreateApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterCreateHandlerImpl implements ApiKeyAfterCreateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.CREATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key created\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterCreateHandler = ApiKeyAfterCreateEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterCreateHandlerImpl","context","event","initialApiKey","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogApiKeyAfterCreateHandler","ApiKeyAfterCreateEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAC/C,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMP,SAASD,cAAcK;YAE7B,MAAMC,eAAe,mBAAmBL,QAAQA,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO;QAC3E,EAAE,OAAOQ,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -1,11 +1,11 @@
1
- import { ApiKeyAfterDeleteHandler } from "@webiny/api-core/features/DeleteApiKey";
1
+ import { ApiKeyAfterDeleteEventHandler } from "@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteHandler.Interface {
3
+ declare class AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: ApiKeyAfterDeleteHandler.Event): Promise<void>;
6
+ handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterDeleteHandler: typeof AuditLogApiKeyAfterDeleteHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/DeleteApiKey").ApiKeyAfterDeleteEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/DeleteApiKey/events").ApiKeyAfterDeleteEvent>>;
10
10
  };
11
11
  export {};
@@ -1,47 +1,41 @@
1
- import WebinyError from "@webiny/error";
2
- import { ApiKeyAfterDeleteHandler } from "@webiny/api-core/features/DeleteApiKey";
1
+ import _webiny_error from "@webiny/error";
2
+ import { ApiKeyAfterDeleteEventHandler } from "@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js";
3
3
  import { AuditLogsContext } from "../../../abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
5
5
  import { getAuditConfig } from "../../../utils/getAuditConfig.js";
6
- /**
7
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
15
- createdBy: apiKey.createdBy,
16
- createdOn: apiKey.createdOn,
17
- description: apiKey.description,
18
- name: apiKey.name,
19
- permissions: apiKey.permissions
20
- };
21
- };
6
+ const cleanupApiKey = (apiKey)=>({
7
+ id: apiKey.id,
8
+ slug: apiKey.slug,
9
+ createdBy: apiKey.createdBy,
10
+ createdOn: apiKey.createdOn,
11
+ description: apiKey.description,
12
+ name: apiKey.name,
13
+ permissions: apiKey.permissions
14
+ });
22
15
  class AuditLogApiKeyAfterDeleteHandlerImpl {
23
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- apiKey: initialApiKey
30
- } = event.payload;
31
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);
32
- const apiKey = cleanupApiKey(initialApiKey);
33
- await createAuditLog("API key deleted", apiKey, apiKey.id, this.context);
34
- } catch (error) {
35
- throw WebinyError.from(error, {
36
- message: "Error while executing AuditLogApiKeyAfterDeleteHandler",
37
- code: "AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER"
38
- });
16
+ constructor(context){
17
+ this.context = context;
18
+ }
19
+ async handle(event) {
20
+ try {
21
+ const { apiKey: initialApiKey } = event.payload;
22
+ const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);
23
+ const apiKey = cleanupApiKey(initialApiKey);
24
+ await createAuditLog("API key deleted", apiKey, apiKey.id, this.context);
25
+ } catch (error) {
26
+ throw _webiny_error.from(error, {
27
+ message: "Error while executing AuditLogApiKeyAfterDeleteHandler",
28
+ code: "AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER"
29
+ });
30
+ }
39
31
  }
40
- }
41
32
  }
42
- export const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteHandler.createImplementation({
43
- implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
44
- dependencies: [AuditLogsContext]
33
+ const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({
34
+ implementation: AuditLogApiKeyAfterDeleteHandlerImpl,
35
+ dependencies: [
36
+ AuditLogsContext
37
+ ]
45
38
  });
39
+ export { AuditLogApiKeyAfterDeleteHandler };
46
40
 
47
41
  //# sourceMappingURL=AuditLogApiKeyAfterDeleteHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","ApiKeyAfterDeleteHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterDeleteHandlerImpl","constructor","context","handle","event","initialApiKey","payload","createAuditLog","SECURITY","API_KEY","DELETE","error","from","message","code","AuditLogApiKeyAfterDeleteHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogApiKeyAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterDeleteHandler } from \"@webiny/api-core/features/DeleteApiKey\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterDeleteHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key deleted\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteHandler.createImplementation({\n implementation: AuditLogApiKeyAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,wBAAwB,QAAQ,wCAAwC;AACjF,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAA+C;EACrFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAqC,EAAiB;IAC/D,IAAI;MACA,MAAM;QAAEZ,MAAM,EAAEa;MAAc,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC/C,MAAMC,cAAc,GAAGjB,cAAc,CAACD,KAAK,CAACmB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMlB,MAAM,GAAGD,aAAa,CAACc,aAAa,CAAC;MAE3C,MAAME,cAAc,CAAC,iBAAiB,EAAEf,MAAM,EAAEA,MAAM,CAACC,EAAE,EAAE,IAAI,CAACS,OAAO,CAAC;IAC5E,CAAC,CAAC,OAAOS,KAAK,EAAE;MACZ,MAAMzB,WAAW,CAAC0B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAG5B,wBAAwB,CAAC6B,oBAAoB,CAAC;EAC1FC,cAAc,EAAEjB,oCAAoC;EACpDkB,YAAY,EAAE,CAAC9B,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterDeleteEventHandler } from \"@webiny/api-core/features/security/apiKeys/DeleteApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterDeleteHandlerImpl implements ApiKeyAfterDeleteEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { apiKey: initialApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.DELETE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n\n await createAuditLog(\"API key deleted\", apiKey, apiKey.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterDeleteHandler = ApiKeyAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterDeleteHandlerImpl","context","event","initialApiKey","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogApiKeyAfterDeleteHandler","ApiKeyAfterDeleteEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,QAAQC,aAAa,EAAE,GAAGD,MAAM,OAAO;YAC/C,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMP,SAASD,cAAcK;YAE7B,MAAMC,eAAe,mBAAmBL,QAAQA,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO;QAC3E,EAAE,OAAOQ,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -1,11 +1,11 @@
1
- import { ApiKeyAfterUpdateHandler } from "@webiny/api-core/features/UpdateApiKey";
1
+ import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateHandler.Interface {
3
+ declare class AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: ApiKeyAfterUpdateHandler.Event): Promise<void>;
6
+ handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogApiKeyAfterUpdateHandler: typeof AuditLogApiKeyAfterUpdateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/UpdateApiKey").ApiKeyAfterUpdateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/apiKeys/UpdateApiKey/events").ApiKeyAfterUpdateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,52 +1,45 @@
1
- import WebinyError from "@webiny/error";
2
- import { ApiKeyAfterUpdateHandler } from "@webiny/api-core/features/UpdateApiKey";
1
+ import _webiny_error from "@webiny/error";
2
+ import { ApiKeyAfterUpdateEventHandler } from "@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js";
3
3
  import { AuditLogsContext } from "../../../abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
5
5
  import { getAuditConfig } from "../../../utils/getAuditConfig.js";
6
- /**
7
- * We need to remove the token from the API Key object, as it is a security risk.
8
- *
9
- * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.
10
- */
11
- const cleanupApiKey = apiKey => {
12
- return {
13
- id: apiKey.id,
14
- slug: apiKey.slug,
15
- createdBy: apiKey.createdBy,
16
- createdOn: apiKey.createdOn,
17
- description: apiKey.description,
18
- name: apiKey.name,
19
- permissions: apiKey.permissions
20
- };
21
- };
6
+ const cleanupApiKey = (apiKey)=>({
7
+ id: apiKey.id,
8
+ slug: apiKey.slug,
9
+ createdBy: apiKey.createdBy,
10
+ createdOn: apiKey.createdOn,
11
+ description: apiKey.description,
12
+ name: apiKey.name,
13
+ permissions: apiKey.permissions
14
+ });
22
15
  class AuditLogApiKeyAfterUpdateHandlerImpl {
23
- constructor(context) {
24
- this.context = context;
25
- }
26
- async handle(event) {
27
- try {
28
- const {
29
- updated: initialApiKey,
30
- original: initialOriginalApiKey
31
- } = event.payload;
32
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);
33
- const apiKey = cleanupApiKey(initialApiKey);
34
- const original = cleanupApiKey(initialOriginalApiKey);
35
- await createAuditLog("API key updated", {
36
- before: original,
37
- after: apiKey
38
- }, apiKey.id, this.context);
39
- } catch (error) {
40
- throw WebinyError.from(error, {
41
- message: "Error while executing AuditLogApiKeyAfterUpdateHandler",
42
- code: "AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER"
43
- });
16
+ constructor(context){
17
+ this.context = context;
18
+ }
19
+ async handle(event) {
20
+ try {
21
+ const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;
22
+ const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);
23
+ const apiKey = cleanupApiKey(initialApiKey);
24
+ const original = cleanupApiKey(initialOriginalApiKey);
25
+ await createAuditLog("API key updated", {
26
+ before: original,
27
+ after: apiKey
28
+ }, apiKey.id, this.context);
29
+ } catch (error) {
30
+ throw _webiny_error.from(error, {
31
+ message: "Error while executing AuditLogApiKeyAfterUpdateHandler",
32
+ code: "AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER"
33
+ });
34
+ }
44
35
  }
45
- }
46
36
  }
47
- export const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateHandler.createImplementation({
48
- implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
49
- dependencies: [AuditLogsContext]
37
+ const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({
38
+ implementation: AuditLogApiKeyAfterUpdateHandlerImpl,
39
+ dependencies: [
40
+ AuditLogsContext
41
+ ]
50
42
  });
43
+ export { AuditLogApiKeyAfterUpdateHandler };
51
44
 
52
45
  //# sourceMappingURL=AuditLogApiKeyAfterUpdateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","ApiKeyAfterUpdateHandler","AuditLogsContext","AUDIT","getAuditConfig","cleanupApiKey","apiKey","id","slug","createdBy","createdOn","description","name","permissions","AuditLogApiKeyAfterUpdateHandlerImpl","constructor","context","handle","event","updated","initialApiKey","original","initialOriginalApiKey","payload","createAuditLog","SECURITY","API_KEY","UPDATE","before","after","error","from","message","code","AuditLogApiKeyAfterUpdateHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogApiKeyAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterUpdateHandler } from \"@webiny/api-core/features/UpdateApiKey\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterUpdateHandler.Event): Promise<void> {\n try {\n const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n const original = cleanupApiKey(initialOriginalApiKey);\n\n await createAuditLog(\n \"API key updated\",\n {\n before: original,\n after: apiKey\n },\n apiKey.id,\n this.context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateHandler.createImplementation({\n implementation: AuditLogApiKeyAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,wBAAwB,QAAQ,wCAAwC;AACjF,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAGvB;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,MAAc,IAA4B;EAC7D,OAAO;IACHC,EAAE,EAAED,MAAM,CAACC,EAAE;IACbC,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBC,SAAS,EAAEH,MAAM,CAACG,SAAS;IAC3BC,SAAS,EAAEJ,MAAM,CAACI,SAAS;IAC3BC,WAAW,EAAEL,MAAM,CAACK,WAAW;IAC/BC,IAAI,EAAEN,MAAM,CAACM,IAAI;IACjBC,WAAW,EAAEP,MAAM,CAACO;EACxB,CAAC;AACL,CAAC;AAED,MAAMC,oCAAoC,CAA+C;EACrFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAqC,EAAiB;IAC/D,IAAI;MACA,MAAM;QAAEC,OAAO,EAAEC,aAAa;QAAEC,QAAQ,EAAEC;MAAsB,CAAC,GAAGJ,KAAK,CAACK,OAAO;MACjF,MAAMC,cAAc,GAAGpB,cAAc,CAACD,KAAK,CAACsB,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC;MAEpE,MAAMrB,MAAM,GAAGD,aAAa,CAACe,aAAa,CAAC;MAC3C,MAAMC,QAAQ,GAAGhB,aAAa,CAACiB,qBAAqB,CAAC;MAErD,MAAME,cAAc,CAChB,iBAAiB,EACjB;QACII,MAAM,EAAEP,QAAQ;QAChBQ,KAAK,EAAEvB;MACX,CAAC,EACDA,MAAM,CAACC,EAAE,EACT,IAAI,CAACS,OACT,CAAC;IACL,CAAC,CAAC,OAAOc,KAAK,EAAE;MACZ,MAAM9B,WAAW,CAAC+B,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,wDAAwD;QACjEC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,gCAAgC,GAAGjC,wBAAwB,CAACkC,oBAAoB,CAAC;EAC1FC,cAAc,EAAEtB,oCAAoC;EACpDuB,YAAY,EAAE,CAACnC,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogApiKeyAfterUpdateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApiKeyAfterUpdateEventHandler } from \"@webiny/api-core/features/security/apiKeys/UpdateApiKey/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport type { ApiKey } from \"@webiny/api-core/types/security.js\";\n\n/**\n * We need to remove the token from the API Key object, as it is a security risk.\n *\n * We assign the API Key object explicitly, so we do not miss any new properties that might be added in the future - and they should not be in the log.\n */\nconst cleanupApiKey = (apiKey: ApiKey): Omit<ApiKey, \"token\"> => {\n return {\n id: apiKey.id,\n slug: apiKey.slug,\n createdBy: apiKey.createdBy,\n createdOn: apiKey.createdOn,\n description: apiKey.description,\n name: apiKey.name,\n permissions: apiKey.permissions\n };\n};\n\nclass AuditLogApiKeyAfterUpdateHandlerImpl implements ApiKeyAfterUpdateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: ApiKeyAfterUpdateEventHandler.Event): Promise<void> {\n try {\n const { updated: initialApiKey, original: initialOriginalApiKey } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.API_KEY.UPDATE);\n\n const apiKey = cleanupApiKey(initialApiKey);\n const original = cleanupApiKey(initialOriginalApiKey);\n\n await createAuditLog(\n \"API key updated\",\n {\n before: original,\n after: apiKey\n },\n apiKey.id,\n this.context\n );\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogApiKeyAfterUpdateHandler\",\n code: \"AUDIT_LOGS_AFTER_API_KEY_UPDATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogApiKeyAfterUpdateHandler = ApiKeyAfterUpdateEventHandler.createImplementation({\n implementation: AuditLogApiKeyAfterUpdateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["cleanupApiKey","apiKey","AuditLogApiKeyAfterUpdateHandlerImpl","context","event","initialApiKey","initialOriginalApiKey","createAuditLog","getAuditConfig","AUDIT","original","error","WebinyError","AuditLogApiKeyAfterUpdateHandler","ApiKeyAfterUpdateEventHandler","AuditLogsContext"],"mappings":";;;;;AAYA,MAAMA,gBAAgB,CAACC,SACZ;QACH,IAAIA,OAAO,EAAE;QACb,MAAMA,OAAO,IAAI;QACjB,WAAWA,OAAO,SAAS;QAC3B,WAAWA,OAAO,SAAS;QAC3B,aAAaA,OAAO,WAAW;QAC/B,MAAMA,OAAO,IAAI;QACjB,aAAaA,OAAO,WAAW;IACnC;AAGJ,MAAMC;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAA0C,EAAiB;QACpE,IAAI;YACA,MAAM,EAAE,SAASC,aAAa,EAAE,UAAUC,qBAAqB,EAAE,GAAGF,MAAM,OAAO;YACjF,MAAMG,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM;YAEnE,MAAMR,SAASD,cAAcK;YAC7B,MAAMK,WAAWV,cAAcM;YAE/B,MAAMC,eACF,mBACA;gBACI,QAAQG;gBACR,OAAOT;YACX,GACAA,OAAO,EAAE,EACT,IAAI,CAAC,OAAO;QAEpB,EAAE,OAAOU,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,mCAAmCC,8BAA8B,oBAAoB,CAAC;IAC/F,gBAAgBZ;IAChB,cAAc;QAACa;KAAiB;AACpC"}
@@ -1,11 +1,11 @@
1
1
  import { AuditLogsContext } from "../../../abstractions.js";
2
- import { RoleAfterCreateHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
3
- declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateHandler.Interface {
2
+ import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
3
+ declare class AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterCreateHandler.Event): Promise<void>;
6
+ handle(event: RoleAfterCreateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterCreateHandler: typeof AuditLogRoleAfterCreateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/CreateRole/events").RoleAfterCreateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/CreateRole/events").RoleAfterCreateEvent>>;
10
10
  };
11
11
  export {};
@@ -1,30 +1,31 @@
1
- import WebinyError from "@webiny/error";
1
+ import _webiny_error from "@webiny/error";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
3
  import { AUDIT } from "../../../config.js";
4
4
  import { getAuditConfig } from "../../../utils/getAuditConfig.js";
5
- import { RoleAfterCreateHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
5
+ import { RoleAfterCreateEventHandler } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
6
6
  class AuditLogRoleAfterCreateHandlerImpl {
7
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- role
14
- } = event.payload;
15
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);
16
- await createAuditLog("Role created", role, role.id, this.context);
17
- } catch (error) {
18
- throw WebinyError.from(error, {
19
- message: "Error while executing AuditLogRoleAfterCreateHandler",
20
- code: "AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER"
21
- });
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { role } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);
14
+ await createAuditLog("Role created", role, role.id, this.context);
15
+ } catch (error) {
16
+ throw _webiny_error.from(error, {
17
+ message: "Error while executing AuditLogRoleAfterCreateHandler",
18
+ code: "AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER"
19
+ });
20
+ }
22
21
  }
23
- }
24
22
  }
25
- export const AuditLogRoleAfterCreateHandler = RoleAfterCreateHandler.createImplementation({
26
- implementation: AuditLogRoleAfterCreateHandlerImpl,
27
- dependencies: [AuditLogsContext]
23
+ const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({
24
+ implementation: AuditLogRoleAfterCreateHandlerImpl,
25
+ dependencies: [
26
+ AuditLogsContext
27
+ ]
28
28
  });
29
+ export { AuditLogRoleAfterCreateHandler };
29
30
 
30
31
  //# sourceMappingURL=AuditLogRoleAfterCreateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","AuditLogsContext","AUDIT","getAuditConfig","RoleAfterCreateHandler","AuditLogRoleAfterCreateHandlerImpl","constructor","context","handle","event","role","payload","createAuditLog","SECURITY","ROLE","CREATE","id","error","from","message","code","AuditLogRoleAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogRoleAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { RoleAfterCreateHandler } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\n\nclass AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterCreateHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);\n\n await createAuditLog(\"Role created\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterCreateHandler = RoleAfterCreateHandler.createImplementation({\n implementation: AuditLogRoleAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AACvB,SAASC,sBAAsB,QAAQ,8DAA8D;AAErG,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,IAAI;MACA,MAAM;QAAEC;MAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC9B,MAAMC,cAAc,GAAGT,cAAc,CAACD,KAAK,CAACW,QAAQ,CAACC,IAAI,CAACC,MAAM,CAAC;MAEjE,MAAMH,cAAc,CAAC,cAAc,EAAEF,IAAI,EAAEA,IAAI,CAACM,EAAE,EAAE,IAAI,CAACT,OAAO,CAAC;IACrE,CAAC,CAAC,OAAOU,KAAK,EAAE;MACZ,MAAMjB,WAAW,CAACkB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,sDAAsD;QAC/DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,8BAA8B,GAAGjB,sBAAsB,CAACkB,oBAAoB,CAAC;EACtFC,cAAc,EAAElB,kCAAkC;EAClDmB,YAAY,EAAE,CAACvB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterCreateHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\nimport { RoleAfterCreateEventHandler } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\n\nclass AuditLogRoleAfterCreateHandlerImpl implements RoleAfterCreateEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterCreateEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.CREATE);\n\n await createAuditLog(\"Role created\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterCreateHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_CREATE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterCreateHandler = RoleAfterCreateEventHandler.createImplementation({\n implementation: AuditLogRoleAfterCreateHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["AuditLogRoleAfterCreateHandlerImpl","context","event","role","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogRoleAfterCreateHandler","RoleAfterCreateEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAC9B,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;YAEhE,MAAMF,eAAe,gBAAgBD,MAAMA,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO;QACpE,EAAE,OAAOI,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,4BAA4B,oBAAoB,CAAC;IAC3F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -1,11 +1,11 @@
1
- import { RoleAfterDeleteHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
1
+ import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteHandler.Interface {
3
+ declare class AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterDeleteHandler.Event): Promise<void>;
6
+ handle(event: RoleAfterDeleteEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterDeleteHandler: typeof AuditLogRoleAfterDeleteHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/DeleteRole/events").RoleAfterDeleteEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/DeleteRole/events").RoleAfterDeleteEvent>>;
10
10
  };
11
11
  export {};
@@ -1,30 +1,31 @@
1
- import WebinyError from "@webiny/error";
2
- import { RoleAfterDeleteHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
1
+ import _webiny_error from "@webiny/error";
2
+ import { RoleAfterDeleteEventHandler } from "@webiny/api-core/features/security/roles/DeleteRole/index.js";
3
3
  import { AuditLogsContext } from "../../../abstractions.js";
4
4
  import { AUDIT } from "../../../config.js";
5
5
  import { getAuditConfig } from "../../../utils/getAuditConfig.js";
6
6
  class AuditLogRoleAfterDeleteHandlerImpl {
7
- constructor(context) {
8
- this.context = context;
9
- }
10
- async handle(event) {
11
- try {
12
- const {
13
- role
14
- } = event.payload;
15
- const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);
16
- await createAuditLog("Role deleted", role, role.id, this.context);
17
- } catch (error) {
18
- throw WebinyError.from(error, {
19
- message: "Error while executing AuditLogRoleAfterDeleteHandler",
20
- code: "AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER"
21
- });
7
+ constructor(context){
8
+ this.context = context;
9
+ }
10
+ async handle(event) {
11
+ try {
12
+ const { role } = event.payload;
13
+ const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);
14
+ await createAuditLog("Role deleted", role, role.id, this.context);
15
+ } catch (error) {
16
+ throw _webiny_error.from(error, {
17
+ message: "Error while executing AuditLogRoleAfterDeleteHandler",
18
+ code: "AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER"
19
+ });
20
+ }
22
21
  }
23
- }
24
22
  }
25
- export const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteHandler.createImplementation({
26
- implementation: AuditLogRoleAfterDeleteHandlerImpl,
27
- dependencies: [AuditLogsContext]
23
+ const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({
24
+ implementation: AuditLogRoleAfterDeleteHandlerImpl,
25
+ dependencies: [
26
+ AuditLogsContext
27
+ ]
28
28
  });
29
+ export { AuditLogRoleAfterDeleteHandler };
29
30
 
30
31
  //# sourceMappingURL=AuditLogRoleAfterDeleteHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","RoleAfterDeleteHandler","AuditLogsContext","AUDIT","getAuditConfig","AuditLogRoleAfterDeleteHandlerImpl","constructor","context","handle","event","role","payload","createAuditLog","SECURITY","ROLE","DELETE","id","error","from","message","code","AuditLogRoleAfterDeleteHandler","createImplementation","implementation","dependencies"],"sources":["AuditLogRoleAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterDeleteHandler } from \"@webiny/api-core/features/security/roles/DeleteRole/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterDeleteHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);\n\n await createAuditLog(\"Role deleted\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteHandler.createImplementation({\n implementation: AuditLogRoleAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,8DAA8D;AACrG,SAASC,gBAAgB;AACzB,SAASC,KAAK;AACd,SAASC,cAAc;AAEvB,MAAMC,kCAAkC,CAA6C;EACjFC,WAAWA,CAASC,OAAmC,EAAE;IAAA,KAArCA,OAAmC,GAAnCA,OAAmC;EAAG;EAE1D,MAAMC,MAAMA,CAACC,KAAmC,EAAiB;IAC7D,IAAI;MACA,MAAM;QAAEC;MAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;MAC9B,MAAMC,cAAc,GAAGR,cAAc,CAACD,KAAK,CAACU,QAAQ,CAACC,IAAI,CAACC,MAAM,CAAC;MAEjE,MAAMH,cAAc,CAAC,cAAc,EAAEF,IAAI,EAAEA,IAAI,CAACM,EAAE,EAAE,IAAI,CAACT,OAAO,CAAC;IACrE,CAAC,CAAC,OAAOU,KAAK,EAAE;MACZ,MAAMjB,WAAW,CAACkB,IAAI,CAACD,KAAK,EAAE;QAC1BE,OAAO,EAAE,sDAAsD;QAC/DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,8BAA8B,GAAGpB,sBAAsB,CAACqB,oBAAoB,CAAC;EACtFC,cAAc,EAAElB,kCAAkC;EAClDmB,YAAY,EAAE,CAACtB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.js","sources":["../../../../src/subscriptions/security/handlers/AuditLogRoleAfterDeleteHandler.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { RoleAfterDeleteEventHandler } from \"@webiny/api-core/features/security/roles/DeleteRole/index.js\";\nimport { AuditLogsContext } from \"~/abstractions.js\";\nimport { AUDIT } from \"~/config.js\";\nimport { getAuditConfig } from \"~/utils/getAuditConfig.js\";\n\nclass AuditLogRoleAfterDeleteHandlerImpl implements RoleAfterDeleteEventHandler.Interface {\n constructor(private context: AuditLogsContext.Interface) {}\n\n async handle(event: RoleAfterDeleteEventHandler.Event): Promise<void> {\n try {\n const { role } = event.payload;\n const createAuditLog = getAuditConfig(AUDIT.SECURITY.ROLE.DELETE);\n\n await createAuditLog(\"Role deleted\", role, role.id, this.context);\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing AuditLogRoleAfterDeleteHandler\",\n code: \"AUDIT_LOGS_AFTER_ROLE_DELETE_HANDLER\"\n });\n }\n }\n}\n\nexport const AuditLogRoleAfterDeleteHandler = RoleAfterDeleteEventHandler.createImplementation({\n implementation: AuditLogRoleAfterDeleteHandlerImpl,\n dependencies: [AuditLogsContext]\n});\n"],"names":["AuditLogRoleAfterDeleteHandlerImpl","context","event","role","createAuditLog","getAuditConfig","AUDIT","error","WebinyError","AuditLogRoleAfterDeleteHandler","RoleAfterDeleteEventHandler","AuditLogsContext"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoBC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAE1D,MAAM,OAAOC,KAAwC,EAAiB;QAClE,IAAI;YACA,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;YAC9B,MAAME,iBAAiBC,eAAeC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM;YAEhE,MAAMF,eAAe,gBAAgBD,MAAMA,KAAK,EAAE,EAAE,IAAI,CAAC,OAAO;QACpE,EAAE,OAAOI,OAAO;YACZ,MAAMC,cAAAA,IAAgB,CAACD,OAAO;gBAC1B,SAAS;gBACT,MAAM;YACV;QACJ;IACJ;AACJ;AAEO,MAAME,iCAAiCC,4BAA4B,oBAAoB,CAAC;IAC3F,gBAAgBV;IAChB,cAAc;QAACW;KAAiB;AACpC"}
@@ -1,11 +1,11 @@
1
- import { RoleAfterUpdateHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
1
+ import { RoleAfterUpdateEventHandler } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
2
2
  import { AuditLogsContext } from "../../../abstractions.js";
3
- declare class AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateHandler.Interface {
3
+ declare class AuditLogRoleAfterUpdateHandlerImpl implements RoleAfterUpdateEventHandler.Interface {
4
4
  private context;
5
5
  constructor(context: AuditLogsContext.Interface);
6
- handle(event: RoleAfterUpdateHandler.Event): Promise<void>;
6
+ handle(event: RoleAfterUpdateEventHandler.Event): Promise<void>;
7
7
  }
8
8
  export declare const AuditLogRoleAfterUpdateHandler: typeof AuditLogRoleAfterUpdateHandlerImpl & {
9
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/UpdateRole/events").RoleAfterUpdateEvent>>;
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("@webiny/api-core/features/security/roles/UpdateRole/events").RoleAfterUpdateEvent>>;
10
10
  };
11
11
  export {};