@salesforce/lds-runtime-mobile 1.284.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.
Files changed (3) hide show
  1. package/dist/main.js +51 -21
  2. package/package.json +18 -18
  3. package/sfdc/main.js +51 -21
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) {
@@ -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);
@@ -16493,11 +16508,17 @@ class NimbusSqliteStore {
16493
16508
  return this.getTable(segment).getAll(segment);
16494
16509
  }
16495
16510
  setEntries(entries, segment) {
16511
+ if (keys(entries).length === 0) {
16512
+ return Promise.resolve();
16513
+ }
16496
16514
  const table = this.getTable(segment);
16497
16515
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
16498
16516
  return this.batchOperationAsPromise([upsertOperation]);
16499
16517
  }
16500
16518
  setMetadata(entries, segment) {
16519
+ if (keys(entries).length === 0) {
16520
+ return Promise.resolve();
16521
+ }
16501
16522
  const table = this.getTable(segment);
16502
16523
  let operation;
16503
16524
  if (this.supportsBatchUpdates) {
@@ -16514,32 +16535,41 @@ class NimbusSqliteStore {
16514
16535
  batchOperations(operations) {
16515
16536
  const sqliteOperations = operations.reduce((acc, cur) => {
16516
16537
  if (cur.type === 'setEntries') {
16517
- const table = this.getTable(cur.segment);
16518
- 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
+ }
16519
16542
  }
16520
16543
  else if (cur.type === 'setMetadata') {
16521
- const table = this.getTable(cur.segment);
16522
- if (this.supportsBatchUpdates) {
16523
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16524
- }
16525
- else {
16526
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16527
- // manually set the context type on the upsert so notifications do not notify rebuilds without
16528
- // plugin updates
16529
- upsert.context.type = 'setMetadata';
16530
- 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
+ }
16531
16556
  }
16532
16557
  }
16533
16558
  else {
16534
- acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16559
+ if (cur.ids.length > 0) {
16560
+ acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16561
+ }
16535
16562
  }
16536
16563
  return acc;
16537
16564
  }, []);
16538
- return this.batchOperationAsPromise(sqliteOperations);
16565
+ return sqliteOperations.length === 0
16566
+ ? Promise.resolve()
16567
+ : this.batchOperationAsPromise(sqliteOperations);
16539
16568
  }
16540
16569
  evictEntries(entryIds, segment) {
16541
- const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
16542
- return this.batchOperationAsPromise([sqliteOperation]);
16570
+ return entryIds.length === 0
16571
+ ? Promise.resolve()
16572
+ : this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
16543
16573
  }
16544
16574
  registerOnChangedListener(listener) {
16545
16575
  let unsubscribeId = undefined;
@@ -18181,4 +18211,4 @@ register({
18181
18211
  });
18182
18212
 
18183
18213
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18184
- // version: 1.284.0-a7e8dc51c
18214
+ // version: 1.285.0-67d4d6869
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.284.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.284.0",
36
- "@salesforce/lds-bindings": "^1.284.0",
37
- "@salesforce/lds-instrumentation": "^1.284.0",
38
- "@salesforce/lds-priming": "^1.284.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.284.0",
44
- "@salesforce/lds-drafts": "^1.284.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.284.0",
46
- "@salesforce/lds-graphql-eval": "^1.284.0",
47
- "@salesforce/lds-network-adapter": "^1.284.0",
48
- "@salesforce/lds-network-nimbus": "^1.284.0",
49
- "@salesforce/lds-store-binary": "^1.284.0",
50
- "@salesforce/lds-store-nimbus": "^1.284.0",
51
- "@salesforce/lds-store-sql": "^1.284.0",
52
- "@salesforce/lds-utils-adapters": "^1.284.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.284.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) {
@@ -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);
@@ -16493,11 +16508,17 @@ class NimbusSqliteStore {
16493
16508
  return this.getTable(segment).getAll(segment);
16494
16509
  }
16495
16510
  setEntries(entries, segment) {
16511
+ if (keys(entries).length === 0) {
16512
+ return Promise.resolve();
16513
+ }
16496
16514
  const table = this.getTable(segment);
16497
16515
  const upsertOperation = table.entriesToUpsertOperations(entries, segment);
16498
16516
  return this.batchOperationAsPromise([upsertOperation]);
16499
16517
  }
16500
16518
  setMetadata(entries, segment) {
16519
+ if (keys(entries).length === 0) {
16520
+ return Promise.resolve();
16521
+ }
16501
16522
  const table = this.getTable(segment);
16502
16523
  let operation;
16503
16524
  if (this.supportsBatchUpdates) {
@@ -16514,32 +16535,41 @@ class NimbusSqliteStore {
16514
16535
  batchOperations(operations) {
16515
16536
  const sqliteOperations = operations.reduce((acc, cur) => {
16516
16537
  if (cur.type === 'setEntries') {
16517
- const table = this.getTable(cur.segment);
16518
- 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
+ }
16519
16542
  }
16520
16543
  else if (cur.type === 'setMetadata') {
16521
- const table = this.getTable(cur.segment);
16522
- if (this.supportsBatchUpdates) {
16523
- acc.push(table.metadataToUpdateOperations(cur.entries, cur.segment));
16524
- }
16525
- else {
16526
- const upsert = table.entriesToUpsertOperations(cur.entries, cur.segment);
16527
- // manually set the context type on the upsert so notifications do not notify rebuilds without
16528
- // plugin updates
16529
- upsert.context.type = 'setMetadata';
16530
- 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
+ }
16531
16556
  }
16532
16557
  }
16533
16558
  else {
16534
- acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16559
+ if (cur.ids.length > 0) {
16560
+ acc.push(this.idsToDeleteOperation(cur.ids, cur.segment));
16561
+ }
16535
16562
  }
16536
16563
  return acc;
16537
16564
  }, []);
16538
- return this.batchOperationAsPromise(sqliteOperations);
16565
+ return sqliteOperations.length === 0
16566
+ ? Promise.resolve()
16567
+ : this.batchOperationAsPromise(sqliteOperations);
16539
16568
  }
16540
16569
  evictEntries(entryIds, segment) {
16541
- const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
16542
- return this.batchOperationAsPromise([sqliteOperation]);
16570
+ return entryIds.length === 0
16571
+ ? Promise.resolve()
16572
+ : this.batchOperationAsPromise([this.idsToDeleteOperation(entryIds, segment)]);
16543
16573
  }
16544
16574
  registerOnChangedListener(listener) {
16545
16575
  let unsubscribeId = undefined;
@@ -18181,4 +18211,4 @@ register({
18181
18211
  });
18182
18212
 
18183
18213
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
18184
- // version: 1.284.0-a7e8dc51c
18214
+ // version: 1.285.0-67d4d6869