@webiny/api-core 6.6.0-alpha.1 → 6.6.0-alpha.11

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 (344) hide show
  1. package/ApiCoreFeature.js +10 -2
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/exports/api/tasks.d.ts +1 -0
  4. package/exports/api/tasks.js +1 -1
  5. package/exports/api.d.ts +2 -1
  6. package/exports/api.js +2 -1
  7. package/features/ai/Ai.d.ts +3 -1
  8. package/features/ai/Ai.js +36 -28
  9. package/features/ai/Ai.js.map +1 -1
  10. package/features/ai/AiModelRegistry.d.ts +14 -0
  11. package/features/ai/AiModelRegistry.js +39 -0
  12. package/features/ai/AiModelRegistry.js.map +1 -0
  13. package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
  14. package/features/ai/AiSdkToolHandlerResolver.js +19 -0
  15. package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
  16. package/features/ai/AiSdkTools.d.ts +4 -3
  17. package/features/ai/AiSdkTools.js +11 -9
  18. package/features/ai/AiSdkTools.js.map +1 -1
  19. package/features/ai/AnthropicSdkFactory.js +12 -4
  20. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  21. package/features/ai/DEVELOPERS.md +183 -0
  22. package/features/ai/GoogleSdkFactory.d.ts +10 -0
  23. package/features/ai/GoogleSdkFactory.js +65 -0
  24. package/features/ai/GoogleSdkFactory.js.map +1 -0
  25. package/features/ai/OpenAiSdkFactory.js +51 -11
  26. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  27. package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
  28. package/features/ai/OpenRouterSdkFactory.js +112 -0
  29. package/features/ai/OpenRouterSdkFactory.js.map +1 -0
  30. package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
  31. package/features/ai/RemoteAiModelCatalog.js +74 -0
  32. package/features/ai/RemoteAiModelCatalog.js.map +1 -0
  33. package/features/ai/abstractions.d.ts +82 -6
  34. package/features/ai/abstractions.js +6 -2
  35. package/features/ai/abstractions.js.map +1 -1
  36. package/features/ai/feature.js +10 -0
  37. package/features/ai/feature.js.map +1 -1
  38. package/features/ai/index.d.ts +2 -4
  39. package/features/ai/index.js +1 -1
  40. package/features/cdnCache/NullCdnCache.d.ts +8 -0
  41. package/features/cdnCache/NullCdnCache.js +11 -0
  42. package/features/cdnCache/NullCdnCache.js.map +1 -0
  43. package/features/cdnCache/abstractions.d.ts +20 -0
  44. package/features/cdnCache/abstractions.js +5 -0
  45. package/features/cdnCache/abstractions.js.map +1 -0
  46. package/features/cdnCache/feature.d.ts +8 -0
  47. package/features/cdnCache/feature.js +11 -0
  48. package/features/cdnCache/feature.js.map +1 -0
  49. package/features/cdnCache/index.d.ts +2 -0
  50. package/features/cdnCache/index.js +2 -0
  51. package/features/debugger/Debugger.d.ts +30 -0
  52. package/features/debugger/Debugger.js +142 -0
  53. package/features/debugger/Debugger.js.map +1 -0
  54. package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
  55. package/features/debugger/DebuggerRouteDecorator.js +102 -0
  56. package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
  57. package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
  58. package/features/debugger/GraphQLDebuggerTransport.js +45 -0
  59. package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
  60. package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
  61. package/features/debugger/__tests__/matchNamespace.test.js +68 -0
  62. package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
  63. package/features/debugger/__tests__/serialize.test.d.ts +1 -0
  64. package/features/debugger/__tests__/serialize.test.js +220 -0
  65. package/features/debugger/__tests__/serialize.test.js.map +1 -0
  66. package/features/debugger/abstractions.d.ts +100 -0
  67. package/features/debugger/abstractions.js +6 -0
  68. package/features/debugger/abstractions.js.map +1 -0
  69. package/features/debugger/feature.d.ts +5 -0
  70. package/features/debugger/feature.js +15 -0
  71. package/features/debugger/feature.js.map +1 -0
  72. package/features/debugger/index.d.ts +12 -0
  73. package/features/debugger/index.js +7 -0
  74. package/features/debugger/limits.d.ts +18 -0
  75. package/features/debugger/limits.js +11 -0
  76. package/features/debugger/limits.js.map +1 -0
  77. package/features/debugger/matchNamespace.d.ts +14 -0
  78. package/features/debugger/matchNamespace.js +35 -0
  79. package/features/debugger/matchNamespace.js.map +1 -0
  80. package/features/debugger/parseNamespaceHeader.d.ts +7 -0
  81. package/features/debugger/parseNamespaceHeader.js +16 -0
  82. package/features/debugger/parseNamespaceHeader.js.map +1 -0
  83. package/features/debugger/permissions.d.ts +14 -0
  84. package/features/debugger/permissions.js +8 -0
  85. package/features/debugger/permissions.js.map +1 -0
  86. package/features/debugger/permissionsSchema.d.ts +17 -0
  87. package/features/debugger/permissionsSchema.js +18 -0
  88. package/features/debugger/permissionsSchema.js.map +1 -0
  89. package/features/debugger/serialize.d.ts +11 -0
  90. package/features/debugger/serialize.js +121 -0
  91. package/features/debugger/serialize.js.map +1 -0
  92. package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
  93. package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
  94. package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
  95. package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
  96. package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
  97. package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
  98. package/features/encryption/EncryptionService.d.ts +3 -2
  99. package/features/encryption/EncryptionService.js +15 -13
  100. package/features/encryption/EncryptionService.js.map +1 -1
  101. package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
  102. package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
  103. package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
  104. package/features/encryption/abstractions.d.ts +26 -0
  105. package/features/encryption/abstractions.js +3 -1
  106. package/features/encryption/abstractions.js.map +1 -1
  107. package/features/encryption/feature.js +2 -0
  108. package/features/encryption/feature.js.map +1 -1
  109. package/features/encryption/index.d.ts +3 -0
  110. package/features/encryption/index.js +3 -1
  111. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +13 -1
  112. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -1
  113. package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
  114. package/features/hashing/BuildParamsHashingConfig.js +18 -0
  115. package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
  116. package/features/hashing/ScryptHasher.d.ts +2 -2
  117. package/features/hashing/ScryptHasher.js +6 -8
  118. package/features/hashing/ScryptHasher.js.map +1 -1
  119. package/features/hashing/abstractions.d.ts +15 -0
  120. package/features/hashing/abstractions.js +2 -1
  121. package/features/hashing/abstractions.js.map +1 -1
  122. package/features/hashing/feature.js +2 -0
  123. package/features/hashing/feature.js.map +1 -1
  124. package/features/hashing/index.d.ts +1 -0
  125. package/features/hashing/index.js +1 -1
  126. package/features/httpClient/HttpClient.d.ts +7 -0
  127. package/features/httpClient/HttpClient.js +72 -0
  128. package/features/httpClient/HttpClient.js.map +1 -0
  129. package/features/httpClient/HttpRequestError.d.ts +10 -0
  130. package/features/httpClient/HttpRequestError.js +13 -0
  131. package/features/httpClient/HttpRequestError.js.map +1 -0
  132. package/features/httpClient/HttpStatusError.d.ts +12 -0
  133. package/features/httpClient/HttpStatusError.js +12 -0
  134. package/features/httpClient/HttpStatusError.js.map +1 -0
  135. package/features/httpClient/abstractions.d.ts +32 -0
  136. package/features/httpClient/abstractions.js +5 -0
  137. package/features/httpClient/abstractions.js.map +1 -0
  138. package/features/{logger → httpClient}/feature.d.ts +1 -1
  139. package/features/httpClient/feature.js +11 -0
  140. package/features/httpClient/feature.js.map +1 -0
  141. package/features/httpClient/index.d.ts +3 -0
  142. package/features/httpClient/index.js +3 -0
  143. package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
  144. package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
  145. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  146. package/features/keyValueStore/KeyValueStore.d.ts +6 -2
  147. package/features/keyValueStore/KeyValueStore.js +13 -3
  148. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  149. package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
  150. package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
  151. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  152. package/features/keyValueStore/abstractions.d.ts +132 -14
  153. package/features/keyValueStore/abstractions.js.map +1 -1
  154. package/features/keyValueStore/errors.d.ts +29 -0
  155. package/features/keyValueStore/errors.js +49 -1
  156. package/features/keyValueStore/errors.js.map +1 -1
  157. package/features/keyValueStore/index.d.ts +4 -1
  158. package/features/keyValueStore/index.js +1 -1
  159. package/features/logger/NullLogger.d.ts +10 -0
  160. package/features/logger/NullLogger.js +12 -0
  161. package/features/logger/NullLogger.js.map +1 -0
  162. package/features/logger/index.d.ts +1 -0
  163. package/features/logger/index.js +1 -0
  164. package/features/publicUrls/NullPublicUrls.d.ts +11 -0
  165. package/features/publicUrls/NullPublicUrls.js +17 -0
  166. package/features/publicUrls/NullPublicUrls.js.map +1 -0
  167. package/features/publicUrls/PublicUrl.d.ts +24 -0
  168. package/features/publicUrls/PublicUrl.js +43 -0
  169. package/features/publicUrls/PublicUrl.js.map +1 -0
  170. package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
  171. package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
  172. package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
  173. package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
  174. package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
  175. package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
  176. package/features/publicUrls/abstractions.d.ts +27 -0
  177. package/features/publicUrls/abstractions.js +5 -0
  178. package/features/publicUrls/abstractions.js.map +1 -0
  179. package/features/publicUrls/feature.d.ts +8 -0
  180. package/features/publicUrls/feature.js +11 -0
  181. package/features/publicUrls/feature.js.map +1 -0
  182. package/features/publicUrls/index.d.ts +3 -0
  183. package/features/publicUrls/index.js +3 -0
  184. package/features/requestContext/RawAssumePermissions.d.ts +14 -0
  185. package/features/requestContext/RawAssumePermissions.js +19 -0
  186. package/features/requestContext/RawAssumePermissions.js.map +1 -0
  187. package/features/requestContext/abstractions.d.ts +22 -0
  188. package/features/requestContext/abstractions.js +2 -1
  189. package/features/requestContext/abstractions.js.map +1 -1
  190. package/features/requestContext/extractAssumePermissions.d.ts +14 -0
  191. package/features/requestContext/extractAssumePermissions.js +32 -0
  192. package/features/requestContext/extractAssumePermissions.js.map +1 -0
  193. package/features/requestContext/feature.d.ts +2 -1
  194. package/features/requestContext/feature.js +2 -0
  195. package/features/requestContext/feature.js.map +1 -1
  196. package/features/requestContext/index.d.ts +3 -1
  197. package/features/requestContext/index.js +2 -1
  198. package/features/requestStorage/abstractions.d.ts +23 -0
  199. package/features/requestStorage/abstractions.js +5 -0
  200. package/features/requestStorage/abstractions.js.map +1 -0
  201. package/features/requestStorage/index.d.ts +1 -0
  202. package/features/requestStorage/index.js +1 -0
  203. package/features/security/IdentityContext/IdentityContext.d.ts +6 -2
  204. package/features/security/IdentityContext/IdentityContext.js +24 -7
  205. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  206. package/features/security/IdentityContext/abstractions.d.ts +6 -1
  207. package/features/security/IdentityContext/abstractions.js.map +1 -1
  208. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
  209. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
  210. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  211. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  212. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  213. package/features/security/authorization/AuthorizationContext/feature.js +6 -1
  214. package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
  215. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
  216. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
  217. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
  218. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
  219. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  220. package/features/security/roles/Installer/RolesInstaller.js +1 -0
  221. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  222. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.d.ts +11 -0
  223. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js +22 -0
  224. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js.map +1 -0
  225. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.d.ts +11 -0
  226. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js +22 -0
  227. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js.map +1 -0
  228. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.d.ts +11 -0
  229. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js +22 -0
  230. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js.map +1 -0
  231. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.d.ts +11 -0
  232. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js +40 -0
  233. package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js.map +1 -0
  234. package/features/security/roles/NotifyRoleChange/abstractions.d.ts +21 -0
  235. package/features/security/roles/NotifyRoleChange/abstractions.js +8 -0
  236. package/features/security/roles/NotifyRoleChange/abstractions.js.map +1 -0
  237. package/features/security/roles/NotifyRoleChange/feature.d.ts +5 -0
  238. package/features/security/roles/NotifyRoleChange/feature.js +17 -0
  239. package/features/security/roles/NotifyRoleChange/feature.js.map +1 -0
  240. package/features/security/roles/NotifyRoleChange/index.d.ts +2 -0
  241. package/features/security/roles/NotifyRoleChange/index.js +2 -0
  242. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +2 -1
  243. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  244. package/features/security/roles/feature.js +2 -0
  245. package/features/security/roles/feature.js.map +1 -1
  246. package/features/security/shared/definedOnly.d.ts +1 -0
  247. package/features/security/shared/definedOnly.js +8 -0
  248. package/features/security/shared/definedOnly.js.map +1 -0
  249. package/features/security/shared/index.d.ts +1 -0
  250. package/features/security/shared/index.js +1 -0
  251. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.d.ts +29 -0
  252. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js +58 -0
  253. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js.map +1 -0
  254. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.d.ts +11 -0
  255. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js +40 -0
  256. package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js.map +1 -0
  257. package/features/security/teams/NotifyTeamChange/abstractions.d.ts +21 -0
  258. package/features/security/teams/NotifyTeamChange/abstractions.js +8 -0
  259. package/features/security/teams/NotifyTeamChange/abstractions.js.map +1 -0
  260. package/features/security/teams/NotifyTeamChange/feature.d.ts +5 -0
  261. package/features/security/teams/NotifyTeamChange/feature.js +15 -0
  262. package/features/security/teams/NotifyTeamChange/feature.js.map +1 -0
  263. package/features/security/teams/NotifyTeamChange/index.d.ts +2 -0
  264. package/features/security/teams/NotifyTeamChange/index.js +2 -0
  265. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +2 -1
  266. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  267. package/features/security/teams/feature.js +2 -0
  268. package/features/security/teams/feature.js.map +1 -1
  269. package/features/task/TaskDefinition/abstractions.d.ts +13 -20
  270. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  271. package/features/task/TaskService/abstractions.d.ts +7 -0
  272. package/features/task/TaskService/abstractions.js.map +1 -1
  273. package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
  274. package/features/tenancy/TenantContext/TenantContext.js +31 -23
  275. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  276. package/features/users/shared/loaders.js.map +1 -1
  277. package/features/users/shared/types.d.ts +9 -7
  278. package/features/wcp/WcpContext/WcpContext.d.ts +6 -1
  279. package/features/wcp/WcpContext/WcpContext.js +17 -2
  280. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  281. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +9 -73
  282. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +25 -5
  283. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  284. package/features/wcp/WcpLicenseLoader.js.map +1 -1
  285. package/features/wcp/resolveWcpProjectEnvironment.d.ts +1 -1
  286. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -1
  287. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.d.ts +20 -0
  288. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js +24 -0
  289. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js.map +1 -0
  290. package/features/websockets/SendToIdentity/abstractions.d.ts +19 -0
  291. package/features/websockets/SendToIdentity/abstractions.js +5 -0
  292. package/features/websockets/SendToIdentity/abstractions.js.map +1 -0
  293. package/features/websockets/WebsocketServiceError.d.ts +7 -0
  294. package/features/websockets/WebsocketServiceError.js +14 -0
  295. package/features/websockets/WebsocketServiceError.js.map +1 -0
  296. package/features/websockets/index.d.ts +6 -0
  297. package/features/websockets/index.js +3 -0
  298. package/features/websockets/types.d.ts +15 -0
  299. package/features/websockets/types.js +0 -0
  300. package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
  301. package/graphql/ApiCoreSchemaFactory.js +7 -1
  302. package/graphql/ApiCoreSchemaFactory.js.map +1 -1
  303. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +1 -0
  304. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +4 -0
  305. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -1
  306. package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
  307. package/graphql/security/SecuritySchemaFactory.js +4 -0
  308. package/graphql/security/SecuritySchemaFactory.js.map +1 -1
  309. package/graphql/system/SystemSchemaFactory.d.ts +1 -0
  310. package/graphql/system/SystemSchemaFactory.js +4 -0
  311. package/graphql/system/SystemSchemaFactory.js.map +1 -1
  312. package/graphql/users/UsersSchemaFactory.d.ts +1 -0
  313. package/graphql/users/UsersSchemaFactory.js +4 -0
  314. package/graphql/users/UsersSchemaFactory.js.map +1 -1
  315. package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
  316. package/graphql/wcp/WcpSchemaFactory.js +5 -1
  317. package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
  318. package/idp/JwksCache.d.ts +14 -3
  319. package/idp/JwksCache.js +97 -17
  320. package/idp/JwksCache.js.map +1 -1
  321. package/idp/JwksStoreFeature.d.ts +8 -0
  322. package/idp/JwksStoreFeature.js +11 -0
  323. package/idp/JwksStoreFeature.js.map +1 -0
  324. package/idp/MemoryJwksStore.d.ts +14 -0
  325. package/idp/MemoryJwksStore.js +21 -0
  326. package/idp/MemoryJwksStore.js.map +1 -0
  327. package/idp/OidcJwtIdentityProvider.js +5 -1
  328. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  329. package/idp/abstractions.d.ts +24 -0
  330. package/idp/abstractions.js +2 -1
  331. package/idp/abstractions.js.map +1 -1
  332. package/idp/feature.js +1 -2
  333. package/idp/feature.js.map +1 -1
  334. package/idp/index.d.ts +1 -0
  335. package/idp/index.js +1 -0
  336. package/index.d.ts +1 -0
  337. package/index.js +1 -0
  338. package/package.json +21 -21
  339. package/types/users.d.ts +2 -3
  340. package/features/logger/LoggerService.d.ts +0 -14
  341. package/features/logger/LoggerService.js +0 -48
  342. package/features/logger/LoggerService.js.map +0 -1
  343. package/features/logger/feature.js +0 -11
  344. package/features/logger/feature.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ import type { Logger } from "./abstractions.js";
2
+ export declare class NullLogger implements Logger.Interface {
3
+ trace(): void;
4
+ debug(): void;
5
+ info(): void;
6
+ warn(): void;
7
+ error(): void;
8
+ fatal(): void;
9
+ log(): void;
10
+ }
@@ -0,0 +1,12 @@
1
+ class NullLogger {
2
+ trace() {}
3
+ debug() {}
4
+ info() {}
5
+ warn() {}
6
+ error() {}
7
+ fatal() {}
8
+ log() {}
9
+ }
10
+ export { NullLogger };
11
+
12
+ //# sourceMappingURL=NullLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/logger/NullLogger.js","sources":["../../../src/features/logger/NullLogger.ts"],"sourcesContent":["import type { Logger } from \"./abstractions.js\";\n\n/*\n * A Logger that drops every line. api-core registers no Logger, the event handlers register the real\n * one at root, so containers built without a handler, such as test harnesses, register this one.\n */\nexport class NullLogger implements Logger.Interface {\n public trace(): void {}\n\n public debug(): void {}\n\n public info(): void {}\n\n public warn(): void {}\n\n public error(): void {}\n\n public fatal(): void {}\n\n public log(): void {}\n}\n"],"names":["NullLogger"],"mappings":"AAMO,MAAMA;IACF,QAAc,CAAC;IAEf,QAAc,CAAC;IAEf,OAAa,CAAC;IAEd,OAAa,CAAC;IAEd,QAAc,CAAC;IAEf,QAAc,CAAC;IAEf,MAAY,CAAC;AACxB"}
@@ -1 +1,2 @@
1
1
  export { Logger } from "./abstractions.js";
2
+ export { NullLogger } from "./NullLogger.js";
@@ -1 +1,2 @@
1
1
  export { Logger } from "./abstractions.js";
2
+ export { NullLogger } from "./NullLogger.js";
@@ -0,0 +1,11 @@
1
+ import { PublicUrls } from "./abstractions.js";
2
+ import { PublicUrl } from "./PublicUrl.js";
3
+ /** Default for hosting types (and tests) that don't supply public URLs. */
4
+ declare class NullPublicUrlsImpl implements PublicUrls.Interface {
5
+ getApiUrl(): Promise<PublicUrl>;
6
+ getAdminUrl(): Promise<PublicUrl>;
7
+ }
8
+ export declare const NullPublicUrls: typeof NullPublicUrlsImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IPublicUrls>;
10
+ };
11
+ export {};
@@ -0,0 +1,17 @@
1
+ import { PublicUrls } from "./abstractions.js";
2
+ import { PublicUrl } from "./PublicUrl.js";
3
+ class NullPublicUrlsImpl {
4
+ async getApiUrl() {
5
+ return PublicUrl.unknown();
6
+ }
7
+ async getAdminUrl() {
8
+ return PublicUrl.unknown();
9
+ }
10
+ }
11
+ const NullPublicUrls = PublicUrls.createImplementation({
12
+ implementation: NullPublicUrlsImpl,
13
+ dependencies: []
14
+ });
15
+ export { NullPublicUrls };
16
+
17
+ //# sourceMappingURL=NullPublicUrls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/NullPublicUrls.js","sources":["../../../src/features/publicUrls/NullPublicUrls.ts"],"sourcesContent":["import { PublicUrls } from \"./abstractions.js\";\nimport { PublicUrl } from \"./PublicUrl.js\";\n\n/** Default for hosting types (and tests) that don't supply public URLs. */\nclass NullPublicUrlsImpl implements PublicUrls.Interface {\n async getApiUrl() {\n return PublicUrl.unknown();\n }\n\n async getAdminUrl() {\n return PublicUrl.unknown();\n }\n}\n\nexport const NullPublicUrls = PublicUrls.createImplementation({\n implementation: NullPublicUrlsImpl,\n dependencies: []\n});\n"],"names":["NullPublicUrlsImpl","PublicUrl","NullPublicUrls","PublicUrls"],"mappings":";;AAIA,MAAMA;IACF,MAAM,YAAY;QACd,OAAOC,UAAU,OAAO;IAC5B;IAEA,MAAM,cAAc;QAChB,OAAOA,UAAU,OAAO;IAC5B;AACJ;AAEO,MAAMC,iBAAiBC,WAAW,oBAAoB,CAAC;IAC1D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A public URL of the API or the Admin app. Usually an origin (https://api.example.com), but it can
3
+ * carry a path when the app is served under a prefix (the standalone dev proxy serves the API at
4
+ * http://localhost:3001/api). Never has a trailing slash.
5
+ *
6
+ * Always an object, never `null`: a URL the deployment doesn't know is an "unknown" `PublicUrl`
7
+ * whose string forms are empty. Check `isKnown()` only where unknown needs different output.
8
+ */
9
+ export declare class PublicUrl {
10
+ private readonly url;
11
+ private constructor();
12
+ /** Unknown for anything that isn't an absolute http(s) URL. */
13
+ static from(value: unknown): PublicUrl;
14
+ static unknown(): PublicUrl;
15
+ isKnown(): boolean;
16
+ /** Hostname plus port, e.g. `api.example.com` or `localhost:3001`. Empty when unknown. */
17
+ get host(): string;
18
+ /** Appends a path, e.g. `join("/files/")` gives `https://api.example.com/files/`. Empty when unknown. */
19
+ join(path: string): string;
20
+ /** The URL, or `fallback` when unknown, e.g. a placeholder in generated config. */
21
+ orElse(fallback: string): string;
22
+ /** Empty when unknown. */
23
+ toString(): string;
24
+ }
@@ -0,0 +1,43 @@
1
+ class PublicUrl {
2
+ constructor(url){
3
+ this.url = url;
4
+ }
5
+ static from(value) {
6
+ if ("string" != typeof value || !value.trim()) return PublicUrl.unknown();
7
+ const trimmed = value.trim();
8
+ let url;
9
+ try {
10
+ url = new URL(trimmed);
11
+ } catch {
12
+ return PublicUrl.unknown();
13
+ }
14
+ if ("https:" !== url.protocol && "http:" !== url.protocol) return PublicUrl.unknown();
15
+ url.pathname = url.pathname.replace(/\/+$/, "");
16
+ url.search = "";
17
+ url.hash = "";
18
+ return new PublicUrl(url);
19
+ }
20
+ static unknown() {
21
+ return new PublicUrl(null);
22
+ }
23
+ isKnown() {
24
+ return null !== this.url;
25
+ }
26
+ get host() {
27
+ return this.url?.host ?? "";
28
+ }
29
+ join(path) {
30
+ if (!this.url) return "";
31
+ return this.toString() + "/" + path.replace(/^\/+/, "");
32
+ }
33
+ orElse(fallback) {
34
+ return this.url ? this.toString() : fallback;
35
+ }
36
+ toString() {
37
+ if (!this.url) return "";
38
+ return this.url.origin + this.url.pathname.replace(/\/+$/, "");
39
+ }
40
+ }
41
+ export { PublicUrl };
42
+
43
+ //# sourceMappingURL=PublicUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/PublicUrl.js","sources":["../../../src/features/publicUrls/PublicUrl.ts"],"sourcesContent":["/**\n * A public URL of the API or the Admin app. Usually an origin (https://api.example.com), but it can\n * carry a path when the app is served under a prefix (the standalone dev proxy serves the API at\n * http://localhost:3001/api). Never has a trailing slash.\n *\n * Always an object, never `null`: a URL the deployment doesn't know is an \"unknown\" `PublicUrl`\n * whose string forms are empty. Check `isKnown()` only where unknown needs different output.\n */\nexport class PublicUrl {\n private constructor(private readonly url: URL | null) {}\n\n /** Unknown for anything that isn't an absolute http(s) URL. */\n static from(value: unknown): PublicUrl {\n if (typeof value !== \"string\" || !value.trim()) {\n return PublicUrl.unknown();\n }\n\n const trimmed = value.trim();\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return PublicUrl.unknown();\n }\n\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") {\n return PublicUrl.unknown();\n }\n\n url.pathname = url.pathname.replace(/\\/+$/, \"\");\n url.search = \"\";\n url.hash = \"\";\n\n return new PublicUrl(url);\n }\n\n static unknown(): PublicUrl {\n return new PublicUrl(null);\n }\n\n isKnown(): boolean {\n return this.url !== null;\n }\n\n /** Hostname plus port, e.g. `api.example.com` or `localhost:3001`. Empty when unknown. */\n get host(): string {\n return this.url?.host ?? \"\";\n }\n\n /** Appends a path, e.g. `join(\"/files/\")` gives `https://api.example.com/files/`. Empty when unknown. */\n join(path: string): string {\n if (!this.url) {\n return \"\";\n }\n\n return this.toString() + \"/\" + path.replace(/^\\/+/, \"\");\n }\n\n /** The URL, or `fallback` when unknown, e.g. a placeholder in generated config. */\n orElse(fallback: string): string {\n return this.url ? this.toString() : fallback;\n }\n\n /** Empty when unknown. */\n toString(): string {\n if (!this.url) {\n return \"\";\n }\n\n return this.url.origin + this.url.pathname.replace(/\\/+$/, \"\");\n }\n}\n"],"names":["PublicUrl","url","value","trimmed","URL","path","fallback"],"mappings":"AAQO,MAAMA;IACT,YAAqCC,GAAe,CAAE;aAAjBA,GAAG,GAAHA;IAAkB;IAGvD,OAAO,KAAKC,KAAc,EAAa;QACnC,IAAI,AAAiB,YAAjB,OAAOA,SAAsB,CAACA,MAAM,IAAI,IACxC,OAAOF,UAAU,OAAO;QAG5B,MAAMG,UAAUD,MAAM,IAAI;QAC1B,IAAID;QACJ,IAAI;YACAA,MAAM,IAAIG,IAAID;QAClB,EAAE,OAAM;YACJ,OAAOH,UAAU,OAAO;QAC5B;QAEA,IAAIC,AAAiB,aAAjBA,IAAI,QAAQ,IAAiBA,AAAiB,YAAjBA,IAAI,QAAQ,EACzC,OAAOD,UAAU,OAAO;QAG5BC,IAAI,QAAQ,GAAGA,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ;QAC5CA,IAAI,MAAM,GAAG;QACbA,IAAI,IAAI,GAAG;QAEX,OAAO,IAAID,UAAUC;IACzB;IAEA,OAAO,UAAqB;QACxB,OAAO,IAAID,UAAU;IACzB;IAEA,UAAmB;QACf,OAAO,AAAa,SAAb,IAAI,CAAC,GAAG;IACnB;IAGA,IAAI,OAAe;QACf,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ;IAC7B;IAGA,KAAKK,IAAY,EAAU;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,EACT,OAAO;QAGX,OAAO,IAAI,CAAC,QAAQ,KAAK,MAAMA,KAAK,OAAO,CAAC,QAAQ;IACxD;IAGA,OAAOC,QAAgB,EAAU;QAC7B,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,KAAKA;IACxC;IAGA,WAAmB;QACf,IAAI,CAAC,IAAI,CAAC,GAAG,EACT,OAAO;QAGX,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ;IAC/D;AACJ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { PublicUrl } from "../PublicUrl.js";
3
+ describe("PublicUrl", ()=>{
4
+ it.each([
5
+ void 0,
6
+ null,
7
+ 42,
8
+ "",
9
+ " ",
10
+ "not a url",
11
+ "api.example.com",
12
+ "ftp://example.com"
13
+ ])("is unknown for %j", (value)=>{
14
+ const url = PublicUrl.from(value);
15
+ expect(url.isKnown()).toBe(false);
16
+ expect(url.toString()).toBe("");
17
+ expect(url.host).toBe("");
18
+ expect(url.join("/files/")).toBe("");
19
+ expect(url.orElse("{API_HOST_URL}")).toBe("{API_HOST_URL}");
20
+ });
21
+ it("drops trailing slashes, query and hash", ()=>{
22
+ const url = PublicUrl.from(" https://api.example.com//?a=1#x ");
23
+ expect(url.toString()).toBe("https://api.example.com");
24
+ expect(url.isKnown()).toBe(true);
25
+ expect(url.orElse("{API_HOST_URL}")).toBe("https://api.example.com");
26
+ });
27
+ it("keeps a path prefix", ()=>{
28
+ const url = PublicUrl.from("http://localhost:3001/api/");
29
+ expect(url.toString()).toBe("http://localhost:3001/api");
30
+ expect(url.host).toBe("localhost:3001");
31
+ });
32
+ it("joins paths with exactly one slash", ()=>{
33
+ expect(PublicUrl.from("https://api.example.com/").join("/files/")).toBe("https://api.example.com/files/");
34
+ expect(PublicUrl.from("http://localhost:3001/api").join("files")).toBe("http://localhost:3001/api/files");
35
+ });
36
+ });
37
+
38
+ //# sourceMappingURL=PublicUrl.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/__tests__/PublicUrl.test.js","sources":["../../../../src/features/publicUrls/__tests__/PublicUrl.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { it } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { PublicUrl } from \"../PublicUrl.js\";\n\ndescribe(\"PublicUrl\", () => {\n it.each([undefined, null, 42, \"\", \" \", \"not a url\", \"api.example.com\", \"ftp://example.com\"])(\n \"is unknown for %j\",\n value => {\n const url = PublicUrl.from(value);\n\n expect(url.isKnown()).toBe(false);\n expect(url.toString()).toBe(\"\");\n expect(url.host).toBe(\"\");\n expect(url.join(\"/files/\")).toBe(\"\");\n expect(url.orElse(\"{API_HOST_URL}\")).toBe(\"{API_HOST_URL}\");\n }\n );\n\n it(\"drops trailing slashes, query and hash\", () => {\n const url = PublicUrl.from(\" https://api.example.com//?a=1#x \");\n\n expect(url.toString()).toBe(\"https://api.example.com\");\n expect(url.isKnown()).toBe(true);\n expect(url.orElse(\"{API_HOST_URL}\")).toBe(\"https://api.example.com\");\n });\n\n it(\"keeps a path prefix\", () => {\n const url = PublicUrl.from(\"http://localhost:3001/api/\");\n\n expect(url.toString()).toBe(\"http://localhost:3001/api\");\n expect(url.host).toBe(\"localhost:3001\");\n });\n\n it(\"joins paths with exactly one slash\", () => {\n expect(PublicUrl.from(\"https://api.example.com/\").join(\"/files/\")).toBe(\n \"https://api.example.com/files/\"\n );\n expect(PublicUrl.from(\"http://localhost:3001/api\").join(\"files\")).toBe(\n \"http://localhost:3001/api/files\"\n );\n });\n});\n"],"names":["describe","it","undefined","value","url","PublicUrl","expect"],"mappings":";;AAKAA,SAAS,aAAa;IAClBC,GAAG,IAAI,CAAC;QAACC;QAAW;QAAM;QAAI;QAAI;QAAO;QAAa;QAAmB;KAAoB,EACzF,qBACAC,CAAAA;QACI,MAAMC,MAAMC,UAAU,IAAI,CAACF;QAE3BG,OAAOF,IAAI,OAAO,IAAI,IAAI,CAAC;QAC3BE,OAAOF,IAAI,QAAQ,IAAI,IAAI,CAAC;QAC5BE,OAAOF,IAAI,IAAI,EAAE,IAAI,CAAC;QACtBE,OAAOF,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC;QACjCE,OAAOF,IAAI,MAAM,CAAC,mBAAmB,IAAI,CAAC;IAC9C;IAGJH,GAAG,0CAA0C;QACzC,MAAMG,MAAMC,UAAU,IAAI,CAAC;QAE3BC,OAAOF,IAAI,QAAQ,IAAI,IAAI,CAAC;QAC5BE,OAAOF,IAAI,OAAO,IAAI,IAAI,CAAC;QAC3BE,OAAOF,IAAI,MAAM,CAAC,mBAAmB,IAAI,CAAC;IAC9C;IAEAH,GAAG,uBAAuB;QACtB,MAAMG,MAAMC,UAAU,IAAI,CAAC;QAE3BC,OAAOF,IAAI,QAAQ,IAAI,IAAI,CAAC;QAC5BE,OAAOF,IAAI,IAAI,EAAE,IAAI,CAAC;IAC1B;IAEAH,GAAG,sCAAsC;QACrCK,OAAOD,UAAU,IAAI,CAAC,4BAA4B,IAAI,CAAC,YAAY,IAAI,CACnE;QAEJC,OAAOD,UAAU,IAAI,CAAC,6BAA6B,IAAI,CAAC,UAAU,IAAI,CAClE;IAER;AACJ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { Container } from "@webiny/feature/api";
3
+ import { PublicUrls, PublicUrlsFeature } from "../index.js";
4
+ describe("PublicUrls", ()=>{
5
+ it("returns unknown URLs by default", async ()=>{
6
+ const container = new Container();
7
+ PublicUrlsFeature.register(container);
8
+ const publicUrls = container.resolve(PublicUrls);
9
+ expect((await publicUrls.getApiUrl()).isKnown()).toBe(false);
10
+ expect((await publicUrls.getAdminUrl()).isKnown()).toBe(false);
11
+ });
12
+ });
13
+
14
+ //# sourceMappingURL=PublicUrls.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/__tests__/PublicUrls.test.js","sources":["../../../../src/features/publicUrls/__tests__/PublicUrls.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { it } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { Container } from \"@webiny/feature/api\";\nimport { PublicUrls } from \"../index.js\";\nimport { PublicUrlsFeature } from \"../index.js\";\n\ndescribe(\"PublicUrls\", () => {\n it(\"returns unknown URLs by default\", async () => {\n const container = new Container();\n PublicUrlsFeature.register(container);\n\n const publicUrls = container.resolve(PublicUrls);\n\n expect((await publicUrls.getApiUrl()).isKnown()).toBe(false);\n expect((await publicUrls.getAdminUrl()).isKnown()).toBe(false);\n });\n});\n"],"names":["describe","it","container","Container","PublicUrlsFeature","publicUrls","PublicUrls","expect"],"mappings":";;;AAOAA,SAAS,cAAc;IACnBC,GAAG,mCAAmC;QAClC,MAAMC,YAAY,IAAIC;QACtBC,kBAAkB,QAAQ,CAACF;QAE3B,MAAMG,aAAaH,UAAU,OAAO,CAACI;QAErCC,OAAQ,OAAMF,WAAW,SAAS,EAAC,EAAG,OAAO,IAAI,IAAI,CAAC;QACtDE,OAAQ,OAAMF,WAAW,WAAW,EAAC,EAAG,OAAO,IAAI,IAAI,CAAC;IAC5D;AACJ"}
@@ -0,0 +1,27 @@
1
+ import type { PublicUrl } from "./PublicUrl.js";
2
+ export interface IPublicUrls {
3
+ /**
4
+ * Public URL of the API for the current tenant, e.g. https://api.example.com. Uses the custom
5
+ * domain when one is configured. Unknown (see `PublicUrl.isKnown()`) when the deployment doesn't
6
+ * know it.
7
+ */
8
+ getApiUrl(): Promise<PublicUrl>;
9
+ /**
10
+ * Public URL of the Admin app for the current tenant, e.g. https://admin.example.com. Uses the
11
+ * custom domain when one is configured. Unknown when the deployment doesn't know it (e.g. the
12
+ * API is deployed but the Admin app isn't yet).
13
+ */
14
+ getAdminUrl(): Promise<PublicUrl>;
15
+ }
16
+ /**
17
+ * Public URLs of this deployment's API and Admin app. Each hosting type supplies its own
18
+ * implementation: AWS reads the service manifest written at deploy time
19
+ * (`@webiny/api-event-handler-aws`), standalone reads the `WEBINY_API_URL` / `WEBINY_ADMIN_URL`
20
+ * build params (`@webiny/api-event-handler-standalone`).
21
+ *
22
+ * Resolve per request and don't cache the result globally: values are "for the current tenant".
23
+ */
24
+ export declare const PublicUrls: import("@webiny/di").Abstraction<IPublicUrls>;
25
+ export declare namespace PublicUrls {
26
+ type Interface = IPublicUrls;
27
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const PublicUrls = createAbstraction("Core/PublicUrls");
3
+ export { PublicUrls };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/abstractions.js","sources":["../../../src/features/publicUrls/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { PublicUrl } from \"./PublicUrl.js\";\n\nexport interface IPublicUrls {\n /**\n * Public URL of the API for the current tenant, e.g. https://api.example.com. Uses the custom\n * domain when one is configured. Unknown (see `PublicUrl.isKnown()`) when the deployment doesn't\n * know it.\n */\n getApiUrl(): Promise<PublicUrl>;\n /**\n * Public URL of the Admin app for the current tenant, e.g. https://admin.example.com. Uses the\n * custom domain when one is configured. Unknown when the deployment doesn't know it (e.g. the\n * API is deployed but the Admin app isn't yet).\n */\n getAdminUrl(): Promise<PublicUrl>;\n}\n\n/**\n * Public URLs of this deployment's API and Admin app. Each hosting type supplies its own\n * implementation: AWS reads the service manifest written at deploy time\n * (`@webiny/api-event-handler-aws`), standalone reads the `WEBINY_API_URL` / `WEBINY_ADMIN_URL`\n * build params (`@webiny/api-event-handler-standalone`).\n *\n * Resolve per request and don't cache the result globally: values are \"for the current tenant\".\n */\nexport const PublicUrls = createAbstraction<IPublicUrls>(\"Core/PublicUrls\");\n\nexport namespace PublicUrls {\n export type Interface = IPublicUrls;\n}\n"],"names":["PublicUrls","createAbstraction"],"mappings":";AA0BO,MAAMA,aAAaC,kBAA+B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Registers the default, which knows no URLs. Each hosting type overrides it through the
3
+ * `publicUrls` hook of `registerApiRequestStack`.
4
+ */
5
+ export declare const PublicUrlsFeature: {
6
+ name: string;
7
+ register(container: import("@webiny/di").Container): void;
8
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { NullPublicUrls } from "./NullPublicUrls.js";
3
+ const PublicUrlsFeature = createFeature({
4
+ name: "PublicUrlsFeature",
5
+ register (container) {
6
+ container.register(NullPublicUrls);
7
+ }
8
+ });
9
+ export { PublicUrlsFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/publicUrls/feature.js","sources":["../../../src/features/publicUrls/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NullPublicUrls } from \"./NullPublicUrls.js\";\n\n/**\n * Registers the default, which knows no URLs. Each hosting type overrides it through the\n * `publicUrls` hook of `registerApiRequestStack`.\n */\nexport const PublicUrlsFeature = createFeature({\n name: \"PublicUrlsFeature\",\n register(container) {\n container.register(NullPublicUrls);\n }\n});\n"],"names":["PublicUrlsFeature","createFeature","container","NullPublicUrls"],"mappings":";;AAOO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,3 @@
1
+ export { PublicUrls } from "./abstractions.js";
2
+ export { PublicUrl } from "./PublicUrl.js";
3
+ export { PublicUrlsFeature } from "./feature.js";
@@ -0,0 +1,3 @@
1
+ export { PublicUrls } from "./abstractions.js";
2
+ export { PublicUrl } from "./PublicUrl.js";
3
+ export { PublicUrlsFeature } from "./feature.js";
@@ -0,0 +1,14 @@
1
+ import { RawAssumePermissions as Abstraction } from "./abstractions.js";
2
+ /**
3
+ * Per-request holder for the transport-extracted preview target. Registered per request, so a
4
+ * fresh instance holds the value for the current request only.
5
+ */
6
+ declare class RawAssumePermissionsImpl implements Abstraction.Interface {
7
+ private value;
8
+ get(): Abstraction.Target | null;
9
+ set(value: Abstraction.Target | null): void;
10
+ }
11
+ export declare const RawAssumePermissions: typeof RawAssumePermissionsImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRawAssumePermissions>;
13
+ };
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { RawAssumePermissions } from "./abstractions.js";
2
+ class RawAssumePermissionsImpl {
3
+ get() {
4
+ return this.value;
5
+ }
6
+ set(value) {
7
+ this.value = value;
8
+ }
9
+ constructor(){
10
+ this.value = null;
11
+ }
12
+ }
13
+ const RawAssumePermissions_RawAssumePermissions = RawAssumePermissions.createImplementation({
14
+ implementation: RawAssumePermissionsImpl,
15
+ dependencies: []
16
+ });
17
+ export { RawAssumePermissions_RawAssumePermissions as RawAssumePermissions };
18
+
19
+ //# sourceMappingURL=RawAssumePermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/RawAssumePermissions.js","sources":["../../../src/features/requestContext/RawAssumePermissions.ts"],"sourcesContent":["import { RawAssumePermissions as Abstraction } from \"./abstractions.js\";\n\n/**\n * Per-request holder for the transport-extracted preview target. Registered per request, so a\n * fresh instance holds the value for the current request only.\n */\nclass RawAssumePermissionsImpl implements Abstraction.Interface {\n private value: Abstraction.Target | null = null;\n\n get(): Abstraction.Target | null {\n return this.value;\n }\n\n set(value: Abstraction.Target | null): void {\n this.value = value;\n }\n}\n\nexport const RawAssumePermissions = Abstraction.createImplementation({\n implementation: RawAssumePermissionsImpl,\n dependencies: []\n});\n"],"names":["RawAssumePermissionsImpl","value","RawAssumePermissions","Abstraction"],"mappings":";AAMA,MAAMA;IAGF,MAAiC;QAC7B,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,IAAIC,KAAgC,EAAQ;QACxC,IAAI,CAAC,KAAK,GAAGA;IACjB;;aARQ,KAAK,GAA8B;;AAS/C;AAEO,MAAMC,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -29,6 +29,28 @@ export declare const RawAuthToken: import("@webiny/di").Abstraction<IRawAuthToke
29
29
  export declare namespace RawAuthToken {
30
30
  type Interface = IRawAuthToken;
31
31
  }
32
+ /**
33
+ * Per-request holder for the role or team the caller asked to be evaluated as, EXTRACTED by the
34
+ * transport from the `x-webiny-assume-permissions` header. This is a preview mechanism: it can
35
+ * only ever narrow what a caller may do, never widen it. AssumedPermissions reads this holder and
36
+ * substitutes the permission set, but only after confirming the caller's own permissions grant
37
+ * full access.
38
+ *
39
+ * Note: only the HTTP transports set this. S3 and background tasks have no caller to preview as.
40
+ */
41
+ export interface IAssumePermissionsTarget {
42
+ type: "role" | "team";
43
+ id: string;
44
+ }
45
+ export interface IRawAssumePermissions {
46
+ get(): IAssumePermissionsTarget | null;
47
+ set(value: IAssumePermissionsTarget | null): void;
48
+ }
49
+ export declare const RawAssumePermissions: import("@webiny/di").Abstraction<IRawAssumePermissions>;
50
+ export declare namespace RawAssumePermissions {
51
+ type Interface = IRawAssumePermissions;
52
+ type Target = IAssumePermissionsTarget;
53
+ }
32
54
  /**
33
55
  * LOAD step: authenticates the token held by RawAuthToken and sets IdentityContext. Fully
34
56
  * transport-agnostic — transports only EXTRACT the token into RawAuthToken.
@@ -1,8 +1,9 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
2
  const RawTenantId = createAbstraction("RequestContext/RawTenantId");
3
3
  const RawAuthToken = createAbstraction("RequestContext/RawAuthToken");
4
+ const RawAssumePermissions = createAbstraction("RequestContext/RawAssumePermissions");
4
5
  const RequestIdentityLoader = createAbstraction("RequestContext/RequestIdentityLoader");
5
6
  const RequestTenantLoader = createAbstraction("RequestContext/RequestTenantLoader");
6
- export { RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader };
7
+ export { RawAssumePermissions, RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader };
7
8
 
8
9
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/requestContext/abstractions.js","sources":["../../../src/features/requestContext/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Per-request holder for the raw tenant id EXTRACTED by the transport (e.g. the `x-tenant` header\n * of an API Gateway event, the bucket name of an S3 event, or `payload.tenant` of a background\n * task). The transport-specific EXTRACT step sets this; the transport-agnostic LOAD step\n * (RequestTenantLoader) reads it, resolves the Tenant, and sets TenantContext.\n */\nexport interface IRawTenantId {\n get(): string | null;\n set(id: string | null): void;\n}\n\nexport const RawTenantId = createAbstraction<IRawTenantId>(\"RequestContext/RawTenantId\");\n\nexport namespace RawTenantId {\n export type Interface = IRawTenantId;\n}\n\n/**\n * Per-request holder for the raw auth token EXTRACTED by the transport (e.g. the `Authorization`\n * bearer header or an auth cookie of an API Gateway event). Only token-based transports set this;\n * the transport-agnostic LOAD step (RequestIdentityLoader) reads it, authenticates it, and\n * sets IdentityContext. A null/absent value authenticates as anonymous.\n *\n * Note: non-token transports (S3, background tasks) never set this — S3 has no user identity, and\n * background-task identity is derived from `task.createdBy` after the task is fetched.\n */\nexport interface IRawAuthToken {\n get(): string | null;\n set(token: string | null): void;\n}\n\nexport const RawAuthToken = createAbstraction<IRawAuthToken>(\"RequestContext/RawAuthToken\");\n\nexport namespace RawAuthToken {\n export type Interface = IRawAuthToken;\n}\n\n/**\n * LOAD step: authenticates the token held by RawAuthToken and sets IdentityContext. Fully\n * transport-agnostic — transports only EXTRACT the token into RawAuthToken.\n */\nexport interface IRequestIdentityLoader {\n establish(): Promise<void>;\n}\n\nexport const RequestIdentityLoader = createAbstraction<IRequestIdentityLoader>(\n \"RequestContext/RequestIdentityLoader\"\n);\n\nexport namespace RequestIdentityLoader {\n export type Interface = IRequestIdentityLoader;\n}\n\n/**\n * LOAD step: resolves the Tenant for the id held by RawTenantId and sets TenantContext. Fully\n * transport-agnostic — transports only EXTRACT the id into RawTenantId.\n */\nexport interface IRequestTenantLoader {\n establish(): Promise<void>;\n}\n\nexport const RequestTenantLoader = createAbstraction<IRequestTenantLoader>(\n \"RequestContext/RequestTenantLoader\"\n);\n\nexport namespace RequestTenantLoader {\n export type Interface = IRequestTenantLoader;\n}\n"],"names":["RawTenantId","createAbstraction","RawAuthToken","RequestIdentityLoader","RequestTenantLoader"],"mappings":";AAaO,MAAMA,cAAcC,kBAAgC;AAoBpD,MAAMC,eAAeD,kBAAiC;AActD,MAAME,wBAAwBF,kBACjC;AAeG,MAAMG,sBAAsBH,kBAC/B"}
1
+ {"version":3,"file":"features/requestContext/abstractions.js","sources":["../../../src/features/requestContext/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Per-request holder for the raw tenant id EXTRACTED by the transport (e.g. the `x-tenant` header\n * of an API Gateway event, the bucket name of an S3 event, or `payload.tenant` of a background\n * task). The transport-specific EXTRACT step sets this; the transport-agnostic LOAD step\n * (RequestTenantLoader) reads it, resolves the Tenant, and sets TenantContext.\n */\nexport interface IRawTenantId {\n get(): string | null;\n set(id: string | null): void;\n}\n\nexport const RawTenantId = createAbstraction<IRawTenantId>(\"RequestContext/RawTenantId\");\n\nexport namespace RawTenantId {\n export type Interface = IRawTenantId;\n}\n\n/**\n * Per-request holder for the raw auth token EXTRACTED by the transport (e.g. the `Authorization`\n * bearer header or an auth cookie of an API Gateway event). Only token-based transports set this;\n * the transport-agnostic LOAD step (RequestIdentityLoader) reads it, authenticates it, and\n * sets IdentityContext. A null/absent value authenticates as anonymous.\n *\n * Note: non-token transports (S3, background tasks) never set this — S3 has no user identity, and\n * background-task identity is derived from `task.createdBy` after the task is fetched.\n */\nexport interface IRawAuthToken {\n get(): string | null;\n set(token: string | null): void;\n}\n\nexport const RawAuthToken = createAbstraction<IRawAuthToken>(\"RequestContext/RawAuthToken\");\n\nexport namespace RawAuthToken {\n export type Interface = IRawAuthToken;\n}\n\n/**\n * Per-request holder for the role or team the caller asked to be evaluated as, EXTRACTED by the\n * transport from the `x-webiny-assume-permissions` header. This is a preview mechanism: it can\n * only ever narrow what a caller may do, never widen it. AssumedPermissions reads this holder and\n * substitutes the permission set, but only after confirming the caller's own permissions grant\n * full access.\n *\n * Note: only the HTTP transports set this. S3 and background tasks have no caller to preview as.\n */\nexport interface IAssumePermissionsTarget {\n /*\n * Whose permissions to assume. A team is a set of roles, so assuming one means the union of its\n * roles' permissions. Assuming a user's permissions would be another type here, resolved to\n * that user's roles and teams the same way.\n */\n type: \"role\" | \"team\";\n id: string;\n}\n\nexport interface IRawAssumePermissions {\n get(): IAssumePermissionsTarget | null;\n set(value: IAssumePermissionsTarget | null): void;\n}\n\nexport const RawAssumePermissions = createAbstraction<IRawAssumePermissions>(\n \"RequestContext/RawAssumePermissions\"\n);\n\nexport namespace RawAssumePermissions {\n export type Interface = IRawAssumePermissions;\n export type Target = IAssumePermissionsTarget;\n}\n\n/**\n * LOAD step: authenticates the token held by RawAuthToken and sets IdentityContext. Fully\n * transport-agnostic — transports only EXTRACT the token into RawAuthToken.\n */\nexport interface IRequestIdentityLoader {\n establish(): Promise<void>;\n}\n\nexport const RequestIdentityLoader = createAbstraction<IRequestIdentityLoader>(\n \"RequestContext/RequestIdentityLoader\"\n);\n\nexport namespace RequestIdentityLoader {\n export type Interface = IRequestIdentityLoader;\n}\n\n/**\n * LOAD step: resolves the Tenant for the id held by RawTenantId and sets TenantContext. Fully\n * transport-agnostic — transports only EXTRACT the id into RawTenantId.\n */\nexport interface IRequestTenantLoader {\n establish(): Promise<void>;\n}\n\nexport const RequestTenantLoader = createAbstraction<IRequestTenantLoader>(\n \"RequestContext/RequestTenantLoader\"\n);\n\nexport namespace RequestTenantLoader {\n export type Interface = IRequestTenantLoader;\n}\n"],"names":["RawTenantId","createAbstraction","RawAuthToken","RawAssumePermissions","RequestIdentityLoader","RequestTenantLoader"],"mappings":";AAaO,MAAMA,cAAcC,kBAAgC;AAoBpD,MAAMC,eAAeD,kBAAiC;AA8BtD,MAAME,uBAAuBF,kBAChC;AAgBG,MAAMG,wBAAwBH,kBACjC;AAeG,MAAMI,sBAAsBJ,kBAC/B"}
@@ -0,0 +1,14 @@
1
+ import { RawAssumePermissions } from "./abstractions.js";
2
+ export declare const ASSUME_PERMISSIONS_HEADER = "x-webiny-assume-permissions";
3
+ type HeaderValue = string | string[] | undefined;
4
+ type Headers = Record<string, HeaderValue> | undefined;
5
+ /**
6
+ * Reads the `x-webiny-assume-permissions` header and parses it into the role or team whose
7
+ * permissions should be previewed. The value is `role:<id>` or `team:<id>`.
8
+ *
9
+ * Anything else parses to null, which leaves the caller's own permissions untouched. Lives in
10
+ * api-core rather than in a transport package so the HTTP transports cannot drift on the format or
11
+ * on header casing.
12
+ */
13
+ export declare function extractAssumePermissions(headers: Headers): RawAssumePermissions.Target | null;
14
+ export {};
@@ -0,0 +1,32 @@
1
+ const ASSUME_PERMISSIONS_HEADER = "x-webiny-assume-permissions";
2
+ function readHeader(headers, name) {
3
+ if (!headers) return null;
4
+ for (const key of Object.keys(headers)){
5
+ if (key.toLowerCase() !== name) continue;
6
+ const value = headers[key];
7
+ if (Array.isArray(value)) return value[0] ?? null;
8
+ return value ?? null;
9
+ }
10
+ return null;
11
+ }
12
+ function extractAssumePermissions(headers) {
13
+ const value = readHeader(headers, ASSUME_PERMISSIONS_HEADER);
14
+ if (!value) return null;
15
+ const separatorIndex = value.indexOf(":");
16
+ if (separatorIndex < 1) return null;
17
+ const type = value.slice(0, separatorIndex).trim();
18
+ const id = value.slice(separatorIndex + 1).trim();
19
+ if ("" === id) return null;
20
+ if ("role" === type) return {
21
+ type: "role",
22
+ id
23
+ };
24
+ if ("team" === type) return {
25
+ type: "team",
26
+ id
27
+ };
28
+ return null;
29
+ }
30
+ export { ASSUME_PERMISSIONS_HEADER, extractAssumePermissions };
31
+
32
+ //# sourceMappingURL=extractAssumePermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/extractAssumePermissions.js","sources":["../../../src/features/requestContext/extractAssumePermissions.ts"],"sourcesContent":["import { RawAssumePermissions } from \"./abstractions.js\";\n\nexport const ASSUME_PERMISSIONS_HEADER = \"x-webiny-assume-permissions\";\n\ntype HeaderValue = string | string[] | undefined;\ntype Headers = Record<string, HeaderValue> | undefined;\n\nfunction readHeader(headers: Headers, name: string): string | null {\n if (!headers) {\n return null;\n }\n\n /*\n * Header names are case-insensitive, and the casing that reaches us depends on the transport\n * and on the client, so match on the lowercased key rather than guessing a spelling. Node's\n * IncomingMessage also hands back an array when a header repeats.\n */\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() !== name) {\n continue;\n }\n\n const value = headers[key];\n if (Array.isArray(value)) {\n return value[0] ?? null;\n }\n\n return value ?? null;\n }\n\n return null;\n}\n\n/**\n * Reads the `x-webiny-assume-permissions` header and parses it into the role or team whose\n * permissions should be previewed. The value is `role:<id>` or `team:<id>`.\n *\n * Anything else parses to null, which leaves the caller's own permissions untouched. Lives in\n * api-core rather than in a transport package so the HTTP transports cannot drift on the format or\n * on header casing.\n */\nexport function extractAssumePermissions(headers: Headers): RawAssumePermissions.Target | null {\n const value = readHeader(headers, ASSUME_PERMISSIONS_HEADER);\n if (!value) {\n return null;\n }\n\n const separatorIndex = value.indexOf(\":\");\n if (separatorIndex < 1) {\n return null;\n }\n\n const type = value.slice(0, separatorIndex).trim();\n const id = value.slice(separatorIndex + 1).trim();\n\n if (id === \"\") {\n return null;\n }\n\n if (type === \"role\") {\n return { type: \"role\", id };\n }\n\n if (type === \"team\") {\n return { type: \"team\", id };\n }\n\n return null;\n}\n"],"names":["ASSUME_PERMISSIONS_HEADER","readHeader","headers","name","key","Object","value","Array","extractAssumePermissions","separatorIndex","type","id"],"mappings":"AAEO,MAAMA,4BAA4B;AAKzC,SAASC,WAAWC,OAAgB,EAAEC,IAAY;IAC9C,IAAI,CAACD,SACD,OAAO;IAQX,KAAK,MAAME,OAAOC,OAAO,IAAI,CAACH,SAAU;QACpC,IAAIE,IAAI,WAAW,OAAOD,MACtB;QAGJ,MAAMG,QAAQJ,OAAO,CAACE,IAAI;QAC1B,IAAIG,MAAM,OAAO,CAACD,QACd,OAAOA,KAAK,CAAC,EAAE,IAAI;QAGvB,OAAOA,SAAS;IACpB;IAEA,OAAO;AACX;AAUO,SAASE,yBAAyBN,OAAgB;IACrD,MAAMI,QAAQL,WAAWC,SAASF;IAClC,IAAI,CAACM,OACD,OAAO;IAGX,MAAMG,iBAAiBH,MAAM,OAAO,CAAC;IACrC,IAAIG,iBAAiB,GACjB,OAAO;IAGX,MAAMC,OAAOJ,MAAM,KAAK,CAAC,GAAGG,gBAAgB,IAAI;IAChD,MAAME,KAAKL,MAAM,KAAK,CAACG,iBAAiB,GAAG,IAAI;IAE/C,IAAIE,AAAO,OAAPA,IACA,OAAO;IAGX,IAAID,AAAS,WAATA,MACA,OAAO;QAAE,MAAM;QAAQC;IAAG;IAG9B,IAAID,AAAS,WAATA,MACA,OAAO;QAAE,MAAM;QAAQC;IAAG;IAG9B,OAAO;AACX"}
@@ -1,7 +1,8 @@
1
1
  import type { Container } from "@webiny/di";
2
2
  /**
3
3
  * Registers the request-context pieces:
4
- * - RawTenantId / RawAuthToken: per-request holders that the transport's EXTRACT step writes to.
4
+ * - RawTenantId / RawAuthToken / RawAssumePermissions: per-request holders that the transport's
5
+ * EXTRACT step writes to.
5
6
  * - RequestIdentityLoader / RequestTenantLoader: transport-agnostic LOAD steps that read
6
7
  * the holders and set IdentityContext / TenantContext.
7
8
  */
@@ -1,6 +1,7 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { RawTenantId } from "./RawTenantId.js";
3
3
  import { RawAuthToken } from "./RawAuthToken.js";
4
+ import { RawAssumePermissions } from "./RawAssumePermissions.js";
4
5
  import { RequestIdentityLoader } from "./RequestIdentityLoader.js";
5
6
  import { RequestTenantLoader } from "./RequestTenantLoader.js";
6
7
  const RequestContextFeature = createFeature({
@@ -8,6 +9,7 @@ const RequestContextFeature = createFeature({
8
9
  register (container) {
9
10
  container.register(RawTenantId).inSingletonScope();
10
11
  container.register(RawAuthToken).inSingletonScope();
12
+ container.register(RawAssumePermissions).inSingletonScope();
11
13
  container.register(RequestIdentityLoader);
12
14
  container.register(RequestTenantLoader);
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features/requestContext/feature.js","sources":["../../../src/features/requestContext/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport { RawTenantId } from \"./RawTenantId.js\";\nimport { RawAuthToken } from \"./RawAuthToken.js\";\nimport { RequestIdentityLoader } from \"./RequestIdentityLoader.js\";\nimport { RequestTenantLoader } from \"./RequestTenantLoader.js\";\n\n/**\n * Registers the request-context pieces:\n * - RawTenantId / RawAuthToken: per-request holders that the transport's EXTRACT step writes to.\n * - RequestIdentityLoader / RequestTenantLoader: transport-agnostic LOAD steps that read\n * the holders and set IdentityContext / TenantContext.\n */\nexport const RequestContextFeature = createFeature({\n name: \"RequestContext\",\n register(container: Container) {\n // Singleton so the value the transport's EXTRACT step sets is the same instance the LOAD\n // establisher reads. Registered per request (RequestContextFeature runs per-request), so it's\n // singleton *within the request container* — a fresh holder per request.\n container.register(RawTenantId).inSingletonScope();\n container.register(RawAuthToken).inSingletonScope();\n container.register(RequestIdentityLoader);\n container.register(RequestTenantLoader);\n }\n});\n"],"names":["RequestContextFeature","createFeature","container","RawTenantId","RawAuthToken","RequestIdentityLoader","RequestTenantLoader"],"mappings":";;;;;AAaO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAoB;QAIzBA,UAAU,QAAQ,CAACC,aAAa,gBAAgB;QAChDD,UAAU,QAAQ,CAACE,cAAc,gBAAgB;QACjDF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
1
+ {"version":3,"file":"features/requestContext/feature.js","sources":["../../../src/features/requestContext/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport { RawTenantId } from \"./RawTenantId.js\";\nimport { RawAuthToken } from \"./RawAuthToken.js\";\nimport { RawAssumePermissions } from \"./RawAssumePermissions.js\";\nimport { RequestIdentityLoader } from \"./RequestIdentityLoader.js\";\nimport { RequestTenantLoader } from \"./RequestTenantLoader.js\";\n\n/**\n * Registers the request-context pieces:\n * - RawTenantId / RawAuthToken / RawAssumePermissions: per-request holders that the transport's\n * EXTRACT step writes to.\n * - RequestIdentityLoader / RequestTenantLoader: transport-agnostic LOAD steps that read\n * the holders and set IdentityContext / TenantContext.\n */\nexport const RequestContextFeature = createFeature({\n name: \"RequestContext\",\n register(container: Container) {\n // Singleton so the value the transport's EXTRACT step sets is the same instance the LOAD\n // establisher reads. Registered per request (RequestContextFeature runs per-request), so it's\n // singleton *within the request container* — a fresh holder per request.\n container.register(RawTenantId).inSingletonScope();\n container.register(RawAuthToken).inSingletonScope();\n container.register(RawAssumePermissions).inSingletonScope();\n container.register(RequestIdentityLoader);\n container.register(RequestTenantLoader);\n }\n});\n"],"names":["RequestContextFeature","createFeature","container","RawTenantId","RawAuthToken","RawAssumePermissions","RequestIdentityLoader","RequestTenantLoader"],"mappings":";;;;;;AAeO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAoB;QAIzBA,UAAU,QAAQ,CAACC,aAAa,gBAAgB;QAChDD,UAAU,QAAQ,CAACE,cAAc,gBAAgB;QACjDF,UAAU,QAAQ,CAACG,sBAAsB,gBAAgB;QACzDH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
@@ -1,2 +1,4 @@
1
- export { RawTenantId, RawAuthToken, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
1
+ export { RawTenantId, RawAuthToken, RawAssumePermissions, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
2
2
  export { RequestContextFeature } from "./feature.js";
3
+ export { ASSUME_PERMISSIONS_HEADER } from "./extractAssumePermissions.js";
4
+ export { extractAssumePermissions } from "./extractAssumePermissions.js";
@@ -1,2 +1,3 @@
1
- export { RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
1
+ export { RawAssumePermissions, RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
2
2
  export { RequestContextFeature } from "./feature.js";
3
+ export { ASSUME_PERMISSIONS_HEADER, extractAssumePermissions } from "./extractAssumePermissions.js";
@@ -0,0 +1,23 @@
1
+ import type { Container } from "@webiny/di";
2
+ export interface IRequestStorage {
3
+ /**
4
+ * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request
5
+ * container. Runs before any domain feature registers, so the features find it there.
6
+ */
7
+ register(container: Container): void | Promise<void>;
8
+ }
9
+ /**
10
+ * The storage a request runs on. A storage registers one implementation per part that owns
11
+ * per-request storage in the root container, once per process; every request container then gets
12
+ * those storages registered first, before the domain features (`registerApiRequestStack`). Several
13
+ * implementations can be registered: each part (the SQL storage, the standalone server's login)
14
+ * brings its own.
15
+ *
16
+ * The root keeps only what outlives a request (the connection, its settings), so a request's
17
+ * storages always come from its own container. A storage that registers its storages in the root
18
+ * instead (the DynamoDB variants) registers none of these.
19
+ */
20
+ export declare const RequestStorage: import("@webiny/di").Abstraction<IRequestStorage>;
21
+ export declare namespace RequestStorage {
22
+ type Interface = IRequestStorage;
23
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const RequestStorage = createAbstraction("Core/RequestStorage");
3
+ export { RequestStorage };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestStorage/abstractions.js","sources":["../../../src/features/requestStorage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\n\nexport interface IRequestStorage {\n /**\n * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request\n * container. Runs before any domain feature registers, so the features find it there.\n */\n register(container: Container): void | Promise<void>;\n}\n\n/**\n * The storage a request runs on. A storage registers one implementation per part that owns\n * per-request storage in the root container, once per process; every request container then gets\n * those storages registered first, before the domain features (`registerApiRequestStack`). Several\n * implementations can be registered: each part (the SQL storage, the standalone server's login)\n * brings its own.\n *\n * The root keeps only what outlives a request (the connection, its settings), so a request's\n * storages always come from its own container. A storage that registers its storages in the root\n * instead (the DynamoDB variants) registers none of these.\n */\nexport const RequestStorage = createAbstraction<IRequestStorage>(\"Core/RequestStorage\");\n\nexport namespace RequestStorage {\n export type Interface = IRequestStorage;\n}\n"],"names":["RequestStorage","createAbstraction"],"mappings":";AAsBO,MAAMA,iBAAiBC,kBAAmC"}
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -1,3 +1,4 @@
1
+ import { HandlerExecution } from "@webiny/event-handler-core";
1
2
  import { IdentityContext as Abstraction } from "./abstractions.js";
2
3
  import { Identity } from "./Identity.js";
3
4
  import { AuthorizationContext } from "../authorization/AuthorizationContext/index.js";
@@ -6,12 +7,15 @@ import { FeatureFlags } from "../../featureFlags/abstractions.js";
6
7
  declare class IdentityContextImpl implements Abstraction.Interface {
7
8
  private authorizationContext;
8
9
  private featureFlags;
10
+ private handlerExecution;
9
11
  private identity;
10
- constructor(authorizationContext: AuthorizationContext.Interface, featureFlags: FeatureFlags.Interface);
12
+ private readonly overrides;
13
+ constructor(authorizationContext: AuthorizationContext.Interface, featureFlags: FeatureFlags.Interface, handlerExecution: HandlerExecution.Interface | undefined);
11
14
  getIdentity(): Identity;
12
15
  setIdentity(identity: Identity | undefined): void;
13
- withIdentity<T>(identity: Identity | undefined, cb: () => Promise<T>): Promise<T>;
16
+ withIdentity<T>(identity: Identity, cb: () => Promise<T>): Promise<T>;
14
17
  withoutAuthorization<T>(cb: () => Promise<T>): Promise<T>;
18
+ withAuthorization<T>(cb: () => Promise<T>): Promise<T>;
15
19
  isAuthorizationEnabled(): boolean;
16
20
  getPermission<TPermission extends SecurityPermission = SecurityPermission>(name: string): Promise<TPermission | null>;
17
21
  getPermissions<TPermission extends SecurityPermission = SecurityPermission>(name: string): Promise<TPermission[]>;