UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

89 lines • 3.74 kB
import type { WriteCondition } from '../../cache/types.ts'; import type { StaleWriteError } from '../../errors/types.ts'; import type { PathSpec } from '../../types.ts'; import type { DropboxTokenManager } from './client.ts'; export interface DropboxEntry { '.tag': 'file' | 'folder' | 'deleted'; id?: string; name: string; path_lower?: string; path_display?: string; size?: number; client_modified?: string; server_modified?: string; rev?: string; content_hash?: string; } /** * List a folder's entries, following every continuation cursor. * * `/` and `''` both mean the account root. */ export declare function listFolder(tm: DropboxTokenManager, path: string, opts?: { recursive?: boolean; /** Entries per request. */ pageSize?: number; /** * Stop once this many entries are in hand and do not request another * page. An emptiness probe wants one entry, and `pageSize` alone * cannot express that: it caps the page, not the walk, so a small * page turned a listing of a large folder into many requests instead * of fewer. */ limit?: number | null; }): Promise<DropboxEntry[]>; /** * A cursor at the folder's present state, without listing it. * * `/` and `''` both mean the account root. Mirrors Python `latest_cursor`. */ export declare function latestCursor(tm: DropboxTokenManager, path: string, opts?: { recursive?: boolean; }): Promise<string>; /** * Replay changes since `cursor`, following every continuation page. */ export declare function continueFolder(tm: DropboxTokenManager, cursor: string): Promise<{ entries: DropboxEntry[]; cursor: string; }>; export declare function getMetadata(tm: DropboxTokenManager, path: string): Promise<DropboxEntry>; export declare function createFolder(tm: DropboxTokenManager, path: string): Promise<void>; export declare function deletePath(tm: DropboxTokenManager, path: string, parentRev?: string | null): Promise<void>; /** * An entry's metadata, null when Dropbox has nothing at the path. Only a * not_found or not_folder 409 is a miss; any other refusal (restricted_content, * a relay's 5xx naming not_found) names a path that may exist, and throws. * Mirrors Python's `lookup`. */ export declare function lookup(tm: DropboxTokenManager, path: string): Promise<DropboxEntry | null>; /** * The refusal a write sent with a rev met, null for any other failure or a * write that went plain. Mirrors Python's `refused`. */ export declare function refused(path: PathSpec, err: unknown, cond: WriteCondition | null, rev: string | null): Promise<StaleWriteError | null>; /** * Move one entry with `/files/move_v2`. Answers the moved entry's metadata * (`.tag` names its kind), or an empty object when the reply carries none. */ export declare function movePath(tm: DropboxTokenManager, from: string, to: string): Promise<Partial<DropboxEntry>>; export declare function copyPath(tm: DropboxTokenManager, from: string, to: string): Promise<void>; export declare const SEARCH_PAGE = 1000; export declare const MAX_SEARCH_MATCHES = 10000; /** * Collect `[path_lower, path_display]` file matches for a search query. * * Pages through `/files/search_v2` and `/files/search/continue_v2`, * deduplicating across pages (the API may repeat results between pages). * `path: ''` searches the whole account. `truncated` reports whether the * result hit the API's 10,000-match ceiling (a truncated set is not a * trustworthy superset). */ export declare function searchFiles(tm: DropboxTokenManager, query: string, opts?: { path?: string; filenameOnly?: boolean; }): Promise<{ paths: [string, string][]; truncated: boolean; }>; //# sourceMappingURL=api.d.ts.map