@webiny/api-core 6.3.0-beta.4 → 6.4.0-beta.0

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 (786) hide show
  1. package/ApiCoreFeature.js +18 -18
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/createApiCore.d.ts +1 -1
  4. package/createApiCore.js +14 -9
  5. package/createApiCore.js.map +1 -1
  6. package/domain/identity/SystemIdentityValue.js +9 -8
  7. package/domain/identity/SystemIdentityValue.js.map +1 -1
  8. package/domain/security/ApiToken.js +5 -11
  9. package/domain/security/ApiToken.js.map +1 -1
  10. package/domain/tenancy/RootTenantValue.js +9 -8
  11. package/domain/tenancy/RootTenantValue.js.map +1 -1
  12. package/domain/tenancy/errors.js +0 -3
  13. package/exports/api/build-params.js +0 -3
  14. package/exports/api/event-publisher.js +0 -3
  15. package/exports/api/graphql.js +0 -2
  16. package/exports/api/key-value-store.js +0 -3
  17. package/exports/api/logger.js +0 -3
  18. package/exports/api/security/api-key.js +0 -2
  19. package/exports/api/security/authentication.js +0 -2
  20. package/exports/api/security/role.js +1 -3
  21. package/exports/api/security/user.js +0 -2
  22. package/exports/api/security.js +3 -7
  23. package/exports/api/system.js +0 -2
  24. package/exports/api/tasks.js +0 -2
  25. package/exports/api/tenancy.js +4 -6
  26. package/exports/api.js +1 -3
  27. package/features/ai/Ai.js +100 -117
  28. package/features/ai/Ai.js.map +1 -1
  29. package/features/ai/AiSdkTools.js +23 -19
  30. package/features/ai/AiSdkTools.js.map +1 -1
  31. package/features/ai/AnthropicSdkFactory.js +82 -65
  32. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  33. package/features/ai/OpenAiSdkFactory.js +234 -181
  34. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  35. package/features/ai/abstractions.js +7 -32
  36. package/features/ai/abstractions.js.map +1 -1
  37. package/features/ai/feature.js +9 -8
  38. package/features/ai/feature.js.map +1 -1
  39. package/features/ai/index.js +1 -3
  40. package/features/buildParams/BuildParams.js +20 -14
  41. package/features/buildParams/BuildParams.js.map +1 -1
  42. package/features/buildParams/abstractions.js +3 -4
  43. package/features/buildParams/abstractions.js.map +1 -1
  44. package/features/buildParams/feature.js +6 -5
  45. package/features/buildParams/feature.js.map +1 -1
  46. package/features/buildParams/index.js +0 -2
  47. package/features/encryption/EncryptionService.js +50 -46
  48. package/features/encryption/EncryptionService.js.map +1 -1
  49. package/features/encryption/abstractions.js +2 -2
  50. package/features/encryption/abstractions.js.map +1 -1
  51. package/features/encryption/feature.js +6 -5
  52. package/features/encryption/feature.js.map +1 -1
  53. package/features/encryption/index.js +0 -2
  54. package/features/eventPublisher/EventPublisher.js +9 -15
  55. package/features/eventPublisher/EventPublisher.js.map +1 -1
  56. package/features/eventPublisher/__tests__/EventPublisher.test.js +385 -419
  57. package/features/eventPublisher/__tests__/EventPublisher.test.js.map +1 -1
  58. package/features/eventPublisher/abstractions.js +7 -12
  59. package/features/eventPublisher/abstractions.js.map +1 -1
  60. package/features/eventPublisher/feature.js +8 -7
  61. package/features/eventPublisher/feature.js.map +1 -1
  62. package/features/eventPublisher/index.js +0 -2
  63. package/features/featureFlags/FeatureFlags.js +15 -12
  64. package/features/featureFlags/FeatureFlags.js.map +1 -1
  65. package/features/featureFlags/abstractions.js +2 -1
  66. package/features/featureFlags/abstractions.js.map +1 -1
  67. package/features/featureFlags/feature.js +6 -5
  68. package/features/featureFlags/feature.js.map +1 -1
  69. package/features/keyValueStore/GlobalKeyValueStore.js +28 -23
  70. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  71. package/features/keyValueStore/KeyValueStore.js +30 -27
  72. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  73. package/features/keyValueStore/KeyValueStoreRepository.d.ts +2 -2
  74. package/features/keyValueStore/KeyValueStoreRepository.js +34 -41
  75. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  76. package/features/keyValueStore/abstractions.d.ts +6 -2
  77. package/features/keyValueStore/abstractions.js +5 -20
  78. package/features/keyValueStore/abstractions.js.map +1 -1
  79. package/features/keyValueStore/errors.js +16 -17
  80. package/features/keyValueStore/errors.js.map +1 -1
  81. package/features/keyValueStore/feature.js +9 -9
  82. package/features/keyValueStore/feature.js.map +1 -1
  83. package/features/keyValueStore/index.js +1 -3
  84. package/features/logger/LoggerService.js +41 -45
  85. package/features/logger/LoggerService.js.map +1 -1
  86. package/features/logger/abstractions.js +2 -2
  87. package/features/logger/abstractions.js.map +1 -1
  88. package/features/logger/feature.js +6 -5
  89. package/features/logger/feature.js.map +1 -1
  90. package/features/logger/index.js +0 -2
  91. package/features/masker/Masker.js +11 -14
  92. package/features/masker/Masker.js.map +1 -1
  93. package/features/masker/abstractions.js +2 -1
  94. package/features/masker/abstractions.js.map +1 -1
  95. package/features/masker/feature.js +7 -6
  96. package/features/masker/feature.js.map +1 -1
  97. package/features/masker/index.js +0 -2
  98. package/features/security/IdentityContext/AnonymousIdentity.js +12 -16
  99. package/features/security/IdentityContext/AnonymousIdentity.js.map +1 -1
  100. package/features/security/IdentityContext/AuthenticatedIdentity.js +5 -8
  101. package/features/security/IdentityContext/AuthenticatedIdentity.js.map +1 -1
  102. package/features/security/IdentityContext/Identity.js +63 -71
  103. package/features/security/IdentityContext/Identity.js.map +1 -1
  104. package/features/security/IdentityContext/IdentityContext.js +69 -106
  105. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  106. package/features/security/IdentityContext/abstractions.js +2 -2
  107. package/features/security/IdentityContext/abstractions.js.map +1 -1
  108. package/features/security/IdentityContext/feature.js +6 -5
  109. package/features/security/IdentityContext/feature.js.map +1 -1
  110. package/features/security/IdentityContext/index.js +0 -3
  111. package/features/security/SecurityFeature.js +13 -21
  112. package/features/security/SecurityFeature.js.map +1 -1
  113. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +48 -49
  114. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  115. package/features/security/apiKeys/CreateApiKey/abstractions.js +2 -2
  116. package/features/security/apiKeys/CreateApiKey/abstractions.js.map +1 -1
  117. package/features/security/apiKeys/CreateApiKey/events.js +17 -16
  118. package/features/security/apiKeys/CreateApiKey/events.js.map +1 -1
  119. package/features/security/apiKeys/CreateApiKey/feature.js +6 -5
  120. package/features/security/apiKeys/CreateApiKey/feature.js.map +1 -1
  121. package/features/security/apiKeys/CreateApiKey/index.js +0 -2
  122. package/features/security/apiKeys/DeleteApiKey/DeleteApiKeyUseCase.js +29 -30
  123. package/features/security/apiKeys/DeleteApiKey/DeleteApiKeyUseCase.js.map +1 -1
  124. package/features/security/apiKeys/DeleteApiKey/abstractions.js +2 -2
  125. package/features/security/apiKeys/DeleteApiKey/abstractions.js.map +1 -1
  126. package/features/security/apiKeys/DeleteApiKey/events.js +17 -16
  127. package/features/security/apiKeys/DeleteApiKey/events.js.map +1 -1
  128. package/features/security/apiKeys/DeleteApiKey/feature.js +6 -5
  129. package/features/security/apiKeys/DeleteApiKey/feature.js.map +1 -1
  130. package/features/security/apiKeys/DeleteApiKey/index.js +0 -2
  131. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js +16 -14
  132. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
  133. package/features/security/apiKeys/GetApiKey/abstractions.js +2 -2
  134. package/features/security/apiKeys/GetApiKey/abstractions.js.map +1 -1
  135. package/features/security/apiKeys/GetApiKey/feature.js +6 -5
  136. package/features/security/apiKeys/GetApiKey/feature.js.map +1 -1
  137. package/features/security/apiKeys/GetApiKey/index.js +0 -2
  138. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js +13 -10
  139. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
  140. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js +2 -2
  141. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  142. package/features/security/apiKeys/GetApiKeyBySlug/feature.js +6 -5
  143. package/features/security/apiKeys/GetApiKeyBySlug/feature.js.map +1 -1
  144. package/features/security/apiKeys/GetApiKeyBySlug/index.js +0 -2
  145. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js +13 -10
  146. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
  147. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js +2 -2
  148. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  149. package/features/security/apiKeys/GetApiKeyByToken/feature.js +6 -5
  150. package/features/security/apiKeys/GetApiKeyByToken/feature.js.map +1 -1
  151. package/features/security/apiKeys/GetApiKeyByToken/index.js +0 -2
  152. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js +17 -17
  153. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js.map +1 -1
  154. package/features/security/apiKeys/ListApiKeys/abstractions.js +2 -2
  155. package/features/security/apiKeys/ListApiKeys/abstractions.js.map +1 -1
  156. package/features/security/apiKeys/ListApiKeys/feature.js +6 -5
  157. package/features/security/apiKeys/ListApiKeys/feature.js.map +1 -1
  158. package/features/security/apiKeys/ListApiKeys/index.js +0 -2
  159. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +39 -42
  160. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  161. package/features/security/apiKeys/UpdateApiKey/abstractions.js +2 -2
  162. package/features/security/apiKeys/UpdateApiKey/abstractions.js.map +1 -1
  163. package/features/security/apiKeys/UpdateApiKey/events.js +17 -16
  164. package/features/security/apiKeys/UpdateApiKey/events.js.map +1 -1
  165. package/features/security/apiKeys/UpdateApiKey/feature.js +6 -5
  166. package/features/security/apiKeys/UpdateApiKey/feature.js.map +1 -1
  167. package/features/security/apiKeys/UpdateApiKey/index.js +0 -2
  168. package/features/security/apiKeys/feature.js +14 -16
  169. package/features/security/apiKeys/feature.js.map +1 -1
  170. package/features/security/apiKeys/shared/ApiKeyProvider.js +42 -42
  171. package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
  172. package/features/security/apiKeys/shared/ApiKeysRepository.js +108 -135
  173. package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
  174. package/features/security/apiKeys/shared/abstractions.js +4 -6
  175. package/features/security/apiKeys/shared/abstractions.js.map +1 -1
  176. package/features/security/apiKeys/shared/errors.js +29 -32
  177. package/features/security/apiKeys/shared/errors.js.map +1 -1
  178. package/features/security/apiKeys/shared/generateToken.js +6 -16
  179. package/features/security/apiKeys/shared/generateToken.js.map +1 -1
  180. package/features/security/apiKeys/shared/schemas.js +27 -23
  181. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  182. package/features/security/apiKeys/shared/types.js +0 -3
  183. package/features/security/authentication/AuthenticationContext/AuthenticationContext.js +44 -38
  184. package/features/security/authentication/AuthenticationContext/AuthenticationContext.js.map +1 -1
  185. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js +33 -43
  186. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js.map +1 -1
  187. package/features/security/authentication/AuthenticationContext/abstractions.js +2 -2
  188. package/features/security/authentication/AuthenticationContext/abstractions.js.map +1 -1
  189. package/features/security/authentication/AuthenticationContext/errors.js +51 -116
  190. package/features/security/authentication/AuthenticationContext/errors.js.map +1 -1
  191. package/features/security/authentication/AuthenticationContext/events.js +17 -16
  192. package/features/security/authentication/AuthenticationContext/events.js.map +1 -1
  193. package/features/security/authentication/AuthenticationContext/feature.js +6 -5
  194. package/features/security/authentication/AuthenticationContext/feature.js.map +1 -1
  195. package/features/security/authentication/AuthenticationContext/index.js +2 -4
  196. package/features/security/authentication/Authenticator/abstractions.js +2 -2
  197. package/features/security/authentication/Authenticator/abstractions.js.map +1 -1
  198. package/features/security/authentication/Authenticator/index.js +0 -2
  199. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +46 -59
  200. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  201. package/features/security/authorization/AuthorizationContext/abstractions.js +3 -4
  202. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  203. package/features/security/authorization/AuthorizationContext/feature.js +10 -9
  204. package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
  205. package/features/security/authorization/AuthorizationContext/index.js +1 -4
  206. package/features/security/authorization/Authorizer/abstractions.js +2 -2
  207. package/features/security/authorization/Authorizer/abstractions.js.map +1 -1
  208. package/features/security/authorization/Authorizer/index.js +0 -2
  209. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +60 -64
  210. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
  211. package/features/security/authorization/GroupsTeamsAuthorizer/RolesTeamsAuthorizer.js +26 -40
  212. package/features/security/authorization/GroupsTeamsAuthorizer/RolesTeamsAuthorizer.js.map +1 -1
  213. package/features/security/authorization/GroupsTeamsAuthorizer/abstractions.js +2 -1
  214. package/features/security/authorization/GroupsTeamsAuthorizer/abstractions.js.map +1 -1
  215. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +7 -6
  216. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  217. package/features/security/login/abstractions.js +9 -8
  218. package/features/security/login/abstractions.js.map +1 -1
  219. package/features/security/login/index.js +0 -2
  220. package/features/security/permissions/createPermissionSchema.js +6 -5
  221. package/features/security/permissions/createPermissionSchema.js.map +1 -1
  222. package/features/security/permissions/createPermissions.js +148 -236
  223. package/features/security/permissions/createPermissions.js.map +1 -1
  224. package/features/security/permissions/index.js +0 -2
  225. package/features/security/permissions/types.js +0 -3
  226. package/features/security/roles/CreateRole/CreateRoleUseCase.js +53 -59
  227. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  228. package/features/security/roles/CreateRole/abstractions.js +2 -2
  229. package/features/security/roles/CreateRole/abstractions.js.map +1 -1
  230. package/features/security/roles/CreateRole/events.js +17 -16
  231. package/features/security/roles/CreateRole/events.js.map +1 -1
  232. package/features/security/roles/CreateRole/feature.js +6 -5
  233. package/features/security/roles/CreateRole/feature.js.map +1 -1
  234. package/features/security/roles/CreateRole/index.js +0 -2
  235. package/features/security/roles/CreateRole/schema.js +8 -7
  236. package/features/security/roles/CreateRole/schema.js.map +1 -1
  237. package/features/security/roles/DeleteRole/DeleteRoleUseCase.js +35 -41
  238. package/features/security/roles/DeleteRole/DeleteRoleUseCase.js.map +1 -1
  239. package/features/security/roles/DeleteRole/abstractions.js +2 -2
  240. package/features/security/roles/DeleteRole/abstractions.js.map +1 -1
  241. package/features/security/roles/DeleteRole/events.js +17 -16
  242. package/features/security/roles/DeleteRole/events.js.map +1 -1
  243. package/features/security/roles/DeleteRole/feature.js +6 -5
  244. package/features/security/roles/DeleteRole/feature.js.map +1 -1
  245. package/features/security/roles/DeleteRole/index.js +0 -2
  246. package/features/security/roles/GetRole/GetRoleUseCase.js +19 -18
  247. package/features/security/roles/GetRole/GetRoleUseCase.js.map +1 -1
  248. package/features/security/roles/GetRole/abstractions.js +2 -2
  249. package/features/security/roles/GetRole/abstractions.js.map +1 -1
  250. package/features/security/roles/GetRole/feature.js +6 -5
  251. package/features/security/roles/GetRole/feature.js.map +1 -1
  252. package/features/security/roles/GetRole/index.js +0 -2
  253. package/features/security/roles/Installer/RolesInstaller.js +38 -35
  254. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  255. package/features/security/roles/ListRoles/ListRolesUseCase.js +18 -17
  256. package/features/security/roles/ListRoles/ListRolesUseCase.js.map +1 -1
  257. package/features/security/roles/ListRoles/abstractions.js +2 -2
  258. package/features/security/roles/ListRoles/abstractions.js.map +1 -1
  259. package/features/security/roles/ListRoles/feature.js +6 -5
  260. package/features/security/roles/ListRoles/feature.js.map +1 -1
  261. package/features/security/roles/ListRoles/index.js +0 -2
  262. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +43 -50
  263. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  264. package/features/security/roles/UpdateRole/abstractions.js +2 -2
  265. package/features/security/roles/UpdateRole/abstractions.js.map +1 -1
  266. package/features/security/roles/UpdateRole/events.js +17 -16
  267. package/features/security/roles/UpdateRole/events.js.map +1 -1
  268. package/features/security/roles/UpdateRole/feature.js +6 -5
  269. package/features/security/roles/UpdateRole/feature.js.map +1 -1
  270. package/features/security/roles/UpdateRole/index.js +0 -2
  271. package/features/security/roles/UpdateRole/schema.js +7 -6
  272. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  273. package/features/security/roles/feature.js +14 -18
  274. package/features/security/roles/feature.js.map +1 -1
  275. package/features/security/roles/shared/RoleProvider.js +27 -21
  276. package/features/security/roles/shared/RoleProvider.js.map +1 -1
  277. package/features/security/roles/shared/RolesRepository.js +96 -113
  278. package/features/security/roles/shared/RolesRepository.js.map +1 -1
  279. package/features/security/roles/shared/abstractions.js +3 -4
  280. package/features/security/roles/shared/abstractions.js.map +1 -1
  281. package/features/security/roles/shared/decorators/ListCache.js +23 -22
  282. package/features/security/roles/shared/decorators/ListCache.js.map +1 -1
  283. package/features/security/roles/shared/decorators/RolesRepositoryCachingDecorator.js +40 -62
  284. package/features/security/roles/shared/decorators/RolesRepositoryCachingDecorator.js.map +1 -1
  285. package/features/security/roles/shared/errors.js +50 -56
  286. package/features/security/roles/shared/errors.js.map +1 -1
  287. package/features/security/roles/shared/types.js +0 -3
  288. package/features/security/shared/abstractions.js +4 -6
  289. package/features/security/shared/abstractions.js.map +1 -1
  290. package/features/security/shared/errors.js +8 -8
  291. package/features/security/shared/errors.js.map +1 -1
  292. package/features/security/shared/index.js +0 -2
  293. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +53 -59
  294. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  295. package/features/security/teams/CreateTeam/abstractions.js +2 -2
  296. package/features/security/teams/CreateTeam/abstractions.js.map +1 -1
  297. package/features/security/teams/CreateTeam/events.js +17 -16
  298. package/features/security/teams/CreateTeam/events.js.map +1 -1
  299. package/features/security/teams/CreateTeam/feature.js +6 -5
  300. package/features/security/teams/CreateTeam/feature.js.map +1 -1
  301. package/features/security/teams/CreateTeam/index.js +0 -2
  302. package/features/security/teams/CreateTeam/schema.js +6 -5
  303. package/features/security/teams/CreateTeam/schema.js.map +1 -1
  304. package/features/security/teams/DeleteTeam/DeleteTeamUseCase.js +36 -46
  305. package/features/security/teams/DeleteTeam/DeleteTeamUseCase.js.map +1 -1
  306. package/features/security/teams/DeleteTeam/abstractions.js +2 -2
  307. package/features/security/teams/DeleteTeam/abstractions.js.map +1 -1
  308. package/features/security/teams/DeleteTeam/events.js +17 -16
  309. package/features/security/teams/DeleteTeam/events.js.map +1 -1
  310. package/features/security/teams/DeleteTeam/feature.js +6 -5
  311. package/features/security/teams/DeleteTeam/feature.js.map +1 -1
  312. package/features/security/teams/DeleteTeam/index.js +0 -2
  313. package/features/security/teams/GetTeam/GetTeamUseCase.js +17 -17
  314. package/features/security/teams/GetTeam/GetTeamUseCase.js.map +1 -1
  315. package/features/security/teams/GetTeam/abstractions.js +2 -2
  316. package/features/security/teams/GetTeam/abstractions.js.map +1 -1
  317. package/features/security/teams/GetTeam/feature.js +6 -5
  318. package/features/security/teams/GetTeam/feature.js.map +1 -1
  319. package/features/security/teams/GetTeam/index.js +0 -2
  320. package/features/security/teams/ListTeams/ListTeamsUseCase.js +20 -21
  321. package/features/security/teams/ListTeams/ListTeamsUseCase.js.map +1 -1
  322. package/features/security/teams/ListTeams/abstractions.js +2 -2
  323. package/features/security/teams/ListTeams/abstractions.js.map +1 -1
  324. package/features/security/teams/ListTeams/feature.js +6 -5
  325. package/features/security/teams/ListTeams/feature.js.map +1 -1
  326. package/features/security/teams/ListTeams/index.js +0 -2
  327. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +46 -58
  328. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  329. package/features/security/teams/UpdateTeam/abstractions.js +2 -2
  330. package/features/security/teams/UpdateTeam/abstractions.js.map +1 -1
  331. package/features/security/teams/UpdateTeam/events.js +17 -16
  332. package/features/security/teams/UpdateTeam/events.js.map +1 -1
  333. package/features/security/teams/UpdateTeam/feature.js +6 -5
  334. package/features/security/teams/UpdateTeam/feature.js.map +1 -1
  335. package/features/security/teams/UpdateTeam/index.js +0 -2
  336. package/features/security/teams/UpdateTeam/schema.js +5 -4
  337. package/features/security/teams/UpdateTeam/schema.js.map +1 -1
  338. package/features/security/teams/feature.js +13 -17
  339. package/features/security/teams/feature.js.map +1 -1
  340. package/features/security/teams/shared/TeamProvider.js +27 -21
  341. package/features/security/teams/shared/TeamProvider.js.map +1 -1
  342. package/features/security/teams/shared/TeamsRepository.js +100 -118
  343. package/features/security/teams/shared/TeamsRepository.js.map +1 -1
  344. package/features/security/teams/shared/abstractions.js +3 -4
  345. package/features/security/teams/shared/abstractions.js.map +1 -1
  346. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js +40 -62
  347. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js.map +1 -1
  348. package/features/security/teams/shared/errors.js +62 -70
  349. package/features/security/teams/shared/errors.js.map +1 -1
  350. package/features/security/teams/shared/types.js +0 -3
  351. package/features/security/utils/AppPermissions.js +50 -89
  352. package/features/security/utils/AppPermissions.js.map +1 -1
  353. package/features/security/utils/IdentityValue.js +19 -22
  354. package/features/security/utils/IdentityValue.js.map +1 -1
  355. package/features/security/utils/filterOutCustomWbyAppsPermissions.js +24 -27
  356. package/features/security/utils/filterOutCustomWbyAppsPermissions.js.map +1 -1
  357. package/features/security/utils/getPermissionsFromRoles.js +5 -10
  358. package/features/security/utils/getPermissionsFromRoles.js.map +1 -1
  359. package/features/security/utils/isJwt.js +2 -1
  360. package/features/security/utils/isJwt.js.map +1 -1
  361. package/features/security/utils/verifyJwtUsingJwk.js +6 -7
  362. package/features/security/utils/verifyJwtUsingJwk.js.map +1 -1
  363. package/features/system/InstallSystem/InstallSystemUseCase.js +45 -44
  364. package/features/system/InstallSystem/InstallSystemUseCase.js.map +1 -1
  365. package/features/system/InstallSystem/abstractions.js +3 -17
  366. package/features/system/InstallSystem/abstractions.js.map +1 -1
  367. package/features/system/InstallSystem/errors.js +15 -16
  368. package/features/system/InstallSystem/errors.js.map +1 -1
  369. package/features/system/InstallSystem/events.js +8 -5
  370. package/features/system/InstallSystem/events.js.map +1 -1
  371. package/features/system/InstallSystem/feature.js +6 -7
  372. package/features/system/InstallSystem/feature.js.map +1 -1
  373. package/features/system/InstallSystem/index.js +2 -6
  374. package/features/system/SystemFeature.js +6 -5
  375. package/features/system/SystemFeature.js.map +1 -1
  376. package/features/task/TaskController/abstractions.js +2 -10
  377. package/features/task/TaskController/abstractions.js.map +1 -1
  378. package/features/task/TaskController/index.js +0 -2
  379. package/features/task/TaskDefinition/abstractions.js +8 -40
  380. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  381. package/features/task/TaskDefinition/index.js +0 -2
  382. package/features/task/TaskService/abstractions.js +9 -13
  383. package/features/task/TaskService/abstractions.js.map +1 -1
  384. package/features/task/TaskService/index.js +0 -2
  385. package/features/tenancy/CreateTenant/CreateTenantGateway.js +14 -11
  386. package/features/tenancy/CreateTenant/CreateTenantGateway.js.map +1 -1
  387. package/features/tenancy/CreateTenant/CreateTenantRepository.js +18 -15
  388. package/features/tenancy/CreateTenant/CreateTenantRepository.js.map +1 -1
  389. package/features/tenancy/CreateTenant/CreateTenantUseCase.js +44 -41
  390. package/features/tenancy/CreateTenant/CreateTenantUseCase.js.map +1 -1
  391. package/features/tenancy/CreateTenant/abstractions.js +6 -29
  392. package/features/tenancy/CreateTenant/abstractions.js.map +1 -1
  393. package/features/tenancy/CreateTenant/decorators/CreateTenantWithWcpIncrement.js +16 -15
  394. package/features/tenancy/CreateTenant/decorators/CreateTenantWithWcpIncrement.js.map +1 -1
  395. package/features/tenancy/CreateTenant/errors.js +8 -8
  396. package/features/tenancy/CreateTenant/errors.js.map +1 -1
  397. package/features/tenancy/CreateTenant/events.js +16 -11
  398. package/features/tenancy/CreateTenant/events.js.map +1 -1
  399. package/features/tenancy/CreateTenant/feature.js +9 -8
  400. package/features/tenancy/CreateTenant/feature.js.map +1 -1
  401. package/features/tenancy/CreateTenant/index.js +2 -4
  402. package/features/tenancy/DeleteTenant/DeleteTenantGateway.js +15 -12
  403. package/features/tenancy/DeleteTenant/DeleteTenantGateway.js.map +1 -1
  404. package/features/tenancy/DeleteTenant/DeleteTenantRepository.js +22 -19
  405. package/features/tenancy/DeleteTenant/DeleteTenantRepository.js.map +1 -1
  406. package/features/tenancy/DeleteTenant/DeleteTenantUseCase.js +29 -27
  407. package/features/tenancy/DeleteTenant/DeleteTenantUseCase.js.map +1 -1
  408. package/features/tenancy/DeleteTenant/abstractions.js +6 -10
  409. package/features/tenancy/DeleteTenant/abstractions.js.map +1 -1
  410. package/features/tenancy/DeleteTenant/decorators/DeleteTenantWithWcpDecrement.js +16 -13
  411. package/features/tenancy/DeleteTenant/decorators/DeleteTenantWithWcpDecrement.js.map +1 -1
  412. package/features/tenancy/DeleteTenant/events.js +16 -11
  413. package/features/tenancy/DeleteTenant/events.js.map +1 -1
  414. package/features/tenancy/DeleteTenant/feature.js +9 -8
  415. package/features/tenancy/DeleteTenant/feature.js.map +1 -1
  416. package/features/tenancy/DeleteTenant/index.js +2 -4
  417. package/features/tenancy/GetRootTenant/GetRootTenantUseCase.js +15 -12
  418. package/features/tenancy/GetRootTenant/GetRootTenantUseCase.js.map +1 -1
  419. package/features/tenancy/GetRootTenant/abstractions.js +2 -4
  420. package/features/tenancy/GetRootTenant/abstractions.js.map +1 -1
  421. package/features/tenancy/GetRootTenant/feature.js +6 -5
  422. package/features/tenancy/GetRootTenant/feature.js.map +1 -1
  423. package/features/tenancy/GetRootTenant/index.js +0 -2
  424. package/features/tenancy/GetTenantById/GetTenantByIdGateway.js +17 -12
  425. package/features/tenancy/GetTenantById/GetTenantByIdGateway.js.map +1 -1
  426. package/features/tenancy/GetTenantById/GetTenantByIdRepository.js +18 -19
  427. package/features/tenancy/GetTenantById/GetTenantByIdRepository.js.map +1 -1
  428. package/features/tenancy/GetTenantById/GetTenantByIdUseCase.js +17 -17
  429. package/features/tenancy/GetTenantById/GetTenantByIdUseCase.js.map +1 -1
  430. package/features/tenancy/GetTenantById/abstractions.js +4 -6
  431. package/features/tenancy/GetTenantById/abstractions.js.map +1 -1
  432. package/features/tenancy/GetTenantById/feature.js +8 -12
  433. package/features/tenancy/GetTenantById/feature.js.map +1 -1
  434. package/features/tenancy/GetTenantById/index.js +1 -3
  435. package/features/tenancy/InstallTenant/DependencyResolver.js +53 -65
  436. package/features/tenancy/InstallTenant/DependencyResolver.js.map +1 -1
  437. package/features/tenancy/InstallTenant/InstallTenantUseCase.js +95 -113
  438. package/features/tenancy/InstallTenant/InstallTenantUseCase.js.map +1 -1
  439. package/features/tenancy/InstallTenant/abstractions.js +4 -15
  440. package/features/tenancy/InstallTenant/abstractions.js.map +1 -1
  441. package/features/tenancy/InstallTenant/errors.js +15 -16
  442. package/features/tenancy/InstallTenant/errors.js.map +1 -1
  443. package/features/tenancy/InstallTenant/events.js +8 -5
  444. package/features/tenancy/InstallTenant/events.js.map +1 -1
  445. package/features/tenancy/InstallTenant/feature.js +6 -5
  446. package/features/tenancy/InstallTenant/feature.js.map +1 -1
  447. package/features/tenancy/InstallTenant/index.js +1 -3
  448. package/features/tenancy/ListTenants/ListTenantsGateway.js +14 -11
  449. package/features/tenancy/ListTenants/ListTenantsGateway.js.map +1 -1
  450. package/features/tenancy/ListTenants/ListTenantsRepository.js +14 -12
  451. package/features/tenancy/ListTenants/ListTenantsRepository.js.map +1 -1
  452. package/features/tenancy/ListTenants/ListTenantsUseCase.js +16 -14
  453. package/features/tenancy/ListTenants/ListTenantsUseCase.js.map +1 -1
  454. package/features/tenancy/ListTenants/abstractions.js +4 -12
  455. package/features/tenancy/ListTenants/abstractions.js.map +1 -1
  456. package/features/tenancy/ListTenants/feature.js +8 -7
  457. package/features/tenancy/ListTenants/feature.js.map +1 -1
  458. package/features/tenancy/ListTenants/index.js +1 -3
  459. package/features/tenancy/TenancyFeature.js +20 -26
  460. package/features/tenancy/TenancyFeature.js.map +1 -1
  461. package/features/tenancy/TenantContext/TenantContext.js +46 -48
  462. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  463. package/features/tenancy/TenantContext/abstractions.js +2 -2
  464. package/features/tenancy/TenantContext/abstractions.js.map +1 -1
  465. package/features/tenancy/TenantContext/errors.js +7 -7
  466. package/features/tenancy/TenantContext/errors.js.map +1 -1
  467. package/features/tenancy/TenantContext/feature.js +6 -5
  468. package/features/tenancy/TenantContext/feature.js.map +1 -1
  469. package/features/tenancy/TenantContext/index.js +0 -2
  470. package/features/tenancy/UpdateTenant/UpdateTenantGateway.js +14 -11
  471. package/features/tenancy/UpdateTenant/UpdateTenantGateway.js.map +1 -1
  472. package/features/tenancy/UpdateTenant/UpdateTenantRepository.js +19 -16
  473. package/features/tenancy/UpdateTenant/UpdateTenantRepository.js.map +1 -1
  474. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.js +37 -36
  475. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.js.map +1 -1
  476. package/features/tenancy/UpdateTenant/abstractions.js +6 -10
  477. package/features/tenancy/UpdateTenant/abstractions.js.map +1 -1
  478. package/features/tenancy/UpdateTenant/events.js +16 -11
  479. package/features/tenancy/UpdateTenant/events.js.map +1 -1
  480. package/features/tenancy/UpdateTenant/feature.js +8 -7
  481. package/features/tenancy/UpdateTenant/feature.js.map +1 -1
  482. package/features/tenancy/UpdateTenant/index.js +2 -4
  483. package/features/tenancy/shared/TenantCache.js +18 -17
  484. package/features/tenancy/shared/TenantCache.js.map +1 -1
  485. package/features/tenancy/shared/abstractions.js +2 -1
  486. package/features/tenancy/shared/abstractions.js.map +1 -1
  487. package/features/tenancy/shared/storageOperations.js +2 -5
  488. package/features/tenancy/shared/storageOperations.js.map +1 -1
  489. package/features/users/AdminUsersFeature.js +15 -19
  490. package/features/users/AdminUsersFeature.js.map +1 -1
  491. package/features/users/CreateUser/CreateUserUseCase.js +65 -100
  492. package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
  493. package/features/users/CreateUser/abstractions.js +2 -13
  494. package/features/users/CreateUser/abstractions.js.map +1 -1
  495. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.js +16 -15
  496. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.js.map +1 -1
  497. package/features/users/CreateUser/events.js +17 -18
  498. package/features/users/CreateUser/events.js.map +1 -1
  499. package/features/users/CreateUser/feature.js +7 -6
  500. package/features/users/CreateUser/feature.js.map +1 -1
  501. package/features/users/CreateUser/index.js +0 -2
  502. package/features/users/CreateUser/schema.js +14 -18
  503. package/features/users/CreateUser/schema.js.map +1 -1
  504. package/features/users/DeleteUser/DeleteUserUseCase.js +35 -50
  505. package/features/users/DeleteUser/DeleteUserUseCase.js.map +1 -1
  506. package/features/users/DeleteUser/abstractions.js +2 -13
  507. package/features/users/DeleteUser/abstractions.js.map +1 -1
  508. package/features/users/DeleteUser/decorators/DeleteUserWithWcpDecrement.js +15 -16
  509. package/features/users/DeleteUser/decorators/DeleteUserWithWcpDecrement.js.map +1 -1
  510. package/features/users/DeleteUser/errors.js +7 -7
  511. package/features/users/DeleteUser/errors.js.map +1 -1
  512. package/features/users/DeleteUser/events.js +17 -18
  513. package/features/users/DeleteUser/events.js.map +1 -1
  514. package/features/users/DeleteUser/feature.js +7 -6
  515. package/features/users/DeleteUser/feature.js.map +1 -1
  516. package/features/users/DeleteUser/index.js +0 -2
  517. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js +60 -74
  518. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js.map +1 -1
  519. package/features/users/ExternalIdpUserSync/feature.js +6 -5
  520. package/features/users/ExternalIdpUserSync/feature.js.map +1 -1
  521. package/features/users/ExternalIdpUserSync/index.js +0 -2
  522. package/features/users/GetIdentityProfile/GetIdentityProfileUseCase.js +29 -39
  523. package/features/users/GetIdentityProfile/GetIdentityProfileUseCase.js.map +1 -1
  524. package/features/users/GetIdentityProfile/abstractions.js +2 -11
  525. package/features/users/GetIdentityProfile/abstractions.js.map +1 -1
  526. package/features/users/GetIdentityProfile/feature.js +6 -5
  527. package/features/users/GetIdentityProfile/feature.js.map +1 -1
  528. package/features/users/GetIdentityProfile/index.js +0 -2
  529. package/features/users/GetIdentityProfile/types.js +0 -3
  530. package/features/users/GetUser/GetUserUseCase.js +19 -23
  531. package/features/users/GetUser/GetUserUseCase.js.map +1 -1
  532. package/features/users/GetUser/abstractions.js +2 -11
  533. package/features/users/GetUser/abstractions.js.map +1 -1
  534. package/features/users/GetUser/feature.js +6 -5
  535. package/features/users/GetUser/feature.js.map +1 -1
  536. package/features/users/GetUser/index.js +0 -2
  537. package/features/users/ListUserTeams/ListUserTeamsUseCase.js +33 -42
  538. package/features/users/ListUserTeams/ListUserTeamsUseCase.js.map +1 -1
  539. package/features/users/ListUserTeams/abstractions.js +2 -11
  540. package/features/users/ListUserTeams/abstractions.js.map +1 -1
  541. package/features/users/ListUserTeams/feature.js +6 -5
  542. package/features/users/ListUserTeams/feature.js.map +1 -1
  543. package/features/users/ListUserTeams/index.js +0 -2
  544. package/features/users/ListUsers/ListUsersUseCase.js +19 -23
  545. package/features/users/ListUsers/ListUsersUseCase.js.map +1 -1
  546. package/features/users/ListUsers/abstractions.js +2 -11
  547. package/features/users/ListUsers/abstractions.js.map +1 -1
  548. package/features/users/ListUsers/feature.js +6 -5
  549. package/features/users/ListUsers/feature.js.map +1 -1
  550. package/features/users/ListUsers/index.js +0 -2
  551. package/features/users/UpdateUser/UpdateUserUseCase.js +52 -74
  552. package/features/users/UpdateUser/UpdateUserUseCase.js.map +1 -1
  553. package/features/users/UpdateUser/abstractions.js +2 -13
  554. package/features/users/UpdateUser/abstractions.js.map +1 -1
  555. package/features/users/UpdateUser/events.js +17 -18
  556. package/features/users/UpdateUser/events.js.map +1 -1
  557. package/features/users/UpdateUser/feature.js +6 -5
  558. package/features/users/UpdateUser/feature.js.map +1 -1
  559. package/features/users/UpdateUser/index.js +0 -2
  560. package/features/users/UpdateUser/schema.js +11 -10
  561. package/features/users/UpdateUser/schema.js.map +1 -1
  562. package/features/users/shared/AdminUsersRepository.js +104 -112
  563. package/features/users/shared/AdminUsersRepository.js.map +1 -1
  564. package/features/users/shared/abstractions.js +2 -9
  565. package/features/users/shared/abstractions.js.map +1 -1
  566. package/features/users/shared/errors.js +40 -46
  567. package/features/users/shared/errors.js.map +1 -1
  568. package/features/users/shared/loaders.js +52 -66
  569. package/features/users/shared/loaders.js.map +1 -1
  570. package/features/users/shared/storageAbstractions.js +2 -2
  571. package/features/users/shared/storageAbstractions.js.map +1 -1
  572. package/features/users/shared/types.js +0 -3
  573. package/features/wcp/WcpContext/WcpContext.js +138 -142
  574. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  575. package/features/wcp/WcpContext/abstractions.js +2 -6
  576. package/features/wcp/WcpContext/abstractions.js.map +1 -1
  577. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +135 -134
  578. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  579. package/features/wcp/WcpContext/feature.js +6 -5
  580. package/features/wcp/WcpContext/feature.js.map +1 -1
  581. package/features/wcp/WcpContext/index.js +0 -2
  582. package/features/wcp/WcpContext/types.js +0 -3
  583. package/features/wcp/WcpContext/utils.js +35 -53
  584. package/features/wcp/WcpContext/utils.js.map +1 -1
  585. package/features/wcp/WcpFeature.js +7 -6
  586. package/features/wcp/WcpFeature.js.map +1 -1
  587. package/graphql/security/NotAuthorizedResponse.js +11 -14
  588. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  589. package/graphql/security/ProfileMapper.js +12 -11
  590. package/graphql/security/ProfileMapper.js.map +1 -1
  591. package/graphql/security/apiKey.gql.js +38 -47
  592. package/graphql/security/apiKey.gql.js.map +1 -1
  593. package/graphql/security/base.gql.js +11 -10
  594. package/graphql/security/base.gql.js.map +1 -1
  595. package/graphql/security/identity.gql.js +87 -97
  596. package/graphql/security/identity.gql.js.map +1 -1
  597. package/graphql/security/index.js +13 -8
  598. package/graphql/security/index.js.map +1 -1
  599. package/graphql/security/role.gql.js +49 -57
  600. package/graphql/security/role.gql.js.map +1 -1
  601. package/graphql/security/team.gql.js +61 -69
  602. package/graphql/security/team.gql.js.map +1 -1
  603. package/graphql/system/createSystemGraphQL.js +31 -34
  604. package/graphql/system/createSystemGraphQL.js.map +1 -1
  605. package/graphql/users/user.gql.js +87 -105
  606. package/graphql/users/user.gql.js.map +1 -1
  607. package/graphql/wcp/graphql.js +25 -28
  608. package/graphql/wcp/graphql.js.map +1 -1
  609. package/idp/JwksCache.js +22 -28
  610. package/idp/JwksCache.js.map +1 -1
  611. package/idp/JwtAuthenticator.js +34 -46
  612. package/idp/JwtAuthenticator.js.map +1 -1
  613. package/idp/OidcJwtIdentityProvider.js +55 -82
  614. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  615. package/idp/abstractions.js +5 -14
  616. package/idp/abstractions.js.map +1 -1
  617. package/idp/feature.js +8 -7
  618. package/idp/feature.js.map +1 -1
  619. package/idp/index.js +1 -3
  620. package/idp/types.js +0 -3
  621. package/index.js +0 -2
  622. package/legacy/security/LegacyContext.js +133 -186
  623. package/legacy/security/LegacyContext.js.map +1 -1
  624. package/legacy/security/createSecurityContext.js +5 -9
  625. package/legacy/security/createSecurityContext.js.map +1 -1
  626. package/legacy/security/plugins/apiKeyAuthentication.js +15 -24
  627. package/legacy/security/plugins/apiKeyAuthentication.js.map +1 -1
  628. package/legacy/security/plugins/apiKeyAuthorization.js +9 -18
  629. package/legacy/security/plugins/apiKeyAuthorization.js.map +1 -1
  630. package/legacy/security/plugins/authenticateUsingCookie.js +18 -22
  631. package/legacy/security/plugins/authenticateUsingCookie.js.map +1 -1
  632. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +1 -1
  633. package/legacy/security/plugins/authenticateUsingHttpHeader.js +15 -18
  634. package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +1 -1
  635. package/legacy/security/plugins/secureHeaders.js +28 -21
  636. package/legacy/security/plugins/secureHeaders.js.map +1 -1
  637. package/legacy/tenancy/LegacyContext.js +45 -52
  638. package/legacy/tenancy/LegacyContext.js.map +1 -1
  639. package/legacy/tenancy/createTenancyContext.js +22 -42
  640. package/legacy/tenancy/createTenancyContext.js.map +1 -1
  641. package/legacy/users/LegacyContext.js +39 -54
  642. package/legacy/users/LegacyContext.js.map +1 -1
  643. package/legacy/users/createAdminUsersContext.js +7 -7
  644. package/legacy/users/createAdminUsersContext.js.map +1 -1
  645. package/legacy/wcp/LegacyWcpContext.js +80 -79
  646. package/legacy/wcp/LegacyWcpContext.js.map +1 -1
  647. package/legacy/wcp/context.d.ts +1 -3
  648. package/legacy/wcp/context.js +33 -37
  649. package/legacy/wcp/context.js.map +1 -1
  650. package/models/base/BaseModel.js +51 -56
  651. package/models/base/BaseModel.js.map +1 -1
  652. package/models/base/ModelBuilder.js +65 -78
  653. package/models/base/ModelBuilder.js.map +1 -1
  654. package/models/base/ModelFactory.js +0 -3
  655. package/models/base/__tests__/ModelBuilder.test.js +437 -454
  656. package/models/base/__tests__/ModelBuilder.test.js.map +1 -1
  657. package/models/base/abstractions.js +0 -3
  658. package/models/cms/FieldBuilder.js +112 -121
  659. package/models/cms/FieldBuilder.js.map +1 -1
  660. package/models/cms/FieldBuilderRegistry.js +13 -12
  661. package/models/cms/FieldBuilderRegistry.js.map +1 -1
  662. package/models/cms/FieldDefinitionsBuilder.js +37 -54
  663. package/models/cms/FieldDefinitionsBuilder.js.map +1 -1
  664. package/models/cms/PrivateCmsModelBuilder.js +84 -89
  665. package/models/cms/PrivateCmsModelBuilder.js.map +1 -1
  666. package/models/cms/PrivatePage/Page.fields.js +7 -6
  667. package/models/cms/PrivatePage/Page.fields.js.map +1 -1
  668. package/models/cms/PrivatePage/PageModelBuilder.js +18 -15
  669. package/models/cms/PrivatePage/PageModelBuilder.js.map +1 -1
  670. package/models/cms/PrivatePage/PageModelFactory.js +20 -25
  671. package/models/cms/PrivatePage/PageModelFactory.js.map +1 -1
  672. package/models/cms/PrivatePage/__tests__/PageModelFactory.test.js +218 -234
  673. package/models/cms/PrivatePage/__tests__/PageModelFactory.test.js.map +1 -1
  674. package/models/cms/PrivatePage/__tests__/PagePublishingDecorator.js +33 -36
  675. package/models/cms/PrivatePage/__tests__/PagePublishingDecorator.js.map +1 -1
  676. package/models/cms/PrivatePage/__tests__/PageSeoDecorator.js +25 -26
  677. package/models/cms/PrivatePage/__tests__/PageSeoDecorator.js.map +1 -1
  678. package/models/cms/PrivatePage/abstractions.js +3 -9
  679. package/models/cms/PrivatePage/abstractions.js.map +1 -1
  680. package/models/cms/__tests__/PrivateCmsModelBuilder.test.js +173 -185
  681. package/models/cms/__tests__/PrivateCmsModelBuilder.test.js.map +1 -1
  682. package/models/cms/abstractions.js +3 -20
  683. package/models/cms/abstractions.js.map +1 -1
  684. package/models/cms/types.js +0 -3
  685. package/models/simple/Page/PageModelBuilder.js +15 -14
  686. package/models/simple/Page/PageModelBuilder.js.map +1 -1
  687. package/models/simple/Page/PageModelFactory.js +16 -15
  688. package/models/simple/Page/PageModelFactory.js.map +1 -1
  689. package/models/simple/Page/__tests__/PageModelBuilderDecorator.js +21 -20
  690. package/models/simple/Page/__tests__/PageModelBuilderDecorator.js.map +1 -1
  691. package/models/simple/Page/__tests__/PageModelBuilderDecorator2.js +17 -16
  692. package/models/simple/Page/__tests__/PageModelBuilderDecorator2.js.map +1 -1
  693. package/models/simple/Page/__tests__/PageModelFactory.test.js +28 -28
  694. package/models/simple/Page/__tests__/PageModelFactory.test.js.map +1 -1
  695. package/models/simple/Page/abstractions.js +9 -8
  696. package/models/simple/Page/abstractions.js.map +1 -1
  697. package/package.json +21 -21
  698. package/types/core.js +0 -3
  699. package/types/security.js +0 -3
  700. package/types/tenancy.js +0 -3
  701. package/types/users.js +0 -3
  702. package/domain/tenancy/errors.js.map +0 -1
  703. package/exports/api/build-params.js.map +0 -1
  704. package/exports/api/event-publisher.js.map +0 -1
  705. package/exports/api/graphql.js.map +0 -1
  706. package/exports/api/key-value-store.js.map +0 -1
  707. package/exports/api/logger.js.map +0 -1
  708. package/exports/api/security/api-key.js.map +0 -1
  709. package/exports/api/security/authentication.js.map +0 -1
  710. package/exports/api/security/role.js.map +0 -1
  711. package/exports/api/security/user.js.map +0 -1
  712. package/exports/api/security.js.map +0 -1
  713. package/exports/api/system.js.map +0 -1
  714. package/exports/api/tasks.js.map +0 -1
  715. package/exports/api/tenancy.js.map +0 -1
  716. package/exports/api.js.map +0 -1
  717. package/features/ai/index.js.map +0 -1
  718. package/features/buildParams/index.js.map +0 -1
  719. package/features/encryption/index.js.map +0 -1
  720. package/features/eventPublisher/index.js.map +0 -1
  721. package/features/keyValueStore/index.js.map +0 -1
  722. package/features/logger/index.js.map +0 -1
  723. package/features/masker/index.js.map +0 -1
  724. package/features/security/IdentityContext/index.js.map +0 -1
  725. package/features/security/apiKeys/CreateApiKey/index.js.map +0 -1
  726. package/features/security/apiKeys/DeleteApiKey/index.js.map +0 -1
  727. package/features/security/apiKeys/GetApiKey/index.js.map +0 -1
  728. package/features/security/apiKeys/GetApiKeyBySlug/index.js.map +0 -1
  729. package/features/security/apiKeys/GetApiKeyByToken/index.js.map +0 -1
  730. package/features/security/apiKeys/ListApiKeys/index.js.map +0 -1
  731. package/features/security/apiKeys/UpdateApiKey/index.js.map +0 -1
  732. package/features/security/apiKeys/shared/types.js.map +0 -1
  733. package/features/security/authentication/AuthenticationContext/index.js.map +0 -1
  734. package/features/security/authentication/Authenticator/index.js.map +0 -1
  735. package/features/security/authorization/AuthorizationContext/index.js.map +0 -1
  736. package/features/security/authorization/Authorizer/index.js.map +0 -1
  737. package/features/security/login/index.js.map +0 -1
  738. package/features/security/permissions/index.js.map +0 -1
  739. package/features/security/permissions/types.js.map +0 -1
  740. package/features/security/roles/CreateRole/index.js.map +0 -1
  741. package/features/security/roles/DeleteRole/index.js.map +0 -1
  742. package/features/security/roles/GetRole/index.js.map +0 -1
  743. package/features/security/roles/ListRoles/index.js.map +0 -1
  744. package/features/security/roles/UpdateRole/index.js.map +0 -1
  745. package/features/security/roles/shared/types.js.map +0 -1
  746. package/features/security/shared/index.js.map +0 -1
  747. package/features/security/teams/CreateTeam/index.js.map +0 -1
  748. package/features/security/teams/DeleteTeam/index.js.map +0 -1
  749. package/features/security/teams/GetTeam/index.js.map +0 -1
  750. package/features/security/teams/ListTeams/index.js.map +0 -1
  751. package/features/security/teams/UpdateTeam/index.js.map +0 -1
  752. package/features/security/teams/shared/types.js.map +0 -1
  753. package/features/system/InstallSystem/index.js.map +0 -1
  754. package/features/task/TaskController/index.js.map +0 -1
  755. package/features/task/TaskDefinition/index.js.map +0 -1
  756. package/features/task/TaskService/index.js.map +0 -1
  757. package/features/tenancy/CreateTenant/index.js.map +0 -1
  758. package/features/tenancy/DeleteTenant/index.js.map +0 -1
  759. package/features/tenancy/GetRootTenant/index.js.map +0 -1
  760. package/features/tenancy/GetTenantById/index.js.map +0 -1
  761. package/features/tenancy/InstallTenant/index.js.map +0 -1
  762. package/features/tenancy/ListTenants/index.js.map +0 -1
  763. package/features/tenancy/TenantContext/index.js.map +0 -1
  764. package/features/tenancy/UpdateTenant/index.js.map +0 -1
  765. package/features/users/CreateUser/index.js.map +0 -1
  766. package/features/users/DeleteUser/index.js.map +0 -1
  767. package/features/users/ExternalIdpUserSync/index.js.map +0 -1
  768. package/features/users/GetIdentityProfile/index.js.map +0 -1
  769. package/features/users/GetIdentityProfile/types.js.map +0 -1
  770. package/features/users/GetUser/index.js.map +0 -1
  771. package/features/users/ListUserTeams/index.js.map +0 -1
  772. package/features/users/ListUsers/index.js.map +0 -1
  773. package/features/users/UpdateUser/index.js.map +0 -1
  774. package/features/users/shared/types.js.map +0 -1
  775. package/features/wcp/WcpContext/index.js.map +0 -1
  776. package/features/wcp/WcpContext/types.js.map +0 -1
  777. package/idp/index.js.map +0 -1
  778. package/idp/types.js.map +0 -1
  779. package/index.js.map +0 -1
  780. package/models/base/ModelFactory.js.map +0 -1
  781. package/models/base/abstractions.js.map +0 -1
  782. package/models/cms/types.js.map +0 -1
  783. package/types/core.js.map +0 -1
  784. package/types/security.js.map +0 -1
  785. package/types/tenancy.js.map +0 -1
  786. package/types/users.js.map +0 -1
@@ -1,29 +1,33 @@
1
1
  import { z } from "zod";
2
- export const createApiKeyInputSchema = z.object({
3
- name: z.string().min(1),
4
- slug: z.string().min(1),
5
- description: z.string(),
6
- permissions: z.array(z.looseObject({
7
- name: z.string()
8
- })).optional().default([])
2
+ const createApiKeyInputSchema = z.object({
3
+ name: z.string().min(1),
4
+ slug: z.string().min(1),
5
+ description: z.string(),
6
+ permissions: z.array(z.looseObject({
7
+ name: z.string()
8
+ })).optional().default([])
9
9
  });
10
- export const updateApiKeyInputSchema = z.object({
11
- name: z.string().min(1).optional(),
12
- description: z.string().optional(),
13
- permissions: z.array(z.looseObject({
14
- name: z.string()
15
- })).optional().default([])
16
- });
17
- export const listApiKeysInputSchema = z.object({
18
- where: z.object({
19
- name: z.string().optional(),
20
- name_contains: z.string().optional(),
10
+ const updateApiKeyInputSchema = z.object({
11
+ name: z.string().min(1).optional(),
21
12
  description: z.string().optional(),
22
- description_contains: z.string().optional()
23
- }).optional(),
24
- limit: z.number().int().positive().max(100).optional(),
25
- after: z.string().optional(),
26
- sort: z.array(z.enum(["createdOn_ASC", "createdOn_DESC"])).optional()
13
+ permissions: z.array(z.looseObject({
14
+ name: z.string()
15
+ })).optional().default([])
16
+ });
17
+ const listApiKeysInputSchema = z.object({
18
+ where: z.object({
19
+ name: z.string().optional(),
20
+ name_contains: z.string().optional(),
21
+ description: z.string().optional(),
22
+ description_contains: z.string().optional()
23
+ }).optional(),
24
+ limit: z.number().int().positive().max(100).optional(),
25
+ after: z.string().optional(),
26
+ sort: z.array(z["enum"]([
27
+ "createdOn_ASC",
28
+ "createdOn_DESC"
29
+ ])).optional()
27
30
  });
31
+ export { createApiKeyInputSchema, listApiKeysInputSchema, updateApiKeyInputSchema };
28
32
 
29
33
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["z","createApiKeyInputSchema","object","name","string","min","slug","description","permissions","array","looseObject","optional","default","updateApiKeyInputSchema","listApiKeysInputSchema","where","name_contains","description_contains","limit","number","int","positive","max","after","sort","enum"],"sources":["schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n description: z.string(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const updateApiKeyInputSchema = z.object({\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const listApiKeysInputSchema = z.object({\n where: z\n .object({\n name: z.string().optional(),\n name_contains: z.string().optional(),\n description: z.string().optional(),\n description_contains: z.string().optional()\n })\n .optional(),\n limit: z.number().int().positive().max(100).optional(),\n after: z.string().optional(),\n sort: z.array(z.enum([\"createdOn_ASC\", \"createdOn_DESC\"])).optional()\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,uBAAuB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAC5CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACvBC,IAAI,EAAEN,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC;EACvBE,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;EACvBI,WAAW,EAAER,CAAC,CACTS,KAAK,CAACT,CAAC,CAACU,WAAW,CAAC;IAAEP,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;EAAE,CAAC,CAAC,CAAC,CAC1CO,QAAQ,CAAC,CAAC,CACVC,OAAO,CAAC,EAAE;AACnB,CAAC,CAAC;AAEF,OAAO,MAAMC,uBAAuB,GAAGb,CAAC,CAACE,MAAM,CAAC;EAC5CC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACM,QAAQ,CAAC,CAAC;EAClCJ,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;EAClCH,WAAW,EAAER,CAAC,CACTS,KAAK,CAACT,CAAC,CAACU,WAAW,CAAC;IAAEP,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC;EAAE,CAAC,CAAC,CAAC,CAC1CO,QAAQ,CAAC,CAAC,CACVC,OAAO,CAAC,EAAE;AACnB,CAAC,CAAC;AAEF,OAAO,MAAME,sBAAsB,GAAGd,CAAC,CAACE,MAAM,CAAC;EAC3Ca,KAAK,EAAEf,CAAC,CACHE,MAAM,CAAC;IACJC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IAC3BK,aAAa,EAAEhB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IACpCJ,WAAW,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;IAClCM,oBAAoB,EAAEjB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACDA,QAAQ,CAAC,CAAC;EACfO,KAAK,EAAElB,CAAC,CAACmB,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACC,GAAG,CAAC,GAAG,CAAC,CAACX,QAAQ,CAAC,CAAC;EACtDY,KAAK,EAAEvB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC,CAAC;EAC5Ba,IAAI,EAAExB,CAAC,CAACS,KAAK,CAACT,CAAC,CAACyB,IAAI,CAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAACd,QAAQ,CAAC;AACxE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/security/apiKeys/shared/schemas.js","sources":["../../../../../src/features/security/apiKeys/shared/schemas.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n description: z.string(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const updateApiKeyInputSchema = z.object({\n name: z.string().min(1).optional(),\n description: z.string().optional(),\n permissions: z\n .array(z.looseObject({ name: z.string() }))\n .optional()\n .default([])\n});\n\nexport const listApiKeysInputSchema = z.object({\n where: z\n .object({\n name: z.string().optional(),\n name_contains: z.string().optional(),\n description: z.string().optional(),\n description_contains: z.string().optional()\n })\n .optional(),\n limit: z.number().int().positive().max(100).optional(),\n after: z.string().optional(),\n sort: z.array(z.enum([\"createdOn_ASC\", \"createdOn_DESC\"])).optional()\n});\n"],"names":["createApiKeyInputSchema","z","updateApiKeyInputSchema","listApiKeysInputSchema"],"mappings":";AAEO,MAAMA,0BAA0BC,EAAE,MAAM,CAAC;IAC5C,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,aAAaA,EAAE,MAAM;IACrB,aAAaA,EAAAA,KACH,CAACA,EAAE,WAAW,CAAC;QAAE,MAAMA,EAAE,MAAM;IAAG,IACvC,QAAQ,GACR,OAAO,CAAC,EAAE;AACnB;AAEO,MAAMC,0BAA0BD,EAAE,MAAM,CAAC;IAC5C,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ;IAChC,aAAaA,EAAE,MAAM,GAAG,QAAQ;IAChC,aAAaA,EAAAA,KACH,CAACA,EAAE,WAAW,CAAC;QAAE,MAAMA,EAAE,MAAM;IAAG,IACvC,QAAQ,GACR,OAAO,CAAC,EAAE;AACnB;AAEO,MAAME,yBAAyBF,EAAE,MAAM,CAAC;IAC3C,OAAOA,EAAAA,MACI,CAAC;QACJ,MAAMA,EAAE,MAAM,GAAG,QAAQ;QACzB,eAAeA,EAAE,MAAM,GAAG,QAAQ;QAClC,aAAaA,EAAE,MAAM,GAAG,QAAQ;QAChC,sBAAsBA,EAAE,MAAM,GAAG,QAAQ;IAC7C,GACC,QAAQ;IACb,OAAOA,EAAE,MAAM,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,CAAC,KAAK,QAAQ;IACpD,OAAOA,EAAE,MAAM,GAAG,QAAQ;IAC1B,MAAMA,EAAE,KAAK,CAACA,CAAC,CAADA,OAAM,CAAC;QAAC;QAAiB;KAAiB,GAAG,QAAQ;AACvE"}
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,51 +1,57 @@
1
1
  import { createImplementation } from "@webiny/di";
2
2
  import { EventPublisher } from "../../../eventPublisher/index.js";
3
- import { AuthenticationContext as Abstraction } from "./abstractions.js";
3
+ import { AuthenticationContext } from "./abstractions.js";
4
4
  import { Authenticator } from "../Authenticator/index.js";
5
- import { BeforeAuthenticationEvent, AfterAuthenticationEvent } from "./events.js";
5
+ import { AfterAuthenticationEvent, BeforeAuthenticationEvent } from "./events.js";
6
6
  import { AnonymousIdentity, AuthenticatedIdentity } from "../../IdentityContext/index.js";
7
7
  import { AuthenticationError } from "./errors.js";
8
8
  class AuthenticationContextImpl {
9
- constructor(authenticators, eventPublisher) {
10
- this.authenticators = authenticators;
11
- this.eventPublisher = eventPublisher;
12
- }
13
- async authenticate(token) {
14
- await this.eventPublisher.publish(new BeforeAuthenticationEvent({
15
- token
16
- }));
17
- try {
18
- return await this.processAuthenticators(token);
19
- } catch (error) {
20
- throw AuthenticationError.from(error);
9
+ constructor(authenticators, eventPublisher){
10
+ this.authenticators = authenticators;
11
+ this.eventPublisher = eventPublisher;
21
12
  }
22
- }
23
- getAuthToken() {
24
- return this.authToken;
25
- }
26
- async processAuthenticators(token) {
27
- // Try each authenticator until one succeeds
28
- for (const authenticator of this.authenticators) {
29
- const identityData = await authenticator.authenticate(token);
30
- if (identityData) {
31
- this.authToken = token;
32
- const identity = new AuthenticatedIdentity(identityData);
33
- await this.eventPublisher.publish(new AfterAuthenticationEvent({
34
- identity,
35
- token
13
+ async authenticate(token) {
14
+ await this.eventPublisher.publish(new BeforeAuthenticationEvent({
15
+ token
36
16
  }));
37
- return identity;
38
- }
17
+ try {
18
+ return await this.processAuthenticators(token);
19
+ } catch (error) {
20
+ throw AuthenticationError.from(error);
21
+ }
22
+ }
23
+ getAuthToken() {
24
+ return this.authToken;
25
+ }
26
+ async processAuthenticators(token) {
27
+ for (const authenticator of this.authenticators){
28
+ const identityData = await authenticator.authenticate(token);
29
+ if (identityData) {
30
+ this.authToken = token;
31
+ const identity = new AuthenticatedIdentity(identityData);
32
+ await this.eventPublisher.publish(new AfterAuthenticationEvent({
33
+ identity,
34
+ token
35
+ }));
36
+ return identity;
37
+ }
38
+ }
39
+ return new AnonymousIdentity();
39
40
  }
40
- return new AnonymousIdentity();
41
- }
42
41
  }
43
- export const AuthenticationContext = createImplementation({
44
- abstraction: Abstraction,
45
- implementation: AuthenticationContextImpl,
46
- dependencies: [[Authenticator, {
47
- multiple: true
48
- }], EventPublisher]
42
+ const AuthenticationContext_AuthenticationContext = createImplementation({
43
+ abstraction: AuthenticationContext,
44
+ implementation: AuthenticationContextImpl,
45
+ dependencies: [
46
+ [
47
+ Authenticator,
48
+ {
49
+ multiple: true
50
+ }
51
+ ],
52
+ EventPublisher
53
+ ]
49
54
  });
55
+ export { AuthenticationContext_AuthenticationContext as AuthenticationContext };
50
56
 
51
57
  //# sourceMappingURL=AuthenticationContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","EventPublisher","AuthenticationContext","Abstraction","Authenticator","BeforeAuthenticationEvent","AfterAuthenticationEvent","AnonymousIdentity","AuthenticatedIdentity","AuthenticationError","AuthenticationContextImpl","constructor","authenticators","eventPublisher","authenticate","token","publish","processAuthenticators","error","from","getAuthToken","authToken","authenticator","identityData","identity","abstraction","implementation","dependencies","multiple"],"sources":["AuthenticationContext.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { AuthenticationContext as Abstraction } from \"./abstractions.js\";\nimport { Authenticator } from \"../Authenticator/index.js\";\nimport { BeforeAuthenticationEvent, AfterAuthenticationEvent } from \"./events.js\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\nimport {\n AnonymousIdentity,\n AuthenticatedIdentity\n} from \"~/features/security/IdentityContext/index.js\";\nimport { AuthenticationError } from \"./errors.js\";\n\nclass AuthenticationContextImpl implements Abstraction.Interface {\n private authToken?: string;\n\n constructor(\n private authenticators: Authenticator.Interface[],\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async authenticate(token: string): Promise<Identity> {\n await this.eventPublisher.publish(new BeforeAuthenticationEvent({ token }));\n\n try {\n return await this.processAuthenticators(token);\n } catch (error) {\n throw AuthenticationError.from(error);\n }\n }\n\n getAuthToken(): string | undefined {\n return this.authToken;\n }\n\n private async processAuthenticators(token: string): Promise<Identity> {\n // Try each authenticator until one succeeds\n for (const authenticator of this.authenticators) {\n const identityData = await authenticator.authenticate(token);\n if (identityData) {\n this.authToken = token;\n\n const identity = new AuthenticatedIdentity(identityData);\n\n await this.eventPublisher.publish(\n new AfterAuthenticationEvent({ identity, token })\n );\n\n return identity;\n }\n }\n\n return new AnonymousIdentity();\n }\n}\n\nexport const AuthenticationContext = createImplementation({\n abstraction: Abstraction,\n implementation: AuthenticationContextImpl,\n dependencies: [[Authenticator, { multiple: true }], EventPublisher]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,cAAc;AACvB,SAASC,qBAAqB,IAAIC,WAAW;AAC7C,SAASC,aAAa;AACtB,SAASC,yBAAyB,EAAEC,wBAAwB;AAE5D,SACIC,iBAAiB,EACjBC,qBAAqB;AAEzB,SAASC,mBAAmB;AAE5B,MAAMC,yBAAyB,CAAkC;EAG7DC,WAAWA,CACCC,cAAyC,EACzCC,cAAwC,EAClD;IAAA,KAFUD,cAAyC,GAAzCA,cAAyC;IAAA,KACzCC,cAAwC,GAAxCA,cAAwC;EACjD;EAEH,MAAMC,YAAYA,CAACC,KAAa,EAAqB;IACjD,MAAM,IAAI,CAACF,cAAc,CAACG,OAAO,CAAC,IAAIX,yBAAyB,CAAC;MAAEU;IAAM,CAAC,CAAC,CAAC;IAE3E,IAAI;MACA,OAAO,MAAM,IAAI,CAACE,qBAAqB,CAACF,KAAK,CAAC;IAClD,CAAC,CAAC,OAAOG,KAAK,EAAE;MACZ,MAAMT,mBAAmB,CAACU,IAAI,CAACD,KAAK,CAAC;IACzC;EACJ;EAEAE,YAAYA,CAAA,EAAuB;IAC/B,OAAO,IAAI,CAACC,SAAS;EACzB;EAEA,MAAcJ,qBAAqBA,CAACF,KAAa,EAAqB;IAClE;IACA,KAAK,MAAMO,aAAa,IAAI,IAAI,CAACV,cAAc,EAAE;MAC7C,MAAMW,YAAY,GAAG,MAAMD,aAAa,CAACR,YAAY,CAACC,KAAK,CAAC;MAC5D,IAAIQ,YAAY,EAAE;QACd,IAAI,CAACF,SAAS,GAAGN,KAAK;QAEtB,MAAMS,QAAQ,GAAG,IAAIhB,qBAAqB,CAACe,YAAY,CAAC;QAExD,MAAM,IAAI,CAACV,cAAc,CAACG,OAAO,CAC7B,IAAIV,wBAAwB,CAAC;UAAEkB,QAAQ;UAAET;QAAM,CAAC,CACpD,CAAC;QAED,OAAOS,QAAQ;MACnB;IACJ;IAEA,OAAO,IAAIjB,iBAAiB,CAAC,CAAC;EAClC;AACJ;AAEA,OAAO,MAAML,qBAAqB,GAAGF,oBAAoB,CAAC;EACtDyB,WAAW,EAAEtB,WAAW;EACxBuB,cAAc,EAAEhB,yBAAyB;EACzCiB,YAAY,EAAE,CAAC,CAACvB,aAAa,EAAE;IAAEwB,QAAQ,EAAE;EAAK,CAAC,CAAC,EAAE3B,cAAc;AACtE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/security/authentication/AuthenticationContext/AuthenticationContext.js","sources":["../../../../../src/features/security/authentication/AuthenticationContext/AuthenticationContext.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { AuthenticationContext as Abstraction } from \"./abstractions.js\";\nimport { Authenticator } from \"../Authenticator/index.js\";\nimport { BeforeAuthenticationEvent, AfterAuthenticationEvent } from \"./events.js\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\nimport {\n AnonymousIdentity,\n AuthenticatedIdentity\n} from \"~/features/security/IdentityContext/index.js\";\nimport { AuthenticationError } from \"./errors.js\";\n\nclass AuthenticationContextImpl implements Abstraction.Interface {\n private authToken?: string;\n\n constructor(\n private authenticators: Authenticator.Interface[],\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async authenticate(token: string): Promise<Identity> {\n await this.eventPublisher.publish(new BeforeAuthenticationEvent({ token }));\n\n try {\n return await this.processAuthenticators(token);\n } catch (error) {\n throw AuthenticationError.from(error);\n }\n }\n\n getAuthToken(): string | undefined {\n return this.authToken;\n }\n\n private async processAuthenticators(token: string): Promise<Identity> {\n // Try each authenticator until one succeeds\n for (const authenticator of this.authenticators) {\n const identityData = await authenticator.authenticate(token);\n if (identityData) {\n this.authToken = token;\n\n const identity = new AuthenticatedIdentity(identityData);\n\n await this.eventPublisher.publish(\n new AfterAuthenticationEvent({ identity, token })\n );\n\n return identity;\n }\n }\n\n return new AnonymousIdentity();\n }\n}\n\nexport const AuthenticationContext = createImplementation({\n abstraction: Abstraction,\n implementation: AuthenticationContextImpl,\n dependencies: [[Authenticator, { multiple: true }], EventPublisher]\n});\n"],"names":["AuthenticationContextImpl","authenticators","eventPublisher","token","BeforeAuthenticationEvent","error","AuthenticationError","authenticator","identityData","identity","AuthenticatedIdentity","AfterAuthenticationEvent","AnonymousIdentity","AuthenticationContext","createImplementation","Abstraction","Authenticator","EventPublisher"],"mappings":";;;;;;;AAYA,MAAMA;IAGF,YACYC,cAAyC,EACzCC,cAAwC,CAClD;aAFUD,cAAc,GAAdA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,aAAaC,KAAa,EAAqB;QACjD,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAIC,0BAA0B;YAAED;QAAM;QAExE,IAAI;YACA,OAAO,MAAM,IAAI,CAAC,qBAAqB,CAACA;QAC5C,EAAE,OAAOE,OAAO;YACZ,MAAMC,oBAAoB,IAAI,CAACD;QACnC;IACJ;IAEA,eAAmC;QAC/B,OAAO,IAAI,CAAC,SAAS;IACzB;IAEA,MAAc,sBAAsBF,KAAa,EAAqB;QAElE,KAAK,MAAMI,iBAAiB,IAAI,CAAC,cAAc,CAAE;YAC7C,MAAMC,eAAe,MAAMD,cAAc,YAAY,CAACJ;YACtD,IAAIK,cAAc;gBACd,IAAI,CAAC,SAAS,GAAGL;gBAEjB,MAAMM,WAAW,IAAIC,sBAAsBF;gBAE3C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIG,yBAAyB;oBAAEF;oBAAUN;gBAAM;gBAGnD,OAAOM;YACX;QACJ;QAEA,OAAO,IAAIG;IACf;AACJ;AAEO,MAAMC,8CAAwBC,qBAAqB;IACtD,aAAaC;IACb,gBAAgBf;IAChB,cAAc;QAAC;YAACgB;YAAe;gBAAE,UAAU;YAAK;SAAE;QAAEC;KAAe;AACvE"}
@@ -1,52 +1,42 @@
1
- import jwt from "jsonwebtoken";
1
+ import jsonwebtoken from "jsonwebtoken";
2
2
  import { createImplementation } from "@webiny/feature/api";
3
3
  import { Reply } from "@webiny/handler";
4
- import { AfterAuthenticationEventHandler } from "./index.js";
5
- import { AuthenticationContext } from "./index.js";
6
- const get24HoursFromNow = () => {
7
- const oneHour = 1000 * 60 * 60;
8
- return new Date(new Date().getTime() + oneHour * 24);
9
- };
10
- const toDate = timestamp => {
11
- return timestamp ? new Date(timestamp * 1000) : get24HoursFromNow();
4
+ import { AfterAuthenticationEventHandler, AuthenticationContext } from "./index.js";
5
+ const get24HoursFromNow = ()=>{
6
+ const oneHour = 3600000;
7
+ return new Date(new Date().getTime() + 24 * oneHour);
12
8
  };
9
+ const toDate = (timestamp)=>timestamp ? new Date(1000 * timestamp) : get24HoursFromNow();
13
10
  class SetIdTokenCookieImpl {
14
- constructor(authenticationContext, reply) {
15
- this.authenticationContext = authenticationContext;
16
- this.reply = reply;
17
- }
18
- async handle() {
19
- const token = this.authenticationContext.getAuthToken();
20
- if (!token) {
21
- return;
11
+ constructor(authenticationContext, reply){
12
+ this.authenticationContext = authenticationContext;
13
+ this.reply = reply;
14
+ }
15
+ async handle() {
16
+ const token = this.authenticationContext.getAuthToken();
17
+ if (!token) return;
18
+ const tokenData = jsonwebtoken.decode(token, {
19
+ json: true
20
+ });
21
+ const expiresOn = tokenData ? toDate(tokenData.exp) : get24HoursFromNow();
22
+ this.reply.setCookie("wby-id-token", token, {
23
+ path: "/",
24
+ expires: expiresOn,
25
+ sameSite: "none",
26
+ secure: true,
27
+ httpOnly: true
28
+ });
29
+ this.reply.header("cache-control", 'no-cache="Set-Cookie"');
22
30
  }
23
-
24
- // Attempt to acquire expiration from the token; fall back to "expire in 24 hours".
25
- // In most cases the token will be a JWT token, but it can also be a custom token, or an API key.
26
- const tokenData = jwt.decode(token, {
27
- json: true
28
- });
29
- const expiresOn = tokenData ? toDate(tokenData.exp) : get24HoursFromNow();
30
-
31
- // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
32
- this.reply.setCookie("wby-id-token", token, {
33
- path: "/",
34
- expires: expiresOn,
35
- // Allow this cookie to be sent with cross-origin requests.
36
- sameSite: "none",
37
- // Only send this cookie to the server when HTTPS is used.
38
- // NOTE: `https` requirement is ignored for `localhost.
39
- secure: true,
40
- // Forbids JavaScript from accessing the cookie.
41
- httpOnly: true
42
- });
43
- this.reply.header("cache-control", `no-cache="Set-Cookie"`);
44
- }
45
31
  }
46
- export const SetIdTokenCookie = createImplementation({
47
- abstraction: AfterAuthenticationEventHandler,
48
- implementation: SetIdTokenCookieImpl,
49
- dependencies: [AuthenticationContext, Reply]
32
+ const SetIdTokenCookie = createImplementation({
33
+ abstraction: AfterAuthenticationEventHandler,
34
+ implementation: SetIdTokenCookieImpl,
35
+ dependencies: [
36
+ AuthenticationContext,
37
+ Reply
38
+ ]
50
39
  });
40
+ export { SetIdTokenCookie };
51
41
 
52
42
  //# sourceMappingURL=SetIdTokenCookie.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jwt","createImplementation","Reply","AfterAuthenticationEventHandler","AuthenticationContext","get24HoursFromNow","oneHour","Date","getTime","toDate","timestamp","SetIdTokenCookieImpl","constructor","authenticationContext","reply","handle","token","getAuthToken","tokenData","decode","json","expiresOn","exp","setCookie","path","expires","sameSite","secure","httpOnly","header","SetIdTokenCookie","abstraction","implementation","dependencies"],"sources":["SetIdTokenCookie.ts"],"sourcesContent":["import jwt from \"jsonwebtoken\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Reply } from \"@webiny/handler\";\nimport { AfterAuthenticationEventHandler } from \"~/features/security/authentication/AuthenticationContext/index.js\";\nimport { AuthenticationContext } from \"~/features/security/authentication/AuthenticationContext/index.js\";\n\nconst get24HoursFromNow = () => {\n const oneHour = 1000 * 60 * 60;\n return new Date(new Date().getTime() + oneHour * 24);\n};\n\nconst toDate = (timestamp: number | undefined) => {\n return timestamp ? new Date(timestamp * 1000) : get24HoursFromNow();\n};\n\nclass SetIdTokenCookieImpl implements AfterAuthenticationEventHandler.Interface {\n constructor(\n private authenticationContext: AuthenticationContext.Interface,\n private reply: Reply.Interface\n ) {}\n\n async handle(): Promise<void> {\n const token = this.authenticationContext.getAuthToken();\n\n if (!token) {\n return;\n }\n\n // Attempt to acquire expiration from the token; fall back to \"expire in 24 hours\".\n // In most cases the token will be a JWT token, but it can also be a custom token, or an API key.\n const tokenData = jwt.decode(token, { json: true });\n const expiresOn = tokenData ? toDate(tokenData.exp) : get24HoursFromNow();\n\n // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie\n this.reply.setCookie(\"wby-id-token\", token, {\n path: \"/\",\n expires: expiresOn,\n // Allow this cookie to be sent with cross-origin requests.\n sameSite: \"none\",\n // Only send this cookie to the server when HTTPS is used.\n // NOTE: `https` requirement is ignored for `localhost.\n secure: true,\n // Forbids JavaScript from accessing the cookie.\n httpOnly: true\n });\n\n this.reply.header(\"cache-control\", `no-cache=\"Set-Cookie\"`);\n }\n}\n\nexport const SetIdTokenCookie = createImplementation({\n abstraction: AfterAuthenticationEventHandler,\n implementation: SetIdTokenCookieImpl,\n dependencies: [AuthenticationContext, Reply]\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,cAAc;AAC9B,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,+BAA+B;AACxC,SAASC,qBAAqB;AAE9B,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE;EAC9B,OAAO,IAAIC,IAAI,CAAC,IAAIA,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,GAAGF,OAAO,GAAG,EAAE,CAAC;AACxD,CAAC;AAED,MAAMG,MAAM,GAAIC,SAA6B,IAAK;EAC9C,OAAOA,SAAS,GAAG,IAAIH,IAAI,CAACG,SAAS,GAAG,IAAI,CAAC,GAAGL,iBAAiB,CAAC,CAAC;AACvE,CAAC;AAED,MAAMM,oBAAoB,CAAsD;EAC5EC,WAAWA,CACCC,qBAAsD,EACtDC,KAAsB,EAChC;IAAA,KAFUD,qBAAsD,GAAtDA,qBAAsD;IAAA,KACtDC,KAAsB,GAAtBA,KAAsB;EAC/B;EAEH,MAAMC,MAAMA,CAAA,EAAkB;IAC1B,MAAMC,KAAK,GAAG,IAAI,CAACH,qBAAqB,CAACI,YAAY,CAAC,CAAC;IAEvD,IAAI,CAACD,KAAK,EAAE;MACR;IACJ;;IAEA;IACA;IACA,MAAME,SAAS,GAAGlB,GAAG,CAACmB,MAAM,CAACH,KAAK,EAAE;MAAEI,IAAI,EAAE;IAAK,CAAC,CAAC;IACnD,MAAMC,SAAS,GAAGH,SAAS,GAAGT,MAAM,CAACS,SAAS,CAACI,GAAG,CAAC,GAAGjB,iBAAiB,CAAC,CAAC;;IAEzE;IACA,IAAI,CAACS,KAAK,CAACS,SAAS,CAAC,cAAc,EAAEP,KAAK,EAAE;MACxCQ,IAAI,EAAE,GAAG;MACTC,OAAO,EAAEJ,SAAS;MAClB;MACAK,QAAQ,EAAE,MAAM;MAChB;MACA;MACAC,MAAM,EAAE,IAAI;MACZ;MACAC,QAAQ,EAAE;IACd,CAAC,CAAC;IAEF,IAAI,CAACd,KAAK,CAACe,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC;EAC/D;AACJ;AAEA,OAAO,MAAMC,gBAAgB,GAAG7B,oBAAoB,CAAC;EACjD8B,WAAW,EAAE5B,+BAA+B;EAC5C6B,cAAc,EAAErB,oBAAoB;EACpCsB,YAAY,EAAE,CAAC7B,qBAAqB,EAAEF,KAAK;AAC/C,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/security/authentication/AuthenticationContext/SetIdTokenCookie.js","sources":["../../../../../src/features/security/authentication/AuthenticationContext/SetIdTokenCookie.ts"],"sourcesContent":["import jwt from \"jsonwebtoken\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Reply } from \"@webiny/handler\";\nimport { AfterAuthenticationEventHandler } from \"~/features/security/authentication/AuthenticationContext/index.js\";\nimport { AuthenticationContext } from \"~/features/security/authentication/AuthenticationContext/index.js\";\n\nconst get24HoursFromNow = () => {\n const oneHour = 1000 * 60 * 60;\n return new Date(new Date().getTime() + oneHour * 24);\n};\n\nconst toDate = (timestamp: number | undefined) => {\n return timestamp ? new Date(timestamp * 1000) : get24HoursFromNow();\n};\n\nclass SetIdTokenCookieImpl implements AfterAuthenticationEventHandler.Interface {\n constructor(\n private authenticationContext: AuthenticationContext.Interface,\n private reply: Reply.Interface\n ) {}\n\n async handle(): Promise<void> {\n const token = this.authenticationContext.getAuthToken();\n\n if (!token) {\n return;\n }\n\n // Attempt to acquire expiration from the token; fall back to \"expire in 24 hours\".\n // In most cases the token will be a JWT token, but it can also be a custom token, or an API key.\n const tokenData = jwt.decode(token, { json: true });\n const expiresOn = tokenData ? toDate(tokenData.exp) : get24HoursFromNow();\n\n // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie\n this.reply.setCookie(\"wby-id-token\", token, {\n path: \"/\",\n expires: expiresOn,\n // Allow this cookie to be sent with cross-origin requests.\n sameSite: \"none\",\n // Only send this cookie to the server when HTTPS is used.\n // NOTE: `https` requirement is ignored for `localhost.\n secure: true,\n // Forbids JavaScript from accessing the cookie.\n httpOnly: true\n });\n\n this.reply.header(\"cache-control\", `no-cache=\"Set-Cookie\"`);\n }\n}\n\nexport const SetIdTokenCookie = createImplementation({\n abstraction: AfterAuthenticationEventHandler,\n implementation: SetIdTokenCookieImpl,\n dependencies: [AuthenticationContext, Reply]\n});\n"],"names":["get24HoursFromNow","oneHour","Date","toDate","timestamp","SetIdTokenCookieImpl","authenticationContext","reply","token","tokenData","jwt","expiresOn","SetIdTokenCookie","createImplementation","AfterAuthenticationEventHandler","AuthenticationContext","Reply"],"mappings":";;;;AAMA,MAAMA,oBAAoB;IACtB,MAAMC,UAAU;IAChB,OAAO,IAAIC,KAAK,IAAIA,OAAO,OAAO,KAAKD,AAAU,KAAVA;AAC3C;AAEA,MAAME,SAAS,CAACC,YACLA,YAAY,IAAIF,KAAKE,AAAY,OAAZA,aAAoBJ;AAGpD,MAAMK;IACF,YACYC,qBAAsD,EACtDC,KAAsB,CAChC;aAFUD,qBAAqB,GAArBA;aACAC,KAAK,GAALA;IACT;IAEH,MAAM,SAAwB;QAC1B,MAAMC,QAAQ,IAAI,CAAC,qBAAqB,CAAC,YAAY;QAErD,IAAI,CAACA,OACD;QAKJ,MAAMC,YAAYC,aAAAA,MAAU,CAACF,OAAO;YAAE,MAAM;QAAK;QACjD,MAAMG,YAAYF,YAAYN,OAAOM,UAAU,GAAG,IAAIT;QAGtD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAgBQ,OAAO;YACxC,MAAM;YACN,SAASG;YAET,UAAU;YAGV,QAAQ;YAER,UAAU;QACd;QAEA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB;IACvC;AACJ;AAEO,MAAMC,mBAAmBC,qBAAqB;IACjD,aAAaC;IACb,gBAAgBT;IAChB,cAAc;QAACU;QAAuBC;KAAM;AAChD"}
@@ -1,5 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- /** Authenticate incoming requests and resolve the current identity. */
3
- export const AuthenticationContext = createAbstraction("AuthenticationContext");
2
+ const AuthenticationContext = createAbstraction("AuthenticationContext");
3
+ export { AuthenticationContext };
4
4
 
5
5
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","AuthenticationContext"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticationContext {\n authenticate(token: string): Promise<Identity>;\n getAuthToken(): string | undefined;\n}\n\n/** Authenticate incoming requests and resolve the current identity. */\nexport const AuthenticationContext =\n createAbstraction<IAuthenticationContext>(\"AuthenticationContext\");\n\nexport namespace AuthenticationContext {\n export type Interface = IAuthenticationContext;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAQvD;AACA,OAAO,MAAMC,qBAAqB,GAC9BD,iBAAiB,CAAyB,uBAAuB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/security/authentication/AuthenticationContext/abstractions.js","sources":["../../../../../src/features/security/authentication/AuthenticationContext/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface IAuthenticationContext {\n authenticate(token: string): Promise<Identity>;\n getAuthToken(): string | undefined;\n}\n\n/** Authenticate incoming requests and resolve the current identity. */\nexport const AuthenticationContext =\n createAbstraction<IAuthenticationContext>(\"AuthenticationContext\");\n\nexport namespace AuthenticationContext {\n export type Interface = IAuthenticationContext;\n}\n"],"names":["AuthenticationContext","createAbstraction"],"mappings":";AASO,MAAMA,wBACTC,kBAA0C"}
@@ -1,130 +1,65 @@
1
1
  import { BaseError } from "@webiny/feature/api";
2
-
3
- /**
4
- * Base class for all authentication-related errors
5
- */
6
- export class AuthenticationError extends BaseError {
7
- constructor(message) {
8
- super({
9
- message
10
- });
11
- }
12
- static from(error) {
13
- // Check for specific jsonwebtoken error names
14
- if (error.name === "TokenExpiredError") {
15
- return new TokenExpiredError(error.message);
16
- }
17
- if (error.name === "NotBeforeError") {
18
- return new TokenNotYetValidError(error.message);
19
- }
20
- if (error.name === "JsonWebTokenError") {
21
- // Check message for specific error types
22
- const message = error.message.toLowerCase();
23
- if (message.includes("invalid signature")) {
24
- return new InvalidTokenSignatureError(error.message);
25
- }
26
- if (message.includes("invalid audience") || message.includes("jwt audience")) {
27
- return new InvalidAudienceError(error.message);
28
- }
29
- if (message.includes("invalid issuer") || message.includes("jwt issuer")) {
30
- return new InvalidIssuerError(error.message);
31
- }
32
- if (message.includes("jwt malformed") || message.includes("invalid token")) {
33
- return new InvalidTokenError(error.message);
34
- }
35
-
36
- // Generic JsonWebTokenError
37
- return new InvalidTokenError(error.message);
2
+ class AuthenticationError extends BaseError {
3
+ constructor(message){
4
+ super({
5
+ message
6
+ });
38
7
  }
39
-
40
- // If it's already one of our errors, return as-is
41
- if (error instanceof AuthenticationError) {
42
- return error;
8
+ static from(error) {
9
+ if ("TokenExpiredError" === error.name) return new TokenExpiredError(error.message);
10
+ if ("NotBeforeError" === error.name) return new TokenNotYetValidError(error.message);
11
+ if ("JsonWebTokenError" === error.name) {
12
+ const message = error.message.toLowerCase();
13
+ if (message.includes("invalid signature")) return new InvalidTokenSignatureError(error.message);
14
+ if (message.includes("invalid audience") || message.includes("jwt audience")) return new InvalidAudienceError(error.message);
15
+ if (message.includes("invalid issuer") || message.includes("jwt issuer")) return new InvalidIssuerError(error.message);
16
+ message.includes("jwt malformed") || message.includes("invalid token");
17
+ return new InvalidTokenError(error.message);
18
+ }
19
+ if (error instanceof AuthenticationError) return error;
20
+ return new InvalidTokenError(error.message || "Authentication failed");
43
21
  }
44
-
45
- // For any other error, wrap in InvalidTokenError
46
- return new InvalidTokenError(error.message || "Authentication failed");
47
- }
48
22
  }
49
-
50
- /**
51
- * Thrown when a JWT token has expired
52
- */
53
- export class TokenExpiredError extends AuthenticationError {
54
- code = "Authentication/TokenExpired";
55
- constructor(message = "Token has expired") {
56
- super(message);
57
- }
23
+ class TokenExpiredError extends AuthenticationError {
24
+ constructor(message = "Token has expired"){
25
+ super(message), this.code = "Authentication/TokenExpired";
26
+ }
58
27
  }
59
-
60
- /**
61
- * Thrown when a JWT token is not yet valid (nbf claim)
62
- */
63
- export class TokenNotYetValidError extends AuthenticationError {
64
- code = "Authentication/TokenNotYetValid";
65
- constructor(message = "Token is not yet valid") {
66
- super(message);
67
- }
28
+ class TokenNotYetValidError extends AuthenticationError {
29
+ constructor(message = "Token is not yet valid"){
30
+ super(message), this.code = "Authentication/TokenNotYetValid";
31
+ }
68
32
  }
69
-
70
- /**
71
- * Thrown when a JWT token has an invalid signature
72
- */
73
- export class InvalidTokenSignatureError extends AuthenticationError {
74
- code = "Authentication/InvalidSignature";
75
- constructor(message = "Invalid token signature") {
76
- super(message);
77
- }
33
+ class InvalidTokenSignatureError extends AuthenticationError {
34
+ constructor(message = "Invalid token signature"){
35
+ super(message), this.code = "Authentication/InvalidSignature";
36
+ }
78
37
  }
79
-
80
- /**
81
- * Thrown when a JWT token is malformed or invalid
82
- */
83
- export class InvalidTokenError extends AuthenticationError {
84
- code = "Authentication/InvalidToken";
85
- constructor(message = "Invalid token") {
86
- super(message);
87
- }
38
+ class InvalidTokenError extends AuthenticationError {
39
+ constructor(message = "Invalid token"){
40
+ super(message), this.code = "Authentication/InvalidToken";
41
+ }
88
42
  }
89
-
90
- /**
91
- * Thrown when the JWT audience claim doesn't match expected value
92
- */
93
- export class InvalidAudienceError extends AuthenticationError {
94
- code = "Authentication/InvalidAudience";
95
- constructor(message = "Invalid audience") {
96
- super(message);
97
- }
43
+ class InvalidAudienceError extends AuthenticationError {
44
+ constructor(message = "Invalid audience"){
45
+ super(message), this.code = "Authentication/InvalidAudience";
46
+ }
98
47
  }
99
-
100
- /**
101
- * Thrown when the JWT issuer claim doesn't match expected value
102
- */
103
- export class InvalidIssuerError extends AuthenticationError {
104
- code = "Authentication/InvalidIssuer";
105
- constructor(message = "Invalid issuer") {
106
- super(message);
107
- }
48
+ class InvalidIssuerError extends AuthenticationError {
49
+ constructor(message = "Invalid issuer"){
50
+ super(message), this.code = "Authentication/InvalidIssuer";
51
+ }
108
52
  }
109
-
110
- /**
111
- * Thrown when a required JWT claim is missing
112
- */
113
- export class MissingClaimError extends AuthenticationError {
114
- code = "Authentication/MissingClaim";
115
- constructor(claim) {
116
- super(`Missing required claim: ${claim}`);
117
- }
53
+ class MissingClaimError extends AuthenticationError {
54
+ constructor(claim){
55
+ super(`Missing required claim: ${claim}`), this.code = "Authentication/MissingClaim";
56
+ }
118
57
  }
119
-
120
- /**
121
- * Generic authentication failure error
122
- */
123
- export class AuthenticationFailedError extends AuthenticationError {
124
- code = "Authentication/Failed";
125
- constructor(message = "Authentication failed") {
126
- super(message);
127
- }
58
+ class AuthenticationFailedError extends AuthenticationError {
59
+ constructor(message = "Authentication failed"){
60
+ super(message), this.code = "Authentication/Failed";
61
+ }
128
62
  }
63
+ export { AuthenticationError, AuthenticationFailedError, InvalidAudienceError, InvalidIssuerError, InvalidTokenError, InvalidTokenSignatureError, MissingClaimError, TokenExpiredError, TokenNotYetValidError };
129
64
 
130
65
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseError","AuthenticationError","constructor","message","from","error","name","TokenExpiredError","TokenNotYetValidError","toLowerCase","includes","InvalidTokenSignatureError","InvalidAudienceError","InvalidIssuerError","InvalidTokenError","code","MissingClaimError","claim","AuthenticationFailedError"],"sources":["errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\n/**\n * Base class for all authentication-related errors\n */\nexport abstract class AuthenticationError extends BaseError {\n protected constructor(message: string) {\n super({ message });\n }\n\n static from(error: any): AuthenticationError {\n // Check for specific jsonwebtoken error names\n if (error.name === \"TokenExpiredError\") {\n return new TokenExpiredError(error.message);\n }\n\n if (error.name === \"NotBeforeError\") {\n return new TokenNotYetValidError(error.message);\n }\n\n if (error.name === \"JsonWebTokenError\") {\n // Check message for specific error types\n const message = error.message.toLowerCase();\n\n if (message.includes(\"invalid signature\")) {\n return new InvalidTokenSignatureError(error.message);\n }\n\n if (message.includes(\"invalid audience\") || message.includes(\"jwt audience\")) {\n return new InvalidAudienceError(error.message);\n }\n\n if (message.includes(\"invalid issuer\") || message.includes(\"jwt issuer\")) {\n return new InvalidIssuerError(error.message);\n }\n\n if (message.includes(\"jwt malformed\") || message.includes(\"invalid token\")) {\n return new InvalidTokenError(error.message);\n }\n\n // Generic JsonWebTokenError\n return new InvalidTokenError(error.message);\n }\n\n // If it's already one of our errors, return as-is\n if (error instanceof AuthenticationError) {\n return error;\n }\n\n // For any other error, wrap in InvalidTokenError\n return new InvalidTokenError(error.message || \"Authentication failed\");\n }\n}\n\n/**\n * Thrown when a JWT token has expired\n */\nexport class TokenExpiredError extends AuthenticationError {\n override readonly code = \"Authentication/TokenExpired\" as const;\n\n constructor(message: string = \"Token has expired\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token is not yet valid (nbf claim)\n */\nexport class TokenNotYetValidError extends AuthenticationError {\n override readonly code = \"Authentication/TokenNotYetValid\" as const;\n\n constructor(message: string = \"Token is not yet valid\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token has an invalid signature\n */\nexport class InvalidTokenSignatureError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidSignature\" as const;\n\n constructor(message: string = \"Invalid token signature\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token is malformed or invalid\n */\nexport class InvalidTokenError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidToken\" as const;\n\n constructor(message: string = \"Invalid token\") {\n super(message);\n }\n}\n\n/**\n * Thrown when the JWT audience claim doesn't match expected value\n */\nexport class InvalidAudienceError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidAudience\" as const;\n\n constructor(message: string = \"Invalid audience\") {\n super(message);\n }\n}\n\n/**\n * Thrown when the JWT issuer claim doesn't match expected value\n */\nexport class InvalidIssuerError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidIssuer\" as const;\n\n constructor(message: string = \"Invalid issuer\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a required JWT claim is missing\n */\nexport class MissingClaimError extends AuthenticationError {\n override readonly code = \"Authentication/MissingClaim\" as const;\n\n constructor(claim: string) {\n super(`Missing required claim: ${claim}`);\n }\n}\n\n/**\n * Generic authentication failure error\n */\nexport class AuthenticationFailedError extends AuthenticationError {\n override readonly code = \"Authentication/Failed\" as const;\n\n constructor(message: string = \"Authentication failed\") {\n super(message);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,qBAAqB;;AAE/C;AACA;AACA;AACA,OAAO,MAAeC,mBAAmB,SAASD,SAAS,CAAC;EAC9CE,WAAWA,CAACC,OAAe,EAAE;IACnC,KAAK,CAAC;MAAEA;IAAQ,CAAC,CAAC;EACtB;EAEA,OAAOC,IAAIA,CAACC,KAAU,EAAuB;IACzC;IACA,IAAIA,KAAK,CAACC,IAAI,KAAK,mBAAmB,EAAE;MACpC,OAAO,IAAIC,iBAAiB,CAACF,KAAK,CAACF,OAAO,CAAC;IAC/C;IAEA,IAAIE,KAAK,CAACC,IAAI,KAAK,gBAAgB,EAAE;MACjC,OAAO,IAAIE,qBAAqB,CAACH,KAAK,CAACF,OAAO,CAAC;IACnD;IAEA,IAAIE,KAAK,CAACC,IAAI,KAAK,mBAAmB,EAAE;MACpC;MACA,MAAMH,OAAO,GAAGE,KAAK,CAACF,OAAO,CAACM,WAAW,CAAC,CAAC;MAE3C,IAAIN,OAAO,CAACO,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QACvC,OAAO,IAAIC,0BAA0B,CAACN,KAAK,CAACF,OAAO,CAAC;MACxD;MAEA,IAAIA,OAAO,CAACO,QAAQ,CAAC,kBAAkB,CAAC,IAAIP,OAAO,CAACO,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC1E,OAAO,IAAIE,oBAAoB,CAACP,KAAK,CAACF,OAAO,CAAC;MAClD;MAEA,IAAIA,OAAO,CAACO,QAAQ,CAAC,gBAAgB,CAAC,IAAIP,OAAO,CAACO,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtE,OAAO,IAAIG,kBAAkB,CAACR,KAAK,CAACF,OAAO,CAAC;MAChD;MAEA,IAAIA,OAAO,CAACO,QAAQ,CAAC,eAAe,CAAC,IAAIP,OAAO,CAACO,QAAQ,CAAC,eAAe,CAAC,EAAE;QACxE,OAAO,IAAII,iBAAiB,CAACT,KAAK,CAACF,OAAO,CAAC;MAC/C;;MAEA;MACA,OAAO,IAAIW,iBAAiB,CAACT,KAAK,CAACF,OAAO,CAAC;IAC/C;;IAEA;IACA,IAAIE,KAAK,YAAYJ,mBAAmB,EAAE;MACtC,OAAOI,KAAK;IAChB;;IAEA;IACA,OAAO,IAAIS,iBAAiB,CAACT,KAAK,CAACF,OAAO,IAAI,uBAAuB,CAAC;EAC1E;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMI,iBAAiB,SAASN,mBAAmB,CAAC;EACrCc,IAAI,GAAG,6BAA6B;EAEtDb,WAAWA,CAACC,OAAe,GAAG,mBAAmB,EAAE;IAC/C,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMK,qBAAqB,SAASP,mBAAmB,CAAC;EACzCc,IAAI,GAAG,iCAAiC;EAE1Db,WAAWA,CAACC,OAAe,GAAG,wBAAwB,EAAE;IACpD,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMQ,0BAA0B,SAASV,mBAAmB,CAAC;EAC9Cc,IAAI,GAAG,iCAAiC;EAE1Db,WAAWA,CAACC,OAAe,GAAG,yBAAyB,EAAE;IACrD,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMW,iBAAiB,SAASb,mBAAmB,CAAC;EACrCc,IAAI,GAAG,6BAA6B;EAEtDb,WAAWA,CAACC,OAAe,GAAG,eAAe,EAAE;IAC3C,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMS,oBAAoB,SAASX,mBAAmB,CAAC;EACxCc,IAAI,GAAG,gCAAgC;EAEzDb,WAAWA,CAACC,OAAe,GAAG,kBAAkB,EAAE;IAC9C,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMU,kBAAkB,SAASZ,mBAAmB,CAAC;EACtCc,IAAI,GAAG,8BAA8B;EAEvDb,WAAWA,CAACC,OAAe,GAAG,gBAAgB,EAAE;IAC5C,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMa,iBAAiB,SAASf,mBAAmB,CAAC;EACrCc,IAAI,GAAG,6BAA6B;EAEtDb,WAAWA,CAACe,KAAa,EAAE;IACvB,KAAK,CAAC,2BAA2BA,KAAK,EAAE,CAAC;EAC7C;AACJ;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,SAASjB,mBAAmB,CAAC;EAC7Cc,IAAI,GAAG,uBAAuB;EAEhDb,WAAWA,CAACC,OAAe,GAAG,uBAAuB,EAAE;IACnD,KAAK,CAACA,OAAO,CAAC;EAClB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"features/security/authentication/AuthenticationContext/errors.js","sources":["../../../../../src/features/security/authentication/AuthenticationContext/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\n/**\n * Base class for all authentication-related errors\n */\nexport abstract class AuthenticationError extends BaseError {\n protected constructor(message: string) {\n super({ message });\n }\n\n static from(error: any): AuthenticationError {\n // Check for specific jsonwebtoken error names\n if (error.name === \"TokenExpiredError\") {\n return new TokenExpiredError(error.message);\n }\n\n if (error.name === \"NotBeforeError\") {\n return new TokenNotYetValidError(error.message);\n }\n\n if (error.name === \"JsonWebTokenError\") {\n // Check message for specific error types\n const message = error.message.toLowerCase();\n\n if (message.includes(\"invalid signature\")) {\n return new InvalidTokenSignatureError(error.message);\n }\n\n if (message.includes(\"invalid audience\") || message.includes(\"jwt audience\")) {\n return new InvalidAudienceError(error.message);\n }\n\n if (message.includes(\"invalid issuer\") || message.includes(\"jwt issuer\")) {\n return new InvalidIssuerError(error.message);\n }\n\n if (message.includes(\"jwt malformed\") || message.includes(\"invalid token\")) {\n return new InvalidTokenError(error.message);\n }\n\n // Generic JsonWebTokenError\n return new InvalidTokenError(error.message);\n }\n\n // If it's already one of our errors, return as-is\n if (error instanceof AuthenticationError) {\n return error;\n }\n\n // For any other error, wrap in InvalidTokenError\n return new InvalidTokenError(error.message || \"Authentication failed\");\n }\n}\n\n/**\n * Thrown when a JWT token has expired\n */\nexport class TokenExpiredError extends AuthenticationError {\n override readonly code = \"Authentication/TokenExpired\" as const;\n\n constructor(message: string = \"Token has expired\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token is not yet valid (nbf claim)\n */\nexport class TokenNotYetValidError extends AuthenticationError {\n override readonly code = \"Authentication/TokenNotYetValid\" as const;\n\n constructor(message: string = \"Token is not yet valid\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token has an invalid signature\n */\nexport class InvalidTokenSignatureError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidSignature\" as const;\n\n constructor(message: string = \"Invalid token signature\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a JWT token is malformed or invalid\n */\nexport class InvalidTokenError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidToken\" as const;\n\n constructor(message: string = \"Invalid token\") {\n super(message);\n }\n}\n\n/**\n * Thrown when the JWT audience claim doesn't match expected value\n */\nexport class InvalidAudienceError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidAudience\" as const;\n\n constructor(message: string = \"Invalid audience\") {\n super(message);\n }\n}\n\n/**\n * Thrown when the JWT issuer claim doesn't match expected value\n */\nexport class InvalidIssuerError extends AuthenticationError {\n override readonly code = \"Authentication/InvalidIssuer\" as const;\n\n constructor(message: string = \"Invalid issuer\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a required JWT claim is missing\n */\nexport class MissingClaimError extends AuthenticationError {\n override readonly code = \"Authentication/MissingClaim\" as const;\n\n constructor(claim: string) {\n super(`Missing required claim: ${claim}`);\n }\n}\n\n/**\n * Generic authentication failure error\n */\nexport class AuthenticationFailedError extends AuthenticationError {\n override readonly code = \"Authentication/Failed\" as const;\n\n constructor(message: string = \"Authentication failed\") {\n super(message);\n }\n}\n"],"names":["AuthenticationError","BaseError","message","error","TokenExpiredError","TokenNotYetValidError","InvalidTokenSignatureError","InvalidAudienceError","InvalidIssuerError","InvalidTokenError","MissingClaimError","claim","AuthenticationFailedError"],"mappings":";AAKO,MAAeA,4BAA4BC;IAC9C,YAAsBC,OAAe,CAAE;QACnC,KAAK,CAAC;YAAEA;QAAQ;IACpB;IAEA,OAAO,KAAKC,KAAU,EAAuB;QAEzC,IAAIA,AAAe,wBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,kBAAkBD,MAAM,OAAO;QAG9C,IAAIA,AAAe,qBAAfA,MAAM,IAAI,EACV,OAAO,IAAIE,sBAAsBF,MAAM,OAAO;QAGlD,IAAIA,AAAe,wBAAfA,MAAM,IAAI,EAA0B;YAEpC,MAAMD,UAAUC,MAAM,OAAO,CAAC,WAAW;YAEzC,IAAID,QAAQ,QAAQ,CAAC,sBACjB,OAAO,IAAII,2BAA2BH,MAAM,OAAO;YAGvD,IAAID,QAAQ,QAAQ,CAAC,uBAAuBA,QAAQ,QAAQ,CAAC,iBACzD,OAAO,IAAIK,qBAAqBJ,MAAM,OAAO;YAGjD,IAAID,QAAQ,QAAQ,CAAC,qBAAqBA,QAAQ,QAAQ,CAAC,eACvD,OAAO,IAAIM,mBAAmBL,MAAM,OAAO;YAG3CD,QAAQ,QAAQ,CAAC,oBAAoBA,QAAQ,QAAQ,CAAC;YAK1D,OAAO,IAAIO,kBAAkBN,MAAM,OAAO;QAC9C;QAGA,IAAIA,iBAAiBH,qBACjB,OAAOG;QAIX,OAAO,IAAIM,kBAAkBN,MAAM,OAAO,IAAI;IAClD;AACJ;AAKO,MAAMC,0BAA0BJ;IAGnC,YAAYE,UAAkB,mBAAmB,CAAE;QAC/C,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMG,8BAA8BL;IAGvC,YAAYE,UAAkB,wBAAwB,CAAE;QACpD,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMI,mCAAmCN;IAG5C,YAAYE,UAAkB,yBAAyB,CAAE;QACrD,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMO,0BAA0BT;IAGnC,YAAYE,UAAkB,eAAe,CAAE;QAC3C,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMK,6BAA6BP;IAGtC,YAAYE,UAAkB,kBAAkB,CAAE;QAC9C,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMM,2BAA2BR;IAGpC,YAAYE,UAAkB,gBAAgB,CAAE;QAC5C,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMQ,0BAA0BV;IAGnC,YAAYW,KAAa,CAAE;QACvB,KAAK,CAAC,CAAC,wBAAwB,EAAEA,OAAO,QAH1B,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMC,kCAAkCZ;IAG3C,YAAYE,UAAkB,uBAAuB,CAAE;QACnD,KAAK,CAACA,UAAAA,IAAAA,CAHQ,IAAI,GAAG;IAIzB;AACJ"}
@@ -1,22 +1,23 @@
1
1
  import { DomainEvent } from "../../../eventPublisher/index.js";
2
2
  import { createAbstraction } from "@webiny/feature/api";
3
- export class BeforeAuthenticationEvent extends DomainEvent {
4
- eventType = "authentication.beforeAuthentication";
5
- getHandlerAbstraction() {
6
- return BeforeAuthenticationEventHandler;
7
- }
3
+ class BeforeAuthenticationEvent extends DomainEvent {
4
+ getHandlerAbstraction() {
5
+ return BeforeAuthenticationEventHandler;
6
+ }
7
+ constructor(...args){
8
+ super(...args), this.eventType = "authentication.beforeAuthentication";
9
+ }
8
10
  }
9
-
10
- /** Hook into authentication lifecycle before authentication occurs. */
11
- export const BeforeAuthenticationEventHandler = createAbstraction("BeforeAuthenticationEventHandler");
12
- export class AfterAuthenticationEvent extends DomainEvent {
13
- eventType = "authentication.afterAuthentication";
14
- getHandlerAbstraction() {
15
- return AfterAuthenticationEventHandler;
16
- }
11
+ const BeforeAuthenticationEventHandler = createAbstraction("BeforeAuthenticationEventHandler");
12
+ class AfterAuthenticationEvent extends DomainEvent {
13
+ getHandlerAbstraction() {
14
+ return AfterAuthenticationEventHandler;
15
+ }
16
+ constructor(...args){
17
+ super(...args), this.eventType = "authentication.afterAuthentication";
18
+ }
17
19
  }
18
-
19
- /** Hook into authentication lifecycle after authentication occurs. */
20
- export const AfterAuthenticationEventHandler = createAbstraction("AfterAuthenticationEventHandler");
20
+ const AfterAuthenticationEventHandler = createAbstraction("AfterAuthenticationEventHandler");
21
+ export { AfterAuthenticationEvent, AfterAuthenticationEventHandler, BeforeAuthenticationEvent, BeforeAuthenticationEventHandler };
21
22
 
22
23
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DomainEvent","createAbstraction","BeforeAuthenticationEvent","eventType","getHandlerAbstraction","BeforeAuthenticationEventHandler","AfterAuthenticationEvent","AfterAuthenticationEventHandler"],"sources":["events.ts"],"sourcesContent":["import { DomainEvent } from \"~/features/eventPublisher/index.js\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface BeforeAuthenticationPayload {\n token: string;\n}\n\nexport class BeforeAuthenticationEvent extends DomainEvent<BeforeAuthenticationPayload> {\n eventType = \"authentication.beforeAuthentication\" as const;\n\n getHandlerAbstraction() {\n return BeforeAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle before authentication occurs. */\nexport const BeforeAuthenticationEventHandler = createAbstraction<\n IEventHandler<BeforeAuthenticationEvent>\n>(\"BeforeAuthenticationEventHandler\");\n\nexport namespace BeforeAuthenticationEventHandler {\n export type Interface = IEventHandler<BeforeAuthenticationEvent>;\n export type Event = BeforeAuthenticationEvent;\n}\n\nexport interface AfterAuthenticationPayload {\n identity: Identity;\n token: string;\n}\n\nexport class AfterAuthenticationEvent extends DomainEvent<AfterAuthenticationPayload> {\n eventType = \"authentication.afterAuthentication\" as const;\n\n getHandlerAbstraction() {\n return AfterAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle after authentication occurs. */\nexport const AfterAuthenticationEventHandler = createAbstraction<\n IEventHandler<AfterAuthenticationEvent>\n>(\"AfterAuthenticationEventHandler\");\n\nexport namespace AfterAuthenticationEventHandler {\n export type Interface = IEventHandler<AfterAuthenticationEvent>;\n export type Event = AfterAuthenticationEvent;\n}\n"],"mappings":"AAAA,SAASA,WAAW;AACpB,SAASC,iBAAiB,QAAQ,qBAAqB;AAQvD,OAAO,MAAMC,yBAAyB,SAASF,WAAW,CAA8B;EACpFG,SAAS,GAAG,qCAAqC;EAEjDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,gCAAgC;EAC3C;AACJ;;AAEA;AACA,OAAO,MAAMA,gCAAgC,GAAGJ,iBAAiB,CAE/D,kCAAkC,CAAC;AAYrC,OAAO,MAAMK,wBAAwB,SAASN,WAAW,CAA6B;EAClFG,SAAS,GAAG,oCAAoC;EAEhDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,+BAA+B;EAC1C;AACJ;;AAEA;AACA,OAAO,MAAMA,+BAA+B,GAAGN,iBAAiB,CAE9D,iCAAiC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/security/authentication/AuthenticationContext/events.js","sources":["../../../../../src/features/security/authentication/AuthenticationContext/events.ts"],"sourcesContent":["import { DomainEvent } from \"~/features/eventPublisher/index.js\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\nimport type { Identity } from \"~/features/security/IdentityContext/Identity.js\";\n\nexport interface BeforeAuthenticationPayload {\n token: string;\n}\n\nexport class BeforeAuthenticationEvent extends DomainEvent<BeforeAuthenticationPayload> {\n eventType = \"authentication.beforeAuthentication\" as const;\n\n getHandlerAbstraction() {\n return BeforeAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle before authentication occurs. */\nexport const BeforeAuthenticationEventHandler = createAbstraction<\n IEventHandler<BeforeAuthenticationEvent>\n>(\"BeforeAuthenticationEventHandler\");\n\nexport namespace BeforeAuthenticationEventHandler {\n export type Interface = IEventHandler<BeforeAuthenticationEvent>;\n export type Event = BeforeAuthenticationEvent;\n}\n\nexport interface AfterAuthenticationPayload {\n identity: Identity;\n token: string;\n}\n\nexport class AfterAuthenticationEvent extends DomainEvent<AfterAuthenticationPayload> {\n eventType = \"authentication.afterAuthentication\" as const;\n\n getHandlerAbstraction() {\n return AfterAuthenticationEventHandler;\n }\n}\n\n/** Hook into authentication lifecycle after authentication occurs. */\nexport const AfterAuthenticationEventHandler = createAbstraction<\n IEventHandler<AfterAuthenticationEvent>\n>(\"AfterAuthenticationEventHandler\");\n\nexport namespace AfterAuthenticationEventHandler {\n export type Interface = IEventHandler<AfterAuthenticationEvent>;\n export type Event = AfterAuthenticationEvent;\n}\n"],"names":["BeforeAuthenticationEvent","DomainEvent","BeforeAuthenticationEventHandler","createAbstraction","AfterAuthenticationEvent","AfterAuthenticationEventHandler"],"mappings":";;AASO,MAAMA,kCAAkCC;IAG3C,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAGO,MAAMA,mCAAmCC,kBAE9C;AAYK,MAAMC,iCAAiCH;IAG1C,wBAAwB;QACpB,OAAOI;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAGO,MAAMA,kCAAkCF,kBAE7C"}