Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/app

Package Overview
Dependencies
Maintainers
4
Versions
3383
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/app - npm Package Compare versions

Comparing version 0.10.13 to 0.10.14-20241017211210

8

dist/esm/index.esm2017.js

@@ -61,3 +61,3 @@ import { Component, ComponentContainer } from '@firebase/component';

const name$q = "@firebase/app";
const version$1 = "0.10.13";
const version$1 = "0.10.14-20241017211210";

@@ -128,3 +128,3 @@ /**

const name$2 = "@firebase/vertexai-preview";
const name$2 = "@firebase/vertexai";

@@ -134,3 +134,3 @@ const name$1 = "@firebase/firestore-compat";

const name = "firebase";
const version = "10.14.1";
const version = "11.0.0-20241017211210";

@@ -1143,3 +1143,3 @@ /**

registerVersion(name$q, version$1, variant);
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
// BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
registerVersion(name$q, version$1, 'esm2017');

@@ -1146,0 +1146,0 @@ // Register platform SDK identifier (no version).

@@ -6,3 +6,2 @@ 'use strict';

var component = require('@firebase/component');
var tslib = require('tslib');
var logger$1 = require('@firebase/logger');

@@ -28,4 +27,4 @@ var util = require('@firebase/util');

*/
var PlatformLoggerServiceImpl = /** @class */ (function () {
function PlatformLoggerServiceImpl(container) {
class PlatformLoggerServiceImpl {
constructor(container) {
this.container = container;

@@ -35,11 +34,11 @@ }

// auth token refresh, and installations will send this string.
PlatformLoggerServiceImpl.prototype.getPlatformInfoString = function () {
var providers = this.container.getProviders();
getPlatformInfoString() {
const providers = this.container.getProviders();
// Loop through providers and get library/version pairs from any that are
// version components.
return providers
.map(function (provider) {
.map(provider => {
if (isVersionServiceProvider(provider)) {
var service = provider.getImmediate();
return "".concat(service.library, "/").concat(service.version);
const service = provider.getImmediate();
return `${service.library}/${service.version}`;
}

@@ -50,7 +49,6 @@ else {

})
.filter(function (logString) { return logString; })
.filter(logString => logString)
.join(' ');
};
return PlatformLoggerServiceImpl;
}());
}
}
/**

@@ -65,8 +63,8 @@ *

function isVersionServiceProvider(provider) {
var component = provider.getComponent();
const component = provider.getComponent();
return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* ComponentType.VERSION */;
}
var name$q = "@firebase/app";
var version$1 = "0.10.13";
const name$q = "@firebase/app";
const version$1 = "0.10.14-20241017211210";

@@ -89,56 +87,56 @@ /**

*/
var logger = new logger$1.Logger('@firebase/app');
const logger = new logger$1.Logger('@firebase/app');
var name$p = "@firebase/app-compat";
const name$p = "@firebase/app-compat";
var name$o = "@firebase/analytics-compat";
const name$o = "@firebase/analytics-compat";
var name$n = "@firebase/analytics";
const name$n = "@firebase/analytics";
var name$m = "@firebase/app-check-compat";
const name$m = "@firebase/app-check-compat";
var name$l = "@firebase/app-check";
const name$l = "@firebase/app-check";
var name$k = "@firebase/auth";
const name$k = "@firebase/auth";
var name$j = "@firebase/auth-compat";
const name$j = "@firebase/auth-compat";
var name$i = "@firebase/database";
const name$i = "@firebase/database";
var name$h = "@firebase/data-connect";
const name$h = "@firebase/data-connect";
var name$g = "@firebase/database-compat";
const name$g = "@firebase/database-compat";
var name$f = "@firebase/functions";
const name$f = "@firebase/functions";
var name$e = "@firebase/functions-compat";
const name$e = "@firebase/functions-compat";
var name$d = "@firebase/installations";
const name$d = "@firebase/installations";
var name$c = "@firebase/installations-compat";
const name$c = "@firebase/installations-compat";
var name$b = "@firebase/messaging";
const name$b = "@firebase/messaging";
var name$a = "@firebase/messaging-compat";
const name$a = "@firebase/messaging-compat";
var name$9 = "@firebase/performance";
const name$9 = "@firebase/performance";
var name$8 = "@firebase/performance-compat";
const name$8 = "@firebase/performance-compat";
var name$7 = "@firebase/remote-config";
const name$7 = "@firebase/remote-config";
var name$6 = "@firebase/remote-config-compat";
const name$6 = "@firebase/remote-config-compat";
var name$5 = "@firebase/storage";
const name$5 = "@firebase/storage";
var name$4 = "@firebase/storage-compat";
const name$4 = "@firebase/storage-compat";
var name$3 = "@firebase/firestore";
const name$3 = "@firebase/firestore";
var name$2 = "@firebase/vertexai-preview";
const name$2 = "@firebase/vertexai";
var name$1 = "@firebase/firestore-compat";
const name$1 = "@firebase/firestore-compat";
var name = "firebase";
var version = "10.14.1";
const name = "firebase";
const version = "11.0.0-20241017211210";

@@ -161,3 +159,2 @@ /**

*/
var _a$1;
/**

@@ -168,33 +165,33 @@ * The default app name

*/
var DEFAULT_ENTRY_NAME = '[DEFAULT]';
var PLATFORM_LOG_STRING = (_a$1 = {},
_a$1[name$q] = 'fire-core',
_a$1[name$p] = 'fire-core-compat',
_a$1[name$n] = 'fire-analytics',
_a$1[name$o] = 'fire-analytics-compat',
_a$1[name$l] = 'fire-app-check',
_a$1[name$m] = 'fire-app-check-compat',
_a$1[name$k] = 'fire-auth',
_a$1[name$j] = 'fire-auth-compat',
_a$1[name$i] = 'fire-rtdb',
_a$1[name$h] = 'fire-data-connect',
_a$1[name$g] = 'fire-rtdb-compat',
_a$1[name$f] = 'fire-fn',
_a$1[name$e] = 'fire-fn-compat',
_a$1[name$d] = 'fire-iid',
_a$1[name$c] = 'fire-iid-compat',
_a$1[name$b] = 'fire-fcm',
_a$1[name$a] = 'fire-fcm-compat',
_a$1[name$9] = 'fire-perf',
_a$1[name$8] = 'fire-perf-compat',
_a$1[name$7] = 'fire-rc',
_a$1[name$6] = 'fire-rc-compat',
_a$1[name$5] = 'fire-gcs',
_a$1[name$4] = 'fire-gcs-compat',
_a$1[name$3] = 'fire-fst',
_a$1[name$1] = 'fire-fst-compat',
_a$1[name$2] = 'fire-vertex',
_a$1['fire-js'] = 'fire-js',
_a$1[name] = 'fire-js-all',
_a$1);
const DEFAULT_ENTRY_NAME = '[DEFAULT]';
const PLATFORM_LOG_STRING = {
[name$q]: 'fire-core',
[name$p]: 'fire-core-compat',
[name$n]: 'fire-analytics',
[name$o]: 'fire-analytics-compat',
[name$l]: 'fire-app-check',
[name$m]: 'fire-app-check-compat',
[name$k]: 'fire-auth',
[name$j]: 'fire-auth-compat',
[name$i]: 'fire-rtdb',
[name$h]: 'fire-data-connect',
[name$g]: 'fire-rtdb-compat',
[name$f]: 'fire-fn',
[name$e]: 'fire-fn-compat',
[name$d]: 'fire-iid',
[name$c]: 'fire-iid-compat',
[name$b]: 'fire-fcm',
[name$a]: 'fire-fcm-compat',
[name$9]: 'fire-perf',
[name$8]: 'fire-perf-compat',
[name$7]: 'fire-rc',
[name$6]: 'fire-rc-compat',
[name$5]: 'fire-gcs',
[name$4]: 'fire-gcs-compat',
[name$3]: 'fire-fst',
[name$1]: 'fire-fst-compat',
[name$2]: 'fire-vertex',
'fire-js': 'fire-js',
[name]: 'fire-js-all'
};

@@ -220,7 +217,7 @@ /**

*/
var _apps = new Map();
const _apps = new Map();
/**
* @internal
*/
var _serverApps = new Map();
const _serverApps = new Map();
/**

@@ -232,3 +229,3 @@ * Registered components.

// eslint-disable-next-line @typescript-eslint/no-explicit-any
var _components = new Map();
const _components = new Map();
/**

@@ -244,3 +241,3 @@ * @param component - the component being added to this app's container

catch (e) {
logger.debug("Component ".concat(component.name, " failed to register with FirebaseApp ").concat(app.name), e);
logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
}

@@ -263,36 +260,15 @@ }

function _registerComponent(component) {
var e_1, _a, e_2, _b;
var componentName = component.name;
const componentName = component.name;
if (_components.has(componentName)) {
logger.debug("There were multiple attempts to register component ".concat(componentName, "."));
logger.debug(`There were multiple attempts to register component ${componentName}.`);
return false;
}
_components.set(componentName, component);
try {
// add the component to existing app instances
for (var _c = tslib.__values(_apps.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
var app = _d.value;
_addComponent(app, component);
}
// add the component to existing app instances
for (const app of _apps.values()) {
_addComponent(app, component);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
for (const serverApp of _serverApps.values()) {
_addComponent(serverApp, component);
}
try {
for (var _e = tslib.__values(_serverApps.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
var serverApp = _f.value;
_addComponent(serverApp, component);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
return true;

@@ -310,3 +286,3 @@ }

function _getProvider(app, name) {
var heartbeatController = app.container
const heartbeatController = app.container
.getProvider('heartbeat')

@@ -327,4 +303,3 @@ .getImmediate({ optional: true });

*/
function _removeServiceInstance(app, name, instanceIdentifier) {
if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
function _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {
_getProvider(app, name).clearInstance(instanceIdentifier);

@@ -379,22 +354,21 @@ }

*/
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 initializeApp() first',
_a["bad-app-name" /* AppError.BAD_APP_NAME */] = "Illegal App name: '{$appName}'",
_a["duplicate-app" /* AppError.DUPLICATE_APP */] = "Firebase App named '{$appName}' already exists with different options or config",
_a["app-deleted" /* AppError.APP_DELETED */] = "Firebase App named '{$appName}' already deleted",
_a["server-app-deleted" /* AppError.SERVER_APP_DELETED */] = 'Firebase Server App has been deleted',
_a["no-options" /* AppError.NO_OPTIONS */] = 'Need to provide options, when not being deployed to hosting via source.',
_a["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' +
["bad-app-name" /* AppError.BAD_APP_NAME */]: "Illegal App name: '{$appName}'",
["duplicate-app" /* AppError.DUPLICATE_APP */]: "Firebase App named '{$appName}' already exists with different options or config",
["app-deleted" /* AppError.APP_DELETED */]: "Firebase App named '{$appName}' already deleted",
["server-app-deleted" /* AppError.SERVER_APP_DELETED */]: 'Firebase Server App has been deleted',
["no-options" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',
["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
'Firebase App instance.',
_a["invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */] = 'First argument to `onLog` must be null or a function.',
_a["idb-open" /* AppError.IDB_OPEN */] = 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',
_a["idb-get" /* AppError.IDB_GET */] = 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',
_a["idb-set" /* AppError.IDB_WRITE */] = 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',
_a["idb-delete" /* AppError.IDB_DELETE */] = 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.',
_a["finalization-registry-not-supported" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */] = 'FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.',
_a["invalid-server-app-environment" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */] = 'FirebaseServerApp is not for use in browser environments.',
_a);
var ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS);
["invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',
["idb-open" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',
["idb-get" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',
["idb-set" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',
["idb-delete" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.',
["finalization-registry-not-supported" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */]: 'FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.',
["invalid-server-app-environment" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */]: 'FirebaseServerApp is not for use in browser environments.'
};
const ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS);

@@ -417,8 +391,7 @@ /**

*/
var FirebaseAppImpl = /** @class */ (function () {
function FirebaseAppImpl(options, config, container) {
var _this = this;
class FirebaseAppImpl {
constructor(options, config, container) {
this._isDeleted = false;
this._options = tslib.__assign({}, options);
this._config = tslib.__assign({}, config);
this._options = Object.assign({}, options);
this._config = Object.assign({}, config);
this._name = config.name;

@@ -428,57 +401,33 @@ this._automaticDataCollectionEnabled =

this._container = container;
this.container.addComponent(new component.Component('app', function () { return _this; }, "PUBLIC" /* ComponentType.PUBLIC */));
this.container.addComponent(new component.Component('app', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
}
Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
get: function () {
this.checkDestroyed();
return this._automaticDataCollectionEnabled;
},
set: function (val) {
this.checkDestroyed();
this._automaticDataCollectionEnabled = val;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "name", {
get: function () {
this.checkDestroyed();
return this._name;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "options", {
get: function () {
this.checkDestroyed();
return this._options;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "config", {
get: function () {
this.checkDestroyed();
return this._config;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "container", {
get: function () {
return this._container;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FirebaseAppImpl.prototype, "isDeleted", {
get: function () {
return this._isDeleted;
},
set: function (val) {
this._isDeleted = val;
},
enumerable: false,
configurable: true
});
get automaticDataCollectionEnabled() {
this.checkDestroyed();
return this._automaticDataCollectionEnabled;
}
set automaticDataCollectionEnabled(val) {
this.checkDestroyed();
this._automaticDataCollectionEnabled = val;
}
get name() {
this.checkDestroyed();
return this._name;
}
get options() {
this.checkDestroyed();
return this._options;
}
get config() {
this.checkDestroyed();
return this._config;
}
get container() {
return this._container;
}
get isDeleted() {
return this._isDeleted;
}
set isDeleted(val) {
this._isDeleted = val;
}
/**

@@ -488,9 +437,8 @@ * This function will throw an Error if the App has already been deleted -

*/
FirebaseAppImpl.prototype.checkDestroyed = function () {
checkDestroyed() {
if (this.isDeleted) {
throw ERROR_FACTORY.create("app-deleted" /* AppError.APP_DELETED */, { appName: this._name });
}
};
return FirebaseAppImpl;
}());
}
}

@@ -513,53 +461,46 @@ /**

*/
var FirebaseServerAppImpl = /** @class */ (function (_super) {
tslib.__extends(FirebaseServerAppImpl, _super);
function FirebaseServerAppImpl(options, serverConfig, name, container) {
var _this = this;
class FirebaseServerAppImpl extends FirebaseAppImpl {
constructor(options, serverConfig, name, container) {
// Build configuration parameters for the FirebaseAppImpl base class.
var automaticDataCollectionEnabled = serverConfig.automaticDataCollectionEnabled !== undefined
const automaticDataCollectionEnabled = serverConfig.automaticDataCollectionEnabled !== undefined
? serverConfig.automaticDataCollectionEnabled
: false;
// Create the FirebaseAppSettings object for the FirebaseAppImp constructor.
var config = {
name: name,
automaticDataCollectionEnabled: automaticDataCollectionEnabled
const config = {
name,
automaticDataCollectionEnabled
};
if (options.apiKey !== undefined) {
// Construct the parent FirebaseAppImp object.
_this = _super.call(this, options, config, container) || this;
super(options, config, container);
}
else {
var appImpl = options;
_this = _super.call(this, appImpl.options, config, container) || this;
const appImpl = options;
super(appImpl.options, config, container);
}
// Now construct the data for the FirebaseServerAppImpl.
_this._serverConfig = tslib.__assign({ automaticDataCollectionEnabled: automaticDataCollectionEnabled }, serverConfig);
_this._finalizationRegistry = null;
this._serverConfig = Object.assign({ automaticDataCollectionEnabled }, serverConfig);
this._finalizationRegistry = null;
if (typeof FinalizationRegistry !== 'undefined') {
_this._finalizationRegistry = new FinalizationRegistry(function () {
_this.automaticCleanup();
this._finalizationRegistry = new FinalizationRegistry(() => {
this.automaticCleanup();
});
}
_this._refCount = 0;
_this.incRefCount(_this._serverConfig.releaseOnDeref);
this._refCount = 0;
this.incRefCount(this._serverConfig.releaseOnDeref);
// Do not retain a hard reference to the dref object, otherwise the FinalizationRegistry
// will never trigger.
_this._serverConfig.releaseOnDeref = undefined;
this._serverConfig.releaseOnDeref = undefined;
serverConfig.releaseOnDeref = undefined;
registerVersion(name$q, version$1, 'serverapp');
return _this;
}
FirebaseServerAppImpl.prototype.toJSON = function () {
toJSON() {
return undefined;
};
Object.defineProperty(FirebaseServerAppImpl.prototype, "refCount", {
get: function () {
return this._refCount;
},
enumerable: false,
configurable: true
});
}
get refCount() {
return this._refCount;
}
// Increment the reference count of this server app. If an object is provided, register it
// with the finalization registry.
FirebaseServerAppImpl.prototype.incRefCount = function (obj) {
incRefCount(obj) {
if (this.isDeleted) {

@@ -572,5 +513,5 @@ return;

}
};
}
// Decrement the reference count.
FirebaseServerAppImpl.prototype.decRefCount = function () {
decRefCount() {
if (this.isDeleted) {

@@ -580,17 +521,13 @@ return 0;

return --this._refCount;
};
}
// Invoked by the FinalizationRegistry callback to note that this app should go through its
// reference counts and delete itself if no reference count remain. The coordinating logic that
// handles this is in deleteApp(...).
FirebaseServerAppImpl.prototype.automaticCleanup = function () {
automaticCleanup() {
void deleteApp(this);
};
Object.defineProperty(FirebaseServerAppImpl.prototype, "settings", {
get: function () {
this.checkDestroyed();
return this._serverConfig;
},
enumerable: false,
configurable: true
});
}
get settings() {
this.checkDestroyed();
return this._serverConfig;
}
/**

@@ -600,9 +537,8 @@ * This function will throw an Error if the App has already been deleted -

*/
FirebaseServerAppImpl.prototype.checkDestroyed = function () {
checkDestroyed() {
if (this.isDeleted) {
throw ERROR_FACTORY.create("server-app-deleted" /* AppError.SERVER_APP_DELETED */);
}
};
return FirebaseServerAppImpl;
}(FirebaseAppImpl));
}
}

@@ -630,13 +566,11 @@ /**

*/
var SDK_VERSION = version;
function initializeApp(_options, rawConfig) {
var e_1, _a;
if (rawConfig === void 0) { rawConfig = {}; }
var options = _options;
const SDK_VERSION = version;
function initializeApp(_options, rawConfig = {}) {
let options = _options;
if (typeof rawConfig !== 'object') {
var name_1 = rawConfig;
rawConfig = { name: name_1 };
const name = rawConfig;
rawConfig = { name };
}
var config = tslib.__assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
var name = config.name;
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
const name = config.name;
if (typeof name !== 'string' || !name) {

@@ -651,3 +585,3 @@ throw ERROR_FACTORY.create("bad-app-name" /* AppError.BAD_APP_NAME */, {

}
var existingApp = _apps.get(name);
const existingApp = _apps.get(name);
if (existingApp) {

@@ -663,17 +597,7 @@ // return the existing app if options and config deep equal the ones in the existing app.

}
var container = new component.ComponentContainer(name);
try {
for (var _b = tslib.__values(_components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component$1 = _c.value;
container.addComponent(component$1);
}
const container = new component.ComponentContainer(name);
for (const component of _components.values()) {
container.addComponent(component);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
var newApp = new FirebaseAppImpl(options, config, container);
const newApp = new FirebaseAppImpl(options, config, container);
_apps.set(name, newApp);

@@ -683,3 +607,2 @@ return newApp;

function initializeServerApp(_options, _serverAppConfig) {
var e_2, _a;
if (util.isBrowser() && !util.isWebWorker()) {

@@ -692,3 +615,3 @@ // FirebaseServerApp isn't designed to be run in browsers.

}
var appOptions;
let appOptions;
if (_isFirebaseApp(_options)) {

@@ -701,3 +624,3 @@ appOptions = _options.options;

// Build an app name based on a hash of the configuration options.
var nameObj = tslib.__assign(tslib.__assign({}, _serverAppConfig), appOptions);
const nameObj = Object.assign(Object.assign({}, _serverAppConfig), appOptions);
// However, Do not mangle the name based on releaseOnDeref, since it will vary between the

@@ -708,4 +631,4 @@ // construction of FirebaseServerApp instances. For example, if the object is the request headers.

}
var hashCode = function (s) {
return tslib.__spreadArray([], tslib.__read(s), false).reduce(function (hash, c) { return (Math.imul(31, hash) + c.charCodeAt(0)) | 0; }, 0);
const hashCode = (s) => {
return [...s].reduce((hash, c) => (Math.imul(31, hash) + c.charCodeAt(0)) | 0, 0);
};

@@ -717,4 +640,4 @@ if (_serverAppConfig.releaseOnDeref !== undefined) {

}
var nameString = '' + hashCode(JSON.stringify(nameObj));
var existingApp = _serverApps.get(nameString);
const nameString = '' + hashCode(JSON.stringify(nameObj));
const existingApp = _serverApps.get(nameString);
if (existingApp) {

@@ -724,17 +647,7 @@ existingApp.incRefCount(_serverAppConfig.releaseOnDeref);

}
var container = new component.ComponentContainer(nameString);
try {
for (var _b = tslib.__values(_components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component$1 = _c.value;
container.addComponent(component$1);
}
const container = new component.ComponentContainer(nameString);
for (const component of _components.values()) {
container.addComponent(component);
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
var newApp = new FirebaseServerAppImpl(appOptions, _serverAppConfig, nameString, container);
const newApp = new FirebaseServerAppImpl(appOptions, _serverAppConfig, nameString, container);
_serverApps.set(nameString, newApp);

@@ -772,5 +685,4 @@ return newApp;

*/
function getApp(name) {
if (name === void 0) { name = DEFAULT_ENTRY_NAME; }
var app = _apps.get(name);
function getApp(name = DEFAULT_ENTRY_NAME) {
const app = _apps.get(name);
if (!app && name === DEFAULT_ENTRY_NAME && util.getDefaultAppConfig()) {

@@ -808,33 +720,22 @@ return initializeApp();

*/
function deleteApp(app) {
return tslib.__awaiter(this, void 0, void 0, function () {
var cleanupProviders, name, firebaseServerApp;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
cleanupProviders = false;
name = app.name;
if (_apps.has(name)) {
cleanupProviders = true;
_apps.delete(name);
}
else if (_serverApps.has(name)) {
firebaseServerApp = app;
if (firebaseServerApp.decRefCount() <= 0) {
_serverApps.delete(name);
cleanupProviders = true;
}
}
if (!cleanupProviders) return [3 /*break*/, 2];
return [4 /*yield*/, Promise.all(app.container
.getProviders()
.map(function (provider) { return provider.delete(); }))];
case 1:
_a.sent();
app.isDeleted = true;
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
async function deleteApp(app) {
let cleanupProviders = false;
const name = app.name;
if (_apps.has(name)) {
cleanupProviders = true;
_apps.delete(name);
}
else if (_serverApps.has(name)) {
const firebaseServerApp = app;
if (firebaseServerApp.decRefCount() <= 0) {
_serverApps.delete(name);
cleanupProviders = true;
}
}
if (cleanupProviders) {
await Promise.all(app.container
.getProviders()
.map(provider => provider.delete()));
app.isDeleted = true;
}
}

@@ -853,14 +754,14 @@ /**

// a good whitelist system.
var library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
if (variant) {
library += "-".concat(variant);
library += `-${variant}`;
}
var libraryMismatch = library.match(/\s|\//);
var versionMismatch = version.match(/\s|\//);
const libraryMismatch = library.match(/\s|\//);
const versionMismatch = version.match(/\s|\//);
if (libraryMismatch || versionMismatch) {
var warning = [
"Unable to register library \"".concat(library, "\" with version \"").concat(version, "\":")
const warning = [
`Unable to register library "${library}" with version "${version}":`
];
if (libraryMismatch) {
warning.push("library name \"".concat(library, "\" contains illegal characters (whitespace or \"/\")"));
warning.push(`library name "${library}" contains illegal characters (whitespace or "/")`);
}

@@ -871,3 +772,3 @@ if (libraryMismatch && versionMismatch) {

if (versionMismatch) {
warning.push("version name \"".concat(version, "\" contains illegal characters (whitespace or \"/\")"));
warning.push(`version name "${version}" contains illegal characters (whitespace or "/")`);
}

@@ -877,3 +778,3 @@ logger.warn(warning.join(' '));

}
_registerComponent(new component.Component("".concat(library, "-version"), function () { return ({ library: library, version: version }); }, "VERSION" /* ComponentType.VERSION */));
_registerComponent(new component.Component(`${library}-version`, () => ({ library, version }), "VERSION" /* ComponentType.VERSION */));
}

@@ -922,10 +823,10 @@ /**

*/
var DB_NAME = 'firebase-heartbeat-database';
var DB_VERSION = 1;
var STORE_NAME = 'firebase-heartbeat-store';
var dbPromise = null;
const DB_NAME = 'firebase-heartbeat-database';
const DB_VERSION = 1;
const STORE_NAME = 'firebase-heartbeat-store';
let dbPromise = null;
function getDbPromise() {
if (!dbPromise) {
dbPromise = idb.openDB(DB_NAME, DB_VERSION, {
upgrade: function (db, oldVersion) {
upgrade: (db, oldVersion) => {
// We don't use 'break' in this switch statement, the fall-through

@@ -949,3 +850,3 @@ // behavior is what we want, because if there are multiple versions between

}
}).catch(function (e) {
}).catch(e => {
throw ERROR_FACTORY.create("idb-open" /* AppError.IDB_OPEN */, {

@@ -958,79 +859,46 @@ originalErrorMessage: e.message

}
function readHeartbeatsFromIndexedDB(app) {
return tslib.__awaiter(this, void 0, void 0, function () {
var db, tx, result, e_1, idbGetError;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
return [4 /*yield*/, getDbPromise()];
case 1:
db = _a.sent();
tx = db.transaction(STORE_NAME);
return [4 /*yield*/, tx.objectStore(STORE_NAME).get(computeKey(app))];
case 2:
result = _a.sent();
// We already have the value but tx.done can throw,
// so we need to await it here to catch errors
return [4 /*yield*/, tx.done];
case 3:
// We already have the value but tx.done can throw,
// so we need to await it here to catch errors
_a.sent();
return [2 /*return*/, result];
case 4:
e_1 = _a.sent();
if (e_1 instanceof util.FirebaseError) {
logger.warn(e_1.message);
}
else {
idbGetError = ERROR_FACTORY.create("idb-get" /* AppError.IDB_GET */, {
originalErrorMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
});
logger.warn(idbGetError.message);
}
return [3 /*break*/, 5];
case 5: return [2 /*return*/];
}
});
});
async function readHeartbeatsFromIndexedDB(app) {
try {
const db = await getDbPromise();
const tx = db.transaction(STORE_NAME);
const result = await tx.objectStore(STORE_NAME).get(computeKey(app));
// We already have the value but tx.done can throw,
// so we need to await it here to catch errors
await tx.done;
return result;
}
catch (e) {
if (e instanceof util.FirebaseError) {
logger.warn(e.message);
}
else {
const idbGetError = ERROR_FACTORY.create("idb-get" /* AppError.IDB_GET */, {
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
});
logger.warn(idbGetError.message);
}
}
}
function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
return tslib.__awaiter(this, void 0, void 0, function () {
var db, tx, objectStore, e_2, idbGetError;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
return [4 /*yield*/, getDbPromise()];
case 1:
db = _a.sent();
tx = db.transaction(STORE_NAME, 'readwrite');
objectStore = tx.objectStore(STORE_NAME);
return [4 /*yield*/, objectStore.put(heartbeatObject, computeKey(app))];
case 2:
_a.sent();
return [4 /*yield*/, tx.done];
case 3:
_a.sent();
return [3 /*break*/, 5];
case 4:
e_2 = _a.sent();
if (e_2 instanceof util.FirebaseError) {
logger.warn(e_2.message);
}
else {
idbGetError = ERROR_FACTORY.create("idb-set" /* AppError.IDB_WRITE */, {
originalErrorMessage: e_2 === null || e_2 === void 0 ? void 0 : e_2.message
});
logger.warn(idbGetError.message);
}
return [3 /*break*/, 5];
case 5: return [2 /*return*/];
}
});
});
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
try {
const db = await getDbPromise();
const tx = db.transaction(STORE_NAME, 'readwrite');
const objectStore = tx.objectStore(STORE_NAME);
await objectStore.put(heartbeatObject, computeKey(app));
await tx.done;
}
catch (e) {
if (e instanceof util.FirebaseError) {
logger.warn(e.message);
}
else {
const idbGetError = ERROR_FACTORY.create("idb-set" /* AppError.IDB_WRITE */, {
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
});
logger.warn(idbGetError.message);
}
}
}
function computeKey(app) {
return "".concat(app.name, "!").concat(app.options.appId);
return `${app.name}!${app.options.appId}`;
}

@@ -1054,8 +922,7 @@

*/
var MAX_HEADER_BYTES = 1024;
const MAX_HEADER_BYTES = 1024;
// 30 days
var STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
var HeartbeatServiceImpl = /** @class */ (function () {
function HeartbeatServiceImpl(container) {
var _this = this;
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
class HeartbeatServiceImpl {
constructor(container) {
this.container = container;

@@ -1072,6 +939,6 @@ /**

this._heartbeatsCache = null;
var app = this.container.getProvider('app').getImmediate();
const app = this.container.getProvider('app').getImmediate();
this._storage = new HeartbeatStorageImpl(app);
this._heartbeatsCachePromise = this._storage.read().then(function (result) {
_this._heartbeatsCache = result;
this._heartbeatsCachePromise = this._storage.read().then(result => {
this._heartbeatsCache = result;
return result;

@@ -1087,53 +954,42 @@ });

*/
HeartbeatServiceImpl.prototype.triggerHeartbeat = function () {
async triggerHeartbeat() {
var _a, _b;
return tslib.__awaiter(this, void 0, void 0, function () {
var platformLogger, agent, date_1, _c, e_1;
return tslib.__generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 3, , 4]);
platformLogger = this.container
.getProvider('platform-logger')
.getImmediate();
agent = platformLogger.getPlatformInfoString();
date_1 = getUTCDateString();
if (!(((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null)) return [3 /*break*/, 2];
_c = this;
return [4 /*yield*/, this._heartbeatsCachePromise];
case 1:
_c._heartbeatsCache = _d.sent();
// If we failed to construct a heartbeats cache, then return immediately.
if (((_b = this._heartbeatsCache) === null || _b === void 0 ? void 0 : _b.heartbeats) == null) {
return [2 /*return*/];
}
_d.label = 2;
case 2:
// Do not store a heartbeat if one is already stored for this day
// or if a header has already been sent today.
if (this._heartbeatsCache.lastSentHeartbeatDate === date_1 ||
this._heartbeatsCache.heartbeats.some(function (singleDateHeartbeat) { return singleDateHeartbeat.date === date_1; })) {
return [2 /*return*/];
}
else {
// There is no entry for this date. Create one.
this._heartbeatsCache.heartbeats.push({ date: date_1, agent: agent });
}
// Remove entries older than 30 days.
this._heartbeatsCache.heartbeats =
this._heartbeatsCache.heartbeats.filter(function (singleDateHeartbeat) {
var hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
var now = Date.now();
return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
});
return [2 /*return*/, this._storage.overwrite(this._heartbeatsCache)];
case 3:
e_1 = _d.sent();
logger.warn(e_1);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
try {
const platformLogger = this.container
.getProvider('platform-logger')
.getImmediate();
// This is the "Firebase user agent" string from the platform logger
// service, not the browser user agent.
const agent = platformLogger.getPlatformInfoString();
const date = getUTCDateString();
if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null) {
this._heartbeatsCache = await this._heartbeatsCachePromise;
// If we failed to construct a heartbeats cache, then return immediately.
if (((_b = this._heartbeatsCache) === null || _b === void 0 ? void 0 : _b.heartbeats) == null) {
return;
}
});
});
};
}
// Do not store a heartbeat if one is already stored for this day
// or if a header has already been sent today.
if (this._heartbeatsCache.lastSentHeartbeatDate === date ||
this._heartbeatsCache.heartbeats.some(singleDateHeartbeat => singleDateHeartbeat.date === date)) {
return;
}
else {
// There is no entry for this date. Create one.
this._heartbeatsCache.heartbeats.push({ date, agent });
}
// Remove entries older than 30 days.
this._heartbeatsCache.heartbeats =
this._heartbeatsCache.heartbeats.filter(singleDateHeartbeat => {
const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
const now = Date.now();
return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
});
return this._storage.overwrite(this._heartbeatsCache);
}
catch (e) {
logger.warn(e);
}
}
/**

@@ -1146,72 +1002,54 @@ * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.

*/
HeartbeatServiceImpl.prototype.getHeartbeatsHeader = function () {
async getHeartbeatsHeader() {
var _a;
return tslib.__awaiter(this, void 0, void 0, function () {
var date, _b, heartbeatsToSend, unsentEntries, headerString, e_2;
return tslib.__generator(this, function (_c) {
switch (_c.label) {
case 0:
_c.trys.push([0, 6, , 7]);
if (!(this._heartbeatsCache === null)) return [3 /*break*/, 2];
return [4 /*yield*/, this._heartbeatsCachePromise];
case 1:
_c.sent();
_c.label = 2;
case 2:
// If it's still null or the array is empty, there is no data to send.
if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null ||
this._heartbeatsCache.heartbeats.length === 0) {
return [2 /*return*/, ''];
}
date = getUTCDateString();
_b = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats), heartbeatsToSend = _b.heartbeatsToSend, unsentEntries = _b.unsentEntries;
headerString = util.base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));
// Store last sent date to prevent another being logged/sent for the same day.
this._heartbeatsCache.lastSentHeartbeatDate = date;
if (!(unsentEntries.length > 0)) return [3 /*break*/, 4];
// Store any unsent entries if they exist.
this._heartbeatsCache.heartbeats = unsentEntries;
// This seems more likely than emptying the array (below) to lead to some odd state
// since the cache isn't empty and this will be called again on the next request,
// and is probably safest if we await it.
return [4 /*yield*/, this._storage.overwrite(this._heartbeatsCache)];
case 3:
// This seems more likely than emptying the array (below) to lead to some odd state
// since the cache isn't empty and this will be called again on the next request,
// and is probably safest if we await it.
_c.sent();
return [3 /*break*/, 5];
case 4:
this._heartbeatsCache.heartbeats = [];
// Do not wait for this, to reduce latency.
void this._storage.overwrite(this._heartbeatsCache);
_c.label = 5;
case 5: return [2 /*return*/, headerString];
case 6:
e_2 = _c.sent();
logger.warn(e_2);
return [2 /*return*/, ''];
case 7: return [2 /*return*/];
}
});
});
};
return HeartbeatServiceImpl;
}());
try {
if (this._heartbeatsCache === null) {
await this._heartbeatsCachePromise;
}
// If it's still null or the array is empty, there is no data to send.
if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null ||
this._heartbeatsCache.heartbeats.length === 0) {
return '';
}
const date = getUTCDateString();
// Extract as many heartbeats from the cache as will fit under the size limit.
const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);
const headerString = util.base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));
// Store last sent date to prevent another being logged/sent for the same day.
this._heartbeatsCache.lastSentHeartbeatDate = date;
if (unsentEntries.length > 0) {
// Store any unsent entries if they exist.
this._heartbeatsCache.heartbeats = unsentEntries;
// This seems more likely than emptying the array (below) to lead to some odd state
// since the cache isn't empty and this will be called again on the next request,
// and is probably safest if we await it.
await this._storage.overwrite(this._heartbeatsCache);
}
else {
this._heartbeatsCache.heartbeats = [];
// Do not wait for this, to reduce latency.
void this._storage.overwrite(this._heartbeatsCache);
}
return headerString;
}
catch (e) {
logger.warn(e);
return '';
}
}
}
function getUTCDateString() {
var today = new Date();
const today = new Date();
// Returns date format 'YYYY-MM-DD'
return today.toISOString().substring(0, 10);
}
function extractHeartbeatsForHeader(heartbeatsCache, maxSize) {
var e_3, _a;
if (maxSize === void 0) { maxSize = MAX_HEADER_BYTES; }
function extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {
// Heartbeats grouped by user agent in the standard format to be sent in
// the header.
var heartbeatsToSend = [];
const heartbeatsToSend = [];
// Single date format heartbeats that are not sent.
var unsentEntries = heartbeatsCache.slice();
var _loop_1 = function (singleDateHeartbeat) {
let unsentEntries = heartbeatsCache.slice();
for (const singleDateHeartbeat of heartbeatsCache) {
// Look for an existing entry with the same user agent.
var heartbeatEntry = heartbeatsToSend.find(function (hb) { return hb.agent === singleDateHeartbeat.agent; });
const heartbeatEntry = heartbeatsToSend.find(hb => hb.agent === singleDateHeartbeat.agent);
if (!heartbeatEntry) {

@@ -1227,3 +1065,3 @@ // If no entry for this user agent exists, create one.

heartbeatsToSend.pop();
return "break";
break;
}

@@ -1237,3 +1075,3 @@ }

heartbeatEntry.dates.pop();
return "break";
break;
}

@@ -1244,117 +1082,75 @@ }

unsentEntries = unsentEntries.slice(1);
};
try {
for (var heartbeatsCache_1 = tslib.__values(heartbeatsCache), heartbeatsCache_1_1 = heartbeatsCache_1.next(); !heartbeatsCache_1_1.done; heartbeatsCache_1_1 = heartbeatsCache_1.next()) {
var singleDateHeartbeat = heartbeatsCache_1_1.value;
var state_1 = _loop_1(singleDateHeartbeat);
if (state_1 === "break")
break;
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (heartbeatsCache_1_1 && !heartbeatsCache_1_1.done && (_a = heartbeatsCache_1.return)) _a.call(heartbeatsCache_1);
}
finally { if (e_3) throw e_3.error; }
}
return {
heartbeatsToSend: heartbeatsToSend,
unsentEntries: unsentEntries
heartbeatsToSend,
unsentEntries
};
}
var HeartbeatStorageImpl = /** @class */ (function () {
function HeartbeatStorageImpl(app) {
class HeartbeatStorageImpl {
constructor(app) {
this.app = app;
this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
}
HeartbeatStorageImpl.prototype.runIndexedDBEnvironmentCheck = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
if (!util.isIndexedDBAvailable()) {
return [2 /*return*/, false];
}
else {
return [2 /*return*/, util.validateIndexedDBOpenable()
.then(function () { return true; })
.catch(function () { return false; })];
}
});
});
};
async runIndexedDBEnvironmentCheck() {
if (!util.isIndexedDBAvailable()) {
return false;
}
else {
return util.validateIndexedDBOpenable()
.then(() => true)
.catch(() => false);
}
}
/**
* Read all heartbeats.
*/
HeartbeatStorageImpl.prototype.read = function () {
return tslib.__awaiter(this, void 0, void 0, function () {
var canUseIndexedDB, idbHeartbeatObject;
return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._canUseIndexedDBPromise];
case 1:
canUseIndexedDB = _a.sent();
if (!!canUseIndexedDB) return [3 /*break*/, 2];
return [2 /*return*/, { heartbeats: [] }];
case 2: return [4 /*yield*/, readHeartbeatsFromIndexedDB(this.app)];
case 3:
idbHeartbeatObject = _a.sent();
if (idbHeartbeatObject === null || idbHeartbeatObject === void 0 ? void 0 : idbHeartbeatObject.heartbeats) {
return [2 /*return*/, idbHeartbeatObject];
}
else {
return [2 /*return*/, { heartbeats: [] }];
}
case 4: return [2 /*return*/];
}
});
});
};
async read() {
const canUseIndexedDB = await this._canUseIndexedDBPromise;
if (!canUseIndexedDB) {
return { heartbeats: [] };
}
else {
const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);
if (idbHeartbeatObject === null || idbHeartbeatObject === void 0 ? void 0 : idbHeartbeatObject.heartbeats) {
return idbHeartbeatObject;
}
else {
return { heartbeats: [] };
}
}
}
// overwrite the storage with the provided heartbeats
HeartbeatStorageImpl.prototype.overwrite = function (heartbeatsObject) {
async overwrite(heartbeatsObject) {
var _a;
return tslib.__awaiter(this, void 0, void 0, function () {
var canUseIndexedDB, existingHeartbeatsObject;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this._canUseIndexedDBPromise];
case 1:
canUseIndexedDB = _b.sent();
if (!!canUseIndexedDB) return [3 /*break*/, 2];
return [2 /*return*/];
case 2: return [4 /*yield*/, this.read()];
case 3:
existingHeartbeatsObject = _b.sent();
return [2 /*return*/, writeHeartbeatsToIndexedDB(this.app, {
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
heartbeats: heartbeatsObject.heartbeats
})];
}
const canUseIndexedDB = await this._canUseIndexedDBPromise;
if (!canUseIndexedDB) {
return;
}
else {
const existingHeartbeatsObject = await this.read();
return writeHeartbeatsToIndexedDB(this.app, {
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
heartbeats: heartbeatsObject.heartbeats
});
});
};
}
}
// add heartbeats
HeartbeatStorageImpl.prototype.add = function (heartbeatsObject) {
async add(heartbeatsObject) {
var _a;
return tslib.__awaiter(this, void 0, void 0, function () {
var canUseIndexedDB, existingHeartbeatsObject;
return tslib.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this._canUseIndexedDBPromise];
case 1:
canUseIndexedDB = _b.sent();
if (!!canUseIndexedDB) return [3 /*break*/, 2];
return [2 /*return*/];
case 2: return [4 /*yield*/, this.read()];
case 3:
existingHeartbeatsObject = _b.sent();
return [2 /*return*/, writeHeartbeatsToIndexedDB(this.app, {
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
heartbeats: tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(existingHeartbeatsObject.heartbeats), false), tslib.__read(heartbeatsObject.heartbeats), false)
})];
}
const canUseIndexedDB = await this._canUseIndexedDBPromise;
if (!canUseIndexedDB) {
return;
}
else {
const existingHeartbeatsObject = await this.read();
return writeHeartbeatsToIndexedDB(this.app, {
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
heartbeats: [
...existingHeartbeatsObject.heartbeats,
...heartbeatsObject.heartbeats
]
});
});
};
return HeartbeatStorageImpl;
}());
}
}
}
/**

@@ -1389,8 +1185,8 @@ * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped

function registerCoreComponents(variant) {
_registerComponent(new component.Component('platform-logger', function (container) { return new PlatformLoggerServiceImpl(container); }, "PRIVATE" /* ComponentType.PRIVATE */));
_registerComponent(new component.Component('heartbeat', function (container) { return new HeartbeatServiceImpl(container); }, "PRIVATE" /* ComponentType.PRIVATE */));
_registerComponent(new component.Component('platform-logger', container => new PlatformLoggerServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
_registerComponent(new component.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
// Register `app` package.
registerVersion(name$q, version$1, variant);
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
registerVersion(name$q, version$1, 'cjs5');
// BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation
registerVersion(name$q, version$1, 'cjs2017');
// Register platform SDK identifier (no version).

@@ -1397,0 +1193,0 @@ registerVersion('fire-js', '');

{
"name": "@firebase/app",
"version": "0.10.13",
"version": "0.10.14-20241017211210",
"description": "The primary entrypoint to the Firebase JS SDK",

@@ -9,3 +9,2 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",

"module": "dist/esm/index.esm2017.js",
"esm5": "dist/esm/index.esm5.js",
"exports": {

@@ -15,3 +14,2 @@ ".": {

"require": "./dist/index.cjs.js",
"esm5": "./dist/esm/index.esm5.js",
"default": "./dist/esm/index.esm2017.js"

@@ -44,5 +42,5 @@ },

"dependencies": {
"@firebase/util": "1.10.0",
"@firebase/logger": "0.4.2",
"@firebase/component": "0.6.9",
"@firebase/util": "1.10.1-20241017211210",
"@firebase/logger": "0.4.3-20241017211210",
"@firebase/component": "0.6.10-20241017211210",
"idb": "7.1.1",

@@ -74,3 +72,6 @@ "tslib": "^2.1.0"

"reportDir": "./coverage/node"
},
"engines": {
"node": ">=18.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc