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>

420 lines (388 loc) 12.6 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 { SDKValidationError } from "./sdkvalidationerror.js"; /** * Type of matcher. One of "equals", "startsWith", or "endsWith". */ export const UpdateCustomEnvironmentType = { Equals: "equals", StartsWith: "startsWith", EndsWith: "endsWith", } as const; /** * Type of matcher. One of "equals", "startsWith", or "endsWith". */ export type UpdateCustomEnvironmentType = ClosedEnum< typeof UpdateCustomEnvironmentType >; /** * How we want to determine a matching branch. This is optional. */ export type UpdateCustomEnvironmentBranchMatcher = { /** * Type of matcher. One of "equals", "startsWith", or "endsWith". */ type: UpdateCustomEnvironmentType; /** * Git branch name or portion thereof. */ pattern: string; }; export type UpdateCustomEnvironmentRequestBody = { /** * The slug of the custom environment. */ slug?: string | undefined; /** * Description of the custom environment. This is optional. */ description?: string | undefined; /** * How we want to determine a matching branch. This is optional. */ branchMatcher?: UpdateCustomEnvironmentBranchMatcher | null | undefined; }; export type UpdateCustomEnvironmentRequest = { /** * The unique project identifier or the project name */ idOrName: string; /** * The unique custom environment identifier within the project */ environmentSlugOrId: 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; requestBody?: UpdateCustomEnvironmentRequestBody | undefined; }; /** * The type of environment (production, preview, or development) */ export const UpdateCustomEnvironmentEnvironmentType = { Development: "development", Preview: "preview", Production: "production", } as const; /** * The type of environment (production, preview, or development) */ export type UpdateCustomEnvironmentEnvironmentType = ClosedEnum< typeof UpdateCustomEnvironmentEnvironmentType >; /** * The type of matching to perform */ export const UpdateCustomEnvironmentEnvironmentResponseType = { EndsWith: "endsWith", Equals: "equals", StartsWith: "startsWith", } as const; /** * The type of matching to perform */ export type UpdateCustomEnvironmentEnvironmentResponseType = ClosedEnum< typeof UpdateCustomEnvironmentEnvironmentResponseType >; /** * Configuration for matching git branches to this environment */ export type UpdateCustomEnvironmentEnvironmentBranchMatcher = { /** * The type of matching to perform */ type: UpdateCustomEnvironmentEnvironmentResponseType; /** * 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 UpdateCustomEnvironmentVerification = { type: string; domain: string; value: string; reason: string; }; /** * List of domains associated with this environment */ export type UpdateCustomEnvironmentDomains = { 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<UpdateCustomEnvironmentVerification> | undefined; }; /** * Internal representation of a custom environment with all required properties */ export type UpdateCustomEnvironmentResponseBody = { /** * 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: UpdateCustomEnvironmentEnvironmentType; /** * Optional description of the environment's purpose */ description?: string | undefined; /** * Configuration for matching git branches to this environment */ branchMatcher?: UpdateCustomEnvironmentEnvironmentBranchMatcher | undefined; /** * List of domains associated with this environment */ domains?: Array<UpdateCustomEnvironmentDomains> | 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; }; /** @internal */ export const UpdateCustomEnvironmentType$outboundSchema: z.ZodNativeEnum< typeof UpdateCustomEnvironmentType > = z.nativeEnum(UpdateCustomEnvironmentType); /** @internal */ export type UpdateCustomEnvironmentBranchMatcher$Outbound = { type: string; pattern: string; }; /** @internal */ export const UpdateCustomEnvironmentBranchMatcher$outboundSchema: z.ZodType< UpdateCustomEnvironmentBranchMatcher$Outbound, z.ZodTypeDef, UpdateCustomEnvironmentBranchMatcher > = z.object({ type: UpdateCustomEnvironmentType$outboundSchema, pattern: z.string(), }); export function updateCustomEnvironmentBranchMatcherToJSON( updateCustomEnvironmentBranchMatcher: UpdateCustomEnvironmentBranchMatcher, ): string { return JSON.stringify( UpdateCustomEnvironmentBranchMatcher$outboundSchema.parse( updateCustomEnvironmentBranchMatcher, ), ); } /** @internal */ export type UpdateCustomEnvironmentRequestBody$Outbound = { slug?: string | undefined; description?: string | undefined; branchMatcher?: | UpdateCustomEnvironmentBranchMatcher$Outbound | null | undefined; }; /** @internal */ export const UpdateCustomEnvironmentRequestBody$outboundSchema: z.ZodType< UpdateCustomEnvironmentRequestBody$Outbound, z.ZodTypeDef, UpdateCustomEnvironmentRequestBody > = z.object({ slug: z.string().optional(), description: z.string().optional(), branchMatcher: z.nullable( z.lazy(() => UpdateCustomEnvironmentBranchMatcher$outboundSchema), ).optional(), }); export function updateCustomEnvironmentRequestBodyToJSON( updateCustomEnvironmentRequestBody: UpdateCustomEnvironmentRequestBody, ): string { return JSON.stringify( UpdateCustomEnvironmentRequestBody$outboundSchema.parse( updateCustomEnvironmentRequestBody, ), ); } /** @internal */ export type UpdateCustomEnvironmentRequest$Outbound = { idOrName: string; environmentSlugOrId: string; teamId?: string | undefined; slug?: string | undefined; RequestBody?: UpdateCustomEnvironmentRequestBody$Outbound | undefined; }; /** @internal */ export const UpdateCustomEnvironmentRequest$outboundSchema: z.ZodType< UpdateCustomEnvironmentRequest$Outbound, z.ZodTypeDef, UpdateCustomEnvironmentRequest > = z.object({ idOrName: z.string(), environmentSlugOrId: z.string(), teamId: z.string().optional(), slug: z.string().optional(), requestBody: z.lazy(() => UpdateCustomEnvironmentRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function updateCustomEnvironmentRequestToJSON( updateCustomEnvironmentRequest: UpdateCustomEnvironmentRequest, ): string { return JSON.stringify( UpdateCustomEnvironmentRequest$outboundSchema.parse( updateCustomEnvironmentRequest, ), ); } /** @internal */ export const UpdateCustomEnvironmentEnvironmentType$inboundSchema: z.ZodNativeEnum<typeof UpdateCustomEnvironmentEnvironmentType> = z.nativeEnum( UpdateCustomEnvironmentEnvironmentType, ); /** @internal */ export const UpdateCustomEnvironmentEnvironmentResponseType$inboundSchema: z.ZodNativeEnum<typeof UpdateCustomEnvironmentEnvironmentResponseType> = z .nativeEnum(UpdateCustomEnvironmentEnvironmentResponseType); /** @internal */ export const UpdateCustomEnvironmentEnvironmentBranchMatcher$inboundSchema: z.ZodType< UpdateCustomEnvironmentEnvironmentBranchMatcher, z.ZodTypeDef, unknown > = z.object({ type: UpdateCustomEnvironmentEnvironmentResponseType$inboundSchema, pattern: types.string(), }); export function updateCustomEnvironmentEnvironmentBranchMatcherFromJSON( jsonString: string, ): SafeParseResult< UpdateCustomEnvironmentEnvironmentBranchMatcher, SDKValidationError > { return safeParse( jsonString, (x) => UpdateCustomEnvironmentEnvironmentBranchMatcher$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'UpdateCustomEnvironmentEnvironmentBranchMatcher' from JSON`, ); } /** @internal */ export const UpdateCustomEnvironmentVerification$inboundSchema: z.ZodType< UpdateCustomEnvironmentVerification, z.ZodTypeDef, unknown > = z.object({ type: types.string(), domain: types.string(), value: types.string(), reason: types.string(), }); export function updateCustomEnvironmentVerificationFromJSON( jsonString: string, ): SafeParseResult<UpdateCustomEnvironmentVerification, SDKValidationError> { return safeParse( jsonString, (x) => UpdateCustomEnvironmentVerification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateCustomEnvironmentVerification' from JSON`, ); } /** @internal */ export const UpdateCustomEnvironmentDomains$inboundSchema: z.ZodType< UpdateCustomEnvironmentDomains, 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(() => UpdateCustomEnvironmentVerification$inboundSchema)), ), }); export function updateCustomEnvironmentDomainsFromJSON( jsonString: string, ): SafeParseResult<UpdateCustomEnvironmentDomains, SDKValidationError> { return safeParse( jsonString, (x) => UpdateCustomEnvironmentDomains$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateCustomEnvironmentDomains' from JSON`, ); } /** @internal */ export const UpdateCustomEnvironmentResponseBody$inboundSchema: z.ZodType< UpdateCustomEnvironmentResponseBody, z.ZodTypeDef, unknown > = z.object({ id: types.string(), slug: types.string(), type: UpdateCustomEnvironmentEnvironmentType$inboundSchema, description: types.optional(types.string()), branchMatcher: types.optional( z.lazy(() => UpdateCustomEnvironmentEnvironmentBranchMatcher$inboundSchema), ), domains: types.optional( z.array(z.lazy(() => UpdateCustomEnvironmentDomains$inboundSchema)), ), currentDeploymentAliases: types.optional(z.array(types.string())), createdAt: types.number(), updatedAt: types.number(), }); export function updateCustomEnvironmentResponseBodyFromJSON( jsonString: string, ): SafeParseResult<UpdateCustomEnvironmentResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => UpdateCustomEnvironmentResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateCustomEnvironmentResponseBody' from JSON`, ); }