@acorex/platform 20.2.4-next.8 → 20.3.0-next.0

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.
@@ -716,10 +716,11 @@ class AXPBroadcastEventService {
716
716
  this.eventSubjects = new Map();
717
717
  this.pendingRequests = new Map();
718
718
  this.multiTabEventHistory = new Set(); // Prevent duplicate processing of the same event
719
+ this.instanceId = AXPDataGenerator.uuid();
719
720
  this.channel = new BroadcastChannel('platform_global_events');
720
721
  // Handle incoming messages
721
722
  this.channel.onmessage = (event) => {
722
- const { type, payload, requestId, response } = event.data;
723
+ const { type, payload, requestId, response, sourceId } = event.data;
723
724
  // Prevent processing the same event multiple times (multi-tab synchronization)
724
725
  if (requestId && this.multiTabEventHistory.has(requestId)) {
725
726
  return;
@@ -735,6 +736,10 @@ class AXPBroadcastEventService {
735
736
  return;
736
737
  }
737
738
  // Handle normal broadcast events
739
+ // Ignore events originating from this same instance to avoid double-delivery
740
+ if (sourceId && sourceId === this.instanceId) {
741
+ return;
742
+ }
738
743
  if (type && this.eventSubjects.has(type)) {
739
744
  this.eventSubjects.get(type).next({ data: payload, requestId });
740
745
  }
@@ -744,7 +749,11 @@ class AXPBroadcastEventService {
744
749
  * Publish an event without expecting a response
745
750
  */
746
751
  publish(type, payload) {
747
- this.channel.postMessage({ type, payload });
752
+ this.channel.postMessage({ type, payload, sourceId: this.instanceId });
753
+ // Local echo so same-tab listeners receive the event as well
754
+ if (this.eventSubjects.has(type)) {
755
+ this.eventSubjects.get(type).next({ data: payload });
756
+ }
748
757
  }
749
758
  /**
750
759
  * Subscribe to an event
@@ -767,7 +776,11 @@ class AXPBroadcastEventService {
767
776
  /**
768
777
  * Send a message and wait for a response with retry logic
769
778
  */
770
- async sendAndWaitForResponse(type, payload, options = { timeout: 60 * 60 * 1000, retries: 3, retryDelay: 1000 }) {
779
+ async sendAndWaitForResponse(type, payload, options = {
780
+ timeout: 60 * 60 * 1000,
781
+ retries: 3,
782
+ retryDelay: 1000,
783
+ }) {
771
784
  const requestId = AXPDataGenerator.uuid();
772
785
  const attemptRequest = (attempt) => {
773
786
  return new Promise((resolve, reject) => {
@@ -821,7 +834,7 @@ class AXPBroadcastEventService {
821
834
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AXPBroadcastEventService, decorators: [{
822
835
  type: Injectable,
823
836
  args: [{
824
- providedIn: 'root'
837
+ providedIn: 'root',
825
838
  }]
826
839
  }], ctorParameters: () => [] });
827
840
 
@@ -1515,38 +1528,46 @@ function applyCondition(item, condition) {
1515
1528
  if (!conditionType) {
1516
1529
  return true;
1517
1530
  }
1518
- switch (conditionType) {
1531
+ const op = String(conditionType);
1532
+ switch (op) {
1519
1533
  case 'equal':
1534
+ case 'eq':
1520
1535
  result = isEqual(valueToCompare, conditionValue);
1521
1536
  if (loggingEnabled) {
1522
1537
  console.log('Equal check result:', result);
1523
1538
  }
1524
1539
  break;
1525
1540
  case 'notEqual':
1541
+ case 'ne':
1542
+ case 'neq':
1526
1543
  result = !isEqual(valueToCompare, conditionValue);
1527
1544
  if (loggingEnabled) {
1528
1545
  console.log('Not equal check result:', result);
1529
1546
  }
1530
1547
  break;
1531
1548
  case 'greaterThan':
1549
+ case 'gt':
1532
1550
  result = gt(valueToCompare, conditionValue);
1533
1551
  if (loggingEnabled) {
1534
1552
  console.log('Greater than check result:', result);
1535
1553
  }
1536
1554
  break;
1537
1555
  case 'lessThan':
1556
+ case 'lt':
1538
1557
  result = lt(valueToCompare, conditionValue);
1539
1558
  if (loggingEnabled) {
1540
1559
  console.log('Less than check result:', result);
1541
1560
  }
1542
1561
  break;
1543
1562
  case 'greaterThanOrEqual':
1563
+ case 'gte':
1544
1564
  result = gte(valueToCompare, conditionValue);
1545
1565
  if (loggingEnabled) {
1546
1566
  console.log('Greater than or equal check result:', result);
1547
1567
  }
1548
1568
  break;
1549
1569
  case 'lessThanOrEqual':
1570
+ case 'lte':
1550
1571
  result = lte(valueToCompare, conditionValue);
1551
1572
  if (loggingEnabled) {
1552
1573
  console.log('Less than or equal check result:', result);
@@ -1643,7 +1664,9 @@ function applyCondition(item, condition) {
1643
1664
  console.log('Default case, returning true');
1644
1665
  }
1645
1666
  }
1646
- return result;
1667
+ // Apply negative flag if present on operator (invert the result)
1668
+ const isNegative = !!condition?.operator?.negative;
1669
+ return isNegative ? !result : result;
1647
1670
  }
1648
1671
  function applyFilterArray(dataArray, filters, logic = 'and') {
1649
1672
  if (filters && filters.length) {