@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>
74 lines (69 loc) • 1.74 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
/**
* This object represents a command run in a Vercel Sandbox session (v2 API).
*/
export type SessionCommand = {
/**
* The ID of the command.
*/
id: string;
/**
* The name of the command.
*/
name: string;
/**
* The arguments of the command.
*/
args: Array<string>;
/**
* The current working directory of the command.
*/
cwd: string;
/**
* The ID of the session associated with the command.
*/
sessionId: string;
/**
* If the command did finish, the exit code.
*/
exitCode: number | null;
/**
* When the command was started, in milliseconds since the epoch.
*/
startedAt: number;
/**
* Duration of the command execution in milliseconds.
*/
durationMs?: number | undefined;
};
/** @internal */
export const SessionCommand$inboundSchema: z.ZodType<
SessionCommand,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string(),
name: types.string(),
args: z.array(types.string()),
cwd: types.string(),
sessionId: types.string(),
exitCode: types.nullable(types.number()),
startedAt: types.number(),
durationMs: types.optional(types.number()),
});
export function sessionCommandFromJSON(
jsonString: string,
): SafeParseResult<SessionCommand, SDKValidationError> {
return safeParse(
jsonString,
(x) => SessionCommand$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'SessionCommand' from JSON`,
);
}