@acorex/connectivity 20.0.20 → 20.0.21

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.
@@ -6521,157 +6521,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6521
6521
  type: Injectable
6522
6522
  }], ctorParameters: () => [] });
6523
6523
 
6524
- class AXCLockService {
6525
- constructor() {
6526
- // Local Dexie database for storing lock information independent of AXPEntityStorageService
6527
- //#region ---- Dexie In-Memory Lock Storage ----
6528
- this.className = 'locks';
6529
- //#endregion
6530
- this.entityName = this.className;
6531
- //#region ---- Cache Configuration & Management ----
6532
- /**
6533
- * Cache Time-To-Live in milliseconds. Default is 5 seconds but can be overridden
6534
- * at runtime using {@link setCacheDuration}.
6535
- */
6536
- this.cacheTTL = 5000;
6537
- /** In-memory cache for lock information. */
6538
- this.cacheMap = new Map();
6539
- // Initialise a dedicated Dexie database for lock management to avoid any
6540
- // dependency on the generic AXPEntityStorageService. Using a separate
6541
- // database name ensures we don't conflict with the existing entity-store
6542
- // schema while keeping things lightweight.
6543
- this.db = new Dexie('ACoreXPlatformLocks');
6544
- this.db.version(1).stores({ [this.className]: 'id, refId, refType, type' });
6545
- // Start cache invalidation timer with the default TTL.
6546
- this.startCacheTimer();
6547
- }
6548
- get lockTable() {
6549
- return this.db[this.className];
6550
- }
6551
- /**
6552
- * Generates a unique cache key based on the lock request parameters.
6553
- */
6554
- getCacheKey(req) {
6555
- return `${req.refId}|${req.refType}|${req.type ?? ''}`;
6556
- }
6557
- /**
6558
- * Starts or restarts the interval that clears the cache.
6559
- */
6560
- startCacheTimer() {
6561
- if (this.cacheTimer) {
6562
- clearInterval(this.cacheTimer);
6563
- }
6564
- this.cacheTimer = setInterval(() => this.cacheMap.clear(), this.cacheTTL);
6565
- }
6566
- /**
6567
- * Allows consumers to change the cache duration (in milliseconds) at runtime.
6568
- * The new duration is applied immediately.
6569
- */
6570
- setCacheDuration(ms) {
6571
- if (ms <= 0) {
6572
- throw new Error('Cache duration must be greater than zero.');
6573
- }
6574
- this.cacheTTL = ms;
6575
- this.startCacheTimer();
6576
- }
6577
- //#endregion
6578
- lock(request) {
6579
- //TODO locked by get info and save
6580
- const entity = {
6581
- id: AXPDataGenerator.uuid(),
6582
- ...request,
6583
- lockedBy: {
6584
- id: request.lockedBy.id,
6585
- name: '',
6586
- title: '',
6587
- },
6588
- };
6589
- return this.lockTable.add(entity).then(() => {
6590
- // Invalidate cache because underlying data has changed.
6591
- this.cacheMap.clear();
6592
- return entity;
6593
- });
6594
- }
6595
- async unlock(request) {
6596
- const items = await this.getItems(request);
6597
- if (items.length > 0) {
6598
- //TODO may be don't have id and multi primary key like this!!!!!
6599
- await this.lockTable.delete(items[0].id);
6600
- // Invalidate cache since data has changed.
6601
- this.cacheMap.clear();
6602
- }
6603
- else {
6604
- throw new Error('not found');
6605
- }
6606
- }
6607
- async check(request) {
6608
- try {
6609
- await this.getInfo(request);
6610
- return true;
6611
- }
6612
- catch {
6613
- return false;
6614
- }
6615
- }
6616
- async getInfo(request) {
6617
- const key = this.getCacheKey(request);
6618
- const cached = this.cacheMap.get(key);
6619
- if (cached) {
6620
- return cached;
6621
- }
6622
- const items = await this.getItems(request);
6623
- if (items.length > 0) {
6624
- this.cacheMap.set(key, items[0]);
6625
- return items[0];
6626
- }
6627
- else {
6628
- throw new Error('not found');
6629
- }
6630
- }
6631
- async getItems(request) {
6632
- const filters = [
6633
- {
6634
- field: 'refId',
6635
- operator: {
6636
- type: 'equal',
6637
- },
6638
- value: request.refId,
6639
- },
6640
- {
6641
- field: 'refType',
6642
- operator: {
6643
- type: 'equal',
6644
- },
6645
- value: request.refType,
6646
- },
6647
- ];
6648
- // Add type filter only when it is provided in the request
6649
- if (request.type !== undefined && request.type != null) {
6650
- filters.push({
6651
- field: 'type',
6652
- operator: {
6653
- type: 'equal',
6654
- },
6655
- value: request.type,
6656
- });
6657
- }
6658
- // Build Dexie query dynamically
6659
- let collection = this.lockTable.where(filters[0].field).equals(filters[0].value);
6660
- if (filters.length > 1) {
6661
- for (let i = 1; i < filters.length; i++) {
6662
- const f = filters[i];
6663
- collection = collection.and((item) => item[f.field] === f.value);
6664
- }
6665
- }
6666
- return collection.toArray();
6667
- }
6668
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6669
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService }); }
6670
- }
6671
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, decorators: [{
6672
- type: Injectable
6673
- }], ctorParameters: () => [] });
6674
-
6675
6524
  class AXCRegionalServiceImpl extends AXPRegionalService {
6676
6525
  constructor() {
6677
6526
  super(...arguments);
@@ -6802,10 +6651,6 @@ class AXCPlatformManagementMockModule {
6802
6651
  provide: AXPRegionalService,
6803
6652
  useClass: AXCRegionalServiceImpl,
6804
6653
  },
6805
- {
6806
- provide: AXPLockService,
6807
- useClass: AXCLockService,
6808
- },
6809
6654
  ] }); }
6810
6655
  }
6811
6656
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, decorators: [{
@@ -6847,10 +6692,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6847
6692
  provide: AXPRegionalService,
6848
6693
  useClass: AXCRegionalServiceImpl,
6849
6694
  },
6850
- {
6851
- provide: AXPLockService,
6852
- useClass: AXCLockService,
6853
- },
6854
6695
  ],
6855
6696
  }]
6856
6697
  }] });
@@ -9778,6 +9619,157 @@ class EntitySearchProvider {
9778
9619
  }
9779
9620
  }
9780
9621
 
9622
+ class AXCLockService {
9623
+ constructor() {
9624
+ // Local Dexie database for storing lock information independent of AXPEntityStorageService
9625
+ //#region ---- Dexie In-Memory Lock Storage ----
9626
+ this.className = 'locks';
9627
+ //#endregion
9628
+ this.entityName = this.className;
9629
+ //#region ---- Cache Configuration & Management ----
9630
+ /**
9631
+ * Cache Time-To-Live in milliseconds. Default is 5 seconds but can be overridden
9632
+ * at runtime using {@link setCacheDuration}.
9633
+ */
9634
+ this.cacheTTL = 5000;
9635
+ /** In-memory cache for lock information. */
9636
+ this.cacheMap = new Map();
9637
+ // Initialise a dedicated Dexie database for lock management to avoid any
9638
+ // dependency on the generic AXPEntityStorageService. Using a separate
9639
+ // database name ensures we don't conflict with the existing entity-store
9640
+ // schema while keeping things lightweight.
9641
+ this.db = new Dexie('ACoreXPlatformLocks');
9642
+ this.db.version(1).stores({ [this.className]: 'id, refId, refType, type' });
9643
+ // Start cache invalidation timer with the default TTL.
9644
+ this.startCacheTimer();
9645
+ }
9646
+ get lockTable() {
9647
+ return this.db[this.className];
9648
+ }
9649
+ /**
9650
+ * Generates a unique cache key based on the lock request parameters.
9651
+ */
9652
+ getCacheKey(req) {
9653
+ return `${req.refId}|${req.refType}|${req.type ?? ''}`;
9654
+ }
9655
+ /**
9656
+ * Starts or restarts the interval that clears the cache.
9657
+ */
9658
+ startCacheTimer() {
9659
+ if (this.cacheTimer) {
9660
+ clearInterval(this.cacheTimer);
9661
+ }
9662
+ this.cacheTimer = setInterval(() => this.cacheMap.clear(), this.cacheTTL);
9663
+ }
9664
+ /**
9665
+ * Allows consumers to change the cache duration (in milliseconds) at runtime.
9666
+ * The new duration is applied immediately.
9667
+ */
9668
+ setCacheDuration(ms) {
9669
+ if (ms <= 0) {
9670
+ throw new Error('Cache duration must be greater than zero.');
9671
+ }
9672
+ this.cacheTTL = ms;
9673
+ this.startCacheTimer();
9674
+ }
9675
+ //#endregion
9676
+ lock(request) {
9677
+ //TODO locked by get info and save
9678
+ const entity = {
9679
+ id: AXPDataGenerator.uuid(),
9680
+ ...request,
9681
+ lockedBy: {
9682
+ id: request.lockedBy.id,
9683
+ name: '',
9684
+ title: '',
9685
+ },
9686
+ };
9687
+ return this.lockTable.add(entity).then(() => {
9688
+ // Invalidate cache because underlying data has changed.
9689
+ this.cacheMap.clear();
9690
+ return entity;
9691
+ });
9692
+ }
9693
+ async unlock(request) {
9694
+ const items = await this.getItems(request);
9695
+ if (items.length > 0) {
9696
+ //TODO may be don't have id and multi primary key like this!!!!!
9697
+ await this.lockTable.delete(items[0].id);
9698
+ // Invalidate cache since data has changed.
9699
+ this.cacheMap.clear();
9700
+ }
9701
+ else {
9702
+ throw new Error('not found');
9703
+ }
9704
+ }
9705
+ async check(request) {
9706
+ try {
9707
+ await this.getInfo(request);
9708
+ return true;
9709
+ }
9710
+ catch {
9711
+ return false;
9712
+ }
9713
+ }
9714
+ async getInfo(request) {
9715
+ const key = this.getCacheKey(request);
9716
+ const cached = this.cacheMap.get(key);
9717
+ if (cached) {
9718
+ return cached;
9719
+ }
9720
+ const items = await this.getItems(request);
9721
+ if (items.length > 0) {
9722
+ this.cacheMap.set(key, items[0]);
9723
+ return items[0];
9724
+ }
9725
+ else {
9726
+ throw new Error('not found');
9727
+ }
9728
+ }
9729
+ async getItems(request) {
9730
+ const filters = [
9731
+ {
9732
+ field: 'refId',
9733
+ operator: {
9734
+ type: 'equal',
9735
+ },
9736
+ value: request.refId,
9737
+ },
9738
+ {
9739
+ field: 'refType',
9740
+ operator: {
9741
+ type: 'equal',
9742
+ },
9743
+ value: request.refType,
9744
+ },
9745
+ ];
9746
+ // Add type filter only when it is provided in the request
9747
+ if (request.type !== undefined && request.type != null) {
9748
+ filters.push({
9749
+ field: 'type',
9750
+ operator: {
9751
+ type: 'equal',
9752
+ },
9753
+ value: request.type,
9754
+ });
9755
+ }
9756
+ // Build Dexie query dynamically
9757
+ let collection = this.lockTable.where(filters[0].field).equals(filters[0].value);
9758
+ if (filters.length > 1) {
9759
+ for (let i = 1; i < filters.length; i++) {
9760
+ const f = filters[i];
9761
+ collection = collection.and((item) => item[f.field] === f.value);
9762
+ }
9763
+ }
9764
+ return collection.toArray();
9765
+ }
9766
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9767
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService }); }
9768
+ }
9769
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, decorators: [{
9770
+ type: Injectable
9771
+ }], ctorParameters: () => [] });
9772
+
9781
9773
  class AXCCommonMockModule {
9782
9774
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9783
9775
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule }); }
@@ -9792,6 +9784,10 @@ class AXCCommonMockModule {
9792
9784
  useClass: EntitySearchProvider,
9793
9785
  multi: true,
9794
9786
  },
9787
+ {
9788
+ provide: AXPLockService,
9789
+ useClass: AXCLockService,
9790
+ },
9795
9791
  ] }); }
9796
9792
  }
9797
9793
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, decorators: [{
@@ -9811,6 +9807,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9811
9807
  useClass: EntitySearchProvider,
9812
9808
  multi: true,
9813
9809
  },
9810
+ {
9811
+ provide: AXPLockService,
9812
+ useClass: AXCLockService,
9813
+ },
9814
9814
  ],
9815
9815
  }]
9816
9816
  }] });
@@ -10619,5 +10619,5 @@ class AXPSecurityManagementMockWidgetDataSourceProvider {
10619
10619
  * Generated bundle index. Do not edit.
10620
10620
  */
10621
10621
 
10622
- export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCConversationMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDocumentManagementMockModule, AXCFOrganizationManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCIssueManagementMockModule, AXCLogManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMockModule, AXCNotificationManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXMAiResponderService, AXPDashboardDataSeeder, AXPDexieEntityStorageService, AXPMessageDataSeeder, AXPReportManagementDataSeeder, AXPRoomDataSeeder, AXPSecurityManagementMockWidgetDataSourceProvider, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, CATEGORY_REPORT_MAPPING, DASHBOARDS, EDITIONS, ENTITIES, FEATURES, GLOBAL_VARIABLES, MOCKStrategy, MODULES, PERMISSIONS, PROPERTIES, REPORT_CATEGORIES, REPORT_DEFINITIONS, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, generateRandomDashboard };
10622
+ export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCConversationMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDocumentManagementMockModule, AXCFOrganizationManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCIssueManagementMockModule, AXCLockService, AXCLogManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMockModule, AXCNotificationManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXMAiResponderService, AXPDashboardDataSeeder, AXPDexieEntityStorageService, AXPMessageDataSeeder, AXPReportManagementDataSeeder, AXPRoomDataSeeder, AXPSecurityManagementMockWidgetDataSourceProvider, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, CATEGORY_REPORT_MAPPING, DASHBOARDS, EDITIONS, ENTITIES, FEATURES, GLOBAL_VARIABLES, MOCKStrategy, MODULES, PERMISSIONS, PROPERTIES, REPORT_CATEGORIES, REPORT_DEFINITIONS, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, generateRandomDashboard };
10623
10623
  //# sourceMappingURL=acorex-connectivity-mock.mjs.map