@acorex/platform 21.0.0-next.44 → 21.0.0-next.45

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.
Files changed (26) hide show
  1. package/fesm2022/{acorex-platform-common-common-settings.provider-lWz_f-Ia.mjs → acorex-platform-common-common-settings.provider-CsOyxClO.mjs} +17 -3
  2. package/fesm2022/acorex-platform-common-common-settings.provider-CsOyxClO.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-common.mjs +204 -164
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-core.mjs +5 -4
  6. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-entity.mjs +381 -49
  8. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-views.mjs +5 -3
  10. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-widget-core.mjs +72 -6
  12. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-widgets.mjs +109 -131
  14. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-themes-default.mjs +71 -5
  16. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-workflow.mjs +85 -4
  18. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/types/acorex-platform-common.d.ts +64 -47
  21. package/types/acorex-platform-layout-entity.d.ts +79 -4
  22. package/types/acorex-platform-layout-widget-core.d.ts +15 -0
  23. package/types/acorex-platform-layout-widgets.d.ts +15 -19
  24. package/types/acorex-platform-themes-default.d.ts +6 -0
  25. package/types/acorex-platform-workflow.d.ts +68 -2
  26. package/fesm2022/acorex-platform-common-common-settings.provider-lWz_f-Ia.mjs.map +0 -1
@@ -872,6 +872,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
872
872
  */
873
873
  const AXP_WORKFLOW_ENGINE = new InjectionToken('AXP_WORKFLOW_ENGINE');
874
874
 
875
+ //#region ---- Error Codes ----
876
+ /**
877
+ * Stable workflow engine error codes for UI branching (toasts, take-over flow, etc.).
878
+ */
879
+ const AXP_WORKFLOW_ERROR_CODES = {
880
+ TASK_NOT_ASSIGNEE: 'WORKFLOW_TASK_NOT_ASSIGNEE',
881
+ CLAIM_REQUIRED: 'WORKFLOW_CLAIM_REQUIRED',
882
+ REASSIGN_NOT_ALLOWED: 'WORKFLOW_REASSIGN_NOT_ALLOWED',
883
+ };
884
+ //#endregion
885
+ //#region ---- Engine Error ----
886
+ /**
887
+ * Business-rule failure from {@link AXPWorkflowEngine} (expected, user-facing).
888
+ */
889
+ class AXPWorkflowEngineError extends Error {
890
+ constructor(message, code, details) {
891
+ super(message);
892
+ this.code = code;
893
+ this.details = details;
894
+ this.name = 'AXPWorkflowEngineError';
895
+ }
896
+ }
897
+ /**
898
+ * Resolves a stable error code from an unknown thrown value.
899
+ */
900
+ function getWorkflowEngineErrorCode(error) {
901
+ if (error instanceof AXPWorkflowEngineError) {
902
+ return error.code;
903
+ }
904
+ return undefined;
905
+ }
906
+ /**
907
+ * Resolves a user-facing message and optional code from an unknown thrown value.
908
+ */
909
+ function getWorkflowEngineErrorInfo(error) {
910
+ if (error instanceof AXPWorkflowEngineError) {
911
+ return { message: error.message, code: error.code };
912
+ }
913
+ if (error instanceof Error) {
914
+ return { message: error.message };
915
+ }
916
+ return { message: 'An unexpected workflow error occurred' };
917
+ }
918
+ //#endregion
919
+
875
920
  /**
876
921
  * Activity types that use the task board (suspend until user acts via inbox), not inline interactive execution.
877
922
  */
@@ -1511,11 +1556,12 @@ class AXPWorkflowManager {
1511
1556
  };
1512
1557
  }
1513
1558
  catch (error) {
1514
- console.error('[AXPWorkflowManager] Error resuming workflow:', error);
1559
+ const { message, code } = getWorkflowEngineErrorInfo(error);
1515
1560
  return {
1516
1561
  success: false,
1517
1562
  instanceId,
1518
- error: error.message || 'Failed to resume workflow',
1563
+ error: message,
1564
+ errorCode: code,
1519
1565
  };
1520
1566
  }
1521
1567
  }
@@ -1580,13 +1626,48 @@ class AXPWorkflowManager {
1580
1626
  success: result.success,
1581
1627
  instanceId,
1582
1628
  error: result.error,
1629
+ errorCode: result.errorCode,
1630
+ };
1631
+ }
1632
+ catch (error) {
1633
+ const { message, code } = getWorkflowEngineErrorInfo(error);
1634
+ return {
1635
+ success: false,
1636
+ instanceId,
1637
+ error: message,
1638
+ errorCode: code,
1639
+ };
1640
+ }
1641
+ }
1642
+ /**
1643
+ * Reassign a human-task bookmark to the current user without advancing the workflow.
1644
+ * Supported only when the injected workflow engine implements {@link AXPWorkflowEngine.reassignTaskToSelf}.
1645
+ */
1646
+ async reassignTaskToSelf(instanceId, bookmarkId, stepId) {
1647
+ const reassign = this.workflowEngine.reassignTaskToSelf?.bind(this.workflowEngine);
1648
+ if (!reassign) {
1649
+ return {
1650
+ success: false,
1651
+ instanceId,
1652
+ error: 'Reassign task is not supported by this workflow engine',
1653
+ };
1654
+ }
1655
+ try {
1656
+ const result = await reassign({ instanceId, bookmarkId, stepId });
1657
+ return {
1658
+ success: result.success,
1659
+ instanceId,
1660
+ error: result.error,
1661
+ errorCode: result.errorCode,
1583
1662
  };
1584
1663
  }
1585
1664
  catch (error) {
1665
+ const { message, code } = getWorkflowEngineErrorInfo(error);
1586
1666
  return {
1587
1667
  success: false,
1588
1668
  instanceId,
1589
- error: error instanceof Error ? error.message : 'Failed to claim task',
1669
+ error: message,
1670
+ errorCode: code,
1590
1671
  };
1591
1672
  }
1592
1673
  }
@@ -2558,5 +2639,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
2558
2639
  * Generated bundle index. Do not edit.
2559
2640
  */
2560
2641
 
2561
- export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionService, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowFunction, AXPWorkflowLocalEngine, AXPWorkflowManager, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_PROVIDER, AXP_WORKFLOW_TASK_BOARD_ACTIVITY_TYPES, ActivityExecutor, WorkflowExpressionScopeService, axpIsWorkflowTaskBoardActivityType, createWorkFlowEvent, ofType };
2642
+ export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionService, AXPWorkflowEngineError, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowFunction, AXPWorkflowLocalEngine, AXPWorkflowManager, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_ERROR_CODES, AXP_WORKFLOW_PROVIDER, AXP_WORKFLOW_TASK_BOARD_ACTIVITY_TYPES, ActivityExecutor, WorkflowExpressionScopeService, axpIsWorkflowTaskBoardActivityType, createWorkFlowEvent, getWorkflowEngineErrorCode, getWorkflowEngineErrorInfo, ofType };
2562
2643
  //# sourceMappingURL=acorex-platform-workflow.mjs.map