@flatfile/plugin-constraints
Version:
A plugin for extending blueprint with external constraints
29 lines (25 loc) • 1.17 kB
TypeScript
import { Flatfile } from '@flatfile/api';
import { FlatfileEvent, FlatfileListener } from '@flatfile/listener';
import { FlatfileRecord } from '@flatfile/plugin-record-hook';
import { TRecordValue } from '@flatfile/hooks';
declare const externalConstraint: (validator: string, cb: (value: any, key: string, support: {
config: any;
record: FlatfileRecord;
property: Flatfile.Property;
event: FlatfileEvent;
}) => any | Promise<any>) => (listener: FlatfileListener) => void;
/**
* External sheet constraints can be registered on a combination of fields. Unlike the single
* field validator, the sheet constraint will return a partial object containing the fields
* references in the sheet constraint along with the configuration of the constraint.
*
* @param validator
* @param cb
*/
declare const externalSheetConstraint: (validator: string, cb: (values: Record<string, TRecordValue>, keys: string[], support: {
config: any;
record: FlatfileRecord;
properties: Flatfile.Property[];
event: FlatfileEvent;
}) => any | Promise<any>) => (listener: FlatfileListener) => void;
export { externalConstraint, externalSheetConstraint };