@datadog/browser-core
Advanced tools
Comparing version 4.40.0 to 4.41.0
@@ -9,3 +9,3 @@ "use strict"; | ||
var publicApi = (0, polyfills_1.assign)({ | ||
version: "4.40.0", | ||
version: "4.41.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 |
@@ -69,3 +69,3 @@ "use strict"; | ||
var clientToken = _a.clientToken, internalAnalyticsSubdomain = _a.internalAnalyticsSubdomain; | ||
var tags = ["sdk_version:".concat("4.40.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("4.41.0"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.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.40.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.41.0")), | ||
'dd-evp-origin=browser', | ||
@@ -84,0 +84,0 @@ "dd-request-id=".concat((0, stringUtils_1.generateUUID)()), |
@@ -10,3 +10,2 @@ "use strict"; | ||
var sanitize_1 = require("../../tools/serialisation/sanitize"); | ||
var experimentalFeatures_1 = require("../../tools/experimentalFeatures"); | ||
var polyfills_1 = require("../../tools/utils/polyfills"); | ||
@@ -64,3 +63,3 @@ var jsonStringify_1 = require("../../tools/serialisation/jsonStringify"); | ||
if (typeof param === 'string') { | ||
return (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.SANITIZE_INPUTS) ? (0, sanitize_1.sanitize)(param) : param; | ||
return (0, sanitize_1.sanitize)(param); | ||
} | ||
@@ -70,4 +69,4 @@ if (param instanceof Error) { | ||
} | ||
return (0, jsonStringify_1.jsonStringify)((0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.SANITIZE_INPUTS) ? (0, sanitize_1.sanitize)(param) : param, undefined, 2); | ||
return (0, jsonStringify_1.jsonStringify)((0, sanitize_1.sanitize)(param), undefined, 2); | ||
} | ||
//# sourceMappingURL=consoleObservable.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
var tracekit_1 = require("../tracekit"); | ||
var experimentalFeatures_1 = require("../../tools/experimentalFeatures"); | ||
var monitor_1 = require("../../tools/monitor"); | ||
@@ -15,5 +14,2 @@ var sanitize_1 = require("../../tools/serialisation/sanitize"); | ||
if (!stackTrace || (stackTrace.message === undefined && !(originalError instanceof Error))) { | ||
var sanitizedError = (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.SANITIZE_INPUTS) | ||
? (0, sanitize_1.sanitize)(originalError) | ||
: originalError; | ||
return { | ||
@@ -23,4 +19,4 @@ startClocks: startClocks, | ||
handling: handling, | ||
originalError: sanitizedError, | ||
message: "".concat(nonErrorPrefix, " ").concat((0, jsonStringify_1.jsonStringify)(sanitizedError)), | ||
originalError: originalError, | ||
message: "".concat(nonErrorPrefix, " ").concat((0, jsonStringify_1.jsonStringify)((0, sanitize_1.sanitize)(originalError))), | ||
stack: exports.NO_ERROR_STACK_PRESENT_MESSAGE, | ||
@@ -27,0 +23,0 @@ handlingStack: handlingStack, |
@@ -51,3 +51,3 @@ "use strict"; | ||
service: telemetryService, | ||
version: "4.40.0", | ||
version: "4.41.0", | ||
source: 'browser', | ||
@@ -54,0 +54,0 @@ _dd: { |
@@ -14,4 +14,3 @@ /** | ||
RESOURCE_PAGE_STATES = "resource_page_states", | ||
COLLECT_FLUSH_REASON = "collect_flush_reason", | ||
SANITIZE_INPUTS = "sanitize_inputs" | ||
COLLECT_FLUSH_REASON = "collect_flush_reason" | ||
} | ||
@@ -18,0 +17,0 @@ export declare function addExperimentalFeatures(enabledFeatures: ExperimentalFeature[]): void; |
@@ -22,3 +22,2 @@ "use strict"; | ||
ExperimentalFeature["COLLECT_FLUSH_REASON"] = "collect_flush_reason"; | ||
ExperimentalFeature["SANITIZE_INPUTS"] = "sanitize_inputs"; | ||
})(ExperimentalFeature = exports.ExperimentalFeature || (exports.ExperimentalFeature = {})); | ||
@@ -25,0 +24,0 @@ var enabledExperimentalFeatures = new Set(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createContextManager = exports.BYTES_COMPUTATION_THROTTLING_DELAY = void 0; | ||
var experimentalFeatures_1 = require("../experimentalFeatures"); | ||
var byteUtils_1 = require("../utils/byteUtils"); | ||
@@ -46,11 +45,7 @@ var functionUtils_1 = require("../utils/functionUtils"); | ||
setContext: function (newContext) { | ||
context = (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.SANITIZE_INPUTS) | ||
? (0, sanitize_1.sanitize)(newContext) | ||
: (0, mergeInto_1.deepClone)(newContext); | ||
context = (0, sanitize_1.sanitize)(newContext); | ||
computeBytesCountThrottled(context); | ||
}, | ||
setContextProperty: function (key, property) { | ||
context[key] = (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.SANITIZE_INPUTS) | ||
? (0, sanitize_1.sanitize)(property) | ||
: (0, mergeInto_1.deepClone)(property); | ||
context[key] = (0, sanitize_1.sanitize)(property); | ||
computeBytesCountThrottled(context); | ||
@@ -57,0 +52,0 @@ }, |
@@ -6,3 +6,3 @@ import { catchUserErrors } from '../tools/catchUserErrors'; | ||
var publicApi = assign({ | ||
version: "4.40.0", | ||
version: "4.41.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 |
@@ -65,3 +65,3 @@ import { timeStampNow } from '../../tools/utils/timeUtils'; | ||
var clientToken = _a.clientToken, internalAnalyticsSubdomain = _a.internalAnalyticsSubdomain; | ||
var tags = ["sdk_version:".concat("4.40.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("4.41.0"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.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.40.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.41.0")), | ||
'dd-evp-origin=browser', | ||
@@ -80,0 +80,0 @@ "dd-request-id=".concat(generateUUID()), |
@@ -7,3 +7,2 @@ import { computeStackTrace } from '../tracekit'; | ||
import { sanitize } from '../../tools/serialisation/sanitize'; | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'; | ||
import { find } from '../../tools/utils/polyfills'; | ||
@@ -60,3 +59,3 @@ import { jsonStringify } from '../../tools/serialisation/jsonStringify'; | ||
if (typeof param === 'string') { | ||
return isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) ? sanitize(param) : param; | ||
return sanitize(param); | ||
} | ||
@@ -66,4 +65,4 @@ if (param instanceof Error) { | ||
} | ||
return jsonStringify(isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) ? sanitize(param) : param, undefined, 2); | ||
return jsonStringify(sanitize(param), undefined, 2); | ||
} | ||
//# sourceMappingURL=consoleObservable.js.map |
import { computeStackTrace } from '../tracekit'; | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'; | ||
import { callMonitored } from '../../tools/monitor'; | ||
@@ -11,5 +10,2 @@ import { sanitize } from '../../tools/serialisation/sanitize'; | ||
if (!stackTrace || (stackTrace.message === undefined && !(originalError instanceof Error))) { | ||
var sanitizedError = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(originalError) | ||
: originalError; | ||
return { | ||
@@ -19,4 +15,4 @@ startClocks: startClocks, | ||
handling: handling, | ||
originalError: sanitizedError, | ||
message: "".concat(nonErrorPrefix, " ").concat(jsonStringify(sanitizedError)), | ||
originalError: originalError, | ||
message: "".concat(nonErrorPrefix, " ").concat(jsonStringify(sanitize(originalError))), | ||
stack: NO_ERROR_STACK_PRESENT_MESSAGE, | ||
@@ -23,0 +19,0 @@ handlingStack: handlingStack, |
@@ -48,3 +48,3 @@ import { ConsoleApiName } from '../../tools/display'; | ||
service: telemetryService, | ||
version: "4.40.0", | ||
version: "4.41.0", | ||
source: 'browser', | ||
@@ -51,0 +51,0 @@ _dd: { |
@@ -14,4 +14,3 @@ /** | ||
RESOURCE_PAGE_STATES = "resource_page_states", | ||
COLLECT_FLUSH_REASON = "collect_flush_reason", | ||
SANITIZE_INPUTS = "sanitize_inputs" | ||
COLLECT_FLUSH_REASON = "collect_flush_reason" | ||
} | ||
@@ -18,0 +17,0 @@ export declare function addExperimentalFeatures(enabledFeatures: ExperimentalFeature[]): void; |
@@ -19,3 +19,2 @@ /** | ||
ExperimentalFeature["COLLECT_FLUSH_REASON"] = "collect_flush_reason"; | ||
ExperimentalFeature["SANITIZE_INPUTS"] = "sanitize_inputs"; | ||
})(ExperimentalFeature || (ExperimentalFeature = {})); | ||
@@ -22,0 +21,0 @@ var enabledExperimentalFeatures = new Set(); |
@@ -1,2 +0,1 @@ | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../experimentalFeatures'; | ||
import { computeBytesCount } from '../utils/byteUtils'; | ||
@@ -43,11 +42,7 @@ import { throttle } from '../utils/functionUtils'; | ||
setContext: function (newContext) { | ||
context = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(newContext) | ||
: deepClone(newContext); | ||
context = sanitize(newContext); | ||
computeBytesCountThrottled(context); | ||
}, | ||
setContextProperty: function (key, property) { | ||
context[key] = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(property) | ||
: deepClone(property); | ||
context[key] = sanitize(property); | ||
computeBytesCountThrottled(context); | ||
@@ -54,0 +49,0 @@ }, |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "4.40.0", | ||
"version": "4.41.0", | ||
"license": "Apache-2.0", | ||
@@ -23,3 +23,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "4a291821c3e07385b7ab76566bb6aa5d4cc5a80f" | ||
"gitHead": "1fcc1cabdf989599914551d0ef82e6cb8d569892" | ||
} |
@@ -7,3 +7,2 @@ import { computeStackTrace } from '../tracekit' | ||
import { sanitize } from '../../tools/serialisation/sanitize' | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures' | ||
import { find } from '../../tools/utils/polyfills' | ||
@@ -75,3 +74,3 @@ import { jsonStringify } from '../../tools/serialisation/jsonStringify' | ||
if (typeof param === 'string') { | ||
return isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) ? sanitize(param) : param | ||
return sanitize(param) | ||
} | ||
@@ -81,7 +80,3 @@ if (param instanceof Error) { | ||
} | ||
return jsonStringify( | ||
isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) ? sanitize(param) : param, | ||
undefined, | ||
2 | ||
) | ||
return jsonStringify(sanitize(param), undefined, 2) | ||
} |
@@ -168,2 +168,28 @@ import type { StackTrace } from '../tracekit' | ||
}) | ||
it('should propagate the original error without modifications', () => { | ||
const error = { description: 'syntax error' } | ||
const stackTrace: StackTrace = { | ||
message: 'some syntax message', | ||
name: 'SyntaxError', | ||
stack: [], | ||
} | ||
const formattedWithoutStackTrace = computeRawError({ | ||
...DEFAULT_RAW_ERROR_PARAMS, | ||
stackTrace: NOT_COMPUTED_STACK_TRACE, | ||
originalError: error, | ||
handling: ErrorHandling.HANDLED, | ||
}) | ||
const formattedWithStackTrace = computeRawError({ | ||
...DEFAULT_RAW_ERROR_PARAMS, | ||
stackTrace, | ||
originalError: error, | ||
handling: ErrorHandling.HANDLED, | ||
}) | ||
expect(formattedWithStackTrace.originalError).toBe(error) | ||
expect(formattedWithoutStackTrace.originalError).toBe(error) | ||
}) | ||
}) | ||
@@ -170,0 +196,0 @@ |
import type { StackTrace } from '../tracekit' | ||
import { computeStackTrace } from '../tracekit' | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures' | ||
import { callMonitored } from '../../tools/monitor' | ||
@@ -34,5 +33,2 @@ import { sanitize } from '../../tools/serialisation/sanitize' | ||
if (!stackTrace || (stackTrace.message === undefined && !(originalError instanceof Error))) { | ||
const sanitizedError = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(originalError) | ||
: originalError | ||
return { | ||
@@ -42,4 +38,4 @@ startClocks, | ||
handling, | ||
originalError: sanitizedError, | ||
message: `${nonErrorPrefix} ${jsonStringify(sanitizedError)!}`, | ||
originalError, | ||
message: `${nonErrorPrefix} ${jsonStringify(sanitize(originalError))!}`, | ||
stack: NO_ERROR_STACK_PRESENT_MESSAGE, | ||
@@ -46,0 +42,0 @@ handlingStack, |
@@ -18,3 +18,2 @@ /** | ||
COLLECT_FLUSH_REASON = 'collect_flush_reason', | ||
SANITIZE_INPUTS = 'sanitize_inputs', | ||
} | ||
@@ -21,0 +20,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../experimentalFeatures' | ||
import { computeBytesCount } from '../utils/byteUtils' | ||
@@ -55,5 +54,3 @@ import { throttle } from '../utils/functionUtils' | ||
setContext: (newContext: Context) => { | ||
context = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(newContext) | ||
: deepClone(newContext) | ||
context = sanitize(newContext) | ||
computeBytesCountThrottled(context) | ||
@@ -63,5 +60,3 @@ }, | ||
setContextProperty: (key: string, property: any) => { | ||
context[key] = isExperimentalFeatureEnabled(ExperimentalFeature.SANITIZE_INPUTS) | ||
? sanitize(property) | ||
: deepClone(property) | ||
context[key] = sanitize(property) | ||
computeBytesCountThrottled(context) | ||
@@ -68,0 +63,0 @@ }, |
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
1176911
23035