@forestadmin/datasource-toolkit
Version:
22 lines • 1.26 kB
TypeScript
import { PlainConditionTreeBranch } from './branch';
import { AsyncLeafReplacer, LeafCallback, LeafReplacer, LeafTester, PlainConditionTreeLeaf } from './leaf';
import { Collection } from '../../../collection';
import { RecordData } from '../../../record';
import Projection from '../../projection';
export type PlainConditionTree = PlainConditionTreeBranch | PlainConditionTreeLeaf;
export default abstract class ConditionTree {
abstract inverse(): ConditionTree;
abstract replaceLeafs(handler: LeafReplacer, bind?: unknown): ConditionTree;
abstract replaceLeafsAsync(handler: AsyncLeafReplacer, bind?: unknown): Promise<ConditionTree>;
abstract match(record: RecordData, collection: Collection, timezone: string): boolean;
abstract forEachLeaf(handler: LeafCallback): void;
abstract everyLeaf(handler: LeafTester): boolean;
abstract someLeaf(handler: LeafTester): boolean;
abstract toPlainObject(): PlainConditionTree;
abstract get projection(): Projection;
apply(records: RecordData[], collection: Collection, timezone: string): RecordData[];
nest(prefix: string): ConditionTree;
unnest(): ConditionTree;
replaceFields(handler: (field: string) => string): ConditionTree;
}
//# sourceMappingURL=base.d.ts.map