@salesforce/lds-adapters-uiapi 1.434.0 → 1.435.1

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.
@@ -4,5 +4,5 @@ export interface FieldsAndOptionalFields {
4
4
  fields: string[];
5
5
  optionalFields: string[];
6
6
  }
7
- export declare function getNameField(objectInfo: ObjectInfoRepresentation, fieldApiName: string): string;
7
+ export declare function getNameField(objectInfo: ObjectInfoRepresentation, fieldApiName: string): string | undefined;
8
8
  export declare function getQualifiedFieldApiNamesFromLayout(layout: RecordLayoutRepresentation, objectInfo: ObjectInfoRepresentation): FieldsAndOptionalFields;
@@ -11406,17 +11406,15 @@ function getRelationshipName(objectInfo, fieldApiName) {
11406
11406
  return objectInfo.fields[fieldApiName].relationshipName;
11407
11407
  }
11408
11408
  function getNameField(objectInfo, fieldApiName) {
11409
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
11410
- // TODO - this logic is adopted from lds222. It searches
11411
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
11412
- // 1. If any of the arrays are empty returns `Name`
11413
- // 2. If `Name` is found in any array position then returns it
11414
- // 3. If the field has more than 1 references(polymorphic), return `Name`
11415
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
11416
- // Rationale for this is unclear and needs clarification.
11417
11409
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
11418
11410
  if (referenceToInfos.length !== 1) {
11419
- return FIELD_NAME;
11411
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
11412
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
11413
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
11414
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
11415
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
11416
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME));
11417
+ return anyHaveName ? FIELD_NAME : undefined;
11420
11418
  }
11421
11419
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
11422
11420
  if (firstReferenceNameFields.length < 1) {
@@ -11451,8 +11449,11 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
11451
11449
  // By default, include the "Id" field on spanning records that are on the layout.
11452
11450
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
11453
11451
  const nameField = getNameField(objectInfo, apiName);
11454
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
11455
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
11452
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
11453
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
11454
+ if (nameField !== undefined) {
11455
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
11456
+ }
11456
11457
  }
11457
11458
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
11458
11459
  }
@@ -11486,8 +11487,11 @@ function getMissingRecordLookupFields(record, objectInfo) {
11486
11487
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
11487
11488
  const idFieldName = `${apiName}.${relationshipName}.Id`;
11488
11489
  lookupFields[idFieldName] = true;
11489
- const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
11490
- lookupFields[nameField] = true;
11490
+ const resolvedNameField = getNameField(objectInfo, fieldName);
11491
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
11492
+ if (resolvedNameField !== undefined) {
11493
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
11494
+ }
11491
11495
  }
11492
11496
  return keys(lookupFields);
11493
11497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.434.0",
3
+ "version": "1.435.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters for record related UI API endpoints",
6
6
  "type": "module",
@@ -68,14 +68,14 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@luvio/graphql-parser": "0.160.4",
71
- "@salesforce/lds-adapters-onestore-graphql": "^1.434.0",
72
- "@salesforce/lds-bindings": "^1.434.0",
73
- "@salesforce/lds-default-luvio": "^1.434.0"
71
+ "@salesforce/lds-adapters-onestore-graphql": "^1.435.1",
72
+ "@salesforce/lds-bindings": "^1.435.1",
73
+ "@salesforce/lds-default-luvio": "^1.435.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@salesforce/lds-compiler-plugins": "^1.434.0",
77
- "@salesforce/lds-jest": "^1.434.0",
78
- "@salesforce/lds-store-binary": "^1.434.0"
76
+ "@salesforce/lds-compiler-plugins": "^1.435.1",
77
+ "@salesforce/lds-jest": "^1.435.1",
78
+ "@salesforce/lds-store-binary": "^1.435.1"
79
79
  },
80
80
  "luvioBundlesize": [
81
81
  {
@@ -28809,4 +28809,4 @@ register({
28809
28809
  });
28810
28810
 
28811
28811
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_deprecated, graphql_imperative, graphql_imperative_deprecated, graphql_imperative_onestore, graphql_onestore, graphql_state_manager, refreshGraphQL, refreshGraphQL_deprecated };
28812
- // version: 1.434.0-6aa2dd15e3
28812
+ // version: 1.435.1-a9f05717b8
package/sfdc/index.js CHANGED
@@ -11041,17 +11041,15 @@ function getRelationshipName(objectInfo, fieldApiName) {
11041
11041
  return objectInfo.fields[fieldApiName].relationshipName;
11042
11042
  }
11043
11043
  function getNameField(objectInfo, fieldApiName) {
11044
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
11045
- // TODO - this logic is adopted from lds222. It searches
11046
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
11047
- // 1. If any of the arrays are empty returns `Name`
11048
- // 2. If `Name` is found in any array position then returns it
11049
- // 3. If the field has more than 1 references(polymorphic), return `Name`
11050
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
11051
- // Rationale for this is unclear and needs clarification.
11052
11044
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
11053
11045
  if (referenceToInfos.length !== 1) {
11054
- return FIELD_NAME;
11046
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
11047
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
11048
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
11049
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
11050
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
11051
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME));
11052
+ return anyHaveName ? FIELD_NAME : undefined;
11055
11053
  }
11056
11054
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
11057
11055
  if (firstReferenceNameFields.length < 1) {
@@ -11086,8 +11084,11 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
11086
11084
  // By default, include the "Id" field on spanning records that are on the layout.
11087
11085
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
11088
11086
  const nameField = getNameField(objectInfo, apiName);
11089
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
11090
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
11087
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
11088
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
11089
+ if (nameField !== undefined) {
11090
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
11091
+ }
11091
11092
  }
11092
11093
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
11093
11094
  }
@@ -11121,8 +11122,11 @@ function getMissingRecordLookupFields(record, objectInfo) {
11121
11122
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
11122
11123
  const idFieldName = `${apiName}.${relationshipName}.Id`;
11123
11124
  lookupFields[idFieldName] = true;
11124
- const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
11125
- lookupFields[nameField] = true;
11125
+ const resolvedNameField = getNameField(objectInfo, fieldName);
11126
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
11127
+ if (resolvedNameField !== undefined) {
11128
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
11129
+ }
11126
11130
  }
11127
11131
  return keys(lookupFields);
11128
11132
  }
@@ -37470,4 +37474,4 @@ withDefaultLuvio((luvio) => {
37470
37474
  });
37471
37475
 
37472
37476
  export { API_NAMESPACE, VERSION$1i as FieldValueRepresentationVersion, InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$J as ObjectInfoDirectoryEntryRepresentationType, RepresentationType$O as ObjectInfoRepresentationType, RECORD_FIELDS_KEY_JUNCTION, RECORD_ID_PREFIX, RECORD_REPRESENTATION_NAME, RECORD_VIEW_ENTITY_ID_PREFIX, RECORD_VIEW_ENTITY_REPRESENTATION_NAME, RepresentationType$V as RecordRepresentationRepresentationType, TTL$z as RecordRepresentationTTL, RepresentationType$V as RecordRepresentationType, VERSION$1g as RecordRepresentationVersion, keyPrefix as UiApiNamespace, buildRecordRepKeyFromId, getFieldApiNamesArray as coerceFieldIdArray, coerceLayoutModeArray, getLayoutTypeArray as coerceLayoutTypeArray, getObjectApiName$1 as coerceObjectId, getObjectApiNamesArray as coerceObjectIdArray, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createLDSAdapterWithPrediction, createListInfo, createRecord, 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, getListInfoByNameAdapterFactory, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListInfosByObjectName, getListInfosByObjectNameAdapterFactory, getListInfosByObjectName_imperative, getListObjectInfo, getListObjectInfoAdapterFactory, getListObjectInfo_imperative, getListPreferences, getListPreferences_imperative, getListRecordsByName, factory$a as getListRecordsByNameAdapterFactory, 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, getQuickActionInfo, getQuickActionInfo_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActionsAdapterFactory, getRecordActions_imperative, factory$f as getRecordAdapterFactory, getRecordAvatars, getRecordAvatarsAdapterFactory, getRecordAvatars_imperative, getRecordCreateDefaults, getRecordCreateDefaults_imperative, getRecordEditActions, getRecordEditActions_imperative, getRecordId18, getRecordId18Array, getRecordIngestionOverride, getRecordNotifyChange, getRecordTemplateClone, getRecordTemplateClone_imperative, getRecordTemplateCreate, getRecordTemplateCreate_imperative, getRecordUi, getRecordUi_imperative, getRecord_imperative, getRecords, getRecordsAdapterFactory, getRecords_imperative, getRelatedListActions, getRelatedListActionsAdapterFactory, getRelatedListActions_imperative, getRelatedListCount, getRelatedListCount_imperative, getRelatedListInfo, getRelatedListInfoAdapterFactory, 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, getRelatedListsInfoAdapterFactory, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$X as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$H as ingestObjectInfo, ingest$B as ingestQuickActionExecutionRepresentation, ingest$O as ingestRecord, instrument, isStoreKeyRecordViewEntity, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$E as keyBuilderFromTypeRecordRepresentation, keyBuilder$1Y as keyBuilderObjectInfo, keyBuilder$1R as keyBuilderQuickActionExecutionRepresentation, keyBuilder$29 as keyBuilderRecord, notifyAllListInfoSummaryUpdateAvailable, notifyAllListRecordUpdateAvailable, notifyListInfoSummaryUpdateAvailable, notifyListInfoUpdateAvailable, notifyListRecordCollectionUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, registerPrefetcher, updateLayoutUserState, updateListInfoByName, updateListPreferences, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
37473
- // version: 1.434.0-6aa2dd15e3
37477
+ // version: 1.435.1-a9f05717b8