import type { CursorListParams, CursorPage, Employee, } from "./_shared"; import type { listScripts, countScripts, createScript, uploadScript, setScriptLock, updateScript, deleteScript, getLatestScriptVersion, publishScriptVersion, ScriptItem, Visibility, LatestVersion, StableVersion, } from "./scripts"; import type { listResources, deleteResource, fetchResourceContentFile, fetchResourcePreview, createResourceUpload, uploadResourceBytes, bindResourceUpload, listWorkspaceDirectories, createWorkspaceDirectory, deleteWorkspaceDirectory, ResourceItem, ResourcePreviewPayload, WorkspaceDirectory, } from "./resources"; import type { acquireFileLock, heartbeatFileLock, releaseFileLock, releaseFileLockOnUnload, createJupyterAccessTicket, ActiveEditSession, FileLockSession, JupyterAccessTicket, } from "./fileLocks"; import type { listSchedules, getSchedule, createSchedule, updateSchedule, deleteSchedule, listScheduleArtifacts, hideScheduleArtifact, Schedule, ScheduleArtifact, CronPreview, ScheduleRunDetail, ScheduleRunSummary, ScheduleNodeRunArtifacts, } from "./schedules"; import type { createScheduleNode, updateScheduleNode, deleteScheduleNode, createScheduleEdge, deleteScheduleEdge, validateSchedule, previewCron, runScheduleNow, listScheduleRuns, getScheduleRun, getScheduleNodeRunArtifacts, DagValidation, } from "./scheduleGraph"; import type { listPlatformEmployees, createPlatformEmployee, updatePlatformEmployee, deletePlatformEmployee, } from "./platformEmployees"; import type { listPlatformRoles, getPlatformRole, listPlatformPermissions, createPlatformRole, updatePlatformRole, deletePlatformRole, updatePlatformRolePermissions, Role, PlatformPermission, RoleCreatePayload, RoleUpdatePayload, } from "./platformRoles"; import type { listEmployees, createEmployee, updateEmployee, deleteEmployee, } from "./employees"; import type { listWorkspaces, createWorkspace, updateWorkspace, deleteWorkspace, Workspace, WorkspaceCreatePayload, WorkspaceUpdatePayload, } from "./workspaces"; import type { listWorkspaceMembers, addWorkspaceMember, updateWorkspaceMember, deleteWorkspaceMember, WorkspaceMember, WorkspaceMemberAddPayload, WorkspaceMemberUpdatePayload, } from "./workspaceMembers"; // Workspace-bound API surface. // // `useApi()` in ~/context/AuthContext returns an object where every // function has had its first `workspaceId` argument pre-filled. The // type below lets consumers import the bound type without depending // on the raw functions. Keep this last in the file so the type // references all the exports above. // ---------------------------------------------------------------------------- export type WorkspaceBoundApi = { listScripts: ( parentPath?: Parameters[1], ownerUserId?: Parameters[2], ) => Promise; countScripts: () => Promise; listResources: ( parentPath?: Parameters[1], opts?: Parameters[2], ) => Promise; createScript: ( input: Parameters[1], ) => Promise; uploadScript: ( file: File, parentPath?: string, visibility?: Visibility, ) => Promise; createResourceUpload: ( body: Parameters[1], ) => Promise<{ upload_id: string; upload_path: string }>; uploadResourceBytes: ( uploadId: string, fileBytes: ArrayBuffer | Blob, contentType: string, ) => Promise<{ storage_object_id: string }>; bindResourceUpload: ( uploadId: string, body: Parameters[2], ) => Promise; deleteResource: ( resourceId: string, ) => Promise<{ resource_id: string; status: string }>; fetchResourceContentFile: ( resourceId: string, fileName: string, signal?: AbortSignal, ) => Promise; fetchResourcePreview: ( resourceId: string, input?: { limit?: number }, signal?: AbortSignal, ) => Promise; updateScript: ( scriptId: string, input: Parameters[2], ) => Promise; deleteScript: ( scriptId: string, ) => Promise<{ script_id: string; status: string; versions_preserved: boolean }>; setScriptLock: ( scriptId: string, isLocked: boolean, ) => Promise; listWorkspaceDirectories: ( parentPath?: Parameters[1], ownerUserId?: Parameters[2], ) => Promise; createWorkspaceDirectory: ( directoryName: string, parentPath?: string, ) => Promise; deleteWorkspaceDirectory: ( path: string, ) => Promise<{ path: string; status: string; deleted_scripts: number; versions_preserved: boolean; }>; acquireFileLock: ( script: ScriptItem, ) => Promise; heartbeatFileLock: ( session: ActiveEditSession, ) => Promise; releaseFileLock: ( session: ActiveEditSession, ) => Promise; releaseFileLockOnUnload: (session: ActiveEditSession) => void; createJupyterAccessTicket: ( session: ActiveEditSession, ) => Promise; getLatestScriptVersion: (scriptId: string) => Promise; publishScriptVersion: ( input: Parameters[1], ) => Promise; listSchedules: () => Promise; getSchedule: (scheduleId: string) => Promise; createSchedule: ( input: Parameters[1], ) => Promise; updateSchedule: ( scheduleId: string, input: Parameters[2], ) => Promise; deleteSchedule: ( scheduleId: string, workflowVersion: number, ) => Promise<{ schedule_id: string; deleted: boolean; workflow_version: number }>; listScheduleArtifacts: () => Promise; hideScheduleArtifact: ( versionsId: string, ) => Promise<{ versions_id: string; deleted: boolean; artifact_preserved: boolean; }>; listEmployees: () => Promise; listPlatformEmployees: ( input?: CursorListParams, ) => Promise>; createEmployee: ( input: Parameters[1], ) => Promise; createPlatformEmployee: ( input: { username: string; display_name: string; email?: string | undefined; password: string; role_code?: "admin" | "developer"; }, ) => Promise; updateEmployee: ( userId: string, input: Parameters[2], ) => Promise; updatePlatformEmployee: ( userId: string, input: { display_name?: string; email?: string | null; role_code?: "admin" | "developer"; status?: "active" | "disabled" | "locked"; }, ) => Promise; deleteEmployee: ( userId: string, ) => Promise<{ user_id: string; deleted: boolean }>; deletePlatformEmployee: ( userId: string, ) => Promise<{ user_id: string; deleted: boolean }>; resetPlatformEmployeePassword: ( userId: string, newPassword: string, ) => Promise<{ user_id: string; password_reset: boolean }>; listPlatformRoles: () => Promise; getPlatformRole: (roleCode: string) => Promise; listPlatformPermissions: () => Promise; createPlatformRole: (input: RoleCreatePayload) => Promise; updatePlatformRole: ( roleCode: string, input: RoleUpdatePayload, ) => Promise; deletePlatformRole: ( roleCode: string, ) => Promise<{ role_code: string; deleted: boolean }>; updatePlatformRolePermissions: ( roleCode: string, permissionCodes: string[], ) => Promise; createScheduleNode: ( scheduleId: string, input: Parameters[2], ) => Promise; updateScheduleNode: ( scheduleId: string, nodeId: string, input: Parameters[3], ) => Promise; deleteScheduleNode: ( scheduleId: string, nodeId: string, workflowVersion: number, options?: { delete_execution_history?: boolean }, ) => Promise; createScheduleEdge: ( scheduleId: string, input: Parameters[2], ) => Promise; deleteScheduleEdge: ( scheduleId: string, edgeId: string, workflowVersion: number, ) => Promise; validateSchedule: ( scheduleId: string, ) => Promise; previewCron: ( input: Parameters[1], ) => Promise; runScheduleNow: (scheduleId: string) => Promise; listScheduleRuns: ( input?: Parameters[1], ) => Promise; getScheduleRun: (runId: string) => Promise; getScheduleNodeRunArtifacts: ( runId: string, nodeRunId: string, ) => Promise; // Workspace (Project) Management - 系统管理接口 listWorkspaces: ( input?: CursorListParams, ) => Promise>; createWorkspace: (input: WorkspaceCreatePayload) => Promise; updateWorkspace: ( workspaceId: string, input: WorkspaceUpdatePayload, ) => Promise; deleteWorkspace: (workspaceId: string) => Promise<{ workspace_id: string; deleted: boolean }>; listWorkspaceMembers: (workspaceId: string) => Promise; addWorkspaceMember: ( workspaceId: string, input: WorkspaceMemberAddPayload, ) => Promise; updateWorkspaceMember: ( workspaceId: string, userId: string, input: WorkspaceMemberUpdatePayload, ) => Promise; deleteWorkspaceMember: ( workspaceId: string, userId: string, ) => Promise<{ user_id: string; deleted: boolean }>; };