@splitsoftware/splitio-commons 1.16.1-rc.8 → 1.17.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.
- package/CHANGES.txt +2 -1
- package/cjs/evaluator/matchers/index.js +1 -3
- package/cjs/evaluator/matchers/matcherTypes.js +0 -1
- package/cjs/evaluator/matchersTransform/index.js +1 -1
- package/cjs/logger/constants.js +4 -3
- package/cjs/logger/messages/info.js +2 -1
- package/cjs/readiness/readinessManager.js +10 -14
- package/cjs/readiness/sdkReadinessManager.js +6 -5
- package/cjs/sdkClient/sdkClientMethodCS.js +2 -2
- package/cjs/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/cjs/sdkFactory/index.js +1 -1
- package/cjs/services/decorateHeaders.js +43 -0
- package/cjs/services/splitApi.js +0 -4
- package/cjs/services/splitHttpClient.js +5 -4
- package/cjs/storages/AbstractSplitsCacheAsync.js +2 -2
- package/cjs/storages/AbstractSplitsCacheSync.js +6 -5
- package/cjs/storages/KeyBuilder.js +0 -3
- package/cjs/storages/KeyBuilderCS.js +5 -17
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +4 -16
- package/cjs/storages/inLocalStorage/index.js +2 -6
- package/cjs/storages/inMemory/InMemoryStorageCS.js +0 -5
- package/cjs/storages/inMemory/SplitsCacheInMemory.js +11 -20
- package/cjs/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/cjs/storages/pluggable/inMemoryWrapper.js +1 -1
- package/cjs/sync/polling/fetchers/mySegmentsFetcher.js +1 -5
- package/cjs/sync/polling/pollingManagerCS.js +33 -51
- package/cjs/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +21 -20
- package/cjs/sync/streaming/SSEClient/index.js +9 -12
- package/cjs/sync/streaming/SSEHandler/index.js +0 -1
- package/cjs/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +9 -23
- package/cjs/sync/streaming/constants.js +1 -2
- package/cjs/sync/streaming/parseUtils.js +8 -3
- package/cjs/sync/streaming/pushManager.js +69 -100
- package/cjs/sync/submitters/telemetrySubmitter.js +0 -4
- package/cjs/sync/syncManagerOnline.js +14 -24
- package/cjs/utils/constants/index.js +2 -4
- package/cjs/utils/settingsValidation/index.js +2 -7
- package/esm/evaluator/matchers/index.js +1 -3
- package/esm/evaluator/matchers/matcherTypes.js +0 -1
- package/esm/evaluator/matchersTransform/index.js +1 -1
- package/esm/logger/constants.js +1 -0
- package/esm/logger/messages/info.js +2 -1
- package/esm/readiness/readinessManager.js +10 -14
- package/esm/readiness/sdkReadinessManager.js +6 -5
- package/esm/sdkClient/sdkClientMethodCS.js +2 -2
- package/esm/sdkClient/sdkClientMethodCSWithTT.js +2 -2
- package/esm/sdkFactory/index.js +1 -1
- package/esm/services/decorateHeaders.js +39 -0
- package/esm/services/splitApi.js +1 -5
- package/esm/services/splitHttpClient.js +5 -4
- package/esm/storages/AbstractSplitsCacheAsync.js +2 -2
- package/esm/storages/AbstractSplitsCacheSync.js +4 -3
- package/esm/storages/KeyBuilder.js +0 -3
- package/esm/storages/KeyBuilderCS.js +4 -15
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +5 -17
- package/esm/storages/inLocalStorage/index.js +3 -7
- package/esm/storages/inMemory/InMemoryStorageCS.js +0 -5
- package/esm/storages/inMemory/SplitsCacheInMemory.js +12 -21
- package/esm/storages/inMemory/TelemetryCacheInMemory.js +10 -7
- package/esm/storages/pluggable/inMemoryWrapper.js +1 -1
- package/esm/sync/polling/fetchers/mySegmentsFetcher.js +1 -5
- package/esm/sync/polling/pollingManagerCS.js +34 -52
- package/esm/sync/polling/syncTasks/mySegmentsSyncTask.js +2 -2
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +19 -18
- package/esm/sync/streaming/SSEClient/index.js +10 -13
- package/esm/sync/streaming/SSEHandler/index.js +1 -2
- package/esm/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.js +9 -23
- package/esm/sync/streaming/constants.js +0 -1
- package/esm/sync/streaming/parseUtils.js +8 -3
- package/esm/sync/streaming/pushManager.js +70 -100
- package/esm/sync/submitters/telemetrySubmitter.js +0 -4
- package/esm/sync/syncManagerOnline.js +15 -25
- package/esm/utils/constants/index.js +1 -3
- package/esm/utils/settingsValidation/index.js +2 -7
- package/package.json +1 -1
- package/src/dtos/types.ts +7 -17
- package/src/evaluator/matchers/index.ts +0 -2
- package/src/evaluator/matchers/matcherTypes.ts +0 -1
- package/src/evaluator/matchersTransform/index.ts +1 -1
- package/src/logger/constants.ts +1 -0
- package/src/logger/messages/info.ts +2 -1
- package/src/readiness/readinessManager.ts +9 -13
- package/src/readiness/sdkReadinessManager.ts +7 -7
- package/src/readiness/types.ts +2 -3
- package/src/sdkClient/sdkClientMethodCS.ts +2 -2
- package/src/sdkClient/sdkClientMethodCSWithTT.ts +2 -2
- package/src/sdkFactory/index.ts +1 -1
- package/src/services/decorateHeaders.ts +41 -0
- package/src/services/splitApi.ts +2 -7
- package/src/services/splitHttpClient.ts +6 -5
- package/src/services/types.ts +0 -1
- package/src/storages/AbstractSplitsCacheAsync.ts +2 -2
- package/src/storages/AbstractSplitsCacheSync.ts +5 -4
- package/src/storages/KeyBuilder.ts +0 -3
- package/src/storages/KeyBuilderCS.ts +5 -25
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +3 -3
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +5 -20
- package/src/storages/inLocalStorage/index.ts +4 -8
- package/src/storages/inMemory/InMemoryStorageCS.ts +0 -5
- package/src/storages/inMemory/SplitsCacheInMemory.ts +10 -15
- package/src/storages/inMemory/TelemetryCacheInMemory.ts +11 -7
- package/src/storages/pluggable/inMemoryWrapper.ts +1 -1
- package/src/storages/types.ts +5 -7
- package/src/sync/polling/fetchers/mySegmentsFetcher.ts +2 -6
- package/src/sync/polling/pollingManagerCS.ts +29 -61
- package/src/sync/polling/syncTasks/mySegmentsSyncTask.ts +10 -10
- package/src/sync/polling/types.ts +3 -4
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +20 -17
- package/src/sync/streaming/SSEClient/index.ts +14 -20
- package/src/sync/streaming/SSEHandler/index.ts +1 -2
- package/src/sync/streaming/SSEHandler/types.ts +2 -14
- package/src/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.ts +10 -26
- package/src/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/SplitsUpdateWorker.ts +1 -1
- package/src/sync/streaming/UpdateWorkers/types.ts +2 -2
- package/src/sync/streaming/constants.ts +0 -1
- package/src/sync/streaming/parseUtils.ts +10 -6
- package/src/sync/streaming/pushManager.ts +68 -104
- package/src/sync/streaming/types.ts +3 -5
- package/src/sync/submitters/telemetrySubmitter.ts +0 -4
- package/src/sync/submitters/types.ts +4 -11
- package/src/sync/syncManagerOnline.ts +11 -19
- package/src/types.ts +9 -28
- package/src/utils/constants/index.ts +1 -3
- package/src/utils/settingsValidation/index.ts +3 -8
- package/src/utils/settingsValidation/types.ts +1 -1
- package/types/dtos/types.d.ts +6 -14
- package/types/logger/constants.d.ts +1 -0
- package/types/readiness/readinessManager.d.ts +2 -2
- package/types/readiness/sdkReadinessManager.d.ts +3 -2
- package/types/readiness/types.d.ts +2 -3
- package/types/services/decorateHeaders.d.ts +2 -0
- package/types/services/splitApi.d.ts +1 -1
- package/types/services/splitHttpClient.d.ts +1 -1
- package/types/services/types.d.ts +0 -1
- package/types/storages/AbstractSplitsCacheAsync.d.ts +1 -1
- package/types/storages/AbstractSplitsCacheSync.d.ts +3 -3
- package/types/storages/KeyBuilder.d.ts +0 -1
- package/types/storages/KeyBuilderCS.d.ts +2 -7
- package/types/storages/inLocalStorage/MySegmentsCacheInLocal.d.ts +2 -2
- package/types/storages/inLocalStorage/SplitsCacheInLocal.d.ts +1 -1
- package/types/storages/inMemory/SplitsCacheInMemory.d.ts +2 -3
- package/types/storages/inMemory/TelemetryCacheInMemory.d.ts +6 -4
- package/types/storages/pluggable/inMemoryWrapper.d.ts +1 -1
- package/types/storages/types.d.ts +3 -4
- package/types/sync/polling/syncTasks/mySegmentsSyncTask.d.ts +3 -2
- package/types/sync/polling/types.d.ts +3 -10
- package/types/sync/polling/updaters/mySegmentsUpdater.d.ts +4 -4
- package/types/sync/streaming/SSEClient/index.d.ts +2 -5
- package/types/sync/streaming/SSEHandler/types.d.ts +2 -13
- package/types/sync/streaming/UpdateWorkers/MySegmentsUpdateWorker.d.ts +2 -3
- package/types/sync/streaming/UpdateWorkers/SegmentsUpdateWorker.d.ts +1 -2
- package/types/sync/streaming/UpdateWorkers/SplitsUpdateWorker.d.ts +2 -3
- package/types/sync/streaming/UpdateWorkers/types.d.ts +2 -2
- package/types/sync/streaming/constants.d.ts +0 -1
- package/types/sync/streaming/parseUtils.d.ts +4 -2
- package/types/sync/streaming/pushManager.d.ts +0 -2
- package/types/sync/streaming/types.d.ts +4 -5
- package/types/sync/submitters/types.d.ts +3 -10
- package/types/types.d.ts +11 -26
- package/types/utils/constants/index.d.ts +1 -3
- package/types/utils/settingsValidation/index.d.ts +0 -2
- package/types/utils/settingsValidation/types.d.ts +1 -1
- package/cjs/evaluator/matchers/large_segment.js +0 -16
- package/esm/evaluator/matchers/large_segment.js +0 -12
- package/src/evaluator/matchers/large_segment.ts +0 -18
package/src/types.ts
CHANGED
|
@@ -86,7 +86,6 @@ export interface ISettings {
|
|
|
86
86
|
metricsRefreshRate?: number,
|
|
87
87
|
telemetryRefreshRate: number,
|
|
88
88
|
segmentsRefreshRate: number,
|
|
89
|
-
largeSegmentsRefreshRate: number,
|
|
90
89
|
offlineRefreshRate: number,
|
|
91
90
|
eventsPushRate: number,
|
|
92
91
|
eventsQueueSize: number,
|
|
@@ -96,8 +95,7 @@ export interface ISettings {
|
|
|
96
95
|
readyTimeout: number,
|
|
97
96
|
requestTimeoutBeforeReady: number,
|
|
98
97
|
retriesOnFailureBeforeReady: number,
|
|
99
|
-
eventsFirstPushWindow: number
|
|
100
|
-
waitForLargeSegments: boolean
|
|
98
|
+
eventsFirstPushWindow: number
|
|
101
99
|
},
|
|
102
100
|
readonly storage: IStorageSyncFactory | IStorageAsyncFactory,
|
|
103
101
|
readonly integrations: Array<{
|
|
@@ -121,8 +119,10 @@ export interface ISettings {
|
|
|
121
119
|
__splitFiltersValidation: ISplitFiltersValidation,
|
|
122
120
|
localhostMode?: SplitIO.LocalhostFactory,
|
|
123
121
|
enabled: boolean,
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
flagSpecVersion: string,
|
|
123
|
+
requestOptions?: {
|
|
124
|
+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
|
|
125
|
+
}
|
|
126
126
|
},
|
|
127
127
|
readonly runtime: {
|
|
128
128
|
ip: string | false
|
|
@@ -221,7 +221,10 @@ interface ISharedSettings {
|
|
|
221
221
|
* Enables synchronization.
|
|
222
222
|
* @property {boolean} enabled
|
|
223
223
|
*/
|
|
224
|
-
enabled
|
|
224
|
+
enabled?: boolean,
|
|
225
|
+
requestOptions?: {
|
|
226
|
+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
|
|
227
|
+
},
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
/**
|
|
@@ -816,13 +819,6 @@ export namespace SplitIO {
|
|
|
816
819
|
* @default 10
|
|
817
820
|
*/
|
|
818
821
|
eventsFirstPushWindow?: number,
|
|
819
|
-
/**
|
|
820
|
-
* Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
|
|
821
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
822
|
-
* @property {number} waitForLargeSegments
|
|
823
|
-
* @default true
|
|
824
|
-
*/
|
|
825
|
-
waitForLargeSegments?: boolean
|
|
826
822
|
},
|
|
827
823
|
/**
|
|
828
824
|
* SDK scheduler settings.
|
|
@@ -867,13 +863,6 @@ export namespace SplitIO {
|
|
|
867
863
|
* @default 60
|
|
868
864
|
*/
|
|
869
865
|
segmentsRefreshRate?: number,
|
|
870
|
-
/**
|
|
871
|
-
* The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
|
|
872
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
873
|
-
* @property {number} largeSegmentsRefreshRate
|
|
874
|
-
* @default 60
|
|
875
|
-
*/
|
|
876
|
-
largeSegmentsRefreshRate?: number,
|
|
877
866
|
/**
|
|
878
867
|
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
879
868
|
* @property {number} eventsPushRate
|
|
@@ -946,14 +935,6 @@ export namespace SplitIO {
|
|
|
946
935
|
* @property {Object} urls
|
|
947
936
|
*/
|
|
948
937
|
urls?: UrlSettings,
|
|
949
|
-
sync?: ISharedSettings['sync'] & {
|
|
950
|
-
/**
|
|
951
|
-
* Enables synchronization of large segments.
|
|
952
|
-
* @property {boolean} largeSegmentsEnabled
|
|
953
|
-
* @default false
|
|
954
|
-
*/
|
|
955
|
-
largeSegmentsEnabled?: boolean
|
|
956
|
-
}
|
|
957
938
|
}
|
|
958
939
|
/**
|
|
959
940
|
* Settings interface for SDK instances created on NodeJS.
|
|
@@ -76,7 +76,6 @@ export const TELEMETRY = 'te';
|
|
|
76
76
|
export const TOKEN = 'to';
|
|
77
77
|
export const SEGMENT = 'se';
|
|
78
78
|
export const MY_SEGMENT = 'ms';
|
|
79
|
-
export const MY_LARGE_SEGMENT = 'mls';
|
|
80
79
|
|
|
81
80
|
export const TREATMENT = 't';
|
|
82
81
|
export const TREATMENTS = 'ts';
|
|
@@ -106,8 +105,7 @@ export const DISABLED = 0;
|
|
|
106
105
|
export const ENABLED = 1;
|
|
107
106
|
export const PAUSED = 2;
|
|
108
107
|
|
|
109
|
-
export const FLAG_SPEC_VERSION = '1.
|
|
108
|
+
export const FLAG_SPEC_VERSION = '1.1';
|
|
110
109
|
|
|
111
110
|
// Matcher types
|
|
112
111
|
export const IN_SEGMENT = 'IN_SEGMENT';
|
|
113
|
-
export const IN_LARGE_SEGMENT = 'IN_LARGE_SEGMENT';
|
|
@@ -32,8 +32,6 @@ export const base = {
|
|
|
32
32
|
featuresRefreshRate: 60,
|
|
33
33
|
// fetch segments updates each 60 sec
|
|
34
34
|
segmentsRefreshRate: 60,
|
|
35
|
-
// fetch large segments updates each 60 sec
|
|
36
|
-
largeSegmentsRefreshRate: 60,
|
|
37
35
|
// publish telemetry stats each 3600 secs (1 hour)
|
|
38
36
|
telemetryRefreshRate: 3600,
|
|
39
37
|
// publish evaluations each 300 sec (default value for OPTIMIZED impressions mode)
|
|
@@ -87,8 +85,7 @@ export const base = {
|
|
|
87
85
|
impressionsMode: OPTIMIZED,
|
|
88
86
|
localhostMode: undefined,
|
|
89
87
|
enabled: true,
|
|
90
|
-
flagSpecVersion: FLAG_SPEC_VERSION
|
|
91
|
-
largeSegmentsEnabled: false
|
|
88
|
+
flagSpecVersion: FLAG_SPEC_VERSION
|
|
92
89
|
},
|
|
93
90
|
|
|
94
91
|
// Logger
|
|
@@ -135,7 +132,6 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
|
|
|
135
132
|
const { scheduler, startup } = withDefaults;
|
|
136
133
|
scheduler.featuresRefreshRate = fromSecondsToMillis(scheduler.featuresRefreshRate);
|
|
137
134
|
scheduler.segmentsRefreshRate = fromSecondsToMillis(scheduler.segmentsRefreshRate);
|
|
138
|
-
scheduler.largeSegmentsRefreshRate = fromSecondsToMillis(scheduler.largeSegmentsRefreshRate);
|
|
139
135
|
scheduler.offlineRefreshRate = fromSecondsToMillis(scheduler.offlineRefreshRate);
|
|
140
136
|
scheduler.eventsPushRate = fromSecondsToMillis(scheduler.eventsPushRate);
|
|
141
137
|
scheduler.telemetryRefreshRate = fromSecondsToMillis(validateMinValue('telemetryRefreshRate', scheduler.telemetryRefreshRate, 60));
|
|
@@ -213,12 +209,11 @@ export function settingsValidation(config: unknown, validationParams: ISettingsV
|
|
|
213
209
|
const splitFiltersValidation = validateSplitFilters(log, sync.splitFilters, withDefaults.mode);
|
|
214
210
|
sync.splitFilters = splitFiltersValidation.validFilters;
|
|
215
211
|
sync.__splitFiltersValidation = splitFiltersValidation;
|
|
216
|
-
|
|
217
|
-
// ensure a valid flag spec version
|
|
218
212
|
sync.flagSpecVersion = flagSpec ? flagSpec(withDefaults) : FLAG_SPEC_VERSION;
|
|
213
|
+
|
|
219
214
|
// ensure a valid user consent value
|
|
220
215
|
// @ts-ignore, modify readonly prop
|
|
221
|
-
withDefaults.userConsent = consent
|
|
216
|
+
withDefaults.userConsent = consent(withDefaults);
|
|
222
217
|
|
|
223
218
|
return withDefaults;
|
|
224
219
|
}
|
|
@@ -25,7 +25,7 @@ export interface ISettingsValidationParams {
|
|
|
25
25
|
/** Localhost mode validator (`settings.sync.localhostMode`) */
|
|
26
26
|
localhost?: (settings: ISettings) => ISettings['sync']['localhostMode'],
|
|
27
27
|
/** User consent validator (`settings.userConsent`) */
|
|
28
|
-
consent
|
|
28
|
+
consent: (settings: ISettings) => ISettings['userConsent'],
|
|
29
29
|
/** Flag spec version validation. Configurable by the JS Synchronizer but not by the SDKs */
|
|
30
30
|
flagSpec?: (settings: ISettings) => ISettings['sync']['flagSpecVersion']
|
|
31
31
|
}
|
package/types/dtos/types.d.ts
CHANGED
|
@@ -48,10 +48,6 @@ interface IInSegmentMatcher extends ISplitMatcherBase {
|
|
|
48
48
|
matcherType: 'IN_SEGMENT';
|
|
49
49
|
userDefinedSegmentMatcherData: IInSegmentMatcherData;
|
|
50
50
|
}
|
|
51
|
-
interface IInLargeSegmentMatcher extends ISplitMatcherBase {
|
|
52
|
-
matcherType: 'IN_LARGE_SEGMENT';
|
|
53
|
-
userDefinedSegmentMatcherData: IInSegmentMatcherData;
|
|
54
|
-
}
|
|
55
51
|
interface IWhitelistMatcher extends ISplitMatcherBase {
|
|
56
52
|
matcherType: 'WHITELIST';
|
|
57
53
|
whitelistMatcherData: IWhitelistMatcherData;
|
|
@@ -132,7 +128,7 @@ interface IInListSemverMatcher extends ISplitMatcherBase {
|
|
|
132
128
|
matcherType: 'IN_LIST_SEMVER';
|
|
133
129
|
whitelistMatcherData: IWhitelistMatcherData;
|
|
134
130
|
}
|
|
135
|
-
export declare type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher | ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher | IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher | IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher
|
|
131
|
+
export declare type ISplitMatcher = IAllKeysMatcher | IInSegmentMatcher | IWhitelistMatcher | IEqualToMatcher | IGreaterThanOrEqualToMatcher | ILessThanOrEqualToMatcher | IBetweenMatcher | IEqualToSetMatcher | IContainsAnyOfSetMatcher | IContainsAllOfSetMatcher | IPartOfSetMatcher | IStartsWithMatcher | IEndsWithMatcher | IContainsStringMatcher | IInSplitTreatmentMatcher | IEqualToBooleanMatcher | IMatchesStringMatcher | IEqualToSemverMatcher | IGreaterThanOrEqualToSemverMatcher | ILessThanOrEqualToSemverMatcher | IBetweenSemverMatcher | IInListSemverMatcher;
|
|
136
132
|
/** Split object */
|
|
137
133
|
export interface ISplitPartition {
|
|
138
134
|
treatment: string;
|
|
@@ -177,17 +173,13 @@ export interface ISegmentChangesResponse {
|
|
|
177
173
|
since: number;
|
|
178
174
|
till: number;
|
|
179
175
|
}
|
|
176
|
+
export interface IMySegmentsResponseItem {
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
}
|
|
180
180
|
/** Interface of the parsed JSON response of `/mySegments/{userKey}` */
|
|
181
181
|
export interface IMySegmentsResponse {
|
|
182
|
-
mySegments:
|
|
183
|
-
id: string;
|
|
184
|
-
name: string;
|
|
185
|
-
}[];
|
|
186
|
-
}
|
|
187
|
-
/** Interface of the parsed JSON response of `/myLargeSegments/{userKey}` */
|
|
188
|
-
export interface IMyLargeSegmentsResponse {
|
|
189
|
-
myLargeSegments: string[];
|
|
190
|
-
changeNumber: number;
|
|
182
|
+
mySegments: IMySegmentsResponseItem[];
|
|
191
183
|
}
|
|
192
184
|
/** Metadata internal type for storages */
|
|
193
185
|
export interface IMetadata {
|
|
@@ -35,6 +35,7 @@ export declare const IMPRESSION = 102;
|
|
|
35
35
|
export declare const IMPRESSION_QUEUEING = 103;
|
|
36
36
|
export declare const NEW_SHARED_CLIENT = 104;
|
|
37
37
|
export declare const NEW_FACTORY = 105;
|
|
38
|
+
export declare const POLLING_SMART_PAUSING = 106;
|
|
38
39
|
export declare const POLLING_START = 107;
|
|
39
40
|
export declare const POLLING_STOP = 108;
|
|
40
41
|
export declare const SYNC_SPLITS_FETCH_RETRY = 109;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IEventEmitter
|
|
1
|
+
import { IEventEmitter } from '../types';
|
|
2
2
|
import { IReadinessManager, ISplitsEventEmitter } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Factory of readiness manager, which handles the ready / update event propagation.
|
|
5
5
|
*/
|
|
6
|
-
export declare function readinessManagerFactory(EventEmitter: new () => IEventEmitter,
|
|
6
|
+
export declare function readinessManagerFactory(EventEmitter: new () => IEventEmitter, readyTimeout?: number, splits?: ISplitsEventEmitter): IReadinessManager;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ISdkReadinessManager } from './types';
|
|
2
|
-
import { IEventEmitter
|
|
2
|
+
import { IEventEmitter } from '../types';
|
|
3
|
+
import { ILogger } from '../logger/types';
|
|
3
4
|
/**
|
|
4
5
|
* SdkReadinessManager factory, which provides the public status API of SDK clients and manager: ready promise, readiness event emitter and constants (SDK_READY, etc).
|
|
5
6
|
* It also updates logs related warnings and errors.
|
|
@@ -7,4 +8,4 @@ import { IEventEmitter, ISettings } from '../types';
|
|
|
7
8
|
* @param readyTimeout time in millis to emit SDK_READY_TIME_OUT event
|
|
8
9
|
* @param readinessManager optional readinessManager to use. only used internally for `shared` method
|
|
9
10
|
*/
|
|
10
|
-
export declare function sdkReadinessManagerFactory(EventEmitter: new () => IEventEmitter,
|
|
11
|
+
export declare function sdkReadinessManagerFactory(log: ILogger, EventEmitter: new () => IEventEmitter, readyTimeout?: number, readinessManager?: import("./types").IReadinessManager): ISdkReadinessManager;
|
|
@@ -34,7 +34,6 @@ export interface IReadinessManager {
|
|
|
34
34
|
/** Event emitters */
|
|
35
35
|
splits: ISplitsEventEmitter;
|
|
36
36
|
segments: ISegmentsEventEmitter;
|
|
37
|
-
largeSegments?: ISegmentsEventEmitter;
|
|
38
37
|
gate: IReadinessEventEmitter;
|
|
39
38
|
/** Readiness status */
|
|
40
39
|
isReady(): boolean;
|
|
@@ -46,7 +45,7 @@ export interface IReadinessManager {
|
|
|
46
45
|
setDestroyed(): void;
|
|
47
46
|
destroy(): void;
|
|
48
47
|
/** for client-side */
|
|
49
|
-
shared(): IReadinessManager;
|
|
48
|
+
shared(readyTimeout?: number): IReadinessManager;
|
|
50
49
|
}
|
|
51
50
|
/** SDK readiness manager */
|
|
52
51
|
export interface ISdkReadinessManager {
|
|
@@ -58,6 +57,6 @@ export interface ISdkReadinessManager {
|
|
|
58
57
|
*/
|
|
59
58
|
incInternalReadyCbCount(): void;
|
|
60
59
|
/** for client-side */
|
|
61
|
-
shared(): ISdkReadinessManager;
|
|
60
|
+
shared(readyTimeout?: number): ISdkReadinessManager;
|
|
62
61
|
}
|
|
63
62
|
export {};
|
|
@@ -9,4 +9,4 @@ import { ITelemetryTracker } from '../trackers/types';
|
|
|
9
9
|
* @param platform object containing environment-specific dependencies
|
|
10
10
|
* @param telemetryTracker telemetry tracker
|
|
11
11
|
*/
|
|
12
|
-
export declare function splitApiFactory(settings: ISettings, platform:
|
|
12
|
+
export declare function splitApiFactory(settings: ISettings, platform: IPlatform, telemetryTracker: ITelemetryTracker): ISplitApi;
|
|
@@ -7,4 +7,4 @@ import { IPlatform } from '../sdkFactory/types';
|
|
|
7
7
|
* @param settings SDK settings, used to access authorizationKey, logger instance and metadata (SDK version, ip and hostname) to set additional headers
|
|
8
8
|
* @param platform object containing environment-specific dependencies
|
|
9
9
|
*/
|
|
10
|
-
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }:
|
|
10
|
+
export declare function splitHttpClientFactory(settings: ISettings, { getOptions, getFetch }: IPlatform): ISplitHttpClient;
|
|
@@ -33,7 +33,6 @@ export interface ISplitApi {
|
|
|
33
33
|
fetchSplitChanges: IFetchSplitChanges;
|
|
34
34
|
fetchSegmentChanges: IFetchSegmentChanges;
|
|
35
35
|
fetchMySegments: IFetchMySegments;
|
|
36
|
-
fetchMyLargeSegments: IFetchMySegments;
|
|
37
36
|
postEventsBulk: IPostEventsBulk;
|
|
38
37
|
postUniqueKeysBulkCs: IPostUniqueKeysBulkCs;
|
|
39
38
|
postUniqueKeysBulkSs: IPostUniqueKeysBulkSs;
|
|
@@ -18,7 +18,7 @@ export declare abstract class AbstractSplitsCacheAsync implements ISplitsCacheAs
|
|
|
18
18
|
abstract getNamesByFlagSets(flagSets: string[]): Promise<ISet<string>[]>;
|
|
19
19
|
abstract trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
20
20
|
abstract clear(): Promise<boolean | void>;
|
|
21
|
-
|
|
21
|
+
usesSegments(): Promise<boolean>;
|
|
22
22
|
/**
|
|
23
23
|
* Check if the splits information is already stored in cache.
|
|
24
24
|
* Noop, just keeping the interface. This is used by client-side implementations only.
|
|
@@ -17,7 +17,7 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
17
17
|
getAll(): ISplit[];
|
|
18
18
|
abstract getSplitNames(): string[];
|
|
19
19
|
abstract trafficTypeExists(trafficType: string): boolean;
|
|
20
|
-
abstract
|
|
20
|
+
abstract usesSegments(): boolean;
|
|
21
21
|
abstract clear(): void;
|
|
22
22
|
/**
|
|
23
23
|
* Check if the splits information is already stored in cache. This data can be preloaded.
|
|
@@ -39,6 +39,6 @@ export declare abstract class AbstractSplitsCacheSync implements ISplitsCacheSyn
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
|
|
42
|
-
* This util is intended to simplify the implementation of `splitsCache::
|
|
42
|
+
* This util is intended to simplify the implementation of `splitsCache::usesSegments` method
|
|
43
43
|
*/
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function usesSegments(split: ISplit): boolean;
|
|
@@ -10,7 +10,6 @@ export declare class KeyBuilder {
|
|
|
10
10
|
isSplitKey(key: string): boolean;
|
|
11
11
|
buildSplitKeyPrefix(): string;
|
|
12
12
|
buildSplitsWithSegmentCountKey(): string;
|
|
13
|
-
buildSplitsWithLargeSegmentCountKey(): string;
|
|
14
13
|
buildSegmentNameKey(segmentName: string): string;
|
|
15
14
|
buildSegmentTillKey(segmentName: string): string;
|
|
16
15
|
extractKey(builtKey: string): string;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { KeyBuilder } from './KeyBuilder';
|
|
2
|
-
export
|
|
3
|
-
buildSegmentNameKey(segmentName: string): string;
|
|
4
|
-
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
5
|
-
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBuilder {
|
|
2
|
+
export declare class KeyBuilderCS extends KeyBuilder {
|
|
8
3
|
protected readonly regexSplitsCacheKey: RegExp;
|
|
9
4
|
protected readonly matchingKey: string;
|
|
10
5
|
constructor(prefix: string, matchingKey: string);
|
|
@@ -13,8 +8,8 @@ export declare class KeyBuilderCS extends KeyBuilder implements MySegmentsKeyBui
|
|
|
13
8
|
*/
|
|
14
9
|
buildSegmentNameKey(segmentName: string): string;
|
|
15
10
|
extractSegmentName(builtSegmentKeyName: string): string | undefined;
|
|
11
|
+
buildOldSegmentNameKey(segmentName: string): string;
|
|
16
12
|
extractOldSegmentKey(builtSegmentKeyName: string): string | undefined;
|
|
17
13
|
buildLastUpdatedKey(): string;
|
|
18
14
|
isSplitsCacheKey(key: string): boolean;
|
|
19
15
|
}
|
|
20
|
-
export declare function myLargeSegmentsKeyBuilder(prefix: string, matchingKey: string): MySegmentsKeyBuilder;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ILogger } from '../../logger/types';
|
|
2
2
|
import { AbstractSegmentsCacheSync } from '../AbstractSegmentsCacheSync';
|
|
3
|
-
import
|
|
3
|
+
import { KeyBuilderCS } from '../KeyBuilderCS';
|
|
4
4
|
export declare class MySegmentsCacheInLocal extends AbstractSegmentsCacheSync {
|
|
5
5
|
private readonly keys;
|
|
6
6
|
private readonly log;
|
|
7
|
-
constructor(log: ILogger, keys:
|
|
7
|
+
constructor(log: ILogger, keys: KeyBuilderCS);
|
|
8
8
|
/**
|
|
9
9
|
* Removes list of segments from localStorage
|
|
10
10
|
* @NOTE this method is not being used at the moment.
|
|
@@ -34,7 +34,7 @@ export declare class SplitsCacheInLocal extends AbstractSplitsCacheSync {
|
|
|
34
34
|
getChangeNumber(): number;
|
|
35
35
|
getSplitNames(): string[];
|
|
36
36
|
trafficTypeExists(trafficType: string): boolean;
|
|
37
|
-
|
|
37
|
+
usesSegments(): boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Check if the splits information is already stored in browser LocalStorage.
|
|
40
40
|
* In this function we could add more code to check if the data is valid.
|
|
@@ -10,8 +10,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
10
10
|
private splitsCache;
|
|
11
11
|
private ttCache;
|
|
12
12
|
private changeNumber;
|
|
13
|
-
private
|
|
14
|
-
private largeSegmentsCount;
|
|
13
|
+
private splitsWithSegmentsCount;
|
|
15
14
|
private flagSetsCache;
|
|
16
15
|
constructor(splitFiltersValidation?: ISplitFiltersValidation);
|
|
17
16
|
clear(): void;
|
|
@@ -22,7 +21,7 @@ export declare class SplitsCacheInMemory extends AbstractSplitsCacheSync {
|
|
|
22
21
|
getChangeNumber(): number;
|
|
23
22
|
getSplitNames(): string[];
|
|
24
23
|
trafficTypeExists(trafficType: string): boolean;
|
|
25
|
-
|
|
24
|
+
usesSegments(): boolean;
|
|
26
25
|
getNamesByFlagSets(flagSets: string[]): ISet<string>[];
|
|
27
26
|
private addToFlagSets;
|
|
28
27
|
private removeFromFlagSets;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum
|
|
1
|
+
import { ImpressionDataType, EventDataType, StreamingEvent, Method, OperationType, TelemetryUsageStatsPayload, UpdatesFromSSEEnum } from '../../sync/submitters/types';
|
|
2
2
|
import { ISegmentsCacheSync, ISplitsCacheSync, IStorageFactoryParams, ITelemetryCacheSync } from '../types';
|
|
3
3
|
export declare const MAX_LATENCY_BUCKET_COUNT = 23;
|
|
4
4
|
export declare function newBuckets(): number[];
|
|
@@ -10,8 +10,7 @@ export declare function shouldRecordTelemetry({ settings }: IStorageFactoryParam
|
|
|
10
10
|
export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
11
11
|
private splits?;
|
|
12
12
|
private segments?;
|
|
13
|
-
|
|
14
|
-
constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined, largeSegments?: ISegmentsCacheSync | undefined);
|
|
13
|
+
constructor(splits?: ISplitsCacheSync | undefined, segments?: ISegmentsCacheSync | undefined);
|
|
15
14
|
private e;
|
|
16
15
|
isEmpty(): boolean;
|
|
17
16
|
clear(): void;
|
|
@@ -66,6 +65,9 @@ export declare class TelemetryCacheInMemory implements ITelemetryCacheSync {
|
|
|
66
65
|
popLatencies(): Partial<Record<Method, number[]>>;
|
|
67
66
|
recordLatency(method: Method, latencyMs: number): void;
|
|
68
67
|
private updatesFromSSE;
|
|
69
|
-
popUpdatesFromSSE():
|
|
68
|
+
popUpdatesFromSSE(): {
|
|
69
|
+
sp: number;
|
|
70
|
+
ms: number;
|
|
71
|
+
};
|
|
70
72
|
recordUpdatesFromSSE(type: UpdatesFromSSEEnum): void;
|
|
71
73
|
}
|
|
@@ -5,7 +5,7 @@ import { ISet } from '../../utils/lang/sets';
|
|
|
5
5
|
* The `_cache` property is the object were items are stored.
|
|
6
6
|
* Intended for testing purposes.
|
|
7
7
|
*
|
|
8
|
-
* @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves
|
|
8
|
+
* @param connDelay delay in millis for `connect` resolve. If not provided, `connect` resolves inmediatelly.
|
|
9
9
|
*/
|
|
10
10
|
export declare function inMemoryWrapperFactory(connDelay?: number): IPluggableStorageWrapper & {
|
|
11
11
|
_cache: Record<string, string | string[] | ISet<string>>;
|
|
@@ -189,7 +189,7 @@ export interface ISplitsCacheBase {
|
|
|
189
189
|
getAll(): MaybeThenable<ISplit[]>;
|
|
190
190
|
getSplitNames(): MaybeThenable<string[]>;
|
|
191
191
|
trafficTypeExists(trafficType: string): MaybeThenable<boolean>;
|
|
192
|
-
|
|
192
|
+
usesSegments(): MaybeThenable<boolean>;
|
|
193
193
|
clear(): MaybeThenable<boolean | void>;
|
|
194
194
|
checkCache(): MaybeThenable<boolean>;
|
|
195
195
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): MaybeThenable<boolean>;
|
|
@@ -205,7 +205,7 @@ export interface ISplitsCacheSync extends ISplitsCacheBase {
|
|
|
205
205
|
getAll(): ISplit[];
|
|
206
206
|
getSplitNames(): string[];
|
|
207
207
|
trafficTypeExists(trafficType: string): boolean;
|
|
208
|
-
|
|
208
|
+
usesSegments(): boolean;
|
|
209
209
|
clear(): void;
|
|
210
210
|
checkCache(): boolean;
|
|
211
211
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): boolean;
|
|
@@ -221,7 +221,7 @@ export interface ISplitsCacheAsync extends ISplitsCacheBase {
|
|
|
221
221
|
getAll(): Promise<ISplit[]>;
|
|
222
222
|
getSplitNames(): Promise<string[]>;
|
|
223
223
|
trafficTypeExists(trafficType: string): Promise<boolean>;
|
|
224
|
-
|
|
224
|
+
usesSegments(): Promise<boolean>;
|
|
225
225
|
clear(): Promise<boolean | void>;
|
|
226
226
|
checkCache(): Promise<boolean>;
|
|
227
227
|
killLocally(name: string, defaultTreatment: string, changeNumber: number): Promise<boolean>;
|
|
@@ -388,7 +388,6 @@ export interface IStorageBase<TSplitsCache extends ISplitsCacheBase, TSegmentsCa
|
|
|
388
388
|
shared?: (matchingKey: string, onReadyCb: (error?: any) => void) => this;
|
|
389
389
|
}
|
|
390
390
|
export interface IStorageSync extends IStorageBase<ISplitsCacheSync, ISegmentsCacheSync, IImpressionsCacheSync, IImpressionCountsCacheSync, IEventsCacheSync, ITelemetryCacheSync, IUniqueKeysCacheSync> {
|
|
391
|
-
largeSegments?: ISegmentsCacheSync;
|
|
392
391
|
}
|
|
393
392
|
export interface IStorageAsync extends IStorageBase<ISplitsCacheAsync, ISegmentsCacheAsync, IImpressionsCacheAsync | IImpressionsCacheSync, IImpressionCountsCacheBase, IEventsCacheAsync | IEventsCacheSync, ITelemetryCacheAsync | ITelemetryCacheSync, IUniqueKeysCacheBase> {
|
|
394
393
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStorageSync } from '../../../storages/types';
|
|
2
|
+
import { IReadinessManager } from '../../../readiness/types';
|
|
2
3
|
import { IMySegmentsSyncTask } from '../types';
|
|
3
4
|
import { IFetchMySegments } from '../../../services/types';
|
|
4
5
|
import { ISettings } from '../../../types';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a sync task that periodically executes a `mySegmentsUpdater` task
|
|
7
8
|
*/
|
|
8
|
-
export declare function mySegmentsSyncTaskFactory(fetchMySegments: IFetchMySegments,
|
|
9
|
+
export declare function mySegmentsSyncTaskFactory(fetchMySegments: IFetchMySegments, storage: IStorageSync, readiness: IReadinessManager, settings: ISettings, matchingKey: string): IMySegmentsSyncTask;
|
|
@@ -12,26 +12,19 @@ export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, se
|
|
|
12
12
|
export declare type MySegmentsData = string[] | {
|
|
13
13
|
name: string;
|
|
14
14
|
add: boolean;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export interface IMySegmentsSyncTask extends ISyncTask<[segmentsData?: MySegmentsData, noCache?: boolean], boolean> {
|
|
17
17
|
}
|
|
18
18
|
export interface IPollingManager extends ITask {
|
|
19
19
|
syncAll(): Promise<any>;
|
|
20
20
|
splitsSyncTask: ISplitsSyncTask;
|
|
21
21
|
segmentsSyncTask: ISyncTask;
|
|
22
|
-
largeSegmentsSyncTask?: ISyncTask;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* PollingManager for client-side with support for multiple clients
|
|
26
25
|
*/
|
|
27
26
|
export interface IPollingManagerCS extends IPollingManager {
|
|
28
|
-
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync):
|
|
29
|
-
msSyncTask: IMySegmentsSyncTask;
|
|
30
|
-
mlsSyncTask?: IMySegmentsSyncTask;
|
|
31
|
-
};
|
|
27
|
+
add(matchingKey: string, readiness: IReadinessManager, storage: IStorageSync): IMySegmentsSyncTask;
|
|
32
28
|
remove(matchingKey: string): void;
|
|
33
|
-
get(matchingKey: string):
|
|
34
|
-
msSyncTask: IMySegmentsSyncTask;
|
|
35
|
-
mlsSyncTask?: IMySegmentsSyncTask;
|
|
36
|
-
} | undefined;
|
|
29
|
+
get(matchingKey: string): IMySegmentsSyncTask | undefined;
|
|
37
30
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IMySegmentsFetcher } from '../fetchers/types';
|
|
2
|
-
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
2
|
+
import { ISegmentsCacheSync, ISplitsCacheSync } from '../../../storages/types';
|
|
3
|
+
import { ISegmentsEventEmitter } from '../../../readiness/types';
|
|
3
4
|
import { ILogger } from '../../../logger/types';
|
|
4
|
-
|
|
5
|
-
declare type IMySegmentsUpdater = (segmentList?: MySegmentsData, noCache?: boolean) => Promise<boolean>;
|
|
5
|
+
declare type IMySegmentsUpdater = (segmentList?: string[], noCache?: boolean) => Promise<boolean>;
|
|
6
6
|
/**
|
|
7
7
|
* factory of MySegments updater, a task that:
|
|
8
8
|
* - fetches mySegments using `mySegmentsFetcher`
|
|
9
9
|
* - updates `mySegmentsCache`
|
|
10
10
|
* - uses `segmentsEventEmitter` to emit events related to segments data updates
|
|
11
11
|
*/
|
|
12
|
-
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, mySegmentsCache: ISegmentsCacheSync,
|
|
12
|
+
export declare function mySegmentsUpdaterFactory(log: ILogger, mySegmentsFetcher: IMySegmentsFetcher, splitsCache: ISplitsCacheSync, mySegmentsCache: ISegmentsCacheSync, segmentsEventEmitter: ISegmentsEventEmitter, requestTimeoutBeforeReady: number, retriesOnFailureBeforeReady: number, matchingKey: string): IMySegmentsUpdater;
|
|
13
13
|
export {};
|
|
@@ -7,23 +7,20 @@ import { ISSEClient, ISseEventHandler } from './types';
|
|
|
7
7
|
* Handles streaming connections with EventSource API
|
|
8
8
|
*/
|
|
9
9
|
export declare class SSEClient implements ISSEClient {
|
|
10
|
+
private settings;
|
|
10
11
|
eventSource?: IEventSourceConstructor;
|
|
11
|
-
streamingUrl: string;
|
|
12
12
|
connection?: InstanceType<IEventSourceConstructor>;
|
|
13
13
|
handler?: ISseEventHandler;
|
|
14
|
-
useHeaders?: boolean;
|
|
15
14
|
headers: Record<string, string>;
|
|
16
15
|
options?: object;
|
|
17
|
-
lse?: boolean;
|
|
18
16
|
/**
|
|
19
17
|
* SSEClient constructor.
|
|
20
18
|
*
|
|
21
19
|
* @param settings Validated settings.
|
|
22
|
-
* @param useHeaders True to send metadata as headers or false to send as query params. If `true`, the provided EventSource must support headers.
|
|
23
20
|
* @param platform object containing environment-specific dependencies
|
|
24
21
|
* @throws 'EventSource API is not available.' if EventSource is not available.
|
|
25
22
|
*/
|
|
26
|
-
constructor(settings: ISettings,
|
|
23
|
+
constructor(settings: ISettings, { getEventSource, getOptions }: IPlatform);
|
|
27
24
|
setEventHandler(handler: ISseEventHandler): void;
|
|
28
25
|
/**
|
|
29
26
|
* Open the connection with a given authToken
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ControlType } from '../constants';
|
|
2
|
-
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY
|
|
2
|
+
import { MY_SEGMENTS_UPDATE, MY_SEGMENTS_UPDATE_V2, SEGMENT_UPDATE, SPLIT_UPDATE, SPLIT_KILL, CONTROL, OCCUPANCY } from '../types';
|
|
3
3
|
export interface IMySegmentsUpdateData {
|
|
4
4
|
type: MY_SEGMENTS_UPDATE;
|
|
5
5
|
changeNumber: number;
|
|
@@ -29,17 +29,6 @@ export interface IMySegmentsUpdateV2Data {
|
|
|
29
29
|
d: string;
|
|
30
30
|
u: UpdateStrategy;
|
|
31
31
|
}
|
|
32
|
-
export interface IMyLargeSegmentsUpdateData {
|
|
33
|
-
type: MY_LARGE_SEGMENTS_UPDATE;
|
|
34
|
-
changeNumber: number;
|
|
35
|
-
largeSegments: string[];
|
|
36
|
-
c: Compression;
|
|
37
|
-
d: string;
|
|
38
|
-
u: UpdateStrategy;
|
|
39
|
-
i?: number;
|
|
40
|
-
h?: number;
|
|
41
|
-
s?: number;
|
|
42
|
-
}
|
|
43
32
|
export interface ISegmentUpdateData {
|
|
44
33
|
type: SEGMENT_UPDATE;
|
|
45
34
|
changeNumber: number;
|
|
@@ -68,7 +57,7 @@ export interface IOccupancyData {
|
|
|
68
57
|
publishers: number;
|
|
69
58
|
};
|
|
70
59
|
}
|
|
71
|
-
export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data |
|
|
60
|
+
export declare type INotificationData = IMySegmentsUpdateData | IMySegmentsUpdateV2Data | ISegmentUpdateData | ISplitUpdateData | ISplitKillData | IControlData | IOccupancyData;
|
|
72
61
|
export declare type INotificationMessage = {
|
|
73
62
|
parsedData: INotificationData;
|
|
74
63
|
channel: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IMySegmentsSyncTask
|
|
1
|
+
import { IMySegmentsSyncTask } from '../../polling/types';
|
|
2
2
|
import { IUpdateWorker } from './types';
|
|
3
3
|
import { ITelemetryTracker } from '../../../trackers/types';
|
|
4
|
-
import { UpdatesFromSSEEnum } from '../../submitters/types';
|
|
5
4
|
/**
|
|
6
5
|
* MySegmentsUpdateWorker factory
|
|
7
6
|
*/
|
|
8
|
-
export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker
|
|
7
|
+
export declare function MySegmentsUpdateWorker(mySegmentsSyncTask: IMySegmentsSyncTask, telemetryTracker: ITelemetryTracker): IUpdateWorker;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ILogger } from '../../../logger/types';
|
|
2
2
|
import { ISegmentsCacheSync } from '../../../storages/types';
|
|
3
3
|
import { ISegmentsSyncTask } from '../../polling/types';
|
|
4
|
-
import { ISegmentUpdateData } from '../SSEHandler/types';
|
|
5
4
|
import { IUpdateWorker } from './types';
|
|
6
5
|
/**
|
|
7
6
|
* SegmentsUpdateWorker factory
|
|
8
7
|
*/
|
|
9
|
-
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker
|
|
8
|
+
export declare function SegmentsUpdateWorker(log: ILogger, segmentsSyncTask: ISegmentsSyncTask, segmentsCache: ISegmentsCacheSync): IUpdateWorker;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ISplit } from '../../../dtos/types';
|
|
2
1
|
import { ILogger } from '../../../logger/types';
|
|
3
2
|
import { ISplitsEventEmitter } from '../../../readiness/types';
|
|
4
3
|
import { ISplitsCacheSync } from '../../../storages/types';
|
|
5
4
|
import { ITelemetryTracker } from '../../../trackers/types';
|
|
6
5
|
import { ISegmentsSyncTask, ISplitsSyncTask } from '../../polling/types';
|
|
7
|
-
import { ISplitKillData
|
|
6
|
+
import { ISplitKillData } from '../SSEHandler/types';
|
|
8
7
|
import { IUpdateWorker } from './types';
|
|
9
8
|
/**
|
|
10
9
|
* SplitsUpdateWorker factory
|
|
11
10
|
*/
|
|
12
|
-
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker
|
|
11
|
+
export declare function SplitsUpdateWorker(log: ILogger, splitsCache: ISplitsCacheSync, splitsSyncTask: ISplitsSyncTask, splitsEventEmitter: ISplitsEventEmitter, telemetryTracker: ITelemetryTracker, segmentsSyncTask?: ISegmentsSyncTask): IUpdateWorker & {
|
|
13
12
|
killSplit(event: ISplitKillData): void;
|
|
14
13
|
};
|