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>

3,969 lines 117 kB
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { ClosedEnum } from "../types/enums.js";
import { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { smartUnion } from "../types/smartUnion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type CancelDeploymentRequest = {
  /**
   * The unique identifier of the deployment.
   */
  id: string;
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
};

export type AliasAssignedAt = number | boolean;

export type Build = {
  env: Array<string>;
};

export type Builds = {
  use: string;
  src?: string | undefined;
  config?: { [k: string]: any } | undefined;
};

/**
 * Machine type which was purchased/selected for this build. `basic` is the 2vCPU tier, recorded on the deployment so the build pipeline can detect a basic build without consulting the project.
 */
export const PurchaseType = {
  Basic: "basic",
  Enhanced: "enhanced",
  Standard: "standard",
  Turbo: "turbo",
} as const;
/**
 * Machine type which was purchased/selected for this build. `basic` is the 2vCPU tier, recorded on the deployment so the build pipeline can detect a basic build without consulting the project.
 */
export type PurchaseType = ClosedEnum<typeof PurchaseType>;

/**
 * The default plan type for the build machine — what the customer is *paying* for on their plan. For most customers, this is standard, but some customers have an entitlement for enhanced builds.
 */
export const DefaultPurchaseType = {
  Basic: "basic",
  Enhanced: "enhanced",
  Standard: "standard",
} as const;
/**
 * The default plan type for the build machine — what the customer is *paying* for on their plan. For most customers, this is standard, but some customers have an entitlement for enhanced builds.
 */
export type DefaultPurchaseType = ClosedEnum<typeof DefaultPurchaseType>;

/**
 * Whether the build ran on a fixed or elastic machine. Used to drive billing for the build.
 */
export const MachineSelectionType = {
  Elastic: "elastic",
  Fixed: "fixed",
} as const;
/**
 * Whether the build ran on a fixed or elastic machine. Used to drive billing for the build.
 */
export type MachineSelectionType = ClosedEnum<typeof MachineSelectionType>;

/**
 * The setting which selected the build machine when the deployment was created. Frozen here so later project or team changes do not rewrite its history.
 */
export const SelectionSource = {
  ElasticAlgorithm: "elastic-algorithm",
  PlanDefault: "plan-default",
  ProjectSetting: "project-setting",
  TeamEntitlement: "team-entitlement",
  TeamSetting: "team-setting",
} as const;
/**
 * The setting which selected the build machine when the deployment was created. Frozen here so later project or team changes do not rewrite its history.
 */
export type SelectionSource = ClosedEnum<typeof SelectionSource>;

/**
 * Build machine configuration recorded for this deployment's build. See {@link DeploymentBuildMachine}. Distinct from the team/user `resourceConfig.buildMachine`, which only carries `default`.
 */
export type CancelDeploymentBuildMachine = {
  /**
   * Machine type which was purchased/selected for this build. `basic` is the 2vCPU tier, recorded on the deployment so the build pipeline can detect a basic build without consulting the project.
   */
  purchaseType?: PurchaseType | undefined;
  /**
   * The default plan type for the build machine — what the customer is *paying* for on their plan. For most customers, this is standard, but some customers have an entitlement for enhanced builds.
   */
  defaultPurchaseType?: DefaultPurchaseType | undefined;
  /**
   * Whether the build ran on a fixed or elastic machine. Used to drive billing for the build.
   */
  machineSelectionType?: MachineSelectionType | undefined;
  /**
   * The setting which selected the build machine when the deployment was created. Frozen here so later project or team changes do not rewrite its history.
   */
  selectionSource?: SelectionSource | undefined;
  /**
   * Number of cores the build machine ran with. Set at dispatch time once the build lands on a hive.
   */
  cores?: number | undefined;
  /**
   * Memory, in MiB, the build machine ran with. Set at dispatch time once the build lands on a hive.
   */
  memory?: number | undefined;
};

export type CancelDeploymentResourceConfig = {
  /**
   * Build machine configuration recorded for this deployment's build. See {@link DeploymentBuildMachine}. Distinct from the team/user `resourceConfig.buildMachine`, which only carries `default`.
   */
  buildMachine?: CancelDeploymentBuildMachine | undefined;
};

export const CancelDeploymentDeploymentsNodeVersion = {
  TenDotX: "10.x",
  TwelveDotX: "12.x",
  FourteenDotX: "14.x",
  SixteenDotX: "16.x",
  EighteenDotX: "18.x",
  TwentyDotX: "20.x",
  TwentyTwoDotX: "22.x",
  TwentyFourDotX: "24.x",
  EightDot10DotX: "8.10.x",
} as const;
export type CancelDeploymentDeploymentsNodeVersion = ClosedEnum<
  typeof CancelDeploymentDeploymentsNodeVersion
>;

export const CancelDeploymentFramework = {
  ActixWeb: "actix-web",
  Angular: "angular",
  Ash: "ash",
  Astro: "astro",
  Axum: "axum",
  Blitzjs: "blitzjs",
  Brunch: "brunch",
  Bun: "bun",
  Container: "container",
  CreateReactApp: "create-react-app",
  Django: "django",
  Docusaurus: "docusaurus",
  Docusaurus2: "docusaurus-2",
  Dojo: "dojo",
  Eleventy: "eleventy",
  Elysia: "elysia",
  Ember: "ember",
  Eve: "eve",
  Express: "express",
  FactoryEve: "factory-eve",
  Fastapi: "fastapi",
  Fasthtml: "fasthtml",
  Fastify: "fastify",
  Flask: "flask",
  Gatsby: "gatsby",
  Go: "go",
  Gridsome: "gridsome",
  H3: "h3",
  Hexo: "hexo",
  Hono: "hono",
  Hugo: "hugo",
  Hydrogen: "hydrogen",
  IonicAngular: "ionic-angular",
  IonicReact: "ionic-react",
  Jekyll: "jekyll",
  Koa: "koa",
  Mastra: "mastra",
  Middleman: "middleman",
  Nestjs: "nestjs",
  Nextjs: "nextjs",
  Nitro: "nitro",
  Node: "node",
  Nuxtjs: "nuxtjs",
  Parcel: "parcel",
  Polymer: "polymer",
  Preact: "preact",
  Python: "python",
  ReactRouter: "react-router",
  Redwoodjs: "redwoodjs",
  Remix: "remix",
  Ruby: "ruby",
  Rust: "rust",
  Saber: "saber",
  Sanity: "sanity",
  SanityV2: "sanity-v2",
  Sapper: "sapper",
  Scully: "scully",
  Services: "services",
  Solidstart: "solidstart",
  Solidstart1: "solidstart-1",
  Stencil: "stencil",
  Storybook: "storybook",
  Svelte: "svelte",
  Sveltekit: "sveltekit",
  Sveltekit1: "sveltekit-1",
  TanstackStart: "tanstack-start",
  TanstackStartLovable: "tanstack-start-lovable",
  Umijs: "umijs",
  Vite: "vite",
  Vitepress: "vitepress",
  Vue: "vue",
  Vuepress: "vuepress",
  Xmcp: "xmcp",
  Zola: "zola",
} as const;
export type CancelDeploymentFramework = ClosedEnum<
  typeof CancelDeploymentFramework
>;

export type CancelDeploymentSpeedInsights = {
  id: string;
  enabledAt?: number | undefined;
  disabledAt?: number | undefined;
  canceledAt?: number | undefined;
  hasData?: boolean | undefined;
  /**
   * When the first free (not Speed Insights Plus) production data point was observed, in ms. Set once by subscriber-analytics-events; projects that already had data before this field shipped get it backfilled on their next batch, so it reads "first free data point observed", not necessarily "first ever".
   */
  dataReceivedAt?: number | undefined;
  paidAt?: number | undefined;
};

export type CancelDeploymentWebAnalytics = {
  id: string;
  disabledAt?: number | undefined;
  canceledAt?: number | undefined;
  enabledAt?: number | undefined;
  hasData?: true | undefined;
};

export type CancelDeploymentProjectSettings = {
  nodeVersion?: CancelDeploymentDeploymentsNodeVersion | undefined;
  buildCommand?: string | null | undefined;
  devCommand?: string | null | undefined;
  framework?: CancelDeploymentFramework | null | undefined;
  commandForIgnoringBuildStep?: string | null | undefined;
  installCommand?: string | null | undefined;
  outputDirectory?: string | null | undefined;
  speedInsights?: CancelDeploymentSpeedInsights | undefined;
  webAnalytics?: CancelDeploymentWebAnalytics | undefined;
};

export const CancelDeploymentDeploymentsStatus = {
  Error: "error",
  Pending: "pending",
  Ready: "ready",
  Skipped: "skipped",
  Timeout: "timeout",
} as const;
export type CancelDeploymentDeploymentsStatus = ClosedEnum<
  typeof CancelDeploymentDeploymentsStatus
>;

export type Integrations = {
  status: CancelDeploymentDeploymentsStatus;
  startedAt: number;
  claimedAt?: number | undefined;
  completedAt?: number | undefined;
  skippedAt?: number | undefined;
  skippedBy?: string | undefined;
};

/**
 * Must be `http` or `https`.
 */
export const Protocol = {
  Http: "http",
  Https: "https",
} as const;
/**
 * Must be `http` or `https`.
 */
export type Protocol = ClosedEnum<typeof Protocol>;

export type RemotePatterns = {
  /**
   * Must be `http` or `https`.
   */
  protocol?: Protocol | undefined;
  /**
   * Can be literal or wildcard. Single `*` matches a single subdomain. Double `**` matches any number of subdomains.
   */
  hostname: string;
  /**
   * Can be literal port such as `8080` or empty string meaning no port.
   */
  port?: string | undefined;
  /**
   * Can be literal or wildcard. Single `*` matches a single path segment. Double `**` matches any number of path segments.
   */
  pathname?: string | undefined;
  /**
   * Can be literal query string such as `?v=1` or empty string meaning no query string.
   */
  search?: string | undefined;
};

export type LocalPatterns = {
  /**
   * Can be literal or wildcard. Single `*` matches a single path segment. Double `**` matches any number of path segments.
   */
  pathname?: string | undefined;
  /**
   * Can be literal query string such as `?v=1` or empty string meaning no query string.
   */
  search?: string | undefined;
};

export const Formats = {
  ImageAvif: "image/avif",
  ImageWebp: "image/webp",
} as const;
export type Formats = ClosedEnum<typeof Formats>;

export const ContentDispositionType = {
  Attachment: "attachment",
  Inline: "inline",
} as const;
export type ContentDispositionType = ClosedEnum<typeof ContentDispositionType>;

export type Images = {
  sizes?: Array<number> | undefined;
  qualities?: Array<number> | undefined;
  domains?: Array<string> | undefined;
  remotePatterns?: Array<RemotePatterns> | undefined;
  localPatterns?: Array<LocalPatterns> | undefined;
  minimumCacheTTL?: number | undefined;
  formats?: Array<Formats> | undefined;
  dangerouslyAllowSVG?: boolean | undefined;
  contentSecurityPolicy?: string | undefined;
  contentDispositionType?: ContentDispositionType | undefined;
};

/**
 * Principal type of the deployment creator.
 */
export const CancelDeploymentDeploymentsType = {
  App: "app",
  Integration: "integration",
  System: "system",
  User: "user",
} as const;
/**
 * Principal type of the deployment creator.
 */
export type CancelDeploymentDeploymentsType = ClosedEnum<
  typeof CancelDeploymentDeploymentsType
>;

/**
 * Information about the deployment creator
 */
export type CancelDeploymentCreator = {
  /**
   * Stable creator id across principal types (user id, app id, integration configuration id, or `system`).
   */
  uid: string;
  /**
   * Principal type of the deployment creator.
   */
  type?: CancelDeploymentDeploymentsType | undefined;
  /**
   * The username of the user that created the deployment
   */
  username?: string | undefined;
  /**
   * The avatar of the user that created the deployment
   */
  avatar?: string | undefined;
};

export const CancelDeploymentReadyState = {
  Building: "BUILDING",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Ready: "READY",
} as const;
export type CancelDeploymentReadyState = ClosedEnum<
  typeof CancelDeploymentReadyState
>;

export type CancelDeploymentOutput = {
  path: string;
  functionName: string;
};

/**
 * A partial representation of a Build used by the deployment endpoint.
 */
export type Lambdas = {
  id: string;
  readyState?: CancelDeploymentReadyState | undefined;
  createdAt?: number | undefined;
  entrypoint?: string | null | undefined;
  readyStateAt?: number | undefined;
  output: Array<CancelDeploymentOutput>;
};

export const CancelDeploymentStatus = {
  Blocked: "BLOCKED",
  Building: "BUILDING",
  Canceled: "CANCELED",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Queued: "QUEUED",
  Ready: "READY",
} as const;
export type CancelDeploymentStatus = ClosedEnum<typeof CancelDeploymentStatus>;

/**
 * The team that owns the deployment if any
 */
export type CancelDeploymentTeam = {
  id: string;
  name: string;
  slug: string;
  avatar?: string | undefined;
};

/**
 * If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.
 */
export type CustomEnvironment2 = {
  id: string;
};

/**
 * The type of environment (production, preview, or development)
 */
export const CustomEnvironmentType = {
  Development: "development",
  Preview: "preview",
  Production: "production",
} as const;
/**
 * The type of environment (production, preview, or development)
 */
export type CustomEnvironmentType = ClosedEnum<typeof CustomEnvironmentType>;

/**
 * The type of matching to perform
 */
export const CancelDeploymentCustomEnvironmentType = {
  EndsWith: "endsWith",
  Equals: "equals",
  StartsWith: "startsWith",
} as const;
/**
 * The type of matching to perform
 */
export type CancelDeploymentCustomEnvironmentType = ClosedEnum<
  typeof CancelDeploymentCustomEnvironmentType
>;

/**
 * Configuration for matching git branches to this environment
 */
export type CustomEnvironmentBranchMatcher = {
  /**
   * The type of matching to perform
   */
  type: CancelDeploymentCustomEnvironmentType;
  /**
   * The pattern to match against branch names
   */
  pattern: string;
};

/**
 * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.
 */
export type CustomEnvironmentVerification = {
  type: string;
  domain: string;
  value: string;
  reason: string;
};

/**
 * List of domains associated with this environment
 */
export type CustomEnvironmentDomains = {
  name: string;
  apexName: string;
  projectId: string;
  redirect?: string | null | undefined;
  redirectStatusCode?: number | null | undefined;
  gitBranch?: string | null | undefined;
  customEnvironmentId?: string | null | undefined;
  updatedAt?: number | undefined;
  createdAt?: number | undefined;
  /**
   * `true` if the domain is verified for use with the project. If `false` it will not be used as an alias on this project until the challenge in `verification` is completed.
   */
  verified: boolean;
  /**
   * A list of verification challenges, one of which must be completed to verify the domain for use on the project. After the challenge is complete `POST /projects/:idOrName/domains/:domain/verify` to verify the domain. Possible challenges: - If `verification.type = TXT` the `verification.domain` will be checked for a TXT record matching `verification.value`.
   */
  verification?: Array<CustomEnvironmentVerification> | undefined;
};

/**
 * If the deployment was created using a Custom Environment, then this property contains information regarding the environment used.
 */
export type CustomEnvironment1 = {
  /**
   * Unique identifier for the custom environment (format: env_*)
   */
  id: string;
  /**
   * URL-friendly name of the environment
   */
  slug: string;
  /**
   * The type of environment (production, preview, or development)
   */
  type: CustomEnvironmentType;
  /**
   * Optional description of the environment's purpose
   */
  description?: string | undefined;
  /**
   * Configuration for matching git branches to this environment
   */
  branchMatcher?: CustomEnvironmentBranchMatcher | undefined;
  /**
   * List of domains associated with this environment
   */
  domains?: Array<CustomEnvironmentDomains> | undefined;
  /**
   * List of aliases for the current deployment
   */
  currentDeploymentAliases?: Array<string> | undefined;
  /**
   * Timestamp when the environment was created
   */
  createdAt: number;
  /**
   * Timestamp when the environment was last updated
   */
  updatedAt: number;
};

export type CancelDeploymentCustomEnvironment =
  | CustomEnvironment1
  | CustomEnvironment2;

export const OomReport = {
  OutOfMemory: "out-of-memory",
} as const;
export type OomReport = ClosedEnum<typeof OomReport>;

/**
 * If defined, either `staging` if a staging alias in the format `<project>.<team>.now.sh` was assigned upon creation, or `production` if the aliases from `alias` were assigned. `null` value indicates the "preview" deployment.
 */
export const CancelDeploymentTarget = {
  Production: "production",
  Staging: "staging",
} as const;
/**
 * If defined, either `staging` if a staging alias in the format `<project>.<team>.now.sh` was assigned upon creation, or `production` if the aliases from `alias` were assigned. `null` value indicates the "preview" deployment.
 */
export type CancelDeploymentTarget = ClosedEnum<typeof CancelDeploymentTarget>;

/**
 * The state of the deployment depending on the process of deploying, or if it is ready or in an error state
 */
export const ReadyState = {
  Blocked: "BLOCKED",
  Building: "BUILDING",
  Canceled: "CANCELED",
  Error: "ERROR",
  Initializing: "INITIALIZING",
  Queued: "QUEUED",
  Ready: "READY",
} as const;
/**
 * The state of the deployment depending on the process of deploying, or if it is ready or in an error state
 */
export type ReadyState = ClosedEnum<typeof ReadyState>;

/**
 * An object that will contain a `code` and a `message` when the aliasing fails, otherwise the value will be `null`
 */
export type AliasError = {
  code: string;
  message: string;
};

export type AliasWarning = {
  code: string;
  message: string;
  link?: string | undefined;
  action?: string | undefined;
};

export const CancelDeploymentType = {
  Lambdas: "LAMBDAS",
} as const;
export type CancelDeploymentType = ClosedEnum<typeof CancelDeploymentType>;

export const ChecksState = {
  Completed: "completed",
  Registered: "registered",
  Running: "running",
} as const;
export type ChecksState = ClosedEnum<typeof ChecksState>;

export const ChecksConclusion = {
  Canceled: "canceled",
  Failed: "failed",
  Skipped: "skipped",
  Succeeded: "succeeded",
} as const;
export type ChecksConclusion = ClosedEnum<typeof ChecksConclusion>;

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type =
  {
    CursorOrigin: "cursor-origin",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type
  >;

export type GitSource19 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type;
  ref: string;
  sha: string;
  repoId: string;
  owner: string;
  repo: string;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type =
  {
    Vercel: "vercel",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type
  >;

export type GitSource18 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type;
  ref: string;
  sha: string;
  org: string;
  repo: string;
  repoPushedAt?: number | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type
  >;

export type GitSource17 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type;
  ref: string;
  sha: string;
  owner?: string | undefined;
  slug?: string | undefined;
  workspaceUuid: string;
  repoUuid: string;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type =
  {
    Gitlab: "gitlab",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type
  >;

export type GitSource16 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type;
  ref: string;
  sha: string;
  projectId: number;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type =
  {
    GithubLimited: "github-limited",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type
  >;

export type GitSource15 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type =
  {
    GithubCustomHost: "github-custom-host",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type
  >;

export type GitSource14 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type;
  host: string;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type =
  {
    Github: "github",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type
  >;

export type GitSource13 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type;
  ref: string;
  sha: string;
  repoId: number;
  org?: string | undefined;
  repo?: string | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type =
  {
    Custom: "custom",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type
  >;

/**
 * Allows custom git sources (local folder mounted to the container) in test mode
 */
export type GitSource12 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type;
  ref: string;
  sha: string;
  gitUrl: string;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type =
  {
    CursorOrigin: "cursor-origin",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type
  >;

export type GitSource11 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type;
  /**
   * Origin repository id.
   */
  repoId: string;
  /**
   * Owner (namespace) slug.
   */
  owner?: string | undefined;
  repo?: string | undefined;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type =
  {
    Vercel: "vercel",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type
  >;

export type GitSource10 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type;
  org?: string | undefined;
  repo?: string | undefined;
  sha: string;
  repoPushedAt?: number | undefined;
  ref?: string | null | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type
  >;

export type CancelDeploymentGitSource9 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type;
  owner: string;
  slug: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type =
  {
    Bitbucket: "bitbucket",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type
  >;

export type CancelDeploymentGitSource8 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type;
  workspaceUuid?: string | undefined;
  repoUuid: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type =
  {
    Gitlab: "gitlab",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type
  >;

export type GitSourceProjectId = string | number;

export type CancelDeploymentGitSource7 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type;
  projectId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType =
  {
    GithubLimited: "github-limited",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType
  >;

export type CancelDeploymentGitSource6 = {
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType =
  {
    GithubLimited: "github-limited",
  } as const;
export type CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType =
  ClosedEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType
  >;

export type CancelDeploymentGitSourceDeploymentsResponseRepoId =
  | string
  | number;

export type CancelDeploymentGitSource5 = {
  type: CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponse200Type = {
  GithubCustomHost: "github-custom-host",
} as const;
export type CancelDeploymentGitSourceDeploymentsResponse200Type = ClosedEnum<
  typeof CancelDeploymentGitSourceDeploymentsResponse200Type
>;

export type CancelDeploymentGitSource4 = {
  type: CancelDeploymentGitSourceDeploymentsResponse200Type;
  host: string;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsResponseType = {
  GithubCustomHost: "github-custom-host",
} as const;
export type CancelDeploymentGitSourceDeploymentsResponseType = ClosedEnum<
  typeof CancelDeploymentGitSourceDeploymentsResponseType
>;

export type CancelDeploymentGitSourceDeploymentsRepoId = string | number;

export type CancelDeploymentGitSource3 = {
  type: CancelDeploymentGitSourceDeploymentsResponseType;
  host: string;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceDeploymentsType = {
  Github: "github",
} as const;
export type CancelDeploymentGitSourceDeploymentsType = ClosedEnum<
  typeof CancelDeploymentGitSourceDeploymentsType
>;

export type CancelDeploymentGitSource2 = {
  type: CancelDeploymentGitSourceDeploymentsType;
  org: string;
  repo: string;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export const CancelDeploymentGitSourceType = {
  Github: "github",
} as const;
export type CancelDeploymentGitSourceType = ClosedEnum<
  typeof CancelDeploymentGitSourceType
>;

export type CancelDeploymentGitSourceRepoId = string | number;

export type CancelDeploymentGitSource1 = {
  type: CancelDeploymentGitSourceType;
  repoId: string | number;
  ref?: string | null | undefined;
  sha?: string | undefined;
  prId?: number | null | undefined;
};

export type CancelDeploymentGitSource =
  | GitSource19
  | GitSource14
  | GitSource17
  | GitSource18
  | CancelDeploymentGitSource4
  | GitSource12
  | GitSource13
  | GitSource15
  | GitSource16
  | CancelDeploymentGitSource2
  | CancelDeploymentGitSource3
  | CancelDeploymentGitSource6
  | CancelDeploymentGitSource9
  | CancelDeploymentGitSource1
  | CancelDeploymentGitSource5
  | CancelDeploymentGitSource7
  | CancelDeploymentGitSource8
  | GitSource10
  | GitSource11;

/**
 * Current provisioning state
 */
export const CancelDeploymentState = {
  Complete: "COMPLETE",
  Pending: "PENDING",
  Timeout: "TIMEOUT",
} as const;
/**
 * Current provisioning state
 */
export type CancelDeploymentState = ClosedEnum<typeof CancelDeploymentState>;

/**
 * Present when deployment was created with manual provisioning enabled, either explicitly or via the experimental BYOC git flow. The deployment stays in INITIALIZING until /continue is called.
 */
export type ManualProvisioning = {
  /**
   * Current provisioning state
   */
  state: CancelDeploymentState;
  /**
   * Timestamp when manual provisioning completed
   */
  completedAt?: number | undefined;
};

/**
 * If set it overrides the `projectSettings.nodeVersion` for this deployment.
 */
export const CancelDeploymentNodeVersion = {
  TenDotX: "10.x",
  TwelveDotX: "12.x",
  FourteenDotX: "14.x",
  SixteenDotX: "16.x",
  EighteenDotX: "18.x",
  TwentyDotX: "20.x",
  TwentyTwoDotX: "22.x",
  TwentyFourDotX: "24.x",
  EightDot10DotX: "8.10.x",
} as const;
/**
 * If set it overrides the `projectSettings.nodeVersion` for this deployment.
 */
export type CancelDeploymentNodeVersion = ClosedEnum<
  typeof CancelDeploymentNodeVersion
>;

/**
 * The public project information associated with the deployment.
 */
export type CancelDeploymentProject = {
  id: string;
  name: string;
  framework?: string | null | undefined;
};

/**
 * Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic
 */
export const ReadySubstate = {
  Promoted: "PROMOTED",
  Rolling: "ROLLING",
  Staged: "STAGED",
} as const;
/**
 * Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic
 */
export type ReadySubstate = ClosedEnum<typeof ReadySubstate>;

/**
 * Where was the deployment created from. Best-effort guess for metrics only — not authoritative; do not gate behavior on it.
 */
export const CancelDeploymentSource = {
  ApiTriggerGitDeploy: "api-trigger-git-deploy",
  Cli: "cli",
  CloneRepo: "clone/repo",
  Drop: "drop",
  Git: "git",
  GitDeployHook: "git-deploy-hook",
  Import: "import",
  ImportRepo: "import/repo",
  Redeploy: "redeploy",
  V0Web: "v0-web",
} as const;
/**
 * Where was the deployment created from. Best-effort guess for metrics only — not authoritative; do not gate behavior on it.
 */
export type CancelDeploymentSource = ClosedEnum<typeof CancelDeploymentSource>;

export type OidcTokenClaims = {
  iss: string;
  sub: string;
  scope: string;
  aud: string;
  owner: string;
  ownerId: string;
  project: string;
  projectId: string;
  environment: string;
  customEnvironmentId?: string | undefined;
  mfeGroupIds?: Array<string> | undefined;
  plan?: string | undefined;
};

export const CancelDeploymentPlan = {
  Enterprise: "enterprise",
  Hobby: "hobby",
  Pro: "pro",
} as const;
export type CancelDeploymentPlan = ClosedEnum<typeof CancelDeploymentPlan>;

export type Crons = {
  schedule: string;
  path: string;
};

export const Kinds = {
  Account: "account",
  Commit: "commit",
  Identity: "identity",
  Sync: "sync",
} as const;
export type Kinds = ClosedEnum<typeof Kinds>;

export type Subscription = {
  collections: Array<string>;
  dids?: Array<string> | undefined;
  kinds?: Array<Kinds> | undefined;
  path: string;
};

export type Atproto2 = {
  enabled: true;
  subscription: Subscription;
};

export type Atproto1 = {
  enabled: false;
};

export type Atproto = Atproto2 | Atproto1;

export const Architecture = {
  Arm64: "arm64",
  X8664: "x86_64",
} as const;
export type Architecture = ClosedEnum<typeof Architecture>;

export const MaxDuration2 = {
  Max: "max",
} as const;
export type MaxDuration2 = ClosedEnum<typeof MaxDuration2>;

export type MaxDuration = number | MaxDuration2;

export const CancelDeploymentMode = {
  Strict: "strict",
} as const;
export type CancelDeploymentMode = ClosedEnum<typeof CancelDeploymentMode>;

export type Affinity = {
  mode: CancelDeploymentMode;
};

export type ExperimentalTriggers3 = {
  /**
   * Event type - must be "schedule/v1beta" (REQUIRED)
   */
  type: "schedule/v1beta";
};

/**
 * Queue trigger input event for v2beta (from vercel.json config). Consumer name is implicitly derived from the function path. Only one trigger per function is allowed.
 */
export type ExperimentalTriggers2 = {
  /**
   * Event type - must be "queue/v2beta" (REQUIRED)
   */
  type: "queue/v2beta";
  /**
   * Name of the queue topic to consume from (REQUIRED)
   */
  topic: string;
  /**
   * Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxDeliveries?: number | undefined;
  /**
   * Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.
   */
  retryAfterSeconds?: number | undefined;
  /**
   * Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.
   */
  initialDelaySeconds?: number | undefined;
  /**
   * Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxConcurrency?: number | undefined;
};

/**
 * Queue trigger input event for v1beta (from vercel.json config). Requires explicit consumer name.
 */
export type ExperimentalTriggers1 = {
  /**
   * Event type - must be "queue/v1beta" (REQUIRED)
   */
  type: "queue/v1beta";
  /**
   * Name of the consumer group for this trigger (REQUIRED)
   */
  consumer: string;
  /**
   * Name of the queue topic to consume from (REQUIRED)
   */
  topic: string;
  /**
   * Maximum number of delivery attempts for message processing (OPTIONAL) This represents the total number of times a message can be delivered, not the number of retries. Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxDeliveries?: number | undefined;
  /**
   * Delay in seconds before retrying failed executions (OPTIONAL) Behavior when not specified depends on the server's default configuration.
   */
  retryAfterSeconds?: number | undefined;
  /**
   * Initial delay in seconds before first execution attempt (OPTIONAL) Must be 0 or greater. Use 0 for no initial delay. Behavior when not specified depends on the server's default configuration.
   */
  initialDelaySeconds?: number | undefined;
  /**
   * Maximum number of concurrent executions for this consumer (OPTIONAL) Must be at least 1 if specified. Behavior when not specified depends on the server's default configuration.
   */
  maxConcurrency?: number | undefined;
};

export type ExperimentalTriggers =
  | ExperimentalTriggers1
  | ExperimentalTriggers2
  | ExperimentalTriggers3;

export type Functions = {
  architecture?: Architecture | undefined;
  memory?: number | undefined;
  maxDuration?: number | MaxDuration2 | undefined;
  affinity?: Affinity | undefined;
  maxConcurrency?: number | undefined;
  regions?: Array<string> | undefined;
  functionFailoverRegions?: Array<string> | undefined;
  runtime?: string | undefined;
  includeFiles?: string | undefined;
  excludeFiles?: string | undefined;
  experimentalTriggers?:
    | Array<
      ExperimentalTriggers1 | ExperimentalTriggers2 | ExperimentalTriggers3
    >
    | undefined;
  supportsCancellation?: boolean | undefined;
};

export type Routes3 = {
  src: string;
  continue: boolean;
  middleware: number;
};

export const Handle = {
  Error: "error",
  Filesystem: "filesystem",
  Hit: "hit",
  Miss: "miss",
  Resource: "resource",
  Rewrite: "rewrite",
} as const;
export type Handle = ClosedEnum<typeof Handle>;

export type Routes2 = {
  handle: Handle;
  src?: string | undefined;
  dest?: string | undefined;
  status?: number | undefined;
};

export const CancelDeploymentHasType = {
  Cookie: "cookie",
  Header: "header",
  Query: "query",
} as const;
export type CancelDeploymentHasType = ClosedEnum<
  typeof CancelDeploymentHasType
>;

export type ValueEq = string | number;

export type CancelDeploymentValue2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type HasValue = string | CancelDeploymentValue2;

export type Has2 = {
  type: CancelDeploymentHasType;
  key: string;
  value?: string | CancelDeploymentValue2 | undefined;
};

export type Eq = string | number;

export type CancelDeploymentValueDeploymentsResponse2002 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type CancelDeploymentHasValue =
  | string
  | CancelDeploymentValueDeploymentsResponse2002;

export type Has1 = {
  type: "host";
  value: string | CancelDeploymentValueDeploymentsResponse2002;
};

export type RoutesHas =
  | Has1
  | (Has2 & { type: "cookie" })
  | (Has2 & { type: "header" })
  | (Has2 & { type: "query" });

export const CancelDeploymentMissingType = {
  Cookie: "cookie",
  Header: "header",
  Query: "query",
} as const;
export type CancelDeploymentMissingType = ClosedEnum<
  typeof CancelDeploymentMissingType
>;

export type CancelDeploymentValueDeploymentsEq = string | number;

export type CancelDeploymentValueDeploymentsResponse2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type CancelDeploymentMissingValue =
  | string
  | CancelDeploymentValueDeploymentsResponse2;

export type Missing2 = {
  type: CancelDeploymentMissingType;
  key: string;
  value?: string | CancelDeploymentValueDeploymentsResponse2 | undefined;
};

export type CancelDeploymentValueEq = string | number;

export type CancelDeploymentValueDeployments2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  re?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type MissingValue = string | CancelDeploymentValueDeployments2;

export type Missing1 = {
  type: "host";
  value: string | CancelDeploymentValueDeployments2;
};

export type RoutesMissing =
  | Missing1
  | (Missing2 & { type: "cookie" })
  | (Missing2 & { type: "header" })
  | (Missing2 & { type: "query" });

export const RoutesAction = {
  Challenge: "challenge",
  Deny: "deny",
} as const;
export type RoutesAction = ClosedEnum<typeof RoutesAction>;

export type RoutesMitigate = {
  action: RoutesAction;
};

export const TransformsOp = {
  Set: "set",
} as const;
export type TransformsOp = ClosedEnum<typeof TransformsOp>;

export type Transforms2 = {
  type: "request.path";
  op: TransformsOp;
  args: string;
  env?: Array<string> | undefined;
};

export const TransformsType = {
  RequestHeaders: "request.headers",
  RequestQuery: "request.query",
  ResponseHeaders: "response.headers",
} as const;
export type TransformsType = ClosedEnum<typeof TransformsType>;

export const CancelDeploymentTransformsOp = {
  Append: "append",
  Delete: "delete",
  Set: "set",
} as const;
export type CancelDeploymentTransformsOp = ClosedEnum<
  typeof CancelDeploymentTransformsOp
>;

export type KeyEq = string | number;

export type Key2 = {
  eq?: string | number | undefined;
  neq?: string | undefined;
  inc?: Array<string> | undefined;
  ninc?: Array<string> | undefined;
  pre?: string | undefined;
  suf?: string | undefined;
  gt?: number | undefined;
  gte?: number | undefined;
  lt?: number | undefined;
  lte?: number | undefined;
};

export type CancelDeploymentTransformsKey = string | Key2;

export type TransformsTarget = {
  key: string | Key2;
};

export type Args = string | Array<string>;

export type Transforms1 = {
  type: TransformsType;
  op: CancelDeploymentTransformsOp;
  target: TransformsTarget;
  args?: string | Array<string> | undefined;
  env?: Array<string> | undefined;
};

export type RoutesTransforms =
  | (Transforms1 & { type: "request.headers" })
  | (Transforms1 & { type: "request.query" })
  | (Transforms1 & { type: "response.headers" })
  | Transforms2;

export type Locale = {
  redirect?: { [k: string]: string } | undefined;
  cookie?: string | undefined;
};

/** @internal */
export type CancelDeploymentRequest$Outbound = {
  id: string;
  teamId?: string | undefined;
  slug?: string | undefined;
};

/** @internal */
export const CancelDeploymentRequest$outboundSchema: z.ZodType<
  CancelDeploymentRequest$Outbound,
  z.ZodTypeDef,
  CancelDeploymentRequest
> = z.object({
  id: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
});

export function cancelDeploymentRequestToJSON(
  cancelDeploymentRequest: CancelDeploymentRequest,
): string {
  return JSON.stringify(
    CancelDeploymentRequest$outboundSchema.parse(cancelDeploymentRequest),
  );
}

/** @internal */
export const AliasAssignedAt$inboundSchema: z.ZodType<
  AliasAssignedAt,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.number(), types.boolean()]);

export function aliasAssignedAtFromJSON(
  jsonString: string,
): SafeParseResult<AliasAssignedAt, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AliasAssignedAt$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AliasAssignedAt' from JSON`,
  );
}

/** @internal */
export const Build$inboundSchema: z.ZodType<Build, z.ZodTypeDef, unknown> = z
  .object({
    env: z.array(types.string()),
  });

export function buildFromJSON(
  jsonString: string,
): SafeParseResult<Build, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Build$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Build' from JSON`,
  );
}

/** @internal */
export const Builds$inboundSchema: z.ZodType<Builds, z.ZodTypeDef, unknown> = z
  .object({
    use: types.string(),
    src: types.optional(types.string()),
    config: types.optional(z.record(z.any())),
  });

export function buildsFromJSON(
  jsonString: string,
): SafeParseResult<Builds, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Builds$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Builds' from JSON`,
  );
}

/** @internal */
export const PurchaseType$inboundSchema: z.ZodNativeEnum<typeof PurchaseType> =
  z.nativeEnum(PurchaseType);

/** @internal */
export const DefaultPurchaseType$inboundSchema: z.ZodNativeEnum<
  typeof DefaultPurchaseType
> = z.nativeEnum(DefaultPurchaseType);

/** @internal */
export const MachineSelectionType$inboundSchema: z.ZodNativeEnum<
  typeof MachineSelectionType
> = z.nativeEnum(MachineSelectionType);

/** @internal */
export const SelectionSource$inboundSchema: z.ZodNativeEnum<
  typeof SelectionSource
> = z.nativeEnum(SelectionSource);

/** @internal */
export const CancelDeploymentBuildMachine$inboundSchema: z.ZodType<
  CancelDeploymentBuildMachine,
  z.ZodTypeDef,
  unknown
> = z.object({
  purchaseType: types.optional(PurchaseType$inboundSchema),
  defaultPurchaseType: types.optional(DefaultPurchaseType$inboundSchema),
  machineSelectionType: types.optional(MachineSelectionType$inboundSchema),
  selectionSource: types.optional(SelectionSource$inboundSchema),
  cores: types.optional(types.number()),
  memory: types.optional(types.number()),
});

export function cancelDeploymentBuildMachineFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentBuildMachine, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentBuildMachine$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentBuildMachine' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentResourceConfig$inboundSchema: z.ZodType<
  CancelDeploymentResourceConfig,
  z.ZodTypeDef,
  unknown
> = z.object({
  buildMachine: types.optional(
    z.lazy(() => CancelDeploymentBuildMachine$inboundSchema),
  ),
});

export function cancelDeploymentResourceConfigFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentResourceConfig, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentResourceConfig$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentResourceConfig' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentDeploymentsNodeVersion$inboundSchema:
  z.ZodNativeEnum<typeof CancelDeploymentDeploymentsNodeVersion> = z.nativeEnum(
    CancelDeploymentDeploymentsNodeVersion,
  );

/** @internal */
export const CancelDeploymentFramework$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentFramework
> = z.nativeEnum(CancelDeploymentFramework);

/** @internal */
export const CancelDeploymentSpeedInsights$inboundSchema: z.ZodType<
  CancelDeploymentSpeedInsights,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  enabledAt: types.optional(types.number()),
  disabledAt: types.optional(types.number()),
  canceledAt: types.optional(types.number()),
  hasData: types.optional(types.boolean()),
  dataReceivedAt: types.optional(types.number()),
  paidAt: types.optional(types.number()),
});

export function cancelDeploymentSpeedInsightsFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentSpeedInsights, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentSpeedInsights$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentSpeedInsights' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentWebAnalytics$inboundSchema: z.ZodType<
  CancelDeploymentWebAnalytics,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  disabledAt: types.optional(types.number()),
  canceledAt: types.optional(types.number()),
  enabledAt: types.optional(types.number()),
  hasData: types.optional(types.literal(true)),
});

export function cancelDeploymentWebAnalyticsFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentWebAnalytics, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentWebAnalytics$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentWebAnalytics' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentProjectSettings$inboundSchema: z.ZodType<
  CancelDeploymentProjectSettings,
  z.ZodTypeDef,
  unknown
> = z.object({
  nodeVersion: types.optional(
    CancelDeploymentDeploymentsNodeVersion$inboundSchema,
  ),
  buildCommand: z.nullable(types.string()).optional(),
  devCommand: z.nullable(types.string()).optional(),
  framework: z.nullable(CancelDeploymentFramework$inboundSchema).optional(),
  commandForIgnoringBuildStep: z.nullable(types.string()).optional(),
  installCommand: z.nullable(types.string()).optional(),
  outputDirectory: z.nullable(types.string()).optional(),
  speedInsights: types.optional(
    z.lazy(() => CancelDeploymentSpeedInsights$inboundSchema),
  ),
  webAnalytics: types.optional(
    z.lazy(() => CancelDeploymentWebAnalytics$inboundSchema),
  ),
});

export function cancelDeploymentProjectSettingsFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentProjectSettings, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentProjectSettings$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentProjectSettings' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentDeploymentsStatus$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentDeploymentsStatus
> = z.nativeEnum(CancelDeploymentDeploymentsStatus);

/** @internal */
export const Integrations$inboundSchema: z.ZodType<
  Integrations,
  z.ZodTypeDef,
  unknown
> = z.object({
  status: CancelDeploymentDeploymentsStatus$inboundSchema,
  startedAt: types.number(),
  claimedAt: types.optional(types.number()),
  completedAt: types.optional(types.number()),
  skippedAt: types.optional(types.number()),
  skippedBy: types.optional(types.string()),
});

export function integrationsFromJSON(
  jsonString: string,
): SafeParseResult<Integrations, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Integrations$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Integrations' from JSON`,
  );
}

/** @internal */
export const Protocol$inboundSchema: z.ZodNativeEnum<typeof Protocol> = z
  .nativeEnum(Protocol);

/** @internal */
export const RemotePatterns$inboundSchema: z.ZodType<
  RemotePatterns,
  z.ZodTypeDef,
  unknown
> = z.object({
  protocol: types.optional(Protocol$inboundSchema),
  hostname: types.string(),
  port: types.optional(types.string()),
  pathname: types.optional(types.string()),
  search: types.optional(types.string()),
});

export function remotePatternsFromJSON(
  jsonString: string,
): SafeParseResult<RemotePatterns, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RemotePatterns$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RemotePatterns' from JSON`,
  );
}

/** @internal */
export const LocalPatterns$inboundSchema: z.ZodType<
  LocalPatterns,
  z.ZodTypeDef,
  unknown
> = z.object({
  pathname: types.optional(types.string()),
  search: types.optional(types.string()),
});

export function localPatternsFromJSON(
  jsonString: string,
): SafeParseResult<LocalPatterns, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => LocalPatterns$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'LocalPatterns' from JSON`,
  );
}

/** @internal */
export const Formats$inboundSchema: z.ZodNativeEnum<typeof Formats> = z
  .nativeEnum(Formats);

/** @internal */
export const ContentDispositionType$inboundSchema: z.ZodNativeEnum<
  typeof ContentDispositionType
> = z.nativeEnum(ContentDispositionType);

/** @internal */
export const Images$inboundSchema: z.ZodType<Images, z.ZodTypeDef, unknown> = z
  .object({
    sizes: types.optional(z.array(types.number())),
    qualities: types.optional(z.array(types.number())),
    domains: types.optional(z.array(types.string())),
    remotePatterns: types.optional(
      z.array(z.lazy(() => RemotePatterns$inboundSchema)),
    ),
    localPatterns: types.optional(
      z.array(z.lazy(() => LocalPatterns$inboundSchema)),
    ),
    minimumCacheTTL: types.optional(types.number()),
    formats: types.optional(z.array(Formats$inboundSchema)),
    dangerouslyAllowSVG: types.optional(types.boolean()),
    contentSecurityPolicy: types.optional(types.string()),
    contentDispositionType: types.optional(
      ContentDispositionType$inboundSchema,
    ),
  });

export function imagesFromJSON(
  jsonString: string,
): SafeParseResult<Images, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Images$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Images' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentDeploymentsType$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentDeploymentsType
> = z.nativeEnum(CancelDeploymentDeploymentsType);

/** @internal */
export const CancelDeploymentCreator$inboundSchema: z.ZodType<
  CancelDeploymentCreator,
  z.ZodTypeDef,
  unknown
> = z.object({
  uid: types.string(),
  type: types.optional(CancelDeploymentDeploymentsType$inboundSchema),
  username: types.optional(types.string()),
  avatar: types.optional(types.string()),
});

export function cancelDeploymentCreatorFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentCreator, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentCreator$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentCreator' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentReadyState$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentReadyState
> = z.nativeEnum(CancelDeploymentReadyState);

/** @internal */
export const CancelDeploymentOutput$inboundSchema: z.ZodType<
  CancelDeploymentOutput,
  z.ZodTypeDef,
  unknown
> = z.object({
  path: types.string(),
  functionName: types.string(),
});

export function cancelDeploymentOutputFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentOutput, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentOutput$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentOutput' from JSON`,
  );
}

/** @internal */
export const Lambdas$inboundSchema: z.ZodType<Lambdas, z.ZodTypeDef, unknown> =
  z.object({
    id: types.string(),
    readyState: types.optional(CancelDeploymentReadyState$inboundSchema),
    createdAt: types.optional(types.number()),
    entrypoint: z.nullable(types.string()).optional(),
    readyStateAt: types.optional(types.number()),
    output: z.array(z.lazy(() => CancelDeploymentOutput$inboundSchema)),
  });

export function lambdasFromJSON(
  jsonString: string,
): SafeParseResult<Lambdas, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Lambdas$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Lambdas' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentStatus$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentStatus
> = z.nativeEnum(CancelDeploymentStatus);

/** @internal */
export const CancelDeploymentTeam$inboundSchema: z.ZodType<
  CancelDeploymentTeam,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.string(),
  slug: types.string(),
  avatar: types.optional(types.string()),
});

export function cancelDeploymentTeamFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentTeam, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentTeam$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentTeam' from JSON`,
  );
}

/** @internal */
export const CustomEnvironment2$inboundSchema: z.ZodType<
  CustomEnvironment2,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
});

export function customEnvironment2FromJSON(
  jsonString: string,
): SafeParseResult<CustomEnvironment2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomEnvironment2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomEnvironment2' from JSON`,
  );
}

/** @internal */
export const CustomEnvironmentType$inboundSchema: z.ZodNativeEnum<
  typeof CustomEnvironmentType
> = z.nativeEnum(CustomEnvironmentType);

/** @internal */
export const CancelDeploymentCustomEnvironmentType$inboundSchema:
  z.ZodNativeEnum<typeof CancelDeploymentCustomEnvironmentType> = z.nativeEnum(
    CancelDeploymentCustomEnvironmentType,
  );

/** @internal */
export const CustomEnvironmentBranchMatcher$inboundSchema: z.ZodType<
  CustomEnvironmentBranchMatcher,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentCustomEnvironmentType$inboundSchema,
  pattern: types.string(),
});

export function customEnvironmentBranchMatcherFromJSON(
  jsonString: string,
): SafeParseResult<CustomEnvironmentBranchMatcher, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomEnvironmentBranchMatcher$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomEnvironmentBranchMatcher' from JSON`,
  );
}

/** @internal */
export const CustomEnvironmentVerification$inboundSchema: z.ZodType<
  CustomEnvironmentVerification,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.string(),
  domain: types.string(),
  value: types.string(),
  reason: types.string(),
});

export function customEnvironmentVerificationFromJSON(
  jsonString: string,
): SafeParseResult<CustomEnvironmentVerification, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomEnvironmentVerification$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomEnvironmentVerification' from JSON`,
  );
}

/** @internal */
export const CustomEnvironmentDomains$inboundSchema: z.ZodType<
  CustomEnvironmentDomains,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: types.string(),
  apexName: types.string(),
  projectId: types.string(),
  redirect: z.nullable(types.string()).optional(),
  redirectStatusCode: z.nullable(types.number()).optional(),
  gitBranch: z.nullable(types.string()).optional(),
  customEnvironmentId: z.nullable(types.string()).optional(),
  updatedAt: types.optional(types.number()),
  createdAt: types.optional(types.number()),
  verified: types.boolean(),
  verification: types.optional(
    z.array(z.lazy(() => CustomEnvironmentVerification$inboundSchema)),
  ),
});

export function customEnvironmentDomainsFromJSON(
  jsonString: string,
): SafeParseResult<CustomEnvironmentDomains, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomEnvironmentDomains$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomEnvironmentDomains' from JSON`,
  );
}

/** @internal */
export const CustomEnvironment1$inboundSchema: z.ZodType<
  CustomEnvironment1,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  slug: types.string(),
  type: CustomEnvironmentType$inboundSchema,
  description: types.optional(types.string()),
  branchMatcher: types.optional(
    z.lazy(() => CustomEnvironmentBranchMatcher$inboundSchema),
  ),
  domains: types.optional(
    z.array(z.lazy(() => CustomEnvironmentDomains$inboundSchema)),
  ),
  currentDeploymentAliases: types.optional(z.array(types.string())),
  createdAt: types.number(),
  updatedAt: types.number(),
});

export function customEnvironment1FromJSON(
  jsonString: string,
): SafeParseResult<CustomEnvironment1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomEnvironment1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomEnvironment1' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentCustomEnvironment$inboundSchema: z.ZodType<
  CancelDeploymentCustomEnvironment,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.lazy(() => CustomEnvironment1$inboundSchema),
  z.lazy(() => CustomEnvironment2$inboundSchema),
]);

export function cancelDeploymentCustomEnvironmentFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentCustomEnvironment, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentCustomEnvironment$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentCustomEnvironment' from JSON`,
  );
}

/** @internal */
export const OomReport$inboundSchema: z.ZodNativeEnum<typeof OomReport> = z
  .nativeEnum(OomReport);

/** @internal */
export const CancelDeploymentTarget$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentTarget
> = z.nativeEnum(CancelDeploymentTarget);

/** @internal */
export const ReadyState$inboundSchema: z.ZodNativeEnum<typeof ReadyState> = z
  .nativeEnum(ReadyState);

/** @internal */
export const AliasError$inboundSchema: z.ZodType<
  AliasError,
  z.ZodTypeDef,
  unknown
> = z.object({
  code: types.string(),
  message: types.string(),
});

export function aliasErrorFromJSON(
  jsonString: string,
): SafeParseResult<AliasError, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AliasError$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AliasError' from JSON`,
  );
}

/** @internal */
export const AliasWarning$inboundSchema: z.ZodType<
  AliasWarning,
  z.ZodTypeDef,
  unknown
> = z.object({
  code: types.string(),
  message: types.string(),
  link: types.optional(types.string()),
  action: types.optional(types.string()),
});

export function aliasWarningFromJSON(
  jsonString: string,
): SafeParseResult<AliasWarning, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AliasWarning$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AliasWarning' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentType$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentType
> = z.nativeEnum(CancelDeploymentType);

/** @internal */
export const ChecksState$inboundSchema: z.ZodNativeEnum<typeof ChecksState> = z
  .nativeEnum(ChecksState);

/** @internal */
export const ChecksConclusion$inboundSchema: z.ZodNativeEnum<
  typeof ChecksConclusion
> = z.nativeEnum(ChecksConclusion);

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type,
  );

/** @internal */
export const GitSource19$inboundSchema: z.ZodType<
  GitSource19,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody19Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  repoId: types.string(),
  owner: types.string(),
  repo: types.string(),
});

export function gitSource19FromJSON(
  jsonString: string,
): SafeParseResult<GitSource19, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource19$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource19' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type,
  );

/** @internal */
export const GitSource18$inboundSchema: z.ZodType<
  GitSource18,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody18Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  org: types.string(),
  repo: types.string(),
  repoPushedAt: types.optional(types.number()),
});

export function gitSource18FromJSON(
  jsonString: string,
): SafeParseResult<GitSource18, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource18$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource18' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type,
  );

/** @internal */
export const GitSource17$inboundSchema: z.ZodType<
  GitSource17,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody17Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  owner: types.optional(types.string()),
  slug: types.optional(types.string()),
  workspaceUuid: types.string(),
  repoUuid: types.string(),
});

export function gitSource17FromJSON(
  jsonString: string,
): SafeParseResult<GitSource17, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource17$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource17' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type,
  );

/** @internal */
export const GitSource16$inboundSchema: z.ZodType<
  GitSource16,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody16Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  projectId: types.number(),
});

export function gitSource16FromJSON(
  jsonString: string,
): SafeParseResult<GitSource16, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource16$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource16' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type,
  );

/** @internal */
export const GitSource15$inboundSchema: z.ZodType<
  GitSource15,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody15Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

export function gitSource15FromJSON(
  jsonString: string,
): SafeParseResult<GitSource15, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource15$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource15' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type,
  );

/** @internal */
export const GitSource14$inboundSchema: z.ZodType<
  GitSource14,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody14Type$inboundSchema,
  host: types.string(),
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

export function gitSource14FromJSON(
  jsonString: string,
): SafeParseResult<GitSource14, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource14$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource14' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type,
  );

/** @internal */
export const GitSource13$inboundSchema: z.ZodType<
  GitSource13,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody13Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  repoId: types.number(),
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
});

export function gitSource13FromJSON(
  jsonString: string,
): SafeParseResult<GitSource13, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource13$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource13' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type,
  );

/** @internal */
export const GitSource12$inboundSchema: z.ZodType<
  GitSource12,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody12Type$inboundSchema,
  ref: types.string(),
  sha: types.string(),
  gitUrl: types.string(),
});

export function gitSource12FromJSON(
  jsonString: string,
): SafeParseResult<GitSource12, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource12$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource12' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type,
  );

/** @internal */
export const GitSource11$inboundSchema: z.ZodType<
  GitSource11,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody11Type$inboundSchema,
  repoId: types.string(),
  owner: types.optional(types.string()),
  repo: types.optional(types.string()),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function gitSource11FromJSON(
  jsonString: string,
): SafeParseResult<GitSource11, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource11$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource11' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type,
  );

/** @internal */
export const GitSource10$inboundSchema: z.ZodType<
  GitSource10,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody10Type$inboundSchema,
  org: types.optional(types.string()),
  repo: types.optional(types.string()),
  sha: types.string(),
  repoPushedAt: types.optional(types.number()),
  ref: z.nullable(types.string()).optional(),
  prId: z.nullable(types.number()).optional(),
});

export function gitSource10FromJSON(
  jsonString: string,
): SafeParseResult<GitSource10, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSource10$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSource10' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type,
  );

/** @internal */
export const CancelDeploymentGitSource9$inboundSchema: z.ZodType<
  CancelDeploymentGitSource9,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody9Type$inboundSchema,
  owner: types.string(),
  slug: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource9FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource9, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource9$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource9' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type,
  );

/** @internal */
export const CancelDeploymentGitSource8$inboundSchema: z.ZodType<
  CancelDeploymentGitSource8,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody8Type$inboundSchema,
  workspaceUuid: types.optional(types.string()),
  repoUuid: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource8FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource8, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource8$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource8' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type,
  );

/** @internal */
export const GitSourceProjectId$inboundSchema: z.ZodType<
  GitSourceProjectId,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

export function gitSourceProjectIdFromJSON(
  jsonString: string,
): SafeParseResult<GitSourceProjectId, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GitSourceProjectId$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GitSourceProjectId' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSource7$inboundSchema: z.ZodType<
  CancelDeploymentGitSource7,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBody7Type$inboundSchema,
  projectId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource7FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource7, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource7$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource7' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType,
  );

/** @internal */
export const CancelDeploymentGitSource6$inboundSchema: z.ZodType<
  CancelDeploymentGitSource6,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONResponseBodyType$inboundSchema,
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource6FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource6, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource6$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource6' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType$inboundSchema:
  z.ZodNativeEnum<
    typeof CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType
  > = z.nativeEnum(
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType,
  );

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponseRepoId$inboundSchema:
  z.ZodType<
    CancelDeploymentGitSourceDeploymentsResponseRepoId,
    z.ZodTypeDef,
    unknown
  > = smartUnion([types.string(), types.number()]);

export function cancelDeploymentGitSourceDeploymentsResponseRepoIdFromJSON(
  jsonString: string,
): SafeParseResult<
  CancelDeploymentGitSourceDeploymentsResponseRepoId,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CancelDeploymentGitSourceDeploymentsResponseRepoId$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CancelDeploymentGitSourceDeploymentsResponseRepoId' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSource5$inboundSchema: z.ZodType<
  CancelDeploymentGitSource5,
  z.ZodTypeDef,
  unknown
> = z.object({
  type:
    CancelDeploymentGitSourceDeploymentsResponse200ApplicationJSONType$inboundSchema,
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource5FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource5, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource5$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource5' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponse200Type$inboundSchema:
  z.ZodNativeEnum<typeof CancelDeploymentGitSourceDeploymentsResponse200Type> =
    z.nativeEnum(CancelDeploymentGitSourceDeploymentsResponse200Type);

/** @internal */
export const CancelDeploymentGitSource4$inboundSchema: z.ZodType<
  CancelDeploymentGitSource4,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentGitSourceDeploymentsResponse200Type$inboundSchema,
  host: types.string(),
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource4FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource4, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource4$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource4' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsResponseType$inboundSchema:
  z.ZodNativeEnum<typeof CancelDeploymentGitSourceDeploymentsResponseType> = z
    .nativeEnum(CancelDeploymentGitSourceDeploymentsResponseType);

/** @internal */
export const CancelDeploymentGitSourceDeploymentsRepoId$inboundSchema:
  z.ZodType<CancelDeploymentGitSourceDeploymentsRepoId, z.ZodTypeDef, unknown> =
    smartUnion([types.string(), types.number()]);

export function cancelDeploymentGitSourceDeploymentsRepoIdFromJSON(
  jsonString: string,
): SafeParseResult<
  CancelDeploymentGitSourceDeploymentsRepoId,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CancelDeploymentGitSourceDeploymentsRepoId$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CancelDeploymentGitSourceDeploymentsRepoId' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSource3$inboundSchema: z.ZodType<
  CancelDeploymentGitSource3,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentGitSourceDeploymentsResponseType$inboundSchema,
  host: types.string(),
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource3FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource3, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource3$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource3' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceDeploymentsType$inboundSchema:
  z.ZodNativeEnum<typeof CancelDeploymentGitSourceDeploymentsType> = z
    .nativeEnum(CancelDeploymentGitSourceDeploymentsType);

/** @internal */
export const CancelDeploymentGitSource2$inboundSchema: z.ZodType<
  CancelDeploymentGitSource2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentGitSourceDeploymentsType$inboundSchema,
  org: types.string(),
  repo: types.string(),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource2FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource2' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSourceType$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentGitSourceType
> = z.nativeEnum(CancelDeploymentGitSourceType);

/** @internal */
export const CancelDeploymentGitSourceRepoId$inboundSchema: z.ZodType<
  CancelDeploymentGitSourceRepoId,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

export function cancelDeploymentGitSourceRepoIdFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSourceRepoId, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSourceRepoId$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSourceRepoId' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSource1$inboundSchema: z.ZodType<
  CancelDeploymentGitSource1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentGitSourceType$inboundSchema,
  repoId: smartUnion([types.string(), types.number()]),
  ref: z.nullable(types.string()).optional(),
  sha: types.optional(types.string()),
  prId: z.nullable(types.number()).optional(),
});

export function cancelDeploymentGitSource1FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource1' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentGitSource$inboundSchema: z.ZodType<
  CancelDeploymentGitSource,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  z.lazy(() => GitSource19$inboundSchema),
  z.lazy(() => GitSource14$inboundSchema),
  z.lazy(() => GitSource17$inboundSchema),
  z.lazy(() => GitSource18$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource4$inboundSchema),
  z.lazy(() => GitSource12$inboundSchema),
  z.lazy(() => GitSource13$inboundSchema),
  z.lazy(() => GitSource15$inboundSchema),
  z.lazy(() => GitSource16$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource2$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource3$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource6$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource9$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource1$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource5$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource7$inboundSchema),
  z.lazy(() => CancelDeploymentGitSource8$inboundSchema),
  z.lazy(() => GitSource10$inboundSchema),
  z.lazy(() => GitSource11$inboundSchema),
]);

export function cancelDeploymentGitSourceFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentGitSource, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentGitSource$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentGitSource' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentState$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentState
> = z.nativeEnum(CancelDeploymentState);

/** @internal */
export const ManualProvisioning$inboundSchema: z.ZodType<
  ManualProvisioning,
  z.ZodTypeDef,
  unknown
> = z.object({
  state: CancelDeploymentState$inboundSchema,
  completedAt: types.optional(types.number()),
});

export function manualProvisioningFromJSON(
  jsonString: string,
): SafeParseResult<ManualProvisioning, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ManualProvisioning$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ManualProvisioning' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentNodeVersion$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentNodeVersion
> = z.nativeEnum(CancelDeploymentNodeVersion);

/** @internal */
export const CancelDeploymentProject$inboundSchema: z.ZodType<
  CancelDeploymentProject,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  name: types.string(),
  framework: z.nullable(types.string()).optional(),
});

export function cancelDeploymentProjectFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentProject, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentProject$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentProject' from JSON`,
  );
}

/** @internal */
export const ReadySubstate$inboundSchema: z.ZodNativeEnum<
  typeof ReadySubstate
> = z.nativeEnum(ReadySubstate);

/** @internal */
export const CancelDeploymentSource$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentSource
> = z.nativeEnum(CancelDeploymentSource);

/** @internal */
export const OidcTokenClaims$inboundSchema: z.ZodType<
  OidcTokenClaims,
  z.ZodTypeDef,
  unknown
> = z.object({
  iss: types.string(),
  sub: types.string(),
  scope: types.string(),
  aud: types.string(),
  owner: types.string(),
  owner_id: types.string(),
  project: types.string(),
  project_id: types.string(),
  environment: types.string(),
  custom_environment_id: types.optional(types.string()),
  mfe_group_ids: types.optional(z.array(types.string())),
  plan: types.optional(types.string()),
}).transform((v) => {
  return remap$(v, {
    "owner_id": "ownerId",
    "project_id": "projectId",
    "custom_environment_id": "customEnvironmentId",
    "mfe_group_ids": "mfeGroupIds",
  });
});

export function oidcTokenClaimsFromJSON(
  jsonString: string,
): SafeParseResult<OidcTokenClaims, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => OidcTokenClaims$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'OidcTokenClaims' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentPlan$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentPlan
> = z.nativeEnum(CancelDeploymentPlan);

/** @internal */
export const Crons$inboundSchema: z.ZodType<Crons, z.ZodTypeDef, unknown> = z
  .object({
    schedule: types.string(),
    path: types.string(),
  });

export function cronsFromJSON(
  jsonString: string,
): SafeParseResult<Crons, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Crons$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Crons' from JSON`,
  );
}

/** @internal */
export const Kinds$inboundSchema: z.ZodNativeEnum<typeof Kinds> = z.nativeEnum(
  Kinds,
);

/** @internal */
export const Subscription$inboundSchema: z.ZodType<
  Subscription,
  z.ZodTypeDef,
  unknown
> = z.object({
  collections: z.array(types.string()),
  dids: types.optional(z.array(types.string())),
  kinds: types.optional(z.array(Kinds$inboundSchema)),
  path: types.string(),
});

export function subscriptionFromJSON(
  jsonString: string,
): SafeParseResult<Subscription, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Subscription$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Subscription' from JSON`,
  );
}

/** @internal */
export const Atproto2$inboundSchema: z.ZodType<
  Atproto2,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.literal(true),
  subscription: z.lazy(() => Subscription$inboundSchema),
});

export function atproto2FromJSON(
  jsonString: string,
): SafeParseResult<Atproto2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Atproto2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Atproto2' from JSON`,
  );
}

/** @internal */
export const Atproto1$inboundSchema: z.ZodType<
  Atproto1,
  z.ZodTypeDef,
  unknown
> = z.object({
  enabled: types.literal(false),
});

export function atproto1FromJSON(
  jsonString: string,
): SafeParseResult<Atproto1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Atproto1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Atproto1' from JSON`,
  );
}

/** @internal */
export const Atproto$inboundSchema: z.ZodType<Atproto, z.ZodTypeDef, unknown> =
  smartUnion([
    z.lazy(() => Atproto2$inboundSchema),
    z.lazy(() => Atproto1$inboundSchema),
  ]);

export function atprotoFromJSON(
  jsonString: string,
): SafeParseResult<Atproto, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Atproto$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Atproto' from JSON`,
  );
}

/** @internal */
export const Architecture$inboundSchema: z.ZodNativeEnum<typeof Architecture> =
  z.nativeEnum(Architecture);

/** @internal */
export const MaxDuration2$inboundSchema: z.ZodNativeEnum<typeof MaxDuration2> =
  z.nativeEnum(MaxDuration2);

/** @internal */
export const MaxDuration$inboundSchema: z.ZodType<
  MaxDuration,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.number(), MaxDuration2$inboundSchema]);

export function maxDurationFromJSON(
  jsonString: string,
): SafeParseResult<MaxDuration, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => MaxDuration$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'MaxDuration' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentMode$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentMode
> = z.nativeEnum(CancelDeploymentMode);

/** @internal */
export const Affinity$inboundSchema: z.ZodType<
  Affinity,
  z.ZodTypeDef,
  unknown
> = z.object({
  mode: CancelDeploymentMode$inboundSchema,
});

export function affinityFromJSON(
  jsonString: string,
): SafeParseResult<Affinity, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Affinity$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Affinity' from JSON`,
  );
}

/** @internal */
export const ExperimentalTriggers3$inboundSchema: z.ZodType<
  ExperimentalTriggers3,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("schedule/v1beta"),
});

export function experimentalTriggers3FromJSON(
  jsonString: string,
): SafeParseResult<ExperimentalTriggers3, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ExperimentalTriggers3$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ExperimentalTriggers3' from JSON`,
  );
}

/** @internal */
export const ExperimentalTriggers2$inboundSchema: z.ZodType<
  ExperimentalTriggers2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("queue/v2beta"),
  topic: types.string(),
  maxDeliveries: types.optional(types.number()),
  retryAfterSeconds: types.optional(types.number()),
  initialDelaySeconds: types.optional(types.number()),
  maxConcurrency: types.optional(types.number()),
});

export function experimentalTriggers2FromJSON(
  jsonString: string,
): SafeParseResult<ExperimentalTriggers2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ExperimentalTriggers2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ExperimentalTriggers2' from JSON`,
  );
}

/** @internal */
export const ExperimentalTriggers1$inboundSchema: z.ZodType<
  ExperimentalTriggers1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("queue/v1beta"),
  consumer: types.string(),
  topic: types.string(),
  maxDeliveries: types.optional(types.number()),
  retryAfterSeconds: types.optional(types.number()),
  initialDelaySeconds: types.optional(types.number()),
  maxConcurrency: types.optional(types.number()),
});

export function experimentalTriggers1FromJSON(
  jsonString: string,
): SafeParseResult<ExperimentalTriggers1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ExperimentalTriggers1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ExperimentalTriggers1' from JSON`,
  );
}

/** @internal */
export const ExperimentalTriggers$inboundSchema: z.ZodType<
  ExperimentalTriggers,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => ExperimentalTriggers1$inboundSchema),
  z.lazy(() => ExperimentalTriggers2$inboundSchema),
  z.lazy(() => ExperimentalTriggers3$inboundSchema),
]);

export function experimentalTriggersFromJSON(
  jsonString: string,
): SafeParseResult<ExperimentalTriggers, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ExperimentalTriggers$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ExperimentalTriggers' from JSON`,
  );
}

/** @internal */
export const Functions$inboundSchema: z.ZodType<
  Functions,
  z.ZodTypeDef,
  unknown
> = z.object({
  architecture: types.optional(Architecture$inboundSchema),
  memory: types.optional(types.number()),
  maxDuration: types.optional(
    smartUnion([types.number(), MaxDuration2$inboundSchema]),
  ),
  affinity: types.optional(z.lazy(() => Affinity$inboundSchema)),
  maxConcurrency: types.optional(types.number()),
  regions: types.optional(z.array(types.string())),
  functionFailoverRegions: types.optional(z.array(types.string())),
  runtime: types.optional(types.string()),
  includeFiles: types.optional(types.string()),
  excludeFiles: types.optional(types.string()),
  experimentalTriggers: types.optional(
    z.array(z.union([
      z.lazy(() => ExperimentalTriggers1$inboundSchema),
      z.lazy(() =>
        ExperimentalTriggers2$inboundSchema
      ),
      z.lazy(() => ExperimentalTriggers3$inboundSchema),
    ])),
  ),
  supportsCancellation: types.optional(types.boolean()),
});

export function functionsFromJSON(
  jsonString: string,
): SafeParseResult<Functions, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Functions$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Functions' from JSON`,
  );
}

/** @internal */
export const Routes3$inboundSchema: z.ZodType<Routes3, z.ZodTypeDef, unknown> =
  z.object({
    src: types.string(),
    continue: types.boolean(),
    middleware: types.number(),
  });

export function routes3FromJSON(
  jsonString: string,
): SafeParseResult<Routes3, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Routes3$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Routes3' from JSON`,
  );
}

/** @internal */
export const Handle$inboundSchema: z.ZodNativeEnum<typeof Handle> = z
  .nativeEnum(Handle);

/** @internal */
export const Routes2$inboundSchema: z.ZodType<Routes2, z.ZodTypeDef, unknown> =
  z.object({
    handle: Handle$inboundSchema,
    src: types.optional(types.string()),
    dest: types.optional(types.string()),
    status: types.optional(types.number()),
  });

export function routes2FromJSON(
  jsonString: string,
): SafeParseResult<Routes2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Routes2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Routes2' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentHasType$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentHasType
> = z.nativeEnum(CancelDeploymentHasType);

/** @internal */
export const ValueEq$inboundSchema: z.ZodType<ValueEq, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), types.number()]);

export function valueEqFromJSON(
  jsonString: string,
): SafeParseResult<ValueEq, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ValueEq$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ValueEq' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentValue2$inboundSchema: z.ZodType<
  CancelDeploymentValue2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

export function cancelDeploymentValue2FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentValue2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentValue2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentValue2' from JSON`,
  );
}

/** @internal */
export const HasValue$inboundSchema: z.ZodType<
  HasValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CancelDeploymentValue2$inboundSchema),
]);

export function hasValueFromJSON(
  jsonString: string,
): SafeParseResult<HasValue, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => HasValue$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'HasValue' from JSON`,
  );
}

/** @internal */
export const Has2$inboundSchema: z.ZodType<Has2, z.ZodTypeDef, unknown> = z
  .object({
    type: CancelDeploymentHasType$inboundSchema,
    key: types.string(),
    value: types.optional(
      smartUnion([
        types.string(),
        z.lazy(() => CancelDeploymentValue2$inboundSchema),
      ]),
    ),
  });

export function has2FromJSON(
  jsonString: string,
): SafeParseResult<Has2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Has2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Has2' from JSON`,
  );
}

/** @internal */
export const Eq$inboundSchema: z.ZodType<Eq, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), types.number()]);

export function eqFromJSON(
  jsonString: string,
): SafeParseResult<Eq, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Eq$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Eq' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentValueDeploymentsResponse2002$inboundSchema:
  z.ZodType<
    CancelDeploymentValueDeploymentsResponse2002,
    z.ZodTypeDef,
    unknown
  > = z.object({
    eq: types.optional(smartUnion([types.string(), types.number()])),
    neq: types.optional(types.string()),
    inc: types.optional(z.array(types.string())),
    ninc: types.optional(z.array(types.string())),
    pre: types.optional(types.string()),
    suf: types.optional(types.string()),
    re: types.optional(types.string()),
    gt: types.optional(types.number()),
    gte: types.optional(types.number()),
    lt: types.optional(types.number()),
    lte: types.optional(types.number()),
  });

export function cancelDeploymentValueDeploymentsResponse2002FromJSON(
  jsonString: string,
): SafeParseResult<
  CancelDeploymentValueDeploymentsResponse2002,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CancelDeploymentValueDeploymentsResponse2002$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CancelDeploymentValueDeploymentsResponse2002' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentHasValue$inboundSchema: z.ZodType<
  CancelDeploymentHasValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CancelDeploymentValueDeploymentsResponse2002$inboundSchema),
]);

export function cancelDeploymentHasValueFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentHasValue, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentHasValue$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentHasValue' from JSON`,
  );
}

/** @internal */
export const Has1$inboundSchema: z.ZodType<Has1, z.ZodTypeDef, unknown> = z
  .object({
    type: types.literal("host"),
    value: smartUnion([
      types.string(),
      z.lazy(() => CancelDeploymentValueDeploymentsResponse2002$inboundSchema),
    ]),
  });

export function has1FromJSON(
  jsonString: string,
): SafeParseResult<Has1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Has1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Has1' from JSON`,
  );
}

/** @internal */
export const RoutesHas$inboundSchema: z.ZodType<
  RoutesHas,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => Has1$inboundSchema),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("cookie") })),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("header") })),
  z.lazy(() => Has2$inboundSchema).and(z.object({ type: z.literal("query") })),
]);

export function routesHasFromJSON(
  jsonString: string,
): SafeParseResult<RoutesHas, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RoutesHas$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RoutesHas' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentMissingType$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentMissingType
> = z.nativeEnum(CancelDeploymentMissingType);

/** @internal */
export const CancelDeploymentValueDeploymentsEq$inboundSchema: z.ZodType<
  CancelDeploymentValueDeploymentsEq,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

export function cancelDeploymentValueDeploymentsEqFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentValueDeploymentsEq, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      CancelDeploymentValueDeploymentsEq$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentValueDeploymentsEq' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentValueDeploymentsResponse2$inboundSchema: z.ZodType<
  CancelDeploymentValueDeploymentsResponse2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

export function cancelDeploymentValueDeploymentsResponse2FromJSON(
  jsonString: string,
): SafeParseResult<
  CancelDeploymentValueDeploymentsResponse2,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      CancelDeploymentValueDeploymentsResponse2$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'CancelDeploymentValueDeploymentsResponse2' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentMissingValue$inboundSchema: z.ZodType<
  CancelDeploymentMissingValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CancelDeploymentValueDeploymentsResponse2$inboundSchema),
]);

export function cancelDeploymentMissingValueFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentMissingValue, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentMissingValue$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentMissingValue' from JSON`,
  );
}

/** @internal */
export const Missing2$inboundSchema: z.ZodType<
  Missing2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: CancelDeploymentMissingType$inboundSchema,
  key: types.string(),
  value: types.optional(
    smartUnion([
      types.string(),
      z.lazy(() => CancelDeploymentValueDeploymentsResponse2$inboundSchema),
    ]),
  ),
});

export function missing2FromJSON(
  jsonString: string,
): SafeParseResult<Missing2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Missing2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Missing2' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentValueEq$inboundSchema: z.ZodType<
  CancelDeploymentValueEq,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), types.number()]);

export function cancelDeploymentValueEqFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentValueEq, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentValueEq$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentValueEq' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentValueDeployments2$inboundSchema: z.ZodType<
  CancelDeploymentValueDeployments2,
  z.ZodTypeDef,
  unknown
> = z.object({
  eq: types.optional(smartUnion([types.string(), types.number()])),
  neq: types.optional(types.string()),
  inc: types.optional(z.array(types.string())),
  ninc: types.optional(z.array(types.string())),
  pre: types.optional(types.string()),
  suf: types.optional(types.string()),
  re: types.optional(types.string()),
  gt: types.optional(types.number()),
  gte: types.optional(types.number()),
  lt: types.optional(types.number()),
  lte: types.optional(types.number()),
});

export function cancelDeploymentValueDeployments2FromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentValueDeployments2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentValueDeployments2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentValueDeployments2' from JSON`,
  );
}

/** @internal */
export const MissingValue$inboundSchema: z.ZodType<
  MissingValue,
  z.ZodTypeDef,
  unknown
> = smartUnion([
  types.string(),
  z.lazy(() => CancelDeploymentValueDeployments2$inboundSchema),
]);

export function missingValueFromJSON(
  jsonString: string,
): SafeParseResult<MissingValue, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => MissingValue$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'MissingValue' from JSON`,
  );
}

/** @internal */
export const Missing1$inboundSchema: z.ZodType<
  Missing1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("host"),
  value: smartUnion([
    types.string(),
    z.lazy(() => CancelDeploymentValueDeployments2$inboundSchema),
  ]),
});

export function missing1FromJSON(
  jsonString: string,
): SafeParseResult<Missing1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Missing1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Missing1' from JSON`,
  );
}

/** @internal */
export const RoutesMissing$inboundSchema: z.ZodType<
  RoutesMissing,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => Missing1$inboundSchema),
  z.lazy(() => Missing2$inboundSchema).and(
    z.object({ type: z.literal("cookie") }),
  ),
  z.lazy(() => Missing2$inboundSchema).and(
    z.object({ type: z.literal("header") }),
  ),
  z.lazy(() => Missing2$inboundSchema).and(
    z.object({ type: z.literal("query") }),
  ),
]);

export function routesMissingFromJSON(
  jsonString: string,
): SafeParseResult<RoutesMissing, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RoutesMissing$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RoutesMissing' from JSON`,
  );
}

/** @internal */
export const RoutesAction$inboundSchema: z.ZodNativeEnum<typeof RoutesAction> =
  z.nativeEnum(RoutesAction);

/** @internal */
export const RoutesMitigate$inboundSchema: z.ZodType<
  RoutesMitigate,
  z.ZodTypeDef,
  unknown
> = z.object({
  action: RoutesAction$inboundSchema,
});

export function routesMitigateFromJSON(
  jsonString: string,
): SafeParseResult<RoutesMitigate, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RoutesMitigate$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RoutesMitigate' from JSON`,
  );
}

/** @internal */
export const TransformsOp$inboundSchema: z.ZodNativeEnum<typeof TransformsOp> =
  z.nativeEnum(TransformsOp);

/** @internal */
export const Transforms2$inboundSchema: z.ZodType<
  Transforms2,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: types.literal("request.path"),
  op: TransformsOp$inboundSchema,
  args: types.string(),
  env: types.optional(z.array(types.string())),
});

export function transforms2FromJSON(
  jsonString: string,
): SafeParseResult<Transforms2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Transforms2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Transforms2' from JSON`,
  );
}

/** @internal */
export const TransformsType$inboundSchema: z.ZodNativeEnum<
  typeof TransformsType
> = z.nativeEnum(TransformsType);

/** @internal */
export const CancelDeploymentTransformsOp$inboundSchema: z.ZodNativeEnum<
  typeof CancelDeploymentTransformsOp
> = z.nativeEnum(CancelDeploymentTransformsOp);

/** @internal */
export const KeyEq$inboundSchema: z.ZodType<KeyEq, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), types.number()]);

export function keyEqFromJSON(
  jsonString: string,
): SafeParseResult<KeyEq, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => KeyEq$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'KeyEq' from JSON`,
  );
}

/** @internal */
export const Key2$inboundSchema: z.ZodType<Key2, z.ZodTypeDef, unknown> = z
  .object({
    eq: types.optional(smartUnion([types.string(), types.number()])),
    neq: types.optional(types.string()),
    inc: types.optional(z.array(types.string())),
    ninc: types.optional(z.array(types.string())),
    pre: types.optional(types.string()),
    suf: types.optional(types.string()),
    gt: types.optional(types.number()),
    gte: types.optional(types.number()),
    lt: types.optional(types.number()),
    lte: types.optional(types.number()),
  });

export function key2FromJSON(
  jsonString: string,
): SafeParseResult<Key2, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Key2$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Key2' from JSON`,
  );
}

/** @internal */
export const CancelDeploymentTransformsKey$inboundSchema: z.ZodType<
  CancelDeploymentTransformsKey,
  z.ZodTypeDef,
  unknown
> = smartUnion([types.string(), z.lazy(() => Key2$inboundSchema)]);

export function cancelDeploymentTransformsKeyFromJSON(
  jsonString: string,
): SafeParseResult<CancelDeploymentTransformsKey, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CancelDeploymentTransformsKey$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CancelDeploymentTransformsKey' from JSON`,
  );
}

/** @internal */
export const TransformsTarget$inboundSchema: z.ZodType<
  TransformsTarget,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: smartUnion([types.string(), z.lazy(() => Key2$inboundSchema)]),
});

export function transformsTargetFromJSON(
  jsonString: string,
): SafeParseResult<TransformsTarget, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => TransformsTarget$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'TransformsTarget' from JSON`,
  );
}

/** @internal */
export const Args$inboundSchema: z.ZodType<Args, z.ZodTypeDef, unknown> =
  smartUnion([types.string(), z.array(types.string())]);

export function argsFromJSON(
  jsonString: string,
): SafeParseResult<Args, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Args$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Args' from JSON`,
  );
}

/** @internal */
export const Transforms1$inboundSchema: z.ZodType<
  Transforms1,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: TransformsType$inboundSchema,
  op: CancelDeploymentTransformsOp$inboundSchema,
  target: z.lazy(() => TransformsTarget$inboundSchema),
  args: types.optional(smartUnion([types.string(), z.array(types.string())])),
  env: types.optional(z.array(types.string())),
});

export function transforms1FromJSON(
  jsonString: string,
): SafeParseResult<Transforms1, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Transforms1$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Transforms1' from JSON`,
  );
}

/** @internal */
export const RoutesTransforms$inboundSchema: z.ZodType<
  RoutesTransforms,
  z.ZodTypeDef,
  unknown
> = z.union([
  z.lazy(() => Transforms1$inboundSchema).and(
    z.object({ type: z.literal("request.headers") }),
  ),
  z.lazy(() => Transforms1$inboundSchema).and(
    z.object({ type: z.literal("request.query") }),
  ),
  z.lazy(() => Transforms1$inboundSchema).and(
    z.object({ type: z.literal("response.headers") }),
  ),
  z.lazy(() => Transforms2$inboundSchema),
]);

export function routesTransformsFromJSON(
  jsonString: string,
): SafeParseResult<RoutesTransforms, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RoutesTransforms$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RoutesTransforms' from JSON`,
  );
}

/** @internal */
export const Locale$inboundSchema: z.ZodType<Locale, z.ZodTypeDef, unknown> = z
  .object({
    redirect: types.optional(z.record(types.string())),
    cookie: types.optional(types.string()),
  });

export function localeFromJSON(
  jsonString: string,
): SafeParseResult<Locale, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => Locale$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'Locale' from JSON`,
  );
}