import { Key, Comparator } from "./utils"; export interface Operation { readonly keep: boolean; readonly done: boolean; propop: boolean; reset(): any; next(item: TItem, key?: Key, owner?: any, root?: boolean): any; } export declare type Tester = (item: any, key?: Key, owner?: any, root?: boolean) => boolean; export interface NamedOperation { name: string; } export declare type OperationCreator = (params: any, parentQuery: any, options: Options, name: string) => Operation; declare type BasicValueQuery = { $eq?: TValue; $ne?: TValue; $lt?: TValue; $gt?: TValue; $lte?: TValue; $gte?: TValue; $in?: TValue[]; $nin?: TValue[]; $all?: TValue[]; $mod?: [number, number]; $exists?: boolean; $regex?: string | RegExp; $size?: number; $where?: ((this: TValue, obj: TValue) => boolean) | string; $options?: "i" | "g" | "m" | "u"; $type?: Function; $not?: NestedQuery; $or?: NestedQuery[]; $nor?: NestedQuery[]; $and?: NestedQuery[]; }; declare type ArrayValueQuery = { $elemMatch?: Query; } & BasicValueQuery; declare type Unpacked = T extends (infer U)[] ? U : T; declare type ValueQuery = TValue extends Array ? ArrayValueQuery> : BasicValueQuery; declare type NotObject = string | number | Date | boolean | Array; declare type ShapeQuery = TItemSchema extends NotObject ? {} : { [k in keyof TItemSchema]?: TItemSchema[k] | ValueQuery; }; declare type NestedQuery = ValueQuery & ShapeQuery; export declare type Query = TItemSchema | RegExp | NestedQuery; export declare abstract class BaseOperation implements Operation { readonly params: TParams; readonly owneryQuery: any; readonly options: Options; readonly name?: string; keep: boolean; done: boolean; abstract propop: boolean; constructor(params: TParams, owneryQuery: any, options: Options, name?: string); protected init(): void; reset(): void; abstract next(item: any, key: Key, parent: any, root: boolean): any; } declare abstract class GroupOperation extends BaseOperation { readonly children: Operation[]; keep: boolean; done: boolean; constructor(params: any, owneryQuery: any, options: Options, children: Operation[]); /** */ reset(): void; abstract next(item: any, key: Key, owner: any, root: boolean): any; /** */ protected childrenNext(item: any, key: Key, owner: any, root: boolean): void; } export declare abstract class NamedGroupOperation extends GroupOperation implements NamedOperation { readonly name: string; abstract propop: boolean; constructor(params: any, owneryQuery: any, options: Options, children: Operation[], name: string); } export declare class QueryOperation extends GroupOperation { readonly propop = true; /** */ next(item: TItem, key: Key, parent: any, root: boolean): void; } export declare class NestedOperation extends GroupOperation { readonly keyPath: Key[]; readonly propop = true; constructor(keyPath: Key[], params: any, owneryQuery: any, options: Options, children: Operation[]); /** */ next(item: any, key: Key, parent: any): void; /** */ private _nextNestedValue; } export declare const createTester: (a: any, compare: Comparator) => any; export declare class EqualsOperation extends BaseOperation { readonly propop = true; private _test; init(): void; next(item: any, key: Key, parent: any): void; } export declare const createEqualsOperation: (params: any, owneryQuery: any, options: Options) => EqualsOperation; export declare class NopeOperation extends BaseOperation { readonly propop = true; next(): void; } export declare const numericalOperationCreator: (createNumericalOperation: OperationCreator) => (params: any, owneryQuery: any, options: Options, name: string) => Operation; export declare const numericalOperation: (createTester: (any: any) => Tester) => (params: any, owneryQuery: any, options: Options, name: string) => Operation; export declare type Options = { operations: { [identifier: string]: OperationCreator; }; compare: (a: any, b: any) => boolean; }; export declare const containsOperation: (query: any, options: Options) => boolean; export declare const createQueryOperation: (query: Query, owneryQuery?: any, { compare, operations }?: Partial) => QueryOperation; export declare const createOperationTester: (operation: Operation) => (item: TItem, key?: Key, owner?: any) => boolean; export declare const createQueryTester: (query: Query, options?: Partial) => (item: TItem, key?: Key, owner?: any) => boolean; export {};