/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0806f4f5400c */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ScheduleCalendar, ScheduleCalendar$inboundSchema, } from "./schedulecalendar.js"; import { ScheduleInterval, ScheduleInterval$inboundSchema, } from "./scheduleinterval.js"; import { SchedulePolicy, SchedulePolicy$inboundSchema, } from "./schedulepolicy.js"; /** * Output representation of a schedule with required schedule_id. * * @remarks * * Used when returning schedules from the API where schedule_id is always present. */ export type ScheduleDefinitionOutput = { /** * Input to provide to the workflow when starting it. */ input: any; /** * 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; /** * Unique identifier for the schedule. */ scheduleId: string; }; /** @internal */ export const ScheduleDefinitionOutput$inboundSchema: z.ZodType< ScheduleDefinitionOutput, unknown > = z.object({ input: z.any(), calendars: z.array(ScheduleCalendar$inboundSchema).optional(), intervals: z.array(ScheduleInterval$inboundSchema).optional(), cron_expressions: z.array(z.string()).optional(), skip: z.array(ScheduleCalendar$inboundSchema).optional(), start_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), end_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), jitter: z.nullable(z.string()).optional(), time_zone_name: z.nullable(z.string()).optional(), policy: SchedulePolicy$inboundSchema.optional(), schedule_id: z.string(), }).transform((v) => { return remap$(v, { "cron_expressions": "cronExpressions", "start_at": "startAt", "end_at": "endAt", "time_zone_name": "timeZoneName", "schedule_id": "scheduleId", }); }); export function scheduleDefinitionOutputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduleDefinitionOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduleDefinitionOutput' from JSON`, ); }