@salesforce/lds-adapters-uiapi 1.296.0 → 1.297.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.
package/sfdc/index.js CHANGED
@@ -12421,6 +12421,7 @@ function getNameField(objectInfo, fieldApiName) {
12421
12421
  }
12422
12422
  function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
12423
12423
  const qualifiedFieldNames = [];
12424
+ const qualifiedOptionalFieldNames = [];
12424
12425
  for (let a = 0, alen = layout.sections.length; a < alen; a++) {
12425
12426
  const section = layout.sections[a];
12426
12427
  for (let b = 0, blen = section.layoutRows.length; b < blen; b++) {
@@ -12436,7 +12437,8 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
12436
12437
  // By default, include the "Id" field on spanning records that are on the layout.
12437
12438
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
12438
12439
  const nameField = getNameField(objectInfo, apiName);
12439
- qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12440
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
12441
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
12440
12442
  }
12441
12443
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
12442
12444
  }
@@ -12444,7 +12446,10 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
12444
12446
  }
12445
12447
  }
12446
12448
  }
12447
- return qualifiedFieldNames;
12449
+ return {
12450
+ fields: qualifiedFieldNames,
12451
+ optionalFields: qualifiedOptionalFieldNames,
12452
+ };
12448
12453
  }
12449
12454
 
12450
12455
  function getMissingRecordLookupFields(record, objectInfo) {
@@ -12865,11 +12870,13 @@ function refresh$1(luvio, config) {
12865
12870
  throw new Error(`RecordUi adapter resolved with a ${snapshot.state} snapshot with undefined data`);
12866
12871
  }
12867
12872
  const { layoutMap, objectInfo } = getLayoutMapAndObjectInfo(recordId, data);
12868
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
12873
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
12874
+ const { fields, optionalFields: layoutOptionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfo);
12875
+ const mergedOptionalFields = dedupe(optionalFields.concat(layoutOptionalFields));
12869
12876
  return buildCachedSnapshot$9(luvio, {
12870
12877
  recordId,
12871
12878
  fields,
12872
- optionalFields,
12879
+ optionalFields: mergedOptionalFields,
12873
12880
  }, refresh);
12874
12881
  });
12875
12882
  }
@@ -12930,6 +12937,7 @@ const recordLayoutFragmentSelector = [
12930
12937
  ];
12931
12938
  function getFieldsFromLayoutMap(layoutMap, objectInfo) {
12932
12939
  let fields = [];
12940
+ let optionalFields = [];
12933
12941
  const layoutTypes = keys(layoutMap);
12934
12942
  for (let i = 0, layoutTypesLen = layoutTypes.length; i < layoutTypesLen; i += 1) {
12935
12943
  const layoutType = layoutTypes[i];
@@ -12937,11 +12945,15 @@ function getFieldsFromLayoutMap(layoutMap, objectInfo) {
12937
12945
  const modes = keys(modesMap);
12938
12946
  for (let m = 0, modesLen = modes.length; m < modesLen; m += 1) {
12939
12947
  const mode = modes[m];
12940
- const modeKeys = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
12941
- fields = fields.concat(modeKeys);
12948
+ const { fields: modeFields, optionalFields: modeOptionalFields } = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
12949
+ fields = fields.concat(modeFields);
12950
+ optionalFields = optionalFields.concat(modeOptionalFields);
12942
12951
  }
12943
12952
  }
12944
- return dedupe(fields).sort();
12953
+ return {
12954
+ fields: dedupe(fields).sort(),
12955
+ optionalFields: dedupe(optionalFields).sort(),
12956
+ };
12945
12957
  }
12946
12958
  /**
12947
12959
  * W-14696113
@@ -12958,8 +12970,12 @@ function convertToImplicitFields(fields, optionalFields) {
12958
12970
  return implicitFields;
12959
12971
  }
12960
12972
  function getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, configOptionalFields) {
12961
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
12962
- const implicitFields = convertToImplicitFields(fields, configOptionalFields);
12973
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
12974
+ let { fields, optionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfo);
12975
+ if (configOptionalFields && configOptionalFields.length > 0) {
12976
+ optionalFields = dedupe(optionalFields.concat(configOptionalFields));
12977
+ }
12978
+ const implicitFields = convertToImplicitFields(fields, optionalFields);
12963
12979
  return getRecord$1(luvio, refresh, recordId, [], implicitFields);
12964
12980
  }
12965
12981
  function getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, configOptionalFields, configFields) {
@@ -13221,8 +13237,15 @@ function buildRecordLayoutSnapshot(recordLayout, luvio, config, recordLayoutSnap
13221
13237
  return;
13222
13238
  }
13223
13239
  // transform the layouts & object info into a set of fields
13224
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
13225
- return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
13240
+ // // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
13241
+ const { fields, optionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
13242
+ let configWithModifiedOptionalFields = {
13243
+ ...config,
13244
+ optionalFields: config.optionalFields
13245
+ ? dedupe(config.optionalFields.concat(optionalFields)).sort()
13246
+ : optionalFields,
13247
+ };
13248
+ return getRecordRepSnapshot(luvio, configWithModifiedOptionalFields, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
13226
13249
  };
13227
13250
  }
13228
13251
  function buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields) {
@@ -13251,6 +13274,8 @@ function getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSna
13251
13274
  // allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
13252
13275
  else if (isUnfulfilledSnapshot(recordRepSnapshot)) {
13253
13276
  context.fields = fields;
13277
+ // W-15692973: Update optionalFields of config as the optional fields may have Name fields of referenced entities
13278
+ context.config.optionalFields = optionalFields;
13254
13279
  }
13255
13280
  // return however much of the record we were able to find in L1; cache policy decides if we
13256
13281
  // should consult L2 or go to network
@@ -37123,4 +37148,4 @@ withDefaultLuvio((luvio) => {
37123
37148
  });
37124
37149
 
37125
37150
  export { API_NAMESPACE, InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$I as ObjectInfoDirectoryEntryRepresentationType, RepresentationType$N as ObjectInfoRepresentationType, RECORD_FIELDS_KEY_JUNCTION, RECORD_ID_PREFIX, RECORD_REPRESENTATION_NAME, RECORD_VIEW_ENTITY_ID_PREFIX, RECORD_VIEW_ENTITY_REPRESENTATION_NAME, RepresentationType$U as RecordRepresentationRepresentationType, TTL$y as RecordRepresentationTTL, RepresentationType$U as RecordRepresentationType, VERSION$1a as RecordRepresentationVersion, keyPrefix as UiApiNamespace, buildRecordRepKeyFromId, getFieldApiNamesArray as coerceFieldIdArray, getObjectApiName$1 as coerceObjectId, getObjectApiNamesArray as coerceObjectIdArray, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createLDSAdapterWithPrediction, createListInfo, createRecord, createRelatedListAdapterWithPrediction, deleteListInfo, deleteRecord, executeBatchRecordOperations, extractRecordIdFromStoreKey, getActionOverrides, getActionOverrides_imperative, getAllApps, getAllApps_imperative, getAppDetails, getAppDetails_imperative, getDuplicateConfiguration, getDuplicateConfiguration_imperative, getDuplicates, getDuplicates_imperative, getFlexipageFormulaOverrides, getFlexipageFormulaOverrides_imperative, getGlobalActions, getGlobalActions_imperative, getKeywordSearchResults, getKeywordSearchResults_imperative, getLayout, getLayoutUserState, getLayoutUserState_imperative, getLayout_imperative, getListInfoByName, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListInfosByObjectName, getListInfosByObjectName_imperative, getListObjectInfo, getListObjectInfo_imperative, getListPreferences, getListPreferences_imperative, getListRecordsByName, getListRecordsByName_imperative, getListUi, getListUi_imperative, getLookupActions, getLookupActions_imperative, getLookupMetadata, getLookupMetadata_imperative, getLookupRecords, getLookupRecords_imperative, getNavItems, getNavItems_imperative, getObjectCreateActions, getObjectCreateActions_imperative, getObjectInfo, getObjectInfoAdapterFactory, getObjectInfoDirectoryAdapterFactory, getObjectInfo_imperative, getObjectInfos, getObjectInfosAdapterFactory, getObjectInfos_imperative, getPathLayout, getPathLayout_imperative, getPicklistValues, getPicklistValuesByRecordType, getPicklistValuesByRecordType_imperative, getPicklistValues_imperative, getQuickActionDefaults, getQuickActionDefaults_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActionsAdapterFactory, getRecordActions_imperative, factory$f as getRecordAdapterFactory, getRecordAvatars, getRecordAvatarsAdapterFactory, getRecordAvatars_imperative, getRecordCreateDefaults, getRecordCreateDefaults_imperative, getRecordEditActions, getRecordEditActions_imperative, getRecordId18, getRecordNotifyChange, getRecordTemplateClone, getRecordTemplateClone_imperative, getRecordTemplateCreate, getRecordTemplateCreate_imperative, getRecordUi, getRecordUi_imperative, getRecord_imperative, getRecords, getRecordsAdapterFactory, getRecords_imperative, getRelatedListActions, getRelatedListActions_imperative, getRelatedListCount, getRelatedListCount_imperative, getRelatedListInfo, getRelatedListInfoBatch, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoBatch_imperative, getRelatedListInfo_imperative, getRelatedListPreferences, getRelatedListPreferencesBatch, getRelatedListPreferencesBatch_imperative, getRelatedListPreferences_imperative, getRelatedListRecordActions, getRelatedListRecordActions_imperative, getRelatedListRecords, getRelatedListRecordsAdapterFactory, getRelatedListRecordsBatch, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsBatch_imperative, getRelatedListRecords_imperative, getRelatedListsActions, getRelatedListsActionsAdapterFactory, getRelatedListsActions_imperative, getRelatedListsCount, getRelatedListsCount_imperative, getRelatedListsInfo, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$W as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$G as ingestObjectInfo, ingest$A as ingestQuickActionExecutionRepresentation, ingest$N as ingestRecord, instrument, isStoreKeyRecordViewEntity, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$C as keyBuilderFromTypeRecordRepresentation, keyBuilder$1V as keyBuilderObjectInfo, keyBuilder$1O as keyBuilderQuickActionExecutionRepresentation, keyBuilder$26 as keyBuilderRecord, notifyAllListInfoSummaryUpdateAvailable, notifyAllListRecordUpdateAvailable, notifyListInfoSummaryUpdateAvailable, notifyListInfoUpdateAvailable, notifyListRecordCollectionUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, registerPrefetcher, updateLayoutUserState, updateListInfoByName, updateListPreferences, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
37126
- // version: 1.296.0-b5e933418
37151
+ // version: 1.297.0-e0cfbd880