/home/techb158/balavpn.abdallabala.com/node_modules/zod/v4/core
NameSizeModeActions
api.cjs264650666editdlrm
api.d.cts294450666editdlrm
api.d.ts294400666editdlrm
api.js229830666editdlrm
checks.cjs210980666editdlrm
checks.d.cts127820666editdlrm
checks.d.ts127780666editdlrm
checks.js195440666editdlrm
core.cjs23090666editdlrm
core.d.cts18110666editdlrm
core.d.ts18080666editdlrm
core.js20850666editdlrm
doc.cjs11990666editdlrm
doc.d.cts3530666editdlrm
doc.d.ts3530666editdlrm
doc.js10880666editdlrm
errors.cjs76500666editdlrm
errors.d.cts78930666editdlrm
errors.d.ts78890666editdlrm
errors.js63160666editdlrm
function.cjs40120666editdlrm
function.d.cts35970666editdlrm
function.d.ts35930666editdlrm
function.js27170666editdlrm
index.cjs21630666editdlrm
index.d.cts5140666editdlrm
index.d.ts4990666editdlrm
index.js4990666editdlrm
json-schema.cjs770666editdlrm
json-schema.d.cts26760666editdlrm
json-schema.d.ts26760666editdlrm
json-schema.js110666editdlrm
parse.cjs39570666editdlrm
parse.d.cts15050666editdlrm
parse.d.ts15010666editdlrm
parse.js25520666editdlrm
regexes.cjs70620666editdlrm
regexes.d.cts27620666editdlrm
regexes.d.ts27620666editdlrm
regexes.js64110666editdlrm
registries.cjs16760666editdlrm
registries.d.cts16460666editdlrm
registries.d.ts16440666editdlrm
registries.js14850666editdlrm
schemas.cjs648430666editdlrm
schemas.d.cts446980666editdlrm
schemas.d.ts446910666editdlrm
schemas.js626520666editdlrm
standard-schema.cjs770666editdlrm
standard-schema.d.cts24030666editdlrm
standard-schema.d.ts24030666editdlrm
standard-schema.js110666editdlrm
to-json-schema.cjs359100666editdlrm
to-json-schema.d.cts37290666editdlrm
to-json-schema.d.ts37260666editdlrm
to-json-schema.js356870666editdlrm
util.cjs164380666editdlrm
util.d.cts107500666editdlrm
util.d.ts107460666editdlrm
util.js150040666editdlrm
versions.cjs1680666editdlrm
versions.d.cts1090666editdlrm
versions.d.ts1090666editdlrm
versions.js700666editdlrm
Edit: /home/techb158/balavpn.abdallabala.com/node_modules/zod/v4/core/errors.js (6316B)
import { $constructor } from "./core.js"; import * as util from "./util.js"; const initializer = (inst, def) => { inst.name = "$ZodError"; Object.defineProperty(inst, "_zod", { value: inst._zod, enumerable: false, }); Object.defineProperty(inst, "issues", { value: def, enumerable: false, }); Object.defineProperty(inst, "message", { get() { return JSON.stringify(def, util.jsonStringifyReplacer, 2); }, enumerable: true, // configurable: false, }); Object.defineProperty(inst, "toString", { value: () => inst.message, enumerable: false, }); }; export const $ZodError = $constructor("$ZodError", initializer); export const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error }); export function flattenError(error, mapper = (issue) => issue.message) { const fieldErrors = {}; const formErrors = []; for (const sub of error.issues) { if (sub.path.length > 0) { fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; fieldErrors[sub.path[0]].push(mapper(sub)); } else { formErrors.push(mapper(sub)); } } return { formErrors, fieldErrors }; } export function formatError(error, _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.errors.length) { issue.errors.map((issues) => processError({ issues })); } else if (issue.code === "invalid_key") { processError({ issues: issue.issues }); } else if (issue.code === "invalid_element") { processError({ issues: issue.issues }); } 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: [] }; } else { curr[el] = curr[el] || { _errors: [] }; curr[el]._errors.push(mapper(issue)); } curr = curr[el]; i++; } } } }; processError(error); return fieldErrors; } export function treeifyError(error, _mapper) { const mapper = _mapper || function (issue) { return issue.message; }; const result = { errors: [] }; const processError = (error, path = []) => { var _a, _b; for (const issue of error.issues) { if (issue.code === "invalid_union" && issue.errors.length) { // regular union error issue.errors.map((issues) => processError({ issues }, issue.path)); } else if (issue.code === "invalid_key") { processError({ issues: issue.issues }, issue.path); } else if (issue.code === "invalid_element") { processError({ issues: issue.issues }, issue.path); } else { const fullpath = [...path, ...issue.path]; if (fullpath.length === 0) { result.errors.push(mapper(issue)); continue; } let curr = result; let i = 0; while (i < fullpath.length) { const el = fullpath[i]; const terminal = i === fullpath.length - 1; if (typeof el === "string") { curr.properties ?? (curr.properties = {}); (_a = curr.properties)[el] ?? (_a[el] = { errors: [] }); curr = curr.properties[el]; } else { curr.items ?? (curr.items = []); (_b = curr.items)[el] ?? (_b[el] = { errors: [] }); curr = curr.items[el]; } if (terminal) { curr.errors.push(mapper(issue)); } i++; } } } }; processError(error); return result; } /** Format a ZodError as a human-readable string in the following form. * * From * * ```ts * ZodError { * issues: [ * { * expected: 'string', * code: 'invalid_type', * path: [ 'username' ], * message: 'Invalid input: expected string' * }, * { * expected: 'number', * code: 'invalid_type', * path: [ 'favoriteNumbers', 1 ], * message: 'Invalid input: expected number' * } * ]; * } * ``` * * to * * ``` * username * ✖ Expected number, received string at "username * favoriteNumbers[0] * ✖ Invalid input: expected number * ``` */ export function toDotPath(path) { const segs = []; for (const seg of path) { if (typeof seg === "number") segs.push(`[${seg}]`); else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`); else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`); else { if (segs.length) segs.push("."); segs.push(seg); } } return segs.join(""); } export function prettifyError(error) { const lines = []; // sort by path length const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length); // Process each issue for (const issue of issues) { lines.push(`✖ ${issue.message}`); if (issue.path?.length) lines.push(` → at ${toDotPath(issue.path)}`); } // Convert Map to formatted string return lines.join("\n"); }