@splitsoftware/splitio-commons 1.17.1-rc.4 → 2.0.0-rc.1

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.
Files changed (177) hide show
  1. package/CHANGES.txt +4 -0
  2. package/cjs/evaluator/Engine.js +1 -1
  3. package/cjs/evaluator/index.js +1 -1
  4. package/cjs/evaluator/matchers/semver_inlist.js +1 -2
  5. package/cjs/evaluator/matchers/whitelist.js +1 -2
  6. package/cjs/listeners/browser.js +1 -2
  7. package/cjs/logger/browser/DebugLogger.js +1 -2
  8. package/cjs/logger/browser/ErrorLogger.js +1 -2
  9. package/cjs/logger/browser/InfoLogger.js +1 -2
  10. package/cjs/logger/browser/WarnLogger.js +1 -2
  11. package/cjs/logger/index.js +1 -2
  12. package/cjs/sdkClient/clientCS.js +5 -8
  13. package/cjs/sdkClient/sdkClientMethodCS.js +1 -1
  14. package/cjs/services/decorateHeaders.js +1 -2
  15. package/cjs/storages/KeyBuilderCS.js +0 -9
  16. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  17. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -4
  18. package/cjs/storages/inLocalStorage/index.js +1 -1
  19. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  20. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -3
  21. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -3
  22. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +2 -2
  23. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -2
  24. package/cjs/storages/inRedis/RedisAdapter.js +2 -2
  25. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -1
  26. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  27. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  28. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  29. package/cjs/storages/pluggable/TelemetryCachePluggable.js +6 -7
  30. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  31. package/cjs/storages/pluggable/inMemoryWrapper.js +6 -6
  32. package/cjs/sync/polling/updaters/splitChangesUpdater.js +3 -3
  33. package/cjs/sync/streaming/parseUtils.js +0 -1
  34. package/cjs/sync/streaming/pushManager.js +2 -3
  35. package/cjs/utils/LRUCache/index.js +1 -2
  36. package/cjs/utils/constants/browser.js +1 -4
  37. package/cjs/utils/lang/index.js +6 -9
  38. package/cjs/utils/lang/objectAssign.js +12 -77
  39. package/cjs/utils/lang/sets.js +10 -107
  40. package/cjs/utils/settingsValidation/index.js +0 -9
  41. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -2
  42. package/esm/evaluator/Engine.js +1 -1
  43. package/esm/evaluator/index.js +2 -2
  44. package/esm/evaluator/matchers/semver_inlist.js +1 -2
  45. package/esm/evaluator/matchers/whitelist.js +1 -2
  46. package/esm/listeners/browser.js +1 -2
  47. package/esm/logger/browser/DebugLogger.js +1 -2
  48. package/esm/logger/browser/ErrorLogger.js +1 -2
  49. package/esm/logger/browser/InfoLogger.js +1 -2
  50. package/esm/logger/browser/WarnLogger.js +1 -2
  51. package/esm/logger/index.js +1 -2
  52. package/esm/sdkClient/clientCS.js +5 -8
  53. package/esm/sdkClient/sdkClientMethodCS.js +1 -1
  54. package/esm/services/decorateHeaders.js +1 -2
  55. package/esm/storages/KeyBuilderCS.js +0 -9
  56. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  57. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +4 -4
  58. package/esm/storages/inLocalStorage/index.js +1 -1
  59. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  60. package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -3
  61. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -3
  62. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +2 -2
  63. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -2
  64. package/esm/storages/inRedis/RedisAdapter.js +2 -2
  65. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  66. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  67. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  68. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  69. package/esm/storages/pluggable/TelemetryCachePluggable.js +6 -7
  70. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  71. package/esm/storages/pluggable/inMemoryWrapper.js +7 -7
  72. package/esm/sync/polling/updaters/splitChangesUpdater.js +3 -3
  73. package/esm/sync/streaming/parseUtils.js +0 -1
  74. package/esm/sync/streaming/pushManager.js +2 -3
  75. package/esm/utils/LRUCache/index.js +1 -2
  76. package/esm/utils/constants/browser.js +0 -3
  77. package/esm/utils/lang/index.js +6 -9
  78. package/esm/utils/lang/objectAssign.js +12 -77
  79. package/esm/utils/lang/sets.js +9 -105
  80. package/esm/utils/settingsValidation/index.js +0 -9
  81. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -2
  82. package/package.json +2 -2
  83. package/src/evaluator/Engine.ts +1 -1
  84. package/src/evaluator/index.ts +4 -4
  85. package/src/evaluator/matchers/semver_inlist.ts +1 -2
  86. package/src/evaluator/matchers/whitelist.ts +1 -3
  87. package/src/listeners/browser.ts +1 -2
  88. package/src/logger/browser/DebugLogger.ts +1 -2
  89. package/src/logger/browser/ErrorLogger.ts +1 -2
  90. package/src/logger/browser/InfoLogger.ts +1 -2
  91. package/src/logger/browser/WarnLogger.ts +1 -2
  92. package/src/logger/index.ts +3 -4
  93. package/src/sdkClient/clientCS.ts +5 -8
  94. package/src/sdkClient/sdkClientMethodCS.ts +1 -1
  95. package/src/sdkFactory/types.ts +1 -1
  96. package/src/services/decorateHeaders.ts +1 -2
  97. package/src/storages/AbstractSplitsCacheAsync.ts +1 -2
  98. package/src/storages/AbstractSplitsCacheSync.ts +1 -2
  99. package/src/storages/KeyBuilderCS.ts +0 -13
  100. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -21
  101. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +5 -5
  102. package/src/storages/inLocalStorage/index.ts +1 -1
  103. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  104. package/src/storages/inMemory/SegmentsCacheInMemory.ts +3 -4
  105. package/src/storages/inMemory/SplitsCacheInMemory.ts +4 -5
  106. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +4 -4
  107. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +4 -4
  108. package/src/storages/inRedis/RedisAdapter.ts +3 -3
  109. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  110. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -4
  111. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -1
  112. package/src/storages/pluggable/SegmentsCachePluggable.ts +0 -1
  113. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  114. package/src/storages/pluggable/TelemetryCachePluggable.ts +6 -7
  115. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -1
  116. package/src/storages/pluggable/inMemoryWrapper.ts +9 -9
  117. package/src/storages/types.ts +3 -4
  118. package/src/sync/polling/updaters/splitChangesUpdater.ts +4 -4
  119. package/src/sync/streaming/parseUtils.ts +0 -1
  120. package/src/sync/streaming/pushManager.ts +3 -4
  121. package/src/sync/submitters/types.ts +3 -4
  122. package/src/types.ts +1 -9
  123. package/src/utils/LRUCache/index.ts +2 -3
  124. package/src/utils/constants/browser.ts +0 -4
  125. package/src/utils/lang/index.ts +6 -7
  126. package/src/utils/lang/objectAssign.ts +13 -92
  127. package/src/utils/lang/sets.ts +10 -122
  128. package/src/utils/settingsValidation/index.ts +0 -10
  129. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  130. package/src/utils/settingsValidation/types.ts +0 -2
  131. package/types/logger/index.d.ts +1 -2
  132. package/types/sdkClient/clientCS.d.ts +2 -3
  133. package/types/sdkFactory/types.d.ts +1 -1
  134. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -2
  135. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -2
  136. package/types/storages/KeyBuilderCS.d.ts +0 -2
  137. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -2
  138. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
  139. package/types/storages/inMemory/UniqueKeysCacheInMemory.d.ts +2 -3
  140. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -2
  141. package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -2
  142. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -2
  143. package/types/storages/types.d.ts +3 -4
  144. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -2
  145. package/types/sync/submitters/types.d.ts +3 -4
  146. package/types/types.d.ts +1 -9
  147. package/types/utils/LRUCache/index.d.ts +1 -2
  148. package/types/utils/constants/browser.d.ts +0 -2
  149. package/types/utils/lang/objectAssign.d.ts +3 -0
  150. package/types/utils/lang/sets.d.ts +2 -61
  151. package/types/utils/settingsValidation/index.d.ts +0 -1
  152. package/types/utils/settingsValidation/types.d.ts +0 -2
  153. package/cjs/integrations/browser.js +0 -31
  154. package/cjs/integrations/ga/GaToSplit.js +0 -257
  155. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +0 -14
  156. package/cjs/integrations/ga/SplitToGa.js +0 -123
  157. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +0 -14
  158. package/cjs/integrations/ga/types.js +0 -2
  159. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +0 -75
  160. package/cjs/utils/lang/maps.js +0 -96
  161. package/esm/integrations/browser.js +0 -27
  162. package/esm/integrations/ga/GaToSplit.js +0 -250
  163. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +0 -10
  164. package/esm/integrations/ga/SplitToGa.js +0 -120
  165. package/esm/integrations/ga/SplitToGoogleAnalytics.js +0 -10
  166. package/esm/integrations/ga/types.js +0 -1
  167. package/esm/sdkClient/sdkClientMethodCSWithTT.js +0 -71
  168. package/esm/utils/lang/maps.js +0 -92
  169. package/src/integrations/browser.ts +0 -35
  170. package/src/integrations/ga/GaToSplit.ts +0 -299
  171. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +0 -14
  172. package/src/integrations/ga/SplitToGa.ts +0 -135
  173. package/src/integrations/ga/SplitToGoogleAnalytics.ts +0 -14
  174. package/src/integrations/ga/autoRequire.js +0 -33
  175. package/src/integrations/ga/types.ts +0 -153
  176. package/src/sdkClient/sdkClientMethodCSWithTT.ts +0 -96
  177. package/src/utils/lang/maps.ts +0 -108
@@ -2,8 +2,8 @@ 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 { _Set, setToArray } from '../../utils/lang/sets';
6
5
  import { getStorageHash } from '../KeyBuilder';
6
+ import { setToArray } from '../../utils/lang/sets';
7
7
  /**
8
8
  * ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
9
9
  */
@@ -227,7 +227,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
227
227
  return flagSets.map(function (flagSet) {
228
228
  var flagSetKey = _this.keys.buildFlagSetKey(flagSet);
229
229
  var flagSetFromLocalStorage = localStorage.getItem(flagSetKey);
230
- return new _Set(flagSetFromLocalStorage ? JSON.parse(flagSetFromLocalStorage) : []);
230
+ return new Set(flagSetFromLocalStorage ? JSON.parse(flagSetFromLocalStorage) : []);
231
231
  });
232
232
  };
233
233
  SplitsCacheInLocal.prototype.addToFlagSets = function (featureFlag) {
@@ -239,7 +239,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
239
239
  return;
240
240
  var flagSetKey = _this.keys.buildFlagSetKey(featureFlagSet);
241
241
  var flagSetFromLocalStorage = localStorage.getItem(flagSetKey);
242
- var flagSetCache = new _Set(flagSetFromLocalStorage ? JSON.parse(flagSetFromLocalStorage) : []);
242
+ var flagSetCache = new Set(flagSetFromLocalStorage ? JSON.parse(flagSetFromLocalStorage) : []);
243
243
  flagSetCache.add(featureFlag.name);
244
244
  localStorage.setItem(flagSetKey, JSON.stringify(setToArray(flagSetCache)));
245
245
  });
@@ -257,7 +257,7 @@ var SplitsCacheInLocal = /** @class */ (function (_super) {
257
257
  var flagSetFromLocalStorage = localStorage.getItem(flagSetKey);
258
258
  if (!flagSetFromLocalStorage)
259
259
  return;
260
- var flagSetCache = new _Set(JSON.parse(flagSetFromLocalStorage));
260
+ var flagSetCache = new Set(JSON.parse(flagSetFromLocalStorage));
261
261
  flagSetCache.delete(featureFlagName);
262
262
  if (flagSetCache.size === 0) {
263
263
  localStorage.removeItem(flagSetKey);
@@ -53,7 +53,7 @@ export function InLocalStorage(options) {
53
53
  this.events.clear();
54
54
  (_a = this.uniqueKeys) === null || _a === void 0 ? void 0 : _a.clear();
55
55
  },
56
- // When using shared instanciation with MEMORY we reuse everything but segments (they are customer per key).
56
+ // When using shared instantiation with MEMORY we reuse everything but segments (they are customer per key).
57
57
  shared: function (matchingKey) {
58
58
  return {
59
59
  splits: this.splits,
@@ -35,7 +35,7 @@ export function InMemoryStorageCSFactory(params) {
35
35
  this.events.clear();
36
36
  this.uniqueKeys && this.uniqueKeys.clear();
37
37
  },
38
- // When using shared instanciation with MEMORY we reuse everything but segments (they are unique per key)
38
+ // When using shared instantiation with MEMORY we reuse everything but segments (they are unique per key)
39
39
  shared: function () {
40
40
  return {
41
41
  splits: this.splits,
@@ -1,4 +1,3 @@
1
- import { _Set } from '../../utils/lang/sets';
2
1
  import { isIntegerNumber } from '../../utils/lang';
3
2
  /**
4
3
  * Default ISplitsCacheSync implementation for server-side that stores segments definitions in memory.
@@ -9,7 +8,7 @@ var SegmentsCacheInMemory = /** @class */ (function () {
9
8
  this.segmentChangeNumber = {};
10
9
  }
11
10
  SegmentsCacheInMemory.prototype.update = function (name, addedKeys, removedKeys, changeNumber) {
12
- var keySet = this.segmentCache[name] || new _Set();
11
+ var keySet = this.segmentCache[name] || new Set();
13
12
  addedKeys.forEach(function (k) { return keySet.add(k); });
14
13
  removedKeys.forEach(function (k) { return keySet.delete(k); });
15
14
  this.segmentCache[name] = keySet;
@@ -29,7 +28,7 @@ var SegmentsCacheInMemory = /** @class */ (function () {
29
28
  };
30
29
  SegmentsCacheInMemory.prototype._registerSegment = function (name) {
31
30
  if (!this.segmentCache[name]) {
32
- this.segmentCache[name] = new _Set();
31
+ this.segmentCache[name] = new Set();
33
32
  }
34
33
  return true;
35
34
  };
@@ -1,7 +1,6 @@
1
1
  import { __extends } from "tslib";
2
2
  import { AbstractSplitsCacheSync, usesSegments } from '../AbstractSplitsCacheSync';
3
3
  import { isFiniteNumber } from '../../utils/lang';
4
- import { _Set } from '../../utils/lang/sets';
5
4
  /**
6
5
  * Default ISplitsCacheSync implementation that stores split definitions in memory.
7
6
  */
@@ -91,7 +90,7 @@ var SplitsCacheInMemory = /** @class */ (function (_super) {
91
90
  };
92
91
  SplitsCacheInMemory.prototype.getNamesByFlagSets = function (flagSets) {
93
92
  var _this = this;
94
- return flagSets.map(function (flagSet) { return _this.flagSetsCache[flagSet] || new _Set(); });
93
+ return flagSets.map(function (flagSet) { return _this.flagSetsCache[flagSet] || new Set(); });
95
94
  };
96
95
  SplitsCacheInMemory.prototype.addToFlagSets = function (featureFlag) {
97
96
  var _this = this;
@@ -101,7 +100,7 @@ var SplitsCacheInMemory = /** @class */ (function (_super) {
101
100
  if (_this.flagSetsFilter.length > 0 && !_this.flagSetsFilter.some(function (filterFlagSet) { return filterFlagSet === featureFlagSet; }))
102
101
  return;
103
102
  if (!_this.flagSetsCache[featureFlagSet])
104
- _this.flagSetsCache[featureFlagSet] = new _Set([]);
103
+ _this.flagSetsCache[featureFlagSet] = new Set([]);
105
104
  _this.flagSetsCache[featureFlagSet].add(featureFlag.name);
106
105
  });
107
106
  };
@@ -1,5 +1,5 @@
1
- import { setToArray, _Set } from '../../utils/lang/sets';
2
1
  import { DEFAULT_CACHE_SIZE } from '../inRedis/constants';
2
+ import { setToArray } from '../../utils/lang/sets';
3
3
  /**
4
4
  * Converts `uniqueKeys` data from cache into request payload for SS.
5
5
  */
@@ -32,7 +32,7 @@ var UniqueKeysCacheInMemory = /** @class */ (function () {
32
32
  */
33
33
  UniqueKeysCacheInMemory.prototype.track = function (userKey, featureName) {
34
34
  if (!this.uniqueKeysTracker[featureName])
35
- this.uniqueKeysTracker[featureName] = new _Set();
35
+ this.uniqueKeysTracker[featureName] = new Set();
36
36
  var tracker = this.uniqueKeysTracker[featureName];
37
37
  if (!tracker.has(userKey)) {
38
38
  tracker.add(userKey);
@@ -1,5 +1,5 @@
1
- import { setToArray, _Set } from '../../utils/lang/sets';
2
1
  import { DEFAULT_CACHE_SIZE } from '../inRedis/constants';
2
+ import { setToArray } from '../../utils/lang/sets';
3
3
  var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
4
4
  /**
5
5
  *
@@ -20,7 +20,7 @@ var UniqueKeysCacheInMemoryCS = /** @class */ (function () {
20
20
  */
21
21
  UniqueKeysCacheInMemoryCS.prototype.track = function (userKey, featureName) {
22
22
  if (!this.uniqueKeysTracker[userKey])
23
- this.uniqueKeysTracker[userKey] = new _Set();
23
+ this.uniqueKeysTracker[userKey] = new Set();
24
24
  var tracker = this.uniqueKeysTracker[userKey];
25
25
  if (!tracker.has(featureName)) {
26
26
  tracker.add(featureName);
@@ -1,9 +1,9 @@
1
1
  import { __extends } from "tslib";
2
2
  import ioredis from 'ioredis';
3
3
  import { merge, isString } from '../../utils/lang';
4
- import { _Set, setToArray } from '../../utils/lang/sets';
5
4
  import { thenable } from '../../utils/promise/thenable';
6
5
  import { timeout } from '../../utils/promise/timeout';
6
+ import { setToArray } from '../../utils/lang/sets';
7
7
  var LOG_PREFIX = 'storage:redis-adapter: ';
8
8
  // If we ever decide to fully wrap every method, there's a Commander.getBuiltinCommands from ioredis.
9
9
  var METHODS_TO_PROMISE_WRAP = ['set', 'exec', 'del', 'get', 'keys', 'sadd', 'srem', 'sismember', 'smembers', 'incr', 'rpush', 'expire', 'mget', 'lrange', 'ltrim', 'hset', 'hincrby', 'popNRaw'];
@@ -33,7 +33,7 @@ var RedisAdapter = /** @class */ (function (_super) {
33
33
  _this.log = log;
34
34
  _this._options = options;
35
35
  _this._notReadyCommandsQueue = [];
36
- _this._runningCommands = new _Set();
36
+ _this._runningCommands = new Set();
37
37
  _this._listenToEvents();
38
38
  _this._setTimeoutWrappers();
39
39
  _this._setDisconnectWrapper();
@@ -2,7 +2,7 @@ import { __extends, __spreadArray } from "tslib";
2
2
  import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
3
3
  import { LOG_PREFIX } from './constants';
4
4
  import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
5
- import { _Set, returnDifference } from '../../utils/lang/sets';
5
+ import { returnDifference } from '../../utils/lang/sets';
6
6
  /**
7
7
  * Discard errors for an answer of multiple operations.
8
8
  */
@@ -197,7 +197,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
197
197
  return value;
198
198
  _this.log.error(LOG_PREFIX + ("Could not read result from get members of flag set " + flagSets[index] + " due to an error: " + e));
199
199
  }); })
200
- .then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new _Set(namesByFlagSet); }); });
200
+ .then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new Set(namesByFlagSet); }); });
201
201
  };
202
202
  /**
203
203
  * Check traffic type existence.
@@ -2,7 +2,6 @@ import { findLatencyIndex } from '../findLatencyIndex';
2
2
  import { getTelemetryConfigStats } from '../../sync/submitters/telemetrySubmitter';
3
3
  import { CONSUMER_MODE, STORAGE_REDIS } from '../../utils/constants';
4
4
  import { isNaNNumber, isString } from '../../utils/lang';
5
- import { _Map } from '../../utils/lang/maps';
6
5
  import { MAX_LATENCY_BUCKET_COUNT, newBuckets } from '../inMemory/TelemetryCacheInMemory';
7
6
  import { parseLatencyField, parseExceptionField, parseMetadata } from '../utils';
8
7
  var TelemetryCacheInRedis = /** @class */ (function () {
@@ -39,7 +38,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
39
38
  TelemetryCacheInRedis.prototype.popLatencies = function () {
40
39
  var _this = this;
41
40
  return this.redis.hgetall(this.keys.latencyPrefix).then(function (latencies) {
42
- var result = new _Map();
41
+ var result = new Map();
43
42
  Object.keys(latencies).forEach(function (field) {
44
43
  var parsedField = parseLatencyField(field);
45
44
  if (isString(parsedField)) {
@@ -71,7 +70,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
71
70
  TelemetryCacheInRedis.prototype.popExceptions = function () {
72
71
  var _this = this;
73
72
  return this.redis.hgetall(this.keys.exceptionPrefix).then(function (exceptions) {
74
- var result = new _Map();
73
+ var result = new Map();
75
74
  Object.keys(exceptions).forEach(function (field) {
76
75
  var parsedField = parseExceptionField(field);
77
76
  if (isString(parsedField)) {
@@ -98,7 +97,7 @@ var TelemetryCacheInRedis = /** @class */ (function () {
98
97
  TelemetryCacheInRedis.prototype.popConfigs = function () {
99
98
  var _this = this;
100
99
  return this.redis.hgetall(this.keys.initPrefix).then(function (configs) {
101
- var result = new _Map();
100
+ var result = new Map();
102
101
  Object.keys(configs).forEach(function (field) {
103
102
  var parsedField = parseMetadata(field);
104
103
  if (isString(parsedField)) {
@@ -1,8 +1,8 @@
1
1
  import { __extends } from "tslib";
2
2
  import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
3
- import { setToArray } from '../../utils/lang/sets';
4
3
  import { DEFAULT_CACHE_SIZE, REFRESH_RATE, TTL_REFRESH } from './constants';
5
4
  import { LOG_PREFIX } from './constants';
5
+ import { setToArray } from '../../utils/lang/sets';
6
6
  var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
7
7
  __extends(UniqueKeysCacheInRedis, _super);
8
8
  function UniqueKeysCacheInRedis(log, key, redis, uniqueKeysQueueSize, refreshRate) {
@@ -2,7 +2,7 @@ import { __extends, __spreadArray } from "tslib";
2
2
  import { isFiniteNumber, isNaNNumber } from '../../utils/lang';
3
3
  import { LOG_PREFIX } from './constants';
4
4
  import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
5
- import { _Set, returnDifference } from '../../utils/lang/sets';
5
+ import { returnDifference } from '../../utils/lang/sets';
6
6
  /**
7
7
  * ISplitsCacheAsync implementation for pluggable storages.
8
8
  */
@@ -167,7 +167,7 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
167
167
  return Promise.all(flagSets.map(function (flagSet) {
168
168
  var flagSetKey = _this.keys.buildFlagSetKey(flagSet);
169
169
  return _this.wrapper.getItems(flagSetKey).catch(function () { return []; });
170
- })).then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new _Set(namesByFlagSet); }); });
170
+ })).then(function (namesByFlagSets) { return namesByFlagSets.map(function (namesByFlagSet) { return new Set(namesByFlagSet); }); });
171
171
  };
172
172
  /**
173
173
  * Check traffic type existence.
@@ -2,7 +2,6 @@ import { findLatencyIndex } from '../findLatencyIndex';
2
2
  import { getTelemetryConfigStats } from '../../sync/submitters/telemetrySubmitter';
3
3
  import { CONSUMER_MODE, STORAGE_PLUGGABLE } from '../../utils/constants';
4
4
  import { isString, isNaNNumber } from '../../utils/lang';
5
- import { _Map } from '../../utils/lang/maps';
6
5
  import { MAX_LATENCY_BUCKET_COUNT, newBuckets } from '../inMemory/TelemetryCacheInMemory';
7
6
  import { parseLatencyField, parseExceptionField, parseMetadata } from '../utils';
8
7
  var TelemetryCachePluggable = /** @class */ (function () {
@@ -38,7 +37,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
38
37
  return this.wrapper.getKeysByPrefix(this.keys.latencyPrefix).then(function (latencyKeys) {
39
38
  return latencyKeys.length ?
40
39
  _this.wrapper.getMany(latencyKeys).then(function (latencies) {
41
- var result = new _Map();
40
+ var result = new Map();
42
41
  for (var i = 0; i < latencyKeys.length; i++) {
43
42
  var field = latencyKeys[i].split('::')[1];
44
43
  var parsedField = parseLatencyField(field);
@@ -65,7 +64,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
65
64
  return Promise.all(latencyKeys.map(function (latencyKey) { return _this.wrapper.del(latencyKey); })).then(function () { return result; });
66
65
  }) :
67
66
  // If latencyKeys is empty, return an empty map.
68
- new _Map();
67
+ new Map();
69
68
  });
70
69
  };
71
70
  /**
@@ -77,7 +76,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
77
76
  return this.wrapper.getKeysByPrefix(this.keys.exceptionPrefix).then(function (exceptionKeys) {
78
77
  return exceptionKeys.length ?
79
78
  _this.wrapper.getMany(exceptionKeys).then(function (exceptions) {
80
- var result = new _Map();
79
+ var result = new Map();
81
80
  for (var i = 0; i < exceptionKeys.length; i++) {
82
81
  var field = exceptionKeys[i].split('::')[1];
83
82
  var parsedField = parseExceptionField(field);
@@ -99,7 +98,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
99
98
  return Promise.all(exceptionKeys.map(function (exceptionKey) { return _this.wrapper.del(exceptionKey); })).then(function () { return result; });
100
99
  }) :
101
100
  // If exceptionKeys is empty, return an empty map.
102
- new _Map();
101
+ new Map();
103
102
  });
104
103
  };
105
104
  /**
@@ -111,7 +110,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
111
110
  return this.wrapper.getKeysByPrefix(this.keys.initPrefix).then(function (configKeys) {
112
111
  return configKeys.length ?
113
112
  _this.wrapper.getMany(configKeys).then(function (configs) {
114
- var result = new _Map();
113
+ var result = new Map();
115
114
  for (var i = 0; i < configKeys.length; i++) {
116
115
  var field = configKeys[i].split('::')[1];
117
116
  var parsedField = parseMetadata(field);
@@ -131,7 +130,7 @@ var TelemetryCachePluggable = /** @class */ (function () {
131
130
  return Promise.all(configKeys.map(function (configKey) { return _this.wrapper.del(configKey); })).then(function () { return result; });
132
131
  }) :
133
132
  // If configKeys is empty, return an empty map.
134
- new _Map();
133
+ new Map();
135
134
  });
136
135
  };
137
136
  return TelemetryCachePluggable;
@@ -1,8 +1,8 @@
1
1
  import { __extends } from "tslib";
2
2
  import { UniqueKeysCacheInMemory } from '../inMemory/UniqueKeysCacheInMemory';
3
- import { setToArray } from '../../utils/lang/sets';
4
3
  import { DEFAULT_CACHE_SIZE, REFRESH_RATE } from '../inRedis/constants';
5
4
  import { LOG_PREFIX } from './constants';
5
+ import { setToArray } from '../../utils/lang/sets';
6
6
  var UniqueKeysCachePluggable = /** @class */ (function (_super) {
7
7
  __extends(UniqueKeysCachePluggable, _super);
8
8
  function UniqueKeysCachePluggable(log, key, wrapper, uniqueKeysQueueSize, refreshRate) {
@@ -1,5 +1,5 @@
1
1
  import { startsWith, toNumber } from '../../utils/lang';
2
- import { setToArray, _Set } from '../../utils/lang/sets';
2
+ import { setToArray } from '../../utils/lang/sets';
3
3
  /**
4
4
  * Creates a IPluggableStorageWrapper implementation that stores items in memory.
5
5
  * The `_cache` property is the object were items are stored.
@@ -87,15 +87,15 @@ export function inMemoryWrapperFactory(connDelay) {
87
87
  var set = _cache[key];
88
88
  if (!set)
89
89
  return Promise.resolve(false);
90
- if (set instanceof _Set)
90
+ if (set instanceof Set)
91
91
  return Promise.resolve(set.has(item));
92
92
  return Promise.reject('key is not a set');
93
93
  },
94
94
  addItems: function (key, items) {
95
95
  if (!(key in _cache))
96
- _cache[key] = new _Set();
96
+ _cache[key] = new Set();
97
97
  var set = _cache[key];
98
- if (set instanceof _Set) {
98
+ if (set instanceof Set) {
99
99
  items.forEach(function (item) { return set.add(item); });
100
100
  return Promise.resolve();
101
101
  }
@@ -103,9 +103,9 @@ export function inMemoryWrapperFactory(connDelay) {
103
103
  },
104
104
  removeItems: function (key, items) {
105
105
  if (!(key in _cache))
106
- _cache[key] = new _Set();
106
+ _cache[key] = new Set();
107
107
  var set = _cache[key];
108
- if (set instanceof _Set) {
108
+ if (set instanceof Set) {
109
109
  items.forEach(function (item) { return set.delete(item); });
110
110
  return Promise.resolve();
111
111
  }
@@ -115,7 +115,7 @@ export function inMemoryWrapperFactory(connDelay) {
115
115
  var set = _cache[key];
116
116
  if (!set)
117
117
  return Promise.resolve([]);
118
- if (set instanceof _Set)
118
+ if (set instanceof Set)
119
119
  return Promise.resolve(setToArray(set));
120
120
  return Promise.reject('key is not a set');
121
121
  },
@@ -1,9 +1,9 @@
1
- import { _Set, setToArray } from '../../../utils/lang/sets';
2
1
  import { timeout } from '../../../utils/promise/timeout';
3
2
  import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
4
3
  import { SYNC_SPLITS_FETCH, SYNC_SPLITS_NEW, SYNC_SPLITS_REMOVED, SYNC_SPLITS_SEGMENTS, SYNC_SPLITS_FETCH_FAILS, SYNC_SPLITS_FETCH_RETRY } from '../../../logger/constants';
5
4
  import { startsWith } from '../../../utils/lang';
6
5
  import { IN_SEGMENT } from '../../../utils/constants';
6
+ import { setToArray } from '../../../utils/lang/sets';
7
7
  // Checks that all registered segments have been fetched (changeNumber !== -1 for every segment).
8
8
  // Returns a promise that could be rejected.
9
9
  // @TODO review together with Segments and MySegments storage APIs
@@ -20,7 +20,7 @@ function checkAllSegmentsExist(segments) {
20
20
  */
21
21
  export function parseSegments(_a) {
22
22
  var conditions = _a.conditions;
23
- var segments = new _Set();
23
+ var segments = new Set();
24
24
  for (var i = 0; i < conditions.length; i++) {
25
25
  var matchers = conditions[i].matcherGroup.matchers;
26
26
  matchers.forEach(function (matcher) {
@@ -55,7 +55,7 @@ function matchFilters(featureFlag, filters) {
55
55
  * Exported for testing purposes.
56
56
  */
57
57
  export function computeSplitsMutation(entries, filters) {
58
- var segments = new _Set();
58
+ var segments = new Set();
59
59
  var computed = entries.reduce(function (accum, split) {
60
60
  if (split.status === 'ACTIVE' && matchFilters(split, filters)) {
61
61
  accum.added.push([split.name, split]);
@@ -8,7 +8,6 @@ function Uint8ArrayToString(myUint8Arr) {
8
8
  }
9
9
  function StringToUint8Array(myString) {
10
10
  var charCodes = myString.split('').map(function (e) { return e.charCodeAt(0); });
11
- // eslint-disable-next-line compat/compat
12
11
  return new Uint8Array(charCodes);
13
12
  }
14
13
  /**
@@ -12,7 +12,6 @@ import { MEMBERSHIPS_MS_UPDATE, MEMBERSHIPS_LS_UPDATE, PUSH_NONRETRYABLE_ERROR,
12
12
  import { STREAMING_FALLBACK, STREAMING_REFRESH_TOKEN, STREAMING_CONNECTING, STREAMING_DISABLED, ERROR_STREAMING_AUTH, STREAMING_DISCONNECTING, STREAMING_RECONNECT, STREAMING_PARSING_MEMBERSHIPS_UPDATE, STREAMING_PARSING_SPLIT_UPDATE } from '../../logger/constants';
13
13
  import { UpdateStrategy } from './SSEHandler/types';
14
14
  import { getDelay, isInBitmap, parseBitmap, parseFFUpdatePayload, parseKeyList } from './parseUtils';
15
- import { _Set } from '../../utils/lang/sets';
16
15
  import { hash64 } from '../../utils/murmur3/murmur3_64';
17
16
  import { TOKEN_REFRESH, AUTH_REJECTION } from '../../utils/constants';
18
17
  /**
@@ -218,8 +217,8 @@ export function pushManagerFactory(params, pollingManager) {
218
217
  var keyList = void 0, added_1, removed_1;
219
218
  try {
220
219
  keyList = parseKeyList(parsedData.d, parsedData.c);
221
- added_1 = new _Set(keyList.a);
222
- removed_1 = new _Set(keyList.r);
220
+ added_1 = new Set(keyList.a);
221
+ removed_1 = new Set(keyList.r);
223
222
  }
224
223
  catch (e) {
225
224
  log.warn(STREAMING_PARSING_MEMBERSHIPS_UPDATE, ['KeyList', e]);
@@ -1,9 +1,8 @@
1
- import { _Map } from '../lang/maps';
2
1
  import { LinkedList, Node } from './LinkedList';
3
2
  var LRUCache = /** @class */ (function () {
4
3
  function LRUCache(maxSize) {
5
4
  this.maxLen = maxSize || 1;
6
- this.items = new _Map();
5
+ this.items = new Map();
7
6
  this.lru = new LinkedList();
8
7
  }
9
8
  LRUCache.prototype.get = function (key) {
@@ -1,5 +1,2 @@
1
- // Integration types
2
- export var GOOGLE_ANALYTICS_TO_SPLIT = 'GOOGLE_ANALYTICS_TO_SPLIT';
3
- export var SPLIT_TO_GOOGLE_ANALYTICS = 'SPLIT_TO_GOOGLE_ANALYTICS';
4
1
  // This value might be eventually set via a config parameter
5
2
  export var DEFAULT_CACHE_EXPIRATION_IN_MILLIS = 864000000; // 10 days
@@ -111,11 +111,9 @@ export function isBoolean(val) {
111
111
  export function isFiniteNumber(val) {
112
112
  if (val instanceof Number)
113
113
  val = val.valueOf();
114
- // @TODO remove `isFinite` once `Number.isFinite` is fully supported by targets
115
- // eslint-disable-next-line compat/compat
116
- if (typeof val === 'number')
117
- return Number.isFinite ? Number.isFinite(val) : isFinite(val);
118
- return false;
114
+ return typeof val === 'number' ?
115
+ Number.isFinite ? Number.isFinite(val) : isFinite(val) :
116
+ false;
119
117
  }
120
118
  /**
121
119
  * Checks if a given value is an integer value of number type or Number object.
@@ -124,10 +122,9 @@ export function isFiniteNumber(val) {
124
122
  export function isIntegerNumber(val) {
125
123
  if (val instanceof Number)
126
124
  val = val.valueOf();
127
- // eslint-disable-next-line compat/compat
128
- if (typeof val === 'number')
129
- return Number.isInteger ? Number.isInteger(val) : isFinite(val) && Math.floor(val) === val;
130
- return false;
125
+ return typeof val === 'number' ?
126
+ Number.isInteger ? Number.isInteger(val) : isFinite(val) && Math.floor(val) === val :
127
+ false;
131
128
  }
132
129
  /**
133
130
  * Checks if a given value is a NaN value of number type or Number object.
@@ -1,82 +1,17 @@
1
- /*
2
- Adaptation of "object-assign" library (https://www.npmjs.com/package/object-assign)
3
- exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
4
- the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
5
-
6
- object-assign
7
- (c) Sindre Sorhus
8
- @license MIT
9
- */
10
- /* eslint-disable */
11
- // @ts-nocheck
12
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
13
- var hasOwnProperty = Object.prototype.hasOwnProperty;
14
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
15
- function toObject(val) {
16
- if (val === null || val === undefined) {
1
+ /**
2
+ * A tiny polyfill for Object.assign
3
+ */
4
+ export var objectAssign = Object.assign || function (target) {
5
+ if (target === null || target === undefined)
17
6
  throw new TypeError('Object.assign cannot be called with null or undefined');
18
- }
19
- return Object(val);
20
- }
21
- function shouldUseNative() {
22
- try {
23
- if (!Object.assign) {
24
- return false;
25
- }
26
- // Detect buggy property enumeration order in older V8 versions.
27
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
28
- var test1 = new String('abc');
29
- test1[5] = 'de';
30
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
31
- return false;
32
- }
33
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
34
- var test2 = {};
35
- for (var i = 0; i < 10; i++) {
36
- test2['_' + String.fromCharCode(i)] = i;
37
- }
38
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
39
- return test2[n];
40
- });
41
- if (order2.join('') !== '0123456789') {
42
- return false;
43
- }
44
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
45
- var test3 = {};
46
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
47
- test3[letter] = letter;
48
- });
49
- if (Object.keys(Object.assign({}, test3)).join('') !==
50
- 'abcdefghijklmnopqrst') {
51
- return false;
52
- }
53
- return true;
54
- }
55
- catch (err) {
56
- // We don't expect any of the above to throw, but better to be safe.
57
- return false;
58
- }
59
- }
60
- export var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
61
- var from;
62
- var to = toObject(target);
63
- var symbols;
64
- for (var s = 1; s < arguments.length; s++) {
65
- from = Object(arguments[s]);
66
- // eslint-disable-next-line no-restricted-syntax
67
- for (var key in from) {
68
- if (hasOwnProperty.call(from, key)) {
69
- to[key] = from[key];
70
- }
71
- }
72
- if (getOwnPropertySymbols) {
73
- symbols = getOwnPropertySymbols(from);
74
- for (var i = 0; i < symbols.length; i++) {
75
- if (propIsEnumerable.call(from, symbols[i])) {
76
- to[symbols[i]] = from[symbols[i]];
77
- }
7
+ target = Object(target);
8
+ for (var i = 1; i < arguments.length; i++) {
9
+ var source = Object(arguments[i]); // eslint-disable-next-line no-restricted-syntax
10
+ for (var key in source) {
11
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12
+ target[key] = source[key];
78
13
  }
79
14
  }
80
15
  }
81
- return to;
16
+ return target;
82
17
  };