@@ -8,7 +8,20 @@ import { EmulatorMockTokenOptions } from '@firebase/util';
88import { FirebaseApp } from ' @firebase/app' ;
99
1010// @public
11- export function child(parent : Reference , path : string ): Reference ;
11+ export function child(parent : DatabaseReference , path : string ): DatabaseReference ;
12+
13+ // @public
14+ export class Database {
15+ readonly app: FirebaseApp ;
16+ readonly ' type' = " database" ;
17+ }
18+
19+ // @public
20+ export interface DatabaseReference extends Query {
21+ readonly key: string | null ;
22+ readonly parent: DatabaseReference | null ;
23+ readonly root: DatabaseReference ;
24+ }
1225
1326// @public
1427export function connectDatabaseEmulator(db : FirebaseDatabase , host : string , port : number , options ? : {
@@ -25,7 +38,7 @@ export class DataSnapshot {
2538 hasChildren(): boolean ;
2639 get key(): string | null ;
2740 get priority(): string | number | null ;
28- readonly ref: Reference ;
41+ readonly ref: DatabaseReference ;
2942 get size(): number ;
3043 toJSON(): object | null ;
3144 val(): any ;
@@ -49,23 +62,17 @@ export function equalTo(value: number | string | boolean | null, key?: string):
4962// @public
5063export type EventType = ' value' | ' child_added' | ' child_changed' | ' child_moved' | ' child_removed' ;
5164
52- // @public
53- export class FirebaseDatabase {
54- readonly app: FirebaseApp ;
55- readonly ' type' = " database" ;
56- }
57-
5865// @public
5966export function get(query : Query ): Promise <DataSnapshot >;
6067
6168// @public
62- export function getDatabase(app ? : FirebaseApp , url ? : string ): FirebaseDatabase ;
69+ export function getDatabase(app ? : FirebaseApp , url ? : string ): Database ;
6370
6471// @public
65- export function goOffline(db : FirebaseDatabase ): void ;
72+ export function goOffline(db : Database ): void ;
6673
6774// @public
68- export function goOnline(db : FirebaseDatabase ): void ;
75+ export function goOnline(db : Database ): void ;
6976
7077// @public
7178export function increment(delta : number ): object ;
@@ -130,7 +137,7 @@ export class OnDisconnect {
130137}
131138
132139// @public
133- export function onDisconnect(ref : Reference ): OnDisconnect ;
140+ export function onDisconnect(ref : DatabaseReference ): OnDisconnect ;
134141
135142// @public
136143export function onValue(query : Query , callback : (snapshot : DataSnapshot ) => unknown , cancelCallback ? : (error : Error ) => unknown ): Unsubscribe ;
@@ -154,12 +161,12 @@ export function orderByPriority(): QueryConstraint;
154161export function orderByValue(): QueryConstraint ;
155162
156163// @public
157- export function push(parent : Reference , value ? : unknown ): ThenableReference ;
164+ export function push(parent : DatabaseReference , value ? : unknown ): ThenableReference ;
158165
159166// @public
160167export interface Query {
161168 isEqual(other : Query | null ): boolean ;
162- readonly ref: Reference ;
169+ readonly ref: DatabaseReference ;
163170 toJSON(): string ;
164171 toString(): string ;
165172}
@@ -176,35 +183,28 @@ export abstract class QueryConstraint {
176183export type QueryConstraintType = ' endAt' | ' endBefore' | ' startAt' | ' startAfter' | ' limitToFirst' | ' limitToLast' | ' orderByChild' | ' orderByKey' | ' orderByPriority' | ' orderByValue' | ' equalTo' ;
177184
178185// @public
179- export function ref(db : FirebaseDatabase , path ? : string ): Reference ;
180-
181- // @public
182- export interface Reference extends Query {
183- readonly key: string | null ;
184- readonly parent: Reference | null ;
185- readonly root: Reference ;
186- }
186+ export function ref(db : Database , path ? : string ): DatabaseReference ;
187187
188188// @public
189- export function refFromURL(db : FirebaseDatabase , url : string ): Reference ;
189+ export function refFromURL(db : Database , url : string ): DatabaseReference ;
190190
191191// @public
192- export function remove(ref : Reference ): Promise <void >;
192+ export function remove(ref : DatabaseReference ): Promise <void >;
193193
194194// @public
195- export function runTransaction(ref : Reference , transactionUpdate : (currentData : any ) => unknown , options ? : TransactionOptions ): Promise <TransactionResult >;
195+ export function runTransaction(ref : DatabaseReference , transactionUpdate : (currentData : any ) => unknown , options ? : TransactionOptions ): Promise <TransactionResult >;
196196
197197// @public
198198export function serverTimestamp(): object ;
199199
200200// @public
201- export function set(ref : Reference , value : unknown ): Promise <void >;
201+ export function set(ref : DatabaseReference , value : unknown ): Promise <void >;
202202
203203// @public
204- export function setPriority(ref : Reference , priority : string | number | null ): Promise <void >;
204+ export function setPriority(ref : DatabaseReference , priority : string | number | null ): Promise <void >;
205205
206206// @public
207- export function setWithPriority(ref : Reference , value : unknown , priority : string | number | null ): Promise <void >;
207+ export function setWithPriority(ref : DatabaseReference , value : unknown , priority : string | number | null ): Promise <void >;
208208
209209// @public
210210export function startAfter(value : number | string | boolean | null , key ? : string ): QueryConstraint ;
@@ -213,7 +213,7 @@ export function startAfter(value: number | string | boolean | null, key?: string
213213export function startAt(value ? : number | string | boolean | null , key ? : string ): QueryConstraint ;
214214
215215// @public
216- export interface ThenableReference extends Reference , Pick <Promise <Reference >, ' then' | ' catch' > {
216+ export interface ThenableReference extends DatabaseReference , Pick <Promise <DatabaseReference >, ' then' | ' catch' > {
217217}
218218
219219// @public
@@ -232,7 +232,7 @@ export class TransactionResult {
232232export type Unsubscribe = () => void ;
233233
234234// @public
235- export function update(ref : Reference , values : object ): Promise <void >;
235+ export function update(ref : DatabaseReference , values : object ): Promise <void >;
236236
237237
238238```
0 commit comments