@datadog/browser-core
Advanced tools
Comparing version 1.17.0 to 1.18.0
import { BuildEnv, Datacenter } from './init'; | ||
export declare const DEFAULT_CONFIGURATION: { | ||
allowedTracingOrigins: (string | RegExp)[]; | ||
isCollectingError: boolean; | ||
@@ -36,2 +37,3 @@ maxErrorsByMinute: number; | ||
isCollectingError?: boolean; | ||
allowedTracingOrigins?: Array<string | RegExp>; | ||
sampleRate?: number; | ||
@@ -63,3 +65,2 @@ resourceSampleRate?: number; | ||
proxyHost?: string; | ||
service?: string; | ||
isEnabled: (feature: string) => boolean; | ||
@@ -66,0 +67,0 @@ replica?: ReplicaConfiguration; |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.DEFAULT_CONFIGURATION = { | ||
allowedTracingOrigins: [], | ||
isCollectingError: true, | ||
@@ -57,2 +58,5 @@ maxErrorsByMinute: 3000, | ||
} | ||
if ('allowedTracingOrigins' in userConfiguration) { | ||
configuration.allowedTracingOrigins = userConfiguration.allowedTracingOrigins; | ||
} | ||
if ('isCollectingError' in userConfiguration) { | ||
@@ -59,0 +63,0 @@ configuration.isCollectingError = !!userConfiguration.isCollectingError; |
@@ -1,4 +0,4 @@ | ||
export interface FetchProxy { | ||
beforeSend: (callback: (context: Partial<FetchContext>) => void) => void; | ||
onRequestComplete: (callback: (context: FetchContext) => void) => void; | ||
export interface FetchProxy<T extends FetchContext = FetchContext> { | ||
beforeSend: (callback: (context: Partial<T>) => void) => void; | ||
onRequestComplete: (callback: (context: T) => void) => void; | ||
} | ||
@@ -8,2 +8,3 @@ export interface FetchContext { | ||
startTime: number; | ||
init?: RequestInit; | ||
duration: number; | ||
@@ -19,3 +20,3 @@ url: string; | ||
} | ||
export declare function startFetchProxy(): FetchProxy; | ||
export declare function startFetchProxy<T extends FetchContext = FetchContext>(): FetchProxy<T>; | ||
export declare function resetFetchProxy(): void; |
@@ -45,6 +45,9 @@ "use strict"; | ||
var method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET'; | ||
var url = urlPolyfill_1.normalizeUrl((typeof input === 'object' && input.url) || input); | ||
var startTime = performance.now(); | ||
var context = { | ||
init: init, | ||
method: method, | ||
startTime: startTime, | ||
url: url, | ||
}; | ||
@@ -57,3 +60,2 @@ var reportFetch = function (response) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
context.duration = performance.now() - context.startTime; | ||
context.url = urlPolyfill_1.normalizeUrl((typeof input === 'object' && input.url) || input); | ||
if (!('stack' in response || response instanceof Error)) return [3 /*break*/, 1]; | ||
@@ -89,3 +91,3 @@ context.status = 0; | ||
beforeSendCallbacks.forEach(function (callback) { return callback(context); }); | ||
var responsePromise = originalFetch.call(this, input, init); | ||
var responsePromise = originalFetch.call(this, input, context.init); | ||
responsePromise.then(internalMonitoring_1.monitor(reportFetch), internalMonitoring_1.monitor(reportFetch)); | ||
@@ -92,0 +94,0 @@ return responsePromise; |
@@ -1,4 +0,4 @@ | ||
export interface XhrProxy { | ||
beforeSend: (callback: (context: Partial<XhrContext>) => void) => void; | ||
onRequestComplete: (callback: (context: XhrContext) => void) => void; | ||
export interface XhrProxy<T extends XhrContext = XhrContext> { | ||
beforeSend: (callback: (context: Partial<T>, xhr: XMLHttpRequest) => void) => void; | ||
onRequestComplete: (callback: (context: T) => void) => void; | ||
} | ||
@@ -17,3 +17,3 @@ export interface XhrContext { | ||
} | ||
export declare function startXhrProxy(): XhrProxy; | ||
export declare function startXhrProxy<T extends XhrContext = XhrContext>(): XhrProxy<T>; | ||
export declare function resetXhrProxy(): void; |
@@ -70,3 +70,3 @@ "use strict"; | ||
this.addEventListener('loadend', internalMonitoring_1.monitor(reportXhr_1)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr, _this); }); | ||
} | ||
@@ -73,0 +73,0 @@ return originalXhrSend.apply(this, arguments); |
import { BuildEnv, Datacenter } from './init'; | ||
export declare const DEFAULT_CONFIGURATION: { | ||
allowedTracingOrigins: (string | RegExp)[]; | ||
isCollectingError: boolean; | ||
@@ -36,2 +37,3 @@ maxErrorsByMinute: number; | ||
isCollectingError?: boolean; | ||
allowedTracingOrigins?: Array<string | RegExp>; | ||
sampleRate?: number; | ||
@@ -63,3 +65,2 @@ resourceSampleRate?: number; | ||
proxyHost?: string; | ||
service?: string; | ||
isEnabled: (feature: string) => boolean; | ||
@@ -66,0 +67,0 @@ replica?: ReplicaConfiguration; |
@@ -6,2 +6,3 @@ import { __assign } from "tslib"; | ||
export var DEFAULT_CONFIGURATION = { | ||
allowedTracingOrigins: [], | ||
isCollectingError: true, | ||
@@ -55,2 +56,5 @@ maxErrorsByMinute: 3000, | ||
} | ||
if ('allowedTracingOrigins' in userConfiguration) { | ||
configuration.allowedTracingOrigins = userConfiguration.allowedTracingOrigins; | ||
} | ||
if ('isCollectingError' in userConfiguration) { | ||
@@ -57,0 +61,0 @@ configuration.isCollectingError = !!userConfiguration.isCollectingError; |
@@ -1,4 +0,4 @@ | ||
export interface FetchProxy { | ||
beforeSend: (callback: (context: Partial<FetchContext>) => void) => void; | ||
onRequestComplete: (callback: (context: FetchContext) => void) => void; | ||
export interface FetchProxy<T extends FetchContext = FetchContext> { | ||
beforeSend: (callback: (context: Partial<T>) => void) => void; | ||
onRequestComplete: (callback: (context: T) => void) => void; | ||
} | ||
@@ -8,2 +8,3 @@ export interface FetchContext { | ||
startTime: number; | ||
init?: RequestInit; | ||
duration: number; | ||
@@ -19,3 +20,3 @@ url: string; | ||
} | ||
export declare function startFetchProxy(): FetchProxy; | ||
export declare function startFetchProxy<T extends FetchContext = FetchContext>(): FetchProxy<T>; | ||
export declare function resetFetchProxy(): void; |
@@ -41,6 +41,9 @@ import { __awaiter, __generator } from "tslib"; | ||
var method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET'; | ||
var url = normalizeUrl((typeof input === 'object' && input.url) || input); | ||
var startTime = performance.now(); | ||
var context = { | ||
init: init, | ||
method: method, | ||
startTime: startTime, | ||
url: url, | ||
}; | ||
@@ -53,3 +56,2 @@ var reportFetch = function (response) { return __awaiter(_this, void 0, void 0, function () { | ||
context.duration = performance.now() - context.startTime; | ||
context.url = normalizeUrl((typeof input === 'object' && input.url) || input); | ||
if (!('stack' in response || response instanceof Error)) return [3 /*break*/, 1]; | ||
@@ -85,3 +87,3 @@ context.status = 0; | ||
beforeSendCallbacks.forEach(function (callback) { return callback(context); }); | ||
var responsePromise = originalFetch.call(this, input, init); | ||
var responsePromise = originalFetch.call(this, input, context.init); | ||
responsePromise.then(monitor(reportFetch), monitor(reportFetch)); | ||
@@ -88,0 +90,0 @@ return responsePromise; |
@@ -1,4 +0,4 @@ | ||
export interface XhrProxy { | ||
beforeSend: (callback: (context: Partial<XhrContext>) => void) => void; | ||
onRequestComplete: (callback: (context: XhrContext) => void) => void; | ||
export interface XhrProxy<T extends XhrContext = XhrContext> { | ||
beforeSend: (callback: (context: Partial<T>, xhr: XMLHttpRequest) => void) => void; | ||
onRequestComplete: (callback: (context: T) => void) => void; | ||
} | ||
@@ -17,3 +17,3 @@ export interface XhrContext { | ||
} | ||
export declare function startXhrProxy(): XhrProxy; | ||
export declare function startXhrProxy<T extends XhrContext = XhrContext>(): XhrProxy<T>; | ||
export declare function resetXhrProxy(): void; |
@@ -66,3 +66,3 @@ import { monitor } from './internalMonitoring'; | ||
this.addEventListener('loadend', monitor(reportXhr_1)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr, _this); }); | ||
} | ||
@@ -69,0 +69,0 @@ return originalXhrSend.apply(this, arguments); |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "812e916fe93d2cb07ecc950e949f5a00781a7666" | ||
"gitHead": "3102b6bce54e93f7ef5a581414fc2aee8ba41074" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
385786
6382