@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
39 lines • 1.81 kB
TypeScript
import type { VC } from "../VC";
import type { AbstractIs, ValidatorPlainResult, ValidatorStandardSchemaResult, ValidatorZodSafeParseResult } from "./AbstractIs";
/**
* A row validator function that returns a boolean.
*/
export type RowIsValidatorPlain<TRow> = (row: TRow, vc: VC) => ValidatorPlainResult | Promise<ValidatorPlainResult>;
/**
* A row validator function that returns a Zod result.
*/
export type RowIsValidatorZodSafeParse<TRow> = (row: TRow, vc: VC) => ValidatorZodSafeParseResult | Promise<ValidatorZodSafeParseResult>;
/**
* A row validator function that returns a Standard Schema validation result.
*/
export type RowIsValidatorStandardSchemaV1<TRow> = (row: TRow, vc: VC) => ValidatorStandardSchemaResult | Promise<ValidatorStandardSchemaResult>;
/**
* Checks that the validator function returns true for the entire row.
*/
export declare class RowIs<TRow> implements AbstractIs<TRow> {
readonly name: string;
readonly field: null;
readonly message: string | null;
readonly validator: RowIsValidatorPlain<TRow> | RowIsValidatorZodSafeParse<TRow> | RowIsValidatorStandardSchemaV1<TRow>;
/**
* Manual validator.
*/
constructor(validator: RowIsValidatorPlain<TRow>, message: string);
/**
* Rich validator, like Standard Schema (https://standardschema.dev) or Zod.
*/
constructor(validator: RowIsValidatorZodSafeParse<TRow> | RowIsValidatorStandardSchemaV1<TRow>);
/**
* Returns true if validation succeeds. Returns false if it wants the client
* to use this.message as a validation failure response. Throws an instance of
* EntValidationError when it needs to deliver the detailed error messages
* about multiple fields.
*/
check(vc: VC, row: TRow): Promise<boolean>;
}
//# sourceMappingURL=RowIs.d.ts.map