@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>
844 lines • 36.3 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";
import { Flag$inboundSchema } from "./flag.js";
export const UpdateFlagCmp = {
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 UpdateFlagRhsType = {
ListInline: "list/inline",
List: "list",
};
export const UpdateFlagState = {
Active: "active",
Archived: "archived",
};
export const UpdateFlagResponseBodyType = {
Variant: "variant",
};
export const UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONType = {
Entity: "entity",
};
export const UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONResponseBodyType = {
Entity: "entity",
};
export const UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONType = {
Entity: "entity",
};
export const UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONResponseBodyType = {
Entity: "entity",
};
export const UpdateFlagRhsFeatureFlagsResponseType = {
Regex: "regex",
};
export const UpdateFlagRhsFeatureFlagsType = {
List: "list",
ListInline: "list/inline",
};
export const ResponseBodyCmp = {
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 ResponseBodyKind = {
Boolean: "boolean",
Json: "json",
Number: "number",
String: "string",
};
export const ResponseBodyState = {
Active: "active",
Archived: "archived",
};
export const ResponseBodyTypeName = {
Flag: "flag",
};
/** @internal */
export const UpdateFlagValue4$outboundSchema = z.object({});
export function updateFlagValue4ToJSON(updateFlagValue4) {
return JSON.stringify(UpdateFlagValue4$outboundSchema.parse(updateFlagValue4));
}
/** @internal */
export const UpdateFlagVariants$outboundSchema = z.object({
id: z.string(),
label: z.string().optional(),
description: z.string().optional(),
value: z.any().optional(),
});
export function updateFlagVariantsToJSON(updateFlagVariants) {
return JSON.stringify(UpdateFlagVariants$outboundSchema.parse(updateFlagVariants));
}
/** @internal */
export const UpdateFlagReuse$outboundSchema = z.object({
active: z.boolean(),
environment: z.string(),
});
export function updateFlagReuseToJSON(updateFlagReuse) {
return JSON.stringify(UpdateFlagReuse$outboundSchema.parse(updateFlagReuse));
}
/** @internal */
export const UpdateFlagTargets$outboundSchema = z.object({
note: z.string().optional(),
value: z.string(),
});
export function updateFlagTargetsToJSON(updateFlagTargets) {
return JSON.stringify(UpdateFlagTargets$outboundSchema.parse(updateFlagTargets));
}
/** @internal */
export const UpdateFlagPausedOutcome$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function updateFlagPausedOutcomeToJSON(updateFlagPausedOutcome) {
return JSON.stringify(UpdateFlagPausedOutcome$outboundSchema.parse(updateFlagPausedOutcome));
}
/** @internal */
export const UpdateFlagLhs2$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function updateFlagLhs2ToJSON(updateFlagLhs2) {
return JSON.stringify(UpdateFlagLhs2$outboundSchema.parse(updateFlagLhs2));
}
/** @internal */
export const UpdateFlagLhs1$outboundSchema = z.object({
type: z.any().optional(),
});
export function updateFlagLhs1ToJSON(updateFlagLhs1) {
return JSON.stringify(UpdateFlagLhs1$outboundSchema.parse(updateFlagLhs1));
}
/** @internal */
export const UpdateFlagLhs$outboundSchema = smartUnion([
z.lazy(() => UpdateFlagLhs2$outboundSchema),
z.lazy(() => UpdateFlagLhs1$outboundSchema),
]);
export function updateFlagLhsToJSON(updateFlagLhs) {
return JSON.stringify(UpdateFlagLhs$outboundSchema.parse(updateFlagLhs));
}
/** @internal */
export const UpdateFlagCmp$outboundSchema = z.nativeEnum(UpdateFlagCmp);
/** @internal */
export const UpdateFlagRhs2$outboundSchema = z.object({
type: z.any().optional(),
pattern: z.string(),
flags: z.string(),
});
export function updateFlagRhs2ToJSON(updateFlagRhs2) {
return JSON.stringify(UpdateFlagRhs2$outboundSchema.parse(updateFlagRhs2));
}
/** @internal */
export const UpdateFlagRhsType$outboundSchema = z.nativeEnum(UpdateFlagRhsType);
/** @internal */
export const UpdateFlagItems2$outboundSchema = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.string(),
});
export function updateFlagItems2ToJSON(updateFlagItems2) {
return JSON.stringify(UpdateFlagItems2$outboundSchema.parse(updateFlagItems2));
}
/** @internal */
export const UpdateFlagItems1$outboundSchema = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.number(),
});
export function updateFlagItems1ToJSON(updateFlagItems1) {
return JSON.stringify(UpdateFlagItems1$outboundSchema.parse(updateFlagItems1));
}
/** @internal */
export const UpdateFlagRhsItems$outboundSchema = smartUnion([
z.lazy(() => UpdateFlagItems1$outboundSchema),
z.lazy(() => UpdateFlagItems2$outboundSchema),
]);
export function updateFlagRhsItemsToJSON(updateFlagRhsItems) {
return JSON.stringify(UpdateFlagRhsItems$outboundSchema.parse(updateFlagRhsItems));
}
/** @internal */
export const UpdateFlagRhs1$outboundSchema = z.object({
type: UpdateFlagRhsType$outboundSchema,
items: z.array(smartUnion([
z.lazy(() => UpdateFlagItems1$outboundSchema),
z.lazy(() => UpdateFlagItems2$outboundSchema),
])),
});
export function updateFlagRhs1ToJSON(updateFlagRhs1) {
return JSON.stringify(UpdateFlagRhs1$outboundSchema.parse(updateFlagRhs1));
}
/** @internal */
export const UpdateFlagRhs$outboundSchema = smartUnion([
z.lazy(() => UpdateFlagRhs2$outboundSchema),
z.lazy(() => UpdateFlagRhs1$outboundSchema),
z.string(),
z.number(),
z.boolean(),
]);
export function updateFlagRhsToJSON(updateFlagRhs) {
return JSON.stringify(UpdateFlagRhs$outboundSchema.parse(updateFlagRhs));
}
/** @internal */
export const UpdateFlagCmpOptions$outboundSchema = z.object({
ignoreCase: z.boolean().optional(),
});
export function updateFlagCmpOptionsToJSON(updateFlagCmpOptions) {
return JSON.stringify(UpdateFlagCmpOptions$outboundSchema.parse(updateFlagCmpOptions));
}
/** @internal */
export const UpdateFlagConditions$outboundSchema = z.object({
lhs: smartUnion([
z.lazy(() => UpdateFlagLhs2$outboundSchema),
z.lazy(() => UpdateFlagLhs1$outboundSchema),
]),
cmp: UpdateFlagCmp$outboundSchema,
rhs: smartUnion([
z.lazy(() => UpdateFlagRhs2$outboundSchema),
z.lazy(() => UpdateFlagRhs1$outboundSchema),
z.string(),
z.number(),
z.boolean(),
]).optional(),
cmpOptions: z.lazy(() => UpdateFlagCmpOptions$outboundSchema).optional(),
});
export function updateFlagConditionsToJSON(updateFlagConditions) {
return JSON.stringify(UpdateFlagConditions$outboundSchema.parse(updateFlagConditions));
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function updateFlagOutcomeFeatureFlagsBaseToJSON(updateFlagOutcomeFeatureFlagsBase) {
return JSON.stringify(UpdateFlagOutcomeFeatureFlagsBase$outboundSchema.parse(updateFlagOutcomeFeatureFlagsBase));
}
/** @internal */
export const UpdateFlagOutcomeSlots$outboundSchema = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function updateFlagOutcomeSlotsToJSON(updateFlagOutcomeSlots) {
return JSON.stringify(UpdateFlagOutcomeSlots$outboundSchema.parse(updateFlagOutcomeSlots));
}
/** @internal */
export const UpdateFlagOutcome3$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => UpdateFlagOutcomeFeatureFlagsBase$outboundSchema),
startTimestamp: z.number(),
rollFromVariantId: z.string(),
rollToVariantId: z.string(),
defaultVariantId: z.string(),
slots: z.array(z.lazy(() => UpdateFlagOutcomeSlots$outboundSchema)),
});
export function updateFlagOutcome3ToJSON(updateFlagOutcome3) {
return JSON.stringify(UpdateFlagOutcome3$outboundSchema.parse(updateFlagOutcome3));
}
/** @internal */
export const UpdateFlagOutcomeBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function updateFlagOutcomeBaseToJSON(updateFlagOutcomeBase) {
return JSON.stringify(UpdateFlagOutcomeBase$outboundSchema.parse(updateFlagOutcomeBase));
}
/** @internal */
export const UpdateFlagOutcome2$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => UpdateFlagOutcomeBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function updateFlagOutcome2ToJSON(updateFlagOutcome2) {
return JSON.stringify(UpdateFlagOutcome2$outboundSchema.parse(updateFlagOutcome2));
}
/** @internal */
export const UpdateFlagOutcome1$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function updateFlagOutcome1ToJSON(updateFlagOutcome1) {
return JSON.stringify(UpdateFlagOutcome1$outboundSchema.parse(updateFlagOutcome1));
}
/** @internal */
export const UpdateFlagOutcome$outboundSchema = smartUnion([
z.lazy(() => UpdateFlagOutcome3$outboundSchema),
z.lazy(() => UpdateFlagOutcome2$outboundSchema),
z.lazy(() => UpdateFlagOutcome1$outboundSchema),
]);
export function updateFlagOutcomeToJSON(updateFlagOutcome) {
return JSON.stringify(UpdateFlagOutcome$outboundSchema.parse(updateFlagOutcome));
}
/** @internal */
export const UpdateFlagRules$outboundSchema = z.object({
id: z.string(),
conditions: z.array(z.lazy(() => UpdateFlagConditions$outboundSchema)),
outcome: smartUnion([
z.lazy(() => UpdateFlagOutcome3$outboundSchema),
z.lazy(() => UpdateFlagOutcome2$outboundSchema),
z.lazy(() => UpdateFlagOutcome1$outboundSchema),
]),
});
export function updateFlagRulesToJSON(updateFlagRules) {
return JSON.stringify(UpdateFlagRules$outboundSchema.parse(updateFlagRules));
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function updateFlagFallthroughFeatureFlagsBaseToJSON(updateFlagFallthroughFeatureFlagsBase) {
return JSON.stringify(UpdateFlagFallthroughFeatureFlagsBase$outboundSchema.parse(updateFlagFallthroughFeatureFlagsBase));
}
/** @internal */
export const UpdateFlagFallthroughSlots$outboundSchema = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function updateFlagFallthroughSlotsToJSON(updateFlagFallthroughSlots) {
return JSON.stringify(UpdateFlagFallthroughSlots$outboundSchema.parse(updateFlagFallthroughSlots));
}
/** @internal */
export const UpdateFlagFallthrough3$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => UpdateFlagFallthroughFeatureFlagsBase$outboundSchema),
startTimestamp: z.number(),
rollFromVariantId: z.string(),
rollToVariantId: z.string(),
defaultVariantId: z.string(),
slots: z.array(z.lazy(() => UpdateFlagFallthroughSlots$outboundSchema)),
});
export function updateFlagFallthrough3ToJSON(updateFlagFallthrough3) {
return JSON.stringify(UpdateFlagFallthrough3$outboundSchema.parse(updateFlagFallthrough3));
}
/** @internal */
export const UpdateFlagFallthroughBase$outboundSchema = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function updateFlagFallthroughBaseToJSON(updateFlagFallthroughBase) {
return JSON.stringify(UpdateFlagFallthroughBase$outboundSchema.parse(updateFlagFallthroughBase));
}
/** @internal */
export const UpdateFlagFallthrough2$outboundSchema = z.object({
type: z.any().optional(),
base: z.lazy(() => UpdateFlagFallthroughBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function updateFlagFallthrough2ToJSON(updateFlagFallthrough2) {
return JSON.stringify(UpdateFlagFallthrough2$outboundSchema.parse(updateFlagFallthrough2));
}
/** @internal */
export const UpdateFlagFallthrough1$outboundSchema = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function updateFlagFallthrough1ToJSON(updateFlagFallthrough1) {
return JSON.stringify(UpdateFlagFallthrough1$outboundSchema.parse(updateFlagFallthrough1));
}
/** @internal */
export const UpdateFlagFallthrough$outboundSchema = smartUnion([
z.lazy(() => UpdateFlagFallthrough3$outboundSchema),
z.lazy(() => UpdateFlagFallthrough2$outboundSchema),
z.lazy(() => UpdateFlagFallthrough1$outboundSchema),
]);
export function updateFlagFallthroughToJSON(updateFlagFallthrough) {
return JSON.stringify(UpdateFlagFallthrough$outboundSchema.parse(updateFlagFallthrough));
}
/** @internal */
export const UpdateFlagEnvironments$outboundSchema = z.object({
active: z.boolean(),
reuse: z.lazy(() => UpdateFlagReuse$outboundSchema).optional(),
targets: z.record(z.record(z.record(z.array(z.lazy(() => UpdateFlagTargets$outboundSchema))))).optional(),
pausedOutcome: z.lazy(() => UpdateFlagPausedOutcome$outboundSchema),
rules: z.array(z.lazy(() => UpdateFlagRules$outboundSchema)),
fallthrough: smartUnion([
z.lazy(() => UpdateFlagFallthrough3$outboundSchema),
z.lazy(() => UpdateFlagFallthrough2$outboundSchema),
z.lazy(() => UpdateFlagFallthrough1$outboundSchema),
]),
revision: z.number().optional(),
});
export function updateFlagEnvironmentsToJSON(updateFlagEnvironments) {
return JSON.stringify(UpdateFlagEnvironments$outboundSchema.parse(updateFlagEnvironments));
}
/** @internal */
export const UpdateFlagState$outboundSchema = z.nativeEnum(UpdateFlagState);
/** @internal */
export const UpdateFlagRequestBody$outboundSchema = z.object({
createdBy: z.string().optional(),
message: z.string().optional(),
variants: z.array(z.lazy(() => UpdateFlagVariants$outboundSchema)).optional(),
environments: z.record(z.lazy(() => UpdateFlagEnvironments$outboundSchema))
.optional(),
seed: z.number().optional(),
description: z.string().optional(),
state: UpdateFlagState$outboundSchema.optional(),
maintainerIds: z.array(z.string()).optional(),
permanent: z.boolean().optional(),
tags: z.array(z.string()).optional(),
});
export function updateFlagRequestBodyToJSON(updateFlagRequestBody) {
return JSON.stringify(UpdateFlagRequestBody$outboundSchema.parse(updateFlagRequestBody));
}
/** @internal */
export const UpdateFlagRequest$outboundSchema = z.object({
projectIdOrName: z.string(),
flagIdOrSlug: z.string(),
ifMatch: z.string().optional(),
withMetadata: z.boolean().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => UpdateFlagRequestBody$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function updateFlagRequestToJSON(updateFlagRequest) {
return JSON.stringify(UpdateFlagRequest$outboundSchema.parse(updateFlagRequest));
}
/** @internal */
export const ResponseBodyValue$inboundSchema = smartUnion([
types.string(),
types.number(),
z.record(z.any()),
z.array(z.any()),
types.boolean(),
]);
export function responseBodyValueFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyValue' from JSON`);
}
/** @internal */
export const ResponseBodyVariants$inboundSchema = z.object({
description: types.optional(types.string()),
label: types.optional(types.string()),
value: types.nullable(smartUnion([
types.string(),
types.number(),
z.record(z.any()),
z.array(z.any()),
types.boolean(),
])),
id: types.string(),
});
export function responseBodyVariantsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyVariants$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyVariants' from JSON`);
}
/** @internal */
export const ResponseBodyReuse$inboundSchema = z.object({
active: types.boolean(),
environment: types.string(),
});
export function responseBodyReuseFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyReuse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyReuse' from JSON`);
}
/** @internal */
export const UpdateFlagResponseBodyTargets$inboundSchema = z.object({
note: types.optional(types.string()),
value: types.string(),
});
export function updateFlagResponseBodyTargetsFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagResponseBodyTargets$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagResponseBodyTargets' from JSON`);
}
/** @internal */
export const UpdateFlagResponseBodyType$inboundSchema = z.nativeEnum(UpdateFlagResponseBodyType);
/** @internal */
export const ResponseBodyPausedOutcome$inboundSchema = z.object({
type: UpdateFlagResponseBodyType$inboundSchema,
variantId: types.string(),
});
export function responseBodyPausedOutcomeFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyPausedOutcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyPausedOutcome' from JSON`);
}
/** @internal */
export const UpdateFlagFallthrough4$inboundSchema = z.object({
type: types.literal("experiment"),
});
export function updateFlagFallthrough4FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthrough4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthrough4' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONType$inboundSchema = z.nativeEnum(UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONType);
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsResponse200Base$inboundSchema = z.object({
type: UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function updateFlagFallthroughFeatureFlagsResponse200BaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlagsResponse200Base$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlagsResponse200Base' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsSlots$inboundSchema = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function updateFlagFallthroughFeatureFlagsSlotsFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlagsSlots$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlagsSlots' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlags3$inboundSchema = z.object({
type: types.literal("rollout"),
base: z.lazy(() => UpdateFlagFallthroughFeatureFlagsResponse200Base$inboundSchema),
defaultVariantId: types.string(),
startTimestamp: types.number(),
rollFromVariantId: types.string(),
rollToVariantId: types.string(),
slots: z.array(z.lazy(() => UpdateFlagFallthroughFeatureFlagsSlots$inboundSchema)),
});
export function updateFlagFallthroughFeatureFlags3FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlags3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlags3' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONResponseBodyType$inboundSchema = z.nativeEnum(UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONResponseBodyType);
/** @internal */
export const UpdateFlagFallthroughFeatureFlagsResponseBase$inboundSchema = z.object({
type: UpdateFlagFallthroughFeatureFlagsResponse200ApplicationJSONResponseBodyType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function updateFlagFallthroughFeatureFlagsResponseBaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlagsResponseBase$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlagsResponseBase' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlags2$inboundSchema = z.object({
type: types.literal("split"),
base: z.lazy(() => UpdateFlagFallthroughFeatureFlagsResponseBase$inboundSchema),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function updateFlagFallthroughFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlags2' from JSON`);
}
/** @internal */
export const UpdateFlagFallthroughFeatureFlags1$inboundSchema = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function updateFlagFallthroughFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagFallthroughFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagFallthroughFeatureFlags1' from JSON`);
}
/** @internal */
export const ResponseBodyFallthrough$inboundSchema = z.union([
z.lazy(() => UpdateFlagFallthroughFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagFallthroughFeatureFlags2$inboundSchema),
z.lazy(() => UpdateFlagFallthroughFeatureFlags3$inboundSchema),
z.lazy(() => UpdateFlagFallthrough4$inboundSchema),
]);
export function responseBodyFallthroughFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyFallthrough$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyFallthrough' from JSON`);
}
/** @internal */
export const UpdateFlagOutcome4$inboundSchema = z.object({
type: types.literal("experiment"),
});
export function updateFlagOutcome4FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcome4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcome4' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONType$inboundSchema = z.nativeEnum(UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONType);
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsResponse200Base$inboundSchema = z.object({
type: UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function updateFlagOutcomeFeatureFlagsResponse200BaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlagsResponse200Base$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlagsResponse200Base' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsSlots$inboundSchema = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function updateFlagOutcomeFeatureFlagsSlotsFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlagsSlots$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlagsSlots' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlags3$inboundSchema = z.object({
type: types.literal("rollout"),
base: z.lazy(() => UpdateFlagOutcomeFeatureFlagsResponse200Base$inboundSchema),
defaultVariantId: types.string(),
startTimestamp: types.number(),
rollFromVariantId: types.string(),
rollToVariantId: types.string(),
slots: z.array(z.lazy(() => UpdateFlagOutcomeFeatureFlagsSlots$inboundSchema)),
});
export function updateFlagOutcomeFeatureFlags3FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlags3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlags3' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONResponseBodyType$inboundSchema = z.nativeEnum(UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONResponseBodyType);
/** @internal */
export const UpdateFlagOutcomeFeatureFlagsResponseBase$inboundSchema = z.object({
type: UpdateFlagOutcomeFeatureFlagsResponse200ApplicationJSONResponseBodyType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function updateFlagOutcomeFeatureFlagsResponseBaseFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlagsResponseBase$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlagsResponseBase' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlags2$inboundSchema = z.object({
type: types.literal("split"),
base: z.lazy(() => UpdateFlagOutcomeFeatureFlagsResponseBase$inboundSchema),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function updateFlagOutcomeFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlags2' from JSON`);
}
/** @internal */
export const UpdateFlagOutcomeFeatureFlags1$inboundSchema = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function updateFlagOutcomeFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagOutcomeFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagOutcomeFeatureFlags1' from JSON`);
}
/** @internal */
export const ResponseBodyOutcome$inboundSchema = z.union([
z.lazy(() => UpdateFlagOutcomeFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagOutcomeFeatureFlags2$inboundSchema),
z.lazy(() => UpdateFlagOutcomeFeatureFlags3$inboundSchema),
z.lazy(() => UpdateFlagOutcome4$inboundSchema),
]);
export function responseBodyOutcomeFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyOutcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyOutcome' from JSON`);
}
/** @internal */
export const UpdateFlagRhsFeatureFlagsResponseType$inboundSchema = z.nativeEnum(UpdateFlagRhsFeatureFlagsResponseType);
/** @internal */
export const UpdateFlagRhs4$inboundSchema = z.object({
type: UpdateFlagRhsFeatureFlagsResponseType$inboundSchema,
pattern: types.string(),
flags: types.string(),
});
export function updateFlagRhs4FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagRhs4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagRhs4' from JSON`);
}
/** @internal */
export const UpdateFlagRhsFeatureFlagsType$inboundSchema = z.nativeEnum(UpdateFlagRhsFeatureFlagsType);
/** @internal */
export const UpdateFlagItemsFeatureFlags2$inboundSchema = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.string(),
});
export function updateFlagItemsFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagItemsFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagItemsFeatureFlags2' from JSON`);
}
/** @internal */
export const UpdateFlagItemsFeatureFlags1$inboundSchema = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.number(),
});
export function updateFlagItemsFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagItemsFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagItemsFeatureFlags1' from JSON`);
}
/** @internal */
export const UpdateFlagRhsFeatureFlagsItems$inboundSchema = smartUnion([
z.lazy(() => UpdateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagItemsFeatureFlags2$inboundSchema),
]);
export function updateFlagRhsFeatureFlagsItemsFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagRhsFeatureFlagsItems$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagRhsFeatureFlagsItems' from JSON`);
}
/** @internal */
export const UpdateFlagRhs3$inboundSchema = z.object({
type: UpdateFlagRhsFeatureFlagsType$inboundSchema,
items: z.array(smartUnion([
z.lazy(() => UpdateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagItemsFeatureFlags2$inboundSchema),
])),
});
export function updateFlagRhs3FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagRhs3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagRhs3' from JSON`);
}
/** @internal */
export const ResponseBodyRhs$inboundSchema = smartUnion([
z.lazy(() => UpdateFlagRhs4$inboundSchema),
z.lazy(() => UpdateFlagRhs3$inboundSchema),
types.string(),
types.number(),
types.boolean(),
]);
export function responseBodyRhsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyRhs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyRhs' from JSON`);
}
/** @internal */
export const ResponseBodyCmpOptions$inboundSchema = z.object({
ignoreCase: types.optional(types.boolean()),
});
export function responseBodyCmpOptionsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyCmpOptions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyCmpOptions' from JSON`);
}
/** @internal */
export const UpdateFlagLhsFeatureFlags2$inboundSchema = z.object({
type: types.literal("entity"),
kind: types.string(),
attribute: types.string(),
});
export function updateFlagLhsFeatureFlags2FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagLhsFeatureFlags2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagLhsFeatureFlags2' from JSON`);
}
/** @internal */
export const UpdateFlagLhsFeatureFlags1$inboundSchema = z.object({
type: types.literal("segment"),
});
export function updateFlagLhsFeatureFlags1FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagLhsFeatureFlags1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagLhsFeatureFlags1' from JSON`);
}
/** @internal */
export const ResponseBodyLhs$inboundSchema = z.union([
z.lazy(() => UpdateFlagLhsFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagLhsFeatureFlags2$inboundSchema),
]);
export function responseBodyLhsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyLhs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyLhs' from JSON`);
}
/** @internal */
export const ResponseBodyCmp$inboundSchema = z.nativeEnum(ResponseBodyCmp);
/** @internal */
export const ResponseBodyConditions$inboundSchema = z.object({
rhs: types.optional(smartUnion([
z.lazy(() => UpdateFlagRhs4$inboundSchema),
z.lazy(() => UpdateFlagRhs3$inboundSchema),
types.string(),
types.number(),
types.boolean(),
])),
cmpOptions: types.optional(z.lazy(() => ResponseBodyCmpOptions$inboundSchema)),
lhs: z.union([
z.lazy(() => UpdateFlagLhsFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagLhsFeatureFlags2$inboundSchema),
]),
cmp: ResponseBodyCmp$inboundSchema,
});
export function responseBodyConditionsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyConditions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyConditions' from JSON`);
}
/** @internal */
export const ResponseBodyRules$inboundSchema = z.object({
id: types.string(),
outcome: z.union([
z.lazy(() => UpdateFlagOutcomeFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagOutcomeFeatureFlags2$inboundSchema),
z.lazy(() => UpdateFlagOutcomeFeatureFlags3$inboundSchema),
z.lazy(() => UpdateFlagOutcome4$inboundSchema),
]),
conditions: z.array(z.lazy(() => ResponseBodyConditions$inboundSchema)),
});
export function responseBodyRulesFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyRules$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyRules' from JSON`);
}
/** @internal */
export const ResponseBodyEnvironments$inboundSchema = z.object({
reuse: types.optional(z.lazy(() => ResponseBodyReuse$inboundSchema)),
targets: types.optional(z.record(z.record(z.record(z.array(z.lazy(() => UpdateFlagResponseBodyTargets$inboundSchema)))))),
revision: types.optional(types.number()),
pausedOutcome: z.lazy(() => ResponseBodyPausedOutcome$inboundSchema),
fallthrough: z.union([
z.lazy(() => UpdateFlagFallthroughFeatureFlags1$inboundSchema),
z.lazy(() => UpdateFlagFallthroughFeatureFlags2$inboundSchema),
z.lazy(() => UpdateFlagFallthroughFeatureFlags3$inboundSchema),
z.lazy(() => UpdateFlagFallthrough4$inboundSchema),
]),
active: types.boolean(),
rules: z.array(z.lazy(() => ResponseBodyRules$inboundSchema)),
});
export function responseBodyEnvironmentsFromJSON(jsonString) {
return safeParse(jsonString, (x) => ResponseBodyEnvironments$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyEnvironments' from JSON`);
}
/** @internal */
export const ResponseBodyKind$inboundSchema = z.nativeEnum(ResponseBodyKind);
/** @internal */
export const ResponseBodyState$inboundSchema = z.nativeEnum(ResponseBodyState);
/** @internal */
export const ResponseBodyTypeName$inboundSchema = z.nativeEnum(ResponseBodyTypeName);
/** @internal */
export const UpdateFlagResponseBody1$inboundSchema = z.object({
description: types.optional(types.string()),
variants: z.array(z.lazy(() => ResponseBodyVariants$inboundSchema)),
id: types.string(),
environments: z.record(z.lazy(() => ResponseBodyEnvironments$inboundSchema)),
kind: ResponseBodyKind$inboundSchema,
revision: types.number(),
seed: types.number(),
state: ResponseBodyState$inboundSchema,
maintainerIds: types.optional(z.array(types.string())),
permanent: types.optional(types.boolean()),
tags: types.optional(z.array(types.string())),
slug: types.string(),
createdAt: types.number(),
updatedAt: types.number(),
updatedBy: types.optional(types.string()),
createdBy: types.string(),
ownerId: types.string(),
projectId: types.string(),
typeName: ResponseBodyTypeName$inboundSchema,
});
export function updateFlagResponseBody1FromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagResponseBody1' from JSON`);
}
/** @internal */
export const UpdateFlagResponseBody$inboundSchema = smartUnion([
z.lazy(() => UpdateFlagResponseBody1$inboundSchema),
Flag$inboundSchema,
]);
export function updateFlagResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => UpdateFlagResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateFlagResponseBody' from JSON`);
}
//# sourceMappingURL=updateflagop.js.map