@salesforce/lds-worker-api 1.354.0-dev6 → 1.354.0-dev7

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.
@@ -1128,4 +1128,4 @@ if (process.env.NODE_ENV !== 'production') {
1128
1128
  }
1129
1129
 
1130
1130
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1131
- // version: 1.354.0-dev6-a32f37c654
1131
+ // version: 1.354.0-dev7-d25082f814
@@ -1106,6 +1106,11 @@ class StringKeyInMemoryStore {
1106
1106
  if (isPendingSnapshot$1(snapshot)) {
1107
1107
  this.updateSubscriptionSnapshot(subscription, rebuiltSnapshot);
1108
1108
  }
1109
+ else if (!isErrorSnapshot$3(snapshot)) {
1110
+ // Context: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002D2hdeYAB/view
1111
+ // Merge the rebuiltSnapshot's seenRecords with the snapshot.seenRecords to ensure the subscription gets an emit the future
1112
+ snapshot.seenRecords.merge(rebuiltSnapshot.seenRecords);
1113
+ }
1109
1114
  return Promise.resolve();
1110
1115
  }
1111
1116
  this.updateSubscriptionSnapshot(subscription, rebuiltSnapshot);
@@ -4138,7 +4143,7 @@ function createResourceParamsImpl(config, configMetadata) {
4138
4143
  }
4139
4144
  return resourceParams;
4140
4145
  }
4141
- // engine version: 0.157.1-dev1-740cceb5
4146
+ // engine version: 0.157.1-dev2-7e528df5
4142
4147
 
4143
4148
  /**
4144
4149
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4266,7 +4271,7 @@ function withDefaultLuvio(callback) {
4266
4271
  }
4267
4272
  callbacks.push(callback);
4268
4273
  }
4269
- // version: 1.354.0-dev6-a32f37c654
4274
+ // version: 1.354.0-dev7-d25082f814
4270
4275
 
4271
4276
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4272
4277
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5214,7 +5219,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5214
5219
  const { apiFamily, name } = metadata;
5215
5220
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5216
5221
  }
5217
- // version: 1.354.0-dev6-a32f37c654
5222
+ // version: 1.354.0-dev7-d25082f814
5218
5223
 
5219
5224
  /**
5220
5225
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -5313,7 +5318,7 @@ var TypeCheckShapes;
5313
5318
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
5314
5319
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
5315
5320
  })(TypeCheckShapes || (TypeCheckShapes = {}));
5316
- // engine version: 0.157.1-dev1-740cceb5
5321
+ // engine version: 0.157.1-dev2-7e528df5
5317
5322
 
5318
5323
  const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
5319
5324
 
@@ -33990,7 +33995,7 @@ withDefaultLuvio((luvio) => {
33990
33995
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33991
33996
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33992
33997
  });
33993
- // version: 1.354.0-dev6-efb2ef03dd
33998
+ // version: 1.354.0-dev7-4e860a7769
33994
33999
 
33995
34000
  /**
33996
34001
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -81869,7 +81874,75 @@ function filterToPredicates(where, recordType, alias, objectInfoMap, joins, draf
81869
81874
  // in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
81870
81875
  if (fieldInfo.referenceToInfos.length === 1) {
81871
81876
  const childRecordType = fieldInfo.referenceToInfos[0].apiName;
81872
- predicates.push(...filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins));
81877
+ let p = filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins);
81878
+ if (isSinglePredicate(p[0]) && p[0].value === null) {
81879
+ // @W-18311580 - this is a reference field with a null value. We need to ensure that we handle the case
81880
+ // where we are joining to a record that may not exist in our offline database, so we need to detect if
81881
+ // the value is really a null, or if it is a missing record in the offline database.
81882
+ //
81883
+ // This effecitvely adds the following predicates to a "where Contact.Account.Name IS NULL" query:
81884
+ //
81885
+ // AND (
81886
+ // (
81887
+ // json_extract("Contact__c_Account__r".data, '$.fields.Id.value') IS NOT NULL (a)
81888
+ // AND json_extract("Contact__c".data, '$.fields.AccountId.value') IS NOT NULL (b)
81889
+ // )
81890
+ // OR json_extract("Contact__c".data, '$.fields.AccountId.value') IS NULL (c)
81891
+ // )
81892
+ //
81893
+ // Where:
81894
+ // (a) AND (b) ensures we have an account record when it is supposed to exist,
81895
+ // OR (c) if AccountId is null, we know we are not referencing an account record.
81896
+ let notNullPredicate = {
81897
+ type: PredicateType.compound,
81898
+ operator: 'and',
81899
+ children: [
81900
+ {
81901
+ alias: alias,
81902
+ leftPath: leftPath,
81903
+ operator: 'IS NOT',
81904
+ value: null,
81905
+ dataType: 'String',
81906
+ type: PredicateType.single,
81907
+ isCaseSensitive: true,
81908
+ },
81909
+ {
81910
+ alias: childAlias,
81911
+ leftPath: `$.fields.Id.value`,
81912
+ operator: 'IS NOT',
81913
+ value: null,
81914
+ dataType: 'String',
81915
+ type: PredicateType.single,
81916
+ isCaseSensitive: true,
81917
+ },
81918
+ ],
81919
+ };
81920
+ let nullPredicate = {
81921
+ type: PredicateType.compound,
81922
+ operator: 'or',
81923
+ children: [
81924
+ notNullPredicate,
81925
+ {
81926
+ alias: alias,
81927
+ leftPath: leftPath,
81928
+ operator: 'IS',
81929
+ value: null,
81930
+ dataType: 'String',
81931
+ type: PredicateType.single,
81932
+ isCaseSensitive: true,
81933
+ },
81934
+ ],
81935
+ };
81936
+ let compoundPredicate = {
81937
+ type: PredicateType.compound,
81938
+ operator: 'and',
81939
+ children: [...p, nullPredicate],
81940
+ };
81941
+ predicates.push(compoundPredicate);
81942
+ }
81943
+ else {
81944
+ predicates.push(...p);
81945
+ }
81873
81946
  }
81874
81947
  else {
81875
81948
  // @W-12618378 polymorphic query sometimes does not work as expected on server. The GQL on certain entities could fail.
@@ -89889,6 +89962,7 @@ function generateTypedBatches(work, batchSize) {
89889
89962
  return batches;
89890
89963
  }
89891
89964
 
89965
+ const skippedCompoundFieldTypes = ['Address', 'Location'];
89892
89966
  function getMissingElementsFromSuperset(superset, subset) {
89893
89967
  return subset.filter((val) => !superset.includes(val));
89894
89968
  }
@@ -89905,6 +89979,7 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
89905
89979
  const allFields = Array.from(new Set([...Object.keys(existingRecord.fields), ...Object.keys(incomingRecord.fields)]));
89906
89980
  const fieldUnion = [];
89907
89981
  let includesSpanningFields = false;
89982
+ let includesSkippedFields = false;
89908
89983
  allFields.forEach((fieldName) => {
89909
89984
  const objectInfoField = objectInfo.fields[fieldName];
89910
89985
  if (objectInfoField === undefined) {
@@ -89922,10 +89997,17 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
89922
89997
  }
89923
89998
  }
89924
89999
  else {
90000
+ if (skippedCompoundFieldTypes.includes(objectInfo.fields[fieldName].dataType)) {
90001
+ includesSkippedFields = true;
90002
+ }
89925
90003
  fieldUnion.push(fieldName);
89926
90004
  }
89927
90005
  });
89928
- return { fields: fieldUnion, includesSpanningFields };
90006
+ return {
90007
+ fields: fieldUnion,
90008
+ includesSpanningFields,
90009
+ includesSkippedFields,
90010
+ };
89929
90011
  }
89930
90012
  /**
89931
90013
  * Merges (if possible) an incoming record from a priming session with an existing record in the durable store.
@@ -89988,9 +90070,15 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
89988
90070
  }
89989
90071
  else {
89990
90072
  const missingFields = getMissingElementsFromSuperset(Object.keys(incomingRecord.fields), Object.keys(existingRecord.fields));
89991
- // if the only missing fields are spanning fields and their corresponding lookup fields match, we can merge
89992
- // since none of the changed fields are part of the incoming record
89993
- if (missingFields.every((field) => {
90073
+ // tests for missing optional fields, pending fields, and spanning fields that can be merged
90074
+ const fieldIsMergeable = (field) => {
90075
+ // missing and pending fields in the existing record are mergeable
90076
+ const fieldState = existingRecord.fields[field].__state;
90077
+ if (fieldState && (fieldState.pending === true || fieldState.isMissing === true)) {
90078
+ return true;
90079
+ }
90080
+ // if the only missing fields are spanning fields and their corresponding lookup fields match, we can merge
90081
+ // since none of the changed fields are part of the incoming record
89994
90082
  const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
89995
90083
  if (referenceFieldName === undefined) {
89996
90084
  return false;
@@ -89999,7 +90087,8 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
89999
90087
  incomingRecord.fields[referenceFieldName] &&
90000
90088
  incomingRecord.fields[referenceFieldName].value ===
90001
90089
  existingRecord.fields[referenceFieldName].value);
90002
- })) {
90090
+ };
90091
+ if (missingFields.every(fieldIsMergeable)) {
90003
90092
  return {
90004
90093
  ok: true,
90005
90094
  needsWrite: true,
@@ -90019,8 +90108,8 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
90019
90108
  };
90020
90109
  }
90021
90110
  // If Etags do not match and the incoming record does not contain all fields, re-request the record
90022
- const { fields, includesSpanningFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
90023
- if (includesSpanningFields) {
90111
+ const { fields, includesSpanningFields, includesSkippedFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
90112
+ if (includesSpanningFields || includesSkippedFields) {
90024
90113
  return {
90025
90114
  ok: false,
90026
90115
  code: 'conflict-spanning-record',
@@ -91008,7 +91097,15 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
91008
91097
  if (Object.keys(recordTypeInfos).length > 1) {
91009
91098
  fieldSet.add('RecordTypeId');
91010
91099
  }
91011
- const fields = Array.from(fieldSet);
91100
+ const fields = Array.from(fieldSet).filter((field) => {
91101
+ const fieldMetadata = batch.objectInfo.fields[field];
91102
+ // skip Address and Location compound fields
91103
+ if (fieldMetadata.compound &&
91104
+ skippedCompoundFieldTypes.includes(fieldMetadata.dataType)) {
91105
+ return false;
91106
+ }
91107
+ return true;
91108
+ });
91012
91109
  // We will have SOQL format specific data types for us by adding a format() value.
91013
91110
  // The field alias will have ___display added to the end.
91014
91111
  for (const field of fieldSet) {
@@ -91027,7 +91124,6 @@ class RecordLoaderSOQLComposite extends NetworkRecordLoader {
91027
91124
  }
91028
91125
  }
91029
91126
  const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
91030
- // console.log(`DUSTIN: soql batch query: ${query}`);
91031
91127
  return query;
91032
91128
  }
91033
91129
  generateWhere(ids) {
@@ -93037,7 +93133,7 @@ register$1({
93037
93133
  id: '@salesforce/lds-network-adapter',
93038
93134
  instrument: instrument$2,
93039
93135
  });
93040
- // version: 1.354.0-dev6-a32f37c654
93136
+ // version: 1.354.0-dev7-d25082f814
93041
93137
 
93042
93138
  const { create: create$2, keys: keys$2 } = Object;
93043
93139
  const { stringify, parse } = JSON;
@@ -117146,7 +117242,7 @@ register$1({
117146
117242
  configuration: { ...configurationForGraphQLAdapters$1 },
117147
117243
  instrument: instrument$1,
117148
117244
  });
117149
- // version: 1.354.0-dev6-efb2ef03dd
117245
+ // version: 1.354.0-dev7-4e860a7769
117150
117246
 
117151
117247
  // On core the unstable adapters are re-exported with different names,
117152
117248
  // we want to match them here.
@@ -117298,7 +117394,7 @@ withDefaultLuvio((luvio) => {
117298
117394
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
117299
117395
  graphQLImperative = ldsAdapter;
117300
117396
  });
117301
- // version: 1.354.0-dev6-efb2ef03dd
117397
+ // version: 1.354.0-dev7-4e860a7769
117302
117398
 
117303
117399
  var gqlApi = /*#__PURE__*/Object.freeze({
117304
117400
  __proto__: null,
@@ -118090,7 +118186,7 @@ const callbacks$1 = [];
118090
118186
  function register(r) {
118091
118187
  callbacks$1.forEach((callback) => callback(r));
118092
118188
  }
118093
- // version: 1.354.0-dev6-a32f37c654
118189
+ // version: 1.354.0-dev7-d25082f814
118094
118190
 
118095
118191
  /**
118096
118192
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -119170,4 +119266,4 @@ const { luvio } = getRuntime();
119170
119266
  setDefaultLuvio({ luvio });
119171
119267
 
119172
119268
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
119173
- // version: 1.354.0-dev6-a32f37c654
119269
+ // version: 1.354.0-dev7-d25082f814
@@ -1112,6 +1112,11 @@
1112
1112
  if (isPendingSnapshot$1(snapshot)) {
1113
1113
  this.updateSubscriptionSnapshot(subscription, rebuiltSnapshot);
1114
1114
  }
1115
+ else if (!isErrorSnapshot$3(snapshot)) {
1116
+ // Context: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002D2hdeYAB/view
1117
+ // Merge the rebuiltSnapshot's seenRecords with the snapshot.seenRecords to ensure the subscription gets an emit the future
1118
+ snapshot.seenRecords.merge(rebuiltSnapshot.seenRecords);
1119
+ }
1115
1120
  return Promise.resolve();
1116
1121
  }
1117
1122
  this.updateSubscriptionSnapshot(subscription, rebuiltSnapshot);
@@ -4144,7 +4149,7 @@
4144
4149
  }
4145
4150
  return resourceParams;
4146
4151
  }
4147
- // engine version: 0.157.1-dev1-740cceb5
4152
+ // engine version: 0.157.1-dev2-7e528df5
4148
4153
 
4149
4154
  /**
4150
4155
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4272,7 +4277,7 @@
4272
4277
  }
4273
4278
  callbacks.push(callback);
4274
4279
  }
4275
- // version: 1.354.0-dev6-a32f37c654
4280
+ // version: 1.354.0-dev7-d25082f814
4276
4281
 
4277
4282
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4278
4283
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5220,7 +5225,7 @@
5220
5225
  const { apiFamily, name } = metadata;
5221
5226
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5222
5227
  }
5223
- // version: 1.354.0-dev6-a32f37c654
5228
+ // version: 1.354.0-dev7-d25082f814
5224
5229
 
5225
5230
  /**
5226
5231
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -5319,7 +5324,7 @@
5319
5324
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
5320
5325
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
5321
5326
  })(TypeCheckShapes || (TypeCheckShapes = {}));
5322
- // engine version: 0.157.1-dev1-740cceb5
5327
+ // engine version: 0.157.1-dev2-7e528df5
5323
5328
 
5324
5329
  const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
5325
5330
 
@@ -33996,7 +34001,7 @@
33996
34001
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
33997
34002
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
33998
34003
  });
33999
- // version: 1.354.0-dev6-efb2ef03dd
34004
+ // version: 1.354.0-dev7-4e860a7769
34000
34005
 
34001
34006
  /**
34002
34007
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -81875,7 +81880,75 @@
81875
81880
  // in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
81876
81881
  if (fieldInfo.referenceToInfos.length === 1) {
81877
81882
  const childRecordType = fieldInfo.referenceToInfos[0].apiName;
81878
- predicates.push(...filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins));
81883
+ let p = filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins);
81884
+ if (isSinglePredicate(p[0]) && p[0].value === null) {
81885
+ // @W-18311580 - this is a reference field with a null value. We need to ensure that we handle the case
81886
+ // where we are joining to a record that may not exist in our offline database, so we need to detect if
81887
+ // the value is really a null, or if it is a missing record in the offline database.
81888
+ //
81889
+ // This effecitvely adds the following predicates to a "where Contact.Account.Name IS NULL" query:
81890
+ //
81891
+ // AND (
81892
+ // (
81893
+ // json_extract("Contact__c_Account__r".data, '$.fields.Id.value') IS NOT NULL (a)
81894
+ // AND json_extract("Contact__c".data, '$.fields.AccountId.value') IS NOT NULL (b)
81895
+ // )
81896
+ // OR json_extract("Contact__c".data, '$.fields.AccountId.value') IS NULL (c)
81897
+ // )
81898
+ //
81899
+ // Where:
81900
+ // (a) AND (b) ensures we have an account record when it is supposed to exist,
81901
+ // OR (c) if AccountId is null, we know we are not referencing an account record.
81902
+ let notNullPredicate = {
81903
+ type: PredicateType.compound,
81904
+ operator: 'and',
81905
+ children: [
81906
+ {
81907
+ alias: alias,
81908
+ leftPath: leftPath,
81909
+ operator: 'IS NOT',
81910
+ value: null,
81911
+ dataType: 'String',
81912
+ type: PredicateType.single,
81913
+ isCaseSensitive: true,
81914
+ },
81915
+ {
81916
+ alias: childAlias,
81917
+ leftPath: `$.fields.Id.value`,
81918
+ operator: 'IS NOT',
81919
+ value: null,
81920
+ dataType: 'String',
81921
+ type: PredicateType.single,
81922
+ isCaseSensitive: true,
81923
+ },
81924
+ ],
81925
+ };
81926
+ let nullPredicate = {
81927
+ type: PredicateType.compound,
81928
+ operator: 'or',
81929
+ children: [
81930
+ notNullPredicate,
81931
+ {
81932
+ alias: alias,
81933
+ leftPath: leftPath,
81934
+ operator: 'IS',
81935
+ value: null,
81936
+ dataType: 'String',
81937
+ type: PredicateType.single,
81938
+ isCaseSensitive: true,
81939
+ },
81940
+ ],
81941
+ };
81942
+ let compoundPredicate = {
81943
+ type: PredicateType.compound,
81944
+ operator: 'and',
81945
+ children: [...p, nullPredicate],
81946
+ };
81947
+ predicates.push(compoundPredicate);
81948
+ }
81949
+ else {
81950
+ predicates.push(...p);
81951
+ }
81879
81952
  }
81880
81953
  else {
81881
81954
  // @W-12618378 polymorphic query sometimes does not work as expected on server. The GQL on certain entities could fail.
@@ -89895,6 +89968,7 @@
89895
89968
  return batches;
89896
89969
  }
89897
89970
 
89971
+ const skippedCompoundFieldTypes = ['Address', 'Location'];
89898
89972
  function getMissingElementsFromSuperset(superset, subset) {
89899
89973
  return subset.filter((val) => !superset.includes(val));
89900
89974
  }
@@ -89911,6 +89985,7 @@
89911
89985
  const allFields = Array.from(new Set([...Object.keys(existingRecord.fields), ...Object.keys(incomingRecord.fields)]));
89912
89986
  const fieldUnion = [];
89913
89987
  let includesSpanningFields = false;
89988
+ let includesSkippedFields = false;
89914
89989
  allFields.forEach((fieldName) => {
89915
89990
  const objectInfoField = objectInfo.fields[fieldName];
89916
89991
  if (objectInfoField === undefined) {
@@ -89928,10 +90003,17 @@
89928
90003
  }
89929
90004
  }
89930
90005
  else {
90006
+ if (skippedCompoundFieldTypes.includes(objectInfo.fields[fieldName].dataType)) {
90007
+ includesSkippedFields = true;
90008
+ }
89931
90009
  fieldUnion.push(fieldName);
89932
90010
  }
89933
90011
  });
89934
- return { fields: fieldUnion, includesSpanningFields };
90012
+ return {
90013
+ fields: fieldUnion,
90014
+ includesSpanningFields,
90015
+ includesSkippedFields,
90016
+ };
89935
90017
  }
89936
90018
  /**
89937
90019
  * Merges (if possible) an incoming record from a priming session with an existing record in the durable store.
@@ -89994,9 +90076,15 @@
89994
90076
  }
89995
90077
  else {
89996
90078
  const missingFields = getMissingElementsFromSuperset(Object.keys(incomingRecord.fields), Object.keys(existingRecord.fields));
89997
- // if the only missing fields are spanning fields and their corresponding lookup fields match, we can merge
89998
- // since none of the changed fields are part of the incoming record
89999
- if (missingFields.every((field) => {
90079
+ // tests for missing optional fields, pending fields, and spanning fields that can be merged
90080
+ const fieldIsMergeable = (field) => {
90081
+ // missing and pending fields in the existing record are mergeable
90082
+ const fieldState = existingRecord.fields[field].__state;
90083
+ if (fieldState && (fieldState.pending === true || fieldState.isMissing === true)) {
90084
+ return true;
90085
+ }
90086
+ // if the only missing fields are spanning fields and their corresponding lookup fields match, we can merge
90087
+ // since none of the changed fields are part of the incoming record
90000
90088
  const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
90001
90089
  if (referenceFieldName === undefined) {
90002
90090
  return false;
@@ -90005,7 +90093,8 @@
90005
90093
  incomingRecord.fields[referenceFieldName] &&
90006
90094
  incomingRecord.fields[referenceFieldName].value ===
90007
90095
  existingRecord.fields[referenceFieldName].value);
90008
- })) {
90096
+ };
90097
+ if (missingFields.every(fieldIsMergeable)) {
90009
90098
  return {
90010
90099
  ok: true,
90011
90100
  needsWrite: true,
@@ -90025,8 +90114,8 @@
90025
90114
  };
90026
90115
  }
90027
90116
  // If Etags do not match and the incoming record does not contain all fields, re-request the record
90028
- const { fields, includesSpanningFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
90029
- if (includesSpanningFields) {
90117
+ const { fields, includesSpanningFields, includesSkippedFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
90118
+ if (includesSpanningFields || includesSkippedFields) {
90030
90119
  return {
90031
90120
  ok: false,
90032
90121
  code: 'conflict-spanning-record',
@@ -91014,7 +91103,15 @@
91014
91103
  if (Object.keys(recordTypeInfos).length > 1) {
91015
91104
  fieldSet.add('RecordTypeId');
91016
91105
  }
91017
- const fields = Array.from(fieldSet);
91106
+ const fields = Array.from(fieldSet).filter((field) => {
91107
+ const fieldMetadata = batch.objectInfo.fields[field];
91108
+ // skip Address and Location compound fields
91109
+ if (fieldMetadata.compound &&
91110
+ skippedCompoundFieldTypes.includes(fieldMetadata.dataType)) {
91111
+ return false;
91112
+ }
91113
+ return true;
91114
+ });
91018
91115
  // We will have SOQL format specific data types for us by adding a format() value.
91019
91116
  // The field alias will have ___display added to the end.
91020
91117
  for (const field of fieldSet) {
@@ -91033,7 +91130,6 @@
91033
91130
  }
91034
91131
  }
91035
91132
  const query = `SELECT ${fields.join(',')} FROM ${batch.type} `;
91036
- // console.log(`DUSTIN: soql batch query: ${query}`);
91037
91133
  return query;
91038
91134
  }
91039
91135
  generateWhere(ids) {
@@ -93043,7 +93139,7 @@
93043
93139
  id: '@salesforce/lds-network-adapter',
93044
93140
  instrument: instrument$2,
93045
93141
  });
93046
- // version: 1.354.0-dev6-a32f37c654
93142
+ // version: 1.354.0-dev7-d25082f814
93047
93143
 
93048
93144
  const { create: create$2, keys: keys$2 } = Object;
93049
93145
  const { stringify, parse } = JSON;
@@ -117152,7 +117248,7 @@
117152
117248
  configuration: { ...configurationForGraphQLAdapters$1 },
117153
117249
  instrument: instrument$1,
117154
117250
  });
117155
- // version: 1.354.0-dev6-efb2ef03dd
117251
+ // version: 1.354.0-dev7-4e860a7769
117156
117252
 
117157
117253
  // On core the unstable adapters are re-exported with different names,
117158
117254
  // we want to match them here.
@@ -117304,7 +117400,7 @@
117304
117400
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
117305
117401
  graphQLImperative = ldsAdapter;
117306
117402
  });
117307
- // version: 1.354.0-dev6-efb2ef03dd
117403
+ // version: 1.354.0-dev7-4e860a7769
117308
117404
 
117309
117405
  var gqlApi = /*#__PURE__*/Object.freeze({
117310
117406
  __proto__: null,
@@ -118096,7 +118192,7 @@
118096
118192
  function register(r) {
118097
118193
  callbacks$1.forEach((callback) => callback(r));
118098
118194
  }
118099
- // version: 1.354.0-dev6-a32f37c654
118195
+ // version: 1.354.0-dev7-d25082f814
118100
118196
 
118101
118197
  /**
118102
118198
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -119195,4 +119291,4 @@
119195
119291
  exports.subscribeToAdapter = subscribeToAdapter;
119196
119292
 
119197
119293
  }));
119198
- // version: 1.354.0-dev6-a32f37c654
119294
+ // version: 1.354.0-dev7-d25082f814
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.354.0-dev6",
3
+ "version": "1.354.0-dev7",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.354.0-dev6",
39
- "@salesforce/lds-adapters-uiapi": "^1.354.0-dev6",
40
- "@salesforce/lds-default-luvio": "^1.354.0-dev6",
41
- "@salesforce/lds-drafts": "^1.354.0-dev6",
42
- "@salesforce/lds-graphql-parser": "^1.354.0-dev6",
43
- "@salesforce/lds-luvio-engine": "^1.354.0-dev6",
44
- "@salesforce/lds-runtime-mobile": "^1.354.0-dev6",
45
- "@salesforce/nimbus-plugin-lds": "^1.354.0-dev6",
38
+ "@salesforce/lds-adapters-graphql": "^1.354.0-dev7",
39
+ "@salesforce/lds-adapters-uiapi": "^1.354.0-dev7",
40
+ "@salesforce/lds-default-luvio": "^1.354.0-dev7",
41
+ "@salesforce/lds-drafts": "^1.354.0-dev7",
42
+ "@salesforce/lds-graphql-parser": "^1.354.0-dev7",
43
+ "@salesforce/lds-luvio-engine": "^1.354.0-dev7",
44
+ "@salesforce/lds-runtime-mobile": "^1.354.0-dev7",
45
+ "@salesforce/nimbus-plugin-lds": "^1.354.0-dev7",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",