diff --git a/connectors/src/connectors/slack/lib/channels.ts b/connectors/src/connectors/slack/lib/channels.ts index cacb3ba0db1f..941bdbff8792 100644 --- a/connectors/src/connectors/slack/lib/channels.ts +++ b/connectors/src/connectors/slack/lib/channels.ts @@ -18,6 +18,7 @@ export type SlackChannelType = { slackId: string; permission: ConnectorPermission; agentConfigurationId: string | null; + private: boolean; }; export async function updateSlackChannelInConnectorsDb({ @@ -60,6 +61,7 @@ export async function updateSlackChannelInConnectorsDb({ slackId: channel.slackChannelId, permission: channel.permission, agentConfigurationId: channel.agentConfigurationId, + private: channel.private, }; } diff --git a/connectors/src/connectors/slack/temporal/activities.ts b/connectors/src/connectors/slack/temporal/activities.ts index 02428ac3b9fc..ca53eeb9eebd 100644 --- a/connectors/src/connectors/slack/temporal/activities.ts +++ b/connectors/src/connectors/slack/temporal/activities.ts @@ -257,6 +257,7 @@ export async function syncChannel( parents: [slackChannelInternalIdFromSlackChannelId(channelId)], mimeType: MIME_TYPES.SLACK.CHANNEL, sourceUrl: getSlackChannelSourceUrl(channelId, slackConfiguration), + providerVisibility: channel.private ? "private" : "public", }); } diff --git a/connectors/src/lib/data_sources.ts b/connectors/src/lib/data_sources.ts index 0fe47cfe3a10..3891a0905a6e 100644 --- a/connectors/src/lib/data_sources.ts +++ b/connectors/src/lib/data_sources.ts @@ -9,6 +9,7 @@ import type { CoreAPIFolder, CoreAPITable, PostDataSourceDocumentRequestBody, + ProviderVisibility, } from "@dust-tt/types"; import { isValidDate, @@ -1244,6 +1245,7 @@ export async function _upsertDataSourceFolder({ title, mimeType, sourceUrl, + providerVisibility, }: { dataSourceConfig: DataSourceConfig; folderId: string; @@ -1253,6 +1255,7 @@ export async function _upsertDataSourceFolder({ title: string; mimeType: string; sourceUrl?: string; + providerVisibility?: ProviderVisibility; }) { const now = new Date(); @@ -1265,6 +1268,7 @@ export async function _upsertDataSourceFolder({ parents, mimeType, sourceUrl: sourceUrl ?? null, + 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 4d789295837e..f0919c62ee0f 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 @@ -121,6 +121,7 @@ async function handler( title, mime_type, source_url, + provider_visibility, } = r.data; if (parentId && parents && parents[1] !== parentId) { return apiError(req, res, { @@ -155,6 +156,7 @@ async function handler( title: title, mimeType: mime_type, sourceUrl: source_url ?? null, + providerVisibility: provider_visibility, }); if (upsertRes.isErr()) { diff --git a/sdks/js/src/index.ts b/sdks/js/src/index.ts index e30712546eef..b7867e56fc2c 100644 --- a/sdks/js/src/index.ts +++ b/sdks/js/src/index.ts @@ -852,6 +852,7 @@ export class DustAPI { parents, mimeType, sourceUrl, + providerVisibility, }: { dataSourceId: string; folderId: string; @@ -861,6 +862,7 @@ export class DustAPI { parents: string[]; mimeType: string; sourceUrl: string | null; + providerVisibility: "public" | "private" | null; }) { const res = await this.request({ method: "POST", @@ -874,6 +876,7 @@ export class DustAPI { parents, mime_type: mimeType, source_url: sourceUrl, + provider_visibility: providerVisibility, }, }); diff --git a/sdks/js/src/types.ts b/sdks/js/src/types.ts index 6cc5f662686d..c8d3d716f72c 100644 --- a/sdks/js/src/types.ts +++ b/sdks/js/src/types.ts @@ -2145,6 +2145,8 @@ export type UpsertFolderResponseType = z.infer< typeof UpsertFolderResponseSchema >; +const ProviderVisibilitySchema = FlexibleEnumSchema<"public" | "private">(); + export const UpsertDataSourceFolderRequestSchema = z.object({ timestamp: z.number(), parents: z.array(z.string()).nullable().optional(), @@ -2152,6 +2154,7 @@ export const UpsertDataSourceFolderRequestSchema = z.object({ title: z.string(), mime_type: z.string(), source_url: z.string().nullable().optional(), + provider_visibility: ProviderVisibilitySchema.nullable().optional(), }); export type UpsertDataSourceFolderRequestType = z.infer< typeof UpsertDataSourceFolderRequestSchema diff --git a/types/src/front/lib/connectors_api.ts b/types/src/front/lib/connectors_api.ts index 863598f6bbe0..78ac41372b66 100644 --- a/types/src/front/lib/connectors_api.ts +++ b/types/src/front/lib/connectors_api.ts @@ -56,6 +56,7 @@ export type ConnectorType = { */ export type ConnectorPermission = "read" | "write" | "read_write" | "none"; export type ContentNodeType = "file" | "folder" | "database" | "channel"; +export type ProviderVisibility = "public" | "private"; /* * This constant defines the priority order for sorting content nodes by their type. @@ -107,7 +108,7 @@ export interface ContentNode { preventSelection?: boolean; permission: ConnectorPermission; lastUpdatedAt: number | null; - providerVisibility?: "public" | "private"; + providerVisibility?: ProviderVisibility; } export type ContentNodeWithParentIds = ContentNode & { diff --git a/types/src/front/lib/core_api.ts b/types/src/front/lib/core_api.ts index a7bd77bbbee1..adaadfeea473 100644 --- a/types/src/front/lib/core_api.ts +++ b/types/src/front/lib/core_api.ts @@ -26,6 +26,7 @@ import { import { LightWorkspaceType } from "../../front/user"; import { LoggerInterface } from "../../shared/logger"; import { Err, Ok, Result } from "../../shared/result"; +import { ProviderVisibility } from "./connectors_api"; export const MAX_CHUNK_SIZE = 512; @@ -1547,6 +1548,7 @@ export class CoreAPI { title, mimeType, sourceUrl, + providerVisibility, }: { projectId: string; dataSourceId: string; @@ -1557,6 +1559,7 @@ export class CoreAPI { title: string; mimeType: string; sourceUrl?: string | null; + providerVisibility: ProviderVisibility | null | undefined; }): Promise> { const response = await this._fetchWithError( `${this._url}/projects/${projectId}/data_sources/${encodeURIComponent( @@ -1575,6 +1578,7 @@ export class CoreAPI { parents, mime_type: mimeType, source_url: sourceUrl, + provider_visibility: providerVisibility, }), } );