@launchdarkly/js-sdk-common
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -5,2 +5,10 @@ # Changelog | ||
## [2.3.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.2.0...js-sdk-common-v2.3.0) (2024-03-15) | ||
### Features | ||
* Always inline contexts for feature events ([#351](https://github.com/launchdarkly/js-core/issues/351)) ([961d21b](https://github.com/launchdarkly/js-core/commit/961d21bf1fef79f30c267cf30d0bccb4ad3feff6)) | ||
* Redact anonymous attributes within feature events ([#352](https://github.com/launchdarkly/js-core/issues/352)) ([8f7ad7e](https://github.com/launchdarkly/js-core/commit/8f7ad7e7ab0032491d11565a0943a5560c98052f)) | ||
## [2.2.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.1.1...js-sdk-common-v2.2.0) (2024-02-06) | ||
@@ -7,0 +15,0 @@ |
@@ -7,3 +7,3 @@ import AttributeReference from './AttributeReference'; | ||
constructor(allAttributesPrivate: boolean, privateAttributes: AttributeReference[]); | ||
filter(context: Context): any; | ||
filter(context: Context, redactAnonymousAttributes?: boolean): any; | ||
private getAttributesToFilter; | ||
@@ -10,0 +10,0 @@ private filterSingleKind; |
@@ -80,6 +80,6 @@ "use strict"; | ||
} | ||
filter(context) { | ||
filter(context, redactAnonymousAttributes = false) { | ||
const contexts = context.getContexts(); | ||
if (contexts.length === 1) { | ||
return this.filterSingleKind(context, contexts[0][1], contexts[0][0]); | ||
return this.filterSingleKind(context, contexts[0][1], contexts[0][0], redactAnonymousAttributes); | ||
} | ||
@@ -90,13 +90,14 @@ const filteredMulti = { | ||
contexts.forEach(([kind, single]) => { | ||
filteredMulti[kind] = this.filterSingleKind(context, single, kind); | ||
filteredMulti[kind] = this.filterSingleKind(context, single, kind, redactAnonymousAttributes); | ||
}); | ||
return filteredMulti; | ||
} | ||
getAttributesToFilter(context, single, kind) { | ||
return (this.allAttributesPrivate | ||
getAttributesToFilter(context, single, kind, redactAllAttributes) { | ||
return (redactAllAttributes | ||
? Object.keys(single).map((k) => new AttributeReference_1.default(k, true)) | ||
: [...this.privateAttributes, ...context.privateAttributes(kind)]).filter((attr) => !protectedAttributes.some((protectedAttr) => protectedAttr.compare(attr))); | ||
} | ||
filterSingleKind(context, single, kind) { | ||
const { cloned, excluded } = cloneWithRedactions(single, this.getAttributesToFilter(context, single, kind)); | ||
filterSingleKind(context, single, kind, redactAnonymousAttributes) { | ||
const redactAllAttributes = this.allAttributesPrivate || (redactAnonymousAttributes && single.anonymous === true); | ||
const { cloned, excluded } = cloneWithRedactions(single, this.getAttributesToFilter(context, single, kind, redactAllAttributes)); | ||
if (context.legacy) { | ||
@@ -103,0 +104,0 @@ legacyTopLevelCopyAttributes.forEach((name) => { |
@@ -148,2 +148,3 @@ "use strict"; | ||
creationDate: event.creationDate, | ||
context: this.contextFilter.filter(event.context, !debug), | ||
key: event.key, | ||
@@ -168,8 +169,2 @@ value: event.value, | ||
} | ||
if (debug) { | ||
out.context = this.contextFilter.filter(event.context); | ||
} | ||
else { | ||
out.contextKeys = event.context.kindsAndKeys; | ||
} | ||
return out; | ||
@@ -176,0 +171,0 @@ } |
{ | ||
"name": "@launchdarkly/js-sdk-common", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
305618
4534