@acorex/connectivity 20.0.11 → 20.0.12

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.
@@ -1,5 +1,5 @@
1
1
  import * as i1 from '@acorex/platform/core';
2
- import { AXPSystemActionType, extractTextFromHtml, AXPDataGenerator, applySortArray, applyFilterArray } from '@acorex/platform/core';
2
+ import { AXPSystemActionType, extractTextFromHtml, AXPDataGenerator, applySortArray, applyFilterArray, AXPActivityLogProvider, AXP_ACTIVITY_LOG_PROVIDER } from '@acorex/platform/core';
3
3
  import Dexie from 'dexie';
4
4
  import { transform, isEqual } from 'lodash';
5
5
  import { AXPEntityDefinitionRegistryService, AXPEntityStorageService, AXP_DATA_SEEDER_TOKEN, AXPDataSeederService } from '@acorex/platform/layout/entity';
@@ -7,7 +7,7 @@ import * as i2 from '@acorex/platform/auth';
7
7
  import { AXPSessionService, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, AXPAuthModule } from '@acorex/platform/auth';
8
8
  import * as i0 from '@angular/core';
9
9
  import { inject, Injectable, NgModule } from '@angular/core';
10
- import { AXPLockService, AXPFileStorageStatus, AXPRegionalService, AXPFileStorageService } from '@acorex/platform/common';
10
+ import { AXPLockService, AXPFileStorageStatus, AXPRegionalService, AXPFileStorageService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
11
11
  import { AXSafePipe } from '@acorex/core/pipes';
12
12
  import { RootConfig, AXMUsersEntityService, AXMSessionStatusTypes, AXMDeviceSessionsServiceImpl, AXMDeviceSessionsService } from '@acorex/modules/security-management';
13
13
  import { AXMFormTemplateTypes, RootConfig as RootConfig$1, AXMFormTemplateManagementCategoryEntityServiceImpl, AXMFormTemplateManagementCategoryEntityService, AXMPermissionsKeys } from '@acorex/modules/form-template-management';
@@ -9493,9 +9493,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9493
9493
  }]
9494
9494
  }], ctorParameters: () => [{ type: i1.AXPAppStartUpService }, { type: i0.Injector }] });
9495
9495
 
9496
+ class AXCPActivityLogService extends AXPActivityLogProvider {
9497
+ constructor() {
9498
+ super(...arguments);
9499
+ this.storageService = inject(AXPEntityStorageService);
9500
+ }
9501
+ async getHistory(refId, refType, options) {
9502
+ // Get all history records for this entity
9503
+ let records = await this.storageService.query(`${refType}-history`, {
9504
+ filter: {
9505
+ logic: 'and',
9506
+ filters: [
9507
+ {
9508
+ field: 'reference.id',
9509
+ operator: {
9510
+ type: 'equal'
9511
+ },
9512
+ value: refId,
9513
+ },
9514
+ {
9515
+ field: 'reference.type',
9516
+ operator: {
9517
+ type: 'equal'
9518
+ },
9519
+ value: refType,
9520
+ }
9521
+ ]
9522
+ },
9523
+ take: 1000,
9524
+ skip: 0,
9525
+ sort: [
9526
+ {
9527
+ field: 'date',
9528
+ dir: 'desc',
9529
+ },
9530
+ ],
9531
+ });
9532
+ // Apply date filtering if specified
9533
+ if (options?.from || options?.to) {
9534
+ records.items = records.items.filter(r => {
9535
+ const recordDate = new Date(r.date);
9536
+ if (options.from && recordDate < options.from) {
9537
+ return false;
9538
+ }
9539
+ if (options.to && recordDate > options.to) {
9540
+ return false;
9541
+ }
9542
+ return true;
9543
+ });
9544
+ }
9545
+ // Sort by date descending (newest first)
9546
+ records.items.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
9547
+ // Apply pagination if specified
9548
+ if (options?.limit || options?.offset) {
9549
+ const offset = options?.offset || 0;
9550
+ const limit = options?.limit || records.items.length;
9551
+ records.items = records.items.slice(offset, offset + limit);
9552
+ }
9553
+ return records.items;
9554
+ }
9555
+ async getHistoryByIds(refId, refType, ids) {
9556
+ const all = await this.getHistory(refId, refType);
9557
+ return all.filter(r => ids.includes(r.id)).reverse();
9558
+ }
9559
+ }
9560
+
9561
+ class EntitySearchProvider {
9562
+ async search(text) {
9563
+ const db = new Dexie('ACoreXPlatform');
9564
+ const lowerText = text.toLowerCase(); // Normalize search text for case-insensitive search
9565
+ db.version(1).stores({
9566
+ 'entity-store': '++id, entityName, [entityName+id]',
9567
+ });
9568
+ // Fetch all records from the entity-store table
9569
+ const allRecords = await db.table('entity-store').toArray();
9570
+ // Filter records based on the search text
9571
+ const filteredRecords = allRecords.filter((record) => this.shallowSearch(record, lowerText));
9572
+ return filteredRecords.map((record) => ({
9573
+ group: `Module.${record.entityName}`,
9574
+ data: record,
9575
+ command: {
9576
+ // 'open-entity': {
9577
+ // entity: record.entityName,
9578
+ // data: record,
9579
+ // },
9580
+ name: 'open-entity',
9581
+ options: {
9582
+ entity: record.entityName,
9583
+ data: record,
9584
+ }
9585
+ },
9586
+ }));
9587
+ }
9588
+ // Helper function for shallow search
9589
+ shallowSearch(obj, text) {
9590
+ if (typeof obj !== 'object' || obj === null) {
9591
+ return false;
9592
+ }
9593
+ return Object.entries(obj).some(([key, value]) => {
9594
+ if (key != 'id' && key != 'entityName') {
9595
+ if (typeof value === 'string' || typeof value === 'number') {
9596
+ return value.toString().toLowerCase().includes(text);
9597
+ }
9598
+ return false;
9599
+ }
9600
+ else {
9601
+ return false;
9602
+ }
9603
+ });
9604
+ }
9605
+ }
9606
+
9607
+ class AXCCommonMockModule {
9608
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9609
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule }); }
9610
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, providers: [
9611
+ {
9612
+ provide: AXP_ACTIVITY_LOG_PROVIDER,
9613
+ useClass: AXCPActivityLogService,
9614
+ multi: true,
9615
+ },
9616
+ {
9617
+ provide: AXP_SEARCH_PROVIDER,
9618
+ useClass: EntitySearchProvider,
9619
+ multi: true,
9620
+ },
9621
+ ] }); }
9622
+ }
9623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, decorators: [{
9624
+ type: NgModule,
9625
+ args: [{
9626
+ imports: [],
9627
+ exports: [],
9628
+ declarations: [],
9629
+ providers: [
9630
+ {
9631
+ provide: AXP_ACTIVITY_LOG_PROVIDER,
9632
+ useClass: AXCPActivityLogService,
9633
+ multi: true,
9634
+ },
9635
+ {
9636
+ provide: AXP_SEARCH_PROVIDER,
9637
+ useClass: EntitySearchProvider,
9638
+ multi: true,
9639
+ },
9640
+ ],
9641
+ }]
9642
+ }] });
9643
+
9496
9644
  /**
9497
9645
  * Generated bundle index. Do not edit.
9498
9646
  */
9499
9647
 
9500
- export { AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCFileStorageService, AXCGlobalVariablesDataSeeder, AXCMetaDataDefinitionDataSeeder, AXCMockModule, AXCPlatformManagementMockModule, AXPDexieEntityStorageService, GLOBAL_VARIABLES, MOCKStrategy };
9648
+ 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, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXMAiResponderService, AXPDashboardDataSeeder, AXPDexieEntityStorageService, AXPMessageDataSeeder, AXPReportManagementDataSeeder, AXPRoomDataSeeder, CATEGORY_REPORT_MAPPING, DASHBOARDS, EDITIONS, ENTITIES, FEATURES, GLOBAL_VARIABLES, MOCKStrategy, MODULES, PERMISSIONS, PROPERTIES, REPORT_CATEGORIES, REPORT_DEFINITIONS, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, generateRandomDashboard };
9501
9649
  //# sourceMappingURL=acorex-connectivity-mock.mjs.map