/* * 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"; export type LocalShellAction = { type: "exec"; command: Array; env: { [k: string]: string }; timeoutMs?: number | undefined; user?: string | undefined; workingDirectory?: string | undefined; }; /** @internal */ export const LocalShellAction$inboundSchema: z.ZodType< LocalShellAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("exec"), command: z.array(z.string()), env: z.record(z.string()), timeout_ms: z.number().int().optional(), user: z.string().optional(), working_directory: z.string().optional(), }).transform((v) => { return remap$(v, { "timeout_ms": "timeoutMs", "working_directory": "workingDirectory", }); }); /** @internal */ export type LocalShellAction$Outbound = { type: "exec"; command: Array; env: { [k: string]: string }; timeout_ms?: number | undefined; user?: string | undefined; working_directory?: string | undefined; }; /** @internal */ export const LocalShellAction$outboundSchema: z.ZodType< LocalShellAction$Outbound, z.ZodTypeDef, LocalShellAction > = z.object({ type: z.literal("exec"), command: z.array(z.string()), env: z.record(z.string()), timeoutMs: z.number().int().optional(), user: z.string().optional(), workingDirectory: z.string().optional(), }).transform((v) => { return remap$(v, { timeoutMs: "timeout_ms", workingDirectory: "working_directory", }); }); export function localShellActionToJSON( localShellAction: LocalShellAction, ): string { return JSON.stringify( LocalShellAction$outboundSchema.parse(localShellAction), ); } export function localShellActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LocalShellAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LocalShellAction' from JSON`, ); }