@salesforce/lds-store-nimbus 1.237.0 → 1.238.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 (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -284,10 +284,17 @@ class NimbusSqliteStore {
284
284
  }
285
285
  setMetadata(entries, segment) {
286
286
  const table = this.getTable(segment);
287
- const operation = this.plugin.supportsBatchUpdates === undefined ||
288
- this.plugin.supportsBatchUpdates() === false
289
- ? table.entriesToUpsertOperations(entries, segment)
290
- : table.metadataToUpdateOperations(entries, segment);
287
+ let operation;
288
+ if (this.plugin.supportsBatchUpdates === undefined ||
289
+ this.plugin.supportsBatchUpdates() === false) {
290
+ operation = table.entriesToUpsertOperations(entries, segment);
291
+ // manually set the context type on the upsert so notifications do not notify rebuilds without
292
+ // plugin updates
293
+ operation.context.type = 'setMetadata';
294
+ }
295
+ else {
296
+ operation = table.metadataToUpdateOperations(entries, segment);
297
+ }
291
298
  return this.batchOperationAsPromise([operation]);
292
299
  }
293
300
  batchOperations(operations) {
@@ -300,7 +307,11 @@ class NimbusSqliteStore {
300
307
  const table = this.getTable(cur.segment);
301
308
  if (this.plugin.supportsBatchUpdates === undefined ||
302
309
  this.plugin.supportsBatchUpdates() === false) {
303
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
310
+ const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
311
+ // manually set the context type on the upsert so notifications do not notify rebuilds without
312
+ // plugin updates
313
+ upsert.context.type = 'setMetadata';
314
+ acc.push(upsert);
304
315
  }
305
316
  else {
306
317
  acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
@@ -326,7 +337,8 @@ class NimbusSqliteStore {
326
337
  // if our context contains a type then set that as our main level type
327
338
  // allows us in the future of updates to specify the segment change happening
328
339
  // example being update call on metadata only or updating data
329
- if (c.type === 'update' && c.context.type !== undefined) {
340
+ if ((c.type === 'update' || c.type === 'upsert') &&
341
+ c.context.type !== undefined) {
330
342
  type = c.context.type;
331
343
  }
332
344
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-store-nimbus",
3
- "version": "1.237.0",
3
+ "version": "1.238.0",
4
4
  "description": "A nimbus-plugin-based implementation of the Luvio DurableStore and SqliteStore.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "types": "dist/types/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  {
35
35
  "path": "./dist/index.js",
36
36
  "maxSize": {
37
- "none": "17 kB",
37
+ "none": "18 kB",
38
38
  "min": "8 kB",
39
39
  "compressed": "3 kB"
40
40
  }