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>

404 lines (377 loc) 10.7 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 { SDKValidationError } from "./sdkvalidationerror.js"; /** * Docker/OCI build instruction associated with an image layer. */ export const VcrImageLayer4Operation = { Add: "ADD", Arg: "ARG", Cmd: "CMD", Copy: "COPY", Entrypoint: "ENTRYPOINT", Env: "ENV", Expose: "EXPOSE", From: "FROM", Healthcheck: "HEALTHCHECK", Label: "LABEL", Onbuild: "ONBUILD", Run: "RUN", Shell: "SHELL", Stopsignal: "STOPSIGNAL", Unknown: "UNKNOWN", User: "USER", Volume: "VOLUME", Workdir: "WORKDIR", } as const; /** * Docker/OCI build instruction associated with an image layer. */ export type VcrImageLayer4Operation = ClosedEnum< typeof VcrImageLayer4Operation >; export const VcrImageLayer4Type = { Add: "ADD", Arg: "ARG", Cmd: "CMD", Copy: "COPY", Entrypoint: "ENTRYPOINT", Expose: "EXPOSE", Healthcheck: "HEALTHCHECK", Label: "LABEL", Onbuild: "ONBUILD", Shell: "SHELL", Stopsignal: "STOPSIGNAL", Unknown: "UNKNOWN", User: "USER", Volume: "VOLUME", Workdir: "WORKDIR", } as const; export type VcrImageLayer4Type = ClosedEnum<typeof VcrImageLayer4Type>; export type VcrImageLayer4 = { createdBy: string | null; digest: string | null; /** * Docker/OCI build instruction associated with an image layer. */ operation: VcrImageLayer4Operation; sizeBytes: number | null; type: VcrImageLayer4Type; value: string | null; }; /** * Docker/OCI build instruction associated with an image layer. */ export const VcrImageLayer3Operation = { Add: "ADD", Arg: "ARG", Cmd: "CMD", Copy: "COPY", Entrypoint: "ENTRYPOINT", Env: "ENV", Expose: "EXPOSE", From: "FROM", Healthcheck: "HEALTHCHECK", Label: "LABEL", Onbuild: "ONBUILD", Run: "RUN", Shell: "SHELL", Stopsignal: "STOPSIGNAL", Unknown: "UNKNOWN", User: "USER", Volume: "VOLUME", Workdir: "WORKDIR", } as const; /** * Docker/OCI build instruction associated with an image layer. */ export type VcrImageLayer3Operation = ClosedEnum< typeof VcrImageLayer3Operation >; export type VcrImageLayer3 = { createdBy: string | null; digest: string | null; /** * Docker/OCI build instruction associated with an image layer. */ operation: VcrImageLayer3Operation; sizeBytes: number | null; type: "ENV"; env: string | null; }; /** * Docker/OCI build instruction associated with an image layer. */ export const VcrImageLayerOperation = { Add: "ADD", Arg: "ARG", Cmd: "CMD", Copy: "COPY", Entrypoint: "ENTRYPOINT", Env: "ENV", Expose: "EXPOSE", From: "FROM", Healthcheck: "HEALTHCHECK", Label: "LABEL", Onbuild: "ONBUILD", Run: "RUN", Shell: "SHELL", Stopsignal: "STOPSIGNAL", Unknown: "UNKNOWN", User: "USER", Volume: "VOLUME", Workdir: "WORKDIR", } as const; /** * Docker/OCI build instruction associated with an image layer. */ export type VcrImageLayerOperation = ClosedEnum<typeof VcrImageLayerOperation>; export type VcrImageLayer2 = { createdBy: string | null; digest: string | null; /** * Docker/OCI build instruction associated with an image layer. */ operation: VcrImageLayerOperation; sizeBytes: number | null; type: "RUN"; command: string | null; }; /** * Docker/OCI build instruction associated with an image layer. */ export const Operation = { Add: "ADD", Arg: "ARG", Cmd: "CMD", Copy: "COPY", Entrypoint: "ENTRYPOINT", Env: "ENV", Expose: "EXPOSE", From: "FROM", Healthcheck: "HEALTHCHECK", Label: "LABEL", Onbuild: "ONBUILD", Run: "RUN", Shell: "SHELL", Stopsignal: "STOPSIGNAL", Unknown: "UNKNOWN", User: "USER", Volume: "VOLUME", Workdir: "WORKDIR", } as const; /** * Docker/OCI build instruction associated with an image layer. */ export type Operation = ClosedEnum<typeof Operation>; export type VcrImageLayer1 = { createdBy: string | null; digest: string | null; /** * Docker/OCI build instruction associated with an image layer. */ operation: Operation; sizeBytes: number | null; type: "FROM"; baseImage: string | null; collapsedDigests: Array<string>; collapsedLayerCount: number; }; export type VcrImageLayer = | VcrImageLayer1 | VcrImageLayer2 | VcrImageLayer3 | (VcrImageLayer4 & { type: "ADD" }) | (VcrImageLayer4 & { type: "ARG" }) | (VcrImageLayer4 & { type: "CMD" }) | (VcrImageLayer4 & { type: "COPY" }) | (VcrImageLayer4 & { type: "ENTRYPOINT" }) | (VcrImageLayer4 & { type: "EXPOSE" }) | (VcrImageLayer4 & { type: "HEALTHCHECK" }) | (VcrImageLayer4 & { type: "LABEL" }) | (VcrImageLayer4 & { type: "ONBUILD" }) | (VcrImageLayer4 & { type: "SHELL" }) | (VcrImageLayer4 & { type: "STOPSIGNAL" }) | (VcrImageLayer4 & { type: "UNKNOWN" }) | (VcrImageLayer4 & { type: "USER" }) | (VcrImageLayer4 & { type: "VOLUME" }) | (VcrImageLayer4 & { type: "WORKDIR" }); /** @internal */ export const VcrImageLayer4Operation$inboundSchema: z.ZodNativeEnum< typeof VcrImageLayer4Operation > = z.nativeEnum(VcrImageLayer4Operation); /** @internal */ export const VcrImageLayer4Type$inboundSchema: z.ZodNativeEnum< typeof VcrImageLayer4Type > = z.nativeEnum(VcrImageLayer4Type); /** @internal */ export const VcrImageLayer4$inboundSchema: z.ZodType< VcrImageLayer4, z.ZodTypeDef, unknown > = z.object({ createdBy: types.nullable(types.string()), digest: types.nullable(types.string()), operation: VcrImageLayer4Operation$inboundSchema, sizeBytes: types.nullable(types.number()), type: VcrImageLayer4Type$inboundSchema, value: types.nullable(types.string()), }); export function vcrImageLayer4FromJSON( jsonString: string, ): SafeParseResult<VcrImageLayer4, SDKValidationError> { return safeParse( jsonString, (x) => VcrImageLayer4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VcrImageLayer4' from JSON`, ); } /** @internal */ export const VcrImageLayer3Operation$inboundSchema: z.ZodNativeEnum< typeof VcrImageLayer3Operation > = z.nativeEnum(VcrImageLayer3Operation); /** @internal */ export const VcrImageLayer3$inboundSchema: z.ZodType< VcrImageLayer3, z.ZodTypeDef, unknown > = z.object({ createdBy: types.nullable(types.string()), digest: types.nullable(types.string()), operation: VcrImageLayer3Operation$inboundSchema, sizeBytes: types.nullable(types.number()), type: types.literal("ENV"), env: types.nullable(types.string()), }); export function vcrImageLayer3FromJSON( jsonString: string, ): SafeParseResult<VcrImageLayer3, SDKValidationError> { return safeParse( jsonString, (x) => VcrImageLayer3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VcrImageLayer3' from JSON`, ); } /** @internal */ export const VcrImageLayerOperation$inboundSchema: z.ZodNativeEnum< typeof VcrImageLayerOperation > = z.nativeEnum(VcrImageLayerOperation); /** @internal */ export const VcrImageLayer2$inboundSchema: z.ZodType< VcrImageLayer2, z.ZodTypeDef, unknown > = z.object({ createdBy: types.nullable(types.string()), digest: types.nullable(types.string()), operation: VcrImageLayerOperation$inboundSchema, sizeBytes: types.nullable(types.number()), type: types.literal("RUN"), command: types.nullable(types.string()), }); export function vcrImageLayer2FromJSON( jsonString: string, ): SafeParseResult<VcrImageLayer2, SDKValidationError> { return safeParse( jsonString, (x) => VcrImageLayer2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VcrImageLayer2' from JSON`, ); } /** @internal */ export const Operation$inboundSchema: z.ZodNativeEnum<typeof Operation> = z .nativeEnum(Operation); /** @internal */ export const VcrImageLayer1$inboundSchema: z.ZodType< VcrImageLayer1, z.ZodTypeDef, unknown > = z.object({ createdBy: types.nullable(types.string()), digest: types.nullable(types.string()), operation: Operation$inboundSchema, sizeBytes: types.nullable(types.number()), type: types.literal("FROM"), baseImage: types.nullable(types.string()), collapsedDigests: z.array(types.string()), collapsedLayerCount: types.number(), }); export function vcrImageLayer1FromJSON( jsonString: string, ): SafeParseResult<VcrImageLayer1, SDKValidationError> { return safeParse( jsonString, (x) => VcrImageLayer1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VcrImageLayer1' from JSON`, ); } /** @internal */ export const VcrImageLayer$inboundSchema: z.ZodType< VcrImageLayer, z.ZodTypeDef, unknown > = z.union([ z.lazy(() => VcrImageLayer1$inboundSchema), z.lazy(() => VcrImageLayer2$inboundSchema), z.lazy(() => VcrImageLayer3$inboundSchema), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("ADD") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("ARG") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("CMD") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("COPY") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("ENTRYPOINT") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("EXPOSE") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("HEALTHCHECK") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("LABEL") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("ONBUILD") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("SHELL") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("STOPSIGNAL") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("UNKNOWN") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("USER") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("VOLUME") }), ), z.lazy(() => VcrImageLayer4$inboundSchema).and( z.object({ type: z.literal("WORKDIR") }), ), ]); export function vcrImageLayerFromJSON( jsonString: string, ): SafeParseResult<VcrImageLayer, SDKValidationError> { return safeParse( jsonString, (x) => VcrImageLayer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VcrImageLayer' from JSON`, ); }