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