@acorex/platform 20.6.0 → 20.6.2

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.
@@ -578,79 +578,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
578
578
  // Compatible with Elsa backend while using ACoreX naming conventions
579
579
  // ============================================
580
580
 
581
- /**
582
- * Base abstract class for activities.
583
- * Extend this to create custom activities.
584
- */
585
- class Activity {
586
- constructor(type, name) {
587
- this.type = type;
588
- this.name = name;
589
- }
590
- /**
591
- * Helper method that returns Done outcome by default.
592
- */
593
- createResult(output, outcome = 'Done') {
594
- return {
595
- success: true,
596
- data: {
597
- output,
598
- outcomes: { [outcome]: true },
599
- },
600
- };
601
- }
602
- }
603
- /**
604
- * Activity registry for registering and creating activities.
605
- */
606
- class ActivityRegistry {
607
- constructor() {
608
- this.registry = new Map();
609
- this.descriptors = new Map();
610
- }
611
- /**
612
- * Register an activity type.
613
- */
614
- register(type, factory, descriptor) {
615
- this.registry.set(type, factory);
616
- this.descriptors.set(type, descriptor);
617
- }
618
- /**
619
- * Create an activity instance.
620
- */
621
- create(type) {
622
- const factory = this.registry.get(type);
623
- if (!factory) {
624
- throw new Error(`Unknown activity type: ${type}`);
625
- }
626
- return factory();
627
- }
628
- /**
629
- * Get activity descriptor.
630
- */
631
- getDescriptor(type) {
632
- return this.descriptors.get(type);
633
- }
634
- /**
635
- * Get all registered types.
636
- */
637
- getTypes() {
638
- return Array.from(this.registry.keys());
639
- }
640
- /**
641
- * Get all descriptors.
642
- */
643
- getAllDescriptors() {
644
- return Array.from(this.descriptors.values());
645
- }
646
- /**
647
- * Get descriptors by category.
648
- */
649
- getDescriptorsByCategory(category) {
650
- return this.getAllDescriptors().filter(d => d.category === category);
651
- }
652
- }
653
-
654
581
  /**
655
582
  * Injection token for activity providers.
656
583
  */
@@ -661,7 +588,6 @@ const AXP_ACTIVITY_PROVIDER = new InjectionToken('AXP_ACTIVITY_PROVIDER');
661
588
  */
662
589
  class AXPActivityProviderService {
663
590
  constructor() {
664
- this.activityDescriptors = new Map();
665
591
  this.categories = [];
666
592
  this.providers = [];
667
593
  this.categoryProviders = [];
@@ -704,22 +630,34 @@ class AXPActivityProviderService {
704
630
  this.initialized = true;
705
631
  }
706
632
  /**
707
- * Get activity descriptor by key.
633
+ * Get activity instance by key.
634
+ * Activity metadata is part of the activity instance itself.
708
635
  */
709
- getDescriptor(key) {
710
- return this.activityDescriptors.get(key);
636
+ async getActivity(key) {
637
+ return this.createActivity(key);
711
638
  }
712
639
  /**
713
- * Get all activity descriptors.
640
+ * Get all registered activity keys from Command Registry.
714
641
  */
715
- getAllDescriptors() {
716
- return Array.from(this.activityDescriptors.values());
642
+ getAllActivityKeys() {
643
+ // Get all registered command keys that are activities
644
+ // This would need to be implemented based on Command Registry capabilities
645
+ return [];
717
646
  }
718
647
  /**
719
- * Get descriptors by category.
648
+ * Get activities by category.
649
+ * Note: This requires loading all activities and filtering by category.
720
650
  */
721
- getDescriptorsByCategory(category) {
722
- return this.getAllDescriptors().filter(d => d.category === category);
651
+ async getActivitiesByCategory(category) {
652
+ const keys = this.getAllActivityKeys();
653
+ const activities = [];
654
+ for (const key of keys) {
655
+ const activity = await this.getActivity(key);
656
+ if (activity && activity.category === category) {
657
+ activities.push(activity);
658
+ }
659
+ }
660
+ return activities;
723
661
  }
724
662
  /**
725
663
  * Get all categories.
@@ -753,11 +691,7 @@ class AXPActivityProviderService {
753
691
  // PRIVATE METHODS
754
692
  // ============================================
755
693
  async initializeProvider(provider) {
756
- const context = {
757
- registerActivity: (config) => {
758
- this.activityDescriptors.set(config.key, config.descriptor);
759
- }
760
- };
694
+ const context = {};
761
695
  await provider.provide(context);
762
696
  }
763
697
  async initializeCategoryProvider(provider) {
@@ -1183,19 +1117,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
1183
1117
  * Usage:
1184
1118
  * ```typescript
1185
1119
  * const activity = new WriteLine();
1186
- * await activity.execute({ text: 'Hello World' });
1120
+ * await activity.execute({ type: 'workflow-activity:write-line', text: 'Hello World' });
1187
1121
  * ```
1188
1122
  */
1189
- class WriteLine extends Activity {
1123
+ class WriteLine {
1190
1124
  constructor() {
1191
- super('WriteLine');
1125
+ this.type = "workflow-activity:write-line";
1192
1126
  }
1193
1127
  async execute(input) {
1194
1128
  const text = input.text || '';
1195
1129
  if (text !== undefined && text !== null) {
1196
1130
  console.log(`[WriteLine] ${text}`);
1197
1131
  }
1198
- return this.createResult(undefined, 'Done');
1132
+ return {
1133
+ success: true,
1134
+ message: {
1135
+ text: 'WriteLine completed',
1136
+ },
1137
+ data: {
1138
+ output: undefined,
1139
+ outcomes: {
1140
+ Done: true,
1141
+ },
1142
+ },
1143
+ };
1199
1144
  }
1200
1145
  }
1201
1146
 
@@ -1204,50 +1149,6 @@ var writeLine_activity = /*#__PURE__*/Object.freeze({
1204
1149
  WriteLine: WriteLine
1205
1150
  });
1206
1151
 
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
1152
  /**
1252
1153
  * Show Confirm Dialog Activity - Displays confirmation dialog to user.
1253
1154
  *
@@ -1259,20 +1160,21 @@ var sequence_activity = /*#__PURE__*/Object.freeze({
1259
1160
  * ```typescript
1260
1161
  * const dialog = new ShowConfirmDialog();
1261
1162
  * await dialog.execute({
1163
+ * type: 'workflow-activity:show-confirm-dialog',
1262
1164
  * title: 'Confirm Delete',
1263
1165
  * message: 'Are you sure?',
1264
1166
  * color: 'danger'
1265
1167
  * });
1266
1168
  * ```
1267
1169
  */
1268
- class ShowConfirmDialog extends Activity {
1269
- //#endregion
1170
+ class ShowConfirmDialog {
1270
1171
  constructor() {
1271
- super('ShowConfirmDialog');
1172
+ this.type = "workflow-activity:show-confirm-dialog";
1272
1173
  //#region ---- Services & Dependencies ----
1273
1174
  this.dialogService = inject(AXDialogService);
1274
1175
  this.translationService = inject(AXTranslationService);
1275
1176
  }
1177
+ //#endregion
1276
1178
  async execute(input) {
1277
1179
  const { title = '', message = '', color = 'primary', defaultAction = 'cancel', align = 'horizontal', backdrop = false } = input;
1278
1180
  // Translate title and message only if they start with '@' (translation key)
@@ -1291,10 +1193,19 @@ class ShowConfirmDialog extends Activity {
1291
1193
  const confirmResult = await this.dialogService.confirm(translatedTitle, translatedMessage, color, align, backdrop, defaultAction);
1292
1194
  const result = confirmResult.result;
1293
1195
  const action = result ? 'confirm' : 'cancel';
1294
- return this.createResult({
1295
- result,
1296
- action
1297
- }, result ? 'Confirmed' : 'Cancelled');
1196
+ return {
1197
+ success: true,
1198
+ message: {
1199
+ text: 'Dialog closed',
1200
+ },
1201
+ data: {
1202
+ output: {
1203
+ result,
1204
+ action
1205
+ },
1206
+ outcomes: result ? { Confirmed: true } : { Cancelled: true },
1207
+ },
1208
+ };
1298
1209
  }
1299
1210
  catch (err) {
1300
1211
  console.error('[ShowConfirmDialog] Error showing dialog:', err);
@@ -1332,20 +1243,21 @@ var showConfirmDialog_activity = /*#__PURE__*/Object.freeze({
1332
1243
  * ```typescript
1333
1244
  * const dialog = new ShowAlertDialog();
1334
1245
  * await dialog.execute({
1246
+ * type: 'workflow-activity:show-alert-dialog',
1335
1247
  * title: 'Alert',
1336
1248
  * message: 'This is an alert',
1337
1249
  * color: 'info'
1338
1250
  * });
1339
1251
  * ```
1340
1252
  */
1341
- class ShowAlertDialog extends Activity {
1342
- //#endregion
1253
+ class ShowAlertDialog {
1343
1254
  constructor() {
1344
- super('ShowAlertDialog');
1255
+ this.type = "workflow-activity:show-alert-dialog";
1345
1256
  //#region ---- Services & Dependencies ----
1346
1257
  this.dialogService = inject(AXDialogService);
1347
1258
  this.translationService = inject(AXTranslationService);
1348
1259
  }
1260
+ //#endregion
1349
1261
  async execute(input) {
1350
1262
  const { title = '', message = '', color = 'primary' } = input;
1351
1263
  // Translate title and message only if they start with '@' (translation key)
@@ -1362,10 +1274,21 @@ class ShowAlertDialog extends Activity {
1362
1274
  : '';
1363
1275
  try {
1364
1276
  await this.dialogService.alert(translatedTitle, translatedMessage, color);
1365
- return this.createResult({
1366
- result: true,
1367
- action: 'ok'
1368
- }, 'Done');
1277
+ return {
1278
+ success: true,
1279
+ message: {
1280
+ text: 'Dialog closed',
1281
+ },
1282
+ data: {
1283
+ output: {
1284
+ result: true,
1285
+ action: 'ok'
1286
+ },
1287
+ outcomes: {
1288
+ Done: true,
1289
+ },
1290
+ },
1291
+ };
1369
1292
  }
1370
1293
  catch (err) {
1371
1294
  console.error('[ShowAlertDialog] Error showing dialog:', err);
@@ -1498,13 +1421,13 @@ var showAlertDialog_activity = /*#__PURE__*/Object.freeze({
1498
1421
  * }
1499
1422
  * ```
1500
1423
  */
1501
- class ShowDialogLayoutBuilder extends Activity {
1502
- //#endregion
1424
+ class ShowDialogLayoutBuilder {
1503
1425
  constructor() {
1504
- super('ShowDialogLayoutBuilder');
1426
+ this.type = "workflow-activity:show-dialog-layout-builder";
1505
1427
  //#region ---- Services & Dependencies ----
1506
1428
  this.layoutBuilder = inject(AXPLayoutBuilderService);
1507
1429
  }
1430
+ //#endregion
1508
1431
  async execute(input) {
1509
1432
  const { title = '', size = 'md', context = {}, closeButton = false, message, content, actions } = input;
1510
1433
  try {
@@ -1572,12 +1495,21 @@ class ShowDialogLayoutBuilder extends Activity {
1572
1495
  dialogRef.close();
1573
1496
  // Return result with appropriate outcome
1574
1497
  const outcome = cancelled ? 'Cancelled' : confirmed ? 'Confirmed' : 'Done';
1575
- return this.createResult({
1576
- context: dialogContext,
1577
- action,
1578
- cancelled,
1579
- confirmed
1580
- }, outcome);
1498
+ return {
1499
+ success: true,
1500
+ message: {
1501
+ text: 'Dialog closed',
1502
+ },
1503
+ data: {
1504
+ output: {
1505
+ context: dialogContext,
1506
+ action,
1507
+ cancelled,
1508
+ confirmed
1509
+ },
1510
+ outcomes: cancelled ? { Cancelled: true } : confirmed ? { Confirmed: true } : { Done: true },
1511
+ },
1512
+ };
1581
1513
  }
1582
1514
  catch (err) {
1583
1515
  console.error('[ShowDialogLayoutBuilder] Error showing dialog:', err);
@@ -1609,15 +1541,16 @@ class ShowDialogLayoutBuilder extends Activity {
1609
1541
  * ```typescript
1610
1542
  * const toast = new ShowToast();
1611
1543
  * await toast.execute({
1544
+ * type: 'workflow-activity:show-toast',
1612
1545
  * color: 'success',
1613
1546
  * title: 'Success',
1614
1547
  * message: 'Operation completed successfully!'
1615
1548
  * });
1616
1549
  * ```
1617
1550
  */
1618
- class ShowToast extends Activity {
1551
+ class ShowToast {
1619
1552
  constructor() {
1620
- super('ShowToast');
1553
+ this.type = "workflow-activity:show-toast";
1621
1554
  this.toastService = inject(AXToastService);
1622
1555
  this.translationService = inject(AXTranslationService);
1623
1556
  }
@@ -1644,7 +1577,18 @@ class ShowToast extends Activity {
1644
1577
  timeOut: duration,
1645
1578
  timeOutProgress: true,
1646
1579
  });
1647
- return this.createResult(undefined, 'Done');
1580
+ return {
1581
+ success: true,
1582
+ message: {
1583
+ text: 'Toast displayed successfully',
1584
+ },
1585
+ data: {
1586
+ output: undefined,
1587
+ outcomes: {
1588
+ Done: true,
1589
+ },
1590
+ },
1591
+ };
1648
1592
  }
1649
1593
  catch (err) {
1650
1594
  console.error('[ShowToast] Error showing toast:', err);
@@ -1676,15 +1620,16 @@ var showToast_activity = /*#__PURE__*/Object.freeze({
1676
1620
  * ```typescript
1677
1621
  * const navigate = new Navigate();
1678
1622
  * await navigate.execute({
1623
+ * type: 'workflow-activity:navigate',
1679
1624
  * mode: 'route',
1680
1625
  * route: '/users',
1681
1626
  * params: { id: '123' }
1682
1627
  * });
1683
1628
  * ```
1684
1629
  */
1685
- class Navigate extends Activity {
1630
+ class Navigate {
1686
1631
  constructor() {
1687
- super('Navigate');
1632
+ this.type = "workflow-activity:navigate";
1688
1633
  this.router = inject(Router);
1689
1634
  }
1690
1635
  async execute(input) {
@@ -1722,7 +1667,18 @@ class Navigate extends Activity {
1722
1667
  },
1723
1668
  };
1724
1669
  }
1725
- return this.createResult(undefined, 'Done');
1670
+ return {
1671
+ success: true,
1672
+ message: {
1673
+ text: 'Navigation completed',
1674
+ },
1675
+ data: {
1676
+ output: undefined,
1677
+ outcomes: {
1678
+ Done: true,
1679
+ },
1680
+ },
1681
+ };
1726
1682
  }
1727
1683
  catch (err) {
1728
1684
  console.error('[Navigate] Error navigating:', err);
@@ -1759,17 +1715,23 @@ var navigate_activity = /*#__PURE__*/Object.freeze({
1759
1715
  * });
1760
1716
  * ```
1761
1717
  */
1762
- class SetVariable extends Activity {
1763
- constructor() {
1764
- super('workflow-activity:set-variable', 'Set Variable');
1765
- }
1718
+ class SetVariable {
1766
1719
  async execute(input) {
1767
1720
  const { variableName, value } = input;
1768
1721
  try {
1769
1722
  // In a real implementation, this would set the variable in workflow context
1770
1723
  // For now, we'll just log it
1771
1724
  console.log(`[SetVariable] Setting ${variableName} = ${JSON.stringify(value)}`);
1772
- return this.createResult(undefined, 'Done');
1725
+ return {
1726
+ success: true,
1727
+ message: {
1728
+ text: 'Variable set successfully',
1729
+ },
1730
+ data: {
1731
+ output: undefined,
1732
+ outcomes: {},
1733
+ },
1734
+ };
1773
1735
  }
1774
1736
  catch (err) {
1775
1737
  console.error('[SetVariable] Error setting variable:', err);
@@ -1801,14 +1763,15 @@ var setVariable_activity = /*#__PURE__*/Object.freeze({
1801
1763
  * ```typescript
1802
1764
  * const dispatch = new DispatchEvent();
1803
1765
  * await dispatch.execute({
1766
+ * type: 'workflow-activity:dispatch-event',
1804
1767
  * eventName: 'user-created',
1805
1768
  * eventData: { userId: '123', name: 'John' }
1806
1769
  * });
1807
1770
  * ```
1808
1771
  */
1809
- class DispatchEvent extends Activity {
1772
+ class DispatchEvent {
1810
1773
  constructor() {
1811
- super('DispatchEvent');
1774
+ this.type = "workflow-activity:dispatch-event";
1812
1775
  }
1813
1776
  async execute(input) {
1814
1777
  const { eventName, eventData } = input;
@@ -1816,7 +1779,18 @@ class DispatchEvent extends Activity {
1816
1779
  // In a real implementation, this would dispatch the event through an event bus
1817
1780
  // For now, we'll just log it
1818
1781
  console.log(`[DispatchEvent] Dispatching event: ${eventName}`, eventData);
1819
- return this.createResult(undefined, 'Done');
1782
+ return {
1783
+ success: true,
1784
+ message: {
1785
+ text: 'Event dispatched successfully',
1786
+ },
1787
+ data: {
1788
+ output: undefined,
1789
+ outcomes: {
1790
+ Done: true,
1791
+ },
1792
+ },
1793
+ };
1820
1794
  }
1821
1795
  catch (err) {
1822
1796
  console.error('[DispatchEvent] Error dispatching event:', err);
@@ -1847,14 +1821,17 @@ var dispatchEvent_activity = /*#__PURE__*/Object.freeze({
1847
1821
  * Usage:
1848
1822
  * ```typescript
1849
1823
  * const ifActivity = new If();
1850
- * ifActivity.condition = '{{user.isAdmin}}';
1851
- * ifActivity.thenActivities = [activity1, activity2];
1852
- * ifActivity.elseActivities = [activity3];
1824
+ * await ifActivity.execute({
1825
+ * type: 'workflow-activity:if',
1826
+ * condition: '{{user.isAdmin}}',
1827
+ * thenActivities: [activity1, activity2],
1828
+ * elseActivities: [activity3]
1829
+ * });
1853
1830
  * ```
1854
1831
  */
1855
- class If extends Activity {
1832
+ class If {
1856
1833
  constructor() {
1857
- super('If');
1834
+ this.type = "workflow-activity:if";
1858
1835
  }
1859
1836
  async execute(input) {
1860
1837
  const { condition, thenActivities = [], elseActivities = [] } = input;
@@ -1887,98 +1864,26 @@ class If extends Activity {
1887
1864
  };
1888
1865
  }
1889
1866
  }
1890
- return this.createResult(result, conditionResult ? 'Then' : 'Else');
1891
- }
1892
- catch (err) {
1893
- console.error('[If] Error evaluating condition:', err);
1894
1867
  return {
1895
- success: false,
1868
+ success: true,
1896
1869
  message: {
1897
- text: err instanceof Error ? err.message : 'Failed to evaluate condition',
1870
+ text: 'Condition evaluated successfully',
1898
1871
  },
1899
1872
  data: {
1900
- output: { branch: 'error' },
1901
- outcomes: {
1902
- Failed: true,
1903
- },
1873
+ output: result,
1874
+ outcomes: conditionResult ? { Then: true } : { Else: true },
1904
1875
  },
1905
1876
  };
1906
1877
  }
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
1878
  catch (err) {
1974
- console.error('[While] Error in loop execution:', err);
1879
+ console.error('[If] Error evaluating condition:', err);
1975
1880
  return {
1976
1881
  success: false,
1977
1882
  message: {
1978
- text: err instanceof Error ? err.message : 'Failed during loop execution',
1883
+ text: err instanceof Error ? err.message : 'Failed to evaluate condition',
1979
1884
  },
1980
1885
  data: {
1981
- output: { iterations: 0, completed: false },
1886
+ output: { branch: 'error' },
1982
1887
  outcomes: {
1983
1888
  Failed: true,
1984
1889
  },
@@ -1998,9 +1903,9 @@ class While extends Activity {
1998
1903
  }
1999
1904
  }
2000
1905
 
2001
- var while_activity = /*#__PURE__*/Object.freeze({
1906
+ var if_activity = /*#__PURE__*/Object.freeze({
2002
1907
  __proto__: null,
2003
- While: While
1908
+ If: If
2004
1909
  });
2005
1910
 
2006
1911
  /**
@@ -2010,14 +1915,15 @@ var while_activity = /*#__PURE__*/Object.freeze({
2010
1915
  * ```typescript
2011
1916
  * const forEach = new ForEach();
2012
1917
  * await forEach.execute({
1918
+ * type: 'workflow-activity:for-each',
2013
1919
  * items: ['item1', 'item2', 'item3'],
2014
1920
  * activities: [processItemActivity]
2015
1921
  * });
2016
1922
  * ```
2017
1923
  */
2018
- class ForEach extends Activity {
1924
+ class ForEach {
2019
1925
  constructor() {
2020
- super('ForEach');
1926
+ this.type = "workflow-activity:for-each";
2021
1927
  }
2022
1928
  async execute(input) {
2023
1929
  const { items = [], activities = [], itemVariableName = 'currentItem', indexVariableName = 'currentIndex' } = input;
@@ -2062,7 +1968,18 @@ class ForEach extends Activity {
2062
1968
  processedItems: results.length,
2063
1969
  results
2064
1970
  };
2065
- return this.createResult(result, 'Done');
1971
+ return {
1972
+ success: true,
1973
+ message: {
1974
+ text: 'ForEach completed successfully',
1975
+ },
1976
+ data: {
1977
+ output: result,
1978
+ outcomes: {
1979
+ Done: true,
1980
+ },
1981
+ },
1982
+ };
2066
1983
  }
2067
1984
  catch (err) {
2068
1985
  console.error('[ForEach] Error in iteration:', err);
@@ -2094,14 +2011,15 @@ var forEach_activity = /*#__PURE__*/Object.freeze({
2094
2011
  * ```typescript
2095
2012
  * const executeCmd = new ExecuteCommand();
2096
2013
  * await executeCmd.execute({
2014
+ * type: 'workflow-activity:execute-command',
2097
2015
  * commandKey: 'UserManagement.CreateUser',
2098
2016
  * input: { name: 'John', email: 'john@example.com' }
2099
2017
  * });
2100
2018
  * ```
2101
2019
  */
2102
- class ExecuteCommand extends Activity {
2020
+ class ExecuteCommand {
2103
2021
  constructor() {
2104
- super('workflow-activity:execute-command', 'Execute Command');
2022
+ this.type = "workflow-activity:execute-command";
2105
2023
  this.commandService = inject(AXPCommandService);
2106
2024
  }
2107
2025
  async execute(input) {
@@ -2118,7 +2036,18 @@ class ExecuteCommand extends Activity {
2118
2036
  executedAt: new Date().toISOString(),
2119
2037
  simulated: true
2120
2038
  };
2121
- return this.createResult(result, 'Done');
2039
+ return {
2040
+ success: true,
2041
+ message: {
2042
+ text: 'Command executed successfully',
2043
+ },
2044
+ data: {
2045
+ output: result,
2046
+ outcomes: {
2047
+ Done: true,
2048
+ },
2049
+ },
2050
+ };
2122
2051
  }
2123
2052
  // Execute command through Command Bus
2124
2053
  const result = await this.commandService.execute(commandKey, commandInput);
@@ -2157,12 +2086,23 @@ class ExecuteCommand extends Activity {
2157
2086
  },
2158
2087
  };
2159
2088
  }
2160
- return this.createResult({
2161
- commandKey,
2089
+ return {
2162
2090
  success: true,
2163
- output: result.data,
2164
- executedAt: new Date().toISOString(),
2165
- }, 'Done');
2091
+ message: {
2092
+ text: 'Command executed successfully',
2093
+ },
2094
+ data: {
2095
+ output: {
2096
+ commandKey,
2097
+ success: true,
2098
+ output: result.data,
2099
+ executedAt: new Date().toISOString(),
2100
+ },
2101
+ outcomes: {
2102
+ Done: true,
2103
+ },
2104
+ },
2105
+ };
2166
2106
  }
2167
2107
  catch (err) {
2168
2108
  console.error('[ExecuteCommand] Error executing command:', err);
@@ -2198,14 +2138,15 @@ var executeCommand_activity = /*#__PURE__*/Object.freeze({
2198
2138
  * ```typescript
2199
2139
  * const executeQuery = new ExecuteQuery();
2200
2140
  * await executeQuery.execute({
2141
+ * type: 'workflow-activity:execute-query',
2201
2142
  * queryKey: 'UserManagement.GetUsers',
2202
2143
  * input: { page: 1, pageSize: 10 }
2203
2144
  * });
2204
2145
  * ```
2205
2146
  */
2206
- class ExecuteQuery extends Activity {
2147
+ class ExecuteQuery {
2207
2148
  constructor() {
2208
- super('workflow-activity:execute-query', 'Execute Query');
2149
+ this.type = "workflow-activity:execute-query";
2209
2150
  this.queryService = inject(AXPQueryService);
2210
2151
  }
2211
2152
  async execute(input) {
@@ -2223,17 +2164,39 @@ class ExecuteQuery extends Activity {
2223
2164
  executedAt: new Date().toISOString(),
2224
2165
  simulated: true
2225
2166
  };
2226
- return this.createResult(result, 'Done');
2167
+ return {
2168
+ success: true,
2169
+ message: {
2170
+ text: 'Query executed successfully',
2171
+ },
2172
+ data: {
2173
+ output: result,
2174
+ outcomes: {
2175
+ Done: true,
2176
+ },
2177
+ },
2178
+ };
2227
2179
  }
2228
2180
  // Execute query through Query Bus
2229
2181
  const result = await this.queryService.fetch(queryKey, queryInput);
2230
- return this.createResult({
2231
- queryKey,
2182
+ return {
2232
2183
  success: true,
2233
- data: result,
2234
- totalCount: Array.isArray(result) ? result.length : (result?.totalCount || 0),
2235
- executedAt: new Date().toISOString()
2236
- }, 'Done');
2184
+ message: {
2185
+ text: 'Query executed successfully',
2186
+ },
2187
+ data: {
2188
+ output: {
2189
+ queryKey,
2190
+ success: true,
2191
+ data: result,
2192
+ totalCount: Array.isArray(result) ? result.length : (result?.totalCount || 0),
2193
+ executedAt: new Date().toISOString()
2194
+ },
2195
+ outcomes: {
2196
+ Done: true,
2197
+ },
2198
+ },
2199
+ };
2237
2200
  }
2238
2201
  catch (err) {
2239
2202
  console.error('[ExecuteQuery] Error executing query:', err);
@@ -2271,18 +2234,29 @@ var executeQuery_activity = /*#__PURE__*/Object.freeze({
2271
2234
  * Usage:
2272
2235
  * ```typescript
2273
2236
  * const start = new StartActivity();
2274
- * await start.execute({});
2237
+ * await start.execute({ type: 'workflow-activity:start' });
2275
2238
  * ```
2276
2239
  */
2277
- class StartActivity extends Activity {
2240
+ class StartActivity {
2278
2241
  constructor() {
2279
- super('StartActivity');
2242
+ this.type = "workflow-activity:start";
2280
2243
  }
2281
2244
  async execute(input) {
2282
2245
  // This activity is a visual marker only
2283
2246
  // It immediately completes and allows workflow to proceed
2284
2247
  console.log('[StartActivity] Workflow started');
2285
- return this.createResult(undefined, 'Done');
2248
+ return {
2249
+ success: true,
2250
+ message: {
2251
+ text: 'Workflow started',
2252
+ },
2253
+ data: {
2254
+ output: undefined,
2255
+ outcomes: {
2256
+ Done: true,
2257
+ },
2258
+ },
2259
+ };
2286
2260
  }
2287
2261
  }
2288
2262
 
@@ -2300,17 +2274,28 @@ var startActivity_activity = /*#__PURE__*/Object.freeze({
2300
2274
  * Usage:
2301
2275
  * ```typescript
2302
2276
  * const end = new EndActivity();
2303
- * await end.execute({});
2277
+ * await end.execute({ type: 'workflow-activity:end' });
2304
2278
  * ```
2305
2279
  */
2306
- class EndActivity extends Activity {
2280
+ class EndActivity {
2307
2281
  constructor() {
2308
- super('EndActivity');
2282
+ this.type = "workflow-activity:end";
2309
2283
  }
2310
2284
  async execute(input) {
2311
2285
  // This activity marks the end of workflow execution
2312
2286
  console.log('[EndActivity] Workflow completed');
2313
- return this.createResult(undefined, 'Done');
2287
+ return {
2288
+ success: true,
2289
+ message: {
2290
+ text: 'Workflow completed',
2291
+ },
2292
+ data: {
2293
+ output: undefined,
2294
+ outcomes: {
2295
+ Done: true,
2296
+ },
2297
+ },
2298
+ };
2314
2299
  }
2315
2300
  }
2316
2301
 
@@ -2339,18 +2324,10 @@ const provideWorkflowActivityCommands = () => provideCommandSetups([
2339
2324
  command: () => Promise.resolve().then(function () { return writeLine_activity; }).then(m => m.WriteLine),
2340
2325
  },
2341
2326
  // Control Flow Activities
2342
- {
2343
- key: 'workflow-activity:sequence',
2344
- command: () => Promise.resolve().then(function () { return sequence_activity; }).then(m => m.Sequence),
2345
- },
2346
2327
  {
2347
2328
  key: 'workflow-activity:if',
2348
2329
  command: () => Promise.resolve().then(function () { return if_activity; }).then(m => m.If),
2349
2330
  },
2350
- {
2351
- key: 'workflow-activity:while',
2352
- command: () => Promise.resolve().then(function () { return while_activity; }).then(m => m.While),
2353
- },
2354
2331
  {
2355
2332
  key: 'workflow-activity:for-each',
2356
2333
  command: () => Promise.resolve().then(function () { return forEach_activity; }).then(m => m.ForEach),
@@ -2512,5 +2489,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
2512
2489
  * Generated bundle index. Do not edit.
2513
2490
  */
2514
2491
 
2515
- export { AXPActivityCategoryProviderService, AXPActivityProviderService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionRegistryService, AXPWorkflowDefinitionResolver, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_DEFINITION_LOADER, Activity, ActivityRegistry, DispatchEvent, EndActivity, ExecuteCommand, ExecuteQuery, ForEach, If, Navigate, Sequence, SetVariable, ShowAlertDialog, ShowConfirmDialog, ShowDialogLayoutBuilder, ShowToast, StartActivity, While, WorkflowCoordinator, WriteLine, createWorkFlowEvent, ofType, provideWorkflowActivityCommands };
2492
+ export { AXPActivityCategoryProviderService, AXPActivityProviderService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionRegistryService, AXPWorkflowDefinitionResolver, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_DEFINITION_LOADER, DispatchEvent, EndActivity, ExecuteCommand, ExecuteQuery, ForEach, If, Navigate, SetVariable, ShowAlertDialog, ShowConfirmDialog, ShowDialogLayoutBuilder, ShowToast, StartActivity, WorkflowCoordinator, WriteLine, createWorkFlowEvent, ofType, provideWorkflowActivityCommands };
2516
2493
  //# sourceMappingURL=acorex-platform-workflow.mjs.map