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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/ApiCoreFeature.js +6 -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 +1 -1
  6. package/exports/api.js +1 -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/debugger/Debugger.d.ts +30 -0
  41. package/features/debugger/Debugger.js +142 -0
  42. package/features/debugger/Debugger.js.map +1 -0
  43. package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
  44. package/features/debugger/DebuggerRouteDecorator.js +102 -0
  45. package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
  46. package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
  47. package/features/debugger/GraphQLDebuggerTransport.js +45 -0
  48. package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
  49. package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
  50. package/features/debugger/__tests__/matchNamespace.test.js +68 -0
  51. package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
  52. package/features/debugger/__tests__/serialize.test.d.ts +1 -0
  53. package/features/debugger/__tests__/serialize.test.js +220 -0
  54. package/features/debugger/__tests__/serialize.test.js.map +1 -0
  55. package/features/debugger/abstractions.d.ts +100 -0
  56. package/features/debugger/abstractions.js +6 -0
  57. package/features/debugger/abstractions.js.map +1 -0
  58. package/features/debugger/feature.d.ts +5 -0
  59. package/features/debugger/feature.js +15 -0
  60. package/features/debugger/feature.js.map +1 -0
  61. package/features/debugger/index.d.ts +12 -0
  62. package/features/debugger/index.js +7 -0
  63. package/features/debugger/limits.d.ts +18 -0
  64. package/features/debugger/limits.js +11 -0
  65. package/features/debugger/limits.js.map +1 -0
  66. package/features/debugger/matchNamespace.d.ts +14 -0
  67. package/features/debugger/matchNamespace.js +35 -0
  68. package/features/debugger/matchNamespace.js.map +1 -0
  69. package/features/debugger/parseNamespaceHeader.d.ts +7 -0
  70. package/features/debugger/parseNamespaceHeader.js +16 -0
  71. package/features/debugger/parseNamespaceHeader.js.map +1 -0
  72. package/features/debugger/permissions.d.ts +14 -0
  73. package/features/debugger/permissions.js +8 -0
  74. package/features/debugger/permissions.js.map +1 -0
  75. package/features/debugger/permissionsSchema.d.ts +17 -0
  76. package/features/debugger/permissionsSchema.js +18 -0
  77. package/features/debugger/permissionsSchema.js.map +1 -0
  78. package/features/debugger/serialize.d.ts +11 -0
  79. package/features/debugger/serialize.js +121 -0
  80. package/features/debugger/serialize.js.map +1 -0
  81. package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
  82. package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
  83. package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
  84. package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
  85. package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
  86. package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
  87. package/features/encryption/EncryptionService.d.ts +3 -2
  88. package/features/encryption/EncryptionService.js +15 -13
  89. package/features/encryption/EncryptionService.js.map +1 -1
  90. package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
  91. package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
  92. package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
  93. package/features/encryption/abstractions.d.ts +26 -0
  94. package/features/encryption/abstractions.js +3 -1
  95. package/features/encryption/abstractions.js.map +1 -1
  96. package/features/encryption/feature.js +2 -0
  97. package/features/encryption/feature.js.map +1 -1
  98. package/features/encryption/index.d.ts +3 -0
  99. package/features/encryption/index.js +3 -1
  100. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +13 -1
  101. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -1
  102. package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
  103. package/features/hashing/BuildParamsHashingConfig.js +18 -0
  104. package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
  105. package/features/hashing/ScryptHasher.d.ts +2 -2
  106. package/features/hashing/ScryptHasher.js +6 -8
  107. package/features/hashing/ScryptHasher.js.map +1 -1
  108. package/features/hashing/abstractions.d.ts +15 -0
  109. package/features/hashing/abstractions.js +2 -1
  110. package/features/hashing/abstractions.js.map +1 -1
  111. package/features/hashing/feature.js +2 -0
  112. package/features/hashing/feature.js.map +1 -1
  113. package/features/hashing/index.d.ts +1 -0
  114. package/features/hashing/index.js +1 -1
  115. package/features/httpClient/HttpClient.d.ts +7 -0
  116. package/features/httpClient/HttpClient.js +72 -0
  117. package/features/httpClient/HttpClient.js.map +1 -0
  118. package/features/httpClient/HttpRequestError.d.ts +10 -0
  119. package/features/httpClient/HttpRequestError.js +13 -0
  120. package/features/httpClient/HttpRequestError.js.map +1 -0
  121. package/features/httpClient/HttpStatusError.d.ts +12 -0
  122. package/features/httpClient/HttpStatusError.js +12 -0
  123. package/features/httpClient/HttpStatusError.js.map +1 -0
  124. package/features/httpClient/abstractions.d.ts +32 -0
  125. package/features/httpClient/abstractions.js +5 -0
  126. package/features/httpClient/abstractions.js.map +1 -0
  127. package/features/{logger → httpClient}/feature.d.ts +1 -1
  128. package/features/httpClient/feature.js +11 -0
  129. package/features/httpClient/feature.js.map +1 -0
  130. package/features/httpClient/index.d.ts +3 -0
  131. package/features/httpClient/index.js +3 -0
  132. package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
  133. package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
  134. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  135. package/features/keyValueStore/KeyValueStore.d.ts +6 -2
  136. package/features/keyValueStore/KeyValueStore.js +13 -3
  137. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  138. package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
  139. package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
  140. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  141. package/features/keyValueStore/abstractions.d.ts +132 -14
  142. package/features/keyValueStore/abstractions.js.map +1 -1
  143. package/features/keyValueStore/errors.d.ts +29 -0
  144. package/features/keyValueStore/errors.js +49 -1
  145. package/features/keyValueStore/errors.js.map +1 -1
  146. package/features/keyValueStore/index.d.ts +4 -1
  147. package/features/keyValueStore/index.js +1 -1
  148. package/features/logger/NullLogger.d.ts +10 -0
  149. package/features/logger/NullLogger.js +12 -0
  150. package/features/logger/NullLogger.js.map +1 -0
  151. package/features/logger/index.d.ts +1 -0
  152. package/features/logger/index.js +1 -0
  153. package/features/publicUrls/NullPublicUrls.d.ts +11 -0
  154. package/features/publicUrls/NullPublicUrls.js +17 -0
  155. package/features/publicUrls/NullPublicUrls.js.map +1 -0
  156. package/features/publicUrls/PublicUrl.d.ts +24 -0
  157. package/features/publicUrls/PublicUrl.js +43 -0
  158. package/features/publicUrls/PublicUrl.js.map +1 -0
  159. package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
  160. package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
  161. package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
  162. package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
  163. package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
  164. package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
  165. package/features/publicUrls/abstractions.d.ts +27 -0
  166. package/features/publicUrls/abstractions.js +5 -0
  167. package/features/publicUrls/abstractions.js.map +1 -0
  168. package/features/publicUrls/feature.d.ts +8 -0
  169. package/features/publicUrls/feature.js +11 -0
  170. package/features/publicUrls/feature.js.map +1 -0
  171. package/features/publicUrls/index.d.ts +3 -0
  172. package/features/publicUrls/index.js +3 -0
  173. package/features/requestContext/RawAssumePermissions.d.ts +14 -0
  174. package/features/requestContext/RawAssumePermissions.js +19 -0
  175. package/features/requestContext/RawAssumePermissions.js.map +1 -0
  176. package/features/requestContext/abstractions.d.ts +22 -0
  177. package/features/requestContext/abstractions.js +2 -1
  178. package/features/requestContext/abstractions.js.map +1 -1
  179. package/features/requestContext/extractAssumePermissions.d.ts +14 -0
  180. package/features/requestContext/extractAssumePermissions.js +32 -0
  181. package/features/requestContext/extractAssumePermissions.js.map +1 -0
  182. package/features/requestContext/feature.d.ts +2 -1
  183. package/features/requestContext/feature.js +2 -0
  184. package/features/requestContext/feature.js.map +1 -1
  185. package/features/requestContext/index.d.ts +3 -1
  186. package/features/requestContext/index.js +2 -1
  187. package/features/security/IdentityContext/IdentityContext.d.ts +6 -2
  188. package/features/security/IdentityContext/IdentityContext.js +24 -7
  189. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  190. package/features/security/IdentityContext/abstractions.d.ts +6 -1
  191. package/features/security/IdentityContext/abstractions.js.map +1 -1
  192. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
  193. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
  194. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  195. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  196. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  197. package/features/security/authorization/AuthorizationContext/feature.js +6 -1
  198. package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
  199. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
  200. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
  201. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
  202. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
  203. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  204. package/features/security/roles/Installer/RolesInstaller.js +1 -0
  205. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  206. package/features/task/TaskDefinition/abstractions.d.ts +13 -20
  207. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  208. package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
  209. package/features/tenancy/TenantContext/TenantContext.js +31 -23
  210. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  211. package/features/users/shared/loaders.js.map +1 -1
  212. package/features/users/shared/types.d.ts +9 -7
  213. package/features/wcp/WcpContext/WcpContext.d.ts +6 -1
  214. package/features/wcp/WcpContext/WcpContext.js +17 -2
  215. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  216. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +9 -73
  217. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +25 -5
  218. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  219. package/features/wcp/WcpLicenseLoader.js.map +1 -1
  220. package/features/wcp/resolveWcpProjectEnvironment.d.ts +1 -1
  221. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -1
  222. package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
  223. package/graphql/ApiCoreSchemaFactory.js +7 -1
  224. package/graphql/ApiCoreSchemaFactory.js.map +1 -1
  225. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +1 -0
  226. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +4 -0
  227. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -1
  228. package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
  229. package/graphql/security/SecuritySchemaFactory.js +4 -0
  230. package/graphql/security/SecuritySchemaFactory.js.map +1 -1
  231. package/graphql/system/SystemSchemaFactory.d.ts +1 -0
  232. package/graphql/system/SystemSchemaFactory.js +4 -0
  233. package/graphql/system/SystemSchemaFactory.js.map +1 -1
  234. package/graphql/users/UsersSchemaFactory.d.ts +1 -0
  235. package/graphql/users/UsersSchemaFactory.js +4 -0
  236. package/graphql/users/UsersSchemaFactory.js.map +1 -1
  237. package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
  238. package/graphql/wcp/WcpSchemaFactory.js +5 -1
  239. package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
  240. package/idp/JwksCache.d.ts +14 -3
  241. package/idp/JwksCache.js +97 -17
  242. package/idp/JwksCache.js.map +1 -1
  243. package/idp/JwksStoreFeature.d.ts +8 -0
  244. package/idp/JwksStoreFeature.js +11 -0
  245. package/idp/JwksStoreFeature.js.map +1 -0
  246. package/idp/MemoryJwksStore.d.ts +14 -0
  247. package/idp/MemoryJwksStore.js +21 -0
  248. package/idp/MemoryJwksStore.js.map +1 -0
  249. package/idp/OidcJwtIdentityProvider.js +5 -1
  250. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  251. package/idp/abstractions.d.ts +24 -0
  252. package/idp/abstractions.js +2 -1
  253. package/idp/abstractions.js.map +1 -1
  254. package/idp/feature.js +1 -2
  255. package/idp/feature.js.map +1 -1
  256. package/idp/index.d.ts +1 -0
  257. package/idp/index.js +1 -0
  258. package/package.json +21 -21
  259. package/types/users.d.ts +2 -3
  260. package/features/logger/LoggerService.d.ts +0 -14
  261. package/features/logger/LoggerService.js +0 -48
  262. package/features/logger/LoggerService.js.map +0 -1
  263. package/features/logger/feature.js +0 -11
  264. package/features/logger/feature.js.map +0 -1
@@ -3,6 +3,7 @@ import { FeatureFlags as feature_flags_FeatureFlags } from "@webiny/feature-flag
3
3
  import { WcpLicenseProvider } from "../../wcp/WcpLicenseProvider.js";
4
4
  const LICENSE_CHECKS = {
5
5
  multiTenancy: (l)=>l.canUseFeature("multiTenancy"),
6
+ languages: (l)=>l.canUseLanguages(),
6
7
  advancedPublishingWorkflow: (l)=>l.canUseWorkflows(),
7
8
  advancedAccessControlLayer: (l)=>l.canUseAacl(),
8
9
  "advancedAccessControlLayer.teams": (l)=>l.canUseTeams(),
@@ -12,8 +13,19 @@ const LICENSE_CHECKS = {
12
13
  auditLogs: (l)=>l.canUseAuditLogs(),
13
14
  recordLocking: (l)=>l.canUseRecordLocking(),
14
15
  "fileManager.threatDetection": (l)=>l.canUseFileManagerThreatDetection(),
16
+ aiPowerups: (l)=>l.canUseAiPowerups(),
15
17
  "aiPowerups.fileManager.imageEnrichment": (l)=>l.canUseAiImageEnrichment(),
16
- abTesting: (l)=>l.canUseAbTesting()
18
+ "aiPowerups.websiteBuilder.pageGeneration": (l)=>l.canUseAiPageGeneration(),
19
+ "aiPowerups.websiteBuilder.pageTranslation": (l)=>l.canUseAiPageTranslation(),
20
+ "aiPowerups.lexicalGeneration": (l)=>l.canUseAiLexicalGeneration(),
21
+ "aiPowerups.adminAssistant": (l)=>l.canUseAiAdminAssistant(),
22
+ "aiPowerups.cms.entryGeneration": (l)=>l.canUseAiEntryGeneration(),
23
+ "aiPowerups.cms.entryComparison": (l)=>l.canUseAiEntryComparison(),
24
+ "aiPowerups.cms.entryTranslation": (l)=>l.canUseAiEntryTranslation(),
25
+ abTesting: (l)=>l.canUseAbTesting(),
26
+ collaboration: (l)=>l.canUseCollaboration(),
27
+ "collaboration.comments": (l)=>l.canUseComments(),
28
+ "collaboration.activityLog": (l)=>l.canUseActivityLog()
17
29
  };
18
30
  class LicenseDecoratedFeatureFlags extends feature_flags_FeatureFlags {
19
31
  constructor(base, license){
@@ -1 +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"}
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 languages: l => l.canUseLanguages(),\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: l => l.canUseAiPowerups(),\n \"aiPowerups.fileManager.imageEnrichment\": l => l.canUseAiImageEnrichment(),\n \"aiPowerups.websiteBuilder.pageGeneration\": l => l.canUseAiPageGeneration(),\n \"aiPowerups.websiteBuilder.pageTranslation\": l => l.canUseAiPageTranslation(),\n \"aiPowerups.lexicalGeneration\": l => l.canUseAiLexicalGeneration(),\n \"aiPowerups.adminAssistant\": l => l.canUseAiAdminAssistant(),\n \"aiPowerups.cms.entryGeneration\": l => l.canUseAiEntryGeneration(),\n \"aiPowerups.cms.entryComparison\": l => l.canUseAiEntryComparison(),\n \"aiPowerups.cms.entryTranslation\": l => l.canUseAiEntryTranslation(),\n abTesting: l => l.canUseAbTesting(),\n collaboration: l => l.canUseCollaboration(),\n \"collaboration.comments\": l => l.canUseComments(),\n \"collaboration.activityLog\": l => l.canUseActivityLog()\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,WAAWA,CAAAA,IAAKA,EAAE,eAAe;IACjC,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,YAAYA,CAAAA,IAAKA,EAAE,gBAAgB;IACnC,0CAA0CA,CAAAA,IAAKA,EAAE,uBAAuB;IACxE,4CAA4CA,CAAAA,IAAKA,EAAE,sBAAsB;IACzE,6CAA6CA,CAAAA,IAAKA,EAAE,uBAAuB;IAC3E,gCAAgCA,CAAAA,IAAKA,EAAE,yBAAyB;IAChE,6BAA6BA,CAAAA,IAAKA,EAAE,sBAAsB;IAC1D,kCAAkCA,CAAAA,IAAKA,EAAE,uBAAuB;IAChE,kCAAkCA,CAAAA,IAAKA,EAAE,uBAAuB;IAChE,mCAAmCA,CAAAA,IAAKA,EAAE,wBAAwB;IAClE,WAAWA,CAAAA,IAAKA,EAAE,eAAe;IACjC,eAAeA,CAAAA,IAAKA,EAAE,mBAAmB;IACzC,0BAA0BA,CAAAA,IAAKA,EAAE,cAAc;IAC/C,6BAA6BA,CAAAA,IAAKA,EAAE,iBAAiB;AACzD;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 { HashingConfig } from "./abstractions.js";
2
+ import { BuildParams } from "../buildParams/abstractions.js";
3
+ declare class BuildParamsHashingConfigImpl implements HashingConfig.Interface {
4
+ readonly pepper: string;
5
+ readonly costN: number | null;
6
+ constructor(buildParams: BuildParams.Interface);
7
+ }
8
+ export declare const BuildParamsHashingConfig: typeof BuildParamsHashingConfigImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IHashingConfig>;
10
+ };
11
+ export {};
@@ -0,0 +1,18 @@
1
+ import { HashingConfig } from "./abstractions.js";
2
+ import { BuildParams } from "../buildParams/abstractions.js";
3
+ class BuildParamsHashingConfigImpl {
4
+ constructor(buildParams){
5
+ this.pepper = buildParams.get("HashingPepper") ?? "";
6
+ const costN = buildParams.get("HashingCost");
7
+ this.costN = costN ? Number(costN) : null;
8
+ }
9
+ }
10
+ const BuildParamsHashingConfig = HashingConfig.createImplementation({
11
+ implementation: BuildParamsHashingConfigImpl,
12
+ dependencies: [
13
+ BuildParams
14
+ ]
15
+ });
16
+ export { BuildParamsHashingConfig };
17
+
18
+ //# sourceMappingURL=BuildParamsHashingConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/hashing/BuildParamsHashingConfig.js","sources":["../../../src/features/hashing/BuildParamsHashingConfig.ts"],"sourcesContent":["import { HashingConfig } from \"./abstractions.js\";\nimport { BuildParams } from \"../buildParams/abstractions.js\";\n\nclass BuildParamsHashingConfigImpl implements HashingConfig.Interface {\n readonly pepper: string;\n readonly costN: number | null;\n\n constructor(buildParams: BuildParams.Interface) {\n this.pepper = buildParams.get<string>(\"HashingPepper\") ?? \"\";\n const costN = buildParams.get<number | string>(\"HashingCost\");\n this.costN = costN ? Number(costN) : null;\n }\n}\n\nexport const BuildParamsHashingConfig = HashingConfig.createImplementation({\n implementation: BuildParamsHashingConfigImpl,\n dependencies: [BuildParams]\n});\n"],"names":["BuildParamsHashingConfigImpl","buildParams","costN","Number","BuildParamsHashingConfig","HashingConfig","BuildParams"],"mappings":";;AAGA,MAAMA;IAIF,YAAYC,WAAkC,CAAE;QAC5C,IAAI,CAAC,MAAM,GAAGA,YAAY,GAAG,CAAS,oBAAoB;QAC1D,MAAMC,QAAQD,YAAY,GAAG,CAAkB;QAC/C,IAAI,CAAC,KAAK,GAAGC,QAAQC,OAAOD,SAAS;IACzC;AACJ;AAEO,MAAME,2BAA2BC,cAAc,oBAAoB,CAAC;IACvE,gBAAgBL;IAChB,cAAc;QAACM;KAAY;AAC/B"}
@@ -1,9 +1,9 @@
1
1
  import type { IHasher } from "./abstractions.js";
2
- import { BuildParams } from "../buildParams/abstractions.js";
2
+ import { HashingConfig } from "./abstractions.js";
3
3
  export declare class ScryptHasher implements IHasher {
4
4
  private readonly cost;
5
5
  private readonly pepper;
6
- constructor(buildParams: BuildParams.Interface);
6
+ constructor(config: HashingConfig.Interface);
7
7
  hash(value: string): Promise<string>;
8
8
  verify(value: string, storedHash: string): Promise<boolean>;
9
9
  private withPepper;
@@ -1,7 +1,6 @@
1
1
  import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
2
2
  import { createImplementation } from "@webiny/feature/api";
3
- import { Hasher } from "./abstractions.js";
4
- import { BuildParams } from "../buildParams/abstractions.js";
3
+ import { Hasher, HashingConfig } from "./abstractions.js";
5
4
  const ScryptHasher_scrypt = (value, salt, keylen, options)=>new Promise((resolve, reject)=>{
6
5
  scrypt(value, salt, keylen, options, (err, derivedKey)=>{
7
6
  if (err) reject(err);
@@ -17,12 +16,11 @@ const DEFAULT_COST = {
17
16
  p: 1
18
17
  };
19
18
  class ScryptHasher {
20
- constructor(buildParams){
21
- this.pepper = buildParams.get("HashingPepper") ?? "";
22
- const costN = buildParams.get("HashingCost");
23
- this.cost = costN ? {
19
+ constructor(config){
20
+ this.pepper = config.pepper;
21
+ this.cost = config.costN ? {
24
22
  ...DEFAULT_COST,
25
- N: Number(costN)
23
+ N: config.costN
26
24
  } : DEFAULT_COST;
27
25
  }
28
26
  async hash(value) {
@@ -66,7 +64,7 @@ const ScryptHasher_Hasher = createImplementation({
66
64
  abstraction: Hasher,
67
65
  implementation: ScryptHasher,
68
66
  dependencies: [
69
- BuildParams
67
+ HashingConfig
70
68
  ]
71
69
  });
72
70
  export { ScryptHasher, ScryptHasher_Hasher as Hasher };
@@ -1 +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"}
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 { HashingConfig } from \"./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(config: HashingConfig.Interface) {\n this.pepper = config.pepper;\n this.cost = config.costN ? { ...DEFAULT_COST, N: config.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: [HashingConfig]\n});\n"],"names":["scrypt","value","salt","keylen","options","Promise","resolve","reject","scryptCb","err","derivedKey","PREFIX","KEYLEN","SALT_BYTES","DEFAULT_COST","ScryptHasher","config","N","r","p","randomBytes","derived","storedHash","parts","nRaw","rRaw","pRaw","saltB64","hashB64","Number","Buffer","expected","timingSafeEqual","Hasher","createImplementation","HasherAbstraction","HashingConfig"],"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,MAA+B,CAAE;QACzC,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;QAC3B,IAAI,CAAC,IAAI,GAAGA,OAAO,KAAK,GAAG;YAAE,GAAGF,YAAY;YAAE,GAAGE,OAAO,KAAK;QAAC,IAAIF;IACtE;IAEA,MAAM,KAAKb,KAAa,EAAmB;QACvC,MAAM,EAAEgB,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI;QAC7B,MAAMjB,OAAOkB,YAAYP;QACzB,MAAMQ,UAAW,MAAMrB,oBAAO,IAAI,CAAC,UAAU,CAACC,QAAQC,MAAMU,QAAQ;YAAEK;YAAGC;YAAGC;QAAE;QAE9E,OAAO;YAACR;YAAQM;YAAGC;YAAGC;YAAGjB,KAAK,QAAQ,CAAC;YAAWmB,QAAQ,QAAQ,CAAC;SAAU,CAAC,IAAI,CAAC;IACvF;IAEA,MAAM,OAAOpB,KAAa,EAAEqB,UAAkB,EAAoB;QAC9D,MAAMC,QAAQD,WAAW,KAAK,CAAC;QAC/B,IAAIC,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,KAAK,CAAC,EAAE,KAAKZ,QACnC,OAAO;QAGX,MAAM,GAAGa,MAAMC,MAAMC,MAAMC,SAASC,QAAQ,GAAGL;QAC/C,MAAMN,IAAIY,OAAOL;QACjB,MAAMN,IAAIW,OAAOJ;QACjB,MAAMN,IAAIU,OAAOH;QACjB,MAAMxB,OAAO4B,OAAO,IAAI,CAACH,SAAS;QAClC,MAAMI,WAAWD,OAAO,IAAI,CAACF,SAAS;QAEtC,MAAMP,UAAW,MAAMrB,oBAAO,IAAI,CAAC,UAAU,CAACC,QAAQC,MAAM6B,SAAS,MAAM,EAAE;YACzEd;YACAC;YACAC;QACJ;QAGA,OAAOa,gBAAgBX,SAASU;IACpC;IAEQ,WAAW9B,KAAa,EAAU;QACtC,OAAO,IAAI,CAAC,MAAM,GAAG,GAAGA,QAAQ,IAAI,CAAC,MAAM,EAAE,GAAGA;IACpD;AACJ;AAEO,MAAMgC,sBAASC,qBAAqB;IACvC,aAAaC;IACb,gBAAgBpB;IAChB,cAAc;QAACqB;KAAc;AACjC"}
@@ -16,3 +16,18 @@ export declare const Hasher: import("@webiny/di").Abstraction<IHasher>;
16
16
  export declare namespace Hasher {
17
17
  type Interface = IHasher;
18
18
  }
19
+ export interface IHashingConfig {
20
+ /** Server-side secret folded into every hash. Empty when none is configured. */
21
+ readonly pepper: string;
22
+ /** scrypt cost parameter N. `null` uses the default. */
23
+ readonly costN: number | null;
24
+ }
25
+ /**
26
+ * Where `Hasher` gets its pepper and cost. The default reads the `HashingPepper` and `HashingCost`
27
+ * build params (`<Infra.Crypto.Hashing>`). A hosting type can replace it, e.g. to read the pepper
28
+ * from env at startup.
29
+ */
30
+ export declare const HashingConfig: import("@webiny/di").Abstraction<IHashingConfig>;
31
+ export declare namespace HashingConfig {
32
+ type Interface = IHashingConfig;
33
+ }
@@ -1,5 +1,6 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
2
  const Hasher = createAbstraction("Hasher");
3
- export { Hasher };
3
+ const HashingConfig = createAbstraction("HashingConfig");
4
+ export { Hasher, HashingConfig };
4
5
 
5
6
  //# sourceMappingURL=abstractions.js.map
@@ -1 +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"}
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\nexport interface IHashingConfig {\n /** Server-side secret folded into every hash. Empty when none is configured. */\n readonly pepper: string;\n /** scrypt cost parameter N. `null` uses the default. */\n readonly costN: number | null;\n}\n\n/**\n * Where `Hasher` gets its pepper and cost. The default reads the `HashingPepper` and `HashingCost`\n * build params (`<Infra.Crypto.Hashing>`). A hosting type can replace it, e.g. to read the pepper\n * from env at startup.\n */\nexport const HashingConfig = createAbstraction<IHashingConfig>(\"HashingConfig\");\n\nexport namespace HashingConfig {\n export type Interface = IHashingConfig;\n}\n"],"names":["Hasher","createAbstraction","HashingConfig"],"mappings":";AAiBO,MAAMA,SAASC,kBAA2B;AAkB1C,MAAMC,gBAAgBD,kBAAkC"}
@@ -1,8 +1,10 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { Hasher } from "./ScryptHasher.js";
3
+ import { BuildParamsHashingConfig } from "./BuildParamsHashingConfig.js";
3
4
  const HasherFeature = createFeature({
4
5
  name: "HasherFeature",
5
6
  register (container) {
7
+ container.register(BuildParamsHashingConfig);
6
8
  container.register(Hasher);
7
9
  }
8
10
  });
@@ -1 +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"}
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\";\nimport { BuildParamsHashingConfig } from \"./BuildParamsHashingConfig.js\";\n\nexport const HasherFeature = createFeature({\n name: \"HasherFeature\",\n register(container) {\n container.register(BuildParamsHashingConfig);\n container.register(Hasher);\n }\n});\n"],"names":["HasherFeature","createFeature","container","BuildParamsHashingConfig","Hasher"],"mappings":";;;AAIO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
@@ -1,2 +1,3 @@
1
1
  export { Hasher } from "./abstractions.js";
2
+ export { HashingConfig } from "./abstractions.js";
2
3
  export type { IHasher } from "./abstractions.js";
@@ -1 +1 @@
1
- export { Hasher } from "./abstractions.js";
1
+ export { Hasher, HashingConfig } from "./abstractions.js";
@@ -0,0 +1,7 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { HttpClient as HttpClientAbstraction } from "./abstractions.js";
3
+ declare class HttpClientImpl implements HttpClientAbstraction.Interface {
4
+ requestJson(request: HttpClientAbstraction.Request): Promise<Result<unknown, HttpClientAbstraction.Error>>;
5
+ }
6
+ export declare const HttpClient: import("@webiny/di").Implementation<typeof HttpClientImpl>;
7
+ export {};
@@ -0,0 +1,72 @@
1
+ import { Result, createImplementation } from "@webiny/feature/api";
2
+ import { HttpClient } from "./abstractions.js";
3
+ import { HttpRequestError } from "./HttpRequestError.js";
4
+ import { HttpStatusError } from "./HttpStatusError.js";
5
+ const DEFAULT_TIMEOUT_MS = 10000;
6
+ function createRequestInit(request) {
7
+ const timeoutMs = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;
8
+ const headers = new Headers(request.headers);
9
+ const init = {
10
+ method: request.method ?? "GET",
11
+ headers,
12
+ signal: AbortSignal.timeout(timeoutMs)
13
+ };
14
+ if (void 0 !== request.body) {
15
+ if (!headers.has("content-type")) headers.set("content-type", "application/json");
16
+ init.body = JSON.stringify(request.body);
17
+ }
18
+ return init;
19
+ }
20
+ function isTimeout(error) {
21
+ return error instanceof Error && "TimeoutError" === error.name;
22
+ }
23
+ function parseJson(text) {
24
+ if ("" === text) return Result.ok(void 0);
25
+ try {
26
+ const value = JSON.parse(text);
27
+ return Result.ok(value);
28
+ } catch (error) {
29
+ return Result.fail(error);
30
+ }
31
+ }
32
+ class HttpClientImpl {
33
+ async requestJson(request) {
34
+ const { url } = request;
35
+ const init = createRequestInit(request);
36
+ let response;
37
+ let text;
38
+ try {
39
+ response = await fetch(url, init);
40
+ text = await response.text();
41
+ } catch (error) {
42
+ const reason = isTimeout(error) ? "timeout" : "network";
43
+ return Result.fail(new HttpRequestError({
44
+ url,
45
+ reason
46
+ }, error));
47
+ }
48
+ const body = parseJson(text);
49
+ if (!response.ok) {
50
+ const statusError = new HttpStatusError({
51
+ url,
52
+ status: response.status,
53
+ statusText: response.statusText,
54
+ body: body.isOk() ? body.value : void 0
55
+ });
56
+ return Result.fail(statusError);
57
+ }
58
+ if (body.isFail()) return Result.fail(new HttpRequestError({
59
+ url,
60
+ reason: "invalidJson"
61
+ }, body.error));
62
+ return Result.ok(body.value);
63
+ }
64
+ }
65
+ const HttpClient_HttpClient = createImplementation({
66
+ abstraction: HttpClient,
67
+ implementation: HttpClientImpl,
68
+ dependencies: []
69
+ });
70
+ export { HttpClient_HttpClient as HttpClient };
71
+
72
+ //# sourceMappingURL=HttpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/httpClient/HttpClient.js","sources":["../../../src/features/httpClient/HttpClient.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { HttpClient as HttpClientAbstraction } from \"./abstractions.js\";\nimport { HttpRequestError } from \"./HttpRequestError.js\";\nimport { HttpStatusError } from \"./HttpStatusError.js\";\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\n\nfunction createRequestInit(request: HttpClientAbstraction.Request): RequestInit {\n const timeoutMs = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const headers = new Headers(request.headers);\n const init: RequestInit = {\n method: request.method ?? \"GET\",\n headers,\n signal: AbortSignal.timeout(timeoutMs)\n };\n\n if (request.body !== undefined) {\n if (!headers.has(\"content-type\")) {\n headers.set(\"content-type\", \"application/json\");\n }\n init.body = JSON.stringify(request.body);\n }\n\n return init;\n}\n\nfunction isTimeout(error: unknown): boolean {\n return error instanceof Error && error.name === \"TimeoutError\";\n}\n\n// An empty body parses to `undefined`, so a 204 is not an invalid response.\nfunction parseJson(text: string): Result<unknown, unknown> {\n if (text === \"\") {\n return Result.ok(undefined);\n }\n try {\n const value: unknown = JSON.parse(text);\n return Result.ok(value);\n } catch (error) {\n return Result.fail(error);\n }\n}\n\nclass HttpClientImpl implements HttpClientAbstraction.Interface {\n async requestJson(\n request: HttpClientAbstraction.Request\n ): Promise<Result<unknown, HttpClientAbstraction.Error>> {\n const { url } = request;\n const init = createRequestInit(request);\n\n let response: Response;\n let text: string;\n try {\n response = await fetch(url, init);\n text = await response.text();\n } catch (error) {\n const reason = isTimeout(error) ? \"timeout\" : \"network\";\n return Result.fail(new HttpRequestError({ url, reason }, error));\n }\n\n const body = parseJson(text);\n\n if (!response.ok) {\n const statusError = new HttpStatusError({\n url,\n status: response.status,\n statusText: response.statusText,\n body: body.isOk() ? body.value : undefined\n });\n return Result.fail(statusError);\n }\n\n if (body.isFail()) {\n return Result.fail(new HttpRequestError({ url, reason: \"invalidJson\" }, body.error));\n }\n\n return Result.ok(body.value);\n }\n}\n\nexport const HttpClient = createImplementation({\n abstraction: HttpClientAbstraction,\n implementation: HttpClientImpl,\n dependencies: []\n});\n"],"names":["DEFAULT_TIMEOUT_MS","createRequestInit","request","timeoutMs","headers","Headers","init","AbortSignal","undefined","JSON","isTimeout","error","Error","parseJson","text","Result","value","HttpClientImpl","url","response","fetch","reason","HttpRequestError","body","statusError","HttpStatusError","HttpClient","createImplementation","HttpClientAbstraction"],"mappings":";;;;AAMA,MAAMA,qBAAqB;AAE3B,SAASC,kBAAkBC,OAAsC;IAC7D,MAAMC,YAAYD,QAAQ,SAAS,IAAIF;IACvC,MAAMI,UAAU,IAAIC,QAAQH,QAAQ,OAAO;IAC3C,MAAMI,OAAoB;QACtB,QAAQJ,QAAQ,MAAM,IAAI;QAC1BE;QACA,QAAQG,YAAY,OAAO,CAACJ;IAChC;IAEA,IAAID,AAAiBM,WAAjBN,QAAQ,IAAI,EAAgB;QAC5B,IAAI,CAACE,QAAQ,GAAG,CAAC,iBACbA,QAAQ,GAAG,CAAC,gBAAgB;QAEhCE,KAAK,IAAI,GAAGG,KAAK,SAAS,CAACP,QAAQ,IAAI;IAC3C;IAEA,OAAOI;AACX;AAEA,SAASI,UAAUC,KAAc;IAC7B,OAAOA,iBAAiBC,SAASD,AAAe,mBAAfA,MAAM,IAAI;AAC/C;AAGA,SAASE,UAAUC,IAAY;IAC3B,IAAIA,AAAS,OAATA,MACA,OAAOC,OAAO,EAAE,CAACP;IAErB,IAAI;QACA,MAAMQ,QAAiBP,KAAK,KAAK,CAACK;QAClC,OAAOC,OAAO,EAAE,CAACC;IACrB,EAAE,OAAOL,OAAO;QACZ,OAAOI,OAAO,IAAI,CAACJ;IACvB;AACJ;AAEA,MAAMM;IACF,MAAM,YACFf,OAAsC,EACe;QACrD,MAAM,EAAEgB,GAAG,EAAE,GAAGhB;QAChB,MAAMI,OAAOL,kBAAkBC;QAE/B,IAAIiB;QACJ,IAAIL;QACJ,IAAI;YACAK,WAAW,MAAMC,MAAMF,KAAKZ;YAC5BQ,OAAO,MAAMK,SAAS,IAAI;QAC9B,EAAE,OAAOR,OAAO;YACZ,MAAMU,SAASX,UAAUC,SAAS,YAAY;YAC9C,OAAOI,OAAO,IAAI,CAAC,IAAIO,iBAAiB;gBAAEJ;gBAAKG;YAAO,GAAGV;QAC7D;QAEA,MAAMY,OAAOV,UAAUC;QAEvB,IAAI,CAACK,SAAS,EAAE,EAAE;YACd,MAAMK,cAAc,IAAIC,gBAAgB;gBACpCP;gBACA,QAAQC,SAAS,MAAM;gBACvB,YAAYA,SAAS,UAAU;gBAC/B,MAAMI,KAAK,IAAI,KAAKA,KAAK,KAAK,GAAGf;YACrC;YACA,OAAOO,OAAO,IAAI,CAACS;QACvB;QAEA,IAAID,KAAK,MAAM,IACX,OAAOR,OAAO,IAAI,CAAC,IAAIO,iBAAiB;YAAEJ;YAAK,QAAQ;QAAc,GAAGK,KAAK,KAAK;QAGtF,OAAOR,OAAO,EAAE,CAACQ,KAAK,KAAK;IAC/B;AACJ;AAEO,MAAMG,wBAAaC,qBAAqB;IAC3C,aAAaC;IACb,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,10 @@
1
+ import { BaseError } from "@webiny/feature/api";
2
+ export interface HttpRequestErrorData {
3
+ url: string;
4
+ reason: "network" | "timeout" | "invalidJson";
5
+ }
6
+ /** The request didn't produce a usable response: it failed, timed out, or the body wasn't JSON. */
7
+ export declare class HttpRequestError extends BaseError<HttpRequestErrorData> {
8
+ readonly code: "HttpClient/Request";
9
+ constructor(data: HttpRequestErrorData, cause: unknown);
10
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseError } from "@webiny/feature/api";
2
+ class HttpRequestError extends BaseError {
3
+ constructor(data, cause){
4
+ super({
5
+ message: `Request to "${data.url}" failed (${data.reason}).`,
6
+ data
7
+ }), this.code = "HttpClient/Request";
8
+ this.cause = cause;
9
+ }
10
+ }
11
+ export { HttpRequestError };
12
+
13
+ //# sourceMappingURL=HttpRequestError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/httpClient/HttpRequestError.js","sources":["../../../src/features/httpClient/HttpRequestError.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\nexport interface HttpRequestErrorData {\n url: string;\n reason: \"network\" | \"timeout\" | \"invalidJson\";\n}\n\n/** The request didn't produce a usable response: it failed, timed out, or the body wasn't JSON. */\nexport class HttpRequestError extends BaseError<HttpRequestErrorData> {\n override readonly code = \"HttpClient/Request\" as const;\n\n constructor(data: HttpRequestErrorData, cause: unknown) {\n super({\n message: `Request to \"${data.url}\" failed (${data.reason}).`,\n data\n });\n this.cause = cause;\n }\n}\n"],"names":["HttpRequestError","BaseError","data","cause"],"mappings":";AAQO,MAAMA,yBAAyBC;IAGlC,YAAYC,IAA0B,EAAEC,KAAc,CAAE;QACpD,KAAK,CAAC;YACF,SAAS,CAAC,YAAY,EAAED,KAAK,GAAG,CAAC,UAAU,EAAEA,KAAK,MAAM,CAAC,EAAE,CAAC;YAC5DA;QACJ,SANc,IAAI,GAAG;QAOrB,IAAI,CAAC,KAAK,GAAGC;IACjB;AACJ"}
@@ -0,0 +1,12 @@
1
+ import { BaseError } from "@webiny/feature/api";
2
+ export interface HttpStatusErrorData {
3
+ url: string;
4
+ status: number;
5
+ statusText: string;
6
+ body: unknown;
7
+ }
8
+ /** The server answered with a non-2xx status. */
9
+ export declare class HttpStatusError extends BaseError<HttpStatusErrorData> {
10
+ readonly code: "HttpClient/Status";
11
+ constructor(data: HttpStatusErrorData);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseError } from "@webiny/feature/api";
2
+ class HttpStatusError extends BaseError {
3
+ constructor(data){
4
+ super({
5
+ message: `Request to "${data.url}" failed with status ${data.status}.`,
6
+ data
7
+ }), this.code = "HttpClient/Status";
8
+ }
9
+ }
10
+ export { HttpStatusError };
11
+
12
+ //# sourceMappingURL=HttpStatusError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/httpClient/HttpStatusError.js","sources":["../../../src/features/httpClient/HttpStatusError.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\nexport interface HttpStatusErrorData {\n url: string;\n status: number;\n statusText: string;\n body: unknown; // the parsed JSON body, or `undefined` when there was none\n}\n\n/** The server answered with a non-2xx status. */\nexport class HttpStatusError extends BaseError<HttpStatusErrorData> {\n override readonly code = \"HttpClient/Status\" as const;\n\n constructor(data: HttpStatusErrorData) {\n super({\n message: `Request to \"${data.url}\" failed with status ${data.status}.`,\n data\n });\n }\n}\n"],"names":["HttpStatusError","BaseError","data"],"mappings":";AAUO,MAAMA,wBAAwBC;IAGjC,YAAYC,IAAyB,CAAE;QACnC,KAAK,CAAC;YACF,SAAS,CAAC,YAAY,EAAEA,KAAK,GAAG,CAAC,qBAAqB,EAAEA,KAAK,MAAM,CAAC,CAAC,CAAC;YACtEA;QACJ,SANc,IAAI,GAAG;IAOzB;AACJ"}
@@ -0,0 +1,32 @@
1
+ import type { Result } from "@webiny/feature/api";
2
+ import type { HttpRequestError } from "./HttpRequestError.js";
3
+ import type { HttpStatusError } from "./HttpStatusError.js";
4
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
+ export interface IHttpClientRequest {
6
+ url: string;
7
+ method?: HttpMethod;
8
+ headers?: Record<string, string>;
9
+ body?: unknown;
10
+ timeoutMs?: number;
11
+ }
12
+ export interface IHttpClientErrors {
13
+ request: HttpRequestError;
14
+ status: HttpStatusError;
15
+ }
16
+ type HttpClientError = IHttpClientErrors[keyof IHttpClientErrors];
17
+ export interface IHttpClient {
18
+ /**
19
+ * Sends a request and parses the response body as JSON. The body is `unknown` on purpose:
20
+ * validate it before use.
21
+ */
22
+ requestJson(request: IHttpClientRequest): Promise<Result<unknown, HttpClientError>>;
23
+ }
24
+ /** Outbound HTTP requests with a timeout, a status check and JSON parsing. */
25
+ export declare const HttpClient: import("@webiny/di").Abstraction<IHttpClient>;
26
+ export declare namespace HttpClient {
27
+ type Interface = IHttpClient;
28
+ type Request = IHttpClientRequest;
29
+ type Method = HttpMethod;
30
+ type Error = HttpClientError;
31
+ }
32
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const HttpClient = createAbstraction("HttpClient");
3
+ export { HttpClient };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/httpClient/abstractions.js","sources":["../../../src/features/httpClient/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { HttpRequestError } from \"./HttpRequestError.js\";\nimport type { HttpStatusError } from \"./HttpStatusError.js\";\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\nexport interface IHttpClientRequest {\n url: string;\n method?: HttpMethod; // defaults to \"GET\"\n headers?: Record<string, string>;\n body?: unknown; // sent as JSON\n timeoutMs?: number; // defaults to 10 seconds\n}\n\nexport interface IHttpClientErrors {\n request: HttpRequestError;\n status: HttpStatusError;\n}\n\ntype HttpClientError = IHttpClientErrors[keyof IHttpClientErrors];\n\nexport interface IHttpClient {\n /**\n * Sends a request and parses the response body as JSON. The body is `unknown` on purpose:\n * validate it before use.\n */\n requestJson(request: IHttpClientRequest): Promise<Result<unknown, HttpClientError>>;\n}\n\n/** Outbound HTTP requests with a timeout, a status check and JSON parsing. */\nexport const HttpClient = createAbstraction<IHttpClient>(\"HttpClient\");\n\nexport namespace HttpClient {\n export type Interface = IHttpClient;\n export type Request = IHttpClientRequest;\n export type Method = HttpMethod;\n export type Error = HttpClientError;\n}\n"],"names":["HttpClient","createAbstraction"],"mappings":";AA+BO,MAAMA,aAAaC,kBAA+B"}
@@ -1,4 +1,4 @@
1
- export declare const LoggerFeature: {
1
+ export declare const HttpClientFeature: {
2
2
  name: string;
3
3
  register(container: import("@webiny/di").Container): void;
4
4
  };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { HttpClient } from "./HttpClient.js";
3
+ const HttpClientFeature = createFeature({
4
+ name: "HttpClientFeature",
5
+ register (container) {
6
+ container.register(HttpClient).inSingletonScope();
7
+ }
8
+ });
9
+ export { HttpClientFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/httpClient/feature.js","sources":["../../../src/features/httpClient/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { HttpClient } from \"./HttpClient.js\";\n\nexport const HttpClientFeature = createFeature({\n name: \"HttpClientFeature\",\n register(container) {\n container.register(HttpClient).inSingletonScope();\n }\n});\n"],"names":["HttpClientFeature","createFeature","container","HttpClient"],"mappings":";;AAGO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,YAAY,gBAAgB;IACnD;AACJ"}
@@ -0,0 +1,3 @@
1
+ export { HttpClient } from "./abstractions.js";
2
+ export { HttpRequestError } from "./HttpRequestError.js";
3
+ export { HttpStatusError } from "./HttpStatusError.js";
@@ -0,0 +1,3 @@
1
+ export { HttpClient } from "./abstractions.js";
2
+ export { HttpRequestError } from "./HttpRequestError.js";
3
+ export { HttpStatusError } from "./HttpStatusError.js";
@@ -1,12 +1,18 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { KeyValueStoreRepository, GlobalKeyValueStore as ServiceAbstraction, IGlobalKeyValueStoreOptions } from "./abstractions.js";
2
+ import { KeyValueStoreRepository } from "./abstractions.js";
3
+ import { GlobalKeyValueStore as ServiceAbstraction } from "./abstractions.js";
4
+ import type { IGlobalKeyValueStoreOptions } from "./abstractions.js";
5
+ import type { IGlobalKeyValueSetOptions } from "./abstractions.js";
6
+ import type { IGlobalKeyValueListParams } from "./abstractions.js";
7
+ import type { IGlobalKeyValueDeleteOptions } from "./abstractions.js";
3
8
  declare class GlobalKeyValueStoreImpl implements ServiceAbstraction.Interface {
4
9
  private repository;
5
10
  constructor(repository: KeyValueStoreRepository.Interface);
6
11
  private getScope;
7
12
  get<T = unknown>(key: string, options?: IGlobalKeyValueStoreOptions): Promise<Result<T, ServiceAbstraction.Error>>;
8
- set(key: string, value: any, options?: IGlobalKeyValueStoreOptions): Promise<Result<void, ServiceAbstraction.Error>>;
9
- delete(key: string, options?: IGlobalKeyValueStoreOptions): Promise<Result<void, ServiceAbstraction.Error>>;
13
+ set(key: string, value: any, options?: IGlobalKeyValueSetOptions): Promise<Result<void, ServiceAbstraction.Error>>;
14
+ delete(key: string, options?: IGlobalKeyValueDeleteOptions): Promise<Result<void, ServiceAbstraction.Error>>;
15
+ list<T = unknown>(params: IGlobalKeyValueListParams): Promise<Result<ServiceAbstraction.ListResult<T>, ServiceAbstraction.Error>>;
10
16
  }
11
17
  export declare const GlobalKeyValueStore: import("@webiny/di").Implementation<typeof GlobalKeyValueStoreImpl>;
12
18
  export {};
@@ -15,12 +15,22 @@ class GlobalKeyValueStoreImpl {
15
15
  async set(key, value, options) {
16
16
  const scope = this.getScope(options);
17
17
  return this.repository.set(key, value, scope, {
18
- expiresAt: options?.expiresAt
18
+ expiresAt: options?.expiresAt,
19
+ collection: options?.collection,
20
+ condition: options?.condition
19
21
  });
20
22
  }
21
23
  async delete(key, options) {
22
24
  const scope = this.getScope(options);
23
- return this.repository.delete(key, scope);
25
+ return this.repository.delete(key, scope, {
26
+ condition: options?.condition
27
+ });
28
+ }
29
+ async list(params) {
30
+ const { scope, ...listParams } = params;
31
+ return this.repository.list(this.getScope({
32
+ scope
33
+ }), listParams);
24
34
  }
25
35
  }
26
36
  const GlobalKeyValueStore_GlobalKeyValueStore = createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"features/keyValueStore/GlobalKeyValueStore.js","sources":["../../../src/features/keyValueStore/GlobalKeyValueStore.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n KeyValueStoreRepository,\n GlobalKeyValueStore as ServiceAbstraction,\n IGlobalKeyValueStoreOptions\n} from \"./abstractions.js\";\n\nconst DEFAULT_SCOPE = \"global\";\n\nclass GlobalKeyValueStoreImpl implements ServiceAbstraction.Interface {\n constructor(private repository: KeyValueStoreRepository.Interface) {}\n\n private getScope(options?: IGlobalKeyValueStoreOptions): string {\n return options?.scope || DEFAULT_SCOPE;\n }\n\n async get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.get<T>(key, scope);\n }\n\n async set(\n key: string,\n value: any,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.set(key, value, scope, {\n expiresAt: options?.expiresAt\n });\n }\n\n async delete(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.delete(key, scope);\n }\n}\n\nexport const GlobalKeyValueStore = createImplementation({\n abstraction: ServiceAbstraction,\n implementation: GlobalKeyValueStoreImpl,\n dependencies: [KeyValueStoreRepository]\n});\n"],"names":["DEFAULT_SCOPE","GlobalKeyValueStoreImpl","repository","options","key","scope","value","GlobalKeyValueStore","createImplementation","ServiceAbstraction","KeyValueStoreRepository"],"mappings":";;AAQA,MAAMA,gBAAgB;AAEtB,MAAMC;IACF,YAAoBC,UAA6C,CAAE;aAA/CA,UAAU,GAAVA;IAAgD;IAE5D,SAASC,OAAqC,EAAU;QAC5D,OAAOA,SAAS,SAASH;IAC7B;IAEA,MAAM,IACFI,GAAW,EACXD,OAAqC,EACO;QAC5C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAIC,KAAKC;IACvC;IAEA,MAAM,IACFD,GAAW,EACXE,KAAU,EACVH,OAAqC,EACU;QAC/C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAACC,KAAKE,OAAOD,OAAO;YAC1C,WAAWF,SAAS;QACxB;IACJ;IAEA,MAAM,OACFC,GAAW,EACXD,OAAqC,EACU;QAC/C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAACC,KAAKC;IACvC;AACJ;AAEO,MAAME,0CAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;KAAwB;AAC3C"}
1
+ {"version":3,"file":"features/keyValueStore/GlobalKeyValueStore.js","sources":["../../../src/features/keyValueStore/GlobalKeyValueStore.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport { KeyValueStoreRepository } from \"./abstractions.js\";\nimport { GlobalKeyValueStore as ServiceAbstraction } from \"./abstractions.js\";\nimport type { IGlobalKeyValueStoreOptions } from \"./abstractions.js\";\nimport type { IGlobalKeyValueSetOptions } from \"./abstractions.js\";\nimport type { IGlobalKeyValueListParams } from \"./abstractions.js\";\nimport type { IGlobalKeyValueDeleteOptions } from \"./abstractions.js\";\n\nconst DEFAULT_SCOPE = \"global\";\n\nclass GlobalKeyValueStoreImpl implements ServiceAbstraction.Interface {\n constructor(private repository: KeyValueStoreRepository.Interface) {}\n\n private getScope(options?: { scope?: string }): string {\n return options?.scope || DEFAULT_SCOPE;\n }\n\n async get<T = unknown>(\n key: string,\n options?: IGlobalKeyValueStoreOptions\n ): Promise<Result<T, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.get<T>(key, scope);\n }\n\n async set(\n key: string,\n value: any,\n options?: IGlobalKeyValueSetOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.set(key, value, scope, {\n expiresAt: options?.expiresAt,\n collection: options?.collection,\n condition: options?.condition\n });\n }\n\n async delete(\n key: string,\n options?: IGlobalKeyValueDeleteOptions\n ): Promise<Result<void, ServiceAbstraction.Error>> {\n const scope = this.getScope(options);\n return this.repository.delete(key, scope, { condition: options?.condition });\n }\n\n async list<T = unknown>(\n params: IGlobalKeyValueListParams\n ): Promise<Result<ServiceAbstraction.ListResult<T>, ServiceAbstraction.Error>> {\n const { scope, ...listParams } = params;\n return this.repository.list<T>(this.getScope({ scope }), listParams);\n }\n}\n\nexport const GlobalKeyValueStore = createImplementation({\n abstraction: ServiceAbstraction,\n implementation: GlobalKeyValueStoreImpl,\n dependencies: [KeyValueStoreRepository]\n});\n"],"names":["DEFAULT_SCOPE","GlobalKeyValueStoreImpl","repository","options","key","scope","value","params","listParams","GlobalKeyValueStore","createImplementation","ServiceAbstraction","KeyValueStoreRepository"],"mappings":";;AASA,MAAMA,gBAAgB;AAEtB,MAAMC;IACF,YAAoBC,UAA6C,CAAE;aAA/CA,UAAU,GAAVA;IAAgD;IAE5D,SAASC,OAA4B,EAAU;QACnD,OAAOA,SAAS,SAASH;IAC7B;IAEA,MAAM,IACFI,GAAW,EACXD,OAAqC,EACO;QAC5C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAIC,KAAKC;IACvC;IAEA,MAAM,IACFD,GAAW,EACXE,KAAU,EACVH,OAAmC,EACY;QAC/C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAACC,KAAKE,OAAOD,OAAO;YAC1C,WAAWF,SAAS;YACpB,YAAYA,SAAS;YACrB,WAAWA,SAAS;QACxB;IACJ;IAEA,MAAM,OACFC,GAAW,EACXD,OAAsC,EACS;QAC/C,MAAME,QAAQ,IAAI,CAAC,QAAQ,CAACF;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAACC,KAAKC,OAAO;YAAE,WAAWF,SAAS;QAAU;IAC9E;IAEA,MAAM,KACFI,MAAiC,EAC0C;QAC3E,MAAM,EAAEF,KAAK,EAAE,GAAGG,YAAY,GAAGD;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAI,IAAI,CAAC,QAAQ,CAAC;YAAEF;QAAM,IAAIG;IAC7D;AACJ;AAEO,MAAMC,0CAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBV;IAChB,cAAc;QAACW;KAAwB;AAC3C"}
@@ -1,14 +1,18 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { KeyValueStore as ServiceAbstraction } from "./abstractions.js";
3
3
  import { GlobalKeyValueStore } from "./abstractions.js";
4
+ import type { IKeyValueSetOptions } from "./abstractions.js";
5
+ import type { IKeyValueDeleteOptions } from "./abstractions.js";
6
+ import type { IKeyValueListParams } from "./abstractions.js";
4
7
  import { TenantContext } from "../../features/tenancy/TenantContext/index.js";
5
8
  declare class KeyValueStoreImpl implements ServiceAbstraction.Interface {
6
9
  private tenantContext;
7
10
  private globalStore;
8
11
  constructor(tenantContext: TenantContext.Interface, globalStore: GlobalKeyValueStore.Interface);
9
12
  get<T = unknown>(key: string): Promise<Result<T, ServiceAbstraction.Error>>;
10
- set(key: string, value: any): Promise<Result<void, ServiceAbstraction.Error>>;
11
- delete(key: string): Promise<Result<void, ServiceAbstraction.Error>>;
13
+ set(key: string, value: any, options?: IKeyValueSetOptions): Promise<Result<void, ServiceAbstraction.Error>>;
14
+ delete(key: string, options?: IKeyValueDeleteOptions): Promise<Result<void, ServiceAbstraction.Error>>;
15
+ list<T = unknown>(params: IKeyValueListParams): Promise<Result<ServiceAbstraction.ListResult<T>, ServiceAbstraction.Error>>;
12
16
  }
13
17
  export declare const KeyValueStore: typeof KeyValueStoreImpl & {
14
18
  __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IKeyValueStore>;
@@ -11,15 +11,25 @@ class KeyValueStoreImpl {
11
11
  scope: tenant.id
12
12
  });
13
13
  }
14
- async set(key, value) {
14
+ async set(key, value, options) {
15
15
  const tenant = this.tenantContext.getTenant();
16
16
  return this.globalStore.set(key, value, {
17
- scope: tenant.id
17
+ scope: tenant.id,
18
+ collection: options?.collection,
19
+ condition: options?.condition
18
20
  });
19
21
  }
20
- async delete(key) {
22
+ async delete(key, options) {
21
23
  const tenant = this.tenantContext.getTenant();
22
24
  return this.globalStore.delete(key, {
25
+ scope: tenant.id,
26
+ condition: options?.condition
27
+ });
28
+ }
29
+ async list(params) {
30
+ const tenant = this.tenantContext.getTenant();
31
+ return this.globalStore.list({
32
+ ...params,
23
33
  scope: tenant.id
24
34
  });
25
35
  }