@splitsoftware/splitio-commons 1.8.1 → 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 (82) hide show
  1. package/CHANGES.txt +6 -3
  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/streaming/pushManager.js +1 -1
  19. package/cjs/sync/submitters/telemetrySubmitter.js +2 -2
  20. package/cjs/utils/inputValidation/apiKey.js +26 -25
  21. package/cjs/utils/inputValidation/preloadedData.js +3 -3
  22. package/cjs/utils/inputValidation/split.js +1 -1
  23. package/cjs/utils/inputValidation/splits.js +2 -2
  24. package/cjs/utils/settingsValidation/index.js +1 -1
  25. package/esm/logger/constants.js +2 -2
  26. package/esm/logger/messages/debug.js +7 -7
  27. package/esm/logger/messages/error.js +2 -2
  28. package/esm/logger/messages/info.js +3 -3
  29. package/esm/logger/messages/warn.js +7 -7
  30. package/esm/sdkClient/client.js +20 -20
  31. package/esm/sdkClient/clientAttributesDecoration.js +8 -8
  32. package/esm/sdkClient/clientInputValidation.js +10 -10
  33. package/esm/sdkClient/sdkClient.js +1 -1
  34. package/esm/sdkFactory/index.js +1 -1
  35. package/esm/sdkManager/index.js +10 -8
  36. package/esm/services/splitHttpClient.js +1 -1
  37. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  38. package/esm/storages/pluggable/SplitsCachePluggable.js +1 -1
  39. package/esm/sync/polling/updaters/segmentChangesUpdater.js +1 -1
  40. package/esm/sync/streaming/pushManager.js +1 -1
  41. package/esm/sync/submitters/telemetrySubmitter.js +2 -2
  42. package/esm/utils/inputValidation/apiKey.js +27 -26
  43. package/esm/utils/inputValidation/preloadedData.js +3 -3
  44. package/esm/utils/inputValidation/split.js +1 -1
  45. package/esm/utils/inputValidation/splits.js +2 -2
  46. package/esm/utils/settingsValidation/index.js +1 -1
  47. package/package.json +2 -2
  48. package/src/logger/constants.ts +2 -2
  49. package/src/logger/messages/debug.ts +7 -7
  50. package/src/logger/messages/error.ts +2 -2
  51. package/src/logger/messages/info.ts +3 -3
  52. package/src/logger/messages/warn.ts +7 -7
  53. package/src/sdkClient/client.ts +20 -20
  54. package/src/sdkClient/clientAttributesDecoration.ts +10 -10
  55. package/src/sdkClient/clientInputValidation.ts +10 -10
  56. package/src/sdkClient/sdkClient.ts +3 -3
  57. package/src/sdkFactory/index.ts +1 -1
  58. package/src/sdkManager/index.ts +11 -8
  59. package/src/services/splitHttpClient.ts +1 -1
  60. package/src/storages/inMemory/AttributesCacheInMemory.ts +7 -6
  61. package/src/storages/inRedis/SplitsCacheInRedis.ts +2 -2
  62. package/src/storages/pluggable/SplitsCachePluggable.ts +1 -1
  63. package/src/sync/polling/updaters/segmentChangesUpdater.ts +1 -1
  64. package/src/sync/streaming/pushManager.ts +1 -1
  65. package/src/sync/submitters/telemetrySubmitter.ts +2 -2
  66. package/src/types.ts +147 -140
  67. package/src/utils/inputValidation/apiKey.ts +25 -24
  68. package/src/utils/inputValidation/preloadedData.ts +3 -3
  69. package/src/utils/inputValidation/split.ts +1 -1
  70. package/src/utils/inputValidation/splits.ts +1 -1
  71. package/src/utils/settingsValidation/index.ts +1 -1
  72. package/types/logger/constants.d.ts +1 -1
  73. package/types/sdkClient/clientAttributesDecoration.d.ts +7 -7
  74. package/types/storages/inMemory/AttributesCacheInMemory.d.ts +4 -3
  75. package/types/types.d.ts +142 -135
  76. package/types/utils/inputValidation/apiKey.d.ts +5 -5
  77. package/types/utils/inputValidation/sdkKey.d.ts +7 -0
  78. package/types/utils/settingsValidation/index.d.ts +1 -1
  79. package/types/storages/metadataBuilder.d.ts +0 -3
  80. /package/types/storages/inMemory/{uniqueKeysCacheInMemory.d.ts → UniqueKeysCacheInMemory.d.ts} +0 -0
  81. /package/types/storages/inMemory/{uniqueKeysCacheInMemoryCS.d.ts → UniqueKeysCacheInMemoryCS.d.ts} +0 -0
  82. /package/types/storages/inRedis/{uniqueKeysCacheInRedis.d.ts → UniqueKeysCacheInRedis.d.ts} +0 -0
@@ -3,7 +3,7 @@ import { isString } from '../lang';
3
3
  // include BOM and nbsp
4
4
  var TRIMMABLE_SPACES_REGEX = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;
5
5
  export function validateSplit(log, maybeSplit, method, item) {
6
- if (item === void 0) { item = 'split name'; }
6
+ if (item === void 0) { item = 'feature flag name'; }
7
7
  if (maybeSplit == undefined) { // eslint-disable-line eqeqeq
8
8
  log.error(ERROR_NULL, [method, item]);
9
9
  }
@@ -2,8 +2,8 @@ import { ERROR_EMPTY_ARRAY } from '../../logger/constants';
2
2
  import { uniq } from '../lang';
3
3
  import { validateSplit } from './split';
4
4
  export function validateSplits(log, maybeSplits, method, listName, item) {
5
- if (listName === void 0) { listName = 'split_names'; }
6
- if (item === void 0) { item = 'split name'; }
5
+ if (listName === void 0) { listName = 'feature flag names'; }
6
+ if (item === void 0) { item = 'feature flag name'; }
7
7
  if (Array.isArray(maybeSplits) && maybeSplits.length > 0) {
8
8
  var validatedArray_1 = [];
9
9
  // Remove invalid values
@@ -81,7 +81,7 @@ function fromSecondsToMillis(n) {
81
81
  }
82
82
  /**
83
83
  * Validates the given config and use it to build a settings object.
84
- * NOTE: it doesn't validate the Api Key. Call `validateApikey` or `validateAndTrackApiKey` for that after settings validation.
84
+ * NOTE: it doesn't validate the SDK Key. Call `validateApiKey` or `validateAndTrackApiKey` for that after settings validation.
85
85
  *
86
86
  * @param config user defined configuration
87
87
  * @param validationParams defaults and fields validators used to validate and creates a settings object from a given config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "1.8.1",
3
+ "version": "1.8.2-rc.1",
4
4
  "description": "Split Javascript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -22,7 +22,7 @@
22
22
  "build": "npm run build:cjs && npm run build:esm",
23
23
  "build:esm": "rimraf esm && tsc -m es2015 --outDir esm -d true --declarationDir types",
24
24
  "build:cjs": "rimraf cjs && tsc -m CommonJS --outDir cjs",
25
- "test": "jest",
25
+ "test": "jest --runInBand",
26
26
  "test:coverage": "jest --coverage",
27
27
  "all": "npm run check && npm run build && npm run test",
28
28
  "publish:rc": "npm run check && npm run test && npm run build && npm publish --tag rc",
@@ -94,7 +94,7 @@ export const WARN_INTEGRATION_INVALID = 218;
94
94
  export const WARN_SPLITS_FILTER_IGNORED = 219;
95
95
  export const WARN_SPLITS_FILTER_INVALID = 220;
96
96
  export const WARN_SPLITS_FILTER_EMPTY = 221;
97
- export const WARN_API_KEY = 222;
97
+ export const WARN_SDK_KEY = 222;
98
98
  export const STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2 = 223;
99
99
 
100
100
  export const ERROR_ENGINE_COMBINER_IFELSEIF = 300;
@@ -136,7 +136,7 @@ export const LOG_PREFIX_SYNC = 'sync';
136
136
  export const LOG_PREFIX_SYNC_MANAGER = LOG_PREFIX_SYNC + ':sync-manager: ';
137
137
  export const LOG_PREFIX_SYNC_OFFLINE = LOG_PREFIX_SYNC + ':offline: ';
138
138
  export const LOG_PREFIX_SYNC_STREAMING = LOG_PREFIX_SYNC + ':streaming: ';
139
- export const LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':split-changes: ';
139
+ export const LOG_PREFIX_SYNC_SPLITS = LOG_PREFIX_SYNC + ':featureflag-changes: ';
140
140
  export const LOG_PREFIX_SYNC_SEGMENTS = LOG_PREFIX_SYNC + ':segment-changes: ';
141
141
  export const LOG_PREFIX_SYNC_MYSEGMENTS = LOG_PREFIX_SYNC + ':my-segments: ';
142
142
  export const LOG_PREFIX_SYNC_POLLING = LOG_PREFIX_SYNC + ':polling-manager: ';
@@ -13,8 +13,8 @@ export const codesDebug: [number, string][] = codesInfo.concat([
13
13
  [c.ENGINE_MATCHER_CONTAINS_ALL, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAllMatcher] %s contains all elements of %s? %s'],
14
14
  [c.ENGINE_MATCHER_CONTAINS_ANY, c.LOG_PREFIX_ENGINE_MATCHER + '[containsAnyMatcher] %s contains at least an element of %s? %s'],
15
15
  [c.ENGINE_MATCHER_CONTAINS_STRING, c.LOG_PREFIX_ENGINE_MATCHER + '[containsStringMatcher] %s contains %s? %s'],
16
- [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.'],
17
- [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent split: "%s" with key: %s %s'],
16
+ [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.'],
17
+ [c.ENGINE_MATCHER_DEPENDENCY_PRE, c.LOG_PREFIX_ENGINE_MATCHER + '[dependencyMatcher] will evaluate parent feature flag: "%s" with key: %s %s'],
18
18
  [c.ENGINE_MATCHER_EQUAL, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToMatcher] is %s equal to %s? %s'],
19
19
  [c.ENGINE_MATCHER_EQUAL_TO_SET, c.LOG_PREFIX_ENGINE_MATCHER + '[equalToSetMatcher] is %s equal to set %s? %s'],
20
20
  [c.ENGINE_MATCHER_ENDS_WITH, c.LOG_PREFIX_ENGINE_MATCHER + '[endsWithMatcher] %s ends with %s? %s'],
@@ -35,15 +35,15 @@ export const codesDebug: [number, string][] = codesInfo.concat([
35
35
  [c.RETRIEVE_CLIENT_EXISTING, 'Retrieving existing SDK client.'],
36
36
  [c.RETRIEVE_MANAGER, 'Retrieving manager instance.'],
37
37
  // synchronizer
38
- [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Splits data: \n%s'],
39
- [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up split update using since = %s'],
40
- [c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New splits %s'],
41
- [c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed splits %s'],
38
+ [c.SYNC_OFFLINE_DATA, c.LOG_PREFIX_SYNC_OFFLINE + 'Feature flags data: \n%s'],
39
+ [c.SYNC_SPLITS_FETCH, c.LOG_PREFIX_SYNC_SPLITS + 'Spin up feature flags update using since = %s'],
40
+ [c.SYNC_SPLITS_NEW, c.LOG_PREFIX_SYNC_SPLITS + 'New feature flags %s'],
41
+ [c.SYNC_SPLITS_REMOVED, c.LOG_PREFIX_SYNC_SPLITS + 'Removed feature flags %s'],
42
42
  [c.SYNC_SPLITS_SEGMENTS, c.LOG_PREFIX_SYNC_SPLITS + 'Segment names collected %s'],
43
43
  [c.STREAMING_NEW_MESSAGE, c.LOG_PREFIX_SYNC_STREAMING + 'New SSE message received, with data: %s.'],
44
44
  [c.SYNC_TASK_START, c.LOG_PREFIX_SYNC + ': Starting %s. Running each %s millis'],
45
45
  [c.SYNC_TASK_EXECUTE, c.LOG_PREFIX_SYNC + ': Running %s'],
46
46
  [c.SYNC_TASK_STOP, c.LOG_PREFIX_SYNC + ': Stopping %s'],
47
47
  // initialization / settings validation
48
- [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': splits filtering criteria is "%s".']
48
+ [c.SETTINGS_SPLITS_FILTER, c.LOG_PREFIX_SETTINGS + ': feature flags filtering criteria is "%s".']
49
49
  ]);
@@ -2,7 +2,7 @@ import * as c from '../constants';
2
2
 
3
3
  export const codesError: [number, string][] = [
4
4
  // evaluator
5
- [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid Split, no valid rules found'],
5
+ [c.ERROR_ENGINE_COMBINER_IFELSEIF, c.LOG_PREFIX_ENGINE_COMBINER + 'Invalid feature flag, no valid rules found'],
6
6
  // SDK
7
7
  [c.ERROR_LOGLEVEL_INVALID, 'logger: Invalid Log Level - No changes to the logs will be applied.'],
8
8
  [c.ERROR_CLIENT_CANNOT_GET_READY, 'The SDK will not get ready. Reason: %s'],
@@ -10,7 +10,7 @@ export const codesError: [number, string][] = [
10
10
  [c.ERROR_IMPRESSIONS_LISTENER, c.LOG_PREFIX_IMPRESSIONS_TRACKER + 'Impression listener logImpression method threw: %s.'],
11
11
  [c.ERROR_EVENTS_TRACKER, c.LOG_PREFIX_EVENTS_TRACKER + 'Failed to queue %s'],
12
12
  // synchronizer
13
- [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'],
13
+ [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'],
14
14
  [c.ERROR_STREAMING_SSE, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to connect or error on streaming connection, with error message: %s'],
15
15
  [c.ERROR_STREAMING_AUTH, c.LOG_PREFIX_SYNC_STREAMING + 'Failed to authenticate for streaming. Error: %s.'],
16
16
  [c.ERROR_HTTP, 'Response status is not OK. Status: %s. URL: %s. Message: %s'],
@@ -8,7 +8,7 @@ export const codesInfo: [number, string][] = codesWarn.concat([
8
8
  [c.CLIENT_READY_FROM_CACHE, READY_MSG + ' from cache'],
9
9
  [c.CLIENT_READY, READY_MSG],
10
10
  // SDK
11
- [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Split: %s. Key: %s. Evaluation: %s. Label: %s'],
11
+ [c.IMPRESSION, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Feature flag: %s. Key: %s. Evaluation: %s. Label: %s'],
12
12
  [c.IMPRESSION_QUEUEING, c.LOG_PREFIX_IMPRESSIONS_TRACKER +'Queueing corresponding impression.'],
13
13
  [c.NEW_SHARED_CLIENT, 'New shared client instance created.'],
14
14
  [c.NEW_FACTORY, 'New Split SDK instance created.'],
@@ -22,13 +22,13 @@ export const codesInfo: [number, string][] = codesWarn.concat([
22
22
  [c.POLLING_SMART_PAUSING, c.LOG_PREFIX_SYNC_POLLING + 'Turning segments data polling %s.'],
23
23
  [c.POLLING_START, c.LOG_PREFIX_SYNC_POLLING + 'Starting polling'],
24
24
  [c.POLLING_STOP, c.LOG_PREFIX_SYNC_POLLING + 'Stopping polling'],
25
- [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of splits #%s. Reason: %s'],
25
+ [c.SYNC_SPLITS_FETCH_RETRY, c.LOG_PREFIX_SYNC_SPLITS + 'Retrying download of feature flags #%s. Reason: %s'],
26
26
  [c.SUBMITTERS_PUSH_FULL_QUEUE, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Flushing full %s queue and reseting timer.'],
27
27
  [c.SUBMITTERS_PUSH, c.LOG_PREFIX_SYNC_SUBMITTERS + 'Pushing %s.'],
28
28
  [c.STREAMING_REFRESH_TOKEN, c.LOG_PREFIX_SYNC_STREAMING + 'Refreshing streaming token in %s seconds, and connecting streaming in %s seconds.'],
29
29
  [c.STREAMING_RECONNECT, c.LOG_PREFIX_SYNC_STREAMING + 'Attempting to reconnect streaming in %s seconds.'],
30
30
  [c.STREAMING_CONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Connecting streaming.'],
31
- [c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given Api key. Switching to polling mode.'],
31
+ [c.STREAMING_DISABLED, c.LOG_PREFIX_SYNC_STREAMING + 'Streaming is disabled for given SDK key. Switching to polling mode.'],
32
32
  [c.STREAMING_DISCONNECTING, c.LOG_PREFIX_SYNC_STREAMING + 'Disconnecting streaming.'],
33
33
  [c.SYNC_START_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming not available. Starting polling.'],
34
34
  [c.SYNC_CONTINUE_POLLING, c.LOG_PREFIX_SYNC_MANAGER + 'Streaming couldn\'t connect. Continue polling.'],
@@ -7,7 +7,7 @@ export const codesWarn: [number, string][] = codesError.concat([
7
7
  [c.ENGINE_VALUE_NO_ATTRIBUTES, c.LOG_PREFIX_ENGINE_VALUE + 'Defined attribute [%s], no attributes received.'],
8
8
  // synchronizer
9
9
  [c.SYNC_MYSEGMENTS_FETCH_RETRY, c.LOG_PREFIX_SYNC_MYSEGMENTS + 'Retrying download of segments #%s. Reason: %s'],
10
- [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of Splits. %s'],
10
+ [c.SYNC_SPLITS_FETCH_FAILS, c.LOG_PREFIX_SYNC_SPLITS + 'Error while doing fetch of feature flags. %s'],
11
11
  [c.STREAMING_PARSING_ERROR_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE error notification: %s'],
12
12
  [c.STREAMING_PARSING_MESSAGE_FAILS, c.LOG_PREFIX_SYNC_STREAMING + 'Error parsing SSE message notification: %s'],
13
13
  [c.STREAMING_FALLBACK, c.LOG_PREFIX_SYNC_STREAMING + 'Falling back to polling mode. Reason: %s'],
@@ -21,15 +21,15 @@ export const codesWarn: [number, string][] = codesError.concat([
21
21
  [c.WARN_TRIMMING_PROPERTIES, '%s: Event has more than 300 properties. Some of them will be trimmed when processed.'],
22
22
  [c.WARN_CONVERTING, '%s: %s "%s" is not of type string, converting.'],
23
23
  [c.WARN_TRIMMING, '%s: %s "%s" has extra whitespace, trimming.'],
24
- [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.'],
24
+ [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.'],
25
25
  [c.WARN_LOWERCASE_TRAFFIC_TYPE, '%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
26
- [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.'],
26
+ [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.'],
27
27
  // initialization / settings validation
28
28
  [c.WARN_INTEGRATION_INVALID, c.LOG_PREFIX_SETTINGS+': %s integration item(s) at settings is invalid. %s'],
29
- [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.'],
30
- [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".'],
31
- [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS+': splitFilters configuration must be a non-empty array of filter objects.'],
32
- [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'],
29
+ [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.'],
30
+ [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".'],
31
+ [c.WARN_SPLITS_FILTER_EMPTY, c.LOG_PREFIX_SETTINGS+': feature flag filter configuration must be a non-empty array of filter objects.'],
32
+ [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'],
33
33
 
34
34
  [c.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching MySegments due to an error processing %s notification: %s'],
35
35
  ]);
@@ -13,10 +13,10 @@ import { isStorageSync } from '../trackers/impressionObserver/utils';
13
13
 
14
14
  const treatmentNotReady = { treatment: CONTROL, label: SDK_NOT_READY };
15
15
 
16
- function treatmentsNotReady(splitNames: string[]) {
16
+ function treatmentsNotReady(featureFlagNames: string[]) {
17
17
  const evaluations: Record<string, IEvaluationResult> = {};
18
- splitNames.forEach(splitName => {
19
- evaluations[splitName] = treatmentNotReady;
18
+ featureFlagNames.forEach(featureFlagName => {
19
+ evaluations[featureFlagName] = treatmentNotReady;
20
20
  });
21
21
  return evaluations;
22
22
  }
@@ -28,12 +28,12 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
28
28
  const { sdkReadinessManager: { readinessManager }, storage, settings, impressionsTracker, eventTracker, telemetryTracker } = params;
29
29
  const { log, mode } = settings;
30
30
 
31
- function getTreatment(key: SplitIO.SplitKey, splitName: string, attributes: SplitIO.Attributes | undefined, withConfig = false) {
31
+ function getTreatment(key: SplitIO.SplitKey, featureFlagName: string, attributes: SplitIO.Attributes | undefined, withConfig = false) {
32
32
  const stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENT_WITH_CONFIG : TREATMENT);
33
33
 
34
34
  const wrapUp = (evaluationResult: IEvaluationResult) => {
35
35
  const queue: ImpressionDTO[] = [];
36
- const treatment = processEvaluation(evaluationResult, splitName, key, attributes, withConfig, `getTreatment${withConfig ? 'withConfig' : ''}`, queue);
36
+ const treatment = processEvaluation(evaluationResult, featureFlagName, key, attributes, withConfig, `getTreatment${withConfig ? 'withConfig' : ''}`, queue);
37
37
  impressionsTracker.track(queue, attributes);
38
38
 
39
39
  stopTelemetryTracker(queue[0] && queue[0].label);
@@ -41,7 +41,7 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
41
41
  };
42
42
 
43
43
  const evaluation = readinessManager.isReady() || readinessManager.isReadyFromCache() ?
44
- evaluateFeature(log, key, splitName, attributes, storage) :
44
+ evaluateFeature(log, key, featureFlagName, attributes, storage) :
45
45
  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
46
46
  treatmentNotReady :
47
47
  Promise.resolve(treatmentNotReady); // Promisify if async
@@ -49,18 +49,18 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
49
49
  return thenable(evaluation) ? evaluation.then((res) => wrapUp(res)) : wrapUp(evaluation);
50
50
  }
51
51
 
52
- function getTreatmentWithConfig(key: SplitIO.SplitKey, splitName: string, attributes: SplitIO.Attributes | undefined) {
53
- return getTreatment(key, splitName, attributes, true);
52
+ function getTreatmentWithConfig(key: SplitIO.SplitKey, featureFlagName: string, attributes: SplitIO.Attributes | undefined) {
53
+ return getTreatment(key, featureFlagName, attributes, true);
54
54
  }
55
55
 
56
- function getTreatments(key: SplitIO.SplitKey, splitNames: string[], attributes: SplitIO.Attributes | undefined, withConfig = false) {
56
+ function getTreatments(key: SplitIO.SplitKey, featureFlagNames: string[], attributes: SplitIO.Attributes | undefined, withConfig = false) {
57
57
  const stopTelemetryTracker = telemetryTracker.trackEval(withConfig ? TREATMENTS_WITH_CONFIG : TREATMENTS);
58
58
 
59
59
  const wrapUp = (evaluationResults: Record<string, IEvaluationResult>) => {
60
60
  const queue: ImpressionDTO[] = [];
61
61
  const treatments: Record<string, SplitIO.Treatment | SplitIO.TreatmentWithConfig> = {};
62
- Object.keys(evaluationResults).forEach(splitName => {
63
- treatments[splitName] = processEvaluation(evaluationResults[splitName], splitName, key, attributes, withConfig, `getTreatments${withConfig ? 'withConfig' : ''}`, queue);
62
+ Object.keys(evaluationResults).forEach(featureFlagName => {
63
+ treatments[featureFlagName] = processEvaluation(evaluationResults[featureFlagName], featureFlagName, key, attributes, withConfig, `getTreatments${withConfig ? 'withConfig' : ''}`, queue);
64
64
  });
65
65
  impressionsTracker.track(queue, attributes);
66
66
 
@@ -69,22 +69,22 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
69
69
  };
70
70
 
71
71
  const evaluations = readinessManager.isReady() || readinessManager.isReadyFromCache() ?
72
- evaluateFeatures(log, key, splitNames, attributes, storage) :
72
+ evaluateFeatures(log, key, featureFlagNames, attributes, storage) :
73
73
  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
74
- treatmentsNotReady(splitNames) :
75
- Promise.resolve(treatmentsNotReady(splitNames)); // Promisify if async
74
+ treatmentsNotReady(featureFlagNames) :
75
+ Promise.resolve(treatmentsNotReady(featureFlagNames)); // Promisify if async
76
76
 
77
77
  return thenable(evaluations) ? evaluations.then((res) => wrapUp(res)) : wrapUp(evaluations);
78
78
  }
79
79
 
80
- function getTreatmentsWithConfig(key: SplitIO.SplitKey, splitNames: string[], attributes: SplitIO.Attributes | undefined) {
81
- return getTreatments(key, splitNames, attributes, true);
80
+ function getTreatmentsWithConfig(key: SplitIO.SplitKey, featureFlagNames: string[], attributes: SplitIO.Attributes | undefined) {
81
+ return getTreatments(key, featureFlagNames, attributes, true);
82
82
  }
83
83
 
84
84
  // Internal function
85
85
  function processEvaluation(
86
86
  evaluation: IEvaluationResult,
87
- splitName: string,
87
+ featureFlagName: string,
88
88
  key: SplitIO.SplitKey,
89
89
  attributes: SplitIO.Attributes | undefined,
90
90
  withConfig: boolean,
@@ -95,12 +95,12 @@ export function clientFactory(params: ISdkFactoryContext): SplitIO.IClient | Spl
95
95
  const bucketingKey = getBucketing(key);
96
96
 
97
97
  const { treatment, label, changeNumber, config = null } = evaluation;
98
- log.info(IMPRESSION, [splitName, matchingKey, treatment, label]);
98
+ log.info(IMPRESSION, [featureFlagName, matchingKey, treatment, label]);
99
99
 
100
- if (validateSplitExistance(log, readinessManager, splitName, label, invokingMethodName)) {
100
+ if (validateSplitExistance(log, readinessManager, featureFlagName, label, invokingMethodName)) {
101
101
  log.info(IMPRESSION_QUEUEING);
102
102
  queue.push({
103
- feature: splitName,
103
+ feature: featureFlagName,
104
104
  keyName: matchingKey,
105
105
  treatment,
106
106
  time: Date.now(),
@@ -18,20 +18,20 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
18
18
  const clientGetTreatmentsWithConfig = client.getTreatmentsWithConfig;
19
19
  const clientTrack = client.track;
20
20
 
21
- function getTreatment(maybeKey: SplitIO.SplitKey, maybeSplit: string, maybeAttributes?: SplitIO.Attributes) {
22
- return clientGetTreatment(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
21
+ function getTreatment(maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes) {
22
+ return clientGetTreatment(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
23
23
  }
24
24
 
25
- function getTreatmentWithConfig(maybeKey: SplitIO.SplitKey, maybeSplit: string, maybeAttributes?: SplitIO.Attributes) {
26
- return clientGetTreatmentWithConfig(maybeKey, maybeSplit, combineAttributes(maybeAttributes));
25
+ function getTreatmentWithConfig(maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes) {
26
+ return clientGetTreatmentWithConfig(maybeKey, maybeFeatureFlagName, combineAttributes(maybeAttributes));
27
27
  }
28
28
 
29
- function getTreatments(maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes) {
30
- return clientGetTreatments(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
29
+ function getTreatments(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes) {
30
+ return clientGetTreatments(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
31
31
  }
32
32
 
33
- function getTreatmentsWithConfig(maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes) {
34
- return clientGetTreatmentsWithConfig(maybeKey, maybeSplits, combineAttributes(maybeAttributes));
33
+ function getTreatmentsWithConfig(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes) {
34
+ return clientGetTreatmentsWithConfig(maybeKey, maybeFeatureFlagNames, combineAttributes(maybeAttributes));
35
35
  }
36
36
 
37
37
  function track(maybeKey: SplitIO.SplitKey, maybeTT: string, maybeEvent: string, maybeEventValue?: number, maybeProperties?: SplitIO.Properties) {
@@ -60,7 +60,7 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
60
60
  * @param {string, number, boolean, list} attributeValue Attribute value
61
61
  * @returns {boolean} true if the attribute was stored and false otherways
62
62
  */
63
- setAttribute(attributeName: string, attributeValue: Object) {
63
+ setAttribute(attributeName: string, attributeValue: SplitIO.AttributeType) {
64
64
  const attribute: Record<string, Object> = {};
65
65
  attribute[attributeName] = attributeValue;
66
66
  if (!validateAttributesDeep(log, attribute, 'setAttribute')) return false;
@@ -95,7 +95,7 @@ export function clientAttributesDecoration<TClient extends SplitIO.IClient | Spl
95
95
  *
96
96
  * @returns {Object} returns all the stored attributes
97
97
  */
98
- getAttributes(): Record<string, Object> {
98
+ getAttributes() {
99
99
  return attributeStorage.getAll();
100
100
  },
101
101
 
@@ -30,10 +30,10 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
30
30
  /**
31
31
  * Avoid repeating this validations code
32
32
  */
33
- function validateEvaluationParams(maybeKey: SplitIO.SplitKey, maybeSplitOrSplits: string | string[], maybeAttributes: SplitIO.Attributes | undefined, methodName: string) {
33
+ function validateEvaluationParams(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNameOrNames: string | string[], maybeAttributes: SplitIO.Attributes | undefined, methodName: string) {
34
34
  const multi = startsWith(methodName, 'getTreatments');
35
35
  const key = validateKey(log, maybeKey, methodName);
36
- const splitOrSplits = multi ? validateSplits(log, maybeSplitOrSplits, methodName) : validateSplit(log, maybeSplitOrSplits, methodName);
36
+ const splitOrSplits = multi ? validateSplits(log, maybeFeatureFlagNameOrNames, methodName) : validateSplit(log, maybeFeatureFlagNameOrNames, methodName);
37
37
  const attributes = validateAttributes(log, maybeAttributes, methodName);
38
38
  const isOperational = validateIfNotDestroyed(log, readinessManager, methodName);
39
39
 
@@ -53,8 +53,8 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
53
53
  return isSync ? value : Promise.resolve(value);
54
54
  }
55
55
 
56
- function getTreatment(maybeKey: SplitIO.SplitKey, maybeSplit: string, maybeAttributes?: SplitIO.Attributes) {
57
- const params = validateEvaluationParams(maybeKey, maybeSplit, maybeAttributes, 'getTreatment');
56
+ function getTreatment(maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes) {
57
+ const params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, 'getTreatment');
58
58
 
59
59
  if (params.valid) {
60
60
  return client.getTreatment(params.key as SplitIO.SplitKey, params.splitOrSplits as string, params.attributes as SplitIO.Attributes | undefined);
@@ -63,8 +63,8 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
63
63
  }
64
64
  }
65
65
 
66
- function getTreatmentWithConfig(maybeKey: SplitIO.SplitKey, maybeSplit: string, maybeAttributes?: SplitIO.Attributes) {
67
- const params = validateEvaluationParams(maybeKey, maybeSplit, maybeAttributes, 'getTreatmentWithConfig');
66
+ function getTreatmentWithConfig(maybeKey: SplitIO.SplitKey, maybeFeatureFlagName: string, maybeAttributes?: SplitIO.Attributes) {
67
+ const params = validateEvaluationParams(maybeKey, maybeFeatureFlagName, maybeAttributes, 'getTreatmentWithConfig');
68
68
 
69
69
  if (params.valid) {
70
70
  return client.getTreatmentWithConfig(params.key as SplitIO.SplitKey, params.splitOrSplits as string, params.attributes as SplitIO.Attributes | undefined);
@@ -73,8 +73,8 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
73
73
  }
74
74
  }
75
75
 
76
- function getTreatments(maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes) {
77
- const params = validateEvaluationParams(maybeKey, maybeSplits, maybeAttributes, 'getTreatments');
76
+ function getTreatments(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes) {
77
+ const params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, 'getTreatments');
78
78
 
79
79
  if (params.valid) {
80
80
  return client.getTreatments(params.key as SplitIO.SplitKey, params.splitOrSplits as string[], params.attributes as SplitIO.Attributes | undefined);
@@ -86,8 +86,8 @@ export function clientInputValidationDecorator<TClient extends SplitIO.IClient |
86
86
  }
87
87
  }
88
88
 
89
- function getTreatmentsWithConfig(maybeKey: SplitIO.SplitKey, maybeSplits: string[], maybeAttributes?: SplitIO.Attributes) {
90
- const params = validateEvaluationParams(maybeKey, maybeSplits, maybeAttributes, 'getTreatmentsWithConfig');
89
+ function getTreatmentsWithConfig(maybeKey: SplitIO.SplitKey, maybeFeatureFlagNames: string[], maybeAttributes?: SplitIO.Attributes) {
90
+ const params = validateEvaluationParams(maybeKey, maybeFeatureFlagNames, maybeAttributes, 'getTreatmentsWithConfig');
91
91
 
92
92
  if (params.valid) {
93
93
  return client.getTreatmentsWithConfig(params.key as SplitIO.SplitKey, params.splitOrSplits as string[], params.attributes as SplitIO.Attributes | undefined);
@@ -20,9 +20,9 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
20
20
  //get the actual time elapsed in ms
21
21
  const timeElapsed = now - lastActionTime;
22
22
  //check if the time elapsed is less than desired cooldown
23
- if (timeElapsed < time){
23
+ if (timeElapsed < time) {
24
24
  //if yes, return message with remaining time in seconds
25
- settings.log.warn(`Flush cooldown, remaining time ${(time-timeElapsed)/1000} seconds`);
25
+ settings.log.warn(`Flush cooldown, remaining time ${(time - timeElapsed) / 1000} seconds`);
26
26
  return Promise.resolve();
27
27
  } else {
28
28
  //Do the requested action and re-assign the lastActionTime
@@ -64,7 +64,7 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
64
64
  sdkReadinessManager.readinessManager.destroy();
65
65
  signalListener && signalListener.stop();
66
66
 
67
- // Release the API Key if it is the main client
67
+ // Release the SDK Key if it is the main client
68
68
  if (!isSharedClient) releaseApiKey(settings.core.authorizationKey);
69
69
 
70
70
  if (uniqueKeysTracker) uniqueKeysTracker.stop();
@@ -26,7 +26,7 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ICsSDK | SplitIO.
26
26
  filterAdapterFactory } = params;
27
27
  const { log, sync: { impressionsMode } } = settings;
28
28
 
29
- // @TODO handle non-recoverable errors, such as, global `fetch` not available, invalid API Key, etc.
29
+ // @TODO handle non-recoverable errors, such as, global `fetch` not available, invalid SDK Key, etc.
30
30
  // On non-recoverable errors, we should mark the SDK as destroyed and not start synchronization.
31
31
 
32
32
  // We will just log and allow for the SDK to end up throwing an SDK_TIMEOUT event for devs to handle.
@@ -8,6 +8,10 @@ import { ISplit } from '../dtos/types';
8
8
  import { SplitIO } from '../types';
9
9
  import { ILogger } from '../logger/types';
10
10
 
11
+ const SPLIT_FN_LABEL = 'split';
12
+ const SPLITS_FN_LABEL = 'splits';
13
+ const NAMES_FN_LABEL = 'names';
14
+
11
15
  function collectTreatments(splitObject: ISplit) {
12
16
  const conditions = splitObject.conditions;
13
17
  // Rollout conditions are supposed to have the entire partitions list, so we find the first one.
@@ -47,17 +51,16 @@ export function sdkManagerFactory<TSplitCache extends ISplitsCacheSync | ISplits
47
51
  splits: TSplitCache,
48
52
  { readinessManager, sdkStatus }: ISdkReadinessManager
49
53
  ): TSplitCache extends ISplitsCacheAsync ? SplitIO.IAsyncManager : SplitIO.IManager {
50
- const SPLIT_FN_LABEL = 'split';
51
54
 
52
55
  return objectAssign(
53
56
  // Proto-linkage of the readiness Event Emitter
54
57
  Object.create(sdkStatus),
55
58
  {
56
59
  /**
57
- * Get the Split object corresponding to the given split name if valid
60
+ * Get the feature flag object corresponding to the given feature flag name if valid
58
61
  */
59
- split(maybeSplitName: string) {
60
- const splitName = validateSplit(log, maybeSplitName, SPLIT_FN_LABEL);
62
+ split(featureFlagName: string) {
63
+ const splitName = validateSplit(log, featureFlagName, SPLIT_FN_LABEL);
61
64
  if (!validateIfNotDestroyed(log, readinessManager, SPLIT_FN_LABEL) || !validateIfOperational(log, readinessManager, SPLIT_FN_LABEL) || !splitName) {
62
65
  return null;
63
66
  }
@@ -76,10 +79,10 @@ export function sdkManagerFactory<TSplitCache extends ISplitsCacheSync | ISplits
76
79
  return objectToView(split);
77
80
  },
78
81
  /**
79
- * Get the Split objects present on the factory storage
82
+ * Get the feature flag objects present on the factory storage
80
83
  */
81
84
  splits() {
82
- if (!validateIfNotDestroyed(log, readinessManager, 'splits') || !validateIfOperational(log, readinessManager, 'splits')) {
85
+ if (!validateIfNotDestroyed(log, readinessManager, SPLITS_FN_LABEL) || !validateIfOperational(log, readinessManager, SPLITS_FN_LABEL)) {
83
86
  return [];
84
87
  }
85
88
  const currentSplits = splits.getAll();
@@ -89,10 +92,10 @@ export function sdkManagerFactory<TSplitCache extends ISplitsCacheSync | ISplits
89
92
  objectsToViews(currentSplits);
90
93
  },
91
94
  /**
92
- * Get the Split names present on the factory storage
95
+ * Get the feature flag names present on the factory storage
93
96
  */
94
97
  names() {
95
- if (!validateIfNotDestroyed(log, readinessManager, 'names') || !validateIfOperational(log, readinessManager, 'names')) {
98
+ if (!validateIfNotDestroyed(log, readinessManager, NAMES_FN_LABEL) || !validateIfOperational(log, readinessManager, NAMES_FN_LABEL)) {
96
99
  return [];
97
100
  }
98
101
  const splitNames = splits.getSplitNames();
@@ -55,7 +55,7 @@ export function splitHttpClientFactory(settings: Pick<ISettings, 'log' | 'versio
55
55
 
56
56
  if (resp) { // An HTTP error
57
57
  switch (resp.status) {
58
- case 404: msg = 'Invalid API key or resource not found.';
58
+ case 404: msg = 'Invalid SDK key or resource not found.';
59
59
  break;
60
60
  // Don't use resp.statusText since reason phrase is removed in HTTP/2
61
61
  default: msg = error.message;
@@ -1,8 +1,9 @@
1
+ import { SplitIO } from '../../types';
1
2
  import { objectAssign } from '../../utils/lang/objectAssign';
2
3
 
3
4
  export class AttributesCacheInMemory {
4
5
 
5
- private attributesCache: Record<string, Object> = {};
6
+ private attributesCache: Record<string, SplitIO.AttributeType> = {};
6
7
 
7
8
 
8
9
  /**
@@ -12,7 +13,7 @@ export class AttributesCacheInMemory {
12
13
  * @param {Object} attributeValue attribute value
13
14
  * @returns {boolean} the attribute was stored
14
15
  */
15
- setAttribute(attributeName: string, attributeValue: Object): boolean {
16
+ setAttribute(attributeName: string, attributeValue: SplitIO.AttributeType) {
16
17
  this.attributesCache[attributeName] = attributeValue;
17
18
  return true;
18
19
  }
@@ -23,7 +24,7 @@ export class AttributesCacheInMemory {
23
24
  * @param {string} attributeName attribute name
24
25
  * @returns {Object?} stored attribute value
25
26
  */
26
- getAttribute(attributeName: string): Object {
27
+ getAttribute(attributeName: string) {
27
28
  return this.attributesCache[attributeName];
28
29
  }
29
30
 
@@ -33,7 +34,7 @@ export class AttributesCacheInMemory {
33
34
  * @param {[string, Object]} attributes attributes to create or update
34
35
  * @returns {boolean} attributes were stored
35
36
  */
36
- setAttributes(attributes: Record<string, Object>): boolean {
37
+ setAttributes(attributes: Record<string, Object>) {
37
38
  this.attributesCache = objectAssign(this.attributesCache, attributes);
38
39
  return true;
39
40
  }
@@ -43,7 +44,7 @@ export class AttributesCacheInMemory {
43
44
  *
44
45
  * @returns {Map<string, Object>} stored attributes
45
46
  */
46
- getAll(): Record<string, Object> {
47
+ getAll() {
47
48
  return this.attributesCache;
48
49
  }
49
50
 
@@ -53,7 +54,7 @@ export class AttributesCacheInMemory {
53
54
  * @param {string} attributeName attribute to remove
54
55
  * @returns {boolean} attribute removed
55
56
  */
56
- removeAttribute(attributeName: string): boolean {
57
+ removeAttribute(attributeName: string) {
57
58
  if (Object.keys(this.attributesCache).indexOf(attributeName) >= 0) {
58
59
  delete this.attributesCache[attributeName];
59
60
  return true;
@@ -75,7 +75,7 @@ export class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
75
75
  parsedPreviousSplit = splitFromStorage ? JSON.parse(splitFromStorage) : undefined;
76
76
  newStringifiedSplit = JSON.stringify(split);
77
77
  } catch (e) {
78
- throw new Error('Error parsing split definition: ' + e);
78
+ throw new Error('Error parsing feature flag definition: ' + e);
79
79
  }
80
80
 
81
81
  return Promise.all([
@@ -247,7 +247,7 @@ export class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
247
247
  return Promise.resolve(splits);
248
248
  })
249
249
  .catch(e => {
250
- this.log.error(LOG_PREFIX + `Could not grab splits due to an error: ${e}.`);
250
+ this.log.error(LOG_PREFIX + `Could not grab feature flags due to an error: ${e}.`);
251
251
  return Promise.reject(e);
252
252
  });
253
253
  }
@@ -59,7 +59,7 @@ export class SplitsCachePluggable extends AbstractSplitsCacheAsync {
59
59
  parsedPreviousSplit = splitFromStorage ? JSON.parse(splitFromStorage) : undefined;
60
60
  stringifiedNewSplit = JSON.stringify(split);
61
61
  } catch (e) {
62
- throw new Error('Error parsing split definition: ' + e);
62
+ throw new Error('Error parsing feature flag definition: ' + e);
63
63
  }
64
64
 
65
65
  return Promise.all([
@@ -98,7 +98,7 @@ export function segmentChangesUpdaterFactory(
98
98
  // If the operation is forbidden, it may be due to permissions. Destroy the SDK instance.
99
99
  // @TODO although factory status is destroyed, synchronization is not stopped
100
100
  if (readiness) readiness.destroy();
101
- 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.`);
101
+ 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.`);
102
102
  } else {
103
103
  log.warn(`${LOG_PREFIX_SYNC_SEGMENTS}Error while doing fetch of segments. ${error}`);
104
104
  }
@@ -139,7 +139,7 @@ export function pushManagerFactory(
139
139
 
140
140
  log.error(ERROR_STREAMING_AUTH, [error.message]);
141
141
 
142
- // Handle 4XX HTTP errors: 401 (invalid API Key) or 400 (using incorrect API Key, i.e., client-side API Key on server-side)
142
+ // Handle 4XX HTTP errors: 401 (invalid SDK Key) or 400 (using incorrect SDK Key, i.e., client-side SDK Key on server-side)
143
143
  if (error.statusCode >= 400 && error.statusCode < 500) {
144
144
  telemetryTracker.streamingEvent(AUTH_REJECTION);
145
145
  pushEmitter.emit(PUSH_NONRETRYABLE_ERROR);
@@ -33,8 +33,8 @@ function getActiveFactories() {
33
33
  }
34
34
 
35
35
  function getRedundantActiveFactories() {
36
- return Object.keys(usedKeysMap).reduce((acum, apiKey) => {
37
- return acum + usedKeysMap[apiKey] - 1;
36
+ return Object.keys(usedKeysMap).reduce((acum, sdkKey) => {
37
+ return acum + usedKeysMap[sdkKey] - 1;
38
38
  }, 0);
39
39
  }
40
40