No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.d.ts 10.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. /**
  2. * Firebase App
  3. *
  4. * @remarks This package coordinates the communication between the different Firebase components
  5. * @packageDocumentation
  6. */
  7. import { Component } from '@firebase/component';
  8. import { ComponentContainer } from '@firebase/component';
  9. import { FirebaseError } from '@firebase/util';
  10. import { LogCallback } from '@firebase/logger';
  11. import { LogLevelString } from '@firebase/logger';
  12. import { LogOptions } from '@firebase/logger';
  13. import { Name } from '@firebase/component';
  14. import { Provider } from '@firebase/component';
  15. /**
  16. * @param component - the component being added to this app's container
  17. *
  18. * @internal
  19. */
  20. export declare function _addComponent<T extends Name>(app: FirebaseApp, component: Component<T>): void;
  21. /**
  22. *
  23. * @internal
  24. */
  25. export declare function _addOrOverwriteComponent(app: FirebaseApp, component: Component): void;
  26. /**
  27. * @internal
  28. */
  29. export declare const _apps: Map<string, FirebaseApp>;
  30. /**
  31. * Test only
  32. *
  33. * @internal
  34. */
  35. export declare function _clearComponents(): void;
  36. /**
  37. * Registered components.
  38. *
  39. * @internal
  40. */
  41. export declare const _components: Map<string, Component<any>>;
  42. /**
  43. * The default app name
  44. *
  45. * @internal
  46. */
  47. export declare const _DEFAULT_ENTRY_NAME = "[DEFAULT]";
  48. /**
  49. * Renders this app unusable and frees the resources of all associated
  50. * services.
  51. *
  52. * @example
  53. * ```javascript
  54. * deleteApp(app)
  55. * .then(function() {
  56. * console.log("App deleted successfully");
  57. * })
  58. * .catch(function(error) {
  59. * console.log("Error deleting app:", error);
  60. * });
  61. * ```
  62. *
  63. * @public
  64. */
  65. export declare function deleteApp(app: FirebaseApp): Promise<void>;
  66. /**
  67. * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
  68. * services.
  69. *
  70. * Do not call this constructor directly. Instead, use
  71. * {@link (initializeApp:1) | initializeApp()} to create an app.
  72. *
  73. * @public
  74. */
  75. export declare interface FirebaseApp {
  76. /**
  77. * The (read-only) name for this app.
  78. *
  79. * The default app's name is `"[DEFAULT]"`.
  80. *
  81. * @example
  82. * ```javascript
  83. * // The default app's name is "[DEFAULT]"
  84. * const app = initializeApp(defaultAppConfig);
  85. * console.log(app.name); // "[DEFAULT]"
  86. * ```
  87. *
  88. * @example
  89. * ```javascript
  90. * // A named app's name is what you provide to initializeApp()
  91. * const otherApp = initializeApp(otherAppConfig, "other");
  92. * console.log(otherApp.name); // "other"
  93. * ```
  94. */
  95. readonly name: string;
  96. /**
  97. * The (read-only) configuration options for this app. These are the original
  98. * parameters given in {@link (initializeApp:1) | initializeApp()}.
  99. *
  100. * @example
  101. * ```javascript
  102. * const app = initializeApp(config);
  103. * console.log(app.options.databaseURL === config.databaseURL); // true
  104. * ```
  105. */
  106. readonly options: FirebaseOptions;
  107. /**
  108. * The settable config flag for GDPR opt-in/opt-out
  109. */
  110. automaticDataCollectionEnabled: boolean;
  111. }
  112. /**
  113. * @internal
  114. */
  115. export declare interface _FirebaseAppInternal extends FirebaseApp {
  116. container: ComponentContainer;
  117. isDeleted: boolean;
  118. checkDestroyed(): void;
  119. }
  120. /**
  121. * @public
  122. *
  123. * Configuration options given to {@link (initializeApp:1) | initializeApp()}
  124. */
  125. export declare interface FirebaseAppSettings {
  126. /**
  127. * custom name for the Firebase App.
  128. * The default value is `"[DEFAULT]"`.
  129. */
  130. name?: string;
  131. /**
  132. * The settable config flag for GDPR opt-in/opt-out
  133. */
  134. automaticDataCollectionEnabled?: boolean;
  135. }
  136. export { FirebaseError }
  137. /**
  138. * @public
  139. *
  140. * Firebase configuration object. Contains a set of parameters required by
  141. * services in order to successfully communicate with Firebase server APIs
  142. * and to associate client data with your Firebase project and
  143. * Firebase application. Typically this object is populated by the Firebase
  144. * console at project setup. See also:
  145. * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
  146. */
  147. export declare interface FirebaseOptions {
  148. /**
  149. * An encrypted string used when calling certain APIs that don't need to
  150. * access private user data
  151. * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
  152. */
  153. apiKey?: string;
  154. /**
  155. * Auth domain for the project ID.
  156. */
  157. authDomain?: string;
  158. /**
  159. * Default Realtime Database URL.
  160. */
  161. databaseURL?: string;
  162. /**
  163. * The unique identifier for the project across all of Firebase and
  164. * Google Cloud.
  165. */
  166. projectId?: string;
  167. /**
  168. * The default Cloud Storage bucket name.
  169. */
  170. storageBucket?: string;
  171. /**
  172. * Unique numerical value used to identify each sender that can send
  173. * Firebase Cloud Messaging messages to client apps.
  174. */
  175. messagingSenderId?: string;
  176. /**
  177. * Unique identifier for the app.
  178. */
  179. appId?: string;
  180. /**
  181. * An ID automatically created when you enable Analytics in your
  182. * Firebase project and register a web app. In versions 7.20.0
  183. * and higher, this parameter is optional.
  184. */
  185. measurementId?: string;
  186. }
  187. /**
  188. * @internal
  189. */
  190. export declare interface _FirebaseService {
  191. app: FirebaseApp;
  192. /**
  193. * Delete the service and free it's resources - called from
  194. * {@link @firebase/app#deleteApp | deleteApp()}
  195. */
  196. _delete(): Promise<void>;
  197. }
  198. /**
  199. * Retrieves a {@link @firebase/app#FirebaseApp} instance.
  200. *
  201. * When called with no arguments, the default app is returned. When an app name
  202. * is provided, the app corresponding to that name is returned.
  203. *
  204. * An exception is thrown if the app being retrieved has not yet been
  205. * initialized.
  206. *
  207. * @example
  208. * ```javascript
  209. * // Return the default app
  210. * const app = getApp();
  211. * ```
  212. *
  213. * @example
  214. * ```javascript
  215. * // Return a named app
  216. * const otherApp = getApp("otherApp");
  217. * ```
  218. *
  219. * @param name - Optional name of the app to return. If no name is
  220. * provided, the default is `"[DEFAULT]"`.
  221. *
  222. * @returns The app corresponding to the provided app name.
  223. * If no app name is provided, the default app is returned.
  224. *
  225. * @public
  226. */
  227. export declare function getApp(name?: string): FirebaseApp;
  228. /**
  229. * A (read-only) array of all initialized apps.
  230. * @public
  231. */
  232. export declare function getApps(): FirebaseApp[];
  233. /**
  234. *
  235. * @param app - FirebaseApp instance
  236. * @param name - service name
  237. *
  238. * @returns the provider for the service with the matching name
  239. *
  240. * @internal
  241. */
  242. export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provider<T>;
  243. /**
  244. * Creates and initializes a {@link @firebase/app#FirebaseApp} instance.
  245. *
  246. * See
  247. * {@link
  248. * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
  249. * | Add Firebase to your app} and
  250. * {@link
  251. * https://firebase.google.com/docs/web/setup#multiple-projects
  252. * | Initialize multiple projects} for detailed documentation.
  253. *
  254. * @example
  255. * ```javascript
  256. *
  257. * // Initialize default app
  258. * // Retrieve your own options values by adding a web app on
  259. * // https://console.firebase.google.com
  260. * initializeApp({
  261. * apiKey: "AIza....", // Auth / General Use
  262. * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
  263. * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
  264. * storageBucket: "YOUR_APP.appspot.com", // Storage
  265. * messagingSenderId: "123456789" // Cloud Messaging
  266. * });
  267. * ```
  268. *
  269. * @example
  270. * ```javascript
  271. *
  272. * // Initialize another app
  273. * const otherApp = initializeApp({
  274. * databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
  275. * storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
  276. * }, "otherApp");
  277. * ```
  278. *
  279. * @param options - Options to configure the app's services.
  280. * @param name - Optional name of the app to initialize. If no name
  281. * is provided, the default is `"[DEFAULT]"`.
  282. *
  283. * @returns The initialized app.
  284. *
  285. * @public
  286. */
  287. export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
  288. /**
  289. * Creates and initializes a FirebaseApp instance.
  290. *
  291. * @param options - Options to configure the app's services.
  292. * @param config - FirebaseApp Configuration
  293. *
  294. * @public
  295. */
  296. export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
  297. /**
  298. * Creates and initializes a FirebaseApp instance.
  299. *
  300. * @public
  301. */
  302. export declare function initializeApp(): FirebaseApp;
  303. /**
  304. * Sets log handler for all Firebase SDKs.
  305. * @param logCallback - An optional custom log handler that executes user code whenever
  306. * the Firebase SDK makes a logging call.
  307. *
  308. * @public
  309. */
  310. export declare function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
  311. /**
  312. *
  313. * @param component - the component to register
  314. * @returns whether or not the component is registered successfully
  315. *
  316. * @internal
  317. */
  318. export declare function _registerComponent<T extends Name>(component: Component<T>): boolean;
  319. /**
  320. * Registers a library's name and version for platform logging purposes.
  321. * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
  322. * @param version - Current version of that library.
  323. * @param variant - Bundle variant, e.g., node, rn, etc.
  324. *
  325. * @public
  326. */
  327. export declare function registerVersion(libraryKeyOrName: string, version: string, variant?: string): void;
  328. /**
  329. *
  330. * @param app - FirebaseApp instance
  331. * @param name - service name
  332. * @param instanceIdentifier - service instance identifier in case the service supports multiple instances
  333. *
  334. * @internal
  335. */
  336. export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
  337. /**
  338. * The current SDK version.
  339. *
  340. * @public
  341. */
  342. export declare const SDK_VERSION: string;
  343. /**
  344. * Sets log level for all Firebase SDKs.
  345. *
  346. * All of the log types above the current log level are captured (i.e. if
  347. * you set the log level to `info`, errors are logged, but `debug` and
  348. * `verbose` logs are not).
  349. *
  350. * @public
  351. */
  352. export declare function setLogLevel(logLevel: LogLevelString): void;
  353. export { }