/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type DynamicConfigDtoTargetValue = Array | Array | string | number; export const DynamicConfigDtoType = { 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 DynamicConfigDtoType = ClosedEnum; export type DynamicConfigDtoConditions = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: DynamicConfigDtoType; }; export type DynamicConfigDtoRules = { /** * 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 DynamicConfigDtoTargetApps = string | Array; export type DynamicConfigDto = { /** * Is the dynamic config enabled */ isEnabled?: boolean | undefined; /** * A brief summary of what the dynamic config is being used for */ description: string; /** * An array of Rule objects */ rules: Array; /** * 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; }; /** @internal */ export const DynamicConfigDtoTargetValue$inboundSchema: z.ZodType< DynamicConfigDtoTargetValue, z.ZodTypeDef, unknown > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** @internal */ export type DynamicConfigDtoTargetValue$Outbound = Array | Array | string | number; /** @internal */ export const DynamicConfigDtoTargetValue$outboundSchema: z.ZodType< DynamicConfigDtoTargetValue$Outbound, z.ZodTypeDef, DynamicConfigDtoTargetValue > = 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 DynamicConfigDtoTargetValue$ { /** @deprecated use `DynamicConfigDtoTargetValue$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDtoTargetValue$inboundSchema; /** @deprecated use `DynamicConfigDtoTargetValue$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDtoTargetValue$outboundSchema; /** @deprecated use `DynamicConfigDtoTargetValue$Outbound` instead. */ export type Outbound = DynamicConfigDtoTargetValue$Outbound; } /** @internal */ export const DynamicConfigDtoType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(DynamicConfigDtoType); /** @internal */ export const DynamicConfigDtoType$outboundSchema: z.ZodNativeEnum = DynamicConfigDtoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigDtoType$ { /** @deprecated use `DynamicConfigDtoType$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDtoType$inboundSchema; /** @deprecated use `DynamicConfigDtoType$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDtoType$outboundSchema; } /** @internal */ export const DynamicConfigDtoConditions$inboundSchema: z.ZodType< DynamicConfigDtoConditions, 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: DynamicConfigDtoType$inboundSchema, }); /** @internal */ export type DynamicConfigDtoConditions$Outbound = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: string; }; /** @internal */ export const DynamicConfigDtoConditions$outboundSchema: z.ZodType< DynamicConfigDtoConditions$Outbound, z.ZodTypeDef, DynamicConfigDtoConditions > = 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: DynamicConfigDtoType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigDtoConditions$ { /** @deprecated use `DynamicConfigDtoConditions$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDtoConditions$inboundSchema; /** @deprecated use `DynamicConfigDtoConditions$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDtoConditions$outboundSchema; /** @deprecated use `DynamicConfigDtoConditions$Outbound` instead. */ export type Outbound = DynamicConfigDtoConditions$Outbound; } /** @internal */ export const DynamicConfigDtoRules$inboundSchema: z.ZodType< DynamicConfigDtoRules, z.ZodTypeDef, unknown > = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => DynamicConfigDtoConditions$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 DynamicConfigDtoRules$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 DynamicConfigDtoRules$outboundSchema: z.ZodType< DynamicConfigDtoRules$Outbound, z.ZodTypeDef, DynamicConfigDtoRules > = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => DynamicConfigDtoConditions$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 DynamicConfigDtoRules$ { /** @deprecated use `DynamicConfigDtoRules$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDtoRules$inboundSchema; /** @deprecated use `DynamicConfigDtoRules$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDtoRules$outboundSchema; /** @deprecated use `DynamicConfigDtoRules$Outbound` instead. */ export type Outbound = DynamicConfigDtoRules$Outbound; } /** @internal */ export const DynamicConfigDtoTargetApps$inboundSchema: z.ZodType< DynamicConfigDtoTargetApps, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.string())]); /** @internal */ export type DynamicConfigDtoTargetApps$Outbound = string | Array; /** @internal */ export const DynamicConfigDtoTargetApps$outboundSchema: z.ZodType< DynamicConfigDtoTargetApps$Outbound, z.ZodTypeDef, DynamicConfigDtoTargetApps > = 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 DynamicConfigDtoTargetApps$ { /** @deprecated use `DynamicConfigDtoTargetApps$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDtoTargetApps$inboundSchema; /** @deprecated use `DynamicConfigDtoTargetApps$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDtoTargetApps$outboundSchema; /** @deprecated use `DynamicConfigDtoTargetApps$Outbound` instead. */ export type Outbound = DynamicConfigDtoTargetApps$Outbound; } /** @internal */ export const DynamicConfigDto$inboundSchema: z.ZodType = z.object({ isEnabled: z.boolean().default(true), description: z.string(), rules: z.array(z.lazy(() => DynamicConfigDtoRules$inboundSchema)), 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(), }); /** @internal */ export type DynamicConfigDto$Outbound = { isEnabled: boolean; description: string; rules: Array; 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; }; /** @internal */ export const DynamicConfigDto$outboundSchema: z.ZodType< DynamicConfigDto$Outbound, z.ZodTypeDef, DynamicConfigDto > = z.object({ isEnabled: z.boolean().default(true), description: z.string(), rules: z.array(z.lazy(() => DynamicConfigDtoRules$outboundSchema)), 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(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DynamicConfigDto$ { /** @deprecated use `DynamicConfigDto$inboundSchema` instead. */ export const inboundSchema = DynamicConfigDto$inboundSchema; /** @deprecated use `DynamicConfigDto$outboundSchema` instead. */ export const outboundSchema = DynamicConfigDto$outboundSchema; /** @deprecated use `DynamicConfigDto$Outbound` instead. */ export type Outbound = DynamicConfigDto$Outbound; }