UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

501 lines 20.2 kB
import * as z from "zod/v3"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export declare const MetricType: { readonly Count: "count"; readonly Currency: "currency"; readonly Percentage: "percentage"; }; export type MetricType = ClosedEnum<typeof MetricType>; export declare const MetricUnit: { readonly Session: "session"; readonly User: "user"; readonly Visitor: "visitor"; }; export type MetricUnit = ClosedEnum<typeof MetricUnit>; export declare const Directionality: { readonly DecreaseIsGood: "decreaseIsGood"; readonly IncreaseIsGood: "increaseIsGood"; }; export type Directionality = ClosedEnum<typeof Directionality>; export type GuardrailMetrics = { description?: string | undefined; metricFormula?: string | undefined; name: string; metricType: MetricType; metricUnit: MetricUnit; directionality: Directionality; }; export declare const Device: { readonly Android: "android"; readonly Desktop: "desktop"; readonly Ios: "ios"; readonly Mweb: "mweb"; }; export type Device = ClosedEnum<typeof Device>; export declare const DurationUnit: { readonly Days: "days"; readonly Exposures: "exposures"; }; export type DurationUnit = ClosedEnum<typeof DurationUnit>; export declare const AllocationUnit: { readonly CookieId: "cookieId"; readonly UserId: "userId"; readonly VisitorId: "visitorId"; }; export type AllocationUnit = ClosedEnum<typeof AllocationUnit>; export declare const FlagMetricType: { readonly Count: "count"; readonly Currency: "currency"; readonly Percentage: "percentage"; }; export type FlagMetricType = ClosedEnum<typeof FlagMetricType>; export declare const FlagMetricUnit: { readonly Session: "session"; readonly User: "user"; readonly Visitor: "visitor"; }; export type FlagMetricUnit = ClosedEnum<typeof FlagMetricUnit>; export declare const FlagDirectionality: { readonly DecreaseIsGood: "decreaseIsGood"; readonly IncreaseIsGood: "increaseIsGood"; }; export type FlagDirectionality = ClosedEnum<typeof FlagDirectionality>; export type PrimaryMetrics = { description?: string | undefined; metricFormula?: string | undefined; name: string; metricType: FlagMetricType; metricUnit: FlagMetricUnit; directionality: FlagDirectionality; }; export declare const FlagStatus: { readonly Closed: "closed"; readonly Draft: "draft"; readonly Paused: "paused"; readonly Running: "running"; }; export type FlagStatus = ClosedEnum<typeof FlagStatus>; export type Experiment = { id?: string | undefined; name?: string | undefined; numVariants?: number | undefined; surfaceArea?: string | undefined; stickyRequirement?: boolean | undefined; layer?: string | undefined; guardrailMetrics?: Array<GuardrailMetrics> | undefined; hypothesis?: string | undefined; device?: Device | undefined; controlVariantId?: string | undefined; startedAt?: number | undefined; endedAt?: number | undefined; decision?: string | undefined; decisionReason?: string | undefined; duration?: number | undefined; durationUnit?: DurationUnit | undefined; allocationPercent?: number | undefined; allocationUnit: AllocationUnit; primaryMetrics: Array<PrimaryMetrics>; status: FlagStatus; }; export type Variants = {}; export type Reuse = { active: boolean; environment: string; }; export type Targets = { note?: string | undefined; value: string; }; export declare const FlagType: { readonly Variant: "variant"; }; export type FlagType = ClosedEnum<typeof FlagType>; export type PausedOutcome = { type: FlagType; variantId: string; }; export declare const FlagFallthroughEnvironments3Type: { readonly Entity: "entity"; }; export type FlagFallthroughEnvironments3Type = ClosedEnum<typeof FlagFallthroughEnvironments3Type>; export type FallthroughBase = { type: FlagFallthroughEnvironments3Type; kind: string; attribute: string; }; export type Slots = { promille: number; durationMs: number; }; export type Fallthrough3 = { type: "rollout"; base: FallthroughBase; defaultVariantId: string; startTimestamp: number; rollFromVariantId: string; rollToVariantId: string; slots: Array<Slots>; }; export declare const FlagFallthroughEnvironments2Type: { readonly Entity: "entity"; }; export type FlagFallthroughEnvironments2Type = ClosedEnum<typeof FlagFallthroughEnvironments2Type>; export type Base = { type: FlagFallthroughEnvironments2Type; kind: string; attribute: string; }; export type Fallthrough2 = { type: "split"; base: Base; weights: { [k: string]: number; }; defaultVariantId: string; }; export type Fallthrough1 = { type: "variant"; variantId: string; }; export type Fallthrough = Fallthrough1 | Fallthrough2 | Fallthrough3; export declare const FlagOutcomeEnvironmentsRules3Type: { readonly Entity: "entity"; }; export type FlagOutcomeEnvironmentsRules3Type = ClosedEnum<typeof FlagOutcomeEnvironmentsRules3Type>; export type FlagOutcomeBase = { type: FlagOutcomeEnvironmentsRules3Type; kind: string; attribute: string; }; export type OutcomeSlots = { promille: number; durationMs: number; }; export type Outcome3 = { type: "rollout"; base: FlagOutcomeBase; defaultVariantId: string; startTimestamp: number; rollFromVariantId: string; rollToVariantId: string; slots: Array<OutcomeSlots>; }; export declare const FlagOutcomeEnvironmentsRulesType: { readonly Entity: "entity"; }; export type FlagOutcomeEnvironmentsRulesType = ClosedEnum<typeof FlagOutcomeEnvironmentsRulesType>; export type OutcomeBase = { type: FlagOutcomeEnvironmentsRulesType; kind: string; attribute: string; }; export type Outcome2 = { type: "split"; base: OutcomeBase; weights: { [k: string]: number; }; defaultVariantId: string; }; export type Outcome1 = { type: "variant"; variantId: string; }; export type Outcome = Outcome1 | Outcome2 | Outcome3; export declare const FlagRhsType: { readonly Regex: "regex"; }; export type FlagRhsType = ClosedEnum<typeof FlagRhsType>; export type Rhs4 = { type: FlagRhsType; pattern: string; flags: string; }; export declare const RhsType: { readonly List: "list"; readonly ListInline: "list/inline"; }; export type RhsType = ClosedEnum<typeof RhsType>; export type Items2 = { label?: string | undefined; note?: string | undefined; value: string; }; export type Items1 = { label?: string | undefined; note?: string | undefined; value: number; }; export type RhsItems = Items1 | Items2; export type Rhs3 = { type: RhsType; items: Array<Items1 | Items2>; }; export type Rhs = Rhs4 | Rhs3 | string | number | boolean; export type CmpOptions = { ignoreCase?: boolean | undefined; }; export type Lhs2 = { type: "entity"; kind: string; attribute: string; }; export type Lhs1 = { type: "segment"; }; export type Lhs = Lhs1 | Lhs2; export declare const Cmp: { readonly NotContains: "!contains"; readonly NotEndsWith: "!endsWith"; readonly NotEq: "!eq"; readonly NotEx: "!ex"; readonly NotOneOf: "!oneOf"; readonly NotRegex: "!regex"; readonly NotStartsWith: "!startsWith"; readonly After: "after"; readonly Before: "before"; readonly Contains: "contains"; readonly ContainsAllOf: "containsAllOf"; readonly ContainsAnyOf: "containsAnyOf"; readonly ContainsNoneOf: "containsNoneOf"; readonly EndsWith: "endsWith"; readonly Eq: "eq"; readonly Ex: "ex"; readonly Gt: "gt"; readonly Gte: "gte"; readonly Lt: "lt"; readonly Lte: "lte"; readonly OneOf: "oneOf"; readonly Regex: "regex"; readonly StartsWith: "startsWith"; }; export type Cmp = ClosedEnum<typeof Cmp>; export type Conditions = { rhs?: Rhs4 | Rhs3 | string | number | boolean | undefined; cmpOptions?: CmpOptions | undefined; lhs: Lhs1 | Lhs2; cmp: Cmp; }; export type Rules = { id: string; outcome: Outcome1 | Outcome2 | Outcome3; conditions: Array<Conditions>; }; export type Environments = { reuse?: Reuse | undefined; targets?: { [k: string]: { [k: string]: { [k: string]: Array<Targets>; }; }; } | undefined; revision?: number | undefined; pausedOutcome: PausedOutcome; fallthrough: Fallthrough1 | Fallthrough2 | Fallthrough3; active: boolean; rules: Array<Rules>; }; export declare const Kind: { readonly Boolean: "boolean"; readonly Json: "json"; readonly Number: "number"; readonly String: "string"; }; export type Kind = ClosedEnum<typeof Kind>; export declare const State: { readonly Active: "active"; readonly Archived: "archived"; }; export type State = ClosedEnum<typeof State>; export declare const TypeName: { readonly Flag: "flag"; }; export type TypeName = ClosedEnum<typeof TypeName>; export type Creator = { id: string; name: string; }; export type Metadata = { creator?: Creator | undefined; }; export type Flag = { description?: string | undefined; maintainerIds?: Array<string> | undefined; permanent?: boolean | undefined; tags?: Array<string> | undefined; experiment?: Experiment | undefined; variants: Array<Variants>; id: string; environments: { [k: string]: Environments; }; kind: Kind; revision: number; seed: number; state: State; slug: string; createdAt: number; updatedAt: number; createdBy: string; ownerId: string; projectId: string; typeName: TypeName; metadata?: Metadata | undefined; }; /** @internal */ export declare const MetricType$inboundSchema: z.ZodNativeEnum<typeof MetricType>; /** @internal */ export declare const MetricUnit$inboundSchema: z.ZodNativeEnum<typeof MetricUnit>; /** @internal */ export declare const Directionality$inboundSchema: z.ZodNativeEnum<typeof Directionality>; /** @internal */ export declare const GuardrailMetrics$inboundSchema: z.ZodType<GuardrailMetrics, z.ZodTypeDef, unknown>; export declare function guardrailMetricsFromJSON(jsonString: string): SafeParseResult<GuardrailMetrics, SDKValidationError>; /** @internal */ export declare const Device$inboundSchema: z.ZodNativeEnum<typeof Device>; /** @internal */ export declare const DurationUnit$inboundSchema: z.ZodNativeEnum<typeof DurationUnit>; /** @internal */ export declare const AllocationUnit$inboundSchema: z.ZodNativeEnum<typeof AllocationUnit>; /** @internal */ export declare const FlagMetricType$inboundSchema: z.ZodNativeEnum<typeof FlagMetricType>; /** @internal */ export declare const FlagMetricUnit$inboundSchema: z.ZodNativeEnum<typeof FlagMetricUnit>; /** @internal */ export declare const FlagDirectionality$inboundSchema: z.ZodNativeEnum<typeof FlagDirectionality>; /** @internal */ export declare const PrimaryMetrics$inboundSchema: z.ZodType<PrimaryMetrics, z.ZodTypeDef, unknown>; export declare function primaryMetricsFromJSON(jsonString: string): SafeParseResult<PrimaryMetrics, SDKValidationError>; /** @internal */ export declare const FlagStatus$inboundSchema: z.ZodNativeEnum<typeof FlagStatus>; /** @internal */ export declare const Experiment$inboundSchema: z.ZodType<Experiment, z.ZodTypeDef, unknown>; export declare function experimentFromJSON(jsonString: string): SafeParseResult<Experiment, SDKValidationError>; /** @internal */ export declare const Variants$inboundSchema: z.ZodType<Variants, z.ZodTypeDef, unknown>; export declare function variantsFromJSON(jsonString: string): SafeParseResult<Variants, SDKValidationError>; /** @internal */ export declare const Reuse$inboundSchema: z.ZodType<Reuse, z.ZodTypeDef, unknown>; export declare function reuseFromJSON(jsonString: string): SafeParseResult<Reuse, SDKValidationError>; /** @internal */ export declare const Targets$inboundSchema: z.ZodType<Targets, z.ZodTypeDef, unknown>; export declare function targetsFromJSON(jsonString: string): SafeParseResult<Targets, SDKValidationError>; /** @internal */ export declare const FlagType$inboundSchema: z.ZodNativeEnum<typeof FlagType>; /** @internal */ export declare const PausedOutcome$inboundSchema: z.ZodType<PausedOutcome, z.ZodTypeDef, unknown>; export declare function pausedOutcomeFromJSON(jsonString: string): SafeParseResult<PausedOutcome, SDKValidationError>; /** @internal */ export declare const FlagFallthroughEnvironments3Type$inboundSchema: z.ZodNativeEnum<typeof FlagFallthroughEnvironments3Type>; /** @internal */ export declare const FallthroughBase$inboundSchema: z.ZodType<FallthroughBase, z.ZodTypeDef, unknown>; export declare function fallthroughBaseFromJSON(jsonString: string): SafeParseResult<FallthroughBase, SDKValidationError>; /** @internal */ export declare const Slots$inboundSchema: z.ZodType<Slots, z.ZodTypeDef, unknown>; export declare function slotsFromJSON(jsonString: string): SafeParseResult<Slots, SDKValidationError>; /** @internal */ export declare const Fallthrough3$inboundSchema: z.ZodType<Fallthrough3, z.ZodTypeDef, unknown>; export declare function fallthrough3FromJSON(jsonString: string): SafeParseResult<Fallthrough3, SDKValidationError>; /** @internal */ export declare const FlagFallthroughEnvironments2Type$inboundSchema: z.ZodNativeEnum<typeof FlagFallthroughEnvironments2Type>; /** @internal */ export declare const Base$inboundSchema: z.ZodType<Base, z.ZodTypeDef, unknown>; export declare function baseFromJSON(jsonString: string): SafeParseResult<Base, SDKValidationError>; /** @internal */ export declare const Fallthrough2$inboundSchema: z.ZodType<Fallthrough2, z.ZodTypeDef, unknown>; export declare function fallthrough2FromJSON(jsonString: string): SafeParseResult<Fallthrough2, SDKValidationError>; /** @internal */ export declare const Fallthrough1$inboundSchema: z.ZodType<Fallthrough1, z.ZodTypeDef, unknown>; export declare function fallthrough1FromJSON(jsonString: string): SafeParseResult<Fallthrough1, SDKValidationError>; /** @internal */ export declare const Fallthrough$inboundSchema: z.ZodType<Fallthrough, z.ZodTypeDef, unknown>; export declare function fallthroughFromJSON(jsonString: string): SafeParseResult<Fallthrough, SDKValidationError>; /** @internal */ export declare const FlagOutcomeEnvironmentsRules3Type$inboundSchema: z.ZodNativeEnum<typeof FlagOutcomeEnvironmentsRules3Type>; /** @internal */ export declare const FlagOutcomeBase$inboundSchema: z.ZodType<FlagOutcomeBase, z.ZodTypeDef, unknown>; export declare function flagOutcomeBaseFromJSON(jsonString: string): SafeParseResult<FlagOutcomeBase, SDKValidationError>; /** @internal */ export declare const OutcomeSlots$inboundSchema: z.ZodType<OutcomeSlots, z.ZodTypeDef, unknown>; export declare function outcomeSlotsFromJSON(jsonString: string): SafeParseResult<OutcomeSlots, SDKValidationError>; /** @internal */ export declare const Outcome3$inboundSchema: z.ZodType<Outcome3, z.ZodTypeDef, unknown>; export declare function outcome3FromJSON(jsonString: string): SafeParseResult<Outcome3, SDKValidationError>; /** @internal */ export declare const FlagOutcomeEnvironmentsRulesType$inboundSchema: z.ZodNativeEnum<typeof FlagOutcomeEnvironmentsRulesType>; /** @internal */ export declare const OutcomeBase$inboundSchema: z.ZodType<OutcomeBase, z.ZodTypeDef, unknown>; export declare function outcomeBaseFromJSON(jsonString: string): SafeParseResult<OutcomeBase, SDKValidationError>; /** @internal */ export declare const Outcome2$inboundSchema: z.ZodType<Outcome2, z.ZodTypeDef, unknown>; export declare function outcome2FromJSON(jsonString: string): SafeParseResult<Outcome2, SDKValidationError>; /** @internal */ export declare const Outcome1$inboundSchema: z.ZodType<Outcome1, z.ZodTypeDef, unknown>; export declare function outcome1FromJSON(jsonString: string): SafeParseResult<Outcome1, SDKValidationError>; /** @internal */ export declare const Outcome$inboundSchema: z.ZodType<Outcome, z.ZodTypeDef, unknown>; export declare function outcomeFromJSON(jsonString: string): SafeParseResult<Outcome, SDKValidationError>; /** @internal */ export declare const FlagRhsType$inboundSchema: z.ZodNativeEnum<typeof FlagRhsType>; /** @internal */ export declare const Rhs4$inboundSchema: z.ZodType<Rhs4, z.ZodTypeDef, unknown>; export declare function rhs4FromJSON(jsonString: string): SafeParseResult<Rhs4, SDKValidationError>; /** @internal */ export declare const RhsType$inboundSchema: z.ZodNativeEnum<typeof RhsType>; /** @internal */ export declare const Items2$inboundSchema: z.ZodType<Items2, z.ZodTypeDef, unknown>; export declare function items2FromJSON(jsonString: string): SafeParseResult<Items2, SDKValidationError>; /** @internal */ export declare const Items1$inboundSchema: z.ZodType<Items1, z.ZodTypeDef, unknown>; export declare function items1FromJSON(jsonString: string): SafeParseResult<Items1, SDKValidationError>; /** @internal */ export declare const RhsItems$inboundSchema: z.ZodType<RhsItems, z.ZodTypeDef, unknown>; export declare function rhsItemsFromJSON(jsonString: string): SafeParseResult<RhsItems, SDKValidationError>; /** @internal */ export declare const Rhs3$inboundSchema: z.ZodType<Rhs3, z.ZodTypeDef, unknown>; export declare function rhs3FromJSON(jsonString: string): SafeParseResult<Rhs3, SDKValidationError>; /** @internal */ export declare const Rhs$inboundSchema: z.ZodType<Rhs, z.ZodTypeDef, unknown>; export declare function rhsFromJSON(jsonString: string): SafeParseResult<Rhs, SDKValidationError>; /** @internal */ export declare const CmpOptions$inboundSchema: z.ZodType<CmpOptions, z.ZodTypeDef, unknown>; export declare function cmpOptionsFromJSON(jsonString: string): SafeParseResult<CmpOptions, SDKValidationError>; /** @internal */ export declare const Lhs2$inboundSchema: z.ZodType<Lhs2, z.ZodTypeDef, unknown>; export declare function lhs2FromJSON(jsonString: string): SafeParseResult<Lhs2, SDKValidationError>; /** @internal */ export declare const Lhs1$inboundSchema: z.ZodType<Lhs1, z.ZodTypeDef, unknown>; export declare function lhs1FromJSON(jsonString: string): SafeParseResult<Lhs1, SDKValidationError>; /** @internal */ export declare const Lhs$inboundSchema: z.ZodType<Lhs, z.ZodTypeDef, unknown>; export declare function lhsFromJSON(jsonString: string): SafeParseResult<Lhs, SDKValidationError>; /** @internal */ export declare const Cmp$inboundSchema: z.ZodNativeEnum<typeof Cmp>; /** @internal */ export declare const Conditions$inboundSchema: z.ZodType<Conditions, z.ZodTypeDef, unknown>; export declare function conditionsFromJSON(jsonString: string): SafeParseResult<Conditions, SDKValidationError>; /** @internal */ export declare const Rules$inboundSchema: z.ZodType<Rules, z.ZodTypeDef, unknown>; export declare function rulesFromJSON(jsonString: string): SafeParseResult<Rules, SDKValidationError>; /** @internal */ export declare const Environments$inboundSchema: z.ZodType<Environments, z.ZodTypeDef, unknown>; export declare function environmentsFromJSON(jsonString: string): SafeParseResult<Environments, SDKValidationError>; /** @internal */ export declare const Kind$inboundSchema: z.ZodNativeEnum<typeof Kind>; /** @internal */ export declare const State$inboundSchema: z.ZodNativeEnum<typeof State>; /** @internal */ export declare const TypeName$inboundSchema: z.ZodNativeEnum<typeof TypeName>; /** @internal */ export declare const Creator$inboundSchema: z.ZodType<Creator, z.ZodTypeDef, unknown>; export declare function creatorFromJSON(jsonString: string): SafeParseResult<Creator, SDKValidationError>; /** @internal */ export declare const Metadata$inboundSchema: z.ZodType<Metadata, z.ZodTypeDef, unknown>; export declare function metadataFromJSON(jsonString: string): SafeParseResult<Metadata, SDKValidationError>; /** @internal */ export declare const Flag$inboundSchema: z.ZodType<Flag, z.ZodTypeDef, unknown>; export declare function flagFromJSON(jsonString: string): SafeParseResult<Flag, SDKValidationError>; //# sourceMappingURL=flag.d.ts.map