Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
0
Maintainers
1
Versions
249
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.35.0 to 4.36.0

2

cjs/boot/init.js

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

var publicApi = (0, utils_1.assign)({
version: "4.35.0",
version: "4.36.0",
// This API method is intentionally not monitored, since the only thing executed is the

@@ -12,0 +12,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and

@@ -6,3 +6,3 @@ import { Observable } from '../tools/observable';

startClocks: ClocksState;
input: RequestInfo;
input: unknown;
init?: RequestInit;

@@ -9,0 +9,0 @@ url: string;

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

function beforeSend(observable, input, init) {
var method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET';
var url = (0, urlPolyfill_1.normalizeUrl)((typeof input === 'object' && input.url) || input);
var method = (init && init.method) || (input instanceof Request && input.method) || 'GET';
var url = input instanceof Request ? input.url : (0, urlPolyfill_1.normalizeUrl)(String(input));
var startClocks = (0, timeUtils_1.clocksNow)();

@@ -45,0 +45,0 @@ var context = {

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

var clientToken = _a.clientToken, internalAnalyticsSubdomain = _a.internalAnalyticsSubdomain;
var tags = ["sdk_version:".concat("4.35.0"), "api:".concat(api)].concat(configurationTags);
var tags = ["sdk_version:".concat("4.36.0"), "api:".concat(api)].concat(configurationTags);
if (flushReason && (0, experimentalFeatures_1.isExperimentalFeatureEnabled)('collect_flush_reason')) {

@@ -81,3 +81,3 @@ tags.push("flush_reason:".concat(flushReason));

"dd-api-key=".concat(clientToken),
"dd-evp-origin-version=".concat(encodeURIComponent("4.35.0")),
"dd-evp-origin-version=".concat(encodeURIComponent("4.36.0")),
'dd-evp-origin=browser',

@@ -84,0 +84,0 @@ "dd-request-id=".concat((0, utils_1.generateUUID)()),

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

service: telemetryService,
version: "4.35.0",
version: "4.36.0",
source: 'browser',

@@ -50,0 +50,0 @@ _dd: {

@@ -22,3 +22,3 @@ export { Configuration, InitConfiguration, buildCookieOptions, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, isExperimentalFeatureEnabled, updateExperimentalFeatures, resetExperimentalFeatures, serializeConfiguration, } from './domain/configuration';

export { instrumentMethod, instrumentMethodAndCallOriginal, instrumentSetter } from './tools/instrumentMethod';
export { ErrorSource, ErrorHandling, computeRawError, createHandlingStack, RawError, RawErrorCause, ErrorWithCause, toStackTraceString, getFileFromStackTraceString, } from './tools/error';
export { ErrorSource, ErrorHandling, computeRawError, createHandlingStack, RawError, RawErrorCause, ErrorWithCause, toStackTraceString, getFileFromStackTraceString, NO_ERROR_STACK_PRESENT_MESSAGE, PROVIDED_ERROR_MESSAGE_PREFIX, } from './tools/error';
export { Context, ContextArray, ContextValue } from './tools/context';

@@ -25,0 +25,0 @@ export { areCookiesAuthorized, getCookie, setCookie, deleteCookie, COOKIE_ACCESS_DELAY } from './browser/cookie';

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.initXhrObservable = exports.COOKIE_ACCESS_DELAY = exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = exports.computeRawError = exports.ErrorSource = exports.instrumentSetter = exports.instrumentMethodAndCallOriginal = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.startBatchWithReplica = exports.getEventBridge = exports.canUseEventBridge = exports.Batch = exports.createHttpRequest = exports.SESSION_TIME_OUT_DELAY = exports.stopSessionManager = exports.startSessionManager = exports.Observable = exports.setDebugMode = exports.callMonitored = exports.monitor = exports.monitored = exports.addTelemetryConfiguration = exports.isTelemetryReplicationAllowed = exports.resetTelemetry = exports.startFakeTelemetry = exports.addTelemetryError = exports.addTelemetryDebug = exports.startTelemetry = exports.RawReportType = exports.initReportObservable = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.serializeConfiguration = exports.resetExperimentalFeatures = exports.updateExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = exports.buildCookieOptions = void 0;
exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_COOKIE_NAME = exports.readBytesFromStream = exports.CLEAR_OLD_CONTEXTS_INTERVAL = exports.ContextHistory = exports.limitModification = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = void 0;
exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = exports.PROVIDED_ERROR_MESSAGE_PREFIX = exports.NO_ERROR_STACK_PRESENT_MESSAGE = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = exports.computeRawError = exports.ErrorSource = exports.instrumentSetter = exports.instrumentMethodAndCallOriginal = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.startBatchWithReplica = exports.getEventBridge = exports.canUseEventBridge = exports.Batch = exports.createHttpRequest = exports.SESSION_TIME_OUT_DELAY = exports.stopSessionManager = exports.startSessionManager = exports.Observable = exports.setDebugMode = exports.callMonitored = exports.monitor = exports.monitored = exports.addTelemetryConfiguration = exports.isTelemetryReplicationAllowed = exports.resetTelemetry = exports.startFakeTelemetry = exports.addTelemetryError = exports.addTelemetryDebug = exports.startTelemetry = exports.RawReportType = exports.initReportObservable = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.serializeConfiguration = exports.resetExperimentalFeatures = exports.updateExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = exports.buildCookieOptions = void 0;
exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_COOKIE_NAME = exports.readBytesFromStream = exports.CLEAR_OLD_CONTEXTS_INTERVAL = exports.ContextHistory = exports.limitModification = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = exports.initXhrObservable = exports.COOKIE_ACCESS_DELAY = void 0;
var configuration_1 = require("./domain/configuration");

@@ -87,2 +87,4 @@ Object.defineProperty(exports, "buildCookieOptions", { enumerable: true, get: function () { return configuration_1.buildCookieOptions; } });

Object.defineProperty(exports, "getFileFromStackTraceString", { enumerable: true, get: function () { return error_1.getFileFromStackTraceString; } });
Object.defineProperty(exports, "NO_ERROR_STACK_PRESENT_MESSAGE", { enumerable: true, get: function () { return error_1.NO_ERROR_STACK_PRESENT_MESSAGE; } });
Object.defineProperty(exports, "PROVIDED_ERROR_MESSAGE_PREFIX", { enumerable: true, get: function () { return error_1.PROVIDED_ERROR_MESSAGE_PREFIX; } });
var cookie_1 = require("./browser/cookie");

@@ -89,0 +91,0 @@ Object.defineProperty(exports, "areCookiesAuthorized", { enumerable: true, get: function () { return cookie_1.areCookiesAuthorized; } });

import type { StackTrace } from '../domain/tracekit';
import type { ClocksState } from './timeUtils';
export declare const NO_ERROR_STACK_PRESENT_MESSAGE = "No stack, consider using an instance of Error";
export declare const PROVIDED_ERROR_MESSAGE_PREFIX = "Provided";
export interface ErrorWithCause extends Error {

@@ -4,0 +6,0 @@ cause?: Error;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.flattenErrorCauses = exports.createHandlingStack = exports.formatErrorMessage = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.computeRawError = exports.ErrorSource = void 0;
exports.flattenErrorCauses = exports.createHandlingStack = exports.formatErrorMessage = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.computeRawError = exports.ErrorSource = exports.PROVIDED_ERROR_MESSAGE_PREFIX = exports.NO_ERROR_STACK_PRESENT_MESSAGE = void 0;
var tracekit_1 = require("../domain/tracekit");
var monitor_1 = require("./monitor");
var utils_1 = require("./utils");
exports.NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error';
exports.PROVIDED_ERROR_MESSAGE_PREFIX = 'Provided';
exports.ErrorSource = {

@@ -25,3 +27,3 @@ AGENT: 'agent',

message: "".concat(nonErrorPrefix, " ").concat((0, utils_1.jsonStringify)(originalError)),
stack: 'No stack, consider using an instance of Error',
stack: exports.NO_ERROR_STACK_PRESENT_MESSAGE,
handlingStack: handlingStack,

@@ -28,0 +30,0 @@ type: stackTrace && stackTrace.name,

@@ -6,3 +6,3 @@ import { catchUserErrors } from '../tools/catchUserErrors';

var publicApi = assign({
version: "4.35.0",
version: "4.36.0",
// This API method is intentionally not monitored, since the only thing executed is the

@@ -9,0 +9,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and

@@ -6,3 +6,3 @@ import { Observable } from '../tools/observable';

startClocks: ClocksState;
input: RequestInfo;
input: unknown;
init?: RequestInit;

@@ -9,0 +9,0 @@ url: string;

@@ -37,4 +37,4 @@ import { instrumentMethod } from '../tools/instrumentMethod';

function beforeSend(observable, input, init) {
var method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET';
var url = normalizeUrl((typeof input === 'object' && input.url) || input);
var method = (init && init.method) || (input instanceof Request && input.method) || 'GET';
var url = input instanceof Request ? input.url : normalizeUrl(String(input));
var startClocks = clocksNow();

@@ -41,0 +41,0 @@ var context = {

@@ -65,3 +65,3 @@ import { timeStampNow } from '../../tools/timeUtils';

var clientToken = _a.clientToken, internalAnalyticsSubdomain = _a.internalAnalyticsSubdomain;
var tags = ["sdk_version:".concat("4.35.0"), "api:".concat(api)].concat(configurationTags);
var tags = ["sdk_version:".concat("4.36.0"), "api:".concat(api)].concat(configurationTags);
if (flushReason && isExperimentalFeatureEnabled('collect_flush_reason')) {

@@ -77,3 +77,3 @@ tags.push("flush_reason:".concat(flushReason));

"dd-api-key=".concat(clientToken),
"dd-evp-origin-version=".concat(encodeURIComponent("4.35.0")),
"dd-evp-origin-version=".concat(encodeURIComponent("4.36.0")),
'dd-evp-origin=browser',

@@ -80,0 +80,0 @@ "dd-request-id=".concat(generateUUID()),

@@ -44,3 +44,3 @@ import { ConsoleApiName } from '../../tools/display';

service: telemetryService,
version: "4.35.0",
version: "4.36.0",
source: 'browser',

@@ -47,0 +47,0 @@ _dd: {

@@ -22,3 +22,3 @@ export { Configuration, InitConfiguration, buildCookieOptions, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, isExperimentalFeatureEnabled, updateExperimentalFeatures, resetExperimentalFeatures, serializeConfiguration, } from './domain/configuration';

export { instrumentMethod, instrumentMethodAndCallOriginal, instrumentSetter } from './tools/instrumentMethod';
export { ErrorSource, ErrorHandling, computeRawError, createHandlingStack, RawError, RawErrorCause, ErrorWithCause, toStackTraceString, getFileFromStackTraceString, } from './tools/error';
export { ErrorSource, ErrorHandling, computeRawError, createHandlingStack, RawError, RawErrorCause, ErrorWithCause, toStackTraceString, getFileFromStackTraceString, NO_ERROR_STACK_PRESENT_MESSAGE, PROVIDED_ERROR_MESSAGE_PREFIX, } from './tools/error';
export { Context, ContextArray, ContextValue } from './tools/context';

@@ -25,0 +25,0 @@ export { areCookiesAuthorized, getCookie, setCookie, deleteCookie, COOKIE_ACCESS_DELAY } from './browser/cookie';

@@ -25,3 +25,3 @@ export { buildCookieOptions, validateAndBuildConfiguration, DefaultPrivacyLevel, isExperimentalFeatureEnabled, updateExperimentalFeatures, resetExperimentalFeatures, serializeConfiguration, } from './domain/configuration';

export { instrumentMethod, instrumentMethodAndCallOriginal, instrumentSetter } from './tools/instrumentMethod';
export { ErrorSource, computeRawError, createHandlingStack, toStackTraceString, getFileFromStackTraceString, } from './tools/error';
export { ErrorSource, computeRawError, createHandlingStack, toStackTraceString, getFileFromStackTraceString, NO_ERROR_STACK_PRESENT_MESSAGE, PROVIDED_ERROR_MESSAGE_PREFIX, } from './tools/error';
export { areCookiesAuthorized, getCookie, setCookie, deleteCookie, COOKIE_ACCESS_DELAY } from './browser/cookie';

@@ -28,0 +28,0 @@ export { initXhrObservable } from './browser/xhrObservable';

import type { StackTrace } from '../domain/tracekit';
import type { ClocksState } from './timeUtils';
export declare const NO_ERROR_STACK_PRESENT_MESSAGE = "No stack, consider using an instance of Error";
export declare const PROVIDED_ERROR_MESSAGE_PREFIX = "Provided";
export interface ErrorWithCause extends Error {

@@ -4,0 +6,0 @@ cause?: Error;

import { computeStackTrace } from '../domain/tracekit';
import { callMonitored } from './monitor';
import { jsonStringify, noop } from './utils';
export var NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error';
export var PROVIDED_ERROR_MESSAGE_PREFIX = 'Provided';
export var ErrorSource = {

@@ -22,3 +24,3 @@ AGENT: 'agent',

message: "".concat(nonErrorPrefix, " ").concat(jsonStringify(originalError)),
stack: 'No stack, consider using an instance of Error',
stack: NO_ERROR_STACK_PRESENT_MESSAGE,
handlingStack: handlingStack,

@@ -25,0 +27,0 @@ type: stackTrace && stackTrace.name,

{
"name": "@datadog/browser-core",
"version": "4.35.0",
"version": "4.36.0",
"license": "Apache-2.0",

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

"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json && yarn replace-build-env esm",
"replace-build-env": "node ../../scripts/replace-build-env.js"
"replace-build-env": "node ../../scripts/build/replace-build-env.js"
},

@@ -28,3 +28,3 @@ "devDependencies": {

},
"gitHead": "c71f60a74755ba55b3d64cf789aa472f2867afef"
"gitHead": "bcd2446e1d5f38c915f5fb581421bfd3fdd8dab6"
}

@@ -10,2 +10,4 @@ import type { FetchStub, FetchStubManager, FetchStubPromise } from '../../test/specHelper'

const FAKE_URL = 'http://fake-url/'
const FAKE_RELATIVE_URL = '/fake-path'
const NORMALIZED_FAKE_RELATIVE_URL = `${location.origin}/fake-path`
let fetchStub: (input: RequestInfo, init?: RequestInit) => FetchStubPromise

@@ -115,2 +117,4 @@ let fetchStubManager: FetchStubManager

fetchStub(FAKE_URL, { method: 'POST' }).resolveWith({ status: 500 })
fetchStub(null as any).resolveWith({ status: 500 })
fetchStub({ method: 'POST' } as any).resolveWith({ status: 500 })

@@ -124,2 +128,4 @@ fetchStubManager.whenAllComplete(() => {

expect(requests[5].method).toEqual('POST')
expect(requests[6].method).toEqual('GET')
expect(requests[7].method).toEqual('GET')
done()

@@ -129,5 +135,13 @@ })

it('should get url from input', (done) => {
it('should get the normalized url from input', (done) => {
fetchStub(FAKE_URL).rejectWith(new Error('fetch error'))
fetchStub(new Request(FAKE_URL)).rejectWith(new Error('fetch error'))
fetchStub(null as any).rejectWith(new Error('fetch error'))
fetchStub({
toString() {
return FAKE_RELATIVE_URL
},
} as any).rejectWith(new Error('fetch error'))
fetchStub(FAKE_RELATIVE_URL).rejectWith(new Error('fetch error'))
fetchStub(new Request(FAKE_RELATIVE_URL)).rejectWith(new Error('fetch error'))

@@ -137,2 +151,6 @@ fetchStubManager.whenAllComplete(() => {

expect(requests[1].url).toEqual(FAKE_URL)
expect(requests[2].url).toMatch(/\/null$/)
expect(requests[3].url).toEqual(NORMALIZED_FAKE_RELATIVE_URL)
expect(requests[4].url).toEqual(NORMALIZED_FAKE_RELATIVE_URL)
expect(requests[5].url).toEqual(NORMALIZED_FAKE_RELATIVE_URL)
done()

@@ -139,0 +157,0 @@ })

@@ -11,3 +11,3 @@ import { instrumentMethod } from '../tools/instrumentMethod'

startClocks: ClocksState
input: RequestInfo
input: unknown
init?: RequestInit

@@ -56,3 +56,3 @@ url: string

if (context) {
responsePromise = originalFetch.call(this, context.input, context.init)
responsePromise = originalFetch.call(this, context.input as RequestInfo, context.init)
callMonitored(afterSend, null, [observable, responsePromise, context])

@@ -73,5 +73,5 @@ } else {

function beforeSend(observable: Observable<FetchContext>, input: RequestInfo, init?: RequestInit) {
const method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET'
const url = normalizeUrl((typeof input === 'object' && input.url) || (input as string))
function beforeSend(observable: Observable<FetchContext>, input: unknown, init?: RequestInit) {
const method = (init && init.method) || (input instanceof Request && input.method) || 'GET'
const url = input instanceof Request ? input.url : normalizeUrl(String(input))
const startClocks = clocksNow()

@@ -78,0 +78,0 @@

@@ -75,2 +75,4 @@ export {

getFileFromStackTraceString,
NO_ERROR_STACK_PRESENT_MESSAGE,
PROVIDED_ERROR_MESSAGE_PREFIX,
} from './tools/error'

@@ -77,0 +79,0 @@ export { Context, ContextArray, ContextValue } from './tools/context'

@@ -7,2 +7,5 @@ import type { StackTrace } from '../domain/tracekit'

export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
export const PROVIDED_ERROR_MESSAGE_PREFIX = 'Provided'
export interface ErrorWithCause extends Error {

@@ -75,3 +78,3 @@ cause?: Error

message: `${nonErrorPrefix} ${jsonStringify(originalError)!}`,
stack: 'No stack, consider using an instance of Error',
stack: NO_ERROR_STACK_PRESENT_MESSAGE,
handlingStack,

@@ -78,0 +81,0 @@ type: stackTrace && stackTrace.name,

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc