From a4efb6af42d8283c15407844585e33c8670165e8 Mon Sep 17 00:00:00 2001 From: Aubin Date: Tue, 14 Jan 2025 14:47:21 +0100 Subject: [PATCH] pass the provider_visibility when upserting folders --- connectors/src/lib/data_sources.ts | 3 +++ .../spaces/[spaceId]/data_sources/[dsId]/folders/[fId].ts | 2 ++ sdks/js/src/index.ts | 3 +++ sdks/js/src/types.ts | 1 + types/src/front/lib/core_api.ts | 3 +++ 5 files changed, 12 insertions(+) diff --git a/connectors/src/lib/data_sources.ts b/connectors/src/lib/data_sources.ts index d94a314e3c770..202c11a8ec55b 100644 --- a/connectors/src/lib/data_sources.ts +++ b/connectors/src/lib/data_sources.ts @@ -1240,6 +1240,7 @@ export async function _upsertDataSourceFolder({ parentId, title, mimeType, + providerVisibility, }: { dataSourceConfig: DataSourceConfig; folderId: string; @@ -1248,6 +1249,7 @@ export async function _upsertDataSourceFolder({ parentId: string | null; title: string; mimeType: string; + providerVisibility?: string; }) { const now = new Date(); @@ -1259,6 +1261,7 @@ export async function _upsertDataSourceFolder({ parentId, parents, mimeType, + providerVisibility: providerVisibility || null, }); if (r.isErr()) { diff --git a/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/folders/[fId].ts b/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/folders/[fId].ts index 02ae4c3a48288..f36318ed5026f 100644 --- a/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/folders/[fId].ts +++ b/front/pages/api/v1/w/[wId]/spaces/[spaceId]/data_sources/[dsId]/folders/[fId].ts @@ -120,6 +120,7 @@ async function handler( parents, title, mime_type, + provider_visibility, } = r.data; if (parentId && parents && parents[1] !== parentId) { return apiError(req, res, { @@ -153,6 +154,7 @@ async function handler( parents: parents || [fId], title: title, mimeType: mime_type, + providerVisibility: provider_visibility, }); if (upsertRes.isErr()) { diff --git a/sdks/js/src/index.ts b/sdks/js/src/index.ts index 31bc68e0d7a95..0107854cb21aa 100644 --- a/sdks/js/src/index.ts +++ b/sdks/js/src/index.ts @@ -829,6 +829,7 @@ export class DustAPI { parentId, parents, mimeType, + providerVisibility, }: { dataSourceId: string; folderId: string; @@ -837,6 +838,7 @@ export class DustAPI { parentId: string | null; parents: string[]; mimeType: string; + providerVisibility: string | null; }) { const res = await this.request({ method: "POST", @@ -849,6 +851,7 @@ export class DustAPI { parent_id: parentId, parents, mime_type: mimeType, + provider_visibility: providerVisibility, }, }); diff --git a/sdks/js/src/types.ts b/sdks/js/src/types.ts index c9a9928b6090a..289ac68016dd3 100644 --- a/sdks/js/src/types.ts +++ b/sdks/js/src/types.ts @@ -2120,6 +2120,7 @@ export const UpsertDataSourceFolderRequestSchema = z.object({ parent_id: z.string().nullable().optional(), title: z.string(), mime_type: z.string(), + provider_visibility: z.string().nullable().optional(), }); export type UpsertDataSourceFolderRequestType = z.infer< typeof UpsertDataSourceFolderRequestSchema diff --git a/types/src/front/lib/core_api.ts b/types/src/front/lib/core_api.ts index 3569938d9cf30..b240ea160f6eb 100644 --- a/types/src/front/lib/core_api.ts +++ b/types/src/front/lib/core_api.ts @@ -1543,6 +1543,7 @@ export class CoreAPI { parents, title, mimeType, + providerVisibility, }: { projectId: string; dataSourceId: string; @@ -1552,6 +1553,7 @@ export class CoreAPI { parents: string[]; title: string; mimeType: string; + providerVisibility: string | null | undefined; }): Promise> { const response = await this._fetchWithError( `${this._url}/projects/${projectId}/data_sources/${encodeURIComponent( @@ -1569,6 +1571,7 @@ export class CoreAPI { parent_id: parentId, parents, mime_type: mimeType, + provider_visibility: providerVisibility, }), } );