import { Analysis, Table } from '@drzl/analyzer';
import { ValidationGenerateOptions, ConstraintsOption, ValidationRenderer } from '@drzl/validation-core';
interface ValibotGenerateOptions extends ValidationGenerateOptions {
outputHeader?: {
enabled?: boolean;
text?: string;
};
/**
* Also emit `findDuplicate
` beside the schemas: the rows in a batch that collide with an
* earlier row on a unique constraint.
*
* Uniqueness is the one constraint a per-row validator structurally cannot see, since it is a
* fact about the table. This checks the half that needs no database. Off by default, because
* generated code ships in the consumer's bundle.
*/
duplicateFinder?: boolean;
/**
* Also emit `constraints.ts`: every CHECK, unique constraint, primary and foreign key on each
* table, as plain data, plus `constraintForIssue` to map a validation issue back to the
* constraint that caused it.
*
* For a consumer building forms. A schema states what a value must look like and never says
* which constraint said so, so a failed parse gives a form a message and no way to attribute it;
* and the two constraints a per-row schema cannot check at all, uniqueness and a foreign key,
* are absent from the emitted module in every form.
*
* The emitted module is library-neutral data, and its matcher reads valibot's path items and
* zod's alike. Off by default, like every option that adds bytes to the consumer's bundle.
* `true` is the shorthand for `{ enabled: true }`; `{ errorMap: false }` emits the data without
* the matcher.
*/
constraints?: ConstraintsOption;
}
declare class ValibotGenerator implements ValidationRenderer {
private analysis;
readonly library: "valibot";
constructor(analysis: Analysis);
generate(opts: ValibotGenerateOptions): Promise;
renderTable(table: Table, opts?: ValibotGenerateOptions): string;
private defaultIndex;
}
export { type ValibotGenerateOptions, ValibotGenerator, ValibotGenerator as default };