@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/processcube_app_sdk",
3
- "version": "0.0.1-develop-29e4c9-lk2mxgh1",
3
+ "version": "0.0.1-develop-0d2257-lkb0csg3",
4
4
  "description": "The SDK for ProcessCube Apps",
5
5
  "type": "module",
6
6
  "main": "common/index.cjs",
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var w=(e,s)=>{for(var t in s)c(e,t,{get:s[t],enumerable:!0})},g=(e,s,t,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of k(s))!m.call(e,o)&&o!==t&&c(e,o,{get:()=>s[o],enumerable:!(r=T(s,o))||r.enumerable});return e};var N=e=>g(c({},"__esModule",{value:!0}),e);var D={};w(D,{finishUserTask:()=>M,finishUserTaskAndGetNext:()=>U,getActiveProcessInstances:()=>q,getReservedUserTasksByIdentity:()=>h,getUserTasks:()=>P,getWaitingUserTaskByCorrelationId:()=>S,getWaitingUserTaskByFlowNodeInstanceId:()=>p,getWaitingUserTasks:()=>F,getWaitingUserTasksByFlowNodeId:()=>E,hardNavigate:()=>R,startProcess:()=>B,waitForUserTaskByProcessInstanceId:()=>x});module.exports=N(D);var V=require("only-server");var a=require("@5minds/processcube_engine_client");var d=require("@5minds/processcube_engine_client"),n=new d.EngineClient(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function C(e,s){let t=await n.userTasks.query({processInstanceId:e,flowNodeId:s});return t.totalCount==0?null:t.userTasks[0]}async function x(e,s){return new Promise(async(t,r)=>{let o=n.userTasks.onUserTaskWaiting(async i=>{if(i.processInstanceId===e&&i.flowNodeId===s&&i.flowNodeInstanceId!=null){let l=await p(i.flowNodeInstanceId);return l!=null?t(l):r(new Error(`UserTask with instance ID "${i.flowNodeInstanceId}" does not exist.`))}}),u=await C(e,s);u&&t(u),await o})}async function U(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.totalCount>0?r.userTasks[0]:null}async function P(...e){return n.userTasks.query(...e)}async function F(e){return n.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function E(e,s){return n.userTasks.query({flowNodeId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s)}async function p(e,s){let t=await n.userTasks.query({flowNodeInstanceId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return t.userTasks.length?t.userTasks[0]:null}async function S(e){let s=await n.userTasks.query({correlationId:e,state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended});return s.totalCount==0?null:s.userTasks[0]}async function h(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?r:null}var f=require("@5minds/processcube_engine_client");async function q(){let e=await n.processInstances.query({state:f.DataModels.ProcessInstances.ProcessInstanceState.running});return e.totalCount===0?null:e.processInstances}var y=require("next/cache"),I=require("next/navigation");async function R(e,s){(0,y.revalidatePath)(e),(0,I.redirect)(e,s)}async function B(...e){return await n.processModels.startProcessInstance(...e)}async function M(...e){await n.userTasks.finishUserTask(...e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByCorrelationId,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByFlowNodeId,hardNavigate,startProcess,waitForUserTaskByProcessInstanceId});
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 o}from"@5minds/processcube_engine_client";import{EngineClient as l}from"@5minds/processcube_engine_client";var t=new l(process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560");async function d(e,s){let n=await t.userTasks.query({processInstanceId:e,flowNodeId:s});return n.totalCount==0?null:n.userTasks[0]}async function g(e,s){return new Promise(async(n,r)=>{let i=t.userTasks.onUserTaskWaiting(async a=>{if(a.processInstanceId===e&&a.flowNodeId===s&&a.flowNodeInstanceId!=null){let u=await p(a.flowNodeInstanceId);return u!=null?n(u):r(new Error(`UserTask with instance ID "${a.flowNodeInstanceId}" does not exist.`))}}),c=await d(e,s);c&&n(c),await i})}async function N(e,s,n){await t.userTasks.finishUserTask(e,s);let r=await t.userTasks.query({flowNodeId:n,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended});return r.totalCount>0?r.userTasks[0]:null}async function C(...e){return t.userTasks.query(...e)}async function x(e){return t.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function U(e,s){return t.userTasks.query({flowNodeId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},s)}async function p(e,s){let n=await t.userTasks.query({flowNodeInstanceId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},s);return n.userTasks.length?n.userTasks[0]:null}async function P(e){let s=await t.userTasks.query({correlationId:e,state:o.FlowNodeInstances.FlowNodeInstanceState.suspended});return s.totalCount==0?null:s.userTasks[0]}async function F(e,s){let r=(await t.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...s})).userTasks.filter(i=>i.actualOwnerId===e.userId);return r.length?r:null}import{DataModels as f}from"@5minds/processcube_engine_client";async function q(){let e=await t.processInstances.query({state:f.ProcessInstances.ProcessInstanceState.running});return e.totalCount===0?null:e.processInstances}import{revalidatePath as y}from"next/cache";import{redirect as I}from"next/navigation";async function b(e,s){y(e),I(e,s)}async function v(...e){return await t.processModels.startProcessInstance(...e)}async function A(...e){await t.userTasks.finishUserTask(...e)}export{A as finishUserTask,N as finishUserTaskAndGetNext,q as getActiveProcessInstances,F as getReservedUserTasksByIdentity,C as getUserTasks,P as getWaitingUserTaskByCorrelationId,p as getWaitingUserTaskByFlowNodeInstanceId,x as getWaitingUserTasks,U as getWaitingUserTasksByFlowNodeId,b as hardNavigate,v as startProcess,g as waitForUserTaskByProcessInstanceId};
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
- export declare function waitForUserTaskByProcessInstanceId(processInstanceId: string, flowNodeId: string): Promise<DataModels.FlowNodeInstances.UserTaskInstance>;
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.UserTaskList>;
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>;