@datadog/browser-core
Advanced tools
Comparing version 5.25.0 to 5.26.0
@@ -11,3 +11,3 @@ "use strict"; | ||
var publicApi = (0, polyfills_1.assign)({ | ||
version: "5.25.0", | ||
version: "5.26.0", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -14,0 +14,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -59,3 +59,3 @@ "use strict"; | ||
var retry = _b.retry, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("5.25.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("5.26.0"), "api:".concat(api)].concat(configurationTags); | ||
if (retry) { | ||
@@ -68,3 +68,3 @@ tags.push("retry_count:".concat(retry.count), "retry_after:".concat(retry.lastFailureStatus)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.25.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.26.0")), | ||
'dd-evp-origin=browser', | ||
@@ -71,0 +71,0 @@ "dd-request-id=".concat((0, stringUtils_1.generateUUID)()), |
@@ -5,1 +5,2 @@ import type { InitConfiguration } from './configuration'; | ||
export declare function buildTag(key: string, rawValue: string): string; | ||
export declare function supportUnicodePropertyEscapes(): boolean; |
@@ -6,2 +6,3 @@ "use strict"; | ||
exports.buildTag = buildTag; | ||
exports.supportUnicodePropertyEscapes = supportUnicodePropertyEscapes; | ||
var display_1 = require("../../tools/display"); | ||
@@ -26,3 +27,2 @@ exports.TAG_SIZE_LIMIT = 200; | ||
} | ||
var FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/; | ||
function buildTag(key, rawValue) { | ||
@@ -33,3 +33,3 @@ // See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note | ||
var valueSizeLimit = exports.TAG_SIZE_LIMIT - key.length - 1; | ||
if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) { | ||
if (rawValue.length > valueSizeLimit || hasForbiddenCharacters(rawValue)) { | ||
display_1.display.warn("".concat(key, " value doesn't meet tag requirements and will be sanitized. ").concat(display_1.MORE_DETAILS, " ").concat(display_1.DOCS_ORIGIN, "/getting_started/tagging/#defining-tags")); | ||
@@ -42,2 +42,23 @@ } | ||
} | ||
function hasForbiddenCharacters(rawValue) { | ||
// Unicode property escapes is not supported in all browsers, so we use a try/catch. | ||
// Todo: Remove the try/catch when dropping IE11. | ||
if (!supportUnicodePropertyEscapes()) { | ||
return false; | ||
} | ||
// We use the Unicode property escapes to match any character that is a letter including other languages like Chinese, Japanese, etc. | ||
// p{Ll} matches a lowercase letter. | ||
// p{Lo} matches a letter that is neither uppercase nor lowercase (ex: Japanese characters). | ||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape#unicode_property_escapes_vs._character_classes | ||
return new RegExp('[^\\p{Ll}\\p{Lo}0-9_:./-]', 'u').test(rawValue); | ||
} | ||
function supportUnicodePropertyEscapes() { | ||
try { | ||
new RegExp('[\\p{Ll}]', 'u'); | ||
return true; | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
//# sourceMappingURL=tags.js.map |
export declare const enum CustomerDataType { | ||
FeatureFlag = 0, | ||
User = 1, | ||
GlobalContext = 2 | ||
GlobalContext = 2, | ||
View = 3 | ||
} |
@@ -74,3 +74,3 @@ "use strict"; | ||
service: telemetryService, | ||
version: "5.25.0", | ||
version: "5.26.0", | ||
source: 'browser', | ||
@@ -77,0 +77,0 @@ _dd: { |
@@ -16,3 +16,4 @@ /** | ||
NULL_INP_TELEMETRY = "null_inp_telemetry", | ||
LONG_ANIMATION_FRAME = "long_animation_frame" | ||
LONG_ANIMATION_FRAME = "long_animation_frame", | ||
VIEW_SPECIFIC_CONTEXT = "view_specific_context" | ||
} | ||
@@ -19,0 +20,0 @@ export declare function initFeatureFlags(enableExperimentalFeatures?: string[] | undefined): void; |
@@ -30,2 +30,3 @@ "use strict"; | ||
ExperimentalFeature["LONG_ANIMATION_FRAME"] = "long_animation_frame"; | ||
ExperimentalFeature["VIEW_SPECIFIC_CONTEXT"] = "view_specific_context"; | ||
})(ExperimentalFeature || (exports.ExperimentalFeature = ExperimentalFeature = {})); | ||
@@ -32,0 +33,0 @@ var enabledExperimentalFeatures = new Set(); |
@@ -7,3 +7,3 @@ import { catchUserErrors } from '../tools/catchUserErrors'; | ||
var publicApi = assign({ | ||
version: "5.25.0", | ||
version: "5.26.0", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -10,0 +10,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -56,3 +56,3 @@ import { timeStampNow } from '../../tools/utils/timeUtils'; | ||
var retry = _b.retry, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("5.25.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("5.26.0"), "api:".concat(api)].concat(configurationTags); | ||
if (retry) { | ||
@@ -65,3 +65,3 @@ tags.push("retry_count:".concat(retry.count), "retry_after:".concat(retry.lastFailureStatus)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.25.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("5.26.0")), | ||
'dd-evp-origin=browser', | ||
@@ -68,0 +68,0 @@ "dd-request-id=".concat(generateUUID()), |
@@ -5,1 +5,2 @@ import type { InitConfiguration } from './configuration'; | ||
export declare function buildTag(key: string, rawValue: string): string; | ||
export declare function supportUnicodePropertyEscapes(): boolean; |
@@ -20,3 +20,2 @@ import { DOCS_ORIGIN, MORE_DETAILS, display } from '../../tools/display'; | ||
} | ||
var FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/; | ||
export function buildTag(key, rawValue) { | ||
@@ -27,3 +26,3 @@ // See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note | ||
var valueSizeLimit = TAG_SIZE_LIMIT - key.length - 1; | ||
if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) { | ||
if (rawValue.length > valueSizeLimit || hasForbiddenCharacters(rawValue)) { | ||
display.warn("".concat(key, " value doesn't meet tag requirements and will be sanitized. ").concat(MORE_DETAILS, " ").concat(DOCS_ORIGIN, "/getting_started/tagging/#defining-tags")); | ||
@@ -36,2 +35,23 @@ } | ||
} | ||
function hasForbiddenCharacters(rawValue) { | ||
// Unicode property escapes is not supported in all browsers, so we use a try/catch. | ||
// Todo: Remove the try/catch when dropping IE11. | ||
if (!supportUnicodePropertyEscapes()) { | ||
return false; | ||
} | ||
// We use the Unicode property escapes to match any character that is a letter including other languages like Chinese, Japanese, etc. | ||
// p{Ll} matches a lowercase letter. | ||
// p{Lo} matches a letter that is neither uppercase nor lowercase (ex: Japanese characters). | ||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape#unicode_property_escapes_vs._character_classes | ||
return new RegExp('[^\\p{Ll}\\p{Lo}0-9_:./-]', 'u').test(rawValue); | ||
} | ||
export function supportUnicodePropertyEscapes() { | ||
try { | ||
new RegExp('[\\p{Ll}]', 'u'); | ||
return true; | ||
} | ||
catch (_a) { | ||
return false; | ||
} | ||
} | ||
//# sourceMappingURL=tags.js.map |
export declare const enum CustomerDataType { | ||
FeatureFlag = 0, | ||
User = 1, | ||
GlobalContext = 2 | ||
GlobalContext = 2, | ||
View = 3 | ||
} |
@@ -61,3 +61,3 @@ import { ConsoleApiName } from '../../tools/display'; | ||
service: telemetryService, | ||
version: "5.25.0", | ||
version: "5.26.0", | ||
source: 'browser', | ||
@@ -64,0 +64,0 @@ _dd: { |
@@ -16,3 +16,4 @@ /** | ||
NULL_INP_TELEMETRY = "null_inp_telemetry", | ||
LONG_ANIMATION_FRAME = "long_animation_frame" | ||
LONG_ANIMATION_FRAME = "long_animation_frame", | ||
VIEW_SPECIFIC_CONTEXT = "view_specific_context" | ||
} | ||
@@ -19,0 +20,0 @@ export declare function initFeatureFlags(enableExperimentalFeatures?: string[] | undefined): void; |
@@ -22,2 +22,3 @@ /** | ||
ExperimentalFeature["LONG_ANIMATION_FRAME"] = "long_animation_frame"; | ||
ExperimentalFeature["VIEW_SPECIFIC_CONTEXT"] = "view_specific_context"; | ||
})(ExperimentalFeature || (ExperimentalFeature = {})); | ||
@@ -24,0 +25,0 @@ var enabledExperimentalFeatures = new Set(); |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "5.25.0", | ||
"version": "5.26.0", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "58708747ce8a3e06267f0ec8667306135efe027f" | ||
"gitHead": "7f4d1bbfd246f1ffc628f388642bf22a4ab77ef3" | ||
} |
@@ -26,4 +26,2 @@ import { DOCS_ORIGIN, MORE_DETAILS, display } from '../../tools/display' | ||
const FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/ | ||
export function buildTag(key: string, rawValue: string) { | ||
@@ -35,3 +33,3 @@ // See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note | ||
if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) { | ||
if (rawValue.length > valueSizeLimit || hasForbiddenCharacters(rawValue)) { | ||
display.warn( | ||
@@ -48,1 +46,24 @@ `${key} value doesn't meet tag requirements and will be sanitized. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/tagging/#defining-tags` | ||
} | ||
function hasForbiddenCharacters(rawValue: string) { | ||
// Unicode property escapes is not supported in all browsers, so we use a try/catch. | ||
// Todo: Remove the try/catch when dropping IE11. | ||
if (!supportUnicodePropertyEscapes()) { | ||
return false | ||
} | ||
// We use the Unicode property escapes to match any character that is a letter including other languages like Chinese, Japanese, etc. | ||
// p{Ll} matches a lowercase letter. | ||
// p{Lo} matches a letter that is neither uppercase nor lowercase (ex: Japanese characters). | ||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape#unicode_property_escapes_vs._character_classes | ||
return new RegExp('[^\\p{Ll}\\p{Lo}0-9_:./-]', 'u').test(rawValue) | ||
} | ||
export function supportUnicodePropertyEscapes() { | ||
try { | ||
new RegExp('[\\p{Ll}]', 'u') | ||
return true | ||
} catch { | ||
return false | ||
} | ||
} |
@@ -5,2 +5,3 @@ export const enum CustomerDataType { | ||
GlobalContext, | ||
View, | ||
} |
@@ -23,2 +23,3 @@ /** | ||
LONG_ANIMATION_FRAME = 'long_animation_frame', | ||
VIEW_SPECIFIC_CONTEXT = 'view_specific_context', | ||
} | ||
@@ -25,0 +26,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
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
1125073
20233