UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

129 lines (116 loc) 3.41 kB
/* * 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 "./sdkvalidationerror.js"; import { SessionCommand, SessionCommand$inboundSchema, } from "./sessioncommand.js"; export type KillSessionCommandRequestBody = { /** * The POSIX signal number to send to the process. Common values: 15 (SIGTERM) for graceful termination, 9 (SIGKILL) for forced termination. */ signal: number; }; export type KillSessionCommandRequest = { /** * The unique identifier of the command to terminate. */ cmdId: string; /** * The unique identifier of the session containing the command. */ sessionId: string; /** * The Team identifier to perform the request on behalf of. */ teamId?: string | undefined; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; requestBody?: KillSessionCommandRequestBody | undefined; }; /** * The command was terminated successfully. */ export type KillSessionCommandResponseBody = { /** * This object represents a command run in a Vercel Sandbox session (v2 API). */ command: SessionCommand; }; /** @internal */ export type KillSessionCommandRequestBody$Outbound = { signal: number; }; /** @internal */ export const KillSessionCommandRequestBody$outboundSchema: z.ZodType< KillSessionCommandRequestBody$Outbound, z.ZodTypeDef, KillSessionCommandRequestBody > = z.object({ signal: z.number(), }); export function killSessionCommandRequestBodyToJSON( killSessionCommandRequestBody: KillSessionCommandRequestBody, ): string { return JSON.stringify( KillSessionCommandRequestBody$outboundSchema.parse( killSessionCommandRequestBody, ), ); } /** @internal */ export type KillSessionCommandRequest$Outbound = { cmdId: string; sessionId: string; teamId?: string | undefined; slug?: string | undefined; RequestBody?: KillSessionCommandRequestBody$Outbound | undefined; }; /** @internal */ export const KillSessionCommandRequest$outboundSchema: z.ZodType< KillSessionCommandRequest$Outbound, z.ZodTypeDef, KillSessionCommandRequest > = z.object({ cmdId: z.string(), sessionId: z.string(), teamId: z.string().optional(), slug: z.string().optional(), requestBody: z.lazy(() => KillSessionCommandRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function killSessionCommandRequestToJSON( killSessionCommandRequest: KillSessionCommandRequest, ): string { return JSON.stringify( KillSessionCommandRequest$outboundSchema.parse(killSessionCommandRequest), ); } /** @internal */ export const KillSessionCommandResponseBody$inboundSchema: z.ZodType< KillSessionCommandResponseBody, z.ZodTypeDef, unknown > = z.object({ command: SessionCommand$inboundSchema, }); export function killSessionCommandResponseBodyFromJSON( jsonString: string, ): SafeParseResult<KillSessionCommandResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => KillSessionCommandResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'KillSessionCommandResponseBody' from JSON`, ); }