launchdarkly-js-sdk-common 5.5.0-beta.4 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/EventProcessor.js +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the `launchdarkly-js-sdk-common` package will be documented in this file. Changes that affect the dependent SDKs such as `launchdarkly-js-client-sdk` should also be logged in those projects, in the next release that uses the updated version of this package. This project adheres to [Semantic Versioning](http://semver.org).
|
|
4
4
|
|
|
5
|
+
## [5.5.0](https://github.com/launchdarkly/js-sdk-common/compare/5.4.0...5.5.0) (2025-04-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Add hook support. ([#116](https://github.com/launchdarkly/js-sdk-common/issues/116)) ([85c227c](https://github.com/launchdarkly/js-sdk-common/commit/85c227ca9b82a3c783b0dd449f7557a3806268bb))
|
|
11
|
+
* Inline context in custom events. ([#118](https://github.com/launchdarkly/js-sdk-common/issues/118)) ([450f8f7](https://github.com/launchdarkly/js-sdk-common/commit/450f8f75f450de1382b35fe7b77d3b97060a19f8))
|
|
12
|
+
|
|
5
13
|
## [5.4.0](https://github.com/launchdarkly/js-sdk-common/compare/5.3.0...5.4.0) (2024-10-18)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
package/src/EventProcessor.js
CHANGED
|
@@ -4,6 +4,7 @@ const ContextFilter = require('./ContextFilter');
|
|
|
4
4
|
const errors = require('./errors');
|
|
5
5
|
const messages = require('./messages');
|
|
6
6
|
const utils = require('./utils');
|
|
7
|
+
const { getContextKeys } = require('./context');
|
|
7
8
|
|
|
8
9
|
function EventProcessor(
|
|
9
10
|
platform,
|
|
@@ -47,8 +48,14 @@ function EventProcessor(
|
|
|
47
48
|
function makeOutputEvent(e) {
|
|
48
49
|
const ret = utils.extend({}, e);
|
|
49
50
|
|
|
50
|
-
//
|
|
51
|
-
|
|
51
|
+
// Identify, feature, and custom events should all include the full context.
|
|
52
|
+
// Debug events do as well, but are not handled by this code path.
|
|
53
|
+
if (e.kind === 'identify' || e.kind === 'feature' || e.kind === 'custom') {
|
|
54
|
+
ret.context = contextFilter.filter(e.context);
|
|
55
|
+
} else {
|
|
56
|
+
ret.contextKeys = getContextKeysFromEvent(e);
|
|
57
|
+
delete ret['context'];
|
|
58
|
+
}
|
|
52
59
|
|
|
53
60
|
if (e.kind === 'feature') {
|
|
54
61
|
delete ret['trackEvents'];
|
|
@@ -57,6 +64,10 @@ function EventProcessor(
|
|
|
57
64
|
return ret;
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
function getContextKeysFromEvent(event) {
|
|
68
|
+
return getContextKeys(event.context, logger);
|
|
69
|
+
}
|
|
70
|
+
|
|
60
71
|
function addToOutbox(event) {
|
|
61
72
|
if (queue.length < eventCapacity) {
|
|
62
73
|
queue.push(event);
|