1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-08 01:15:49 +02:00
unleash.unleash/src/lib/features/client-feature-toggles/delta/createClientFeatureToggleDelta.ts
Jaanus Sellin 138ba35d7a
feat: segment delta (#8990)
Now the delta endpoint also always returns all the segments.
2024-12-17 10:56:09 +02:00

35 lines
1.2 KiB
TypeScript

import { ClientFeatureToggleDelta } from './client-feature-toggle-delta';
import EventStore from '../../events/event-store';
import ConfigurationRevisionService from '../../feature-toggle/configuration-revision-service';
import type { IUnleashConfig } from '../../../types';
import type { Db } from '../../../db/db';
import ClientFeatureToggleDeltaReadModel from './client-feature-toggle-delta-read-model';
import { SegmentReadModel } from '../../segment/segment-read-model';
export const createClientFeatureToggleDelta = (
db: Db,
config: IUnleashConfig,
): ClientFeatureToggleDelta => {
const { getLogger, eventBus, flagResolver } = config;
const eventStore = new EventStore(db, getLogger);
const clientFeatureToggleDeltaReadModel =
new ClientFeatureToggleDeltaReadModel(db, eventBus);
const configurationRevisionService =
ConfigurationRevisionService.getInstance({ eventStore }, config);
const segmentReadModel = new SegmentReadModel(db);
const clientFeatureToggleDelta = new ClientFeatureToggleDelta(
clientFeatureToggleDeltaReadModel,
segmentReadModel,
eventStore,
configurationRevisionService,
flagResolver,
);
return clientFeatureToggleDelta;
};