/** Options accepted by the segment validators. */ export type ValidateSegmentOptions = { /** * Permit the documented `__id[0-9]+__` Datastore-import document-name form (document segments only; * collection segments always reject the reserved namespace). Off by default. */ allowLegacyDatastoreIds?: boolean; }; /** * Validates that `value` is a single, legal Firestore path segment (used for both document ids and * collection segments — they share the same character rules). Returns the value on success; throws * {@link InvalidDocumentIdError} with a stable `reason` otherwise. * * @param value - The candidate segment (usually caller-supplied / untrusted) * @param label - What is being validated, for the error message (e.g. `document id`, `subcollection name`) */ export declare function validatePathSegment(value: unknown, label: string, opts?: ValidateSegmentOptions): string; /** Validates a caller-supplied document id. Alias of {@link validatePathSegment} for readability. */ export declare function validateDocumentId(value: unknown, label?: string, opts?: ValidateSegmentOptions): string; /** * Validates a subcollection / collection name (one collection segment). Collection segments always * reject the reserved namespace — the `allowLegacyDatastoreIds` exception is document-id-only. */ export declare function validateCollectionSegment(value: unknown, label?: string): string; /** * Validates a full collection path (`col`, `col/doc/col`, …): an ODD number of non-empty segments, * each a legal path segment. Used at repository construction so an illegal base path fails fast. The * `allowLegacyDatastoreIds` exception applies only to the document segments (odd indices). */ export declare function validateCollectionPath(path: string, opts?: ValidateSegmentOptions): string; /** * Validates a full **document** path (`col/doc`, `col/doc/col/doc`, …): an EVEN number of non-empty * segments, each a legal path segment. The mirror of {@link validateCollectionPath}. * * Used by collection-group document-name filters: in a collection-group query, * `FieldPath.documentId()` compares against a document's FULL resource path, not its leaf id, so the * operand is a path rather than a single segment (verified — the Admin SDK rejects a bare id there * with "must result in a valid document path … odd number of segments"). The per-segment checks are * the same server-side boundary {@link validateDocumentId} provides for leaf ids: a `..` or reserved * `__…__` segment inside the path otherwise reaches Firestore and fails there as `INVALID_ARGUMENT`. * * Stricter than the SDK on purpose: the SDK silently tolerates a leading/trailing `/` (`"/a/b/"` * normalizes to `a/b`), which this rejects as an empty segment so an ambiguous operand never * reaches the wire. The `allowLegacyDatastoreIds` exception applies only to the document segments * (odd indices). */ export declare function validateDocumentPath(path: unknown, label?: string, opts?: ValidateSegmentOptions): string;