@salesforce/lds-runtime-bridge 1.283.0 → 1.285.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.
@@ -1389,11 +1389,17 @@ class NimbusSqliteStore {
1389
1389
  return this.getTable(segment).getAll(segment);
1390
1390
  }
1391
1391
  setEntries(entries, segment) {
1392
+ if (keys$2(entries).length === 0) {
1393
+ return Promise.resolve();
1394
+ }
1392
1395
  const table = this.getTable(segment);
1393
1396
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
1394
1397
  return this.batchOperationAsPromise([upsertOperation]);
1395
1398
  }
1396
1399
  setMetadata(entries, segment) {
1400
+ if (keys$2(entries).length === 0) {
1401
+ return Promise.resolve();
1402
+ }
1397
1403
  const table = this.getTable(segment);
1398
1404
  let operation;
1399
1405
  if (this.supportsBatchUpdates) {
@@ -1410,32 +1416,41 @@ class NimbusSqliteStore {
1410
1416
  batchOperations(operations) {
1411
1417
  const sqliteOperations = operations.reduce((acc, cur) => {
1412
1418
  if (cur.type === 'setEntries') {
1413
- const table = this.getTable(cur.segment);
1414
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
1419
+ if (keys$2(cur.entries).length > 0) {
1420
+ const table = this.getTable(cur.segment);
1421
+ acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
1422
+ }
1415
1423
  }
1416
1424
  else if (cur.type === 'setMetadata') {
1417
- const table = this.getTable(cur.segment);
1418
- if (this.supportsBatchUpdates) {
1419
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
1420
- }
1421
- else {
1422
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
1423
- // manually set the context type on the upsert so notifications do not notify rebuilds without
1424
- // plugin updates
1425
- upsert.context.type = 'setMetadata';
1426
- acc.push(upsert);
1425
+ if (keys$2(cur.entries).length > 0) {
1426
+ const table = this.getTable(cur.segment);
1427
+ if (this.supportsBatchUpdates) {
1428
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
1429
+ }
1430
+ else {
1431
+ const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
1432
+ // manually set the context type on the upsert so notifications do not notify rebuilds without
1433
+ // plugin updates
1434
+ upsert.context.type = 'setMetadata';
1435
+ acc.push(upsert);
1436
+ }
1427
1437
  }
1428
1438
  }
1429
1439
  else {
1430
- acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
1440
+ if (cur.ids.length > 0) {
1441
+ acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
1442
+ }
1431
1443
  }
1432
1444
  return acc;
1433
1445
  }, []);
1434
- return this.batchOperationAsPromise(sqliteOperations);
1446
+ return sqliteOperations.length === 0
1447
+ ? Promise.resolve()
1448
+ : this.batchOperationAsPromise(sqliteOperations);
1435
1449
  }
1436
1450
  evictEntries(entryIds, segment) {
1437
- const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
1438
- return this.batchOperationAsPromise([sqliteOperation]);
1451
+ return entryIds.length === 0
1452
+ ? Promise.resolve()
1453
+ : this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
1439
1454
  }
1440
1455
  registerOnChangedListener(listener) {
1441
1456
  let unsubscribeId = undefined;
@@ -3751,6 +3766,9 @@ function normalizeRecordFields(key, entry) {
3751
3766
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
3752
3767
  * scalar fields and persisting link metadata to transform back into a normalized representation
3753
3768
  *
3769
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
3770
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
3771
+ *
3754
3772
  * @param normalizedRecord Record containing normalized field links
3755
3773
  * @param recordStore a store containing referenced record fields
3756
3774
  */
@@ -3765,7 +3783,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
3765
3783
  // pending fields get filtered out of the durable store
3766
3784
  const { pending } = field;
3767
3785
  if (pending === true) {
3768
- continue;
3786
+ // do not write records with pending fields to the durable store
3787
+ // there should be a refresh operation outbound that will bring in the updated record
3788
+ return undefined;
3769
3789
  }
3770
3790
  const { __ref } = field;
3771
3791
  if (__ref !== undefined) {
@@ -3931,10 +3951,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3931
3951
  };
3932
3952
  }
3933
3953
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
3934
- putEntries[recordKey] = {
3935
- data: denormalizedRecord,
3936
- metadata,
3937
- };
3954
+ if (denormalizedRecord !== undefined) {
3955
+ putEntries[recordKey] = {
3956
+ data: denormalizedRecord,
3957
+ metadata,
3958
+ };
3959
+ }
3938
3960
  }
3939
3961
  else {
3940
3962
  putEntries[key] = value;
@@ -4077,4 +4099,4 @@ function ldsRuntimeBridge() {
4077
4099
  }
4078
4100
 
4079
4101
  export { ldsRuntimeBridge as default };
4080
- // version: 1.283.0-a330da944
4102
+ // version: 1.285.0-67d4d6869
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-bridge",
3
- "version": "1.283.0",
3
+ "version": "1.285.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for bridge.app.",
6
6
  "main": "dist/ldsRuntimeBridge.js",
@@ -34,17 +34,17 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
35
35
  },
36
36
  "dependencies": {
37
- "@salesforce/lds-adapters-uiapi": "^1.283.0",
38
- "@salesforce/lds-instrumentation": "^1.283.0",
37
+ "@salesforce/lds-adapters-uiapi": "^1.285.0",
38
+ "@salesforce/lds-instrumentation": "^1.285.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-drafts-adapters-uiapi": "^1.283.0",
44
- "@salesforce/lds-network-aura": "^1.283.0",
45
- "@salesforce/lds-runtime-aura": "^1.283.0",
46
- "@salesforce/lds-store-nimbus": "^1.283.0",
47
- "@salesforce/nimbus-plugin-lds": "^1.283.0",
43
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.285.0",
44
+ "@salesforce/lds-network-aura": "^1.285.0",
45
+ "@salesforce/lds-runtime-aura": "^1.285.0",
46
+ "@salesforce/lds-store-nimbus": "^1.285.0",
47
+ "@salesforce/nimbus-plugin-lds": "^1.285.0",
48
48
  "babel-plugin-dynamic-import-node": "^2.3.3"
49
49
  },
50
50
  "luvioBundlesize": [