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

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 (170) hide show
  1. package/ApiCoreFeature.js +5 -0
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/exports/api.d.ts +1 -0
  4. package/exports/api.js +1 -0
  5. package/features/ai/AiSdkTools.d.ts +1 -1
  6. package/features/ai/AiSdkTools.js +3 -2
  7. package/features/ai/AiSdkTools.js.map +1 -1
  8. package/features/ai/abstractions.d.ts +9 -1
  9. package/features/ai/abstractions.js.map +1 -1
  10. package/features/ai/index.d.ts +1 -0
  11. package/features/ai/index.js +1 -0
  12. package/features/ai/isReadOnlyTool.d.ts +9 -0
  13. package/features/ai/isReadOnlyTool.js +4 -0
  14. package/features/ai/isReadOnlyTool.js.map +1 -0
  15. package/features/cdnCache/NullCdnCache.d.ts +8 -0
  16. package/features/cdnCache/NullCdnCache.js +11 -0
  17. package/features/cdnCache/NullCdnCache.js.map +1 -0
  18. package/features/cdnCache/abstractions.d.ts +20 -0
  19. package/features/cdnCache/abstractions.js +5 -0
  20. package/features/cdnCache/abstractions.js.map +1 -0
  21. package/features/cdnCache/feature.d.ts +8 -0
  22. package/features/cdnCache/feature.js +11 -0
  23. package/features/cdnCache/feature.js.map +1 -0
  24. package/features/cdnCache/index.d.ts +2 -0
  25. package/features/cdnCache/index.js +2 -0
  26. package/features/requestStorage/abstractions.d.ts +23 -0
  27. package/features/requestStorage/abstractions.js +5 -0
  28. package/features/requestStorage/abstractions.js.map +1 -0
  29. package/features/requestStorage/index.d.ts +1 -0
  30. package/features/requestStorage/index.js +1 -0
  31. package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.d.ts +13 -0
  32. package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.js +25 -0
  33. package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.js.map +1 -0
  34. package/features/security/CanAccessCurrentTenant/abstractions.d.ts +12 -0
  35. package/features/security/CanAccessCurrentTenant/abstractions.js +5 -0
  36. package/features/security/CanAccessCurrentTenant/abstractions.js.map +1 -0
  37. package/features/security/CanAccessCurrentTenant/feature.d.ts +4 -0
  38. package/features/security/CanAccessCurrentTenant/feature.js +11 -0
  39. package/features/security/CanAccessCurrentTenant/feature.js.map +1 -0
  40. package/features/security/CanAccessCurrentTenant/index.d.ts +2 -0
  41. package/features/security/CanAccessCurrentTenant/index.js +2 -0
  42. package/features/security/SecurityFeature.js +4 -0
  43. package/features/security/SecurityFeature.js.map +1 -1
  44. package/features/security/ai/CreateRoleTool.d.ts +54 -0
  45. package/features/security/ai/CreateRoleTool.js +71 -0
  46. package/features/security/ai/CreateRoleTool.js.map +1 -0
  47. package/features/security/ai/CreateTeamTool.d.ts +49 -0
  48. package/features/security/ai/CreateTeamTool.js +56 -0
  49. package/features/security/ai/CreateTeamTool.js.map +1 -0
  50. package/features/security/ai/DeleteRoleTool.d.ts +52 -0
  51. package/features/security/ai/DeleteRoleTool.js +79 -0
  52. package/features/security/ai/DeleteRoleTool.js.map +1 -0
  53. package/features/security/ai/DeleteTeamTool.d.ts +47 -0
  54. package/features/security/ai/DeleteTeamTool.js +56 -0
  55. package/features/security/ai/DeleteTeamTool.js.map +1 -0
  56. package/features/security/ai/ListRolesTool.d.ts +40 -0
  57. package/features/security/ai/ListRolesTool.js +48 -0
  58. package/features/security/ai/ListRolesTool.js.map +1 -0
  59. package/features/security/ai/ListTeamsTool.d.ts +42 -0
  60. package/features/security/ai/ListTeamsTool.js +49 -0
  61. package/features/security/ai/ListTeamsTool.js.map +1 -0
  62. package/features/security/ai/UpdateRoleTool.d.ts +46 -0
  63. package/features/security/ai/UpdateRoleTool.js +53 -0
  64. package/features/security/ai/UpdateRoleTool.js.map +1 -0
  65. package/features/security/ai/UpdateTeamTool.d.ts +53 -0
  66. package/features/security/ai/UpdateTeamTool.js +56 -0
  67. package/features/security/ai/UpdateTeamTool.js.map +1 -0
  68. package/features/security/ai/feature.d.ts +10 -0
  69. package/features/security/ai/feature.js +25 -0
  70. package/features/security/ai/feature.js.map +1 -0
  71. package/features/security/ai/index.d.ts +9 -0
  72. package/features/security/ai/index.js +9 -0
  73. package/features/security/apiKeys/ApiKeyAuthorizer.js +1 -1
  74. package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -1
  75. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.d.ts +11 -0
  76. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js +24 -0
  77. package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js.map +1 -0
  78. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.d.ts +11 -0
  79. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js +24 -0
  80. package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js.map +1 -0
  81. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.d.ts +11 -0
  82. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js +24 -0
  83. package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js.map +1 -0
  84. package/features/security/roles/NotifyRoleChange/feature.d.ts +5 -0
  85. package/features/security/roles/NotifyRoleChange/feature.js +15 -0
  86. package/features/security/roles/NotifyRoleChange/feature.js.map +1 -0
  87. package/features/security/roles/NotifyRoleChange/index.d.ts +2 -0
  88. package/features/security/roles/NotifyRoleChange/index.js +2 -0
  89. package/features/security/roles/NotifyRoleChange/recordType.d.ts +5 -0
  90. package/features/security/roles/NotifyRoleChange/recordType.js +4 -0
  91. package/features/security/roles/NotifyRoleChange/recordType.js.map +1 -0
  92. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +2 -1
  93. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  94. package/features/security/roles/feature.js +2 -0
  95. package/features/security/roles/feature.js.map +1 -1
  96. package/features/security/shared/definedOnly.d.ts +1 -0
  97. package/features/security/shared/definedOnly.js +8 -0
  98. package/features/security/shared/definedOnly.js.map +1 -0
  99. package/features/security/shared/index.d.ts +1 -0
  100. package/features/security/shared/index.js +1 -0
  101. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.d.ts +29 -0
  102. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js +62 -0
  103. package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js.map +1 -0
  104. package/features/security/teams/NotifyTeamChange/feature.d.ts +5 -0
  105. package/features/security/teams/NotifyTeamChange/feature.js +13 -0
  106. package/features/security/teams/NotifyTeamChange/feature.js.map +1 -0
  107. package/features/security/teams/NotifyTeamChange/index.d.ts +2 -0
  108. package/features/security/teams/NotifyTeamChange/index.js +2 -0
  109. package/features/security/teams/NotifyTeamChange/recordType.d.ts +5 -0
  110. package/features/security/teams/NotifyTeamChange/recordType.js +4 -0
  111. package/features/security/teams/NotifyTeamChange/recordType.js.map +1 -0
  112. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +2 -1
  113. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  114. package/features/security/teams/feature.js +2 -0
  115. package/features/security/teams/feature.js.map +1 -1
  116. package/features/task/TaskService/abstractions.d.ts +7 -0
  117. package/features/task/TaskService/abstractions.js.map +1 -1
  118. package/features/users/AdminUsersFeature.js +4 -0
  119. package/features/users/AdminUsersFeature.js.map +1 -1
  120. package/features/users/CreateUser/CreateUserUseCase.js +1 -1
  121. package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
  122. package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.d.ts +29 -0
  123. package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.js +62 -0
  124. package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.js.map +1 -0
  125. package/features/users/NotifyUserChange/feature.d.ts +5 -0
  126. package/features/users/NotifyUserChange/feature.js +13 -0
  127. package/features/users/NotifyUserChange/feature.js.map +1 -0
  128. package/features/users/NotifyUserChange/index.d.ts +2 -0
  129. package/features/users/NotifyUserChange/index.js +2 -0
  130. package/features/users/NotifyUserChange/recordType.d.ts +5 -0
  131. package/features/users/NotifyUserChange/recordType.js +4 -0
  132. package/features/users/NotifyUserChange/recordType.js.map +1 -0
  133. package/features/users/ai/ListUsersTool.d.ts +39 -0
  134. package/features/users/ai/ListUsersTool.js +46 -0
  135. package/features/users/ai/ListUsersTool.js.map +1 -0
  136. package/features/users/ai/UpdateUserAccessTool.d.ts +59 -0
  137. package/features/users/ai/UpdateUserAccessTool.js +101 -0
  138. package/features/users/ai/UpdateUserAccessTool.js.map +1 -0
  139. package/features/users/ai/feature.d.ts +11 -0
  140. package/features/users/ai/feature.js +13 -0
  141. package/features/users/ai/feature.js.map +1 -0
  142. package/features/users/ai/index.d.ts +3 -0
  143. package/features/users/ai/index.js +3 -0
  144. package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.d.ts +12 -0
  145. package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.js +38 -0
  146. package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.js.map +1 -0
  147. package/features/websockets/NotifyRecordChange/abstractions.d.ts +39 -0
  148. package/features/websockets/NotifyRecordChange/abstractions.js +6 -0
  149. package/features/websockets/NotifyRecordChange/abstractions.js.map +1 -0
  150. package/features/websockets/NotifyRecordChange/feature.d.ts +5 -0
  151. package/features/websockets/NotifyRecordChange/feature.js +11 -0
  152. package/features/websockets/NotifyRecordChange/feature.js.map +1 -0
  153. package/features/websockets/NotifyRecordChange/index.d.ts +2 -0
  154. package/features/websockets/NotifyRecordChange/index.js +2 -0
  155. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.d.ts +20 -0
  156. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js +24 -0
  157. package/features/websockets/SendToIdentity/NullSendToIdentityUseCase.js.map +1 -0
  158. package/features/websockets/SendToIdentity/abstractions.d.ts +19 -0
  159. package/features/websockets/SendToIdentity/abstractions.js +5 -0
  160. package/features/websockets/SendToIdentity/abstractions.js.map +1 -0
  161. package/features/websockets/WebsocketServiceError.d.ts +7 -0
  162. package/features/websockets/WebsocketServiceError.js +14 -0
  163. package/features/websockets/WebsocketServiceError.js.map +1 -0
  164. package/features/websockets/index.d.ts +7 -0
  165. package/features/websockets/index.js +4 -0
  166. package/features/websockets/types.d.ts +15 -0
  167. package/features/websockets/types.js +0 -0
  168. package/index.d.ts +1 -0
  169. package/index.js +1 -0
  170. package/package.json +11 -11
package/ApiCoreFeature.js CHANGED
@@ -9,6 +9,7 @@ import { IdpAuthenticatorFeature } from "./idp/feature.js";
9
9
  import { KeyValueStoreFeature } from "./features/keyValueStore/feature.js";
10
10
  import { BuildParamsFeature } from "./features/buildParams/feature.js";
11
11
  import { PublicUrlsFeature } from "./features/publicUrls/feature.js";
12
+ import { CdnCacheFeature } from "./features/cdnCache/feature.js";
12
13
  import { DebuggerFeature } from "./features/debugger/feature.js";
13
14
  import { EncryptionFeature } from "./features/encryption/feature.js";
14
15
  import { HasherFeature } from "./features/hashing/feature.js";
@@ -20,6 +21,7 @@ import { AiFeature } from "./features/ai/feature.js";
20
21
  import { WcpFeature } from "./features/wcp/WcpFeature.js";
21
22
  import { HttpClientFeature } from "./features/httpClient/feature.js";
22
23
  import { NullWebhookDispatcher } from "./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js";
24
+ import { NotifyRecordChangeFeature, NullSendToIdentityUseCase } from "./features/websockets/index.js";
23
25
  import { WebhookProviderFeature } from "./features/webhooks/index.js";
24
26
  import { RequestContextFeature } from "./features/requestContext/index.js";
25
27
  import { ApiCoreSchemaFactory } from "./graphql/ApiCoreSchemaFactory.js";
@@ -41,6 +43,7 @@ const ApiCoreFeature = createFeature({
41
43
  EventPublisherFeature.register(container);
42
44
  BuildParamsFeature.register(container);
43
45
  PublicUrlsFeature.register(container);
46
+ CdnCacheFeature.register(container);
44
47
  DebuggerFeature.register(container);
45
48
  EncryptionFeature.register(container);
46
49
  HasherFeature.register(container);
@@ -53,6 +56,8 @@ const ApiCoreFeature = createFeature({
53
56
  IdpAuthenticatorFeature.register(container);
54
57
  RequestContextFeature.register(container);
55
58
  container.register(NullWebhookDispatcher).inSingletonScope();
59
+ container.register(NullSendToIdentityUseCase);
60
+ NotifyRecordChangeFeature.register(container);
56
61
  WebhookProviderFeature.register(container);
57
62
  container.register(ApiCoreSchemaFactory);
58
63
  container.register(SecuritySchemaFactory);
@@ -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 { 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 { PublicUrlsFeature } from \"~/features/publicUrls/feature.js\";\nimport { DebuggerFeature } from \"~/features/debugger/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 { StringFormatterFeature } from \"~/features/stringFormatter/feature.js\";\nimport { DateFormatterFeature } from \"~/features/dateFormatter/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { HttpClientFeature } from \"~/features/httpClient/feature.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\";\nimport { FeatureFlagsSchemaFactory } from \"~/graphql/featureFlags/FeatureFlagsSchemaFactory.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 StringFormatterFeature.register(container);\n DateFormatterFeature.register(container);\n HttpClientFeature.register(container);\n AiFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n PublicUrlsFeature.register(container);\n DebuggerFeature.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 container.register(FeatureFlagsSchemaFactory);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","storageOperations","ApiCoreStorageOperationsFactory","WcpFeature","MaskerFeature","StringFormatterFeature","DateFormatterFeature","HttpClientFeature","AiFeature","EventPublisherFeature","BuildParamsFeature","PublicUrlsFeature","DebuggerFeature","EncryptionFeature","HasherFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","RequestContextFeature","NullWebhookDispatcher","WebhookProviderFeature","ApiCoreSchemaFactory","SecuritySchemaFactory","UsersSchemaFactory","SystemSchemaFactory","WcpSchemaFactory","FeatureFlagsSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,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,uBAAuB,QAAQ,CAACN;QAChCO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,UAAU,QAAQ,CAACT;QACnBU,sBAAsB,QAAQ,CAACV;QAC/BW,mBAAmB,QAAQ,CAACX;QAC5BY,kBAAkB,QAAQ,CAACZ;QAC3Ba,gBAAgB,QAAQ,CAACb;QACzBc,kBAAkB,QAAQ,CAACd;QAC3Be,cAAc,QAAQ,CAACf;QACvBgB,oBAAoB,QAAQ,CAAChB;QAC7BiB,eAAe,QAAQ,CAACjB,WAAWE,kBAAkB,wBAAwB;QAC7EgB,gBAAgB,QAAQ,CAAClB,WAAWE,kBAAkB,yBAAyB;QAC/EiB,kBAAkB,QAAQ,CAACnB,WAAWE,kBAAkB,sBAAsB;QAC9EkB,qBAAqB,QAAQ,CAACpB,WAAWE,kBAAkB,yBAAyB;QACpFmB,cAAc,QAAQ,CAACrB;QACvBsB,wBAAwB,QAAQ,CAACtB;QACjCuB,sBAAsB,QAAQ,CAACvB;QAC/BA,UAAU,QAAQ,CAACwB,uBAAuB,gBAAgB;QAC1DC,uBAAuB,QAAQ,CAACzB;QAIhCA,UAAU,QAAQ,CAAC0B;QACnB1B,UAAU,QAAQ,CAAC2B;QACnB3B,UAAU,QAAQ,CAAC4B;QACnB5B,UAAU,QAAQ,CAAC6B;QACnB7B,UAAU,QAAQ,CAAC8B;QACnB9B,UAAU,QAAQ,CAAC+B;IACvB;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 { 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 { PublicUrlsFeature } from \"~/features/publicUrls/feature.js\";\nimport { CdnCacheFeature } from \"~/features/cdnCache/feature.js\";\nimport { DebuggerFeature } from \"~/features/debugger/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 { StringFormatterFeature } from \"~/features/stringFormatter/feature.js\";\nimport { DateFormatterFeature } from \"~/features/dateFormatter/feature.js\";\nimport { AiFeature } from \"~/features/ai/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { HttpClientFeature } from \"~/features/httpClient/feature.js\";\nimport { NullWebhookDispatcher } from \"./features/webhooks/WebhookDispatcher/NullWebhookDispatcher.js\";\nimport { NullSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport { NotifyRecordChangeFeature } from \"~/features/websockets/index.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\";\nimport { FeatureFlagsSchemaFactory } from \"~/graphql/featureFlags/FeatureFlagsSchemaFactory.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 StringFormatterFeature.register(container);\n DateFormatterFeature.register(container);\n HttpClientFeature.register(container);\n AiFeature.register(container);\n EventPublisherFeature.register(container);\n BuildParamsFeature.register(container);\n PublicUrlsFeature.register(container);\n CdnCacheFeature.register(container);\n DebuggerFeature.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 container.register(NullSendToIdentityUseCase);\n NotifyRecordChangeFeature.register(container);\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 container.register(FeatureFlagsSchemaFactory);\n }\n});\n"],"names":["ApiCoreFeature","createFeature","container","config","storageOperations","ApiCoreStorageOperationsFactory","WcpFeature","MaskerFeature","StringFormatterFeature","DateFormatterFeature","HttpClientFeature","AiFeature","EventPublisherFeature","BuildParamsFeature","PublicUrlsFeature","CdnCacheFeature","DebuggerFeature","EncryptionFeature","HasherFeature","FeatureFlagsFeature","TenancyFeature","SecurityFeature","AdminUsersFeature","KeyValueStoreFeature","SystemFeature","IdpAuthenticatorFeature","RequestContextFeature","NullWebhookDispatcher","NullSendToIdentityUseCase","NotifyRecordChangeFeature","WebhookProviderFeature","ApiCoreSchemaFactory","SecuritySchemaFactory","UsersSchemaFactory","SystemSchemaFactory","WcpSchemaFactory","FeatureFlagsSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,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,uBAAuB,QAAQ,CAACN;QAChCO,qBAAqB,QAAQ,CAACP;QAC9BQ,kBAAkB,QAAQ,CAACR;QAC3BS,UAAU,QAAQ,CAACT;QACnBU,sBAAsB,QAAQ,CAACV;QAC/BW,mBAAmB,QAAQ,CAACX;QAC5BY,kBAAkB,QAAQ,CAACZ;QAC3Ba,gBAAgB,QAAQ,CAACb;QACzBc,gBAAgB,QAAQ,CAACd;QACzBe,kBAAkB,QAAQ,CAACf;QAC3BgB,cAAc,QAAQ,CAAChB;QACvBiB,oBAAoB,QAAQ,CAACjB;QAC7BkB,eAAe,QAAQ,CAAClB,WAAWE,kBAAkB,wBAAwB;QAC7EiB,gBAAgB,QAAQ,CAACnB,WAAWE,kBAAkB,yBAAyB;QAC/EkB,kBAAkB,QAAQ,CAACpB,WAAWE,kBAAkB,sBAAsB;QAC9EmB,qBAAqB,QAAQ,CAACrB,WAAWE,kBAAkB,yBAAyB;QACpFoB,cAAc,QAAQ,CAACtB;QACvBuB,wBAAwB,QAAQ,CAACvB;QACjCwB,sBAAsB,QAAQ,CAACxB;QAC/BA,UAAU,QAAQ,CAACyB,uBAAuB,gBAAgB;QAC1DzB,UAAU,QAAQ,CAAC0B;QACnBC,0BAA0B,QAAQ,CAAC3B;QACnC4B,uBAAuB,QAAQ,CAAC5B;QAIhCA,UAAU,QAAQ,CAAC6B;QACnB7B,UAAU,QAAQ,CAAC8B;QACnB9B,UAAU,QAAQ,CAAC+B;QACnB/B,UAAU,QAAQ,CAACgC;QACnBhC,UAAU,QAAQ,CAACiC;QACnBjC,UAAU,QAAQ,CAACkC;IACvB;AACJ"}
package/exports/api.d.ts CHANGED
@@ -6,3 +6,4 @@ export { Hasher } from "../features/hashing/index.js";
6
6
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
7
7
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
8
8
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
9
+ export { WebsocketsSendToIdentityUseCase } from "../features/websockets/index.js";
package/exports/api.js CHANGED
@@ -5,3 +5,4 @@ export { Hasher } from "../features/hashing/index.js";
5
5
  export { BuildParam, BuildParams } from "../features/buildParams/index.js";
6
6
  export { DomainEvent, EventPublisher } from "../features/eventPublisher/index.js";
7
7
  export { GlobalKeyValueStore, KeyValueStore } from "../features/keyValueStore/index.js";
8
+ export { WebsocketsSendToIdentityUseCase } from "../features/websockets/index.js";
@@ -4,7 +4,7 @@ declare class AiSdkToolsImpl implements AiSdkToolsAbstraction.Interface {
4
4
  private definitions;
5
5
  private resolver;
6
6
  constructor(definitions: AiSdkToolDefinition.Interface[], resolver: AiSdkToolHandlerResolver.Interface);
7
- getToolSet(): ToolSet;
7
+ getToolSet(options?: AiSdkToolsAbstraction.Options): ToolSet;
8
8
  }
9
9
  export declare const AiSdkTools: typeof AiSdkToolsImpl & {
10
10
  __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IAiSdkTools>;
@@ -1,12 +1,13 @@
1
1
  import { AiSdkToolDefinition, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
2
+ import { isReadOnlyTool } from "./isReadOnlyTool.js";
2
3
  class AiSdkToolsImpl {
3
4
  constructor(definitions, resolver){
4
5
  this.definitions = definitions;
5
6
  this.resolver = resolver;
6
7
  }
7
- getToolSet() {
8
+ getToolSet(options = {}) {
8
9
  const map = {};
9
- for (const definition of this.definitions)map[definition.name] = {
10
+ for (const definition of this.definitions)if (!options.readOnly || isReadOnlyTool(definition)) map[definition.name] = {
10
11
  description: definition.description,
11
12
  inputSchema: definition.inputSchema,
12
13
  execute: (input)=>this.resolver.resolve(definition.handler).execute(input)
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/AiSdkTools.js","sources":["../../../src/features/ai/AiSdkTools.ts"],"sourcesContent":["import {\n AiSdkToolDefinition,\n AiSdkToolHandlerResolver,\n AiSdkTools as AiSdkToolsAbstraction\n} from \"./abstractions.js\";\nimport type { ToolSet } from \"ai\";\n\nclass AiSdkToolsImpl implements AiSdkToolsAbstraction.Interface {\n constructor(\n private definitions: AiSdkToolDefinition.Interface[],\n private resolver: AiSdkToolHandlerResolver.Interface\n ) {}\n\n getToolSet(): ToolSet {\n const map: ToolSet = {};\n for (const definition of this.definitions) {\n map[definition.name] = {\n description: definition.description,\n inputSchema: definition.inputSchema,\n /*\n * Deliberately resolved inside the call, not here. The model is offered every\n * tool and calls a few, which is what keeps the rest of their use cases unbuilt.\n *\n * `resolve` IS `container.resolveImplementation`, one layer down. It lives behind\n * an abstraction so this class does not inject a container. Note it builds the\n * class the definition names; resolving the `AiSdkToolHandler` abstraction would\n * find nothing, since handlers are declared through it but never registered.\n */\n execute: (input: unknown) =>\n this.resolver.resolve(definition.handler).execute(input)\n };\n }\n return map;\n }\n}\n\nexport const AiSdkTools = AiSdkToolsAbstraction.createImplementation({\n implementation: AiSdkToolsImpl,\n dependencies: [[AiSdkToolDefinition, { multiple: true }], AiSdkToolHandlerResolver]\n});\n"],"names":["AiSdkToolsImpl","definitions","resolver","map","definition","input","AiSdkTools","AiSdkToolsAbstraction","AiSdkToolDefinition","AiSdkToolHandlerResolver"],"mappings":";AAOA,MAAMA;IACF,YACYC,WAA4C,EAC5CC,QAA4C,CACtD;aAFUD,WAAW,GAAXA;aACAC,QAAQ,GAARA;IACT;IAEH,aAAsB;QAClB,MAAMC,MAAe,CAAC;QACtB,KAAK,MAAMC,cAAc,IAAI,CAAC,WAAW,CACrCD,GAAG,CAACC,WAAW,IAAI,CAAC,GAAG;YACnB,aAAaA,WAAW,WAAW;YACnC,aAAaA,WAAW,WAAW;YAUnC,SAAS,CAACC,QACN,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACD,WAAW,OAAO,EAAE,OAAO,CAACC;QAC1D;QAEJ,OAAOF;IACX;AACJ;AAEO,MAAMG,wBAAaC,WAAAA,oBAA0C,CAAC;IACjE,gBAAgBP;IAChB,cAAc;QAAC;YAACQ;YAAqB;gBAAE,UAAU;YAAK;SAAE;QAAEC;KAAyB;AACvF"}
1
+ {"version":3,"file":"features/ai/AiSdkTools.js","sources":["../../../src/features/ai/AiSdkTools.ts"],"sourcesContent":["import {\n AiSdkToolDefinition,\n AiSdkToolHandlerResolver,\n AiSdkTools as AiSdkToolsAbstraction\n} from \"./abstractions.js\";\nimport { isReadOnlyTool } from \"./isReadOnlyTool.js\";\nimport type { ToolSet } from \"ai\";\n\nclass AiSdkToolsImpl implements AiSdkToolsAbstraction.Interface {\n constructor(\n private definitions: AiSdkToolDefinition.Interface[],\n private resolver: AiSdkToolHandlerResolver.Interface\n ) {}\n\n getToolSet(options: AiSdkToolsAbstraction.Options = {}): ToolSet {\n const map: ToolSet = {};\n for (const definition of this.definitions) {\n if (options.readOnly && !isReadOnlyTool(definition)) {\n continue;\n }\n map[definition.name] = {\n description: definition.description,\n inputSchema: definition.inputSchema,\n /*\n * Deliberately resolved inside the call, not here. The model is offered every\n * tool and calls a few, which is what keeps the rest of their use cases unbuilt.\n *\n * `resolve` IS `container.resolveImplementation`, one layer down. It lives behind\n * an abstraction so this class does not inject a container. Note it builds the\n * class the definition names; resolving the `AiSdkToolHandler` abstraction would\n * find nothing, since handlers are declared through it but never registered.\n */\n execute: (input: unknown) =>\n this.resolver.resolve(definition.handler).execute(input)\n };\n }\n return map;\n }\n}\n\nexport const AiSdkTools = AiSdkToolsAbstraction.createImplementation({\n implementation: AiSdkToolsImpl,\n dependencies: [[AiSdkToolDefinition, { multiple: true }], AiSdkToolHandlerResolver]\n});\n"],"names":["AiSdkToolsImpl","definitions","resolver","options","map","definition","isReadOnlyTool","input","AiSdkTools","AiSdkToolsAbstraction","AiSdkToolDefinition","AiSdkToolHandlerResolver"],"mappings":";;AAQA,MAAMA;IACF,YACYC,WAA4C,EAC5CC,QAA4C,CACtD;aAFUD,WAAW,GAAXA;aACAC,QAAQ,GAARA;IACT;IAEH,WAAWC,UAAyC,CAAC,CAAC,EAAW;QAC7D,MAAMC,MAAe,CAAC;QACtB,KAAK,MAAMC,cAAc,IAAI,CAAC,WAAW,CACrC,IAAIF,CAAAA,QAAQ,QAAQ,IAAKG,eAAeD,aAGxCD,GAAG,CAACC,WAAW,IAAI,CAAC,GAAG;YACnB,aAAaA,WAAW,WAAW;YACnC,aAAaA,WAAW,WAAW;YAUnC,SAAS,CAACE,QACN,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACF,WAAW,OAAO,EAAE,OAAO,CAACE;QAC1D;QAEJ,OAAOH;IACX;AACJ;AAEO,MAAMI,wBAAaC,WAAAA,oBAA0C,CAAC;IACjE,gBAAgBT;IAChB,cAAc;QAAC;YAACU;YAAqB;gBAAE,UAAU;YAAK;SAAE;QAAEC;KAAyB;AACvF"}
@@ -176,12 +176,20 @@ export declare const AiSdkToolHandlerResolver: import("@webiny/di").Abstraction<
176
176
  export declare namespace AiSdkToolHandlerResolver {
177
177
  type Interface = IAiSdkToolHandlerResolver;
178
178
  }
179
+ export interface IAiSdkToolSetOptions {
180
+ /**
181
+ * Leave out every tool not declared read-only (see `isReadOnlyTool`). For a run nobody watches,
182
+ * such as content generation: it has no one to approve a change, so it must not be offered one.
183
+ */
184
+ readOnly?: boolean;
185
+ }
179
186
  export interface IAiSdkTools {
180
- getToolSet(): ToolSet;
187
+ getToolSet(options?: IAiSdkToolSetOptions): ToolSet;
181
188
  }
182
189
  /** Collection of AI SDK tools. Returns a ready-to-use ToolSet for generateText/streamText. */
183
190
  export declare const AiSdkTools: import("@webiny/di").Abstraction<IAiSdkTools>;
184
191
  export declare namespace AiSdkTools {
185
192
  type Interface = IAiSdkTools;
193
+ type Options = IAiSdkToolSetOptions;
186
194
  }
187
195
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/abstractions.js","sources":["../../../src/features/ai/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Constructor } from \"@webiny/di\";\nimport type { generateText } from \"ai\";\nimport type { streamText } from \"ai\";\nimport type { LanguageModel } from \"ai\";\nimport type { FlexibleSchema, ToolSet } from \"ai\";\n\n// AiSdk\n\n/**\n * What a model accepts, as published in the model catalog. A capability that isn't listed is unknown,\n * and unknown is treated as unsupported: a parameter the model may reject is not sent.\n */\nexport interface IAiModelSupports {\n tools?: boolean;\n vision?: boolean;\n temperature?: boolean;\n}\n\nexport interface IAiSdkModel {\n id: string; // raw model id, e.g. \"claude-sonnet-4-5\"\n name: string; // human-friendly name, e.g. \"Claude Sonnet 4.5\"\n deprecated?: Date;\n endOfLife?: Date;\n supports?: IAiModelSupports;\n}\n\nexport interface IAiSdk {\n languageModel(modelId: string): LanguageModel;\n}\n\n/** A single AI SDK instance (e.g. OpenAI, Anthropic) that resolves model instances. */\nexport const AiSdk = createAbstraction<IAiSdk>(\"AiSdk\");\n\nexport namespace AiSdk {\n export type Interface = IAiSdk;\n}\n\n// AiSdkFactory\n\nexport interface IAiSdkFactory {\n readonly id: string; // machine id, e.g. \"anthropic\"\n readonly name: string; // human-friendly name, e.g. \"Anthropic\"\n readonly models: readonly IAiSdkModel[]; // static model list, no API call needed\n execute(apiKey?: string): Promise<IAiSdk>;\n}\n\n/** Factory that asynchronously initialises an AI SDK. Register one per provider namespace. */\nexport const AiSdkFactory = createAbstraction<IAiSdkFactory>(\"AiSdkFactory\");\n\nexport namespace AiSdkFactory {\n export type Interface = IAiSdkFactory;\n}\n\n// AiConnection\n\nexport interface IAiConnectionInline {\n readonly sdkName: string;\n readonly apiKey?: string;\n}\n\nexport interface IAiConnection extends IAiConnectionInline {\n readonly id: string;\n}\n\n// AiConnectionFactory\n\nexport interface IAiConnectionFactory {\n execute(): Promise<IAiConnection>;\n}\n\n/** Factory that asynchronously produces an AiConnection. */\nexport const AiConnectionFactory = createAbstraction<IAiConnectionFactory>(\"AiConnectionFactory\");\n\nexport namespace AiConnectionFactory {\n export type Interface = IAiConnectionFactory;\n}\n\n// Ai\n\ntype SDKGenerateTextParams = Parameters<typeof generateText>[0];\ntype SDKStreamTextParams = Parameters<typeof streamText>[0];\n\nexport type AiGenerateTextParams = Omit<SDKGenerateTextParams, \"model\"> & {\n model: string;\n connection?: string | IAiConnectionInline;\n};\nexport type AiStreamTextParams = Omit<SDKStreamTextParams, \"model\"> & {\n model: string;\n connection?: string | IAiConnectionInline;\n};\n\nexport interface AiModel {\n providerId: string; // e.g. \"anthropic\"\n providerName: string; // e.g. \"Anthropic\"\n modelId: string; // e.g. \"claude-sonnet-4-5\"\n modelName: string; // e.g. \"Claude Sonnet 4.5\"\n deprecated: Date | undefined;\n endOfLife: Date | undefined;\n supports: IAiModelSupports | undefined;\n}\n\nexport interface IAi {\n generateText(params: AiGenerateTextParams): ReturnType<typeof generateText>;\n streamText(params: AiStreamTextParams): Promise<ReturnType<typeof streamText>>;\n listModels(): Promise<AiModel[]>;\n listModelsByConnections(): Promise<AiModel[]>;\n listModelsByConnection(connection: string | IAiConnectionInline): Promise<AiModel[]>;\n}\n\n/** Interact with AI language models using registered providers. */\nexport const Ai = createAbstraction<IAi>(\"Ai\");\n\nexport namespace Ai {\n export type Interface = IAi;\n export type GenerateTextParams = AiGenerateTextParams;\n export type StreamTextParams = AiStreamTextParams;\n}\n\n// AiModelRegistry\n\nexport interface IAiModelRegistry {\n listModels(): Promise<AiModel[]>;\n}\n\n/** Single source of truth for available AI models. Decoratable to restrict the model list. */\nexport const AiModelRegistry = createAbstraction<IAiModelRegistry>(\"AiModelRegistry\");\n\nexport namespace AiModelRegistry {\n export type Interface = IAiModelRegistry;\n}\n\n// AiModelCatalog\n\nexport interface AiCatalogProvider {\n id: string; // Matches `AiSdkFactory.id`, e.g. \"anthropic\".\n name: string; // Human-friendly name, e.g. \"Anthropic\".\n models: IAiSdkModel[];\n}\n\nexport interface IAiModelCatalog {\n /** Returns `undefined` when the catalog can't be loaded. */\n listProviders(): Promise<AiCatalogProvider[] | undefined>;\n}\n\n/** The published list of providers and models Webiny supports. SDK factories still gate what is offered. */\nexport const AiModelCatalog = createAbstraction<IAiModelCatalog>(\"AiModelCatalog\");\n\nexport namespace AiModelCatalog {\n export type Interface = IAiModelCatalog;\n}\n\n// AiSdkToolDefinition\n\n/**\n * Behavioural hints about a tool. Purely advisory — they never replace a permission check.\n * Names mirror the MCP tool annotations so they can be forwarded verbatim to MCP clients,\n * which use them to decide what to auto-approve and what to confirm with the user.\n */\nexport interface IAiSdkToolAnnotations {\n /** Tool does not modify state. */\n readOnlyHint?: boolean;\n /** Tool may perform destructive updates (only meaningful when not read-only). */\n destructiveHint?: boolean;\n /** Repeated calls with the same arguments have no additional effect. */\n idempotentHint?: boolean;\n /** Tool interacts with entities outside its own closed world. */\n openWorldHint?: boolean;\n}\n\n/**\n * What a tool DOES. This is the half that injects use cases, so it is built only for a tool the\n * model actually calls, and only at the moment it calls it.\n */\nexport interface IAiSdkToolHandler<TInput = any> {\n execute(input: TInput): Promise<unknown>;\n}\n\n/**\n * What a tool IS: everything the model is told about it, plus the class that runs it.\n *\n * Carries no behaviour and no dependencies, which is what makes the registry cheap to read.\n * `AiSdkTools` builds every definition to assemble the tool set, and builds a handler only for a\n * tool the model actually calls.\n */\nexport interface IAiSdkToolDefinition<TInput = any> {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: FlexibleSchema<TInput>;\n /** Human-friendly display name. Falls back to `name` when omitted. */\n readonly title?: string;\n readonly annotations?: IAiSdkToolAnnotations;\n readonly handler: Constructor<IAiSdkToolHandler<TInput>>;\n}\n\nexport const AiSdkToolDefinition = createAbstraction<IAiSdkToolDefinition>(\"AiSdkToolDefinition\");\n\n/**\n * The behaviour half of a tool, built on demand through {@link AiSdkToolHandlerResolver}.\n *\n * Implementations are NOT registered against this abstraction. The definition points at the class\n * directly, exactly as `HttpRouteDefinition` points at its `HttpRouteHandler`. Declaring them\n * through it is what attaches their dependency metadata.\n */\nexport const AiSdkToolHandler = createAbstraction<IAiSdkToolHandler>(\"AiSdkToolHandler\");\n\nexport namespace AiSdkToolDefinition {\n export type Interface<TInput = any> = IAiSdkToolDefinition<TInput>;\n export type Annotations = IAiSdkToolAnnotations;\n}\n\nexport namespace AiSdkToolHandler {\n export type Interface<TInput = any> = IAiSdkToolHandler<TInput>;\n}\n\n// AiSdkToolHandlerResolver\n\nexport interface IAiSdkToolHandlerResolver {\n resolve<TInput>(handler: Constructor<IAiSdkToolHandler<TInput>>): IAiSdkToolHandler<TInput>;\n}\n\n/**\n * Builds the behaviour half of a tool on demand.\n *\n * Something has to turn `tool.handler` (a class) into an instance, and that needs the container.\n * Rather than injecting the container into the tool registry, it lives behind this one narrow\n * abstraction, so everything else depends on `resolve(handler)` and stays testable with a stub.\n */\nexport const AiSdkToolHandlerResolver = createAbstraction<IAiSdkToolHandlerResolver>(\n \"AiSdkToolHandlerResolver\"\n);\n\nexport namespace AiSdkToolHandlerResolver {\n export type Interface = IAiSdkToolHandlerResolver;\n}\n\n// AiSdkTools\n\nexport interface IAiSdkTools {\n getToolSet(): ToolSet;\n}\n\n/** Collection of AI SDK tools. Returns a ready-to-use ToolSet for generateText/streamText. */\nexport const AiSdkTools = createAbstraction<IAiSdkTools>(\"AiSdkTools\");\n\nexport namespace AiSdkTools {\n export type Interface = IAiSdkTools;\n}\n"],"names":["AiSdk","createAbstraction","AiSdkFactory","AiConnectionFactory","Ai","AiModelRegistry","AiModelCatalog","AiSdkToolDefinition","AiSdkToolHandler","AiSdkToolHandlerResolver","AiSdkTools"],"mappings":";AAgCO,MAAMA,QAAQC,kBAA0B;AAgBxC,MAAMC,eAAeD,kBAAiC;AAwBtD,MAAME,sBAAsBF,kBAAwC;AAuCpE,MAAMG,KAAKH,kBAAuB;AAelC,MAAMI,kBAAkBJ,kBAAoC;AAoB5D,MAAMK,iBAAiBL,kBAAmC;AAiD1D,MAAMM,sBAAsBN,kBAAwC;AASpE,MAAMO,mBAAmBP,kBAAqC;AAwB9D,MAAMQ,2BAA2BR,kBACpC;AAcG,MAAMS,aAAaT,kBAA+B"}
1
+ {"version":3,"file":"features/ai/abstractions.js","sources":["../../../src/features/ai/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Constructor } from \"@webiny/di\";\nimport type { generateText } from \"ai\";\nimport type { streamText } from \"ai\";\nimport type { LanguageModel } from \"ai\";\nimport type { FlexibleSchema, ToolSet } from \"ai\";\n\n// AiSdk\n\n/**\n * What a model accepts, as published in the model catalog. A capability that isn't listed is unknown,\n * and unknown is treated as unsupported: a parameter the model may reject is not sent.\n */\nexport interface IAiModelSupports {\n tools?: boolean;\n vision?: boolean;\n temperature?: boolean;\n}\n\nexport interface IAiSdkModel {\n id: string; // raw model id, e.g. \"claude-sonnet-4-5\"\n name: string; // human-friendly name, e.g. \"Claude Sonnet 4.5\"\n deprecated?: Date;\n endOfLife?: Date;\n supports?: IAiModelSupports;\n}\n\nexport interface IAiSdk {\n languageModel(modelId: string): LanguageModel;\n}\n\n/** A single AI SDK instance (e.g. OpenAI, Anthropic) that resolves model instances. */\nexport const AiSdk = createAbstraction<IAiSdk>(\"AiSdk\");\n\nexport namespace AiSdk {\n export type Interface = IAiSdk;\n}\n\n// AiSdkFactory\n\nexport interface IAiSdkFactory {\n readonly id: string; // machine id, e.g. \"anthropic\"\n readonly name: string; // human-friendly name, e.g. \"Anthropic\"\n readonly models: readonly IAiSdkModel[]; // static model list, no API call needed\n execute(apiKey?: string): Promise<IAiSdk>;\n}\n\n/** Factory that asynchronously initialises an AI SDK. Register one per provider namespace. */\nexport const AiSdkFactory = createAbstraction<IAiSdkFactory>(\"AiSdkFactory\");\n\nexport namespace AiSdkFactory {\n export type Interface = IAiSdkFactory;\n}\n\n// AiConnection\n\nexport interface IAiConnectionInline {\n readonly sdkName: string;\n readonly apiKey?: string;\n}\n\nexport interface IAiConnection extends IAiConnectionInline {\n readonly id: string;\n}\n\n// AiConnectionFactory\n\nexport interface IAiConnectionFactory {\n execute(): Promise<IAiConnection>;\n}\n\n/** Factory that asynchronously produces an AiConnection. */\nexport const AiConnectionFactory = createAbstraction<IAiConnectionFactory>(\"AiConnectionFactory\");\n\nexport namespace AiConnectionFactory {\n export type Interface = IAiConnectionFactory;\n}\n\n// Ai\n\ntype SDKGenerateTextParams = Parameters<typeof generateText>[0];\ntype SDKStreamTextParams = Parameters<typeof streamText>[0];\n\nexport type AiGenerateTextParams = Omit<SDKGenerateTextParams, \"model\"> & {\n model: string;\n connection?: string | IAiConnectionInline;\n};\nexport type AiStreamTextParams = Omit<SDKStreamTextParams, \"model\"> & {\n model: string;\n connection?: string | IAiConnectionInline;\n};\n\nexport interface AiModel {\n providerId: string; // e.g. \"anthropic\"\n providerName: string; // e.g. \"Anthropic\"\n modelId: string; // e.g. \"claude-sonnet-4-5\"\n modelName: string; // e.g. \"Claude Sonnet 4.5\"\n deprecated: Date | undefined;\n endOfLife: Date | undefined;\n supports: IAiModelSupports | undefined;\n}\n\nexport interface IAi {\n generateText(params: AiGenerateTextParams): ReturnType<typeof generateText>;\n streamText(params: AiStreamTextParams): Promise<ReturnType<typeof streamText>>;\n listModels(): Promise<AiModel[]>;\n listModelsByConnections(): Promise<AiModel[]>;\n listModelsByConnection(connection: string | IAiConnectionInline): Promise<AiModel[]>;\n}\n\n/** Interact with AI language models using registered providers. */\nexport const Ai = createAbstraction<IAi>(\"Ai\");\n\nexport namespace Ai {\n export type Interface = IAi;\n export type GenerateTextParams = AiGenerateTextParams;\n export type StreamTextParams = AiStreamTextParams;\n}\n\n// AiModelRegistry\n\nexport interface IAiModelRegistry {\n listModels(): Promise<AiModel[]>;\n}\n\n/** Single source of truth for available AI models. Decoratable to restrict the model list. */\nexport const AiModelRegistry = createAbstraction<IAiModelRegistry>(\"AiModelRegistry\");\n\nexport namespace AiModelRegistry {\n export type Interface = IAiModelRegistry;\n}\n\n// AiModelCatalog\n\nexport interface AiCatalogProvider {\n id: string; // Matches `AiSdkFactory.id`, e.g. \"anthropic\".\n name: string; // Human-friendly name, e.g. \"Anthropic\".\n models: IAiSdkModel[];\n}\n\nexport interface IAiModelCatalog {\n /** Returns `undefined` when the catalog can't be loaded. */\n listProviders(): Promise<AiCatalogProvider[] | undefined>;\n}\n\n/** The published list of providers and models Webiny supports. SDK factories still gate what is offered. */\nexport const AiModelCatalog = createAbstraction<IAiModelCatalog>(\"AiModelCatalog\");\n\nexport namespace AiModelCatalog {\n export type Interface = IAiModelCatalog;\n}\n\n// AiSdkToolDefinition\n\n/**\n * Behavioural hints about a tool. Purely advisory — they never replace a permission check.\n * Names mirror the MCP tool annotations so they can be forwarded verbatim to MCP clients,\n * which use them to decide what to auto-approve and what to confirm with the user.\n */\nexport interface IAiSdkToolAnnotations {\n /** Tool does not modify state. */\n readOnlyHint?: boolean;\n /** Tool may perform destructive updates (only meaningful when not read-only). */\n destructiveHint?: boolean;\n /** Repeated calls with the same arguments have no additional effect. */\n idempotentHint?: boolean;\n /** Tool interacts with entities outside its own closed world. */\n openWorldHint?: boolean;\n}\n\n/**\n * What a tool DOES. This is the half that injects use cases, so it is built only for a tool the\n * model actually calls, and only at the moment it calls it.\n */\nexport interface IAiSdkToolHandler<TInput = any> {\n execute(input: TInput): Promise<unknown>;\n}\n\n/**\n * What a tool IS: everything the model is told about it, plus the class that runs it.\n *\n * Carries no behaviour and no dependencies, which is what makes the registry cheap to read.\n * `AiSdkTools` builds every definition to assemble the tool set, and builds a handler only for a\n * tool the model actually calls.\n */\nexport interface IAiSdkToolDefinition<TInput = any> {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: FlexibleSchema<TInput>;\n /** Human-friendly display name. Falls back to `name` when omitted. */\n readonly title?: string;\n readonly annotations?: IAiSdkToolAnnotations;\n readonly handler: Constructor<IAiSdkToolHandler<TInput>>;\n}\n\nexport const AiSdkToolDefinition = createAbstraction<IAiSdkToolDefinition>(\"AiSdkToolDefinition\");\n\n/**\n * The behaviour half of a tool, built on demand through {@link AiSdkToolHandlerResolver}.\n *\n * Implementations are NOT registered against this abstraction. The definition points at the class\n * directly, exactly as `HttpRouteDefinition` points at its `HttpRouteHandler`. Declaring them\n * through it is what attaches their dependency metadata.\n */\nexport const AiSdkToolHandler = createAbstraction<IAiSdkToolHandler>(\"AiSdkToolHandler\");\n\nexport namespace AiSdkToolDefinition {\n export type Interface<TInput = any> = IAiSdkToolDefinition<TInput>;\n export type Annotations = IAiSdkToolAnnotations;\n}\n\nexport namespace AiSdkToolHandler {\n export type Interface<TInput = any> = IAiSdkToolHandler<TInput>;\n}\n\n// AiSdkToolHandlerResolver\n\nexport interface IAiSdkToolHandlerResolver {\n resolve<TInput>(handler: Constructor<IAiSdkToolHandler<TInput>>): IAiSdkToolHandler<TInput>;\n}\n\n/**\n * Builds the behaviour half of a tool on demand.\n *\n * Something has to turn `tool.handler` (a class) into an instance, and that needs the container.\n * Rather than injecting the container into the tool registry, it lives behind this one narrow\n * abstraction, so everything else depends on `resolve(handler)` and stays testable with a stub.\n */\nexport const AiSdkToolHandlerResolver = createAbstraction<IAiSdkToolHandlerResolver>(\n \"AiSdkToolHandlerResolver\"\n);\n\nexport namespace AiSdkToolHandlerResolver {\n export type Interface = IAiSdkToolHandlerResolver;\n}\n\n// AiSdkTools\n\nexport interface IAiSdkToolSetOptions {\n /**\n * Leave out every tool not declared read-only (see `isReadOnlyTool`). For a run nobody watches,\n * such as content generation: it has no one to approve a change, so it must not be offered one.\n */\n readOnly?: boolean;\n}\n\nexport interface IAiSdkTools {\n getToolSet(options?: IAiSdkToolSetOptions): ToolSet;\n}\n\n/** Collection of AI SDK tools. Returns a ready-to-use ToolSet for generateText/streamText. */\nexport const AiSdkTools = createAbstraction<IAiSdkTools>(\"AiSdkTools\");\n\nexport namespace AiSdkTools {\n export type Interface = IAiSdkTools;\n export type Options = IAiSdkToolSetOptions;\n}\n"],"names":["AiSdk","createAbstraction","AiSdkFactory","AiConnectionFactory","Ai","AiModelRegistry","AiModelCatalog","AiSdkToolDefinition","AiSdkToolHandler","AiSdkToolHandlerResolver","AiSdkTools"],"mappings":";AAgCO,MAAMA,QAAQC,kBAA0B;AAgBxC,MAAMC,eAAeD,kBAAiC;AAwBtD,MAAME,sBAAsBF,kBAAwC;AAuCpE,MAAMG,KAAKH,kBAAuB;AAelC,MAAMI,kBAAkBJ,kBAAoC;AAoB5D,MAAMK,iBAAiBL,kBAAmC;AAiD1D,MAAMM,sBAAsBN,kBAAwC;AASpE,MAAMO,mBAAmBP,kBAAqC;AAwB9D,MAAMQ,2BAA2BR,kBACpC;AAsBG,MAAMS,aAAaT,kBAA+B"}
@@ -1,5 +1,6 @@
1
1
  export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai, AiModelRegistry, AiModelCatalog, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
2
2
  export type { IAiConnection, IAiConnectionInline, AiModel, IAiSdkModel } from "./abstractions.js";
3
+ export { isReadOnlyTool } from "./isReadOnlyTool.js";
3
4
  export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
4
5
  export { TextExtractor, DefaultTextExtractor } from "./TextExtractor/index.js";
5
6
  export { AiBeforeGenerateTextEvent, AiBeforeGenerateTextEventHandler, AiAfterGenerateTextEvent, AiAfterGenerateTextEventHandler, AiGenerateTextErrorEvent, AiGenerateTextErrorEventHandler, AiBeforeStreamTextEvent, AiBeforeStreamTextEventHandler } from "./events.js";
@@ -1,4 +1,5 @@
1
1
  export { Ai, AiConnectionFactory, AiModelCatalog, AiModelRegistry, AiSdk, AiSdkFactory, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
2
+ export { isReadOnlyTool } from "./isReadOnlyTool.js";
2
3
  export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
3
4
  export { DefaultTextExtractor, TextExtractor } from "./TextExtractor/index.js";
4
5
  export { AiAfterGenerateTextEvent, AiAfterGenerateTextEventHandler, AiBeforeGenerateTextEvent, AiBeforeGenerateTextEventHandler, AiBeforeStreamTextEvent, AiBeforeStreamTextEventHandler, AiGenerateTextErrorEvent, AiGenerateTextErrorEventHandler } from "./events.js";
@@ -0,0 +1,9 @@
1
+ import type { AiSdkToolDefinition } from "./abstractions.js";
2
+ /**
3
+ * A tool runs unattended only if it says, in its own declaration, that it does not change anything.
4
+ *
5
+ * The default is deliberately the safe one: a tool with no annotations counts as one that writes.
6
+ * Tools are registered by extensions as well as by Webiny, so an author who forgets to annotate gets
7
+ * a confirm prompt in the assistant, and no place in unattended runs, rather than silent write access.
8
+ */
9
+ export declare const isReadOnlyTool: (tool: AiSdkToolDefinition.Interface) => boolean;
@@ -0,0 +1,4 @@
1
+ const isReadOnlyTool = (tool)=>tool.annotations?.readOnlyHint === true;
2
+ export { isReadOnlyTool };
3
+
4
+ //# sourceMappingURL=isReadOnlyTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/isReadOnlyTool.js","sources":["../../../src/features/ai/isReadOnlyTool.ts"],"sourcesContent":["import type { AiSdkToolDefinition } from \"./abstractions.js\";\n\n/**\n * A tool runs unattended only if it says, in its own declaration, that it does not change anything.\n *\n * The default is deliberately the safe one: a tool with no annotations counts as one that writes.\n * Tools are registered by extensions as well as by Webiny, so an author who forgets to annotate gets\n * a confirm prompt in the assistant, and no place in unattended runs, rather than silent write access.\n */\nexport const isReadOnlyTool = (tool: AiSdkToolDefinition.Interface): boolean =>\n tool.annotations?.readOnlyHint === true;\n"],"names":["isReadOnlyTool","tool"],"mappings":"AASO,MAAMA,iBAAiB,CAACC,OAC3BA,KAAK,WAAW,EAAE,iBAAiB"}
@@ -0,0 +1,8 @@
1
+ import { CdnCache } from "./abstractions.js";
2
+ declare class NullCdnCacheImpl implements CdnCache.Interface {
3
+ invalidate(): Promise<void>;
4
+ }
5
+ export declare const NullCdnCache: typeof NullCdnCacheImpl & {
6
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICdnCache>;
7
+ };
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { CdnCache } from "./abstractions.js";
2
+ class NullCdnCacheImpl {
3
+ async invalidate() {}
4
+ }
5
+ const NullCdnCache = CdnCache.createImplementation({
6
+ implementation: NullCdnCacheImpl,
7
+ dependencies: []
8
+ });
9
+ export { NullCdnCache };
10
+
11
+ //# sourceMappingURL=NullCdnCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/NullCdnCache.js","sources":["../../../src/features/cdnCache/NullCdnCache.ts"],"sourcesContent":["import { CdnCache } from \"./abstractions.js\";\n\n// Default for hosting types (and tests) with no CDN in front of the API.\nclass NullCdnCacheImpl implements CdnCache.Interface {\n async invalidate(): Promise<void> {\n // Nothing to invalidate.\n }\n}\n\nexport const NullCdnCache = CdnCache.createImplementation({\n implementation: NullCdnCacheImpl,\n dependencies: []\n});\n"],"names":["NullCdnCacheImpl","NullCdnCache","CdnCache"],"mappings":";AAGA,MAAMA;IACF,MAAM,aAA4B,CAElC;AACJ;AAEO,MAAMC,eAAeC,SAAS,oBAAoB,CAAC;IACtD,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,20 @@
1
+ export interface ICdnCacheInvalidateParams {
2
+ caller: string;
3
+ paths: string[];
4
+ }
5
+ export interface ICdnCache {
6
+ invalidate(params: ICdnCacheInvalidateParams): Promise<void>;
7
+ }
8
+ /**
9
+ * The CDN cache in front of the API, if the deployment has one. AWS caches API responses in
10
+ * CloudFront, and `@webiny/api-event-handler-aws` supplies the implementation that invalidates them.
11
+ * Standalone has no CDN, so it keeps the default, which has nothing to invalidate.
12
+ *
13
+ * Invalidating is a side effect of a write that has already succeeded, so `invalidate` never
14
+ * rejects: an implementation logs its own failures. Callers await it and carry on.
15
+ */
16
+ export declare const CdnCache: import("@webiny/di").Abstraction<ICdnCache>;
17
+ export declare namespace CdnCache {
18
+ type Interface = ICdnCache;
19
+ type InvalidateParams = ICdnCacheInvalidateParams;
20
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CdnCache = createAbstraction("Core/CdnCache");
3
+ export { CdnCache };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/abstractions.js","sources":["../../../src/features/cdnCache/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ICdnCacheInvalidateParams {\n // Who asked, for the logs, e.g. `wb.redirects`.\n caller: string;\n // API paths to drop from the cache, e.g. `/wb/redirects`.\n paths: string[];\n}\n\nexport interface ICdnCache {\n invalidate(params: ICdnCacheInvalidateParams): Promise<void>;\n}\n\n/**\n * The CDN cache in front of the API, if the deployment has one. AWS caches API responses in\n * CloudFront, and `@webiny/api-event-handler-aws` supplies the implementation that invalidates them.\n * Standalone has no CDN, so it keeps the default, which has nothing to invalidate.\n *\n * Invalidating is a side effect of a write that has already succeeded, so `invalidate` never\n * rejects: an implementation logs its own failures. Callers await it and carry on.\n */\nexport const CdnCache = createAbstraction<ICdnCache>(\"Core/CdnCache\");\n\nexport namespace CdnCache {\n export type Interface = ICdnCache;\n export type InvalidateParams = ICdnCacheInvalidateParams;\n}\n"],"names":["CdnCache","createAbstraction"],"mappings":";AAqBO,MAAMA,WAAWC,kBAA6B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Registers the default, which has nothing to invalidate. A hosting type with a CDN registers its
3
+ * own implementation later in the request stack, which replaces this one.
4
+ */
5
+ export declare const CdnCacheFeature: {
6
+ name: string;
7
+ register(container: import("@webiny/di").Container): void;
8
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { NullCdnCache } from "./NullCdnCache.js";
3
+ const CdnCacheFeature = createFeature({
4
+ name: "CdnCacheFeature",
5
+ register (container) {
6
+ container.register(NullCdnCache);
7
+ }
8
+ });
9
+ export { CdnCacheFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/cdnCache/feature.js","sources":["../../../src/features/cdnCache/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NullCdnCache } from \"./NullCdnCache.js\";\n\n/**\n * Registers the default, which has nothing to invalidate. A hosting type with a CDN registers its\n * own implementation later in the request stack, which replaces this one.\n */\nexport const CdnCacheFeature = createFeature({\n name: \"CdnCacheFeature\",\n register(container) {\n container.register(NullCdnCache);\n }\n});\n"],"names":["CdnCacheFeature","createFeature","container","NullCdnCache"],"mappings":";;AAOO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { CdnCache } from "./abstractions.js";
2
+ export { CdnCacheFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { CdnCache } from "./abstractions.js";
2
+ export { CdnCacheFeature } from "./feature.js";
@@ -0,0 +1,23 @@
1
+ import type { Container } from "@webiny/di";
2
+ export interface IRequestStorage {
3
+ /**
4
+ * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request
5
+ * container. Runs before any domain feature registers, so the features find it there.
6
+ */
7
+ register(container: Container): void | Promise<void>;
8
+ }
9
+ /**
10
+ * The storage a request runs on. A storage registers one implementation per part that owns
11
+ * per-request storage in the root container, once per process; every request container then gets
12
+ * those storages registered first, before the domain features (`registerApiRequestStack`). Several
13
+ * implementations can be registered: each part (the SQL storage, the standalone server's login)
14
+ * brings its own.
15
+ *
16
+ * The root keeps only what outlives a request (the connection, its settings), so a request's
17
+ * storages always come from its own container. A storage that registers its storages in the root
18
+ * instead (the DynamoDB variants) registers none of these.
19
+ */
20
+ export declare const RequestStorage: import("@webiny/di").Abstraction<IRequestStorage>;
21
+ export declare namespace RequestStorage {
22
+ type Interface = IRequestStorage;
23
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const RequestStorage = createAbstraction("Core/RequestStorage");
3
+ export { RequestStorage };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/requestStorage/abstractions.js","sources":["../../../src/features/requestStorage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\n\nexport interface IRequestStorage {\n /**\n * Registers the storage of a part of the API (core, audit logs, websockets, login) in a request\n * container. Runs before any domain feature registers, so the features find it there.\n */\n register(container: Container): void | Promise<void>;\n}\n\n/**\n * The storage a request runs on. A storage registers one implementation per part that owns\n * per-request storage in the root container, once per process; every request container then gets\n * those storages registered first, before the domain features (`registerApiRequestStack`). Several\n * implementations can be registered: each part (the SQL storage, the standalone server's login)\n * brings its own.\n *\n * The root keeps only what outlives a request (the connection, its settings), so a request's\n * storages always come from its own container. A storage that registers its storages in the root\n * instead (the DynamoDB variants) registers none of these.\n */\nexport const RequestStorage = createAbstraction<IRequestStorage>(\"Core/RequestStorage\");\n\nexport namespace RequestStorage {\n export type Interface = IRequestStorage;\n}\n"],"names":["RequestStorage","createAbstraction"],"mappings":";AAsBO,MAAMA,iBAAiBC,kBAAmC"}
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { RequestStorage } from "./abstractions.js";
@@ -0,0 +1,13 @@
1
+ import { CanAccessCurrentTenantUseCase as UseCaseAbstraction } from "./abstractions.js";
2
+ import { IdentityContext } from "../../../features/security/IdentityContext/index.js";
3
+ import { AuthorizationContext } from "../../../features/security/authorization/AuthorizationContext/index.js";
4
+ declare class CanAccessCurrentTenantUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private identityContext;
6
+ private authorizationContext;
7
+ constructor(identityContext: IdentityContext.Interface, authorizationContext: AuthorizationContext.Interface);
8
+ execute(): Promise<boolean>;
9
+ }
10
+ export declare const CanAccessCurrentTenantUseCase: typeof CanAccessCurrentTenantUseCaseImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICanAccessCurrentTenantUseCase>;
12
+ };
13
+ export {};
@@ -0,0 +1,25 @@
1
+ import { CanAccessCurrentTenantUseCase } from "./abstractions.js";
2
+ import { IdentityContext } from "../IdentityContext/index.js";
3
+ import { AuthorizationContext } from "../authorization/AuthorizationContext/index.js";
4
+ class CanAccessCurrentTenantUseCaseImpl {
5
+ constructor(identityContext, authorizationContext){
6
+ this.identityContext = identityContext;
7
+ this.authorizationContext = authorizationContext;
8
+ }
9
+ async execute() {
10
+ const identity = this.identityContext.getIdentity();
11
+ if (identity.isAnonymous()) return false;
12
+ const permissions = await this.authorizationContext.loadPermissions(identity);
13
+ return permissions.length > 0;
14
+ }
15
+ }
16
+ const CanAccessCurrentTenantUseCase_CanAccessCurrentTenantUseCase = CanAccessCurrentTenantUseCase.createImplementation({
17
+ implementation: CanAccessCurrentTenantUseCaseImpl,
18
+ dependencies: [
19
+ IdentityContext,
20
+ AuthorizationContext
21
+ ]
22
+ });
23
+ export { CanAccessCurrentTenantUseCase_CanAccessCurrentTenantUseCase as CanAccessCurrentTenantUseCase };
24
+
25
+ //# sourceMappingURL=CanAccessCurrentTenantUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.js","sources":["../../../../src/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.ts"],"sourcesContent":["import { CanAccessCurrentTenantUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { AuthorizationContext } from \"~/features/security/authorization/AuthorizationContext/index.js\";\n\nclass CanAccessCurrentTenantUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private authorizationContext: AuthorizationContext.Interface\n ) {}\n\n async execute(): Promise<boolean> {\n const identity = this.identityContext.getIdentity();\n if (identity.isAnonymous()) {\n return false;\n }\n\n /*\n * Loaded through AuthorizationContext, not IdentityContext.listPermissions(): with AACL enabled\n * that list always carries an extra `aacl` entry, so it is never empty and the check would\n * always pass.\n */\n const permissions = await this.authorizationContext.loadPermissions(identity);\n return permissions.length > 0;\n }\n}\n\nexport const CanAccessCurrentTenantUseCase = UseCaseAbstraction.createImplementation({\n implementation: CanAccessCurrentTenantUseCaseImpl,\n dependencies: [IdentityContext, AuthorizationContext]\n});\n"],"names":["CanAccessCurrentTenantUseCaseImpl","identityContext","authorizationContext","identity","permissions","CanAccessCurrentTenantUseCase","UseCaseAbstraction","IdentityContext","AuthorizationContext"],"mappings":";;;AAIA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,oBAAoD,CAC9D;aAFUD,eAAe,GAAfA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,UAA4B;QAC9B,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAIA,SAAS,WAAW,IACpB,OAAO;QAQX,MAAMC,cAAc,MAAM,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAACD;QACpE,OAAOC,YAAY,MAAM,GAAG;IAChC;AACJ;AAEO,MAAMC,8DAAgCC,8BAAAA,oBAAuC,CAAC;IACjF,gBAAgBN;IAChB,cAAc;QAACO;QAAiBC;KAAqB;AACzD"}
@@ -0,0 +1,12 @@
1
+ export interface ICanAccessCurrentTenantUseCase {
2
+ execute(): Promise<boolean>;
3
+ }
4
+ /**
5
+ * Whether the current identity may access the current tenant: it is not anonymous and has at least
6
+ * one permission there. For entry points where the client names the tenant and nothing else stops a
7
+ * valid token from being used in a tenant it has no access to, such as a websocket connect.
8
+ */
9
+ export declare const CanAccessCurrentTenantUseCase: import("@webiny/di").Abstraction<ICanAccessCurrentTenantUseCase>;
10
+ export declare namespace CanAccessCurrentTenantUseCase {
11
+ type Interface = ICanAccessCurrentTenantUseCase;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CanAccessCurrentTenantUseCase = createAbstraction("Security/CanAccessCurrentTenantUseCase");
3
+ export { CanAccessCurrentTenantUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/CanAccessCurrentTenant/abstractions.js","sources":["../../../../src/features/security/CanAccessCurrentTenant/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface ICanAccessCurrentTenantUseCase {\n execute(): Promise<boolean>;\n}\n\n/**\n * Whether the current identity may access the current tenant: it is not anonymous and has at least\n * one permission there. For entry points where the client names the tenant and nothing else stops a\n * valid token from being used in a tenant it has no access to, such as a websocket connect.\n */\nexport const CanAccessCurrentTenantUseCase = createAbstraction<ICanAccessCurrentTenantUseCase>(\n \"Security/CanAccessCurrentTenantUseCase\"\n);\n\nexport namespace CanAccessCurrentTenantUseCase {\n export type Interface = ICanAccessCurrentTenantUseCase;\n}\n"],"names":["CanAccessCurrentTenantUseCase","createAbstraction"],"mappings":";AAWO,MAAMA,gCAAgCC,kBACzC"}
@@ -0,0 +1,4 @@
1
+ export declare const CanAccessCurrentTenantFeature: {
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 { CanAccessCurrentTenantUseCase } from "./CanAccessCurrentTenantUseCase.js";
3
+ const CanAccessCurrentTenantFeature = createFeature({
4
+ name: "CanAccessCurrentTenant",
5
+ register (container) {
6
+ container.register(CanAccessCurrentTenantUseCase);
7
+ }
8
+ });
9
+ export { CanAccessCurrentTenantFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/security/CanAccessCurrentTenant/feature.js","sources":["../../../../src/features/security/CanAccessCurrentTenant/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CanAccessCurrentTenantUseCase } from \"./CanAccessCurrentTenantUseCase.js\";\n\nexport const CanAccessCurrentTenantFeature = createFeature({\n name: \"CanAccessCurrentTenant\",\n register(container) {\n container.register(CanAccessCurrentTenantUseCase);\n }\n});\n"],"names":["CanAccessCurrentTenantFeature","createFeature","container","CanAccessCurrentTenantUseCase"],"mappings":";;AAGO,MAAMA,gCAAgCC,cAAc;IACvD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { CanAccessCurrentTenantUseCase } from "./abstractions.js";
2
+ export { CanAccessCurrentTenantFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { CanAccessCurrentTenantUseCase } from "./abstractions.js";
2
+ export { CanAccessCurrentTenantFeature } from "./feature.js";
@@ -7,6 +7,8 @@ import { IdentityContextFeature } from "./IdentityContext/index.js";
7
7
  import { ApiKeysFeature } from "./apiKeys/feature.js";
8
8
  import { TeamsFeature } from "./teams/feature.js";
9
9
  import { RolesFeature } from "./roles/feature.js";
10
+ import { SecurityAiToolsFeature } from "./ai/feature.js";
11
+ import { CanAccessCurrentTenantFeature } from "./CanAccessCurrentTenant/index.js";
10
12
  const SecurityFeature = createFeature({
11
13
  name: "SecurityFeature",
12
14
  register (container, storageOperations) {
@@ -14,10 +16,12 @@ const SecurityFeature = createFeature({
14
16
  AuthorizationContextFeature.register(container);
15
17
  AuthenticationContextFeature.register(container);
16
18
  IdentityContextFeature.register(container);
19
+ CanAccessCurrentTenantFeature.register(container);
17
20
  ApiKeysFeature.register(container);
18
21
  RolesFeature.register(container);
19
22
  TeamsFeature.register(container);
20
23
  GroupsTeamsAuthorizerFeature.register(container);
24
+ SecurityAiToolsFeature.register(container);
21
25
  }
22
26
  });
23
27
  export { SecurityFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/security/SecurityFeature.js","sources":["../../../src/features/security/SecurityFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport type { SecurityStorageOperations as ISecurityStorageOperations } from \"~/types/security.js\";\nimport { SecurityStorageOperations } from \"./shared/abstractions.js\";\nimport { AuthenticationContextFeature } from \"./authentication/AuthenticationContext/index.js\";\nimport { AuthorizationContextFeature } from \"./authorization/AuthorizationContext/index.js\";\nimport { GroupsTeamsAuthorizerFeature } from \"./authorization/GroupsTeamsAuthorizer/feature.js\";\nimport { IdentityContextFeature } from \"./IdentityContext/index.js\";\nimport { ApiKeysFeature } from \"./apiKeys/feature.js\";\nimport { TeamsFeature } from \"./teams/feature.js\";\nimport { RolesFeature } from \"~/features/security/roles/feature.js\";\n\n/**\n * Setup all security features in the DI container.\n * This is the main entry point for registering all security-related features.\n *\n * @param container - DI container instance\n * @param storageOperations - Storage operations implementation\n */\nexport const SecurityFeature = createFeature({\n name: \"SecurityFeature\",\n register(container: Container, storageOperations: ISecurityStorageOperations) {\n // Register storage operations abstraction (singleton)\n container.registerInstance(SecurityStorageOperations, storageOperations);\n\n AuthorizationContextFeature.register(container);\n AuthenticationContextFeature.register(container);\n IdentityContextFeature.register(container);\n ApiKeysFeature.register(container);\n RolesFeature.register(container);\n TeamsFeature.register(container);\n GroupsTeamsAuthorizerFeature.register(container);\n }\n});\n"],"names":["SecurityFeature","createFeature","container","storageOperations","SecurityStorageOperations","AuthorizationContextFeature","AuthenticationContextFeature","IdentityContextFeature","ApiKeysFeature","RolesFeature","TeamsFeature","GroupsTeamsAuthorizerFeature"],"mappings":";;;;;;;;;AAmBO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAoB,EAAEC,iBAA6C;QAExED,UAAU,gBAAgB,CAACE,2BAA2BD;QAEtDE,4BAA4B,QAAQ,CAACH;QACrCI,6BAA6B,QAAQ,CAACJ;QACtCK,uBAAuB,QAAQ,CAACL;QAChCM,eAAe,QAAQ,CAACN;QACxBO,aAAa,QAAQ,CAACP;QACtBQ,aAAa,QAAQ,CAACR;QACtBS,6BAA6B,QAAQ,CAACT;IAC1C;AACJ"}
1
+ {"version":3,"file":"features/security/SecurityFeature.js","sources":["../../../src/features/security/SecurityFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport type { SecurityStorageOperations as ISecurityStorageOperations } from \"~/types/security.js\";\nimport { SecurityStorageOperations } from \"./shared/abstractions.js\";\nimport { AuthenticationContextFeature } from \"./authentication/AuthenticationContext/index.js\";\nimport { AuthorizationContextFeature } from \"./authorization/AuthorizationContext/index.js\";\nimport { GroupsTeamsAuthorizerFeature } from \"./authorization/GroupsTeamsAuthorizer/feature.js\";\nimport { IdentityContextFeature } from \"./IdentityContext/index.js\";\nimport { ApiKeysFeature } from \"./apiKeys/feature.js\";\nimport { TeamsFeature } from \"./teams/feature.js\";\nimport { RolesFeature } from \"~/features/security/roles/feature.js\";\nimport { SecurityAiToolsFeature } from \"./ai/feature.js\";\nimport { CanAccessCurrentTenantFeature } from \"./CanAccessCurrentTenant/index.js\";\n\n/**\n * Setup all security features in the DI container.\n * This is the main entry point for registering all security-related features.\n *\n * @param container - DI container instance\n * @param storageOperations - Storage operations implementation\n */\nexport const SecurityFeature = createFeature({\n name: \"SecurityFeature\",\n register(container: Container, storageOperations: ISecurityStorageOperations) {\n // Register storage operations abstraction (singleton)\n container.registerInstance(SecurityStorageOperations, storageOperations);\n\n AuthorizationContextFeature.register(container);\n AuthenticationContextFeature.register(container);\n IdentityContextFeature.register(container);\n CanAccessCurrentTenantFeature.register(container);\n ApiKeysFeature.register(container);\n RolesFeature.register(container);\n TeamsFeature.register(container);\n GroupsTeamsAuthorizerFeature.register(container);\n SecurityAiToolsFeature.register(container);\n }\n});\n"],"names":["SecurityFeature","createFeature","container","storageOperations","SecurityStorageOperations","AuthorizationContextFeature","AuthenticationContextFeature","IdentityContextFeature","CanAccessCurrentTenantFeature","ApiKeysFeature","RolesFeature","TeamsFeature","GroupsTeamsAuthorizerFeature","SecurityAiToolsFeature"],"mappings":";;;;;;;;;;;AAqBO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAoB,EAAEC,iBAA6C;QAExED,UAAU,gBAAgB,CAACE,2BAA2BD;QAEtDE,4BAA4B,QAAQ,CAACH;QACrCI,6BAA6B,QAAQ,CAACJ;QACtCK,uBAAuB,QAAQ,CAACL;QAChCM,8BAA8B,QAAQ,CAACN;QACvCO,eAAe,QAAQ,CAACP;QACxBQ,aAAa,QAAQ,CAACR;QACtBS,aAAa,QAAQ,CAACT;QACtBU,6BAA6B,QAAQ,CAACV;QACtCW,uBAAuB,QAAQ,CAACX;IACpC;AACJ"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition } from "../../../features/ai/index.js";
3
+ import { AiSdkToolHandler } from "../../../features/ai/index.js";
4
+ import { CreateRoleUseCase } from "../../../features/security/roles/CreateRole/index.js";
5
+ import { GetRoleUseCase } from "../../../features/security/roles/GetRole/index.js";
6
+ declare const inputSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ slug: z.ZodString;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ copyPermissionsFrom: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ type Input = z.infer<typeof inputSchema>;
13
+ interface CreatedRole {
14
+ id: string;
15
+ name: string;
16
+ slug: string;
17
+ /** The role the permissions were copied from, so the reply can say where they came from. */
18
+ permissionsCopiedFrom?: string;
19
+ }
20
+ declare class CreateRoleToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
21
+ private getRole;
22
+ private createRole;
23
+ constructor(getRole: GetRoleUseCase.Interface, createRole: CreateRoleUseCase.Interface);
24
+ execute(input: Input): Promise<CreatedRole>;
25
+ }
26
+ /**
27
+ * Creates a role, empty or with the permissions of an existing one.
28
+ *
29
+ * The model never writes permission objects. They are app-specific records with keys the model
30
+ * would have to guess, and the approval card would show a list of them the user cannot check. A
31
+ * role it creates either starts empty, for the user to fill in on the Roles screen, or copies a
32
+ * role the user names, which the approval shows by id.
33
+ */
34
+ declare class CreateRoleToolImpl implements AiSdkToolDefinition.Interface<Input> {
35
+ readonly name = "createRole";
36
+ readonly title = "Create role";
37
+ readonly description = "Creates a security role. It starts with no permissions, or with a copy of an existing role's permissions when `copyPermissionsFrom` is given (call listRoles for the id). Permissions cannot be written directly; the user edits them on the Roles screen. Requires user approval.";
38
+ readonly inputSchema: z.ZodObject<{
39
+ name: z.ZodString;
40
+ slug: z.ZodString;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ copyPermissionsFrom: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ readonly annotations: {
45
+ readOnlyHint: boolean;
46
+ };
47
+ readonly handler: typeof CreateRoleToolHandlerImpl & {
48
+ __abstraction: import("@webiny/di").Abstraction<import("../../ai/abstractions").IAiSdkToolHandler<any>>;
49
+ };
50
+ }
51
+ export declare const CreateRoleTool: typeof CreateRoleToolImpl & {
52
+ __abstraction: import("@webiny/di").Abstraction<import("../../ai/abstractions").IAiSdkToolDefinition<any>>;
53
+ };
54
+ export {};