@splitsoftware/splitio-commons 1.2.1-rc.1 → 1.2.1-rc.10

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 (278) 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 +5 -3
  25. package/cjs/integrations/ga/SplitToGa.js +1 -1
  26. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  27. package/cjs/listeners/browser.js +15 -11
  28. package/cjs/listeners/node.js +1 -1
  29. package/cjs/logger/constants.js +8 -3
  30. package/cjs/logger/index.js +2 -2
  31. package/cjs/logger/messages/debug.js +4 -4
  32. package/cjs/logger/messages/error.js +5 -4
  33. package/cjs/logger/messages/info.js +7 -5
  34. package/cjs/logger/messages/warn.js +1 -1
  35. package/cjs/logger/sdkLogger.js +1 -1
  36. package/cjs/readiness/readinessManager.js +2 -2
  37. package/cjs/readiness/sdkReadinessManager.js +4 -4
  38. package/cjs/sdkClient/client.js +12 -11
  39. package/cjs/sdkClient/clientAttributesDecoration.js +4 -4
  40. package/cjs/sdkClient/clientCS.js +3 -3
  41. package/cjs/sdkClient/clientInputValidation.js +20 -22
  42. package/cjs/sdkClient/sdkClient.js +3 -6
  43. package/cjs/sdkClient/sdkClientMethod.js +1 -1
  44. package/cjs/sdkClient/sdkClientMethodCS.js +6 -10
  45. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +7 -15
  46. package/cjs/sdkFactory/index.js +14 -12
  47. package/cjs/sdkFactory/userConsentProps.js +37 -0
  48. package/cjs/sdkManager/index.js +11 -11
  49. package/cjs/services/splitApi.js +3 -2
  50. package/cjs/services/splitHttpClient.js +2 -2
  51. package/cjs/storages/KeyBuilder.js +2 -6
  52. package/cjs/storages/KeyBuilderCS.js +13 -3
  53. package/cjs/storages/KeyBuilderSS.js +1 -1
  54. package/cjs/storages/findLatencyIndex.js +1 -1
  55. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +24 -4
  56. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +12 -12
  57. package/cjs/storages/inLocalStorage/index.js +4 -4
  58. package/cjs/storages/inMemory/AttributesCacheInMemory.js +1 -1
  59. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +1 -1
  60. package/cjs/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  61. package/cjs/storages/inMemory/InMemoryStorage.js +1 -1
  62. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  63. package/cjs/storages/inMemory/LatenciesCacheInMemory.js +1 -1
  64. package/cjs/storages/inMemory/MySegmentsCacheInMemory.js +1 -1
  65. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -2
  66. package/cjs/storages/inMemory/SplitsCacheInMemory.js +5 -5
  67. package/cjs/storages/inRedis/LatenciesCacheInRedis.js +1 -1
  68. package/cjs/storages/inRedis/RedisAdapter.js +24 -11
  69. package/cjs/storages/inRedis/SegmentsCacheInRedis.js +1 -1
  70. package/cjs/storages/inRedis/SplitsCacheInRedis.js +3 -3
  71. package/cjs/storages/inRedis/index.js +1 -1
  72. package/cjs/storages/pluggable/SegmentsCachePluggable.js +1 -1
  73. package/cjs/storages/pluggable/SplitsCachePluggable.js +3 -3
  74. package/cjs/storages/pluggable/inMemoryWrapper.js +4 -4
  75. package/cjs/storages/pluggable/index.js +6 -6
  76. package/cjs/sync/offline/LocalhostFromFile.js +1 -1
  77. package/cjs/sync/offline/LocalhostFromObject.js +1 -1
  78. package/cjs/sync/offline/splitsParser/parseCondition.js +1 -1
  79. package/cjs/sync/offline/splitsParser/splitsParserFromFile.js +13 -13
  80. package/cjs/sync/offline/splitsParser/splitsParserFromSettings.js +3 -3
  81. package/cjs/sync/offline/syncManagerOffline.js +1 -1
  82. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -2
  83. package/cjs/sync/polling/fetchers/segmentChangesFetcher.js +1 -1
  84. package/cjs/sync/polling/pollingManagerCS.js +6 -6
  85. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  86. package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +1 -1
  87. package/cjs/sync/polling/syncTasks/segmentsSyncTask.js +1 -1
  88. package/cjs/sync/polling/syncTasks/splitsSyncTask.js +1 -1
  89. package/cjs/sync/polling/updaters/mySegmentsUpdater.js +1 -1
  90. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +2 -2
  91. package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -2
  92. package/cjs/sync/streaming/AuthClient/index.js +3 -3
  93. package/cjs/sync/streaming/SSEClient/index.js +2 -1
  94. package/cjs/sync/streaming/SSEHandler/NotificationParser.js +1 -1
  95. package/cjs/sync/streaming/SSEHandler/index.js +3 -3
  96. package/cjs/sync/streaming/mySegmentsV2utils.js +1 -1
  97. package/cjs/sync/streaming/pushManager.js +24 -17
  98. package/cjs/sync/submitters/eventsSyncTask.js +17 -5
  99. package/cjs/sync/submitters/impressionCountsSyncTask.js +1 -1
  100. package/cjs/sync/submitters/impressionsSyncTask.js +15 -3
  101. package/cjs/sync/submitters/metricsSyncTask.js +3 -3
  102. package/cjs/sync/submitters/submitterManager.js +4 -4
  103. package/cjs/sync/submitters/submitterSyncTask.js +1 -1
  104. package/cjs/sync/syncManagerOnline.js +12 -8
  105. package/cjs/trackers/eventTracker.js +11 -4
  106. package/cjs/trackers/impressionObserver/impressionObserverCS.js +1 -1
  107. package/cjs/trackers/impressionObserver/impressionObserverSS.js +1 -1
  108. package/cjs/trackers/impressionObserver/utils.js +8 -1
  109. package/cjs/trackers/impressionsTracker.js +9 -8
  110. package/cjs/utils/MinEvents.js +2 -1
  111. package/cjs/utils/consent.js +10 -0
  112. package/cjs/utils/constants/index.js +5 -1
  113. package/cjs/utils/inputValidation/apiKey.js +1 -1
  114. package/cjs/utils/inputValidation/attribute.js +4 -4
  115. package/cjs/utils/inputValidation/attributes.js +2 -2
  116. package/cjs/utils/inputValidation/event.js +1 -1
  117. package/cjs/utils/inputValidation/eventProperties.js +5 -5
  118. package/cjs/utils/inputValidation/eventValue.js +1 -1
  119. package/cjs/utils/inputValidation/key.js +6 -5
  120. package/cjs/utils/inputValidation/preloadedData.js +8 -8
  121. package/cjs/utils/inputValidation/split.js +1 -1
  122. package/cjs/utils/inputValidation/splits.js +2 -2
  123. package/cjs/utils/inputValidation/trafficType.js +1 -1
  124. package/cjs/utils/inputValidation/trafficTypeExistance.js +1 -1
  125. package/cjs/utils/jwt/index.js +1 -1
  126. package/cjs/utils/key/index.js +3 -3
  127. package/cjs/utils/lang/index.js +13 -4
  128. package/cjs/utils/lang/maps.js +16 -2
  129. package/cjs/utils/murmur3/common.js +1 -1
  130. package/cjs/utils/murmur3/murmur3.js +10 -10
  131. package/cjs/utils/murmur3/murmur3_128.js +1 -1
  132. package/cjs/utils/murmur3/murmur3_128_x86.js +37 -37
  133. package/cjs/utils/murmur3/murmur3_64.js +1 -1
  134. package/cjs/utils/settingsValidation/consent.js +16 -0
  135. package/cjs/utils/settingsValidation/impressionsMode.js +6 -6
  136. package/cjs/utils/settingsValidation/index.js +32 -14
  137. package/cjs/utils/settingsValidation/integrations/configurable.js +1 -1
  138. package/cjs/utils/settingsValidation/integrations/pluggable.js +1 -1
  139. package/cjs/utils/settingsValidation/localhost/builtin.js +2 -2
  140. package/cjs/utils/settingsValidation/logger/builtinLogger.js +3 -3
  141. package/cjs/utils/settingsValidation/logger/commons.js +1 -1
  142. package/cjs/utils/settingsValidation/logger/pluggableLogger.js +1 -1
  143. package/cjs/utils/settingsValidation/runtime.js +11 -0
  144. package/cjs/utils/settingsValidation/splitFilters.js +1 -1
  145. package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
  146. package/cjs/utils/timeTracker/index.js +3 -3
  147. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +4 -2
  148. package/esm/integrations/ga/SplitToGoogleAnalytics.js +4 -2
  149. package/esm/listeners/browser.js +14 -10
  150. package/esm/logger/constants.js +5 -2
  151. package/esm/logger/messages/debug.js +3 -3
  152. package/esm/logger/messages/error.js +4 -3
  153. package/esm/logger/messages/info.js +6 -4
  154. package/esm/sdkClient/client.js +3 -2
  155. package/esm/sdkClient/clientCS.js +1 -1
  156. package/esm/sdkClient/clientInputValidation.js +6 -8
  157. package/esm/sdkClient/sdkClient.js +1 -4
  158. package/esm/sdkClient/sdkClientMethodCS.js +1 -5
  159. package/esm/sdkClient/sdkClientMethodCSWithTT.js +1 -9
  160. package/esm/sdkFactory/index.js +8 -6
  161. package/esm/sdkFactory/userConsentProps.js +33 -0
  162. package/esm/services/splitApi.js +2 -1
  163. package/esm/storages/KeyBuilder.js +2 -6
  164. package/esm/storages/KeyBuilderCS.js +11 -1
  165. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +23 -3
  166. package/esm/storages/inLocalStorage/index.js +1 -1
  167. package/esm/storages/inMemory/ImpressionsCacheInMemory.js +15 -1
  168. package/esm/storages/inMemory/InMemoryStorage.js +1 -1
  169. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  170. package/esm/storages/inRedis/RedisAdapter.js +15 -2
  171. package/esm/storages/pluggable/index.js +2 -2
  172. package/esm/sync/offline/splitsParser/splitsParserFromFile.js +1 -1
  173. package/esm/sync/polling/fetchers/segmentChangesFetcher.js +2 -2
  174. package/esm/sync/streaming/SSEClient/index.js +2 -1
  175. package/esm/sync/streaming/pushManager.js +9 -2
  176. package/esm/sync/submitters/eventsSyncTask.js +18 -6
  177. package/esm/sync/submitters/impressionsSyncTask.js +13 -1
  178. package/esm/sync/syncManagerOnline.js +11 -7
  179. package/esm/trackers/eventTracker.js +8 -1
  180. package/esm/trackers/impressionObserver/utils.js +7 -1
  181. package/esm/trackers/impressionsTracker.js +6 -5
  182. package/esm/utils/consent.js +6 -0
  183. package/esm/utils/constants/index.js +4 -0
  184. package/esm/utils/inputValidation/attributes.js +1 -1
  185. package/esm/utils/inputValidation/key.js +2 -1
  186. package/esm/utils/lang/index.js +12 -4
  187. package/esm/utils/lang/maps.js +14 -1
  188. package/esm/utils/settingsValidation/consent.js +12 -0
  189. package/esm/utils/settingsValidation/impressionsMode.js +7 -7
  190. package/esm/utils/settingsValidation/index.js +28 -10
  191. package/esm/utils/settingsValidation/runtime.js +7 -0
  192. package/package.json +8 -8
  193. package/src/evaluator/parser/index.ts +1 -1
  194. package/src/evaluator/types.ts +2 -2
  195. package/src/evaluator/value/index.ts +2 -2
  196. package/src/evaluator/value/sanitize.ts +2 -2
  197. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +7 -4
  198. package/src/integrations/ga/SplitToGoogleAnalytics.ts +7 -4
  199. package/src/integrations/pluggable.ts +2 -2
  200. package/src/integrations/types.ts +5 -0
  201. package/src/listeners/browser.ts +13 -9
  202. package/src/logger/constants.ts +5 -2
  203. package/src/logger/messages/debug.ts +3 -3
  204. package/src/logger/messages/error.ts +4 -3
  205. package/src/logger/messages/info.ts +6 -4
  206. package/src/logger/types.ts +4 -0
  207. package/src/sdkClient/client.ts +3 -2
  208. package/src/sdkClient/clientCS.ts +1 -1
  209. package/src/sdkClient/clientInputValidation.ts +8 -7
  210. package/src/sdkClient/sdkClient.ts +2 -5
  211. package/src/sdkClient/sdkClientMethodCS.ts +1 -6
  212. package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -11
  213. package/src/sdkFactory/index.ts +9 -7
  214. package/src/sdkFactory/types.ts +2 -1
  215. package/src/sdkFactory/userConsentProps.ts +40 -0
  216. package/src/storages/KeyBuilder.ts +2 -6
  217. package/src/storages/KeyBuilderCS.ts +13 -1
  218. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +23 -3
  219. package/src/storages/inLocalStorage/index.ts +1 -1
  220. package/src/storages/inMemory/ImpressionsCacheInMemory.ts +22 -1
  221. package/src/storages/inMemory/InMemoryStorage.ts +1 -1
  222. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  223. package/src/storages/inRedis/RedisAdapter.ts +8 -2
  224. package/src/storages/pluggable/index.ts +2 -2
  225. package/src/storages/types.ts +6 -2
  226. package/src/sync/offline/splitsParser/splitsParserFromFile.ts +1 -1
  227. package/src/sync/streaming/SSEClient/index.ts +2 -1
  228. package/src/sync/streaming/pushManager.ts +11 -2
  229. package/src/sync/submitters/eventsSyncTask.ts +19 -6
  230. package/src/sync/submitters/impressionsSyncTask.ts +16 -1
  231. package/src/sync/syncManagerOnline.ts +13 -7
  232. package/src/sync/types.ts +4 -1
  233. package/src/trackers/eventTracker.ts +11 -3
  234. package/src/trackers/impressionObserver/utils.ts +8 -1
  235. package/src/trackers/impressionsTracker.ts +7 -8
  236. package/src/types.ts +22 -1
  237. package/src/utils/consent.ts +8 -0
  238. package/src/utils/constants/index.ts +5 -0
  239. package/src/utils/inputValidation/attributes.ts +1 -2
  240. package/src/utils/lang/index.ts +15 -4
  241. package/src/utils/lang/maps.ts +15 -1
  242. package/src/utils/settingsValidation/consent.ts +16 -0
  243. package/src/utils/settingsValidation/impressionsMode.ts +8 -8
  244. package/src/utils/settingsValidation/index.ts +29 -10
  245. package/src/utils/settingsValidation/runtime.ts +9 -0
  246. package/src/utils/settingsValidation/types.ts +12 -6
  247. package/types/evaluator/types.d.ts +2 -2
  248. package/types/evaluator/value/index.d.ts +1 -1
  249. package/types/evaluator/value/sanitize.d.ts +1 -1
  250. package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +2 -2
  251. package/types/integrations/ga/SplitToGoogleAnalytics.d.ts +2 -3
  252. package/types/integrations/types.d.ts +4 -0
  253. package/types/logger/constants.d.ts +5 -2
  254. package/types/logger/types.d.ts +4 -0
  255. package/types/sdkClient/clientAttributesDecoration.d.ts +1 -1
  256. package/types/sdkClient/clientInputValidation.d.ts +2 -3
  257. package/types/sdkFactory/types.d.ts +1 -1
  258. package/types/sdkFactory/userConsentProps.d.ts +6 -0
  259. package/types/storages/KeyBuilderCS.d.ts +2 -0
  260. package/types/storages/inMemory/ImpressionsCacheInMemory.d.ts +9 -0
  261. package/types/storages/inRedis/RedisAdapter.d.ts +1 -1
  262. package/types/storages/types.d.ts +3 -1
  263. package/types/sync/types.d.ts +3 -0
  264. package/types/trackers/eventTracker.d.ts +2 -2
  265. package/types/trackers/impressionObserver/utils.d.ts +4 -0
  266. package/types/trackers/impressionsTracker.d.ts +2 -3
  267. package/types/types.d.ts +22 -1
  268. package/types/utils/consent.d.ts +2 -0
  269. package/types/utils/constants/index.d.ts +3 -0
  270. package/types/utils/lang/index.d.ts +6 -1
  271. package/types/utils/lang/maps.d.ts +7 -0
  272. package/types/utils/settingsValidation/consent.d.ts +6 -0
  273. package/types/utils/settingsValidation/impressionsMode.d.ts +1 -1
  274. package/types/utils/settingsValidation/runtime/browser.d.ts +2 -0
  275. package/types/utils/settingsValidation/runtime/node.d.ts +2 -0
  276. package/types/utils/settingsValidation/runtime.d.ts +2 -0
  277. package/types/utils/settingsValidation/types.d.ts +12 -6
  278. package/types/utils/settingsValidation/userConsent.d.ts +5 -0
@@ -6,7 +6,7 @@ var attribute_1 = require("./attribute");
6
6
  var constants_1 = require("../../logger/constants");
7
7
  function validateAttributes(log, maybeAttrs, method) {
8
8
  // Attributes are optional
9
- if (lang_1.isObject(maybeAttrs) || maybeAttrs == undefined) // eslint-disable-line eqeqeq
9
+ if (maybeAttrs == undefined || (0, lang_1.isObject)(maybeAttrs)) // eslint-disable-line eqeqeq
10
10
  return maybeAttrs;
11
11
  log.error(constants_1.ERROR_NOT_PLAIN_OBJECT, [method, 'attributes']);
12
12
  return false;
@@ -17,7 +17,7 @@ function validateAttributesDeep(log, maybeAttributes, method) {
17
17
  return false;
18
18
  var result = true;
19
19
  Object.keys(maybeAttributes).forEach(function (attributeKey) {
20
- if (!attribute_1.validateAttribute(log, attributeKey, maybeAttributes[attributeKey], method))
20
+ if (!(0, attribute_1.validateAttribute)(log, attributeKey, maybeAttributes[attributeKey], method))
21
21
  result = false;
22
22
  });
23
23
  return result;
@@ -9,7 +9,7 @@ function validateEvent(log, maybeEvent, method) {
9
9
  if (maybeEvent == undefined) { // eslint-disable-line eqeqeq
10
10
  log.error(constants_1.ERROR_NULL, [method, item]);
11
11
  }
12
- else if (!lang_1.isString(maybeEvent)) {
12
+ else if (!(0, lang_1.isString)(maybeEvent)) {
13
13
  log.error(constants_1.ERROR_INVALID, [method, item]);
14
14
  }
15
15
  else { // It is a string.
@@ -16,13 +16,13 @@ var BASE_EVENT_SIZE = 1024; // We assume 1kb events without properties (avg meas
16
16
  function validateEventProperties(log, maybeProperties, method) {
17
17
  if (maybeProperties == undefined)
18
18
  return { properties: null, size: BASE_EVENT_SIZE }; // eslint-disable-line eqeqeq
19
- if (!lang_1.isObject(maybeProperties)) {
19
+ if (!(0, lang_1.isObject)(maybeProperties)) {
20
20
  log.error(constants_1.ERROR_NOT_PLAIN_OBJECT, [method, 'properties']);
21
21
  return { properties: false, size: BASE_EVENT_SIZE };
22
22
  }
23
23
  var keys = Object.keys(maybeProperties);
24
24
  // Shallow clone
25
- var clone = objectAssign_1.objectAssign({}, maybeProperties);
25
+ var clone = (0, objectAssign_1.objectAssign)({}, maybeProperties);
26
26
  // To avoid calculating the size twice we'll return it from here.
27
27
  var output = {
28
28
  properties: clone,
@@ -34,9 +34,9 @@ function validateEventProperties(log, maybeProperties, method) {
34
34
  for (var i = 0; i < keys.length; i++) {
35
35
  output.size += keys[i].length * ECMA_SIZES.STRING; // Count the size of the key which is always a string.
36
36
  var val = clone[keys[i]];
37
- var isStringVal = lang_1.isString(val);
38
- var isFiniteVal = lang_1.isFiniteNumber(val);
39
- var isBoolVal = lang_1.isBoolean(val);
37
+ var isStringVal = (0, lang_1.isString)(val);
38
+ var isFiniteVal = (0, lang_1.isFiniteNumber)(val);
39
+ var isBoolVal = (0, lang_1.isBoolean)(val);
40
40
  var isNullVal = val === null;
41
41
  if (!(isStringVal || isFiniteVal || isBoolVal || isNullVal)) { // If it's not of valid type.
42
42
  clone[keys[i]] = null;
@@ -4,7 +4,7 @@ exports.validateEventValue = void 0;
4
4
  var constants_1 = require("../../logger/constants");
5
5
  var lang_1 = require("../lang");
6
6
  function validateEventValue(log, maybeValue, method) {
7
- if (lang_1.isFiniteNumber(maybeValue) || maybeValue == undefined) // eslint-disable-line eqeqeq
7
+ if ((0, lang_1.isFiniteNumber)(maybeValue) || maybeValue == undefined) // eslint-disable-line eqeqeq
8
8
  return maybeValue;
9
9
  log.error(constants_1.ERROR_NOT_FINITE, [method]);
10
10
  return false;
@@ -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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniqueId = exports.uniqAsStrings = exports.uniq = exports.toString = exports.toNumber = exports.startsWith = exports.merge = exports.isString = exports.isObject = exports.isNaNNumber = exports.isIntegerNumber = exports.isFiniteNumber = exports.isBoolean = exports.groupBy = exports.get = exports.forOwn = exports.findIndex = exports.find = exports.endsWith = void 0;
3
+ exports.uniqueId = exports.uniqAsStrings = exports.uniq = exports.toString = exports.toNumber = exports.startsWith = exports.merge = exports.stringToUpperCase = exports.isString = exports.isObject = exports.isNaNNumber = exports.isIntegerNumber = exports.isFiniteNumber = exports.isBoolean = exports.groupBy = exports.get = exports.forOwn = exports.findIndex = exports.find = exports.endsWith = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  /**
6
6
  * Checks if the target string ends with the sub string.
@@ -154,10 +154,12 @@ function isNaNNumber(val) {
154
154
  }
155
155
  exports.isNaNNumber = isNaNNumber;
156
156
  /**
157
- * Validates if a value is an object with the Object prototype (map object).
157
+ * Validates if a value is an object created by the Object constructor (plain object).
158
+ * It checks `constructor.name` to avoid false negatives when validating values on a separate VM context, which has its own global built-ins.
158
159
  */
159
160
  function isObject(obj) {
160
- return obj !== null && typeof obj === 'object' && obj.constructor === Object;
161
+ return obj !== null && typeof obj === 'object' && (obj.constructor === Object ||
162
+ (obj.constructor != null && obj.constructor.name === 'Object'));
161
163
  }
162
164
  exports.isObject = isObject;
163
165
  /**
@@ -167,6 +169,13 @@ function isString(val) {
167
169
  return typeof val === 'string' || val instanceof String;
168
170
  }
169
171
  exports.isString = isString;
172
+ /**
173
+ * String sanitizer. Returns the provided value converted to uppercase if it is a string.
174
+ */
175
+ function stringToUpperCase(val) {
176
+ return isString(val) ? val.toUpperCase() : val;
177
+ }
178
+ exports.stringToUpperCase = stringToUpperCase;
170
179
  /**
171
180
  * Deep copy version of Object.assign using recursion.
172
181
  * There are some assumptions here. It's for internal use and we don't need verbose errors
@@ -194,7 +203,7 @@ function merge(target, source) {
194
203
  });
195
204
  if (rest && rest.length) {
196
205
  var nextSource = rest.splice(0, 1)[0];
197
- res = merge.apply(void 0, tslib_1.__spreadArrays([res, nextSource], rest));
206
+ res = merge.apply(void 0, (0, tslib_1.__spreadArray)([res, nextSource], rest, false));
198
207
  }
199
208
  return res;
200
209
  }
@@ -24,7 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  THE SOFTWARE.
25
25
  **/
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports._Map = exports.MapPoly = void 0;
27
+ exports._Map = exports.__getMapConstructor = exports.MapPoly = void 0;
28
28
  var MapPoly = /** @class */ (function () {
29
29
  // unlike ES6 `Map`, it only accepts an array as first argument iterable
30
30
  function MapPoly(entries) {
@@ -71,4 +71,18 @@ var MapPoly = /** @class */ (function () {
71
71
  return MapPoly;
72
72
  }());
73
73
  exports.MapPoly = MapPoly;
74
- exports._Map = typeof Map !== 'undefined' ? Map : MapPoly;
74
+ /**
75
+ * return the Map constructor to use. If native Map is not available or it doesn't support the required features (e.g., IE11),
76
+ * a ponyfill with minimal features is returned instead.
77
+ *
78
+ * Exported for testing purposes only.
79
+ */
80
+ function __getMapConstructor() {
81
+ // eslint-disable-next-line compat/compat
82
+ if (typeof Array.from === 'function' && typeof Map === 'function' && Map.prototype && Map.prototype.values) {
83
+ return Map;
84
+ }
85
+ return MapPoly;
86
+ }
87
+ exports.__getMapConstructor = __getMapConstructor;
88
+ exports._Map = __getMapConstructor();
@@ -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
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateConsent = void 0;
4
+ var constants_1 = require("../../logger/constants");
5
+ var constants_2 = require("../constants");
6
+ var lang_1 = require("../lang");
7
+ var userConsentValues = [constants_2.CONSENT_DECLINED, constants_2.CONSENT_GRANTED, constants_2.CONSENT_UNKNOWN];
8
+ function validateConsent(_a) {
9
+ var userConsent = _a.userConsent, log = _a.log;
10
+ userConsent = (0, lang_1.stringToUpperCase)(userConsent);
11
+ if (userConsentValues.indexOf(userConsent) > -1)
12
+ return userConsent;
13
+ log.error(constants_1.ERROR_INVALID_CONFIG_PARAM, ['userConsent', userConsentValues, constants_2.CONSENT_GRANTED]);
14
+ return constants_2.CONSENT_GRANTED;
15
+ }
16
+ exports.validateConsent = validateConsent;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validImpressionsMode = void 0;
4
4
  var constants_1 = require("../../logger/constants");
5
5
  var constants_2 = require("../constants");
6
+ var lang_1 = require("../lang");
6
7
  function validImpressionsMode(log, impressionsMode) {
7
- impressionsMode = impressionsMode.toUpperCase();
8
- if ([constants_2.DEBUG, constants_2.OPTIMIZED].indexOf(impressionsMode) === -1) {
9
- log.error(constants_1.ERROR_INVALID_IMPRESSIONS_MODE, [[constants_2.DEBUG, constants_2.OPTIMIZED], constants_2.OPTIMIZED]);
10
- impressionsMode = constants_2.OPTIMIZED;
11
- }
12
- return impressionsMode;
8
+ impressionsMode = (0, lang_1.stringToUpperCase)(impressionsMode);
9
+ if ([constants_2.DEBUG, constants_2.OPTIMIZED].indexOf(impressionsMode) > -1)
10
+ return impressionsMode;
11
+ log.error(constants_1.ERROR_INVALID_CONFIG_PARAM, ['impressionsMode', [constants_2.DEBUG, constants_2.OPTIMIZED], constants_2.OPTIMIZED]);
12
+ return constants_2.OPTIMIZED;
13
13
  }
14
14
  exports.validImpressionsMode = validImpressionsMode;