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

@datadog/browser-core

Package Overview
Dependencies
Maintainers
1
Versions
259
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 2.1.2 to 2.2.0

2

cjs/boot/init.d.ts
import { CookieOptions } from '../browser/cookie';
import { UserConfiguration } from '../domain/configuration';
export declare function makeGlobal<T>(stub: T): T & {
export declare function makePublicApi<T>(stub: T): T & {
onReady(callback: () => void): void;

@@ -5,0 +5,0 @@ };

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

var internalMonitoring_1 = require("../domain/internalMonitoring");
function makeGlobal(stub) {
var global = tslib_1.__assign(tslib_1.__assign({}, stub), {
function makePublicApi(stub) {
var publicApi = tslib_1.__assign(tslib_1.__assign({}, stub), {
// This API method is intentionally not monitored, since the only thing executed is the

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

// as much as possible but of course it's not a real protection.
Object.defineProperty(global, '_setDebug', {
Object.defineProperty(publicApi, '_setDebug', {
get: function () {

@@ -26,5 +26,5 @@ return internalMonitoring_1.setDebugMode;

});
return global;
return publicApi;
}
exports.makeGlobal = makeGlobal;
exports.makePublicApi = makePublicApi;
function defineGlobal(global, name, api) {

@@ -31,0 +31,0 @@ var existingGlobalVariable = global[name];

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

: [];
var intakeType = userConfiguration.useAlternateIntakeDomains ? 'alternate' : 'classic';
var intakeType = getIntakeType(transportConfiguration.site, userConfiguration);
var intakeUrls = getIntakeUrls(intakeType, transportConfiguration, userConfiguration.replica !== undefined);

@@ -134,2 +134,6 @@ var configuration = tslib_1.__assign({ beforeSend: userConfiguration.beforeSend, cookieOptions: buildCookieOptions(userConfiguration), isEnabled: function (feature) {

}
function getIntakeType(site, userConfiguration) {
// TODO when new intake will be available for gov, only allow classic intake for us and eu
return userConfiguration.useAlternateIntakeDomains || site === 'us3.datadoghq.com' ? 'alternate' : 'classic';
}
function getIntakeUrls(intakeType, conf, withReplica) {

@@ -136,0 +140,0 @@ if (conf.proxyHost) {

export { DEFAULT_CONFIGURATION, Configuration, UserConfiguration, buildCookieOptions } from './domain/configuration';
export { startAutomaticErrorCollection, ErrorObservable } from './domain/automaticErrorCollection';
export { computeStackTrace } from './domain/tracekit';
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makePublicApi, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { InternalMonitoring, MonitoringMessage, monitored, monitor, addMonitoringMessage, } from './domain/internalMonitoring';

@@ -6,0 +6,0 @@ export { Observable } from './tools/observable';

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

exports.defineGlobal = init_1.defineGlobal;
exports.makeGlobal = init_1.makeGlobal;
exports.makePublicApi = init_1.makePublicApi;
exports.commonInit = init_1.commonInit;

@@ -18,0 +18,0 @@ exports.checkCookiesAuthorized = init_1.checkCookiesAuthorized;

import { CookieOptions } from '../browser/cookie';
import { UserConfiguration } from '../domain/configuration';
export declare function makeGlobal<T>(stub: T): T & {
export declare function makePublicApi<T>(stub: T): T & {
onReady(callback: () => void): void;

@@ -5,0 +5,0 @@ };

@@ -6,4 +6,4 @@ var _a;

import { setDebugMode, startInternalMonitoring } from '../domain/internalMonitoring';
export function makeGlobal(stub) {
var global = __assign(__assign({}, stub), {
export function makePublicApi(stub) {
var publicApi = __assign(__assign({}, stub), {
// This API method is intentionally not monitored, since the only thing executed is the

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

// as much as possible but of course it's not a real protection.
Object.defineProperty(global, '_setDebug', {
Object.defineProperty(publicApi, '_setDebug', {
get: function () {

@@ -24,3 +24,3 @@ return setDebugMode;

});
return global;
return publicApi;
}

@@ -27,0 +27,0 @@ export function defineGlobal(global, name, api) {

@@ -60,3 +60,3 @@ import { __assign } from "tslib";

: [];
var intakeType = userConfiguration.useAlternateIntakeDomains ? 'alternate' : 'classic';
var intakeType = getIntakeType(transportConfiguration.site, userConfiguration);
var intakeUrls = getIntakeUrls(intakeType, transportConfiguration, userConfiguration.replica !== undefined);

@@ -130,2 +130,6 @@ var configuration = __assign({ beforeSend: userConfiguration.beforeSend, cookieOptions: buildCookieOptions(userConfiguration), isEnabled: function (feature) {

}
function getIntakeType(site, userConfiguration) {
// TODO when new intake will be available for gov, only allow classic intake for us and eu
return userConfiguration.useAlternateIntakeDomains || site === 'us3.datadoghq.com' ? 'alternate' : 'classic';
}
function getIntakeUrls(intakeType, conf, withReplica) {

@@ -132,0 +136,0 @@ if (conf.proxyHost) {

export { DEFAULT_CONFIGURATION, Configuration, UserConfiguration, buildCookieOptions } from './domain/configuration';
export { startAutomaticErrorCollection, ErrorObservable } from './domain/automaticErrorCollection';
export { computeStackTrace } from './domain/tracekit';
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makePublicApi, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { InternalMonitoring, MonitoringMessage, monitored, monitor, addMonitoringMessage, } from './domain/internalMonitoring';

@@ -6,0 +6,0 @@ export { Observable } from './tools/observable';

export { DEFAULT_CONFIGURATION, buildCookieOptions } from './domain/configuration';
export { startAutomaticErrorCollection } from './domain/automaticErrorCollection';
export { computeStackTrace } from './domain/tracekit';
export { BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { BuildMode, Datacenter, defineGlobal, makePublicApi, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './boot/init';
export { monitored, monitor, addMonitoringMessage, } from './domain/internalMonitoring';

@@ -6,0 +6,0 @@ export { Observable } from './tools/observable';

{
"name": "@datadog/browser-core",
"version": "2.1.2",
"version": "2.2.0",
"license": "Apache-2.0",

@@ -18,4 +18,4 @@ "main": "cjs/index.js",

"devDependencies": {
"@types/sinon": "7.0.13",
"sinon": "7.3.2"
"@types/sinon": "9.0.10",
"sinon": "9.2.2"
},

@@ -27,3 +27,3 @@ "repository": {

},
"gitHead": "6c5a255d8ec1cd4562de2f74e42b74ac22702dee"
"gitHead": "8cb2ec883174f7194f62d2c66e0ba42152619b63"
}

@@ -5,4 +5,4 @@ import { areCookiesAuthorized, CookieOptions } from '../browser/cookie'

export function makeGlobal<T>(stub: T): T & { onReady(callback: () => void): void } {
const global = {
export function makePublicApi<T>(stub: T): T & { onReady(callback: () => void): void } {
const publicApi = {
...stub,

@@ -20,3 +20,3 @@

// as much as possible but of course it's not a real protection.
Object.defineProperty(global, '_setDebug', {
Object.defineProperty(publicApi, '_setDebug', {
get() {

@@ -28,3 +28,3 @@ return setDebugMode

return global
return publicApi
}

@@ -31,0 +31,0 @@

@@ -136,6 +136,6 @@ import { BuildEnv, BuildMode, Datacenter } from '../boot/init'

it('should handle sites with subdomains and classic intake', () => {
const configuration = buildConfiguration({ clientToken, site: 'us3.datadoghq.com' }, usEnv)
expect(configuration.isIntakeUrl('https://rum-http-intake.logs.us3.datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://browser-http-intake.logs.us3.datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://public-trace-http-intake.logs.us3.datadoghq.com/v1/input/xxx')).toBe(
const configuration = buildConfiguration({ clientToken, site: 'foo.datadoghq.com' }, usEnv)
expect(configuration.isIntakeUrl('https://rum-http-intake.logs.foo.datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://browser-http-intake.logs.foo.datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://public-trace-http-intake.logs.foo.datadoghq.com/v1/input/xxx')).toBe(
true

@@ -147,5 +147,15 @@ )

const configuration = buildConfiguration(
{ clientToken, site: 'us3.datadoghq.com', useAlternateIntakeDomains: true },
{ clientToken, site: 'foo.datadoghq.com', useAlternateIntakeDomains: true },
usEnv
)
expect(configuration.isIntakeUrl('https://rum.browser-intake-foo-datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://logs.browser-intake-foo-datadoghq.com/v1/input/xxx')).toBe(true)
expect(configuration.isIntakeUrl('https://trace.browser-intake-foo-datadoghq.com/v1/input/xxx')).toBe(true)
})
it('should force alternate intake for us3', () => {
const configuration = buildConfiguration(
{ clientToken, site: 'us3.datadoghq.com', useAlternateIntakeDomains: false },
usEnv
)
expect(configuration.isIntakeUrl('https://rum.browser-intake-us3-datadoghq.com/v1/input/xxx')).toBe(true)

@@ -152,0 +162,0 @@ expect(configuration.isIntakeUrl('https://logs.browser-intake-us3-datadoghq.com/v1/input/xxx')).toBe(true)

@@ -142,3 +142,3 @@ import { BuildEnv, BuildMode, Datacenter, INTAKE_SITE } from '../boot/init'

const intakeType: IntakeType = userConfiguration.useAlternateIntakeDomains ? 'alternate' : 'classic'
const intakeType: IntakeType = getIntakeType(transportConfiguration.site, userConfiguration)
const intakeUrls = getIntakeUrls(intakeType, transportConfiguration, userConfiguration.replica !== undefined)

@@ -260,2 +260,7 @@ const configuration: Configuration = {

function getIntakeType(site: string, userConfiguration: UserConfiguration) {
// TODO when new intake will be available for gov, only allow classic intake for us and eu
return userConfiguration.useAlternateIntakeDomains || site === 'us3.datadoghq.com' ? 'alternate' : 'classic'
}
function getIntakeUrls(intakeType: IntakeType, conf: TransportConfiguration, withReplica: boolean) {

@@ -262,0 +267,0 @@ if (conf.proxyHost) {

@@ -9,3 +9,3 @@ export { DEFAULT_CONFIGURATION, Configuration, UserConfiguration, buildCookieOptions } from './domain/configuration'

defineGlobal,
makeGlobal,
makePublicApi,
commonInit,

@@ -12,0 +12,0 @@ checkCookiesAuthorized,

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