1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-17 01:17:29 +02:00

feat: project field to feature removed event (#9322)

Start sending out project for feature deleted, as we need it for edge to
keep exact copy.
This commit is contained in:
Jaanus Sellin 2025-02-19 09:37:10 +02:00 committed by GitHub
parent c1fc07f402
commit ca562c548d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 15 deletions

View File

@ -205,17 +205,9 @@ export class ClientFeatureToggleDelta extends EventEmitter {
return undefined;
}
const response: ClientFeaturesDeltaSchema = {
events: events.map((event) => {
if (event.type === 'feature-removed') {
const { project, ...rest } = event;
return rest;
}
return event;
}),
return {
events,
};
return Promise.resolve(response);
}
}

View File

@ -131,13 +131,13 @@ describe('RevisionCache', () => {
},
{
eventId: 4,
type: 'feature-removed',
type: DELTA_EVENT_TYPES.FEATURE_REMOVED,
featureName: 'test-flag',
project: 'default',
},
{
eventId: 5,
type: 'segment-updated',
type: DELTA_EVENT_TYPES.SEGMENT_UPDATED,
segment: {
id: 1,
name: 'update-segment-new',
@ -146,12 +146,12 @@ describe('RevisionCache', () => {
},
{
eventId: 6,
type: 'segment-removed',
type: DELTA_EVENT_TYPES.SEGMENT_REMOVED,
segmentId: 2,
},
{
eventId: 7,
type: 'segment-updated',
type: DELTA_EVENT_TYPES.SEGMENT_UPDATED,
segment: {
id: 3,
name: 'new-segment',

View File

@ -8,6 +8,7 @@ test('clientFeaturesDeltaSchema all fields', () => {
eventId: 1,
type: 'feature-removed',
featureName: 'removed-event',
project: 'default',
},
{
eventId: 1,

View File

@ -35,11 +35,12 @@ export const clientFeaturesDeltaSchema = {
},
{
type: 'object',
required: ['eventId', 'type', 'featureName'],
required: ['eventId', 'type', 'featureName', 'project'],
properties: {
eventId: { type: 'number' },
type: { type: 'string', enum: ['feature-removed'] },
featureName: { type: 'string' },
project: { type: 'string' },
},
},
{