@splitsoftware/splitio-commons 1.17.1-rc.3 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/CHANGES.txt +7 -3
  2. package/cjs/evaluator/index.js +2 -2
  3. package/cjs/evaluator/matchers/semver_inlist.js +1 -2
  4. package/cjs/evaluator/matchers/whitelist.js +1 -2
  5. package/cjs/listeners/browser.js +1 -2
  6. package/cjs/logger/browser/DebugLogger.js +1 -2
  7. package/cjs/logger/browser/ErrorLogger.js +1 -2
  8. package/cjs/logger/browser/InfoLogger.js +1 -2
  9. package/cjs/logger/browser/WarnLogger.js +1 -2
  10. package/cjs/logger/index.js +1 -2
  11. package/cjs/readiness/readinessManager.js +5 -7
  12. package/cjs/sdkClient/clientCS.js +5 -8
  13. package/cjs/sdkClient/sdkClientMethodCS.js +5 -8
  14. package/cjs/sdkFactory/index.js +10 -33
  15. package/cjs/services/decorateHeaders.js +1 -2
  16. package/cjs/storages/AbstractSplitsCacheAsync.js +7 -0
  17. package/cjs/storages/AbstractSplitsCacheSync.js +7 -0
  18. package/cjs/storages/KeyBuilderCS.js +0 -9
  19. package/cjs/storages/dataLoader.js +32 -64
  20. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  21. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  22. package/cjs/storages/inLocalStorage/index.js +1 -6
  23. package/cjs/storages/inMemory/InMemoryStorageCS.js +4 -16
  24. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  25. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -3
  26. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  27. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  28. package/cjs/storages/inRedis/RedisAdapter.js +3 -4
  29. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -1
  30. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  31. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  32. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  33. package/cjs/storages/pluggable/TelemetryCachePluggable.js +6 -7
  34. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  35. package/cjs/storages/pluggable/inMemoryWrapper.js +7 -8
  36. package/cjs/storages/pluggable/index.js +32 -37
  37. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +7 -2
  38. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  39. package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -5
  40. package/cjs/sync/streaming/parseUtils.js +0 -1
  41. package/cjs/sync/streaming/pushManager.js +2 -3
  42. package/cjs/trackers/eventTracker.js +9 -11
  43. package/cjs/trackers/impressionsTracker.js +13 -15
  44. package/cjs/trackers/uniqueKeysTracker.js +3 -5
  45. package/cjs/utils/LRUCache/index.js +1 -2
  46. package/cjs/utils/constants/browser.js +1 -4
  47. package/cjs/utils/lang/index.js +6 -9
  48. package/cjs/utils/lang/objectAssign.js +12 -77
  49. package/cjs/utils/lang/sets.js +3 -110
  50. package/cjs/utils/settingsValidation/index.js +0 -9
  51. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -2
  52. package/cjs/utils/settingsValidation/storage/storageCS.js +12 -1
  53. package/esm/evaluator/index.js +3 -3
  54. package/esm/evaluator/matchers/semver_inlist.js +1 -2
  55. package/esm/evaluator/matchers/whitelist.js +1 -2
  56. package/esm/listeners/browser.js +1 -2
  57. package/esm/logger/browser/DebugLogger.js +1 -2
  58. package/esm/logger/browser/ErrorLogger.js +1 -2
  59. package/esm/logger/browser/InfoLogger.js +1 -2
  60. package/esm/logger/browser/WarnLogger.js +1 -2
  61. package/esm/logger/index.js +1 -2
  62. package/esm/readiness/readinessManager.js +5 -7
  63. package/esm/sdkClient/clientCS.js +5 -8
  64. package/esm/sdkClient/sdkClientMethodCS.js +5 -8
  65. package/esm/sdkFactory/index.js +11 -34
  66. package/esm/services/decorateHeaders.js +1 -2
  67. package/esm/storages/AbstractSplitsCacheAsync.js +7 -0
  68. package/esm/storages/AbstractSplitsCacheSync.js +7 -0
  69. package/esm/storages/KeyBuilderCS.js +0 -9
  70. package/esm/storages/dataLoader.js +30 -61
  71. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  72. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  73. package/esm/storages/inLocalStorage/index.js +2 -7
  74. package/esm/storages/inMemory/InMemoryStorageCS.js +4 -16
  75. package/esm/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  76. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -3
  77. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  78. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  79. package/esm/storages/inRedis/RedisAdapter.js +3 -4
  80. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  81. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  82. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  83. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  84. package/esm/storages/pluggable/TelemetryCachePluggable.js +6 -7
  85. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  86. package/esm/storages/pluggable/inMemoryWrapper.js +7 -8
  87. package/esm/storages/pluggable/index.js +32 -37
  88. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +8 -3
  89. package/esm/sync/polling/pollingManagerSS.js +3 -3
  90. package/esm/sync/polling/updaters/splitChangesUpdater.js +14 -6
  91. package/esm/sync/streaming/parseUtils.js +0 -1
  92. package/esm/sync/streaming/pushManager.js +2 -3
  93. package/esm/trackers/eventTracker.js +9 -11
  94. package/esm/trackers/impressionsTracker.js +13 -15
  95. package/esm/trackers/uniqueKeysTracker.js +3 -5
  96. package/esm/utils/LRUCache/index.js +1 -2
  97. package/esm/utils/constants/browser.js +0 -3
  98. package/esm/utils/lang/index.js +6 -9
  99. package/esm/utils/lang/objectAssign.js +12 -77
  100. package/esm/utils/lang/sets.js +2 -107
  101. package/esm/utils/settingsValidation/index.js +0 -9
  102. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -2
  103. package/esm/utils/settingsValidation/storage/storageCS.js +10 -0
  104. package/package.json +2 -2
  105. package/src/evaluator/index.ts +5 -5
  106. package/src/evaluator/matchers/semver_inlist.ts +1 -2
  107. package/src/evaluator/matchers/whitelist.ts +1 -3
  108. package/src/listeners/browser.ts +1 -2
  109. package/src/logger/browser/DebugLogger.ts +1 -2
  110. package/src/logger/browser/ErrorLogger.ts +1 -2
  111. package/src/logger/browser/InfoLogger.ts +1 -2
  112. package/src/logger/browser/WarnLogger.ts +1 -2
  113. package/src/logger/index.ts +3 -4
  114. package/src/readiness/readinessManager.ts +7 -9
  115. package/src/readiness/types.ts +0 -1
  116. package/src/sdkClient/clientCS.ts +5 -8
  117. package/src/sdkClient/sdkClientMethodCS.ts +3 -6
  118. package/src/sdkFactory/index.ts +12 -37
  119. package/src/sdkFactory/types.ts +1 -4
  120. package/src/services/decorateHeaders.ts +1 -2
  121. package/src/storages/AbstractSplitsCacheAsync.ts +9 -2
  122. package/src/storages/AbstractSplitsCacheSync.ts +9 -2
  123. package/src/storages/KeyBuilderCS.ts +0 -13
  124. package/src/storages/dataLoader.ts +32 -62
  125. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -21
  126. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +16 -8
  127. package/src/storages/inLocalStorage/index.ts +2 -8
  128. package/src/storages/inMemory/InMemoryStorageCS.ts +4 -19
  129. package/src/storages/inMemory/SegmentsCacheInMemory.ts +4 -5
  130. package/src/storages/inMemory/SplitsCacheInMemory.ts +4 -5
  131. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +4 -5
  132. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +4 -5
  133. package/src/storages/inRedis/RedisAdapter.ts +4 -5
  134. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  135. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -4
  136. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -2
  137. package/src/storages/pluggable/SegmentsCachePluggable.ts +0 -1
  138. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  139. package/src/storages/pluggable/TelemetryCachePluggable.ts +6 -7
  140. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -2
  141. package/src/storages/pluggable/inMemoryWrapper.ts +8 -9
  142. package/src/storages/pluggable/index.ts +33 -38
  143. package/src/storages/types.ts +9 -6
  144. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +7 -3
  145. package/src/sync/polling/pollingManagerSS.ts +2 -3
  146. package/src/sync/polling/updaters/splitChangesUpdater.ts +15 -8
  147. package/src/sync/streaming/parseUtils.ts +0 -1
  148. package/src/sync/streaming/pushManager.ts +3 -4
  149. package/src/sync/submitters/types.ts +3 -4
  150. package/src/trackers/eventTracker.ts +7 -10
  151. package/src/trackers/impressionsTracker.ts +9 -12
  152. package/src/trackers/types.ts +0 -1
  153. package/src/trackers/uniqueKeysTracker.ts +4 -6
  154. package/src/types.ts +9 -18
  155. package/src/utils/LRUCache/index.ts +2 -3
  156. package/src/utils/constants/browser.ts +0 -4
  157. package/src/utils/lang/index.ts +6 -7
  158. package/src/utils/lang/objectAssign.ts +13 -92
  159. package/src/utils/lang/sets.ts +3 -125
  160. package/src/utils/settingsValidation/index.ts +0 -10
  161. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  162. package/src/utils/settingsValidation/storage/storageCS.ts +13 -0
  163. package/src/utils/settingsValidation/types.ts +0 -2
  164. package/types/logger/index.d.ts +1 -2
  165. package/types/readiness/types.d.ts +0 -1
  166. package/types/sdkClient/clientCS.d.ts +2 -3
  167. package/types/sdkFactory/types.d.ts +1 -3
  168. package/types/storages/AbstractSplitsCacheAsync.d.ts +6 -2
  169. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -2
  170. package/types/storages/KeyBuilderCS.d.ts +0 -2
  171. package/types/storages/dataLoader.d.ts +6 -17
  172. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +7 -2
  173. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
  174. package/types/storages/inMemory/UniqueKeysCacheInMemory.d.ts +2 -3
  175. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -2
  176. package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -2
  177. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -2
  178. package/types/storages/types.d.ts +7 -6
  179. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -2
  180. package/types/sync/submitters/types.d.ts +3 -4
  181. package/types/trackers/eventTracker.d.ts +1 -1
  182. package/types/trackers/impressionsTracker.d.ts +1 -1
  183. package/types/trackers/types.d.ts +0 -1
  184. package/types/types.d.ts +9 -17
  185. package/types/utils/LRUCache/index.d.ts +1 -2
  186. package/types/utils/constants/browser.d.ts +0 -2
  187. package/types/utils/lang/objectAssign.d.ts +3 -0
  188. package/types/utils/lang/sets.d.ts +1 -61
  189. package/types/utils/settingsValidation/index.d.ts +0 -1
  190. package/types/utils/settingsValidation/storage/storageCS.d.ts +5 -0
  191. package/types/utils/settingsValidation/types.d.ts +0 -2
  192. package/cjs/integrations/browser.js +0 -31
  193. package/cjs/integrations/ga/GaToSplit.js +0 -257
  194. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +0 -14
  195. package/cjs/integrations/ga/SplitToGa.js +0 -123
  196. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +0 -14
  197. package/cjs/integrations/ga/types.js +0 -2
  198. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +0 -79
  199. package/cjs/utils/lang/maps.js +0 -96
  200. package/esm/integrations/browser.js +0 -27
  201. package/esm/integrations/ga/GaToSplit.js +0 -250
  202. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +0 -10
  203. package/esm/integrations/ga/SplitToGa.js +0 -120
  204. package/esm/integrations/ga/SplitToGoogleAnalytics.js +0 -10
  205. package/esm/integrations/ga/types.js +0 -1
  206. package/esm/sdkClient/sdkClientMethodCSWithTT.js +0 -75
  207. package/esm/utils/lang/maps.js +0 -92
  208. package/src/integrations/browser.ts +0 -35
  209. package/src/integrations/ga/GaToSplit.ts +0 -299
  210. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +0 -14
  211. package/src/integrations/ga/SplitToGa.ts +0 -135
  212. package/src/integrations/ga/SplitToGoogleAnalytics.ts +0 -14
  213. package/src/integrations/ga/autoRequire.js +0 -33
  214. package/src/integrations/ga/types.ts +0 -153
  215. package/src/sdkClient/sdkClientMethodCSWithTT.ts +0 -101
  216. package/src/utils/lang/maps.ts +0 -108
@@ -1,7 +1,6 @@
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';
7
6
  var LOG_PREFIX = 'storage:redis-adapter: ';
@@ -17,7 +16,7 @@ var DEFAULT_OPTIONS = {
17
16
  var DEFAULT_LIBRARY_OPTIONS = {
18
17
  enableOfflineQueue: false,
19
18
  connectTimeout: DEFAULT_OPTIONS.connectionTimeout,
20
- lazyConnect: false // @TODO true to avoid side-effects on instantiation.
19
+ lazyConnect: false
21
20
  };
22
21
  /**
23
22
  * Redis adapter on top of the library of choice (written with ioredis) for some extra control.
@@ -33,7 +32,7 @@ var RedisAdapter = /** @class */ (function (_super) {
33
32
  _this.log = log;
34
33
  _this._options = options;
35
34
  _this._notReadyCommandsQueue = [];
36
- _this._runningCommands = new _Set();
35
+ _this._runningCommands = new Set();
37
36
  _this._listenToEvents();
38
37
  _this._setTimeoutWrappers();
39
38
  _this._setDisconnectWrapper();
@@ -126,7 +125,7 @@ var RedisAdapter = /** @class */ (function (_super) {
126
125
  setTimeout(function deferredDisconnect() {
127
126
  if (instance._runningCommands.size > 0) {
128
127
  instance.log.info(LOG_PREFIX + ("Attempting to disconnect but there are " + instance._runningCommands.size + " commands still waiting for resolution. Defering disconnection until those finish."));
129
- Promise.all(setToArray(instance._runningCommands))
128
+ Promise.all(Array.from(instance._runningCommands))
130
129
  .then(function () {
131
130
  instance.log.debug(LOG_PREFIX + 'Pending commands finished successfully, disconnecting.');
132
131
  originalMethod.apply(instance, params);
@@ -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,6 +1,5 @@
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';
6
5
  var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
@@ -22,7 +21,7 @@ var UniqueKeysCacheInRedis = /** @class */ (function (_super) {
22
21
  if (!featureNames.length)
23
22
  return Promise.resolve(false);
24
23
  var uniqueKeysArray = featureNames.map(function (featureName) {
25
- var featureKeys = setToArray(_this.uniqueKeysTracker[featureName]);
24
+ var featureKeys = Array.from(_this.uniqueKeysTracker[featureName]);
26
25
  var uniqueKeysPayload = {
27
26
  f: featureName,
28
27
  ks: featureKeys
@@ -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,6 +1,5 @@
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';
6
5
  var UniqueKeysCachePluggable = /** @class */ (function (_super) {
@@ -22,7 +21,7 @@ var UniqueKeysCachePluggable = /** @class */ (function (_super) {
22
21
  if (!featureNames.length)
23
22
  return Promise.resolve(false);
24
23
  var uniqueKeysArray = featureNames.map(function (featureName) {
25
- var featureKeys = setToArray(_this.uniqueKeysTracker[featureName]);
24
+ var featureKeys = Array.from(_this.uniqueKeysTracker[featureName]);
26
25
  var uniqueKeysPayload = {
27
26
  f: featureName,
28
27
  ks: featureKeys
@@ -1,5 +1,4 @@
1
1
  import { startsWith, toNumber } from '../../utils/lang';
2
- import { setToArray, _Set } from '../../utils/lang/sets';
3
2
  /**
4
3
  * Creates a IPluggableStorageWrapper implementation that stores items in memory.
5
4
  * The `_cache` property is the object were items are stored.
@@ -87,15 +86,15 @@ export function inMemoryWrapperFactory(connDelay) {
87
86
  var set = _cache[key];
88
87
  if (!set)
89
88
  return Promise.resolve(false);
90
- if (set instanceof _Set)
89
+ if (set instanceof Set)
91
90
  return Promise.resolve(set.has(item));
92
91
  return Promise.reject('key is not a set');
93
92
  },
94
93
  addItems: function (key, items) {
95
94
  if (!(key in _cache))
96
- _cache[key] = new _Set();
95
+ _cache[key] = new Set();
97
96
  var set = _cache[key];
98
- if (set instanceof _Set) {
97
+ if (set instanceof Set) {
99
98
  items.forEach(function (item) { return set.add(item); });
100
99
  return Promise.resolve();
101
100
  }
@@ -103,9 +102,9 @@ export function inMemoryWrapperFactory(connDelay) {
103
102
  },
104
103
  removeItems: function (key, items) {
105
104
  if (!(key in _cache))
106
- _cache[key] = new _Set();
105
+ _cache[key] = new Set();
107
106
  var set = _cache[key];
108
- if (set instanceof _Set) {
107
+ if (set instanceof Set) {
109
108
  items.forEach(function (item) { return set.delete(item); });
110
109
  return Promise.resolve();
111
110
  }
@@ -115,8 +114,8 @@ export function inMemoryWrapperFactory(connDelay) {
115
114
  var set = _cache[key];
116
115
  if (!set)
117
116
  return Promise.resolve([]);
118
- if (set instanceof _Set)
119
- return Promise.resolve(setToArray(set));
117
+ if (set instanceof Set)
118
+ return Promise.resolve(Array.from(set));
120
119
  return Promise.reject('key is not a set');
121
120
  },
122
121
  // always connects and disconnects
@@ -55,7 +55,6 @@ export function PluggableStorage(options) {
55
55
  var metadata = metadataBuilder(settings);
56
56
  var keys = new KeyBuilderSS(prefix, metadata);
57
57
  var wrapper = wrapperAdapter(log, options.wrapper);
58
- var connectPromise;
59
58
  var isSyncronizer = mode === undefined; // If mode is not defined, the synchronizer is running
60
59
  var isPartialConsumer = mode === CONSUMER_PARTIAL_MODE;
61
60
  var telemetry = shouldRecordTelemetry(params) || isSyncronizer ?
@@ -73,6 +72,37 @@ export function PluggableStorage(options) {
73
72
  settings.core.key === undefined ? new UniqueKeysCacheInMemory() : new UniqueKeysCacheInMemoryCS() :
74
73
  new UniqueKeysCachePluggable(log, keys.buildUniqueKeysKey(), wrapper) :
75
74
  undefined;
75
+ // Connects to wrapper and emits SDK_READY event on main client
76
+ var connectPromise = wrapper.connect().then(function () {
77
+ if (isSyncronizer) {
78
+ // In standalone or producer mode, clear storage if SDK key or feature flag filter has changed
79
+ return wrapper.get(keys.buildHashKey()).then(function (hash) {
80
+ var currentHash = getStorageHash(settings);
81
+ if (hash !== currentHash) {
82
+ log.info(LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
83
+ return wrapper.getKeysByPrefix(keys.prefix + ".").then(function (storageKeys) {
84
+ return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
85
+ }).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
86
+ }
87
+ }).then(function () {
88
+ onReadyCb();
89
+ });
90
+ }
91
+ else {
92
+ // Start periodic flush of async storages if not running synchronizer (producer mode)
93
+ if (impressionCountsCache && impressionCountsCache.start)
94
+ impressionCountsCache.start();
95
+ if (uniqueKeysCache && uniqueKeysCache.start)
96
+ uniqueKeysCache.start();
97
+ if (telemetry && telemetry.recordConfig)
98
+ telemetry.recordConfig();
99
+ onReadyCb();
100
+ }
101
+ }).catch(function (e) {
102
+ e = e || new Error('Error connecting wrapper');
103
+ onReadyCb(e);
104
+ return e; // Propagate error for shared clients
105
+ });
76
106
  return {
77
107
  splits: new SplitsCachePluggable(log, keys, wrapper, settings.sync.__splitFiltersValidation),
78
108
  segments: new SegmentsCachePluggable(log, keys, wrapper),
@@ -81,41 +111,6 @@ export function PluggableStorage(options) {
81
111
  events: isPartialConsumer ? promisifyEventsTrack(new EventsCacheInMemory(eventsQueueSize)) : new EventsCachePluggable(log, keys.buildEventsKey(), wrapper, metadata),
82
112
  telemetry: telemetry,
83
113
  uniqueKeys: uniqueKeysCache,
84
- init: function () {
85
- if (connectPromise)
86
- return connectPromise;
87
- // Connects to wrapper and emits SDK_READY event on main client
88
- return connectPromise = wrapper.connect().then(function () {
89
- if (isSyncronizer) {
90
- // In standalone or producer mode, clear storage if SDK key or feature flag filter has changed
91
- return wrapper.get(keys.buildHashKey()).then(function (hash) {
92
- var currentHash = getStorageHash(settings);
93
- if (hash !== currentHash) {
94
- log.info(LOG_PREFIX + 'Storage HASH has changed (SDK key, flags filter criteria or flags spec version was modified). Clearing cache');
95
- return wrapper.getKeysByPrefix(keys.prefix + ".").then(function (storageKeys) {
96
- return Promise.all(storageKeys.map(function (storageKey) { return wrapper.del(storageKey); }));
97
- }).then(function () { return wrapper.set(keys.buildHashKey(), currentHash); });
98
- }
99
- }).then(function () {
100
- onReadyCb();
101
- });
102
- }
103
- else {
104
- // Start periodic flush of async storages if not running synchronizer (producer mode)
105
- if (impressionCountsCache && impressionCountsCache.start)
106
- impressionCountsCache.start();
107
- if (uniqueKeysCache && uniqueKeysCache.start)
108
- uniqueKeysCache.start();
109
- if (telemetry && telemetry.recordConfig)
110
- telemetry.recordConfig();
111
- onReadyCb();
112
- }
113
- }).catch(function (e) {
114
- e = e || new Error('Error connecting wrapper');
115
- onReadyCb(e);
116
- return e; // Propagate error for shared clients
117
- });
118
- },
119
114
  // Stop periodic flush and disconnect the underlying storage
120
115
  destroy: function () {
121
116
  return Promise.all(isSyncronizer ? [] : [
@@ -125,7 +120,7 @@ export function PluggableStorage(options) {
125
120
  },
126
121
  // emits SDK_READY event on shared clients and returns a reference to the storage
127
122
  shared: function (_, onReadyCb) {
128
- this.init().then(onReadyCb);
123
+ connectPromise.then(onReadyCb);
129
124
  return __assign(__assign({}, this), {
130
125
  // no-op destroy, to disconnect the wrapper only when the main client is destroyed
131
126
  destroy: function () { } });
@@ -1,7 +1,7 @@
1
1
  import { forOwn } from '../../../utils/lang';
2
2
  import { syncTaskFactory } from '../../syncTask';
3
3
  import { CONTROL } from '../../../utils/constants';
4
- import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
4
+ import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
5
5
  import { SYNC_OFFLINE_DATA, ERROR_SYNC_OFFLINE_LOADING } from '../../../logger/constants';
6
6
  /**
7
7
  * Offline equivalent of `splitChangesUpdaterFactory`
@@ -43,8 +43,13 @@ export function fromObjectUpdaterFactory(splitsParser, storage, readiness, setti
43
43
  readiness.splits.emit(SDK_SPLITS_ARRIVED);
44
44
  if (startingUp) {
45
45
  startingUp = false;
46
- // Emits SDK_READY
47
- readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
46
+ Promise.resolve(splitsCache.checkCache()).then(function (cacheReady) {
47
+ // Emits SDK_READY_FROM_CACHE
48
+ if (cacheReady)
49
+ readiness.splits.emit(SDK_SPLITS_CACHE_LOADED);
50
+ // Emits SDK_READY
51
+ readiness.segments.emit(SDK_SEGMENTS_ARRIVED);
52
+ });
48
53
  }
49
54
  return true;
50
55
  });
@@ -1,6 +1,5 @@
1
1
  import { splitsSyncTaskFactory } from './syncTasks/splitsSyncTask';
2
2
  import { segmentsSyncTaskFactory } from './syncTasks/segmentsSyncTask';
3
- import { thenable } from '../../utils/promise/thenable';
4
3
  import { POLLING_START, POLLING_STOP, LOG_PREFIX_SYNC_POLLING } from '../../logger/constants';
5
4
  /**
6
5
  * Expose start / stop mechanism for pulling data from services.
@@ -19,9 +18,10 @@ export function pollingManagerSSFactory(params) {
19
18
  log.debug(LOG_PREFIX_SYNC_POLLING + ("Splits will be refreshed each " + settings.scheduler.featuresRefreshRate + " millis"));
20
19
  log.debug(LOG_PREFIX_SYNC_POLLING + ("Segments will be refreshed each " + settings.scheduler.segmentsRefreshRate + " millis"));
21
20
  var startingUp = splitsSyncTask.start();
22
- if (thenable(startingUp)) {
21
+ if (startingUp) {
23
22
  startingUp.then(function () {
24
- segmentsSyncTask.start();
23
+ if (splitsSyncTask.isRunning())
24
+ segmentsSyncTask.start();
25
25
  });
26
26
  }
27
27
  },
@@ -1,6 +1,5 @@
1
- import { _Set, setToArray } from '../../../utils/lang/sets';
2
1
  import { timeout } from '../../../utils/promise/timeout';
3
- import { SDK_SPLITS_ARRIVED } from '../../../readiness/constants';
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';
@@ -20,7 +19,7 @@ function checkAllSegmentsExist(segments) {
20
19
  */
21
20
  export function parseSegments(_a) {
22
21
  var conditions = _a.conditions;
23
- var segments = new _Set();
22
+ var segments = new Set();
24
23
  for (var i = 0; i < conditions.length; i++) {
25
24
  var matchers = conditions[i].matcherGroup.matchers;
26
25
  matchers.forEach(function (matcher) {
@@ -55,7 +54,7 @@ function matchFilters(featureFlag, filters) {
55
54
  * Exported for testing purposes.
56
55
  */
57
56
  export function computeSplitsMutation(entries, filters) {
58
- var segments = new _Set();
57
+ var segments = new Set();
59
58
  var computed = entries.reduce(function (accum, split) {
60
59
  if (split.status === 'ACTIVE' && matchFilters(split, filters)) {
61
60
  accum.added.push([split.name, split]);
@@ -68,7 +67,7 @@ export function computeSplitsMutation(entries, filters) {
68
67
  }
69
68
  return accum;
70
69
  }, { added: [], removed: [], segments: [] });
71
- computed.segments = setToArray(segments);
70
+ computed.segments = Array.from(segments);
72
71
  return computed;
73
72
  }
74
73
  /**
@@ -121,7 +120,7 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, seg
121
120
  function _splitChangesUpdater(since, retry) {
122
121
  if (retry === void 0) { retry = 0; }
123
122
  log.debug(SYNC_SPLITS_FETCH, [since]);
124
- return Promise.resolve(splitUpdateNotification ?
123
+ var fetcherPromise = Promise.resolve(splitUpdateNotification ?
125
124
  { splits: [splitUpdateNotification.payload], till: splitUpdateNotification.changeNumber } :
126
125
  splitChangesFetcher(since, noCache, till, _promiseDecorator))
127
126
  .then(function (splitChanges) {
@@ -165,6 +164,15 @@ export function splitChangesUpdaterFactory(log, splitChangesFetcher, splits, seg
165
164
  }
166
165
  return false;
167
166
  });
167
+ // After triggering the requests, if we have cached splits information let's notify that to emit SDK_READY_FROM_CACHE.
168
+ // Wrapping in a promise since checkCache can be async.
169
+ if (splitsEventEmitter && startingUp) {
170
+ Promise.resolve(splits.checkCache()).then(function (isCacheReady) {
171
+ if (isCacheReady)
172
+ splitsEventEmitter.emit(SDK_SPLITS_CACHE_LOADED);
173
+ });
174
+ }
175
+ return fetcherPromise;
168
176
  }
169
177
  var sincePromise = Promise.resolve(splits.getChangeNumber()); // `getChangeNumber` never rejects or throws error
170
178
  return sincePromise.then(_splitChangesUpdater);
@@ -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]);
@@ -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, whenInit, integrationsManager, telemetryCache) {
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) {
@@ -20,16 +20,14 @@ export function eventTrackerFactory(settings, eventsCache, whenInit, integration
20
20
  log.info(EVENTS_TRACKER_SUCCESS, [msg]);
21
21
  if (integrationsManager) {
22
22
  // Wrap in a timeout because we don't want it to be blocking.
23
- whenInit(function () {
24
- setTimeout(function () {
25
- // copy of event, to avoid unexpected behaviour if modified by integrations
26
- var eventDataCopy = objectAssign({}, eventData);
27
- if (properties)
28
- eventDataCopy.properties = objectAssign({}, properties);
29
- // integrationsManager does not throw errors (they are internally handled by each integration module)
30
- integrationsManager.handleEvent(eventDataCopy);
31
- });
32
- });
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, whenInit, integrationsManager, telemetryCache) {
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) {
@@ -51,20 +51,18 @@ export function impressionsTrackerFactory(settings, impressionsCache, strategy,
51
51
  sdkLanguageVersion: version
52
52
  };
53
53
  // Wrap in a timeout because we don't want it to be blocking.
54
- whenInit(function () {
55
- setTimeout(function () {
56
- // integrationsManager.handleImpression does not throw errors
57
- if (integrationsManager)
58
- integrationsManager.handleImpression(impressionData);
59
- try { // @ts-ignore. An exception on the listeners should not break the SDK.
60
- if (impressionListener)
61
- impressionListener.logImpression(impressionData);
62
- }
63
- catch (err) {
64
- log.error(ERROR_IMPRESSIONS_LISTENER, [err]);
65
- }
66
- });
67
- });
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
  }
@@ -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.