/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { collectExtraKeys as collectExtraKeys$, 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"; import { DelayControlsMetadataResponseDto, DelayControlsMetadataResponseDto$inboundSchema, } from "./delaycontrolsmetadataresponsedto.js"; import { ResourceOriginEnum, ResourceOriginEnum$inboundSchema, } from "./resourceoriginenum.js"; import { StepIssuesDto, StepIssuesDto$inboundSchema } from "./stepissuesdto.js"; /** * Type of the delay. Currently only 'regular' is supported by the schema. */ export const DelayStepResponseDtoType = { Regular: "regular", Timed: "timed", } as const; /** * Type of the delay. Currently only 'regular' is supported by the schema. */ export type DelayStepResponseDtoType = ClosedEnum< typeof DelayStepResponseDtoType >; /** * Unit of time for the delay amount. */ export const DelayStepResponseDtoUnit = { Seconds: "seconds", Minutes: "minutes", Hours: "hours", Days: "days", Weeks: "weeks", Months: "months", } as const; /** * Unit of time for the delay amount. */ export type DelayStepResponseDtoUnit = ClosedEnum< typeof DelayStepResponseDtoUnit >; /** * Control values for the delay step */ export type DelayStepResponseDtoControlValues = { /** * 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: DelayStepResponseDtoType; /** * Amount of time to delay. */ amount?: number | undefined; /** * Unit of time for the delay amount. */ unit?: DelayStepResponseDtoUnit | undefined; /** * Cron expression for the delay. Min length 1. */ cron?: string | undefined; additionalProperties?: { [k: string]: any } | undefined; }; export type DelayStepResponseDto = { /** * Controls metadata for the delay step */ controls: DelayControlsMetadataResponseDto; /** * Control values for the delay step */ controlValues?: DelayStepResponseDtoControlValues | undefined; /** * JSON Schema for variables, follows the JSON Schema standard */ variables: { [k: string]: any }; /** * Unique identifier of the step */ stepId: string; /** * Database identifier of the step */ id: string; /** * Name of the step */ name: string; /** * Slug of the step */ slug: string; /** * Type of the step */ type: "delay"; /** * Origin of the layout */ origin: ResourceOriginEnum; /** * Workflow identifier */ workflowId: string; /** * Workflow database identifier */ workflowDatabaseId: string; /** * Issues associated with the step */ issues?: StepIssuesDto | undefined; /** * Hash identifying the deployed Cloudflare Worker for this step */ stepResolverHash?: string | undefined; }; /** @internal */ export const DelayStepResponseDtoType$inboundSchema: z.ZodNativeEnum< typeof DelayStepResponseDtoType > = z.nativeEnum(DelayStepResponseDtoType); /** @internal */ export const DelayStepResponseDtoUnit$inboundSchema: z.ZodNativeEnum< typeof DelayStepResponseDtoUnit > = z.nativeEnum(DelayStepResponseDtoUnit); /** @internal */ export const DelayStepResponseDtoControlValues$inboundSchema: z.ZodType< DelayStepResponseDtoControlValues, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ skip: z.record(z.any()).optional(), type: DelayStepResponseDtoType$inboundSchema.default("regular"), amount: z.number().optional(), unit: DelayStepResponseDtoUnit$inboundSchema.optional(), cron: z.string().optional(), }).catchall(z.any()), "additionalProperties", true, ); export function delayStepResponseDtoControlValuesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DelayStepResponseDtoControlValues$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DelayStepResponseDtoControlValues' from JSON`, ); } /** @internal */ export const DelayStepResponseDto$inboundSchema: z.ZodType< DelayStepResponseDto, z.ZodTypeDef, unknown > = z.object({ controls: DelayControlsMetadataResponseDto$inboundSchema, controlValues: z.lazy(() => DelayStepResponseDtoControlValues$inboundSchema) .optional(), variables: z.record(z.any()), stepId: z.string(), _id: z.string(), name: z.string(), slug: z.string(), type: z.literal("delay"), origin: ResourceOriginEnum$inboundSchema, workflowId: z.string(), workflowDatabaseId: z.string(), issues: StepIssuesDto$inboundSchema.optional(), stepResolverHash: z.string().optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function delayStepResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DelayStepResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DelayStepResponseDto' from JSON`, ); }