@salesforce/lds-runtime-mobile 1.130.8 → 1.130.10

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/dist/main.js CHANGED
@@ -1240,7 +1240,8 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1240
1240
  for (const cacheKeyMapKey of cacheKeyMapKeys) {
1241
1241
  const cacheKey = cacheKeyMap.get(cacheKeyMapKey);
1242
1242
  if (cacheKey.mergeable === true) {
1243
- keysToRevive.add(cacheKeyMapKey);
1243
+ const canonical = environment.storeGetCanonicalKey(cacheKeyMapKey);
1244
+ keysToRevive.add(canonical);
1244
1245
  }
1245
1246
  }
1246
1247
  let snapshotFromMemoryIngest = undefined;
@@ -11022,6 +11023,10 @@ function makeEnvironmentUiApiRecordDraftAware(luvio, options, env) {
11022
11023
  return create$2(adapterSpecificEnvironments, {});
11023
11024
  }
11024
11025
 
11026
+ function clone(obj) {
11027
+ return parse$2(stringify$2(obj));
11028
+ }
11029
+
11025
11030
  const DEFAULT_FIELD_CREATED_BY_ID = 'CreatedById';
11026
11031
  const DEFAULT_FIELD_CREATED_DATE = 'CreatedDate';
11027
11032
  const DEFAULT_FIELD_ID = 'Id';
@@ -11049,7 +11054,9 @@ function replayDraftsOnRecord(record, draftMetadata) {
11049
11054
  // no baseRecord
11050
11055
  return undefined;
11051
11056
  }
11052
- const { recordOperations } = draftMetadata;
11057
+ const { recordOperations: originalOperations } = draftMetadata;
11058
+ // since replaying drafts is destructive, we need to clone the original operations
11059
+ const recordOperations = clone(originalOperations);
11053
11060
  if (recordOperations.length === 0) {
11054
11061
  return undefined;
11055
11062
  }
@@ -11080,7 +11087,11 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
11080
11087
  }
11081
11088
  const draftActionType = draftOperation.type;
11082
11089
  if (draftActionType === 'create') {
11083
- throw Error('a create action cannot exist on an existing record');
11090
+ if (record.drafts !== undefined) {
11091
+ throw Error('a create action cannot exist on an existing draft record');
11092
+ }
11093
+ // the draft may have been uploaded already so skip the create operation and apply the rest (if any)
11094
+ return recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations);
11084
11095
  }
11085
11096
  // add the draft node
11086
11097
  if (record.drafts === undefined) {
@@ -11843,6 +11854,11 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
11843
11854
  let record = entry && entry.data;
11844
11855
  if (record === undefined) {
11845
11856
  record = storeRecords[recordKey];
11857
+ if (record === undefined) {
11858
+ // fields are being published without a record for them existing,
11859
+ // fields cannot exist standalone in the durable store
11860
+ continue;
11861
+ }
11846
11862
  }
11847
11863
  putRecords[recordId] = true;
11848
11864
  if (isStoreRecordError(record)) {
@@ -15710,4 +15726,4 @@ register({
15710
15726
  });
15711
15727
 
15712
15728
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15713
- // version: 1.130.8-e6645fb41
15729
+ // version: 1.130.10-0fac4c295
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.130.8",
3
+ "version": "1.130.10",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
package/sfdc/main.js CHANGED
@@ -1240,7 +1240,8 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1240
1240
  for (const cacheKeyMapKey of cacheKeyMapKeys) {
1241
1241
  const cacheKey = cacheKeyMap.get(cacheKeyMapKey);
1242
1242
  if (cacheKey.mergeable === true) {
1243
- keysToRevive.add(cacheKeyMapKey);
1243
+ const canonical = environment.storeGetCanonicalKey(cacheKeyMapKey);
1244
+ keysToRevive.add(canonical);
1244
1245
  }
1245
1246
  }
1246
1247
  let snapshotFromMemoryIngest = undefined;
@@ -11022,6 +11023,10 @@ function makeEnvironmentUiApiRecordDraftAware(luvio, options, env) {
11022
11023
  return create$2(adapterSpecificEnvironments, {});
11023
11024
  }
11024
11025
 
11026
+ function clone(obj) {
11027
+ return parse$2(stringify$2(obj));
11028
+ }
11029
+
11025
11030
  const DEFAULT_FIELD_CREATED_BY_ID = 'CreatedById';
11026
11031
  const DEFAULT_FIELD_CREATED_DATE = 'CreatedDate';
11027
11032
  const DEFAULT_FIELD_ID = 'Id';
@@ -11049,7 +11054,9 @@ function replayDraftsOnRecord(record, draftMetadata) {
11049
11054
  // no baseRecord
11050
11055
  return undefined;
11051
11056
  }
11052
- const { recordOperations } = draftMetadata;
11057
+ const { recordOperations: originalOperations } = draftMetadata;
11058
+ // since replaying drafts is destructive, we need to clone the original operations
11059
+ const recordOperations = clone(originalOperations);
11053
11060
  if (recordOperations.length === 0) {
11054
11061
  return undefined;
11055
11062
  }
@@ -11080,7 +11087,11 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
11080
11087
  }
11081
11088
  const draftActionType = draftOperation.type;
11082
11089
  if (draftActionType === 'create') {
11083
- throw Error('a create action cannot exist on an existing record');
11090
+ if (record.drafts !== undefined) {
11091
+ throw Error('a create action cannot exist on an existing draft record');
11092
+ }
11093
+ // the draft may have been uploaded already so skip the create operation and apply the rest (if any)
11094
+ return recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations);
11084
11095
  }
11085
11096
  // add the draft node
11086
11097
  if (record.drafts === undefined) {
@@ -11843,6 +11854,11 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
11843
11854
  let record = entry && entry.data;
11844
11855
  if (record === undefined) {
11845
11856
  record = storeRecords[recordKey];
11857
+ if (record === undefined) {
11858
+ // fields are being published without a record for them existing,
11859
+ // fields cannot exist standalone in the durable store
11860
+ continue;
11861
+ }
11846
11862
  }
11847
11863
  putRecords[recordId] = true;
11848
11864
  if (isStoreRecordError(record)) {
@@ -15710,4 +15726,4 @@ register({
15710
15726
  });
15711
15727
 
15712
15728
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15713
- // version: 1.130.8-e6645fb41
15729
+ // version: 1.130.10-0fac4c295