Skip to content

Commit

Permalink
Removing unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
lasryaric committed Apr 4, 2024
1 parent cc965a4 commit 09f3de4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion front/pages/api/w/[wId]/data_sources/managed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<
Expand Down
2 changes: 1 addition & 1 deletion front/pages/w/[wId]/builder/data-sources/managed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export default function DataSourcesView({
provider,
connectionId,
name: undefined,
configuration: undefined,
configuration: null,
} satisfies PostManagedDataSourceRequestBody),
}
);
Expand Down
7 changes: 6 additions & 1 deletion types/src/connectors/api_handlers/connector_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
4 changes: 3 additions & 1 deletion types/src/connectors/api_handlers/create_connector.ts
Original file line number Diff line number Diff line change
@@ -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<
Expand Down
2 changes: 1 addition & 1 deletion types/src/front/lib/connectors_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class ConnectorsAPI {
workspaceAPIKey: string,
dataSourceName: string,
connectionId: string,
configuration: unknown
configuration: ConnectorConfiguration
): Promise<ConnectorsAPIResponse<ConnectorType>> {
const res = await fetch(
`${CONNECTORS_API}/connectors/create/${encodeURIComponent(provider)}`,
Expand Down

0 comments on commit 09f3de4

Please sign in to comment.