UNPKG

featurehub-repository

Version:

Core package of API that exposes FeatureHub feature flags, values and configuration to client applications written in Typescript or Javascript.

32 lines (31 loc) 1.35 kB
import { RolloutStrategy, RolloutStrategyAttribute } from './models/models'; import { ClientContext } from './client_context'; export interface PercentageCalculator { determineClientPercentage(percentageText: string, featureId: string): number; } export declare class Murmur3PercentageCalculator implements PercentageCalculator { private readonly MAX_PERCENTAGE; determineClientPercentage(percentageText: string, featureId: string): number; } export declare class Applied { readonly matched: boolean; readonly value: any; constructor(matched: boolean, value: any); } export declare class ApplyFeature { private readonly _percentageCalculator; private readonly _matcherRepository; constructor(percentageCalculator?: PercentageCalculator, matcherRepository?: MatcherRepository); apply(strategies: Array<RolloutStrategy>, key: string, featureValueId: string, context: ClientContext): Applied; private determinePercentageKey; private matchAttribute; } export interface StrategyMatcher { match(suppliedValue: string, attr: RolloutStrategyAttribute): boolean; } export interface MatcherRepository { findMatcher(attr: RolloutStrategyAttribute): StrategyMatcher; } export declare class MatcherRegistry implements MatcherRepository { findMatcher(attr: RolloutStrategyAttribute): StrategyMatcher; }