@@ -35,8 +35,8 @@ interface SdkConfigOptions {
3535 filter ?: string ;
3636 } ;
3737 dataSystem ?: {
38- initializers ?: SDKDataSystemDataSourceParams ;
39- synchronizers ?: SDKDataSystemDataSourceParams ;
38+ initializers ?: SDKDataSystemInitializerParams [ ] ;
39+ synchronizers ?: SDKDataSystemSynchronizerParams ;
4040 payloadFilter ?: string ;
4141 } ;
4242 events ?: {
@@ -73,13 +73,7 @@ interface SdkConfigOptions {
7373 } ;
7474}
7575
76- export interface SDKDataSystemParams {
77- initializers ?: SDKDataSystemDataSourceParams ;
78- synchronizers ?: SDKDataSystemDataSourceParams ;
79- payloadFilter ?: string ;
80- }
81-
82- export interface SDKDataSystemDataSourceParams {
76+ export interface SDKDataSystemSynchronizerParams {
8377 primary ?: {
8478 streaming ?: SDKDataSourceStreamingParams ;
8579 polling ?: SDKDataSourcePollingParams ;
@@ -90,6 +84,10 @@ export interface SDKDataSystemDataSourceParams {
9084 } ;
9185}
9286
87+ export interface SDKDataSystemInitializerParams {
88+ polling ?: SDKDataSourcePollingParams ;
89+ }
90+
9391export interface SDKDataSourceStreamingParams {
9492 baseUri ?: string ;
9593 initialRetryDelayMs ?: number ;
@@ -224,9 +222,14 @@ export function makeSdkConfig(options: SdkConfigOptions, tag: string): LDOptions
224222 }
225223
226224 if ( options . dataSystem ) {
227- const dataSourceStreamingOptions = options . dataSystem . synchronizers ?. primary ?. streaming ?? options . dataSystem . synchronizers ?. secondary ?. streaming ;
228- const dataSourcePollingOptions = options . dataSystem . synchronizers ?. primary ?. polling ?? options . dataSystem . synchronizers ?. secondary ?. polling ;
229-
225+ const dataSourceStreamingOptions : SDKDataSourceStreamingParams | undefined =
226+ options . dataSystem . synchronizers ?. primary ?. streaming ??
227+ options . dataSystem . synchronizers ?. secondary ?. streaming ;
228+ const dataSourcePollingOptions : SDKDataSourcePollingParams | undefined =
229+ options . dataSystem . initializers ?. [ 0 ] ?. polling ??
230+ options . dataSystem . synchronizers ?. primary ?. polling ??
231+ options . dataSystem . synchronizers ?. secondary ?. polling ;
232+
230233 if ( dataSourceStreamingOptions ) {
231234 cf . streamUri = dataSourceStreamingOptions . baseUri ;
232235 cf . streamInitialReconnectDelay = maybeTime ( dataSourceStreamingOptions . initialRetryDelayMs ) ;
@@ -237,27 +240,31 @@ export function makeSdkConfig(options: SdkConfigOptions, tag: string): LDOptions
237240 cf . pollInterval = maybeTime ( dataSourcePollingOptions . pollIntervalMs ) ;
238241 }
239242
240- let dataSourceOptions : DataSourceOptions | undefined ;
243+ let dataSourceOptions : DataSourceOptions | undefined ;
241244 if ( dataSourceStreamingOptions && dataSourcePollingOptions ) {
242245 dataSourceOptions = {
243246 dataSourceOptionsType : 'standard' ,
244- ...( dataSourceStreamingOptions . initialRetryDelayMs != null &&
245- { streamInitialReconnectDelay : maybeTime ( dataSourceStreamingOptions . initialRetryDelayMs ) } ) ,
246- ...( dataSourcePollingOptions . pollIntervalMs != null &&
247- { pollInterval : dataSourcePollingOptions . pollIntervalMs } ) ,
248- }
247+ ...( dataSourceStreamingOptions . initialRetryDelayMs != null && {
248+ streamInitialReconnectDelay : maybeTime ( dataSourceStreamingOptions . initialRetryDelayMs ) ,
249+ } ) ,
250+ ...( dataSourcePollingOptions . pollIntervalMs != null && {
251+ pollInterval : dataSourcePollingOptions . pollIntervalMs ,
252+ } ) ,
253+ } ;
249254 } else if ( dataSourceStreamingOptions ) {
250255 dataSourceOptions = {
251256 dataSourceOptionsType : 'streamingOnly' ,
252- ...( dataSourceStreamingOptions . initialRetryDelayMs != null &&
253- { streamInitialReconnectDelay : maybeTime ( dataSourceStreamingOptions . initialRetryDelayMs ) } ) ,
254- }
257+ ...( dataSourceStreamingOptions . initialRetryDelayMs != null && {
258+ streamInitialReconnectDelay : maybeTime ( dataSourceStreamingOptions . initialRetryDelayMs ) ,
259+ } ) ,
260+ } ;
255261 } else if ( dataSourcePollingOptions ) {
256262 dataSourceOptions = {
257263 dataSourceOptionsType : 'pollingOnly' ,
258- ...( dataSourcePollingOptions . pollIntervalMs != null &&
259- { pollInterval : dataSourcePollingOptions . pollIntervalMs } ) ,
260- }
264+ ...( dataSourcePollingOptions . pollIntervalMs != null && {
265+ pollInterval : dataSourcePollingOptions . pollIntervalMs ,
266+ } ) ,
267+ } ;
261268 } else {
262269 // No data source options were specified
263270 dataSourceOptions = undefined ;
@@ -269,7 +276,7 @@ export function makeSdkConfig(options: SdkConfigOptions, tag: string): LDOptions
269276
270277 cf . dataSystem = {
271278 dataSource : dataSourceOptions ,
272- }
279+ } ;
273280 }
274281
275282 return cf ;
0 commit comments