@splitsoftware/splitio-commons 1.8.2-rc.0 → 1.8.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGES.txt +5 -5
  2. package/README.md +1 -1
  3. package/cjs/logger/constants.js +3 -3
  4. package/cjs/logger/messages/debug.js +7 -7
  5. package/cjs/logger/messages/error.js +2 -2
  6. package/cjs/logger/messages/info.js +3 -3
  7. package/cjs/logger/messages/warn.js +7 -7
  8. package/cjs/sdkClient/client.js +20 -20
  9. package/cjs/sdkClient/clientAttributesDecoration.js +8 -8
  10. package/cjs/sdkClient/clientInputValidation.js +10 -10
  11. package/cjs/sdkClient/sdkClient.js +1 -1
  12. package/cjs/sdkFactory/index.js +1 -1
  13. package/cjs/sdkManager/index.js +10 -8
  14. package/cjs/services/splitHttpClient.js +1 -1
  15. package/cjs/storages/inRedis/SplitsCacheInRedis.js +2 -2
  16. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  17. package/cjs/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  18. package/cjs/sync/polling/updaters/splitChangesUpdater.js +5 -12
  19. package/cjs/sync/streaming/pushManager.js +1 -1
  20. package/cjs/sync/submitters/telemetrySubmitter.js +2 -2
  21. package/cjs/utils/inputValidation/apiKey.js +26 -25
  22. package/cjs/utils/inputValidation/preloadedData.js +3 -3
  23. package/cjs/utils/inputValidation/split.js +1 -1
  24. package/cjs/utils/inputValidation/splits.js +2 -2
  25. package/cjs/utils/settingsValidation/index.js +1 -1
  26. package/esm/logger/constants.js +2 -2
  27. package/esm/logger/messages/debug.js +7 -7
  28. package/esm/logger/messages/error.js +2 -2
  29. package/esm/logger/messages/info.js +3 -3
  30. package/esm/logger/messages/warn.js +7 -7
  31. package/esm/sdkClient/client.js +20 -20
  32. package/esm/sdkClient/clientAttributesDecoration.js +8 -8
  33. package/esm/sdkClient/clientInputValidation.js +10 -10
  34. package/esm/sdkClient/sdkClient.js +1 -1
  35. package/esm/sdkFactory/index.js +1 -1
  36. package/esm/sdkManager/index.js +10 -8
  37. package/esm/services/splitHttpClient.js +1 -1
  38. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  39. package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
  40. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  41. package/esm/sync/polling/updaters/splitChangesUpdater.js +5 -12
  42. package/esm/sync/streaming/pushManager.js +1 -1
  43. package/esm/sync/submitters/telemetrySubmitter.js +2 -2
  44. package/esm/utils/inputValidation/apiKey.js +27 -26
  45. package/esm/utils/inputValidation/preloadedData.js +3 -3
  46. package/esm/utils/inputValidation/split.js +1 -1
  47. package/esm/utils/inputValidation/splits.js +2 -2
  48. package/esm/utils/settingsValidation/index.js +1 -1
  49. package/package.json +1 -1
  50. package/src/logger/constants.ts +2 -2
  51. package/src/logger/messages/debug.ts +7 -7
  52. package/src/logger/messages/error.ts +2 -2
  53. package/src/logger/messages/info.ts +3 -3
  54. package/src/logger/messages/warn.ts +7 -7
  55. package/src/sdkClient/client.ts +20 -20
  56. package/src/sdkClient/clientAttributesDecoration.ts +10 -10
  57. package/src/sdkClient/clientInputValidation.ts +10 -10
  58. package/src/sdkClient/sdkClient.ts +3 -3
  59. package/src/sdkFactory/index.ts +1 -1
  60. package/src/sdkManager/index.ts +11 -8
  61. package/src/services/splitHttpClient.ts +1 -1
  62. package/src/storages/inMemory/AttributesCacheInMemory.ts +7 -6
  63. package/src/storages/inRedis/SplitsCacheInRedis.ts +2 -2
  64. package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
  65. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  66. package/src/sync/polling/updaters/splitChangesUpdater.ts +6 -12
  67. package/src/sync/streaming/pushManager.ts +1 -1
  68. package/src/sync/submitters/telemetrySubmitter.ts +2 -2
  69. package/src/types.ts +147 -140
  70. package/src/utils/inputValidation/apiKey.ts +25 -24
  71. package/src/utils/inputValidation/preloadedData.ts +3 -3
  72. package/src/utils/inputValidation/split.ts +1 -1
  73. package/src/utils/inputValidation/splits.ts +1 -1
  74. package/src/utils/settingsValidation/index.ts +1 -1
  75. package/types/logger/constants.d.ts +1 -1
  76. package/types/sdkClient/clientAttributesDecoration.d.ts +7 -7
  77. package/types/storages/inMemory/AttributesCacheInMemory.d.ts +4 -3
  78. package/types/types.d.ts +142 -135
  79. package/types/utils/inputValidation/apiKey.d.ts +5 -5
  80. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  81. package/types/utils/settingsValidation/index.d.ts +1 -1
  82. package/types/storages/metadataBuilder.d.ts +0 -3
  83. /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
  84. /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
  85. /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
@@ -3,51 +3,52 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.releaseApiKey = exports.validateAndTrackApiKey = exports.usedKeysMap = exports.validateApiKey = void 0;
4
4
  var constants_1 = require("../../logger/constants");
5
5
  var lang_1 = require("../lang");
6
- var item = 'api_key';
7
- /** validates the given api key */
8
- function validateApiKey(log, maybeApiKey) {
9
- var apiKey = false;
10
- if (maybeApiKey == undefined) { // eslint-disable-line eqeqeq
6
+ var item = 'sdk_key';
7
+ // @TODO replace ApiKey with SdkKey in function names
8
+ /** validates the given SDK key */
9
+ function validateApiKey(log, maybeSdkKey) {
10
+ var sdkKey = false;
11
+ if (maybeSdkKey == undefined) { // eslint-disable-line eqeqeq
11
12
  log.error(constants_1.ERROR_NULL, [constants_1.LOG_PREFIX_INSTANTIATION, item]);
12
13
  }
13
- else if ((0, lang_1.isString)(maybeApiKey)) {
14
- if (maybeApiKey.length > 0)
15
- apiKey = maybeApiKey;
14
+ else if ((0, lang_1.isString)(maybeSdkKey)) {
15
+ if (maybeSdkKey.length > 0)
16
+ sdkKey = maybeSdkKey;
16
17
  else
17
18
  log.error(constants_1.ERROR_EMPTY, [constants_1.LOG_PREFIX_INSTANTIATION, item]);
18
19
  }
19
20
  else {
20
21
  log.error(constants_1.ERROR_INVALID, [constants_1.LOG_PREFIX_INSTANTIATION, item]);
21
22
  }
22
- return apiKey;
23
+ return sdkKey;
23
24
  }
24
25
  exports.validateApiKey = validateApiKey;
25
26
  // Exported for telemetry
26
27
  exports.usedKeysMap = {};
27
- /** validates the given api key and also warns if it is in use */
28
- function validateAndTrackApiKey(log, maybeApiKey) {
29
- var apiKey = validateApiKey(log, maybeApiKey);
30
- // If the apiKey is correct, we'll save it as the instance creation should work.
31
- if (apiKey) {
32
- if (!exports.usedKeysMap[apiKey]) {
28
+ /** validates the given SDK key and also warns if it is in use */
29
+ function validateAndTrackApiKey(log, maybeSdkKey) {
30
+ var sdkKey = validateApiKey(log, maybeSdkKey);
31
+ // If sdkKey is correct, we'll save it as the instance creation should work.
32
+ if (sdkKey) {
33
+ if (!exports.usedKeysMap[sdkKey]) {
33
34
  // If this key is not present, only warning scenarios is that we have factories for other keys.
34
- exports.usedKeysMap[apiKey] = 1;
35
+ exports.usedKeysMap[sdkKey] = 1;
35
36
  if (Object.keys(exports.usedKeysMap).length > 1) {
36
- log.warn(constants_1.WARN_API_KEY, ['an instance of the Split factory']);
37
+ log.warn(constants_1.WARN_SDK_KEY, ['an instance of the Split factory']);
37
38
  }
38
39
  }
39
40
  else {
40
- log.warn(constants_1.WARN_API_KEY, [exports.usedKeysMap[apiKey] + " factory/ies with this API Key"]);
41
- exports.usedKeysMap[apiKey]++;
41
+ log.warn(constants_1.WARN_SDK_KEY, [exports.usedKeysMap[sdkKey] + " factory/ies with this SDK Key"]);
42
+ exports.usedKeysMap[sdkKey]++;
42
43
  }
43
44
  }
44
- return apiKey;
45
+ return sdkKey;
45
46
  }
46
47
  exports.validateAndTrackApiKey = validateAndTrackApiKey;
47
- function releaseApiKey(apiKey) {
48
- if (exports.usedKeysMap[apiKey])
49
- exports.usedKeysMap[apiKey]--;
50
- if (exports.usedKeysMap[apiKey] === 0)
51
- delete exports.usedKeysMap[apiKey];
48
+ function releaseApiKey(sdkKey) {
49
+ if (exports.usedKeysMap[sdkKey])
50
+ exports.usedKeysMap[sdkKey]--;
51
+ if (exports.usedKeysMap[sdkKey] === 0)
52
+ delete exports.usedKeysMap[sdkKey];
52
53
  }
53
54
  exports.releaseApiKey = releaseApiKey;
@@ -13,12 +13,12 @@ function validateSplitsData(log, maybeSplitsData, method) {
13
13
  if ((0, lang_1.isObject)(maybeSplitsData)) {
14
14
  var splitNames = Object.keys(maybeSplitsData);
15
15
  if (splitNames.length === 0)
16
- log.warn(method + ": preloadedData.splitsData doesn't contain split definitions.");
16
+ log.warn(method + ": preloadedData.splitsData doesn't contain feature flag definitions.");
17
17
  // @TODO in the future, consider handling the possibility of having parsed definitions of splits
18
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
- log.error(method + ": preloadedData.splitsData must be a map of split names to their serialized definitions.");
21
+ log.error(method + ": preloadedData.splitsData must be a map of feature flag names to their stringified definitions.");
22
22
  return false;
23
23
  }
24
24
  function validateMySegmentsData(log, maybeMySegmentsData, method) {
@@ -40,7 +40,7 @@ function validateSegmentsData(log, maybeSegmentsData, method) {
40
40
  if (segmentNames.every(function (segmentName) { return (0, lang_1.isString)(maybeSegmentsData[segmentName]); }))
41
41
  return true;
42
42
  }
43
- log.error(method + ": preloadedData.segmentsData must be a map of segment names to their serialized definitions.");
43
+ log.error(method + ": preloadedData.segmentsData must be a map of segment names to their stringified definitions.");
44
44
  return false;
45
45
  }
46
46
  function validatePreloadedData(log, maybePreloadedData, method) {
@@ -6,7 +6,7 @@ var lang_1 = require("../lang");
6
6
  // include BOM and nbsp
7
7
  var TRIMMABLE_SPACES_REGEX = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;
8
8
  function validateSplit(log, maybeSplit, method, item) {
9
- if (item === void 0) { item = 'split name'; }
9
+ if (item === void 0) { item = 'feature flag name'; }
10
10
  if (maybeSplit == undefined) { // eslint-disable-line eqeqeq
11
11
  log.error(constants_1.ERROR_NULL, [method, item]);
12
12
  }
@@ -5,8 +5,8 @@ var constants_1 = require("../../logger/constants");
5
5
  var lang_1 = require("../lang");
6
6
  var split_1 = require("./split");
7
7
  function validateSplits(log, maybeSplits, method, listName, item) {
8
- if (listName === void 0) { listName = 'split_names'; }
9
- if (item === void 0) { item = 'split name'; }
8
+ if (listName === void 0) { listName = 'feature flag names'; }
9
+ if (item === void 0) { item = 'feature flag name'; }
10
10
  if (Array.isArray(maybeSplits) && maybeSplits.length > 0) {
11
11
  var validatedArray_1 = [];
12
12
  // Remove invalid values
@@ -84,7 +84,7 @@ function fromSecondsToMillis(n) {
84
84
  }
85
85
  /**
86
86
  * Validates the given config and use it to build a settings object.
87
- * NOTE: it doesn't validate the Api Key. Call `validateApikey` or `validateAndTrackApiKey` for that after settings validation.
87
+ * NOTE: it doesn't validate the SDK Key. Call `validateApiKey` or `validateAndTrackApiKey` for that after settings validation.
88
88
  *
89
89
  * @param config user defined configuration
90
90
  * @param validationParams defaults and fields validators used to validate and creates a settings object from a given config
@@ -92,7 +92,7 @@ export var WARN_INTEGRATION_INVALID = 218;
92
92
  export var WARN_SPLITS_FILTER_IGNORED = 219;
93
93
  export var WARN_SPLITS_FILTER_INVALID = 220;
94
94
  export var WARN_SPLITS_FILTER_EMPTY = 221;
95
- export var WARN_API_KEY = 222;
95
+ export var WARN_SDK_KEY = 222;
96
96
  export var STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;
97
97
  export var ERROR_ENGINE_COMBINER_IFELSEIF = 300;
98
98
  export var ERROR_LOGLEVEL_INVALID = 301;
@@ -132,7 +132,7 @@ export var LOG_PREFIX_SYNC = 'sync';
132
132
  export var LOG_PREFIX_SYNC_MANAGER = LOG_PREFIX_SYNC + ':sync-manager: ';
133
133
  export var LOG_PREFIX_SYNC_OFFLINE = LOG_PREFIX_SYNC + ':offline: ';
134
134
  export var LOG_PREFIX_SYNC_STREAMING = LOG_PREFIX_SYNC + ':streaming: ';
135
- export var LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':split-changes: ';
135
+ export var LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':featureflag-changes: ';
136
136
  export var LOG_PREFIX_SYNC_SEGMENTS = LOG_PREFIX_SYNC + ':segment-changes: ';
137
137
  export var LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
138
138
  export var LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
@@ -12,8 +12,8 @@ export var codesDebug = codesInfo.concat([
12
12
  [c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
13
13
  [c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
14
14
  [c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
15
- [c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] parent split "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],
16
- [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent split: "%s" with key: %s %s'],
15
+ [c.ENGINE_MATCHER_DEPENDENCY, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] parent feature flag "%s" evaluated to "%s" with label "%s". %s evaluated treatment is part of [%s] ? %s.'],
16
+ [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
17
17
  [c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
18
18
  [c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
19
19
  [c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
@@ -34,15 +34,15 @@ export var codesDebug = codesInfo.concat([
34
34
  [c.RETRIEVE_CLIENT_EXISTING, 'Retrieving existing SDK client.'],
35
35
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
36
36
  // synchronizer
37
- [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Splits data: \n%s'],
38
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up split update using since = %s'],
39
- [c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New splits %s'],
40
- [c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed splits %s'],
37
+ [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
38
+ [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
39
+ [c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s'],
40
+ [c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed feature flags %s'],
41
41
  [c.SYNC_SPLITS_SEGMENTS, c.LOG_PREFIX_SYNC_SPLITS + 'Segment names collected %s'],
42
42
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
43
43
  [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
44
44
  [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
45
45
  [c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + ': Stopping %s'],
46
46
  // initialization / settings validation
47
- [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': splits filtering criteria is "%s".']
47
+ [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
48
48
  ]);
@@ -1,7 +1,7 @@
1
1
  import * as c from '../constants';
2
2
  export var codesError = [
3
3
  // evaluator
4
- [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid Split, no valid rules found'],
4
+ [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules found'],
5
5
  // SDK
6
6
  [c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
7
7
  [c.ERROR_CLIENT_CANNOT_GET_READY, 'The SDK will not get ready. Reason: %s'],
@@ -9,7 +9,7 @@ export var codesError = [
9
9
  [c.ERROR_IMPRESSIONS_LISTENER, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Impression listener logImpression method threw: %s.'],
10
10
  [c.ERROR_EVENTS_TRACKER, c.LOG_PREFIX_EVENTS_TRACKER + 'Failed to queue %s'],
11
11
  // synchronizer
12
- [c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock Splits data, no changes will be applied to the current cache. %s'],
12
+ [c.ERROR_SYNC_OFFLINE_LOADING, c.LOG_PREFIX_SYNC_OFFLINE + 'There was an issue loading the mock feature flags data. No changes will be applied to the current cache. %s'],
13
13
  [c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
14
14
  [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
15
15
  [c.ERROR_HTTP, 'Response status is not OK. Status: %s. URL: %s. Message: %s'],
@@ -6,7 +6,7 @@ export var codesInfo = codesWarn.concat([
6
6
  [c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
7
7
  [c.CLIENT_READY, READY_MSG],
8
8
  // SDK
9
- [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Split: %s. Key: %s. Evaluation: %s. Label: %s'],
9
+ [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
10
10
  [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Queueing corresponding impression.'],
11
11
  [c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
12
12
  [c.NEW_FACTORY, 'New Split SDK instance created.'],
@@ -19,13 +19,13 @@ export var codesInfo = codesWarn.concat([
19
19
  [c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
20
20
  [c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
21
21
  [c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
22
- [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of splits #%s. Reason: %s'],
22
+ [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of feature flags #%s. Reason: %s'],
23
23
  [c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and reseting timer.'],
24
24
  [c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
25
25
  [c.STREAMING_REFRESH_TOKEN, c.LOG_PREFIX_SYNC_STREAMING + 'Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.'],
26
26
  [c.STREAMING_RECONNECT, c.LOG_PREFIX_SYNC_STREAMING + 'Attempting to reconnect streaming in %s seconds.'],
27
27
  [c.STREAMING_CONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Connecting streaming.'],
28
- [c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given Api key. Switching to polling mode.'],
28
+ [c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given SDK key. Switching to polling mode.'],
29
29
  [c.STREAMING_DISCONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Disconnecting streaming.'],
30
30
  [c.SYNC_START_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming not available. Starting polling.'],
31
31
  [c.SYNC_CONTINUE_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming couldn\'t connect. Continue polling.'],
@@ -6,7 +6,7 @@ export var codesWarn = codesError.concat([
6
6
  [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute [%s], no attributes received.'],
7
7
  // synchronizer
8
8
  [c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying download of segments #%s. Reason: %s'],
9
- [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of Splits. %s'],
9
+ [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
10
10
  [c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
11
11
  [c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
12
12
  [c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
@@ -20,14 +20,14 @@ export var codesWarn = codesError.concat([
20
20
  [c.WARN_TRIMMING_PROPERTIES, '%s: Event has more than 300 properties. Some of them will be trimmed when processed.'],
21
21
  [c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
22
22
  [c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
23
- [c.WARN_NOT_EXISTENT_SPLIT, '%s: split "%s" does not exist in this environment, please double check what splits exist in the Split web console.'],
23
+ [c.WARN_NOT_EXISTENT_SPLIT, '%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],
24
24
  [c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
25
- [c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding split in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split web console.'],
25
+ [c.WARN_NOT_EXISTENT_TT, '%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split user interface.'],
26
26
  // initialization / settings validation
27
27
  [c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS + ': %s integration item(s) at settings is invalid. %s'],
28
- [c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS + ': split filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
29
- [c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS + ': split filter at position %s is invalid. It must be an object with a valid filter type ("byName" or "byPrefix") and a list of "values".'],
30
- [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': splitFilters configuration must be a non-empty array of filter objects.'],
31
- [c.WARN_API_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
28
+ [c.WARN_SPLITS_FILTER_IGNORED, c.LOG_PREFIX_SETTINGS + ': feature flag filters have been configured but will have no effect if mode is not "%s", since synchronization is being deferred to an external tool.'],
29
+ [c.WARN_SPLITS_FILTER_INVALID, c.LOG_PREFIX_SETTINGS + ': feature flag filter at position %s is invalid. It must be an object with a valid filter type ("byName" or "byPrefix") and a list of "values".'],
30
+ [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS + ': feature flag filter configuration must be a non-empty array of filter objects.'],
31
+ [c.WARN_SDK_KEY, c.LOG_PREFIX_SETTINGS + ': You already have %s. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application'],
32
32
  [c.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching MySegments due to an error processing %s notification: %s'],
33
33
  ]);
@@ -8,10 +8,10 @@ import { CONTROL, TREATMENT, TREATMENTS, TREATMENT_WITH_CONFIG, TREATMENTS_WITH_
8
8
  import { IMPRESSION, IMPRESSION_QUEUEING } from '../logger/constants';
9
9
  import { isStorageSync } from '../trackers/impressionObserver/utils';
10
10
  var treatmentNotReady = { treatment: CONTROL, label: SDK_NOT_READY };
11
- function treatmentsNotReady(splitNames) {
11
+ function treatmentsNotReady(featureFlagNames) {
12
12
  var evaluations = {};
13
- splitNames.forEach(function (splitName) {
14
- evaluations[splitName] = treatmentNotReady;
13
+ featureFlagNames.forEach(function (featureFlagName) {
14
+ evaluations[featureFlagName] = treatmentNotReady;
15
15
  });
16
16
  return evaluations;
17
17
  }
@@ -21,59 +21,59 @@ function treatmentsNotReady(splitNames) {
21
21
  export function clientFactory(params) {
22
22
  var readinessManager = params.sdkReadinessManager.readinessManager, storage = params.storage, settings = params.settings, impressionsTracker = params.impressionsTracker, eventTracker = params.eventTracker, telemetryTracker = params.telemetryTracker;
23
23
  var log = settings.log, mode = settings.mode;
24
- function getTreatment(key, splitName, attributes, withConfig) {
24
+ function getTreatment(key, featureFlagName, attributes, withConfig) {
25
25
  if (withConfig === void 0) { withConfig = false; }
26
26
  var stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENT_WITH_CONFIG : TREATMENT);
27
27
  var wrapUp = function (evaluationResult) {
28
28
  var queue = [];
29
- var treatment = processEvaluation(evaluationResult, splitName, key, attributes, withConfig, "getTreatment" + (withConfig ? 'withConfig' : ''), queue);
29
+ var treatment = processEvaluation(evaluationResult, featureFlagName, key, attributes, withConfig, "getTreatment" + (withConfig ? 'withConfig' : ''), queue);
30
30
  impressionsTracker.track(queue, attributes);
31
31
  stopTelemetryTracker(queue[0] && queue[0].label);
32
32
  return treatment;
33
33
  };
34
34
  var evaluation = readinessManager.isReady() || readinessManager.isReadyFromCache() ?
35
- evaluateFeature(log, key, splitName, attributes, storage) :
35
+ evaluateFeature(log, key, featureFlagName, attributes, storage) :
36
36
  isStorageSync(settings) ? // If the SDK is not ready, treatment may be incorrect due to having splits but not segments data, or storage is not connected
37
37
  treatmentNotReady :
38
38
  Promise.resolve(treatmentNotReady); // Promisify if async
39
39
  return thenable(evaluation) ? evaluation.then(function (res) { return wrapUp(res); }) : wrapUp(evaluation);
40
40
  }
41
- function getTreatmentWithConfig(key, splitName, attributes) {
42
- return getTreatment(key, splitName, attributes, true);
41
+ function getTreatmentWithConfig(key, featureFlagName, attributes) {
42
+ return getTreatment(key, featureFlagName, attributes, true);
43
43
  }
44
- function getTreatments(key, splitNames, attributes, withConfig) {
44
+ function getTreatments(key, featureFlagNames, attributes, withConfig) {
45
45
  if (withConfig === void 0) { withConfig = false; }
46
46
  var stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENTS_WITH_CONFIG : TREATMENTS);
47
47
  var wrapUp = function (evaluationResults) {
48
48
  var queue = [];
49
49
  var treatments = {};
50
- Object.keys(evaluationResults).forEach(function (splitName) {
51
- treatments[splitName] = processEvaluation(evaluationResults[splitName], splitName, key, attributes, withConfig, "getTreatments" + (withConfig ? 'withConfig' : ''), queue);
50
+ Object.keys(evaluationResults).forEach(function (featureFlagName) {
51
+ treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, attributes, withConfig, "getTreatments" + (withConfig ? 'withConfig' : ''), queue);
52
52
  });
53
53
  impressionsTracker.track(queue, attributes);
54
54
  stopTelemetryTracker(queue[0] && queue[0].label);
55
55
  return treatments;
56
56
  };
57
57
  var evaluations = readinessManager.isReady() || readinessManager.isReadyFromCache() ?
58
- evaluateFeatures(log, key, splitNames, attributes, storage) :
58
+ evaluateFeatures(log, key, featureFlagNames, attributes, storage) :
59
59
  isStorageSync(settings) ? // If the SDK is not ready, treatment may be incorrect due to having splits but not segments data, or storage is not connected
60
- treatmentsNotReady(splitNames) :
61
- Promise.resolve(treatmentsNotReady(splitNames)); // Promisify if async
60
+ treatmentsNotReady(featureFlagNames) :
61
+ Promise.resolve(treatmentsNotReady(featureFlagNames)); // Promisify if async
62
62
  return thenable(evaluations) ? evaluations.then(function (res) { return wrapUp(res); }) : wrapUp(evaluations);
63
63
  }
64
- function getTreatmentsWithConfig(key, splitNames, attributes) {
65
- return getTreatments(key, splitNames, attributes, true);
64
+ function getTreatmentsWithConfig(key, featureFlagNames, attributes) {
65
+ return getTreatments(key, featureFlagNames, attributes, true);
66
66
  }
67
67
  // Internal function
68
- function processEvaluation(evaluation, splitName, key, attributes, withConfig, invokingMethodName, queue) {
68
+ function processEvaluation(evaluation, featureFlagName, key, attributes, withConfig, invokingMethodName, queue) {
69
69
  var matchingKey = getMatching(key);
70
70
  var bucketingKey = getBucketing(key);
71
71
  var treatment = evaluation.treatment, label = evaluation.label, changeNumber = evaluation.changeNumber, _a = evaluation.config, config = _a === void 0 ? null : _a;
72
- log.info(IMPRESSION, [splitName, matchingKey, treatment, label]);
73
- if (validateSplitExistance(log, readinessManager, splitName, label, invokingMethodName)) {
72
+ log.info(IMPRESSION, [featureFlagName, matchingKey, treatment, label]);
73
+ if (validateSplitExistance(log, readinessManager, featureFlagName, label, invokingMethodName)) {
74
74
  log.info(IMPRESSION_QUEUEING);
75
75
  queue.push({
76
- feature: splitName,
76
+ feature: featureFlagName,
77
77
  keyName: matchingKey,
78
78
  treatment: treatment,
79
79
  time: Date.now(),
@@ -12,17 +12,17 @@ export function clientAttributesDecoration(log, client) {
12
12
  var clientGetTreatments = client.getTreatments;
13
13
  var clientGetTreatmentsWithConfig = client.getTreatmentsWithConfig;
14
14
  var clientTrack = client.track;
15
- function getTreatment(maybeKey, maybeSplit, maybeAttributes) {
16
- return clientGetTreatment(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
15
+ function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes) {
16
+ return clientGetTreatment(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
17
17
  }
18
- function getTreatmentWithConfig(maybeKey, maybeSplit, maybeAttributes) {
19
- return clientGetTreatmentWithConfig(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
18
+ function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes) {
19
+ return clientGetTreatmentWithConfig(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
20
20
  }
21
- function getTreatments(maybeKey, maybeSplits, maybeAttributes) {
22
- return clientGetTreatments(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
21
+ function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
22
+ return clientGetTreatments(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
23
23
  }
24
- function getTreatmentsWithConfig(maybeKey, maybeSplits, maybeAttributes) {
25
- return clientGetTreatmentsWithConfig(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
24
+ function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
25
+ return clientGetTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
26
26
  }
27
27
  function track(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties) {
28
28
  return clientTrack(maybeKey, maybeTT, maybeEvent, maybeEventValue, maybeProperties);
@@ -13,10 +13,10 @@ export function clientInputValidationDecorator(settings, client, readinessManage
13
13
  /**
14
14
  * Avoid repeating this validations code
15
15
  */
16
- function validateEvaluationParams(maybeKey, maybeSplitOrSplits, maybeAttributes, methodName) {
16
+ function validateEvaluationParams(maybeKey, maybeFeatureFlagNameOrNames, maybeAttributes, methodName) {
17
17
  var multi = startsWith(methodName, 'getTreatments');
18
18
  var key = validateKey(log, maybeKey, methodName);
19
- var splitOrSplits = multi ? validateSplits(log, maybeSplitOrSplits, methodName) : validateSplit(log, maybeSplitOrSplits, methodName);
19
+ var splitOrSplits = multi ? validateSplits(log, maybeFeatureFlagNameOrNames, methodName) : validateSplit(log, maybeFeatureFlagNameOrNames, methodName);
20
20
  var attributes = validateAttributes(log, maybeAttributes, methodName);
21
21
  var isOperational = validateIfNotDestroyed(log, readinessManager, methodName);
22
22
  validateIfOperational(log, readinessManager, methodName);
@@ -31,8 +31,8 @@ export function clientInputValidationDecorator(settings, client, readinessManage
31
31
  function wrapResult(value) {
32
32
  return isSync ? value : Promise.resolve(value);
33
33
  }
34
- function getTreatment(maybeKey, maybeSplit, maybeAttributes) {
35
- var params = validateEvaluationParams(maybeKey, maybeSplit, maybeAttributes, 'getTreatment');
34
+ function getTreatment(maybeKey, maybeFeatureFlagName, maybeAttributes) {
35
+ var params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, 'getTreatment');
36
36
  if (params.valid) {
37
37
  return client.getTreatment(params.key, params.splitOrSplits, params.attributes);
38
38
  }
@@ -40,8 +40,8 @@ export function clientInputValidationDecorator(settings, client, readinessManage
40
40
  return wrapResult(CONTROL);
41
41
  }
42
42
  }
43
- function getTreatmentWithConfig(maybeKey, maybeSplit, maybeAttributes) {
44
- var params = validateEvaluationParams(maybeKey, maybeSplit, maybeAttributes, 'getTreatmentWithConfig');
43
+ function getTreatmentWithConfig(maybeKey, maybeFeatureFlagName, maybeAttributes) {
44
+ var params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, 'getTreatmentWithConfig');
45
45
  if (params.valid) {
46
46
  return client.getTreatmentWithConfig(params.key, params.splitOrSplits, params.attributes);
47
47
  }
@@ -49,8 +49,8 @@ export function clientInputValidationDecorator(settings, client, readinessManage
49
49
  return wrapResult(objectAssign({}, CONTROL_WITH_CONFIG));
50
50
  }
51
51
  }
52
- function getTreatments(maybeKey, maybeSplits, maybeAttributes) {
53
- var params = validateEvaluationParams(maybeKey, maybeSplits, maybeAttributes, 'getTreatments');
52
+ function getTreatments(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
53
+ var params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, 'getTreatments');
54
54
  if (params.valid) {
55
55
  return client.getTreatments(params.key, params.splitOrSplits, params.attributes);
56
56
  }
@@ -61,8 +61,8 @@ export function clientInputValidationDecorator(settings, client, readinessManage
61
61
  return wrapResult(res_1);
62
62
  }
63
63
  }
64
- function getTreatmentsWithConfig(maybeKey, maybeSplits, maybeAttributes) {
65
- var params = validateEvaluationParams(maybeKey, maybeSplits, maybeAttributes, 'getTreatmentsWithConfig');
64
+ function getTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, maybeAttributes) {
65
+ var params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, 'getTreatmentsWithConfig');
66
66
  if (params.valid) {
67
67
  return client.getTreatmentsWithConfig(params.key, params.splitOrSplits, params.attributes);
68
68
  }
@@ -49,7 +49,7 @@ export function sdkClientFactory(params, isSharedClient) {
49
49
  // Cleanup event listeners
50
50
  sdkReadinessManager.readinessManager.destroy();
51
51
  signalListener && signalListener.stop();
52
- // Release the API Key if it is the main client
52
+ // Release the SDK Key if it is the main client
53
53
  if (!isSharedClient)
54
54
  releaseApiKey(settings.core.authorizationKey);
55
55
  if (uniqueKeysTracker)
@@ -18,7 +18,7 @@ import { NONE, OPTIMIZED } from '../utils/constants';
18
18
  export function sdkFactory(params) {
19
19
  var settings = params.settings, platform = params.platform, storageFactory = params.storageFactory, splitApiFactory = params.splitApiFactory, extraProps = params.extraProps, syncManagerFactory = params.syncManagerFactory, SignalListener = params.SignalListener, impressionsObserverFactory = params.impressionsObserverFactory, integrationsManagerFactory = params.integrationsManagerFactory, sdkManagerFactory = params.sdkManagerFactory, sdkClientMethodFactory = params.sdkClientMethodFactory, filterAdapterFactory = params.filterAdapterFactory;
20
20
  var log = settings.log, impressionsMode = settings.sync.impressionsMode;
21
- // @TODO handle non-recoverable errors, such as, global `fetch` not available, invalid API Key, etc.
21
+ // @TODO handle non-recoverable errors, such as, global `fetch` not available, invalid SDK Key, etc.
22
22
  // On non-recoverable errors, we should mark the SDK as destroyed and not start synchronization.
23
23
  // We will just log and allow for the SDK to end up throwing an SDK_TIMEOUT event for devs to handle.
24
24
  validateAndTrackApiKey(log, settings.core.authorizationKey);
@@ -2,6 +2,9 @@ import { objectAssign } from '../utils/lang/objectAssign';
2
2
  import { thenable } from '../utils/promise/thenable';
3
3
  import { find } from '../utils/lang';
4
4
  import { validateSplit, validateSplitExistance, validateIfNotDestroyed, validateIfOperational } from '../utils/inputValidation';
5
+ var SPLIT_FN_LABEL = 'split';
6
+ var SPLITS_FN_LABEL = 'splits';
7
+ var NAMES_FN_LABEL = 'names';
5
8
  function collectTreatments(splitObject) {
6
9
  var conditions = splitObject.conditions;
7
10
  // Rollout conditions are supposed to have the entire partitions list, so we find the first one.
@@ -35,15 +38,14 @@ function objectsToViews(splitObjects) {
35
38
  }
36
39
  export function sdkManagerFactory(log, splits, _a) {
37
40
  var readinessManager = _a.readinessManager, sdkStatus = _a.sdkStatus;
38
- var SPLIT_FN_LABEL = 'split';
39
41
  return objectAssign(
40
42
  // Proto-linkage of the readiness Event Emitter
41
43
  Object.create(sdkStatus), {
42
44
  /**
43
- * Get the Split object corresponding to the given split name if valid
45
+ * Get the feature flag object corresponding to the given feature flag name if valid
44
46
  */
45
- split: function (maybeSplitName) {
46
- var splitName = validateSplit(log, maybeSplitName, SPLIT_FN_LABEL);
47
+ split: function (featureFlagName) {
48
+ var splitName = validateSplit(log, featureFlagName, SPLIT_FN_LABEL);
47
49
  if (!validateIfNotDestroyed(log, readinessManager, SPLIT_FN_LABEL) || !validateIfOperational(log, readinessManager, SPLIT_FN_LABEL) || !splitName) {
48
50
  return null;
49
51
  }
@@ -58,10 +60,10 @@ export function sdkManagerFactory(log, splits, _a) {
58
60
  return objectToView(split);
59
61
  },
60
62
  /**
61
- * Get the Split objects present on the factory storage
63
+ * Get the feature flag objects present on the factory storage
62
64
  */
63
65
  splits: function () {
64
- if (!validateIfNotDestroyed(log, readinessManager, 'splits') || !validateIfOperational(log, readinessManager, 'splits')) {
66
+ if (!validateIfNotDestroyed(log, readinessManager, SPLITS_FN_LABEL) || !validateIfOperational(log, readinessManager, SPLITS_FN_LABEL)) {
65
67
  return [];
66
68
  }
67
69
  var currentSplits = splits.getAll();
@@ -70,10 +72,10 @@ export function sdkManagerFactory(log, splits, _a) {
70
72
  objectsToViews(currentSplits);
71
73
  },
72
74
  /**
73
- * Get the Split names present on the factory storage
75
+ * Get the feature flag names present on the factory storage
74
76
  */
75
77
  names: function () {
76
- if (!validateIfNotDestroyed(log, readinessManager, 'names') || !validateIfOperational(log, readinessManager, 'names')) {
78
+ if (!validateIfNotDestroyed(log, readinessManager, NAMES_FN_LABEL) || !validateIfOperational(log, readinessManager, NAMES_FN_LABEL)) {
77
79
  return [];
78
80
  }
79
81
  var splitNames = splits.getSplitNames();
@@ -50,7 +50,7 @@ export function splitHttpClientFactory(settings, getFetch, getOptions) {
50
50
  if (resp) { // An HTTP error
51
51
  switch (resp.status) {
52
52
  case 404:
53
- msg = 'Invalid API key or resource not found.';
53
+ msg = 'Invalid SDK key or resource not found.';
54
54
  break;
55
55
  // Don't use resp.statusText since reason phrase is removed in HTTP/2
56
56
  default:
@@ -65,7 +65,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
65
65
  newStringifiedSplit = JSON.stringify(split);
66
66
  }
67
67
  catch (e) {
68
- throw new Error('Error parsing split definition: ' + e);
68
+ throw new Error('Error parsing feature flag definition: ' + e);
69
69
  }
70
70
  return Promise.all([
71
71
  _this.redis.set(splitKey, newStringifiedSplit),
@@ -226,7 +226,7 @@ var SplitsCacheInRedis = /** @class */ (function (_super) {
226
226
  return Promise.resolve(splits);
227
227
  })
228
228
  .catch(function (e) {
229
- _this.log.error(LOG_PREFIX + ("Could not grab splits due to an error: " + e + "."));
229
+ _this.log.error(LOG_PREFIX + ("Could not grab feature flags due to an error: " + e + "."));
230
230
  return Promise.reject(e);
231
231
  });
232
232
  };
@@ -52,7 +52,7 @@ var SplitsCachePluggable = /** @class */ (function (_super) {
52
52
  stringifiedNewSplit = JSON.stringify(split);
53
53
  }
54
54
  catch (e) {
55
- throw new Error('Error parsing split definition: ' + e);
55
+ throw new Error('Error parsing feature flag definition: ' + e);
56
56
  }
57
57
  return Promise.all([
58
58
  _this.wrapper.set(splitKey, stringifiedNewSplit),
@@ -81,7 +81,7 @@ export function segmentChangesUpdaterFactory(log, segmentChangesFetcher, segment
81
81
  // @TODO although factory status is destroyed, synchronization is not stopped
82
82
  if (readiness)
83
83
  readiness.destroy();
84
- log.error(LOG_PREFIX_INSTANTIATION + ": you passed a client-side type authorizationKey, please grab an Api Key from the Split web console that is of type Server-side.");
84
+ log.error(LOG_PREFIX_INSTANTIATION + ": you passed a client-side type authorizationKey, please grab an SDK Key from the Split user interface that is of type server-side.");
85
85
  }
86
86
  else {
87
87
  log.warn(LOG_PREFIX_SYNC_SEGMENTS + "Error while doing fetch of segments. " + error);
@@ -2,7 +2,6 @@ import { _Set, setToArray } from '../../../utils/lang/sets';
2
2
  import { timeout } from '../../../utils/promise/timeout';
3
3
  import { SDK_SPLITS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
4
4
  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
- import { _Map } from '../../../utils/lang/maps';
6
5
  // Checks that all registered segments have been fetched (changeNumber !== -1 for every segment).
7
6
  // Returns a promise that could be rejected.
8
7
  // @TODO review together with Segments and MySegments storage APIs
@@ -35,25 +34,19 @@ export function parseSegments(_a) {
35
34
  * Exported for testing purposes.
36
35
  */
37
36
  export function computeSplitsMutation(entries) {
38
- var uniqueEntries = new _Map();
39
- entries.forEach(function (split) {
40
- var prevSplit = uniqueEntries.get(split.name);
41
- if (!prevSplit || prevSplit.changeNumber < split.changeNumber)
42
- uniqueEntries.set(split.name, split);
43
- });
44
37
  var segments = new _Set();
45
- var computed = { added: [], removed: [], segments: [] };
46
- uniqueEntries.forEach(function (split) {
38
+ var computed = entries.reduce(function (accum, split) {
47
39
  if (split.status === 'ACTIVE') {
48
- computed.added.push([split.name, split]);
40
+ accum.added.push([split.name, split]);
49
41
  parseSegments(split).forEach(function (segmentName) {
50
42
  segments.add(segmentName);
51
43
  });
52
44
  }
53
45
  else {
54
- computed.removed.push(split.name);
46
+ accum.removed.push(split.name);
55
47
  }
56
- });
48
+ return accum;
49
+ }, { added: [], removed: [], segments: [] });
57
50
  computed.segments = setToArray(segments);
58
51
  return computed;
59
52
  }