@firebase/app-compat 0.2.45 → 0.2.46

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 (37) hide show
  1. package/dist/esm/index.esm2017.js +408 -408
  2. package/dist/esm/index.esm2017.js.map +1 -1
  3. package/dist/esm/src/errors.d.ts +28 -28
  4. package/dist/esm/src/firebaseApp.d.ts +91 -91
  5. package/dist/esm/src/firebaseNamespace.d.ts +26 -26
  6. package/dist/esm/src/firebaseNamespaceCore.d.ts +27 -27
  7. package/dist/esm/src/index.d.ts +26 -26
  8. package/dist/esm/src/index.lite.d.ts +18 -18
  9. package/dist/esm/src/lite/firebaseAppLite.d.ts +49 -49
  10. package/dist/esm/src/lite/firebaseNamespaceLite.d.ts +18 -18
  11. package/dist/esm/src/logger.d.ts +18 -18
  12. package/dist/esm/src/public-types.d.ts +100 -100
  13. package/dist/esm/src/registerCoreComponents.d.ts +17 -17
  14. package/dist/esm/src/types.d.ts +71 -71
  15. package/dist/esm/test/firebaseAppCompat.test.d.ts +17 -17
  16. package/dist/esm/test/setup.d.ts +17 -17
  17. package/dist/esm/test/util.d.ts +28 -28
  18. package/dist/index.cjs.js +408 -408
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.lite.js +317 -317
  21. package/dist/index.lite.js.map +1 -1
  22. package/dist/src/errors.d.ts +28 -28
  23. package/dist/src/firebaseApp.d.ts +91 -91
  24. package/dist/src/firebaseNamespace.d.ts +26 -26
  25. package/dist/src/firebaseNamespaceCore.d.ts +27 -27
  26. package/dist/src/index.d.ts +26 -26
  27. package/dist/src/index.lite.d.ts +18 -18
  28. package/dist/src/lite/firebaseAppLite.d.ts +49 -49
  29. package/dist/src/lite/firebaseNamespaceLite.d.ts +18 -18
  30. package/dist/src/logger.d.ts +18 -18
  31. package/dist/src/public-types.d.ts +100 -100
  32. package/dist/src/registerCoreComponents.d.ts +17 -17
  33. package/dist/src/types.d.ts +71 -71
  34. package/dist/test/firebaseAppCompat.test.d.ts +17 -17
  35. package/dist/test/setup.d.ts +17 -17
  36. package/dist/test/util.d.ts +28 -28
  37. package/package.json +6 -6
@@ -4,434 +4,434 @@ import * as modularAPIs from '@firebase/app';
4
4
  import { _addComponent, deleteApp, _DEFAULT_ENTRY_NAME, _addOrOverwriteComponent, registerVersion } from '@firebase/app';
5
5
  import { Logger } from '@firebase/logger';
6
6
 
7
- /**
8
- * @license
9
- * Copyright 2020 Google LLC
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
- /**
24
- * Global context object for a collection of services using
25
- * a shared authentication state.
26
- *
27
- * marked as internal because it references internal types exported from @firebase/app
28
- * @internal
29
- */
30
- class FirebaseAppImpl {
31
- constructor(_delegate, firebase) {
32
- this._delegate = _delegate;
33
- this.firebase = firebase;
34
- // add itself to container
35
- _addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
36
- this.container = _delegate.container;
37
- }
38
- get automaticDataCollectionEnabled() {
39
- return this._delegate.automaticDataCollectionEnabled;
40
- }
41
- set automaticDataCollectionEnabled(val) {
42
- this._delegate.automaticDataCollectionEnabled = val;
43
- }
44
- get name() {
45
- return this._delegate.name;
46
- }
47
- get options() {
48
- return this._delegate.options;
49
- }
50
- delete() {
51
- return new Promise(resolve => {
52
- this._delegate.checkDestroyed();
53
- resolve();
54
- }).then(() => {
55
- this.firebase.INTERNAL.removeApp(this.name);
56
- return deleteApp(this._delegate);
57
- });
58
- }
59
- /**
60
- * Return a service instance associated with this app (creating it
61
- * on demand), identified by the passed instanceIdentifier.
62
- *
63
- * NOTE: Currently storage and functions are the only ones that are leveraging this
64
- * functionality. They invoke it by calling:
65
- *
66
- * ```javascript
67
- * firebase.app().storage('STORAGE BUCKET ID')
68
- * ```
69
- *
70
- * The service name is passed to this already
71
- * @internal
72
- */
73
- _getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
74
- var _a;
75
- this._delegate.checkDestroyed();
76
- // Initialize instance if InstantiationMode is `EXPLICIT`.
77
- const provider = this._delegate.container.getProvider(name);
78
- if (!provider.isInitialized() &&
79
- ((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* InstantiationMode.EXPLICIT */) {
80
- provider.initialize();
81
- }
82
- // getImmediate will always succeed because _getService is only called for registered components.
83
- return provider.getImmediate({
84
- identifier: instanceIdentifier
85
- });
86
- }
87
- /**
88
- * Remove a service instance from the cache, so we will create a new instance for this service
89
- * when people try to get it again.
90
- *
91
- * NOTE: currently only firestore uses this functionality to support firestore shutdown.
92
- *
93
- * @param name The service name
94
- * @param instanceIdentifier instance identifier in case multiple instances are allowed
95
- * @internal
96
- */
97
- _removeServiceInstance(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
98
- this._delegate.container
99
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
- .getProvider(name)
101
- .clearInstance(instanceIdentifier);
102
- }
103
- /**
104
- * @param component the component being added to this app's container
105
- * @internal
106
- */
107
- _addComponent(component) {
108
- _addComponent(this._delegate, component);
109
- }
110
- _addOrOverwriteComponent(component) {
111
- _addOrOverwriteComponent(this._delegate, component);
112
- }
113
- toJSON() {
114
- return {
115
- name: this.name,
116
- automaticDataCollectionEnabled: this.automaticDataCollectionEnabled,
117
- options: this.options
118
- };
119
- }
120
- }
121
- // TODO: investigate why the following needs to be commented out
122
- // Prevent dead-code elimination of these methods w/o invalid property
123
- // copying.
124
- // (FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
125
- // FirebaseAppImpl.prototype.delete ||
7
+ /**
8
+ * @license
9
+ * Copyright 2020 Google LLC
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ /**
24
+ * Global context object for a collection of services using
25
+ * a shared authentication state.
26
+ *
27
+ * marked as internal because it references internal types exported from @firebase/app
28
+ * @internal
29
+ */
30
+ class FirebaseAppImpl {
31
+ constructor(_delegate, firebase) {
32
+ this._delegate = _delegate;
33
+ this.firebase = firebase;
34
+ // add itself to container
35
+ _addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
36
+ this.container = _delegate.container;
37
+ }
38
+ get automaticDataCollectionEnabled() {
39
+ return this._delegate.automaticDataCollectionEnabled;
40
+ }
41
+ set automaticDataCollectionEnabled(val) {
42
+ this._delegate.automaticDataCollectionEnabled = val;
43
+ }
44
+ get name() {
45
+ return this._delegate.name;
46
+ }
47
+ get options() {
48
+ return this._delegate.options;
49
+ }
50
+ delete() {
51
+ return new Promise(resolve => {
52
+ this._delegate.checkDestroyed();
53
+ resolve();
54
+ }).then(() => {
55
+ this.firebase.INTERNAL.removeApp(this.name);
56
+ return deleteApp(this._delegate);
57
+ });
58
+ }
59
+ /**
60
+ * Return a service instance associated with this app (creating it
61
+ * on demand), identified by the passed instanceIdentifier.
62
+ *
63
+ * NOTE: Currently storage and functions are the only ones that are leveraging this
64
+ * functionality. They invoke it by calling:
65
+ *
66
+ * ```javascript
67
+ * firebase.app().storage('STORAGE BUCKET ID')
68
+ * ```
69
+ *
70
+ * The service name is passed to this already
71
+ * @internal
72
+ */
73
+ _getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
74
+ var _a;
75
+ this._delegate.checkDestroyed();
76
+ // Initialize instance if InstantiationMode is `EXPLICIT`.
77
+ const provider = this._delegate.container.getProvider(name);
78
+ if (!provider.isInitialized() &&
79
+ ((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* InstantiationMode.EXPLICIT */) {
80
+ provider.initialize();
81
+ }
82
+ // getImmediate will always succeed because _getService is only called for registered components.
83
+ return provider.getImmediate({
84
+ identifier: instanceIdentifier
85
+ });
86
+ }
87
+ /**
88
+ * Remove a service instance from the cache, so we will create a new instance for this service
89
+ * when people try to get it again.
90
+ *
91
+ * NOTE: currently only firestore uses this functionality to support firestore shutdown.
92
+ *
93
+ * @param name The service name
94
+ * @param instanceIdentifier instance identifier in case multiple instances are allowed
95
+ * @internal
96
+ */
97
+ _removeServiceInstance(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
98
+ this._delegate.container
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
+ .getProvider(name)
101
+ .clearInstance(instanceIdentifier);
102
+ }
103
+ /**
104
+ * @param component the component being added to this app's container
105
+ * @internal
106
+ */
107
+ _addComponent(component) {
108
+ _addComponent(this._delegate, component);
109
+ }
110
+ _addOrOverwriteComponent(component) {
111
+ _addOrOverwriteComponent(this._delegate, component);
112
+ }
113
+ toJSON() {
114
+ return {
115
+ name: this.name,
116
+ automaticDataCollectionEnabled: this.automaticDataCollectionEnabled,
117
+ options: this.options
118
+ };
119
+ }
120
+ }
121
+ // TODO: investigate why the following needs to be commented out
122
+ // Prevent dead-code elimination of these methods w/o invalid property
123
+ // copying.
124
+ // (FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||
125
+ // FirebaseAppImpl.prototype.delete ||
126
126
  // console.log('dc');
127
127
 
128
- /**
129
- * @license
130
- * Copyright 2019 Google LLC
131
- *
132
- * Licensed under the Apache License, Version 2.0 (the "License");
133
- * you may not use this file except in compliance with the License.
134
- * You may obtain a copy of the License at
135
- *
136
- * http://www.apache.org/licenses/LICENSE-2.0
137
- *
138
- * Unless required by applicable law or agreed to in writing, software
139
- * distributed under the License is distributed on an "AS IS" BASIS,
140
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141
- * See the License for the specific language governing permissions and
142
- * limitations under the License.
143
- */
144
- const ERRORS = {
145
- ["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
146
- 'call Firebase App.initializeApp()',
147
- ["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
148
- 'Firebase App instance.'
149
- };
128
+ /**
129
+ * @license
130
+ * Copyright 2019 Google LLC
131
+ *
132
+ * Licensed under the Apache License, Version 2.0 (the "License");
133
+ * you may not use this file except in compliance with the License.
134
+ * You may obtain a copy of the License at
135
+ *
136
+ * http://www.apache.org/licenses/LICENSE-2.0
137
+ *
138
+ * Unless required by applicable law or agreed to in writing, software
139
+ * distributed under the License is distributed on an "AS IS" BASIS,
140
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141
+ * See the License for the specific language governing permissions and
142
+ * limitations under the License.
143
+ */
144
+ const ERRORS = {
145
+ ["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
146
+ 'call Firebase App.initializeApp()',
147
+ ["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
148
+ 'Firebase App instance.'
149
+ };
150
150
  const ERROR_FACTORY = new ErrorFactory('app-compat', 'Firebase', ERRORS);
151
151
 
152
- /**
153
- * @license
154
- * Copyright 2019 Google LLC
155
- *
156
- * Licensed under the Apache License, Version 2.0 (the "License");
157
- * you may not use this file except in compliance with the License.
158
- * You may obtain a copy of the License at
159
- *
160
- * http://www.apache.org/licenses/LICENSE-2.0
161
- *
162
- * Unless required by applicable law or agreed to in writing, software
163
- * distributed under the License is distributed on an "AS IS" BASIS,
164
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165
- * See the License for the specific language governing permissions and
166
- * limitations under the License.
167
- */
168
- /**
169
- * Because auth can't share code with other components, we attach the utility functions
170
- * in an internal namespace to share code.
171
- * This function return a firebase namespace object without
172
- * any utility functions, so it can be shared between the regular firebaseNamespace and
173
- * the lite version.
174
- */
175
- function createFirebaseNamespaceCore(firebaseAppImpl) {
176
- const apps = {};
177
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
- // const components = new Map<string, Component<any>>();
179
- // A namespace is a plain JavaScript Object.
180
- const namespace = {
181
- // Hack to prevent Babel from modifying the object returned
182
- // as the firebase namespace.
183
- // @ts-ignore
184
- __esModule: true,
185
- initializeApp: initializeAppCompat,
186
- // @ts-ignore
187
- app,
188
- registerVersion: modularAPIs.registerVersion,
189
- setLogLevel: modularAPIs.setLogLevel,
190
- onLog: modularAPIs.onLog,
191
- // @ts-ignore
192
- apps: null,
193
- SDK_VERSION: modularAPIs.SDK_VERSION,
194
- INTERNAL: {
195
- registerComponent: registerComponentCompat,
196
- removeApp,
197
- useAsService,
198
- modularAPIs
199
- }
200
- };
201
- // Inject a circular default export to allow Babel users who were previously
202
- // using:
203
- //
204
- // import firebase from 'firebase';
205
- // which becomes: var firebase = require('firebase').default;
206
- //
207
- // instead of
208
- //
209
- // import * as firebase from 'firebase';
210
- // which becomes: var firebase = require('firebase');
211
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
212
- namespace['default'] = namespace;
213
- // firebase.apps is a read-only getter.
214
- Object.defineProperty(namespace, 'apps', {
215
- get: getApps
216
- });
217
- /**
218
- * Called by App.delete() - but before any services associated with the App
219
- * are deleted.
220
- */
221
- function removeApp(name) {
222
- delete apps[name];
223
- }
224
- /**
225
- * Get the App object for a given name (or DEFAULT).
226
- */
227
- function app(name) {
228
- name = name || modularAPIs._DEFAULT_ENTRY_NAME;
229
- if (!contains(apps, name)) {
230
- throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
231
- }
232
- return apps[name];
233
- }
234
- // @ts-ignore
235
- app['App'] = firebaseAppImpl;
236
- /**
237
- * Create a new App instance (name must be unique).
238
- *
239
- * This function is idempotent. It can be called more than once and return the same instance using the same options and config.
240
- */
241
- function initializeAppCompat(options, rawConfig = {}) {
242
- const app = modularAPIs.initializeApp(options, rawConfig);
243
- if (contains(apps, app.name)) {
244
- return apps[app.name];
245
- }
246
- const appCompat = new firebaseAppImpl(app, namespace);
247
- apps[app.name] = appCompat;
248
- return appCompat;
249
- }
250
- /*
251
- * Return an array of all the non-deleted FirebaseApps.
252
- */
253
- function getApps() {
254
- // Make a copy so caller cannot mutate the apps list.
255
- return Object.keys(apps).map(name => apps[name]);
256
- }
257
- function registerComponentCompat(component) {
258
- const componentName = component.name;
259
- const componentNameWithoutCompat = componentName.replace('-compat', '');
260
- if (modularAPIs._registerComponent(component) &&
261
- component.type === "PUBLIC" /* ComponentType.PUBLIC */) {
262
- // create service namespace for public components
263
- // The Service namespace is an accessor function ...
264
- const serviceNamespace = (appArg = app()) => {
265
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
- if (typeof appArg[componentNameWithoutCompat] !== 'function') {
267
- // Invalid argument.
268
- // This happens in the following case: firebase.storage('gs:/')
269
- throw ERROR_FACTORY.create("invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */, {
270
- appName: componentName
271
- });
272
- }
273
- // Forward service instance lookup to the FirebaseApp.
274
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
275
- return appArg[componentNameWithoutCompat]();
276
- };
277
- // ... and a container for service-level properties.
278
- if (component.serviceProps !== undefined) {
279
- deepExtend(serviceNamespace, component.serviceProps);
280
- }
281
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
- namespace[componentNameWithoutCompat] = serviceNamespace;
283
- // Patch the FirebaseAppImpl prototype
284
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
- firebaseAppImpl.prototype[componentNameWithoutCompat] =
286
- // TODO: The eslint disable can be removed and the 'ignoreRestArgs'
287
- // option added to the no-explicit-any rule when ESlint releases it.
288
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
- function (...args) {
290
- const serviceFxn = this._getService.bind(this, componentName);
291
- return serviceFxn.apply(this, component.multipleInstances ? args : []);
292
- };
293
- }
294
- return component.type === "PUBLIC" /* ComponentType.PUBLIC */
295
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
- namespace[componentNameWithoutCompat]
297
- : null;
298
- }
299
- // Map the requested service to a registered service name
300
- // (used to map auth to serverAuth service when needed).
301
- function useAsService(app, name) {
302
- if (name === 'serverAuth') {
303
- return null;
304
- }
305
- const useService = name;
306
- return useService;
307
- }
308
- return namespace;
152
+ /**
153
+ * @license
154
+ * Copyright 2019 Google LLC
155
+ *
156
+ * Licensed under the Apache License, Version 2.0 (the "License");
157
+ * you may not use this file except in compliance with the License.
158
+ * You may obtain a copy of the License at
159
+ *
160
+ * http://www.apache.org/licenses/LICENSE-2.0
161
+ *
162
+ * Unless required by applicable law or agreed to in writing, software
163
+ * distributed under the License is distributed on an "AS IS" BASIS,
164
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165
+ * See the License for the specific language governing permissions and
166
+ * limitations under the License.
167
+ */
168
+ /**
169
+ * Because auth can't share code with other components, we attach the utility functions
170
+ * in an internal namespace to share code.
171
+ * This function return a firebase namespace object without
172
+ * any utility functions, so it can be shared between the regular firebaseNamespace and
173
+ * the lite version.
174
+ */
175
+ function createFirebaseNamespaceCore(firebaseAppImpl) {
176
+ const apps = {};
177
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
+ // const components = new Map<string, Component<any>>();
179
+ // A namespace is a plain JavaScript Object.
180
+ const namespace = {
181
+ // Hack to prevent Babel from modifying the object returned
182
+ // as the firebase namespace.
183
+ // @ts-ignore
184
+ __esModule: true,
185
+ initializeApp: initializeAppCompat,
186
+ // @ts-ignore
187
+ app,
188
+ registerVersion: modularAPIs.registerVersion,
189
+ setLogLevel: modularAPIs.setLogLevel,
190
+ onLog: modularAPIs.onLog,
191
+ // @ts-ignore
192
+ apps: null,
193
+ SDK_VERSION: modularAPIs.SDK_VERSION,
194
+ INTERNAL: {
195
+ registerComponent: registerComponentCompat,
196
+ removeApp,
197
+ useAsService,
198
+ modularAPIs
199
+ }
200
+ };
201
+ // Inject a circular default export to allow Babel users who were previously
202
+ // using:
203
+ //
204
+ // import firebase from 'firebase';
205
+ // which becomes: var firebase = require('firebase').default;
206
+ //
207
+ // instead of
208
+ //
209
+ // import * as firebase from 'firebase';
210
+ // which becomes: var firebase = require('firebase');
211
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
212
+ namespace['default'] = namespace;
213
+ // firebase.apps is a read-only getter.
214
+ Object.defineProperty(namespace, 'apps', {
215
+ get: getApps
216
+ });
217
+ /**
218
+ * Called by App.delete() - but before any services associated with the App
219
+ * are deleted.
220
+ */
221
+ function removeApp(name) {
222
+ delete apps[name];
223
+ }
224
+ /**
225
+ * Get the App object for a given name (or DEFAULT).
226
+ */
227
+ function app(name) {
228
+ name = name || modularAPIs._DEFAULT_ENTRY_NAME;
229
+ if (!contains(apps, name)) {
230
+ throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
231
+ }
232
+ return apps[name];
233
+ }
234
+ // @ts-ignore
235
+ app['App'] = firebaseAppImpl;
236
+ /**
237
+ * Create a new App instance (name must be unique).
238
+ *
239
+ * This function is idempotent. It can be called more than once and return the same instance using the same options and config.
240
+ */
241
+ function initializeAppCompat(options, rawConfig = {}) {
242
+ const app = modularAPIs.initializeApp(options, rawConfig);
243
+ if (contains(apps, app.name)) {
244
+ return apps[app.name];
245
+ }
246
+ const appCompat = new firebaseAppImpl(app, namespace);
247
+ apps[app.name] = appCompat;
248
+ return appCompat;
249
+ }
250
+ /*
251
+ * Return an array of all the non-deleted FirebaseApps.
252
+ */
253
+ function getApps() {
254
+ // Make a copy so caller cannot mutate the apps list.
255
+ return Object.keys(apps).map(name => apps[name]);
256
+ }
257
+ function registerComponentCompat(component) {
258
+ const componentName = component.name;
259
+ const componentNameWithoutCompat = componentName.replace('-compat', '');
260
+ if (modularAPIs._registerComponent(component) &&
261
+ component.type === "PUBLIC" /* ComponentType.PUBLIC */) {
262
+ // create service namespace for public components
263
+ // The Service namespace is an accessor function ...
264
+ const serviceNamespace = (appArg = app()) => {
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
+ if (typeof appArg[componentNameWithoutCompat] !== 'function') {
267
+ // Invalid argument.
268
+ // This happens in the following case: firebase.storage('gs:/')
269
+ throw ERROR_FACTORY.create("invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */, {
270
+ appName: componentName
271
+ });
272
+ }
273
+ // Forward service instance lookup to the FirebaseApp.
274
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
275
+ return appArg[componentNameWithoutCompat]();
276
+ };
277
+ // ... and a container for service-level properties.
278
+ if (component.serviceProps !== undefined) {
279
+ deepExtend(serviceNamespace, component.serviceProps);
280
+ }
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
+ namespace[componentNameWithoutCompat] = serviceNamespace;
283
+ // Patch the FirebaseAppImpl prototype
284
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
+ firebaseAppImpl.prototype[componentNameWithoutCompat] =
286
+ // TODO: The eslint disable can be removed and the 'ignoreRestArgs'
287
+ // option added to the no-explicit-any rule when ESlint releases it.
288
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
+ function (...args) {
290
+ const serviceFxn = this._getService.bind(this, componentName);
291
+ return serviceFxn.apply(this, component.multipleInstances ? args : []);
292
+ };
293
+ }
294
+ return component.type === "PUBLIC" /* ComponentType.PUBLIC */
295
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
+ namespace[componentNameWithoutCompat]
297
+ : null;
298
+ }
299
+ // Map the requested service to a registered service name
300
+ // (used to map auth to serverAuth service when needed).
301
+ function useAsService(app, name) {
302
+ if (name === 'serverAuth') {
303
+ return null;
304
+ }
305
+ const useService = name;
306
+ return useService;
307
+ }
308
+ return namespace;
309
309
  }
310
310
 
311
- /**
312
- * @license
313
- * Copyright 2019 Google LLC
314
- *
315
- * Licensed under the Apache License, Version 2.0 (the "License");
316
- * you may not use this file except in compliance with the License.
317
- * You may obtain a copy of the License at
318
- *
319
- * http://www.apache.org/licenses/LICENSE-2.0
320
- *
321
- * Unless required by applicable law or agreed to in writing, software
322
- * distributed under the License is distributed on an "AS IS" BASIS,
323
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
324
- * See the License for the specific language governing permissions and
325
- * limitations under the License.
326
- */
327
- /**
328
- * Return a firebase namespace object.
329
- *
330
- * In production, this will be called exactly once and the result
331
- * assigned to the 'firebase' global. It may be called multiple times
332
- * in unit tests.
333
- */
334
- function createFirebaseNamespace() {
335
- const namespace = createFirebaseNamespaceCore(FirebaseAppImpl);
336
- namespace.INTERNAL = Object.assign(Object.assign({}, namespace.INTERNAL), { createFirebaseNamespace,
337
- extendNamespace,
338
- createSubscribe,
339
- ErrorFactory,
340
- deepExtend });
341
- /**
342
- * Patch the top-level firebase namespace with additional properties.
343
- *
344
- * firebase.INTERNAL.extendNamespace()
345
- */
346
- function extendNamespace(props) {
347
- deepExtend(namespace, props);
348
- }
349
- return namespace;
350
- }
311
+ /**
312
+ * @license
313
+ * Copyright 2019 Google LLC
314
+ *
315
+ * Licensed under the Apache License, Version 2.0 (the "License");
316
+ * you may not use this file except in compliance with the License.
317
+ * You may obtain a copy of the License at
318
+ *
319
+ * http://www.apache.org/licenses/LICENSE-2.0
320
+ *
321
+ * Unless required by applicable law or agreed to in writing, software
322
+ * distributed under the License is distributed on an "AS IS" BASIS,
323
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
324
+ * See the License for the specific language governing permissions and
325
+ * limitations under the License.
326
+ */
327
+ /**
328
+ * Return a firebase namespace object.
329
+ *
330
+ * In production, this will be called exactly once and the result
331
+ * assigned to the 'firebase' global. It may be called multiple times
332
+ * in unit tests.
333
+ */
334
+ function createFirebaseNamespace() {
335
+ const namespace = createFirebaseNamespaceCore(FirebaseAppImpl);
336
+ namespace.INTERNAL = Object.assign(Object.assign({}, namespace.INTERNAL), { createFirebaseNamespace,
337
+ extendNamespace,
338
+ createSubscribe,
339
+ ErrorFactory,
340
+ deepExtend });
341
+ /**
342
+ * Patch the top-level firebase namespace with additional properties.
343
+ *
344
+ * firebase.INTERNAL.extendNamespace()
345
+ */
346
+ function extendNamespace(props) {
347
+ deepExtend(namespace, props);
348
+ }
349
+ return namespace;
350
+ }
351
351
  const firebase$1 = createFirebaseNamespace();
352
352
 
353
- /**
354
- * @license
355
- * Copyright 2019 Google LLC
356
- *
357
- * Licensed under the Apache License, Version 2.0 (the "License");
358
- * you may not use this file except in compliance with the License.
359
- * You may obtain a copy of the License at
360
- *
361
- * http://www.apache.org/licenses/LICENSE-2.0
362
- *
363
- * Unless required by applicable law or agreed to in writing, software
364
- * distributed under the License is distributed on an "AS IS" BASIS,
365
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
366
- * See the License for the specific language governing permissions and
367
- * limitations under the License.
368
- */
353
+ /**
354
+ * @license
355
+ * Copyright 2019 Google LLC
356
+ *
357
+ * Licensed under the Apache License, Version 2.0 (the "License");
358
+ * you may not use this file except in compliance with the License.
359
+ * You may obtain a copy of the License at
360
+ *
361
+ * http://www.apache.org/licenses/LICENSE-2.0
362
+ *
363
+ * Unless required by applicable law or agreed to in writing, software
364
+ * distributed under the License is distributed on an "AS IS" BASIS,
365
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
366
+ * See the License for the specific language governing permissions and
367
+ * limitations under the License.
368
+ */
369
369
  const logger = new Logger('@firebase/app-compat');
370
370
 
371
371
  const name = "@firebase/app-compat";
372
- const version = "0.2.45";
372
+ const version = "0.2.46";
373
373
 
374
- /**
375
- * @license
376
- * Copyright 2019 Google LLC
377
- *
378
- * Licensed under the Apache License, Version 2.0 (the "License");
379
- * you may not use this file except in compliance with the License.
380
- * You may obtain a copy of the License at
381
- *
382
- * http://www.apache.org/licenses/LICENSE-2.0
383
- *
384
- * Unless required by applicable law or agreed to in writing, software
385
- * distributed under the License is distributed on an "AS IS" BASIS,
386
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
387
- * See the License for the specific language governing permissions and
388
- * limitations under the License.
389
- */
390
- function registerCoreComponents(variant) {
391
- // Register `app` package.
392
- registerVersion(name, version, variant);
374
+ /**
375
+ * @license
376
+ * Copyright 2019 Google LLC
377
+ *
378
+ * Licensed under the Apache License, Version 2.0 (the "License");
379
+ * you may not use this file except in compliance with the License.
380
+ * You may obtain a copy of the License at
381
+ *
382
+ * http://www.apache.org/licenses/LICENSE-2.0
383
+ *
384
+ * Unless required by applicable law or agreed to in writing, software
385
+ * distributed under the License is distributed on an "AS IS" BASIS,
386
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
387
+ * See the License for the specific language governing permissions and
388
+ * limitations under the License.
389
+ */
390
+ function registerCoreComponents(variant) {
391
+ // Register `app` package.
392
+ registerVersion(name, version, variant);
393
393
  }
394
394
 
395
- /**
396
- * @license
397
- * Copyright 2020 Google LLC
398
- *
399
- * Licensed under the Apache License, Version 2.0 (the "License");
400
- * you may not use this file except in compliance with the License.
401
- * You may obtain a copy of the License at
402
- *
403
- * http://www.apache.org/licenses/LICENSE-2.0
404
- *
405
- * Unless required by applicable law or agreed to in writing, software
406
- * distributed under the License is distributed on an "AS IS" BASIS,
407
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
408
- * See the License for the specific language governing permissions and
409
- * limitations under the License.
410
- */
411
- try {
412
- const globals = getGlobal();
413
- // Firebase Lite detection
414
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
415
- if (globals.firebase !== undefined) {
395
+ /**
396
+ * @license
397
+ * Copyright 2020 Google LLC
398
+ *
399
+ * Licensed under the Apache License, Version 2.0 (the "License");
400
+ * you may not use this file except in compliance with the License.
401
+ * You may obtain a copy of the License at
402
+ *
403
+ * http://www.apache.org/licenses/LICENSE-2.0
404
+ *
405
+ * Unless required by applicable law or agreed to in writing, software
406
+ * distributed under the License is distributed on an "AS IS" BASIS,
407
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
408
+ * See the License for the specific language governing permissions and
409
+ * limitations under the License.
410
+ */
411
+ try {
412
+ const globals = getGlobal();
413
+ // Firebase Lite detection
414
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
415
+ if (globals.firebase !== undefined) {
416
416
  logger.warn(`
417
417
  Warning: Firebase is already defined in the global scope. Please make sure
418
418
  Firebase library is only loaded once.
419
- `);
420
- // eslint-disable-next-line
421
- const sdkVersion = globals.firebase
422
- .SDK_VERSION;
423
- if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
419
+ `);
420
+ // eslint-disable-next-line
421
+ const sdkVersion = globals.firebase
422
+ .SDK_VERSION;
423
+ if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {
424
424
  logger.warn(`
425
425
  Warning: You are trying to load Firebase while using Firebase Performance standalone script.
426
426
  You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.
427
- `);
428
- }
429
- }
430
- }
431
- catch (_a) {
432
- // ignore errors thrown by getGlobal
433
- }
434
- const firebase = firebase$1;
427
+ `);
428
+ }
429
+ }
430
+ }
431
+ catch (_a) {
432
+ // ignore errors thrown by getGlobal
433
+ }
434
+ const firebase = firebase$1;
435
435
  registerCoreComponents();
436
436
 
437
437
  export { firebase as default };