/** * Represents the type of a segment in a path. * - `'literal'`: a static path part (e.g., "users") * - `'param'`: a dynamic path parameter (e.g., "{userId}") */ export type PathPartType = 'literal' | 'param'; export type PathType = 'root' | 'collection' | 'document'; export interface PathDataProvider { /** * Returns a `PathData` instance */ pathData(path: string, ...guards: PathType[]): PathData | undefined; } /** * An immutable instance containing both the fully qualified path and an immutable * array of path items */ export interface PathData extends PathDataProvider { /** * The path type, one of `'root' | 'collection' | 'document'`. */ readonly type: PathType; /** * The fully qualified path to the parent of the node represente by this instance. */ readonly parentPath: string; /** * The id of the resource associated with the path (the name for collection paths). * An empty string if the path is empty. */ readonly id: string; /** * The full qualified path represented by this instance. */ readonly path: string; /** * An immutable array of strings containing the individual segments of the path represented * by this instance. */ readonly segments: readonly string[]; /** * An immutable instance containing both the fully qualified path and an immutable * array of path items. */ parent(): PathData; } export declare class PathDataCache implements PathDataProvider { private _data; pathData(path: string, ...guards: PathType[]): PathData | undefined; assert(path: string, ...guards: PathType[]): PathData; flush(): void; } /** * Represents a segment of a parsed path, either static or dynamic. * This is an abstract base class and should not be instantiated directly. */ export declare abstract class PathPart { /** * The type of the path part: either `'literal'` or `'param'`. */ abstract readonly type: PathPartType; /** * The original string value of the path part. */ readonly value: string; /** * Constructs a path part with the given value. * @param value The raw string value of the path part. */ constructor(value: string); } /** * Represents a static (literal) segment in a document path. * For example, in `users/{userId}`, the segment `users` is literal. */ export declare class LiteralPathPart extends PathPart { /** The type of the path part — always `'literal'`. */ readonly type: PathPartType; } /** * Represents a dynamic (parameterized) segment in a document path. * For example, in `users/{userId}`, the segment `{userId}` is a parameter. */ export declare class ParamPathPart extends PathPart { /** The type of the path part — always `'param'`. */ readonly type: PathPartType; /** * The name of the parameter (e.g., `"userId"` in `{userId}`). */ readonly name: string; /** * Constructs a parameter path part with the given name and value. * @param name The name of the path parameter. * @param value The raw value matched in the actual path. */ constructor(name: string, value: string); } export declare function parseRawPath(path: string): string[]; export declare function joinPathParts(path: string[]): string; export declare function pathType(pathParts: string[] | readonly string[] | string): PathType; /** * Matches a Firestore-style path pattern against an actual path. * * @param pattern A Firestore-style pattern (e.g. 'users/{userId}/posts/{postId}') * @param path An actual document path (e.g. 'users/abc/posts/123') * @returns An array of `LiteralPathPart` and `ParamPathPart` if the path matches the pattern; * otherwise `undefined` */ export declare function matchFirestorePath(pattern: string, path: string): (LiteralPathPart | ParamPathPart)[] | undefined; //# sourceMappingURL=path.d.ts.map