import { Execution } from '../engine/Execution'; import { IDataStore, FindParams, FindResult, IBPMNServer, IInstanceData, IItemData } from '../interfaces'; import { ServerComponent } from '../server/ServerComponent'; declare class DataStore extends ServerComponent implements IDataStore { dbConfiguration: any; db: any; execution: Execution; isModified: boolean; isRunning: boolean; inSaving: boolean; promises: any[]; locker: any; enableSavePoints: boolean; saveLogs: boolean; saveSource: boolean; constructor(server: IBPMNServer); save(instance: any, options?: {}): Promise; loadInstance(instanceId: any, options?: {}): Promise<{ instance: IInstanceData; items: any[]; }>; private getItemsFromInstances; static seq: number; private saveInstance; findItem(query: any): Promise; findInstance(query: any, options: any): Promise; convertObj(obj: any, cls: any): any; convertColl(coll: any, cls: any): void; /** * * @param query * @param option * -'summary' minimal data * - 'full' * - {projection,sort} * @returns */ findInstances(query: any, option?: 'summary' | 'full' | any): Promise; /** * scenario: * * ``` * itemId { items { id : value } } * itemKey { items {key: value } } * instance, task { instance: { id: instanceId }, items: { elementId: value }} * message { items: { messageId: nameofmessage, key: value } {} * status { items: {status: 'wait' } } * custom: { query: query, projection: projection } * ``` * New approach: * just like MongoDB * ``` * itemId { items { id : value } } * itemKey { items {key: value } } * instance, task { id: instanceId , items.elementId: value } * message { items.messageId: nameofmessage, key: value } {} * status { items.status: 'wait' } } * custom: { query: query, projection: projection } * ``` * Problem with Mongodb: `projection $elematch returns only the first record` * * @param query */ findItems(query: any): Promise; deleteInstances(query: any): Promise; /** * first time installation of DB * * creates a new collection and add an index * * */ install(): Promise; archive(query: any): Promise; /** * MongoDB Pagination class for finding instances in a collection. * This module provides a function to retrieve paginated results from a MongoDB collection. * It allows filtering, sorting, and projecting fields in the results. * The results can be paginated using a cursor for efficient data retrieval. * all the parameters are optional and are passed to the findInstances method. * * `sort` fields can be specified as an object with field names as keys and 1 (ascending) or -1 (descending) as values. * * Sort by `_id` in descending order by default. * * Sort field can be a nested field, e.g., `data.caseId` * * Sort field can be a numeric or date field. * * `filter` is an object that specifies the criteria for filtering the results. * * `after` is a string that specifies the cursor for pagination, allowing you to retrieve results after a specific document. * * * `limit` is a number that specifies the maximum number of documents to return in the result set. * * * `projection` is an object that specifies which fields to include or exclude in the returned documents. * * * */ find({ filter, after, limit, sort, projection, lastItem, latestItem, getTotalCount }: FindParams): Promise; } export { DataStore };