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

@openreplay/tracker

Package Overview
Dependencies
Maintainers
4
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openreplay/tracker - npm Package Compare versions

Comparing version 3.5.16-beta.2 to 3.5.16-beta.3

6

cjs/app/index.d.ts
import type Message from "../common/messages.js";
import Nodes, { CheckOptions } from "./nodes.js";
import Nodes from "./nodes.js";
import Sanitizer from "./sanitizer.js";

@@ -49,6 +49,4 @@ import Ticker from "./ticker.js";

sessionStorage: Storage;
maxMemorySize: number;
memoryCheckInterval: number;
onStart?: StartCallback;
} & WebworkerOptions & CheckOptions;
} & WebworkerOptions;
export declare type Options = AppOptions & ObserverOptions & SanitizerOptions;

@@ -55,0 +53,0 @@ export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";

@@ -30,3 +30,2 @@ "use strict";

// } ?? maybe onStart is good
// private gc?: NodeJS.Timer = undefined;
this.messages = [];

@@ -37,3 +36,3 @@ this.startCallbacks = [];

this.activityState = ActivityState.NotActive;
this.version = '3.5.16-beta.2'; // TODO: version compatability check inside each plugin.
this.version = '3.5.16-beta.3'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -54,8 +53,6 @@ this.options = Object.assign({

sessionStorage: window.sessionStorage,
maxMemorySize: 550 * 1e6,
memoryCheckInterval: 2 * 60 * 1000,
}, options);
this.revID = this.options.revID;
this.sanitizer = new sanitizer_js_1.default(this, options);
this.nodes = new nodes_js_1.default(this.options.node_id, this.options.maxMemorySize, this.options.memoryCheckInterval);
this.nodes = new nodes_js_1.default(this.options.node_id);
this.observer = new top_observer_js_1.default(this, options);

@@ -326,12 +323,2 @@ this.ticker = new ticker_js_1.default(this);

this.notify.log("OpenReplay tracking started.");
// // GC
// if (!this.gc) {
// this.gc = setInterval(() => {
// console.log('checking')
// // @ts-ignore
// if (window.performance.memory.usedJSHeapSize > this.options.maxMemorySize) {
// this.restart();
// }
// }, this.options.memoryCheckInterval)
// }
// get rid of onStart ?

@@ -373,3 +360,2 @@ if (typeof this.options.onStart === 'function') {

try {
// this.gc && clearInterval(this.gc)
this.sanitizer.clear();

@@ -376,0 +362,0 @@ this.observer.disconnect();

@@ -1,7 +0,2 @@

/// <reference types="node" resolution-mode="require"/>
declare type NodeCallback = (node: Node, isStart: boolean) => void;
export interface CheckOptions {
maxMemorySize: number;
memoryCheckInterval: number;
}
export default class Nodes {

@@ -12,4 +7,3 @@ private readonly node_id;

private readonly elementListeners;
gc: NodeJS.Timer | undefined;
constructor(node_id: string, maxMemorySize: CheckOptions["maxMemorySize"], memoryCheckInterval: CheckOptions["memoryCheckInterval"]);
constructor(node_id: string);
attachNodeCallback(nodeCallback: NodeCallback): void;

@@ -16,0 +10,0 @@ attachElementListener(type: string, node: Element, elementListener: EventListener): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Nodes {
constructor(node_id, maxMemorySize, memoryCheckInterval) {
constructor(node_id) {
this.node_id = node_id;

@@ -9,8 +9,2 @@ this.nodes = [];

this.elementListeners = new Map();
this.gc = setInterval(() => {
// @ts-ignore should use settings object here
if (window.performance.memory.usedJSHeapSize > maxMemorySize) {
this.cleanTree();
}
}, memoryCheckInterval);
}

@@ -92,8 +86,4 @@ attachNodeCallback(nodeCallback) {

this.nodes.length = 0;
if (this.gc) {
clearInterval(this.gc);
this.gc = undefined;
}
}
}
exports.default = Nodes;

@@ -35,2 +35,7 @@ "use strict";

*/
/*
Nikita:
- rn we only send unbind event for parent (all child nodes will be cut in the live replay anyways)
to prevent sending 1k+ unbinds for child nodes and making replay file bigger than it should be
*/
var RecentsType;

@@ -41,2 +46,3 @@ (function (RecentsType) {

RecentsType[RecentsType["Changed"] = 2] = "Changed";
RecentsType[RecentsType["RemovedChild"] = 3] = "RemovedChild";
})(RecentsType || (RecentsType = {}));

@@ -61,3 +67,3 @@ class Observer {

for (let i = 0; i < mutation.removedNodes.length; i++) {
this.bindTree(mutation.removedNodes[i]);
this.bindTree(mutation.removedNodes[i], true);
}

@@ -158,3 +164,3 @@ for (let i = 0; i < mutation.addedNodes.length; i++) {

}
bindNode(node) {
bindNode(node, isRemove = false) {
const [id, isNew] = this.app.nodes.registerNode(node);

@@ -165,6 +171,6 @@ if (isNew) {

else if (this.recents.get(id) !== RecentsType.New) { // can we do just `else` here?
this.recents.set(id, RecentsType.Removed);
this.recents.set(id, isRemove ? RecentsType.RemovedChild : RecentsType.Removed);
}
}
bindTree(node) {
bindTree(node, isRemove = false) {
if (!isObservable(node)) {

@@ -175,3 +181,4 @@ return;

const walker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, {
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) !== undefined
acceptNode: (node) => isIgnored(node)
|| (this.app.nodes.getID(node) !== undefined && !isRemove)
? NodeFilter.FILTER_REJECT

@@ -183,3 +190,3 @@ : NodeFilter.FILTER_ACCEPT,

while (walker.nextNode()) {
this.bindNode(walker.currentNode);
this.bindNode(walker.currentNode, isRemove);
}

@@ -186,0 +193,0 @@ }

@@ -130,3 +130,3 @@ "use strict";

req.send(JSON.stringify({
trackerVersion: '3.5.16-beta.2',
trackerVersion: '3.5.16-beta.3',
projectKey: options.projectKey,

@@ -133,0 +133,0 @@ doNotTrack,

@@ -117,7 +117,7 @@ "use strict";

const node = app.nodes.getNode(id);
if (!isTextEditable(node)) {
if (node && !isTextEditable(node)) {
inputValues.delete(id);
return;
}
if (value !== node.value) {
if (node && value !== node.value) {
inputValues.set(id, node.value);

@@ -133,7 +133,7 @@ if (!registeredTargets.has(id)) {

const node = app.nodes.getNode(id);
if (!isCheckable(node)) {
if (node && !isCheckable(node)) {
checkableValues.delete(id);
return;
}
if (checked !== node.checked) {
if (node && checked !== node.checked) {
checkableValues.set(id, node.checked);

@@ -140,0 +140,0 @@ app.send(new messages_js_1.SetInputChecked(id, node.checked));

import type Message from "../common/messages.js";
import Nodes, { CheckOptions } from "./nodes.js";
import Nodes from "./nodes.js";
import Sanitizer from "./sanitizer.js";

@@ -49,6 +49,4 @@ import Ticker from "./ticker.js";

sessionStorage: Storage;
maxMemorySize: number;
memoryCheckInterval: number;
onStart?: StartCallback;
} & WebworkerOptions & CheckOptions;
} & WebworkerOptions;
export declare type Options = AppOptions & ObserverOptions & SanitizerOptions;

@@ -55,0 +53,0 @@ export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";

@@ -27,3 +27,2 @@ import { Timestamp, Metadata, UserID } from "../common/messages.js";

// } ?? maybe onStart is good
// private gc?: NodeJS.Timer = undefined;
this.messages = [];

@@ -34,3 +33,3 @@ this.startCallbacks = [];

this.activityState = ActivityState.NotActive;
this.version = '3.5.16-beta.2'; // TODO: version compatability check inside each plugin.
this.version = '3.5.16-beta.3'; // TODO: version compatability check inside each plugin.
this.projectKey = projectKey;

@@ -51,8 +50,6 @@ this.options = Object.assign({

sessionStorage: window.sessionStorage,
maxMemorySize: 550 * 1e6,
memoryCheckInterval: 2 * 60 * 1000,
}, options);
this.revID = this.options.revID;
this.sanitizer = new Sanitizer(this, options);
this.nodes = new Nodes(this.options.node_id, this.options.maxMemorySize, this.options.memoryCheckInterval);
this.nodes = new Nodes(this.options.node_id);
this.observer = new Observer(this, options);

@@ -323,12 +320,2 @@ this.ticker = new Ticker(this);

this.notify.log("OpenReplay tracking started.");
// // GC
// if (!this.gc) {
// this.gc = setInterval(() => {
// console.log('checking')
// // @ts-ignore
// if (window.performance.memory.usedJSHeapSize > this.options.maxMemorySize) {
// this.restart();
// }
// }, this.options.memoryCheckInterval)
// }
// get rid of onStart ?

@@ -370,3 +357,2 @@ if (typeof this.options.onStart === 'function') {

try {
// this.gc && clearInterval(this.gc)
this.sanitizer.clear();

@@ -373,0 +359,0 @@ this.observer.disconnect();

@@ -1,7 +0,2 @@

/// <reference types="node" resolution-mode="require"/>
declare type NodeCallback = (node: Node, isStart: boolean) => void;
export interface CheckOptions {
maxMemorySize: number;
memoryCheckInterval: number;
}
export default class Nodes {

@@ -12,4 +7,3 @@ private readonly node_id;

private readonly elementListeners;
gc: NodeJS.Timer | undefined;
constructor(node_id: string, maxMemorySize: CheckOptions["maxMemorySize"], memoryCheckInterval: CheckOptions["memoryCheckInterval"]);
constructor(node_id: string);
attachNodeCallback(nodeCallback: NodeCallback): void;

@@ -16,0 +10,0 @@ attachElementListener(type: string, node: Element, elementListener: EventListener): void;

export default class Nodes {
constructor(node_id, maxMemorySize, memoryCheckInterval) {
constructor(node_id) {
this.node_id = node_id;

@@ -7,8 +7,2 @@ this.nodes = [];

this.elementListeners = new Map();
this.gc = setInterval(() => {
// @ts-ignore should use settings object here
if (window.performance.memory.usedJSHeapSize > maxMemorySize) {
this.cleanTree();
}
}, memoryCheckInterval);
}

@@ -90,7 +84,3 @@ attachNodeCallback(nodeCallback) {

this.nodes.length = 0;
if (this.gc) {
clearInterval(this.gc);
this.gc = undefined;
}
}
}

@@ -33,2 +33,7 @@ import { RemoveNodeAttribute, SetNodeAttribute, SetNodeAttributeURLBased, SetCSSDataURLBased, SetNodeData, CreateTextNode, CreateElementNode, MoveNode, RemoveNode, } from "../../common/messages.js";

*/
/*
Nikita:
- rn we only send unbind event for parent (all child nodes will be cut in the live replay anyways)
to prevent sending 1k+ unbinds for child nodes and making replay file bigger than it should be
*/
var RecentsType;

@@ -39,2 +44,3 @@ (function (RecentsType) {

RecentsType[RecentsType["Changed"] = 2] = "Changed";
RecentsType[RecentsType["RemovedChild"] = 3] = "RemovedChild";
})(RecentsType || (RecentsType = {}));

@@ -59,3 +65,3 @@ export default class Observer {

for (let i = 0; i < mutation.removedNodes.length; i++) {
this.bindTree(mutation.removedNodes[i]);
this.bindTree(mutation.removedNodes[i], true);
}

@@ -156,3 +162,3 @@ for (let i = 0; i < mutation.addedNodes.length; i++) {

}
bindNode(node) {
bindNode(node, isRemove = false) {
const [id, isNew] = this.app.nodes.registerNode(node);

@@ -163,6 +169,6 @@ if (isNew) {

else if (this.recents.get(id) !== RecentsType.New) { // can we do just `else` here?
this.recents.set(id, RecentsType.Removed);
this.recents.set(id, isRemove ? RecentsType.RemovedChild : RecentsType.Removed);
}
}
bindTree(node) {
bindTree(node, isRemove = false) {
if (!isObservable(node)) {

@@ -173,3 +179,4 @@ return;

const walker = document.createTreeWalker(node, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, {
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) !== undefined
acceptNode: (node) => isIgnored(node)
|| (this.app.nodes.getID(node) !== undefined && !isRemove)
? NodeFilter.FILTER_REJECT

@@ -181,3 +188,3 @@ : NodeFilter.FILTER_ACCEPT,

while (walker.nextNode()) {
this.bindNode(walker.currentNode);
this.bindNode(walker.currentNode, isRemove);
}

@@ -184,0 +191,0 @@ }

@@ -126,3 +126,3 @@ import App, { DEFAULT_INGEST_POINT } from "./app/index.js";

req.send(JSON.stringify({
trackerVersion: '3.5.16-beta.2',
trackerVersion: '3.5.16-beta.3',
projectKey: options.projectKey,

@@ -129,0 +129,0 @@ doNotTrack,

@@ -113,7 +113,7 @@ import { normSpaces, IN_BROWSER, getLabelAttribute, hasOpenreplayAttribute, } from "../utils.js";

const node = app.nodes.getNode(id);
if (!isTextEditable(node)) {
if (node && !isTextEditable(node)) {
inputValues.delete(id);
return;
}
if (value !== node.value) {
if (node && value !== node.value) {
inputValues.set(id, node.value);

@@ -129,7 +129,7 @@ if (!registeredTargets.has(id)) {

const node = app.nodes.getNode(id);
if (!isCheckable(node)) {
if (node && !isCheckable(node)) {
checkableValues.delete(id);
return;
}
if (checked !== node.checked) {
if (node && checked !== node.checked) {
checkableValues.set(id, node.checked);

@@ -136,0 +136,0 @@ app.send(new SetInputChecked(id, node.checked));

{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "3.5.16-beta.2",
"version": "3.5.16-beta.3",
"keywords": [

@@ -6,0 +6,0 @@ "logging",

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