@salesforce/lds-adapters-uiapi 1.229.0-dev8 → 1.229.0-dev9

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.
@@ -1,4 +1,4 @@
1
- import type { ProxyGraphNode, GraphNode, Luvio, NormalizedKeyMetadata } from '@luvio/engine';
1
+ import type { ProxyGraphNode, GraphNode, NormalizedKeyMetadata, Luvio } from '@luvio/engine';
2
2
  import type { FieldValueRepresentation } from '../generated/types/FieldValueRepresentation';
3
3
  import type { RecordCreateDefaultRecordRepresentation } from '../generated/types/RecordCreateDefaultRecordRepresentation';
4
4
  import type { ObjectInfoRepresentation } from '../generated/types/ObjectInfoRepresentation';
@@ -4606,22 +4606,12 @@ function _markMissingPath(record, path) {
4606
4606
  const fieldValueRepresentation = record.object('fields');
4607
4607
  const fieldName = path.shift();
4608
4608
  if (fieldValueRepresentation.isUndefined(fieldName) === true) {
4609
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4610
- // an undefined/non-present __ref if isMissing is present
4611
- fieldValueRepresentation.write(fieldName, {
4612
- __ref: undefined,
4613
- isMissing: true,
4614
- });
4609
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
4615
4610
  return;
4616
4611
  }
4617
4612
  const link = fieldValueRepresentation.link(fieldName);
4618
4613
  if (link.isPending()) {
4619
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4620
- // an undefined/non-present __ref if isMissing is present
4621
- fieldValueRepresentation.write(fieldName, {
4622
- __ref: undefined,
4623
- isMissing: true,
4624
- });
4614
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
4625
4615
  }
4626
4616
  else if (path.length > 0 && link.isMissing() === false) {
4627
4617
  const fieldValue = link.follow();
@@ -4637,6 +4627,19 @@ function _markMissingPath(record, path) {
4637
4627
  }
4638
4628
  }
4639
4629
  }
4630
+ /**
4631
+ * Graph Node Directly modifies store entries, which is generally a non-starter.
4632
+ * Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
4633
+ * as a seenId in the store when you perform this mutation.
4634
+ */
4635
+ function writeMissingFieldToStore(field, fieldName) {
4636
+ // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4637
+ // an undefined/non-present __ref if isMissing is present
4638
+ field.write(fieldName, {
4639
+ __ref: undefined,
4640
+ isMissing: true,
4641
+ });
4642
+ }
4640
4643
  /**
4641
4644
  * Tells you if an objectApiName is supported by UI API or not.
4642
4645
  * Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
@@ -4768,8 +4771,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
4768
4771
  return existing;
4769
4772
  }
4770
4773
  function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
4771
- const incomingNode = luvio.wrapNormalizedGraphNode(incoming);
4772
- const existingNode = luvio.wrapNormalizedGraphNode(existing);
4774
+ const recordKey = keyBuilder$35(luvio, {
4775
+ recordId: incoming.id,
4776
+ });
4777
+ const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
4778
+ const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
4773
4779
  const incomingTrackedFieldsTrieRoot = {
4774
4780
  name: incoming.apiName,
4775
4781
  children: {},
@@ -4778,9 +4784,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
4778
4784
  name: existing.apiName,
4779
4785
  children: {},
4780
4786
  };
4781
- const recordKey = keyBuilder$35(luvio, {
4782
- recordId: incoming.id,
4783
- });
4784
4787
  const trackedFieldsConfig = {
4785
4788
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
4786
4789
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
@@ -12216,7 +12219,7 @@ const notifyChangeFactory = (luvio) => {
12216
12219
  const responsePromises = [];
12217
12220
  for (let i = 0, len = entries.length; i < len; i++) {
12218
12221
  const { key, record } = entries[i];
12219
- const node = luvio.wrapNormalizedGraphNode(record);
12222
+ const node = luvio.wrapNormalizedGraphNode(record, key);
12220
12223
  const optionalFields = getTrackedFields(key, node, {
12221
12224
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnNotifyChange(),
12222
12225
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-uiapi",
3
- "version": "1.229.0-dev8",
3
+ "version": "1.229.0-dev9",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters for record related UI API endpoints",
6
6
  "main": "dist/es/es2018/uiapi-records-service.js",
@@ -68,15 +68,15 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "@salesforce/lds-bindings": "1.229.0-dev8",
72
- "@salesforce/lds-default-luvio": "1.229.0-dev8"
71
+ "@salesforce/lds-bindings": "1.229.0-dev9",
72
+ "@salesforce/lds-default-luvio": "1.229.0-dev9"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@databases/sqlite": "^3.0.0",
76
- "@salesforce/lds-compiler-plugins": "1.229.0-dev8",
77
- "@salesforce/lds-jest": "1.229.0-dev8",
78
- "@salesforce/lds-store-binary": "1.229.0-dev8",
79
- "@salesforce/lds-uiapi-record-utils": "1.229.0-dev8"
76
+ "@salesforce/lds-compiler-plugins": "1.229.0-dev9",
77
+ "@salesforce/lds-jest": "1.229.0-dev9",
78
+ "@salesforce/lds-store-binary": "1.229.0-dev9",
79
+ "@salesforce/lds-uiapi-record-utils": "1.229.0-dev9"
80
80
  },
81
81
  "luvioBundlesize": [
82
82
  {
@@ -18107,4 +18107,4 @@ register({
18107
18107
  });
18108
18108
 
18109
18109
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
18110
- // version: 1.229.0-dev8-26b9af754
18110
+ // version: 1.229.0-dev9-939b09095
package/sfdc/index.js CHANGED
@@ -4472,22 +4472,12 @@ function _markMissingPath(record, path) {
4472
4472
  const fieldValueRepresentation = record.object('fields');
4473
4473
  const fieldName = path.shift();
4474
4474
  if (fieldValueRepresentation.isUndefined(fieldName) === true) {
4475
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4476
- // an undefined/non-present __ref if isMissing is present
4477
- fieldValueRepresentation.write(fieldName, {
4478
- __ref: undefined,
4479
- isMissing: true,
4480
- });
4475
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
4481
4476
  return;
4482
4477
  }
4483
4478
  const link = fieldValueRepresentation.link(fieldName);
4484
4479
  if (link.isPending()) {
4485
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4486
- // an undefined/non-present __ref if isMissing is present
4487
- fieldValueRepresentation.write(fieldName, {
4488
- __ref: undefined,
4489
- isMissing: true,
4490
- });
4480
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
4491
4481
  }
4492
4482
  else if (path.length > 0 && link.isMissing() === false) {
4493
4483
  const fieldValue = link.follow();
@@ -4503,6 +4493,19 @@ function _markMissingPath(record, path) {
4503
4493
  }
4504
4494
  }
4505
4495
  }
4496
+ /**
4497
+ * Graph Node Directly modifies store entries, which is generally a non-starter.
4498
+ * Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
4499
+ * as a seenId in the store when you perform this mutation.
4500
+ */
4501
+ function writeMissingFieldToStore(field, fieldName) {
4502
+ // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
4503
+ // an undefined/non-present __ref if isMissing is present
4504
+ field.write(fieldName, {
4505
+ __ref: undefined,
4506
+ isMissing: true,
4507
+ });
4508
+ }
4506
4509
  /**
4507
4510
  * Tells you if an objectApiName is supported by UI API or not.
4508
4511
  * Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
@@ -4634,8 +4637,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
4634
4637
  return existing;
4635
4638
  }
4636
4639
  function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
4637
- const incomingNode = luvio.wrapNormalizedGraphNode(incoming);
4638
- const existingNode = luvio.wrapNormalizedGraphNode(existing);
4640
+ const recordKey = keyBuilder$1U(luvio, {
4641
+ recordId: incoming.id,
4642
+ });
4643
+ const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
4644
+ const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
4639
4645
  const incomingTrackedFieldsTrieRoot = {
4640
4646
  name: incoming.apiName,
4641
4647
  children: {},
@@ -4644,9 +4650,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
4644
4650
  name: existing.apiName,
4645
4651
  children: {},
4646
4652
  };
4647
- const recordKey = keyBuilder$1U(luvio, {
4648
- recordId: incoming.id,
4649
- });
4650
4653
  const trackedFieldsConfig = {
4651
4654
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
4652
4655
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
@@ -11748,7 +11751,7 @@ const notifyChangeFactory = (luvio) => {
11748
11751
  const responsePromises = [];
11749
11752
  for (let i = 0, len = entries.length; i < len; i++) {
11750
11753
  const { key, record } = entries[i];
11751
- const node = luvio.wrapNormalizedGraphNode(record);
11754
+ const node = luvio.wrapNormalizedGraphNode(record, key);
11752
11755
  const optionalFields = getTrackedFields(key, node, {
11753
11756
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnNotifyChange(),
11754
11757
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
@@ -32867,4 +32870,4 @@ withDefaultLuvio((luvio) => {
32867
32870
  });
32868
32871
 
32869
32872
  export { InMemoryRecordRepresentationQueryEvaluator, MRU, RepresentationType$J as ObjectInfoRepresentationType, RepresentationType$O as RecordRepresentationRepresentationType, TTL$w as RecordRepresentationTTL, RepresentationType$O as RecordRepresentationType, VERSION$17 as RecordRepresentationVersion, keyPrefix as UiApiNamespace, configurationForRestAdapters as configuration, createContentDocumentAndVersion, createContentVersion, createIngestRecordWithFields, createRecord, deleteRecord, getActionOverrides, getActionOverrides_imperative, getAllApps, getAllApps_imperative, getAppDetails, getAppDetails_imperative, getDuplicateConfiguration, getDuplicateConfiguration_imperative, getDuplicates, getDuplicates_imperative, getGlobalActions, getGlobalActions_imperative, getKeywordSearchResults, getKeywordSearchResults_imperative, getLayout, getLayoutUserState, getLayoutUserState_imperative, getLayout_imperative, getListInfoByName, getListInfoByName_imperative, getListInfosByName, getListInfosByName_imperative, getListObjectInfo, getListObjectInfo_imperative, getListRecordsByName, getListRecordsByName_imperative, getListUi, getListUi_imperative, getLookupActions, getLookupActions_imperative, getLookupMetadata, getLookupMetadata_imperative, getLookupRecords, getLookupRecords_imperative, getNavItems, getNavItems_imperative, getObjectCreateActions, getObjectCreateActions_imperative, getObjectInfo, getObjectInfoAdapterFactory, getObjectInfo_imperative, getObjectInfos, getObjectInfosAdapterFactory, getObjectInfos_imperative, getPicklistValues, getPicklistValuesByRecordType, getPicklistValuesByRecordType_imperative, getPicklistValues_imperative, getQuickActionDefaults, getQuickActionDefaults_imperative, getQuickActionLayout, getQuickActionLayout_imperative, getRecord, getRecordActions, getRecordActions_imperative, factory$e as getRecordAdapterFactory, getRecordAvatars, 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, getRelatedListInfoBatch_imperative, getRelatedListInfo_imperative, getRelatedListPreferences, getRelatedListPreferencesBatch, getRelatedListPreferencesBatch_imperative, getRelatedListPreferences_imperative, getRelatedListRecordActions, getRelatedListRecordActions_imperative, getRelatedListRecords, getRelatedListRecordsBatch, getRelatedListRecordsBatch_imperative, getRelatedListRecords_imperative, getRelatedListsActions, getRelatedListsActions_imperative, getRelatedListsCount, getRelatedListsCount_imperative, getRelatedListsInfo, getRelatedListsInfo_imperative, getResponseCacheKeys as getResponseCacheKeysContentDocumentCompositeRepresentation, getSearchFilterMetadata, getSearchFilterMetadata_imperative, getSearchFilterOptions, getSearchFilterOptions_imperative, getSearchResults, getSearchResults_imperative, getTypeCacheKeys$Q as getTypeCacheKeysRecord, ingest as ingestContentDocumentCompositeRepresentation, ingest$C as ingestObjectInfo, ingest$y as ingestQuickActionExecutionRepresentation, ingest$H as ingestRecord, instrument, keyBuilder as keyBuilderContentDocumentCompositeRepresentation, keyBuilderFromType as keyBuilderFromTypeContentDocumentCompositeRepresentation, keyBuilderFromType$y as keyBuilderFromTypeRecordRepresentation, keyBuilder$1J as keyBuilderObjectInfo, keyBuilder$1D as keyBuilderQuickActionExecutionRepresentation, keyBuilder$1U as keyBuilderRecord, notifyListInfoUpdateAvailable, notifyListViewSummaryUpdateAvailable, notifyQuickActionDefaultsUpdateAvailable, notifyRecordUpdateAvailable, performQuickAction, performUpdateRecordQuickAction, refresh, updateLayoutUserState, updateListInfoByName, updateRecord, updateRecordAvatar, updateRelatedListInfo, updateRelatedListPreferences };
32870
- // version: 1.229.0-dev8-26b9af754
32873
+ // version: 1.229.0-dev9-939b09095
@@ -95,7 +95,7 @@ var TypeCheckShapes;
95
95
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
96
96
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
97
97
  })(TypeCheckShapes || (TypeCheckShapes = {}));
98
- // engine version: 0.146.0-dev4-c265089a
98
+ // engine version: 0.146.0-dev5-a2ec6e3f
99
99
 
100
100
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
101
101