@splitsoftware/splitio-commons 2.1.1-rc.0 → 2.1.1-rc.2
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 +7 -0
- package/README.md +0 -1
- package/cjs/evaluator/combiners/and.js +6 -2
- package/cjs/evaluator/combiners/ifelseif.js +6 -6
- package/cjs/evaluator/condition/index.js +5 -6
- package/cjs/evaluator/index.js +7 -7
- package/cjs/evaluator/matchers/index.js +1 -3
- package/cjs/evaluator/matchers/matcherTypes.js +0 -1
- package/cjs/evaluator/matchersTransform/index.js +0 -4
- package/cjs/evaluator/parser/index.js +2 -2
- package/cjs/evaluator/value/sanitize.js +0 -1
- package/cjs/logger/constants.js +3 -4
- package/cjs/logger/messages/debug.js +2 -3
- package/cjs/logger/messages/error.js +1 -1
- package/cjs/logger/messages/warn.js +2 -2
- package/cjs/readiness/readinessManager.js +6 -0
- package/cjs/sdkClient/client.js +29 -19
- package/cjs/sdkClient/clientAttributesDecoration.js +19 -25
- package/cjs/sdkClient/clientInputValidation.js +28 -26
- package/cjs/services/splitApi.js +2 -2
- package/cjs/storages/AbstractSplitsCacheAsync.js +0 -7
- package/cjs/storages/AbstractSplitsCacheSync.js +2 -12
- package/cjs/storages/KeyBuilder.js +0 -9
- package/cjs/storages/KeyBuilderCS.js +4 -4
- package/cjs/storages/KeyBuilderSS.js +0 -3
- package/cjs/storages/dataLoader.js +3 -2
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +23 -76
- package/cjs/storages/inLocalStorage/index.js +5 -7
- package/cjs/storages/inLocalStorage/validateCache.js +79 -0
- package/cjs/storages/inMemory/InMemoryStorage.js +0 -3
- package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -4
- package/cjs/storages/inRedis/index.js +0 -2
- package/cjs/storages/pluggable/index.js +2 -3
- package/cjs/storages/utils.js +1 -0
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +3 -2
- package/cjs/sync/polling/fetchers/splitChangesFetcher.js +2 -2
- package/cjs/sync/polling/pollingManagerCS.js +7 -7
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +33 -60
- package/cjs/sync/streaming/SSEHandler/index.js +0 -1
- package/cjs/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +77 -106
- package/cjs/sync/streaming/constants.js +1 -2
- package/cjs/sync/streaming/pushManager.js +16 -3
- package/cjs/sync/submitters/impressionsSubmitter.js +3 -2
- package/cjs/sync/syncManagerOnline.js +10 -5
- package/cjs/trackers/strategy/strategyDebug.js +2 -0
- package/cjs/trackers/strategy/strategyOptimized.js +3 -0
- package/cjs/utils/constants/index.js +2 -3
- package/cjs/utils/inputValidation/eventProperties.js +12 -1
- package/cjs/utils/inputValidation/index.js +3 -1
- package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
- package/esm/evaluator/combiners/and.js +6 -2
- package/esm/evaluator/combiners/ifelseif.js +7 -7
- package/esm/evaluator/condition/index.js +5 -6
- package/esm/evaluator/index.js +7 -7
- package/esm/evaluator/matchers/index.js +1 -3
- package/esm/evaluator/matchers/matcherTypes.js +0 -1
- package/esm/evaluator/matchersTransform/index.js +0 -4
- package/esm/evaluator/parser/index.js +2 -2
- package/esm/evaluator/value/sanitize.js +0 -1
- package/esm/logger/constants.js +0 -1
- package/esm/logger/messages/debug.js +2 -3
- package/esm/logger/messages/error.js +1 -1
- package/esm/logger/messages/warn.js +2 -2
- package/esm/readiness/readinessManager.js +6 -0
- package/esm/sdkClient/client.js +29 -19
- package/esm/sdkClient/clientAttributesDecoration.js +19 -25
- package/esm/sdkClient/clientInputValidation.js +29 -27
- package/esm/services/splitApi.js +2 -2
- package/esm/storages/AbstractSplitsCacheAsync.js +0 -7
- package/esm/storages/AbstractSplitsCacheSync.js +2 -12
- package/esm/storages/KeyBuilder.js +0 -9
- package/esm/storages/KeyBuilderCS.js +4 -4
- package/esm/storages/KeyBuilderSS.js +0 -3
- package/esm/storages/dataLoader.js +2 -1
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +23 -76
- package/esm/storages/inLocalStorage/index.js +5 -7
- package/esm/storages/inLocalStorage/validateCache.js +75 -0
- package/esm/storages/inMemory/InMemoryStorage.js +0 -3
- package/esm/storages/inMemory/InMemoryStorageCS.js +0 -4
- package/esm/storages/inRedis/index.js +0 -2
- package/esm/storages/pluggable/index.js +2 -3
- package/esm/storages/utils.js +1 -0
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +3 -2
- package/esm/sync/polling/fetchers/splitChangesFetcher.js +2 -2
- package/esm/sync/polling/pollingManagerCS.js +7 -7
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -2
- package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
- package/esm/sync/polling/updaters/splitChangesUpdater.js +34 -61
- package/esm/sync/streaming/SSEHandler/index.js +1 -2
- package/esm/sync/streaming/UpdateWorkers/SplitsUpdateWorker.js +73 -102
- package/esm/sync/streaming/constants.js +0 -1
- package/esm/sync/streaming/pushManager.js +19 -6
- package/esm/sync/submitters/impressionsSubmitter.js +3 -2
- package/esm/sync/syncManagerOnline.js +10 -5
- package/esm/trackers/strategy/strategyDebug.js +2 -0
- package/esm/trackers/strategy/strategyOptimized.js +3 -0
- package/esm/utils/constants/index.js +1 -2
- package/esm/utils/inputValidation/eventProperties.js +10 -0
- package/esm/utils/inputValidation/index.js +1 -0
- package/esm/utils/settingsValidation/storage/storageCS.js +1 -1
- package/package.json +1 -1
- package/src/dtos/types.ts +8 -32
- package/src/evaluator/Engine.ts +1 -1
- package/src/evaluator/combiners/and.ts +4 -5
- package/src/evaluator/combiners/ifelseif.ts +9 -7
- package/src/evaluator/condition/engineUtils.ts +1 -1
- package/src/evaluator/condition/index.ts +12 -12
- package/src/evaluator/index.ts +7 -7
- package/src/evaluator/matchers/index.ts +1 -3
- package/src/evaluator/matchers/matcherTypes.ts +0 -1
- package/src/evaluator/matchersTransform/index.ts +0 -3
- package/src/evaluator/parser/index.ts +3 -3
- package/src/evaluator/types.ts +2 -2
- package/src/evaluator/value/index.ts +2 -2
- package/src/evaluator/value/sanitize.ts +4 -5
- package/src/logger/constants.ts +0 -1
- package/src/logger/messages/debug.ts +2 -3
- package/src/logger/messages/error.ts +1 -1
- package/src/logger/messages/warn.ts +2 -2
- package/src/readiness/readinessManager.ts +5 -0
- package/src/sdkClient/client.ts +31 -21
- package/src/sdkClient/clientAttributesDecoration.ts +20 -27
- package/src/sdkClient/clientInputValidation.ts +30 -27
- package/src/sdkManager/index.ts +1 -1
- package/src/services/splitApi.ts +2 -2
- package/src/services/types.ts +1 -1
- package/src/storages/AbstractSplitsCacheAsync.ts +0 -8
- package/src/storages/AbstractSplitsCacheSync.ts +3 -14
- package/src/storages/KeyBuilder.ts +0 -12
- package/src/storages/KeyBuilderCS.ts +5 -5
- package/src/storages/KeyBuilderSS.ts +0 -4
- package/src/storages/dataLoader.ts +3 -1
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +26 -87
- package/src/storages/inLocalStorage/index.ts +8 -12
- package/src/storages/inLocalStorage/validateCache.ts +91 -0
- package/src/storages/inMemory/InMemoryStorage.ts +0 -3
- package/src/storages/inMemory/InMemoryStorageCS.ts +0 -4
- package/src/storages/inRedis/index.ts +0 -2
- package/src/storages/pluggable/index.ts +2 -3
- package/src/storages/types.ts +2 -37
- package/src/storages/utils.ts +1 -0
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +6 -5
- package/src/sync/polling/fetchers/splitChangesFetcher.ts +1 -2
- package/src/sync/polling/fetchers/types.ts +0 -1
- package/src/sync/polling/pollingManagerCS.ts +7 -7
- package/src/sync/polling/types.ts +2 -2
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -2
- package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
- package/src/sync/polling/updaters/splitChangesUpdater.ts +43 -71
- package/src/sync/streaming/SSEHandler/index.ts +1 -2
- package/src/sync/streaming/SSEHandler/types.ts +2 -2
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +68 -98
- package/src/sync/streaming/constants.ts +0 -1
- package/src/sync/streaming/parseUtils.ts +2 -2
- package/src/sync/streaming/pushManager.ts +18 -6
- package/src/sync/streaming/types.ts +2 -3
- package/src/sync/submitters/impressionsSubmitter.ts +3 -2
- package/src/sync/submitters/types.ts +23 -33
- package/src/sync/syncManagerOnline.ts +11 -5
- package/src/trackers/strategy/strategyDebug.ts +2 -0
- package/src/trackers/strategy/strategyOptimized.ts +3 -0
- package/src/utils/constants/index.ts +1 -2
- package/src/utils/inputValidation/eventProperties.ts +10 -0
- package/src/utils/inputValidation/index.ts +1 -0
- package/src/utils/lang/index.ts +2 -2
- package/src/utils/settingsValidation/storage/storageCS.ts +1 -1
- package/types/splitio.d.ts +128 -36
- package/cjs/evaluator/matchers/rbsegment.js +0 -43
- package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -117
- package/cjs/storages/inMemory/RBSegmentsCacheInMemory.js +0 -61
- package/cjs/storages/inRedis/RBSegmentsCacheInRedis.js +0 -64
- package/cjs/storages/pluggable/RBSegmentsCachePluggable.js +0 -64
- package/cjs/utils/constants/browser.js +0 -5
- package/esm/evaluator/matchers/rbsegment.js +0 -39
- package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +0 -114
- package/esm/storages/inMemory/RBSegmentsCacheInMemory.js +0 -58
- package/esm/storages/inRedis/RBSegmentsCacheInRedis.js +0 -61
- package/esm/storages/pluggable/RBSegmentsCachePluggable.js +0 -61
- package/esm/utils/constants/browser.js +0 -2
- package/src/evaluator/matchers/rbsegment.ts +0 -61
- package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +0 -136
- package/src/storages/inMemory/RBSegmentsCacheInMemory.ts +0 -68
- package/src/storages/inRedis/RBSegmentsCacheInRedis.ts +0 -79
- package/src/storages/pluggable/RBSegmentsCachePluggable.ts +0 -76
- package/src/utils/constants/browser.ts +0 -2
|
@@ -24,15 +24,6 @@ var KeyBuilder = /** @class */ (function () {
|
|
|
24
24
|
KeyBuilder.prototype.buildSplitKeyPrefix = function () {
|
|
25
25
|
return this.prefix + ".split.";
|
|
26
26
|
};
|
|
27
|
-
KeyBuilder.prototype.buildRBSegmentKey = function (rbsegmentName) {
|
|
28
|
-
return this.prefix + ".rbsegment." + rbsegmentName;
|
|
29
|
-
};
|
|
30
|
-
KeyBuilder.prototype.buildRBSegmentsTillKey = function () {
|
|
31
|
-
return this.prefix + ".rbsegments.till";
|
|
32
|
-
};
|
|
33
|
-
KeyBuilder.prototype.buildRBSegmentKeyPrefix = function () {
|
|
34
|
-
return this.prefix + ".rbsegment.";
|
|
35
|
-
};
|
|
36
27
|
KeyBuilder.prototype.buildSegmentNameKey = function (segmentName) {
|
|
37
28
|
return this.prefix + ".segment." + segmentName;
|
|
38
29
|
};
|
|
@@ -6,7 +6,7 @@ var KeyBuilderCS = /** @class */ (function (_super) {
|
|
|
6
6
|
function KeyBuilderCS(prefix, matchingKey) {
|
|
7
7
|
var _this = _super.call(this, prefix) || this;
|
|
8
8
|
_this.matchingKey = matchingKey;
|
|
9
|
-
_this.regexSplitsCacheKey = new RegExp("^" + prefix + "\\.(splits?|trafficType|flagSet
|
|
9
|
+
_this.regexSplitsCacheKey = new RegExp("^" + prefix + "\\.(splits?|trafficType|flagSet)\\.");
|
|
10
10
|
return _this;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -32,12 +32,12 @@ var KeyBuilderCS = /** @class */ (function (_super) {
|
|
|
32
32
|
KeyBuilderCS.prototype.isSplitKey = function (key) {
|
|
33
33
|
return startsWith(key, this.prefix + ".split.");
|
|
34
34
|
};
|
|
35
|
-
KeyBuilderCS.prototype.isRBSegmentKey = function (key) {
|
|
36
|
-
return startsWith(key, this.prefix + ".rbsegment.");
|
|
37
|
-
};
|
|
38
35
|
KeyBuilderCS.prototype.buildSplitsWithSegmentCountKey = function () {
|
|
39
36
|
return this.prefix + ".splits.usingSegments";
|
|
40
37
|
};
|
|
38
|
+
KeyBuilderCS.prototype.buildLastClear = function () {
|
|
39
|
+
return this.prefix + ".lastClear";
|
|
40
|
+
};
|
|
41
41
|
return KeyBuilderCS;
|
|
42
42
|
}(KeyBuilder));
|
|
43
43
|
export { KeyBuilderCS };
|
|
@@ -39,9 +39,6 @@ var KeyBuilderSS = /** @class */ (function (_super) {
|
|
|
39
39
|
KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
|
|
40
40
|
return this.buildSplitKeyPrefix() + "*";
|
|
41
41
|
};
|
|
42
|
-
KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
|
|
43
|
-
return this.buildRBSegmentKeyPrefix() + "*";
|
|
44
|
-
};
|
|
45
42
|
/* Telemetry keys */
|
|
46
43
|
KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
|
|
47
44
|
return this.latencyPrefix + "::" + this.versionablePrefix + "/" + METHOD_NAMES[method] + "/" + bucket;
|
|
@@ -2,21 +2,17 @@ import { __extends } from "tslib";
|
|
|
2
2
|
import { AbstractSplitsCacheSync, usesSegments } from '../AbstractSplitsCacheSync';
|
|
3
3
|
import { isFiniteNumber, toNumber, isNaNNumber } from '../../utils/lang';
|
|
4
4
|
import { LOG_PREFIX } from './constants';
|
|
5
|
-
import { getStorageHash } from '../KeyBuilder';
|
|
6
5
|
import { setToArray } from '../../utils/lang/sets';
|
|
7
6
|
/**
|
|
8
7
|
* ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
|
|
9
8
|
*/
|
|
10
9
|
var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
11
10
|
__extends(SplitsCacheInLocal, _super);
|
|
12
|
-
function SplitsCacheInLocal(settings, keys
|
|
11
|
+
function SplitsCacheInLocal(settings, keys) {
|
|
13
12
|
var _this = _super.call(this) || this;
|
|
14
13
|
_this.keys = keys;
|
|
15
14
|
_this.log = settings.log;
|
|
16
|
-
_this.storageHash = getStorageHash(settings);
|
|
17
15
|
_this.flagSetsFilter = settings.sync.__splitFiltersValidation.groupedFilters.bySet;
|
|
18
|
-
_this._checkExpiration(expirationTimestamp);
|
|
19
|
-
_this._checkFilterQuery();
|
|
20
16
|
return _this;
|
|
21
17
|
}
|
|
22
18
|
SplitsCacheInLocal.prototype._decrementCount = function (key) {
|
|
@@ -29,13 +25,11 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
29
25
|
};
|
|
30
26
|
SplitsCacheInLocal.prototype._decrementCounts = function (split) {
|
|
31
27
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this._decrementCount(segmentsCountKey);
|
|
38
|
-
}
|
|
28
|
+
var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
|
|
29
|
+
this._decrementCount(ttKey);
|
|
30
|
+
if (usesSegments(split)) {
|
|
31
|
+
var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
|
|
32
|
+
this._decrementCount(segmentsCountKey);
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
catch (e) {
|
|
@@ -44,13 +38,15 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
44
38
|
};
|
|
45
39
|
SplitsCacheInLocal.prototype._incrementCounts = function (split) {
|
|
46
40
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
|
|
50
|
-
if (usesSegments(split)) {
|
|
51
|
-
var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
|
|
41
|
+
if (split) {
|
|
42
|
+
var ttKey = this.keys.buildTrafficTypeKey(split.trafficTypeName);
|
|
52
43
|
// @ts-expect-error
|
|
53
|
-
localStorage.setItem(
|
|
44
|
+
localStorage.setItem(ttKey, toNumber(localStorage.getItem(ttKey)) + 1);
|
|
45
|
+
if (usesSegments(split)) {
|
|
46
|
+
var segmentsCountKey = this.keys.buildSplitsWithSegmentCountKey();
|
|
47
|
+
// @ts-expect-error
|
|
48
|
+
localStorage.setItem(segmentsCountKey, toNumber(localStorage.getItem(segmentsCountKey)) + 1);
|
|
49
|
+
}
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
catch (e) {
|
|
@@ -62,7 +58,6 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
62
58
|
* We cannot simply call `localStorage.clear()` since that implies removing user items from the storage.
|
|
63
59
|
*/
|
|
64
60
|
SplitsCacheInLocal.prototype.clear = function () {
|
|
65
|
-
this.log.info(LOG_PREFIX + 'Flushing Splits data from localStorage');
|
|
66
61
|
// collect item keys
|
|
67
62
|
var len = localStorage.length;
|
|
68
63
|
var accum = [];
|
|
@@ -83,11 +78,12 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
83
78
|
var splitKey = this.keys.buildSplitKey(name_1);
|
|
84
79
|
var splitFromLocalStorage = localStorage.getItem(splitKey);
|
|
85
80
|
var previousSplit = splitFromLocalStorage ? JSON.parse(splitFromLocalStorage) : null;
|
|
81
|
+
if (previousSplit) {
|
|
82
|
+
this._decrementCounts(previousSplit);
|
|
83
|
+
this.removeFromFlagSets(previousSplit.name, previousSplit.sets);
|
|
84
|
+
}
|
|
86
85
|
localStorage.setItem(splitKey, JSON.stringify(split));
|
|
87
86
|
this._incrementCounts(split);
|
|
88
|
-
this._decrementCounts(previousSplit);
|
|
89
|
-
if (previousSplit)
|
|
90
|
-
this.removeFromFlagSets(previousSplit.name, previousSplit.sets);
|
|
91
87
|
this.addToFlagSets(split);
|
|
92
88
|
return true;
|
|
93
89
|
}
|
|
@@ -103,8 +99,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
103
99
|
return false;
|
|
104
100
|
localStorage.removeItem(this.keys.buildSplitKey(name));
|
|
105
101
|
this._decrementCounts(split);
|
|
106
|
-
|
|
107
|
-
this.removeFromFlagSets(split.name, split.sets);
|
|
102
|
+
this.removeFromFlagSets(split.name, split.sets);
|
|
108
103
|
return true;
|
|
109
104
|
}
|
|
110
105
|
catch (e) {
|
|
@@ -117,18 +112,6 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
117
112
|
return item && JSON.parse(item);
|
|
118
113
|
};
|
|
119
114
|
SplitsCacheInLocal.prototype.setChangeNumber = function (changeNumber) {
|
|
120
|
-
// when using a new split query, we must update it at the store
|
|
121
|
-
if (this.updateNewFilter) {
|
|
122
|
-
this.log.info(LOG_PREFIX + 'SDK key, flags filter criteria or flags spec version was modified. Updating cache');
|
|
123
|
-
var storageHashKey = this.keys.buildHashKey();
|
|
124
|
-
try {
|
|
125
|
-
localStorage.setItem(storageHashKey, this.storageHash);
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
this.log.error(LOG_PREFIX + e);
|
|
129
|
-
}
|
|
130
|
-
this.updateNewFilter = false;
|
|
131
|
-
}
|
|
132
115
|
try {
|
|
133
116
|
localStorage.setItem(this.keys.buildSplitsTillKey(), changeNumber + '');
|
|
134
117
|
// update "last updated" timestamp with current time
|
|
@@ -172,48 +155,12 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
|
|
|
172
155
|
return true;
|
|
173
156
|
var storedCount = localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey());
|
|
174
157
|
var splitsWithSegmentsCount = storedCount === null ? 0 : toNumber(storedCount);
|
|
175
|
-
|
|
176
|
-
splitsWithSegmentsCount > 0
|
|
177
|
-
true;
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Check if the splits information is already stored in browser LocalStorage.
|
|
181
|
-
* In this function we could add more code to check if the data is valid.
|
|
182
|
-
* @override
|
|
183
|
-
*/
|
|
184
|
-
SplitsCacheInLocal.prototype.checkCache = function () {
|
|
185
|
-
return this.getChangeNumber() > -1;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
|
|
189
|
-
*
|
|
190
|
-
* @param expirationTimestamp - if the value is not a number, data will not be cleaned
|
|
191
|
-
*/
|
|
192
|
-
SplitsCacheInLocal.prototype._checkExpiration = function (expirationTimestamp) {
|
|
193
|
-
var value = localStorage.getItem(this.keys.buildLastUpdatedKey());
|
|
194
|
-
if (value !== null) {
|
|
195
|
-
value = parseInt(value, 10);
|
|
196
|
-
if (!isNaNNumber(value) && expirationTimestamp && value < expirationTimestamp)
|
|
197
|
-
this.clear();
|
|
158
|
+
if (isFiniteNumber(splitsWithSegmentsCount)) {
|
|
159
|
+
return splitsWithSegmentsCount > 0;
|
|
198
160
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
SplitsCacheInLocal.prototype._checkFilterQuery = function () {
|
|
202
|
-
var storageHashKey = this.keys.buildHashKey();
|
|
203
|
-
var storageHash = localStorage.getItem(storageHashKey);
|
|
204
|
-
if (storageHash !== this.storageHash) {
|
|
205
|
-
try {
|
|
206
|
-
// mark cache to update the new query filter on first successful splits fetch
|
|
207
|
-
this.updateNewFilter = true;
|
|
208
|
-
// if there is cache, clear it
|
|
209
|
-
if (this.checkCache())
|
|
210
|
-
this.clear();
|
|
211
|
-
}
|
|
212
|
-
catch (e) {
|
|
213
|
-
this.log.error(LOG_PREFIX + e);
|
|
214
|
-
}
|
|
161
|
+
else {
|
|
162
|
+
return true;
|
|
215
163
|
}
|
|
216
|
-
// if the filter didn't change, nothing is done
|
|
217
164
|
};
|
|
218
165
|
SplitsCacheInLocal.prototype.getNamesByFlagSets = function (flagSets) {
|
|
219
166
|
var _this = this;
|
|
@@ -6,14 +6,13 @@ import { KeyBuilderCS, myLargeSegmentsKeyBuilder } from '../KeyBuilderCS';
|
|
|
6
6
|
import { isLocalStorageAvailable } from '../../utils/env/isLocalStorageAvailable';
|
|
7
7
|
import { SplitsCacheInLocal } from './SplitsCacheInLocal';
|
|
8
8
|
import { MySegmentsCacheInLocal } from './MySegmentsCacheInLocal';
|
|
9
|
-
import { DEFAULT_CACHE_EXPIRATION_IN_MILLIS } from '../../utils/constants/browser';
|
|
10
9
|
import { InMemoryStorageCSFactory } from '../inMemory/InMemoryStorageCS';
|
|
11
10
|
import { LOG_PREFIX } from './constants';
|
|
12
11
|
import { STORAGE_LOCALSTORAGE } from '../../utils/constants';
|
|
13
12
|
import { shouldRecordTelemetry, TelemetryCacheInMemory } from '../inMemory/TelemetryCacheInMemory';
|
|
14
13
|
import { UniqueKeysCacheInMemoryCS } from '../inMemory/UniqueKeysCacheInMemoryCS';
|
|
15
14
|
import { getMatching } from '../../utils/key';
|
|
16
|
-
import {
|
|
15
|
+
import { validateCache } from './validateCache';
|
|
17
16
|
/**
|
|
18
17
|
* InLocal storage factory for standalone client-side SplitFactory
|
|
19
18
|
*/
|
|
@@ -29,14 +28,11 @@ export function InLocalStorage(options) {
|
|
|
29
28
|
var settings = params.settings, _a = params.settings, log = _a.log, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize;
|
|
30
29
|
var matchingKey = getMatching(settings.core.key);
|
|
31
30
|
var keys = new KeyBuilderCS(prefix, matchingKey);
|
|
32
|
-
var
|
|
33
|
-
var splits = new SplitsCacheInLocal(settings, keys, expirationTimestamp);
|
|
34
|
-
var rbSegments = new RBSegmentsCacheInLocal(settings, keys);
|
|
31
|
+
var splits = new SplitsCacheInLocal(settings, keys);
|
|
35
32
|
var segments = new MySegmentsCacheInLocal(log, keys);
|
|
36
33
|
var largeSegments = new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey));
|
|
37
34
|
return {
|
|
38
35
|
splits: splits,
|
|
39
|
-
rbSegments: rbSegments,
|
|
40
36
|
segments: segments,
|
|
41
37
|
largeSegments: largeSegments,
|
|
42
38
|
impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
|
|
@@ -44,12 +40,14 @@ export function InLocalStorage(options) {
|
|
|
44
40
|
events: new EventsCacheInMemory(eventsQueueSize),
|
|
45
41
|
telemetry: shouldRecordTelemetry(params) ? new TelemetryCacheInMemory(splits, segments) : undefined,
|
|
46
42
|
uniqueKeys: new UniqueKeysCacheInMemoryCS(),
|
|
43
|
+
validateCache: function () {
|
|
44
|
+
return validateCache(options, settings, keys, splits, segments, largeSegments);
|
|
45
|
+
},
|
|
47
46
|
destroy: function () { },
|
|
48
47
|
// When using shared instantiation with MEMORY we reuse everything but segments (they are customer per key).
|
|
49
48
|
shared: function (matchingKey) {
|
|
50
49
|
return {
|
|
51
50
|
splits: this.splits,
|
|
52
|
-
rbSegments: this.rbSegments,
|
|
53
51
|
segments: new MySegmentsCacheInLocal(log, new KeyBuilderCS(prefix, matchingKey)),
|
|
54
52
|
largeSegments: new MySegmentsCacheInLocal(log, myLargeSegmentsKeyBuilder(prefix, matchingKey)),
|
|
55
53
|
impressions: this.impressions,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
|
|
2
|
+
import { getStorageHash } from '../KeyBuilder';
|
|
3
|
+
import { LOG_PREFIX } from './constants';
|
|
4
|
+
var DEFAULT_CACHE_EXPIRATION_IN_DAYS = 10;
|
|
5
|
+
var MILLIS_IN_A_DAY = 86400000;
|
|
6
|
+
/**
|
|
7
|
+
* Validates if cache should be cleared and sets the cache `hash` if needed.
|
|
8
|
+
*
|
|
9
|
+
* @returns `true` if cache should be cleared, `false` otherwise
|
|
10
|
+
*/
|
|
11
|
+
function validateExpiration(options, settings, keys, currentTimestamp, isThereCache) {
|
|
12
|
+
var log = settings.log;
|
|
13
|
+
// Check expiration
|
|
14
|
+
var lastUpdatedTimestamp = parseInt(localStorage.getItem(keys.buildLastUpdatedKey()), 10);
|
|
15
|
+
if (!isNaNNumber(lastUpdatedTimestamp)) {
|
|
16
|
+
var cacheExpirationInDays = isFiniteNumber(options.expirationDays) && options.expirationDays >= 1 ? options.expirationDays : DEFAULT_CACHE_EXPIRATION_IN_DAYS;
|
|
17
|
+
var expirationTimestamp = currentTimestamp - MILLIS_IN_A_DAY * cacheExpirationInDays;
|
|
18
|
+
if (lastUpdatedTimestamp < expirationTimestamp) {
|
|
19
|
+
log.info(LOG_PREFIX + 'Cache expired more than ' + cacheExpirationInDays + ' days ago. Cleaning up cache');
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Check hash
|
|
24
|
+
var storageHashKey = keys.buildHashKey();
|
|
25
|
+
var storageHash = localStorage.getItem(storageHashKey);
|
|
26
|
+
var currentStorageHash = getStorageHash(settings);
|
|
27
|
+
if (storageHash !== currentStorageHash) {
|
|
28
|
+
try {
|
|
29
|
+
localStorage.setItem(storageHashKey, currentStorageHash);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
log.error(LOG_PREFIX + e);
|
|
33
|
+
}
|
|
34
|
+
if (isThereCache) {
|
|
35
|
+
log.info(LOG_PREFIX + 'SDK key, flags filter criteria, or flags spec version has changed. Cleaning up cache');
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return false; // No cache to clear
|
|
39
|
+
}
|
|
40
|
+
// Clear on init
|
|
41
|
+
if (options.clearOnInit) {
|
|
42
|
+
var lastClearTimestamp = parseInt(localStorage.getItem(keys.buildLastClear()), 10);
|
|
43
|
+
if (isNaNNumber(lastClearTimestamp) || lastClearTimestamp < currentTimestamp - MILLIS_IN_A_DAY) {
|
|
44
|
+
log.info(LOG_PREFIX + 'clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache');
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Clean cache if:
|
|
51
|
+
* - it has expired, i.e., its `lastUpdated` timestamp is older than the given `expirationTimestamp`
|
|
52
|
+
* - its hash has changed, i.e., the SDK key, flags filter criteria or flags spec version was modified
|
|
53
|
+
* - `clearOnInit` was set and cache was not cleared in the last 24 hours
|
|
54
|
+
*
|
|
55
|
+
* @returns `true` if cache is ready to be used, `false` otherwise (cache was cleared or there is no cache)
|
|
56
|
+
*/
|
|
57
|
+
export function validateCache(options, settings, keys, splits, segments, largeSegments) {
|
|
58
|
+
var currentTimestamp = Date.now();
|
|
59
|
+
var isThereCache = splits.getChangeNumber() > -1;
|
|
60
|
+
if (validateExpiration(options, settings, keys, currentTimestamp, isThereCache)) {
|
|
61
|
+
splits.clear();
|
|
62
|
+
segments.clear();
|
|
63
|
+
largeSegments.clear();
|
|
64
|
+
// Update last clear timestamp
|
|
65
|
+
try {
|
|
66
|
+
localStorage.setItem(keys.buildLastClear(), currentTimestamp + '');
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
settings.log.error(LOG_PREFIX + e);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
// Check if ready from cache
|
|
74
|
+
return isThereCache;
|
|
75
|
+
}
|
|
@@ -6,7 +6,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
|
|
|
6
6
|
import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
|
|
7
7
|
import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
|
|
8
8
|
import { UniqueKeysCacheInMemory } from './UniqueKeysCacheInMemory';
|
|
9
|
-
import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
|
|
10
9
|
/**
|
|
11
10
|
* InMemory storage factory for standalone server-side SplitFactory
|
|
12
11
|
*
|
|
@@ -15,11 +14,9 @@ import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
|
|
|
15
14
|
export function InMemoryStorageFactory(params) {
|
|
16
15
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, __splitFiltersValidation = _a.sync.__splitFiltersValidation;
|
|
17
16
|
var splits = new SplitsCacheInMemory(__splitFiltersValidation);
|
|
18
|
-
var rbSegments = new RBSegmentsCacheInMemory();
|
|
19
17
|
var segments = new SegmentsCacheInMemory();
|
|
20
18
|
var storage = {
|
|
21
19
|
splits: splits,
|
|
22
|
-
rbSegments: rbSegments,
|
|
23
20
|
segments: segments,
|
|
24
21
|
impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
|
|
25
22
|
impressionCounts: new ImpressionCountsCacheInMemory(),
|
|
@@ -6,7 +6,6 @@ import { ImpressionCountsCacheInMemory } from './ImpressionCountsCacheInMemory';
|
|
|
6
6
|
import { LOCALHOST_MODE, STORAGE_MEMORY } from '../../utils/constants';
|
|
7
7
|
import { shouldRecordTelemetry, TelemetryCacheInMemory } from './TelemetryCacheInMemory';
|
|
8
8
|
import { UniqueKeysCacheInMemoryCS } from './UniqueKeysCacheInMemoryCS';
|
|
9
|
-
import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
|
|
10
9
|
/**
|
|
11
10
|
* InMemory storage factory for standalone client-side SplitFactory
|
|
12
11
|
*
|
|
@@ -15,12 +14,10 @@ import { RBSegmentsCacheInMemory } from './RBSegmentsCacheInMemory';
|
|
|
15
14
|
export function InMemoryStorageCSFactory(params) {
|
|
16
15
|
var _a = params.settings, _b = _a.scheduler, impressionsQueueSize = _b.impressionsQueueSize, eventsQueueSize = _b.eventsQueueSize, __splitFiltersValidation = _a.sync.__splitFiltersValidation;
|
|
17
16
|
var splits = new SplitsCacheInMemory(__splitFiltersValidation);
|
|
18
|
-
var rbSegments = new RBSegmentsCacheInMemory();
|
|
19
17
|
var segments = new MySegmentsCacheInMemory();
|
|
20
18
|
var largeSegments = new MySegmentsCacheInMemory();
|
|
21
19
|
var storage = {
|
|
22
20
|
splits: splits,
|
|
23
|
-
rbSegments: rbSegments,
|
|
24
21
|
segments: segments,
|
|
25
22
|
largeSegments: largeSegments,
|
|
26
23
|
impressions: new ImpressionsCacheInMemory(impressionsQueueSize),
|
|
@@ -33,7 +30,6 @@ export function InMemoryStorageCSFactory(params) {
|
|
|
33
30
|
shared: function () {
|
|
34
31
|
return {
|
|
35
32
|
splits: this.splits,
|
|
36
|
-
rbSegments: this.rbSegments,
|
|
37
33
|
segments: new MySegmentsCacheInMemory(),
|
|
38
34
|
largeSegments: new MySegmentsCacheInMemory(),
|
|
39
35
|
impressions: this.impressions,
|
|
@@ -9,7 +9,6 @@ import { TelemetryCacheInRedis } from './TelemetryCacheInRedis';
|
|
|
9
9
|
import { UniqueKeysCacheInRedis } from './UniqueKeysCacheInRedis';
|
|
10
10
|
import { ImpressionCountsCacheInRedis } from './ImpressionCountsCacheInRedis';
|
|
11
11
|
import { metadataBuilder } from '../utils';
|
|
12
|
-
import { RBSegmentsCacheInRedis } from './RBSegmentsCacheInRedis';
|
|
13
12
|
/**
|
|
14
13
|
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
|
|
15
14
|
* @see {@link https://www.npmjs.com/package/ioredis}
|
|
@@ -38,7 +37,6 @@ export function InRedisStorage(options) {
|
|
|
38
37
|
});
|
|
39
38
|
return {
|
|
40
39
|
splits: new SplitsCacheInRedis(log, keys, redisClient, settings.sync.__splitFiltersValidation),
|
|
41
|
-
rbSegments: new RBSegmentsCacheInRedis(log, keys, redisClient),
|
|
42
40
|
segments: new SegmentsCacheInRedis(log, keys, redisClient),
|
|
43
41
|
impressions: new ImpressionsCacheInRedis(log, keys.buildImpressionsKey(), redisClient, metadata),
|
|
44
42
|
impressionCounts: impressionCountsCache,
|
|
@@ -19,7 +19,6 @@ import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
|
|
|
19
19
|
import { UniqueKeysCacheInMemoryCS } from '../inMemory/UniqueKeysCacheInMemoryCS';
|
|
20
20
|
import { metadataBuilder } from '../utils';
|
|
21
21
|
import { LOG_PREFIX } from '../pluggable/constants';
|
|
22
|
-
import { RBSegmentsCachePluggable } from './RBSegmentsCachePluggable';
|
|
23
22
|
var NO_VALID_WRAPPER = 'Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.';
|
|
24
23
|
var NO_VALID_WRAPPER_INTERFACE = 'The provided wrapper instance doesn’t follow the expected interface. Check our docs.';
|
|
25
24
|
/**
|
|
@@ -72,7 +71,8 @@ export function PluggableStorage(options) {
|
|
|
72
71
|
// Connects to wrapper and emits SDK_READY event on main client
|
|
73
72
|
var connectPromise = wrapper.connect().then(function () {
|
|
74
73
|
if (isSynchronizer) {
|
|
75
|
-
//
|
|
74
|
+
// @TODO reuse InLocalStorage::validateCache logic
|
|
75
|
+
// In standalone or producer mode, clear storage if SDK key, flags filter criteria or flags spec version was modified
|
|
76
76
|
return wrapper.get(keys.buildHashKey()).then(function (hash) {
|
|
77
77
|
var currentHash = getStorageHash(settings);
|
|
78
78
|
if (hash !== currentHash) {
|
|
@@ -102,7 +102,6 @@ export function PluggableStorage(options) {
|
|
|
102
102
|
});
|
|
103
103
|
return {
|
|
104
104
|
splits: new SplitsCachePluggable(log, keys, wrapper, settings.sync.__splitFiltersValidation),
|
|
105
|
-
rbSegments: new RBSegmentsCachePluggable(log, keys, wrapper),
|
|
106
105
|
segments: new SegmentsCachePluggable(log, keys, wrapper),
|
|
107
106
|
impressions: isPartialConsumer ? new ImpressionsCacheInMemory(impressionsQueueSize) : new ImpressionsCachePluggable(log, keys.buildImpressionsKey(), wrapper, metadata),
|
|
108
107
|
impressionCounts: impressionCountsCache,
|
package/esm/storages/utils.js
CHANGED
|
@@ -42,9 +42,10 @@ export function fromObjectUpdaterFactory(splitsParser, storage, readiness, setti
|
|
|
42
42
|
readiness.splits.emit(SDK_SPLITS_ARRIVED);
|
|
43
43
|
if (startingUp) {
|
|
44
44
|
startingUp = false;
|
|
45
|
-
|
|
45
|
+
var isCacheLoaded_1 = storage.validateCache ? storage.validateCache() : false;
|
|
46
|
+
Promise.resolve().then(function () {
|
|
46
47
|
// Emits SDK_READY_FROM_CACHE
|
|
47
|
-
if (
|
|
48
|
+
if (isCacheLoaded_1)
|
|
48
49
|
readiness.splits.emit(SDK_SPLITS_CACHE_LOADED);
|
|
49
50
|
// Emits SDK_READY
|
|
50
51
|
readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* SplitChanges fetcher is a wrapper around `splitChanges` API service that parses the response and handle errors.
|
|
4
4
|
*/
|
|
5
5
|
export function splitChangesFetcherFactory(fetchSplitChanges) {
|
|
6
|
-
return function splitChangesFetcher(since, noCache, till,
|
|
6
|
+
return function splitChangesFetcher(since, noCache, till,
|
|
7
7
|
// Optional decorator for `fetchSplitChanges` promise, such as timeout or time tracker
|
|
8
8
|
decorator) {
|
|
9
|
-
var splitsPromise = fetchSplitChanges(since, noCache, till
|
|
9
|
+
var splitsPromise = fetchSplitChanges(since, noCache, till);
|
|
10
10
|
if (decorator)
|
|
11
11
|
splitsPromise = decorator(splitsPromise);
|
|
12
12
|
return splitsPromise.then(function (resp) { return resp.json(); });
|
|
@@ -31,10 +31,10 @@ export function pollingManagerCSFactory(params) {
|
|
|
31
31
|
readiness.splits.on(SDK_SPLITS_ARRIVED, function () {
|
|
32
32
|
if (!splitsSyncTask.isRunning())
|
|
33
33
|
return; // noop if not doing polling
|
|
34
|
-
var
|
|
35
|
-
if (
|
|
36
|
-
log.info(POLLING_SMART_PAUSING, [
|
|
37
|
-
if (
|
|
34
|
+
var splitsHaveSegments = storage.splits.usesSegments();
|
|
35
|
+
if (splitsHaveSegments !== mySegmentsSyncTask.isRunning()) {
|
|
36
|
+
log.info(POLLING_SMART_PAUSING, [splitsHaveSegments ? 'ON' : 'OFF']);
|
|
37
|
+
if (splitsHaveSegments) {
|
|
38
38
|
startMySegmentsSyncTasks();
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
@@ -46,10 +46,10 @@ export function pollingManagerCSFactory(params) {
|
|
|
46
46
|
var mySegmentsSyncTask = mySegmentsSyncTaskFactory(splitApi.fetchMemberships, storage, readiness, settings, matchingKey);
|
|
47
47
|
// smart ready
|
|
48
48
|
function smartReady() {
|
|
49
|
-
if (!readiness.isReady() && !storage.splits.usesSegments()
|
|
49
|
+
if (!readiness.isReady() && !storage.splits.usesSegments())
|
|
50
50
|
readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
|
|
51
51
|
}
|
|
52
|
-
if (!storage.splits.usesSegments()
|
|
52
|
+
if (!storage.splits.usesSegments())
|
|
53
53
|
setTimeout(smartReady, 0);
|
|
54
54
|
else
|
|
55
55
|
readiness.splits.once(SDK_SPLITS_ARRIVED, smartReady);
|
|
@@ -63,7 +63,7 @@ export function pollingManagerCSFactory(params) {
|
|
|
63
63
|
start: function () {
|
|
64
64
|
log.info(POLLING_START);
|
|
65
65
|
splitsSyncTask.start();
|
|
66
|
-
if (storage.splits.usesSegments()
|
|
66
|
+
if (storage.splits.usesSegments())
|
|
67
67
|
startMySegmentsSyncTasks();
|
|
68
68
|
},
|
|
69
69
|
// Stop periodic fetching (polling)
|
|
@@ -9,7 +9,7 @@ import { MEMBERSHIPS_LS_UPDATE } from '../../streaming/constants';
|
|
|
9
9
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
10
10
|
*/
|
|
11
11
|
export function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmentsEventEmitter, requestTimeoutBeforeReady, retriesOnFailureBeforeReady, matchingKey) {
|
|
12
|
-
var splits = storage.splits,
|
|
12
|
+
var splits = storage.splits, segments = storage.segments, largeSegments = storage.largeSegments;
|
|
13
13
|
var readyOnAlreadyExistentState = true;
|
|
14
14
|
var startingUp = true;
|
|
15
15
|
/** timeout and telemetry decorator for `splitChangesFetcher` promise */
|
|
@@ -31,7 +31,7 @@ export function mySegmentsUpdaterFactory(log, mySegmentsFetcher, storage, segmen
|
|
|
31
31
|
shouldNotifyUpdate = largeSegments.resetSegments(segmentsData.ls || {}) || shouldNotifyUpdate;
|
|
32
32
|
}
|
|
33
33
|
// Notify update if required
|
|
34
|
-
if (
|
|
34
|
+
if (splits.usesSegments() && (shouldNotifyUpdate || readyOnAlreadyExistentState)) {
|
|
35
35
|
readyOnAlreadyExistentState = false;
|
|
36
36
|
segmentsEventEmitter.emit(SDK_SEGMENTS_ARRIVED);
|
|
37
37
|
}
|
|
@@ -36,7 +36,7 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
|
|
|
36
36
|
* Returned promise will not be rejected.
|
|
37
37
|
*
|
|
38
38
|
* @param fetchOnlyNew - if true, only fetch the segments that not exists, i.e., which `changeNumber` is equal to -1.
|
|
39
|
-
* This param is used by SplitUpdateWorker on server-side SDK, to fetch new registered segments on SPLIT_UPDATE
|
|
39
|
+
* This param is used by SplitUpdateWorker on server-side SDK, to fetch new registered segments on SPLIT_UPDATE notifications.
|
|
40
40
|
* @param segmentName - segment name to fetch. By passing `undefined` it fetches the list of segments registered at the storage
|
|
41
41
|
* @param noCache - true to revalidate data to fetch on a SEGMENT_UPDATE notifications.
|
|
42
42
|
* @param till - till target for the provided segmentName, for CDN bypass.
|