/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { ClosedEnum } from "../../types/enums.js"; import { ConditionGroupV3, ConditionGroupV3$inboundSchema, ConditionGroupV3$Outbound, ConditionGroupV3$outboundSchema, } from "./conditiongroupv3.js"; import { EngineReferenceV2, EngineReferenceV2$inboundSchema, EngineReferenceV2$Outbound, EngineReferenceV2$outboundSchema, } from "./enginereferencev2.js"; import { ExpressionV3, ExpressionV3$inboundSchema, ExpressionV3$Outbound, ExpressionV3$outboundSchema, } from "./expressionv3.js"; import { StepConfigSlim, StepConfigSlim$inboundSchema, StepConfigSlim$Outbound, StepConfigSlim$outboundSchema, } from "./stepconfigslim.js"; import { TriggerSlim, TriggerSlim$inboundSchema, TriggerSlim$Outbound, TriggerSlim$outboundSchema, } from "./triggerslim.js"; import { WorkflowDelay, WorkflowDelay$inboundSchema, WorkflowDelay$Outbound, WorkflowDelay$outboundSchema, } from "./workflowdelay.js"; export const RunsOnIncidentModes = { Standard: "standard", Test: "test", Retrospective: "retrospective", } as const; export type RunsOnIncidentModes = ClosedEnum; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ export const RunsOnIncidents = { NewlyCreated: "newly_created", NewlyCreatedAndActive: "newly_created_and_active", } as const; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ export type RunsOnIncidents = ClosedEnum; /** * The state of the workflow (e.g. is it draft, or disabled) */ export const State = { Active: "active", Disabled: "disabled", Draft: "draft", Error: "error", } as const; /** * The state of the workflow (e.g. is it draft, or disabled) */ export type State = ClosedEnum; export type WorkflowSlim = { /** * Conditions that apply to the workflow trigger */ conditionGroups: Array; /** * Whether to continue executing the workflow if a step fails */ continueOnStepError: boolean; delay?: WorkflowDelay | undefined; /** * Expressions that make variables available in the scope */ expressions: Array; /** * Folder to display the workflow in */ folder?: string | undefined; /** * Unique identifier for the workflow */ id: string; /** * Whether to include private incidents */ includePrivateIncidents: boolean; /** * The human-readable name of the workflow */ name: string; /** * This workflow will run 'once for' a list of references */ onceFor: Array; /** * The time from which this workflow will run on incidents */ runsFrom?: Date | undefined; /** * Which modes of incident this should run on (defaults to just standard incidents) */ runsOnIncidentModes: Array; /** * Which incidents should the workflow be applied to? (newly_created or newly_created_and_active) */ runsOnIncidents: RunsOnIncidents; /** * The state of the workflow (e.g. is it draft, or disabled) */ state: State; /** * Steps that are executed as part of the workflow */ steps: Array; trigger: TriggerSlim; /** * Revision of the workflow, uniquely identifying its version */ version: number; }; /** @internal */ export const RunsOnIncidentModes$inboundSchema: z.ZodNativeEnum< typeof RunsOnIncidentModes > = z.nativeEnum(RunsOnIncidentModes); /** @internal */ export const RunsOnIncidentModes$outboundSchema: z.ZodNativeEnum< typeof RunsOnIncidentModes > = RunsOnIncidentModes$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RunsOnIncidentModes$ { /** @deprecated use `RunsOnIncidentModes$inboundSchema` instead. */ export const inboundSchema = RunsOnIncidentModes$inboundSchema; /** @deprecated use `RunsOnIncidentModes$outboundSchema` instead. */ export const outboundSchema = RunsOnIncidentModes$outboundSchema; } /** @internal */ export const RunsOnIncidents$inboundSchema: z.ZodNativeEnum< typeof RunsOnIncidents > = z.nativeEnum(RunsOnIncidents); /** @internal */ export const RunsOnIncidents$outboundSchema: z.ZodNativeEnum< typeof RunsOnIncidents > = RunsOnIncidents$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RunsOnIncidents$ { /** @deprecated use `RunsOnIncidents$inboundSchema` instead. */ export const inboundSchema = RunsOnIncidents$inboundSchema; /** @deprecated use `RunsOnIncidents$outboundSchema` instead. */ export const outboundSchema = RunsOnIncidents$outboundSchema; } /** @internal */ export const State$inboundSchema: z.ZodNativeEnum = z.nativeEnum( State, ); /** @internal */ export const State$outboundSchema: z.ZodNativeEnum = State$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace State$ { /** @deprecated use `State$inboundSchema` instead. */ export const inboundSchema = State$inboundSchema; /** @deprecated use `State$outboundSchema` instead. */ export const outboundSchema = State$outboundSchema; } /** @internal */ export const WorkflowSlim$inboundSchema: z.ZodType< WorkflowSlim, z.ZodTypeDef, unknown > = z.object({ condition_groups: z.array(ConditionGroupV3$inboundSchema), continue_on_step_error: z.boolean(), delay: WorkflowDelay$inboundSchema.optional(), expressions: z.array(ExpressionV3$inboundSchema), folder: z.string().optional(), id: z.string(), include_private_incidents: z.boolean(), name: z.string(), once_for: z.array(EngineReferenceV2$inboundSchema), runs_from: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), runs_on_incident_modes: z.array(RunsOnIncidentModes$inboundSchema), runs_on_incidents: RunsOnIncidents$inboundSchema, state: State$inboundSchema, steps: z.array(StepConfigSlim$inboundSchema), trigger: TriggerSlim$inboundSchema, version: z.number().int(), }).transform((v) => { return remap$(v, { "condition_groups": "conditionGroups", "continue_on_step_error": "continueOnStepError", "include_private_incidents": "includePrivateIncidents", "once_for": "onceFor", "runs_from": "runsFrom", "runs_on_incident_modes": "runsOnIncidentModes", "runs_on_incidents": "runsOnIncidents", }); }); /** @internal */ export type WorkflowSlim$Outbound = { condition_groups: Array; continue_on_step_error: boolean; delay?: WorkflowDelay$Outbound | undefined; expressions: Array; folder?: string | undefined; id: string; include_private_incidents: boolean; name: string; once_for: Array; runs_from?: string | undefined; runs_on_incident_modes: Array; runs_on_incidents: string; state: string; steps: Array; trigger: TriggerSlim$Outbound; version: number; }; /** @internal */ export const WorkflowSlim$outboundSchema: z.ZodType< WorkflowSlim$Outbound, z.ZodTypeDef, WorkflowSlim > = z.object({ conditionGroups: z.array(ConditionGroupV3$outboundSchema), continueOnStepError: z.boolean(), delay: WorkflowDelay$outboundSchema.optional(), expressions: z.array(ExpressionV3$outboundSchema), folder: z.string().optional(), id: z.string(), includePrivateIncidents: z.boolean(), name: z.string(), onceFor: z.array(EngineReferenceV2$outboundSchema), runsFrom: z.date().transform(v => v.toISOString()).optional(), runsOnIncidentModes: z.array(RunsOnIncidentModes$outboundSchema), runsOnIncidents: RunsOnIncidents$outboundSchema, state: State$outboundSchema, steps: z.array(StepConfigSlim$outboundSchema), trigger: TriggerSlim$outboundSchema, version: z.number().int(), }).transform((v) => { return remap$(v, { conditionGroups: "condition_groups", continueOnStepError: "continue_on_step_error", includePrivateIncidents: "include_private_incidents", onceFor: "once_for", runsFrom: "runs_from", runsOnIncidentModes: "runs_on_incident_modes", runsOnIncidents: "runs_on_incidents", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WorkflowSlim$ { /** @deprecated use `WorkflowSlim$inboundSchema` instead. */ export const inboundSchema = WorkflowSlim$inboundSchema; /** @deprecated use `WorkflowSlim$outboundSchema` instead. */ export const outboundSchema = WorkflowSlim$outboundSchema; /** @deprecated use `WorkflowSlim$Outbound` instead. */ export type Outbound = WorkflowSlim$Outbound; }