@acorex-platform/framework-client 0.0.10
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/README.md +7 -0
- package/auth/README.md +3 -0
- package/common/README.md +3 -0
- package/core/README.md +4 -0
- package/fesm2022/acorex-platform-framework-client-auth.mjs +1383 -0
- package/fesm2022/acorex-platform-framework-client-auth.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-common-common-settings.provider-CbzOYCnI.mjs +190 -0
- package/fesm2022/acorex-platform-framework-client-common-common-settings.provider-CbzOYCnI.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-common.mjs +9467 -0
- package/fesm2022/acorex-platform-framework-client-common.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-core.mjs +4655 -0
- package/fesm2022/acorex-platform-framework-client-core.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-domain.mjs +3189 -0
- package/fesm2022/acorex-platform-framework-client-domain.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-builder.mjs +3439 -0
- package/fesm2022/acorex-platform-framework-client-layout-builder.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-CWVU3wXL.mjs +134 -0
- package/fesm2022/acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-CWVU3wXL.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-components.mjs +9777 -0
- package/fesm2022/acorex-platform-framework-client-layout-components.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-designer.mjs +2799 -0
- package/fesm2022/acorex-platform-framework-client-layout-designer.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity-attachments-page.component-CxBxxpmA.mjs +376 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity-attachments-page.component-CxBxxpmA.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity-file-list-popup.component-l0JAHKIH.mjs +100 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity-file-list-popup.component-l0JAHKIH.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity.mjs +26299 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-views.mjs +2960 -0
- package/fesm2022/acorex-platform-framework-client-layout-views.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs +4711 -0
- package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-button-widget-designer.component-CpkWwygb.mjs +72 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-button-widget-designer.component-CpkWwygb.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-image-preview.popup-C_EPAvCU.mjs +29 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-image-preview.popup-C_EPAvCU.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-page-widget-designer.component-CmtTq2Mt.mjs +172 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-page-widget-designer.component-CmtTq2Mt.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-repeater-widget-column.component-DSx0E3NV.mjs +513 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-repeater-widget-column.component-DSx0E3NV.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-DdfcGV1C.mjs +274 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-DdfcGV1C.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-CntopmDS.mjs +64 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-CntopmDS.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-text-block-widget-designer.component-B5kSWxGk.mjs +34 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets-text-block-widget-designer.component-B5kSWxGk.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs +28553 -0
- package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-native.mjs +155 -0
- package/fesm2022/acorex-platform-framework-client-native.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-runtime.mjs +911 -0
- package/fesm2022/acorex-platform-framework-client-runtime.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-create-view.component-DnTHwsDJ.mjs +160 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-create-view.component-DnTHwsDJ.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-modify-view.component-BpR9g6QS.mjs +121 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-modify-view.component-BpR9g6QS.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-single-view.component-D1a7UI71.mjs +236 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-entity-master-single-view.component-D1a7UI71.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-401.component-D--_MIar.mjs +48 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-401.component-D--_MIar.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-404.component-Byyqk8pH.mjs +42 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-404.component-Byyqk8pH.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-offline.component-DR6G8gPC.mjs +19 -0
- package/fesm2022/acorex-platform-framework-client-themes-default-error-offline.component-DR6G8gPC.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-default.mjs +4160 -0
- package/fesm2022/acorex-platform-framework-client-themes-default.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-column.component-CXSGiTCK.mjs +55 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-column.component-CXSGiTCK.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-view.component-BY5clQ1J.mjs +57 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-view.component-BY5clQ1J.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-settings.provider-DEL2YOTP.mjs +234 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-settings.provider-DEL2YOTP.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-column.component-BXl8u4Yp.mjs +94 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-column.component-BXl8u4Yp.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-view.component-i2sOOkVj.mjs +86 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-view.component-i2sOOkVj.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared.mjs +2375 -0
- package/fesm2022/acorex-platform-framework-client-themes-shared.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-workflow.mjs +2836 -0
- package/fesm2022/acorex-platform-framework-client-workflow.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client.mjs +6 -0
- package/fesm2022/acorex-platform-framework-client.mjs.map +1 -0
- package/layout/builder/README.md +1578 -0
- package/layout/components/README.md +3 -0
- package/layout/designer/README.md +4 -0
- package/layout/entity/README.md +4 -0
- package/layout/views/README.md +3 -0
- package/layout/widget-core/README.md +4 -0
- package/layout/widgets/README.md +3 -0
- package/native/README.md +4 -0
- package/package.json +98 -0
- package/runtime/README.md +3 -0
- package/themes/default/README.md +3 -0
- package/themes/shared/README.md +3 -0
- package/types/acorex-platform-framework-client-auth.d.ts +690 -0
- package/types/acorex-platform-framework-client-common.d.ts +3287 -0
- package/types/acorex-platform-framework-client-core.d.ts +1849 -0
- package/types/acorex-platform-framework-client-domain.d.ts +1968 -0
- package/types/acorex-platform-framework-client-layout-builder.d.ts +1058 -0
- package/types/acorex-platform-framework-client-layout-components.d.ts +3362 -0
- package/types/acorex-platform-framework-client-layout-designer.d.ts +501 -0
- package/types/acorex-platform-framework-client-layout-entity.d.ts +4374 -0
- package/types/acorex-platform-framework-client-layout-views.d.ts +975 -0
- package/types/acorex-platform-framework-client-layout-widget-core.d.ts +1080 -0
- package/types/acorex-platform-framework-client-layout-widgets.d.ts +5263 -0
- package/types/acorex-platform-framework-client-native.d.ts +28 -0
- package/types/acorex-platform-framework-client-runtime.d.ts +301 -0
- package/types/acorex-platform-framework-client-themes-default.d.ts +889 -0
- package/types/acorex-platform-framework-client-themes-shared.d.ts +202 -0
- package/types/acorex-platform-framework-client-workflow.d.ts +1345 -0
- package/types/acorex-platform-framework-client.d.ts +2 -0
- package/workflow/README.md +4 -0
|
@@ -0,0 +1,1345 @@
|
|
|
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 { AXPActivityCategory, AXPActivityDefinition, AXPWorkflowContinuationMetadata, AXPWorkflowContinuationBeforeInteractive, AXPWorkflowCategory, AXPWorkflowDefinition } from '@acorex-platform/framework-shared/core';
|
|
6
|
+
export { AXPWorkflowCategory } from '@acorex-platform/framework-shared/core';
|
|
7
|
+
import { AXPExpressionEvaluatorScope } from '@acorex-platform/framework-client/core';
|
|
8
|
+
|
|
9
|
+
declare class AXPWorkflowError extends Error {
|
|
10
|
+
inner: Error | null;
|
|
11
|
+
constructor(message: string, inner?: Error | null);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface AXPWorkflow {
|
|
15
|
+
steps: {
|
|
16
|
+
[stepName: string]: AXPWorkflowStep;
|
|
17
|
+
};
|
|
18
|
+
startStepId: string;
|
|
19
|
+
}
|
|
20
|
+
declare class AXPWorkflowContext {
|
|
21
|
+
constructor(initialData?: any);
|
|
22
|
+
private variables;
|
|
23
|
+
private stepOutputs;
|
|
24
|
+
setVariable(key: string, value: any): void;
|
|
25
|
+
setVariables(context?: any): void;
|
|
26
|
+
getVariable<T = any>(key?: string | null): T;
|
|
27
|
+
setOutput(key: string, output: any): void;
|
|
28
|
+
setOutputs(values: Map<string, any>): void;
|
|
29
|
+
getOutput<T = any>(key: string): T;
|
|
30
|
+
}
|
|
31
|
+
type AXPWorkflowActionInput = any;
|
|
32
|
+
type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';
|
|
33
|
+
interface AXPWorkflowCondition {
|
|
34
|
+
type: AXPWorkflowConditionType;
|
|
35
|
+
conditions?: AXPWorkflowCondition[];
|
|
36
|
+
expression?: string;
|
|
37
|
+
}
|
|
38
|
+
interface AXPWorkflowNextStep {
|
|
39
|
+
conditions: AXPWorkflowCondition[];
|
|
40
|
+
nextStepId: string;
|
|
41
|
+
}
|
|
42
|
+
interface AXPWorkflowStep {
|
|
43
|
+
id?: string;
|
|
44
|
+
action: AXPWorkflowAction | string;
|
|
45
|
+
input?: AXPWorkflowActionInput;
|
|
46
|
+
nextSteps?: AXPWorkflowNextStep[];
|
|
47
|
+
conditions?: AXPWorkflowCondition[];
|
|
48
|
+
}
|
|
49
|
+
declare abstract class AXPWorkflowAction {
|
|
50
|
+
private eventService;
|
|
51
|
+
protected dispatch(event: AXPWorkflowEvent): void;
|
|
52
|
+
abstract execute(context: AXPWorkflowContext): Promise<void>;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowAction, never>;
|
|
54
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowAction>;
|
|
55
|
+
}
|
|
56
|
+
declare abstract class AXPWorkflowFunction {
|
|
57
|
+
abstract execute(...args: any[]): Promise<any> | any;
|
|
58
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowFunction, never>;
|
|
59
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowFunction>;
|
|
60
|
+
}
|
|
61
|
+
interface AXPWorkflowEvent<T = any> {
|
|
62
|
+
type: string;
|
|
63
|
+
payload?: T;
|
|
64
|
+
}
|
|
65
|
+
declare function createWorkFlowEvent<T>(type: string): {
|
|
66
|
+
(payload: T): {
|
|
67
|
+
type: string;
|
|
68
|
+
payload: T;
|
|
69
|
+
};
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
declare function ofType<T extends {
|
|
73
|
+
type: string;
|
|
74
|
+
}>(...allowedTypes: Array<{
|
|
75
|
+
type: string;
|
|
76
|
+
}>): rxjs.MonoTypeOperatorFunction<T>;
|
|
77
|
+
|
|
78
|
+
declare class AXPWorkflowEventService {
|
|
79
|
+
private eventSubject;
|
|
80
|
+
dispatch(event: AXPWorkflowEvent): void;
|
|
81
|
+
get events$(): Observable<AXPWorkflowEvent>;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowEventService, never>;
|
|
83
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowEventService>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class AXPWorkflowRegistryService {
|
|
87
|
+
private functionsMap;
|
|
88
|
+
private actionsMap;
|
|
89
|
+
private workflowsMap;
|
|
90
|
+
registerWorkflow(name: string, workflow: AXPWorkflow): void;
|
|
91
|
+
getWorkflow(name: string): AXPWorkflow | undefined;
|
|
92
|
+
registerAction(name: string, action: Type<AXPWorkflowAction>): void;
|
|
93
|
+
getAction(name: string): Type<AXPWorkflowAction> | undefined;
|
|
94
|
+
registerFunction(name: string, func: Type<AXPWorkflowFunction>): void;
|
|
95
|
+
getFunction(name: string): Type<AXPWorkflowFunction> | undefined;
|
|
96
|
+
getFunctionNames(): string[];
|
|
97
|
+
getStep(workflowName: string, stepName: string): AXPWorkflowStep | undefined;
|
|
98
|
+
updateStepInWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
|
|
99
|
+
addStepToWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
|
|
100
|
+
addAfterStep(workflowId: string, stepId: string, newStepId: string, newStepAction: string, conditionExpression: string): void;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowRegistryService, never>;
|
|
102
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowRegistryService>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface AXPWorkflowModuleConfigs {
|
|
106
|
+
functions?: {
|
|
107
|
+
[name: string]: Type<AXPWorkflowFunction>;
|
|
108
|
+
};
|
|
109
|
+
actions?: {
|
|
110
|
+
[name: string]: Type<AXPWorkflowAction>;
|
|
111
|
+
};
|
|
112
|
+
workflows?: {
|
|
113
|
+
[name: string]: AXPWorkflow;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
declare class AXPWorkflowModule {
|
|
117
|
+
static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
|
|
118
|
+
static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
|
|
119
|
+
/**
|
|
120
|
+
* @ignore
|
|
121
|
+
*/
|
|
122
|
+
constructor(instances: any[]);
|
|
123
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowModule, [{ optional: true; }]>;
|
|
124
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXPWorkflowModule, never, never, never>;
|
|
125
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXPWorkflowModule>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare class AXPWorkflowService {
|
|
129
|
+
private registryService;
|
|
130
|
+
private injector;
|
|
131
|
+
private eventService;
|
|
132
|
+
get events$(): Observable<AXPWorkflowEvent>;
|
|
133
|
+
constructor(registryService: AXPWorkflowRegistryService, injector: Injector);
|
|
134
|
+
exists(name: string): boolean;
|
|
135
|
+
execute(workflow: AXPWorkflow | string, initialContext?: AXPWorkflowContext | any | null): Promise<AXPWorkflowContext>;
|
|
136
|
+
private processData;
|
|
137
|
+
private getActionInstance;
|
|
138
|
+
private getWorkflowInstance;
|
|
139
|
+
private determineNextStep;
|
|
140
|
+
private evaluateCondition;
|
|
141
|
+
private evaluateSingleCondition;
|
|
142
|
+
private evaluateExpression;
|
|
143
|
+
private processInputs;
|
|
144
|
+
private createFunctionScope;
|
|
145
|
+
private getFunctionInstance;
|
|
146
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowService, never>;
|
|
147
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowService>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
type AXPActivityProviderToken = AXPActivityProvider | Promise<AXPActivityProvider>;
|
|
151
|
+
declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProviderToken[]>;
|
|
152
|
+
interface AXPActivityProvider {
|
|
153
|
+
/**
|
|
154
|
+
* Get list of activity definitions for a category.
|
|
155
|
+
* @param categoryId - Category ID to filter activities
|
|
156
|
+
* @returns Promise of activity definitions array
|
|
157
|
+
*/
|
|
158
|
+
getList(categoryId: string): Promise<AXPActivityDefinition[]>;
|
|
159
|
+
/**
|
|
160
|
+
* Get activity definition by name (unique identifier).
|
|
161
|
+
* The name is used as the command key for execution.
|
|
162
|
+
* @param name - Activity name (unique identifier and command key)
|
|
163
|
+
* @returns Promise of activity definition or undefined if not found
|
|
164
|
+
*/
|
|
165
|
+
getById(name: string): Promise<AXPActivityDefinition | undefined>;
|
|
166
|
+
}
|
|
167
|
+
type AXPActivityCategoryProviderToken = AXPActivityCategoryProvider | Promise<AXPActivityCategoryProvider>;
|
|
168
|
+
declare const AXP_ACTIVITY_CATEGORY_PROVIDER: InjectionToken<AXPActivityCategoryProviderToken[]>;
|
|
169
|
+
interface AXPActivityCategoryProvider {
|
|
170
|
+
getList(parentId?: string): Promise<AXPActivityCategory[]>;
|
|
171
|
+
getById(id: string): Promise<AXPActivityCategory | undefined>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Optimized Activity Definition Service
|
|
176
|
+
*
|
|
177
|
+
* Manages activity definitions (metadata) for UI and tooling.
|
|
178
|
+
* Similar to AXPReportDefinitionService - only handles metadata, not execution.
|
|
179
|
+
*
|
|
180
|
+
* Performance optimizations:
|
|
181
|
+
* 1. Uses childrenCount to determine if category has children (no query needed)
|
|
182
|
+
* 2. Uses itemsCount to determine if category has activities (no query needed)
|
|
183
|
+
* 3. Aggressive caching prevents duplicate API calls
|
|
184
|
+
* 4. Single pending request per resource prevents race conditions
|
|
185
|
+
* 5. Lazy loading - only loads data when needed
|
|
186
|
+
*/
|
|
187
|
+
declare class AXPActivityDefinitionService {
|
|
188
|
+
private readonly categoryProviders;
|
|
189
|
+
private readonly activityProviders;
|
|
190
|
+
/** Cache for categories by id - O(1) lookup */
|
|
191
|
+
private categoriesById;
|
|
192
|
+
/** Cache for categories by parentId - O(1) lookup */
|
|
193
|
+
private categoriesByParentId;
|
|
194
|
+
/** Cache for activity definitions by categoryId - O(1) lookup */
|
|
195
|
+
private activitiesByCategory;
|
|
196
|
+
/** Cache for individual activity definitions by name - O(1) lookup */
|
|
197
|
+
private activitiesByName;
|
|
198
|
+
/** Track which provider index owns each category (by category ID) */
|
|
199
|
+
private categoryOwnership;
|
|
200
|
+
/** Pending API requests to prevent duplicate calls */
|
|
201
|
+
private pendingCategoriesRequests;
|
|
202
|
+
private pendingActivitiesRequests;
|
|
203
|
+
private pendingActivityRequests;
|
|
204
|
+
/**
|
|
205
|
+
* Get categories by parentId with aggressive caching
|
|
206
|
+
*
|
|
207
|
+
* Optimization: Returns cached result immediately if available,
|
|
208
|
+
* preventing unnecessary API calls during navigation
|
|
209
|
+
*
|
|
210
|
+
* @param parentId - Parent category ID (undefined = root categories)
|
|
211
|
+
* @returns Array of categories with count metadata (childrenCount, itemsCount)
|
|
212
|
+
*/
|
|
213
|
+
getCategories(parentId?: string): Promise<AXPActivityCategory[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Get single category by ID with O(1) lookup
|
|
216
|
+
*
|
|
217
|
+
* Optimization: Uses Map for instant retrieval, falls back to
|
|
218
|
+
* searching cache, then providers if not found
|
|
219
|
+
*/
|
|
220
|
+
getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* Get category path from root to specified category
|
|
223
|
+
*
|
|
224
|
+
* Optimization: Builds path using cached categories only
|
|
225
|
+
*/
|
|
226
|
+
getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Get activity definitions for a category with smart caching
|
|
229
|
+
*
|
|
230
|
+
* Optimization: Checks itemsCount before querying
|
|
231
|
+
* - If itemsCount = 0, returns empty array (no API call)
|
|
232
|
+
* - If itemsCount > 0, loads and caches activity definitions
|
|
233
|
+
* - Returns cached result on subsequent calls
|
|
234
|
+
*
|
|
235
|
+
* @param categoryId - Category ID to get activity definitions from
|
|
236
|
+
* @returns Array of activity definitions
|
|
237
|
+
*/
|
|
238
|
+
getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]>;
|
|
239
|
+
/**
|
|
240
|
+
* Get single activity definition by name with O(1) lookup
|
|
241
|
+
*
|
|
242
|
+
* Optimization: Uses Map for instant retrieval
|
|
243
|
+
*
|
|
244
|
+
* @param name - Activity name (unique identifier and command key)
|
|
245
|
+
* @returns Activity definition or undefined if not found
|
|
246
|
+
*/
|
|
247
|
+
getActivityByName(name: string): Promise<AXPActivityDefinition | undefined>;
|
|
248
|
+
/**
|
|
249
|
+
* Get all activity definitions (flat list) by loading root categories and their activities.
|
|
250
|
+
* Used by activity selector UIs (e.g. automation command configurator).
|
|
251
|
+
*/
|
|
252
|
+
getAllActivities(): Promise<AXPActivityDefinition[]>;
|
|
253
|
+
/**
|
|
254
|
+
* Get category ID containing a specific activity definition
|
|
255
|
+
*
|
|
256
|
+
* Optimization: Searches cache first, loads on-demand if needed
|
|
257
|
+
*/
|
|
258
|
+
getCategoryIdByActivityName(activityName: string): Promise<string | undefined>;
|
|
259
|
+
/**
|
|
260
|
+
* Get category path for an activity
|
|
261
|
+
*/
|
|
262
|
+
getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]>;
|
|
263
|
+
/**
|
|
264
|
+
* Load categories from providers and cache results
|
|
265
|
+
*
|
|
266
|
+
* Optimization: Tracks provider ownership to avoid unnecessary API calls
|
|
267
|
+
* - For root (parentId = undefined): Query ALL providers
|
|
268
|
+
* - For children: Only query the provider that owns the parent
|
|
269
|
+
*/
|
|
270
|
+
private loadCategoriesFromProviders;
|
|
271
|
+
/**
|
|
272
|
+
* Get the provider index that owns a specific category
|
|
273
|
+
*
|
|
274
|
+
* @returns Array with provider index, or null if ownership unknown (query all)
|
|
275
|
+
*/
|
|
276
|
+
private getProviderIndexForCategory;
|
|
277
|
+
/**
|
|
278
|
+
* Load activity definitions from providers and cache results
|
|
279
|
+
*
|
|
280
|
+
* Optimization: Only queries the provider that owns the category
|
|
281
|
+
* Uses provider INDEX to match category provider with activity provider
|
|
282
|
+
*/
|
|
283
|
+
private loadActivitiesFromProviders;
|
|
284
|
+
/**
|
|
285
|
+
* Load single activity definition from providers and cache result
|
|
286
|
+
*/
|
|
287
|
+
private loadActivityFromProviders;
|
|
288
|
+
/**
|
|
289
|
+
* Breadth-first search through category hierarchy
|
|
290
|
+
*/
|
|
291
|
+
private searchCategoryInHierarchy;
|
|
292
|
+
/**
|
|
293
|
+
* Check if category has children (uses cached count)
|
|
294
|
+
*/
|
|
295
|
+
categoryHasChildren(categoryId: string): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Check if category has activities (uses cached count)
|
|
298
|
+
*/
|
|
299
|
+
categoryHasActivities(categoryId: string): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Clear all caches
|
|
302
|
+
*/
|
|
303
|
+
clearAllCache(): void;
|
|
304
|
+
/**
|
|
305
|
+
* Clear categories cache only
|
|
306
|
+
*/
|
|
307
|
+
clearCategoriesCache(): void;
|
|
308
|
+
/**
|
|
309
|
+
* Clear activities cache only
|
|
310
|
+
*/
|
|
311
|
+
clearActivitiesCache(): void;
|
|
312
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityDefinitionService, never>;
|
|
313
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityDefinitionService>;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Represents a workflow task that needs to be executed.
|
|
318
|
+
* Inspired by Temporal's Activity Tasks and Camunda's External Tasks.
|
|
319
|
+
*/
|
|
320
|
+
interface AXPWorkflowTask {
|
|
321
|
+
/**
|
|
322
|
+
* Unique token for this task (used for completion/security).
|
|
323
|
+
*/
|
|
324
|
+
taskToken: string;
|
|
325
|
+
/**
|
|
326
|
+
* Activity ID from workflow definition.
|
|
327
|
+
*/
|
|
328
|
+
activityId: string;
|
|
329
|
+
/**
|
|
330
|
+
* Activity type (e.g., 'workflow-activity:show-toast').
|
|
331
|
+
*/
|
|
332
|
+
activityType: string;
|
|
333
|
+
/**
|
|
334
|
+
* Human-readable activity name.
|
|
335
|
+
*/
|
|
336
|
+
activityName?: string;
|
|
337
|
+
/**
|
|
338
|
+
* Where this task should be executed.
|
|
339
|
+
* - 'frontend': Execute in browser (UI activities, console, events)
|
|
340
|
+
* - 'backend': Execute in backend (business logic, API calls)
|
|
341
|
+
* - 'both': Execute in both frontend and backend (hybrid activities)
|
|
342
|
+
*/
|
|
343
|
+
executionMode: 'frontend' | 'backend' | 'both';
|
|
344
|
+
/**
|
|
345
|
+
* Type of task for inbox handling.
|
|
346
|
+
*/
|
|
347
|
+
taskType?: 'human-task' | 'ui-activity' | 'system-activity';
|
|
348
|
+
/**
|
|
349
|
+
* Input data for the activity (for frontend activities).
|
|
350
|
+
*/
|
|
351
|
+
input?: Record<string, any>;
|
|
352
|
+
/**
|
|
353
|
+
* Configuration for the activity (for frontend activities).
|
|
354
|
+
*/
|
|
355
|
+
config?: Record<string, any>;
|
|
356
|
+
/**
|
|
357
|
+
* Continuation UX copied from the activity definition at task creation time.
|
|
358
|
+
*/
|
|
359
|
+
continuation?: AXPWorkflowContinuationMetadata;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Request to start a workflow instance.
|
|
363
|
+
*/
|
|
364
|
+
interface AXPStartWorkflowRequest {
|
|
365
|
+
/**
|
|
366
|
+
* Workflow ID to execute.
|
|
367
|
+
*/
|
|
368
|
+
workflowId: string;
|
|
369
|
+
/**
|
|
370
|
+
* Initial input data for workflow.
|
|
371
|
+
*/
|
|
372
|
+
input: Record<string, any>;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Response after starting workflow instance.
|
|
376
|
+
*/
|
|
377
|
+
interface AXPStartWorkflowResponse {
|
|
378
|
+
/**
|
|
379
|
+
* Unique instance ID for this workflow run.
|
|
380
|
+
*/
|
|
381
|
+
instanceId: string;
|
|
382
|
+
/**
|
|
383
|
+
* Current workflow state.
|
|
384
|
+
*/
|
|
385
|
+
state: AXPWorkflowInstanceState;
|
|
386
|
+
/**
|
|
387
|
+
* First task to execute (determined by backend).
|
|
388
|
+
* Client should execute this task based on executionMode.
|
|
389
|
+
*/
|
|
390
|
+
pendingTask?: AXPWorkflowTask | null;
|
|
391
|
+
/**
|
|
392
|
+
* Activity outputs map (activityId -> output).
|
|
393
|
+
* Returned for expression evaluation in subsequent activities.
|
|
394
|
+
*/
|
|
395
|
+
activityOutputs?: Record<string, any>;
|
|
396
|
+
/**
|
|
397
|
+
* Last activity output (convenience).
|
|
398
|
+
* Prefer using `activityOutputs[activityId]` when possible.
|
|
399
|
+
*/
|
|
400
|
+
lastActivityOutput?: any;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Request to resume a suspended workflow.
|
|
404
|
+
*/
|
|
405
|
+
interface AXPResumeWorkflowRequest {
|
|
406
|
+
/**
|
|
407
|
+
* Instance ID.
|
|
408
|
+
*/
|
|
409
|
+
instanceId: string;
|
|
410
|
+
/**
|
|
411
|
+
* Step ID that was waiting for user input.
|
|
412
|
+
*/
|
|
413
|
+
stepId: string;
|
|
414
|
+
/**
|
|
415
|
+
* Secure task token issued with the pending task.
|
|
416
|
+
* Backend validates and resolves the step using this token.
|
|
417
|
+
*/
|
|
418
|
+
taskToken: string;
|
|
419
|
+
/**
|
|
420
|
+
* User action outcome (e.g., 'Confirmed', 'Cancelled').
|
|
421
|
+
*/
|
|
422
|
+
outcome?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Optional user input data.
|
|
425
|
+
*/
|
|
426
|
+
userInput?: any;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Response after resuming workflow.
|
|
430
|
+
*/
|
|
431
|
+
interface AXPResumeWorkflowResponse {
|
|
432
|
+
/**
|
|
433
|
+
* Activity execution output.
|
|
434
|
+
*/
|
|
435
|
+
output: any;
|
|
436
|
+
/**
|
|
437
|
+
* Activity execution outcomes.
|
|
438
|
+
*/
|
|
439
|
+
outcomes: Record<string, any>;
|
|
440
|
+
/**
|
|
441
|
+
* Next task to execute (if any).
|
|
442
|
+
*/
|
|
443
|
+
nextTask?: AXPWorkflowTask | null;
|
|
444
|
+
/**
|
|
445
|
+
* Updated workflow state.
|
|
446
|
+
*/
|
|
447
|
+
state: AXPWorkflowInstanceState;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Request to get workflow instance state.
|
|
451
|
+
*/
|
|
452
|
+
interface AXPGetWorkflowStateRequest {
|
|
453
|
+
/**
|
|
454
|
+
* Instance ID.
|
|
455
|
+
*/
|
|
456
|
+
instanceId: string;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Workflow instance state (managed by backend, cached in client).
|
|
460
|
+
*/
|
|
461
|
+
interface AXPWorkflowInstanceState {
|
|
462
|
+
/**
|
|
463
|
+
* Unique instance ID.
|
|
464
|
+
*/
|
|
465
|
+
instanceId: string;
|
|
466
|
+
/**
|
|
467
|
+
* Workflow ID.
|
|
468
|
+
*/
|
|
469
|
+
workflowId: string;
|
|
470
|
+
/**
|
|
471
|
+
* Current instance status.
|
|
472
|
+
*/
|
|
473
|
+
status: 'running' | 'completed' | 'suspended' | 'error';
|
|
474
|
+
/**
|
|
475
|
+
* Current step ID (if suspended or running).
|
|
476
|
+
*/
|
|
477
|
+
currentStepId?: string;
|
|
478
|
+
/**
|
|
479
|
+
* Workflow variables (state).
|
|
480
|
+
*/
|
|
481
|
+
variables: Record<string, any>;
|
|
482
|
+
/**
|
|
483
|
+
* Activity outputs map (activityId -> output).
|
|
484
|
+
* Used by expression evaluation scope as `outputs.activityId`.
|
|
485
|
+
*/
|
|
486
|
+
activityOutputs?: Record<string, any>;
|
|
487
|
+
/**
|
|
488
|
+
* Last activity output (convenience).
|
|
489
|
+
* Useful when the next activity needs a quick access to the previous result.
|
|
490
|
+
*/
|
|
491
|
+
lastActivityOutput?: any;
|
|
492
|
+
/**
|
|
493
|
+
* Initial input data.
|
|
494
|
+
*/
|
|
495
|
+
input: Record<string, any>;
|
|
496
|
+
/**
|
|
497
|
+
* Final output data (if completed).
|
|
498
|
+
*/
|
|
499
|
+
output?: Record<string, any>;
|
|
500
|
+
/**
|
|
501
|
+
* Last update timestamp.
|
|
502
|
+
*/
|
|
503
|
+
lastUpdated: Date;
|
|
504
|
+
}
|
|
505
|
+
interface AXPFrontActivityCompleteRequest {
|
|
506
|
+
/**
|
|
507
|
+
* Instance ID.
|
|
508
|
+
*/
|
|
509
|
+
instanceId: string;
|
|
510
|
+
activityNode: string;
|
|
511
|
+
output: Record<string, any>;
|
|
512
|
+
outcome?: string;
|
|
513
|
+
}
|
|
514
|
+
interface AXPFrontActivityCompleteResponse {
|
|
515
|
+
/**
|
|
516
|
+
* Activity execution output.
|
|
517
|
+
*/
|
|
518
|
+
output?: any;
|
|
519
|
+
/**
|
|
520
|
+
* Activity execution outcomes.
|
|
521
|
+
*/
|
|
522
|
+
outcomes?: Record<string, any>;
|
|
523
|
+
/**
|
|
524
|
+
* Next task to execute (if any).
|
|
525
|
+
*/
|
|
526
|
+
nextTask?: AXPWorkflowTask | null;
|
|
527
|
+
/**
|
|
528
|
+
* Updated workflow state.
|
|
529
|
+
*/
|
|
530
|
+
state?: AXPWorkflowInstanceState;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Activity types that use the task board (suspend until user acts via inbox), not inline interactive execution.
|
|
534
|
+
*/
|
|
535
|
+
declare const AXP_WORKFLOW_TASK_BOARD_ACTIVITY_TYPES: readonly string[];
|
|
536
|
+
declare function axpIsWorkflowTaskBoardActivityType(activityType: string | undefined | null): boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Claim a pooled workflow task (updates bookmark assignee without resuming the workflow).
|
|
539
|
+
*/
|
|
540
|
+
interface AXPClaimWorkflowTaskRequest {
|
|
541
|
+
instanceId: string;
|
|
542
|
+
bookmarkId: string;
|
|
543
|
+
stepId: string;
|
|
544
|
+
}
|
|
545
|
+
interface AXPClaimWorkflowTaskResponse {
|
|
546
|
+
success: boolean;
|
|
547
|
+
error?: string;
|
|
548
|
+
errorCode?: string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Reassign a human-task bookmark to the current user without resuming the workflow.
|
|
552
|
+
*/
|
|
553
|
+
interface AXPReassignWorkflowTaskToSelfRequest {
|
|
554
|
+
instanceId: string;
|
|
555
|
+
bookmarkId: string;
|
|
556
|
+
stepId: string;
|
|
557
|
+
}
|
|
558
|
+
interface AXPReassignWorkflowTaskToSelfResponse {
|
|
559
|
+
success: boolean;
|
|
560
|
+
error?: string;
|
|
561
|
+
errorCode?: string;
|
|
562
|
+
}
|
|
563
|
+
/** Restore task-board visibility after the user declines a pre-interactive continuation prompt. */
|
|
564
|
+
interface AXPRevertResumeAfterDeclinedInteractiveContinuationRequest {
|
|
565
|
+
instanceId: string;
|
|
566
|
+
/** Human-task / cartable step that was resumed from the task board. */
|
|
567
|
+
suspendedStepId: string;
|
|
568
|
+
/** Inline frontend step that was about to run when the user declined. */
|
|
569
|
+
abortedStepId?: string;
|
|
570
|
+
/** Bookmark id of the suspended step (when known). */
|
|
571
|
+
bookmarkId?: string;
|
|
572
|
+
}
|
|
573
|
+
interface AXPRevertResumeAfterDeclinedInteractiveContinuationResponse {
|
|
574
|
+
success: boolean;
|
|
575
|
+
state?: AXPWorkflowInstanceState;
|
|
576
|
+
error?: string;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Interface for workflow engine operations.
|
|
581
|
+
*/
|
|
582
|
+
interface AXPWorkflowEngine {
|
|
583
|
+
/**
|
|
584
|
+
* Start a new workflow instance.
|
|
585
|
+
*
|
|
586
|
+
* Creates a new workflow instance in backend and returns instance ID.
|
|
587
|
+
*
|
|
588
|
+
* @param request - Start workflow request
|
|
589
|
+
* @returns Response with instanceId and initial state
|
|
590
|
+
*
|
|
591
|
+
*/
|
|
592
|
+
start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
|
|
593
|
+
/**
|
|
594
|
+
* Resume a suspended workflow instance.
|
|
595
|
+
*
|
|
596
|
+
* Resumes workflow instance after user interaction (e.g., after show-dialog).
|
|
597
|
+
*
|
|
598
|
+
* @param request - Resume workflow request
|
|
599
|
+
* @returns Resume response with next step and updated state
|
|
600
|
+
*
|
|
601
|
+
*/
|
|
602
|
+
resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
|
|
603
|
+
/**
|
|
604
|
+
* Get current workflow instance state.
|
|
605
|
+
*
|
|
606
|
+
* Retrieves current state of a workflow instance from backend.
|
|
607
|
+
*
|
|
608
|
+
* @param request - Get state request
|
|
609
|
+
* @returns Current workflow instance state
|
|
610
|
+
*
|
|
611
|
+
*/
|
|
612
|
+
getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
|
|
613
|
+
frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
|
|
614
|
+
/**
|
|
615
|
+
* Optional: claim a pooled task (e.g. cartable) without consuming the bookmark.
|
|
616
|
+
* Engines that do not support pooling should omit this method.
|
|
617
|
+
*/
|
|
618
|
+
claimTask?(request: AXPClaimWorkflowTaskRequest): Promise<AXPClaimWorkflowTaskResponse>;
|
|
619
|
+
/**
|
|
620
|
+
* Optional: reassign a human-task bookmark to the current user (requires permission on the engine).
|
|
621
|
+
*/
|
|
622
|
+
reassignTaskToSelf?(request: AXPReassignWorkflowTaskToSelfRequest): Promise<AXPReassignWorkflowTaskToSelfResponse>;
|
|
623
|
+
/**
|
|
624
|
+
* Optional: restore a suspended task-board step when the user declines a pre-interactive continuation prompt.
|
|
625
|
+
*/
|
|
626
|
+
revertResumeAfterDeclinedInteractiveContinuation?(request: AXPRevertResumeAfterDeclinedInteractiveContinuationRequest): Promise<AXPRevertResumeAfterDeclinedInteractiveContinuationResponse>;
|
|
627
|
+
/**
|
|
628
|
+
* Optional: terminate a non-finished instance (e.g. superseded lifecycle run).
|
|
629
|
+
*/
|
|
630
|
+
cancelInstance?(instanceId: string, reason?: string): Promise<void>;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Injection token for workflow engine.
|
|
634
|
+
* Default implementation is AXPWorkflowLocalEngine.
|
|
635
|
+
*/
|
|
636
|
+
declare const AXP_WORKFLOW_ENGINE: InjectionToken<AXPWorkflowEngine>;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Stable workflow engine error codes for UI branching (toasts, take-over flow, etc.).
|
|
640
|
+
*/
|
|
641
|
+
declare const AXP_WORKFLOW_ERROR_CODES: {
|
|
642
|
+
readonly TASK_NOT_ASSIGNEE: "WORKFLOW_TASK_NOT_ASSIGNEE";
|
|
643
|
+
readonly CLAIM_REQUIRED: "WORKFLOW_CLAIM_REQUIRED";
|
|
644
|
+
readonly REASSIGN_NOT_ALLOWED: "WORKFLOW_REASSIGN_NOT_ALLOWED";
|
|
645
|
+
};
|
|
646
|
+
type AXPWorkflowErrorCode = (typeof AXP_WORKFLOW_ERROR_CODES)[keyof typeof AXP_WORKFLOW_ERROR_CODES];
|
|
647
|
+
/**
|
|
648
|
+
* Business-rule failure from {@link AXPWorkflowEngine} (expected, user-facing).
|
|
649
|
+
*/
|
|
650
|
+
declare class AXPWorkflowEngineError extends Error {
|
|
651
|
+
readonly code: AXPWorkflowErrorCode;
|
|
652
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
653
|
+
constructor(message: string, code: AXPWorkflowErrorCode, details?: Record<string, unknown> | undefined);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Resolves a stable error code from an unknown thrown value.
|
|
657
|
+
*/
|
|
658
|
+
declare function getWorkflowEngineErrorCode(error: unknown): AXPWorkflowErrorCode | undefined;
|
|
659
|
+
/**
|
|
660
|
+
* Resolves a user-facing message and optional code from an unknown thrown value.
|
|
661
|
+
*/
|
|
662
|
+
declare function getWorkflowEngineErrorInfo(error: unknown): {
|
|
663
|
+
message: string;
|
|
664
|
+
code?: AXPWorkflowErrorCode;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Result of starting a workflow.
|
|
669
|
+
*/
|
|
670
|
+
interface WorkflowStartResult {
|
|
671
|
+
/**
|
|
672
|
+
* Whether the operation succeeded.
|
|
673
|
+
*/
|
|
674
|
+
success: boolean;
|
|
675
|
+
/**
|
|
676
|
+
* Workflow instance ID.
|
|
677
|
+
*/
|
|
678
|
+
instanceId?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Initial workflow state.
|
|
681
|
+
*/
|
|
682
|
+
state?: AXPWorkflowInstanceState;
|
|
683
|
+
/**
|
|
684
|
+
* First task to execute (if any).
|
|
685
|
+
*/
|
|
686
|
+
nextTask?: AXPWorkflowTask | null;
|
|
687
|
+
/**
|
|
688
|
+
* Workflow output (if completed immediately).
|
|
689
|
+
*/
|
|
690
|
+
output?: any;
|
|
691
|
+
/**
|
|
692
|
+
* Error message (if failed).
|
|
693
|
+
*/
|
|
694
|
+
error?: string;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Result of completing a task.
|
|
698
|
+
*/
|
|
699
|
+
interface WorkflowCompleteResult {
|
|
700
|
+
/**
|
|
701
|
+
* Whether the operation succeeded.
|
|
702
|
+
*/
|
|
703
|
+
success: boolean;
|
|
704
|
+
/**
|
|
705
|
+
* Workflow instance ID.
|
|
706
|
+
*/
|
|
707
|
+
instanceId: string;
|
|
708
|
+
/**
|
|
709
|
+
* Updated workflow state.
|
|
710
|
+
*/
|
|
711
|
+
state?: AXPWorkflowInstanceState;
|
|
712
|
+
/**
|
|
713
|
+
* Next task to execute (if any).
|
|
714
|
+
*/
|
|
715
|
+
nextTask?: AXPWorkflowTask | null;
|
|
716
|
+
/**
|
|
717
|
+
* Workflow output (if completed).
|
|
718
|
+
*/
|
|
719
|
+
output?: any;
|
|
720
|
+
/**
|
|
721
|
+
* Error message (if failed).
|
|
722
|
+
*/
|
|
723
|
+
error?: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Result of resuming a workflow.
|
|
727
|
+
*/
|
|
728
|
+
interface WorkflowResumeResult {
|
|
729
|
+
/**
|
|
730
|
+
* Whether the operation succeeded.
|
|
731
|
+
*/
|
|
732
|
+
success: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* Workflow instance ID.
|
|
735
|
+
*/
|
|
736
|
+
instanceId: string;
|
|
737
|
+
/**
|
|
738
|
+
* Updated workflow state.
|
|
739
|
+
*/
|
|
740
|
+
state?: AXPWorkflowInstanceState;
|
|
741
|
+
/**
|
|
742
|
+
* Next task to execute (if any).
|
|
743
|
+
*/
|
|
744
|
+
nextTask?: AXPWorkflowTask | null;
|
|
745
|
+
/**
|
|
746
|
+
* Workflow output (if completed).
|
|
747
|
+
*/
|
|
748
|
+
output?: any;
|
|
749
|
+
/**
|
|
750
|
+
* Error message (if failed).
|
|
751
|
+
*/
|
|
752
|
+
error?: string;
|
|
753
|
+
/**
|
|
754
|
+
* Stable engine error code when available (e.g. WORKFLOW_TASK_NOT_ASSIGNEE).
|
|
755
|
+
*/
|
|
756
|
+
errorCode?: string;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Result of claiming a pooled workflow task (cartable / candidate pool).
|
|
760
|
+
*/
|
|
761
|
+
interface WorkflowClaimTaskResult {
|
|
762
|
+
success: boolean;
|
|
763
|
+
instanceId: string;
|
|
764
|
+
error?: string;
|
|
765
|
+
errorCode?: string;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Result of reassigning a human-task bookmark to the current user.
|
|
769
|
+
*/
|
|
770
|
+
interface WorkflowReassignTaskToSelfResult {
|
|
771
|
+
success: boolean;
|
|
772
|
+
instanceId: string;
|
|
773
|
+
error?: string;
|
|
774
|
+
errorCode?: string;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Workflow Manager - Facade for workflow lifecycle orchestration.
|
|
778
|
+
*
|
|
779
|
+
* This service is the ONLY interface the frontend uses to interact with workflows.
|
|
780
|
+
* It follows Clean Architecture principles and does NOT contain execution or business logic.
|
|
781
|
+
*
|
|
782
|
+
* Responsibilities:
|
|
783
|
+
* - Orchestrate workflow lifecycle (start, execute, complete, resume)
|
|
784
|
+
* - Delegate execution to ActivityExecutor
|
|
785
|
+
* - Cache workflow state in memory
|
|
786
|
+
* - Expose a stable API for UI
|
|
787
|
+
*
|
|
788
|
+
* Rules:
|
|
789
|
+
* - No HTTP calls (delegates to AXPWorkflowEngine)
|
|
790
|
+
* - No CommandBus / Command execution (delegates to ActivityExecutor)
|
|
791
|
+
* - No workflow branching logic (backend decides)
|
|
792
|
+
* - No business validation (backend validates)
|
|
793
|
+
* - No backend assumptions (uses abstract runtime service)
|
|
794
|
+
*/
|
|
795
|
+
declare class AXPWorkflowManager {
|
|
796
|
+
private readonly workflowEngine;
|
|
797
|
+
private readonly activityExecutor;
|
|
798
|
+
private readonly debug;
|
|
799
|
+
private readonly continuationHook;
|
|
800
|
+
/**
|
|
801
|
+
* Cache workflow states in memory for quick access.
|
|
802
|
+
* Key: instanceId
|
|
803
|
+
* Value: AXPWorkflowInstanceState
|
|
804
|
+
*/
|
|
805
|
+
private stateCache;
|
|
806
|
+
/**
|
|
807
|
+
* Cache TTL in milliseconds (5 minutes).
|
|
808
|
+
*/
|
|
809
|
+
private readonly CACHE_TTL;
|
|
810
|
+
/**
|
|
811
|
+
* Execute frontend activities interactively until reaching workflow-activity:human-task or completion.
|
|
812
|
+
*
|
|
813
|
+
* Interactive = show form/popup immediately (user sees and acts). Only workflow-activity:human-task
|
|
814
|
+
* is not interactive (goes to task board). Other frontend activities (show-layout-popup, show-toast, etc.)
|
|
815
|
+
* even with taskType human-task in definition are executed here.
|
|
816
|
+
*
|
|
817
|
+
* @param instanceId - Workflow instance ID
|
|
818
|
+
* @param task - Current task to execute
|
|
819
|
+
* @param state - Current workflow state
|
|
820
|
+
* @param lastActivityOutput - Last activity output (for expression evaluation)
|
|
821
|
+
* @returns Final result with nextTask (if workflow-activity:human-task) or completion status
|
|
822
|
+
*/
|
|
823
|
+
private executeInteractiveFlow;
|
|
824
|
+
/**
|
|
825
|
+
* Runs inline interactive activities when allowed, with an optional pre-flow continuation prompt.
|
|
826
|
+
*/
|
|
827
|
+
private runInteractiveFlowWithContinuation;
|
|
828
|
+
private invokeWorkflowContinuationAfterStep;
|
|
829
|
+
/**
|
|
830
|
+
* Restores the suspended task-board step when the user declines a pre-interactive continuation prompt.
|
|
831
|
+
*/
|
|
832
|
+
private revertResumeAfterDeclinedInteractiveContinuation;
|
|
833
|
+
/**
|
|
834
|
+
* Start a new workflow instance.
|
|
835
|
+
*
|
|
836
|
+
* Creates a new workflow instance in backend and returns instance ID.
|
|
837
|
+
* Backend decides what to do: returns pendingTask or indicates completion.
|
|
838
|
+
*
|
|
839
|
+
* @param workflowId - Workflow ID to start
|
|
840
|
+
* @param input - Initial input data (optional)
|
|
841
|
+
* @returns Start result with instanceId, state, and nextTask
|
|
842
|
+
*
|
|
843
|
+
* @example
|
|
844
|
+
* ```typescript
|
|
845
|
+
* const result = await workflowManager.start('my-workflow', { userId: '123' });
|
|
846
|
+
*
|
|
847
|
+
* if (result.success && result.nextTask) {
|
|
848
|
+
* // Execute task if frontend
|
|
849
|
+
* if (result.nextTask.executionMode === 'frontend') {
|
|
850
|
+
* const execResult = await workflowManager.execute(result.nextTask);
|
|
851
|
+
* await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);
|
|
852
|
+
* }
|
|
853
|
+
* }
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
start(workflowId: string, input?: Record<string, any>): Promise<WorkflowStartResult>;
|
|
857
|
+
/**
|
|
858
|
+
* Resume a suspended workflow (e.g., after user interaction).
|
|
859
|
+
*
|
|
860
|
+
* Backend determines nextStep based on outcome and outcomeConnections.
|
|
861
|
+
* Client only provides instanceId, stepId, outcome, and optional userInput.
|
|
862
|
+
*
|
|
863
|
+
* @param instanceId - Workflow instance ID
|
|
864
|
+
* @param stepId - Step ID that was waiting for user input
|
|
865
|
+
* @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
|
|
866
|
+
* @param userInput - Optional user input data
|
|
867
|
+
* @param taskToken - Secure task token (required for secure resumption)
|
|
868
|
+
* @returns Resume result with next task (if any)
|
|
869
|
+
*/
|
|
870
|
+
resume(instanceId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowResumeResult>;
|
|
871
|
+
/**
|
|
872
|
+
* Get workflow instance state.
|
|
873
|
+
*
|
|
874
|
+
* Retrieves state from cache (if valid) or from backend.
|
|
875
|
+
*
|
|
876
|
+
* @param instanceId - Workflow instance ID
|
|
877
|
+
* @returns Workflow instance state or null if not found
|
|
878
|
+
*/
|
|
879
|
+
getState(instanceId: string): Promise<AXPWorkflowInstanceState | null>;
|
|
880
|
+
/**
|
|
881
|
+
* Claim a pooled workflow task (assign current user on the bookmark without advancing the workflow).
|
|
882
|
+
* Supported only when the injected workflow engine implements {@link AXPWorkflowEngine.claimTask}.
|
|
883
|
+
*/
|
|
884
|
+
claimTask(instanceId: string, bookmarkId: string, stepId: string): Promise<WorkflowClaimTaskResult>;
|
|
885
|
+
/**
|
|
886
|
+
* Reassign a human-task bookmark to the current user without advancing the workflow.
|
|
887
|
+
* Supported only when the injected workflow engine implements {@link AXPWorkflowEngine.reassignTaskToSelf}.
|
|
888
|
+
*/
|
|
889
|
+
reassignTaskToSelf(instanceId: string, bookmarkId: string, stepId: string): Promise<WorkflowReassignTaskToSelfResult>;
|
|
890
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowManager, never>;
|
|
891
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowManager>;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Local engine implementation that manages workflow progression and state.
|
|
896
|
+
*
|
|
897
|
+
* This engine:
|
|
898
|
+
* - Returns frontend/both activities as pendingTask (does NOT execute them)
|
|
899
|
+
* - Skips backend activities (does not error, continues execution)
|
|
900
|
+
* - Maintains workflow state in memory
|
|
901
|
+
* - Does not require backend API calls
|
|
902
|
+
*
|
|
903
|
+
* Execution of frontend tasks is handled by AXPWorkflowManager via ActivityExecutor.
|
|
904
|
+
* This engine only manages workflow progression and state storage.
|
|
905
|
+
*
|
|
906
|
+
* This is the DEFAULT engine provider. Applications can override it with
|
|
907
|
+
* an API-based engine implementation.
|
|
908
|
+
*/
|
|
909
|
+
declare class AXPWorkflowLocalEngine implements AXPWorkflowEngine {
|
|
910
|
+
private readonly activityDefinitionService;
|
|
911
|
+
private readonly workflowProviders;
|
|
912
|
+
private readonly multiLanguageResolver;
|
|
913
|
+
private readonly debug;
|
|
914
|
+
/**
|
|
915
|
+
* In-memory storage for workflow instances.
|
|
916
|
+
* Key: instanceId
|
|
917
|
+
* Value: LocalWorkflowState
|
|
918
|
+
*/
|
|
919
|
+
private instances;
|
|
920
|
+
/**
|
|
921
|
+
* Task token storage for secure resume operations.
|
|
922
|
+
* Key: taskToken
|
|
923
|
+
* Value: { instanceId, activityId }
|
|
924
|
+
*/
|
|
925
|
+
private taskTokens;
|
|
926
|
+
/**
|
|
927
|
+
* Start a new workflow instance.
|
|
928
|
+
*
|
|
929
|
+
* Creates an in-memory workflow instance and progresses it.
|
|
930
|
+
* Frontend/both activities are returned as pendingTask for external execution.
|
|
931
|
+
* Backend activities are skipped.
|
|
932
|
+
*/
|
|
933
|
+
start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
|
|
934
|
+
/**
|
|
935
|
+
* Resume a suspended workflow instance.
|
|
936
|
+
*
|
|
937
|
+
* Validates task token, applies externally executed result,
|
|
938
|
+
* and continues progressing workflow steps.
|
|
939
|
+
*/
|
|
940
|
+
resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
|
|
941
|
+
/**
|
|
942
|
+
* Get current workflow instance state.
|
|
943
|
+
*/
|
|
944
|
+
getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
|
|
945
|
+
/**
|
|
946
|
+
* Get workflow definition from available providers.
|
|
947
|
+
*/
|
|
948
|
+
private getDefinition;
|
|
949
|
+
/**
|
|
950
|
+
* Progress workflow steps starting from the current position.
|
|
951
|
+
*
|
|
952
|
+
* For frontend/both activities: returns task immediately (suspends workflow).
|
|
953
|
+
* For backend activities: skips and continues.
|
|
954
|
+
*
|
|
955
|
+
* Returns the next pending task (if frontend activity found) or null (if completed).
|
|
956
|
+
*/
|
|
957
|
+
private executeWorkflowSteps;
|
|
958
|
+
/**
|
|
959
|
+
* Get next activity ID based on connections and outcomes.
|
|
960
|
+
*/
|
|
961
|
+
private getNextActivityId;
|
|
962
|
+
frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
|
|
963
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowLocalEngine, never>;
|
|
964
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowLocalEngine>;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Result of executing a workflow activity.
|
|
969
|
+
*/
|
|
970
|
+
interface ActivityExecutionResult {
|
|
971
|
+
/**
|
|
972
|
+
* Activity execution output.
|
|
973
|
+
*/
|
|
974
|
+
output: any;
|
|
975
|
+
/**
|
|
976
|
+
* Activity execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').
|
|
977
|
+
*/
|
|
978
|
+
outcome: string;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Activity Executor Service
|
|
982
|
+
*
|
|
983
|
+
* Service for executing workflow activities via CommandBus.
|
|
984
|
+
* Automatically evaluates expressions in activity inputs before execution.
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* const executor = inject(ActivityExecutor);
|
|
989
|
+
*
|
|
990
|
+
* // Execute activity with task and workflow state (expressions will be evaluated)
|
|
991
|
+
* const result = await executor.execute(task, workflowState, activityOutputs);
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
994
|
+
declare class ActivityExecutor {
|
|
995
|
+
private readonly commandService;
|
|
996
|
+
private readonly expressionEvaluator;
|
|
997
|
+
private readonly expressionScopeService;
|
|
998
|
+
private readonly translateService;
|
|
999
|
+
private readonly debug;
|
|
1000
|
+
/**
|
|
1001
|
+
* Execute a workflow activity with expression evaluation.
|
|
1002
|
+
*
|
|
1003
|
+
* Evaluates expressions in activity inputs using workflow state,
|
|
1004
|
+
* then executes the activity via CommandBus.
|
|
1005
|
+
*
|
|
1006
|
+
* @param task - Workflow task containing activity information
|
|
1007
|
+
* @param workflowState - Current workflow instance state (for expression evaluation)
|
|
1008
|
+
* @param activityOutputs - Map of previous activity outputs (for expression evaluation)
|
|
1009
|
+
* @returns Execution result with output and outcome
|
|
1010
|
+
*/
|
|
1011
|
+
execute(task: AXPWorkflowTask, workflowState?: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): Promise<ActivityExecutionResult>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Resolves command failure message text for workflow output: `@` keys via translate, MLS maps via resolve.
|
|
1014
|
+
*/
|
|
1015
|
+
private resolveCommandMessageTextForError;
|
|
1016
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ActivityExecutor, never>;
|
|
1017
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ActivityExecutor>;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Workflow expression evaluation context.
|
|
1022
|
+
* Contains workflow state data needed for expression evaluation.
|
|
1023
|
+
*/
|
|
1024
|
+
interface WorkflowExpressionContext {
|
|
1025
|
+
/** Workflow input values */
|
|
1026
|
+
inputs: Record<string, any>;
|
|
1027
|
+
/** Workflow state variables */
|
|
1028
|
+
variables: Record<string, any>;
|
|
1029
|
+
/** Previous activity outputs (activityId -> output) */
|
|
1030
|
+
outputs: Record<string, any>;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Workflow Expression Scope Service
|
|
1034
|
+
*
|
|
1035
|
+
* Shared service for building expression evaluation scope from workflow data.
|
|
1036
|
+
* Used by both Local Engine and Mock Runtime to manage workflow data (inputs, variables, outputs).
|
|
1037
|
+
*
|
|
1038
|
+
* Responsibilities:
|
|
1039
|
+
* - Build expression evaluation scope from workflow state
|
|
1040
|
+
* - Provide context.eval() function for accessing workflow data
|
|
1041
|
+
* - Manage workflow data structure (inputs, variables, outputs)
|
|
1042
|
+
*
|
|
1043
|
+
* This service does NOT:
|
|
1044
|
+
* - Execute activities
|
|
1045
|
+
* - Evaluate expressions (delegates to AXPExpressionEvaluatorService)
|
|
1046
|
+
* - Manage workflow state (handled by runtime)
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* ```typescript
|
|
1050
|
+
* const scopeService = inject(WorkflowExpressionScopeService);
|
|
1051
|
+
*
|
|
1052
|
+
* // Build scope from workflow state
|
|
1053
|
+
* const scope = scopeService.buildScope({
|
|
1054
|
+
* inputs: state.input || {},
|
|
1055
|
+
* variables: state.variables || {},
|
|
1056
|
+
* outputs: activityOutputs
|
|
1057
|
+
* });
|
|
1058
|
+
*
|
|
1059
|
+
* // Or build from state directly
|
|
1060
|
+
* const scope = scopeService.buildScopeFromState(state, activityOutputs);
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
declare class WorkflowExpressionScopeService {
|
|
1064
|
+
private readonly contextEvalFactory;
|
|
1065
|
+
/**
|
|
1066
|
+
* Collect dot-notation key-value pairs from nested objects so that e.g.
|
|
1067
|
+
* { metadata: { "metadata.questionnaire.id": "x" } } becomes { "metadata.questionnaire.id": "x" } at root.
|
|
1068
|
+
* Top-level non-dot keys are kept as-is.
|
|
1069
|
+
*/
|
|
1070
|
+
private flattenDotKeysFromTree;
|
|
1071
|
+
/**
|
|
1072
|
+
* Expand flat keys with dots into nested objects.
|
|
1073
|
+
* e.g. { "metadata.questionnaire.id": "x" } -> { metadata: { questionnaire: { id: "x" } } }.
|
|
1074
|
+
*/
|
|
1075
|
+
private expandDotKeys;
|
|
1076
|
+
/**
|
|
1077
|
+
* Normalize workflow input so that flat dot-notation keys (e.g. from form schema
|
|
1078
|
+
* "metadata.questionnaire.id") become nested for expression access (inputs.metadata.questionnaire.id).
|
|
1079
|
+
*/
|
|
1080
|
+
private normalizeInputs;
|
|
1081
|
+
/**
|
|
1082
|
+
* Build expression evaluation scope for workflow activities.
|
|
1083
|
+
*
|
|
1084
|
+
* Provides workflow-specific data (inputs, variables, outputs) and context.eval() function.
|
|
1085
|
+
* Other data (session, current user, etc.) are provided by expression evaluator scope providers.
|
|
1086
|
+
*
|
|
1087
|
+
* Scope includes:
|
|
1088
|
+
* - inputs: Workflow input values (accessible as inputs.propertyName)
|
|
1089
|
+
* - variables: Workflow state variables (accessible as variables.propertyName or vars.propertyName)
|
|
1090
|
+
* - outputs: Previous activity outputs (accessible as outputs.activityId)
|
|
1091
|
+
* - context.eval(path): Function to access nested properties from workflow data
|
|
1092
|
+
*
|
|
1093
|
+
* Expressions can use:
|
|
1094
|
+
* - {{inputs.userName}} - Direct access to workflow input
|
|
1095
|
+
* - {{variables.someVar}} or {{vars.someVar}} - Direct access to workflow variable
|
|
1096
|
+
* - {{outputs.activityId.property}} - Direct access to previous activity output
|
|
1097
|
+
* - {{context.eval("inputs.userName")}} - Access via context.eval (supports nested paths)
|
|
1098
|
+
* - {{context.eval("variables.someVar")}} - Access variables via context.eval
|
|
1099
|
+
* - {{context.eval("outputs.activityId.property")}} - Access outputs via context.eval
|
|
1100
|
+
* - {{session.currentUser().name}} - Access current user via expression evaluator scope providers
|
|
1101
|
+
*
|
|
1102
|
+
* The context.eval() function provides a unified way to access all workflow data,
|
|
1103
|
+
* similar to how entity-detail-list uses context.eval() to access parent data.
|
|
1104
|
+
*
|
|
1105
|
+
* @param context - Workflow expression context containing inputs, variables, and outputs
|
|
1106
|
+
* @returns Expression evaluator scope with workflow data and context.eval() function
|
|
1107
|
+
*/
|
|
1108
|
+
buildScope(context: WorkflowExpressionContext): AXPExpressionEvaluatorScope;
|
|
1109
|
+
/**
|
|
1110
|
+
* Build expression evaluation scope from workflow instance state.
|
|
1111
|
+
*
|
|
1112
|
+
* Convenience method that extracts data from AXPWorkflowInstanceState.
|
|
1113
|
+
*
|
|
1114
|
+
* @param state - Workflow instance state
|
|
1115
|
+
* @param activityOutputs - Map of activity outputs (activityId -> output)
|
|
1116
|
+
* @returns Expression evaluator scope with workflow data and context.eval() function
|
|
1117
|
+
*/
|
|
1118
|
+
buildScopeFromState(state: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): AXPExpressionEvaluatorScope;
|
|
1119
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowExpressionScopeService, never>;
|
|
1120
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowExpressionScopeService>;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/** Context passed after a workflow step completes (resume, start, or interactive chain). */
|
|
1124
|
+
interface AXPWorkflowContinuationStepContext {
|
|
1125
|
+
instanceId: string;
|
|
1126
|
+
/** Consumed bookmark id from the task board (when known). */
|
|
1127
|
+
completedBookmarkId?: string;
|
|
1128
|
+
/** Activity id that just completed (human-task or interactive step). */
|
|
1129
|
+
completedActivityId?: string;
|
|
1130
|
+
/** Resume outcome that completed the step (e.g. start-fill, Submitted, Saved). */
|
|
1131
|
+
resumeOutcome?: string;
|
|
1132
|
+
/** Next pending task returned by the engine / workflow manager (when known). */
|
|
1133
|
+
pendingNextTask?: AXPWorkflowTask | null;
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Result of a continuation prompt in the current start/resume cycle.
|
|
1137
|
+
* Used by {@link AXPWorkflowManager} to avoid duplicate dialogs in the same cycle.
|
|
1138
|
+
*/
|
|
1139
|
+
type AXPWorkflowContinuationOfferResult = 'not-offered' | 'confirmed' | 'declined';
|
|
1140
|
+
/**
|
|
1141
|
+
* Optional hook: offer the current user to continue to the next workflow step.
|
|
1142
|
+
* Implemented by workflow-management (task board UX); invoked from {@link AXPWorkflowManager}.
|
|
1143
|
+
*/
|
|
1144
|
+
interface AXPWorkflowContinuationHook {
|
|
1145
|
+
/**
|
|
1146
|
+
* Before running an inline interactive activity chain (sign-off, forms, etc.).
|
|
1147
|
+
* Return `declined` to skip executing that chain in this resume/start call.
|
|
1148
|
+
*/
|
|
1149
|
+
offerBeforeInteractiveFlow?(context: AXPWorkflowContinuationStepContext): Promise<AXPWorkflowContinuationOfferResult>;
|
|
1150
|
+
/** After resume/start when the next human-task is on the task board, or no before-offer ran. */
|
|
1151
|
+
offerAfterWorkflowStep?(context: AXPWorkflowContinuationStepContext): Promise<AXPWorkflowContinuationOfferResult | void>;
|
|
1152
|
+
}
|
|
1153
|
+
declare const AXP_WORKFLOW_CONTINUATION_HOOK: InjectionToken<AXPWorkflowContinuationHook>;
|
|
1154
|
+
/** When true on resume `userInput`, skips the post-step continuation dialog (auto-advance). */
|
|
1155
|
+
declare const AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY = "_suppressWorkflowContinuation";
|
|
1156
|
+
declare function isWorkflowContinuationSuppressed(userInput: unknown): boolean;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Frontend step executed inline (dialog/popup), not suspended on the task board.
|
|
1160
|
+
* Derived from execution mode and task-board activity types — no per-activity hardcoding.
|
|
1161
|
+
*/
|
|
1162
|
+
declare function axpIsWorkflowInlineFrontendTask(task: AXPWorkflowTask | null | undefined): boolean;
|
|
1163
|
+
/** @deprecated Use {@link axpIsWorkflowInlineFrontendTask}. */
|
|
1164
|
+
declare function axpIsWorkflowInteractiveFrontendTask(task: AXPWorkflowTask | null | undefined): boolean;
|
|
1165
|
+
/** Resolved before-interactive behavior from task metadata (set by engine from activity definition). */
|
|
1166
|
+
declare function axpResolveWorkflowContinuationBeforeInteractive(task: AXPWorkflowTask | null | undefined): AXPWorkflowContinuationBeforeInteractive;
|
|
1167
|
+
/**
|
|
1168
|
+
* Whether to skip the pre-interactive "continue?" prompt based on activity metadata.
|
|
1169
|
+
* Assignee-specific rules are applied in workflow-management (needs session).
|
|
1170
|
+
*/
|
|
1171
|
+
declare function axpShouldSkipBeforeInteractiveFromMetadata(behavior: AXPWorkflowContinuationBeforeInteractive, completedWasHumanTask: boolean): boolean;
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether to show a "continue?" prompt before running inline frontend activities.
|
|
1174
|
+
* Skips when the user already resumed a task-board step (primary action / resume).
|
|
1175
|
+
*/
|
|
1176
|
+
declare function axpShouldOfferBeforeInteractiveFlow(context: AXPWorkflowContinuationStepContext): boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* Whether the workflow advanced enough to consider a continuation prompt.
|
|
1179
|
+
* Includes pending interactive steps when inbox bookmarks are already consumed.
|
|
1180
|
+
*/
|
|
1181
|
+
declare function axpShouldOfferWorkflowContinuationAfterStep(context: AXPWorkflowContinuationStepContext, activeBookmarkActivityIds: string[]): boolean;
|
|
1182
|
+
|
|
1183
|
+
type AXPWorkflowProviderToken = AXPWorkflowProvider | Promise<AXPWorkflowProvider>;
|
|
1184
|
+
declare const AXP_WORKFLOW_PROVIDER: InjectionToken<AXPWorkflowProviderToken[]>;
|
|
1185
|
+
interface AXPWorkflowProvider {
|
|
1186
|
+
/**
|
|
1187
|
+
* Get list of workflow definitions for a category.
|
|
1188
|
+
* @param categoryId - Category ID to filter workflows
|
|
1189
|
+
* @returns Promise of workflow definition array
|
|
1190
|
+
*/
|
|
1191
|
+
getList(categoryId: string): Promise<AXPWorkflowDefinition[]>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Get full workflow definition by name (unique identifier).
|
|
1194
|
+
* Used by workflow engines for execution and UI for metadata.
|
|
1195
|
+
* @param name - Workflow name (unique identifier)
|
|
1196
|
+
* @returns Promise of full workflow definition or null if not found
|
|
1197
|
+
*/
|
|
1198
|
+
getByName(name: string): Promise<AXPWorkflowDefinition | null>;
|
|
1199
|
+
}
|
|
1200
|
+
type AXPWorkflowCategoryProviderToken = AXPWorkflowCategoryProvider | Promise<AXPWorkflowCategoryProvider>;
|
|
1201
|
+
declare const AXP_WORKFLOW_CATEGORY_PROVIDER: InjectionToken<AXPWorkflowCategoryProviderToken[]>;
|
|
1202
|
+
interface AXPWorkflowCategoryProvider {
|
|
1203
|
+
getList(parentId?: string): Promise<AXPWorkflowCategory[]>;
|
|
1204
|
+
getById(id: string): Promise<AXPWorkflowCategory | undefined>;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Optimized Workflow Definition Service
|
|
1209
|
+
*
|
|
1210
|
+
* Manages workflow definitions (metadata) for UI and tooling.
|
|
1211
|
+
* Similar to AXPActivityDefinitionService - only handles metadata, not execution.
|
|
1212
|
+
*
|
|
1213
|
+
* Performance optimizations:
|
|
1214
|
+
* 1. Uses childrenCount to determine if category has children (no query needed)
|
|
1215
|
+
* 2. Uses itemsCount to determine if category has workflows (no query needed)
|
|
1216
|
+
* 3. Aggressive caching prevents duplicate API calls
|
|
1217
|
+
* 4. Single pending request per resource prevents race conditions
|
|
1218
|
+
* 5. Lazy loading - only loads data when needed
|
|
1219
|
+
*/
|
|
1220
|
+
declare class AXPWorkflowDefinitionService {
|
|
1221
|
+
private readonly categoryProviders;
|
|
1222
|
+
private readonly workflowProviders;
|
|
1223
|
+
/** Cache for categories by id - O(1) lookup */
|
|
1224
|
+
private categoriesById;
|
|
1225
|
+
/** Cache for categories by parentId - O(1) lookup */
|
|
1226
|
+
private categoriesByParentId;
|
|
1227
|
+
/** Cache for workflow definitions by categoryId - O(1) lookup */
|
|
1228
|
+
private workflowsByCategory;
|
|
1229
|
+
/** Cache for individual workflow definitions by name - O(1) lookup */
|
|
1230
|
+
private workflowsByName;
|
|
1231
|
+
/** Track which provider index owns each category (by category ID) */
|
|
1232
|
+
private categoryOwnership;
|
|
1233
|
+
/** Pending API requests to prevent duplicate calls */
|
|
1234
|
+
private pendingCategoriesRequests;
|
|
1235
|
+
private pendingWorkflowsRequests;
|
|
1236
|
+
private pendingWorkflowRequests;
|
|
1237
|
+
/**
|
|
1238
|
+
* Get categories by parentId with aggressive caching
|
|
1239
|
+
*
|
|
1240
|
+
* Optimization: Returns cached result immediately if available,
|
|
1241
|
+
* preventing unnecessary API calls during navigation
|
|
1242
|
+
*
|
|
1243
|
+
* @param parentId - Parent category ID (undefined = root categories)
|
|
1244
|
+
* @returns Array of categories with count metadata (childrenCount, itemsCount)
|
|
1245
|
+
*/
|
|
1246
|
+
getCategories(parentId?: string): Promise<AXPWorkflowCategory[]>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Get single category by ID with O(1) lookup
|
|
1249
|
+
*
|
|
1250
|
+
* Optimization: Uses Map for instant retrieval, falls back to
|
|
1251
|
+
* searching cache, then providers if not found
|
|
1252
|
+
*/
|
|
1253
|
+
getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined>;
|
|
1254
|
+
/**
|
|
1255
|
+
* Get category path from root to specified category
|
|
1256
|
+
*
|
|
1257
|
+
* Optimization: Builds path using cached categories only
|
|
1258
|
+
*/
|
|
1259
|
+
getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get workflow definitions for a category with smart caching
|
|
1262
|
+
*
|
|
1263
|
+
* Optimization: Checks itemsCount before querying
|
|
1264
|
+
* - If itemsCount = 0, returns empty array (no API call)
|
|
1265
|
+
* - If itemsCount > 0, loads and caches workflow definitions
|
|
1266
|
+
* - Returns cached result on subsequent calls
|
|
1267
|
+
*
|
|
1268
|
+
* @param categoryId - Category ID to get workflow definitions from
|
|
1269
|
+
* @returns Array of workflow definitions
|
|
1270
|
+
*/
|
|
1271
|
+
getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinition[]>;
|
|
1272
|
+
/**
|
|
1273
|
+
* Get single workflow definition by name with O(1) lookup
|
|
1274
|
+
*
|
|
1275
|
+
* Optimization: Uses Map for instant retrieval
|
|
1276
|
+
*
|
|
1277
|
+
* @param name - Workflow name (unique identifier)
|
|
1278
|
+
* @returns Workflow definition or undefined if not found
|
|
1279
|
+
*/
|
|
1280
|
+
getWorkflowByName(name: string): Promise<AXPWorkflowDefinition | undefined>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Get category ID containing a specific workflow definition
|
|
1283
|
+
*
|
|
1284
|
+
* Optimization: Searches cache first, loads on-demand if needed
|
|
1285
|
+
*/
|
|
1286
|
+
getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined>;
|
|
1287
|
+
/**
|
|
1288
|
+
* Get category path for a workflow
|
|
1289
|
+
*/
|
|
1290
|
+
getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Load categories from providers and cache results
|
|
1293
|
+
*
|
|
1294
|
+
* Optimization: Tracks provider ownership to avoid unnecessary API calls
|
|
1295
|
+
* - For root (parentId = undefined): Query ALL providers
|
|
1296
|
+
* - For children: Only query the provider that owns the parent
|
|
1297
|
+
*/
|
|
1298
|
+
private loadCategoriesFromProviders;
|
|
1299
|
+
/**
|
|
1300
|
+
* Get the provider index that owns a specific category
|
|
1301
|
+
*
|
|
1302
|
+
* @returns Array with provider index, or null if ownership unknown (query all)
|
|
1303
|
+
*/
|
|
1304
|
+
private getProviderIndexForCategory;
|
|
1305
|
+
/**
|
|
1306
|
+
* Load workflow definitions from providers and cache results
|
|
1307
|
+
*
|
|
1308
|
+
* Optimization: Only queries the provider that owns the category
|
|
1309
|
+
* Uses provider INDEX to match category provider with workflow provider
|
|
1310
|
+
*/
|
|
1311
|
+
private loadWorkflowsFromProviders;
|
|
1312
|
+
/**
|
|
1313
|
+
* Load single workflow definition from providers and cache result
|
|
1314
|
+
*/
|
|
1315
|
+
private loadWorkflowFromProviders;
|
|
1316
|
+
/**
|
|
1317
|
+
* Breadth-first search through category hierarchy
|
|
1318
|
+
*/
|
|
1319
|
+
private searchCategoryInHierarchy;
|
|
1320
|
+
/**
|
|
1321
|
+
* Check if category has children (uses cached count)
|
|
1322
|
+
*/
|
|
1323
|
+
categoryHasChildren(categoryId: string): boolean;
|
|
1324
|
+
/**
|
|
1325
|
+
* Check if category has workflows (uses cached count)
|
|
1326
|
+
*/
|
|
1327
|
+
categoryHasWorkflows(categoryId: string): boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* Clear all caches
|
|
1330
|
+
*/
|
|
1331
|
+
clearAllCache(): void;
|
|
1332
|
+
/**
|
|
1333
|
+
* Clear categories cache only
|
|
1334
|
+
*/
|
|
1335
|
+
clearCategoriesCache(): void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Clear workflows cache only
|
|
1338
|
+
*/
|
|
1339
|
+
clearWorkflowsCache(): void;
|
|
1340
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionService, never>;
|
|
1341
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionService>;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionService, AXPWorkflowEngineError, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowFunction, AXPWorkflowLocalEngine, AXPWorkflowManager, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_CONTINUATION_HOOK, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_ERROR_CODES, AXP_WORKFLOW_PROVIDER, AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY, AXP_WORKFLOW_TASK_BOARD_ACTIVITY_TYPES, ActivityExecutor, WorkflowExpressionScopeService, axpIsWorkflowInlineFrontendTask, axpIsWorkflowInteractiveFrontendTask, axpIsWorkflowTaskBoardActivityType, axpResolveWorkflowContinuationBeforeInteractive, axpShouldOfferBeforeInteractiveFlow, axpShouldOfferWorkflowContinuationAfterStep, axpShouldSkipBeforeInteractiveFromMetadata, createWorkFlowEvent, getWorkflowEngineErrorCode, getWorkflowEngineErrorInfo, isWorkflowContinuationSuppressed, ofType };
|
|
1345
|
+
export type { AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityProvider, AXPActivityProviderToken, AXPClaimWorkflowTaskRequest, AXPClaimWorkflowTaskResponse, AXPFrontActivityCompleteRequest, AXPFrontActivityCompleteResponse, AXPGetWorkflowStateRequest, AXPReassignWorkflowTaskToSelfRequest, AXPReassignWorkflowTaskToSelfResponse, AXPResumeWorkflowRequest, AXPResumeWorkflowResponse, AXPRevertResumeAfterDeclinedInteractiveContinuationRequest, AXPRevertResumeAfterDeclinedInteractiveContinuationResponse, AXPStartWorkflowRequest, AXPStartWorkflowResponse, AXPWorkflow, AXPWorkflowActionInput, AXPWorkflowCategoryProvider, AXPWorkflowCategoryProviderToken, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowContinuationHook, AXPWorkflowContinuationOfferResult, AXPWorkflowContinuationStepContext, AXPWorkflowEngine, AXPWorkflowErrorCode, AXPWorkflowEvent, AXPWorkflowInstanceState, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowProvider, AXPWorkflowProviderToken, AXPWorkflowStep, AXPWorkflowTask, ActivityExecutionResult, WorkflowClaimTaskResult, WorkflowCompleteResult, WorkflowExpressionContext, WorkflowReassignTaskToSelfResult, WorkflowResumeResult, WorkflowStartResult };
|