MCPcopy
hub / github.com/di-sukharev/opencommit / processCreateParams

Function processCreateParams

out/cli.cjs:29554–29577  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

29552 }
29553 };
29554 function processCreateParams(params) {
29555 if (!params)
29556 return {};
29557 const { errorMap, invalid_type_error, required_error, description } = params;
29558 if (errorMap && (invalid_type_error || required_error)) {
29559 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
29560 }
29561 if (errorMap)
29562 return { errorMap, description };
29563 const customMap = (iss, ctx) => {
29564 var _a5, _b2;
29565 const { message } = params;
29566 if (iss.code === "invalid_enum_value") {
29567 return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
29568 }
29569 if (typeof ctx.data === "undefined") {
29570 return { message: (_a5 = message !== null && message !== void 0 ? message : required_error) !== null && _a5 !== void 0 ? _a5 : ctx.defaultError };
29571 }
29572 if (iss.code !== "invalid_type")
29573 return { message: ctx.defaultError };
29574 return { message: (_b2 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b2 !== void 0 ? _b2 : ctx.defaultError };
29575 };
29576 return { errorMap: customMap, description };
29577 }
29578 var ZodType = class {
29579 constructor(def) {
29580 this.spa = this.safeParseAsync;

Callers 9

transformMethod · 0.85
defaultMethod · 0.85
brandMethod · 0.85
catchMethod · 0.85
createMethod · 0.85
createMethod · 0.85
createMethod · 0.85
createZodEnumFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…