import type * as ConfigJson from "./ConfigJson"; import type { PrerequisiteFlagComparator, RedirectMode, SegmentComparator, SettingType, UserComparator } from "./ConfigJson"; export declare class ProjectConfig { readonly configJson: string | undefined; readonly config: Config | undefined; readonly timestamp: number; readonly httpETag: string | undefined; static readonly serializationFormatVersion = "v2"; static readonly empty: ProjectConfig; static contentEquals(projectConfig1: ProjectConfig, projectConfig2: ProjectConfig): boolean; constructor(configJson: string | undefined, config: Config | undefined, timestamp: number, httpETag: string | undefined); with(timestamp: number): ProjectConfig; get isEmpty(): boolean; isExpired(expirationMs: number): boolean; static generateTimestamp(): number; static serialize(config: ProjectConfig): string; static deserialize(value: string): ProjectConfig; } /** Details of a ConfigCat config. */ export interface IConfig { /** The salt that was used to hash sensitive comparison values. */ readonly salt: string | undefined; /** The array of segments. */ readonly segments: ReadonlyArray; /** The key-value map of settings. */ readonly settings: Readonly<{ [key: string]: ISettingUnion; }>; } export declare class Config implements IConfig { static deserialize(configJson: string): Config; readonly preferences: Preferences | undefined; readonly segments: ReadonlyArray; readonly settings: Readonly<{ [key: string]: SettingUnion; }>; constructor(json: Partial); get salt(): string | undefined; } export declare class Preferences { readonly baseUrl: string | undefined; readonly redirectMode: RedirectMode | undefined; readonly salt: string | undefined; constructor(json: ConfigJson.Preferences); } /** Describes a segment. */ export interface ISegment { /** The name of the segment. */ readonly name: string; /** The array of segment rule conditions (where there is a logical AND relation between the items). */ readonly conditions: ReadonlyArray; } export declare class Segment implements ISegment { readonly name: string; readonly conditions: ReadonlyArray; constructor(json: ConfigJson.Segment); } export declare type SettingTypeMap = { [SettingType.Boolean]: boolean; [SettingType.String]: string; [SettingType.Int]: number; [SettingType.Double]: number; }; export declare type SettingValue = SettingTypeMap[SettingType] | null | undefined; export declare type VariationIdValue = string | null | undefined; /** A model object which contains a setting value along with related data. */ export interface ISettingValueContainer { /** Setting value. */ readonly value: SettingTypeMap[TSetting]; /** Variation ID. */ readonly variationId?: NonNullable; } export declare class SettingValueContainer implements ISettingValueContainer { readonly value: SettingTypeMap[TSetting]; readonly variationId?: NonNullable; constructor(json: ConfigJson.ServedValue, hasUnwrappedValue?: boolean); } export declare type ISettingUnion = { [K in SettingType]: ISetting; }[SettingType]; /** Feature flag or setting. */ export interface ISetting extends ISettingValueContainer { /** Setting type. */ readonly type: TSetting; /** The User Object attribute which serves as the basis of percentage options evaluation. */ readonly percentageOptionsAttribute: string; /** The array of targeting rules (where there is a logical OR relation between the items). */ readonly targetingRules: ReadonlyArray>; /** The array of percentage options. */ readonly percentageOptions: ReadonlyArray>; } export declare type SettingUnion = { [K in SettingType]: Setting; }[SettingType]; export declare class Setting extends SettingValueContainer implements ISetting { readonly type: TSetting; readonly percentageOptionsAttribute: string; readonly targetingRules: ReadonlyArray>; readonly percentageOptions: ReadonlyArray>; readonly configJsonSalt: string; constructor(json: ConfigJson.Setting, config?: Config); static fromValue(value: NonNullable): Setting; } /** Describes a targeting rule. */ export interface ITargetingRule { /** The array of conditions that are combined with the AND logical operator. (The IF part of the targeting rule.) */ readonly conditions: ReadonlyArray; /** The simple value or the array of percentage options associated with the targeting rule. (The THEN part of the targeting rule.) */ readonly then: ISettingValueContainer | ReadonlyArray>; } export declare class TargetingRule implements ITargetingRule { readonly conditions: ReadonlyArray; readonly then: SettingValueContainer | ReadonlyArray>; constructor(json: ConfigJson.TargetingRule, config: Config); } /** Represents a percentage option. */ export interface IPercentageOption extends ISettingValueContainer { /** A number between 0 and 100 that represents a randomly allocated fraction of the users. */ readonly percentage: number; } export declare class PercentageOption extends SettingValueContainer implements IPercentageOption { readonly percentage: number; constructor(json: ConfigJson.PercentageOption); } export declare type ConditionTypeMap = { ["UserCondition"]: IUserConditionUnion; ["PrerequisiteFlagCondition"]: IPrerequisiteFlagCondition; ["SegmentCondition"]: ISegmentCondition; }; export declare type IConditionUnion = ConditionTypeMap[keyof ConditionTypeMap]; /** Represents a condition. */ export interface ICondition { /** The type of the condition. */ readonly type: TCondition; } export declare type ConditionUnion = UserConditionUnion | PrerequisiteFlagCondition | SegmentCondition; export declare type UserConditionComparisonValueTypeMap = { [UserComparator.TextIsOneOf]: Readonly; [UserComparator.TextIsNotOneOf]: Readonly; [UserComparator.TextContainsAnyOf]: Readonly; [UserComparator.TextNotContainsAnyOf]: Readonly; [UserComparator.SemVerIsOneOf]: Readonly; [UserComparator.SemVerIsNotOneOf]: Readonly; [UserComparator.SemVerLess]: string; [UserComparator.SemVerLessOrEquals]: string; [UserComparator.SemVerGreater]: string; [UserComparator.SemVerGreaterOrEquals]: string; [UserComparator.NumberEquals]: number; [UserComparator.NumberNotEquals]: number; [UserComparator.NumberLess]: number; [UserComparator.NumberLessOrEquals]: number; [UserComparator.NumberGreater]: number; [UserComparator.NumberGreaterOrEquals]: number; [UserComparator.SensitiveTextIsOneOf]: Readonly; [UserComparator.SensitiveTextIsNotOneOf]: Readonly; [UserComparator.DateTimeBefore]: number; [UserComparator.DateTimeAfter]: number; [UserComparator.SensitiveTextEquals]: string; [UserComparator.SensitiveTextNotEquals]: string; [UserComparator.SensitiveTextStartsWithAnyOf]: Readonly; [UserComparator.SensitiveTextNotStartsWithAnyOf]: Readonly; [UserComparator.SensitiveTextEndsWithAnyOf]: Readonly; [UserComparator.SensitiveTextNotEndsWithAnyOf]: Readonly; [UserComparator.SensitiveArrayContainsAnyOf]: Readonly; [UserComparator.SensitiveArrayNotContainsAnyOf]: Readonly; [UserComparator.TextEquals]: string; [UserComparator.TextNotEquals]: string; [UserComparator.TextStartsWithAnyOf]: Readonly; [UserComparator.TextNotStartsWithAnyOf]: Readonly; [UserComparator.TextEndsWithAnyOf]: Readonly; [UserComparator.TextNotEndsWithAnyOf]: Readonly; [UserComparator.ArrayContainsAnyOf]: Readonly; [UserComparator.ArrayNotContainsAnyOf]: Readonly; }; export declare type IUserConditionUnion = { [K in UserComparator]: IUserCondition; }[UserComparator]; /** Describes a condition that is based on a User Object attribute. */ export interface IUserCondition extends ICondition<"UserCondition"> { /** The User Object attribute that the condition is based on. Can be "Identifier", "Email", "Country" or any custom attribute. */ readonly comparisonAttribute: string; /** The operator which defines the relation between the comparison attribute and the comparison value. */ readonly comparator: TComparator; /** The value that the User Object attribute is compared to. */ readonly comparisonValue: UserConditionComparisonValueTypeMap[TComparator]; } export declare type UserConditionUnion = { [K in UserComparator]: UserCondition; }[UserComparator]; export declare class UserCondition implements IUserCondition { readonly type = "UserCondition"; readonly comparisonAttribute: string; readonly comparator: TComparator; readonly comparisonValue: UserConditionComparisonValueTypeMap[TComparator]; constructor(json: ConfigJson.UserCondition); } /** Describes a condition that is based on a prerequisite flag. */ export interface IPrerequisiteFlagCondition extends ICondition<"PrerequisiteFlagCondition"> { /** The key of the prerequisite flag that the condition is based on. */ readonly prerequisiteFlagKey: string; /** The operator which defines the relation between the evaluated value of the prerequisite flag and the comparison value. */ readonly comparator: PrerequisiteFlagComparator; /** The value that the evaluated value of the prerequisite flag is compared to. */ readonly comparisonValue: NonNullable; } export declare class PrerequisiteFlagCondition implements IPrerequisiteFlagCondition { readonly type = "PrerequisiteFlagCondition"; readonly prerequisiteFlagKey: string; readonly comparator: PrerequisiteFlagComparator; readonly comparisonValue: NonNullable; constructor(json: ConfigJson.PrerequisiteFlagCondition); } /** Describes a condition that is based on a segment. */ export interface ISegmentCondition extends ICondition<"SegmentCondition"> { /** The segment that the condition is based on. */ readonly segment: ISegment; /** The operator which defines the expected result of the evaluation of the segment. */ readonly comparator: SegmentComparator; } export declare class SegmentCondition implements ISegmentCondition { readonly type = "SegmentCondition"; readonly segment: Segment; readonly comparator: SegmentComparator; constructor(json: ConfigJson.SegmentCondition, config: Config); } //# sourceMappingURL=ProjectConfig.d.ts.map