@acorex/platform 21.0.0-next.2 → 21.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/index.d.ts +97 -238
- package/common/index.d.ts +783 -213
- package/core/index.d.ts +311 -442
- package/fesm2022/acorex-platform-auth.mjs +156 -200
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-common.mjs +1038 -127
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +602 -413
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-domain.mjs +54 -11
- package/fesm2022/acorex-platform-domain.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +412 -270
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +2100 -3141
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-designer.mjs +7 -7
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +730 -652
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +4 -4
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +249 -205
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/{acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs → acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs} +2 -2
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-m8rHZP8L.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs} +2 -2
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs +3066 -1040
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-mARj77Mr.mjs → acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs} +26 -5
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-Cym8pq0v.mjs → acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs} +4 -5
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs +101 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs → acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs} +3 -3
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +166 -30
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +27 -27
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +474 -1527
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/layout/builder/index.d.ts +4 -1
- package/layout/components/index.d.ts +405 -327
- package/layout/designer/index.d.ts +3 -3
- package/layout/entity/index.d.ts +154 -108
- package/layout/widget-core/index.d.ts +39 -52
- package/layout/widgets/index.d.ts +368 -54
- package/package.json +9 -9
- package/themes/default/index.d.ts +15 -2
- package/themes/shared/index.d.ts +10 -10
- package/workflow/index.d.ts +182 -817
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs +0 -50
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs +0 -42
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs +0 -55
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs +0 -50
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs +0 -48
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs +0 -42
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-m8rHZP8L.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-mARj77Mr.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-Cym8pq0v.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs +0 -101
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs.map +0 -1
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject,
|
|
2
|
+
import { Injectable, inject, Optional, Inject, NgModule, InjectionToken } from '@angular/core';
|
|
3
3
|
import { Subject, filter } from 'rxjs';
|
|
4
4
|
import { cloneDeep, get, set } from 'lodash-es';
|
|
5
5
|
import { setSmart } from '@acorex/platform/core';
|
|
6
|
-
import { AXPCommandService
|
|
7
|
-
import { AXDialogService } from '@acorex/components/dialog';
|
|
8
|
-
import { AXTranslationService } from '@acorex/core/translation';
|
|
9
|
-
import { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';
|
|
10
|
-
import { AXToastService } from '@acorex/components/toast';
|
|
11
|
-
import { Router } from '@angular/router';
|
|
6
|
+
import { AXPCommandService } from '@acorex/platform/runtime';
|
|
12
7
|
|
|
13
8
|
class AXPWorkflowError extends Error {
|
|
14
9
|
constructor(message, inner = null) {
|
|
@@ -416,6 +411,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
416
411
|
}]
|
|
417
412
|
}] });
|
|
418
413
|
|
|
414
|
+
class AXPWorkflowModule {
|
|
415
|
+
static forRoot(config) {
|
|
416
|
+
return {
|
|
417
|
+
ngModule: AXPWorkflowModule,
|
|
418
|
+
providers: [
|
|
419
|
+
{
|
|
420
|
+
provide: 'AXPWorkflowModuleFactory',
|
|
421
|
+
useFactory: (registry) => () => {
|
|
422
|
+
registry.registerAction('start-workflow', AXPStartWorkflowAction);
|
|
423
|
+
registry.registerAction('decide', AXPWorkflowDecideAction);
|
|
424
|
+
//
|
|
425
|
+
if (config?.functions) {
|
|
426
|
+
for (const [key, type] of Object.entries(config.functions)) {
|
|
427
|
+
registry.registerFunction(key, type);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
//
|
|
431
|
+
if (config?.actions) {
|
|
432
|
+
for (const [key, type] of Object.entries(config.actions)) {
|
|
433
|
+
registry.registerAction(key, type);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
//
|
|
437
|
+
if (config?.workflows) {
|
|
438
|
+
for (const [key, type] of Object.entries(config.workflows)) {
|
|
439
|
+
registry.registerWorkflow(key, type);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
deps: [AXPWorkflowRegistryService],
|
|
444
|
+
multi: true,
|
|
445
|
+
},
|
|
446
|
+
...Object.values(config?.actions ?? { AXPStartWorkflowAction }),
|
|
447
|
+
...Object.values(config?.functions ?? {}),
|
|
448
|
+
],
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
static forChild(config) {
|
|
452
|
+
return {
|
|
453
|
+
ngModule: AXPWorkflowModule,
|
|
454
|
+
providers: [
|
|
455
|
+
// Built-in activities are already registered in forRoot via @NgModule providers
|
|
456
|
+
// No need to register again in forChild
|
|
457
|
+
{
|
|
458
|
+
provide: 'AXPWorkflowModuleFactory',
|
|
459
|
+
useFactory: (registry) => () => {
|
|
460
|
+
registry.registerAction('start-workflow', AXPStartWorkflowAction);
|
|
461
|
+
registry.registerAction('decide', AXPWorkflowDecideAction);
|
|
462
|
+
//
|
|
463
|
+
if (config?.functions) {
|
|
464
|
+
for (const [key, type] of Object.entries(config.functions)) {
|
|
465
|
+
registry.registerFunction(key, type);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
//
|
|
469
|
+
if (config?.actions) {
|
|
470
|
+
for (const [key, type] of Object.entries(config.actions)) {
|
|
471
|
+
registry.registerAction(key, type);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
//
|
|
475
|
+
if (config?.workflows) {
|
|
476
|
+
for (const [key, type] of Object.entries(config.workflows)) {
|
|
477
|
+
registry.registerWorkflow(key, type);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
deps: [AXPWorkflowRegistryService],
|
|
482
|
+
multi: true,
|
|
483
|
+
},
|
|
484
|
+
...Object.values(config?.actions ?? {}),
|
|
485
|
+
...Object.values(config?.functions ?? {}),
|
|
486
|
+
],
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* @ignore
|
|
491
|
+
*/
|
|
492
|
+
constructor(instances) {
|
|
493
|
+
instances?.forEach((f) => {
|
|
494
|
+
f();
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule, deps: [{ token: 'AXPWorkflowModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
498
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule }); }
|
|
499
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule }); }
|
|
500
|
+
}
|
|
501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule, decorators: [{
|
|
502
|
+
type: NgModule,
|
|
503
|
+
args: [{
|
|
504
|
+
imports: [],
|
|
505
|
+
exports: [],
|
|
506
|
+
declarations: [],
|
|
507
|
+
providers: [],
|
|
508
|
+
}]
|
|
509
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
510
|
+
type: Optional
|
|
511
|
+
}, {
|
|
512
|
+
type: Inject,
|
|
513
|
+
args: ['AXPWorkflowModuleFactory']
|
|
514
|
+
}] }] });
|
|
515
|
+
|
|
419
516
|
/**
|
|
420
517
|
* Injection token for workflow definition loaders.
|
|
421
518
|
* Multiple loaders can be provided (multi: true).
|
|
@@ -578,256 +675,435 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
578
675
|
// Compatible with Elsa backend while using ACoreX naming conventions
|
|
579
676
|
// ============================================
|
|
580
677
|
|
|
678
|
+
const AXP_ACTIVITY_PROVIDER = new InjectionToken('AXP_ACTIVITY_PROVIDER', {
|
|
679
|
+
factory: () => [],
|
|
680
|
+
});
|
|
681
|
+
const AXP_ACTIVITY_CATEGORY_PROVIDER = new InjectionToken('AXP_ACTIVITY_CATEGORY_PROVIDER', {
|
|
682
|
+
factory: () => [],
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
//#region ---- Imports ----
|
|
686
|
+
//#endregion
|
|
581
687
|
/**
|
|
582
|
-
*
|
|
583
|
-
*
|
|
688
|
+
* Optimized Activity Definition Service
|
|
689
|
+
*
|
|
690
|
+
* Manages activity definitions (metadata) for UI and tooling.
|
|
691
|
+
* Similar to AXPReportDefinitionService - only handles metadata, not execution.
|
|
692
|
+
*
|
|
693
|
+
* Performance optimizations:
|
|
694
|
+
* 1. Uses childrenCount to determine if category has children (no query needed)
|
|
695
|
+
* 2. Uses itemsCount to determine if category has activities (no query needed)
|
|
696
|
+
* 3. Aggressive caching prevents duplicate API calls
|
|
697
|
+
* 4. Single pending request per resource prevents race conditions
|
|
698
|
+
* 5. Lazy loading - only loads data when needed
|
|
584
699
|
*/
|
|
585
|
-
class
|
|
586
|
-
constructor(
|
|
587
|
-
|
|
588
|
-
this.
|
|
700
|
+
class AXPActivityDefinitionService {
|
|
701
|
+
constructor() {
|
|
702
|
+
//#region ---- Providers & Caches ----
|
|
703
|
+
this.categoryProviders = inject(AXP_ACTIVITY_CATEGORY_PROVIDER, { optional: true }) || [];
|
|
704
|
+
this.activityProviders = inject(AXP_ACTIVITY_PROVIDER, { optional: true }) || [];
|
|
705
|
+
//#endregion
|
|
706
|
+
//#region ---- Cache Storage ----
|
|
707
|
+
/** Cache for categories by id - O(1) lookup */
|
|
708
|
+
this.categoriesById = new Map();
|
|
709
|
+
/** Cache for categories by parentId - O(1) lookup */
|
|
710
|
+
this.categoriesByParentId = new Map();
|
|
711
|
+
/** Cache for activity definitions by categoryId - O(1) lookup */
|
|
712
|
+
this.activitiesByCategory = new Map();
|
|
713
|
+
/** Cache for individual activity definitions by name - O(1) lookup */
|
|
714
|
+
this.activitiesByName = new Map();
|
|
715
|
+
/** Track which provider index owns each category (by category ID) */
|
|
716
|
+
this.categoryOwnership = new Map(); // Maps categoryId → provider index
|
|
717
|
+
/** Pending API requests to prevent duplicate calls */
|
|
718
|
+
this.pendingCategoriesRequests = new Map();
|
|
719
|
+
this.pendingActivitiesRequests = new Map();
|
|
720
|
+
this.pendingActivityRequests = new Map();
|
|
589
721
|
}
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region ---- Initialization ----
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region ---- Public API: Categories ----
|
|
590
726
|
/**
|
|
591
|
-
*
|
|
727
|
+
* Get categories by parentId with aggressive caching
|
|
728
|
+
*
|
|
729
|
+
* Optimization: Returns cached result immediately if available,
|
|
730
|
+
* preventing unnecessary API calls during navigation
|
|
731
|
+
*
|
|
732
|
+
* @param parentId - Parent category ID (undefined = root categories)
|
|
733
|
+
* @returns Array of categories with count metadata (childrenCount, itemsCount)
|
|
592
734
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
class ActivityRegistry {
|
|
607
|
-
constructor() {
|
|
608
|
-
this.registry = new Map();
|
|
609
|
-
this.descriptors = new Map();
|
|
735
|
+
async getCategories(parentId) {
|
|
736
|
+
// ✅ Fast path: Return cached result
|
|
737
|
+
if (this.categoriesByParentId.has(parentId)) {
|
|
738
|
+
return this.categoriesByParentId.get(parentId);
|
|
739
|
+
}
|
|
740
|
+
// ✅ Prevent duplicate requests: Return pending promise
|
|
741
|
+
if (this.pendingCategoriesRequests.has(parentId)) {
|
|
742
|
+
return this.pendingCategoriesRequests.get(parentId);
|
|
743
|
+
}
|
|
744
|
+
// ✅ Create single request and cache it
|
|
745
|
+
const requestPromise = this.loadCategoriesFromProviders(parentId);
|
|
746
|
+
this.pendingCategoriesRequests.set(parentId, requestPromise);
|
|
747
|
+
return requestPromise;
|
|
610
748
|
}
|
|
611
749
|
/**
|
|
612
|
-
*
|
|
750
|
+
* Get single category by ID with O(1) lookup
|
|
751
|
+
*
|
|
752
|
+
* Optimization: Uses Map for instant retrieval, falls back to
|
|
753
|
+
* searching cache, then providers if not found
|
|
613
754
|
*/
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
this.
|
|
755
|
+
async getCategoryById(categoryId) {
|
|
756
|
+
// ✅ Fast path: O(1) lookup in cache
|
|
757
|
+
if (this.categoriesById.has(categoryId)) {
|
|
758
|
+
return this.categoriesById.get(categoryId);
|
|
759
|
+
}
|
|
760
|
+
// ✅ Search in cached parent-child lists
|
|
761
|
+
for (const categories of this.categoriesByParentId.values()) {
|
|
762
|
+
const found = categories.find(cat => cat.id === categoryId);
|
|
763
|
+
if (found) {
|
|
764
|
+
this.categoriesById.set(categoryId, found);
|
|
765
|
+
return found;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
// ✅ Load root categories if not loaded
|
|
769
|
+
if (!this.categoriesByParentId.has(undefined)) {
|
|
770
|
+
await this.getCategories();
|
|
771
|
+
if (this.categoriesById.has(categoryId)) {
|
|
772
|
+
return this.categoriesById.get(categoryId);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
// ✅ Breadth-first search through hierarchy
|
|
776
|
+
return this.searchCategoryInHierarchy(categoryId);
|
|
617
777
|
}
|
|
618
778
|
/**
|
|
619
|
-
*
|
|
779
|
+
* Get category path from root to specified category
|
|
780
|
+
*
|
|
781
|
+
* Optimization: Builds path using cached categories only
|
|
620
782
|
*/
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
|
|
783
|
+
async getCategoriesPathById(categoryId) {
|
|
784
|
+
const path = [];
|
|
785
|
+
let currentCategoryId = categoryId;
|
|
786
|
+
while (currentCategoryId) {
|
|
787
|
+
const category = await this.getCategoryById(currentCategoryId);
|
|
788
|
+
if (!category) {
|
|
789
|
+
throw new Error(`Category '${currentCategoryId}' not found`);
|
|
790
|
+
}
|
|
791
|
+
path.unshift(category);
|
|
792
|
+
currentCategoryId = category.parentId;
|
|
625
793
|
}
|
|
626
|
-
return
|
|
794
|
+
return path;
|
|
627
795
|
}
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region ---- Public API: Activity Definitions ----
|
|
628
798
|
/**
|
|
629
|
-
* Get activity
|
|
799
|
+
* Get activity definitions for a category with smart caching
|
|
800
|
+
*
|
|
801
|
+
* Optimization: Checks itemsCount before querying
|
|
802
|
+
* - If itemsCount = 0, returns empty array (no API call)
|
|
803
|
+
* - If itemsCount > 0, loads and caches activity definitions
|
|
804
|
+
* - Returns cached result on subsequent calls
|
|
805
|
+
*
|
|
806
|
+
* @param categoryId - Category ID to get activity definitions from
|
|
807
|
+
* @returns Array of activity definitions
|
|
630
808
|
*/
|
|
631
|
-
|
|
632
|
-
|
|
809
|
+
async getActivitiesByCategoryId(categoryId) {
|
|
810
|
+
// ✅ Fast path: Return cached result
|
|
811
|
+
if (this.activitiesByCategory.has(categoryId)) {
|
|
812
|
+
return this.activitiesByCategory.get(categoryId);
|
|
813
|
+
}
|
|
814
|
+
// ✅ Smart optimization: Check itemsCount before querying
|
|
815
|
+
const category = await this.getCategoryById(categoryId);
|
|
816
|
+
if (category && category.itemsCount !== undefined && category.itemsCount === 0) {
|
|
817
|
+
// Category has no activities - cache empty array and skip API call
|
|
818
|
+
const emptyArray = [];
|
|
819
|
+
this.activitiesByCategory.set(categoryId, emptyArray);
|
|
820
|
+
return emptyArray;
|
|
821
|
+
}
|
|
822
|
+
// ✅ Prevent duplicate requests
|
|
823
|
+
if (this.pendingActivitiesRequests.has(categoryId)) {
|
|
824
|
+
return this.pendingActivitiesRequests.get(categoryId);
|
|
825
|
+
}
|
|
826
|
+
// ✅ Load from providers
|
|
827
|
+
const requestPromise = this.loadActivitiesFromProviders(categoryId);
|
|
828
|
+
this.pendingActivitiesRequests.set(categoryId, requestPromise);
|
|
829
|
+
return requestPromise;
|
|
633
830
|
}
|
|
634
831
|
/**
|
|
635
|
-
* Get
|
|
832
|
+
* Get single activity definition by name with O(1) lookup
|
|
833
|
+
*
|
|
834
|
+
* Optimization: Uses Map for instant retrieval
|
|
835
|
+
*
|
|
836
|
+
* @param name - Activity name (unique identifier and command key)
|
|
837
|
+
* @returns Activity definition or undefined if not found
|
|
636
838
|
*/
|
|
637
|
-
|
|
638
|
-
|
|
839
|
+
async getActivityByName(name) {
|
|
840
|
+
// ✅ Fast path: O(1) lookup in cache
|
|
841
|
+
if (this.activitiesByName.has(name)) {
|
|
842
|
+
return this.activitiesByName.get(name);
|
|
843
|
+
}
|
|
844
|
+
// ✅ Prevent duplicate requests
|
|
845
|
+
if (this.pendingActivityRequests.has(name)) {
|
|
846
|
+
return this.pendingActivityRequests.get(name);
|
|
847
|
+
}
|
|
848
|
+
// ✅ Load from providers
|
|
849
|
+
const requestPromise = this.loadActivityFromProviders(name);
|
|
850
|
+
this.pendingActivityRequests.set(name, requestPromise);
|
|
851
|
+
return requestPromise;
|
|
639
852
|
}
|
|
640
853
|
/**
|
|
641
|
-
* Get
|
|
854
|
+
* Get category ID containing a specific activity definition
|
|
855
|
+
*
|
|
856
|
+
* Optimization: Searches cache first, loads on-demand if needed
|
|
642
857
|
*/
|
|
643
|
-
|
|
644
|
-
|
|
858
|
+
async getCategoryIdByActivityName(activityName) {
|
|
859
|
+
// ✅ Search in cached activity definitions
|
|
860
|
+
for (const [categoryId, definitions] of this.activitiesByCategory.entries()) {
|
|
861
|
+
if (definitions.some(def => def.name === activityName)) {
|
|
862
|
+
return categoryId;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
// ✅ Try loading the activity definition to find its category
|
|
866
|
+
const definition = await this.getActivityByName(activityName);
|
|
867
|
+
if (definition && definition.category) {
|
|
868
|
+
// Try to find category by name/id
|
|
869
|
+
const categories = await this.getCategories();
|
|
870
|
+
const found = categories.find(cat => cat.id === definition.category || cat.title === definition.category);
|
|
871
|
+
if (found) {
|
|
872
|
+
return found.id;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return undefined;
|
|
645
876
|
}
|
|
646
877
|
/**
|
|
647
|
-
* Get
|
|
878
|
+
* Get category path for an activity
|
|
648
879
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
* Injection token for activity providers.
|
|
656
|
-
*/
|
|
657
|
-
const AXP_ACTIVITY_PROVIDER = new InjectionToken('AXP_ACTIVITY_PROVIDER');
|
|
658
|
-
/**
|
|
659
|
-
* Activity Provider Service.
|
|
660
|
-
* Collects all activity providers and manages activity registration.
|
|
661
|
-
*/
|
|
662
|
-
class AXPActivityProviderService {
|
|
663
|
-
constructor() {
|
|
664
|
-
this.activityDescriptors = new Map();
|
|
665
|
-
this.categories = [];
|
|
666
|
-
this.providers = [];
|
|
667
|
-
this.categoryProviders = [];
|
|
668
|
-
this.initialized = false;
|
|
669
|
-
this.commandService = inject(AXPCommandService);
|
|
670
|
-
this.commandRegistry = inject(AXPCommandRegistry);
|
|
880
|
+
async getCategoriesPathByActivityName(activityName) {
|
|
881
|
+
const categoryId = await this.getCategoryIdByActivityName(activityName);
|
|
882
|
+
if (!categoryId) {
|
|
883
|
+
throw new Error(`Activity '${activityName}' not found in any category`);
|
|
884
|
+
}
|
|
885
|
+
return this.getCategoriesPathById(categoryId);
|
|
671
886
|
}
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region ---- Private: Data Loading ----
|
|
672
889
|
/**
|
|
673
|
-
*
|
|
890
|
+
* Load categories from providers and cache results
|
|
891
|
+
*
|
|
892
|
+
* Optimization: Tracks provider ownership to avoid unnecessary API calls
|
|
893
|
+
* - For root (parentId = undefined): Query ALL providers
|
|
894
|
+
* - For children: Only query the provider that owns the parent
|
|
674
895
|
*/
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
896
|
+
async loadCategoriesFromProviders(parentId) {
|
|
897
|
+
try {
|
|
898
|
+
const resolvedProviders = await Promise.allSettled(this.categoryProviders);
|
|
899
|
+
const categories = [];
|
|
900
|
+
// Determine which provider(s) to query
|
|
901
|
+
const providerIndicesToQuery = parentId
|
|
902
|
+
? this.getProviderIndexForCategory(parentId)
|
|
903
|
+
: null; // Root: query all providers
|
|
904
|
+
for (let i = 0; i < resolvedProviders.length; i++) {
|
|
905
|
+
const p = resolvedProviders[i];
|
|
906
|
+
// Skip if we have a specific provider index and this isn't it
|
|
907
|
+
if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {
|
|
911
|
+
try {
|
|
912
|
+
const cats = await p.value.getList(parentId);
|
|
913
|
+
if (Array.isArray(cats) && cats.length > 0) {
|
|
914
|
+
categories.push(...cats);
|
|
915
|
+
// ✅ Track ownership: This provider INDEX owns these categories
|
|
916
|
+
cats.forEach(cat => this.categoryOwnership.set(cat.id, i));
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
catch {
|
|
920
|
+
// Continue on error - try other providers
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
// ✅ Cache results for fast subsequent access
|
|
925
|
+
this.categoriesByParentId.set(parentId, categories);
|
|
926
|
+
categories.forEach(cat => this.categoriesById.set(cat.id, cat));
|
|
927
|
+
return categories;
|
|
928
|
+
}
|
|
929
|
+
finally {
|
|
930
|
+
this.pendingCategoriesRequests.delete(parentId);
|
|
679
931
|
}
|
|
680
932
|
}
|
|
681
933
|
/**
|
|
682
|
-
*
|
|
934
|
+
* Get the provider index that owns a specific category
|
|
935
|
+
*
|
|
936
|
+
* @returns Array with provider index, or null if ownership unknown (query all)
|
|
683
937
|
*/
|
|
684
|
-
|
|
685
|
-
this.
|
|
686
|
-
if (
|
|
687
|
-
|
|
938
|
+
getProviderIndexForCategory(categoryId) {
|
|
939
|
+
const ownerIndex = this.categoryOwnership.get(categoryId);
|
|
940
|
+
if (ownerIndex !== undefined) {
|
|
941
|
+
return [ownerIndex];
|
|
688
942
|
}
|
|
943
|
+
// Ownership unknown - will query all providers (fallback)
|
|
944
|
+
return null;
|
|
689
945
|
}
|
|
690
946
|
/**
|
|
691
|
-
*
|
|
947
|
+
* Load activity definitions from providers and cache results
|
|
948
|
+
*
|
|
949
|
+
* Optimization: Only queries the provider that owns the category
|
|
950
|
+
* Uses provider INDEX to match category provider with activity provider
|
|
692
951
|
*/
|
|
693
|
-
async
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
952
|
+
async loadActivitiesFromProviders(categoryId) {
|
|
953
|
+
try {
|
|
954
|
+
const resolvedProviders = await Promise.allSettled(this.activityProviders);
|
|
955
|
+
const definitions = [];
|
|
956
|
+
// ✅ Smart routing: Get provider INDEX that owns this category
|
|
957
|
+
const ownerIndex = this.categoryOwnership.get(categoryId);
|
|
958
|
+
const providerIndicesToQuery = ownerIndex !== undefined ? [ownerIndex] : null;
|
|
959
|
+
for (let i = 0; i < resolvedProviders.length; i++) {
|
|
960
|
+
const p = resolvedProviders[i];
|
|
961
|
+
// Skip if we have a specific provider index and this isn't it
|
|
962
|
+
if (providerIndicesToQuery !== null && !providerIndicesToQuery.includes(i)) {
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
if (p.status === 'fulfilled' && p.value && typeof p.value.getList === 'function') {
|
|
966
|
+
try {
|
|
967
|
+
const defs = await p.value.getList(categoryId);
|
|
968
|
+
if (Array.isArray(defs)) {
|
|
969
|
+
definitions.push(...defs);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
catch {
|
|
973
|
+
// Continue on error - try other providers
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
// ✅ Cache results for fast subsequent access
|
|
978
|
+
this.activitiesByCategory.set(categoryId, definitions);
|
|
979
|
+
definitions.forEach(def => {
|
|
980
|
+
if (def.name) {
|
|
981
|
+
this.activitiesByName.set(def.name, def);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
return definitions;
|
|
699
985
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
await this.initializeProvider(provider);
|
|
986
|
+
finally {
|
|
987
|
+
this.pendingActivitiesRequests.delete(categoryId);
|
|
703
988
|
}
|
|
704
|
-
this.initialized = true;
|
|
705
989
|
}
|
|
706
990
|
/**
|
|
707
|
-
*
|
|
991
|
+
* Load single activity definition from providers and cache result
|
|
708
992
|
*/
|
|
709
|
-
|
|
710
|
-
|
|
993
|
+
async loadActivityFromProviders(name) {
|
|
994
|
+
try {
|
|
995
|
+
const resolvedProviders = await Promise.allSettled(this.activityProviders);
|
|
996
|
+
// Try providers first
|
|
997
|
+
for (const p of resolvedProviders) {
|
|
998
|
+
if (p.status === 'fulfilled' && p.value && typeof p.value.getById === 'function') {
|
|
999
|
+
try {
|
|
1000
|
+
const result = await p.value.getById(name);
|
|
1001
|
+
if (result) {
|
|
1002
|
+
this.activitiesByName.set(name, result);
|
|
1003
|
+
return result;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
catch {
|
|
1007
|
+
// Continue on error
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
// Fallback: Search in cached activity definitions
|
|
1012
|
+
for (const definitions of this.activitiesByCategory.values()) {
|
|
1013
|
+
const found = definitions.find(def => def.name === name);
|
|
1014
|
+
if (found) {
|
|
1015
|
+
this.activitiesByName.set(name, found);
|
|
1016
|
+
return found;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
return undefined;
|
|
1020
|
+
}
|
|
1021
|
+
finally {
|
|
1022
|
+
this.pendingActivityRequests.delete(name);
|
|
1023
|
+
}
|
|
711
1024
|
}
|
|
712
1025
|
/**
|
|
713
|
-
*
|
|
1026
|
+
* Breadth-first search through category hierarchy
|
|
714
1027
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
1028
|
+
async searchCategoryInHierarchy(categoryId) {
|
|
1029
|
+
const searchQueue = [undefined];
|
|
1030
|
+
const searched = new Set();
|
|
1031
|
+
while (searchQueue.length > 0) {
|
|
1032
|
+
const parentId = searchQueue.shift();
|
|
1033
|
+
if (searched.has(parentId))
|
|
1034
|
+
continue;
|
|
1035
|
+
searched.add(parentId);
|
|
1036
|
+
const categories = await this.getCategories(parentId);
|
|
1037
|
+
const found = categories.find(cat => cat.id === categoryId);
|
|
1038
|
+
if (found) {
|
|
1039
|
+
return found;
|
|
1040
|
+
}
|
|
1041
|
+
// ✅ Optimization: Only search children if childrenCount > 0
|
|
1042
|
+
for (const category of categories) {
|
|
1043
|
+
if (category.childrenCount > 0 && !searched.has(category.id)) {
|
|
1044
|
+
searchQueue.push(category.id);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return undefined;
|
|
717
1049
|
}
|
|
1050
|
+
//#endregion
|
|
1051
|
+
//#region ---- Cache Management ----
|
|
718
1052
|
/**
|
|
719
|
-
*
|
|
1053
|
+
* Check if category has children (uses cached count)
|
|
720
1054
|
*/
|
|
721
|
-
|
|
722
|
-
|
|
1055
|
+
categoryHasChildren(categoryId) {
|
|
1056
|
+
const category = this.categoriesById.get(categoryId);
|
|
1057
|
+
return category ? category.childrenCount > 0 : false;
|
|
723
1058
|
}
|
|
724
1059
|
/**
|
|
725
|
-
*
|
|
1060
|
+
* Check if category has activities (uses cached count)
|
|
726
1061
|
*/
|
|
727
|
-
|
|
728
|
-
|
|
1062
|
+
categoryHasActivities(categoryId) {
|
|
1063
|
+
const category = this.categoriesById.get(categoryId);
|
|
1064
|
+
return category ? (category.itemsCount ?? 0) > 0 : false;
|
|
729
1065
|
}
|
|
730
1066
|
/**
|
|
731
|
-
*
|
|
1067
|
+
* Clear all caches
|
|
732
1068
|
*/
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
return null;
|
|
743
|
-
}
|
|
744
|
-
// Create command instance
|
|
745
|
-
const command = await loader();
|
|
746
|
-
return command;
|
|
747
|
-
}
|
|
748
|
-
catch (error) {
|
|
749
|
-
return null;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
// ============================================
|
|
753
|
-
// PRIVATE METHODS
|
|
754
|
-
// ============================================
|
|
755
|
-
async initializeProvider(provider) {
|
|
756
|
-
const context = {
|
|
757
|
-
registerActivity: (config) => {
|
|
758
|
-
this.activityDescriptors.set(config.key, config.descriptor);
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
await provider.provide(context);
|
|
1069
|
+
clearAllCache() {
|
|
1070
|
+
this.categoriesById.clear();
|
|
1071
|
+
this.categoriesByParentId.clear();
|
|
1072
|
+
this.activitiesByCategory.clear();
|
|
1073
|
+
this.activitiesByName.clear();
|
|
1074
|
+
this.categoryOwnership.clear();
|
|
1075
|
+
this.pendingCategoriesRequests.clear();
|
|
1076
|
+
this.pendingActivitiesRequests.clear();
|
|
1077
|
+
this.pendingActivityRequests.clear();
|
|
762
1078
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
1079
|
+
/**
|
|
1080
|
+
* Clear categories cache only
|
|
1081
|
+
*/
|
|
1082
|
+
clearCategoriesCache() {
|
|
1083
|
+
this.categoriesById.clear();
|
|
1084
|
+
this.categoriesByParentId.clear();
|
|
1085
|
+
this.categoryOwnership.clear();
|
|
1086
|
+
this.pendingCategoriesRequests.clear();
|
|
770
1087
|
}
|
|
771
|
-
|
|
772
|
-
|
|
1088
|
+
/**
|
|
1089
|
+
* Clear activities cache only
|
|
1090
|
+
*/
|
|
1091
|
+
clearActivitiesCache() {
|
|
1092
|
+
this.activitiesByCategory.clear();
|
|
1093
|
+
this.activitiesByName.clear();
|
|
1094
|
+
this.pendingActivitiesRequests.clear();
|
|
1095
|
+
this.pendingActivityRequests.clear();
|
|
1096
|
+
}
|
|
1097
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityDefinitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1098
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityDefinitionService, providedIn: 'root' }); }
|
|
773
1099
|
}
|
|
774
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type:
|
|
1100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityDefinitionService, decorators: [{
|
|
775
1101
|
type: Injectable,
|
|
776
1102
|
args: [{
|
|
777
|
-
providedIn: 'root'
|
|
1103
|
+
providedIn: 'root',
|
|
778
1104
|
}]
|
|
779
1105
|
}] });
|
|
780
1106
|
|
|
781
|
-
/**
|
|
782
|
-
* Injection token for activity category providers.
|
|
783
|
-
*/
|
|
784
|
-
const AXP_ACTIVITY_CATEGORY_PROVIDER = new InjectionToken('AXP_ACTIVITY_CATEGORY_PROVIDER');
|
|
785
|
-
class AXPActivityCategoryProviderService {
|
|
786
|
-
constructor(parent, providers = []) {
|
|
787
|
-
this.parent = parent;
|
|
788
|
-
this.providers = providers;
|
|
789
|
-
this.categories = new Map();
|
|
790
|
-
this.isInitialized = false;
|
|
791
|
-
if (!parent) {
|
|
792
|
-
this.initialize();
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
async initialize() {
|
|
796
|
-
if (this.isInitialized) {
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
for (const provider of this.providers) {
|
|
800
|
-
await provider.provide({
|
|
801
|
-
registerCategories: (categories) => {
|
|
802
|
-
categories.forEach(cat => this.categories.set(cat.name, cat));
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
this.isInitialized = true;
|
|
807
|
-
}
|
|
808
|
-
getAllCategories() {
|
|
809
|
-
return Array.from(this.categories.values()).sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
810
|
-
}
|
|
811
|
-
getCategory(name) {
|
|
812
|
-
return this.categories.get(name);
|
|
813
|
-
}
|
|
814
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityCategoryProviderService, deps: [{ token: AXPActivityCategoryProviderService, optional: true, skipSelf: true }, { token: AXP_ACTIVITY_CATEGORY_PROVIDER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
815
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityCategoryProviderService, providedIn: 'root' }); }
|
|
816
|
-
}
|
|
817
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPActivityCategoryProviderService, decorators: [{
|
|
818
|
-
type: Injectable,
|
|
819
|
-
args: [{ providedIn: 'root' }]
|
|
820
|
-
}], ctorParameters: () => [{ type: AXPActivityCategoryProviderService, decorators: [{
|
|
821
|
-
type: Optional
|
|
822
|
-
}, {
|
|
823
|
-
type: SkipSelf
|
|
824
|
-
}] }, { type: undefined, decorators: [{
|
|
825
|
-
type: Optional
|
|
826
|
-
}, {
|
|
827
|
-
type: Inject,
|
|
828
|
-
args: [AXP_ACTIVITY_CATEGORY_PROVIDER]
|
|
829
|
-
}] }] });
|
|
830
|
-
|
|
831
1107
|
/**
|
|
832
1108
|
* Abstract service for workflow execution operations.
|
|
833
1109
|
*
|
|
@@ -1177,1340 +1453,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
1177
1453
|
|
|
1178
1454
|
// Production Workflow Coordinator (Frontend/Backend Separation)
|
|
1179
1455
|
|
|
1180
|
-
/**
|
|
1181
|
-
* WriteLine Activity - Simple console logging activity.
|
|
1182
|
-
*
|
|
1183
|
-
* Usage:
|
|
1184
|
-
* ```typescript
|
|
1185
|
-
* const activity = new WriteLine();
|
|
1186
|
-
* await activity.execute({ text: 'Hello World' });
|
|
1187
|
-
* ```
|
|
1188
|
-
*/
|
|
1189
|
-
class WriteLine extends Activity {
|
|
1190
|
-
constructor() {
|
|
1191
|
-
super('WriteLine');
|
|
1192
|
-
}
|
|
1193
|
-
async execute(input) {
|
|
1194
|
-
const text = input.text || '';
|
|
1195
|
-
if (text !== undefined && text !== null) {
|
|
1196
|
-
console.log(`[WriteLine] ${text}`);
|
|
1197
|
-
}
|
|
1198
|
-
return this.createResult(undefined, 'Done');
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
var writeLine_activity = /*#__PURE__*/Object.freeze({
|
|
1203
|
-
__proto__: null,
|
|
1204
|
-
WriteLine: WriteLine
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
/**
|
|
1208
|
-
* Sequence Activity - Executes activities in sequential order.
|
|
1209
|
-
*
|
|
1210
|
-
* Usage:
|
|
1211
|
-
* ```typescript
|
|
1212
|
-
* const sequence = new Sequence();
|
|
1213
|
-
* sequence.activities = [activity1, activity2, activity3];
|
|
1214
|
-
* await sequence.execute({});
|
|
1215
|
-
* ```
|
|
1216
|
-
*/
|
|
1217
|
-
class Sequence extends Activity {
|
|
1218
|
-
constructor() {
|
|
1219
|
-
super('Sequence');
|
|
1220
|
-
/**
|
|
1221
|
-
* Activities to execute in sequence.
|
|
1222
|
-
*/
|
|
1223
|
-
this.activities = [];
|
|
1224
|
-
}
|
|
1225
|
-
async execute(input) {
|
|
1226
|
-
// Execute all activities in sequence
|
|
1227
|
-
for (const activity of this.activities) {
|
|
1228
|
-
const result = await activity.execute(input);
|
|
1229
|
-
if (!result.success) {
|
|
1230
|
-
return {
|
|
1231
|
-
success: false,
|
|
1232
|
-
message: result.message,
|
|
1233
|
-
data: {
|
|
1234
|
-
output: undefined,
|
|
1235
|
-
outcomes: {
|
|
1236
|
-
Failed: true,
|
|
1237
|
-
},
|
|
1238
|
-
},
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
return this.createResult(undefined, 'Done');
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
var sequence_activity = /*#__PURE__*/Object.freeze({
|
|
1247
|
-
__proto__: null,
|
|
1248
|
-
Sequence: Sequence
|
|
1249
|
-
});
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* Show Confirm Dialog Activity - Displays confirmation dialog to user.
|
|
1253
|
-
*
|
|
1254
|
-
* Has two outcomes:
|
|
1255
|
-
* - 'Confirmed': User clicked confirm/yes
|
|
1256
|
-
* - 'Cancelled': User clicked cancel/no
|
|
1257
|
-
*
|
|
1258
|
-
* Usage:
|
|
1259
|
-
* ```typescript
|
|
1260
|
-
* const dialog = new ShowConfirmDialog();
|
|
1261
|
-
* await dialog.execute({
|
|
1262
|
-
* title: 'Confirm Delete',
|
|
1263
|
-
* message: 'Are you sure?',
|
|
1264
|
-
* color: 'danger'
|
|
1265
|
-
* });
|
|
1266
|
-
* ```
|
|
1267
|
-
*/
|
|
1268
|
-
class ShowConfirmDialog extends Activity {
|
|
1269
|
-
//#endregion
|
|
1270
|
-
constructor() {
|
|
1271
|
-
super('ShowConfirmDialog');
|
|
1272
|
-
//#region ---- Services & Dependencies ----
|
|
1273
|
-
this.dialogService = inject(AXDialogService);
|
|
1274
|
-
this.translationService = inject(AXTranslationService);
|
|
1275
|
-
}
|
|
1276
|
-
async execute(input) {
|
|
1277
|
-
const { title = '', message = '', color = 'primary', defaultAction = 'cancel', align = 'horizontal', backdrop = false } = input;
|
|
1278
|
-
// Translate title and message only if they start with '@' (translation key)
|
|
1279
|
-
// Otherwise use the text as-is
|
|
1280
|
-
const translatedTitle = title
|
|
1281
|
-
? (title.startsWith('@')
|
|
1282
|
-
? await this.translationService.translateAsync(title) || title
|
|
1283
|
-
: title)
|
|
1284
|
-
: '';
|
|
1285
|
-
const translatedMessage = message
|
|
1286
|
-
? (message.startsWith('@')
|
|
1287
|
-
? await this.translationService.translateAsync(message) || message
|
|
1288
|
-
: message)
|
|
1289
|
-
: '';
|
|
1290
|
-
try {
|
|
1291
|
-
const confirmResult = await this.dialogService.confirm(translatedTitle, translatedMessage, color, align, backdrop, defaultAction);
|
|
1292
|
-
const result = confirmResult.result;
|
|
1293
|
-
const action = result ? 'confirm' : 'cancel';
|
|
1294
|
-
return this.createResult({
|
|
1295
|
-
result,
|
|
1296
|
-
action
|
|
1297
|
-
}, result ? 'Confirmed' : 'Cancelled');
|
|
1298
|
-
}
|
|
1299
|
-
catch (err) {
|
|
1300
|
-
console.error('[ShowConfirmDialog] Error showing dialog:', err);
|
|
1301
|
-
return {
|
|
1302
|
-
success: false,
|
|
1303
|
-
message: {
|
|
1304
|
-
text: err instanceof Error ? err.message : 'Failed to show confirm dialog',
|
|
1305
|
-
},
|
|
1306
|
-
data: {
|
|
1307
|
-
output: {
|
|
1308
|
-
result: false,
|
|
1309
|
-
action: 'error',
|
|
1310
|
-
},
|
|
1311
|
-
outcomes: {
|
|
1312
|
-
Cancelled: true,
|
|
1313
|
-
},
|
|
1314
|
-
},
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
var showConfirmDialog_activity = /*#__PURE__*/Object.freeze({
|
|
1321
|
-
__proto__: null,
|
|
1322
|
-
ShowConfirmDialog: ShowConfirmDialog
|
|
1323
|
-
});
|
|
1324
|
-
|
|
1325
|
-
/**
|
|
1326
|
-
* Show Alert Dialog Activity - Displays alert dialog to user.
|
|
1327
|
-
*
|
|
1328
|
-
* Has one outcome:
|
|
1329
|
-
* - 'Done': User clicked OK
|
|
1330
|
-
*
|
|
1331
|
-
* Usage:
|
|
1332
|
-
* ```typescript
|
|
1333
|
-
* const dialog = new ShowAlertDialog();
|
|
1334
|
-
* await dialog.execute({
|
|
1335
|
-
* title: 'Alert',
|
|
1336
|
-
* message: 'This is an alert',
|
|
1337
|
-
* color: 'info'
|
|
1338
|
-
* });
|
|
1339
|
-
* ```
|
|
1340
|
-
*/
|
|
1341
|
-
class ShowAlertDialog extends Activity {
|
|
1342
|
-
//#endregion
|
|
1343
|
-
constructor() {
|
|
1344
|
-
super('ShowAlertDialog');
|
|
1345
|
-
//#region ---- Services & Dependencies ----
|
|
1346
|
-
this.dialogService = inject(AXDialogService);
|
|
1347
|
-
this.translationService = inject(AXTranslationService);
|
|
1348
|
-
}
|
|
1349
|
-
async execute(input) {
|
|
1350
|
-
const { title = '', message = '', color = 'primary' } = input;
|
|
1351
|
-
// Translate title and message only if they start with '@' (translation key)
|
|
1352
|
-
// Otherwise use the text as-is
|
|
1353
|
-
const translatedTitle = title
|
|
1354
|
-
? (title.startsWith('@')
|
|
1355
|
-
? await this.translationService.translateAsync(title) || title
|
|
1356
|
-
: title)
|
|
1357
|
-
: '';
|
|
1358
|
-
const translatedMessage = message
|
|
1359
|
-
? (message.startsWith('@')
|
|
1360
|
-
? await this.translationService.translateAsync(message) || message
|
|
1361
|
-
: message)
|
|
1362
|
-
: '';
|
|
1363
|
-
try {
|
|
1364
|
-
await this.dialogService.alert(translatedTitle, translatedMessage, color);
|
|
1365
|
-
return this.createResult({
|
|
1366
|
-
result: true,
|
|
1367
|
-
action: 'ok'
|
|
1368
|
-
}, 'Done');
|
|
1369
|
-
}
|
|
1370
|
-
catch (err) {
|
|
1371
|
-
console.error('[ShowAlertDialog] Error showing dialog:', err);
|
|
1372
|
-
return {
|
|
1373
|
-
success: false,
|
|
1374
|
-
message: {
|
|
1375
|
-
text: err instanceof Error ? err.message : 'Failed to show alert dialog',
|
|
1376
|
-
},
|
|
1377
|
-
data: {
|
|
1378
|
-
output: {
|
|
1379
|
-
result: false,
|
|
1380
|
-
action: 'error',
|
|
1381
|
-
},
|
|
1382
|
-
outcomes: {
|
|
1383
|
-
Failed: true,
|
|
1384
|
-
},
|
|
1385
|
-
},
|
|
1386
|
-
};
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
var showAlertDialog_activity = /*#__PURE__*/Object.freeze({
|
|
1392
|
-
__proto__: null,
|
|
1393
|
-
ShowAlertDialog: ShowAlertDialog
|
|
1394
|
-
});
|
|
1395
|
-
|
|
1396
|
-
/**
|
|
1397
|
-
* Show Dialog Layout Builder Activity - Displays dialog using Layout Builder.
|
|
1398
|
-
*
|
|
1399
|
-
* This activity allows you to create custom dialogs using the Layout Builder API.
|
|
1400
|
-
* It accepts JSON-serializable content (AXPWidgetNode) and actions configuration.
|
|
1401
|
-
*
|
|
1402
|
-
* The content can be created using Layout Builder and then converted to JSON:
|
|
1403
|
-
* ```typescript
|
|
1404
|
-
* const builder = layoutBuilderService.create();
|
|
1405
|
-
* builder.flex(flex => {
|
|
1406
|
-
* flex.setDirection('column')
|
|
1407
|
-
* .formField('First Name', field => {
|
|
1408
|
-
* field.path('firstName');
|
|
1409
|
-
* field.textBox({ placeholder: 'Enter first name' });
|
|
1410
|
-
* });
|
|
1411
|
-
* });
|
|
1412
|
-
* const contentNode = builder.build();
|
|
1413
|
-
* ```
|
|
1414
|
-
*
|
|
1415
|
-
* Usage in Workflow:
|
|
1416
|
-
* ```typescript
|
|
1417
|
-
* const dialog = new ShowDialogLayoutBuilder();
|
|
1418
|
-
* await dialog.execute({
|
|
1419
|
-
* title: 'User Information',
|
|
1420
|
-
* size: 'md',
|
|
1421
|
-
* context: { firstName: '', lastName: '' },
|
|
1422
|
-
* content: {
|
|
1423
|
-
* type: 'flex-layout',
|
|
1424
|
-
* mode: 'edit',
|
|
1425
|
-
* options: {
|
|
1426
|
-
* flexDirection: 'column',
|
|
1427
|
-
* gap: '16px'
|
|
1428
|
-
* },
|
|
1429
|
-
* children: [
|
|
1430
|
-
* {
|
|
1431
|
-
* type: 'form-field',
|
|
1432
|
-
* mode: 'edit',
|
|
1433
|
-
* options: {
|
|
1434
|
-
* label: 'First Name',
|
|
1435
|
-
* showLabel: true
|
|
1436
|
-
* },
|
|
1437
|
-
* children: [{
|
|
1438
|
-
* type: 'text-editor',
|
|
1439
|
-
* path: 'firstName',
|
|
1440
|
-
* options: {
|
|
1441
|
-
* placeholder: 'Enter first name'
|
|
1442
|
-
* }
|
|
1443
|
-
* }]
|
|
1444
|
-
* }
|
|
1445
|
-
* ]
|
|
1446
|
-
* },
|
|
1447
|
-
* actions: {
|
|
1448
|
-
* cancel: '@general:actions.cancel.title',
|
|
1449
|
-
* submit: '@general:actions.submit.title',
|
|
1450
|
-
* custom: [{
|
|
1451
|
-
* title: 'Save Draft',
|
|
1452
|
-
* icon: 'fa-save',
|
|
1453
|
-
* color: 'secondary',
|
|
1454
|
-
* command: { name: 'save-draft' }
|
|
1455
|
-
* }]
|
|
1456
|
-
* }
|
|
1457
|
-
* });
|
|
1458
|
-
* ```
|
|
1459
|
-
*
|
|
1460
|
-
* Usage in JSON Workflow Definition:
|
|
1461
|
-
* ```json
|
|
1462
|
-
* {
|
|
1463
|
-
* "type": "ShowDialogLayoutBuilder",
|
|
1464
|
-
* "properties": {
|
|
1465
|
-
* "title": "User Information",
|
|
1466
|
-
* "size": "md",
|
|
1467
|
-
* "context": { "firstName": "", "lastName": "" },
|
|
1468
|
-
* "content": {
|
|
1469
|
-
* "type": "flex-layout",
|
|
1470
|
-
* "mode": "edit",
|
|
1471
|
-
* "options": {
|
|
1472
|
-
* "flexDirection": "column",
|
|
1473
|
-
* "gap": "16px"
|
|
1474
|
-
* },
|
|
1475
|
-
* "children": [
|
|
1476
|
-
* {
|
|
1477
|
-
* "type": "form-field",
|
|
1478
|
-
* "mode": "edit",
|
|
1479
|
-
* "options": {
|
|
1480
|
-
* "label": "First Name",
|
|
1481
|
-
* "showLabel": true
|
|
1482
|
-
* },
|
|
1483
|
-
* "children": [{
|
|
1484
|
-
* "type": "text-editor",
|
|
1485
|
-
* "path": "firstName",
|
|
1486
|
-
* "options": {
|
|
1487
|
-
* "placeholder": "Enter first name"
|
|
1488
|
-
* }
|
|
1489
|
-
* }]
|
|
1490
|
-
* }
|
|
1491
|
-
* ]
|
|
1492
|
-
* },
|
|
1493
|
-
* "actions": {
|
|
1494
|
-
* "cancel": "@general:actions.cancel.title",
|
|
1495
|
-
* "submit": "@general:actions.submit.title"
|
|
1496
|
-
* }
|
|
1497
|
-
* }
|
|
1498
|
-
* }
|
|
1499
|
-
* ```
|
|
1500
|
-
*/
|
|
1501
|
-
class ShowDialogLayoutBuilder extends Activity {
|
|
1502
|
-
//#endregion
|
|
1503
|
-
constructor() {
|
|
1504
|
-
super('ShowDialogLayoutBuilder');
|
|
1505
|
-
//#region ---- Services & Dependencies ----
|
|
1506
|
-
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
1507
|
-
}
|
|
1508
|
-
async execute(input) {
|
|
1509
|
-
const { title = '', size = 'md', context = {}, closeButton = false, message, content, actions } = input;
|
|
1510
|
-
try {
|
|
1511
|
-
// Create dialog using layout builder
|
|
1512
|
-
const dialogRef = await this.layoutBuilder
|
|
1513
|
-
.create()
|
|
1514
|
-
.dialog(dialog => {
|
|
1515
|
-
// Set basic dialog options
|
|
1516
|
-
dialog
|
|
1517
|
-
.setTitle(title)
|
|
1518
|
-
.setSize(size)
|
|
1519
|
-
.setCloseButton(closeButton)
|
|
1520
|
-
.setContext(context);
|
|
1521
|
-
// Set message if provided
|
|
1522
|
-
if (message) {
|
|
1523
|
-
dialog.setMessage(message);
|
|
1524
|
-
}
|
|
1525
|
-
// Set content if provided
|
|
1526
|
-
if (content) {
|
|
1527
|
-
// If content is already a flex-layout, use it directly
|
|
1528
|
-
// Otherwise, wrap it in a flex container with column direction
|
|
1529
|
-
if (content.type === 'flex-layout') {
|
|
1530
|
-
// Set content layout directly (accessing internal state of DialogContainerBuilder)
|
|
1531
|
-
dialog.contentLayout = content;
|
|
1532
|
-
}
|
|
1533
|
-
else {
|
|
1534
|
-
// Wrap content in a flex container
|
|
1535
|
-
const wrappedContent = {
|
|
1536
|
-
type: 'flex-layout',
|
|
1537
|
-
mode: 'edit',
|
|
1538
|
-
options: {
|
|
1539
|
-
flexDirection: 'column',
|
|
1540
|
-
gap: '10px',
|
|
1541
|
-
},
|
|
1542
|
-
children: [content],
|
|
1543
|
-
};
|
|
1544
|
-
dialog.contentLayout = wrappedContent;
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
// Set actions if provided
|
|
1548
|
-
if (actions) {
|
|
1549
|
-
dialog.setActions(actionBuilder => {
|
|
1550
|
-
if (actions.cancel) {
|
|
1551
|
-
actionBuilder.cancel(actions.cancel);
|
|
1552
|
-
}
|
|
1553
|
-
if (actions.submit) {
|
|
1554
|
-
actionBuilder.submit(actions.submit);
|
|
1555
|
-
}
|
|
1556
|
-
if (actions.custom) {
|
|
1557
|
-
actions.custom.forEach(action => {
|
|
1558
|
-
actionBuilder.custom(action);
|
|
1559
|
-
});
|
|
1560
|
-
}
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
})
|
|
1564
|
-
.show();
|
|
1565
|
-
// Get user action and context
|
|
1566
|
-
const action = dialogRef.action() || 'cancel';
|
|
1567
|
-
const dialogContext = dialogRef.context();
|
|
1568
|
-
// Determine outcomes
|
|
1569
|
-
const cancelled = action === 'cancel';
|
|
1570
|
-
const confirmed = action === 'submit' || (!cancelled && action !== 'error');
|
|
1571
|
-
// Close dialog
|
|
1572
|
-
dialogRef.close();
|
|
1573
|
-
// Return result with appropriate outcome
|
|
1574
|
-
const outcome = cancelled ? 'Cancelled' : confirmed ? 'Confirmed' : 'Done';
|
|
1575
|
-
return this.createResult({
|
|
1576
|
-
context: dialogContext,
|
|
1577
|
-
action,
|
|
1578
|
-
cancelled,
|
|
1579
|
-
confirmed
|
|
1580
|
-
}, outcome);
|
|
1581
|
-
}
|
|
1582
|
-
catch (err) {
|
|
1583
|
-
console.error('[ShowDialogLayoutBuilder] Error showing dialog:', err);
|
|
1584
|
-
return {
|
|
1585
|
-
success: false,
|
|
1586
|
-
message: {
|
|
1587
|
-
text: err instanceof Error ? err.message : 'Failed to show dialog',
|
|
1588
|
-
},
|
|
1589
|
-
data: {
|
|
1590
|
-
output: {
|
|
1591
|
-
context: {},
|
|
1592
|
-
action: 'error',
|
|
1593
|
-
cancelled: true,
|
|
1594
|
-
confirmed: false,
|
|
1595
|
-
},
|
|
1596
|
-
outcomes: {
|
|
1597
|
-
Error: true,
|
|
1598
|
-
},
|
|
1599
|
-
},
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
/**
|
|
1606
|
-
* Show Toast Activity - Displays toast notification to user.
|
|
1607
|
-
*
|
|
1608
|
-
* Usage:
|
|
1609
|
-
* ```typescript
|
|
1610
|
-
* const toast = new ShowToast();
|
|
1611
|
-
* await toast.execute({
|
|
1612
|
-
* color: 'success',
|
|
1613
|
-
* title: 'Success',
|
|
1614
|
-
* message: 'Operation completed successfully!'
|
|
1615
|
-
* });
|
|
1616
|
-
* ```
|
|
1617
|
-
*/
|
|
1618
|
-
class ShowToast extends Activity {
|
|
1619
|
-
constructor() {
|
|
1620
|
-
super('ShowToast');
|
|
1621
|
-
this.toastService = inject(AXToastService);
|
|
1622
|
-
this.translationService = inject(AXTranslationService);
|
|
1623
|
-
}
|
|
1624
|
-
async execute(input) {
|
|
1625
|
-
const { color = 'primary', title = '', message = '', duration = 3000 } = input;
|
|
1626
|
-
// Translate title and message only if they start with '@' (translation key)
|
|
1627
|
-
// Otherwise use the text as-is
|
|
1628
|
-
const translatedTitle = title
|
|
1629
|
-
? (title.startsWith('@')
|
|
1630
|
-
? await this.translationService.translateAsync(title) || title
|
|
1631
|
-
: title)
|
|
1632
|
-
: '';
|
|
1633
|
-
const translatedMessage = message
|
|
1634
|
-
? (message.startsWith('@')
|
|
1635
|
-
? await this.translationService.translateAsync(message) || message
|
|
1636
|
-
: message)
|
|
1637
|
-
: '';
|
|
1638
|
-
try {
|
|
1639
|
-
await this.toastService.show({
|
|
1640
|
-
color: color,
|
|
1641
|
-
title: translatedTitle,
|
|
1642
|
-
content: translatedMessage,
|
|
1643
|
-
closeButton: true,
|
|
1644
|
-
timeOut: duration,
|
|
1645
|
-
timeOutProgress: true,
|
|
1646
|
-
});
|
|
1647
|
-
return this.createResult(undefined, 'Done');
|
|
1648
|
-
}
|
|
1649
|
-
catch (err) {
|
|
1650
|
-
console.error('[ShowToast] Error showing toast:', err);
|
|
1651
|
-
return {
|
|
1652
|
-
success: false,
|
|
1653
|
-
message: {
|
|
1654
|
-
text: err instanceof Error ? err.message : 'Failed to show toast',
|
|
1655
|
-
},
|
|
1656
|
-
data: {
|
|
1657
|
-
output: undefined,
|
|
1658
|
-
outcomes: {
|
|
1659
|
-
Failed: true,
|
|
1660
|
-
},
|
|
1661
|
-
},
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
var showToast_activity = /*#__PURE__*/Object.freeze({
|
|
1668
|
-
__proto__: null,
|
|
1669
|
-
ShowToast: ShowToast
|
|
1670
|
-
});
|
|
1671
|
-
|
|
1672
|
-
/**
|
|
1673
|
-
* Navigate Activity - Navigates to different pages/routes.
|
|
1674
|
-
*
|
|
1675
|
-
* Usage:
|
|
1676
|
-
* ```typescript
|
|
1677
|
-
* const navigate = new Navigate();
|
|
1678
|
-
* await navigate.execute({
|
|
1679
|
-
* mode: 'route',
|
|
1680
|
-
* route: '/users',
|
|
1681
|
-
* params: { id: '123' }
|
|
1682
|
-
* });
|
|
1683
|
-
* ```
|
|
1684
|
-
*/
|
|
1685
|
-
class Navigate extends Activity {
|
|
1686
|
-
constructor() {
|
|
1687
|
-
super('Navigate');
|
|
1688
|
-
this.router = inject(Router);
|
|
1689
|
-
}
|
|
1690
|
-
async execute(input) {
|
|
1691
|
-
const { mode = 'route', route = '', params = {}, queryParams = {}, entity = '', entityId = '', url = '' } = input;
|
|
1692
|
-
try {
|
|
1693
|
-
switch (mode) {
|
|
1694
|
-
case 'route':
|
|
1695
|
-
await this.router.navigate([route], { queryParams });
|
|
1696
|
-
break;
|
|
1697
|
-
case 'entity-details':
|
|
1698
|
-
const detailsRoute = `/entities/${entity}/details/${entityId}`;
|
|
1699
|
-
await this.router.navigate([detailsRoute], { queryParams });
|
|
1700
|
-
break;
|
|
1701
|
-
case 'entity-list':
|
|
1702
|
-
const listRoute = `/entities/${entity}`;
|
|
1703
|
-
await this.router.navigate([listRoute], { queryParams });
|
|
1704
|
-
break;
|
|
1705
|
-
case 'external':
|
|
1706
|
-
if (url) {
|
|
1707
|
-
window.open(url, '_blank');
|
|
1708
|
-
}
|
|
1709
|
-
break;
|
|
1710
|
-
default:
|
|
1711
|
-
console.error(`[Navigate] Unknown navigation mode: ${mode}`);
|
|
1712
|
-
return {
|
|
1713
|
-
success: false,
|
|
1714
|
-
message: {
|
|
1715
|
-
text: `Unknown navigation mode: ${mode}`,
|
|
1716
|
-
},
|
|
1717
|
-
data: {
|
|
1718
|
-
output: undefined,
|
|
1719
|
-
outcomes: {
|
|
1720
|
-
Failed: true,
|
|
1721
|
-
},
|
|
1722
|
-
},
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1725
|
-
return this.createResult(undefined, 'Done');
|
|
1726
|
-
}
|
|
1727
|
-
catch (err) {
|
|
1728
|
-
console.error('[Navigate] Error navigating:', err);
|
|
1729
|
-
return {
|
|
1730
|
-
success: false,
|
|
1731
|
-
message: {
|
|
1732
|
-
text: err instanceof Error ? err.message : 'Failed to navigate',
|
|
1733
|
-
},
|
|
1734
|
-
data: {
|
|
1735
|
-
output: undefined,
|
|
1736
|
-
outcomes: {
|
|
1737
|
-
Failed: true,
|
|
1738
|
-
},
|
|
1739
|
-
},
|
|
1740
|
-
};
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
var navigate_activity = /*#__PURE__*/Object.freeze({
|
|
1746
|
-
__proto__: null,
|
|
1747
|
-
Navigate: Navigate
|
|
1748
|
-
});
|
|
1749
|
-
|
|
1750
|
-
/**
|
|
1751
|
-
* Set Variable Activity - Sets a variable value in workflow context.
|
|
1752
|
-
*
|
|
1753
|
-
* Usage:
|
|
1754
|
-
* ```typescript
|
|
1755
|
-
* const setVar = new SetVariable();
|
|
1756
|
-
* await setVar.execute({
|
|
1757
|
-
* variableName: 'userId',
|
|
1758
|
-
* value: '12345'
|
|
1759
|
-
* });
|
|
1760
|
-
* ```
|
|
1761
|
-
*/
|
|
1762
|
-
class SetVariable extends Activity {
|
|
1763
|
-
constructor() {
|
|
1764
|
-
super('workflow-activity:set-variable', 'Set Variable');
|
|
1765
|
-
}
|
|
1766
|
-
async execute(input) {
|
|
1767
|
-
const { variableName, value } = input;
|
|
1768
|
-
try {
|
|
1769
|
-
// In a real implementation, this would set the variable in workflow context
|
|
1770
|
-
// For now, we'll just log it
|
|
1771
|
-
console.log(`[SetVariable] Setting ${variableName} = ${JSON.stringify(value)}`);
|
|
1772
|
-
return this.createResult(undefined, 'Done');
|
|
1773
|
-
}
|
|
1774
|
-
catch (err) {
|
|
1775
|
-
console.error('[SetVariable] Error setting variable:', err);
|
|
1776
|
-
return {
|
|
1777
|
-
success: false,
|
|
1778
|
-
message: {
|
|
1779
|
-
text: err instanceof Error ? err.message : 'Failed to set variable',
|
|
1780
|
-
},
|
|
1781
|
-
data: {
|
|
1782
|
-
output: undefined,
|
|
1783
|
-
outcomes: {
|
|
1784
|
-
Failed: true,
|
|
1785
|
-
},
|
|
1786
|
-
},
|
|
1787
|
-
};
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
var setVariable_activity = /*#__PURE__*/Object.freeze({
|
|
1793
|
-
__proto__: null,
|
|
1794
|
-
SetVariable: SetVariable
|
|
1795
|
-
});
|
|
1796
|
-
|
|
1797
|
-
/**
|
|
1798
|
-
* Dispatch Event Activity - Dispatches an event to the system.
|
|
1799
|
-
*
|
|
1800
|
-
* Usage:
|
|
1801
|
-
* ```typescript
|
|
1802
|
-
* const dispatch = new DispatchEvent();
|
|
1803
|
-
* await dispatch.execute({
|
|
1804
|
-
* eventName: 'user-created',
|
|
1805
|
-
* eventData: { userId: '123', name: 'John' }
|
|
1806
|
-
* });
|
|
1807
|
-
* ```
|
|
1808
|
-
*/
|
|
1809
|
-
class DispatchEvent extends Activity {
|
|
1810
|
-
constructor() {
|
|
1811
|
-
super('DispatchEvent');
|
|
1812
|
-
}
|
|
1813
|
-
async execute(input) {
|
|
1814
|
-
const { eventName, eventData } = input;
|
|
1815
|
-
try {
|
|
1816
|
-
// In a real implementation, this would dispatch the event through an event bus
|
|
1817
|
-
// For now, we'll just log it
|
|
1818
|
-
console.log(`[DispatchEvent] Dispatching event: ${eventName}`, eventData);
|
|
1819
|
-
return this.createResult(undefined, 'Done');
|
|
1820
|
-
}
|
|
1821
|
-
catch (err) {
|
|
1822
|
-
console.error('[DispatchEvent] Error dispatching event:', err);
|
|
1823
|
-
return {
|
|
1824
|
-
success: false,
|
|
1825
|
-
message: {
|
|
1826
|
-
text: err instanceof Error ? err.message : 'Failed to dispatch event',
|
|
1827
|
-
},
|
|
1828
|
-
data: {
|
|
1829
|
-
output: undefined,
|
|
1830
|
-
outcomes: {
|
|
1831
|
-
Failed: true,
|
|
1832
|
-
},
|
|
1833
|
-
},
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
var dispatchEvent_activity = /*#__PURE__*/Object.freeze({
|
|
1840
|
-
__proto__: null,
|
|
1841
|
-
DispatchEvent: DispatchEvent
|
|
1842
|
-
});
|
|
1843
|
-
|
|
1844
|
-
/**
|
|
1845
|
-
* If Activity - Conditional execution based on a condition.
|
|
1846
|
-
*
|
|
1847
|
-
* Usage:
|
|
1848
|
-
* ```typescript
|
|
1849
|
-
* const ifActivity = new If();
|
|
1850
|
-
* ifActivity.condition = '{{user.isAdmin}}';
|
|
1851
|
-
* ifActivity.thenActivities = [activity1, activity2];
|
|
1852
|
-
* ifActivity.elseActivities = [activity3];
|
|
1853
|
-
* ```
|
|
1854
|
-
*/
|
|
1855
|
-
class If extends Activity {
|
|
1856
|
-
constructor() {
|
|
1857
|
-
super('If');
|
|
1858
|
-
}
|
|
1859
|
-
async execute(input) {
|
|
1860
|
-
const { condition, thenActivities = [], elseActivities = [] } = input;
|
|
1861
|
-
try {
|
|
1862
|
-
// Evaluate condition (simplified - in real implementation, use expression evaluator)
|
|
1863
|
-
const conditionResult = this.evaluateCondition(condition);
|
|
1864
|
-
let result;
|
|
1865
|
-
let activities;
|
|
1866
|
-
if (conditionResult) {
|
|
1867
|
-
activities = thenActivities;
|
|
1868
|
-
result = { branch: 'then' };
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
activities = elseActivities;
|
|
1872
|
-
result = { branch: 'else' };
|
|
1873
|
-
}
|
|
1874
|
-
// Execute activities in the chosen branch
|
|
1875
|
-
for (const activity of activities) {
|
|
1876
|
-
const activityResult = await activity.execute(input);
|
|
1877
|
-
if (!activityResult.success) {
|
|
1878
|
-
return {
|
|
1879
|
-
success: false,
|
|
1880
|
-
message: activityResult.message,
|
|
1881
|
-
data: {
|
|
1882
|
-
output: { branch: conditionResult ? 'then' : 'else', failedActivity: activity },
|
|
1883
|
-
outcomes: {
|
|
1884
|
-
Failed: true,
|
|
1885
|
-
},
|
|
1886
|
-
},
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
return this.createResult(result, conditionResult ? 'Then' : 'Else');
|
|
1891
|
-
}
|
|
1892
|
-
catch (err) {
|
|
1893
|
-
console.error('[If] Error evaluating condition:', err);
|
|
1894
|
-
return {
|
|
1895
|
-
success: false,
|
|
1896
|
-
message: {
|
|
1897
|
-
text: err instanceof Error ? err.message : 'Failed to evaluate condition',
|
|
1898
|
-
},
|
|
1899
|
-
data: {
|
|
1900
|
-
output: { branch: 'error' },
|
|
1901
|
-
outcomes: {
|
|
1902
|
-
Failed: true,
|
|
1903
|
-
},
|
|
1904
|
-
},
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
evaluateCondition(condition) {
|
|
1909
|
-
if (typeof condition === 'boolean') {
|
|
1910
|
-
return condition;
|
|
1911
|
-
}
|
|
1912
|
-
if (typeof condition === 'string') {
|
|
1913
|
-
// Simple evaluation - in real implementation, use proper expression evaluator
|
|
1914
|
-
return condition === 'true' || condition === '1' || condition === 'yes';
|
|
1915
|
-
}
|
|
1916
|
-
return false;
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
var if_activity = /*#__PURE__*/Object.freeze({
|
|
1921
|
-
__proto__: null,
|
|
1922
|
-
If: If
|
|
1923
|
-
});
|
|
1924
|
-
|
|
1925
|
-
/**
|
|
1926
|
-
* While Activity - Loop execution while condition is true.
|
|
1927
|
-
*
|
|
1928
|
-
* Usage:
|
|
1929
|
-
* ```typescript
|
|
1930
|
-
* const whileActivity = new While();
|
|
1931
|
-
* whileActivity.condition = '{{counter < 10}}';
|
|
1932
|
-
* whileActivity.activities = [incrementActivity, logActivity];
|
|
1933
|
-
* ```
|
|
1934
|
-
*/
|
|
1935
|
-
class While extends Activity {
|
|
1936
|
-
constructor() {
|
|
1937
|
-
super('While');
|
|
1938
|
-
}
|
|
1939
|
-
async execute(input) {
|
|
1940
|
-
const { condition, activities = [], maxIterations = 1000 } = input;
|
|
1941
|
-
try {
|
|
1942
|
-
let iteration = 0;
|
|
1943
|
-
let conditionResult = this.evaluateCondition(condition);
|
|
1944
|
-
while (conditionResult && iteration < maxIterations) {
|
|
1945
|
-
// Execute activities in the loop
|
|
1946
|
-
for (const activity of activities) {
|
|
1947
|
-
const activityResult = await activity.execute(input);
|
|
1948
|
-
if (!activityResult.success) {
|
|
1949
|
-
return {
|
|
1950
|
-
success: false,
|
|
1951
|
-
message: activityResult.message,
|
|
1952
|
-
data: {
|
|
1953
|
-
output: {
|
|
1954
|
-
iterations: iteration,
|
|
1955
|
-
completed: false,
|
|
1956
|
-
},
|
|
1957
|
-
outcomes: {
|
|
1958
|
-
Failed: true,
|
|
1959
|
-
},
|
|
1960
|
-
},
|
|
1961
|
-
};
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
iteration++;
|
|
1965
|
-
conditionResult = this.evaluateCondition(condition);
|
|
1966
|
-
}
|
|
1967
|
-
const result = {
|
|
1968
|
-
iterations: iteration,
|
|
1969
|
-
completed: iteration < maxIterations
|
|
1970
|
-
};
|
|
1971
|
-
return this.createResult(result, 'Done');
|
|
1972
|
-
}
|
|
1973
|
-
catch (err) {
|
|
1974
|
-
console.error('[While] Error in loop execution:', err);
|
|
1975
|
-
return {
|
|
1976
|
-
success: false,
|
|
1977
|
-
message: {
|
|
1978
|
-
text: err instanceof Error ? err.message : 'Failed during loop execution',
|
|
1979
|
-
},
|
|
1980
|
-
data: {
|
|
1981
|
-
output: { iterations: 0, completed: false },
|
|
1982
|
-
outcomes: {
|
|
1983
|
-
Failed: true,
|
|
1984
|
-
},
|
|
1985
|
-
},
|
|
1986
|
-
};
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
evaluateCondition(condition) {
|
|
1990
|
-
if (typeof condition === 'boolean') {
|
|
1991
|
-
return condition;
|
|
1992
|
-
}
|
|
1993
|
-
if (typeof condition === 'string') {
|
|
1994
|
-
// Simple evaluation - in real implementation, use proper expression evaluator
|
|
1995
|
-
return condition === 'true' || condition === '1' || condition === 'yes';
|
|
1996
|
-
}
|
|
1997
|
-
return false;
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
var while_activity = /*#__PURE__*/Object.freeze({
|
|
2002
|
-
__proto__: null,
|
|
2003
|
-
While: While
|
|
2004
|
-
});
|
|
2005
|
-
|
|
2006
|
-
/**
|
|
2007
|
-
* ForEach Activity - Iterates over a collection of items.
|
|
2008
|
-
*
|
|
2009
|
-
* Usage:
|
|
2010
|
-
* ```typescript
|
|
2011
|
-
* const forEach = new ForEach();
|
|
2012
|
-
* await forEach.execute({
|
|
2013
|
-
* items: ['item1', 'item2', 'item3'],
|
|
2014
|
-
* activities: [processItemActivity]
|
|
2015
|
-
* });
|
|
2016
|
-
* ```
|
|
2017
|
-
*/
|
|
2018
|
-
class ForEach extends Activity {
|
|
2019
|
-
constructor() {
|
|
2020
|
-
super('ForEach');
|
|
2021
|
-
}
|
|
2022
|
-
async execute(input) {
|
|
2023
|
-
const { items = [], activities = [], itemVariableName = 'currentItem', indexVariableName = 'currentIndex' } = input;
|
|
2024
|
-
try {
|
|
2025
|
-
const results = [];
|
|
2026
|
-
for (let index = 0; index < items.length; index++) {
|
|
2027
|
-
const currentItem = items[index];
|
|
2028
|
-
// Create context with current item and index
|
|
2029
|
-
const itemContext = {
|
|
2030
|
-
...input,
|
|
2031
|
-
[itemVariableName]: currentItem,
|
|
2032
|
-
[indexVariableName]: index
|
|
2033
|
-
};
|
|
2034
|
-
// Execute activities for current item
|
|
2035
|
-
for (const activity of activities) {
|
|
2036
|
-
const activityResult = await activity.execute(itemContext);
|
|
2037
|
-
if (!activityResult.success) {
|
|
2038
|
-
return {
|
|
2039
|
-
success: false,
|
|
2040
|
-
message: activityResult.message,
|
|
2041
|
-
data: {
|
|
2042
|
-
output: {
|
|
2043
|
-
totalItems: items.length,
|
|
2044
|
-
processedItems: results.length,
|
|
2045
|
-
results,
|
|
2046
|
-
},
|
|
2047
|
-
outcomes: {
|
|
2048
|
-
Failed: true,
|
|
2049
|
-
},
|
|
2050
|
-
},
|
|
2051
|
-
};
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
results.push({
|
|
2055
|
-
item: currentItem,
|
|
2056
|
-
index,
|
|
2057
|
-
processed: true
|
|
2058
|
-
});
|
|
2059
|
-
}
|
|
2060
|
-
const result = {
|
|
2061
|
-
totalItems: items.length,
|
|
2062
|
-
processedItems: results.length,
|
|
2063
|
-
results
|
|
2064
|
-
};
|
|
2065
|
-
return this.createResult(result, 'Done');
|
|
2066
|
-
}
|
|
2067
|
-
catch (err) {
|
|
2068
|
-
console.error('[ForEach] Error in iteration:', err);
|
|
2069
|
-
return {
|
|
2070
|
-
success: false,
|
|
2071
|
-
message: {
|
|
2072
|
-
text: err instanceof Error ? err.message : 'Failed during iteration',
|
|
2073
|
-
},
|
|
2074
|
-
data: {
|
|
2075
|
-
output: { totalItems: 0, processedItems: 0, results: [] },
|
|
2076
|
-
outcomes: {
|
|
2077
|
-
Failed: true,
|
|
2078
|
-
},
|
|
2079
|
-
},
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
var forEach_activity = /*#__PURE__*/Object.freeze({
|
|
2086
|
-
__proto__: null,
|
|
2087
|
-
ForEach: ForEach
|
|
2088
|
-
});
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* Execute Command Activity - Executes a command through Command Bus.
|
|
2092
|
-
*
|
|
2093
|
-
* Usage:
|
|
2094
|
-
* ```typescript
|
|
2095
|
-
* const executeCmd = new ExecuteCommand();
|
|
2096
|
-
* await executeCmd.execute({
|
|
2097
|
-
* commandKey: 'UserManagement.CreateUser',
|
|
2098
|
-
* input: { name: 'John', email: 'john@example.com' }
|
|
2099
|
-
* });
|
|
2100
|
-
* ```
|
|
2101
|
-
*/
|
|
2102
|
-
class ExecuteCommand extends Activity {
|
|
2103
|
-
constructor() {
|
|
2104
|
-
super('workflow-activity:execute-command', 'Execute Command');
|
|
2105
|
-
this.commandService = inject(AXPCommandService);
|
|
2106
|
-
}
|
|
2107
|
-
async execute(input) {
|
|
2108
|
-
const { commandKey, input: commandInput = {} } = input;
|
|
2109
|
-
try {
|
|
2110
|
-
// Check if command exists
|
|
2111
|
-
if (!this.commandService.exists(commandKey)) {
|
|
2112
|
-
console.warn(`[ExecuteCommand] Command '${commandKey}' is not registered. Simulating execution.`);
|
|
2113
|
-
// Simulate command execution for unregistered commands
|
|
2114
|
-
const result = {
|
|
2115
|
-
commandKey,
|
|
2116
|
-
success: true,
|
|
2117
|
-
output: commandInput,
|
|
2118
|
-
executedAt: new Date().toISOString(),
|
|
2119
|
-
simulated: true
|
|
2120
|
-
};
|
|
2121
|
-
return this.createResult(result, 'Done');
|
|
2122
|
-
}
|
|
2123
|
-
// Execute command through Command Bus
|
|
2124
|
-
const result = await this.commandService.execute(commandKey, commandInput);
|
|
2125
|
-
if (!result) {
|
|
2126
|
-
return {
|
|
2127
|
-
success: false,
|
|
2128
|
-
message: {
|
|
2129
|
-
text: `Command '${commandKey}' returned no result`,
|
|
2130
|
-
},
|
|
2131
|
-
data: {
|
|
2132
|
-
output: {
|
|
2133
|
-
commandKey,
|
|
2134
|
-
success: false,
|
|
2135
|
-
executedAt: new Date().toISOString(),
|
|
2136
|
-
},
|
|
2137
|
-
outcomes: {
|
|
2138
|
-
Failed: true,
|
|
2139
|
-
},
|
|
2140
|
-
},
|
|
2141
|
-
};
|
|
2142
|
-
}
|
|
2143
|
-
if (!result.success) {
|
|
2144
|
-
return {
|
|
2145
|
-
success: false,
|
|
2146
|
-
message: result.message,
|
|
2147
|
-
data: {
|
|
2148
|
-
output: {
|
|
2149
|
-
commandKey,
|
|
2150
|
-
success: false,
|
|
2151
|
-
executedAt: new Date().toISOString(),
|
|
2152
|
-
error: result.message?.text,
|
|
2153
|
-
},
|
|
2154
|
-
outcomes: {
|
|
2155
|
-
Failed: true,
|
|
2156
|
-
},
|
|
2157
|
-
},
|
|
2158
|
-
};
|
|
2159
|
-
}
|
|
2160
|
-
return this.createResult({
|
|
2161
|
-
commandKey,
|
|
2162
|
-
success: true,
|
|
2163
|
-
output: result.data,
|
|
2164
|
-
executedAt: new Date().toISOString(),
|
|
2165
|
-
}, 'Done');
|
|
2166
|
-
}
|
|
2167
|
-
catch (err) {
|
|
2168
|
-
console.error('[ExecuteCommand] Error executing command:', err);
|
|
2169
|
-
return {
|
|
2170
|
-
success: false,
|
|
2171
|
-
message: {
|
|
2172
|
-
text: err instanceof Error ? err.message : 'Unknown error',
|
|
2173
|
-
},
|
|
2174
|
-
data: {
|
|
2175
|
-
output: {
|
|
2176
|
-
commandKey,
|
|
2177
|
-
success: false,
|
|
2178
|
-
error: err instanceof Error ? err.message : 'Unknown error',
|
|
2179
|
-
},
|
|
2180
|
-
outcomes: {
|
|
2181
|
-
Failed: true,
|
|
2182
|
-
},
|
|
2183
|
-
},
|
|
2184
|
-
};
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
var executeCommand_activity = /*#__PURE__*/Object.freeze({
|
|
2190
|
-
__proto__: null,
|
|
2191
|
-
ExecuteCommand: ExecuteCommand
|
|
2192
|
-
});
|
|
2193
|
-
|
|
2194
|
-
/**
|
|
2195
|
-
* Execute Query Activity - Executes a query through Query Bus.
|
|
2196
|
-
*
|
|
2197
|
-
* Usage:
|
|
2198
|
-
* ```typescript
|
|
2199
|
-
* const executeQuery = new ExecuteQuery();
|
|
2200
|
-
* await executeQuery.execute({
|
|
2201
|
-
* queryKey: 'UserManagement.GetUsers',
|
|
2202
|
-
* input: { page: 1, pageSize: 10 }
|
|
2203
|
-
* });
|
|
2204
|
-
* ```
|
|
2205
|
-
*/
|
|
2206
|
-
class ExecuteQuery extends Activity {
|
|
2207
|
-
constructor() {
|
|
2208
|
-
super('workflow-activity:execute-query', 'Execute Query');
|
|
2209
|
-
this.queryService = inject(AXPQueryService);
|
|
2210
|
-
}
|
|
2211
|
-
async execute(input) {
|
|
2212
|
-
const { queryKey, input: queryInput = {} } = input;
|
|
2213
|
-
try {
|
|
2214
|
-
// Check if query exists
|
|
2215
|
-
if (!this.queryService.exists(queryKey)) {
|
|
2216
|
-
console.warn(`[ExecuteQuery] Query '${queryKey}' is not registered. Simulating execution.`);
|
|
2217
|
-
// Simulate query execution for unregistered queries
|
|
2218
|
-
const result = {
|
|
2219
|
-
queryKey,
|
|
2220
|
-
success: true,
|
|
2221
|
-
data: [],
|
|
2222
|
-
totalCount: 0,
|
|
2223
|
-
executedAt: new Date().toISOString(),
|
|
2224
|
-
simulated: true
|
|
2225
|
-
};
|
|
2226
|
-
return this.createResult(result, 'Done');
|
|
2227
|
-
}
|
|
2228
|
-
// Execute query through Query Bus
|
|
2229
|
-
const result = await this.queryService.fetch(queryKey, queryInput);
|
|
2230
|
-
return this.createResult({
|
|
2231
|
-
queryKey,
|
|
2232
|
-
success: true,
|
|
2233
|
-
data: result,
|
|
2234
|
-
totalCount: Array.isArray(result) ? result.length : (result?.totalCount || 0),
|
|
2235
|
-
executedAt: new Date().toISOString()
|
|
2236
|
-
}, 'Done');
|
|
2237
|
-
}
|
|
2238
|
-
catch (err) {
|
|
2239
|
-
console.error('[ExecuteQuery] Error executing query:', err);
|
|
2240
|
-
return {
|
|
2241
|
-
success: false,
|
|
2242
|
-
message: {
|
|
2243
|
-
text: err instanceof Error ? err.message : 'Unknown error',
|
|
2244
|
-
},
|
|
2245
|
-
data: {
|
|
2246
|
-
output: {
|
|
2247
|
-
queryKey,
|
|
2248
|
-
success: false,
|
|
2249
|
-
error: err instanceof Error ? err.message : 'Unknown error',
|
|
2250
|
-
},
|
|
2251
|
-
outcomes: {
|
|
2252
|
-
Failed: true,
|
|
2253
|
-
},
|
|
2254
|
-
},
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
|
|
2260
|
-
var executeQuery_activity = /*#__PURE__*/Object.freeze({
|
|
2261
|
-
__proto__: null,
|
|
2262
|
-
ExecuteQuery: ExecuteQuery
|
|
2263
|
-
});
|
|
2264
|
-
|
|
2265
|
-
/**
|
|
2266
|
-
* Start Activity - Marks the start point of a workflow.
|
|
2267
|
-
*
|
|
2268
|
-
* This is a visual marker activity that doesn't perform any actual work.
|
|
2269
|
-
* It's used in workflow designers to clearly indicate where a workflow begins.
|
|
2270
|
-
*
|
|
2271
|
-
* Usage:
|
|
2272
|
-
* ```typescript
|
|
2273
|
-
* const start = new StartActivity();
|
|
2274
|
-
* await start.execute({});
|
|
2275
|
-
* ```
|
|
2276
|
-
*/
|
|
2277
|
-
class StartActivity extends Activity {
|
|
2278
|
-
constructor() {
|
|
2279
|
-
super('StartActivity');
|
|
2280
|
-
}
|
|
2281
|
-
async execute(input) {
|
|
2282
|
-
// This activity is a visual marker only
|
|
2283
|
-
// It immediately completes and allows workflow to proceed
|
|
2284
|
-
console.log('[StartActivity] Workflow started');
|
|
2285
|
-
return this.createResult(undefined, 'Done');
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
var startActivity_activity = /*#__PURE__*/Object.freeze({
|
|
2290
|
-
__proto__: null,
|
|
2291
|
-
StartActivity: StartActivity
|
|
2292
|
-
});
|
|
2293
|
-
|
|
2294
|
-
/**
|
|
2295
|
-
* End Activity - Marks the end point of a workflow.
|
|
2296
|
-
*
|
|
2297
|
-
* This is a visual marker activity that terminates the workflow execution.
|
|
2298
|
-
* When this activity is reached, the workflow completes successfully.
|
|
2299
|
-
*
|
|
2300
|
-
* Usage:
|
|
2301
|
-
* ```typescript
|
|
2302
|
-
* const end = new EndActivity();
|
|
2303
|
-
* await end.execute({});
|
|
2304
|
-
* ```
|
|
2305
|
-
*/
|
|
2306
|
-
class EndActivity extends Activity {
|
|
2307
|
-
constructor() {
|
|
2308
|
-
super('EndActivity');
|
|
2309
|
-
}
|
|
2310
|
-
async execute(input) {
|
|
2311
|
-
// This activity marks the end of workflow execution
|
|
2312
|
-
console.log('[EndActivity] Workflow completed');
|
|
2313
|
-
return this.createResult(undefined, 'Done');
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
var endActivity_activity = /*#__PURE__*/Object.freeze({
|
|
2318
|
-
__proto__: null,
|
|
2319
|
-
EndActivity: EndActivity
|
|
2320
|
-
});
|
|
2321
|
-
|
|
2322
|
-
/**
|
|
2323
|
-
* Command setups for all built-in workflow activities.
|
|
2324
|
-
* Registers activities as AXPCommand instances.
|
|
2325
|
-
*/
|
|
2326
|
-
const provideWorkflowActivityCommands = () => provideCommandSetups([
|
|
2327
|
-
// Workflow Markers
|
|
2328
|
-
{
|
|
2329
|
-
key: 'workflow-activity:start',
|
|
2330
|
-
command: () => Promise.resolve().then(function () { return startActivity_activity; }).then(m => m.StartActivity),
|
|
2331
|
-
},
|
|
2332
|
-
{
|
|
2333
|
-
key: 'workflow-activity:end',
|
|
2334
|
-
command: () => Promise.resolve().then(function () { return endActivity_activity; }).then(m => m.EndActivity),
|
|
2335
|
-
},
|
|
2336
|
-
// Console Activities
|
|
2337
|
-
{
|
|
2338
|
-
key: 'workflow-activity:write-line',
|
|
2339
|
-
command: () => Promise.resolve().then(function () { return writeLine_activity; }).then(m => m.WriteLine),
|
|
2340
|
-
},
|
|
2341
|
-
// Control Flow Activities
|
|
2342
|
-
{
|
|
2343
|
-
key: 'workflow-activity:sequence',
|
|
2344
|
-
command: () => Promise.resolve().then(function () { return sequence_activity; }).then(m => m.Sequence),
|
|
2345
|
-
},
|
|
2346
|
-
{
|
|
2347
|
-
key: 'workflow-activity:if',
|
|
2348
|
-
command: () => Promise.resolve().then(function () { return if_activity; }).then(m => m.If),
|
|
2349
|
-
},
|
|
2350
|
-
{
|
|
2351
|
-
key: 'workflow-activity:while',
|
|
2352
|
-
command: () => Promise.resolve().then(function () { return while_activity; }).then(m => m.While),
|
|
2353
|
-
},
|
|
2354
|
-
{
|
|
2355
|
-
key: 'workflow-activity:for-each',
|
|
2356
|
-
command: () => Promise.resolve().then(function () { return forEach_activity; }).then(m => m.ForEach),
|
|
2357
|
-
},
|
|
2358
|
-
// Dialog Activities
|
|
2359
|
-
{
|
|
2360
|
-
key: 'workflow-activity:show-confirm-dialog',
|
|
2361
|
-
command: () => Promise.resolve().then(function () { return showConfirmDialog_activity; }).then(m => m.ShowConfirmDialog),
|
|
2362
|
-
},
|
|
2363
|
-
{
|
|
2364
|
-
key: 'workflow-activity:show-alert-dialog',
|
|
2365
|
-
command: () => Promise.resolve().then(function () { return showAlertDialog_activity; }).then(m => m.ShowAlertDialog),
|
|
2366
|
-
},
|
|
2367
|
-
// Notification Activities
|
|
2368
|
-
{
|
|
2369
|
-
key: 'workflow-activity:show-toast',
|
|
2370
|
-
command: () => Promise.resolve().then(function () { return showToast_activity; }).then(m => m.ShowToast),
|
|
2371
|
-
},
|
|
2372
|
-
// Event Activities
|
|
2373
|
-
{
|
|
2374
|
-
key: 'workflow-activity:dispatch-event',
|
|
2375
|
-
command: () => Promise.resolve().then(function () { return dispatchEvent_activity; }).then(m => m.DispatchEvent),
|
|
2376
|
-
},
|
|
2377
|
-
// Variable Activities
|
|
2378
|
-
{
|
|
2379
|
-
key: 'workflow-activity:set-variable',
|
|
2380
|
-
command: () => Promise.resolve().then(function () { return setVariable_activity; }).then(m => m.SetVariable),
|
|
2381
|
-
},
|
|
2382
|
-
// Command & Query Activities
|
|
2383
|
-
{
|
|
2384
|
-
key: 'workflow-activity:execute-command',
|
|
2385
|
-
command: () => Promise.resolve().then(function () { return executeCommand_activity; }).then(m => m.ExecuteCommand),
|
|
2386
|
-
},
|
|
2387
|
-
{
|
|
2388
|
-
key: 'workflow-activity:execute-query',
|
|
2389
|
-
command: () => Promise.resolve().then(function () { return executeQuery_activity; }).then(m => m.ExecuteQuery),
|
|
2390
|
-
},
|
|
2391
|
-
// Navigation Activities
|
|
2392
|
-
{
|
|
2393
|
-
key: 'workflow-activity:navigate',
|
|
2394
|
-
command: () => Promise.resolve().then(function () { return navigate_activity; }).then(m => m.Navigate),
|
|
2395
|
-
},
|
|
2396
|
-
]);
|
|
2397
|
-
|
|
2398
|
-
// Built-in Activities
|
|
2399
|
-
|
|
2400
1456
|
// Workflow Definition Types (Storage/Database)
|
|
2401
1457
|
|
|
2402
|
-
class AXPWorkflowModule {
|
|
2403
|
-
static forRoot(config) {
|
|
2404
|
-
return {
|
|
2405
|
-
ngModule: AXPWorkflowModule,
|
|
2406
|
-
providers: [
|
|
2407
|
-
provideWorkflowActivityCommands(),
|
|
2408
|
-
{
|
|
2409
|
-
provide: 'AXPWorkflowModuleFactory',
|
|
2410
|
-
useFactory: (registry) => () => {
|
|
2411
|
-
registry.registerAction('start-workflow', AXPStartWorkflowAction);
|
|
2412
|
-
registry.registerAction('decide', AXPWorkflowDecideAction);
|
|
2413
|
-
//
|
|
2414
|
-
if (config?.functions) {
|
|
2415
|
-
for (const [key, type] of Object.entries(config.functions)) {
|
|
2416
|
-
registry.registerFunction(key, type);
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
//
|
|
2420
|
-
if (config?.actions) {
|
|
2421
|
-
for (const [key, type] of Object.entries(config.actions)) {
|
|
2422
|
-
registry.registerAction(key, type);
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
//
|
|
2426
|
-
if (config?.workflows) {
|
|
2427
|
-
for (const [key, type] of Object.entries(config.workflows)) {
|
|
2428
|
-
registry.registerWorkflow(key, type);
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
},
|
|
2432
|
-
deps: [AXPWorkflowRegistryService],
|
|
2433
|
-
multi: true,
|
|
2434
|
-
},
|
|
2435
|
-
...Object.values(config?.actions ?? { AXPStartWorkflowAction }),
|
|
2436
|
-
...Object.values(config?.functions ?? {}),
|
|
2437
|
-
],
|
|
2438
|
-
};
|
|
2439
|
-
}
|
|
2440
|
-
static forChild(config) {
|
|
2441
|
-
return {
|
|
2442
|
-
ngModule: AXPWorkflowModule,
|
|
2443
|
-
providers: [
|
|
2444
|
-
// Built-in activities are already registered in forRoot via @NgModule providers
|
|
2445
|
-
// No need to register again in forChild
|
|
2446
|
-
{
|
|
2447
|
-
provide: 'AXPWorkflowModuleFactory',
|
|
2448
|
-
useFactory: (registry) => () => {
|
|
2449
|
-
registry.registerAction('start-workflow', AXPStartWorkflowAction);
|
|
2450
|
-
registry.registerAction('decide', AXPWorkflowDecideAction);
|
|
2451
|
-
//
|
|
2452
|
-
if (config?.functions) {
|
|
2453
|
-
for (const [key, type] of Object.entries(config.functions)) {
|
|
2454
|
-
registry.registerFunction(key, type);
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
//
|
|
2458
|
-
if (config?.actions) {
|
|
2459
|
-
for (const [key, type] of Object.entries(config.actions)) {
|
|
2460
|
-
registry.registerAction(key, type);
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
//
|
|
2464
|
-
if (config?.workflows) {
|
|
2465
|
-
for (const [key, type] of Object.entries(config.workflows)) {
|
|
2466
|
-
registry.registerWorkflow(key, type);
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
},
|
|
2470
|
-
deps: [AXPWorkflowRegistryService],
|
|
2471
|
-
multi: true,
|
|
2472
|
-
},
|
|
2473
|
-
...Object.values(config?.actions ?? {}),
|
|
2474
|
-
...Object.values(config?.functions ?? {}),
|
|
2475
|
-
],
|
|
2476
|
-
};
|
|
2477
|
-
}
|
|
2478
|
-
/**
|
|
2479
|
-
* @ignore
|
|
2480
|
-
*/
|
|
2481
|
-
constructor(instances) {
|
|
2482
|
-
// Inject AXP_COMMAND_SETUP to trigger command registration factory
|
|
2483
|
-
this._commandSetup = inject(AXP_COMMAND_SETUP, { optional: true });
|
|
2484
|
-
instances?.forEach((f) => {
|
|
2485
|
-
f();
|
|
2486
|
-
});
|
|
2487
|
-
}
|
|
2488
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule, deps: [{ token: 'AXPWorkflowModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2489
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule }); }
|
|
2490
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule, providers: [
|
|
2491
|
-
provideWorkflowActivityCommands(),
|
|
2492
|
-
] }); }
|
|
2493
|
-
}
|
|
2494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowModule, decorators: [{
|
|
2495
|
-
type: NgModule,
|
|
2496
|
-
args: [{
|
|
2497
|
-
imports: [],
|
|
2498
|
-
exports: [],
|
|
2499
|
-
declarations: [],
|
|
2500
|
-
providers: [
|
|
2501
|
-
provideWorkflowActivityCommands(),
|
|
2502
|
-
],
|
|
2503
|
-
}]
|
|
2504
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2505
|
-
type: Optional
|
|
2506
|
-
}, {
|
|
2507
|
-
type: Inject,
|
|
2508
|
-
args: ['AXPWorkflowModuleFactory']
|
|
2509
|
-
}] }] });
|
|
2510
|
-
|
|
2511
1458
|
/**
|
|
2512
1459
|
* Generated bundle index. Do not edit.
|
|
2513
1460
|
*/
|
|
2514
1461
|
|
|
2515
|
-
export {
|
|
1462
|
+
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 };
|
|
2516
1463
|
//# sourceMappingURL=acorex-platform-workflow.mjs.map
|