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>

442 lines 23.5 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; import { Block$inboundSchema, BlockHistory4$inboundSchema, CreateProjectDeploymentPolicy$inboundSchema, CreateProjectGitComments$inboundSchema, CreateProjectHasProjectsResponse1$inboundSchema, CreateProjectHasProjectsResponse2$inboundSchema, CreateProjectHistory$inboundSchema, CreateProjectOidcTokenConfig$inboundSchema, CreateProjectPassport$inboundSchema, CreateProjectPermissions$inboundSchema, CreateProjectProjectsResourceConfig$inboundSchema, CreateProjectProjectsSsoProtection$inboundSchema, CreateProjectRollbackDescription$inboundSchema, CreateProjectSandbox$inboundSchema, CreateProjectSecurity$inboundSchema, CreateProjectStaticIps$inboundSchema, CreateProjectTargets$inboundSchema, CreateProjectTier$inboundSchema, CreateProjectTrustedIps$inboundSchema, CreateProjectTrustedSources$inboundSchema, CreateProjectWebAnalytics$inboundSchema, DefaultResourceConfig$inboundSchema, Features$inboundSchema, GitProviderOptions$inboundSchema, LastAliasRequest$inboundSchema, LastRollbackTarget$inboundSchema, ProtectionBypass$inboundSchema, ProtectionConfig$inboundSchema, RollingRelease$inboundSchema, UsageStatus$inboundSchema, } from "./createprojecthasprojectsresponse1.js"; import { Alias$inboundSchema, Analytics$inboundSchema, Blobs$inboundSchema, CreateProjectConnectConfigurations$inboundSchema, CreateProjectCreator$inboundSchema, CreateProjectCrons$inboundSchema, CreateProjectCustomEnvironments$inboundSchema, CreateProjectDataCache$inboundSchema, CreateProjectEnv$inboundSchema, CreateProjectExpiration$inboundSchema, CreateProjectIpBuckets$inboundSchema, CreateProjectMicrofrontends$inboundSchema, CreateProjectNodeVersion$inboundSchema, CreateProjectOptionsAllowlist$inboundSchema, CreateProjectPasswordProtection$inboundSchema, CreateProjectProjectsFramework$inboundSchema, CreateProjectServices$inboundSchema, DeploymentExpiration$inboundSchema, Jobs$inboundSchema, LatestDeployments$inboundSchema, Link$inboundSchema, SpeedInsights$inboundSchema, } from "./createprojectpasswordprotection.js"; export const RouteAction = { BlockLegalCwc: "block_legal_cwc", }; export const CreateProjectProjectsResponse200Action = { AddDeploymentInterstitial: "add-deployment-interstitial", AddProjectInterstitial: "add-project-interstitial", RemoveDeploymentInterstitial: "remove-deployment-interstitial", RemoveProjectInterstitial: "remove-project-interstitial", }; export const CreateProjectHasKey = { XVercelIpCountry: "x-vercel-ip-country", }; export const InternalRoutesAction = { BlockLegalCwc: "block_legal_cwc", }; export const CreateProjectAction = { Accept: "accept", Cancel: "cancel", Delete: "delete", }; export const CreateProjectProjectsEnv = { Preview: "preview", Production: "production", }; /** * Which tracing destination this rule applies to. `internal` is the hidden Vercel production-tracing drain (internal delivery); `external` is any customer-configured drain. Derived from the owning drain's delivery type when project tracing is computed; absent on configs persisted before this field existed. */ export const CreateProjectDestination = { External: "external", Internal: "internal", }; /** @internal */ export const RouteHas$inboundSchema = z.union([ CreateProjectHasProjectsResponse1$inboundSchema, CreateProjectHasProjectsResponse2$inboundSchema, ]); export function routeHasFromJSON(jsonString) { return safeParse(jsonString, (x) => RouteHas$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RouteHas' from JSON`); } /** @internal */ export const RouteAction$inboundSchema = z .nativeEnum(RouteAction); /** @internal */ export const RouteMitigate$inboundSchema = z.object({ action: RouteAction$inboundSchema, }); export function routeMitigateFromJSON(jsonString) { return safeParse(jsonString, (x) => RouteMitigate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RouteMitigate' from JSON`); } /** @internal */ export const Route2$inboundSchema = z .object({ has: z.array(z.union([ CreateProjectHasProjectsResponse1$inboundSchema, CreateProjectHasProjectsResponse2$inboundSchema, ])), mitigate: z.lazy(() => RouteMitigate$inboundSchema), src: types.optional(types.string()), }); export function route2FromJSON(jsonString) { return safeParse(jsonString, (x) => Route2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Route2' from JSON`); } /** @internal */ export const Route1$inboundSchema = z .object({ src: types.string(), status: types.number(), expiry: types.optional(types.number()), }); export function route1FromJSON(jsonString) { return safeParse(jsonString, (x) => Route1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Route1' from JSON`); } /** @internal */ export const BlockHistoryRoute$inboundSchema = smartUnion([ z.lazy(() => Route1$inboundSchema), z.lazy(() => Route2$inboundSchema), ]); export function blockHistoryRouteFromJSON(jsonString) { return safeParse(jsonString, (x) => BlockHistoryRoute$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BlockHistoryRoute' from JSON`); } /** @internal */ export const BlockHistory3$inboundSchema = z.object({ action: types.literal("route-blocked"), route: smartUnion([ z.lazy(() => Route1$inboundSchema), z.lazy(() => Route2$inboundSchema), ]), reason: types.string(), createdAt: types.number(), caseId: types.optional(types.string()), actor: types.optional(types.string()), comment: types.optional(types.string()), ineligibleForAppeal: types.optional(types.boolean()), isCascading: types.optional(types.boolean()), }); export function blockHistory3FromJSON(jsonString) { return safeParse(jsonString, (x) => BlockHistory3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BlockHistory3' from JSON`); } /** @internal */ export const BlockHistory2$inboundSchema = z.object({ action: types.literal("unblocked"), createdAt: types.number(), caseId: types.optional(types.string()), actor: types.optional(types.string()), comment: types.optional(types.string()), ineligibleForAppeal: types.optional(types.boolean()), isCascading: types.optional(types.boolean()), }); export function blockHistory2FromJSON(jsonString) { return safeParse(jsonString, (x) => BlockHistory2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BlockHistory2' from JSON`); } /** @internal */ export const BlockHistory1$inboundSchema = z.object({ action: types.literal("blocked"), reason: types.string(), statusCode: types.number(), createdAt: types.number(), caseId: types.optional(types.string()), actor: types.optional(types.string()), comment: types.optional(types.string()), ineligibleForAppeal: types.optional(types.boolean()), isCascading: types.optional(types.boolean()), }); export function blockHistory1FromJSON(jsonString) { return safeParse(jsonString, (x) => BlockHistory1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BlockHistory1' from JSON`); } /** @internal */ export const CreateProjectBlockHistory$inboundSchema = z.union([ z.lazy(() => BlockHistory1$inboundSchema), z.lazy(() => BlockHistory2$inboundSchema), z.lazy(() => BlockHistory3$inboundSchema), BlockHistory4$inboundSchema, ]); export function createProjectBlockHistoryFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectBlockHistory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectBlockHistory' from JSON`); } /** @internal */ export const CreateProjectProjectsResponse200Action$inboundSchema = z.nativeEnum(CreateProjectProjectsResponse200Action); /** @internal */ export const InterstitialHistory$inboundSchema = z.object({ action: CreateProjectProjectsResponse200Action$inboundSchema, createdAt: types.number(), caseId: types.optional(types.string()), reason: types.optional(types.string()), actor: types.optional(types.string()), comment: types.optional(types.string()), }); export function interstitialHistoryFromJSON(jsonString) { return safeParse(jsonString, (x) => InterstitialHistory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InterstitialHistory' from JSON`); } /** @internal */ export const CreateProjectAbuse$inboundSchema = z.object({ scanner: types.optional(types.string()), history: z.array(CreateProjectHistory$inboundSchema), updatedAt: types.number(), block: types.optional(Block$inboundSchema), blockHistory: types.optional(z.array(z.union([ z.lazy(() => BlockHistory1$inboundSchema), z.lazy(() => BlockHistory2$inboundSchema), z.lazy(() => BlockHistory3$inboundSchema), BlockHistory4$inboundSchema, ]))), interstitial: types.optional(types.boolean()), interstitialHistory: types.optional(z.array(z.lazy(() => InterstitialHistory$inboundSchema))), }); export function createProjectAbuseFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectAbuse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectAbuse' from JSON`); } /** @internal */ export const CreateProjectHasProjectsValue$inboundSchema = z.object({ eq: types.string(), }); export function createProjectHasProjectsValueFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectHasProjectsValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectHasProjectsValue' from JSON`); } /** @internal */ export const CreateProjectHas2$inboundSchema = z.object({ type: types.literal("host"), value: z.lazy(() => CreateProjectHasProjectsValue$inboundSchema), }); export function createProjectHas2FromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectHas2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectHas2' from JSON`); } /** @internal */ export const CreateProjectHasKey$inboundSchema = z.nativeEnum(CreateProjectHasKey); /** @internal */ export const CreateProjectHasValue$inboundSchema = z.object({ eq: types.string(), }); export function createProjectHasValueFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectHasValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectHasValue' from JSON`); } /** @internal */ export const CreateProjectHas1$inboundSchema = z.object({ type: types.literal("header"), key: CreateProjectHasKey$inboundSchema, value: z.lazy(() => CreateProjectHasValue$inboundSchema), }); export function createProjectHas1FromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectHas1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectHas1' from JSON`); } /** @internal */ export const InternalRoutesHas$inboundSchema = z.union([ z.lazy(() => CreateProjectHas1$inboundSchema), z.lazy(() => CreateProjectHas2$inboundSchema), ]); export function internalRoutesHasFromJSON(jsonString) { return safeParse(jsonString, (x) => InternalRoutesHas$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalRoutesHas' from JSON`); } /** @internal */ export const InternalRoutesAction$inboundSchema = z.nativeEnum(InternalRoutesAction); /** @internal */ export const InternalRoutesMitigate$inboundSchema = z.object({ action: InternalRoutesAction$inboundSchema, }); export function internalRoutesMitigateFromJSON(jsonString) { return safeParse(jsonString, (x) => InternalRoutesMitigate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalRoutesMitigate' from JSON`); } /** @internal */ export const InternalRoutes2$inboundSchema = z.object({ has: z.array(z.union([ z.lazy(() => CreateProjectHas1$inboundSchema), z.lazy(() => CreateProjectHas2$inboundSchema), ])), mitigate: z.lazy(() => InternalRoutesMitigate$inboundSchema), src: types.optional(types.string()), }); export function internalRoutes2FromJSON(jsonString) { return safeParse(jsonString, (x) => InternalRoutes2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalRoutes2' from JSON`); } /** @internal */ export const InternalRoutes1$inboundSchema = z.object({ src: types.string(), status: types.number(), expiry: types.optional(types.number()), }); export function internalRoutes1FromJSON(jsonString) { return safeParse(jsonString, (x) => InternalRoutes1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalRoutes1' from JSON`); } /** @internal */ export const InternalRoutes$inboundSchema = smartUnion([ z.lazy(() => InternalRoutes1$inboundSchema), z.lazy(() => InternalRoutes2$inboundSchema), ]); export function internalRoutesFromJSON(jsonString) { return safeParse(jsonString, (x) => InternalRoutes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternalRoutes' from JSON`); } /** @internal */ export const CreateProjectAction$inboundSchema = z.nativeEnum(CreateProjectAction); /** @internal */ export const CreateProjectValuePreviousValue$inboundSchema = smartUnion([types.string(), types.number(), types.boolean()]); export function createProjectValuePreviousValueFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectValuePreviousValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectValuePreviousValue' from JSON`); } /** @internal */ export const CreateProjectValueCurrentValue$inboundSchema = smartUnion([types.string(), types.number(), types.boolean()]); export function createProjectValueCurrentValueFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectValueCurrentValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectValueCurrentValue' from JSON`); } /** @internal */ export const Value3$inboundSchema = z .object({ previousValue: smartUnion([ types.string(), types.number(), types.boolean(), ]), currentValue: smartUnion([types.string(), types.number(), types.boolean()]), }); export function value3FromJSON(jsonString) { return safeParse(jsonString, (x) => Value3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Value3' from JSON`); } /** @internal */ export const CreateProjectValue$inboundSchema = smartUnion([ z.lazy(() => Value3$inboundSchema), types.string(), types.number(), types.boolean(), ]); export function createProjectValueFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectValue' from JSON`); } /** @internal */ export const CreateProjectDismissedToasts$inboundSchema = z.object({ key: types.string(), dismissedAt: types.number(), action: CreateProjectAction$inboundSchema, value: types.nullable(smartUnion([ z.lazy(() => Value3$inboundSchema), types.string(), types.number(), types.boolean(), ])), }); export function createProjectDismissedToastsFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectDismissedToasts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectDismissedToasts' from JSON`); } /** @internal */ export const CreateProjectProjectsEnv$inboundSchema = z.nativeEnum(CreateProjectProjectsEnv); /** @internal */ export const CreateProjectDestination$inboundSchema = z.nativeEnum(CreateProjectDestination); /** @internal */ export const CreateProjectSamplingRules$inboundSchema = z.object({ rate: types.number(), env: types.optional(CreateProjectProjectsEnv$inboundSchema), requestPath: types.optional(types.string()), destination: types.optional(CreateProjectDestination$inboundSchema), }); export function createProjectSamplingRulesFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectSamplingRules$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectSamplingRules' from JSON`); } /** @internal */ export const CreateProjectTracing$inboundSchema = z.object({ domains: types.optional(types.string()), ignorePaths: types.optional(z.array(types.string())), samplingRules: types.optional(z.array(z.lazy(() => CreateProjectSamplingRules$inboundSchema))), }); export function createProjectTracingFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectTracing$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectTracing' from JSON`); } /** @internal */ export const CreateProjectResponseBody$inboundSchema = z.object({ accountId: types.string(), creator: types.optional(CreateProjectCreator$inboundSchema), alias: z.array(Alias$inboundSchema), analytics: types.optional(Analytics$inboundSchema), appliedCve55182Migration: types.optional(types.boolean()), speedInsights: types.optional(SpeedInsights$inboundSchema), autoExposeSystemEnvs: types.optional(types.boolean()), autoAssignCustomDomains: types.optional(types.boolean()), autoAssignCustomDomainsUpdatedBy: types.optional(types.string()), buildCommand: z.nullable(types.string()).optional(), commandForIgnoringBuildStep: z.nullable(types.string()).optional(), connectConfigurations: z.nullable(z.array(CreateProjectConnectConfigurations$inboundSchema)).optional(), connectConfigurationId: z.nullable(types.string()).optional(), connectBuildsEnabled: types.optional(types.boolean()), passiveConnectConfigurationId: z.nullable(types.string()).optional(), createdAt: types.optional(types.number()), customerSupportCodeVisibility: types.optional(types.boolean()), crons: types.optional(CreateProjectCrons$inboundSchema), dataCache: types.optional(CreateProjectDataCache$inboundSchema), deploymentExpiration: DeploymentExpiration$inboundSchema, expiration: types.optional(CreateProjectExpiration$inboundSchema), devCommand: z.nullable(types.string()).optional(), directoryListing: types.boolean(), installCommand: z.nullable(types.string()).optional(), env: types.optional(z.array(CreateProjectEnv$inboundSchema)), customEnvironments: types.optional(z.array(CreateProjectCustomEnvironments$inboundSchema)), framework: z.nullable(CreateProjectProjectsFramework$inboundSchema) .optional(), services: types.optional(z.array(CreateProjectServices$inboundSchema)), gitForkProtection: types.optional(types.boolean()), gitLFS: types.optional(types.boolean()), id: types.string(), ipBuckets: types.optional(z.array(CreateProjectIpBuckets$inboundSchema)), jobs: types.optional(Jobs$inboundSchema), latestDeployments: types.optional(z.array(LatestDeployments$inboundSchema)), link: types.optional(Link$inboundSchema), blobs: types.optional(Blobs$inboundSchema), microfrontends: types.optional(CreateProjectMicrofrontends$inboundSchema), name: types.string(), nodeVersion: CreateProjectNodeVersion$inboundSchema, optionsAllowlist: z.nullable(CreateProjectOptionsAllowlist$inboundSchema) .optional(), outputDirectory: z.nullable(types.string()).optional(), passwordProtection: z.nullable(CreateProjectPasswordProtection$inboundSchema) .optional(), passport: z.nullable(CreateProjectPassport$inboundSchema).optional(), protectionConfig: types.optional(ProtectionConfig$inboundSchema), sandbox: types.optional(CreateProjectSandbox$inboundSchema), productionDeploymentsFastLane: types.optional(types.boolean()), resourceConfig: CreateProjectProjectsResourceConfig$inboundSchema, rollbackDescription: types.optional(CreateProjectRollbackDescription$inboundSchema), rollingRelease: z.nullable(RollingRelease$inboundSchema).optional(), defaultResourceConfig: DefaultResourceConfig$inboundSchema, rootDirectory: z.nullable(types.string()).optional(), serverlessFunctionZeroConfigFailover: types.optional(types.boolean()), skewProtectionBoundaryAt: types.optional(types.number()), skewProtectionMaxAge: types.optional(types.number()), skewProtectionAllowedDomains: types.optional(z.array(types.string())), skipGitConnectDuringLink: types.optional(types.boolean()), staticIps: types.optional(CreateProjectStaticIps$inboundSchema), sourceFilesOutsideRootDirectory: types.optional(types.boolean()), enableAffectedProjectsDeployments: types.optional(types.boolean()), enableExternalRewriteCaching: types.optional(types.boolean()), ssoProtection: z.nullable(CreateProjectProjectsSsoProtection$inboundSchema) .optional(), targets: types.optional(z.record(types.nullable(CreateProjectTargets$inboundSchema))), transferCompletedAt: types.optional(types.number()), transferStartedAt: types.optional(types.number()), transferToAccountId: types.optional(types.string()), transferredFromAccountId: types.optional(types.string()), updatedAt: types.optional(types.number()), live: types.optional(types.boolean()), enablePreviewFeedback: z.nullable(types.boolean()).optional(), enableProductionFeedback: z.nullable(types.boolean()).optional(), permissions: types.optional(CreateProjectPermissions$inboundSchema), lastRollbackTarget: z.nullable(LastRollbackTarget$inboundSchema).optional(), lastAliasRequest: z.nullable(LastAliasRequest$inboundSchema).optional(), protectionBypass: types.optional(z.record(ProtectionBypass$inboundSchema)), hasActiveBranches: types.optional(types.boolean()), trustedIps: z.nullable(CreateProjectTrustedIps$inboundSchema).optional(), trustedSources: z.nullable(CreateProjectTrustedSources$inboundSchema) .optional(), gitComments: types.optional(CreateProjectGitComments$inboundSchema), gitProviderOptions: types.optional(GitProviderOptions$inboundSchema), paused: types.optional(types.boolean()), concurrencyBucketName: types.optional(types.string()), webAnalytics: types.optional(CreateProjectWebAnalytics$inboundSchema), security: types.optional(CreateProjectSecurity$inboundSchema), oidcTokenConfig: types.optional(CreateProjectOidcTokenConfig$inboundSchema), deploymentPolicy: z.nullable(CreateProjectDeploymentPolicy$inboundSchema) .optional(), tier: types.optional(CreateProjectTier$inboundSchema), usageStatus: types.optional(UsageStatus$inboundSchema), features: types.optional(Features$inboundSchema), v0: types.optional(types.boolean()), v0Created: types.optional(types.boolean()), abuse: types.optional(z.lazy(() => CreateProjectAbuse$inboundSchema)), internalRoutes: types.optional(z.array(smartUnion([ z.lazy(() => InternalRoutes1$inboundSchema), z.lazy(() => InternalRoutes2$inboundSchema), ]))), hasDeployments: types.optional(types.boolean()), dismissedToasts: types.optional(z.array(z.lazy(() => CreateProjectDismissedToasts$inboundSchema))), protectedSourcemaps: types.optional(types.boolean()), tracing: types.optional(z.lazy(() => CreateProjectTracing$inboundSchema)), avatar: z.nullable(types.string()).optional(), }); export function createProjectResponseBodyFromJSON(jsonString) { return safeParse(jsonString, (x) => CreateProjectResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProjectResponseBody' from JSON`); } //# sourceMappingURL=createprojectresponsebody.js.map