UNPKG

2.73 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2017 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
18import * as types from '@firebase/database-types';
19import { Database } from './src/api/Database';
20import * as INTERNAL from './src/api/internal';
21import { DataSnapshot, Query, Reference } from './src/api/Reference';
22import * as TEST_ACCESS from './src/api/test_access';
23import { enableLogging } from './src/exp/Database';
24declare const ServerValue: {
25 TIMESTAMP: object;
26 increment: (delta: number) => object;
27};
28/**
29 * A one off register function which returns a database based on the app and
30 * passed database URL. (Used by the Admin SDK)
31 *
32 * @param app - A valid FirebaseApp-like object
33 * @param url - A valid Firebase databaseURL
34 * @param version - custom version e.g. firebase-admin version
35 * @param nodeAdmin - true if the SDK is being initialized from Firebase Admin.
36 */
37export declare function initStandalone(app: FirebaseApp, url: string, version: string, nodeAdmin?: boolean): {
38 instance: types.Database;
39 namespace: {
40 Reference: typeof Reference;
41 Query: typeof Query;
42 Database: typeof Database;
43 DataSnapshot: typeof DataSnapshot;
44 enableLogging: typeof enableLogging;
45 INTERNAL: typeof INTERNAL;
46 ServerValue: {
47 TIMESTAMP: object;
48 increment: (delta: number) => object;
49 };
50 TEST_ACCESS: typeof TEST_ACCESS;
51 };
52};
53export declare function registerDatabase(instance: FirebaseNamespace): void;
54export { Database, Query, Reference, enableLogging, ServerValue };
55export { OnDisconnect } from './src/api/onDisconnect';
56declare module '@firebase/app-types' {
57 interface FirebaseNamespace {
58 database?: {
59 (app?: FirebaseApp): types.FirebaseDatabase;
60 enableLogging: typeof types.enableLogging;
61 ServerValue: types.ServerValue;
62 Database: typeof types.FirebaseDatabase;
63 };
64 }
65 interface FirebaseApp {
66 database?(): types.FirebaseDatabase;
67 }
68}
69export { DataSnapshot } from './src/api/Reference';