@webiny/api-core 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
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.
- package/ApiCoreFeature.d.ts +2 -2
- package/ApiCoreFeature.js +35 -5
- package/ApiCoreFeature.js.map +1 -1
- package/exports/api/security/api-key.d.ts +1 -0
- package/exports/api/security/api-key.js +1 -0
- package/exports/api/tasks.d.ts +1 -0
- package/exports/api/tasks.js +1 -1
- package/exports/api.d.ts +2 -1
- package/exports/api.js +2 -1
- package/features/ai/Ai.d.ts +5 -1
- package/features/ai/Ai.js +72 -29
- package/features/ai/Ai.js.map +1 -1
- package/features/ai/AiModelRegistry.d.ts +14 -0
- package/features/ai/AiModelRegistry.js +39 -0
- package/features/ai/AiModelRegistry.js.map +1 -0
- package/features/ai/AiSdkToolHandlerResolver.d.ts +11 -0
- package/features/ai/AiSdkToolHandlerResolver.js +19 -0
- package/features/ai/AiSdkToolHandlerResolver.js.map +1 -0
- package/features/ai/AiSdkTools.d.ts +4 -3
- package/features/ai/AiSdkTools.js +11 -9
- package/features/ai/AiSdkTools.js.map +1 -1
- package/features/ai/AnthropicSdkFactory.js +18 -34
- package/features/ai/AnthropicSdkFactory.js.map +1 -1
- package/features/ai/DEVELOPERS.md +183 -0
- package/features/ai/GoogleSdkFactory.d.ts +10 -0
- package/features/ai/GoogleSdkFactory.js +65 -0
- package/features/ai/GoogleSdkFactory.js.map +1 -0
- package/features/ai/OpenAiSdkFactory.js +42 -150
- package/features/ai/OpenAiSdkFactory.js.map +1 -1
- package/features/ai/OpenRouterSdkFactory.d.ts +10 -0
- package/features/ai/OpenRouterSdkFactory.js +112 -0
- package/features/ai/OpenRouterSdkFactory.js.map +1 -0
- package/features/ai/RemoteAiModelCatalog.d.ts +13 -0
- package/features/ai/RemoteAiModelCatalog.js +74 -0
- package/features/ai/RemoteAiModelCatalog.js.map +1 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.d.ts +9 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js +28 -0
- package/features/ai/TextExtractor/DefaultTextExtractor.js.map +1 -0
- package/features/ai/TextExtractor/abstractions.d.ts +12 -0
- package/features/ai/TextExtractor/abstractions.js +5 -0
- package/features/ai/TextExtractor/abstractions.js.map +1 -0
- package/features/ai/TextExtractor/index.d.ts +3 -0
- package/features/ai/TextExtractor/index.js +2 -0
- package/features/ai/TextExtractor/parsers/docxParser.d.ts +1 -0
- package/features/ai/TextExtractor/parsers/docxParser.js +111 -0
- package/features/ai/TextExtractor/parsers/docxParser.js.map +1 -0
- package/features/ai/abstractions.d.ts +102 -7
- package/features/ai/abstractions.js +6 -2
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/events.d.ts +59 -0
- package/features/ai/events.js +41 -0
- package/features/ai/events.js.map +1 -0
- package/features/ai/feature.js +16 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +6 -2
- package/features/ai/index.js +4 -1
- package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
- package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
- package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
- package/features/ai/toolPipeline/abstractions.d.ts +23 -0
- package/features/ai/toolPipeline/abstractions.js +7 -0
- package/features/ai/toolPipeline/abstractions.js.map +1 -0
- package/features/ai/toolPipeline/index.d.ts +2 -0
- package/features/ai/toolPipeline/index.js +1 -0
- package/features/dateFormatter/DefaultDateFormatter.d.ts +15 -0
- package/features/dateFormatter/DefaultDateFormatter.js +20 -0
- package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
- package/features/dateFormatter/abstractions.d.ts +13 -0
- package/features/dateFormatter/abstractions.js +5 -0
- package/features/dateFormatter/abstractions.js.map +1 -0
- package/features/dateFormatter/feature.d.ts +4 -0
- package/features/dateFormatter/feature.js +11 -0
- package/features/dateFormatter/feature.js.map +1 -0
- package/features/dateFormatter/index.d.ts +3 -0
- package/features/dateFormatter/index.js +2 -0
- package/features/debugger/Debugger.d.ts +30 -0
- package/features/debugger/Debugger.js +142 -0
- package/features/debugger/Debugger.js.map +1 -0
- package/features/debugger/DebuggerRouteDecorator.d.ts +45 -0
- package/features/debugger/DebuggerRouteDecorator.js +107 -0
- package/features/debugger/DebuggerRouteDecorator.js.map +1 -0
- package/features/debugger/GraphQLDebuggerTransport.d.ts +28 -0
- package/features/debugger/GraphQLDebuggerTransport.js +45 -0
- package/features/debugger/GraphQLDebuggerTransport.js.map +1 -0
- package/features/debugger/__tests__/matchNamespace.test.d.ts +1 -0
- package/features/debugger/__tests__/matchNamespace.test.js +68 -0
- package/features/debugger/__tests__/matchNamespace.test.js.map +1 -0
- package/features/debugger/__tests__/serialize.test.d.ts +1 -0
- package/features/debugger/__tests__/serialize.test.js +220 -0
- package/features/debugger/__tests__/serialize.test.js.map +1 -0
- package/features/debugger/abstractions.d.ts +100 -0
- package/features/debugger/abstractions.js +6 -0
- package/features/debugger/abstractions.js.map +1 -0
- package/features/debugger/feature.d.ts +5 -0
- package/features/debugger/feature.js +15 -0
- package/features/debugger/feature.js.map +1 -0
- package/features/debugger/index.d.ts +12 -0
- package/features/debugger/index.js +7 -0
- package/features/debugger/limits.d.ts +18 -0
- package/features/debugger/limits.js +11 -0
- package/features/debugger/limits.js.map +1 -0
- package/features/debugger/matchNamespace.d.ts +14 -0
- package/features/debugger/matchNamespace.js +35 -0
- package/features/debugger/matchNamespace.js.map +1 -0
- package/features/debugger/parseNamespaceHeader.d.ts +7 -0
- package/features/debugger/parseNamespaceHeader.js +16 -0
- package/features/debugger/parseNamespaceHeader.js.map +1 -0
- package/features/debugger/permissions.d.ts +14 -0
- package/features/debugger/permissions.js +8 -0
- package/features/debugger/permissions.js.map +1 -0
- package/features/debugger/permissionsSchema.d.ts +17 -0
- package/features/debugger/permissionsSchema.js +18 -0
- package/features/debugger/permissionsSchema.js.map +1 -0
- package/features/debugger/serialize.d.ts +11 -0
- package/features/debugger/serialize.js +121 -0
- package/features/debugger/serialize.js.map +1 -0
- package/features/encryption/EncryptionKeyCacheFeature.d.ts +8 -0
- package/features/encryption/EncryptionKeyCacheFeature.js +11 -0
- package/features/encryption/EncryptionKeyCacheFeature.js.map +1 -0
- package/features/encryption/EncryptionService.d.ts +2 -1
- package/features/encryption/EncryptionService.js +11 -4
- package/features/encryption/EncryptionService.js.map +1 -1
- package/features/encryption/MemoryEncryptionKeyCache.d.ts +13 -0
- package/features/encryption/MemoryEncryptionKeyCache.js +26 -0
- package/features/encryption/MemoryEncryptionKeyCache.js.map +1 -0
- package/features/encryption/abstractions.d.ts +11 -0
- package/features/encryption/abstractions.js +2 -1
- package/features/encryption/abstractions.js.map +1 -1
- package/features/encryption/index.d.ts +1 -0
- package/features/encryption/index.js +1 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.d.ts +13 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js +62 -0
- package/features/featureFlags/decorators/FeatureFlagsWithLicenseDecorator.js.map +1 -0
- package/features/hashing/ScryptHasher.d.ts +11 -0
- package/features/hashing/ScryptHasher.js +74 -0
- package/features/hashing/ScryptHasher.js.map +1 -0
- package/features/hashing/abstractions.d.ts +18 -0
- package/features/hashing/abstractions.js +5 -0
- package/features/hashing/abstractions.js.map +1 -0
- package/features/hashing/feature.d.ts +4 -0
- package/features/hashing/feature.js +11 -0
- package/features/hashing/feature.js.map +1 -0
- package/features/hashing/index.d.ts +2 -0
- package/features/hashing/index.js +1 -0
- package/features/httpClient/HttpClient.d.ts +7 -0
- package/features/httpClient/HttpClient.js +72 -0
- package/features/httpClient/HttpClient.js.map +1 -0
- package/features/httpClient/HttpRequestError.d.ts +10 -0
- package/features/httpClient/HttpRequestError.js +13 -0
- package/features/httpClient/HttpRequestError.js.map +1 -0
- package/features/httpClient/HttpStatusError.d.ts +12 -0
- package/features/httpClient/HttpStatusError.js +12 -0
- package/features/httpClient/HttpStatusError.js.map +1 -0
- package/features/httpClient/abstractions.d.ts +32 -0
- package/features/httpClient/abstractions.js +5 -0
- package/features/httpClient/abstractions.js.map +1 -0
- package/features/httpClient/feature.d.ts +4 -0
- package/features/httpClient/feature.js +11 -0
- package/features/httpClient/feature.js.map +1 -0
- package/features/httpClient/index.d.ts +3 -0
- package/features/httpClient/index.js +3 -0
- package/features/keyValueStore/GlobalKeyValueStore.d.ts +9 -3
- package/features/keyValueStore/GlobalKeyValueStore.js +12 -2
- package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStore.d.ts +6 -2
- package/features/keyValueStore/KeyValueStore.js +13 -3
- package/features/keyValueStore/KeyValueStore.js.map +1 -1
- package/features/keyValueStore/KeyValueStoreRepository.d.ts +8 -2
- package/features/keyValueStore/KeyValueStoreRepository.js +82 -4
- package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
- package/features/keyValueStore/abstractions.d.ts +132 -14
- package/features/keyValueStore/abstractions.js.map +1 -1
- package/features/keyValueStore/errors.d.ts +29 -0
- package/features/keyValueStore/errors.js +49 -1
- package/features/keyValueStore/errors.js.map +1 -1
- package/features/keyValueStore/index.d.ts +4 -1
- package/features/keyValueStore/index.js +1 -1
- package/features/publicUrls/NullPublicUrls.d.ts +11 -0
- package/features/publicUrls/NullPublicUrls.js +17 -0
- package/features/publicUrls/NullPublicUrls.js.map +1 -0
- package/features/publicUrls/PublicUrl.d.ts +24 -0
- package/features/publicUrls/PublicUrl.js +43 -0
- package/features/publicUrls/PublicUrl.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js +38 -0
- package/features/publicUrls/__tests__/PublicUrl.test.js.map +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.d.ts +1 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js +14 -0
- package/features/publicUrls/__tests__/PublicUrls.test.js.map +1 -0
- package/features/publicUrls/abstractions.d.ts +27 -0
- package/features/publicUrls/abstractions.js +5 -0
- package/features/publicUrls/abstractions.js.map +1 -0
- package/features/publicUrls/feature.d.ts +8 -0
- package/features/publicUrls/feature.js +11 -0
- package/features/publicUrls/feature.js.map +1 -0
- package/features/publicUrls/index.d.ts +3 -0
- package/features/publicUrls/index.js +3 -0
- package/features/requestContext/RawAssumePermissions.d.ts +14 -0
- package/features/requestContext/RawAssumePermissions.js +19 -0
- package/features/requestContext/RawAssumePermissions.js.map +1 -0
- package/features/requestContext/RawAuthToken.d.ts +14 -0
- package/features/requestContext/RawAuthToken.js +19 -0
- package/features/requestContext/RawAuthToken.js.map +1 -0
- package/features/requestContext/RawTenantId.d.ts +14 -0
- package/features/requestContext/RawTenantId.js +19 -0
- package/features/requestContext/RawTenantId.js.map +1 -0
- package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
- package/features/requestContext/RequestIdentityLoader.js +26 -0
- package/features/requestContext/RequestIdentityLoader.js.map +1 -0
- package/features/requestContext/RequestTenantLoader.d.ts +18 -0
- package/features/requestContext/RequestTenantLoader.js +52 -0
- package/features/requestContext/RequestTenantLoader.js.map +1 -0
- package/features/requestContext/abstractions.d.ts +75 -0
- package/features/requestContext/abstractions.js +9 -0
- package/features/requestContext/abstractions.js.map +1 -0
- package/features/requestContext/extractAssumePermissions.d.ts +14 -0
- package/features/requestContext/extractAssumePermissions.js +32 -0
- package/features/requestContext/extractAssumePermissions.js.map +1 -0
- package/features/requestContext/feature.d.ts +12 -0
- package/features/requestContext/feature.js +19 -0
- package/features/requestContext/feature.js.map +1 -0
- package/features/requestContext/index.d.ts +4 -0
- package/features/requestContext/index.js +3 -0
- package/features/security/IdentityContext/IdentityContext.d.ts +3 -3
- package/features/security/IdentityContext/IdentityContext.js +6 -6
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
- package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
- package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +11 -6
- package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.d.ts +1 -1
- package/features/security/apiKeys/GetApiKey/GetApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyBySlug/GetApiKeyBySlugUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.d.ts +1 -3
- package/features/security/apiKeys/GetApiKeyByToken/GetApiKeyByTokenUseCase.js.map +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -1
- package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +9 -3
- package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
- package/features/security/apiKeys/feature.js +11 -2
- package/features/security/apiKeys/feature.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeyProvider.d.ts +3 -5
- package/features/security/apiKeys/shared/ApiKeyProvider.js +6 -21
- package/features/security/apiKeys/shared/ApiKeyProvider.js.map +1 -1
- package/features/security/apiKeys/shared/ApiKeysRepository.d.ts +1 -0
- package/features/security/apiKeys/shared/ApiKeysRepository.js +19 -4
- package/features/security/apiKeys/shared/ApiKeysRepository.js.map +1 -1
- package/features/security/apiKeys/shared/generateToken.d.ts +1 -1
- package/features/security/apiKeys/shared/generateToken.js.map +1 -1
- package/features/security/apiKeys/shared/schemas.d.ts +2 -2
- package/features/security/apiKeys/shared/schemas.js +2 -2
- package/features/security/apiKeys/shared/schemas.js.map +1 -1
- package/features/security/apiKeys/shared/types.d.ts +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.d.ts +30 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js +60 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/AssumedPermissions.js.map +1 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +4 -4
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js +5 -5
- package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.js.map +1 -1
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js +2 -0
- package/features/security/authorization/GroupsTeamsAuthorizer/feature.js.map +1 -1
- package/features/security/roles/CreateRole/CreateRoleUseCase.js +11 -6
- package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
- package/features/security/roles/CreateRole/schema.d.ts +1 -1
- package/features/security/roles/CreateRole/schema.js +1 -1
- package/features/security/roles/CreateRole/schema.js.map +1 -1
- package/features/security/roles/Installer/RolesInstaller.js +1 -0
- package/features/security/roles/Installer/RolesInstaller.js.map +1 -1
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +9 -3
- package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
- package/features/security/roles/UpdateRole/schema.d.ts +1 -1
- package/features/security/roles/UpdateRole/schema.js +1 -1
- package/features/security/roles/UpdateRole/schema.js.map +1 -1
- package/features/security/shared/description.d.ts +4 -0
- package/features/security/shared/description.js +7 -0
- package/features/security/shared/description.js.map +1 -0
- package/features/security/shared/index.d.ts +1 -0
- package/features/security/shared/index.js +1 -0
- package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +3 -1
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js +20 -8
- package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
- package/features/security/teams/CreateTeam/schema.d.ts +1 -1
- package/features/security/teams/CreateTeam/schema.js +1 -1
- package/features/security/teams/CreateTeam/schema.js.map +1 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.d.ts +3 -1
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +20 -5
- package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
- package/features/security/teams/UpdateTeam/schema.d.ts +1 -1
- package/features/security/teams/UpdateTeam/schema.js +1 -1
- package/features/security/teams/UpdateTeam/schema.js.map +1 -1
- package/features/security/teams/shared/resolveRoleIdentifiers.d.ts +17 -0
- package/features/security/teams/shared/resolveRoleIdentifiers.js +32 -0
- package/features/security/teams/shared/resolveRoleIdentifiers.js.map +1 -0
- package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
- package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
- package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
- package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
- package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
- package/features/serviceDiscovery/index.d.ts +3 -0
- package/features/serviceDiscovery/index.js +1 -0
- package/features/slugify/DefaultSlugify.d.ts +8 -0
- package/features/slugify/DefaultSlugify.js +20 -0
- package/features/slugify/DefaultSlugify.js.map +1 -0
- package/features/slugify/abstractions.d.ts +12 -0
- package/features/slugify/abstractions.js +5 -0
- package/features/slugify/abstractions.js.map +1 -0
- package/features/slugify/feature.d.ts +4 -0
- package/features/slugify/feature.js +11 -0
- package/features/slugify/feature.js.map +1 -0
- package/features/slugify/index.d.ts +3 -0
- package/features/slugify/index.js +2 -0
- package/features/storageOperations/abstractions.d.ts +21 -0
- package/features/storageOperations/abstractions.js +10 -0
- package/features/storageOperations/abstractions.js.map +1 -0
- package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
- package/features/stringFormatter/DefaultStringFormatter.js +19 -0
- package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
- package/features/stringFormatter/abstractions.d.ts +11 -0
- package/features/stringFormatter/abstractions.js +5 -0
- package/features/stringFormatter/abstractions.js.map +1 -0
- package/features/stringFormatter/feature.d.ts +4 -0
- package/features/stringFormatter/feature.js +13 -0
- package/features/stringFormatter/feature.js.map +1 -0
- package/features/stringFormatter/index.d.ts +3 -0
- package/features/stringFormatter/index.js +2 -0
- package/features/task/TaskDefinition/abstractions.d.ts +69 -4
- package/features/task/TaskDefinition/abstractions.js +2 -1
- package/features/task/TaskDefinition/abstractions.js.map +1 -1
- package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
- package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
- package/features/tenancy/TenantContext/TenantContext.d.ts +1 -0
- package/features/tenancy/TenantContext/TenantContext.js +13 -8
- package/features/tenancy/TenantContext/TenantContext.js.map +1 -1
- package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
- package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
- package/features/wcp/WcpContext/WcpContext.d.ts +16 -5
- package/features/wcp/WcpContext/WcpContext.js +41 -2
- package/features/wcp/WcpContext/WcpContext.js.map +1 -1
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +15 -60
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +81 -25
- package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
- package/features/wcp/WcpContext/feature.d.ts +1 -2
- package/features/wcp/WcpContext/feature.js +2 -2
- package/features/wcp/WcpContext/feature.js.map +1 -1
- package/features/wcp/WcpContext/index.d.ts +0 -1
- package/features/wcp/WcpContext/types.d.ts +0 -4
- package/features/wcp/WcpFeature.d.ts +1 -1
- package/features/wcp/WcpFeature.js +7 -2
- package/features/wcp/WcpFeature.js.map +1 -1
- package/features/wcp/WcpLicenseLoader.d.ts +25 -0
- package/features/wcp/WcpLicenseLoader.js +58 -0
- package/features/wcp/WcpLicenseLoader.js.map +1 -0
- package/features/wcp/WcpLicenseProvider.d.ts +21 -0
- package/features/wcp/WcpLicenseProvider.js +14 -0
- package/features/wcp/WcpLicenseProvider.js.map +1 -0
- package/features/wcp/resolveWcpProjectEnvironment.d.ts +9 -0
- package/features/wcp/resolveWcpProjectEnvironment.js +23 -0
- package/features/wcp/resolveWcpProjectEnvironment.js.map +1 -0
- package/graphql/ApiCoreSchemaFactory.d.ts +16 -0
- package/graphql/ApiCoreSchemaFactory.js +58 -0
- package/graphql/ApiCoreSchemaFactory.js.map +1 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.d.ts +10 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js +53 -0
- package/graphql/featureFlags/FeatureFlagsSchemaFactory.js.map +1 -0
- package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
- package/graphql/security/NotAuthorizedResponse.js +1 -1
- package/graphql/security/NotAuthorizedResponse.js.map +1 -1
- package/graphql/security/SecuritySchemaFactory.d.ts +15 -0
- package/graphql/security/SecuritySchemaFactory.js +27 -0
- package/graphql/security/SecuritySchemaFactory.js.map +1 -0
- package/graphql/security/addApiKeySchema.d.ts +2 -0
- package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
- package/graphql/security/addApiKeySchema.js.map +1 -0
- package/graphql/security/addIdentitySchema.d.ts +2 -0
- package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
- package/graphql/security/addIdentitySchema.js.map +1 -0
- package/graphql/security/addRoleSchema.d.ts +2 -0
- package/graphql/security/addRoleSchema.js +137 -0
- package/graphql/security/addRoleSchema.js.map +1 -0
- package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
- package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
- package/graphql/security/addSecurityBaseSchema.js.map +1 -0
- package/graphql/security/addTeamSchema.d.ts +2 -0
- package/graphql/security/addTeamSchema.js +157 -0
- package/graphql/security/addTeamSchema.js.map +1 -0
- package/graphql/system/SystemSchemaFactory.d.ts +10 -0
- package/graphql/system/SystemSchemaFactory.js +70 -0
- package/graphql/system/SystemSchemaFactory.js.map +1 -0
- package/graphql/users/UsersSchemaFactory.d.ts +10 -0
- package/graphql/users/UsersSchemaFactory.js +195 -0
- package/graphql/users/UsersSchemaFactory.js.map +1 -0
- package/graphql/wcp/WcpSchemaFactory.d.ts +10 -0
- package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +32 -18
- package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
- package/idp/JwksCache.d.ts +14 -3
- package/idp/JwksCache.js +97 -17
- package/idp/JwksCache.js.map +1 -1
- package/idp/JwksStoreFeature.d.ts +8 -0
- package/idp/JwksStoreFeature.js +11 -0
- package/idp/JwksStoreFeature.js.map +1 -0
- package/idp/MemoryJwksStore.d.ts +14 -0
- package/idp/MemoryJwksStore.js +21 -0
- package/idp/MemoryJwksStore.js.map +1 -0
- package/idp/OidcJwtIdentityProvider.js +5 -1
- package/idp/OidcJwtIdentityProvider.js.map +1 -1
- package/idp/abstractions.d.ts +24 -0
- package/idp/abstractions.js +2 -1
- package/idp/abstractions.js.map +1 -1
- package/idp/feature.js +1 -2
- package/idp/feature.js.map +1 -1
- package/idp/index.d.ts +1 -0
- package/idp/index.js +1 -0
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +23 -24
- package/testing/environment.d.ts +14 -0
- package/testing/environment.js +18 -0
- package/testing/environment.js.map +1 -0
- package/types/core.d.ts +17 -5
- package/types/security.d.ts +1 -7
- package/types/tenancy.d.ts +0 -17
- package/types/users.d.ts +0 -13
- package/createApiCore.d.ts +0 -7
- package/createApiCore.js +0 -22
- package/createApiCore.js.map +0 -1
- package/graphql/security/apiKey.gql.d.ts +0 -4
- package/graphql/security/apiKey.gql.js.map +0 -1
- package/graphql/security/base.gql.d.ts +0 -4
- package/graphql/security/base.gql.js.map +0 -1
- package/graphql/security/identity.gql.d.ts +0 -4
- package/graphql/security/identity.gql.js.map +0 -1
- package/graphql/security/index.d.ts +0 -1
- package/graphql/security/index.js +0 -15
- package/graphql/security/index.js.map +0 -1
- package/graphql/security/role.gql.d.ts +0 -4
- package/graphql/security/role.gql.js +0 -106
- package/graphql/security/role.gql.js.map +0 -1
- package/graphql/security/team.gql.d.ts +0 -4
- package/graphql/security/team.gql.js +0 -119
- package/graphql/security/team.gql.js.map +0 -1
- package/graphql/system/createSystemGraphQL.d.ts +0 -2
- package/graphql/system/createSystemGraphQL.js +0 -54
- package/graphql/system/createSystemGraphQL.js.map +0 -1
- package/graphql/users/user.gql.d.ts +0 -3
- package/graphql/users/user.gql.js +0 -167
- package/graphql/users/user.gql.js.map +0 -1
- package/graphql/wcp/graphql.d.ts +0 -2
- package/graphql/wcp/graphql.js.map +0 -1
- package/legacy/security/LegacyContext.d.ts +0 -36
- package/legacy/security/LegacyContext.js +0 -152
- package/legacy/security/LegacyContext.js.map +0 -1
- package/legacy/security/createSecurityContext.d.ts +0 -3
- package/legacy/security/createSecurityContext.js +0 -10
- package/legacy/security/createSecurityContext.js.map +0 -1
- package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
- package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
- package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
- package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
- package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
- package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
- package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
- package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
- package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
- package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
- package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
- package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
- package/legacy/security/plugins/secureHeaders.d.ts +0 -1
- package/legacy/security/plugins/secureHeaders.js +0 -30
- package/legacy/security/plugins/secureHeaders.js.map +0 -1
- package/legacy/tenancy/LegacyContext.d.ts +0 -15
- package/legacy/tenancy/LegacyContext.js +0 -57
- package/legacy/tenancy/LegacyContext.js.map +0 -1
- package/legacy/tenancy/createTenancyContext.d.ts +0 -3
- package/legacy/tenancy/createTenancyContext.js +0 -31
- package/legacy/tenancy/createTenancyContext.js.map +0 -1
- package/legacy/users/LegacyContext.d.ts +0 -13
- package/legacy/users/LegacyContext.js +0 -55
- package/legacy/users/LegacyContext.js.map +0 -1
- package/legacy/users/createAdminUsersContext.d.ts +0 -3
- package/legacy/users/createAdminUsersContext.js +0 -12
- package/legacy/users/createAdminUsersContext.js.map +0 -1
- package/legacy/wcp/LegacyWcpContext.d.ts +0 -33
- package/legacy/wcp/LegacyWcpContext.js +0 -84
- package/legacy/wcp/LegacyWcpContext.js.map +0 -1
- package/legacy/wcp/context.d.ts +0 -5
- package/legacy/wcp/context.js +0 -46
- package/legacy/wcp/context.js.map +0 -1
|
@@ -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
|
|
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,
|
|
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//
|
|
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"}
|
package/features/ai/feature.js
CHANGED
|
@@ -1,15 +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";
|
|
11
|
+
import { AiOutputToolRegistry } from "./toolPipeline/AiOutputToolRegistry.js";
|
|
12
|
+
import { AiToolPipelineRunner } from "./toolPipeline/AiToolPipelineRunner.js";
|
|
13
|
+
import { DefaultTextExtractor } from "./TextExtractor/DefaultTextExtractor.js";
|
|
6
14
|
const AiFeature = createFeature({
|
|
7
15
|
name: "AiFeature",
|
|
8
16
|
register (container) {
|
|
9
17
|
container.register(OpenAiSdkFactory);
|
|
10
18
|
container.register(AnthropicSdkFactory);
|
|
19
|
+
container.register(GoogleSdkFactory);
|
|
20
|
+
container.register(OpenRouterSdkFactory);
|
|
11
21
|
container.register(Ai);
|
|
22
|
+
container.register(RemoteAiModelCatalog);
|
|
23
|
+
container.register(AiModelRegistry);
|
|
12
24
|
container.register(AiSdkTools);
|
|
25
|
+
container.register(AiSdkToolHandlerResolver);
|
|
26
|
+
container.register(AiOutputToolRegistry);
|
|
27
|
+
container.register(AiToolPipelineRunner);
|
|
28
|
+
container.register(DefaultTextExtractor);
|
|
13
29
|
}
|
|
14
30
|
});
|
|
15
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\";\n\nexport const AiFeature = createFeature({\n name: \"AiFeature\",\n register(container) {\n container.register(OpenAiSdkFactory);\n container.register(AnthropicSdkFactory);\n container.register(Ai);\n container.register(AiSdkTools);\n }\n});\n"],"names":["AiFeature","createFeature","container","OpenAiSdkFactory","AnthropicSdkFactory","Ai","AiSdkTools"],"mappings":"
|
|
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"}
|
package/features/ai/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export { AiSdk, AiSdkFactory, AiConnectionFactory, Ai,
|
|
2
|
-
export type { IAiConnection, IAiConnectionInline, AiModel, IAiSdkModel
|
|
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
|
+
export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } 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";
|
|
3
7
|
export { AiFeature } from "./feature.js";
|
package/features/ai/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { Ai, AiConnectionFactory, AiSdk, AiSdkFactory,
|
|
1
|
+
export { Ai, AiConnectionFactory, AiModelCatalog, AiModelRegistry, AiSdk, AiSdkFactory, AiSdkToolDefinition, AiSdkToolHandler, AiSdkToolHandlerResolver, AiSdkTools } from "./abstractions.js";
|
|
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";
|
|
2
5
|
export { AiFeature } from "./feature.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IAiOutputTool, type IAiOutputToolRegistry } from "./abstractions.js";
|
|
2
|
+
declare class AiOutputToolRegistryImpl implements IAiOutputToolRegistry {
|
|
3
|
+
private toolMap;
|
|
4
|
+
constructor(tools: IAiOutputTool[]);
|
|
5
|
+
has(name: string): boolean;
|
|
6
|
+
invoke(name: string, params: Record<string, unknown>): Promise<unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AiOutputToolRegistry: typeof AiOutputToolRegistryImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<IAiOutputToolRegistry>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AiOutputTool, AiOutputToolRegistry } from "./abstractions.js";
|
|
2
|
+
class AiOutputToolRegistryImpl {
|
|
3
|
+
constructor(tools){
|
|
4
|
+
this.toolMap = new Map(tools.map((t)=>[
|
|
5
|
+
t.name,
|
|
6
|
+
t
|
|
7
|
+
]));
|
|
8
|
+
}
|
|
9
|
+
has(name) {
|
|
10
|
+
return this.toolMap.has(name);
|
|
11
|
+
}
|
|
12
|
+
async invoke(name, params) {
|
|
13
|
+
const tool = this.toolMap.get(name);
|
|
14
|
+
if (!tool) return;
|
|
15
|
+
return tool.execute(params);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const AiOutputToolRegistry_AiOutputToolRegistry = AiOutputToolRegistry.createImplementation({
|
|
19
|
+
implementation: AiOutputToolRegistryImpl,
|
|
20
|
+
dependencies: [
|
|
21
|
+
[
|
|
22
|
+
AiOutputTool,
|
|
23
|
+
{
|
|
24
|
+
multiple: true
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { AiOutputToolRegistry_AiOutputToolRegistry as AiOutputToolRegistry };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=AiOutputToolRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ai/toolPipeline/AiOutputToolRegistry.js","sources":["../../../../src/features/ai/toolPipeline/AiOutputToolRegistry.ts"],"sourcesContent":["import {\n AiOutputTool,\n AiOutputToolRegistry as Abstraction,\n type IAiOutputTool,\n type IAiOutputToolRegistry\n} from \"./abstractions.js\";\n\nclass AiOutputToolRegistryImpl implements IAiOutputToolRegistry {\n private toolMap: Map<string, IAiOutputTool>;\n\n constructor(tools: IAiOutputTool[]) {\n this.toolMap = new Map(tools.map(t => [t.name, t]));\n }\n\n has(name: string): boolean {\n return this.toolMap.has(name);\n }\n\n async invoke(name: string, params: Record<string, unknown>): Promise<unknown> {\n const tool = this.toolMap.get(name);\n if (!tool) {\n return undefined;\n }\n return tool.execute(params);\n }\n}\n\nexport const AiOutputToolRegistry = Abstraction.createImplementation({\n implementation: AiOutputToolRegistryImpl,\n dependencies: [[AiOutputTool, { multiple: true }]]\n});\n"],"names":["AiOutputToolRegistryImpl","tools","Map","t","name","params","tool","AiOutputToolRegistry","Abstraction","AiOutputTool"],"mappings":";AAOA,MAAMA;IAGF,YAAYC,KAAsB,CAAE;QAChC,IAAI,CAAC,OAAO,GAAG,IAAIC,IAAID,MAAM,GAAG,CAACE,CAAAA,IAAK;gBAACA,EAAE,IAAI;gBAAEA;aAAE;IACrD;IAEA,IAAIC,IAAY,EAAW;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAACA;IAC5B;IAEA,MAAM,OAAOA,IAAY,EAAEC,MAA+B,EAAoB;QAC1E,MAAMC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAACF;QAC9B,IAAI,CAACE,MACD;QAEJ,OAAOA,KAAK,OAAO,CAACD;IACxB;AACJ;AAEO,MAAME,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBR;IAChB,cAAc;QAAC;YAACS;YAAc;gBAAE,UAAU;YAAK;SAAE;KAAC;AACtD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IAiOutputToolRegistry, type IAiToolPipelineRunner } from "./abstractions.js";
|
|
2
|
+
declare class AiToolPipelineRunnerImpl implements IAiToolPipelineRunner {
|
|
3
|
+
private registry;
|
|
4
|
+
constructor(registry: IAiOutputToolRegistry);
|
|
5
|
+
resolve(data: unknown): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare const AiToolPipelineRunner: typeof AiToolPipelineRunnerImpl & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<IAiToolPipelineRunner>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AiOutputToolRegistry, AiToolPipelineRunner } from "./abstractions.js";
|
|
2
|
+
function isToolEnvelope(value) {
|
|
3
|
+
return "object" == typeof value && null !== value && "tool" in value && "string" == typeof value.tool && "params" in value && "object" == typeof value.params;
|
|
4
|
+
}
|
|
5
|
+
class AiToolPipelineRunnerImpl {
|
|
6
|
+
constructor(registry){
|
|
7
|
+
this.registry = registry;
|
|
8
|
+
}
|
|
9
|
+
async resolve(data) {
|
|
10
|
+
if (null == data) return data;
|
|
11
|
+
if (isToolEnvelope(data)) {
|
|
12
|
+
if (!this.registry.has(data.tool)) return data;
|
|
13
|
+
const result = await this.registry.invoke(data.tool, data.params);
|
|
14
|
+
return this.resolve(result);
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(data)) return Promise.all(data.map((item)=>this.resolve(item)));
|
|
17
|
+
if ("object" == typeof data) {
|
|
18
|
+
const entries = Object.entries(data);
|
|
19
|
+
const resolvedValues = await Promise.all(entries.map(([, value])=>this.resolve(value)));
|
|
20
|
+
return Object.fromEntries(entries.map(([key], i)=>[
|
|
21
|
+
key,
|
|
22
|
+
resolvedValues[i]
|
|
23
|
+
]));
|
|
24
|
+
}
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const AiToolPipelineRunner_AiToolPipelineRunner = AiToolPipelineRunner.createImplementation({
|
|
29
|
+
implementation: AiToolPipelineRunnerImpl,
|
|
30
|
+
dependencies: [
|
|
31
|
+
AiOutputToolRegistry
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
export { AiToolPipelineRunner_AiToolPipelineRunner as AiToolPipelineRunner };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=AiToolPipelineRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ai/toolPipeline/AiToolPipelineRunner.js","sources":["../../../../src/features/ai/toolPipeline/AiToolPipelineRunner.ts"],"sourcesContent":["import {\n AiOutputToolRegistry,\n AiToolPipelineRunner as Abstraction,\n type IAiOutputToolRegistry,\n type IAiToolPipelineRunner\n} from \"./abstractions.js\";\n\nfunction isToolEnvelope(\n value: unknown\n): value is { tool: string; params: Record<string, unknown> } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"tool\" in value &&\n typeof (value as Record<string, unknown>).tool === \"string\" &&\n \"params\" in value &&\n typeof (value as Record<string, unknown>).params === \"object\"\n );\n}\n\nclass AiToolPipelineRunnerImpl implements IAiToolPipelineRunner {\n constructor(private registry: IAiOutputToolRegistry) {}\n\n async resolve(data: unknown): Promise<unknown> {\n if (data === null || data === undefined) {\n return data;\n }\n\n if (isToolEnvelope(data)) {\n if (!this.registry.has(data.tool)) {\n return data;\n }\n const result = await this.registry.invoke(data.tool, data.params);\n return this.resolve(result);\n }\n\n if (Array.isArray(data)) {\n return Promise.all(data.map(item => this.resolve(item)));\n }\n\n if (typeof data === \"object\") {\n const entries = Object.entries(data as Record<string, unknown>);\n const resolvedValues = await Promise.all(\n entries.map(([, value]) => this.resolve(value))\n );\n return Object.fromEntries(entries.map(([key], i) => [key, resolvedValues[i]]));\n }\n\n return data;\n }\n}\n\nexport const AiToolPipelineRunner = Abstraction.createImplementation({\n implementation: AiToolPipelineRunnerImpl,\n dependencies: [AiOutputToolRegistry]\n});\n"],"names":["isToolEnvelope","value","AiToolPipelineRunnerImpl","registry","data","result","Array","Promise","item","entries","Object","resolvedValues","key","i","AiToolPipelineRunner","Abstraction","AiOutputToolRegistry"],"mappings":";AAOA,SAASA,eACLC,KAAc;IAEd,OACI,AAAiB,YAAjB,OAAOA,SACPA,AAAU,SAAVA,SACA,UAAUA,SACV,AAAmD,YAAnD,OAAQA,MAAkC,IAAI,IAC9C,YAAYA,SACZ,AAAqD,YAArD,OAAQA,MAAkC,MAAM;AAExD;AAEA,MAAMC;IACF,YAAoBC,QAA+B,CAAE;aAAjCA,QAAQ,GAARA;IAAkC;IAEtD,MAAM,QAAQC,IAAa,EAAoB;QAC3C,IAAIA,QAAAA,MACA,OAAOA;QAGX,IAAIJ,eAAeI,OAAO;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,KAAK,IAAI,GAC5B,OAAOA;YAEX,MAAMC,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAACD,KAAK,IAAI,EAAEA,KAAK,MAAM;YAChE,OAAO,IAAI,CAAC,OAAO,CAACC;QACxB;QAEA,IAAIC,MAAM,OAAO,CAACF,OACd,OAAOG,QAAQ,GAAG,CAACH,KAAK,GAAG,CAACI,CAAAA,OAAQ,IAAI,CAAC,OAAO,CAACA;QAGrD,IAAI,AAAgB,YAAhB,OAAOJ,MAAmB;YAC1B,MAAMK,UAAUC,OAAO,OAAO,CAACN;YAC/B,MAAMO,iBAAiB,MAAMJ,QAAQ,GAAG,CACpCE,QAAQ,GAAG,CAAC,CAAC,GAAGR,MAAM,GAAK,IAAI,CAAC,OAAO,CAACA;YAE5C,OAAOS,OAAO,WAAW,CAACD,QAAQ,GAAG,CAAC,CAAC,CAACG,IAAI,EAAEC,IAAM;oBAACD;oBAAKD,cAAc,CAACE,EAAE;iBAAC;QAChF;QAEA,OAAOT;IACX;AACJ;AAEO,MAAMU,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBb;IAChB,cAAc;QAACc;KAAqB;AACxC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface IAiOutputTool {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
execute(params: Record<string, unknown>): Promise<unknown>;
|
|
4
|
+
}
|
|
5
|
+
export declare const AiOutputTool: import("@webiny/di").Abstraction<IAiOutputTool>;
|
|
6
|
+
export declare namespace AiOutputTool {
|
|
7
|
+
type Interface = IAiOutputTool;
|
|
8
|
+
}
|
|
9
|
+
export interface IAiOutputToolRegistry {
|
|
10
|
+
has(name: string): boolean;
|
|
11
|
+
invoke(name: string, params: Record<string, unknown>): Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
export declare const AiOutputToolRegistry: import("@webiny/di").Abstraction<IAiOutputToolRegistry>;
|
|
14
|
+
export declare namespace AiOutputToolRegistry {
|
|
15
|
+
type Interface = IAiOutputToolRegistry;
|
|
16
|
+
}
|
|
17
|
+
export interface IAiToolPipelineRunner {
|
|
18
|
+
resolve(data: unknown): Promise<unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const AiToolPipelineRunner: import("@webiny/di").Abstraction<IAiToolPipelineRunner>;
|
|
21
|
+
export declare namespace AiToolPipelineRunner {
|
|
22
|
+
type Interface = IAiToolPipelineRunner;
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const AiOutputTool = createAbstraction("AiOutputTool");
|
|
3
|
+
const AiOutputToolRegistry = createAbstraction("AiOutputToolRegistry");
|
|
4
|
+
const AiToolPipelineRunner = createAbstraction("AiToolPipelineRunner");
|
|
5
|
+
export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ai/toolPipeline/abstractions.js","sources":["../../../../src/features/ai/toolPipeline/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IAiOutputTool {\n readonly name: string;\n execute(params: Record<string, unknown>): Promise<unknown>;\n}\n\nexport const AiOutputTool = createAbstraction<IAiOutputTool>(\"AiOutputTool\");\n\nexport namespace AiOutputTool {\n export type Interface = IAiOutputTool;\n}\n\nexport interface IAiOutputToolRegistry {\n has(name: string): boolean;\n invoke(name: string, params: Record<string, unknown>): Promise<unknown>;\n}\n\nexport const AiOutputToolRegistry =\n createAbstraction<IAiOutputToolRegistry>(\"AiOutputToolRegistry\");\n\nexport namespace AiOutputToolRegistry {\n export type Interface = IAiOutputToolRegistry;\n}\n\nexport interface IAiToolPipelineRunner {\n resolve(data: unknown): Promise<unknown>;\n}\n\nexport const AiToolPipelineRunner =\n createAbstraction<IAiToolPipelineRunner>(\"AiToolPipelineRunner\");\n\nexport namespace AiToolPipelineRunner {\n export type Interface = IAiToolPipelineRunner;\n}\n"],"names":["AiOutputTool","createAbstraction","AiOutputToolRegistry","AiToolPipelineRunner"],"mappings":";AAOO,MAAMA,eAAeC,kBAAiC;AAWtD,MAAMC,uBACTD,kBAAyC;AAUtC,MAAME,uBACTF,kBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AiOutputTool, AiOutputToolRegistry, AiToolPipelineRunner } from "./abstractions.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/dateFormatter/DefaultDateFormatter.js","sources":["../../../src/features/dateFormatter/DefaultDateFormatter.ts"],"sourcesContent":["import { DateFormatter } from \"./abstractions.js\";\nimport type { FormattableDate } from \"./abstractions.js\";\n\nconst pad = (value: number): string => {\n return String(value).padStart(2, \"0\");\n};\n\n/**\n * Default absolute date/time format: `YYYY-MM-DD HH:mm`, 24-hour, UTC. Built from UTC parts rather\n * than `Intl.DateTimeFormat` so the output is fully deterministic — backend formatting must not\n * depend on the server locale or the bundled ICU version. Projects can change it by decorating\n * DateFormatter.\n */\nclass DefaultDateFormatterImpl implements DateFormatter.Interface {\n format(date: FormattableDate): string {\n const value = new Date(date);\n const year = value.getUTCFullYear();\n const month = pad(value.getUTCMonth() + 1);\n const day = pad(value.getUTCDate());\n const hours = pad(value.getUTCHours());\n const minutes = pad(value.getUTCMinutes());\n return `${year}-${month}-${day} ${hours}:${minutes}`;\n }\n}\n\nexport const DefaultDateFormatter = DateFormatter.createImplementation({\n implementation: DefaultDateFormatterImpl,\n dependencies: []\n});\n"],"names":["pad","value","String","DefaultDateFormatterImpl","date","Date","year","month","day","hours","minutes","DefaultDateFormatter","DateFormatter"],"mappings":";AAGA,MAAMA,MAAM,CAACC,QACFC,OAAOD,OAAO,QAAQ,CAAC,GAAG;AASrC,MAAME;IACF,OAAOC,IAAqB,EAAU;QAClC,MAAMH,QAAQ,IAAII,KAAKD;QACvB,MAAME,OAAOL,MAAM,cAAc;QACjC,MAAMM,QAAQP,IAAIC,MAAM,WAAW,KAAK;QACxC,MAAMO,MAAMR,IAAIC,MAAM,UAAU;QAChC,MAAMQ,QAAQT,IAAIC,MAAM,WAAW;QACnC,MAAMS,UAAUV,IAAIC,MAAM,aAAa;QACvC,OAAO,GAAGK,KAAK,CAAC,EAAEC,MAAM,CAAC,EAAEC,IAAI,CAAC,EAAEC,MAAM,CAAC,EAAEC,SAAS;IACxD;AACJ;AAEO,MAAMC,uBAAuBC,cAAc,oBAAoB,CAAC;IACnE,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type FormattableDate = Date | string | number;
|
|
2
|
+
export interface IDateFormatter {
|
|
3
|
+
/**
|
|
4
|
+
* Formats an absolute date/time as a string using Webiny's default format. Change the format
|
|
5
|
+
* everywhere at once by decorating this abstraction.
|
|
6
|
+
*/
|
|
7
|
+
format(date: FormattableDate): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DateFormatter: import("@webiny/di").Abstraction<IDateFormatter>;
|
|
10
|
+
export declare namespace DateFormatter {
|
|
11
|
+
type Interface = IDateFormatter;
|
|
12
|
+
type Value = FormattableDate;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/dateFormatter/abstractions.js","sources":["../../../src/features/dateFormatter/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport type FormattableDate = Date | string | number;\n\nexport interface IDateFormatter {\n /**\n * Formats an absolute date/time as a string using Webiny's default format. Change the format\n * everywhere at once by decorating this abstraction.\n */\n format(date: FormattableDate): string;\n}\n\nexport const DateFormatter = createAbstraction<IDateFormatter>(\"DateFormatter\");\n\nexport namespace DateFormatter {\n export type Interface = IDateFormatter;\n export type Value = FormattableDate;\n}\n"],"names":["DateFormatter","createAbstraction"],"mappings":";AAYO,MAAMA,gBAAgBC,kBAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { DefaultDateFormatter } from "./DefaultDateFormatter.js";
|
|
3
|
+
const DateFormatterFeature = createFeature({
|
|
4
|
+
name: "DateFormatterFeature",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(DefaultDateFormatter);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { DateFormatterFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/dateFormatter/feature.js","sources":["../../../src/features/dateFormatter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DefaultDateFormatter } from \"./DefaultDateFormatter.js\";\n\nexport const DateFormatterFeature = createFeature({\n name: \"DateFormatterFeature\",\n register(container) {\n container.register(DefaultDateFormatter);\n }\n});\n"],"names":["DateFormatterFeature","createFeature","container","DefaultDateFormatter"],"mappings":";;AAGO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Debugger as DebuggerAbstraction } from "./abstractions.js";
|
|
2
|
+
import { DebuggerTransport } from "./abstractions.js";
|
|
3
|
+
import type { DebugNamespace } from "./abstractions.js";
|
|
4
|
+
import type { IDebugDeliveryTarget } from "./abstractions.js";
|
|
5
|
+
import type { IDebuggerStartParams } from "./abstractions.js";
|
|
6
|
+
import type { IDebugPayloadFactory } from "./abstractions.js";
|
|
7
|
+
import { IdentityContext } from "../../features/security/IdentityContext/index.js";
|
|
8
|
+
import { BuildParams } from "../../features/buildParams/index.js";
|
|
9
|
+
import { Logger } from "../../features/logger/index.js";
|
|
10
|
+
export declare class DebuggerImpl implements DebuggerAbstraction.Interface {
|
|
11
|
+
private readonly identityContext;
|
|
12
|
+
private readonly buildParams;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
private readonly transports;
|
|
15
|
+
private session;
|
|
16
|
+
private readonly limits;
|
|
17
|
+
constructor(identityContext: IdentityContext.Interface, buildParams: BuildParams.Interface, logger: Logger.Interface, transports: DebuggerTransport.Interface[]);
|
|
18
|
+
start(params: IDebuggerStartParams): void;
|
|
19
|
+
isEnabled(namespace: DebugNamespace): boolean;
|
|
20
|
+
log(namespace: DebugNamespace, payload: IDebugPayloadFactory): void;
|
|
21
|
+
flush(target: IDebugDeliveryTarget): Promise<void>;
|
|
22
|
+
discard(): void;
|
|
23
|
+
private isDisabled;
|
|
24
|
+
/**
|
|
25
|
+
* Drops entries from the front until the session fits the byte budget. The client reproduces the
|
|
26
|
+
* bug, so the failure is at the end of the session and the tail is what matters.
|
|
27
|
+
*/
|
|
28
|
+
private enforceBudget;
|
|
29
|
+
}
|
|
30
|
+
export declare const Debugger: import("@webiny/di").Implementation<typeof DebuggerImpl>;
|