Path: blob/master/src/packages/conat/project/api/system.ts
1453 views
import type {1ExecuteCodeOutput,2ExecuteCodeOptions,3} from "@cocalc/util/types/execute-code";4import type { DirectoryListingEntry } from "@cocalc/util/types";5import type {6Configuration,7ConfigurationAspect,8} from "@cocalc/comm/project-configuration";9import { type ProjectJupyterApiOptions } from "@cocalc/util/jupyter/api-types";1011export const system = {12terminate: true,1314version: true,1516listing: true,17deleteFiles: true,18moveFiles: true,19renameFile: true,20realpath: true,21canonicalPaths: true,2223// these should be deprecated -- the new streaming writeFile and readFile in conat/files are better.24writeTextFileToProject: true,25readTextFileFromProject: true,2627configuration: true,2829ping: true,30exec: true,3132signal: true,3334// jupyter stateless API35jupyterExecute: true,36};3738export interface System {39// stop the api service40terminate: () => Promise<void>;4142version: () => Promise<number>;4344listing: (opts: {45path: string;46hidden?: boolean;47}) => Promise<DirectoryListingEntry[]>;48deleteFiles: (opts: { paths: string[] }) => Promise<void>;49moveFiles: (opts: { paths: string[]; dest: string }) => Promise<void>;50renameFile: (opts: { src: string; dest: string }) => Promise<void>;51realpath: (path: string) => Promise<string>;52canonicalPaths: (paths: string[]) => Promise<string[]>;5354writeTextFileToProject: (opts: {55path: string;56content: string;57}) => Promise<void>;58readTextFileFromProject: (opts: { path: string }) => Promise<string>;5960configuration: (61aspect: ConfigurationAspect,62no_cache?,63) => Promise<Configuration>;6465ping: () => Promise<{ now: number }>;6667exec: (opts: ExecuteCodeOptions) => Promise<ExecuteCodeOutput>;6869signal: (opts: {70signal: number;71pids?: number[];72pid?: number;73}) => Promise<void>;7475jupyterExecute: (opts: ProjectJupyterApiOptions) => Promise<object[]>;76}777879