@5minds/processcube_app_sdk 0.0.1-develop-40adb2-lkb16tf4 → 0.0.1-develop-07be65-llkhfb2r
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
CHANGED
package/server/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var C=(e,s)=>{for(var t in s)u(e,t,{get:s[t],enumerable:!0})},D=(e,s,t,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of S(s))!M.call(e,o)&&o!==t&&u(e,o,{get:()=>s[o],enumerable:!(r=x(s,o))||r.enumerable});return e};var q=e=>D(u({},"__esModule",{value:!0}),e);var z={};C(z,{finishUserTask:()=>j,finishUserTaskAndGetNext:()=>b,getActiveProcessInstances:()=>J,getAssignedUserTasksByIdentity:()=>_,getIdentity:()=>G,getReservedUserTasksByIdentity:()=>W,getUserTasks:()=>p,getWaitingUserTaskByFlowNodeInstanceId:()=>m,getWaitingUserTasks:()=>B,getWaitingUserTasksByCorrelationId:()=>A,getWaitingUserTasksByFlowNodeId:()=>v,getWaitingUserTasksByProcessInstanceId:()=>R,hardNavigate:()=>O,navigateToUrl:()=>$,startProcess:()=>L,waitForUserTask:()=>E});module.exports=q(z);var fe=require("only-server");var a=require("@5minds/processcube_engine_client");var f=require("@5minds/processcube_engine_client"),n=new f.EngineClient(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function E(e={}){let{processInstanceId:s,flowNodeId:t}=e;return new Promise(async(r,o)=>{let d=await n.userTasks.onUserTaskWaiting(async i=>{let F=i.flowNodeInstanceId===void 0,U=s!==void 0&&i.processInstanceId!==s,P=t!==void 0&&i.flowNodeId!==t,h=s!==void 0&&t!==void 0&&i.processInstanceId!==s&&i.flowNodeId!==t;if(F||U||P||h)return;let I=await m(i.flowNodeInstanceId);return n.notification.removeSubscription(d),I===null?o(new Error(`UserTask with instance ID "${i.flowNodeInstanceId}" does not exist.`)):r(I)}),l=(await p({processInstanceId:s,flowNodeId:t,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended}))?.[0];l&&(n.notification.removeSubscription(d),r(l))})}async function b(e,s,t){await n.userTasks.finishUserTask(e,s);let r=await n.userTasks.query({flowNodeId:t,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended});return r.userTasks.length===0?null:r.userTasks[0]}async function p(...e){let s=await n.userTasks.query(...e);return s.userTasks.length===0?null:s.userTasks}async function B(e){let s=await n.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.userTasks.length===0?null:s.userTasks}async function R(e,s){let t=await n.userTasks.query({processInstanceId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function v(e,s){let t=await n.userTasks.query({flowNodeId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function m(e,s){let t=await n.userTasks.query({flowNodeInstanceId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{...s,limit:1});return t.userTasks.length===0?null:t.userTasks[0]}async function A(e,s){let t=await n.userTasks.query({correlationId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function W(e,s){let r=(await n.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(o=>o.actualOwnerId===e.userId);return r.length===0?null:r}async function _(e,s){let r=(await n.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(o=>o.assignedUserIds?.includes(e.userId));return r.length===0?null:r}var c=require("next/headers"),T=require("next-auth/jwt");async function G(){let e=await(0,T.getToken)({req:{cookies:(0,c.cookies)(),headers:(0,c.headers)()}});if(!e?.accessToken||!e?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:e?.accessToken,userId:e?.sub}}var k=require("@5minds/processcube_engine_client");async function J(e){let s=await n.processInstances.query({state:k.DataModels.ProcessInstances.ProcessInstanceState.running},e);return s.processInstances.length===0?null:s.processInstances}var w=require("next/cache"),y=require("next/navigation");async function O(e,s){(0,w.revalidatePath)(e),(0,y.redirect)(e,s)}async function L(...e){return await n.processModels.startProcessInstance(...e)}async function j(...e){await n.userTasks.finishUserTask(...e)}var g=require("next/cache"),N=require("next/navigation");function $(e){(0,g.revalidatePath)(e),(0,N.redirect)(e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getAssignedUserTasksByIdentity,getIdentity,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByCorrelationId,getWaitingUserTasksByFlowNodeId,getWaitingUserTasksByProcessInstanceId,hardNavigate,navigateToUrl,startProcess,waitForUserTask});
|
package/server/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"only-server";import{DataModels as
|
|
1
|
+
import"only-server";import{DataModels as o}from"@5minds/processcube_engine_client";import{EngineClient as m}from"@5minds/processcube_engine_client";var n=new m(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function q(e={}){let{processInstanceId:s,flowNodeId:t}=e;return new Promise(async(r,i)=>{let c=await n.userTasks.onUserTaskWaiting(async a=>{let l=a.flowNodeInstanceId===void 0,I=s!==void 0&&a.processInstanceId!==s,f=t!==void 0&&a.flowNodeId!==t,p=s!==void 0&&t!==void 0&&a.processInstanceId!==s&&a.flowNodeId!==t;if(l||I||f||p)return;let d=await k(a.flowNodeInstanceId);return n.notification.removeSubscription(c),d===null?i(new Error(`UserTask with instance ID "${a.flowNodeInstanceId}" does not exist.`)):r(d)}),u=(await T({processInstanceId:s,flowNodeId:t,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended}))?.[0];u&&(n.notification.removeSubscription(c),r(u))})}async function E(e,s,t){await n.userTasks.finishUserTask(e,s);let r=await n.userTasks.query({flowNodeId:t,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended});return r.userTasks.length===0?null:r.userTasks[0]}async function T(...e){let s=await n.userTasks.query(...e);return s.userTasks.length===0?null:s.userTasks}async function b(e){let s=await n.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.userTasks.length===0?null:s.userTasks}async function B(e,s){let t=await n.userTasks.query({processInstanceId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function R(e,s){let t=await n.userTasks.query({flowNodeId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function k(e,s){let t=await n.userTasks.query({flowNodeInstanceId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},{...s,limit:1});return t.userTasks.length===0?null:t.userTasks[0]}async function v(e,s){let t=await n.userTasks.query({correlationId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length===0?null:t.userTasks}async function A(e,s){let r=(await n.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(i=>i.actualOwnerId===e.userId);return r.length===0?null:r}async function W(e,s){let r=(await n.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(i=>i.assignedUserIds?.includes(e.userId));return r.length===0?null:r}import{cookies as w,headers as y}from"next/headers";import{getToken as g}from"next-auth/jwt";async function O(){let e=await g({req:{cookies:w(),headers:y()}});if(!e?.accessToken||!e?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:e?.accessToken,userId:e?.sub}}import{DataModels as N}from"@5minds/processcube_engine_client";async function z(e){let s=await n.processInstances.query({state:N.ProcessInstances.ProcessInstanceState.running},e);return s.processInstances.length===0?null:s.processInstances}import{revalidatePath as F}from"next/cache";import{redirect as U}from"next/navigation";async function ee(e,s){F(e),U(e,s)}async function ne(...e){return await n.processModels.startProcessInstance(...e)}async function re(...e){await n.userTasks.finishUserTask(...e)}import{revalidatePath as P}from"next/cache";import{redirect as h}from"next/navigation";function ce(e){P(e),h(e)}export{re as finishUserTask,E as finishUserTaskAndGetNext,z as getActiveProcessInstances,W as getAssignedUserTasksByIdentity,O as getIdentity,A as getReservedUserTasksByIdentity,T as getUserTasks,k as getWaitingUserTaskByFlowNodeInstanceId,b as getWaitingUserTasks,v as getWaitingUserTasksByCorrelationId,R as getWaitingUserTasksByFlowNodeId,B as getWaitingUserTasksByProcessInstanceId,ee as hardNavigate,ce as navigateToUrl,ne as startProcess,q as waitForUserTask};
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { DataModels } from '@5minds/processcube_engine_client';
|
|
2
|
-
|
|
2
|
+
import { Client } from './internal/EngineClient';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param options The query options of {@link Client.processInstances.query}
|
|
6
|
+
* @returns {DataModels.ProcessInstances.ProcessInstance[] | null}
|
|
7
|
+
*/
|
|
8
|
+
export declare function getActiveProcessInstances(options?: Parameters<typeof Client.processInstances.query>[1]): Promise<DataModels.ProcessInstances.ProcessInstance[] | null>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DataModels } from '@5minds/processcube_engine_client';
|
|
2
2
|
import { Client } from './internal/EngineClient';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* If there is no UserTask waiting, this function will wait for the next UserTask to be created.
|
|
5
|
+
* If there is already a UserTask waiting, this function will return it.
|
|
5
6
|
*
|
|
6
7
|
* @param filterBy Additional filter options
|
|
7
8
|
* @param filterBy.processInstanceId The ID of the ProcessInstance the UserTask belongs to
|
|
@@ -13,36 +14,44 @@ export declare function waitForUserTask(filterBy?: {
|
|
|
13
14
|
flowNodeId?: string;
|
|
14
15
|
}): Promise<DataModels.FlowNodeInstances.UserTaskInstance>;
|
|
15
16
|
export declare function finishUserTaskAndGetNext(flowNodeInstanceId: string, result: any, flowNodeId: string): Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>;
|
|
16
|
-
export declare function getUserTasks(...args: Parameters<typeof Client.userTasks.query>): Promise<DataModels.FlowNodeInstances.
|
|
17
|
+
export declare function getUserTasks(...args: Parameters<typeof Client.userTasks.query>): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
17
18
|
/**
|
|
18
19
|
*
|
|
19
|
-
* @param options Additional options for the query e.g.
|
|
20
|
-
* @returns DataModels.FlowNodeInstances.
|
|
20
|
+
* @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
|
|
21
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
|
|
21
22
|
*/
|
|
22
23
|
export declare function getWaitingUserTasks(options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param processInstanceId The Process Instance ID
|
|
27
|
+
* @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
|
|
28
|
+
* @returns {Promise<Array<DataModels.FlowNodeInstances.UserTaskInstance> | null>}
|
|
29
|
+
*/
|
|
30
|
+
export declare function getWaitingUserTasksByProcessInstanceId(processInstanceId: string | Array<string>, options?: Parameters<typeof Client.userTasks.query>[1]): Promise<Array<DataModels.FlowNodeInstances.UserTaskInstance> | null>;
|
|
23
31
|
/**
|
|
24
32
|
*
|
|
25
33
|
* @param flowNodeId The UserTasks ID (BPMN)
|
|
26
|
-
* @param options Additional options for the query e.g.
|
|
27
|
-
* @returns DataModels.FlowNodeInstances.
|
|
34
|
+
* @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
|
|
35
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
|
|
28
36
|
*/
|
|
29
|
-
export declare function getWaitingUserTasksByFlowNodeId(flowNodeId: string | string[], options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.
|
|
37
|
+
export declare function getWaitingUserTasksByFlowNodeId(flowNodeId: string | string[], options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
30
38
|
/**
|
|
31
39
|
*
|
|
32
40
|
* @param flowNodeInstanceId The UserTask Instance ID
|
|
33
|
-
* @param options Additional options for the query e.g.
|
|
34
|
-
* @returns DataModels.FlowNodeInstances.UserTaskInstance | null
|
|
41
|
+
* @param options Additional options for the query e.g. {@link DataModels.Iam.Identity}
|
|
42
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>}
|
|
35
43
|
*/
|
|
36
44
|
export declare function getWaitingUserTaskByFlowNodeInstanceId(flowNodeInstanceId: string, options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>;
|
|
37
45
|
/**
|
|
38
46
|
* @param correlationId The Correlation ID
|
|
39
|
-
* @
|
|
47
|
+
* @param options Additional options for the query e.g. {@link DataModels.Iam.Identity}
|
|
48
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
|
|
40
49
|
*/
|
|
41
|
-
export declare function
|
|
50
|
+
export declare function getWaitingUserTasksByCorrelationId(correlationId: string, options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
|
|
42
51
|
/**
|
|
43
52
|
* @param identity The identity of the user
|
|
44
|
-
* @param options Additional options for the query e.g.
|
|
45
|
-
* @returns DataModels.FlowNodeInstances.UserTaskInstance[] | null
|
|
53
|
+
* @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
|
|
54
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
|
|
46
55
|
*/
|
|
47
56
|
export declare function getReservedUserTasksByIdentity(identity: DataModels.Iam.Identity, options?: {
|
|
48
57
|
offset?: number;
|
|
@@ -52,8 +61,8 @@ export declare function getReservedUserTasksByIdentity(identity: DataModels.Iam.
|
|
|
52
61
|
/**
|
|
53
62
|
*
|
|
54
63
|
* @param identity The identity of the user
|
|
55
|
-
* @param options Additional options for the query e.g.
|
|
56
|
-
* @returns DataModels.FlowNodeInstances.UserTaskInstance[] | null
|
|
64
|
+
* @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
|
|
65
|
+
* @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
|
|
57
66
|
*/
|
|
58
67
|
export declare function getAssignedUserTasksByIdentity(identity: DataModels.Iam.Identity, options?: {
|
|
59
68
|
offset?: number;
|