UNPKG

7.05 kBTypeScriptView Raw
1/*! firebase-admin v12.0.0 */
2/*!
3 * @license
4 * Copyright 2017 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18import { AppStore } from './lifecycle';
19import { app, appCheck, auth, messaging, machineLearning, storage, firestore, database, instanceId, installations, projectManagement, securityRules, remoteConfig, AppOptions } from '../firebase-namespace-api';
20import { cert, refreshToken, applicationDefault } from './credential-factory';
21import App = app.App;
22import AppCheck = appCheck.AppCheck;
23import Auth = auth.Auth;
24import Database = database.Database;
25import Firestore = firestore.Firestore;
26import Installations = installations.Installations;
27import InstanceId = instanceId.InstanceId;
28import MachineLearning = machineLearning.MachineLearning;
29import Messaging = messaging.Messaging;
30import ProjectManagement = projectManagement.ProjectManagement;
31import RemoteConfig = remoteConfig.RemoteConfig;
32import SecurityRules = securityRules.SecurityRules;
33import Storage = storage.Storage;
34export interface FirebaseServiceNamespace<T> {
35 (app?: App): T;
36 [key: string]: any;
37}
38/**
39 * Internals of a FirebaseNamespace instance.
40 */
41export declare class FirebaseNamespaceInternals {
42 private readonly appStore;
43 constructor(appStore: AppStore);
44 /**
45 * Initializes the App instance.
46 *
47 * @param options - Optional options for the App instance. If none present will try to initialize
48 * from the FIREBASE_CONFIG environment variable. If the environment variable contains a string
49 * that starts with '{' it will be parsed as JSON, otherwise it will be assumed to be pointing
50 * to a file.
51 * @param appName - Optional name of the FirebaseApp instance.
52 *
53 * @returns A new App instance.
54 */
55 initializeApp(options?: AppOptions, appName?: string): App;
56 /**
57 * Returns the App instance with the provided name (or the default App instance
58 * if no name is provided).
59 *
60 * @param appName - Optional name of the FirebaseApp instance to return.
61 * @returns The App instance which has the provided name.
62 */
63 app(appName?: string): App;
64 get apps(): App[];
65}
66/**
67 * Global Firebase context object.
68 */
69export declare class FirebaseNamespace {
70 __esModule: boolean;
71 credential: {
72 cert: typeof cert;
73 refreshToken: typeof refreshToken;
74 applicationDefault: typeof applicationDefault;
75 };
76 SDK_VERSION: string;
77 INTERNAL: FirebaseNamespaceInternals;
78 Promise: any;
79 constructor(appStore?: AppStore);
80 /**
81 * Gets the `Auth` service namespace. The returned namespace can be used to get the
82 * `Auth` service for the default app or an explicitly specified app.
83 */
84 get auth(): FirebaseServiceNamespace<Auth>;
85 /**
86 * Gets the `Database` service namespace. The returned namespace can be used to get the
87 * `Database` service for the default app or an explicitly specified app.
88 */
89 get database(): FirebaseServiceNamespace<Database>;
90 /**
91 * Gets the `Messaging` service namespace. The returned namespace can be used to get the
92 * `Messaging` service for the default app or an explicitly specified app.
93 */
94 get messaging(): FirebaseServiceNamespace<Messaging>;
95 /**
96 * Gets the `Storage` service namespace. The returned namespace can be used to get the
97 * `Storage` service for the default app or an explicitly specified app.
98 */
99 get storage(): FirebaseServiceNamespace<Storage>;
100 /**
101 * Gets the `Firestore` service namespace. The returned namespace can be used to get the
102 * `Firestore` service for the default app or an explicitly specified app.
103 */
104 get firestore(): FirebaseServiceNamespace<Firestore>;
105 /**
106 * Gets the `MachineLearning` service namespace. The returned namespace can be
107 * used to get the `MachineLearning` service for the default app or an
108 * explicityly specified app.
109 */
110 get machineLearning(): FirebaseServiceNamespace<MachineLearning>;
111 /**
112 * Gets the `Installations` service namespace. The returned namespace can be used to get the
113 * `Installations` service for the default app or an explicitly specified app.
114 */
115 get installations(): FirebaseServiceNamespace<Installations>;
116 /**
117 * Gets the `InstanceId` service namespace. The returned namespace can be used to get the
118 * `Instance` service for the default app or an explicitly specified app.
119 */
120 get instanceId(): FirebaseServiceNamespace<InstanceId>;
121 /**
122 * Gets the `ProjectManagement` service namespace. The returned namespace can be used to get the
123 * `ProjectManagement` service for the default app or an explicitly specified app.
124 */
125 get projectManagement(): FirebaseServiceNamespace<ProjectManagement>;
126 /**
127 * Gets the `SecurityRules` service namespace. The returned namespace can be used to get the
128 * `SecurityRules` service for the default app or an explicitly specified app.
129 */
130 get securityRules(): FirebaseServiceNamespace<SecurityRules>;
131 /**
132 * Gets the `RemoteConfig` service namespace. The returned namespace can be used to get the
133 * `RemoteConfig` service for the default app or an explicitly specified app.
134 */
135 get remoteConfig(): FirebaseServiceNamespace<RemoteConfig>;
136 /**
137 * Gets the `AppCheck` service namespace. The returned namespace can be used to get the
138 * `AppCheck` service for the default app or an explicitly specified app.
139 */
140 get appCheck(): FirebaseServiceNamespace<AppCheck>;
141 /**
142 * Initializes the FirebaseApp instance.
143 *
144 * @param options - Optional options for the FirebaseApp instance.
145 * If none present will try to initialize from the FIREBASE_CONFIG environment variable.
146 * If the environment variable contains a string that starts with '{' it will be parsed as JSON,
147 * otherwise it will be assumed to be pointing to a file.
148 * @param appName - Optional name of the FirebaseApp instance.
149 *
150 * @returns A new FirebaseApp instance.
151 */
152 initializeApp(options?: AppOptions, appName?: string): App;
153 /**
154 * Returns the FirebaseApp instance with the provided name (or the default FirebaseApp instance
155 * if no name is provided).
156 *
157 * @param appName - Optional name of the FirebaseApp instance to return.
158 * @returns The FirebaseApp instance which has the provided name.
159 */
160 app(appName?: string): App;
161 get apps(): App[];
162 private ensureApp;
163}