import { Observable } from 'rxjs'; import { Auth } from './Auth'; import { AggregateOptions, BulkWriteResult, ChangeStreamOptions, Document, DocumentEvent, DocumentExtraOptions, DocumentFilter, DocumentLiveQuery, DocumentOptions, DocumentPipeline, DocumentQuery, FindOptions, LiveQueryMessage, ManyInsertResponse, ManyUpdateResponse, ManyUpsertResponse, QueryMethod, Sort } from './types'; export type MaybeArray = T | T[]; export type RunResult = number | MaybeArray | ManyInsertResponse | ManyUpdateResponse | ManyUpsertResponse | BulkWriteResult | void; export declare const BordaLiveQueryMemo: Map; export declare class BordaQuery { #private; get app(): string; get collection(): string; get inspect(): boolean; get unlocked(): boolean; get auth(): Auth; constructor({ app, inspect, collection, auth, }: { app: string; collection: string; inspect?: boolean; auth?: Auth; }); /** * unlock can only be used in server environment * with proper ApiKey+ApiSecret defined */ unlock(isUnlocked?: boolean): this; /** * doc modifiers */ projection(project: any): this; sort(by: Sort): this; filter(by: DocumentFilter): this; limit(by: number): this; skip(by: number): this; include(fields: string[]): this; exclude(fields: string[]): this; pipeline(docs: DocumentPipeline[]): this; /** * find documents using mongo-like queries */ find(options?: FindOptions & DocumentExtraOptions): Promise; /** * find a document using mongo-like queries * or direclty by passing its objectId */ findOne(objectId: string): Promise; findOne(objectId: string, options?: FindOptions & DocumentExtraOptions): Promise; findOne(options?: DocumentExtraOptions): Promise; /** * update a document using mongo-like queries * or direclty by passing its objectId */ update(doc: TSchema, options?: DocumentExtraOptions): Promise; update(objectId: string, doc: TSchema, options?: DocumentExtraOptions): Promise; updateMany(doc: TSchema, options?: DocumentExtraOptions): Promise; insert(doc: Partial, options?: DocumentExtraOptions): Promise; /** * insert many documents * The number of operations in each group cannot exceed the value of the maxWriteBatchSize of the database. As of MongoDB 3.6, this value is 100,000. * learn more https://www.mongodb.com/docs/manual/reference/method/db.collection.insertMany/ */ insertMany(docs: Partial[], options?: DocumentExtraOptions): Promise>; /** * update or insert a document */ upsert(doc: Partial, options?: DocumentExtraOptions): Promise; /** * update or insert many documents */ upsertMany(docs: Partial[], options?: DocumentExtraOptions): Promise; /** * delete a document using mongo-like queries * or direclty by passing its objectId */ delete(options?: DocumentExtraOptions): Promise; delete(objectId: string, options?: DocumentExtraOptions): Promise; deleteMany(options?: DocumentExtraOptions): Promise; /** * count documents using mongo-like queries */ count(options?: FindOptions & DocumentExtraOptions): Promise; /** * aggregate documents using mongo-like queries */ aggregate(options?: AggregateOptions & DocumentExtraOptions): Promise; /** * doc retrieval */ run(method: QueryMethod, options?: DocumentOptions, docOrDocs?: Partial | Partial[], objectId?: string): Promise>; on(event: DocumentEvent, options?: ChangeStreamOptions): Observable>; once(): Observable>; get bridge(): { run: (query: DocumentQuery) => Promise | Awaited>; on: (query: DocumentLiveQuery) => Observable>; once: (query: DocumentLiveQuery) => Observable>; }; } export declare class BordaClientQuery extends BordaQuery { #private; constructor({ app, auth, inspect, collection, serverURL, serverKey, serverSecret, serverHeaderPrefix, webSocketURL, }: { app: string; auth: Auth; collection: string; inspect?: boolean; serverURL: string; serverKey: string; serverSecret: string; serverHeaderPrefix: string; webSocketURL?: string; }); get bridge(): { run: ({ collection, pipeline, method, objectId, filter, doc, docs, options, unlock, projection, sort, limit, skip, include, exclude, }: DocumentQuery) => Promise>; on: (liveQuery: DocumentLiveQuery, options?: ChangeStreamOptions) => Observable>; once: (liveQuery: DocumentLiveQuery) => Observable>; }; }