@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>
923 lines • 39.5 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
/**
* The kind of flag
*/
export const CreateFlagKind = {
Boolean: "boolean",
String: "string",
Number: "number",
Json: "json",
};
export const CreateFlagCmp = {
Eq: "eq",
NotEq: "!eq",
OneOf: "oneOf",
NotOneOf: "!oneOf",
ContainsAllOf: "containsAllOf",
ContainsAnyOf: "containsAnyOf",
ContainsNoneOf: "containsNoneOf",
StartsWith: "startsWith",
NotStartsWith: "!startsWith",
EndsWith: "endsWith",
NotEndsWith: "!endsWith",
Contains: "contains",
NotContains: "!contains",
Ex: "ex",
NotEx: "!ex",
Gt: "gt",
Gte: "gte",
Lt: "lt",
Lte: "lte",
Regex: "regex",
NotRegex: "!regex",
Before: "before",
After: "after",
};
export const CreateFlagRhsType = {
ListInline: "list/inline",
List: "list",
};
export const CreateFlagState = {
Active: "active",
Archived: "archived",
};
export const CreateFlagMetricType = {
Count: "count",
Currency: "currency",
Percentage: "percentage",
};
export const CreateFlagMetricUnit = {
Session: "session",
User: "user",
Visitor: "visitor",
};
export const CreateFlagDirectionality = {
DecreaseIsGood: "decreaseIsGood",
IncreaseIsGood: "increaseIsGood",
};
export const CreateFlagDevice = {
Android: "android",
Desktop: "desktop",
Ios: "ios",
Mweb: "mweb",
};
export const CreateFlagDurationUnit = {
Days: "days",
Exposures: "exposures",
};
export const CreateFlagAllocationUnit = {
CookieId: "cookieId",
UserId: "userId",
VisitorId: "visitorId",
};
export const CreateFlagFeatureFlagsMetricType = {
Count: "count",
Currency: "currency",
Percentage: "percentage",
};
export const CreateFlagFeatureFlagsMetricUnit = {
Session: "session",
User: "user",
Visitor: "visitor",
};
export const CreateFlagFeatureFlagsDirectionality = {
DecreaseIsGood: "decreaseIsGood",
IncreaseIsGood: "increaseIsGood",
};
export const CreateFlagStatus = {
Closed: "closed",
Draft: "draft",
Paused: "paused",
Running: "running",
};
export const CreateFlagType = {
Variant: "variant",
};
export const CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType = {
Entity: "entity",
};
export const CreateFlagFallthroughFeatureFlagsResponse201Type = {
Entity: "entity",
};
export const CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType = {
Entity: "entity",
};
export const CreateFlagOutcomeFeatureFlagsResponse201Type = {
Entity: "entity",
};
export const CreateFlagRhsFeatureFlagsResponseType = {
Regex: "regex",
};
export const CreateFlagRhsFeatureFlagsType = {
List: "list",
ListInline: "list/inline",
};
export const CreateFlagFeatureFlagsCmp = {
NotContains: "!contains",
NotEndsWith: "!endsWith",
NotEq: "!eq",
NotEx: "!ex",
NotOneOf: "!oneOf",
NotRegex: "!regex",
NotStartsWith: "!startsWith",
After: "after",
Before: "before",
Contains: "contains",
ContainsAllOf: "containsAllOf",
ContainsAnyOf: "containsAnyOf",
ContainsNoneOf: "containsNoneOf",
EndsWith: "endsWith",
Eq: "eq",
Ex: "ex",
Gt: "gt",
Gte: "gte",
Lt: "lt",
Lte: "lte",
OneOf: "oneOf",
Regex: "regex",
StartsWith: "startsWith",
};
export const CreateFlagFeatureFlagsKind = {
Boolean: "boolean",
Json: "json",
Number: "number",
String: "string",
};
export const CreateFlagFeatureFlagsState = {
Active: "active",
Archived: "archived",
};
export const CreateFlagTypeName = {
Flag: "flag",
};
/** @internal */
export const CreateFlagKind$outboundSchema = z.nativeEnum(CreateFlagKind);
/** @internal */
export const Value4$outboundSchema = z.object({});
export function value4ToJSON(value4) {
return JSON.stringify(Value4$outboundSchema.parse(value4));
}
/** @internal */
export const CreateFlagVariants$outboundSchema = z.object({
id: z.string(),
label: z.string().optional(),
description: z.string().optional(),
value: z.any().optional(),
});
export function createFlagVariantsToJSON(createFlagVariants) {
return JSON.stringify(CreateFlagVariants$outboundSchema.parse(createFlagVariants));
}
/** @internal */
export const CreateFlagReuse$outboundSchema = z.object({
active: z.boolean(),
environment: z.string(),
});
export function createFlagReuseToJSON(createFlagReuse) {
return JSON.stringify(CreateFlagReuse$outboundSchema.parse(createFlagReuse));
}
/** @internal */
export const CreateFlagTargets$outboundSchema = z.object({
note: z.string().optional(),
value: z.string(),
});
export function createFlagTargetsToJSON(createFlagTargets) {
return JSON.stringify(CreateFlagTargets$outboundSchema.parse(createFlagTargets));
}
/** @internal */
export const CreateFlagPausedOutcome$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagPausedOutcomeToJSON(createFlagPausedOutcome) {
return JSON.stringify(CreateFlagPausedOutcome$outboundSchema.parse(createFlagPausedOutcome));
}
/** @internal */
export const CreateFlagLhs2$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagLhs2ToJSON(createFlagLhs2) {
return JSON.stringify(CreateFlagLhs2$outboundSchema.parse(createFlagLhs2));
}
/** @internal */
export const CreateFlagLhs1$outboundSchema = z.object({
type: z.any().optional(),
});
export function createFlagLhs1ToJSON(createFlagLhs1) {
return JSON.stringify(CreateFlagLhs1$outboundSchema.parse(createFlagLhs1));
}
/** @internal */
export const CreateFlagLhs$outboundSchema = smartUnion([
z.lazy(() => CreateFlagLhs2$outboundSchema),
z.lazy(() => CreateFlagLhs1$outboundSchema),
]);
export function createFlagLhsToJSON(createFlagLhs) {
return JSON.stringify(CreateFlagLhs$outboundSchema.parse(createFlagLhs));
}
/** @internal */
export const CreateFlagCmp$outboundSchema = z.nativeEnum(CreateFlagCmp);
/** @internal */
export const Rhs2$outboundSchema = z.object({
type: z.any().optional(),
pattern: z.string(),
flags: z.string(),
});
export function rhs2ToJSON(rhs2) {
return JSON.stringify(Rhs2$outboundSchema.parse(rhs2));
}
/** @internal */
export const CreateFlagRhsType$outboundSchema = z.nativeEnum(CreateFlagRhsType);
/** @internal */
export const CreateFlagItems2$outboundSchema = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.string(),
});
export function createFlagItems2ToJSON(createFlagItems2) {
return JSON.stringify(CreateFlagItems2$outboundSchema.parse(createFlagItems2));
}
/** @internal */
export const CreateFlagItems1$outboundSchema = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.number(),
});
export function createFlagItems1ToJSON(createFlagItems1) {
return JSON.stringify(CreateFlagItems1$outboundSchema.parse(createFlagItems1));
}
/** @internal */
export const CreateFlagRhsItems$outboundSchema = smartUnion([
z.lazy(() => CreateFlagItems1$outboundSchema),
z.lazy(() => CreateFlagItems2$outboundSchema),
]);
export function createFlagRhsItemsToJSON(createFlagRhsItems) {
return JSON.stringify(CreateFlagRhsItems$outboundSchema.parse(createFlagRhsItems));
}
/** @internal */
export const Rhs1$outboundSchema = z.object({
type: CreateFlagRhsType$outboundSchema,
items: z.array(smartUnion([
z.lazy(() => CreateFlagItems1$outboundSchema),
z.lazy(() => CreateFlagItems2$outboundSchema),
])),
});
export function rhs1ToJSON(rhs1) {
return JSON.stringify(Rhs1$outboundSchema.parse(rhs1));
}
/** @internal */
export const CreateFlagRhs$outboundSchema = smartUnion([
z.lazy(() => Rhs2$outboundSchema),
z.lazy(() => Rhs1$outboundSchema),
z.string(),
z.number(),
z.boolean(),
]);
export function createFlagRhsToJSON(createFlagRhs) {
return JSON.stringify(CreateFlagRhs$outboundSchema.parse(createFlagRhs));
}
/** @internal */
export const CreateFlagCmpOptions$outboundSchema = z.object({
ignoreCase: z.boolean().optional(),
});
export function createFlagCmpOptionsToJSON(createFlagCmpOptions) {
return JSON.stringify(CreateFlagCmpOptions$outboundSchema.parse(createFlagCmpOptions));
}
/** @internal */
export const CreateFlagConditions$outboundSchema = z.object({
lhs: smartUnion([
z.lazy(() => CreateFlagLhs2$outboundSchema),
z.lazy(() => CreateFlagLhs1$outboundSchema),
]),
cmp: CreateFlagCmp$outboundSchema,
rhs: smartUnion([
z.lazy(() => Rhs2$outboundSchema),
z.lazy(() => Rhs1$outboundSchema),
z.string(),
z.number(),
z.boolean(),
]).optional(),
cmpOptions: z.lazy(() => CreateFlagCmpOptions$outboundSchema).optional(),
});
export function createFlagConditionsToJSON(createFlagConditions) {
return JSON.stringify(CreateFlagConditions$outboundSchema.parse(createFlagConditions));
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagOutcomeFeatureFlagsBaseToJSON(createFlagOutcomeFeatureFlagsBase) {
return JSON.stringify(CreateFlagOutcomeFeatureFlagsBase$outboundSchema.parse(createFlagOutcomeFeatureFlagsBase));
}
/** @internal */
export const CreateFlagOutcomeSlots$outboundSchema = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function createFlagOutcomeSlotsToJSON(createFlagOutcomeSlots) {
return JSON.stringify(CreateFlagOutcomeSlots$outboundSchema.parse(createFlagOutcomeSlots));
}
/** @internal */
export const CreateFlagOutcome3$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagOutcomeFeatureFlagsBase$outboundSchema),
startTimestamp: z.number(),
rollFromVariantId: z.string(),
rollToVariantId: z.string(),
defaultVariantId: z.string(),
slots: z.array(z.lazy(() => CreateFlagOutcomeSlots$outboundSchema)),
});
export function createFlagOutcome3ToJSON(createFlagOutcome3) {
return JSON.stringify(CreateFlagOutcome3$outboundSchema.parse(createFlagOutcome3));
}
/** @internal */
export const CreateFlagOutcomeBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagOutcomeBaseToJSON(createFlagOutcomeBase) {
return JSON.stringify(CreateFlagOutcomeBase$outboundSchema.parse(createFlagOutcomeBase));
}
/** @internal */
export const CreateFlagOutcome2$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagOutcomeBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function createFlagOutcome2ToJSON(createFlagOutcome2) {
return JSON.stringify(CreateFlagOutcome2$outboundSchema.parse(createFlagOutcome2));
}
/** @internal */
export const CreateFlagOutcome1$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagOutcome1ToJSON(createFlagOutcome1) {
return JSON.stringify(CreateFlagOutcome1$outboundSchema.parse(createFlagOutcome1));
}
/** @internal */
export const CreateFlagOutcome$outboundSchema = smartUnion([
z.lazy(() => CreateFlagOutcome3$outboundSchema),
z.lazy(() => CreateFlagOutcome2$outboundSchema),
z.lazy(() => CreateFlagOutcome1$outboundSchema),
]);
export function createFlagOutcomeToJSON(createFlagOutcome) {
return JSON.stringify(CreateFlagOutcome$outboundSchema.parse(createFlagOutcome));
}
/** @internal */
export const CreateFlagRules$outboundSchema = z.object({
id: z.string(),
conditions: z.array(z.lazy(() => CreateFlagConditions$outboundSchema)),
outcome: smartUnion([
z.lazy(() => CreateFlagOutcome3$outboundSchema),
z.lazy(() => CreateFlagOutcome2$outboundSchema),
z.lazy(() => CreateFlagOutcome1$outboundSchema),
]),
});
export function createFlagRulesToJSON(createFlagRules) {
return JSON.stringify(CreateFlagRules$outboundSchema.parse(createFlagRules));
}
/** @internal */
export const CreateFlagFallthroughFeatureFlagsBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagFallthroughFeatureFlagsBaseToJSON(createFlagFallthroughFeatureFlagsBase) {
return JSON.stringify(CreateFlagFallthroughFeatureFlagsBase$outboundSchema.parse(createFlagFallthroughFeatureFlagsBase));
}
/** @internal */
export const FallthroughSlots$outboundSchema = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function fallthroughSlotsToJSON(fallthroughSlots) {
return JSON.stringify(FallthroughSlots$outboundSchema.parse(fallthroughSlots));
}
/** @internal */
export const CreateFlagFallthrough3$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagFallthroughFeatureFlagsBase$outboundSchema),
startTimestamp: z.number(),
rollFromVariantId: z.string(),
rollToVariantId: z.string(),
defaultVariantId: z.string(),
slots: z.array(z.lazy(() => FallthroughSlots$outboundSchema)),
});
export function createFlagFallthrough3ToJSON(createFlagFallthrough3) {
return JSON.stringify(CreateFlagFallthrough3$outboundSchema.parse(createFlagFallthrough3));
}
/** @internal */
export const CreateFlagFallthroughBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagFallthroughBaseToJSON(createFlagFallthroughBase) {
return JSON.stringify(CreateFlagFallthroughBase$outboundSchema.parse(createFlagFallthroughBase));
}
/** @internal */
export const CreateFlagFallthrough2$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagFallthroughBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function createFlagFallthrough2ToJSON(createFlagFallthrough2) {
return JSON.stringify(CreateFlagFallthrough2$outboundSchema.parse(createFlagFallthrough2));
}
/** @internal */
export const CreateFlagFallthrough1$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagFallthrough1ToJSON(createFlagFallthrough1) {
return JSON.stringify(CreateFlagFallthrough1$outboundSchema.parse(createFlagFallthrough1));
}
/** @internal */
export const CreateFlagFallthrough$outboundSchema = smartUnion([
z.lazy(() => CreateFlagFallthrough3$outboundSchema),
z.lazy(() => CreateFlagFallthrough2$outboundSchema),
z.lazy(() => CreateFlagFallthrough1$outboundSchema),
]);
export function createFlagFallthroughToJSON(createFlagFallthrough) {
return JSON.stringify(CreateFlagFallthrough$outboundSchema.parse(createFlagFallthrough));
}
/** @internal */
export const CreateFlagEnvironments$outboundSchema = z.object({
active: z.boolean(),
reuse: z.lazy(() => CreateFlagReuse$outboundSchema).optional(),
targets: z.record(z.record(z.record(z.array(z.lazy(() => CreateFlagTargets$outboundSchema))))).optional(),
pausedOutcome: z.lazy(() => CreateFlagPausedOutcome$outboundSchema),
rules: z.array(z.lazy(() => CreateFlagRules$outboundSchema)),
fallthrough: smartUnion([
z.lazy(() => CreateFlagFallthrough3$outboundSchema),
z.lazy(() => CreateFlagFallthrough2$outboundSchema),
z.lazy(() => CreateFlagFallthrough1$outboundSchema),
]),
revision: z.number().optional(),
});
export function createFlagEnvironmentsToJSON(createFlagEnvironments) {
return JSON.stringify(CreateFlagEnvironments$outboundSchema.parse(createFlagEnvironments));
}
/** @internal */
export const CreateFlagState$outboundSchema = z.nativeEnum(CreateFlagState);
/** @internal */
export const CreateFlagRequestBody$outboundSchema = z.object({
slug: z.string(),
kind: CreateFlagKind$outboundSchema,
variants: z.array(z.lazy(() => CreateFlagVariants$outboundSchema)).optional(),
environments: z.record(z.lazy(() => CreateFlagEnvironments$outboundSchema)),
seed: z.number().optional(),
description: z.string().optional(),
state: CreateFlagState$outboundSchema.optional(),
maintainerIds: z.array(z.string()).optional(),
permanent: z.boolean().optional(),
tags: z.array(z.string()).optional(),
});
export function createFlagRequestBodyToJSON(createFlagRequestBody) {
return JSON.stringify(CreateFlagRequestBody$outboundSchema.parse(createFlagRequestBody));
}
/** @internal */
export const CreateFlagRequest$outboundSchema = z.object({
projectIdOrName: z.string(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => CreateFlagRequestBody$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function createFlagRequestToJSON(createFlagRequest) {
return JSON.stringify(CreateFlagRequest$outboundSchema.parse(createFlagRequest));
}
/** @internal */
export const CreateFlagMetricType$inboundSchema = z.nativeEnum(CreateFlagMetricType);
/** @internal */
export const CreateFlagMetricUnit$inboundSchema = z.nativeEnum(CreateFlagMetricUnit);
/** @internal */
export const CreateFlagDirectionality$inboundSchema = z.nativeEnum(CreateFlagDirectionality);
/** @internal */
export const CreateFlagGuardrailMetrics$inboundSchema = z.object({
description: types.optional(types.string()),
metricFormula: types.optional(types.string()),
name: types.string(),
metricType: CreateFlagMetricType$inboundSchema,
metricUnit: CreateFlagMetricUnit$inboundSchema,
directionality: CreateFlagDirectionality$inboundSchema,
});
export function createFlagGuardrailMetricsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagGuardrailMetrics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagGuardrailMetrics' from JSON`);
}
/** @internal */
export const CreateFlagDevice$inboundSchema = z.nativeEnum(CreateFlagDevice);
/** @internal */
export const CreateFlagDurationUnit$inboundSchema = z.nativeEnum(CreateFlagDurationUnit);
/** @internal */
export const CreateFlagAllocationUnit$inboundSchema = z.nativeEnum(CreateFlagAllocationUnit);
/** @internal */
export const CreateFlagFeatureFlagsMetricType$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsMetricType);
/** @internal */
export const CreateFlagFeatureFlagsMetricUnit$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsMetricUnit);
/** @internal */
export const CreateFlagFeatureFlagsDirectionality$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsDirectionality);
/** @internal */
export const CreateFlagPrimaryMetrics$inboundSchema = z.object({
description: types.optional(types.string()),
metricFormula: types.optional(types.string()),
name: types.string(),
metricType: CreateFlagFeatureFlagsMetricType$inboundSchema,
metricUnit: CreateFlagFeatureFlagsMetricUnit$inboundSchema,
directionality: CreateFlagFeatureFlagsDirectionality$inboundSchema,
});
export function createFlagPrimaryMetricsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagPrimaryMetrics$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagPrimaryMetrics' from JSON`);
}
/** @internal */
export const CreateFlagStatus$inboundSchema = z.nativeEnum(CreateFlagStatus);
/** @internal */
export const CreateFlagExperiment$inboundSchema = z.object({
id: types.optional(types.string()),
name: types.optional(types.string()),
numVariants: types.optional(types.number()),
surfaceArea: types.optional(types.string()),
stickyRequirement: types.optional(types.boolean()),
layer: types.optional(types.string()),
guardrailMetrics: types.optional(z.array(z.lazy(() => CreateFlagGuardrailMetrics$inboundSchema))),
hypothesis: types.optional(types.string()),
device: types.optional(CreateFlagDevice$inboundSchema),
controlVariantId: types.optional(types.string()),
startedAt: types.optional(types.number()),
endedAt: types.optional(types.number()),
decision: types.optional(types.string()),
decisionReason: types.optional(types.string()),
duration: types.optional(types.number()),
durationUnit: types.optional(CreateFlagDurationUnit$inboundSchema),
allocationPercent: types.optional(types.number()),
allocationUnit: CreateFlagAllocationUnit$inboundSchema,
primaryMetrics: z.array(z.lazy(() => CreateFlagPrimaryMetrics$inboundSchema)),
status: CreateFlagStatus$inboundSchema,
});
export function createFlagExperimentFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagExperiment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagExperiment' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsVariants$inboundSchema = z.object({});
export function createFlagFeatureFlagsVariantsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsVariants$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsVariants' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsReuse$inboundSchema = z.object({
active: types.boolean(),
environment: types.string(),
});
export function createFlagFeatureFlagsReuseFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsReuse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsReuse' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsTargets$inboundSchema = z.object({
note: types.optional(types.string()),
value: types.string(),
});
export function createFlagFeatureFlagsTargetsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsTargets$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsTargets' from JSON`);
}
/** @internal */
export const CreateFlagType$inboundSchema = z.nativeEnum(CreateFlagType);
/** @internal */
export const CreateFlagFeatureFlagsPausedOutcome$inboundSchema = z.object({
type: CreateFlagType$inboundSchema,
variantId: types.string(),
});
export function createFlagFeatureFlagsPausedOutcomeFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsPausedOutcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsPausedOutcome' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType$inboundSchema = z.nativeEnum(CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType);
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201Base$inboundSchema = z.object({
type: CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagFallthroughFeatureFlagsResponse201BaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughFeatureFlagsResponse201Base$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughFeatureFlagsResponse201Base' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughSlots$inboundSchema = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function createFlagFallthroughSlotsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughSlots$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughSlots' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags3$inboundSchema = z.object({
type: types.literal("rollout"),
base: z.lazy(() => CreateFlagFallthroughFeatureFlagsResponse201Base$inboundSchema),
defaultVariantId: types.string(),
startTimestamp: types.number(),
rollFromVariantId: types.string(),
rollToVariantId: types.string(),
slots: z.array(z.lazy(() => CreateFlagFallthroughSlots$inboundSchema)),
});
export function createFlagFallthroughFeatureFlags3FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughFeatureFlags3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughFeatureFlags3' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201Type$inboundSchema = z
.nativeEnum(CreateFlagFallthroughFeatureFlagsResponse201Type);
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema = z.object({
type: CreateFlagFallthroughFeatureFlagsResponse201Type$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagFallthroughFeatureFlagsResponseBaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughFeatureFlagsResponseBase' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags2$inboundSchema = z.object({
type: types.literal("split"),
base: z.lazy(() => CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function createFlagFallthroughFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughFeatureFlags2' from JSON`);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags1$inboundSchema = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function createFlagFallthroughFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFallthroughFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFallthroughFeatureFlags1' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsFallthrough$inboundSchema = z.union([
z.lazy(() => CreateFlagFallthroughFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags3$inboundSchema),
]);
export function createFlagFeatureFlagsFallthroughFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsFallthrough$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsFallthrough' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType$inboundSchema = z.nativeEnum(CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType);
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201Base$inboundSchema = z.object({
type: CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagOutcomeFeatureFlagsResponse201BaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlagsResponse201Base$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlagsResponse201Base' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsSlots$inboundSchema = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function createFlagOutcomeFeatureFlagsSlotsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlagsSlots$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlagsSlots' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags3$inboundSchema = z.object({
type: types.literal("rollout"),
base: z.lazy(() => CreateFlagOutcomeFeatureFlagsResponse201Base$inboundSchema),
defaultVariantId: types.string(),
startTimestamp: types.number(),
rollFromVariantId: types.string(),
rollToVariantId: types.string(),
slots: z.array(z.lazy(() => CreateFlagOutcomeFeatureFlagsSlots$inboundSchema)),
});
export function createFlagOutcomeFeatureFlags3FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlags3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlags3' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201Type$inboundSchema = z
.nativeEnum(CreateFlagOutcomeFeatureFlagsResponse201Type);
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema = z.object({
type: CreateFlagOutcomeFeatureFlagsResponse201Type$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagOutcomeFeatureFlagsResponseBaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlagsResponseBase' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags2$inboundSchema = z.object({
type: types.literal("split"),
base: z.lazy(() => CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function createFlagOutcomeFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlags2' from JSON`);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags1$inboundSchema = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function createFlagOutcomeFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagOutcomeFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagOutcomeFeatureFlags1' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsOutcome$inboundSchema = z.union([
z.lazy(() => CreateFlagOutcomeFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags3$inboundSchema),
]);
export function createFlagFeatureFlagsOutcomeFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsOutcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsOutcome' from JSON`);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsResponseType$inboundSchema = z.nativeEnum(CreateFlagRhsFeatureFlagsResponseType);
/** @internal */
export const CreateFlagRhs4$inboundSchema = z.object({
type: CreateFlagRhsFeatureFlagsResponseType$inboundSchema,
pattern: types.string(),
flags: types.string(),
});
export function createFlagRhs4FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagRhs4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagRhs4' from JSON`);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsType$inboundSchema = z.nativeEnum(CreateFlagRhsFeatureFlagsType);
/** @internal */
export const CreateFlagItemsFeatureFlags2$inboundSchema = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.string(),
});
export function createFlagItemsFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagItemsFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagItemsFeatureFlags2' from JSON`);
}
/** @internal */
export const CreateFlagItemsFeatureFlags1$inboundSchema = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.number(),
});
export function createFlagItemsFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagItemsFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagItemsFeatureFlags1' from JSON`);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsItems$inboundSchema = smartUnion([
z.lazy(() => CreateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagItemsFeatureFlags2$inboundSchema),
]);
export function createFlagRhsFeatureFlagsItemsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagRhsFeatureFlagsItems$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagRhsFeatureFlagsItems' from JSON`);
}
/** @internal */
export const CreateFlagRhs3$inboundSchema = z.object({
type: CreateFlagRhsFeatureFlagsType$inboundSchema,
items: z.array(smartUnion([
z.lazy(() => CreateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagItemsFeatureFlags2$inboundSchema),
])),
});
export function createFlagRhs3FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagRhs3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagRhs3' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsRhs$inboundSchema = smartUnion([
z.lazy(() => CreateFlagRhs4$inboundSchema),
z.lazy(() => CreateFlagRhs3$inboundSchema),
types.string(),
types.number(),
types.boolean(),
]);
export function createFlagFeatureFlagsRhsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsRhs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsRhs' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsCmpOptions$inboundSchema = z.object({
ignoreCase: types.optional(types.boolean()),
});
export function createFlagFeatureFlagsCmpOptionsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsCmpOptions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsCmpOptions' from JSON`);
}
/** @internal */
export const CreateFlagLhsFeatureFlags2$inboundSchema = z.object({
type: types.literal("entity"),
kind: types.string(),
attribute: types.string(),
});
export function createFlagLhsFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagLhsFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagLhsFeatureFlags2' from JSON`);
}
/** @internal */
export const CreateFlagLhsFeatureFlags1$inboundSchema = z.object({
type: types.literal("segment"),
});
export function createFlagLhsFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagLhsFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagLhsFeatureFlags1' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsLhs$inboundSchema = z.union([
z.lazy(() => CreateFlagLhsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagLhsFeatureFlags2$inboundSchema),
]);
export function createFlagFeatureFlagsLhsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsLhs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsLhs' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsCmp$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsCmp);
/** @internal */
export const CreateFlagFeatureFlagsConditions$inboundSchema = z.object({
rhs: types.optional(smartUnion([
z.lazy(() => CreateFlagRhs4$inboundSchema),
z.lazy(() => CreateFlagRhs3$inboundSchema),
types.string(),
types.number(),
types.boolean(),
])),
cmpOptions: types.optional(z.lazy(() => CreateFlagFeatureFlagsCmpOptions$inboundSchema)),
lhs: z.union([
z.lazy(() => CreateFlagLhsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagLhsFeatureFlags2$inboundSchema),
]),
cmp: CreateFlagFeatureFlagsCmp$inboundSchema,
});
export function createFlagFeatureFlagsConditionsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsConditions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsConditions' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsRules$inboundSchema = z.object({
id: types.string(),
outcome: z.union([
z.lazy(() => CreateFlagOutcomeFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags3$inboundSchema),
]),
conditions: z.array(z.lazy(() => CreateFlagFeatureFlagsConditions$inboundSchema)),
});
export function createFlagFeatureFlagsRulesFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsRules$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsRules' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsEnvironments$inboundSchema = z.object({
reuse: types.optional(z.lazy(() => CreateFlagFeatureFlagsReuse$inboundSchema)),
targets: types.optional(z.record(z.record(z.record(z.array(z.lazy(() => CreateFlagFeatureFlagsTargets$inboundSchema)))))),
revision: types.optional(types.number()),
pausedOutcome: z.lazy(() => CreateFlagFeatureFlagsPausedOutcome$inboundSchema),
fallthrough: z.union([
z.lazy(() => CreateFlagFallthroughFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags3$inboundSchema),
]),
active: types.boolean(),
rules: z.array(z.lazy(() => CreateFlagFeatureFlagsRules$inboundSchema)),
});
export function createFlagFeatureFlagsEnvironmentsFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagFeatureFlagsEnvironments$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagFeatureFlagsEnvironments' from JSON`);
}
/** @internal */
export const CreateFlagFeatureFlagsKind$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsKind);
/** @internal */
export const CreateFlagFeatureFlagsState$inboundSchema = z.nativeEnum(CreateFlagFeatureFlagsState);
/** @internal */
export const CreateFlagTypeName$inboundSchema = z.nativeEnum(CreateFlagTypeName);
/** @internal */
export const CreateFlagResponseBody$inboundSchema = z.object({
description: types.optional(types.string()),
maintainerIds: types.optional(z.array(types.string())),
permanent: types.optional(types.boolean()),
tags: types.optional(z.array(types.string())),
experiment: types.optional(z.lazy(() => CreateFlagExperiment$inboundSchema)),
variants: z.array(z.lazy(() => CreateFlagFeatureFlagsVariants$inboundSchema)),
id: types.string(),
environments: z.record(z.lazy(() => CreateFlagFeatureFlagsEnvironments$inboundSchema)),
kind: CreateFlagFeatureFlagsKind$inboundSchema,
revision: types.number(),
seed: types.number(),
state: CreateFlagFeatureFlagsState$inboundSchema,
slug: types.string(),
createdAt: types.number(),
updatedAt: types.number(),
createdBy: types.string(),
ownerId: types.string(),
projectId: types.string(),
typeName: CreateFlagTypeName$inboundSchema,
});
export function createFlagResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateFlagResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFlagResponseBody' from JSON`);
}
//# sourceMappingURL=createflagop.js.map