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 1.5.0 to 1.6.3

2

cjs/configuration.d.ts
import { BuildEnv, Datacenter } from './init';
export declare const DEFAULT_CONFIGURATION: {
enableExperimentalFeatures: boolean;
isCollectingError: boolean;

@@ -36,2 +37,3 @@ maxErrorsByMinute: number;

datacenter?: Datacenter;
enableExperimentalFeatures?: boolean;
internalMonitoringEndpoint?: string;

@@ -38,0 +40,0 @@ logsEndpoint?: string;

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

exports.DEFAULT_CONFIGURATION = {
enableExperimentalFeatures: false,
isCollectingError: true,

@@ -52,2 +53,5 @@ maxErrorsByMinute: 3000,

}
if ('enableExperimentalFeatures' in userConfiguration) {
configuration.enableExperimentalFeatures = userConfiguration.enableExperimentalFeatures;
}
if (transportConfiguration.env === 'e2e-test') {

@@ -54,0 +58,0 @@ if (userConfiguration.internalMonitoringEndpoint !== undefined) {

@@ -6,2 +6,3 @@ import { Configuration } from './configuration';

export interface ErrorMessage {
startTime: number;
message: string;

@@ -46,4 +47,5 @@ context: {

};
startTime: number;
};
export declare function toStackTraceString(stack: StackTrace): string;
export declare function trackNetworkError(configuration: Configuration, errorObservable: ErrorObservable, requestObservable: RequestObservable): void;

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

message: "Reached max number of errors by minute: " + configuration.maxErrorsByMinute,
startTime: performance.now(),
});

@@ -72,2 +73,3 @@ }

message: ['console error:', message].concat(optionalParams).map(formatConsoleParameters).join(' '),
startTime: performance.now(),
});

@@ -123,2 +125,3 @@ });

},
startTime: performance.now(),
};

@@ -155,2 +158,3 @@ }

message: format(request.type) + " error " + request.method + " " + request.url,
startTime: request.startTime,
});

@@ -157,0 +161,0 @@ }

@@ -37,3 +37,8 @@ "use strict";

var startTime = performance.now();
var hasBeenReported = false;
var reportXhr = function () {
if (hasBeenReported) {
return;
}
hasBeenReported = true;
observable.notify({

@@ -50,2 +55,11 @@ startTime: startTime,

};
var originalOnreadystatechange = this.onreadystatechange;
this.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE) {
internalMonitoring_1.monitor(reportXhr)();
}
if (originalOnreadystatechange) {
originalOnreadystatechange.apply(this, arguments);
}
};
this.addEventListener('loadend', internalMonitoring_1.monitor(reportXhr));

@@ -52,0 +66,0 @@ return originalSend.apply(this, arguments);

@@ -0,3 +1,5 @@

import { Configuration } from './configuration';
import { Observable } from './observable';
import { RequestDetails } from './requestCollection';
export declare const SPEC_ENDPOINTS: Partial<Configuration>;
export declare function isSafari(): boolean;

@@ -4,0 +6,0 @@ export declare function isFirefox(): boolean;

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

var utils_1 = require("./utils");
exports.SPEC_ENDPOINTS = {
internalMonitoringEndpoint: 'https://monitoring-intake.com/abcde?foo=bar',
logsEndpoint: 'https://logs-intake.com/abcde?foo=bar',
rumEndpoint: 'https://rum-intake.com/abcde?foo=bar',
traceEndpoint: 'https://trace-intake.com/abcde?foo=bar',
};
function isSafari() {

@@ -7,0 +13,0 @@ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

3

cjs/transport.d.ts

@@ -13,3 +13,4 @@ import { Context } from './utils';

private bytesLimit;
constructor(endpointUrl: string, bytesLimit: number);
private withBatchTime;
constructor(endpointUrl: string, bytesLimit: number, withBatchTime?: boolean);
send(data: string, size: number): void;

@@ -16,0 +17,0 @@ }

@@ -16,9 +16,13 @@ "use strict";

var HttpRequest = /** @class */ (function () {
function HttpRequest(endpointUrl, bytesLimit) {
function HttpRequest(endpointUrl, bytesLimit, withBatchTime) {
if (withBatchTime === void 0) { withBatchTime = false; }
this.endpointUrl = endpointUrl;
this.bytesLimit = bytesLimit;
this.withBatchTime = withBatchTime;
}
HttpRequest.prototype.send = function (data, size) {
var batchTime = new Date().getTime();
var url = this.withBatchTime ? this.endpointUrl + "&batch_time=" + batchTime : this.endpointUrl;
if (navigator.sendBeacon && size < this.bytesLimit) {
var isQueued = navigator.sendBeacon(this.endpointUrl, data);
var isQueued = navigator.sendBeacon(url, data);
if (isQueued) {

@@ -29,3 +33,3 @@ return;

var request = new XMLHttpRequest();
request.open('POST', this.endpointUrl, true);
request.open('POST', url, true);
request.send(data);

@@ -32,0 +36,0 @@ };

@@ -6,2 +6,3 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare enum ResourceKind {
DOCUMENT = "document",
XHR = "xhr",

@@ -49,5 +50,5 @@ BEACON = "beacon",

export declare function jsonStringify(value: unknown, replacer?: Array<string | number>, space?: string | number): string | undefined;
export declare function startsWith(candidate: string, search: string): boolean;
export declare function includes(candidate: unknown[], search: unknown): boolean;
export declare function isPercentage(value: unknown): boolean;
export declare function isNumber(value: unknown): value is number;
/**

@@ -61,2 +62,3 @@ * Get the time since the navigation was started.

export declare function getRelativeTime(timestamp: number): number;
export declare function getTimestamp(relativeTime: number): number;
export declare function objectValues(object: {

@@ -63,0 +65,0 @@ [key: string]: unknown;

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

(function (ResourceKind) {
ResourceKind["DOCUMENT"] = "document";
ResourceKind["XHR"] = "xhr";

@@ -150,6 +151,2 @@ ResourceKind["BEACON"] = "beacon";

}
function startsWith(candidate, search) {
return candidate.indexOf(search) === 0;
}
exports.startsWith = startsWith;
function includes(candidate, search) {

@@ -160,5 +157,9 @@ return candidate.indexOf(search) !== -1;

function isPercentage(value) {
return typeof value === 'number' && value >= 0 && value <= 100;
return isNumber(value) && value >= 0 && value <= 100;
}
exports.isPercentage = isPercentage;
function isNumber(value) {
return typeof value === 'number';
}
exports.isNumber = isNumber;
/**

@@ -175,2 +176,6 @@ * Get the time since the navigation was started.

exports.getRelativeTime = getRelativeTime;
function getTimestamp(relativeTime) {
return Math.floor(performance.timing.navigationStart + relativeTime);
}
exports.getTimestamp = getTimestamp;
function objectValues(object) {

@@ -177,0 +182,0 @@ var values = [];

import { BuildEnv, Datacenter } from './init';
export declare const DEFAULT_CONFIGURATION: {
enableExperimentalFeatures: boolean;
isCollectingError: boolean;

@@ -36,2 +37,3 @@ maxErrorsByMinute: number;

datacenter?: Datacenter;
enableExperimentalFeatures?: boolean;
internalMonitoringEndpoint?: string;

@@ -38,0 +40,0 @@ logsEndpoint?: string;

import * as tslib_1 from "tslib";
import { ONE_KILO_BYTE, ONE_SECOND } from './utils';
export var DEFAULT_CONFIGURATION = {
enableExperimentalFeatures: false,
isCollectingError: true,

@@ -49,2 +50,5 @@ maxErrorsByMinute: 3000,

}
if ('enableExperimentalFeatures' in userConfiguration) {
configuration.enableExperimentalFeatures = userConfiguration.enableExperimentalFeatures;
}
if (transportConfiguration.env === 'e2e-test') {

@@ -51,0 +55,0 @@ if (userConfiguration.internalMonitoringEndpoint !== undefined) {

@@ -6,2 +6,3 @@ import { Configuration } from './configuration';

export interface ErrorMessage {
startTime: number;
message: string;

@@ -46,4 +47,5 @@ context: {

};
startTime: number;
};
export declare function toStackTraceString(stack: StackTrace): string;
export declare function trackNetworkError(configuration: Configuration, errorObservable: ErrorObservable, requestObservable: RequestObservable): void;

@@ -45,2 +45,3 @@ import { monitor } from './internalMonitoring';

message: "Reached max number of errors by minute: " + configuration.maxErrorsByMinute,
startTime: performance.now(),
});

@@ -68,2 +69,3 @@ }

message: ['console error:', message].concat(optionalParams).map(formatConsoleParameters).join(' '),
startTime: performance.now(),
});

@@ -115,2 +117,3 @@ });

},
startTime: performance.now(),
};

@@ -145,2 +148,3 @@ }

message: format(request.type) + " error " + request.method + " " + request.url,
startTime: request.startTime,
});

@@ -147,0 +151,0 @@ }

@@ -34,3 +34,8 @@ import * as tslib_1 from "tslib";

var startTime = performance.now();
var hasBeenReported = false;
var reportXhr = function () {
if (hasBeenReported) {
return;
}
hasBeenReported = true;
observable.notify({

@@ -47,2 +52,11 @@ startTime: startTime,

};
var originalOnreadystatechange = this.onreadystatechange;
this.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE) {
monitor(reportXhr)();
}
if (originalOnreadystatechange) {
originalOnreadystatechange.apply(this, arguments);
}
};
this.addEventListener('loadend', monitor(reportXhr));

@@ -49,0 +63,0 @@ return originalSend.apply(this, arguments);

@@ -0,3 +1,5 @@

import { Configuration } from './configuration';
import { Observable } from './observable';
import { RequestDetails } from './requestCollection';
export declare const SPEC_ENDPOINTS: Partial<Configuration>;
export declare function isSafari(): boolean;

@@ -4,0 +6,0 @@ export declare function isFirefox(): boolean;

import * as tslib_1 from "tslib";
import { noop } from './utils';
export var SPEC_ENDPOINTS = {
internalMonitoringEndpoint: 'https://monitoring-intake.com/abcde?foo=bar',
logsEndpoint: 'https://logs-intake.com/abcde?foo=bar',
rumEndpoint: 'https://rum-intake.com/abcde?foo=bar',
traceEndpoint: 'https://trace-intake.com/abcde?foo=bar',
};
export function isSafari() {

@@ -4,0 +10,0 @@ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

@@ -13,3 +13,4 @@ import { Context } from './utils';

private bytesLimit;
constructor(endpointUrl: string, bytesLimit: number);
private withBatchTime;
constructor(endpointUrl: string, bytesLimit: number, withBatchTime?: boolean);
send(data: string, size: number): void;

@@ -16,0 +17,0 @@ }

@@ -13,9 +13,13 @@ import lodashMerge from 'lodash.merge';

var HttpRequest = /** @class */ (function () {
function HttpRequest(endpointUrl, bytesLimit) {
function HttpRequest(endpointUrl, bytesLimit, withBatchTime) {
if (withBatchTime === void 0) { withBatchTime = false; }
this.endpointUrl = endpointUrl;
this.bytesLimit = bytesLimit;
this.withBatchTime = withBatchTime;
}
HttpRequest.prototype.send = function (data, size) {
var batchTime = new Date().getTime();
var url = this.withBatchTime ? this.endpointUrl + "&batch_time=" + batchTime : this.endpointUrl;
if (navigator.sendBeacon && size < this.bytesLimit) {
var isQueued = navigator.sendBeacon(this.endpointUrl, data);
var isQueued = navigator.sendBeacon(url, data);
if (isQueued) {

@@ -26,3 +30,3 @@ return;

var request = new XMLHttpRequest();
request.open('POST', this.endpointUrl, true);
request.open('POST', url, true);
request.send(data);

@@ -29,0 +33,0 @@ };

@@ -6,2 +6,3 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare enum ResourceKind {
DOCUMENT = "document",
XHR = "xhr",

@@ -49,5 +50,5 @@ BEACON = "beacon",

export declare function jsonStringify(value: unknown, replacer?: Array<string | number>, space?: string | number): string | undefined;
export declare function startsWith(candidate: string, search: string): boolean;
export declare function includes(candidate: unknown[], search: unknown): boolean;
export declare function isPercentage(value: unknown): boolean;
export declare function isNumber(value: unknown): value is number;
/**

@@ -61,2 +62,3 @@ * Get the time since the navigation was started.

export declare function getRelativeTime(timestamp: number): number;
export declare function getTimestamp(relativeTime: number): number;
export declare function objectValues(object: {

@@ -63,0 +65,0 @@ [key: string]: unknown;

@@ -6,2 +6,3 @@ export var ONE_SECOND = 1000;

(function (ResourceKind) {
ResourceKind["DOCUMENT"] = "document";
ResourceKind["XHR"] = "xhr";

@@ -138,5 +139,2 @@ ResourceKind["BEACON"] = "beacon";

}
export function startsWith(candidate, search) {
return candidate.indexOf(search) === 0;
}
export function includes(candidate, search) {

@@ -146,4 +144,7 @@ return candidate.indexOf(search) !== -1;

export function isPercentage(value) {
return typeof value === 'number' && value >= 0 && value <= 100;
return isNumber(value) && value >= 0 && value <= 100;
}
export function isNumber(value) {
return typeof value === 'number';
}
/**

@@ -159,2 +160,5 @@ * Get the time since the navigation was started.

}
export function getTimestamp(relativeTime) {
return Math.floor(performance.timing.navigationStart + relativeTime);
}
export function objectValues(object) {

@@ -161,0 +165,0 @@ var values = [];

{
"name": "@datadog/browser-core",
"version": "1.5.0",
"version": "1.6.3",
"license": "Apache-2.0",

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

},
"gitHead": "f70c4905c4f074895f043ed5a5a637d2a8d6203d"
"gitHead": "601cd5cf3e22e3814abee1f53484510149f02e2a"
}

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