UNPKG

featurehub-javascript-client-sdk

Version:
32 lines (31 loc) 1.48 kB
import { FeatureRolloutStrategy, FeatureRolloutStrategyAttribute } from './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 interface StrategyMatcher { match(suppliedValue: string, attr: FeatureRolloutStrategyAttribute): boolean; } export interface MatcherRepository { findMatcher(attr: FeatureRolloutStrategyAttribute): StrategyMatcher; } export declare class MatcherRegistry implements MatcherRepository { findMatcher(attr: FeatureRolloutStrategyAttribute): StrategyMatcher; } export declare class ApplyFeature { private readonly _percentageCalculator; private readonly _matcherRepository; constructor(percentageCalculator?: PercentageCalculator, matcherRepository?: MatcherRepository); apply(strategies: FeatureRolloutStrategy[] | undefined, key: string, featureValueId: string, context?: ClientContext): Applied; static determinePercentageKey(context: ClientContext, percentageAttributes: Array<string> | undefined | null): string; private matchAttribute; }