/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Type of the delay. Currently only 'regular' is supported by the schema. */ export const Type = { Regular: "regular", Timed: "timed", } as const; /** * Type of the delay. Currently only 'regular' is supported by the schema. */ export type Type = ClosedEnum; /** * Unit of time for the delay amount. */ export const Unit = { Seconds: "seconds", Minutes: "minutes", Hours: "hours", Days: "days", Weeks: "weeks", Months: "months", } as const; /** * Unit of time for the delay amount. */ export type Unit = ClosedEnum; export type DelayControlDto = { /** * JSONLogic filter conditions for conditionally skipping the step execution. Supports complex logical operations with AND, OR, and comparison operators. See https://jsonlogic.com/ for full typing reference. */ skip?: { [k: string]: any } | undefined; /** * Type of the delay. Currently only 'regular' is supported by the schema. */ type?: Type | undefined; /** * Amount of time to delay. */ amount?: number | undefined; /** * Unit of time for the delay amount. */ unit?: Unit | undefined; /** * Cron expression for the delay. Min length 1. */ cron?: string | undefined; }; /** @internal */ export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Type, ); /** @internal */ export const Type$outboundSchema: z.ZodNativeEnum = Type$inboundSchema; /** @internal */ export const Unit$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Unit, ); /** @internal */ export const Unit$outboundSchema: z.ZodNativeEnum = Unit$inboundSchema; /** @internal */ export const DelayControlDto$inboundSchema: z.ZodType< DelayControlDto, z.ZodTypeDef, unknown > = z.object({ skip: z.record(z.any()).optional(), type: Type$inboundSchema.default("regular"), amount: z.number().optional(), unit: Unit$inboundSchema.optional(), cron: z.string().optional(), }); /** @internal */ export type DelayControlDto$Outbound = { skip?: { [k: string]: any } | undefined; type: string; amount?: number | undefined; unit?: string | undefined; cron?: string | undefined; }; /** @internal */ export const DelayControlDto$outboundSchema: z.ZodType< DelayControlDto$Outbound, z.ZodTypeDef, DelayControlDto > = z.object({ skip: z.record(z.any()).optional(), type: Type$outboundSchema.default("regular"), amount: z.number().optional(), unit: Unit$outboundSchema.optional(), cron: z.string().optional(), }); export function delayControlDtoToJSON( delayControlDto: DelayControlDto, ): string { return JSON.stringify(DelayControlDto$outboundSchema.parse(delayControlDto)); } export function delayControlDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DelayControlDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DelayControlDto' from JSON`, ); }