/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomControlsMetadataResponseDto, CustomControlsMetadataResponseDto$inboundSchema, } from "./customcontrolsmetadataresponsedto.js"; import { ResourceOriginEnum, ResourceOriginEnum$inboundSchema, } from "./resourceoriginenum.js"; import { StepIssuesDto, StepIssuesDto$inboundSchema } from "./stepissuesdto.js"; /** * Control values for the custom step */ export type CustomStepResponseDtoControlValues = { /** * Custom control values for the step. */ custom?: { [k: string]: any } | undefined; additionalProperties?: { [k: string]: any } | undefined; }; export type CustomStepResponseDto = { /** * Controls metadata for the custom step */ controls: CustomControlsMetadataResponseDto; /** * Control values for the custom step */ controlValues?: CustomStepResponseDtoControlValues | 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: "custom"; /** * 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 CustomStepResponseDtoControlValues$inboundSchema: z.ZodType< CustomStepResponseDtoControlValues, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ custom: z.record(z.any()).optional(), }).catchall(z.any()), "additionalProperties", true, ); export function customStepResponseDtoControlValuesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomStepResponseDtoControlValues$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomStepResponseDtoControlValues' from JSON`, ); } /** @internal */ export const CustomStepResponseDto$inboundSchema: z.ZodType< CustomStepResponseDto, z.ZodTypeDef, unknown > = z.object({ controls: CustomControlsMetadataResponseDto$inboundSchema, controlValues: z.lazy(() => CustomStepResponseDtoControlValues$inboundSchema) .optional(), variables: z.record(z.any()), stepId: z.string(), _id: z.string(), name: z.string(), slug: z.string(), type: z.literal("custom"), 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 customStepResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomStepResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomStepResponseDto' from JSON`, ); }