@splitsoftware/splitio-commons 1.2.1-rc.1 → 1.2.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.
Files changed (156) hide show
  1. package/cjs/evaluator/Engine.js +6 -6
  2. package/cjs/evaluator/combiners/and.js +1 -1
  3. package/cjs/evaluator/combiners/ifelseif.js +2 -2
  4. package/cjs/evaluator/condition/engineUtils.js +2 -2
  5. package/cjs/evaluator/condition/index.js +4 -4
  6. package/cjs/evaluator/index.js +5 -5
  7. package/cjs/evaluator/matchers/cont_all.js +1 -1
  8. package/cjs/evaluator/matchers/cont_any.js +1 -1
  9. package/cjs/evaluator/matchers/cont_str.js +1 -1
  10. package/cjs/evaluator/matchers/dependency.js +1 -1
  11. package/cjs/evaluator/matchers/eq_set.js +1 -1
  12. package/cjs/evaluator/matchers/ew.js +1 -1
  13. package/cjs/evaluator/matchers/part_of.js +1 -1
  14. package/cjs/evaluator/matchers/segment.js +1 -1
  15. package/cjs/evaluator/matchers/sw.js +1 -1
  16. package/cjs/evaluator/matchers/whitelist.js +1 -1
  17. package/cjs/evaluator/matchersTransform/index.js +12 -12
  18. package/cjs/evaluator/parser/index.js +6 -6
  19. package/cjs/evaluator/treatments/index.js +1 -1
  20. package/cjs/evaluator/value/index.js +1 -1
  21. package/cjs/evaluator/value/sanitize.js +4 -4
  22. package/cjs/integrations/browser.js +3 -3
  23. package/cjs/integrations/ga/GaToSplit.js +14 -14
  24. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +1 -1
  25. package/cjs/integrations/ga/SplitToGa.js +1 -1
  26. package/cjs/listeners/browser.js +1 -1
  27. package/cjs/listeners/node.js +1 -1
  28. package/cjs/logger/constants.js +3 -1
  29. package/cjs/logger/index.js +2 -2
  30. package/cjs/logger/messages/debug.js +1 -1
  31. package/cjs/logger/messages/error.js +1 -1
  32. package/cjs/logger/messages/info.js +1 -1
  33. package/cjs/logger/messages/warn.js +1 -1
  34. package/cjs/logger/sdkLogger.js +1 -1
  35. package/cjs/readiness/readinessManager.js +2 -2
  36. package/cjs/readiness/sdkReadinessManager.js +4 -4
  37. package/cjs/sdkClient/client.js +9 -9
  38. package/cjs/sdkClient/clientAttributesDecoration.js +4 -4
  39. package/cjs/sdkClient/clientCS.js +2 -2
  40. package/cjs/sdkClient/clientInputValidation.js +14 -14
  41. package/cjs/sdkClient/sdkClient.js +3 -3
  42. package/cjs/sdkClient/sdkClientMethod.js +1 -1
  43. package/cjs/sdkClient/sdkClientMethodCS.js +6 -6
  44. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +8 -8
  45. package/cjs/sdkFactory/index.js +8 -8
  46. package/cjs/sdkManager/index.js +11 -11
  47. package/cjs/services/splitApi.js +3 -2
  48. package/cjs/services/splitHttpClient.js +2 -2
  49. package/cjs/storages/KeyBuilder.js +2 -2
  50. package/cjs/storages/KeyBuilderCS.js +2 -2
  51. package/cjs/storages/KeyBuilderSS.js +1 -1
  52. package/cjs/storages/findLatencyIndex.js +1 -1
  53. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -1
  54. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +12 -12
  55. package/cjs/storages/inLocalStorage/index.js +3 -3
  56. package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
  57. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  58. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +1 -1
  59. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
  60. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -2
  61. package/cjs/storages/inMemory/SplitsCacheInMemory.js +5 -5
  62. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +1 -1
  63. package/cjs/storages/inRedis/RedisAdapter.js +16 -10
  64. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +1 -1
  65. package/cjs/storages/inRedis/SplitsCacheInRedis.js +3 -3
  66. package/cjs/storages/inRedis/index.js +1 -1
  67. package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
  68. package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
  69. package/cjs/storages/pluggable/inMemoryWrapper.js +4 -4
  70. package/cjs/storages/pluggable/index.js +4 -4
  71. package/cjs/sync/offline/LocalhostFromFile.js +1 -1
  72. package/cjs/sync/offline/LocalhostFromObject.js +1 -1
  73. package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
  74. package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +13 -13
  75. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +3 -3
  76. package/cjs/sync/offline/syncManagerOffline.js +1 -1
  77. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
  78. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  79. package/cjs/sync/polling/pollingManagerCS.js +6 -6
  80. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  81. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
  82. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +1 -1
  83. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  84. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +1 -1
  85. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  86. package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -2
  87. package/cjs/sync/streaming/AuthClient/index.js +3 -3
  88. package/cjs/sync/streaming/SSEHandler/NotificationParser.js +1 -1
  89. package/cjs/sync/streaming/SSEHandler/index.js +3 -3
  90. package/cjs/sync/streaming/mySegmentsV2utils.js +1 -1
  91. package/cjs/sync/streaming/pushManager.js +15 -15
  92. package/cjs/sync/submitters/eventsSyncTask.js +1 -1
  93. package/cjs/sync/submitters/impressionCountsSyncTask.js +1 -1
  94. package/cjs/sync/submitters/impressionsSyncTask.js +3 -3
  95. package/cjs/sync/submitters/metricsSyncTask.js +3 -3
  96. package/cjs/sync/submitters/submitterManager.js +4 -4
  97. package/cjs/sync/submitters/submitterSyncTask.js +1 -1
  98. package/cjs/sync/syncManagerOnline.js +1 -1
  99. package/cjs/trackers/eventTracker.js +3 -3
  100. package/cjs/trackers/impressionObserver/impressionObserverCS.js +1 -1
  101. package/cjs/trackers/impressionObserver/impressionObserverSS.js +1 -1
  102. package/cjs/trackers/impressionsTracker.js +3 -3
  103. package/cjs/utils/MinEvents.js +2 -1
  104. package/cjs/utils/inputValidation/apiKey.js +1 -1
  105. package/cjs/utils/inputValidation/attribute.js +4 -4
  106. package/cjs/utils/inputValidation/attributes.js +2 -2
  107. package/cjs/utils/inputValidation/event.js +1 -1
  108. package/cjs/utils/inputValidation/eventProperties.js +5 -5
  109. package/cjs/utils/inputValidation/eventValue.js +1 -1
  110. package/cjs/utils/inputValidation/key.js +6 -5
  111. package/cjs/utils/inputValidation/preloadedData.js +8 -8
  112. package/cjs/utils/inputValidation/split.js +1 -1
  113. package/cjs/utils/inputValidation/splits.js +2 -2
  114. package/cjs/utils/inputValidation/trafficType.js +1 -1
  115. package/cjs/utils/inputValidation/trafficTypeExistance.js +1 -1
  116. package/cjs/utils/jwt/index.js +1 -1
  117. package/cjs/utils/key/index.js +3 -3
  118. package/cjs/utils/lang/index.js +1 -1
  119. package/cjs/utils/murmur3/common.js +1 -1
  120. package/cjs/utils/murmur3/murmur3.js +10 -10
  121. package/cjs/utils/murmur3/murmur3_128.js +1 -1
  122. package/cjs/utils/murmur3/murmur3_128_x86.js +37 -37
  123. package/cjs/utils/murmur3/murmur3_64.js +1 -1
  124. package/cjs/utils/settingsValidation/index.js +5 -10
  125. package/cjs/utils/settingsValidation/integrations/configurable.js +1 -1
  126. package/cjs/utils/settingsValidation/integrations/pluggable.js +1 -1
  127. package/cjs/utils/settingsValidation/localhost/builtin.js +2 -2
  128. package/cjs/utils/settingsValidation/logger/builtinLogger.js +3 -3
  129. package/cjs/utils/settingsValidation/logger/commons.js +1 -1
  130. package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  131. package/cjs/utils/settingsValidation/runtime/browser.js +10 -0
  132. package/cjs/utils/settingsValidation/runtime/node.js +22 -0
  133. package/cjs/utils/settingsValidation/splitFilters.js +1 -1
  134. package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
  135. package/cjs/utils/timeTracker/index.js +3 -3
  136. package/esm/services/splitApi.js +2 -1
  137. package/esm/storages/inRedis/RedisAdapter.js +7 -1
  138. package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
  139. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +2 -2
  140. package/esm/utils/inputValidation/key.js +2 -1
  141. package/esm/utils/lang/index.js +2 -2
  142. package/esm/utils/settingsValidation/index.js +1 -6
  143. package/esm/utils/settingsValidation/runtime/browser.js +6 -0
  144. package/esm/utils/settingsValidation/runtime/node.js +17 -0
  145. package/package.json +9 -8
  146. package/src/logger/types.ts +4 -0
  147. package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
  148. package/src/utils/settingsValidation/index.ts +1 -6
  149. package/src/utils/settingsValidation/runtime/browser.ts +6 -0
  150. package/src/utils/settingsValidation/runtime/node.ts +22 -0
  151. package/src/utils/settingsValidation/types.ts +6 -6
  152. package/types/logger/types.d.ts +4 -0
  153. package/types/sdkClient/clientAttributesDecoration.d.ts +1 -1
  154. package/types/utils/settingsValidation/runtime/browser.d.ts +4 -0
  155. package/types/utils/settingsValidation/runtime/node.d.ts +5 -0
  156. package/types/utils/settingsValidation/types.d.ts +6 -6
@@ -9,11 +9,11 @@ function validateKeyValue(log, maybeKey, method, type) {
9
9
  log.error(constants_1.ERROR_NULL, [method, type]);
10
10
  return false;
11
11
  }
12
- if (lang_1.isFiniteNumber(maybeKey)) {
12
+ if ((0, lang_1.isFiniteNumber)(maybeKey)) {
13
13
  log.warn(constants_1.WARN_CONVERTING, [method, type, maybeKey]);
14
- return lang_1.toString(maybeKey);
14
+ return (0, lang_1.toString)(maybeKey);
15
15
  }
16
- if (lang_1.isString(maybeKey)) {
16
+ if ((0, lang_1.isString)(maybeKey)) {
17
17
  // It's a string, start by trimming the value.
18
18
  maybeKey = maybeKey.trim();
19
19
  // It's aaaaaall good.
@@ -32,13 +32,14 @@ function validateKeyValue(log, maybeKey, method, type) {
32
32
  return false;
33
33
  }
34
34
  function validateKey(log, maybeKey, method) {
35
- if (lang_1.isObject(maybeKey)) {
35
+ if ((0, lang_1.isObject)(maybeKey)) {
36
36
  // Validate key object
37
37
  var matchingKey = validateKeyValue(log, maybeKey.matchingKey, method, 'matchingKey');
38
38
  var bucketingKey = validateKeyValue(log, maybeKey.bucketingKey, method, 'bucketingKey');
39
39
  if (matchingKey && bucketingKey)
40
40
  return {
41
- matchingKey: matchingKey, bucketingKey: bucketingKey
41
+ matchingKey: matchingKey,
42
+ bucketingKey: bucketingKey
42
43
  };
43
44
  log.error(constants_1.ERROR_INVALID_KEY_OBJECT, [method]);
44
45
  return false;
@@ -4,30 +4,30 @@ exports.validatePreloadedData = void 0;
4
4
  var lang_1 = require("../lang");
5
5
  var split_1 = require("./split");
6
6
  function validateTimestampData(log, maybeTimestamp, method, item) {
7
- if (lang_1.isFiniteNumber(maybeTimestamp) && maybeTimestamp > -1)
7
+ if ((0, lang_1.isFiniteNumber)(maybeTimestamp) && maybeTimestamp > -1)
8
8
  return true;
9
9
  log.error(method + ": preloadedData." + item + " must be a positive number.");
10
10
  return false;
11
11
  }
12
12
  function validateSplitsData(log, maybeSplitsData, method) {
13
- if (lang_1.isObject(maybeSplitsData)) {
13
+ if ((0, lang_1.isObject)(maybeSplitsData)) {
14
14
  var splitNames = Object.keys(maybeSplitsData);
15
15
  if (splitNames.length === 0)
16
16
  log.warn(method + ": preloadedData.splitsData doesn't contain split definitions.");
17
17
  // @TODO in the future, consider handling the possibility of having parsed definitions of splits
18
- if (splitNames.every(function (splitName) { return split_1.validateSplit(log, splitName, method) && lang_1.isString(maybeSplitsData[splitName]); }))
18
+ if (splitNames.every(function (splitName) { return (0, split_1.validateSplit)(log, splitName, method) && (0, lang_1.isString)(maybeSplitsData[splitName]); }))
19
19
  return true;
20
20
  }
21
21
  log.error(method + ": preloadedData.splitsData must be a map of split names to their serialized definitions.");
22
22
  return false;
23
23
  }
24
24
  function validateMySegmentsData(log, maybeMySegmentsData, method) {
25
- if (lang_1.isObject(maybeMySegmentsData)) {
25
+ if ((0, lang_1.isObject)(maybeMySegmentsData)) {
26
26
  var userKeys = Object.keys(maybeMySegmentsData);
27
27
  if (userKeys.every(function (userKey) {
28
28
  var segmentNames = maybeMySegmentsData[userKey];
29
29
  // an empty list is valid
30
- return Array.isArray(segmentNames) && segmentNames.every(function (segmentName) { return lang_1.isString(segmentName); });
30
+ return Array.isArray(segmentNames) && segmentNames.every(function (segmentName) { return (0, lang_1.isString)(segmentName); });
31
31
  }))
32
32
  return true;
33
33
  }
@@ -35,16 +35,16 @@ function validateMySegmentsData(log, maybeMySegmentsData, method) {
35
35
  return false;
36
36
  }
37
37
  function validateSegmentsData(log, maybeSegmentsData, method) {
38
- if (lang_1.isObject(maybeSegmentsData)) {
38
+ if ((0, lang_1.isObject)(maybeSegmentsData)) {
39
39
  var segmentNames = Object.keys(maybeSegmentsData);
40
- if (segmentNames.every(function (segmentName) { return lang_1.isString(maybeSegmentsData[segmentName]); }))
40
+ if (segmentNames.every(function (segmentName) { return (0, lang_1.isString)(maybeSegmentsData[segmentName]); }))
41
41
  return true;
42
42
  }
43
43
  log.error(method + ": preloadedData.segmentsData must be a map of segment names to their serialized definitions.");
44
44
  return false;
45
45
  }
46
46
  function validatePreloadedData(log, maybePreloadedData, method) {
47
- if (!lang_1.isObject(maybePreloadedData)) {
47
+ if (!(0, lang_1.isObject)(maybePreloadedData)) {
48
48
  log.error(method + ": preloadedData must be an object.");
49
49
  }
50
50
  else if (validateTimestampData(log, maybePreloadedData.lastUpdated, method, 'lastUpdated') &&
@@ -10,7 +10,7 @@ function validateSplit(log, maybeSplit, method, item) {
10
10
  if (maybeSplit == undefined) { // eslint-disable-line eqeqeq
11
11
  log.error(constants_1.ERROR_NULL, [method, item]);
12
12
  }
13
- else if (!lang_1.isString(maybeSplit)) {
13
+ else if (!(0, lang_1.isString)(maybeSplit)) {
14
14
  log.error(constants_1.ERROR_INVALID, [method, item]);
15
15
  }
16
16
  else {
@@ -11,13 +11,13 @@ function validateSplits(log, maybeSplits, method, listName, item) {
11
11
  var validatedArray_1 = [];
12
12
  // Remove invalid values
13
13
  maybeSplits.forEach(function (maybeSplit) {
14
- var splitName = split_1.validateSplit(log, maybeSplit, method, item);
14
+ var splitName = (0, split_1.validateSplit)(log, maybeSplit, method, item);
15
15
  if (splitName)
16
16
  validatedArray_1.push(splitName);
17
17
  });
18
18
  // Strip off duplicated values if we have valid split names then return
19
19
  if (validatedArray_1.length)
20
- return lang_1.uniq(validatedArray_1);
20
+ return (0, lang_1.uniq)(validatedArray_1);
21
21
  }
22
22
  log.error(constants_1.ERROR_EMPTY_ARRAY, [method, listName]);
23
23
  return false;
@@ -9,7 +9,7 @@ function validateTrafficType(log, maybeTT, method) {
9
9
  if (maybeTT == undefined) { // eslint-disable-line eqeqeq
10
10
  log.error(constants_1.ERROR_NULL, [method, item]);
11
11
  }
12
- else if (!lang_1.isString(maybeTT)) {
12
+ else if (!(0, lang_1.isString)(maybeTT)) {
13
13
  log.error(constants_1.ERROR_INVALID, [method, item]);
14
14
  }
15
15
  else {
@@ -15,7 +15,7 @@ function validateTrafficTypeExistance(log, readinessManager, splitsCache, mode,
15
15
  if (!readinessManager.isReady() || mode === constants_1.LOCALHOST_MODE)
16
16
  return true;
17
17
  var res = splitsCache.trafficTypeExists(maybeTT); // never rejects or throws error
18
- if (thenable_1.thenable(res)) {
18
+ if ((0, thenable_1.thenable)(res)) {
19
19
  return res.then(function (isValid) {
20
20
  if (!isValid)
21
21
  logTTExistanceWarning(log, maybeTT, method);
@@ -9,7 +9,7 @@ function decodeJWTtoken(token) {
9
9
  var base64Url = token.split('.')[1];
10
10
  var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
11
11
  // no need to check availability of `encodeURIComponent`, since it is a function highly supported in browsers, node and other platforms.
12
- var jsonPayload = decodeURIComponent(base64_1.decodeFromBase64(base64).split('').map(function (c) {
12
+ var jsonPayload = decodeURIComponent((0, base64_1.decodeFromBase64)(base64).split('').map(function (c) {
13
13
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
14
14
  }).join(''));
15
15
  return JSON.parse(jsonPayload);
@@ -7,12 +7,12 @@ var lang_1 = require("../lang");
7
7
  // }
8
8
  // returns the matchingKey if the Key is defined as an object or the key itself if it is a string
9
9
  function getMatching(key) {
10
- return lang_1.isObject(key) ? key.matchingKey : key;
10
+ return (0, lang_1.isObject)(key) ? key.matchingKey : key;
11
11
  }
12
12
  exports.getMatching = getMatching;
13
13
  // if the key is a string, there's no bucketingKey (undefined)
14
14
  function getBucketing(key) {
15
- return lang_1.isObject(key) ? key.bucketingKey : undefined;
15
+ return (0, lang_1.isObject)(key) ? key.bucketingKey : undefined;
16
16
  }
17
17
  exports.getBucketing = getBucketing;
18
18
  /**
@@ -20,7 +20,7 @@ exports.getBucketing = getBucketing;
20
20
  * specific split.
21
21
  */
22
22
  function keyParser(key) {
23
- if (lang_1.isObject(key)) {
23
+ if ((0, lang_1.isObject)(key)) {
24
24
  return {
25
25
  matchingKey: key.matchingKey,
26
26
  bucketingKey: key.bucketingKey
@@ -194,7 +194,7 @@ function merge(target, source) {
194
194
  });
195
195
  if (rest && rest.length) {
196
196
  var nextSource = rest.splice(0, 1)[0];
197
- res = merge.apply(void 0, tslib_1.__spreadArrays([res, nextSource], rest));
197
+ res = merge.apply(void 0, (0, tslib_1.__spreadArray)([res, nextSource], rest, false));
198
198
  }
199
199
  return res;
200
200
  }
@@ -4,7 +4,7 @@ exports.x86Fmix = exports.x86Rotl = exports.x86Multiply = exports.UTF16ToUTF8 =
4
4
  var utfx_1 = require("./utfx");
5
5
  function UTF16ToUTF8(key) {
6
6
  var sd;
7
- utfx_1.encodeUTF16toUTF8(utfx_1.stringSource(key), sd = utfx_1.stringDestination());
7
+ (0, utfx_1.encodeUTF16toUTF8)((0, utfx_1.stringSource)(key), sd = (0, utfx_1.stringDestination)());
8
8
  return sd();
9
9
  }
10
10
  exports.UTF16ToUTF8 = UTF16ToUTF8;
@@ -28,12 +28,12 @@ function hash32(key, seed) {
28
28
  var c2 = 0x1b873593;
29
29
  for (var i = 0; i < bytes; i = i + 4) {
30
30
  k1 = ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24);
31
- k1 = common_1.x86Multiply(k1, c1);
32
- k1 = common_1.x86Rotl(k1, 15);
33
- k1 = common_1.x86Multiply(k1, c2);
31
+ k1 = (0, common_1.x86Multiply)(k1, c1);
32
+ k1 = (0, common_1.x86Rotl)(k1, 15);
33
+ k1 = (0, common_1.x86Multiply)(k1, c2);
34
34
  h1 ^= k1;
35
- h1 = common_1.x86Rotl(h1, 13);
36
- h1 = common_1.x86Multiply(h1, 5) + 0xe6546b64;
35
+ h1 = (0, common_1.x86Rotl)(h1, 13);
36
+ h1 = (0, common_1.x86Multiply)(h1, 5) + 0xe6546b64;
37
37
  }
38
38
  k1 = 0;
39
39
  switch (remainder) {
@@ -43,17 +43,17 @@ function hash32(key, seed) {
43
43
  k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
44
44
  case 1:
45
45
  k1 ^= (key.charCodeAt(i) & 0xff);
46
- k1 = common_1.x86Multiply(k1, c1);
47
- k1 = common_1.x86Rotl(k1, 15);
48
- k1 = common_1.x86Multiply(k1, c2);
46
+ k1 = (0, common_1.x86Multiply)(k1, c1);
47
+ k1 = (0, common_1.x86Rotl)(k1, 15);
48
+ k1 = (0, common_1.x86Multiply)(k1, c2);
49
49
  h1 ^= k1;
50
50
  }
51
51
  h1 ^= key.length;
52
- h1 = common_1.x86Fmix(h1);
52
+ h1 = (0, common_1.x86Fmix)(h1);
53
53
  return h1 >>> 0;
54
54
  }
55
55
  function hash(str, seed) {
56
- return hash32(common_1.UTF16ToUTF8(str), seed >>> 0);
56
+ return hash32((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
57
57
  }
58
58
  exports.hash = hash;
59
59
  function bucket(str, seed) {
@@ -214,6 +214,6 @@ function hash128x64(key, seed) {
214
214
  * @param {string} str
215
215
  */
216
216
  function hash128(str, seed) {
217
- return hash128x64(common_1.UTF16ToUTF8(str), seed >>> 0);
217
+ return hash128x64((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
218
218
  }
219
219
  exports.hash128 = hash128;
@@ -39,34 +39,34 @@ function hash128x86(key, seed) {
39
39
  k2 = ((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24);
40
40
  k3 = ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24);
41
41
  k4 = ((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24);
42
- k1 = common_1.x86Multiply(k1, c1);
43
- k1 = common_1.x86Rotl(k1, 15);
44
- k1 = common_1.x86Multiply(k1, c2);
42
+ k1 = (0, common_1.x86Multiply)(k1, c1);
43
+ k1 = (0, common_1.x86Rotl)(k1, 15);
44
+ k1 = (0, common_1.x86Multiply)(k1, c2);
45
45
  h1 ^= k1;
46
- h1 = common_1.x86Rotl(h1, 19);
46
+ h1 = (0, common_1.x86Rotl)(h1, 19);
47
47
  h1 += h2;
48
- h1 = common_1.x86Multiply(h1, 5) + 0x561ccd1b;
49
- k2 = common_1.x86Multiply(k2, c2);
50
- k2 = common_1.x86Rotl(k2, 16);
51
- k2 = common_1.x86Multiply(k2, c3);
48
+ h1 = (0, common_1.x86Multiply)(h1, 5) + 0x561ccd1b;
49
+ k2 = (0, common_1.x86Multiply)(k2, c2);
50
+ k2 = (0, common_1.x86Rotl)(k2, 16);
51
+ k2 = (0, common_1.x86Multiply)(k2, c3);
52
52
  h2 ^= k2;
53
- h2 = common_1.x86Rotl(h2, 17);
53
+ h2 = (0, common_1.x86Rotl)(h2, 17);
54
54
  h2 += h3;
55
- h2 = common_1.x86Multiply(h2, 5) + 0x0bcaa747;
56
- k3 = common_1.x86Multiply(k3, c3);
57
- k3 = common_1.x86Rotl(k3, 17);
58
- k3 = common_1.x86Multiply(k3, c4);
55
+ h2 = (0, common_1.x86Multiply)(h2, 5) + 0x0bcaa747;
56
+ k3 = (0, common_1.x86Multiply)(k3, c3);
57
+ k3 = (0, common_1.x86Rotl)(k3, 17);
58
+ k3 = (0, common_1.x86Multiply)(k3, c4);
59
59
  h3 ^= k3;
60
- h3 = common_1.x86Rotl(h3, 15);
60
+ h3 = (0, common_1.x86Rotl)(h3, 15);
61
61
  h3 += h4;
62
- h3 = common_1.x86Multiply(h3, 5) + 0x96cd1c35;
63
- k4 = common_1.x86Multiply(k4, c4);
64
- k4 = common_1.x86Rotl(k4, 18);
65
- k4 = common_1.x86Multiply(k4, c1);
62
+ h3 = (0, common_1.x86Multiply)(h3, 5) + 0x96cd1c35;
63
+ k4 = (0, common_1.x86Multiply)(k4, c4);
64
+ k4 = (0, common_1.x86Rotl)(k4, 18);
65
+ k4 = (0, common_1.x86Multiply)(k4, c1);
66
66
  h4 ^= k4;
67
- h4 = common_1.x86Rotl(h4, 13);
67
+ h4 = (0, common_1.x86Rotl)(h4, 13);
68
68
  h4 += h1;
69
- h4 = common_1.x86Multiply(h4, 5) + 0x32ac3b17;
69
+ h4 = (0, common_1.x86Multiply)(h4, 5) + 0x32ac3b17;
70
70
  }
71
71
  k1 = 0;
72
72
  k2 = 0;
@@ -79,9 +79,9 @@ function hash128x86(key, seed) {
79
79
  k4 ^= key.charCodeAt(i + 13) << 8;
80
80
  case 13:
81
81
  k4 ^= key.charCodeAt(i + 12);
82
- k4 = common_1.x86Multiply(k4, c4);
83
- k4 = common_1.x86Rotl(k4, 18);
84
- k4 = common_1.x86Multiply(k4, c1);
82
+ k4 = (0, common_1.x86Multiply)(k4, c4);
83
+ k4 = (0, common_1.x86Rotl)(k4, 18);
84
+ k4 = (0, common_1.x86Multiply)(k4, c1);
85
85
  h4 ^= k4;
86
86
  case 12:
87
87
  k3 ^= key.charCodeAt(i + 11) << 24;
@@ -91,9 +91,9 @@ function hash128x86(key, seed) {
91
91
  k3 ^= key.charCodeAt(i + 9) << 8;
92
92
  case 9:
93
93
  k3 ^= key.charCodeAt(i + 8);
94
- k3 = common_1.x86Multiply(k3, c3);
95
- k3 = common_1.x86Rotl(k3, 17);
96
- k3 = common_1.x86Multiply(k3, c4);
94
+ k3 = (0, common_1.x86Multiply)(k3, c3);
95
+ k3 = (0, common_1.x86Rotl)(k3, 17);
96
+ k3 = (0, common_1.x86Multiply)(k3, c4);
97
97
  h3 ^= k3;
98
98
  case 8:
99
99
  k2 ^= key.charCodeAt(i + 7) << 24;
@@ -103,9 +103,9 @@ function hash128x86(key, seed) {
103
103
  k2 ^= key.charCodeAt(i + 5) << 8;
104
104
  case 5:
105
105
  k2 ^= key.charCodeAt(i + 4);
106
- k2 = common_1.x86Multiply(k2, c2);
107
- k2 = common_1.x86Rotl(k2, 16);
108
- k2 = common_1.x86Multiply(k2, c3);
106
+ k2 = (0, common_1.x86Multiply)(k2, c2);
107
+ k2 = (0, common_1.x86Rotl)(k2, 16);
108
+ k2 = (0, common_1.x86Multiply)(k2, c3);
109
109
  h2 ^= k2;
110
110
  case 4:
111
111
  k1 ^= key.charCodeAt(i + 3) << 24;
@@ -115,9 +115,9 @@ function hash128x86(key, seed) {
115
115
  k1 ^= key.charCodeAt(i + 1) << 8;
116
116
  case 1:
117
117
  k1 ^= key.charCodeAt(i);
118
- k1 = common_1.x86Multiply(k1, c1);
119
- k1 = common_1.x86Rotl(k1, 15);
120
- k1 = common_1.x86Multiply(k1, c2);
118
+ k1 = (0, common_1.x86Multiply)(k1, c1);
119
+ k1 = (0, common_1.x86Rotl)(k1, 15);
120
+ k1 = (0, common_1.x86Multiply)(k1, c2);
121
121
  h1 ^= k1;
122
122
  }
123
123
  h1 ^= key.length;
@@ -130,10 +130,10 @@ function hash128x86(key, seed) {
130
130
  h2 += h1;
131
131
  h3 += h1;
132
132
  h4 += h1;
133
- h1 = common_1.x86Fmix(h1);
134
- h2 = common_1.x86Fmix(h2);
135
- h3 = common_1.x86Fmix(h3);
136
- h4 = common_1.x86Fmix(h4);
133
+ h1 = (0, common_1.x86Fmix)(h1);
134
+ h2 = (0, common_1.x86Fmix)(h2);
135
+ h3 = (0, common_1.x86Fmix)(h3);
136
+ h4 = (0, common_1.x86Fmix)(h4);
137
137
  h1 += h2;
138
138
  h1 += h3;
139
139
  h1 += h4;
@@ -149,6 +149,6 @@ function hash128x86(key, seed) {
149
149
  * @param {string} str
150
150
  */
151
151
  function hash128(str, seed) {
152
- return hash128x86(common_1.UTF16ToUTF8(str), seed >>> 0);
152
+ return hash128x86((0, common_1.UTF16ToUTF8)(str), seed >>> 0);
153
153
  }
154
154
  exports.hash128 = hash128;
@@ -27,7 +27,7 @@ function hex2dec(s) {
27
27
  * @param {string} str
28
28
  */
29
29
  function hash64(str) {
30
- var hex = murmur3_128_1.hash128(str).slice(0, 16);
30
+ var hex = (0, murmur3_128_1.hash128)(str).slice(0, 16);
31
31
  return {
32
32
  hex: hex,
33
33
  dec: hex2dec(hex) // KeyList notification
@@ -67,10 +67,6 @@ var base = {
67
67
  impressionsMode: constants_1.OPTIMIZED,
68
68
  localhostMode: undefined
69
69
  },
70
- runtime: {
71
- ip: false,
72
- hostname: false
73
- },
74
70
  // Logger
75
71
  log: undefined
76
72
  };
@@ -87,7 +83,7 @@ function fromSecondsToMillis(n) {
87
83
  function settingsValidation(config, validationParams) {
88
84
  var defaults = validationParams.defaults, runtime = validationParams.runtime, storage = validationParams.storage, integrations = validationParams.integrations, logger = validationParams.logger, localhost = validationParams.localhost;
89
85
  // creates a settings object merging base, defaults and config objects.
90
- var withDefaults = lang_1.merge({}, base, defaults, config);
86
+ var withDefaults = (0, lang_1.merge)({}, base, defaults, config);
91
87
  // ensure a valid logger.
92
88
  // First thing to validate, since other validators might use the logger.
93
89
  var log = logger(withDefaults); // @ts-ignore, modify readonly prop
@@ -106,7 +102,7 @@ function settingsValidation(config, validationParams) {
106
102
  startup.eventsFirstPushWindow = fromSecondsToMillis(startup.eventsFirstPushWindow);
107
103
  // ensure a valid SDK mode
108
104
  // @ts-ignore, modify readonly prop
109
- withDefaults.mode = mode_1.mode(withDefaults.core.authorizationKey, withDefaults.mode);
105
+ withDefaults.mode = (0, mode_1.mode)(withDefaults.core.authorizationKey, withDefaults.mode);
110
106
  // ensure a valid Storage based on mode defined.
111
107
  // @ts-ignore, modify readonly prop
112
108
  if (storage)
@@ -117,8 +113,7 @@ function settingsValidation(config, validationParams) {
117
113
  }
118
114
  // Current ip/hostname information
119
115
  // @ts-ignore, modify readonly prop
120
- if (runtime)
121
- withDefaults.runtime = runtime(withDefaults);
116
+ withDefaults.runtime = runtime(withDefaults);
122
117
  // ensure a valid list of integrations.
123
118
  // `integrations` returns an array of valid integration items.
124
119
  // @ts-ignore, modify readonly prop
@@ -134,11 +129,11 @@ function settingsValidation(config, validationParams) {
134
129
  scheduler.pushRetryBackoffBase = fromSecondsToMillis(scheduler.pushRetryBackoffBase);
135
130
  }
136
131
  // validate the `splitFilters` settings and parse splits query
137
- var splitFiltersValidation = splitFilters_1.validateSplitFilters(log, withDefaults.sync.splitFilters, withDefaults.mode);
132
+ var splitFiltersValidation = (0, splitFilters_1.validateSplitFilters)(log, withDefaults.sync.splitFilters, withDefaults.mode);
138
133
  withDefaults.sync.splitFilters = splitFiltersValidation.validFilters;
139
134
  withDefaults.sync.__splitFiltersValidation = splitFiltersValidation;
140
135
  // ensure a valid impressionsMode
141
- withDefaults.sync.impressionsMode = impressionsMode_1.validImpressionsMode(log, withDefaults.sync.impressionsMode);
136
+ withDefaults.sync.impressionsMode = (0, impressionsMode_1.validImpressionsMode)(log, withDefaults.sync.impressionsMode);
142
137
  return withDefaults;
143
138
  }
144
139
  exports.settingsValidation = settingsValidation;
@@ -13,6 +13,6 @@ var lang_1 = require("../../lang");
13
13
  */
14
14
  function validateConfigurableIntegrations(settings, validIntegrationTypes) {
15
15
  if (validIntegrationTypes === void 0) { validIntegrationTypes = []; }
16
- return common_1.validateIntegrations(settings, function (integration) { return integration && lang_1.isString(integration.type) && validIntegrationTypes.indexOf(integration.type) > -1; }, 'Integration items must have a valid "type" value');
16
+ return (0, common_1.validateIntegrations)(settings, function (integration) { return integration && (0, lang_1.isString)(integration.type) && validIntegrationTypes.indexOf(integration.type) > -1; }, 'Integration items must have a valid "type" value');
17
17
  }
18
18
  exports.validateConfigurableIntegrations = validateConfigurableIntegrations;
@@ -10,6 +10,6 @@ var common_1 = require("./common");
10
10
  * @returns {Array} array of valid integration factories. The array might be empty if `settings` object does not have valid integrations.
11
11
  */
12
12
  function validatePluggableIntegrations(settings) {
13
- return common_1.validateIntegrations(settings, function (integration) { return typeof integration === 'function'; }, 'Integration items must be functions that initialize the integrations');
13
+ return (0, common_1.validateIntegrations)(settings, function (integration) { return typeof integration === 'function'; }, 'Integration items must be functions that initialize the integrations');
14
14
  }
15
15
  exports.validatePluggableIntegrations = validatePluggableIntegrations;
@@ -12,7 +12,7 @@ var pluggable_1 = require("./pluggable");
12
12
  */
13
13
  function validateLocalhostWithDefault(settings) {
14
14
  if (!settings.sync.localhostMode)
15
- return LocalhostFromObject_1.LocalhostFromObject();
16
- return pluggable_1.validateLocalhost(settings) || LocalhostFromObject_1.LocalhostFromObject();
15
+ return (0, LocalhostFromObject_1.LocalhostFromObject)();
16
+ return (0, pluggable_1.validateLocalhost)(settings) || (0, LocalhostFromObject_1.LocalhostFromObject)();
17
17
  }
18
18
  exports.validateLocalhostWithDefault = validateLocalhostWithDefault;
@@ -19,14 +19,14 @@ var ENV_VAR_KEY = 'SPLITIO_DEBUG';
19
19
  */
20
20
  var initialState = String(
21
21
  // eslint-disable-next-line no-undef
22
- isNode_1.isNode ? process.env[ENV_VAR_KEY] : isLocalStorageAvailable_1.isLocalStorageAvailable() ? localStorage.getItem(LS_KEY) : '');
22
+ isNode_1.isNode ? process.env[ENV_VAR_KEY] : (0, isLocalStorageAvailable_1.isLocalStorageAvailable)() ? localStorage.getItem(LS_KEY) : '');
23
23
  // By default it starts disabled.
24
24
  var initialLogLevel = logger_1.LogLevels.NONE;
25
25
  // Kept to avoid a breaking change ('on', 'enable' and 'enabled' are equivalent)
26
26
  if (/^(enabled?|on)/i.test(initialState)) {
27
27
  initialLogLevel = logger_1.LogLevels.DEBUG;
28
28
  }
29
- else if (logger_1.isLogLevelString(initialState)) {
29
+ else if ((0, logger_1.isLogLevelString)(initialState)) {
30
30
  initialLogLevel = initialState;
31
31
  }
32
32
  /**
@@ -37,7 +37,7 @@ else if (logger_1.isLogLevelString(initialState)) {
37
37
  */
38
38
  function validateLogger(settings) {
39
39
  var debug = settings.debug;
40
- var logLevel = debug !== undefined ? commons_1.getLogLevel(debug) : initialLogLevel;
40
+ var logLevel = debug !== undefined ? (0, commons_1.getLogLevel)(debug) : initialLogLevel;
41
41
  var log = new logger_1.Logger({ logLevel: logLevel || initialLogLevel }, allCodes);
42
42
  // @ts-ignore // if logLevel is undefined at this point, it means that settings `debug` value is invalid
43
43
  if (!logLevel)
@@ -18,7 +18,7 @@ function getLogLevel(debugValue) {
18
18
  return logger_1.LogLevels.NONE;
19
19
  }
20
20
  }
21
- else if (typeof debugValue === 'string' && logger_1.isLogLevelString(debugValue)) {
21
+ else if (typeof debugValue === 'string' && (0, logger_1.isLogLevelString)(debugValue)) {
22
22
  return debugValue;
23
23
  }
24
24
  else {
@@ -21,7 +21,7 @@ function validateLogger(settings) {
21
21
  if (debug !== undefined) {
22
22
  if (isLogger(debug))
23
23
  return debug;
24
- logLevel = commons_1.getLogLevel(settings.debug);
24
+ logLevel = (0, commons_1.getLogLevel)(settings.debug);
25
25
  }
26
26
  var log = new logger_1.Logger({ logLevel: logLevel || initialLogLevel });
27
27
  // @ts-ignore // `debug` value is invalid if logLevel is undefined at this point
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRuntime = void 0;
4
+ function validateRuntime() {
5
+ return {
6
+ ip: false,
7
+ hostname: false
8
+ };
9
+ }
10
+ exports.validateRuntime = validateRuntime;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRuntime = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var os_1 = (0, tslib_1.__importDefault)(require("os"));
6
+ var ip_1 = (0, tslib_1.__importDefault)(require("ip"));
7
+ var constants_1 = require("../../constants");
8
+ function validateRuntime(settings) {
9
+ var isIPAddressesEnabled = settings.core.IPAddressesEnabled === true;
10
+ var isConsumerMode = settings.mode === constants_1.CONSUMER_MODE;
11
+ // If the values are not available, default to false (for standalone) or "unknown" (for consumer mode, to be used on Redis keys)
12
+ var ip = ip_1.default.address() || (isConsumerMode ? constants_1.UNKNOWN : false);
13
+ var hostname = os_1.default.hostname() || (isConsumerMode ? constants_1.UNKNOWN : false);
14
+ if (!isIPAddressesEnabled) { // If IPAddresses setting is not enabled, set as false (for standalone) or "NA" (for consumer mode, to be used on Redis keys)
15
+ ip = hostname = isConsumerMode ? constants_1.NA : false;
16
+ }
17
+ return {
18
+ ip: ip,
19
+ hostname: hostname
20
+ };
21
+ }
22
+ exports.validateRuntime = validateRuntime;
@@ -36,7 +36,7 @@ function validateFilterType(maybeFilterType) {
36
36
  */
37
37
  function validateSplitFilter(log, type, values, maxLength) {
38
38
  // validate and remove invalid and duplicated values
39
- var result = splits_1.validateSplits(log, values, constants_2.LOG_PREFIX_SETTINGS, type + " filter", type + " filter value");
39
+ var result = (0, splits_1.validateSplits)(log, values, constants_2.LOG_PREFIX_SETTINGS, type + " filter", type + " filter value");
40
40
  if (result) {
41
41
  // check max length
42
42
  if (result.length > maxLength)
@@ -5,7 +5,7 @@ var InMemoryStorageCS_1 = require("../../../storages/inMemory/InMemoryStorageCS"
5
5
  var constants_1 = require("../../../logger/constants");
6
6
  var constants_2 = require("../../../utils/constants");
7
7
  function __InLocalStorageMockFactory(params) {
8
- var result = InMemoryStorageCS_1.InMemoryStorageCSFactory(params);
8
+ var result = (0, InMemoryStorageCS_1.InMemoryStorageCSFactory)(params);
9
9
  result.splits.checkCache = function () { return true; }; // to emit SDK_READY_FROM_CACHE
10
10
  return result;
11
11
  }
@@ -125,12 +125,12 @@ exports.TrackerAPI = {
125
125
  * @return {Function | Promise} The stop function for this specific task or the promise received with the callbacks registered.
126
126
  */
127
127
  start: function (log, task, collectors, promise, now) {
128
- var taskUniqueId = lang_1.uniqueId();
128
+ var taskUniqueId = (0, lang_1.uniqueId)();
129
129
  var taskCollector = getCollectorForTask(task, collectors);
130
130
  var result;
131
131
  // If we are registering a promise with this task, we should count the status and the exceptions as well
132
132
  // as stopping the task when the promise resolves. Then return the promise
133
- if (thenable_1.thenable(promise)) {
133
+ if ((0, thenable_1.thenable)(promise)) {
134
134
  result = this.__attachToPromise(log, promise, task, taskCollector, taskUniqueId);
135
135
  }
136
136
  else {
@@ -147,7 +147,7 @@ exports.TrackerAPI = {
147
147
  var cb = getCallbackForTask(task, taskCollector);
148
148
  timers[trackingKey] = {
149
149
  cb: cb,
150
- timer: timer_1.timer(now)
150
+ timer: (0, timer_1.timer)(now)
151
151
  };
152
152
  return result;
153
153
  },
@@ -72,7 +72,8 @@ export function splitApiFactory(settings, platform) {
72
72
  return splitHttpClient(url, {
73
73
  // Adding extra headers to send impressions in OPTIMIZED or DEBUG modes.
74
74
  method: 'POST',
75
- body: body, headers: objectAssign({ SplitSDKImpressionsMode: SplitSDKImpressionsMode }, headers)
75
+ body: body,
76
+ headers: objectAssign({ SplitSDKImpressionsMode: SplitSDKImpressionsMode }, headers)
76
77
  });
77
78
  },
78
79
  /**
@@ -151,7 +151,13 @@ var RedisAdapter = /** @class */ (function (_super) {
151
151
  RedisAdapter._defineOptions = function (_a) {
152
152
  var connectionTimeout = _a.connectionTimeout, operationTimeout = _a.operationTimeout, url = _a.url, host = _a.host, port = _a.port, db = _a.db, pass = _a.pass;
153
153
  var parsedOptions = {
154
- connectionTimeout: connectionTimeout, operationTimeout: operationTimeout, url: url, host: host, port: port, db: db, pass: pass
154
+ connectionTimeout: connectionTimeout,
155
+ operationTimeout: operationTimeout,
156
+ url: url,
157
+ host: host,
158
+ port: port,
159
+ db: db,
160
+ pass: pass
155
161
  };
156
162
  return merge({}, DEFAULT_OPTIONS, parsedOptions);
157
163
  };
@@ -62,7 +62,7 @@ export function splitsParserFromFileFactory() {
62
62
  data = fs.readFileSync(filePath, 'utf-8');
63
63
  }
64
64
  catch (e) {
65
- log.error(e.message);
65
+ log.error(e && e.message);
66
66
  return {};
67
67
  }
68
68
  if (data === previousMock)