@salesforce/lwc-adapters-uiapi 1.433.0 → 1.435.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 (2) hide show
  1. package/dist/main.js +33 -56
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -7440,28 +7440,23 @@ let configurableCreateContentVersion = new Configurable();
7440
7440
  * Depth to which tracked fields will be added to a request that results from a cache miss.
7441
7441
  * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
7442
7442
  * be reached by following 1 relationship from the root record, etc.
7443
- * @defaultValue '5', replicates the current behavior
7443
+ * @defaultValue '1'
7444
7444
  */
7445
- let trackedFieldDepthOnCacheMiss = 5;
7445
+ let trackedFieldDepthOnCacheMiss = 1;
7446
7446
  /**
7447
7447
  * Depth to which tracked fields will be added to a request that results from a merge conflict
7448
7448
  * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
7449
7449
  * be reached by following 1 relationship from the root record, etc.
7450
- * @defaultValue '5', replicates the current behavior
7450
+ * @defaultValue '1'
7451
7451
  */
7452
- let trackedFieldDepthOnCacheMergeConflict = 5;
7452
+ let trackedFieldDepthOnCacheMergeConflict = 1;
7453
7453
  /**
7454
7454
  * Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
7455
7455
  * A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
7456
7456
  * be reached by following 1 relationship from the root record, etc.
7457
- * @defaultValue '5', replicates the current behavior
7457
+ * @defaultValue '1'
7458
7458
  */
7459
- let trackedFieldDepthOnNotifyChange = 5;
7460
- /**
7461
- * Determines if we will only fetch the 'Id' field for the leaf relationship record
7462
- * @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
7463
- */
7464
- let trackedFieldLeafNodeIdAndNameOnly = false;
7459
+ let trackedFieldDepthOnNotifyChange = 1;
7465
7460
  /**
7466
7461
  * One store enabled Get Object Info adapter
7467
7462
  */
@@ -7558,12 +7553,6 @@ const configurationForRestAdapters = {
7558
7553
  getTrackedFieldDepthOnNotifyChange: function () {
7559
7554
  return trackedFieldDepthOnNotifyChange;
7560
7555
  },
7561
- setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
7562
- trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
7563
- },
7564
- getTrackedFieldLeafNodeIdAndNameOnly: function () {
7565
- return trackedFieldLeafNodeIdAndNameOnly;
7566
- },
7567
7556
  setRecordRepresentationIngestionOverride: function (ingest) {
7568
7557
  recordRepresentationIngestionOverride = ingest;
7569
7558
  },
@@ -10717,6 +10706,9 @@ function buildSelectionFromRecord(record) {
10717
10706
  return [...sel.selections, DRAFTS_SELECTION];
10718
10707
  }
10719
10708
 
10709
+ // Unused suffixes, but leaving in as comments to avoid eslint errors
10710
+ // const CUSTOM_API_NAME_SUFFIX = '__c';
10711
+ // const DMO_API_NAME_SUFFIX = '__dlm';
10720
10712
  const CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX = '__x';
10721
10713
  const RECORD_REPRESENTATION_ERROR_VERSION = 'RECORD_REPRESENTATION_ERROR_VERSION_1';
10722
10714
  const RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS = {
@@ -10743,7 +10735,7 @@ function addScalarField(current, leafNodeFieldKey) {
10743
10735
  }
10744
10736
  }
10745
10737
  function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordIds = {}, depth = 0) {
10746
- var _a, _b;
10738
+ var _a;
10747
10739
  // Filter Error and null nodes
10748
10740
  if (!isGraphNode(node)) {
10749
10741
  return;
@@ -10781,13 +10773,11 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
10781
10773
  if (!isGraphNode(field)) {
10782
10774
  continue;
10783
10775
  }
10784
- const { maxDepth, onlyFetchLeafNodeIdAndName } = config;
10776
+ const { maxDepth } = config;
10785
10777
  if (field.isScalar('value') === false && !Array.isArray((_a = field.data) === null || _a === void 0 ? void 0 : _a.value)) {
10786
10778
  if (depth + 1 > maxDepth) {
10787
- if (onlyFetchLeafNodeIdAndName === true) {
10788
- addScalarFieldId(current);
10789
- addScalarFieldName(current);
10790
- }
10779
+ addScalarFieldId(current);
10780
+ addScalarFieldName(current);
10791
10781
  continue;
10792
10782
  }
10793
10783
  const spanningLink = field.link('value');
@@ -10809,19 +10799,10 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
10809
10799
  current.children[key] = next;
10810
10800
  }
10811
10801
  else {
10812
- // Skip the field, if its value is null at the max level depth.
10813
- // Ideally, it should only skip relationship field. However,
10814
- // on the client, there is not a reliable way to determine the
10815
- // the field type.
10816
10802
  if (depth === maxDepth) {
10817
- if (onlyFetchLeafNodeIdAndName === true) {
10818
- addScalarFieldId(current);
10819
- addScalarFieldName(current);
10820
- continue;
10821
- }
10822
- if (field.scalar('value') === null && !Array.isArray((_b = field.data) === null || _b === void 0 ? void 0 : _b.value)) {
10823
- continue;
10824
- }
10803
+ addScalarFieldId(current);
10804
+ addScalarFieldName(current);
10805
+ continue;
10825
10806
  }
10826
10807
  const state = fieldValueRep.linkData();
10827
10808
  if (state !== undefined) {
@@ -11399,7 +11380,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
11399
11380
  };
11400
11381
  const trackedFieldsConfig = {
11401
11382
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
11402
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
11403
11383
  };
11404
11384
  extractTrackedFieldsToTrie(recordKey, incomingNode, incomingTrackedFieldsTrieRoot, trackedFieldsConfig);
11405
11385
  extractTrackedFieldsToTrie(recordKey, existingNode, existingTrackedFieldsTrieRoot, trackedFieldsConfig);
@@ -11868,7 +11848,6 @@ function prepareRequest$7(luvio, config) {
11868
11848
  const key = keyBuilder$3T(luvio, createResourceParams$15(config));
11869
11849
  const allTrackedFields = getTrackedFields(key, luvio.getNode(key), {
11870
11850
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
11871
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
11872
11851
  }, config.optionalFields);
11873
11852
  const optionalFields = fields === undefined ? allTrackedFields : difference(allTrackedFields, fields);
11874
11853
  const resourceParams = createResourceParams$15({
@@ -11995,7 +11974,6 @@ function ingestSuccessChildResourceParams$9(luvio, childResourceParamsArray, chi
11995
11974
  };
11996
11975
  const childTrackedFields = getTrackedFields(childKey, luvio.getNode(childKey), {
11997
11976
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
11998
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
11999
11977
  }, childResourceParams.queryParams.optionalFields);
12000
11978
  const childSnapshot = ingestSuccess$X(luvio, {
12001
11979
  recordId: childResourceParams.urlParams.recordId,
@@ -18528,17 +18506,15 @@ function getRelationshipName(objectInfo, fieldApiName) {
18528
18506
  return objectInfo.fields[fieldApiName].relationshipName;
18529
18507
  }
18530
18508
  function getNameField(objectInfo, fieldApiName) {
18531
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
18532
- // TODO - this logic is adopted from lds222. It searches
18533
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
18534
- // 1. If any of the arrays are empty returns `Name`
18535
- // 2. If `Name` is found in any array position then returns it
18536
- // 3. If the field has more than 1 references(polymorphic), return `Name`
18537
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
18538
- // Rationale for this is unclear and needs clarification.
18539
18509
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
18540
18510
  if (referenceToInfos.length !== 1) {
18541
- return FIELD_NAME;
18511
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
18512
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
18513
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
18514
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
18515
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
18516
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME));
18517
+ return anyHaveName ? FIELD_NAME : undefined;
18542
18518
  }
18543
18519
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
18544
18520
  if (firstReferenceNameFields.length < 1) {
@@ -18573,8 +18549,11 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
18573
18549
  // By default, include the "Id" field on spanning records that are on the layout.
18574
18550
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
18575
18551
  const nameField = getNameField(objectInfo, apiName);
18576
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
18577
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
18552
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
18553
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
18554
+ if (nameField !== undefined) {
18555
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
18556
+ }
18578
18557
  }
18579
18558
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
18580
18559
  }
@@ -18608,8 +18587,11 @@ function getMissingRecordLookupFields(record, objectInfo) {
18608
18587
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
18609
18588
  const idFieldName = `${apiName}.${relationshipName}.Id`;
18610
18589
  lookupFields[idFieldName] = true;
18611
- const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
18612
- lookupFields[nameField] = true;
18590
+ const resolvedNameField = getNameField(objectInfo, fieldName);
18591
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
18592
+ if (resolvedNameField !== undefined) {
18593
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
18594
+ }
18613
18595
  }
18614
18596
  return keys(lookupFields);
18615
18597
  }
@@ -19477,7 +19459,6 @@ const notifyChangeFactory = (luvio) => {
19477
19459
  const node = luvio.wrapNormalizedGraphNode(record, key);
19478
19460
  const optionalFields = getTrackedFields(key, node, {
19479
19461
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnNotifyChange(),
19480
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
19481
19462
  });
19482
19463
  const refreshRequest = createResourceRequestFromRepresentation(record, optionalFields);
19483
19464
  const existingWeakEtag = record.weakEtag;
@@ -23199,7 +23180,6 @@ function buildNetworkSnapshot$Y(luvio, config, options) {
23199
23180
  const key = keyBuilder$3b(luvio, config);
23200
23181
  const trackedFieldsConfig = {
23201
23182
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
23202
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly()
23203
23183
  };
23204
23184
  const optionalFieldsTrie = convertFieldsToTrie(getTrackedFields(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
23205
23185
  const fieldsTrie = BLANK_RECORD_FIELDS_TRIE;
@@ -69350,7 +69330,6 @@ const buildNetworkSnapshot$6 = (luvio, context, config, options) => {
69350
69330
  ...resourceRequest.queryParams,
69351
69331
  optionalFields: getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
69352
69332
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
69353
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
69354
69333
  }, config.optionalFields),
69355
69334
  },
69356
69335
  });
@@ -69985,7 +69964,6 @@ function prepareRequest(luvio, context, config) {
69985
69964
  ...resourceRequest.queryParams,
69986
69965
  optionalFields: getTrackedFields(recordTemplateKey, luvio.getNode(recordTemplateKey), {
69987
69966
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
69988
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
69989
69967
  }, config.optionalFields),
69990
69968
  },
69991
69969
  });
@@ -70005,7 +69983,6 @@ function onFetchResponseSuccess(luvio, context, config, request, response, resou
70005
69983
  });
70006
69984
  const allTrackedFields = getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
70007
69985
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMiss(),
70008
- onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
70009
69986
  }, optionalFields);
70010
69987
  const allTrackedFieldsTrie = convertFieldsToTrie(allTrackedFields, true);
70011
69988
  const ingest = createFieldsIngestSuccess({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lwc-adapters-uiapi",
3
- "version": "1.433.0",
3
+ "version": "1.435.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "UIAPI adapters with LWC bindings",
6
6
  "module": "dist/main.js",
@@ -31,10 +31,10 @@
31
31
  "clean": "rm -rf dist src/generated"
32
32
  },
33
33
  "devDependencies": {
34
- "@salesforce/lds-adapters-uiapi": "^1.433.0"
34
+ "@salesforce/lds-adapters-uiapi": "^1.435.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "@luvio/lwc-luvio": "0.160.4",
38
- "@salesforce/lds-default-luvio": "^1.433.0"
38
+ "@salesforce/lds-default-luvio": "^1.435.0"
39
39
  }
40
40
  }