import { type rest } from "@codesandbox/api"; import type { Id } from "@codesandbox/pitcher-common"; import { Disposable, SerialQueue } from "@codesandbox/pitcher-common"; import type { PitcherRequest, fs as fsProtocol } from "@codesandbox/pitcher-protocol"; import { MemoryFS } from "../../common/MemoryFS"; import type { IFSClient, PickRawFsResult, FSSyncEvent, FSErrorEvent } from "../../interface/clients"; import type { AbsoluteWorkspacePath, RelativeWorkspacePath } from "../../types"; import type { FilesState } from "./FilesState"; import type { getApiUtils } from "./api-utils"; import type { BrowserLanguageClient } from "./language/LanguageClient"; export declare class BrowserFSClient extends Disposable implements IFSClient { private filesState; private apiUtils; private seamlessFork; private getLangClient; memoryFS: MemoryFS; operationQueue: SerialQueue; workspacePath: string; private onFSErrorEmitter; onFSError: import("@codesandbox/pitcher-common").Event; private onFSSyncEmitter; onFSSync: import("@codesandbox/pitcher-common").Event; private onPendingOperationsChangeEmitter; onPendingOperationsChange: import("@codesandbox/pitcher-common").Event; readyPromise: Promise; private directoryIdToShortId; private clock; private seamlessForkBarrier; private activeWatchers; constructor(filesState: FilesState, initialSandboxFs: { modules: rest.Sandbox["modules"]; directories: rest.Sandbox["directories"]; }, apiUtils: ReturnType, seamlessFork: (request: PitcherRequest["method"]) => boolean, getLangClient: () => BrowserLanguageClient | null); private getPendingOperations; private getDirShortId; private createModule; private applyInternalOperation; private mapOperationToPitcherRequestMethod; private applyFSOperation; private createNewDirectory; private createParentDirs; /** * When you have a path you know is relative, but you want to to ensure the correct format with * prefixed "/" and type safety */ asRelativeWorkspacePath(path: string): `$RELATIVE/${string}`; /** * When you know you have an absolute path, but want to ensure it to be this users workspace and have type safety */ asAbsoluteWorkspacePath(path: string): `$ABSOLUTE/${string}`; /** * When you have a type safe absolute path and want to make it relative */ absoluteToRelativeWorkspacePath(path: AbsoluteWorkspacePath): `$RELATIVE/${string}`; /** * When you have a tpe safe relative path and want to make it absolute to this users workspace path */ relativeToAbsoluteWorkspacePath(path: RelativeWorkspacePath): `$ABSOLUTE/${string}`; resolveRelativeWorkspacePath(path: string): `$RELATIVE/${string}`; resolveAbsoluteWorkspacePath(path: string): `$ABSOLUTE/${string}`; resync(): Promise; createFile(name: string, parentId: Id): Promise<{ id: Id; filepath: string; }>; isFile(id: Id): boolean; /** * Create a directory with the provided name within the directory of the * given parent id. * */ createDirectory(name: string, parentId: Id): Id; /** * delete a node from the FS * */ deleteNode(id: Id): void; /** * rename a node from the FS * */ move(id: Id, opts: { newName?: string; newParentId?: Id; }): void; search({ text: query, glob, caseSensitivity, }: fsProtocol.FSSearchParams): Promise; streamingSearch(_params: fsProtocol.FSSearchParams, _onMatches: (matches: fsProtocol.StreamingSearchResult[]) => void, _abort: Disposable): Promise<{ hitLimit: boolean; }>; pathSearch(_params: fsProtocol.PathSearchParams): Promise; uploadFile(name: string, content: Uint8Array, parentId: Id): Promise<{ id: Id; filepath: RelativeWorkspacePath; }>; download(path?: string): Promise<{ downloadUrl: string; }>; getPathFromId: (id: Id) => `$RELATIVE/${string}` | undefined; getIdFromPath: (path: string) => Id | undefined; readFileSync(path: string): Uint8Array; readFile(path: string): Promise>; readdir(path: string): Promise>; writeFile(path: string, content: Uint8Array, create?: boolean, _overwrite?: boolean): Promise>; stat(path: string): Promise>; copy(from: string, to: string, recursive?: boolean, overwrite?: boolean): Promise>; rename(from: string, to: string, overwrite?: boolean): Promise>; remove(path: string, recursive?: boolean): Promise>; mkdir(path: string, recursive?: boolean): Promise>; private watchQueue; private queueWatchEvent; private emitWatchEvents; watch(path: string, options: { readonly recursive?: boolean; readonly excludes?: readonly string[]; }, onEvent: (watchEvent: fsProtocol.FSWatchEvent) => void): Promise<(PickRawFsResult<"fs/watch"> & { type: "error"; }) | { type: "success"; dispose(): void; }>; openSeamlessBranchBarrier(): void; } //# sourceMappingURL=FSClient.d.ts.map