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>

568 lines (540 loc) 22.6 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; import { UpdateProjectAbuse, UpdateProjectAbuse$inboundSchema, UpdateProjectDefaultResourceConfig, UpdateProjectDefaultResourceConfig$inboundSchema, UpdateProjectFeatures, UpdateProjectFeatures$inboundSchema, UpdateProjectFlatRateTier, UpdateProjectFlatRateTier$inboundSchema, UpdateProjectGitComments, UpdateProjectGitComments$inboundSchema, UpdateProjectGitProviderOptions, UpdateProjectGitProviderOptions$inboundSchema, UpdateProjectInternalRoutes, UpdateProjectInternalRoutes$inboundSchema, UpdateProjectLastAliasRequest, UpdateProjectLastAliasRequest$inboundSchema, UpdateProjectLastRollbackTarget, UpdateProjectLastRollbackTarget$inboundSchema, UpdateProjectPermissions, UpdateProjectPermissions$inboundSchema, UpdateProjectProjectsAction, UpdateProjectProjectsAction$inboundSchema, UpdateProjectProjectsDeploymentPolicy, UpdateProjectProjectsDeploymentPolicy$inboundSchema, UpdateProjectProjectsOidcTokenConfig, UpdateProjectProjectsOidcTokenConfig$inboundSchema, UpdateProjectProjectsPassport, UpdateProjectProjectsPassport$inboundSchema, UpdateProjectProjectsPasswordProtection, UpdateProjectProjectsPasswordProtection$inboundSchema, UpdateProjectProjectsResourceConfig, UpdateProjectProjectsResourceConfig$inboundSchema, UpdateProjectProjectsSsoProtection, UpdateProjectProjectsSsoProtection$inboundSchema, UpdateProjectProjectsStaticIps, UpdateProjectProjectsStaticIps$inboundSchema, UpdateProjectProjectsTrustedIps, UpdateProjectProjectsTrustedIps$inboundSchema, UpdateProjectProtectionBypass, UpdateProjectProtectionBypass$inboundSchema, UpdateProjectProtectionConfig, UpdateProjectProtectionConfig$inboundSchema, UpdateProjectRollbackDescription, UpdateProjectRollbackDescription$inboundSchema, UpdateProjectRollingRelease, UpdateProjectRollingRelease$inboundSchema, UpdateProjectSecurity, UpdateProjectSecurity$inboundSchema, UpdateProjectTargets, UpdateProjectTargets$inboundSchema, UpdateProjectTrustedSources, UpdateProjectTrustedSources$inboundSchema, UpdateProjectUsageStatus, UpdateProjectUsageStatus$inboundSchema, UpdateProjectWebAnalytics, UpdateProjectWebAnalytics$inboundSchema, } from "./updateprojectprojectsaction.js"; import { UpdateProjectAnalytics, UpdateProjectAnalytics$inboundSchema, UpdateProjectConnectConfigurations, UpdateProjectConnectConfigurations$inboundSchema, UpdateProjectCrons, UpdateProjectCrons$inboundSchema, UpdateProjectCustomEnvironments, UpdateProjectCustomEnvironments$inboundSchema, UpdateProjectDataCache, UpdateProjectDataCache$inboundSchema, UpdateProjectDeploymentExpiration, UpdateProjectDeploymentExpiration$inboundSchema, UpdateProjectExpiration, UpdateProjectExpiration$inboundSchema, UpdateProjectIpBuckets, UpdateProjectIpBuckets$inboundSchema, UpdateProjectJobs, UpdateProjectJobs$inboundSchema, UpdateProjectLatestDeployments, UpdateProjectLatestDeployments$inboundSchema, UpdateProjectLink, UpdateProjectLink$inboundSchema, UpdateProjectMicrofrontends, UpdateProjectMicrofrontends$inboundSchema, UpdateProjectProjectsEnv, UpdateProjectProjectsEnv$inboundSchema, UpdateProjectProjectsFramework, UpdateProjectProjectsFramework$inboundSchema, UpdateProjectProjectsNodeVersion, UpdateProjectProjectsNodeVersion$inboundSchema, UpdateProjectProjectsOptionsAllowlist, UpdateProjectProjectsOptionsAllowlist$inboundSchema, UpdateProjectServices, UpdateProjectServices$inboundSchema, UpdateProjectSpeedInsights, UpdateProjectSpeedInsights$inboundSchema, } from "./updateprojectprojectsoptionsallowlist.js"; export type UpdateProjectValuePreviousValue = string | number | boolean; export type UpdateProjectValueCurrentValue = string | number | boolean; export type UpdateProjectValue3 = { previousValue: string | number | boolean; currentValue: string | number | boolean; }; export type UpdateProjectValue = | UpdateProjectValue3 | string | number | boolean; export type UpdateProjectProjectsDismissedToasts = { key: string; dismissedAt: number; action: UpdateProjectProjectsAction; value: UpdateProjectValue3 | string | number | boolean | null; }; export const UpdateProjectProjectsResponseEnv = { Preview: "preview", Production: "production", } as const; export type UpdateProjectProjectsResponseEnv = ClosedEnum< typeof UpdateProjectProjectsResponseEnv >; export type UpdateProjectSamplingRules = { rate: number; env?: UpdateProjectProjectsResponseEnv | undefined; requestPath?: string | undefined; }; export type UpdateProjectTracing = { domains?: string | undefined; ignorePaths?: Array<string> | undefined; samplingRules?: Array<UpdateProjectSamplingRules> | undefined; }; /** * The project was successfully updated */ export type UpdateProjectResponseBody = { accountId: string; analytics?: UpdateProjectAnalytics | undefined; appliedCve55182Migration?: boolean | undefined; speedInsights?: UpdateProjectSpeedInsights | undefined; autoExposeSystemEnvs?: boolean | undefined; autoAssignCustomDomains?: boolean | undefined; autoAssignCustomDomainsUpdatedBy?: string | undefined; buildCommand?: string | null | undefined; commandForIgnoringBuildStep?: string | null | undefined; connectConfigurations?: | Array<UpdateProjectConnectConfigurations> | null | undefined; connectConfigurationId?: string | null | undefined; connectBuildsEnabled?: boolean | undefined; passiveConnectConfigurationId?: string | null | undefined; createdAt?: number | undefined; customerSupportCodeVisibility?: boolean | undefined; crons?: UpdateProjectCrons | undefined; dataCache?: UpdateProjectDataCache | undefined; /** * Retention policies for deployments. These are enforced at the project level, but we also maintain an instance of this at the team level as a default policy that gets applied to new projects. */ deploymentExpiration: UpdateProjectDeploymentExpiration; expiration?: UpdateProjectExpiration | undefined; devCommand?: string | null | undefined; directoryListing: boolean; installCommand?: string | null | undefined; env?: Array<UpdateProjectProjectsEnv> | undefined; customEnvironments?: Array<UpdateProjectCustomEnvironments> | undefined; framework?: UpdateProjectProjectsFramework | null | undefined; services?: Array<UpdateProjectServices> | undefined; gitForkProtection?: boolean | undefined; gitLFS?: boolean | undefined; id: string; ipBuckets?: Array<UpdateProjectIpBuckets> | undefined; jobs?: UpdateProjectJobs | undefined; latestDeployments?: Array<UpdateProjectLatestDeployments> | undefined; link?: UpdateProjectLink | undefined; microfrontends?: UpdateProjectMicrofrontends | undefined; name: string; nodeVersion: UpdateProjectProjectsNodeVersion; optionsAllowlist?: UpdateProjectProjectsOptionsAllowlist | null | undefined; outputDirectory?: string | null | undefined; passwordProtection?: | UpdateProjectProjectsPasswordProtection | null | undefined; passport?: UpdateProjectProjectsPassport | null | undefined; protectionConfig?: UpdateProjectProtectionConfig | undefined; productionDeploymentsFastLane?: boolean | undefined; resourceConfig: UpdateProjectProjectsResourceConfig; /** * Description of why a project was rolled back, and by whom. Note that lastAliasRequest contains the from/to details of the rollback. */ rollbackDescription?: UpdateProjectRollbackDescription | undefined; /** * Project-level rolling release configuration that defines how deployments should be gradually rolled out */ rollingRelease?: UpdateProjectRollingRelease | null | undefined; defaultResourceConfig: UpdateProjectDefaultResourceConfig; rootDirectory?: string | null | undefined; serverlessFunctionZeroConfigFailover?: boolean | undefined; skewProtectionBoundaryAt?: number | undefined; skewProtectionMaxAge?: number | undefined; skewProtectionAllowedDomains?: Array<string> | undefined; skipGitConnectDuringLink?: boolean | undefined; staticIps?: UpdateProjectProjectsStaticIps | undefined; sourceFilesOutsideRootDirectory?: boolean | undefined; enableAffectedProjectsDeployments?: boolean | undefined; enableExternalRewriteCaching?: boolean | undefined; ssoProtection?: UpdateProjectProjectsSsoProtection | null | undefined; targets?: { [k: string]: UpdateProjectTargets | null } | undefined; transferCompletedAt?: number | undefined; transferStartedAt?: number | undefined; transferToAccountId?: string | undefined; transferredFromAccountId?: string | undefined; updatedAt?: number | undefined; live?: boolean | undefined; enablePreviewFeedback?: boolean | null | undefined; enableProductionFeedback?: boolean | null | undefined; permissions?: UpdateProjectPermissions | undefined; lastRollbackTarget?: UpdateProjectLastRollbackTarget | null | undefined; lastAliasRequest?: UpdateProjectLastAliasRequest | null | undefined; protectionBypass?: { [k: string]: UpdateProjectProtectionBypass } | undefined; hasActiveBranches?: boolean | undefined; trustedIps?: UpdateProjectProjectsTrustedIps | null | undefined; trustedSources?: UpdateProjectTrustedSources | null | undefined; gitComments?: UpdateProjectGitComments | undefined; gitProviderOptions?: UpdateProjectGitProviderOptions | undefined; paused?: boolean | undefined; concurrencyBucketName?: string | undefined; webAnalytics?: UpdateProjectWebAnalytics | undefined; security?: UpdateProjectSecurity | undefined; oidcTokenConfig?: UpdateProjectProjectsOidcTokenConfig | undefined; /** * Project shape. `null` on a rule list clears the project's override for that rule type (fall back to team for every env); omitting is equivalent. Setting `deploymentPolicy` itself to `null` clears every override at once. Kept structurally distinct from {@link TeamDeploymentPolicy} so the two storage locations don't share a type by accident. */ deploymentPolicy?: UpdateProjectProjectsDeploymentPolicy | null | undefined; tier?: string | undefined; flatRateTier?: UpdateProjectFlatRateTier | undefined; usageStatus?: UpdateProjectUsageStatus | undefined; features?: UpdateProjectFeatures | undefined; v0?: boolean | undefined; v0Created?: boolean | undefined; abuse?: UpdateProjectAbuse | undefined; internalRoutes?: Array<UpdateProjectInternalRoutes> | undefined; hasDeployments?: boolean | undefined; dismissedToasts?: Array<UpdateProjectProjectsDismissedToasts> | undefined; protectedSourcemaps?: boolean | undefined; tracing?: UpdateProjectTracing | undefined; avatar?: string | null | undefined; }; /** @internal */ export const UpdateProjectValuePreviousValue$inboundSchema: z.ZodType< UpdateProjectValuePreviousValue, z.ZodTypeDef, unknown > = smartUnion([types.string(), types.number(), types.boolean()]); export function updateProjectValuePreviousValueFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectValuePreviousValue, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectValuePreviousValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectValuePreviousValue' from JSON`, ); } /** @internal */ export const UpdateProjectValueCurrentValue$inboundSchema: z.ZodType< UpdateProjectValueCurrentValue, z.ZodTypeDef, unknown > = smartUnion([types.string(), types.number(), types.boolean()]); export function updateProjectValueCurrentValueFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectValueCurrentValue, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectValueCurrentValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectValueCurrentValue' from JSON`, ); } /** @internal */ export const UpdateProjectValue3$inboundSchema: z.ZodType< UpdateProjectValue3, z.ZodTypeDef, unknown > = z.object({ previousValue: smartUnion([types.string(), types.number(), types.boolean()]), currentValue: smartUnion([types.string(), types.number(), types.boolean()]), }); export function updateProjectValue3FromJSON( jsonString: string, ): SafeParseResult<UpdateProjectValue3, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectValue3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectValue3' from JSON`, ); } /** @internal */ export const UpdateProjectValue$inboundSchema: z.ZodType< UpdateProjectValue, z.ZodTypeDef, unknown > = smartUnion([ z.lazy(() => UpdateProjectValue3$inboundSchema), types.string(), types.number(), types.boolean(), ]); export function updateProjectValueFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectValue, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectValue' from JSON`, ); } /** @internal */ export const UpdateProjectProjectsDismissedToasts$inboundSchema: z.ZodType< UpdateProjectProjectsDismissedToasts, z.ZodTypeDef, unknown > = z.object({ key: types.string(), dismissedAt: types.number(), action: UpdateProjectProjectsAction$inboundSchema, value: types.nullable( smartUnion([ z.lazy(() => UpdateProjectValue3$inboundSchema), types.string(), types.number(), types.boolean(), ]), ), }); export function updateProjectProjectsDismissedToastsFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectProjectsDismissedToasts, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectProjectsDismissedToasts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectProjectsDismissedToasts' from JSON`, ); } /** @internal */ export const UpdateProjectProjectsResponseEnv$inboundSchema: z.ZodNativeEnum< typeof UpdateProjectProjectsResponseEnv > = z.nativeEnum(UpdateProjectProjectsResponseEnv); /** @internal */ export const UpdateProjectSamplingRules$inboundSchema: z.ZodType< UpdateProjectSamplingRules, z.ZodTypeDef, unknown > = z.object({ rate: types.number(), env: types.optional(UpdateProjectProjectsResponseEnv$inboundSchema), requestPath: types.optional(types.string()), }); export function updateProjectSamplingRulesFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectSamplingRules, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectSamplingRules$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectSamplingRules' from JSON`, ); } /** @internal */ export const UpdateProjectTracing$inboundSchema: z.ZodType< UpdateProjectTracing, z.ZodTypeDef, unknown > = z.object({ domains: types.optional(types.string()), ignorePaths: types.optional(z.array(types.string())), samplingRules: types.optional( z.array(z.lazy(() => UpdateProjectSamplingRules$inboundSchema)), ), }); export function updateProjectTracingFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectTracing, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectTracing$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectTracing' from JSON`, ); } /** @internal */ export const UpdateProjectResponseBody$inboundSchema: z.ZodType< UpdateProjectResponseBody, z.ZodTypeDef, unknown > = z.object({ accountId: types.string(), analytics: types.optional(UpdateProjectAnalytics$inboundSchema), appliedCve55182Migration: types.optional(types.boolean()), speedInsights: types.optional(UpdateProjectSpeedInsights$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(UpdateProjectConnectConfigurations$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(UpdateProjectCrons$inboundSchema), dataCache: types.optional(UpdateProjectDataCache$inboundSchema), deploymentExpiration: UpdateProjectDeploymentExpiration$inboundSchema, expiration: types.optional(UpdateProjectExpiration$inboundSchema), devCommand: z.nullable(types.string()).optional(), directoryListing: types.boolean(), installCommand: z.nullable(types.string()).optional(), env: types.optional(z.array(UpdateProjectProjectsEnv$inboundSchema)), customEnvironments: types.optional( z.array(UpdateProjectCustomEnvironments$inboundSchema), ), framework: z.nullable(UpdateProjectProjectsFramework$inboundSchema) .optional(), services: types.optional(z.array(UpdateProjectServices$inboundSchema)), gitForkProtection: types.optional(types.boolean()), gitLFS: types.optional(types.boolean()), id: types.string(), ipBuckets: types.optional(z.array(UpdateProjectIpBuckets$inboundSchema)), jobs: types.optional(UpdateProjectJobs$inboundSchema), latestDeployments: types.optional( z.array(UpdateProjectLatestDeployments$inboundSchema), ), link: types.optional(UpdateProjectLink$inboundSchema), microfrontends: types.optional(UpdateProjectMicrofrontends$inboundSchema), name: types.string(), nodeVersion: UpdateProjectProjectsNodeVersion$inboundSchema, optionsAllowlist: z.nullable( UpdateProjectProjectsOptionsAllowlist$inboundSchema, ).optional(), outputDirectory: z.nullable(types.string()).optional(), passwordProtection: z.nullable( UpdateProjectProjectsPasswordProtection$inboundSchema, ).optional(), passport: z.nullable(UpdateProjectProjectsPassport$inboundSchema).optional(), protectionConfig: types.optional(UpdateProjectProtectionConfig$inboundSchema), productionDeploymentsFastLane: types.optional(types.boolean()), resourceConfig: UpdateProjectProjectsResourceConfig$inboundSchema, rollbackDescription: types.optional( UpdateProjectRollbackDescription$inboundSchema, ), rollingRelease: z.nullable(UpdateProjectRollingRelease$inboundSchema) .optional(), defaultResourceConfig: UpdateProjectDefaultResourceConfig$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(UpdateProjectProjectsStaticIps$inboundSchema), sourceFilesOutsideRootDirectory: types.optional(types.boolean()), enableAffectedProjectsDeployments: types.optional(types.boolean()), enableExternalRewriteCaching: types.optional(types.boolean()), ssoProtection: z.nullable(UpdateProjectProjectsSsoProtection$inboundSchema) .optional(), targets: types.optional( z.record(types.nullable(UpdateProjectTargets$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(UpdateProjectPermissions$inboundSchema), lastRollbackTarget: z.nullable(UpdateProjectLastRollbackTarget$inboundSchema) .optional(), lastAliasRequest: z.nullable(UpdateProjectLastAliasRequest$inboundSchema) .optional(), protectionBypass: types.optional( z.record(UpdateProjectProtectionBypass$inboundSchema), ), hasActiveBranches: types.optional(types.boolean()), trustedIps: z.nullable(UpdateProjectProjectsTrustedIps$inboundSchema) .optional(), trustedSources: z.nullable(UpdateProjectTrustedSources$inboundSchema) .optional(), gitComments: types.optional(UpdateProjectGitComments$inboundSchema), gitProviderOptions: types.optional( UpdateProjectGitProviderOptions$inboundSchema, ), paused: types.optional(types.boolean()), concurrencyBucketName: types.optional(types.string()), webAnalytics: types.optional(UpdateProjectWebAnalytics$inboundSchema), security: types.optional(UpdateProjectSecurity$inboundSchema), oidcTokenConfig: types.optional( UpdateProjectProjectsOidcTokenConfig$inboundSchema, ), deploymentPolicy: z.nullable( UpdateProjectProjectsDeploymentPolicy$inboundSchema, ).optional(), tier: types.optional(types.string()), flatRateTier: types.optional(UpdateProjectFlatRateTier$inboundSchema), usageStatus: types.optional(UpdateProjectUsageStatus$inboundSchema), features: types.optional(UpdateProjectFeatures$inboundSchema), v0: types.optional(types.boolean()), v0Created: types.optional(types.boolean()), abuse: types.optional(UpdateProjectAbuse$inboundSchema), internalRoutes: types.optional( z.array(UpdateProjectInternalRoutes$inboundSchema), ), hasDeployments: types.optional(types.boolean()), dismissedToasts: types.optional( z.array(z.lazy(() => UpdateProjectProjectsDismissedToasts$inboundSchema)), ), protectedSourcemaps: types.optional(types.boolean()), tracing: types.optional(z.lazy(() => UpdateProjectTracing$inboundSchema)), avatar: z.nullable(types.string()).optional(), }); export function updateProjectResponseBodyFromJSON( jsonString: string, ): SafeParseResult<UpdateProjectResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => UpdateProjectResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateProjectResponseBody' from JSON`, ); }