import { Observable } from 'rxjs'; import { DocumentSnapshot, IDatabaseProvider, QueryConstraint } from '@progressive-development/pd-provider-interfaces'; /** * The configured database provider, or a clear error instead of `undefined`. * * `services.database` is optional — an app that never touches a database does * not configure one. Every consumer would otherwise repeat the same guard; * this is that guard, once. (Seen copied into seven service classes of one * app before it moved here.) * * @throws if no database provider is configured */ export declare function pdDatabase(): IDatabaseProvider; /** Options of {@link observeCollection}. */ export interface ObserveCollectionOptions { /** Query constraints (filters), same shape as the provider's. */ constraints?: QueryConstraint[]; } /** * A collection listener as an Observable. * * The provider interface is callback based on purpose — it must stay usable * without rxjs. Inside an app built on this framework rxjs *is* the currency * (store, effects), so the translation belongs here: one place instead of one * per app. * * Three things come for free with it: * * - **The first snapshot arrives on subscription** — no separate initial read, * which would be a second source of truth for the same data. * - **Failures reach the consumer** with their cause (missing permissions, * missing index, lost connection) instead of being logged and swallowed. * - **Unsubscribing closes the listener**, so an effect that completes cannot * leak a channel. * * @example * ```typescript * observeCollection("openGames", { * constraints: [{ type: "where", field: "roomId", operator: "==", value: roomId }], * }).pipe(map((docs) => docs.map(toGame))); * ``` */ export declare function observeCollection(collectionPath: string, options?: ObserveCollectionOptions): Observable[]>; //# sourceMappingURL=database-access.d.ts.map