import DateTime from "@web-atoms/date-time/dist/DateTime"; import IPagedList from "../models/IPagedList"; import type BaseEntityService from "./BaseEntityService"; import type { ICollection, IListParams, IModel, IPagedListParams, IQueryMethod } from "./BaseEntityService"; export type stepTypes = "Day" | "Month" | "Year" | "Week" | "Hour"; export declare const convertToLinq: (x: string) => string; export declare function append(original: T[], ...item: T[]): T[]; export interface IIncludedQuery extends Required> { thenInclude(path: (x: TR) => TP): IIncludedQuery; } export interface IIncludedArrayQuery extends Required> { thenInclude(q: (x: TR) => TP[]): IIncludedArrayQuery; thenInclude(q: (x: TR) => TP): IIncludedQuery; } export type Func = (x: T) => TR; export type SelectWithFunc = (x: T, y: ICollection) => TR; export interface IDateRange { startDate: DateTime; endDate: DateTime; } export interface IEntityWithDateRange { entity: T; range: IDateRange; } export declare class QueryComposer { private separator; private query; private parameters; private index; constructor(separator?: string); add

(p: P, q: (p: P) => (item: Q) => any): void; asQuery(): any[]; } interface IQueryContext { service: BaseEntityService; name: string; traceQuery?: boolean; queryFunction?: string; args?: any[]; queryProcessor?: "DotNet" | "JavaScript"; } export default class Query { private context; private methods; constructor(context: IQueryContext, methods?: IQueryMethod[]); where(q: (x: T) => any): Query; where(p: TP, q: (p: TP) => (x: T) => any): Query; joinDateRange(start: DateTime, end: DateTime, step: stepTypes): Query>; selectWith(model: IModel, q: SelectWithFunc): Query; selectWith(model: IModel, tp: TP, q: (p: TP) => SelectWithFunc): Query; select(q: (x: T) => TR): Query; select(tp: TP, q: (p: TP) => (x: T) => TR): Query; /** * @param args any[] * @returns Query */ whereLinq(query: TemplateStringsArray, ...args: any[]): Query; selectLinq(query: TemplateStringsArray, ...args: any[]): Query; join(model: IModel, left: (x: T) => TKey, right: (x: TInner) => TKey): Query<{ entity: T; inner: TInner; }>; leftJoin(model: IModel, left: (x: T) => TKey, right: (x: TInner) => TKey): Query<{ entity: T; inner: TInner; }>; include(q: (x: T) => TR[]): IIncludedArrayQuery; include(q: (x: T) => TR): IIncludedQuery; include(...q: string[]): Query; firstOrDefault(p?: IListParams): Promise; orderBy(q: (x: T) => TR): Query; orderBy(p: TP, q: (p: TP) => (x: T) => TR): Query; orderByDescending(q: (x: T) => TR): Query; orderByDescending(p: TP, q: (p: TP) => (x: T) => TR): Query; thenBy(q: (x: T) => TR): Query; thenBy(p: TP, q: (p: TP) => (x: T) => TR): Query; thenByDescending(q: (x: T) => TR): Query; thenByDescending(p: TP, q: (p: TP) => (x: T) => TR): Query; trace(): Query; /** * Warning, will return all the items from the query, please use `toPagedList` * for better performance * @param cancelToken Cancel Token to cancel the query * @returns Promise */ toArray({ cancelToken, doNotResolve, hideActivityIndicator, cacheSeconds, cacheVersion }?: IListParams): Promise; toPagedList({ start, size, cancelToken, cacheVersion, hideActivityIndicator, splitInclude, cacheSeconds, cacheImmutable, count }?: IPagedListParams): Promise>; protected thenInclude(a: any): any; private append; private process; private convertToLinq; } export {}; //# sourceMappingURL=Query.d.ts.map