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>

134 lines 4.47 kB
import * as z from "zod/v3"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SandboxNetworkPolicy } from "./sandboxnetworkpolicy.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * The status of the sandbox. */ export declare const SessionStatus: { readonly Aborted: "aborted"; readonly Failed: "failed"; readonly Pending: "pending"; readonly Running: "running"; readonly Snapshotting: "snapshotting"; readonly Stopped: "stopped"; readonly Stopping: "stopping"; }; /** * The status of the sandbox. */ export type SessionStatus = ClosedEnum<typeof SessionStatus>; /** * The quantity of data transfered to and from the sandbox, in bytes. This value is only available once the sandbox is stopped, and only if it stopped successfully. */ export type NetworkTransfer = { ingress: number; egress: number; }; /** * This object contains information related to a Vercel Sandbox Session. v2 endpoints return "session" instead of "sandbox" as the response wrapper key. */ export type Session = { /** * The name of the source sandbox. */ sourceSandboxName: string; /** * The unique identifier of the project associated with this session. */ projectId: string; /** * The unique identifier of the sandbox. */ id: string; /** * Memory allocated to this sandbox in MB. */ memory: number; /** * Number of vCPUs allocated to this sandbox. */ vcpus: number; /** * The region where the sandbox is hosted. */ region: string; /** * The runtime of the sandbox. */ runtime: string; /** * The maximum amount of time the sandbox will run for in milliseconds. */ timeout: number; /** * The status of the sandbox. */ status: SessionStatus; /** * The time when the sandbox was requested, in milliseconds since the epoch. */ requestedAt: number; /** * The time when the sandbox was started, in milliseconds since the epoch. */ startedAt?: number | undefined; /** * The working directory of the sandbox. */ cwd: string; /** * The time when the sandbox was requested to stop, in milliseconds since the epoch. */ requestedStopAt?: number | undefined; /** * The time when the sandbox was stopped, in milliseconds since the epoch. */ stoppedAt?: number | undefined; /** * The time when the sandbox was aborted, in milliseconds since the epoch. */ abortedAt?: number | undefined; /** * The duration of the sandbox in milliseconds. */ duration?: number | undefined; /** * The unique identifier of the snapshot associated with this sandbox, if any. */ sourceSnapshotId?: string | undefined; /** * The time when a snapshot was requested, in milliseconds since the epoch. */ snapshottedAt?: number | undefined; /** * The time when the sandbox was created, in milliseconds since the epoch. */ createdAt: number; /** * The last time the sandbox was updated, in milliseconds since the epoch. */ updatedAt: number; /** * The network policy applied to this sandbox, if any. */ networkPolicy?: SandboxNetworkPolicy | undefined; /** * The amount of CPU time the sandbox consumed, if available, in milliseconds. This value is only available once the sandbox is stopped, and only if it stopped successfully. */ activeCpuDurationMs?: number | undefined; /** * The quantity of data transfered to and from the sandbox, in bytes. This value is only available once the sandbox is stopped, and only if it stopped successfully. */ networkTransfer?: NetworkTransfer | undefined; }; /** @internal */ export declare const SessionStatus$inboundSchema: z.ZodNativeEnum<typeof SessionStatus>; /** @internal */ export declare const NetworkTransfer$inboundSchema: z.ZodType<NetworkTransfer, z.ZodTypeDef, unknown>; export declare function networkTransferFromJSON(jsonString: string): SafeParseResult<NetworkTransfer, SDKValidationError>; /** @internal */ export declare const Session$inboundSchema: z.ZodType<Session, z.ZodTypeDef, unknown>; export declare function sessionFromJSON(jsonString: string): SafeParseResult<Session, SDKValidationError>; //# sourceMappingURL=session.d.ts.map