import { IBPMNServer, IDefinition, IExecution, IInstanceData, IItemData, ISecureUser } from '../'; /** * root object to api * * to create: * * api=new BPMNAPI(new BPMNServer(...)); * * to use: * * api.engine to access engine functions (start,invoke..) * api.data to access dataStore functions (find.. delete) * api.model to access Model functions (list,save,export..) * * * api cli: * >api engine start --name 'Buy Used Car' --data caseId 1003 * >api engine invoke --query name 'Buy Used Car' items.status wait name 'Buy' --data carModel 'Mazda 3' * >api data findItems --query name 'Buy Used Car' items.status wait * >api model list */ declare class BPMNAPI { server: IBPMNServer; engine: APIEngine; data: APIData; model: APIModel; defaultUser: ISecureUser; constructor(server: IBPMNServer); } declare class APIComponent { api: BPMNAPI; constructor(api: any); get server(): IBPMNServer; getUser(user: any): any; } /** common parameters: - query: MongoDB query to locate the target instance or item - data: input Data - user: an instance of ISecureUser object - options: various options, this is an open object that is based through the run-time Returns IExecution containing the instance and the results of the call */ export interface IEngineOptions { startNodeId?: any; noWait?: boolean; recover?: boolean; [otherOptions: string]: unknown; } export interface IAPIEngine { /** start a new Instance of specified model @param {String} modelName - name of the model to start. @param {ISecureUser} user - user object {} */ start(modelName: any, data: {}, user: ISecureUser, options?: IEngineOptions): Promise; /** continue with the execution of a particular item that is in a wait state, typically a user task */ invoke(query: any, data: {}, user?: ISecureUser, options?: IEngineOptions): Promise; /** provide assignment data to a user task Also, updates item data */ assign(query: any, data: any, assignment: any, user?: ISecureUser, options?: IEngineOptions): Promise; /** throw a message with an id, system will identify receiving item */ throwMessage(messageId: any, data: any, messageMatchingKey: any, user?: ISecureUser, options?: IEngineOptions): Promise; /** throw a signal with an id, system will identify receiving item(s) */ throwSignal(signalId: any, data: any, messageMatchingKey: any, user?: ISecureUser, options?: IEngineOptions): Promise; /** start a second event node (in a subprocess) for a running instance */ startEvent(query: any, elementId: any, data: {}, user?: ISecureUser, options?: IEngineOptions): Promise; /** * * restarting an already completed instance at a particular node * this function requires `dataStore.enableSavePoints` to be true in configuration.ts * this add a savePoint for each item, allowing you to select that item to restore it * * * @param itemQuery - Query to find a single item * @param inputData * */ restart(itemQuery: any, data: any, userName: any, options?: any): Promise; /** * upgrade running instances with the latest revised bpmn model * default behaviour is that running instances will retain the model at start * However, this routine will upgrade already started instances with the revised model * * @param model Model Name * @param afterNodeIds list of nodeIds, to check if already started, don't apply the upgrade * */ upgrade(model: string, afterNodeIds: string[]): Promise; } export interface IAPIData { /** returns list of `User Tasks` that the user has access to to get assigned tasks for a user ```ts api.data.getPendingUserTasks({"item.assignee":user.userName}); ``` */ getPendingUserTasks(query: any, user: ISecureUser): Promise; /** returns list of `item`s */ findItems(query: any, user?: ISecureUser): Promise; findItem(query: any, user?: ISecureUser): Promise; /** returns list of `instance`s */ findInstances(query: any, user?: ISecureUser, options?: any): Promise; /** deletes the `instance`s */ deleteInstances(query: any, user?: ISecureUser): any; } /** common parameters: - query: MongoDB query to locate the target instance or item - user: an instance of ISecureUser object */ export interface IAPIModel { /** retrieve Model data */ get(query: any, user: ISecureUser): Promise; /** save a model to the modelStore */ save(name: any, source: any, svg: any, user?: ISecureUser): any; /** list all models authorized to the user */ list(query: any, user: ISecureUser): Promise; /** returns Model Events (like timers) for authorized to the user and based on specifid query */ findEvents(query: any, user?: ISecureUser): any; /** returns Model Start Events for authorized to the user and based on specifid query */ findStartEvents(query: any, user?: ISecureUser): any; /** delete the specified model */ delete(name: any, user?: ISecureUser): any; /** delete the specified model */ rename(name: any, newName: any, user?: ISecureUser): any; /** returns the bpmn (xml) for the model */ getSource(name: any, user?: ISecureUser): any; /** load a model */ load(name: any, user?: ISecureUser): any; /** Exports the specified models based on a query to a folder */ export(query: any, folder: any, user?: ISecureUser): any; } declare class APIEngine extends APIComponent implements IAPIEngine { start(name: any, data?: {}, user?: ISecureUser, options?: IEngineOptions): Promise; invoke(query: any, data?: {}, user?: ISecureUser, options?: IEngineOptions): Promise; assign(query: any, data: any, assignment: any, user?: ISecureUser, options?: IEngineOptions): Promise; throwMessage(messageId: any, data: any, messageMatchingKey: any, user?: ISecureUser, options?: IEngineOptions): Promise; throwSignal(signalId: any, data: any, messageMatchingKey: any, user?: ISecureUser, options?: IEngineOptions): Promise; startEvent(query: any, elementId: any, data?: {}, user?: ISecureUser, options?: IEngineOptions): Promise; restart(itemQuery: any, data: any, user: ISecureUser, options?: {}): Promise; upgrade(model: any, afterNodeIds: any): Promise; } declare class APIData extends APIComponent { getPendingUserTasks(query: any, user?: ISecureUser): Promise; findItems(query: any, user?: ISecureUser): Promise; findItem(query: any, user?: ISecureUser): Promise; findInstances(query: any, user?: ISecureUser, options?: any): Promise; deleteInstances(query: any, user?: ISecureUser): Promise; } declare class APIModel extends APIComponent { get(query: any, user: ISecureUser): Promise; save(name: any, source: any, svg: any, user?: ISecureUser): Promise; list(query: any, user?: ISecureUser): Promise; findEvents(query: any, user?: ISecureUser): Promise; findStartEvents(query: any, user?: ISecureUser): Promise; delete(name: any, user?: ISecureUser): Promise; rename(name: any, newName: any, user?: ISecureUser): Promise; getSource(name: any, user?: ISecureUser): Promise; load(name: any, user?: ISecureUser): Promise; export(query: any, folder: any, user?: ISecureUser): Promise; } export { BPMNAPI, APIEngine, APIData, APIModel };