@splitsoftware/splitio-commons 1.6.2-rc.0 → 1.6.2-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/CHANGES.txt +4 -0
  2. package/cjs/consent/sdkUserConsent.js +2 -2
  3. package/cjs/evaluator/index.js +15 -16
  4. package/cjs/integrations/ga/GaToSplit.js +8 -5
  5. package/cjs/listeners/browser.js +2 -1
  6. package/cjs/logger/constants.js +2 -1
  7. package/cjs/sdkClient/client.js +19 -7
  8. package/cjs/sdkClient/sdkClient.js +3 -1
  9. package/cjs/sdkFactory/index.js +24 -7
  10. package/cjs/sdkManager/index.js +3 -11
  11. package/cjs/services/splitApi.js +24 -4
  12. package/cjs/storages/AbstractSplitsCacheAsync.js +8 -10
  13. package/cjs/storages/AbstractSplitsCacheSync.js +8 -10
  14. package/cjs/storages/KeyBuilderSS.js +54 -9
  15. package/cjs/storages/dataLoader.js +1 -1
  16. package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +5 -7
  17. package/cjs/storages/inLocalStorage/index.js +5 -1
  18. package/cjs/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
  19. package/cjs/storages/inMemory/InMemoryStorage.js +6 -2
  20. package/cjs/storages/inMemory/InMemoryStorageCS.js +6 -2
  21. package/cjs/storages/inMemory/SplitsCacheInMemory.js +7 -10
  22. package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -5
  23. package/cjs/storages/inMemory/UniqueKeysCacheInMemory.js +73 -0
  24. package/cjs/storages/inMemory/UniqueKeysCacheInMemoryCS.js +78 -0
  25. package/cjs/storages/inRedis/EventsCacheInRedis.js +1 -1
  26. package/cjs/storages/inRedis/ImpressionCountsCacheInRedis.js +50 -0
  27. package/cjs/storages/inRedis/SplitsCacheInRedis.js +15 -9
  28. package/cjs/storages/inRedis/TelemetryCacheInRedis.js +100 -0
  29. package/cjs/storages/inRedis/UniqueKeysCacheInRedis.js +59 -0
  30. package/cjs/storages/inRedis/constants.js +4 -1
  31. package/cjs/storages/inRedis/index.js +17 -2
  32. package/cjs/storages/pluggable/ImpressionCountsCachePluggable.js +43 -0
  33. package/cjs/storages/pluggable/SplitsCachePluggable.js +14 -9
  34. package/cjs/storages/pluggable/TelemetryCachePluggable.js +126 -0
  35. package/cjs/storages/pluggable/UniqueKeysCachePluggable.js +50 -0
  36. package/cjs/storages/pluggable/index.js +42 -17
  37. package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
  38. package/cjs/sync/polling/updaters/splitChangesUpdater.js +1 -1
  39. package/cjs/sync/submitters/submitterManager.js +3 -0
  40. package/cjs/sync/submitters/telemetrySubmitter.js +8 -4
  41. package/cjs/sync/submitters/uniqueKeysSubmitter.js +27 -0
  42. package/cjs/trackers/impressionsTracker.js +22 -41
  43. package/cjs/trackers/strategy/strategyDebug.js +25 -0
  44. package/cjs/trackers/strategy/strategyNone.js +29 -0
  45. package/cjs/trackers/strategy/strategyOptimized.js +35 -0
  46. package/cjs/trackers/telemetryTracker.js +6 -0
  47. package/cjs/trackers/uniqueKeysTracker.js +38 -0
  48. package/cjs/utils/constants/index.js +4 -2
  49. package/cjs/utils/lang/maps.js +15 -7
  50. package/cjs/utils/redis/RedisMock.js +31 -0
  51. package/cjs/utils/settingsValidation/impressionsMode.js +2 -2
  52. package/esm/consent/sdkUserConsent.js +2 -2
  53. package/esm/evaluator/index.js +15 -16
  54. package/esm/integrations/ga/GaToSplit.js +8 -5
  55. package/esm/listeners/browser.js +3 -2
  56. package/esm/logger/constants.js +1 -0
  57. package/esm/sdkClient/client.js +19 -7
  58. package/esm/sdkClient/sdkClient.js +3 -1
  59. package/esm/sdkFactory/index.js +24 -7
  60. package/esm/sdkManager/index.js +3 -11
  61. package/esm/services/splitApi.js +24 -4
  62. package/esm/storages/AbstractSplitsCacheAsync.js +8 -10
  63. package/esm/storages/AbstractSplitsCacheSync.js +8 -10
  64. package/esm/storages/KeyBuilderSS.js +50 -8
  65. package/esm/storages/dataLoader.js +1 -1
  66. package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -7
  67. package/esm/storages/inLocalStorage/index.js +6 -2
  68. package/esm/storages/inMemory/ImpressionCountsCacheInMemory.js +12 -1
  69. package/esm/storages/inMemory/InMemoryStorage.js +8 -4
  70. package/esm/storages/inMemory/InMemoryStorageCS.js +7 -3
  71. package/esm/storages/inMemory/SplitsCacheInMemory.js +7 -10
  72. package/esm/storages/inMemory/TelemetryCacheInMemory.js +9 -5
  73. package/esm/storages/inMemory/UniqueKeysCacheInMemory.js +70 -0
  74. package/esm/storages/inMemory/UniqueKeysCacheInMemoryCS.js +75 -0
  75. package/esm/storages/inRedis/EventsCacheInRedis.js +1 -1
  76. package/esm/storages/inRedis/ImpressionCountsCacheInRedis.js +47 -0
  77. package/esm/storages/inRedis/SplitsCacheInRedis.js +15 -9
  78. package/esm/storages/inRedis/TelemetryCacheInRedis.js +100 -0
  79. package/esm/storages/inRedis/UniqueKeysCacheInRedis.js +56 -0
  80. package/esm/storages/inRedis/constants.js +3 -0
  81. package/esm/storages/inRedis/index.js +18 -3
  82. package/esm/storages/pluggable/ImpressionCountsCachePluggable.js +40 -0
  83. package/esm/storages/pluggable/SplitsCachePluggable.js +14 -9
  84. package/esm/storages/pluggable/TelemetryCachePluggable.js +126 -0
  85. package/esm/storages/pluggable/UniqueKeysCachePluggable.js +47 -0
  86. package/esm/storages/pluggable/index.js +43 -18
  87. package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
  88. package/esm/sync/polling/updaters/splitChangesUpdater.js +1 -1
  89. package/esm/sync/submitters/submitterManager.js +3 -0
  90. package/esm/sync/submitters/telemetrySubmitter.js +9 -5
  91. package/esm/sync/submitters/uniqueKeysSubmitter.js +23 -0
  92. package/esm/trackers/impressionsTracker.js +22 -41
  93. package/esm/trackers/strategy/strategyDebug.js +21 -0
  94. package/esm/trackers/strategy/strategyNone.js +25 -0
  95. package/esm/trackers/strategy/strategyOptimized.js +31 -0
  96. package/esm/trackers/telemetryTracker.js +6 -0
  97. package/esm/trackers/uniqueKeysTracker.js +34 -0
  98. package/esm/utils/constants/index.js +2 -0
  99. package/esm/utils/lang/maps.js +15 -7
  100. package/esm/utils/redis/RedisMock.js +28 -0
  101. package/esm/utils/settingsValidation/impressionsMode.js +3 -3
  102. package/package.json +1 -2
  103. package/src/consent/sdkUserConsent.ts +2 -2
  104. package/src/evaluator/index.ts +14 -15
  105. package/src/integrations/ga/GaToSplit.ts +9 -5
  106. package/src/integrations/types.ts +2 -1
  107. package/src/listeners/browser.ts +3 -2
  108. package/src/logger/constants.ts +1 -0
  109. package/src/sdkClient/client.ts +21 -8
  110. package/src/sdkClient/sdkClient.ts +3 -1
  111. package/src/sdkFactory/index.ts +28 -8
  112. package/src/sdkFactory/types.ts +7 -4
  113. package/src/sdkManager/index.ts +3 -12
  114. package/src/services/splitApi.ts +26 -4
  115. package/src/services/types.ts +8 -2
  116. package/src/storages/AbstractSplitsCacheAsync.ts +13 -15
  117. package/src/storages/AbstractSplitsCacheSync.ts +15 -17
  118. package/src/storages/KeyBuilderSS.ts +61 -9
  119. package/src/storages/dataLoader.ts +1 -1
  120. package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +8 -11
  121. package/src/storages/inLocalStorage/index.ts +5 -2
  122. package/src/storages/inMemory/ImpressionCountsCacheInMemory.ts +16 -1
  123. package/src/storages/inMemory/InMemoryStorage.ts +7 -4
  124. package/src/storages/inMemory/InMemoryStorageCS.ts +6 -3
  125. package/src/storages/inMemory/SplitsCacheInMemory.ts +10 -14
  126. package/src/storages/inMemory/TelemetryCacheInMemory.ts +10 -6
  127. package/src/storages/inMemory/UniqueKeysCacheInMemory.ts +82 -0
  128. package/src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts +88 -0
  129. package/src/storages/inRedis/EventsCacheInRedis.ts +1 -1
  130. package/src/storages/inRedis/ImpressionCountsCacheInRedis.ts +53 -0
  131. package/src/storages/inRedis/SplitsCacheInRedis.ts +21 -17
  132. package/src/storages/inRedis/TelemetryCacheInRedis.ts +122 -2
  133. package/src/storages/inRedis/UniqueKeysCacheInRedis.ts +65 -0
  134. package/src/storages/inRedis/constants.ts +3 -0
  135. package/src/storages/inRedis/index.ts +15 -5
  136. package/src/storages/pluggable/ImpressionCountsCachePluggable.ts +47 -0
  137. package/src/storages/pluggable/SplitsCachePluggable.ts +20 -17
  138. package/src/storages/pluggable/TelemetryCachePluggable.ts +147 -2
  139. package/src/storages/pluggable/UniqueKeysCachePluggable.ts +56 -0
  140. package/src/storages/pluggable/index.ts +44 -19
  141. package/src/storages/types.ts +50 -29
  142. package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +5 -6
  143. package/src/sync/polling/updaters/splitChangesUpdater.ts +2 -2
  144. package/src/sync/submitters/submitterManager.ts +2 -0
  145. package/src/sync/submitters/telemetrySubmitter.ts +15 -8
  146. package/src/sync/submitters/types.ts +38 -7
  147. package/src/sync/submitters/uniqueKeysSubmitter.ts +36 -0
  148. package/src/trackers/impressionsTracker.ts +27 -48
  149. package/src/trackers/strategy/strategyDebug.ts +28 -0
  150. package/src/trackers/strategy/strategyNone.ts +34 -0
  151. package/src/trackers/strategy/strategyOptimized.ts +42 -0
  152. package/src/trackers/telemetryTracker.ts +7 -2
  153. package/src/trackers/types.ts +32 -0
  154. package/src/trackers/uniqueKeysTracker.ts +48 -0
  155. package/src/types.ts +1 -1
  156. package/src/utils/constants/index.ts +2 -0
  157. package/src/utils/lang/maps.ts +20 -8
  158. package/src/utils/redis/RedisMock.ts +33 -0
  159. package/src/utils/settingsValidation/impressionsMode.ts +3 -3
  160. package/src/utils/settingsValidation/index.ts +1 -0
  161. package/types/integrations/types.d.ts +2 -1
  162. package/types/logger/browser/{debugLogger.d.ts → DebugLogger.d.ts} +0 -0
  163. package/types/logger/browser/{errorLogger.d.ts → ErrorLogger.d.ts} +0 -0
  164. package/types/logger/browser/{infoLogger.d.ts → InfoLogger.d.ts} +0 -0
  165. package/types/logger/browser/{warnLogger.d.ts → WarnLogger.d.ts} +0 -0
  166. package/types/logger/constants.d.ts +1 -0
  167. package/types/sdkFactory/types.d.ts +4 -2
  168. package/types/services/types.d.ts +6 -2
  169. package/types/storages/AbstractSplitsCacheAsync.d.ts +7 -6
  170. package/types/storages/AbstractSplitsCacheSync.d.ts +6 -6
  171. package/types/storages/KeyBuilderSS.d.ts +9 -2
  172. package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +3 -4
  173. package/types/storages/inMemory/ImpressionCountsCacheInMemory.d.ts +5 -1
  174. package/types/storages/inMemory/SplitsCacheInMemory.d.ts +3 -2
  175. package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -3
  176. package/types/storages/inMemory/uniqueKeysCacheInMemory.d.ts +35 -0
  177. package/types/storages/inMemory/uniqueKeysCacheInMemoryCS.d.ts +37 -0
  178. package/types/storages/inRedis/EventsCacheInRedis.d.ts +1 -1
  179. package/types/storages/inRedis/ImpressionCountsCacheInRedis.d.ts +14 -0
  180. package/types/storages/inRedis/SplitsCacheInRedis.d.ts +6 -5
  181. package/types/storages/inRedis/TelemetryCacheInRedis.d.ts +16 -1
  182. package/types/storages/inRedis/constants.d.ts +3 -0
  183. package/types/storages/inRedis/uniqueKeysCacheInRedis.d.ts +15 -0
  184. package/types/storages/pluggable/ImpressionCountsCachePluggable.d.ts +14 -0
  185. package/types/storages/pluggable/SplitsCachePluggable.d.ts +6 -5
  186. package/types/storages/pluggable/TelemetryCachePluggable.d.ts +17 -1
  187. package/types/storages/pluggable/UniqueKeysCachePluggable.d.ts +14 -0
  188. package/types/storages/types.d.ts +38 -25
  189. package/types/sync/polling/updaters/splitChangesUpdater.d.ts +1 -1
  190. package/types/sync/submitters/telemetrySubmitter.d.ts +1 -1
  191. package/types/sync/submitters/types.d.ts +30 -7
  192. package/types/sync/submitters/uniqueKeysSubmitter.d.ts +0 -8
  193. package/types/trackers/impressionsTracker.d.ts +4 -6
  194. package/types/trackers/types.d.ts +27 -0
  195. package/types/trackers/uniqueKeysTracker.d.ts +3 -3
  196. package/types/types.d.ts +1 -1
  197. package/types/utils/constants/index.d.ts +2 -0
  198. package/types/utils/lang/maps.d.ts +6 -2
  199. package/types/utils/redis/RedisMock.d.ts +4 -0
  200. package/src/splitio.d.ts +0 -1602
  201. package/types/integrations/ga/GaToSplitPlugin.d.ts +0 -3
  202. package/types/integrations/ga/SplitToGaPlugin.d.ts +0 -4
  203. package/types/integrations/ga/autoRequire.d.ts +0 -4
  204. package/types/logger/codes.d.ts +0 -2
  205. package/types/logger/codesConstants.d.ts +0 -117
  206. package/types/logger/codesConstantsBrowser.d.ts +0 -2
  207. package/types/logger/codesConstantsNode.d.ts +0 -14
  208. package/types/logger/codesDebug.d.ts +0 -1
  209. package/types/logger/codesDebugBrowser.d.ts +0 -1
  210. package/types/logger/codesDebugNode.d.ts +0 -1
  211. package/types/logger/codesError.d.ts +0 -1
  212. package/types/logger/codesErrorNode.d.ts +0 -1
  213. package/types/logger/codesInfo.d.ts +0 -1
  214. package/types/logger/codesWarn.d.ts +0 -1
  215. package/types/logger/codesWarnNode.d.ts +0 -1
  216. package/types/logger/debugLogger.d.ts +0 -2
  217. package/types/logger/errorLogger.d.ts +0 -2
  218. package/types/logger/infoLogger.d.ts +0 -2
  219. package/types/logger/messages/debugBrowser.d.ts +0 -1
  220. package/types/logger/messages/debugNode.d.ts +0 -1
  221. package/types/logger/messages/errorNode.d.ts +0 -1
  222. package/types/logger/messages/warnNode.d.ts +0 -1
  223. package/types/logger/noopLogger.d.ts +0 -2
  224. package/types/logger/warnLogger.d.ts +0 -2
  225. package/types/sdkClient/types.d.ts +0 -18
  226. package/types/sdkFactory/userConsentProps.d.ts +0 -6
  227. package/types/sdkManager/sdkManagerMethod.d.ts +0 -6
  228. package/types/storages/getRegisteredSegments.d.ts +0 -10
  229. package/types/storages/inMemory/CountsCacheInMemory.d.ts +0 -20
  230. package/types/storages/inMemory/LatenciesCacheInMemory.d.ts +0 -20
  231. package/types/storages/inMemory/index.d.ts +0 -10
  232. package/types/storages/inRedis/CountsCacheInRedis.d.ts +0 -9
  233. package/types/storages/inRedis/LatenciesCacheInRedis.d.ts +0 -9
  234. package/types/storages/parseSegments.d.ts +0 -6
  235. package/types/sync/offline/LocalhostFromFile.d.ts +0 -2
  236. package/types/sync/offline/splitsParser/splitsParserFromFile.d.ts +0 -2
  237. package/types/sync/polling/syncTasks/splitsSyncTask.copy.d.ts +0 -35
  238. package/types/sync/polling/syncTasks/splitsSyncTask.morelikeoriginal.d.ts +0 -35
  239. package/types/sync/streaming/AuthClient/indexV1.d.ts +0 -12
  240. package/types/sync/streaming/AuthClient/indexV2.d.ts +0 -8
  241. package/types/sync/streaming/pushManagerCS.d.ts +0 -1
  242. package/types/sync/streaming/pushManagerNoUsers.d.ts +0 -13
  243. package/types/sync/streaming/pushManagerSS.d.ts +0 -1
  244. package/types/sync/submitters/eventsSyncTask.d.ts +0 -8
  245. package/types/sync/submitters/impressionCountsSyncTask.d.ts +0 -13
  246. package/types/sync/submitters/impressionsSyncTask.d.ts +0 -14
  247. package/types/sync/submitters/metricsSyncTask.d.ts +0 -12
  248. package/types/sync/submitters/submitterSyncTask.d.ts +0 -10
  249. package/types/sync/submitters/telemetrySyncTask.d.ts +0 -0
  250. package/types/sync/syncManagerFromFile.d.ts +0 -2
  251. package/types/sync/syncManagerFromObject.d.ts +0 -2
  252. package/types/sync/syncManagerOffline.d.ts +0 -9
  253. package/types/sync/syncTaskComposite.d.ts +0 -5
  254. package/types/trackers/telemetryRecorder.d.ts +0 -0
  255. package/types/utils/EventEmitter.d.ts +0 -4
  256. package/types/utils/consent.d.ts +0 -2
  257. package/types/utils/lang/errors.d.ts +0 -10
  258. package/types/utils/murmur3/commons.d.ts +0 -12
  259. package/types/utils/settingsValidation/buildMetadata.d.ts +0 -3
  260. package/types/utils/settingsValidation/localhost/index.d.ts +0 -9
  261. package/types/utils/settingsValidation/logger.d.ts +0 -11
  262. package/types/utils/settingsValidation/runtime/browser.d.ts +0 -2
  263. package/types/utils/settingsValidation/runtime/node.d.ts +0 -2
  264. package/types/utils/settingsValidation/userConsent.d.ts +0 -5
  265. package/types/utils/timeTracker/index.d.ts +0 -1
@@ -1,5 +1,7 @@
1
+ /* eslint-disable no-use-before-define */
1
2
  import { IMetadata } from '../../dtos/types';
2
3
  import { SplitIO } from '../../types';
4
+ import { IMap } from '../../utils/lang/maps';
3
5
  import { ISyncTask } from '../types';
4
6
 
5
7
  export type ImpressionsPayload = {
@@ -35,6 +37,24 @@ export type ImpressionCountsPayload = {
35
37
  }[]
36
38
  }
37
39
 
40
+ export type UniqueKeysPayloadSs = {
41
+ keys: {
42
+ /** Split name */
43
+ f: string
44
+ /** keyNames */
45
+ ks: string[]
46
+ }[]
47
+ }
48
+
49
+ export type UniqueKeysPayloadCs = {
50
+ keys: {
51
+ /** keyNames */
52
+ k: string
53
+ /** Split name */
54
+ fs: string[]
55
+ }[]
56
+ }
57
+
38
58
  export type StoredImpressionWithMetadata = {
39
59
  /** Metadata */
40
60
  m: IMetadata,
@@ -64,6 +84,12 @@ export type StoredEventWithMetadata = {
64
84
  e: SplitIO.EventData
65
85
  }
66
86
 
87
+ export type MultiMethodLatencies = IMap<string, MethodLatencies>
88
+
89
+ export type MultiMethodExceptions = IMap<string, MethodExceptions>
90
+
91
+ export type MultiConfigs = IMap<string, TelemetryConfigStats>
92
+
67
93
  /**
68
94
  * Telemetry usage stats
69
95
  */
@@ -115,11 +141,15 @@ export type StreamingEvent = {
115
141
  t: number, // timestamp
116
142
  }
117
143
 
144
+ // 'telemetry.latencias' and 'telemetry.exceptions' Redis/Pluggable keys
145
+ export type TelemetryUsageStats = {
146
+ mL?: MethodLatencies, // clientMethodLatencies
147
+ mE?: MethodExceptions, // methodExceptions
148
+ }
149
+
118
150
  // 'metrics/usage' JSON request body
119
- export type TelemetryUsageStatsPayload = {
151
+ export type TelemetryUsageStatsPayload = TelemetryUsageStats & {
120
152
  lS: LastSync, // lastSynchronization
121
- mL: MethodLatencies, // clientMethodLatencies
122
- mE: MethodExceptions, // methodExceptions
123
153
  hE: HttpErrors, // httpErrors
124
154
  hL: HttpLatencies, // httpLatencies
125
155
  tR: number, // tokenRefreshes
@@ -127,9 +157,9 @@ export type TelemetryUsageStatsPayload = {
127
157
  iQ: number, // impressionsQueued
128
158
  iDe: number, // impressionsDeduped
129
159
  iDr: number, // impressionsDropped
130
- spC: number, // splitCount
131
- seC: number, // segmentCount
132
- skC: number, // segmentKeyCount
160
+ spC?: number, // splitCount
161
+ seC?: number, // segmentCount
162
+ skC?: number, // segmentKeyCount
133
163
  sL?: number, // sessionLengthMs
134
164
  eQ: number, // eventsQueued
135
165
  eD: number, // eventsDropped
@@ -148,7 +178,8 @@ export type OperationMode = STANDALONE_ENUM | CONSUMER_ENUM | CONSUMER_PARTIAL_E
148
178
 
149
179
  export type OPTIMIZED_ENUM = 0;
150
180
  export type DEBUG_ENUM = 1;
151
- export type ImpressionsMode = OPTIMIZED_ENUM | DEBUG_ENUM;
181
+ export type NONE_ENUM = 2;
182
+ export type ImpressionsMode = OPTIMIZED_ENUM | DEBUG_ENUM | NONE_ENUM;
152
183
 
153
184
  export type RefreshRates = {
154
185
  sp: number, // splits
@@ -0,0 +1,36 @@
1
+ import { SUBMITTERS_PUSH_FULL_QUEUE } from '../../logger/constants';
2
+ import { ISdkFactoryContextSync } from '../../sdkFactory/types';
3
+ import { submitterFactory } from './submitter';
4
+
5
+ const DATA_NAME = 'unique keys';
6
+ const UNIQUE_KEYS_RATE = 900000; // 15 minutes
7
+
8
+ /**
9
+ * Submitter that periodically posts impression counts
10
+ */
11
+ export function uniqueKeysSubmitterFactory(params: ISdkFactoryContextSync) {
12
+
13
+ const {
14
+ settings: { log, core: { key } },
15
+ splitApi: { postUniqueKeysBulkCs, postUniqueKeysBulkSs },
16
+ storage: { uniqueKeys }
17
+ } = params;
18
+
19
+ const isClientSide = key !== undefined;
20
+ const postUniqueKeysBulk = isClientSide ? postUniqueKeysBulkCs : postUniqueKeysBulkSs;
21
+
22
+ const syncTask = submitterFactory(log, postUniqueKeysBulk, uniqueKeys!, UNIQUE_KEYS_RATE, DATA_NAME);
23
+
24
+ // register unique keys submitter to be executed when uniqueKeys cache is full
25
+ uniqueKeys!.setOnFullQueueCb(() => {
26
+ if (syncTask.isRunning()) {
27
+ log.info(SUBMITTERS_PUSH_FULL_QUEUE, [DATA_NAME]);
28
+ syncTask.execute();
29
+ }
30
+ // If submitter is stopped (e.g., user consent declined or unknown, or app state offline), we don't send the data.
31
+ // Data will be sent when submitter is resumed.
32
+ });
33
+
34
+ return syncTask;
35
+ }
36
+
@@ -1,10 +1,8 @@
1
1
  import { objectAssign } from '../utils/lang/objectAssign';
2
2
  import { thenable } from '../utils/promise/thenable';
3
- import { truncateTimeFrame } from '../utils/time';
4
- import { IImpressionCountsCacheSync, IImpressionsCacheBase, ITelemetryCacheSync, ITelemetryCacheAsync } from '../storages/types';
5
- import { IImpressionsHandler, IImpressionsTracker } from './types';
3
+ import { IImpressionsCacheBase, ITelemetryCacheSync, ITelemetryCacheAsync } from '../storages/types';
4
+ import { IImpressionsHandler, IImpressionsTracker, IStrategy } from './types';
6
5
  import { SplitIO, ImpressionDTO, ISettings } from '../types';
7
- import { IImpressionObserver } from './impressionObserver/types';
8
6
  import { IMPRESSIONS_TRACKER_SUCCESS, ERROR_IMPRESSIONS_TRACKER, ERROR_IMPRESSIONS_LISTENER } from '../logger/constants';
9
7
  import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
10
8
 
@@ -15,18 +13,14 @@ import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
15
13
  * @param metadata runtime metadata (ip, hostname and version)
16
14
  * @param impressionListener optional impression listener
17
15
  * @param integrationsManager optional integrations manager
18
- * @param observer optional impression observer. If provided, previous time (pt property) is included in impression instances
19
- * @param countsCache optional cache to save impressions count. If provided, impressions will be deduped (OPTIMIZED mode)
16
+ * @param strategy strategy for impressions tracking.
20
17
  */
21
18
  export function impressionsTrackerFactory(
22
19
  settings: ISettings,
23
20
  impressionsCache: IImpressionsCacheBase,
21
+ strategy: IStrategy,
24
22
  integrationsManager?: IImpressionsHandler,
25
- // if observer is provided, it implies `shouldAddPreviousTime` flag (i.e., if impressions previous time should be added or not)
26
- observer?: IImpressionObserver,
27
- // if countsCache is provided, it implies `isOptimized` flag (i.e., if impressions should be deduped or not)
28
- countsCache?: IImpressionCountsCacheSync,
29
- telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync
23
+ telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync,
30
24
  ): IImpressionsTracker {
31
25
 
32
26
  const { log, impressionListener, runtime: { ip, hostname }, version } = settings;
@@ -36,51 +30,36 @@ export function impressionsTrackerFactory(
36
30
  if (settings.userConsent === CONSENT_DECLINED) return;
37
31
 
38
32
  const impressionsCount = impressions.length;
33
+ const { impressionsToStore, impressionsToListener, deduped } = strategy.process(impressions);
34
+
35
+ const impressionsToListenerCount = impressionsToListener.length;
36
+
37
+ if ( impressionsToStore.length>0 ){
38
+ const res = impressionsCache.track(impressionsToStore);
39
39
 
40
- const impressionsToStore: ImpressionDTO[] = []; // Track only the impressions that are going to be stored
41
- // Wraps impressions to store and adds previousTime if it corresponds
42
- impressions.forEach((impression) => {
43
- if (observer) {
44
- // Adds previous time if it is enabled
45
- impression.pt = observer.testAndSet(impression);
46
- }
47
-
48
- const now = Date.now();
49
- if (countsCache) {
50
- // Increments impression counter per featureName
51
- countsCache.track(impression.feature, now, 1);
52
- }
53
-
54
- // Checks if the impression should be added in queue to be sent
55
- if (!countsCache || !impression.pt || impression.pt < truncateTimeFrame(now)) {
56
- impressionsToStore.push(impression);
57
- }
58
- });
59
-
60
- const res = impressionsCache.track(impressionsToStore);
61
-
62
- // If we're on an async storage, handle error and log it.
63
- if (thenable(res)) {
64
- res.then(() => {
65
- log.info(IMPRESSIONS_TRACKER_SUCCESS, [impressionsCount]);
66
- }).catch(err => {
67
- log.error(ERROR_IMPRESSIONS_TRACKER, [impressionsCount, err]);
68
- });
69
- } else {
70
- // Record when impressionsCache is sync only (standalone mode)
71
- // @TODO we are not dropping impressions on full queue yet, so DROPPED stats are not recorded
72
- if (telemetryCache) {
73
- (telemetryCache as ITelemetryCacheSync).recordImpressionStats(QUEUED, impressionsToStore.length);
74
- (telemetryCache as ITelemetryCacheSync).recordImpressionStats(DEDUPED, impressions.length - impressionsToStore.length);
40
+ // If we're on an async storage, handle error and log it.
41
+ if (thenable(res)) {
42
+ res.then(() => {
43
+ log.info(IMPRESSIONS_TRACKER_SUCCESS, [impressionsCount]);
44
+ }).catch(err => {
45
+ log.error(ERROR_IMPRESSIONS_TRACKER, [impressionsCount, err]);
46
+ });
47
+ } else {
48
+ // Record when impressionsCache is sync only (standalone mode)
49
+ // @TODO we are not dropping impressions on full queue yet, so DROPPED stats are not recorded
50
+ if (telemetryCache) {
51
+ (telemetryCache as ITelemetryCacheSync).recordImpressionStats(QUEUED, impressionsToStore.length);
52
+ (telemetryCache as ITelemetryCacheSync).recordImpressionStats(DEDUPED, deduped);
53
+ }
75
54
  }
76
55
  }
77
56
 
78
57
  // @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
79
58
  if (impressionListener || integrationsManager) {
80
- for (let i = 0; i < impressionsCount; i++) {
59
+ for (let i = 0; i < impressionsToListenerCount; i++) {
81
60
  const impressionData: SplitIO.ImpressionData = {
82
61
  // copy of impression, to avoid unexpected behaviour if modified by integrations or impressionListener
83
- impression: objectAssign({}, impressions[i]),
62
+ impression: objectAssign({}, impressionsToListener[i]),
84
63
  attributes,
85
64
  ip,
86
65
  hostname,
@@ -0,0 +1,28 @@
1
+ import { ImpressionDTO } from '../../types';
2
+ import { IImpressionObserver } from '../impressionObserver/types';
3
+ import { IStrategy } from '../types';
4
+
5
+ /**
6
+ * Debug strategy for impressions tracker. Wraps impressions to store and adds previousTime if it corresponds
7
+ *
8
+ * @param impressionsObserver impression observer. Previous time (pt property) is included in impression instances
9
+ * @returns IStrategyResult
10
+ */
11
+ export function strategyDebugFactory(
12
+ impressionsObserver: IImpressionObserver
13
+ ): IStrategy {
14
+
15
+ return {
16
+ process(impressions: ImpressionDTO[]) {
17
+ impressions.forEach((impression) => {
18
+ // Adds previous time if it is enabled
19
+ impression.pt = impressionsObserver.testAndSet(impression);
20
+ });
21
+ return {
22
+ impressionsToStore: impressions,
23
+ impressionsToListener: impressions,
24
+ deduped: 0
25
+ };
26
+ }
27
+ };
28
+ }
@@ -0,0 +1,34 @@
1
+ import { IImpressionCountsCacheSync } from '../../storages/types';
2
+ import { ImpressionDTO } from '../../types';
3
+ import { IStrategy, IUniqueKeysTracker } from '../types';
4
+
5
+ /**
6
+ * None strategy for impressions tracker.
7
+ *
8
+ * @param impressionsCounter cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
9
+ * @param uniqueKeysTracker unique keys tracker in charge of tracking the unique keys per split.
10
+ * @returns IStrategyResult
11
+ */
12
+ export function strategyNoneFactory(
13
+ impressionsCounter: IImpressionCountsCacheSync,
14
+ uniqueKeysTracker: IUniqueKeysTracker
15
+ ): IStrategy {
16
+
17
+ return {
18
+ process(impressions: ImpressionDTO[]) {
19
+ impressions.forEach((impression) => {
20
+ const now = Date.now();
21
+ // Increments impression counter per featureName
22
+ impressionsCounter.track(impression.feature, now, 1);
23
+ // Keep track by unique key
24
+ uniqueKeysTracker.track(impression.keyName, impression.feature);
25
+ });
26
+
27
+ return {
28
+ impressionsToStore: [],
29
+ impressionsToListener: impressions,
30
+ deduped: 0
31
+ };
32
+ }
33
+ };
34
+ }
@@ -0,0 +1,42 @@
1
+ import { IImpressionCountsCacheSync } from '../../storages/types';
2
+ import { ImpressionDTO } from '../../types';
3
+ import { truncateTimeFrame } from '../../utils/time';
4
+ import { IImpressionObserver } from '../impressionObserver/types';
5
+ import { IStrategy } from '../types';
6
+
7
+ /**
8
+ * Optimized strategy for impressions tracker. Wraps impressions to store and adds previousTime if it corresponds
9
+ *
10
+ * @param impressionsObserver impression observer. previous time (pt property) is included in impression instances
11
+ * @param impressionsCounter cache to save impressions count. impressions will be deduped (OPTIMIZED mode)
12
+ * @returns IStrategyResult
13
+ */
14
+ export function strategyOptimizedFactory(
15
+ impressionsObserver: IImpressionObserver,
16
+ impressionsCounter: IImpressionCountsCacheSync,
17
+ ): IStrategy {
18
+
19
+ return {
20
+ process(impressions: ImpressionDTO[]) {
21
+ const impressionsToStore: ImpressionDTO[] = [];
22
+ impressions.forEach((impression) => {
23
+ impression.pt = impressionsObserver.testAndSet(impression);
24
+
25
+ const now = Date.now();
26
+
27
+ // Increments impression counter per featureName
28
+ if (impression.pt) impressionsCounter.track(impression.feature, now, 1);
29
+
30
+ // Checks if the impression should be added in queue to be sent
31
+ if (!impression.pt || impression.pt < truncateTimeFrame(now)) {
32
+ impressionsToStore.push(impression);
33
+ }
34
+ });
35
+ return {
36
+ impressionsToStore: impressionsToStore,
37
+ impressionsToListener: impressions,
38
+ deduped: impressions.length - impressionsToStore.length
39
+ };
40
+ }
41
+ };
42
+ }
@@ -48,6 +48,10 @@ export function telemetryTrackerFactory(
48
48
  });
49
49
  if (e === TOKEN_REFRESH) (telemetryCache as ITelemetryCacheSync).recordTokenRefreshes();
50
50
  }
51
+ },
52
+ addTag(tag: string) {
53
+ // @ts-ignore
54
+ if (telemetryCache.addTag) telemetryCache.addTag(tag);
51
55
  }
52
56
  };
53
57
 
@@ -56,8 +60,9 @@ export function telemetryTrackerFactory(
56
60
  return {
57
61
  trackEval: noopTrack,
58
62
  trackHttp: noopTrack,
59
- sessionLength: () => { },
60
- streamingEvent: () => { },
63
+ sessionLength() { },
64
+ streamingEvent() { },
65
+ addTag() { }
61
66
  };
62
67
  }
63
68
  }
@@ -41,4 +41,36 @@ export interface ITelemetryTracker {
41
41
  * Records streaming event
42
42
  */
43
43
  streamingEvent(e: StreamingEventType | AUTH_REJECTION, d?: number): void
44
+ /**
45
+ * Records tag
46
+ */
47
+ addTag(tag: string): void
48
+ }
49
+
50
+ export interface IFilterAdapter {
51
+ add(key: string, featureName: string): boolean;
52
+ contains(key: string, featureName: string): boolean;
53
+ clear(): void;
54
+ refreshRate?: number;
55
+ }
56
+
57
+ export interface IImpressionSenderAdapter {
58
+ recordUniqueKeys(data: Object): void;
59
+ recordImpressionCounts(data: Object): void
60
+ }
61
+
62
+ /** Unique keys tracker */
63
+ export interface IUniqueKeysTracker {
64
+ stop(): void;
65
+ track(key: string, featureName: string): void;
66
+ }
67
+
68
+ export interface IStrategyResult {
69
+ impressionsToStore: ImpressionDTO[],
70
+ impressionsToListener: ImpressionDTO[],
71
+ deduped: number
72
+ }
73
+
74
+ export interface IStrategy {
75
+ process(impressions: ImpressionDTO[]): IStrategyResult
44
76
  }
@@ -0,0 +1,48 @@
1
+ import { LOG_PREFIX_UNIQUE_KEYS_TRACKER } from '../logger/constants';
2
+ import { ILogger } from '../logger/types';
3
+ import { IUniqueKeysCacheBase } from '../storages/types';
4
+ import { IFilterAdapter, IUniqueKeysTracker } from './types';
5
+
6
+ const noopFilterAdapter = {
7
+ add() {return true;},
8
+ contains() {return true;},
9
+ clear() {}
10
+ };
11
+
12
+ /**
13
+ * Trackes uniques keys
14
+ * Unique Keys Tracker will be in charge of checking if the MTK was already sent to the BE in the last period
15
+ * or schedule to be sent; if not it will be added in an internal cache and sent in the next post.
16
+ *
17
+ * @param log Logger instance
18
+ * @param uniqueKeysCache cache to save unique keys
19
+ * @param filterAdapter filter adapter
20
+ */
21
+ export function uniqueKeysTrackerFactory(
22
+ log: ILogger,
23
+ uniqueKeysCache: IUniqueKeysCacheBase,
24
+ filterAdapter: IFilterAdapter = noopFilterAdapter,
25
+ ): IUniqueKeysTracker {
26
+ let intervalId: any;
27
+
28
+ if (filterAdapter.refreshRate) {
29
+ intervalId = setInterval(filterAdapter.clear, filterAdapter.refreshRate);
30
+ }
31
+
32
+ return {
33
+
34
+ track(key: string, featureName: string): void {
35
+ if (!filterAdapter.add(key, featureName)) {
36
+ log.debug(`${LOG_PREFIX_UNIQUE_KEYS_TRACKER}The feature ${featureName} and key ${key} exist in the filter`);
37
+ return;
38
+ }
39
+ uniqueKeysCache.track(key, featureName);
40
+ },
41
+
42
+ stop(): void {
43
+ clearInterval(intervalId);
44
+ }
45
+
46
+ };
47
+
48
+ }
package/src/types.ts CHANGED
@@ -718,7 +718,7 @@ export namespace SplitIO {
718
718
  * ImpressionsMode type
719
719
  * @typedef {string} ImpressionsMode
720
720
  */
721
- export type ImpressionsMode = 'OPTIMIZED' | 'DEBUG'
721
+ export type ImpressionsMode = 'OPTIMIZED' | 'DEBUG' | 'NONE'
722
722
  /**
723
723
  * Defines the format of Split data to preload on the factory storage (cache).
724
724
  */
@@ -19,6 +19,7 @@ export const SPLIT_EVENT = 'EVENT';
19
19
  // Impression collection modes
20
20
  export const DEBUG = 'DEBUG';
21
21
  export const OPTIMIZED = 'OPTIMIZED';
22
+ export const NONE = 'NONE';
22
23
 
23
24
  // SDK Modes
24
25
  export const LOCALHOST_MODE: SDKMode = 'localhost';
@@ -49,6 +50,7 @@ export const CONSUMER_PARTIAL_ENUM = 2;
49
50
 
50
51
  export const OPTIMIZED_ENUM = 0;
51
52
  export const DEBUG_ENUM = 1;
53
+ export const NONE_ENUM = 2;
52
54
 
53
55
  export const SPLITS = 'sp';
54
56
  export const IMPRESSIONS = 'im';
@@ -24,10 +24,12 @@ THE SOFTWARE.
24
24
  **/
25
25
 
26
26
  export interface IMap<K, V> {
27
- set(key: K, value: V): this;
28
27
  clear(): void;
29
28
  delete(key: K): boolean;
29
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
30
30
  get(key: K): V | undefined;
31
+ has(key: K): boolean;
32
+ set(key: K, value: V): this;
31
33
  readonly size: number;
32
34
  }
33
35
 
@@ -46,13 +48,6 @@ export class MapPoly<K, V> implements IMap<K, V>{
46
48
  this.__mapValuesData__.length = 0;
47
49
  }
48
50
 
49
- set(key: K, value: V) {
50
- let index = this.__mapKeysData__.indexOf(key);
51
- if (index === -1) index = this.__mapKeysData__.push(key) - 1;
52
- this.__mapValuesData__[index] = value;
53
- return this;
54
- }
55
-
56
51
  delete(key: K) {
57
52
  const index = this.__mapKeysData__.indexOf(key);
58
53
  if (index === -1) return false;
@@ -61,12 +56,29 @@ export class MapPoly<K, V> implements IMap<K, V>{
61
56
  return true;
62
57
  }
63
58
 
59
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) {
60
+ for (let i = 0; i < this.__mapKeysData__.length; i++) {
61
+ callbackfn.call(thisArg, this.__mapValuesData__[i], this.__mapKeysData__[i], this as any);
62
+ }
63
+ }
64
+
64
65
  get(key: K) {
65
66
  const index = this.__mapKeysData__.indexOf(key);
66
67
  if (index === -1) return;
67
68
  return this.__mapValuesData__[index];
68
69
  }
69
70
 
71
+ has(key: K): boolean {
72
+ return this.__mapKeysData__.indexOf(key) !== -1;
73
+ }
74
+
75
+ set(key: K, value: V) {
76
+ let index = this.__mapKeysData__.indexOf(key);
77
+ if (index === -1) index = this.__mapKeysData__.push(key) - 1;
78
+ this.__mapValuesData__[index] = value;
79
+ return this;
80
+ }
81
+
70
82
  get size() {
71
83
  return this.__mapKeysData__.length;
72
84
  }
@@ -0,0 +1,33 @@
1
+ //@ts-nocheck
2
+ function identityFunction(data: any): any {
3
+ return data;
4
+ }
5
+
6
+ function asyncFunction(data: any): Promise<any> {
7
+ return Promise.resolve(data);
8
+ }
9
+
10
+ const IDENTITY_METHODS: string[] = [];
11
+ const ASYNC_METHODS = ['rpush', 'hincrby'];
12
+ const PIPELINE_METHODS = ['rpush', 'hincrby'];
13
+
14
+ export class RedisMock {
15
+
16
+ private pipelineMethods: any = { exec: jest.fn(asyncFunction) }
17
+
18
+ constructor() {
19
+ IDENTITY_METHODS.forEach(method => {
20
+ this[method] = jest.fn(identityFunction);
21
+ });
22
+ ASYNC_METHODS.forEach(method => {
23
+ this[method] = jest.fn(asyncFunction);
24
+ });
25
+ PIPELINE_METHODS.forEach(method => {
26
+ this.pipelineMethods[method] = this[method];
27
+ });
28
+
29
+ this.pipeline = jest.fn(() => {return this.pipelineMethods;});
30
+ }
31
+
32
+
33
+ }
@@ -1,14 +1,14 @@
1
1
  import { ERROR_INVALID_CONFIG_PARAM } from '../../logger/constants';
2
2
  import { ILogger } from '../../logger/types';
3
3
  import { SplitIO } from '../../types';
4
- import { DEBUG, OPTIMIZED } from '../constants';
4
+ import { DEBUG, OPTIMIZED, NONE } from '../constants';
5
5
  import { stringToUpperCase } from '../lang';
6
6
 
7
7
  export function validImpressionsMode(log: ILogger, impressionsMode: any): SplitIO.ImpressionsMode {
8
8
  impressionsMode = stringToUpperCase(impressionsMode);
9
9
 
10
- if ([DEBUG, OPTIMIZED].indexOf(impressionsMode) > -1) return impressionsMode;
10
+ if ([DEBUG, OPTIMIZED, NONE].indexOf(impressionsMode) > -1) return impressionsMode;
11
11
 
12
- log.error(ERROR_INVALID_CONFIG_PARAM, ['impressionsMode', [DEBUG, OPTIMIZED], OPTIMIZED]);
12
+ log.error(ERROR_INVALID_CONFIG_PARAM, ['impressionsMode', [DEBUG, OPTIMIZED, NONE], OPTIMIZED]);
13
13
  return OPTIMIZED;
14
14
  }
@@ -136,6 +136,7 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
136
136
  if (get(config, 'scheduler.impressionsRefreshRate') === undefined && withDefaults.sync.impressionsMode === DEBUG) scheduler.impressionsRefreshRate = 60;
137
137
  scheduler.impressionsRefreshRate = fromSecondsToMillis(scheduler.impressionsRefreshRate);
138
138
 
139
+
139
140
  // Log deprecation for old telemetry param
140
141
  if (scheduler.metricsRefreshRate) log.warn('`metricsRefreshRate` will be deprecated soon. For configuring telemetry rates, update `telemetryRefreshRate` value in configs');
141
142
 
@@ -1,5 +1,5 @@
1
1
  import { IEventsCacheBase } from '../storages/types';
2
- import { IEventsHandler, IImpressionsHandler } from '../trackers/types';
2
+ import { IEventsHandler, IImpressionsHandler, ITelemetryTracker } from '../trackers/types';
3
3
  import { ISettings, SplitIO } from '../types';
4
4
  export interface IIntegration {
5
5
  queue(data: SplitIO.IntegrationData): void;
@@ -10,6 +10,7 @@ export interface IIntegrationFactoryParams {
10
10
  events: IEventsCacheBase;
11
11
  };
12
12
  settings: ISettings;
13
+ telemetryTracker: ITelemetryTracker;
13
14
  }
14
15
  export declare type IntegrationFactory = {
15
16
  readonly type: string;
@@ -138,4 +138,5 @@ export declare const LOG_PREFIX_SYNC_POLLING: string;
138
138
  export declare const LOG_PREFIX_SYNC_SUBMITTERS: string;
139
139
  export declare const LOG_PREFIX_IMPRESSIONS_TRACKER = "impressions-tracker: ";
140
140
  export declare const LOG_PREFIX_EVENTS_TRACKER = "events-tracker: ";
141
+ export declare const LOG_PREFIX_UNIQUE_KEYS_TRACKER = "unique-keys-tracker: ";
141
142
  export declare const LOG_PREFIX_CLEANUP = "cleanup: ";
@@ -6,7 +6,7 @@ import { IFetch, ISplitApi, IEventSourceConstructor } from '../services/types';
6
6
  import { IStorageAsync, IStorageSync, ISplitsCacheSync, ISplitsCacheAsync, IStorageFactoryParams } from '../storages/types';
7
7
  import { ISyncManager } from '../sync/types';
8
8
  import { IImpressionObserver } from '../trackers/impressionObserver/types';
9
- import { IImpressionsTracker, IEventTracker, ITelemetryTracker } from '../trackers/types';
9
+ import { IImpressionsTracker, IEventTracker, ITelemetryTracker, IFilterAdapter, IUniqueKeysTracker } from '../trackers/types';
10
10
  import { SplitIO, ISettings, IEventEmitter } from '../types';
11
11
  /**
12
12
  * Environment related dependencies.
@@ -42,6 +42,7 @@ export interface ISdkFactoryContext {
42
42
  eventTracker: IEventTracker;
43
43
  telemetryTracker: ITelemetryTracker;
44
44
  storage: IStorageSync | IStorageAsync;
45
+ uniqueKeysTracker?: IUniqueKeysTracker;
45
46
  signalListener?: ISignalListener;
46
47
  splitApi?: ISplitApi;
47
48
  syncManager?: ISyncManager;
@@ -70,11 +71,12 @@ export interface ISdkFactoryParams {
70
71
  (): SplitIO.ICsClient;
71
72
  (key: SplitIO.SplitKey, trafficType?: string | undefined): SplitIO.ICsClient;
72
73
  } | (() => SplitIO.IClient) | (() => SplitIO.IAsyncClient));
74
+ impressionsObserverFactory: () => IImpressionObserver;
75
+ filterAdapterFactory?: () => IFilterAdapter;
73
76
  SignalListener?: new (syncManager: ISyncManager | undefined, // Used by NodeSignalListener to flush data, and by BrowserSignalListener to close streaming connection.
74
77
  settings: ISettings, // Used by BrowserSignalListener
75
78
  storage: IStorageSync | IStorageAsync, // Used by BrowserSignalListener
76
79
  serviceApi: ISplitApi | undefined) => ISignalListener;
77
80
  integrationsManagerFactory?: (params: IIntegrationFactoryParams) => IIntegrationManager | undefined;
78
- impressionsObserverFactory?: () => IImpressionObserver;
79
81
  extraProps?: (params: ISdkFactoryContext) => object;
80
82
  }