/** Encode to URL-safe base64, so a source can be used as a filename. */ export declare function encodeBase64Url(str: string): string; /** Decode URL-safe base64 (base64url). */ export declare function decodeBase64Url(base64url: string): string; /** * Drop the query string and fragment from an HTTP(S) source, so the same page * maps to one path. A non-URL source (`clipboard://...`) passes through. */ export declare function normalizeSource(source: string): string; /** Formats accepted by ingest_data at runtime and in its public schema. */ export declare const CONTENT_FORMATS: readonly ['text', 'html', 'markdown']; export type ContentFormat = (typeof CONTENT_FORMATS)[number]; /** Raw-data directory for a given LanceDB path. */ export declare function getRawDataDir(dbPath: string): string; /** `{dbPath}/raw-data/{base64url(normalizedSource)}.{ext}` */ export declare function generateRawDataPath(dbPath: string, source: string): string; /** Save content under raw-data, creating the directory if needed. */ export declare function saveRawData(dbPath: string, source: string, content: string): Promise; /** True only for managed raw-data content files under this database. */ export declare function isManagedRawDataPath(filePath: string, dbPath: string): boolean; /** * Lexical containment in `/raw-data/`. Safe for cleanup gates * (`unlink` does not follow symlinks). Use {@link isPathInRawDataDir} * when the result controls `readFile`. */ export declare function isPathInRawDataDirLexical(filePath: string, dbPath: string): boolean; /** * Lexical containment plus `realpath` so a symlink under raw-data * pointing outside cannot route a read through the raw-data fast-path. * Fail-closed on `realpath` errors. */ export declare function isPathInRawDataDir(filePath: string, dbPath: string): Promise; /** Original source of a raw-data path, or `null` when it is not one. */ export declare function extractSourceFromPath(filePath: string): string | null; /** * Metadata stored alongside each raw-data .md file as a .meta.json sidecar */ /** What {@link saveMetaJson} writes. */ export interface RawDataMeta { title: string | null; source: string; format: ContentFormat; } /** * What re-ingest reads back. Only `title` is consumed, so a sidecar missing * `source` or `format` still yields a usable title rather than failing an * otherwise valid ingest. */ export interface RawDataMetaRead { title: string | null; } /** Replaces the trailing `.md` with `.meta.json`. */ export declare function generateMetaJsonPath(mdPath: string): string; /** Save metadata as a JSON sidecar beside a raw-data .md file. */ export declare function saveMetaJson(mdPath: string, meta: RawDataMeta): Promise; /** `null` when the sidecar does not exist; any other read error is re-thrown. */ export declare function loadMetaJson(mdPath: string): Promise; /** * True when a filesystem error means the target path does not exist. */ export declare function isEnoent(error: unknown): boolean; /** * Pre-unlink existence of the on-disk raw-data artifacts for a target .md * path: the raw-data file itself and its .meta.json sidecar. */ export interface RawDataArtifactExistence { rawDataExisted: boolean; metaExisted: boolean; } /** * Report which raw-data artifacts exist. Single source for the delete * `existed` signal, so the MCP and CLI paths cannot drift. Call BEFORE * unlinking — it reports pre-unlink state. */ export declare function checkRawDataArtifacts(targetPath: string): Promise; //# sourceMappingURL=raw-data-utils.d.ts.map