unleash-server
Version:
Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.
42 lines (41 loc) • 1.49 kB
TypeScript
import { PlaygroundConstraintSchema } from 'lib/openapi/spec/playground-constraint-schema';
import { PlaygroundSegmentSchema } from 'lib/openapi/spec/playground-segment-schema';
import { StrategyEvaluationResult } from '../client';
import { Constraint } from '../constraint';
import { Context } from '../context';
export declare type SegmentForEvaluation = {
name: string;
id: number;
constraints: Constraint[];
};
export interface StrategyTransportInterface {
name: string;
parameters: any;
constraints: Constraint[];
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: unknown, context: Context, constraints: Iterable<Constraint>, segments: SegmentForEvaluation[]): StrategyEvaluationResult;
}