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

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 (198) hide show
  1. package/ApiCoreFeature.d.ts +2 -2
  2. package/ApiCoreFeature.js +23 -5
  3. package/ApiCoreFeature.js.map +1 -1
  4. package/exports/api.d.ts +2 -1
  5. package/exports/api.js +2 -1
  6. package/features/ai/feature.js +4 -0
  7. package/features/ai/feature.js.map +1 -1
  8. package/features/ai/index.d.ts +2 -0
  9. package/features/ai/index.js +1 -0
  10. package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
  11. package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
  12. package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
  13. package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
  14. package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
  15. package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
  16. package/features/ai/toolPipeline/abstractions.d.ts +23 -0
  17. package/features/ai/toolPipeline/abstractions.js +7 -0
  18. package/features/ai/toolPipeline/abstractions.js.map +1 -0
  19. package/features/ai/toolPipeline/index.d.ts +2 -0
  20. package/features/ai/toolPipeline/index.js +1 -0
  21. package/features/hashing/ScryptHasher.d.ts +11 -0
  22. package/features/hashing/ScryptHasher.js +74 -0
  23. package/features/hashing/ScryptHasher.js.map +1 -0
  24. package/features/hashing/abstractions.d.ts +18 -0
  25. package/features/hashing/abstractions.js +5 -0
  26. package/features/hashing/abstractions.js.map +1 -0
  27. package/features/hashing/feature.d.ts +4 -0
  28. package/features/hashing/feature.js +11 -0
  29. package/features/hashing/feature.js.map +1 -0
  30. package/features/hashing/index.d.ts +2 -0
  31. package/features/hashing/index.js +1 -0
  32. package/features/requestContext/RawAuthToken.d.ts +14 -0
  33. package/features/requestContext/RawAuthToken.js +19 -0
  34. package/features/requestContext/RawAuthToken.js.map +1 -0
  35. package/features/requestContext/RawTenantId.d.ts +14 -0
  36. package/features/requestContext/RawTenantId.js +19 -0
  37. package/features/requestContext/RawTenantId.js.map +1 -0
  38. package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
  39. package/features/requestContext/RequestIdentityLoader.js +26 -0
  40. package/features/requestContext/RequestIdentityLoader.js.map +1 -0
  41. package/features/requestContext/RequestTenantLoader.d.ts +18 -0
  42. package/features/requestContext/RequestTenantLoader.js +52 -0
  43. package/features/requestContext/RequestTenantLoader.js.map +1 -0
  44. package/features/requestContext/abstractions.d.ts +53 -0
  45. package/features/requestContext/abstractions.js +8 -0
  46. package/features/requestContext/abstractions.js.map +1 -0
  47. package/features/requestContext/feature.d.ts +11 -0
  48. package/features/requestContext/feature.js +17 -0
  49. package/features/requestContext/feature.js.map +1 -0
  50. package/features/requestContext/index.d.ts +2 -0
  51. package/features/requestContext/index.js +2 -0
  52. package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
  53. package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
  54. package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
  55. package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
  56. package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
  57. package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
  58. package/features/security/apiKeys/feature.js +4 -0
  59. package/features/security/apiKeys/feature.js.map +1 -1
  60. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +1 -1
  61. package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
  62. package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
  63. package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
  64. package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
  65. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
  66. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
  67. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
  68. package/features/serviceDiscovery/index.d.ts +3 -0
  69. package/features/serviceDiscovery/index.js +1 -0
  70. package/features/storageOperations/abstractions.d.ts +21 -0
  71. package/features/storageOperations/abstractions.js +10 -0
  72. package/features/storageOperations/abstractions.js.map +1 -0
  73. package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
  74. package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
  75. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
  76. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
  77. package/features/wcp/WcpContext/WcpContext.d.ts +4 -5
  78. package/features/wcp/WcpContext/WcpContext.js +5 -2
  79. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  80. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +8 -8
  81. package/features/wcp/WcpContext/feature.d.ts +1 -2
  82. package/features/wcp/WcpContext/feature.js +2 -2
  83. package/features/wcp/WcpContext/feature.js.map +1 -1
  84. package/features/wcp/WcpContext/index.d.ts +0 -1
  85. package/features/wcp/WcpContext/types.d.ts +0 -4
  86. package/features/wcp/WcpFeature.d.ts +1 -1
  87. package/features/wcp/WcpFeature.js +5 -2
  88. package/features/wcp/WcpFeature.js.map +1 -1
  89. package/features/wcp/WcpLicenseProvider.d.ts +29 -0
  90. package/features/wcp/WcpLicenseProvider.js +18 -0
  91. package/features/wcp/WcpLicenseProvider.js.map +1 -0
  92. package/features/wcp/loadWcpLicense.d.ts +2 -0
  93. package/{legacy/wcp/context.js → features/wcp/loadWcpLicense.js} +24 -19
  94. package/features/wcp/loadWcpLicense.js.map +1 -0
  95. package/graphql/ApiCoreSchemaFactory.d.ts +15 -0
  96. package/graphql/ApiCoreSchemaFactory.js +52 -0
  97. package/graphql/ApiCoreSchemaFactory.js.map +1 -0
  98. package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
  99. package/graphql/security/NotAuthorizedResponse.js +1 -1
  100. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  101. package/graphql/security/SecuritySchemaFactory.d.ts +14 -0
  102. package/graphql/security/SecuritySchemaFactory.js +23 -0
  103. package/graphql/security/SecuritySchemaFactory.js.map +1 -0
  104. package/graphql/security/addApiKeySchema.d.ts +2 -0
  105. package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
  106. package/graphql/security/addApiKeySchema.js.map +1 -0
  107. package/graphql/security/addIdentitySchema.d.ts +2 -0
  108. package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
  109. package/graphql/security/addIdentitySchema.js.map +1 -0
  110. package/graphql/security/addRoleSchema.d.ts +2 -0
  111. package/graphql/security/addRoleSchema.js +137 -0
  112. package/graphql/security/addRoleSchema.js.map +1 -0
  113. package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
  114. package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
  115. package/graphql/security/addSecurityBaseSchema.js.map +1 -0
  116. package/graphql/security/addTeamSchema.d.ts +2 -0
  117. package/graphql/security/addTeamSchema.js +157 -0
  118. package/graphql/security/addTeamSchema.js.map +1 -0
  119. package/graphql/system/SystemSchemaFactory.d.ts +9 -0
  120. package/graphql/system/SystemSchemaFactory.js +66 -0
  121. package/graphql/system/SystemSchemaFactory.js.map +1 -0
  122. package/graphql/users/UsersSchemaFactory.d.ts +9 -0
  123. package/graphql/users/UsersSchemaFactory.js +191 -0
  124. package/graphql/users/UsersSchemaFactory.js.map +1 -0
  125. package/graphql/wcp/WcpSchemaFactory.d.ts +9 -0
  126. package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +26 -18
  127. package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
  128. package/index.d.ts +3 -1
  129. package/index.js +3 -1
  130. package/package.json +19 -22
  131. package/types/core.d.ts +17 -5
  132. package/types/security.d.ts +0 -6
  133. package/types/tenancy.d.ts +0 -17
  134. package/types/users.d.ts +0 -13
  135. package/createApiCore.d.ts +0 -7
  136. package/createApiCore.js +0 -22
  137. package/createApiCore.js.map +0 -1
  138. package/graphql/security/apiKey.gql.d.ts +0 -4
  139. package/graphql/security/apiKey.gql.js.map +0 -1
  140. package/graphql/security/base.gql.d.ts +0 -4
  141. package/graphql/security/base.gql.js.map +0 -1
  142. package/graphql/security/identity.gql.d.ts +0 -4
  143. package/graphql/security/identity.gql.js.map +0 -1
  144. package/graphql/security/index.d.ts +0 -1
  145. package/graphql/security/index.js +0 -15
  146. package/graphql/security/index.js.map +0 -1
  147. package/graphql/security/role.gql.d.ts +0 -4
  148. package/graphql/security/role.gql.js +0 -106
  149. package/graphql/security/role.gql.js.map +0 -1
  150. package/graphql/security/team.gql.d.ts +0 -4
  151. package/graphql/security/team.gql.js +0 -119
  152. package/graphql/security/team.gql.js.map +0 -1
  153. package/graphql/system/createSystemGraphQL.d.ts +0 -2
  154. package/graphql/system/createSystemGraphQL.js +0 -54
  155. package/graphql/system/createSystemGraphQL.js.map +0 -1
  156. package/graphql/users/user.gql.d.ts +0 -3
  157. package/graphql/users/user.gql.js +0 -167
  158. package/graphql/users/user.gql.js.map +0 -1
  159. package/graphql/wcp/graphql.d.ts +0 -2
  160. package/graphql/wcp/graphql.js.map +0 -1
  161. package/legacy/security/LegacyContext.d.ts +0 -36
  162. package/legacy/security/LegacyContext.js +0 -152
  163. package/legacy/security/LegacyContext.js.map +0 -1
  164. package/legacy/security/createSecurityContext.d.ts +0 -3
  165. package/legacy/security/createSecurityContext.js +0 -10
  166. package/legacy/security/createSecurityContext.js.map +0 -1
  167. package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
  168. package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
  169. package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
  170. package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
  171. package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
  172. package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
  173. package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
  174. package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
  175. package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
  176. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
  177. package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
  178. package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
  179. package/legacy/security/plugins/secureHeaders.d.ts +0 -1
  180. package/legacy/security/plugins/secureHeaders.js +0 -30
  181. package/legacy/security/plugins/secureHeaders.js.map +0 -1
  182. package/legacy/tenancy/LegacyContext.d.ts +0 -15
  183. package/legacy/tenancy/LegacyContext.js +0 -57
  184. package/legacy/tenancy/LegacyContext.js.map +0 -1
  185. package/legacy/tenancy/createTenancyContext.d.ts +0 -3
  186. package/legacy/tenancy/createTenancyContext.js +0 -31
  187. package/legacy/tenancy/createTenancyContext.js.map +0 -1
  188. package/legacy/users/LegacyContext.d.ts +0 -13
  189. package/legacy/users/LegacyContext.js +0 -55
  190. package/legacy/users/LegacyContext.js.map +0 -1
  191. package/legacy/users/createAdminUsersContext.d.ts +0 -3
  192. package/legacy/users/createAdminUsersContext.js +0 -12
  193. package/legacy/users/createAdminUsersContext.js.map +0 -1
  194. package/legacy/wcp/LegacyWcpContext.d.ts +0 -33
  195. package/legacy/wcp/LegacyWcpContext.js +0 -84
  196. package/legacy/wcp/LegacyWcpContext.js.map +0 -1
  197. package/legacy/wcp/context.d.ts +0 -5
  198. package/legacy/wcp/context.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Container } from "@webiny/di";
2
- import type { ApiCoreStorageOperations } from "./types/core.js";
2
+ import type { ApiCoreConfig } from "./types/core.js";
3
3
  export declare const ApiCoreFeature: {
4
4
  name: string;
5
- register(container: Container, context: ApiCoreStorageOperations): void;
5
+ register(container: Container, context?: ApiCoreConfig | undefined): void;
6
6
  };
package/ApiCoreFeature.js CHANGED
@@ -5,33 +5,51 @@ import { SecurityFeature } from "./features/security/SecurityFeature.js";
5
5
  import { SystemFeature } from "./features/system/SystemFeature.js";
6
6
  import { TenancyFeature } from "./features/tenancy/TenancyFeature.js";
7
7
  import { AdminUsersFeature } from "./features/users/AdminUsersFeature.js";
8
+ import { ApiCoreStorageOperationsFactory } from "./features/storageOperations/abstractions.js";
8
9
  import { IdpAuthenticatorFeature } from "./idp/feature.js";
9
10
  import { KeyValueStoreFeature } from "./features/keyValueStore/feature.js";
10
11
  import { BuildParamsFeature } from "./features/buildParams/feature.js";
11
12
  import { EncryptionFeature } from "./features/encryption/feature.js";
13
+ import { HasherFeature } from "./features/hashing/feature.js";
12
14
  import { FeatureFlagsFeature } from "./features/featureFlags/feature.js";
13
15
  import { MaskerFeature } from "./features/masker/feature.js";
14
16
  import { AiFeature } from "./features/ai/feature.js";
17
+ import { WcpFeature } from "./features/wcp/WcpFeature.js";
15
18
  import { NullWebhookDispatcher } from "./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js";
16
19
  import { WebhookProviderFeature } from "./features/webhooks/index.js";
20
+ import { RequestContextFeature } from "./features/requestContext/index.js";
21
+ import { ApiCoreSchemaFactory } from "./graphql/ApiCoreSchemaFactory.js";
22
+ import { SecuritySchemaFactory } from "./graphql/security/SecuritySchemaFactory.js";
23
+ import { UsersSchemaFactory } from "./graphql/users/UsersSchemaFactory.js";
24
+ import { SystemSchemaFactory } from "./graphql/system/SystemSchemaFactory.js";
25
+ import { WcpSchemaFactory } from "./graphql/wcp/WcpSchemaFactory.js";
17
26
  const ApiCoreFeature = createFeature({
18
27
  name: "ApiCore",
19
- register (container, config) {
28
+ register (container, config = {}) {
29
+ const storageOperations = container.resolve(ApiCoreStorageOperationsFactory).create();
30
+ WcpFeature.register(container, config.wcpLicense);
20
31
  MaskerFeature.register(container);
21
32
  AiFeature.register(container);
22
33
  LoggerFeature.register(container);
23
34
  EventPublisherFeature.register(container);
24
35
  BuildParamsFeature.register(container);
25
36
  EncryptionFeature.register(container);
37
+ HasherFeature.register(container);
26
38
  FeatureFlagsFeature.register(container);
27
- TenancyFeature.register(container, config.tenancyStorageOperations);
28
- SecurityFeature.register(container, config.securityStorageOperations);
29
- AdminUsersFeature.register(container, config.usersStorageOperations);
30
- KeyValueStoreFeature.register(container, config.keyValueStorageOperations);
39
+ TenancyFeature.register(container, storageOperations.tenancyStorageOperations);
40
+ SecurityFeature.register(container, storageOperations.securityStorageOperations);
41
+ AdminUsersFeature.register(container, storageOperations.usersStorageOperations);
42
+ KeyValueStoreFeature.register(container, storageOperations.keyValueStorageOperations);
31
43
  SystemFeature.register(container);
32
44
  IdpAuthenticatorFeature.register(container);
45
+ RequestContextFeature.register(container);
33
46
  container.register(NullWebhookDispatcher).inSingletonScope();
34
47
  WebhookProviderFeature.register(container);
48
+ container.register(ApiCoreSchemaFactory);
49
+ container.register(SecuritySchemaFactory);
50
+ container.register(UsersSchemaFactory);
51
+ container.register(SystemSchemaFactory);
52
+ container.register(WcpSchemaFactory);
35
53
  }
36
54
  });
37
55
  export { ApiCoreFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { LoggerFeature } from \"~/features/logger/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { WebhookProviderFeature } from \"~/features/webhooks/index.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreStorageOperations) {\n // Register features\n MaskerFeature.register(container);\n AiFeature.register(container);\n LoggerFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n EncryptionFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, config.tenancyStorageOperations);\n SecurityFeature.register(container, config.securityStorageOperations);\n AdminUsersFeature.register(container, config.usersStorageOperations);\n KeyValueStoreFeature.register(container, config.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n container.register(NullWebhookDispatcher).inSingletonScope();\n WebhookProviderFeature.register(container);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","MaskerFeature","AiFeature","LoggerFeature","EventPublisherFeature","BuildParamsFeature","EncryptionFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","NullWebhookDispatcher","WebhookProviderFeature"],"mappings":";;;;;;;;;;;;;;;;AAmBO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAoB,EAAEC,MAAgC;QAE3DC,cAAc,QAAQ,CAACF;QACvBG,UAAU,QAAQ,CAACH;QACnBI,cAAc,QAAQ,CAACJ;QACvBK,sBAAsB,QAAQ,CAACL;QAC/BM,mBAAmB,QAAQ,CAACN;QAC5BO,kBAAkB,QAAQ,CAACP;QAC3BQ,oBAAoB,QAAQ,CAACR;QAC7BS,eAAe,QAAQ,CAACT,WAAWC,OAAO,wBAAwB;QAClES,gBAAgB,QAAQ,CAACV,WAAWC,OAAO,yBAAyB;QACpEU,kBAAkB,QAAQ,CAACX,WAAWC,OAAO,sBAAsB;QACnEW,qBAAqB,QAAQ,CAACZ,WAAWC,OAAO,yBAAyB;QACzEY,cAAc,QAAQ,CAACb;QACvBc,wBAAwB,QAAQ,CAACd;QACjCA,UAAU,QAAQ,CAACe,uBAAuB,gBAAgB;QAC1DC,uBAAuB,QAAQ,CAAChB;IACpC;AACJ"}
1
+ {"version":3,"file":"ApiCoreFeature.js","sources":["../src/ApiCoreFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisherFeature } from \"~/features/eventPublisher/feature.js\";\nimport { LoggerFeature } from \"~/features/logger/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { SystemFeature } from \"~/features/system/SystemFeature.js\";\nimport { TenancyFeature } from \"./features/tenancy/TenancyFeature.js\";\nimport { AdminUsersFeature } from \"~/features/users/AdminUsersFeature.js\";\nimport type { ApiCoreConfig } from \"~/types/core.js\";\nimport { ApiCoreStorageOperationsFactory } from \"~/features/storageOperations/abstractions.js\";\nimport { IdpAuthenticatorFeature } from \"~/idp/feature.js\";\nimport { KeyValueStoreFeature } from \"~/features/keyValueStore/feature.js\";\nimport { BuildParamsFeature } from \"~/features/buildParams/feature.js\";\nimport { EncryptionFeature } from \"~/features/encryption/feature.js\";\nimport { HasherFeature } from \"~/features/hashing/feature.js\";\nimport { FeatureFlagsFeature } from \"~/features/featureFlags/feature.js\";\nimport { MaskerFeature } from \"~/features/masker/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { WebhookProviderFeature } from \"~/features/webhooks/index.js\";\nimport { RequestContextFeature } from \"~/features/requestContext/index.js\";\nimport { ApiCoreSchemaFactory } from \"~/graphql/ApiCoreSchemaFactory.js\";\nimport { SecuritySchemaFactory } from \"~/graphql/security/SecuritySchemaFactory.js\";\nimport { UsersSchemaFactory } from \"~/graphql/users/UsersSchemaFactory.js\";\nimport { SystemSchemaFactory } from \"~/graphql/system/SystemSchemaFactory.js\";\nimport { WcpSchemaFactory } from \"~/graphql/wcp/WcpSchemaFactory.js\";\n\nexport const ApiCoreFeature = createFeature({\n name: \"ApiCore\",\n register(container: Container, config: ApiCoreConfig = {}) {\n // Storage operations are built synchronously, here, from the adapter-provided factory —\n // the same way for every event (no out-of-feature construction, no async initializer).\n const storageOperations = container.resolve(ApiCoreStorageOperationsFactory).create();\n\n // Register features\n WcpFeature.register(container, config.wcpLicense);\n MaskerFeature.register(container);\n AiFeature.register(container);\n LoggerFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n EncryptionFeature.register(container);\n HasherFeature.register(container);\n FeatureFlagsFeature.register(container);\n TenancyFeature.register(container, storageOperations.tenancyStorageOperations);\n SecurityFeature.register(container, storageOperations.securityStorageOperations);\n AdminUsersFeature.register(container, storageOperations.usersStorageOperations);\n KeyValueStoreFeature.register(container, storageOperations.keyValueStorageOperations);\n SystemFeature.register(container);\n IdpAuthenticatorFeature.register(container);\n RequestContextFeature.register(container);\n container.register(NullWebhookDispatcher).inSingletonScope();\n WebhookProviderFeature.register(container);\n\n // Core API GraphQL schema: a base factory (root types + scalars) plus one\n // CoreGraphQLSchemaFactory per domain.\n container.register(ApiCoreSchemaFactory);\n container.register(SecuritySchemaFactory);\n container.register(UsersSchemaFactory);\n container.register(SystemSchemaFactory);\n container.register(WcpSchemaFactory);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","storageOperations","ApiCoreStorageOperationsFactory","WcpFeature","MaskerFeature","AiFeature","LoggerFeature","EventPublisherFeature","BuildParamsFeature","EncryptionFeature","HasherFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","RequestContextFeature","NullWebhookDispatcher","WebhookProviderFeature","ApiCoreSchemaFactory","SecuritySchemaFactory","UsersSchemaFactory","SystemSchemaFactory","WcpSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAoB,EAAEC,SAAwB,CAAC,CAAC;QAGrD,MAAMC,oBAAoBF,UAAU,OAAO,CAACG,iCAAiC,MAAM;QAGnFC,WAAW,QAAQ,CAACJ,WAAWC,OAAO,UAAU;QAChDI,cAAc,QAAQ,CAACL;QACvBM,UAAU,QAAQ,CAACN;QACnBO,cAAc,QAAQ,CAACP;QACvBQ,sBAAsB,QAAQ,CAACR;QAC/BS,mBAAmB,QAAQ,CAACT;QAC5BU,kBAAkB,QAAQ,CAACV;QAC3BW,cAAc,QAAQ,CAACX;QACvBY,oBAAoB,QAAQ,CAACZ;QAC7Ba,eAAe,QAAQ,CAACb,WAAWE,kBAAkB,wBAAwB;QAC7EY,gBAAgB,QAAQ,CAACd,WAAWE,kBAAkB,yBAAyB;QAC/Ea,kBAAkB,QAAQ,CAACf,WAAWE,kBAAkB,sBAAsB;QAC9Ec,qBAAqB,QAAQ,CAAChB,WAAWE,kBAAkB,yBAAyB;QACpFe,cAAc,QAAQ,CAACjB;QACvBkB,wBAAwB,QAAQ,CAAClB;QACjCmB,sBAAsB,QAAQ,CAACnB;QAC/BA,UAAU,QAAQ,CAACoB,uBAAuB,gBAAgB;QAC1DC,uBAAuB,QAAQ,CAACrB;QAIhCA,UAAU,QAAQ,CAACsB;QACnBtB,UAAU,QAAQ,CAACuB;QACnBvB,UAAU,QAAQ,CAACwB;QACnBxB,UAAU,QAAQ,CAACyB;QACnBzB,UAAU,QAAQ,CAAC0B;IACvB;AACJ"}
package/exports/api.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai } from "../features/ai/index.js";
1
+ export { AiSdk, AiSdkFactory, AiSdkTool, AiConnectionFactory, Ai } from "../features/ai/index.js";
2
2
  export type { IAiConnection, IAiConnectionInline } from "../features/ai/index.js";
3
3
  export { Logger } from "../features/logger/index.js";
4
4
  export { Encryption } from "../features/encryption/index.js";
5
+ export { Hasher } from "../features/hashing/index.js";
5
6
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
6
7
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
7
8
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
package/exports/api.js CHANGED
@@ -1,6 +1,7 @@
1
- export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory } from "../features/ai/index.js";
1
+ export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory, AiSdkTool } from "../features/ai/index.js";
2
2
  export { Logger } from "../features/logger/index.js";
3
3
  export { Encryption } from "../features/encryption/index.js";
4
+ export { Hasher } from "../features/hashing/index.js";
4
5
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
5
6
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
6
7
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
@@ -3,6 +3,8 @@ import { OpenAiSdkFactory } from "./OpenAiSdkFactory.js";
3
3
  import { AnthropicSdkFactory } from "./AnthropicSdkFactory.js";
4
4
  import { Ai } from "./Ai.js";
5
5
  import { AiSdkTools } from "./AiSdkTools.js";
6
+ import { AiOutputToolRegistry } from "./toolPipeline/AiOutputToolRegistry.js";
7
+ import { AiToolPipelineRunner } from "./toolPipeline/AiToolPipelineRunner.js";
6
8
  const AiFeature = createFeature({
7
9
  name: "AiFeature",
8
10
  register (container) {
@@ -10,6 +12,8 @@ const AiFeature = createFeature({
10
12
  container.register(AnthropicSdkFactory);
11
13
  container.register(Ai);
12
14
  container.register(AiSdkTools);
15
+ container.register(AiOutputToolRegistry);
16
+ container.register(AiToolPipelineRunner);
13
17
  }
14
18
  });
15
19
  export { AiFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/feature.js","sources":["../../../src/features/ai/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { OpenAiSdkFactory } from \"./OpenAiSdkFactory.js\";\nimport { AnthropicSdkFactory } from \"./AnthropicSdkFactory.js\";\nimport { Ai } from \"./Ai.js\";\nimport { AiSdkTools } from \"./AiSdkTools.js\";\n\nexport const AiFeature = createFeature({\n name: \"AiFeature\",\n register(container) {\n container.register(OpenAiSdkFactory);\n container.register(AnthropicSdkFactory);\n container.register(Ai);\n container.register(AiSdkTools);\n }\n});\n"],"names":["AiFeature","createFeature","container","OpenAiSdkFactory","AnthropicSdkFactory","Ai","AiSdkTools"],"mappings":";;;;;AAMO,MAAMA,YAAYC,cAAc;IACnC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
1
+ {"version":3,"file":"features/ai/feature.js","sources":["../../../src/features/ai/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { OpenAiSdkFactory } from \"./OpenAiSdkFactory.js\";\nimport { AnthropicSdkFactory } from \"./AnthropicSdkFactory.js\";\nimport { Ai } from \"./Ai.js\";\nimport { AiSdkTools } from \"./AiSdkTools.js\";\nimport { AiOutputToolRegistry } from \"./toolPipeline/AiOutputToolRegistry.js\";\nimport { AiToolPipelineRunner } from \"./toolPipeline/AiToolPipelineRunner.js\";\n\nexport const AiFeature = createFeature({\n name: \"AiFeature\",\n register(container) {\n container.register(OpenAiSdkFactory);\n container.register(AnthropicSdkFactory);\n container.register(Ai);\n container.register(AiSdkTools);\n container.register(AiOutputToolRegistry);\n container.register(AiToolPipelineRunner);\n }\n});\n"],"names":["AiFeature","createFeature","container","OpenAiSdkFactory","AnthropicSdkFactory","Ai","AiSdkTools","AiOutputToolRegistry","AiToolPipelineRunner"],"mappings":";;;;;;;AAQO,MAAMA,YAAYC,cAAc;IACnC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;IACvB;AACJ"}
@@ -1,3 +1,5 @@
1
1
  export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai, AiSdkTool, AiSdkTools } from "./abstractions.js";
2
2
  export type { IAiConnection, IAiConnectionInline, AiModel, IAiSdkModel, IAiSdkTool, IAiSdkTools } from "./abstractions.js";
3
+ export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
4
+ export type { IAiOutputTool, IAiOutputToolRegistry, IAiToolPipelineRunner } from "./toolPipeline/index.js";
3
5
  export { AiFeature } from "./feature.js";
@@ -1,2 +1,3 @@
1
1
  export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory, AiSdkTool, AiSdkTools } from "./abstractions.js";
2
+ export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
2
3
  export { AiFeature } from "./feature.js";
@@ -0,0 +1,11 @@
1
+ import { type IAiOutputTool, type IAiOutputToolRegistry } from "./abstractions.js";
2
+ declare class AiOutputToolRegistryImpl implements IAiOutputToolRegistry {
3
+ private toolMap;
4
+ constructor(tools: IAiOutputTool[]);
5
+ has(name: string): boolean;
6
+ invoke(name: string, params: Record<string, unknown>): Promise<unknown>;
7
+ }
8
+ export declare const AiOutputToolRegistry: typeof AiOutputToolRegistryImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<IAiOutputToolRegistry>;
10
+ };
11
+ export {};
@@ -0,0 +1,31 @@
1
+ import { AiOutputTool, AiOutputToolRegistry } from "./abstractions.js";
2
+ class AiOutputToolRegistryImpl {
3
+ constructor(tools){
4
+ this.toolMap = new Map(tools.map((t)=>[
5
+ t.name,
6
+ t
7
+ ]));
8
+ }
9
+ has(name) {
10
+ return this.toolMap.has(name);
11
+ }
12
+ async invoke(name, params) {
13
+ const tool = this.toolMap.get(name);
14
+ if (!tool) return;
15
+ return tool.execute(params);
16
+ }
17
+ }
18
+ const AiOutputToolRegistry_AiOutputToolRegistry = AiOutputToolRegistry.createImplementation({
19
+ implementation: AiOutputToolRegistryImpl,
20
+ dependencies: [
21
+ [
22
+ AiOutputTool,
23
+ {
24
+ multiple: true
25
+ }
26
+ ]
27
+ ]
28
+ });
29
+ export { AiOutputToolRegistry_AiOutputToolRegistry as AiOutputToolRegistry };
30
+
31
+ //# sourceMappingURL=AiOutputToolRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/toolPipeline/AiOutputToolRegistry.js","sources":["../../../../src/features/ai/toolPipeline/AiOutputToolRegistry.ts"],"sourcesContent":["import {\n AiOutputTool,\n AiOutputToolRegistry as Abstraction,\n type IAiOutputTool,\n type IAiOutputToolRegistry\n} from \"./abstractions.js\";\n\nclass AiOutputToolRegistryImpl implements IAiOutputToolRegistry {\n private toolMap: Map<string, IAiOutputTool>;\n\n constructor(tools: IAiOutputTool[]) {\n this.toolMap = new Map(tools.map(t => [t.name, t]));\n }\n\n has(name: string): boolean {\n return this.toolMap.has(name);\n }\n\n async invoke(name: string, params: Record<string, unknown>): Promise<unknown> {\n const tool = this.toolMap.get(name);\n if (!tool) {\n return undefined;\n }\n return tool.execute(params);\n }\n}\n\nexport const AiOutputToolRegistry = Abstraction.createImplementation({\n implementation: AiOutputToolRegistryImpl,\n dependencies: [[AiOutputTool, { multiple: true }]]\n});\n"],"names":["AiOutputToolRegistryImpl","tools","Map","t","name","params","tool","AiOutputToolRegistry","Abstraction","AiOutputTool"],"mappings":";AAOA,MAAMA;IAGF,YAAYC,KAAsB,CAAE;QAChC,IAAI,CAAC,OAAO,GAAG,IAAIC,IAAID,MAAM,GAAG,CAACE,CAAAA,IAAK;gBAACA,EAAE,IAAI;gBAAEA;aAAE;IACrD;IAEA,IAAIC,IAAY,EAAW;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAACA;IAC5B;IAEA,MAAM,OAAOA,IAAY,EAAEC,MAA+B,EAAoB;QAC1E,MAAMC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAACF;QAC9B,IAAI,CAACE,MACD;QAEJ,OAAOA,KAAK,OAAO,CAACD;IACxB;AACJ;AAEO,MAAME,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBR;IAChB,cAAc;QAAC;YAACS;YAAc;gBAAE,UAAU;YAAK;SAAE;KAAC;AACtD"}
@@ -0,0 +1,10 @@
1
+ import { type IAiOutputToolRegistry, type IAiToolPipelineRunner } from "./abstractions.js";
2
+ declare class AiToolPipelineRunnerImpl implements IAiToolPipelineRunner {
3
+ private registry;
4
+ constructor(registry: IAiOutputToolRegistry);
5
+ resolve(data: unknown): Promise<unknown>;
6
+ }
7
+ export declare const AiToolPipelineRunner: typeof AiToolPipelineRunnerImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<IAiToolPipelineRunner>;
9
+ };
10
+ export {};
@@ -0,0 +1,36 @@
1
+ import { AiOutputToolRegistry, AiToolPipelineRunner } from "./abstractions.js";
2
+ function isToolEnvelope(value) {
3
+ return "object" == typeof value && null !== value && "tool" in value && "string" == typeof value.tool && "params" in value && "object" == typeof value.params;
4
+ }
5
+ class AiToolPipelineRunnerImpl {
6
+ constructor(registry){
7
+ this.registry = registry;
8
+ }
9
+ async resolve(data) {
10
+ if (null == data) return data;
11
+ if (isToolEnvelope(data)) {
12
+ if (!this.registry.has(data.tool)) return data;
13
+ const result = await this.registry.invoke(data.tool, data.params);
14
+ return this.resolve(result);
15
+ }
16
+ if (Array.isArray(data)) return Promise.all(data.map((item)=>this.resolve(item)));
17
+ if ("object" == typeof data) {
18
+ const entries = Object.entries(data);
19
+ const resolvedValues = await Promise.all(entries.map(([, value])=>this.resolve(value)));
20
+ return Object.fromEntries(entries.map(([key], i)=>[
21
+ key,
22
+ resolvedValues[i]
23
+ ]));
24
+ }
25
+ return data;
26
+ }
27
+ }
28
+ const AiToolPipelineRunner_AiToolPipelineRunner = AiToolPipelineRunner.createImplementation({
29
+ implementation: AiToolPipelineRunnerImpl,
30
+ dependencies: [
31
+ AiOutputToolRegistry
32
+ ]
33
+ });
34
+ export { AiToolPipelineRunner_AiToolPipelineRunner as AiToolPipelineRunner };
35
+
36
+ //# sourceMappingURL=AiToolPipelineRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/toolPipeline/AiToolPipelineRunner.js","sources":["../../../../src/features/ai/toolPipeline/AiToolPipelineRunner.ts"],"sourcesContent":["import {\n AiOutputToolRegistry,\n AiToolPipelineRunner as Abstraction,\n type IAiOutputToolRegistry,\n type IAiToolPipelineRunner\n} from \"./abstractions.js\";\n\nfunction isToolEnvelope(\n value: unknown\n): value is { tool: string; params: Record<string, unknown> } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"tool\" in value &&\n typeof (value as Record<string, unknown>).tool === \"string\" &&\n \"params\" in value &&\n typeof (value as Record<string, unknown>).params === \"object\"\n );\n}\n\nclass AiToolPipelineRunnerImpl implements IAiToolPipelineRunner {\n constructor(private registry: IAiOutputToolRegistry) {}\n\n async resolve(data: unknown): Promise<unknown> {\n if (data === null || data === undefined) {\n return data;\n }\n\n if (isToolEnvelope(data)) {\n if (!this.registry.has(data.tool)) {\n return data;\n }\n const result = await this.registry.invoke(data.tool, data.params);\n return this.resolve(result);\n }\n\n if (Array.isArray(data)) {\n return Promise.all(data.map(item => this.resolve(item)));\n }\n\n if (typeof data === \"object\") {\n const entries = Object.entries(data as Record<string, unknown>);\n const resolvedValues = await Promise.all(\n entries.map(([, value]) => this.resolve(value))\n );\n return Object.fromEntries(entries.map(([key], i) => [key, resolvedValues[i]]));\n }\n\n return data;\n }\n}\n\nexport const AiToolPipelineRunner = Abstraction.createImplementation({\n implementation: AiToolPipelineRunnerImpl,\n dependencies: [AiOutputToolRegistry]\n});\n"],"names":["isToolEnvelope","value","AiToolPipelineRunnerImpl","registry","data","result","Array","Promise","item","entries","Object","resolvedValues","key","i","AiToolPipelineRunner","Abstraction","AiOutputToolRegistry"],"mappings":";AAOA,SAASA,eACLC,KAAc;IAEd,OACI,AAAiB,YAAjB,OAAOA,SACPA,AAAU,SAAVA,SACA,UAAUA,SACV,AAAmD,YAAnD,OAAQA,MAAkC,IAAI,IAC9C,YAAYA,SACZ,AAAqD,YAArD,OAAQA,MAAkC,MAAM;AAExD;AAEA,MAAMC;IACF,YAAoBC,QAA+B,CAAE;aAAjCA,QAAQ,GAARA;IAAkC;IAEtD,MAAM,QAAQC,IAAa,EAAoB;QAC3C,IAAIA,QAAAA,MACA,OAAOA;QAGX,IAAIJ,eAAeI,OAAO;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,KAAK,IAAI,GAC5B,OAAOA;YAEX,MAAMC,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAACD,KAAK,IAAI,EAAEA,KAAK,MAAM;YAChE,OAAO,IAAI,CAAC,OAAO,CAACC;QACxB;QAEA,IAAIC,MAAM,OAAO,CAACF,OACd,OAAOG,QAAQ,GAAG,CAACH,KAAK,GAAG,CAACI,CAAAA,OAAQ,IAAI,CAAC,OAAO,CAACA;QAGrD,IAAI,AAAgB,YAAhB,OAAOJ,MAAmB;YAC1B,MAAMK,UAAUC,OAAO,OAAO,CAACN;YAC/B,MAAMO,iBAAiB,MAAMJ,QAAQ,GAAG,CACpCE,QAAQ,GAAG,CAAC,CAAC,GAAGR,MAAM,GAAK,IAAI,CAAC,OAAO,CAACA;YAE5C,OAAOS,OAAO,WAAW,CAACD,QAAQ,GAAG,CAAC,CAAC,CAACG,IAAI,EAAEC,IAAM;oBAACD;oBAAKD,cAAc,CAACE,EAAE;iBAAC;QAChF;QAEA,OAAOT;IACX;AACJ;AAEO,MAAMU,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBb;IAChB,cAAc;QAACc;KAAqB;AACxC"}
@@ -0,0 +1,23 @@
1
+ export interface IAiOutputTool {
2
+ readonly name: string;
3
+ execute(params: Record<string, unknown>): Promise<unknown>;
4
+ }
5
+ export declare const AiOutputTool: import("@webiny/di").Abstraction<IAiOutputTool>;
6
+ export declare namespace AiOutputTool {
7
+ type Interface = IAiOutputTool;
8
+ }
9
+ export interface IAiOutputToolRegistry {
10
+ has(name: string): boolean;
11
+ invoke(name: string, params: Record<string, unknown>): Promise<unknown>;
12
+ }
13
+ export declare const AiOutputToolRegistry: import("@webiny/di").Abstraction<IAiOutputToolRegistry>;
14
+ export declare namespace AiOutputToolRegistry {
15
+ type Interface = IAiOutputToolRegistry;
16
+ }
17
+ export interface IAiToolPipelineRunner {
18
+ resolve(data: unknown): Promise<unknown>;
19
+ }
20
+ export declare const AiToolPipelineRunner: import("@webiny/di").Abstraction<IAiToolPipelineRunner>;
21
+ export declare namespace AiToolPipelineRunner {
22
+ type Interface = IAiToolPipelineRunner;
23
+ }
@@ -0,0 +1,7 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const AiOutputTool = createAbstraction("AiOutputTool");
3
+ const AiOutputToolRegistry = createAbstraction("AiOutputToolRegistry");
4
+ const AiToolPipelineRunner = createAbstraction("AiToolPipelineRunner");
5
+ export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner };
6
+
7
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/toolPipeline/abstractions.js","sources":["../../../../src/features/ai/toolPipeline/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IAiOutputTool {\n readonly name: string;\n execute(params: Record<string, unknown>): Promise<unknown>;\n}\n\nexport const AiOutputTool = createAbstraction<IAiOutputTool>(\"AiOutputTool\");\n\nexport namespace AiOutputTool {\n export type Interface = IAiOutputTool;\n}\n\nexport interface IAiOutputToolRegistry {\n has(name: string): boolean;\n invoke(name: string, params: Record<string, unknown>): Promise<unknown>;\n}\n\nexport const AiOutputToolRegistry =\n createAbstraction<IAiOutputToolRegistry>(\"AiOutputToolRegistry\");\n\nexport namespace AiOutputToolRegistry {\n export type Interface = IAiOutputToolRegistry;\n}\n\nexport interface IAiToolPipelineRunner {\n resolve(data: unknown): Promise<unknown>;\n}\n\nexport const AiToolPipelineRunner =\n createAbstraction<IAiToolPipelineRunner>(\"AiToolPipelineRunner\");\n\nexport namespace AiToolPipelineRunner {\n export type Interface = IAiToolPipelineRunner;\n}\n"],"names":["AiOutputTool","createAbstraction","AiOutputToolRegistry","AiToolPipelineRunner"],"mappings":";AAOO,MAAMA,eAAeC,kBAAiC;AAWtD,MAAMC,uBACTD,kBAAyC;AAUtC,MAAME,uBACTF,kBAAyC"}
@@ -0,0 +1,2 @@
1
+ export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./abstractions.js";
2
+ export type { IAiOutputTool, IAiOutputToolRegistry, IAiToolPipelineRunner } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./abstractions.js";
@@ -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"}