/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ExposedPort, ExposedPort$inboundSchema } from "./exposedport.js"; import { Hosting, Hosting$inboundSchema } from "./hosting.js"; import { ProcessStatus, ProcessStatus$inboundSchema } from "./processstatus.js"; import { Region, Region$inboundSchema } from "./region.js"; import { TransportType, TransportType$inboundSchema } from "./transporttype.js"; /** * Connection details for an active process. */ export type ProcessV3ExposedPort = { /** * Transport type specifies the underlying communication protocol to the exposed port. */ transportType: TransportType; port: number; host: string; name: string; }; export type ProcessV3 = { hosting?: Hosting | undefined; status: ProcessStatus; /** * Tracks the number of rooms that have been allocated to the process. */ roomsAllocated: number; /** * The summary of why the process exited, if it has stopped. */ summaryExitReason?: string | undefined; /** * When the process has been terminated. */ terminatedAt: Date | null; /** * When the process is issued to stop. */ stoppingAt: Date | null; /** * When the process bound to the specified port. We use this to determine when to register the process to the load balancer. */ startedAt: Date | null; /** * When the container was fully downloaded and started booting. */ bootedAt: Date | null; /** * When the process was assigned to an available node. */ scheduledAt: Date | null; /** * When the process started being provisioned. */ createdAt: Date; /** * Governs how many [rooms](https://hathora.dev/docs/concepts/hathora-entities#room) can be scheduled in a process. */ roomsPerProcess: number; additionalExposedPorts: Array; exposedPort: ProcessV3ExposedPort | null; region: Region; /** * System generated unique identifier to a runtime instance of your game server. */ processId: string; /** * The id of the fleet. */ fleetId?: string | undefined; /** * System generated id for a deployment. */ deploymentId: string; /** * System generated unique identifier for an application. */ appId: string; }; /** @internal */ export const ProcessV3ExposedPort$inboundSchema: z.ZodType< ProcessV3ExposedPort, z.ZodTypeDef, unknown > = z.object({ transportType: TransportType$inboundSchema, port: z.number().int(), host: z.string(), name: z.string(), }); export function processV3ExposedPortFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProcessV3ExposedPort$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProcessV3ExposedPort' from JSON`, ); } /** @internal */ export const ProcessV3$inboundSchema: z.ZodType< ProcessV3, z.ZodTypeDef, unknown > = z.object({ hosting: Hosting$inboundSchema.optional(), status: ProcessStatus$inboundSchema, roomsAllocated: z.number().int(), summaryExitReason: z.string().optional(), terminatedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), stoppingAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), startedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), bootedAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), scheduledAt: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)), roomsPerProcess: z.number().int(), additionalExposedPorts: z.array(ExposedPort$inboundSchema), exposedPort: z.nullable(z.lazy(() => ProcessV3ExposedPort$inboundSchema)), region: Region$inboundSchema, processId: z.string(), fleetId: z.string().optional(), deploymentId: z.string(), appId: z.string(), }); export function processV3FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProcessV3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProcessV3' from JSON`, ); }