/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 251d7c5276e4 */ import * as z from "zod/v4"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { SetupFingerprintInfo, SetupFingerprintInfo$inboundSchema, } from "./setupfingerprintinfo.js"; /** * Types of packages that can be built */ export const PackageTypeEnum = { Cli: "cli", Cloudformation: "cloudformation", Helm: "helm", OperatorImage: "operator-image", SandboxBundle: "sandbox-bundle", Terraform: "terraform", } as const; /** * Types of packages that can be built */ export type PackageTypeEnum = ClosedEnum; /** * Status of a package build */ export const PackageStatus = { Pending: "pending", Building: "building", Ready: "ready", Failed: "failed", Canceled: "canceled", } as const; /** * Status of a package build */ export type PackageStatus = ClosedEnum; /** * Configuration for Terraform package generation. */ export type ConfigTerraform = { /** * Human-friendly application name shown in generated install artifacts. */ displayName?: string | null | undefined; /** * AWS regions supported by the environment that built this package. */ supportedAwsRegions?: Array | undefined; type: "terraform"; }; /** * Configuration for a sandbox bundle package. * * @remarks * * The bundle is a zip holding one Dockerfile that layers the published Alien sandbox agent * onto the vendor's base image; everything the builder writes is derived from these fields. */ export type ConfigSandboxBundle = { /** * Full reference of the published sandbox agent image copied into the bundle. */ agentImage: string; /** * The base container image the sandbox filesystem starts from. A release-pushed image * * @remarks * arrives resolved onto the private registry template with its {region} token intact. */ baseImage: string; /** * Object key the bundle is written under in every regional bundle store. */ objectKey: string; /** * Regions whose bundle store must receive this bundle. Part of the build input hash, * * @remarks * so a newly supported region re-mints the bundle instead of silently missing it. */ supportedAwsRegions?: Array | undefined; type: "sandbox-bundle"; }; /** * Branding configuration for the Operator image. */ export type ConfigOperatorImage = { /** * Short brand slug used for generated resource names. */ brand?: string | null | undefined; /** * Human-friendly display name for logs and startup messages */ displayName: string; /** * Branded environment variable prefix (e.g., "ACME"). */ envPrefix?: string | null | undefined; /** * Branded Kubernetes/cloud label domain (e.g., "acme.dev"). */ labelDomain?: string | null | undefined; /** * Image name (e.g., "acme-operator") */ name: string; type: "operator-image"; }; /** * Configuration for the Helm chart package */ export type ConfigHelm = { /** * Chart name (e.g., "acme-operator") */ chartName: string; /** * Human-friendly description of the chart */ description: string; type: "helm"; }; /** * Configuration for CloudFormation packages */ export type ConfigCloudformation = { /** * Human-friendly application name shown in generated install artifacts. */ displayName?: string | null | undefined; /** * AWS regions supported by the environment that built this package. */ supportedAwsRegions?: Array | undefined; type: "cloudformation"; }; /** * Target OS and architecture for compiled binaries. * * @remarks * * Used as keys in package output maps (CLI binaries, Terraform providers, etc.) * and for cross-compilation target selection during builds. */ export const PackageBinaryTarget = { WindowsX64: "windows-x64", LinuxX64: "linux-x64", LinuxArm64: "linux-arm64", DarwinArm64: "darwin-arm64", } as const; /** * Target OS and architecture for compiled binaries. * * @remarks * * Used as keys in package output maps (CLI binaries, Terraform providers, etc.) * and for cross-compilation target selection during builds. */ export type PackageBinaryTarget = ClosedEnum; /** * Branding configuration for the deploy CLI binary. */ export type ConfigCli = { /** * Binary targets required by this package's setup consumer. * * @remarks * * Older package rows omit this field and retain the historical all-target * behavior. Callers creating new packages should state their target set. */ binaryTargets?: Array | undefined; /** * Human-friendly display name for help banners and about text */ displayName: string; /** * Binary name displayed in help and usage (e.g., "acmectl") */ name: string; type: "cli"; }; /** * Type-specific configuration */ export type Config = | ConfigCli | ConfigCloudformation | ConfigHelm | ConfigOperatorImage | ConfigSandboxBundle | ConfigTerraform; /** * Information about a single Terraform module package for one target. */ export type PackageModules = { /** * Download URL for the module archive */ downloadUrl: string; /** * Filename of the module archive */ filename: string; /** * SHA256 checksum of the archive */ shasum: string; /** * Size of the archive in bytes */ size: number; /** * Terraform module source (hostname/namespace/name/provider, without scheme) */ source: string; /** * Terraform module target (aws, gcp, azure, eks, gke, aks) */ target: string; /** * Terraform input variables exposed by this module. */ variables?: Array | undefined; }; /** * GPG public key for Terraform provider signature verification */ export type PackageGpgPublicKey = { /** * ASCII-armored public key */ asciiArmor: string; /** * GPG key ID */ keyId: string; }; /** * Information about a single Terraform provider package for a specific platform */ export type PackagePlatforms = { /** * Download URL for the provider zip */ downloadUrl: string; /** * Filename of the provider zip */ filename: string; /** * SHA256 checksum of the zip file */ shasum: string; /** * URL to the shasums signature file */ shasumsSignatureUrl: string; /** * URL to the shasums file */ shasumsUrl: string; /** * Size of the zip file in bytes */ size: number; }; /** * Terraform provider registry outputs. */ export type PackageProvider = { /** * GPG public key for Terraform provider signature verification */ gpgPublicKey: PackageGpgPublicKey; /** * Provider packages for each target platform */ platforms: { [k: string]: PackagePlatforms }; /** * Terraform provider source (hostname/namespace/type, without scheme) */ source: string; }; export const OutputsTypeTerraform = { Terraform: "terraform", } as const; export type OutputsTypeTerraform = ClosedEnum; /** * Outputs from a Terraform package build. */ export type OutputsTerraform = { /** * Module registry artifacts by Terraform target. */ modules: { [k: string]: PackageModules }; /** * Terraform provider registry outputs. */ provider: PackageProvider; type: OutputsTypeTerraform; }; export const OutputsTypeSandboxBundle = { SandboxBundle: "sandbox-bundle", } as const; export type OutputsTypeSandboxBundle = ClosedEnum< typeof OutputsTypeSandboxBundle >; /** * Outputs from a sandbox bundle package build. */ export type OutputsSandboxBundle = { /** * Bundle URI with the {region} token in the bucket, resolved by the deploy-time emitters. */ bundleUriTemplate: string; /** * Object key the bundle was written under in every regional bundle store. */ objectKey: string; /** * Regions whose bundle store received this bundle. */ regions: Array; /** * SHA256 checksum of the region-neutral bundle zip; a region-templated base image makes * * @remarks * each regional object differ from it only in the rendered region. */ sha256: string; /** * Region-neutral bundle zip size in bytes. */ size: number; type: OutputsTypeSandboxBundle; }; /** * Information about a single CloudFormation template package for one target. */ export type PackageTargets = { /** * AWS Console quick-launch URL */ launchStackUrl: string; /** * SHA256 checksum of the template */ sha256: string; /** * Template size in bytes */ size: number; /** * S3 URL to the CloudFormation stack policy */ stackPolicyUrl: string; /** * CloudFormation target (aws, eks) */ target: string; /** * S3 URL to the CloudFormation template */ templateUrl: string; }; export const OutputsTypeCloudformation = { Cloudformation: "cloudformation", } as const; export type OutputsTypeCloudformation = ClosedEnum< typeof OutputsTypeCloudformation >; /** * Outputs from a CloudFormation package build. */ export type OutputsCloudformation = { /** * Template artifacts by CloudFormation target. */ targets: { [k: string]: PackageTargets }; type: OutputsTypeCloudformation; }; export const OutputsTypeHelm = { Helm: "helm", } as const; export type OutputsTypeHelm = ClosedEnum; /** * Outputs from a Helm chart package build */ export type OutputsHelm = { /** * OCI chart reference (e.g., "oci://public.ecr.aws/acme/charts/project-id") */ chart: string; /** * Chart version (e.g., "1.2.3") */ version: string; type: OutputsTypeHelm; }; export const OutputsTypeOperatorImage = { OperatorImage: "operator-image", } as const; export type OutputsTypeOperatorImage = ClosedEnum< typeof OutputsTypeOperatorImage >; /** * Outputs from an Operator image package build */ export type OutputsOperatorImage = { /** * Image digest (e.g., "sha256:abc123...") */ digest: string; /** * Full image reference (e.g., "public.ecr.aws/acme/operators/project-id:1.2.3") */ image: string; /** * DNS-style label domain embedded into the Operator binary, if whitelabeled. */ labelDomain?: string | null | undefined; type: OutputsTypeOperatorImage; }; /** * Information about a single binary artifact */ export type PackageBinaries = { /** * SHA256 checksum */ sha256: string; /** * File size in bytes */ size: number; /** * Download URL for the binary */ url: string; }; /** * Source provenance for a generated CLI package. */ export type PackageBuildInfo = { /** * Alien source commit used to build the source CLI and agent binaries. */ alienSha: string; /** * Compute backend source revision used by optional package extensions, if applicable. */ horizonSha: string; /** * Machine runtime release manifest embedded into the generated CLI. */ machineBundleManifestUrl?: string | null | undefined; /** * Source revision used to build the package service and optional extensions. */ platformSha: string; /** * SHA256 checksum of the source runtime helper binary shipped with the CLI package, when present. */ sourceAgentBinarySha256?: string | null | undefined; /** * SHA256 checksum of the source deploy CLI binary before white-label config is appended. */ sourceCliBinarySha256: string; }; export const OutputsTypeCli = { Cli: "cli", } as const; export type OutputsTypeCli = ClosedEnum; /** * Outputs from a CLI package build */ export type OutputsCli = { /** * Binary information for each target platform */ binaries: { [k: string]: PackageBinaries }; /** * Source provenance for a generated CLI package. */ buildInfo: PackageBuildInfo; type: OutputsTypeCli; }; /** * Package outputs (only when status is 'ready') */ export type PackageOutputsUnion = | OutputsSandboxBundle | OutputsCli | OutputsOperatorImage | OutputsHelm | OutputsTerraform | OutputsCloudformation | any; /** * Coarse package build phase */ export const BuildPhase = { Building: "building", Publishing: "publishing", } as const; /** * Coarse package build phase */ export type BuildPhase = ClosedEnum; export type Package = { /** * Unique identifier for the package. */ id: string; /** * Unique identifier for the project. */ projectId: string; /** * Unique identifier for the workspace. */ workspaceId: string; /** * Types of packages that can be built */ type: PackageTypeEnum; /** * Status of a package build */ status: PackageStatus; /** * Package version (e.g., '1.0.0', 'rel_abc123') */ version: string; /** * Release used as package build input. Null for release-less packages such as Operate Operator images. */ sourceReleaseId?: string | null | undefined; /** * Per-target setup compatibility fingerprints copied from the source release */ setupFingerprints: { [k: string]: SetupFingerprintInfo }; /** * Hash of Platform-known package build request inputs: package type, source release, setup fingerprints, package config, and setup contract version */ packageBuildInputHash: string; /** * Type-specific configuration */ config: | ConfigCli | ConfigCloudformation | ConfigHelm | ConfigOperatorImage | ConfigSandboxBundle | ConfigTerraform; /** * Package outputs (only when status is 'ready') */ outputs?: | OutputsSandboxBundle | OutputsCli | OutputsOperatorImage | OutputsHelm | OutputsTerraform | OutputsCloudformation | any | null | undefined; /** * Error information if status is 'failed' */ error?: any | null | undefined; /** * Builder-recorded source binary SHA256 (for cli/terraform packages) */ sourceBinarySha256?: string | null | undefined; /** * Number of build retries */ retries: number; lockedAt?: Date | null | undefined; lockedBy?: string | null | undefined; /** * Expiration of the current builder lease */ leaseExpiresAt?: Date | null | undefined; /** * Coarse package build phase */ buildPhase?: BuildPhase | null | undefined; /** * Last successful builder lease renewal or phase change */ lastProgressAt?: Date | null | undefined; createdAt: Date; updatedAt: Date; completedAt?: Date | null | undefined; }; /** @internal */ export const PackageTypeEnum$inboundSchema: z.ZodEnum = z.enum(PackageTypeEnum); /** @internal */ export const PackageStatus$inboundSchema: z.ZodEnum = z .enum(PackageStatus); /** @internal */ export const ConfigTerraform$inboundSchema: z.ZodType< ConfigTerraform, unknown > = z.object({ displayName: z.nullable(z.string()).optional(), supportedAwsRegions: z.array(z.string()).optional(), type: z.literal("terraform"), }); export function configTerraformFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigTerraform$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigTerraform' from JSON`, ); } /** @internal */ export const ConfigSandboxBundle$inboundSchema: z.ZodType< ConfigSandboxBundle, unknown > = z.object({ agentImage: z.string(), baseImage: z.string(), objectKey: z.string(), supportedAwsRegions: z.array(z.string()).optional(), type: z.literal("sandbox-bundle"), }); export function configSandboxBundleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigSandboxBundle$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigSandboxBundle' from JSON`, ); } /** @internal */ export const ConfigOperatorImage$inboundSchema: z.ZodType< ConfigOperatorImage, unknown > = z.object({ brand: z.nullable(z.string()).optional(), displayName: z.string(), envPrefix: z.nullable(z.string()).optional(), labelDomain: z.nullable(z.string()).optional(), name: z.string(), type: z.literal("operator-image"), }); export function configOperatorImageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigOperatorImage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigOperatorImage' from JSON`, ); } /** @internal */ export const ConfigHelm$inboundSchema: z.ZodType = z .object({ chartName: z.string(), description: z.string(), type: z.literal("helm"), }); export function configHelmFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigHelm$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigHelm' from JSON`, ); } /** @internal */ export const ConfigCloudformation$inboundSchema: z.ZodType< ConfigCloudformation, unknown > = z.object({ displayName: z.nullable(z.string()).optional(), supportedAwsRegions: z.array(z.string()).optional(), type: z.literal("cloudformation"), }); export function configCloudformationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigCloudformation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigCloudformation' from JSON`, ); } /** @internal */ export const PackageBinaryTarget$inboundSchema: z.ZodEnum< typeof PackageBinaryTarget > = z.enum(PackageBinaryTarget); /** @internal */ export const ConfigCli$inboundSchema: z.ZodType = z.object({ binaryTargets: z.array(PackageBinaryTarget$inboundSchema).optional(), displayName: z.string(), name: z.string(), type: z.literal("cli"), }); export function configCliFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigCli$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigCli' from JSON`, ); } /** @internal */ export const Config$inboundSchema: z.ZodType = z.union([ z.lazy(() => ConfigCli$inboundSchema), z.lazy(() => ConfigCloudformation$inboundSchema), z.lazy(() => ConfigHelm$inboundSchema), z.lazy(() => ConfigOperatorImage$inboundSchema), z.lazy(() => ConfigSandboxBundle$inboundSchema), z.lazy(() => ConfigTerraform$inboundSchema), ]); export function configFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Config$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Config' from JSON`, ); } /** @internal */ export const PackageModules$inboundSchema: z.ZodType = z.object({ downloadUrl: z.string(), filename: z.string(), shasum: z.string(), size: z.int(), source: z.string(), target: z.string(), variables: z.array(z.string()).optional(), }); export function packageModulesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageModules$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageModules' from JSON`, ); } /** @internal */ export const PackageGpgPublicKey$inboundSchema: z.ZodType< PackageGpgPublicKey, unknown > = z.object({ asciiArmor: z.string(), keyId: z.string(), }); export function packageGpgPublicKeyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageGpgPublicKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageGpgPublicKey' from JSON`, ); } /** @internal */ export const PackagePlatforms$inboundSchema: z.ZodType< PackagePlatforms, unknown > = z.object({ downloadUrl: z.string(), filename: z.string(), shasum: z.string(), shasumsSignatureUrl: z.string(), shasumsUrl: z.string(), size: z.int(), }); export function packagePlatformsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackagePlatforms$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackagePlatforms' from JSON`, ); } /** @internal */ export const PackageProvider$inboundSchema: z.ZodType< PackageProvider, unknown > = z.object({ gpgPublicKey: z.lazy(() => PackageGpgPublicKey$inboundSchema), platforms: z.record(z.string(), z.lazy(() => PackagePlatforms$inboundSchema)), source: z.string(), }); export function packageProviderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageProvider$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageProvider' from JSON`, ); } /** @internal */ export const OutputsTypeTerraform$inboundSchema: z.ZodEnum< typeof OutputsTypeTerraform > = z.enum(OutputsTypeTerraform); /** @internal */ export const OutputsTerraform$inboundSchema: z.ZodType< OutputsTerraform, unknown > = z.object({ modules: z.record(z.string(), z.lazy(() => PackageModules$inboundSchema)), provider: z.lazy(() => PackageProvider$inboundSchema), type: OutputsTypeTerraform$inboundSchema, }); export function outputsTerraformFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsTerraform$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsTerraform' from JSON`, ); } /** @internal */ export const OutputsTypeSandboxBundle$inboundSchema: z.ZodEnum< typeof OutputsTypeSandboxBundle > = z.enum(OutputsTypeSandboxBundle); /** @internal */ export const OutputsSandboxBundle$inboundSchema: z.ZodType< OutputsSandboxBundle, unknown > = z.object({ bundleUriTemplate: z.string(), objectKey: z.string(), regions: z.array(z.string()), sha256: z.string(), size: z.int(), type: OutputsTypeSandboxBundle$inboundSchema, }); export function outputsSandboxBundleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsSandboxBundle$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsSandboxBundle' from JSON`, ); } /** @internal */ export const PackageTargets$inboundSchema: z.ZodType = z.object({ launchStackUrl: z.string(), sha256: z.string(), size: z.int(), stackPolicyUrl: z.string(), target: z.string(), templateUrl: z.string(), }); export function packageTargetsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageTargets$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageTargets' from JSON`, ); } /** @internal */ export const OutputsTypeCloudformation$inboundSchema: z.ZodEnum< typeof OutputsTypeCloudformation > = z.enum(OutputsTypeCloudformation); /** @internal */ export const OutputsCloudformation$inboundSchema: z.ZodType< OutputsCloudformation, unknown > = z.object({ targets: z.record(z.string(), z.lazy(() => PackageTargets$inboundSchema)), type: OutputsTypeCloudformation$inboundSchema, }); export function outputsCloudformationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsCloudformation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsCloudformation' from JSON`, ); } /** @internal */ export const OutputsTypeHelm$inboundSchema: z.ZodEnum = z.enum(OutputsTypeHelm); /** @internal */ export const OutputsHelm$inboundSchema: z.ZodType = z .object({ chart: z.string(), version: z.string(), type: OutputsTypeHelm$inboundSchema, }); export function outputsHelmFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsHelm$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsHelm' from JSON`, ); } /** @internal */ export const OutputsTypeOperatorImage$inboundSchema: z.ZodEnum< typeof OutputsTypeOperatorImage > = z.enum(OutputsTypeOperatorImage); /** @internal */ export const OutputsOperatorImage$inboundSchema: z.ZodType< OutputsOperatorImage, unknown > = z.object({ digest: z.string(), image: z.string(), labelDomain: z.nullable(z.string()).optional(), type: OutputsTypeOperatorImage$inboundSchema, }); export function outputsOperatorImageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsOperatorImage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsOperatorImage' from JSON`, ); } /** @internal */ export const PackageBinaries$inboundSchema: z.ZodType< PackageBinaries, unknown > = z.object({ sha256: z.string(), size: z.int(), url: z.string(), }); export function packageBinariesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageBinaries$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageBinaries' from JSON`, ); } /** @internal */ export const PackageBuildInfo$inboundSchema: z.ZodType< PackageBuildInfo, unknown > = z.object({ alienSha: z.string(), horizonSha: z.string(), machineBundleManifestUrl: z.nullable(z.string()).optional(), platformSha: z.string(), sourceAgentBinarySha256: z.nullable(z.string()).optional(), sourceCliBinarySha256: z.string(), }); export function packageBuildInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageBuildInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageBuildInfo' from JSON`, ); } /** @internal */ export const OutputsTypeCli$inboundSchema: z.ZodEnum = z .enum(OutputsTypeCli); /** @internal */ export const OutputsCli$inboundSchema: z.ZodType = z .object({ binaries: z.record(z.string(), z.lazy(() => PackageBinaries$inboundSchema)), buildInfo: z.lazy(() => PackageBuildInfo$inboundSchema), type: OutputsTypeCli$inboundSchema, }); export function outputsCliFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutputsCli$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputsCli' from JSON`, ); } /** @internal */ export const PackageOutputsUnion$inboundSchema: z.ZodType< PackageOutputsUnion, unknown > = z.union([ z.lazy(() => OutputsSandboxBundle$inboundSchema), z.lazy(() => OutputsCli$inboundSchema), z.lazy(() => OutputsOperatorImage$inboundSchema), z.lazy(() => OutputsHelm$inboundSchema), z.lazy(() => OutputsTerraform$inboundSchema), z.lazy(() => OutputsCloudformation$inboundSchema), z.any(), ]); export function packageOutputsUnionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PackageOutputsUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PackageOutputsUnion' from JSON`, ); } /** @internal */ export const BuildPhase$inboundSchema: z.ZodEnum = z.enum( BuildPhase, ); /** @internal */ export const Package$inboundSchema: z.ZodType = z.object({ id: z.string(), projectId: z.string(), workspaceId: z.string(), type: PackageTypeEnum$inboundSchema, status: PackageStatus$inboundSchema, version: z.string(), sourceReleaseId: z.nullable(z.string()).optional(), setupFingerprints: z.record(z.string(), SetupFingerprintInfo$inboundSchema), packageBuildInputHash: z.string(), config: z.union([ z.lazy(() => ConfigCli$inboundSchema), z.lazy(() => ConfigCloudformation$inboundSchema), z.lazy(() => ConfigHelm$inboundSchema), z.lazy(() => ConfigOperatorImage$inboundSchema), z.lazy(() => ConfigSandboxBundle$inboundSchema), z.lazy(() => ConfigTerraform$inboundSchema), ]), outputs: z.nullable( z.union([ z.lazy(() => OutputsSandboxBundle$inboundSchema), z.lazy(() => OutputsCli$inboundSchema), z.lazy(() => OutputsOperatorImage$inboundSchema), z.lazy(() => OutputsHelm$inboundSchema), z.lazy(() => OutputsTerraform$inboundSchema), z.lazy(() => OutputsCloudformation$inboundSchema), z.any(), ]), ).optional(), error: z.nullable(z.any()).optional(), sourceBinarySha256: z.nullable(z.string()).optional(), retries: z.int(), lockedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), lockedBy: z.nullable(z.string()).optional(), leaseExpiresAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), buildPhase: z.nullable(BuildPhase$inboundSchema).optional(), lastProgressAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), updatedAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), completedAt: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }); export function packageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Package$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Package' from JSON`, ); }