@acorex-platform/module-workflow-management-client 1.0.2 → 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.
- package/fesm2022/{acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BcOBHoOK.mjs → acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BXlJXZCZ.mjs} +823 -567
- package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BXlJXZCZ.mjs.map +1 -0
- 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
- 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
- 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
- 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
- package/fesm2022/{acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs → acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs} +9 -8
- package/fesm2022/acorex-platform-module-workflow-management-client-commands-ISHAdB1W.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entities-automation.mjs +1 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entities-automation.mjs.map +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-CcCT3L9D.mjs.map +1 -0
- 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
- 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
- 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
- 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
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts.mjs +34 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs +245 -0
- package/fesm2022/acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs.map +1 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/fesm2022/acorex-platform-module-workflow-management-client-workflow-definition-activities-page-DgagKVhS.mjs.map +1 -0
- 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
- package/fesm2022/acorex-platform-module-workflow-management-client-workflow-instance-activity-instances-page-CE7L5ZDi.mjs.map +1 -0
- 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
- 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
- package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CHVdaY4M.mjs → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CofkxzF1.mjs} +9 -9
- package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CHVdaY4M.mjs.map → acorex-platform-module-workflow-management-client-workflow-run-history-popup.component-CofkxzF1.mjs.map} +1 -1
- 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
- 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
- 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
- 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
- package/fesm2022/{acorex-platform-module-workflow-management-client-workflow-task-popover.component-BXutLQAO.mjs → acorex-platform-module-workflow-management-client-workflow-task-popover.component-V3Spc1Dn.mjs} +14 -9
- package/fesm2022/acorex-platform-module-workflow-management-client-workflow-task-popover.component-V3Spc1Dn.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-workflow-management-client.mjs +1 -1
- package/i18n/en-AU/workflow-management.json +26 -1
- package/i18n/en-US/workflow-management.json +26 -1
- package/i18n/fa-IR/workflow-management.json +26 -1
- package/package.json +2 -2
- package/types/acorex-platform-module-workflow-management-client-contracts.d.ts +124 -2
- package/types/acorex-platform-module-workflow-management-client.d.ts +73 -58
- package/fesm2022/acorex-platform-module-workflow-management-client-acorex-platform-module-workflow-management-client-BcOBHoOK.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-contracts-entity-catalog-automation.entity-BY4uwLMZ.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-index-B0-OPKmr.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-index-Bx8vYkYe.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-index-C8nsbDAw.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-workflow-management-client-workflow-task-popover.component-BXutLQAO.mjs.map +0 -1
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
import { axpRegisterOfflineReadEntities, axpReadOnlyEntityCapabilities, axpRegisterEntityDataCapabilities } from '@acorex-platform/framework-shared/entity';
|
|
2
|
+
import { axpRegisterDataExecutionCapabilities } from '@acorex-platform/framework-shared/runtime';
|
|
3
|
+
|
|
4
|
+
/** Task-list projection; execution state and history are deliberately absent. */
|
|
5
|
+
const WORKFLOW_TASK_BOARD_QUERY = 'WorkflowManagement:TaskBoard:List';
|
|
6
|
+
|
|
7
|
+
// Execution state remains server-owned; only definitions and authorized list projections persist.
|
|
8
|
+
const WORKFLOW_OFFLINE_READ_ENTITIES = ['WorkflowManagement.WorkflowDefinition'];
|
|
9
|
+
axpRegisterOfflineReadEntities(...WORKFLOW_OFFLINE_READ_ENTITIES);
|
|
10
|
+
// Published definitions include format metadata outside scalar entity columns.
|
|
11
|
+
const definition = axpReadOnlyEntityCapabilities('WorkflowManagement.WorkflowDefinition', ['$schema', 'tenantId', 'toolVersion', 'createdAt', 'updatedAt', 'auditInfo', 'scopeInfo', 'version', 'isLatest', 'isArchived', 'statusId', 'schemaVersion', 'name', 'title', 'description', 'variables', 'inputs', 'outputs', 'graph', 'customProperties', 'extensions', 'bindings', 'catalogScopeKeys', 'catalogScopes', 'categoryIds', 'categories'], 1000, true);
|
|
12
|
+
definition.cache.allowOfflineRead = true;
|
|
13
|
+
definition.defaults = { enabled: false, storage: { fields: definition.cache.allowedFields } };
|
|
14
|
+
axpRegisterEntityDataCapabilities(definition);
|
|
15
|
+
const WORKFLOW_OFFLINE_REFERENCE_ENTITIES = ['WorkflowManagement.WorkflowDefinitionCategory'];
|
|
16
|
+
const category = axpReadOnlyEntityCapabilities(WORKFLOW_OFFLINE_REFERENCE_ENTITIES[0], ['title', 'description', 'parentId', 'childrenCount', 'itemsCount', 'scopeInfo'], 1000, true);
|
|
17
|
+
category.cache.allowOfflineRead = true;
|
|
18
|
+
category.defaults = { enabled: false, storage: { fields: category.cache.allowedFields } };
|
|
19
|
+
axpRegisterEntityDataCapabilities(category);
|
|
20
|
+
const WORKFLOW_TASK_BOARD_OFFLINE_CONFIG = {
|
|
21
|
+
read: { strategy: 'cache-first', offlineFallback: 'stale-cache' },
|
|
22
|
+
clientCache: { kind: 'indexed-db', ttlMs: 60000, maxAgeMs: 86400000, maxItems: 5000, maxBytes: 5 * 1024 * 1024, fields: ['items', 'total'] },
|
|
23
|
+
sync: { offlineValidityMs: 86400000 },
|
|
24
|
+
};
|
|
25
|
+
axpRegisterDataExecutionCapabilities({
|
|
26
|
+
targetKind: 'Query', targetKey: WORKFLOW_TASK_BOARD_QUERY, revision: 'task-board-offline-read-v2', operations: ['read'],
|
|
27
|
+
clientCache: { storageKinds: ['memory', 'indexed-db'], allowedFields: ['items', 'total'], maxItems: 5000, maxBytes: 5 * 1024 * 1024, maxAgeMs: 86400000, allowOfflineRead: true },
|
|
28
|
+
dataDependencies: ['WorkflowManagement.WorkflowInstance', 'WorkflowManagement.WorkflowDefinition', 'TaskManagement.Task', 'TaskManagement.TaskAssignment', 'TaskManagement.TaskStatus'],
|
|
29
|
+
});
|
|
30
|
+
|
|
1
31
|
const AXPWorkflowManagementMenuKeys = {
|
|
2
32
|
Root: 'workflow-management:menu',
|
|
3
33
|
Workflow: 'workflow-management:workflow',
|
|
@@ -172,11 +202,14 @@ const AXP_WORKFLOW_TASK_CONTEXT_TITLE_PARTS_KEY = '_taskTitleParts';
|
|
|
172
202
|
|
|
173
203
|
//#endregion
|
|
174
204
|
|
|
205
|
+
const WORKFLOW_TASK_EXECUTE_ACTION = 'WorkflowManagement:Task:ExecuteAction';
|
|
206
|
+
const WORKFLOW_TASK_ACTION_UI = 'WorkflowManagement.WorkflowTask:ExecuteAction';
|
|
207
|
+
|
|
175
208
|
//#region ---- Contracts barrel ----
|
|
176
209
|
|
|
177
210
|
/**
|
|
178
211
|
* Generated bundle index. Do not edit.
|
|
179
212
|
*/
|
|
180
213
|
|
|
181
|
-
export { AXMPermissionsKeys, AXPAdministrationPermissionKeys, AXPWorkflowManagementMenuKeys, AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY, AXP_WORKFLOW_TASK_CONTEXT_TITLE_PARTS_KEY, RootConfig, WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY, WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY, WorkflowManagementManifest };
|
|
214
|
+
export { AXMPermissionsKeys, AXPAdministrationPermissionKeys, AXPWorkflowManagementMenuKeys, AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY, AXP_WORKFLOW_TASK_CONTEXT_TITLE_PARTS_KEY, RootConfig, WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY, WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY, WORKFLOW_OFFLINE_READ_ENTITIES, WORKFLOW_OFFLINE_REFERENCE_ENTITIES, WORKFLOW_TASK_ACTION_UI, WORKFLOW_TASK_BOARD_OFFLINE_CONFIG, WORKFLOW_TASK_BOARD_QUERY, WORKFLOW_TASK_EXECUTE_ACTION, WorkflowManagementManifest };
|
|
182
215
|
//# sourceMappingURL=acorex-platform-module-workflow-management-client-contracts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-workflow-management-client-contracts.mjs","sources":["../../../../libs/modules/workflow-management/contracts/src/menu.keys.ts","../../../../libs/modules/workflow-management/contracts/src/permission.keys.ts","../../../../libs/modules/workflow-management/contracts/src/root-config.ts","../../../../libs/modules/workflow-management/contracts/src/manifest.ts","../../../../libs/modules/workflow-management/contracts/src/WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workflow-management/contracts/src/WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workflow-management/contracts/src/workflow-task-context.constants.ts","../../../../libs/modules/workflow-management/contracts/src/entities/automation/automation.types.ts","../../../../libs/modules/workflow-management/contracts/src/index.ts","../../../../libs/modules/workflow-management/contracts/src/acorex-platform-module-workflow-management-client-contracts.ts"],"sourcesContent":["export const AXPWorkflowManagementMenuKeys = {\n Root: 'workflow-management:menu',\n Workflow: 'workflow-management:workflow',\n WorkflowDefinitions: 'workflow-management:workflow-definitions',\n WorkflowInstances: 'workflow-management:workflow-instances',\n Activities: 'workflow-management:activities',\n} as const;\n\n","/**\n * Administration capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPAdministrationPermissionKeys = {\n Access: 'Administration:Permission:Access',\n MaintainUsersAndRoles: 'Administration:Permission:MaintainUsersAndRoles',\n ManageSessions: 'Administration:Permission:ManageSessions',\n MaintainPolicies: 'Administration:Permission:MaintainPolicies',\n ViewIntegrations: 'Administration:Permission:ViewIntegrations',\n MaintainConnections: 'Administration:Permission:MaintainConnections',\n MaintainWorkflows: 'Administration:Permission:MaintainWorkflows',\n ManageWorkflowActions: 'Administration:Permission:ManageWorkflowActions',\n ViewRules: 'Administration:Permission:ViewRules',\n MaintainRules: 'Administration:Permission:MaintainRules',\n ManageRuleActions: 'Administration:Permission:ManageRuleActions',\n MaintainAi: 'Administration:Permission:MaintainAi',\n UseAiAssist: 'Administration:Permission:UseAiAssist',\n MaintainDashboards: 'Administration:Permission:MaintainDashboards',\n ViewJobs: 'Administration:Permission:ViewJobs',\n ManageJobActions: 'Administration:Permission:ManageJobActions',\n ViewObservability: 'Administration:Permission:ViewObservability',\n MaintainObservability: 'Administration:Permission:MaintainObservability',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPAdministrationPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMPermissionsKeys = {\n WorkflowManagement: {\n Management: AXPAdministrationPermissionKeys.MaintainWorkflows,\n },\n WorkflowInstance: {\n ReassignToSelf: AXPAdministrationPermissionKeys.ManageWorkflowActions,\n },\n} as const;\n","const config = {\n i18n: 'workflow-management',\n module: 'WorkflowManagement',\n};\n\nexport const RootConfig = {\n config,\n module: {\n route: 'workflow-management',\n name: config.module,\n title: '@workflow-management:module.title',\n icon: 'fa-light fa-diagram-project',\n },\n /** Task-board suspend activity type ids (match activity definition keys). */\n activities: {\n humanTask: 'workflow-activity:human-task',\n cartable: 'workflow-activity:cartable',\n },\n entities: {\n workflowDefinition: {\n name: 'WorkflowDefinition',\n fullName: `${config.module}.WorkflowDefinition`,\n title: '@workflow-management:workflow-definitions.entities.workflow-definition.title',\n titlePlural: '@workflow-management:workflow-definitions.entities.workflow-definition.plural',\n icon: 'fa-light fa-diagram-project',\n },\n workflowInstance: {\n name: 'WorkflowInstance',\n fullName: `${config.module}.WorkflowInstance`,\n title: '@workflow-management:workflow-instances.entities.workflow-instance.title',\n titlePlural: '@workflow-management:workflow-instances.entities.workflow-instance.plural',\n icon: 'fa-light fa-play-circle',\n },\n activityDefinition: {\n name: 'ActivityDefinition',\n fullName: `${config.module}.ActivityDefinition`,\n title: '@workflow-management:activities.entities.activity-definition.title',\n titlePlural: '@workflow-management:activities.entities.activity-definition.plural',\n icon: 'fa-light fa-puzzle-piece',\n },\n automation: {\n name: 'Automation',\n fullName: `${config.module}.Automation`,\n title: '@workflow-management:automations.entities.automation.title',\n titlePlural: '@workflow-management:automations.entities.automation.plural',\n icon: 'fa-light fa-bolt',\n },\n },\n /**\n * Live dashboard queries bound to base DashboardManagement chart/KPI widgets.\n * Keys: `{module}:Dashboard:{Name}`.\n */\n queries: {\n dashboard: {\n definitionsKpi: `${config.module}:Dashboard:DefinitionsKpi`,\n activitiesKpi: `${config.module}:Dashboard:ActivitiesKpi`,\n definitionsByStatusBar: `${config.module}:Dashboard:DefinitionsByStatusBar`,\n activitiesByCategoryDonut: `${config.module}:Dashboard:ActivitiesByCategoryDonut`,\n publishedDefinitionsGauge: `${config.module}:Dashboard:PublishedDefinitionsGauge`,\n /** @deprecated Prefer {@link runningInstancesKpi} for runtime ops dashboards. */\n workflowDefinitionsKpi: `${config.module}:Dashboard:WorkflowDefinitionsKpi`,\n /** @deprecated Prefer {@link instancesBySubStatusDonut} for runtime ops dashboards. */\n workflowsByStatusBar: `${config.module}:Dashboard:WorkflowsByStatusBar`,\n runningInstancesKpi: `${config.module}:Dashboard:RunningInstancesKpi`,\n faultedInstancesKpi: `${config.module}:Dashboard:FaultedInstancesKpi`,\n awaitingActionInstancesKpi: `${config.module}:Dashboard:AwaitingActionInstancesKpi`,\n startedTodayInstancesKpi: `${config.module}:Dashboard:StartedTodayInstancesKpi`,\n completedTodayInstancesKpi: `${config.module}:Dashboard:CompletedTodayInstancesKpi`,\n avgRunningAgeHoursKpi: `${config.module}:Dashboard:AvgRunningAgeHoursKpi`,\n instancesBySubStatusDonut: `${config.module}:Dashboard:InstancesBySubStatusDonut`,\n instancesByDefinitionBar: `${config.module}:Dashboard:InstancesByDefinitionBar`,\n instancesThroughputLine: `${config.module}:Dashboard:InstancesThroughputLine`,\n instancesByCurrentActivityBar: `${config.module}:Dashboard:InstancesByCurrentActivityBar`,\n instancesFaultHeatmap: `${config.module}:Dashboard:InstancesFaultHeatmap`,\n },\n },\n} as const;\n","//#region ---- Imports ----\n\nimport { AXPModuleManifest } from '@acorex-platform/framework-shared/core';\nimport { RootConfig } from './root-config';\n\n//#endregion\n\n//#region ---- Manifest Definition ----\n\n/**\n * Workflow Management Module Manifest.\n * Defines module metadata, features, and provider references.\n */\nexport const WorkflowManagementManifest: AXPModuleManifest = {\n name: RootConfig.module.name,\n version: '1.0.0',\n title: RootConfig.module.title,\n icon: RootConfig.module.icon,\n i18n: RootConfig.config.i18n,\n\n type: 'platform',\n domain: 'operations',\n // Module dependencies (optional)\n};\n\n//#endregion\n\n","/** Component key for the Workflow Instance Activity instances tab. Register via AXP_PAGE_COMPONENT_PROVIDER. */\nexport const WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY =\n 'workflow-instance-activity-instances-page';\n","/** Registry key for the workflow definition Activities custom page (linear graph editor). */\nexport const WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY = 'workflow-definition-activities-page';\n","//#region ---- Workflow task context (reserved keys) ----\n\n/**\n * Human-task / cartable `context` payload: technical ids at the root; display metadata under reserved keys.\n *\n * @example\n * ```json\n * {\n * \"leaveRequestId\": \"{{ variables.leaveRequestId }}\",\n * \"_taskI18n\": {\n * \"employeeDisplayName\": \"{{ variables.employeeDisplayName }}\",\n * \"leaveTypeTitle\": \"{{ variables.leaveTypeTitle }}\"\n * },\n * \"_taskTitleParts\": [\n * \"{{ variables.employeeDisplayName }}\",\n * \"{{ variables.leaveTypeTitle }}\"\n * ]\n * }\n * ```\n */\n\n/** Interpolation map for `@scope:key` task title and description strings. */\nexport const AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY = '_taskI18n';\n\n/** Ordered segments joined with \" — \" when bookmark title is still a generic activity label. */\nexport const AXP_WORKFLOW_TASK_CONTEXT_TITLE_PARTS_KEY = '_taskTitleParts';\n\n//#endregion\n","import type { AXPFilterClause } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Automation Model ----\n\n/**\n * Reusable automation entity model.\n * refType + refId reference any parent entity (e.g. AssessmentManagement.Questionnaire, refId = questionnaire id).\n */\nexport interface AXMWorkflowManagementAutomationEntityModel extends AXPEntityModel<string> {\n /** Entity type of the parent record (e.g. \"AssessmentManagement.Questionnaire\"). */\n refType: string;\n /** Parent record id. */\n refId: string;\n name?: string;\n title?: string;\n description?: string;\n condition: AXPFilterClause;\n /** Activity/command key and parameters (from activity-command-configurator). */\n command: { key: string; title?: string; payload?: Record<string, unknown> };\n}\n\n//#endregion\n","//#region ---- Contracts barrel ----\n\nexport * from './menu.keys';\nexport * from './permission.keys';\n\nexport * from './root-config';\nexport * from './manifest';\n\nexport * from './WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY';\nexport * from './WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY';\n\nexport * from './workflow-task-context.constants';\n\n//#endregion\n\nexport * from './entities';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,MAAM,6BAA6B,GAAG;AAC3C,IAAA,IAAI,EAAE,0BAA0B;AAChC,IAAA,QAAQ,EAAE,8BAA8B;AACxC,IAAA,mBAAmB,EAAE,0CAA0C;AAC/D,IAAA,iBAAiB,EAAE,wCAAwC;AAC3D,IAAA,UAAU,EAAE,gCAAgC;;;ACL9C;;;AAGG;AACI,MAAM,+BAA+B,GAAG;AAC7C,IAAA,MAAM,EAAE,kCAAkC;AAC1C,IAAA,qBAAqB,EAAE,iDAAiD;AACxE,IAAA,cAAc,EAAE,0CAA0C;AAC1D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CAAC,MAAM,CAAC,IAAI;AAC5B,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK;AAC9B,IAAA,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAC5B,IAAA,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAE5B,IAAA,IAAI,EAAE,UAAU;AAChB,IAAA,MAAM,EAAE,YAAY;;;AAItB;;ACzBA;AACO,MAAM,uDAAuD,GAClE;;ACFF;AACO,MAAM,iDAAiD,GAAG;;ACDjE;AAEA;;;;;;;;;;;;;;;;;AAiBG;AAEH;AACO,MAAM,kCAAkC,GAAG;AAElD;AACO,MAAM,yCAAyC,GAAG;AAEzD;;ACHA;;ACxBA;;ACAA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-workflow-management-client-contracts.mjs","sources":["../../../../libs/modules/workflow-management/contracts/src/workflow-task-board.query.ts","../../../../libs/modules/workflow-management/contracts/src/offline-read.capabilities.ts","../../../../libs/modules/workflow-management/contracts/src/menu.keys.ts","../../../../libs/modules/workflow-management/contracts/src/permission.keys.ts","../../../../libs/modules/workflow-management/contracts/src/root-config.ts","../../../../libs/modules/workflow-management/contracts/src/manifest.ts","../../../../libs/modules/workflow-management/contracts/src/WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workflow-management/contracts/src/WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY.ts","../../../../libs/modules/workflow-management/contracts/src/workflow-task-context.constants.ts","../../../../libs/modules/workflow-management/contracts/src/entities/automation/automation.types.ts","../../../../libs/modules/workflow-management/contracts/src/workflow-task-actions.ts","../../../../libs/modules/workflow-management/contracts/src/index.ts","../../../../libs/modules/workflow-management/contracts/src/acorex-platform-module-workflow-management-client-contracts.ts"],"sourcesContent":["/** Task-list projection; execution state and history are deliberately absent. */\nexport const WORKFLOW_TASK_BOARD_QUERY = 'WorkflowManagement:TaskBoard:List';\n\nexport interface WorkflowTaskBoardSource {\n provider: string;\n definitionId?: string;\n}\n\nexport interface WorkflowTaskBoardRequest {\n sources: WorkflowTaskBoardSource[];\n skip?: number;\n take?: number;\n assigneeIds?: (string | number)[];\n reporterIds?: (string | number)[];\n priorities?: string[];\n dueStatusKeys?: string[];\n subjectRefTypes?: string[];\n subjectRefIds?: string[];\n tags?: string[];\n range?: { from: string; end: string };\n /** Browser-local calendar boundaries, preserving locale/timezone filter semantics. */\n calendar: { today: string; tomorrow: string; dayAfterTomorrow: string; weekEnd: string };\n}\n\nexport interface WorkflowTaskBoardRow {\n provider: string;\n instanceId: string;\n definitionId: string;\n createdAt: string;\n updatedAt?: string;\n entityRefId?: string;\n entityRefType?: string;\n initiatorUserId?: string;\n creator?: { id: string; fullName?: string };\n /** null means the secured lookup was performed but no display status was available. */\n linkedTaskStatus?: { id: string; title: string; color?: string; icon?: string } | null;\n bookmark: { id: string; activityId: string; payload: Record<string, unknown> };\n}\n\nexport interface WorkflowTaskBoardPage {\n items: WorkflowTaskBoardRow[];\n total: number;\n}\n","import { axpReadOnlyEntityCapabilities, axpRegisterEntityDataCapabilities, axpRegisterOfflineReadEntities } from '@acorex-platform/framework-shared/entity';\nimport { axpRegisterDataExecutionCapabilities, type AXPDataExecutionConfigPatch } from '@acorex-platform/framework-shared/runtime';\nimport { WORKFLOW_TASK_BOARD_QUERY } from './workflow-task-board.query';\n\n// Execution state remains server-owned; only definitions and authorized list projections persist.\nexport const WORKFLOW_OFFLINE_READ_ENTITIES = ['WorkflowManagement.WorkflowDefinition'] as const;\naxpRegisterOfflineReadEntities(...WORKFLOW_OFFLINE_READ_ENTITIES);\n// Published definitions include format metadata outside scalar entity columns.\nconst definition = axpReadOnlyEntityCapabilities('WorkflowManagement.WorkflowDefinition', ['$schema', 'tenantId', 'toolVersion', 'createdAt', 'updatedAt', 'auditInfo', 'scopeInfo', 'version', 'isLatest', 'isArchived', 'statusId', 'schemaVersion', 'name', 'title', 'description', 'variables', 'inputs', 'outputs', 'graph', 'customProperties', 'extensions', 'bindings', 'catalogScopeKeys', 'catalogScopes', 'categoryIds', 'categories'], 1000, true);\ndefinition.cache.allowOfflineRead = true;\ndefinition.defaults = { enabled: false, storage: { fields: definition.cache.allowedFields } };\naxpRegisterEntityDataCapabilities(definition);\nexport const WORKFLOW_OFFLINE_REFERENCE_ENTITIES = ['WorkflowManagement.WorkflowDefinitionCategory'] as const;\nconst category = axpReadOnlyEntityCapabilities(WORKFLOW_OFFLINE_REFERENCE_ENTITIES[0], ['title', 'description', 'parentId', 'childrenCount', 'itemsCount', 'scopeInfo'], 1000, true);\ncategory.cache.allowOfflineRead = true;\ncategory.defaults = { enabled: false, storage: { fields: category.cache.allowedFields } };\naxpRegisterEntityDataCapabilities(category);\nexport const WORKFLOW_TASK_BOARD_OFFLINE_CONFIG: AXPDataExecutionConfigPatch = {\n read: { strategy: 'cache-first', offlineFallback: 'stale-cache' },\n clientCache: { kind: 'indexed-db', ttlMs: 60000, maxAgeMs: 86400000, maxItems: 5000, maxBytes: 5 * 1024 * 1024, fields: ['items', 'total'] },\n sync: { offlineValidityMs: 86400000 },\n};\naxpRegisterDataExecutionCapabilities({\n targetKind: 'Query', targetKey: WORKFLOW_TASK_BOARD_QUERY, revision: 'task-board-offline-read-v2', operations: ['read'],\n clientCache: { storageKinds: ['memory', 'indexed-db'], allowedFields: ['items', 'total'], maxItems: 5000, maxBytes: 5 * 1024 * 1024, maxAgeMs: 86400000, allowOfflineRead: true },\n dataDependencies: ['WorkflowManagement.WorkflowInstance', 'WorkflowManagement.WorkflowDefinition', 'TaskManagement.Task', 'TaskManagement.TaskAssignment', 'TaskManagement.TaskStatus'],\n});\n","export const AXPWorkflowManagementMenuKeys = {\n Root: 'workflow-management:menu',\n Workflow: 'workflow-management:workflow',\n WorkflowDefinitions: 'workflow-management:workflow-definitions',\n WorkflowInstances: 'workflow-management:workflow-instances',\n Activities: 'workflow-management:activities',\n} as const;\n\n","/**\n * Administration capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPAdministrationPermissionKeys = {\n Access: 'Administration:Permission:Access',\n MaintainUsersAndRoles: 'Administration:Permission:MaintainUsersAndRoles',\n ManageSessions: 'Administration:Permission:ManageSessions',\n MaintainPolicies: 'Administration:Permission:MaintainPolicies',\n ViewIntegrations: 'Administration:Permission:ViewIntegrations',\n MaintainConnections: 'Administration:Permission:MaintainConnections',\n MaintainWorkflows: 'Administration:Permission:MaintainWorkflows',\n ManageWorkflowActions: 'Administration:Permission:ManageWorkflowActions',\n ViewRules: 'Administration:Permission:ViewRules',\n MaintainRules: 'Administration:Permission:MaintainRules',\n ManageRuleActions: 'Administration:Permission:ManageRuleActions',\n MaintainAi: 'Administration:Permission:MaintainAi',\n UseAiAssist: 'Administration:Permission:UseAiAssist',\n MaintainDashboards: 'Administration:Permission:MaintainDashboards',\n ViewJobs: 'Administration:Permission:ViewJobs',\n ManageJobActions: 'Administration:Permission:ManageJobActions',\n ViewObservability: 'Administration:Permission:ViewObservability',\n MaintainObservability: 'Administration:Permission:MaintainObservability',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPAdministrationPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMPermissionsKeys = {\n WorkflowManagement: {\n Management: AXPAdministrationPermissionKeys.MaintainWorkflows,\n },\n WorkflowInstance: {\n ReassignToSelf: AXPAdministrationPermissionKeys.ManageWorkflowActions,\n },\n} as const;\n","const config = {\n i18n: 'workflow-management',\n module: 'WorkflowManagement',\n};\n\nexport const RootConfig = {\n config,\n module: {\n route: 'workflow-management',\n name: config.module,\n title: '@workflow-management:module.title',\n icon: 'fa-light fa-diagram-project',\n },\n /** Task-board suspend activity type ids (match activity definition keys). */\n activities: {\n humanTask: 'workflow-activity:human-task',\n cartable: 'workflow-activity:cartable',\n },\n entities: {\n workflowDefinition: {\n name: 'WorkflowDefinition',\n fullName: `${config.module}.WorkflowDefinition`,\n title: '@workflow-management:workflow-definitions.entities.workflow-definition.title',\n titlePlural: '@workflow-management:workflow-definitions.entities.workflow-definition.plural',\n icon: 'fa-light fa-diagram-project',\n },\n workflowInstance: {\n name: 'WorkflowInstance',\n fullName: `${config.module}.WorkflowInstance`,\n title: '@workflow-management:workflow-instances.entities.workflow-instance.title',\n titlePlural: '@workflow-management:workflow-instances.entities.workflow-instance.plural',\n icon: 'fa-light fa-play-circle',\n },\n activityDefinition: {\n name: 'ActivityDefinition',\n fullName: `${config.module}.ActivityDefinition`,\n title: '@workflow-management:activities.entities.activity-definition.title',\n titlePlural: '@workflow-management:activities.entities.activity-definition.plural',\n icon: 'fa-light fa-puzzle-piece',\n },\n automation: {\n name: 'Automation',\n fullName: `${config.module}.Automation`,\n title: '@workflow-management:automations.entities.automation.title',\n titlePlural: '@workflow-management:automations.entities.automation.plural',\n icon: 'fa-light fa-bolt',\n },\n },\n /**\n * Live dashboard queries bound to base DashboardManagement chart/KPI widgets.\n * Keys: `{module}:Dashboard:{Name}`.\n */\n queries: {\n dashboard: {\n definitionsKpi: `${config.module}:Dashboard:DefinitionsKpi`,\n activitiesKpi: `${config.module}:Dashboard:ActivitiesKpi`,\n definitionsByStatusBar: `${config.module}:Dashboard:DefinitionsByStatusBar`,\n activitiesByCategoryDonut: `${config.module}:Dashboard:ActivitiesByCategoryDonut`,\n publishedDefinitionsGauge: `${config.module}:Dashboard:PublishedDefinitionsGauge`,\n /** @deprecated Prefer {@link runningInstancesKpi} for runtime ops dashboards. */\n workflowDefinitionsKpi: `${config.module}:Dashboard:WorkflowDefinitionsKpi`,\n /** @deprecated Prefer {@link instancesBySubStatusDonut} for runtime ops dashboards. */\n workflowsByStatusBar: `${config.module}:Dashboard:WorkflowsByStatusBar`,\n runningInstancesKpi: `${config.module}:Dashboard:RunningInstancesKpi`,\n faultedInstancesKpi: `${config.module}:Dashboard:FaultedInstancesKpi`,\n awaitingActionInstancesKpi: `${config.module}:Dashboard:AwaitingActionInstancesKpi`,\n startedTodayInstancesKpi: `${config.module}:Dashboard:StartedTodayInstancesKpi`,\n completedTodayInstancesKpi: `${config.module}:Dashboard:CompletedTodayInstancesKpi`,\n avgRunningAgeHoursKpi: `${config.module}:Dashboard:AvgRunningAgeHoursKpi`,\n instancesBySubStatusDonut: `${config.module}:Dashboard:InstancesBySubStatusDonut`,\n instancesByDefinitionBar: `${config.module}:Dashboard:InstancesByDefinitionBar`,\n instancesThroughputLine: `${config.module}:Dashboard:InstancesThroughputLine`,\n instancesByCurrentActivityBar: `${config.module}:Dashboard:InstancesByCurrentActivityBar`,\n instancesFaultHeatmap: `${config.module}:Dashboard:InstancesFaultHeatmap`,\n },\n },\n} as const;\n","//#region ---- Imports ----\n\nimport { AXPModuleManifest } from '@acorex-platform/framework-shared/core';\nimport { RootConfig } from './root-config';\n\n//#endregion\n\n//#region ---- Manifest Definition ----\n\n/**\n * Workflow Management Module Manifest.\n * Defines module metadata, features, and provider references.\n */\nexport const WorkflowManagementManifest: AXPModuleManifest = {\n name: RootConfig.module.name,\n version: '1.0.0',\n title: RootConfig.module.title,\n icon: RootConfig.module.icon,\n i18n: RootConfig.config.i18n,\n\n type: 'platform',\n domain: 'operations',\n // Module dependencies (optional)\n};\n\n//#endregion\n\n","/** Component key for the Workflow Instance Activity instances tab. Register via AXP_PAGE_COMPONENT_PROVIDER. */\nexport const WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY =\n 'workflow-instance-activity-instances-page';\n","/** Registry key for the workflow definition Activities custom page (linear graph editor). */\nexport const WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY = 'workflow-definition-activities-page';\n","//#region ---- Workflow task context (reserved keys) ----\n\n/**\n * Human-task / cartable `context` payload: technical ids at the root; display metadata under reserved keys.\n *\n * @example\n * ```json\n * {\n * \"leaveRequestId\": \"{{ variables.leaveRequestId }}\",\n * \"_taskI18n\": {\n * \"employeeDisplayName\": \"{{ variables.employeeDisplayName }}\",\n * \"leaveTypeTitle\": \"{{ variables.leaveTypeTitle }}\"\n * },\n * \"_taskTitleParts\": [\n * \"{{ variables.employeeDisplayName }}\",\n * \"{{ variables.leaveTypeTitle }}\"\n * ]\n * }\n * ```\n */\n\n/** Interpolation map for `@scope:key` task title and description strings. */\nexport const AXP_WORKFLOW_TASK_CONTEXT_I18N_KEY = '_taskI18n';\n\n/** Ordered segments joined with \" — \" when bookmark title is still a generic activity label. */\nexport const AXP_WORKFLOW_TASK_CONTEXT_TITLE_PARTS_KEY = '_taskTitleParts';\n\n//#endregion\n","import type { AXPFilterClause } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n//#region ---- Imports ----\n//#endregion\n\n//#region ---- Automation Model ----\n\n/**\n * Reusable automation entity model.\n * refType + refId reference any parent entity (e.g. AssessmentManagement.Questionnaire, refId = questionnaire id).\n */\nexport interface AXMWorkflowManagementAutomationEntityModel extends AXPEntityModel<string> {\n /** Entity type of the parent record (e.g. \"AssessmentManagement.Questionnaire\"). */\n refType: string;\n /** Parent record id. */\n refId: string;\n name?: string;\n title?: string;\n description?: string;\n condition: AXPFilterClause;\n /** Activity/command key and parameters (from activity-command-configurator). */\n command: { key: string; title?: string; payload?: Record<string, unknown> };\n}\n\n//#endregion\n","/** An action reference is a hint; the server always resolves and authorizes it again. */\nexport interface WorkflowTaskActionRef {\n taskId: string;\n actionId: string;\n expectedTaskVersion: number;\n actionRevision: string;\n}\n\nexport interface WorkflowTaskActionInputField {\n name: string;\n title: string;\n type: 'string' | 'number' | 'integer' | 'boolean';\n required: boolean;\n choices?: Array<string | number>;\n maxLength?: number;\n}\n\nexport interface WorkflowTaskActionPresentation {\n workflowAction: WorkflowTaskActionRef;\n title: string;\n confirmation?: string;\n inputFields?: WorkflowTaskActionInputField[];\n}\n\nexport interface ExecuteWorkflowTaskActionRequest extends WorkflowTaskActionRef {\n commandId: string;\n input?: Record<string, unknown>;\n /** Explicit decisions collected locally; absent means open without advancing. */\n completion?: WorkflowTaskInteractionCompletion[];\n}\n\nexport interface WorkflowTaskInteractionCompletion {\n activityId: string;\n outcome: string;\n output: Record<string, unknown>;\n}\n\nexport interface WorkflowTaskInteraction {\n startActivityId: string;\n activities: Array<{\n activityId: string;\n activityType: string;\n input: Record<string, unknown>;\n outputToVariables?: Record<string, string>;\n /** null marks a boundary that needs an actual workflow commit. */\n routes: Record<string, string | null>;\n }>;\n}\n\nexport interface ExecuteWorkflowTaskActionResult {\n kind?: 'claimed' | 'resumed' | 'opened';\n interaction?: WorkflowTaskInteraction;\n instanceId: string;\n activityId: string;\n bookmarkId: string;\n outcome: string;\n replayed?: boolean;\n /** The workflow engine response is consumed by the framework workflow manager. */\n response: unknown;\n}\n\nexport const WORKFLOW_TASK_EXECUTE_ACTION = 'WorkflowManagement:Task:ExecuteAction';\nexport const WORKFLOW_TASK_ACTION_UI = 'WorkflowManagement.WorkflowTask:ExecuteAction';\n","//#region ---- Contracts barrel ----\nexport * from './offline-read.capabilities';\n\nexport * from './menu.keys';\nexport * from './permission.keys';\n\nexport * from './root-config';\nexport * from './manifest';\n\nexport * from './WORKFLOW_INSTANCE_ACTIVITY_INSTANCES_PAGE_COMPONENT_KEY';\nexport * from './WORKFLOW_DEFINITION_ACTIVITIES_PAGE_COMPONENT_KEY';\n\nexport * from './workflow-task-context.constants';\n\n//#endregion\n\nexport * from './entities';\nexport * from './workflow-task-board.query';\nexport * from './workflow-task-actions';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AACO,MAAM,yBAAyB,GAAG;;ACGzC;AACO,MAAM,8BAA8B,GAAG,CAAC,uCAAuC;AACtF,8BAA8B,CAAC,GAAG,8BAA8B,CAAC;AACjE;AACA,MAAM,UAAU,GAAG,6BAA6B,CAAC,uCAAuC,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW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,MAAM,EAAE,YAAY;;;AAItB;;ACzBA;AACO,MAAM,uDAAuD,GAClE;;ACFF;AACO,MAAM,iDAAiD,GAAG;;ACDjE;AAEA;;;;;;;;;;;;;;;;;AAiBG;AAEH;AACO,MAAM,kCAAkC,GAAG;AAElD;AACO,MAAM,yCAAyC,GAAG;AAEzD;;ACHA;;ACqCO,MAAM,4BAA4B,GAAG;AACrC,MAAM,uBAAuB,GAAG;;AC9DvC;;ACAA;;AAEG;;"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { AXDialogService } from '@acorex/components/dialog';
|
|
4
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
5
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
6
|
+
import { platformErrorI18nKey, extractRequestErrorInfo } from '@acorex-platform/framework-client/common';
|
|
7
|
+
import { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';
|
|
8
|
+
import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
|
|
9
|
+
import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
|
|
10
|
+
import { AXPWorkflowManager, AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY } from '@acorex-platform/framework-client/workflow';
|
|
11
|
+
import { createRandomUuid, runtimeQueryPayloadData, AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
|
|
12
|
+
|
|
13
|
+
/** Give a prepared activity the identity of the action being executed, not a shared or graph-supplied task ID. */
|
|
14
|
+
function withWorkflowTaskInput(input, taskId) {
|
|
15
|
+
const properties = input?.['properties'];
|
|
16
|
+
return properties && typeof properties === 'object' && !Array.isArray(properties)
|
|
17
|
+
? { ...input, properties: { ...properties, taskId } }
|
|
18
|
+
: { ...input, taskId };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class ExecuteWorkflowTaskActionCommand {
|
|
22
|
+
constructor() {
|
|
23
|
+
//#region ----- Services & Dependencies -----
|
|
24
|
+
this.commands = inject(AXPCommandService);
|
|
25
|
+
this.manager = inject(AXPWorkflowManager);
|
|
26
|
+
this.session = inject(AXPSessionService);
|
|
27
|
+
this.translations = inject(AXTranslationService);
|
|
28
|
+
this.dialogs = inject(AXDialogService);
|
|
29
|
+
this.layouts = inject(AXPLayoutBuilderService);
|
|
30
|
+
this.events = inject(AXPBroadcastEventService);
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ----- Action Execution -----
|
|
33
|
+
this.pending = new Map();
|
|
34
|
+
this.retired = new Set();
|
|
35
|
+
}
|
|
36
|
+
execute(input) {
|
|
37
|
+
const ref = input?.workflowAction;
|
|
38
|
+
const key = JSON.stringify([this.scope(), ref?.taskId, ref?.actionId, ref?.expectedTaskVersion, ref?.actionRevision]);
|
|
39
|
+
const active = this.pending.get(key);
|
|
40
|
+
if (active)
|
|
41
|
+
return active;
|
|
42
|
+
// A committed decision consumes its menu reference. The row refresh
|
|
43
|
+
// can arrive later than a second click; never send that reference twice.
|
|
44
|
+
if (this.retired.has(key)) {
|
|
45
|
+
if (input?.workflowAction?.taskId)
|
|
46
|
+
this.refreshTask(input.workflowAction.taskId);
|
|
47
|
+
return Promise.resolve({ success: false, metadata: { outcome: 'cancelled', refresh: false } });
|
|
48
|
+
}
|
|
49
|
+
const work = this.run(input, key).finally(() => { if (this.pending.get(key) === work)
|
|
50
|
+
this.pending.delete(key); });
|
|
51
|
+
this.pending.set(key, work);
|
|
52
|
+
return work;
|
|
53
|
+
}
|
|
54
|
+
scope() { return JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]); }
|
|
55
|
+
async run(input, key) {
|
|
56
|
+
const scope = this.scope(), ref = input?.workflowAction;
|
|
57
|
+
try {
|
|
58
|
+
if (!ref?.taskId || !ref.actionId || !ref.actionRevision)
|
|
59
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
60
|
+
// The menu already contains the presentation. ExecuteAction validates the
|
|
61
|
+
// version, revision and permissions again under the workflow lease.
|
|
62
|
+
const presentation = input;
|
|
63
|
+
let values = input.input;
|
|
64
|
+
if (values === undefined && presentation.inputFields?.length) {
|
|
65
|
+
const collected = await this.collect(presentation.title, presentation.inputFields);
|
|
66
|
+
if (collected === null)
|
|
67
|
+
return { success: false, metadata: { outcome: 'cancelled' } };
|
|
68
|
+
values = collected;
|
|
69
|
+
}
|
|
70
|
+
if (presentation.confirmation) {
|
|
71
|
+
const title = await this.translations.translateAsync(presentation.title);
|
|
72
|
+
const message = await this.translations.translateAsync(presentation.confirmation);
|
|
73
|
+
const confirmed = await this.dialogs.confirm(title, message, 'warning', 'horizontal', false, 'cancel');
|
|
74
|
+
if (!confirmed.result)
|
|
75
|
+
return { success: false, metadata: { outcome: 'cancelled' } };
|
|
76
|
+
}
|
|
77
|
+
if (scope !== this.scope())
|
|
78
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
79
|
+
const { WORKFLOW_TASK_EXECUTE_ACTION } = await import('@acorex-platform/module-workflow-management-client/contracts');
|
|
80
|
+
const request = { ...ref, commandId: createRandomUuid(), input: values ?? {} };
|
|
81
|
+
let response = await this.commands.executeRemote(WORKFLOW_TASK_EXECUTE_ACTION, request);
|
|
82
|
+
let result = response && runtimeQueryPayloadData(response);
|
|
83
|
+
if (!result)
|
|
84
|
+
throw response ?? new Error('@workflow-management:task-actions.changed');
|
|
85
|
+
if (scope !== this.scope())
|
|
86
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
87
|
+
if (result.kind === 'opened') {
|
|
88
|
+
const completion = await this.collectInteraction(result, ref.taskId);
|
|
89
|
+
// This is a UI dismissal, not the workflow's Cancelled transition.
|
|
90
|
+
// Keep the original menu/bookmark usable and issue no refresh or API.
|
|
91
|
+
if (completion === null)
|
|
92
|
+
return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'cancelled', refresh: false } };
|
|
93
|
+
if (scope !== this.scope())
|
|
94
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
95
|
+
const decision = { ...request, completion };
|
|
96
|
+
response = await this.measure('complete-request', () => this.sendDecision(WORKFLOW_TASK_EXECUTE_ACTION, decision, scope));
|
|
97
|
+
result = response && runtimeQueryPayloadData(response);
|
|
98
|
+
if (!result || result.kind === 'opened')
|
|
99
|
+
throw response ?? new Error('@workflow-management:task-actions.changed');
|
|
100
|
+
if (scope !== this.scope())
|
|
101
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
102
|
+
}
|
|
103
|
+
this.retire(key);
|
|
104
|
+
if (result.kind === 'claimed') {
|
|
105
|
+
this.refreshTask(ref.taskId);
|
|
106
|
+
return { success: true, kind: 'object', data: result, metadata: { refresh: false } };
|
|
107
|
+
}
|
|
108
|
+
const resumed = await this.measure('client-continuation', () => this.manager.continueAfterResume(result.response, {
|
|
109
|
+
instanceId: result.instanceId, stepId: result.activityId, outcome: result.outcome,
|
|
110
|
+
userInput: { bookmarkId: result.bookmarkId, [AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY]: true },
|
|
111
|
+
}));
|
|
112
|
+
// Only committed decisions replace the bookmark and reconcile the row.
|
|
113
|
+
this.refreshTask(ref.taskId);
|
|
114
|
+
return resumed.success ? { success: true, kind: 'object', data: resumed, metadata: { refresh: false } } : { success: false, message: { text: platformErrorI18nKey(resumed.errorCode) ?? '@general:messages.generic.error.description' }, metadata: { refresh: false } };
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (scope === this.scope() && ref?.taskId)
|
|
118
|
+
this.refreshTask(ref.taskId);
|
|
119
|
+
const info = extractRequestErrorInfo(error);
|
|
120
|
+
if (info?.code === 'conflict' || info?.status === 409) {
|
|
121
|
+
this.retire(key);
|
|
122
|
+
return { success: false, metadata: { outcome: 'cancelled', refresh: false } };
|
|
123
|
+
}
|
|
124
|
+
const message = error instanceof Error && error.message.startsWith('@') ? error.message : platformErrorI18nKey(info?.code) ?? '@general:messages.generic.error.description';
|
|
125
|
+
return { success: false, message: { text: message }, metadata: { refresh: false } };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ----- Prepared Interaction -----
|
|
130
|
+
async sendDecision(command, request, scope) {
|
|
131
|
+
const send = () => this.commands.executeRemote(command, request);
|
|
132
|
+
const lostAcknowledgement = (error) => {
|
|
133
|
+
const status = extractRequestErrorInfo(error)?.status;
|
|
134
|
+
return scope === this.scope() && (status === 0 || status === 502 || status === 504);
|
|
135
|
+
};
|
|
136
|
+
let response;
|
|
137
|
+
try {
|
|
138
|
+
response = await send();
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (!lostAcknowledgement(error))
|
|
142
|
+
throw error;
|
|
143
|
+
return send();
|
|
144
|
+
}
|
|
145
|
+
// The exact same command ID and completion are safe to replay after a transport failure.
|
|
146
|
+
return lostAcknowledgement(response) ? send() : response;
|
|
147
|
+
}
|
|
148
|
+
async collectInteraction(opened, taskId) {
|
|
149
|
+
const interaction = opened.interaction;
|
|
150
|
+
const response = opened.response;
|
|
151
|
+
if (!interaction || !response.state || response.state.instanceId !== opened.instanceId)
|
|
152
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
153
|
+
let state = structuredClone(response.state);
|
|
154
|
+
let current = interaction.startActivityId;
|
|
155
|
+
const completion = [];
|
|
156
|
+
while (current && completion.length < 10) {
|
|
157
|
+
const node = interaction.activities.find(activity => activity.activityId === current);
|
|
158
|
+
if (!node)
|
|
159
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
160
|
+
const input = withWorkflowTaskInput(node.input, taskId);
|
|
161
|
+
const result = await this.manager.executePreparedActivity({ taskToken: '', activityId: node.activityId, activityType: node.activityType,
|
|
162
|
+
executionMode: 'frontend', taskType: 'ui-activity', input, config: input }, state);
|
|
163
|
+
if (['cancel', 'cancelled', 'close'].includes(result.outcome.toLowerCase()))
|
|
164
|
+
return null;
|
|
165
|
+
const outcome = Object.keys(node.routes).find(key => key.toLowerCase() === result.outcome.toLowerCase());
|
|
166
|
+
if (!outcome)
|
|
167
|
+
throw new Error('@general:messages.generic.error.description');
|
|
168
|
+
const output = result.output && typeof result.output === 'object' && !Array.isArray(result.output) ? result.output : {};
|
|
169
|
+
completion.push({ activityId: node.activityId, outcome, output });
|
|
170
|
+
const mapped = Object.fromEntries(Object.entries(node.outputToVariables ?? {}).map(([name, path]) => [name,
|
|
171
|
+
path.split('.').reduce((value, key) => value && typeof value === 'object' ? value[key] : undefined, output)]));
|
|
172
|
+
state = { ...state, variables: { ...state.variables, ...output, ...mapped,
|
|
173
|
+
[`${node.activityId}_activityOutput`]: output, [`${node.activityId}_outcome`]: outcome },
|
|
174
|
+
activityOutputs: { ...state.activityOutputs, [node.activityId]: output }, lastActivityOutput: output };
|
|
175
|
+
current = node.routes[outcome];
|
|
176
|
+
}
|
|
177
|
+
if (current)
|
|
178
|
+
throw new Error('@workflow-management:task-actions.changed');
|
|
179
|
+
return completion;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region ----- Action Reconciliation -----
|
|
183
|
+
retire(key) {
|
|
184
|
+
this.retired.add(key);
|
|
185
|
+
if (this.retired.size > 500) {
|
|
186
|
+
const oldest = this.retired.values().next().value;
|
|
187
|
+
if (oldest)
|
|
188
|
+
this.retired.delete(oldest);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
refreshTask(taskId) {
|
|
192
|
+
globalThis.performance?.mark?.('axp:workflow-task:board-refresh');
|
|
193
|
+
this.events.publish('task-board.refresh', { provider: 'task-management.tasks', preserveRows: true, itemIds: [taskId] });
|
|
194
|
+
}
|
|
195
|
+
async measure(phase, work) {
|
|
196
|
+
const timeline = globalThis.performance;
|
|
197
|
+
if (!timeline?.measure)
|
|
198
|
+
return work();
|
|
199
|
+
const start = timeline.now();
|
|
200
|
+
try {
|
|
201
|
+
return await work();
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
timeline.measure(`axp:workflow-task:${phase}`, { start, end: timeline.now() });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region ----- Dialog Input -----
|
|
209
|
+
async collect(title, fields) {
|
|
210
|
+
const result = await this.layouts.create().dialog(dialog => dialog
|
|
211
|
+
.setTitle(title)
|
|
212
|
+
.setContext(Object.fromEntries(fields.filter(field => field.type === 'boolean').map(field => [field.name, false])))
|
|
213
|
+
.content(flex => {
|
|
214
|
+
flex.setDirection('column');
|
|
215
|
+
for (const input of fields)
|
|
216
|
+
flex.formField(input.title, field => {
|
|
217
|
+
field.path(input.name);
|
|
218
|
+
const type = input.choices ? AXPWidgetsCatalog.select : input.type === 'boolean' ? AXPWidgetsCatalog.checkbox : ['integer', 'number'].includes(input.type) ? AXPWidgetsCatalog.number : AXPWidgetsCatalog.text;
|
|
219
|
+
field.customWidget(type, {
|
|
220
|
+
...(input.choices ? { dataSource: input.choices.map(id => ({ id, title: String(id) })), valueField: 'id', textField: 'title' } : {}),
|
|
221
|
+
...(input.maxLength ? { maxLength: input.maxLength } : {}),
|
|
222
|
+
...(input.type === 'integer' ? { decimals: 0 } : {}),
|
|
223
|
+
validations: input.required && input.type !== 'boolean' ? [{ rule: 'required' }] : [],
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
})
|
|
227
|
+
.setActions(actions => actions.cancel('@general:actions.cancel.title').submit('@general:actions.submit.title'))
|
|
228
|
+
.onAction(ref => ref.action() === 'submit' ? ref.context() : null)).show();
|
|
229
|
+
const values = resolveLayoutBuilderDialogResult(result);
|
|
230
|
+
if (values == null)
|
|
231
|
+
return null;
|
|
232
|
+
// Blank optional number/select editors can return null; omit absent values
|
|
233
|
+
// rather than sending a value rejected by the authoritative input schema.
|
|
234
|
+
return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== undefined && value !== null));
|
|
235
|
+
}
|
|
236
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExecuteWorkflowTaskActionCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
237
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExecuteWorkflowTaskActionCommand, providedIn: 'root' }); }
|
|
238
|
+
}
|
|
239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExecuteWorkflowTaskActionCommand, decorators: [{
|
|
240
|
+
type: Injectable,
|
|
241
|
+
args: [{ providedIn: 'root' }]
|
|
242
|
+
}] });
|
|
243
|
+
|
|
244
|
+
export { ExecuteWorkflowTaskActionCommand };
|
|
245
|
+
//# sourceMappingURL=acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-workflow-management-client-execute-workflow-task-action.command-D117Kcca.mjs","sources":["../../../../libs/modules/workflow-management/client/src/lib/features/task-provider/workflow-task-interaction-input.util.ts","../../../../libs/modules/workflow-management/client/src/lib/features/task-provider/execute-workflow-task-action.command.ts"],"sourcesContent":["/** Give a prepared activity the identity of the action being executed, not a shared or graph-supplied task ID. */\nexport function withWorkflowTaskInput(input: Record<string, unknown> | undefined, taskId: string): Record<string, unknown> {\n const properties = input?.['properties'];\n return properties && typeof properties === 'object' && !Array.isArray(properties)\n ? { ...input, properties: { ...properties, taskId } }\n : { ...input, taskId };\n}\n","import { inject, Injectable } from '@angular/core';\nimport { AXDialogService } from '@acorex/components/dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPWorkflowManager, AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY, type AXPResumeWorkflowResponse, type AXPWorkflowInstanceState } from '@acorex-platform/framework-client/workflow';\nimport { AXPWidgetsCatalog, createRandomUuid, runtimeQueryPayloadData, type AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport type { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport type { WorkflowTaskActionPresentation, WorkflowTaskActionInputField, ExecuteWorkflowTaskActionRequest, ExecuteWorkflowTaskActionResult, WorkflowTaskInteractionCompletion } from '@acorex-platform/module-workflow-management-client/contracts';\nimport { withWorkflowTaskInput } from './workflow-task-interaction-input.util';\n\ntype ActionInput = WorkflowTaskActionPresentation & { input?: Record<string, unknown> };\n\n@Injectable({ providedIn: 'root' })\nexport class ExecuteWorkflowTaskActionCommand implements AXPCommand<ActionInput> {\n //#region ----- Services & Dependencies -----\n private readonly commands = inject(AXPCommandService);\n private readonly manager = inject(AXPWorkflowManager);\n private readonly session = inject(AXPSessionService);\n private readonly translations = inject(AXTranslationService);\n private readonly dialogs = inject(AXDialogService);\n private readonly layouts = inject(AXPLayoutBuilderService);\n private readonly events = inject(AXPBroadcastEventService);\n //#endregion\n\n //#region ----- Action Execution -----\n private readonly pending = new Map<string, Promise<AXPRuntimeCommandResult>>();\n private readonly retired = new Set<string>();\n\n execute(input: ActionInput): Promise<AXPRuntimeCommandResult> {\n const ref = input?.workflowAction;\n const key = JSON.stringify([this.scope(), ref?.taskId, ref?.actionId, ref?.expectedTaskVersion, ref?.actionRevision]);\n const active = this.pending.get(key);\n if (active) return active;\n // A committed decision consumes its menu reference. The row refresh\n // can arrive later than a second click; never send that reference twice.\n if (this.retired.has(key)) {\n if (input?.workflowAction?.taskId) this.refreshTask(input.workflowAction.taskId);\n return Promise.resolve({ success: false, metadata: { outcome: 'cancelled', refresh: false } });\n }\n const work = this.run(input, key).finally(() => { if (this.pending.get(key) === work) this.pending.delete(key); });\n this.pending.set(key, work);\n return work;\n }\n\n private scope(): string { return JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]); }\n\n private async run(input: ActionInput, key: string): Promise<AXPRuntimeCommandResult> {\n const scope = this.scope(), ref = input?.workflowAction;\n try {\n if (!ref?.taskId || !ref.actionId || !ref.actionRevision) throw new Error('@workflow-management:task-actions.changed');\n // The menu already contains the presentation. ExecuteAction validates the\n // version, revision and permissions again under the workflow lease.\n const presentation = input;\n let values = input.input;\n if (values === undefined && presentation.inputFields?.length) {\n const collected = await this.collect(presentation.title, presentation.inputFields);\n if (collected === null) return { success: false, metadata: { outcome: 'cancelled' } };\n values = collected;\n }\n if (presentation.confirmation) {\n const title = await this.translations.translateAsync(presentation.title);\n const message = await this.translations.translateAsync(presentation.confirmation);\n const confirmed = await this.dialogs.confirm(title, message, 'warning', 'horizontal', false, 'cancel');\n if (!confirmed.result) return { success: false, metadata: { outcome: 'cancelled' } };\n }\n if (scope !== this.scope()) throw new Error('@workflow-management:task-actions.changed');\n const { WORKFLOW_TASK_EXECUTE_ACTION } = await import('@acorex-platform/module-workflow-management-client/contracts');\n const request: ExecuteWorkflowTaskActionRequest = { ...ref, commandId: createRandomUuid(), input: values ?? {} };\n let response = await this.commands.executeRemote<ExecuteWorkflowTaskActionRequest, ExecuteWorkflowTaskActionResult>(WORKFLOW_TASK_EXECUTE_ACTION, request);\n let result = response && runtimeQueryPayloadData(response);\n if (!result) throw response ?? new Error('@workflow-management:task-actions.changed');\n if (scope !== this.scope()) throw new Error('@workflow-management:task-actions.changed');\n if (result.kind === 'opened') {\n const completion = await this.collectInteraction(result, ref.taskId);\n // This is a UI dismissal, not the workflow's Cancelled transition.\n // Keep the original menu/bookmark usable and issue no refresh or API.\n if (completion === null) return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'cancelled', refresh: false } };\n if (scope !== this.scope()) throw new Error('@workflow-management:task-actions.changed');\n const decision = { ...request, completion };\n response = await this.measure('complete-request', () =>\n this.sendDecision(WORKFLOW_TASK_EXECUTE_ACTION, decision, scope));\n result = response && runtimeQueryPayloadData(response);\n if (!result || result.kind === 'opened') throw response ?? new Error('@workflow-management:task-actions.changed');\n if (scope !== this.scope()) throw new Error('@workflow-management:task-actions.changed');\n }\n this.retire(key);\n if (result.kind === 'claimed') {\n this.refreshTask(ref.taskId);\n return { success: true, kind: 'object', data: result, metadata: { refresh: false } };\n }\n const resumed = await this.measure('client-continuation', () => this.manager.continueAfterResume(result.response as AXPResumeWorkflowResponse, {\n instanceId: result.instanceId, stepId: result.activityId, outcome: result.outcome,\n userInput: { bookmarkId: result.bookmarkId, [AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY]: true },\n }));\n // Only committed decisions replace the bookmark and reconcile the row.\n this.refreshTask(ref.taskId);\n return resumed.success ? { success: true, kind: 'object', data: resumed, metadata: { refresh: false } } : { success: false, message: { text: platformErrorI18nKey(resumed.errorCode) ?? '@general:messages.generic.error.description' }, metadata: { refresh: false } };\n } catch (error) {\n if (scope === this.scope() && ref?.taskId) this.refreshTask(ref.taskId);\n const info = extractRequestErrorInfo(error);\n if (info?.code === 'conflict' || info?.status === 409) {\n this.retire(key);\n return { success: false, metadata: { outcome: 'cancelled', refresh: false } };\n }\n const message = error instanceof Error && error.message.startsWith('@') ? error.message : platformErrorI18nKey(info?.code) ?? '@general:messages.generic.error.description';\n return { success: false, message: { text: message }, metadata: { refresh: false } };\n }\n }\n\n //#endregion\n\n //#region ----- Prepared Interaction -----\n private async sendDecision(command: string, request: ExecuteWorkflowTaskActionRequest, scope: string) {\n const send = () => this.commands.executeRemote<ExecuteWorkflowTaskActionRequest, ExecuteWorkflowTaskActionResult>(command, request);\n const lostAcknowledgement = (error: unknown) => {\n const status = extractRequestErrorInfo(error)?.status;\n return scope === this.scope() && (status === 0 || status === 502 || status === 504);\n };\n let response: Awaited<ReturnType<typeof send>>;\n try {\n response = await send();\n } catch (error) {\n if (!lostAcknowledgement(error)) throw error;\n return send();\n }\n // The exact same command ID and completion are safe to replay after a transport failure.\n return lostAcknowledgement(response) ? send() : response;\n }\n\n private async collectInteraction(opened: ExecuteWorkflowTaskActionResult, taskId: string): Promise<WorkflowTaskInteractionCompletion[] | null> {\n const interaction = opened.interaction;\n const response = opened.response as { state?: AXPWorkflowInstanceState };\n if (!interaction || !response.state || response.state.instanceId !== opened.instanceId) throw new Error('@workflow-management:task-actions.changed');\n let state = structuredClone(response.state);\n let current: string | null = interaction.startActivityId;\n const completion: WorkflowTaskInteractionCompletion[] = [];\n while (current && completion.length < 10) {\n const node = interaction.activities.find(activity => activity.activityId === current);\n if (!node) throw new Error('@workflow-management:task-actions.changed');\n const input = withWorkflowTaskInput(node.input, taskId);\n const result = await this.manager.executePreparedActivity({ taskToken: '', activityId: node.activityId, activityType: node.activityType,\n executionMode: 'frontend', taskType: 'ui-activity', input, config: input }, state);\n if (['cancel', 'cancelled', 'close'].includes(result.outcome.toLowerCase())) return null;\n const outcome = Object.keys(node.routes).find(key => key.toLowerCase() === result.outcome.toLowerCase());\n if (!outcome) throw new Error('@general:messages.generic.error.description');\n const output = result.output && typeof result.output === 'object' && !Array.isArray(result.output) ? result.output as Record<string, unknown> : {};\n completion.push({ activityId: node.activityId, outcome, output });\n const mapped = Object.fromEntries(Object.entries(node.outputToVariables ?? {}).map(([name, path]) => [name,\n path.split('.').reduce<unknown>((value, key) => value && typeof value === 'object' ? (value as Record<string, unknown>)[key] : undefined, output)]));\n state = { ...state, variables: { ...state.variables, ...output, ...mapped,\n [`${node.activityId}_activityOutput`]: output, [`${node.activityId}_outcome`]: outcome },\n activityOutputs: { ...state.activityOutputs, [node.activityId]: output }, lastActivityOutput: output };\n current = node.routes[outcome];\n }\n if (current) throw new Error('@workflow-management:task-actions.changed');\n return completion;\n }\n //#endregion\n\n //#region ----- Action Reconciliation -----\n private retire(key: string): void {\n this.retired.add(key);\n if (this.retired.size > 500) {\n const oldest = this.retired.values().next().value;\n if (oldest) this.retired.delete(oldest);\n }\n }\n\n private refreshTask(taskId: string): void {\n globalThis.performance?.mark?.('axp:workflow-task:board-refresh');\n this.events.publish('task-board.refresh', { provider: 'task-management.tasks', preserveRows: true, itemIds: [taskId] });\n }\n\n private async measure<T>(phase: 'complete-request' | 'client-continuation', work: () => Promise<T>): Promise<T> {\n const timeline = globalThis.performance;\n if (!timeline?.measure) return work();\n const start = timeline.now();\n try {\n return await work();\n } finally {\n timeline.measure(`axp:workflow-task:${phase}`, { start, end: timeline.now() });\n }\n }\n //#endregion\n\n //#region ----- Dialog Input -----\n private async collect(title: string, fields: WorkflowTaskActionInputField[]): Promise<Record<string, unknown> | null> {\n const result = await this.layouts.create().dialog<Record<string, unknown> | null>(dialog => dialog\n .setTitle(title)\n .setContext(Object.fromEntries(fields.filter(field => field.type === 'boolean').map(field => [field.name, false])))\n .content(flex => {\n flex.setDirection('column');\n for (const input of fields) flex.formField(input.title, field => {\n field.path(input.name);\n const type = input.choices ? AXPWidgetsCatalog.select : input.type === 'boolean' ? AXPWidgetsCatalog.checkbox : ['integer', 'number'].includes(input.type) ? AXPWidgetsCatalog.number : AXPWidgetsCatalog.text;\n field.customWidget(type, {\n ...(input.choices ? { dataSource: input.choices.map(id => ({ id, title: String(id) })), valueField: 'id', textField: 'title' } : {}),\n ...(input.maxLength ? { maxLength: input.maxLength } : {}),\n ...(input.type === 'integer' ? { decimals: 0 } : {}),\n validations: input.required && input.type !== 'boolean' ? [{ rule: 'required' }] : [],\n });\n });\n })\n .setActions(actions => actions.cancel('@general:actions.cancel.title').submit('@general:actions.submit.title'))\n .onAction(ref => ref.action() === 'submit' ? ref.context() as Record<string, unknown> : null)).show();\n const values = resolveLayoutBuilderDialogResult<Record<string, unknown> | null>(result);\n if (values == null) return null;\n // Blank optional number/select editors can return null; omit absent values\n // rather than sending a value rejected by the authoritative input schema.\n return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== undefined && value !== null));\n }\n //#endregion\n}\n"],"names":[],"m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C,CAAC,IAAI,EAAE;AACvG,QAAA,MAAM,MAAM,GAAG,gCAAgC,CAAiC,MAAM,CAAC;QACvF,IAAI,MAAM,IAAI,IAAI;AAAE,YAAA,OAAO,IAAI;;;AAG/B,QAAA,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;IAChH;8GArMW,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cADnB,MAAM,EAAA,CAAA,CAAA;;2FACnB,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAD5C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -124,4 +124,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
124
124
|
}] });
|
|
125
125
|
|
|
126
126
|
export { ExecuteWorkflowWithInputCommand };
|
|
127
|
-
//# sourceMappingURL=acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-
|
|
127
|
+
//# sourceMappingURL=acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-BFdyJ4rC.mjs","sources":["../../../../libs/modules/workflow-management/client/src/lib/features/entities/workflow-definition/commands/execute-workflow-with-input.command.ts"],"sourcesContent":["\n\nimport { AXPWidgetPropertyGroup } from '@acorex-platform/framework-shared/widget-core';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPProperty } from '@acorex-platform/framework-shared/core';\nimport {\n AXPPropertyViewerResult,\n AXPPropertyViewerService,\n buildPropertyViewerInitialContextFromProperties,\n buildPropertyViewerTabsFromProperties,\n} from '@acorex-platform/framework-client/layout/components';\nimport { mapAXPPropertyToWidgetProperty } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPWorkflowDefinitionService } from '@acorex-platform/framework-client/workflow';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { cloneDeep } from 'lodash';\n\nimport type { ExecuteWorkflowInput, ExecuteWorkflowOutput } from './execute-workflow.command';\n\n//#region ---- Types ----\n\n/**\n * Invoked from entity list actions. Resolves {@link ExecuteWorkflowInput.workflowId} from\n * `options` or the root payload; optional `input` from options is ignored until\n * the property viewer collects values.\n */\nexport interface ExecuteWorkflowWithInputInvocation {\n workflowId: string;\n}\n\n//#endregion\n\n/**\n * Opens the property viewer when the workflow definition declares `inputs`, then runs\n * `WorkflowManagement.WorkflowDefinition:Execute` with the collected variables.\n */\n@Injectable()\nexport class ExecuteWorkflowWithInputCommand implements AXPCommand<\n ExecuteWorkflowWithInputInvocation,\n ExecuteWorkflowOutput\n> {\n //#region ---- Services & Dependencies ----\n\n private readonly workflowDefinitionService = inject(AXPWorkflowDefinitionService);\n private readonly propertyViewerService = inject(AXPPropertyViewerService);\n private readonly commandService = inject(AXPCommandService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(xx: unknown): AXPCommandExecuteResultPromise<ExecuteWorkflowOutput> {\n try {\n const raw = (xx as Record<string, unknown>) ?? {};\n const opts = (raw['options'] ?? xx) as Record<string, unknown>;\n const workflowId = String(opts['workflowId'] ?? '');\n if (!workflowId) {\n return {\n success: false,\n message: {\n text: (await this.translationService.translateAsync('@general:messages.invalid-data')) || 'Invalid data',\n },\n };\n }\n\n const definition = await this.workflowDefinitionService.getWorkflowByName(workflowId);\n if (!definition) {\n const notFound =\n (await this.translationService.translateAsync(\n '@workflow-management:workflow-definitions.actions.execute.workflow-not-found',\n { params: { name: workflowId } },\n )) || `Workflow \"${workflowId}\" was not found.`;\n return {\n success: false,\n message: { text: notFound },\n };\n }\n\n const inputProps = (definition.inputs ?? []) as AXPProperty[];\n let initialInput: Record<string, unknown> = {};\n\n if (inputProps.length > 0) {\n const dialogResult = await this.openInputDialog(\n inputProps,\n this.translationService.resolve(definition.title) ?? workflowId,\n );\n if (dialogResult === 'cancelled') {\n return {\n success: false,\n message: {\n text: (await this.translationService.translateAsync('@general:actions.cancel.title')) || 'Cancelled',\n },\n };\n }\n initialInput = dialogResult;\n }\n\n const executed = await this.commandService.execute<ExecuteWorkflowInput, ExecuteWorkflowOutput>(\n 'WorkflowManagement.WorkflowDefinition:Execute',\n {\n workflowId,\n input: initialInput,\n },\n );\n if (!executed) {\n return {\n success: false,\n message: {\n text:\n (await this.translationService.translateAsync('@general:messages.entity.command-no-result')) ||\n 'Command returned no result',\n },\n };\n }\n return executed;\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n return { success: false, message: { text: message } };\n }\n }\n\n private async openInputDialog(\n inputProps: AXPProperty[],\n workflowLabel: string,\n ): Promise<Record<string, unknown> | 'cancelled'> {\n const group: AXPWidgetPropertyGroup = { name: 'workflow-inputs', title: 'Input', order: 0 };\n const widgetProps = inputProps.map((p, index) =>\n mapAXPPropertyToWidgetProperty(p, {\n group,\n order: index,\n valuePathPrefix: 'input',\n resolveTitle: (prop) =>\n typeof prop.title === 'string' ? prop.title : (this.translationService.resolve(prop.title) ?? prop.name),\n resolveDescription: (prop) =>\n prop.description === undefined\n ? undefined\n : typeof prop.description === 'string'\n ? prop.description\n : this.translationService.resolve(prop.description),\n }),\n );\n\n const tabs = buildPropertyViewerTabsFromProperties(widgetProps);\n const context = buildPropertyViewerInitialContextFromProperties(widgetProps, { input: {} } as Record<\n string,\n unknown\n >);\n const titleKey = '@workflow-management:workflow-definitions.actions.execute.input-dialog.title';\n const rawTitle = await this.translationService.translateAsync(titleKey);\n const title = rawTitle && rawTitle !== titleKey ? rawTitle : `Input — ${workflowLabel}`;\n\n const result = (await this.propertyViewerService\n .create()\n .dialog<AXPPropertyViewerResult | null>((d) => {\n d.setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setMode('advanced')\n .setTabs(tabs)\n .setContext(cloneDeep(context));\n })\n .show()) as AXPPropertyViewerResult | null;\n\n if (!result || result.values === undefined || result.values === null) {\n return 'cancelled';\n }\n\n const values = result.values as Record<string, unknown>;\n const inputBag = values['input'];\n if (inputBag !== undefined && typeof inputBag === 'object' && !Array.isArray(inputBag)) {\n return { ...(inputBag as Record<string, unknown>) };\n }\n return {};\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;AA+BA;AAEA;;;AAGG;MAEU,+BAA+B,CAAA;AAD5C,IAAA,WAAA,GAAA;;AAOmB,QAAA,IAAA,CAAA,yBAAyB,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAChE,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACxD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAmInE,IAAA;;;IA7HC,MAAM,OAAO,CAAC,EAAW,EAAA;AACvB,QAAA,IAAI;AACF,YAAA,MAAM,GAAG,GAAI,EAA8B,IAAI,EAAE;YACjD,MAAM,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAA4B;YAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YACnD,IAAI,CA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;AACtF,YAAA,OAAO,EAAE,GAAI,QAAoC,EAAE;QACrD;AACA,QAAA,OAAO,EAAE;IACX;8GAzIW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA/B,+BAA+B,EAAA,CAAA,CAAA;;2FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-workflow-management-client-execute-workflow-with-input.command-8fwqrqCV.mjs","sources":["../../../../libs/modules/workflow-management/client/src/lib/features/entities/workflow-definition/commands/execute-workflow-with-input.command.ts"],"sourcesContent":["\n\nimport { AXPWidgetPropertyGroup } from '@acorex-platform/framework-shared/widget-core';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, AXPProperty } from '@acorex-platform/framework-shared/core';\nimport {\n AXPPropertyViewerResult,\n AXPPropertyViewerService,\n buildPropertyViewerInitialContextFromProperties,\n buildPropertyViewerTabsFromProperties,\n} from '@acorex-platform/framework-client/layout/components';\nimport { mapAXPPropertyToWidgetProperty } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPWorkflowDefinitionService } from '@acorex-platform/framework-client/workflow';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { cloneDeep } from 'lodash';\n\nimport type { ExecuteWorkflowInput, ExecuteWorkflowOutput } from './execute-workflow.command';\n\n//#region ---- Types ----\n\n/**\n * Invoked from entity list actions. Resolves {@link ExecuteWorkflowInput.workflowId} from\n * `options` or the root payload; optional `input` from options is ignored until\n * the property viewer collects values.\n */\nexport interface ExecuteWorkflowWithInputInvocation {\n workflowId: string;\n}\n\n//#endregion\n\n/**\n * Opens the property viewer when the workflow definition declares `inputs`, then runs\n * `WorkflowManagement.WorkflowDefinition:Execute` with the collected variables.\n */\n@Injectable()\nexport class ExecuteWorkflowWithInputCommand implements AXPCommand<\n ExecuteWorkflowWithInputInvocation,\n ExecuteWorkflowOutput\n> {\n //#region ---- Services & Dependencies ----\n\n private readonly workflowDefinitionService = inject(AXPWorkflowDefinitionService);\n private readonly propertyViewerService = inject(AXPPropertyViewerService);\n private readonly commandService = inject(AXPCommandService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(xx: unknown): AXPCommandExecuteResultPromise<ExecuteWorkflowOutput> {\n try {\n const raw = (xx as Record<string, unknown>) ?? {};\n const opts = (raw['options'] ?? xx) as Record<string, unknown>;\n const workflowId = String(opts['workflowId'] ?? '');\n if (!workflowId) {\n return {\n success: false,\n message: {\n text: (await this.translationService.translateAsync('@general:messages.invalid-data')) || 'Invalid data',\n },\n };\n }\n\n const definition = await this.workflowDefinitionService.getWorkflowByName(workflowId);\n if (!definition) {\n const notFound =\n (await this.translationService.translateAsync(\n '@workflow-management:workflow-definitions.actions.execute.workflow-not-found',\n { params: { name: workflowId } },\n )) || `Workflow \"${workflowId}\" was not found.`;\n return {\n success: false,\n message: { text: notFound },\n };\n }\n\n const inputProps = (definition.inputs ?? []) as AXPProperty[];\n let initialInput: Record<string, unknown> = {};\n\n if (inputProps.length > 0) {\n const dialogResult = await this.openInputDialog(\n inputProps,\n this.translationService.resolve(definition.title) ?? workflowId,\n );\n if (dialogResult === 'cancelled') {\n return {\n success: false,\n message: {\n text: (await this.translationService.translateAsync('@general:actions.cancel.title')) || 'Cancelled',\n },\n };\n }\n initialInput = dialogResult;\n }\n\n const executed = await this.commandService.execute<ExecuteWorkflowInput, ExecuteWorkflowOutput>(\n 'WorkflowManagement.WorkflowDefinition:Execute',\n {\n workflowId,\n input: initialInput,\n },\n );\n if (!executed) {\n return {\n success: false,\n message: {\n text:\n (await this.translationService.translateAsync('@general:messages.entity.command-no-result')) ||\n 'Command returned no result',\n },\n };\n }\n return executed;\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n return { success: false, message: { text: message } };\n }\n }\n\n private async openInputDialog(\n inputProps: AXPProperty[],\n workflowLabel: string,\n ): Promise<Record<string, unknown> | 'cancelled'> {\n const group: AXPWidgetPropertyGroup = { name: 'workflow-inputs', title: 'Input', order: 0 };\n const widgetProps = inputProps.map((p, index) =>\n mapAXPPropertyToWidgetProperty(p, {\n group,\n order: index,\n valuePathPrefix: 'input',\n resolveTitle: (prop) =>\n typeof prop.title === 'string' ? prop.title : (this.translationService.resolve(prop.title) ?? prop.name),\n resolveDescription: (prop) =>\n prop.description === undefined\n ? undefined\n : typeof prop.description === 'string'\n ? prop.description\n : this.translationService.resolve(prop.description),\n }),\n );\n\n const tabs = buildPropertyViewerTabsFromProperties(widgetProps);\n const context = buildPropertyViewerInitialContextFromProperties(widgetProps, { input: {} } as Record<\n string,\n unknown\n >);\n const titleKey = '@workflow-management:workflow-definitions.actions.execute.input-dialog.title';\n const rawTitle = await this.translationService.translateAsync(titleKey);\n const title = rawTitle && rawTitle !== titleKey ? rawTitle : `Input — ${workflowLabel}`;\n\n const result = (await this.propertyViewerService\n .create()\n .dialog<AXPPropertyViewerResult | null>((d) => {\n d.setTitle(title)\n .setSize('md')\n .setCloseButton(true)\n .setMode('advanced')\n .setTabs(tabs)\n .setContext(cloneDeep(context));\n })\n .show()) as AXPPropertyViewerResult | null;\n\n if (!result || result.values === undefined || result.values === null) {\n return 'cancelled';\n }\n\n const values = result.values as Record<string, unknown>;\n const inputBag = values['input'];\n if (inputBag !== undefined && typeof inputBag === 'object' && !Array.isArray(inputBag)) {\n return { ...(inputBag as Record<string, unknown>) };\n }\n return {};\n }\n\n //#endregion\n}\n"],"names":[],"mappings":";;;;;;;;;AA+BA;AAEA;;;AAGG;MAEU,+BAA+B,CAAA;AAD5C,IAAA,WAAA,GAAA;;AAOmB,QAAA,IAAA,CAAA,yBAAyB,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAChE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AI;AACZ,iBAAA,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACnC,QAAA,CAAC;aACA,IAAI,EAAE,CAAmC;AAE5C,QAAA,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE;AACpE,YAAA,OAAO,WAAW;QACpB;AAEA,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAiC;AACvD,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;AAChC,QAAA,IAAI,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AACtF,YAAA,OAAO,EAAE,GAAI,QAAoC,EAAE;QACrD;AACA,QAAA,OAAO,EAAE;IACX;8GAzIW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA/B,+BAA+B,EAAA,CAAA,CAAA;;2FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C;;;"}
|
|
@@ -158,4 +158,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
158
158
|
}] });
|
|
159
159
|
|
|
160
160
|
export { ExecuteWorkflowCommand };
|
|
161
|
-
//# sourceMappingURL=acorex-platform-module-workflow-management-client-execute-workflow.command-
|
|
161
|
+
//# sourceMappingURL=acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-workflow-management-client-execute-workflow.command-D1AQsYgn.mjs","sources":["../../../../libs/modules/workflow-management/client/src/lib/features/entities/workflow-definition/commands/execute-workflow.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';\nimport { Injectable, inject } from '@angular/core';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\n\n//#region ---- Types ----\n\n/**\n * Input for ExecuteWorkflow command\n */\nexport interface ExecuteWorkflowInput {\n /**\n * Workflow name (unique key)\n */\n workflowId: string;\n\n /**\n * Initial input data\n */\n input?: Record<string, any>;\n}\n\n/**\n * Output for ExecuteWorkflow command\n */\nexport interface ExecuteWorkflowOutput {\n /**\n * Instance ID\n */\n instanceId: string;\n\n /**\n * Workflow output\n */\n output: any;\n}\n\nconst WORKFLOW_EXECUTE_ERROR_I18N = '@workflow-management:workflow-instances.messages.error';\n\n//#endregion\n\n/**\n * Execute Workflow Command\n * \n * Starts and manages workflow execution from entity list.\n * Handles the complete workflow lifecycle including frontend/backend activities.\n */\n@Injectable()\nexport class ExecuteWorkflowCommand implements AXPCommand<ExecuteWorkflowInput, ExecuteWorkflowOutput> {\n //#region ---- Services ----\n\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(xx: any): AXPCommandExecuteResultPromise<ExecuteWorkflowOutput> {\n\n try {\n // Extract input from command context (entity actions pass options via options)\n const input = (xx?.options || xx) as ExecuteWorkflowInput;\n \n console.log(`[WorkflowManagement] 🚀 ExecuteWorkflowCommand: Starting workflow '${input.workflowId}'`, {\n workflowId: input.workflowId,\n input: input.input,\n context: xx,\n });\n\n // Start workflow execution\n // This uses the workflow engine which now queries definitions by name field\n const result = await this.workflowManager.start(input.workflowId, input.input || {});\n \n console.log(`[WorkflowManagement] 📊 Workflow start result:`, {\n success: result.success,\n instanceId: result.instanceId,\n error: result.error,\n stateStatus: result.state?.status,\n stateActivityOutputs: result.state?.activityOutputs,\n });\n\n if (!result.success) {\n console.error(`[WorkflowManagement] ❌ Failed to start workflow '${input.workflowId}':`, result.error);\n const unknownMessage = await this.translationService.translateAsync('@general:toggle.unknown');\n const errorMessage = result.error || unknownMessage;\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-failed-title`),\n content: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-content`, {\n params: { message: errorMessage },\n }),\n closeButton: true,\n timeOut: 5000,\n });\n\n return {\n success: false,\n message: { details: {\n instanceId: result.instanceId || '',\n output: null,\n },\n text: result.error || 'Unknown error'\n },\n };\n }\n\n console.log(`[WorkflowManagement] ✅ Workflow '${input.workflowId}' started successfully. Instance ID: ${result.instanceId}`);\n\n // Handle workflow execution loop\n // let currentResult = result;\n // let taskCount = 0;\n // while (currentResult.nextTask) {\n // taskCount++;\n // const task = currentResult.nextTask;\n\n // console.log(`[ExecuteWorkflowCommand] 🔄 Task ${taskCount}: Executing frontend task: ${task.activityType}`, task);\n\n // // Execute frontend task\n // console.log(`[ExecuteWorkflowCommand] ⚙️ Calling workflowManager.execute...`);\n // const executionResult = await this.workflowManager.execute(task);\n // console.log(`[ExecuteWorkflowCommand] ✅ Task executed:`, {\n // output: executionResult.output,\n // outcome: executionResult.outcome,\n // });\n \n // const { output, outcome } = executionResult;\n\n // // Complete task and get next\n // currentResult = await this.workflowManager.complete(\n // currentResult.instanceId!,\n // task,\n // outcome,\n // output\n // );\n\n // if (!currentResult.success) {\n // this.toastService.show({\n // color: 'danger',\n // title: 'Workflow Execution Failed',\n // content: currentResult.error || 'Unknown error',\n // closeButton: true,\n // timeOut: 5000,\n // });\n\n // return {\n // success: false,\n // message: {\n // text: currentResult.error || 'Unknown error'\n // },\n // data: {\n // instanceId: currentResult.instanceId || '',\n // output: null,\n // }\n // };\n // }\n // }\n\n // Workflow completed successfully\n // console.log(`[ExecuteWorkflowCommand] Workflow completed:`, currentResult.state?.output);\n\n if (result.dismissed) {\n return {\n success: true,\n kind: 'object',\n data: undefined as unknown as ExecuteWorkflowOutput,\n metadata: { refresh: false },\n };\n }\n\n return {\n success: true,\n kind: 'object',\n data: undefined as unknown as ExecuteWorkflowOutput,\n // data: {\n // instanceId: currentResult.instanceId!,\n // output: currentResult.state?.output,\n // }\n };\n } catch (error: any) {\n console.error(`[ExecuteWorkflowCommand] Error:`, error);\n\n const unknownMessage = await this.translationService.translateAsync('@general:toggle.unknown');\n const errorMessage = error.message || unknownMessage;\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-title`),\n content: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-content`, {\n params: { message: errorMessage },\n }),\n closeButton: true,\n timeOut: 5000,\n });\n\n return {\n success: false,\n message: { details: {\n instanceId: '',\n output: null,\n },\n text: error.message || 'Unknown error'\n },\n };\n }\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;;AAwCA,MAAM,2BAA2B,GAAG,wDAAwD;AAE5F;AAEA;;;;;AAKG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAC5C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA2JnE,IAAA;;;IArJC,MAAM,OAAO,CAAC,EAAO,EAAA;AAEnB,QAAA,IAAI;;YAEF,MAAM,KAAK,IAAI,EAAE,EAAE,OAAO,IAAI,EAAE,CAAyB;YAEzD,OAAO,CAAC,GAAG,CAAC,CAAA,mEAAA,EAAsE,KAAK,CAAC,UAAU,GAAG,EAAE;gBACrG,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,KAAK,EAAE,KAAK,CAAC,K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AAC;gBAC3G,OAAO,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA,EAAG,2BAA2B,CAAA,wBAAA,CAA0B,EAAE;AAC9G,oBAAA,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;iBAClC,CAAC;AACF,gBAAA,WAAW,EAAE,IAAI;AACjB,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA,CAAC;YAEF,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,EAAE,OAAO,EAAE;AAClB,wBAAA,UAAU,EAAE,EAAE;AACd,wBAAA,MAAM,EAAE,IAAI;AACb,qBAAA;AACC,oBAAA,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI;AACxB,iBAAA;aACA;QACL;IACF;8GA7JW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-workflow-management-client-execute-workflow.command-CnQgIVaj.mjs","sources":["../../../../libs/modules/workflow-management/client/src/lib/features/entities/workflow-definition/commands/execute-workflow.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';\nimport { Injectable, inject } from '@angular/core';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\n\n//#region ---- Types ----\n\n/**\n * Input for ExecuteWorkflow command\n */\nexport interface ExecuteWorkflowInput {\n /**\n * Workflow name (unique key)\n */\n workflowId: string;\n\n /**\n * Initial input data\n */\n input?: Record<string, any>;\n}\n\n/**\n * Output for ExecuteWorkflow command\n */\nexport interface ExecuteWorkflowOutput {\n /**\n * Instance ID\n */\n instanceId: string;\n\n /**\n * Workflow output\n */\n output: any;\n}\n\nconst WORKFLOW_EXECUTE_ERROR_I18N = '@workflow-management:workflow-instances.messages.error';\n\n//#endregion\n\n/**\n * Execute Workflow Command\n * \n * Starts and manages workflow execution from entity list.\n * Handles the complete workflow lifecycle including frontend/backend activities.\n */\n@Injectable()\nexport class ExecuteWorkflowCommand implements AXPCommand<ExecuteWorkflowInput, ExecuteWorkflowOutput> {\n //#region ---- Services ----\n\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(xx: any): AXPCommandExecuteResultPromise<ExecuteWorkflowOutput> {\n\n try {\n // Extract input from command context (entity actions pass options via options)\n const input = (xx?.options || xx) as ExecuteWorkflowInput;\n \n console.log(`[WorkflowManagement] 🚀 ExecuteWorkflowCommand: Starting workflow '${input.workflowId}'`, {\n workflowId: input.workflowId,\n input: input.input,\n context: xx,\n });\n\n // Start workflow execution\n // This uses the workflow engine which now queries definitions by name field\n const result = await this.workflowManager.start(input.workflowId, input.input || {});\n \n console.log(`[WorkflowManagement] 📊 Workflow start result:`, {\n success: result.success,\n instanceId: result.instanceId,\n error: result.error,\n stateStatus: result.state?.status,\n stateActivityOutputs: result.state?.activityOutputs,\n });\n\n if (!result.success) {\n console.error(`[WorkflowManagement] ❌ Failed to start workflow '${input.workflowId}':`, result.error);\n const unknownMessage = await this.translationService.translateAsync('@general:toggle.unknown');\n const errorMessage = result.error || unknownMessage;\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-failed-title`),\n content: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-content`, {\n params: { message: errorMessage },\n }),\n closeButton: true,\n timeOut: 5000,\n });\n\n return {\n success: false,\n message: { details: {\n instanceId: result.instanceId || '',\n output: null,\n },\n text: result.error || 'Unknown error'\n },\n };\n }\n\n console.log(`[WorkflowManagement] ✅ Workflow '${input.workflowId}' started successfully. Instance ID: ${result.instanceId}`);\n\n // Handle workflow execution loop\n // let currentResult = result;\n // let taskCount = 0;\n // while (currentResult.nextTask) {\n // taskCount++;\n // const task = currentResult.nextTask;\n\n // console.log(`[ExecuteWorkflowCommand] 🔄 Task ${taskCount}: Executing frontend task: ${task.activityType}`, task);\n\n // // Execute frontend task\n // console.log(`[ExecuteWorkflowCommand] ⚙️ Calling workflowManager.execute...`);\n // const executionResult = await this.workflowManager.execute(task);\n // console.log(`[ExecuteWorkflowCommand] ✅ Task executed:`, {\n // output: executionResult.output,\n // outcome: executionResult.outcome,\n // });\n \n // const { output, outcome } = executionResult;\n\n // // Complete task and get next\n // currentResult = await this.workflowManager.complete(\n // currentResult.instanceId!,\n // task,\n // outcome,\n // output\n // );\n\n // if (!currentResult.success) {\n // this.toastService.show({\n // color: 'danger',\n // title: 'Workflow Execution Failed',\n // content: currentResult.error || 'Unknown error',\n // closeButton: true,\n // timeOut: 5000,\n // });\n\n // return {\n // success: false,\n // message: {\n // text: currentResult.error || 'Unknown error'\n // },\n // data: {\n // instanceId: currentResult.instanceId || '',\n // output: null,\n // }\n // };\n // }\n // }\n\n // Workflow completed successfully\n // console.log(`[ExecuteWorkflowCommand] Workflow completed:`, currentResult.state?.output);\n\n if (result.dismissed) {\n return {\n success: true,\n kind: 'object',\n data: undefined as unknown as ExecuteWorkflowOutput,\n metadata: { refresh: false },\n };\n }\n\n return {\n success: true,\n kind: 'object',\n data: undefined as unknown as ExecuteWorkflowOutput,\n // data: {\n // instanceId: currentResult.instanceId!,\n // output: currentResult.state?.output,\n // }\n };\n } catch (error: any) {\n console.error(`[ExecuteWorkflowCommand] Error:`, error);\n\n const unknownMessage = await this.translationService.translateAsync('@general:toggle.unknown');\n const errorMessage = error.message || unknownMessage;\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-title`),\n content: await this.translationService.translateAsync(`${WORKFLOW_EXECUTE_ERROR_I18N}.execution-error-content`, {\n params: { message: errorMessage },\n }),\n closeButton: true,\n timeOut: 5000,\n });\n\n return {\n success: false,\n message: { details: {\n instanceId: '',\n output: null,\n },\n text: error.message || 'Unknown error'\n },\n };\n }\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;;AAwCA,MAAM,2BAA2B,GAAG,wDAAwD;AAE5F;AAEA;;;;;AAKG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAC5C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA2JnE,IAAA;;;IArJC,MAAM,OAAO,CAAC,EAAO,EAAA;AAEnB,QAAA,IAAI;;YAEF,MAAM,KAAK,IAAI,EAAE,EAAE,OAAO,IAAI,EAAE,CAAyB;YAEzD,OAAO,CAAC,GAAG,CAAC,CAAA,mEAAA,EAAsE,KAAK,CAAC,UAAU,GAAG,EAAE;gBACrG,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gBAAA,OAAO,EAAE,EAAE;AACZ,aAAA,CAAC;;;AAIF,YAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;AAEpF,YAAA,OAAO,CAAC,GAAG,CAAC,CAAA,8CAAA,CAAgD,EAAE;gBAC5D,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,C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UAAU,EAAE,EAAE;AACd,wBAAA,MAAM,EAAE,IAAI;AACb,qBAAA;AACC,oBAAA,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI;AACxB,iBAAA;aACA;QACL;IACF;8GA7JW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
@@ -57,4 +57,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
57
57
|
}] });
|
|
58
58
|
|
|
59
59
|
export { SaveWorkflowDefinitionActivitiesCommand, WORKFLOW_DEFINITION_ACTIVITIES_SAVE_COMMAND };
|
|
60
|
-
//# sourceMappingURL=acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-
|
|
60
|
+
//# sourceMappingURL=acorex-platform-module-workflow-management-client-save-workflow-definition-activities.command-CvFHyST8.mjs.map
|