@acorex/platform 20.6.0-next.2 → 20.6.0-next.3
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/core/index.d.ts +2 -2
- package/fesm2022/acorex-platform-layout-widgets.mjs +81 -78
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +13 -76
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/layout/widgets/index.d.ts +9 -26
- package/package.json +5 -5
- package/workflow/index.d.ts +884 -433
|
@@ -415,6 +415,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
415
415
|
}]
|
|
416
416
|
}] });
|
|
417
417
|
|
|
418
|
+
// ============================================
|
|
419
|
+
// WORKFLOW INSTANCE v3.0.0 TYPES
|
|
420
|
+
// Based on Elsa Workflow Instance schema: https://elsaworkflows.io/schemas/workflow-instance/v3.0.0/schema.json
|
|
421
|
+
// Compatible with Elsa backend while using ACoreX naming conventions
|
|
422
|
+
// ============================================
|
|
423
|
+
|
|
418
424
|
/**
|
|
419
425
|
* Base abstract class for activities.
|
|
420
426
|
* Extend this to create custom activities.
|
|
@@ -808,6 +814,7 @@ class WorkflowCoordinator {
|
|
|
808
814
|
const response = await this.workflowExecutionService.resumeExecution({
|
|
809
815
|
executionId,
|
|
810
816
|
stepId: task.activityId,
|
|
817
|
+
taskToken: task.taskToken,
|
|
811
818
|
outcome,
|
|
812
819
|
userInput: output
|
|
813
820
|
});
|
|
@@ -852,12 +859,17 @@ class WorkflowCoordinator {
|
|
|
852
859
|
* @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
|
|
853
860
|
* @param userInput - Optional user input data
|
|
854
861
|
*/
|
|
855
|
-
async resumeWorkflow(executionId, stepId, outcome, userInput) {
|
|
862
|
+
async resumeWorkflow(executionId, stepId, outcome, userInput, taskToken) {
|
|
856
863
|
try {
|
|
864
|
+
// Ensure taskToken is provided for secure resumption
|
|
865
|
+
if (!taskToken) {
|
|
866
|
+
throw new Error('Missing taskToken for resumeWorkflow');
|
|
867
|
+
}
|
|
857
868
|
// Backend handles everything: checks outcomeConnections and determines nextStep
|
|
858
869
|
const response = await this.workflowExecutionService.resumeExecution({
|
|
859
870
|
executionId,
|
|
860
871
|
stepId,
|
|
872
|
+
taskToken,
|
|
861
873
|
outcome,
|
|
862
874
|
userInput
|
|
863
875
|
});
|
|
@@ -907,81 +919,6 @@ class WorkflowCoordinator {
|
|
|
907
919
|
return null;
|
|
908
920
|
}
|
|
909
921
|
}
|
|
910
|
-
/**
|
|
911
|
-
* Start step-based execution (only current step, not full workflow).
|
|
912
|
-
*
|
|
913
|
-
* Use this when you only need to execute one step at a time.
|
|
914
|
-
* Perfect for form-based workflows where user interacts with forms.
|
|
915
|
-
*
|
|
916
|
-
* @param workflowId - Workflow ID
|
|
917
|
-
* @param stepId - Initial step ID to execute
|
|
918
|
-
* @param input - Initial input data
|
|
919
|
-
* @returns Execution info with executionId and initial state
|
|
920
|
-
*
|
|
921
|
-
* @example
|
|
922
|
-
* ```typescript
|
|
923
|
-
* // Start login form step
|
|
924
|
-
* const execution = await coordinator.startStepExecution(
|
|
925
|
-
* 'login-workflow',
|
|
926
|
-
* 'login-form-step',
|
|
927
|
-
* {}
|
|
928
|
-
* );
|
|
929
|
-
*
|
|
930
|
-
* // Save executionId for resume after refresh
|
|
931
|
-
* localStorage.setItem('execution-id', execution.executionId);
|
|
932
|
-
* ```
|
|
933
|
-
*/
|
|
934
|
-
async startStepExecution(workflowId, stepId, input = {}) {
|
|
935
|
-
// Start workflow execution in backend
|
|
936
|
-
const execution = await this.startWorkflowExecution(workflowId, input);
|
|
937
|
-
// Update state with current step
|
|
938
|
-
const stateWithStep = {
|
|
939
|
-
...execution.state,
|
|
940
|
-
currentStepId: stepId,
|
|
941
|
-
status: 'running'
|
|
942
|
-
};
|
|
943
|
-
// Update cache
|
|
944
|
-
this.stateCache.set(execution.executionId, stateWithStep);
|
|
945
|
-
return {
|
|
946
|
-
executionId: execution.executionId,
|
|
947
|
-
state: stateWithStep
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Get next task from backend after backend task completion.
|
|
952
|
-
*
|
|
953
|
-
* Use this when backend task completes - backend will return next task.
|
|
954
|
-
* For frontend tasks, use executeTask + completeTask instead.
|
|
955
|
-
*
|
|
956
|
-
* @param executionId - Execution ID
|
|
957
|
-
* @returns Next task from backend (if any)
|
|
958
|
-
*/
|
|
959
|
-
async getNextTask(executionId) {
|
|
960
|
-
try {
|
|
961
|
-
// Backend handles everything: executes backend tasks and returns next task
|
|
962
|
-
const response = await this.workflowExecutionService.executeCurrentStep({
|
|
963
|
-
executionId
|
|
964
|
-
});
|
|
965
|
-
// Update cache
|
|
966
|
-
if (response.state) {
|
|
967
|
-
this.stateCache.set(executionId, response.state);
|
|
968
|
-
}
|
|
969
|
-
return {
|
|
970
|
-
success: true,
|
|
971
|
-
output: response.output,
|
|
972
|
-
nextTask: response.nextTask || null,
|
|
973
|
-
executionId,
|
|
974
|
-
state: response.state
|
|
975
|
-
};
|
|
976
|
-
}
|
|
977
|
-
catch (error) {
|
|
978
|
-
return {
|
|
979
|
-
success: false,
|
|
980
|
-
error: error.message || 'Failed to get next task',
|
|
981
|
-
nextTask: null
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
922
|
//#endregion
|
|
986
923
|
//#region ---- Private Methods ----
|
|
987
924
|
/**
|