@acorex/platform 21.0.0-next.5 → 21.0.0-next.8

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 (32) hide show
  1. package/auth/index.d.ts +228 -3
  2. package/fesm2022/acorex-platform-auth.mjs +162 -2
  3. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  4. package/fesm2022/acorex-platform-common.mjs +1 -1
  5. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-layout-builder.mjs +11 -2
  7. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-layout-components.mjs +7 -7
  9. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-entity.mjs +79 -34
  11. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-widget-core.mjs +108 -1
  13. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-widgets.mjs +224 -89
  15. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  16. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs → acorex-platform-themes-default-entity-master-list-view.component-D3qZa5fM.mjs} +4 -4
  17. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-D3qZa5fM.mjs.map +1 -0
  18. package/fesm2022/acorex-platform-themes-default.mjs +2 -2
  19. package/fesm2022/{acorex-platform-themes-shared-theme-color-chooser-column.component-DTnfRy5f.mjs → acorex-platform-themes-shared-theme-color-chooser-column.component-Dz0cylyQ.mjs} +8 -8
  20. package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-Dz0cylyQ.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-themes-shared.mjs +1 -1
  22. package/fesm2022/acorex-platform-workflow.mjs +1084 -456
  23. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  24. package/layout/builder/index.d.ts +6 -0
  25. package/layout/components/index.d.ts +4 -3
  26. package/layout/entity/index.d.ts +9 -0
  27. package/layout/widget-core/index.d.ts +42 -1
  28. package/layout/widgets/index.d.ts +12 -7
  29. package/package.json +9 -9
  30. package/workflow/index.d.ts +798 -939
  31. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +0 -1
  32. package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-DTnfRy5f.mjs.map +0 -1
@@ -2,9 +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, AXPExecuteCommandResultPromise } from '@acorex/platform/runtime';
6
- import { AXPCategoryEntity, AXPValidationRules } from '@acorex/platform/core';
5
+ import { AXPValidationRules, AXPCategoryEntity } from '@acorex/platform/core';
7
6
  import { AXPWidgetTypesMap } from '@acorex/platform/layout/widget-core';
7
+ import { AXPCommand, AXPExecuteCommandResultPromise } from '@acorex/platform/runtime';
8
8
 
9
9
  declare class AXPWorkflowError extends Error {
10
10
  inner: Error | null;
@@ -147,784 +147,377 @@ declare class AXPWorkflowService {
147
147
  static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowService>;
148
148
  }
149
149
 
150
- /**
151
- * Base entity with versioning support.
152
- */
153
- interface AXPVersionedEntity {
154
- version: number;
155
- isLatest: boolean;
156
- isPublished: boolean;
150
+ interface AXPWorkflowDefinition {
151
+ schemaVersion: "acorex-platform-workflow/v1";
152
+ name: string;
153
+ title?: string | null;
154
+ description?: string | null;
155
+ variables?: AXPVariableDefinition[];
156
+ inputs?: AXPWorkflowInputDescriptor[];
157
+ outputs?: AXPWorkflowOutputDescriptor[];
158
+ graph: AXPWorkflowGraph;
159
+ customProperties?: Record<string, any>;
160
+ /** engine specific (Elsa, ...) */
161
+ extensions?: AXPWorkflowExtensions;
162
+ }
163
+ interface AXPWorkflowGraph {
164
+ startActivityId: string;
165
+ activities: AXPWorkflowActivityInstance[];
166
+ connections: AXPConnection[];
167
+ /** purely designer */
168
+ designer?: {
169
+ nodes?: Record<string, {
170
+ x: number;
171
+ y: number;
172
+ nodeId?: string;
173
+ }>;
174
+ edges?: Array<{
175
+ from: string;
176
+ to: string;
177
+ vertices?: Array<{
178
+ x: number;
179
+ y: number;
180
+ }>;
181
+ }>;
182
+ };
157
183
  }
158
- /**
159
- * Workflow definition stored in database.
160
- * This is the stored format that matches Elsa backend structure.
161
- */
162
- interface AXPStoredWorkflowDefinition extends AXPVersionedEntity {
163
- /**
164
- * Unique ID of this workflow definition version.
165
- */
184
+ interface AXPWorkflowActivityInstance {
166
185
  id: string;
167
- /**
168
- * Unique workflow name (same across all versions).
169
- * This is the primary identifier (replaces definitionId).
170
- */
186
+ nodeId?: string;
171
187
  name: string;
188
+ title?: string | null;
189
+ executionMode?: "frontend" | "backend" | "both";
190
+ inputs?: Record<string, any>;
191
+ metadata?: Record<string, any>;
192
+ customProperties?: Record<string, any>;
193
+ /** engine-specific override */
194
+ extensions?: Record<string, any>;
195
+ }
196
+ interface AXPConnection {
197
+ source: {
198
+ activtyName: string;
199
+ port?: string | null;
200
+ };
201
+ target: {
202
+ activtyName: string;
203
+ port?: string | null;
204
+ };
205
+ vertices?: Array<{
206
+ x: number;
207
+ y: number;
208
+ }>;
209
+ }
210
+ interface AXPVariableDefinition {
211
+ name: string;
212
+ type: string;
213
+ isArray?: boolean;
214
+ value?: any;
215
+ storageDriverType?: string | null;
216
+ }
217
+ interface AXPWorkflowPropertyWidget {
218
+ type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
219
+ options?: Record<string, any>;
220
+ }
221
+ interface AXPWorkflowInputDescriptor {
222
+ name: string;
223
+ title: string;
224
+ description?: string;
225
+ schema: {
226
+ dataType: string;
227
+ isArray?: boolean;
228
+ nullable?: boolean;
229
+ readonly?: boolean;
230
+ hidden?: boolean | string;
231
+ defaultValue?: any | string | ((context: any | null) => any);
232
+ interface: AXPWorkflowPropertyWidget;
233
+ };
234
+ validations?: AXPValidationRules;
235
+ }
236
+ interface AXPWorkflowOutputDescriptor {
237
+ name: string;
238
+ title: string;
239
+ description?: string;
172
240
  /**
173
- * Tenant ID (nullable).
174
- */
175
- tenantId?: string | null;
176
- /**
177
- * Description of what the workflow does.
178
- */
179
- description?: string | null;
241
+ * Optional: where this output comes from in your context/memory.
242
+ * Example: "$.result.orderId" or "vars.orderId"
243
+ */
244
+ path?: string;
245
+ metadata?: Record<string, any>;
246
+ schema: {
247
+ isArray?: boolean;
248
+ dataType: string;
249
+ };
250
+ }
251
+ /**
252
+ * Engine-specific extension bag for a workflow.
253
+ * Keep ALL engine-only fields here (Elsa, StepFunctions adapter, etc).
254
+ */
255
+ interface AXPWorkflowExtensions {
180
256
  /**
181
- * Creation timestamp (ISO date-time).
257
+ * Elsa-specific extensions (optional).
182
258
  */
183
- createdAt: string;
259
+ elsa?: AXPElsaWorkflowExtensions;
184
260
  /**
185
- * Version of the tool that produced this definition (e.g. "3.2.0.0").
261
+ * Other engines (future-proof).
262
+ * Example: stepFunctions, logicApps, temporal, ...
186
263
  */
187
- toolVersion?: string | null;
264
+ [engine: string]: any;
265
+ }
266
+ /**
267
+ * Elsa-only fields (Optional).
268
+ * Put strategy/tool/schema/raw payload here to keep Core model global.
269
+ */
270
+ interface AXPElsaWorkflowExtensions {
188
271
  /**
189
- * Materializer name for deserialization.
272
+ * Elsa schema URL (if you want to round-trip exact docs).
273
+ * Example: "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json"
190
274
  */
275
+ schema?: string;
276
+ toolVersion?: string;
191
277
  materializerName?: string;
192
278
  /**
193
- * JSON data (for simple workflows).
279
+ * Elsa strategy/options (engine-level concerns).
194
280
  */
195
- stringData?: string;
281
+ options?: {
282
+ activationStrategyType?: string | null;
283
+ incidentStrategyType?: string | null;
284
+ commitStrategyName?: string | null;
285
+ autoUpdateConsumingWorkflows?: boolean;
286
+ usableAsActivity?: boolean | null;
287
+ activityCategory?: string | null;
288
+ };
196
289
  /**
197
- * Binary data (for complex workflows).
290
+ * If you want lossless Elsa round-trip, keep the raw Elsa definition here.
198
291
  */
199
- binaryData?: Uint8Array;
292
+ rawDefinition?: any;
200
293
  }
294
+
201
295
  /**
202
- * Variable definition.
203
- * Matches VariableDefinition from workflow definition schema.
296
+ * Workflow definition loader interface.
297
+ * Implement this to provide workflow definitions from various sources (JSON files, database, etc.).
204
298
  */
205
- interface AXPVariableDefinition {
299
+ interface AXPWorkflowDefinitionLoader {
206
300
  /**
207
- * Variable ID.
301
+ * Get workflow definition by name (unique key).
302
+ * @param name - The workflow name (unique key)
303
+ * @returns Workflow definition or null if not found
208
304
  */
209
- id?: string;
305
+ get(name: string): Promise<AXPWorkflowDefinition | null>;
210
306
  /**
211
- * Variable name.
307
+ * Get all available workflow names.
308
+ * Used for preloading and discovery.
309
+ * @returns Array of workflow names
212
310
  */
213
- name: string;
311
+ getAllNames?(): Promise<string[]>;
312
+ }
313
+ /**
314
+ * Injection token for workflow definition loaders.
315
+ * Multiple loaders can be provided (multi: true).
316
+ */
317
+ declare const AXP_WORKFLOW_DEFINITION_LOADER: InjectionToken<AXPWorkflowDefinitionLoader>;
318
+
319
+ /**
320
+ * Workflow status.
321
+ */
322
+ type AXPWorkflowStatus = 'Running' | 'Finished';
323
+ /**
324
+ * Workflow sub-status.
325
+ */
326
+ type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';
327
+ /**
328
+ * Activity status.
329
+ */
330
+ type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';
331
+ /**
332
+ * Exception state.
333
+ */
334
+ interface AXPExceptionState {
214
335
  /**
215
- * Type name (e.g., "String", "Int32", "Boolean").
336
+ * Exception type name.
216
337
  */
217
- typeName: string;
338
+ type: string;
218
339
  /**
219
- * Whether this is an array type.
340
+ * Exception message.
220
341
  */
221
- isArray?: boolean;
342
+ message: string;
222
343
  /**
223
- * Variable value (as string expression or literal).
344
+ * Stack trace (nullable).
224
345
  */
225
- value?: string | null;
346
+ stackTrace?: string | null;
226
347
  /**
227
- * Storage driver type name (for custom storage).
348
+ * Inner exception (nullable).
228
349
  */
229
- storageDriverTypeName?: string | null;
350
+ innerException?: AXPExceptionState | null;
230
351
  }
231
352
  /**
232
- * Workflow input definition.
233
- * Matches WorkflowInputDefinition from workflow definition schema.
353
+ * Activity incident.
234
354
  */
235
- interface AXPWorkflowInputDefinition {
236
- /**
237
- * Input type (e.g., "String", "Int32", "Object").
238
- */
239
- type: string;
355
+ interface AXPActivityIncident {
240
356
  /**
241
- * Input name.
357
+ * Activity ID that caused the incident.
242
358
  */
243
- name: string;
359
+ activityId: string;
244
360
  /**
245
- * Display name.
361
+ * Activity node ID.
246
362
  */
247
- displayName?: string;
363
+ activityNodeId: string;
248
364
  /**
249
- * Description.
365
+ * Activity type.
250
366
  */
251
- description?: string;
367
+ activityType: string;
252
368
  /**
253
- * Category for grouping.
369
+ * Incident message.
254
370
  */
255
- category?: string;
371
+ message: string;
256
372
  /**
257
- * UI hint (widget type).
373
+ * Exception (nullable).
258
374
  */
259
- uiHint?: string;
375
+ exception?: AXPExceptionState | null;
260
376
  /**
261
- * Storage driver type (for custom storage).
377
+ * Timestamp (ISO date-time).
262
378
  */
263
- storageDriverType?: string | null;
379
+ timestamp: string;
264
380
  }
265
381
  /**
266
- * Workflow output definition.
267
- * Matches WorkflowOutputDefinition from workflow definition schema.
382
+ * Workflow fault state.
268
383
  */
269
- interface AXPWorkflowOutputDefinition {
270
- /**
271
- * Output type (e.g., "String", "Int32", "Object").
272
- */
273
- type: string;
274
- /**
275
- * Output name.
276
- */
277
- name: string;
384
+ interface AXPWorkflowFaultState {
278
385
  /**
279
- * Display name.
386
+ * Exception (nullable).
280
387
  */
281
- displayName?: string;
388
+ exception?: AXPExceptionState | null;
282
389
  /**
283
- * Description.
390
+ * Fault message.
284
391
  */
285
- description?: string;
392
+ message: string;
286
393
  /**
287
- * Category for grouping.
394
+ * Faulted activity ID (nullable).
288
395
  */
289
- category?: string;
396
+ faultedActivityId?: string | null;
290
397
  }
291
398
  /**
292
- * Expression.
293
- * Used for dynamic values in activities.
399
+ * Bookmark.
294
400
  */
295
- interface AXPExpression {
401
+ interface AXPBookmark {
296
402
  /**
297
- * Expression type (e.g., "Literal", "JavaScript", "Liquid").
403
+ * Bookmark ID.
298
404
  */
299
- type: string;
405
+ id: string;
406
+ /**
407
+ * Bookmark name.
408
+ */
409
+ name: string;
300
410
  /**
301
- * Expression value.
411
+ * Bookmark hash.
302
412
  */
303
- value?: any;
304
- }
305
- /**
306
- * Input value wrapper.
307
- * Wraps an expression with type information.
308
- */
309
- interface AXPInputValue {
413
+ hash: string;
310
414
  /**
311
- * Type name.
415
+ * Bookmark payload (nullable).
312
416
  */
313
- typeName: string;
417
+ payload?: any | null;
314
418
  /**
315
- * Expression (or null).
419
+ * Activity node ID.
316
420
  */
317
- expression?: AXPExpression | null;
318
- }
319
- /**
320
- * Output value wrapper.
321
- * References memory location.
322
- */
323
- interface AXPOutputValue {
421
+ activityNodeId: string;
324
422
  /**
325
- * Type name.
423
+ * Activity instance ID.
326
424
  */
327
- typeName: string;
425
+ activityInstanceId: string;
328
426
  /**
329
- * Memory reference (or null).
427
+ * Auto burn flag.
330
428
  */
331
- memoryReference?: {
332
- id: string;
333
- } | null;
334
- }
335
- /**
336
- * Position (for visual layout).
337
- */
338
- interface AXPPosition {
339
- x: number;
340
- y: number;
341
- }
342
- /**
343
- * Endpoint (connection point).
344
- */
345
- interface AXPEndpoint {
429
+ autoBurn?: boolean;
346
430
  /**
347
- * Activity ID.
431
+ * Callback method name (nullable).
348
432
  */
349
- activity: string;
433
+ callbackMethodName?: string | null;
350
434
  /**
351
- * Port name (nullable).
435
+ * Metadata (nullable).
352
436
  */
353
- port?: string | null;
437
+ metadata?: Record<string, string> | null;
354
438
  }
355
439
  /**
356
- * Connection between activities.
440
+ * Completion callback state.
357
441
  */
358
- interface AXPConnection {
442
+ interface AXPCompletionCallbackState {
359
443
  /**
360
- * Source endpoint.
444
+ * Owner activity instance ID.
361
445
  */
362
- source: AXPEndpoint;
446
+ ownerInstanceId: string;
363
447
  /**
364
- * Target endpoint.
448
+ * Child activity node ID.
365
449
  */
366
- target: AXPEndpoint;
450
+ childNodeId: string;
367
451
  /**
368
- * Connection vertices (for curved paths).
452
+ * Method name (nullable).
369
453
  */
370
- vertices?: AXPPosition[];
454
+ methodName?: string | null;
371
455
  }
372
456
  /**
373
- * Variable model (for flowchart variables).
457
+ * Variable (for activity context).
374
458
  */
375
- interface AXPVariableModel {
459
+ interface AXPActivityVariable {
460
+ /**
461
+ * Variable ID.
462
+ */
376
463
  id: string;
464
+ /**
465
+ * Variable name.
466
+ */
377
467
  name: string;
468
+ /**
469
+ * Type name.
470
+ */
378
471
  typeName: string;
379
- value?: string | null;
380
- storageDriverTypeName?: string | null;
381
- }
382
- /**
383
- * Metadata (designer annotations).
384
- */
385
- interface AXPMetadata {
386
- [key: string]: any;
387
- }
388
- /**
389
- * Custom properties (free-form bag).
390
- */
391
- interface AXPCustomProperties {
392
472
  /**
393
- * Connections that reference non-existent activities.
473
+ * Is array flag.
474
+ */
475
+ isArray?: boolean;
476
+ /**
477
+ * Variable value (nullable).
394
478
  */
395
- notFoundConnections?: AXPConnection[];
479
+ value?: any | null;
396
480
  /**
397
- * Additional custom properties.
481
+ * Storage driver type name (nullable).
398
482
  */
399
- [key: string]: any;
483
+ storageDriverTypeName?: string | null;
400
484
  }
401
485
  /**
402
- * Base activity (workflow definition format).
403
- * Matches Activity from workflow definition schema.
404
- * Note: This is the workflow definition format, not the frontend Activity class.
486
+ * Activity execution context state.
405
487
  */
406
- interface AXPActivity$1 {
488
+ interface AXPActivityExecutionContextState {
407
489
  /**
408
- * Activity ID.
490
+ * Context ID (activity instance ID).
409
491
  */
410
492
  id: string;
411
493
  /**
412
- * Node ID (for visual designer).
494
+ * Parent context ID (nullable).
413
495
  */
414
- nodeId: string;
496
+ parentContextId?: string | null;
415
497
  /**
416
- * Activity name.
498
+ * Scheduled activity node ID.
417
499
  */
418
- name?: string | null;
500
+ scheduledActivityNodeId: string;
419
501
  /**
420
- * Activity type (e.g., "workflow-activity:write-line", "workflow-activity:if").
502
+ * Owner activity node ID (nullable).
421
503
  */
422
- type: string;
504
+ ownerActivityNodeId?: string | null;
423
505
  /**
424
- * Activity version.
506
+ * Properties bag.
425
507
  */
426
- version: number;
508
+ properties: Record<string, any>;
427
509
  /**
428
- * Execution mode for this activity instance.
429
- * Determines where this activity should be executed:
430
- * - 'frontend': Execute in browser (UI activities like dialogs, toasts, navigation)
431
- * - 'backend': Execute in backend (business logic, database operations, API calls)
432
- * - 'both': Execute in both frontend and backend (hybrid activities)
433
- *
434
- * If not specified, falls back to AXPActivity's executionMode.
435
- * This allows per-instance override of the default execution mode.
436
- *
437
- * @example
438
- * ```json
439
- * {
440
- * "id": "show-dialog",
441
- * "type": "workflow-activity:show-dialog",
442
- * "executionMode": "frontend"
443
- * }
444
- * ```
510
+ * Activity state (evaluated properties) (nullable).
445
511
  */
446
- executionMode?: 'frontend' | 'backend' | 'both';
512
+ activityState?: Record<string, any> | null;
447
513
  /**
448
- * Custom properties.
514
+ * Dynamic variables.
449
515
  */
450
- customProperties?: AXPCustomProperties;
516
+ dynamicVariables: AXPActivityVariable[];
451
517
  /**
452
- * Metadata (designer annotations).
518
+ * Activity status.
453
519
  */
454
- metadata?: AXPMetadata;
455
- /**
456
- * Additional type-specific properties.
457
- */
458
- [key: string]: any;
459
- }
460
- /**
461
- * Flowchart activity (workflow definition format).
462
- * This is the root activity that contains all other activities.
463
- */
464
- interface AXPFlowchart extends AXPActivity$1 {
465
- /**
466
- * Type must be "workflow-activity:flowchart".
467
- */
468
- type: "workflow-activity:flowchart";
469
- /**
470
- * Activities in this flowchart.
471
- */
472
- activities: AXPActivity$1[];
473
- /**
474
- * Variables in this flowchart.
475
- */
476
- variables?: AXPVariableModel[];
477
- /**
478
- * Connections between activities.
479
- */
480
- connections: AXPConnection[];
481
- }
482
- /**
483
- * Simplified workflow definition for JSON files.
484
- * This is what developers write - system fields are added automatically.
485
- */
486
- interface AXPWorkflowDefinitionJson {
487
- /**
488
- * Unique workflow name (used as key/identifier).
489
- * This is the only required field for identification.
490
- * Similar to entity system where 'name' is the unique key.
491
- */
492
- name: string;
493
- /**
494
- * Display title (human-readable name shown in UI).
495
- * Similar to entity system where 'title' is the display name.
496
- */
497
- title?: string | null;
498
- /**
499
- * Description.
500
- */
501
- description?: string | null;
502
- /**
503
- * Workflow variables.
504
- */
505
- variables?: AXPVariableDefinition[];
506
- /**
507
- * Workflow inputs.
508
- */
509
- inputs?: AXPWorkflowInputDefinition[];
510
- /**
511
- * Workflow outputs.
512
- */
513
- outputs?: AXPWorkflowOutputDefinition[];
514
- /**
515
- * Workflow outcomes.
516
- */
517
- outcomes?: string[];
518
- /**
519
- * Custom properties.
520
- */
521
- customProperties?: AXPCustomProperties;
522
- /**
523
- * Workflow options.
524
- */
525
- options?: AXPWorkflowOptions;
526
- /**
527
- * Root activity (Flowchart).
528
- */
529
- root: AXPFlowchart;
530
- }
531
- /**
532
- * Complete workflow definition (v3.0.0 format).
533
- * This is the core workflow definition without system fields.
534
- * System fields ($schema, tenantId, createdAt, toolVersion, isPublished, id, version, isLatest, isReadonly, isSystem)
535
- * are managed by the entity system and stored in entity model.
536
- */
537
- interface AXPWorkflowDefinition {
538
- /**
539
- * Unique workflow name (used as key/identifier, same across all versions).
540
- * This is the primary identifier for the workflow.
541
- */
542
- name: string;
543
- /**
544
- * Display title (human-readable name shown in UI).
545
- */
546
- title?: string | null;
547
- /**
548
- * Description.
549
- */
550
- description?: string | null;
551
- /**
552
- * Workflow variables.
553
- */
554
- variables?: AXPVariableDefinition[];
555
- /**
556
- * Workflow inputs.
557
- */
558
- inputs?: AXPWorkflowInputDefinition[];
559
- /**
560
- * Workflow outputs.
561
- */
562
- outputs?: AXPWorkflowOutputDefinition[];
563
- /**
564
- * Workflow outcomes.
565
- */
566
- outcomes?: string[];
567
- /**
568
- * Custom properties.
569
- */
570
- customProperties?: AXPCustomProperties;
571
- /**
572
- * Workflow options.
573
- */
574
- options?: AXPWorkflowOptions;
575
- /**
576
- * @deprecated Use options.usableAsActivity instead.
577
- */
578
- usableAsActivity?: boolean | null;
579
- /**
580
- * Root activity (Flowchart).
581
- */
582
- root: AXPFlowchart;
583
- }
584
- /**
585
- * Workflow configuration options.
586
- */
587
- interface AXPWorkflowOptions {
588
- /**
589
- * Activation strategy type.
590
- */
591
- activationStrategyType?: string | null;
592
- /**
593
- * Whether workflow can be used as an activity.
594
- */
595
- usableAsActivity?: boolean | null;
596
- /**
597
- * Auto-update consuming workflows.
598
- */
599
- autoUpdateConsumingWorkflows?: boolean;
600
- /**
601
- * Activity category (if usable as activity).
602
- */
603
- activityCategory?: string | null;
604
- /**
605
- * Incident strategy type.
606
- */
607
- incidentStrategyType?: string | null;
608
- /**
609
- * Commit strategy name.
610
- */
611
- commitStrategyName?: string | null;
612
- }
613
-
614
- /**
615
- * Workflow definition loader interface.
616
- * Implement this to provide workflow definitions from various sources (JSON files, database, etc.).
617
- */
618
- interface AXPWorkflowDefinitionLoader {
619
- /**
620
- * Get workflow definition by name (unique key).
621
- * @param name - The workflow name (unique key)
622
- * @returns Workflow definition or null if not found
623
- */
624
- get(name: string): Promise<AXPWorkflowDefinition | null>;
625
- /**
626
- * Get all available workflow names.
627
- * Used for preloading and discovery.
628
- * @returns Array of workflow names
629
- */
630
- getAllNames?(): Promise<string[]>;
631
- }
632
- /**
633
- * Workflow definition preloader interface.
634
- * Implement this to provide a list of workflow definitions that should be preloaded.
635
- */
636
- interface AXPWorkflowDefinitionPreloader {
637
- /**
638
- * Get list of workflow definition IDs to preload.
639
- * @returns Array of definition IDs
640
- */
641
- preload(): string[];
642
- }
643
- /**
644
- * Injection token for workflow definition loaders.
645
- * Multiple loaders can be provided (multi: true).
646
- */
647
- declare const AXP_WORKFLOW_DEFINITION_LOADER: InjectionToken<AXPWorkflowDefinitionLoader>;
648
- /**
649
- * Resolver service for workflow definitions.
650
- * Aggregates all registered loaders and resolves workflow definitions.
651
- */
652
- declare class AXPWorkflowDefinitionResolver {
653
- private loaders;
654
- /**
655
- * Get workflow definition by name (unique key).
656
- * Tries all registered loaders until one returns a definition.
657
- * @param name - The workflow name (unique key)
658
- * @returns Workflow definition or null if not found
659
- */
660
- get(name: string): Promise<AXPWorkflowDefinition | null>;
661
- /**
662
- * Get all available workflow names from all loaders.
663
- * @returns Array of unique workflow names
664
- */
665
- getAllNames(): Promise<string[]>;
666
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionResolver, never>;
667
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionResolver>;
668
- }
669
-
670
- /**
671
- * Registry service for workflow definitions.
672
- * Caches loaded definitions and provides change notifications.
673
- */
674
- declare class AXPWorkflowDefinitionRegistryService {
675
- private resolver;
676
- private cache;
677
- private onChanged;
678
- /**
679
- * Observable for workflow definition changes.
680
- */
681
- get onChanged$(): rxjs.Observable<{
682
- name: string;
683
- action: "registered" | "updated" | "removed";
684
- }>;
685
- /**
686
- * Get workflow definition by name (unique key).
687
- * Uses cache if available, otherwise loads from resolver.
688
- * @param name - The workflow name (unique key)
689
- * @returns Workflow definition or null if not found
690
- */
691
- get(name: string): Promise<AXPWorkflowDefinition | null>;
692
- /**
693
- * Register a workflow definition in the cache.
694
- * @param definition - The workflow definition to register
695
- */
696
- register(definition: AXPWorkflowDefinition): void;
697
- /**
698
- * Update a workflow definition in the cache.
699
- * @param definition - The updated workflow definition
700
- */
701
- update(definition: AXPWorkflowDefinition): void;
702
- /**
703
- * Remove a workflow definition from the cache.
704
- * @param name - The workflow name to remove
705
- */
706
- remove(name: string): void;
707
- /**
708
- * Clear all cached workflow definitions.
709
- */
710
- clear(): void;
711
- /**
712
- * Check if a workflow definition is cached.
713
- * @param definitionId - The workflow definition ID
714
- * @returns True if cached, false otherwise
715
- */
716
- has(definitionId: string): boolean;
717
- /**
718
- * Get all cached workflow definition IDs.
719
- * @returns Array of definition IDs (only those that have been loaded)
720
- */
721
- getAllIds(): string[];
722
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionRegistryService, never>;
723
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionRegistryService>;
724
- }
725
-
726
- /**
727
- * Workflow status.
728
- */
729
- type AXPWorkflowStatus = 'Running' | 'Finished';
730
- /**
731
- * Workflow sub-status.
732
- */
733
- type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';
734
- /**
735
- * Activity status.
736
- */
737
- type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';
738
- /**
739
- * Exception state.
740
- */
741
- interface AXPExceptionState {
742
- /**
743
- * Exception type name.
744
- */
745
- type: string;
746
- /**
747
- * Exception message.
748
- */
749
- message: string;
750
- /**
751
- * Stack trace (nullable).
752
- */
753
- stackTrace?: string | null;
754
- /**
755
- * Inner exception (nullable).
756
- */
757
- innerException?: AXPExceptionState | null;
758
- }
759
- /**
760
- * Activity incident.
761
- */
762
- interface AXPActivityIncident {
763
- /**
764
- * Activity ID that caused the incident.
765
- */
766
- activityId: string;
767
- /**
768
- * Activity node ID.
769
- */
770
- activityNodeId: string;
771
- /**
772
- * Activity type.
773
- */
774
- activityType: string;
775
- /**
776
- * Incident message.
777
- */
778
- message: string;
779
- /**
780
- * Exception (nullable).
781
- */
782
- exception?: AXPExceptionState | null;
783
- /**
784
- * Timestamp (ISO date-time).
785
- */
786
- timestamp: string;
787
- }
788
- /**
789
- * Workflow fault state.
790
- */
791
- interface AXPWorkflowFaultState {
792
- /**
793
- * Exception (nullable).
794
- */
795
- exception?: AXPExceptionState | null;
796
- /**
797
- * Fault message.
798
- */
799
- message: string;
800
- /**
801
- * Faulted activity ID (nullable).
802
- */
803
- faultedActivityId?: string | null;
804
- }
805
- /**
806
- * Bookmark.
807
- */
808
- interface AXPBookmark {
809
- /**
810
- * Bookmark ID.
811
- */
812
- id: string;
813
- /**
814
- * Bookmark name.
815
- */
816
- name: string;
817
- /**
818
- * Bookmark hash.
819
- */
820
- hash: string;
821
- /**
822
- * Bookmark payload (nullable).
823
- */
824
- payload?: any | null;
825
- /**
826
- * Activity node ID.
827
- */
828
- activityNodeId: string;
829
- /**
830
- * Activity instance ID.
831
- */
832
- activityInstanceId: string;
833
- /**
834
- * Auto burn flag.
835
- */
836
- autoBurn?: boolean;
837
- /**
838
- * Callback method name (nullable).
839
- */
840
- callbackMethodName?: string | null;
841
- /**
842
- * Metadata (nullable).
843
- */
844
- metadata?: Record<string, string> | null;
845
- }
846
- /**
847
- * Completion callback state.
848
- */
849
- interface AXPCompletionCallbackState {
850
- /**
851
- * Owner activity instance ID.
852
- */
853
- ownerInstanceId: string;
854
- /**
855
- * Child activity node ID.
856
- */
857
- childNodeId: string;
858
- /**
859
- * Method name (nullable).
860
- */
861
- methodName?: string | null;
862
- }
863
- /**
864
- * Variable (for activity context).
865
- */
866
- interface AXPActivityVariable {
867
- /**
868
- * Variable ID.
869
- */
870
- id: string;
871
- /**
872
- * Variable name.
873
- */
874
- name: string;
875
- /**
876
- * Type name.
877
- */
878
- typeName: string;
879
- /**
880
- * Is array flag.
881
- */
882
- isArray?: boolean;
883
- /**
884
- * Variable value (nullable).
885
- */
886
- value?: any | null;
887
- /**
888
- * Storage driver type name (nullable).
889
- */
890
- storageDriverTypeName?: string | null;
891
- }
892
- /**
893
- * Activity execution context state.
894
- */
895
- interface AXPActivityExecutionContextState {
896
- /**
897
- * Context ID (activity instance ID).
898
- */
899
- id: string;
900
- /**
901
- * Parent context ID (nullable).
902
- */
903
- parentContextId?: string | null;
904
- /**
905
- * Scheduled activity node ID.
906
- */
907
- scheduledActivityNodeId: string;
908
- /**
909
- * Owner activity node ID (nullable).
910
- */
911
- ownerActivityNodeId?: string | null;
912
- /**
913
- * Properties bag.
914
- */
915
- properties: Record<string, any>;
916
- /**
917
- * Activity state (evaluated properties) (nullable).
918
- */
919
- activityState?: Record<string, any> | null;
920
- /**
921
- * Dynamic variables.
922
- */
923
- dynamicVariables: AXPActivityVariable[];
924
- /**
925
- * Activity status.
926
- */
927
- status: AXPActivityStatus;
520
+ status: AXPActivityStatus;
928
521
  /**
929
522
  * Is executing flag.
930
523
  */
@@ -1101,10 +694,6 @@ interface AXPWorkflowInstance {
1101
694
  */
1102
695
  interface AXPActivityCategory extends AXPCategoryEntity {
1103
696
  }
1104
- interface ActivityPropertyWidget {
1105
- type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
1106
- options?: Record<string, any>;
1107
- }
1108
697
  /**
1109
698
  * Activity Definition - Metadata for UI and tooling.
1110
699
  * Contains all metadata needed for displaying activities in toolbox and designer.
@@ -1148,11 +737,11 @@ interface AXPActivityDefinition {
1148
737
  /**
1149
738
  * Input descriptors.
1150
739
  */
1151
- inputs?: InputDescriptor[];
740
+ inputs?: AXPWorkflowInputDescriptor[];
1152
741
  /**
1153
742
  * Output descriptors.
1154
743
  */
1155
- outputs?: OutputDescriptor[];
744
+ outputs?: AXPWorkflowOutputDescriptor[];
1156
745
  /**
1157
746
  * Static outcomes (exit points).
1158
747
  * Example: ['Done', 'Success', 'Failed']
@@ -1188,35 +777,6 @@ interface AXPActivity<TInput = any, TOutput = any> extends AXPCommand<TInput, {
1188
777
  outcomes: Record<string, any>;
1189
778
  }>;
1190
779
  }
1191
- /**
1192
- * Input property descriptor.
1193
- * Similar to AXPEntityProperty structure.
1194
- */
1195
- interface InputDescriptor {
1196
- name: string;
1197
- title: string;
1198
- description?: string;
1199
- schema: {
1200
- dataType: string;
1201
- nullable?: boolean;
1202
- readonly?: boolean;
1203
- hidden?: boolean | string;
1204
- defaultValue?: any | string | ((context: any | null) => any);
1205
- interface?: ActivityPropertyWidget;
1206
- };
1207
- validations?: AXPValidationRules;
1208
- }
1209
- /**
1210
- * Output property descriptor.
1211
- */
1212
- interface OutputDescriptor {
1213
- name: string;
1214
- title: string;
1215
- description?: string;
1216
- schema: {
1217
- dataType: string;
1218
- };
1219
- }
1220
780
 
1221
781
  type AXPActivityProviderToken = AXPActivityProvider | Promise<AXPActivityProvider>;
1222
782
  declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProviderToken[]>;
@@ -1379,10 +939,6 @@ declare class AXPActivityDefinitionService {
1379
939
  static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityDefinitionService>;
1380
940
  }
1381
941
 
1382
- /**
1383
- * Types and interfaces for Workflow Execution Service.
1384
- */
1385
-
1386
942
  /**
1387
943
  * Represents a workflow task that needs to be executed.
1388
944
  * Inspired by Temporal's Activity Tasks and Camunda's External Tasks.
@@ -1421,9 +977,9 @@ interface AXPWorkflowTask {
1421
977
  config?: Record<string, any>;
1422
978
  }
1423
979
  /**
1424
- * Request to start a workflow execution.
980
+ * Request to start a workflow instance.
1425
981
  */
1426
- interface AXPStartWorkflowExecutionRequest {
982
+ interface AXPStartWorkflowRequest {
1427
983
  /**
1428
984
  * Workflow ID to execute.
1429
985
  */
@@ -1434,17 +990,17 @@ interface AXPStartWorkflowExecutionRequest {
1434
990
  input: Record<string, any>;
1435
991
  }
1436
992
  /**
1437
- * Response after starting workflow execution.
993
+ * Response after starting workflow instance.
1438
994
  */
1439
- interface AXPStartWorkflowExecutionResponse {
995
+ interface AXPStartWorkflowResponse {
1440
996
  /**
1441
- * Unique execution ID for this workflow run.
997
+ * Unique instance ID for this workflow run.
1442
998
  */
1443
- executionId: string;
999
+ instanceId: string;
1444
1000
  /**
1445
1001
  * Current workflow state.
1446
1002
  */
1447
- state: AXPWorkflowExecutionState;
1003
+ state: AXPWorkflowInstanceState;
1448
1004
  /**
1449
1005
  * First task to execute (determined by backend).
1450
1006
  * Client should execute this task based on executionMode.
@@ -1452,357 +1008,660 @@ interface AXPStartWorkflowExecutionResponse {
1452
1008
  pendingTask?: AXPWorkflowTask | null;
1453
1009
  }
1454
1010
  /**
1455
- * Request to resume a suspended workflow.
1011
+ * Request to resume a suspended workflow.
1012
+ */
1013
+ interface AXPResumeWorkflowRequest {
1014
+ /**
1015
+ * Instance ID.
1016
+ */
1017
+ instanceId: string;
1018
+ /**
1019
+ * Step ID that was waiting for user input.
1020
+ */
1021
+ stepId: string;
1022
+ /**
1023
+ * Secure task token issued with the pending task.
1024
+ * Backend validates and resolves the step using this token.
1025
+ */
1026
+ taskToken: string;
1027
+ /**
1028
+ * User action outcome (e.g., 'Confirmed', 'Cancelled').
1029
+ */
1030
+ outcome: string;
1031
+ /**
1032
+ * Optional user input data.
1033
+ */
1034
+ userInput?: any;
1035
+ }
1036
+ /**
1037
+ * Response after resuming workflow.
1038
+ */
1039
+ interface AXPResumeWorkflowResponse {
1040
+ /**
1041
+ * Activity execution output.
1042
+ */
1043
+ output: any;
1044
+ /**
1045
+ * Activity execution outcomes.
1046
+ */
1047
+ outcomes: Record<string, any>;
1048
+ /**
1049
+ * Next task to execute (if any).
1050
+ */
1051
+ nextTask?: AXPWorkflowTask | null;
1052
+ /**
1053
+ * Updated workflow state.
1054
+ */
1055
+ state: AXPWorkflowInstanceState;
1056
+ }
1057
+ /**
1058
+ * Request to get workflow instance state.
1059
+ */
1060
+ interface AXPGetWorkflowStateRequest {
1061
+ /**
1062
+ * Instance ID.
1063
+ */
1064
+ instanceId: string;
1065
+ }
1066
+ /**
1067
+ * Workflow instance state (managed by backend, cached in client).
1068
+ */
1069
+ interface AXPWorkflowInstanceState {
1070
+ /**
1071
+ * Unique instance ID.
1072
+ */
1073
+ instanceId: string;
1074
+ /**
1075
+ * Workflow ID.
1076
+ */
1077
+ workflowId: string;
1078
+ /**
1079
+ * Current instance status.
1080
+ */
1081
+ status: 'running' | 'completed' | 'suspended' | 'error';
1082
+ /**
1083
+ * Current step ID (if suspended or running).
1084
+ */
1085
+ currentStepId?: string;
1086
+ /**
1087
+ * Workflow variables (state).
1088
+ */
1089
+ variables: Record<string, any>;
1090
+ /**
1091
+ * Initial input data.
1092
+ */
1093
+ input: Record<string, any>;
1094
+ /**
1095
+ * Final output data (if completed).
1096
+ */
1097
+ output?: Record<string, any>;
1098
+ /**
1099
+ * Last update timestamp.
1100
+ */
1101
+ lastUpdated: Date;
1102
+ }
1103
+
1104
+ /**
1105
+ * Interface for workflow engine operations.
1106
+ */
1107
+ interface AXPWorkflowEngine {
1108
+ /**
1109
+ * Start a new workflow instance.
1110
+ *
1111
+ * Creates a new workflow instance in backend and returns instance ID.
1112
+ *
1113
+ * @param request - Start workflow request
1114
+ * @returns Response with instanceId and initial state
1115
+ *
1116
+ */
1117
+ start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
1118
+ /**
1119
+ * Resume a suspended workflow instance.
1120
+ *
1121
+ * Resumes workflow instance after user interaction (e.g., after show-dialog).
1122
+ *
1123
+ * @param request - Resume workflow request
1124
+ * @returns Resume response with next step and updated state
1125
+ *
1126
+ */
1127
+ resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
1128
+ /**
1129
+ * Get current workflow instance state.
1130
+ *
1131
+ * Retrieves current state of a workflow instance from backend.
1132
+ *
1133
+ * @param request - Get state request
1134
+ * @returns Current workflow instance state
1135
+ *
1136
+ */
1137
+ getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
1138
+ }
1139
+ /**
1140
+ * Injection token for workflow engine.
1141
+ * Default implementation is AXPWorkflowLocalEngine.
1142
+ */
1143
+ declare const AXP_WORKFLOW_ENGINE: InjectionToken<AXPWorkflowEngine>;
1144
+
1145
+ /**
1146
+ * Result of executing a frontend task.
1456
1147
  */
1457
- interface AXPResumeWorkflowExecutionRequest {
1458
- /**
1459
- * Execution ID.
1460
- */
1461
- executionId: string;
1462
- /**
1463
- * Step ID that was waiting for user input.
1464
- */
1465
- stepId: string;
1148
+ interface FrontendTaskExecutionResult {
1466
1149
  /**
1467
- * Secure task token issued with the pending task.
1468
- * Backend validates and resolves the step using this token.
1150
+ * Task execution output.
1469
1151
  */
1470
- taskToken: string;
1152
+ output: any;
1471
1153
  /**
1472
- * User action outcome (e.g., 'Confirmed', 'Cancelled').
1154
+ * Task execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').
1473
1155
  */
1474
1156
  outcome: string;
1157
+ }
1158
+ /**
1159
+ * Service responsible for executing frontend workflow tasks.
1160
+ *
1161
+ * This service handles the execution of frontend or hybrid tasks using
1162
+ * the command infrastructure. It translates command results into
1163
+ * workflow-compatible output and outcome format.
1164
+ *
1165
+ * This service is replaceable per platform and contains all execution logic.
1166
+ */
1167
+ declare class FrontendTaskExecutor {
1168
+ private readonly commandService;
1475
1169
  /**
1476
- * Optional user input data.
1170
+ * Execute a frontend workflow task.
1171
+ *
1172
+ * Only executes tasks with executionMode 'frontend' or 'both'.
1173
+ * Backend tasks should not be passed to this executor.
1174
+ *
1175
+ * @param task - Task to execute
1176
+ * @returns Execution result with output and outcome
1177
+ *
1178
+ * @throws Error if task is not a frontend task
1477
1179
  */
1478
- userInput?: any;
1180
+ execute(task: AXPWorkflowTask): Promise<FrontendTaskExecutionResult>;
1181
+ static ɵfac: i0.ɵɵFactoryDeclaration<FrontendTaskExecutor, never>;
1182
+ static ɵprov: i0.ɵɵInjectableDeclaration<FrontendTaskExecutor>;
1479
1183
  }
1184
+
1480
1185
  /**
1481
- * Response after resuming workflow.
1186
+ * Result of starting a workflow.
1482
1187
  */
1483
- interface AXPResumeWorkflowExecutionResponse {
1188
+ interface WorkflowStartResult {
1484
1189
  /**
1485
- * Activity execution output.
1190
+ * Whether the operation succeeded.
1486
1191
  */
1487
- output: any;
1192
+ success: boolean;
1488
1193
  /**
1489
- * Activity execution outcomes.
1194
+ * Workflow instance ID.
1490
1195
  */
1491
- outcomes: Record<string, any>;
1196
+ instanceId?: string;
1492
1197
  /**
1493
- * Next task to execute (if any).
1198
+ * Initial workflow state.
1199
+ */
1200
+ state?: AXPWorkflowInstanceState;
1201
+ /**
1202
+ * First task to execute (if any).
1494
1203
  */
1495
1204
  nextTask?: AXPWorkflowTask | null;
1496
1205
  /**
1497
- * Updated workflow state.
1206
+ * Workflow output (if completed immediately).
1498
1207
  */
1499
- state: AXPWorkflowExecutionState;
1500
- }
1501
- /**
1502
- * Request to get workflow execution state.
1503
- */
1504
- interface AXPGetWorkflowExecutionStateRequest {
1208
+ output?: any;
1505
1209
  /**
1506
- * Execution ID.
1210
+ * Error message (if failed).
1507
1211
  */
1508
- executionId: string;
1212
+ error?: string;
1509
1213
  }
1510
1214
  /**
1511
- * Request to get workflow definition.
1215
+ * Result of completing a task.
1512
1216
  */
1513
- interface AXPGetWorkflowDefinitionRequest {
1217
+ interface WorkflowCompleteResult {
1514
1218
  /**
1515
- * Workflow ID or definition ID.
1219
+ * Whether the operation succeeded.
1516
1220
  */
1517
- workflowId: string;
1518
- }
1519
- /**
1520
- * Response with workflow definition.
1521
- */
1522
- interface AXPGetWorkflowDefinitionResponse {
1221
+ success: boolean;
1523
1222
  /**
1524
- * Workflow definition.
1223
+ * Workflow instance ID.
1525
1224
  */
1526
- workflow: AXPWorkflowDefinition;
1527
- }
1528
- /**
1529
- * Workflow execution state (managed by backend, cached in client).
1530
- */
1531
- interface AXPWorkflowExecutionState {
1225
+ instanceId: string;
1532
1226
  /**
1533
- * Unique execution ID.
1227
+ * Updated workflow state.
1534
1228
  */
1535
- executionId: string;
1229
+ state?: AXPWorkflowInstanceState;
1536
1230
  /**
1537
- * Workflow ID.
1231
+ * Next task to execute (if any).
1538
1232
  */
1539
- workflowId: string;
1233
+ nextTask?: AXPWorkflowTask | null;
1540
1234
  /**
1541
- * Current execution status.
1235
+ * Workflow output (if completed).
1542
1236
  */
1543
- status: 'running' | 'completed' | 'suspended' | 'error';
1237
+ output?: any;
1544
1238
  /**
1545
- * Current step ID (if suspended or running).
1239
+ * Error message (if failed).
1546
1240
  */
1547
- currentStepId?: string;
1241
+ error?: string;
1242
+ }
1243
+ /**
1244
+ * Result of resuming a workflow.
1245
+ */
1246
+ interface WorkflowResumeResult {
1548
1247
  /**
1549
- * Workflow variables (state).
1248
+ * Whether the operation succeeded.
1550
1249
  */
1551
- variables: Record<string, any>;
1250
+ success: boolean;
1552
1251
  /**
1553
- * Initial input data.
1252
+ * Workflow instance ID.
1554
1253
  */
1555
- input: Record<string, any>;
1254
+ instanceId: string;
1556
1255
  /**
1557
- * Final output data (if completed).
1256
+ * Updated workflow state.
1558
1257
  */
1559
- output?: Record<string, any>;
1258
+ state?: AXPWorkflowInstanceState;
1560
1259
  /**
1561
- * Last update timestamp.
1260
+ * Next task to execute (if any).
1261
+ */
1262
+ nextTask?: AXPWorkflowTask | null;
1263
+ /**
1264
+ * Workflow output (if completed).
1562
1265
  */
1563
- lastUpdated: Date;
1564
- }
1565
-
1566
- /**
1567
- * Workflow execution result.
1568
- */
1569
- interface WorkflowExecutionResult {
1570
- success: boolean;
1571
1266
  output?: any;
1267
+ /**
1268
+ * Error message (if failed).
1269
+ */
1572
1270
  error?: string;
1573
- nextTask?: AXPWorkflowTask | null;
1574
- executionId?: string;
1575
- state?: AXPWorkflowExecutionState;
1576
1271
  }
1577
1272
  /**
1578
- * Production Workflow Coordinator.
1273
+ * Workflow Manager - Facade for workflow lifecycle orchestration.
1579
1274
  *
1580
- * Separates frontend/backend execution:
1581
- * - Frontend activities: Execute with AXPCommand in browser
1582
- * - Backend activities: Execute via API calls to backend
1583
- * - State caching: Caches workflow state in client for performance
1275
+ * This service is the ONLY interface the frontend uses to interact with workflows.
1276
+ * It follows Clean Architecture principles and does NOT contain execution or business logic.
1584
1277
  *
1278
+ * Responsibilities:
1279
+ * - Orchestrate workflow lifecycle (start, execute, complete, resume)
1280
+ * - Delegate execution to FrontendTaskExecutor
1281
+ * - Cache workflow state in memory
1282
+ * - Expose a stable API for UI
1283
+ *
1284
+ * Rules:
1285
+ * - No HTTP calls (delegates to AXPWorkflowEngine)
1286
+ * - No CommandBus / Command execution (delegates to FrontendTaskExecutor)
1287
+ * - No workflow branching logic (backend decides)
1288
+ * - No business validation (backend validates)
1289
+ * - No backend assumptions (uses abstract runtime service)
1585
1290
  */
1586
- declare class WorkflowCoordinator {
1587
- private readonly workflowExecutionService;
1588
- private readonly commandService;
1291
+ declare class AXPWorkflowManager {
1292
+ private readonly workflowEngine;
1293
+ private readonly frontendTaskExecutor;
1589
1294
  /**
1590
1295
  * Cache workflow states in memory for quick access.
1591
- * Key: executionId
1592
- * Value: AXPWorkflowExecutionState
1296
+ * Key: instanceId
1297
+ * Value: AXPWorkflowInstanceState
1593
1298
  */
1594
1299
  private stateCache;
1595
1300
  /**
1596
- * Start workflow execution in backend.
1301
+ * Cache TTL in milliseconds (5 minutes).
1302
+ */
1303
+ private readonly CACHE_TTL;
1304
+ /**
1305
+ * Start a new workflow instance.
1597
1306
  *
1307
+ * Creates a new workflow instance in backend and returns instance ID.
1598
1308
  * Backend decides what to do: returns pendingTask or indicates completion.
1599
- * Frontend only calls API - no business logic here.
1600
1309
  *
1601
- * @param workflowId - Workflow ID
1602
- * @param input - Initial input data
1603
- * @returns Execution result with pendingTask (if any)
1310
+ * @param workflowId - Workflow ID to start
1311
+ * @param input - Initial input data (optional)
1312
+ * @returns Start result with instanceId, state, and nextTask
1604
1313
  *
1605
1314
  * @example
1606
1315
  * ```typescript
1607
- * const result = await coordinator.startWorkflow('my-workflow', { userId: '123' });
1316
+ * const result = await workflowManager.start('my-workflow', { userId: '123' });
1608
1317
  *
1609
- * if (result.pendingTask) {
1610
- * // Execute task if frontend, or wait for backend to complete
1611
- * if (result.pendingTask.executionMode === 'frontend') {
1612
- * await coordinator.executeTask(result.pendingTask);
1613
- * await coordinator.completeTask(result.executionId, result.pendingTask, outcome, output);
1318
+ * if (result.success && result.nextTask) {
1319
+ * // Execute task if frontend
1320
+ * if (result.nextTask.executionMode === 'frontend') {
1321
+ * const execResult = await workflowManager.execute(result.nextTask);
1322
+ * await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);
1614
1323
  * }
1615
1324
  * }
1616
1325
  * ```
1617
1326
  */
1618
- startWorkflow(workflowId: string, input?: Record<string, any>): Promise<WorkflowExecutionResult>;
1327
+ start(workflowId: string, input?: Record<string, any>): Promise<WorkflowStartResult>;
1619
1328
  /**
1620
- * Execute a frontend task using AXPCommand.
1329
+ * Execute a frontend task.
1621
1330
  *
1622
- * Only executes if task.executionMode is 'frontend' or 'both'.
1623
- * Backend tasks are handled automatically by backend.
1331
+ * Delegates to FrontendTaskExecutor for actual execution.
1332
+ * Only executes tasks with executionMode 'frontend' or 'both'.
1624
1333
  *
1625
1334
  * @param task - Task to execute
1626
1335
  * @returns Execution result with output and outcome
1336
+ *
1337
+ * @throws Error if task is not a frontend task
1627
1338
  */
1628
- executeTask(task: AXPWorkflowTask): Promise<{
1629
- output: any;
1630
- outcome: string;
1631
- }>;
1339
+ execute(task: AXPWorkflowTask): Promise<FrontendTaskExecutionResult>;
1632
1340
  /**
1633
1341
  * Complete a task and get next task from backend.
1634
1342
  *
1635
1343
  * Sends task result to backend API.
1636
1344
  * Backend decides: next task, fail, or complete workflow.
1637
1345
  *
1638
- * @param executionId - Execution ID
1346
+ * @param instanceId - Workflow instance ID
1639
1347
  * @param task - Completed task
1640
1348
  * @param outcome - Task outcome (e.g., 'Done', 'Confirmed', 'Cancelled')
1641
- * @param output - Task output/result
1642
- * @returns Next task from backend (if any)
1643
- */
1644
- completeTask(executionId: string, task: AXPWorkflowTask, outcome: string, output?: any): Promise<WorkflowExecutionResult>;
1645
- /**
1646
- * Execute workflow by ID (backward compatibility).
1647
- *
1648
- * @deprecated Use startWorkflow + executeTask + completeTask pattern instead.
1649
- * This method is kept for backward compatibility but will be removed.
1349
+ * @param output - Task output/result (optional)
1350
+ * @returns Complete result with next task (if any)
1650
1351
  */
1651
- executeWorkflowById(workflowId: string, input?: Record<string, any>): Promise<WorkflowExecutionResult>;
1352
+ complete(instanceId: string, task: AXPWorkflowTask, outcome: string, output?: any): Promise<WorkflowCompleteResult>;
1652
1353
  /**
1653
1354
  * Resume a suspended workflow (e.g., after user interaction).
1654
1355
  *
1655
1356
  * Backend determines nextStep based on outcome and outcomeConnections.
1656
- * Client only provides executionId, stepId, outcome, and optional userInput.
1357
+ * Client only provides instanceId, stepId, outcome, and optional userInput.
1657
1358
  *
1658
- * @param executionId - Workflow execution ID
1359
+ * @param instanceId - Workflow instance ID
1659
1360
  * @param stepId - Step ID that was waiting for user input
1660
1361
  * @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
1661
1362
  * @param userInput - Optional user input data
1363
+ * @param taskToken - Secure task token (required for secure resumption)
1364
+ * @returns Resume result with next task (if any)
1662
1365
  */
1663
- resumeWorkflow(executionId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowExecutionResult>;
1664
- /**
1665
- * Get workflow execution state (from cache or backend).
1666
- */
1667
- getWorkflowState(executionId: string): Promise<AXPWorkflowExecutionState | null>;
1366
+ resume(instanceId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowResumeResult>;
1668
1367
  /**
1669
- * Execute a frontend activity using CommandBus.
1368
+ * Get workflow instance state.
1670
1369
  *
1671
- * Frontend activities are executed in the browser using AXPCommandService.
1672
- * Activities can also be executed in both frontend and backend (hybrid mode).
1370
+ * Retrieves state from cache (if valid) or from backend.
1673
1371
  *
1674
- * @param task - Frontend task to execute
1675
- * @returns Execution result with output and outcome
1372
+ * @param instanceId - Workflow instance ID
1373
+ * @returns Workflow instance state or null if not found
1676
1374
  */
1677
- private executeFrontendActivity;
1678
- /**
1679
- * Start workflow execution in backend.
1680
- * Backend returns executionId, initial state, and first task to execute.
1681
- */
1682
- private startWorkflowExecution;
1683
- static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowCoordinator, never>;
1684
- static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowCoordinator>;
1375
+ getState(instanceId: string): Promise<AXPWorkflowInstanceState | null>;
1376
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowManager, never>;
1377
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowManager>;
1685
1378
  }
1686
1379
 
1687
1380
  /**
1688
- * Abstract service for workflow execution operations.
1689
- *
1690
- * This service handles communication with backend for workflow execution.
1691
- *
1692
- * Implementation should be provided in connectivity layer:
1693
- * - Mock implementation: @acorex/connectivity/mock
1694
- * - API implementation: @acorex/connectivity/api
1381
+ * Local engine implementation that manages workflow progression and state.
1695
1382
  *
1696
- * @example
1697
- * ```typescript
1698
- * // In connectivity/mock
1699
- * @Injectable()
1700
- * export class AXCWorkflowExecutionService implements AXPWorkflowExecutionService {
1701
- * async startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse> {
1702
- * // Mock implementation
1703
- * }
1704
- * }
1383
+ * This engine:
1384
+ * - Returns frontend/both activities as pendingTask (does NOT execute them)
1385
+ * - Skips backend activities (does not error, continues execution)
1386
+ * - Maintains workflow state in memory
1387
+ * - Does not require backend API calls
1705
1388
  *
1706
- * // In connectivity/api
1707
- * @Injectable()
1708
- * export class AXCWorkflowExecutionService implements AXPWorkflowExecutionService {
1709
- * constructor(private http: HttpClient) {}
1389
+ * Execution of frontend tasks is handled by AXPWorkflowManager via FrontendTaskExecutor.
1390
+ * This engine only manages workflow progression and state storage.
1710
1391
  *
1711
- * async startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse> {
1712
- * return firstValueFrom(
1713
- * this.http.post<AXPStartWorkflowExecutionResponse>(
1714
- * `${this.config.baseUrl}/api/workflows/${request.workflowId}/start`,
1715
- * { input: request.input }
1716
- * )
1717
- * );
1718
- * }
1719
- * }
1720
- * ```
1392
+ * This is the DEFAULT engine provider. Applications can override it with
1393
+ * an API-based engine implementation.
1721
1394
  */
1722
- declare abstract class AXPWorkflowExecutionService {
1395
+ declare class AXPWorkflowLocalEngine implements AXPWorkflowEngine {
1396
+ private readonly definitionLoaders;
1397
+ constructor(definitionLoaders?: AXPWorkflowDefinitionLoader[] | null);
1398
+ /**
1399
+ * In-memory storage for workflow instances.
1400
+ * Key: instanceId
1401
+ * Value: LocalWorkflowState
1402
+ */
1403
+ private instances;
1404
+ /**
1405
+ * Task token storage for secure resume operations.
1406
+ * Key: taskToken
1407
+ * Value: { instanceId, activityId }
1408
+ */
1409
+ private taskTokens;
1723
1410
  /**
1724
- * Start a new workflow execution.
1411
+ * Start a new workflow instance.
1725
1412
  *
1726
- * Creates a new workflow execution instance in backend and returns execution ID.
1413
+ * Creates an in-memory workflow instance and progresses it.
1414
+ * Frontend/both activities are returned as pendingTask for external execution.
1415
+ * Backend activities are skipped.
1416
+ */
1417
+ start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
1418
+ /**
1419
+ * Resume a suspended workflow instance.
1727
1420
  *
1728
- * @param request - Start execution request
1729
- * @returns Execution response with executionId and initial state
1421
+ * Validates task token, applies externally executed result,
1422
+ * and continues progressing workflow steps.
1423
+ */
1424
+ resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
1425
+ /**
1426
+ * Get current workflow instance state.
1427
+ */
1428
+ getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
1429
+ /**
1430
+ * Get workflow definition from available loaders.
1431
+ */
1432
+ private getDefinition;
1433
+ /**
1434
+ * Progress workflow steps starting from the current position.
1730
1435
  *
1731
- * @example
1732
- * ```typescript
1733
- * const response = await workflowExecutionService.startExecution({
1734
- * workflowId: 'my-workflow',
1735
- * input: { userId: '123', action: 'create' }
1736
- * });
1436
+ * For frontend/both activities: returns task immediately (suspends workflow).
1437
+ * For backend activities: skips and continues.
1737
1438
  *
1738
- * console.log('Execution ID:', response.executionId);
1739
- * console.log('Initial State:', response.state);
1740
- * ```
1439
+ * Returns the next pending task (if frontend activity found) or null (if completed).
1440
+ */
1441
+ private executeWorkflowSteps;
1442
+ /**
1443
+ * Get next activity ID based on connections and outcomes.
1444
+ */
1445
+ private getNextActivityId;
1446
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowLocalEngine, [{ optional: true; }]>;
1447
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowLocalEngine>;
1448
+ }
1449
+
1450
+ /**
1451
+ * Workflow Category - Extends AXPCategoryEntity for consistency and performance
1452
+ *
1453
+ * Inherited properties from AXPCategoryEntity:
1454
+ * - id: string - Unique identifier
1455
+ * - title: string - Display name
1456
+ * - description?: string - Category description
1457
+ * - parentId?: string - Parent category ID
1458
+ * - childrenCount: number - Direct child categories count (enables lazy loading)
1459
+ * - itemsCount?: number - Direct workflows count
1460
+ * - totalChildren?: number - Total nested categories (optional, for analytics)
1461
+ * - totalItems?: number - Total workflows in tree (optional, for analytics)
1462
+ */
1463
+ interface AXPWorkflowCategory extends AXPCategoryEntity {
1464
+ }
1465
+ /**
1466
+ * Workflow Definition - Metadata for UI and tooling.
1467
+ * Contains all metadata needed for displaying workflows in toolbox and designer.
1468
+ * The `name` property is used as the workflow identifier.
1469
+ */
1470
+ interface AXPWorkflowDefinitionMetadata {
1471
+ /**
1472
+ * Workflow name - used as unique identifier.
1473
+ * This is the unique identifier for the workflow.
1474
+ */
1475
+ name: string;
1476
+ /**
1477
+ * Display name for UI.
1478
+ */
1479
+ title?: string;
1480
+ /**
1481
+ * Description of what the workflow does.
1482
+ */
1483
+ description?: string;
1484
+ /**
1485
+ * Category for grouping in toolbox.
1486
+ */
1487
+ category?: string;
1488
+ /**
1489
+ * Icon name or class.
1490
+ */
1491
+ icon?: string;
1492
+ /**
1493
+ * Whether this workflow is browsable in the toolbox.
1494
+ * Default: true
1495
+ */
1496
+ isBrowsable?: boolean;
1497
+ /**
1498
+ * Version number.
1499
+ */
1500
+ version?: number;
1501
+ /**
1502
+ * Whether this workflow is published.
1503
+ */
1504
+ isPublished?: boolean;
1505
+ }
1506
+ type AXPWorkflowProviderToken = AXPWorkflowProvider | Promise<AXPWorkflowProvider>;
1507
+ declare const AXP_WORKFLOW_PROVIDER: InjectionToken<AXPWorkflowProviderToken[]>;
1508
+ interface AXPWorkflowProvider {
1509
+ /**
1510
+ * Get list of workflow definitions for a category.
1511
+ * @param categoryId - Category ID to filter workflows
1512
+ * @returns Promise of workflow definition metadata array
1513
+ */
1514
+ getList(categoryId: string): Promise<AXPWorkflowDefinitionMetadata[]>;
1515
+ /**
1516
+ * Get workflow definition metadata by name (unique identifier).
1517
+ * @param name - Workflow name (unique identifier)
1518
+ * @returns Promise of workflow definition metadata or undefined if not found
1741
1519
  */
1742
- abstract startExecution(request: AXPStartWorkflowExecutionRequest): Promise<AXPStartWorkflowExecutionResponse>;
1520
+ getById(name: string): Promise<AXPWorkflowDefinitionMetadata | undefined>;
1521
+ }
1522
+ type AXPWorkflowCategoryProviderToken = AXPWorkflowCategoryProvider | Promise<AXPWorkflowCategoryProvider>;
1523
+ declare const AXP_WORKFLOW_CATEGORY_PROVIDER: InjectionToken<AXPWorkflowCategoryProviderToken[]>;
1524
+ interface AXPWorkflowCategoryProvider {
1525
+ getList(parentId?: string): Promise<AXPWorkflowCategory[]>;
1526
+ getById(id: string): Promise<AXPWorkflowCategory | undefined>;
1527
+ }
1528
+
1529
+ /**
1530
+ * Optimized Workflow Definition Service
1531
+ *
1532
+ * Manages workflow definitions (metadata) for UI and tooling.
1533
+ * Similar to AXPActivityDefinitionService - only handles metadata, not execution.
1534
+ *
1535
+ * Performance optimizations:
1536
+ * 1. Uses childrenCount to determine if category has children (no query needed)
1537
+ * 2. Uses itemsCount to determine if category has workflows (no query needed)
1538
+ * 3. Aggressive caching prevents duplicate API calls
1539
+ * 4. Single pending request per resource prevents race conditions
1540
+ * 5. Lazy loading - only loads data when needed
1541
+ */
1542
+ declare class AXPWorkflowDefinitionService {
1543
+ private readonly categoryProviders;
1544
+ private readonly workflowProviders;
1545
+ /** Cache for categories by id - O(1) lookup */
1546
+ private categoriesById;
1547
+ /** Cache for categories by parentId - O(1) lookup */
1548
+ private categoriesByParentId;
1549
+ /** Cache for workflow definitions by categoryId - O(1) lookup */
1550
+ private workflowsByCategory;
1551
+ /** Cache for individual workflow definitions by name - O(1) lookup */
1552
+ private workflowsByName;
1553
+ /** Track which provider index owns each category (by category ID) */
1554
+ private categoryOwnership;
1555
+ /** Pending API requests to prevent duplicate calls */
1556
+ private pendingCategoriesRequests;
1557
+ private pendingWorkflowsRequests;
1558
+ private pendingWorkflowRequests;
1743
1559
  /**
1744
- * Resume a suspended workflow execution.
1560
+ * Get categories by parentId with aggressive caching
1745
1561
  *
1746
- * Resumes workflow execution after user interaction (e.g., after show-dialog).
1562
+ * Optimization: Returns cached result immediately if available,
1563
+ * preventing unnecessary API calls during navigation
1747
1564
  *
1748
- * @param request - Resume execution request
1749
- * @returns Resume response with next step and updated state
1565
+ * @param parentId - Parent category ID (undefined = root categories)
1566
+ * @returns Array of categories with count metadata (childrenCount, itemsCount)
1567
+ */
1568
+ getCategories(parentId?: string): Promise<AXPWorkflowCategory[]>;
1569
+ /**
1570
+ * Get single category by ID with O(1) lookup
1750
1571
  *
1751
- * @example
1752
- * ```typescript
1753
- * const response = await workflowExecutionService.resumeExecution({
1754
- * executionId: 'exec-123',
1755
- * stepId: 'step-dialog-1',
1756
- * taskToken: 'sec-task-token',
1757
- * outcome: 'Confirmed',
1758
- * userInput: { confirmed: true }
1759
- * });
1572
+ * Optimization: Uses Map for instant retrieval, falls back to
1573
+ * searching cache, then providers if not found
1574
+ */
1575
+ getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined>;
1576
+ /**
1577
+ * Get category path from root to specified category
1760
1578
  *
1761
- * console.log('Next Step:', response.nextStep);
1762
- * console.log('Updated State:', response.state);
1763
- * ```
1579
+ * Optimization: Builds path using cached categories only
1764
1580
  */
1765
- abstract resumeExecution(request: AXPResumeWorkflowExecutionRequest): Promise<AXPResumeWorkflowExecutionResponse>;
1581
+ getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]>;
1766
1582
  /**
1767
- * Get current workflow execution state.
1583
+ * Get workflow definitions for a category with smart caching
1768
1584
  *
1769
- * Retrieves current state of a workflow execution from backend.
1585
+ * Optimization: Checks itemsCount before querying
1586
+ * - If itemsCount = 0, returns empty array (no API call)
1587
+ * - If itemsCount > 0, loads and caches workflow definitions
1588
+ * - Returns cached result on subsequent calls
1770
1589
  *
1771
- * @param request - Get state request
1772
- * @returns Current workflow execution state
1590
+ * @param categoryId - Category ID to get workflow definitions from
1591
+ * @returns Array of workflow definition metadata
1592
+ */
1593
+ getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinitionMetadata[]>;
1594
+ /**
1595
+ * Get single workflow definition metadata by name with O(1) lookup
1773
1596
  *
1774
- * @example
1775
- * ```typescript
1776
- * const state = await workflowExecutionService.getExecutionState({
1777
- * executionId: 'exec-123'
1778
- * });
1597
+ * Optimization: Uses Map for instant retrieval
1779
1598
  *
1780
- * console.log('Status:', state.status);
1781
- * console.log('Variables:', state.variables);
1782
- * ```
1599
+ * @param name - Workflow name (unique identifier)
1600
+ * @returns Workflow definition metadata or undefined if not found
1783
1601
  */
1784
- abstract getExecutionState(request: AXPGetWorkflowExecutionStateRequest): Promise<AXPWorkflowExecutionState>;
1602
+ getWorkflowByName(name: string): Promise<AXPWorkflowDefinitionMetadata | undefined>;
1785
1603
  /**
1786
- * Get workflow definition by ID.
1604
+ * Get category ID containing a specific workflow definition
1787
1605
  *
1788
- * Retrieves workflow definition from backend.
1606
+ * Optimization: Searches cache first, loads on-demand if needed
1607
+ */
1608
+ getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined>;
1609
+ /**
1610
+ * Get category path for a workflow
1611
+ */
1612
+ getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]>;
1613
+ /**
1614
+ * Load categories from providers and cache results
1789
1615
  *
1790
- * @param request - Get workflow definition request
1791
- * @returns Workflow definition in executable format
1616
+ * Optimization: Tracks provider ownership to avoid unnecessary API calls
1617
+ * - For root (parentId = undefined): Query ALL providers
1618
+ * - For children: Only query the provider that owns the parent
1619
+ */
1620
+ private loadCategoriesFromProviders;
1621
+ /**
1622
+ * Get the provider index that owns a specific category
1792
1623
  *
1793
- * @example
1794
- * ```typescript
1795
- * const response = await workflowExecutionService.getWorkflowDefinition({
1796
- * workflowId: 'my-workflow'
1797
- * });
1624
+ * @returns Array with provider index, or null if ownership unknown (query all)
1625
+ */
1626
+ private getProviderIndexForCategory;
1627
+ /**
1628
+ * Load workflow definitions from providers and cache results
1798
1629
  *
1799
- * console.log('Workflow:', response.workflow);
1800
- * ```
1630
+ * Optimization: Only queries the provider that owns the category
1631
+ * Uses provider INDEX to match category provider with workflow provider
1632
+ */
1633
+ private loadWorkflowsFromProviders;
1634
+ /**
1635
+ * Load single workflow definition from providers and cache result
1636
+ */
1637
+ private loadWorkflowFromProviders;
1638
+ /**
1639
+ * Breadth-first search through category hierarchy
1640
+ */
1641
+ private searchCategoryInHierarchy;
1642
+ /**
1643
+ * Check if category has children (uses cached count)
1644
+ */
1645
+ categoryHasChildren(categoryId: string): boolean;
1646
+ /**
1647
+ * Check if category has workflows (uses cached count)
1648
+ */
1649
+ categoryHasWorkflows(categoryId: string): boolean;
1650
+ /**
1651
+ * Clear all caches
1652
+ */
1653
+ clearAllCache(): void;
1654
+ /**
1655
+ * Clear categories cache only
1656
+ */
1657
+ clearCategoriesCache(): void;
1658
+ /**
1659
+ * Clear workflows cache only
1801
1660
  */
1802
- abstract getWorkflowDefinition(request: AXPGetWorkflowDefinitionRequest): Promise<AXPGetWorkflowDefinitionResponse>;
1803
- static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowExecutionService, never>;
1804
- static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowExecutionService>;
1661
+ clearWorkflowsCache(): void;
1662
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionService, never>;
1663
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionService>;
1805
1664
  }
1806
1665
 
1807
- export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionRegistryService, AXPWorkflowDefinitionResolver, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_DEFINITION_LOADER, WorkflowCoordinator, createWorkFlowEvent, ofType };
1808
- export type { AXPActivity, AXPActivityCategory, AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityDefinition, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderToken, 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, AXPActivity$1 as AXPWorkflowActivity, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowDefinitionJson, AXPWorkflowDefinitionLoader, AXPWorkflowDefinitionPreloader, AXPWorkflowEvent, AXPWorkflowExecutionState, AXPWorkflowFaultState, AXPWorkflowInputDefinition, AXPWorkflowInstance, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOptions, AXPWorkflowOutputDefinition, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, ActivityPropertyWidget, InputDescriptor, OutputDescriptor, WorkflowExecutionResult };
1666
+ 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 };
1667
+ export type { AXPActivity, AXPActivityCategory, AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityDefinition, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderToken, AXPActivityStatus, AXPActivityVariable, AXPBookmark, AXPCompletionCallbackState, AXPConnection, AXPElsaWorkflowExtensions, AXPExceptionState, AXPGetWorkflowStateRequest, AXPResumeWorkflowRequest, AXPResumeWorkflowResponse, AXPStartWorkflowRequest, AXPStartWorkflowResponse, AXPVariableDefinition, AXPWorkflow, AXPWorkflowActionInput, AXPWorkflowActivityInstance, AXPWorkflowCategory, AXPWorkflowCategoryProvider, AXPWorkflowCategoryProviderToken, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowDefinitionLoader, AXPWorkflowDefinitionMetadata, AXPWorkflowEngine, AXPWorkflowEvent, AXPWorkflowExtensions, AXPWorkflowFaultState, AXPWorkflowGraph, AXPWorkflowInputDescriptor, AXPWorkflowInstance, AXPWorkflowInstanceState, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOutputDescriptor, AXPWorkflowProvider, AXPWorkflowProviderToken, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, FrontendTaskExecutionResult, WorkflowCompleteResult, WorkflowResumeResult, WorkflowStartResult };