@firebase/app-compat
Advanced tools
Comparing version 0.2.43 to 0.2.44-20241017211210
@@ -372,3 +372,3 @@ import { ErrorFactory, contains, deepExtend, createSubscribe, getGlobal } from '@firebase/util'; | ||
const name = "@firebase/app-compat"; | ||
const version = "0.2.43"; | ||
const version = "0.2.44-20241017211210"; | ||
@@ -375,0 +375,0 @@ /** |
'use strict'; | ||
var util = require('@firebase/util'); | ||
var tslib = require('tslib'); | ||
var component = require('@firebase/component'); | ||
@@ -52,45 +51,31 @@ var modularAPIs = require('@firebase/app'); | ||
*/ | ||
var FirebaseAppImpl = /** @class */ (function () { | ||
function FirebaseAppImpl(_delegate, firebase) { | ||
var _this = this; | ||
class FirebaseAppImpl { | ||
constructor(_delegate, firebase) { | ||
this._delegate = _delegate; | ||
this.firebase = firebase; | ||
// add itself to container | ||
modularAPIs._addComponent(_delegate, new component.Component('app-compat', function () { return _this; }, "PUBLIC" /* ComponentType.PUBLIC */)); | ||
modularAPIs._addComponent(_delegate, new component.Component('app-compat', () => this, "PUBLIC" /* ComponentType.PUBLIC */)); | ||
this.container = _delegate.container; | ||
} | ||
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", { | ||
get: function () { | ||
return this._delegate.automaticDataCollectionEnabled; | ||
}, | ||
set: function (val) { | ||
this._delegate.automaticDataCollectionEnabled = val; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FirebaseAppImpl.prototype, "name", { | ||
get: function () { | ||
return this._delegate.name; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FirebaseAppImpl.prototype, "options", { | ||
get: function () { | ||
return this._delegate.options; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
FirebaseAppImpl.prototype.delete = function () { | ||
var _this = this; | ||
return new Promise(function (resolve) { | ||
_this._delegate.checkDestroyed(); | ||
get automaticDataCollectionEnabled() { | ||
return this._delegate.automaticDataCollectionEnabled; | ||
} | ||
set automaticDataCollectionEnabled(val) { | ||
this._delegate.automaticDataCollectionEnabled = val; | ||
} | ||
get name() { | ||
return this._delegate.name; | ||
} | ||
get options() { | ||
return this._delegate.options; | ||
} | ||
delete() { | ||
return new Promise(resolve => { | ||
this._delegate.checkDestroyed(); | ||
resolve(); | ||
}).then(function () { | ||
_this.firebase.INTERNAL.removeApp(_this.name); | ||
return modularAPIs.deleteApp(_this._delegate); | ||
}).then(() => { | ||
this.firebase.INTERNAL.removeApp(this.name); | ||
return modularAPIs.deleteApp(this._delegate); | ||
}); | ||
}; | ||
} | ||
/** | ||
@@ -110,8 +95,7 @@ * Return a service instance associated with this app (creating it | ||
*/ | ||
FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { | ||
_getService(name, instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME) { | ||
var _a; | ||
if (instanceIdentifier === void 0) { instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME; } | ||
this._delegate.checkDestroyed(); | ||
// Initialize instance if InstantiationMode is `EXPLICIT`. | ||
var provider = this._delegate.container.getProvider(name); | ||
const provider = this._delegate.container.getProvider(name); | ||
if (!provider.isInitialized() && | ||
@@ -125,3 +109,3 @@ ((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === "EXPLICIT" /* InstantiationMode.EXPLICIT */) { | ||
}); | ||
}; | ||
} | ||
/** | ||
@@ -137,4 +121,3 @@ * Remove a service instance from the cache, so we will create a new instance for this service | ||
*/ | ||
FirebaseAppImpl.prototype._removeServiceInstance = function (name, instanceIdentifier) { | ||
if (instanceIdentifier === void 0) { instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME; } | ||
_removeServiceInstance(name, instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME) { | ||
this._delegate.container | ||
@@ -144,3 +127,3 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
.clearInstance(instanceIdentifier); | ||
}; | ||
} | ||
/** | ||
@@ -150,9 +133,9 @@ * @param component the component being added to this app's container | ||
*/ | ||
FirebaseAppImpl.prototype._addComponent = function (component) { | ||
_addComponent(component) { | ||
modularAPIs._addComponent(this._delegate, component); | ||
}; | ||
FirebaseAppImpl.prototype._addOrOverwriteComponent = function (component) { | ||
} | ||
_addOrOverwriteComponent(component) { | ||
modularAPIs._addOrOverwriteComponent(this._delegate, component); | ||
}; | ||
FirebaseAppImpl.prototype.toJSON = function () { | ||
} | ||
toJSON() { | ||
return { | ||
@@ -163,5 +146,4 @@ name: this.name, | ||
}; | ||
}; | ||
return FirebaseAppImpl; | ||
}()); | ||
} | ||
} | ||
// TODO: investigate why the following needs to be commented out | ||
@@ -190,10 +172,9 @@ // Prevent dead-code elimination of these methods w/o invalid property | ||
*/ | ||
var _a; | ||
var ERRORS = (_a = {}, | ||
_a["no-app" /* AppError.NO_APP */] = "No Firebase App '{$appName}' has been created - " + | ||
const ERRORS = { | ||
["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " + | ||
'call Firebase App.initializeApp()', | ||
_a["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' + | ||
'Firebase App instance.', | ||
_a); | ||
var ERROR_FACTORY = new util.ErrorFactory('app-compat', 'Firebase', ERRORS); | ||
["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' + | ||
'Firebase App instance.' | ||
}; | ||
const ERROR_FACTORY = new util.ErrorFactory('app-compat', 'Firebase', ERRORS); | ||
@@ -224,7 +205,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 | ||
@@ -236,3 +217,3 @@ // as the firebase namespace. | ||
// @ts-ignore | ||
app: app, | ||
app, | ||
registerVersion: modularAPIs__namespace.registerVersion, | ||
@@ -246,4 +227,4 @@ setLogLevel: modularAPIs__namespace.setLogLevel, | ||
registerComponent: registerComponentCompat, | ||
removeApp: removeApp, | ||
useAsService: useAsService, | ||
removeApp, | ||
useAsService, | ||
modularAPIs: modularAPIs__namespace | ||
@@ -292,9 +273,8 @@ } | ||
*/ | ||
function initializeAppCompat(options, rawConfig) { | ||
if (rawConfig === void 0) { rawConfig = {}; } | ||
var app = modularAPIs__namespace.initializeApp(options, rawConfig); | ||
function initializeAppCompat(options, rawConfig = {}) { | ||
const app = modularAPIs__namespace.initializeApp(options, rawConfig); | ||
if (util.contains(apps, app.name)) { | ||
return apps[app.name]; | ||
} | ||
var appCompat = new firebaseAppImpl(app, namespace); | ||
const appCompat = new firebaseAppImpl(app, namespace); | ||
apps[app.name] = appCompat; | ||
@@ -308,7 +288,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; | ||
var componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
const componentName = component.name; | ||
const componentNameWithoutCompat = componentName.replace('-compat', ''); | ||
if (modularAPIs__namespace._registerComponent(component) && | ||
@@ -318,4 +298,3 @@ component.type === "PUBLIC" /* ComponentType.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 | ||
@@ -345,8 +324,4 @@ if (typeof appArg[componentNameWithoutCompat] !== 'function') { | ||
// 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 : []); | ||
@@ -366,3 +341,3 @@ }; | ||
} | ||
var useService = name; | ||
const useService = name; | ||
return useService; | ||
@@ -397,4 +372,8 @@ } | ||
function createFirebaseNamespace() { | ||
var namespace = createFirebaseNamespaceCore(FirebaseAppImpl); | ||
namespace.INTERNAL = tslib.__assign(tslib.__assign({}, namespace.INTERNAL), { createFirebaseNamespace: createFirebaseNamespace, extendNamespace: extendNamespace, createSubscribe: util.createSubscribe, ErrorFactory: util.ErrorFactory, deepExtend: util.deepExtend }); | ||
const namespace = createFirebaseNamespaceCore(FirebaseAppImpl); | ||
namespace.INTERNAL = Object.assign(Object.assign({}, namespace.INTERNAL), { createFirebaseNamespace, | ||
extendNamespace, | ||
createSubscribe: util.createSubscribe, | ||
ErrorFactory: util.ErrorFactory, | ||
deepExtend: util.deepExtend }); | ||
/** | ||
@@ -410,3 +389,3 @@ * Patch the top-level firebase namespace with additional properties. | ||
} | ||
var firebase$1 = createFirebaseNamespace(); | ||
const firebase$1 = createFirebaseNamespace(); | ||
@@ -429,6 +408,6 @@ /** | ||
*/ | ||
var logger = new logger$1.Logger('@firebase/app-compat'); | ||
const logger = new logger$1.Logger('@firebase/app-compat'); | ||
var name = "@firebase/app-compat"; | ||
var version = "0.2.43"; | ||
const name = "@firebase/app-compat"; | ||
const version = "0.2.44-20241017211210"; | ||
@@ -473,12 +452,18 @@ /** | ||
try { | ||
var globals = util.getGlobal(); | ||
const globals = util.getGlobal(); | ||
// Firebase Lite detection | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
if (globals.firebase !== undefined) { | ||
logger.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "); | ||
logger.warn(` | ||
Warning: Firebase is already defined in the global scope. Please make sure | ||
Firebase library is only loaded once. | ||
`); | ||
// eslint-disable-next-line | ||
var sdkVersion = globals.firebase | ||
const sdkVersion = globals.firebase | ||
.SDK_VERSION; | ||
if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) { | ||
logger.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n "); | ||
logger.warn(` | ||
Warning: You are trying to load Firebase while using Firebase Performance standalone script. | ||
You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code. | ||
`); | ||
} | ||
@@ -490,3 +475,3 @@ } | ||
} | ||
var firebase = firebase$1; | ||
const firebase = firebase$1; | ||
registerCoreComponents(); | ||
@@ -493,0 +478,0 @@ |
@@ -295,3 +295,3 @@ import * as modularAPIs from '@firebase/app'; | ||
const name$1 = "@firebase/app-compat"; | ||
const version = "0.2.43"; | ||
const version = "0.2.44-20241017211210"; | ||
@@ -298,0 +298,0 @@ /** |
{ | ||
"name": "@firebase/app-compat", | ||
"version": "0.2.43", | ||
"version": "0.2.44-20241017211210", | ||
"description": "The primary entrypoint to the Firebase JS SDK", | ||
@@ -9,5 +9,3 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"module": "dist/esm/index.esm2017.js", | ||
"esm5": "dist/esm/index.esm5.js", | ||
"lite": "dist/index.lite.js", | ||
"liteesm5": "dist/index.lite.esm5.js", | ||
"exports": { | ||
@@ -17,5 +15,3 @@ ".": { | ||
"require": "./dist/index.cjs.js", | ||
"esm5": "./dist/esm/index.esm5.js", | ||
"lite": "./dist/index.lite.js", | ||
"liteesm5": "./dist/index.lite.esm5.js", | ||
"default": "./dist/esm/index.esm2017.js" | ||
@@ -46,6 +42,6 @@ }, | ||
"dependencies": { | ||
"@firebase/app": "0.10.13", | ||
"@firebase/util": "1.10.0", | ||
"@firebase/logger": "0.4.2", | ||
"@firebase/component": "0.6.9", | ||
"@firebase/app": "0.10.14-20241017211210", | ||
"@firebase/util": "1.10.1-20241017211210", | ||
"@firebase/logger": "0.4.3-20241017211210", | ||
"@firebase/component": "0.6.10-20241017211210", | ||
"tslib": "^2.1.0" | ||
@@ -74,3 +70,6 @@ }, | ||
"reportDir": "./coverage/node" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
} | ||
} |
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
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 2 instances in 1 package
3
80
178121
42
2611
11
289
+ Added@firebase/app@0.10.14-20241017211210(transitive)
+ Added@firebase/component@0.6.10-20241017211210(transitive)
+ Added@firebase/logger@0.4.3-20241017211210(transitive)
+ Added@firebase/util@1.10.1-20241017211210(transitive)
- Removed@firebase/app@0.10.13(transitive)
- Removed@firebase/component@0.6.9(transitive)
- Removed@firebase/logger@0.4.2(transitive)
- Removed@firebase/util@1.10.0(transitive)