1414 * limitations under the License.
1515 */
1616
17- import { Agent } from 'http' ;
1817import { auth } from './auth/index' ;
19- import { credential } from './credential/index' ;
2018import { database } from './database/index' ;
2119import { firestore } from './firestore/index' ;
2220import { instanceId } from './instance-id/index' ;
@@ -27,6 +25,10 @@ import { remoteConfig } from './remote-config/index';
2725import { securityRules } from './security-rules/index' ;
2826import { storage } from './storage/index' ;
2927
28+ import { App as AppCore , AppOptions } from './core' ;
29+
30+ export * from './core' ;
31+
3032/**
3133 * `FirebaseError` is a subclass of the standard JavaScript `Error` object. In
3234 * addition to a message string and stack trace, it contains a string code.
@@ -106,71 +108,6 @@ export interface FirebaseArrayIndexError {
106108 error : FirebaseError ;
107109}
108110
109- /**
110- * Available options to pass to [`initializeApp()`](admin#.initializeApp).
111- */
112- export interface AppOptions {
113-
114- /**
115- * A {@link credential.Credential `Credential`} object used to
116- * authenticate the Admin SDK.
117- *
118- * See [Initialize the SDK](/docs/admin/setup#initialize_the_sdk) for detailed
119- * documentation and code samples.
120- */
121- credential ?: credential . Credential ;
122-
123- /**
124- * The object to use as the [`auth`](/docs/reference/security/database/#auth)
125- * variable in your Realtime Database Rules when the Admin SDK reads from or
126- * writes to the Realtime Database. This allows you to downscope the Admin SDK
127- * from its default full read and write privileges.
128- *
129- * You can pass `null` to act as an unauthenticated client.
130- *
131- * See
132- * [Authenticate with limited privileges](/docs/database/admin/start#authenticate-with-limited-privileges)
133- * for detailed documentation and code samples.
134- */
135- databaseAuthVariableOverride ?: object | null ;
136-
137- /**
138- * The URL of the Realtime Database from which to read and write data.
139- */
140- databaseURL ?: string ;
141-
142- /**
143- * The ID of the service account to be used for signing custom tokens. This
144- * can be found in the `client_email` field of a service account JSON file.
145- */
146- serviceAccountId ?: string ;
147-
148- /**
149- * The name of the Google Cloud Storage bucket used for storing application data.
150- * Use only the bucket name without any prefixes or additions (do *not* prefix
151- * the name with "gs://").
152- */
153- storageBucket ?: string ;
154-
155- /**
156- * The ID of the Google Cloud project associated with the App.
157- */
158- projectId ?: string ;
159-
160- /**
161- * An [HTTP Agent](https://nodejs.org/api/http.html#http_class_http_agent)
162- * to be used when making outgoing HTTP calls. This Agent instance is used
163- * by all services that make REST calls (e.g. `auth`, `messaging`,
164- * `projectManagement`).
165- *
166- * Realtime Database and Firestore use other means of communicating with
167- * the backend servers, so they do not use this HTTP Agent. `Credential`
168- * instances also do not use this HTTP Agent, but instead support
169- * specifying an HTTP Agent in the corresponding factory methods.
170- */
171- httpAgent ?: Agent ;
172- }
173-
174111// eslint-disable-next-line @typescript-eslint/no-namespace
175112export namespace app {
176113 /**
@@ -183,45 +120,7 @@ export namespace app {
183120 * `admin.initializeApp()`}
184121 * to create an app.
185122 */
186- export interface App {
187-
188- /**
189- * The (read-only) name for this app.
190- *
191- * The default app's name is `"[DEFAULT]"`.
192- *
193- * @example
194- * ```javascript
195- * // The default app's name is "[DEFAULT]"
196- * admin.initializeApp(defaultAppConfig);
197- * console.log(admin.app().name); // "[DEFAULT]"
198- * ```
199- *
200- * @example
201- * ```javascript
202- * // A named app's name is what you provide to initializeApp()
203- * var otherApp = admin.initializeApp(otherAppConfig, "other");
204- * console.log(otherApp.name); // "other"
205- * ```
206- */
207- name : string ;
208-
209- /**
210- * The (read-only) configuration options for this app. These are the original
211- * parameters given in
212- * {@link
213- * https://firebase.google.com/docs/reference/admin/node/admin#.initializeApp
214- * `admin.initializeApp()`}.
215- *
216- * @example
217- * ```javascript
218- * var app = admin.initializeApp(config);
219- * console.log(app.options.credential === config.credential); // true
220- * console.log(app.options.databaseURL === config.databaseURL); // true
221- * ```
222- */
223- options : AppOptions ;
224-
123+ export interface App extends AppCore {
225124 auth ( ) : auth . Auth ;
226125 database ( url ?: string ) : database . Database ;
227126 firestore ( ) : firestore . Firestore ;
@@ -232,25 +131,6 @@ export namespace app {
232131 remoteConfig ( ) : remoteConfig . RemoteConfig ;
233132 securityRules ( ) : securityRules . SecurityRules ;
234133 storage ( ) : storage . Storage ;
235-
236- /**
237- * Renders this local `FirebaseApp` unusable and frees the resources of
238- * all associated services (though it does *not* clean up any backend
239- * resources). When running the SDK locally, this method
240- * must be called to ensure graceful termination of the process.
241- *
242- * @example
243- * ```javascript
244- * app.delete()
245- * .then(function() {
246- * console.log("App deleted successfully");
247- * })
248- * .catch(function(error) {
249- * console.log("Error deleting app:", error);
250- * });
251- * ```
252- */
253- delete ( ) : Promise < void > ;
254134 }
255135}
256136
0 commit comments