unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
45 lines • 1.25 kB
JavaScript
export class FakeReleasePlanMilestoneStrategyStore {
constructor() {
this.items = [];
}
async insert(item) {
const strategy = {
...item,
id: String(this.items.length + 1),
strategyName: item.name,
};
this.items.push(strategy);
return strategy;
}
async update(id, item) {
const idx = this.items.findIndex((s) => s.id === id);
if (idx >= 0) {
this.items[idx] = { ...this.items[idx], ...item };
return this.items[idx];
}
return {};
}
async upsert(_strategyId, _strategy) {
return {};
}
async deleteStrategiesForMilestone(_milestoneId) {
this.items = this.items.filter((s) => s.milestoneId !== _milestoneId);
}
async get(key) {
return this.items.find((s) => s.id === key);
}
async getAll() {
return this.items;
}
async exists(key) {
return this.items.some((s) => s.id === key);
}
async delete(key) {
this.items = this.items.filter((s) => s.id !== key);
}
async deleteAll() {
this.items = [];
}
destroy() { }
}
//# sourceMappingURL=fake-release-plan-milestone-strategy-store.js.map