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>

400 lines 16.3 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 type Value = string | number | { [k: string]: any; } | Array<any> | boolean; export type Variants = { description?: string | undefined; label?: string | undefined; value: string | number | { [k: string]: any; } | Array<any> | boolean | null; id: string; }; 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 type Fallthrough4 = { type: "experiment"; }; 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 | Fallthrough4; export type Outcome4 = { type: "experiment"; }; 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 FlagOutcomeEnvironmentsRules2Type: { readonly Entity: "entity"; }; export type FlagOutcomeEnvironmentsRules2Type = ClosedEnum<typeof FlagOutcomeEnvironmentsRules2Type>; export type OutcomeBase = { type: FlagOutcomeEnvironmentsRules2Type; 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 FlagOutcome = Outcome1 | Outcome2 | Outcome3 | Outcome4; 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 | Outcome4; conditions: Array<Conditions>; }; export type FlagEnvironments = { reuse?: Reuse | undefined; targets?: { [k: string]: { [k: string]: { [k: string]: Array<Targets>; }; }; } | undefined; revision?: number | undefined; pausedOutcome: PausedOutcome; fallthrough: Fallthrough1 | Fallthrough2 | Fallthrough3 | Fallthrough4; 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; variants: Array<Variants>; id: string; environments: { [k: string]: FlagEnvironments; }; kind: Kind; revision: number; seed: number; state: State; maintainerIds?: Array<string> | undefined; permanent?: boolean | undefined; tags?: Array<string> | undefined; slug: string; createdAt: number; updatedAt: number; updatedBy?: string | undefined; createdBy: string; ownerId: string; projectId: string; typeName: TypeName; metadata?: Metadata | undefined; }; /** @internal */ export declare const Value$inboundSchema: z.ZodType<Value, z.ZodTypeDef, unknown>; export declare function valueFromJSON(jsonString: string): SafeParseResult<Value, 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 Fallthrough4$inboundSchema: z.ZodType<Fallthrough4, z.ZodTypeDef, unknown>; export declare function fallthrough4FromJSON(jsonString: string): SafeParseResult<Fallthrough4, 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 Outcome4$inboundSchema: z.ZodType<Outcome4, z.ZodTypeDef, unknown>; export declare function outcome4FromJSON(jsonString: string): SafeParseResult<Outcome4, 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 FlagOutcomeEnvironmentsRules2Type$inboundSchema: z.ZodNativeEnum<typeof FlagOutcomeEnvironmentsRules2Type>; /** @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 FlagOutcome$inboundSchema: z.ZodType<FlagOutcome, z.ZodTypeDef, unknown>; export declare function flagOutcomeFromJSON(jsonString: string): SafeParseResult<FlagOutcome, 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 FlagEnvironments$inboundSchema: z.ZodType<FlagEnvironments, z.ZodTypeDef, unknown>; export declare function flagEnvironmentsFromJSON(jsonString: string): SafeParseResult<FlagEnvironments, 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