Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-core - npm Package Compare versions

Comparing version 5.12.0 to 5.13.0

2

cjs/boot/init.js

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

var publicApi = (0, polyfills_1.assign)({
version: "5.12.0",
version: "5.13.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

@@ -11,2 +11,7 @@ import type { Duration } from '../../tools/utils/timeUtils';

export type DefaultPrivacyLevel = (typeof DefaultPrivacyLevel)[keyof typeof DefaultPrivacyLevel];
export declare const TraceContextInjection: {
readonly ALL: "all";
readonly SAMPLED: "sampled";
};
export type TraceContextInjection = (typeof TraceContextInjection)[keyof typeof TraceContextInjection];
export interface InitConfiguration {

@@ -13,0 +18,0 @@ clientToken: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeConfiguration = exports.validateAndBuildConfiguration = exports.DefaultPrivacyLevel = void 0;
exports.serializeConfiguration = exports.validateAndBuildConfiguration = exports.TraceContextInjection = exports.DefaultPrivacyLevel = void 0;
var catchUserErrors_1 = require("../../tools/catchUserErrors");

@@ -20,2 +20,6 @@ var display_1 = require("../../tools/display");

};
exports.TraceContextInjection = {
ALL: 'all',
SAMPLED: 'sampled',
};
function validateAndBuildConfiguration(initConfiguration) {

@@ -22,0 +26,0 @@ var _a, _b, _c, _d;

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

if (trackType === 'logs' && initConfiguration.usePciIntake && site === intakeSites_1.INTAKE_SITE_US1) {
return 'pci.browser-intake-datadoghq.com';
return intakeSites_1.PCI_INTAKE_HOST_US1;
}

@@ -62,3 +62,3 @@ if (internalAnalyticsSubdomain && site === intakeSites_1.INTAKE_SITE_US1) {

var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding;
var tags = ["sdk_version:".concat("5.12.0"), "api:".concat(api)].concat(configurationTags);
var tags = ["sdk_version:".concat("5.13.0"), "api:".concat(api)].concat(configurationTags);
if (flushReason && (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.COLLECT_FLUSH_REASON)) {

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

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

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

@@ -1,4 +0,4 @@

export { Configuration, InitConfiguration, DefaultPrivacyLevel, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { Configuration, InitConfiguration, DefaultPrivacyLevel, TraceContextInjection, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { createEndpointBuilder, EndpointBuilder, TrackType } from './endpointBuilder';
export * from './intakeSites';
export { computeTransportConfiguration } from './transportConfiguration';

@@ -17,5 +17,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.computeTransportConfiguration = exports.createEndpointBuilder = exports.serializeConfiguration = exports.validateAndBuildConfiguration = exports.DefaultPrivacyLevel = void 0;
exports.computeTransportConfiguration = exports.createEndpointBuilder = exports.serializeConfiguration = exports.validateAndBuildConfiguration = exports.TraceContextInjection = exports.DefaultPrivacyLevel = void 0;
var configuration_1 = require("./configuration");
Object.defineProperty(exports, "DefaultPrivacyLevel", { enumerable: true, get: function () { return configuration_1.DefaultPrivacyLevel; } });
Object.defineProperty(exports, "TraceContextInjection", { enumerable: true, get: function () { return configuration_1.TraceContextInjection; } });
Object.defineProperty(exports, "validateAndBuildConfiguration", { enumerable: true, get: function () { return configuration_1.validateAndBuildConfiguration; } });

@@ -22,0 +23,0 @@ Object.defineProperty(exports, "serializeConfiguration", { enumerable: true, get: function () { return configuration_1.serializeConfiguration; } });

@@ -6,1 +6,2 @@ export declare const INTAKE_SITE_STAGING = "datad0g.com";

export declare const INTAKE_SITE_US1_FED = "ddog-gov.com";
export declare const PCI_INTAKE_HOST_US1 = "pci.browser-intake-datadoghq.com";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_FED_STAGING = exports.INTAKE_SITE_STAGING = void 0;
exports.PCI_INTAKE_HOST_US1 = exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_FED_STAGING = exports.INTAKE_SITE_STAGING = void 0;
exports.INTAKE_SITE_STAGING = 'datad0g.com';

@@ -9,2 +9,3 @@ exports.INTAKE_SITE_FED_STAGING = 'dd0g-gov.com';

exports.INTAKE_SITE_US1_FED = 'ddog-gov.com';
exports.PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com';
//# sourceMappingURL=intakeSites.js.map

@@ -9,5 +9,6 @@ "use strict";

function computeTransportConfiguration(initConfiguration) {
var site = initConfiguration.site || intakeSites_1.INTAKE_SITE_US1;
var tags = (0, tags_1.buildTags)(initConfiguration);
var endpointBuilders = computeEndpointBuilders(initConfiguration, tags);
var intakeUrlPrefixes = (0, polyfills_1.objectValues)(endpointBuilders).map(function (builder) { return builder.urlPrefix; });
var intakeUrlPrefixes = computeIntakeUrlPrefixes(endpointBuilders, site);
var replicaConfiguration = computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags);

@@ -17,3 +18,3 @@ return (0, polyfills_1.assign)({

replica: replicaConfiguration,
site: initConfiguration.site || intakeSites_1.INTAKE_SITE_US1,
site: site,
}, endpointBuilders);

@@ -44,2 +45,9 @@ }

}
function computeIntakeUrlPrefixes(endpointBuilders, site) {
var intakeUrlPrefixes = (0, polyfills_1.objectValues)(endpointBuilders).map(function (builder) { return builder.urlPrefix; });
if (site === intakeSites_1.INTAKE_SITE_US1) {
intakeUrlPrefixes.push("https://".concat(intakeSites_1.PCI_INTAKE_HOST_US1, "/"));
}
return intakeUrlPrefixes;
}
//# sourceMappingURL=transportConfiguration.js.map

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

export declare function instrumentOnError(callback: UnhandledErrorCallback): {
stop: () => void;
stop: typeof import("../..").noop;
};
export declare function instrumentUnhandledRejection(callback: UnhandledErrorCallback): {
stop: () => void;
stop: typeof import("../..").noop;
};

@@ -41,2 +41,3 @@ import type { Context } from '../../tools/serialisation/context';

trace_sample_rate?: number | undefined;
trace_context_injection?: "all" | "sampled" | undefined;
premium_sample_rate?: number | undefined;

@@ -43,0 +44,0 @@ replay_sample_rate?: number | undefined;

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

service: telemetryService,
version: "5.12.0",
version: "5.13.0",
source: 'browser',

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

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

/**
* The opt-in configuration to add trace context
*/
trace_context_injection?: 'all' | 'sampled';
/**
* The percentage of sessions with Browser RUM & Session Replay pricing tracked (deprecated in favor of session_replay_sample_rate)

@@ -105,0 +109,0 @@ */

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

export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, TraceContextInjection, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { TrackingConsent, TrackingConsentState, createTrackingConsentState } from './domain/trackingConsent';

@@ -3,0 +3,0 @@ export { isExperimentalFeatureEnabled, addExperimentalFeatures, resetExperimentalFeatures, getExperimentalFeatures, ExperimentalFeature, } from './tools/experimentalFeatures';

@@ -17,7 +17,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.computeRawError = exports.instrumentSetter = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.AbstractLifeCycle = exports.createIdentityEncoder = exports.createFlushController = exports.startBatchWithReplica = exports.bridgeSupports = exports.getEventBridge = exports.canUseEventBridge = 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.displayAlreadyInitializedError = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.ExperimentalFeature = exports.getExperimentalFeatures = exports.resetExperimentalFeatures = exports.addExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.createTrackingConsentState = exports.TrackingConsent = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_STAGING = exports.serializeConfiguration = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = void 0;
exports.ErrorSource = exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_STORE_KEY = exports.STORAGE_POLL_DELAY = exports.readBytesFromStream = exports.CLEAR_OLD_VALUES_INTERVAL = exports.ValueHistory = exports.CUSTOMER_DATA_BYTES_LIMIT = exports.createCustomerDataTracker = exports.createCustomerDataTrackerManager = exports.removeStorageListeners = exports.storeContextManager = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.resetConsoleObservable = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = exports.initXhrObservable = exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = exports.NO_ERROR_STACK_PRESENT_MESSAGE = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = void 0;
exports.instrumentSetter = exports.instrumentMethod = exports.getZoneJsOriginalValue = exports.runOnReadyState = exports.sendToExtension = exports.AbstractLifeCycle = exports.createIdentityEncoder = exports.createFlushController = exports.startBatchWithReplica = exports.bridgeSupports = exports.getEventBridge = exports.canUseEventBridge = 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.displayAlreadyInitializedError = exports.makePublicApi = exports.defineGlobal = exports.computeStackTrace = exports.trackRuntimeError = exports.ExperimentalFeature = exports.getExperimentalFeatures = exports.resetExperimentalFeatures = exports.addExperimentalFeatures = exports.isExperimentalFeatureEnabled = exports.createTrackingConsentState = exports.TrackingConsent = exports.INTAKE_SITE_EU1 = exports.INTAKE_SITE_US1_FED = exports.INTAKE_SITE_US1 = exports.INTAKE_SITE_STAGING = exports.serializeConfiguration = exports.TraceContextInjection = exports.DefaultPrivacyLevel = exports.validateAndBuildConfiguration = void 0;
exports.ErrorSource = exports.sanitizeUser = exports.checkUser = exports.getSyntheticsResultId = exports.getSyntheticsTestId = exports.willSyntheticsInjectRum = exports.SESSION_STORE_KEY = exports.STORAGE_POLL_DELAY = exports.readBytesFromStream = exports.CLEAR_OLD_VALUES_INTERVAL = exports.ValueHistory = exports.CUSTOMER_DATA_BYTES_LIMIT = exports.createCustomerDataTracker = exports.createCustomerDataTrackerManager = exports.removeStorageListeners = exports.storeContextManager = exports.createContextManager = exports.catchUserErrors = exports.BoundedBuffer = exports.resetConsoleObservable = exports.initConsoleObservable = exports.isPageExitReason = exports.PageExitReason = exports.createPageExitObservable = exports.initFetchObservable = exports.initXhrObservable = exports.deleteCookie = exports.setCookie = exports.getCookie = exports.areCookiesAuthorized = exports.NO_ERROR_STACK_PRESENT_MESSAGE = exports.getFileFromStackTraceString = exports.toStackTraceString = exports.createHandlingStack = exports.computeRawError = void 0;
var configuration_1 = require("./domain/configuration");
Object.defineProperty(exports, "validateAndBuildConfiguration", { enumerable: true, get: function () { return configuration_1.validateAndBuildConfiguration; } });
Object.defineProperty(exports, "DefaultPrivacyLevel", { enumerable: true, get: function () { return configuration_1.DefaultPrivacyLevel; } });
Object.defineProperty(exports, "TraceContextInjection", { enumerable: true, get: function () { return configuration_1.TraceContextInjection; } });
Object.defineProperty(exports, "serializeConfiguration", { enumerable: true, get: function () { return configuration_1.serializeConfiguration; } });

@@ -24,0 +25,0 @@ Object.defineProperty(exports, "INTAKE_SITE_STAGING", { enumerable: true, get: function () { return configuration_1.INTAKE_SITE_STAGING; } });

@@ -32,2 +32,7 @@ import { noop } from './utils/functionUtils';

*
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
* removing the instrumentation, the original method is usually restored, but if a third party
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
* a noop.
*
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones

@@ -38,2 +43,9 @@ * that are inherited from the prototype chain. Example:

*
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
* the same requirements as instrumenting a method:
* * if the event handler is already set by a third party, we need to call it and not just blindly
* override it.
* * if the event handler is set by a third party after us, we need to keep it in place when
* removing ours.
*
* @example

@@ -51,4 +63,4 @@ *

[key: string]: any;
}, METHOD extends keyof TARGET>(targetPrototype: TARGET, method: METHOD, onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void): {
stop: () => void;
}, METHOD extends keyof TARGET & string>(targetPrototype: TARGET, method: METHOD, onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void): {
stop: typeof noop;
};

@@ -55,0 +67,0 @@ export declare function instrumentSetter<TARGET extends {

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

*
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
* removing the instrumentation, the original method is usually restored, but if a third party
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
* a noop.
*
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones

@@ -18,2 +23,9 @@ * that are inherited from the prototype chain. Example:

*
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
* the same requirements as instrumenting a method:
* * if the event handler is already set by a third party, we need to call it and not just blindly
* override it.
* * if the event handler is set by a third party after us, we need to keep it in place when
* removing ours.
*
* @example

@@ -31,2 +43,10 @@ *

var original = targetPrototype[method];
if (typeof original !== 'function') {
if ((0, polyfills_1.startsWith)(method, 'on')) {
original = functionUtils_1.noop;
}
else {
return { stop: functionUtils_1.noop };
}
}
var instrumentation = createInstrumentedMethod(original, onPreCall);

@@ -57,3 +77,2 @@ var instrumentationWrapper = function () {

var parameters = (0, polyfills_1.arrayFrom)(arguments);
var result;
var postCallCallback;

@@ -69,6 +88,4 @@ (0, monitor_1.callMonitored)(onPreCall, null, [

]);
if (typeof original === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
result = original.apply(this, parameters);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
var result = original.apply(this, parameters);
if (postCallCallback) {

@@ -75,0 +92,0 @@ (0, monitor_1.callMonitored)(postCallCallback, null, [result]);

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

var publicApi = assign({
version: "5.12.0",
version: "5.13.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

@@ -11,2 +11,7 @@ import type { Duration } from '../../tools/utils/timeUtils';

export type DefaultPrivacyLevel = (typeof DefaultPrivacyLevel)[keyof typeof DefaultPrivacyLevel];
export declare const TraceContextInjection: {
readonly ALL: "all";
readonly SAMPLED: "sampled";
};
export type TraceContextInjection = (typeof TraceContextInjection)[keyof typeof TraceContextInjection];
export interface InitConfiguration {

@@ -13,0 +18,0 @@ clientToken: string;

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

};
export var TraceContextInjection = {
ALL: 'all',
SAMPLED: 'sampled',
};
export function validateAndBuildConfiguration(initConfiguration) {

@@ -19,0 +23,0 @@ var _a, _b, _c, _d;

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

import { generateUUID } from '../../tools/utils/stringUtils';
import { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING } from './intakeSites';
import { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING, PCI_INTAKE_HOST_US1 } from './intakeSites';
export function createEndpointBuilder(initConfiguration, trackType, configurationTags) {

@@ -39,3 +39,3 @@ var buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, trackType);

if (trackType === 'logs' && initConfiguration.usePciIntake && site === INTAKE_SITE_US1) {
return 'pci.browser-intake-datadoghq.com';
return PCI_INTAKE_HOST_US1;
}

@@ -59,3 +59,3 @@ if (internalAnalyticsSubdomain && site === INTAKE_SITE_US1) {

var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding;
var tags = ["sdk_version:".concat("5.12.0"), "api:".concat(api)].concat(configurationTags);
var tags = ["sdk_version:".concat("5.13.0"), "api:".concat(api)].concat(configurationTags);
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {

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

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

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

@@ -1,4 +0,4 @@

export { Configuration, InitConfiguration, DefaultPrivacyLevel, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { Configuration, InitConfiguration, DefaultPrivacyLevel, TraceContextInjection, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { createEndpointBuilder, EndpointBuilder, TrackType } from './endpointBuilder';
export * from './intakeSites';
export { computeTransportConfiguration } from './transportConfiguration';

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

export { DefaultPrivacyLevel, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { DefaultPrivacyLevel, TraceContextInjection, validateAndBuildConfiguration, serializeConfiguration, } from './configuration';
export { createEndpointBuilder } from './endpointBuilder';

@@ -3,0 +3,0 @@ export * from './intakeSites';

@@ -6,1 +6,2 @@ export declare const INTAKE_SITE_STAGING = "datad0g.com";

export declare const INTAKE_SITE_US1_FED = "ddog-gov.com";
export declare const PCI_INTAKE_HOST_US1 = "pci.browser-intake-datadoghq.com";

@@ -6,2 +6,3 @@ export var INTAKE_SITE_STAGING = 'datad0g.com';

export var INTAKE_SITE_US1_FED = 'ddog-gov.com';
export var PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com';
//# sourceMappingURL=intakeSites.js.map
import { objectValues, assign } from '../../tools/utils/polyfills';
import { createEndpointBuilder } from './endpointBuilder';
import { buildTags } from './tags';
import { INTAKE_SITE_US1 } from './intakeSites';
import { INTAKE_SITE_US1, PCI_INTAKE_HOST_US1 } from './intakeSites';
export function computeTransportConfiguration(initConfiguration) {
var site = initConfiguration.site || INTAKE_SITE_US1;
var tags = buildTags(initConfiguration);
var endpointBuilders = computeEndpointBuilders(initConfiguration, tags);
var intakeUrlPrefixes = objectValues(endpointBuilders).map(function (builder) { return builder.urlPrefix; });
var intakeUrlPrefixes = computeIntakeUrlPrefixes(endpointBuilders, site);
var replicaConfiguration = computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags);

@@ -13,3 +14,3 @@ return assign({

replica: replicaConfiguration,
site: initConfiguration.site || INTAKE_SITE_US1,
site: site,
}, endpointBuilders);

@@ -39,2 +40,9 @@ }

}
function computeIntakeUrlPrefixes(endpointBuilders, site) {
var intakeUrlPrefixes = objectValues(endpointBuilders).map(function (builder) { return builder.urlPrefix; });
if (site === INTAKE_SITE_US1) {
intakeUrlPrefixes.push("https://".concat(PCI_INTAKE_HOST_US1, "/"));
}
return intakeUrlPrefixes;
}
//# sourceMappingURL=transportConfiguration.js.map

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

export declare function instrumentOnError(callback: UnhandledErrorCallback): {
stop: () => void;
stop: typeof import("../..").noop;
};
export declare function instrumentUnhandledRejection(callback: UnhandledErrorCallback): {
stop: () => void;
stop: typeof import("../..").noop;
};

@@ -41,2 +41,3 @@ import type { Context } from '../../tools/serialisation/context';

trace_sample_rate?: number | undefined;
trace_context_injection?: "all" | "sampled" | undefined;
premium_sample_rate?: number | undefined;

@@ -43,0 +44,0 @@ replay_sample_rate?: number | undefined;

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

service: telemetryService,
version: "5.12.0",
version: "5.13.0",
source: 'browser',

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

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

/**
* The opt-in configuration to add trace context
*/
trace_context_injection?: 'all' | 'sampled';
/**
* The percentage of sessions with Browser RUM & Session Replay pricing tracked (deprecated in favor of session_replay_sample_rate)

@@ -105,0 +109,0 @@ */

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

export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { Configuration, InitConfiguration, validateAndBuildConfiguration, DefaultPrivacyLevel, TraceContextInjection, EndpointBuilder, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { TrackingConsent, TrackingConsentState, createTrackingConsentState } from './domain/trackingConsent';

@@ -3,0 +3,0 @@ export { isExperimentalFeatureEnabled, addExperimentalFeatures, resetExperimentalFeatures, getExperimentalFeatures, ExperimentalFeature, } from './tools/experimentalFeatures';

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

export { validateAndBuildConfiguration, DefaultPrivacyLevel, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { validateAndBuildConfiguration, DefaultPrivacyLevel, TraceContextInjection, serializeConfiguration, INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_US1_FED, INTAKE_SITE_EU1, } from './domain/configuration';
export { TrackingConsent, createTrackingConsentState } from './domain/trackingConsent';

@@ -3,0 +3,0 @@ export { isExperimentalFeatureEnabled, addExperimentalFeatures, resetExperimentalFeatures, getExperimentalFeatures, ExperimentalFeature, } from './tools/experimentalFeatures';

@@ -32,2 +32,7 @@ import { noop } from './utils/functionUtils';

*
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
* removing the instrumentation, the original method is usually restored, but if a third party
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
* a noop.
*
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones

@@ -38,2 +43,9 @@ * that are inherited from the prototype chain. Example:

*
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
* the same requirements as instrumenting a method:
* * if the event handler is already set by a third party, we need to call it and not just blindly
* override it.
* * if the event handler is set by a third party after us, we need to keep it in place when
* removing ours.
*
* @example

@@ -51,4 +63,4 @@ *

[key: string]: any;
}, METHOD extends keyof TARGET>(targetPrototype: TARGET, method: METHOD, onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void): {
stop: () => void;
}, METHOD extends keyof TARGET & string>(targetPrototype: TARGET, method: METHOD, onPreCall: (this: null, callInfos: InstrumentedMethodCall<TARGET, METHOD>) => void): {
stop: typeof noop;
};

@@ -55,0 +67,0 @@ export declare function instrumentSetter<TARGET extends {

import { setTimeout } from './timer';
import { callMonitored } from './monitor';
import { noop } from './utils/functionUtils';
import { arrayFrom } from './utils/polyfills';
import { arrayFrom, startsWith } from './utils/polyfills';
/**

@@ -9,2 +9,7 @@ * Instruments a method on a object, calling the given callback before the original method is

*
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
* removing the instrumentation, the original method is usually restored, but if a third party
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
* a noop.
*
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones

@@ -15,2 +20,9 @@ * that are inherited from the prototype chain. Example:

*
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
* the same requirements as instrumenting a method:
* * if the event handler is already set by a third party, we need to call it and not just blindly
* override it.
* * if the event handler is set by a third party after us, we need to keep it in place when
* removing ours.
*
* @example

@@ -28,2 +40,10 @@ *

var original = targetPrototype[method];
if (typeof original !== 'function') {
if (startsWith(method, 'on')) {
original = noop;
}
else {
return { stop: noop };
}
}
var instrumentation = createInstrumentedMethod(original, onPreCall);

@@ -53,3 +73,2 @@ var instrumentationWrapper = function () {

var parameters = arrayFrom(arguments);
var result;
var postCallCallback;

@@ -65,6 +84,4 @@ callMonitored(onPreCall, null, [

]);
if (typeof original === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
result = original.apply(this, parameters);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
var result = original.apply(this, parameters);
if (postCallCallback) {

@@ -71,0 +88,0 @@ callMonitored(postCallCallback, null, [result]);

{
"name": "@datadog/browser-core",
"version": "5.12.0",
"version": "5.13.0",
"license": "Apache-2.0",

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

},
"gitHead": "4350ee6453b6757e6256caa44a22ecdbabc035d5"
"gitHead": "b703afd5ef260f5b6b023e42c3696771cd8976e9"
}

@@ -24,2 +24,9 @@ import { catchUserErrors } from '../../tools/catchUserErrors'

export const TraceContextInjection = {
ALL: 'all',
SAMPLED: 'sampled',
} as const
export type TraceContextInjection = (typeof TraceContextInjection)[keyof typeof TraceContextInjection]
export interface InitConfiguration {

@@ -26,0 +33,0 @@ // global options

@@ -7,3 +7,3 @@ import type { Payload } from '../../transport'

import type { InitConfiguration } from './configuration'
import { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING } from './intakeSites'
import { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING, PCI_INTAKE_HOST_US1 } from './intakeSites'

@@ -67,3 +67,3 @@ // replaced at build time

if (trackType === 'logs' && initConfiguration.usePciIntake && site === INTAKE_SITE_US1) {
return 'pci.browser-intake-datadoghq.com'
return PCI_INTAKE_HOST_US1
}

@@ -70,0 +70,0 @@

@@ -5,2 +5,3 @@ export {

DefaultPrivacyLevel,
TraceContextInjection,
validateAndBuildConfiguration,

@@ -7,0 +8,0 @@ serializeConfiguration,

@@ -6,1 +6,3 @@ export const INTAKE_SITE_STAGING = 'datad0g.com'

export const INTAKE_SITE_US1_FED = 'ddog-gov.com'
export const PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com'

@@ -6,3 +6,3 @@ import { objectValues, assign } from '../../tools/utils/polyfills'

import { buildTags } from './tags'
import { INTAKE_SITE_US1 } from './intakeSites'
import { INTAKE_SITE_US1, PCI_INTAKE_HOST_US1 } from './intakeSites'

@@ -25,6 +25,8 @@ export interface TransportConfiguration {

export function computeTransportConfiguration(initConfiguration: InitConfiguration): TransportConfiguration {
const site = initConfiguration.site || INTAKE_SITE_US1
const tags = buildTags(initConfiguration)
const endpointBuilders = computeEndpointBuilders(initConfiguration, tags)
const intakeUrlPrefixes = objectValues(endpointBuilders).map((builder) => builder.urlPrefix)
const intakeUrlPrefixes = computeIntakeUrlPrefixes(endpointBuilders, site)

@@ -37,3 +39,3 @@ const replicaConfiguration = computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags)

replica: replicaConfiguration,
site: initConfiguration.site || INTAKE_SITE_US1,
site,
},

@@ -75,1 +77,14 @@ endpointBuilders

}
function computeIntakeUrlPrefixes(
endpointBuilders: ReturnType<typeof computeEndpointBuilders>,
site: string
): string[] {
const intakeUrlPrefixes = objectValues(endpointBuilders).map((builder) => builder.urlPrefix)
if (site === INTAKE_SITE_US1) {
intakeUrlPrefixes.push(`https://${PCI_INTAKE_HOST_US1}/`)
}
return intakeUrlPrefixes
}

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

/**
* The opt-in configuration to add trace context
*/
trace_context_injection?: 'all' | 'sampled'
/**
* The percentage of sessions with Browser RUM & Session Replay pricing tracked (deprecated in favor of session_replay_sample_rate)

@@ -107,0 +111,0 @@ */

@@ -6,2 +6,3 @@ export {

DefaultPrivacyLevel,
TraceContextInjection,
EndpointBuilder,

@@ -8,0 +9,0 @@ serializeConfiguration,

import { setTimeout } from './timer'
import { callMonitored } from './monitor'
import { noop } from './utils/functionUtils'
import { arrayFrom } from './utils/polyfills'
import { arrayFrom, startsWith } from './utils/polyfills'

@@ -38,2 +38,7 @@ /**

*
* This function makes sure that we are "good citizens" regarding third party instrumentations: when
* removing the instrumentation, the original method is usually restored, but if a third party
* instrumentation was set after ours, we keep it in place and just replace our instrumentation with
* a noop.
*
* Note: it is generally better to instrument methods that are "owned" by the object instead of ones

@@ -44,2 +49,9 @@ * that are inherited from the prototype chain. Example:

*
* This method is also used to set event handler properties (ex: window.onerror = ...), as it has
* the same requirements as instrumenting a method:
* * if the event handler is already set by a third party, we need to call it and not just blindly
* override it.
* * if the event handler is set by a third party after us, we need to keep it in place when
* removing ours.
*
* @example

@@ -55,3 +67,3 @@ *

*/
export function instrumentMethod<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET>(
export function instrumentMethod<TARGET extends { [key: string]: any }, METHOD extends keyof TARGET & string>(
targetPrototype: TARGET,

@@ -61,4 +73,12 @@ method: METHOD,

) {
const original = targetPrototype[method]
let original = targetPrototype[method]
if (typeof original !== 'function') {
if (startsWith(method, 'on')) {
original = noop as TARGET[METHOD]
} else {
return { stop: noop }
}
}
let instrumentation = createInstrumentedMethod(original, onPreCall)

@@ -93,3 +113,2 @@

const parameters = arrayFrom(arguments) as Parameters<TARGET[METHOD]>
let result

@@ -108,6 +127,4 @@ let postCallCallback: PostCallCallback<TARGET, METHOD> | undefined

if (typeof original === 'function') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
result = original.apply(this, parameters)
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const result = original.apply(this, parameters)

@@ -114,0 +131,0 @@ if (postCallCallback) {

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

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