@acorex/connectivity 20.3.0-next.19 → 20.3.0-next.20

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.
@@ -22,7 +22,7 @@ import { AXPBarChartWidget, AXPDonutChartWidget, AXPGaugeChartWidget, AXPLineCha
22
22
  import { AXPTaskBoardShortcut, AXPTaskBoardWidget, RootConfig as RootConfig$h, AXPWorkflowTaskProvider } from '@acorex/modules/task-management';
23
23
  import { AXPMyNotificationDashboardWidget, RootConfig as RootConfig$b, AXMNotificationEntityServiceImpl, AXMNotificationEntityService } from '@acorex/modules/notification-management';
24
24
  import { RootConfig as RootConfig$5, AXMMetaDataDefinitionService } from '@acorex/modules/data-management';
25
- import { get, set } from 'lodash-es';
25
+ import { get, upperFirst, set } from 'lodash-es';
26
26
  import { provideQuerySetups, AXPCommandService, provideCommandSetups, AXPQueryService, AXPRuntimeModule } from '@acorex/platform/runtime';
27
27
  import { AXMDistributionServiceImpl, AXMDocumentService, AXMDistributionInteractionService, RootConfig as RootConfig$6, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMReviewService, AXMReviewServiceImpl, AXMDistributionInteractionServiceImpl, AXMFolderService, AXMDistributionService } from '@acorex/modules/document-management';
28
28
  import { AXDataSource } from '@acorex/cdk/common';
@@ -5632,7 +5632,6 @@ class AXCDistributionMockService extends AXMDistributionServiceImpl {
5632
5632
  }
5633
5633
  }
5634
5634
  catch (error) {
5635
- console.warn(`Failed to fetch document ${distribution.documentId} for distribution ${distribution.id}:`, error);
5636
5635
  // Continue without the document data if fetch fails
5637
5636
  }
5638
5637
  }
@@ -5660,7 +5659,6 @@ class AXCDistributionMockService extends AXMDistributionServiceImpl {
5660
5659
  distribution.status = assignedCount > 0 && signers.size === assignedCount ? 'done' : 'in-progress';
5661
5660
  }
5662
5661
  catch (error) {
5663
- console.warn(`Failed to compute interactions for distribution ${distribution.id}:`, error);
5664
5662
  distribution.viewedCount = distribution.viewedCount ?? `${0}/${distribution.assignedTo.length}`;
5665
5663
  distribution.signedCount = distribution.signedCount ?? `${0}/${distribution.assignedTo.length}`;
5666
5664
  distribution.status = distribution.status ?? 'in-progress';
@@ -5682,7 +5680,6 @@ class AXCDistributionMockService extends AXMDistributionServiceImpl {
5682
5680
  }
5683
5681
  }
5684
5682
  catch (error) {
5685
- console.warn(`Failed to fetch document ${distribution.documentId} for distribution ${id}:`, error);
5686
5683
  // Continue without the document data if fetch fails
5687
5684
  }
5688
5685
  }
@@ -6189,7 +6186,6 @@ class AXMFileMockService extends AXMDocumentServiceImpl {
6189
6186
  }
6190
6187
  }
6191
6188
  catch (error) {
6192
- console.warn(`Failed to fetch review for document ${item.id}:`, error);
6193
6189
  // Continue processing other items if one fails
6194
6190
  }
6195
6191
  }
@@ -6706,7 +6702,6 @@ class AXCReviewMockService extends AXMReviewServiceImpl {
6706
6702
  }
6707
6703
  }
6708
6704
  catch (error) {
6709
- console.warn(`Failed to fetch document ${review.documentId} for review ${review.id}:`, error);
6710
6705
  // Continue without the document data if fetch fails
6711
6706
  }
6712
6707
  }
@@ -6724,7 +6719,6 @@ class AXCReviewMockService extends AXMReviewServiceImpl {
6724
6719
  }
6725
6720
  }
6726
6721
  catch (error) {
6727
- console.warn(`Failed to fetch user ${review.reviewerId} for review ${review.id}:`, error);
6728
6722
  // Continue without the document data if fetch fails
6729
6723
  }
6730
6724
  }
@@ -6825,7 +6819,6 @@ class AXCDistributionInteractionMockService extends AXMDistributionInteractionSe
6825
6819
  }
6826
6820
  }
6827
6821
  catch (error) {
6828
- console.warn('Failed to get distribution record or create missing interaction records:', error);
6829
6822
  }
6830
6823
  }
6831
6824
  // Group items by creator user id
@@ -24460,6 +24453,7 @@ const EMPLOYEES_MOCK = [
24460
24453
  hireDate: new Date('2010-06-01'),
24461
24454
  managerId: null, // Sarah is a senior manager
24462
24455
  manager: null,
24456
+ imageId: [],
24463
24457
  },
24464
24458
  {
24465
24459
  id: uuid$g(),
@@ -24475,6 +24469,7 @@ const EMPLOYEES_MOCK = [
24475
24469
  hireDate: new Date('2005-09-12'),
24476
24470
  managerId: null, // Mike is a senior manager
24477
24471
  manager: null,
24472
+ imageId: [],
24478
24473
  },
24479
24474
  {
24480
24475
  id: uuid$g(),
@@ -24490,6 +24485,7 @@ const EMPLOYEES_MOCK = [
24490
24485
  hireDate: new Date('2018-01-15'),
24491
24486
  managerId: null, // Emily is a senior manager
24492
24487
  manager: null,
24488
+ imageId: [],
24493
24489
  },
24494
24490
  {
24495
24491
  id: uuid$g(),
@@ -24505,6 +24501,7 @@ const EMPLOYEES_MOCK = [
24505
24501
  hireDate: new Date('2012-03-05'),
24506
24502
  managerId: null, // David is a senior manager
24507
24503
  manager: null,
24504
+ imageId: [],
24508
24505
  },
24509
24506
  {
24510
24507
  id: uuid$g(),
@@ -24520,6 +24517,7 @@ const EMPLOYEES_MOCK = [
24520
24517
  hireDate: new Date('2014-07-11'),
24521
24518
  managerId: null, // Lisa is a senior manager
24522
24519
  manager: null,
24520
+ imageId: [],
24523
24521
  },
24524
24522
  {
24525
24523
  id: uuid$g(),
@@ -24535,6 +24533,7 @@ const EMPLOYEES_MOCK = [
24535
24533
  hireDate: new Date('2019-03-15'),
24536
24534
  managerId: 'EMP002', // Reports to Sarah Johnson
24537
24535
  manager: null, // Will be set after initialization
24536
+ imageId: [],
24538
24537
  },
24539
24538
  {
24540
24539
  id: uuid$g(),
@@ -24550,6 +24549,7 @@ const EMPLOYEES_MOCK = [
24550
24549
  hireDate: new Date('2016-11-08'),
24551
24550
  managerId: 'EMP003', // Reports to Mike Chen
24552
24551
  manager: null, // Will be set after initialization
24552
+ imageId: [],
24553
24553
  },
24554
24554
  {
24555
24555
  id: uuid$g(),
@@ -24565,6 +24565,7 @@ const EMPLOYEES_MOCK = [
24565
24565
  hireDate: new Date('2011-05-22'),
24566
24566
  managerId: 'EMP009', // Reports to David Thompson
24567
24567
  manager: null, // Will be set after initialization
24568
+ imageId: [],
24568
24569
  },
24569
24570
  {
24570
24571
  id: uuid$g(),
@@ -24580,6 +24581,7 @@ const EMPLOYEES_MOCK = [
24580
24581
  hireDate: new Date('2020-08-10'),
24581
24582
  managerId: 'EMP010', // Reports to Lisa Wang
24582
24583
  manager: null, // Will be set after initialization
24584
+ imageId: [],
24583
24585
  },
24584
24586
  {
24585
24587
  id: uuid$g(),
@@ -24595,6 +24597,7 @@ const EMPLOYEES_MOCK = [
24595
24597
  hireDate: new Date('2017-02-28'),
24596
24598
  managerId: 'EMP002', // Reports to Sarah Johnson
24597
24599
  manager: null, // Will be set after initialization
24600
+ imageId: [],
24598
24601
  },
24599
24602
  {
24600
24603
  id: uuid$g(),
@@ -24610,6 +24613,7 @@ const EMPLOYEES_MOCK = [
24610
24613
  hireDate: new Date('2019-09-15'),
24611
24614
  managerId: 'EMP003', // Reports to Mike Chen
24612
24615
  manager: null, // Will be set after initialization
24616
+ imageId: [],
24613
24617
  },
24614
24618
  {
24615
24619
  id: uuid$g(),
@@ -24625,6 +24629,7 @@ const EMPLOYEES_MOCK = [
24625
24629
  hireDate: new Date('2015-12-01'),
24626
24630
  managerId: 'EMP009', // Reports to David Thompson
24627
24631
  manager: null, // Will be set after initialization
24632
+ imageId: [],
24628
24633
  },
24629
24634
  {
24630
24635
  id: uuid$g(),
@@ -24640,6 +24645,7 @@ const EMPLOYEES_MOCK = [
24640
24645
  hireDate: new Date('2018-06-20'),
24641
24646
  managerId: 'EMP010', // Reports to Lisa Wang
24642
24647
  manager: null, // Will be set after initialization
24648
+ imageId: [],
24643
24649
  },
24644
24650
  {
24645
24651
  id: uuid$g(),
@@ -24655,6 +24661,7 @@ const EMPLOYEES_MOCK = [
24655
24661
  hireDate: new Date('2013-04-12'),
24656
24662
  managerId: 'EMP002', // Reports to Sarah Johnson
24657
24663
  manager: null, // Will be set after initialization
24664
+ imageId: [],
24658
24665
  },
24659
24666
  {
24660
24667
  id: uuid$g(),
@@ -24670,6 +24677,7 @@ const EMPLOYEES_MOCK = [
24670
24677
  hireDate: new Date('2016-01-30'),
24671
24678
  managerId: 'EMP003', // Reports to Mike Chen
24672
24679
  manager: null, // Will be set after initialization
24680
+ imageId: [],
24673
24681
  },
24674
24682
  {
24675
24683
  id: uuid$g(),
@@ -24685,6 +24693,7 @@ const EMPLOYEES_MOCK = [
24685
24693
  hireDate: new Date('2016-01-30'),
24686
24694
  managerId: 'EMP003', // Reports to Mike Chen
24687
24695
  manager: null, // Will be set after initialization
24696
+ imageId: [],
24688
24697
  },
24689
24698
  {
24690
24699
  id: uuid$g(),
@@ -24700,6 +24709,7 @@ const EMPLOYEES_MOCK = [
24700
24709
  hireDate: new Date('2016-01-30'),
24701
24710
  managerId: 'EMP003', // Reports to Mike Chen
24702
24711
  manager: null, // Will be set after initialization
24712
+ imageId: [],
24703
24713
  },
24704
24714
  ];
24705
24715
  // Set manager references after all employees are defined
@@ -25490,6 +25500,11 @@ const EMPLOYEE_SKILLS_REPORT = {
25490
25500
  valueField: 'id',
25491
25501
  textField: 'title',
25492
25502
  dataSource: SKILLS_MOCK,
25503
+ validations: [
25504
+ {
25505
+ rule: 'required',
25506
+ },
25507
+ ],
25493
25508
  },
25494
25509
  },
25495
25510
  },
@@ -31960,7 +31975,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
31960
31975
  class AXCWorkflowManagementMockModule {
31961
31976
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXCWorkflowManagementMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
31962
31977
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.3", ngImport: i0, type: AXCWorkflowManagementMockModule }); }
31963
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXCWorkflowManagementMockModule }); }
31978
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXCWorkflowManagementMockModule, providers: [
31979
+ provideCommandSetups([
31980
+ {
31981
+ key: 'Distribution:Record',
31982
+ command: () => import('./acorex-connectivity-mock-distribution-record.command-DG45yvDA.mjs').then((c) => c.AXCDistributionCommand),
31983
+ },
31984
+ ]),
31985
+ // {
31986
+ // provide: AXP_WORKFLOW_TASK_PROVIDER,
31987
+ // useClass: AXPTaskBoardProjectManagementTaskProvider,
31988
+ // multi: true,
31989
+ // },
31990
+ // {
31991
+ // provide: AXP_WORKFLOW_TASK_PROVIDER,
31992
+ // useClass: AXPTaskBoardPlatformManagementTaskProvider,
31993
+ // multi: true,
31994
+ // },
31995
+ ] }); }
31964
31996
  }
31965
31997
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXCWorkflowManagementMockModule, decorators: [{
31966
31998
  type: NgModule,
@@ -31969,16 +32001,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
31969
32001
  exports: [],
31970
32002
  declarations: [],
31971
32003
  providers: [
31972
- // {
31973
- // provide: AXP_WORKFLOW_TASK_PROVIDER,
31974
- // useClass: AXPTaskBoardProjectManagementTaskProvider,
31975
- // multi: true,
31976
- // },
31977
- // {
31978
- // provide: AXP_WORKFLOW_TASK_PROVIDER,
31979
- // useClass: AXPTaskBoardPlatformManagementTaskProvider,
31980
- // multi: true,
31981
- // },
32004
+ provideCommandSetups([
32005
+ {
32006
+ key: 'Distribution:Record',
32007
+ command: () => import('./acorex-connectivity-mock-distribution-record.command-DG45yvDA.mjs').then((c) => c.AXCDistributionCommand),
32008
+ },
32009
+ ]),
32010
+ // {
32011
+ // provide: AXP_WORKFLOW_TASK_PROVIDER,
32012
+ // useClass: AXPTaskBoardProjectManagementTaskProvider,
32013
+ // multi: true,
32014
+ // },
32015
+ // {
32016
+ // provide: AXP_WORKFLOW_TASK_PROVIDER,
32017
+ // useClass: AXPTaskBoardPlatformManagementTaskProvider,
32018
+ // multi: true,
32019
+ // },
31982
32020
  ],
31983
32021
  }]
31984
32022
  }] });
@@ -36439,10 +36477,8 @@ const createFileCastMiddleware = {
36439
36477
  const fileId = ensureCleanFileId(file.source.value);
36440
36478
  try {
36441
36479
  await fileStorageService.remove(fileId);
36442
- console.log(`🗑️ Deleted file from storage: ${fileId}`);
36443
36480
  }
36444
36481
  catch (error) {
36445
- console.warn(`⚠️ Failed to delete file from storage: ${fileId}`, error);
36446
36482
  }
36447
36483
  }
36448
36484
  // Return null to indicate this file should be removed from the list
@@ -36476,11 +36512,9 @@ const createFileCastMiddleware = {
36476
36512
  }
36477
36513
  // Case 3: New file that needs uploading
36478
36514
  if (!file.source?.value) {
36479
- console.warn('❌ File does not have source.value');
36480
36515
  return null;
36481
36516
  }
36482
36517
  if (!(file.source.value instanceof Blob)) {
36483
- console.warn('❌ File source.value is not a Blob/File instance for upload:', typeof file.source.value);
36484
36518
  return null;
36485
36519
  }
36486
36520
  // Convert Blob to File to satisfy storage API
@@ -36518,11 +36552,9 @@ const createFileCastMiddleware = {
36518
36552
  return { id: docId, kind: 'document' };
36519
36553
  }
36520
36554
  catch (error) {
36521
- console.warn(`[file-cast] ⚠️ Failed to create document for new upload; returning file`, { newFileId, error });
36522
36555
  }
36523
36556
  }
36524
36557
  else {
36525
- console.warn(`[file-cast] ⚠️ Document service unavailable for new upload; returning file`, { newFileId });
36526
36558
  }
36527
36559
  }
36528
36560
  return { id: newFileId, kind: 'file' };
@@ -36617,7 +36649,6 @@ const createFileCastMiddleware = {
36617
36649
  }
36618
36650
  catch (e) {
36619
36651
  // Fallback: if anything fails, we will try to insert without parentId; mock may reject
36620
- console.warn('[file-cast] ⚠️ Failed to ensure folder path for document, inserting without parentId');
36621
36652
  }
36622
36653
  // Insert document record with resolved parent folder if available
36623
36654
  const id = await svc.insertOne({
@@ -36661,7 +36692,6 @@ const createFileCastMiddleware = {
36661
36692
  }
36662
36693
  else {
36663
36694
  // File was deleted or failed to process - return null to remove from array
36664
- console.warn(`[file-cast] ⚠️ Skipping array file (deleted/failed)`, { keyPath, index });
36665
36695
  return null;
36666
36696
  }
36667
36697
  }
@@ -36686,7 +36716,6 @@ const createFileCastMiddleware = {
36686
36716
  // File was deleted - set to null or remove the field entirely
36687
36717
  // For single files, we'll set to null to indicate deletion
36688
36718
  setValueByPath(ctx.data, keyPath, null);
36689
- console.warn(`[file-cast] ⚠️ Single file removed (deleted/failed)`, { keyPath });
36690
36719
  }
36691
36720
  }
36692
36721
  }));
@@ -36768,7 +36797,6 @@ const createFileCastMiddleware = {
36768
36797
  const info = infoMap.get(actualId);
36769
36798
  if (info)
36770
36799
  return convertStorageInfoToFileListItem(info);
36771
- console.warn(`[file-cast] ⚠️ File info not found`, { keyPath, fileId: actualId });
36772
36800
  return {
36773
36801
  id: actualId,
36774
36802
  name: 'Unknown File',
@@ -36793,7 +36821,6 @@ const createFileCastMiddleware = {
36793
36821
  listItem.meta = doc.meta;
36794
36822
  return listItem;
36795
36823
  }
36796
- console.warn(`[file-cast] ⚠️ Document not found`, { keyPath, documentId: actualDocId });
36797
36824
  return {
36798
36825
  id: actualDocId,
36799
36826
  name: 'Unknown Document',
@@ -36820,7 +36847,6 @@ const createFileCastMiddleware = {
36820
36847
  setValueByPath(resultData, keyPath, fileObject);
36821
36848
  }
36822
36849
  else {
36823
- console.warn(`[file-cast] ⚠️ File info not found`, { keyPath, fileId: actualFileId });
36824
36850
  setValueByPath(resultData, keyPath, {
36825
36851
  id: actualFileId,
36826
36852
  name: 'Unknown File',
@@ -36860,7 +36886,6 @@ const createFileCastMiddleware = {
36860
36886
  setValueByPath(resultData, keyPath, listItem);
36861
36887
  }
36862
36888
  else {
36863
- console.warn(`[file-cast] ⚠️ Document not found`, { keyPath, documentId: actualDocId });
36864
36889
  setValueByPath(resultData, keyPath, {
36865
36890
  id: actualDocId,
36866
36891
  name: 'Unknown Document',
@@ -36870,7 +36895,6 @@ const createFileCastMiddleware = {
36870
36895
  }
36871
36896
  }
36872
36897
  else {
36873
- console.warn(`[file-cast] ⚠️ Document service unavailable`, { keyPath, documentId: actualDocId });
36874
36898
  setValueByPath(resultData, keyPath, {
36875
36899
  id: actualDocId,
36876
36900
  name: 'Unknown Document',
@@ -36950,6 +36974,239 @@ const identifierCommitMiddleware = {
36950
36974
  },
36951
36975
  };
36952
36976
 
36977
+ // Toggle detailed logging for troubleshooting
36978
+ const DEBUG = false;
36979
+ /**
36980
+ * Lookup Resolver Middleware
36981
+ *
36982
+ * This middleware resolves lookup field IDs to full objects based on entity property definitions or naming conventions.
36983
+ *
36984
+ * Behavior:
36985
+ * - Runs on 'create' and 'update' operations
36986
+ * - Finds fields ending with 'Id' or 'Ids' (case sensitive)
36987
+ * - Resolves IDs to full objects from corresponding entity
36988
+ * - Replaces ID values with constructed objects
36989
+ *
36990
+ * Resolution Strategy (in order):
36991
+ * 1. Check entity property definition for LookupBox with entity option
36992
+ * 2. If property contains dot (X.assignId -> X.assign)
36993
+ * 3. Use current module name (ModuleName.assign)
36994
+ * 4. Try name variants with common modules
36995
+ *
36996
+ * Naming Convention:
36997
+ * - testId -> creates 'test' object with full record
36998
+ * - testIds -> creates 'testList' array with full records
36999
+ * - documentId -> creates 'document' object with full record
37000
+ * - categoryIds -> creates 'categoryList' array with full records
37001
+ *
37002
+ * Example:
37003
+ * Input: { stageId: "123" } with lookup to CustomerManagement.opportunityStage
37004
+ * Result: { stage: { id: "123", title: "Stage Title", ... } }
37005
+ */
37006
+ const lookupResolverMiddleware = {
37007
+ //#region ---- Middleware Configuration ----
37008
+ target: {
37009
+ ops: ['create', 'update'], // Only for write operations
37010
+ order: 10, // After policy enforcement, before other middlewares
37011
+ },
37012
+ //#endregion
37013
+ //#region ---- Middleware Execution ----
37014
+ execute: async (ctx, next) => {
37015
+ const registry = inject(AXPEntityDefinitionRegistryService);
37016
+ // Parse entity name (format: "Module.EntityName")
37017
+ const [moduleName, entityName] = ctx.entityName.split('.');
37018
+ if (!moduleName || !entityName || !ctx.data) {
37019
+ await next();
37020
+ return;
37021
+ }
37022
+ try {
37023
+ // Find fields ending with 'Id'/'ID' or 'Ids'/'IDs' (case-insensitive)
37024
+ const idFields = Object.keys(ctx.data).filter(fieldName => /(Ids|IDs|Id|ID)$/.test(fieldName));
37025
+ if (DEBUG)
37026
+ console.log('[lookup-resolver] idFields:', idFields);
37027
+ if (idFields.length === 0) {
37028
+ await next();
37029
+ return;
37030
+ }
37031
+ // Process each ID field
37032
+ await Promise.all(idFields.map(async (fieldName) => {
37033
+ const fieldValue = get(ctx.data, fieldName);
37034
+ if (fieldValue === null || fieldValue === undefined) {
37035
+ if (DEBUG)
37036
+ console.log(`[lookup-resolver] Skip ${fieldName}: null/undefined`);
37037
+ return;
37038
+ }
37039
+ if (DEBUG)
37040
+ console.log(`[lookup-resolver] Processing field '${fieldName}' value:`, fieldValue);
37041
+ try {
37042
+ // Determine if it's single or multiple IDs (case-insensitive)
37043
+ const isMultiple = /(Ids|IDs)$/.test(fieldName);
37044
+ // Support arrays and comma-separated strings for multiple
37045
+ const ids = Array.isArray(fieldValue)
37046
+ ? fieldValue
37047
+ : (isMultiple && typeof fieldValue === 'string')
37048
+ ? fieldValue.split(',').map(x => x.trim()).filter(Boolean)
37049
+ : [fieldValue];
37050
+ // Extract entity name from field name
37051
+ // documentId -> document, categoryIds -> category
37052
+ const targetEntityName = fieldName.replace(/(Ids|IDs|Id|ID)$/, '');
37053
+ if (DEBUG)
37054
+ console.log(`[lookup-resolver] targetEntityName='${targetEntityName}', isMultiple=${isMultiple}, ids=`, ids);
37055
+ let lookupEntityName = '';
37056
+ let lookupEntityDef = null;
37057
+ let idField = 'id';
37058
+ // Step 1: Get current entity definition and check if field has lookup
37059
+ try {
37060
+ const currentEntityDef = await registry.resolve(moduleName, entityName);
37061
+ if (currentEntityDef?.properties) {
37062
+ const property = currentEntityDef.properties.find((p) => p.name === fieldName);
37063
+ // Check if property has lookup options with entity option
37064
+ const opts = property?.schema?.interface?.options;
37065
+ if (opts?.['entity']) {
37066
+ const lookupEntity = opts['entity'];
37067
+ lookupEntityName = lookupEntity;
37068
+ idField = opts['valueField'] || 'id';
37069
+ if (DEBUG)
37070
+ console.log(`[lookup-resolver] Using property-defined lookup: ${lookupEntity}, valueField='${idField}'`);
37071
+ // Resolve the lookup entity definition
37072
+ const [lookupModule, lookupName] = lookupEntity.split('.');
37073
+ if (lookupModule && lookupName) {
37074
+ try {
37075
+ lookupEntityDef = await registry.resolve(lookupModule, lookupName);
37076
+ }
37077
+ catch {
37078
+ if (DEBUG)
37079
+ console.warn(`[lookup-resolver] Failed to resolve property-defined entity ${lookupEntity}`);
37080
+ }
37081
+ }
37082
+ }
37083
+ }
37084
+ }
37085
+ catch {
37086
+ // Continue with fallback logic
37087
+ }
37088
+ // Step 2: If no lookup found, use naming conventions
37089
+ if (!lookupEntityDef) {
37090
+ // Check if targetEntityName contains a dot (e.g., X.assignId -> X.assign)
37091
+ if (targetEntityName.includes('.')) {
37092
+ const parts = targetEntityName.split('.');
37093
+ const targetModule = parts[0];
37094
+ const targetEntity = parts.slice(1).join('.');
37095
+ lookupEntityName = `${targetModule}.${targetEntity}`;
37096
+ if (DEBUG)
37097
+ console.log(`[lookup-resolver] Using dotted name: ${lookupEntityName}`);
37098
+ try {
37099
+ lookupEntityDef = await registry.resolve(targetModule, targetEntity);
37100
+ }
37101
+ catch {
37102
+ if (DEBUG)
37103
+ console.warn(`[lookup-resolver] Failed dotted resolve: ${lookupEntityName}`);
37104
+ }
37105
+ }
37106
+ // If still no entity, try ModuleName.entityName
37107
+ if (!lookupEntityDef) {
37108
+ lookupEntityName = `${moduleName}.${targetEntityName}`;
37109
+ if (DEBUG)
37110
+ console.log(`[lookup-resolver] Using module fallback: ${lookupEntityName}`);
37111
+ try {
37112
+ lookupEntityDef = await registry.resolve(moduleName, targetEntityName);
37113
+ }
37114
+ catch {
37115
+ if (DEBUG)
37116
+ console.warn(`[lookup-resolver] Failed module fallback resolve: ${lookupEntityName}`);
37117
+ }
37118
+ }
37119
+ // Step 3: If still not found, try name variants with different modules
37120
+ if (!lookupEntityDef) {
37121
+ const nameVariants = [targetEntityName, upperFirst(targetEntityName)];
37122
+ const moduleVariants = [moduleName, 'DocumentManagement', 'ContentManagement', 'CustomerManagement', 'OrganizationManagement'];
37123
+ outer: for (const mod of moduleVariants) {
37124
+ for (const ent of nameVariants) {
37125
+ try {
37126
+ const def = await registry.resolve(mod, ent);
37127
+ if (def) {
37128
+ lookupEntityDef = def;
37129
+ lookupEntityName = `${mod}.${ent}`;
37130
+ if (DEBUG)
37131
+ console.log(`[lookup-resolver] Using variant: ${lookupEntityName}`);
37132
+ break outer;
37133
+ }
37134
+ }
37135
+ catch {
37136
+ // continue trying
37137
+ }
37138
+ }
37139
+ }
37140
+ }
37141
+ }
37142
+ if (!lookupEntityDef) {
37143
+ if (DEBUG)
37144
+ console.warn(`[lookup-resolver] Entity not resolved for field ${fieldName}; skip`);
37145
+ return;
37146
+ }
37147
+ // Query lookup entities
37148
+ if (DEBUG)
37149
+ console.log(`[lookup-resolver] Querying ${lookupEntityName} for ${idField} IN:`, ids);
37150
+ const lookupResults = await ctx.backend.query(lookupEntityName, {
37151
+ skip: 0,
37152
+ take: ids.length,
37153
+ filter: {
37154
+ field: idField,
37155
+ operator: { type: 'in' },
37156
+ value: ids,
37157
+ },
37158
+ });
37159
+ if (!lookupResults?.items || lookupResults.items.length === 0) {
37160
+ if (DEBUG)
37161
+ console.warn(`[lookup-resolver] No results for ${lookupEntityName} with ids:`, ids);
37162
+ return;
37163
+ }
37164
+ if (DEBUG)
37165
+ console.log(`[lookup-resolver] Retrieved ${lookupResults.items.length} item(s)`);
37166
+ // Create lookup objects map
37167
+ const lookupMap = new Map();
37168
+ lookupResults.items.forEach((item) => {
37169
+ const key = String(get(item, idField));
37170
+ lookupMap.set(key, item);
37171
+ });
37172
+ // Build resolved objects (full records)
37173
+ const resolvedObjects = ids.map((id) => {
37174
+ const lookupItem = lookupMap.get(String(id));
37175
+ if (!lookupItem) {
37176
+ return null;
37177
+ }
37178
+ return lookupItem; // Return full record
37179
+ }).filter(Boolean);
37180
+ if (DEBUG) {
37181
+ const missing = ids.filter((id) => !lookupMap.has(String(id)));
37182
+ if (missing.length)
37183
+ console.warn(`[lookup-resolver] Missing ${missing.length} id(s) not found in ${lookupEntityName}:`, missing);
37184
+ }
37185
+ if (DEBUG)
37186
+ console.log(`[lookup-resolver] Resolved ${resolvedObjects.length}/${ids.length} object(s)`);
37187
+ // Determine target field name
37188
+ const targetFieldName = isMultiple ? `${targetEntityName}List` : targetEntityName;
37189
+ // Replace field value with resolved objects
37190
+ set(ctx.data, targetFieldName, isMultiple ? resolvedObjects : resolvedObjects[0] || null);
37191
+ if (DEBUG)
37192
+ console.log(`[lookup-resolver] Set '${targetFieldName}' (kept '${fieldName}')`);
37193
+ }
37194
+ catch (error) {
37195
+ console.error(`[lookup-resolver] ❌ Failed to resolve lookup for field ${fieldName}:`, error);
37196
+ // Continue with original value on error
37197
+ }
37198
+ }));
37199
+ }
37200
+ catch (error) {
37201
+ console.error('[lookup-resolver] ❌ Unexpected error in lookup resolver middleware:', error);
37202
+ // Continue with original data on error
37203
+ }
37204
+ // Execute the main operation
37205
+ await next();
37206
+ },
37207
+ //#endregion
37208
+ };
37209
+
36953
37210
  function defaultIdField(dataPath) {
36954
37211
  const leaf = (dataPath || '').split('.').filter(Boolean).pop() || 'related';
36955
37212
  return `${leaf}Id`;
@@ -37676,6 +37933,7 @@ class AXCMiddlewaresModule {
37676
37933
  // Middlewares
37677
37934
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: policyEnforceMiddleware },
37678
37935
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: eventDispatchMiddleware },
37936
+ { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: lookupResolverMiddleware },
37679
37937
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: mergeDetailRelationMiddleware },
37680
37938
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: identifierCommitMiddleware },
37681
37939
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: childCountMiddleware },
@@ -37702,6 +37960,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
37702
37960
  // Middlewares
37703
37961
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: policyEnforceMiddleware },
37704
37962
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: eventDispatchMiddleware },
37963
+ { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: lookupResolverMiddleware },
37705
37964
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: mergeDetailRelationMiddleware },
37706
37965
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: identifierCommitMiddleware },
37707
37966
  { provide: AXP_ENTITY_STORAGE_MIDDLEWARE, multi: true, useValue: childCountMiddleware },
@@ -38767,5 +39026,5 @@ const AXCMockEntityLogListener = {
38767
39026
  * Generated bundle index. Do not edit.
38768
39027
  */
38769
39028
 
38770
- export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCalendarDataSeeder, AXCCalendarEventDataSeeder, AXCCalendarManagementMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCContentManagementMockModule, AXCConversationMockModule, AXCCustomerManagementMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDexieEntityStorageService, AXCDocumentManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCGoogleStrategyMock, AXCHelpDeskMockModule, AXCHumanCapitalManagementMockModule, AXCIdentifierManagementMockModule, AXCJsaSeeder, AXCLocaleManagementMockModule, AXCLocationManagementMockModule, AXCLockService, AXCLogManagementMockModule, AXCLogReportCategoryProvider, AXCLogReportDefinitionProvider, AXCMeetingManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMiddlewaresModule, AXCMockEntityLogListener, AXCMockModule, AXCNotificationManagementMockModule, AXCOrganizationManagementMockModule, AXCPartyManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCQueryCategoryMetadataInheritanceQuery, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTaskManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXCUserPassStrategyMock, AXCVersionDB, AXCWorkflowManagementMockModule, AXC_LOG_REPORT_CATEGORY_PROVIDER, AXC_LOG_REPORT_DEFINITION_PROVIDER, AXMAiResponderService, AXMBusinessUnitDataSeeder, AXMCalendarEventTypeSeeder, AXMEmployeeDataSeeder, AXMEmployeeSkillDataSeeder, AXMEmployeeSkillsCategoryProvider, AXMEmployeeSkillsReportDefinitionProvider, AXMEmploymentTypeDataSeeder, AXMFormDataSourcesProvider, AXMIndustryDataSeeder, AXMLeaveRequestDataSeeder, AXMMeetingDataSeeder, AXMMeetingFilesDataSeeder, AXMMeetingParticipantDataSeeder, AXMMeetingRoleTypeDataSeeder, AXMMeetingSessionDataSeeder, AXMMeetingTypeDataSeeder, AXMMeetingTypeFileTemplateDataSeeder, AXMPositionAssignmentDataSeeder, AXMPositionDataSeeder, AXMReportCategoryDataSeeder, AXMReportDefinitionDataSeeder, AXMReportExecuteCommand, AXMReportMockDataService, AXMResponsibilityDataSeeder, AXMRoleDataSeeder, AXMSkillDataSeeder, AXMSkillLevelDataSeeder, AXMTeamDataSeeder, AXM_EMPLOYEE_SKILLS_CATEGORY_PROVIDER, AXM_EMPLOYEE_SKILLS_DEFINITION_PROVIDER, AXPDashboardDataSeeder, AXPIdentifierDB, AXPMessageDataSeeder, AXPMockChecksumProvider, AXPMockClockProvider, AXPMockIdentifierService, AXPMockLookupProvider, AXPMockPolicyProvider, AXPMockSequenceProvider, AXPRoomDataSeeder, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, AXPTaskBoardPlatformManagementTaskProvider, AXPTaskBoardProjectManagementTaskProvider, AXQEmployeeSkillsLevelPercentagesQuery, AXQEmployeeSkillsLevelsQuery, AXQEmployeeSkillsListQuery, AXQEmployeeSkillsSkillPercentagesQuery, AXQEmployeeSkillsStatsQuery, AXQEmployeeSkillsTrendQuery, AXVChangeType, BUSINESS_UNITS_MOCK, DASHBOARDS, EDITIONS, EMPLOYEES_MOCK, EMPLOYEE_SKILLS_MOCK, EMPLOYMENT_TYPES_MOCK, ENTITIES, FEATURES, GLOBAL_VARIABLES, LEAVE_REQUESTS_MOCK, MODULES, PERMISSIONS, POSITIONS_CATEGORY_MOCK, POSITIONS_MOCK, POSITION_ASSIGNMENTS_MOCK, PROPERTIES, RESPONSIBILITIES_CATEGORY_MOCK, RESPONSIBILITIES_MOCK, ROLES_CATEGORY_MOCK, ROLES_MOCK, SKILLS_CATEGORY_MOCK, SKILLS_MOCK, SKILL_LEVELS_MOCK, TASKS, TASK_STATUSES, TASK_TEMPLATES, TASK_TYPES, TEAMS_MOCK, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, VersioningService, applications, auditLoggerMiddleware, axVersionDB, calendarEventMock, calendarEventTypeMockData, calendarMock, childCountMiddleware, computeDiff, createAndSaveDashboardForUser, createDashboardForUser, createFileCastMiddleware, findContactMethod, findEmployeeById, findPartyById, generateUserDashboard, historyLoggerMiddleware, identifierCommitMiddleware, meetingFilesMock, meetingIds, meetingMock, meetingParticipantMock, meetingRoleTypeMock, meetingSessionMock, meetingTimeSlotMock, meetingTypeFileTemplateMock, meetingTypeMock, mergeDetailRelationMiddleware, mockRoleDefinitions, mockUsers, normalizeAnyFileArrayForView, normalizeSnapshotFileFieldsForView, participantIds, primaryMiddleware, signatureLoaderMiddleware, tenantsMock, toUiRows };
39029
+ export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCalendarDataSeeder, AXCCalendarEventDataSeeder, AXCCalendarManagementMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCContentManagementMockModule, AXCConversationMockModule, AXCCustomerManagementMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDexieEntityStorageService, AXCDocumentManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCGoogleStrategyMock, AXCHelpDeskMockModule, AXCHumanCapitalManagementMockModule, AXCIdentifierManagementMockModule, AXCJsaSeeder, AXCLocaleManagementMockModule, AXCLocationManagementMockModule, AXCLockService, AXCLogManagementMockModule, AXCLogReportCategoryProvider, AXCLogReportDefinitionProvider, AXCMeetingManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMiddlewaresModule, AXCMockEntityLogListener, AXCMockModule, AXCNotificationManagementMockModule, AXCOrganizationManagementMockModule, AXCPartyManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCQueryCategoryMetadataInheritanceQuery, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTaskManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXCUserPassStrategyMock, AXCVersionDB, AXCWorkflowManagementMockModule, AXC_LOG_REPORT_CATEGORY_PROVIDER, AXC_LOG_REPORT_DEFINITION_PROVIDER, AXMAiResponderService, AXMBusinessUnitDataSeeder, AXMCalendarEventTypeSeeder, AXMEmployeeDataSeeder, AXMEmployeeSkillDataSeeder, AXMEmployeeSkillsCategoryProvider, AXMEmployeeSkillsReportDefinitionProvider, AXMEmploymentTypeDataSeeder, AXMFormDataSourcesProvider, AXMIndustryDataSeeder, AXMLeaveRequestDataSeeder, AXMMeetingDataSeeder, AXMMeetingFilesDataSeeder, AXMMeetingParticipantDataSeeder, AXMMeetingRoleTypeDataSeeder, AXMMeetingSessionDataSeeder, AXMMeetingTypeDataSeeder, AXMMeetingTypeFileTemplateDataSeeder, AXMPositionAssignmentDataSeeder, AXMPositionDataSeeder, AXMReportCategoryDataSeeder, AXMReportDefinitionDataSeeder, AXMReportExecuteCommand, AXMReportMockDataService, AXMResponsibilityDataSeeder, AXMRoleDataSeeder, AXMSkillDataSeeder, AXMSkillLevelDataSeeder, AXMTeamDataSeeder, AXM_EMPLOYEE_SKILLS_CATEGORY_PROVIDER, AXM_EMPLOYEE_SKILLS_DEFINITION_PROVIDER, AXPDashboardDataSeeder, AXPIdentifierDB, AXPMessageDataSeeder, AXPMockChecksumProvider, AXPMockClockProvider, AXPMockIdentifierService, AXPMockLookupProvider, AXPMockPolicyProvider, AXPMockSequenceProvider, AXPRoomDataSeeder, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, AXPTaskBoardPlatformManagementTaskProvider, AXPTaskBoardProjectManagementTaskProvider, AXQEmployeeSkillsLevelPercentagesQuery, AXQEmployeeSkillsLevelsQuery, AXQEmployeeSkillsListQuery, AXQEmployeeSkillsSkillPercentagesQuery, AXQEmployeeSkillsStatsQuery, AXQEmployeeSkillsTrendQuery, AXVChangeType, BUSINESS_UNITS_MOCK, DASHBOARDS, EDITIONS, EMPLOYEES_MOCK, EMPLOYEE_SKILLS_MOCK, EMPLOYMENT_TYPES_MOCK, ENTITIES, FEATURES, GLOBAL_VARIABLES, LEAVE_REQUESTS_MOCK, MODULES, PERMISSIONS, POSITIONS_CATEGORY_MOCK, POSITIONS_MOCK, POSITION_ASSIGNMENTS_MOCK, PROPERTIES, RESPONSIBILITIES_CATEGORY_MOCK, RESPONSIBILITIES_MOCK, ROLES_CATEGORY_MOCK, ROLES_MOCK, SKILLS_CATEGORY_MOCK, SKILLS_MOCK, SKILL_LEVELS_MOCK, TASKS, TASK_STATUSES, TASK_TEMPLATES, TASK_TYPES, TEAMS_MOCK, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, VersioningService, applications, auditLoggerMiddleware, axVersionDB, calendarEventMock, calendarEventTypeMockData, calendarMock, childCountMiddleware, computeDiff, createAndSaveDashboardForUser, createDashboardForUser, createFileCastMiddleware, findContactMethod, findEmployeeById, findPartyById, generateUserDashboard, historyLoggerMiddleware, identifierCommitMiddleware, lookupResolverMiddleware, meetingFilesMock, meetingIds, meetingMock, meetingParticipantMock, meetingRoleTypeMock, meetingSessionMock, meetingTimeSlotMock, meetingTypeFileTemplateMock, meetingTypeMock, mergeDetailRelationMiddleware, mockRoleDefinitions, mockUsers, normalizeAnyFileArrayForView, normalizeSnapshotFileFieldsForView, participantIds, primaryMiddleware, signatureLoaderMiddleware, tenantsMock, toUiRows };
38771
39030
  //# sourceMappingURL=acorex-connectivity-mock.mjs.map