mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
d8478dd928
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
34 lines
988 B
TypeScript
34 lines
988 B
TypeScript
import { IUnleashConfig } from '../types/option';
|
|
import { IUnleashStores } from '../types/stores';
|
|
import { Logger } from '../logger';
|
|
import { IEventStore } from '../types/stores/event-store';
|
|
import { IEvent } from '../types/events';
|
|
|
|
export default class EventService {
|
|
private logger: Logger;
|
|
|
|
private eventStore: IEventStore;
|
|
|
|
constructor(
|
|
{ eventStore }: Pick<IUnleashStores, 'eventStore'>,
|
|
{ getLogger }: Pick<IUnleashConfig, 'getLogger'>,
|
|
) {
|
|
this.logger = getLogger('services/event-service.ts');
|
|
this.eventStore = eventStore;
|
|
}
|
|
|
|
async getEvents(): Promise<IEvent[]> {
|
|
return this.eventStore.getEvents();
|
|
}
|
|
|
|
async getEventsForToggle(name: string): Promise<IEvent[]> {
|
|
return this.eventStore.getEventsForFeature(name);
|
|
}
|
|
|
|
async getEventsForProject(project: string): Promise<IEvent[]> {
|
|
return this.eventStore.getEventsFilterByProject(project);
|
|
}
|
|
}
|
|
|
|
module.exports = EventService;
|