1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-22 01:16:07 +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; return undefined;
} }
const response: ClientFeaturesDeltaSchema = { return {
events: events.map((event) => { events,
if (event.type === 'feature-removed') {
const { project, ...rest } = event;
return rest;
}
return event;
}),
}; };
return Promise.resolve(response);
} }
} }

View File

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

View File

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

View File

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