featurehub-javascript-client-sdk
Version:
FeatureHub client/browser SDK
32 lines (31 loc) • 1.48 kB
TypeScript
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;
}