@5minds/processcube_app_sdk 0.0.1-develop-0d2257-lkb0csg3 → 0.0.1-develop-e5b363-lki8hmms

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.
@@ -0,0 +1,23 @@
1
+ import { Session, CallbacksOptions } from 'next-auth';
2
+ import type { JWT } from 'next-auth/jwt';
3
+ /**
4
+ *
5
+ * @returns {Boolean} A boolean whether the user has the claim or not
6
+ */
7
+ export declare function hasClaim(claim: string): Promise<boolean>;
8
+ /**
9
+ *
10
+ * This function passes the {@link Account}'s {@link Account.access_token} and {@link Account.id_token} to the generated {@link JWT}.
11
+ *
12
+ * @param args The arguments of {@link CallbacksOptions.jwt}.
13
+ * @returns A {@link JWT}
14
+ */
15
+ export declare function authConfigJwtCallback(args: Parameters<CallbacksOptions['jwt']>[0]): Promise<JWT>;
16
+ /**
17
+ *
18
+ * This function passes the {@link Account.access_token} Claims to the current {@link Session} user.
19
+ *
20
+ * @param args The arguments of {@link CallbacksOptions.session}.
21
+ * @returns A {@link JWT}
22
+ */
23
+ export declare function authConfigSessionCallback(args: Parameters<CallbacksOptions['session']>[0]): Promise<Session>;
package/common/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var f=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},d=(e,r,o,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of p(r))!a.call(e,t)&&t!==o&&i(e,t,{get:()=>r[t],enumerable:!(m=h(r,t))||m.enumerable});return e};var R=e=>d(i({},"__esModule",{value:!0}),e);var k={};f(k,{RemoteUserTask:()=>g});module.exports=R(k);var s=require("react/jsx-runtime");function g(e){return(0,s.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,s.jsx)("iframe",{width:"100%",height:"100%",src:e.url})})}0&&(module.exports={RemoteUserTask});
1
+ "use strict";var T=Object.create;var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var s in t)r(e,s,{get:t[s],enumerable:!0})},c=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!S.call(e,n)&&n!==s&&r(e,n,{get:()=>t[n],enumerable:!(o=g(t,n))||o.enumerable});return e};var y=(e,t,s)=>(s=e!=null?T(C(e)):{},c(t||!e||!e.__esModule?r(s,"default",{value:e,enumerable:!0}):s,e)),x=e=>c(r({},"__esModule",{value:!0}),e);var v={};b(v,{RemoteUserTask:()=>j,authConfigJwtCallback:()=>f,authConfigSessionCallback:()=>k,hasClaim:()=>P});module.exports=x(v);var a=require("react/jsx-runtime");function j(e){return(0,a.jsx)("div",{style:{width:"100%",height:"100%"},children:(0,a.jsx)("iframe",{width:"100%",height:"100%",src:e.url})})}var u=require("next-auth"),m=require("next-auth/react"),d=y(require("jwt-decode"),1);async function P(e){let t;return typeof window>"u"?t=(await(0,u.getServerSession)({callbacks:{jwt:f,session:k}}))?.user:t=(await(0,m.getSession)())?.user,!t||!t.claims?!1:t.claims[e]!=null}async function f(e){let{token:t,account:s}=e;return s&&(t.accessToken=s.access_token,t.idToken=s.id_token),t}async function k(e){let{session:t,token:s}=e,o=await l(s.accessToken),n=await l(s.idToken),p=Object.keys(n),i=Object.fromEntries(Object.entries(o).filter(([w,J])=>!p.includes(w)));return delete i.scope,delete i.jti,delete i.client_id,t.user.claims=i,t}async function l(e){return(0,d.default)(e)}0&&(module.exports={RemoteUserTask,authConfigJwtCallback,authConfigSessionCallback,hasClaim});
package/common/index.d.ts CHANGED
@@ -1 +1,23 @@
1
1
  export * from './components/RemoteUserTask';
2
+ export * from './functions/hasClaim';
3
+ import { DefaultSession } from 'next-auth';
4
+ declare module 'next-auth' {
5
+ /**
6
+ * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
7
+ */
8
+ interface Session {
9
+ user: {
10
+ /** The user's identity claims. */
11
+ claims?: Record<string, unknown>;
12
+ } & DefaultSession['user'];
13
+ }
14
+ }
15
+ declare module 'next-auth/jwt' {
16
+ /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
17
+ interface JWT {
18
+ /** OpenID Access Token */
19
+ accessToken?: string;
20
+ /** OpenID ID Token */
21
+ idToken?: string;
22
+ }
23
+ }
package/common/index.mjs CHANGED
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";function t(r){return e("div",{style:{width:"100%",height:"100%"},children:e("iframe",{width:"100%",height:"100%",src:r.url})})}export{t as RemoteUserTask};
1
+ import{jsx as o}from"react/jsx-runtime";function w(t){return o("div",{style:{width:"100%",height:"100%"},children:o("iframe",{width:"100%",height:"100%",src:t.url})})}import{getServerSession as u}from"next-auth";import{getSession as m}from"next-auth/react";import d from"jwt-decode";async function j(t){let e;return typeof window>"u"?e=(await u({callbacks:{jwt:f,session:k}}))?.user:e=(await m())?.user,!e||!e.claims?!1:e.claims[t]!=null}async function f(t){let{token:e,account:s}=t;return s&&(e.accessToken=s.access_token,e.idToken=s.id_token),e}async function k(t){let{session:e,token:s}=t,r=await i(s.accessToken),a=await i(s.idToken),c=Object.keys(a),n=Object.fromEntries(Object.entries(r).filter(([l,p])=>!c.includes(l)));return delete n.scope,delete n.jti,delete n.client_id,e.user.claims=n,e}async function i(t){return d(t)}export{w as RemoteUserTask,f as authConfigJwtCallback,k as authConfigSessionCallback,j as hasClaim};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/processcube_app_sdk",
3
- "version": "0.0.1-develop-0d2257-lkb0csg3",
3
+ "version": "0.0.1-develop-e5b363-lki8hmms",
4
4
  "description": "The SDK for ProcessCube Apps",
5
5
  "type": "module",
6
6
  "main": "common/index.cjs",
@@ -73,11 +73,13 @@
73
73
  },
74
74
  "peerDependencies": {
75
75
  "next": ">=13.4",
76
+ "next-auth": "^4.22.1",
76
77
  "react": ">=18.0.0"
77
78
  },
78
79
  "dependencies": {
79
80
  "@5minds/processcube_engine_client": "^4.3.1",
80
81
  "client-only": "^0.0.1",
82
+ "jwt-decode": "^3.1.2",
81
83
  "only-server": "^0.0.1"
82
84
  }
83
85
  }
package/server/index.cjs CHANGED
@@ -1 +1 @@
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});
1
+ "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var S=(e,s)=>{for(var t in s)u(e,t,{get:s[t],enumerable:!0})},M=(e,s,t,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of x(s))!P.call(e,o)&&o!==t&&u(e,o,{get:()=>s[o],enumerable:!(r=h(s,o))||r.enumerable});return e};var C=e=>M(u({},"__esModule",{value:!0}),e);var O={};S(O,{finishUserTask:()=>J,finishUserTaskAndGetNext:()=>E,getActiveProcessInstances:()=>A,getAssignedUserTasksByIdentity:()=>_,getIdentity:()=>W,getReservedUserTasksByIdentity:()=>R,getUserTasks:()=>p,getWaitingUserTaskByFlowNodeInstanceId:()=>m,getWaitingUserTasks:()=>q,getWaitingUserTasksByCorrelationId:()=>B,getWaitingUserTasksByFlowNodeId:()=>b,hardNavigate:()=>G,startProcess:()=>v,waitForUserTask:()=>D});module.exports=C(O);var ie=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 D(e={}){let{processInstanceId:s,flowNodeId:t}=e;return new Promise(async(r,o)=>{let d=await n.userTasks.onUserTaskWaiting(async i=>{let g=i.flowNodeInstanceId===void 0,N=s!==void 0&&i.processInstanceId!==s,F=t!==void 0&&i.flowNodeId!==t,U=s!==void 0&&t!==void 0&&i.processInstanceId!==s&&i.flowNodeId!==t;if(g||N||F||U)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 E(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 q(e){let s=await n.userTasks.query({state:a.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.userTasks.length===0?null:s.userTasks}async function b(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 B(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 R(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 W(){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 A(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 G(e,s){(0,w.revalidatePath)(e),(0,y.redirect)(e,s)}async function v(...e){return await n.processModels.startProcessInstance(...e)}async function J(...e){await n.userTasks.finishUserTask(...e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getAssignedUserTasksByIdentity,getIdentity,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByCorrelationId,getWaitingUserTasksByFlowNodeId,hardNavigate,startProcess,waitForUserTask});
package/server/index.d.ts CHANGED
@@ -8,3 +8,24 @@ declare global {
8
8
  }
9
9
  }
10
10
  }
11
+ import { DefaultSession } from 'next-auth';
12
+ declare module 'next-auth' {
13
+ /**
14
+ * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
15
+ */
16
+ interface Session {
17
+ user: {
18
+ /** The user's identity claims. */
19
+ claims?: Record<string, unknown>;
20
+ } & DefaultSession['user'];
21
+ }
22
+ }
23
+ declare module 'next-auth/jwt' {
24
+ /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */
25
+ interface JWT {
26
+ /** OpenID Access Token */
27
+ accessToken?: string;
28
+ /** OpenID ID Token */
29
+ idToken?: string;
30
+ }
31
+ }
package/server/index.mjs CHANGED
@@ -1 +1 @@
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
+ 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 C(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 D(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 E(e){let s=await n.userTasks.query({state:o.FlowNodeInstances.FlowNodeInstanceState.suspended},e);return s.userTasks.length===0?null:s.userTasks}async function q(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 b(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 B(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 R(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 G(){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 L(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 X(e,s){F(e),U(e,s)}async function ee(...e){return await n.processModels.startProcessInstance(...e)}async function se(...e){await n.userTasks.finishUserTask(...e)}export{se as finishUserTask,D as finishUserTaskAndGetNext,L as getActiveProcessInstances,R as getAssignedUserTasksByIdentity,G as getIdentity,B as getReservedUserTasksByIdentity,T as getUserTasks,k as getWaitingUserTaskByFlowNodeInstanceId,E as getWaitingUserTasks,b as getWaitingUserTasksByCorrelationId,q as getWaitingUserTasksByFlowNodeId,X as hardNavigate,ee as startProcess,C as waitForUserTask};
@@ -1,2 +1,8 @@
1
1
  import { DataModels } from '@5minds/processcube_engine_client';
2
- export declare function getActiveProcessInstances(): Promise<DataModels.ProcessInstances.ProcessInstance[] | null>;
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
- * Waits for a UserTask to be created and returns it.
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,37 @@ 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.UserTaskList>;
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. `identity` or `sortSettings`
20
- * @returns DataModels.FlowNodeInstances.UserTaskList
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>;
23
24
  /**
24
25
  *
25
26
  * @param flowNodeId The UserTasks ID (BPMN)
26
- * @param options Additional options for the query e.g. `identity` or `sortSettings`
27
- * @returns DataModels.FlowNodeInstances.UserTaskList
27
+ * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity} or {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
28
+ * @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
28
29
  */
29
- export declare function getWaitingUserTasksByFlowNodeId(flowNodeId: string | string[], options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskList>;
30
+ export declare function getWaitingUserTasksByFlowNodeId(flowNodeId: string | string[], options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
30
31
  /**
31
32
  *
32
33
  * @param flowNodeInstanceId The UserTask Instance ID
33
- * @param options Additional options for the query e.g. `identity`
34
- * @returns DataModels.FlowNodeInstances.UserTaskInstance | null
34
+ * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity}
35
+ * @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>}
35
36
  */
36
37
  export declare function getWaitingUserTaskByFlowNodeInstanceId(flowNodeInstanceId: string, options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>;
37
38
  /**
38
39
  * @param correlationId The Correlation ID
39
- * @returns DataModels.FlowNodeInstances.UserTaskInstance | null
40
+ * @param options Additional options for the query e.g. {@link DataModels.Iam.Identity}
41
+ * @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
40
42
  */
41
- export declare function getWaitingUserTaskByCorrelationId(correlationId: string): Promise<DataModels.FlowNodeInstances.UserTaskInstance | null>;
43
+ export declare function getWaitingUserTasksByCorrelationId(correlationId: string, options?: Parameters<typeof Client.userTasks.query>[1]): Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>;
42
44
  /**
43
45
  * @param identity The identity of the user
44
- * @param options Additional options for the query e.g. `sortSettings`
45
- * @returns DataModels.FlowNodeInstances.UserTaskInstance[] | null
46
+ * @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
47
+ * @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
46
48
  */
47
49
  export declare function getReservedUserTasksByIdentity(identity: DataModels.Iam.Identity, options?: {
48
50
  offset?: number;
@@ -52,8 +54,8 @@ export declare function getReservedUserTasksByIdentity(identity: DataModels.Iam.
52
54
  /**
53
55
  *
54
56
  * @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
+ * @param options Additional options for the query e.g. {@link DataModels.FlowNodeInstances.FlowNodeInstanceSortSettings}
58
+ * @returns {Promise<DataModels.FlowNodeInstances.UserTaskInstance[] | null>}
57
59
  */
58
60
  export declare function getAssignedUserTasksByIdentity(identity: DataModels.Iam.Identity, options?: {
59
61
  offset?: number;
@@ -0,0 +1,6 @@
1
+ import type { DataModels } from '@5minds/processcube_engine_client';
2
+ /**
3
+ *
4
+ * @returns The users {@link DataModels.Iam.Identity} which can be used to access the 5Minds Engine.
5
+ */
6
+ export declare function getIdentity(): Promise<DataModels.Iam.Identity>;
@@ -1,2 +1,3 @@
1
1
  export * from './UserTaskFunctions';
2
+ export * from './getIdentity';
2
3
  export * from './ProcessInstanceFunctions';