import type { Status } from './types'; /** * String error codes mirroring the Firebase Web SDK's `FirestoreErrorCode`. * The 16 canonical status codes, kebab-cased. * * Reference: {@link https://firebase.google.com/docs/reference/js/firestore_.firestoreerror#firestoreerrorcode} */ export type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated'; /** * Maps a canonical Firestore status string (e.g. `'NOT_FOUND'`) to the * kebab-cased error code. Unrecognized values fall back to `'unknown'`. */ export declare const status_to_code: (status: string) => FirestoreErrorCode; /** * Error thrown by every `fireworkers` operation when Firestore rejects a * request or the network request fails. Shape mirrors the Firebase Web SDK's * `FirestoreError` so callers can branch on `err.code`. */ export declare class FirestoreError extends Error { readonly code: FirestoreErrorCode; readonly httpCode?: number; readonly status?: string; constructor({ code, message, httpCode, status, }: { code: FirestoreErrorCode; message: string; httpCode?: number; status?: string; }); } /** * Inspects a parsed REST response body and throws a `FirestoreError` if it * contains an `error` object. Otherwise narrows `data` to the success shape. */ export declare function throw_if_error(data: T | { error: Status; }): asserts data is T; /** * `fetch` wrapper that converts network-level rejections (e.g. DNS failure, * connection reset) into a `FirestoreError` with code `'unavailable'` so * consumers have a single error type to catch. */ export declare const safe_fetch: (input: URL | RequestInfo, init?: RequestInit) => Promise;