@salesforce/lds-runtime-mobile 1.275.0 → 1.276.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 (3) hide show
  1. package/dist/main.js +31 -15
  2. package/package.json +16 -16
  3. package/sfdc/main.js +31 -15
package/dist/main.js CHANGED
@@ -814,10 +814,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
814
814
  const entries = wasVisited === true || enableDurableMetadataRefresh === false
815
815
  ? durableRecords
816
816
  : refreshedDurableRecords;
817
- const isMetadataRefresh = entries === refreshedDurableRecords;
818
- setRecordTo(entries, key,
819
- // dont send record data with metadata refresh
820
- isMetadataRefresh ? undefined : record, metadata);
817
+ setRecordTo(entries, key, record, metadata);
821
818
  }
822
819
  const durableStoreOperations = additionalDurableStoreOperations;
823
820
  const recordKeys = keys$7(durableRecords);
@@ -12372,13 +12369,21 @@ function buildSyntheticRecordRepresentation(luvio, createOperation, userId, obje
12372
12369
  draftFields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = { value: timestampString, displayValue: null };
12373
12370
  draftFields[DEFAULT_FIELD_OWNER_ID] = { value: userId, displayValue: null };
12374
12371
  draftFields[DEFAULT_FIELD_ID] = { value: recordId, displayValue: null };
12375
- if (objectInfo !== undefined) {
12376
- const allObjectFields = keys$3(objectInfo.fields);
12377
- allObjectFields.forEach((fieldName) => {
12378
- if (draftFields[fieldName] === undefined) {
12379
- draftFields[fieldName] = { value: null, displayValue: null };
12380
- }
12381
- });
12372
+ const allObjectFields = keys$3(objectInfo.fields);
12373
+ allObjectFields.forEach((fieldName) => {
12374
+ if (draftFields[fieldName] === undefined) {
12375
+ draftFields[fieldName] = { value: null, displayValue: null };
12376
+ }
12377
+ });
12378
+ // TODO [W-14915806]: lightning-record-form injects the `IsPersonAccount`
12379
+ // field for all `Account` and `PersonAccount` records. However, not all
12380
+ // orgs use person accounts, and if that field is not present in the object
12381
+ // info then it is not synthesized. We force it to be synthesized here to
12382
+ // ensure lightning-record-form will work correctly with draft-created
12383
+ // accounts.
12384
+ if ((apiName === 'Account' || apiName === 'PersonAccount') &&
12385
+ draftFields['IsPersonAccount'] === undefined) {
12386
+ draftFields['IsPersonAccount'] = { value: null, displayValue: null };
12382
12387
  }
12383
12388
  return {
12384
12389
  id: recordId,
@@ -16785,6 +16790,7 @@ function findReferenceFieldForSpanningField(fieldName, objectInfo) {
16785
16790
  function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
16786
16791
  const allFields = Array.from(new Set([...Object.keys(existingRecord.fields), ...Object.keys(incomingRecord.fields)]));
16787
16792
  const fieldUnion = [];
16793
+ let includesSpanningFields = false;
16788
16794
  allFields.forEach((fieldName) => {
16789
16795
  const objectInfoField = objectInfo.fields[fieldName];
16790
16796
  if (objectInfoField === undefined) {
@@ -16792,13 +16798,14 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
16792
16798
  const referenceField = findReferenceFieldForSpanningField(fieldName, objectInfo);
16793
16799
  if (referenceField !== undefined) {
16794
16800
  fieldUnion.push(`${fieldName}.Id`);
16801
+ includesSpanningFields = true;
16795
16802
  }
16796
16803
  }
16797
16804
  else {
16798
16805
  fieldUnion.push(fieldName);
16799
16806
  }
16800
16807
  });
16801
- return fieldUnion;
16808
+ return { fields: fieldUnion, includesSpanningFields };
16802
16809
  }
16803
16810
  /**
16804
16811
  * Merges (if possible) an incoming record from a priming session with an existing record in the durable store.
@@ -16830,7 +16837,7 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
16830
16837
  ok: false,
16831
16838
  code: 'conflict-drafts',
16832
16839
  hasDraft: true,
16833
- fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo),
16840
+ fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo).fields,
16834
16841
  };
16835
16842
  }
16836
16843
  // Check if incoming record's Etag is equal to the existing one
@@ -16892,10 +16899,19 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
16892
16899
  };
16893
16900
  }
16894
16901
  // If Etags do not match and the incoming record does not contain all fields, re-request the record
16902
+ const { fields, includesSpanningFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
16903
+ if (includesSpanningFields) {
16904
+ return {
16905
+ ok: false,
16906
+ code: 'conflict-spanning-record',
16907
+ fieldUnion: fields,
16908
+ hasDraft: false,
16909
+ };
16910
+ }
16895
16911
  return {
16896
16912
  ok: false,
16897
16913
  code: 'conflict-missing-fields',
16898
- fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo),
16914
+ fieldUnion: fields,
16899
16915
  hasDraft: false,
16900
16916
  };
16901
16917
  }
@@ -17948,4 +17964,4 @@ register({
17948
17964
  });
17949
17965
 
17950
17966
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17951
- // version: 1.275.0-c8b3e2f72
17967
+ // version: 1.276.0-dcebc4076
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.275.0",
3
+ "version": "1.276.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,25 +32,25 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.275.0",
36
- "@salesforce/lds-bindings": "^1.275.0",
37
- "@salesforce/lds-instrumentation": "^1.275.0",
38
- "@salesforce/lds-priming": "^1.275.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.276.0",
36
+ "@salesforce/lds-bindings": "^1.276.0",
37
+ "@salesforce/lds-instrumentation": "^1.276.0",
38
+ "@salesforce/lds-priming": "^1.276.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.275.0",
44
- "@salesforce/lds-drafts": "^1.275.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.275.0",
46
- "@salesforce/lds-graphql-eval": "^1.275.0",
47
- "@salesforce/lds-network-adapter": "^1.275.0",
48
- "@salesforce/lds-network-nimbus": "^1.275.0",
49
- "@salesforce/lds-store-binary": "^1.275.0",
50
- "@salesforce/lds-store-nimbus": "^1.275.0",
51
- "@salesforce/lds-store-sql": "^1.275.0",
52
- "@salesforce/lds-utils-adapters": "^1.275.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.275.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.276.0",
44
+ "@salesforce/lds-drafts": "^1.276.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.276.0",
46
+ "@salesforce/lds-graphql-eval": "^1.276.0",
47
+ "@salesforce/lds-network-adapter": "^1.276.0",
48
+ "@salesforce/lds-network-nimbus": "^1.276.0",
49
+ "@salesforce/lds-store-binary": "^1.276.0",
50
+ "@salesforce/lds-store-nimbus": "^1.276.0",
51
+ "@salesforce/lds-store-sql": "^1.276.0",
52
+ "@salesforce/lds-utils-adapters": "^1.276.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.276.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
package/sfdc/main.js CHANGED
@@ -814,10 +814,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
814
814
  const entries = wasVisited === true || enableDurableMetadataRefresh === false
815
815
  ? durableRecords
816
816
  : refreshedDurableRecords;
817
- const isMetadataRefresh = entries === refreshedDurableRecords;
818
- setRecordTo(entries, key,
819
- // dont send record data with metadata refresh
820
- isMetadataRefresh ? undefined : record, metadata);
817
+ setRecordTo(entries, key, record, metadata);
821
818
  }
822
819
  const durableStoreOperations = additionalDurableStoreOperations;
823
820
  const recordKeys = keys$7(durableRecords);
@@ -12372,13 +12369,21 @@ function buildSyntheticRecordRepresentation(luvio, createOperation, userId, obje
12372
12369
  draftFields[DEFAULT_FIELD_LAST_MODIFIED_DATE] = { value: timestampString, displayValue: null };
12373
12370
  draftFields[DEFAULT_FIELD_OWNER_ID] = { value: userId, displayValue: null };
12374
12371
  draftFields[DEFAULT_FIELD_ID] = { value: recordId, displayValue: null };
12375
- if (objectInfo !== undefined) {
12376
- const allObjectFields = keys$3(objectInfo.fields);
12377
- allObjectFields.forEach((fieldName) => {
12378
- if (draftFields[fieldName] === undefined) {
12379
- draftFields[fieldName] = { value: null, displayValue: null };
12380
- }
12381
- });
12372
+ const allObjectFields = keys$3(objectInfo.fields);
12373
+ allObjectFields.forEach((fieldName) => {
12374
+ if (draftFields[fieldName] === undefined) {
12375
+ draftFields[fieldName] = { value: null, displayValue: null };
12376
+ }
12377
+ });
12378
+ // TODO [W-14915806]: lightning-record-form injects the `IsPersonAccount`
12379
+ // field for all `Account` and `PersonAccount` records. However, not all
12380
+ // orgs use person accounts, and if that field is not present in the object
12381
+ // info then it is not synthesized. We force it to be synthesized here to
12382
+ // ensure lightning-record-form will work correctly with draft-created
12383
+ // accounts.
12384
+ if ((apiName === 'Account' || apiName === 'PersonAccount') &&
12385
+ draftFields['IsPersonAccount'] === undefined) {
12386
+ draftFields['IsPersonAccount'] = { value: null, displayValue: null };
12382
12387
  }
12383
12388
  return {
12384
12389
  id: recordId,
@@ -16785,6 +16790,7 @@ function findReferenceFieldForSpanningField(fieldName, objectInfo) {
16785
16790
  function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
16786
16791
  const allFields = Array.from(new Set([...Object.keys(existingRecord.fields), ...Object.keys(incomingRecord.fields)]));
16787
16792
  const fieldUnion = [];
16793
+ let includesSpanningFields = false;
16788
16794
  allFields.forEach((fieldName) => {
16789
16795
  const objectInfoField = objectInfo.fields[fieldName];
16790
16796
  if (objectInfoField === undefined) {
@@ -16792,13 +16798,14 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
16792
16798
  const referenceField = findReferenceFieldForSpanningField(fieldName, objectInfo);
16793
16799
  if (referenceField !== undefined) {
16794
16800
  fieldUnion.push(`${fieldName}.Id`);
16801
+ includesSpanningFields = true;
16795
16802
  }
16796
16803
  }
16797
16804
  else {
16798
16805
  fieldUnion.push(fieldName);
16799
16806
  }
16800
16807
  });
16801
- return fieldUnion;
16808
+ return { fields: fieldUnion, includesSpanningFields };
16802
16809
  }
16803
16810
  /**
16804
16811
  * Merges (if possible) an incoming record from a priming session with an existing record in the durable store.
@@ -16830,7 +16837,7 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
16830
16837
  ok: false,
16831
16838
  code: 'conflict-drafts',
16832
16839
  hasDraft: true,
16833
- fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo),
16840
+ fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo).fields,
16834
16841
  };
16835
16842
  }
16836
16843
  // Check if incoming record's Etag is equal to the existing one
@@ -16892,10 +16899,19 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
16892
16899
  };
16893
16900
  }
16894
16901
  // If Etags do not match and the incoming record does not contain all fields, re-request the record
16902
+ const { fields, includesSpanningFields } = buildFieldUnionArray(existingRecord, incomingRecord, objectInfo);
16903
+ if (includesSpanningFields) {
16904
+ return {
16905
+ ok: false,
16906
+ code: 'conflict-spanning-record',
16907
+ fieldUnion: fields,
16908
+ hasDraft: false,
16909
+ };
16910
+ }
16895
16911
  return {
16896
16912
  ok: false,
16897
16913
  code: 'conflict-missing-fields',
16898
- fieldUnion: buildFieldUnionArray(existingRecord, incomingRecord, objectInfo),
16914
+ fieldUnion: fields,
16899
16915
  hasDraft: false,
16900
16916
  };
16901
16917
  }
@@ -17948,4 +17964,4 @@ register({
17948
17964
  });
17949
17965
 
17950
17966
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17951
- // version: 1.275.0-c8b3e2f72
17967
+ // version: 1.276.0-dcebc4076