/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: afee1e10cc99 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { ScheduleCalendar, ScheduleCalendar$Outbound, ScheduleCalendar$outboundSchema, } from "./schedulecalendar.js"; import { ScheduleInterval, ScheduleInterval$Outbound, ScheduleInterval$outboundSchema, } from "./scheduleinterval.js"; import { SchedulePolicy, SchedulePolicy$Outbound, SchedulePolicy$outboundSchema, } from "./schedulepolicy.js"; /** * Schedule definition for partial updates. * * @remarks * * All fields are optional (inherited from _ScheduleRequestBase). Only explicitly-set * fields are applied during an update; unset fields preserve the existing schedule values. */ export type PartialScheduleDefinition = { /** * Input to provide to the workflow when starting it. */ input?: any | undefined; /** * Calendar-based specification of times. */ calendars?: Array | undefined; /** * Interval-based specification of times. */ intervals?: Array | undefined; /** * Cron-based specification of times. */ cronExpressions?: Array | undefined; /** * Set of calendar times to skip. */ skip?: Array | undefined; /** * Time after which the first action may be run. */ startAt?: Date | null | undefined; /** * Time after which no more actions will be run. */ endAt?: Date | null | undefined; /** * Jitter to apply each action. * * @remarks * * An action's scheduled time will be incremented by a random value between 0 * and this value if present (but not past the next schedule). */ jitter?: string | null | undefined; /** * IANA time zone name, for example ``US/Central``. */ timeZoneName?: string | null | undefined; policy?: SchedulePolicy | undefined; /** * Maximum number of times this schedule will trigger a workflow execution. Once this limit is reached, no further executions are triggered automatically. null means unlimited. */ maxExecutions?: number | null | undefined; }; /** @internal */ export type PartialScheduleDefinition$Outbound = { input?: any | undefined; calendars?: Array | undefined; intervals?: Array | undefined; cron_expressions?: Array | undefined; skip?: Array | undefined; start_at?: string | null | undefined; end_at?: string | null | undefined; jitter?: string | null | undefined; time_zone_name?: string | null | undefined; policy?: SchedulePolicy$Outbound | undefined; max_executions?: number | null | undefined; }; /** @internal */ export const PartialScheduleDefinition$outboundSchema: z.ZodType< PartialScheduleDefinition$Outbound, PartialScheduleDefinition > = z.object({ input: z.any().optional(), calendars: z.array(ScheduleCalendar$outboundSchema).optional(), intervals: z.array(ScheduleInterval$outboundSchema).optional(), cronExpressions: z.array(z.string()).optional(), skip: z.array(ScheduleCalendar$outboundSchema).optional(), startAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), endAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), jitter: z.nullable(z.string()).optional(), timeZoneName: z.nullable(z.string()).optional(), policy: SchedulePolicy$outboundSchema.optional(), maxExecutions: z.nullable(z.int()).optional(), }).transform((v) => { return remap$(v, { cronExpressions: "cron_expressions", startAt: "start_at", endAt: "end_at", timeZoneName: "time_zone_name", maxExecutions: "max_executions", }); }); export function partialScheduleDefinitionToJSON( partialScheduleDefinition: PartialScheduleDefinition, ): string { return JSON.stringify( PartialScheduleDefinition$outboundSchema.parse(partialScheduleDefinition), ); }