mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: now project moving is split into two events (#9358)
When project is moved, then Unleash creates only one event, which is for target project. We also need one for source project, to know that project was moved out of it. Test will be in enterprise repo.
This commit is contained in:
		
							parent
							
								
									42a05ef418
								
							
						
					
					
						commit
						55eb73cf08
					
				| @ -1,10 +1,11 @@ | ||||
| import type { | ||||
|     IEventStore, | ||||
|     IFeatureToggleDeltaQuery, | ||||
|     IFeatureToggleQuery, | ||||
|     IFlagResolver, | ||||
|     ISegmentReadModel, | ||||
|     IUnleashConfig, | ||||
| import { | ||||
|     FEATURE_PROJECT_CHANGE, | ||||
|     type IEventStore, | ||||
|     type IFeatureToggleDeltaQuery, | ||||
|     type IFeatureToggleQuery, | ||||
|     type IFlagResolver, | ||||
|     type ISegmentReadModel, | ||||
|     type IUnleashConfig, | ||||
| } from '../../../types'; | ||||
| import type ConfigurationRevisionService from '../../feature-toggle/configuration-revision-service'; | ||||
| import { UPDATE_REVISION } from '../../feature-toggle/configuration-revision-service'; | ||||
| @ -238,6 +239,16 @@ export class ClientFeatureToggleDelta extends EventEmitter { | ||||
|             latestRevision, | ||||
|         ); | ||||
| 
 | ||||
|         const featuresMovedEvents = changeEvents | ||||
|             .filter((event) => event.featureName) | ||||
|             .filter((event) => event.type === FEATURE_PROJECT_CHANGE) | ||||
|             .map((event) => ({ | ||||
|                 eventId: latestRevision, | ||||
|                 type: DELTA_EVENT_TYPES.FEATURE_REMOVED, | ||||
|                 featureName: event.featureName!, | ||||
|                 project: event.data.oldProject, | ||||
|             })); | ||||
| 
 | ||||
|         const featuresUpdated = [ | ||||
|             ...new Set( | ||||
|                 changeEvents | ||||
| @ -299,6 +310,7 @@ export class ClientFeatureToggleDelta extends EventEmitter { | ||||
|                 }), | ||||
|             ); | ||||
|             this.delta[environment].addEvents([ | ||||
|                 ...featuresMovedEvents, | ||||
|                 ...featuresUpdatedEvents, | ||||
|                 ...featuresRemovedEvents, | ||||
|                 ...segmentsUpdatedEvents, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user