@salesforce/lds-drafts 1.309.0-dev18 → 1.309.0-dev20

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/ldsDrafts.js CHANGED
@@ -542,6 +542,12 @@ class DurableDraftQueue {
542
542
  state: DraftQueueState.Stopped,
543
543
  });
544
544
  }
545
+ stopQueueWhileRunning(action) {
546
+ this.stopQueueManually();
547
+ return action().finally(() => {
548
+ this.startQueueSafe();
549
+ });
550
+ }
545
551
  /**
546
552
  * Used to stop the queue within DraftQueue without user interaction
547
553
  */
@@ -1785,6 +1791,14 @@ class DraftManager {
1785
1791
  stopQueue() {
1786
1792
  return this.draftQueue.stopQueue();
1787
1793
  }
1794
+ /**
1795
+ * Stops the draft queue manually without notifying the user and then runs the passed action.
1796
+ * After the action is completed it will safely start the queue if the user had set it to be
1797
+ * started.
1798
+ */
1799
+ stopQueueWhileRunning(action) {
1800
+ return this.draftQueue.stopQueueWhileRunning(action);
1801
+ }
1788
1802
  /**
1789
1803
  * Subscribes the listener to changes to the draft queue.
1790
1804
  *
@@ -118,6 +118,12 @@ export declare class DraftManager {
118
118
  * in progress items are finished.
119
119
  */
120
120
  stopQueue(): Promise<void>;
121
+ /**
122
+ * Stops the draft queue manually without notifying the user and then runs the passed action.
123
+ * After the action is completed it will safely start the queue if the user had set it to be
124
+ * started.
125
+ */
126
+ stopQueueWhileRunning(action: () => Promise<void>): Promise<void>;
121
127
  /**
122
128
  * Subscribes the listener to changes to the draft queue.
123
129
  *
@@ -247,6 +247,12 @@ export interface DraftQueue {
247
247
  startQueue(): Promise<void>;
248
248
  /** Set the draft queue state to Stopped and don't let another item begin */
249
249
  stopQueue(): Promise<void>;
250
+ /**
251
+ * Perform an action the queue is stopped.
252
+ * It then starts the queue back up again if the user had it on.
253
+ * @param action
254
+ */
255
+ stopQueueWhileRunning(action: () => Promise<void>): Promise<void>;
250
256
  /**
251
257
  * Sets the metadata object of the specified action to the
252
258
  * provided metadata
@@ -26,6 +26,7 @@ export declare class DurableDraftQueue implements DraftQueue {
26
26
  getQueueState(): DraftQueueState;
27
27
  startQueue(): Promise<void>;
28
28
  stopQueue(): Promise<void>;
29
+ stopQueueWhileRunning(action: () => Promise<void>): Promise<void>;
29
30
  /**
30
31
  * Used to stop the queue within DraftQueue without user interaction
31
32
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-drafts",
3
- "version": "1.309.0-dev18",
3
+ "version": "1.309.0-dev20",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS Drafts",
6
6
  "main": "dist/ldsDrafts.js",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@luvio/engine": "0.156.4-dev2",
28
28
  "@luvio/environments": "0.156.4-dev2",
29
- "@salesforce/lds-utils-adapters": "^1.309.0-dev18"
29
+ "@salesforce/lds-utils-adapters": "^1.309.0-dev20"
30
30
  },
31
31
  "volta": {
32
32
  "extends": "../../package.json"