@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>
2,706 lines • 73.6 kB
text/typescript
/*
* 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 { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
/**
* The kind of flag
*/
export const CreateFlagKind = {
Boolean: "boolean",
String: "string",
Number: "number",
Json: "json",
} as const;
/**
* The kind of flag
*/
export type CreateFlagKind = ClosedEnum<typeof CreateFlagKind>;
export type Value4 = {};
export type CreateFlagVariants = {
/**
* The id of the variant
*/
id: string;
/**
* A label for the variant
*/
label?: string | undefined;
/**
* A description of the variant
*/
description?: string | undefined;
value?: any | undefined;
};
/**
* Allows linking this environment to another environment so this flag will be evaluated with the other flag's configuration
*/
export type CreateFlagReuse = {
/**
* Whether the reuse is active or not
*/
active: boolean;
/**
* The environment to link to
*/
environment: string;
};
export type CreateFlagTargets = {
note?: string | undefined;
value: string;
};
export type CreateFlagPausedOutcome = {
type?: any | undefined;
variantId: string;
};
export type CreateFlagLhs2 = {
type?: any | undefined;
kind: string;
attribute: string;
};
export type CreateFlagLhs1 = {
type?: any | undefined;
};
export type CreateFlagLhs = CreateFlagLhs2 | CreateFlagLhs1;
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",
} as const;
export type CreateFlagCmp = ClosedEnum<typeof CreateFlagCmp>;
export type Rhs2 = {
type?: any | undefined;
pattern: string;
flags: string;
};
export const CreateFlagRhsType = {
ListInline: "list/inline",
List: "list",
} as const;
export type CreateFlagRhsType = ClosedEnum<typeof CreateFlagRhsType>;
export type CreateFlagItems2 = {
label?: string | undefined;
note?: string | undefined;
value: string;
};
export type CreateFlagItems1 = {
label?: string | undefined;
note?: string | undefined;
value: number;
};
export type CreateFlagRhsItems = CreateFlagItems1 | CreateFlagItems2;
export type Rhs1 = {
type: CreateFlagRhsType;
items: Array<CreateFlagItems1 | CreateFlagItems2>;
};
export type CreateFlagRhs = Rhs2 | Rhs1 | string | number | boolean;
export type CreateFlagCmpOptions = {
ignoreCase?: boolean | undefined;
};
export type CreateFlagConditions = {
lhs: CreateFlagLhs2 | CreateFlagLhs1;
cmp: CreateFlagCmp;
rhs?: Rhs2 | Rhs1 | string | number | boolean | undefined;
cmpOptions?: CreateFlagCmpOptions | undefined;
};
export type CreateFlagOutcomeFeatureFlagsBase = {
type?: any | undefined;
kind: string;
attribute: string;
};
export type CreateFlagOutcomeSlots = {
/**
* Promille of traffic for rollToVariant (0-100_000, where 1_000 = 1%)
*/
promille: number;
/**
* How long this promille is served in ms before moving to the next slot.
*/
durationMs: number;
};
export type CreateFlagOutcome3 = {
type?: any | undefined;
base: CreateFlagOutcomeFeatureFlagsBase;
/**
* Epoch ms when the rollout begins
*/
startTimestamp: number;
/**
* The variant to roll away from
*/
rollFromVariantId: string;
/**
* The variant to roll towards
*/
rollToVariantId: string;
/**
* This variant will be used when the base attribute does not exist
*/
defaultVariantId: string;
/**
* Each slot defines a promille and how long it is served for. After all slots expire, 100% is served indefinitely. The final implicit 100% slot does not need to be listed. Example: [[5_000, 21_600_000], [10_000, 28_800_000]] means 5‰ for 6h, then 10‰ for 8h, then 100% indefinitely.
*/
slots: Array<CreateFlagOutcomeSlots>;
};
export type CreateFlagOutcomeBase = {
type?: any | undefined;
kind: string;
attribute: string;
};
export type CreateFlagOutcome2 = {
type?: any | undefined;
base: CreateFlagOutcomeBase;
/**
* The distribution for each variant
*/
weights: { [k: string]: number };
/**
* This variant will be used when the base attribute does not exist
*/
defaultVariantId: string;
};
export type CreateFlagOutcome1 = {
type?: any | undefined;
variantId: string;
};
export type CreateFlagOutcome =
| CreateFlagOutcome3
| CreateFlagOutcome2
| CreateFlagOutcome1;
export type CreateFlagRules = {
id: string;
conditions: Array<CreateFlagConditions>;
outcome: CreateFlagOutcome3 | CreateFlagOutcome2 | CreateFlagOutcome1;
};
export type CreateFlagFallthroughFeatureFlagsBase = {
type?: any | undefined;
kind: string;
attribute: string;
};
export type FallthroughSlots = {
/**
* Promille of traffic for rollToVariant (0-100_000, where 1_000 = 1%)
*/
promille: number;
/**
* How long this promille is served in ms before moving to the next slot.
*/
durationMs: number;
};
export type CreateFlagFallthrough3 = {
type?: any | undefined;
base: CreateFlagFallthroughFeatureFlagsBase;
/**
* Epoch ms when the rollout begins
*/
startTimestamp: number;
/**
* The variant to roll away from
*/
rollFromVariantId: string;
/**
* The variant to roll towards
*/
rollToVariantId: string;
/**
* This variant will be used when the base attribute does not exist
*/
defaultVariantId: string;
/**
* Each slot defines a promille and how long it is served for. After all slots expire, 100% is served indefinitely. The final implicit 100% slot does not need to be listed. Example: [[5_000, 21_600_000], [10_000, 28_800_000]] means 5‰ for 6h, then 10‰ for 8h, then 100% indefinitely.
*/
slots: Array<FallthroughSlots>;
};
export type CreateFlagFallthroughBase = {
type?: any | undefined;
kind: string;
attribute: string;
};
export type CreateFlagFallthrough2 = {
type?: any | undefined;
base: CreateFlagFallthroughBase;
/**
* The distribution for each variant
*/
weights: { [k: string]: number };
/**
* This variant will be used when the base attribute does not exist
*/
defaultVariantId: string;
};
export type CreateFlagFallthrough1 = {
type?: any | undefined;
variantId: string;
};
export type CreateFlagFallthrough =
| CreateFlagFallthrough3
| CreateFlagFallthrough2
| CreateFlagFallthrough1;
export type CreateFlagEnvironments = {
active: boolean;
/**
* Allows linking this environment to another environment so this flag will be evaluated with the other flag's configuration
*/
reuse?: CreateFlagReuse | undefined;
/**
* Allows assigning targets to variants while bypassing the flag's rules
*/
targets?: {
[k: string]: { [k: string]: { [k: string]: Array<CreateFlagTargets> } };
} | undefined;
pausedOutcome: CreateFlagPausedOutcome;
rules: Array<CreateFlagRules>;
fallthrough:
| CreateFlagFallthrough3
| CreateFlagFallthrough2
| CreateFlagFallthrough1;
/**
* The revision of the environment config
*/
revision?: number | undefined;
};
export const CreateFlagState = {
Active: "active",
Archived: "archived",
} as const;
export type CreateFlagState = ClosedEnum<typeof CreateFlagState>;
export type CreateFlagRequestBody = {
/**
* A unique (per project) key for the flag, composed of letters, numbers, dashes, and underscores
*/
slug: string;
/**
* The kind of flag
*/
kind: CreateFlagKind;
/**
* The variants of the flag
*/
variants?: Array<CreateFlagVariants> | undefined;
/**
* The configuration for the flag in different environments
*/
environments: { [k: string]: CreateFlagEnvironments };
/**
* A random seed to prevent split points in different flags from having the same targets
*/
seed?: number | undefined;
/**
* A description of the flag
*/
description?: string | undefined;
state?: CreateFlagState | undefined;
/**
* The user ids of the maintainers of the flag
*/
maintainerIds?: Array<string> | undefined;
/**
* Whether this flag is marked as permanent, indicating it should not be removed
*/
permanent?: boolean | undefined;
/**
* Tags for categorizing the flag
*/
tags?: Array<string> | undefined;
};
export type CreateFlagRequest = {
/**
* The project id or name
*/
projectIdOrName: string;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
requestBody?: CreateFlagRequestBody | undefined;
};
export const CreateFlagMetricType = {
Count: "count",
Currency: "currency",
Percentage: "percentage",
} as const;
export type CreateFlagMetricType = ClosedEnum<typeof CreateFlagMetricType>;
export const CreateFlagMetricUnit = {
Session: "session",
User: "user",
Visitor: "visitor",
} as const;
export type CreateFlagMetricUnit = ClosedEnum<typeof CreateFlagMetricUnit>;
export const CreateFlagDirectionality = {
DecreaseIsGood: "decreaseIsGood",
IncreaseIsGood: "increaseIsGood",
} as const;
export type CreateFlagDirectionality = ClosedEnum<
typeof CreateFlagDirectionality
>;
export type CreateFlagGuardrailMetrics = {
description?: string | undefined;
metricFormula?: string | undefined;
name: string;
metricType: CreateFlagMetricType;
metricUnit: CreateFlagMetricUnit;
directionality: CreateFlagDirectionality;
};
export const CreateFlagDevice = {
Android: "android",
Desktop: "desktop",
Ios: "ios",
Mweb: "mweb",
} as const;
export type CreateFlagDevice = ClosedEnum<typeof CreateFlagDevice>;
export const CreateFlagDurationUnit = {
Days: "days",
Exposures: "exposures",
} as const;
export type CreateFlagDurationUnit = ClosedEnum<typeof CreateFlagDurationUnit>;
export const CreateFlagAllocationUnit = {
CookieId: "cookieId",
UserId: "userId",
VisitorId: "visitorId",
} as const;
export type CreateFlagAllocationUnit = ClosedEnum<
typeof CreateFlagAllocationUnit
>;
export const CreateFlagFeatureFlagsMetricType = {
Count: "count",
Currency: "currency",
Percentage: "percentage",
} as const;
export type CreateFlagFeatureFlagsMetricType = ClosedEnum<
typeof CreateFlagFeatureFlagsMetricType
>;
export const CreateFlagFeatureFlagsMetricUnit = {
Session: "session",
User: "user",
Visitor: "visitor",
} as const;
export type CreateFlagFeatureFlagsMetricUnit = ClosedEnum<
typeof CreateFlagFeatureFlagsMetricUnit
>;
export const CreateFlagFeatureFlagsDirectionality = {
DecreaseIsGood: "decreaseIsGood",
IncreaseIsGood: "increaseIsGood",
} as const;
export type CreateFlagFeatureFlagsDirectionality = ClosedEnum<
typeof CreateFlagFeatureFlagsDirectionality
>;
export type CreateFlagPrimaryMetrics = {
description?: string | undefined;
metricFormula?: string | undefined;
name: string;
metricType: CreateFlagFeatureFlagsMetricType;
metricUnit: CreateFlagFeatureFlagsMetricUnit;
directionality: CreateFlagFeatureFlagsDirectionality;
};
export const CreateFlagStatus = {
Closed: "closed",
Draft: "draft",
Paused: "paused",
Running: "running",
} as const;
export type CreateFlagStatus = ClosedEnum<typeof CreateFlagStatus>;
export type CreateFlagExperiment = {
id?: string | undefined;
name?: string | undefined;
numVariants?: number | undefined;
surfaceArea?: string | undefined;
stickyRequirement?: boolean | undefined;
layer?: string | undefined;
guardrailMetrics?: Array<CreateFlagGuardrailMetrics> | undefined;
hypothesis?: string | undefined;
device?: CreateFlagDevice | undefined;
controlVariantId?: string | undefined;
startedAt?: number | undefined;
endedAt?: number | undefined;
decision?: string | undefined;
decisionReason?: string | undefined;
duration?: number | undefined;
durationUnit?: CreateFlagDurationUnit | undefined;
allocationPercent?: number | undefined;
allocationUnit: CreateFlagAllocationUnit;
primaryMetrics: Array<CreateFlagPrimaryMetrics>;
status: CreateFlagStatus;
};
export type CreateFlagFeatureFlagsVariants = {};
export type CreateFlagFeatureFlagsReuse = {
active: boolean;
environment: string;
};
export type CreateFlagFeatureFlagsTargets = {
note?: string | undefined;
value: string;
};
export const CreateFlagType = {
Variant: "variant",
} as const;
export type CreateFlagType = ClosedEnum<typeof CreateFlagType>;
export type CreateFlagFeatureFlagsPausedOutcome = {
type: CreateFlagType;
variantId: string;
};
export const CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType = {
Entity: "entity",
} as const;
export type CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType =
ClosedEnum<
typeof CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType
>;
export type CreateFlagFallthroughFeatureFlagsResponse201Base = {
type: CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType;
kind: string;
attribute: string;
};
export type CreateFlagFallthroughSlots = {
promille: number;
durationMs: number;
};
export type CreateFlagFallthroughFeatureFlags3 = {
type: "rollout";
base: CreateFlagFallthroughFeatureFlagsResponse201Base;
defaultVariantId: string;
startTimestamp: number;
rollFromVariantId: string;
rollToVariantId: string;
slots: Array<CreateFlagFallthroughSlots>;
};
export const CreateFlagFallthroughFeatureFlagsResponse201Type = {
Entity: "entity",
} as const;
export type CreateFlagFallthroughFeatureFlagsResponse201Type = ClosedEnum<
typeof CreateFlagFallthroughFeatureFlagsResponse201Type
>;
export type CreateFlagFallthroughFeatureFlagsResponseBase = {
type: CreateFlagFallthroughFeatureFlagsResponse201Type;
kind: string;
attribute: string;
};
export type CreateFlagFallthroughFeatureFlags2 = {
type: "split";
base: CreateFlagFallthroughFeatureFlagsResponseBase;
weights: { [k: string]: number };
defaultVariantId: string;
};
export type CreateFlagFallthroughFeatureFlags1 = {
type: "variant";
variantId: string;
};
export type CreateFlagFeatureFlagsFallthrough =
| CreateFlagFallthroughFeatureFlags1
| CreateFlagFallthroughFeatureFlags2
| CreateFlagFallthroughFeatureFlags3;
export const CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType = {
Entity: "entity",
} as const;
export type CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType =
ClosedEnum<
typeof CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType
>;
export type CreateFlagOutcomeFeatureFlagsResponse201Base = {
type: CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType;
kind: string;
attribute: string;
};
export type CreateFlagOutcomeFeatureFlagsSlots = {
promille: number;
durationMs: number;
};
export type CreateFlagOutcomeFeatureFlags3 = {
type: "rollout";
base: CreateFlagOutcomeFeatureFlagsResponse201Base;
defaultVariantId: string;
startTimestamp: number;
rollFromVariantId: string;
rollToVariantId: string;
slots: Array<CreateFlagOutcomeFeatureFlagsSlots>;
};
export const CreateFlagOutcomeFeatureFlagsResponse201Type = {
Entity: "entity",
} as const;
export type CreateFlagOutcomeFeatureFlagsResponse201Type = ClosedEnum<
typeof CreateFlagOutcomeFeatureFlagsResponse201Type
>;
export type CreateFlagOutcomeFeatureFlagsResponseBase = {
type: CreateFlagOutcomeFeatureFlagsResponse201Type;
kind: string;
attribute: string;
};
export type CreateFlagOutcomeFeatureFlags2 = {
type: "split";
base: CreateFlagOutcomeFeatureFlagsResponseBase;
weights: { [k: string]: number };
defaultVariantId: string;
};
export type CreateFlagOutcomeFeatureFlags1 = {
type: "variant";
variantId: string;
};
export type CreateFlagFeatureFlagsOutcome =
| CreateFlagOutcomeFeatureFlags1
| CreateFlagOutcomeFeatureFlags2
| CreateFlagOutcomeFeatureFlags3;
export const CreateFlagRhsFeatureFlagsResponseType = {
Regex: "regex",
} as const;
export type CreateFlagRhsFeatureFlagsResponseType = ClosedEnum<
typeof CreateFlagRhsFeatureFlagsResponseType
>;
export type CreateFlagRhs4 = {
type: CreateFlagRhsFeatureFlagsResponseType;
pattern: string;
flags: string;
};
export const CreateFlagRhsFeatureFlagsType = {
List: "list",
ListInline: "list/inline",
} as const;
export type CreateFlagRhsFeatureFlagsType = ClosedEnum<
typeof CreateFlagRhsFeatureFlagsType
>;
export type CreateFlagItemsFeatureFlags2 = {
label?: string | undefined;
note?: string | undefined;
value: string;
};
export type CreateFlagItemsFeatureFlags1 = {
label?: string | undefined;
note?: string | undefined;
value: number;
};
export type CreateFlagRhsFeatureFlagsItems =
| CreateFlagItemsFeatureFlags1
| CreateFlagItemsFeatureFlags2;
export type CreateFlagRhs3 = {
type: CreateFlagRhsFeatureFlagsType;
items: Array<CreateFlagItemsFeatureFlags1 | CreateFlagItemsFeatureFlags2>;
};
export type CreateFlagFeatureFlagsRhs =
| CreateFlagRhs4
| CreateFlagRhs3
| string
| number
| boolean;
export type CreateFlagFeatureFlagsCmpOptions = {
ignoreCase?: boolean | undefined;
};
export type CreateFlagLhsFeatureFlags2 = {
type: "entity";
kind: string;
attribute: string;
};
export type CreateFlagLhsFeatureFlags1 = {
type: "segment";
};
export type CreateFlagFeatureFlagsLhs =
| CreateFlagLhsFeatureFlags1
| CreateFlagLhsFeatureFlags2;
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",
} as const;
export type CreateFlagFeatureFlagsCmp = ClosedEnum<
typeof CreateFlagFeatureFlagsCmp
>;
export type CreateFlagFeatureFlagsConditions = {
rhs?: CreateFlagRhs4 | CreateFlagRhs3 | string | number | boolean | undefined;
cmpOptions?: CreateFlagFeatureFlagsCmpOptions | undefined;
lhs: CreateFlagLhsFeatureFlags1 | CreateFlagLhsFeatureFlags2;
cmp: CreateFlagFeatureFlagsCmp;
};
export type CreateFlagFeatureFlagsRules = {
id: string;
outcome:
| CreateFlagOutcomeFeatureFlags1
| CreateFlagOutcomeFeatureFlags2
| CreateFlagOutcomeFeatureFlags3;
conditions: Array<CreateFlagFeatureFlagsConditions>;
};
export type CreateFlagFeatureFlagsEnvironments = {
reuse?: CreateFlagFeatureFlagsReuse | undefined;
targets?: {
[k: string]: {
[k: string]: { [k: string]: Array<CreateFlagFeatureFlagsTargets> };
};
} | undefined;
revision?: number | undefined;
pausedOutcome: CreateFlagFeatureFlagsPausedOutcome;
fallthrough:
| CreateFlagFallthroughFeatureFlags1
| CreateFlagFallthroughFeatureFlags2
| CreateFlagFallthroughFeatureFlags3;
active: boolean;
rules: Array<CreateFlagFeatureFlagsRules>;
};
export const CreateFlagFeatureFlagsKind = {
Boolean: "boolean",
Json: "json",
Number: "number",
String: "string",
} as const;
export type CreateFlagFeatureFlagsKind = ClosedEnum<
typeof CreateFlagFeatureFlagsKind
>;
export const CreateFlagFeatureFlagsState = {
Active: "active",
Archived: "archived",
} as const;
export type CreateFlagFeatureFlagsState = ClosedEnum<
typeof CreateFlagFeatureFlagsState
>;
export const CreateFlagTypeName = {
Flag: "flag",
} as const;
export type CreateFlagTypeName = ClosedEnum<typeof CreateFlagTypeName>;
export type CreateFlagResponseBody = {
description?: string | undefined;
maintainerIds?: Array<string> | undefined;
permanent?: boolean | undefined;
tags?: Array<string> | undefined;
experiment?: CreateFlagExperiment | undefined;
variants: Array<CreateFlagFeatureFlagsVariants>;
id: string;
environments: { [k: string]: CreateFlagFeatureFlagsEnvironments };
kind: CreateFlagFeatureFlagsKind;
revision: number;
seed: number;
state: CreateFlagFeatureFlagsState;
slug: string;
createdAt: number;
updatedAt: number;
createdBy: string;
ownerId: string;
projectId: string;
typeName: CreateFlagTypeName;
};
/** @internal */
export const CreateFlagKind$outboundSchema: z.ZodNativeEnum<
typeof CreateFlagKind
> = z.nativeEnum(CreateFlagKind);
/** @internal */
export type Value4$Outbound = {};
/** @internal */
export const Value4$outboundSchema: z.ZodType<
Value4$Outbound,
z.ZodTypeDef,
Value4
> = z.object({});
export function value4ToJSON(value4: Value4): string {
return JSON.stringify(Value4$outboundSchema.parse(value4));
}
/** @internal */
export type CreateFlagVariants$Outbound = {
id: string;
label?: string | undefined;
description?: string | undefined;
value?: any | undefined;
};
/** @internal */
export const CreateFlagVariants$outboundSchema: z.ZodType<
CreateFlagVariants$Outbound,
z.ZodTypeDef,
CreateFlagVariants
> = z.object({
id: z.string(),
label: z.string().optional(),
description: z.string().optional(),
value: z.any().optional(),
});
export function createFlagVariantsToJSON(
createFlagVariants: CreateFlagVariants,
): string {
return JSON.stringify(
CreateFlagVariants$outboundSchema.parse(createFlagVariants),
);
}
/** @internal */
export type CreateFlagReuse$Outbound = {
active: boolean;
environment: string;
};
/** @internal */
export const CreateFlagReuse$outboundSchema: z.ZodType<
CreateFlagReuse$Outbound,
z.ZodTypeDef,
CreateFlagReuse
> = z.object({
active: z.boolean(),
environment: z.string(),
});
export function createFlagReuseToJSON(
createFlagReuse: CreateFlagReuse,
): string {
return JSON.stringify(CreateFlagReuse$outboundSchema.parse(createFlagReuse));
}
/** @internal */
export type CreateFlagTargets$Outbound = {
note?: string | undefined;
value: string;
};
/** @internal */
export const CreateFlagTargets$outboundSchema: z.ZodType<
CreateFlagTargets$Outbound,
z.ZodTypeDef,
CreateFlagTargets
> = z.object({
note: z.string().optional(),
value: z.string(),
});
export function createFlagTargetsToJSON(
createFlagTargets: CreateFlagTargets,
): string {
return JSON.stringify(
CreateFlagTargets$outboundSchema.parse(createFlagTargets),
);
}
/** @internal */
export type CreateFlagPausedOutcome$Outbound = {
type?: any | undefined;
variantId: string;
};
/** @internal */
export const CreateFlagPausedOutcome$outboundSchema: z.ZodType<
CreateFlagPausedOutcome$Outbound,
z.ZodTypeDef,
CreateFlagPausedOutcome
> = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagPausedOutcomeToJSON(
createFlagPausedOutcome: CreateFlagPausedOutcome,
): string {
return JSON.stringify(
CreateFlagPausedOutcome$outboundSchema.parse(createFlagPausedOutcome),
);
}
/** @internal */
export type CreateFlagLhs2$Outbound = {
type?: any | undefined;
kind: string;
attribute: string;
};
/** @internal */
export const CreateFlagLhs2$outboundSchema: z.ZodType<
CreateFlagLhs2$Outbound,
z.ZodTypeDef,
CreateFlagLhs2
> = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagLhs2ToJSON(createFlagLhs2: CreateFlagLhs2): string {
return JSON.stringify(CreateFlagLhs2$outboundSchema.parse(createFlagLhs2));
}
/** @internal */
export type CreateFlagLhs1$Outbound = {
type?: any | undefined;
};
/** @internal */
export const CreateFlagLhs1$outboundSchema: z.ZodType<
CreateFlagLhs1$Outbound,
z.ZodTypeDef,
CreateFlagLhs1
> = z.object({
type: z.any().optional(),
});
export function createFlagLhs1ToJSON(createFlagLhs1: CreateFlagLhs1): string {
return JSON.stringify(CreateFlagLhs1$outboundSchema.parse(createFlagLhs1));
}
/** @internal */
export type CreateFlagLhs$Outbound =
| CreateFlagLhs2$Outbound
| CreateFlagLhs1$Outbound;
/** @internal */
export const CreateFlagLhs$outboundSchema: z.ZodType<
CreateFlagLhs$Outbound,
z.ZodTypeDef,
CreateFlagLhs
> = smartUnion([
z.lazy(() => CreateFlagLhs2$outboundSchema),
z.lazy(() => CreateFlagLhs1$outboundSchema),
]);
export function createFlagLhsToJSON(createFlagLhs: CreateFlagLhs): string {
return JSON.stringify(CreateFlagLhs$outboundSchema.parse(createFlagLhs));
}
/** @internal */
export const CreateFlagCmp$outboundSchema: z.ZodNativeEnum<
typeof CreateFlagCmp
> = z.nativeEnum(CreateFlagCmp);
/** @internal */
export type Rhs2$Outbound = {
type?: any | undefined;
pattern: string;
flags: string;
};
/** @internal */
export const Rhs2$outboundSchema: z.ZodType<Rhs2$Outbound, z.ZodTypeDef, Rhs2> =
z.object({
type: z.any().optional(),
pattern: z.string(),
flags: z.string(),
});
export function rhs2ToJSON(rhs2: Rhs2): string {
return JSON.stringify(Rhs2$outboundSchema.parse(rhs2));
}
/** @internal */
export const CreateFlagRhsType$outboundSchema: z.ZodNativeEnum<
typeof CreateFlagRhsType
> = z.nativeEnum(CreateFlagRhsType);
/** @internal */
export type CreateFlagItems2$Outbound = {
label?: string | undefined;
note?: string | undefined;
value: string;
};
/** @internal */
export const CreateFlagItems2$outboundSchema: z.ZodType<
CreateFlagItems2$Outbound,
z.ZodTypeDef,
CreateFlagItems2
> = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.string(),
});
export function createFlagItems2ToJSON(
createFlagItems2: CreateFlagItems2,
): string {
return JSON.stringify(
CreateFlagItems2$outboundSchema.parse(createFlagItems2),
);
}
/** @internal */
export type CreateFlagItems1$Outbound = {
label?: string | undefined;
note?: string | undefined;
value: number;
};
/** @internal */
export const CreateFlagItems1$outboundSchema: z.ZodType<
CreateFlagItems1$Outbound,
z.ZodTypeDef,
CreateFlagItems1
> = z.object({
label: z.string().optional(),
note: z.string().optional(),
value: z.number(),
});
export function createFlagItems1ToJSON(
createFlagItems1: CreateFlagItems1,
): string {
return JSON.stringify(
CreateFlagItems1$outboundSchema.parse(createFlagItems1),
);
}
/** @internal */
export type CreateFlagRhsItems$Outbound =
| CreateFlagItems1$Outbound
| CreateFlagItems2$Outbound;
/** @internal */
export const CreateFlagRhsItems$outboundSchema: z.ZodType<
CreateFlagRhsItems$Outbound,
z.ZodTypeDef,
CreateFlagRhsItems
> = smartUnion([
z.lazy(() => CreateFlagItems1$outboundSchema),
z.lazy(() => CreateFlagItems2$outboundSchema),
]);
export function createFlagRhsItemsToJSON(
createFlagRhsItems: CreateFlagRhsItems,
): string {
return JSON.stringify(
CreateFlagRhsItems$outboundSchema.parse(createFlagRhsItems),
);
}
/** @internal */
export type Rhs1$Outbound = {
type: string;
items: Array<CreateFlagItems1$Outbound | CreateFlagItems2$Outbound>;
};
/** @internal */
export const Rhs1$outboundSchema: z.ZodType<Rhs1$Outbound, z.ZodTypeDef, Rhs1> =
z.object({
type: CreateFlagRhsType$outboundSchema,
items: z.array(
smartUnion([
z.lazy(() => CreateFlagItems1$outboundSchema),
z.lazy(() => CreateFlagItems2$outboundSchema),
]),
),
});
export function rhs1ToJSON(rhs1: Rhs1): string {
return JSON.stringify(Rhs1$outboundSchema.parse(rhs1));
}
/** @internal */
export type CreateFlagRhs$Outbound =
| Rhs2$Outbound
| Rhs1$Outbound
| string
| number
| boolean;
/** @internal */
export const CreateFlagRhs$outboundSchema: z.ZodType<
CreateFlagRhs$Outbound,
z.ZodTypeDef,
CreateFlagRhs
> = smartUnion([
z.lazy(() => Rhs2$outboundSchema),
z.lazy(() => Rhs1$outboundSchema),
z.string(),
z.number(),
z.boolean(),
]);
export function createFlagRhsToJSON(createFlagRhs: CreateFlagRhs): string {
return JSON.stringify(CreateFlagRhs$outboundSchema.parse(createFlagRhs));
}
/** @internal */
export type CreateFlagCmpOptions$Outbound = {
ignoreCase?: boolean | undefined;
};
/** @internal */
export const CreateFlagCmpOptions$outboundSchema: z.ZodType<
CreateFlagCmpOptions$Outbound,
z.ZodTypeDef,
CreateFlagCmpOptions
> = z.object({
ignoreCase: z.boolean().optional(),
});
export function createFlagCmpOptionsToJSON(
createFlagCmpOptions: CreateFlagCmpOptions,
): string {
return JSON.stringify(
CreateFlagCmpOptions$outboundSchema.parse(createFlagCmpOptions),
);
}
/** @internal */
export type CreateFlagConditions$Outbound = {
lhs: CreateFlagLhs2$Outbound | CreateFlagLhs1$Outbound;
cmp: string;
rhs?: Rhs2$Outbound | Rhs1$Outbound | string | number | boolean | undefined;
cmpOptions?: CreateFlagCmpOptions$Outbound | undefined;
};
/** @internal */
export const CreateFlagConditions$outboundSchema: z.ZodType<
CreateFlagConditions$Outbound,
z.ZodTypeDef,
CreateFlagConditions
> = 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: CreateFlagConditions,
): string {
return JSON.stringify(
CreateFlagConditions$outboundSchema.parse(createFlagConditions),
);
}
/** @internal */
export type CreateFlagOutcomeFeatureFlagsBase$Outbound = {
type?: any | undefined;
kind: string;
attribute: string;
};
/** @internal */
export const CreateFlagOutcomeFeatureFlagsBase$outboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlagsBase$Outbound,
z.ZodTypeDef,
CreateFlagOutcomeFeatureFlagsBase
> = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagOutcomeFeatureFlagsBaseToJSON(
createFlagOutcomeFeatureFlagsBase: CreateFlagOutcomeFeatureFlagsBase,
): string {
return JSON.stringify(
CreateFlagOutcomeFeatureFlagsBase$outboundSchema.parse(
createFlagOutcomeFeatureFlagsBase,
),
);
}
/** @internal */
export type CreateFlagOutcomeSlots$Outbound = {
promille: number;
durationMs: number;
};
/** @internal */
export const CreateFlagOutcomeSlots$outboundSchema: z.ZodType<
CreateFlagOutcomeSlots$Outbound,
z.ZodTypeDef,
CreateFlagOutcomeSlots
> = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function createFlagOutcomeSlotsToJSON(
createFlagOutcomeSlots: CreateFlagOutcomeSlots,
): string {
return JSON.stringify(
CreateFlagOutcomeSlots$outboundSchema.parse(createFlagOutcomeSlots),
);
}
/** @internal */
export type CreateFlagOutcome3$Outbound = {
type?: any | undefined;
base: CreateFlagOutcomeFeatureFlagsBase$Outbound;
startTimestamp: number;
rollFromVariantId: string;
rollToVariantId: string;
defaultVariantId: string;
slots: Array<CreateFlagOutcomeSlots$Outbound>;
};
/** @internal */
export const CreateFlagOutcome3$outboundSchema: z.ZodType<
CreateFlagOutcome3$Outbound,
z.ZodTypeDef,
CreateFlagOutcome3
> = 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: CreateFlagOutcome3,
): string {
return JSON.stringify(
CreateFlagOutcome3$outboundSchema.parse(createFlagOutcome3),
);
}
/** @internal */
export type CreateFlagOutcomeBase$Outbound = {
type?: any | undefined;
kind: string;
attribute: string;
};
/** @internal */
export const CreateFlagOutcomeBase$outboundSchema: z.ZodType<
CreateFlagOutcomeBase$Outbound,
z.ZodTypeDef,
CreateFlagOutcomeBase
> = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagOutcomeBaseToJSON(
createFlagOutcomeBase: CreateFlagOutcomeBase,
): string {
return JSON.stringify(
CreateFlagOutcomeBase$outboundSchema.parse(createFlagOutcomeBase),
);
}
/** @internal */
export type CreateFlagOutcome2$Outbound = {
type?: any | undefined;
base: CreateFlagOutcomeBase$Outbound;
weights: { [k: string]: number };
defaultVariantId: string;
};
/** @internal */
export const CreateFlagOutcome2$outboundSchema: z.ZodType<
CreateFlagOutcome2$Outbound,
z.ZodTypeDef,
CreateFlagOutcome2
> = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagOutcomeBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function createFlagOutcome2ToJSON(
createFlagOutcome2: CreateFlagOutcome2,
): string {
return JSON.stringify(
CreateFlagOutcome2$outboundSchema.parse(createFlagOutcome2),
);
}
/** @internal */
export type CreateFlagOutcome1$Outbound = {
type?: any | undefined;
variantId: string;
};
/** @internal */
export const CreateFlagOutcome1$outboundSchema: z.ZodType<
CreateFlagOutcome1$Outbound,
z.ZodTypeDef,
CreateFlagOutcome1
> = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagOutcome1ToJSON(
createFlagOutcome1: CreateFlagOutcome1,
): string {
return JSON.stringify(
CreateFlagOutcome1$outboundSchema.parse(createFlagOutcome1),
);
}
/** @internal */
export type CreateFlagOutcome$Outbound =
| CreateFlagOutcome3$Outbound
| CreateFlagOutcome2$Outbound
| CreateFlagOutcome1$Outbound;
/** @internal */
export const CreateFlagOutcome$outboundSchema: z.ZodType<
CreateFlagOutcome$Outbound,
z.ZodTypeDef,
CreateFlagOutcome
> = smartUnion([
z.lazy(() => CreateFlagOutcome3$outboundSchema),
z.lazy(() => CreateFlagOutcome2$outboundSchema),
z.lazy(() => CreateFlagOutcome1$outboundSchema),
]);
export function createFlagOutcomeToJSON(
createFlagOutcome: CreateFlagOutcome,
): string {
return JSON.stringify(
CreateFlagOutcome$outboundSchema.parse(createFlagOutcome),
);
}
/** @internal */
export type CreateFlagRules$Outbound = {
id: string;
conditions: Array<CreateFlagConditions$Outbound>;
outcome:
| CreateFlagOutcome3$Outbound
| CreateFlagOutcome2$Outbound
| CreateFlagOutcome1$Outbound;
};
/** @internal */
export const CreateFlagRules$outboundSchema: z.ZodType<
CreateFlagRules$Outbound,
z.ZodTypeDef,
CreateFlagRules
> = 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: CreateFlagRules,
): string {
return JSON.stringify(CreateFlagRules$outboundSchema.parse(createFlagRules));
}
/** @internal */
export type CreateFlagFallthroughFeatureFlagsBase$Outbound = {
type?: any | undefined;
kind: string;
attribute: string;
};
/** @internal */
export const CreateFlagFallthroughFeatureFlagsBase$outboundSchema: z.ZodType<
CreateFlagFallthroughFeatureFlagsBase$Outbound,
z.ZodTypeDef,
CreateFlagFallthroughFeatureFlagsBase
> = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagFallthroughFeatureFlagsBaseToJSON(
createFlagFallthroughFeatureFlagsBase: CreateFlagFallthroughFeatureFlagsBase,
): string {
return JSON.stringify(
CreateFlagFallthroughFeatureFlagsBase$outboundSchema.parse(
createFlagFallthroughFeatureFlagsBase,
),
);
}
/** @internal */
export type FallthroughSlots$Outbound = {
promille: number;
durationMs: number;
};
/** @internal */
export const FallthroughSlots$outboundSchema: z.ZodType<
FallthroughSlots$Outbound,
z.ZodTypeDef,
FallthroughSlots
> = z.object({
promille: z.number(),
durationMs: z.number(),
});
export function fallthroughSlotsToJSON(
fallthroughSlots: FallthroughSlots,
): string {
return JSON.stringify(
FallthroughSlots$outboundSchema.parse(fallthroughSlots),
);
}
/** @internal */
export type CreateFlagFallthrough3$Outbound = {
type?: any | undefined;
base: CreateFlagFallthroughFeatureFlagsBase$Outbound;
startTimestamp: number;
rollFromVariantId: string;
rollToVariantId: string;
defaultVariantId: string;
slots: Array<FallthroughSlots$Outbound>;
};
/** @internal */
export const CreateFlagFallthrough3$outboundSchema: z.ZodType<
CreateFlagFallthrough3$Outbound,
z.ZodTypeDef,
CreateFlagFallthrough3
> = 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: CreateFlagFallthrough3,
): string {
return JSON.stringify(
CreateFlagFallthrough3$outboundSchema.parse(createFlagFallthrough3),
);
}
/** @internal */
export type CreateFlagFallthroughBase$Outbound = {
type?: any | undefined;
kind: string;
attribute: string;
};
/** @internal */
export const CreateFlagFallthroughBase$outboundSchema: z.ZodType<
CreateFlagFallthroughBase$Outbound,
z.ZodTypeDef,
CreateFlagFallthroughBase
> = z.object({
type: z.any().optional(),
kind: z.string(),
attribute: z.string(),
});
export function createFlagFallthroughBaseToJSON(
createFlagFallthroughBase: CreateFlagFallthroughBase,
): string {
return JSON.stringify(
CreateFlagFallthroughBase$outboundSchema.parse(createFlagFallthroughBase),
);
}
/** @internal */
export type CreateFlagFallthrough2$Outbound = {
type?: any | undefined;
base: CreateFlagFallthroughBase$Outbound;
weights: { [k: string]: number };
defaultVariantId: string;
};
/** @internal */
export const CreateFlagFallthrough2$outboundSchema: z.ZodType<
CreateFlagFallthrough2$Outbound,
z.ZodTypeDef,
CreateFlagFallthrough2
> = z.object({
type: z.any().optional(),
base: z.lazy(() => CreateFlagFallthroughBase$outboundSchema),
weights: z.record(z.number()),
defaultVariantId: z.string(),
});
export function createFlagFallthrough2ToJSON(
createFlagFallthrough2: CreateFlagFallthrough2,
): string {
return JSON.stringify(
CreateFlagFallthrough2$outboundSchema.parse(createFlagFallthrough2),
);
}
/** @internal */
export type CreateFlagFallthrough1$Outbound = {
type?: any | undefined;
variantId: string;
};
/** @internal */
export const CreateFlagFallthrough1$outboundSchema: z.ZodType<
CreateFlagFallthrough1$Outbound,
z.ZodTypeDef,
CreateFlagFallthrough1
> = z.object({
type: z.any().optional(),
variantId: z.string(),
});
export function createFlagFallthrough1ToJSON(
createFlagFallthrough1: CreateFlagFallthrough1,
): string {
return JSON.stringify(
CreateFlagFallthrough1$outboundSchema.parse(createFlagFallthrough1),
);
}
/** @internal */
export type CreateFlagFallthrough$Outbound =
| CreateFlagFallthrough3$Outbound
| CreateFlagFallthrough2$Outbound
| CreateFlagFallthrough1$Outbound;
/** @internal */
export const CreateFlagFallthrough$outboundSchema: z.ZodType<
CreateFlagFallthrough$Outbound,
z.ZodTypeDef,
CreateFlagFallthrough
> = smartUnion([
z.lazy(() => CreateFlagFallthrough3$outboundSchema),
z.lazy(() => CreateFlagFallthrough2$outboundSchema),
z.lazy(() => CreateFlagFallthrough1$outboundSchema),
]);
export function createFlagFallthroughToJSON(
createFlagFallthrough: CreateFlagFallthrough,
): string {
return JSON.stringify(
CreateFlagFallthrough$outboundSchema.parse(createFlagFallthrough),
);
}
/** @internal */
export type CreateFlagEnvironments$Outbound = {
active: boolean;
reuse?: CreateFlagReuse$Outbound | undefined;
targets?: {
[k: string]: {
[k: string]: { [k: string]: Array<CreateFlagTargets$Outbound> };
};
} | undefined;
pausedOutcome: CreateFlagPausedOutcome$Outbound;
rules: Array<CreateFlagRules$Outbound>;
fallthrough:
| CreateFlagFallthrough3$Outbound
| CreateFlagFallthrough2$Outbound
| CreateFlagFallthrough1$Outbound;
revision?: number | undefined;
};
/** @internal */
export const CreateFlagEnvironments$outboundSchema: z.ZodType<
CreateFlagEnvironments$Outbound,
z.ZodTypeDef,
CreateFlagEnvironments
> = 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: CreateFlagEnvironments,
): string {
return JSON.stringify(
CreateFlagEnvironments$outboundSchema.parse(createFlagEnvironments),
);
}
/** @internal */
export const CreateFlagState$outboundSchema: z.ZodNativeEnum<
typeof CreateFlagState
> = z.nativeEnum(CreateFlagState);
/** @internal */
export type CreateFlagRequestBody$Outbound = {
slug: string;
kind: string;
variants?: Array<CreateFlagVariants$Outbound> | undefined;
environments: { [k: string]: CreateFlagEnvironments$Outbound };
seed?: number | undefined;
description?: string | undefined;
state?: string | undefined;
maintainerIds?: Array<string> | undefined;
permanent?: boolean | undefined;
tags?: Array<string> | undefined;
};
/** @internal */
export const CreateFlagRequestBody$outboundSchema: z.ZodType<
CreateFlagRequestBody$Outbound,
z.ZodTypeDef,
CreateFlagRequestBody
> = 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: CreateFlagRequestBody,
): string {
return JSON.stringify(
CreateFlagRequestBody$outboundSchema.parse(createFlagRequestBody),
);
}
/** @internal */
export type CreateFlagRequest$Outbound = {
projectIdOrName: string;
teamId?: string | undefined;
slug?: string | undefined;
RequestBody?: CreateFlagRequestBody$Outbound | undefined;
};
/** @internal */
export const CreateFlagRequest$outboundSchema: z.ZodType<
CreateFlagRequest$Outbound,
z.ZodTypeDef,
CreateFlagRequest
> = 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: CreateFlagRequest,
): string {
return JSON.stringify(
CreateFlagRequest$outboundSchema.parse(createFlagRequest),
);
}
/** @internal */
export const CreateFlagMetricType$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagMetricType
> = z.nativeEnum(CreateFlagMetricType);
/** @internal */
export const CreateFlagMetricUnit$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagMetricUnit
> = z.nativeEnum(CreateFlagMetricUnit);
/** @internal */
export const CreateFlagDirectionality$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagDirectionality
> = z.nativeEnum(CreateFlagDirectionality);
/** @internal */
export const CreateFlagGuardrailMetrics$inboundSchema: z.ZodType<
CreateFlagGuardrailMetrics,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagGuardrailMetrics, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagGuardrailMetrics$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagGuardrailMetrics' from JSON`,
);
}
/** @internal */
export const CreateFlagDevice$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagDevice
> = z.nativeEnum(CreateFlagDevice);
/** @internal */
export const CreateFlagDurationUnit$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagDurationUnit
> = z.nativeEnum(CreateFlagDurationUnit);
/** @internal */
export const CreateFlagAllocationUnit$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagAllocationUnit
> = z.nativeEnum(CreateFlagAllocationUnit);
/** @internal */
export const CreateFlagFeatureFlagsMetricType$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagFeatureFlagsMetricType
> = z.nativeEnum(CreateFlagFeatureFlagsMetricType);
/** @internal */
export const CreateFlagFeatureFlagsMetricUnit$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagFeatureFlagsMetricUnit
> = z.nativeEnum(CreateFlagFeatureFlagsMetricUnit);
/** @internal */
export const CreateFlagFeatureFlagsDirectionality$inboundSchema:
z.ZodNativeEnum<typeof CreateFlagFeatureFlagsDirectionality> = z.nativeEnum(
CreateFlagFeatureFlagsDirectionality,
);
/** @internal */
export const CreateFlagPrimaryMetrics$inboundSchema: z.ZodType<
CreateFlagPrimaryMetrics,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagPrimaryMetrics, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagPrimaryMetrics$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagPrimaryMetrics' from JSON`,
);
}
/** @internal */
export const CreateFlagStatus$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagStatus
> = z.nativeEnum(CreateFlagStatus);
/** @internal */
export const CreateFlagExperiment$inboundSchema: z.ZodType<
CreateFlagExperiment,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagExperiment, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagExperiment$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagExperiment' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsVariants$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsVariants,
z.ZodTypeDef,
unknown
> = z.object({});
export function createFlagFeatureFlagsVariantsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsVariants, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsVariants$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsVariants' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsReuse$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsReuse,
z.ZodTypeDef,
unknown
> = z.object({
active: types.boolean(),
environment: types.string(),
});
export function createFlagFeatureFlagsReuseFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsReuse, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsReuse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsReuse' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsTargets$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsTargets,
z.ZodTypeDef,
unknown
> = z.object({
note: types.optional(types.string()),
value: types.string(),
});
export function createFlagFeatureFlagsTargetsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsTargets, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsTargets$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsTargets' from JSON`,
);
}
/** @internal */
export const CreateFlagType$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagType
> = z.nativeEnum(CreateFlagType);
/** @internal */
export const CreateFlagFeatureFlagsPausedOutcome$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsPausedOutcome,
z.ZodTypeDef,
unknown
> = z.object({
type: CreateFlagType$inboundSchema,
variantId: types.string(),
});
export function createFlagFeatureFlagsPausedOutcomeFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsPausedOutcome, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagFeatureFlagsPausedOutcome$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsPausedOutcome' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType$inboundSchema:
z.ZodNativeEnum<
typeof CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType
> = z.nativeEnum(
CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType,
);
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201Base$inboundSchema:
z.ZodType<
CreateFlagFallthroughFeatureFlagsResponse201Base,
z.ZodTypeDef,
unknown
> = z.object({
type:
CreateFlagFallthroughFeatureFlagsResponse201ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagFallthroughFeatureFlagsResponse201BaseFromJSON(
jsonString: string,
): SafeParseResult<
CreateFlagFallthroughFeatureFlagsResponse201Base,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
CreateFlagFallthroughFeatureFlagsResponse201Base$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'CreateFlagFallthroughFeatureFlagsResponse201Base' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughSlots$inboundSchema: z.ZodType<
CreateFlagFallthroughSlots,
z.ZodTypeDef,
unknown
> = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function createFlagFallthroughSlotsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFallthroughSlots, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFallthroughSlots$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFallthroughSlots' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags3$inboundSchema: z.ZodType<
CreateFlagFallthroughFeatureFlags3,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagFallthroughFeatureFlags3, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagFallthroughFeatureFlags3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFallthroughFeatureFlags3' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponse201Type$inboundSchema:
z.ZodNativeEnum<typeof CreateFlagFallthroughFeatureFlagsResponse201Type> = z
.nativeEnum(CreateFlagFallthroughFeatureFlagsResponse201Type);
/** @internal */
export const CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema:
z.ZodType<
CreateFlagFallthroughFeatureFlagsResponseBase,
z.ZodTypeDef,
unknown
> = z.object({
type: CreateFlagFallthroughFeatureFlagsResponse201Type$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagFallthroughFeatureFlagsResponseBaseFromJSON(
jsonString: string,
): SafeParseResult<
CreateFlagFallthroughFeatureFlagsResponseBase,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'CreateFlagFallthroughFeatureFlagsResponseBase' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags2$inboundSchema: z.ZodType<
CreateFlagFallthroughFeatureFlags2,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("split"),
base: z.lazy(() =>
CreateFlagFallthroughFeatureFlagsResponseBase$inboundSchema
),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function createFlagFallthroughFeatureFlags2FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFallthroughFeatureFlags2, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagFallthroughFeatureFlags2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFallthroughFeatureFlags2' from JSON`,
);
}
/** @internal */
export const CreateFlagFallthroughFeatureFlags1$inboundSchema: z.ZodType<
CreateFlagFallthroughFeatureFlags1,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function createFlagFallthroughFeatureFlags1FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFallthroughFeatureFlags1, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagFallthroughFeatureFlags1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFallthroughFeatureFlags1' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsFallthrough$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsFallthrough,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => CreateFlagFallthroughFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagFallthroughFeatureFlags3$inboundSchema),
]);
export function createFlagFeatureFlagsFallthroughFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsFallthrough, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsFallthrough$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsFallthrough' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType$inboundSchema:
z.ZodNativeEnum<
typeof CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType
> = z.nativeEnum(CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType);
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201Base$inboundSchema:
z.ZodType<
CreateFlagOutcomeFeatureFlagsResponse201Base,
z.ZodTypeDef,
unknown
> = z.object({
type:
CreateFlagOutcomeFeatureFlagsResponse201ApplicationJSONType$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagOutcomeFeatureFlagsResponse201BaseFromJSON(
jsonString: string,
): SafeParseResult<
CreateFlagOutcomeFeatureFlagsResponse201Base,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
CreateFlagOutcomeFeatureFlagsResponse201Base$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'CreateFlagOutcomeFeatureFlagsResponse201Base' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsSlots$inboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlagsSlots,
z.ZodTypeDef,
unknown
> = z.object({
promille: types.number(),
durationMs: types.number(),
});
export function createFlagOutcomeFeatureFlagsSlotsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagOutcomeFeatureFlagsSlots, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagOutcomeFeatureFlagsSlots$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagOutcomeFeatureFlagsSlots' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags3$inboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlags3,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagOutcomeFeatureFlags3, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagOutcomeFeatureFlags3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagOutcomeFeatureFlags3' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponse201Type$inboundSchema:
z.ZodNativeEnum<typeof CreateFlagOutcomeFeatureFlagsResponse201Type> = z
.nativeEnum(CreateFlagOutcomeFeatureFlagsResponse201Type);
/** @internal */
export const CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlagsResponseBase,
z.ZodTypeDef,
unknown
> = z.object({
type: CreateFlagOutcomeFeatureFlagsResponse201Type$inboundSchema,
kind: types.string(),
attribute: types.string(),
});
export function createFlagOutcomeFeatureFlagsResponseBaseFromJSON(
jsonString: string,
): SafeParseResult<
CreateFlagOutcomeFeatureFlagsResponseBase,
SDKValidationError
> {
return safeParse(
jsonString,
(x) =>
CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema.parse(
JSON.parse(x),
),
`Failed to parse 'CreateFlagOutcomeFeatureFlagsResponseBase' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags2$inboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlags2,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("split"),
base: z.lazy(() => CreateFlagOutcomeFeatureFlagsResponseBase$inboundSchema),
weights: z.record(types.number()),
defaultVariantId: types.string(),
});
export function createFlagOutcomeFeatureFlags2FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagOutcomeFeatureFlags2, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagOutcomeFeatureFlags2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagOutcomeFeatureFlags2' from JSON`,
);
}
/** @internal */
export const CreateFlagOutcomeFeatureFlags1$inboundSchema: z.ZodType<
CreateFlagOutcomeFeatureFlags1,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("variant"),
variantId: types.string(),
});
export function createFlagOutcomeFeatureFlags1FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagOutcomeFeatureFlags1, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagOutcomeFeatureFlags1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagOutcomeFeatureFlags1' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsOutcome$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsOutcome,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => CreateFlagOutcomeFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags2$inboundSchema),
z.lazy(() => CreateFlagOutcomeFeatureFlags3$inboundSchema),
]);
export function createFlagFeatureFlagsOutcomeFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsOutcome, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsOutcome$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsOutcome' from JSON`,
);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsResponseType$inboundSchema:
z.ZodNativeEnum<typeof CreateFlagRhsFeatureFlagsResponseType> = z.nativeEnum(
CreateFlagRhsFeatureFlagsResponseType,
);
/** @internal */
export const CreateFlagRhs4$inboundSchema: z.ZodType<
CreateFlagRhs4,
z.ZodTypeDef,
unknown
> = z.object({
type: CreateFlagRhsFeatureFlagsResponseType$inboundSchema,
pattern: types.string(),
flags: types.string(),
});
export function createFlagRhs4FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagRhs4, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagRhs4$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagRhs4' from JSON`,
);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsType$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagRhsFeatureFlagsType
> = z.nativeEnum(CreateFlagRhsFeatureFlagsType);
/** @internal */
export const CreateFlagItemsFeatureFlags2$inboundSchema: z.ZodType<
CreateFlagItemsFeatureFlags2,
z.ZodTypeDef,
unknown
> = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.string(),
});
export function createFlagItemsFeatureFlags2FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagItemsFeatureFlags2, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagItemsFeatureFlags2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagItemsFeatureFlags2' from JSON`,
);
}
/** @internal */
export const CreateFlagItemsFeatureFlags1$inboundSchema: z.ZodType<
CreateFlagItemsFeatureFlags1,
z.ZodTypeDef,
unknown
> = z.object({
label: types.optional(types.string()),
note: types.optional(types.string()),
value: types.number(),
});
export function createFlagItemsFeatureFlags1FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagItemsFeatureFlags1, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagItemsFeatureFlags1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagItemsFeatureFlags1' from JSON`,
);
}
/** @internal */
export const CreateFlagRhsFeatureFlagsItems$inboundSchema: z.ZodType<
CreateFlagRhsFeatureFlagsItems,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => CreateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagItemsFeatureFlags2$inboundSchema),
]);
export function createFlagRhsFeatureFlagsItemsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagRhsFeatureFlagsItems, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagRhsFeatureFlagsItems$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagRhsFeatureFlagsItems' from JSON`,
);
}
/** @internal */
export const CreateFlagRhs3$inboundSchema: z.ZodType<
CreateFlagRhs3,
z.ZodTypeDef,
unknown
> = z.object({
type: CreateFlagRhsFeatureFlagsType$inboundSchema,
items: z.array(
smartUnion([
z.lazy(() => CreateFlagItemsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagItemsFeatureFlags2$inboundSchema),
]),
),
});
export function createFlagRhs3FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagRhs3, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagRhs3$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagRhs3' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsRhs$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsRhs,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => CreateFlagRhs4$inboundSchema),
z.lazy(() => CreateFlagRhs3$inboundSchema),
types.string(),
types.number(),
types.boolean(),
]);
export function createFlagFeatureFlagsRhsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsRhs, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsRhs$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsRhs' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsCmpOptions$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsCmpOptions,
z.ZodTypeDef,
unknown
> = z.object({
ignoreCase: types.optional(types.boolean()),
});
export function createFlagFeatureFlagsCmpOptionsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsCmpOptions, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsCmpOptions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsCmpOptions' from JSON`,
);
}
/** @internal */
export const CreateFlagLhsFeatureFlags2$inboundSchema: z.ZodType<
CreateFlagLhsFeatureFlags2,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("entity"),
kind: types.string(),
attribute: types.string(),
});
export function createFlagLhsFeatureFlags2FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagLhsFeatureFlags2, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagLhsFeatureFlags2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagLhsFeatureFlags2' from JSON`,
);
}
/** @internal */
export const CreateFlagLhsFeatureFlags1$inboundSchema: z.ZodType<
CreateFlagLhsFeatureFlags1,
z.ZodTypeDef,
unknown
> = z.object({
type: types.literal("segment"),
});
export function createFlagLhsFeatureFlags1FromJSON(
jsonString: string,
): SafeParseResult<CreateFlagLhsFeatureFlags1, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagLhsFeatureFlags1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagLhsFeatureFlags1' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsLhs$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsLhs,
z.ZodTypeDef,
unknown
> = z.union([
z.lazy(() => CreateFlagLhsFeatureFlags1$inboundSchema),
z.lazy(() => CreateFlagLhsFeatureFlags2$inboundSchema),
]);
export function createFlagFeatureFlagsLhsFromJSON(
jsonString: string,
): SafeParseResult<CreateFlagFeatureFlagsLhs, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsLhs$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsLhs' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsCmp$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagFeatureFlagsCmp
> = z.nativeEnum(CreateFlagFeatureFlagsCmp);
/** @internal */
export const CreateFlagFeatureFlagsConditions$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsConditions,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagFeatureFlagsConditions, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsConditions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsConditions' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsRules$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsRules,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagFeatureFlagsRules, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagFeatureFlagsRules$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsRules' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsEnvironments$inboundSchema: z.ZodType<
CreateFlagFeatureFlagsEnvironments,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagFeatureFlagsEnvironments, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
CreateFlagFeatureFlagsEnvironments$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagFeatureFlagsEnvironments' from JSON`,
);
}
/** @internal */
export const CreateFlagFeatureFlagsKind$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagFeatureFlagsKind
> = z.nativeEnum(CreateFlagFeatureFlagsKind);
/** @internal */
export const CreateFlagFeatureFlagsState$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagFeatureFlagsState
> = z.nativeEnum(CreateFlagFeatureFlagsState);
/** @internal */
export const CreateFlagTypeName$inboundSchema: z.ZodNativeEnum<
typeof CreateFlagTypeName
> = z.nativeEnum(CreateFlagTypeName);
/** @internal */
export const CreateFlagResponseBody$inboundSchema: z.ZodType<
CreateFlagResponseBody,
z.ZodTypeDef,
unknown
> = 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: string,
): SafeParseResult<CreateFlagResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreateFlagResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreateFlagResponseBody' from JSON`,
);
}