launchdarkly-js-sdk-common 5.5.0-beta.4 → 5.5.0-beta.5
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/package.json +1 -1
- package/src/EventProcessor.js +13 -2
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);
|