import { Entity, EntityCrudRepository, juggler, Options } from '@loopback/repository'; import { PickKeys } from 'ts-essentials'; import { Driver } from './driver'; import { QueryFilter, QueryWhere } from './filter'; import { EntityClass } from './types'; export interface Query { entityClass: EntityClass; /** * Find matching records * * @param filter - Query filter * @param options - Options for the operations * @returns A promise of an array of records found */ find(filter?: QueryFilter, options?: Options): Promise<(T & Relations)[]>; /** * Find one record that matches filter specification. Same as find, but limited to one result; Returns object, not collection. * * @param filter - Query filter * @param options - Options for the operations * @returns A promise of a record found */ findOne(filter?: QueryFilter, options?: Options): Promise<(T & Relations) | null>; /** * Count matching records * @param where - Matching criteria * @param options - Options for the operations * @returns A promise of number of records matched */ count(where?: QueryWhere, options?: Options): Promise<{ count: number; }>; } export declare const QueryMethods: PickKeys, (...args: any) => any>[]; export declare const QueryProperties: (keyof Query)[]; export declare class DefaultQuery implements Query { readonly entityClass: EntityClass; readonly dataSource: juggler.DataSource; readonly repo?: EntityCrudRepository; readonly driver: Driver; constructor(repo: EntityCrudRepository, dataSource?: juggler.DataSource); constructor(entityClass: EntityClass, dataSource: juggler.DataSource); find(filter?: QueryFilter, options?: Options): Promise<(T & Relations)[]>; findOne(filter?: QueryFilter, options?: Options): Promise<(T & Relations) | null>; count(where?: QueryWhere, options?: Options): Promise<{ count: number; }>; protected toEntity(model: Record): R; protected toEntities(models: Record[]): R[]; } export declare function isQuery(obj: any): obj is Query;