@acorex/platform 21.0.0-next.3 → 21.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/auth/index.d.ts +6 -6
  2. package/common/index.d.ts +10 -5
  3. package/core/index.d.ts +55 -315
  4. package/fesm2022/acorex-platform-auth.mjs +18 -22
  5. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-common.mjs +62 -38
  7. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-core.mjs +150 -246
  9. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-builder.mjs +11 -2
  11. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-components.mjs +3 -3
  13. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-entity.mjs +67 -83
  15. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-layout-widget-core.mjs +110 -33
  17. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-layout-widgets.mjs +19 -11
  19. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  20. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs → acorex-platform-themes-default-entity-master-list-view.component-DfJEx_bs.mjs} +2 -2
  21. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DfJEx_bs.mjs.map +1 -0
  22. package/fesm2022/acorex-platform-themes-default.mjs +2 -2
  23. package/fesm2022/acorex-platform-workflow.mjs +1268 -1699
  24. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  25. package/layout/builder/index.d.ts +6 -0
  26. package/layout/entity/index.d.ts +2 -9
  27. package/layout/widget-core/index.d.ts +42 -4
  28. package/package.json +5 -5
  29. package/workflow/index.d.ts +650 -1074
  30. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +0 -1
@@ -2,12 +2,9 @@ import * as rxjs from 'rxjs';
2
2
  import { Observable } from 'rxjs';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Type, ModuleWithProviders, Injector, InjectionToken } from '@angular/core';
5
- import { AXPCommand } from '@acorex/platform/runtime';
6
- import * as _acorex_platform_core from '@acorex/platform/core';
7
- import { AXPExecuteCommandResult, AXPValidationRules, AXPActionMenuItem } from '@acorex/platform/core';
8
- import { AXPWidgetTypesMap, AXPWidgetNode } from '@acorex/platform/layout/widget-core';
9
- import { AXStyleColorType } from '@acorex/cdk/common';
10
- import { AXPopupSizeType } from '@acorex/components/popup';
5
+ import { AXPCommand, AXPExecuteCommandResultPromise } from '@acorex/platform/runtime';
6
+ import { AXPCategoryEntity, AXPValidationRules } from '@acorex/platform/core';
7
+ import { AXPWidgetTypesMap } from '@acorex/platform/layout/widget-core';
11
8
 
12
9
  declare class AXPWorkflowError extends Error {
13
10
  inner: Error | null;
@@ -117,7 +114,6 @@ interface AXPWorkflowModuleConfigs {
117
114
  };
118
115
  }
119
116
  declare class AXPWorkflowModule {
120
- private _commandSetup;
121
117
  static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
122
118
  static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
123
119
  /**
@@ -407,7 +403,7 @@ interface AXPCustomProperties {
407
403
  * Matches Activity from workflow definition schema.
408
404
  * Note: This is the workflow definition format, not the frontend Activity class.
409
405
  */
410
- interface AXPActivity {
406
+ interface AXPActivity$1 {
411
407
  /**
412
408
  * Activity ID.
413
409
  */
@@ -435,7 +431,7 @@ interface AXPActivity {
435
431
  * - 'backend': Execute in backend (business logic, database operations, API calls)
436
432
  * - 'both': Execute in both frontend and backend (hybrid activities)
437
433
  *
438
- * If not specified, falls back to ActivityDescriptor's executionMode.
434
+ * If not specified, falls back to AXPActivity's executionMode.
439
435
  * This allows per-instance override of the default execution mode.
440
436
  *
441
437
  * @example
@@ -465,7 +461,7 @@ interface AXPActivity {
465
461
  * Flowchart activity (workflow definition format).
466
462
  * This is the root activity that contains all other activities.
467
463
  */
468
- interface AXPFlowchart extends AXPActivity {
464
+ interface AXPFlowchart extends AXPActivity$1 {
469
465
  /**
470
466
  * Type must be "workflow-activity:flowchart".
471
467
  */
@@ -473,7 +469,7 @@ interface AXPFlowchart extends AXPActivity {
473
469
  /**
474
470
  * Activities in this flowchart.
475
471
  */
476
- activities: AXPActivity[];
472
+ activities: AXPActivity$1[];
477
473
  /**
478
474
  * Variables in this flowchart.
479
475
  */
@@ -633,99 +629,11 @@ interface AXPWorkflowDefinitionLoader {
633
629
  */
634
630
  getAllNames?(): Promise<string[]>;
635
631
  }
636
- /**
637
- * Workflow definition preloader interface.
638
- * Implement this to provide a list of workflow definitions that should be preloaded.
639
- */
640
- interface AXPWorkflowDefinitionPreloader {
641
- /**
642
- * Get list of workflow definition IDs to preload.
643
- * @returns Array of definition IDs
644
- */
645
- preload(): string[];
646
- }
647
632
  /**
648
633
  * Injection token for workflow definition loaders.
649
634
  * Multiple loaders can be provided (multi: true).
650
635
  */
651
636
  declare const AXP_WORKFLOW_DEFINITION_LOADER: InjectionToken<AXPWorkflowDefinitionLoader>;
652
- /**
653
- * Resolver service for workflow definitions.
654
- * Aggregates all registered loaders and resolves workflow definitions.
655
- */
656
- declare class AXPWorkflowDefinitionResolver {
657
- private loaders;
658
- /**
659
- * Get workflow definition by name (unique key).
660
- * Tries all registered loaders until one returns a definition.
661
- * @param name - The workflow name (unique key)
662
- * @returns Workflow definition or null if not found
663
- */
664
- get(name: string): Promise<AXPWorkflowDefinition | null>;
665
- /**
666
- * Get all available workflow names from all loaders.
667
- * @returns Array of unique workflow names
668
- */
669
- getAllNames(): Promise<string[]>;
670
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionResolver, never>;
671
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionResolver>;
672
- }
673
-
674
- /**
675
- * Registry service for workflow definitions.
676
- * Caches loaded definitions and provides change notifications.
677
- */
678
- declare class AXPWorkflowDefinitionRegistryService {
679
- private resolver;
680
- private cache;
681
- private onChanged;
682
- /**
683
- * Observable for workflow definition changes.
684
- */
685
- get onChanged$(): rxjs.Observable<{
686
- name: string;
687
- action: "registered" | "updated" | "removed";
688
- }>;
689
- /**
690
- * Get workflow definition by name (unique key).
691
- * Uses cache if available, otherwise loads from resolver.
692
- * @param name - The workflow name (unique key)
693
- * @returns Workflow definition or null if not found
694
- */
695
- get(name: string): Promise<AXPWorkflowDefinition | null>;
696
- /**
697
- * Register a workflow definition in the cache.
698
- * @param definition - The workflow definition to register
699
- */
700
- register(definition: AXPWorkflowDefinition): void;
701
- /**
702
- * Update a workflow definition in the cache.
703
- * @param definition - The updated workflow definition
704
- */
705
- update(definition: AXPWorkflowDefinition): void;
706
- /**
707
- * Remove a workflow definition from the cache.
708
- * @param name - The workflow name to remove
709
- */
710
- remove(name: string): void;
711
- /**
712
- * Clear all cached workflow definitions.
713
- */
714
- clear(): void;
715
- /**
716
- * Check if a workflow definition is cached.
717
- * @param definitionId - The workflow definition ID
718
- * @returns True if cached, false otherwise
719
- */
720
- has(definitionId: string): boolean;
721
- /**
722
- * Get all cached workflow definition IDs.
723
- * @returns Array of definition IDs (only those that have been loaded)
724
- */
725
- getAllIds(): string[];
726
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionRegistryService, never>;
727
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionRegistryService>;
728
- }
729
637
 
730
638
  /**
731
639
  * Workflow status.
@@ -1090,73 +998,44 @@ interface AXPWorkflowInstance {
1090
998
  finishedAt?: string | null;
1091
999
  }
1092
1000
 
1001
+ /**
1002
+ * Activity Category - Extends AXPCategoryEntity for consistency and performance
1003
+ *
1004
+ * Inherited properties from AXPCategoryEntity:
1005
+ * - id: string - Unique identifier
1006
+ * - title: string - Display name
1007
+ * - description?: string - Category description
1008
+ * - parentId?: string - Parent category ID
1009
+ * - childrenCount: number - Direct child categories count (enables lazy loading)
1010
+ * - itemsCount?: number - Direct activities count
1011
+ * - totalChildren?: number - Total nested categories (optional, for analytics)
1012
+ * - totalItems?: number - Total activities in tree (optional, for analytics)
1013
+ */
1014
+ interface AXPActivityCategory extends AXPCategoryEntity {
1015
+ }
1093
1016
  interface ActivityPropertyWidget {
1094
1017
  type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
1095
1018
  options?: Record<string, any>;
1096
1019
  }
1097
1020
  /**
1098
- * Simple activity interface - just a command with outcomes.
1099
- * All activities are AXPCommand for unified execution through Command Bus.
1100
- */
1101
- interface IActivity<TInput = any, TOutput = any> extends AXPCommand<TInput, {
1102
- output: TOutput;
1103
- outcomes: Record<string, any>;
1104
- }> {
1105
- /**
1106
- * Activity type name.
1107
- * Example: "WriteLine", "ShowDialog", "CreateUserCommand"
1108
- */
1109
- type: string;
1110
- /**
1111
- * Display name for UI.
1112
- */
1113
- name?: string;
1114
- /**
1115
- * Execute the activity as a command.
1116
- * @param input - Activity input data
1117
- * @returns Promise with output and outcomes
1118
- */
1119
- execute(input: TInput): Promise<AXPExecuteCommandResult<{
1120
- output: TOutput;
1121
- outcomes: Record<string, any>;
1122
- }>>;
1123
- }
1124
- /**
1125
- * Base abstract class for activities.
1126
- * Extend this to create custom activities.
1021
+ * Activity Definition - Metadata for UI and tooling.
1022
+ * Contains all metadata needed for displaying activities in toolbox and designer.
1023
+ * The `name` property is used as the command key for execution.
1127
1024
  */
1128
- declare abstract class Activity<TInput = any, TOutput = any> implements IActivity<TInput, TOutput> {
1129
- type: string;
1130
- name?: string;
1131
- constructor(type: string, name?: string);
1025
+ interface AXPActivityDefinition {
1132
1026
  /**
1133
- * Execute the activity as a command.
1134
- * Override this method in subclasses to implement activity logic.
1027
+ * Activity name - used as command key for execution.
1028
+ * This is the unique identifier for the activity.
1135
1029
  */
1136
- abstract execute(input: TInput): Promise<AXPExecuteCommandResult<{
1137
- output: TOutput;
1138
- outcomes: Record<string, any>;
1139
- }>>;
1140
- /**
1141
- * Helper method that returns Done outcome by default.
1142
- */
1143
- protected createResult(output: TOutput, outcome?: string): AXPExecuteCommandResult<{
1144
- output: TOutput;
1145
- outcomes: Record<string, any>;
1146
- }>;
1147
- }
1148
- /**
1149
- * Activity descriptor - metadata about an activity type.
1150
- */
1151
- interface ActivityDescriptor {
1030
+ name: string;
1152
1031
  /**
1153
- * Activity type name.
1032
+ * Activity type (e.g., "workflow-activity:check-permission").
1154
1033
  */
1155
1034
  type: string;
1156
1035
  /**
1157
1036
  * Display name for UI.
1158
1037
  */
1159
- displayName: string;
1038
+ title?: string;
1160
1039
  /**
1161
1040
  * Description of what the activity does.
1162
1041
  */
@@ -1164,7 +1043,7 @@ interface ActivityDescriptor {
1164
1043
  /**
1165
1044
  * Category for grouping in toolbox.
1166
1045
  */
1167
- category: string;
1046
+ category?: string;
1168
1047
  /**
1169
1048
  * Icon name or class.
1170
1049
  */
@@ -1181,11 +1060,11 @@ interface ActivityDescriptor {
1181
1060
  /**
1182
1061
  * Input descriptors.
1183
1062
  */
1184
- inputs: InputDescriptor[];
1063
+ inputs?: InputDescriptor[];
1185
1064
  /**
1186
1065
  * Output descriptors.
1187
1066
  */
1188
- outputs: OutputDescriptor[];
1067
+ outputs?: OutputDescriptor[];
1189
1068
  /**
1190
1069
  * Static outcomes (exit points).
1191
1070
  * Example: ['Done', 'Success', 'Failed']
@@ -1202,6 +1081,25 @@ interface ActivityDescriptor {
1202
1081
  */
1203
1082
  isContainer?: boolean;
1204
1083
  }
1084
+ /**
1085
+ * Activity - Command with specific TResult structure.
1086
+ * Extends AXPCommand with a fixed TResult that includes output and outcomes.
1087
+ * No additional properties beyond AXPCommand - pure command interface.
1088
+ */
1089
+ interface AXPActivity<TInput = any, TOutput = any> extends AXPCommand<TInput, {
1090
+ output: TOutput;
1091
+ outcomes: Record<string, any>;
1092
+ }> {
1093
+ /**
1094
+ * Execute the activity as a command.
1095
+ * @param input - Activity input data
1096
+ * @returns Promise with output and outcomes
1097
+ */
1098
+ execute(input: TInput): AXPExecuteCommandResultPromise<{
1099
+ output: TOutput;
1100
+ outcomes: Record<string, any>;
1101
+ }>;
1102
+ }
1205
1103
  /**
1206
1104
  * Input property descriptor.
1207
1105
  * Similar to AXPEntityProperty structure.
@@ -1231,164 +1129,168 @@ interface OutputDescriptor {
1231
1129
  dataType: string;
1232
1130
  };
1233
1131
  }
1132
+
1133
+ type AXPActivityProviderToken = AXPActivityProvider | Promise<AXPActivityProvider>;
1134
+ declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProviderToken[]>;
1135
+ interface AXPActivityProvider {
1136
+ /**
1137
+ * Get list of activity definitions for a category.
1138
+ * @param categoryId - Category ID to filter activities
1139
+ * @returns Promise of activity definitions array
1140
+ */
1141
+ getList(categoryId: string): Promise<AXPActivityDefinition[]>;
1142
+ /**
1143
+ * Get activity definition by name (unique identifier).
1144
+ * The name is used as the command key for execution.
1145
+ * @param name - Activity name (unique identifier and command key)
1146
+ * @returns Promise of activity definition or undefined if not found
1147
+ */
1148
+ getById(name: string): Promise<AXPActivityDefinition | undefined>;
1149
+ }
1150
+ type AXPActivityCategoryProviderToken = AXPActivityCategoryProvider | Promise<AXPActivityCategoryProvider>;
1151
+ declare const AXP_ACTIVITY_CATEGORY_PROVIDER: InjectionToken<AXPActivityCategoryProviderToken[]>;
1152
+ interface AXPActivityCategoryProvider {
1153
+ getList(parentId?: string): Promise<AXPActivityCategory[]>;
1154
+ getById(id: string): Promise<AXPActivityCategory | undefined>;
1155
+ }
1156
+
1234
1157
  /**
1235
- * Activity registry for registering and creating activities.
1236
- */
1237
- declare class ActivityRegistry {
1238
- private registry;
1239
- private descriptors;
1158
+ * Optimized Activity Definition Service
1159
+ *
1160
+ * Manages activity definitions (metadata) for UI and tooling.
1161
+ * Similar to AXPReportDefinitionService - only handles metadata, not execution.
1162
+ *
1163
+ * Performance optimizations:
1164
+ * 1. Uses childrenCount to determine if category has children (no query needed)
1165
+ * 2. Uses itemsCount to determine if category has activities (no query needed)
1166
+ * 3. Aggressive caching prevents duplicate API calls
1167
+ * 4. Single pending request per resource prevents race conditions
1168
+ * 5. Lazy loading - only loads data when needed
1169
+ */
1170
+ declare class AXPActivityDefinitionService {
1171
+ private readonly categoryProviders;
1172
+ private readonly activityProviders;
1173
+ /** Cache for categories by id - O(1) lookup */
1174
+ private categoriesById;
1175
+ /** Cache for categories by parentId - O(1) lookup */
1176
+ private categoriesByParentId;
1177
+ /** Cache for activity definitions by categoryId - O(1) lookup */
1178
+ private activitiesByCategory;
1179
+ /** Cache for individual activity definitions by name - O(1) lookup */
1180
+ private activitiesByName;
1181
+ /** Track which provider index owns each category (by category ID) */
1182
+ private categoryOwnership;
1183
+ /** Pending API requests to prevent duplicate calls */
1184
+ private pendingCategoriesRequests;
1185
+ private pendingActivitiesRequests;
1186
+ private pendingActivityRequests;
1187
+ /**
1188
+ * Get categories by parentId with aggressive caching
1189
+ *
1190
+ * Optimization: Returns cached result immediately if available,
1191
+ * preventing unnecessary API calls during navigation
1192
+ *
1193
+ * @param parentId - Parent category ID (undefined = root categories)
1194
+ * @returns Array of categories with count metadata (childrenCount, itemsCount)
1195
+ */
1196
+ getCategories(parentId?: string): Promise<AXPActivityCategory[]>;
1240
1197
  /**
1241
- * Register an activity type.
1198
+ * Get single category by ID with O(1) lookup
1199
+ *
1200
+ * Optimization: Uses Map for instant retrieval, falls back to
1201
+ * searching cache, then providers if not found
1242
1202
  */
1243
- register(type: string, factory: () => IActivity, descriptor: ActivityDescriptor): void;
1203
+ getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined>;
1244
1204
  /**
1245
- * Create an activity instance.
1205
+ * Get category path from root to specified category
1206
+ *
1207
+ * Optimization: Builds path using cached categories only
1246
1208
  */
1247
- create(type: string): IActivity;
1209
+ getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]>;
1248
1210
  /**
1249
- * Get activity descriptor.
1211
+ * Get activity definitions for a category with smart caching
1212
+ *
1213
+ * Optimization: Checks itemsCount before querying
1214
+ * - If itemsCount = 0, returns empty array (no API call)
1215
+ * - If itemsCount > 0, loads and caches activity definitions
1216
+ * - Returns cached result on subsequent calls
1217
+ *
1218
+ * @param categoryId - Category ID to get activity definitions from
1219
+ * @returns Array of activity definitions
1250
1220
  */
1251
- getDescriptor(type: string): ActivityDescriptor | undefined;
1221
+ getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]>;
1252
1222
  /**
1253
- * Get all registered types.
1223
+ * Get single activity definition by name with O(1) lookup
1224
+ *
1225
+ * Optimization: Uses Map for instant retrieval
1226
+ *
1227
+ * @param name - Activity name (unique identifier and command key)
1228
+ * @returns Activity definition or undefined if not found
1254
1229
  */
1255
- getTypes(): string[];
1230
+ getActivityByName(name: string): Promise<AXPActivityDefinition | undefined>;
1256
1231
  /**
1257
- * Get all descriptors.
1232
+ * Get category ID containing a specific activity definition
1233
+ *
1234
+ * Optimization: Searches cache first, loads on-demand if needed
1258
1235
  */
1259
- getAllDescriptors(): ActivityDescriptor[];
1236
+ getCategoryIdByActivityName(activityName: string): Promise<string | undefined>;
1260
1237
  /**
1261
- * Get descriptors by category.
1238
+ * Get category path for an activity
1262
1239
  */
1263
- getDescriptorsByCategory(category: string): ActivityDescriptor[];
1264
- }
1265
-
1266
- interface ActivityCategoryDescriptor {
1267
- name: string;
1268
- displayName: string;
1269
- description?: string;
1270
- icon?: string;
1271
- color?: string;
1272
- order?: number;
1273
- isVisible?: boolean;
1274
- tags?: string[];
1275
- }
1276
- interface AXPActivityCategoryProviderContext {
1277
- registerCategories(categories: ActivityCategoryDescriptor[]): void;
1278
- }
1279
- interface AXPActivityCategoryProvider {
1280
- provide(context: AXPActivityCategoryProviderContext): Promise<void> | void;
1281
- }
1282
- /**
1283
- * Injection token for activity category providers.
1284
- */
1285
- declare const AXP_ACTIVITY_CATEGORY_PROVIDER: InjectionToken<AXPActivityCategoryProvider[]>;
1286
- declare class AXPActivityCategoryProviderService {
1287
- private parent?;
1288
- private providers;
1289
- private categories;
1290
- private isInitialized;
1291
- constructor(parent?: AXPActivityCategoryProviderService | undefined, providers?: AXPActivityCategoryProvider[]);
1292
- private initialize;
1293
- getAllCategories(): ActivityCategoryDescriptor[];
1294
- getCategory(name: string): ActivityCategoryDescriptor | undefined;
1295
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityCategoryProviderService, [{ optional: true; skipSelf: true; }, { optional: true; }]>;
1296
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityCategoryProviderService>;
1297
- }
1298
-
1299
- /**
1300
- * Context for registering activities in a provider.
1301
- */
1302
- interface AXPActivityProviderContext {
1240
+ getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]>;
1303
1241
  /**
1304
- * Register an activity with its descriptor.
1242
+ * Load categories from providers and cache results
1243
+ *
1244
+ * Optimization: Tracks provider ownership to avoid unnecessary API calls
1245
+ * - For root (parentId = undefined): Query ALL providers
1246
+ * - For children: Only query the provider that owns the parent
1305
1247
  */
1306
- registerActivity(config: {
1307
- key: string;
1308
- descriptor: ActivityDescriptor;
1309
- }): void;
1310
- }
1311
- /**
1312
- * Interface for activity providers.
1313
- * Modules implement this to register their activities.
1314
- */
1315
- interface AXPActivityProvider {
1248
+ private loadCategoriesFromProviders;
1316
1249
  /**
1317
- * Provide activities to the system.
1250
+ * Get the provider index that owns a specific category
1251
+ *
1252
+ * @returns Array with provider index, or null if ownership unknown (query all)
1318
1253
  */
1319
- provide(context: AXPActivityProviderContext): Promise<void> | void;
1320
- }
1321
- /**
1322
- * Injection token for activity providers.
1323
- */
1324
- declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProvider[]>;
1325
- /**
1326
- * Category definition for activity categorization.
1327
- */
1328
- interface ActivityCategory {
1329
- name: string;
1330
- displayName: string;
1331
- description?: string;
1332
- icon?: string;
1333
- color?: string;
1334
- order?: number;
1335
- isVisible?: boolean;
1336
- tags?: string[];
1337
- }
1338
- /**
1339
- * Activity Provider Service.
1340
- * Collects all activity providers and manages activity registration.
1341
- */
1342
- declare class AXPActivityProviderService {
1343
- private activityDescriptors;
1344
- private categories;
1345
- private providers;
1346
- private categoryProviders;
1347
- private initialized;
1348
- private readonly commandService;
1349
- private readonly commandRegistry;
1254
+ private getProviderIndexForCategory;
1350
1255
  /**
1351
- * Register an activity provider.
1256
+ * Load activity definitions from providers and cache results
1257
+ *
1258
+ * Optimization: Only queries the provider that owns the category
1259
+ * Uses provider INDEX to match category provider with activity provider
1352
1260
  */
1353
- registerProvider(provider: AXPActivityProvider): void;
1261
+ private loadActivitiesFromProviders;
1354
1262
  /**
1355
- * Register a category provider.
1263
+ * Load single activity definition from providers and cache result
1356
1264
  */
1357
- registerCategoryProvider(provider: AXPActivityCategoryProvider): void;
1265
+ private loadActivityFromProviders;
1358
1266
  /**
1359
- * Initialize all providers.
1267
+ * Breadth-first search through category hierarchy
1360
1268
  */
1361
- initialize(): Promise<void>;
1269
+ private searchCategoryInHierarchy;
1362
1270
  /**
1363
- * Get activity descriptor by key.
1271
+ * Check if category has children (uses cached count)
1364
1272
  */
1365
- getDescriptor(key: string): ActivityDescriptor | undefined;
1273
+ categoryHasChildren(categoryId: string): boolean;
1366
1274
  /**
1367
- * Get all activity descriptors.
1275
+ * Check if category has activities (uses cached count)
1368
1276
  */
1369
- getAllDescriptors(): ActivityDescriptor[];
1277
+ categoryHasActivities(categoryId: string): boolean;
1370
1278
  /**
1371
- * Get descriptors by category.
1279
+ * Clear all caches
1372
1280
  */
1373
- getDescriptorsByCategory(category: string): ActivityDescriptor[];
1281
+ clearAllCache(): void;
1374
1282
  /**
1375
- * Get all categories.
1283
+ * Clear categories cache only
1376
1284
  */
1377
- getCategories(): ActivityCategory[];
1285
+ clearCategoriesCache(): void;
1378
1286
  /**
1379
- * Create an activity instance by key using AXPCommandService.
1287
+ * Clear activities cache only
1380
1288
  */
1381
- createActivity(key: string): Promise<IActivity | null>;
1382
- private initializeProvider;
1383
- private initializeCategoryProvider;
1384
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityProviderService, never>;
1385
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityProviderService>;
1289
+ clearActivitiesCache(): void;
1290
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityDefinitionService, never>;
1291
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityDefinitionService>;
1386
1292
  }
1387
1293
 
1388
- /**
1389
- * Types and interfaces for Workflow Execution Service.
1390
- */
1391
-
1392
1294
  /**
1393
1295
  * Represents a workflow task that needs to be executed.
1394
1296
  * Inspired by Temporal's Activity Tasks and Camunda's External Tasks.
@@ -1427,9 +1329,9 @@ interface AXPWorkflowTask {
1427
1329
  config?: Record<string, any>;
1428
1330
  }
1429
1331
  /**
1430
- * Request to start a workflow execution.
1332
+ * Request to start a workflow instance.
1431
1333
  */
1432
- interface AXPStartWorkflowExecutionRequest {
1334
+ interface AXPStartWorkflowRequest {
1433
1335
  /**
1434
1336
  * Workflow ID to execute.
1435
1337
  */
@@ -1440,17 +1342,17 @@ interface AXPStartWorkflowExecutionRequest {
1440
1342
  input: Record<string, any>;
1441
1343
  }
1442
1344
  /**
1443
- * Response after starting workflow execution.
1345
+ * Response after starting workflow instance.
1444
1346
  */
1445
- interface AXPStartWorkflowExecutionResponse {
1347
+ interface AXPStartWorkflowResponse {
1446
1348
  /**
1447
- * Unique execution ID for this workflow run.
1349
+ * Unique instance ID for this workflow run.
1448
1350
  */
1449
- executionId: string;
1351
+ instanceId: string;
1450
1352
  /**
1451
1353
  * Current workflow state.
1452
1354
  */
1453
- state: AXPWorkflowExecutionState;
1355
+ state: AXPWorkflowInstanceState;
1454
1356
  /**
1455
1357
  * First task to execute (determined by backend).
1456
1358
  * Client should execute this task based on executionMode.
@@ -1460,11 +1362,11 @@ interface AXPStartWorkflowExecutionResponse {
1460
1362
  /**
1461
1363
  * Request to resume a suspended workflow.
1462
1364
  */
1463
- interface AXPResumeWorkflowExecutionRequest {
1365
+ interface AXPResumeWorkflowRequest {
1464
1366
  /**
1465
- * Execution ID.
1367
+ * Instance ID.
1466
1368
  */
1467
- executionId: string;
1369
+ instanceId: string;
1468
1370
  /**
1469
1371
  * Step ID that was waiting for user input.
1470
1372
  */
@@ -1486,7 +1388,7 @@ interface AXPResumeWorkflowExecutionRequest {
1486
1388
  /**
1487
1389
  * Response after resuming workflow.
1488
1390
  */
1489
- interface AXPResumeWorkflowExecutionResponse {
1391
+ interface AXPResumeWorkflowResponse {
1490
1392
  /**
1491
1393
  * Activity execution output.
1492
1394
  */
@@ -1502,49 +1404,31 @@ interface AXPResumeWorkflowExecutionResponse {
1502
1404
  /**
1503
1405
  * Updated workflow state.
1504
1406
  */
1505
- state: AXPWorkflowExecutionState;
1506
- }
1507
- /**
1508
- * Request to get workflow execution state.
1509
- */
1510
- interface AXPGetWorkflowExecutionStateRequest {
1511
- /**
1512
- * Execution ID.
1513
- */
1514
- executionId: string;
1515
- }
1516
- /**
1517
- * Request to get workflow definition.
1518
- */
1519
- interface AXPGetWorkflowDefinitionRequest {
1520
- /**
1521
- * Workflow ID or definition ID.
1522
- */
1523
- workflowId: string;
1407
+ state: AXPWorkflowInstanceState;
1524
1408
  }
1525
1409
  /**
1526
- * Response with workflow definition.
1410
+ * Request to get workflow instance state.
1527
1411
  */
1528
- interface AXPGetWorkflowDefinitionResponse {
1412
+ interface AXPGetWorkflowStateRequest {
1529
1413
  /**
1530
- * Workflow definition.
1414
+ * Instance ID.
1531
1415
  */
1532
- workflow: AXPWorkflowDefinition;
1416
+ instanceId: string;
1533
1417
  }
1534
1418
  /**
1535
- * Workflow execution state (managed by backend, cached in client).
1419
+ * Workflow instance state (managed by backend, cached in client).
1536
1420
  */
1537
- interface AXPWorkflowExecutionState {
1421
+ interface AXPWorkflowInstanceState {
1538
1422
  /**
1539
- * Unique execution ID.
1423
+ * Unique instance ID.
1540
1424
  */
1541
- executionId: string;
1425
+ instanceId: string;
1542
1426
  /**
1543
1427
  * Workflow ID.
1544
1428
  */
1545
1429
  workflowId: string;
1546
1430
  /**
1547
- * Current execution status.
1431
+ * Current instance status.
1548
1432
  */
1549
1433
  status: 'running' | 'completed' | 'suspended' | 'error';
1550
1434
  /**
@@ -1570,874 +1454,566 @@ interface AXPWorkflowExecutionState {
1570
1454
  }
1571
1455
 
1572
1456
  /**
1573
- * Workflow execution result.
1457
+ * Interface for workflow engine operations.
1574
1458
  */
1575
- interface WorkflowExecutionResult {
1459
+ interface AXPWorkflowEngine {
1460
+ /**
1461
+ * Start a new workflow instance.
1462
+ *
1463
+ * Creates a new workflow instance in backend and returns instance ID.
1464
+ *
1465
+ * @param request - Start workflow request
1466
+ * @returns Response with instanceId and initial state
1467
+ *
1468
+ */
1469
+ start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
1470
+ /**
1471
+ * Resume a suspended workflow instance.
1472
+ *
1473
+ * Resumes workflow instance after user interaction (e.g., after show-dialog).
1474
+ *
1475
+ * @param request - Resume workflow request
1476
+ * @returns Resume response with next step and updated state
1477
+ *
1478
+ */
1479
+ resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
1480
+ /**
1481
+ * Get current workflow instance state.
1482
+ *
1483
+ * Retrieves current state of a workflow instance from backend.
1484
+ *
1485
+ * @param request - Get state request
1486
+ * @returns Current workflow instance state
1487
+ *
1488
+ */
1489
+ getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
1490
+ }
1491
+ /**
1492
+ * Injection token for workflow engine.
1493
+ * Default implementation is AXPWorkflowLocalEngine.
1494
+ */
1495
+ declare const AXP_WORKFLOW_ENGINE: InjectionToken<AXPWorkflowEngine>;
1496
+
1497
+ /**
1498
+ * Result of executing a frontend task.
1499
+ */
1500
+ interface FrontendTaskExecutionResult {
1501
+ /**
1502
+ * Task execution output.
1503
+ */
1504
+ output: any;
1505
+ /**
1506
+ * Task execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').
1507
+ */
1508
+ outcome: string;
1509
+ }
1510
+ /**
1511
+ * Service responsible for executing frontend workflow tasks.
1512
+ *
1513
+ * This service handles the execution of frontend or hybrid tasks using
1514
+ * the command infrastructure. It translates command results into
1515
+ * workflow-compatible output and outcome format.
1516
+ *
1517
+ * This service is replaceable per platform and contains all execution logic.
1518
+ */
1519
+ declare class FrontendTaskExecutor {
1520
+ private readonly commandService;
1521
+ /**
1522
+ * Execute a frontend workflow task.
1523
+ *
1524
+ * Only executes tasks with executionMode 'frontend' or 'both'.
1525
+ * Backend tasks should not be passed to this executor.
1526
+ *
1527
+ * @param task - Task to execute
1528
+ * @returns Execution result with output and outcome
1529
+ *
1530
+ * @throws Error if task is not a frontend task
1531
+ */
1532
+ execute(task: AXPWorkflowTask): Promise<FrontendTaskExecutionResult>;
1533
+ static ɵfac: i0.ɵɵFactoryDeclaration<FrontendTaskExecutor, never>;
1534
+ static ɵprov: i0.ɵɵInjectableDeclaration<FrontendTaskExecutor>;
1535
+ }
1536
+
1537
+ /**
1538
+ * Result of starting a workflow.
1539
+ */
1540
+ interface WorkflowStartResult {
1541
+ /**
1542
+ * Whether the operation succeeded.
1543
+ */
1576
1544
  success: boolean;
1545
+ /**
1546
+ * Workflow instance ID.
1547
+ */
1548
+ instanceId?: string;
1549
+ /**
1550
+ * Initial workflow state.
1551
+ */
1552
+ state?: AXPWorkflowInstanceState;
1553
+ /**
1554
+ * First task to execute (if any).
1555
+ */
1556
+ nextTask?: AXPWorkflowTask | null;
1557
+ /**
1558
+ * Workflow output (if completed immediately).
1559
+ */
1577
1560
  output?: any;
1561
+ /**
1562
+ * Error message (if failed).
1563
+ */
1578
1564
  error?: string;
1565
+ }
1566
+ /**
1567
+ * Result of completing a task.
1568
+ */
1569
+ interface WorkflowCompleteResult {
1570
+ /**
1571
+ * Whether the operation succeeded.
1572
+ */
1573
+ success: boolean;
1574
+ /**
1575
+ * Workflow instance ID.
1576
+ */
1577
+ instanceId: string;
1578
+ /**
1579
+ * Updated workflow state.
1580
+ */
1581
+ state?: AXPWorkflowInstanceState;
1582
+ /**
1583
+ * Next task to execute (if any).
1584
+ */
1585
+ nextTask?: AXPWorkflowTask | null;
1586
+ /**
1587
+ * Workflow output (if completed).
1588
+ */
1589
+ output?: any;
1590
+ /**
1591
+ * Error message (if failed).
1592
+ */
1593
+ error?: string;
1594
+ }
1595
+ /**
1596
+ * Result of resuming a workflow.
1597
+ */
1598
+ interface WorkflowResumeResult {
1599
+ /**
1600
+ * Whether the operation succeeded.
1601
+ */
1602
+ success: boolean;
1603
+ /**
1604
+ * Workflow instance ID.
1605
+ */
1606
+ instanceId: string;
1607
+ /**
1608
+ * Updated workflow state.
1609
+ */
1610
+ state?: AXPWorkflowInstanceState;
1611
+ /**
1612
+ * Next task to execute (if any).
1613
+ */
1579
1614
  nextTask?: AXPWorkflowTask | null;
1580
- executionId?: string;
1581
- state?: AXPWorkflowExecutionState;
1615
+ /**
1616
+ * Workflow output (if completed).
1617
+ */
1618
+ output?: any;
1619
+ /**
1620
+ * Error message (if failed).
1621
+ */
1622
+ error?: string;
1582
1623
  }
1583
1624
  /**
1584
- * Production Workflow Coordinator.
1625
+ * Workflow Manager - Facade for workflow lifecycle orchestration.
1626
+ *
1627
+ * This service is the ONLY interface the frontend uses to interact with workflows.
1628
+ * It follows Clean Architecture principles and does NOT contain execution or business logic.
1585
1629
  *
1586
- * Separates frontend/backend execution:
1587
- * - Frontend activities: Execute with AXPCommand in browser
1588
- * - Backend activities: Execute via API calls to backend
1589
- * - State caching: Caches workflow state in client for performance
1630
+ * Responsibilities:
1631
+ * - Orchestrate workflow lifecycle (start, execute, complete, resume)
1632
+ * - Delegate execution to FrontendTaskExecutor
1633
+ * - Cache workflow state in memory
1634
+ * - Expose a stable API for UI
1590
1635
  *
1636
+ * Rules:
1637
+ * - No HTTP calls (delegates to AXPWorkflowEngine)
1638
+ * - No CommandBus / Command execution (delegates to FrontendTaskExecutor)
1639
+ * - No workflow branching logic (backend decides)
1640
+ * - No business validation (backend validates)
1641
+ * - No backend assumptions (uses abstract runtime service)
1591
1642
  */
1592
- declare class WorkflowCoordinator {
1593
- private readonly workflowExecutionService;
1594
- private readonly commandService;
1643
+ declare class AXPWorkflowManager {
1644
+ private readonly workflowEngine;
1645
+ private readonly frontendTaskExecutor;
1595
1646
  /**
1596
1647
  * Cache workflow states in memory for quick access.
1597
- * Key: executionId
1598
- * Value: AXPWorkflowExecutionState
1648
+ * Key: instanceId
1649
+ * Value: AXPWorkflowInstanceState
1599
1650
  */
1600
1651
  private stateCache;
1601
1652
  /**
1602
- * Start workflow execution in backend.
1653
+ * Cache TTL in milliseconds (5 minutes).
1654
+ */
1655
+ private readonly CACHE_TTL;
1656
+ /**
1657
+ * Start a new workflow instance.
1603
1658
  *
1659
+ * Creates a new workflow instance in backend and returns instance ID.
1604
1660
  * Backend decides what to do: returns pendingTask or indicates completion.
1605
- * Frontend only calls API - no business logic here.
1606
1661
  *
1607
- * @param workflowId - Workflow ID
1608
- * @param input - Initial input data
1609
- * @returns Execution result with pendingTask (if any)
1662
+ * @param workflowId - Workflow ID to start
1663
+ * @param input - Initial input data (optional)
1664
+ * @returns Start result with instanceId, state, and nextTask
1610
1665
  *
1611
1666
  * @example
1612
1667
  * ```typescript
1613
- * const result = await coordinator.startWorkflow('my-workflow', { userId: '123' });
1668
+ * const result = await workflowManager.start('my-workflow', { userId: '123' });
1614
1669
  *
1615
- * if (result.pendingTask) {
1616
- * // Execute task if frontend, or wait for backend to complete
1617
- * if (result.pendingTask.executionMode === 'frontend') {
1618
- * await coordinator.executeTask(result.pendingTask);
1619
- * await coordinator.completeTask(result.executionId, result.pendingTask, outcome, output);
1670
+ * if (result.success && result.nextTask) {
1671
+ * // Execute task if frontend
1672
+ * if (result.nextTask.executionMode === 'frontend') {
1673
+ * const execResult = await workflowManager.execute(result.nextTask);
1674
+ * await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);
1620
1675
  * }
1621
1676
  * }
1622
1677
  * ```
1623
1678
  */
1624
- startWorkflow(workflowId: string, input?: Record<string, any>): Promise<WorkflowExecutionResult>;
1679
+ start(workflowId: string, input?: Record<string, any>): Promise<WorkflowStartResult>;
1625
1680
  /**
1626
- * Execute a frontend task using AXPCommand.
1681
+ * Execute a frontend task.
1627
1682
  *
1628
- * Only executes if task.executionMode is 'frontend' or 'both'.
1629
- * Backend tasks are handled automatically by backend.
1683
+ * Delegates to FrontendTaskExecutor for actual execution.
1684
+ * Only executes tasks with executionMode 'frontend' or 'both'.
1630
1685
  *
1631
1686
  * @param task - Task to execute
1632
1687
  * @returns Execution result with output and outcome
1688
+ *
1689
+ * @throws Error if task is not a frontend task
1633
1690
  */
1634
- executeTask(task: AXPWorkflowTask): Promise<{
1635
- output: any;
1636
- outcome: string;
1637
- }>;
1691
+ execute(task: AXPWorkflowTask): Promise<FrontendTaskExecutionResult>;
1638
1692
  /**
1639
1693
  * Complete a task and get next task from backend.
1640
1694
  *
1641
1695
  * Sends task result to backend API.
1642
1696
  * Backend decides: next task, fail, or complete workflow.
1643
1697
  *
1644
- * @param executionId - Execution ID
1698
+ * @param instanceId - Workflow instance ID
1645
1699
  * @param task - Completed task
1646
1700
  * @param outcome - Task outcome (e.g., 'Done', 'Confirmed', 'Cancelled')
1647
- * @param output - Task output/result
1648
- * @returns Next task from backend (if any)
1649
- */
1650
- completeTask(executionId: string, task: AXPWorkflowTask, outcome: string, output?: any): Promise<WorkflowExecutionResult>;
1651
- /**
1652
- * Execute workflow by ID (backward compatibility).
1653
- *
1654
- * @deprecated Use startWorkflow + executeTask + completeTask pattern instead.
1655
- * This method is kept for backward compatibility but will be removed.
1701
+ * @param output - Task output/result (optional)
1702
+ * @returns Complete result with next task (if any)
1656
1703
  */
1657
- executeWorkflowById(workflowId: string, input?: Record<string, any>): Promise<WorkflowExecutionResult>;
1704
+ complete(instanceId: string, task: AXPWorkflowTask, outcome: string, output?: any): Promise<WorkflowCompleteResult>;
1658
1705
  /**
1659
1706
  * Resume a suspended workflow (e.g., after user interaction).
1660
1707
  *
1661
1708
  * Backend determines nextStep based on outcome and outcomeConnections.
1662
- * Client only provides executionId, stepId, outcome, and optional userInput.
1709
+ * Client only provides instanceId, stepId, outcome, and optional userInput.
1663
1710
  *
1664
- * @param executionId - Workflow execution ID
1711
+ * @param instanceId - Workflow instance ID
1665
1712
  * @param stepId - Step ID that was waiting for user input
1666
1713
  * @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
1667
1714
  * @param userInput - Optional user input data
1715
+ * @param taskToken - Secure task token (required for secure resumption)
1716
+ * @returns Resume result with next task (if any)
1668
1717
  */
1669
- resumeWorkflow(executionId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowExecutionResult>;
1718
+ resume(instanceId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowResumeResult>;
1670
1719
  /**
1671
- * Get workflow execution state (from cache or backend).
1672
- */
1673
- getWorkflowState(executionId: string): Promise<AXPWorkflowExecutionState | null>;
1674
- /**
1675
- * Execute a frontend activity using CommandBus.
1720
+ * Get workflow instance state.
1676
1721
  *
1677
- * Frontend activities are executed in the browser using AXPCommandService.
1678
- * Activities can also be executed in both frontend and backend (hybrid mode).
1722
+ * Retrieves state from cache (if valid) or from backend.
1679
1723
  *
1680
- * @param task - Frontend task to execute
1681
- * @returns Execution result with output and outcome
1724
+ * @param instanceId - Workflow instance ID
1725
+ * @returns Workflow instance state or null if not found
1682
1726
  */
1683
- private executeFrontendActivity;
1684
- /**
1685
- * Start workflow execution in backend.
1686
- * Backend returns executionId, initial state, and first task to execute.
1687
- */
1688
- private startWorkflowExecution;
1689
- static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowCoordinator, never>;
1690
- static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowCoordinator>;
1727
+ getState(instanceId: string): Promise<AXPWorkflowInstanceState | null>;
1728
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowManager, never>;
1729
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowManager>;
1691
1730
  }
1692
1731
 
1693
1732
  /**
1694
- * Abstract service for workflow execution operations.
1695
- *
1696
- * This service handles communication with backend for workflow execution.
1697
- *
1698
- * Implementation should be provided in connectivity layer:
1699
- * - Mock implementation: @acorex/connectivity/mock
1700
- * - API implementation: @acorex/connectivity/api
1733
+ * Local engine implementation that manages workflow progression and state.
1701
1734
  *
1702
- * @example
1703
- * ```typescript
1704
- * // In connectivity/mock
1705
- * @Injectable()
1706
- * export class AXCWorkflowExecutionService implements AXPWorkflowExecutionService {
1707
- * async startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse> {
1708
- * // Mock implementation
1709
- * }
1710
- * }
1735
+ * This engine:
1736
+ * - Returns frontend/both activities as pendingTask (does NOT execute them)
1737
+ * - Skips backend activities (does not error, continues execution)
1738
+ * - Maintains workflow state in memory
1739
+ * - Does not require backend API calls
1711
1740
  *
1712
- * // In connectivity/api
1713
- * @Injectable()
1714
- * export class AXCWorkflowExecutionService implements AXPWorkflowExecutionService {
1715
- * constructor(private http: HttpClient) {}
1741
+ * Execution of frontend tasks is handled by AXPWorkflowManager via FrontendTaskExecutor.
1742
+ * This engine only manages workflow progression and state storage.
1716
1743
  *
1717
- * async startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse> {
1718
- * return firstValueFrom(
1719
- * this.http.post<AXPStartWorkflowExecutionResponse>(
1720
- * `${this.config.baseUrl}/api/workflows/${request.workflowId}/start`,
1721
- * { input: request.input }
1722
- * )
1723
- * );
1724
- * }
1725
- * }
1726
- * ```
1744
+ * This is the DEFAULT engine provider. Applications can override it with
1745
+ * an API-based engine implementation.
1727
1746
  */
1728
- declare abstract class AXPWorkflowExecutionService {
1747
+ declare class AXPWorkflowLocalEngine implements AXPWorkflowEngine {
1748
+ private readonly definitionLoaders;
1749
+ constructor(definitionLoaders?: AXPWorkflowDefinitionLoader[] | null);
1729
1750
  /**
1730
- * Start a new workflow execution.
1731
- *
1732
- * Creates a new workflow execution instance in backend and returns execution ID.
1733
- *
1734
- * @param request - Start execution request
1735
- * @returns Execution response with executionId and initial state
1736
- *
1737
- * @example
1738
- * ```typescript
1739
- * const response = await workflowExecutionService.startExecution({
1740
- * workflowId: 'my-workflow',
1741
- * input: { userId: '123', action: 'create' }
1742
- * });
1743
- *
1744
- * console.log('Execution ID:', response.executionId);
1745
- * console.log('Initial State:', response.state);
1746
- * ```
1751
+ * In-memory storage for workflow instances.
1752
+ * Key: instanceId
1753
+ * Value: LocalWorkflowState
1747
1754
  */
1748
- abstract startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse>;
1755
+ private instances;
1749
1756
  /**
1750
- * Resume a suspended workflow execution.
1751
- *
1752
- * Resumes workflow execution after user interaction (e.g., after show-dialog).
1753
- *
1754
- * @param request - Resume execution request
1755
- * @returns Resume response with next step and updated state
1756
- *
1757
- * @example
1758
- * ```typescript
1759
- * const response = await workflowExecutionService.resumeExecution({
1760
- * executionId: 'exec-123',
1761
- * stepId: 'step-dialog-1',
1762
- * taskToken: 'sec-task-token',
1763
- * outcome: 'Confirmed',
1764
- * userInput: { confirmed: true }
1765
- * });
1766
- *
1767
- * console.log('Next Step:', response.nextStep);
1768
- * console.log('Updated State:', response.state);
1769
- * ```
1757
+ * Task token storage for secure resume operations.
1758
+ * Key: taskToken
1759
+ * Value: { instanceId, activityId }
1770
1760
  */
1771
- abstract resumeExecution(request: AXPResumeWorkflowExecutionRequest): Promise<AXPResumeWorkflowExecutionResponse>;
1761
+ private taskTokens;
1772
1762
  /**
1773
- * Get current workflow execution state.
1774
- *
1775
- * Retrieves current state of a workflow execution from backend.
1776
- *
1777
- * @param request - Get state request
1778
- * @returns Current workflow execution state
1763
+ * Start a new workflow instance.
1779
1764
  *
1780
- * @example
1781
- * ```typescript
1782
- * const state = await workflowExecutionService.getExecutionState({
1783
- * executionId: 'exec-123'
1784
- * });
1785
- *
1786
- * console.log('Status:', state.status);
1787
- * console.log('Variables:', state.variables);
1788
- * ```
1765
+ * Creates an in-memory workflow instance and progresses it.
1766
+ * Frontend/both activities are returned as pendingTask for external execution.
1767
+ * Backend activities are skipped.
1789
1768
  */
1790
- abstract getExecutionState(request: AXPGetWorkflowExecutionStateRequest): Promise<AXPWorkflowExecutionState>;
1769
+ start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
1791
1770
  /**
1792
- * Get workflow definition by ID.
1771
+ * Resume a suspended workflow instance.
1793
1772
  *
1794
- * Retrieves workflow definition from backend.
1773
+ * Validates task token, applies externally executed result,
1774
+ * and continues progressing workflow steps.
1775
+ */
1776
+ resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
1777
+ /**
1778
+ * Get current workflow instance state.
1779
+ */
1780
+ getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
1781
+ /**
1782
+ * Get workflow definition from available loaders.
1783
+ */
1784
+ private getDefinition;
1785
+ /**
1786
+ * Progress workflow steps starting from the current position.
1795
1787
  *
1796
- * @param request - Get workflow definition request
1797
- * @returns Workflow definition in executable format
1788
+ * For frontend/both activities: returns task immediately (suspends workflow).
1789
+ * For backend activities: skips and continues.
1798
1790
  *
1799
- * @example
1800
- * ```typescript
1801
- * const response = await workflowExecutionService.getWorkflowDefinition({
1802
- * workflowId: 'my-workflow'
1803
- * });
1804
- *
1805
- * console.log('Workflow:', response.workflow);
1806
- * ```
1791
+ * Returns the next pending task (if frontend activity found) or null (if completed).
1807
1792
  */
1808
- abstract getWorkflowDefinition(request: AXPGetWorkflowDefinitionRequest): Promise<AXPGetWorkflowDefinitionResponse>;
1809
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowExecutionService, never>;
1810
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowExecutionService>;
1793
+ private executeWorkflowSteps;
1794
+ /**
1795
+ * Get next activity ID based on connections and outcomes.
1796
+ */
1797
+ private getNextActivityId;
1798
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowLocalEngine, [{ optional: true; }]>;
1799
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowLocalEngine>;
1811
1800
  }
1812
1801
 
1813
1802
  /**
1814
- * WriteLine Activity - Simple console logging activity.
1803
+ * Workflow Category - Extends AXPCategoryEntity for consistency and performance
1815
1804
  *
1816
- * Usage:
1817
- * ```typescript
1818
- * const activity = new WriteLine();
1819
- * await activity.execute({ text: 'Hello World' });
1820
- * ```
1805
+ * Inherited properties from AXPCategoryEntity:
1806
+ * - id: string - Unique identifier
1807
+ * - title: string - Display name
1808
+ * - description?: string - Category description
1809
+ * - parentId?: string - Parent category ID
1810
+ * - childrenCount: number - Direct child categories count (enables lazy loading)
1811
+ * - itemsCount?: number - Direct workflows count
1812
+ * - totalChildren?: number - Total nested categories (optional, for analytics)
1813
+ * - totalItems?: number - Total workflows in tree (optional, for analytics)
1821
1814
  */
1822
- declare class WriteLine extends Activity<{
1823
- text?: string;
1824
- }, void> {
1825
- constructor();
1826
- execute(input: {
1827
- text?: string;
1828
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
1829
- output: void;
1830
- outcomes: Record<string, any>;
1831
- }>>;
1815
+ interface AXPWorkflowCategory extends AXPCategoryEntity {
1832
1816
  }
1833
-
1834
1817
  /**
1835
- * Sequence Activity - Executes activities in sequential order.
1836
- *
1837
- * Usage:
1838
- * ```typescript
1839
- * const sequence = new Sequence();
1840
- * sequence.activities = [activity1, activity2, activity3];
1841
- * await sequence.execute({});
1842
- * ```
1818
+ * Workflow Definition - Metadata for UI and tooling.
1819
+ * Contains all metadata needed for displaying workflows in toolbox and designer.
1820
+ * The `name` property is used as the workflow identifier.
1843
1821
  */
1844
- declare class Sequence extends Activity<{}, void> {
1822
+ interface AXPWorkflowDefinitionMetadata {
1845
1823
  /**
1846
- * Activities to execute in sequence.
1824
+ * Workflow name - used as unique identifier.
1825
+ * This is the unique identifier for the workflow.
1826
+ */
1827
+ name: string;
1828
+ /**
1829
+ * Display name for UI.
1847
1830
  */
1848
- activities: IActivity[];
1849
- constructor();
1850
- execute(input: {}): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
1851
- output: void;
1852
- outcomes: Record<string, any>;
1853
- }>>;
1854
- }
1855
-
1856
- /**
1857
- * Show Confirm Dialog Activity - Displays confirmation dialog to user.
1858
- *
1859
- * Has two outcomes:
1860
- * - 'Confirmed': User clicked confirm/yes
1861
- * - 'Cancelled': User clicked cancel/no
1862
- *
1863
- * Usage:
1864
- * ```typescript
1865
- * const dialog = new ShowConfirmDialog();
1866
- * await dialog.execute({
1867
- * title: 'Confirm Delete',
1868
- * message: 'Are you sure?',
1869
- * color: 'danger'
1870
- * });
1871
- * ```
1872
- */
1873
- declare class ShowConfirmDialog extends Activity<{
1874
1831
  title?: string;
1875
- message?: string;
1876
- color?: AXStyleColorType;
1877
- defaultAction?: 'confirm' | 'cancel';
1878
- align?: 'horizontal' | 'vertical';
1879
- backdrop?: boolean;
1880
- }, {
1881
- result: boolean;
1882
- action: string;
1883
- }> {
1884
- private readonly dialogService;
1885
- private readonly translationService;
1886
- constructor();
1887
- execute(input: {
1888
- title?: string;
1889
- message?: string;
1890
- color?: AXStyleColorType;
1891
- defaultAction?: 'confirm' | 'cancel';
1892
- align?: 'horizontal' | 'vertical';
1893
- backdrop?: boolean;
1894
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
1895
- output: {
1896
- result: boolean;
1897
- action: string;
1898
- };
1899
- outcomes: Record<string, any>;
1900
- }>>;
1832
+ /**
1833
+ * Description of what the workflow does.
1834
+ */
1835
+ description?: string;
1836
+ /**
1837
+ * Category for grouping in toolbox.
1838
+ */
1839
+ category?: string;
1840
+ /**
1841
+ * Icon name or class.
1842
+ */
1843
+ icon?: string;
1844
+ /**
1845
+ * Whether this workflow is browsable in the toolbox.
1846
+ * Default: true
1847
+ */
1848
+ isBrowsable?: boolean;
1849
+ /**
1850
+ * Version number.
1851
+ */
1852
+ version?: number;
1853
+ /**
1854
+ * Whether this workflow is published.
1855
+ */
1856
+ isPublished?: boolean;
1901
1857
  }
1902
-
1903
- /**
1904
- * Show Alert Dialog Activity - Displays alert dialog to user.
1905
- *
1906
- * Has one outcome:
1907
- * - 'Done': User clicked OK
1908
- *
1909
- * Usage:
1910
- * ```typescript
1911
- * const dialog = new ShowAlertDialog();
1912
- * await dialog.execute({
1913
- * title: 'Alert',
1914
- * message: 'This is an alert',
1915
- * color: 'info'
1916
- * });
1917
- * ```
1918
- */
1919
- declare class ShowAlertDialog extends Activity<{
1920
- title?: string;
1921
- message?: string;
1922
- color?: AXStyleColorType;
1923
- }, {
1924
- result: boolean;
1925
- action: string;
1926
- }> {
1927
- private readonly dialogService;
1928
- private readonly translationService;
1929
- constructor();
1930
- execute(input: {
1931
- title?: string;
1932
- message?: string;
1933
- color?: AXStyleColorType;
1934
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
1935
- output: {
1936
- result: boolean;
1937
- action: string;
1938
- };
1939
- outcomes: Record<string, any>;
1940
- }>>;
1858
+ type AXPWorkflowProviderToken = AXPWorkflowProvider | Promise<AXPWorkflowProvider>;
1859
+ declare const AXP_WORKFLOW_PROVIDER: InjectionToken<AXPWorkflowProviderToken[]>;
1860
+ interface AXPWorkflowProvider {
1861
+ /**
1862
+ * Get list of workflow definitions for a category.
1863
+ * @param categoryId - Category ID to filter workflows
1864
+ * @returns Promise of workflow definition metadata array
1865
+ */
1866
+ getList(categoryId: string): Promise<AXPWorkflowDefinitionMetadata[]>;
1867
+ /**
1868
+ * Get workflow definition metadata by name (unique identifier).
1869
+ * @param name - Workflow name (unique identifier)
1870
+ * @returns Promise of workflow definition metadata or undefined if not found
1871
+ */
1872
+ getById(name: string): Promise<AXPWorkflowDefinitionMetadata | undefined>;
1873
+ }
1874
+ type AXPWorkflowCategoryProviderToken = AXPWorkflowCategoryProvider | Promise<AXPWorkflowCategoryProvider>;
1875
+ declare const AXP_WORKFLOW_CATEGORY_PROVIDER: InjectionToken<AXPWorkflowCategoryProviderToken[]>;
1876
+ interface AXPWorkflowCategoryProvider {
1877
+ getList(parentId?: string): Promise<AXPWorkflowCategory[]>;
1878
+ getById(id: string): Promise<AXPWorkflowCategory | undefined>;
1941
1879
  }
1942
1880
 
1943
1881
  /**
1944
- * Show Dialog Layout Builder Activity - Displays dialog using Layout Builder.
1945
- *
1946
- * This activity allows you to create custom dialogs using the Layout Builder API.
1947
- * It accepts JSON-serializable content (AXPWidgetNode) and actions configuration.
1882
+ * Optimized Workflow Definition Service
1948
1883
  *
1949
- * The content can be created using Layout Builder and then converted to JSON:
1950
- * ```typescript
1951
- * const builder = layoutBuilderService.create();
1952
- * builder.flex(flex => {
1953
- * flex.setDirection('column')
1954
- * .formField('First Name', field => {
1955
- * field.path('firstName');
1956
- * field.textBox({ placeholder: 'Enter first name' });
1957
- * });
1958
- * });
1959
- * const contentNode = builder.build();
1960
- * ```
1884
+ * Manages workflow definitions (metadata) for UI and tooling.
1885
+ * Similar to AXPActivityDefinitionService - only handles metadata, not execution.
1961
1886
  *
1962
- * Usage in Workflow:
1963
- * ```typescript
1964
- * const dialog = new ShowDialogLayoutBuilder();
1965
- * await dialog.execute({
1966
- * title: 'User Information',
1967
- * size: 'md',
1968
- * context: { firstName: '', lastName: '' },
1969
- * content: {
1970
- * type: 'flex-layout',
1971
- * mode: 'edit',
1972
- * options: {
1973
- * flexDirection: 'column',
1974
- * gap: '16px'
1975
- * },
1976
- * children: [
1977
- * {
1978
- * type: 'form-field',
1979
- * mode: 'edit',
1980
- * options: {
1981
- * label: 'First Name',
1982
- * showLabel: true
1983
- * },
1984
- * children: [{
1985
- * type: 'text-editor',
1986
- * path: 'firstName',
1987
- * options: {
1988
- * placeholder: 'Enter first name'
1989
- * }
1990
- * }]
1991
- * }
1992
- * ]
1993
- * },
1994
- * actions: {
1995
- * cancel: '@general:actions.cancel.title',
1996
- * submit: '@general:actions.submit.title',
1997
- * custom: [{
1998
- * title: 'Save Draft',
1999
- * icon: 'fa-save',
2000
- * color: 'secondary',
2001
- * command: { name: 'save-draft' }
2002
- * }]
2003
- * }
2004
- * });
2005
- * ```
2006
- *
2007
- * Usage in JSON Workflow Definition:
2008
- * ```json
2009
- * {
2010
- * "type": "ShowDialogLayoutBuilder",
2011
- * "properties": {
2012
- * "title": "User Information",
2013
- * "size": "md",
2014
- * "context": { "firstName": "", "lastName": "" },
2015
- * "content": {
2016
- * "type": "flex-layout",
2017
- * "mode": "edit",
2018
- * "options": {
2019
- * "flexDirection": "column",
2020
- * "gap": "16px"
2021
- * },
2022
- * "children": [
2023
- * {
2024
- * "type": "form-field",
2025
- * "mode": "edit",
2026
- * "options": {
2027
- * "label": "First Name",
2028
- * "showLabel": true
2029
- * },
2030
- * "children": [{
2031
- * "type": "text-editor",
2032
- * "path": "firstName",
2033
- * "options": {
2034
- * "placeholder": "Enter first name"
2035
- * }
2036
- * }]
2037
- * }
2038
- * ]
2039
- * },
2040
- * "actions": {
2041
- * "cancel": "@general:actions.cancel.title",
2042
- * "submit": "@general:actions.submit.title"
2043
- * }
2044
- * }
2045
- * }
2046
- * ```
2047
- */
2048
- declare class ShowDialogLayoutBuilder extends Activity<{
1887
+ * Performance optimizations:
1888
+ * 1. Uses childrenCount to determine if category has children (no query needed)
1889
+ * 2. Uses itemsCount to determine if category has workflows (no query needed)
1890
+ * 3. Aggressive caching prevents duplicate API calls
1891
+ * 4. Single pending request per resource prevents race conditions
1892
+ * 5. Lazy loading - only loads data when needed
1893
+ */
1894
+ declare class AXPWorkflowDefinitionService {
1895
+ private readonly categoryProviders;
1896
+ private readonly workflowProviders;
1897
+ /** Cache for categories by id - O(1) lookup */
1898
+ private categoriesById;
1899
+ /** Cache for categories by parentId - O(1) lookup */
1900
+ private categoriesByParentId;
1901
+ /** Cache for workflow definitions by categoryId - O(1) lookup */
1902
+ private workflowsByCategory;
1903
+ /** Cache for individual workflow definitions by name - O(1) lookup */
1904
+ private workflowsByName;
1905
+ /** Track which provider index owns each category (by category ID) */
1906
+ private categoryOwnership;
1907
+ /** Pending API requests to prevent duplicate calls */
1908
+ private pendingCategoriesRequests;
1909
+ private pendingWorkflowsRequests;
1910
+ private pendingWorkflowRequests;
1911
+ /**
1912
+ * Get categories by parentId with aggressive caching
1913
+ *
1914
+ * Optimization: Returns cached result immediately if available,
1915
+ * preventing unnecessary API calls during navigation
1916
+ *
1917
+ * @param parentId - Parent category ID (undefined = root categories)
1918
+ * @returns Array of categories with count metadata (childrenCount, itemsCount)
1919
+ */
1920
+ getCategories(parentId?: string): Promise<AXPWorkflowCategory[]>;
2049
1921
  /**
2050
- * Dialog title
1922
+ * Get single category by ID with O(1) lookup
1923
+ *
1924
+ * Optimization: Uses Map for instant retrieval, falls back to
1925
+ * searching cache, then providers if not found
2051
1926
  */
2052
- title?: string;
1927
+ getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined>;
2053
1928
  /**
2054
- * Dialog size
1929
+ * Get category path from root to specified category
1930
+ *
1931
+ * Optimization: Builds path using cached categories only
2055
1932
  */
2056
- size?: AXPopupSizeType;
1933
+ getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]>;
2057
1934
  /**
2058
- * Initial dialog context/data
1935
+ * Get workflow definitions for a category with smart caching
1936
+ *
1937
+ * Optimization: Checks itemsCount before querying
1938
+ * - If itemsCount = 0, returns empty array (no API call)
1939
+ * - If itemsCount > 0, loads and caches workflow definitions
1940
+ * - Returns cached result on subsequent calls
1941
+ *
1942
+ * @param categoryId - Category ID to get workflow definitions from
1943
+ * @returns Array of workflow definition metadata
2059
1944
  */
2060
- context?: Record<string, any>;
1945
+ getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinitionMetadata[]>;
2061
1946
  /**
2062
- * Show close button
1947
+ * Get single workflow definition metadata by name with O(1) lookup
1948
+ *
1949
+ * Optimization: Uses Map for instant retrieval
1950
+ *
1951
+ * @param name - Workflow name (unique identifier)
1952
+ * @returns Workflow definition metadata or undefined if not found
2063
1953
  */
2064
- closeButton?: boolean;
1954
+ getWorkflowByName(name: string): Promise<AXPWorkflowDefinitionMetadata | undefined>;
2065
1955
  /**
2066
- * Dialog message (optional, shown above content)
1956
+ * Get category ID containing a specific workflow definition
1957
+ *
1958
+ * Optimization: Searches cache first, loads on-demand if needed
2067
1959
  */
2068
- message?: string;
1960
+ getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined>;
2069
1961
  /**
2070
- * Dialog content as AXPWidgetNode (JSON-serializable)
2071
- * This can be created using Layout Builder and then converted to JSON.
1962
+ * Get category path for a workflow
2072
1963
  */
2073
- content?: AXPWidgetNode;
1964
+ getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]>;
2074
1965
  /**
2075
- * Dialog actions configuration (JSON-serializable)
1966
+ * Load categories from providers and cache results
1967
+ *
1968
+ * Optimization: Tracks provider ownership to avoid unnecessary API calls
1969
+ * - For root (parentId = undefined): Query ALL providers
1970
+ * - For children: Only query the provider that owns the parent
2076
1971
  */
2077
- actions?: {
2078
- /**
2079
- * Cancel button text (optional)
2080
- */
2081
- cancel?: string;
2082
- /**
2083
- * Submit button text (optional)
2084
- */
2085
- submit?: string;
2086
- /**
2087
- * Custom actions array (optional)
2088
- */
2089
- custom?: AXPActionMenuItem[];
2090
- };
2091
- }, {
1972
+ private loadCategoriesFromProviders;
2092
1973
  /**
2093
- * Dialog context/data after user interaction
1974
+ * Get the provider index that owns a specific category
1975
+ *
1976
+ * @returns Array with provider index, or null if ownership unknown (query all)
2094
1977
  */
2095
- context: Record<string, any>;
1978
+ private getProviderIndexForCategory;
2096
1979
  /**
2097
- * Action that user clicked (e.g., 'submit', 'cancel', or custom action name)
1980
+ * Load workflow definitions from providers and cache results
1981
+ *
1982
+ * Optimization: Only queries the provider that owns the category
1983
+ * Uses provider INDEX to match category provider with workflow provider
2098
1984
  */
2099
- action: string;
1985
+ private loadWorkflowsFromProviders;
2100
1986
  /**
2101
- * Whether user cancelled the dialog
1987
+ * Load single workflow definition from providers and cache result
2102
1988
  */
2103
- cancelled: boolean;
1989
+ private loadWorkflowFromProviders;
2104
1990
  /**
2105
- * Whether user confirmed/submitted the dialog
1991
+ * Breadth-first search through category hierarchy
2106
1992
  */
2107
- confirmed: boolean;
2108
- }> {
2109
- private readonly layoutBuilder;
2110
- constructor();
2111
- execute(input: {
2112
- title?: string;
2113
- size?: AXPopupSizeType;
2114
- context?: Record<string, any>;
2115
- closeButton?: boolean;
2116
- message?: string;
2117
- content?: AXPWidgetNode;
2118
- actions?: {
2119
- cancel?: string;
2120
- submit?: string;
2121
- custom?: AXPActionMenuItem[];
2122
- };
2123
- }): Promise<AXPExecuteCommandResult<{
2124
- output: {
2125
- context: Record<string, any>;
2126
- action: string;
2127
- cancelled: boolean;
2128
- confirmed: boolean;
2129
- };
2130
- outcomes: Record<string, any>;
2131
- }>>;
2132
- }
2133
-
2134
- /**
2135
- * Show Toast Activity - Displays toast notification to user.
2136
- *
2137
- * Usage:
2138
- * ```typescript
2139
- * const toast = new ShowToast();
2140
- * await toast.execute({
2141
- * color: 'success',
2142
- * title: 'Success',
2143
- * message: 'Operation completed successfully!'
2144
- * });
2145
- * ```
2146
- */
2147
- declare class ShowToast extends Activity<{
2148
- color?: AXStyleColorType;
2149
- title?: string;
2150
- message?: string;
2151
- duration?: number;
2152
- }, void> {
2153
- private readonly toastService;
2154
- private readonly translationService;
2155
- constructor();
2156
- execute(input: {
2157
- color?: AXStyleColorType;
2158
- title?: string;
2159
- message?: string;
2160
- duration?: number;
2161
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2162
- output: void;
2163
- outcomes: Record<string, any>;
2164
- }>>;
2165
- }
2166
-
2167
- /**
2168
- * Navigate Activity - Navigates to different pages/routes.
2169
- *
2170
- * Usage:
2171
- * ```typescript
2172
- * const navigate = new Navigate();
2173
- * await navigate.execute({
2174
- * mode: 'route',
2175
- * route: '/users',
2176
- * params: { id: '123' }
2177
- * });
2178
- * ```
2179
- */
2180
- declare class Navigate extends Activity<{
2181
- mode?: 'route' | 'entity-details' | 'entity-list' | 'external';
2182
- route?: string;
2183
- params?: Record<string, any>;
2184
- queryParams?: Record<string, any>;
2185
- entity?: string;
2186
- entityId?: string;
2187
- url?: string;
2188
- }, void> {
2189
- private readonly router;
2190
- constructor();
2191
- execute(input: {
2192
- mode?: 'route' | 'entity-details' | 'entity-list' | 'external';
2193
- route?: string;
2194
- params?: Record<string, any>;
2195
- queryParams?: Record<string, any>;
2196
- entity?: string;
2197
- entityId?: string;
2198
- url?: string;
2199
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2200
- output: void;
2201
- outcomes: Record<string, any>;
2202
- }>>;
2203
- }
2204
-
2205
- /**
2206
- * Set Variable Activity - Sets a variable value in workflow context.
2207
- *
2208
- * Usage:
2209
- * ```typescript
2210
- * const setVar = new SetVariable();
2211
- * await setVar.execute({
2212
- * variableName: 'userId',
2213
- * value: '12345'
2214
- * });
2215
- * ```
2216
- */
2217
- declare class SetVariable extends Activity<{
2218
- variableName: string;
2219
- value: any;
2220
- }, void> {
2221
- constructor();
2222
- execute(input: {
2223
- variableName: string;
2224
- value: any;
2225
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2226
- output: void;
2227
- outcomes: Record<string, any>;
2228
- }>>;
2229
- }
2230
-
2231
- /**
2232
- * Dispatch Event Activity - Dispatches an event to the system.
2233
- *
2234
- * Usage:
2235
- * ```typescript
2236
- * const dispatch = new DispatchEvent();
2237
- * await dispatch.execute({
2238
- * eventName: 'user-created',
2239
- * eventData: { userId: '123', name: 'John' }
2240
- * });
2241
- * ```
2242
- */
2243
- declare class DispatchEvent extends Activity<{
2244
- eventName: string;
2245
- eventData?: any;
2246
- }, void> {
2247
- constructor();
2248
- execute(input: {
2249
- eventName: string;
2250
- eventData?: any;
2251
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2252
- output: void;
2253
- outcomes: Record<string, any>;
2254
- }>>;
2255
- }
2256
-
2257
- /**
2258
- * If Activity - Conditional execution based on a condition.
2259
- *
2260
- * Usage:
2261
- * ```typescript
2262
- * const ifActivity = new If();
2263
- * ifActivity.condition = '{{user.isAdmin}}';
2264
- * ifActivity.thenActivities = [activity1, activity2];
2265
- * ifActivity.elseActivities = [activity3];
2266
- * ```
2267
- */
2268
- declare class If extends Activity<{
2269
- condition: string | boolean;
2270
- thenActivities?: IActivity[];
2271
- elseActivities?: IActivity[];
2272
- }, any> {
2273
- constructor();
2274
- execute(input: {
2275
- condition: string | boolean;
2276
- thenActivities?: IActivity[];
2277
- elseActivities?: IActivity[];
2278
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2279
- output: any;
2280
- outcomes: Record<string, any>;
2281
- }>>;
2282
- private evaluateCondition;
2283
- }
2284
-
2285
- /**
2286
- * While Activity - Loop execution while condition is true.
2287
- *
2288
- * Usage:
2289
- * ```typescript
2290
- * const whileActivity = new While();
2291
- * whileActivity.condition = '{{counter < 10}}';
2292
- * whileActivity.activities = [incrementActivity, logActivity];
2293
- * ```
2294
- */
2295
- declare class While extends Activity<{
2296
- condition: string | boolean;
2297
- activities?: IActivity[];
2298
- maxIterations?: number;
2299
- }, any> {
2300
- constructor();
2301
- execute(input: {
2302
- condition: string | boolean;
2303
- activities?: IActivity[];
2304
- maxIterations?: number;
2305
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2306
- output: any;
2307
- outcomes: Record<string, any>;
2308
- }>>;
2309
- private evaluateCondition;
2310
- }
2311
-
2312
- /**
2313
- * ForEach Activity - Iterates over a collection of items.
2314
- *
2315
- * Usage:
2316
- * ```typescript
2317
- * const forEach = new ForEach();
2318
- * await forEach.execute({
2319
- * items: ['item1', 'item2', 'item3'],
2320
- * activities: [processItemActivity]
2321
- * });
2322
- * ```
2323
- */
2324
- declare class ForEach extends Activity<{
2325
- items: any[];
2326
- activities?: IActivity[];
2327
- itemVariableName?: string;
2328
- indexVariableName?: string;
2329
- }, any> {
2330
- constructor();
2331
- execute(input: {
2332
- items: any[];
2333
- activities?: IActivity[];
2334
- itemVariableName?: string;
2335
- indexVariableName?: string;
2336
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2337
- output: any;
2338
- outcomes: Record<string, any>;
2339
- }>>;
2340
- }
2341
-
2342
- /**
2343
- * Execute Command Activity - Executes a command through Command Bus.
2344
- *
2345
- * Usage:
2346
- * ```typescript
2347
- * const executeCmd = new ExecuteCommand();
2348
- * await executeCmd.execute({
2349
- * commandKey: 'UserManagement.CreateUser',
2350
- * input: { name: 'John', email: 'john@example.com' }
2351
- * });
2352
- * ```
2353
- */
2354
- declare class ExecuteCommand extends Activity<{
2355
- commandKey: string;
2356
- input?: any;
2357
- }, any> {
2358
- private readonly commandService;
2359
- constructor();
2360
- execute(input: {
2361
- commandKey: string;
2362
- input?: any;
2363
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2364
- output: any;
2365
- outcomes: Record<string, any>;
2366
- }>>;
2367
- }
2368
-
2369
- /**
2370
- * Execute Query Activity - Executes a query through Query Bus.
2371
- *
2372
- * Usage:
2373
- * ```typescript
2374
- * const executeQuery = new ExecuteQuery();
2375
- * await executeQuery.execute({
2376
- * queryKey: 'UserManagement.GetUsers',
2377
- * input: { page: 1, pageSize: 10 }
2378
- * });
2379
- * ```
2380
- */
2381
- declare class ExecuteQuery extends Activity<{
2382
- queryKey: string;
2383
- input?: any;
2384
- }, any> {
2385
- private readonly queryService;
2386
- constructor();
2387
- execute(input: {
2388
- queryKey: string;
2389
- input?: any;
2390
- }): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2391
- output: any;
2392
- outcomes: Record<string, any>;
2393
- }>>;
2394
- }
2395
-
2396
- /**
2397
- * Start Activity - Marks the start point of a workflow.
2398
- *
2399
- * This is a visual marker activity that doesn't perform any actual work.
2400
- * It's used in workflow designers to clearly indicate where a workflow begins.
2401
- *
2402
- * Usage:
2403
- * ```typescript
2404
- * const start = new StartActivity();
2405
- * await start.execute({});
2406
- * ```
2407
- */
2408
- declare class StartActivity extends Activity<Record<string, never>, void> {
2409
- constructor();
2410
- execute(input: Record<string, never>): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2411
- output: void;
2412
- outcomes: Record<string, any>;
2413
- }>>;
2414
- }
2415
-
2416
- /**
2417
- * End Activity - Marks the end point of a workflow.
2418
- *
2419
- * This is a visual marker activity that terminates the workflow execution.
2420
- * When this activity is reached, the workflow completes successfully.
2421
- *
2422
- * Usage:
2423
- * ```typescript
2424
- * const end = new EndActivity();
2425
- * await end.execute({});
2426
- * ```
2427
- */
2428
- declare class EndActivity extends Activity<Record<string, never>, void> {
2429
- constructor();
2430
- execute(input: Record<string, never>): Promise<_acorex_platform_core.AXPExecuteCommandResult<{
2431
- output: void;
2432
- outcomes: Record<string, any>;
2433
- }>>;
1993
+ private searchCategoryInHierarchy;
1994
+ /**
1995
+ * Check if category has children (uses cached count)
1996
+ */
1997
+ categoryHasChildren(categoryId: string): boolean;
1998
+ /**
1999
+ * Check if category has workflows (uses cached count)
2000
+ */
2001
+ categoryHasWorkflows(categoryId: string): boolean;
2002
+ /**
2003
+ * Clear all caches
2004
+ */
2005
+ clearAllCache(): void;
2006
+ /**
2007
+ * Clear categories cache only
2008
+ */
2009
+ clearCategoriesCache(): void;
2010
+ /**
2011
+ * Clear workflows cache only
2012
+ */
2013
+ clearWorkflowsCache(): void;
2014
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionService, never>;
2015
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionService>;
2434
2016
  }
2435
2017
 
2436
- /**
2437
- * Command setups for all built-in workflow activities.
2438
- * Registers activities as AXPCommand instances.
2439
- */
2440
- declare const provideWorkflowActivityCommands: () => i0.EnvironmentProviders;
2441
-
2442
- export { AXPActivityCategoryProviderService, AXPActivityProviderService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionRegistryService, AXPWorkflowDefinitionResolver, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_DEFINITION_LOADER, Activity, ActivityRegistry, DispatchEvent, EndActivity, ExecuteCommand, ExecuteQuery, ForEach, If, Navigate, Sequence, SetVariable, ShowAlertDialog, ShowConfirmDialog, ShowDialogLayoutBuilder, ShowToast, StartActivity, While, WorkflowCoordinator, WriteLine, createWorkFlowEvent, ofType, provideWorkflowActivityCommands };
2443
- export type { AXPActivity, AXPActivityCategoryProvider, AXPActivityCategoryProviderContext, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderContext, AXPActivityStatus, AXPActivityVariable, AXPBookmark, AXPCompletionCallbackState, AXPConnection, AXPCustomProperties, AXPEndpoint, AXPExceptionState, AXPExpression, AXPFlowchart, AXPGetWorkflowDefinitionRequest, AXPGetWorkflowDefinitionResponse, AXPGetWorkflowExecutionStateRequest, AXPInputValue, AXPMetadata, AXPOutputValue, AXPPosition, AXPResumeWorkflowExecutionRequest, AXPResumeWorkflowExecutionResponse, AXPStartWorkflowExecutionRequest, AXPStartWorkflowExecutionResponse, AXPStoredWorkflowDefinition, AXPVariableDefinition, AXPVariableModel, AXPVersionedEntity, AXPWorkflow, AXPWorkflowActionInput, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowDefinitionJson, AXPWorkflowDefinitionLoader, AXPWorkflowDefinitionPreloader, AXPWorkflowEvent, AXPWorkflowExecutionState, AXPWorkflowFaultState, AXPWorkflowInputDefinition, AXPWorkflowInstance, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOptions, AXPWorkflowOutputDefinition, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, ActivityCategory, ActivityCategoryDescriptor, ActivityDescriptor, ActivityPropertyWidget, IActivity, InputDescriptor, OutputDescriptor, WorkflowExecutionResult };
2018
+ 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_DEFINITION_LOADER, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_PROVIDER, FrontendTaskExecutor, createWorkFlowEvent, ofType };
2019
+ export type { AXPActivity, AXPActivityCategory, AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityDefinition, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderToken, AXPActivityStatus, AXPActivityVariable, AXPBookmark, AXPCompletionCallbackState, AXPConnection, AXPCustomProperties, AXPEndpoint, AXPExceptionState, AXPExpression, AXPFlowchart, AXPGetWorkflowStateRequest, AXPInputValue, AXPMetadata, AXPOutputValue, AXPPosition, AXPResumeWorkflowRequest, AXPResumeWorkflowResponse, AXPStartWorkflowRequest, AXPStartWorkflowResponse, AXPStoredWorkflowDefinition, AXPVariableDefinition, AXPVariableModel, AXPVersionedEntity, AXPWorkflow, AXPWorkflowActionInput, AXPActivity$1 as AXPWorkflowActivity, AXPWorkflowCategory, AXPWorkflowCategoryProvider, AXPWorkflowCategoryProviderToken, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowDefinitionJson, AXPWorkflowDefinitionLoader, AXPWorkflowDefinitionMetadata, AXPWorkflowEngine, AXPWorkflowEvent, AXPWorkflowFaultState, AXPWorkflowInputDefinition, AXPWorkflowInstance, AXPWorkflowInstanceState, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOptions, AXPWorkflowOutputDefinition, AXPWorkflowProvider, AXPWorkflowProviderToken, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, ActivityPropertyWidget, FrontendTaskExecutionResult, InputDescriptor, OutputDescriptor, WorkflowCompleteResult, WorkflowResumeResult, WorkflowStartResult };