@splitsoftware/splitio-commons 1.17.1-rc.4 → 1.17.1-rc.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/CHANGES.txt +28 -29
- package/LICENSE +1 -1
- package/README.md +4 -3
- package/cjs/consent/sdkUserConsent.js +4 -2
- package/cjs/evaluator/matchers/index.js +1 -3
- package/cjs/evaluator/matchers/matcherTypes.js +0 -1
- package/cjs/evaluator/matchers/segment.js +0 -6
- package/cjs/evaluator/matchersTransform/index.js +1 -4
- package/cjs/evaluator/matchersTransform/segment.js +1 -3
- package/cjs/logger/constants.js +2 -2
- package/cjs/logger/messages/info.js +1 -1
- package/cjs/logger/messages/warn.js +1 -1
- package/cjs/readiness/readinessManager.js +8 -18
- package/cjs/readiness/sdkReadinessManager.js +6 -5
- package/cjs/sdkClient/sdkClient.js +5 -5
- package/cjs/sdkClient/sdkClientMethod.js +1 -3
- package/cjs/sdkClient/sdkClientMethodCS.js +15 -9
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +15 -9
- package/cjs/sdkFactory/index.js +10 -32
- package/cjs/services/decorateHeaders.js +6 -1
- package/cjs/services/splitApi.js +5 -5
- package/cjs/services/splitHttpClient.js +5 -2
- package/cjs/storages/AbstractSegmentsCacheSync.js +33 -0
- package/cjs/storages/AbstractSplitsCacheSync.js +1 -2
- package/cjs/storages/KeyBuilderCS.js +5 -23
- package/cjs/storages/dataLoader.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +56 -33
- package/cjs/storages/inLocalStorage/index.js +2 -6
- package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -6
- package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +44 -13
- package/cjs/storages/inMemory/SegmentsCacheInMemory.js +28 -14
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +9 -8
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/cjs/storages/inRedis/SegmentsCacheInRedis.js +21 -15
- package/cjs/storages/inRedis/index.js +11 -5
- package/cjs/storages/pluggable/SegmentsCachePluggable.js +34 -13
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/sync/offline/syncManagerOffline.js +11 -18
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
- package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/cjs/sync/polling/pollingManagerCS.js +1 -1
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +21 -15
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +28 -12
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/cjs/sync/streaming/AuthClient/index.js +1 -1
- package/cjs/sync/streaming/SSEHandler/index.js +5 -3
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +48 -107
- package/cjs/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
- package/cjs/sync/streaming/constants.js +3 -3
- package/cjs/sync/streaming/parseUtils.js +9 -14
- package/cjs/sync/streaming/pushManager.js +67 -69
- package/cjs/sync/syncManagerOnline.js +21 -20
- package/cjs/sync/syncTask.js +2 -2
- package/cjs/trackers/eventTracker.js +10 -12
- package/cjs/trackers/impressionsTracker.js +14 -16
- package/cjs/trackers/uniqueKeysTracker.js +3 -5
- package/cjs/utils/constants/index.js +4 -5
- package/cjs/utils/settingsValidation/index.js +1 -2
- package/esm/consent/sdkUserConsent.js +4 -2
- package/esm/evaluator/matchers/index.js +1 -3
- package/esm/evaluator/matchers/matcherTypes.js +0 -1
- package/esm/evaluator/matchers/segment.js +0 -6
- package/esm/evaluator/matchersTransform/index.js +1 -4
- package/esm/evaluator/matchersTransform/segment.js +1 -3
- package/esm/logger/constants.js +1 -1
- package/esm/logger/messages/info.js +1 -1
- package/esm/logger/messages/warn.js +1 -1
- package/esm/readiness/readinessManager.js +8 -18
- package/esm/readiness/sdkReadinessManager.js +6 -5
- package/esm/sdkClient/sdkClient.js +5 -5
- package/esm/sdkClient/sdkClientMethod.js +1 -3
- package/esm/sdkClient/sdkClientMethodCS.js +13 -7
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +13 -7
- package/esm/sdkFactory/index.js +10 -32
- package/esm/services/decorateHeaders.js +4 -0
- package/esm/services/splitApi.js +6 -6
- package/esm/services/splitHttpClient.js +6 -3
- package/esm/storages/AbstractSegmentsCacheSync.js +30 -0
- package/esm/storages/AbstractSplitsCacheSync.js +2 -3
- package/esm/storages/KeyBuilderCS.js +4 -21
- package/esm/storages/dataLoader.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +56 -33
- package/esm/storages/inLocalStorage/index.js +3 -7
- package/esm/storages/inMemory/InMemoryStorageCS.js +1 -6
- package/esm/storages/inMemory/MySegmentsCacheInMemory.js +44 -13
- package/esm/storages/inMemory/SegmentsCacheInMemory.js +28 -14
- package/esm/storages/inMemory/SplitsCacheInMemory.js +9 -8
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/esm/storages/inRedis/SegmentsCacheInRedis.js +21 -15
- package/esm/storages/inRedis/index.js +11 -5
- package/esm/storages/pluggable/SegmentsCachePluggable.js +34 -13
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/sync/offline/syncManagerOffline.js +11 -18
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +8 -5
- package/esm/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
- package/esm/sync/polling/pollingManagerCS.js +1 -1
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +21 -15
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +28 -12
- package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
- package/esm/sync/streaming/AuthClient/index.js +1 -1
- package/esm/sync/streaming/SSEHandler/index.js +6 -4
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +49 -108
- package/esm/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.js +3 -3
- package/esm/sync/streaming/constants.js +2 -2
- package/esm/sync/streaming/parseUtils.js +8 -12
- package/esm/sync/streaming/pushManager.js +70 -72
- package/esm/sync/syncManagerOnline.js +21 -20
- package/esm/sync/syncTask.js +2 -2
- package/esm/trackers/eventTracker.js +10 -12
- package/esm/trackers/impressionsTracker.js +14 -16
- package/esm/trackers/uniqueKeysTracker.js +3 -5
- package/esm/utils/constants/index.js +2 -3
- package/esm/utils/settingsValidation/index.js +1 -2
- package/package.json +1 -1
- package/src/consent/sdkUserConsent.ts +3 -2
- package/src/dtos/types.ts +7 -21
- package/src/evaluator/matchers/index.ts +0 -2
- package/src/evaluator/matchers/matcherTypes.ts +0 -1
- package/src/evaluator/matchers/segment.ts +0 -7
- package/src/evaluator/matchersTransform/index.ts +1 -4
- package/src/evaluator/matchersTransform/segment.ts +3 -5
- package/src/logger/constants.ts +1 -1
- package/src/logger/messages/info.ts +1 -1
- package/src/logger/messages/warn.ts +1 -1
- package/src/readiness/readinessManager.ts +8 -19
- package/src/readiness/sdkReadinessManager.ts +7 -7
- package/src/readiness/types.ts +2 -5
- package/src/sdkClient/sdkClient.ts +5 -5
- package/src/sdkClient/sdkClientMethod.ts +1 -4
- package/src/sdkClient/sdkClientMethodCS.ts +15 -7
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +15 -7
- package/src/sdkFactory/index.ts +12 -35
- package/src/sdkFactory/types.ts +1 -4
- package/src/services/decorateHeaders.ts +5 -0
- package/src/services/splitApi.ts +7 -7
- package/src/services/splitHttpClient.ts +7 -4
- package/src/services/types.ts +2 -2
- package/src/storages/AbstractSegmentsCacheSync.ts +68 -0
- package/src/storages/AbstractSplitsCacheSync.ts +3 -4
- package/src/storages/KeyBuilderCS.ts +5 -34
- package/src/storages/dataLoader.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +63 -33
- package/src/storages/inLocalStorage/index.ts +4 -8
- package/src/storages/inMemory/InMemoryStorageCS.ts +1 -6
- package/src/storages/inMemory/MySegmentsCacheInMemory.ts +47 -13
- package/src/storages/inMemory/SegmentsCacheInMemory.ts +27 -13
- package/src/storages/inMemory/SplitsCacheInMemory.ts +9 -7
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +11 -7
- package/src/storages/inRedis/SegmentsCacheInRedis.ts +24 -15
- package/src/storages/inRedis/index.ts +12 -6
- package/src/storages/pluggable/SegmentsCachePluggable.ts +37 -13
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/types.ts +17 -15
- package/src/sync/offline/syncManagerOffline.ts +13 -21
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +10 -8
- package/src/sync/polling/fetchers/segmentChangesFetcher.ts +1 -1
- package/src/sync/polling/fetchers/types.ts +2 -3
- package/src/sync/polling/pollingManagerCS.ts +4 -4
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +5 -4
- package/src/sync/polling/types.ts +6 -7
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +22 -19
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +29 -13
- package/src/sync/polling/updaters/splitChangesUpdater.ts +1 -1
- package/src/sync/streaming/AuthClient/index.ts +1 -1
- package/src/sync/streaming/SSEClient/index.ts +6 -4
- package/src/sync/streaming/SSEHandler/index.ts +8 -5
- package/src/sync/streaming/SSEHandler/types.ts +15 -15
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +49 -116
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +4 -4
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/types.ts +2 -2
- package/src/sync/streaming/constants.ts +2 -2
- package/src/sync/streaming/parseUtils.ts +11 -19
- package/src/sync/streaming/pushManager.ts +72 -73
- package/src/sync/streaming/types.ts +10 -10
- package/src/sync/submitters/types.ts +5 -8
- package/src/sync/syncManagerOnline.ts +17 -17
- package/src/sync/syncTask.ts +2 -2
- package/src/sync/types.ts +1 -1
- package/src/trackers/eventTracker.ts +8 -11
- package/src/trackers/impressionsTracker.ts +10 -13
- package/src/trackers/types.ts +0 -1
- package/src/trackers/uniqueKeysTracker.ts +4 -6
- package/src/types.ts +1 -7
- package/src/utils/constants/index.ts +2 -3
- package/src/utils/settingsValidation/index.ts +2 -3
- package/src/utils/settingsValidation/types.ts +1 -1
- package/types/dtos/types.d.ts +7 -18
- package/types/evaluator/matchersTransform/segment.d.ts +2 -2
- package/types/logger/constants.d.ts +1 -1
- package/types/readiness/readinessManager.d.ts +2 -2
- package/types/readiness/sdkReadinessManager.d.ts +3 -2
- package/types/readiness/types.d.ts +2 -5
- package/types/sdkClient/sdkClientMethod.d.ts +1 -1
- package/types/sdkFactory/types.d.ts +1 -3
- package/types/services/decorateHeaders.d.ts +1 -0
- package/types/services/splitApi.d.ts +1 -1
- package/types/services/splitHttpClient.d.ts +1 -1
- package/types/services/types.d.ts +2 -2
- package/types/storages/AbstractSegmentsCacheSync.d.ts +11 -9
- package/types/storages/AbstractSplitsCacheSync.d.ts +1 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -9
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +18 -8
- package/types/storages/inMemory/MySegmentsCacheInMemory.d.ts +13 -7
- package/types/storages/inMemory/SegmentsCacheInMemory.d.ts +8 -6
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -1
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -4
- package/types/storages/inRedis/SegmentsCacheInRedis.d.ts +4 -7
- package/types/storages/inRedis/index.d.ts +1 -1
- package/types/storages/pluggable/SegmentsCachePluggable.d.ts +17 -5
- package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
- package/types/storages/types.d.ts +15 -11
- package/types/sync/polling/fetchers/mySegmentsFetcher.d.ts +2 -2
- package/types/sync/polling/fetchers/types.d.ts +2 -2
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +2 -2
- package/types/sync/polling/types.d.ts +4 -7
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +3 -4
- package/types/sync/streaming/SSEHandler/types.d.ts +14 -16
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -4
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -2
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -3
- package/types/sync/streaming/UpdateWorkers/types.d.ts +2 -2
- package/types/sync/streaming/constants.d.ts +2 -2
- package/types/sync/streaming/parseUtils.d.ts +5 -4
- package/types/sync/streaming/types.d.ts +8 -8
- package/types/sync/submitters/types.d.ts +4 -7
- package/types/sync/types.d.ts +1 -1
- package/types/trackers/eventTracker.d.ts +1 -1
- package/types/trackers/impressionsTracker.d.ts +1 -1
- package/types/trackers/types.d.ts +0 -1
- package/types/types.d.ts +1 -7
- package/types/utils/constants/index.d.ts +2 -3
- package/types/utils/settingsValidation/types.d.ts +1 -1
- package/cjs/evaluator/matchers/large_segment.js +0 -16
- package/cjs/sdkClient/identity.js +0 -7
- package/cjs/storages/AbstractMySegmentsCacheSync.js +0 -60
- package/esm/evaluator/matchers/large_segment.js +0 -12
- package/esm/sdkClient/identity.js +0 -3
- package/esm/storages/AbstractMySegmentsCacheSync.js +0 -57
- package/src/evaluator/matchers/large_segment.ts +0 -18
- package/src/sdkClient/identity.ts +0 -5
- package/src/storages/AbstractMySegmentsCacheSync.ts +0 -94
- package/types/evaluator/matchers/large_segment.d.ts +0 -5
- package/types/evaluator/matchers/sember_inlist.d.ts +0 -3
- package/types/evaluator/matchersTransform/set.d.ts +0 -5
- package/types/evaluator/matchersTransform/string.d.ts +0 -7
- package/types/sdkClient/identity.d.ts +0 -2
- package/types/storages/AbstractMySegmentsCacheSync.d.ts +0 -39
- package/types/storages/AbstractSplitsCache.d.ts +0 -46
- package/types/sync/streaming/mySegmentsV2utils.d.ts +0 -27
- package/types/sync/streaming/pushManagerCS_Spec1_3.d.ts +0 -9
- package/types/sync/streaming/pushManager_Spec1_3.d.ts +0 -9
- package/types/trackers/impressionObserver/utils.d.ts +0 -5
- package/types/utils/inputValidation/sdkKey.d.ts +0 -7
- package/types/utils/inputValidation/splitExistance.d.ts +0 -7
- package/types/utils/inputValidation/trafficTypeExistance.d.ts +0 -9
- package/types/utils/redis/RedisMock.d.ts +0 -4
- package/types/utils/settingsValidation/logger/globalLogLevel.d.ts +0 -8
- /package/types/utils/{semVer.d.ts → Semver.d.ts} +0 -0
|
@@ -8,10 +8,10 @@ import { authenticateFactory, hashUserKey } from './AuthClient';
|
|
|
8
8
|
import { forOwn } from '../../utils/lang';
|
|
9
9
|
import { SSEClient } from './SSEClient';
|
|
10
10
|
import { getMatching } from '../../utils/key';
|
|
11
|
-
import {
|
|
12
|
-
import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT,
|
|
11
|
+
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, PUSH_NONRETRYABLE_ERROR, PUSH_SUBSYSTEM_DOWN, SECONDS_BEFORE_EXPIRATION, SEGMENT_UPDATE, SPLIT_KILL, SPLIT_UPDATE, PUSH_RETRYABLE_ERROR, PUSH_SUBSYSTEM_UP, ControlType } from './constants';
|
|
12
|
+
import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT, STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, STREAMING_PARSING_SPLIT_UPDATE } from '../../logger/constants';
|
|
13
13
|
import { UpdateStrategy } from './SSEHandler/types';
|
|
14
|
-
import {
|
|
14
|
+
import { isInBitmap, parseBitmap, parseFFUpdatePayload, parseKeyList } from './parseUtils';
|
|
15
15
|
import { _Set } from '../../utils/lang/sets';
|
|
16
16
|
import { hash64 } from '../../utils/murmur3/murmur3_64';
|
|
17
17
|
import { TOKEN_REFRESH, AUTH_REJECTION } from '../../utils/constants';
|
|
@@ -45,10 +45,10 @@ export function pushManagerFactory(params, pollingManager) {
|
|
|
45
45
|
var segmentsUpdateWorker = userKey ? undefined : SegmentsUpdateWorker(log, pollingManager.segmentsSyncTask, storage.segments);
|
|
46
46
|
// For server-side we pass the segmentsSyncTask, used by SplitsUpdateWorker to fetch new segments
|
|
47
47
|
var splitsUpdateWorker = SplitsUpdateWorker(log, storage.splits, pollingManager.splitsSyncTask, readiness.splits, telemetryTracker, userKey ? undefined : pollingManager.segmentsSyncTask);
|
|
48
|
-
// [Only for client-side] map of hashes to user keys, to dispatch
|
|
48
|
+
// [Only for client-side] map of hashes to user keys, to dispatch MY_SEGMENTS_UPDATE events to the corresponding MySegmentsUpdateWorker
|
|
49
49
|
var userKeyHashes = {};
|
|
50
50
|
// [Only for client-side] map of user keys to their corresponding hash64 and MySegmentsUpdateWorkers.
|
|
51
|
-
// Hash64 is used to process
|
|
51
|
+
// Hash64 is used to process MY_SEGMENTS_UPDATE_V2 events and dispatch actions to the corresponding MySegmentsUpdateWorker.
|
|
52
52
|
var clients = {};
|
|
53
53
|
// [Only for client-side] variable to flag that a new client was added. It is needed to reconnect streaming.
|
|
54
54
|
var connectForNewClient = false;
|
|
@@ -195,76 +195,77 @@ export function pushManagerFactory(params, pollingManager) {
|
|
|
195
195
|
}
|
|
196
196
|
splitsUpdateWorker.put(parsedData);
|
|
197
197
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
log.warn(STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['BoundedFetchRequest', e]);
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
forOwn(clients, function (_a, matchingKey) {
|
|
210
|
-
var hash64 = _a.hash64, worker = _a.worker;
|
|
211
|
-
if (isInBitmap(bitmap_1, hash64.hex)) {
|
|
212
|
-
worker.put(parsedData, undefined, getDelay(parsedData, matchingKey));
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
return;
|
|
198
|
+
if (userKey) {
|
|
199
|
+
pushEmitter.on(MY_SEGMENTS_UPDATE, function handleMySegmentsUpdate(parsedData, channel) {
|
|
200
|
+
var userKeyHash = channel.split('_')[2];
|
|
201
|
+
var userKey = userKeyHashes[userKeyHash];
|
|
202
|
+
if (userKey && clients[userKey]) { // check existence since it can be undefined if client has been destroyed
|
|
203
|
+
clients[userKey].worker.put(parsedData.changeNumber, parsedData.includesPayload ? parsedData.segmentList ? parsedData.segmentList : [] : undefined);
|
|
216
204
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
205
|
+
});
|
|
206
|
+
pushEmitter.on(MY_SEGMENTS_UPDATE_V2, function handleMySegmentsUpdate(parsedData) {
|
|
207
|
+
switch (parsedData.u) {
|
|
208
|
+
case UpdateStrategy.BoundedFetchRequest: {
|
|
209
|
+
var bitmap_1;
|
|
210
|
+
try {
|
|
211
|
+
bitmap_1 = parseBitmap(parsedData.d, parsedData.c);
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
log.warn(STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, ['BoundedFetchRequest', e]);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
forOwn(clients, function (_a) {
|
|
218
|
+
var hash64 = _a.hash64, worker = _a.worker;
|
|
219
|
+
if (isInBitmap(bitmap_1, hash64.hex)) {
|
|
220
|
+
worker.put(parsedData.changeNumber); // fetch mySegments
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
231
224
|
}
|
|
232
|
-
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
removed: add ? [] : [parsedData.n[0]]
|
|
239
|
-
});
|
|
225
|
+
case UpdateStrategy.KeyList: {
|
|
226
|
+
var keyList = void 0, added_1, removed_1;
|
|
227
|
+
try {
|
|
228
|
+
keyList = parseKeyList(parsedData.d, parsedData.c);
|
|
229
|
+
added_1 = new _Set(keyList.a);
|
|
230
|
+
removed_1 = new _Set(keyList.r);
|
|
240
231
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
232
|
+
catch (e) {
|
|
233
|
+
log.warn(STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, ['KeyList', e]);
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
forOwn(clients, function (_a) {
|
|
237
|
+
var hash64 = _a.hash64, worker = _a.worker;
|
|
238
|
+
var add = added_1.has(hash64.dec) ? true : removed_1.has(hash64.dec) ? false : undefined;
|
|
239
|
+
if (add !== undefined) {
|
|
240
|
+
worker.put(parsedData.changeNumber, {
|
|
241
|
+
name: parsedData.segmentName,
|
|
242
|
+
add: add
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return;
|
|
248
247
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
case UpdateStrategy.SegmentRemoval:
|
|
249
|
+
if (!parsedData.segmentName) {
|
|
250
|
+
log.warn(STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, ['SegmentRemoval', 'No segment name was provided']);
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
forOwn(clients, function (_a) {
|
|
254
|
+
var worker = _a.worker;
|
|
255
|
+
return worker.put(parsedData.changeNumber, {
|
|
256
|
+
name: parsedData.segmentName,
|
|
257
|
+
add: false
|
|
258
|
+
});
|
|
254
259
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// `UpdateStrategy.UnboundedFetchRequest` and fallbacks of other cases
|
|
263
|
+
forOwn(clients, function (_a) {
|
|
264
|
+
var worker = _a.worker;
|
|
265
|
+
worker.put(parsedData.changeNumber);
|
|
266
|
+
});
|
|
262
267
|
});
|
|
263
268
|
}
|
|
264
|
-
if (userKey) {
|
|
265
|
-
pushEmitter.on(MEMBERSHIPS_MS_UPDATE, handleMySegmentsUpdate);
|
|
266
|
-
pushEmitter.on(MEMBERSHIPS_LS_UPDATE, handleMySegmentsUpdate);
|
|
267
|
-
}
|
|
268
269
|
else {
|
|
269
270
|
pushEmitter.on(SEGMENT_UPDATE, segmentsUpdateWorker.put);
|
|
270
271
|
}
|
|
@@ -299,10 +300,7 @@ export function pushManagerFactory(params, pollingManager) {
|
|
|
299
300
|
var hash = hashUserKey(userKey);
|
|
300
301
|
if (!userKeyHashes[hash]) {
|
|
301
302
|
userKeyHashes[hash] = userKey;
|
|
302
|
-
clients[userKey] = {
|
|
303
|
-
hash64: hash64(userKey),
|
|
304
|
-
worker: MySegmentsUpdateWorker(log, storage, mySegmentsSyncTask, telemetryTracker)
|
|
305
|
-
};
|
|
303
|
+
clients[userKey] = { hash64: hash64(userKey), worker: MySegmentsUpdateWorker(mySegmentsSyncTask, telemetryTracker) };
|
|
306
304
|
connectForNewClient = true; // we must reconnect on start, to listen the channel for the new user key
|
|
307
305
|
// Reconnects in case of a new client.
|
|
308
306
|
// Run in next event-loop cycle to save authentication calls
|
|
@@ -115,32 +115,33 @@ export function syncManagerOnlineFactory(pollingManagerFactory, pushManagerFacto
|
|
|
115
115
|
if (!pollingManager)
|
|
116
116
|
return;
|
|
117
117
|
var mySegmentsSyncTask = pollingManager.add(matchingKey, readinessManager, storage);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
118
|
+
return {
|
|
119
|
+
isRunning: mySegmentsSyncTask.isRunning,
|
|
120
|
+
start: function () {
|
|
121
|
+
if (syncEnabled) {
|
|
122
|
+
if (pushManager) {
|
|
123
|
+
if (pollingManager.isRunning()) {
|
|
124
|
+
// if doing polling, we must start the periodic fetch of data
|
|
125
|
+
if (storage.splits.usesSegments())
|
|
126
|
+
mySegmentsSyncTask.start();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// if not polling, we must execute the sync task for the initial fetch
|
|
130
|
+
// of segments since `syncAll` was already executed when starting the main client
|
|
131
|
+
mySegmentsSyncTask.execute();
|
|
132
|
+
}
|
|
133
|
+
pushManager.add(matchingKey, mySegmentsSyncTask);
|
|
125
134
|
}
|
|
126
135
|
else {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
mySegmentsSyncTask.execute();
|
|
136
|
+
if (storage.splits.usesSegments())
|
|
137
|
+
mySegmentsSyncTask.start();
|
|
130
138
|
}
|
|
131
|
-
pushManager.add(matchingKey, mySegmentsSyncTask);
|
|
132
139
|
}
|
|
133
140
|
else {
|
|
134
|
-
if (
|
|
135
|
-
mySegmentsSyncTask.
|
|
141
|
+
if (!readinessManager.isReady())
|
|
142
|
+
mySegmentsSyncTask.execute();
|
|
136
143
|
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
if (!readinessManager.isReady())
|
|
140
|
-
mySegmentsSyncTask.execute();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
+
},
|
|
144
145
|
stop: function () {
|
|
145
146
|
// check in case `client.destroy()` has been invoked more than once for the same client
|
|
146
147
|
var mySegmentsSyncTask = pollingManager.get(matchingKey);
|
package/esm/sync/syncTask.js
CHANGED
|
@@ -66,8 +66,8 @@ export function syncTaskFactory(log, task, period, taskName) {
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
stop: function () {
|
|
69
|
-
running
|
|
70
|
-
|
|
69
|
+
if (running) {
|
|
70
|
+
running = false;
|
|
71
71
|
log.debug(SYNC_TASK_STOP, [taskName]);
|
|
72
72
|
clearTimeout(timeoutID);
|
|
73
73
|
timeoutID = undefined;
|
|
@@ -9,7 +9,7 @@ import { isConsumerMode } from '../utils/settingsValidation/mode';
|
|
|
9
9
|
* @param eventsCache cache to save events
|
|
10
10
|
* @param integrationsManager optional event handler used for integrations
|
|
11
11
|
*/
|
|
12
|
-
export function eventTrackerFactory(settings, eventsCache,
|
|
12
|
+
export function eventTrackerFactory(settings, eventsCache, integrationsManager, telemetryCache) {
|
|
13
13
|
var log = settings.log, mode = settings.mode;
|
|
14
14
|
var isAsync = isConsumerMode(mode);
|
|
15
15
|
function queueEventsCallback(eventData, tracked) {
|
|
@@ -19,17 +19,15 @@ export function eventTrackerFactory(settings, eventsCache, whenInit, integration
|
|
|
19
19
|
if (tracked) {
|
|
20
20
|
log.info(EVENTS_TRACKER_SUCCESS, [msg]);
|
|
21
21
|
if (integrationsManager) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
});
|
|
22
|
+
// Wrap in a timeout because we don't want it to be blocking.
|
|
23
|
+
setTimeout(function () {
|
|
24
|
+
// copy of event, to avoid unexpected behaviour if modified by integrations
|
|
25
|
+
var eventDataCopy = objectAssign({}, eventData);
|
|
26
|
+
if (properties)
|
|
27
|
+
eventDataCopy.properties = objectAssign({}, properties);
|
|
28
|
+
// integrationsManager does not throw errors (they are internally handled by each integration module)
|
|
29
|
+
integrationsManager.handleEvent(eventDataCopy);
|
|
30
|
+
}, 0);
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
else {
|
|
@@ -11,7 +11,7 @@ import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
|
|
|
11
11
|
* @param integrationsManager optional integrations manager
|
|
12
12
|
* @param strategy strategy for impressions tracking.
|
|
13
13
|
*/
|
|
14
|
-
export function impressionsTrackerFactory(settings, impressionsCache, strategy,
|
|
14
|
+
export function impressionsTrackerFactory(settings, impressionsCache, strategy, integrationsManager, telemetryCache) {
|
|
15
15
|
var log = settings.log, impressionListener = settings.impressionListener, _a = settings.runtime, ip = _a.ip, hostname = _a.hostname, version = settings.version;
|
|
16
16
|
return {
|
|
17
17
|
track: function (impressions, attributes) {
|
|
@@ -50,21 +50,19 @@ export function impressionsTrackerFactory(settings, impressionsCache, strategy,
|
|
|
50
50
|
hostname: hostname,
|
|
51
51
|
sdkLanguageVersion: version
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
});
|
|
53
|
+
// Wrap in a timeout because we don't want it to be blocking.
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
// integrationsManager.handleImpression does not throw errors
|
|
56
|
+
if (integrationsManager)
|
|
57
|
+
integrationsManager.handleImpression(impressionData);
|
|
58
|
+
try { // @ts-ignore. An exception on the listeners should not break the SDK.
|
|
59
|
+
if (impressionListener)
|
|
60
|
+
impressionListener.logImpression(impressionData);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
log.error(ERROR_IMPRESSIONS_LISTENER, [err]);
|
|
64
|
+
}
|
|
65
|
+
}, 0);
|
|
68
66
|
};
|
|
69
67
|
for (var i = 0; i < impressionsToListenerCount; i++) {
|
|
70
68
|
_loop_1(i);
|
|
@@ -16,6 +16,9 @@ var noopFilterAdapter = {
|
|
|
16
16
|
export function uniqueKeysTrackerFactory(log, uniqueKeysCache, filterAdapter) {
|
|
17
17
|
if (filterAdapter === void 0) { filterAdapter = noopFilterAdapter; }
|
|
18
18
|
var intervalId;
|
|
19
|
+
if (filterAdapter.refreshRate) {
|
|
20
|
+
intervalId = setInterval(filterAdapter.clear, filterAdapter.refreshRate);
|
|
21
|
+
}
|
|
19
22
|
return {
|
|
20
23
|
track: function (key, featureName) {
|
|
21
24
|
if (!filterAdapter.add(key, featureName)) {
|
|
@@ -24,11 +27,6 @@ export function uniqueKeysTrackerFactory(log, uniqueKeysCache, filterAdapter) {
|
|
|
24
27
|
}
|
|
25
28
|
uniqueKeysCache.track(key, featureName);
|
|
26
29
|
},
|
|
27
|
-
start: function () {
|
|
28
|
-
if (filterAdapter.refreshRate) {
|
|
29
|
-
intervalId = setInterval(filterAdapter.clear, filterAdapter.refreshRate);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
30
|
stop: function () {
|
|
33
31
|
clearInterval(intervalId);
|
|
34
32
|
}
|
|
@@ -60,7 +60,7 @@ export var EVENTS = 'ev';
|
|
|
60
60
|
export var TELEMETRY = 'te';
|
|
61
61
|
export var TOKEN = 'to';
|
|
62
62
|
export var SEGMENT = 'se';
|
|
63
|
-
export var
|
|
63
|
+
export var MY_SEGMENT = 'ms';
|
|
64
64
|
export var TREATMENT = 't';
|
|
65
65
|
export var TREATMENTS = 'ts';
|
|
66
66
|
export var TREATMENT_WITH_CONFIG = 'tc';
|
|
@@ -86,7 +86,6 @@ export var NON_REQUESTED = 1;
|
|
|
86
86
|
export var DISABLED = 0;
|
|
87
87
|
export var ENABLED = 1;
|
|
88
88
|
export var PAUSED = 2;
|
|
89
|
-
export var FLAG_SPEC_VERSION = '1.
|
|
89
|
+
export var FLAG_SPEC_VERSION = '1.1';
|
|
90
90
|
// Matcher types
|
|
91
91
|
export var IN_SEGMENT = 'IN_SEGMENT';
|
|
92
|
-
export var IN_LARGE_SEGMENT = 'IN_LARGE_SEGMENT';
|
|
@@ -183,10 +183,9 @@ export function settingsValidation(config, validationParams) {
|
|
|
183
183
|
var splitFiltersValidation = validateSplitFilters(log, sync.splitFilters, withDefaults.mode);
|
|
184
184
|
sync.splitFilters = splitFiltersValidation.validFilters;
|
|
185
185
|
sync.__splitFiltersValidation = splitFiltersValidation;
|
|
186
|
-
// ensure a valid flag spec version
|
|
187
186
|
sync.flagSpecVersion = flagSpec ? flagSpec(withDefaults) : FLAG_SPEC_VERSION;
|
|
188
187
|
// ensure a valid user consent value
|
|
189
188
|
// @ts-ignore, modify readonly prop
|
|
190
|
-
withDefaults.userConsent = consent
|
|
189
|
+
withDefaults.userConsent = consent(withDefaults);
|
|
191
190
|
return withDefaults;
|
|
192
191
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ const ConsentStatus = {
|
|
|
15
15
|
* The public user consent API exposed via SplitFactory, used to control if the SDK tracks and sends impressions and events or not.
|
|
16
16
|
*/
|
|
17
17
|
export function createUserConsentAPI(params: ISdkFactoryContext) {
|
|
18
|
-
const { settings, settings: { log }, syncManager, storage: { events, impressions, impressionCounts } } = params;
|
|
18
|
+
const { settings, settings: { log }, syncManager, storage: { events, impressions, impressionCounts, uniqueKeys } } = params;
|
|
19
19
|
|
|
20
20
|
if (!isConsentGranted(settings)) log.info(USER_CONSENT_INITIAL, [settings.userConsent]);
|
|
21
21
|
|
|
@@ -41,7 +41,8 @@ export function createUserConsentAPI(params: ISdkFactoryContext) {
|
|
|
41
41
|
// @ts-ignore, clear method is present in storage for standalone and partial consumer mode
|
|
42
42
|
if (events.clear) events.clear(); // @ts-ignore
|
|
43
43
|
if (impressions.clear) impressions.clear(); // @ts-ignore
|
|
44
|
-
if (impressionCounts && impressionCounts.clear) impressionCounts.clear();
|
|
44
|
+
if (impressionCounts && impressionCounts.clear) impressionCounts.clear(); // @ts-ignore
|
|
45
|
+
if (uniqueKeys && uniqueKeys.clear) uniqueKeys.clear();
|
|
45
46
|
}
|
|
46
47
|
} else {
|
|
47
48
|
log.info(USER_CONSENT_NOT_UPDATED, [newConsentStatus]);
|
package/src/dtos/types.ts
CHANGED
|
@@ -30,10 +30,6 @@ export interface IInSegmentMatcherData {
|
|
|
30
30
|
segmentName: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export interface IInLargeSegmentMatcherData {
|
|
34
|
-
largeSegmentName: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
33
|
export interface IDependencyMatcherData {
|
|
38
34
|
split: string,
|
|
39
35
|
treatments: string[]
|
|
@@ -47,7 +43,6 @@ interface ISplitMatcherBase {
|
|
|
47
43
|
attribute: string | null
|
|
48
44
|
}
|
|
49
45
|
userDefinedSegmentMatcherData?: null | IInSegmentMatcherData
|
|
50
|
-
userDefinedLargeSegmentMatcherData?: null | IInLargeSegmentMatcherData
|
|
51
46
|
whitelistMatcherData?: null | IWhitelistMatcherData
|
|
52
47
|
unaryNumericMatcherData?: null | IUnaryNumericMatcherData
|
|
53
48
|
betweenMatcherData?: null | IBetweenMatcherData
|
|
@@ -66,11 +61,6 @@ interface IInSegmentMatcher extends ISplitMatcherBase {
|
|
|
66
61
|
userDefinedSegmentMatcherData: IInSegmentMatcherData
|
|
67
62
|
}
|
|
68
63
|
|
|
69
|
-
interface IInLargeSegmentMatcher extends ISplitMatcherBase {
|
|
70
|
-
matcherType: 'IN_LARGE_SEGMENT',
|
|
71
|
-
userDefinedLargeSegmentMatcherData: IInLargeSegmentMatcherData
|
|
72
|
-
}
|
|
73
|
-
|
|
74
64
|
interface IWhitelistMatcher extends ISplitMatcherBase {
|
|
75
65
|
matcherType: 'WHITELIST',
|
|
76
66
|
whitelistMatcherData: IWhitelistMatcherData
|
|
@@ -175,8 +165,7 @@ interface IInListSemverMatcher extends ISplitMatcherBase {
|
|
|
175
165
|
export type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher |
|
|
176
166
|
ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher |
|
|
177
167
|
IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher |
|
|
178
|
-
IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher
|
|
179
|
-
IInLargeSegmentMatcher
|
|
168
|
+
IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher
|
|
180
169
|
|
|
181
170
|
/** Split object */
|
|
182
171
|
export interface ISplitPartition {
|
|
@@ -229,17 +218,14 @@ export interface ISegmentChangesResponse {
|
|
|
229
218
|
till: number
|
|
230
219
|
}
|
|
231
220
|
|
|
232
|
-
export interface
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
n: string
|
|
236
|
-
}[]
|
|
221
|
+
export interface IMySegmentsResponseItem {
|
|
222
|
+
id: string,
|
|
223
|
+
name: string
|
|
237
224
|
}
|
|
238
225
|
|
|
239
|
-
/** Interface of the parsed JSON response of `/
|
|
240
|
-
export interface
|
|
241
|
-
|
|
242
|
-
ls?: IMySegmentsResponse
|
|
226
|
+
/** Interface of the parsed JSON response of `/mySegments/{userKey}` */
|
|
227
|
+
export interface IMySegmentsResponse {
|
|
228
|
+
mySegments: IMySegmentsResponseItem[]
|
|
243
229
|
}
|
|
244
230
|
|
|
245
231
|
/** Metadata internal type for storages */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { allMatcherContext } from './all';
|
|
2
2
|
import { segmentMatcherContext } from './segment';
|
|
3
|
-
import { largeSegmentMatcherContext } from './large_segment';
|
|
4
3
|
import { whitelistMatcherContext } from './whitelist';
|
|
5
4
|
import { equalToMatcherContext } from './eq';
|
|
6
5
|
import { greaterThanEqualMatcherContext } from './gte';
|
|
@@ -49,7 +48,6 @@ const matchers = [
|
|
|
49
48
|
lessThanEqualToSemverMatcherContext, // LESS_THAN_OR_EQUAL_TO_SEMVER: 20
|
|
50
49
|
betweenSemverMatcherContext, // BETWEEN_SEMVER: 21
|
|
51
50
|
inListSemverMatcherContext, // IN_LIST_SEMVER: 22
|
|
52
|
-
largeSegmentMatcherContext, // IN_LARGE_SEGMENT: 23
|
|
53
51
|
];
|
|
54
52
|
|
|
55
53
|
/**
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { MaybeThenable } from '../../dtos/types';
|
|
2
2
|
import { ISegmentsCacheBase } from '../../storages/types';
|
|
3
|
-
import { thenable } from '../../utils/promise/thenable';
|
|
4
3
|
|
|
5
4
|
export function segmentMatcherContext(segmentName: string, storage: { segments: ISegmentsCacheBase }) {
|
|
6
5
|
|
|
7
6
|
return function segmentMatcher(key: string): MaybeThenable<boolean> {
|
|
8
7
|
const isInSegment = storage.segments.isInSegment(segmentName, key);
|
|
9
8
|
|
|
10
|
-
if (thenable(isInSegment)) {
|
|
11
|
-
isInSegment.then(result => {
|
|
12
|
-
return result;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
9
|
return isInSegment;
|
|
17
10
|
};
|
|
18
11
|
}
|
|
@@ -4,7 +4,7 @@ import { segmentTransform } from './segment';
|
|
|
4
4
|
import { whitelistTransform } from './whitelist';
|
|
5
5
|
import { numericTransform } from './unaryNumeric';
|
|
6
6
|
import { zeroSinceHH, zeroSinceSS } from '../convertions';
|
|
7
|
-
import { IBetweenMatcherData,
|
|
7
|
+
import { IBetweenMatcherData, IInSegmentMatcherData, ISplitMatcher, IUnaryNumericMatcherData } from '../../dtos/types';
|
|
8
8
|
import { IMatcherDto } from '../types';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -18,7 +18,6 @@ export function matchersTransform(matchers: ISplitMatcher[]): IMatcherDto[] {
|
|
|
18
18
|
negate,
|
|
19
19
|
keySelector,
|
|
20
20
|
userDefinedSegmentMatcherData,
|
|
21
|
-
userDefinedLargeSegmentMatcherData,
|
|
22
21
|
whitelistMatcherData, /* whitelistObject, provided by 'WHITELIST', 'IN_LIST_SEMVER', set and string matchers */
|
|
23
22
|
unaryNumericMatcherData,
|
|
24
23
|
betweenMatcherData,
|
|
@@ -36,8 +35,6 @@ export function matchersTransform(matchers: ISplitMatcher[]): IMatcherDto[] {
|
|
|
36
35
|
|
|
37
36
|
if (type === matcherTypes.IN_SEGMENT) {
|
|
38
37
|
value = segmentTransform(userDefinedSegmentMatcherData as IInSegmentMatcherData);
|
|
39
|
-
} else if (type === matcherTypes.IN_LARGE_SEGMENT) {
|
|
40
|
-
value = segmentTransform(userDefinedLargeSegmentMatcherData as IInLargeSegmentMatcherData);
|
|
41
38
|
} else if (type === matcherTypes.EQUAL_TO) {
|
|
42
39
|
value = numericTransform(unaryNumericMatcherData as IUnaryNumericMatcherData);
|
|
43
40
|
dataType = matcherDataTypes.NUMBER;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { IInSegmentMatcherData
|
|
1
|
+
import { IInSegmentMatcherData } from '../../dtos/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Extract segment name as a plain string.
|
|
5
5
|
*/
|
|
6
|
-
export function segmentTransform(segment?: IInSegmentMatcherData
|
|
7
|
-
return segment ?
|
|
8
|
-
(segment as IInSegmentMatcherData).segmentName || (segment as IInLargeSegmentMatcherData).largeSegmentName :
|
|
9
|
-
undefined;
|
|
6
|
+
export function segmentTransform(segment?: IInSegmentMatcherData) {
|
|
7
|
+
return segment ? segment.segmentName : undefined;
|
|
10
8
|
}
|
package/src/logger/constants.ts
CHANGED
|
@@ -79,7 +79,7 @@ export const WARN_SPLITS_FILTER_IGNORED = 219;
|
|
|
79
79
|
export const WARN_SPLITS_FILTER_INVALID = 220;
|
|
80
80
|
export const WARN_SPLITS_FILTER_EMPTY = 221;
|
|
81
81
|
export const WARN_SDK_KEY = 222;
|
|
82
|
-
export const
|
|
82
|
+
export const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;
|
|
83
83
|
export const STREAMING_PARSING_SPLIT_UPDATE = 224;
|
|
84
84
|
export const WARN_INVALID_FLAGSET = 225;
|
|
85
85
|
export const WARN_LOWERCASE_FLAGSET = 226;
|
|
@@ -23,7 +23,7 @@ export const codesInfo: [number, string][] = codesWarn.concat([
|
|
|
23
23
|
[c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
|
|
24
24
|
[c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
|
|
25
25
|
[c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of feature flags #%s. Reason: %s'],
|
|
26
|
-
[c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and
|
|
26
|
+
[c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and reseting timer.'],
|
|
27
27
|
[c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
|
|
28
28
|
[c.STREAMING_REFRESH_TOKEN, c.LOG_PREFIX_SYNC_STREAMING + 'Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.'],
|
|
29
29
|
[c.STREAMING_RECONNECT, c.LOG_PREFIX_SYNC_STREAMING + 'Attempting to reconnect streaming in %s seconds.'],
|
|
@@ -32,7 +32,7 @@ export const codesWarn: [number, string][] = codesError.concat([
|
|
|
32
32
|
[c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
|
|
33
33
|
[c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
|
|
34
34
|
|
|
35
|
-
[c.
|
|
35
|
+
[c.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching MySegments due to an error processing %s notification: %s'],
|
|
36
36
|
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
|
|
37
37
|
[c.WARN_INVALID_FLAGSET, '%s: you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter or number, be in lowercase, alphanumeric and have a max length of 50 characters. %s was discarded.'],
|
|
38
38
|
[c.WARN_LOWERCASE_FLAGSET, '%s: flag set %s should be all lowercase - converting string to lowercase.'],
|