@acorex-platform/module-workflow-management-client 1.0.1 → 2.0.0-beta.0

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 (66) hide show
  1. package/fesm2022/{acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DaEuz1U-.mjs → acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BXlJXZCZ.mjs} +824 -563
  2. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BXlJXZCZ.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-BPa0Sh6Z.mjs → acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-CCrfObJV.mjs} +1 -1
  4. package/fesm2022/{acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-BPa0Sh6Z.mjs.map → acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-CCrfObJV.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-DuYGXzAL.mjs → acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-BDfqjyXH.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-DuYGXzAL.mjs.map → acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-BDfqjyXH.mjs.map} +1 -1
  7. package/fesm2022/{acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs → acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs} +9 -8
  8. package/fesm2022/acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entities-automation.mjs +1 -1
  10. package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entities-automation.mjs.map +1 -1
  11. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-acorex-platform-module-workflow-management-client-contracts-entity-catalog-Drne-WcE.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-acorex-platform-module-workflow-management-client-contracts-entity-catalog-BvPz8y4z.mjs} +6 -6
  12. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-acorex-platform-module-workflow-management-client-contracts-entity-catalog-Drne-WcE.mjs.map → acorex-platform-module-workflow-management-client-contracts-entity-catalog-acorex-platform-module-workflow-management-client-contracts-entity-catalog-BvPz8y4z.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-category.entity-3VLEu-L6.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-category.entity-DyB1oUwY.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-category.entity-3VLEu-L6.mjs.map → acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-category.entity-DyB1oUwY.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-definition.entity-ClVokZpw.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-definition.entity-DXu2hFJW.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-definition.entity-ClVokZpw.mjs.map → acorex-platform-module-workflow-management-client-contracts-entity-catalog-activity-definition.entity-DXu2hFJW.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-BY4uwLMZ.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-CcCT3L9D.mjs} +3 -3
  18. package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-CcCT3L9D.mjs.map +1 -0
  19. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-definition.entity-DN9KS_mu.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-definition.entity-BKYn5nnd.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-definition.entity-DN9KS_mu.mjs.map → acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-definition.entity-BKYn5nnd.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-instance.entity-BnfbJExU.mjs → acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-instance.entity-Bg_3eDOz.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-instance.entity-BnfbJExU.mjs.map → acorex-platform-module-workflow-management-client-contracts-entity-catalog-workflow-instance.entity-Bg_3eDOz.mjs.map} +1 -1
  23. package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog.mjs +1 -1
  24. package/fesm2022/acorex-platform-module-workflow-management-client-contracts.mjs +34 -1
  25. package/fesm2022/acorex-platform-module-workflow-management-client-contracts.mjs.map +1 -1
  26. package/fesm2022/acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs +245 -0
  27. package/fesm2022/acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs.map +1 -0
  28. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-BFdyJ4rC.mjs → acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs} +1 -1
  29. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-BFdyJ4rC.mjs.map → acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs.map} +1 -1
  30. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs → acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs} +1 -1
  31. package/fesm2022/{acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs.map → acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs.map} +1 -1
  32. package/fesm2022/{acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-spFF77AO.mjs → acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-CvFHyST8.mjs} +1 -1
  33. package/fesm2022/{acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-spFF77AO.mjs.map → acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-CvFHyST8.mjs.map} +1 -1
  34. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-activity-instance-rows.utils-CMVZYS4y.mjs → acorex-platform-module-workflow-management-client-workflow-activity-instance-rows.utils-D7w2TNxB.mjs} +1 -1
  35. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-activity-instance-rows.utils-CMVZYS4y.mjs.map → acorex-platform-module-workflow-management-client-workflow-activity-instance-rows.utils-D7w2TNxB.mjs.map} +1 -1
  36. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-D0E2zjIA.mjs → acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-DV8K0otJ.mjs} +1 -1
  37. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-D0E2zjIA.mjs.map → acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-DV8K0otJ.mjs.map} +1 -1
  38. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-CVTeOv-q.mjs → acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-DPMtUBxM.mjs} +3 -3
  39. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-CVTeOv-q.mjs.map → acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-DPMtUBxM.mjs.map} +1 -1
  40. package/fesm2022/{acorex-platform-module-workflow-management-client-index-B0-OPKmr.mjs → acorex-platform-module-workflow-management-client-workflow-definition-activities-page-DgagKVhS.mjs} +4 -4
  41. package/fesm2022/acorex-platform-module-workflow-management-client-workflow-definition-activities-page-DgagKVhS.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-module-workflow-management-client-index-C8nsbDAw.mjs → acorex-platform-module-workflow-management-client-workflow-instance-activity-instances-page-CE7L5ZDi.mjs} +4 -4
  43. package/fesm2022/acorex-platform-module-workflow-management-client-workflow-instance-activity-instances-page-CE7L5ZDi.mjs.map +1 -0
  44. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs → acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs} +1 -1
  45. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs.map → acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs.map} +1 -1
  46. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BtQ8OC0Q.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CofkxzF1.mjs} +9 -9
  47. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-BtQ8OC0Q.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CofkxzF1.mjs.map} +1 -1
  48. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-timeline-tab.component-AnJ-Pywf.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-timeline-tab.component-ChMzrVoq.mjs} +4 -4
  49. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-timeline-tab.component-AnJ-Pywf.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-timeline-tab.component-ChMzrVoq.mjs.map} +1 -1
  50. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-visual-tab.component-34kIeL5C.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-visual-tab.component-CEfYaxTL.mjs} +4 -4
  51. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-visual-tab.component-34kIeL5C.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-visual-tab.component-CEfYaxTL.mjs.map} +1 -1
  52. package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-BjjwcQ2s.mjs → acorex-platform-module-workflow-management-client-workflow-task-popover.component-V3Spc1Dn.mjs} +14 -9
  53. package/fesm2022/acorex-platform-module-workflow-management-client-workflow-task-popover.component-V3Spc1Dn.mjs.map +1 -0
  54. package/fesm2022/acorex-platform-module-workflow-management-client.mjs +1 -1
  55. package/i18n/en-AU/workflow-management.json +26 -1
  56. package/i18n/en-US/workflow-management.json +26 -1
  57. package/i18n/fa-IR/workflow-management.json +26 -1
  58. package/package.json +2 -2
  59. package/types/acorex-platform-module-workflow-management-client-contracts.d.ts +124 -2
  60. package/types/acorex-platform-module-workflow-management-client.d.ts +73 -58
  61. package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DaEuz1U-.mjs.map +0 -1
  62. package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-BY4uwLMZ.mjs.map +0 -1
  63. package/fesm2022/acorex-platform-module-workflow-management-client-index-B0-OPKmr.mjs.map +0 -1
  64. package/fesm2022/acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs.map +0 -1
  65. package/fesm2022/acorex-platform-module-workflow-management-client-index-C8nsbDAw.mjs.map +0 -1
  66. package/fesm2022/acorex-platform-module-workflow-management-client-workflow-task-popover.component-BjjwcQ2s.mjs.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { AXPCommonMenuKeys, AXPCommonPermissionGroupKeys } from '@acorex-platform/module-common-client/contracts';
2
2
  import { AXPSessionService, AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
3
- import { AXPEntityService, AXPEntityFormBuilderService, AXPEntityDefinitionRegistryService, actionExists, ensureListActions, cloneLayoutArrays, ensureLayoutSection, ensureLayoutPropertyView, AXP_ENTITY_ACTION_PLUGIN, AXP_ENTITY_CONFIG_TOKEN } from '@acorex-platform/framework-client/layout/entity';
3
+ import { AXPEntityService, AXPEntityFormBuilderService, AXPEntityDefinitionRegistryService, materializeEntityAttachmentFields, actionExists, ensureListActions, cloneLayoutArrays, ensureLayoutSection, ensureLayoutPropertyView, AXP_ENTITY_ACTION_PLUGIN, AXP_ENTITY_CONFIG_TOKEN } from '@acorex-platform/framework-client/layout/entity';
4
4
  import * as i0 from '@angular/core';
5
5
  import { inject, Injectable, NgModule, runInInjectionContext, Injector, makeEnvironmentProviders, DestroyRef, InjectionToken, Inject } from '@angular/core';
6
- import { firstValueFrom } from 'rxjs';
7
- import { RootConfig, AXPAdministrationPermissionKeys, AXPWorkflowManagementMenuKeys, AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY } from '@acorex-platform/module-workflow-management-client/contracts';
6
+ import { firstValueFrom, merge as merge$1 } from 'rxjs';
7
+ import { RootConfig, AXPAdministrationPermissionKeys, AXPWorkflowManagementMenuKeys, WORKFLOW_TASK_BOARD_QUERY, AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY } from '@acorex-platform/module-workflow-management-client/contracts';
8
8
  import { AXMCalendarManagementModule } from '@acorex-platform/module-calendar-management-client';
9
- import { AXP_PROTECTED_ROUTE_GUARDS, AXP_STATUS_PROVIDERS, AXP_MENU_PROVIDER, AXPSettingsService, AXPStatusDefinitionProviderService } from '@acorex-platform/framework-client/common';
10
- import { AXPBroadcastEventService, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, provideLazyProvider, AXPExpressionEvaluatorService } from '@acorex-platform/framework-client/core';
9
+ import { AXPFileStorageService, AXP_PROTECTED_ROUTE_GUARDS, AXP_STATUS_PROVIDERS, AXP_MENU_PROVIDER, AXPPreparedInteractionService, AXPDataRefreshService, AXPSettingsService, AXPStatusDefinitionProviderService } from '@acorex-platform/framework-client/common';
10
+ import { AXPBroadcastEventService, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, provideLazyProvider, AXPEntityBroadcastService, AXPExpressionEvaluatorService } from '@acorex-platform/framework-client/core';
11
11
  import { AXPDomainModule } from '@acorex-platform/framework-client/domain';
12
- import { AXP_PAGE_COMPONENT_PROVIDER } from '@acorex-platform/framework-client/layout/components';
12
+ import { AXP_WORKFLOW_TASK_PROVIDER, AXP_WORKFLOW_TASK_PROVIDER_RESOLVER, AXP_PAGE_COMPONENT_PROVIDER, AXPWorkBoardProvider, AXPDueStatusProviderService, normalizeTaskPriority, mapEntityStatusColorForBadge } from '@acorex-platform/framework-client/layout/components';
13
13
  import { AXPWidgetSerializationHelper, AXP_WIDGETS_EDITOR_CATEGORY, AXPWidgetCoreModule, AXP_WIDGET_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/layout/widget-core';
14
- import { provideQuerySetups, provideCommandSetups, AXPCommandService } from '@acorex-platform/framework-client/runtime';
14
+ import { AXPCommandService, provideQuerySetups, provideCommandSetups, AXPQueryService } from '@acorex-platform/framework-client/runtime';
15
15
  import { AXPWorkflowDefinitionService, axpShouldOfferWorkflowContinuationAfterStep, axpIsWorkflowInlineFrontendTask, axpResolveWorkflowContinuationBeforeInteractive, axpShouldSkipBeforeInteractiveFromMetadata, AXP_WORKFLOW_ENGINE, AXPWorkflowManager, AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY, AXP_WORKFLOW_ERROR_CODES, axpIsWorkflowTaskBoardActivityType, AXP_WORKFLOW_PROVIDER, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_CONTINUATION_HOOK, WorkflowExpressionScopeService } from '@acorex-platform/framework-client/workflow';
16
16
  import { ROUTES } from '@angular/router';
17
17
  import { AXDialogService } from '@acorex/components/dialog';
@@ -20,13 +20,15 @@ import { AXPopupService } from '@acorex/components/popup';
20
20
  import { AXPDialogOpener, AXPDialogRendererComponent, AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
21
21
  import { cloneDeep, isString, trim, isEmpty, defaultTo, merge, get } from 'lodash';
22
22
  import { AXToastService } from '@acorex/components/toast';
23
- import { AXPWidgetsList, runtimeCommandPayloadData, AXPSystemActionType, AXPStatusProvider, AXPSystemStatusType, systemStatusToDefinition, AXPRegionalSetting, AXPSystemStatuses, AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
23
+ import { AXPWidgetsList, runtimeCommandPayloadData, AXPSystemActionType, AXPStatusProvider, AXPSystemStatusType, systemStatusToDefinition, runtimeQueryPayloadData, AXPRegionalSetting, AXPSystemStatuses, AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
24
+ import { AXMTaskWorkspaceService } from '@acorex-platform/module-task-management-client';
24
25
  import { AXPEntityCommandScope, entityDetailsCrudActions, AXP_RECORD_WORKFLOW_INFO_INSTANCE_ID_FIELD } from '@acorex-platform/framework-shared/entity';
25
26
  import { AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';
26
27
  import { AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';
27
- import { AXP_WORKFLOW_TASK_PROVIDER, AXP_WORKFLOW_TASK_PROVIDER_RESOLVER, AXPWorkflowTaskProvider, AXPDueStatusProviderService, matchesTaskBoardAssigneeUserIdsFilter, filterTasksOverlappingRange, matchesTaskPriorityFilter, matchesTaskDueStatusFilter, normalizeTaskPriority, mapEntityStatusColorForBadge } from '@acorex-platform/module-task-management-client';
28
+ import { cloneDeep as cloneDeep$1 } from 'lodash-es';
28
29
  import { AXFormatService } from '@acorex/core/format';
29
30
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
31
+ import { AXLocaleService } from '@acorex/core/locale';
30
32
 
31
33
  class AXMMenuProvider {
32
34
  constructor() {
@@ -565,6 +567,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
565
567
  type: Injectable
566
568
  }] });
567
569
 
570
+ //#region ----- Imports -----
571
+ //#endregion
572
+ //#region ----- Sign-off layout -----
573
+ function field(label, editor) {
574
+ return { type: 'form-field', options: { label, showLabel: true }, children: [editor] };
575
+ }
576
+ function workflowSignOffLayout(options) {
577
+ const children = [field(options?.noteLabelKey ?? '@workflow-management:sign-off.activities.sign-off.note-label', {
578
+ type: 'large-text-editor', name: 'note', path: 'note', options: { maxLength: 1000, rows: 3 },
579
+ }), field('@workflow-management:sign-off.activities.sign-off.signature-label', {
580
+ type: 'signature', name: 'signature', path: 'signature',
581
+ options: {
582
+ captureMode: options?.captureMode ?? 'inline',
583
+ showOverlay: false,
584
+ signatureProvider: options?.signatureProvider ?? 'hcm-employee',
585
+ validations: [{ rule: 'required', options: { message: '@workflow-management:sign-off.activities.sign-off.signature-required' } }],
586
+ },
587
+ })];
588
+ return { type: 'block-layout', mode: 'edit', children };
589
+ }
590
+ function workflowSignOffActions(allowReject) {
591
+ const actions = [];
592
+ if (allowReject) {
593
+ actions.push({
594
+ name: 'reject',
595
+ title: '@general:actions.reject.title',
596
+ look: 'outline',
597
+ color: 'danger',
598
+ requirePaths: ['note'],
599
+ requiredMessageKey: '@workflow-management:sign-off.activities.rejection-reason.note-required',
600
+ });
601
+ }
602
+ actions.push({
603
+ name: 'sign',
604
+ title: '@workflow-management:sign-off.activities.sign-off.submit-text',
605
+ look: 'solid',
606
+ color: 'primary',
607
+ validate: true,
608
+ });
609
+ return actions;
610
+ }
611
+ //#endregion
612
+
568
613
  /** Keep aligned with AXM_HCM_EMPLOYEE_SIGNATURE_PROVIDER_NAME. */
569
614
  const DEFAULT_SIGN_OFF_SIGNATURE_PROVIDER = 'hcm-employee';
570
615
  //#endregion
@@ -576,18 +621,35 @@ const DEFAULT_SIGN_OFF_SIGNATURE_PROVIDER = 'hcm-employee';
576
621
  * Use after review/approval paths in workflows that require an auditable sign-off.
577
622
  *
578
623
  * Activity type: `workflow-activity:sign-off`
579
- * Outcomes: `Signed` | `Cancelled`
624
+ * Outcomes: `Signed` | `Rejected` | `Cancelled`
580
625
  */
581
626
  class SignOffActivity {
582
627
  constructor() {
583
628
  //#region ---- Services & Dependencies ----
584
629
  this.layoutBuilder = inject(AXPLayoutBuilderService);
585
630
  this.translationService = inject(AXTranslationService);
631
+ this.taskWorkspace = inject(AXMTaskWorkspaceService);
586
632
  }
587
633
  //#endregion
588
634
  //#region ---- Command Implementation ----
589
635
  async execute(input) {
590
636
  try {
637
+ const provided = isString(input.signature) ? trim(input.signature) : '';
638
+ if (provided.startsWith('data:image/')) {
639
+ return {
640
+ success: true,
641
+ kind: 'object',
642
+ data: {
643
+ signature: provided,
644
+ note: isString(input.note) ? input.note : undefined,
645
+ signedAt: isString(input.signedAt) && input.signedAt.trim() ? input.signedAt : new Date().toISOString(),
646
+ },
647
+ metadata: { outcome: 'Signed' },
648
+ };
649
+ }
650
+ if (input.presentation === 'workspace') {
651
+ return await this.openWorkspace(input);
652
+ }
591
653
  const message = input.message
592
654
  ? await this.translationService.translateAsync(input.message)
593
655
  : await this.translationService.translateAsync('@workflow-management:sign-off.activities.sign-off.default-message');
@@ -635,6 +697,49 @@ class SignOffActivity {
635
697
  }
636
698
  }
637
699
  //#endregion
700
+ //#region ---- Task workspace -----
701
+ async openWorkspace(input) {
702
+ const allowReject = input.allowReject === true;
703
+ const closed = await this.taskWorkspace.open({
704
+ taskId: input.taskId,
705
+ messageKey: input.message || '@workflow-management:sign-off.activities.sign-off.default-message',
706
+ content: input.content,
707
+ layout: input.layout ?? workflowSignOffLayout({
708
+ captureMode: this.resolveCaptureMode(input.captureMode),
709
+ signatureProvider: this.resolveSignatureProvider(input.signatureProvider),
710
+ }),
711
+ actions: [
712
+ ...(input.content?.provider === 'form-template' ? [] : [{ name: 'cancel', title: '@general:actions.cancel.title', look: 'outline', color: 'default' }]),
713
+ ...workflowSignOffActions(allowReject),
714
+ ],
715
+ });
716
+ if (closed.errorKey)
717
+ return { success: false, message: { text: closed.errorKey } };
718
+ const note = closed.values?.['note'];
719
+ if (allowReject && !closed.cancelled && closed.action === 'reject' && isString(note) && trim(note)) {
720
+ return { success: true, kind: 'object', data: { reason: trim(note) }, metadata: { outcome: 'Rejected' } };
721
+ }
722
+ const signature = isString(closed.values?.['signature']) ? trim(closed.values['signature']) : '';
723
+ if (closed.cancelled || closed.action !== 'sign' || !signature.startsWith('data:image/')) {
724
+ return {
725
+ success: true,
726
+ kind: 'object',
727
+ data: { signature: '', signedAt: new Date().toISOString() },
728
+ metadata: { outcome: 'Cancelled' },
729
+ };
730
+ }
731
+ return {
732
+ success: true,
733
+ kind: 'object',
734
+ data: {
735
+ signature,
736
+ note: isString(note) ? note : undefined,
737
+ signedAt: new Date().toISOString(),
738
+ },
739
+ metadata: { outcome: 'Signed' },
740
+ };
741
+ }
742
+ //#endregion
638
743
  //#region ---- Dialog ----
639
744
  resolveCaptureMode(value) {
640
745
  if (value === 'popup') {
@@ -749,6 +854,18 @@ class RejectionReasonActivity {
749
854
  //#region ---- Command Implementation ----
750
855
  async execute(input) {
751
856
  try {
857
+ const provided = isString(input.reason) ? trim(input.reason) : '';
858
+ if (provided) {
859
+ return {
860
+ success: true,
861
+ kind: 'object',
862
+ data: {
863
+ reason: provided,
864
+ rejectedAt: isString(input.rejectedAt) && input.rejectedAt.trim() ? input.rejectedAt : new Date().toISOString(),
865
+ },
866
+ metadata: { outcome: 'Submitted' },
867
+ };
868
+ }
752
869
  const requireReason = input.requireReason !== false;
753
870
  const message = input.message
754
871
  ? await this.translationService.translateAsync(input.message)
@@ -887,6 +1004,7 @@ class CreateEntityFormActivity {
887
1004
  this.entityForm = inject(AXPEntityFormBuilderService);
888
1005
  this.entityService = inject(AXPEntityDefinitionRegistryService);
889
1006
  this.translationService = inject(AXTranslationService);
1007
+ this.fileStorage = inject(AXPFileStorageService);
890
1008
  }
891
1009
  //#endregion
892
1010
  //#region ---- Public Methods ----
@@ -948,6 +1066,25 @@ class CreateEntityFormActivity {
948
1066
  }
949
1067
  const context = merge({}, initialData, dialogRef.context());
950
1068
  if (persistInWorkflow) {
1069
+ dialogRef.setLoading(true);
1070
+ try {
1071
+ await materializeEntityAttachmentFields(entityRef, context, this.fileStorage, {
1072
+ refType: `${module}.${entity}`,
1073
+ });
1074
+ }
1075
+ catch (error) {
1076
+ const text = error instanceof Error && error.message
1077
+ ? error.message
1078
+ : await this.translationService.translateAsync('@general:widgets.file-uploader.messages.upload-failed');
1079
+ return {
1080
+ success: false,
1081
+ message: { details: {}, text },
1082
+ metadata: { outcome: 'Failed' },
1083
+ };
1084
+ }
1085
+ finally {
1086
+ dialogRef.setLoading(false);
1087
+ }
951
1088
  return { success: true, kind: 'object',
952
1089
  data: { result: context ?? {} },
953
1090
  metadata: {
@@ -1750,15 +1887,16 @@ const AXMActivityCommandConfiguratorWidget = {
1750
1887
  ],
1751
1888
  components: {
1752
1889
  edit: {
1753
- component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-DuYGXzAL.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetEditComponent),
1890
+ component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-BDfqjyXH.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetEditComponent),
1754
1891
  },
1755
1892
  designer: {
1756
- component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-DuYGXzAL.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetEditComponent),
1893
+ component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-edit.component-BDfqjyXH.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetEditComponent),
1757
1894
  },
1758
1895
  column: {
1759
- component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-BPa0Sh6Z.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetColumnComponent),
1896
+ component: () => import('./acorex-platform-module-workflow-management-client-activity-command-configurator-widget-column.component-CCrfObJV.mjs').then((c) => c.AXMActivityCommandConfiguratorWidgetColumnComponent),
1760
1897
  },
1761
1898
  },
1899
+ toString: `display(value)`,
1762
1900
  };
1763
1901
  //#endregion
1764
1902
 
@@ -1796,15 +1934,16 @@ const AXMWorkflowConfiguratorWidget = {
1796
1934
  ],
1797
1935
  components: {
1798
1936
  edit: {
1799
- component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-CVTeOv-q.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetEditComponent),
1937
+ component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-DPMtUBxM.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetEditComponent),
1800
1938
  },
1801
1939
  designer: {
1802
- component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-CVTeOv-q.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetEditComponent),
1940
+ component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-edit.component-DPMtUBxM.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetEditComponent),
1803
1941
  },
1804
1942
  column: {
1805
- component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-D0E2zjIA.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetColumnComponent),
1943
+ component: () => import('./acorex-platform-module-workflow-management-client-workflow-configurator-widget-column.component-DV8K0otJ.mjs').then((c) => c.AXMWorkflowConfiguratorWidgetColumnComponent),
1806
1944
  },
1807
1945
  },
1946
+ toString: `display(value)`,
1808
1947
  };
1809
1948
  //#endregion
1810
1949
 
@@ -1901,7 +2040,7 @@ function loadGenericWorkflowTaskProviderClass$1() {
1901
2040
  //#region ---- Discovery ----
1902
2041
  /**
1903
2042
  * Discovers one workflow task provider per workflow definition.
1904
- * Re-runs discovery when {@link AXPWorkflowTaskProviderResolveOptions.force} is set.
2043
+ * Re-runs discovery when {@link AXPWorkBoardProviderResolveOptions.force} is set.
1905
2044
  */
1906
2045
  async function discoverWorkflowTaskProviders(injector, options) {
1907
2046
  if (options?.force) {
@@ -1913,8 +2052,7 @@ async function discoverWorkflowTaskProviders(injector, options) {
1913
2052
  const categories = await workflowDefinitionService.getCategories();
1914
2053
  const providers = [];
1915
2054
  const seenDefinitionNames = new Set();
1916
- for (const category of categories) {
1917
- const workflows = await workflowDefinitionService.getWorkflowsByCategoryId(category.id);
2055
+ const registerWorkflows = async (workflows) => {
1918
2056
  for (const workflow of workflows) {
1919
2057
  const key = workflow.name;
1920
2058
  if (!key || seenDefinitionNames.has(key)) {
@@ -1932,6 +2070,13 @@ async function discoverWorkflowTaskProviders(injector, options) {
1932
2070
  const provider = runInInjectionContext(injector, () => new ProviderClass(config));
1933
2071
  providers.push(provider);
1934
2072
  }
2073
+ };
2074
+ for (const category of categories) {
2075
+ await registerWorkflows(await workflowDefinitionService.getWorkflowsByCategoryId(category.id));
2076
+ }
2077
+ // Tenants with no visible category catalog still have workflow instances (e.g. documentReview).
2078
+ if (seenDefinitionNames.size === 0) {
2079
+ await registerWorkflows(await workflowDefinitionService.getWorkflowsByCategoryId('__all__'));
1935
2080
  }
1936
2081
  return providers;
1937
2082
  }
@@ -2569,6 +2714,8 @@ class AXPWorkflowInstanceHumanTaskService {
2569
2714
  this.sessionService = inject(AXPSessionService);
2570
2715
  this.translationService = inject(AXTranslationService);
2571
2716
  this.dialogService = inject(AXDialogService);
2717
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
2718
+ this.commands = inject(AXPCommandService);
2572
2719
  this.toastService = inject(AXToastService);
2573
2720
  this.eventService = inject(AXPBroadcastEventService);
2574
2721
  this.workflowEngine = inject(AXP_WORKFLOW_ENGINE);
@@ -2613,7 +2760,7 @@ class AXPWorkflowInstanceHumanTaskService {
2613
2760
  return result;
2614
2761
  }
2615
2762
  /**
2616
- * Runs the first configured action on a suspended human-task bookmark (e.g. start-fill → questionnaire).
2763
+ * Runs an explicitly chosen decision, or the sole navigation action, on a suspended human-task bookmark.
2617
2764
  */
2618
2765
  async executePrimaryHumanTaskAction(instanceId, activityId, options) {
2619
2766
  const found = await this.bookmarkAccess.findActiveBookmark(instanceId, activityId);
@@ -2624,7 +2771,20 @@ class AXPWorkflowInstanceHumanTaskService {
2624
2771
  if (!payload?.taskToken) {
2625
2772
  return null;
2626
2773
  }
2627
- const outcome = this.resolvePrimaryTaskOutcome(payload);
2774
+ const outcome = await this.chooseTaskOutcome(payload);
2775
+ if (!outcome)
2776
+ return null;
2777
+ if (/[:.]/.test(outcome)) {
2778
+ const actions = this.availableActions(payload);
2779
+ const selected = actions.find(action => (action.command?.name ?? action.name) === outcome);
2780
+ const executed = await this.commands.execute(outcome, {
2781
+ ...selected?.command?.options, ...payload.context,
2782
+ instanceId, bookmarkId: found.bookmark.id, activityId, taskToken: payload.taskToken,
2783
+ });
2784
+ if (options?.notifyViews !== false)
2785
+ this.notifyWorkflowTaskViewsChanged();
2786
+ return { success: executed?.success === true, instanceId };
2787
+ }
2628
2788
  const result = await this.resumeSuspendedHumanTask({
2629
2789
  instanceId,
2630
2790
  bookmarkId: found.bookmark.id,
@@ -2669,16 +2829,57 @@ class AXPWorkflowInstanceHumanTaskService {
2669
2829
  }
2670
2830
  //#endregion
2671
2831
  //#region ---- Outcome resolution ----
2672
- /** First action command name on the human-task bookmark (e.g. start-fill, approve). */
2673
- resolvePrimaryTaskOutcome(payload) {
2674
- const actions = [...(payload.actions?.prefix ?? []), ...(payload.actions?.suffix ?? [])];
2675
- for (const action of actions) {
2676
- const outcome = action.command?.name ?? action.name;
2677
- if (outcome && outcome !== 'unknown') {
2678
- return outcome;
2832
+ availableActions(payload) {
2833
+ let raw = payload.actions;
2834
+ if (typeof raw === 'string') {
2835
+ try {
2836
+ raw = JSON.parse(raw);
2837
+ }
2838
+ catch {
2839
+ return [];
2679
2840
  }
2680
2841
  }
2681
- return 'submit';
2842
+ const configured = raw && typeof raw === 'object' ? raw : {};
2843
+ return [...(Array.isArray(configured.prefix) ? configured.prefix : []), ...(Array.isArray(configured.suffix) ? configured.suffix : [])]
2844
+ .filter((action) => {
2845
+ if (!action || typeof action !== 'object')
2846
+ return false;
2847
+ const item = action;
2848
+ const name = item.command?.name ?? item.name;
2849
+ return item.hidden !== true && item.disabled !== true && typeof name === 'string' && !!name.trim() && name !== 'unknown';
2850
+ });
2851
+ }
2852
+ /** A synchronous caller must never turn ordering into a business decision. */
2853
+ resolvePrimaryTaskOutcome(payload) {
2854
+ const actions = this.availableActions(payload);
2855
+ if (actions.length > 1)
2856
+ throw new Error('Multiple workflow actions require an explicit selection.');
2857
+ if (!actions.length && payload.actions)
2858
+ throw new Error('No eligible workflow action is available.');
2859
+ return actions[0]?.command?.name ?? actions[0]?.name ?? 'submit';
2860
+ }
2861
+ /** Continue opens a decision picker; a single navigation action can still open its form. */
2862
+ async chooseTaskOutcome(payload) {
2863
+ const actions = this.availableActions(payload);
2864
+ if (!actions.length && !payload.actions)
2865
+ actions.push({ name: 'submit', title: '@general:actions.submit.title' });
2866
+ if (!actions.length)
2867
+ return null;
2868
+ const only = actions.length === 1 ? actions[0].command?.name ?? actions[0].name : null;
2869
+ if (only && !/^(approve|reject|cancel|lock|complete-job)$/i.test(only))
2870
+ return only;
2871
+ const choices = actions.map((action, index) => ({ key: `workflow-choice-${index}`, outcome: action.command?.name ?? action.name, title: action.title }));
2872
+ const result = await this.layoutBuilder.create().dialog(dialog => dialog
2873
+ .setTitle('@workflow-management:task-actions.choose-title')
2874
+ .setMessage('@workflow-management:task-actions.choose-message')
2875
+ .setActions(builder => {
2876
+ builder.cancel('@general:actions.cancel.title');
2877
+ for (const choice of choices)
2878
+ builder.custom({ title: choice.title, command: { name: choice.key } });
2879
+ })
2880
+ .onAction(ref => choices.find(choice => choice.key === ref.action())?.outcome ?? null)).show();
2881
+ const selected = resolveLayoutBuilderDialogResult(result);
2882
+ return typeof selected === 'string' && choices.some(choice => choice.outcome === selected) ? selected : null;
2682
2883
  }
2683
2884
  //#endregion
2684
2885
  //#region ---- UI helpers ----
@@ -2748,9 +2949,31 @@ class AXPWorkflowTaskContinuationService {
2748
2949
  }
2749
2950
  async offerAfterWorkflowStep(context) {
2750
2951
  try {
2952
+ // Reject cancel/draft/same-step continuations before loading the entity.
2953
+ if (context.pendingNextTask && !shouldOfferWorkflowContinuationAfterStep(context, context.pendingNextTask ? [context.pendingNextTask.activityId] : [])) {
2954
+ return 'not-offered';
2955
+ }
2751
2956
  if (this.isAssignedToSomeoneElse(context.pendingNextTask)) {
2752
2957
  return 'not-offered';
2753
2958
  }
2959
+ // The engine response already identifies an assigned next step. There is
2960
+ // nothing to reload before asking; fetch a fresh bookmark only on confirm.
2961
+ const pending = context.pendingNextTask;
2962
+ const currentUserId = this.sessionService.user?.id;
2963
+ if (pending && currentUserId != null &&
2964
+ axpIsWorkflowTaskBoardActivityType(pending.activityType)) {
2965
+ const payload = this.buildPayloadFromWorkflowTask(pending);
2966
+ if (normalizeWorkflowTaskUserIds(payload.assignedUserIds).includes(String(currentUserId))) {
2967
+ if (!await this.confirmContinueToNextStep(false)) {
2968
+ return 'declined';
2969
+ }
2970
+ await this.humanTaskService.executePrimaryHumanTaskAction(context.instanceId, pending.activityId, {
2971
+ suppressContinuation: true,
2972
+ notifyViews: true,
2973
+ });
2974
+ return 'confirmed';
2975
+ }
2976
+ }
2754
2977
  const expectedActivityId = context.pendingNextTask?.activityId;
2755
2978
  const instance = await this.bookmarkAccess.loadInstanceForContinuation(context.instanceId, expectedActivityId);
2756
2979
  if (!instance) {
@@ -2844,6 +3067,11 @@ class AXPWorkflowTaskContinuationService {
2844
3067
  return 'confirmed';
2845
3068
  }
2846
3069
  }
3070
+ const activityType = continuationCtx.payload?.activityType;
3071
+ if (axpIsWorkflowTaskBoardActivityType(activityType)) {
3072
+ this.humanTaskService.notifyWorkflowTaskViewsChanged();
3073
+ return 'confirmed';
3074
+ }
2847
3075
  await this.humanTaskService.executePrimaryHumanTaskAction(instanceId, nextActivityId, {
2848
3076
  suppressContinuation: true,
2849
3077
  notifyViews: true,
@@ -3052,37 +3280,45 @@ class AXMWorkflowManagementModule {
3052
3280
  provideQuerySetups([
3053
3281
  {
3054
3282
  key: RootConfig.queries.dashboard.definitionsKpi,
3055
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowDefinitionsKpiQuery),
3283
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowDefinitionsKpiQuery),
3056
3284
  },
3057
3285
  {
3058
3286
  key: RootConfig.queries.dashboard.activitiesKpi,
3059
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowActivitiesKpiQuery),
3287
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowActivitiesKpiQuery),
3060
3288
  },
3061
3289
  {
3062
3290
  key: RootConfig.queries.dashboard.definitionsByStatusBar,
3063
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowDefinitionsByStatusBarQuery),
3291
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowDefinitionsByStatusBarQuery),
3064
3292
  },
3065
3293
  {
3066
3294
  key: RootConfig.queries.dashboard.activitiesByCategoryDonut,
3067
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowActivitiesByCategoryDonutQuery),
3295
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowActivitiesByCategoryDonutQuery),
3068
3296
  },
3069
3297
  {
3070
3298
  key: RootConfig.queries.dashboard.publishedDefinitionsGauge,
3071
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowPublishedDefinitionsGaugeQuery),
3299
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowPublishedDefinitionsGaugeQuery),
3072
3300
  },
3073
3301
  ]),
3074
3302
  provideCommandSetups([
3303
+ {
3304
+ key: 'WorkflowManagement.WorkflowTask:PreparedInteraction',
3305
+ command: () => Promise.resolve().then(function () { return preparedWorkflowTask_service; }).then(c => c.PreparedWorkflowTaskCommand),
3306
+ },
3307
+ {
3308
+ key: 'WorkflowManagement.WorkflowTask:ExecuteAction',
3309
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs').then(c => c.ExecuteWorkflowTaskActionCommand),
3310
+ },
3075
3311
  {
3076
3312
  key: 'WorkflowManagement.WorkflowDefinition:ExecuteWithInput',
3077
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-BFdyJ4rC.mjs').then((c) => c.ExecuteWorkflowWithInputCommand),
3313
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs').then((c) => c.ExecuteWorkflowWithInputCommand),
3078
3314
  },
3079
3315
  {
3080
3316
  key: 'WorkflowManagement.WorkflowDefinition:Execute',
3081
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs').then((c) => c.ExecuteWorkflowCommand),
3317
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs').then((c) => c.ExecuteWorkflowCommand),
3082
3318
  },
3083
3319
  {
3084
3320
  key: 'WorkflowManagement.WorkflowDefinition:Activities:Save',
3085
- command: () => import('./acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-spFF77AO.mjs').then((c) => c.SaveWorkflowDefinitionActivitiesCommand),
3321
+ command: () => import('./acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-CvFHyST8.mjs').then((c) => c.SaveWorkflowDefinitionActivitiesCommand),
3086
3322
  },
3087
3323
  {
3088
3324
  key: 'workflow-activity:show-toast',
@@ -3122,29 +3358,29 @@ class AXMWorkflowManagementModule {
3122
3358
  },
3123
3359
  {
3124
3360
  key: 'WorkflowManagement.WorkflowRun:Continue',
3125
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ContinueWorkflowRunCommand),
3361
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ContinueWorkflowRunCommand),
3126
3362
  },
3127
3363
  {
3128
3364
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3129
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.CancelWorkflowRunCommand),
3365
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.CancelWorkflowRunCommand),
3130
3366
  },
3131
3367
  {
3132
3368
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3133
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3369
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3134
3370
  },
3135
3371
  {
3136
3372
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3137
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3373
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3138
3374
  },
3139
3375
  {
3140
3376
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3141
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3377
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3142
3378
  },
3143
3379
  ]),
3144
3380
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
3145
3381
  // Entity Definition Loader
3146
- provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-index-C8nsbDAw.mjs').then((m) => m.AXMWorkflowInstanceActivityInstancesPageComponentProvider)),
3147
- provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-index-B0-OPKmr.mjs').then((m) => m.AXMWorkflowDefinitionActivitiesPageComponentProvider)),
3382
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-workflow-instance-activity-instances-page-CE7L5ZDi.mjs').then((m) => m.AXMWorkflowInstanceActivityInstancesPageComponentProvider)),
3383
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-workflow-definition-activities-page-DgagKVhS.mjs').then((m) => m.AXMWorkflowDefinitionActivitiesPageComponentProvider)),
3148
3384
  // Automation condition builder: default automation.rules(refType, refId); modules override for their refTypes
3149
3385
  {
3150
3386
  provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
@@ -3226,37 +3462,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3226
3462
  provideQuerySetups([
3227
3463
  {
3228
3464
  key: RootConfig.queries.dashboard.definitionsKpi,
3229
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowDefinitionsKpiQuery),
3465
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowDefinitionsKpiQuery),
3230
3466
  },
3231
3467
  {
3232
3468
  key: RootConfig.queries.dashboard.activitiesKpi,
3233
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowActivitiesKpiQuery),
3469
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowActivitiesKpiQuery),
3234
3470
  },
3235
3471
  {
3236
3472
  key: RootConfig.queries.dashboard.definitionsByStatusBar,
3237
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowDefinitionsByStatusBarQuery),
3473
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowDefinitionsByStatusBarQuery),
3238
3474
  },
3239
3475
  {
3240
3476
  key: RootConfig.queries.dashboard.activitiesByCategoryDonut,
3241
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowActivitiesByCategoryDonutQuery),
3477
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowActivitiesByCategoryDonutQuery),
3242
3478
  },
3243
3479
  {
3244
3480
  key: RootConfig.queries.dashboard.publishedDefinitionsGauge,
3245
- loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries--9NtYkau.mjs').then((c) => c.AXMWorkflowPublishedDefinitionsGaugeQuery),
3481
+ loader: () => import('./acorex-platform-module-workflow-management-client-workflow-live-dashboard.queries-DamdqV3a.mjs').then((c) => c.AXMWorkflowPublishedDefinitionsGaugeQuery),
3246
3482
  },
3247
3483
  ]),
3248
3484
  provideCommandSetups([
3485
+ {
3486
+ key: 'WorkflowManagement.WorkflowTask:PreparedInteraction',
3487
+ command: () => Promise.resolve().then(function () { return preparedWorkflowTask_service; }).then(c => c.PreparedWorkflowTaskCommand),
3488
+ },
3489
+ {
3490
+ key: 'WorkflowManagement.WorkflowTask:ExecuteAction',
3491
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs').then(c => c.ExecuteWorkflowTaskActionCommand),
3492
+ },
3249
3493
  {
3250
3494
  key: 'WorkflowManagement.WorkflowDefinition:ExecuteWithInput',
3251
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-BFdyJ4rC.mjs').then((c) => c.ExecuteWorkflowWithInputCommand),
3495
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs').then((c) => c.ExecuteWorkflowWithInputCommand),
3252
3496
  },
3253
3497
  {
3254
3498
  key: 'WorkflowManagement.WorkflowDefinition:Execute',
3255
- command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs').then((c) => c.ExecuteWorkflowCommand),
3499
+ command: () => import('./acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs').then((c) => c.ExecuteWorkflowCommand),
3256
3500
  },
3257
3501
  {
3258
3502
  key: 'WorkflowManagement.WorkflowDefinition:Activities:Save',
3259
- command: () => import('./acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-spFF77AO.mjs').then((c) => c.SaveWorkflowDefinitionActivitiesCommand),
3503
+ command: () => import('./acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-CvFHyST8.mjs').then((c) => c.SaveWorkflowDefinitionActivitiesCommand),
3260
3504
  },
3261
3505
  {
3262
3506
  key: 'workflow-activity:show-toast',
@@ -3296,29 +3540,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3296
3540
  },
3297
3541
  {
3298
3542
  key: 'WorkflowManagement.WorkflowRun:Continue',
3299
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ContinueWorkflowRunCommand),
3543
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ContinueWorkflowRunCommand),
3300
3544
  },
3301
3545
  {
3302
3546
  key: 'WorkflowManagement.WorkflowRun:CancelRun',
3303
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.CancelWorkflowRunCommand),
3547
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.CancelWorkflowRunCommand),
3304
3548
  },
3305
3549
  {
3306
3550
  key: 'WorkflowManagement.WorkflowRun:TakeOver',
3307
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3551
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.TakeOverWorkflowRunCommand),
3308
3552
  },
3309
3553
  {
3310
3554
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3311
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3555
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3312
3556
  },
3313
3557
  {
3314
3558
  key: 'WorkflowManagement.WorkflowRun:ShowHistory',
3315
- command: () => import('./acorex-platform-module-workflow-management-client-index-BkJuXaZn.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3559
+ command: () => import('./acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs').then((c) => c.ShowWorkflowRunHistoryCommand),
3316
3560
  },
3317
3561
  ]),
3318
3562
  // provideEntity([RootConfig.entities.activityDefinition.fullName]),
3319
3563
  // Entity Definition Loader
3320
- provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-index-C8nsbDAw.mjs').then((m) => m.AXMWorkflowInstanceActivityInstancesPageComponentProvider)),
3321
- provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-index-B0-OPKmr.mjs').then((m) => m.AXMWorkflowDefinitionActivitiesPageComponentProvider)),
3564
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-workflow-instance-activity-instances-page-CE7L5ZDi.mjs').then((m) => m.AXMWorkflowInstanceActivityInstancesPageComponentProvider)),
3565
+ provideLazyProvider(AXP_PAGE_COMPONENT_PROVIDER, () => import('./acorex-platform-module-workflow-management-client-workflow-definition-activities-page-DgagKVhS.mjs').then((m) => m.AXMWorkflowDefinitionActivitiesPageComponentProvider)),
3322
3566
  // Automation condition builder: default automation.rules(refType, refId); modules override for their refTypes
3323
3567
  {
3324
3568
  provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER,
@@ -3388,147 +3632,432 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
3388
3632
  }]
3389
3633
  }] });
3390
3634
 
3391
- //#endregion
3392
- //#region ----- Service -----
3393
- /**
3394
- * Shared suspended {@link WorkflowManagement.WorkflowInstance} query for task-board providers.
3395
- * One API round-trip serves all per-definition workflow task providers.
3396
- */
3397
- class AXPWorkflowTaskInstanceQueryService {
3635
+ /** Module-owned descriptors use the shared query cache, entity reads, drafts and command outbox. */
3636
+ class PreparedWorkflowTaskService {
3398
3637
  constructor() {
3399
- this.entityService = inject(AXPEntityService);
3400
- this.destroyRef = inject(DestroyRef);
3401
- this.eventService = inject(AXPBroadcastEventService);
3402
- this.workflowInstanceData = this.entityService
3403
- .withEntity('WorkflowManagement', 'WorkflowInstance')
3404
- .data();
3405
- this.cacheTtlMs = 5_000;
3406
- this.cachedInstances = null;
3407
- this.cacheExpiresAt = 0;
3408
- this.inFlight = null;
3409
- this.eventService
3410
- .listen('task-board.refresh')
3411
- .pipe(takeUntilDestroyed(this.destroyRef))
3412
- .subscribe(() => {
3413
- this.invalidate();
3414
- });
3415
- this.eventService
3416
- .listen('task-board.invalidate-task-cache')
3417
- .pipe(takeUntilDestroyed(this.destroyRef))
3418
- .subscribe(() => {
3419
- this.invalidate();
3420
- });
3638
+ this.commands = inject(AXPCommandService);
3639
+ this.interactions = inject(AXPPreparedInteractionService);
3640
+ this.toast = inject(AXToastService);
3641
+ this.translation = inject(AXTranslationService);
3421
3642
  }
3422
- invalidate() {
3423
- this.cachedInstances = null;
3424
- this.cacheExpiresAt = 0;
3425
- this.inFlight = null;
3643
+ async read(input, config) {
3644
+ return this.interactions.read(config.prepareQuery, input, task => task.instanceId === input.instanceId && task.activityId === input.activityId);
3426
3645
  }
3427
- /**
3428
- * Returns suspended workflow instances, optionally scoped to one definition.
3429
- * The underlying entity query always loads the full suspended set once per cache window.
3430
- */
3431
- async getSuspendedInstances(definitionId) {
3432
- const instances = await this.loadAllSuspendedInstances();
3433
- if (!definitionId) {
3434
- return instances;
3435
- }
3436
- return instances.filter((instance) => instance.definitionId === definitionId);
3646
+ async prepare(input, config) {
3647
+ const result = await this.interactions.prepare(config.prepareQuery, input, task => task.instanceId === input.instanceId && task.activityId === input.activityId);
3648
+ await this.message(result === 'offline' ? 'prepare-online' : 'prepared', result === 'offline' ? 'warning' : 'success');
3437
3649
  }
3438
- async loadAllSuspendedInstances() {
3439
- const now = Date.now();
3440
- if (this.cachedInstances && this.cacheExpiresAt > now) {
3441
- return this.cachedInstances;
3650
+ async open(input, config) {
3651
+ const task = await this.read(input, config);
3652
+ const existing = await this.interactions.submissionState(task.draftKey, task.revision);
3653
+ if (existing) {
3654
+ await this.message(existing, 'primary');
3655
+ return true;
3442
3656
  }
3443
- if (this.inFlight) {
3444
- return this.inFlight;
3657
+ const answer = await this.commands.execute(task.open.command, task.open.input);
3658
+ if (!answer?.success || answer.kind !== 'object' || !answer.data || typeof answer.data !== 'object') {
3659
+ if (answer?.message)
3660
+ console.warn('[PreparedWorkflowTask] Viewer did not complete', answer.message);
3661
+ return false;
3445
3662
  }
3446
- const baseFilter = {
3447
- logic: 'and',
3448
- filters: [
3449
- {
3450
- field: 'subStatus',
3451
- operator: { type: 'equal' },
3452
- value: 'Suspended',
3453
- },
3454
- ],
3455
- };
3456
- this.inFlight = this.workflowInstanceData
3457
- .query({
3458
- skip: 0,
3459
- take: 5000,
3460
- filter: baseFilter,
3461
- })
3462
- .then((page) => {
3463
- this.cachedInstances = page.items ?? [];
3464
- this.cacheExpiresAt = Date.now() + this.cacheTtlMs;
3465
- return this.cachedInstances;
3466
- })
3467
- .finally(() => {
3468
- this.inFlight = null;
3469
- });
3470
- return this.inFlight;
3663
+ const state = await this.interactions.submit(task.draftKey, task.revision, config.submitCommand, input, answer.data);
3664
+ if (state === 'failed') {
3665
+ await this.message('failed', 'danger');
3666
+ return false;
3667
+ }
3668
+ await this.message(state, 'success');
3669
+ return true;
3471
3670
  }
3472
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3473
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, providedIn: 'root' }); }
3671
+ async retry(input, config) {
3672
+ const state = await this.interactions.retry(config.submitCommand, input);
3673
+ if (state)
3674
+ await this.message(state, state === 'failed' ? 'warning' : 'success');
3675
+ }
3676
+ async message(key, color) {
3677
+ this.toast.show({ color, content: await this.translation.translateAsync(`@workflow-management:tasks.offline.${key}`) });
3678
+ }
3679
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3680
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskService, providedIn: 'root' }); }
3474
3681
  }
3475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, decorators: [{
3682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskService, decorators: [{
3476
3683
  type: Injectable,
3477
3684
  args: [{ providedIn: 'root' }]
3478
- }], ctorParameters: () => [] });
3479
-
3480
- //#region ---- Imports ----
3481
- //#endregion
3482
- //#region ---- Expression scope ----
3483
- /** Maps persisted {@link AXPWorkflowState} to the workflow expression evaluation scope. */
3484
- function buildWorkflowTaskExpressionScope(workflowState, expressionScopeService) {
3485
- const properties = workflowState?.properties ?? {};
3486
- const outputs = {};
3487
- if (properties['__lastActivityOutput'] !== undefined) {
3488
- outputs['last'] = properties['__lastActivityOutput'];
3685
+ }] });
3686
+ class PreparedWorkflowTaskCommand {
3687
+ constructor() {
3688
+ this.tasks = inject(PreparedWorkflowTaskService);
3689
+ }
3690
+ async execute(action) {
3691
+ const input = { instanceId: action.instanceId, activityId: action.activityId };
3692
+ switch (action.operation) {
3693
+ case 'open':
3694
+ if (!(await this.tasks.open(input, action)))
3695
+ return { success: false };
3696
+ break;
3697
+ case 'prepare':
3698
+ await this.tasks.prepare(input, action);
3699
+ break;
3700
+ case 'retry':
3701
+ await this.tasks.retry(input, action);
3702
+ break;
3703
+ default:
3704
+ return { success: false };
3705
+ }
3706
+ return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };
3489
3707
  }
3490
- return expressionScopeService.buildScope({
3491
- inputs: workflowState?.input ?? {},
3492
- variables: properties,
3493
- outputs,
3494
- });
3708
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3709
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskCommand, providedIn: 'root' }); }
3710
+ }
3711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: PreparedWorkflowTaskCommand, decorators: [{
3712
+ type: Injectable,
3713
+ args: [{ providedIn: 'root' }]
3714
+ }] });
3715
+
3716
+ var preparedWorkflowTask_service = /*#__PURE__*/Object.freeze({
3717
+ __proto__: null,
3718
+ PreparedWorkflowTaskCommand: PreparedWorkflowTaskCommand,
3719
+ PreparedWorkflowTaskService: PreparedWorkflowTaskService
3720
+ });
3721
+
3722
+ /** Project workflow display references through the shared entity data boundary. */
3723
+ class WorkflowTaskReferenceReadService {
3724
+ constructor() {
3725
+ this.entities = inject(AXPEntityService);
3726
+ this.session = inject(AXPSessionService);
3727
+ }
3728
+ async read(entity, id, fields) {
3729
+ const currentScope = () => JSON.stringify([this.session.tenant?.id, this.session.user?.id, this.session.application?.id, this.session.authorizationRevision]);
3730
+ const scope = currentScope(), projection = fields?.length ? [...new Set(['id', ...fields])].sort() : undefined;
3731
+ const [module, name] = entity.split('.'), data = this.entities.withEntity(module, name).data();
3732
+ const row = projection ? (await data.query({ skip: 0, take: 1, fields: projection, filter: { logic: 'and', filters: [{ field: 'id', operator: { type: 'equal' }, value: id }] } })).items[0] ?? null : await data.byKey(id);
3733
+ return scope === currentScope() ? cloneDeep$1(row) : null;
3734
+ }
3735
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: WorkflowTaskReferenceReadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3736
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: WorkflowTaskReferenceReadService, providedIn: 'root' }); }
3737
+ }
3738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: WorkflowTaskReferenceReadService, decorators: [{
3739
+ type: Injectable,
3740
+ args: [{ providedIn: 'root' }]
3741
+ }] });
3742
+
3743
+ //#region ----- Types -----
3744
+ function isRecord$1(value) {
3745
+ return value != null && typeof value === 'object' && !Array.isArray(value);
3746
+ }
3747
+ function resolveText(value) {
3748
+ return typeof value === 'string' ? value.trim() : '';
3495
3749
  }
3750
+ /** Workflow / task-board metadata keys that must not replace a business record id. */
3751
+ const TASK_BOARD_META_KEYS = new Set([
3752
+ 'instanceId',
3753
+ 'bookmarkId',
3754
+ 'activityId',
3755
+ 'activityType',
3756
+ 'activityName',
3757
+ 'taskToken',
3758
+ 'entityRefId',
3759
+ 'entityRefType',
3760
+ 'definitionId',
3761
+ 'statusColor',
3762
+ 'entityStatusDefinition',
3763
+ 'entityStatusDefinitionKey',
3764
+ 'hasExplicitDueDate',
3765
+ 'bookmarkConsumed',
3766
+ 'titleKey',
3767
+ 'descriptionKey',
3768
+ 'taskI18nParams',
3769
+ 'payload',
3770
+ 'dueStatus',
3771
+ ]);
3496
3772
  //#endregion
3497
- //#region ---- Workflow state for tasks ----
3498
- async function resolveWorkflowStateForTaskCopy(workflowState, deps) {
3499
- if (!deps.resolveWorkflowStateForTasks) {
3500
- return workflowState;
3773
+ //#region ----- Business record id -----
3774
+ /**
3775
+ * Resolves the business record id for a delegated platform command.
3776
+ * Prefers explicit command `data.id` / `workOrderId`, then bookmark context, then entityRef.
3777
+ * Never returns the workflow instance id or bookmark id.
3778
+ */
3779
+ function resolveBusinessRecordIdFromTaskContext(input) {
3780
+ const fromCommand = resolveText(input.commandData?.['id']) ||
3781
+ resolveText(input.commandData?.['workOrderId']);
3782
+ if (fromCommand) {
3783
+ return fromCommand;
3501
3784
  }
3502
- return deps.resolveWorkflowStateForTasks(workflowState);
3785
+ const context = input.context ?? {};
3786
+ const fromContext = resolveText(context['workOrderId']) ||
3787
+ resolveText(context['id']) ||
3788
+ resolveText(context['documentId']) ||
3789
+ resolveText(context['taskId']) ||
3790
+ resolveText(context['lifecycleEventId']);
3791
+ if (fromContext) {
3792
+ return fromContext;
3793
+ }
3794
+ const refId = resolveText(input.entityRefId ?? input.taskData?.['entityRefId']);
3795
+ const refType = resolveText(input.entityRefType ?? input.taskData?.['entityRefType']);
3796
+ const expected = resolveText(input.expectedEntityRefType);
3797
+ if (refId && (!expected || refType === expected)) {
3798
+ return refId;
3799
+ }
3800
+ return '';
3503
3801
  }
3504
- //#endregion
3505
- //#region ---- Param evaluation (_taskI18n) ----
3506
3802
  /**
3507
- * Evaluates bookmark `context._taskI18n` entries via the workflow expression evaluator.
3508
- * Keep MLS and raw dates in params; resolve and format at display time for locale reactivity.
3803
+ * Builds `options.data` for a delegated platform command so business-record
3804
+ * fields from the action definition / bookmark context are preserved.
3805
+ * Task-board metadata stays alongside (instanceId, bookmarkId, …) without
3806
+ * overwriting `id` with a bookmark or workflow-instance id.
3509
3807
  */
3510
- async function buildWorkflowTaskI18nParams(context, workflowState, expressionScopeService, expressionEvaluator) {
3511
- const params = {};
3512
- const i18n = context?.[AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY];
3513
- if (!i18n || typeof i18n !== 'object' || Array.isArray(i18n)) {
3514
- return params;
3808
+ function buildDelegatedPlatformCommandData(input) {
3809
+ const commandOptions = isRecord$1(input.commandOptions) ? input.commandOptions : {};
3810
+ const nestedData = isRecord$1(commandOptions['data']) ? commandOptions['data'] : {};
3811
+ const context = isRecord$1(input.context) ? input.context : {};
3812
+ const taskData = isRecord$1(input.taskData) ? input.taskData : {};
3813
+ const payload = isRecord$1(taskData['payload']) ? taskData['payload'] : {};
3814
+ const payloadContext = isRecord$1(payload['context']) ? payload['context'] : {};
3815
+ const mergedContext = { ...payloadContext, ...context };
3816
+ const businessId = resolveBusinessRecordIdFromTaskContext({
3817
+ commandData: nestedData,
3818
+ context: mergedContext,
3819
+ taskData,
3820
+ entityRefId: taskData['entityRefId'],
3821
+ entityRefType: taskData['entityRefType'],
3822
+ expectedEntityRefType: input.expectedEntityRefType,
3823
+ });
3824
+ const taskMeta = {};
3825
+ for (const [key, value] of Object.entries(taskData)) {
3826
+ if (TASK_BOARD_META_KEYS.has(key)) {
3827
+ taskMeta[key] = value;
3828
+ }
3515
3829
  }
3516
- const scope = buildWorkflowTaskExpressionScope(workflowState, expressionScopeService);
3517
- for (const [key, value] of Object.entries(i18n)) {
3518
- const evaluated = await expressionEvaluator.evaluate(value, scope);
3519
- if (evaluated != null && evaluated !== '') {
3520
- params[key] = evaluated;
3830
+ const data = {
3831
+ ...nestedData,
3832
+ ...mergedContext,
3833
+ ...taskMeta,
3834
+ };
3835
+ if (businessId) {
3836
+ data['id'] = businessId;
3837
+ if (!resolveText(data['workOrderId']) && (mergedContext['workOrderId'] || nestedData['workOrderId'] || input.expectedEntityRefType)) {
3838
+ data['workOrderId'] = businessId;
3521
3839
  }
3522
3840
  }
3523
- return params;
3841
+ return data;
3524
3842
  }
3525
3843
  //#endregion
3526
- //#region ---- Display normalization ----
3527
- const TASK_I18N_DATE_KEYS = new Set([
3528
- 'startDate',
3529
- 'endDate',
3530
- 'effectiveDate',
3531
- 'dueDate',
3844
+
3845
+ //#region ---- Imports ----
3846
+ //#endregion
3847
+ //#region ---- Rules ----
3848
+ /**
3849
+ * Maps frozen workflow input title strings to their source entity for MLS rehydration.
3850
+ * Used for suspended instances started before start-flow commands preserved MLS on input.
3851
+ */
3852
+ const WORKFLOW_TASK_TITLE_REHYDRATION_RULES = [
3853
+ {
3854
+ titleKey: 'eventTypeTitle',
3855
+ idKey: 'eventTypeId',
3856
+ entity: 'HumanCapitalManagement.LifecycleEventType',
3857
+ },
3858
+ {
3859
+ titleKey: 'leaveTypeTitle',
3860
+ idKey: 'leaveTypeId',
3861
+ entity: 'HumanCapitalManagement.LeaveType',
3862
+ },
3863
+ {
3864
+ titleKey: 'recordTypeTitle',
3865
+ idKey: 'recordTypeId',
3866
+ entity: 'HealthCore.HealthRecordType',
3867
+ },
3868
+ ];
3869
+ //#endregion
3870
+ //#region ---- Rehydration ----
3871
+ function needsTitleRehydration(titleValue, translationService) {
3872
+ if (titleValue == null || titleValue === '') {
3873
+ return false;
3874
+ }
3875
+ if (translationService.isValidMultiLanguageObject(titleValue)) {
3876
+ return false;
3877
+ }
3878
+ return isString(titleValue) && titleValue.trim().length > 0;
3879
+ }
3880
+ /**
3881
+ * Replaces frozen plain-string workflow input titles with MLS from the referenced entity row.
3882
+ * Does not mutate or persist the original workflow state.
3883
+ */
3884
+ async function rehydrateWorkflowStateInputTitles(workflowState, translationService, fetchByKey) {
3885
+ if (!workflowState?.input || typeof workflowState.input !== 'object') {
3886
+ return workflowState;
3887
+ }
3888
+ const input = workflowState.input;
3889
+ const nextInput = { ...input };
3890
+ let patched = false;
3891
+ await Promise.all(WORKFLOW_TASK_TITLE_REHYDRATION_RULES.map(async (rule) => {
3892
+ const titleValue = input[rule.titleKey];
3893
+ if (!needsTitleRehydration(titleValue, translationService)) {
3894
+ return;
3895
+ }
3896
+ const idRaw = input[rule.idKey];
3897
+ const id = idRaw != null && idRaw !== '' ? String(idRaw).trim() : '';
3898
+ if (!id) {
3899
+ return;
3900
+ }
3901
+ try {
3902
+ const row = await fetchByKey(rule.entity, id);
3903
+ const titleField = rule.titleField ?? 'title';
3904
+ const resolvedTitle = get(row, titleField);
3905
+ if (resolvedTitle == null || resolvedTitle === '') {
3906
+ return;
3907
+ }
3908
+ if (translationService.isValidMultiLanguageObject(resolvedTitle) ||
3909
+ (isString(resolvedTitle) && resolvedTitle.trim())) {
3910
+ nextInput[rule.titleKey] = resolvedTitle;
3911
+ patched = true;
3912
+ }
3913
+ }
3914
+ catch {
3915
+ // Keep the frozen title when lookup fails.
3916
+ }
3917
+ }));
3918
+ if (!patched) {
3919
+ return workflowState;
3920
+ }
3921
+ return {
3922
+ ...workflowState,
3923
+ input: nextInput,
3924
+ };
3925
+ }
3926
+ //#endregion
3927
+
3928
+ /** One filtered, paged query for all selected workflow providers. No full execution rows. */
3929
+ class AXPWorkflowTaskInstanceQueryService {
3930
+ constructor() {
3931
+ this.queries = inject(AXPQueryService);
3932
+ this.session = inject(AXPSessionService);
3933
+ this.locale = inject(AXLocaleService);
3934
+ this.refresh = inject(AXPDataRefreshService);
3935
+ this.revision = 0;
3936
+ const events = inject(AXPBroadcastEventService);
3937
+ const destroyRef = inject(DestroyRef);
3938
+ const invalidate = () => {
3939
+ this.revision++;
3940
+ void this.refresh.query(WORKFLOW_TASK_BOARD_QUERY);
3941
+ };
3942
+ merge$1(this.session.user$, this.session.tenant$, this.session.application$, this.session.authorizationRevision$, this.session.isReadyForAppScopedApi$)
3943
+ .pipe(takeUntilDestroyed(destroyRef)).subscribe(() => {
3944
+ const scope = this.scopeKey();
3945
+ if (scope !== this.lastScope) {
3946
+ this.lastScope = scope;
3947
+ invalidate();
3948
+ }
3949
+ });
3950
+ events.listen('task-board.invalidate-task-cache').pipe(takeUntilDestroyed(destroyRef)).subscribe(() => {
3951
+ invalidate();
3952
+ });
3953
+ const entityEvents = inject(AXPEntityBroadcastService);
3954
+ const dependencies = new Set(['WorkflowManagement.WorkflowInstance', 'WorkflowManagement.WorkflowDefinition', 'TaskManagement.Task', 'TaskManagement.TaskAssignment', 'TaskManagement.TaskStatus']);
3955
+ merge$1(entityEvents.listenCreated(), entityEvents.listenModified(), entityEvents.listenDeleted(), entityEvents.listenLayoutRefresh())
3956
+ .pipe(takeUntilDestroyed(destroyRef)).subscribe(({ data }) => { if (dependencies.has(data?.name))
3957
+ invalidate(); });
3958
+ }
3959
+ async getTasks(sources, options = {}) {
3960
+ const today = new Date();
3961
+ today.setHours(0, 0, 0, 0);
3962
+ const tomorrow = new Date(today);
3963
+ tomorrow.setDate(tomorrow.getDate() + 1);
3964
+ const afterTomorrow = new Date(tomorrow);
3965
+ afterTomorrow.setDate(afterTomorrow.getDate() + 1);
3966
+ const weekEnd = new Date(today);
3967
+ const startsOn = this.locale.activeProfile()?.calendar?.week?.startsOn ?? 0;
3968
+ weekEnd.setDate(weekEnd.getDate() + 6 - (weekEnd.getDay() - startsOn + 7) % 7);
3969
+ weekEnd.setHours(23, 59, 59, 999);
3970
+ const input = {
3971
+ sources, skip: options.skip ?? 0, take: options.take ?? 5000,
3972
+ assigneeIds: options.assigneeIds, reporterIds: options.reporterIds,
3973
+ priorities: options.priorities, dueStatusKeys: options.dueStatusKeys,
3974
+ subjectRefTypes: options.subjectRefTypes, subjectRefIds: options.subjectRefIds, tags: options.tags,
3975
+ range: options.range?.from && options.range?.end ? { from: options.range.from.toISOString(), end: options.range.end.toISOString() } : undefined,
3976
+ calendar: { today: today.toISOString(), tomorrow: tomorrow.toISOString(), dayAfterTomorrow: afterTomorrow.toISOString(), weekEnd: weekEnd.toISOString() },
3977
+ };
3978
+ const scope = () => this.scopeKey();
3979
+ const initialScope = scope();
3980
+ if (this.lastScope !== initialScope || this.session.isReadyForAppScopedApi === false) {
3981
+ this.lastScope = initialScope;
3982
+ this.revision++;
3983
+ }
3984
+ if (this.session.isReadyForAppScopedApi === false)
3985
+ return { items: [], total: 0 };
3986
+ // Empty filters and reordered selections have identical query semantics.
3987
+ for (const field of ['assigneeIds', 'reporterIds', 'priorities', 'dueStatusKeys', 'subjectRefTypes', 'subjectRefIds', 'tags']) {
3988
+ const values = input[field];
3989
+ Object.assign(input, { [field]: values?.length ? [...new Set(values.map(String))].sort() : undefined });
3990
+ }
3991
+ const revision = this.revision;
3992
+ const result = await this.queries.fetch(WORKFLOW_TASK_BOARD_QUERY, input, { snapshot: false });
3993
+ const page = runtimeQueryPayloadData(result);
3994
+ if (!page)
3995
+ throw new Error('Failed to load workflow tasks.');
3996
+ return initialScope === scope() && revision === this.revision ? cloneDeep$1(page) : { items: [], total: 0 };
3997
+ }
3998
+ scopeKey() {
3999
+ return JSON.stringify([this.session.tenant?.id, this.session.user?.id, this.session.application?.id, this.session.authorizationRevision, this.session.isReadyForAppScopedApi]);
4000
+ }
4001
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4002
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, providedIn: 'root' }); }
4003
+ }
4004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPWorkflowTaskInstanceQueryService, decorators: [{
4005
+ type: Injectable,
4006
+ args: [{ providedIn: 'root' }]
4007
+ }], ctorParameters: () => [] });
4008
+
4009
+ //#region ---- Imports ----
4010
+ //#endregion
4011
+ //#region ---- Expression scope ----
4012
+ /** Maps persisted {@link AXPWorkflowState} to the workflow expression evaluation scope. */
4013
+ function buildWorkflowTaskExpressionScope(workflowState, expressionScopeService) {
4014
+ const properties = workflowState?.properties ?? {};
4015
+ const outputs = {};
4016
+ if (properties['__lastActivityOutput'] !== undefined) {
4017
+ outputs['last'] = properties['__lastActivityOutput'];
4018
+ }
4019
+ return expressionScopeService.buildScope({
4020
+ inputs: workflowState?.input ?? {},
4021
+ variables: properties,
4022
+ outputs,
4023
+ });
4024
+ }
4025
+ //#endregion
4026
+ //#region ---- Workflow state for tasks ----
4027
+ async function resolveWorkflowStateForTaskCopy(workflowState, deps) {
4028
+ if (!deps.resolveWorkflowStateForTasks) {
4029
+ return workflowState;
4030
+ }
4031
+ return deps.resolveWorkflowStateForTasks(workflowState);
4032
+ }
4033
+ //#endregion
4034
+ //#region ---- Param evaluation (_taskI18n) ----
4035
+ /**
4036
+ * Evaluates bookmark `context._taskI18n` entries via the workflow expression evaluator.
4037
+ * Keep MLS and raw dates in params; resolve and format at display time for locale reactivity.
4038
+ */
4039
+ async function buildWorkflowTaskI18nParams(context, workflowState, expressionScopeService, expressionEvaluator) {
4040
+ const params = {};
4041
+ const i18n = context?.[AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY];
4042
+ if (!i18n || typeof i18n !== 'object' || Array.isArray(i18n)) {
4043
+ return params;
4044
+ }
4045
+ const scope = buildWorkflowTaskExpressionScope(workflowState, expressionScopeService);
4046
+ for (const [key, value] of Object.entries(i18n)) {
4047
+ const evaluated = await expressionEvaluator.evaluate(value, scope);
4048
+ if (evaluated != null && evaluated !== '') {
4049
+ params[key] = evaluated;
4050
+ }
4051
+ }
4052
+ return params;
4053
+ }
4054
+ //#endregion
4055
+ //#region ---- Display normalization ----
4056
+ const TASK_I18N_DATE_KEYS = new Set([
4057
+ 'startDate',
4058
+ 'endDate',
4059
+ 'effectiveDate',
4060
+ 'dueDate',
3532
4061
  'occurredDate',
3533
4062
  ]);
3534
4063
  function isDateLikeString(value) {
@@ -3673,192 +4202,6 @@ async function buildWorkflowTaskDisplayParamsFromWorkflowState(workflowState, de
3673
4202
  }
3674
4203
  //#endregion
3675
4204
 
3676
- //#region ---- Imports ----
3677
- //#endregion
3678
- //#region ---- Rules ----
3679
- /**
3680
- * Maps frozen workflow input title strings to their source entity for MLS rehydration.
3681
- * Used for suspended instances started before start-flow commands preserved MLS on input.
3682
- */
3683
- const WORKFLOW_TASK_TITLE_REHYDRATION_RULES = [
3684
- {
3685
- titleKey: 'eventTypeTitle',
3686
- idKey: 'eventTypeId',
3687
- entity: 'HumanCapitalManagement.LifecycleEventType',
3688
- },
3689
- {
3690
- titleKey: 'leaveTypeTitle',
3691
- idKey: 'leaveTypeId',
3692
- entity: 'HumanCapitalManagement.LeaveType',
3693
- },
3694
- {
3695
- titleKey: 'recordTypeTitle',
3696
- idKey: 'recordTypeId',
3697
- entity: 'HealthCore.HealthRecordType',
3698
- },
3699
- ];
3700
- //#endregion
3701
- //#region ---- Rehydration ----
3702
- function needsTitleRehydration(titleValue, translationService) {
3703
- if (titleValue == null || titleValue === '') {
3704
- return false;
3705
- }
3706
- if (translationService.isValidMultiLanguageObject(titleValue)) {
3707
- return false;
3708
- }
3709
- return isString(titleValue) && titleValue.trim().length > 0;
3710
- }
3711
- /**
3712
- * Replaces frozen plain-string workflow input titles with MLS from the referenced entity row.
3713
- * Does not mutate or persist the original workflow state.
3714
- */
3715
- async function rehydrateWorkflowStateInputTitles(workflowState, translationService, fetchByKey) {
3716
- if (!workflowState?.input || typeof workflowState.input !== 'object') {
3717
- return workflowState;
3718
- }
3719
- const input = workflowState.input;
3720
- const nextInput = { ...input };
3721
- let patched = false;
3722
- await Promise.all(WORKFLOW_TASK_TITLE_REHYDRATION_RULES.map(async (rule) => {
3723
- const titleValue = input[rule.titleKey];
3724
- if (!needsTitleRehydration(titleValue, translationService)) {
3725
- return;
3726
- }
3727
- const idRaw = input[rule.idKey];
3728
- const id = idRaw != null && idRaw !== '' ? String(idRaw).trim() : '';
3729
- if (!id) {
3730
- return;
3731
- }
3732
- try {
3733
- const row = await fetchByKey(rule.entity, id);
3734
- const titleField = rule.titleField ?? 'title';
3735
- const resolvedTitle = get(row, titleField);
3736
- if (resolvedTitle == null || resolvedTitle === '') {
3737
- return;
3738
- }
3739
- if (translationService.isValidMultiLanguageObject(resolvedTitle) ||
3740
- (isString(resolvedTitle) && resolvedTitle.trim())) {
3741
- nextInput[rule.titleKey] = resolvedTitle;
3742
- patched = true;
3743
- }
3744
- }
3745
- catch {
3746
- // Keep the frozen title when lookup fails.
3747
- }
3748
- }));
3749
- if (!patched) {
3750
- return workflowState;
3751
- }
3752
- return {
3753
- ...workflowState,
3754
- input: nextInput,
3755
- };
3756
- }
3757
- //#endregion
3758
-
3759
- //#region ----- Types -----
3760
- function isRecord$1(value) {
3761
- return value != null && typeof value === 'object' && !Array.isArray(value);
3762
- }
3763
- function resolveText(value) {
3764
- return typeof value === 'string' ? value.trim() : '';
3765
- }
3766
- /** Workflow / task-board metadata keys that must not replace a business record id. */
3767
- const TASK_BOARD_META_KEYS = new Set([
3768
- 'instanceId',
3769
- 'bookmarkId',
3770
- 'activityId',
3771
- 'activityType',
3772
- 'activityName',
3773
- 'taskToken',
3774
- 'entityRefId',
3775
- 'entityRefType',
3776
- 'definitionId',
3777
- 'statusColor',
3778
- 'entityStatusDefinition',
3779
- 'entityStatusDefinitionKey',
3780
- 'hasExplicitDueDate',
3781
- 'bookmarkConsumed',
3782
- 'titleKey',
3783
- 'descriptionKey',
3784
- 'taskI18nParams',
3785
- 'payload',
3786
- 'dueStatus',
3787
- ]);
3788
- //#endregion
3789
- //#region ----- Business record id -----
3790
- /**
3791
- * Resolves the business record id for a delegated platform command.
3792
- * Prefers explicit command `data.id` / `workOrderId`, then bookmark context, then entityRef.
3793
- * Never returns the workflow instance id or bookmark id.
3794
- */
3795
- function resolveBusinessRecordIdFromTaskContext(input) {
3796
- const fromCommand = resolveText(input.commandData?.['id']) ||
3797
- resolveText(input.commandData?.['workOrderId']);
3798
- if (fromCommand) {
3799
- return fromCommand;
3800
- }
3801
- const context = input.context ?? {};
3802
- const fromContext = resolveText(context['workOrderId']) ||
3803
- resolveText(context['id']) ||
3804
- resolveText(context['documentId']) ||
3805
- resolveText(context['taskId']) ||
3806
- resolveText(context['lifecycleEventId']);
3807
- if (fromContext) {
3808
- return fromContext;
3809
- }
3810
- const refId = resolveText(input.entityRefId ?? input.taskData?.['entityRefId']);
3811
- const refType = resolveText(input.entityRefType ?? input.taskData?.['entityRefType']);
3812
- const expected = resolveText(input.expectedEntityRefType);
3813
- if (refId && (!expected || refType === expected)) {
3814
- return refId;
3815
- }
3816
- return '';
3817
- }
3818
- /**
3819
- * Builds `options.data` for a delegated platform command so business-record
3820
- * fields from the action definition / bookmark context are preserved.
3821
- * Task-board metadata stays alongside (instanceId, bookmarkId, …) without
3822
- * overwriting `id` with a bookmark or workflow-instance id.
3823
- */
3824
- function buildDelegatedPlatformCommandData(input) {
3825
- const commandOptions = isRecord$1(input.commandOptions) ? input.commandOptions : {};
3826
- const nestedData = isRecord$1(commandOptions['data']) ? commandOptions['data'] : {};
3827
- const context = isRecord$1(input.context) ? input.context : {};
3828
- const taskData = isRecord$1(input.taskData) ? input.taskData : {};
3829
- const payload = isRecord$1(taskData['payload']) ? taskData['payload'] : {};
3830
- const payloadContext = isRecord$1(payload['context']) ? payload['context'] : {};
3831
- const mergedContext = { ...payloadContext, ...context };
3832
- const businessId = resolveBusinessRecordIdFromTaskContext({
3833
- commandData: nestedData,
3834
- context: mergedContext,
3835
- taskData,
3836
- entityRefId: taskData['entityRefId'],
3837
- entityRefType: taskData['entityRefType'],
3838
- expectedEntityRefType: input.expectedEntityRefType,
3839
- });
3840
- const taskMeta = {};
3841
- for (const [key, value] of Object.entries(taskData)) {
3842
- if (TASK_BOARD_META_KEYS.has(key)) {
3843
- taskMeta[key] = value;
3844
- }
3845
- }
3846
- const data = {
3847
- ...nestedData,
3848
- ...mergedContext,
3849
- ...taskMeta,
3850
- };
3851
- if (businessId) {
3852
- data['id'] = businessId;
3853
- if (!resolveText(data['workOrderId']) && (mergedContext['workOrderId'] || nestedData['workOrderId'] || input.expectedEntityRefType)) {
3854
- data['workOrderId'] = businessId;
3855
- }
3856
- }
3857
- return data;
3858
- }
3859
- //#endregion
3860
-
3861
- //#region ---- Imports ----
3862
4205
  /**
3863
4206
  * Injection token for provider config. Use when registering via DI (provide token + useFactory with deps).
3864
4207
  * Prefer {@link provideGenericWorkflowTaskProvider} (dynamic import) instead of a static class import in NgModule providers.
@@ -3872,20 +4215,18 @@ function isRecord(value) {
3872
4215
  /**
3873
4216
  * Generic Workflow Task Provider
3874
4217
  *
3875
- * Provides tasks from Workflow Instances directly (no Work Items).
3876
- * Queries suspended workflow instances and extracts tasks from bookmarks.
4218
+ * Displays the server's filtered, paged projection of active workflow bookmarks.
3877
4219
  *
3878
4220
  * Create one provider per workflow definition by passing a config (name, title, definitionId).
3879
4221
  * E.g. leave request: { name: 'leave-request-workflow-tasks', title: 'Leave Request', definitionId: 'LeaveRequestWorkflow' }
3880
4222
  *
3881
4223
  * Architecture:
3882
- * - Queries Workflow Instances with subStatus = 'Suspended'
3883
- * - Filters by config.definitionId when set (one provider = one definition)
3884
- * - Extracts active bookmarks for each instance
3885
- * - Parses bookmark payload for assignment/actions
4224
+ * - Groups workflow providers into one TaskBoard query
4225
+ * - Server filters definitions, assignment, priority and dates before pagination
4226
+ * - Keeps action context/tokens while execution state stays on the server
3886
4227
  * - Maps to task board format
3887
4228
  */
3888
- class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4229
+ class AXPGenericWorkflowTaskProvider extends AXPWorkBoardProvider {
3889
4230
  //#endregion
3890
4231
  //#region ---- Constructor ----
3891
4232
  constructor(config) {
@@ -3894,7 +4235,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
3894
4235
  //#region ---- Services & Dependencies ----
3895
4236
  this.entityService = inject(AXPEntityService);
3896
4237
  this.workflowInstanceQuery = inject(AXPWorkflowTaskInstanceQueryService);
3897
- this.userEntityData = this.entityService.withEntity('SecurityManagement', 'User').data();
4238
+ this.referenceReads = inject(WorkflowTaskReferenceReadService);
3898
4239
  this.translationService = inject(AXTranslationService);
3899
4240
  this.formatService = inject(AXFormatService);
3900
4241
  this.settingsService = inject(AXPSettingsService);
@@ -3903,18 +4244,18 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
3903
4244
  this.workflowDefinitionService = inject(AXPWorkflowDefinitionService);
3904
4245
  this.workflowManager = inject(AXPWorkflowManager);
3905
4246
  this.humanTaskService = inject(AXPWorkflowInstanceHumanTaskService);
4247
+ this.preparedTasks = inject(PreparedWorkflowTaskService);
3906
4248
  this.sessionService = inject(AXPSessionService);
3907
4249
  this.toastService = inject(AXToastService);
3908
4250
  this.commandService = inject(AXPCommandService);
3909
4251
  this.dueStatusProviderService = inject(AXPDueStatusProviderService);
3910
4252
  this.expressionScopeService = inject(WorkflowExpressionScopeService);
3911
4253
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
4254
+ //#endregion
4255
+ //#region ---- Cache State ----
4256
+ /** Primary entity type (with status plugin) inferred from the workflow definition. */
3912
4257
  /** Per-provider caches (one instance per workflow definition). */
3913
- this.entityDefinitionCache = new Map();
3914
4258
  this.statusDefinitionKeyByEntityType = new Map();
3915
- this.statusProviderByDefinitionKey = new Map();
3916
- this.userReferenceCache = new Map();
3917
- this.entityStatusIdCache = new Map();
3918
4259
  this.config = config;
3919
4260
  }
3920
4261
  //#endregion
@@ -3935,11 +4276,6 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
3935
4276
  }
3936
4277
  //#endregion
3937
4278
  //#region ---- Bookmark Helpers ----
3938
- /** Bookmark types shown on the workflow task board. */
3939
- isTaskBoardBookmarkPayload(payload) {
3940
- const t = payload.activityType;
3941
- return t === 'workflow-activity:human-task' || t === 'workflow-activity:cartable';
3942
- }
3943
4279
  /** Pooled task: must be claimed before submit/cancel (cartable, or human-task with candidates only). */
3944
4280
  isPooledClaimablePayload(payload) {
3945
4281
  const assigned = this.normalizeUserIdList(payload.assignedUserIds);
@@ -4029,88 +4365,37 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4029
4365
  * - definitionId (if provided in filter)
4030
4366
  * - assignee/claimant (if filter provided)
4031
4367
  *
4032
- * Then extracts active bookmarks and maps to task board format.
4368
+ * The server extracts active bookmarks and returns one filtered page.
4033
4369
  */
4034
4370
  async getTasks(options) {
4035
- const instances = await this.workflowInstanceQuery.getSuspendedInstances(this.config.definitionId);
4036
- // Extract tasks from bookmarks for each instance
4037
- const tasks = [];
4038
- for (const instance of instances) {
4039
- try {
4040
- // Get active bookmarks from instance entity (workflowInstance.bookmarks)
4041
- const bookmarks = this.getActiveBookmarksFromInstance(instance);
4042
- // Process each bookmark (typically one per suspended activity)
4043
- for (const bookmark of bookmarks) {
4044
- try {
4045
- // Get payload from entity (payload object or parse payloadJson)
4046
- let payload;
4047
- try {
4048
- const raw = bookmark.payload ?? (bookmark.payloadJson ? JSON.parse(bookmark.payloadJson) : null);
4049
- payload =
4050
- typeof raw === 'object' && raw !== null
4051
- ? raw
4052
- : {};
4053
- }
4054
- catch {
4055
- continue;
4056
- }
4057
- // Task board: human-task and cartable (pooled); exclude other suspended UI bookmarks
4058
- if (!this.isTaskBoardBookmarkPayload(payload)) {
4059
- continue;
4060
- }
4061
- // Check assignment filter if provided
4062
- if (options?.assigneeIds && options.assigneeIds.length > 0) {
4063
- const allUserIds = [
4064
- ...this.normalizeUserIdList(payload.assignedUserIds),
4065
- ...this.normalizeUserIdList(payload.candidateUserIds),
4066
- ];
4067
- // TODO: Also check candidateRoleIds by resolving role members
4068
- if (!matchesTaskBoardAssigneeUserIdsFilter(allUserIds, options.assigneeIds)) {
4069
- continue;
4070
- }
4071
- }
4072
- if (options?.reporterIds && options.reporterIds.length > 0) {
4073
- const initiatorId = getWorkflowInstanceInitiatorUserId(instance);
4074
- const reporterSet = new Set(options.reporterIds.map(String));
4075
- if (!initiatorId || !reporterSet.has(initiatorId)) {
4076
- continue;
4077
- }
4078
- }
4079
- // Map bookmark to task
4080
- const task = await this.mapBookmarkToTask(instance, bookmark, payload);
4081
- tasks.push(task);
4082
- }
4083
- catch {
4084
- // Skip this bookmark and continue
4085
- }
4086
- }
4087
- }
4088
- catch {
4089
- // Skip this instance and continue
4090
- }
4371
+ return this.getTasksForProviders([this], options);
4372
+ }
4373
+ get taskQueryGroup() { return 'workflow-task-board'; }
4374
+ async getTasksForProviders(providers, options) {
4375
+ const workflowProviders = providers;
4376
+ const page = await this.workflowInstanceQuery.getTasks(workflowProviders.map((provider) => ({
4377
+ provider: provider.name,
4378
+ definitionId: provider.config.definitionId,
4379
+ })), options);
4380
+ const byName = new Map(workflowProviders.map((provider) => [provider.name, provider]));
4381
+ const items = [];
4382
+ for (const row of page.items) {
4383
+ const provider = byName.get(row.provider);
4384
+ if (!provider)
4385
+ continue;
4386
+ items.push({ ...(await provider.mapTaskBoardRow(row)), provider: provider.name });
4091
4387
  }
4092
- const rangeFiltered = filterTasksOverlappingRange(tasks, options?.range);
4093
- const priorityFiltered = options?.priorities && options.priorities.length > 0
4094
- ? rangeFiltered.filter((task) => matchesTaskPriorityFilter(task, options.priorities))
4095
- : rangeFiltered;
4096
- const dueStatusFiltered = options?.dueStatusKeys && options.dueStatusKeys.length > 0
4097
- ? priorityFiltered.filter((task) => matchesTaskDueStatusFilter(task, options.dueStatusKeys))
4098
- : priorityFiltered;
4099
- const total = dueStatusFiltered.length;
4100
- const skip = options?.skip ?? 0;
4101
- const take = options?.take ?? total;
4102
- const items = dueStatusFiltered.slice(skip, skip + take);
4103
- return { items, total };
4388
+ return { items, total: page.total };
4104
4389
  }
4105
- /**
4106
- * Get active (non-consumed) bookmarks from workflow instance entity.
4107
- * Reads from instance.workflowInstance?.bookmarks — no direct DB access.
4108
- */
4109
- getActiveBookmarksFromInstance(instance) {
4110
- const wi = instance?.workflowInstance;
4111
- const bookmarks = wi?.bookmarks ?? [];
4112
- const active = bookmarks.filter((b) => !b.isConsumed && !b.consumed);
4113
- return active;
4390
+ async mapTaskBoardRow(row) {
4391
+ // Compatibility adapter for existing display/status helpers; no execution state is fetched.
4392
+ const instance = {
4393
+ id: row.instanceId, definitionId: row.definitionId, createdAt: row.createdAt, updatedAt: row.updatedAt,
4394
+ entityRefId: row.entityRefId, entityRefType: row.entityRefType,
4395
+ auditInfo: { created: { by: row.creator } },
4396
+ workflowVariablesTable: row.initiatorUserId ? [{ name: 'initiatorUserId', value: row.initiatorUserId }] : [],
4397
+ };
4398
+ return this.mapBookmarkToTask(instance, row.bookmark, row.bookmark.payload, row.linkedTaskStatus);
4114
4399
  }
4115
4400
  //#endregion
4116
4401
  //#region ---- Task Display & Translation ----
@@ -4143,9 +4428,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4143
4428
  * Formats dates for task popover metadata using regional short-date settings.
4144
4429
  */
4145
4430
  async formatDateForTaskDisplay(value) {
4146
- const date = value instanceof Date
4147
- ? value
4148
- : this.parseDateOnlyString(value) ?? this.parseIsoDateString(value);
4431
+ const date = value instanceof Date ? value : (this.parseDateOnlyString(value) ?? this.parseIsoDateString(value));
4149
4432
  if (!date || Number.isNaN(date.getTime())) {
4150
4433
  return typeof value === 'string' ? value.trim() : '';
4151
4434
  }
@@ -4172,19 +4455,16 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4172
4455
  if (!id) {
4173
4456
  return undefined;
4174
4457
  }
4175
- const cached = this.userReferenceCache.get(id);
4176
- if (cached) {
4177
- return cached;
4178
- }
4179
- const load = this.loadUserReference(id);
4180
- this.userReferenceCache.set(id, load);
4181
- return load;
4458
+ return this.loadUserReference(id);
4182
4459
  }
4183
4460
  async loadUserReference(id) {
4461
+ const user = this.sessionService.user;
4462
+ const label = user?.id === id ? [user.displayName, user.fullName, user.username].find(value => typeof value === 'string' && value.trim()) : undefined;
4463
+ const fallback = { id, type: 'user', fullName: typeof label === 'string' ? label.trim() : id };
4184
4464
  try {
4185
- const row = await this.userEntityData.byKey(id);
4465
+ const row = await this.referenceReads.read('SecurityManagement.User', id, ['displayName', 'username']);
4186
4466
  if (!row || typeof row !== 'object') {
4187
- return { id, type: 'user', fullName: id };
4467
+ return fallback;
4188
4468
  }
4189
4469
  const displayName = 'displayName' in row ? String(row.displayName ?? '').trim() : '';
4190
4470
  const username = 'username' in row ? String(row.username ?? '').trim() : '';
@@ -4196,7 +4476,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4196
4476
  return ref;
4197
4477
  }
4198
4478
  catch {
4199
- return { id, type: 'user', fullName: id };
4479
+ return fallback;
4200
4480
  }
4201
4481
  }
4202
4482
  //#endregion
@@ -4208,7 +4488,10 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4208
4488
  expressionEvaluator: this.expressionEvaluator,
4209
4489
  translationService: this.translationService,
4210
4490
  resolveWorkflowStateForTasks: (workflowState) => rehydrateWorkflowStateInputTitles(workflowState, this.translationService, async (entity, id) => {
4211
- const row = await this.entityService.withEntity(entity).data().byKey(id);
4491
+ const row = await this.entityService
4492
+ .withEntity(entity)
4493
+ .data()
4494
+ .byKey(id);
4212
4495
  return row && typeof row === 'object' ? row : null;
4213
4496
  }),
4214
4497
  };
@@ -4216,7 +4499,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4216
4499
  //#endregion
4217
4500
  //#region ---- Task Mapping ----
4218
4501
  /** Map bookmark to task board task format. */
4219
- async mapBookmarkToTask(instance, bookmark, payload) {
4502
+ async mapBookmarkToTask(instance, bookmark, payload, linkedTaskStatus) {
4220
4503
  const dueDateParsed = this.parseBookmarkDueDate(payload.dueDate);
4221
4504
  const hasExplicitDueDate = dueDateParsed != null;
4222
4505
  const instanceCreatedAt = instance.createdAt ? new Date(instance.createdAt) : new Date();
@@ -4234,7 +4517,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4234
4517
  }, this.buildTaskTranslationDeps());
4235
4518
  const assigneeId = this.normalizeUserIdList(payload.assignedUserIds)[0];
4236
4519
  const assignee = await this.resolveAssigneeReference(assigneeId);
4237
- const resolvedStatus = await this.resolveTaskStatus(payload, instance);
4520
+ const resolvedStatus = await this.resolveTaskStatus(payload, instance, linkedTaskStatus);
4238
4521
  const bookmarkConsumed = Boolean(bookmark.isConsumed || bookmark.consumed);
4239
4522
  const baseTask = {
4240
4523
  id: bookmark.id, // Use bookmark ID as task ID
@@ -4313,6 +4596,21 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4313
4596
  const activityId = taskData?.activityId ?? command.options?.['activityId'] ?? command.options?.['stepId'] ?? '';
4314
4597
  const outcome = command.options?.['outcome'] ?? 'Done';
4315
4598
  const userInput = command.options?.['userInput'] ?? {};
4599
+ if (['workflow-offline:prepare', 'workflow-offline:open', 'workflow-offline:retry'].includes(command.name)) {
4600
+ const config = command.options?.['offlineInteraction'];
4601
+ if (!config?.prepareQuery || !config.submitCommand || !instanceId || !activityId)
4602
+ throw new Error('The offline task action is missing its workflow context.');
4603
+ const request = { instanceId: String(instanceId), activityId: String(activityId) };
4604
+ if (command.name === 'workflow-offline:prepare') {
4605
+ await this.preparedTasks.prepare(request, config);
4606
+ return { success: true, kind: 'object', data: undefined };
4607
+ }
4608
+ if (command.name === 'workflow-offline:retry') {
4609
+ await this.preparedTasks.retry(request, config);
4610
+ return { success: true, kind: 'object', data: undefined };
4611
+ }
4612
+ return (await this.preparedTasks.open(request, config)) ? { success: true, kind: 'object', data: undefined } : { success: false };
4613
+ }
4316
4614
  if (command.name === 'WorkflowManagement.WorkflowInstance:ClaimTask') {
4317
4615
  if (!instanceId || !bookmarkId || !activityId) {
4318
4616
  return {
@@ -4347,9 +4645,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4347
4645
  };
4348
4646
  }
4349
4647
  const reassigned = await this.humanTaskService.reassignBookmarkToCurrentUserWithConfirm(instanceId, bookmarkId, activityId);
4350
- return reassigned
4351
- ? { success: true, kind: 'object', data: undefined }
4352
- : { success: false };
4648
+ return reassigned ? { success: true, kind: 'object', data: undefined } : { success: false };
4353
4649
  }
4354
4650
  // Handle workflow resume commands
4355
4651
  if (command.name === 'WorkflowManagement.WorkflowInstance:Resume' || command.name === 'resume-workflow') {
@@ -4405,8 +4701,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4405
4701
  taskData: rowData,
4406
4702
  expectedEntityRefType,
4407
4703
  });
4408
- const documentId = (typeof options['documentId'] === 'string' ? options['documentId'].trim() : '') ||
4409
- (typeof data['documentId'] === 'string' ? String(data['documentId']).trim() : '');
4704
+ const documentId = (typeof options['documentId'] === 'string' ? options['documentId'].trim() : '') || (typeof data['documentId'] === 'string' ? String(data['documentId']).trim() : '');
4410
4705
  const delegated = await this.commandService.execute(command.name, {
4411
4706
  ...options,
4412
4707
  ...(documentId ? { documentId } : {}),
@@ -4473,6 +4768,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4473
4768
  if (this.isDelegatedPlatformCommand(actionName)) {
4474
4769
  const isSignAction = actionName.toLowerCase().includes('sign');
4475
4770
  const isViewDocumentAction = action.name === 'view-document' || actionName.toLowerCase().includes('document:open');
4771
+ const declaredPriority = action.priority;
4476
4772
  const expectedEntityRefType = typeof taskData?.entityRefType === 'string' ? String(taskData.entityRefType).trim() : undefined;
4477
4773
  const delegatedData = buildDelegatedPlatformCommandData({
4478
4774
  commandOptions,
@@ -4485,7 +4781,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4485
4781
  title: this.resolveWorkflowActionTitle(action.title, actionName),
4486
4782
  icon: action.icon,
4487
4783
  color: action.color,
4488
- priority: isSignAction || isViewDocumentAction ? 'primary' : 'secondary',
4784
+ priority: declaredPriority === 'primary' || declaredPriority === 'secondary' ? declaredPriority : isSignAction || isViewDocumentAction ? 'primary' : 'secondary',
4489
4785
  command: {
4490
4786
  name: actionName,
4491
4787
  options: {
@@ -4561,6 +4857,22 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4561
4857
  },
4562
4858
  });
4563
4859
  }
4860
+ const offlineInteraction = payload.context?.['offlineInteraction'];
4861
+ if (offlineInteraction?.prepareQuery && offlineInteraction.submitCommand) {
4862
+ for (const action of actions) {
4863
+ if (action.priority === 'primary' && action.command?.name === 'WorkflowManagement.WorkflowInstance:Resume') {
4864
+ action.command = { ...action.command, name: 'workflow-offline:open', options: { ...action.command.options, offlineInteraction } };
4865
+ }
4866
+ }
4867
+ for (const operation of ['prepare', 'open', 'retry'])
4868
+ actions.push({
4869
+ name: `offline-${operation}`,
4870
+ title: `@workflow-management:tasks.offline.${operation}`,
4871
+ icon: 'fa-light fa-cloud-arrow-down',
4872
+ priority: 'secondary',
4873
+ command: { name: `workflow-offline:${operation}`, options: { instanceId: taskData.instanceId, activityId: taskData.activityId, offlineInteraction } },
4874
+ });
4875
+ }
4564
4876
  this.appendWorkflowMoreMenuActions(actions, taskData, payload);
4565
4877
  return actions;
4566
4878
  }
@@ -4580,8 +4892,14 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4580
4892
  //#endregion
4581
4893
  //#region ---- Entity Status Resolution ----
4582
4894
  /** Resolves task status from bookmark context `statusId` and entity status plugin; falls back to workflow Pending. */
4583
- async resolveTaskStatus(payload, instance) {
4895
+ async resolveTaskStatus(payload, instance, linkedTaskStatus) {
4584
4896
  const context = payload.context;
4897
+ if (linkedTaskStatus !== undefined) {
4898
+ if (!linkedTaskStatus)
4899
+ return this.getWorkflowPendingStatus();
4900
+ const { id, title, color, icon } = linkedTaskStatus;
4901
+ return { id, title: await this.translateStatusTitle(title), color, definition: { name: id, title, color: color ?? 'primary', ...(icon ? { icon } : {}) } };
4902
+ }
4585
4903
  // TaskManagement.Task uses lookup statuses (not a status plugin). Prefer the linked task row.
4586
4904
  const taskId = this.readContextString(context, 'taskId');
4587
4905
  if (taskId && !this.isUnresolvedWorkflowExpression(taskId)) {
@@ -4635,7 +4953,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4635
4953
  */
4636
4954
  async loadTaskRowStatus(taskId) {
4637
4955
  try {
4638
- const row = await this.entityService.withEntity('TaskManagement', 'Task').data().byKey(taskId);
4956
+ const row = await this.referenceReads.read('TaskManagement.Task', taskId);
4639
4957
  if (!row || typeof row !== 'object') {
4640
4958
  return null;
4641
4959
  }
@@ -4698,12 +5016,10 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4698
5016
  * Loads `statusId` from the linked entity row when bookmark context omits or stale-fails it.
4699
5017
  */
4700
5018
  async loadEntityStatusIdFromContext(context, entityType, instance) {
4701
- const contextEntityId = this.readContextString(context, 'lifecycleEventId') ??
4702
- this.readContextString(context, 'taskId');
5019
+ const contextEntityId = this.readContextString(context, 'lifecycleEventId') ?? this.readContextString(context, 'taskId');
4703
5020
  const refType = instance.entityRefType?.trim();
4704
5021
  const refId = instance.entityRefId?.trim();
4705
- const entityId = contextEntityId ??
4706
- (refType === entityType && refId ? refId : null);
5022
+ const entityId = contextEntityId ?? (refType === entityType && refId ? refId : null);
4707
5023
  if (!entityId) {
4708
5024
  return null;
4709
5025
  }
@@ -4713,18 +5029,8 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4713
5029
  * Finds a row of `entityType` linked to this workflow instance (e.g. LifecycleEvent.workflowInfo.instanceId).
4714
5030
  */
4715
5031
  async loadEntityStatusIdByWorkflowInstance(entityType, workflowInstanceId) {
4716
- const instanceId = workflowInstanceId?.trim();
4717
- if (!instanceId) {
4718
- return null;
4719
- }
4720
- const cacheKey = `${entityType}::wi::${instanceId}`;
4721
- const cached = this.entityStatusIdCache.get(cacheKey);
4722
- if (cached) {
4723
- return cached;
4724
- }
4725
- const load = this.fetchEntityStatusIdByWorkflowInstance(entityType, instanceId);
4726
- this.entityStatusIdCache.set(cacheKey, load);
4727
- return load;
5032
+ const id = workflowInstanceId?.trim();
5033
+ return id ? this.fetchEntityStatusIdByWorkflowInstance(entityType, id) : null;
4728
5034
  }
4729
5035
  async fetchEntityStatusIdByWorkflowInstance(entityType, instanceId) {
4730
5036
  const parsed = this.parseQualifiedEntityType(entityType);
@@ -4732,14 +5038,15 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4732
5038
  return null;
4733
5039
  }
4734
5040
  try {
4735
- const { items } = await this.entityService.withEntity(parsed.module, parsed.name).data().query({
5041
+ const { items } = await this.entityService
5042
+ .withEntity(parsed.module, parsed.name)
5043
+ .data()
5044
+ .query({
4736
5045
  skip: 0,
4737
5046
  take: 1,
4738
5047
  filter: {
4739
5048
  logic: 'and',
4740
- filters: [
4741
- { field: AXP_RECORD_WORKFLOW_INFO_INSTANCE_ID_FIELD, operator: { type: 'equal' }, value: instanceId },
4742
- ],
5049
+ filters: [{ field: AXP_RECORD_WORKFLOW_INFO_INSTANCE_ID_FIELD, operator: { type: 'equal' }, value: instanceId }],
4743
5050
  },
4744
5051
  });
4745
5052
  const row = items?.[0];
@@ -4758,14 +5065,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4758
5065
  }
4759
5066
  }
4760
5067
  async loadEntityStatusId(entityType, entityId) {
4761
- const cacheKey = `${entityType}::${entityId}`;
4762
- const cached = this.entityStatusIdCache.get(cacheKey);
4763
- if (cached) {
4764
- return cached;
4765
- }
4766
- const load = this.fetchEntityStatusIdByKey(entityType, entityId);
4767
- this.entityStatusIdCache.set(cacheKey, load);
4768
- return load;
5068
+ return this.fetchEntityStatusIdByKey(entityType, entityId);
4769
5069
  }
4770
5070
  async fetchEntityStatusIdByKey(entityType, entityId) {
4771
5071
  const parsed = this.parseQualifiedEntityType(entityType);
@@ -4852,17 +5152,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4852
5152
  return { module: trimmed.slice(0, dot), name: trimmed.slice(dot + 1) };
4853
5153
  }
4854
5154
  async resolveEntityDefinition(entityType) {
4855
- const key = entityType.trim();
4856
- if (!key) {
4857
- return null;
4858
- }
4859
- const existing = this.entityDefinitionCache.get(key);
4860
- if (existing) {
4861
- return existing;
4862
- }
4863
- const load = this.fetchEntityDefinition(key);
4864
- this.entityDefinitionCache.set(key, load);
4865
- return load;
5155
+ return this.fetchEntityDefinition(entityType.trim());
4866
5156
  }
4867
5157
  async fetchEntityDefinition(entityType) {
4868
5158
  const parsed = this.parseQualifiedEntityType(entityType);
@@ -4903,33 +5193,19 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4903
5193
  */
4904
5194
  rememberStatusDefinitionKeyForEntityType(entityType, entity) {
4905
5195
  const key = entityType.trim();
4906
- if (!key || this.statusDefinitionKeyByEntityType.has(key)) {
5196
+ if (!key) {
4907
5197
  return;
4908
5198
  }
4909
5199
  const definitionKey = entity ? this.getStatusPluginDefinitionKey(entity) : null;
4910
5200
  this.statusDefinitionKeyByEntityType.set(key, definitionKey);
4911
5201
  }
4912
5202
  async getEntityStatusProvider(entityType) {
4913
- let definitionKey = this.getStatusDefinitionKeyForEntityType(entityType);
4914
- if (!definitionKey) {
4915
- const entity = await this.resolveEntityDefinition(entityType);
4916
- this.rememberStatusDefinitionKeyForEntityType(entityType, entity);
4917
- definitionKey = this.getStatusDefinitionKeyForEntityType(entityType);
4918
- }
4919
- if (!definitionKey) {
4920
- return undefined;
4921
- }
4922
- return this.getStatusProviderByDefinitionKey(definitionKey);
5203
+ const entity = await this.resolveEntityDefinition(entityType);
5204
+ const key = entity ? this.getStatusPluginDefinitionKey(entity) : null;
5205
+ return key ? this.getStatusProviderByDefinitionKey(key) : undefined;
4923
5206
  }
4924
5207
  getStatusProviderByDefinitionKey(definitionKey) {
4925
- const key = definitionKey.trim();
4926
- const existing = this.statusProviderByDefinitionKey.get(key);
4927
- if (existing) {
4928
- return existing;
4929
- }
4930
- const load = this.statusDefinitionService.getStatus(key);
4931
- this.statusProviderByDefinitionKey.set(key, load);
4932
- return load;
5208
+ return this.statusDefinitionService.getStatus(definitionKey.trim());
4933
5209
  }
4934
5210
  //#endregion
4935
5211
  //#region ---- Entity Status Presentation ----
@@ -4938,9 +5214,6 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4938
5214
  return provider?.statuses.find((status) => status.name === statusId);
4939
5215
  }
4940
5216
  async warmStatusDefinitionKeyCache(entityType) {
4941
- if (this.statusDefinitionKeyByEntityType.has(entityType.trim())) {
4942
- return;
4943
- }
4944
5217
  const entity = await this.resolveEntityDefinition(entityType);
4945
5218
  this.rememberStatusDefinitionKeyForEntityType(entityType, entity);
4946
5219
  }
@@ -4948,9 +5221,6 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4948
5221
  * First `entity-create` target in this workflow whose entity has a status plugin (cached per provider).
4949
5222
  */
4950
5223
  async resolvePrimaryEntityTypeForProvider() {
4951
- if (this.primaryEntityTypeWithStatus !== undefined) {
4952
- return this.primaryEntityTypeWithStatus;
4953
- }
4954
5224
  let resolved = null;
4955
5225
  const definitionId = this.config.definitionId?.trim();
4956
5226
  if (definitionId) {
@@ -4971,7 +5241,6 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
4971
5241
  }
4972
5242
  }
4973
5243
  }
4974
- this.primaryEntityTypeWithStatus = resolved;
4975
5244
  return resolved;
4976
5245
  }
4977
5246
  //#endregion
@@ -5016,8 +5285,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5016
5285
  });
5017
5286
  }
5018
5287
  else {
5019
- const statusColor = mapEntityStatusColorForBadge(statusDefinition?.color ??
5020
- task.data?.statusColor, task.status.id);
5288
+ const statusColor = mapEntityStatusColorForBadge(statusDefinition?.color ?? task.data?.statusColor, task.status.id);
5021
5289
  pushField('status', '@general:terms.status.title', AXPWidgetsList.Layouts.BadgeLayout, {
5022
5290
  text: task.status.title,
5023
5291
  color: statusColor,
@@ -5040,8 +5308,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5040
5308
  workflowDefinitionId: task.data?.definitionId,
5041
5309
  activityType: payload?.activityType,
5042
5310
  });
5043
- const dueStatus = taskWithDueStatus.data
5044
- ?.dueStatus;
5311
+ const dueStatus = taskWithDueStatus.data?.dueStatus;
5045
5312
  const formattedDueDate = await this.formatDateForTaskDisplay(dueDate);
5046
5313
  pushField('dueDate', '@workflow-management:tasks.popover.due', AXPWidgetsList.Layouts.BadgeLayout, {
5047
5314
  text: formattedDueDate,
@@ -5095,14 +5362,8 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5095
5362
  return { kind: 'none' };
5096
5363
  }
5097
5364
  const i18n = context[AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY];
5098
- const rawFromI18n = i18n && typeof i18n === 'object' && !Array.isArray(i18n)
5099
- ? i18n['effectiveDate']
5100
- : undefined;
5101
- const raw = rawFromI18n ??
5102
- context['effectiveDate'] ??
5103
- (context['result'] && typeof context['result'] === 'object' && !Array.isArray(context['result'])
5104
- ? context['result']['effectiveDate']
5105
- : undefined);
5365
+ const rawFromI18n = i18n && typeof i18n === 'object' && !Array.isArray(i18n) ? i18n['effectiveDate'] : undefined;
5366
+ const raw = rawFromI18n ?? context['effectiveDate'] ?? (context['result'] && typeof context['result'] === 'object' && !Array.isArray(context['result']) ? context['result']['effectiveDate'] : undefined);
5106
5367
  if (raw instanceof Date) {
5107
5368
  return Number.isNaN(raw.getTime()) ? { kind: 'none' } : { kind: 'date', value: raw };
5108
5369
  }
@@ -5148,7 +5409,7 @@ class AXPGenericWorkflowTaskProvider extends AXPWorkflowTaskProvider {
5148
5409
  //#endregion
5149
5410
  //#region ---- Component ----
5150
5411
  getComponent() {
5151
- return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-BjjwcQ2s.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5412
+ return () => import('./acorex-platform-module-workflow-management-client-workflow-task-popover.component-V3Spc1Dn.mjs').then((m) => m.AXMWorkflowTaskPopoverComponent);
5152
5413
  }
5153
5414
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGenericWorkflowTaskProvider, deps: [{ token: AXP_GENERIC_WORKFLOW_TASK_PROVIDER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
5154
5415
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGenericWorkflowTaskProvider }); }
@@ -5170,5 +5431,5 @@ var genericWorkflowTask_provider = /*#__PURE__*/Object.freeze({
5170
5431
  * Generated bundle index. Do not edit.
5171
5432
  */
5172
5433
 
5173
- export { AXPWorkflowInstanceHumanTaskService as A, needsTakeOverForWorkflowInteractiveContinuation as B, CartableTaskActivity as C, needsTakeOverForWorkflowTaskContinuation as D, parseWorkflowTaskContinuationPayload as E, resolveWorkflowHumanTaskAssigneeId as F, resolveWorkflowInitiatorUserIdFromVariables as G, HumanTaskActivity as H, resolveWorkflowTaskContinuationAssigneeId as I, shouldOfferWorkflowContinuationAfterStep as J, shouldOfferWorkflowInteractiveStepContinuation as K, shouldOfferWorkflowTaskContinuation as L, shouldSkipContinuationBeforeInteractive as M, wasWorkflowTaskBoardActivity as N, RejectionReasonActivity as R, ShowConfirmPopupActivity as S, AXMWorkflowManagementCommandKeys as a, buildWorkflowTaskDisplayParamsFromWorkflowState as b, createWorkflowInstanceBookmarkAccess as c, buildWorkflowTaskDisplayParams as d, AXCCategoryProvider as e, AXMMenuProvider as f, AXMWorkflowActivitiesDefinitionProvider as g, AXMWorkflowManagementModule as h, isWorkflowPooledClaimablePayload as i, AXPCreateEntityActivity as j, AXPGenericWorkflowTaskProvider as k, AXPWorkflowTaskContinuationService as l, AXPWorkflowTaskInstanceQueryService as m, normalizeWorkflowTaskUserIds as n, AXP_GENERIC_WORKFLOW_TASK_PROVIDER_CONFIG as o, CreateEntityFormActivity as p, ShowLayoutPopupActivity as q, rehydrateWorkflowStateInputTitles as r, ShowToastActivity as s, SignOffActivity as t, discoverWorkflowTaskProviders as u, findActiveHumanTaskAssigneeId as v, findHumanTaskAssigneeIdForActivity as w, getWorkflowInstanceInitiatorUserId as x, isWorkflowReassignableHumanTaskPayload as y, isWorkflowTaskBoardBookmarkPayload as z };
5174
- //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-DaEuz1U-.mjs.map
5434
+ export { AXPWorkflowInstanceHumanTaskService as A, needsTakeOverForWorkflowInteractiveContinuation as B, CartableTaskActivity as C, needsTakeOverForWorkflowTaskContinuation as D, parseWorkflowTaskContinuationPayload as E, resolveWorkflowHumanTaskAssigneeId as F, resolveWorkflowInitiatorUserIdFromVariables as G, HumanTaskActivity as H, resolveWorkflowTaskContinuationAssigneeId as I, shouldOfferWorkflowContinuationAfterStep as J, shouldOfferWorkflowInteractiveStepContinuation as K, shouldOfferWorkflowTaskContinuation as L, shouldSkipContinuationBeforeInteractive as M, wasWorkflowTaskBoardActivity as N, workflowSignOffActions as O, workflowSignOffLayout as P, RejectionReasonActivity as R, ShowConfirmPopupActivity as S, AXMWorkflowManagementCommandKeys as a, buildWorkflowTaskDisplayParamsFromWorkflowState as b, createWorkflowInstanceBookmarkAccess as c, buildWorkflowTaskDisplayParams as d, AXCCategoryProvider as e, AXMMenuProvider as f, AXMWorkflowActivitiesDefinitionProvider as g, AXMWorkflowManagementModule as h, isWorkflowPooledClaimablePayload as i, AXPCreateEntityActivity as j, AXPGenericWorkflowTaskProvider as k, AXPWorkflowTaskContinuationService as l, AXPWorkflowTaskInstanceQueryService as m, normalizeWorkflowTaskUserIds as n, AXP_GENERIC_WORKFLOW_TASK_PROVIDER_CONFIG as o, CreateEntityFormActivity as p, ShowLayoutPopupActivity as q, rehydrateWorkflowStateInputTitles as r, ShowToastActivity as s, SignOffActivity as t, discoverWorkflowTaskProviders as u, findActiveHumanTaskAssigneeId as v, findHumanTaskAssigneeIdForActivity as w, getWorkflowInstanceInitiatorUserId as x, isWorkflowReassignableHumanTaskPayload as y, isWorkflowTaskBoardBookmarkPayload as z };
5435
+ //# sourceMappingURL=acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BXlJXZCZ.mjs.map