@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>
360 lines (338 loc) • 13.3 kB
text/typescript
/*
* 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 {
Alias,
Alias$inboundSchema,
GetProjectsResponseBody2,
GetProjectsResponseBody2$inboundSchema,
ResponseBodyAnalytics,
ResponseBodyAnalytics$inboundSchema,
ResponseBodyDeploymentExpiration,
ResponseBodyDeploymentExpiration$inboundSchema,
ResponseBodyIpBuckets,
ResponseBodyIpBuckets$inboundSchema,
} from "./getprojectscontenthint10.js";
import {
GetProjectsInternalRoutesHas,
GetProjectsInternalRoutesHas$inboundSchema,
GetProjectsResponseBodyNodeVersion,
GetProjectsResponseBodyNodeVersion$inboundSchema,
ResponseBodyAbuse,
ResponseBodyAbuse$inboundSchema,
ResponseBodyEnv,
ResponseBodyEnv$inboundSchema,
ResponseBodyFramework,
ResponseBodyFramework$inboundSchema,
ResponseBodyGitComments,
ResponseBodyGitComments$inboundSchema,
ResponseBodyGitProviderOptions,
ResponseBodyGitProviderOptions$inboundSchema,
ResponseBodyLatestDeployments,
ResponseBodyLatestDeployments$inboundSchema,
ResponseBodyLink,
ResponseBodyLink$inboundSchema,
ResponseBodyOidcTokenConfig,
ResponseBodyOidcTokenConfig$inboundSchema,
ResponseBodyPassport,
ResponseBodyPassport$inboundSchema,
ResponseBodyPasswordProtection,
ResponseBodyPasswordProtection$inboundSchema,
ResponseBodyResourceConfig,
ResponseBodyResourceConfig$inboundSchema,
ResponseBodyRollingRelease,
ResponseBodyRollingRelease$inboundSchema,
ResponseBodySecurity,
ResponseBodySecurity$inboundSchema,
ResponseBodySpeedInsights,
ResponseBodySpeedInsights$inboundSchema,
ResponseBodySsoProtection,
ResponseBodySsoProtection$inboundSchema,
ResponseBodyTargets,
ResponseBodyTargets$inboundSchema,
ResponseBodyTrustedSources,
ResponseBodyTrustedSources$inboundSchema,
ResponseBodyWebAnalytics,
ResponseBodyWebAnalytics$inboundSchema,
} from "./getprojectsinternalrouteshas.js";
import {
GetProjectsResponseBody3,
GetProjectsResponseBody3$inboundSchema,
} from "./getprojectsresponsebodyprojectsnodeversion.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export const GetProjectsInternalRoutesAction = {
BlockLegalCwc: "block_legal_cwc",
} as const;
export type GetProjectsInternalRoutesAction = ClosedEnum<
typeof GetProjectsInternalRoutesAction
>;
export type GetProjectsInternalRoutesMitigate = {
action: GetProjectsInternalRoutesAction;
};
export type GetProjectsInternalRoutes2 = {
has: Array<GetProjectsInternalRoutesHas>;
mitigate: GetProjectsInternalRoutesMitigate;
src?: string | undefined;
};
export type GetProjectsInternalRoutes1 = {
src: string;
status: number;
};
export type ResponseBodyInternalRoutes =
| GetProjectsInternalRoutes1
| GetProjectsInternalRoutes2;
export type GetProjectsResponseBody1 = {
accountId: string;
alias: Array<Alias>;
analytics?: ResponseBodyAnalytics | undefined;
appliedCve55182Migration?: boolean | undefined;
autoExposeSystemEnvs?: boolean | undefined;
autoAssignCustomDomains?: boolean | undefined;
autoAssignCustomDomainsUpdatedBy?: string | undefined;
buildCommand?: string | null | undefined;
commandForIgnoringBuildStep?: string | null | undefined;
customerSupportCodeVisibility?: boolean | undefined;
createdAt?: number | undefined;
devCommand?: string | null | undefined;
directoryListing: boolean;
/**
* 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: ResponseBodyDeploymentExpiration;
installCommand?: string | null | undefined;
ipBuckets?: Array<ResponseBodyIpBuckets> | undefined;
env?: Array<ResponseBodyEnv> | undefined;
framework?: ResponseBodyFramework | null | undefined;
gitForkProtection?: boolean | undefined;
id: string;
latestDeployments?: Array<ResponseBodyLatestDeployments> | undefined;
link?: ResponseBodyLink | undefined;
name: string;
nodeVersion: GetProjectsResponseBodyNodeVersion;
outputDirectory?: string | null | undefined;
passwordProtection?: ResponseBodyPasswordProtection | null | undefined;
passport?: ResponseBodyPassport | null | undefined;
resourceConfig: ResponseBodyResourceConfig;
/**
* Project-level rolling release configuration that defines how deployments should be gradually rolled out
*/
rollingRelease?: ResponseBodyRollingRelease | null | undefined;
rootDirectory?: string | null | undefined;
serverlessFunctionRegion: string;
serverlessFunctionZeroConfigFailover?: boolean | undefined;
speedInsights?: ResponseBodySpeedInsights | undefined;
skipGitConnectDuringLink?: boolean | undefined;
sourceFilesOutsideRootDirectory?: boolean | undefined;
ssoProtection?: ResponseBodySsoProtection | null | undefined;
targets?: { [k: string]: ResponseBodyTargets | null } | undefined;
transferCompletedAt?: number | undefined;
transferStartedAt?: number | undefined;
transferToAccountId?: string | undefined;
transferredFromAccountId?: string | undefined;
trustedSources?: ResponseBodyTrustedSources | null | undefined;
updatedAt?: number | undefined;
live?: boolean | undefined;
hasActiveBranches?: boolean | undefined;
gitComments?: ResponseBodyGitComments | undefined;
gitProviderOptions?: ResponseBodyGitProviderOptions | undefined;
paused?: boolean | undefined;
webAnalytics?: ResponseBodyWebAnalytics | undefined;
security?: ResponseBodySecurity | undefined;
oidcTokenConfig?: ResponseBodyOidcTokenConfig | undefined;
tier?: string | undefined;
abuse?: ResponseBodyAbuse | undefined;
internalRoutes?:
| Array<GetProjectsInternalRoutes1 | GetProjectsInternalRoutes2>
| undefined;
};
export type GetProjectsResponseBody =
| GetProjectsResponseBody2
| GetProjectsResponseBody3
| Array<GetProjectsResponseBody1>;
/** @internal */
export const GetProjectsInternalRoutesAction$inboundSchema: z.ZodNativeEnum<
typeof GetProjectsInternalRoutesAction
> = z.nativeEnum(GetProjectsInternalRoutesAction);
/** @internal */
export const GetProjectsInternalRoutesMitigate$inboundSchema: z.ZodType<
GetProjectsInternalRoutesMitigate,
z.ZodTypeDef,
unknown
> = z.object({
action: GetProjectsInternalRoutesAction$inboundSchema,
});
export function getProjectsInternalRoutesMitigateFromJSON(
jsonString: string,
): SafeParseResult<GetProjectsInternalRoutesMitigate, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetProjectsInternalRoutesMitigate$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetProjectsInternalRoutesMitigate' from JSON`,
);
}
/** @internal */
export const GetProjectsInternalRoutes2$inboundSchema: z.ZodType<
GetProjectsInternalRoutes2,
z.ZodTypeDef,
unknown
> = z.object({
has: z.array(GetProjectsInternalRoutesHas$inboundSchema),
mitigate: z.lazy(() => GetProjectsInternalRoutesMitigate$inboundSchema),
src: types.optional(types.string()),
});
export function getProjectsInternalRoutes2FromJSON(
jsonString: string,
): SafeParseResult<GetProjectsInternalRoutes2, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetProjectsInternalRoutes2$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetProjectsInternalRoutes2' from JSON`,
);
}
/** @internal */
export const GetProjectsInternalRoutes1$inboundSchema: z.ZodType<
GetProjectsInternalRoutes1,
z.ZodTypeDef,
unknown
> = z.object({
src: types.string(),
status: types.number(),
});
export function getProjectsInternalRoutes1FromJSON(
jsonString: string,
): SafeParseResult<GetProjectsInternalRoutes1, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetProjectsInternalRoutes1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetProjectsInternalRoutes1' from JSON`,
);
}
/** @internal */
export const ResponseBodyInternalRoutes$inboundSchema: z.ZodType<
ResponseBodyInternalRoutes,
z.ZodTypeDef,
unknown
> = smartUnion([
z.lazy(() => GetProjectsInternalRoutes1$inboundSchema),
z.lazy(() => GetProjectsInternalRoutes2$inboundSchema),
]);
export function responseBodyInternalRoutesFromJSON(
jsonString: string,
): SafeParseResult<ResponseBodyInternalRoutes, SDKValidationError> {
return safeParse(
jsonString,
(x) => ResponseBodyInternalRoutes$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ResponseBodyInternalRoutes' from JSON`,
);
}
/** @internal */
export const GetProjectsResponseBody1$inboundSchema: z.ZodType<
GetProjectsResponseBody1,
z.ZodTypeDef,
unknown
> = z.object({
accountId: types.string(),
alias: z.array(Alias$inboundSchema),
analytics: types.optional(ResponseBodyAnalytics$inboundSchema),
appliedCve55182Migration: types.optional(types.boolean()),
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(),
customerSupportCodeVisibility: types.optional(types.boolean()),
createdAt: types.optional(types.number()),
devCommand: z.nullable(types.string()).optional(),
directoryListing: types.boolean(),
deploymentExpiration: ResponseBodyDeploymentExpiration$inboundSchema,
installCommand: z.nullable(types.string()).optional(),
ipBuckets: types.optional(z.array(ResponseBodyIpBuckets$inboundSchema)),
env: types.optional(z.array(ResponseBodyEnv$inboundSchema)),
framework: z.nullable(ResponseBodyFramework$inboundSchema).optional(),
gitForkProtection: types.optional(types.boolean()),
id: types.string(),
latestDeployments: types.optional(
z.array(ResponseBodyLatestDeployments$inboundSchema),
),
link: types.optional(ResponseBodyLink$inboundSchema),
name: types.string(),
nodeVersion: GetProjectsResponseBodyNodeVersion$inboundSchema,
outputDirectory: z.nullable(types.string()).optional(),
passwordProtection: z.nullable(ResponseBodyPasswordProtection$inboundSchema)
.optional(),
passport: z.nullable(ResponseBodyPassport$inboundSchema).optional(),
resourceConfig: ResponseBodyResourceConfig$inboundSchema,
rollingRelease: z.nullable(ResponseBodyRollingRelease$inboundSchema)
.optional(),
rootDirectory: z.nullable(types.string()).optional(),
serverlessFunctionRegion: types.string(),
serverlessFunctionZeroConfigFailover: types.optional(types.boolean()),
speedInsights: types.optional(ResponseBodySpeedInsights$inboundSchema),
skipGitConnectDuringLink: types.optional(types.boolean()),
sourceFilesOutsideRootDirectory: types.optional(types.boolean()),
ssoProtection: z.nullable(ResponseBodySsoProtection$inboundSchema).optional(),
targets: types.optional(
z.record(types.nullable(ResponseBodyTargets$inboundSchema)),
),
transferCompletedAt: types.optional(types.number()),
transferStartedAt: types.optional(types.number()),
transferToAccountId: types.optional(types.string()),
transferredFromAccountId: types.optional(types.string()),
trustedSources: z.nullable(ResponseBodyTrustedSources$inboundSchema)
.optional(),
updatedAt: types.optional(types.number()),
live: types.optional(types.boolean()),
hasActiveBranches: types.optional(types.boolean()),
gitComments: types.optional(ResponseBodyGitComments$inboundSchema),
gitProviderOptions: types.optional(
ResponseBodyGitProviderOptions$inboundSchema,
),
paused: types.optional(types.boolean()),
webAnalytics: types.optional(ResponseBodyWebAnalytics$inboundSchema),
security: types.optional(ResponseBodySecurity$inboundSchema),
oidcTokenConfig: types.optional(ResponseBodyOidcTokenConfig$inboundSchema),
tier: types.optional(types.string()),
abuse: types.optional(ResponseBodyAbuse$inboundSchema),
internalRoutes: types.optional(
z.array(smartUnion([
z.lazy(() => GetProjectsInternalRoutes1$inboundSchema),
z.lazy(() =>
GetProjectsInternalRoutes2$inboundSchema
),
])),
),
});
export function getProjectsResponseBody1FromJSON(
jsonString: string,
): SafeParseResult<GetProjectsResponseBody1, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetProjectsResponseBody1$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetProjectsResponseBody1' from JSON`,
);
}
/** @internal */
export const GetProjectsResponseBody$inboundSchema: z.ZodType<
GetProjectsResponseBody,
z.ZodTypeDef,
unknown
> = smartUnion([
GetProjectsResponseBody2$inboundSchema,
GetProjectsResponseBody3$inboundSchema,
z.array(z.lazy(() => GetProjectsResponseBody1$inboundSchema)),
]);
export function getProjectsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetProjectsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetProjectsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetProjectsResponseBody' from JSON`,
);
}