@salesforce/lds-store-nimbus 1.244.0 → 1.246.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.
package/dist/index.js CHANGED
@@ -251,6 +251,7 @@ class NimbusSqliteStore {
251
251
  ...additionalTableMap,
252
252
  [DefaultDurableSegment]: new LdsDataTable(plugin),
253
253
  };
254
+ this.supportsBatchUpdates = plugin.supportsBatchUpdates !== undefined;
254
255
  }
255
256
  isEvalSupported() {
256
257
  return true;
@@ -285,16 +286,15 @@ class NimbusSqliteStore {
285
286
  setMetadata(entries, segment) {
286
287
  const table = this.getTable(segment);
287
288
  let operation;
288
- if (this.plugin.supportsBatchUpdates === undefined ||
289
- this.plugin.supportsBatchUpdates() === false) {
289
+ if (this.supportsBatchUpdates) {
290
+ operation = table.metadataToUpdateOperations(entries, segment);
291
+ }
292
+ else {
290
293
  operation = table.entriesToUpsertOperations(entries, segment);
291
294
  // manually set the context type on the upsert so notifications do not notify rebuilds without
292
295
  // plugin updates
293
296
  operation.context.type = 'setMetadata';
294
297
  }
295
- else {
296
- operation = table.metadataToUpdateOperations(entries, segment);
297
- }
298
298
  return this.batchOperationAsPromise([operation]);
299
299
  }
300
300
  batchOperations(operations) {
@@ -305,17 +305,16 @@ class NimbusSqliteStore {
305
305
  }
306
306
  else if (cur.type === 'setMetadata') {
307
307
  const table = this.getTable(cur.segment);
308
- if (this.plugin.supportsBatchUpdates === undefined ||
309
- this.plugin.supportsBatchUpdates() === false) {
308
+ if (this.supportsBatchUpdates) {
309
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
310
+ }
311
+ else {
310
312
  const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
311
313
  // manually set the context type on the upsert so notifications do not notify rebuilds without
312
314
  // plugin updates
313
315
  upsert.context.type = 'setMetadata';
314
316
  acc.push(upsert);
315
317
  }
316
- else {
317
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
318
- }
319
318
  }
320
319
  else {
321
320
  acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
@@ -11,6 +11,7 @@ export declare class NimbusSqliteStore implements SqliteStore, DurableStore {
11
11
  private plugin;
12
12
  private readonly dataTableMap;
13
13
  private readonly internalDataTable;
14
+ private supportsBatchUpdates;
14
15
  constructor(plugin: SqliteStorePlugin, additionalTableMap?: Record<string, LdsDataTableBase>);
15
16
  isEvalSupported(): boolean;
16
17
  query(sql: string, params: SqliteType[]): Promise<SqliteResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-store-nimbus",
3
- "version": "1.244.0",
3
+ "version": "1.246.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",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {},
28
28
  "devDependencies": {
29
- "@luvio/environments": "0.150.3",
29
+ "@luvio/environments": "0.150.6",
30
30
  "@salesforce/nimbus-plugin-lds": "*",
31
31
  "@salesforce/lds-store-sql": "*"
32
32
  },