/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type DynamicConfigCreateDtoTargetValue = Array | Array | string | number; export const DynamicConfigCreateDtoType = { AppVersion: "app_version", BrowserName: "browser_name", BrowserVersion: "browser_version", Country: "country", CustomField: "custom_field", Email: "email", EnvironmentTier: "environment_tier", FailsGate: "fails_gate", FailsSegment: "fails_segment", IpAddress: "ip_address", Locale: "locale", OsName: "os_name", OsVersion: "os_version", PassesGate: "passes_gate", PassesSegment: "passes_segment", Public: "public", Time: "time", UnitId: "unit_id", UserId: "user_id", Url: "url", Javascript: "javascript", DeviceModel: "device_model", TargetApp: "target_app", } as const; export type DynamicConfigCreateDtoType = ClosedEnum; export type DynamicConfigCreateDtoConditions = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: DynamicConfigCreateDtoType; }; export type Rules = { /** * The name of this rule. */ name: string; /** * Of the users that meet the conditions of this rule, what percent should return true. */ passPercentage: number; /** * An array of Condition objects. */ conditions: Array; environments?: Array | null | undefined; /** * The Statsig ID of this rule. */ id?: string | undefined; /** * The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout */ baseID?: string | undefined; returnValue?: { [k: string]: any } | undefined; returnValueJson5?: string | undefined; }; export type TargetApps = string | Array; export type DynamicConfigCreateDto = { /** * Is the dynamic config enabled */ isEnabled?: boolean | undefined; description?: string | undefined; /** * An array of Rule objects */ rules?: Array | undefined; /** * The fallback JSON object when no rules are triggered */ defaultValue?: { [k: string]: any } | undefined; /** * Can include comments. If provided with defaultValue, must parse to the same JSON */ defaultValueJson5?: string | undefined; /** * The type of ID which the dynamic config is based on. */ idType?: string | undefined; /** * The list of tag names attached to the dynamic config */ tags?: Array | undefined; creatorID?: any | null | undefined; creatorEmail?: any | null | undefined; /** * A schema using JSON Schema Draft 2020-12 to enforce return values of this dynamic config's rules. */ schema?: any | null | undefined; /** * `schema` except with Json5 comments. Optional and should parse to same json as `schema`. */ schemaJson5?: any | null | undefined; targetApps?: string | Array | undefined; team?: any | null | undefined; name: string; id?: string | undefined; }; /** @internal */ export const DynamicConfigCreateDtoTargetValue$inboundSchema: z.ZodType< DynamicConfigCreateDtoTargetValue, z.ZodTypeDef, unknown > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** @internal */ export type DynamicConfigCreateDtoTargetValue$Outbound = | Array | Array | string | number; /** @internal */ export const DynamicConfigCreateDtoTargetValue$outboundSchema: z.ZodType< DynamicConfigCreateDtoTargetValue$Outbound, z.ZodTypeDef, DynamicConfigCreateDtoTargetValue > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigCreateDtoTargetValue$ { /** @deprecated use `DynamicConfigCreateDtoTargetValue$inboundSchema` instead. */ export const inboundSchema = DynamicConfigCreateDtoTargetValue$inboundSchema; /** @deprecated use `DynamicConfigCreateDtoTargetValue$outboundSchema` instead. */ export const outboundSchema = DynamicConfigCreateDtoTargetValue$outboundSchema; /** @deprecated use `DynamicConfigCreateDtoTargetValue$Outbound` instead. */ export type Outbound = DynamicConfigCreateDtoTargetValue$Outbound; } /** @internal */ export const DynamicConfigCreateDtoType$inboundSchema: z.ZodNativeEnum< typeof DynamicConfigCreateDtoType > = z.nativeEnum(DynamicConfigCreateDtoType); /** @internal */ export const DynamicConfigCreateDtoType$outboundSchema: z.ZodNativeEnum< typeof DynamicConfigCreateDtoType > = DynamicConfigCreateDtoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigCreateDtoType$ { /** @deprecated use `DynamicConfigCreateDtoType$inboundSchema` instead. */ export const inboundSchema = DynamicConfigCreateDtoType$inboundSchema; /** @deprecated use `DynamicConfigCreateDtoType$outboundSchema` instead. */ export const outboundSchema = DynamicConfigCreateDtoType$outboundSchema; } /** @internal */ export const DynamicConfigCreateDtoConditions$inboundSchema: z.ZodType< DynamicConfigCreateDtoConditions, z.ZodTypeDef, unknown > = z.object({ targetValue: z .nullable(z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()])) .optional(), operator: z.string().optional(), field: z.nullable(z.any()).optional(), customID: z.nullable(z.any()).optional(), type: DynamicConfigCreateDtoType$inboundSchema, }); /** @internal */ export type DynamicConfigCreateDtoConditions$Outbound = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: string; }; /** @internal */ export const DynamicConfigCreateDtoConditions$outboundSchema: z.ZodType< DynamicConfigCreateDtoConditions$Outbound, z.ZodTypeDef, DynamicConfigCreateDtoConditions > = z.object({ targetValue: z .nullable(z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()])) .optional(), operator: z.string().optional(), field: z.nullable(z.any()).optional(), customID: z.nullable(z.any()).optional(), type: DynamicConfigCreateDtoType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigCreateDtoConditions$ { /** @deprecated use `DynamicConfigCreateDtoConditions$inboundSchema` instead. */ export const inboundSchema = DynamicConfigCreateDtoConditions$inboundSchema; /** @deprecated use `DynamicConfigCreateDtoConditions$outboundSchema` instead. */ export const outboundSchema = DynamicConfigCreateDtoConditions$outboundSchema; /** @deprecated use `DynamicConfigCreateDtoConditions$Outbound` instead. */ export type Outbound = DynamicConfigCreateDtoConditions$Outbound; } /** @internal */ export const Rules$inboundSchema: z.ZodType = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => DynamicConfigCreateDtoConditions$inboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), returnValue: z.record(z.any()).optional(), returnValueJson5: z.string().optional(), }); /** @internal */ export type Rules$Outbound = { name: string; passPercentage: number; conditions: Array; environments?: Array | null | undefined; id?: string | undefined; baseID?: string | undefined; returnValue?: { [k: string]: any } | undefined; returnValueJson5?: string | undefined; }; /** @internal */ export const Rules$outboundSchema: z.ZodType = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => DynamicConfigCreateDtoConditions$outboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), returnValue: z.record(z.any()).optional(), returnValueJson5: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Rules$ { /** @deprecated use `Rules$inboundSchema` instead. */ export const inboundSchema = Rules$inboundSchema; /** @deprecated use `Rules$outboundSchema` instead. */ export const outboundSchema = Rules$outboundSchema; /** @deprecated use `Rules$Outbound` instead. */ export type Outbound = Rules$Outbound; } /** @internal */ export const TargetApps$inboundSchema: z.ZodType = z.union([ z.string(), z.array(z.string()), ]); /** @internal */ export type TargetApps$Outbound = string | Array; /** @internal */ export const TargetApps$outboundSchema: z.ZodType = z.union([z.string(), z.array(z.string())]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TargetApps$ { /** @deprecated use `TargetApps$inboundSchema` instead. */ export const inboundSchema = TargetApps$inboundSchema; /** @deprecated use `TargetApps$outboundSchema` instead. */ export const outboundSchema = TargetApps$outboundSchema; /** @deprecated use `TargetApps$Outbound` instead. */ export type Outbound = TargetApps$Outbound; } /** @internal */ export const DynamicConfigCreateDto$inboundSchema: z.ZodType< DynamicConfigCreateDto, z.ZodTypeDef, unknown > = z.object({ isEnabled: z.boolean().default(true), description: z.string().optional(), rules: z.array(z.lazy(() => Rules$inboundSchema)).optional(), defaultValue: z.record(z.any()).optional(), defaultValueJson5: z.string().optional(), idType: z.string().optional(), tags: z.array(z.string()).optional(), creatorID: z.nullable(z.any()).optional(), creatorEmail: z.nullable(z.any()).optional(), schema: z.nullable(z.any()).optional(), schemaJson5: z.nullable(z.any()).optional(), targetApps: z.union([z.string(), z.array(z.string())]).optional(), team: z.nullable(z.any()).optional(), name: z.string(), id: z.string().optional(), }); /** @internal */ export type DynamicConfigCreateDto$Outbound = { isEnabled: boolean; description?: string | undefined; rules?: Array | undefined; defaultValue?: { [k: string]: any } | undefined; defaultValueJson5?: string | undefined; idType?: string | undefined; tags?: Array | undefined; creatorID?: any | null | undefined; creatorEmail?: any | null | undefined; schema?: any | null | undefined; schemaJson5?: any | null | undefined; targetApps?: string | Array | undefined; team?: any | null | undefined; name: string; id?: string | undefined; }; /** @internal */ export const DynamicConfigCreateDto$outboundSchema: z.ZodType< DynamicConfigCreateDto$Outbound, z.ZodTypeDef, DynamicConfigCreateDto > = z.object({ isEnabled: z.boolean().default(true), description: z.string().optional(), rules: z.array(z.lazy(() => Rules$outboundSchema)).optional(), defaultValue: z.record(z.any()).optional(), defaultValueJson5: z.string().optional(), idType: z.string().optional(), tags: z.array(z.string()).optional(), creatorID: z.nullable(z.any()).optional(), creatorEmail: z.nullable(z.any()).optional(), schema: z.nullable(z.any()).optional(), schemaJson5: z.nullable(z.any()).optional(), targetApps: z.union([z.string(), z.array(z.string())]).optional(), team: z.nullable(z.any()).optional(), name: z.string(), id: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigCreateDto$ { /** @deprecated use `DynamicConfigCreateDto$inboundSchema` instead. */ export const inboundSchema = DynamicConfigCreateDto$inboundSchema; /** @deprecated use `DynamicConfigCreateDto$outboundSchema` instead. */ export const outboundSchema = DynamicConfigCreateDto$outboundSchema; /** @deprecated use `DynamicConfigCreateDto$Outbound` instead. */ export type Outbound = DynamicConfigCreateDto$Outbound; }