@5minds/processcube_app_sdk 0.0.1-develop-29e4c9-lk2mxgh1 → 0.0.1-develop-0d2257-lkb0csg3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/index.cjs +1 -1
- package/server/index.mjs +1 -1
- package/server/lib/UserTaskFunctions.d.ts +24 -2
package/package.json
CHANGED
package/server/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var F=(e,s)=>{for(var n in s)c(e,n,{get:s[n],enumerable:!0})},x=(e,s,n,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of N(s))!U.call(e,o)&&o!==n&&c(e,o,{get:()=>s[o],enumerable:!(r=k(s,o))||r.enumerable});return e};var C=e=>x(c({},"__esModule",{value:!0}),e);var v={};F(v,{finishUserTask:()=>_,finishUserTaskAndGetNext:()=>P,getActiveProcessInstances:()=>R,getAssignedUserTasksByIdentity:()=>D,getReservedUserTasksByIdentity:()=>B,getUserTasks:()=>h,getWaitingUserTaskByCorrelationId:()=>q,getWaitingUserTaskByFlowNodeInstanceId:()=>l,getWaitingUserTasks:()=>E,getWaitingUserTasksByFlowNodeId:()=>M,hardNavigate:()=>b,startProcess:()=>G,waitForUserTask:()=>S});module.exports=C(v);var ee=require("only-server");var a=require("@5minds/processcube_engine_client");var u=require("@5minds/processcube_engine_client"),t=new u.EngineClient(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function S(e={}){let{processInstanceId:s,flowNodeId:n}=e;return new Promise(async(r,o)=>{let y=await t.userTasks.onUserTaskWaiting(async i=>{let w=i.flowNodeInstanceId===void 0,T=s!==void 0&&i.processInstanceId!==s,g=n!==void 0&&i.flowNodeId!==n,m=s!==void 0&&n!==void 0&&i.processInstanceId!==s&&i.flowNodeId!==n;if(w||T||g||m)return;let d=await l(i.flowNodeInstanceId);return t.notification.removeSubscription(y),d===null?o(new Error(`UserTask with instance ID "${i.flowNodeInstanceId}" does not exist.`)):r(d)})})}async function P(e,s,n){await t.userTasks.finishUserTask(e,s);let r=await t.userTasks.query({flowNodeId:n,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended});return r.totalCount>0?r.userTasks[0]:null}async function h(...e){return t.userTasks.query(...e)}async function E(e){let s=await t.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.totalCount===0?null:s.userTasks}async function M(e,s){return t.userTasks.query({flowNodeId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s)}async function l(e,s){let n=await t.userTasks.query({flowNodeInstanceId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return n.userTasks.length?n.userTasks[0]:null}async function q(e){let s=await t.userTasks.query({correlationId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended});return s.totalCount==0?null:s.userTasks[0]}async function B(e,s){let r=(await t.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(o=>o.actualOwnerId===e.userId);return r.length?r:null}async function D(e,s){let r=(await t.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(o=>o.assignedUserIds?.includes(e.userId));return r.length?r:null}var I=require("@5minds/processcube_engine_client");async function R(){let e=await t.processInstances.query({state:I.DataModels.ProcessInstances.ProcessInstanceState.running});return e.totalCount===0?null:e.processInstances}var f=require("next/cache"),p=require("next/navigation");async function b(e,s){(0,f.revalidatePath)(e),(0,p.redirect)(e,s)}async function G(...e){return await t.processModels.startProcessInstance(...e)}async function _(...e){await t.userTasks.finishUserTask(...e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getAssignedUserTasksByIdentity,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByCorrelationId,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByFlowNodeId,hardNavigate,startProcess,waitForUserTask});
|
package/server/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"only-server";import{DataModels as
|
|
1
|
+
import"only-server";import{DataModels as a}from"@5minds/processcube_engine_client";import{EngineClient as p}from"@5minds/processcube_engine_client";var t=new p(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function F(e={}){let{processInstanceId:s,flowNodeId:n}=e;return new Promise(async(r,i)=>{let d=await t.userTasks.onUserTaskWaiting(async o=>{let u=o.flowNodeInstanceId===void 0,l=s!==void 0&&o.processInstanceId!==s,I=n!==void 0&&o.flowNodeId!==n,f=s!==void 0&&n!==void 0&&o.processInstanceId!==s&&o.flowNodeId!==n;if(u||l||I||f)return;let c=await y(o.flowNodeInstanceId);return t.notification.removeSubscription(d),c===null?i(new Error(`UserTask with instance ID "${o.flowNodeInstanceId}" does not exist.`)):r(c)})})}async function x(e,s,n){await t.userTasks.finishUserTask(e,s);let r=await t.userTasks.query({flowNodeId:n,state:a.FlowNodeInstances.FlowNodeInstanceState.suspended});return r.totalCount>0?r.userTasks[0]:null}async function C(...e){return t.userTasks.query(...e)}async function S(e){let s=await t.userTasks.query({state:a.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.totalCount===0?null:s.userTasks}async function P(e,s){return t.userTasks.query({flowNodeId:e,state:a.FlowNodeInstances.FlowNodeInstanceState.suspended},s)}async function y(e,s){let n=await t.userTasks.query({flowNodeInstanceId:e,state:a.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return n.userTasks.length?n.userTasks[0]:null}async function h(e){let s=await t.userTasks.query({correlationId:e,state:a.FlowNodeInstances.FlowNodeInstanceState.suspended});return s.totalCount==0?null:s.userTasks[0]}async function E(e,s){let r=(await t.userTasks.query({state:a.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(i=>i.actualOwnerId===e.userId);return r.length?r:null}async function M(e,s){let r=(await t.userTasks.query({state:a.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(i=>i.assignedUserIds?.includes(e.userId));return r.length?r:null}import{DataModels as w}from"@5minds/processcube_engine_client";async function R(){let e=await t.processInstances.query({state:w.ProcessInstances.ProcessInstanceState.running});return e.totalCount===0?null:e.processInstances}import{revalidatePath as T}from"next/cache";import{redirect as g}from"next/navigation";async function O(e,s){T(e),g(e,s)}async function $(...e){return await t.processModels.startProcessInstance(...e)}async function j(...e){await t.userTasks.finishUserTask(...e)}export{j as finishUserTask,x as finishUserTaskAndGetNext,R as getActiveProcessInstances,M as getAssignedUserTasksByIdentity,E as getReservedUserTasksByIdentity,C as getUserTasks,h as getWaitingUserTaskByCorrelationId,y as getWaitingUserTaskByFlowNodeInstanceId,S as getWaitingUserTasks,P as getWaitingUserTasksByFlowNodeId,O as hardNavigate,$ as startProcess,F as waitForUserTask};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { DataModels } from '@5minds/processcube_engine_client';
|
|
2
2
|
import { Client } from './internal/EngineClient';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Waits for a UserTask to be created and returns it.
|
|
5
|
+
*
|
|
6
|
+
* @param filterBy Additional filter options
|
|
7
|
+
* @param filterBy.processInstanceId The ID of the ProcessInstance the UserTask belongs to
|
|
8
|
+
* @param filterBy.flowNodeId The UserTask FlowNode ID (BPMN)
|
|
9
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance>} The created UserTask.
|
|
10
|
+
*/
|
|
11
|
+
export declare function waitForUserTask(filterBy?: {
|
|
12
|
+
processInstanceId?: string;
|
|
13
|
+
flowNodeId?: string;
|
|
14
|
+
}): Promise<DataModels.FlowNodeInstances.UserTaskInstance>;
|
|
4
15
|
export declare function finishUserTaskAndGetNext(flowNodeInstanceId: string, result: any, flowNodeId: string): Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>;
|
|
5
16
|
export declare function getUserTasks(...args: Parameters<typeof Client.userTasks.query>): Promise<DataModels.FlowNodeInstances.UserTaskList>;
|
|
6
17
|
/**
|
|
@@ -8,7 +19,7 @@ export declare function getUserTasks(...args: Parameters<typeof Client.userTasks
|
|
|
8
19
|
* @param options Additional options for the query e.g. `identity` or `sortSettings`
|
|
9
20
|
* @returns DataModels.FlowNodeInstances.UserTaskList
|
|
10
21
|
*/
|
|
11
|
-
export declare function getWaitingUserTasks(options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.
|
|
22
|
+
export declare function getWaitingUserTasks(options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
12
23
|
/**
|
|
13
24
|
*
|
|
14
25
|
* @param flowNodeId The UserTasks ID (BPMN)
|
|
@@ -38,3 +49,14 @@ export declare function getReservedUserTasksByIdentity(identity: DataModels.Iam.
|
|
|
38
49
|
limit?: number;
|
|
39
50
|
sortSettings?: DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings;
|
|
40
51
|
}): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @param identity The identity of the user
|
|
55
|
+
* @param options Additional options for the query e.g. `sortSettings`
|
|
56
|
+
* @returns DataModels.FlowNodeInstances.UserTaskInstance[] | null
|
|
57
|
+
*/
|
|
58
|
+
export declare function getAssignedUserTasksByIdentity(identity: DataModels.Iam.Identity, options?: {
|
|
59
|
+
offset?: number;
|
|
60
|
+
limit?: number;
|
|
61
|
+
sortSettings?: DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings;
|
|
62
|
+
}): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|