/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 0955e0907116 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { APIError, APIError$inboundSchema } from "./apierror.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { SyncAcquireResponseDeployment, SyncAcquireResponseDeployment$inboundSchema, } from "./syncacquireresponsedeployment.js"; export type Failure = { /** * ID of the deployment that failed */ deploymentId: string; /** * Project ID the deployment belongs to */ projectId: string; error: APIError; }; /** * Acquired deployments and failures */ export type SyncAcquireResponse = { /** * List of acquired deployments with deployment context */ deployments: Array; /** * List of deployments that failed during context building (locks already released) */ failures: Array; /** * When the provisional leases on the returned deployments lapse. Confirm them with sync/renew before starting work. Null when nothing was acquired. */ leaseExpiresAt: Date | null; }; /** @internal */ export const Failure$inboundSchema: z.ZodType = z.object({ deploymentId: z.string(), projectId: z.string(), error: APIError$inboundSchema, }); export function failureFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Failure$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Failure' from JSON`, ); } /** @internal */ export const SyncAcquireResponse$inboundSchema: z.ZodType< SyncAcquireResponse, unknown > = z.object({ deployments: z.array(SyncAcquireResponseDeployment$inboundSchema), failures: z.array(z.lazy(() => Failure$inboundSchema)), leaseExpiresAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ), }); export function syncAcquireResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SyncAcquireResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SyncAcquireResponse' from JSON`, ); }