/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type RuleDtoTargetValue = Array | Array | string | number; export const RuleDtoType = { 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 RuleDtoType = ClosedEnum; export type RuleDtoConditions = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: RuleDtoType; }; export type RuleDto = { /** * 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; /** * The environments this rule is enabled for. */ 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; }; /** @internal */ export const RuleDtoTargetValue$inboundSchema: z.ZodType< RuleDtoTargetValue, z.ZodTypeDef, unknown > = z.union([z.array(z.string()), z.array(z.number()), z.string(), z.number()]); /** @internal */ export type RuleDtoTargetValue$Outbound = Array | Array | string | number; /** @internal */ export const RuleDtoTargetValue$outboundSchema: z.ZodType< RuleDtoTargetValue$Outbound, z.ZodTypeDef, RuleDtoTargetValue > = 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 RuleDtoTargetValue$ { /** @deprecated use `RuleDtoTargetValue$inboundSchema` instead. */ export const inboundSchema = RuleDtoTargetValue$inboundSchema; /** @deprecated use `RuleDtoTargetValue$outboundSchema` instead. */ export const outboundSchema = RuleDtoTargetValue$outboundSchema; /** @deprecated use `RuleDtoTargetValue$Outbound` instead. */ export type Outbound = RuleDtoTargetValue$Outbound; } /** @internal */ export const RuleDtoType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(RuleDtoType); /** @internal */ export const RuleDtoType$outboundSchema: z.ZodNativeEnum = RuleDtoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RuleDtoType$ { /** @deprecated use `RuleDtoType$inboundSchema` instead. */ export const inboundSchema = RuleDtoType$inboundSchema; /** @deprecated use `RuleDtoType$outboundSchema` instead. */ export const outboundSchema = RuleDtoType$outboundSchema; } /** @internal */ export const RuleDtoConditions$inboundSchema: z.ZodType = 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: RuleDtoType$inboundSchema, }); /** @internal */ export type RuleDtoConditions$Outbound = { targetValue?: Array | Array | string | number | null | undefined; operator?: string | undefined; field?: any | null | undefined; customID?: any | null | undefined; type: string; }; /** @internal */ export const RuleDtoConditions$outboundSchema: z.ZodType< RuleDtoConditions$Outbound, z.ZodTypeDef, RuleDtoConditions > = 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: RuleDtoType$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RuleDtoConditions$ { /** @deprecated use `RuleDtoConditions$inboundSchema` instead. */ export const inboundSchema = RuleDtoConditions$inboundSchema; /** @deprecated use `RuleDtoConditions$outboundSchema` instead. */ export const outboundSchema = RuleDtoConditions$outboundSchema; /** @deprecated use `RuleDtoConditions$Outbound` instead. */ export type Outbound = RuleDtoConditions$Outbound; } /** @internal */ export const RuleDto$inboundSchema: z.ZodType = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => RuleDtoConditions$inboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: z.string().optional(), }); /** @internal */ export type RuleDto$Outbound = { name: string; passPercentage: number; conditions: Array; environments?: Array | null | undefined; id?: string | undefined; baseID?: string | undefined; }; /** @internal */ export const RuleDto$outboundSchema: z.ZodType = z.object({ name: z.string(), passPercentage: z.number(), conditions: z.array(z.lazy(() => RuleDtoConditions$outboundSchema)), environments: z.nullable(z.array(z.string())).optional(), id: z.string().optional(), baseID: 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 RuleDto$ { /** @deprecated use `RuleDto$inboundSchema` instead. */ export const inboundSchema = RuleDto$inboundSchema; /** @deprecated use `RuleDto$outboundSchema` instead. */ export const outboundSchema = RuleDto$outboundSchema; /** @deprecated use `RuleDto$Outbound` instead. */ export type Outbound = RuleDto$Outbound; }