//#region src/core/extract/effects.d.ts /** * Effect compilation utilities. * Uses fn.toString() to extract function source text from live Zod schema references, * then classifies whether the function can be safely inlined (zero external captures). */ /** * Can this refine predicate be CALLED by reference from generated code? * * Weaker than {@link tryCompileEffect}: the callback keeps its own closure, so * captures are fine — only shapes whose semantics the generated call could not * reproduce are rejected. A second parameter means the zod `ctx` protocol * (superRefine-style issue collection), and an async/generator function returns * a promise where zod's synchronous parse raises $ZodAsyncError. */ declare function isReferenceablePredicate(fn: unknown): boolean; /** * Does this callback DEMONSTRABLY observe zod's second (parse-context) argument? * * Only a positive answer is trustworthy. Zod calls `transform(value, payload)` * while every compiled route passes the value alone, so a callback that reads * the second argument must be left to zod — but a callback whose signature * cannot be read (a native like `Number`, a bound function) is NOT thereby * suspect, and refusing those costs a very common idiom its compiled path for * no correctness gain: `.transform(Number)` delegating measured SLOWER than not * compiling at all. So this reports only what the parsed parameter list proves. * * `fn.length` cannot answer this at all: it stops counting at the first default * and ignores a rest element, so `(...args) => args.length` reports 0 and * `(v, ctx = null) => …` reports 1. */ declare function observesSecondArgument(fn: unknown): boolean; /** * Can a callback be invoked with the value alone without hiding Zod's second * parse-context argument? `fn.length` is insufficient here: default and rest * parameters can observe that argument while still reporting length 0 or 1. */ declare function isContextFreeUnaryCallback(fn: unknown): boolean; /** * A `superRefine`: a `custom` check whose callback takes zod's PAYLOAD rather * than the value, collecting issues instead of returning a verdict. Zod stores * it on the check instance (`_zod.check`) rather than `def.fn`. * * Narrowed to zod's OWN wrapper, which is what `_superRefine` builds and the * only thing whose payload handling is modelled here: it installs `addIssue`, * so every issue the user adds has been through `util.issue`. The trait marks a * genuine `$ZodCheck` instance and so excludes a raw `.check(fn)` — shape- * identical, but there the callback IS the user's, holding the payload * unmediated. A `when` predicate is likewise refused: it makes zod run the * check conditionally, where generated code runs it always. */ declare function isPayloadCheck(check: { _zod?: { check?: unknown; def?: { fn?: unknown; when?: unknown; }; traits?: Set; }; }): boolean; /** * Try to compile a function into an inlineable source string. * Returns the function source if it's a zero-capture function (safe to inline), * or undefined if it cannot be compiled (async, has captures, or parse failure). */ declare function tryCompileEffect(fn: unknown): string | undefined; //#endregion export { isContextFreeUnaryCallback, isPayloadCheck, isReferenceablePredicate, observesSecondArgument, tryCompileEffect }; //# sourceMappingURL=effects.d.ts.map