@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
@@ -3,335 +3,335 @@ import { _addComponent, deleteApp, _DEFAULT_ENTRY_NAME, registerVersion } from '
3
3
  import { Component } from '@firebase/component';
4
4
  import { ErrorFactory, contains, deepExtend } from '@firebase/util';
5
5
 
6
- /**
7
- * @license
8
- * Copyright 2019 Google LLC
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- /**
23
- * Global context object for a collection of services using
24
- * a shared authentication state.
25
- */
26
- class FirebaseAppLiteImpl {
27
- constructor(_delegate, firebase) {
28
- this._delegate = _delegate;
29
- this.firebase = firebase;
30
- // add itself to container
31
- _addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
32
- }
33
- get automaticDataCollectionEnabled() {
34
- return this._delegate.automaticDataCollectionEnabled;
35
- }
36
- set automaticDataCollectionEnabled(val) {
37
- this.automaticDataCollectionEnabled = val;
38
- }
39
- get name() {
40
- return this._delegate.name;
41
- }
42
- get options() {
43
- return this._delegate.options;
44
- }
45
- delete() {
46
- this.firebase.INTERNAL.removeApp(this.name);
47
- return deleteApp(this._delegate);
48
- }
49
- /**
50
- * Return a service instance associated with this app (creating it
51
- * on demand), identified by the passed instanceIdentifier.
52
- *
53
- * NOTE: Currently storage is the only one that is leveraging this
54
- * functionality. They invoke it by calling:
55
- *
56
- * ```javascript
57
- * firebase.app().storage('STORAGE BUCKET ID')
58
- * ```
59
- *
60
- * The service name is passed to this already
61
- * @internal
62
- */
63
- _getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
64
- this._delegate.checkDestroyed();
65
- // getImmediate will always succeed because _getService is only called for registered components.
66
- return this._delegate.container.getProvider(name).getImmediate({
67
- identifier: instanceIdentifier
68
- });
69
- }
6
+ /**
7
+ * @license
8
+ * Copyright 2019 Google LLC
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ /**
23
+ * Global context object for a collection of services using
24
+ * a shared authentication state.
25
+ */
26
+ class FirebaseAppLiteImpl {
27
+ constructor(_delegate, firebase) {
28
+ this._delegate = _delegate;
29
+ this.firebase = firebase;
30
+ // add itself to container
31
+ _addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
32
+ }
33
+ get automaticDataCollectionEnabled() {
34
+ return this._delegate.automaticDataCollectionEnabled;
35
+ }
36
+ set automaticDataCollectionEnabled(val) {
37
+ this.automaticDataCollectionEnabled = val;
38
+ }
39
+ get name() {
40
+ return this._delegate.name;
41
+ }
42
+ get options() {
43
+ return this._delegate.options;
44
+ }
45
+ delete() {
46
+ this.firebase.INTERNAL.removeApp(this.name);
47
+ return deleteApp(this._delegate);
48
+ }
49
+ /**
50
+ * Return a service instance associated with this app (creating it
51
+ * on demand), identified by the passed instanceIdentifier.
52
+ *
53
+ * NOTE: Currently storage is the only one that is leveraging this
54
+ * functionality. They invoke it by calling:
55
+ *
56
+ * ```javascript
57
+ * firebase.app().storage('STORAGE BUCKET ID')
58
+ * ```
59
+ *
60
+ * The service name is passed to this already
61
+ * @internal
62
+ */
63
+ _getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {
64
+ this._delegate.checkDestroyed();
65
+ // getImmediate will always succeed because _getService is only called for registered components.
66
+ return this._delegate.container.getProvider(name).getImmediate({
67
+ identifier: instanceIdentifier
68
+ });
69
+ }
70
70
  }
71
71
 
72
- /**
73
- * @license
74
- * Copyright 2019 Google LLC
75
- *
76
- * Licensed under the Apache License, Version 2.0 (the "License");
77
- * you may not use this file except in compliance with the License.
78
- * You may obtain a copy of the License at
79
- *
80
- * http://www.apache.org/licenses/LICENSE-2.0
81
- *
82
- * Unless required by applicable law or agreed to in writing, software
83
- * distributed under the License is distributed on an "AS IS" BASIS,
84
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85
- * See the License for the specific language governing permissions and
86
- * limitations under the License.
87
- */
88
- const ERRORS = {
89
- ["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
90
- 'call Firebase App.initializeApp()',
91
- ["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
92
- 'Firebase App instance.'
93
- };
72
+ /**
73
+ * @license
74
+ * Copyright 2019 Google LLC
75
+ *
76
+ * Licensed under the Apache License, Version 2.0 (the "License");
77
+ * you may not use this file except in compliance with the License.
78
+ * You may obtain a copy of the License at
79
+ *
80
+ * http://www.apache.org/licenses/LICENSE-2.0
81
+ *
82
+ * Unless required by applicable law or agreed to in writing, software
83
+ * distributed under the License is distributed on an "AS IS" BASIS,
84
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
85
+ * See the License for the specific language governing permissions and
86
+ * limitations under the License.
87
+ */
88
+ const ERRORS = {
89
+ ["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
90
+ 'call Firebase App.initializeApp()',
91
+ ["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
92
+ 'Firebase App instance.'
93
+ };
94
94
  const ERROR_FACTORY = new ErrorFactory('app-compat', 'Firebase', ERRORS);
95
95
 
96
- /**
97
- * @license
98
- * Copyright 2019 Google LLC
99
- *
100
- * Licensed under the Apache License, Version 2.0 (the "License");
101
- * you may not use this file except in compliance with the License.
102
- * You may obtain a copy of the License at
103
- *
104
- * http://www.apache.org/licenses/LICENSE-2.0
105
- *
106
- * Unless required by applicable law or agreed to in writing, software
107
- * distributed under the License is distributed on an "AS IS" BASIS,
108
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109
- * See the License for the specific language governing permissions and
110
- * limitations under the License.
111
- */
112
- /**
113
- * Because auth can't share code with other components, we attach the utility functions
114
- * in an internal namespace to share code.
115
- * This function return a firebase namespace object without
116
- * any utility functions, so it can be shared between the regular firebaseNamespace and
117
- * the lite version.
118
- */
119
- function createFirebaseNamespaceCore(firebaseAppImpl) {
120
- const apps = {};
121
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
- // const components = new Map<string, Component<any>>();
123
- // A namespace is a plain JavaScript Object.
124
- const namespace = {
125
- // Hack to prevent Babel from modifying the object returned
126
- // as the firebase namespace.
127
- // @ts-ignore
128
- __esModule: true,
129
- initializeApp: initializeAppCompat,
130
- // @ts-ignore
131
- app,
132
- registerVersion: modularAPIs.registerVersion,
133
- setLogLevel: modularAPIs.setLogLevel,
134
- onLog: modularAPIs.onLog,
135
- // @ts-ignore
136
- apps: null,
137
- SDK_VERSION: modularAPIs.SDK_VERSION,
138
- INTERNAL: {
139
- registerComponent: registerComponentCompat,
140
- removeApp,
141
- useAsService,
142
- modularAPIs
143
- }
144
- };
145
- // Inject a circular default export to allow Babel users who were previously
146
- // using:
147
- //
148
- // import firebase from 'firebase';
149
- // which becomes: var firebase = require('firebase').default;
150
- //
151
- // instead of
152
- //
153
- // import * as firebase from 'firebase';
154
- // which becomes: var firebase = require('firebase');
155
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
156
- namespace['default'] = namespace;
157
- // firebase.apps is a read-only getter.
158
- Object.defineProperty(namespace, 'apps', {
159
- get: getApps
160
- });
161
- /**
162
- * Called by App.delete() - but before any services associated with the App
163
- * are deleted.
164
- */
165
- function removeApp(name) {
166
- delete apps[name];
167
- }
168
- /**
169
- * Get the App object for a given name (or DEFAULT).
170
- */
171
- function app(name) {
172
- name = name || modularAPIs._DEFAULT_ENTRY_NAME;
173
- if (!contains(apps, name)) {
174
- throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
175
- }
176
- return apps[name];
177
- }
178
- // @ts-ignore
179
- app['App'] = firebaseAppImpl;
180
- /**
181
- * Create a new App instance (name must be unique).
182
- *
183
- * This function is idempotent. It can be called more than once and return the same instance using the same options and config.
184
- */
185
- function initializeAppCompat(options, rawConfig = {}) {
186
- const app = modularAPIs.initializeApp(options, rawConfig);
187
- if (contains(apps, app.name)) {
188
- return apps[app.name];
189
- }
190
- const appCompat = new firebaseAppImpl(app, namespace);
191
- apps[app.name] = appCompat;
192
- return appCompat;
193
- }
194
- /*
195
- * Return an array of all the non-deleted FirebaseApps.
196
- */
197
- function getApps() {
198
- // Make a copy so caller cannot mutate the apps list.
199
- return Object.keys(apps).map(name => apps[name]);
200
- }
201
- function registerComponentCompat(component) {
202
- const componentName = component.name;
203
- const componentNameWithoutCompat = componentName.replace('-compat', '');
204
- if (modularAPIs._registerComponent(component) &&
205
- component.type === "PUBLIC" /* ComponentType.PUBLIC */) {
206
- // create service namespace for public components
207
- // The Service namespace is an accessor function ...
208
- const serviceNamespace = (appArg = app()) => {
209
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
210
- if (typeof appArg[componentNameWithoutCompat] !== 'function') {
211
- // Invalid argument.
212
- // This happens in the following case: firebase.storage('gs:/')
213
- throw ERROR_FACTORY.create("invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */, {
214
- appName: componentName
215
- });
216
- }
217
- // Forward service instance lookup to the FirebaseApp.
218
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
219
- return appArg[componentNameWithoutCompat]();
220
- };
221
- // ... and a container for service-level properties.
222
- if (component.serviceProps !== undefined) {
223
- deepExtend(serviceNamespace, component.serviceProps);
224
- }
225
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
- namespace[componentNameWithoutCompat] = serviceNamespace;
227
- // Patch the FirebaseAppImpl prototype
228
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
229
- firebaseAppImpl.prototype[componentNameWithoutCompat] =
230
- // TODO: The eslint disable can be removed and the 'ignoreRestArgs'
231
- // option added to the no-explicit-any rule when ESlint releases it.
232
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
- function (...args) {
234
- const serviceFxn = this._getService.bind(this, componentName);
235
- return serviceFxn.apply(this, component.multipleInstances ? args : []);
236
- };
237
- }
238
- return component.type === "PUBLIC" /* ComponentType.PUBLIC */
239
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
- namespace[componentNameWithoutCompat]
241
- : null;
242
- }
243
- // Map the requested service to a registered service name
244
- // (used to map auth to serverAuth service when needed).
245
- function useAsService(app, name) {
246
- if (name === 'serverAuth') {
247
- return null;
248
- }
249
- const useService = name;
250
- return useService;
251
- }
252
- return namespace;
96
+ /**
97
+ * @license
98
+ * Copyright 2019 Google LLC
99
+ *
100
+ * Licensed under the Apache License, Version 2.0 (the "License");
101
+ * you may not use this file except in compliance with the License.
102
+ * You may obtain a copy of the License at
103
+ *
104
+ * http://www.apache.org/licenses/LICENSE-2.0
105
+ *
106
+ * Unless required by applicable law or agreed to in writing, software
107
+ * distributed under the License is distributed on an "AS IS" BASIS,
108
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109
+ * See the License for the specific language governing permissions and
110
+ * limitations under the License.
111
+ */
112
+ /**
113
+ * Because auth can't share code with other components, we attach the utility functions
114
+ * in an internal namespace to share code.
115
+ * This function return a firebase namespace object without
116
+ * any utility functions, so it can be shared between the regular firebaseNamespace and
117
+ * the lite version.
118
+ */
119
+ function createFirebaseNamespaceCore(firebaseAppImpl) {
120
+ const apps = {};
121
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
+ // const components = new Map<string, Component<any>>();
123
+ // A namespace is a plain JavaScript Object.
124
+ const namespace = {
125
+ // Hack to prevent Babel from modifying the object returned
126
+ // as the firebase namespace.
127
+ // @ts-ignore
128
+ __esModule: true,
129
+ initializeApp: initializeAppCompat,
130
+ // @ts-ignore
131
+ app,
132
+ registerVersion: modularAPIs.registerVersion,
133
+ setLogLevel: modularAPIs.setLogLevel,
134
+ onLog: modularAPIs.onLog,
135
+ // @ts-ignore
136
+ apps: null,
137
+ SDK_VERSION: modularAPIs.SDK_VERSION,
138
+ INTERNAL: {
139
+ registerComponent: registerComponentCompat,
140
+ removeApp,
141
+ useAsService,
142
+ modularAPIs
143
+ }
144
+ };
145
+ // Inject a circular default export to allow Babel users who were previously
146
+ // using:
147
+ //
148
+ // import firebase from 'firebase';
149
+ // which becomes: var firebase = require('firebase').default;
150
+ //
151
+ // instead of
152
+ //
153
+ // import * as firebase from 'firebase';
154
+ // which becomes: var firebase = require('firebase');
155
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
156
+ namespace['default'] = namespace;
157
+ // firebase.apps is a read-only getter.
158
+ Object.defineProperty(namespace, 'apps', {
159
+ get: getApps
160
+ });
161
+ /**
162
+ * Called by App.delete() - but before any services associated with the App
163
+ * are deleted.
164
+ */
165
+ function removeApp(name) {
166
+ delete apps[name];
167
+ }
168
+ /**
169
+ * Get the App object for a given name (or DEFAULT).
170
+ */
171
+ function app(name) {
172
+ name = name || modularAPIs._DEFAULT_ENTRY_NAME;
173
+ if (!contains(apps, name)) {
174
+ throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
175
+ }
176
+ return apps[name];
177
+ }
178
+ // @ts-ignore
179
+ app['App'] = firebaseAppImpl;
180
+ /**
181
+ * Create a new App instance (name must be unique).
182
+ *
183
+ * This function is idempotent. It can be called more than once and return the same instance using the same options and config.
184
+ */
185
+ function initializeAppCompat(options, rawConfig = {}) {
186
+ const app = modularAPIs.initializeApp(options, rawConfig);
187
+ if (contains(apps, app.name)) {
188
+ return apps[app.name];
189
+ }
190
+ const appCompat = new firebaseAppImpl(app, namespace);
191
+ apps[app.name] = appCompat;
192
+ return appCompat;
193
+ }
194
+ /*
195
+ * Return an array of all the non-deleted FirebaseApps.
196
+ */
197
+ function getApps() {
198
+ // Make a copy so caller cannot mutate the apps list.
199
+ return Object.keys(apps).map(name => apps[name]);
200
+ }
201
+ function registerComponentCompat(component) {
202
+ const componentName = component.name;
203
+ const componentNameWithoutCompat = componentName.replace('-compat', '');
204
+ if (modularAPIs._registerComponent(component) &&
205
+ component.type === "PUBLIC" /* ComponentType.PUBLIC */) {
206
+ // create service namespace for public components
207
+ // The Service namespace is an accessor function ...
208
+ const serviceNamespace = (appArg = app()) => {
209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
210
+ if (typeof appArg[componentNameWithoutCompat] !== 'function') {
211
+ // Invalid argument.
212
+ // This happens in the following case: firebase.storage('gs:/')
213
+ throw ERROR_FACTORY.create("invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */, {
214
+ appName: componentName
215
+ });
216
+ }
217
+ // Forward service instance lookup to the FirebaseApp.
218
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
219
+ return appArg[componentNameWithoutCompat]();
220
+ };
221
+ // ... and a container for service-level properties.
222
+ if (component.serviceProps !== undefined) {
223
+ deepExtend(serviceNamespace, component.serviceProps);
224
+ }
225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
+ namespace[componentNameWithoutCompat] = serviceNamespace;
227
+ // Patch the FirebaseAppImpl prototype
228
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
229
+ firebaseAppImpl.prototype[componentNameWithoutCompat] =
230
+ // TODO: The eslint disable can be removed and the 'ignoreRestArgs'
231
+ // option added to the no-explicit-any rule when ESlint releases it.
232
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
+ function (...args) {
234
+ const serviceFxn = this._getService.bind(this, componentName);
235
+ return serviceFxn.apply(this, component.multipleInstances ? args : []);
236
+ };
237
+ }
238
+ return component.type === "PUBLIC" /* ComponentType.PUBLIC */
239
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
+ namespace[componentNameWithoutCompat]
241
+ : null;
242
+ }
243
+ // Map the requested service to a registered service name
244
+ // (used to map auth to serverAuth service when needed).
245
+ function useAsService(app, name) {
246
+ if (name === 'serverAuth') {
247
+ return null;
248
+ }
249
+ const useService = name;
250
+ return useService;
251
+ }
252
+ return namespace;
253
253
  }
254
254
 
255
- /**
256
- * @license
257
- * Copyright 2019 Google LLC
258
- *
259
- * Licensed under the Apache License, Version 2.0 (the "License");
260
- * you may not use this file except in compliance with the License.
261
- * You may obtain a copy of the License at
262
- *
263
- * http://www.apache.org/licenses/LICENSE-2.0
264
- *
265
- * Unless required by applicable law or agreed to in writing, software
266
- * distributed under the License is distributed on an "AS IS" BASIS,
267
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
- * See the License for the specific language governing permissions and
269
- * limitations under the License.
270
- */
271
- function createFirebaseNamespaceLite() {
272
- const namespace = createFirebaseNamespaceCore(FirebaseAppLiteImpl);
273
- namespace.SDK_VERSION = `${namespace.SDK_VERSION}_LITE`;
274
- const registerComponent = namespace.INTERNAL.registerComponent;
275
- namespace.INTERNAL.registerComponent = registerComponentForLite;
276
- /**
277
- * This is a special implementation, so it only works with performance.
278
- * only allow performance SDK to register.
279
- */
280
- function registerComponentForLite(
281
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
- component) {
283
- // only allow performance to register with firebase lite
284
- if (component.type === "PUBLIC" /* ComponentType.PUBLIC */ &&
285
- !component.name.includes('performance') &&
286
- !component.name.includes('installations')) {
287
- throw Error(`${name} cannot register with the standalone perf instance`);
288
- }
289
- return registerComponent(component);
290
- }
291
- return namespace;
255
+ /**
256
+ * @license
257
+ * Copyright 2019 Google LLC
258
+ *
259
+ * Licensed under the Apache License, Version 2.0 (the "License");
260
+ * you may not use this file except in compliance with the License.
261
+ * You may obtain a copy of the License at
262
+ *
263
+ * http://www.apache.org/licenses/LICENSE-2.0
264
+ *
265
+ * Unless required by applicable law or agreed to in writing, software
266
+ * distributed under the License is distributed on an "AS IS" BASIS,
267
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
+ * See the License for the specific language governing permissions and
269
+ * limitations under the License.
270
+ */
271
+ function createFirebaseNamespaceLite() {
272
+ const namespace = createFirebaseNamespaceCore(FirebaseAppLiteImpl);
273
+ namespace.SDK_VERSION = `${namespace.SDK_VERSION}_LITE`;
274
+ const registerComponent = namespace.INTERNAL.registerComponent;
275
+ namespace.INTERNAL.registerComponent = registerComponentForLite;
276
+ /**
277
+ * This is a special implementation, so it only works with performance.
278
+ * only allow performance SDK to register.
279
+ */
280
+ function registerComponentForLite(
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
+ component) {
283
+ // only allow performance to register with firebase lite
284
+ if (component.type === "PUBLIC" /* ComponentType.PUBLIC */ &&
285
+ !component.name.includes('performance') &&
286
+ !component.name.includes('installations')) {
287
+ throw Error(`${name} cannot register with the standalone perf instance`);
288
+ }
289
+ return registerComponent(component);
290
+ }
291
+ return namespace;
292
292
  }
293
293
 
294
294
  const name$1 = "@firebase/app-compat";
295
- const version = "0.2.45";
295
+ const version = "0.2.46";
296
296
 
297
- /**
298
- * @license
299
- * Copyright 2019 Google LLC
300
- *
301
- * Licensed under the Apache License, Version 2.0 (the "License");
302
- * you may not use this file except in compliance with the License.
303
- * You may obtain a copy of the License at
304
- *
305
- * http://www.apache.org/licenses/LICENSE-2.0
306
- *
307
- * Unless required by applicable law or agreed to in writing, software
308
- * distributed under the License is distributed on an "AS IS" BASIS,
309
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310
- * See the License for the specific language governing permissions and
311
- * limitations under the License.
312
- */
313
- function registerCoreComponents(variant) {
314
- // Register `app` package.
315
- registerVersion(name$1, version, variant);
297
+ /**
298
+ * @license
299
+ * Copyright 2019 Google LLC
300
+ *
301
+ * Licensed under the Apache License, Version 2.0 (the "License");
302
+ * you may not use this file except in compliance with the License.
303
+ * You may obtain a copy of the License at
304
+ *
305
+ * http://www.apache.org/licenses/LICENSE-2.0
306
+ *
307
+ * Unless required by applicable law or agreed to in writing, software
308
+ * distributed under the License is distributed on an "AS IS" BASIS,
309
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310
+ * See the License for the specific language governing permissions and
311
+ * limitations under the License.
312
+ */
313
+ function registerCoreComponents(variant) {
314
+ // Register `app` package.
315
+ registerVersion(name$1, version, variant);
316
316
  }
317
317
 
318
- /**
319
- * @license
320
- * Copyright 2019 Google LLC
321
- *
322
- * Licensed under the Apache License, Version 2.0 (the "License");
323
- * you may not use this file except in compliance with the License.
324
- * You may obtain a copy of the License at
325
- *
326
- * http://www.apache.org/licenses/LICENSE-2.0
327
- *
328
- * Unless required by applicable law or agreed to in writing, software
329
- * distributed under the License is distributed on an "AS IS" BASIS,
330
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
331
- * See the License for the specific language governing permissions and
332
- * limitations under the License.
333
- */
334
- const firebase = createFirebaseNamespaceLite();
318
+ /**
319
+ * @license
320
+ * Copyright 2019 Google LLC
321
+ *
322
+ * Licensed under the Apache License, Version 2.0 (the "License");
323
+ * you may not use this file except in compliance with the License.
324
+ * You may obtain a copy of the License at
325
+ *
326
+ * http://www.apache.org/licenses/LICENSE-2.0
327
+ *
328
+ * Unless required by applicable law or agreed to in writing, software
329
+ * distributed under the License is distributed on an "AS IS" BASIS,
330
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
331
+ * See the License for the specific language governing permissions and
332
+ * limitations under the License.
333
+ */
334
+ const firebase = createFirebaseNamespaceLite();
335
335
  registerCoreComponents('lite');
336
336
 
337
337
  export { firebase as default };