@splitsoftware/splitio-commons 1.17.1-rc.4 → 2.0.0-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 (177) hide show
  1. package/CHANGES.txt +4 -0
  2. package/cjs/evaluator/Engine.js +1 -1
  3. package/cjs/evaluator/index.js +1 -1
  4. package/cjs/evaluator/matchers/semver_inlist.js +1 -2
  5. package/cjs/evaluator/matchers/whitelist.js +1 -2
  6. package/cjs/listeners/browser.js +1 -2
  7. package/cjs/logger/browser/DebugLogger.js +1 -2
  8. package/cjs/logger/browser/ErrorLogger.js +1 -2
  9. package/cjs/logger/browser/InfoLogger.js +1 -2
  10. package/cjs/logger/browser/WarnLogger.js +1 -2
  11. package/cjs/logger/index.js +1 -2
  12. package/cjs/sdkClient/clientCS.js +5 -8
  13. package/cjs/sdkClient/sdkClientMethodCS.js +1 -1
  14. package/cjs/services/decorateHeaders.js +1 -2
  15. package/cjs/storages/KeyBuilderCS.js +0 -9
  16. package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  17. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -4
  18. package/cjs/storages/inLocalStorage/index.js +1 -1
  19. package/cjs/storages/inMemory/InMemoryStorageCS.js +1 -1
  20. package/cjs/storages/inMemory/SegmentsCacheInMemory.js +2 -3
  21. package/cjs/storages/inMemory/SplitsCacheInMemory.js +2 -3
  22. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +2 -2
  23. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -2
  24. package/cjs/storages/inRedis/RedisAdapter.js +2 -2
  25. package/cjs/storages/inRedis/SplitsCacheInRedis.js +1 -1
  26. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  27. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  28. package/cjs/storages/pluggable/SplitsCachePluggable.js +1 -1
  29. package/cjs/storages/pluggable/TelemetryCachePluggable.js +6 -7
  30. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  31. package/cjs/storages/pluggable/inMemoryWrapper.js +6 -6
  32. package/cjs/sync/polling/updaters/splitChangesUpdater.js +3 -3
  33. package/cjs/sync/streaming/parseUtils.js +0 -1
  34. package/cjs/sync/streaming/pushManager.js +2 -3
  35. package/cjs/utils/LRUCache/index.js +1 -2
  36. package/cjs/utils/constants/browser.js +1 -4
  37. package/cjs/utils/lang/index.js +6 -9
  38. package/cjs/utils/lang/objectAssign.js +12 -77
  39. package/cjs/utils/lang/sets.js +10 -107
  40. package/cjs/utils/settingsValidation/index.js +0 -9
  41. package/cjs/utils/settingsValidation/logger/builtinLogger.js +1 -2
  42. package/esm/evaluator/Engine.js +1 -1
  43. package/esm/evaluator/index.js +2 -2
  44. package/esm/evaluator/matchers/semver_inlist.js +1 -2
  45. package/esm/evaluator/matchers/whitelist.js +1 -2
  46. package/esm/listeners/browser.js +1 -2
  47. package/esm/logger/browser/DebugLogger.js +1 -2
  48. package/esm/logger/browser/ErrorLogger.js +1 -2
  49. package/esm/logger/browser/InfoLogger.js +1 -2
  50. package/esm/logger/browser/WarnLogger.js +1 -2
  51. package/esm/logger/index.js +1 -2
  52. package/esm/sdkClient/clientCS.js +5 -8
  53. package/esm/sdkClient/sdkClientMethodCS.js +1 -1
  54. package/esm/services/decorateHeaders.js +1 -2
  55. package/esm/storages/KeyBuilderCS.js +0 -9
  56. package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +1 -21
  57. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +4 -4
  58. package/esm/storages/inLocalStorage/index.js +1 -1
  59. package/esm/storages/inMemory/InMemoryStorageCS.js +1 -1
  60. package/esm/storages/inMemory/SegmentsCacheInMemory.js +2 -3
  61. package/esm/storages/inMemory/SplitsCacheInMemory.js +2 -3
  62. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +2 -2
  63. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +2 -2
  64. package/esm/storages/inRedis/RedisAdapter.js +2 -2
  65. package/esm/storages/inRedis/SplitsCacheInRedis.js +2 -2
  66. package/esm/storages/inRedis/TelemetryCacheInRedis.js +3 -4
  67. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +1 -1
  68. package/esm/storages/pluggable/SplitsCachePluggable.js +2 -2
  69. package/esm/storages/pluggable/TelemetryCachePluggable.js +6 -7
  70. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +1 -1
  71. package/esm/storages/pluggable/inMemoryWrapper.js +7 -7
  72. package/esm/sync/polling/updaters/splitChangesUpdater.js +3 -3
  73. package/esm/sync/streaming/parseUtils.js +0 -1
  74. package/esm/sync/streaming/pushManager.js +2 -3
  75. package/esm/utils/LRUCache/index.js +1 -2
  76. package/esm/utils/constants/browser.js +0 -3
  77. package/esm/utils/lang/index.js +6 -9
  78. package/esm/utils/lang/objectAssign.js +12 -77
  79. package/esm/utils/lang/sets.js +9 -105
  80. package/esm/utils/settingsValidation/index.js +0 -9
  81. package/esm/utils/settingsValidation/logger/builtinLogger.js +1 -2
  82. package/package.json +2 -2
  83. package/src/evaluator/Engine.ts +1 -1
  84. package/src/evaluator/index.ts +4 -4
  85. package/src/evaluator/matchers/semver_inlist.ts +1 -2
  86. package/src/evaluator/matchers/whitelist.ts +1 -3
  87. package/src/listeners/browser.ts +1 -2
  88. package/src/logger/browser/DebugLogger.ts +1 -2
  89. package/src/logger/browser/ErrorLogger.ts +1 -2
  90. package/src/logger/browser/InfoLogger.ts +1 -2
  91. package/src/logger/browser/WarnLogger.ts +1 -2
  92. package/src/logger/index.ts +3 -4
  93. package/src/sdkClient/clientCS.ts +5 -8
  94. package/src/sdkClient/sdkClientMethodCS.ts +1 -1
  95. package/src/sdkFactory/types.ts +1 -1
  96. package/src/services/decorateHeaders.ts +1 -2
  97. package/src/storages/AbstractSplitsCacheAsync.ts +1 -2
  98. package/src/storages/AbstractSplitsCacheSync.ts +1 -2
  99. package/src/storages/KeyBuilderCS.ts +0 -13
  100. package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +1 -21
  101. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +5 -5
  102. package/src/storages/inLocalStorage/index.ts +1 -1
  103. package/src/storages/inMemory/InMemoryStorageCS.ts +1 -1
  104. package/src/storages/inMemory/SegmentsCacheInMemory.ts +3 -4
  105. package/src/storages/inMemory/SplitsCacheInMemory.ts +4 -5
  106. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +4 -4
  107. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +4 -4
  108. package/src/storages/inRedis/RedisAdapter.ts +3 -3
  109. package/src/storages/inRedis/SplitsCacheInRedis.ts +3 -3
  110. package/src/storages/inRedis/TelemetryCacheInRedis.ts +3 -4
  111. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +1 -1
  112. package/src/storages/pluggable/SegmentsCachePluggable.ts +0 -1
  113. package/src/storages/pluggable/SplitsCachePluggable.ts +3 -3
  114. package/src/storages/pluggable/TelemetryCachePluggable.ts +6 -7
  115. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +1 -1
  116. package/src/storages/pluggable/inMemoryWrapper.ts +9 -9
  117. package/src/storages/types.ts +3 -4
  118. package/src/sync/polling/updaters/splitChangesUpdater.ts +4 -4
  119. package/src/sync/streaming/parseUtils.ts +0 -1
  120. package/src/sync/streaming/pushManager.ts +3 -4
  121. package/src/sync/submitters/types.ts +3 -4
  122. package/src/types.ts +1 -9
  123. package/src/utils/LRUCache/index.ts +2 -3
  124. package/src/utils/constants/browser.ts +0 -4
  125. package/src/utils/lang/index.ts +6 -7
  126. package/src/utils/lang/objectAssign.ts +13 -92
  127. package/src/utils/lang/sets.ts +10 -122
  128. package/src/utils/settingsValidation/index.ts +0 -10
  129. package/src/utils/settingsValidation/logger/builtinLogger.ts +1 -2
  130. package/src/utils/settingsValidation/types.ts +0 -2
  131. package/types/logger/index.d.ts +1 -2
  132. package/types/sdkClient/clientCS.d.ts +2 -3
  133. package/types/sdkFactory/types.d.ts +1 -1
  134. package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -2
  135. package/types/storages/AbstractSplitsCacheSync.d.ts +1 -2
  136. package/types/storages/KeyBuilderCS.d.ts +0 -2
  137. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -2
  138. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +1 -2
  139. package/types/storages/inMemory/UniqueKeysCacheInMemory.d.ts +2 -3
  140. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +1 -2
  141. package/types/storages/pluggable/SplitsCachePluggable.d.ts +1 -2
  142. package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -2
  143. package/types/storages/types.d.ts +3 -4
  144. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -2
  145. package/types/sync/submitters/types.d.ts +3 -4
  146. package/types/types.d.ts +1 -9
  147. package/types/utils/LRUCache/index.d.ts +1 -2
  148. package/types/utils/constants/browser.d.ts +0 -2
  149. package/types/utils/lang/objectAssign.d.ts +3 -0
  150. package/types/utils/lang/sets.d.ts +2 -61
  151. package/types/utils/settingsValidation/index.d.ts +0 -1
  152. package/types/utils/settingsValidation/types.d.ts +0 -2
  153. package/cjs/integrations/browser.js +0 -31
  154. package/cjs/integrations/ga/GaToSplit.js +0 -257
  155. package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +0 -14
  156. package/cjs/integrations/ga/SplitToGa.js +0 -123
  157. package/cjs/integrations/ga/SplitToGoogleAnalytics.js +0 -14
  158. package/cjs/integrations/ga/types.js +0 -2
  159. package/cjs/sdkClient/sdkClientMethodCSWithTT.js +0 -75
  160. package/cjs/utils/lang/maps.js +0 -96
  161. package/esm/integrations/browser.js +0 -27
  162. package/esm/integrations/ga/GaToSplit.js +0 -250
  163. package/esm/integrations/ga/GoogleAnalyticsToSplit.js +0 -10
  164. package/esm/integrations/ga/SplitToGa.js +0 -120
  165. package/esm/integrations/ga/SplitToGoogleAnalytics.js +0 -10
  166. package/esm/integrations/ga/types.js +0 -1
  167. package/esm/sdkClient/sdkClientMethodCSWithTT.js +0 -71
  168. package/esm/utils/lang/maps.js +0 -92
  169. package/src/integrations/browser.ts +0 -35
  170. package/src/integrations/ga/GaToSplit.ts +0 -299
  171. package/src/integrations/ga/GoogleAnalyticsToSplit.ts +0 -14
  172. package/src/integrations/ga/SplitToGa.ts +0 -135
  173. package/src/integrations/ga/SplitToGoogleAnalytics.ts +0 -14
  174. package/src/integrations/ga/autoRequire.js +0 -33
  175. package/src/integrations/ga/types.ts +0 -153
  176. package/src/sdkClient/sdkClientMethodCSWithTT.ts +0 -96
  177. package/src/utils/lang/maps.ts +0 -108
@@ -1,71 +1,6 @@
1
- /*
2
- Adaptation of "object-assign" library (https://www.npmjs.com/package/object-assign)
3
- exported as an ES module instead of CommonJS, to avoid extra configuration steps when using
4
- the ESM build of the SDK with tools that doesn't support CommonJS by default (e.g. Rollup).
5
-
6
- object-assign
7
- (c) Sindre Sorhus
8
- @license MIT
9
- */
10
-
11
- /* eslint-disable */
12
- // @ts-nocheck
13
-
14
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
15
- var hasOwnProperty = Object.prototype.hasOwnProperty;
16
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
17
-
18
- function toObject(val) {
19
- if (val === null || val === undefined) {
20
- throw new TypeError('Object.assign cannot be called with null or undefined');
21
- }
22
-
23
- return Object(val);
24
- }
25
-
26
- function shouldUseNative() {
27
- try {
28
- if (!Object.assign) {
29
- return false;
30
- }
31
-
32
- // Detect buggy property enumeration order in older V8 versions.
33
-
34
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
35
- var test1 = new String('abc');
36
- test1[5] = 'de';
37
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
38
- return false;
39
- }
40
-
41
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
42
- var test2 = {};
43
- for (var i = 0; i < 10; i++) {
44
- test2['_' + String.fromCharCode(i)] = i;
45
- }
46
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
47
- return test2[n];
48
- });
49
- if (order2.join('') !== '0123456789') {
50
- return false;
51
- }
52
-
53
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
54
- var test3 = {};
55
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
56
- test3[letter] = letter;
57
- });
58
- if (Object.keys(Object.assign({}, test3)).join('') !==
59
- 'abcdefghijklmnopqrst') {
60
- return false;
61
- }
62
-
63
- return true;
64
- } catch (err) {
65
- // We don't expect any of the above to throw, but better to be safe.
66
- return false;
67
- }
68
- }
1
+ /**
2
+ * A tiny polyfill for Object.assign
3
+ */
69
4
 
70
5
  // https://www.npmjs.com/package/@types/object-assign
71
6
  type ObjectAssign = (<T, U>(target: T, source: U) => T & U) &
@@ -74,31 +9,17 @@ type ObjectAssign = (<T, U>(target: T, source: U) => T & U) &
74
9
  (<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q) => T & U & V & W & Q) &
75
10
  (<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R) => T & U & V & W & Q & R) &
76
11
  ((target: any, ...sources: any[]) => any);
77
-
78
- export const objectAssign: ObjectAssign = shouldUseNative() ? Object.assign : function (target, source) {
79
- var from;
80
- var to = toObject(target);
81
- var symbols;
82
-
83
- for (var s = 1; s < arguments.length; s++) {
84
- from = Object(arguments[s]);
85
-
86
- // eslint-disable-next-line no-restricted-syntax
87
- for (var key in from) {
88
- if (hasOwnProperty.call(from, key)) {
89
- to[key] = from[key];
90
- }
91
- }
92
-
93
- if (getOwnPropertySymbols) {
94
- symbols = getOwnPropertySymbols(from);
95
- for (var i = 0; i < symbols.length; i++) {
96
- if (propIsEnumerable.call(from, symbols[i])) {
97
- to[symbols[i]] = from[symbols[i]];
98
- }
12
+ export const objectAssign: ObjectAssign = Object.assign || function (target: any) {
13
+ if (target === null || target === undefined) throw new TypeError('Object.assign cannot be called with null or undefined');
14
+ target = Object(target);
15
+
16
+ for (let i = 1; i < arguments.length; i++) {
17
+ const source = Object(arguments[i]); // eslint-disable-next-line no-restricted-syntax
18
+ for (const key in source) {
19
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20
+ target[key] = source[key];
99
21
  }
100
22
  }
101
23
  }
102
-
103
- return to;
24
+ return target;
104
25
  };
@@ -1,129 +1,17 @@
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.
1
+ export function setToArray<T>(set: Set<T>): T[] {
2
+ if (Array.from) return Array.from(set);
4
3
 
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;
4
+ const array: T[] = [];
5
+ set.forEach((value: T) => {
6
+ array.push(value);
7
+ });
8
+ return array;
111
9
  }
112
10
 
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;
11
+ export function returnSetsUnion<T>(set: Set<T>, set2: Set<T>): Set<T> {
12
+ return new Set(setToArray(set).concat(setToArray(set2)));
121
13
  }
122
14
 
123
15
  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);
16
+ return list.filter(item => list2.indexOf(item) === -1);
129
17
  }
@@ -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';
@@ -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;
@@ -72,7 +72,7 @@ export interface ISdkFactoryParams {
72
72
  sdkManagerFactory: typeof sdkManagerFactory;
73
73
  sdkClientMethodFactory: (params: ISdkFactoryContext) => ({
74
74
  (): SplitIO.ICsClient;
75
- (key: SplitIO.SplitKey, trafficType?: string | undefined): SplitIO.ICsClient;
75
+ (key: SplitIO.SplitKey): SplitIO.ICsClient;
76
76
  } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient));
77
77
  impressionsObserverFactory: () => IImpressionObserver;
78
78
  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,7 +14,7 @@ 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>;
@@ -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.
@@ -35,7 +34,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
35
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.
36
35
  */
37
36
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
38
- abstract getNamesByFlagSets(flagSets: string[]): ISet<string>[];
37
+ abstract getNamesByFlagSets(flagSets: string[]): Set<string>[];
39
38
  }
40
39
  /**
41
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,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.
@@ -48,7 +47,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
48
47
  */
49
48
  private _checkExpiration;
50
49
  private _checkFilterQuery;
51
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
50
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
52
51
  private addToFlagSets;
53
52
  private removeFromFlagSets;
54
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
  */
@@ -21,7 +20,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
21
20
  getSplitNames(): string[];
22
21
  trafficTypeExists(trafficType: string): boolean;
23
22
  usesSegments(): boolean;
24
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
23
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
25
24
  private addToFlagSets;
26
25
  private removeFromFlagSets;
27
26
  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
  */
@@ -194,7 +193,7 @@ export interface ISplitsCacheBase {
194
193
  clear(): MaybeThenable<boolean | void>;
195
194
  checkCache(): MaybeThenable<boolean>;
196
195
  killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
197
- getNamesByFlagSets(flagSets: string[]): MaybeThenable<ISet<string>[]>;
196
+ getNamesByFlagSets(flagSets: string[]): MaybeThenable<Set<string>[]>;
198
197
  }
199
198
  export interface ISplitsCacheSync extends ISplitsCacheBase {
200
199
  addSplits(entries: [string, ISplit][]): boolean[];
@@ -210,7 +209,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
210
209
  clear(): void;
211
210
  checkCache(): boolean;
212
211
  killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
213
- getNamesByFlagSets(flagSets: string[]): ISet<string>[];
212
+ getNamesByFlagSets(flagSets: string[]): Set<string>[];
214
213
  }
215
214
  export interface ISplitsCacheAsync extends ISplitsCacheBase {
216
215
  addSplits(entries: [string, ISplit][]): Promise<boolean[] | void>;
@@ -226,7 +225,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
226
225
  clear(): Promise<boolean | void>;
227
226
  checkCache(): Promise<boolean>;
228
227
  killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
229
- getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
228
+ getNamesByFlagSets(flagSets: string[]): Promise<Set<string>[]>;
230
229
  }
231
230
  /** Segments cache */
232
231
  export interface ISegmentsCacheBase {
@@ -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
@@ -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
  };
@@ -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
@@ -1,8 +1,7 @@
1
- import { IMap } from '../lang/maps';
2
1
  import { LinkedList, Node } from './LinkedList';
3
2
  export declare class LRUCache<K, V> {
4
3
  maxLen: number;
5
- items: IMap<K, Node<{
4
+ items: Map<K, Node<{
6
5
  key: K;
7
6
  value: V;
8
7
  }>>;
@@ -1,3 +1 @@
1
- export declare const GOOGLE_ANALYTICS_TO_SPLIT = "GOOGLE_ANALYTICS_TO_SPLIT";
2
- export declare const SPLIT_TO_GOOGLE_ANALYTICS = "SPLIT_TO_GOOGLE_ANALYTICS";
3
1
  export declare const DEFAULT_CACHE_EXPIRATION_IN_MILLIS = 864000000;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * A tiny polyfill for Object.assign
3
+ */
1
4
  declare type ObjectAssign = (<T, U>(target: T, source: U) => T & U) & (<T, U, V>(target: T, source1: U, source2: V) => T & U & V) & (<T, U, V, W>(target: T, source1: U, source2: V, source3: W) => T & U & V & W) & (<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q) => T & U & V & W & Q) & (<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R) => T & U & V & W & Q & R) & ((target: any, ...sources: any[]) => any);
2
5
  export declare const objectAssign: ObjectAssign;
3
6
  export {};