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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/CHANGES.txt +7 -3
  2. package/cjs/evaluator/index.js +2 -2
  3. package/cjs/evaluator/matchers/semver_inlist.js +1 -2
  4. package/cjs/evaluator/matchers/whitelist.js +1 -2
  5. package/cjs/listeners/browser.js +1 -2
  6. package/cjs/logger/browser/DebugLogger.js +1 -2
  7. package/cjs/logger/browser/ErrorLogger.js +1 -2
  8. package/cjs/logger/browser/InfoLogger.js +1 -2
  9. package/cjs/logger/browser/WarnLogger.js +1 -2
  10. package/cjs/logger/index.js +1 -2
  11. package/cjs/sdkClient/clientCS.js +5 -8
  12. package/cjs/sdkClient/sdkClientMethodCS.js +1 -1
  13. package/cjs/sdkFactory/index.js +1 -3
  14. package/cjs/services/decorateHeaders.js +1 -2
  15. package/cjs/storages/AbstractSplitsCacheAsync.js +7 -0
  16. package/cjs/storages/AbstractSplitsCacheSync.js +7 -0
  17. package/cjs/storages/KeyBuilderCS.js +0 -9
  18. package/cjs/storages/dataLoader.js +32 -65
  19. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  20. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  21. package/cjs/storages/inLocalStorage/index.js +1 -4
  22. package/cjs/storages/inMemory/InMemoryStorageCS.js +4 -16
  23. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  24. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -3
  25. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  26. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  27. package/cjs/storages/inRedis/RedisAdapter.js +2 -3
  28. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -1
  29. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  30. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  31. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  32. package/cjs/storages/pluggable/TelemetryCachePluggable.js +6 -7
  33. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  34. package/cjs/storages/pluggable/inMemoryWrapper.js +7 -8
  35. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +7 -2
  36. package/cjs/sync/polling/pollingManagerSS.js +3 -3
  37. package/cjs/sync/polling/updaters/splitChangesUpdater.js +13 -5
  38. package/cjs/sync/streaming/parseUtils.js +0 -1
  39. package/cjs/sync/streaming/pushManager.js +2 -3
  40. package/cjs/utils/LRUCache/index.js +1 -2
  41. package/cjs/utils/constants/browser.js +1 -4
  42. package/cjs/utils/lang/index.js +6 -9
  43. package/cjs/utils/lang/objectAssign.js +12 -77
  44. package/cjs/utils/lang/sets.js +3 -110
  45. package/cjs/utils/settingsValidation/index.js +0 -9
  46. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -2
  47. package/cjs/utils/settingsValidation/storage/storageCS.js +12 -1
  48. package/esm/evaluator/index.js +3 -3
  49. package/esm/evaluator/matchers/semver_inlist.js +1 -2
  50. package/esm/evaluator/matchers/whitelist.js +1 -2
  51. package/esm/listeners/browser.js +1 -2
  52. package/esm/logger/browser/DebugLogger.js +1 -2
  53. package/esm/logger/browser/ErrorLogger.js +1 -2
  54. package/esm/logger/browser/InfoLogger.js +1 -2
  55. package/esm/logger/browser/WarnLogger.js +1 -2
  56. package/esm/logger/index.js +1 -2
  57. package/esm/sdkClient/clientCS.js +5 -8
  58. package/esm/sdkClient/sdkClientMethodCS.js +1 -1
  59. package/esm/sdkFactory/index.js +2 -4
  60. package/esm/services/decorateHeaders.js +1 -2
  61. package/esm/storages/AbstractSplitsCacheAsync.js +7 -0
  62. package/esm/storages/AbstractSplitsCacheSync.js +7 -0
  63. package/esm/storages/KeyBuilderCS.js +0 -9
  64. package/esm/storages/dataLoader.js +30 -62
  65. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  66. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +14 -7
  67. package/esm/storages/inLocalStorage/index.js +2 -5
  68. package/esm/storages/inMemory/InMemoryStorageCS.js +4 -16
  69. package/esm/storages/inMemory/SegmentsCacheInMemory.js +3 -4
  70. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -3
  71. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +2 -3
  72. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -3
  73. package/esm/storages/inRedis/RedisAdapter.js +2 -3
  74. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  75. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  76. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -2
  77. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  78. package/esm/storages/pluggable/TelemetryCachePluggable.js +6 -7
  79. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -2
  80. package/esm/storages/pluggable/inMemoryWrapper.js +7 -8
  81. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +8 -3
  82. package/esm/sync/polling/pollingManagerSS.js +3 -3
  83. package/esm/sync/polling/updaters/splitChangesUpdater.js +14 -6
  84. package/esm/sync/streaming/parseUtils.js +0 -1
  85. package/esm/sync/streaming/pushManager.js +2 -3
  86. package/esm/utils/LRUCache/index.js +1 -2
  87. package/esm/utils/constants/browser.js +0 -3
  88. package/esm/utils/lang/index.js +6 -9
  89. package/esm/utils/lang/objectAssign.js +12 -77
  90. package/esm/utils/lang/sets.js +2 -107
  91. package/esm/utils/settingsValidation/index.js +0 -9
  92. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -2
  93. package/esm/utils/settingsValidation/storage/storageCS.js +10 -0
  94. package/package.json +2 -2
  95. package/src/evaluator/index.ts +5 -5
  96. package/src/evaluator/matchers/semver_inlist.ts +1 -2
  97. package/src/evaluator/matchers/whitelist.ts +1 -3
  98. package/src/listeners/browser.ts +1 -2
  99. package/src/logger/browser/DebugLogger.ts +1 -2
  100. package/src/logger/browser/ErrorLogger.ts +1 -2
  101. package/src/logger/browser/InfoLogger.ts +1 -2
  102. package/src/logger/browser/WarnLogger.ts +1 -2
  103. package/src/logger/index.ts +3 -4
  104. package/src/sdkClient/clientCS.ts +5 -8
  105. package/src/sdkClient/sdkClientMethodCS.ts +1 -1
  106. package/src/sdkFactory/index.ts +2 -5
  107. package/src/sdkFactory/types.ts +1 -1
  108. package/src/services/decorateHeaders.ts +1 -2
  109. package/src/storages/AbstractSplitsCacheAsync.ts +9 -2
  110. package/src/storages/AbstractSplitsCacheSync.ts +9 -2
  111. package/src/storages/KeyBuilderCS.ts +0 -13
  112. package/src/storages/dataLoader.ts +32 -63
  113. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -21
  114. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +16 -8
  115. package/src/storages/inLocalStorage/index.ts +2 -6
  116. package/src/storages/inMemory/InMemoryStorageCS.ts +4 -19
  117. package/src/storages/inMemory/SegmentsCacheInMemory.ts +4 -5
  118. package/src/storages/inMemory/SplitsCacheInMemory.ts +4 -5
  119. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +4 -5
  120. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +4 -5
  121. package/src/storages/inRedis/RedisAdapter.ts +3 -4
  122. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  123. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -4
  124. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -2
  125. package/src/storages/pluggable/SegmentsCachePluggable.ts +0 -1
  126. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  127. package/src/storages/pluggable/TelemetryCachePluggable.ts +6 -7
  128. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -2
  129. package/src/storages/pluggable/inMemoryWrapper.ts +8 -9
  130. package/src/storages/types.ts +9 -5
  131. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +7 -3
  132. package/src/sync/polling/pollingManagerSS.ts +2 -3
  133. package/src/sync/polling/updaters/splitChangesUpdater.ts +15 -8
  134. package/src/sync/streaming/parseUtils.ts +0 -1
  135. package/src/sync/streaming/pushManager.ts +3 -4
  136. package/src/sync/submitters/types.ts +3 -4
  137. package/src/types.ts +9 -18
  138. package/src/utils/LRUCache/index.ts +2 -3
  139. package/src/utils/constants/browser.ts +0 -4
  140. package/src/utils/lang/index.ts +6 -7
  141. package/src/utils/lang/objectAssign.ts +13 -92
  142. package/src/utils/lang/sets.ts +3 -125
  143. package/src/utils/settingsValidation/index.ts +0 -10
  144. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  145. package/src/utils/settingsValidation/storage/storageCS.ts +13 -0
  146. package/src/utils/settingsValidation/types.ts +0 -2
  147. package/types/logger/index.d.ts +1 -2
  148. package/types/sdkClient/clientCS.d.ts +2 -3
  149. package/types/sdkFactory/types.d.ts +1 -1
  150. package/types/storages/AbstractSplitsCacheAsync.d.ts +6 -2
  151. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -2
  152. package/types/storages/KeyBuilderCS.d.ts +0 -2
  153. package/types/storages/dataLoader.d.ts +6 -17
  154. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +7 -2
  155. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
  156. package/types/storages/inMemory/UniqueKeysCacheInMemory.d.ts +2 -3
  157. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -2
  158. package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -2
  159. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -2
  160. package/types/storages/types.d.ts +7 -5
  161. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -2
  162. package/types/sync/submitters/types.d.ts +3 -4
  163. package/types/types.d.ts +9 -17
  164. package/types/utils/LRUCache/index.d.ts +1 -2
  165. package/types/utils/constants/browser.d.ts +0 -2
  166. package/types/utils/lang/objectAssign.d.ts +3 -0
  167. package/types/utils/lang/sets.d.ts +1 -61
  168. package/types/utils/settingsValidation/index.d.ts +0 -1
  169. package/types/utils/settingsValidation/storage/storageCS.d.ts +5 -0
  170. package/types/utils/settingsValidation/types.d.ts +0 -2
  171. package/cjs/integrations/browser.js +0 -31
  172. package/cjs/integrations/ga/GaToSplit.js +0 -257
  173. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +0 -14
  174. package/cjs/integrations/ga/SplitToGa.js +0 -123
  175. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +0 -14
  176. package/cjs/integrations/ga/types.js +0 -2
  177. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +0 -76
  178. package/cjs/utils/lang/maps.js +0 -96
  179. package/esm/integrations/browser.js +0 -27
  180. package/esm/integrations/ga/GaToSplit.js +0 -250
  181. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +0 -10
  182. package/esm/integrations/ga/SplitToGa.js +0 -120
  183. package/esm/integrations/ga/SplitToGoogleAnalytics.js +0 -10
  184. package/esm/integrations/ga/types.js +0 -1
  185. package/esm/sdkClient/sdkClientMethodCSWithTT.js +0 -72
  186. package/esm/utils/lang/maps.js +0 -92
  187. package/src/integrations/browser.ts +0 -35
  188. package/src/integrations/ga/GaToSplit.ts +0 -299
  189. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +0 -14
  190. package/src/integrations/ga/SplitToGa.ts +0 -135
  191. package/src/integrations/ga/SplitToGoogleAnalytics.ts +0 -14
  192. package/src/integrations/ga/autoRequire.js +0 -33
  193. package/src/integrations/ga/types.ts +0 -153
  194. package/src/sdkClient/sdkClientMethodCSWithTT.ts +0 -98
  195. package/src/utils/lang/maps.ts +0 -108
@@ -1,129 +1,7 @@
1
- /**
2
- * Set implementation based on es6-set polyfill (https://github.com/medikoo/es6-set/blob/master/polyfill.js),
3
- * with the minimal features used by the SDK.
4
-
5
- Copyright (C) 2013 Mariusz Nowak (www.medikoo.com)
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
- **/
25
-
26
- export interface ISet<T> {
27
- add(value: T): this;
28
- clear(): void;
29
- delete(value: T): boolean;
30
- forEach(callbackfn: (value: T, value2: T, set: ISet<T>) => void, thisArg?: any): void;
31
- has(value: T): boolean;
32
- readonly size: number;
33
- }
34
-
35
- export class SetPoly<T> implements ISet<T>{
36
- __setData__: T[] = [];
37
-
38
- // unlike ES6 `Set`, it only accepts an array as first argument iterable
39
- constructor(values?: readonly T[] | null) {
40
- if (Array.isArray(values)) values.forEach(value => { this.add(value); });
41
- }
42
-
43
- clear() {
44
- if (!this.__setData__.length) return;
45
- this.__setData__.length = 0;
46
- }
47
-
48
- add(value: T) {
49
- if (this.has(value)) return this;
50
- this.__setData__.push(value);
51
- return this;
52
- }
53
-
54
- delete(value: T) {
55
- let index = this.__setData__.indexOf(value);
56
- if (index === -1) return false;
57
- this.__setData__.splice(index, 1);
58
- return true;
59
- }
60
-
61
- has(value: T) {
62
- return this.__setData__.indexOf(value) !== -1;
63
- }
64
-
65
- forEach(callbackfn: (value: T, value2: T, set: SetPoly<T>) => void, thisArg?: any): void {
66
- if (typeof callbackfn !== 'function') throw new TypeError(callbackfn + ' is not a function');
67
-
68
- for (let i = 0; i < this.__setData__.length; i++) {
69
- const value = this.__setData__[i];
70
- callbackfn.call(thisArg, value, value, this);
71
- }
72
- }
73
-
74
- get size() {
75
- return this.__setData__.length;
76
- }
77
-
78
- }
79
-
80
-
81
- /**
82
- * return an array containing the items of the given set.
83
- * @param set Set or SetPoly instance
84
- */
85
- export function setToArray<T>(set: ISet<T>): T[] {
86
- if (set instanceof SetPoly) {
87
- return set.__setData__.slice();
88
- }
89
- // if not using SetPoly as set, it means Array.from is supported
90
- // eslint-disable-next-line compat/compat
91
- return Array.from(set as Set<T>);
92
- }
93
-
94
- interface ISetConstructor {
95
- new <T = any>(values?: readonly T[] | null): ISet<T>;
96
- readonly prototype: ISet<any>;
97
- }
98
-
99
- /**
100
- * return the Set constructor to use. If `Array.from` built-in or native Set is not available or it doesn't support the required features,
101
- * a ponyfill with minimal features is returned instead.
102
- *
103
- * Exported for testing purposes only.
104
- */
105
- export function __getSetConstructor(): ISetConstructor {
106
- // eslint-disable-next-line compat/compat
107
- if (typeof Array.from === 'function' && typeof Set === 'function' && Set.prototype && Set.prototype.values) {
108
- return Set;
109
- }
110
- return SetPoly;
111
- }
112
-
113
- export const _Set = __getSetConstructor();
114
-
115
- export function returnSetsUnion<T>(set: ISet<T>, set2: ISet<T>): ISet<T> {
116
- const result = new _Set(setToArray(set));
117
- set2.forEach(value => {
118
- result.add(value);
119
- });
120
- return result;
1
+ export function returnSetsUnion<T>(set: Set<T>, set2: Set<T>): Set<T> {
2
+ return new Set(Array.from(set).concat(Array.from(set2)));
121
3
  }
122
4
 
123
5
  export function returnDifference<T>(list: T[] = [], list2: T[] = []): T[] {
124
- const result = new _Set(list);
125
- list2.forEach(item => {
126
- result.delete(item);
127
- });
128
- return setToArray(result);
6
+ return list.filter(item => list2.indexOf(item) === -1);
129
7
  }
@@ -6,7 +6,6 @@ import { validImpressionsMode } from './impressionsMode';
6
6
  import { ISettingsValidationParams } from './types';
7
7
  import { ISettings } from '../../types';
8
8
  import { validateKey } from '../inputValidation/key';
9
- import { validateTrafficType } from '../inputValidation/trafficType';
10
9
  import { ERROR_MIN_CONFIG_PARAM, LOG_PREFIX_CLIENT_INSTANTIATION } from '../../logger/constants';
11
10
 
12
11
  // Exported for telemetry
@@ -19,8 +18,6 @@ export const base = {
19
18
  authorizationKey: undefined,
20
19
  // key used in your system (only required for browser version)
21
20
  key: undefined,
22
- // traffic type for the given key (only used on browser version)
23
- trafficType: undefined,
24
21
  // toggle impressions tracking of labels
25
22
  labelsEnabled: true,
26
23
  // toggle sendind (true) or not sending (false) IP and Host Name with impressions, events, and telemetries requests (only used on nodejs version)
@@ -168,13 +165,6 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
168
165
  // @ts-ignore, @TODO handle invalid keys as a non-recoverable error?
169
166
  withDefaults.core.key = validateKey(log, maybeKey, LOG_PREFIX_CLIENT_INSTANTIATION);
170
167
  }
171
-
172
- if (validationParams.acceptTT) {
173
- const maybeTT = withDefaults.core.trafficType;
174
- if (maybeTT !== undefined) { // @ts-ignore
175
- withDefaults.core.trafficType = validateTrafficType(log, maybeTT, LOG_PREFIX_CLIENT_INSTANTIATION);
176
- }
177
- }
178
168
  } else {
179
169
  // On server-side, key is undefined and used to distinguish from client-side
180
170
  if (maybeKey !== undefined) log.warn('Provided `key` is ignored in server-side SDK.'); // @ts-ignore
@@ -3,11 +3,10 @@ import { ILogger } from '../../../logger/types';
3
3
  import { isLocalStorageAvailable } from '../../env/isLocalStorageAvailable';
4
4
  import { isNode } from '../../env/isNode';
5
5
  import { codesDebug } from '../../../logger/messages/debug';
6
- import { _Map } from '../../lang/maps';
7
6
  import { getLogLevel } from './commons';
8
7
  import { LogLevel } from '../../../types';
9
8
 
10
- const allCodes = new _Map(codesDebug);
9
+ const allCodes = new Map(codesDebug);
11
10
 
12
11
  // @TODO set default debug setting instead of initialLogLevel when integrating in JS and Node packages
13
12
  const LS_KEY = 'splitio_debug';
@@ -3,6 +3,14 @@ import { ISettings, SDKMode } from '../../../types';
3
3
  import { ILogger } from '../../../logger/types';
4
4
  import { ERROR_STORAGE_INVALID } from '../../../logger/constants';
5
5
  import { LOCALHOST_MODE, STANDALONE_MODE, STORAGE_PLUGGABLE, STORAGE_LOCALSTORAGE, STORAGE_MEMORY } from '../../../utils/constants';
6
+ import { IStorageFactoryParams, IStorageSync } from '../../../storages/types';
7
+
8
+ export function __InLocalStorageMockFactory(params: IStorageFactoryParams): IStorageSync {
9
+ const result = InMemoryStorageCSFactory(params);
10
+ result.splits.checkCache = () => true; // to emit SDK_READY_FROM_CACHE
11
+ return result;
12
+ }
13
+ __InLocalStorageMockFactory.type = STORAGE_MEMORY;
6
14
 
7
15
  /**
8
16
  * This function validates `settings.storage` object
@@ -22,6 +30,11 @@ export function validateStorageCS(settings: { log: ILogger, storage?: any, mode:
22
30
  log.error(ERROR_STORAGE_INVALID);
23
31
  }
24
32
 
33
+ // In localhost mode with InLocalStorage, fallback to a mock InLocalStorage to emit SDK_READY_FROM_CACHE
34
+ if (mode === LOCALHOST_MODE && storage.type === STORAGE_LOCALSTORAGE) {
35
+ return __InLocalStorageMockFactory;
36
+ }
37
+
25
38
  if ([LOCALHOST_MODE, STANDALONE_MODE].indexOf(mode) === -1) {
26
39
  // Consumer modes require an async storage
27
40
  if (storage.type !== STORAGE_PLUGGABLE) throw new Error('A PluggableStorage instance is required on consumer mode');
@@ -12,8 +12,6 @@ export interface ISettingsValidationParams {
12
12
  defaults: Partial<ISettings> & { version: string } & { startup: ISettings['startup'] },
13
13
  /** If true, validates core.key */
14
14
  acceptKey?: boolean,
15
- /** If true, validates core.trafficType */
16
- acceptTT?: boolean,
17
15
  /** Define runtime values (`settings.runtime`) */
18
16
  runtime: (settings: ISettings) => ISettings['runtime'],
19
17
  /** Storage validator (`settings.storage`) */
@@ -1,6 +1,5 @@
1
1
  import { ILoggerOptions, ILogger } from './types';
2
2
  import { LogLevel } from '../types';
3
- import { IMap } from '../utils/lang/maps';
4
3
  export declare const LogLevels: {
5
4
  [level: string]: LogLevel;
6
5
  };
@@ -10,7 +9,7 @@ export declare class Logger implements ILogger {
10
9
  private options;
11
10
  private codes;
12
11
  private logLevel;
13
- constructor(options?: ILoggerOptions, codes?: IMap<number, string>);
12
+ constructor(options?: ILoggerOptions, codes?: Map<number, string>);
14
13
  setLogLevel(logLevel: LogLevel): void;
15
14
  debug(msg: string | number, args?: any[]): void;
16
15
  info(msg: string | number, args?: any[]): void;
@@ -1,10 +1,9 @@
1
1
  import { ILogger } from '../logger/types';
2
2
  import { SplitIO } from '../types';
3
3
  /**
4
- * Decorator that binds a key and (optionally) a traffic type to client methods
4
+ * Decorator that binds a key to client methods
5
5
  *
6
6
  * @param client sync client instance
7
7
  * @param key validated split key
8
- * @param trafficType validated traffic type
9
8
  */
10
- export declare function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: SplitIO.SplitKey, trafficType?: string): SplitIO.ICsClient;
9
+ export declare function clientCSDecorator(log: ILogger, client: SplitIO.IClient, key: SplitIO.SplitKey): SplitIO.ICsClient;
@@ -71,7 +71,7 @@ export interface ISdkFactoryParams {
71
71
  sdkManagerFactory: typeof sdkManagerFactory;
72
72
  sdkClientMethodFactory: (params: ISdkFactoryContext) => ({
73
73
  (): SplitIO.ICsClient;
74
- (key: SplitIO.SplitKey, trafficType?: string | undefined): SplitIO.ICsClient;
74
+ (key: SplitIO.SplitKey): SplitIO.ICsClient;
75
75
  } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient));
76
76
  impressionsObserverFactory: () => IImpressionObserver;
77
77
  filterAdapterFactory?: () => IFilterAdapter;
@@ -1,6 +1,5 @@
1
1
  import { ISplitsCacheAsync } from './types';
2
2
  import { ISplit } from '../dtos/types';
3
- import { ISet } from '../utils/lang/sets';
4
3
  /**
5
4
  * This class provides a skeletal implementation of the ISplitsCacheAsync interface
6
5
  * to minimize the effort required to implement this interface.
@@ -15,10 +14,15 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
15
14
  abstract getChangeNumber(): Promise<number>;
16
15
  abstract getAll(): Promise<ISplit[]>;
17
16
  abstract getSplitNames(): Promise<string[]>;
18
- abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
17
+ abstract getNamesByFlagSets(flagSets: string[]): Promise<Set<string>[]>;
19
18
  abstract trafficTypeExists(trafficType: string): Promise<boolean>;
20
19
  abstract clear(): Promise<boolean | void>;
21
20
  usesSegments(): Promise<boolean>;
21
+ /**
22
+ * Check if the splits information is already stored in cache.
23
+ * Noop, just keeping the interface. This is used by client-side implementations only.
24
+ */
25
+ checkCache(): Promise<boolean>;
22
26
  /**
23
27
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
24
28
  * Used for SPLIT_KILL push notifications.
@@ -1,6 +1,5 @@
1
1
  import { ISplitsCacheSync } from './types';
2
2
  import { ISplit } from '../dtos/types';
3
- import { ISet } from '../utils/lang/sets';
4
3
  /**
5
4
  * This class provides a skeletal implementation of the ISplitsCacheSync interface
6
5
  * to minimize the effort required to implement this interface.
@@ -19,6 +18,11 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
19
18
  abstract trafficTypeExists(trafficType: string): boolean;
20
19
  abstract usesSegments(): boolean;
21
20
  abstract clear(): void;
21
+ /**
22
+ * Check if the splits information is already stored in cache. This data can be preloaded.
23
+ * It is used as condition to emit SDK_SPLITS_CACHE_LOADED, and then SDK_READY_FROM_CACHE.
24
+ */
25
+ checkCache(): boolean;
22
26
  /**
23
27
  * Kill `name` split and set `defaultTreatment` and `changeNumber`.
24
28
  * Used for SPLIT_KILL push notifications.
@@ -30,7 +34,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
30
34
  * for instance, if the `changeNumber` is old, or if the split is not found (e.g., `/splitchanges` hasn't been fetched yet), or if the storage fails to apply the update.
31
35
  */
32
36
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
33
- abstract getNamesByFlagSets(flagSets: string[]): ISet<string>[];
37
+ abstract getNamesByFlagSets(flagSets: string[]): Set<string>[];
34
38
  }
35
39
  /**
36
40
  * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
@@ -2,7 +2,6 @@ import { KeyBuilder } from './KeyBuilder';
2
2
  export interface MySegmentsKeyBuilder {
3
3
  buildSegmentNameKey(segmentName: string): string;
4
4
  extractSegmentName(builtSegmentKeyName: string): string | undefined;
5
- extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
6
5
  buildTillKey(): string;
7
6
  }
8
7
  export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBuilder {
@@ -14,7 +13,6 @@ export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBui
14
13
  */
15
14
  buildSegmentNameKey(segmentName: string): string;
16
15
  extractSegmentName(builtSegmentKeyName: string): string | undefined;
17
- extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
18
16
  buildLastUpdatedKey(): string;
19
17
  isSplitsCacheKey(key: string): boolean;
20
18
  buildTillKey(): string;
@@ -1,21 +1,10 @@
1
1
  import { SplitIO } from '../types';
2
- import { ISegmentsCacheSync, ISplitsCacheSync, IStorageSync } from './types';
2
+ import { DataLoader } from './types';
3
3
  /**
4
- * Storage-agnostic adaptation of `loadDataIntoLocalStorage` function
5
- * (https://github.com/godaddy/split-javascript-data-loader/blob/master/src/load-data.js)
4
+ * Factory of client-side storage loader
6
5
  *
7
- * @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader and extended with a `mySegmentsData` property.
8
- * @param storage object containing `splits` and `segments` cache (client-side variant)
9
- * @param userKey user key (matching key) of the provided MySegmentsCache
10
- *
11
- * @TODO extend to load largeSegments
12
- * @TODO extend to load data on shared mySegments storages. Be specific when emitting SDK_READY_FROM_CACHE on shared clients. Maybe the serializer should provide the `useSegments` flag.
13
- * @TODO add logs, and input validation in this module, in favor of size reduction.
14
- * @TODO unit tests
6
+ * @param preloadedData validated data following the format proposed in https://github.com/godaddy/split-javascript-data-loader
7
+ * and extended with a `mySegmentsData` property.
8
+ * @returns function to preload the storage
15
9
  */
16
- export declare function loadData(preloadedData: SplitIO.PreloadedData, storage: {
17
- splits?: ISplitsCacheSync;
18
- segments: ISegmentsCacheSync;
19
- largeSegments?: ISegmentsCacheSync;
20
- }, userKey?: string): void;
21
- export declare function getSnapshot(storage: IStorageSync, userKeys?: string[]): SplitIO.PreloadedData;
10
+ export declare function dataLoaderFactory(preloadedData: SplitIO.PreloadedData): DataLoader;
@@ -1,7 +1,6 @@
1
1
  import { ISplit } from '../../dtos/types';
2
2
  import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
3
3
  import { KeyBuilderCS } from '../KeyBuilderCS';
4
- import { ISet } from '../../utils/lang/sets';
5
4
  import { ISettings } from '../../types';
6
5
  /**
7
6
  * ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
@@ -35,6 +34,12 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
35
34
  getSplitNames(): string[];
36
35
  trafficTypeExists(trafficType: string): boolean;
37
36
  usesSegments(): boolean;
37
+ /**
38
+ * Check if the splits information is already stored in browser LocalStorage.
39
+ * In this function we could add more code to check if the data is valid.
40
+ * @override
41
+ */
42
+ checkCache(): boolean;
38
43
  /**
39
44
  * Clean Splits cache if its `lastUpdated` timestamp is older than the given `expirationTimestamp`,
40
45
  *
@@ -42,7 +47,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
42
47
  */
43
48
  private _checkExpiration;
44
49
  private _checkFilterQuery;
45
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
50
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
46
51
  private addToFlagSets;
47
52
  private removeFromFlagSets;
48
53
  private removeNames;
@@ -1,6 +1,5 @@
1
1
  import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
2
2
  import { AbstractSplitsCacheSync } from '../AbstractSplitsCacheSync';
3
- import { ISet } from '../../utils/lang/sets';
4
3
  /**
5
4
  * Default ISplitsCacheSync implementation that stores split definitions in memory.
6
5
  * Supported by all JS runtimes.
@@ -22,7 +21,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
22
21
  getSplitNames(): string[];
23
22
  trafficTypeExists(trafficType: string): boolean;
24
23
  usesSegments(): boolean;
25
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
24
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
26
25
  private addToFlagSets;
27
26
  private removeFromFlagSets;
28
27
  private removeNames;
@@ -1,18 +1,17 @@
1
1
  import { IUniqueKeysCacheBase } from '../types';
2
- import { ISet } from '../../utils/lang/sets';
3
2
  import { UniqueKeysPayloadSs } from '../../sync/submitters/types';
4
3
  /**
5
4
  * Converts `uniqueKeys` data from cache into request payload for SS.
6
5
  */
7
6
  export declare function fromUniqueKeysCollector(uniqueKeys: {
8
- [featureName: string]: ISet<string>;
7
+ [featureName: string]: Set<string>;
9
8
  }): UniqueKeysPayloadSs;
10
9
  export declare class UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
11
10
  protected onFullQueue?: () => void;
12
11
  private readonly maxStorage;
13
12
  private uniqueTrackerSize;
14
13
  protected uniqueKeysTracker: {
15
- [featureName: string]: ISet<string>;
14
+ [featureName: string]: Set<string>;
16
15
  };
17
16
  constructor(uniqueKeysQueueSize?: number);
18
17
  setOnFullQueueCb(cb: () => void): void;
@@ -2,7 +2,6 @@ import { KeyBuilderSS } from '../KeyBuilderSS';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
4
4
  import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
5
- import { ISet } from '../../utils/lang/sets';
6
5
  import type { RedisAdapter } from './RedisAdapter';
7
6
  /**
8
7
  * ISplitsCacheAsync implementation that stores split definitions in Redis.
@@ -79,7 +78,7 @@ export declare class SplitsCacheInRedis extends AbstractSplitsCacheAsync {
79
78
  * The returned promise is resolved with the list of feature flag names per flag set,
80
79
  * or rejected if the pipelined redis operation fails (e.g., timeout).
81
80
  */
82
- getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
81
+ getNamesByFlagSets(flagSets: string[]): Promise<Set<string>[]>;
83
82
  /**
84
83
  * Check traffic type existence.
85
84
  * The returned promise is resolved with a boolean indicating whether the TT exist or not.
@@ -3,7 +3,6 @@ import { IPluggableStorageWrapper } from '../types';
3
3
  import { ILogger } from '../../logger/types';
4
4
  import { ISplit, ISplitFiltersValidation } from '../../dtos/types';
5
5
  import { AbstractSplitsCacheAsync } from '../AbstractSplitsCacheAsync';
6
- import { ISet } from '../../utils/lang/sets';
7
6
  /**
8
7
  * ISplitsCacheAsync implementation for pluggable storages.
9
8
  */
@@ -75,7 +74,7 @@ export declare class SplitsCachePluggable extends AbstractSplitsCacheAsync {
75
74
  * The returned promise is resolved with the list of feature flag names per flag set.
76
75
  * It never rejects (If there is a wrapper error for some flag set, an empty set is returned for it).
77
76
  */
78
- getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
77
+ getNamesByFlagSets(flagSets: string[]): Promise<Set<string>[]>;
79
78
  /**
80
79
  * Check traffic type existence.
81
80
  * The returned promise is resolved with a boolean indicating whether the TT exist or not.
@@ -1,5 +1,4 @@
1
1
  import { IPluggableStorageWrapper } from '../types';
2
- import { ISet } from '../../utils/lang/sets';
3
2
  /**
4
3
  * Creates a IPluggableStorageWrapper implementation that stores items in memory.
5
4
  * The `_cache` property is the object were items are stored.
@@ -8,6 +7,6 @@ import { ISet } from '../../utils/lang/sets';
8
7
  * @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves immediately.
9
8
  */
10
9
  export declare function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & {
11
- _cache: Record<string, string | string[] | ISet<string>>;
10
+ _cache: Record<string, string | string[] | Set<string>>;
12
11
  _setConnDelay(connDelay: number): void;
13
12
  };
@@ -2,7 +2,6 @@ import { MaybeThenable, ISplit, IMySegmentsResponse } from '../dtos/types';
2
2
  import { MySegmentsData } from '../sync/polling/types';
3
3
  import { EventDataType, HttpErrors, HttpLatencies, ImpressionDataType, LastSync, Method, MethodExceptions, MethodLatencies, MultiMethodExceptions, MultiMethodLatencies, MultiConfigs, OperationType, StoredEventWithMetadata, StoredImpressionWithMetadata, StreamingEvent, UniqueKeysPayloadCs, UniqueKeysPayloadSs, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../sync/submitters/types';
4
4
  import { SplitIO, ImpressionDTO, ISettings } from '../types';
5
- import { ISet } from '../utils/lang/sets';
6
5
  /**
7
6
  * Interface of a pluggable storage wrapper.
8
7
  */
@@ -192,8 +191,9 @@ export interface ISplitsCacheBase {
192
191
  trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
193
192
  usesSegments(): MaybeThenable<boolean>;
194
193
  clear(): MaybeThenable<boolean | void>;
194
+ checkCache(): MaybeThenable<boolean>;
195
195
  killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
196
- getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>[]>;
196
+ getNamesByFlagSets(flagSets: string[]): MaybeThenable<Set<string>[]>;
197
197
  }
198
198
  export interface ISplitsCacheSync extends ISplitsCacheBase {
199
199
  addSplits(entries: [string, ISplit][]): boolean[];
@@ -207,8 +207,9 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
207
207
  trafficTypeExists(trafficType: string): boolean;
208
208
  usesSegments(): boolean;
209
209
  clear(): void;
210
+ checkCache(): boolean;
210
211
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
211
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
212
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
212
213
  }
213
214
  export interface ISplitsCacheAsync extends ISplitsCacheBase {
214
215
  addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
@@ -222,8 +223,9 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
222
223
  trafficTypeExists(trafficType: string): Promise<boolean>;
223
224
  usesSegments(): Promise<boolean>;
224
225
  clear(): Promise<boolean | void>;
226
+ checkCache(): Promise<boolean>;
225
227
  killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
226
- getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
228
+ getNamesByFlagSets(flagSets: string[]): Promise<Set<string>[]>;
227
229
  }
228
230
  /** Segments cache */
229
231
  export interface ISegmentsCacheBase {
@@ -391,6 +393,7 @@ export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCa
391
393
  export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
392
394
  }
393
395
  /** StorageFactory */
396
+ export declare type DataLoader = (storage: IStorageSync, matchingKey: string) => void;
394
397
  export interface IStorageFactoryParams {
395
398
  settings: ISettings;
396
399
  /**
@@ -398,7 +401,6 @@ export interface IStorageFactoryParams {
398
401
  * It is meant for emitting SDK_READY event in consumer mode, and waiting before using the storage in the synchronizer.
399
402
  */
400
403
  onReadyCb: (error?: any) => void;
401
- onReadyFromCacheCb: (error?: any) => void;
402
404
  }
403
405
  export declare type StorageType = 'MEMORY' | 'LOCALSTORAGE' | 'REDIS' | 'PLUGGABLE';
404
406
  export declare type IStorageSyncFactory = {
@@ -1,4 +1,3 @@
1
- import { ISet } from '../../../utils/lang/sets';
2
1
  import { ISegmentsCacheBase, ISplitsCacheBase } from '../../../storages/types';
3
2
  import { ISplitChangesFetcher } from '../fetchers/types';
4
3
  import { ISplit, ISplitFiltersValidation } from '../../../dtos/types';
@@ -12,7 +11,7 @@ declare type ISplitChangesUpdater = (noCache?: boolean, till?: number, splitUpda
12
11
  * Collect segments from a raw split definition.
13
12
  * Exported for testing purposes.
14
13
  */
15
- export declare function parseSegments({ conditions }: ISplit): ISet<string>;
14
+ export declare function parseSegments({ conditions }: ISplit): Set<string>;
16
15
  interface ISplitMutations {
17
16
  added: [string, ISplit][];
18
17
  removed: string[];
@@ -1,6 +1,5 @@
1
1
  import { IMetadata } from '../../dtos/types';
2
2
  import { SplitIO } from '../../types';
3
- import { IMap } from '../../utils/lang/maps';
4
3
  import { ISyncTask } from '../types';
5
4
  export declare type ImpressionsPayload = {
6
5
  /** Split name */
@@ -79,9 +78,9 @@ export declare type StoredEventWithMetadata = {
79
78
  /** Stored event */
80
79
  e: SplitIO.EventData;
81
80
  };
82
- export declare type MultiMethodLatencies = IMap<string, MethodLatencies>;
83
- export declare type MultiMethodExceptions = IMap<string, MethodExceptions>;
84
- export declare type MultiConfigs = IMap<string, TelemetryConfigStats>;
81
+ export declare type MultiMethodLatencies = Map<string, MethodLatencies>;
82
+ export declare type MultiMethodExceptions = Map<string, MethodExceptions>;
83
+ export declare type MultiConfigs = Map<string, TelemetryConfigStats>;
85
84
  /**
86
85
  * Telemetry usage stats
87
86
  */
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ISplit, ISplitFiltersValidation } from './dtos/types';
1
+ import { ISplitFiltersValidation } from './dtos/types';
2
2
  import { IIntegration, IIntegrationFactoryParams } from './integrations/types';
3
3
  import { ILogger } from './logger/types';
4
4
  import { ISdkFactoryContext } from './sdkFactory/types';
@@ -65,7 +65,6 @@ export interface ISettings {
65
65
  readonly core: {
66
66
  authorizationKey: string;
67
67
  key: SplitIO.SplitKey;
68
- trafficType?: string;
69
68
  labelsEnabled: boolean;
70
69
  IPAddressesEnabled: boolean;
71
70
  };
@@ -92,7 +91,6 @@ export interface ISettings {
92
91
  eventsFirstPushWindow: number;
93
92
  };
94
93
  readonly storage: IStorageSyncFactory | IStorageAsyncFactory;
95
- readonly preloadedData?: SplitIO.PreloadedData;
96
94
  readonly integrations: Array<{
97
95
  readonly type: string;
98
96
  (params: IIntegrationFactoryParams): IIntegration | void;
@@ -771,19 +769,21 @@ export declare namespace SplitIO {
771
769
  * If this value is older than 10 days ago (expiration time policy), the data is not used to update the storage content.
772
770
  * @TODO configurable expiration time policy?
773
771
  */
772
+ lastUpdated: number;
774
773
  /**
775
774
  * Change number of the preloaded data.
776
775
  * If this value is older than the current changeNumber at the storage, the data is not used to update the storage content.
777
776
  */
778
777
  since: number;
779
778
  /**
780
- * List of feature flag definitions.
781
- * @TODO rename to flags
779
+ * Map of feature flags to their stringified definitions.
782
780
  */
783
- splitsData: ISplit[];
781
+ splitsData: {
782
+ [splitName: string]: string;
783
+ };
784
784
  /**
785
785
  * Optional map of user keys to their list of segments.
786
- * @TODO rename to memberships
786
+ * @TODO remove when releasing first version
787
787
  */
788
788
  mySegmentsData?: {
789
789
  [key: string]: string[];
@@ -791,10 +791,9 @@ export declare namespace SplitIO {
791
791
  /**
792
792
  * Optional map of segments to their stringified definitions.
793
793
  * This property is ignored if `mySegmentsData` was provided.
794
- * @TODO rename to segments
795
794
  */
796
795
  segmentsData?: {
797
- [segmentName: string]: string[];
796
+ [segmentName: string]: string;
798
797
  };
799
798
  }
800
799
  /**
@@ -922,12 +921,6 @@ export declare namespace SplitIO {
922
921
  * @property {SplitKey} key
923
922
  */
924
923
  key: SplitKey;
925
- /**
926
- * Traffic type associated with the customer identifier. @see {@link https://help.split.io/hc/en-us/articles/360019916311-Traffic-type}
927
- * If no provided as a setting it will be required on the client.track() calls.
928
- * @property {string} trafficType
929
- */
930
- trafficType?: string;
931
924
  /**
932
925
  * Disable labels from being sent to Split backend. Labels may contain sensitive information.
933
926
  * @property {boolean} labelsEnabled
@@ -1036,10 +1029,9 @@ export declare namespace SplitIO {
1036
1029
  * Returns a shared client of the SDK, with the given key and optional traffic type.
1037
1030
  * @function client
1038
1031
  * @param {SplitKey} key The key for the new client instance.
1039
- * @param {string=} trafficType The traffic type of the provided key.
1040
1032
  * @returns {ICsClient} The client instance.
1041
1033
  */
1042
- client(key: SplitKey, trafficType?: string): ICsClient;
1034
+ client(key: SplitKey): ICsClient;
1043
1035
  /**
1044
1036
  * Returns a manager instance of the SDK to explore available information.
1045
1037
  * @function manager