Skip to content

Commit

Permalink
pass the provider_visibility when upserting folders
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Jan 14, 2025
1 parent a928cd9 commit a4efb6a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions connectors/src/lib/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ export async function _upsertDataSourceFolder({
parentId,
title,
mimeType,
providerVisibility,
}: {
dataSourceConfig: DataSourceConfig;
folderId: string;
Expand All @@ -1248,6 +1249,7 @@ export async function _upsertDataSourceFolder({
parentId: string | null;
title: string;
mimeType: string;
providerVisibility?: string;
}) {
const now = new Date();

Expand All @@ -1259,6 +1261,7 @@ export async function _upsertDataSourceFolder({
parentId,
parents,
mimeType,
providerVisibility: providerVisibility || null,
});

if (r.isErr()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -153,6 +154,7 @@ async function handler(
parents: parents || [fId],
title: title,
mimeType: mime_type,
providerVisibility: provider_visibility,
});

if (upsertRes.isErr()) {
Expand Down
3 changes: 3 additions & 0 deletions sdks/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ export class DustAPI {
parentId,
parents,
mimeType,
providerVisibility,
}: {
dataSourceId: string;
folderId: string;
Expand All @@ -837,6 +838,7 @@ export class DustAPI {
parentId: string | null;
parents: string[];
mimeType: string;
providerVisibility: string | null;
}) {
const res = await this.request({
method: "POST",
Expand All @@ -849,6 +851,7 @@ export class DustAPI {
parent_id: parentId,
parents,
mime_type: mimeType,
provider_visibility: providerVisibility,
},
});

Expand Down
1 change: 1 addition & 0 deletions sdks/js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions types/src/front/lib/core_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,7 @@ export class CoreAPI {
parents,
title,
mimeType,
providerVisibility,
}: {
projectId: string;
dataSourceId: string;
Expand All @@ -1552,6 +1553,7 @@ export class CoreAPI {
parents: string[];
title: string;
mimeType: string;
providerVisibility: string | null | undefined;
}): Promise<CoreAPIResponse<{ folder: CoreAPIFolder }>> {
const response = await this._fetchWithError(
`${this._url}/projects/${projectId}/data_sources/${encodeURIComponent(
Expand All @@ -1569,6 +1571,7 @@ export class CoreAPI {
parent_id: parentId,
parents,
mime_type: mimeType,
provider_visibility: providerVisibility,
}),
}
);
Expand Down

0 comments on commit a4efb6a

Please sign in to comment.