import { PathSpec } from '../types.ts'; /** Normalize a key prefix: empty/undefined → '', strip leading /, ensure trailing /. */ export declare function normalize(raw: string | undefined): string; /** Prepend a normalized prefix to a virtual path. */ export declare function apply(prefix: string, path: string): string; /** Same as apply() but guarantees a trailing slash for LIST-style ops. */ export declare function applyDir(prefix: string, path: string): string; /** Strip a normalized prefix from a backend-returned key. */ export declare function strip(prefix: string, key: string): string; /** * Remove a mount prefix from a virtual path at a path boundary. * * A sibling that only shares the prefix as a string (`/database` vs a * `/data` prefix) is left untouched. * * Example: * stripMount('/data/sub/x.txt', '/data') -> '/sub/x.txt' * stripMount('/database/x.txt', '/data') -> '/database/x.txt' * stripMount('/data', '/data') -> '/' * stripMount('/x.txt', '') -> '/x.txt' */ export declare function stripMount(virtual: string, prefix: string): string; /** * Whether `candidate` is `root` itself or sits below it. * * A boundary-aware prefix test, so a sibling that merely shares the string * (`/data/xy` against `/data/x`) is not counted. Both sides are compared * without a trailing slash, because a backend may have keyed a directory * either way. Mirrors Python `under_path` (`utils/key_prefix.py`). * * Example: * underPath('/data/x/y', '/data/x') -> true * underPath('/data/x', '/data/x/') -> true * underPath('/data/xy', '/data/x') -> false */ export declare function underPath(candidate: string, root: string): boolean; /** * Backend key for a virtual path under a mount prefix. * * Example: * mountKey('/data/sub/x.txt', '/data') -> 'sub/x.txt' * mountKey('/data', '/data') -> '' * mountKey('/x.txt', '') -> 'x.txt' */ export declare function mountKey(virtual: string, prefix: string): string; /** * Backend key for a child virtual path, derived from its parent. * * A child shares the parent's mount prefix, so its key is the child * virtual path with the same prefix removed. The prefix length is * recovered from the parent's `virtual`/`resourcePath` pair, so no mount * context is needed. * * Example: * rekey('/data/sub', 'sub', '/data/sub/x.txt') -> 'sub/x.txt' * rekey('/data', '', '/data/x.txt') -> 'x.txt' */ export declare function rekey(parentVirtual: string, parentResourcePath: string, child: string): string; /** * Recover a mount prefix from a virtual path and its backend key. * * The inverse of stamping: given a path's virtual form and the key the * mount stamped, return the mount prefix that was stripped off. * * Example: * mountPrefixOf('/data/sub', 'sub') -> '/data' * mountPrefixOf('/data', '') -> '/data' * mountPrefixOf('/x.txt', 'x.txt') -> '' */ export declare function mountPrefixOf(virtual: string, resourcePath: string): string; export declare function mountedPath(root: PathSpec, mountPath: string): PathSpec; //# sourceMappingURL=key_prefix.d.ts.map