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

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 (341) hide show
  1. package/ApiCoreFeature.d.ts +2 -2
  2. package/ApiCoreFeature.js +29 -5
  3. package/ApiCoreFeature.js.map +1 -1
  4. package/exports/api/security/api-key.d.ts +1 -0
  5. package/exports/api/security/api-key.js +1 -0
  6. package/exports/api.d.ts +3 -1
  7. package/exports/api.js +2 -1
  8. package/features/ai/Ai.d.ts +3 -3
  9. package/features/ai/Ai.js +60 -23
  10. package/features/ai/Ai.js.map +1 -1
  11. package/features/ai/AnthropicSdkFactory.js +12 -0
  12. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  13. package/features/ai/OpenAiSdkFactory.js +16 -0
  14. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  15. package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
  16. package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
  17. package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
  18. package/features/ai/TextExtractor/abstractions.d.ts +12 -0
  19. package/features/ai/TextExtractor/abstractions.js +5 -0
  20. package/features/ai/TextExtractor/abstractions.js.map +1 -0
  21. package/features/ai/TextExtractor/index.d.ts +3 -0
  22. package/features/ai/TextExtractor/index.js +2 -0
  23. package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
  24. package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
  25. package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
  26. package/features/ai/abstractions.d.ts +18 -7
  27. package/features/ai/abstractions.js +1 -2
  28. package/features/ai/abstractions.js.map +1 -1
  29. package/features/ai/events.d.ts +59 -0
  30. package/features/ai/events.js +41 -0
  31. package/features/ai/events.js.map +1 -0
  32. package/features/ai/feature.js +6 -2
  33. package/features/ai/feature.js.map +1 -1
  34. package/features/ai/index.d.ts +8 -2
  35. package/features/ai/index.js +4 -1
  36. package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
  37. package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
  38. package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
  39. package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
  40. package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
  41. package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
  42. package/features/ai/toolPipeline/abstractions.d.ts +23 -0
  43. package/features/ai/toolPipeline/abstractions.js +7 -0
  44. package/features/ai/toolPipeline/abstractions.js.map +1 -0
  45. package/features/ai/toolPipeline/index.d.ts +2 -0
  46. package/features/ai/toolPipeline/index.js +1 -0
  47. package/features/dateFormatter/DefaultDateFormatter.d.ts +15 -0
  48. package/features/dateFormatter/DefaultDateFormatter.js +20 -0
  49. package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
  50. package/features/dateFormatter/abstractions.d.ts +13 -0
  51. package/features/dateFormatter/abstractions.js +5 -0
  52. package/features/dateFormatter/abstractions.js.map +1 -0
  53. package/features/dateFormatter/feature.d.ts +4 -0
  54. package/features/dateFormatter/feature.js +11 -0
  55. package/features/dateFormatter/feature.js.map +1 -0
  56. package/features/dateFormatter/index.d.ts +3 -0
  57. package/features/dateFormatter/index.js +2 -0
  58. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
  59. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +49 -0
  60. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
  61. package/features/hashing/ScryptHasher.d.ts +11 -0
  62. package/features/hashing/ScryptHasher.js +74 -0
  63. package/features/hashing/ScryptHasher.js.map +1 -0
  64. package/features/hashing/abstractions.d.ts +18 -0
  65. package/features/hashing/abstractions.js +5 -0
  66. package/features/hashing/abstractions.js.map +1 -0
  67. package/features/hashing/feature.d.ts +4 -0
  68. package/features/hashing/feature.js +11 -0
  69. package/features/hashing/feature.js.map +1 -0
  70. package/features/hashing/index.d.ts +2 -0
  71. package/features/hashing/index.js +1 -0
  72. package/features/requestContext/RawAuthToken.d.ts +14 -0
  73. package/features/requestContext/RawAuthToken.js +19 -0
  74. package/features/requestContext/RawAuthToken.js.map +1 -0
  75. package/features/requestContext/RawTenantId.d.ts +14 -0
  76. package/features/requestContext/RawTenantId.js +19 -0
  77. package/features/requestContext/RawTenantId.js.map +1 -0
  78. package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
  79. package/features/requestContext/RequestIdentityLoader.js +26 -0
  80. package/features/requestContext/RequestIdentityLoader.js.map +1 -0
  81. package/features/requestContext/RequestTenantLoader.d.ts +18 -0
  82. package/features/requestContext/RequestTenantLoader.js +52 -0
  83. package/features/requestContext/RequestTenantLoader.js.map +1 -0
  84. package/features/requestContext/abstractions.d.ts +53 -0
  85. package/features/requestContext/abstractions.js +8 -0
  86. package/features/requestContext/abstractions.js.map +1 -0
  87. package/features/requestContext/feature.d.ts +11 -0
  88. package/features/requestContext/feature.js +17 -0
  89. package/features/requestContext/feature.js.map +1 -0
  90. package/features/requestContext/index.d.ts +2 -0
  91. package/features/requestContext/index.js +2 -0
  92. package/features/security/IdentityContext/IdentityContext.d.ts +3 -3
  93. package/features/security/IdentityContext/IdentityContext.js +6 -6
  94. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  95. package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
  96. package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
  97. package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
  98. package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
  99. package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
  100. package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
  101. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
  102. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  103. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
  104. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
  105. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
  106. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
  107. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
  108. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  109. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
  110. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
  111. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
  112. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  113. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
  114. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  115. package/features/security/apiKeys/feature.js +11 -2
  116. package/features/security/apiKeys/feature.js.map +1 -1
  117. package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
  118. package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
  119. package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
  120. package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
  121. package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
  122. package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
  123. package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
  124. package/features/security/apiKeys/shared/generateToken.js.map +1 -1
  125. package/features/security/apiKeys/shared/schemas.d.ts +2 -2
  126. package/features/security/apiKeys/shared/schemas.js +2 -2
  127. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  128. package/features/security/apiKeys/shared/types.d.ts +1 -1
  129. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +4 -4
  130. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
  131. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
  132. package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
  133. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  134. package/features/security/roles/CreateRole/schema.d.ts +1 -1
  135. package/features/security/roles/CreateRole/schema.js +1 -1
  136. package/features/security/roles/CreateRole/schema.js.map +1 -1
  137. package/features/security/roles/Installer/RolesInstaller.js +0 -1
  138. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  139. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
  140. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  141. package/features/security/roles/UpdateRole/schema.d.ts +1 -1
  142. package/features/security/roles/UpdateRole/schema.js +1 -1
  143. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  144. package/features/security/shared/description.d.ts +4 -0
  145. package/features/security/shared/description.js +7 -0
  146. package/features/security/shared/description.js.map +1 -0
  147. package/features/security/shared/index.d.ts +1 -0
  148. package/features/security/shared/index.js +1 -0
  149. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +3 -1
  150. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
  151. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  152. package/features/security/teams/CreateTeam/schema.d.ts +1 -1
  153. package/features/security/teams/CreateTeam/schema.js +1 -1
  154. package/features/security/teams/CreateTeam/schema.js.map +1 -1
  155. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
  156. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
  157. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  158. package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
  159. package/features/security/teams/UpdateTeam/schema.js +1 -1
  160. package/features/security/teams/UpdateTeam/schema.js.map +1 -1
  161. package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
  162. package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
  163. package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
  164. package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
  165. package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
  166. package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
  167. package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
  168. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
  169. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
  170. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
  171. package/features/serviceDiscovery/index.d.ts +3 -0
  172. package/features/serviceDiscovery/index.js +1 -0
  173. package/features/slugify/DefaultSlugify.d.ts +8 -0
  174. package/features/slugify/DefaultSlugify.js +20 -0
  175. package/features/slugify/DefaultSlugify.js.map +1 -0
  176. package/features/slugify/abstractions.d.ts +12 -0
  177. package/features/slugify/abstractions.js +5 -0
  178. package/features/slugify/abstractions.js.map +1 -0
  179. package/features/slugify/feature.d.ts +4 -0
  180. package/features/slugify/feature.js +11 -0
  181. package/features/slugify/feature.js.map +1 -0
  182. package/features/slugify/index.d.ts +3 -0
  183. package/features/slugify/index.js +2 -0
  184. package/features/storageOperations/abstractions.d.ts +21 -0
  185. package/features/storageOperations/abstractions.js +10 -0
  186. package/features/storageOperations/abstractions.js.map +1 -0
  187. package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
  188. package/features/stringFormatter/DefaultStringFormatter.js +19 -0
  189. package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
  190. package/features/stringFormatter/abstractions.d.ts +11 -0
  191. package/features/stringFormatter/abstractions.js +5 -0
  192. package/features/stringFormatter/abstractions.js.map +1 -0
  193. package/features/stringFormatter/feature.d.ts +4 -0
  194. package/features/stringFormatter/feature.js +13 -0
  195. package/features/stringFormatter/feature.js.map +1 -0
  196. package/features/stringFormatter/index.d.ts +3 -0
  197. package/features/stringFormatter/index.js +2 -0
  198. package/features/task/TaskDefinition/abstractions.d.ts +76 -4
  199. package/features/task/TaskDefinition/abstractions.js +2 -1
  200. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  201. package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
  202. package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
  203. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
  204. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
  205. package/features/wcp/WcpContext/WcpContext.d.ts +10 -5
  206. package/features/wcp/WcpContext/WcpContext.js +23 -2
  207. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  208. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +25 -7
  209. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +57 -25
  210. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  211. package/features/wcp/WcpContext/feature.d.ts +1 -2
  212. package/features/wcp/WcpContext/feature.js +2 -2
  213. package/features/wcp/WcpContext/feature.js.map +1 -1
  214. package/features/wcp/WcpContext/index.d.ts +0 -1
  215. package/features/wcp/WcpContext/types.d.ts +0 -4
  216. package/features/wcp/WcpFeature.d.ts +1 -1
  217. package/features/wcp/WcpFeature.js +7 -2
  218. package/features/wcp/WcpFeature.js.map +1 -1
  219. package/features/wcp/WcpLicenseLoader.d.ts +25 -0
  220. package/features/wcp/WcpLicenseLoader.js +58 -0
  221. package/features/wcp/WcpLicenseLoader.js.map +1 -0
  222. package/features/wcp/WcpLicenseProvider.d.ts +21 -0
  223. package/features/wcp/WcpLicenseProvider.js +14 -0
  224. package/features/wcp/WcpLicenseProvider.js.map +1 -0
  225. package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
  226. package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
  227. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
  228. package/graphql/ApiCoreSchemaFactory.d.ts +15 -0
  229. package/graphql/ApiCoreSchemaFactory.js +52 -0
  230. package/graphql/ApiCoreSchemaFactory.js.map +1 -0
  231. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +9 -0
  232. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +49 -0
  233. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
  234. package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
  235. package/graphql/security/NotAuthorizedResponse.js +1 -1
  236. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  237. package/graphql/security/SecuritySchemaFactory.d.ts +14 -0
  238. package/graphql/security/SecuritySchemaFactory.js +23 -0
  239. package/graphql/security/SecuritySchemaFactory.js.map +1 -0
  240. package/graphql/security/addApiKeySchema.d.ts +2 -0
  241. package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
  242. package/graphql/security/addApiKeySchema.js.map +1 -0
  243. package/graphql/security/addIdentitySchema.d.ts +2 -0
  244. package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
  245. package/graphql/security/addIdentitySchema.js.map +1 -0
  246. package/graphql/security/addRoleSchema.d.ts +2 -0
  247. package/graphql/security/addRoleSchema.js +137 -0
  248. package/graphql/security/addRoleSchema.js.map +1 -0
  249. package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
  250. package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
  251. package/graphql/security/addSecurityBaseSchema.js.map +1 -0
  252. package/graphql/security/addTeamSchema.d.ts +2 -0
  253. package/graphql/security/addTeamSchema.js +157 -0
  254. package/graphql/security/addTeamSchema.js.map +1 -0
  255. package/graphql/system/SystemSchemaFactory.d.ts +9 -0
  256. package/graphql/system/SystemSchemaFactory.js +66 -0
  257. package/graphql/system/SystemSchemaFactory.js.map +1 -0
  258. package/graphql/users/UsersSchemaFactory.d.ts +9 -0
  259. package/graphql/users/UsersSchemaFactory.js +191 -0
  260. package/graphql/users/UsersSchemaFactory.js.map +1 -0
  261. package/graphql/wcp/WcpSchemaFactory.d.ts +9 -0
  262. package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +28 -18
  263. package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
  264. package/index.d.ts +3 -1
  265. package/index.js +3 -1
  266. package/package.json +21 -24
  267. package/testing/environment.d.ts +14 -0
  268. package/testing/environment.js +18 -0
  269. package/testing/environment.js.map +1 -0
  270. package/types/core.d.ts +17 -5
  271. package/types/security.d.ts +1 -7
  272. package/types/tenancy.d.ts +0 -17
  273. package/types/users.d.ts +0 -13
  274. package/createApiCore.d.ts +0 -7
  275. package/createApiCore.js +0 -22
  276. package/createApiCore.js.map +0 -1
  277. package/features/ai/AiModelRegistry.d.ts +0 -12
  278. package/features/ai/AiModelRegistry.js +0 -28
  279. package/features/ai/AiModelRegistry.js.map +0 -1
  280. package/graphql/security/apiKey.gql.d.ts +0 -4
  281. package/graphql/security/apiKey.gql.js.map +0 -1
  282. package/graphql/security/base.gql.d.ts +0 -4
  283. package/graphql/security/base.gql.js.map +0 -1
  284. package/graphql/security/identity.gql.d.ts +0 -4
  285. package/graphql/security/identity.gql.js.map +0 -1
  286. package/graphql/security/index.d.ts +0 -1
  287. package/graphql/security/index.js +0 -15
  288. package/graphql/security/index.js.map +0 -1
  289. package/graphql/security/role.gql.d.ts +0 -4
  290. package/graphql/security/role.gql.js +0 -106
  291. package/graphql/security/role.gql.js.map +0 -1
  292. package/graphql/security/team.gql.d.ts +0 -4
  293. package/graphql/security/team.gql.js +0 -119
  294. package/graphql/security/team.gql.js.map +0 -1
  295. package/graphql/system/createSystemGraphQL.d.ts +0 -2
  296. package/graphql/system/createSystemGraphQL.js +0 -54
  297. package/graphql/system/createSystemGraphQL.js.map +0 -1
  298. package/graphql/users/user.gql.d.ts +0 -3
  299. package/graphql/users/user.gql.js +0 -167
  300. package/graphql/users/user.gql.js.map +0 -1
  301. package/graphql/wcp/graphql.d.ts +0 -2
  302. package/graphql/wcp/graphql.js.map +0 -1
  303. package/legacy/security/LegacyContext.d.ts +0 -36
  304. package/legacy/security/LegacyContext.js +0 -152
  305. package/legacy/security/LegacyContext.js.map +0 -1
  306. package/legacy/security/createSecurityContext.d.ts +0 -3
  307. package/legacy/security/createSecurityContext.js +0 -10
  308. package/legacy/security/createSecurityContext.js.map +0 -1
  309. package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
  310. package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
  311. package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
  312. package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
  313. package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
  314. package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
  315. package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
  316. package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
  317. package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
  318. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
  319. package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
  320. package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
  321. package/legacy/security/plugins/secureHeaders.d.ts +0 -1
  322. package/legacy/security/plugins/secureHeaders.js +0 -30
  323. package/legacy/security/plugins/secureHeaders.js.map +0 -1
  324. package/legacy/tenancy/LegacyContext.d.ts +0 -15
  325. package/legacy/tenancy/LegacyContext.js +0 -57
  326. package/legacy/tenancy/LegacyContext.js.map +0 -1
  327. package/legacy/tenancy/createTenancyContext.d.ts +0 -3
  328. package/legacy/tenancy/createTenancyContext.js +0 -31
  329. package/legacy/tenancy/createTenancyContext.js.map +0 -1
  330. package/legacy/users/LegacyContext.d.ts +0 -13
  331. package/legacy/users/LegacyContext.js +0 -55
  332. package/legacy/users/LegacyContext.js.map +0 -1
  333. package/legacy/users/createAdminUsersContext.d.ts +0 -3
  334. package/legacy/users/createAdminUsersContext.js +0 -12
  335. package/legacy/users/createAdminUsersContext.js.map +0 -1
  336. package/legacy/wcp/LegacyWcpContext.d.ts +0 -33
  337. package/legacy/wcp/LegacyWcpContext.js +0 -84
  338. package/legacy/wcp/LegacyWcpContext.js.map +0 -1
  339. package/legacy/wcp/context.d.ts +0 -5
  340. package/legacy/wcp/context.js +0 -46
  341. package/legacy/wcp/context.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/abstractions.js","sources":["../../../src/features/dateFormatter/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport type FormattableDate = Date | string | number;\n\nexport interface IDateFormatter {\n /**\n * Formats an absolute date/time as a string using Webiny's default format. Change the format\n * everywhere at once by decorating this abstraction.\n */\n format(date: FormattableDate): string;\n}\n\nexport const DateFormatter = createAbstraction<IDateFormatter>(\"DateFormatter\");\n\nexport namespace DateFormatter {\n export type Interface = IDateFormatter;\n export type Value = FormattableDate;\n}\n"],"names":["DateFormatter","createAbstraction"],"mappings":";AAYO,MAAMA,gBAAgBC,kBAAkC"}
@@ -0,0 +1,4 @@
1
+ export declare const DateFormatterFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { DefaultDateFormatter } from "./DefaultDateFormatter.js";
3
+ const DateFormatterFeature = createFeature({
4
+ name: "DateFormatterFeature",
5
+ register (container) {
6
+ container.register(DefaultDateFormatter);
7
+ }
8
+ });
9
+ export { DateFormatterFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/feature.js","sources":["../../../src/features/dateFormatter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DefaultDateFormatter } from \"./DefaultDateFormatter.js\";\n\nexport const DateFormatterFeature = createFeature({\n name: \"DateFormatterFeature\",\n register(container) {\n container.register(DefaultDateFormatter);\n }\n});\n"],"names":["DateFormatterFeature","createFeature","container","DefaultDateFormatter"],"mappings":";;AAGO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,3 @@
1
+ export { DateFormatter } from "./abstractions.js";
2
+ export type { IDateFormatter, FormattableDate } from "./abstractions.js";
3
+ export { DateFormatterFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { DateFormatter } from "./abstractions.js";
2
+ export { DateFormatterFeature } from "./feature.js";
@@ -0,0 +1,13 @@
1
+ import { FeatureFlags } from "../abstractions.js";
2
+ import { FeatureFlags as FeatureFlagsClass } from "@webiny/feature-flags";
3
+ import { WcpLicenseProvider } from "../../../features/wcp/WcpLicenseProvider.js";
4
+ declare class FeatureFlagsWithLicenseDecoratorImpl implements FeatureFlags.Interface {
5
+ private licenseProvider;
6
+ private decoratee;
7
+ constructor(licenseProvider: WcpLicenseProvider.Interface, decoratee: FeatureFlags.Interface);
8
+ get(): FeatureFlagsClass;
9
+ }
10
+ export declare const FeatureFlagsWithLicenseDecorator: typeof FeatureFlagsWithLicenseDecoratorImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IFeatureFlagsAbstraction>;
12
+ };
13
+ export {};
@@ -0,0 +1,49 @@
1
+ import { FeatureFlags } from "../abstractions.js";
2
+ import { FeatureFlags as feature_flags_FeatureFlags } from "@webiny/feature-flags";
3
+ import { WcpLicenseProvider } from "../../wcp/WcpLicenseProvider.js";
4
+ const LICENSE_CHECKS = {
5
+ multiTenancy: (l)=>l.canUseFeature("multiTenancy"),
6
+ advancedPublishingWorkflow: (l)=>l.canUseWorkflows(),
7
+ advancedAccessControlLayer: (l)=>l.canUseAacl(),
8
+ "advancedAccessControlLayer.teams": (l)=>l.canUseTeams(),
9
+ "advancedAccessControlLayer.privateFiles": (l)=>l.canUsePrivateFiles(),
10
+ "advancedAccessControlLayer.folderLevelPermissions": (l)=>l.canUseFolderLevelPermissions(),
11
+ "advancedAccessControlLayer.hcmsFieldPermissions": (l)=>l.canUseHcmsFieldPermissions(),
12
+ auditLogs: (l)=>l.canUseAuditLogs(),
13
+ recordLocking: (l)=>l.canUseRecordLocking(),
14
+ "fileManager.threatDetection": (l)=>l.canUseFileManagerThreatDetection(),
15
+ "aiPowerups.fileManager.imageEnrichment": (l)=>l.canUseAiImageEnrichment(),
16
+ abTesting: (l)=>l.canUseAbTesting()
17
+ };
18
+ class LicenseDecoratedFeatureFlags extends feature_flags_FeatureFlags {
19
+ constructor(base, license){
20
+ super(base.toDto()), this.base = base, this.license = license;
21
+ }
22
+ isEnabled(name) {
23
+ const check = LICENSE_CHECKS[name];
24
+ if (check) {
25
+ if (!check(this.license)) return false;
26
+ return !this.base.isExplicitlyDisabled(name);
27
+ }
28
+ return this.base.isEnabled(name);
29
+ }
30
+ }
31
+ class FeatureFlagsWithLicenseDecoratorImpl {
32
+ constructor(licenseProvider, decoratee){
33
+ this.licenseProvider = licenseProvider;
34
+ this.decoratee = decoratee;
35
+ }
36
+ get() {
37
+ const base = this.decoratee.get();
38
+ return new LicenseDecoratedFeatureFlags(base, this.licenseProvider.get());
39
+ }
40
+ }
41
+ const FeatureFlagsWithLicenseDecorator = FeatureFlags.createDecorator({
42
+ decorator: FeatureFlagsWithLicenseDecoratorImpl,
43
+ dependencies: [
44
+ WcpLicenseProvider
45
+ ]
46
+ });
47
+ export { FeatureFlagsWithLicenseDecorator };
48
+
49
+ //# sourceMappingURL=FeatureFlagsWithLicenseDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js","sources":["../../../../src/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.ts"],"sourcesContent":["import { FeatureFlags } from \"../abstractions.js\";\nimport { FeatureFlags as FeatureFlagsClass } from \"@webiny/feature-flags\";\nimport type { FeatureFlagName } from \"@webiny/feature-flags\";\nimport type { ILicense } from \"@webiny/wcp/types.js\";\nimport { WcpLicenseProvider } from \"~/features/wcp/WcpLicenseProvider.js\";\n\n/*\n * Feature flag resolution (license decorator).\n *\n * Two kinds of flag, and only one of them is Webiny's to sell:\n *\n * LICENSE-GOVERNED (listed in LICENSE_CHECKS) — the license is the authority:\n * 1. No license, or license blocks the flag → false, config ignored\n * 2. License allows + config unset → true (the license grants it)\n * 3. License allows + config=false → false (config may disable, never re-enable)\n *\n * EVERYTHING ELSE — the project's own flags. The config decides, and nothing is assumed:\n * 4. config=true → true\n * 5. config=false or unset → false\n *\n * There is deliberately no third kind. A set of flags used to be enabled by default here, which was\n * a workaround for capabilities the license could not express: rather than gate them properly they\n * were left on for anyone holding any license at all. It also meant EVERY unrecognised name resolved\n * to true, so an undeclared flag and a typo both read as enabled. A feature that should be sold\n * belongs in LICENSE_CHECKS and on the license; anything else is the project's own to switch on.\n */\n\nconst LICENSE_CHECKS: Record<string, (license: ILicense) => boolean> = {\n multiTenancy: l => l.canUseFeature(\"multiTenancy\"),\n advancedPublishingWorkflow: l => l.canUseWorkflows(),\n advancedAccessControlLayer: l => l.canUseAacl(),\n \"advancedAccessControlLayer.teams\": l => l.canUseTeams(),\n \"advancedAccessControlLayer.privateFiles\": l => l.canUsePrivateFiles(),\n \"advancedAccessControlLayer.folderLevelPermissions\": l => l.canUseFolderLevelPermissions(),\n \"advancedAccessControlLayer.hcmsFieldPermissions\": l => l.canUseHcmsFieldPermissions(),\n auditLogs: l => l.canUseAuditLogs(),\n recordLocking: l => l.canUseRecordLocking(),\n \"fileManager.threatDetection\": l => l.canUseFileManagerThreatDetection(),\n \"aiPowerups.fileManager.imageEnrichment\": l => l.canUseAiImageEnrichment(),\n abTesting: l => l.canUseAbTesting()\n};\n\nclass LicenseDecoratedFeatureFlags extends FeatureFlagsClass {\n constructor(\n private base: FeatureFlagsClass,\n private license: ILicense\n ) {\n super(base.toDto());\n }\n\n override isEnabled(name: FeatureFlagName): boolean {\n const check = LICENSE_CHECKS[name];\n if (check) {\n if (!check(this.license)) {\n return false;\n }\n // License allows — config can only disable, not re-enable blocked features.\n return !this.base.isExplicitlyDisabled(name);\n }\n /*\n * Everything else is the project's own, and the config is the only thing that decides. No\n * default: `isEnabled` on the base is true only for an explicitly configured `true`.\n *\n * This branch used to return `!isExplicitlyDisabled(name)` whenever a license existed, which\n * made EVERY unrecognised name true — an undeclared flag, or a typo like `aiPowerupz`. It also\n * returned false outright without a license, so an unlicensed install could not turn on a flag\n * it had declared itself. Neither is the license's business.\n */\n return this.base.isEnabled(name);\n }\n}\n\nclass FeatureFlagsWithLicenseDecoratorImpl implements FeatureFlags.Interface {\n constructor(\n private licenseProvider: WcpLicenseProvider.Interface,\n private decoratee: FeatureFlags.Interface\n ) {}\n\n get(): FeatureFlagsClass {\n const base = this.decoratee.get();\n return new LicenseDecoratedFeatureFlags(base, this.licenseProvider.get());\n }\n}\n\nexport const FeatureFlagsWithLicenseDecorator = FeatureFlags.createDecorator({\n decorator: FeatureFlagsWithLicenseDecoratorImpl,\n dependencies: [WcpLicenseProvider]\n});\n"],"names":["LICENSE_CHECKS","l","LicenseDecoratedFeatureFlags","FeatureFlagsClass","base","license","name","check","FeatureFlagsWithLicenseDecoratorImpl","licenseProvider","decoratee","FeatureFlagsWithLicenseDecorator","FeatureFlags","WcpLicenseProvider"],"mappings":";;;AA2BA,MAAMA,iBAAiE;IACnE,cAAcC,CAAAA,IAAKA,EAAE,aAAa,CAAC;IACnC,4BAA4BA,CAAAA,IAAKA,EAAE,eAAe;IAClD,4BAA4BA,CAAAA,IAAKA,EAAE,UAAU;IAC7C,oCAAoCA,CAAAA,IAAKA,EAAE,WAAW;IACtD,2CAA2CA,CAAAA,IAAKA,EAAE,kBAAkB;IACpE,qDAAqDA,CAAAA,IAAKA,EAAE,4BAA4B;IACxF,mDAAmDA,CAAAA,IAAKA,EAAE,0BAA0B;IACpF,WAAWA,CAAAA,IAAKA,EAAE,eAAe;IACjC,eAAeA,CAAAA,IAAKA,EAAE,mBAAmB;IACzC,+BAA+BA,CAAAA,IAAKA,EAAE,gCAAgC;IACtE,0CAA0CA,CAAAA,IAAKA,EAAE,uBAAuB;IACxE,WAAWA,CAAAA,IAAKA,EAAE,eAAe;AACrC;AAEA,MAAMC,qCAAqCC;IACvC,YACYC,IAAuB,EACvBC,OAAiB,CAC3B;QACE,KAAK,CAACD,KAAK,KAAK,UAHRA,IAAI,GAAJA,MAAAA,IAAAA,CACAC,OAAO,GAAPA;IAGZ;IAES,UAAUC,IAAqB,EAAW;QAC/C,MAAMC,QAAQP,cAAc,CAACM,KAAK;QAClC,IAAIC,OAAO;YACP,IAAI,CAACA,MAAM,IAAI,CAAC,OAAO,GACnB,OAAO;YAGX,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAACD;QAC3C;QAUA,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAACA;IAC/B;AACJ;AAEA,MAAME;IACF,YACYC,eAA6C,EAC7CC,SAAiC,CAC3C;aAFUD,eAAe,GAAfA;aACAC,SAAS,GAATA;IACT;IAEH,MAAyB;QACrB,MAAMN,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG;QAC/B,OAAO,IAAIF,6BAA6BE,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG;IAC1E;AACJ;AAEO,MAAMO,mCAAmCC,aAAa,eAAe,CAAC;IACzE,WAAWJ;IACX,cAAc;QAACK;KAAmB;AACtC"}
@@ -0,0 +1,11 @@
1
+ import type { IHasher } from "./abstractions.js";
2
+ import { BuildParams } from "../buildParams/abstractions.js";
3
+ export declare class ScryptHasher implements IHasher {
4
+ private readonly cost;
5
+ private readonly pepper;
6
+ constructor(buildParams: BuildParams.Interface);
7
+ hash(value: string): Promise<string>;
8
+ verify(value: string, storedHash: string): Promise<boolean>;
9
+ private withPepper;
10
+ }
11
+ export declare const Hasher: import("@webiny/di").Implementation<typeof ScryptHasher>;
@@ -0,0 +1,74 @@
1
+ import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
2
+ import { createImplementation } from "@webiny/feature/api";
3
+ import { Hasher } from "./abstractions.js";
4
+ import { BuildParams } from "../buildParams/abstractions.js";
5
+ const ScryptHasher_scrypt = (value, salt, keylen, options)=>new Promise((resolve, reject)=>{
6
+ scrypt(value, salt, keylen, options, (err, derivedKey)=>{
7
+ if (err) reject(err);
8
+ else resolve(derivedKey);
9
+ });
10
+ });
11
+ const PREFIX = "scrypt";
12
+ const KEYLEN = 64;
13
+ const SALT_BYTES = 16;
14
+ const DEFAULT_COST = {
15
+ N: 16384,
16
+ r: 8,
17
+ p: 1
18
+ };
19
+ class ScryptHasher {
20
+ constructor(buildParams){
21
+ this.pepper = buildParams.get("HashingPepper") ?? "";
22
+ const costN = buildParams.get("HashingCost");
23
+ this.cost = costN ? {
24
+ ...DEFAULT_COST,
25
+ N: Number(costN)
26
+ } : DEFAULT_COST;
27
+ }
28
+ async hash(value) {
29
+ const { N, r, p } = this.cost;
30
+ const salt = randomBytes(SALT_BYTES);
31
+ const derived = await ScryptHasher_scrypt(this.withPepper(value), salt, KEYLEN, {
32
+ N,
33
+ r,
34
+ p
35
+ });
36
+ return [
37
+ PREFIX,
38
+ N,
39
+ r,
40
+ p,
41
+ salt.toString("base64"),
42
+ derived.toString("base64")
43
+ ].join("$");
44
+ }
45
+ async verify(value, storedHash) {
46
+ const parts = storedHash.split("$");
47
+ if (6 !== parts.length || parts[0] !== PREFIX) return false;
48
+ const [, nRaw, rRaw, pRaw, saltB64, hashB64] = parts;
49
+ const N = Number(nRaw);
50
+ const r = Number(rRaw);
51
+ const p = Number(pRaw);
52
+ const salt = Buffer.from(saltB64, "base64");
53
+ const expected = Buffer.from(hashB64, "base64");
54
+ const derived = await ScryptHasher_scrypt(this.withPepper(value), salt, expected.length, {
55
+ N,
56
+ r,
57
+ p
58
+ });
59
+ return timingSafeEqual(derived, expected);
60
+ }
61
+ withPepper(value) {
62
+ return this.pepper ? `${value}${this.pepper}` : value;
63
+ }
64
+ }
65
+ const ScryptHasher_Hasher = createImplementation({
66
+ abstraction: Hasher,
67
+ implementation: ScryptHasher,
68
+ dependencies: [
69
+ BuildParams
70
+ ]
71
+ });
72
+ export { ScryptHasher, ScryptHasher_Hasher as Hasher };
73
+
74
+ //# sourceMappingURL=ScryptHasher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/hashing/ScryptHasher.js","sources":["../../../src/features/hashing/ScryptHasher.ts"],"sourcesContent":["import { randomBytes, scrypt as scryptCb, timingSafeEqual } from \"node:crypto\";\nimport type { ScryptOptions } from \"node:crypto\";\nimport { createImplementation } from \"@webiny/feature/api\";\nimport { Hasher as HasherAbstraction } from \"./abstractions.js\";\nimport type { IHasher } from \"./abstractions.js\";\nimport { BuildParams } from \"../buildParams/abstractions.js\";\n\n// `promisify(scryptCb)` resolves to the no-options overload, so we wrap by hand\n// to keep the cost parameters (N, r, p).\nconst scrypt = (\n value: string,\n salt: Buffer,\n keylen: number,\n options: ScryptOptions\n): Promise<Buffer> =>\n new Promise((resolve, reject) => {\n scryptCb(value, salt, keylen, options, (err, derivedKey) => {\n if (err) {\n reject(err);\n } else {\n resolve(derivedKey);\n }\n });\n });\n\n/**\n * Default hasher, built on Node's `crypto.scrypt` — no native dependency, so it runs anywhere Node\n * runs.\n *\n * Configuration (from `webiny.config.tsx` via `<Infra.Hashing>` → BuildParams):\n * - `HashingPepper` — an optional server-side secret folded into every hash. Unlike the per-value\n * salt (stored alongside the hash), the pepper is NOT stored, so a stolen database alone cannot\n * be brute-forced without also holding the pepper. Changing it invalidates existing hashes (same\n * trade-off as rotating the encryption passphrase). Omitted → no pepper, salt only.\n * - `HashingCost` — optional override of the scrypt cost parameter N. Defaults to 16384.\n *\n * The stored value is self-describing (`scrypt$N$r$p$salt$hash`), so switching to Argon2id later is\n * a matter of registering a different `Hasher` — old scrypt hashes keep verifying.\n */\nconst PREFIX = \"scrypt\";\nconst KEYLEN = 64;\nconst SALT_BYTES = 16;\n\ninterface ScryptCost {\n N: number;\n r: number;\n p: number;\n}\n\nconst DEFAULT_COST: ScryptCost = { N: 16384, r: 8, p: 1 };\n\nexport class ScryptHasher implements IHasher {\n private readonly cost: ScryptCost;\n private readonly pepper: string;\n\n constructor(buildParams: BuildParams.Interface) {\n this.pepper = buildParams.get<string>(\"HashingPepper\") ?? \"\";\n const costN = buildParams.get<number | string>(\"HashingCost\");\n this.cost = costN ? { ...DEFAULT_COST, N: Number(costN) } : DEFAULT_COST;\n }\n\n async hash(value: string): Promise<string> {\n const { N, r, p } = this.cost;\n const salt = randomBytes(SALT_BYTES);\n const derived = (await scrypt(this.withPepper(value), salt, KEYLEN, { N, r, p })) as Buffer;\n\n return [PREFIX, N, r, p, salt.toString(\"base64\"), derived.toString(\"base64\")].join(\"$\");\n }\n\n async verify(value: string, storedHash: string): Promise<boolean> {\n const parts = storedHash.split(\"$\");\n if (parts.length !== 6 || parts[0] !== PREFIX) {\n return false;\n }\n\n const [, nRaw, rRaw, pRaw, saltB64, hashB64] = parts;\n const N = Number(nRaw);\n const r = Number(rRaw);\n const p = Number(pRaw);\n const salt = Buffer.from(saltB64, \"base64\");\n const expected = Buffer.from(hashB64, \"base64\");\n\n const derived = (await scrypt(this.withPepper(value), salt, expected.length, {\n N,\n r,\n p\n })) as Buffer;\n\n // Lengths always match here, so timingSafeEqual is safe to call directly.\n return timingSafeEqual(derived, expected);\n }\n\n private withPepper(value: string): string {\n return this.pepper ? `${value}${this.pepper}` : value;\n }\n}\n\nexport const Hasher = createImplementation({\n abstraction: HasherAbstraction,\n implementation: ScryptHasher,\n dependencies: [BuildParams]\n});\n"],"names":["scrypt","value","salt","keylen","options","Promise","resolve","reject","scryptCb","err","derivedKey","PREFIX","KEYLEN","SALT_BYTES","DEFAULT_COST","ScryptHasher","buildParams","costN","Number","N","r","p","randomBytes","derived","storedHash","parts","nRaw","rRaw","pRaw","saltB64","hashB64","Buffer","expected","timingSafeEqual","Hasher","createImplementation","HasherAbstraction","BuildParams"],"mappings":";;;;AASA,MAAMA,sBAAS,CACXC,OACAC,MACAC,QACAC,UAEA,IAAIC,QAAQ,CAACC,SAASC;QAClBC,OAASP,OAAOC,MAAMC,QAAQC,SAAS,CAACK,KAAKC;YACzC,IAAID,KACAF,OAAOE;iBAEPH,QAAQI;QAEhB;IACJ;AAgBJ,MAAMC,SAAS;AACf,MAAMC,SAAS;AACf,MAAMC,aAAa;AAQnB,MAAMC,eAA2B;IAAE,GAAG;IAAO,GAAG;IAAG,GAAG;AAAE;AAEjD,MAAMC;IAIT,YAAYC,WAAkC,CAAE;QAC5C,IAAI,CAAC,MAAM,GAAGA,YAAY,GAAG,CAAS,oBAAoB;QAC1D,MAAMC,QAAQD,YAAY,GAAG,CAAkB;QAC/C,IAAI,CAAC,IAAI,GAAGC,QAAQ;YAAE,GAAGH,YAAY;YAAE,GAAGI,OAAOD;QAAO,IAAIH;IAChE;IAEA,MAAM,KAAKb,KAAa,EAAmB;QACvC,MAAM,EAAEkB,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI;QAC7B,MAAMnB,OAAOoB,YAAYT;QACzB,MAAMU,UAAW,MAAMvB,oBAAO,IAAI,CAAC,UAAU,CAACC,QAAQC,MAAMU,QAAQ;YAAEO;YAAGC;YAAGC;QAAE;QAE9E,OAAO;YAACV;YAAQQ;YAAGC;YAAGC;YAAGnB,KAAK,QAAQ,CAAC;YAAWqB,QAAQ,QAAQ,CAAC;SAAU,CAAC,IAAI,CAAC;IACvF;IAEA,MAAM,OAAOtB,KAAa,EAAEuB,UAAkB,EAAoB;QAC9D,MAAMC,QAAQD,WAAW,KAAK,CAAC;QAC/B,IAAIC,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,KAAK,CAAC,EAAE,KAAKd,QACnC,OAAO;QAGX,MAAM,GAAGe,MAAMC,MAAMC,MAAMC,SAASC,QAAQ,GAAGL;QAC/C,MAAMN,IAAID,OAAOQ;QACjB,MAAMN,IAAIF,OAAOS;QACjB,MAAMN,IAAIH,OAAOU;QACjB,MAAM1B,OAAO6B,OAAO,IAAI,CAACF,SAAS;QAClC,MAAMG,WAAWD,OAAO,IAAI,CAACD,SAAS;QAEtC,MAAMP,UAAW,MAAMvB,oBAAO,IAAI,CAAC,UAAU,CAACC,QAAQC,MAAM8B,SAAS,MAAM,EAAE;YACzEb;YACAC;YACAC;QACJ;QAGA,OAAOY,gBAAgBV,SAASS;IACpC;IAEQ,WAAW/B,KAAa,EAAU;QACtC,OAAO,IAAI,CAAC,MAAM,GAAG,GAAGA,QAAQ,IAAI,CAAC,MAAM,EAAE,GAAGA;IACpD;AACJ;AAEO,MAAMiC,sBAASC,qBAAqB;IACvC,aAAaC;IACb,gBAAgBrB;IAChB,cAAc;QAACsB;KAAY;AAC/B"}
@@ -0,0 +1,18 @@
1
+ export interface IHasher {
2
+ hash(value: string): Promise<string>;
3
+ /** Constant-time compare of `value` against a previously produced hash string. */
4
+ verify(value: string, storedHash: string): Promise<boolean>;
5
+ }
6
+ /**
7
+ * Hashes and verifies secret values (passwords, API-key secrets, tokens, …) with a slow, salted
8
+ * KDF — built for the "store a hash, later verify a presented value" pattern.
9
+ *
10
+ * NOT a general-purpose digest: output is salted and non-deterministic, so this is the wrong tool
11
+ * for checksums / cache keys / dedup (use a fast deterministic digest util for those). Swap the
12
+ * implementation to change algorithms (e.g. Argon2id); stored hashes are self-describing, so old
13
+ * hashes keep verifying after a swap.
14
+ */
15
+ export declare const Hasher: import("@webiny/di").Abstraction<IHasher>;
16
+ export declare namespace Hasher {
17
+ type Interface = IHasher;
18
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const Hasher = createAbstraction("Hasher");
3
+ export { Hasher };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/hashing/abstractions.js","sources":["../../../src/features/hashing/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IHasher {\n hash(value: string): Promise<string>;\n /** Constant-time compare of `value` against a previously produced hash string. */\n verify(value: string, storedHash: string): Promise<boolean>;\n}\n\n/**\n * Hashes and verifies secret values (passwords, API-key secrets, tokens, …) with a slow, salted\n * KDF — built for the \"store a hash, later verify a presented value\" pattern.\n *\n * NOT a general-purpose digest: output is salted and non-deterministic, so this is the wrong tool\n * for checksums / cache keys / dedup (use a fast deterministic digest util for those). Swap the\n * implementation to change algorithms (e.g. Argon2id); stored hashes are self-describing, so old\n * hashes keep verifying after a swap.\n */\nexport const Hasher = createAbstraction<IHasher>(\"Hasher\");\n\nexport namespace Hasher {\n export type Interface = IHasher;\n}\n"],"names":["Hasher","createAbstraction"],"mappings":";AAiBO,MAAMA,SAASC,kBAA2B"}
@@ -0,0 +1,4 @@
1
+ export declare const HasherFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { Hasher } from "./ScryptHasher.js";
3
+ const HasherFeature = createFeature({
4
+ name: "HasherFeature",
5
+ register (container) {
6
+ container.register(Hasher);
7
+ }
8
+ });
9
+ export { HasherFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/hashing/feature.js","sources":["../../../src/features/hashing/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Hasher } from \"./ScryptHasher.js\";\n\nexport const HasherFeature = createFeature({\n name: \"HasherFeature\",\n register(container) {\n container.register(Hasher);\n }\n});\n"],"names":["HasherFeature","createFeature","container","Hasher"],"mappings":";;AAGO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { Hasher } from "./abstractions.js";
2
+ export type { IHasher } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { Hasher } from "./abstractions.js";
@@ -0,0 +1,14 @@
1
+ import type { IRawAuthToken } from "./abstractions.js";
2
+ /**
3
+ * Per-request holder for the transport-extracted raw auth token. Registered per request, so a fresh
4
+ * instance holds the value for the current request only.
5
+ */
6
+ declare class RawAuthTokenImpl implements IRawAuthToken {
7
+ private value;
8
+ get(): string | null;
9
+ set(token: string | null): void;
10
+ }
11
+ export declare const RawAuthToken: typeof RawAuthTokenImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<IRawAuthToken>;
13
+ };
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { RawAuthToken } from "./abstractions.js";
2
+ class RawAuthTokenImpl {
3
+ get() {
4
+ return this.value;
5
+ }
6
+ set(token) {
7
+ this.value = token;
8
+ }
9
+ constructor(){
10
+ this.value = null;
11
+ }
12
+ }
13
+ const RawAuthToken_RawAuthToken = RawAuthToken.createImplementation({
14
+ implementation: RawAuthTokenImpl,
15
+ dependencies: []
16
+ });
17
+ export { RawAuthToken_RawAuthToken as RawAuthToken };
18
+
19
+ //# sourceMappingURL=RawAuthToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/RawAuthToken.js","sources":["../../../src/features/requestContext/RawAuthToken.ts"],"sourcesContent":["import { RawAuthToken as Abstraction } from \"./abstractions.js\";\nimport type { IRawAuthToken } from \"./abstractions.js\";\n\n/**\n * Per-request holder for the transport-extracted raw auth token. Registered per request, so a fresh\n * instance holds the value for the current request only.\n */\nclass RawAuthTokenImpl implements IRawAuthToken {\n private value: string | null = null;\n\n get(): string | null {\n return this.value;\n }\n\n set(token: string | null): void {\n this.value = token;\n }\n}\n\nexport const RawAuthToken = Abstraction.createImplementation({\n implementation: RawAuthTokenImpl,\n dependencies: []\n});\n"],"names":["RawAuthTokenImpl","token","RawAuthToken","Abstraction"],"mappings":";AAOA,MAAMA;IAGF,MAAqB;QACjB,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,IAAIC,KAAoB,EAAQ;QAC5B,IAAI,CAAC,KAAK,GAAGA;IACjB;;aARQ,KAAK,GAAkB;;AASnC;AAEO,MAAMC,4BAAeC,aAAAA,oBAAgC,CAAC;IACzD,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,14 @@
1
+ import type { IRawTenantId } from "./abstractions.js";
2
+ /**
3
+ * Per-request holder for the transport-extracted raw tenant id. Registered per request, so a fresh
4
+ * instance holds the value for the current request only.
5
+ */
6
+ declare class RawTenantIdImpl implements IRawTenantId {
7
+ private value;
8
+ get(): string | null;
9
+ set(id: string | null): void;
10
+ }
11
+ export declare const RawTenantId: typeof RawTenantIdImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<IRawTenantId>;
13
+ };
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { RawTenantId } from "./abstractions.js";
2
+ class RawTenantIdImpl {
3
+ get() {
4
+ return this.value;
5
+ }
6
+ set(id) {
7
+ this.value = id;
8
+ }
9
+ constructor(){
10
+ this.value = null;
11
+ }
12
+ }
13
+ const RawTenantId_RawTenantId = RawTenantId.createImplementation({
14
+ implementation: RawTenantIdImpl,
15
+ dependencies: []
16
+ });
17
+ export { RawTenantId_RawTenantId as RawTenantId };
18
+
19
+ //# sourceMappingURL=RawTenantId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/RawTenantId.js","sources":["../../../src/features/requestContext/RawTenantId.ts"],"sourcesContent":["import { RawTenantId as Abstraction } from \"./abstractions.js\";\nimport type { IRawTenantId } from \"./abstractions.js\";\n\n/**\n * Per-request holder for the transport-extracted raw tenant id. Registered per request, so a fresh\n * instance holds the value for the current request only.\n */\nclass RawTenantIdImpl implements IRawTenantId {\n private value: string | null = null;\n\n get(): string | null {\n return this.value;\n }\n\n set(id: string | null): void {\n this.value = id;\n }\n}\n\nexport const RawTenantId = Abstraction.createImplementation({\n implementation: RawTenantIdImpl,\n dependencies: []\n});\n"],"names":["RawTenantIdImpl","id","RawTenantId","Abstraction"],"mappings":";AAOA,MAAMA;IAGF,MAAqB;QACjB,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,IAAIC,EAAiB,EAAQ;QACzB,IAAI,CAAC,KAAK,GAAGA;IACjB;;aARQ,KAAK,GAAkB;;AASnC;AAEO,MAAMC,0BAAcC,YAAAA,oBAAgC,CAAC;IACxD,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,19 @@
1
+ import { RequestIdentityLoader as Abstraction } from "./abstractions.js";
2
+ import type { IRawAuthToken } from "./abstractions.js";
3
+ import type { IAuthenticationContext } from "../../features/security/authentication/AuthenticationContext/index.js";
4
+ import type { IIdentityContext } from "../../features/security/IdentityContext/abstractions.js";
5
+ /**
6
+ * LOAD step: authenticates the token set by the transport's EXTRACT step into RawAuthToken and sets
7
+ * IdentityContext. A null/absent token authenticates as anonymous (preserves the previous
8
+ * always-authenticate-the-header behavior). Transport-agnostic.
9
+ */
10
+ export declare class RequestIdentityLoaderImpl implements Abstraction.Interface {
11
+ private authentication;
12
+ private identityContext;
13
+ private rawAuthToken;
14
+ constructor(authentication: IAuthenticationContext, identityContext: IIdentityContext, rawAuthToken: IRawAuthToken);
15
+ establish(): Promise<void>;
16
+ }
17
+ export declare const RequestIdentityLoader: typeof RequestIdentityLoaderImpl & {
18
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRequestIdentityLoader>;
19
+ };
@@ -0,0 +1,26 @@
1
+ import { RawAuthToken, RequestIdentityLoader } from "./abstractions.js";
2
+ import { AuthenticationContext } from "../security/authentication/AuthenticationContext/index.js";
3
+ import { IdentityContext } from "../security/IdentityContext/index.js";
4
+ class RequestIdentityLoaderImpl {
5
+ constructor(authentication, identityContext, rawAuthToken){
6
+ this.authentication = authentication;
7
+ this.identityContext = identityContext;
8
+ this.rawAuthToken = rawAuthToken;
9
+ }
10
+ async establish() {
11
+ const token = this.rawAuthToken.get() ?? "";
12
+ const identity = await this.authentication.authenticate(token);
13
+ this.identityContext.setIdentity(identity);
14
+ }
15
+ }
16
+ const RequestIdentityLoader_RequestIdentityLoader = RequestIdentityLoader.createImplementation({
17
+ implementation: RequestIdentityLoaderImpl,
18
+ dependencies: [
19
+ AuthenticationContext,
20
+ IdentityContext,
21
+ RawAuthToken
22
+ ]
23
+ });
24
+ export { RequestIdentityLoaderImpl, RequestIdentityLoader_RequestIdentityLoader as RequestIdentityLoader };
25
+
26
+ //# sourceMappingURL=RequestIdentityLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/RequestIdentityLoader.js","sources":["../../../src/features/requestContext/RequestIdentityLoader.ts"],"sourcesContent":["import { RequestIdentityLoader as Abstraction, RawAuthToken } from \"./abstractions.js\";\nimport type { IRawAuthToken } from \"./abstractions.js\";\nimport { AuthenticationContext } from \"~/features/security/authentication/AuthenticationContext/index.js\";\nimport type { IAuthenticationContext } from \"~/features/security/authentication/AuthenticationContext/index.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport type { IIdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\n\n/**\n * LOAD step: authenticates the token set by the transport's EXTRACT step into RawAuthToken and sets\n * IdentityContext. A null/absent token authenticates as anonymous (preserves the previous\n * always-authenticate-the-header behavior). Transport-agnostic.\n */\nexport class RequestIdentityLoaderImpl implements Abstraction.Interface {\n constructor(\n private authentication: IAuthenticationContext,\n private identityContext: IIdentityContext,\n private rawAuthToken: IRawAuthToken\n ) {}\n\n async establish(): Promise<void> {\n const token = this.rawAuthToken.get() ?? \"\";\n const identity = await this.authentication.authenticate(token);\n this.identityContext.setIdentity(identity);\n }\n}\n\nexport const RequestIdentityLoader = Abstraction.createImplementation({\n implementation: RequestIdentityLoaderImpl,\n dependencies: [AuthenticationContext, IdentityContext, RawAuthToken]\n});\n"],"names":["RequestIdentityLoaderImpl","authentication","identityContext","rawAuthToken","token","identity","RequestIdentityLoader","Abstraction","AuthenticationContext","IdentityContext","RawAuthToken"],"mappings":";;;AAYO,MAAMA;IACT,YACYC,cAAsC,EACtCC,eAAiC,EACjCC,YAA2B,CACrC;aAHUF,cAAc,GAAdA;aACAC,eAAe,GAAfA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,YAA2B;QAC7B,MAAMC,QAAQ,IAAI,CAAC,YAAY,CAAC,GAAG,MAAM;QACzC,MAAMC,WAAW,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAACD;QACxD,IAAI,CAAC,eAAe,CAAC,WAAW,CAACC;IACrC;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAgC,CAAC;IAClE,gBAAgBP;IAChB,cAAc;QAACQ;QAAuBC;QAAiBC;KAAa;AACxE"}
@@ -0,0 +1,18 @@
1
+ import { RequestTenantLoader as Abstraction } from "./abstractions.js";
2
+ import type { IRawTenantId } from "./abstractions.js";
3
+ import type { ITenantContext } from "../../features/tenancy/TenantContext/abstractions.js";
4
+ import type { IGetTenantByIdUseCase } from "../../features/tenancy/GetTenantById/abstractions.js";
5
+ /**
6
+ * LOAD step: reads the raw tenant id (set by the transport's EXTRACT step into RawTenantId),
7
+ * resolves the Tenant, and sets TenantContext. Transport-agnostic.
8
+ */
9
+ export declare class RequestTenantLoaderImpl implements Abstraction.Interface {
10
+ private tenantContext;
11
+ private getTenantById;
12
+ private rawTenantId;
13
+ constructor(tenantContext: ITenantContext, getTenantById: IGetTenantByIdUseCase, rawTenantId: IRawTenantId);
14
+ establish(): Promise<void>;
15
+ }
16
+ export declare const RequestTenantLoader: typeof RequestTenantLoaderImpl & {
17
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRequestTenantLoader>;
18
+ };
@@ -0,0 +1,52 @@
1
+ import { RawTenantId, RequestTenantLoader } from "./abstractions.js";
2
+ import { TenantContext } from "../tenancy/TenantContext/index.js";
3
+ import { GetTenantByIdUseCase } from "../tenancy/GetTenantById/index.js";
4
+ const DEFAULT_TENANT_ID = "root";
5
+ const createBootstrapRootTenant = ()=>{
6
+ const now = new Date().toISOString();
7
+ return {
8
+ id: DEFAULT_TENANT_ID,
9
+ name: "Root",
10
+ description: "",
11
+ status: "enabled",
12
+ isInstalled: false,
13
+ settings: {
14
+ name: {
15
+ full: "Root",
16
+ slug: "root"
17
+ },
18
+ social: {},
19
+ favicon: {},
20
+ logo: {}
21
+ },
22
+ tags: [],
23
+ parent: null,
24
+ createdOn: now,
25
+ savedOn: now
26
+ };
27
+ };
28
+ class RequestTenantLoaderImpl {
29
+ constructor(tenantContext, getTenantById, rawTenantId){
30
+ this.tenantContext = tenantContext;
31
+ this.getTenantById = getTenantById;
32
+ this.rawTenantId = rawTenantId;
33
+ }
34
+ async establish() {
35
+ const resolvedId = this.rawTenantId.get() || DEFAULT_TENANT_ID;
36
+ const result = await this.getTenantById.execute(resolvedId);
37
+ if (result.isOk()) return void this.tenantContext.setTenant(result.value);
38
+ if (resolvedId === DEFAULT_TENANT_ID) return void this.tenantContext.setTenant(createBootstrapRootTenant());
39
+ console.warn(`[RequestTenantLoader] Tenant "${resolvedId}" not found.`);
40
+ }
41
+ }
42
+ const RequestTenantLoader_RequestTenantLoader = RequestTenantLoader.createImplementation({
43
+ implementation: RequestTenantLoaderImpl,
44
+ dependencies: [
45
+ TenantContext,
46
+ GetTenantByIdUseCase,
47
+ RawTenantId
48
+ ]
49
+ });
50
+ export { RequestTenantLoaderImpl, RequestTenantLoader_RequestTenantLoader as RequestTenantLoader };
51
+
52
+ //# sourceMappingURL=RequestTenantLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestContext/RequestTenantLoader.js","sources":["../../../src/features/requestContext/RequestTenantLoader.ts"],"sourcesContent":["import { RequestTenantLoader as Abstraction, RawTenantId } from \"./abstractions.js\";\nimport type { IRawTenantId } from \"./abstractions.js\";\nimport { TenantContext } from \"~/features/tenancy/TenantContext/index.js\";\nimport type { ITenantContext } from \"~/features/tenancy/TenantContext/abstractions.js\";\nimport { GetTenantByIdUseCase } from \"~/features/tenancy/GetTenantById/index.js\";\nimport type { IGetTenantByIdUseCase } from \"~/features/tenancy/GetTenantById/abstractions.js\";\nimport type { Tenant } from \"~/types/tenancy.js\";\n\nconst DEFAULT_TENANT_ID = \"root\";\n\n/**\n * A minimal in-memory root tenant used only before the system is installed, when the real root\n * tenant record doesn't exist yet. It keeps the request pipeline + GraphQL schema build functional\n * (nothing dereferences a null tenant) so the install mutation can run and create the real root.\n * Once installed, getTenantById returns the persisted record and this is never used.\n */\nconst createBootstrapRootTenant = (): Tenant => {\n const now = new Date().toISOString();\n return {\n id: DEFAULT_TENANT_ID,\n name: \"Root\",\n description: \"\",\n status: \"enabled\",\n isInstalled: false,\n settings: {\n name: { full: \"Root\", slug: \"root\" },\n social: {},\n favicon: {},\n logo: {}\n } as any,\n tags: [],\n parent: null,\n createdOn: now,\n savedOn: now\n };\n};\n\n/**\n * LOAD step: reads the raw tenant id (set by the transport's EXTRACT step into RawTenantId),\n * resolves the Tenant, and sets TenantContext. Transport-agnostic.\n */\nexport class RequestTenantLoaderImpl implements Abstraction.Interface {\n constructor(\n private tenantContext: ITenantContext,\n private getTenantById: IGetTenantByIdUseCase,\n private rawTenantId: IRawTenantId\n ) {}\n\n async establish(): Promise<void> {\n const resolvedId = this.rawTenantId.get() || DEFAULT_TENANT_ID;\n const result = await this.getTenantById.execute(resolvedId);\n if (result.isOk()) {\n this.tenantContext.setTenant(result.value);\n return;\n }\n\n // Fresh, not-yet-installed environment: the root tenant record doesn't exist yet. Establish a\n // bootstrap root so the request pipeline + GraphQL schema build work and the install mutation\n // can create the real root tenant. Only ever taken for the root tenant pre-install.\n if (resolvedId === DEFAULT_TENANT_ID) {\n this.tenantContext.setTenant(createBootstrapRootTenant());\n return;\n }\n\n console.warn(`[RequestTenantLoader] Tenant \"${resolvedId}\" not found.`);\n }\n}\n\nexport const RequestTenantLoader = Abstraction.createImplementation({\n implementation: RequestTenantLoaderImpl,\n dependencies: [TenantContext, GetTenantByIdUseCase, RawTenantId]\n});\n"],"names":["DEFAULT_TENANT_ID","createBootstrapRootTenant","now","Date","RequestTenantLoaderImpl","tenantContext","getTenantById","rawTenantId","resolvedId","result","console","RequestTenantLoader","Abstraction","TenantContext","GetTenantByIdUseCase","RawTenantId"],"mappings":";;;AAQA,MAAMA,oBAAoB;AAQ1B,MAAMC,4BAA4B;IAC9B,MAAMC,MAAM,IAAIC,OAAO,WAAW;IAClC,OAAO;QACH,IAAIH;QACJ,MAAM;QACN,aAAa;QACb,QAAQ;QACR,aAAa;QACb,UAAU;YACN,MAAM;gBAAE,MAAM;gBAAQ,MAAM;YAAO;YACnC,QAAQ,CAAC;YACT,SAAS,CAAC;YACV,MAAM,CAAC;QACX;QACA,MAAM,EAAE;QACR,QAAQ;QACR,WAAWE;QACX,SAASA;IACb;AACJ;AAMO,MAAME;IACT,YACYC,aAA6B,EAC7BC,aAAoC,EACpCC,WAAyB,CACnC;aAHUF,aAAa,GAAbA;aACAC,aAAa,GAAbA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,YAA2B;QAC7B,MAAMC,aAAa,IAAI,CAAC,WAAW,CAAC,GAAG,MAAMR;QAC7C,MAAMS,SAAS,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACD;QAChD,IAAIC,OAAO,IAAI,IAAI,YACf,IAAI,CAAC,aAAa,CAAC,SAAS,CAACA,OAAO,KAAK;QAO7C,IAAID,eAAeR,mBAAmB,YAClC,IAAI,CAAC,aAAa,CAAC,SAAS,CAACC;QAIjCS,QAAQ,IAAI,CAAC,CAAC,8BAA8B,EAAEF,WAAW,YAAY,CAAC;IAC1E;AACJ;AAEO,MAAMG,0CAAsBC,oBAAAA,oBAAgC,CAAC;IAChE,gBAAgBR;IAChB,cAAc;QAACS;QAAeC;QAAsBC;KAAY;AACpE"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Per-request holder for the raw tenant id EXTRACTED by the transport (e.g. the `x-tenant` header
3
+ * of an API Gateway event, the bucket name of an S3 event, or `payload.tenant` of a background
4
+ * task). The transport-specific EXTRACT step sets this; the transport-agnostic LOAD step
5
+ * (RequestTenantLoader) reads it, resolves the Tenant, and sets TenantContext.
6
+ */
7
+ export interface IRawTenantId {
8
+ get(): string | null;
9
+ set(id: string | null): void;
10
+ }
11
+ export declare const RawTenantId: import("@webiny/di").Abstraction<IRawTenantId>;
12
+ export declare namespace RawTenantId {
13
+ type Interface = IRawTenantId;
14
+ }
15
+ /**
16
+ * Per-request holder for the raw auth token EXTRACTED by the transport (e.g. the `Authorization`
17
+ * bearer header or an auth cookie of an API Gateway event). Only token-based transports set this;
18
+ * the transport-agnostic LOAD step (RequestIdentityLoader) reads it, authenticates it, and
19
+ * sets IdentityContext. A null/absent value authenticates as anonymous.
20
+ *
21
+ * Note: non-token transports (S3, background tasks) never set this — S3 has no user identity, and
22
+ * background-task identity is derived from `task.createdBy` after the task is fetched.
23
+ */
24
+ export interface IRawAuthToken {
25
+ get(): string | null;
26
+ set(token: string | null): void;
27
+ }
28
+ export declare const RawAuthToken: import("@webiny/di").Abstraction<IRawAuthToken>;
29
+ export declare namespace RawAuthToken {
30
+ type Interface = IRawAuthToken;
31
+ }
32
+ /**
33
+ * LOAD step: authenticates the token held by RawAuthToken and sets IdentityContext. Fully
34
+ * transport-agnostic — transports only EXTRACT the token into RawAuthToken.
35
+ */
36
+ export interface IRequestIdentityLoader {
37
+ establish(): Promise<void>;
38
+ }
39
+ export declare const RequestIdentityLoader: import("@webiny/di").Abstraction<IRequestIdentityLoader>;
40
+ export declare namespace RequestIdentityLoader {
41
+ type Interface = IRequestIdentityLoader;
42
+ }
43
+ /**
44
+ * LOAD step: resolves the Tenant for the id held by RawTenantId and sets TenantContext. Fully
45
+ * transport-agnostic — transports only EXTRACT the id into RawTenantId.
46
+ */
47
+ export interface IRequestTenantLoader {
48
+ establish(): Promise<void>;
49
+ }
50
+ export declare const RequestTenantLoader: import("@webiny/di").Abstraction<IRequestTenantLoader>;
51
+ export declare namespace RequestTenantLoader {
52
+ type Interface = IRequestTenantLoader;
53
+ }
@@ -0,0 +1,8 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const RawTenantId = createAbstraction("RequestContext/RawTenantId");
3
+ const RawAuthToken = createAbstraction("RequestContext/RawAuthToken");
4
+ const RequestIdentityLoader = createAbstraction("RequestContext/RequestIdentityLoader");
5
+ const RequestTenantLoader = createAbstraction("RequestContext/RequestTenantLoader");
6
+ export { RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader };
7
+
8
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ import type { Container } from "@webiny/di";
2
+ /**
3
+ * Registers the request-context pieces:
4
+ * - RawTenantId / RawAuthToken: per-request holders that the transport's EXTRACT step writes to.
5
+ * - RequestIdentityLoader / RequestTenantLoader: transport-agnostic LOAD steps that read
6
+ * the holders and set IdentityContext / TenantContext.
7
+ */
8
+ export declare const RequestContextFeature: {
9
+ name: string;
10
+ register(container: Container): void;
11
+ };
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { RawTenantId } from "./RawTenantId.js";
3
+ import { RawAuthToken } from "./RawAuthToken.js";
4
+ import { RequestIdentityLoader } from "./RequestIdentityLoader.js";
5
+ import { RequestTenantLoader } from "./RequestTenantLoader.js";
6
+ const RequestContextFeature = createFeature({
7
+ name: "RequestContext",
8
+ register (container) {
9
+ container.register(RawTenantId).inSingletonScope();
10
+ container.register(RawAuthToken).inSingletonScope();
11
+ container.register(RequestIdentityLoader);
12
+ container.register(RequestTenantLoader);
13
+ }
14
+ });
15
+ export { RequestContextFeature };
16
+
17
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export { RawTenantId, RawAuthToken, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
2
+ export { RequestContextFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader } from "./abstractions.js";
2
+ export { RequestContextFeature } from "./feature.js";