udp-stencil-component-library 26.3.0 → 26.4.0-beta.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.
Files changed (51) hide show
  1. package/dist/cjs/advanced-search_12.cjs.entry.js +2 -2
  2. package/dist/cjs/ag-grid-base_63.cjs.entry.js +3 -3
  3. package/dist/cjs/ambient-template-grid.cjs.entry.js +2 -2
  4. package/dist/cjs/api-method-instance-grid.cjs.entry.js +4 -4
  5. package/dist/cjs/{apiMethodInstance-BBY8QR38.js → apiMethodInstance-0K09_ZVK.js} +1 -1
  6. package/dist/cjs/{apiUtils-BJMM5dtn.js → apiUtils-CizHWZU8.js} +21 -20
  7. package/dist/cjs/{catalog-store-CxtCXeLF.js → catalog-store-CyaEzZFg.js} +1 -1
  8. package/dist/cjs/{configureUdpColumnMods-CBB_FuoL.js → configureUdpColumnMods-BH2vf0d0.js} +24 -6
  9. package/dist/cjs/index.cjs.js +10 -5
  10. package/dist/cjs/{lookupHelper-CHQgG01N.js → lookupHelper-BRE25uqB.js} +26 -18
  11. package/dist/cjs/search-method-grid.cjs.entry.js +2 -2
  12. package/dist/collection/components/grid/new-grid/helperFunctions/configureUdpColumnMods.js +23 -5
  13. package/dist/collection/components/grid/new-grid/helperFunctions/lookupHelper.js +25 -17
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/udp-utilities/api-udp/apiUtils.js +21 -20
  16. package/dist/collection/udp-utilities/lookup/lookupUtils.js +3 -0
  17. package/dist/components/apiUtils.js +1 -1
  18. package/dist/components/configureUdpColumnMods.js +1 -1
  19. package/dist/components/index.js +1 -1
  20. package/dist/docs.json +1 -1
  21. package/dist/esm/advanced-search_12.entry.js +2 -2
  22. package/dist/esm/ag-grid-base_63.entry.js +3 -3
  23. package/dist/esm/ambient-template-grid.entry.js +2 -2
  24. package/dist/esm/api-method-instance-grid.entry.js +4 -4
  25. package/dist/esm/{apiMethodInstance-CsQEcb2U.js → apiMethodInstance-ntvOZHfA.js} +1 -1
  26. package/dist/esm/{apiUtils-oxtMm00a.js → apiUtils-Crz00whk.js} +21 -20
  27. package/dist/esm/{catalog-store-DyXZf2Fc.js → catalog-store-D1LvLGo_.js} +1 -1
  28. package/dist/esm/{configureUdpColumnMods-7rLs-wc2.js → configureUdpColumnMods-CXhuwtXi.js} +24 -6
  29. package/dist/esm/index.js +10 -6
  30. package/dist/esm/{lookupHelper-Bx-mQ_IX.js → lookupHelper-Cq8dS6ZL.js} +26 -18
  31. package/dist/esm/search-method-grid.entry.js +2 -2
  32. package/dist/stencil-library/advanced-search_12.entry.js +1 -1
  33. package/dist/stencil-library/ag-grid-base_63.entry.js +1 -1
  34. package/dist/stencil-library/ambient-template-grid.entry.js +1 -1
  35. package/dist/stencil-library/api-method-instance-grid.entry.js +1 -1
  36. package/dist/stencil-library/{apiMethodInstance-CsQEcb2U.js → apiMethodInstance-ntvOZHfA.js} +1 -1
  37. package/dist/stencil-library/apiUtils-Crz00whk.js +1 -0
  38. package/dist/stencil-library/{catalog-store-DyXZf2Fc.js → catalog-store-D1LvLGo_.js} +1 -1
  39. package/dist/stencil-library/configureUdpColumnMods-CXhuwtXi.js +1 -0
  40. package/dist/stencil-library/index.esm.js +1 -1
  41. package/dist/stencil-library/lookupHelper-Cq8dS6ZL.js +1 -0
  42. package/dist/stencil-library/search-method-grid.entry.js +1 -1
  43. package/dist/types/components/grid/new-grid/helperFunctions/lookupHelper.d.ts +3 -2
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/udp-utilities/api-udp/apiUtils.d.ts +18 -2
  46. package/dist/types/udp-utilities/lookup/lookup.d.ts +11 -0
  47. package/dist/types/udp-utilities/lookup/lookupUtils.d.ts +2 -0
  48. package/package.json +1 -1
  49. package/dist/stencil-library/apiUtils-oxtMm00a.js +0 -1
  50. package/dist/stencil-library/configureUdpColumnMods-7rLs-wc2.js +0 -1
  51. package/dist/stencil-library/lookupHelper-Bx-mQ_IX.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-G1ccGqOs.js');
4
4
  var conversionFunctions = require('./conversionFunctions-B_9y17KE.js');
5
- var catalogStore = require('./catalog-store-CxtCXeLF.js');
5
+ var catalogStore = require('./catalog-store-CyaEzZFg.js');
6
6
  var Close24 = require('@carbon/icons/es/close/24');
7
7
  var uuid = require('uuid');
8
8
  var Save16 = require('@carbon/icons/es/save/16');
@@ -15,7 +15,7 @@ var AdvancedQuery16 = require('@carbon/icons/es/ibm-watson--discovery/16');
15
15
  var DataEnrichment16 = require('@carbon/icons/es/idea/16');
16
16
  var Renew16 = require('@carbon/icons/es/renew/16');
17
17
  require('@stencil/store');
18
- require('./apiUtils-BJMM5dtn.js');
18
+ require('./apiUtils-CizHWZU8.js');
19
19
  require('deep-equal');
20
20
  require('./makeApiCall-CFfg9gI0.js');
21
21
  require('axios');
@@ -2,11 +2,11 @@
2
2
 
3
3
  var index = require('./index-G1ccGqOs.js');
4
4
  var agGridEnterpriseV33 = require('ag-grid-enterprise-v33');
5
- var apiUtils = require('./apiUtils-BJMM5dtn.js');
6
- var lookupHelper = require('./lookupHelper-CHQgG01N.js');
5
+ var apiUtils = require('./apiUtils-CizHWZU8.js');
6
+ var lookupHelper = require('./lookupHelper-BRE25uqB.js');
7
7
  var tenantUtils = require('./tenantUtils-BCKSE0vq.js');
8
8
  var statusRenderer = require('./status-renderer-9CQ-hhq8.js');
9
- var configureUdpColumnMods = require('./configureUdpColumnMods-CBB_FuoL.js');
9
+ var configureUdpColumnMods = require('./configureUdpColumnMods-BH2vf0d0.js');
10
10
  var lodashEs = require('lodash-es');
11
11
  var makeApiCall = require('./makeApiCall-CFfg9gI0.js');
12
12
  var configService = require('./configService-D-lDX-f_.js');
@@ -2,11 +2,11 @@
2
2
 
3
3
  var index = require('./index-G1ccGqOs.js');
4
4
  var immer = require('immer');
5
- var catalogStore = require('./catalog-store-CxtCXeLF.js');
5
+ var catalogStore = require('./catalog-store-CyaEzZFg.js');
6
6
  var ChooseItem16 = require('@carbon/icons/es/choose-item/16');
7
7
  var Star16 = require('@carbon/icons/es/star/16');
8
8
  var List16 = require('@carbon/icons/es/list/16');
9
- var apiUtils = require('./apiUtils-BJMM5dtn.js');
9
+ var apiUtils = require('./apiUtils-CizHWZU8.js');
10
10
  var transformSearchData = require('./transformSearchData-B4bk4Aik.js');
11
11
  var conversionFunctions = require('./conversionFunctions-B_9y17KE.js');
12
12
  var localforage = require('localforage');
@@ -4,12 +4,12 @@ var index = require('./index-G1ccGqOs.js');
4
4
  var makeApiCall = require('./makeApiCall-CFfg9gI0.js');
5
5
  var searchObject = require('./searchObject-DeDFFGcx.js');
6
6
  var lodashEs = require('lodash-es');
7
- var apiMethodInstance = require('./apiMethodInstance-BBY8QR38.js');
7
+ var apiMethodInstance = require('./apiMethodInstance-0K09_ZVK.js');
8
8
  var configService = require('./configService-D-lDX-f_.js');
9
9
  require('axios');
10
- require('./configureUdpColumnMods-CBB_FuoL.js');
11
- require('./lookupHelper-CHQgG01N.js');
12
- require('./apiUtils-BJMM5dtn.js');
10
+ require('./configureUdpColumnMods-BH2vf0d0.js');
11
+ require('./lookupHelper-BRE25uqB.js');
12
+ require('./apiUtils-CizHWZU8.js');
13
13
  require('deep-equal');
14
14
  require('@stencil/store');
15
15
  require('./tenantUtils-BCKSE0vq.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var configureUdpColumnMods = require('./configureUdpColumnMods-CBB_FuoL.js');
3
+ var configureUdpColumnMods = require('./configureUdpColumnMods-BH2vf0d0.js');
4
4
 
5
5
  function mapDotNetTypeToAgGridType(type) {
6
6
  const normalized = type.replace(/\?$/, '').trim().toLowerCase();
@@ -117,10 +117,12 @@ const getMappedPageList = (lookups = {}, pageList = []) => {
117
117
  const propertyValue = item[attribute];
118
118
  if (propertyValue !== null && propertyValue !== undefined) {
119
119
  const matchingLookupRow = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _a === void 0 ? void 0 : _a.find(row => {
120
- if (lookup.keyName && row[lookup.keyName]) {
121
- return row[lookup.keyName].toString() === propertyValue.toString();
122
- }
123
- return false;
120
+ var _a;
121
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
122
+ if (!keys.length)
123
+ return false;
124
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
125
+ return keys.every(k => row[k.name] != null && String(row[k.name]) === String(item[k.name]));
124
126
  });
125
127
  if (matchingLookupRow && lookup.valueName) {
126
128
  updatedItem[attribute] = matchingLookupRow[lookup.valueName];
@@ -143,24 +145,29 @@ function getCleanData(data, lookupsMap) {
143
145
  let cleanData = Object.assign({}, data);
144
146
  if (lookupsMap && cleanData) {
145
147
  Object.keys(lookupsMap).forEach(attribute => {
148
+ var _a;
146
149
  const lookupConfig = lookupsMap[attribute];
147
150
  const lookup = getLookupById(lookupConfig.value);
148
151
  if (Array.isArray(cleanData)) {
149
152
  // Data is an array of rows.
153
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
150
154
  cleanData.forEach((row, index) => {
151
- var _a;
155
+ var _a, _b;
152
156
  let currentValue = row[attribute];
153
- let temp = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _a === void 0 ? void 0 : _a.find(item => item[lookup.valueName] === currentValue);
157
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
158
+ let temp = (_b = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _b === void 0 ? void 0 : _b.find(item => item[lookup.valueName] === currentValue);
154
159
  if (temp != null)
155
- cleanData[index][attribute] = temp[lookup.keyName];
160
+ keys.forEach(k => { cleanData[index][k.name] = temp[k.name]; });
156
161
  });
157
162
  }
158
163
  else if (cleanData[attribute]) {
159
164
  // Data is a single row
160
165
  let currentValue = cleanData[attribute];
166
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
161
167
  let temp = lookup.data.find(item => item[lookup.valueName] === currentValue);
162
168
  if (temp != null)
163
- cleanData[attribute] = temp[lookup.keyName];
169
+ keys.forEach(k => { cleanData[k.name] = temp[k.name]; });
170
+ /* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
164
171
  }
165
172
  });
166
173
  }
@@ -192,24 +199,18 @@ async function processQueryResponseWithLookups(lookupApiMethodId, response, repl
192
199
  .then(response => {
193
200
  if (response) {
194
201
  const lookupConfig = lookupsMap[key];
195
- lookups[key] = {
196
- data: response.data,
197
- keyName: lookupConfig.lookupKeyName || response.keyName,
198
- valueName: lookupConfig.lookupValueName || response.valueName,
199
- businessObjectKey: response.businessObjectKey,
200
- };
202
+ lookups[key] = Object.assign({ data: response.data, keyName: lookupConfig.lookupKeyName || response.keyName,
203
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
204
+ udpLookupUdpLookupKey: response.udpLookupUdpLookupKey, valueName: lookupConfig.lookupValueName || response.valueName, businessObjectKey: response.businessObjectKey }, response);
201
205
  setLookupsDataMap({ [response.id]: response }, replaceCache);
202
206
  }
203
207
  })
204
208
  .catch(e => e));
205
209
  }
206
210
  else {
207
- lookups[key] = {
208
- data: existingLookup.data,
209
- keyName: lookupConfig.lookupKeyName || existingLookup.keyName,
210
- valueName: lookupConfig.lookupValueName || existingLookup.valueName,
211
- businessObjectKey: existingLookup.businessObjectKey,
212
- };
211
+ lookups[key] = Object.assign({ data: existingLookup.data, keyName: lookupConfig.lookupKeyName || existingLookup.keyName,
212
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
213
+ udpLookupUdpLookupKey: existingLookup.udpLookupUdpLookupKey, valueName: lookupConfig.lookupValueName || existingLookup.valueName, businessObjectKey: existingLookup.businessObjectKey }, existingLookup);
213
214
  }
214
215
  }
215
216
  });
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var store = require('@stencil/store');
4
- var apiUtils = require('./apiUtils-BJMM5dtn.js');
4
+ var apiUtils = require('./apiUtils-CizHWZU8.js');
5
5
 
6
6
  // src/global/state.ts
7
7
  const { state, onChange } = store.createStore({
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var lookupHelper = require('./lookupHelper-CHQgG01N.js');
3
+ var lookupHelper = require('./lookupHelper-BRE25uqB.js');
4
4
 
5
5
  /**
6
6
  * Finds an existing 'actions' column in an array of ColDefs and applies
@@ -37,14 +37,32 @@ function configureUdpColumnMods(columnDefs, disableColumnFiltering = false) {
37
37
  if ((_e = colDef === null || colDef === void 0 ? void 0 : colDef.context) === null || _e === void 0 ? void 0 : _e.lookupId) {
38
38
  const lookupId = colDef.context.lookupId;
39
39
  const field = colDef.field;
40
+ // If the filter was explicitly disabled upstream (e.g. a preview grid), only apply
41
+ // the valueGetter for lookup display — do not override the disabled filter.
42
+ if (colDef.filter === false) {
43
+ return Object.assign(Object.assign({}, colDef), { valueGetter: (params) => params.data[field + 'LookupValue'], sortable: false });
44
+ }
40
45
  return Object.assign(Object.assign({}, colDef), { valueGetter: (params) => params.data[field + 'LookupValue'], filterValueGetter: (params) => { var _a; return (_a = params.data) === null || _a === void 0 ? void 0 : _a[field]; }, filter: 'agSetColumnFilter', filterParams: Object.assign({ values: (params) => {
41
- lookupHelper.getLookupTable(lookupId).then(table => {
42
- params.success(Array.from(table.valueMap.keys()));
43
- });
46
+ lookupHelper.getLookupTable(lookupId)
47
+ .then(table => {
48
+ var _a, _b, _c, _d;
49
+ const keyName = (_d = (_b = (_a = table.keys.find(k => k.name.toLowerCase() === (field !== null && field !== void 0 ? field : '').toLowerCase())) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = table.keys[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
50
+ const uniqueFieldValues = new Set(Array.from(table.valueMap.keys()).map(innerMap => { var _a; return (_a = innerMap.get(keyName)) !== null && _a !== void 0 ? _a : ''; }));
51
+ params.success(Array.from(uniqueFieldValues));
52
+ })
53
+ .catch(() => params.success([]));
44
54
  }, valueFormatter: (params) => {
45
- var _a, _b;
55
+ var _a, _b, _c, _d, _e;
46
56
  const key = params.value == null ? '' : String(params.value);
47
- return (_b = (_a = lookupHelper.getLookupTableSync(lookupId)) === null || _a === void 0 ? void 0 : _a.valueMap.get(key)) !== null && _b !== void 0 ? _b : key;
57
+ const table = lookupHelper.getLookupTableSync(lookupId);
58
+ if (!table)
59
+ return key;
60
+ const keyName = (_d = (_b = (_a = table.keys.find(k => k.name.toLowerCase() === (field !== null && field !== void 0 ? field : '').toLowerCase())) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = table.keys[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
61
+ for (const [innerMap, resolvedValue] of table.valueMap.entries()) {
62
+ if (String((_e = innerMap.get(keyName)) !== null && _e !== void 0 ? _e : '') === key)
63
+ return resolvedValue;
64
+ }
65
+ return key;
48
66
  } }, colDef.filterParams), sortable: false });
49
67
  }
50
68
  if (disableColumnFiltering) {
@@ -3,20 +3,20 @@
3
3
  var formRegistry = require('./form-registry-Cme6U-bl.js');
4
4
  var axios = require('axios');
5
5
  var transformSearchData = require('./transformSearchData-B4bk4Aik.js');
6
- var catalogStore = require('./catalog-store-CxtCXeLF.js');
6
+ var catalogStore = require('./catalog-store-CyaEzZFg.js');
7
7
  var SearchBuilder = require('./SearchBuilder-ClIYV_dJ.js');
8
8
  var searchObject = require('./searchObject-DeDFFGcx.js');
9
9
  var catalogTree = require('./catalogTree-CnzW15ah.js');
10
10
  var configService = require('./configService-D-lDX-f_.js');
11
- var apiMethodInstance = require('./apiMethodInstance-BBY8QR38.js');
11
+ var apiMethodInstance = require('./apiMethodInstance-0K09_ZVK.js');
12
12
  var themeManager = require('./theme-manager-vLJfQYn8.js');
13
13
  require('@stencil/store');
14
- require('./apiUtils-BJMM5dtn.js');
14
+ require('./apiUtils-CizHWZU8.js');
15
15
  require('deep-equal');
16
16
  require('./makeApiCall-CFfg9gI0.js');
17
17
  require('./tenantUtils-BCKSE0vq.js');
18
- require('./configureUdpColumnMods-CBB_FuoL.js');
19
- require('./lookupHelper-CHQgG01N.js');
18
+ require('./configureUdpColumnMods-BH2vf0d0.js');
19
+ require('./lookupHelper-BRE25uqB.js');
20
20
  require('@fluentui/web-components');
21
21
  require('@fluentui/tokens');
22
22
 
@@ -79,6 +79,10 @@ const LookupColumnTypeId = {
79
79
  Double: 5,
80
80
  };
81
81
 
82
+ const getLookupKeysFormatted = (keys) => {
83
+ return keys.map((key) => key.name).join(', ') || '';
84
+ };
85
+
82
86
  /**
83
87
  * Build the Azure Maps provider trio (tile URL + address search + reverse
84
88
  * geocoder) from a subscription key. Returns `null` when the key is empty so
@@ -356,5 +360,6 @@ exports.LookupTypeId = LookupTypeId;
356
360
  exports.UdpWebSocketClient = UdpWebSocketClient;
357
361
  exports.apiMutate = apiMutate;
358
362
  exports.createAzureMapsProviders = createAzureMapsProviders;
363
+ exports.getLookupKeysFormatted = getLookupKeysFormatted;
359
364
  exports.getMergedConfig = getMergedConfig;
360
365
  exports.useMatchBreakpoint = useMatchBreakpoint;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var apiUtils = require('./apiUtils-BJMM5dtn.js');
3
+ var apiUtils = require('./apiUtils-CizHWZU8.js');
4
4
 
5
5
  function getCurrentApiCatalogId() {
6
6
  return sessionStorage.getItem('current-api-catalog-id');
@@ -13,21 +13,28 @@ async function getLookupTable(lookupId) {
13
13
  if (cached)
14
14
  return cached;
15
15
  const inFlight = pendingLookups.get(lookupId);
16
- if (inFlight)
16
+ if (inFlight !== undefined)
17
17
  return inFlight;
18
18
  const promise = (async () => {
19
19
  var _a, _b;
20
- const lookupApiMethodId = (_b = (_a = (await apiUtils.getPromotedLookupMethod(getCurrentApiCatalogId()))) === null || _a === void 0 ? void 0 : _a.unityBaseGetDataMethod) === null || _b === void 0 ? void 0 : _b.apiMethodId;
21
- const empty = { keyName: '', valueName: '', valueMap: new Map() };
22
- if (!lookupApiMethodId)
23
- return empty;
20
+ const empty = { keys: [], valueName: '', valueMap: new Map() };
24
21
  try {
22
+ const lookupApiMethodId = (_b = (_a = (await apiUtils.getPromotedLookupMethod(getCurrentApiCatalogId()))) === null || _a === void 0 ? void 0 : _a.unityBaseGetDataMethod) === null || _b === void 0 ? void 0 : _b.apiMethodId;
23
+ if (!lookupApiMethodId)
24
+ return empty;
25
25
  const response = await apiUtils.executeQueryWithParameters({ data: { id: lookupId } }, lookupApiMethodId);
26
- const { keyName, valueName, data } = response !== null && response !== void 0 ? response : {};
27
- if (!data || !keyName || !valueName)
26
+ let { keyName, udpLookupUdpLookupKey, valueName, data } = response !== null && response !== void 0 ? response : {};
27
+ if (!data || (!keyName && !udpLookupUdpLookupKey) || !valueName)
28
28
  return empty;
29
- const valueMap = new Map(data.map((item) => [String(item[keyName]), item[valueName]]));
30
- const table = { keyName, valueName, valueMap };
29
+ // If they are using legacy single key format, convert it to the new format for easier processing
30
+ if (!!keyName)
31
+ udpLookupUdpLookupKey = [{ name: keyName }];
32
+ const keys = udpLookupUdpLookupKey;
33
+ const valueMap = new Map(data.map((item) => {
34
+ const keyMap = new Map(keys.map((k) => [k.name, String(item[k.name])]));
35
+ return [keyMap, item[valueName]];
36
+ }));
37
+ const table = { keys: udpLookupUdpLookupKey, valueName, valueMap };
31
38
  resolvedLookups.set(lookupId, table);
32
39
  return table;
33
40
  }
@@ -63,17 +70,18 @@ async function processLookupsInData(rowData, columnDefs) {
63
70
  }
64
71
  await Promise.all(Array.from(uniqueLookupIds).map(id => getLookupTable(id)));
65
72
  return rowData.map(row => {
66
- var _a;
67
73
  const newRow = Object.assign({}, row);
68
74
  for (const [field, lookupId] of lookupsByField.entries()) {
69
- if (newRow[field] === null || newRow[field] === undefined)
70
- continue;
71
- const valueMap = (_a = resolvedLookups.get(lookupId)) === null || _a === void 0 ? void 0 : _a.valueMap;
72
- if (!valueMap)
75
+ const lookup = resolvedLookups.get(lookupId);
76
+ if (!(lookup === null || lookup === void 0 ? void 0 : lookup.valueMap))
73
77
  continue;
74
- const key = String(newRow[field]);
75
- if (valueMap.has(key)) {
76
- newRow[field + 'LookupValue'] = valueMap.get(key);
78
+ for (const [innerMap, resolvedValue] of lookup.valueMap.entries()) {
79
+ // The row must match on all keys to get the correct resolved value (handles multi-key lookups)
80
+ const allMatch = lookup.keys.every(k => String(innerMap.get(k.name)) === String(newRow[k.name]));
81
+ if (allMatch) {
82
+ newRow[field + 'LookupValue'] = resolvedValue;
83
+ break;
84
+ }
77
85
  }
78
86
  }
79
87
  return newRow;
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-G1ccGqOs.js');
4
- var apiUtils = require('./apiUtils-BJMM5dtn.js');
4
+ var apiUtils = require('./apiUtils-CizHWZU8.js');
5
5
  var searchObject = require('./searchObject-DeDFFGcx.js');
6
- var lookupHelper = require('./lookupHelper-CHQgG01N.js');
6
+ var lookupHelper = require('./lookupHelper-BRE25uqB.js');
7
7
  var makeApiCall = require('./makeApiCall-CFfg9gI0.js');
8
8
  var configService = require('./configService-D-lDX-f_.js');
9
9
  var isEqual = require('lodash-es/isEqual');
@@ -34,14 +34,32 @@ export function configureUdpColumnMods(columnDefs, disableColumnFiltering = fals
34
34
  if ((_e = colDef === null || colDef === void 0 ? void 0 : colDef.context) === null || _e === void 0 ? void 0 : _e.lookupId) {
35
35
  const lookupId = colDef.context.lookupId;
36
36
  const field = colDef.field;
37
+ // If the filter was explicitly disabled upstream (e.g. a preview grid), only apply
38
+ // the valueGetter for lookup display — do not override the disabled filter.
39
+ if (colDef.filter === false) {
40
+ return Object.assign(Object.assign({}, colDef), { valueGetter: (params) => params.data[field + 'LookupValue'], sortable: false });
41
+ }
37
42
  return Object.assign(Object.assign({}, colDef), { valueGetter: (params) => params.data[field + 'LookupValue'], filterValueGetter: (params) => { var _a; return (_a = params.data) === null || _a === void 0 ? void 0 : _a[field]; }, filter: 'agSetColumnFilter', filterParams: Object.assign({ values: (params) => {
38
- getLookupTable(lookupId).then(table => {
39
- params.success(Array.from(table.valueMap.keys()));
40
- });
43
+ getLookupTable(lookupId)
44
+ .then(table => {
45
+ var _a, _b, _c, _d;
46
+ const keyName = (_d = (_b = (_a = table.keys.find(k => k.name.toLowerCase() === (field !== null && field !== void 0 ? field : '').toLowerCase())) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = table.keys[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
47
+ const uniqueFieldValues = new Set(Array.from(table.valueMap.keys()).map(innerMap => { var _a; return (_a = innerMap.get(keyName)) !== null && _a !== void 0 ? _a : ''; }));
48
+ params.success(Array.from(uniqueFieldValues));
49
+ })
50
+ .catch(() => params.success([]));
41
51
  }, valueFormatter: (params) => {
42
- var _a, _b;
52
+ var _a, _b, _c, _d, _e;
43
53
  const key = params.value == null ? '' : String(params.value);
44
- return (_b = (_a = getLookupTableSync(lookupId)) === null || _a === void 0 ? void 0 : _a.valueMap.get(key)) !== null && _b !== void 0 ? _b : key;
54
+ const table = getLookupTableSync(lookupId);
55
+ if (!table)
56
+ return key;
57
+ const keyName = (_d = (_b = (_a = table.keys.find(k => k.name.toLowerCase() === (field !== null && field !== void 0 ? field : '').toLowerCase())) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = table.keys[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
58
+ for (const [innerMap, resolvedValue] of table.valueMap.entries()) {
59
+ if (String((_e = innerMap.get(keyName)) !== null && _e !== void 0 ? _e : '') === key)
60
+ return resolvedValue;
61
+ }
62
+ return key;
45
63
  } }, colDef.filterParams), sortable: false });
46
64
  }
47
65
  if (disableColumnFiltering) {
@@ -7,21 +7,28 @@ export async function getLookupTable(lookupId) {
7
7
  if (cached)
8
8
  return cached;
9
9
  const inFlight = pendingLookups.get(lookupId);
10
- if (inFlight)
10
+ if (inFlight !== undefined)
11
11
  return inFlight;
12
12
  const promise = (async () => {
13
13
  var _a, _b;
14
- const lookupApiMethodId = (_b = (_a = (await getPromotedLookupMethod(getCurrentApiCatalogId()))) === null || _a === void 0 ? void 0 : _a.unityBaseGetDataMethod) === null || _b === void 0 ? void 0 : _b.apiMethodId;
15
- const empty = { keyName: '', valueName: '', valueMap: new Map() };
16
- if (!lookupApiMethodId)
17
- return empty;
14
+ const empty = { keys: [], valueName: '', valueMap: new Map() };
18
15
  try {
16
+ const lookupApiMethodId = (_b = (_a = (await getPromotedLookupMethod(getCurrentApiCatalogId()))) === null || _a === void 0 ? void 0 : _a.unityBaseGetDataMethod) === null || _b === void 0 ? void 0 : _b.apiMethodId;
17
+ if (!lookupApiMethodId)
18
+ return empty;
19
19
  const response = await executeQueryWithParameters({ data: { id: lookupId } }, lookupApiMethodId);
20
- const { keyName, valueName, data } = response !== null && response !== void 0 ? response : {};
21
- if (!data || !keyName || !valueName)
20
+ let { keyName, udpLookupUdpLookupKey, valueName, data } = response !== null && response !== void 0 ? response : {};
21
+ if (!data || (!keyName && !udpLookupUdpLookupKey) || !valueName)
22
22
  return empty;
23
- const valueMap = new Map(data.map((item) => [String(item[keyName]), item[valueName]]));
24
- const table = { keyName, valueName, valueMap };
23
+ // If they are using legacy single key format, convert it to the new format for easier processing
24
+ if (!!keyName)
25
+ udpLookupUdpLookupKey = [{ name: keyName }];
26
+ const keys = udpLookupUdpLookupKey;
27
+ const valueMap = new Map(data.map((item) => {
28
+ const keyMap = new Map(keys.map((k) => [k.name, String(item[k.name])]));
29
+ return [keyMap, item[valueName]];
30
+ }));
31
+ const table = { keys: udpLookupUdpLookupKey, valueName, valueMap };
25
32
  resolvedLookups.set(lookupId, table);
26
33
  return table;
27
34
  }
@@ -57,17 +64,18 @@ export async function processLookupsInData(rowData, columnDefs) {
57
64
  }
58
65
  await Promise.all(Array.from(uniqueLookupIds).map(id => getLookupTable(id)));
59
66
  return rowData.map(row => {
60
- var _a;
61
67
  const newRow = Object.assign({}, row);
62
68
  for (const [field, lookupId] of lookupsByField.entries()) {
63
- if (newRow[field] === null || newRow[field] === undefined)
64
- continue;
65
- const valueMap = (_a = resolvedLookups.get(lookupId)) === null || _a === void 0 ? void 0 : _a.valueMap;
66
- if (!valueMap)
69
+ const lookup = resolvedLookups.get(lookupId);
70
+ if (!(lookup === null || lookup === void 0 ? void 0 : lookup.valueMap))
67
71
  continue;
68
- const key = String(newRow[field]);
69
- if (valueMap.has(key)) {
70
- newRow[field + 'LookupValue'] = valueMap.get(key);
72
+ for (const [innerMap, resolvedValue] of lookup.valueMap.entries()) {
73
+ // The row must match on all keys to get the correct resolved value (handles multi-key lookups)
74
+ const allMatch = lookup.keys.every(k => String(innerMap.get(k.name)) === String(newRow[k.name]));
75
+ if (allMatch) {
76
+ newRow[field + 'LookupValue'] = resolvedValue;
77
+ break;
78
+ }
71
79
  }
72
80
  }
73
81
  return newRow;
@@ -7,6 +7,7 @@ export { SearchBuilder, SearchUtilities, LogicalSearchOperator, SearchGroupingTy
7
7
  export * from './store/catalog-store';
8
8
  export { isCatalogModelObject, buildCatalogTree, buildIndices, findNodeByPath } from './udp-utilities/catalog';
9
9
  export * from './udp-utilities/lookup/lookup';
10
+ export * from './udp-utilities/lookup/lookupUtils';
10
11
  export * from './udp-utilities/tags/tag';
11
12
  export * from './udp-utilities/api-config';
12
13
  export * from './udp-utilities/api-method-instance';
@@ -90,10 +90,12 @@ const getMappedPageList = (lookups = {}, pageList = []) => {
90
90
  const propertyValue = item[attribute];
91
91
  if (propertyValue !== null && propertyValue !== undefined) {
92
92
  const matchingLookupRow = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _a === void 0 ? void 0 : _a.find(row => {
93
- if (lookup.keyName && row[lookup.keyName]) {
94
- return row[lookup.keyName].toString() === propertyValue.toString();
95
- }
96
- return false;
93
+ var _a;
94
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
95
+ if (!keys.length)
96
+ return false;
97
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
98
+ return keys.every(k => row[k.name] != null && String(row[k.name]) === String(item[k.name]));
97
99
  });
98
100
  if (matchingLookupRow && lookup.valueName) {
99
101
  updatedItem[attribute] = matchingLookupRow[lookup.valueName];
@@ -116,24 +118,29 @@ export function getCleanData(data, lookupsMap) {
116
118
  let cleanData = Object.assign({}, data);
117
119
  if (lookupsMap && cleanData) {
118
120
  Object.keys(lookupsMap).forEach(attribute => {
121
+ var _a;
119
122
  const lookupConfig = lookupsMap[attribute];
120
123
  const lookup = getLookupById(lookupConfig.value);
121
124
  if (Array.isArray(cleanData)) {
122
125
  // Data is an array of rows.
126
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
123
127
  cleanData.forEach((row, index) => {
124
- var _a;
128
+ var _a, _b;
125
129
  let currentValue = row[attribute];
126
- let temp = (_a = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _a === void 0 ? void 0 : _a.find(item => item[lookup.valueName] === currentValue);
130
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
131
+ let temp = (_b = lookup === null || lookup === void 0 ? void 0 : lookup.data) === null || _b === void 0 ? void 0 : _b.find(item => item[lookup.valueName] === currentValue);
127
132
  if (temp != null)
128
- cleanData[index][attribute] = temp[lookup.keyName];
133
+ keys.forEach(k => { cleanData[index][k.name] = temp[k.name]; });
129
134
  });
130
135
  }
131
136
  else if (cleanData[attribute]) {
132
137
  // Data is a single row
133
138
  let currentValue = cleanData[attribute];
139
+ const keys = (_a = lookup.udpLookupUdpLookupKey) !== null && _a !== void 0 ? _a : (lookup.keyName ? [{ name: lookup.keyName }] : []);
134
140
  let temp = lookup.data.find(item => item[lookup.valueName] === currentValue);
135
141
  if (temp != null)
136
- cleanData[attribute] = temp[lookup.keyName];
142
+ keys.forEach(k => { cleanData[k.name] = temp[k.name]; });
143
+ /* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */
137
144
  }
138
145
  });
139
146
  }
@@ -165,24 +172,18 @@ export async function processQueryResponseWithLookups(lookupApiMethodId, respons
165
172
  .then(response => {
166
173
  if (response) {
167
174
  const lookupConfig = lookupsMap[key];
168
- lookups[key] = {
169
- data: response.data,
170
- keyName: lookupConfig.lookupKeyName || response.keyName,
171
- valueName: lookupConfig.lookupValueName || response.valueName,
172
- businessObjectKey: response.businessObjectKey,
173
- };
175
+ lookups[key] = Object.assign({ data: response.data, keyName: lookupConfig.lookupKeyName || response.keyName,
176
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
177
+ udpLookupUdpLookupKey: response.udpLookupUdpLookupKey, valueName: lookupConfig.lookupValueName || response.valueName, businessObjectKey: response.businessObjectKey }, response);
174
178
  lookupsStore.setLookupsDataMap({ [response.id]: response }, replaceCache);
175
179
  }
176
180
  })
177
181
  .catch(e => e));
178
182
  }
179
183
  else {
180
- lookups[key] = {
181
- data: existingLookup.data,
182
- keyName: lookupConfig.lookupKeyName || existingLookup.keyName,
183
- valueName: lookupConfig.lookupValueName || existingLookup.valueName,
184
- businessObjectKey: existingLookup.businessObjectKey,
185
- };
184
+ lookups[key] = Object.assign({ data: existingLookup.data, keyName: lookupConfig.lookupKeyName || existingLookup.keyName,
185
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
186
+ udpLookupUdpLookupKey: existingLookup.udpLookupUdpLookupKey, valueName: lookupConfig.lookupValueName || existingLookup.valueName, businessObjectKey: existingLookup.businessObjectKey }, existingLookup);
186
187
  }
187
188
  }
188
189
  });
@@ -0,0 +1,3 @@
1
+ export const getLookupKeysFormatted = (keys) => {
2
+ return keys.map((key) => key.name).join(', ') || '';
3
+ };
@@ -1 +1 @@
1
- import t from"deep-equal";import{m as a}from"./makeApiCall.js";import{C as e}from"./configService.js";import{createStore as s}from"@stencil/store";import{g as o}from"./tenantUtils.js";let n=null;const i=async()=>(n||await(async()=>{await e.waitForConfig(),n={baseURL:e.integrationV1ApiUrl,baseURLV2:e.integrationV2ApiUrl,baseURLTenantV1:e.tenantV1ApiUrl,baseURLTenantV2:e.tenantV2ApiUrl,baseURLHost:e.productV1ApiUrl,securityServiceV1:e.securityV1ApiUrl}})(),n),{state:r,onChange:c}=s({lookupsDataMap:null});function l(t,a=!1){r.lookupsDataMap=a?t:Object.assign(Object.assign({},r.lookupsDataMap),t)}var d=Object.freeze({__proto__:null,onChange:c,setLookupsDataMap:l,state:r});const u=async()=>{const{baseURL:t}=await i();console.log("baseURL from External config:",t);const s=`${t}/tenantProductApiCatalogBase/tenant/${o()}/product/${e.config.UNITY_PRODUCT_ID}`;return a("GET",s)};let p;const w=(e,s,n,r=!1)=>{const c=[e,s,o(),"hotlist"!=n];if(!r&&p){if(t(p.args,c)){const{response:t}=p;return console.info(`Using prefetch for /apimethod/executeQueryAdHoc/${s} prefetch`,p.args,c),p=void 0,t}console.warn(`Failed to match arguments for /apimethod/executeQueryAdHoc/${s} prefetch:\nPrefetch args: %o\nExecute args: %o`,p.args,c),p=void 0}const l=i().then((({baseURL:t,baseURLHost:o})=>a("POST","hotlist"!=n?`${t}/apimethod/executeQueryAdHoc/${s}`:`${o}/UdpHotList/containingRecord`,e)));return r&&(console.info(`Prefetching /apimethod/executeQueryAdHoc/${s}`),p={args:c,response:l}),l},b=async t=>{const{baseURL:e}=await i();return a("GET",`${e}/apiCatalog/${t}`)},m=async(t,e)=>{console.log("executeQueryWithParameters called",e);const{baseURL:s}=await i();console.log("baseURL from External config:",s);const o=`${s}/apimethod/executeQueryWithParameters/${e}`;return await a("POST",o,t)};class f{constructor(){this.pageList=[]}}function $(t){const{state:a}=d;return a.lookupsDataMap&&t?a.lookupsDataMap[t]:null}function y(t,a){let e=Object.assign({},t);return a&&e&&Object.keys(a).forEach((t=>{const s=$(a[t].value);if(Array.isArray(e))e.forEach(((a,o)=>{var n;let i=a[t],r=null===(n=null==s?void 0:s.data)||void 0===n?void 0:n.find((t=>t[s.valueName]===i));null!=r&&(e[o][t]=r[s.keyName])}));else if(e[t]){let a=e[t],o=s.data.find((t=>t[s.valueName]===a));null!=o&&(e[t]=o[s.keyName])}})),e}const U=async(t={},a={},e,s,o,n,i)=>{const{lookupApiMethodId:r,prefetch:c=!1}=i;console.info("Udp Lookup Api Method Id IS Set",r),t[0].logicalSearchOperator=e;const d=Object.assign({},...t);let u=Object.assign({},d);a&&Array.isArray(a)&&a.length>0&&(u=Object.assign(Object.assign({},u),{filterElements:[...d.filterElements,...a]})),console.log("filter object AUI",JSON.stringify(u,null,2));const p=await w(u,s,"",c);return console.log("response from QUAD",p),r?await async function(t,a,e,s){let o=new f,n={};if(!a)return console.error("Could not retrieve query data"),null;n=s||(null==a?void 0:a.lookupsMap)||{},o=a;const i=[],r={};Object.keys(n).forEach((a=>{const s=n[a];if(null==s?void 0:s.value){const o=!e&&$(s.value),c={id:s.value};o?r[a]={data:o.data,keyName:s.lookupKeyName||o.keyName,valueName:s.lookupValueName||o.valueName,businessObjectKey:o.businessObjectKey}:i.push(Promise.resolve(t).then((t=>m({data:c},t))).then((t=>{if(t){const s=n[a];r[a]={data:t.data,keyName:s.lookupKeyName||t.keyName,valueName:s.lookupValueName||t.valueName,businessObjectKey:t.businessObjectKey},l({[t.id]:t},e)}})).catch((t=>t)))}})),await Promise.all(i);const c=((t={},a=[])=>a.map((a=>{const e=Object.assign({},a);return Object.keys(t).forEach((s=>{var o;const n=t[s],i=a[s];if(null!=i){const t=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.find((t=>!(!n.keyName||!t[n.keyName])&&t[n.keyName].toString()===i.toString()));t&&n.valueName&&(e[s]=t[n.valueName])}})),e})))(r,o.pageList);return o.pageList=c,o}(r,p,n,o):(console.log("response from executeQueryAdHocAndMapLookups",p),null==p?void 0:p.data)},L=async(t,e)=>{const{baseURLTenantV2:s}=await i(),o=`${s}/GridView/${t}/PartiallyFull`,n=await a("GET",o);console.log("data from utils:",n),e(n)},g=async(t,e)=>{const{baseURLTenantV2:s}=await i(),o=`${s}/GridView/${t}`,n=await a("DELETE",o);console.log("data from utils:",n),e(n)},T=async(t,e,s,o,n)=>{const{baseURLTenantV2:r}=await i(),c=`${r}/GridView/getFromUser/${t}/${e}?domainName=${o}&apiCatalogId=${s}`;n(await a("GET",c))},R=async(t,e)=>{const{baseURLTenantV2:s}=await i(),o=`${s}/GridView/gridConfigurations/${t}/${e}`;return await a("GET",o)},E=async(t,e,s,n,r,c,l,d,u)=>{const{baseURLTenantV2:p}=await i(),w=`${p}/GridView/createGridView`,b={gridView:{Name:n,GridViewVisibilityTypeId:l,isDefault:d,tenantId:o(),userId:t,gridId:e,domain:r,apiCatalogId:s},gridConfigurations:c};u(await a("POST",w,b))},h=async(t,e,s,n,r,c,l,d,u,p)=>{const{baseURLTenantV2:w}=await i(),b=`${w}/GridView/updateGridView/${t}`,m={gridView:{Name:r,GridViewVisibilityTypeId:u,isDefault:l,tenantId:o(),userId:e,gridId:s,domain:d,apiCatalogId:n},gridConfigurations:c};try{p(await a("PUT",b,m))}catch(t){console.error("Error updating view:",t)}},V=async(t,e,s,n,r,c,l,d,u)=>{const{baseURLTenantV2:p}=await i(),w=`${p}/GridView/${t}`,b={Name:r,GridViewVisibilityTypeId:d,isDefault:c,tenantId:o(),userId:e,gridId:s,domain:l,apiCatalogId:n};try{const t=await a("PUT",w,b);return u(t),t}catch(t){console.error("Error updating view:",t)}},G=async(t,e,s,o)=>{const{baseURLV2:n}=await i(),r=`${n}/action/grid/${t}`,c=await a("GET",r);if(e){const t=(await a("GET",`${n}/actionPermission`)).filter((t=>s.some((a=>a.permissionId===t.permissionId))));o(c.filter((a=>t.some((t=>t.actionId===a.actionId)))))}else o(c)},O=async t=>{const{baseURL:e}=await i();return console.log("baseURL from External config:",e),a("GET",`${e}/apimethodinstance/${t}`,{data:{}})},v=async t=>{const{baseURL:e}=await i();return console.log("baseURL from External config:",e),a("GET",`${e}/apimethod/${t}`)},j=async t=>{const s=`lookupMethod-${t}`,o=sessionStorage.getItem(s);if(o)return JSON.parse(o);const{baseURL:n}=await i(),r=await a("GET",`${n}/apiCatalog/${t}?includeCatalogObjectList=false&includePromotedMethods=false`),c=`${n}/apicatalog/${t}/promotedMethodEntities/UdpLookup/product/${r.productId?r.productId:e.config.UNITY_PRODUCT_ID}?compareSanitizedName=true`,l=await a("GET",c);return l&&sessionStorage.setItem(s,JSON.stringify(l)),l},I=async()=>{const{baseURLHost:t}=await i();return a("GET",`${t}/UdpHotList`,null)},H=async t=>{const{baseURLHost:e}=await i();return a("POST",`${e}/UdpHotList`,t)},P=async t=>{const{baseURLHost:e}=await i();return a("DELETE",`${e}/UdpHotList/${t}`,null)},C=async t=>{const{baseURLHost:e}=await i();return a("POST",`${e}/UdpHotListRecord`,t,!0)},S=async t=>{const{baseURLHost:e}=await i();return a("GET",`${e}/UdpHotList/${t}/full`,null,!0)},A=async t=>{const{baseURLHost:e}=await i();return a("DELETE",`${e}/udphotlistrecord/${t}`,null,!0)};export{u as a,O as b,v as c,j as d,b as e,T as f,y as g,L as h,g as i,I as j,C as k,P as l,S as m,H as n,w as o,G as p,m as q,h as r,E as s,A as t,V as u,U as v,R as w}
1
+ import t from"deep-equal";import{m as a}from"./makeApiCall.js";import{C as e}from"./configService.js";import{createStore as o}from"@stencil/store";import{g as s}from"./tenantUtils.js";let n=null;const i=async()=>(n||await(async()=>{await e.waitForConfig(),n={baseURL:e.integrationV1ApiUrl,baseURLV2:e.integrationV2ApiUrl,baseURLTenantV1:e.tenantV1ApiUrl,baseURLTenantV2:e.tenantV2ApiUrl,baseURLHost:e.productV1ApiUrl,securityServiceV1:e.securityV1ApiUrl}})(),n),{state:r,onChange:c}=o({lookupsDataMap:null});function l(t,a=!1){r.lookupsDataMap=a?t:Object.assign(Object.assign({},r.lookupsDataMap),t)}var d=Object.freeze({__proto__:null,onChange:c,setLookupsDataMap:l,state:r});const u=async()=>{const{baseURL:t}=await i();console.log("baseURL from External config:",t);const o=`${t}/tenantProductApiCatalogBase/tenant/${s()}/product/${e.config.UNITY_PRODUCT_ID}`;return a("GET",o)};let p;const m=(e,o,n,r=!1)=>{const c=[e,o,s(),"hotlist"!=n];if(!r&&p){if(t(p.args,c)){const{response:t}=p;return console.info(`Using prefetch for /apimethod/executeQueryAdHoc/${o} prefetch`,p.args,c),p=void 0,t}console.warn(`Failed to match arguments for /apimethod/executeQueryAdHoc/${o} prefetch:\nPrefetch args: %o\nExecute args: %o`,p.args,c),p=void 0}const l=i().then((({baseURL:t,baseURLHost:s})=>a("POST","hotlist"!=n?`${t}/apimethod/executeQueryAdHoc/${o}`:`${s}/UdpHotList/containingRecord`,e)));return r&&(console.info(`Prefetching /apimethod/executeQueryAdHoc/${o}`),p={args:c,response:l}),l},b=async t=>{const{baseURL:e}=await i();return a("GET",`${e}/apiCatalog/${t}`)},w=async(t,e)=>{console.log("executeQueryWithParameters called",e);const{baseURL:o}=await i();console.log("baseURL from External config:",o);const s=`${o}/apimethod/executeQueryWithParameters/${e}`;return await a("POST",s,t)};class f{constructor(){this.pageList=[]}}function $(t){const{state:a}=d;return a.lookupsDataMap&&t?a.lookupsDataMap[t]:null}function y(t,a){let e=Object.assign({},t);return a&&e&&Object.keys(a).forEach((t=>{var o;const s=$(a[t].value);if(Array.isArray(e))e.forEach(((a,o)=>{var n,i;let r=a[t];const c=null!==(n=s.udpLookupUdpLookupKey)&&void 0!==n?n:s.keyName?[{name:s.keyName}]:[];let l=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.find((t=>t[s.valueName]===r));null!=l&&c.forEach((t=>{e[o][t.name]=l[t.name]}))}));else if(e[t]){let a=e[t];const n=null!==(o=s.udpLookupUdpLookupKey)&&void 0!==o?o:s.keyName?[{name:s.keyName}]:[];let i=s.data.find((t=>t[s.valueName]===a));null!=i&&n.forEach((t=>{e[t.name]=i[t.name]}))}})),e}const L=async(t={},a={},e,o,s,n,i)=>{const{lookupApiMethodId:r,prefetch:c=!1}=i;console.info("Udp Lookup Api Method Id IS Set",r),t[0].logicalSearchOperator=e;const d=Object.assign({},...t);let u=Object.assign({},d);a&&Array.isArray(a)&&a.length>0&&(u=Object.assign(Object.assign({},u),{filterElements:[...d.filterElements,...a]})),console.log("filter object AUI",JSON.stringify(u,null,2));const p=await m(u,o,"",c);return console.log("response from QUAD",p),r?await async function(t,a,e,o){let s=new f,n={};if(!a)return console.error("Could not retrieve query data"),null;n=o||(null==a?void 0:a.lookupsMap)||{},s=a;const i=[],r={};Object.keys(n).forEach((a=>{const o=n[a];if(null==o?void 0:o.value){const s=!e&&$(o.value),c={id:o.value};s?r[a]=Object.assign({data:s.data,keyName:o.lookupKeyName||s.keyName,udpLookupUdpLookupKey:s.udpLookupUdpLookupKey,valueName:o.lookupValueName||s.valueName,businessObjectKey:s.businessObjectKey},s):i.push(Promise.resolve(t).then((t=>w({data:c},t))).then((t=>{if(t){const o=n[a];r[a]=Object.assign({data:t.data,keyName:o.lookupKeyName||t.keyName,udpLookupUdpLookupKey:t.udpLookupUdpLookupKey,valueName:o.lookupValueName||t.valueName,businessObjectKey:t.businessObjectKey},t),l({[t.id]:t},e)}})).catch((t=>t)))}})),await Promise.all(i);const c=((t={},a=[])=>a.map((a=>{const e=Object.assign({},a);return Object.keys(t).forEach((o=>{var s;const n=t[o];if(null!=a[o]){const t=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s.find((t=>{var e;const o=null!==(e=n.udpLookupUdpLookupKey)&&void 0!==e?e:n.keyName?[{name:n.keyName}]:[];return!!o.length&&o.every((e=>null!=t[e.name]&&String(t[e.name])===String(a[e.name])))}));t&&n.valueName&&(e[o]=t[n.valueName])}})),e})))(r,s.pageList);return s.pageList=c,s}(r,p,n,s):(console.log("response from executeQueryAdHocAndMapLookups",p),null==p?void 0:p.data)},U=async(t,e)=>{const{baseURLTenantV2:o}=await i(),s=`${o}/GridView/${t}/PartiallyFull`,n=await a("GET",s);console.log("data from utils:",n),e(n)},g=async(t,e)=>{const{baseURLTenantV2:o}=await i(),s=`${o}/GridView/${t}`,n=await a("DELETE",s);console.log("data from utils:",n),e(n)},T=async(t,e,o,s,n)=>{const{baseURLTenantV2:r}=await i(),c=`${r}/GridView/getFromUser/${t}/${e}?domainName=${s}&apiCatalogId=${o}`;n(await a("GET",c))},R=async(t,e)=>{const{baseURLTenantV2:o}=await i(),s=`${o}/GridView/gridConfigurations/${t}/${e}`;return await a("GET",s)},E=async(t,e,o,n,r,c,l,d,u)=>{const{baseURLTenantV2:p}=await i(),m=`${p}/GridView/createGridView`,b={gridView:{Name:n,GridViewVisibilityTypeId:l,isDefault:d,tenantId:s(),userId:t,gridId:e,domain:r,apiCatalogId:o},gridConfigurations:c};u(await a("POST",m,b))},h=async(t,e,o,n,r,c,l,d,u,p)=>{const{baseURLTenantV2:m}=await i(),b=`${m}/GridView/updateGridView/${t}`,w={gridView:{Name:r,GridViewVisibilityTypeId:u,isDefault:l,tenantId:s(),userId:e,gridId:o,domain:d,apiCatalogId:n},gridConfigurations:c};try{p(await a("PUT",b,w))}catch(t){console.error("Error updating view:",t)}},V=async(t,e,o,n,r,c,l,d,u)=>{const{baseURLTenantV2:p}=await i(),m=`${p}/GridView/${t}`,b={Name:r,GridViewVisibilityTypeId:d,isDefault:c,tenantId:s(),userId:e,gridId:o,domain:l,apiCatalogId:n};try{const t=await a("PUT",m,b);return u(t),t}catch(t){console.error("Error updating view:",t)}},v=async(t,e,o,s)=>{const{baseURLV2:n}=await i(),r=`${n}/action/grid/${t}`,c=await a("GET",r);if(e){const t=(await a("GET",`${n}/actionPermission`)).filter((t=>o.some((a=>a.permissionId===t.permissionId))));s(c.filter((a=>t.some((t=>t.actionId===a.actionId)))))}else s(c)},G=async t=>{const{baseURL:e}=await i();return console.log("baseURL from External config:",e),a("GET",`${e}/apimethodinstance/${t}`,{data:{}})},O=async t=>{const{baseURL:e}=await i();return console.log("baseURL from External config:",e),a("GET",`${e}/apimethod/${t}`)},j=async t=>{const o=`lookupMethod-${t}`,s=sessionStorage.getItem(o);if(s)return JSON.parse(s);const{baseURL:n}=await i(),r=await a("GET",`${n}/apiCatalog/${t}?includeCatalogObjectList=false&includePromotedMethods=false`),c=`${n}/apicatalog/${t}/promotedMethodEntities/UdpLookup/product/${r.productId?r.productId:e.config.UNITY_PRODUCT_ID}?compareSanitizedName=true`,l=await a("GET",c);return l&&sessionStorage.setItem(o,JSON.stringify(l)),l},I=async()=>{const{baseURLHost:t}=await i();return a("GET",`${t}/UdpHotList`,null)},H=async t=>{const{baseURLHost:e}=await i();return a("POST",`${e}/UdpHotList`,t)},P=async t=>{const{baseURLHost:e}=await i();return a("DELETE",`${e}/UdpHotList/${t}`,null)},S=async t=>{const{baseURLHost:e}=await i();return a("POST",`${e}/UdpHotListRecord`,t,!0)},C=async t=>{const{baseURLHost:e}=await i();return a("GET",`${e}/UdpHotList/${t}/full`,null,!0)},k=async t=>{const{baseURLHost:e}=await i();return a("DELETE",`${e}/udphotlistrecord/${t}`,null,!0)};export{u as a,G as b,O as c,j as d,b as e,T as f,y as g,U as h,g as i,I as j,S as k,P as l,C as m,H as n,m as o,v as p,w as q,h as r,E as s,k as t,V as u,L as v,R as w}