full site update
This commit is contained in:
138
node_modules/zod/v3/ZodError.cjs
generated
vendored
Normal file
138
node_modules/zod/v3/ZodError.cjs
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
|
||||
const util_js_1 = require("./helpers/util.cjs");
|
||||
exports.ZodIssueCode = util_js_1.util.arrayToEnum([
|
||||
"invalid_type",
|
||||
"invalid_literal",
|
||||
"custom",
|
||||
"invalid_union",
|
||||
"invalid_union_discriminator",
|
||||
"invalid_enum_value",
|
||||
"unrecognized_keys",
|
||||
"invalid_arguments",
|
||||
"invalid_return_type",
|
||||
"invalid_date",
|
||||
"invalid_string",
|
||||
"too_small",
|
||||
"too_big",
|
||||
"invalid_intersection_types",
|
||||
"not_multiple_of",
|
||||
"not_finite",
|
||||
]);
|
||||
const quotelessJson = (obj) => {
|
||||
const json = JSON.stringify(obj, null, 2);
|
||||
return json.replace(/"([^"]+)":/g, "$1:");
|
||||
};
|
||||
exports.quotelessJson = quotelessJson;
|
||||
class ZodError extends Error {
|
||||
get errors() {
|
||||
return this.issues;
|
||||
}
|
||||
constructor(issues) {
|
||||
super();
|
||||
this.issues = [];
|
||||
this.addIssue = (sub) => {
|
||||
this.issues = [...this.issues, sub];
|
||||
};
|
||||
this.addIssues = (subs = []) => {
|
||||
this.issues = [...this.issues, ...subs];
|
||||
};
|
||||
const actualProto = new.target.prototype;
|
||||
if (Object.setPrototypeOf) {
|
||||
// eslint-disable-next-line ban/ban
|
||||
Object.setPrototypeOf(this, actualProto);
|
||||
}
|
||||
else {
|
||||
this.__proto__ = actualProto;
|
||||
}
|
||||
this.name = "ZodError";
|
||||
this.issues = issues;
|
||||
}
|
||||
format(_mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const fieldErrors = { _errors: [] };
|
||||
const processError = (error) => {
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.unionErrors.map(processError);
|
||||
}
|
||||
else if (issue.code === "invalid_return_type") {
|
||||
processError(issue.returnTypeError);
|
||||
}
|
||||
else if (issue.code === "invalid_arguments") {
|
||||
processError(issue.argumentsError);
|
||||
}
|
||||
else if (issue.path.length === 0) {
|
||||
fieldErrors._errors.push(mapper(issue));
|
||||
}
|
||||
else {
|
||||
let curr = fieldErrors;
|
||||
let i = 0;
|
||||
while (i < issue.path.length) {
|
||||
const el = issue.path[i];
|
||||
const terminal = i === issue.path.length - 1;
|
||||
if (!terminal) {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
// if (typeof el === "string") {
|
||||
// curr[el] = curr[el] || { _errors: [] };
|
||||
// } else if (typeof el === "number") {
|
||||
// const errorArray: any = [];
|
||||
// errorArray._errors = [];
|
||||
// curr[el] = curr[el] || errorArray;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
curr[el]._errors.push(mapper(issue));
|
||||
}
|
||||
curr = curr[el];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(this);
|
||||
return fieldErrors;
|
||||
}
|
||||
static assert(value) {
|
||||
if (!(value instanceof ZodError)) {
|
||||
throw new Error(`Not a ZodError: ${value}`);
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return this.message;
|
||||
}
|
||||
get message() {
|
||||
return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
|
||||
}
|
||||
get isEmpty() {
|
||||
return this.issues.length === 0;
|
||||
}
|
||||
flatten(mapper = (issue) => issue.message) {
|
||||
const fieldErrors = {};
|
||||
const formErrors = [];
|
||||
for (const sub of this.issues) {
|
||||
if (sub.path.length > 0) {
|
||||
const firstEl = sub.path[0];
|
||||
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
||||
fieldErrors[firstEl].push(mapper(sub));
|
||||
}
|
||||
else {
|
||||
formErrors.push(mapper(sub));
|
||||
}
|
||||
}
|
||||
return { formErrors, fieldErrors };
|
||||
}
|
||||
get formErrors() {
|
||||
return this.flatten();
|
||||
}
|
||||
}
|
||||
exports.ZodError = ZodError;
|
||||
ZodError.create = (issues) => {
|
||||
const error = new ZodError(issues);
|
||||
return error;
|
||||
};
|
164
node_modules/zod/v3/ZodError.d.cts
generated
vendored
Normal file
164
node_modules/zod/v3/ZodError.d.cts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
import type { Primitive } from "./helpers/typeAliases.cjs";
|
||||
import { util, type ZodParsedType } from "./helpers/util.cjs";
|
||||
import type { TypeOf, ZodType } from "./index.cjs";
|
||||
type allKeys<T> = T extends any ? keyof T : never;
|
||||
export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
|
||||
export type typeToFlattenedError<T, U = string> = {
|
||||
formErrors: U[];
|
||||
fieldErrors: {
|
||||
[P in allKeys<T>]?: U[];
|
||||
};
|
||||
};
|
||||
export declare const ZodIssueCode: {
|
||||
invalid_type: "invalid_type";
|
||||
invalid_literal: "invalid_literal";
|
||||
custom: "custom";
|
||||
invalid_union: "invalid_union";
|
||||
invalid_union_discriminator: "invalid_union_discriminator";
|
||||
invalid_enum_value: "invalid_enum_value";
|
||||
unrecognized_keys: "unrecognized_keys";
|
||||
invalid_arguments: "invalid_arguments";
|
||||
invalid_return_type: "invalid_return_type";
|
||||
invalid_date: "invalid_date";
|
||||
invalid_string: "invalid_string";
|
||||
too_small: "too_small";
|
||||
too_big: "too_big";
|
||||
invalid_intersection_types: "invalid_intersection_types";
|
||||
not_multiple_of: "not_multiple_of";
|
||||
not_finite: "not_finite";
|
||||
};
|
||||
export type ZodIssueCode = keyof typeof ZodIssueCode;
|
||||
export type ZodIssueBase = {
|
||||
path: (string | number)[];
|
||||
message?: string | undefined;
|
||||
};
|
||||
export interface ZodInvalidTypeIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_type;
|
||||
expected: ZodParsedType;
|
||||
received: ZodParsedType;
|
||||
}
|
||||
export interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_literal;
|
||||
expected: unknown;
|
||||
received: unknown;
|
||||
}
|
||||
export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.unrecognized_keys;
|
||||
keys: string[];
|
||||
}
|
||||
export interface ZodInvalidUnionIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_union;
|
||||
unionErrors: ZodError[];
|
||||
}
|
||||
export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_union_discriminator;
|
||||
options: Primitive[];
|
||||
}
|
||||
export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
||||
received: string | number;
|
||||
code: typeof ZodIssueCode.invalid_enum_value;
|
||||
options: (string | number)[];
|
||||
}
|
||||
export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_arguments;
|
||||
argumentsError: ZodError;
|
||||
}
|
||||
export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_return_type;
|
||||
returnTypeError: ZodError;
|
||||
}
|
||||
export interface ZodInvalidDateIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_date;
|
||||
}
|
||||
export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
||||
includes: string;
|
||||
position?: number | undefined;
|
||||
} | {
|
||||
startsWith: string;
|
||||
} | {
|
||||
endsWith: string;
|
||||
};
|
||||
export interface ZodInvalidStringIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_string;
|
||||
validation: StringValidation;
|
||||
}
|
||||
export interface ZodTooSmallIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.too_small;
|
||||
minimum: number | bigint;
|
||||
inclusive: boolean;
|
||||
exact?: boolean;
|
||||
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
||||
}
|
||||
export interface ZodTooBigIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.too_big;
|
||||
maximum: number | bigint;
|
||||
inclusive: boolean;
|
||||
exact?: boolean;
|
||||
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
||||
}
|
||||
export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_intersection_types;
|
||||
}
|
||||
export interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.not_multiple_of;
|
||||
multipleOf: number | bigint;
|
||||
}
|
||||
export interface ZodNotFiniteIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.not_finite;
|
||||
}
|
||||
export interface ZodCustomIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.custom;
|
||||
params?: {
|
||||
[k: string]: any;
|
||||
};
|
||||
}
|
||||
export type DenormalizedError = {
|
||||
[k: string]: DenormalizedError | string[];
|
||||
};
|
||||
export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
||||
export type ZodIssue = ZodIssueOptionalMessage & {
|
||||
fatal?: boolean | undefined;
|
||||
message: string;
|
||||
};
|
||||
export declare const quotelessJson: (obj: any) => string;
|
||||
type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
|
||||
[K in keyof T]?: ZodFormattedError<T[K]>;
|
||||
} : T extends any[] ? {
|
||||
[k: number]: ZodFormattedError<T[number]>;
|
||||
} : T extends object ? {
|
||||
[K in keyof T]?: ZodFormattedError<T[K]>;
|
||||
} : unknown;
|
||||
export type ZodFormattedError<T, U = string> = {
|
||||
_errors: U[];
|
||||
} & recursiveZodFormattedError<NonNullable<T>>;
|
||||
export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
|
||||
export declare class ZodError<T = any> extends Error {
|
||||
issues: ZodIssue[];
|
||||
get errors(): ZodIssue[];
|
||||
constructor(issues: ZodIssue[]);
|
||||
format(): ZodFormattedError<T>;
|
||||
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
||||
static create: (issues: ZodIssue[]) => ZodError<any>;
|
||||
static assert(value: unknown): asserts value is ZodError;
|
||||
toString(): string;
|
||||
get message(): string;
|
||||
get isEmpty(): boolean;
|
||||
addIssue: (sub: ZodIssue) => void;
|
||||
addIssues: (subs?: ZodIssue[]) => void;
|
||||
flatten(): typeToFlattenedError<T>;
|
||||
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
||||
get formErrors(): typeToFlattenedError<T, string>;
|
||||
}
|
||||
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
||||
export type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
||||
path?: (string | number)[];
|
||||
fatal?: boolean | undefined;
|
||||
};
|
||||
export type ErrorMapCtx = {
|
||||
defaultError: string;
|
||||
data: any;
|
||||
};
|
||||
export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
||||
message: string;
|
||||
};
|
||||
export {};
|
164
node_modules/zod/v3/ZodError.d.ts
generated
vendored
Normal file
164
node_modules/zod/v3/ZodError.d.ts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
import type { Primitive } from "./helpers/typeAliases.js";
|
||||
import { util, type ZodParsedType } from "./helpers/util.js";
|
||||
import type { TypeOf, ZodType } from "./index.js";
|
||||
type allKeys<T> = T extends any ? keyof T : never;
|
||||
export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
|
||||
export type typeToFlattenedError<T, U = string> = {
|
||||
formErrors: U[];
|
||||
fieldErrors: {
|
||||
[P in allKeys<T>]?: U[];
|
||||
};
|
||||
};
|
||||
export declare const ZodIssueCode: {
|
||||
invalid_type: "invalid_type";
|
||||
invalid_literal: "invalid_literal";
|
||||
custom: "custom";
|
||||
invalid_union: "invalid_union";
|
||||
invalid_union_discriminator: "invalid_union_discriminator";
|
||||
invalid_enum_value: "invalid_enum_value";
|
||||
unrecognized_keys: "unrecognized_keys";
|
||||
invalid_arguments: "invalid_arguments";
|
||||
invalid_return_type: "invalid_return_type";
|
||||
invalid_date: "invalid_date";
|
||||
invalid_string: "invalid_string";
|
||||
too_small: "too_small";
|
||||
too_big: "too_big";
|
||||
invalid_intersection_types: "invalid_intersection_types";
|
||||
not_multiple_of: "not_multiple_of";
|
||||
not_finite: "not_finite";
|
||||
};
|
||||
export type ZodIssueCode = keyof typeof ZodIssueCode;
|
||||
export type ZodIssueBase = {
|
||||
path: (string | number)[];
|
||||
message?: string | undefined;
|
||||
};
|
||||
export interface ZodInvalidTypeIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_type;
|
||||
expected: ZodParsedType;
|
||||
received: ZodParsedType;
|
||||
}
|
||||
export interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_literal;
|
||||
expected: unknown;
|
||||
received: unknown;
|
||||
}
|
||||
export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.unrecognized_keys;
|
||||
keys: string[];
|
||||
}
|
||||
export interface ZodInvalidUnionIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_union;
|
||||
unionErrors: ZodError[];
|
||||
}
|
||||
export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_union_discriminator;
|
||||
options: Primitive[];
|
||||
}
|
||||
export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
||||
received: string | number;
|
||||
code: typeof ZodIssueCode.invalid_enum_value;
|
||||
options: (string | number)[];
|
||||
}
|
||||
export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_arguments;
|
||||
argumentsError: ZodError;
|
||||
}
|
||||
export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_return_type;
|
||||
returnTypeError: ZodError;
|
||||
}
|
||||
export interface ZodInvalidDateIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_date;
|
||||
}
|
||||
export type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
|
||||
includes: string;
|
||||
position?: number | undefined;
|
||||
} | {
|
||||
startsWith: string;
|
||||
} | {
|
||||
endsWith: string;
|
||||
};
|
||||
export interface ZodInvalidStringIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_string;
|
||||
validation: StringValidation;
|
||||
}
|
||||
export interface ZodTooSmallIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.too_small;
|
||||
minimum: number | bigint;
|
||||
inclusive: boolean;
|
||||
exact?: boolean;
|
||||
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
||||
}
|
||||
export interface ZodTooBigIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.too_big;
|
||||
maximum: number | bigint;
|
||||
inclusive: boolean;
|
||||
exact?: boolean;
|
||||
type: "array" | "string" | "number" | "set" | "date" | "bigint";
|
||||
}
|
||||
export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.invalid_intersection_types;
|
||||
}
|
||||
export interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.not_multiple_of;
|
||||
multipleOf: number | bigint;
|
||||
}
|
||||
export interface ZodNotFiniteIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.not_finite;
|
||||
}
|
||||
export interface ZodCustomIssue extends ZodIssueBase {
|
||||
code: typeof ZodIssueCode.custom;
|
||||
params?: {
|
||||
[k: string]: any;
|
||||
};
|
||||
}
|
||||
export type DenormalizedError = {
|
||||
[k: string]: DenormalizedError | string[];
|
||||
};
|
||||
export type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
||||
export type ZodIssue = ZodIssueOptionalMessage & {
|
||||
fatal?: boolean | undefined;
|
||||
message: string;
|
||||
};
|
||||
export declare const quotelessJson: (obj: any) => string;
|
||||
type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? {
|
||||
[K in keyof T]?: ZodFormattedError<T[K]>;
|
||||
} : T extends any[] ? {
|
||||
[k: number]: ZodFormattedError<T[number]>;
|
||||
} : T extends object ? {
|
||||
[K in keyof T]?: ZodFormattedError<T[K]>;
|
||||
} : unknown;
|
||||
export type ZodFormattedError<T, U = string> = {
|
||||
_errors: U[];
|
||||
} & recursiveZodFormattedError<NonNullable<T>>;
|
||||
export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
|
||||
export declare class ZodError<T = any> extends Error {
|
||||
issues: ZodIssue[];
|
||||
get errors(): ZodIssue[];
|
||||
constructor(issues: ZodIssue[]);
|
||||
format(): ZodFormattedError<T>;
|
||||
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
||||
static create: (issues: ZodIssue[]) => ZodError<any>;
|
||||
static assert(value: unknown): asserts value is ZodError;
|
||||
toString(): string;
|
||||
get message(): string;
|
||||
get isEmpty(): boolean;
|
||||
addIssue: (sub: ZodIssue) => void;
|
||||
addIssues: (subs?: ZodIssue[]) => void;
|
||||
flatten(): typeToFlattenedError<T>;
|
||||
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
||||
get formErrors(): typeToFlattenedError<T, string>;
|
||||
}
|
||||
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
||||
export type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
||||
path?: (string | number)[];
|
||||
fatal?: boolean | undefined;
|
||||
};
|
||||
export type ErrorMapCtx = {
|
||||
defaultError: string;
|
||||
data: any;
|
||||
};
|
||||
export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
||||
message: string;
|
||||
};
|
||||
export {};
|
133
node_modules/zod/v3/ZodError.js
generated
vendored
Normal file
133
node_modules/zod/v3/ZodError.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { util } from "./helpers/util.js";
|
||||
export const ZodIssueCode = util.arrayToEnum([
|
||||
"invalid_type",
|
||||
"invalid_literal",
|
||||
"custom",
|
||||
"invalid_union",
|
||||
"invalid_union_discriminator",
|
||||
"invalid_enum_value",
|
||||
"unrecognized_keys",
|
||||
"invalid_arguments",
|
||||
"invalid_return_type",
|
||||
"invalid_date",
|
||||
"invalid_string",
|
||||
"too_small",
|
||||
"too_big",
|
||||
"invalid_intersection_types",
|
||||
"not_multiple_of",
|
||||
"not_finite",
|
||||
]);
|
||||
export const quotelessJson = (obj) => {
|
||||
const json = JSON.stringify(obj, null, 2);
|
||||
return json.replace(/"([^"]+)":/g, "$1:");
|
||||
};
|
||||
export class ZodError extends Error {
|
||||
get errors() {
|
||||
return this.issues;
|
||||
}
|
||||
constructor(issues) {
|
||||
super();
|
||||
this.issues = [];
|
||||
this.addIssue = (sub) => {
|
||||
this.issues = [...this.issues, sub];
|
||||
};
|
||||
this.addIssues = (subs = []) => {
|
||||
this.issues = [...this.issues, ...subs];
|
||||
};
|
||||
const actualProto = new.target.prototype;
|
||||
if (Object.setPrototypeOf) {
|
||||
// eslint-disable-next-line ban/ban
|
||||
Object.setPrototypeOf(this, actualProto);
|
||||
}
|
||||
else {
|
||||
this.__proto__ = actualProto;
|
||||
}
|
||||
this.name = "ZodError";
|
||||
this.issues = issues;
|
||||
}
|
||||
format(_mapper) {
|
||||
const mapper = _mapper ||
|
||||
function (issue) {
|
||||
return issue.message;
|
||||
};
|
||||
const fieldErrors = { _errors: [] };
|
||||
const processError = (error) => {
|
||||
for (const issue of error.issues) {
|
||||
if (issue.code === "invalid_union") {
|
||||
issue.unionErrors.map(processError);
|
||||
}
|
||||
else if (issue.code === "invalid_return_type") {
|
||||
processError(issue.returnTypeError);
|
||||
}
|
||||
else if (issue.code === "invalid_arguments") {
|
||||
processError(issue.argumentsError);
|
||||
}
|
||||
else if (issue.path.length === 0) {
|
||||
fieldErrors._errors.push(mapper(issue));
|
||||
}
|
||||
else {
|
||||
let curr = fieldErrors;
|
||||
let i = 0;
|
||||
while (i < issue.path.length) {
|
||||
const el = issue.path[i];
|
||||
const terminal = i === issue.path.length - 1;
|
||||
if (!terminal) {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
// if (typeof el === "string") {
|
||||
// curr[el] = curr[el] || { _errors: [] };
|
||||
// } else if (typeof el === "number") {
|
||||
// const errorArray: any = [];
|
||||
// errorArray._errors = [];
|
||||
// curr[el] = curr[el] || errorArray;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
curr[el] = curr[el] || { _errors: [] };
|
||||
curr[el]._errors.push(mapper(issue));
|
||||
}
|
||||
curr = curr[el];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
processError(this);
|
||||
return fieldErrors;
|
||||
}
|
||||
static assert(value) {
|
||||
if (!(value instanceof ZodError)) {
|
||||
throw new Error(`Not a ZodError: ${value}`);
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return this.message;
|
||||
}
|
||||
get message() {
|
||||
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
||||
}
|
||||
get isEmpty() {
|
||||
return this.issues.length === 0;
|
||||
}
|
||||
flatten(mapper = (issue) => issue.message) {
|
||||
const fieldErrors = {};
|
||||
const formErrors = [];
|
||||
for (const sub of this.issues) {
|
||||
if (sub.path.length > 0) {
|
||||
const firstEl = sub.path[0];
|
||||
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
||||
fieldErrors[firstEl].push(mapper(sub));
|
||||
}
|
||||
else {
|
||||
formErrors.push(mapper(sub));
|
||||
}
|
||||
}
|
||||
return { formErrors, fieldErrors };
|
||||
}
|
||||
get formErrors() {
|
||||
return this.flatten();
|
||||
}
|
||||
}
|
||||
ZodError.create = (issues) => {
|
||||
const error = new ZodError(issues);
|
||||
return error;
|
||||
};
|
17
node_modules/zod/v3/errors.cjs
generated
vendored
Normal file
17
node_modules/zod/v3/errors.cjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultErrorMap = void 0;
|
||||
exports.setErrorMap = setErrorMap;
|
||||
exports.getErrorMap = getErrorMap;
|
||||
const en_js_1 = __importDefault(require("./locales/en.cjs"));
|
||||
exports.defaultErrorMap = en_js_1.default;
|
||||
let overrideErrorMap = en_js_1.default;
|
||||
function setErrorMap(map) {
|
||||
overrideErrorMap = map;
|
||||
}
|
||||
function getErrorMap() {
|
||||
return overrideErrorMap;
|
||||
}
|
5
node_modules/zod/v3/errors.d.cts
generated
vendored
Normal file
5
node_modules/zod/v3/errors.d.cts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ZodErrorMap } from "./ZodError.cjs";
|
||||
import defaultErrorMap from "./locales/en.cjs";
|
||||
export { defaultErrorMap };
|
||||
export declare function setErrorMap(map: ZodErrorMap): void;
|
||||
export declare function getErrorMap(): ZodErrorMap;
|
5
node_modules/zod/v3/errors.d.ts
generated
vendored
Normal file
5
node_modules/zod/v3/errors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { ZodErrorMap } from "./ZodError.js";
|
||||
import defaultErrorMap from "./locales/en.js";
|
||||
export { defaultErrorMap };
|
||||
export declare function setErrorMap(map: ZodErrorMap): void;
|
||||
export declare function getErrorMap(): ZodErrorMap;
|
9
node_modules/zod/v3/errors.js
generated
vendored
Normal file
9
node_modules/zod/v3/errors.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import defaultErrorMap from "./locales/en.js";
|
||||
let overrideErrorMap = defaultErrorMap;
|
||||
export { defaultErrorMap };
|
||||
export function setErrorMap(map) {
|
||||
overrideErrorMap = map;
|
||||
}
|
||||
export function getErrorMap() {
|
||||
return overrideErrorMap;
|
||||
}
|
22
node_modules/zod/v3/external.cjs
generated
vendored
Normal file
22
node_modules/zod/v3/external.cjs
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./errors.cjs"), exports);
|
||||
__exportStar(require("./helpers/parseUtil.cjs"), exports);
|
||||
__exportStar(require("./helpers/typeAliases.cjs"), exports);
|
||||
__exportStar(require("./helpers/util.cjs"), exports);
|
||||
__exportStar(require("./types.cjs"), exports);
|
||||
__exportStar(require("./ZodError.cjs"), exports);
|
6
node_modules/zod/v3/external.d.cts
generated
vendored
Normal file
6
node_modules/zod/v3/external.d.cts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./errors.cjs";
|
||||
export * from "./helpers/parseUtil.cjs";
|
||||
export * from "./helpers/typeAliases.cjs";
|
||||
export * from "./helpers/util.cjs";
|
||||
export * from "./types.cjs";
|
||||
export * from "./ZodError.cjs";
|
6
node_modules/zod/v3/external.d.ts
generated
vendored
Normal file
6
node_modules/zod/v3/external.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./errors.js";
|
||||
export * from "./helpers/parseUtil.js";
|
||||
export * from "./helpers/typeAliases.js";
|
||||
export * from "./helpers/util.js";
|
||||
export * from "./types.js";
|
||||
export * from "./ZodError.js";
|
6
node_modules/zod/v3/external.js
generated
vendored
Normal file
6
node_modules/zod/v3/external.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./errors.js";
|
||||
export * from "./helpers/parseUtil.js";
|
||||
export * from "./helpers/typeAliases.js";
|
||||
export * from "./helpers/util.js";
|
||||
export * from "./types.js";
|
||||
export * from "./ZodError.js";
|
2
node_modules/zod/v3/helpers/enumUtil.cjs
generated
vendored
Normal file
2
node_modules/zod/v3/helpers/enumUtil.cjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
8
node_modules/zod/v3/helpers/enumUtil.d.cts
generated
vendored
Normal file
8
node_modules/zod/v3/helpers/enumUtil.d.cts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare namespace enumUtil {
|
||||
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
||||
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
||||
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
||||
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
||||
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
||||
export {};
|
||||
}
|
8
node_modules/zod/v3/helpers/enumUtil.d.ts
generated
vendored
Normal file
8
node_modules/zod/v3/helpers/enumUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare namespace enumUtil {
|
||||
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
||||
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
||||
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
||||
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
||||
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
||||
export {};
|
||||
}
|
1
node_modules/zod/v3/helpers/enumUtil.js
generated
vendored
Normal file
1
node_modules/zod/v3/helpers/enumUtil.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
9
node_modules/zod/v3/helpers/errorUtil.cjs
generated
vendored
Normal file
9
node_modules/zod/v3/helpers/errorUtil.cjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.errorUtil = void 0;
|
||||
var errorUtil;
|
||||
(function (errorUtil) {
|
||||
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
||||
// biome-ignore lint:
|
||||
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
||||
})(errorUtil || (exports.errorUtil = errorUtil = {}));
|
9
node_modules/zod/v3/helpers/errorUtil.d.cts
generated
vendored
Normal file
9
node_modules/zod/v3/helpers/errorUtil.d.cts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export declare namespace errorUtil {
|
||||
type ErrMessage = string | {
|
||||
message?: string | undefined;
|
||||
};
|
||||
const errToObj: (message?: ErrMessage) => {
|
||||
message?: string | undefined;
|
||||
};
|
||||
const toString: (message?: ErrMessage) => string | undefined;
|
||||
}
|
9
node_modules/zod/v3/helpers/errorUtil.d.ts
generated
vendored
Normal file
9
node_modules/zod/v3/helpers/errorUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export declare namespace errorUtil {
|
||||
type ErrMessage = string | {
|
||||
message?: string | undefined;
|
||||
};
|
||||
const errToObj: (message?: ErrMessage) => {
|
||||
message?: string | undefined;
|
||||
};
|
||||
const toString: (message?: ErrMessage) => string | undefined;
|
||||
}
|
6
node_modules/zod/v3/helpers/errorUtil.js
generated
vendored
Normal file
6
node_modules/zod/v3/helpers/errorUtil.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export var errorUtil;
|
||||
(function (errorUtil) {
|
||||
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
||||
// biome-ignore lint:
|
||||
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
||||
})(errorUtil || (errorUtil = {}));
|
124
node_modules/zod/v3/helpers/parseUtil.cjs
generated
vendored
Normal file
124
node_modules/zod/v3/helpers/parseUtil.cjs
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
|
||||
exports.addIssueToContext = addIssueToContext;
|
||||
const errors_js_1 = require("../errors.cjs");
|
||||
const en_js_1 = __importDefault(require("../locales/en.cjs"));
|
||||
const makeIssue = (params) => {
|
||||
const { data, path, errorMaps, issueData } = params;
|
||||
const fullPath = [...path, ...(issueData.path || [])];
|
||||
const fullIssue = {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
};
|
||||
if (issueData.message !== undefined) {
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: issueData.message,
|
||||
};
|
||||
}
|
||||
let errorMessage = "";
|
||||
const maps = errorMaps
|
||||
.filter((m) => !!m)
|
||||
.slice()
|
||||
.reverse();
|
||||
for (const map of maps) {
|
||||
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
||||
}
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: errorMessage,
|
||||
};
|
||||
};
|
||||
exports.makeIssue = makeIssue;
|
||||
exports.EMPTY_PATH = [];
|
||||
function addIssueToContext(ctx, issueData) {
|
||||
const overrideMap = (0, errors_js_1.getErrorMap)();
|
||||
const issue = (0, exports.makeIssue)({
|
||||
issueData: issueData,
|
||||
data: ctx.data,
|
||||
path: ctx.path,
|
||||
errorMaps: [
|
||||
ctx.common.contextualErrorMap, // contextual error map is first priority
|
||||
ctx.schemaErrorMap, // then schema-bound map if available
|
||||
overrideMap, // then global override map
|
||||
overrideMap === en_js_1.default ? undefined : en_js_1.default, // then global default map
|
||||
].filter((x) => !!x),
|
||||
});
|
||||
ctx.common.issues.push(issue);
|
||||
}
|
||||
class ParseStatus {
|
||||
constructor() {
|
||||
this.value = "valid";
|
||||
}
|
||||
dirty() {
|
||||
if (this.value === "valid")
|
||||
this.value = "dirty";
|
||||
}
|
||||
abort() {
|
||||
if (this.value !== "aborted")
|
||||
this.value = "aborted";
|
||||
}
|
||||
static mergeArray(status, results) {
|
||||
const arrayValue = [];
|
||||
for (const s of results) {
|
||||
if (s.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (s.status === "dirty")
|
||||
status.dirty();
|
||||
arrayValue.push(s.value);
|
||||
}
|
||||
return { status: status.value, value: arrayValue };
|
||||
}
|
||||
static async mergeObjectAsync(status, pairs) {
|
||||
const syncPairs = [];
|
||||
for (const pair of pairs) {
|
||||
const key = await pair.key;
|
||||
const value = await pair.value;
|
||||
syncPairs.push({
|
||||
key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
return ParseStatus.mergeObjectSync(status, syncPairs);
|
||||
}
|
||||
static mergeObjectSync(status, pairs) {
|
||||
const finalObject = {};
|
||||
for (const pair of pairs) {
|
||||
const { key, value } = pair;
|
||||
if (key.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (value.status === "aborted")
|
||||
return exports.INVALID;
|
||||
if (key.status === "dirty")
|
||||
status.dirty();
|
||||
if (value.status === "dirty")
|
||||
status.dirty();
|
||||
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
||||
finalObject[key.value] = value.value;
|
||||
}
|
||||
}
|
||||
return { status: status.value, value: finalObject };
|
||||
}
|
||||
}
|
||||
exports.ParseStatus = ParseStatus;
|
||||
exports.INVALID = Object.freeze({
|
||||
status: "aborted",
|
||||
});
|
||||
const DIRTY = (value) => ({ status: "dirty", value });
|
||||
exports.DIRTY = DIRTY;
|
||||
const OK = (value) => ({ status: "valid", value });
|
||||
exports.OK = OK;
|
||||
const isAborted = (x) => x.status === "aborted";
|
||||
exports.isAborted = isAborted;
|
||||
const isDirty = (x) => x.status === "dirty";
|
||||
exports.isDirty = isDirty;
|
||||
const isValid = (x) => x.status === "valid";
|
||||
exports.isValid = isValid;
|
||||
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
||||
exports.isAsync = isAsync;
|
78
node_modules/zod/v3/helpers/parseUtil.d.cts
generated
vendored
Normal file
78
node_modules/zod/v3/helpers/parseUtil.d.cts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.cjs";
|
||||
import type { ZodParsedType } from "./util.cjs";
|
||||
export declare const makeIssue: (params: {
|
||||
data: any;
|
||||
path: (string | number)[];
|
||||
errorMaps: ZodErrorMap[];
|
||||
issueData: IssueData;
|
||||
}) => ZodIssue;
|
||||
export type ParseParams = {
|
||||
path: (string | number)[];
|
||||
errorMap: ZodErrorMap;
|
||||
async: boolean;
|
||||
};
|
||||
export type ParsePathComponent = string | number;
|
||||
export type ParsePath = ParsePathComponent[];
|
||||
export declare const EMPTY_PATH: ParsePath;
|
||||
export interface ParseContext {
|
||||
readonly common: {
|
||||
readonly issues: ZodIssue[];
|
||||
readonly contextualErrorMap?: ZodErrorMap | undefined;
|
||||
readonly async: boolean;
|
||||
};
|
||||
readonly path: ParsePath;
|
||||
readonly schemaErrorMap?: ZodErrorMap | undefined;
|
||||
readonly parent: ParseContext | null;
|
||||
readonly data: any;
|
||||
readonly parsedType: ZodParsedType;
|
||||
}
|
||||
export type ParseInput = {
|
||||
data: any;
|
||||
path: (string | number)[];
|
||||
parent: ParseContext;
|
||||
};
|
||||
export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
||||
export type ObjectPair = {
|
||||
key: SyncParseReturnType<any>;
|
||||
value: SyncParseReturnType<any>;
|
||||
};
|
||||
export declare class ParseStatus {
|
||||
value: "aborted" | "dirty" | "valid";
|
||||
dirty(): void;
|
||||
abort(): void;
|
||||
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
||||
static mergeObjectAsync(status: ParseStatus, pairs: {
|
||||
key: ParseReturnType<any>;
|
||||
value: ParseReturnType<any>;
|
||||
}[]): Promise<SyncParseReturnType<any>>;
|
||||
static mergeObjectSync(status: ParseStatus, pairs: {
|
||||
key: SyncParseReturnType<any>;
|
||||
value: SyncParseReturnType<any>;
|
||||
alwaysSet?: boolean;
|
||||
}[]): SyncParseReturnType;
|
||||
}
|
||||
export interface ParseResult {
|
||||
status: "aborted" | "dirty" | "valid";
|
||||
data: any;
|
||||
}
|
||||
export type INVALID = {
|
||||
status: "aborted";
|
||||
};
|
||||
export declare const INVALID: INVALID;
|
||||
export type DIRTY<T> = {
|
||||
status: "dirty";
|
||||
value: T;
|
||||
};
|
||||
export declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
||||
export type OK<T> = {
|
||||
status: "valid";
|
||||
value: T;
|
||||
};
|
||||
export declare const OK: <T>(value: T) => OK<T>;
|
||||
export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
||||
export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
||||
export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
||||
export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
||||
export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
||||
export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
||||
export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
78
node_modules/zod/v3/helpers/parseUtil.d.ts
generated
vendored
Normal file
78
node_modules/zod/v3/helpers/parseUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError.js";
|
||||
import type { ZodParsedType } from "./util.js";
|
||||
export declare const makeIssue: (params: {
|
||||
data: any;
|
||||
path: (string | number)[];
|
||||
errorMaps: ZodErrorMap[];
|
||||
issueData: IssueData;
|
||||
}) => ZodIssue;
|
||||
export type ParseParams = {
|
||||
path: (string | number)[];
|
||||
errorMap: ZodErrorMap;
|
||||
async: boolean;
|
||||
};
|
||||
export type ParsePathComponent = string | number;
|
||||
export type ParsePath = ParsePathComponent[];
|
||||
export declare const EMPTY_PATH: ParsePath;
|
||||
export interface ParseContext {
|
||||
readonly common: {
|
||||
readonly issues: ZodIssue[];
|
||||
readonly contextualErrorMap?: ZodErrorMap | undefined;
|
||||
readonly async: boolean;
|
||||
};
|
||||
readonly path: ParsePath;
|
||||
readonly schemaErrorMap?: ZodErrorMap | undefined;
|
||||
readonly parent: ParseContext | null;
|
||||
readonly data: any;
|
||||
readonly parsedType: ZodParsedType;
|
||||
}
|
||||
export type ParseInput = {
|
||||
data: any;
|
||||
path: (string | number)[];
|
||||
parent: ParseContext;
|
||||
};
|
||||
export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
||||
export type ObjectPair = {
|
||||
key: SyncParseReturnType<any>;
|
||||
value: SyncParseReturnType<any>;
|
||||
};
|
||||
export declare class ParseStatus {
|
||||
value: "aborted" | "dirty" | "valid";
|
||||
dirty(): void;
|
||||
abort(): void;
|
||||
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
||||
static mergeObjectAsync(status: ParseStatus, pairs: {
|
||||
key: ParseReturnType<any>;
|
||||
value: ParseReturnType<any>;
|
||||
}[]): Promise<SyncParseReturnType<any>>;
|
||||
static mergeObjectSync(status: ParseStatus, pairs: {
|
||||
key: SyncParseReturnType<any>;
|
||||
value: SyncParseReturnType<any>;
|
||||
alwaysSet?: boolean;
|
||||
}[]): SyncParseReturnType;
|
||||
}
|
||||
export interface ParseResult {
|
||||
status: "aborted" | "dirty" | "valid";
|
||||
data: any;
|
||||
}
|
||||
export type INVALID = {
|
||||
status: "aborted";
|
||||
};
|
||||
export declare const INVALID: INVALID;
|
||||
export type DIRTY<T> = {
|
||||
status: "dirty";
|
||||
value: T;
|
||||
};
|
||||
export declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
||||
export type OK<T> = {
|
||||
status: "valid";
|
||||
value: T;
|
||||
};
|
||||
export declare const OK: <T>(value: T) => OK<T>;
|
||||
export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
||||
export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
||||
export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
||||
export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
||||
export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
||||
export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
||||
export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|
109
node_modules/zod/v3/helpers/parseUtil.js
generated
vendored
Normal file
109
node_modules/zod/v3/helpers/parseUtil.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import { getErrorMap } from "../errors.js";
|
||||
import defaultErrorMap from "../locales/en.js";
|
||||
export const makeIssue = (params) => {
|
||||
const { data, path, errorMaps, issueData } = params;
|
||||
const fullPath = [...path, ...(issueData.path || [])];
|
||||
const fullIssue = {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
};
|
||||
if (issueData.message !== undefined) {
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: issueData.message,
|
||||
};
|
||||
}
|
||||
let errorMessage = "";
|
||||
const maps = errorMaps
|
||||
.filter((m) => !!m)
|
||||
.slice()
|
||||
.reverse();
|
||||
for (const map of maps) {
|
||||
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
||||
}
|
||||
return {
|
||||
...issueData,
|
||||
path: fullPath,
|
||||
message: errorMessage,
|
||||
};
|
||||
};
|
||||
export const EMPTY_PATH = [];
|
||||
export function addIssueToContext(ctx, issueData) {
|
||||
const overrideMap = getErrorMap();
|
||||
const issue = makeIssue({
|
||||
issueData: issueData,
|
||||
data: ctx.data,
|
||||
path: ctx.path,
|
||||
errorMaps: [
|
||||
ctx.common.contextualErrorMap, // contextual error map is first priority
|
||||
ctx.schemaErrorMap, // then schema-bound map if available
|
||||
overrideMap, // then global override map
|
||||
overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map
|
||||
].filter((x) => !!x),
|
||||
});
|
||||
ctx.common.issues.push(issue);
|
||||
}
|
||||
export class ParseStatus {
|
||||
constructor() {
|
||||
this.value = "valid";
|
||||
}
|
||||
dirty() {
|
||||
if (this.value === "valid")
|
||||
this.value = "dirty";
|
||||
}
|
||||
abort() {
|
||||
if (this.value !== "aborted")
|
||||
this.value = "aborted";
|
||||
}
|
||||
static mergeArray(status, results) {
|
||||
const arrayValue = [];
|
||||
for (const s of results) {
|
||||
if (s.status === "aborted")
|
||||
return INVALID;
|
||||
if (s.status === "dirty")
|
||||
status.dirty();
|
||||
arrayValue.push(s.value);
|
||||
}
|
||||
return { status: status.value, value: arrayValue };
|
||||
}
|
||||
static async mergeObjectAsync(status, pairs) {
|
||||
const syncPairs = [];
|
||||
for (const pair of pairs) {
|
||||
const key = await pair.key;
|
||||
const value = await pair.value;
|
||||
syncPairs.push({
|
||||
key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
return ParseStatus.mergeObjectSync(status, syncPairs);
|
||||
}
|
||||
static mergeObjectSync(status, pairs) {
|
||||
const finalObject = {};
|
||||
for (const pair of pairs) {
|
||||
const { key, value } = pair;
|
||||
if (key.status === "aborted")
|
||||
return INVALID;
|
||||
if (value.status === "aborted")
|
||||
return INVALID;
|
||||
if (key.status === "dirty")
|
||||
status.dirty();
|
||||
if (value.status === "dirty")
|
||||
status.dirty();
|
||||
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
||||
finalObject[key.value] = value.value;
|
||||
}
|
||||
}
|
||||
return { status: status.value, value: finalObject };
|
||||
}
|
||||
}
|
||||
export const INVALID = Object.freeze({
|
||||
status: "aborted",
|
||||
});
|
||||
export const DIRTY = (value) => ({ status: "dirty", value });
|
||||
export const OK = (value) => ({ status: "valid", value });
|
||||
export const isAborted = (x) => x.status === "aborted";
|
||||
export const isDirty = (x) => x.status === "dirty";
|
||||
export const isValid = (x) => x.status === "valid";
|
||||
export const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
2
node_modules/zod/v3/helpers/partialUtil.cjs
generated
vendored
Normal file
2
node_modules/zod/v3/helpers/partialUtil.cjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
8
node_modules/zod/v3/helpers/partialUtil.d.cts
generated
vendored
Normal file
8
node_modules/zod/v3/helpers/partialUtil.d.cts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ZodArray, ZodNullable, ZodObject, ZodOptional, ZodRawShape, ZodTuple, ZodTupleItems, ZodTypeAny } from "../types.cjs";
|
||||
export declare namespace partialUtil {
|
||||
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
||||
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
||||
}, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
||||
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
||||
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
||||
}
|
8
node_modules/zod/v3/helpers/partialUtil.d.ts
generated
vendored
Normal file
8
node_modules/zod/v3/helpers/partialUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ZodArray, ZodNullable, ZodObject, ZodOptional, ZodRawShape, ZodTuple, ZodTupleItems, ZodTypeAny } from "../types.js";
|
||||
export declare namespace partialUtil {
|
||||
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{
|
||||
[k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>>;
|
||||
}, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
||||
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
||||
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
||||
}
|
1
node_modules/zod/v3/helpers/partialUtil.js
generated
vendored
Normal file
1
node_modules/zod/v3/helpers/partialUtil.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
2
node_modules/zod/v3/helpers/typeAliases.cjs
generated
vendored
Normal file
2
node_modules/zod/v3/helpers/typeAliases.cjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
2
node_modules/zod/v3/helpers/typeAliases.d.cts
generated
vendored
Normal file
2
node_modules/zod/v3/helpers/typeAliases.d.cts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
||||
export type Scalars = Primitive | Primitive[];
|
2
node_modules/zod/v3/helpers/typeAliases.d.ts
generated
vendored
Normal file
2
node_modules/zod/v3/helpers/typeAliases.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
||||
export type Scalars = Primitive | Primitive[];
|
1
node_modules/zod/v3/helpers/typeAliases.js
generated
vendored
Normal file
1
node_modules/zod/v3/helpers/typeAliases.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
137
node_modules/zod/v3/helpers/util.cjs
generated
vendored
Normal file
137
node_modules/zod/v3/helpers/util.cjs
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
|
||||
var util;
|
||||
(function (util) {
|
||||
util.assertEqual = (_) => { };
|
||||
function assertIs(_arg) { }
|
||||
util.assertIs = assertIs;
|
||||
function assertNever(_x) {
|
||||
throw new Error();
|
||||
}
|
||||
util.assertNever = assertNever;
|
||||
util.arrayToEnum = (items) => {
|
||||
const obj = {};
|
||||
for (const item of items) {
|
||||
obj[item] = item;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
util.getValidEnumValues = (obj) => {
|
||||
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
||||
const filtered = {};
|
||||
for (const k of validKeys) {
|
||||
filtered[k] = obj[k];
|
||||
}
|
||||
return util.objectValues(filtered);
|
||||
};
|
||||
util.objectValues = (obj) => {
|
||||
return util.objectKeys(obj).map(function (e) {
|
||||
return obj[e];
|
||||
});
|
||||
};
|
||||
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
|
||||
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
|
||||
: (object) => {
|
||||
const keys = [];
|
||||
for (const key in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
util.find = (arr, checker) => {
|
||||
for (const item of arr) {
|
||||
if (checker(item))
|
||||
return item;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
util.isInteger = typeof Number.isInteger === "function"
|
||||
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
||||
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
||||
function joinValues(array, separator = " | ") {
|
||||
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
|
||||
}
|
||||
util.joinValues = joinValues;
|
||||
util.jsonStringifyReplacer = (_, value) => {
|
||||
if (typeof value === "bigint") {
|
||||
return value.toString();
|
||||
}
|
||||
return value;
|
||||
};
|
||||
})(util || (exports.util = util = {}));
|
||||
var objectUtil;
|
||||
(function (objectUtil) {
|
||||
objectUtil.mergeShapes = (first, second) => {
|
||||
return {
|
||||
...first,
|
||||
...second, // second overwrites first
|
||||
};
|
||||
};
|
||||
})(objectUtil || (exports.objectUtil = objectUtil = {}));
|
||||
exports.ZodParsedType = util.arrayToEnum([
|
||||
"string",
|
||||
"nan",
|
||||
"number",
|
||||
"integer",
|
||||
"float",
|
||||
"boolean",
|
||||
"date",
|
||||
"bigint",
|
||||
"symbol",
|
||||
"function",
|
||||
"undefined",
|
||||
"null",
|
||||
"array",
|
||||
"object",
|
||||
"unknown",
|
||||
"promise",
|
||||
"void",
|
||||
"never",
|
||||
"map",
|
||||
"set",
|
||||
]);
|
||||
const getParsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "undefined":
|
||||
return exports.ZodParsedType.undefined;
|
||||
case "string":
|
||||
return exports.ZodParsedType.string;
|
||||
case "number":
|
||||
return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
|
||||
case "boolean":
|
||||
return exports.ZodParsedType.boolean;
|
||||
case "function":
|
||||
return exports.ZodParsedType.function;
|
||||
case "bigint":
|
||||
return exports.ZodParsedType.bigint;
|
||||
case "symbol":
|
||||
return exports.ZodParsedType.symbol;
|
||||
case "object":
|
||||
if (Array.isArray(data)) {
|
||||
return exports.ZodParsedType.array;
|
||||
}
|
||||
if (data === null) {
|
||||
return exports.ZodParsedType.null;
|
||||
}
|
||||
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
||||
return exports.ZodParsedType.promise;
|
||||
}
|
||||
if (typeof Map !== "undefined" && data instanceof Map) {
|
||||
return exports.ZodParsedType.map;
|
||||
}
|
||||
if (typeof Set !== "undefined" && data instanceof Set) {
|
||||
return exports.ZodParsedType.set;
|
||||
}
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return exports.ZodParsedType.date;
|
||||
}
|
||||
return exports.ZodParsedType.object;
|
||||
default:
|
||||
return exports.ZodParsedType.unknown;
|
||||
}
|
||||
};
|
||||
exports.getParsedType = getParsedType;
|
85
node_modules/zod/v3/helpers/util.d.cts
generated
vendored
Normal file
85
node_modules/zod/v3/helpers/util.d.cts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
export declare namespace util {
|
||||
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
||||
export type isAny<T> = 0 extends 1 & T ? true : false;
|
||||
export const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
|
||||
export function assertIs<T>(_arg: T): void;
|
||||
export function assertNever(_x: never): never;
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
||||
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
||||
export type InexactPartial<T> = {
|
||||
[k in keyof T]?: T[k] | undefined;
|
||||
};
|
||||
export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
||||
export const getValidEnumValues: (obj: any) => any[];
|
||||
export const objectValues: (obj: any) => any[];
|
||||
export const objectKeys: ObjectConstructor["keys"];
|
||||
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
||||
export type identity<T> = objectUtil.identity<T>;
|
||||
export type flatten<T> = objectUtil.flatten<T>;
|
||||
export type noUndefined<T> = T extends undefined ? never : T;
|
||||
export const isInteger: NumberConstructor["isInteger"];
|
||||
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
||||
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
||||
export {};
|
||||
}
|
||||
export declare namespace objectUtil {
|
||||
export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
||||
[k in Exclude<keyof U, keyof V>]: U[k];
|
||||
} & V;
|
||||
type optionalKeys<T extends object> = {
|
||||
[k in keyof T]: undefined extends T[k] ? k : never;
|
||||
}[keyof T];
|
||||
type requiredKeys<T extends object> = {
|
||||
[k in keyof T]: undefined extends T[k] ? never : k;
|
||||
}[keyof T];
|
||||
export type addQuestionMarks<T extends object, _O = any> = {
|
||||
[K in requiredKeys<T>]: T[K];
|
||||
} & {
|
||||
[K in optionalKeys<T>]?: T[K];
|
||||
} & {
|
||||
[k in keyof T]?: unknown;
|
||||
};
|
||||
export type identity<T> = T;
|
||||
export type flatten<T> = identity<{
|
||||
[k in keyof T]: T[k];
|
||||
}>;
|
||||
export type noNeverKeys<T> = {
|
||||
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
||||
}[keyof T];
|
||||
export type noNever<T> = identity<{
|
||||
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
||||
}>;
|
||||
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
||||
export type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
||||
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
||||
} & {
|
||||
[K in keyof B]: B[K];
|
||||
};
|
||||
export {};
|
||||
}
|
||||
export declare const ZodParsedType: {
|
||||
string: "string";
|
||||
nan: "nan";
|
||||
number: "number";
|
||||
integer: "integer";
|
||||
float: "float";
|
||||
boolean: "boolean";
|
||||
date: "date";
|
||||
bigint: "bigint";
|
||||
symbol: "symbol";
|
||||
function: "function";
|
||||
undefined: "undefined";
|
||||
null: "null";
|
||||
array: "array";
|
||||
object: "object";
|
||||
unknown: "unknown";
|
||||
promise: "promise";
|
||||
void: "void";
|
||||
never: "never";
|
||||
map: "map";
|
||||
set: "set";
|
||||
};
|
||||
export type ZodParsedType = keyof typeof ZodParsedType;
|
||||
export declare const getParsedType: (data: any) => ZodParsedType;
|
85
node_modules/zod/v3/helpers/util.d.ts
generated
vendored
Normal file
85
node_modules/zod/v3/helpers/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
export declare namespace util {
|
||||
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
||||
export type isAny<T> = 0 extends 1 & T ? true : false;
|
||||
export const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
|
||||
export function assertIs<T>(_arg: T): void;
|
||||
export function assertNever(_x: never): never;
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
||||
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
||||
export type InexactPartial<T> = {
|
||||
[k in keyof T]?: T[k] | undefined;
|
||||
};
|
||||
export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
||||
export const getValidEnumValues: (obj: any) => any[];
|
||||
export const objectValues: (obj: any) => any[];
|
||||
export const objectKeys: ObjectConstructor["keys"];
|
||||
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
||||
export type identity<T> = objectUtil.identity<T>;
|
||||
export type flatten<T> = objectUtil.flatten<T>;
|
||||
export type noUndefined<T> = T extends undefined ? never : T;
|
||||
export const isInteger: NumberConstructor["isInteger"];
|
||||
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
||||
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
||||
export {};
|
||||
}
|
||||
export declare namespace objectUtil {
|
||||
export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : {
|
||||
[k in Exclude<keyof U, keyof V>]: U[k];
|
||||
} & V;
|
||||
type optionalKeys<T extends object> = {
|
||||
[k in keyof T]: undefined extends T[k] ? k : never;
|
||||
}[keyof T];
|
||||
type requiredKeys<T extends object> = {
|
||||
[k in keyof T]: undefined extends T[k] ? never : k;
|
||||
}[keyof T];
|
||||
export type addQuestionMarks<T extends object, _O = any> = {
|
||||
[K in requiredKeys<T>]: T[K];
|
||||
} & {
|
||||
[K in optionalKeys<T>]?: T[K];
|
||||
} & {
|
||||
[k in keyof T]?: unknown;
|
||||
};
|
||||
export type identity<T> = T;
|
||||
export type flatten<T> = identity<{
|
||||
[k in keyof T]: T[k];
|
||||
}>;
|
||||
export type noNeverKeys<T> = {
|
||||
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
||||
}[keyof T];
|
||||
export type noNever<T> = identity<{
|
||||
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
||||
}>;
|
||||
export const mergeShapes: <U, T>(first: U, second: T) => T & U;
|
||||
export type extendShape<A extends object, B extends object> = keyof A & keyof B extends never ? A & B : {
|
||||
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
||||
} & {
|
||||
[K in keyof B]: B[K];
|
||||
};
|
||||
export {};
|
||||
}
|
||||
export declare const ZodParsedType: {
|
||||
string: "string";
|
||||
nan: "nan";
|
||||
number: "number";
|
||||
integer: "integer";
|
||||
float: "float";
|
||||
boolean: "boolean";
|
||||
date: "date";
|
||||
bigint: "bigint";
|
||||
symbol: "symbol";
|
||||
function: "function";
|
||||
undefined: "undefined";
|
||||
null: "null";
|
||||
array: "array";
|
||||
object: "object";
|
||||
unknown: "unknown";
|
||||
promise: "promise";
|
||||
void: "void";
|
||||
never: "never";
|
||||
map: "map";
|
||||
set: "set";
|
||||
};
|
||||
export type ZodParsedType = keyof typeof ZodParsedType;
|
||||
export declare const getParsedType: (data: any) => ZodParsedType;
|
133
node_modules/zod/v3/helpers/util.js
generated
vendored
Normal file
133
node_modules/zod/v3/helpers/util.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
export var util;
|
||||
(function (util) {
|
||||
util.assertEqual = (_) => { };
|
||||
function assertIs(_arg) { }
|
||||
util.assertIs = assertIs;
|
||||
function assertNever(_x) {
|
||||
throw new Error();
|
||||
}
|
||||
util.assertNever = assertNever;
|
||||
util.arrayToEnum = (items) => {
|
||||
const obj = {};
|
||||
for (const item of items) {
|
||||
obj[item] = item;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
util.getValidEnumValues = (obj) => {
|
||||
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
||||
const filtered = {};
|
||||
for (const k of validKeys) {
|
||||
filtered[k] = obj[k];
|
||||
}
|
||||
return util.objectValues(filtered);
|
||||
};
|
||||
util.objectValues = (obj) => {
|
||||
return util.objectKeys(obj).map(function (e) {
|
||||
return obj[e];
|
||||
});
|
||||
};
|
||||
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
|
||||
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
|
||||
: (object) => {
|
||||
const keys = [];
|
||||
for (const key in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
util.find = (arr, checker) => {
|
||||
for (const item of arr) {
|
||||
if (checker(item))
|
||||
return item;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
util.isInteger = typeof Number.isInteger === "function"
|
||||
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
||||
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
||||
function joinValues(array, separator = " | ") {
|
||||
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
|
||||
}
|
||||
util.joinValues = joinValues;
|
||||
util.jsonStringifyReplacer = (_, value) => {
|
||||
if (typeof value === "bigint") {
|
||||
return value.toString();
|
||||
}
|
||||
return value;
|
||||
};
|
||||
})(util || (util = {}));
|
||||
export var objectUtil;
|
||||
(function (objectUtil) {
|
||||
objectUtil.mergeShapes = (first, second) => {
|
||||
return {
|
||||
...first,
|
||||
...second, // second overwrites first
|
||||
};
|
||||
};
|
||||
})(objectUtil || (objectUtil = {}));
|
||||
export const ZodParsedType = util.arrayToEnum([
|
||||
"string",
|
||||
"nan",
|
||||
"number",
|
||||
"integer",
|
||||
"float",
|
||||
"boolean",
|
||||
"date",
|
||||
"bigint",
|
||||
"symbol",
|
||||
"function",
|
||||
"undefined",
|
||||
"null",
|
||||
"array",
|
||||
"object",
|
||||
"unknown",
|
||||
"promise",
|
||||
"void",
|
||||
"never",
|
||||
"map",
|
||||
"set",
|
||||
]);
|
||||
export const getParsedType = (data) => {
|
||||
const t = typeof data;
|
||||
switch (t) {
|
||||
case "undefined":
|
||||
return ZodParsedType.undefined;
|
||||
case "string":
|
||||
return ZodParsedType.string;
|
||||
case "number":
|
||||
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
||||
case "boolean":
|
||||
return ZodParsedType.boolean;
|
||||
case "function":
|
||||
return ZodParsedType.function;
|
||||
case "bigint":
|
||||
return ZodParsedType.bigint;
|
||||
case "symbol":
|
||||
return ZodParsedType.symbol;
|
||||
case "object":
|
||||
if (Array.isArray(data)) {
|
||||
return ZodParsedType.array;
|
||||
}
|
||||
if (data === null) {
|
||||
return ZodParsedType.null;
|
||||
}
|
||||
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
||||
return ZodParsedType.promise;
|
||||
}
|
||||
if (typeof Map !== "undefined" && data instanceof Map) {
|
||||
return ZodParsedType.map;
|
||||
}
|
||||
if (typeof Set !== "undefined" && data instanceof Set) {
|
||||
return ZodParsedType.set;
|
||||
}
|
||||
if (typeof Date !== "undefined" && data instanceof Date) {
|
||||
return ZodParsedType.date;
|
||||
}
|
||||
return ZodParsedType.object;
|
||||
default:
|
||||
return ZodParsedType.unknown;
|
||||
}
|
||||
};
|
33
node_modules/zod/v3/index.cjs
generated
vendored
Normal file
33
node_modules/zod/v3/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.z = void 0;
|
||||
const z = __importStar(require("./external.cjs"));
|
||||
exports.z = z;
|
||||
__exportStar(require("./external.cjs"), exports);
|
||||
exports.default = z;
|
4
node_modules/zod/v3/index.d.cts
generated
vendored
Normal file
4
node_modules/zod/v3/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as z from "./external.cjs";
|
||||
export * from "./external.cjs";
|
||||
export { z };
|
||||
export default z;
|
4
node_modules/zod/v3/index.d.ts
generated
vendored
Normal file
4
node_modules/zod/v3/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as z from "./external.js";
|
||||
export * from "./external.js";
|
||||
export { z };
|
||||
export default z;
|
4
node_modules/zod/v3/index.js
generated
vendored
Normal file
4
node_modules/zod/v3/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as z from "./external.js";
|
||||
export * from "./external.js";
|
||||
export { z };
|
||||
export default z;
|
111
node_modules/zod/v3/locales/en.cjs
generated
vendored
Normal file
111
node_modules/zod/v3/locales/en.cjs
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ZodError_js_1 = require("../ZodError.cjs");
|
||||
const util_js_1 = require("../helpers/util.cjs");
|
||||
const errorMap = (issue, _ctx) => {
|
||||
let message;
|
||||
switch (issue.code) {
|
||||
case ZodError_js_1.ZodIssueCode.invalid_type:
|
||||
if (issue.received === util_js_1.ZodParsedType.undefined) {
|
||||
message = "Required";
|
||||
}
|
||||
else {
|
||||
message = `Expected ${issue.expected}, received ${issue.received}`;
|
||||
}
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_literal:
|
||||
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_js_1.util.jsonStringifyReplacer)}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.unrecognized_keys:
|
||||
message = `Unrecognized key(s) in object: ${util_js_1.util.joinValues(issue.keys, ", ")}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_union:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_union_discriminator:
|
||||
message = `Invalid discriminator value. Expected ${util_js_1.util.joinValues(issue.options)}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_enum_value:
|
||||
message = `Invalid enum value. Expected ${util_js_1.util.joinValues(issue.options)}, received '${issue.received}'`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_arguments:
|
||||
message = `Invalid function arguments`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_return_type:
|
||||
message = `Invalid function return type`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_date:
|
||||
message = `Invalid date`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_string:
|
||||
if (typeof issue.validation === "object") {
|
||||
if ("includes" in issue.validation) {
|
||||
message = `Invalid input: must include "${issue.validation.includes}"`;
|
||||
if (typeof issue.validation.position === "number") {
|
||||
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
||||
}
|
||||
}
|
||||
else if ("startsWith" in issue.validation) {
|
||||
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
||||
}
|
||||
else if ("endsWith" in issue.validation) {
|
||||
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
||||
}
|
||||
else {
|
||||
util_js_1.util.assertNever(issue.validation);
|
||||
}
|
||||
}
|
||||
else if (issue.validation !== "regex") {
|
||||
message = `Invalid ${issue.validation}`;
|
||||
}
|
||||
else {
|
||||
message = "Invalid";
|
||||
}
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.too_small:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
||||
else if (issue.type === "bigint")
|
||||
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.too_big:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "bigint")
|
||||
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.custom:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.invalid_intersection_types:
|
||||
message = `Intersection results could not be merged`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.not_multiple_of:
|
||||
message = `Number must be a multiple of ${issue.multipleOf}`;
|
||||
break;
|
||||
case ZodError_js_1.ZodIssueCode.not_finite:
|
||||
message = "Number must be finite";
|
||||
break;
|
||||
default:
|
||||
message = _ctx.defaultError;
|
||||
util_js_1.util.assertNever(issue);
|
||||
}
|
||||
return { message };
|
||||
};
|
||||
exports.default = errorMap;
|
3
node_modules/zod/v3/locales/en.d.cts
generated
vendored
Normal file
3
node_modules/zod/v3/locales/en.d.cts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { type ZodErrorMap } from "../ZodError.cjs";
|
||||
declare const errorMap: ZodErrorMap;
|
||||
export default errorMap;
|
3
node_modules/zod/v3/locales/en.d.ts
generated
vendored
Normal file
3
node_modules/zod/v3/locales/en.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { type ZodErrorMap } from "../ZodError.js";
|
||||
declare const errorMap: ZodErrorMap;
|
||||
export default errorMap;
|
109
node_modules/zod/v3/locales/en.js
generated
vendored
Normal file
109
node_modules/zod/v3/locales/en.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
import { ZodIssueCode } from "../ZodError.js";
|
||||
import { util, ZodParsedType } from "../helpers/util.js";
|
||||
const errorMap = (issue, _ctx) => {
|
||||
let message;
|
||||
switch (issue.code) {
|
||||
case ZodIssueCode.invalid_type:
|
||||
if (issue.received === ZodParsedType.undefined) {
|
||||
message = "Required";
|
||||
}
|
||||
else {
|
||||
message = `Expected ${issue.expected}, received ${issue.received}`;
|
||||
}
|
||||
break;
|
||||
case ZodIssueCode.invalid_literal:
|
||||
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
||||
break;
|
||||
case ZodIssueCode.unrecognized_keys:
|
||||
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_union:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_union_discriminator:
|
||||
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_enum_value:
|
||||
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_arguments:
|
||||
message = `Invalid function arguments`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_return_type:
|
||||
message = `Invalid function return type`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_date:
|
||||
message = `Invalid date`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_string:
|
||||
if (typeof issue.validation === "object") {
|
||||
if ("includes" in issue.validation) {
|
||||
message = `Invalid input: must include "${issue.validation.includes}"`;
|
||||
if (typeof issue.validation.position === "number") {
|
||||
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
||||
}
|
||||
}
|
||||
else if ("startsWith" in issue.validation) {
|
||||
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
||||
}
|
||||
else if ("endsWith" in issue.validation) {
|
||||
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
||||
}
|
||||
else {
|
||||
util.assertNever(issue.validation);
|
||||
}
|
||||
}
|
||||
else if (issue.validation !== "regex") {
|
||||
message = `Invalid ${issue.validation}`;
|
||||
}
|
||||
else {
|
||||
message = "Invalid";
|
||||
}
|
||||
break;
|
||||
case ZodIssueCode.too_small:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
||||
else if (issue.type === "bigint")
|
||||
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodIssueCode.too_big:
|
||||
if (issue.type === "array")
|
||||
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
||||
else if (issue.type === "string")
|
||||
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
||||
else if (issue.type === "number")
|
||||
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "bigint")
|
||||
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
||||
else if (issue.type === "date")
|
||||
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
||||
else
|
||||
message = "Invalid input";
|
||||
break;
|
||||
case ZodIssueCode.custom:
|
||||
message = `Invalid input`;
|
||||
break;
|
||||
case ZodIssueCode.invalid_intersection_types:
|
||||
message = `Intersection results could not be merged`;
|
||||
break;
|
||||
case ZodIssueCode.not_multiple_of:
|
||||
message = `Number must be a multiple of ${issue.multipleOf}`;
|
||||
break;
|
||||
case ZodIssueCode.not_finite:
|
||||
message = "Number must be finite";
|
||||
break;
|
||||
default:
|
||||
message = _ctx.defaultError;
|
||||
util.assertNever(issue);
|
||||
}
|
||||
return { message };
|
||||
};
|
||||
export default errorMap;
|
2
node_modules/zod/v3/standard-schema.cjs
generated
vendored
Normal file
2
node_modules/zod/v3/standard-schema.cjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
102
node_modules/zod/v3/standard-schema.d.cts
generated
vendored
Normal file
102
node_modules/zod/v3/standard-schema.d.cts
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* The Standard Schema interface.
|
||||
*/
|
||||
export type StandardSchemaV1<Input = unknown, Output = Input> = {
|
||||
/**
|
||||
* The Standard Schema properties.
|
||||
*/
|
||||
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
||||
};
|
||||
export declare namespace StandardSchemaV1 {
|
||||
/**
|
||||
* The Standard Schema properties interface.
|
||||
*/
|
||||
export interface Props<Input = unknown, Output = Input> {
|
||||
/**
|
||||
* The version number of the standard.
|
||||
*/
|
||||
readonly version: 1;
|
||||
/**
|
||||
* The vendor name of the schema library.
|
||||
*/
|
||||
readonly vendor: string;
|
||||
/**
|
||||
* Validates unknown input values.
|
||||
*/
|
||||
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
||||
/**
|
||||
* Inferred types associated with the schema.
|
||||
*/
|
||||
readonly types?: Types<Input, Output> | undefined;
|
||||
}
|
||||
/**
|
||||
* The result interface of the validate function.
|
||||
*/
|
||||
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
||||
/**
|
||||
* The result interface if validation succeeds.
|
||||
*/
|
||||
export interface SuccessResult<Output> {
|
||||
/**
|
||||
* The typed output value.
|
||||
*/
|
||||
readonly value: Output;
|
||||
/**
|
||||
* The non-existent issues.
|
||||
*/
|
||||
readonly issues?: undefined;
|
||||
}
|
||||
/**
|
||||
* The result interface if validation fails.
|
||||
*/
|
||||
export interface FailureResult {
|
||||
/**
|
||||
* The issues of failed validation.
|
||||
*/
|
||||
readonly issues: ReadonlyArray<Issue>;
|
||||
}
|
||||
/**
|
||||
* The issue interface of the failure output.
|
||||
*/
|
||||
export interface Issue {
|
||||
/**
|
||||
* The error message of the issue.
|
||||
*/
|
||||
readonly message: string;
|
||||
/**
|
||||
* The path of the issue, if any.
|
||||
*/
|
||||
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
||||
}
|
||||
/**
|
||||
* The path segment interface of the issue.
|
||||
*/
|
||||
export interface PathSegment {
|
||||
/**
|
||||
* The key representing a path segment.
|
||||
*/
|
||||
readonly key: PropertyKey;
|
||||
}
|
||||
/**
|
||||
* The Standard Schema types interface.
|
||||
*/
|
||||
export interface Types<Input = unknown, Output = Input> {
|
||||
/**
|
||||
* The input type of the schema.
|
||||
*/
|
||||
readonly input: Input;
|
||||
/**
|
||||
* The output type of the schema.
|
||||
*/
|
||||
readonly output: Output;
|
||||
}
|
||||
/**
|
||||
* Infers the input type of a Standard Schema.
|
||||
*/
|
||||
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
||||
/**
|
||||
* Infers the output type of a Standard Schema.
|
||||
*/
|
||||
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
||||
export {};
|
||||
}
|
102
node_modules/zod/v3/standard-schema.d.ts
generated
vendored
Normal file
102
node_modules/zod/v3/standard-schema.d.ts
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* The Standard Schema interface.
|
||||
*/
|
||||
export type StandardSchemaV1<Input = unknown, Output = Input> = {
|
||||
/**
|
||||
* The Standard Schema properties.
|
||||
*/
|
||||
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
||||
};
|
||||
export declare namespace StandardSchemaV1 {
|
||||
/**
|
||||
* The Standard Schema properties interface.
|
||||
*/
|
||||
export interface Props<Input = unknown, Output = Input> {
|
||||
/**
|
||||
* The version number of the standard.
|
||||
*/
|
||||
readonly version: 1;
|
||||
/**
|
||||
* The vendor name of the schema library.
|
||||
*/
|
||||
readonly vendor: string;
|
||||
/**
|
||||
* Validates unknown input values.
|
||||
*/
|
||||
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
||||
/**
|
||||
* Inferred types associated with the schema.
|
||||
*/
|
||||
readonly types?: Types<Input, Output> | undefined;
|
||||
}
|
||||
/**
|
||||
* The result interface of the validate function.
|
||||
*/
|
||||
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
||||
/**
|
||||
* The result interface if validation succeeds.
|
||||
*/
|
||||
export interface SuccessResult<Output> {
|
||||
/**
|
||||
* The typed output value.
|
||||
*/
|
||||
readonly value: Output;
|
||||
/**
|
||||
* The non-existent issues.
|
||||
*/
|
||||
readonly issues?: undefined;
|
||||
}
|
||||
/**
|
||||
* The result interface if validation fails.
|
||||
*/
|
||||
export interface FailureResult {
|
||||
/**
|
||||
* The issues of failed validation.
|
||||
*/
|
||||
readonly issues: ReadonlyArray<Issue>;
|
||||
}
|
||||
/**
|
||||
* The issue interface of the failure output.
|
||||
*/
|
||||
export interface Issue {
|
||||
/**
|
||||
* The error message of the issue.
|
||||
*/
|
||||
readonly message: string;
|
||||
/**
|
||||
* The path of the issue, if any.
|
||||
*/
|
||||
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
||||
}
|
||||
/**
|
||||
* The path segment interface of the issue.
|
||||
*/
|
||||
export interface PathSegment {
|
||||
/**
|
||||
* The key representing a path segment.
|
||||
*/
|
||||
readonly key: PropertyKey;
|
||||
}
|
||||
/**
|
||||
* The Standard Schema types interface.
|
||||
*/
|
||||
export interface Types<Input = unknown, Output = Input> {
|
||||
/**
|
||||
* The input type of the schema.
|
||||
*/
|
||||
readonly input: Input;
|
||||
/**
|
||||
* The output type of the schema.
|
||||
*/
|
||||
readonly output: Output;
|
||||
}
|
||||
/**
|
||||
* Infers the input type of a Standard Schema.
|
||||
*/
|
||||
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
||||
/**
|
||||
* Infers the output type of a Standard Schema.
|
||||
*/
|
||||
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
||||
export {};
|
||||
}
|
1
node_modules/zod/v3/standard-schema.js
generated
vendored
Normal file
1
node_modules/zod/v3/standard-schema.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
3775
node_modules/zod/v3/types.cjs
generated
vendored
Normal file
3775
node_modules/zod/v3/types.cjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1031
node_modules/zod/v3/types.d.cts
generated
vendored
Normal file
1031
node_modules/zod/v3/types.d.cts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1031
node_modules/zod/v3/types.d.ts
generated
vendored
Normal file
1031
node_modules/zod/v3/types.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3693
node_modules/zod/v3/types.js
generated
vendored
Normal file
3693
node_modules/zod/v3/types.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user