@@ -3,7 +3,7 @@ import { IDefinitionChangesFetcher } from '../fetchers/types';
33import { IRBSegment , IDefinition , IDefinitionChangesResponse , ISplitFiltersValidation , MaybeThenable } from '../../../dtos/types' ;
44import { ISplitsEventEmitter } from '../../../readiness/types' ;
55import { timeout } from '../../../utils/promise/timeout' ;
6- import { SDK_SPLITS_ARRIVED , FLAGS_UPDATE , SEGMENTS_UPDATE } from '../../../readiness/constants' ;
6+ import { SDK_SPLITS_ARRIVED , FLAGS_UPDATE , SEGMENTS_UPDATE , CONFIGS_UPDATE } from '../../../readiness/constants' ;
77import { ILogger } from '../../../logger/types' ;
88import { SYNC_FETCH , SYNC_UPDATE , SYNC_FETCH_FAILS , SYNC_FETCH_RETRY } from '../../../logger/constants' ;
99import { startsWith } from '../../../utils/lang' ;
@@ -158,7 +158,7 @@ export function definitionChangesUpdaterFactory(
158158 return Promise . resolve (
159159 instantUpdate ?
160160 instantUpdate . type === SPLIT_UPDATE ?
161- // IFFU edge case: a change to a flag that adds an IN_RULE_BASED_SEGMENT matcher that is not present yet
161+ // IFFU edge case: a change to definition that adds an IN_RULE_BASED_SEGMENT matcher that is not present yet
162162 Promise . resolve ( rbSegments . contains ( parseSegments ( instantUpdate . payload , IN_RULE_BASED_SEGMENT ) ) ) . then ( ( contains ) => {
163163 return contains ?
164164 { ff : { d : [ instantUpdate . payload as IDefinition ] , t : instantUpdate . changeNumber } } :
@@ -170,11 +170,11 @@ export function definitionChangesUpdaterFactory(
170170 . then ( ( definitionChanges : IDefinitionChangesResponse ) => {
171171 const usedSegments = new Set < string > ( ) ;
172172
173- let updatedFlags : string [ ] = [ ] ;
173+ let updatedDefinitions : string [ ] = [ ] ;
174174 let ffUpdate : MaybeThenable < boolean > = false ;
175175 if ( definitionChanges . ff ) {
176176 const { added, removed, names } = computeMutation ( definitionChanges . ff . d , usedSegments , splitFiltersValidation ) ;
177- updatedFlags = names ;
177+ updatedDefinitions = names ;
178178 log . debug ( SYNC_UPDATE , [ definitionChangesFetcher . type , added . length , removed . length ] ) ;
179179 ffUpdate = splits . update ( added , removed , definitionChanges . ff . t ) ;
180180 }
@@ -202,8 +202,8 @@ export function definitionChangesUpdaterFactory(
202202 // emit SDK events
203203 if ( emitSplitsArrivedEvent ) {
204204 const metadata : SdkUpdateMetadata = {
205- type : updatedFlags . length > 0 ? FLAGS_UPDATE : SEGMENTS_UPDATE ,
206- names : updatedFlags . length > 0 ? updatedFlags : [ ]
205+ type : updatedDefinitions . length > 0 ? definitionChangesFetcher . type === 'configs' ? CONFIGS_UPDATE : FLAGS_UPDATE : SEGMENTS_UPDATE ,
206+ names : updatedDefinitions . length > 0 ? updatedDefinitions : [ ]
207207 } ;
208208 splitsEventEmitter . emit ( SDK_SPLITS_ARRIVED , metadata ) ;
209209 }
0 commit comments