feat(files): orchestrate connector folder sync
Module Package Release / publish-packages (push) Successful in 12s
Module Package Release / publish-packages (push) Successful in 12s
This commit is contained in:
+54
-1
@@ -426,6 +426,48 @@ export type FileConnectorSyncResponse = {
|
||||
previous_version_id?: string | null;
|
||||
current_version_id: string;
|
||||
};
|
||||
export type FileConnectorFolderSyncAction = "created" | "updated" | "unchanged" | "skipped" | "conflict" | "policy_denied" | "failed";
|
||||
export type FileConnectorFolderSyncItem = {
|
||||
source_path: string;
|
||||
target_path?: string | null;
|
||||
action: FileConnectorFolderSyncAction;
|
||||
file?: ManagedFile | null;
|
||||
previous_version_id?: string | null;
|
||||
current_version_id?: string | null;
|
||||
source_revision?: string | null;
|
||||
detail?: string | null;
|
||||
policy_decision?: FileConnectorPolicyDecision | null;
|
||||
};
|
||||
export type FileConnectorFolderSyncSummary = {
|
||||
discovered: number;
|
||||
created: number;
|
||||
updated: number;
|
||||
unchanged: number;
|
||||
skipped: number;
|
||||
conflicts: number;
|
||||
policy_denied: number;
|
||||
failed: number;
|
||||
};
|
||||
export type FileConnectorFolderSyncResponse = {
|
||||
connector_space_id: string;
|
||||
connector_profile_id: string;
|
||||
provider: string;
|
||||
remote_path: string;
|
||||
target_folder: string;
|
||||
recursive: boolean;
|
||||
truncated: boolean;
|
||||
summary: FileConnectorFolderSyncSummary;
|
||||
items: FileConnectorFolderSyncItem[];
|
||||
};
|
||||
export type FileConnectorFolderSyncPayload = {
|
||||
path?: string;
|
||||
target_folder?: string | null;
|
||||
recursive?: boolean;
|
||||
conflict_strategy?: "reject" | "overwrite" | "rename" | "skip";
|
||||
max_files?: number;
|
||||
max_depth?: number;
|
||||
metadata?: Record<string, unknown>;
|
||||
};
|
||||
export type FileConnectorWritePayload = {
|
||||
file_id: string;
|
||||
remote_path: string;
|
||||
@@ -502,7 +544,7 @@ export type FileBlobGcResponse = {
|
||||
export type RenameResponse = {dry_run: boolean;items: {kind: "file" | "folder";id: string;file_id?: string | null;folder_path?: string | null;old_path: string;new_path: string;}[];};
|
||||
export type TransferResponse = {operation: "move" | "copy";files: number;folders: number;};
|
||||
export type ConflictAction = "overwrite" | "rename" | "skip";
|
||||
export type ConflictStrategy = "reject" | "overwrite" | "rename";
|
||||
export type ConflictStrategy = "reject" | "overwrite" | "rename" | "skip";
|
||||
export type ConflictResolution = {target_path: string;action: ConflictAction;new_path?: string;};
|
||||
export type PatternResolveResponse = {
|
||||
patterns: {pattern: string;matches: ManagedFile[];}[];
|
||||
@@ -1176,6 +1218,17 @@ payload: FileConnectorFilePayload)
|
||||
});
|
||||
}
|
||||
|
||||
export function syncFileConnectorSpaceFolder(
|
||||
settings: ApiSettings,
|
||||
spaceId: string,
|
||||
payload: FileConnectorFolderSyncPayload)
|
||||
: Promise<FileConnectorFolderSyncResponse> {
|
||||
return apiFetch<FileConnectorFolderSyncResponse>(settings, `/api/v1/files/connector-spaces/${encodeURIComponent(spaceId)}/sync`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ path: "", target_folder: "", recursive: true, conflict_strategy: "skip", max_files: 100, max_depth: 12, metadata: {}, ...payload })
|
||||
});
|
||||
}
|
||||
|
||||
export function shareFilesWithCampaign(settings: ApiSettings, fileIds: string[], campaignId: string): Promise<FileBulkShareResponse> {
|
||||
return shareFilesWithTarget(settings, fileIds, { type: "campaign", id: campaignId, label: "campaign" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user