diff --git a/front/pages/api/w/[wId]/data_sources/managed.ts b/front/pages/api/w/[wId]/data_sources/managed.ts index 883276e5f18d9..bbfab032691d1 100644 --- a/front/pages/api/w/[wId]/data_sources/managed.ts +++ b/front/pages/api/w/[wId]/data_sources/managed.ts @@ -2,6 +2,7 @@ import type { DataSourceType, WithAPIErrorReponse } from "@dust-tt/types"; import type { ConnectorType } from "@dust-tt/types"; import { assertNever, + ConnectorConfigurationTypeSchema, DEFAULT_FREE_QDRANT_CLUSTER, DEFAULT_PAID_QDRANT_CLUSTER, EMBEDDING_CONFIG, @@ -36,7 +37,7 @@ export const PostManagedDataSourceRequestBodySchema = t.type({ provider: t.string, connectionId: t.union([t.string, t.undefined]), name: t.union([t.string, t.undefined]), - configuration: t.unknown, + configuration: ConnectorConfigurationTypeSchema, }); export type PostManagedDataSourceRequestBody = t.TypeOf< diff --git a/front/pages/w/[wId]/builder/data-sources/managed.tsx b/front/pages/w/[wId]/builder/data-sources/managed.tsx index dd7dfacaf656d..efdd3b74a23b2 100644 --- a/front/pages/w/[wId]/builder/data-sources/managed.tsx +++ b/front/pages/w/[wId]/builder/data-sources/managed.tsx @@ -443,7 +443,7 @@ export default function DataSourcesView({ provider, connectionId, name: undefined, - configuration: undefined, + configuration: null, } satisfies PostManagedDataSourceRequestBody), } ); diff --git a/types/src/connectors/api_handlers/connector_configuration.ts b/types/src/connectors/api_handlers/connector_configuration.ts index 49fd698279775..d577abc192302 100644 --- a/types/src/connectors/api_handlers/connector_configuration.ts +++ b/types/src/connectors/api_handlers/connector_configuration.ts @@ -34,8 +34,13 @@ export type ConnectorConfigurations = { intercom: null; }; +export const ConnectorConfigurationTypeSchema = t.union([ + WebCrawlerConfigurationTypeSchema, + t.null, +]); + export const UpdateConnectorConfigurationTypeSchema = t.type({ - configuration: t.union([WebCrawlerConfigurationTypeSchema, t.null]), + configuration: ConnectorConfigurationTypeSchema, }); export type UpdateConnectorConfigurationType = t.TypeOf< diff --git a/types/src/connectors/api_handlers/create_connector.ts b/types/src/connectors/api_handlers/create_connector.ts index 220559a2a58b4..b1b134fd5a440 100644 --- a/types/src/connectors/api_handlers/create_connector.ts +++ b/types/src/connectors/api_handlers/create_connector.ts @@ -1,11 +1,13 @@ import * as t from "io-ts"; +import { ConnectorConfigurationTypeSchema } from "./connector_configuration"; + export const ConnectorCreateRequestBodySchema = t.type({ workspaceAPIKey: t.string, dataSourceName: t.string, workspaceId: t.string, connectionId: t.string, - configuration: t.unknown, + configuration: ConnectorConfigurationTypeSchema, }); export type ConnectorCreateRequestBody = t.TypeOf< diff --git a/types/src/front/lib/connectors_api.ts b/types/src/front/lib/connectors_api.ts index d41887ed8c4f4..e9f2aed1a5669 100644 --- a/types/src/front/lib/connectors_api.ts +++ b/types/src/front/lib/connectors_api.ts @@ -131,7 +131,7 @@ export class ConnectorsAPI { workspaceAPIKey: string, dataSourceName: string, connectionId: string, - configuration: unknown + configuration: ConnectorConfiguration ): Promise> { const res = await fetch( `${CONNECTORS_API}/connectors/create/${encodeURIComponent(provider)}`,