@acorex/platform 21.0.0-next.3 → 21.0.0-next.34
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-auth.mjs +295 -45
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/{acorex-platform-common-common-settings.provider-zhqNP3xb.mjs → acorex-platform-common-common-settings.provider-G9XcXXOG.mjs} +60 -4
- package/fesm2022/acorex-platform-common-common-settings.provider-G9XcXXOG.mjs.map +1 -0
- package/fesm2022/acorex-platform-common.mjs +960 -319
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +1352 -832
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-domain.mjs +554 -826
- package/fesm2022/acorex-platform-domain.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +530 -154
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components-binding-expression-editor-popup.component-CXEdvDTf.mjs +121 -0
- package/fesm2022/acorex-platform-layout-components-binding-expression-editor-popup.component-CXEdvDTf.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-components.mjs +5969 -2347
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-designer.mjs +169 -154
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +15380 -9274
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +393 -110
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +511 -450
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/{acorex-platform-layout-widgets-button-widget-designer.component-C3VoBb_b.mjs → acorex-platform-layout-widgets-button-widget-designer.component-Dy7jF-oD.mjs} +10 -10
- package/fesm2022/acorex-platform-layout-widgets-button-widget-designer.component-Dy7jF-oD.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs → acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs} +39 -16
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs → acorex-platform-layout-widgets-image-preview.popup-C_EPAvCU.mjs} +6 -7
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-C_EPAvCU.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-page-widget-designer.component-BtZMBxYp.mjs → acorex-platform-layout-widgets-page-widget-designer.component-D10yO28c.mjs} +12 -12
- package/fesm2022/acorex-platform-layout-widgets-page-widget-designer.component-D10yO28c.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-repeater-widget-column.component-BGQqY5Mw.mjs +111 -0
- package/fesm2022/acorex-platform-layout-widgets-repeater-widget-column.component-BGQqY5Mw.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-DmzNTYiS.mjs} +6 -6
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-DmzNTYiS.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-BNG_588B.mjs} +5 -5
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-BNG_588B.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-text-block-widget-designer.component-Df1BFkSa.mjs → acorex-platform-layout-widgets-text-block-widget-designer.component-Vo4fWHtX.mjs} +6 -6
- package/fesm2022/acorex-platform-layout-widgets-text-block-widget-designer.component-Vo4fWHtX.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs +7865 -4026
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-native.mjs +8 -7
- package/fesm2022/acorex-platform-native.mjs.map +1 -1
- package/fesm2022/acorex-platform-runtime.mjs +220 -169
- package/fesm2022/acorex-platform-runtime.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Cvvr4HnL.mjs +160 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Cvvr4HnL.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-TYoLN1Jq.mjs +120 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-TYoLN1Jq.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs → acorex-platform-themes-default-entity-master-single-view.component-C2z5Lq9y.mjs} +18 -25
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-C2z5Lq9y.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-error-401.component-cfREo88K.mjs → acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs} +4 -4
- package/fesm2022/acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-error-404.component-CdCV5ZoA.mjs → acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs} +4 -4
- package/fesm2022/acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-error-offline.component-DR6G8gPC.mjs +19 -0
- package/fesm2022/acorex-platform-themes-default-error-offline.component-DR6G8gPC.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +1717 -66
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs → acorex-platform-themes-shared-icon-chooser-column.component-CqkWJYdv.mjs} +6 -6
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-CqkWJYdv.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-shared-icon-chooser-view.component-9W52W6Nu.mjs → acorex-platform-themes-shared-icon-chooser-view.component-BOTuLdWN.mjs} +6 -6
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-view.component-BOTuLdWN.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-settings.provider-DSs1o1M6.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-shared-theme-color-chooser-column.component-DTnfRy5f.mjs → acorex-platform-themes-shared-theme-color-chooser-column.component-CHfrTtol.mjs} +11 -11
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-CHfrTtol.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-shared-theme-color-chooser-view.component-DY0JtT1v.mjs → acorex-platform-themes-shared-theme-color-chooser-view.component-BSmvnUVq.mjs} +9 -9
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-view.component-BSmvnUVq.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared.mjs +563 -561
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +1735 -1750
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/fesm2022/acorex-platform.mjs.map +1 -1
- package/package.json +31 -31
- package/{auth/index.d.ts → types/acorex-platform-auth.d.ts} +247 -10
- package/{common/index.d.ts → types/acorex-platform-common.d.ts} +492 -31
- package/{core/index.d.ts → types/acorex-platform-core.d.ts} +606 -392
- package/{domain/index.d.ts → types/acorex-platform-domain.d.ts} +719 -413
- package/{layout/builder/index.d.ts → types/acorex-platform-layout-builder.d.ts} +128 -56
- package/types/acorex-platform-layout-components.d.ts +2927 -0
- package/{layout/designer/index.d.ts → types/acorex-platform-layout-designer.d.ts} +9 -3
- package/{layout/entity/index.d.ts → types/acorex-platform-layout-entity.d.ts} +1133 -237
- package/{layout/views/index.d.ts → types/acorex-platform-layout-views.d.ts} +90 -31
- package/{layout/widget-core/index.d.ts → types/acorex-platform-layout-widget-core.d.ts} +206 -102
- package/{layout/widgets/index.d.ts → types/acorex-platform-layout-widgets.d.ts} +942 -137
- package/{native/index.d.ts → types/acorex-platform-native.d.ts} +0 -7
- package/{runtime/index.d.ts → types/acorex-platform-runtime.d.ts} +237 -74
- package/{themes/default/index.d.ts → types/acorex-platform-themes-default.d.ts} +113 -5
- package/{themes/shared/index.d.ts → types/acorex-platform-themes-shared.d.ts} +1 -1
- package/types/acorex-platform-workflow.d.ts +1806 -0
- package/fesm2022/acorex-platform-common-common-settings.provider-zhqNP3xb.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-button-widget-designer.component-C3VoBb_b.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-page-widget-designer.component-BtZMBxYp.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-text-block-widget-designer.component-Df1BFkSa.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs +0 -157
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs +0 -1542
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs +0 -101
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-error-401.component-cfREo88K.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-error-404.component-CdCV5ZoA.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-error-offline.component-E7SzBcAt.mjs +0 -19
- package/fesm2022/acorex-platform-themes-default-error-offline.component-E7SzBcAt.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-view.component-9W52W6Nu.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-DTnfRy5f.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-view.component-DY0JtT1v.mjs.map +0 -1
- package/layout/components/index.d.ts +0 -1669
- package/workflow/index.d.ts +0 -2443
- /package/{index.d.ts → types/acorex-platform.d.ts} +0 -0
|
@@ -0,0 +1,1806 @@
|
|
|
1
|
+
import * as rxjs from 'rxjs';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Type, ModuleWithProviders, Injector, InjectionToken } from '@angular/core';
|
|
5
|
+
import { AXPValidationRules, AXPEntityOp, AXPCategoryEntity, AXPExpressionEvaluatorScope } from '@acorex/platform/core';
|
|
6
|
+
import { AXPWidgetTypesMap } from '@acorex/platform/layout/widget-core';
|
|
7
|
+
|
|
8
|
+
declare class AXPWorkflowError extends Error {
|
|
9
|
+
inner: Error | null;
|
|
10
|
+
constructor(message: string, inner?: Error | null);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AXPWorkflow {
|
|
14
|
+
steps: {
|
|
15
|
+
[stepName: string]: AXPWorkflowStep;
|
|
16
|
+
};
|
|
17
|
+
startStepId: string;
|
|
18
|
+
}
|
|
19
|
+
declare class AXPWorkflowContext {
|
|
20
|
+
constructor(initialData?: any);
|
|
21
|
+
private variables;
|
|
22
|
+
private stepOutputs;
|
|
23
|
+
setVariable(key: string, value: any): void;
|
|
24
|
+
setVariables(context?: any): void;
|
|
25
|
+
getVariable<T = any>(key?: string | null): T;
|
|
26
|
+
setOutput(key: string, output: any): void;
|
|
27
|
+
setOutputs(values: Map<string, any>): void;
|
|
28
|
+
getOutput<T = any>(key: string): T;
|
|
29
|
+
}
|
|
30
|
+
type AXPWorkflowActionInput = any;
|
|
31
|
+
type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';
|
|
32
|
+
interface AXPWorkflowCondition {
|
|
33
|
+
type: AXPWorkflowConditionType;
|
|
34
|
+
conditions?: AXPWorkflowCondition[];
|
|
35
|
+
expression?: string;
|
|
36
|
+
}
|
|
37
|
+
interface AXPWorkflowNextStep {
|
|
38
|
+
conditions: AXPWorkflowCondition[];
|
|
39
|
+
nextStepId: string;
|
|
40
|
+
}
|
|
41
|
+
interface AXPWorkflowStep {
|
|
42
|
+
id?: string;
|
|
43
|
+
action: AXPWorkflowAction | string;
|
|
44
|
+
input?: AXPWorkflowActionInput;
|
|
45
|
+
nextSteps?: AXPWorkflowNextStep[];
|
|
46
|
+
conditions?: AXPWorkflowCondition[];
|
|
47
|
+
}
|
|
48
|
+
declare abstract class AXPWorkflowAction {
|
|
49
|
+
private eventService;
|
|
50
|
+
protected dispatch(event: AXPWorkflowEvent): void;
|
|
51
|
+
abstract execute(context: AXPWorkflowContext): Promise<void>;
|
|
52
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowAction, never>;
|
|
53
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowAction>;
|
|
54
|
+
}
|
|
55
|
+
declare abstract class AXPWorkflowFunction {
|
|
56
|
+
abstract execute(...args: any[]): Promise<any> | any;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowFunction, never>;
|
|
58
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowFunction>;
|
|
59
|
+
}
|
|
60
|
+
interface AXPWorkflowEvent<T = any> {
|
|
61
|
+
type: string;
|
|
62
|
+
payload?: T;
|
|
63
|
+
}
|
|
64
|
+
declare function createWorkFlowEvent<T>(type: string): {
|
|
65
|
+
(payload: T): {
|
|
66
|
+
type: string;
|
|
67
|
+
payload: T;
|
|
68
|
+
};
|
|
69
|
+
type: string;
|
|
70
|
+
};
|
|
71
|
+
declare function ofType<T extends {
|
|
72
|
+
type: string;
|
|
73
|
+
}>(...allowedTypes: Array<{
|
|
74
|
+
type: string;
|
|
75
|
+
}>): rxjs.MonoTypeOperatorFunction<T>;
|
|
76
|
+
|
|
77
|
+
declare class AXPWorkflowEventService {
|
|
78
|
+
private eventSubject;
|
|
79
|
+
dispatch(event: AXPWorkflowEvent): void;
|
|
80
|
+
get events$(): Observable<AXPWorkflowEvent>;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowEventService, never>;
|
|
82
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowEventService>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare class AXPWorkflowRegistryService {
|
|
86
|
+
private functionsMap;
|
|
87
|
+
private actionsMap;
|
|
88
|
+
private workflowsMap;
|
|
89
|
+
registerWorkflow(name: string, workflow: AXPWorkflow): void;
|
|
90
|
+
getWorkflow(name: string): AXPWorkflow | undefined;
|
|
91
|
+
registerAction(name: string, action: Type<AXPWorkflowAction>): void;
|
|
92
|
+
getAction(name: string): Type<AXPWorkflowAction> | undefined;
|
|
93
|
+
registerFunction(name: string, func: Type<AXPWorkflowFunction>): void;
|
|
94
|
+
getFunction(name: string): Type<AXPWorkflowFunction> | undefined;
|
|
95
|
+
getFunctionNames(): string[];
|
|
96
|
+
getStep(workflowName: string, stepName: string): AXPWorkflowStep | undefined;
|
|
97
|
+
updateStepInWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
|
|
98
|
+
addStepToWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
|
|
99
|
+
addAfterStep(workflowId: string, stepId: string, newStepId: string, newStepAction: string, conditionExpression: string): void;
|
|
100
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowRegistryService, never>;
|
|
101
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowRegistryService>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface AXPWorkflowModuleConfigs {
|
|
105
|
+
functions?: {
|
|
106
|
+
[name: string]: Type<AXPWorkflowFunction>;
|
|
107
|
+
};
|
|
108
|
+
actions?: {
|
|
109
|
+
[name: string]: Type<AXPWorkflowAction>;
|
|
110
|
+
};
|
|
111
|
+
workflows?: {
|
|
112
|
+
[name: string]: AXPWorkflow;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
declare class AXPWorkflowModule {
|
|
116
|
+
static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
|
|
117
|
+
static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
|
|
118
|
+
/**
|
|
119
|
+
* @ignore
|
|
120
|
+
*/
|
|
121
|
+
constructor(instances: any[]);
|
|
122
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowModule, [{ optional: true; }]>;
|
|
123
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXPWorkflowModule, never, never, never>;
|
|
124
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXPWorkflowModule>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare class AXPWorkflowService {
|
|
128
|
+
private registryService;
|
|
129
|
+
private injector;
|
|
130
|
+
private eventService;
|
|
131
|
+
get events$(): Observable<AXPWorkflowEvent>;
|
|
132
|
+
constructor(registryService: AXPWorkflowRegistryService, injector: Injector);
|
|
133
|
+
exists(name: string): boolean;
|
|
134
|
+
execute(workflow: AXPWorkflow | string, initialContext?: AXPWorkflowContext | any | null): Promise<AXPWorkflowContext>;
|
|
135
|
+
private processData;
|
|
136
|
+
private getActionInstance;
|
|
137
|
+
private getWorkflowInstance;
|
|
138
|
+
private determineNextStep;
|
|
139
|
+
private evaluateCondition;
|
|
140
|
+
private evaluateSingleCondition;
|
|
141
|
+
private evaluateExpression;
|
|
142
|
+
private processInputs;
|
|
143
|
+
private createFunctionScope;
|
|
144
|
+
private getFunctionInstance;
|
|
145
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowService, never>;
|
|
146
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowService>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface AXPWorkflowDefinition {
|
|
150
|
+
schemaVersion: "acorex-platform-workflow/v1";
|
|
151
|
+
name: string;
|
|
152
|
+
title?: string | null;
|
|
153
|
+
description?: string | null;
|
|
154
|
+
variables?: AXPVariableDefinition[];
|
|
155
|
+
inputs?: AXPWorkflowInputDescriptor[];
|
|
156
|
+
outputs?: AXPWorkflowOutputDescriptor[];
|
|
157
|
+
graph: AXPWorkflowGraph;
|
|
158
|
+
customProperties?: Record<string, any>;
|
|
159
|
+
/** engine specific (Elsa, ...) */
|
|
160
|
+
extensions?: AXPWorkflowExtensions;
|
|
161
|
+
/**
|
|
162
|
+
* Workflow bindings configuration.
|
|
163
|
+
* Defines which entities and events should trigger this workflow.
|
|
164
|
+
*/
|
|
165
|
+
bindings?: AXPWorkflowBinding[];
|
|
166
|
+
}
|
|
167
|
+
interface AXPWorkflowGraph {
|
|
168
|
+
startActivityId: string;
|
|
169
|
+
activities: AXPWorkflowActivityInstance[];
|
|
170
|
+
connections: AXPConnection[];
|
|
171
|
+
/** purely designer */
|
|
172
|
+
designer?: {
|
|
173
|
+
nodes?: Record<string, {
|
|
174
|
+
x: number;
|
|
175
|
+
y: number;
|
|
176
|
+
nodeId?: string;
|
|
177
|
+
}>;
|
|
178
|
+
edges?: Array<{
|
|
179
|
+
from: string;
|
|
180
|
+
to: string;
|
|
181
|
+
vertices?: Array<{
|
|
182
|
+
x: number;
|
|
183
|
+
y: number;
|
|
184
|
+
}>;
|
|
185
|
+
}>;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
interface AXPWorkflowActivityInstance {
|
|
189
|
+
id: string;
|
|
190
|
+
nodeId?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Activity name - references AXPActivityDefinition.name
|
|
193
|
+
* Used to lookup activity definition for metadata (executionMode, title, etc.)
|
|
194
|
+
*/
|
|
195
|
+
name: string;
|
|
196
|
+
/**
|
|
197
|
+
* Input values for this activity instance.
|
|
198
|
+
* Key-value pairs where keys match input descriptor names from AXPActivityDefinition.inputs
|
|
199
|
+
* Example: { "message": "Hello", "duration": 5000 }
|
|
200
|
+
*/
|
|
201
|
+
inputs?: Record<string, any>;
|
|
202
|
+
/**
|
|
203
|
+
* Output mapping: process variable name → path in this activity's output (BPMN-style: activity → variable).
|
|
204
|
+
* When this activity completes, each entry sets variables[variableName] = output[outputPath].
|
|
205
|
+
* Example: { leaveRequestId: 'id' } → variables.leaveRequestId = activityOutput.id
|
|
206
|
+
*/
|
|
207
|
+
outputToVariables?: Record<string, string>;
|
|
208
|
+
metadata?: Record<string, any>;
|
|
209
|
+
/** engine-specific override */
|
|
210
|
+
extensions?: Record<string, any>;
|
|
211
|
+
}
|
|
212
|
+
interface AXPConnection {
|
|
213
|
+
source: {
|
|
214
|
+
activtyName: string;
|
|
215
|
+
port?: string | null;
|
|
216
|
+
};
|
|
217
|
+
target: {
|
|
218
|
+
activtyName: string;
|
|
219
|
+
port?: string | null;
|
|
220
|
+
};
|
|
221
|
+
vertices?: Array<{
|
|
222
|
+
x: number;
|
|
223
|
+
y: number;
|
|
224
|
+
}>;
|
|
225
|
+
}
|
|
226
|
+
interface AXPWorkflowPropertyWidget {
|
|
227
|
+
type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
|
|
228
|
+
options?: Record<string, any>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Base schema shape for workflow inputs, outputs, and variables.
|
|
232
|
+
*/
|
|
233
|
+
interface AXPWorkflowDescriptorSchemaBase {
|
|
234
|
+
dataType: string;
|
|
235
|
+
isArray?: boolean;
|
|
236
|
+
nullable?: boolean;
|
|
237
|
+
readonly?: boolean;
|
|
238
|
+
hidden?: boolean | string;
|
|
239
|
+
defaultValue?: any | string | ((context: any | null) => any);
|
|
240
|
+
interface: AXPWorkflowPropertyWidget;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Base descriptor for workflow inputs, outputs, and variables.
|
|
244
|
+
* Shared fields: name, title, description, schema.
|
|
245
|
+
*/
|
|
246
|
+
interface AXPWorkflowDescriptorBase {
|
|
247
|
+
name: string;
|
|
248
|
+
title: string;
|
|
249
|
+
description?: string;
|
|
250
|
+
schema: AXPWorkflowDescriptorSchemaBase;
|
|
251
|
+
}
|
|
252
|
+
interface AXPWorkflowInputDescriptor extends AXPWorkflowDescriptorBase {
|
|
253
|
+
validations?: AXPValidationRules;
|
|
254
|
+
}
|
|
255
|
+
interface AXPWorkflowOutputDescriptor extends AXPWorkflowDescriptorBase {
|
|
256
|
+
/**
|
|
257
|
+
* Optional: where this output comes from in your context/memory.
|
|
258
|
+
* Example: "$.result.orderId" or "vars.orderId"
|
|
259
|
+
*/
|
|
260
|
+
path?: string;
|
|
261
|
+
metadata?: Record<string, any>;
|
|
262
|
+
}
|
|
263
|
+
interface AXPVariableDefinition extends AXPWorkflowDescriptorBase {
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Engine-specific extension bag for a workflow.
|
|
267
|
+
* Keep ALL engine-only fields here (Elsa, StepFunctions adapter, etc).
|
|
268
|
+
*/
|
|
269
|
+
interface AXPWorkflowExtensions {
|
|
270
|
+
/**
|
|
271
|
+
* Elsa-specific extensions (optional).
|
|
272
|
+
*/
|
|
273
|
+
elsa?: AXPElsaWorkflowExtensions;
|
|
274
|
+
/**
|
|
275
|
+
* Other engines (future-proof).
|
|
276
|
+
* Example: stepFunctions, logicApps, temporal, ...
|
|
277
|
+
*/
|
|
278
|
+
[engine: string]: any;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Elsa-only fields (Optional).
|
|
282
|
+
* Put strategy/tool/schema/raw payload here to keep Core model global.
|
|
283
|
+
*/
|
|
284
|
+
interface AXPElsaWorkflowExtensions {
|
|
285
|
+
/**
|
|
286
|
+
* Elsa schema URL (if you want to round-trip exact docs).
|
|
287
|
+
* Example: "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json"
|
|
288
|
+
*/
|
|
289
|
+
schema?: string;
|
|
290
|
+
toolVersion?: string;
|
|
291
|
+
materializerName?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Elsa strategy/options (engine-level concerns).
|
|
294
|
+
*/
|
|
295
|
+
options?: {
|
|
296
|
+
activationStrategyType?: string | null;
|
|
297
|
+
incidentStrategyType?: string | null;
|
|
298
|
+
commitStrategyName?: string | null;
|
|
299
|
+
autoUpdateConsumingWorkflows?: boolean;
|
|
300
|
+
usableAsActivity?: boolean | null;
|
|
301
|
+
activityCategory?: string | null;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* If you want lossless Elsa round-trip, keep the raw Elsa definition here.
|
|
305
|
+
*/
|
|
306
|
+
rawDefinition?: any;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Workflow binding configuration.
|
|
310
|
+
* Defines which entities and events should trigger a workflow.
|
|
311
|
+
*/
|
|
312
|
+
interface AXPWorkflowBinding {
|
|
313
|
+
/**
|
|
314
|
+
* Entity types this workflow applies to (e.g., ['ContentManagement.Promotion', 'ContentManagement.Article'])
|
|
315
|
+
* Empty array means applies to all entities with workflow plugin enabled.
|
|
316
|
+
*/
|
|
317
|
+
entityTypes: string[];
|
|
318
|
+
/**
|
|
319
|
+
* Event types that trigger this workflow (e.g., ['create', 'update'])
|
|
320
|
+
* Uses AXPEntityOp directly (create, update, delete, etc.)
|
|
321
|
+
*/
|
|
322
|
+
eventTypes: AXPEntityOp[];
|
|
323
|
+
/**
|
|
324
|
+
* Whether this binding is enabled
|
|
325
|
+
*/
|
|
326
|
+
enabled: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Optional conditions for when to trigger (future enhancement)
|
|
329
|
+
*/
|
|
330
|
+
conditions?: any;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Workflow status.
|
|
335
|
+
*/
|
|
336
|
+
type AXPWorkflowStatus = 'Running' | 'Finished';
|
|
337
|
+
/**
|
|
338
|
+
* Workflow sub-status.
|
|
339
|
+
*/
|
|
340
|
+
type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';
|
|
341
|
+
/**
|
|
342
|
+
* Activity status.
|
|
343
|
+
*/
|
|
344
|
+
type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';
|
|
345
|
+
/**
|
|
346
|
+
* Exception state.
|
|
347
|
+
*/
|
|
348
|
+
interface AXPExceptionState {
|
|
349
|
+
/**
|
|
350
|
+
* Exception type name.
|
|
351
|
+
*/
|
|
352
|
+
type: string;
|
|
353
|
+
/**
|
|
354
|
+
* Exception message.
|
|
355
|
+
*/
|
|
356
|
+
message: string;
|
|
357
|
+
/**
|
|
358
|
+
* Stack trace (nullable).
|
|
359
|
+
*/
|
|
360
|
+
stackTrace?: string | null;
|
|
361
|
+
/**
|
|
362
|
+
* Inner exception (nullable).
|
|
363
|
+
*/
|
|
364
|
+
innerException?: AXPExceptionState | null;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Activity incident.
|
|
368
|
+
*/
|
|
369
|
+
interface AXPActivityIncident {
|
|
370
|
+
/**
|
|
371
|
+
* Activity ID that caused the incident.
|
|
372
|
+
*/
|
|
373
|
+
activityId: string;
|
|
374
|
+
/**
|
|
375
|
+
* Activity node ID.
|
|
376
|
+
*/
|
|
377
|
+
activityNodeId: string;
|
|
378
|
+
/**
|
|
379
|
+
* Activity type.
|
|
380
|
+
*/
|
|
381
|
+
activityType: string;
|
|
382
|
+
/**
|
|
383
|
+
* Incident message.
|
|
384
|
+
*/
|
|
385
|
+
message: string;
|
|
386
|
+
/**
|
|
387
|
+
* Exception (nullable).
|
|
388
|
+
*/
|
|
389
|
+
exception?: AXPExceptionState | null;
|
|
390
|
+
/**
|
|
391
|
+
* Timestamp (ISO date-time).
|
|
392
|
+
*/
|
|
393
|
+
timestamp: string;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Workflow fault state.
|
|
397
|
+
*/
|
|
398
|
+
interface AXPWorkflowFaultState {
|
|
399
|
+
/**
|
|
400
|
+
* Exception (nullable).
|
|
401
|
+
*/
|
|
402
|
+
exception?: AXPExceptionState | null;
|
|
403
|
+
/**
|
|
404
|
+
* Fault message.
|
|
405
|
+
*/
|
|
406
|
+
message: string;
|
|
407
|
+
/**
|
|
408
|
+
* Faulted activity ID (nullable).
|
|
409
|
+
*/
|
|
410
|
+
faultedActivityId?: string | null;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Bookmark.
|
|
414
|
+
*/
|
|
415
|
+
interface AXPBookmark {
|
|
416
|
+
/**
|
|
417
|
+
* Bookmark ID.
|
|
418
|
+
*/
|
|
419
|
+
id: string;
|
|
420
|
+
/**
|
|
421
|
+
* Bookmark name.
|
|
422
|
+
*/
|
|
423
|
+
name: string;
|
|
424
|
+
/**
|
|
425
|
+
* Bookmark hash.
|
|
426
|
+
*/
|
|
427
|
+
hash: string;
|
|
428
|
+
/**
|
|
429
|
+
* Bookmark payload (nullable).
|
|
430
|
+
*/
|
|
431
|
+
payload?: any | null;
|
|
432
|
+
/**
|
|
433
|
+
* Activity node ID.
|
|
434
|
+
*/
|
|
435
|
+
activityNodeId: string;
|
|
436
|
+
/**
|
|
437
|
+
* Activity instance ID.
|
|
438
|
+
*/
|
|
439
|
+
activityInstanceId: string;
|
|
440
|
+
/**
|
|
441
|
+
* Auto burn flag.
|
|
442
|
+
*/
|
|
443
|
+
autoBurn?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Callback method name (nullable).
|
|
446
|
+
*/
|
|
447
|
+
callbackMethodName?: string | null;
|
|
448
|
+
/**
|
|
449
|
+
* Metadata (nullable).
|
|
450
|
+
*/
|
|
451
|
+
metadata?: Record<string, string> | null;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Completion callback state.
|
|
455
|
+
*/
|
|
456
|
+
interface AXPCompletionCallbackState {
|
|
457
|
+
/**
|
|
458
|
+
* Owner activity instance ID.
|
|
459
|
+
*/
|
|
460
|
+
ownerInstanceId: string;
|
|
461
|
+
/**
|
|
462
|
+
* Child activity node ID.
|
|
463
|
+
*/
|
|
464
|
+
childNodeId: string;
|
|
465
|
+
/**
|
|
466
|
+
* Method name (nullable).
|
|
467
|
+
*/
|
|
468
|
+
methodName?: string | null;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Variable (for activity context).
|
|
472
|
+
*/
|
|
473
|
+
interface AXPActivityVariable {
|
|
474
|
+
/**
|
|
475
|
+
* Variable ID.
|
|
476
|
+
*/
|
|
477
|
+
id: string;
|
|
478
|
+
/**
|
|
479
|
+
* Variable name.
|
|
480
|
+
*/
|
|
481
|
+
name: string;
|
|
482
|
+
/**
|
|
483
|
+
* Type name.
|
|
484
|
+
*/
|
|
485
|
+
typeName: string;
|
|
486
|
+
/**
|
|
487
|
+
* Is array flag.
|
|
488
|
+
*/
|
|
489
|
+
isArray?: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Variable value (nullable).
|
|
492
|
+
*/
|
|
493
|
+
value?: any | null;
|
|
494
|
+
/**
|
|
495
|
+
* Storage driver type name (nullable).
|
|
496
|
+
*/
|
|
497
|
+
storageDriverTypeName?: string | null;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Activity execution context state.
|
|
501
|
+
*/
|
|
502
|
+
interface AXPActivityExecutionContextState {
|
|
503
|
+
/**
|
|
504
|
+
* Context ID (activity instance ID).
|
|
505
|
+
*/
|
|
506
|
+
id: string;
|
|
507
|
+
/**
|
|
508
|
+
* Parent context ID (nullable).
|
|
509
|
+
*/
|
|
510
|
+
parentContextId?: string | null;
|
|
511
|
+
/**
|
|
512
|
+
* Scheduled activity node ID.
|
|
513
|
+
*/
|
|
514
|
+
scheduledActivityNodeId: string;
|
|
515
|
+
/**
|
|
516
|
+
* Owner activity node ID (nullable).
|
|
517
|
+
*/
|
|
518
|
+
ownerActivityNodeId?: string | null;
|
|
519
|
+
/**
|
|
520
|
+
* Properties bag.
|
|
521
|
+
*/
|
|
522
|
+
properties: Record<string, any>;
|
|
523
|
+
/**
|
|
524
|
+
* Activity state (evaluated properties) (nullable).
|
|
525
|
+
*/
|
|
526
|
+
activityState?: Record<string, any> | null;
|
|
527
|
+
/**
|
|
528
|
+
* Dynamic variables.
|
|
529
|
+
*/
|
|
530
|
+
dynamicVariables: AXPActivityVariable[];
|
|
531
|
+
/**
|
|
532
|
+
* Activity status.
|
|
533
|
+
*/
|
|
534
|
+
status: AXPActivityStatus;
|
|
535
|
+
/**
|
|
536
|
+
* Is executing flag.
|
|
537
|
+
*/
|
|
538
|
+
isExecuting: boolean;
|
|
539
|
+
/**
|
|
540
|
+
* Fault count.
|
|
541
|
+
*/
|
|
542
|
+
faultCount: number;
|
|
543
|
+
/**
|
|
544
|
+
* Started at timestamp (ISO date-time).
|
|
545
|
+
*/
|
|
546
|
+
startedAt: string;
|
|
547
|
+
/**
|
|
548
|
+
* Completed at timestamp (ISO date-time, nullable).
|
|
549
|
+
*/
|
|
550
|
+
completedAt?: string | null;
|
|
551
|
+
/**
|
|
552
|
+
* Tag (nullable).
|
|
553
|
+
*/
|
|
554
|
+
tag?: any | null;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Workflow state (internal execution state).
|
|
558
|
+
*/
|
|
559
|
+
interface AXPWorkflowState {
|
|
560
|
+
/**
|
|
561
|
+
* State ID.
|
|
562
|
+
*/
|
|
563
|
+
id: string;
|
|
564
|
+
/**
|
|
565
|
+
* Workflow definition ID.
|
|
566
|
+
*/
|
|
567
|
+
definitionId: string;
|
|
568
|
+
/**
|
|
569
|
+
* Workflow definition version.
|
|
570
|
+
*/
|
|
571
|
+
definitionVersion: number;
|
|
572
|
+
/**
|
|
573
|
+
* Correlation ID (nullable).
|
|
574
|
+
*/
|
|
575
|
+
correlationId?: string | null;
|
|
576
|
+
/**
|
|
577
|
+
* Workflow status.
|
|
578
|
+
*/
|
|
579
|
+
status: AXPWorkflowStatus;
|
|
580
|
+
/**
|
|
581
|
+
* Workflow sub-status.
|
|
582
|
+
*/
|
|
583
|
+
subStatus: AXPWorkflowSubStatus;
|
|
584
|
+
/**
|
|
585
|
+
* Bookmarks.
|
|
586
|
+
*/
|
|
587
|
+
bookmarks: AXPBookmark[];
|
|
588
|
+
/**
|
|
589
|
+
* Incidents.
|
|
590
|
+
*/
|
|
591
|
+
incidents: AXPActivityIncident[];
|
|
592
|
+
/**
|
|
593
|
+
* Fault (nullable).
|
|
594
|
+
*/
|
|
595
|
+
fault?: AXPWorkflowFaultState | null;
|
|
596
|
+
/**
|
|
597
|
+
* Completion callbacks.
|
|
598
|
+
*/
|
|
599
|
+
completionCallbacks: AXPCompletionCallbackState[];
|
|
600
|
+
/**
|
|
601
|
+
* Activity execution contexts.
|
|
602
|
+
*/
|
|
603
|
+
activityExecutionContexts: AXPActivityExecutionContextState[];
|
|
604
|
+
/**
|
|
605
|
+
* Input data.
|
|
606
|
+
*/
|
|
607
|
+
input: Record<string, any>;
|
|
608
|
+
/**
|
|
609
|
+
* Output data.
|
|
610
|
+
*/
|
|
611
|
+
output: Record<string, any>;
|
|
612
|
+
/**
|
|
613
|
+
* Properties bag.
|
|
614
|
+
*/
|
|
615
|
+
properties: Record<string, any>;
|
|
616
|
+
/**
|
|
617
|
+
* Created at timestamp (ISO date-time).
|
|
618
|
+
*/
|
|
619
|
+
createdAt: string;
|
|
620
|
+
/**
|
|
621
|
+
* Updated at timestamp (ISO date-time).
|
|
622
|
+
*/
|
|
623
|
+
updatedAt: string;
|
|
624
|
+
/**
|
|
625
|
+
* Finished at timestamp (ISO date-time, nullable).
|
|
626
|
+
*/
|
|
627
|
+
finishedAt?: string | null;
|
|
628
|
+
/**
|
|
629
|
+
* Total number of activities/steps in the workflow (for progress display).
|
|
630
|
+
*/
|
|
631
|
+
totalSteps?: number;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Workflow instance (stored in database).
|
|
635
|
+
* This matches the Elsa Workflow Instance schema for backend compatibility.
|
|
636
|
+
*/
|
|
637
|
+
interface AXPWorkflowInstance {
|
|
638
|
+
/**
|
|
639
|
+
* Schema reference.
|
|
640
|
+
*/
|
|
641
|
+
$schema?: string;
|
|
642
|
+
/**
|
|
643
|
+
* Unique instance ID.
|
|
644
|
+
*/
|
|
645
|
+
id: string;
|
|
646
|
+
/**
|
|
647
|
+
* Workflow definition ID.
|
|
648
|
+
*/
|
|
649
|
+
definitionId: string;
|
|
650
|
+
/**
|
|
651
|
+
* Workflow definition version ID.
|
|
652
|
+
*/
|
|
653
|
+
definitionVersionId: string;
|
|
654
|
+
/**
|
|
655
|
+
* Workflow definition version number.
|
|
656
|
+
*/
|
|
657
|
+
version: number;
|
|
658
|
+
/**
|
|
659
|
+
* Parent workflow instance ID (nullable, for child workflows).
|
|
660
|
+
*/
|
|
661
|
+
parentWorkflowInstanceId?: string | null;
|
|
662
|
+
/**
|
|
663
|
+
* Workflow state (internal execution state).
|
|
664
|
+
*/
|
|
665
|
+
workflowState: AXPWorkflowState;
|
|
666
|
+
/**
|
|
667
|
+
* Workflow status.
|
|
668
|
+
*/
|
|
669
|
+
status: AXPWorkflowStatus;
|
|
670
|
+
/**
|
|
671
|
+
* Workflow sub-status.
|
|
672
|
+
*/
|
|
673
|
+
subStatus: AXPWorkflowSubStatus;
|
|
674
|
+
/**
|
|
675
|
+
* Correlation ID (nullable).
|
|
676
|
+
*/
|
|
677
|
+
correlationId?: string | null;
|
|
678
|
+
/**
|
|
679
|
+
* Instance name (nullable).
|
|
680
|
+
*/
|
|
681
|
+
name?: string | null;
|
|
682
|
+
/**
|
|
683
|
+
* Incident count.
|
|
684
|
+
*/
|
|
685
|
+
incidentCount: number;
|
|
686
|
+
/**
|
|
687
|
+
* Created at timestamp (ISO date-time).
|
|
688
|
+
*/
|
|
689
|
+
createdAt: string;
|
|
690
|
+
/**
|
|
691
|
+
* Updated at timestamp (ISO date-time).
|
|
692
|
+
*/
|
|
693
|
+
updatedAt: string;
|
|
694
|
+
/**
|
|
695
|
+
* Finished at timestamp (ISO date-time, nullable).
|
|
696
|
+
*/
|
|
697
|
+
finishedAt?: string | null;
|
|
698
|
+
/**
|
|
699
|
+
* Entity reference ID (for linking workflow instances to business entities).
|
|
700
|
+
*/
|
|
701
|
+
entityRefId?: string | null;
|
|
702
|
+
/**
|
|
703
|
+
* Entity reference type (e.g., 'HumanCapitalManagement.LeaveRequest').
|
|
704
|
+
*/
|
|
705
|
+
entityRefType?: string | null;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Type of task for inbox handling.
|
|
710
|
+
* - 'human-task': Requires inbox - needs human interaction
|
|
711
|
+
* - 'ui-activity': UI-only activity (no inbox) - immediate execution
|
|
712
|
+
* - 'system-activity': System/backend activity (no inbox) - automated execution
|
|
713
|
+
*/
|
|
714
|
+
type AXPTaskType = 'human-task' | 'ui-activity' | 'system-activity';
|
|
715
|
+
/**
|
|
716
|
+
* Activity Category - Extends AXPCategoryEntity for consistency and performance
|
|
717
|
+
*
|
|
718
|
+
* Inherited properties from AXPCategoryEntity:
|
|
719
|
+
* - id: string - Unique identifier
|
|
720
|
+
* - title: string - Display name
|
|
721
|
+
* - description?: string - Category description
|
|
722
|
+
* - parentId?: string - Parent category ID
|
|
723
|
+
* - childrenCount: number - Direct child categories count (enables lazy loading)
|
|
724
|
+
* - itemsCount?: number - Direct activities count
|
|
725
|
+
* - totalChildrenCount?: number - Total nested categories (optional, for analytics)
|
|
726
|
+
* - totalItemsCount?: number - Total activities in tree (optional, for analytics)
|
|
727
|
+
*/
|
|
728
|
+
interface AXPActivityCategory extends AXPCategoryEntity {
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Activity Definition - Metadata for UI and tooling.
|
|
732
|
+
* Contains all metadata needed for displaying activities in toolbox and designer.
|
|
733
|
+
* The `name` property is used as the command key for execution.
|
|
734
|
+
*/
|
|
735
|
+
interface AXPActivityDefinition {
|
|
736
|
+
/**
|
|
737
|
+
* Activity name - used as command key for execution.
|
|
738
|
+
* This is the unique identifier for the activity.
|
|
739
|
+
*/
|
|
740
|
+
name: string;
|
|
741
|
+
/**
|
|
742
|
+
* Activity type (e.g., "workflow-activity:check-permission").
|
|
743
|
+
*/
|
|
744
|
+
type: string;
|
|
745
|
+
/**
|
|
746
|
+
* Display name for UI.
|
|
747
|
+
*/
|
|
748
|
+
title?: string;
|
|
749
|
+
/**
|
|
750
|
+
* Description of what the activity does.
|
|
751
|
+
*/
|
|
752
|
+
description?: string;
|
|
753
|
+
/**
|
|
754
|
+
* Category for grouping in toolbox.
|
|
755
|
+
*/
|
|
756
|
+
category?: string;
|
|
757
|
+
/**
|
|
758
|
+
* Icon name or class.
|
|
759
|
+
*/
|
|
760
|
+
icon?: string;
|
|
761
|
+
/**
|
|
762
|
+
* Where this activity should be executed.
|
|
763
|
+
* - 'frontend': Execute in browser (UI activities, console, events)
|
|
764
|
+
* - 'backend': Execute in backend (business logic, API calls)
|
|
765
|
+
* - 'both': Execute in both frontend and backend (hybrid activities)
|
|
766
|
+
*
|
|
767
|
+
* Default: 'frontend'
|
|
768
|
+
*/
|
|
769
|
+
executionMode?: 'frontend' | 'backend' | 'both';
|
|
770
|
+
/**
|
|
771
|
+
* Type of task for inbox handling.
|
|
772
|
+
* - 'human-task': Requires inbox - needs human interaction
|
|
773
|
+
* - 'ui-activity': UI-only activity (no inbox) - immediate execution
|
|
774
|
+
* - 'system-activity': System/backend activity (no inbox) - automated execution
|
|
775
|
+
*
|
|
776
|
+
* Default: 'ui-activity' (for backward compatibility)
|
|
777
|
+
*/
|
|
778
|
+
taskType?: AXPTaskType;
|
|
779
|
+
/**
|
|
780
|
+
* Input descriptors.
|
|
781
|
+
*/
|
|
782
|
+
inputs?: AXPWorkflowInputDescriptor[];
|
|
783
|
+
/**
|
|
784
|
+
* Output descriptors.
|
|
785
|
+
*/
|
|
786
|
+
outputs?: AXPWorkflowOutputDescriptor[];
|
|
787
|
+
/**
|
|
788
|
+
* Static outcomes (exit points).
|
|
789
|
+
* Example: ['Done', 'Success', 'Failed']
|
|
790
|
+
*/
|
|
791
|
+
outcomes?: string[];
|
|
792
|
+
/**
|
|
793
|
+
* Whether this activity is browsable in the toolbox.
|
|
794
|
+
* Default: true
|
|
795
|
+
*/
|
|
796
|
+
isBrowsable?: boolean;
|
|
797
|
+
/**
|
|
798
|
+
* Whether this activity is a container (can have children).
|
|
799
|
+
* Default: false
|
|
800
|
+
*/
|
|
801
|
+
isContainer?: boolean;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
type AXPActivityProviderToken = AXPActivityProvider | Promise<AXPActivityProvider>;
|
|
805
|
+
declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProviderToken[]>;
|
|
806
|
+
interface AXPActivityProvider {
|
|
807
|
+
/**
|
|
808
|
+
* Get list of activity definitions for a category.
|
|
809
|
+
* @param categoryId - Category ID to filter activities
|
|
810
|
+
* @returns Promise of activity definitions array
|
|
811
|
+
*/
|
|
812
|
+
getList(categoryId: string): Promise<AXPActivityDefinition[]>;
|
|
813
|
+
/**
|
|
814
|
+
* Get activity definition by name (unique identifier).
|
|
815
|
+
* The name is used as the command key for execution.
|
|
816
|
+
* @param name - Activity name (unique identifier and command key)
|
|
817
|
+
* @returns Promise of activity definition or undefined if not found
|
|
818
|
+
*/
|
|
819
|
+
getById(name: string): Promise<AXPActivityDefinition | undefined>;
|
|
820
|
+
}
|
|
821
|
+
type AXPActivityCategoryProviderToken = AXPActivityCategoryProvider | Promise<AXPActivityCategoryProvider>;
|
|
822
|
+
declare const AXP_ACTIVITY_CATEGORY_PROVIDER: InjectionToken<AXPActivityCategoryProviderToken[]>;
|
|
823
|
+
interface AXPActivityCategoryProvider {
|
|
824
|
+
getList(parentId?: string): Promise<AXPActivityCategory[]>;
|
|
825
|
+
getById(id: string): Promise<AXPActivityCategory | undefined>;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Optimized Activity Definition Service
|
|
830
|
+
*
|
|
831
|
+
* Manages activity definitions (metadata) for UI and tooling.
|
|
832
|
+
* Similar to AXPReportDefinitionService - only handles metadata, not execution.
|
|
833
|
+
*
|
|
834
|
+
* Performance optimizations:
|
|
835
|
+
* 1. Uses childrenCount to determine if category has children (no query needed)
|
|
836
|
+
* 2. Uses itemsCount to determine if category has activities (no query needed)
|
|
837
|
+
* 3. Aggressive caching prevents duplicate API calls
|
|
838
|
+
* 4. Single pending request per resource prevents race conditions
|
|
839
|
+
* 5. Lazy loading - only loads data when needed
|
|
840
|
+
*/
|
|
841
|
+
declare class AXPActivityDefinitionService {
|
|
842
|
+
private readonly categoryProviders;
|
|
843
|
+
private readonly activityProviders;
|
|
844
|
+
/** Cache for categories by id - O(1) lookup */
|
|
845
|
+
private categoriesById;
|
|
846
|
+
/** Cache for categories by parentId - O(1) lookup */
|
|
847
|
+
private categoriesByParentId;
|
|
848
|
+
/** Cache for activity definitions by categoryId - O(1) lookup */
|
|
849
|
+
private activitiesByCategory;
|
|
850
|
+
/** Cache for individual activity definitions by name - O(1) lookup */
|
|
851
|
+
private activitiesByName;
|
|
852
|
+
/** Track which provider index owns each category (by category ID) */
|
|
853
|
+
private categoryOwnership;
|
|
854
|
+
/** Pending API requests to prevent duplicate calls */
|
|
855
|
+
private pendingCategoriesRequests;
|
|
856
|
+
private pendingActivitiesRequests;
|
|
857
|
+
private pendingActivityRequests;
|
|
858
|
+
/**
|
|
859
|
+
* Get categories by parentId with aggressive caching
|
|
860
|
+
*
|
|
861
|
+
* Optimization: Returns cached result immediately if available,
|
|
862
|
+
* preventing unnecessary API calls during navigation
|
|
863
|
+
*
|
|
864
|
+
* @param parentId - Parent category ID (undefined = root categories)
|
|
865
|
+
* @returns Array of categories with count metadata (childrenCount, itemsCount)
|
|
866
|
+
*/
|
|
867
|
+
getCategories(parentId?: string): Promise<AXPActivityCategory[]>;
|
|
868
|
+
/**
|
|
869
|
+
* Get single category by ID with O(1) lookup
|
|
870
|
+
*
|
|
871
|
+
* Optimization: Uses Map for instant retrieval, falls back to
|
|
872
|
+
* searching cache, then providers if not found
|
|
873
|
+
*/
|
|
874
|
+
getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined>;
|
|
875
|
+
/**
|
|
876
|
+
* Get category path from root to specified category
|
|
877
|
+
*
|
|
878
|
+
* Optimization: Builds path using cached categories only
|
|
879
|
+
*/
|
|
880
|
+
getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]>;
|
|
881
|
+
/**
|
|
882
|
+
* Get activity definitions for a category with smart caching
|
|
883
|
+
*
|
|
884
|
+
* Optimization: Checks itemsCount before querying
|
|
885
|
+
* - If itemsCount = 0, returns empty array (no API call)
|
|
886
|
+
* - If itemsCount > 0, loads and caches activity definitions
|
|
887
|
+
* - Returns cached result on subsequent calls
|
|
888
|
+
*
|
|
889
|
+
* @param categoryId - Category ID to get activity definitions from
|
|
890
|
+
* @returns Array of activity definitions
|
|
891
|
+
*/
|
|
892
|
+
getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]>;
|
|
893
|
+
/**
|
|
894
|
+
* Get single activity definition by name with O(1) lookup
|
|
895
|
+
*
|
|
896
|
+
* Optimization: Uses Map for instant retrieval
|
|
897
|
+
*
|
|
898
|
+
* @param name - Activity name (unique identifier and command key)
|
|
899
|
+
* @returns Activity definition or undefined if not found
|
|
900
|
+
*/
|
|
901
|
+
getActivityByName(name: string): Promise<AXPActivityDefinition | undefined>;
|
|
902
|
+
/**
|
|
903
|
+
* Get all activity definitions (flat list) by loading root categories and their activities.
|
|
904
|
+
* Used by activity selector UIs (e.g. automation command configurator).
|
|
905
|
+
*/
|
|
906
|
+
getAllActivities(): Promise<AXPActivityDefinition[]>;
|
|
907
|
+
/**
|
|
908
|
+
* Get category ID containing a specific activity definition
|
|
909
|
+
*
|
|
910
|
+
* Optimization: Searches cache first, loads on-demand if needed
|
|
911
|
+
*/
|
|
912
|
+
getCategoryIdByActivityName(activityName: string): Promise<string | undefined>;
|
|
913
|
+
/**
|
|
914
|
+
* Get category path for an activity
|
|
915
|
+
*/
|
|
916
|
+
getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]>;
|
|
917
|
+
/**
|
|
918
|
+
* Load categories from providers and cache results
|
|
919
|
+
*
|
|
920
|
+
* Optimization: Tracks provider ownership to avoid unnecessary API calls
|
|
921
|
+
* - For root (parentId = undefined): Query ALL providers
|
|
922
|
+
* - For children: Only query the provider that owns the parent
|
|
923
|
+
*/
|
|
924
|
+
private loadCategoriesFromProviders;
|
|
925
|
+
/**
|
|
926
|
+
* Get the provider index that owns a specific category
|
|
927
|
+
*
|
|
928
|
+
* @returns Array with provider index, or null if ownership unknown (query all)
|
|
929
|
+
*/
|
|
930
|
+
private getProviderIndexForCategory;
|
|
931
|
+
/**
|
|
932
|
+
* Load activity definitions from providers and cache results
|
|
933
|
+
*
|
|
934
|
+
* Optimization: Only queries the provider that owns the category
|
|
935
|
+
* Uses provider INDEX to match category provider with activity provider
|
|
936
|
+
*/
|
|
937
|
+
private loadActivitiesFromProviders;
|
|
938
|
+
/**
|
|
939
|
+
* Load single activity definition from providers and cache result
|
|
940
|
+
*/
|
|
941
|
+
private loadActivityFromProviders;
|
|
942
|
+
/**
|
|
943
|
+
* Breadth-first search through category hierarchy
|
|
944
|
+
*/
|
|
945
|
+
private searchCategoryInHierarchy;
|
|
946
|
+
/**
|
|
947
|
+
* Check if category has children (uses cached count)
|
|
948
|
+
*/
|
|
949
|
+
categoryHasChildren(categoryId: string): boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Check if category has activities (uses cached count)
|
|
952
|
+
*/
|
|
953
|
+
categoryHasActivities(categoryId: string): boolean;
|
|
954
|
+
/**
|
|
955
|
+
* Clear all caches
|
|
956
|
+
*/
|
|
957
|
+
clearAllCache(): void;
|
|
958
|
+
/**
|
|
959
|
+
* Clear categories cache only
|
|
960
|
+
*/
|
|
961
|
+
clearCategoriesCache(): void;
|
|
962
|
+
/**
|
|
963
|
+
* Clear activities cache only
|
|
964
|
+
*/
|
|
965
|
+
clearActivitiesCache(): void;
|
|
966
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityDefinitionService, never>;
|
|
967
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityDefinitionService>;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Represents a workflow task that needs to be executed.
|
|
972
|
+
* Inspired by Temporal's Activity Tasks and Camunda's External Tasks.
|
|
973
|
+
*/
|
|
974
|
+
interface AXPWorkflowTask {
|
|
975
|
+
/**
|
|
976
|
+
* Unique token for this task (used for completion/security).
|
|
977
|
+
*/
|
|
978
|
+
taskToken: string;
|
|
979
|
+
/**
|
|
980
|
+
* Activity ID from workflow definition.
|
|
981
|
+
*/
|
|
982
|
+
activityId: string;
|
|
983
|
+
/**
|
|
984
|
+
* Activity type (e.g., 'workflow-activity:show-toast').
|
|
985
|
+
*/
|
|
986
|
+
activityType: string;
|
|
987
|
+
/**
|
|
988
|
+
* Human-readable activity name.
|
|
989
|
+
*/
|
|
990
|
+
activityName?: string;
|
|
991
|
+
/**
|
|
992
|
+
* Where this task should be executed.
|
|
993
|
+
* - 'frontend': Execute in browser (UI activities, console, events)
|
|
994
|
+
* - 'backend': Execute in backend (business logic, API calls)
|
|
995
|
+
* - 'both': Execute in both frontend and backend (hybrid activities)
|
|
996
|
+
*/
|
|
997
|
+
executionMode: 'frontend' | 'backend' | 'both';
|
|
998
|
+
/**
|
|
999
|
+
* Type of task for inbox handling.
|
|
1000
|
+
*/
|
|
1001
|
+
taskType?: 'human-task' | 'ui-activity' | 'system-activity';
|
|
1002
|
+
/**
|
|
1003
|
+
* Input data for the activity (for frontend activities).
|
|
1004
|
+
*/
|
|
1005
|
+
input?: Record<string, any>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Configuration for the activity (for frontend activities).
|
|
1008
|
+
*/
|
|
1009
|
+
config?: Record<string, any>;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Request to start a workflow instance.
|
|
1013
|
+
*/
|
|
1014
|
+
interface AXPStartWorkflowRequest {
|
|
1015
|
+
/**
|
|
1016
|
+
* Workflow ID to execute.
|
|
1017
|
+
*/
|
|
1018
|
+
workflowId: string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Initial input data for workflow.
|
|
1021
|
+
*/
|
|
1022
|
+
input: Record<string, any>;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Response after starting workflow instance.
|
|
1026
|
+
*/
|
|
1027
|
+
interface AXPStartWorkflowResponse {
|
|
1028
|
+
/**
|
|
1029
|
+
* Unique instance ID for this workflow run.
|
|
1030
|
+
*/
|
|
1031
|
+
instanceId: string;
|
|
1032
|
+
/**
|
|
1033
|
+
* Current workflow state.
|
|
1034
|
+
*/
|
|
1035
|
+
state: AXPWorkflowInstanceState;
|
|
1036
|
+
/**
|
|
1037
|
+
* First task to execute (determined by backend).
|
|
1038
|
+
* Client should execute this task based on executionMode.
|
|
1039
|
+
*/
|
|
1040
|
+
pendingTask?: AXPWorkflowTask | null;
|
|
1041
|
+
/**
|
|
1042
|
+
* Activity outputs map (activityId -> output).
|
|
1043
|
+
* Returned for expression evaluation in subsequent activities.
|
|
1044
|
+
*/
|
|
1045
|
+
activityOutputs?: Record<string, any>;
|
|
1046
|
+
/**
|
|
1047
|
+
* Last activity output (convenience).
|
|
1048
|
+
* Prefer using `activityOutputs[activityId]` when possible.
|
|
1049
|
+
*/
|
|
1050
|
+
lastActivityOutput?: any;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Request to resume a suspended workflow.
|
|
1054
|
+
*/
|
|
1055
|
+
interface AXPResumeWorkflowRequest {
|
|
1056
|
+
/**
|
|
1057
|
+
* Instance ID.
|
|
1058
|
+
*/
|
|
1059
|
+
instanceId: string;
|
|
1060
|
+
/**
|
|
1061
|
+
* Step ID that was waiting for user input.
|
|
1062
|
+
*/
|
|
1063
|
+
stepId: string;
|
|
1064
|
+
/**
|
|
1065
|
+
* Secure task token issued with the pending task.
|
|
1066
|
+
* Backend validates and resolves the step using this token.
|
|
1067
|
+
*/
|
|
1068
|
+
taskToken: string;
|
|
1069
|
+
/**
|
|
1070
|
+
* User action outcome (e.g., 'Confirmed', 'Cancelled').
|
|
1071
|
+
*/
|
|
1072
|
+
outcome?: string;
|
|
1073
|
+
/**
|
|
1074
|
+
* Optional user input data.
|
|
1075
|
+
*/
|
|
1076
|
+
userInput?: any;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Response after resuming workflow.
|
|
1080
|
+
*/
|
|
1081
|
+
interface AXPResumeWorkflowResponse {
|
|
1082
|
+
/**
|
|
1083
|
+
* Activity execution output.
|
|
1084
|
+
*/
|
|
1085
|
+
output: any;
|
|
1086
|
+
/**
|
|
1087
|
+
* Activity execution outcomes.
|
|
1088
|
+
*/
|
|
1089
|
+
outcomes: Record<string, any>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Next task to execute (if any).
|
|
1092
|
+
*/
|
|
1093
|
+
nextTask?: AXPWorkflowTask | null;
|
|
1094
|
+
/**
|
|
1095
|
+
* Updated workflow state.
|
|
1096
|
+
*/
|
|
1097
|
+
state: AXPWorkflowInstanceState;
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Request to get workflow instance state.
|
|
1101
|
+
*/
|
|
1102
|
+
interface AXPGetWorkflowStateRequest {
|
|
1103
|
+
/**
|
|
1104
|
+
* Instance ID.
|
|
1105
|
+
*/
|
|
1106
|
+
instanceId: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Workflow instance state (managed by backend, cached in client).
|
|
1110
|
+
*/
|
|
1111
|
+
interface AXPWorkflowInstanceState {
|
|
1112
|
+
/**
|
|
1113
|
+
* Unique instance ID.
|
|
1114
|
+
*/
|
|
1115
|
+
instanceId: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* Workflow ID.
|
|
1118
|
+
*/
|
|
1119
|
+
workflowId: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* Current instance status.
|
|
1122
|
+
*/
|
|
1123
|
+
status: 'running' | 'completed' | 'suspended' | 'error';
|
|
1124
|
+
/**
|
|
1125
|
+
* Current step ID (if suspended or running).
|
|
1126
|
+
*/
|
|
1127
|
+
currentStepId?: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Workflow variables (state).
|
|
1130
|
+
*/
|
|
1131
|
+
variables: Record<string, any>;
|
|
1132
|
+
/**
|
|
1133
|
+
* Activity outputs map (activityId -> output).
|
|
1134
|
+
* Used by expression evaluation scope as `outputs.activityId`.
|
|
1135
|
+
*/
|
|
1136
|
+
activityOutputs?: Record<string, any>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Last activity output (convenience).
|
|
1139
|
+
* Useful when the next activity needs a quick access to the previous result.
|
|
1140
|
+
*/
|
|
1141
|
+
lastActivityOutput?: any;
|
|
1142
|
+
/**
|
|
1143
|
+
* Initial input data.
|
|
1144
|
+
*/
|
|
1145
|
+
input: Record<string, any>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Final output data (if completed).
|
|
1148
|
+
*/
|
|
1149
|
+
output?: Record<string, any>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Last update timestamp.
|
|
1152
|
+
*/
|
|
1153
|
+
lastUpdated: Date;
|
|
1154
|
+
}
|
|
1155
|
+
interface AXPFrontActivityCompleteRequest {
|
|
1156
|
+
/**
|
|
1157
|
+
* Instance ID.
|
|
1158
|
+
*/
|
|
1159
|
+
instanceId: string;
|
|
1160
|
+
activityNode: string;
|
|
1161
|
+
output: Record<string, any>;
|
|
1162
|
+
outcome?: string;
|
|
1163
|
+
}
|
|
1164
|
+
interface AXPFrontActivityCompleteResponse {
|
|
1165
|
+
/**
|
|
1166
|
+
* Activity execution output.
|
|
1167
|
+
*/
|
|
1168
|
+
output?: any;
|
|
1169
|
+
/**
|
|
1170
|
+
* Activity execution outcomes.
|
|
1171
|
+
*/
|
|
1172
|
+
outcomes?: Record<string, any>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Next task to execute (if any).
|
|
1175
|
+
*/
|
|
1176
|
+
nextTask?: AXPWorkflowTask | null;
|
|
1177
|
+
/**
|
|
1178
|
+
* Updated workflow state.
|
|
1179
|
+
*/
|
|
1180
|
+
state?: AXPWorkflowInstanceState;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* Interface for workflow engine operations.
|
|
1185
|
+
*/
|
|
1186
|
+
interface AXPWorkflowEngine {
|
|
1187
|
+
/**
|
|
1188
|
+
* Start a new workflow instance.
|
|
1189
|
+
*
|
|
1190
|
+
* Creates a new workflow instance in backend and returns instance ID.
|
|
1191
|
+
*
|
|
1192
|
+
* @param request - Start workflow request
|
|
1193
|
+
* @returns Response with instanceId and initial state
|
|
1194
|
+
*
|
|
1195
|
+
*/
|
|
1196
|
+
start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Resume a suspended workflow instance.
|
|
1199
|
+
*
|
|
1200
|
+
* Resumes workflow instance after user interaction (e.g., after show-dialog).
|
|
1201
|
+
*
|
|
1202
|
+
* @param request - Resume workflow request
|
|
1203
|
+
* @returns Resume response with next step and updated state
|
|
1204
|
+
*
|
|
1205
|
+
*/
|
|
1206
|
+
resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Get current workflow instance state.
|
|
1209
|
+
*
|
|
1210
|
+
* Retrieves current state of a workflow instance from backend.
|
|
1211
|
+
*
|
|
1212
|
+
* @param request - Get state request
|
|
1213
|
+
* @returns Current workflow instance state
|
|
1214
|
+
*
|
|
1215
|
+
*/
|
|
1216
|
+
getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
|
|
1217
|
+
frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Injection token for workflow engine.
|
|
1221
|
+
* Default implementation is AXPWorkflowLocalEngine.
|
|
1222
|
+
*/
|
|
1223
|
+
declare const AXP_WORKFLOW_ENGINE: InjectionToken<AXPWorkflowEngine>;
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Result of starting a workflow.
|
|
1227
|
+
*/
|
|
1228
|
+
interface WorkflowStartResult {
|
|
1229
|
+
/**
|
|
1230
|
+
* Whether the operation succeeded.
|
|
1231
|
+
*/
|
|
1232
|
+
success: boolean;
|
|
1233
|
+
/**
|
|
1234
|
+
* Workflow instance ID.
|
|
1235
|
+
*/
|
|
1236
|
+
instanceId?: string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Initial workflow state.
|
|
1239
|
+
*/
|
|
1240
|
+
state?: AXPWorkflowInstanceState;
|
|
1241
|
+
/**
|
|
1242
|
+
* First task to execute (if any).
|
|
1243
|
+
*/
|
|
1244
|
+
nextTask?: AXPWorkflowTask | null;
|
|
1245
|
+
/**
|
|
1246
|
+
* Workflow output (if completed immediately).
|
|
1247
|
+
*/
|
|
1248
|
+
output?: any;
|
|
1249
|
+
/**
|
|
1250
|
+
* Error message (if failed).
|
|
1251
|
+
*/
|
|
1252
|
+
error?: string;
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Result of completing a task.
|
|
1256
|
+
*/
|
|
1257
|
+
interface WorkflowCompleteResult {
|
|
1258
|
+
/**
|
|
1259
|
+
* Whether the operation succeeded.
|
|
1260
|
+
*/
|
|
1261
|
+
success: boolean;
|
|
1262
|
+
/**
|
|
1263
|
+
* Workflow instance ID.
|
|
1264
|
+
*/
|
|
1265
|
+
instanceId: string;
|
|
1266
|
+
/**
|
|
1267
|
+
* Updated workflow state.
|
|
1268
|
+
*/
|
|
1269
|
+
state?: AXPWorkflowInstanceState;
|
|
1270
|
+
/**
|
|
1271
|
+
* Next task to execute (if any).
|
|
1272
|
+
*/
|
|
1273
|
+
nextTask?: AXPWorkflowTask | null;
|
|
1274
|
+
/**
|
|
1275
|
+
* Workflow output (if completed).
|
|
1276
|
+
*/
|
|
1277
|
+
output?: any;
|
|
1278
|
+
/**
|
|
1279
|
+
* Error message (if failed).
|
|
1280
|
+
*/
|
|
1281
|
+
error?: string;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Result of resuming a workflow.
|
|
1285
|
+
*/
|
|
1286
|
+
interface WorkflowResumeResult {
|
|
1287
|
+
/**
|
|
1288
|
+
* Whether the operation succeeded.
|
|
1289
|
+
*/
|
|
1290
|
+
success: boolean;
|
|
1291
|
+
/**
|
|
1292
|
+
* Workflow instance ID.
|
|
1293
|
+
*/
|
|
1294
|
+
instanceId: string;
|
|
1295
|
+
/**
|
|
1296
|
+
* Updated workflow state.
|
|
1297
|
+
*/
|
|
1298
|
+
state?: AXPWorkflowInstanceState;
|
|
1299
|
+
/**
|
|
1300
|
+
* Next task to execute (if any).
|
|
1301
|
+
*/
|
|
1302
|
+
nextTask?: AXPWorkflowTask | null;
|
|
1303
|
+
/**
|
|
1304
|
+
* Workflow output (if completed).
|
|
1305
|
+
*/
|
|
1306
|
+
output?: any;
|
|
1307
|
+
/**
|
|
1308
|
+
* Error message (if failed).
|
|
1309
|
+
*/
|
|
1310
|
+
error?: string;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Workflow Manager - Facade for workflow lifecycle orchestration.
|
|
1314
|
+
*
|
|
1315
|
+
* This service is the ONLY interface the frontend uses to interact with workflows.
|
|
1316
|
+
* It follows Clean Architecture principles and does NOT contain execution or business logic.
|
|
1317
|
+
*
|
|
1318
|
+
* Responsibilities:
|
|
1319
|
+
* - Orchestrate workflow lifecycle (start, execute, complete, resume)
|
|
1320
|
+
* - Delegate execution to ActivityExecutor
|
|
1321
|
+
* - Cache workflow state in memory
|
|
1322
|
+
* - Expose a stable API for UI
|
|
1323
|
+
*
|
|
1324
|
+
* Rules:
|
|
1325
|
+
* - No HTTP calls (delegates to AXPWorkflowEngine)
|
|
1326
|
+
* - No CommandBus / Command execution (delegates to ActivityExecutor)
|
|
1327
|
+
* - No workflow branching logic (backend decides)
|
|
1328
|
+
* - No business validation (backend validates)
|
|
1329
|
+
* - No backend assumptions (uses abstract runtime service)
|
|
1330
|
+
*/
|
|
1331
|
+
declare class AXPWorkflowManager {
|
|
1332
|
+
private readonly workflowEngine;
|
|
1333
|
+
private readonly activityExecutor;
|
|
1334
|
+
/**
|
|
1335
|
+
* Cache workflow states in memory for quick access.
|
|
1336
|
+
* Key: instanceId
|
|
1337
|
+
* Value: AXPWorkflowInstanceState
|
|
1338
|
+
*/
|
|
1339
|
+
private stateCache;
|
|
1340
|
+
/**
|
|
1341
|
+
* Cache TTL in milliseconds (5 minutes).
|
|
1342
|
+
*/
|
|
1343
|
+
private readonly CACHE_TTL;
|
|
1344
|
+
/**
|
|
1345
|
+
* Execute frontend activities interactively until reaching workflow-activity:human-task or completion.
|
|
1346
|
+
*
|
|
1347
|
+
* Interactive = show form/popup immediately (user sees and acts). Only workflow-activity:human-task
|
|
1348
|
+
* is not interactive (goes to task board). Other frontend activities (show-layout-popup, show-toast, etc.)
|
|
1349
|
+
* even with taskType human-task in definition are executed here.
|
|
1350
|
+
*
|
|
1351
|
+
* @param instanceId - Workflow instance ID
|
|
1352
|
+
* @param task - Current task to execute
|
|
1353
|
+
* @param state - Current workflow state
|
|
1354
|
+
* @param lastActivityOutput - Last activity output (for expression evaluation)
|
|
1355
|
+
* @returns Final result with nextTask (if workflow-activity:human-task) or completion status
|
|
1356
|
+
*/
|
|
1357
|
+
private executeInteractiveFlow;
|
|
1358
|
+
/**
|
|
1359
|
+
* Start a new workflow instance.
|
|
1360
|
+
*
|
|
1361
|
+
* Creates a new workflow instance in backend and returns instance ID.
|
|
1362
|
+
* Backend decides what to do: returns pendingTask or indicates completion.
|
|
1363
|
+
*
|
|
1364
|
+
* @param workflowId - Workflow ID to start
|
|
1365
|
+
* @param input - Initial input data (optional)
|
|
1366
|
+
* @returns Start result with instanceId, state, and nextTask
|
|
1367
|
+
*
|
|
1368
|
+
* @example
|
|
1369
|
+
* ```typescript
|
|
1370
|
+
* const result = await workflowManager.start('my-workflow', { userId: '123' });
|
|
1371
|
+
*
|
|
1372
|
+
* if (result.success && result.nextTask) {
|
|
1373
|
+
* // Execute task if frontend
|
|
1374
|
+
* if (result.nextTask.executionMode === 'frontend') {
|
|
1375
|
+
* const execResult = await workflowManager.execute(result.nextTask);
|
|
1376
|
+
* await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);
|
|
1377
|
+
* }
|
|
1378
|
+
* }
|
|
1379
|
+
* ```
|
|
1380
|
+
*/
|
|
1381
|
+
start(workflowId: string, input?: Record<string, any>): Promise<WorkflowStartResult>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Resume a suspended workflow (e.g., after user interaction).
|
|
1384
|
+
*
|
|
1385
|
+
* Backend determines nextStep based on outcome and outcomeConnections.
|
|
1386
|
+
* Client only provides instanceId, stepId, outcome, and optional userInput.
|
|
1387
|
+
*
|
|
1388
|
+
* @param instanceId - Workflow instance ID
|
|
1389
|
+
* @param stepId - Step ID that was waiting for user input
|
|
1390
|
+
* @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
|
|
1391
|
+
* @param userInput - Optional user input data
|
|
1392
|
+
* @param taskToken - Secure task token (required for secure resumption)
|
|
1393
|
+
* @returns Resume result with next task (if any)
|
|
1394
|
+
*/
|
|
1395
|
+
resume(instanceId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowResumeResult>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Get workflow instance state.
|
|
1398
|
+
*
|
|
1399
|
+
* Retrieves state from cache (if valid) or from backend.
|
|
1400
|
+
*
|
|
1401
|
+
* @param instanceId - Workflow instance ID
|
|
1402
|
+
* @returns Workflow instance state or null if not found
|
|
1403
|
+
*/
|
|
1404
|
+
getState(instanceId: string): Promise<AXPWorkflowInstanceState | null>;
|
|
1405
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowManager, never>;
|
|
1406
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowManager>;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* Local engine implementation that manages workflow progression and state.
|
|
1411
|
+
*
|
|
1412
|
+
* This engine:
|
|
1413
|
+
* - Returns frontend/both activities as pendingTask (does NOT execute them)
|
|
1414
|
+
* - Skips backend activities (does not error, continues execution)
|
|
1415
|
+
* - Maintains workflow state in memory
|
|
1416
|
+
* - Does not require backend API calls
|
|
1417
|
+
*
|
|
1418
|
+
* Execution of frontend tasks is handled by AXPWorkflowManager via ActivityExecutor.
|
|
1419
|
+
* This engine only manages workflow progression and state storage.
|
|
1420
|
+
*
|
|
1421
|
+
* This is the DEFAULT engine provider. Applications can override it with
|
|
1422
|
+
* an API-based engine implementation.
|
|
1423
|
+
*/
|
|
1424
|
+
declare class AXPWorkflowLocalEngine implements AXPWorkflowEngine {
|
|
1425
|
+
private readonly activityDefinitionService;
|
|
1426
|
+
private readonly workflowProviders;
|
|
1427
|
+
/**
|
|
1428
|
+
* In-memory storage for workflow instances.
|
|
1429
|
+
* Key: instanceId
|
|
1430
|
+
* Value: LocalWorkflowState
|
|
1431
|
+
*/
|
|
1432
|
+
private instances;
|
|
1433
|
+
/**
|
|
1434
|
+
* Task token storage for secure resume operations.
|
|
1435
|
+
* Key: taskToken
|
|
1436
|
+
* Value: { instanceId, activityId }
|
|
1437
|
+
*/
|
|
1438
|
+
private taskTokens;
|
|
1439
|
+
/**
|
|
1440
|
+
* Start a new workflow instance.
|
|
1441
|
+
*
|
|
1442
|
+
* Creates an in-memory workflow instance and progresses it.
|
|
1443
|
+
* Frontend/both activities are returned as pendingTask for external execution.
|
|
1444
|
+
* Backend activities are skipped.
|
|
1445
|
+
*/
|
|
1446
|
+
start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Resume a suspended workflow instance.
|
|
1449
|
+
*
|
|
1450
|
+
* Validates task token, applies externally executed result,
|
|
1451
|
+
* and continues progressing workflow steps.
|
|
1452
|
+
*/
|
|
1453
|
+
resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
|
|
1454
|
+
/**
|
|
1455
|
+
* Get current workflow instance state.
|
|
1456
|
+
*/
|
|
1457
|
+
getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Get workflow definition from available providers.
|
|
1460
|
+
*/
|
|
1461
|
+
private getDefinition;
|
|
1462
|
+
/**
|
|
1463
|
+
* Progress workflow steps starting from the current position.
|
|
1464
|
+
*
|
|
1465
|
+
* For frontend/both activities: returns task immediately (suspends workflow).
|
|
1466
|
+
* For backend activities: skips and continues.
|
|
1467
|
+
*
|
|
1468
|
+
* Returns the next pending task (if frontend activity found) or null (if completed).
|
|
1469
|
+
*/
|
|
1470
|
+
private executeWorkflowSteps;
|
|
1471
|
+
/**
|
|
1472
|
+
* Get next activity ID based on connections and outcomes.
|
|
1473
|
+
*/
|
|
1474
|
+
private getNextActivityId;
|
|
1475
|
+
frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
|
|
1476
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowLocalEngine, never>;
|
|
1477
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowLocalEngine>;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
/**
|
|
1481
|
+
* Result of executing a workflow activity.
|
|
1482
|
+
*/
|
|
1483
|
+
interface ActivityExecutionResult {
|
|
1484
|
+
/**
|
|
1485
|
+
* Activity execution output.
|
|
1486
|
+
*/
|
|
1487
|
+
output: any;
|
|
1488
|
+
/**
|
|
1489
|
+
* Activity execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').
|
|
1490
|
+
*/
|
|
1491
|
+
outcome: string;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Activity Executor Service
|
|
1495
|
+
*
|
|
1496
|
+
* Service for executing workflow activities via CommandBus.
|
|
1497
|
+
* Automatically evaluates expressions in activity inputs before execution.
|
|
1498
|
+
*
|
|
1499
|
+
* @example
|
|
1500
|
+
* ```typescript
|
|
1501
|
+
* const executor = inject(ActivityExecutor);
|
|
1502
|
+
*
|
|
1503
|
+
* // Execute activity with task and workflow state (expressions will be evaluated)
|
|
1504
|
+
* const result = await executor.execute(task, workflowState, activityOutputs);
|
|
1505
|
+
* ```
|
|
1506
|
+
*/
|
|
1507
|
+
declare class ActivityExecutor {
|
|
1508
|
+
private readonly commandService;
|
|
1509
|
+
private readonly expressionEvaluator;
|
|
1510
|
+
private readonly expressionScopeService;
|
|
1511
|
+
/**
|
|
1512
|
+
* Execute a workflow activity with expression evaluation.
|
|
1513
|
+
*
|
|
1514
|
+
* Evaluates expressions in activity inputs using workflow state,
|
|
1515
|
+
* then executes the activity via CommandBus.
|
|
1516
|
+
*
|
|
1517
|
+
* @param task - Workflow task containing activity information
|
|
1518
|
+
* @param workflowState - Current workflow instance state (for expression evaluation)
|
|
1519
|
+
* @param activityOutputs - Map of previous activity outputs (for expression evaluation)
|
|
1520
|
+
* @returns Execution result with output and outcome
|
|
1521
|
+
*/
|
|
1522
|
+
execute(task: AXPWorkflowTask, workflowState?: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): Promise<ActivityExecutionResult>;
|
|
1523
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ActivityExecutor, never>;
|
|
1524
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ActivityExecutor>;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Workflow expression evaluation context.
|
|
1529
|
+
* Contains workflow state data needed for expression evaluation.
|
|
1530
|
+
*/
|
|
1531
|
+
interface WorkflowExpressionContext {
|
|
1532
|
+
/** Workflow input values */
|
|
1533
|
+
inputs: Record<string, any>;
|
|
1534
|
+
/** Workflow state variables */
|
|
1535
|
+
variables: Record<string, any>;
|
|
1536
|
+
/** Previous activity outputs (activityId -> output) */
|
|
1537
|
+
outputs: Record<string, any>;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Workflow Expression Scope Service
|
|
1541
|
+
*
|
|
1542
|
+
* Shared service for building expression evaluation scope from workflow data.
|
|
1543
|
+
* Used by both Local Engine and Mock Runtime to manage workflow data (inputs, variables, outputs).
|
|
1544
|
+
*
|
|
1545
|
+
* Responsibilities:
|
|
1546
|
+
* - Build expression evaluation scope from workflow state
|
|
1547
|
+
* - Provide context.eval() function for accessing workflow data
|
|
1548
|
+
* - Manage workflow data structure (inputs, variables, outputs)
|
|
1549
|
+
*
|
|
1550
|
+
* This service does NOT:
|
|
1551
|
+
* - Execute activities
|
|
1552
|
+
* - Evaluate expressions (delegates to AXPExpressionEvaluatorService)
|
|
1553
|
+
* - Manage workflow state (handled by runtime)
|
|
1554
|
+
*
|
|
1555
|
+
* @example
|
|
1556
|
+
* ```typescript
|
|
1557
|
+
* const scopeService = inject(WorkflowExpressionScopeService);
|
|
1558
|
+
*
|
|
1559
|
+
* // Build scope from workflow state
|
|
1560
|
+
* const scope = scopeService.buildScope({
|
|
1561
|
+
* inputs: state.input || {},
|
|
1562
|
+
* variables: state.variables || {},
|
|
1563
|
+
* outputs: activityOutputs
|
|
1564
|
+
* });
|
|
1565
|
+
*
|
|
1566
|
+
* // Or build from state directly
|
|
1567
|
+
* const scope = scopeService.buildScopeFromState(state, activityOutputs);
|
|
1568
|
+
* ```
|
|
1569
|
+
*/
|
|
1570
|
+
declare class WorkflowExpressionScopeService {
|
|
1571
|
+
/**
|
|
1572
|
+
* Collect dot-notation key-value pairs from nested objects so that e.g.
|
|
1573
|
+
* { metadata: { "metadata.questionnaire.id": "x" } } becomes { "metadata.questionnaire.id": "x" } at root.
|
|
1574
|
+
* Top-level non-dot keys are kept as-is.
|
|
1575
|
+
*/
|
|
1576
|
+
private flattenDotKeysFromTree;
|
|
1577
|
+
/**
|
|
1578
|
+
* Expand flat keys with dots into nested objects.
|
|
1579
|
+
* e.g. { "metadata.questionnaire.id": "x" } -> { metadata: { questionnaire: { id: "x" } } }.
|
|
1580
|
+
*/
|
|
1581
|
+
private expandDotKeys;
|
|
1582
|
+
/**
|
|
1583
|
+
* Normalize workflow input so that flat dot-notation keys (e.g. from form schema
|
|
1584
|
+
* "metadata.questionnaire.id") become nested for expression access (inputs.metadata.questionnaire.id).
|
|
1585
|
+
*/
|
|
1586
|
+
private normalizeInputs;
|
|
1587
|
+
/**
|
|
1588
|
+
* Build expression evaluation scope for workflow activities.
|
|
1589
|
+
*
|
|
1590
|
+
* Provides workflow-specific data (inputs, variables, outputs) and context.eval() function.
|
|
1591
|
+
* Other data (session, current user, etc.) are provided by expression evaluator scope providers.
|
|
1592
|
+
*
|
|
1593
|
+
* Scope includes:
|
|
1594
|
+
* - inputs: Workflow input values (accessible as inputs.propertyName)
|
|
1595
|
+
* - variables: Workflow state variables (accessible as variables.propertyName or vars.propertyName)
|
|
1596
|
+
* - outputs: Previous activity outputs (accessible as outputs.activityId)
|
|
1597
|
+
* - context.eval(path): Function to access nested properties from workflow data
|
|
1598
|
+
*
|
|
1599
|
+
* Expressions can use:
|
|
1600
|
+
* - {{inputs.userName}} - Direct access to workflow input
|
|
1601
|
+
* - {{variables.someVar}} or {{vars.someVar}} - Direct access to workflow variable
|
|
1602
|
+
* - {{outputs.activityId.property}} - Direct access to previous activity output
|
|
1603
|
+
* - {{context.eval("inputs.userName")}} - Access via context.eval (supports nested paths)
|
|
1604
|
+
* - {{context.eval("variables.someVar")}} - Access variables via context.eval
|
|
1605
|
+
* - {{context.eval("outputs.activityId.property")}} - Access outputs via context.eval
|
|
1606
|
+
* - {{session.currentUser().name}} - Access current user via expression evaluator scope providers
|
|
1607
|
+
*
|
|
1608
|
+
* The context.eval() function provides a unified way to access all workflow data,
|
|
1609
|
+
* similar to how entity-detail-list uses context.eval() to access parent data.
|
|
1610
|
+
*
|
|
1611
|
+
* @param context - Workflow expression context containing inputs, variables, and outputs
|
|
1612
|
+
* @returns Expression evaluator scope with workflow data and context.eval() function
|
|
1613
|
+
*/
|
|
1614
|
+
buildScope(context: WorkflowExpressionContext): AXPExpressionEvaluatorScope;
|
|
1615
|
+
/**
|
|
1616
|
+
* Build expression evaluation scope from workflow instance state.
|
|
1617
|
+
*
|
|
1618
|
+
* Convenience method that extracts data from AXPWorkflowInstanceState.
|
|
1619
|
+
*
|
|
1620
|
+
* @param state - Workflow instance state
|
|
1621
|
+
* @param activityOutputs - Map of activity outputs (activityId -> output)
|
|
1622
|
+
* @returns Expression evaluator scope with workflow data and context.eval() function
|
|
1623
|
+
*/
|
|
1624
|
+
buildScopeFromState(state: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): AXPExpressionEvaluatorScope;
|
|
1625
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowExpressionScopeService, never>;
|
|
1626
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowExpressionScopeService>;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* Workflow Category - Extends AXPCategoryEntity for consistency and performance
|
|
1631
|
+
*
|
|
1632
|
+
* Inherited properties from AXPCategoryEntity:
|
|
1633
|
+
* - id: string - Unique identifier
|
|
1634
|
+
* - title: string - Display name
|
|
1635
|
+
* - description?: string - Category description
|
|
1636
|
+
* - parentId?: string - Parent category ID
|
|
1637
|
+
* - childrenCount: number - Direct child categories count (enables lazy loading)
|
|
1638
|
+
* - itemsCount?: number - Direct workflows count
|
|
1639
|
+
* - totalChildrenCount?: number - Total nested categories (optional, for analytics)
|
|
1640
|
+
* - totalItemsCount?: number - Total workflows in tree (optional, for analytics)
|
|
1641
|
+
*/
|
|
1642
|
+
interface AXPWorkflowCategory extends AXPCategoryEntity {
|
|
1643
|
+
}
|
|
1644
|
+
type AXPWorkflowProviderToken = AXPWorkflowProvider | Promise<AXPWorkflowProvider>;
|
|
1645
|
+
declare const AXP_WORKFLOW_PROVIDER: InjectionToken<AXPWorkflowProviderToken[]>;
|
|
1646
|
+
interface AXPWorkflowProvider {
|
|
1647
|
+
/**
|
|
1648
|
+
* Get list of workflow definitions for a category.
|
|
1649
|
+
* @param categoryId - Category ID to filter workflows
|
|
1650
|
+
* @returns Promise of workflow definition array
|
|
1651
|
+
*/
|
|
1652
|
+
getList(categoryId: string): Promise<AXPWorkflowDefinition[]>;
|
|
1653
|
+
/**
|
|
1654
|
+
* Get full workflow definition by name (unique identifier).
|
|
1655
|
+
* Used by workflow engines for execution and UI for metadata.
|
|
1656
|
+
* @param name - Workflow name (unique identifier)
|
|
1657
|
+
* @returns Promise of full workflow definition or null if not found
|
|
1658
|
+
*/
|
|
1659
|
+
getByName(name: string): Promise<AXPWorkflowDefinition | null>;
|
|
1660
|
+
}
|
|
1661
|
+
type AXPWorkflowCategoryProviderToken = AXPWorkflowCategoryProvider | Promise<AXPWorkflowCategoryProvider>;
|
|
1662
|
+
declare const AXP_WORKFLOW_CATEGORY_PROVIDER: InjectionToken<AXPWorkflowCategoryProviderToken[]>;
|
|
1663
|
+
interface AXPWorkflowCategoryProvider {
|
|
1664
|
+
getList(parentId?: string): Promise<AXPWorkflowCategory[]>;
|
|
1665
|
+
getById(id: string): Promise<AXPWorkflowCategory | undefined>;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Optimized Workflow Definition Service
|
|
1670
|
+
*
|
|
1671
|
+
* Manages workflow definitions (metadata) for UI and tooling.
|
|
1672
|
+
* Similar to AXPActivityDefinitionService - only handles metadata, not execution.
|
|
1673
|
+
*
|
|
1674
|
+
* Performance optimizations:
|
|
1675
|
+
* 1. Uses childrenCount to determine if category has children (no query needed)
|
|
1676
|
+
* 2. Uses itemsCount to determine if category has workflows (no query needed)
|
|
1677
|
+
* 3. Aggressive caching prevents duplicate API calls
|
|
1678
|
+
* 4. Single pending request per resource prevents race conditions
|
|
1679
|
+
* 5. Lazy loading - only loads data when needed
|
|
1680
|
+
*/
|
|
1681
|
+
declare class AXPWorkflowDefinitionService {
|
|
1682
|
+
private readonly categoryProviders;
|
|
1683
|
+
private readonly workflowProviders;
|
|
1684
|
+
/** Cache for categories by id - O(1) lookup */
|
|
1685
|
+
private categoriesById;
|
|
1686
|
+
/** Cache for categories by parentId - O(1) lookup */
|
|
1687
|
+
private categoriesByParentId;
|
|
1688
|
+
/** Cache for workflow definitions by categoryId - O(1) lookup */
|
|
1689
|
+
private workflowsByCategory;
|
|
1690
|
+
/** Cache for individual workflow definitions by name - O(1) lookup */
|
|
1691
|
+
private workflowsByName;
|
|
1692
|
+
/** Track which provider index owns each category (by category ID) */
|
|
1693
|
+
private categoryOwnership;
|
|
1694
|
+
/** Pending API requests to prevent duplicate calls */
|
|
1695
|
+
private pendingCategoriesRequests;
|
|
1696
|
+
private pendingWorkflowsRequests;
|
|
1697
|
+
private pendingWorkflowRequests;
|
|
1698
|
+
/**
|
|
1699
|
+
* Get categories by parentId with aggressive caching
|
|
1700
|
+
*
|
|
1701
|
+
* Optimization: Returns cached result immediately if available,
|
|
1702
|
+
* preventing unnecessary API calls during navigation
|
|
1703
|
+
*
|
|
1704
|
+
* @param parentId - Parent category ID (undefined = root categories)
|
|
1705
|
+
* @returns Array of categories with count metadata (childrenCount, itemsCount)
|
|
1706
|
+
*/
|
|
1707
|
+
getCategories(parentId?: string): Promise<AXPWorkflowCategory[]>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Get single category by ID with O(1) lookup
|
|
1710
|
+
*
|
|
1711
|
+
* Optimization: Uses Map for instant retrieval, falls back to
|
|
1712
|
+
* searching cache, then providers if not found
|
|
1713
|
+
*/
|
|
1714
|
+
getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Get category path from root to specified category
|
|
1717
|
+
*
|
|
1718
|
+
* Optimization: Builds path using cached categories only
|
|
1719
|
+
*/
|
|
1720
|
+
getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]>;
|
|
1721
|
+
/**
|
|
1722
|
+
* Get workflow definitions for a category with smart caching
|
|
1723
|
+
*
|
|
1724
|
+
* Optimization: Checks itemsCount before querying
|
|
1725
|
+
* - If itemsCount = 0, returns empty array (no API call)
|
|
1726
|
+
* - If itemsCount > 0, loads and caches workflow definitions
|
|
1727
|
+
* - Returns cached result on subsequent calls
|
|
1728
|
+
*
|
|
1729
|
+
* @param categoryId - Category ID to get workflow definitions from
|
|
1730
|
+
* @returns Array of workflow definitions
|
|
1731
|
+
*/
|
|
1732
|
+
getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinition[]>;
|
|
1733
|
+
/**
|
|
1734
|
+
* Get single workflow definition by name with O(1) lookup
|
|
1735
|
+
*
|
|
1736
|
+
* Optimization: Uses Map for instant retrieval
|
|
1737
|
+
*
|
|
1738
|
+
* @param name - Workflow name (unique identifier)
|
|
1739
|
+
* @returns Workflow definition or undefined if not found
|
|
1740
|
+
*/
|
|
1741
|
+
getWorkflowByName(name: string): Promise<AXPWorkflowDefinition | undefined>;
|
|
1742
|
+
/**
|
|
1743
|
+
* Get category ID containing a specific workflow definition
|
|
1744
|
+
*
|
|
1745
|
+
* Optimization: Searches cache first, loads on-demand if needed
|
|
1746
|
+
*/
|
|
1747
|
+
getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined>;
|
|
1748
|
+
/**
|
|
1749
|
+
* Get category path for a workflow
|
|
1750
|
+
*/
|
|
1751
|
+
getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]>;
|
|
1752
|
+
/**
|
|
1753
|
+
* Load categories from providers and cache results
|
|
1754
|
+
*
|
|
1755
|
+
* Optimization: Tracks provider ownership to avoid unnecessary API calls
|
|
1756
|
+
* - For root (parentId = undefined): Query ALL providers
|
|
1757
|
+
* - For children: Only query the provider that owns the parent
|
|
1758
|
+
*/
|
|
1759
|
+
private loadCategoriesFromProviders;
|
|
1760
|
+
/**
|
|
1761
|
+
* Get the provider index that owns a specific category
|
|
1762
|
+
*
|
|
1763
|
+
* @returns Array with provider index, or null if ownership unknown (query all)
|
|
1764
|
+
*/
|
|
1765
|
+
private getProviderIndexForCategory;
|
|
1766
|
+
/**
|
|
1767
|
+
* Load workflow definitions from providers and cache results
|
|
1768
|
+
*
|
|
1769
|
+
* Optimization: Only queries the provider that owns the category
|
|
1770
|
+
* Uses provider INDEX to match category provider with workflow provider
|
|
1771
|
+
*/
|
|
1772
|
+
private loadWorkflowsFromProviders;
|
|
1773
|
+
/**
|
|
1774
|
+
* Load single workflow definition from providers and cache result
|
|
1775
|
+
*/
|
|
1776
|
+
private loadWorkflowFromProviders;
|
|
1777
|
+
/**
|
|
1778
|
+
* Breadth-first search through category hierarchy
|
|
1779
|
+
*/
|
|
1780
|
+
private searchCategoryInHierarchy;
|
|
1781
|
+
/**
|
|
1782
|
+
* Check if category has children (uses cached count)
|
|
1783
|
+
*/
|
|
1784
|
+
categoryHasChildren(categoryId: string): boolean;
|
|
1785
|
+
/**
|
|
1786
|
+
* Check if category has workflows (uses cached count)
|
|
1787
|
+
*/
|
|
1788
|
+
categoryHasWorkflows(categoryId: string): boolean;
|
|
1789
|
+
/**
|
|
1790
|
+
* Clear all caches
|
|
1791
|
+
*/
|
|
1792
|
+
clearAllCache(): void;
|
|
1793
|
+
/**
|
|
1794
|
+
* Clear categories cache only
|
|
1795
|
+
*/
|
|
1796
|
+
clearCategoriesCache(): void;
|
|
1797
|
+
/**
|
|
1798
|
+
* Clear workflows cache only
|
|
1799
|
+
*/
|
|
1800
|
+
clearWorkflowsCache(): void;
|
|
1801
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionService, never>;
|
|
1802
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionService>;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionService, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowFunction, AXPWorkflowLocalEngine, AXPWorkflowManager, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_PROVIDER, ActivityExecutor, WorkflowExpressionScopeService, createWorkFlowEvent, ofType };
|
|
1806
|
+
export type { AXPActivityCategory, AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityDefinition, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderToken, AXPActivityStatus, AXPActivityVariable, AXPBookmark, AXPCompletionCallbackState, AXPConnection, AXPElsaWorkflowExtensions, AXPExceptionState, AXPFrontActivityCompleteRequest, AXPFrontActivityCompleteResponse, AXPGetWorkflowStateRequest, AXPResumeWorkflowRequest, AXPResumeWorkflowResponse, AXPStartWorkflowRequest, AXPStartWorkflowResponse, AXPTaskType, AXPVariableDefinition, AXPWorkflow, AXPWorkflowActionInput, AXPWorkflowActivityInstance, AXPWorkflowBinding, AXPWorkflowCategory, AXPWorkflowCategoryProvider, AXPWorkflowCategoryProviderToken, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowDescriptorBase, AXPWorkflowDescriptorSchemaBase, AXPWorkflowEngine, AXPWorkflowEvent, AXPWorkflowExtensions, AXPWorkflowFaultState, AXPWorkflowGraph, AXPWorkflowInputDescriptor, AXPWorkflowInstance, AXPWorkflowInstanceState, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOutputDescriptor, AXPWorkflowProvider, AXPWorkflowProviderToken, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, ActivityExecutionResult, WorkflowCompleteResult, WorkflowExpressionContext, WorkflowResumeResult, WorkflowStartResult };
|