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