hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
897 lines • 29.4 kB
TypeScript
/**
* It's difficult to remove fields from server-returned types (Expression,
* Split, EventType, CommitConfig, etc) as old SDK versions will depend on them.
* So we should only add fields to these types if we don't expect to remove them
* later.
*/
export type ValueType = VoidValueType | BooleanValueType | IntValueType | FloatValueType | StringValueType | RegexValueType | EnumValueType | ObjectValueType | UnionValueType | ListValueType | FunctionValueType;
export type VoidValueType = {
type: "VoidValueType";
};
export type BooleanValueType = {
type: "BooleanValueType";
};
export type IntValueType = {
type: "IntValueType";
};
export type FloatValueType = {
type: "FloatValueType";
};
export type StringValueType = {
type: "StringValueType";
};
export type RegexValueType = {
type: "RegexValueType";
};
export type EnumValueType = {
type: "EnumValueType";
enumTypeName: string;
};
export type ObjectValueType = {
type: "ObjectValueType";
objectTypeName: string;
};
export type UnionValueType = {
type: "UnionValueType";
unionTypeName: string;
};
export type ListValueType = {
type: "ListValueType";
itemValueType: ValueType;
};
export type FunctionValueType = {
type: "FunctionValueType";
parameterValueTypes: ValueType[];
returnValueType: ValueType;
};
export type Schema = {
enums: {
[enumTypeName: string]: EnumSchema;
};
objects: {
[objectTypeName: string]: ObjectSchema;
};
unions: {
[unionTypeName: string]: UnionSchema;
};
tags?: {
[name: string]: Tag;
};
};
export type CommonTypeSchema = {
description: string | null;
};
export type DeprecationTypeSchema = {
deprecationReason?: string;
};
export type EnumSchema = CommonTypeSchema & {
values: {
[enumValue: string]: EnumValueSchema;
};
};
export type EnumValueSchema = CommonTypeSchema & DeprecationTypeSchema;
export type ObjectRole = "args" | "input" | "output" | "event";
export type ObjectSchema = CommonTypeSchema & {
role: ObjectRole;
fields: {
[fieldName: string]: ObjectFieldSchema;
};
};
export type Tag = {
name: string;
color: string;
};
export type ObjectFieldSchema = CommonTypeSchema & DeprecationTypeSchema & {
valueType: ValueType;
};
export type UnionSchema = CommonTypeSchema & {
variants: {
[objectTypeName: string]: true;
};
};
export type Expression = NoOpExpression | BooleanExpression | IntExpression | FloatExpression | StringExpression | RegexExpression | EnumExpression | ObjectExpression | GetFieldExpression | UpdateObjectExpression | ListExpression | SwitchExpression | EnumSwitchExpression | ComparisonExpression | ArithmeticExpression | RoundNumberExpression | StringifyNumberExpression | StringConcatExpression | GetUrlQueryParameterExpression | SplitExpression | LogEventExpression | FunctionExpression | VariableExpression | ApplicationExpression;
export type BaseExpressionFields = {
id: string;
isTransient?: boolean;
logs?: Logs;
metadata?: {
note?: string;
permissions?: Permissions;
tags?: {
[tagName: string]: true;
};
};
};
export type LogsHandler = (logs: Required<Pick<Logs, "messageList" | "eventList" | "evaluationList" | "exposureList">>) => void;
export type Logs = {
messageList?: Message[];
eventList?: Event[];
exposureList?: Exposure[];
evaluationList?: Evaluation[];
evaluations?: CountMap;
/** @deprecated - use eventList instead */
events?: CountMap;
/** @deprecated - use exposureList instead */
exposures?: CountMap;
};
export type CountMap = {
[key: string]: number;
};
export type Evaluation = {
path: string;
value: Value;
args: {
[path: string]: ObjectValue;
};
isFallback: boolean;
};
export type Exposure = {
splitId: string;
unitId: string;
event: Event | null;
assignment: SplitAssignment;
};
export type Event = {
objectTypeName: string;
payload: ObjectValue;
};
export type Message = {
level: LogLevel;
message: string;
metadata: object;
};
export type Permissions = {
group: {
[groupId: string]: Permission;
};
user: {
[userId: string]: Permission;
};
};
export type Permission = {
write: "allow";
};
export type NoOpExpression = BaseExpressionFields & {
type: typeof NoOpExpressionType;
valueType: VoidValueType;
};
export declare const NoOpExpressionType: "NoOpExpression";
export type BooleanExpression = BaseExpressionFields & {
type: typeof BooleanExpressionType;
valueType: BooleanValueType;
value: boolean;
};
export declare const BooleanExpressionType: "BooleanExpression";
export type IntExpression = BaseExpressionFields & {
type: typeof IntExpressionType;
valueType: IntValueType;
value: number;
};
export declare const IntExpressionType: "IntExpression";
export type FloatExpression = BaseExpressionFields & {
type: typeof FloatExpressionType;
valueType: FloatValueType;
value: number;
};
export declare const FloatExpressionType: "FloatExpression";
export type StringExpression = BaseExpressionFields & {
type: typeof StringExpressionType;
valueType: StringValueType;
value: string;
};
export declare const StringExpressionType: "StringExpression";
export type RegexExpression = BaseExpressionFields & {
type: typeof RegexExpressionType;
valueType: RegexValueType;
value: string;
};
export declare const RegexExpressionType: "RegexExpression";
export type EnumExpression = BaseExpressionFields & {
type: typeof EnumExpressionType;
valueType: EnumValueType;
value: string;
};
export declare const EnumExpressionType: "EnumExpression";
export type ObjectExpression = BaseExpressionFields & {
type: typeof ObjectExpressionType;
valueType: ObjectValueType;
objectTypeName: string;
fields: {
[fieldName: string]: Expression | null;
};
};
export declare const ObjectExpressionType: "ObjectExpression";
export type GetFieldExpression = BaseExpressionFields & {
type: typeof GetFieldExpressionType;
valueType: ValueType;
object: Expression | null;
fieldPath: string | null;
};
export declare const GetFieldExpressionType: "GetFieldExpression";
export type UpdateObjectExpression = BaseExpressionFields & {
type: typeof UpdateObjectExpressionType;
valueType: ObjectValueType;
object: Expression | null;
updates: {
[fieldName: string]: Expression | null;
};
};
export declare const UpdateObjectExpressionType: "UpdateObjectExpression";
export type ListExpression = BaseExpressionFields & {
type: typeof ListExpressionType;
valueType: ListValueType;
items: (Expression | null)[];
};
export declare const ListExpressionType = "ListExpression";
export type SwitchExpression = BaseExpressionFields & {
type: typeof SwitchExpressionType;
valueType: ValueType;
control: Expression | null;
cases: {
id: string;
when: Expression | null;
then: Expression | null;
}[];
default: Expression | null;
};
export declare const SwitchExpressionType: "SwitchExpression";
export type EnumSwitchExpression = BaseExpressionFields & {
type: typeof EnumSwitchExpressionType;
valueType: ValueType;
control: Expression | null;
cases: {
[enumValue: string]: Expression | null;
};
};
export declare const EnumSwitchExpressionType: "EnumSwitchExpression";
declare const comparisonOperators: readonly ["==", "!=", "<", "<=", ">", ">=", "AND", "OR", "in", "notIn", "startsWith", "notStartsWith", "endsWith", "notEndsWith", "contains", "notContains", "matches", "notMatches"];
export type ComparisonOperator = (typeof comparisonOperators)[number];
export type ComparisonExpression = BaseExpressionFields & {
type: typeof ComparisonExpressionType;
valueType: BooleanValueType;
operator: ComparisonOperator | null;
a: Expression | null;
b: Expression | null;
};
export declare const ComparisonExpressionType = "ComparisonExpression";
export declare const arithmeticOperators: readonly ["+", "-", "*", "/", "POW", "MOD"];
export type ArithmeticOperator = (typeof arithmeticOperators)[number];
export type ArithmeticExpression = BaseExpressionFields & {
type: typeof ArithmeticExpressionType;
valueType: IntValueType | FloatValueType;
operator: ArithmeticOperator | null;
a: Expression | null;
b: Expression | null;
};
export declare const ArithmeticExpressionType: "ArithmeticExpression";
export type RoundNumberExpression = BaseExpressionFields & {
type: typeof RoundNumberExpressionType;
valueType: IntValueType;
number: Expression | null;
};
export declare const RoundNumberExpressionType: "RoundNumberExpression";
export type StringifyNumberExpression = BaseExpressionFields & {
type: typeof StringifyNumberExpressionType;
valueType: StringValueType;
number: Expression | null;
};
export declare const StringifyNumberExpressionType: "StringifyNumberExpression";
export type StringConcatExpression = BaseExpressionFields & {
type: typeof StringConcatExpressionType;
valueType: StringValueType;
strings: Expression | null;
};
export declare const StringConcatExpressionType: "StringConcatExpression";
export type GetUrlQueryParameterExpression = BaseExpressionFields & {
type: typeof GetUrlQueryParameterExpressionType;
valueType: StringValueType;
url: Expression | null;
queryParameterName: Expression | null;
};
export declare const GetUrlQueryParameterExpressionType: "GetUrlQueryParameterExpression";
export type SplitExpression = BaseExpressionFields & {
type: typeof SplitExpressionType;
valueType: ValueType;
splitId: string | null;
dimensionId: string | null;
expose: Expression | null;
unitId: Expression | null;
dimensionMapping: DimensionMapping;
eventObjectTypeName: string | null;
eventPayload: Expression | null;
featuresMapping: FeaturesMapping;
};
export declare const SplitExpressionType: "SplitExpression";
export type DimensionMapping = DiscreteDimensionMapping | ContinuousDimensionMapping;
export type DiscreteDimensionMapping = {
type: typeof DiscreteDimensionType;
cases: {
[armId: string]: Expression | null;
};
};
export declare const DiscreteDimensionType = "discrete";
export type FeaturesMapping = {
[featureId: string]: Expression | null;
};
export type ContinuousDimensionMapping = {
type: typeof ContinuousDimensionType;
function: Expression | null;
};
export declare const ContinuousDimensionType = "continuous";
export type LogEventExpression = BaseExpressionFields & {
type: typeof LogEventExpressionType;
valueType: VoidValueType;
eventObjectTypeName: string | null;
eventPayload: Expression | null;
eventTypeId: string | null;
unitId: Expression | null;
featuresMapping: FeaturesMapping;
};
export declare const LogEventExpressionType: "LogEventExpression";
export type FunctionExpression = BaseExpressionFields & {
type: typeof FunctionExpressionType;
valueType: FunctionValueType;
parameters: Parameter[];
body: Expression | null;
};
export declare const FunctionExpressionType: "FunctionExpression";
export type Parameter = {
id: string;
name: string;
};
export type VariableExpression = BaseExpressionFields & {
type: typeof VariableExpressionType;
valueType: ValueType;
variableId: string;
};
export declare const VariableExpressionType: "VariableExpression";
export type ApplicationExpression = BaseExpressionFields & {
type: typeof ApplicationExpressionType;
valueType: ValueType;
function: Expression | null;
arguments: (Expression | null)[];
};
export declare const ApplicationExpressionType: "ApplicationExpression";
export type SplitType = "test" | "ml";
export type SplitBase = {
id: string;
name: string;
description?: string;
archived?: boolean;
dimensions: {
[dimensionId: string]: Dimension;
};
eventObjectTypeName: string | null;
featureIds: {
[featureId: string]: true;
};
};
export type TestSplit = SplitBase & {
type: "test";
};
export type MLSplit = SplitBase & {
type: "ml";
rewardEvents: {
eventObjectTypeName: string;
unitIdPayloadPath: string[];
}[];
rewardSql: string;
};
export type Split = TestSplit | MLSplit;
export type SplitMap = {
[splitId: string]: Split;
};
export type Dimension = DiscreteDimension | ContinuousDimension;
type BaseDimensionFields = {
id: string;
splitId: string;
index: number;
name: string;
};
export type DiscreteDimension = BaseDimensionFields & {
type: typeof DiscreteDimensionType;
arms: {
[armId: string]: Arm;
};
controlArmId?: string;
};
export type Arm = {
id: string;
dimensionId: string;
index: number;
name: string;
allocation: number;
description?: string;
};
type ContinuousDimension = BaseDimensionFields & {
type: typeof ContinuousDimensionType;
range: number[][];
};
export type EventType = {
id: string;
name: string;
featureIds: {
[featureId: string]: true;
};
};
export type EventTypeMap = {
[eventTypeId: string]: EventType;
};
export type Feature = {
id: string;
name: string;
valueType: ValueType;
};
export type FeatureMap = {
[featureId: string]: Feature;
};
export type BaseCommitData = {
schemaCode: string;
expression: Expression;
splits: SplitMap;
eventTypes: EventTypeMap;
features: FeatureMap;
};
export type CommitData = BaseCommitData & {
id: number;
projectId: number;
config: CommitConfig;
hash: string;
};
export type ActiveCommitData = CommitData;
export type CommitConfig = {
splitConfig: {
[splitId: string]: SplitConfig;
};
};
export type SplitConfig = EpsilonGreedyConfig | PersonalizationSplitConfig;
export type EpsilonGreedyConfig = {
type: "EpsilonGreedyConfig";
epsilon: number;
bestAssignment: SplitAssignment;
};
type PersonalizationSplitConfig = {
type: "PersonalizationSplitConfig";
epsilon: number;
logic: {
[dimensionId: string]: {
rules: {
featureValuesPath: string[];
featureValue: Value;
armId: string;
}[];
defaultArmId: string;
};
};
};
export type Query<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = {
name?: string;
variableDefinitions: VariableDefinitions;
fragmentDefinitions: FragmentDefinitions<TFieldArguments>;
fieldQuery: FieldQuery<TFieldArguments>;
};
export type FragmentDefinitions<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = {
[fragmentName: string]: InlineFragment<TFieldArguments>;
};
export type VariableDefinitions = {
[variableName: string]: {
valueType: ValueType;
defaultValue?: Value;
};
};
export type FieldQuery<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = {
[objectTypeName: string]: Fragment<TFieldArguments>;
};
export type Fragment<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = InlineFragment<TFieldArguments> | FragmentSpread;
export type InlineFragment<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = {
type: "InlineFragment";
objectTypeName: string;
selection: Selection<TFieldArguments>;
};
export type FragmentSpread = {
type: "FragmentSpread";
fragmentName: string;
};
export type Selection<TFieldArguments extends ObjectValueWithVariables | ObjectExpression> = {
[fieldName: string]: {
fieldArguments: TFieldArguments;
fieldQuery: FieldQuery<TFieldArguments> | null;
};
};
export type Value = boolean | number | string | ObjectValue | Value[];
export type ObjectValue = {
[fieldName: string]: Value;
};
export type QueryVariable = {
__isVariable: true;
name: string;
};
export declare function isQueryVariable(value: ValueWithVariables): value is QueryVariable;
export type ValueWithVariables = Value | QueryVariable | ValueWithVariables[] | ObjectValueWithVariables;
export type ObjectValueWithVariables = {
[fieldName: string]: ValueWithVariables;
};
export type SplitAssignment = {
[dimensionId: string]: SplitAssignmentEntry;
};
export type SplitAssignmentEntry = {
type: typeof DiscreteDimensionType;
armId: string;
} | {
type: typeof ContinuousDimensionType;
value: number;
};
export type SplitAssignmentWithNullableEntries = {
[dimensionId: string]: SplitAssignmentEntry | null;
};
export declare const requestTypes: readonly ["codegen", "graphql", "init", "hash", "js", "schema"];
export type RequestType = (typeof requestTypes)[number];
export type SdkType = "js" | "python" | "rust";
export type JsLanguage = "ts" | "js" | "mjs" | "cjs";
export type Language = JsLanguage | "python" | "rust";
export type CodegenFramework = "nextApp" | "nextPages" | "react" | "reactNative" | "remix" | "gatsby" | "vue";
export type CodegenPlatform = "vercel";
export type CodegenRequestBody = {
query: string | null;
framework?: CodegenFramework;
platform?: CodegenPlatform;
clientFileName?: string;
getHypertuneImportPath?: string;
includeToken?: boolean;
includeFallback?: boolean;
includeToolbar?: boolean;
sdkType: SdkType;
sdkVersion: string;
language: Language;
};
export type QueryObjectValueWithVariables = {
name?: string;
variableDefinitions: VariableDefinitions;
fragmentDefinitions: {
[fragmentName: string]: InlineFragmentObjectValueWithVariables;
};
fieldQuery: FieldQueryObjectValueWithVariables;
};
export type FieldQueryObjectValueWithVariables = {
[objectTypeName: string]: FragmentObjectValueWithVariables;
};
export type FragmentObjectValueWithVariables = InlineFragmentObjectValueWithVariables | FragmentSpread;
export type InlineFragmentObjectValueWithVariables = {
type: "InlineFragment";
objectTypeName: string;
selection: SelectionObjectValueWithVariables;
};
export type SelectionObjectValueWithVariables = {
[fieldName: string]: {
fieldArguments: ObjectValueWithVariables;
fieldQuery: FieldQueryObjectValueWithVariables | null;
};
};
export type InitQuery = {
type: "Query";
query: QueryObjectValueWithVariables | null;
} | {
type: "GraphqlQuery";
code: string;
} | {
type: "StoredQuery";
id: string;
};
export type InitRequestBody = {
query: string | InitQuery;
variables: ObjectValue;
sdkType: SdkType;
sdkVersion: string;
};
export type GraphqlRequestBody = {
query: string;
variables?: ObjectValue;
schemaVersion?: string;
};
export type SchemaRequestBody = {
schemaVersion?: string;
optionalInputTypes?: boolean;
introspection?: boolean;
};
export type CodegenFile = {
name: string;
content: string;
};
export type CodegenResponseBody = {
files: CodegenFile[];
messages: Message[];
/** @deprecated */
code?: string;
/** @deprecated */
frameworkCode?: string;
};
export type InitData = {
commitId: number;
hash: string;
reducedExpression: Expression;
splits: SplitMap;
commitConfig: CommitConfig;
};
export type HashData = {
commitId: number;
hash: string;
};
export type Step = GetFieldStep | GetItemStep;
type GetFieldStep = {
type: "GetFieldStep";
fieldName: string;
fieldArguments: ObjectValue;
};
type GetItemStep = {
type: "GetItemStep";
index: number;
fallbackLength: number;
};
export type UpdateTrigger = "initDataProvider" | "hydration" | "override";
export type UpdateListener = (newStateHash: string, // TODO: move into metadata in the next major release.
metadata: {
becameReady: boolean;
updateTrigger: UpdateTrigger;
hasUpdated: boolean;
}) => void;
export type TracedFetch = (traceId: string, url: string, requestInit: Omit<RequestInit, "headers"> & {
headers: Record<string, string>;
}) => Promise<Response>;
export type InitDataProvider = {
getName: () => string;
getInitData: GetInitDataFunction;
getHashData?: GetHashDataFunction;
};
export type GetInitDataFunction = (args: {
traceId: string;
initQuery: InitQuery;
variableValues: ObjectValue;
}) => Promise<InitData>;
export type GetHashDataFunction = (args: {
traceId: string;
initQuery: InitQuery;
variableValues: ObjectValue;
}) => Promise<HashData>;
/**
* `CreateOptions` contains options used to create the Hypertune source. Options
* with generated types are defined in your generated code.
*/
export type CreateOptions = {
/**
* `branchName` specifies a Hypertune branch to initialize from.
* This is useful for testing significant logic and schema changes, especially
* breaking schema changes, as different schema versions can be served at the
* same time on different branches during a migration.
*/
branchName?: string;
/**
* `initData` specifies initial `InitData` for the SDK, allowing it to be used
* immediately. This can be supplied via a static build-time snapshot in your
* generated client, via hydration or even manually (e.g. in unit tests).
*/
initData?: InitData;
/**
* `initDataProvider` specifies where the SDK should fetch its data from.
*
* - When set to `null` the SDK won't fetch any initialization data, relying
* only on a build-time snapshot in your generated client or hydration.
* - When set to `undefined` it will default to
* `HypertuneEdgeInitDataProvider`.
* - For initialization from Vercel Edge Config, set this to a new instance of
* `VercelEdgeConfigInitDataProvider`.
*
* @default HypertuneEdgeInitDataProvider
*/
initDataProvider?: InitDataProvider | null;
/**
* `lastInitDataRefreshTime` is a timestamp specifying the last time
* the provided `initData` was last checked for freshness using an
* `InitDataProvider`. It is ignored when no `initData` was provided.
*/
lastInitDataRefreshTime?: number | null;
/**
* `initDataRefreshIntervalMs` specifies the interval, in milliseconds, at
* which the SDK checks for updates. The minimum allowed value is 1000ms.
*
* - When `initIfNeeded` is called, the SDK will make an initialization
* request only if the last initialization occurred at least this interval
* ago.
*
* - When `shouldRefreshInitData` is `true`, this value controls how often the
* SDK checks for updates in the background.
*
* - When `initDataProvider` is null, the SDK will never check for updates.
*
* @default 2000
*/
initDataRefreshIntervalMs?: number;
/**
* `shouldRefreshInitData` specifies whether the SDK checks for flag updates
* in the background. The frequency of checks is controlled by the
* `initDataRefreshIntervalMs` option.
*
* When `initDataProvider` is `null` the SDK will never check for updates.
*
* @default true (false when using VercelEdgeConfigInitDataProvider)
*/
shouldRefreshInitData?: boolean;
/**
* `shouldRefreshInitDataOnCreate` specifies whether the SDK should
* initialize from `initDataProvider` on creation.
*
* When `initDataProvider` is `null` the SDK will never check for updates.
*
* @default true (false when using VercelEdgeConfigInitDataProvider)
*/
shouldRefreshInitDataOnCreate?: boolean;
/**
* shouldSkipInitDataUpdateOnRefresh controls whether the SDK skips fetching
* and updating its internal state when it detects a new commit exists. It
* still triggers an update notification. This is useful for clients that
* hydrate from their own servers.
*
* @default false
*/
shouldSkipInitDataUpdateOnRefresh?: boolean;
/**
* cacheSize controls the size of internal SDK caches.
*
* Setting it to 0 disables caching.
*
* @default 250
*/
cacheSize?: number;
remoteLogging?: {
/**
* `mode` determines how log messages, expression evaluations, split
* exposures and analytics events are sent to the remote server.
*
* - When set to "normal", all data is sent to the remote server.
*
* - When set to "off", no data is sent to the remote server. This is useful
* in development and test environments.
*
* - When set to "session", log messages, expression evaluations and
* split exposures are deduplicated per session, based on the provided
* context. However, all analytics events are still sent to the remote
* server.
*
* @default "normal" ("session" when the SDK is used in the browser)
*/
mode?: RemoteLoggingMode;
/**
* `endpointUrl` allows you to send SDK log messages, expression
* evaluations, split exposures and analytics events to your own server. You
* can then forward them to Hypertune Edge or other analytics or
* observability systems.
*
* @default https://gcp.fasthorse.workers.dev/logs
*/
endpointUrl?: string;
/**
* `flushIntervalMs` specifies the interval, in milliseconds, at which the
* SDK flushes logs to the remote server. The minimum allowed value is
* 1000ms.
*
* When set to `null`, the SDK will never automatically flush logs, so you
* you will need to flush logs manually using the `flushLogs` method.
*
* When `mode` is set to "off" the SDK will never automatically flush logs.
*
* @default 2000
*/
flushIntervalMs?: number | null;
};
/**
* @deprecated use `logsHandler` instead
*/
localLogger?: LocalLogger;
/**
* By default, all message logs with level `Info` or higher are logged to the
* console.
*
* You can set a `logsHandler` to handle logs yourself and override this
* behavior, e.g. by logging `Debug` logs to the console too or forwarding
* logs, including flag evaluations, analytics events and split exposures to
* other analytics or observability systems.
*/
logsHandler?: LogsHandler;
/**
* @deprecated Use `shouldRefreshInitData` instead.
*/
shouldCheckForUpdates?: boolean;
/**
* @deprecated Use `lastInitDataRefreshTime` instead.
*/
lastDataProviderInitTime?: number | null;
/**
* @deprecated Use `initDataRefreshIntervalMs` and `shouldCheckForUpdates`
* instead.
*/
initIntervalMs?: number;
};
export type RemoteLoggingMode = "normal" | "off" | "session";
export type LocalLogger = (level: LogLevel, message: string, metadata: object) => void;
export type DehydratedState<TOverride extends object, TVariableValues extends ObjectValue> = {
initData: InitData;
lastInitDataRefreshTime: number | null;
override: DeepPartial<TOverride> | null;
variableValues: TVariableValues;
};
export type DeepPartial<T> = (T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T) | undefined;
export type CreateLogsInput = {
evaluations: EvaluationCountInput[];
events: EventInput[];
exposures: ExposureInput[];
idempotencyKey: string;
logs: LogInput[];
token: string;
};
export type LogInput = {
commitId?: string | null;
/** A JSON formatted Date string */
createdAt: string;
level: LogLevel;
message: string;
/** JSON object containing metadata relating to the log */
metadataJson: string;
type: LogType;
};
export declare enum LogLevel {
Debug = "Debug",
Error = "Error",
Info = "Info",
Warn = "Warn"
}
export declare enum LogType {
/** Codegen requests handled by Hypertune Edge */
Codegen = "Codegen",
/** GraphQL requests handled by Hypertune Edge */
GraphQl = "GraphQL",
/** Init requests handled by Hypertune Edge */
Init = "Init",
/** JS requests handled by Hypertune Edge */
Js = "JS",
/** SDK logs that aren't related to a specific Node */
SdkMessage = "SDKMessage",
/** SDK logs related to a specific Node */
SdkNode = "SDKNode",
/** Schema requests handled by Hypertune Edge */
Schema = "Schema"
}
export type EvaluationCountInput = {
commitId: string;
count: number;
expressionId: string;
};
export type EventInput = {
commitId: string;
createdAt: string;
eventObjectTypeName?: string | null;
eventPayloadJson?: string | null;
eventTypeId?: string | null;
unitId?: string | null;
};
export type ExposureInput = {
assignment: AssignmentInput[];
commitId: string;
createdAt: string;
eventObjectTypeName?: string | null;
eventPayloadJson?: string | null;
splitId: string;
unitId: string;
};
export type AssignmentInput = {
continuousValue?: number | null;
dimensionId: string;
discreteArmId?: string | null;
entryType: DimensionType;
};
export declare enum DimensionType {
Continuous = "Continuous",
Discrete = "Discrete"
}
export {};
//# sourceMappingURL=types.d.ts.map