UNPKG

@5minds/processcube_app_sdk

Version:
109 lines (108 loc) 5.59 kB
import { DataModels } from '@5minds/processcube_engine_client'; import type { Identity, UserTaskResult } from '@5minds/processcube_engine_sdk'; import { UserTaskInstance, UserTaskList } from '../../common'; import { Client } from './internal/EngineClient'; type OptionsWithBoolIdentity = Omit<Parameters<typeof Client.userTasks.query>[1], 'identity'> & { identity?: Identity | boolean; }; /** * If there is no UserTask waiting, this function will wait for the next UserTask to be created. * If there is already a UserTask waiting, this function will return it. * * @param filterBy Additional filter options * @param filterBy.correlationId The ID of the correlation which contains the UserTask * @param filterBy.processInstanceId The ID of the ProcessInstance the UserTask belongs to * @param filterBy.flowNodeId The UserTask FlowNode ID (BPMN) * @param identity The Identity of the User or true if the implied identity should be used * @returns {Promise<UserTaskInstance>} The created UserTask. */ export declare function waitForUserTask(filterBy?: { correlationId?: string; processInstanceId?: string; flowNodeId?: string; }, identity?: Identity | boolean): Promise<UserTaskInstance>; /** * The FilterBy object can be used to filter the result set of the finishUserTaskAndGetNext function. * The next UserTask will be returned based on the given filter options. */ export type FilterBy = { processInstanceId?: string; flowNodeId?: string; correlationId?: string; }; /** * Finishes the UserTask with the given flowNodeInstanceId and returns the next UserTask. * The next UserTask will be returned based on the given filter options. * * @param flowNodeInstanceId The ID of the flowNodeInstance to finish * @param FilterBy Additional filter options for the next UserTask * @param result The result of the UserTask * @param identity The Identity of the User or true if the implied identity should be used * @returns {Promise<UserTaskInstance>} The next UserTask based on the given filter options. */ export declare function finishUserTaskAndGetNext(flowNodeInstanceId: string, filterBy?: FilterBy, result?: UserTaskResult, identity?: Identity | boolean): Promise<UserTaskInstance | null>; export declare function getUserTasks(query: DataModels.FlowNodeInstances.UserTaskQuery, options?: OptionsWithBoolIdentity): Promise<UserTaskList>; /** * * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings} * @returns {Promise<UserTaskList>} */ export declare function getWaitingUserTasks(options?: OptionsWithBoolIdentity): Promise<UserTaskList>; /** * * @param processInstanceId The Process Instance ID * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings} * @returns {Promise<UserTaskList>} */ export declare function getWaitingUserTasksByProcessInstanceId(processInstanceId: string | Array<string>, options?: OptionsWithBoolIdentity): Promise<UserTaskList>; /** * * @param flowNodeId The UserTasks ID (BPMN) * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings} * @returns {Promise<UserTaskList>} */ export declare function getWaitingUserTasksByFlowNodeId(flowNodeId: string | string[], options?: OptionsWithBoolIdentity): Promise<UserTaskList>; /** * * @param flowNodeInstanceId The UserTask Instance ID * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} * @returns {Promise<UserTaskInstance | null>} */ export declare function getWaitingUserTaskByFlowNodeInstanceId(flowNodeInstanceId: string, options?: OptionsWithBoolIdentity): Promise<UserTaskInstance | null>; /** * @param correlationId The Correlation ID * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} * @returns {Promise<UserTaskList>} */ export declare function getWaitingUserTasksByCorrelationId(correlationId: string, options?: OptionsWithBoolIdentity): Promise<UserTaskList>; /** * @param identity The identity of the user * @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings} * @returns {Promise<UserTaskList>} */ export declare function getReservedUserTasksByIdentity(identity?: Identity, options?: { offset?: number; limit?: number; sortSettings?: DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings; }): Promise<UserTaskList>; /** * * @param identity The identity of the user * @param flowNodeInstanceId The instance id of the flowNode that should be reserved * @param actualOwnerId The user id of the process instance owner * @returns {Promise<void>} */ export declare function reserveUserTask(identity: DataModels.Iam.Identity, flowNodeInstanceId: string, actualOwnerId?: string): Promise<void>; export declare function cancelReservedUserTask(identity: DataModels.Iam.Identity, flowNodeInstanceId: string): Promise<void>; /** * * @param identity The identity of the user * @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings} * @returns {Promise<UserTaskList>} */ export declare function getAssignedUserTasksByIdentity(identity?: Identity, options?: { offset?: number; limit?: number; sortSettings?: DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings; }): Promise<UserTaskList>; export {};