Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-rum-core - npm Package Compare versions

Comparing version 2.13.0 to 2.14.0

2

cjs/boot/buildEnv.js

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

datacenter: 'us',
sdkVersion: '2.13.0',
sdkVersion: '2.14.0',
};
//# sourceMappingURL=buildEnv.js.map

@@ -58,2 +58,3 @@ import { Configuration, Duration, Omit, RelativeTime } from '@datadog/browser-core';

export declare function supportPerformanceTimingEvent(entryType: string): boolean;
export declare function supportPerformanceEntry(): boolean;
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: Configuration): void;

@@ -60,0 +61,0 @@ export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.retrieveInitialDocumentResourceTiming = exports.startPerformanceCollection = exports.supportPerformanceTimingEvent = void 0;
exports.retrieveInitialDocumentResourceTiming = exports.startPerformanceCollection = exports.supportPerformanceEntry = exports.supportPerformanceTimingEvent = void 0;
var tslib_1 = require("tslib");

@@ -18,2 +18,7 @@ var browser_core_1 = require("@datadog/browser-core");

exports.supportPerformanceTimingEvent = supportPerformanceTimingEvent;
function supportPerformanceEntry() {
// Safari 10 doesn't support PerformanceEntry
return typeof PerformanceEntry === 'function';
}
exports.supportPerformanceEntry = supportPerformanceEntry;
function startPerformanceCollection(lifeCycle, configuration) {

@@ -20,0 +25,0 @@ retrieveInitialDocumentResourceTiming(function (timing) {

@@ -36,3 +36,4 @@ "use strict";

var stackTrace = error instanceof Error ? browser_core_1.computeStackTrace(error) : undefined;
return tslib_1.__assign({ startClocks: startClocks, source: source, originalError: error }, browser_core_1.formatUnknownError(stackTrace, error, 'Provided'));
return tslib_1.__assign(tslib_1.__assign({ startClocks: startClocks,
source: source, originalError: error }, browser_core_1.formatUnknownError(stackTrace, error, 'Provided')), { handling: browser_core_1.ErrorHandling.HANDLED });
}

@@ -55,2 +56,3 @@ function processError(error, foregroundContexts) {

type: error.type,
handling: error.handling,
},

@@ -57,0 +59,0 @@ type: rawRumEvent_types_1.RumEventType.ERROR,

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

var browser_core_1 = require("@datadog/browser-core");
var performanceCollection_1 = require("../../../browser/performanceCollection");
var rawRumEvent_types_1 = require("../../../rawRumEvent.types");

@@ -46,3 +47,3 @@ var lifeCycle_1 = require("../../lifeCycle");

domainContext: {
performanceEntry: matchingTiming instanceof PerformanceEntry ? matchingTiming.toJSON() : matchingTiming,
performanceEntry: matchingTiming && toPerformanceEntryRepresentation(matchingTiming),
xhr: request.xhr,

@@ -74,3 +75,3 @@ response: request.response,

domainContext: {
performanceEntry: entry instanceof PerformanceEntry ? entry.toJSON() : entry,
performanceEntry: toPerformanceEntryRepresentation(entry),
},

@@ -99,2 +100,8 @@ };

}
function toPerformanceEntryRepresentation(entry) {
if (performanceCollection_1.supportPerformanceEntry() && entry instanceof PerformanceEntry) {
entry.toJSON();
}
return entry;
}
//# sourceMappingURL=resourceCollection.js.map

@@ -33,2 +33,8 @@ "use strict";

function startViewLifeCycle() {
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
// Renew view on session renewal
currentView = trackViewChange(undefined, currentView.name);
});
// End the current view on page unload

@@ -57,8 +63,2 @@ lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.BEFORE_UNLOAD, function () {

function startAutomaticViewCollection() {
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
// Renew view on session renewal
currentView = trackViewChange();
});
return trackLocationChanges_1.trackLocationChanges(function () {

@@ -77,6 +77,2 @@ if (trackLocationChanges_1.areDifferentLocation(currentView.getLocation(), location)) {

function startManualViewCollection() {
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
});
return trackLocationChanges_1.trackLocationChanges(function () {

@@ -140,2 +136,3 @@ currentView.updateLocation(location);

return {
name: name,
scheduleUpdate: scheduleViewUpdate,

@@ -142,0 +139,0 @@ end: function (clocks) {

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

import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp, Omit } from '@datadog/browser-core';
import { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, Omit } from '@datadog/browser-core';
export declare enum RumEventType {

@@ -50,2 +50,3 @@ ACTION = "action",

message: string;
handling?: ErrorHandling;
};

@@ -52,0 +53,0 @@ view?: {

@@ -133,2 +133,6 @@ /**

/**
* Whether the error has been handled manually in the source code or not
*/
readonly handling?: 'handled' | 'unhandled';
/**
* Resource properties of the error

@@ -531,2 +535,26 @@ */

}[];
/**
* Average memory used during the view lifetime (in bytes)
*/
readonly memory_average?: number;
/**
* Peak memory used during the view lifetime (in bytes)
*/
readonly memory_max?: number;
/**
* Total number of cpu ticks during the view’s lifetime
*/
readonly cpu_ticks_count?: number;
/**
* Average number of cpu ticks per second during the view’s lifetime
*/
readonly cpu_ticks_per_second?: number;
/**
* Average refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_average?: number;
/**
* Minimum refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_min?: number;
[k: string]: unknown;

@@ -533,0 +561,0 @@ };

export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '2.13.0',
sdkVersion: '2.14.0',
};
//# sourceMappingURL=buildEnv.js.map

@@ -58,2 +58,3 @@ import { Configuration, Duration, Omit, RelativeTime } from '@datadog/browser-core';

export declare function supportPerformanceTimingEvent(entryType: string): boolean;
export declare function supportPerformanceEntry(): boolean;
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: Configuration): void;

@@ -60,0 +61,0 @@ export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void;

@@ -14,2 +14,6 @@ import { __assign } from "tslib";

}
export function supportPerformanceEntry() {
// Safari 10 doesn't support PerformanceEntry
return typeof PerformanceEntry === 'function';
}
export function startPerformanceCollection(lifeCycle, configuration) {

@@ -16,0 +20,0 @@ retrieveInitialDocumentResourceTiming(function (timing) {

import { __assign } from "tslib";
import { computeStackTrace, formatUnknownError, startAutomaticErrorCollection, generateUUID, } from '@datadog/browser-core';
import { computeStackTrace, formatUnknownError, startAutomaticErrorCollection, generateUUID, ErrorHandling, } from '@datadog/browser-core';
import { RumEventType } from '../../../rawRumEvent.types';

@@ -31,3 +31,4 @@ import { LifeCycleEventType } from '../../lifeCycle';

var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined;
return __assign({ startClocks: startClocks, source: source, originalError: error }, formatUnknownError(stackTrace, error, 'Provided'));
return __assign(__assign({ startClocks: startClocks,
source: source, originalError: error }, formatUnknownError(stackTrace, error, 'Provided')), { handling: ErrorHandling.HANDLED });
}

@@ -50,2 +51,3 @@ function processError(error, foregroundContexts) {

type: error.type,
handling: error.handling,
},

@@ -52,0 +54,0 @@ type: RumEventType.ERROR,

import { __assign } from "tslib";
import { combine, generateUUID, RequestType, ResourceType, toServerDuration, relativeToClocks, } from '@datadog/browser-core';
import { RumEventType } from '../../../rawRumEvent.types';
import { supportPerformanceEntry, } from '../../../browser/performanceCollection';
import { RumEventType, } from '../../../rawRumEvent.types';
import { LifeCycleEventType } from '../../lifeCycle';

@@ -41,3 +42,3 @@ import { matchRequestTiming } from './matchRequestTiming';

domainContext: {
performanceEntry: matchingTiming instanceof PerformanceEntry ? matchingTiming.toJSON() : matchingTiming,
performanceEntry: matchingTiming && toPerformanceEntryRepresentation(matchingTiming),
xhr: request.xhr,

@@ -69,3 +70,3 @@ response: request.response,

domainContext: {
performanceEntry: entry instanceof PerformanceEntry ? entry.toJSON() : entry,
performanceEntry: toPerformanceEntryRepresentation(entry),
},

@@ -94,2 +95,8 @@ };

}
function toPerformanceEntryRepresentation(entry) {
if (supportPerformanceEntry() && entry instanceof PerformanceEntry) {
entry.toJSON();
}
return entry;
}
//# sourceMappingURL=resourceCollection.js.map

@@ -30,2 +30,8 @@ import { __assign } from "tslib";

function startViewLifeCycle() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
// Renew view on session renewal
currentView = trackViewChange(undefined, currentView.name);
});
// End the current view on page unload

@@ -54,8 +60,2 @@ lifeCycle.subscribe(LifeCycleEventType.BEFORE_UNLOAD, function () {

function startAutomaticViewCollection() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
// Renew view on session renewal
currentView = trackViewChange();
});
return trackLocationChanges(function () {

@@ -74,6 +74,2 @@ if (areDifferentLocation(currentView.getLocation(), location)) {

function startManualViewCollection() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {
// do not trigger view update to avoid wrong data
currentView.end();
});
return trackLocationChanges(function () {

@@ -136,2 +132,3 @@ currentView.updateLocation(location);

return {
name: name,
scheduleUpdate: scheduleViewUpdate,

@@ -138,0 +135,0 @@ end: function (clocks) {

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

import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp, Omit } from '@datadog/browser-core';
import { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, Omit } from '@datadog/browser-core';
export declare enum RumEventType {

@@ -50,2 +50,3 @@ ACTION = "action",

message: string;
handling?: ErrorHandling;
};

@@ -52,0 +53,0 @@ view?: {

@@ -133,2 +133,6 @@ /**

/**
* Whether the error has been handled manually in the source code or not
*/
readonly handling?: 'handled' | 'unhandled';
/**
* Resource properties of the error

@@ -531,2 +535,26 @@ */

}[];
/**
* Average memory used during the view lifetime (in bytes)
*/
readonly memory_average?: number;
/**
* Peak memory used during the view lifetime (in bytes)
*/
readonly memory_max?: number;
/**
* Total number of cpu ticks during the view’s lifetime
*/
readonly cpu_ticks_count?: number;
/**
* Average number of cpu ticks per second during the view’s lifetime
*/
readonly cpu_ticks_per_second?: number;
/**
* Average refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_average?: number;
/**
* Minimum refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_min?: number;
[k: string]: unknown;

@@ -533,0 +561,0 @@ };

{
"name": "@datadog/browser-rum-core",
"version": "2.13.0",
"version": "2.14.0",
"license": "Apache-2.0",

@@ -15,3 +15,3 @@ "main": "cjs/index.js",

"dependencies": {
"@datadog/browser-core": "2.13.0",
"@datadog/browser-core": "2.14.0",
"tslib": "^1.10.0"

@@ -27,3 +27,3 @@ },

},
"gitHead": "fac76433fe8eb0f107c47628b88fedc918eea641"
"gitHead": "0f132b95b3071926e6d63b8dc70389da93840553"
}

@@ -101,2 +101,7 @@ import {

export function supportPerformanceEntry() {
// Safari 10 doesn't support PerformanceEntry
return typeof PerformanceEntry === 'function'
}
export function startPerformanceCollection(lifeCycle: LifeCycle, configuration: Configuration) {

@@ -103,0 +108,0 @@ retrieveInitialDocumentResourceTiming((timing) => {

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

import { ErrorSource, RelativeTime, TimeStamp } from '@datadog/browser-core'
import { ErrorHandling, ErrorSource, RelativeTime, TimeStamp } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../../../test/specHelper'

@@ -50,2 +50,3 @@ import { RumEventType } from '../../../rawRumEvent.types'

type: 'Error',
handling: ErrorHandling.HANDLED,
},

@@ -153,2 +154,3 @@ type: RumEventType.ERROR,

type: 'foo',
handling: undefined,
},

@@ -155,0 +157,0 @@ view: {

@@ -10,2 +10,3 @@ import {

generateUUID,
ErrorHandling,
} from '@datadog/browser-core'

@@ -63,3 +64,9 @@ import { CommonContext, RawRumErrorEvent, RumEventType } from '../../../rawRumEvent.types'

const stackTrace = error instanceof Error ? computeStackTrace(error) : undefined
return { startClocks, source, originalError: error, ...formatUnknownError(stackTrace, error, 'Provided') }
return {
startClocks,
source,
originalError: error,
...formatUnknownError(stackTrace, error, 'Provided'),
handling: ErrorHandling.HANDLED,
}
}

@@ -86,2 +93,3 @@

type: error.type,
handling: error.handling,
},

@@ -88,0 +96,0 @@ type: RumEventType.ERROR as const,

@@ -9,4 +9,14 @@ import {

} from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { RawRumResourceEvent, RumEventType } from '../../../rawRumEvent.types'
import {
RumPerformanceEntry,
RumPerformanceResourceTiming,
supportPerformanceEntry,
} from '../../../browser/performanceCollection'
import {
PerformanceEntryRepresentation,
RawRumResourceEvent,
RumEventType,
RumFetchResourceEventDomainContext,
RumXhrResourceEventDomainContext,
} from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from '../../lifeCycle'

@@ -67,3 +77,3 @@ import { RequestCompleteEvent } from '../../requestCollection'

domainContext: {
performanceEntry: matchingTiming instanceof PerformanceEntry ? matchingTiming.toJSON() : matchingTiming,
performanceEntry: matchingTiming && toPerformanceEntryRepresentation(matchingTiming),
xhr: request.xhr,

@@ -74,3 +84,3 @@ response: request.response,

error: request.error,
},
} as RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext,
}

@@ -102,3 +112,3 @@ }

domainContext: {
performanceEntry: entry instanceof PerformanceEntry ? entry.toJSON() : entry,
performanceEntry: toPerformanceEntryRepresentation(entry),
},

@@ -134,1 +144,8 @@ }

}
function toPerformanceEntryRepresentation(entry: RumPerformanceEntry): PerformanceEntryRepresentation {
if (supportPerformanceEntry() && entry instanceof PerformanceEntry) {
entry.toJSON()
}
return entry as PerformanceEntryRepresentation
}

@@ -172,27 +172,2 @@ import { Duration, RelativeTime, timeStampNow, display, relativeToClocks } from '@datadog/browser-core'

describe('renew session', () => {
it('should create new view on renew session', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewCreateCount } = viewTest
expect(getViewCreateCount()).toBe(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewCreateCount()).toBe(2)
})
it('should not update the current view when the session is renewed', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewUpdateCount, getViewUpdate } = viewTest
expect(getViewUpdateCount()).toEqual(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewUpdateCount()).toEqual(2)
expect(getViewUpdate(0).id).not.toBe(getViewUpdate(1).id)
})
})
describe('view referrer', () => {

@@ -284,26 +259,2 @@ it('should set the document referrer as referrer for the initial view', () => {

describe('renew session', () => {
it('should not update the current view when the session is renewed', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewUpdateCount } = viewTest
expect(getViewUpdateCount()).toEqual(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewUpdateCount()).toEqual(1)
})
it('should not create new view when the session is renewed', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewCreateCount } = viewTest
expect(getViewCreateCount()).toEqual(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewCreateCount()).toEqual(1)
})
})
describe('view referrer', () => {

@@ -479,2 +430,71 @@ it('should set the document referrer as referrer for the initial view', () => {

describe('renew session', () => {
let setupBuilder: TestSetupBuilder
let viewTest: ViewTest
beforeEach(() => {
setupBuilder = setup()
.withFakeLocation('/foo')
.beforeBuild((buildContext) => {
viewTest = setupViewTest(buildContext, 'initial view name')
return viewTest
})
})
afterEach(() => {
setupBuilder.cleanup()
})
it('should create new view on renew session', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewCreateCount } = viewTest
expect(getViewCreateCount()).toBe(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewCreateCount()).toBe(2)
})
it('should use the current view name for the new view', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewCreateCount, getViewCreate, startView } = viewTest
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
startView('foo')
startView('bar')
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
startView('qux')
history.pushState({}, '', '/bar')
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewCreateCount()).toBe(8)
expect(getViewCreate(0).name).toBe('initial view name')
expect(getViewCreate(1).name).toBe('initial view name')
expect(getViewCreate(2).name).toBe('foo')
expect(getViewCreate(3).name).toBe('bar')
expect(getViewCreate(4).name).toBe('bar')
expect(getViewCreate(5).name).toBe('qux')
expect(getViewCreate(6).name).toBeUndefined()
expect(getViewCreate(7).name).toBeUndefined()
})
it('should not update the current view when the session is renewed', () => {
const { lifeCycle } = setupBuilder.build()
const { getViewUpdateCount, getViewUpdate } = viewTest
expect(getViewUpdateCount()).toEqual(1)
lifeCycle.notify(LifeCycleEventType.SESSION_RENEWED)
expect(getViewUpdateCount()).toEqual(2)
expect(getViewUpdate(0).id).not.toBe(getViewUpdate(1).id)
})
})
describe('view hasReplay', () => {

@@ -481,0 +501,0 @@ let setupBuilder: TestSetupBuilder

@@ -106,2 +106,9 @@ import {

function startViewLifeCycle() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
// do not trigger view update to avoid wrong data
currentView.end()
// Renew view on session renewal
currentView = trackViewChange(undefined, currentView.name)
})
// End the current view on page unload

@@ -138,9 +145,2 @@ lifeCycle.subscribe(LifeCycleEventType.BEFORE_UNLOAD, () => {

function startAutomaticViewCollection() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
// do not trigger view update to avoid wrong data
currentView.end()
// Renew view on session renewal
currentView = trackViewChange()
})
return trackLocationChanges(() => {

@@ -160,7 +160,2 @@ if (areDifferentLocation(currentView.getLocation(), location)) {

function startManualViewCollection() {
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
// do not trigger view update to avoid wrong data
currentView.end()
})
return trackLocationChanges(() => {

@@ -252,2 +247,3 @@ currentView.updateLocation(location)

return {
name,
scheduleUpdate: scheduleViewUpdate,

@@ -254,0 +250,0 @@ end(clocks = clocksNow()) {

@@ -1,2 +0,11 @@

import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp, Omit } from '@datadog/browser-core'
import {
Context,
Duration,
ErrorSource,
ErrorHandling,
ResourceType,
ServerDuration,
TimeStamp,
Omit,
} from '@datadog/browser-core'

@@ -54,2 +63,3 @@ export enum RumEventType {

message: string
handling?: ErrorHandling
}

@@ -56,0 +66,0 @@ view?: {

@@ -135,2 +135,6 @@ /* eslint-disable */

/**
* Whether the error has been handled manually in the source code or not
*/
readonly handling?: 'handled' | 'unhandled'
/**
* Resource properties of the error

@@ -569,2 +573,26 @@ */

}[]
/**
* Average memory used during the view lifetime (in bytes)
*/
readonly memory_average?: number
/**
* Peak memory used during the view lifetime (in bytes)
*/
readonly memory_max?: number
/**
* Total number of cpu ticks during the view’s lifetime
*/
readonly cpu_ticks_count?: number
/**
* Average number of cpu ticks per second during the view’s lifetime
*/
readonly cpu_ticks_per_second?: number
/**
* Average refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_average?: number
/**
* Minimum refresh rate during the view’s lifetime (in frames per second)
*/
readonly refresh_rate_min?: number
[k: string]: unknown

@@ -571,0 +599,0 @@ }

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

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

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