@firebase/app-compat
Advanced tools
Comparing version 0.0.900-exp.555fe23c5 to 0.0.900-exp.57f19127c
@@ -54,16 +54,16 @@ 'use strict'; | ||
var FirebaseAppImpl = /** @class */ (function () { | ||
function FirebaseAppImpl(app, firebase) { | ||
function FirebaseAppImpl(_delegate, firebase) { | ||
var _this = this; | ||
this.app = app; | ||
this._delegate = _delegate; | ||
this.firebase = firebase; | ||
// add itself to container | ||
modularAPIs._addComponent(app, new component.Component('app-compat', function () { return _this; }, "PUBLIC" /* PUBLIC */)); | ||
this.container = app.container; | ||
modularAPIs._addComponent(_delegate, new component.Component('app-compat', function () { return _this; }, "PUBLIC" /* PUBLIC */)); | ||
this.container = _delegate.container; | ||
} | ||
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", { | ||
get: function () { | ||
return this.app.automaticDataCollectionEnabled; | ||
return this._delegate.automaticDataCollectionEnabled; | ||
}, | ||
set: function (val) { | ||
this.app.automaticDataCollectionEnabled = val; | ||
this._delegate.automaticDataCollectionEnabled = val; | ||
}, | ||
@@ -75,3 +75,3 @@ enumerable: false, | ||
get: function () { | ||
return this.app.name; | ||
return this._delegate.name; | ||
}, | ||
@@ -83,3 +83,3 @@ enumerable: false, | ||
get: function () { | ||
return this.app.options; | ||
return this._delegate.options; | ||
}, | ||
@@ -92,7 +92,7 @@ enumerable: false, | ||
return new Promise(function (resolve) { | ||
_this.app.checkDestroyed(); | ||
_this._delegate.checkDestroyed(); | ||
resolve(); | ||
}).then(function () { | ||
_this.firebase.INTERNAL.removeApp(_this.name); | ||
return modularAPIs.deleteApp(_this.app); | ||
return modularAPIs.deleteApp(_this._delegate); | ||
}); | ||
@@ -115,6 +115,13 @@ }; | ||
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { | ||
var _a; | ||
if (instanceIdentifier === void 0) { instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME; } | ||
this.app.checkDestroyed(); | ||
this._delegate.checkDestroyed(); | ||
// Initialize instance if InstatiationMode is `EXPLICIT`. | ||
var provider = this._delegate.container.getProvider(name); | ||
if (!provider.isInitialized() && | ||
((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* EXPLICIT */) { | ||
provider.initialize(); | ||
} | ||
// getImmediate will always succeed because _getService is only called for registered components. | ||
return this.app.container.getProvider(name).getImmediate({ | ||
return provider.getImmediate({ | ||
identifier: instanceIdentifier | ||
@@ -135,3 +142,3 @@ }); | ||
if (instanceIdentifier === void 0) { instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME; } | ||
this.app.container | ||
this._delegate.container | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -146,6 +153,6 @@ .getProvider(name) | ||
FirebaseAppImpl.prototype._addComponent = function (component) { | ||
modularAPIs._addComponent(this.app, component); | ||
modularAPIs._addComponent(this._delegate, component); | ||
}; | ||
FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) { | ||
modularAPIs._addOrOverwriteComponent(this.app, component); | ||
modularAPIs._addOrOverwriteComponent(this._delegate, component); | ||
}; | ||
@@ -296,2 +303,3 @@ FirebaseAppImpl.prototype.toJSON = function () { | ||
var componentName = component.name; | ||
var componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
if (modularAPIs._registerComponent(component) && | ||
@@ -304,3 +312,3 @@ component.type === "PUBLIC" /* PUBLIC */) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (typeof appArg[componentName] !== 'function') { | ||
if (typeof appArg[componentNameWithoutCompat] !== 'function') { | ||
// Invalid argument. | ||
@@ -314,3 +322,3 @@ // This happens in the following case: firebase.storage('gs:/') | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return appArg[componentName](); | ||
return appArg[componentNameWithoutCompat](); | ||
}; | ||
@@ -322,6 +330,6 @@ // ... and a container for service-level properties. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] = serviceNamespace; | ||
namespace[componentNameWithoutCompat] = serviceNamespace; | ||
// Patch the FirebaseAppImpl prototype | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
firebaseAppImpl.prototype[componentName] = | ||
firebaseAppImpl.prototype[componentNameWithoutCompat] = | ||
// TODO: The eslint disable can be removed and the 'ignoreRestArgs' | ||
@@ -341,3 +349,3 @@ // option added to the no-explicit-any rule when ESlint releases it. | ||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] | ||
namespace[componentNameWithoutCompat] | ||
: null; | ||
@@ -418,3 +426,3 @@ } | ||
var name = "@firebase/app-compat"; | ||
var version = "0.0.900"; | ||
var version = "0.0.900-exp.57f19127c"; | ||
@@ -421,0 +429,0 @@ /** |
@@ -28,28 +28,28 @@ import { ErrorFactory, contains, deepExtend, createSubscribe, isBrowser } from '@firebase/util'; | ||
class FirebaseAppImpl { | ||
constructor(app, firebase) { | ||
this.app = app; | ||
constructor(_delegate, firebase) { | ||
this._delegate = _delegate; | ||
this.firebase = firebase; | ||
// add itself to container | ||
_addComponent(app, new Component('app-compat', () => this, "PUBLIC" /* PUBLIC */)); | ||
this.container = app.container; | ||
_addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* PUBLIC */)); | ||
this.container = _delegate.container; | ||
} | ||
get automaticDataCollectionEnabled() { | ||
return this.app.automaticDataCollectionEnabled; | ||
return this._delegate.automaticDataCollectionEnabled; | ||
} | ||
set automaticDataCollectionEnabled(val) { | ||
this.app.automaticDataCollectionEnabled = val; | ||
this._delegate.automaticDataCollectionEnabled = val; | ||
} | ||
get name() { | ||
return this.app.name; | ||
return this._delegate.name; | ||
} | ||
get options() { | ||
return this.app.options; | ||
return this._delegate.options; | ||
} | ||
delete() { | ||
return new Promise(resolve => { | ||
this.app.checkDestroyed(); | ||
this._delegate.checkDestroyed(); | ||
resolve(); | ||
}).then(() => { | ||
this.firebase.INTERNAL.removeApp(this.name); | ||
return deleteApp(this.app); | ||
return deleteApp(this._delegate); | ||
}); | ||
@@ -72,5 +72,12 @@ } | ||
_getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) { | ||
this.app.checkDestroyed(); | ||
var _a; | ||
this._delegate.checkDestroyed(); | ||
// Initialize instance if InstatiationMode is `EXPLICIT`. | ||
const provider = this._delegate.container.getProvider(name); | ||
if (!provider.isInitialized() && | ||
((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* EXPLICIT */) { | ||
provider.initialize(); | ||
} | ||
// getImmediate will always succeed because _getService is only called for registered components. | ||
return this.app.container.getProvider(name).getImmediate({ | ||
return provider.getImmediate({ | ||
identifier: instanceIdentifier | ||
@@ -90,3 +97,3 @@ }); | ||
_removeServiceInstance(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) { | ||
this.app.container | ||
this._delegate.container | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -101,6 +108,6 @@ .getProvider(name) | ||
_addComponent(component) { | ||
_addComponent(this.app, component); | ||
_addComponent(this._delegate, component); | ||
} | ||
_addOrOverwriteComponent(component) { | ||
_addOrOverwriteComponent(this.app, component); | ||
_addOrOverwriteComponent(this._delegate, component); | ||
} | ||
@@ -248,2 +255,3 @@ toJSON() { | ||
const componentName = component.name; | ||
const componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
if (_registerComponent(component) && | ||
@@ -255,3 +263,3 @@ component.type === "PUBLIC" /* PUBLIC */) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (typeof appArg[componentName] !== 'function') { | ||
if (typeof appArg[componentNameWithoutCompat] !== 'function') { | ||
// Invalid argument. | ||
@@ -265,3 +273,3 @@ // This happens in the following case: firebase.storage('gs:/') | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return appArg[componentName](); | ||
return appArg[componentNameWithoutCompat](); | ||
}; | ||
@@ -273,6 +281,6 @@ // ... and a container for service-level properties. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] = serviceNamespace; | ||
namespace[componentNameWithoutCompat] = serviceNamespace; | ||
// Patch the FirebaseAppImpl prototype | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
firebaseAppImpl.prototype[componentName] = | ||
firebaseAppImpl.prototype[componentNameWithoutCompat] = | ||
// TODO: The eslint disable can be removed and the 'ignoreRestArgs' | ||
@@ -288,3 +296,3 @@ // option added to the no-explicit-any rule when ESlint releases it. | ||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] | ||
namespace[componentNameWithoutCompat] | ||
: null; | ||
@@ -365,3 +373,3 @@ } | ||
const name = "@firebase/app-compat"; | ||
const version = "0.0.900"; | ||
const version = "0.0.900-exp.57f19127c"; | ||
@@ -368,0 +376,0 @@ /** |
@@ -29,16 +29,16 @@ import { ErrorFactory, contains, deepExtend, createSubscribe, isBrowser } from '@firebase/util'; | ||
var FirebaseAppImpl = /** @class */ (function () { | ||
function FirebaseAppImpl(app, firebase) { | ||
function FirebaseAppImpl(_delegate, firebase) { | ||
var _this = this; | ||
this.app = app; | ||
this._delegate = _delegate; | ||
this.firebase = firebase; | ||
// add itself to container | ||
_addComponent(app, new Component('app-compat', function () { return _this; }, "PUBLIC" /* PUBLIC */)); | ||
this.container = app.container; | ||
_addComponent(_delegate, new Component('app-compat', function () { return _this; }, "PUBLIC" /* PUBLIC */)); | ||
this.container = _delegate.container; | ||
} | ||
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", { | ||
get: function () { | ||
return this.app.automaticDataCollectionEnabled; | ||
return this._delegate.automaticDataCollectionEnabled; | ||
}, | ||
set: function (val) { | ||
this.app.automaticDataCollectionEnabled = val; | ||
this._delegate.automaticDataCollectionEnabled = val; | ||
}, | ||
@@ -50,3 +50,3 @@ enumerable: false, | ||
get: function () { | ||
return this.app.name; | ||
return this._delegate.name; | ||
}, | ||
@@ -58,3 +58,3 @@ enumerable: false, | ||
get: function () { | ||
return this.app.options; | ||
return this._delegate.options; | ||
}, | ||
@@ -67,7 +67,7 @@ enumerable: false, | ||
return new Promise(function (resolve) { | ||
_this.app.checkDestroyed(); | ||
_this._delegate.checkDestroyed(); | ||
resolve(); | ||
}).then(function () { | ||
_this.firebase.INTERNAL.removeApp(_this.name); | ||
return deleteApp(_this.app); | ||
return deleteApp(_this._delegate); | ||
}); | ||
@@ -90,6 +90,13 @@ }; | ||
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { | ||
var _a; | ||
if (instanceIdentifier === void 0) { instanceIdentifier = _DEFAULT_ENTRY_NAME; } | ||
this.app.checkDestroyed(); | ||
this._delegate.checkDestroyed(); | ||
// Initialize instance if InstatiationMode is `EXPLICIT`. | ||
var provider = this._delegate.container.getProvider(name); | ||
if (!provider.isInitialized() && | ||
((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* EXPLICIT */) { | ||
provider.initialize(); | ||
} | ||
// getImmediate will always succeed because _getService is only called for registered components. | ||
return this.app.container.getProvider(name).getImmediate({ | ||
return provider.getImmediate({ | ||
identifier: instanceIdentifier | ||
@@ -110,3 +117,3 @@ }); | ||
if (instanceIdentifier === void 0) { instanceIdentifier = _DEFAULT_ENTRY_NAME; } | ||
this.app.container | ||
this._delegate.container | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -121,6 +128,6 @@ .getProvider(name) | ||
FirebaseAppImpl.prototype._addComponent = function (component) { | ||
_addComponent(this.app, component); | ||
_addComponent(this._delegate, component); | ||
}; | ||
FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) { | ||
_addOrOverwriteComponent(this.app, component); | ||
_addOrOverwriteComponent(this._delegate, component); | ||
}; | ||
@@ -271,2 +278,3 @@ FirebaseAppImpl.prototype.toJSON = function () { | ||
var componentName = component.name; | ||
var componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
if (_registerComponent(component) && | ||
@@ -279,3 +287,3 @@ component.type === "PUBLIC" /* PUBLIC */) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (typeof appArg[componentName] !== 'function') { | ||
if (typeof appArg[componentNameWithoutCompat] !== 'function') { | ||
// Invalid argument. | ||
@@ -289,3 +297,3 @@ // This happens in the following case: firebase.storage('gs:/') | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return appArg[componentName](); | ||
return appArg[componentNameWithoutCompat](); | ||
}; | ||
@@ -297,6 +305,6 @@ // ... and a container for service-level properties. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] = serviceNamespace; | ||
namespace[componentNameWithoutCompat] = serviceNamespace; | ||
// Patch the FirebaseAppImpl prototype | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
firebaseAppImpl.prototype[componentName] = | ||
firebaseAppImpl.prototype[componentNameWithoutCompat] = | ||
// TODO: The eslint disable can be removed and the 'ignoreRestArgs' | ||
@@ -316,3 +324,3 @@ // option added to the no-explicit-any rule when ESlint releases it. | ||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] | ||
namespace[componentNameWithoutCompat] | ||
: null; | ||
@@ -393,3 +401,3 @@ } | ||
var name = "@firebase/app-compat"; | ||
var version = "0.0.900"; | ||
var version = "0.0.900-exp.57f19127c"; | ||
@@ -396,0 +404,0 @@ /** |
import * as modularAPIs from '@firebase/app'; | ||
import { deleteApp, _addComponent, _DEFAULT_ENTRY_NAME, registerVersion, setLogLevel, onLog, SDK_VERSION, initializeApp, _registerComponent } from '@firebase/app'; | ||
import { _addComponent, deleteApp, _DEFAULT_ENTRY_NAME, registerVersion, setLogLevel, onLog, SDK_VERSION, initializeApp, _registerComponent } from '@firebase/app'; | ||
import { Component } from '@firebase/component'; | ||
@@ -26,38 +26,25 @@ import { ErrorFactory, contains, deepExtend } from '@firebase/util'; | ||
*/ | ||
var FirebaseAppLiteImpl = /** @class */ (function () { | ||
function FirebaseAppLiteImpl(app, firebase) { | ||
var _this = this; | ||
this.app = app; | ||
class FirebaseAppLiteImpl { | ||
constructor(_delegate, firebase) { | ||
this._delegate = _delegate; | ||
this.firebase = firebase; | ||
// add itself to container | ||
_addComponent(app, new Component('app-compat', function () { return _this; }, "PUBLIC" /* PUBLIC */)); | ||
_addComponent(_delegate, new Component('app-compat', () => this, "PUBLIC" /* PUBLIC */)); | ||
} | ||
Object.defineProperty(FirebaseAppLiteImpl.prototype, "automaticDataCollectionEnabled", { | ||
get: function () { | ||
return this.app.automaticDataCollectionEnabled; | ||
}, | ||
set: function (val) { | ||
this.automaticDataCollectionEnabled = val; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FirebaseAppLiteImpl.prototype, "name", { | ||
get: function () { | ||
return this.app.name; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FirebaseAppLiteImpl.prototype, "options", { | ||
get: function () { | ||
return this.app.options; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
FirebaseAppLiteImpl.prototype.delete = function () { | ||
get automaticDataCollectionEnabled() { | ||
return this._delegate.automaticDataCollectionEnabled; | ||
} | ||
set automaticDataCollectionEnabled(val) { | ||
this.automaticDataCollectionEnabled = val; | ||
} | ||
get name() { | ||
return this._delegate.name; | ||
} | ||
get options() { | ||
return this._delegate.options; | ||
} | ||
delete() { | ||
this.firebase.INTERNAL.removeApp(this.name); | ||
return deleteApp(this.app); | ||
}; | ||
return deleteApp(this._delegate); | ||
} | ||
/** | ||
@@ -77,12 +64,10 @@ * Return a service instance associated with this app (creating it | ||
*/ | ||
FirebaseAppLiteImpl.prototype._getService = function (name, instanceIdentifier) { | ||
if (instanceIdentifier === void 0) { instanceIdentifier = _DEFAULT_ENTRY_NAME; } | ||
this.app.checkDestroyed(); | ||
_getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) { | ||
this._delegate.checkDestroyed(); | ||
// getImmediate will always succeed because _getService is only called for registered components. | ||
return this.app.container.getProvider(name).getImmediate({ | ||
return this._delegate.container.getProvider(name).getImmediate({ | ||
identifier: instanceIdentifier | ||
}); | ||
}; | ||
return FirebaseAppLiteImpl; | ||
}()); | ||
} | ||
} | ||
@@ -105,10 +90,9 @@ /** | ||
*/ | ||
var _a; | ||
var ERRORS = (_a = {}, | ||
_a["no-app" /* NO_APP */] = "No Firebase App '{$appName}' has been created - " + | ||
const ERRORS = { | ||
["no-app" /* NO_APP */]: "No Firebase App '{$appName}' has been created - " + | ||
'call Firebase App.initializeApp()', | ||
_a["invalid-app-argument" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' + | ||
'Firebase App instance.', | ||
_a); | ||
var ERROR_FACTORY = new ErrorFactory('app-compat', 'Firebase', ERRORS); | ||
["invalid-app-argument" /* INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' + | ||
'Firebase App instance.' | ||
}; | ||
const ERROR_FACTORY = new ErrorFactory('app-compat', 'Firebase', ERRORS); | ||
@@ -139,7 +123,7 @@ /** | ||
function createFirebaseNamespaceCore(firebaseAppImpl) { | ||
var apps = {}; | ||
const apps = {}; | ||
// // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
// const components = new Map<string, Component<any>>(); | ||
// A namespace is a plain JavaScript Object. | ||
var namespace = { | ||
const namespace = { | ||
// Hack to prevent Babel from modifying the object returned | ||
@@ -151,3 +135,3 @@ // as the firebase namespace. | ||
// @ts-ignore | ||
app: app, | ||
app, | ||
registerVersion: registerVersion, | ||
@@ -161,5 +145,5 @@ setLogLevel: setLogLevel, | ||
registerComponent: registerComponentCompat, | ||
removeApp: removeApp, | ||
useAsService: useAsService, | ||
modularAPIs: modularAPIs | ||
removeApp, | ||
useAsService, | ||
modularAPIs | ||
} | ||
@@ -205,6 +189,5 @@ }; | ||
*/ | ||
function initializeAppCompat(options, rawConfig) { | ||
if (rawConfig === void 0) { rawConfig = {}; } | ||
var app = initializeApp(options, rawConfig); | ||
var appCompat = new firebaseAppImpl(app, namespace); | ||
function initializeAppCompat(options, rawConfig = {}) { | ||
const app = initializeApp(options, rawConfig); | ||
const appCompat = new firebaseAppImpl(app, namespace); | ||
apps[app.name] = appCompat; | ||
@@ -218,6 +201,7 @@ return appCompat; | ||
// Make a copy so caller cannot mutate the apps list. | ||
return Object.keys(apps).map(function (name) { return apps[name]; }); | ||
return Object.keys(apps).map(name => apps[name]); | ||
} | ||
function registerComponentCompat(component) { | ||
var componentName = component.name; | ||
const componentName = component.name; | ||
const componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
if (_registerComponent(component) && | ||
@@ -227,6 +211,5 @@ component.type === "PUBLIC" /* PUBLIC */) { | ||
// The Service namespace is an accessor function ... | ||
var serviceNamespace = function (appArg) { | ||
if (appArg === void 0) { appArg = app(); } | ||
const serviceNamespace = (appArg = app()) => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (typeof appArg[componentName] !== 'function') { | ||
if (typeof appArg[componentNameWithoutCompat] !== 'function') { | ||
// Invalid argument. | ||
@@ -240,3 +223,3 @@ // This happens in the following case: firebase.storage('gs:/') | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return appArg[componentName](); | ||
return appArg[componentNameWithoutCompat](); | ||
}; | ||
@@ -248,15 +231,11 @@ // ... and a container for service-level properties. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] = serviceNamespace; | ||
namespace[componentNameWithoutCompat] = serviceNamespace; | ||
// Patch the FirebaseAppImpl prototype | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
firebaseAppImpl.prototype[componentName] = | ||
firebaseAppImpl.prototype[componentNameWithoutCompat] = | ||
// TODO: The eslint disable can be removed and the 'ignoreRestArgs' | ||
// option added to the no-explicit-any rule when ESlint releases it. | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
var serviceFxn = this._getService.bind(this, componentName); | ||
function (...args) { | ||
const serviceFxn = this._getService.bind(this, componentName); | ||
return serviceFxn.apply(this, component.multipleInstances ? args : []); | ||
@@ -267,3 +246,3 @@ }; | ||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
namespace[componentName] | ||
namespace[componentNameWithoutCompat] | ||
: null; | ||
@@ -277,3 +256,3 @@ } | ||
} | ||
var useService = name; | ||
const useService = name; | ||
return useService; | ||
@@ -301,5 +280,5 @@ } | ||
function createFirebaseNamespaceLite() { | ||
var namespace = createFirebaseNamespaceCore(FirebaseAppLiteImpl); | ||
namespace.SDK_VERSION = namespace.SDK_VERSION + "_LITE"; | ||
var registerComponent = namespace.INTERNAL.registerComponent; | ||
const namespace = createFirebaseNamespaceCore(FirebaseAppLiteImpl); | ||
namespace.SDK_VERSION = `${namespace.SDK_VERSION}_LITE`; | ||
const registerComponent = namespace.INTERNAL.registerComponent; | ||
namespace.INTERNAL.registerComponent = registerComponentForLite; | ||
@@ -315,5 +294,5 @@ /** | ||
if (component.type === "PUBLIC" /* PUBLIC */ && | ||
component.name !== 'performance' && | ||
component.name !== 'installations') { | ||
throw Error(name + " cannot register with the standalone perf instance"); | ||
!component.name.includes('performance') && | ||
!component.name.includes('installations')) { | ||
throw Error(`${name} cannot register with the standalone perf instance`); | ||
} | ||
@@ -325,4 +304,4 @@ return registerComponent(component); | ||
var name$1 = "@firebase/app-compat"; | ||
var version = "0.0.900"; | ||
const name$1 = "@firebase/app-compat"; | ||
const version = "0.0.900-exp.57f19127c"; | ||
@@ -366,3 +345,3 @@ /** | ||
*/ | ||
var firebase = createFirebaseNamespaceLite(); | ||
const firebase = createFirebaseNamespaceLite(); | ||
registerCoreComponents('lite'); | ||
@@ -369,0 +348,0 @@ |
@@ -17,6 +17,26 @@ /** | ||
*/ | ||
import { FirebaseApp, FirebaseOptions } from './public-types'; | ||
import { FirebaseOptions } from './public-types'; | ||
import { Component } from '@firebase/component'; | ||
import { _FirebaseAppInternal as _FirebaseAppExp } from "@firebase/app"; | ||
import { _FirebaseService, _FirebaseNamespace } from './types'; | ||
import { Compat } from '@firebase/util'; | ||
export interface _FirebaseApp { | ||
/** | ||
* The (read-only) name (identifier) for this App. '[DEFAULT]' is the default | ||
* App. | ||
*/ | ||
name: string; | ||
/** | ||
* The (read-only) configuration options from the app initialization. | ||
*/ | ||
options: FirebaseOptions; | ||
/** | ||
* The settable config flag for GDPR opt-in/opt-out | ||
*/ | ||
automaticDataCollectionEnabled: boolean; | ||
/** | ||
* Make the given App unusable and free resources. | ||
*/ | ||
delete(): Promise<void>; | ||
} | ||
/** | ||
@@ -26,7 +46,7 @@ * Global context object for a collection of services using | ||
*/ | ||
export declare class FirebaseAppImpl implements FirebaseApp { | ||
private readonly app; | ||
export declare class FirebaseAppImpl implements Compat<_FirebaseAppExp>, _FirebaseApp { | ||
readonly _delegate: _FirebaseAppExp; | ||
private readonly firebase; | ||
private container; | ||
constructor(app: _FirebaseAppExp, firebase: _FirebaseNamespace); | ||
constructor(_delegate: _FirebaseAppExp, firebase: _FirebaseNamespace); | ||
get automaticDataCollectionEnabled(): boolean; | ||
@@ -33,0 +53,0 @@ set automaticDataCollectionEnabled(val: boolean); |
@@ -21,2 +21,2 @@ /** | ||
export { _FirebaseNamespace, _FirebaseService } from './types'; | ||
export { FirebaseApp } from './public-types'; | ||
export { FirebaseApp, FirebaseNamespace } from './public-types'; |
@@ -20,2 +20,3 @@ /** | ||
import { _FirebaseAppInternal as FirebaseAppExp } from "@firebase/app"; | ||
import { Compat } from '@firebase/util'; | ||
/** | ||
@@ -25,6 +26,6 @@ * Global context object for a collection of services using | ||
*/ | ||
export declare class FirebaseAppLiteImpl implements FirebaseApp { | ||
private readonly app; | ||
export declare class FirebaseAppLiteImpl implements FirebaseApp, Compat<FirebaseAppExp> { | ||
readonly _delegate: FirebaseAppExp; | ||
private readonly firebase; | ||
constructor(app: FirebaseAppExp, firebase: _FirebaseNamespace); | ||
constructor(_delegate: FirebaseAppExp, firebase: _FirebaseNamespace); | ||
get automaticDataCollectionEnabled(): boolean; | ||
@@ -31,0 +32,0 @@ set automaticDataCollectionEnabled(val: boolean); |
@@ -18,3 +18,3 @@ /** | ||
import { LogCallback, LogLevelString, LogOptions } from '@firebase/logger'; | ||
import { FirebaseAppImpl } from './firebaseApp'; | ||
import { FirebaseAppImpl, _FirebaseApp } from './firebaseApp'; | ||
export interface FirebaseOptions { | ||
@@ -34,20 +34,13 @@ apiKey?: string; | ||
} | ||
export interface FirebaseApp { | ||
/** | ||
* The (read-only) name (identifier) for this App. '[DEFAULT]' is the default | ||
* App. | ||
*/ | ||
name: string; | ||
/** | ||
* The (read-only) configuration options from the app initialization. | ||
*/ | ||
options: FirebaseOptions; | ||
/** | ||
* The settable config flag for GDPR opt-in/opt-out | ||
*/ | ||
automaticDataCollectionEnabled: boolean; | ||
/** | ||
* Make the given App unusable and free resources. | ||
*/ | ||
delete(): Promise<void>; | ||
/** | ||
* This interface will be enhanced by other products by adding e.g. firestore(), messaging() methods. | ||
* As a result, FirebaseAppImpl can't directly implement it, otherwise there will be typings errors: | ||
* | ||
* For example, "Class 'FirebaseAppImpl' incorrectly implements interface 'FirebaseApp'. | ||
* Property 'installations' is missing in type 'FirebaseAppImpl' but required in type 'FirebaseApp'" | ||
* | ||
* To workaround this issue, we defined a _FirebaseApp interface which is implemented by FirebaseAppImpl | ||
* and let FirebaseApp extends it. | ||
*/ | ||
export interface FirebaseApp extends _FirebaseApp { | ||
} | ||
@@ -54,0 +47,0 @@ export interface FirebaseNamespace { |
@@ -22,3 +22,4 @@ /** | ||
import { FirebaseApp, FirebaseNamespace } from './public-types'; | ||
import { Component, ComponentContainer } from '@firebase/component'; | ||
import { Compat } from '@firebase/util'; | ||
import { Component, ComponentContainer, Name } from '@firebase/component'; | ||
export interface FirebaseServiceInternals { | ||
@@ -31,3 +32,3 @@ /** | ||
} | ||
export interface _FirebaseService { | ||
export interface _FirebaseService extends Compat<unknown> { | ||
app: FirebaseApp; | ||
@@ -44,4 +45,4 @@ INTERNAL?: FirebaseServiceInternals; | ||
container: ComponentContainer; | ||
_addComponent(component: Component): void; | ||
_addOrOverwriteComponent(component: Component): void; | ||
_addComponent<T extends Name>(component: Component<T>): void; | ||
_addOrOverwriteComponent<T extends Name>(component: Component<T>): void; | ||
_removeServiceInstance(name: string, instanceIdentifier?: string): void; | ||
@@ -65,3 +66,3 @@ } | ||
*/ | ||
registerComponent(component: Component): FirebaseServiceNamespace<_FirebaseService> | null; | ||
registerComponent<T extends Name>(component: Component<T>): FirebaseServiceNamespace<_FirebaseService> | null; | ||
/** | ||
@@ -68,0 +69,0 @@ * Internal API to remove an app from the list of registered apps. |
@@ -23,2 +23,3 @@ /** | ||
instanceIdentifier?: string | undefined; | ||
readonly _delegate: {}; | ||
constructor(app_: FirebaseApp, instanceIdentifier?: string | undefined); | ||
@@ -25,0 +26,0 @@ get app(): FirebaseApp; |
{ | ||
"name": "@firebase/app-compat", | ||
"version": "0.0.900-exp.555fe23c5", | ||
"version": "0.0.900-exp.57f19127c", | ||
"description": "The primary entrypoint to the Firebase JS SDK", | ||
@@ -8,7 +8,6 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"main": "dist/index.cjs.js", | ||
"browser": "dist/index.esm5.js", | ||
"module": "dist/index.esm5.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"browser": "dist/index.esm2017.js", | ||
"module": "dist/index.esm2017.js", | ||
"lite": "dist/index.lite.js", | ||
"lite-esm2017": "dist/index.lite.esm2017.js", | ||
"lite-esm5": "dist/index.lite.esm5.js", | ||
"files": [ | ||
@@ -33,7 +32,7 @@ "dist" | ||
"dependencies": { | ||
"@firebase/app": "0.0.900-exp.555fe23c5", | ||
"@firebase/util": "0.3.4", | ||
"@firebase/app": "0.0.900-exp.57f19127c", | ||
"@firebase/util": "1.1.0", | ||
"@firebase/logger": "0.2.6", | ||
"@firebase/component": "0.2.0", | ||
"tslib": "^2.0.0", | ||
"@firebase/component": "0.5.3", | ||
"tslib": "^2.1.0", | ||
"dom-storage": "2.1.0", | ||
@@ -64,3 +63,4 @@ "xmlhttprequest": "1.8.0" | ||
}, | ||
"esm5": "dist/index.esm5.js", | ||
"peerDependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
217590
2517
+ Added@firebase/app@0.0.900-exp.57f19127c(transitive)
+ Added@firebase/component@0.5.3(transitive)
+ Added@firebase/util@1.1.0(transitive)
- Removed@firebase/app@0.0.900-exp.555fe23c5(transitive)
- Removed@firebase/component@0.2.0(transitive)
- Removed@firebase/util@0.3.4(transitive)
- Removedtslib@1.14.1(transitive)
Updated@firebase/component@0.5.3
Updated@firebase/util@1.1.0
Updatedtslib@^2.1.0