New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/app

Package Overview
Dependencies
Maintainers
4
Versions
3425
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.18-canary.d8aabaf9e to 0.10.18-canary.dafae52af

6

dist/app/src/heartbeatService.d.ts

@@ -20,2 +20,3 @@ /**

import { HeartbeatsByUserAgent, HeartbeatService, HeartbeatsInIndexedDB, HeartbeatStorage, SingleDateHeartbeat } from './types';
export declare const MAX_NUM_STORED_HEARTBEATS = 30;
export declare class HeartbeatServiceImpl implements HeartbeatService {

@@ -85,1 +86,6 @@ private readonly container;

export declare function countBytes(heartbeatsCache: HeartbeatsByUserAgent[]): number;
/**
* Returns the index of the heartbeat with the earliest date.
* If the heartbeats array is empty, -1 is returned.
*/
export declare function getEarliestHeartbeatIdx(heartbeats: SingleDateHeartbeat[]): number;

@@ -20,2 +20,3 @@ /**

import { HeartbeatsByUserAgent, HeartbeatService, HeartbeatsInIndexedDB, HeartbeatStorage, SingleDateHeartbeat } from './types';
export declare const MAX_NUM_STORED_HEARTBEATS = 30;
export declare class HeartbeatServiceImpl implements HeartbeatService {

@@ -85,1 +86,6 @@ private readonly container;

export declare function countBytes(heartbeatsCache: HeartbeatsByUserAgent[]): number;
/**
* Returns the index of the heartbeat with the earliest date.
* If the heartbeats array is empty, -1 is returned.
*/
export declare function getEarliestHeartbeatIdx(heartbeats: SingleDateHeartbeat[]): number;

38

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.18-canary.d8aabaf9e";
const version$1 = "0.10.18-canary.dafae52af";

@@ -133,3 +133,3 @@ /**

const name = "firebase";
const version = "11.2.0-canary.d8aabaf9e";
const version = "11.2.0-canary.dafae52af";

@@ -915,4 +915,3 @@ /**

const MAX_HEADER_BYTES = 1024;
// 30 days
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
const MAX_NUM_STORED_HEARTBEATS = 30;
class HeartbeatServiceImpl {

@@ -971,10 +970,9 @@ constructor(container) {

this._heartbeatsCache.heartbeats.push({ date, agent });
// If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.
// Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.
if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {
const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);
this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);
}
}
// 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);

@@ -1154,2 +1152,20 @@ }

}
/**
* Returns the index of the heartbeat with the earliest date.
* If the heartbeats array is empty, -1 is returned.
*/
function getEarliestHeartbeatIdx(heartbeats) {
if (heartbeats.length === 0) {
return -1;
}
let earliestHeartbeatIdx = 0;
let earliestHeartbeatDate = heartbeats[0].date;
for (let i = 1; i < heartbeats.length; i++) {
if (heartbeats[i].date < earliestHeartbeatDate) {
earliestHeartbeatDate = heartbeats[i].date;
earliestHeartbeatIdx = i;
}
}
return earliestHeartbeatIdx;
}

@@ -1156,0 +1172,0 @@ /**

@@ -64,3 +64,3 @@ 'use strict';

const name$q = "@firebase/app";
const version$1 = "0.10.18-canary.d8aabaf9e";
const version$1 = "0.10.18-canary.dafae52af";

@@ -136,3 +136,3 @@ /**

const name = "firebase";
const version = "11.2.0-canary.d8aabaf9e";
const version = "11.2.0-canary.dafae52af";

@@ -918,4 +918,3 @@ /**

const MAX_HEADER_BYTES = 1024;
// 30 days
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
const MAX_NUM_STORED_HEARTBEATS = 30;
class HeartbeatServiceImpl {

@@ -974,10 +973,9 @@ constructor(container) {

this._heartbeatsCache.heartbeats.push({ date, agent });
// If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.
// Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.
if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {
const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);
this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);
}
}
// 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);

@@ -1157,2 +1155,20 @@ }

}
/**
* Returns the index of the heartbeat with the earliest date.
* If the heartbeats array is empty, -1 is returned.
*/
function getEarliestHeartbeatIdx(heartbeats) {
if (heartbeats.length === 0) {
return -1;
}
let earliestHeartbeatIdx = 0;
let earliestHeartbeatDate = heartbeats[0].date;
for (let i = 1; i < heartbeats.length; i++) {
if (heartbeats[i].date < earliestHeartbeatDate) {
earliestHeartbeatDate = heartbeats[i].date;
earliestHeartbeatIdx = i;
}
}
return earliestHeartbeatIdx;
}

@@ -1159,0 +1175,0 @@ /**

{
"name": "@firebase/app",
"version": "0.10.18-canary.d8aabaf9e",
"version": "0.10.18-canary.dafae52af",
"description": "The primary entrypoint to the Firebase JS SDK",

@@ -40,5 +40,5 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",

"dependencies": {
"@firebase/util": "1.10.3-canary.d8aabaf9e",
"@firebase/logger": "0.4.4-canary.d8aabaf9e",
"@firebase/component": "0.6.12-canary.d8aabaf9e",
"@firebase/util": "1.10.3-canary.dafae52af",
"@firebase/logger": "0.4.4-canary.dafae52af",
"@firebase/component": "0.6.12-canary.dafae52af",
"idb": "7.1.1",

@@ -49,3 +49,3 @@ "tslib": "^2.1.0"

"devDependencies": {
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-json": "6.1.0",
"rollup": "2.79.1",

@@ -52,0 +52,0 @@ "rollup-plugin-replace": "2.2.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