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>

395 lines (357 loc) 11 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 GetStorageStoresByIdRequest = { id: string; skipMetadata?: boolean | undefined; includeGuides?: boolean | undefined; }; export const GetStorageStoresByIdFramework = { 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 GetStorageStoresByIdFramework = ClosedEnum< typeof GetStorageStoresByIdFramework >; export type GetStorageStoresByIdActions = { slug: string; environments: Array<string>; }; export type GetStorageStoresByIdDeployments = { required: boolean; actions: Array<GetStorageStoresByIdActions>; }; export type GetStorageStoresByIdProjectsMetadata = { id: string; projectId: string; name: string; framework?: GetStorageStoresByIdFramework | null | undefined; latestDeployment?: string | undefined; environments: Array<string>; envVarPrefix: string | null; environmentVariables: Array<string>; deployments?: GetStorageStoresByIdDeployments | undefined; makeEnvVarsSensitive?: boolean | undefined; }; export const Providers2 = { Wildcard: "*", } as const; export type Providers2 = ClosedEnum<typeof Providers2>; export const Providers1 = { Bitbucket: "bitbucket", Github: "github", Gitlab: "gitlab", } as const; export type Providers1 = ClosedEnum<typeof Providers1>; export type GetStorageStoresByIdProviders = Array<Providers1> | Providers2; export type Git = { providers: Array<Providers1> | Providers2; owners?: Array<string> | undefined; repos?: Array<string> | undefined; }; export type ProjectFilter = { git?: Git | undefined; }; export const GetStorageStoresByIdStatus = { Available: "available", Error: "error", Initializing: "initializing", LimitsExceededSuspended: "limits-exceeded-suspended", LimitsExceededSuspendedStoreCount: "limits-exceeded-suspended-store-count", Onboarding: "onboarding", Suspended: "suspended", Uninstalled: "uninstalled", } as const; export type GetStorageStoresByIdStatus = ClosedEnum< typeof GetStorageStoresByIdStatus >; export type GetStorageStoresByIdStore = { projectsMetadata: Array<GetStorageStoresByIdProjectsMetadata>; projectFilter?: ProjectFilter | undefined; totalConnectedProjects?: number | undefined; usageQuotaExceeded: boolean; status: GetStorageStoresByIdStatus | null; }; export type GetStorageStoresByIdResponseBody = { store: GetStorageStoresByIdStore; }; /** @internal */ export type GetStorageStoresByIdRequest$Outbound = { id: string; "skip-metadata"?: boolean | undefined; "include-guides"?: boolean | undefined; }; /** @internal */ export const GetStorageStoresByIdRequest$outboundSchema: z.ZodType< GetStorageStoresByIdRequest$Outbound, z.ZodTypeDef, GetStorageStoresByIdRequest > = z.object({ id: z.string(), skipMetadata: z.boolean().optional(), includeGuides: z.boolean().optional(), }).transform((v) => { return remap$(v, { skipMetadata: "skip-metadata", includeGuides: "include-guides", }); }); export function getStorageStoresByIdRequestToJSON( getStorageStoresByIdRequest: GetStorageStoresByIdRequest, ): string { return JSON.stringify( GetStorageStoresByIdRequest$outboundSchema.parse( getStorageStoresByIdRequest, ), ); } /** @internal */ export const GetStorageStoresByIdFramework$inboundSchema: z.ZodNativeEnum< typeof GetStorageStoresByIdFramework > = z.nativeEnum(GetStorageStoresByIdFramework); /** @internal */ export const GetStorageStoresByIdActions$inboundSchema: z.ZodType< GetStorageStoresByIdActions, z.ZodTypeDef, unknown > = z.object({ slug: types.string(), environments: z.array(types.string()), }); export function getStorageStoresByIdActionsFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdActions, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdActions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdActions' from JSON`, ); } /** @internal */ export const GetStorageStoresByIdDeployments$inboundSchema: z.ZodType< GetStorageStoresByIdDeployments, z.ZodTypeDef, unknown > = z.object({ required: types.boolean(), actions: z.array(z.lazy(() => GetStorageStoresByIdActions$inboundSchema)), }); export function getStorageStoresByIdDeploymentsFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdDeployments, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdDeployments$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdDeployments' from JSON`, ); } /** @internal */ export const GetStorageStoresByIdProjectsMetadata$inboundSchema: z.ZodType< GetStorageStoresByIdProjectsMetadata, z.ZodTypeDef, unknown > = z.object({ id: types.string(), projectId: types.string(), name: types.string(), framework: z.nullable(GetStorageStoresByIdFramework$inboundSchema).optional(), latestDeployment: types.optional(types.string()), environments: z.array(types.string()), envVarPrefix: types.nullable(types.string()), environmentVariables: z.array(types.string()), deployments: types.optional( z.lazy(() => GetStorageStoresByIdDeployments$inboundSchema), ), makeEnvVarsSensitive: types.optional(types.boolean()), }); export function getStorageStoresByIdProjectsMetadataFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdProjectsMetadata, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdProjectsMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdProjectsMetadata' from JSON`, ); } /** @internal */ export const Providers2$inboundSchema: z.ZodNativeEnum<typeof Providers2> = z .nativeEnum(Providers2); /** @internal */ export const Providers1$inboundSchema: z.ZodNativeEnum<typeof Providers1> = z .nativeEnum(Providers1); /** @internal */ export const GetStorageStoresByIdProviders$inboundSchema: z.ZodType< GetStorageStoresByIdProviders, z.ZodTypeDef, unknown > = smartUnion([z.array(Providers1$inboundSchema), Providers2$inboundSchema]); export function getStorageStoresByIdProvidersFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdProviders, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdProviders$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdProviders' from JSON`, ); } /** @internal */ export const Git$inboundSchema: z.ZodType<Git, z.ZodTypeDef, unknown> = z .object({ providers: smartUnion([ z.array(Providers1$inboundSchema), Providers2$inboundSchema, ]), owners: types.optional(z.array(types.string())), repos: types.optional(z.array(types.string())), }); export function gitFromJSON( jsonString: string, ): SafeParseResult<Git, SDKValidationError> { return safeParse( jsonString, (x) => Git$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Git' from JSON`, ); } /** @internal */ export const ProjectFilter$inboundSchema: z.ZodType< ProjectFilter, z.ZodTypeDef, unknown > = z.object({ git: types.optional(z.lazy(() => Git$inboundSchema)), }); export function projectFilterFromJSON( jsonString: string, ): SafeParseResult<ProjectFilter, SDKValidationError> { return safeParse( jsonString, (x) => ProjectFilter$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProjectFilter' from JSON`, ); } /** @internal */ export const GetStorageStoresByIdStatus$inboundSchema: z.ZodNativeEnum< typeof GetStorageStoresByIdStatus > = z.nativeEnum(GetStorageStoresByIdStatus); /** @internal */ export const GetStorageStoresByIdStore$inboundSchema: z.ZodType< GetStorageStoresByIdStore, z.ZodTypeDef, unknown > = z.object({ projectsMetadata: z.array( z.lazy(() => GetStorageStoresByIdProjectsMetadata$inboundSchema), ), projectFilter: types.optional(z.lazy(() => ProjectFilter$inboundSchema)), totalConnectedProjects: types.optional(types.number()), usageQuotaExceeded: types.boolean(), status: types.nullable(GetStorageStoresByIdStatus$inboundSchema), }); export function getStorageStoresByIdStoreFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdStore, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdStore$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdStore' from JSON`, ); } /** @internal */ export const GetStorageStoresByIdResponseBody$inboundSchema: z.ZodType< GetStorageStoresByIdResponseBody, z.ZodTypeDef, unknown > = z.object({ store: z.lazy(() => GetStorageStoresByIdStore$inboundSchema), }); export function getStorageStoresByIdResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetStorageStoresByIdResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetStorageStoresByIdResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetStorageStoresByIdResponseBody' from JSON`, ); }