|
15 | 15 | */
|
16 | 16 |
|
17 | 17 | import {Bucket} from '@google-cloud/storage';
|
18 |
| -import * as _rtdb from '@firebase/database'; |
19 | 18 | import * as _firestore from '@google-cloud/firestore';
|
20 | 19 |
|
21 | 20 | declare namespace admin {
|
@@ -175,6 +174,119 @@ declare namespace admin.credential {
|
175 | 174 | function refreshToken(refreshTokenPathOrObject: string|Object): admin.credential.Credential;
|
176 | 175 | }
|
177 | 176 |
|
| 177 | +declare namespace admin.database { |
| 178 | + interface Database { |
| 179 | + app: admin.app.App; |
| 180 | + |
| 181 | + goOffline(): void; |
| 182 | + goOnline(): void; |
| 183 | + ref(path?: string): admin.database.Reference; |
| 184 | + refFromURL(url: string): admin.database.Reference; |
| 185 | + } |
| 186 | + |
| 187 | + interface DataSnapshot { |
| 188 | + key: string|null; |
| 189 | + ref: admin.database.Reference; |
| 190 | + |
| 191 | + child(path: string): admin.database.DataSnapshot; |
| 192 | + exists(): boolean; |
| 193 | + exportVal(): any; |
| 194 | + forEach(action: (a: admin.database.DataSnapshot) => boolean): boolean; |
| 195 | + getPriority(): string|number|null; |
| 196 | + hasChild(path: string): boolean; |
| 197 | + hasChildren(): boolean; |
| 198 | + numChildren(): number; |
| 199 | + toJSON(): Object | null; |
| 200 | + val(): any; |
| 201 | + } |
| 202 | + |
| 203 | + interface OnDisconnect { |
| 204 | + cancel(onComplete?: (a: Error|null) => any): Promise<void>; |
| 205 | + remove(onComplete?: (a: Error|null) => any): Promise<void>; |
| 206 | + set(value: any, onComplete?: (a: Error|null) => any): Promise<void>; |
| 207 | + setWithPriority( |
| 208 | + value: any, |
| 209 | + priority: number|string|null, |
| 210 | + onComplete?: (a: Error|null) => any |
| 211 | + ): Promise<void>; |
| 212 | + update(values: Object, onComplete?: (a: Error|null) => any): Promise<void>; |
| 213 | + } |
| 214 | + |
| 215 | + type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed'; |
| 216 | + |
| 217 | + interface Query { |
| 218 | + ref: admin.database.Reference; |
| 219 | + |
| 220 | + endAt(value: number|string|boolean|null, key?: string): admin.database.Query; |
| 221 | + equalTo(value: number|string|boolean|null, key?: string): admin.database.Query; |
| 222 | + isEqual(other: admin.database.Query|null): boolean; |
| 223 | + limitToFirst(limit: number): admin.database.Query; |
| 224 | + limitToLast(limit: number): admin.database.Query; |
| 225 | + off( |
| 226 | + eventType?: admin.database.EventType, |
| 227 | + callback?: (a: admin.database.DataSnapshot, b?: string|null) => any, |
| 228 | + context?: Object|null |
| 229 | + ): void; |
| 230 | + on( |
| 231 | + eventType: admin.database.EventType, |
| 232 | + callback: (a: admin.database.DataSnapshot|null, b?: string) => any, |
| 233 | + cancelCallbackOrContext?: Object|null, |
| 234 | + context?: Object|null |
| 235 | + ): (a: admin.database.DataSnapshot|null, b?: string) => any; |
| 236 | + once( |
| 237 | + eventType: admin.database.EventType, |
| 238 | + successCallback?: (a: admin.database.DataSnapshot, b?: string) => any, |
| 239 | + failureCallbackOrContext?: Object|null, |
| 240 | + context?: Object|null |
| 241 | + ): Promise<any>; |
| 242 | + orderByChild(path: string): admin.database.Query; |
| 243 | + orderByKey(): admin.database.Query; |
| 244 | + orderByPriority(): admin.database.Query; |
| 245 | + orderByValue(): admin.database.Query; |
| 246 | + startAt(value: number|string|boolean|null, key?: string): admin.database.Query; |
| 247 | + toJSON(): Object; |
| 248 | + toString(): string; |
| 249 | + } |
| 250 | + |
| 251 | + interface Reference extends admin.database.Query { |
| 252 | + key: string|null; |
| 253 | + parent: admin.database.Reference|null; |
| 254 | + root: admin.database.Reference; |
| 255 | + path: string; |
| 256 | + |
| 257 | + child(path: string): admin.database.Reference; |
| 258 | + onDisconnect(): admin.database.OnDisconnect; |
| 259 | + push(value?: any, onComplete?: (a: Error|null) => any): admin.database.ThenableReference; |
| 260 | + remove(onComplete?: (a: Error|null) => any): Promise<void>; |
| 261 | + set(value: any, onComplete?: (a: Error|null) => any): Promise<void>; |
| 262 | + setPriority( |
| 263 | + priority: string|number|null, |
| 264 | + onComplete: (a: Error|null) => any |
| 265 | + ): Promise<void>; |
| 266 | + setWithPriority( |
| 267 | + newVal: any, newPriority: string|number|null, |
| 268 | + onComplete?: (a: Error|null) => any |
| 269 | + ): Promise<void>; |
| 270 | + transaction( |
| 271 | + transactionUpdate: (a: any) => any, |
| 272 | + onComplete?: (a: Error|null, b: boolean, c: admin.database.DataSnapshot|null) => any, |
| 273 | + applyLocally?: boolean |
| 274 | + ): Promise<{ |
| 275 | + committed: boolean, |
| 276 | + snapshot: admin.database.DataSnapshot|null |
| 277 | + }>; |
| 278 | + update(values: Object, onComplete?: (a: Error|null) => any): Promise<void>; |
| 279 | + } |
| 280 | + |
| 281 | + interface ThenableReference extends admin.database.Reference, PromiseLike<any> {} |
| 282 | + |
| 283 | + function enableLogging(logger?: boolean|((message: string) => any), persistent?: boolean): any; |
| 284 | +} |
| 285 | + |
| 286 | +declare namespace admin.database.ServerValue { |
| 287 | + var TIMESTAMP: number; |
| 288 | +} |
| 289 | + |
178 | 290 | declare namespace admin.messaging {
|
179 | 291 | type DataMessagePayload = {
|
180 | 292 | [key: string]: string;
|
@@ -295,18 +407,6 @@ declare namespace admin.storage {
|
295 | 407 | }
|
296 | 408 | }
|
297 | 409 |
|
298 |
| -declare namespace admin.database { |
299 |
| - export import Database = _rtdb.Database; |
300 |
| - export import Reference = _rtdb.Reference; |
301 |
| - export import Query = _rtdb.Query; |
302 |
| - export import ServerValue = _rtdb.ServerValue; |
303 |
| - export import enableLogging = _rtdb.enableLogging; |
304 |
| - export import OnDisconnect = _rtdb.OnDisconnect; |
305 |
| - export import DataSnapshot = _rtdb.DataSnapshot; |
306 |
| - |
307 |
| - type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed'; |
308 |
| -} |
309 |
| - |
310 | 410 | declare namespace admin.firestore {
|
311 | 411 | export import FieldPath = _firestore.FieldPath;
|
312 | 412 | export import FieldValue = _firestore.FieldValue;
|
|
0 commit comments