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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/ApiCoreFeature.js +12 -2
  2. package/ApiCoreFeature.js.map +1 -1
  3. package/exports/api/security/api-key.d.ts +1 -0
  4. package/exports/api/security/api-key.js +1 -0
  5. package/exports/api/tasks.d.ts +1 -0
  6. package/exports/api/tasks.js +1 -1
  7. package/exports/api.d.ts +1 -1
  8. package/exports/api.js +1 -1
  9. package/features/ai/Ai.d.ts +5 -1
  10. package/features/ai/Ai.js +72 -29
  11. package/features/ai/Ai.js.map +1 -1
  12. package/features/ai/AiModelRegistry.d.ts +14 -0
  13. package/features/ai/AiModelRegistry.js +39 -0
  14. package/features/ai/AiModelRegistry.js.map +1 -0
  15. package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
  16. package/features/ai/AiSdkToolHandlerResolver.js +19 -0
  17. package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
  18. package/features/ai/AiSdkTools.d.ts +4 -3
  19. package/features/ai/AiSdkTools.js +11 -9
  20. package/features/ai/AiSdkTools.js.map +1 -1
  21. package/features/ai/AnthropicSdkFactory.js +24 -4
  22. package/features/ai/AnthropicSdkFactory.js.map +1 -1
  23. package/features/ai/DEVELOPERS.md +183 -0
  24. package/features/ai/GoogleSdkFactory.d.ts +10 -0
  25. package/features/ai/GoogleSdkFactory.js +65 -0
  26. package/features/ai/GoogleSdkFactory.js.map +1 -0
  27. package/features/ai/OpenAiSdkFactory.js +67 -11
  28. package/features/ai/OpenAiSdkFactory.js.map +1 -1
  29. package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
  30. package/features/ai/OpenRouterSdkFactory.js +112 -0
  31. package/features/ai/OpenRouterSdkFactory.js.map +1 -0
  32. package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
  33. package/features/ai/RemoteAiModelCatalog.js +74 -0
  34. package/features/ai/RemoteAiModelCatalog.js.map +1 -0
  35. package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
  36. package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
  37. package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
  38. package/features/ai/TextExtractor/abstractions.d.ts +12 -0
  39. package/features/ai/TextExtractor/abstractions.js +5 -0
  40. package/features/ai/TextExtractor/abstractions.js.map +1 -0
  41. package/features/ai/TextExtractor/index.d.ts +3 -0
  42. package/features/ai/TextExtractor/index.js +2 -0
  43. package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
  44. package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
  45. package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
  46. package/features/ai/abstractions.d.ts +102 -7
  47. package/features/ai/abstractions.js +6 -2
  48. package/features/ai/abstractions.js.map +1 -1
  49. package/features/ai/events.d.ts +59 -0
  50. package/features/ai/events.js +41 -0
  51. package/features/ai/events.js.map +1 -0
  52. package/features/ai/feature.js +12 -0
  53. package/features/ai/feature.js.map +1 -1
  54. package/features/ai/index.d.ts +5 -3
  55. package/features/ai/index.js +3 -1
  56. package/features/dateFormatter/DefaultDateFormatter.d.ts +15 -0
  57. package/features/dateFormatter/DefaultDateFormatter.js +20 -0
  58. package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
  59. package/features/dateFormatter/abstractions.d.ts +13 -0
  60. package/features/dateFormatter/abstractions.js +5 -0
  61. package/features/dateFormatter/abstractions.js.map +1 -0
  62. package/features/dateFormatter/feature.d.ts +4 -0
  63. package/features/dateFormatter/feature.js +11 -0
  64. package/features/dateFormatter/feature.js.map +1 -0
  65. package/features/dateFormatter/index.d.ts +3 -0
  66. package/features/dateFormatter/index.js +2 -0
  67. package/features/debugger/Debugger.d.ts +30 -0
  68. package/features/debugger/Debugger.js +142 -0
  69. package/features/debugger/Debugger.js.map +1 -0
  70. package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
  71. package/features/debugger/DebuggerRouteDecorator.js +102 -0
  72. package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
  73. package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
  74. package/features/debugger/GraphQLDebuggerTransport.js +45 -0
  75. package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
  76. package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
  77. package/features/debugger/__tests__/matchNamespace.test.js +68 -0
  78. package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
  79. package/features/debugger/__tests__/serialize.test.d.ts +1 -0
  80. package/features/debugger/__tests__/serialize.test.js +220 -0
  81. package/features/debugger/__tests__/serialize.test.js.map +1 -0
  82. package/features/debugger/abstractions.d.ts +100 -0
  83. package/features/debugger/abstractions.js +6 -0
  84. package/features/debugger/abstractions.js.map +1 -0
  85. package/features/debugger/feature.d.ts +5 -0
  86. package/features/debugger/feature.js +15 -0
  87. package/features/debugger/feature.js.map +1 -0
  88. package/features/debugger/index.d.ts +12 -0
  89. package/features/debugger/index.js +7 -0
  90. package/features/debugger/limits.d.ts +18 -0
  91. package/features/debugger/limits.js +11 -0
  92. package/features/debugger/limits.js.map +1 -0
  93. package/features/debugger/matchNamespace.d.ts +14 -0
  94. package/features/debugger/matchNamespace.js +35 -0
  95. package/features/debugger/matchNamespace.js.map +1 -0
  96. package/features/debugger/parseNamespaceHeader.d.ts +7 -0
  97. package/features/debugger/parseNamespaceHeader.js +16 -0
  98. package/features/debugger/parseNamespaceHeader.js.map +1 -0
  99. package/features/debugger/permissions.d.ts +14 -0
  100. package/features/debugger/permissions.js +8 -0
  101. package/features/debugger/permissions.js.map +1 -0
  102. package/features/debugger/permissionsSchema.d.ts +17 -0
  103. package/features/debugger/permissionsSchema.js +18 -0
  104. package/features/debugger/permissionsSchema.js.map +1 -0
  105. package/features/debugger/serialize.d.ts +11 -0
  106. package/features/debugger/serialize.js +121 -0
  107. package/features/debugger/serialize.js.map +1 -0
  108. package/features/encryption/BuildParamsEncryptionConfig.d.ts +13 -0
  109. package/features/encryption/BuildParamsEncryptionConfig.js +19 -0
  110. package/features/encryption/BuildParamsEncryptionConfig.js.map +1 -0
  111. package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
  112. package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
  113. package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
  114. package/features/encryption/EncryptionService.d.ts +3 -2
  115. package/features/encryption/EncryptionService.js +15 -13
  116. package/features/encryption/EncryptionService.js.map +1 -1
  117. package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
  118. package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
  119. package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
  120. package/features/encryption/abstractions.d.ts +26 -0
  121. package/features/encryption/abstractions.js +3 -1
  122. package/features/encryption/abstractions.js.map +1 -1
  123. package/features/encryption/feature.js +2 -0
  124. package/features/encryption/feature.js.map +1 -1
  125. package/features/encryption/index.d.ts +3 -0
  126. package/features/encryption/index.js +3 -1
  127. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
  128. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +61 -0
  129. package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
  130. package/features/hashing/BuildParamsHashingConfig.d.ts +11 -0
  131. package/features/hashing/BuildParamsHashingConfig.js +18 -0
  132. package/features/hashing/BuildParamsHashingConfig.js.map +1 -0
  133. package/features/hashing/ScryptHasher.d.ts +2 -2
  134. package/features/hashing/ScryptHasher.js +6 -8
  135. package/features/hashing/ScryptHasher.js.map +1 -1
  136. package/features/hashing/abstractions.d.ts +15 -0
  137. package/features/hashing/abstractions.js +2 -1
  138. package/features/hashing/abstractions.js.map +1 -1
  139. package/features/hashing/feature.js +2 -0
  140. package/features/hashing/feature.js.map +1 -1
  141. package/features/hashing/index.d.ts +1 -0
  142. package/features/hashing/index.js +1 -1
  143. package/features/httpClient/HttpClient.d.ts +7 -0
  144. package/features/httpClient/HttpClient.js +72 -0
  145. package/features/httpClient/HttpClient.js.map +1 -0
  146. package/features/httpClient/HttpRequestError.d.ts +10 -0
  147. package/features/httpClient/HttpRequestError.js +13 -0
  148. package/features/httpClient/HttpRequestError.js.map +1 -0
  149. package/features/httpClient/HttpStatusError.d.ts +12 -0
  150. package/features/httpClient/HttpStatusError.js +12 -0
  151. package/features/httpClient/HttpStatusError.js.map +1 -0
  152. package/features/httpClient/abstractions.d.ts +32 -0
  153. package/features/httpClient/abstractions.js +5 -0
  154. package/features/httpClient/abstractions.js.map +1 -0
  155. package/features/httpClient/feature.d.ts +4 -0
  156. package/features/httpClient/feature.js +11 -0
  157. package/features/httpClient/feature.js.map +1 -0
  158. package/features/httpClient/index.d.ts +3 -0
  159. package/features/httpClient/index.js +3 -0
  160. package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
  161. package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
  162. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  163. package/features/keyValueStore/KeyValueStore.d.ts +6 -2
  164. package/features/keyValueStore/KeyValueStore.js +13 -3
  165. package/features/keyValueStore/KeyValueStore.js.map +1 -1
  166. package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
  167. package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
  168. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  169. package/features/keyValueStore/abstractions.d.ts +132 -14
  170. package/features/keyValueStore/abstractions.js.map +1 -1
  171. package/features/keyValueStore/errors.d.ts +29 -0
  172. package/features/keyValueStore/errors.js +49 -1
  173. package/features/keyValueStore/errors.js.map +1 -1
  174. package/features/keyValueStore/index.d.ts +4 -1
  175. package/features/keyValueStore/index.js +1 -1
  176. package/features/logger/NullLogger.d.ts +10 -0
  177. package/features/logger/NullLogger.js +12 -0
  178. package/features/logger/NullLogger.js.map +1 -0
  179. package/features/logger/index.d.ts +1 -0
  180. package/features/logger/index.js +1 -0
  181. package/features/publicUrls/NullPublicUrls.d.ts +11 -0
  182. package/features/publicUrls/NullPublicUrls.js +17 -0
  183. package/features/publicUrls/NullPublicUrls.js.map +1 -0
  184. package/features/publicUrls/PublicUrl.d.ts +24 -0
  185. package/features/publicUrls/PublicUrl.js +43 -0
  186. package/features/publicUrls/PublicUrl.js.map +1 -0
  187. package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
  188. package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
  189. package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
  190. package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
  191. package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
  192. package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
  193. package/features/publicUrls/abstractions.d.ts +27 -0
  194. package/features/publicUrls/abstractions.js +5 -0
  195. package/features/publicUrls/abstractions.js.map +1 -0
  196. package/features/publicUrls/feature.d.ts +8 -0
  197. package/features/publicUrls/feature.js +11 -0
  198. package/features/publicUrls/feature.js.map +1 -0
  199. package/features/publicUrls/index.d.ts +3 -0
  200. package/features/publicUrls/index.js +3 -0
  201. package/features/requestContext/RawAssumePermissions.d.ts +14 -0
  202. package/features/requestContext/RawAssumePermissions.js +19 -0
  203. package/features/requestContext/RawAssumePermissions.js.map +1 -0
  204. package/features/requestContext/abstractions.d.ts +22 -0
  205. package/features/requestContext/abstractions.js +2 -1
  206. package/features/requestContext/abstractions.js.map +1 -1
  207. package/features/requestContext/extractAssumePermissions.d.ts +14 -0
  208. package/features/requestContext/extractAssumePermissions.js +32 -0
  209. package/features/requestContext/extractAssumePermissions.js.map +1 -0
  210. package/features/requestContext/feature.d.ts +2 -1
  211. package/features/requestContext/feature.js +2 -0
  212. package/features/requestContext/feature.js.map +1 -1
  213. package/features/requestContext/index.d.ts +3 -1
  214. package/features/requestContext/index.js +2 -1
  215. package/features/security/IdentityContext/IdentityContext.d.ts +8 -4
  216. package/features/security/IdentityContext/IdentityContext.js +28 -11
  217. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  218. package/features/security/IdentityContext/abstractions.d.ts +6 -1
  219. package/features/security/IdentityContext/abstractions.js.map +1 -1
  220. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
  221. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  222. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
  223. package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
  224. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
  225. package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
  226. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
  227. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  228. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
  229. package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
  230. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
  231. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  232. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
  233. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  234. package/features/security/apiKeys/feature.js +7 -2
  235. package/features/security/apiKeys/feature.js.map +1 -1
  236. package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
  237. package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
  238. package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
  239. package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
  240. package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
  241. package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
  242. package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
  243. package/features/security/apiKeys/shared/generateToken.js.map +1 -1
  244. package/features/security/apiKeys/shared/schemas.d.ts +2 -2
  245. package/features/security/apiKeys/shared/schemas.js +2 -2
  246. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  247. package/features/security/apiKeys/shared/types.d.ts +1 -1
  248. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +13 -3
  249. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +35 -22
  250. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  251. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  252. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  253. package/features/security/authorization/AuthorizationContext/feature.js +6 -1
  254. package/features/security/authorization/AuthorizationContext/feature.js.map +1 -1
  255. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
  256. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
  257. package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
  258. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +3 -3
  259. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
  260. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
  261. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
  262. package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
  263. package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
  264. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  265. package/features/security/roles/CreateRole/schema.d.ts +1 -1
  266. package/features/security/roles/CreateRole/schema.js +1 -1
  267. package/features/security/roles/CreateRole/schema.js.map +1 -1
  268. package/features/security/roles/Installer/RolesInstaller.js +1 -0
  269. package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
  270. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
  271. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  272. package/features/security/roles/UpdateRole/schema.d.ts +1 -1
  273. package/features/security/roles/UpdateRole/schema.js +1 -1
  274. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  275. package/features/security/shared/description.d.ts +4 -0
  276. package/features/security/shared/description.js +7 -0
  277. package/features/security/shared/description.js.map +1 -0
  278. package/features/security/shared/index.d.ts +1 -0
  279. package/features/security/shared/index.js +1 -0
  280. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +3 -1
  281. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
  282. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  283. package/features/security/teams/CreateTeam/schema.d.ts +1 -1
  284. package/features/security/teams/CreateTeam/schema.js +1 -1
  285. package/features/security/teams/CreateTeam/schema.js.map +1 -1
  286. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
  287. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
  288. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  289. package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
  290. package/features/security/teams/UpdateTeam/schema.js +1 -1
  291. package/features/security/teams/UpdateTeam/schema.js.map +1 -1
  292. package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
  293. package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
  294. package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
  295. package/features/slugify/DefaultSlugify.d.ts +8 -0
  296. package/features/slugify/DefaultSlugify.js +20 -0
  297. package/features/slugify/DefaultSlugify.js.map +1 -0
  298. package/features/slugify/abstractions.d.ts +12 -0
  299. package/features/slugify/abstractions.js +5 -0
  300. package/features/slugify/abstractions.js.map +1 -0
  301. package/features/{logger → slugify}/feature.d.ts +1 -1
  302. package/features/slugify/feature.js +11 -0
  303. package/features/slugify/feature.js.map +1 -0
  304. package/features/slugify/index.d.ts +3 -0
  305. package/features/slugify/index.js +2 -0
  306. package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
  307. package/features/stringFormatter/DefaultStringFormatter.js +19 -0
  308. package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
  309. package/features/stringFormatter/abstractions.d.ts +11 -0
  310. package/features/stringFormatter/abstractions.js +5 -0
  311. package/features/stringFormatter/abstractions.js.map +1 -0
  312. package/features/stringFormatter/feature.d.ts +4 -0
  313. package/features/stringFormatter/feature.js +13 -0
  314. package/features/stringFormatter/feature.js.map +1 -0
  315. package/features/stringFormatter/index.d.ts +3 -0
  316. package/features/stringFormatter/index.js +2 -0
  317. package/features/task/TaskDefinition/abstractions.d.ts +69 -4
  318. package/features/task/TaskDefinition/abstractions.js +2 -1
  319. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  320. package/features/tenancy/TenantContext/TenantContext.d.ts +5 -1
  321. package/features/tenancy/TenantContext/TenantContext.js +31 -23
  322. package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
  323. package/features/users/shared/loaders.js.map +1 -1
  324. package/features/users/shared/types.d.ts +9 -7
  325. package/features/wcp/WcpContext/WcpContext.d.ts +11 -0
  326. package/features/wcp/WcpContext/WcpContext.js +33 -0
  327. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  328. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +14 -60
  329. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +77 -25
  330. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  331. package/features/wcp/WcpFeature.js +2 -0
  332. package/features/wcp/WcpFeature.js.map +1 -1
  333. package/features/wcp/WcpLicenseLoader.d.ts +25 -0
  334. package/features/wcp/WcpLicenseLoader.js +58 -0
  335. package/features/wcp/WcpLicenseLoader.js.map +1 -0
  336. package/features/wcp/WcpLicenseProvider.d.ts +6 -14
  337. package/features/wcp/WcpLicenseProvider.js +3 -7
  338. package/features/wcp/WcpLicenseProvider.js.map +1 -1
  339. package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
  340. package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
  341. package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
  342. package/graphql/ApiCoreSchemaFactory.d.ts +1 -0
  343. package/graphql/ApiCoreSchemaFactory.js +7 -1
  344. package/graphql/ApiCoreSchemaFactory.js.map +1 -1
  345. package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +10 -0
  346. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +53 -0
  347. package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
  348. package/graphql/security/SecuritySchemaFactory.d.ts +1 -0
  349. package/graphql/security/SecuritySchemaFactory.js +4 -0
  350. package/graphql/security/SecuritySchemaFactory.js.map +1 -1
  351. package/graphql/system/SystemSchemaFactory.d.ts +1 -0
  352. package/graphql/system/SystemSchemaFactory.js +4 -0
  353. package/graphql/system/SystemSchemaFactory.js.map +1 -1
  354. package/graphql/users/UsersSchemaFactory.d.ts +1 -0
  355. package/graphql/users/UsersSchemaFactory.js +4 -0
  356. package/graphql/users/UsersSchemaFactory.js.map +1 -1
  357. package/graphql/wcp/WcpSchemaFactory.d.ts +1 -0
  358. package/graphql/wcp/WcpSchemaFactory.js +6 -0
  359. package/graphql/wcp/WcpSchemaFactory.js.map +1 -1
  360. package/idp/JwksCache.d.ts +14 -3
  361. package/idp/JwksCache.js +97 -17
  362. package/idp/JwksCache.js.map +1 -1
  363. package/idp/JwksStoreFeature.d.ts +8 -0
  364. package/idp/JwksStoreFeature.js +11 -0
  365. package/idp/JwksStoreFeature.js.map +1 -0
  366. package/idp/MemoryJwksStore.d.ts +14 -0
  367. package/idp/MemoryJwksStore.js +21 -0
  368. package/idp/MemoryJwksStore.js.map +1 -0
  369. package/idp/OidcJwtIdentityProvider.js +5 -1
  370. package/idp/OidcJwtIdentityProvider.js.map +1 -1
  371. package/idp/abstractions.d.ts +24 -0
  372. package/idp/abstractions.js +2 -1
  373. package/idp/abstractions.js.map +1 -1
  374. package/idp/feature.js +1 -2
  375. package/idp/feature.js.map +1 -1
  376. package/idp/index.d.ts +1 -0
  377. package/idp/index.js +1 -0
  378. package/package.json +22 -22
  379. package/testing/environment.d.ts +14 -0
  380. package/testing/environment.js +18 -0
  381. package/testing/environment.js.map +1 -0
  382. package/types/security.d.ts +1 -1
  383. package/types/users.d.ts +2 -3
  384. package/features/logger/LoggerService.d.ts +0 -14
  385. package/features/logger/LoggerService.js +0 -48
  386. package/features/logger/LoggerService.js.map +0 -1
  387. package/features/logger/feature.js +0 -11
  388. package/features/logger/feature.js.map +0 -1
  389. package/features/wcp/loadWcpLicense.d.ts +0 -2
  390. package/features/wcp/loadWcpLicense.js +0 -51
  391. package/features/wcp/loadWcpLicense.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ import { TextExtractor } from "./abstractions.js";
2
+ import { extractDocxText } from "./parsers/docxParser.js";
3
+ const TEXT_MIME_PREFIX = "text/";
4
+ const SUPPORTED_MIME_TYPES = new Set([
5
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
6
+ "application/json"
7
+ ]);
8
+ class TextExtractorImpl {
9
+ canExtract(mimeType) {
10
+ return mimeType.startsWith(TEXT_MIME_PREFIX) || SUPPORTED_MIME_TYPES.has(mimeType);
11
+ }
12
+ async extract(buffer, mimeType) {
13
+ if (mimeType.startsWith(TEXT_MIME_PREFIX) || "application/json" === mimeType) return {
14
+ text: buffer.toString("utf-8")
15
+ };
16
+ if ("application/vnd.openxmlformats-officedocument.wordprocessingml.document" === mimeType) return {
17
+ text: await extractDocxText(buffer)
18
+ };
19
+ throw new Error(`Unsupported MIME type: ${mimeType}`);
20
+ }
21
+ }
22
+ const DefaultTextExtractor = TextExtractor.createImplementation({
23
+ implementation: TextExtractorImpl,
24
+ dependencies: []
25
+ });
26
+ export { DefaultTextExtractor };
27
+
28
+ //# sourceMappingURL=DefaultTextExtractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/TextExtractor/DefaultTextExtractor.js","sources":["../../../../src/features/ai/TextExtractor/DefaultTextExtractor.ts"],"sourcesContent":["import { TextExtractor, type TextExtractorResult } from \"./abstractions.js\";\nimport { extractDocxText } from \"./parsers/docxParser.js\";\n\nconst TEXT_MIME_PREFIX = \"text/\";\n\nconst SUPPORTED_MIME_TYPES = new Set([\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \"application/json\"\n]);\n\nclass TextExtractorImpl implements TextExtractor.Interface {\n canExtract(mimeType: string): boolean {\n return mimeType.startsWith(TEXT_MIME_PREFIX) || SUPPORTED_MIME_TYPES.has(mimeType);\n }\n\n async extract(buffer: Buffer, mimeType: string): Promise<TextExtractorResult> {\n if (mimeType.startsWith(TEXT_MIME_PREFIX) || mimeType === \"application/json\") {\n return { text: buffer.toString(\"utf-8\") };\n }\n\n if (\n mimeType === \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"\n ) {\n return { text: await extractDocxText(buffer) };\n }\n\n throw new Error(`Unsupported MIME type: ${mimeType}`);\n }\n}\n\nexport const DefaultTextExtractor = TextExtractor.createImplementation({\n implementation: TextExtractorImpl,\n dependencies: []\n});\n"],"names":["TEXT_MIME_PREFIX","SUPPORTED_MIME_TYPES","Set","TextExtractorImpl","mimeType","buffer","extractDocxText","Error","DefaultTextExtractor","TextExtractor"],"mappings":";;AAGA,MAAMA,mBAAmB;AAEzB,MAAMC,uBAAuB,IAAIC,IAAI;IACjC;IACA;CACH;AAED,MAAMC;IACF,WAAWC,QAAgB,EAAW;QAClC,OAAOA,SAAS,UAAU,CAACJ,qBAAqBC,qBAAqB,GAAG,CAACG;IAC7E;IAEA,MAAM,QAAQC,MAAc,EAAED,QAAgB,EAAgC;QAC1E,IAAIA,SAAS,UAAU,CAACJ,qBAAqBI,AAAa,uBAAbA,UACzC,OAAO;YAAE,MAAMC,OAAO,QAAQ,CAAC;QAAS;QAG5C,IACID,AAAa,8EAAbA,UAEA,OAAO;YAAE,MAAM,MAAME,gBAAgBD;QAAQ;QAGjD,MAAM,IAAIE,MAAM,CAAC,uBAAuB,EAAEH,UAAU;IACxD;AACJ;AAEO,MAAMI,uBAAuBC,cAAc,oBAAoB,CAAC;IACnE,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,12 @@
1
+ export interface TextExtractorResult {
2
+ text: string;
3
+ }
4
+ export interface ITextExtractor {
5
+ canExtract(mimeType: string): boolean;
6
+ extract(buffer: Buffer, mimeType: string): Promise<TextExtractorResult>;
7
+ }
8
+ export declare const TextExtractor: import("@webiny/di").Abstraction<ITextExtractor>;
9
+ export declare namespace TextExtractor {
10
+ type Interface = ITextExtractor;
11
+ type Result = TextExtractorResult;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const TextExtractor = createAbstraction("TextExtractor");
3
+ export { TextExtractor };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/TextExtractor/abstractions.js","sources":["../../../../src/features/ai/TextExtractor/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface TextExtractorResult {\n text: string;\n}\n\nexport interface ITextExtractor {\n canExtract(mimeType: string): boolean;\n extract(buffer: Buffer, mimeType: string): Promise<TextExtractorResult>;\n}\n\nexport const TextExtractor = createAbstraction<ITextExtractor>(\"TextExtractor\");\n\nexport namespace TextExtractor {\n export type Interface = ITextExtractor;\n export type Result = TextExtractorResult;\n}\n"],"names":["TextExtractor","createAbstraction"],"mappings":";AAWO,MAAMA,gBAAgBC,kBAAkC"}
@@ -0,0 +1,3 @@
1
+ export { TextExtractor } from "./abstractions.js";
2
+ export type { ITextExtractor, TextExtractorResult } from "./abstractions.js";
3
+ export { DefaultTextExtractor } from "./DefaultTextExtractor.js";
@@ -0,0 +1,2 @@
1
+ export { TextExtractor } from "./abstractions.js";
2
+ export { DefaultTextExtractor } from "./DefaultTextExtractor.js";
@@ -0,0 +1 @@
1
+ export declare function extractDocxText(buffer: Buffer): Promise<string>;
@@ -0,0 +1,111 @@
1
+ import { inflateRawSync } from "node:zlib";
2
+ async function extractDocxText(buffer) {
3
+ const xml = extractFileFromZip(buffer, "word/document.xml");
4
+ if (!xml) throw new Error("Invalid DOCX: word/document.xml not found.");
5
+ const stylesXml = extractFileFromZip(buffer, "word/styles.xml");
6
+ const styleMap = stylesXml ? buildStyleMap(stylesXml) : new Map();
7
+ return convertToMarkdown(xml, styleMap);
8
+ }
9
+ function buildStyleMap(stylesXml) {
10
+ const map = new Map();
11
+ const styleRegex = /<w:style\s[^>]*w:styleId="([^"]*)"[^>]*>[\s\S]*?<\/w:style>/g;
12
+ let match;
13
+ while(null !== (match = styleRegex.exec(stylesXml))){
14
+ const styleId = match[1];
15
+ const block = match[0];
16
+ const nameMatch = block.match(/<w:name\s+w:val="([^"]*)"/);
17
+ if (nameMatch) map.set(styleId, nameMatch[1]);
18
+ }
19
+ return map;
20
+ }
21
+ function getHeadingLevel(paragraphXml, styleMap) {
22
+ const styleMatch = paragraphXml.match(/<w:pStyle\s+w:val="([^"]*)"/);
23
+ if (!styleMatch) return 0;
24
+ const styleId = styleMatch[1];
25
+ const directMatch = styleId.match(/^[Hh]eading(\d)$/);
26
+ if (directMatch) return parseInt(directMatch[1], 10);
27
+ const styleName = styleMap.get(styleId) ?? "";
28
+ const nameMatch = styleName.match(/^[Hh]eading\s*(\d)$/);
29
+ if (nameMatch) return parseInt(nameMatch[1], 10);
30
+ if (/title/i.test(styleName) || /title/i.test(styleId)) return 1;
31
+ return 0;
32
+ }
33
+ function isListItem(paragraphXml) {
34
+ return /<w:numId\s/.test(paragraphXml);
35
+ }
36
+ function extractRunMarkdown(runXml) {
37
+ const textRegex = /<w:t(?:\s[^>]*)?>([^<]*)<\/w:t>/g;
38
+ const texts = [];
39
+ let match;
40
+ while(null !== (match = textRegex.exec(runXml)))texts.push(match[1]);
41
+ if (0 === texts.length) return "";
42
+ const text = texts.join("");
43
+ const isBold = /<w:b[\s/>]/.test(runXml) && !/<w:b\s+w:val="(false|0)"/.test(runXml);
44
+ const isItalic = /<w:i[\s/>]/.test(runXml) && !/<w:i\s+w:val="(false|0)"/.test(runXml);
45
+ if (isBold && isItalic) return `***${text}***`;
46
+ if (isBold) return `**${text}**`;
47
+ if (isItalic) return `*${text}*`;
48
+ return text;
49
+ }
50
+ function convertToMarkdown(xml, styleMap) {
51
+ const paragraphs = [];
52
+ const paragraphRegex = /<w:p[\s>][\s\S]*?<\/w:p>/g;
53
+ let paragraphMatch;
54
+ while(null !== (paragraphMatch = paragraphRegex.exec(xml))){
55
+ const paragraphXml = paragraphMatch[0];
56
+ const runRegex = /<w:r[\s>][\s\S]*?<\/w:r>/g;
57
+ const runs = [];
58
+ let runMatch;
59
+ while(null !== (runMatch = runRegex.exec(paragraphXml))){
60
+ const md = extractRunMarkdown(runMatch[0]);
61
+ if (md) runs.push(md);
62
+ }
63
+ if (0 === runs.length) continue;
64
+ let line = runs.join("");
65
+ const headingLevel = getHeadingLevel(paragraphXml, styleMap);
66
+ if (headingLevel > 0 && headingLevel <= 6) line = `${"#".repeat(headingLevel)} ${line}`;
67
+ else if (isListItem(paragraphXml)) line = `- ${line}`;
68
+ paragraphs.push(line);
69
+ }
70
+ return paragraphs.join("\n\n");
71
+ }
72
+ function extractFileFromZip(buffer, targetPath) {
73
+ const eocdOffset = findEocd(buffer);
74
+ if (-1 === eocdOffset) throw new Error("Invalid ZIP: End of Central Directory not found.");
75
+ const cdOffset = buffer.readUInt32LE(eocdOffset + 16);
76
+ const cdSize = buffer.readUInt32LE(eocdOffset + 12);
77
+ const cdEnd = cdOffset + cdSize;
78
+ let offset = cdOffset;
79
+ while(offset < cdEnd){
80
+ const sig = buffer.readUInt32LE(offset);
81
+ if (0x02014b50 !== sig) break;
82
+ const compressionMethod = buffer.readUInt16LE(offset + 10);
83
+ const compressedSize = buffer.readUInt32LE(offset + 20);
84
+ const fileNameLen = buffer.readUInt16LE(offset + 28);
85
+ const extraLen = buffer.readUInt16LE(offset + 30);
86
+ const commentLen = buffer.readUInt16LE(offset + 32);
87
+ const localHeaderOffset = buffer.readUInt32LE(offset + 42);
88
+ const fileName = buffer.toString("utf-8", offset + 46, offset + 46 + fileNameLen);
89
+ if (fileName === targetPath) return readLocalFile(buffer, localHeaderOffset, compressionMethod, compressedSize);
90
+ offset += 46 + fileNameLen + extraLen + commentLen;
91
+ }
92
+ return null;
93
+ }
94
+ function readLocalFile(buffer, offset, compressionMethod, compressedSize) {
95
+ const sig = buffer.readUInt32LE(offset);
96
+ if (0x04034b50 !== sig) throw new Error("Invalid ZIP: bad local file header.");
97
+ const localFileNameLen = buffer.readUInt16LE(offset + 26);
98
+ const localExtraLen = buffer.readUInt16LE(offset + 28);
99
+ const dataOffset = offset + 30 + localFileNameLen + localExtraLen;
100
+ const raw = buffer.subarray(dataOffset, dataOffset + compressedSize);
101
+ if (0 === compressionMethod) return raw.toString("utf-8");
102
+ if (8 === compressionMethod) return inflateRawSync(raw).toString("utf-8");
103
+ throw new Error(`Unsupported ZIP compression method: ${compressionMethod}`);
104
+ }
105
+ function findEocd(buffer) {
106
+ for(let i = buffer.length - 22; i >= Math.max(0, buffer.length - 65557); i--)if (0x06054b50 === buffer.readUInt32LE(i)) return i;
107
+ return -1;
108
+ }
109
+ export { extractDocxText };
110
+
111
+ //# sourceMappingURL=docxParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/TextExtractor/parsers/docxParser.js","sources":["../../../../../src/features/ai/TextExtractor/parsers/docxParser.ts"],"sourcesContent":["import { inflateRawSync } from \"node:zlib\";\n\nexport async function extractDocxText(buffer: Buffer): Promise<string> {\n const xml = extractFileFromZip(buffer, \"word/document.xml\");\n if (!xml) {\n throw new Error(\"Invalid DOCX: word/document.xml not found.\");\n }\n\n const stylesXml = extractFileFromZip(buffer, \"word/styles.xml\");\n const styleMap = stylesXml ? buildStyleMap(stylesXml) : new Map<string, string>();\n\n return convertToMarkdown(xml, styleMap);\n}\n\nfunction buildStyleMap(stylesXml: string): Map<string, string> {\n const map = new Map<string, string>();\n const styleRegex = /<w:style\\s[^>]*w:styleId=\"([^\"]*)\"[^>]*>[\\s\\S]*?<\\/w:style>/g;\n let match: RegExpExecArray | null;\n\n while ((match = styleRegex.exec(stylesXml)) !== null) {\n const styleId = match[1];\n const block = match[0];\n const nameMatch = block.match(/<w:name\\s+w:val=\"([^\"]*)\"/);\n if (nameMatch) {\n map.set(styleId, nameMatch[1]);\n }\n }\n\n return map;\n}\n\nfunction getHeadingLevel(paragraphXml: string, styleMap: Map<string, string>): number {\n const styleMatch = paragraphXml.match(/<w:pStyle\\s+w:val=\"([^\"]*)\"/);\n if (!styleMatch) {\n return 0;\n }\n\n const styleId = styleMatch[1];\n\n const directMatch = styleId.match(/^[Hh]eading(\\d)$/);\n if (directMatch) {\n return parseInt(directMatch[1], 10);\n }\n\n const styleName = styleMap.get(styleId) ?? \"\";\n const nameMatch = styleName.match(/^[Hh]eading\\s*(\\d)$/);\n if (nameMatch) {\n return parseInt(nameMatch[1], 10);\n }\n\n if (/title/i.test(styleName) || /title/i.test(styleId)) {\n return 1;\n }\n\n return 0;\n}\n\nfunction isListItem(paragraphXml: string): boolean {\n return /<w:numId\\s/.test(paragraphXml);\n}\n\nfunction extractRunMarkdown(runXml: string): string {\n const textRegex = /<w:t(?:\\s[^>]*)?>([^<]*)<\\/w:t>/g;\n const texts: string[] = [];\n let match: RegExpExecArray | null;\n while ((match = textRegex.exec(runXml)) !== null) {\n texts.push(match[1]);\n }\n if (texts.length === 0) {\n return \"\";\n }\n\n const text = texts.join(\"\");\n const isBold = /<w:b[\\s/>]/.test(runXml) && !/<w:b\\s+w:val=\"(false|0)\"/.test(runXml);\n const isItalic = /<w:i[\\s/>]/.test(runXml) && !/<w:i\\s+w:val=\"(false|0)\"/.test(runXml);\n\n if (isBold && isItalic) {\n return `***${text}***`;\n }\n if (isBold) {\n return `**${text}**`;\n }\n if (isItalic) {\n return `*${text}*`;\n }\n return text;\n}\n\nfunction convertToMarkdown(xml: string, styleMap: Map<string, string>): string {\n const paragraphs: string[] = [];\n const paragraphRegex = /<w:p[\\s>][\\s\\S]*?<\\/w:p>/g;\n let paragraphMatch: RegExpExecArray | null;\n\n while ((paragraphMatch = paragraphRegex.exec(xml)) !== null) {\n const paragraphXml = paragraphMatch[0];\n\n const runRegex = /<w:r[\\s>][\\s\\S]*?<\\/w:r>/g;\n const runs: string[] = [];\n let runMatch: RegExpExecArray | null;\n while ((runMatch = runRegex.exec(paragraphXml)) !== null) {\n const md = extractRunMarkdown(runMatch[0]);\n if (md) {\n runs.push(md);\n }\n }\n\n if (runs.length === 0) {\n continue;\n }\n\n let line = runs.join(\"\");\n const headingLevel = getHeadingLevel(paragraphXml, styleMap);\n\n if (headingLevel > 0 && headingLevel <= 6) {\n line = `${\"#\".repeat(headingLevel)} ${line}`;\n } else if (isListItem(paragraphXml)) {\n line = `- ${line}`;\n }\n\n paragraphs.push(line);\n }\n\n return paragraphs.join(\"\\n\\n\");\n}\n\n// --- ZIP utilities (unchanged) ---\n\nfunction extractFileFromZip(buffer: Buffer, targetPath: string): string | null {\n const eocdOffset = findEocd(buffer);\n if (eocdOffset === -1) {\n throw new Error(\"Invalid ZIP: End of Central Directory not found.\");\n }\n\n const cdOffset = buffer.readUInt32LE(eocdOffset + 16);\n const cdSize = buffer.readUInt32LE(eocdOffset + 12);\n const cdEnd = cdOffset + cdSize;\n let offset = cdOffset;\n\n while (offset < cdEnd) {\n const sig = buffer.readUInt32LE(offset);\n if (sig !== 0x02014b50) {\n break;\n }\n\n const compressionMethod = buffer.readUInt16LE(offset + 10);\n const compressedSize = buffer.readUInt32LE(offset + 20);\n const fileNameLen = buffer.readUInt16LE(offset + 28);\n const extraLen = buffer.readUInt16LE(offset + 30);\n const commentLen = buffer.readUInt16LE(offset + 32);\n const localHeaderOffset = buffer.readUInt32LE(offset + 42);\n const fileName = buffer.toString(\"utf-8\", offset + 46, offset + 46 + fileNameLen);\n\n if (fileName === targetPath) {\n return readLocalFile(buffer, localHeaderOffset, compressionMethod, compressedSize);\n }\n\n offset += 46 + fileNameLen + extraLen + commentLen;\n }\n\n return null;\n}\n\nfunction readLocalFile(\n buffer: Buffer,\n offset: number,\n compressionMethod: number,\n compressedSize: number\n): string {\n const sig = buffer.readUInt32LE(offset);\n if (sig !== 0x04034b50) {\n throw new Error(\"Invalid ZIP: bad local file header.\");\n }\n\n const localFileNameLen = buffer.readUInt16LE(offset + 26);\n const localExtraLen = buffer.readUInt16LE(offset + 28);\n const dataOffset = offset + 30 + localFileNameLen + localExtraLen;\n\n const raw = buffer.subarray(dataOffset, dataOffset + compressedSize);\n\n if (compressionMethod === 0) {\n return raw.toString(\"utf-8\");\n }\n\n if (compressionMethod === 8) {\n return inflateRawSync(raw).toString(\"utf-8\");\n }\n\n throw new Error(`Unsupported ZIP compression method: ${compressionMethod}`);\n}\n\nfunction findEocd(buffer: Buffer): number {\n for (let i = buffer.length - 22; i >= Math.max(0, buffer.length - 65557); i--) {\n if (buffer.readUInt32LE(i) === 0x06054b50) {\n return i;\n }\n }\n return -1;\n}\n"],"names":["extractDocxText","buffer","xml","extractFileFromZip","Error","stylesXml","styleMap","buildStyleMap","Map","convertToMarkdown","map","styleRegex","match","styleId","block","nameMatch","getHeadingLevel","paragraphXml","styleMatch","directMatch","parseInt","styleName","isListItem","extractRunMarkdown","runXml","textRegex","texts","text","isBold","isItalic","paragraphs","paragraphRegex","paragraphMatch","runRegex","runs","runMatch","md","line","headingLevel","targetPath","eocdOffset","findEocd","cdOffset","cdSize","cdEnd","offset","sig","compressionMethod","compressedSize","fileNameLen","extraLen","commentLen","localHeaderOffset","fileName","readLocalFile","localFileNameLen","localExtraLen","dataOffset","raw","inflateRawSync","i","Math"],"mappings":"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"}
@@ -1,10 +1,23 @@
1
+ import type { Constructor } from "@webiny/di";
1
2
  import type { generateText } from "ai";
2
3
  import type { streamText } from "ai";
3
4
  import type { LanguageModel } from "ai";
4
5
  import type { FlexibleSchema, ToolSet } from "ai";
6
+ /**
7
+ * What a model accepts, as published in the model catalog. A capability that isn't listed is unknown,
8
+ * and unknown is treated as unsupported: a parameter the model may reject is not sent.
9
+ */
10
+ export interface IAiModelSupports {
11
+ tools?: boolean;
12
+ vision?: boolean;
13
+ temperature?: boolean;
14
+ }
5
15
  export interface IAiSdkModel {
6
16
  id: string;
7
17
  name: string;
18
+ deprecated?: Date;
19
+ endOfLife?: Date;
20
+ supports?: IAiModelSupports;
8
21
  }
9
22
  export interface IAiSdk {
10
23
  languageModel(modelId: string): LanguageModel;
@@ -55,6 +68,9 @@ export interface AiModel {
55
68
  providerName: string;
56
69
  modelId: string;
57
70
  modelName: string;
71
+ deprecated: Date | undefined;
72
+ endOfLife: Date | undefined;
73
+ supports: IAiModelSupports | undefined;
58
74
  }
59
75
  export interface IAi {
60
76
  generateText(params: AiGenerateTextParams): ReturnType<typeof generateText>;
@@ -70,16 +86,95 @@ export declare namespace Ai {
70
86
  type GenerateTextParams = AiGenerateTextParams;
71
87
  type StreamTextParams = AiStreamTextParams;
72
88
  }
73
- export interface IAiSdkTool<TInput = any> {
89
+ export interface IAiModelRegistry {
90
+ listModels(): Promise<AiModel[]>;
91
+ }
92
+ /** Single source of truth for available AI models. Decoratable to restrict the model list. */
93
+ export declare const AiModelRegistry: import("@webiny/di").Abstraction<IAiModelRegistry>;
94
+ export declare namespace AiModelRegistry {
95
+ type Interface = IAiModelRegistry;
96
+ }
97
+ export interface AiCatalogProvider {
98
+ id: string;
99
+ name: string;
100
+ models: IAiSdkModel[];
101
+ }
102
+ export interface IAiModelCatalog {
103
+ /** Returns `undefined` when the catalog can't be loaded. */
104
+ listProviders(): Promise<AiCatalogProvider[] | undefined>;
105
+ }
106
+ /** The published list of providers and models Webiny supports. SDK factories still gate what is offered. */
107
+ export declare const AiModelCatalog: import("@webiny/di").Abstraction<IAiModelCatalog>;
108
+ export declare namespace AiModelCatalog {
109
+ type Interface = IAiModelCatalog;
110
+ }
111
+ /**
112
+ * Behavioural hints about a tool. Purely advisory — they never replace a permission check.
113
+ * Names mirror the MCP tool annotations so they can be forwarded verbatim to MCP clients,
114
+ * which use them to decide what to auto-approve and what to confirm with the user.
115
+ */
116
+ export interface IAiSdkToolAnnotations {
117
+ /** Tool does not modify state. */
118
+ readOnlyHint?: boolean;
119
+ /** Tool may perform destructive updates (only meaningful when not read-only). */
120
+ destructiveHint?: boolean;
121
+ /** Repeated calls with the same arguments have no additional effect. */
122
+ idempotentHint?: boolean;
123
+ /** Tool interacts with entities outside its own closed world. */
124
+ openWorldHint?: boolean;
125
+ }
126
+ /**
127
+ * What a tool DOES. This is the half that injects use cases, so it is built only for a tool the
128
+ * model actually calls, and only at the moment it calls it.
129
+ */
130
+ export interface IAiSdkToolHandler<TInput = any> {
131
+ execute(input: TInput): Promise<unknown>;
132
+ }
133
+ /**
134
+ * What a tool IS: everything the model is told about it, plus the class that runs it.
135
+ *
136
+ * Carries no behaviour and no dependencies, which is what makes the registry cheap to read.
137
+ * `AiSdkTools` builds every definition to assemble the tool set, and builds a handler only for a
138
+ * tool the model actually calls.
139
+ */
140
+ export interface IAiSdkToolDefinition<TInput = any> {
74
141
  readonly name: string;
75
142
  readonly description: string;
76
143
  readonly inputSchema: FlexibleSchema<TInput>;
77
- execute(input: TInput): Promise<unknown>;
78
- }
79
- /** A single tool that can be provided to AI generateText/streamText calls. */
80
- export declare const AiSdkTool: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
81
- export declare namespace AiSdkTool {
82
- type Interface = IAiSdkTool;
144
+ /** Human-friendly display name. Falls back to `name` when omitted. */
145
+ readonly title?: string;
146
+ readonly annotations?: IAiSdkToolAnnotations;
147
+ readonly handler: Constructor<IAiSdkToolHandler<TInput>>;
148
+ }
149
+ export declare const AiSdkToolDefinition: import("@webiny/di").Abstraction<IAiSdkToolDefinition<any>>;
150
+ /**
151
+ * The behaviour half of a tool, built on demand through {@link AiSdkToolHandlerResolver}.
152
+ *
153
+ * Implementations are NOT registered against this abstraction. The definition points at the class
154
+ * directly, exactly as `HttpRouteDefinition` points at its `HttpRouteHandler`. Declaring them
155
+ * through it is what attaches their dependency metadata.
156
+ */
157
+ export declare const AiSdkToolHandler: import("@webiny/di").Abstraction<IAiSdkToolHandler<any>>;
158
+ export declare namespace AiSdkToolDefinition {
159
+ type Interface<TInput = any> = IAiSdkToolDefinition<TInput>;
160
+ type Annotations = IAiSdkToolAnnotations;
161
+ }
162
+ export declare namespace AiSdkToolHandler {
163
+ type Interface<TInput = any> = IAiSdkToolHandler<TInput>;
164
+ }
165
+ export interface IAiSdkToolHandlerResolver {
166
+ resolve<TInput>(handler: Constructor<IAiSdkToolHandler<TInput>>): IAiSdkToolHandler<TInput>;
167
+ }
168
+ /**
169
+ * Builds the behaviour half of a tool on demand.
170
+ *
171
+ * Something has to turn `tool.handler` (a class) into an instance, and that needs the container.
172
+ * Rather than injecting the container into the tool registry, it lives behind this one narrow
173
+ * abstraction, so everything else depends on `resolve(handler)` and stays testable with a stub.
174
+ */
175
+ export declare const AiSdkToolHandlerResolver: import("@webiny/di").Abstraction<IAiSdkToolHandlerResolver>;
176
+ export declare namespace AiSdkToolHandlerResolver {
177
+ type Interface = IAiSdkToolHandlerResolver;
83
178
  }
84
179
  export interface IAiSdkTools {
85
180
  getToolSet(): ToolSet;
@@ -3,8 +3,12 @@ const AiSdk = createAbstraction("AiSdk");
3
3
  const AiSdkFactory = createAbstraction("AiSdkFactory");
4
4
  const AiConnectionFactory = createAbstraction("AiConnectionFactory");
5
5
  const Ai = createAbstraction("Ai");
6
- const AiSdkTool = createAbstraction("AiSdkTool");
6
+ const AiModelRegistry = createAbstraction("AiModelRegistry");
7
+ const AiModelCatalog = createAbstraction("AiModelCatalog");
8
+ const AiSdkToolDefinition = createAbstraction("AiSdkToolDefinition");
9
+ const AiSdkToolHandler = createAbstraction("AiSdkToolHandler");
10
+ const AiSdkToolHandlerResolver = createAbstraction("AiSdkToolHandlerResolver");
7
11
  const AiSdkTools = createAbstraction("AiSdkTools");
8
- export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory, AiSdkTool, AiSdkTools };
12
+ export { Ai, AiConnectionFactory, AiModelCatalog, AiModelRegistry, AiSdk, AiSdkFactory, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools };
9
13
 
10
14
  //# sourceMappingURL=abstractions.js.map
@@ -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 { generateText } from \"ai\";\nimport type { streamText } from \"ai\";\nimport type { LanguageModel } from \"ai\";\nimport type { FlexibleSchema, ToolSet } from \"ai\";\n\n// AiSdk\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}\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}\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// AiSdkTool\n\nexport interface IAiSdkTool<TInput = any> {\n readonly name: string;\n readonly description: string;\n readonly inputSchema: FlexibleSchema<TInput>;\n execute(input: TInput): Promise<unknown>;\n}\n\n/** A single tool that can be provided to AI generateText/streamText calls. */\nexport const AiSdkTool = createAbstraction<IAiSdkTool>(\"AiSdkTool\");\n\nexport namespace AiSdkTool {\n export type Interface = IAiSdkTool;\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","AiSdkTool","AiSdkTools"],"mappings":";AAkBO,MAAMA,QAAQC,kBAA0B;AAgBxC,MAAMC,eAAeD,kBAAiC;AAwBtD,MAAME,sBAAsBF,kBAAwC;AAoCpE,MAAMG,KAAKH,kBAAuB;AAkBlC,MAAMI,YAAYJ,kBAA8B;AAahD,MAAMK,aAAaL,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 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"}
@@ -0,0 +1,59 @@
1
+ import { DomainEvent } from "../../features/eventPublisher/index.js";
2
+ import type { IEventHandler } from "../../features/eventPublisher/index.js";
3
+ import type { AiGenerateTextParams, AiStreamTextParams } from "./abstractions.js";
4
+ import type { generateText } from "ai";
5
+ export interface AiBeforeGenerateTextPayload {
6
+ requestId: string;
7
+ params: AiGenerateTextParams;
8
+ }
9
+ export declare class AiBeforeGenerateTextEvent extends DomainEvent<AiBeforeGenerateTextPayload> {
10
+ eventType: "ai.beforeGenerateText";
11
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AiBeforeGenerateTextEvent>>;
12
+ }
13
+ export declare const AiBeforeGenerateTextEventHandler: import("@webiny/di").Abstraction<IEventHandler<AiBeforeGenerateTextEvent>>;
14
+ export declare namespace AiBeforeGenerateTextEventHandler {
15
+ type Interface = IEventHandler<AiBeforeGenerateTextEvent>;
16
+ type Event = AiBeforeGenerateTextEvent;
17
+ }
18
+ export interface AiAfterGenerateTextPayload {
19
+ requestId: string;
20
+ params: AiGenerateTextParams;
21
+ result: Awaited<ReturnType<typeof generateText>>;
22
+ duration: number;
23
+ }
24
+ export declare class AiAfterGenerateTextEvent extends DomainEvent<AiAfterGenerateTextPayload> {
25
+ eventType: "ai.afterGenerateText";
26
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AiAfterGenerateTextEvent>>;
27
+ }
28
+ export declare const AiAfterGenerateTextEventHandler: import("@webiny/di").Abstraction<IEventHandler<AiAfterGenerateTextEvent>>;
29
+ export declare namespace AiAfterGenerateTextEventHandler {
30
+ type Interface = IEventHandler<AiAfterGenerateTextEvent>;
31
+ type Event = AiAfterGenerateTextEvent;
32
+ }
33
+ export interface AiGenerateTextErrorPayload {
34
+ requestId: string;
35
+ params: AiGenerateTextParams;
36
+ error: Error;
37
+ duration: number;
38
+ }
39
+ export declare class AiGenerateTextErrorEvent extends DomainEvent<AiGenerateTextErrorPayload> {
40
+ eventType: "ai.generateTextError";
41
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AiGenerateTextErrorEvent>>;
42
+ }
43
+ export declare const AiGenerateTextErrorEventHandler: import("@webiny/di").Abstraction<IEventHandler<AiGenerateTextErrorEvent>>;
44
+ export declare namespace AiGenerateTextErrorEventHandler {
45
+ type Interface = IEventHandler<AiGenerateTextErrorEvent>;
46
+ type Event = AiGenerateTextErrorEvent;
47
+ }
48
+ export interface AiBeforeStreamTextPayload {
49
+ params: AiStreamTextParams;
50
+ }
51
+ export declare class AiBeforeStreamTextEvent extends DomainEvent<AiBeforeStreamTextPayload> {
52
+ eventType: "ai.beforeStreamText";
53
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<AiBeforeStreamTextEvent>>;
54
+ }
55
+ export declare const AiBeforeStreamTextEventHandler: import("@webiny/di").Abstraction<IEventHandler<AiBeforeStreamTextEvent>>;
56
+ export declare namespace AiBeforeStreamTextEventHandler {
57
+ type Interface = IEventHandler<AiBeforeStreamTextEvent>;
58
+ type Event = AiBeforeStreamTextEvent;
59
+ }
@@ -0,0 +1,41 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ import { DomainEvent } from "../eventPublisher/index.js";
3
+ class AiBeforeGenerateTextEvent extends DomainEvent {
4
+ getHandlerAbstraction() {
5
+ return AiBeforeGenerateTextEventHandler;
6
+ }
7
+ constructor(...args){
8
+ super(...args), this.eventType = "ai.beforeGenerateText";
9
+ }
10
+ }
11
+ const AiBeforeGenerateTextEventHandler = createAbstraction("AiBeforeGenerateTextEventHandler");
12
+ class AiAfterGenerateTextEvent extends DomainEvent {
13
+ getHandlerAbstraction() {
14
+ return AiAfterGenerateTextEventHandler;
15
+ }
16
+ constructor(...args){
17
+ super(...args), this.eventType = "ai.afterGenerateText";
18
+ }
19
+ }
20
+ const AiAfterGenerateTextEventHandler = createAbstraction("AiAfterGenerateTextEventHandler");
21
+ class AiGenerateTextErrorEvent extends DomainEvent {
22
+ getHandlerAbstraction() {
23
+ return AiGenerateTextErrorEventHandler;
24
+ }
25
+ constructor(...args){
26
+ super(...args), this.eventType = "ai.generateTextError";
27
+ }
28
+ }
29
+ const AiGenerateTextErrorEventHandler = createAbstraction("AiGenerateTextErrorEventHandler");
30
+ class AiBeforeStreamTextEvent extends DomainEvent {
31
+ getHandlerAbstraction() {
32
+ return AiBeforeStreamTextEventHandler;
33
+ }
34
+ constructor(...args){
35
+ super(...args), this.eventType = "ai.beforeStreamText";
36
+ }
37
+ }
38
+ const AiBeforeStreamTextEventHandler = createAbstraction("AiBeforeStreamTextEventHandler");
39
+ export { AiAfterGenerateTextEvent, AiAfterGenerateTextEventHandler, AiBeforeGenerateTextEvent, AiBeforeGenerateTextEventHandler, AiBeforeStreamTextEvent, AiBeforeStreamTextEventHandler, AiGenerateTextErrorEvent, AiGenerateTextErrorEventHandler };
40
+
41
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/events.js","sources":["../../../src/features/ai/events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"~/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\nimport type { AiGenerateTextParams, AiStreamTextParams } from \"./abstractions.js\";\nimport type { generateText } from \"ai\";\n\n// ============================================================================\n// BeforeGenerateText\n// ============================================================================\n\nexport interface AiBeforeGenerateTextPayload {\n requestId: string;\n params: AiGenerateTextParams;\n}\n\nexport class AiBeforeGenerateTextEvent extends DomainEvent<AiBeforeGenerateTextPayload> {\n eventType = \"ai.beforeGenerateText\" as const;\n\n getHandlerAbstraction() {\n return AiBeforeGenerateTextEventHandler;\n }\n}\n\nexport const AiBeforeGenerateTextEventHandler = createAbstraction<\n IEventHandler<AiBeforeGenerateTextEvent>\n>(\"AiBeforeGenerateTextEventHandler\");\n\nexport namespace AiBeforeGenerateTextEventHandler {\n export type Interface = IEventHandler<AiBeforeGenerateTextEvent>;\n export type Event = AiBeforeGenerateTextEvent;\n}\n\n// ============================================================================\n// AfterGenerateText\n// ============================================================================\n\nexport interface AiAfterGenerateTextPayload {\n requestId: string;\n params: AiGenerateTextParams;\n result: Awaited<ReturnType<typeof generateText>>;\n duration: number;\n}\n\nexport class AiAfterGenerateTextEvent extends DomainEvent<AiAfterGenerateTextPayload> {\n eventType = \"ai.afterGenerateText\" as const;\n\n getHandlerAbstraction() {\n return AiAfterGenerateTextEventHandler;\n }\n}\n\nexport const AiAfterGenerateTextEventHandler = createAbstraction<\n IEventHandler<AiAfterGenerateTextEvent>\n>(\"AiAfterGenerateTextEventHandler\");\n\nexport namespace AiAfterGenerateTextEventHandler {\n export type Interface = IEventHandler<AiAfterGenerateTextEvent>;\n export type Event = AiAfterGenerateTextEvent;\n}\n\n// ============================================================================\n// GenerateTextError\n// ============================================================================\n\nexport interface AiGenerateTextErrorPayload {\n requestId: string;\n params: AiGenerateTextParams;\n error: Error;\n duration: number;\n}\n\nexport class AiGenerateTextErrorEvent extends DomainEvent<AiGenerateTextErrorPayload> {\n eventType = \"ai.generateTextError\" as const;\n\n getHandlerAbstraction() {\n return AiGenerateTextErrorEventHandler;\n }\n}\n\nexport const AiGenerateTextErrorEventHandler = createAbstraction<\n IEventHandler<AiGenerateTextErrorEvent>\n>(\"AiGenerateTextErrorEventHandler\");\n\nexport namespace AiGenerateTextErrorEventHandler {\n export type Interface = IEventHandler<AiGenerateTextErrorEvent>;\n export type Event = AiGenerateTextErrorEvent;\n}\n\n// ============================================================================\n// BeforeStreamText\n// ============================================================================\n\nexport interface AiBeforeStreamTextPayload {\n params: AiStreamTextParams;\n}\n\nexport class AiBeforeStreamTextEvent extends DomainEvent<AiBeforeStreamTextPayload> {\n eventType = \"ai.beforeStreamText\" as const;\n\n getHandlerAbstraction() {\n return AiBeforeStreamTextEventHandler;\n }\n}\n\nexport const AiBeforeStreamTextEventHandler = createAbstraction<\n IEventHandler<AiBeforeStreamTextEvent>\n>(\"AiBeforeStreamTextEventHandler\");\n\nexport namespace AiBeforeStreamTextEventHandler {\n export type Interface = IEventHandler<AiBeforeStreamTextEvent>;\n export type Event = AiBeforeStreamTextEvent;\n}\n"],"names":["AiBeforeGenerateTextEvent","DomainEvent","AiBeforeGenerateTextEventHandler","createAbstraction","AiAfterGenerateTextEvent","AiAfterGenerateTextEventHandler","AiGenerateTextErrorEvent","AiGenerateTextErrorEventHandler","AiBeforeStreamTextEvent","AiBeforeStreamTextEventHandler"],"mappings":";;AAeO,MAAMA,kCAAkCC;IAG3C,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,mCAAmCC,kBAE9C;AAkBK,MAAMC,iCAAiCH;IAG1C,wBAAwB;QACpB,OAAOI;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,kCAAkCF,kBAE7C;AAkBK,MAAMG,iCAAiCL;IAG1C,wBAAwB;QACpB,OAAOM;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,kCAAkCJ,kBAE7C;AAeK,MAAMK,gCAAgCP;IAGzC,wBAAwB;QACpB,OAAOQ;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,iCAAiCN,kBAE5C"}
@@ -1,19 +1,31 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { OpenAiSdkFactory } from "./OpenAiSdkFactory.js";
3
3
  import { AnthropicSdkFactory } from "./AnthropicSdkFactory.js";
4
+ import { GoogleSdkFactory } from "./GoogleSdkFactory.js";
5
+ import { OpenRouterSdkFactory } from "./OpenRouterSdkFactory.js";
4
6
  import { Ai } from "./Ai.js";
7
+ import { AiModelRegistry } from "./AiModelRegistry.js";
8
+ import { RemoteAiModelCatalog } from "./RemoteAiModelCatalog.js";
5
9
  import { AiSdkTools } from "./AiSdkTools.js";
10
+ import { AiSdkToolHandlerResolver } from "./AiSdkToolHandlerResolver.js";
6
11
  import { AiOutputToolRegistry } from "./toolPipeline/AiOutputToolRegistry.js";
7
12
  import { AiToolPipelineRunner } from "./toolPipeline/AiToolPipelineRunner.js";
13
+ import { DefaultTextExtractor } from "./TextExtractor/DefaultTextExtractor.js";
8
14
  const AiFeature = createFeature({
9
15
  name: "AiFeature",
10
16
  register (container) {
11
17
  container.register(OpenAiSdkFactory);
12
18
  container.register(AnthropicSdkFactory);
19
+ container.register(GoogleSdkFactory);
20
+ container.register(OpenRouterSdkFactory);
13
21
  container.register(Ai);
22
+ container.register(RemoteAiModelCatalog);
23
+ container.register(AiModelRegistry);
14
24
  container.register(AiSdkTools);
25
+ container.register(AiSdkToolHandlerResolver);
15
26
  container.register(AiOutputToolRegistry);
16
27
  container.register(AiToolPipelineRunner);
28
+ container.register(DefaultTextExtractor);
17
29
  }
18
30
  });
19
31
  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\";\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
+ {"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 { GoogleSdkFactory } from \"./GoogleSdkFactory.js\";\nimport { OpenRouterSdkFactory } from \"./OpenRouterSdkFactory.js\";\nimport { Ai } from \"./Ai.js\";\nimport { AiModelRegistry } from \"./AiModelRegistry.js\";\nimport { RemoteAiModelCatalog } from \"./RemoteAiModelCatalog.js\";\nimport { AiSdkTools } from \"./AiSdkTools.js\";\nimport { AiSdkToolHandlerResolver } from \"./AiSdkToolHandlerResolver.js\";\nimport { AiOutputToolRegistry } from \"./toolPipeline/AiOutputToolRegistry.js\";\nimport { AiToolPipelineRunner } from \"./toolPipeline/AiToolPipelineRunner.js\";\nimport { DefaultTextExtractor } from \"./TextExtractor/DefaultTextExtractor.js\";\n\nexport const AiFeature = createFeature({\n name: \"AiFeature\",\n register(container) {\n container.register(OpenAiSdkFactory);\n container.register(AnthropicSdkFactory);\n container.register(GoogleSdkFactory);\n container.register(OpenRouterSdkFactory);\n container.register(Ai);\n container.register(RemoteAiModelCatalog);\n container.register(AiModelRegistry);\n container.register(AiSdkTools);\n container.register(AiSdkToolHandlerResolver);\n container.register(AiOutputToolRegistry);\n container.register(AiToolPipelineRunner);\n container.register(DefaultTextExtractor);\n }\n});\n"],"names":["AiFeature","createFeature","container","OpenAiSdkFactory","AnthropicSdkFactory","GoogleSdkFactory","OpenRouterSdkFactory","Ai","RemoteAiModelCatalog","AiModelRegistry","AiSdkTools","AiSdkToolHandlerResolver","AiOutputToolRegistry","AiToolPipelineRunner","DefaultTextExtractor"],"mappings":";;;;;;;;;;;;;AAcO,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;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;QACnBR,UAAU,QAAQ,CAACS;QACnBT,UAAU,QAAQ,CAACU;QACnBV,UAAU,QAAQ,CAACW;QACnBX,UAAU,QAAQ,CAACY;IACvB;AACJ"}
@@ -1,5 +1,7 @@
1
- export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai, AiSdkTool, AiSdkTools } from "./abstractions.js";
2
- export type { IAiConnection, IAiConnectionInline, AiModel, IAiSdkModel, IAiSdkTool, IAiSdkTools } from "./abstractions.js";
1
+ export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai, AiModelRegistry, AiModelCatalog, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
2
+ export type { IAiConnection, IAiConnectionInline, AiModel, IAiSdkModel } from "./abstractions.js";
3
3
  export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
4
- export type { IAiOutputTool, IAiOutputToolRegistry, IAiToolPipelineRunner } from "./toolPipeline/index.js";
4
+ export { TextExtractor, DefaultTextExtractor } from "./TextExtractor/index.js";
5
+ export { AiBeforeGenerateTextEvent, AiBeforeGenerateTextEventHandler, AiAfterGenerateTextEvent, AiAfterGenerateTextEventHandler, AiGenerateTextErrorEvent, AiGenerateTextErrorEventHandler, AiBeforeStreamTextEvent, AiBeforeStreamTextEventHandler } from "./events.js";
6
+ export type { AiBeforeGenerateTextPayload, AiAfterGenerateTextPayload, AiGenerateTextErrorPayload, AiBeforeStreamTextPayload } from "./events.js";
5
7
  export { AiFeature } from "./feature.js";
@@ -1,3 +1,5 @@
1
- export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory, AiSdkTool, AiSdkTools } from "./abstractions.js";
1
+ export { Ai, AiConnectionFactory, AiModelCatalog, AiModelRegistry, AiSdk, AiSdkFactory, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
2
2
  export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./toolPipeline/index.js";
3
+ export { DefaultTextExtractor, TextExtractor } from "./TextExtractor/index.js";
4
+ export { AiAfterGenerateTextEvent, AiAfterGenerateTextEventHandler, AiBeforeGenerateTextEvent, AiBeforeGenerateTextEventHandler, AiBeforeStreamTextEvent, AiBeforeStreamTextEventHandler, AiGenerateTextErrorEvent, AiGenerateTextErrorEventHandler } from "./events.js";
3
5
  export { AiFeature } from "./feature.js";
@@ -0,0 +1,15 @@
1
+ import { DateFormatter } from "./abstractions.js";
2
+ import type { FormattableDate } from "./abstractions.js";
3
+ /**
4
+ * Default absolute date/time format: `YYYY-MM-DD HH:mm`, 24-hour, UTC. Built from UTC parts rather
5
+ * than `Intl.DateTimeFormat` so the output is fully deterministic — backend formatting must not
6
+ * depend on the server locale or the bundled ICU version. Projects can change it by decorating
7
+ * DateFormatter.
8
+ */
9
+ declare class DefaultDateFormatterImpl implements DateFormatter.Interface {
10
+ format(date: FormattableDate): string;
11
+ }
12
+ export declare const DefaultDateFormatter: typeof DefaultDateFormatterImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDateFormatter>;
14
+ };
15
+ export {};
@@ -0,0 +1,20 @@
1
+ import { DateFormatter } from "./abstractions.js";
2
+ const pad = (value)=>String(value).padStart(2, "0");
3
+ class DefaultDateFormatterImpl {
4
+ format(date) {
5
+ const value = new Date(date);
6
+ const year = value.getUTCFullYear();
7
+ const month = pad(value.getUTCMonth() + 1);
8
+ const day = pad(value.getUTCDate());
9
+ const hours = pad(value.getUTCHours());
10
+ const minutes = pad(value.getUTCMinutes());
11
+ return `${year}-${month}-${day} ${hours}:${minutes}`;
12
+ }
13
+ }
14
+ const DefaultDateFormatter = DateFormatter.createImplementation({
15
+ implementation: DefaultDateFormatterImpl,
16
+ dependencies: []
17
+ });
18
+ export { DefaultDateFormatter };
19
+
20
+ //# sourceMappingURL=DefaultDateFormatter.js.map