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-public.d.ts 8.7KB

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