@salesforce/lds-runtime-mobile 1.327.0 → 1.328.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
@@ -2126,6 +2126,12 @@ class DurableDraftQueue {
2126
2126
  draftCount: this.draftStore.getCount(),
2127
2127
  });
2128
2128
  }
2129
+ stopQueueWhileRunning(action) {
2130
+ this.stopQueueManually(true);
2131
+ return action().finally(() => {
2132
+ this.startQueueSafe();
2133
+ });
2134
+ }
2129
2135
  /**
2130
2136
  * Used to stop the queue within DraftQueue without user interaction
2131
2137
  */
@@ -2910,6 +2916,14 @@ class DraftManager {
2910
2916
  stopQueue() {
2911
2917
  return this.draftQueue.stopQueue();
2912
2918
  }
2919
+ /**
2920
+ * Stops the draft queue manually without notifying the user and then runs the passed action.
2921
+ * After the action is completed it will safely start the queue if the user had set it to be
2922
+ * started.
2923
+ */
2924
+ stopQueueWhileRunning(action) {
2925
+ return this.draftQueue.stopQueueWhileRunning(action);
2926
+ }
2913
2927
  /**
2914
2928
  * Subscribes the listener to changes to the draft queue.
2915
2929
  *
@@ -49291,18 +49305,6 @@ function createSeenRecords(ids, currentSnapshot) {
49291
49305
  }
49292
49306
  return seenRecords;
49293
49307
  }
49294
- function createErrorSnapshot(result, snapshot) {
49295
- return {
49296
- ...snapshot,
49297
- data: undefined,
49298
- state: 'Error',
49299
- error: {
49300
- body: {
49301
- message: result.errors,
49302
- },
49303
- },
49304
- };
49305
- }
49306
49308
  function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
49307
49309
  return {
49308
49310
  refresh,
@@ -49820,7 +49822,18 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
49820
49822
  // currently by design if there are any graphql errors we return an ErrorSnapshot
49821
49823
  // partial results are not supported at this time
49822
49824
  if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
49823
- return createErrorSnapshot(gqlResult, nonEvaluatedSnapshot);
49825
+ const errors = gqlResult.errors || [];
49826
+ let responseErrors = errors.map((e) => {
49827
+ return { message: e instanceof Error ? e.message : String(e) };
49828
+ });
49829
+ return {
49830
+ data: undefined,
49831
+ state: 'Error',
49832
+ error: {
49833
+ errorType: 'adapterError',
49834
+ error: responseErrors,
49835
+ },
49836
+ };
49824
49837
  }
49825
49838
  // if the non-eval'ed snapshot was an error then we return a synthetic
49826
49839
  // Fulfilled snapshot (this only happens in this code path if
@@ -50996,6 +51009,9 @@ class NimbusDraftQueue {
50996
51009
  stopQueue() {
50997
51010
  return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
50998
51011
  }
51012
+ stopQueueWhileRunning(_action) {
51013
+ return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
51014
+ }
50999
51015
  replaceAction(_actionId, _withActionId) {
51000
51016
  return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
51001
51017
  }
@@ -55297,4 +55313,4 @@ register({
55297
55313
  });
55298
55314
 
55299
55315
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55300
- // version: 1.327.0-8614d511e1
55316
+ // version: 1.328.0-f3d79bc783
@@ -16,6 +16,7 @@ export declare class NimbusDraftQueue implements DraftQueue {
16
16
  removeDraftAction(_actionId: string): Promise<void>;
17
17
  startQueue(): Promise<void>;
18
18
  stopQueue(): Promise<void>;
19
+ stopQueueWhileRunning(_action: () => Promise<void>): Promise<void>;
19
20
  replaceAction<Data, Response>(_actionId: string, _withActionId: string): Promise<DraftAction<Data, Response>>;
20
21
  mergeActions<Data, Response>(_targetActionId: string, _sourceActionId: string): Promise<DraftAction<Data, Response>>;
21
22
  retryAction<Data, Response>(_actionId: string): Promise<DraftAction<Data, Response>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.327.0",
3
+ "version": "1.328.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,23 +32,23 @@
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.327.0",
36
- "@salesforce/lds-bindings": "^1.327.0",
37
- "@salesforce/lds-instrumentation": "^1.327.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.328.0",
36
+ "@salesforce/lds-bindings": "^1.328.0",
37
+ "@salesforce/lds-instrumentation": "^1.328.0",
38
38
  "@salesforce/user": "0.0.21",
39
39
  "o11y": "250.7.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@salesforce/lds-adapters-graphql": "^1.327.0",
43
- "@salesforce/lds-drafts": "^1.327.0",
44
- "@salesforce/lds-durable-records": "^1.327.0",
45
- "@salesforce/lds-network-adapter": "^1.327.0",
46
- "@salesforce/lds-network-nimbus": "^1.327.0",
47
- "@salesforce/lds-store-binary": "^1.327.0",
48
- "@salesforce/lds-store-nimbus": "^1.327.0",
49
- "@salesforce/lds-store-sql": "^1.327.0",
50
- "@salesforce/lds-utils-adapters": "^1.327.0",
51
- "@salesforce/nimbus-plugin-lds": "^1.327.0",
42
+ "@salesforce/lds-adapters-graphql": "^1.328.0",
43
+ "@salesforce/lds-drafts": "^1.328.0",
44
+ "@salesforce/lds-durable-records": "^1.328.0",
45
+ "@salesforce/lds-network-adapter": "^1.328.0",
46
+ "@salesforce/lds-network-nimbus": "^1.328.0",
47
+ "@salesforce/lds-store-binary": "^1.328.0",
48
+ "@salesforce/lds-store-nimbus": "^1.328.0",
49
+ "@salesforce/lds-store-sql": "^1.328.0",
50
+ "@salesforce/lds-utils-adapters": "^1.328.0",
51
+ "@salesforce/nimbus-plugin-lds": "^1.328.0",
52
52
  "babel-plugin-dynamic-import-node": "^2.3.3",
53
53
  "wait-for-expect": "^3.0.2"
54
54
  },
package/sfdc/main.js CHANGED
@@ -2126,6 +2126,12 @@ class DurableDraftQueue {
2126
2126
  draftCount: this.draftStore.getCount(),
2127
2127
  });
2128
2128
  }
2129
+ stopQueueWhileRunning(action) {
2130
+ this.stopQueueManually(true);
2131
+ return action().finally(() => {
2132
+ this.startQueueSafe();
2133
+ });
2134
+ }
2129
2135
  /**
2130
2136
  * Used to stop the queue within DraftQueue without user interaction
2131
2137
  */
@@ -2910,6 +2916,14 @@ class DraftManager {
2910
2916
  stopQueue() {
2911
2917
  return this.draftQueue.stopQueue();
2912
2918
  }
2919
+ /**
2920
+ * Stops the draft queue manually without notifying the user and then runs the passed action.
2921
+ * After the action is completed it will safely start the queue if the user had set it to be
2922
+ * started.
2923
+ */
2924
+ stopQueueWhileRunning(action) {
2925
+ return this.draftQueue.stopQueueWhileRunning(action);
2926
+ }
2913
2927
  /**
2914
2928
  * Subscribes the listener to changes to the draft queue.
2915
2929
  *
@@ -49291,18 +49305,6 @@ function createSeenRecords(ids, currentSnapshot) {
49291
49305
  }
49292
49306
  return seenRecords;
49293
49307
  }
49294
- function createErrorSnapshot(result, snapshot) {
49295
- return {
49296
- ...snapshot,
49297
- data: undefined,
49298
- state: 'Error',
49299
- error: {
49300
- body: {
49301
- message: result.errors,
49302
- },
49303
- },
49304
- };
49305
- }
49306
49308
  function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
49307
49309
  return {
49308
49310
  refresh,
@@ -49820,7 +49822,18 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
49820
49822
  // currently by design if there are any graphql errors we return an ErrorSnapshot
49821
49823
  // partial results are not supported at this time
49822
49824
  if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
49823
- return createErrorSnapshot(gqlResult, nonEvaluatedSnapshot);
49825
+ const errors = gqlResult.errors || [];
49826
+ let responseErrors = errors.map((e) => {
49827
+ return { message: e instanceof Error ? e.message : String(e) };
49828
+ });
49829
+ return {
49830
+ data: undefined,
49831
+ state: 'Error',
49832
+ error: {
49833
+ errorType: 'adapterError',
49834
+ error: responseErrors,
49835
+ },
49836
+ };
49824
49837
  }
49825
49838
  // if the non-eval'ed snapshot was an error then we return a synthetic
49826
49839
  // Fulfilled snapshot (this only happens in this code path if
@@ -50996,6 +51009,9 @@ class NimbusDraftQueue {
50996
51009
  stopQueue() {
50997
51010
  return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
50998
51011
  }
51012
+ stopQueueWhileRunning(_action) {
51013
+ return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
51014
+ }
50999
51015
  replaceAction(_actionId, _withActionId) {
51000
51016
  return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
51001
51017
  }
@@ -55297,4 +55313,4 @@ register({
55297
55313
  });
55298
55314
 
55299
55315
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
55300
- // version: 1.327.0-8614d511e1
55316
+ // version: 1.328.0-f3d79bc783
@@ -16,6 +16,7 @@ export declare class NimbusDraftQueue implements DraftQueue {
16
16
  removeDraftAction(_actionId: string): Promise<void>;
17
17
  startQueue(): Promise<void>;
18
18
  stopQueue(): Promise<void>;
19
+ stopQueueWhileRunning(_action: () => Promise<void>): Promise<void>;
19
20
  replaceAction<Data, Response>(_actionId: string, _withActionId: string): Promise<DraftAction<Data, Response>>;
20
21
  mergeActions<Data, Response>(_targetActionId: string, _sourceActionId: string): Promise<DraftAction<Data, Response>>;
21
22
  retryAction<Data, Response>(_actionId: string): Promise<DraftAction<Data, Response>>;