@salesforce/lds-runtime-mobile 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.
package/dist/main.js CHANGED
@@ -5514,10 +5514,6 @@ class DurableDraftQueue {
5514
5514
  switch (result) {
5515
5515
  case ProcessActionResult.BLOCKED_ON_ERROR:
5516
5516
  this.state = DraftQueueState.Error;
5517
- await this.notifyChangedListeners({
5518
- type: DraftQueueEventType.QueueStateChanged,
5519
- state: this.state,
5520
- });
5521
5517
  return Promise.reject();
5522
5518
  default:
5523
5519
  return Promise.resolve();
@@ -5663,6 +5659,10 @@ class DurableDraftQueue {
5663
5659
  if (status === DraftActionStatus.Error) {
5664
5660
  this.state = DraftQueueState.Error;
5665
5661
  this.processingAction = undefined;
5662
+ this.notifyChangedListeners({
5663
+ type: DraftQueueEventType.ActionFailed,
5664
+ action: action,
5665
+ });
5666
5666
  return ProcessActionResult.BLOCKED_ON_ERROR;
5667
5667
  }
5668
5668
  if (id === this.uploadingActionId) {
@@ -11325,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
11325
11325
  * @param objectInfos
11326
11326
  * @returns
11327
11327
  */
11328
- function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11328
+ function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
11329
11329
  const { selectionSet } = topNode;
11330
11330
  if (selectionSet === undefined)
11331
11331
  return [];
@@ -11339,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11339
11339
  displayValue = node;
11340
11340
  break;
11341
11341
  }
11342
- if (isInlineFragmentNode(node)) {
11343
- const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
11344
- displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
11345
- }
11346
11342
  }
11347
11343
  if (displayValue !== undefined) {
11348
- const apiName = parentNode.name.value;
11349
11344
  const objectInfo = objectInfos[apiName];
11350
11345
  if (objectInfo !== undefined &&
11351
11346
  objectInfo.nameFields !== undefined &&
@@ -11412,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
11412
11407
  // example: TimeSheetId { value }
11413
11408
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
11414
11409
  }
11415
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
11416
- ...parent,
11417
- name: {
11418
- ...parent.name,
11419
- value: targetRelationship.childObjectApiName,
11420
- },
11421
- }, objectInfos));
11410
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
11422
11411
  }
11423
11412
  }
11424
11413
  }
11425
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
11414
+ else {
11415
+ let apiName = parent.name.value;
11416
+ if (pathToObjectApiNamesMap[parentPath] !== undefined &&
11417
+ pathToObjectApiNamesMap[parentPath].length === 1) {
11418
+ apiName = pathToObjectApiNamesMap[parentPath][0];
11419
+ }
11420
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11421
+ }
11426
11422
  }
11427
11423
  }
11424
+ else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
11425
+ const { typeCondition: { name: { value: apiName }, }, } = parentNode;
11426
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11427
+ }
11428
11428
  return [
11429
11429
  ...rootQueryIdField,
11430
11430
  ...flat(parentRelaltionships),
@@ -12743,6 +12743,21 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
12743
12743
  }
12744
12744
  return fields;
12745
12745
  }
12746
+ getRedirectMappings(action) {
12747
+ if (action.data.method === 'post' && action.response.status === 204) {
12748
+ return undefined;
12749
+ }
12750
+ return super.getRedirectMappings(action);
12751
+ }
12752
+ async handleActionCompleted(completedAction, queueOperations, allHandlers) {
12753
+ if (completedAction.response.status === 204 && completedAction.data.method === 'post') {
12754
+ // if we get a 204 it means the record creation was successful but we don't have the record to ingest
12755
+ // remove the synthesized draft and do not try to ingest the response
12756
+ await this.evictKey(completedAction.tag);
12757
+ return;
12758
+ }
12759
+ return super.handleActionCompleted(completedAction, queueOperations, allHandlers);
12760
+ }
12746
12761
  async fetchReferenceRecord(referenceFields) {
12747
12762
  const promises = referenceFields.map(async (referenceFieldInfo) => {
12748
12763
  const apiName = await this.identifyApiName(referenceFieldInfo.id, referenceFieldInfo.field);
@@ -13109,6 +13124,9 @@ function normalizeRecordFields(key, entry) {
13109
13124
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
13110
13125
  * scalar fields and persisting link metadata to transform back into a normalized representation
13111
13126
  *
13127
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
13128
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
13129
+ *
13112
13130
  * @param normalizedRecord Record containing normalized field links
13113
13131
  * @param recordStore a store containing referenced record fields
13114
13132
  */
@@ -13123,7 +13141,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
13123
13141
  // pending fields get filtered out of the durable store
13124
13142
  const { pending } = field;
13125
13143
  if (pending === true) {
13126
- continue;
13144
+ // do not write records with pending fields to the durable store
13145
+ // there should be a refresh operation outbound that will bring in the updated record
13146
+ return undefined;
13127
13147
  }
13128
13148
  const { __ref } = field;
13129
13149
  if (__ref !== undefined) {
@@ -13289,10 +13309,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
13289
13309
  };
13290
13310
  }
13291
13311
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
13292
- putEntries[recordKey] = {
13293
- data: denormalizedRecord,
13294
- metadata,
13295
- };
13312
+ if (denormalizedRecord !== undefined) {
13313
+ putEntries[recordKey] = {
13314
+ data: denormalizedRecord,
13315
+ metadata,
13316
+ };
13317
+ }
13296
13318
  }
13297
13319
  else {
13298
13320
  putEntries[key] = value;
@@ -16486,11 +16508,17 @@ class NimbusSqliteStore {
16486
16508
  return this.getTable(segment).getAll(segment);
16487
16509
  }
16488
16510
  setEntries(entries, segment) {
16511
+ if (keys(entries).length === 0) {
16512
+ return Promise.resolve();
16513
+ }
16489
16514
  const table = this.getTable(segment);
16490
16515
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
16491
16516
  return this.batchOperationAsPromise([upsertOperation]);
16492
16517
  }
16493
16518
  setMetadata(entries, segment) {
16519
+ if (keys(entries).length === 0) {
16520
+ return Promise.resolve();
16521
+ }
16494
16522
  const table = this.getTable(segment);
16495
16523
  let operation;
16496
16524
  if (this.supportsBatchUpdates) {
@@ -16507,32 +16535,41 @@ class NimbusSqliteStore {
16507
16535
  batchOperations(operations) {
16508
16536
  const sqliteOperations = operations.reduce((acc, cur) => {
16509
16537
  if (cur.type === 'setEntries') {
16510
- const table = this.getTable(cur.segment);
16511
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
16538
+ if (keys(cur.entries).length > 0) {
16539
+ const table = this.getTable(cur.segment);
16540
+ acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
16541
+ }
16512
16542
  }
16513
16543
  else if (cur.type === 'setMetadata') {
16514
- const table = this.getTable(cur.segment);
16515
- if (this.supportsBatchUpdates) {
16516
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16517
- }
16518
- else {
16519
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16520
- // manually set the context type on the upsert so notifications do not notify rebuilds without
16521
- // plugin updates
16522
- upsert.context.type = 'setMetadata';
16523
- acc.push(upsert);
16544
+ if (keys(cur.entries).length > 0) {
16545
+ const table = this.getTable(cur.segment);
16546
+ if (this.supportsBatchUpdates) {
16547
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16548
+ }
16549
+ else {
16550
+ const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16551
+ // manually set the context type on the upsert so notifications do not notify rebuilds without
16552
+ // plugin updates
16553
+ upsert.context.type = 'setMetadata';
16554
+ acc.push(upsert);
16555
+ }
16524
16556
  }
16525
16557
  }
16526
16558
  else {
16527
- acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16559
+ if (cur.ids.length > 0) {
16560
+ acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16561
+ }
16528
16562
  }
16529
16563
  return acc;
16530
16564
  }, []);
16531
- return this.batchOperationAsPromise(sqliteOperations);
16565
+ return sqliteOperations.length === 0
16566
+ ? Promise.resolve()
16567
+ : this.batchOperationAsPromise(sqliteOperations);
16532
16568
  }
16533
16569
  evictEntries(entryIds, segment) {
16534
- const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
16535
- return this.batchOperationAsPromise([sqliteOperation]);
16570
+ return entryIds.length === 0
16571
+ ? Promise.resolve()
16572
+ : this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
16536
16573
  }
16537
16574
  registerOnChangedListener(listener) {
16538
16575
  let unsubscribeId = undefined;
@@ -16868,17 +16905,6 @@ const NimbusBinaryStore = {
16868
16905
  },
16869
16906
  };
16870
16907
 
16871
- function setupInspection(luvio) {
16872
- if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
16873
- // when inspection is enabled, make luvio available as a global
16874
- // eslint-disable-next-line no-undef
16875
- globalThis.luvio = luvio;
16876
- registerReportObserver((report) => {
16877
- __nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
16878
- });
16879
- }
16880
- }
16881
-
16882
16908
  /**
16883
16909
  * Copyright (c) 2022, Salesforce, Inc.,
16884
16910
  * All rights reserved.
@@ -18002,6 +18028,21 @@ function primingSessionFactory(config) {
18002
18028
  return instrumentPrimingSession(session);
18003
18029
  }
18004
18030
 
18031
+ // so eslint doesn't complain about nimbus
18032
+ /* global __nimbus */
18033
+ function setupObserver() {
18034
+ if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
18035
+ registerReportObserver((report) => {
18036
+ __nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
18037
+ name: report.adapterName,
18038
+ serializedConfig: stringify$1(report.config),
18039
+ status: report.result,
18040
+ duration: report.executionTime,
18041
+ });
18042
+ });
18043
+ }
18044
+ }
18045
+
18005
18046
  // so eslint doesn't complain about nimbus
18006
18047
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
18007
18048
  /* global __nimbus */
@@ -18096,8 +18137,8 @@ function getRuntime() {
18096
18137
  lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
18097
18138
  // Currently instruments store runtime perf
18098
18139
  setupMobileInstrumentation(lazyLuvio, store);
18099
- // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
18100
- setupInspection(lazyLuvio);
18140
+ // If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
18141
+ setupObserver();
18101
18142
  // set storeEval function for lds-adapters-graghql to use
18102
18143
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
18103
18144
  const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
@@ -18170,4 +18211,4 @@ register({
18170
18211
  });
18171
18212
 
18172
18213
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18173
- // version: 1.283.0-a330da944
18214
+ // version: 1.285.0-67d4d6869
@@ -0,0 +1 @@
1
+ export declare function setupObserver(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.283.0",
3
+ "version": "1.285.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.283.0",
36
- "@salesforce/lds-bindings": "^1.283.0",
37
- "@salesforce/lds-instrumentation": "^1.283.0",
38
- "@salesforce/lds-priming": "^1.283.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.285.0",
36
+ "@salesforce/lds-bindings": "^1.285.0",
37
+ "@salesforce/lds-instrumentation": "^1.285.0",
38
+ "@salesforce/lds-priming": "^1.285.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.283.0",
44
- "@salesforce/lds-drafts": "^1.283.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.283.0",
46
- "@salesforce/lds-graphql-eval": "^1.283.0",
47
- "@salesforce/lds-network-adapter": "^1.283.0",
48
- "@salesforce/lds-network-nimbus": "^1.283.0",
49
- "@salesforce/lds-store-binary": "^1.283.0",
50
- "@salesforce/lds-store-nimbus": "^1.283.0",
51
- "@salesforce/lds-store-sql": "^1.283.0",
52
- "@salesforce/lds-utils-adapters": "^1.283.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.283.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.285.0",
44
+ "@salesforce/lds-drafts": "^1.285.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.285.0",
46
+ "@salesforce/lds-graphql-eval": "^1.285.0",
47
+ "@salesforce/lds-network-adapter": "^1.285.0",
48
+ "@salesforce/lds-network-nimbus": "^1.285.0",
49
+ "@salesforce/lds-store-binary": "^1.285.0",
50
+ "@salesforce/lds-store-nimbus": "^1.285.0",
51
+ "@salesforce/lds-store-sql": "^1.285.0",
52
+ "@salesforce/lds-utils-adapters": "^1.285.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.285.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
@@ -59,7 +59,7 @@
59
59
  "path": "./dist/main.js",
60
60
  "maxSize": {
61
61
  "none": "800 kB",
62
- "min": "322 kB",
62
+ "min": "322.2 kB",
63
63
  "compressed": "150 kB"
64
64
  }
65
65
  },
@@ -67,7 +67,7 @@
67
67
  "path": "./sfdc/main.js",
68
68
  "maxSize": {
69
69
  "none": "800 kB",
70
- "min": "322 kB",
70
+ "min": "322.2 kB",
71
71
  "compressed": "150 kB"
72
72
  }
73
73
  }
package/sfdc/main.js CHANGED
@@ -5514,10 +5514,6 @@ class DurableDraftQueue {
5514
5514
  switch (result) {
5515
5515
  case ProcessActionResult.BLOCKED_ON_ERROR:
5516
5516
  this.state = DraftQueueState.Error;
5517
- await this.notifyChangedListeners({
5518
- type: DraftQueueEventType.QueueStateChanged,
5519
- state: this.state,
5520
- });
5521
5517
  return Promise.reject();
5522
5518
  default:
5523
5519
  return Promise.resolve();
@@ -5663,6 +5659,10 @@ class DurableDraftQueue {
5663
5659
  if (status === DraftActionStatus.Error) {
5664
5660
  this.state = DraftQueueState.Error;
5665
5661
  this.processingAction = undefined;
5662
+ this.notifyChangedListeners({
5663
+ type: DraftQueueEventType.ActionFailed,
5664
+ action: action,
5665
+ });
5666
5666
  return ProcessActionResult.BLOCKED_ON_ERROR;
5667
5667
  }
5668
5668
  if (id === this.uploadingActionId) {
@@ -11325,7 +11325,7 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
11325
11325
  * @param objectInfos
11326
11326
  * @returns
11327
11327
  */
11328
- function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11328
+ function injectFieldsForDisplayValue(topNode, apiName, objectInfos) {
11329
11329
  const { selectionSet } = topNode;
11330
11330
  if (selectionSet === undefined)
11331
11331
  return [];
@@ -11339,13 +11339,8 @@ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
11339
11339
  displayValue = node;
11340
11340
  break;
11341
11341
  }
11342
- if (isInlineFragmentNode(node)) {
11343
- const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
11344
- displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
11345
- }
11346
11342
  }
11347
11343
  if (displayValue !== undefined) {
11348
- const apiName = parentNode.name.value;
11349
11344
  const objectInfo = objectInfos[apiName];
11350
11345
  if (objectInfo !== undefined &&
11351
11346
  objectInfo.nameFields !== undefined &&
@@ -11412,19 +11407,24 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
11412
11407
  // example: TimeSheetId { value }
11413
11408
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
11414
11409
  }
11415
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
11416
- ...parent,
11417
- name: {
11418
- ...parent.name,
11419
- value: targetRelationship.childObjectApiName,
11420
- },
11421
- }, objectInfos));
11410
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
11422
11411
  }
11423
11412
  }
11424
11413
  }
11425
- displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
11414
+ else {
11415
+ let apiName = parent.name.value;
11416
+ if (pathToObjectApiNamesMap[parentPath] !== undefined &&
11417
+ pathToObjectApiNamesMap[parentPath].length === 1) {
11418
+ apiName = pathToObjectApiNamesMap[parentPath][0];
11419
+ }
11420
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11421
+ }
11426
11422
  }
11427
11423
  }
11424
+ else if (isInlineFragmentNode(parentNode) && parentNode.typeCondition !== undefined) {
11425
+ const { typeCondition: { name: { value: apiName }, }, } = parentNode;
11426
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, apiName, objectInfos));
11427
+ }
11428
11428
  return [
11429
11429
  ...rootQueryIdField,
11430
11430
  ...flat(parentRelaltionships),
@@ -12743,6 +12743,21 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
12743
12743
  }
12744
12744
  return fields;
12745
12745
  }
12746
+ getRedirectMappings(action) {
12747
+ if (action.data.method === 'post' && action.response.status === 204) {
12748
+ return undefined;
12749
+ }
12750
+ return super.getRedirectMappings(action);
12751
+ }
12752
+ async handleActionCompleted(completedAction, queueOperations, allHandlers) {
12753
+ if (completedAction.response.status === 204 && completedAction.data.method === 'post') {
12754
+ // if we get a 204 it means the record creation was successful but we don't have the record to ingest
12755
+ // remove the synthesized draft and do not try to ingest the response
12756
+ await this.evictKey(completedAction.tag);
12757
+ return;
12758
+ }
12759
+ return super.handleActionCompleted(completedAction, queueOperations, allHandlers);
12760
+ }
12746
12761
  async fetchReferenceRecord(referenceFields) {
12747
12762
  const promises = referenceFields.map(async (referenceFieldInfo) => {
12748
12763
  const apiName = await this.identifyApiName(referenceFieldInfo.id, referenceFieldInfo.field);
@@ -13109,6 +13124,9 @@ function normalizeRecordFields(key, entry) {
13109
13124
  * Transforms a record for storage in the durable store. The transformation involves denormalizing
13110
13125
  * scalar fields and persisting link metadata to transform back into a normalized representation
13111
13126
  *
13127
+ * If the record contains pending fields this will return undefined as pending records do not get persisted
13128
+ * to the durable store. There should be a refresh operation outbound that will bring in the updated record.
13129
+ *
13112
13130
  * @param normalizedRecord Record containing normalized field links
13113
13131
  * @param recordStore a store containing referenced record fields
13114
13132
  */
@@ -13123,7 +13141,9 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
13123
13141
  // pending fields get filtered out of the durable store
13124
13142
  const { pending } = field;
13125
13143
  if (pending === true) {
13126
- continue;
13144
+ // do not write records with pending fields to the durable store
13145
+ // there should be a refresh operation outbound that will bring in the updated record
13146
+ return undefined;
13127
13147
  }
13128
13148
  const { __ref } = field;
13129
13149
  if (__ref !== undefined) {
@@ -13289,10 +13309,12 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
13289
13309
  };
13290
13310
  }
13291
13311
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
13292
- putEntries[recordKey] = {
13293
- data: denormalizedRecord,
13294
- metadata,
13295
- };
13312
+ if (denormalizedRecord !== undefined) {
13313
+ putEntries[recordKey] = {
13314
+ data: denormalizedRecord,
13315
+ metadata,
13316
+ };
13317
+ }
13296
13318
  }
13297
13319
  else {
13298
13320
  putEntries[key] = value;
@@ -16486,11 +16508,17 @@ class NimbusSqliteStore {
16486
16508
  return this.getTable(segment).getAll(segment);
16487
16509
  }
16488
16510
  setEntries(entries, segment) {
16511
+ if (keys(entries).length === 0) {
16512
+ return Promise.resolve();
16513
+ }
16489
16514
  const table = this.getTable(segment);
16490
16515
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
16491
16516
  return this.batchOperationAsPromise([upsertOperation]);
16492
16517
  }
16493
16518
  setMetadata(entries, segment) {
16519
+ if (keys(entries).length === 0) {
16520
+ return Promise.resolve();
16521
+ }
16494
16522
  const table = this.getTable(segment);
16495
16523
  let operation;
16496
16524
  if (this.supportsBatchUpdates) {
@@ -16507,32 +16535,41 @@ class NimbusSqliteStore {
16507
16535
  batchOperations(operations) {
16508
16536
  const sqliteOperations = operations.reduce((acc, cur) => {
16509
16537
  if (cur.type === 'setEntries') {
16510
- const table = this.getTable(cur.segment);
16511
- acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
16538
+ if (keys(cur.entries).length > 0) {
16539
+ const table = this.getTable(cur.segment);
16540
+ acc.push(table.entriesToUpsertOperations(cur.entries, cur.segment));
16541
+ }
16512
16542
  }
16513
16543
  else if (cur.type === 'setMetadata') {
16514
- const table = this.getTable(cur.segment);
16515
- if (this.supportsBatchUpdates) {
16516
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16517
- }
16518
- else {
16519
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16520
- // manually set the context type on the upsert so notifications do not notify rebuilds without
16521
- // plugin updates
16522
- upsert.context.type = 'setMetadata';
16523
- acc.push(upsert);
16544
+ if (keys(cur.entries).length > 0) {
16545
+ const table = this.getTable(cur.segment);
16546
+ if (this.supportsBatchUpdates) {
16547
+ acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16548
+ }
16549
+ else {
16550
+ const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16551
+ // manually set the context type on the upsert so notifications do not notify rebuilds without
16552
+ // plugin updates
16553
+ upsert.context.type = 'setMetadata';
16554
+ acc.push(upsert);
16555
+ }
16524
16556
  }
16525
16557
  }
16526
16558
  else {
16527
- acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16559
+ if (cur.ids.length > 0) {
16560
+ acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16561
+ }
16528
16562
  }
16529
16563
  return acc;
16530
16564
  }, []);
16531
- return this.batchOperationAsPromise(sqliteOperations);
16565
+ return sqliteOperations.length === 0
16566
+ ? Promise.resolve()
16567
+ : this.batchOperationAsPromise(sqliteOperations);
16532
16568
  }
16533
16569
  evictEntries(entryIds, segment) {
16534
- const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
16535
- return this.batchOperationAsPromise([sqliteOperation]);
16570
+ return entryIds.length === 0
16571
+ ? Promise.resolve()
16572
+ : this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
16536
16573
  }
16537
16574
  registerOnChangedListener(listener) {
16538
16575
  let unsubscribeId = undefined;
@@ -16868,17 +16905,6 @@ const NimbusBinaryStore = {
16868
16905
  },
16869
16906
  };
16870
16907
 
16871
- function setupInspection(luvio) {
16872
- if (__nimbus.plugins.LdsInspectorPlugin !== undefined) {
16873
- // when inspection is enabled, make luvio available as a global
16874
- // eslint-disable-next-line no-undef
16875
- globalThis.luvio = luvio;
16876
- registerReportObserver((report) => {
16877
- __nimbus.plugins.LdsInspectorPlugin.sendAdapterReport(stringify$1(report));
16878
- });
16879
- }
16880
- }
16881
-
16882
16908
  /**
16883
16909
  * Copyright (c) 2022, Salesforce, Inc.,
16884
16910
  * All rights reserved.
@@ -18002,6 +18028,21 @@ function primingSessionFactory(config) {
18002
18028
  return instrumentPrimingSession(session);
18003
18029
  }
18004
18030
 
18031
+ // so eslint doesn't complain about nimbus
18032
+ /* global __nimbus */
18033
+ function setupObserver() {
18034
+ if (__nimbus.plugins.LdsObserverPlugin !== undefined) {
18035
+ registerReportObserver((report) => {
18036
+ __nimbus.plugins.LdsObserverPlugin.logAdapterExecution({
18037
+ name: report.adapterName,
18038
+ serializedConfig: stringify$1(report.config),
18039
+ status: report.result,
18040
+ duration: report.executionTime,
18041
+ });
18042
+ });
18043
+ }
18044
+ }
18045
+
18005
18046
  // so eslint doesn't complain about nimbus
18006
18047
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
18007
18048
  /* global __nimbus */
@@ -18096,8 +18137,8 @@ function getRuntime() {
18096
18137
  lazyGetRecords = getRecordsAdapterFactory(lazyLuvio);
18097
18138
  // Currently instruments store runtime perf
18098
18139
  setupMobileInstrumentation(lazyLuvio, store);
18099
- // If the inspection nimbus plugin is configured, inspection is enabled otherwise this is a no-op
18100
- setupInspection(lazyLuvio);
18140
+ // If the observer nimbus plugin is configured, observation is enabled otherwise this is a no-op
18141
+ setupObserver();
18101
18142
  // set storeEval function for lds-adapters-graghql to use
18102
18143
  withRegistration('@salesforce/lds-adapters-graphql', (registration) => {
18103
18144
  const { configuration: { setStoreEval, setDraftFunctions }, } = registration;
@@ -18170,4 +18211,4 @@ register({
18170
18211
  });
18171
18212
 
18172
18213
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18173
- // version: 1.283.0-a330da944
18214
+ // version: 1.285.0-67d4d6869
@@ -0,0 +1 @@
1
+ export declare function setupObserver(): void;
@@ -1,2 +0,0 @@
1
- import type { Luvio } from '@luvio/engine';
2
- export declare function setupInspection(luvio: Luvio): void;
@@ -1,2 +0,0 @@
1
- import type { Luvio } from '@luvio/engine';
2
- export declare function setupInspection(luvio: Luvio): void;