unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
46 lines • 1.8 kB
TypeScript
import type { PlaygroundConstraintSchema } from '../../../../openapi/spec/playground-constraint-schema.js';
import type { PlaygroundSegmentSchema } from '../../../../openapi/spec/playground-segment-schema.js';
import type { StrategyEvaluationResult } from '../client.js';
import { type Constraint } from '../constraint.js';
import type { Context } from '../context.js';
import { type VariantDefinition } from '../variant.js';
export type SegmentForEvaluation = {
name: string;
id: number;
constraints: Constraint[];
};
export interface StrategyTransportInterface {
name: string;
title?: string;
disabled?: boolean;
parameters: any;
constraints: Constraint[];
variants?: VariantDefinition[];
segments?: number[];
id?: string;
}
export interface Segment {
id: number;
name: string;
description?: string;
constraints: Constraint[];
createdBy: string;
createdAt: string;
}
export declare class Strategy {
name: string;
private returnValue;
constructor(name: string, returnValue?: boolean);
checkConstraint(constraint: Constraint, context: Context): boolean;
checkConstraints(context: Context, constraints?: Iterable<Constraint>): {
result: boolean;
constraints: PlaygroundConstraintSchema[];
};
isEnabled(_parameters: unknown, _context: Context): boolean;
checkSegments(context: Context, segments: SegmentForEvaluation[]): {
result: boolean;
segments: PlaygroundSegmentSchema[];
};
isEnabledWithConstraints(parameters: Record<string, unknown>, context: Context, constraints: Iterable<Constraint>, segments: Array<SegmentForEvaluation>, disabled?: boolean, variantDefinitions?: VariantDefinition[]): StrategyEvaluationResult;
}
//# sourceMappingURL=strategy.d.ts.map