@webiny/api-core 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7

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 (499) hide show
  1. package/ApiCoreFeature.d.ts +2 -2
  2. package/ApiCoreFeature.js +35 -5
  3. package/ApiCoreFeature.js.map +1 -1
  4. package/exports/api/security/api-key.d.ts +1 -0
  5. package/exports/api/security/api-key.js +1 -0
  6. package/exports/api/tasks.d.ts +1 -0
  7. package/exports/api/tasks.js +1 -1
  8. package/exports/api.d.ts +2 -1
  9. package/exports/api.js +2 -1
  10. package/features/ai/Ai.d.ts +5 -1
  11. package/features/ai/Ai.js +72 -29
  12. package/features/ai/Ai.js.map +1 -1
  13. package/features/ai/AiModelRegistry.d.ts +14 -0
  14. package/features/ai/AiModelRegistry.js +39 -0
  15. package/features/ai/AiModelRegistry.js.map +1 -0
  16. package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
  17. package/features/ai/AiSdkToolHandlerResolver.js +19 -0
  18. package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
  19. package/features/ai/AiSdkTools.d.ts +4 -3
  20. package/features/ai/AiSdkTools.js +11 -9
  21. package/features/ai/AiSdkTools.js.map +1 -1
  22. package/features/ai/AnthropicSdkFactory.js +18 -34
  23. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  24. package/features/ai/DEVELOPERS.md +183 -0
  25. package/features/ai/GoogleSdkFactory.d.ts +10 -0
  26. package/features/ai/GoogleSdkFactory.js +65 -0
  27. package/features/ai/GoogleSdkFactory.js.map +1 -0
  28. package/features/ai/OpenAiSdkFactory.js +42 -150
  29. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  30. package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
  31. package/features/ai/OpenRouterSdkFactory.js +112 -0
  32. package/features/ai/OpenRouterSdkFactory.js.map +1 -0
  33. package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
  34. package/features/ai/RemoteAiModelCatalog.js +74 -0
  35. package/features/ai/RemoteAiModelCatalog.js.map +1 -0
  36. package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
  37. package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
  38. package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
  39. package/features/ai/TextExtractor/abstractions.d.ts +12 -0
  40. package/features/ai/TextExtractor/abstractions.js +5 -0
  41. package/features/ai/TextExtractor/abstractions.js.map +1 -0
  42. package/features/ai/TextExtractor/index.d.ts +3 -0
  43. package/features/ai/TextExtractor/index.js +2 -0
  44. package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
  45. package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
  46. package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
  47. package/features/ai/abstractions.d.ts +102 -7
  48. package/features/ai/abstractions.js +6 -2
  49. package/features/ai/abstractions.js.map +1 -1
  50. package/features/ai/events.d.ts +59 -0
  51. package/features/ai/events.js +41 -0
  52. package/features/ai/events.js.map +1 -0
  53. package/features/ai/feature.js +16 -0
  54. package/features/ai/feature.js.map +1 -1
  55. package/features/ai/index.d.ts +6 -2
  56. package/features/ai/index.js +4 -1
  57. package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
  58. package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
  59. package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
  60. package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
  61. package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
  62. package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
  63. package/features/ai/toolPipeline/abstractions.d.ts +23 -0
  64. package/features/ai/toolPipeline/abstractions.js +7 -0
  65. package/features/ai/toolPipeline/abstractions.js.map +1 -0
  66. package/features/ai/toolPipeline/index.d.ts +2 -0
  67. package/features/ai/toolPipeline/index.js +1 -0
  68. package/features/dateFormatter/DefaultDateFormatter.d.ts +15 -0
  69. package/features/dateFormatter/DefaultDateFormatter.js +20 -0
  70. package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
  71. package/features/dateFormatter/abstractions.d.ts +13 -0
  72. package/features/dateFormatter/abstractions.js +5 -0
  73. package/features/dateFormatter/abstractions.js.map +1 -0
  74. package/features/dateFormatter/feature.d.ts +4 -0
  75. package/features/dateFormatter/feature.js +11 -0
  76. package/features/dateFormatter/feature.js.map +1 -0
  77. package/features/dateFormatter/index.d.ts +3 -0
  78. package/features/dateFormatter/index.js +2 -0
  79. package/features/debugger/Debugger.d.ts +30 -0
  80. package/features/debugger/Debugger.js +142 -0
  81. package/features/debugger/Debugger.js.map +1 -0
  82. package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
  83. package/features/debugger/DebuggerRouteDecorator.js +107 -0
  84. package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
  85. package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
  86. package/features/debugger/GraphQLDebuggerTransport.js +45 -0
  87. package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
  88. package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
  89. package/features/debugger/__tests__/matchNamespace.test.js +68 -0
  90. package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
  91. package/features/debugger/__tests__/serialize.test.d.ts +1 -0
  92. package/features/debugger/__tests__/serialize.test.js +220 -0
  93. package/features/debugger/__tests__/serialize.test.js.map +1 -0
  94. package/features/debugger/abstractions.d.ts +100 -0
  95. package/features/debugger/abstractions.js +6 -0
  96. package/features/debugger/abstractions.js.map +1 -0
  97. package/features/debugger/feature.d.ts +5 -0
  98. package/features/debugger/feature.js +15 -0
  99. package/features/debugger/feature.js.map +1 -0
  100. package/features/debugger/index.d.ts +12 -0
  101. package/features/debugger/index.js +7 -0
  102. package/features/debugger/limits.d.ts +18 -0
  103. package/features/debugger/limits.js +11 -0
  104. package/features/debugger/limits.js.map +1 -0
  105. package/features/debugger/matchNamespace.d.ts +14 -0
  106. package/features/debugger/matchNamespace.js +35 -0
  107. package/features/debugger/matchNamespace.js.map +1 -0
  108. package/features/debugger/parseNamespaceHeader.d.ts +7 -0
  109. package/features/debugger/parseNamespaceHeader.js +16 -0
  110. package/features/debugger/parseNamespaceHeader.js.map +1 -0
  111. package/features/debugger/permissions.d.ts +14 -0
  112. package/features/debugger/permissions.js +8 -0
  113. package/features/debugger/permissions.js.map +1 -0
  114. package/features/debugger/permissionsSchema.d.ts +17 -0
  115. package/features/debugger/permissionsSchema.js +18 -0
  116. package/features/debugger/permissionsSchema.js.map +1 -0
  117. package/features/debugger/serialize.d.ts +11 -0
  118. package/features/debugger/serialize.js +121 -0
  119. package/features/debugger/serialize.js.map +1 -0
  120. package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
  121. package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
  122. package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
  123. package/features/encryption/EncryptionService.d.ts +2 -1
  124. package/features/encryption/EncryptionService.js +11 -4
  125. package/features/encryption/EncryptionService.js.map +1 -1
  126. package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
  127. package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
  128. package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
  129. package/features/encryption/abstractions.d.ts +11 -0
  130. package/features/encryption/abstractions.js +2 -1
  131. package/features/encryption/abstractions.js.map +1 -1
  132. package/features/encryption/index.d.ts +1 -0
  133. package/features/encryption/index.js +1 -0
  134. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
  135. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +62 -0
  136. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
  137. package/features/hashing/ScryptHasher.d.ts +11 -0
  138. package/features/hashing/ScryptHasher.js +74 -0
  139. package/features/hashing/ScryptHasher.js.map +1 -0
  140. package/features/hashing/abstractions.d.ts +18 -0
  141. package/features/hashing/abstractions.js +5 -0
  142. package/features/hashing/abstractions.js.map +1 -0
  143. package/features/hashing/feature.d.ts +4 -0
  144. package/features/hashing/feature.js +11 -0
  145. package/features/hashing/feature.js.map +1 -0
  146. package/features/hashing/index.d.ts +2 -0
  147. package/features/hashing/index.js +1 -0
  148. package/features/httpClient/HttpClient.d.ts +7 -0
  149. package/features/httpClient/HttpClient.js +72 -0
  150. package/features/httpClient/HttpClient.js.map +1 -0
  151. package/features/httpClient/HttpRequestError.d.ts +10 -0
  152. package/features/httpClient/HttpRequestError.js +13 -0
  153. package/features/httpClient/HttpRequestError.js.map +1 -0
  154. package/features/httpClient/HttpStatusError.d.ts +12 -0
  155. package/features/httpClient/HttpStatusError.js +12 -0
  156. package/features/httpClient/HttpStatusError.js.map +1 -0
  157. package/features/httpClient/abstractions.d.ts +32 -0
  158. package/features/httpClient/abstractions.js +5 -0
  159. package/features/httpClient/abstractions.js.map +1 -0
  160. package/features/httpClient/feature.d.ts +4 -0
  161. package/features/httpClient/feature.js +11 -0
  162. package/features/httpClient/feature.js.map +1 -0
  163. package/features/httpClient/index.d.ts +3 -0
  164. package/features/httpClient/index.js +3 -0
  165. package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
  166. package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
  167. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  168. package/features/keyValueStore/KeyValueStore.d.ts +6 -2
  169. package/features/keyValueStore/KeyValueStore.js +13 -3
  170. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  171. package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
  172. package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
  173. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  174. package/features/keyValueStore/abstractions.d.ts +132 -14
  175. package/features/keyValueStore/abstractions.js.map +1 -1
  176. package/features/keyValueStore/errors.d.ts +29 -0
  177. package/features/keyValueStore/errors.js +49 -1
  178. package/features/keyValueStore/errors.js.map +1 -1
  179. package/features/keyValueStore/index.d.ts +4 -1
  180. package/features/keyValueStore/index.js +1 -1
  181. package/features/publicUrls/NullPublicUrls.d.ts +11 -0
  182. package/features/publicUrls/NullPublicUrls.js +17 -0
  183. package/features/publicUrls/NullPublicUrls.js.map +1 -0
  184. package/features/publicUrls/PublicUrl.d.ts +24 -0
  185. package/features/publicUrls/PublicUrl.js +43 -0
  186. package/features/publicUrls/PublicUrl.js.map +1 -0
  187. package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
  188. package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
  189. package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
  190. package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
  191. package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
  192. package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
  193. package/features/publicUrls/abstractions.d.ts +27 -0
  194. package/features/publicUrls/abstractions.js +5 -0
  195. package/features/publicUrls/abstractions.js.map +1 -0
  196. package/features/publicUrls/feature.d.ts +8 -0
  197. package/features/publicUrls/feature.js +11 -0
  198. package/features/publicUrls/feature.js.map +1 -0
  199. package/features/publicUrls/index.d.ts +3 -0
  200. package/features/publicUrls/index.js +3 -0
  201. package/features/requestContext/RawAssumePermissions.d.ts +14 -0
  202. package/features/requestContext/RawAssumePermissions.js +19 -0
  203. package/features/requestContext/RawAssumePermissions.js.map +1 -0
  204. package/features/requestContext/RawAuthToken.d.ts +14 -0
  205. package/features/requestContext/RawAuthToken.js +19 -0
  206. package/features/requestContext/RawAuthToken.js.map +1 -0
  207. package/features/requestContext/RawTenantId.d.ts +14 -0
  208. package/features/requestContext/RawTenantId.js +19 -0
  209. package/features/requestContext/RawTenantId.js.map +1 -0
  210. package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
  211. package/features/requestContext/RequestIdentityLoader.js +26 -0
  212. package/features/requestContext/RequestIdentityLoader.js.map +1 -0
  213. package/features/requestContext/RequestTenantLoader.d.ts +18 -0
  214. package/features/requestContext/RequestTenantLoader.js +52 -0
  215. package/features/requestContext/RequestTenantLoader.js.map +1 -0
  216. package/features/requestContext/abstractions.d.ts +75 -0
  217. package/features/requestContext/abstractions.js +9 -0
  218. package/features/requestContext/abstractions.js.map +1 -0
  219. package/features/requestContext/extractAssumePermissions.d.ts +14 -0
  220. package/features/requestContext/extractAssumePermissions.js +32 -0
  221. package/features/requestContext/extractAssumePermissions.js.map +1 -0
  222. package/features/requestContext/feature.d.ts +12 -0
  223. package/features/requestContext/feature.js +19 -0
  224. package/features/requestContext/feature.js.map +1 -0
  225. package/features/requestContext/index.d.ts +4 -0
  226. package/features/requestContext/index.js +3 -0
  227. package/features/security/IdentityContext/IdentityContext.d.ts +3 -3
  228. package/features/security/IdentityContext/IdentityContext.js +6 -6
  229. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  230. package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
  231. package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
  232. package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
  233. package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
  234. package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
  235. package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
  236. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
  237. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  238. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
  239. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
  240. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
  241. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
  242. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
  243. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  244. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
  245. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
  246. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
  247. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  248. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
  249. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  250. package/features/security/apiKeys/feature.js +11 -2
  251. package/features/security/apiKeys/feature.js.map +1 -1
  252. package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
  253. package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
  254. package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
  255. package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
  256. package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
  257. package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
  258. package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
  259. package/features/security/apiKeys/shared/generateToken.js.map +1 -1
  260. package/features/security/apiKeys/shared/schemas.d.ts +2 -2
  261. package/features/security/apiKeys/shared/schemas.js +2 -2
  262. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  263. package/features/security/apiKeys/shared/types.d.ts +1 -1
  264. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
  265. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
  266. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
  267. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +4 -4
  268. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
  269. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
  270. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
  271. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  272. package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
  273. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  274. package/features/security/roles/CreateRole/schema.d.ts +1 -1
  275. package/features/security/roles/CreateRole/schema.js +1 -1
  276. package/features/security/roles/CreateRole/schema.js.map +1 -1
  277. package/features/security/roles/Installer/RolesInstaller.js +1 -0
  278. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  279. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
  280. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  281. package/features/security/roles/UpdateRole/schema.d.ts +1 -1
  282. package/features/security/roles/UpdateRole/schema.js +1 -1
  283. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  284. package/features/security/shared/description.d.ts +4 -0
  285. package/features/security/shared/description.js +7 -0
  286. package/features/security/shared/description.js.map +1 -0
  287. package/features/security/shared/index.d.ts +1 -0
  288. package/features/security/shared/index.js +1 -0
  289. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +3 -1
  290. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
  291. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  292. package/features/security/teams/CreateTeam/schema.d.ts +1 -1
  293. package/features/security/teams/CreateTeam/schema.js +1 -1
  294. package/features/security/teams/CreateTeam/schema.js.map +1 -1
  295. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
  296. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
  297. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  298. package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
  299. package/features/security/teams/UpdateTeam/schema.js +1 -1
  300. package/features/security/teams/UpdateTeam/schema.js.map +1 -1
  301. package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
  302. package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
  303. package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
  304. package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
  305. package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
  306. package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
  307. package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
  308. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
  309. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
  310. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
  311. package/features/serviceDiscovery/index.d.ts +3 -0
  312. package/features/serviceDiscovery/index.js +1 -0
  313. package/features/slugify/DefaultSlugify.d.ts +8 -0
  314. package/features/slugify/DefaultSlugify.js +20 -0
  315. package/features/slugify/DefaultSlugify.js.map +1 -0
  316. package/features/slugify/abstractions.d.ts +12 -0
  317. package/features/slugify/abstractions.js +5 -0
  318. package/features/slugify/abstractions.js.map +1 -0
  319. package/features/slugify/feature.d.ts +4 -0
  320. package/features/slugify/feature.js +11 -0
  321. package/features/slugify/feature.js.map +1 -0
  322. package/features/slugify/index.d.ts +3 -0
  323. package/features/slugify/index.js +2 -0
  324. package/features/storageOperations/abstractions.d.ts +21 -0
  325. package/features/storageOperations/abstractions.js +10 -0
  326. package/features/storageOperations/abstractions.js.map +1 -0
  327. package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
  328. package/features/stringFormatter/DefaultStringFormatter.js +19 -0
  329. package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
  330. package/features/stringFormatter/abstractions.d.ts +11 -0
  331. package/features/stringFormatter/abstractions.js +5 -0
  332. package/features/stringFormatter/abstractions.js.map +1 -0
  333. package/features/stringFormatter/feature.d.ts +4 -0
  334. package/features/stringFormatter/feature.js +13 -0
  335. package/features/stringFormatter/feature.js.map +1 -0
  336. package/features/stringFormatter/index.d.ts +3 -0
  337. package/features/stringFormatter/index.js +2 -0
  338. package/features/task/TaskDefinition/abstractions.d.ts +69 -4
  339. package/features/task/TaskDefinition/abstractions.js +2 -1
  340. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  341. package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
  342. package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
  343. package/features/tenancy/TenantContext/TenantContext.d.ts +1 -0
  344. package/features/tenancy/TenantContext/TenantContext.js +13 -8
  345. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  346. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
  347. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
  348. package/features/wcp/WcpContext/WcpContext.d.ts +16 -5
  349. package/features/wcp/WcpContext/WcpContext.js +41 -2
  350. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  351. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +15 -60
  352. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +81 -25
  353. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  354. package/features/wcp/WcpContext/feature.d.ts +1 -2
  355. package/features/wcp/WcpContext/feature.js +2 -2
  356. package/features/wcp/WcpContext/feature.js.map +1 -1
  357. package/features/wcp/WcpContext/index.d.ts +0 -1
  358. package/features/wcp/WcpContext/types.d.ts +0 -4
  359. package/features/wcp/WcpFeature.d.ts +1 -1
  360. package/features/wcp/WcpFeature.js +7 -2
  361. package/features/wcp/WcpFeature.js.map +1 -1
  362. package/features/wcp/WcpLicenseLoader.d.ts +25 -0
  363. package/features/wcp/WcpLicenseLoader.js +58 -0
  364. package/features/wcp/WcpLicenseLoader.js.map +1 -0
  365. package/features/wcp/WcpLicenseProvider.d.ts +21 -0
  366. package/features/wcp/WcpLicenseProvider.js +14 -0
  367. package/features/wcp/WcpLicenseProvider.js.map +1 -0
  368. package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
  369. package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
  370. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
  371. package/graphql/ApiCoreSchemaFactory.d.ts +16 -0
  372. package/graphql/ApiCoreSchemaFactory.js +58 -0
  373. package/graphql/ApiCoreSchemaFactory.js.map +1 -0
  374. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +10 -0
  375. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +53 -0
  376. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
  377. package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
  378. package/graphql/security/NotAuthorizedResponse.js +1 -1
  379. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  380. package/graphql/security/SecuritySchemaFactory.d.ts +15 -0
  381. package/graphql/security/SecuritySchemaFactory.js +27 -0
  382. package/graphql/security/SecuritySchemaFactory.js.map +1 -0
  383. package/graphql/security/addApiKeySchema.d.ts +2 -0
  384. package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
  385. package/graphql/security/addApiKeySchema.js.map +1 -0
  386. package/graphql/security/addIdentitySchema.d.ts +2 -0
  387. package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
  388. package/graphql/security/addIdentitySchema.js.map +1 -0
  389. package/graphql/security/addRoleSchema.d.ts +2 -0
  390. package/graphql/security/addRoleSchema.js +137 -0
  391. package/graphql/security/addRoleSchema.js.map +1 -0
  392. package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
  393. package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
  394. package/graphql/security/addSecurityBaseSchema.js.map +1 -0
  395. package/graphql/security/addTeamSchema.d.ts +2 -0
  396. package/graphql/security/addTeamSchema.js +157 -0
  397. package/graphql/security/addTeamSchema.js.map +1 -0
  398. package/graphql/system/SystemSchemaFactory.d.ts +10 -0
  399. package/graphql/system/SystemSchemaFactory.js +70 -0
  400. package/graphql/system/SystemSchemaFactory.js.map +1 -0
  401. package/graphql/users/UsersSchemaFactory.d.ts +10 -0
  402. package/graphql/users/UsersSchemaFactory.js +195 -0
  403. package/graphql/users/UsersSchemaFactory.js.map +1 -0
  404. package/graphql/wcp/WcpSchemaFactory.d.ts +10 -0
  405. package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +32 -18
  406. package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
  407. package/idp/JwksCache.d.ts +14 -3
  408. package/idp/JwksCache.js +97 -17
  409. package/idp/JwksCache.js.map +1 -1
  410. package/idp/JwksStoreFeature.d.ts +8 -0
  411. package/idp/JwksStoreFeature.js +11 -0
  412. package/idp/JwksStoreFeature.js.map +1 -0
  413. package/idp/MemoryJwksStore.d.ts +14 -0
  414. package/idp/MemoryJwksStore.js +21 -0
  415. package/idp/MemoryJwksStore.js.map +1 -0
  416. package/idp/OidcJwtIdentityProvider.js +5 -1
  417. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  418. package/idp/abstractions.d.ts +24 -0
  419. package/idp/abstractions.js +2 -1
  420. package/idp/abstractions.js.map +1 -1
  421. package/idp/feature.js +1 -2
  422. package/idp/feature.js.map +1 -1
  423. package/idp/index.d.ts +1 -0
  424. package/idp/index.js +1 -0
  425. package/index.d.ts +3 -1
  426. package/index.js +3 -1
  427. package/package.json +23 -24
  428. package/testing/environment.d.ts +14 -0
  429. package/testing/environment.js +18 -0
  430. package/testing/environment.js.map +1 -0
  431. package/types/core.d.ts +17 -5
  432. package/types/security.d.ts +1 -7
  433. package/types/tenancy.d.ts +0 -17
  434. package/types/users.d.ts +0 -13
  435. package/createApiCore.d.ts +0 -7
  436. package/createApiCore.js +0 -22
  437. package/createApiCore.js.map +0 -1
  438. package/graphql/security/apiKey.gql.d.ts +0 -4
  439. package/graphql/security/apiKey.gql.js.map +0 -1
  440. package/graphql/security/base.gql.d.ts +0 -4
  441. package/graphql/security/base.gql.js.map +0 -1
  442. package/graphql/security/identity.gql.d.ts +0 -4
  443. package/graphql/security/identity.gql.js.map +0 -1
  444. package/graphql/security/index.d.ts +0 -1
  445. package/graphql/security/index.js +0 -15
  446. package/graphql/security/index.js.map +0 -1
  447. package/graphql/security/role.gql.d.ts +0 -4
  448. package/graphql/security/role.gql.js +0 -106
  449. package/graphql/security/role.gql.js.map +0 -1
  450. package/graphql/security/team.gql.d.ts +0 -4
  451. package/graphql/security/team.gql.js +0 -119
  452. package/graphql/security/team.gql.js.map +0 -1
  453. package/graphql/system/createSystemGraphQL.d.ts +0 -2
  454. package/graphql/system/createSystemGraphQL.js +0 -54
  455. package/graphql/system/createSystemGraphQL.js.map +0 -1
  456. package/graphql/users/user.gql.d.ts +0 -3
  457. package/graphql/users/user.gql.js +0 -167
  458. package/graphql/users/user.gql.js.map +0 -1
  459. package/graphql/wcp/graphql.d.ts +0 -2
  460. package/graphql/wcp/graphql.js.map +0 -1
  461. package/legacy/security/LegacyContext.d.ts +0 -36
  462. package/legacy/security/LegacyContext.js +0 -152
  463. package/legacy/security/LegacyContext.js.map +0 -1
  464. package/legacy/security/createSecurityContext.d.ts +0 -3
  465. package/legacy/security/createSecurityContext.js +0 -10
  466. package/legacy/security/createSecurityContext.js.map +0 -1
  467. package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
  468. package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
  469. package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
  470. package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
  471. package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
  472. package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
  473. package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
  474. package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
  475. package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
  476. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
  477. package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
  478. package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
  479. package/legacy/security/plugins/secureHeaders.d.ts +0 -1
  480. package/legacy/security/plugins/secureHeaders.js +0 -30
  481. package/legacy/security/plugins/secureHeaders.js.map +0 -1
  482. package/legacy/tenancy/LegacyContext.d.ts +0 -15
  483. package/legacy/tenancy/LegacyContext.js +0 -57
  484. package/legacy/tenancy/LegacyContext.js.map +0 -1
  485. package/legacy/tenancy/createTenancyContext.d.ts +0 -3
  486. package/legacy/tenancy/createTenancyContext.js +0 -31
  487. package/legacy/tenancy/createTenancyContext.js.map +0 -1
  488. package/legacy/users/LegacyContext.d.ts +0 -13
  489. package/legacy/users/LegacyContext.js +0 -55
  490. package/legacy/users/LegacyContext.js.map +0 -1
  491. package/legacy/users/createAdminUsersContext.d.ts +0 -3
  492. package/legacy/users/createAdminUsersContext.js +0 -12
  493. package/legacy/users/createAdminUsersContext.js.map +0 -1
  494. package/legacy/wcp/LegacyWcpContext.d.ts +0 -33
  495. package/legacy/wcp/LegacyWcpContext.js +0 -84
  496. package/legacy/wcp/LegacyWcpContext.js.map +0 -1
  497. package/legacy/wcp/context.d.ts +0 -5
  498. package/legacy/wcp/context.js +0 -46
  499. package/legacy/wcp/context.js.map +0 -1
@@ -56,6 +56,12 @@ export declare namespace OidcIdentityProvider {
56
56
  }
57
57
  interface IJwkCache {
58
58
  getKeys(issuer: string): Promise<IJwk[]>;
59
+ /**
60
+ * Fetches the issuer's keys again, for a token signed with a key the cached set doesn't have
61
+ * (the issuer rotated its keys). Returns null when a fetch started less than a minute ago, or
62
+ * when the fetch fails, so tokens with made-up key ids can't make every request call the issuer.
63
+ */
64
+ refreshKeys(issuer: string): Promise<IJwk[] | null>;
59
65
  }
60
66
  /** Cache for JSON Web Keys used in JWT verification. */
61
67
  export declare const JwkCache: import("@webiny/di").Abstraction<IJwkCache>;
@@ -63,4 +69,22 @@ export declare namespace JwkCache {
63
69
  type Interface = IJwkCache;
64
70
  type Jwk = IJwk;
65
71
  }
72
+ export interface IJwksIssuerState {
73
+ keys?: IJwk[];
74
+ fetchedAt?: number;
75
+ lastAttemptAt?: number;
76
+ pending?: Promise<IJwk[]>;
77
+ }
78
+ export interface IJwksStore {
79
+ get(issuer: string): IJwksIssuerState;
80
+ }
81
+ /**
82
+ * Keeps each issuer's JSON Web Keys across requests. Register it in the ROOT container: JwkCache is
83
+ * registered per request, so keys kept there would be fetched again on every request.
84
+ */
85
+ export declare const JwksStore: import("@webiny/di").Abstraction<IJwksStore>;
86
+ export declare namespace JwksStore {
87
+ type Interface = IJwksStore;
88
+ type IssuerState = IJwksIssuerState;
89
+ }
66
90
  export {};
@@ -3,6 +3,7 @@ const IdentityProvider = createAbstraction("IdentityProvider");
3
3
  const JwtIdentityProvider = createAbstraction("JwtIdentityProvider");
4
4
  const OidcIdentityProvider = createAbstraction("OidcIdentityProvider");
5
5
  const JwkCache = createAbstraction("JwkCache");
6
- export { IdentityProvider, JwkCache, JwtIdentityProvider, OidcIdentityProvider };
6
+ const JwksStore = createAbstraction("JwksStore");
7
+ export { IdentityProvider, JwkCache, JwksStore, JwtIdentityProvider, OidcIdentityProvider };
7
8
 
8
9
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"idp/abstractions.js","sources":["../../src/idp/abstractions.ts"],"sourcesContent":["import type { JwtPayload as IJwtPayload, JwtHeader as IJwtHeader } from \"jsonwebtoken\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData as IIdentityData } from \"~/features/security/IdentityContext/Identity.js\";\nimport type { Jwk as IJwk } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type IJwt = {\n header: IJwtHeader;\n payload: IJwtPayload;\n};\n\nexport type OptionalExternal<T> = Omit<T, \"external\"> & { external?: boolean };\n\nexport type IProviderIdentityData = Omit<IIdentityData, \"type\" | \"profile\"> & {\n /**\n * Defaults to `admin` it omitted.\n */\n type?: string;\n profile?: OptionalExternal<NonNullable<IIdentityData[\"profile\"]>>;\n};\n\n// Generic Idp Provider\nexport interface IIdentityProvider {\n isApplicable(token: string): boolean;\n getIdentity(token: string): Promise<IProviderIdentityData | null>;\n}\n\n/** Generic identity provider for token-based authentication. */\nexport const IdentityProvider = createAbstraction<IIdentityProvider>(\"IdentityProvider\");\n\nexport namespace IdentityProvider {\n export type Interface = IIdentityProvider;\n export type IdentityData = IProviderIdentityData;\n export type JwtPayload = IJwtPayload;\n}\n\nexport interface IJwtIdentityProvider {\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(token: string, jwt: IJwt): Promise<IProviderIdentityData | null>;\n}\n\n/** JWT-specific identity provider for token validation. */\nexport const JwtIdentityProvider = createAbstraction<IJwtIdentityProvider>(\"JwtIdentityProvider\");\n\nexport namespace JwtIdentityProvider {\n export type Interface = IJwtIdentityProvider;\n export type Jwt = IJwt;\n export type JwtPayload = IJwtPayload;\n export type JwtHeader = IJwtHeader;\n export type IdentityData = IProviderIdentityData;\n}\n\n// OIDC Provider\nexport interface IOidcIdentityProvider {\n issuer: string;\n clientId: string;\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(jwt: IJwtPayload): Promise<IProviderIdentityData>;\n verifyToken?(token: string): Promise<IJwtPayload | undefined>;\n verifyTokenClaims?(token: IJwtPayload): Promise<void>;\n}\n\n/** OIDC-compliant identity provider with issuer validation. */\nexport const OidcIdentityProvider =\n createAbstraction<IOidcIdentityProvider>(\"OidcIdentityProvider\");\n\nexport namespace OidcIdentityProvider {\n export type Interface = IOidcIdentityProvider;\n export type JwtPayload = IJwtPayload;\n export type IdentityData = IProviderIdentityData;\n}\n\ninterface IJwkCache {\n getKeys(issuer: string): Promise<IJwk[]>;\n}\n\n/** Cache for JSON Web Keys used in JWT verification. */\nexport const JwkCache = createAbstraction<IJwkCache>(\"JwkCache\");\nexport namespace JwkCache {\n export type Interface = IJwkCache;\n export type Jwk = IJwk;\n}\n"],"names":["IdentityProvider","createAbstraction","JwtIdentityProvider","OidcIdentityProvider","JwkCache"],"mappings":";AA2BO,MAAMA,mBAAmBC,kBAAqC;AAc9D,MAAMC,sBAAsBD,kBAAwC;AAqBpE,MAAME,uBACTF,kBAAyC;AAatC,MAAMG,WAAWH,kBAA6B"}
1
+ {"version":3,"file":"idp/abstractions.js","sources":["../../src/idp/abstractions.ts"],"sourcesContent":["import type { JwtPayload as IJwtPayload, JwtHeader as IJwtHeader } from \"jsonwebtoken\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData as IIdentityData } from \"~/features/security/IdentityContext/Identity.js\";\nimport type { Jwk as IJwk } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type IJwt = {\n header: IJwtHeader;\n payload: IJwtPayload;\n};\n\nexport type OptionalExternal<T> = Omit<T, \"external\"> & { external?: boolean };\n\nexport type IProviderIdentityData = Omit<IIdentityData, \"type\" | \"profile\"> & {\n /**\n * Defaults to `admin` it omitted.\n */\n type?: string;\n profile?: OptionalExternal<NonNullable<IIdentityData[\"profile\"]>>;\n};\n\n// Generic Idp Provider\nexport interface IIdentityProvider {\n isApplicable(token: string): boolean;\n getIdentity(token: string): Promise<IProviderIdentityData | null>;\n}\n\n/** Generic identity provider for token-based authentication. */\nexport const IdentityProvider = createAbstraction<IIdentityProvider>(\"IdentityProvider\");\n\nexport namespace IdentityProvider {\n export type Interface = IIdentityProvider;\n export type IdentityData = IProviderIdentityData;\n export type JwtPayload = IJwtPayload;\n}\n\nexport interface IJwtIdentityProvider {\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(token: string, jwt: IJwt): Promise<IProviderIdentityData | null>;\n}\n\n/** JWT-specific identity provider for token validation. */\nexport const JwtIdentityProvider = createAbstraction<IJwtIdentityProvider>(\"JwtIdentityProvider\");\n\nexport namespace JwtIdentityProvider {\n export type Interface = IJwtIdentityProvider;\n export type Jwt = IJwt;\n export type JwtPayload = IJwtPayload;\n export type JwtHeader = IJwtHeader;\n export type IdentityData = IProviderIdentityData;\n}\n\n// OIDC Provider\nexport interface IOidcIdentityProvider {\n issuer: string;\n clientId: string;\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(jwt: IJwtPayload): Promise<IProviderIdentityData>;\n verifyToken?(token: string): Promise<IJwtPayload | undefined>;\n verifyTokenClaims?(token: IJwtPayload): Promise<void>;\n}\n\n/** OIDC-compliant identity provider with issuer validation. */\nexport const OidcIdentityProvider =\n createAbstraction<IOidcIdentityProvider>(\"OidcIdentityProvider\");\n\nexport namespace OidcIdentityProvider {\n export type Interface = IOidcIdentityProvider;\n export type JwtPayload = IJwtPayload;\n export type IdentityData = IProviderIdentityData;\n}\n\ninterface IJwkCache {\n getKeys(issuer: string): Promise<IJwk[]>;\n /**\n * Fetches the issuer's keys again, for a token signed with a key the cached set doesn't have\n * (the issuer rotated its keys). Returns null when a fetch started less than a minute ago, or\n * when the fetch fails, so tokens with made-up key ids can't make every request call the issuer.\n */\n refreshKeys(issuer: string): Promise<IJwk[] | null>;\n}\n\n/** Cache for JSON Web Keys used in JWT verification. */\nexport const JwkCache = createAbstraction<IJwkCache>(\"JwkCache\");\nexport namespace JwkCache {\n export type Interface = IJwkCache;\n export type Jwk = IJwk;\n}\n\nexport interface IJwksIssuerState {\n keys?: IJwk[];\n // When the keys were last fetched successfully.\n fetchedAt?: number;\n // When a fetch last started, successful or not. Limits how often an unknown key id can refetch.\n lastAttemptAt?: number;\n // The fetch in progress, shared by every request that needs it.\n pending?: Promise<IJwk[]>;\n}\n\nexport interface IJwksStore {\n // Returns the issuer's state, creating it on first use. Callers update it in place.\n get(issuer: string): IJwksIssuerState;\n}\n\n/**\n * Keeps each issuer's JSON Web Keys across requests. Register it in the ROOT container: JwkCache is\n * registered per request, so keys kept there would be fetched again on every request.\n */\nexport const JwksStore = createAbstraction<IJwksStore>(\"JwksStore\");\nexport namespace JwksStore {\n export type Interface = IJwksStore;\n export type IssuerState = IJwksIssuerState;\n}\n"],"names":["IdentityProvider","createAbstraction","JwtIdentityProvider","OidcIdentityProvider","JwkCache","JwksStore"],"mappings":";AA2BO,MAAMA,mBAAmBC,kBAAqC;AAc9D,MAAMC,sBAAsBD,kBAAwC;AAqBpE,MAAME,uBACTF,kBAAyC;AAmBtC,MAAMG,WAAWH,kBAA6B;AAyB9C,MAAMI,YAAYJ,kBAA8B"}
package/idp/feature.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { JwtAuthenticator } from "./JwtAuthenticator.js";
3
- import { JwkCache } from "./abstractions.js";
4
3
  import { JwksCache } from "./JwksCache.js";
5
4
  import { OidcJwtIdentityProvider } from "./OidcJwtIdentityProvider.js";
6
5
  const IdpAuthenticatorFeature = createFeature({
@@ -8,7 +7,7 @@ const IdpAuthenticatorFeature = createFeature({
8
7
  register (container) {
9
8
  container.register(JwtAuthenticator);
10
9
  container.register(OidcJwtIdentityProvider);
11
- container.registerInstance(JwkCache, new JwksCache());
10
+ container.register(JwksCache).inSingletonScope();
12
11
  }
13
12
  });
14
13
  export { IdpAuthenticatorFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"idp/feature.js","sources":["../../src/idp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { JwtAuthenticator } from \"./JwtAuthenticator.js\";\nimport { JwkCache } from \"./abstractions.js\";\nimport { JwksCache } from \"./JwksCache.js\";\nimport { OidcJwtIdentityProvider } from \"~/idp/OidcJwtIdentityProvider.js\";\n\nexport const IdpAuthenticatorFeature = createFeature({\n name: \"IdpAuthenticator\",\n register(container) {\n container.register(JwtAuthenticator);\n container.register(OidcJwtIdentityProvider);\n container.registerInstance(JwkCache, new JwksCache());\n }\n});\n"],"names":["IdpAuthenticatorFeature","createFeature","container","JwtAuthenticator","OidcJwtIdentityProvider","JwkCache","JwksCache"],"mappings":";;;;;AAMO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,gBAAgB,CAACG,UAAU,IAAIC;IAC7C;AACJ"}
1
+ {"version":3,"file":"idp/feature.js","sources":["../../src/idp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { JwtAuthenticator } from \"./JwtAuthenticator.js\";\nimport { JwksCache } from \"./JwksCache.js\";\nimport { OidcJwtIdentityProvider } from \"~/idp/OidcJwtIdentityProvider.js\";\n\nexport const IdpAuthenticatorFeature = createFeature({\n name: \"IdpAuthenticator\",\n register(container) {\n container.register(JwtAuthenticator);\n container.register(OidcJwtIdentityProvider);\n /*\n * Per request. The keys outlive it through JwksStore, which belongs in the root container\n * (JwksStoreFeature).\n */\n container.register(JwksCache).inSingletonScope();\n }\n});\n"],"names":["IdpAuthenticatorFeature","createFeature","container","JwtAuthenticator","OidcJwtIdentityProvider","JwksCache"],"mappings":";;;;AAKO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QAKnBF,UAAU,QAAQ,CAACG,WAAW,gBAAgB;IAClD;AACJ"}
package/idp/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { IdentityProvider, OidcIdentityProvider, JwtIdentityProvider } from "./abstractions.js";
2
2
  export type { IdentityData } from "./types.js";
3
+ export { JwksStoreFeature } from "./JwksStoreFeature.js";
package/idp/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export { IdentityProvider, JwtIdentityProvider, OidcIdentityProvider } from "./abstractions.js";
2
+ export { JwksStoreFeature } from "./JwksStoreFeature.js";
package/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export { createApiCore } from "./createApiCore.js";
1
+ export { ApiCoreFeature } from "./ApiCoreFeature.js";
2
+ export { ApiCoreStorageOperationsFactory, registerApiCoreStorageOperations } from "./features/storageOperations/abstractions.js";
3
+ export { WcpLicenseProvider } from "./features/wcp/WcpLicenseProvider.js";
package/index.js CHANGED
@@ -1 +1,3 @@
1
- export { createApiCore } from "./createApiCore.js";
1
+ export { ApiCoreFeature } from "./ApiCoreFeature.js";
2
+ export { ApiCoreStorageOperationsFactory, registerApiCoreStorageOperations } from "./features/storageOperations/abstractions.js";
3
+ export { WcpLicenseProvider } from "./features/wcp/WcpLicenseProvider.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-core",
3
- "version": "0.0.0-unstable.7be00a75a9",
3
+ "version": "0.0.0-unstable.7c2def32a7",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,39 +14,38 @@
14
14
  "./*": "./*"
15
15
  },
16
16
  "dependencies": {
17
- "@ai-sdk/anthropic": "3.0.78",
18
- "@ai-sdk/openai": "3.0.64",
19
- "@webiny/api": "0.0.0-unstable.7be00a75a9",
20
- "@webiny/di": "0.0.0-unstable.7be00a75a9",
21
- "@webiny/error": "0.0.0-unstable.7be00a75a9",
22
- "@webiny/feature": "0.0.0-unstable.7be00a75a9",
23
- "@webiny/feature-flags": "0.0.0-unstable.7be00a75a9",
24
- "@webiny/handler": "0.0.0-unstable.7be00a75a9",
25
- "@webiny/handler-db": "0.0.0-unstable.7be00a75a9",
26
- "@webiny/handler-graphql": "0.0.0-unstable.7be00a75a9",
27
- "@webiny/plugins": "0.0.0-unstable.7be00a75a9",
28
- "@webiny/utils": "0.0.0-unstable.7be00a75a9",
29
- "@webiny/wcp": "0.0.0-unstable.7be00a75a9",
30
- "ai": "6.0.185",
17
+ "@ai-sdk/anthropic": "4.0.40",
18
+ "@ai-sdk/google": "4.0.49",
19
+ "@ai-sdk/openai": "4.0.45",
20
+ "@openrouter/ai-sdk-provider": "3.1.0",
21
+ "@webiny/api": "0.0.0-unstable.7c2def32a7",
22
+ "@webiny/api-graphql": "0.0.0-unstable.7c2def32a7",
23
+ "@webiny/di": "2.0.0",
24
+ "@webiny/error": "0.0.0-unstable.7c2def32a7",
25
+ "@webiny/event-handler-core": "0.0.0-unstable.7c2def32a7",
26
+ "@webiny/feature": "0.0.0-unstable.7c2def32a7",
27
+ "@webiny/feature-flags": "0.0.0-unstable.7c2def32a7",
28
+ "@webiny/handler": "0.0.0-unstable.7c2def32a7",
29
+ "@webiny/utils": "0.0.0-unstable.7c2def32a7",
30
+ "@webiny/wcp": "0.0.0-unstable.7c2def32a7",
31
+ "ai": "7.0.73",
31
32
  "dataloader": "2.2.3",
32
- "jose": "6.2.3",
33
+ "graphql": "16.14.2",
34
+ "jose": "6.2.9",
33
35
  "jsonwebtoken": "9.0.3",
34
36
  "lodash": "4.18.1",
35
- "minimatch": "10.2.5",
37
+ "minimatch": "10.2.6",
36
38
  "pino": "10.3.1",
37
39
  "pino-lambda": "4.4.1",
40
+ "slugify": "1.6.9",
38
41
  "zod": "4.4.3"
39
42
  },
40
43
  "devDependencies": {
41
44
  "@types/jsonwebtoken": "9.0.10",
42
- "@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
43
- "@webiny/db-dynamodb": "0.0.0-unstable.7be00a75a9",
44
- "@webiny/handler-aws": "0.0.0-unstable.7be00a75a9",
45
- "@webiny/project-utils": "0.0.0-unstable.7be00a75a9",
46
- "jest-dynalite": "3.6.1",
45
+ "@webiny/build-tools": "0.0.0-unstable.7c2def32a7",
47
46
  "rimraf": "6.1.3",
48
- "typescript": "6.0.3",
49
- "vitest": "4.1.7"
47
+ "typescript": "7.0.2",
48
+ "vitest": "4.1.11"
50
49
  },
51
50
  "publishConfig": {
52
51
  "access": "public"
@@ -0,0 +1,14 @@
1
+ export type Plugin<T = Record<string, any>> = {
2
+ type: string;
3
+ name?: string;
4
+ init?: () => void;
5
+ [key: string]: any;
6
+ } & T;
7
+ export type PluginCollection = (Plugin | PluginCollection)[];
8
+ export interface StorageOperations<T = any> {
9
+ storageOperations: T;
10
+ plugins: PluginCollection;
11
+ }
12
+ export declare const getStorageOps: <T = any>(app: string) => StorageOperations<T>;
13
+ export declare const setStorageOps: (app: string, factory: () => StorageOperations) => void;
14
+ export declare const clearStorageOps: () => void;
@@ -0,0 +1,18 @@
1
+ const getStorageOps = (app)=>{
2
+ const storageOps = globalThis["__storageOps"];
3
+ if (void 0 === storageOps) throw new Error("Storage ops are not configured!");
4
+ const appStorageOps = storageOps[app];
5
+ if (void 0 === appStorageOps) throw new Error(`Storage ops for "${app}" are not configured! Have you configured "jest.setup.js" correctly?`);
6
+ return appStorageOps();
7
+ };
8
+ const setStorageOps = (app, factory)=>{
9
+ const storageOps = globalThis["__storageOps"] || {};
10
+ storageOps[app] = factory;
11
+ globalThis["__storageOps"] = storageOps;
12
+ };
13
+ const clearStorageOps = ()=>{
14
+ delete globalThis["__storageOps"];
15
+ };
16
+ export { clearStorageOps, getStorageOps, setStorageOps };
17
+
18
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing/environment.js","sources":["../../src/testing/environment.ts"],"sourcesContent":["export type Plugin<T = Record<string, any>> = {\n type: string;\n name?: string;\n init?: () => void;\n [key: string]: any;\n} & T;\n\nexport type PluginCollection = (Plugin | PluginCollection)[];\n\nexport interface StorageOperations<T = any> {\n storageOperations: T;\n plugins: PluginCollection;\n}\n\nexport const getStorageOps = <T = any>(app: string): StorageOperations<T> => {\n const storageOps = (globalThis as Record<string, any>)[\"__storageOps\"];\n\n if (typeof storageOps === \"undefined\") {\n throw new Error(`Storage ops are not configured!`);\n }\n\n const appStorageOps = storageOps[app];\n if (typeof appStorageOps === \"undefined\") {\n throw new Error(\n `Storage ops for \"${app}\" are not configured! Have you configured \"jest.setup.js\" correctly?`\n );\n }\n\n return appStorageOps();\n};\n\nexport const setStorageOps = (app: string, factory: () => StorageOperations): void => {\n const storageOps = (globalThis as Record<string, any>)[\"__storageOps\"] || {};\n storageOps[app] = factory;\n (globalThis as Record<string, any>)[\"__storageOps\"] = storageOps;\n};\n\nexport const clearStorageOps = (): void => {\n delete (globalThis as Record<string, any>)[\"__storageOps\"];\n};\n"],"names":["getStorageOps","app","storageOps","globalThis","Error","appStorageOps","setStorageOps","factory","clearStorageOps"],"mappings":"AAcO,MAAMA,gBAAgB,CAAUC;IACnC,MAAMC,aAAcC,UAAkC,CAAC,eAAe;IAEtE,IAAI,AAAsB,WAAfD,YACP,MAAM,IAAIE,MAAM;IAGpB,MAAMC,gBAAgBH,UAAU,CAACD,IAAI;IACrC,IAAI,AAAyB,WAAlBI,eACP,MAAM,IAAID,MACN,CAAC,iBAAiB,EAAEH,IAAI,oEAAoE,CAAC;IAIrG,OAAOI;AACX;AAEO,MAAMC,gBAAgB,CAACL,KAAaM;IACvC,MAAML,aAAcC,UAAkC,CAAC,eAAe,IAAI,CAAC;IAC3ED,UAAU,CAACD,IAAI,GAAGM;IACjBJ,UAAkC,CAAC,eAAe,GAAGD;AAC1D;AAEO,MAAMM,kBAAkB;IAC3B,OAAQL,UAAkC,CAAC,eAAe;AAC9D"}
package/types/core.d.ts CHANGED
@@ -1,13 +1,25 @@
1
1
  import { Context as BaseContext } from "@webiny/api/types.js";
2
- import type { SecurityContext, SecurityStorageOperations } from "../types/security.js";
3
- import type { TenancyContext, TenancyStorageOperations } from "../types/tenancy.js";
4
- import type { WcpContext } from "../features/wcp/WcpContext/types.js";
5
- import type { AdminUsersContext, AdminUsersStorageOperations } from "../types/users.js";
2
+ import type { SecurityStorageOperations } from "../types/security.js";
3
+ import type { TenancyStorageOperations } from "../types/tenancy.js";
4
+ import type { AdminUsersStorageOperations } from "../types/users.js";
6
5
  import { KeyValueStorageOperations } from "../features/keyValueStore/index.js";
7
- export type ApiCoreContext = BaseContext & SecurityContext & TenancyContext & WcpContext & AdminUsersContext;
6
+ import type { ILicense } from "@webiny/wcp/types.js";
7
+ /**
8
+ * The base handler context available to all api-core GraphQL resolvers and event handlers.
9
+ * Services are accessed via `context.container.resolve(...)`, not via context properties.
10
+ */
11
+ export type ApiCoreContext = BaseContext;
8
12
  export type ApiCoreStorageOperations = {
9
13
  usersStorageOperations: AdminUsersStorageOperations;
10
14
  tenancyStorageOperations: TenancyStorageOperations;
11
15
  securityStorageOperations: SecurityStorageOperations;
12
16
  keyValueStorageOperations: KeyValueStorageOperations.Interface;
13
17
  };
18
+ /**
19
+ * Config for `ApiCoreFeature.register` — runtime options only (e.g. the WCP license). Storage
20
+ * operations are no longer passed here; they are resolved from `ApiCoreStorageOperationsFactory`
21
+ * inside the feature (registered by a storage adapter or `registerApiCoreStorageOperations`).
22
+ */
23
+ export type ApiCoreConfig = {
24
+ wcpLicense?: ILicense;
25
+ };
@@ -1,5 +1,3 @@
1
- import type { TenancyContext } from "../types/tenancy.js";
2
- import type { LegacyContext } from "../legacy/security/LegacyContext.js";
3
1
  import { Identity } from "../features/security/IdentityContext/index.js";
4
2
  export type { Jwk, Jwt } from "../features/security/utils/verifyJwtUsingJwk.js";
5
3
  export type SecurityIdentity = Identity;
@@ -13,7 +11,6 @@ export interface GetTeamWhere {
13
11
  slug?: string;
14
12
  tenant?: string;
15
13
  }
16
- export type Security = LegacyContext;
17
14
  export interface SecurityStorageOperations {
18
15
  getRole(params: StorageOperationsGetRoleParams): Promise<Role | null>;
19
16
  listRoles(params: StorageOperationsListRolesParams): Promise<Role[]>;
@@ -36,9 +33,6 @@ export interface SecurityStorageOperations {
36
33
  export type SecurityPermission<T = Record<string, any>> = T & {
37
34
  name: string;
38
35
  };
39
- export interface SecurityContext extends TenancyContext {
40
- security: Security;
41
- }
42
36
  export interface FullAccessPermission {
43
37
  name: "*";
44
38
  }
@@ -135,7 +129,7 @@ export interface StorageApiKey {
135
129
  name: string;
136
130
  slug: string;
137
131
  description: string;
138
- token: string;
132
+ token: `wat_${string}`;
139
133
  permissions: SecurityPermission[];
140
134
  createdBy: CreatedBy;
141
135
  createdOn: string;
@@ -1,6 +1,3 @@
1
- import { DbContext } from "@webiny/handler-db/types.js";
2
- import { Context as BaseContext } from "@webiny/handler/types.js";
3
- import { WcpContext } from "../features/wcp/WcpContext/index.js";
4
1
  export type TenantSettings = Record<string, any>;
5
2
  export type TenantStatus = "enabled" | "disabled";
6
3
  export interface Tenant {
@@ -33,17 +30,3 @@ export interface TenancyStorageOperations {
33
30
  updateTenant(data: Tenant): Promise<Tenant>;
34
31
  deleteTenant(id: string): Promise<void>;
35
32
  }
36
- export interface TenancyContext extends BaseContext, DbContext, WcpContext.Interface {
37
- tenancy: Tenancy;
38
- }
39
- export interface Tenancy {
40
- getCurrentTenant(): Tenant;
41
- setCurrentTenant(tenant: Tenant): void;
42
- getRootTenant(): Promise<Tenant>;
43
- getTenantById(id: string): Promise<Tenant>;
44
- listTenants(params?: ListTenantsParams): Promise<Tenant[]>;
45
- createTenant(data: CreateTenantInput): Promise<Tenant>;
46
- withRootTenant<T>(cb: () => T): Promise<T>;
47
- withEachTenant<TReturn>(tenants: Tenant[], cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn[]>;
48
- withTenant<TReturn>(tenant: Tenant, cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn>;
49
- }
package/types/users.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- import type { SecurityContext, Team } from "../types/security.js";
2
- import type { TenancyContext } from "../types/tenancy.js";
3
- export interface AdminUsersContext extends SecurityContext, TenancyContext {
4
- adminUsers: AdminUsers;
5
- }
6
1
  export interface CreatedBy {
7
2
  id: string;
8
3
  displayName: string | null;
@@ -45,14 +40,6 @@ export interface ListUsersParams {
45
40
  };
46
41
  sort?: string[];
47
42
  }
48
- export interface AdminUsers {
49
- getUser<TUser extends AdminUser = AdminUser>(params: GetUserParams): Promise<TUser>;
50
- listUsers<TUser extends AdminUser = AdminUser>(params?: ListUsersParams): Promise<TUser[]>;
51
- listUserTeams(id: string): Promise<Team[]>;
52
- createUser<TUser extends AdminUser = AdminUser>(data: CreateUserInput): Promise<TUser>;
53
- updateUser<TUser extends AdminUser = AdminUser>(id: string, data: UpdateUserInput): Promise<TUser>;
54
- deleteUser(id: string): Promise<void>;
55
- }
56
43
  export interface StorageOperationsListUsersParams extends ListUsersParams {
57
44
  where: ListUsersParams["where"] & {
58
45
  tenant: string;
@@ -1,7 +0,0 @@
1
- import type { DecryptedWcpProjectLicense } from "@webiny/wcp/types.js";
2
- import type { ApiCoreStorageOperations } from "./types/core.js";
3
- export interface ApiCoreConfig {
4
- storageOperations: ApiCoreStorageOperations;
5
- testProjectLicense?: DecryptedWcpProjectLicense;
6
- }
7
- export declare const createApiCore: (config: ApiCoreConfig) => (import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("@webiny/api/types.js").Context> | import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context> | import("@webiny/api/index.js").ContextPlugin<import("~/types/core.js").ApiCoreContext> | import("@webiny/api/index.js").ContextPlugin<import("~/types/core.js").ApiCoreContext>[])[];
package/createApiCore.js DELETED
@@ -1,22 +0,0 @@
1
- import { createRegisterExtensionPlugin } from "@webiny/handler/plugins/RegisterExtensionPlugin.js";
2
- import { ApiCoreFeature } from "./ApiCoreFeature.js";
3
- import { createWcpContext } from "./legacy/wcp/context.js";
4
- import { createSecurityContext } from "./legacy/security/createSecurityContext.js";
5
- import { createAdminUsersContext } from "./legacy/users/createAdminUsersContext.js";
6
- import { createTenancyContext } from "./legacy/tenancy/createTenancyContext.js";
7
- import { createSystemGraphQL } from "./graphql/system/createSystemGraphQL.js";
8
- const createApiCore = (config)=>[
9
- createRegisterExtensionPlugin((context)=>{
10
- ApiCoreFeature.register(context.container, config.storageOperations);
11
- }),
12
- createWcpContext({
13
- testProjectLicense: config.testProjectLicense
14
- }),
15
- createTenancyContext(),
16
- createSecurityContext(),
17
- createAdminUsersContext(),
18
- createSystemGraphQL()
19
- ];
20
- export { createApiCore };
21
-
22
- //# sourceMappingURL=createApiCore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createApiCore.js","sources":["../src/createApiCore.ts"],"sourcesContent":["import { createRegisterExtensionPlugin } from \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\nimport { ApiCoreFeature } from \"./ApiCoreFeature.js\";\nimport type { DecryptedWcpProjectLicense } from \"@webiny/wcp/types.js\";\nimport { createWcpContext } from \"~/legacy/wcp/context.js\";\nimport { createSecurityContext } from \"~/legacy/security/createSecurityContext.js\";\nimport { createAdminUsersContext } from \"~/legacy/users/createAdminUsersContext.js\";\nimport { createTenancyContext } from \"~/legacy/tenancy/createTenancyContext.js\";\nimport { createSystemGraphQL } from \"~/graphql/system/createSystemGraphQL.js\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\n\nexport interface ApiCoreConfig {\n storageOperations: ApiCoreStorageOperations;\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport const createApiCore = (config: ApiCoreConfig) => {\n return [\n createRegisterExtensionPlugin(context => {\n ApiCoreFeature.register(context.container, config.storageOperations);\n }),\n createWcpContext({ testProjectLicense: config.testProjectLicense }),\n createTenancyContext(),\n createSecurityContext(),\n createAdminUsersContext(),\n createSystemGraphQL()\n ];\n};\n"],"names":["createApiCore","config","createRegisterExtensionPlugin","context","ApiCoreFeature","createWcpContext","createTenancyContext","createSecurityContext","createAdminUsersContext","createSystemGraphQL"],"mappings":";;;;;;;AAeO,MAAMA,gBAAgB,CAACC,SACnB;QACHC,8BAA8BC,CAAAA;YAC1BC,eAAe,QAAQ,CAACD,QAAQ,SAAS,EAAEF,OAAO,iBAAiB;QACvE;QACAI,iBAAiB;YAAE,oBAAoBJ,OAAO,kBAAkB;QAAC;QACjEK;QACAC;QACAC;QACAC;KACH"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/apiKey.gql.js","sources":["../../../src/graphql/security/apiKey.gql.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { CreateApiKeyUseCase } from \"~/features/security/apiKeys/CreateApiKey/index.js\";\nimport { UpdateApiKeyUseCase } from \"~/features/security/apiKeys/UpdateApiKey/index.js\";\nimport { DeleteApiKeyUseCase } from \"~/features/security/apiKeys/DeleteApiKey/index.js\";\nimport { ListApiKeysUseCase } from \"~/features/security/apiKeys/ListApiKeys/index.js\";\nimport { GetApiKeyUseCase } from \"~/features/security/apiKeys/GetApiKey/index.js\";\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityApiKey {\n id: ID\n name: String\n slug: String\n description: String\n token: String\n permissions: [JSON]\n createdOn: DateTime\n createdBy: SecurityCreatedBy\n }\n\n input SecurityApiKeyInput {\n id: ID\n name: String!\n slug: String\n description: String\n token: String\n permissions: [JSON]!\n }\n\n type SecurityApiKeyResponse {\n data: SecurityApiKey\n error: SecurityError\n }\n\n type SecurityApiKeyListResponse {\n data: [SecurityApiKey!]\n error: SecurityError\n }\n\n extend type SecurityQuery {\n listApiKeys: SecurityApiKeyListResponse\n getApiKey(id: ID!): SecurityApiKeyResponse\n }\n\n extend type SecurityMutation {\n createApiKey(data: SecurityApiKeyInput!): SecurityApiKeyResponse\n updateApiKey(id: ID!, data: SecurityApiKeyInput!): SecurityApiKeyResponse\n deleteApiKey(id: ID!): SecurityBooleanResponse\n }\n `,\n resolvers: {\n SecurityQuery: {\n async listApiKeys(_, __, context) {\n const list = context.container.resolve(ListApiKeysUseCase);\n const result = await list.execute();\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async getApiKey(_, args: any, context) {\n const getById = context.container.resolve(GetApiKeyUseCase);\n const result = await getById.execute(args.id);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n }\n },\n SecurityMutation: {\n async createApiKey(_, args: any, context) {\n const createApiKey = context.container.resolve(CreateApiKeyUseCase);\n const result = await createApiKey.execute(args.data);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async updateApiKey(_, args: any, context) {\n const updateApiKey = context.container.resolve(UpdateApiKeyUseCase);\n const result = await updateApiKey.execute(args.id, args.data);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async deleteApiKey(_, args: any, context) {\n const deleteApiKey = context.container.resolve(DeleteApiKeyUseCase);\n const result = await deleteApiKey.execute(args.id);\n\n if (result.isOk()) {\n return new Response(true);\n }\n return new ErrorResponse(result.error);\n }\n }\n }\n});\n"],"names":["GraphQLSchemaPlugin","_","__","context","list","ListApiKeysUseCase","result","Response","ErrorResponse","args","getById","GetApiKeyUseCase","createApiKey","CreateApiKeyUseCase","updateApiKey","UpdateApiKeyUseCase","deleteApiKey","DeleteApiKeyUseCase"],"mappings":";;;;;;;AASA,mBAAe,IAAIA,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCzB,CAAC;IACD,WAAW;QACP,eAAe;YACX,MAAM,aAAYC,CAAC,EAAEC,EAAE,EAAEC,OAAO;gBAC5B,MAAMC,OAAOD,QAAQ,SAAS,CAAC,OAAO,CAACE;gBACvC,MAAMC,SAAS,MAAMF,KAAK,OAAO;gBAEjC,IAAIE,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,WAAUL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACjC,MAAMO,UAAUP,QAAQ,SAAS,CAAC,OAAO,CAACQ;gBAC1C,MAAML,SAAS,MAAMI,QAAQ,OAAO,CAACD,KAAK,EAAE;gBAE5C,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;QACJ;QACA,kBAAkB;YACd,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMS,eAAeT,QAAQ,SAAS,CAAC,OAAO,CAACU;gBAC/C,MAAMP,SAAS,MAAMM,aAAa,OAAO,CAACH,KAAK,IAAI;gBAEnD,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMW,eAAeX,QAAQ,SAAS,CAAC,OAAO,CAACY;gBAC/C,MAAMT,SAAS,MAAMQ,aAAa,OAAO,CAACL,KAAK,EAAE,EAAEA,KAAK,IAAI;gBAE5D,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMa,eAAeb,QAAQ,SAAS,CAAC,OAAO,CAACc;gBAC/C,MAAMX,SAAS,MAAMU,aAAa,OAAO,CAACP,KAAK,EAAE;gBAEjD,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAAS;gBAExB,OAAO,IAAIC,cAAcF,OAAO,KAAK;YACzC;QACJ;IACJ;AACJ"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
- import type { SecurityContext } from "../../types/security.js";
3
- declare const _default: GraphQLSchemaPlugin<SecurityContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/base.gql.js","sources":["../../../src/graphql/security/base.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport type { SecurityContext } from \"~/types/security.js\";\n\nconst emptyResolver = () => ({});\n\nexport default new GraphQLSchemaPlugin<SecurityContext>({\n typeDefs: /* GraphQL */ `\n type SecurityMutation {\n _empty: String\n }\n\n type SecurityQuery {\n _empty: String\n }\n\n extend type Query {\n security: SecurityQuery\n }\n\n extend type Mutation {\n security: SecurityMutation\n }\n\n type SecurityCreatedBy {\n id: ID\n displayName: String\n }\n\n type SecurityError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type SecurityBooleanResponse {\n data: Boolean\n error: SecurityError\n }\n `,\n resolvers: {\n Query: {\n security: emptyResolver\n },\n Mutation: {\n security: emptyResolver\n }\n }\n});\n"],"names":["emptyResolver","GraphQLSchemaPlugin"],"mappings":";AAGA,MAAMA,gBAAgB,IAAO,EAAC;AAE9B,iBAAe,IAAIC,oBAAqC;IACpD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCzB,CAAC;IACD,WAAW;QACP,OAAO;YACH,UAAUD;QACd;QACA,UAAU;YACN,UAAUA;QACd;IACJ;AACJ"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/identity.gql.js","sources":["../../../src/graphql/security/identity.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { AfterLoginEvent } from \"~/features/security/login/index.js\";\nimport { GetIdentityProfileUseCase } from \"~/features/users/GetIdentityProfile/index.js\";\nimport type { SecurityContext } from \"~/types/security.js\";\nimport type { AdminUser } from \"~/types/users.js\";\nimport { TeamsRepository } from \"~/features/security/teams/shared/abstractions.js\";\nimport { RolesRepository } from \"~/features/security/roles/shared/abstractions.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { ProfileMapper } from \"./ProfileMapper.js\";\n\nconst getDefaultTenant = async (context: SecurityContext) => {\n const identity = context.security.getIdentity();\n const defaultTenantId = identity.context.defaultTenantId ?? \"root\";\n\n const defaultTenant = await context.tenancy.getTenantById(defaultTenantId);\n if (defaultTenant) {\n return defaultTenant;\n }\n\n return context.tenancy.getRootTenant();\n};\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityIdentityTenant {\n id: ID!\n name: String!\n }\n type SecurityIdentityProfileRole {\n id: String!\n slug: String!\n name: String!\n }\n\n type SecurityIdentityProfileTeam {\n id: String!\n slug: String!\n name: String!\n }\n\n type SecurityIdentityProfile {\n firstName: String\n lastName: String\n email: String\n avatar: JSON\n external: Boolean!\n createdOn: DateTime!\n }\n\n type SecurityIdentity {\n id: ID!\n type: String!\n displayName: String!\n roles: [SecurityIdentityProfileRole!]!\n teams: [SecurityIdentityProfileTeam!]!\n permissions: [JSON!]!\n profile: SecurityIdentityProfile!\n currentTenant: SecurityIdentityTenant!\n defaultTenant: SecurityIdentityTenant!\n }\n\n type SecurityIdentityLoginResponse {\n data: SecurityIdentity\n error: SecurityError\n }\n\n extend type SecurityMutation {\n \"Login using idToken obtained from a 3rd party identity provider\"\n login: SecurityIdentityLoginResponse\n }\n `,\n resolvers: {\n SecurityMutation: {\n login: async (_, __, context) => {\n const identityContext = context.container.resolve(IdentityContext);\n const identity = identityContext.getIdentity();\n if (identity.isAnonymous()) {\n return new ErrorResponse({\n code: \"Security/Identity/NotAuthenticated\",\n message: \"Unauthenticated!\"\n });\n }\n\n try {\n const eventPublisher = context.container.resolve(EventPublisher);\n await eventPublisher.publish(new AfterLoginEvent({ identity }));\n } catch (err) {\n return new ErrorResponse(err);\n }\n\n // Roles and teams are stored in the user record.\n const rolesRepo = context.container.resolve(RolesRepository);\n const teamsRepo = context.container.resolve(TeamsRepository);\n const getProfile = context.container.resolve(GetIdentityProfileUseCase);\n\n const result = await context.security.withoutAuthorization(async () => {\n return getProfile.execute(identity.id);\n });\n\n if (result.isFail()) {\n return new ErrorResponse({\n code: \"Security/Identity/NotAuthorized\",\n message: \"Missing user profile!\"\n });\n }\n\n const user = result.value;\n\n const [roles, teams] = await Promise.all([\n getRoles(user, rolesRepo),\n getTeams(user, teamsRepo)\n ]);\n\n const profileMapper = new ProfileMapper();\n const profile = await profileMapper.toDTO(user);\n\n return new Response({\n ...identity.toJson(),\n profile,\n roles,\n teams\n });\n }\n },\n SecurityIdentity: {\n defaultTenant(_, __, context) {\n return getDefaultTenant(context);\n },\n currentTenant(_, __, context) {\n return context.tenancy.getCurrentTenant();\n },\n permissions(_, __, context) {\n return context.security.listPermissions();\n }\n }\n }\n});\n\nconst getRoles = async (user: AdminUser, rolesRepo: RolesRepository.Interface) => {\n const roleIds = user.roles ?? [];\n if (roleIds.length > 0) {\n const result = await rolesRepo.list({\n where: { id_in: roleIds }\n });\n\n if (result.isOk()) {\n return result.value.map(role => ({\n id: role.id,\n slug: role.slug,\n name: role.name\n }));\n }\n }\n\n return [];\n};\n\nconst getTeams = async (user: AdminUser, teamsRepo: TeamsRepository.Interface) => {\n const teamIds = user.teams ?? [];\n if (teamIds.length > 0) {\n const result = await teamsRepo.list({\n where: { id_in: teamIds }\n });\n if (result.isOk()) {\n return result.value.map(team => ({\n id: team.id,\n slug: team.slug,\n name: team.name\n }));\n }\n }\n return [];\n};\n"],"names":["getDefaultTenant","context","identity","defaultTenantId","defaultTenant","GraphQLSchemaPlugin","_","__","identityContext","IdentityContext","ErrorResponse","eventPublisher","EventPublisher","AfterLoginEvent","err","rolesRepo","RolesRepository","teamsRepo","TeamsRepository","getProfile","GetIdentityProfileUseCase","result","user","roles","teams","Promise","getRoles","getTeams","profileMapper","ProfileMapper","profile","Response","roleIds","role","teamIds","team"],"mappings":";;;;;;;;;AAaA,MAAMA,mBAAmB,OAAOC;IAC5B,MAAMC,WAAWD,QAAQ,QAAQ,CAAC,WAAW;IAC7C,MAAME,kBAAkBD,SAAS,OAAO,CAAC,eAAe,IAAI;IAE5D,MAAME,gBAAgB,MAAMH,QAAQ,OAAO,CAAC,aAAa,CAACE;IAC1D,IAAIC,eACA,OAAOA;IAGX,OAAOH,QAAQ,OAAO,CAAC,aAAa;AACxC;AAEA,qBAAe,IAAII,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+CzB,CAAC;IACD,WAAW;QACP,kBAAkB;YACd,OAAO,OAAOC,GAAGC,IAAIN;gBACjB,MAAMO,kBAAkBP,QAAQ,SAAS,CAAC,OAAO,CAACQ;gBAClD,MAAMP,WAAWM,gBAAgB,WAAW;gBAC5C,IAAIN,SAAS,WAAW,IACpB,OAAO,IAAIQ,cAAc;oBACrB,MAAM;oBACN,SAAS;gBACb;gBAGJ,IAAI;oBACA,MAAMC,iBAAiBV,QAAQ,SAAS,CAAC,OAAO,CAACW;oBACjD,MAAMD,eAAe,OAAO,CAAC,IAAIE,gBAAgB;wBAAEX;oBAAS;gBAChE,EAAE,OAAOY,KAAK;oBACV,OAAO,IAAIJ,cAAcI;gBAC7B;gBAGA,MAAMC,YAAYd,QAAQ,SAAS,CAAC,OAAO,CAACe;gBAC5C,MAAMC,YAAYhB,QAAQ,SAAS,CAAC,OAAO,CAACiB;gBAC5C,MAAMC,aAAalB,QAAQ,SAAS,CAAC,OAAO,CAACmB;gBAE7C,MAAMC,SAAS,MAAMpB,QAAQ,QAAQ,CAAC,oBAAoB,CAAC,UAChDkB,WAAW,OAAO,CAACjB,SAAS,EAAE;gBAGzC,IAAImB,OAAO,MAAM,IACb,OAAO,IAAIX,cAAc;oBACrB,MAAM;oBACN,SAAS;gBACb;gBAGJ,MAAMY,OAAOD,OAAO,KAAK;gBAEzB,MAAM,CAACE,OAAOC,MAAM,GAAG,MAAMC,QAAQ,GAAG,CAAC;oBACrCC,SAASJ,MAAMP;oBACfY,SAASL,MAAML;iBAClB;gBAED,MAAMW,gBAAgB,IAAIC;gBAC1B,MAAMC,UAAU,MAAMF,cAAc,KAAK,CAACN;gBAE1C,OAAO,IAAIS,SAAS;oBAChB,GAAG7B,SAAS,MAAM,EAAE;oBACpB4B;oBACAP;oBACAC;gBACJ;YACJ;QACJ;QACA,kBAAkB;YACd,eAAclB,CAAC,EAAEC,EAAE,EAAEN,OAAO;gBACxB,OAAOD,iBAAiBC;YAC5B;YACA,eAAcK,CAAC,EAAEC,EAAE,EAAEN,OAAO;gBACxB,OAAOA,QAAQ,OAAO,CAAC,gBAAgB;YAC3C;YACA,aAAYK,CAAC,EAAEC,EAAE,EAAEN,OAAO;gBACtB,OAAOA,QAAQ,QAAQ,CAAC,eAAe;YAC3C;QACJ;IACJ;AACJ;AAEA,MAAMyB,WAAW,OAAOJ,MAAiBP;IACrC,MAAMiB,UAAUV,KAAK,KAAK,IAAI,EAAE;IAChC,IAAIU,QAAQ,MAAM,GAAG,GAAG;QACpB,MAAMX,SAAS,MAAMN,UAAU,IAAI,CAAC;YAChC,OAAO;gBAAE,OAAOiB;YAAQ;QAC5B;QAEA,IAAIX,OAAO,IAAI,IACX,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACY,CAAAA,OAAS;gBAC7B,IAAIA,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;IAER;IAEA,OAAO,EAAE;AACb;AAEA,MAAMN,WAAW,OAAOL,MAAiBL;IACrC,MAAMiB,UAAUZ,KAAK,KAAK,IAAI,EAAE;IAChC,IAAIY,QAAQ,MAAM,GAAG,GAAG;QACpB,MAAMb,SAAS,MAAMJ,UAAU,IAAI,CAAC;YAChC,OAAO;gBAAE,OAAOiB;YAAQ;QAC5B;QACA,IAAIb,OAAO,IAAI,IACX,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACc,CAAAA,OAAS;gBAC7B,IAAIA,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;IAER;IACA,OAAO,EAAE;AACb"}
@@ -1 +0,0 @@
1
- export declare const createSecurityGraphQL: () => import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("../../types/core.js").ApiCoreContext>[];
@@ -1,15 +0,0 @@
1
- import base_gql from "./base.gql.js";
2
- import apiKey_gql from "./apiKey.gql.js";
3
- import role_gql from "./role.gql.js";
4
- import team_gql from "./team.gql.js";
5
- import identity_gql from "./identity.gql.js";
6
- const createSecurityGraphQL = ()=>[
7
- base_gql,
8
- team_gql,
9
- apiKey_gql,
10
- role_gql,
11
- identity_gql
12
- ];
13
- export { createSecurityGraphQL };
14
-
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/index.js","sources":["../../../src/graphql/security/index.ts"],"sourcesContent":["import base from \"./base.gql.js\";\nimport apiKey from \"./apiKey.gql.js\";\nimport role from \"./role.gql.js\";\nimport team from \"./team.gql.js\";\nimport identity from \"./identity.gql.js\";\n\nexport const createSecurityGraphQL = () => {\n return [base, team, apiKey, role, identity];\n};\n"],"names":["createSecurityGraphQL","base","team","apiKey","role","identity"],"mappings":";;;;;AAMO,MAAMA,wBAAwB,IAC1B;QAACC;QAAMC;QAAMC;QAAQC;QAAMC;KAAS"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;
@@ -1,106 +0,0 @@
1
- import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/handler-graphql/responses.js";
2
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
3
- const role_gql = new GraphQLSchemaPlugin({
4
- typeDefs: `
5
- type SecurityRole {
6
- id: ID
7
- name: String
8
- slug: String
9
- createdOn: DateTime
10
- description: String
11
- permissions: [JSON]
12
- system: Boolean!
13
- plugin: Boolean
14
- }
15
-
16
- input SecurityRoleCreateInput {
17
- name: String!
18
- slug: String!
19
- description: String
20
- permissions: [JSON!]!
21
- }
22
-
23
- input SecurityRoleUpdateInput {
24
- name: String
25
- description: String
26
- permissions: [JSON!]
27
- }
28
-
29
- type SecurityRoleResponse {
30
- data: SecurityRole
31
- error: SecurityError
32
- }
33
-
34
- type SecurityRoleListResponse {
35
- data: [SecurityRole]
36
- error: SecurityError
37
- }
38
-
39
- input GetRoleWhereInput {
40
- id: ID
41
- slug: String
42
- }
43
-
44
- extend type SecurityQuery {
45
- getRole(where: GetRoleWhereInput!): SecurityRoleResponse
46
- listRoles: SecurityRoleListResponse
47
- }
48
-
49
- extend type SecurityMutation {
50
- createRole(data: SecurityRoleCreateInput!): SecurityRoleResponse
51
- updateRole(id: ID!, data: SecurityRoleUpdateInput!): SecurityRoleResponse
52
- deleteRole(id: ID!): SecurityBooleanResponse
53
- }
54
- `,
55
- resolvers: {
56
- SecurityQuery: {
57
- getRole: async (_, { where }, context)=>{
58
- try {
59
- const roles = await context.security.getRole({
60
- where
61
- });
62
- return new Response(roles);
63
- } catch (e) {
64
- return new ErrorResponse(e);
65
- }
66
- },
67
- listRoles: async (_, __, context)=>{
68
- try {
69
- const rolesList = await context.security.listRoles();
70
- return new ListResponse(rolesList);
71
- } catch (e) {
72
- return new ListErrorResponse(e);
73
- }
74
- }
75
- },
76
- SecurityMutation: {
77
- createRole: async (_, { data }, context)=>{
78
- try {
79
- const role = await context.security.createRole(data);
80
- return new Response(role);
81
- } catch (e) {
82
- return new ErrorResponse(e);
83
- }
84
- },
85
- updateRole: async (_, { id, data }, context)=>{
86
- try {
87
- const role = await context.security.updateRole(id, data);
88
- return new Response(role);
89
- } catch (e) {
90
- return new ErrorResponse(e);
91
- }
92
- },
93
- deleteRole: async (_, { id }, context)=>{
94
- try {
95
- await context.security.deleteRole(id);
96
- return new Response(true);
97
- } catch (e) {
98
- return new ErrorResponse(e);
99
- }
100
- }
101
- }
102
- }
103
- });
104
- export default role_gql;
105
-
106
- //# sourceMappingURL=role.gql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/role.gql.js","sources":["../../../src/graphql/security/role.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityRole {\n id: ID\n name: String\n slug: String\n createdOn: DateTime\n description: String\n permissions: [JSON]\n system: Boolean!\n plugin: Boolean\n }\n\n input SecurityRoleCreateInput {\n name: String!\n slug: String!\n description: String\n permissions: [JSON!]!\n }\n\n input SecurityRoleUpdateInput {\n name: String\n description: String\n permissions: [JSON!]\n }\n\n type SecurityRoleResponse {\n data: SecurityRole\n error: SecurityError\n }\n\n type SecurityRoleListResponse {\n data: [SecurityRole]\n error: SecurityError\n }\n\n input GetRoleWhereInput {\n id: ID\n slug: String\n }\n\n extend type SecurityQuery {\n getRole(where: GetRoleWhereInput!): SecurityRoleResponse\n listRoles: SecurityRoleListResponse\n }\n\n extend type SecurityMutation {\n createRole(data: SecurityRoleCreateInput!): SecurityRoleResponse\n updateRole(id: ID!, data: SecurityRoleUpdateInput!): SecurityRoleResponse\n deleteRole(id: ID!): SecurityBooleanResponse\n }\n `,\n resolvers: {\n SecurityQuery: {\n getRole: async (_, { where }, context) => {\n try {\n const roles = await context.security.getRole({ where });\n return new Response(roles);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listRoles: async (_, __, context) => {\n try {\n const rolesList = await context.security.listRoles();\n\n return new ListResponse(rolesList);\n } catch (e) {\n return new ListErrorResponse(e);\n }\n }\n },\n SecurityMutation: {\n createRole: async (_, { data }, context) => {\n try {\n const role = await context.security.createRole(data);\n\n return new Response(role);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateRole: async (_, { id, data }, context) => {\n try {\n const role = await context.security.updateRole(id, data);\n return new Response(role);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteRole: async (_, { id }, context) => {\n try {\n await context.security.deleteRole(id);\n\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n"],"names":["GraphQLSchemaPlugin","_","where","context","roles","Response","e","ErrorResponse","__","rolesList","ListResponse","ListErrorResponse","data","role","id"],"mappings":";;AASA,iBAAe,IAAIA,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkDzB,CAAC;IACD,WAAW;QACP,eAAe;YACX,SAAS,OAAOC,GAAG,EAAEC,KAAK,EAAE,EAAEC;gBAC1B,IAAI;oBACA,MAAMC,QAAQ,MAAMD,QAAQ,QAAQ,CAAC,OAAO,CAAC;wBAAED;oBAAM;oBACrD,OAAO,IAAIG,SAASD;gBACxB,EAAE,OAAOE,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,WAAW,OAAOL,GAAGO,IAAIL;gBACrB,IAAI;oBACA,MAAMM,YAAY,MAAMN,QAAQ,QAAQ,CAAC,SAAS;oBAElD,OAAO,IAAIO,aAAaD;gBAC5B,EAAE,OAAOH,GAAG;oBACR,OAAO,IAAIK,kBAAkBL;gBACjC;YACJ;QACJ;QACA,kBAAkB;YACd,YAAY,OAAOL,GAAG,EAAEW,IAAI,EAAE,EAAET;gBAC5B,IAAI;oBACA,MAAMU,OAAO,MAAMV,QAAQ,QAAQ,CAAC,UAAU,CAACS;oBAE/C,OAAO,IAAIP,SAASQ;gBACxB,EAAE,OAAOP,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOL,GAAG,EAAEa,EAAE,EAAEF,IAAI,EAAE,EAAET;gBAChC,IAAI;oBACA,MAAMU,OAAO,MAAMV,QAAQ,QAAQ,CAAC,UAAU,CAACW,IAAIF;oBACnD,OAAO,IAAIP,SAASQ;gBACxB,EAAE,OAAOP,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOL,GAAG,EAAEa,EAAE,EAAE,EAAEX;gBAC1B,IAAI;oBACA,MAAMA,QAAQ,QAAQ,CAAC,UAAU,CAACW;oBAElC,OAAO,IAAIT,SAAS;gBACxB,EAAE,OAAOC,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;IACJ;AACJ"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;