import { QueryDef, QueryTarget, Operator, QueryByAliasObj, LangFallback, IncludeOpts } from './query.js'; import { BasedQueryResponse } from './BasedQueryResponse.js'; import { Search } from './search/index.js'; import { OnData, OnError } from './subscription/index.js'; import { DbClient } from '../index.js'; import { LangName } from '@based/schema'; import { FilterBranchFn, FilterOpts } from './filter/types.js'; import { StepInput, aggFnOptions } from './aggregates/types.js'; import { ReaderSchema } from '@based/protocol/db-read'; export { QueryByAliasObj }; export type SelectFn = (field: string) => BasedDbReferenceQuery; export type BranchInclude = (select: SelectFn) => any; export type QueryCommand = { method: string; args: any[]; }; export declare class QueryBranch { db: DbClient; def: QueryDef; queryCommands: QueryCommand[]; constructor(db: DbClient, def?: QueryDef); sort(field: string, order?: 'asc' | 'desc'): T; filter(field: string, operator?: O | boolean, value?: any, opts?: FilterOpts): T; search(query: string, ...fields: Search[]): T; search(query: ArrayBufferView, field: string, opts?: Omit): T; groupBy(field: string, step?: StepInput): T; count(): T; sum(...fields: string[]): T; cardinality(...fields: string[]): T; stddev(...args: (string | aggFnOptions)[]): T; var(...args: (string | aggFnOptions)[]): T; avg(...fields: string[]): T; harmonicMean(...fields: string[]): T; max(...fields: string[]): T; min(...fields: string[]): T; or(fn: FilterBranchFn): T; or(field: string, operator?: Operator | boolean, value?: any, opts?: FilterOpts): T; range(start: number, end?: number): T; include(...fields: (string | BranchInclude | IncludeOpts | (string | IncludeOpts)[])[]): T; } export declare class BasedDbReferenceQuery extends QueryBranch { } declare class GetPromise extends Promise { toObject(): Promise; toJSON(replacer?: (this: any, key: string, value: any) => any, space?: string | number): Promise; inspect(depth?: number, raw?: boolean): GetPromise; } export declare class BasedDbQuery extends QueryBranch { #private; skipValidation: boolean; target: QueryTarget; readSchema: ReaderSchema; constructor(db: DbClient, type: string, rawTarget?: QueryByAliasObj | number | Promise | Uint32Array | (QueryByAliasObj | number)[], skipValidation?: boolean); at(index: number): BasedDbQuery; reset(): void; get(): GetPromise; buffer?: Uint8Array; subscriptionBuffer?: Uint8Array; register(): void; locale(locale: LangName, fallBack?: LangFallback): this; subscribe(onData: OnData, onError?: OnError): import("./subscription/types.js").OnClose; _getSync(dbCtxExternal: any): BasedQueryResponse; }