import { IUniversalFlagConfigResponse, IBanditParametersResponse } from '../http-client'; import { Environment, FormatEnum, IObfuscatedPrecomputedBandit, IPrecomputedBandit, PrecomputedFlag } from '../interfaces'; import { ContextAttributes, FlagKey, HashedFlagKey } from '../types'; interface IBasePrecomputedConfigurationResponse { readonly format: FormatEnum.PRECOMPUTED; readonly obfuscated: boolean; readonly createdAt: string; readonly environment?: Environment; } export interface IPrecomputedConfigurationResponse extends IBasePrecomputedConfigurationResponse { readonly obfuscated: false; readonly flags: Record; readonly bandits: Record; } export interface IObfuscatedPrecomputedConfigurationResponse extends IBasePrecomputedConfigurationResponse { readonly obfuscated: true; readonly salt: string; readonly flags: Record; readonly bandits: Record; } export interface IPrecomputedConfiguration { readonly response: string; readonly subjectKey: string; readonly subjectAttributes?: ContextAttributes; } declare abstract class BasePrecomputedConfigurationResponse { readonly subjectKey: string; readonly subjectAttributes?: ContextAttributes | undefined; readonly environment?: Environment | undefined; readonly createdAt: string; readonly format = FormatEnum.PRECOMPUTED; constructor(subjectKey: string, subjectAttributes?: ContextAttributes | undefined, environment?: Environment | undefined); } export declare class PrecomputedConfiguration implements IPrecomputedConfiguration { readonly response: string; readonly subjectKey: string; readonly subjectAttributes?: ContextAttributes | undefined; private constructor(); static obfuscated(subjectKey: string, flags: Record, bandits: Record, salt: string, subjectAttributes?: ContextAttributes, environment?: Environment): IPrecomputedConfiguration; static unobfuscated(subjectKey: string, flags: Record, bandits: Record, subjectAttributes?: ContextAttributes, environment?: Environment): IPrecomputedConfiguration; } export declare class PrecomputedConfigurationResponse extends BasePrecomputedConfigurationResponse implements IPrecomputedConfigurationResponse { readonly flags: Record; readonly bandits: Record; readonly obfuscated = false; constructor(subjectKey: string, flags: Record, bandits: Record, subjectAttributes?: ContextAttributes, environment?: Environment); } export declare class ObfuscatedPrecomputedConfigurationResponse extends BasePrecomputedConfigurationResponse implements IObfuscatedPrecomputedConfigurationResponse { readonly bandits: Record; readonly flags: Record; readonly obfuscated = true; readonly salt: string; constructor(subjectKey: string, flags: Record, bandits: Record, salt: string, subjectAttributes?: ContextAttributes, environment?: Environment); } export interface IConfigurationWire { /** * Version field should be incremented for breaking format changes. * For example, removing required fields or changing field type/meaning. */ readonly version: number; /** * Wrapper around an IUniversalFlagConfig payload */ readonly config?: IConfigResponse; /** * Wrapper around an IBanditParametersResponse payload. */ readonly bandits?: IConfigResponse; readonly precomputed?: IPrecomputedConfiguration; } type UfcResponseType = IUniversalFlagConfigResponse | IBanditParametersResponse; type ResponseString = string & { readonly __brand: unique symbol; readonly __type: T; }; /** * A wrapper around a server response that includes the response, etag, and fetchedAt timestamp. */ interface IConfigResponse { readonly response: ResponseString; readonly etag?: string; readonly fetchedAt?: string; } export declare function inflateResponse(response: ResponseString): T; export declare function deflateResponse(value: T): ResponseString; export declare class ConfigurationWireV1 implements IConfigurationWire { readonly precomputed?: IPrecomputedConfiguration | undefined; readonly config?: IConfigResponse | undefined; readonly bandits?: IConfigResponse | undefined; readonly version = 1; private constructor(); toString(): string; static fromResponses(flagConfig: IUniversalFlagConfigResponse, banditConfig?: IBanditParametersResponse, flagConfigEtag?: string, banditConfigEtag?: string): ConfigurationWireV1; static precomputed(precomputedConfig: IPrecomputedConfiguration): ConfigurationWireV1; static empty(): ConfigurationWireV1; } export {}; //# sourceMappingURL=configuration-wire-types.d.ts.map