UNPKG

@forestadmin/datasource-toolkit

Version:
35 lines 1.53 kB
import ConditionTree, { PlainConditionTree } from './base'; import { Operator } from './operators'; import { Collection } from '../../../collection'; import { RecordData } from '../../../record'; import Projection from '../../projection'; export type PlainConditionTreeLeaf = { field: string; operator: Operator; value?: unknown; }; type LeafHandler<R> = (leaf: ConditionTreeLeaf) => R; export type LeafReplacer = LeafHandler<ConditionTree | PlainConditionTree>; export type AsyncLeafReplacer = LeafHandler<Promise<ConditionTree | PlainConditionTree>>; export type LeafTester = LeafHandler<boolean>; export type LeafCallback = LeafHandler<void>; export default class ConditionTreeLeaf extends ConditionTree { field: string; operator: Operator; value?: unknown; get projection(): Projection; get useIntervalOperator(): boolean; constructor(field: string, operator: Operator, value?: unknown); forEachLeaf(handler: LeafCallback): void; everyLeaf(handler: LeafTester): boolean; someLeaf(handler: LeafTester): boolean; inverse(): ConditionTree; replaceLeafs(handler: LeafReplacer, bind?: unknown): ConditionTree; replaceLeafsAsync(handler: AsyncLeafReplacer, bind?: unknown): Promise<ConditionTree>; match(record: RecordData, collection: Collection, timezone: string): boolean; override(params: Partial<PlainConditionTreeLeaf>): ConditionTreeLeaf; unnest(): ConditionTreeLeaf; toPlainObject(): PlainConditionTree; } export {}; //# sourceMappingURL=leaf.d.ts.map