@depup/firebase__app 0.14.9-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +32 -0
  2. package/changes.json +14 -0
  3. package/dist/app/src/api.d.ts +235 -0
  4. package/dist/app/src/constants.d.ts +26 -0
  5. package/dist/app/src/errors.d.ts +67 -0
  6. package/dist/app/src/firebaseApp.d.ts +46 -0
  7. package/dist/app/src/firebaseServerApp.d.ts +36 -0
  8. package/dist/app/src/global_index.d.ts +939 -0
  9. package/dist/app/src/heartbeatService.d.ts +89 -0
  10. package/dist/app/src/index.d.ts +9 -0
  11. package/dist/app/src/indexeddb.d.ts +20 -0
  12. package/dist/app/src/internal.d.ts +108 -0
  13. package/dist/app/src/logger.d.ts +18 -0
  14. package/dist/app/src/platformLoggerService.d.ts +23 -0
  15. package/dist/app/src/public-types.d.ts +241 -0
  16. package/dist/app/src/registerCoreComponents.d.ts +17 -0
  17. package/dist/app/src/tsdoc-metadata.json +11 -0
  18. package/dist/app/src/types.d.ts +55 -0
  19. package/dist/app/test/setup.d.ts +17 -0
  20. package/dist/app/test/util.d.ts +26 -0
  21. package/dist/app-public.d.ts +477 -0
  22. package/dist/app.d.ts +572 -0
  23. package/dist/esm/app/src/api.d.ts +235 -0
  24. package/dist/esm/app/src/constants.d.ts +26 -0
  25. package/dist/esm/app/src/errors.d.ts +67 -0
  26. package/dist/esm/app/src/firebaseApp.d.ts +46 -0
  27. package/dist/esm/app/src/firebaseServerApp.d.ts +36 -0
  28. package/dist/esm/app/src/heartbeatService.d.ts +89 -0
  29. package/dist/esm/app/src/index.d.ts +9 -0
  30. package/dist/esm/app/src/indexeddb.d.ts +20 -0
  31. package/dist/esm/app/src/internal.d.ts +108 -0
  32. package/dist/esm/app/src/logger.d.ts +18 -0
  33. package/dist/esm/app/src/platformLoggerService.d.ts +23 -0
  34. package/dist/esm/app/src/public-types.d.ts +241 -0
  35. package/dist/esm/app/src/registerCoreComponents.d.ts +17 -0
  36. package/dist/esm/app/src/types.d.ts +55 -0
  37. package/dist/esm/app/test/setup.d.ts +17 -0
  38. package/dist/esm/app/test/util.d.ts +26 -0
  39. package/dist/esm/index.esm.js +1237 -0
  40. package/dist/esm/index.esm.js.map +1 -0
  41. package/dist/esm/package.json +1 -0
  42. package/dist/index.cjs.js +1265 -0
  43. package/dist/index.cjs.js.map +1 -0
  44. package/package.json +100 -0
package/dist/app.d.ts ADDED
@@ -0,0 +1,572 @@
1
+ /**
2
+ * Firebase App
3
+ *
4
+ * @remarks This package coordinates the communication between the different Firebase components
5
+ * @packageDocumentation
6
+ */
7
+
8
+ import { Component } from '@firebase/component';
9
+ import { ComponentContainer } from '@firebase/component';
10
+ import { FirebaseError } from '@firebase/util';
11
+ import { LogCallback } from '@firebase/logger';
12
+ import { LogLevelString } from '@firebase/logger';
13
+ import { LogOptions } from '@firebase/logger';
14
+ import { Name } from '@firebase/component';
15
+ import { Provider } from '@firebase/component';
16
+
17
+ /**
18
+ * @param component - the component being added to this app's container
19
+ *
20
+ * @internal
21
+ */
22
+ export declare function _addComponent<T extends Name>(app: FirebaseApp, component: Component<T>): void;
23
+
24
+ /**
25
+ *
26
+ * @internal
27
+ */
28
+ export declare function _addOrOverwriteComponent(app: FirebaseApp, component: Component): void;
29
+
30
+ /**
31
+ * @internal
32
+ */
33
+ export declare const _apps: Map<string, FirebaseApp>;
34
+
35
+ /**
36
+ * Test only
37
+ *
38
+ * @internal
39
+ */
40
+ export declare function _clearComponents(): void;
41
+
42
+ /**
43
+ * Registered components.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare const _components: Map<string, Component<any>>;
48
+
49
+ /**
50
+ * The default app name
51
+ *
52
+ * @internal
53
+ */
54
+ export declare const _DEFAULT_ENTRY_NAME = "[DEFAULT]";
55
+
56
+ /**
57
+ * Renders this app unusable and frees the resources of all associated
58
+ * services.
59
+ *
60
+ * @example
61
+ * ```javascript
62
+ * deleteApp(app)
63
+ * .then(function() {
64
+ * console.log("App deleted successfully");
65
+ * })
66
+ * .catch(function(error) {
67
+ * console.log("Error deleting app:", error);
68
+ * });
69
+ * ```
70
+ *
71
+ * @public
72
+ */
73
+ export declare function deleteApp(app: FirebaseApp): Promise<void>;
74
+
75
+ /**
76
+ * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
77
+ * services.
78
+ *
79
+ * Do not call this constructor directly. Instead, use
80
+ * {@link (initializeApp:1) | initializeApp()} to create an app.
81
+ *
82
+ * @public
83
+ */
84
+ export declare interface FirebaseApp {
85
+ /**
86
+ * The (read-only) name for this app.
87
+ *
88
+ * The default app's name is `"[DEFAULT]"`.
89
+ *
90
+ * @example
91
+ * ```javascript
92
+ * // The default app's name is "[DEFAULT]"
93
+ * const app = initializeApp(defaultAppConfig);
94
+ * console.log(app.name); // "[DEFAULT]"
95
+ * ```
96
+ *
97
+ * @example
98
+ * ```javascript
99
+ * // A named app's name is what you provide to initializeApp()
100
+ * const otherApp = initializeApp(otherAppConfig, "other");
101
+ * console.log(otherApp.name); // "other"
102
+ * ```
103
+ */
104
+ readonly name: string;
105
+ /**
106
+ * The (read-only) configuration options for this app. These are the original
107
+ * parameters given in {@link (initializeApp:1) | initializeApp()}.
108
+ *
109
+ * @example
110
+ * ```javascript
111
+ * const app = initializeApp(config);
112
+ * console.log(app.options.databaseURL === config.databaseURL); // true
113
+ * ```
114
+ */
115
+ readonly options: FirebaseOptions;
116
+ /**
117
+ * The settable config flag for GDPR opt-in/opt-out
118
+ */
119
+ automaticDataCollectionEnabled: boolean;
120
+ }
121
+
122
+ /**
123
+ * @internal
124
+ */
125
+ export declare interface _FirebaseAppInternal extends FirebaseApp {
126
+ container: ComponentContainer;
127
+ isDeleted: boolean;
128
+ checkDestroyed(): void;
129
+ }
130
+
131
+ /**
132
+ * @public
133
+ *
134
+ * Configuration options given to {@link (initializeApp:1) | initializeApp()}
135
+ */
136
+ export declare interface FirebaseAppSettings {
137
+ /**
138
+ * custom name for the Firebase App.
139
+ * The default value is `"[DEFAULT]"`.
140
+ */
141
+ name?: string;
142
+ /**
143
+ * The settable config flag for GDPR opt-in/opt-out. Defaults to true.
144
+ */
145
+ automaticDataCollectionEnabled?: boolean;
146
+ }
147
+ export { FirebaseError }
148
+
149
+ /**
150
+ * @public
151
+ *
152
+ * Firebase configuration object. Contains a set of parameters required by
153
+ * services in order to successfully communicate with Firebase server APIs
154
+ * and to associate client data with your Firebase project and
155
+ * Firebase application. Typically this object is populated by the Firebase
156
+ * console at project setup. See also:
157
+ * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
158
+ */
159
+ export declare interface FirebaseOptions {
160
+ /**
161
+ * An encrypted string used when calling certain APIs that don't need to
162
+ * access private user data
163
+ * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
164
+ */
165
+ apiKey?: string;
166
+ /**
167
+ * Auth domain for the project ID.
168
+ */
169
+ authDomain?: string;
170
+ /**
171
+ * Default Realtime Database URL.
172
+ */
173
+ databaseURL?: string;
174
+ /**
175
+ * The unique identifier for the project across all of Firebase and
176
+ * Google Cloud.
177
+ */
178
+ projectId?: string;
179
+ /**
180
+ * The default Cloud Storage bucket name.
181
+ */
182
+ storageBucket?: string;
183
+ /**
184
+ * Unique numerical value used to identify each sender that can send
185
+ * Firebase Cloud Messaging messages to client apps.
186
+ */
187
+ messagingSenderId?: string;
188
+ /**
189
+ * Unique identifier for the app.
190
+ */
191
+ appId?: string;
192
+ /**
193
+ * An ID automatically created when you enable Analytics in your
194
+ * Firebase project and register a web app. In versions 7.20.0
195
+ * and higher, this parameter is optional.
196
+ */
197
+ measurementId?: string;
198
+ }
199
+
200
+ /**
201
+ * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
202
+ * for a collection of services running in server environments.
203
+ *
204
+ * Do not call this constructor directly. Instead, use
205
+ * {@link (initializeServerApp:1) | initializeServerApp()} to create
206
+ * an app.
207
+ *
208
+ * @public
209
+ */
210
+ export declare interface FirebaseServerApp extends FirebaseApp {
211
+ /**
212
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
213
+ * applications. However, it may be used internally, and is declared here so that
214
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
215
+ */
216
+ name: string;
217
+ /**
218
+ * The (read-only) configuration settings for this server app. These are the original
219
+ * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
220
+ *
221
+ * @example
222
+ * ```javascript
223
+ * const app = initializeServerApp(settings);
224
+ * console.log(app.settings.authIdToken === options.authIdToken); // true
225
+ * ```
226
+ */
227
+ readonly settings: FirebaseServerAppSettings;
228
+ }
229
+
230
+ /**
231
+ * @public
232
+ *
233
+ * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
234
+ */
235
+ export declare interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
236
+ /**
237
+ * An optional Auth ID token used to resume a signed in user session from a client
238
+ * runtime environment.
239
+ *
240
+ * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
241
+ * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
242
+ * needs to have been recently minted for this operation to succeed.
243
+ *
244
+ * If the token fails local verification due to expiration or parsing errors, then a console error
245
+ * is logged at the time of initialization of the `FirebaseServerApp` instance.
246
+ *
247
+ * If the Auth service has failed to validate the token when the Auth SDK is initialized, then an
248
+ * warning is logged to the console and the Auth SDK will not sign in a user on initialization.
249
+ *
250
+ * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
251
+ * is invoked with the `User` object as per standard Auth flows. However, `User` objects
252
+ * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
253
+ * operations fail.
254
+ */
255
+ authIdToken?: string;
256
+ /**
257
+ * An optional App Check token. If provided, the Firebase SDKs that use App Check will utilize
258
+ * this App Check token in place of requiring an instance of App Check to be initialized.
259
+ *
260
+ * If the token fails local verification due to expiration or parsing errors, then a console error
261
+ * is logged at the time of initialization of the `FirebaseServerApp` instance.
262
+ */
263
+ appCheckToken?: string;
264
+ /**
265
+ * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
266
+ * object to monitor the garbage collection status of the provided object. The
267
+ * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
268
+ * provided `releaseOnDeref` object is garbage collected.
269
+ *
270
+ * You can use this field to reduce memory management overhead for your application.
271
+ * If provided, an app running in a SSR pass does not need to perform
272
+ * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
273
+ * SSR scope, for instance.)
274
+ *
275
+ * If an object is not provided then the application must clean up the `FirebaseServerApp`
276
+ * instance by invoking `deleteApp`.
277
+ *
278
+ * If the application provides an object in this parameter, but the application is
279
+ * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
280
+ * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
281
+ * initialization.
282
+ */
283
+ releaseOnDeref?: object;
284
+ }
285
+
286
+ /**
287
+ * @internal
288
+ */
289
+ export declare interface _FirebaseService {
290
+ app: FirebaseApp;
291
+ /**
292
+ * Delete the service and free it's resources - called from
293
+ * {@link @firebase/app#deleteApp | deleteApp()}
294
+ */
295
+ _delete(): Promise<void>;
296
+ }
297
+
298
+ /**
299
+ * Retrieves a {@link @firebase/app#FirebaseApp} instance.
300
+ *
301
+ * When called with no arguments, the default app is returned. When an app name
302
+ * is provided, the app corresponding to that name is returned.
303
+ *
304
+ * An exception is thrown if the app being retrieved has not yet been
305
+ * initialized.
306
+ *
307
+ * @example
308
+ * ```javascript
309
+ * // Return the default app
310
+ * const app = getApp();
311
+ * ```
312
+ *
313
+ * @example
314
+ * ```javascript
315
+ * // Return a named app
316
+ * const otherApp = getApp("otherApp");
317
+ * ```
318
+ *
319
+ * @param name - Optional name of the app to return. If no name is
320
+ * provided, the default is `"[DEFAULT]"`.
321
+ *
322
+ * @returns The app corresponding to the provided app name.
323
+ * If no app name is provided, the default app is returned.
324
+ *
325
+ * @public
326
+ */
327
+ export declare function getApp(name?: string): FirebaseApp;
328
+
329
+ /**
330
+ * A (read-only) array of all initialized apps.
331
+ * @public
332
+ */
333
+ export declare function getApps(): FirebaseApp[];
334
+
335
+ /**
336
+ *
337
+ * @param app - FirebaseApp instance
338
+ * @param name - service name
339
+ *
340
+ * @returns the provider for the service with the matching name
341
+ *
342
+ * @internal
343
+ */
344
+ export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provider<T>;
345
+
346
+ /**
347
+ * Creates and initializes a {@link @firebase/app#FirebaseApp} instance.
348
+ *
349
+ * See
350
+ * {@link
351
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
352
+ * | Add Firebase to your app} and
353
+ * {@link
354
+ * https://firebase.google.com/docs/web/setup#multiple-projects
355
+ * | Initialize multiple projects} for detailed documentation.
356
+ *
357
+ * @example
358
+ * ```javascript
359
+ *
360
+ * // Initialize default app
361
+ * // Retrieve your own options values by adding a web app on
362
+ * // https://console.firebase.google.com
363
+ * initializeApp({
364
+ * apiKey: "AIza....", // Auth / General Use
365
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
366
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
367
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
368
+ * messagingSenderId: "123456789" // Cloud Messaging
369
+ * });
370
+ * ```
371
+ *
372
+ * @example
373
+ * ```javascript
374
+ *
375
+ * // Initialize another app
376
+ * const otherApp = initializeApp({
377
+ * databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
378
+ * storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
379
+ * }, "otherApp");
380
+ * ```
381
+ *
382
+ * @param options - Options to configure the app's services.
383
+ * @param name - Optional name of the app to initialize. If no name
384
+ * is provided, the default is `"[DEFAULT]"`.
385
+ *
386
+ * @returns The initialized app.
387
+ *
388
+ * @throws If the optional `name` parameter is malformed or empty.
389
+ *
390
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
391
+ *
392
+ * @public
393
+ */
394
+ export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
395
+
396
+ /**
397
+ * Creates and initializes a FirebaseApp instance.
398
+ *
399
+ * @param options - Options to configure the app's services.
400
+ * @param config - FirebaseApp Configuration
401
+ *
402
+ * @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
403
+ *
404
+ * @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
405
+ * @public
406
+ */
407
+ export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
408
+
409
+ /**
410
+ * Creates and initializes a FirebaseApp instance.
411
+ *
412
+ * @public
413
+ */
414
+ export declare function initializeApp(): FirebaseApp;
415
+
416
+ /**
417
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
418
+ *
419
+ * The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
420
+ * server side rendering environments only. Initialization will fail if invoked from a
421
+ * browser environment.
422
+ *
423
+ * See
424
+ * {@link
425
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
426
+ * | Add Firebase to your app} and
427
+ * {@link
428
+ * https://firebase.google.com/docs/web/setup#multiple-projects
429
+ * | Initialize multiple projects} for detailed documentation.
430
+ *
431
+ * @example
432
+ * ```javascript
433
+ *
434
+ * // Initialize an instance of `FirebaseServerApp`.
435
+ * // Retrieve your own options values by adding a web app on
436
+ * // https://console.firebase.google.com
437
+ * initializeServerApp({
438
+ * apiKey: "AIza....", // Auth / General Use
439
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
440
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
441
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
442
+ * messagingSenderId: "123456789" // Cloud Messaging
443
+ * },
444
+ * {
445
+ * authIdToken: "Your Auth ID Token"
446
+ * });
447
+ * ```
448
+ *
449
+ * @param options - `Firebase.AppOptions` to configure the app's services, or a
450
+ * a `FirebaseApp` instance which contains the `AppOptions` within.
451
+ * @param config - Optional `FirebaseServerApp` settings.
452
+ *
453
+ * @returns The initialized `FirebaseServerApp`.
454
+ *
455
+ * @throws If invoked in an unsupported non-server environment such as a browser.
456
+ *
457
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
458
+ * provide Finalization Registry support.
459
+ *
460
+ * @public
461
+ */
462
+ export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
463
+
464
+ /**
465
+ * Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
466
+ *
467
+ * @param config - Optional `FirebaseServerApp` settings.
468
+ *
469
+ * @returns The initialized `FirebaseServerApp`.
470
+ *
471
+ * @throws If invoked in an unsupported non-server environment such as a browser.
472
+ * @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
473
+ * provide Finalization Registry support.
474
+ * @throws If the `FIREBASE_OPTIONS` environment variable does not contain a valid project
475
+ * configuration required for auto-initialization.
476
+ *
477
+ * @public
478
+ */
479
+ export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
480
+
481
+ /**
482
+ *
483
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
484
+ *
485
+ * @returns true if the provide object is of type FirebaseApp.
486
+ *
487
+ * @internal
488
+ */
489
+ export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
490
+
491
+ /**
492
+ *
493
+ * @param obj - an object of type FirebaseApp.
494
+ *
495
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
496
+ *
497
+ * @internal
498
+ */
499
+ export declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp | null | undefined): obj is FirebaseServerApp;
500
+
501
+ /**
502
+ *
503
+ * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
504
+ *
505
+ * @returns true if the provided object is of type FirebaseServerAppImpl.
506
+ *
507
+ * @internal
508
+ */
509
+ export declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
510
+
511
+ /**
512
+ * Sets log handler for all Firebase SDKs.
513
+ * @param logCallback - An optional custom log handler that executes user code whenever
514
+ * the Firebase SDK makes a logging call.
515
+ *
516
+ * @public
517
+ */
518
+ export declare function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
519
+
520
+ /**
521
+ *
522
+ * @param component - the component to register
523
+ * @returns whether or not the component is registered successfully
524
+ *
525
+ * @internal
526
+ */
527
+ export declare function _registerComponent<T extends Name>(component: Component<T>): boolean;
528
+
529
+ /**
530
+ * Registers a library's name and version for platform logging purposes.
531
+ * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
532
+ * @param version - Current version of that library.
533
+ * @param variant - Bundle variant, e.g., node, rn, etc.
534
+ *
535
+ * @public
536
+ */
537
+ export declare function registerVersion(libraryKeyOrName: string, version: string, variant?: string): void;
538
+
539
+ /**
540
+ *
541
+ * @param app - FirebaseApp instance
542
+ * @param name - service name
543
+ * @param instanceIdentifier - service instance identifier in case the service supports multiple instances
544
+ *
545
+ * @internal
546
+ */
547
+ export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
548
+
549
+ /**
550
+ * The current SDK version.
551
+ *
552
+ * @public
553
+ */
554
+ export declare const SDK_VERSION: string;
555
+
556
+ /**
557
+ * @internal
558
+ */
559
+ export declare const _serverApps: Map<string, FirebaseServerApp>;
560
+
561
+ /**
562
+ * Sets log level for all Firebase SDKs.
563
+ *
564
+ * All of the log types above the current log level are captured (i.e. if
565
+ * you set the log level to `info`, errors are logged, but `debug` and
566
+ * `verbose` logs are not).
567
+ *
568
+ * @public
569
+ */
570
+ export declare function setLogLevel(logLevel: LogLevelString): void;
571
+
572
+ export { }