@webiny/api-core 6.6.0-alpha.0 → 6.6.0-alpha.10

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 (391) hide show
  1. package/ApiCoreFeature.js +12 -2
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/exports/api/security/api-key.d.ts +1 -0
  4. package/exports/api/security/api-key.js +1 -0
  5. package/exports/api/tasks.d.ts +1 -0
  6. package/exports/api/tasks.js +1 -1
  7. package/exports/api.d.ts +1 -1
  8. package/exports/api.js +1 -1
  9. package/features/ai/Ai.d.ts +5 -1
  10. package/features/ai/Ai.js +72 -29
  11. package/features/ai/Ai.js.map +1 -1
  12. package/features/ai/AiModelRegistry.d.ts +14 -0
  13. package/features/ai/AiModelRegistry.js +39 -0
  14. package/features/ai/AiModelRegistry.js.map +1 -0
  15. package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
  16. package/features/ai/AiSdkToolHandlerResolver.js +19 -0
  17. package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
  18. package/features/ai/AiSdkTools.d.ts +4 -3
  19. package/features/ai/AiSdkTools.js +11 -9
  20. package/features/ai/AiSdkTools.js.map +1 -1
  21. package/features/ai/AnthropicSdkFactory.js +24 -4
  22. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  23. package/features/ai/DEVELOPERS.md +183 -0
  24. package/features/ai/GoogleSdkFactory.d.ts +10 -0
  25. package/features/ai/GoogleSdkFactory.js +65 -0
  26. package/features/ai/GoogleSdkFactory.js.map +1 -0
  27. package/features/ai/OpenAiSdkFactory.js +67 -11
  28. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  29. package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
  30. package/features/ai/OpenRouterSdkFactory.js +112 -0
  31. package/features/ai/OpenRouterSdkFactory.js.map +1 -0
  32. package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
  33. package/features/ai/RemoteAiModelCatalog.js +74 -0
  34. package/features/ai/RemoteAiModelCatalog.js.map +1 -0
  35. package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
  36. package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
  37. package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
  38. package/features/ai/TextExtractor/abstractions.d.ts +12 -0
  39. package/features/ai/TextExtractor/abstractions.js +5 -0
  40. package/features/ai/TextExtractor/abstractions.js.map +1 -0
  41. package/features/ai/TextExtractor/index.d.ts +3 -0
  42. package/features/ai/TextExtractor/index.js +2 -0
  43. package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
  44. package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
  45. package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
  46. package/features/ai/abstractions.d.ts +102 -7
  47. package/features/ai/abstractions.js +6 -2
  48. package/features/ai/abstractions.js.map +1 -1
  49. package/features/ai/events.d.ts +59 -0
  50. package/features/ai/events.js +41 -0
  51. package/features/ai/events.js.map +1 -0
  52. package/features/ai/feature.js +12 -0
  53. package/features/ai/feature.js.map +1 -1
  54. package/features/ai/index.d.ts +5 -3
  55. package/features/ai/index.js +3 -1
  56. package/features/dateFormatter/DefaultDateFormatter.d.ts +15 -0
  57. package/features/dateFormatter/DefaultDateFormatter.js +20 -0
  58. package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
  59. package/features/dateFormatter/abstractions.d.ts +13 -0
  60. package/features/dateFormatter/abstractions.js +5 -0
  61. package/features/dateFormatter/abstractions.js.map +1 -0
  62. package/features/dateFormatter/feature.d.ts +4 -0
  63. package/features/dateFormatter/feature.js +11 -0
  64. package/features/dateFormatter/feature.js.map +1 -0
  65. package/features/dateFormatter/index.d.ts +3 -0
  66. package/features/dateFormatter/index.js +2 -0
  67. package/features/debugger/Debugger.d.ts +30 -0
  68. package/features/debugger/Debugger.js +142 -0
  69. package/features/debugger/Debugger.js.map +1 -0
  70. package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
  71. package/features/debugger/DebuggerRouteDecorator.js +102 -0
  72. package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
  73. package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
  74. package/features/debugger/GraphQLDebuggerTransport.js +45 -0
  75. package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
  76. package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
  77. package/features/debugger/__tests__/matchNamespace.test.js +68 -0
  78. package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
  79. package/features/debugger/__tests__/serialize.test.d.ts +1 -0
  80. package/features/debugger/__tests__/serialize.test.js +220 -0
  81. package/features/debugger/__tests__/serialize.test.js.map +1 -0
  82. package/features/debugger/abstractions.d.ts +100 -0
  83. package/features/debugger/abstractions.js +6 -0
  84. package/features/debugger/abstractions.js.map +1 -0
  85. package/features/debugger/feature.d.ts +5 -0
  86. package/features/debugger/feature.js +15 -0
  87. package/features/debugger/feature.js.map +1 -0
  88. package/features/debugger/index.d.ts +12 -0
  89. package/features/debugger/index.js +7 -0
  90. package/features/debugger/limits.d.ts +18 -0
  91. package/features/debugger/limits.js +11 -0
  92. package/features/debugger/limits.js.map +1 -0
  93. package/features/debugger/matchNamespace.d.ts +14 -0
  94. package/features/debugger/matchNamespace.js +35 -0
  95. package/features/debugger/matchNamespace.js.map +1 -0
  96. package/features/debugger/parseNamespaceHeader.d.ts +7 -0
  97. package/features/debugger/parseNamespaceHeader.js +16 -0
  98. package/features/debugger/parseNamespaceHeader.js.map +1 -0
  99. package/features/debugger/permissions.d.ts +14 -0
  100. package/features/debugger/permissions.js +8 -0
  101. package/features/debugger/permissions.js.map +1 -0
  102. package/features/debugger/permissionsSchema.d.ts +17 -0
  103. package/features/debugger/permissionsSchema.js +18 -0
  104. package/features/debugger/permissionsSchema.js.map +1 -0
  105. package/features/debugger/serialize.d.ts +11 -0
  106. package/features/debugger/serialize.js +121 -0
  107. package/features/debugger/serialize.js.map +1 -0
  108. package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
  109. package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
  110. package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
  111. package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
  112. package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
  113. package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
  114. package/features/encryption/EncryptionService.d.ts +3 -2
  115. package/features/encryption/EncryptionService.js +15 -13
  116. package/features/encryption/EncryptionService.js.map +1 -1
  117. package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
  118. package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
  119. package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
  120. package/features/encryption/abstractions.d.ts +26 -0
  121. package/features/encryption/abstractions.js +3 -1
  122. package/features/encryption/abstractions.js.map +1 -1
  123. package/features/encryption/feature.js +2 -0
  124. package/features/encryption/feature.js.map +1 -1
  125. package/features/encryption/index.d.ts +3 -0
  126. package/features/encryption/index.js +3 -1
  127. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
  128. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +61 -0
  129. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
  130. package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
  131. package/features/hashing/BuildParamsHashingConfig.js +18 -0
  132. package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
  133. package/features/hashing/ScryptHasher.d.ts +2 -2
  134. package/features/hashing/ScryptHasher.js +6 -8
  135. package/features/hashing/ScryptHasher.js.map +1 -1
  136. package/features/hashing/abstractions.d.ts +15 -0
  137. package/features/hashing/abstractions.js +2 -1
  138. package/features/hashing/abstractions.js.map +1 -1
  139. package/features/hashing/feature.js +2 -0
  140. package/features/hashing/feature.js.map +1 -1
  141. package/features/hashing/index.d.ts +1 -0
  142. package/features/hashing/index.js +1 -1
  143. package/features/httpClient/HttpClient.d.ts +7 -0
  144. package/features/httpClient/HttpClient.js +72 -0
  145. package/features/httpClient/HttpClient.js.map +1 -0
  146. package/features/httpClient/HttpRequestError.d.ts +10 -0
  147. package/features/httpClient/HttpRequestError.js +13 -0
  148. package/features/httpClient/HttpRequestError.js.map +1 -0
  149. package/features/httpClient/HttpStatusError.d.ts +12 -0
  150. package/features/httpClient/HttpStatusError.js +12 -0
  151. package/features/httpClient/HttpStatusError.js.map +1 -0
  152. package/features/httpClient/abstractions.d.ts +32 -0
  153. package/features/httpClient/abstractions.js +5 -0
  154. package/features/httpClient/abstractions.js.map +1 -0
  155. package/features/httpClient/feature.d.ts +4 -0
  156. package/features/httpClient/feature.js +11 -0
  157. package/features/httpClient/feature.js.map +1 -0
  158. package/features/httpClient/index.d.ts +3 -0
  159. package/features/httpClient/index.js +3 -0
  160. package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
  161. package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
  162. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  163. package/features/keyValueStore/KeyValueStore.d.ts +6 -2
  164. package/features/keyValueStore/KeyValueStore.js +13 -3
  165. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  166. package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
  167. package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
  168. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  169. package/features/keyValueStore/abstractions.d.ts +132 -14
  170. package/features/keyValueStore/abstractions.js.map +1 -1
  171. package/features/keyValueStore/errors.d.ts +29 -0
  172. package/features/keyValueStore/errors.js +49 -1
  173. package/features/keyValueStore/errors.js.map +1 -1
  174. package/features/keyValueStore/index.d.ts +4 -1
  175. package/features/keyValueStore/index.js +1 -1
  176. package/features/logger/NullLogger.d.ts +10 -0
  177. package/features/logger/NullLogger.js +12 -0
  178. package/features/logger/NullLogger.js.map +1 -0
  179. package/features/logger/index.d.ts +1 -0
  180. package/features/logger/index.js +1 -0
  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/abstractions.d.ts +22 -0
  205. package/features/requestContext/abstractions.js +2 -1
  206. package/features/requestContext/abstractions.js.map +1 -1
  207. package/features/requestContext/extractAssumePermissions.d.ts +14 -0
  208. package/features/requestContext/extractAssumePermissions.js +32 -0
  209. package/features/requestContext/extractAssumePermissions.js.map +1 -0
  210. package/features/requestContext/feature.d.ts +2 -1
  211. package/features/requestContext/feature.js +2 -0
  212. package/features/requestContext/feature.js.map +1 -1
  213. package/features/requestContext/index.d.ts +3 -1
  214. package/features/requestContext/index.js +2 -1
  215. package/features/security/IdentityContext/IdentityContext.d.ts +8 -4
  216. package/features/security/IdentityContext/IdentityContext.js +28 -11
  217. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  218. package/features/security/IdentityContext/abstractions.d.ts +6 -1
  219. package/features/security/IdentityContext/abstractions.js.map +1 -1
  220. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
  221. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  222. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
  223. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
  224. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
  225. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
  226. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
  227. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  228. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
  229. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
  230. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
  231. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  232. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
  233. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  234. package/features/security/apiKeys/feature.js +7 -2
  235. package/features/security/apiKeys/feature.js.map +1 -1
  236. package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
  237. package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
  238. package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
  239. package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
  240. package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
  241. package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
  242. package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
  243. package/features/security/apiKeys/shared/generateToken.js.map +1 -1
  244. package/features/security/apiKeys/shared/schemas.d.ts +2 -2
  245. package/features/security/apiKeys/shared/schemas.js +2 -2
  246. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  247. package/features/security/apiKeys/shared/types.d.ts +1 -1
  248. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
  249. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
  250. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  251. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  252. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  253. package/features/security/authorization/AuthorizationContext/feature.js +6 -1
  254. package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
  255. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
  256. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
  257. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
  258. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +3 -3
  259. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
  260. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
  261. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
  262. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  263. package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
  264. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  265. package/features/security/roles/CreateRole/schema.d.ts +1 -1
  266. package/features/security/roles/CreateRole/schema.js +1 -1
  267. package/features/security/roles/CreateRole/schema.js.map +1 -1
  268. package/features/security/roles/Installer/RolesInstaller.js +1 -0
  269. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  270. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
  271. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  272. package/features/security/roles/UpdateRole/schema.d.ts +1 -1
  273. package/features/security/roles/UpdateRole/schema.js +1 -1
  274. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  275. package/features/security/shared/description.d.ts +4 -0
  276. package/features/security/shared/description.js +7 -0
  277. package/features/security/shared/description.js.map +1 -0
  278. package/features/security/shared/index.d.ts +1 -0
  279. package/features/security/shared/index.js +1 -0
  280. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +3 -1
  281. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
  282. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  283. package/features/security/teams/CreateTeam/schema.d.ts +1 -1
  284. package/features/security/teams/CreateTeam/schema.js +1 -1
  285. package/features/security/teams/CreateTeam/schema.js.map +1 -1
  286. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
  287. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
  288. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  289. package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
  290. package/features/security/teams/UpdateTeam/schema.js +1 -1
  291. package/features/security/teams/UpdateTeam/schema.js.map +1 -1
  292. package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
  293. package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
  294. package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
  295. package/features/slugify/DefaultSlugify.d.ts +8 -0
  296. package/features/slugify/DefaultSlugify.js +20 -0
  297. package/features/slugify/DefaultSlugify.js.map +1 -0
  298. package/features/slugify/abstractions.d.ts +12 -0
  299. package/features/slugify/abstractions.js +5 -0
  300. package/features/slugify/abstractions.js.map +1 -0
  301. package/features/{logger → slugify}/feature.d.ts +1 -1
  302. package/features/slugify/feature.js +11 -0
  303. package/features/slugify/feature.js.map +1 -0
  304. package/features/slugify/index.d.ts +3 -0
  305. package/features/slugify/index.js +2 -0
  306. package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
  307. package/features/stringFormatter/DefaultStringFormatter.js +19 -0
  308. package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
  309. package/features/stringFormatter/abstractions.d.ts +11 -0
  310. package/features/stringFormatter/abstractions.js +5 -0
  311. package/features/stringFormatter/abstractions.js.map +1 -0
  312. package/features/stringFormatter/feature.d.ts +4 -0
  313. package/features/stringFormatter/feature.js +13 -0
  314. package/features/stringFormatter/feature.js.map +1 -0
  315. package/features/stringFormatter/index.d.ts +3 -0
  316. package/features/stringFormatter/index.js +2 -0
  317. package/features/task/TaskDefinition/abstractions.d.ts +69 -4
  318. package/features/task/TaskDefinition/abstractions.js +2 -1
  319. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  320. package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
  321. package/features/tenancy/TenantContext/TenantContext.js +31 -23
  322. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  323. package/features/users/shared/loaders.js.map +1 -1
  324. package/features/users/shared/types.d.ts +9 -7
  325. package/features/wcp/WcpContext/WcpContext.d.ts +11 -0
  326. package/features/wcp/WcpContext/WcpContext.js +33 -0
  327. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  328. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +14 -60
  329. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +77 -25
  330. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  331. package/features/wcp/WcpFeature.js +2 -0
  332. package/features/wcp/WcpFeature.js.map +1 -1
  333. package/features/wcp/WcpLicenseLoader.d.ts +25 -0
  334. package/features/wcp/WcpLicenseLoader.js +58 -0
  335. package/features/wcp/WcpLicenseLoader.js.map +1 -0
  336. package/features/wcp/WcpLicenseProvider.d.ts +6 -14
  337. package/features/wcp/WcpLicenseProvider.js +3 -7
  338. package/features/wcp/WcpLicenseProvider.js.map +1 -1
  339. package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
  340. package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
  341. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
  342. package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
  343. package/graphql/ApiCoreSchemaFactory.js +7 -1
  344. package/graphql/ApiCoreSchemaFactory.js.map +1 -1
  345. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +10 -0
  346. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +53 -0
  347. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
  348. package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
  349. package/graphql/security/SecuritySchemaFactory.js +4 -0
  350. package/graphql/security/SecuritySchemaFactory.js.map +1 -1
  351. package/graphql/system/SystemSchemaFactory.d.ts +1 -0
  352. package/graphql/system/SystemSchemaFactory.js +4 -0
  353. package/graphql/system/SystemSchemaFactory.js.map +1 -1
  354. package/graphql/users/UsersSchemaFactory.d.ts +1 -0
  355. package/graphql/users/UsersSchemaFactory.js +4 -0
  356. package/graphql/users/UsersSchemaFactory.js.map +1 -1
  357. package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
  358. package/graphql/wcp/WcpSchemaFactory.js +6 -0
  359. package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
  360. package/idp/JwksCache.d.ts +14 -3
  361. package/idp/JwksCache.js +97 -17
  362. package/idp/JwksCache.js.map +1 -1
  363. package/idp/JwksStoreFeature.d.ts +8 -0
  364. package/idp/JwksStoreFeature.js +11 -0
  365. package/idp/JwksStoreFeature.js.map +1 -0
  366. package/idp/MemoryJwksStore.d.ts +14 -0
  367. package/idp/MemoryJwksStore.js +21 -0
  368. package/idp/MemoryJwksStore.js.map +1 -0
  369. package/idp/OidcJwtIdentityProvider.js +5 -1
  370. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  371. package/idp/abstractions.d.ts +24 -0
  372. package/idp/abstractions.js +2 -1
  373. package/idp/abstractions.js.map +1 -1
  374. package/idp/feature.js +1 -2
  375. package/idp/feature.js.map +1 -1
  376. package/idp/index.d.ts +1 -0
  377. package/idp/index.js +1 -0
  378. package/package.json +22 -22
  379. package/testing/environment.d.ts +14 -0
  380. package/testing/environment.js +18 -0
  381. package/testing/environment.js.map +1 -0
  382. package/types/security.d.ts +1 -1
  383. package/types/users.d.ts +2 -3
  384. package/features/logger/LoggerService.d.ts +0 -14
  385. package/features/logger/LoggerService.js +0 -48
  386. package/features/logger/LoggerService.js.map +0 -1
  387. package/features/logger/feature.js +0 -11
  388. package/features/logger/feature.js.map +0 -1
  389. package/features/wcp/loadWcpLicense.d.ts +0 -2
  390. package/features/wcp/loadWcpLicense.js +0 -51
  391. package/features/wcp/loadWcpLicense.js.map +0 -1
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-core",
3
- "version": "6.6.0-alpha.0",
3
+ "version": "6.6.0-alpha.10",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,36 +14,36 @@
14
14
  "./*": "./*"
15
15
  },
16
16
  "dependencies": {
17
- "@ai-sdk/anthropic": "4.0.23",
18
- "@ai-sdk/openai": "4.0.22",
19
- "@webiny/api": "6.6.0-alpha.0",
20
- "@webiny/api-graphql": "6.6.0-alpha.0",
21
- "@webiny/di": "1.0.2",
22
- "@webiny/error": "6.6.0-alpha.0",
23
- "@webiny/feature": "6.6.0-alpha.0",
24
- "@webiny/feature-flags": "6.6.0-alpha.0",
25
- "@webiny/handler": "6.6.0-alpha.0",
26
- "@webiny/utils": "6.6.0-alpha.0",
27
- "@webiny/wcp": "6.6.0-alpha.0",
28
- "ai": "7.0.40",
17
+ "@ai-sdk/anthropic": "4.0.94",
18
+ "@ai-sdk/google": "4.0.109",
19
+ "@ai-sdk/openai": "4.0.106",
20
+ "@openrouter/ai-sdk-provider": "3.1.0",
21
+ "@webiny/api": "6.6.0-alpha.10",
22
+ "@webiny/api-graphql": "6.6.0-alpha.10",
23
+ "@webiny/di": "2.0.0",
24
+ "@webiny/error": "6.6.0-alpha.10",
25
+ "@webiny/event-handler-core": "6.6.0-alpha.10",
26
+ "@webiny/feature": "6.6.0-alpha.10",
27
+ "@webiny/feature-flags": "6.6.0-alpha.10",
28
+ "@webiny/handler": "6.6.0-alpha.10",
29
+ "@webiny/utils": "6.6.0-alpha.10",
30
+ "@webiny/wcp": "6.6.0-alpha.10",
31
+ "ai": "7.0.159",
29
32
  "dataloader": "2.2.3",
30
33
  "graphql": "16.14.2",
31
- "jose": "6.2.4",
34
+ "jose": "6.2.14",
32
35
  "jsonwebtoken": "9.0.3",
33
36
  "lodash": "4.18.1",
34
- "minimatch": "10.2.6",
35
- "pino": "10.3.1",
36
- "pino-lambda": "4.4.1",
37
- "zod": "4.4.3"
37
+ "minimatch": "11.0.3",
38
+ "slugify": "1.6.9",
39
+ "zod": "4.6.7"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@types/jsonwebtoken": "9.0.10",
41
- "@webiny/build-tools": "6.6.0-alpha.0",
42
- "@webiny/event-handler-core": "6.6.0-alpha.0",
43
- "@webiny/project-utils": "6.6.0-alpha.0",
43
+ "@webiny/build-tools": "6.6.0-alpha.10",
44
44
  "rimraf": "6.1.3",
45
45
  "typescript": "7.0.2",
46
- "vitest": "4.1.10"
46
+ "vitest": "5.0.5"
47
47
  },
48
48
  "publishConfig": {
49
49
  "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"}
@@ -129,7 +129,7 @@ export interface StorageApiKey {
129
129
  name: string;
130
130
  slug: string;
131
131
  description: string;
132
- token: string;
132
+ token: `wat_${string}`;
133
133
  permissions: SecurityPermission[];
134
134
  createdBy: CreatedBy;
135
135
  createdOn: string;
package/types/users.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ListUsersWhere } from "../features/users/shared/types.js";
1
2
  export interface CreatedBy {
2
3
  id: string;
3
4
  displayName: string | null;
@@ -35,9 +36,7 @@ export interface GetUserParams {
35
36
  };
36
37
  }
37
38
  export interface ListUsersParams {
38
- where?: {
39
- id_in?: string[];
40
- };
39
+ where?: ListUsersWhere;
41
40
  sort?: string[];
42
41
  }
43
42
  export interface StorageOperationsListUsersParams extends ListUsersParams {
@@ -1,14 +0,0 @@
1
- import { Logger as LoggerAbstraction } from "./abstractions.js";
2
- export declare class LoggerImpl implements LoggerAbstraction.Interface {
3
- private pinoLogger;
4
- constructor();
5
- trace(objOrMsg: object | string, ...args: any[]): void;
6
- debug(objOrMsg: object | string, ...args: any[]): void;
7
- info(objOrMsg: object | string, ...args: any[]): void;
8
- warn(objOrMsg: object | string, ...args: any[]): void;
9
- error(objOrMsg: object | string, ...args: any[]): void;
10
- fatal(objOrMsg: object | string, ...args: any[]): void;
11
- log(objOrMsg: object | string, ...args: any[]): void;
12
- private getLogLevel;
13
- }
14
- export declare const Logger: import("@webiny/di").Implementation<typeof LoggerImpl>;
@@ -1,48 +0,0 @@
1
- import { createImplementation } from "@webiny/feature/api";
2
- import { pino } from "pino";
3
- import { Logger } from "./abstractions.js";
4
- import { StructuredLogFormatter, pinoLambdaDestination } from "pino-lambda";
5
- const DEFAULT_LOG_LEVEL = "info";
6
- class LoggerImpl {
7
- constructor(){
8
- const level = this.getLogLevel();
9
- const destination = pinoLambdaDestination({
10
- formatter: new StructuredLogFormatter()
11
- });
12
- this.pinoLogger = pino({
13
- level
14
- }, destination);
15
- }
16
- trace(objOrMsg, ...args) {
17
- this.pinoLogger.trace(objOrMsg, ...args);
18
- }
19
- debug(objOrMsg, ...args) {
20
- this.pinoLogger.debug(objOrMsg, ...args);
21
- }
22
- info(objOrMsg, ...args) {
23
- this.pinoLogger.info(objOrMsg, ...args);
24
- }
25
- warn(objOrMsg, ...args) {
26
- this.pinoLogger.warn(objOrMsg, ...args);
27
- }
28
- error(objOrMsg, ...args) {
29
- this.pinoLogger.error(objOrMsg, ...args);
30
- }
31
- fatal(objOrMsg, ...args) {
32
- this.pinoLogger.fatal(objOrMsg, ...args);
33
- }
34
- log(objOrMsg, ...args) {
35
- this.pinoLogger.info(objOrMsg, ...args);
36
- }
37
- getLogLevel() {
38
- return process.env.WEBINY_API_LOG_LEVEL || DEFAULT_LOG_LEVEL;
39
- }
40
- }
41
- const LoggerService_Logger = createImplementation({
42
- abstraction: Logger,
43
- implementation: LoggerImpl,
44
- dependencies: []
45
- });
46
- export { LoggerImpl, LoggerService_Logger as Logger };
47
-
48
- //# sourceMappingURL=LoggerService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features/logger/LoggerService.js","sources":["../../../src/features/logger/LoggerService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { type Logger as PinoLogger, pino } from \"pino\";\nimport { Logger as LoggerAbstraction } from \"./abstractions.js\";\n\n// TODO: We have `pino-lambda` hardcoded here simply b/c of lack of good infrastructure.\n// We want `pino-lambda` for AWS Lambda, but its setup step relies on context of the Lambda function. That's\n// why we also have it hardcoded in `createHandler` function in `handler-aws` package.\n// Once we have a better infrastructure for handling such cases, we should refactor this.\nimport { pinoLambdaDestination, StructuredLogFormatter } from \"pino-lambda\";\n\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport class LoggerImpl implements LoggerAbstraction.Interface {\n private pinoLogger: PinoLogger;\n\n constructor() {\n const level = this.getLogLevel();\n const destination = pinoLambdaDestination({\n formatter: new StructuredLogFormatter()\n });\n this.pinoLogger = pino({ level }, destination);\n }\n\n trace(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.trace(objOrMsg, ...args);\n }\n\n debug(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.debug(objOrMsg, ...args);\n }\n\n info(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.info(objOrMsg, ...args);\n }\n\n warn(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.warn(objOrMsg, ...args);\n }\n\n error(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.error(objOrMsg, ...args);\n }\n\n fatal(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.fatal(objOrMsg, ...args);\n }\n\n log(objOrMsg: object | string, ...args: any[]) {\n this.pinoLogger.info(objOrMsg, ...args);\n }\n\n private getLogLevel() {\n return process.env.WEBINY_API_LOG_LEVEL || DEFAULT_LOG_LEVEL;\n }\n}\n\nexport const Logger = createImplementation({\n abstraction: LoggerAbstraction,\n implementation: LoggerImpl,\n dependencies: []\n});\n"],"names":["DEFAULT_LOG_LEVEL","LoggerImpl","level","destination","pinoLambdaDestination","StructuredLogFormatter","pino","objOrMsg","args","process","Logger","createImplementation","LoggerAbstraction"],"mappings":";;;;AAUA,MAAMA,oBAAoB;AAEnB,MAAMC;IAGT,aAAc;QACV,MAAMC,QAAQ,IAAI,CAAC,WAAW;QAC9B,MAAMC,cAAcC,sBAAsB;YACtC,WAAW,IAAIC;QACnB;QACA,IAAI,CAAC,UAAU,GAAGC,KAAK;YAAEJ;QAAM,GAAGC;IACtC;IAEA,MAAMI,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,KAAKD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEA,KAAKD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,MAAMD,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAACD,aAAaC;IACvC;IAEA,IAAID,QAAyB,EAAE,GAAGC,IAAW,EAAE;QAC3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAACD,aAAaC;IACtC;IAEQ,cAAc;QAClB,OAAOC,QAAQ,GAAG,CAAC,oBAAoB,IAAIT;IAC/C;AACJ;AAEO,MAAMU,uBAASC,qBAAqB;IACvC,aAAaC;IACb,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
@@ -1,11 +0,0 @@
1
- import { createFeature } from "@webiny/feature/api";
2
- import { Logger } from "./LoggerService.js";
3
- const LoggerFeature = createFeature({
4
- name: "LoggerFeature",
5
- register (container) {
6
- container.register(Logger);
7
- }
8
- });
9
- export { LoggerFeature };
10
-
11
- //# sourceMappingURL=feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features/logger/feature.js","sources":["../../../src/features/logger/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Logger } from \"./LoggerService.js\";\n\nexport const LoggerFeature = createFeature({\n name: \"LoggerFeature\",\n register(container) {\n container.register(Logger);\n }\n});\n"],"names":["LoggerFeature","createFeature","container","Logger"],"mappings":";;AAGO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,2 +0,0 @@
1
- import type { DecryptedWcpProjectLicense, ILicense } from "@webiny/wcp/types.js";
2
- export declare function loadWcpLicense(testProjectLicense?: DecryptedWcpProjectLicense): Promise<ILicense>;
@@ -1,51 +0,0 @@
1
- import { License, NullLicense, getWcpProjectEnvironment, getWcpProjectLicense } from "@webiny/wcp";
2
- import { getWcpProjectLicenseCacheKey } from "./WcpContext/utils.js";
3
- function resolveWcpProjectEnvironment() {
4
- const fromBlob = getWcpProjectEnvironment();
5
- if (fromBlob) return fromBlob;
6
- const projectId = process.env.WEBINY_PROJECT_ID || process.env.WCP_PROJECT_ID;
7
- const apiKey = process.env.WEBINY_PROJECT_API_KEY || process.env.WCP_PROJECT_ENVIRONMENT_API_KEY;
8
- if (!projectId || !apiKey) return null;
9
- const [orgId, project] = projectId.split("/");
10
- if (!orgId || !project) return null;
11
- return {
12
- id: "",
13
- apiKey,
14
- org: {
15
- id: orgId
16
- },
17
- project: {
18
- id: project
19
- }
20
- };
21
- }
22
- const wcpProjectEnvironment = resolveWcpProjectEnvironment();
23
- const cachedLicense = {
24
- cacheKey: null,
25
- project: null,
26
- license: new NullLicense()
27
- };
28
- async function loadWcpLicense(testProjectLicense) {
29
- if (testProjectLicense) cachedLicense.license = License.fromLicenseDto(testProjectLicense);
30
- else if (wcpProjectEnvironment) {
31
- const currentCacheKey = getWcpProjectLicenseCacheKey();
32
- if (cachedLicense.cacheKey !== currentCacheKey) {
33
- cachedLicense.cacheKey = currentCacheKey;
34
- const decryptedLicenseDto = await getWcpProjectLicense({
35
- orgId: wcpProjectEnvironment.org.id,
36
- projectId: wcpProjectEnvironment.project.id,
37
- projectEnvironmentApiKey: wcpProjectEnvironment.apiKey
38
- });
39
- if (decryptedLicenseDto) cachedLicense.project = {
40
- orgId: decryptedLicenseDto.orgId,
41
- projectId: decryptedLicenseDto.projectId,
42
- package: decryptedLicenseDto.package
43
- };
44
- cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);
45
- }
46
- }
47
- return cachedLicense.license;
48
- }
49
- export { loadWcpLicense };
50
-
51
- //# sourceMappingURL=loadWcpLicense.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features/wcp/loadWcpLicense.js","sources":["../../../src/features/wcp/loadWcpLicense.ts"],"sourcesContent":["import { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { License } from \"@webiny/wcp\";\nimport type { CachedWcpProjectLicense } from \"~/features/wcp/WcpContext/types.js\";\nimport { getWcpProjectLicenseCacheKey } from \"~/features/wcp/WcpContext/utils.js\";\n\n/**\n * Resolve the WCP project environment used to fetch the license. Prefer the CLI-computed\n * WCP_PROJECT_ENVIRONMENT blob (set by `applyWcpEnvVars` during `webiny serve` and the AWS deploy).\n * When it's absent — a CLI-less self-hosted deploy that boots the built handler directly (e.g.\n * `node start.mjs`) — derive the same org, project and api key straight from the runtime env, so a\n * fresh license can still be fetched.\n */\nfunction resolveWcpProjectEnvironment(): WcpProjectEnvironment | null {\n const fromBlob = getWcpProjectEnvironment();\n if (fromBlob) {\n return fromBlob;\n }\n\n const projectId = process.env.WEBINY_PROJECT_ID || process.env.WCP_PROJECT_ID;\n const apiKey =\n process.env.WEBINY_PROJECT_API_KEY || process.env.WCP_PROJECT_ENVIRONMENT_API_KEY;\n if (!projectId || !apiKey) {\n return null;\n }\n\n // WEBINY_PROJECT_ID has an \"orgId/projectId\" shape.\n const [orgId, project] = projectId.split(\"/\");\n if (!orgId || !project) {\n return null;\n }\n\n // `id` is intentionally empty. The WCP backend identifies the specific project environment\n // from the api key (sent as the request's authorization header); the license fetch only uses\n // org/project (URL path) + apiKey (auth), never the environment id. So there's nothing to fill.\n return { id: \"\", apiKey, org: { id: orgId }, project: { id: project } };\n}\n\nconst wcpProjectEnvironment = resolveWcpProjectEnvironment();\n\nconst cachedLicense: CachedWcpProjectLicense = {\n cacheKey: null,\n project: null,\n license: new NullLicense()\n};\n\nexport async function loadWcpLicense(\n testProjectLicense?: DecryptedWcpProjectLicense\n): Promise<ILicense> {\n if (testProjectLicense) {\n cachedLicense.license = License.fromLicenseDto(testProjectLicense);\n } else if (wcpProjectEnvironment) {\n const currentCacheKey = getWcpProjectLicenseCacheKey();\n if (cachedLicense.cacheKey !== currentCacheKey) {\n cachedLicense.cacheKey = currentCacheKey;\n // Pull the project license from the WCP API.\n const decryptedLicenseDto = await getWcpProjectLicense({\n orgId: wcpProjectEnvironment.org.id,\n projectId: wcpProjectEnvironment.project.id,\n projectEnvironmentApiKey: wcpProjectEnvironment.apiKey\n });\n\n if (decryptedLicenseDto) {\n cachedLicense.project = {\n orgId: decryptedLicenseDto.orgId,\n projectId: decryptedLicenseDto.projectId,\n package: decryptedLicenseDto.package\n };\n }\n\n cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);\n }\n }\n\n return cachedLicense.license;\n}\n"],"names":["resolveWcpProjectEnvironment","fromBlob","getWcpProjectEnvironment","projectId","process","apiKey","orgId","project","wcpProjectEnvironment","cachedLicense","NullLicense","loadWcpLicense","testProjectLicense","License","currentCacheKey","getWcpProjectLicenseCacheKey","decryptedLicenseDto","getWcpProjectLicense"],"mappings":";;AAiBA,SAASA;IACL,MAAMC,WAAWC;IACjB,IAAID,UACA,OAAOA;IAGX,MAAME,YAAYC,QAAQ,GAAG,CAAC,iBAAiB,IAAIA,QAAQ,GAAG,CAAC,cAAc;IAC7E,MAAMC,SACFD,QAAQ,GAAG,CAAC,sBAAsB,IAAIA,QAAQ,GAAG,CAAC,+BAA+B;IACrF,IAAI,CAACD,aAAa,CAACE,QACf,OAAO;IAIX,MAAM,CAACC,OAAOC,QAAQ,GAAGJ,UAAU,KAAK,CAAC;IACzC,IAAI,CAACG,SAAS,CAACC,SACX,OAAO;IAMX,OAAO;QAAE,IAAI;QAAIF;QAAQ,KAAK;YAAE,IAAIC;QAAM;QAAG,SAAS;YAAE,IAAIC;QAAQ;IAAE;AAC1E;AAEA,MAAMC,wBAAwBR;AAE9B,MAAMS,gBAAyC;IAC3C,UAAU;IACV,SAAS;IACT,SAAS,IAAIC;AACjB;AAEO,eAAeC,eAClBC,kBAA+C;IAE/C,IAAIA,oBACAH,cAAc,OAAO,GAAGI,QAAQ,cAAc,CAACD;SAC5C,IAAIJ,uBAAuB;QAC9B,MAAMM,kBAAkBC;QACxB,IAAIN,cAAc,QAAQ,KAAKK,iBAAiB;YAC5CL,cAAc,QAAQ,GAAGK;YAEzB,MAAME,sBAAsB,MAAMC,qBAAqB;gBACnD,OAAOT,sBAAsB,GAAG,CAAC,EAAE;gBACnC,WAAWA,sBAAsB,OAAO,CAAC,EAAE;gBAC3C,0BAA0BA,sBAAsB,MAAM;YAC1D;YAEA,IAAIQ,qBACAP,cAAc,OAAO,GAAG;gBACpB,OAAOO,oBAAoB,KAAK;gBAChC,WAAWA,oBAAoB,SAAS;gBACxC,SAASA,oBAAoB,OAAO;YACxC;YAGJP,cAAc,OAAO,GAAGI,QAAQ,cAAc,CAACG;QACnD;IACJ;IAEA,OAAOP,cAAc,OAAO;AAChC"}