@instana/core
Advanced tools
Comparing version 1.106.0 to 1.106.1
{ | ||
"name": "@instana/core", | ||
"version": "1.106.0", | ||
"version": "1.106.1", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -136,3 +136,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "d780ba095bd7d11df8b2e1afc05b305f958aad72" | ||
"gitHead": "b1a1c2f0a7a9c1e0d9fcf52359128c1f561e9d24" | ||
} |
'use strict'; | ||
module.exports = exports = function applyCompressionRoot(prev, next, blacklist) { | ||
const result = applyCompression([], prev, next, blacklist); | ||
module.exports = exports = function applyCompressionRoot(prev, next, excludeList) { | ||
const result = applyCompression([], prev, next, excludeList); | ||
@@ -13,10 +13,10 @@ // the root object needs to be at least an empty object. | ||
function applyCompression(path, prev, next, blacklist) { | ||
if (isBlacklisted(path, blacklist)) { | ||
function applyCompression(path, prev, next, excludeList) { | ||
if (isExcluded(path, excludeList)) { | ||
return next; | ||
} | ||
if (blacklist == null && prev === next) { | ||
if (excludeList == null && prev === next) { | ||
// Shortcut: If it is the same object, remove it completely. We can only take this shortcut safely, if there is no | ||
// blacklist, otherwise we might accidentally remove attributes that would be blacklisted for compression. | ||
// excludeList, otherwise we might accidentally remove attributes that would be excluded for compression. | ||
return undefined; | ||
@@ -33,3 +33,3 @@ } | ||
} else if (nType === 'object') { | ||
return applyCompressionToObject(path, prev, next, blacklist); | ||
return applyCompressionToObject(path, prev, next, excludeList); | ||
} else if (prev !== next) { | ||
@@ -42,3 +42,3 @@ return next; | ||
function applyCompressionToObject(path, prev, next, blacklist) { | ||
function applyCompressionToObject(path, prev, next, excludeList) { | ||
const result = {}; | ||
@@ -54,3 +54,3 @@ let addedProps = 0; | ||
const compressed = applyCompression(path.concat(nKey), pValue, nValue, blacklist); | ||
const compressed = applyCompression(path.concat(nKey), pValue, nValue, excludeList); | ||
if (compressed !== undefined) { | ||
@@ -87,20 +87,20 @@ result[nKey] = compressed; | ||
function isBlacklisted(path, blacklist) { | ||
if (blacklist == null) { | ||
function isExcluded(path, excludeList) { | ||
if (excludeList == null) { | ||
return false; | ||
} | ||
// Compare the given path to all blacklist entries. | ||
// Compare the given path to all excludeList entries. | ||
// eslint-disable-next-line no-restricted-syntax | ||
outer: for (let i = 0; i < blacklist.length; i++) { | ||
if (blacklist[i].length !== path.length) { | ||
// The blacklist entry and then given path have different lengths, this cannot be a match. Continue with next | ||
// blacklist entry. | ||
outer: for (let i = 0; i < excludeList.length; i++) { | ||
if (excludeList[i].length !== path.length) { | ||
// The excludeList entry and then given path have different lengths, this cannot be a match. Continue with next | ||
// excludeList entry. | ||
// eslint-disable-next-line no-continue | ||
continue; | ||
} | ||
for (let j = 0; j < blacklist[i].length; j++) { | ||
if (blacklist[i][j] !== path[j]) { | ||
// We found a path segment that is differnt for this blacklist entry and then given path, this cannot be a | ||
// match. Continue with next blacklist entry. | ||
for (let j = 0; j < excludeList[i].length; j++) { | ||
if (excludeList[i][j] !== path[j]) { | ||
// We found a path segment that is differnt for this excludeList entry and then given path, this cannot be a | ||
// match. Continue with next excludeList entry. | ||
// eslint-disable-next-line no-continue | ||
@@ -110,4 +110,4 @@ continue outer; | ||
} | ||
// This blacklist entry and the given path have the same number of segments and all segments are identical, so this | ||
// is a match, that is, this path has been blacklisted for compression. | ||
// This excludeList entry and the given path have the same number of segments and all segments are identical, so | ||
// this is a match, that is, this path has been excludeListed for compression. | ||
return true; | ||
@@ -114,0 +114,0 @@ } |
@@ -173,3 +173,3 @@ /* eslint-disable */ | ||
let fromEnvVar = {}; | ||
let fromEnvVar; | ||
if (process.env.INSTANA_EXTRA_HTTP_HEADERS) { | ||
@@ -176,0 +176,0 @@ fromEnvVar = parseHeadersEnvVar(process.env.INSTANA_EXTRA_HTTP_HEADERS); |
378488