/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DelayRegularMetadata, DelayRegularMetadata$inboundSchema, } from "./delayregularmetadata.js"; import { DelayScheduledMetadata, DelayScheduledMetadata$inboundSchema, } from "./delayscheduledmetadata.js"; import { DigestRegularMetadata, DigestRegularMetadata$inboundSchema, } from "./digestregularmetadata.js"; import { DigestTimedMetadata, DigestTimedMetadata$inboundSchema, } from "./digesttimedmetadata.js"; import { MessageTemplate, MessageTemplate$inboundSchema, } from "./messagetemplate.js"; import { NotificationStepData, NotificationStepData$inboundSchema, } from "./notificationstepdata.js"; import { ReplyCallback, ReplyCallback$inboundSchema } from "./replycallback.js"; import { StepFilterDto, StepFilterDto$inboundSchema } from "./stepfilterdto.js"; /** * Metadata associated with the workflow step. Can vary based on the type of step. */ export type Metadata = | DelayScheduledMetadata | DigestRegularMetadata | DigestTimedMetadata | DelayRegularMetadata; export type NotificationStepDto = { /** * Unique identifier for the notification step. */ id?: string | undefined; /** * Universally unique identifier for the notification step. */ uuid?: string | undefined; /** * Name of the notification step. */ name?: string | undefined; /** * ID of the template associated with this notification step. */ templateId?: string | undefined; /** * Indicates whether the notification step is active. */ active?: boolean | undefined; /** * Determines if the process should stop on failure. */ shouldStopOnFail?: boolean | undefined; /** * Message template used in this notification step. */ template?: MessageTemplate | undefined; /** * Filters applied to this notification step. */ filters?: Array | undefined; /** * ID of the parent notification step, if applicable. */ parentId?: string | undefined; /** * Metadata associated with the workflow step. Can vary based on the type of step. */ metadata?: | DelayScheduledMetadata | DigestRegularMetadata | DigestTimedMetadata | DelayRegularMetadata | undefined; /** * Callback information for replies, including whether it is active and the callback URL. */ replyCallback?: ReplyCallback | undefined; variants?: Array | undefined; }; /** @internal */ export const Metadata$inboundSchema: z.ZodType< Metadata, z.ZodTypeDef, unknown > = z.union([ DelayScheduledMetadata$inboundSchema, DigestRegularMetadata$inboundSchema, DigestTimedMetadata$inboundSchema, DelayRegularMetadata$inboundSchema, ]); export function metadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Metadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Metadata' from JSON`, ); } /** @internal */ export const NotificationStepDto$inboundSchema: z.ZodType< NotificationStepDto, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), uuid: z.string().optional(), name: z.string().optional(), _templateId: z.string().optional(), active: z.boolean().optional(), shouldStopOnFail: z.boolean().optional(), template: MessageTemplate$inboundSchema.optional(), filters: z.array(StepFilterDto$inboundSchema).optional(), _parentId: z.string().optional(), metadata: z.union([ DelayScheduledMetadata$inboundSchema, DigestRegularMetadata$inboundSchema, DigestTimedMetadata$inboundSchema, DelayRegularMetadata$inboundSchema, ]).optional(), replyCallback: ReplyCallback$inboundSchema.optional(), variants: z.array(NotificationStepData$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "_id": "id", "_templateId": "templateId", "_parentId": "parentId", }); }); export function notificationStepDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NotificationStepDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NotificationStepDto' from JSON`, ); }