@salesforce/lds-drafts 1.304.0 → 1.306.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/ldsDrafts.js
CHANGED
|
@@ -793,6 +793,29 @@ class DurableDraftQueue {
|
|
|
793
793
|
mergeActions(targetActionId, sourceActionId) {
|
|
794
794
|
return this.replaceOrMergeActions(targetActionId, sourceActionId, true);
|
|
795
795
|
}
|
|
796
|
+
async retryAction(actionId) {
|
|
797
|
+
this.stopQueueManually();
|
|
798
|
+
const actions = await this.getQueueActions();
|
|
799
|
+
const target = actions[0];
|
|
800
|
+
if (!target || target.id !== actionId) {
|
|
801
|
+
throw Error(`Action ${actionId} not found at the head of the draft queue`);
|
|
802
|
+
}
|
|
803
|
+
if (!isDraftError(target)) {
|
|
804
|
+
throw Error(`Action ${actionId} is not in Error state`);
|
|
805
|
+
}
|
|
806
|
+
let pendingAction = {
|
|
807
|
+
...target,
|
|
808
|
+
status: DraftActionStatus.Pending,
|
|
809
|
+
error: undefined,
|
|
810
|
+
};
|
|
811
|
+
await this.draftStore.writeAction(pendingAction);
|
|
812
|
+
await this.notifyChangedListeners({
|
|
813
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
814
|
+
action: pendingAction,
|
|
815
|
+
});
|
|
816
|
+
await this.startQueueSafe();
|
|
817
|
+
return pendingAction;
|
|
818
|
+
}
|
|
796
819
|
async setMetadata(actionId, metadata) {
|
|
797
820
|
const keys$1 = keys(metadata);
|
|
798
821
|
const compatibleKeys = keys$1.filter((key) => {
|
|
@@ -1605,9 +1628,14 @@ var DraftQueueOperationType;
|
|
|
1605
1628
|
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
1606
1629
|
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
1607
1630
|
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
1631
|
+
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
1632
|
+
* Planned to be removed in 256 (W-16217436) */
|
|
1608
1633
|
DraftQueueOperationType["QueueStarted"] = "started";
|
|
1634
|
+
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
1635
|
+
* Planned to be removed in 256 (W-16217436) */
|
|
1609
1636
|
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
1610
|
-
|
|
1637
|
+
/** @since 252 */
|
|
1638
|
+
DraftQueueOperationType["QueueStateChanged"] = "queueStateChanged";
|
|
1611
1639
|
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
1612
1640
|
/**
|
|
1613
1641
|
* Converts the internal DraftAction's ResourceRequest into
|
|
@@ -1703,8 +1731,6 @@ class DraftManager {
|
|
|
1703
1731
|
return DraftQueueOperationType.QueueStarted;
|
|
1704
1732
|
case DraftQueueState.Stopped:
|
|
1705
1733
|
return DraftQueueOperationType.QueueStopped;
|
|
1706
|
-
case DraftQueueState.Waiting:
|
|
1707
|
-
return DraftQueueOperationType.QueueWaiting;
|
|
1708
1734
|
default:
|
|
1709
1735
|
throw Error('Unsupported event type');
|
|
1710
1736
|
}
|
|
@@ -1877,7 +1903,12 @@ class DraftManager {
|
|
|
1877
1903
|
const managerState = await this.getQueue();
|
|
1878
1904
|
let operationType, item;
|
|
1879
1905
|
if (isDraftQueueStateChangeEvent(event)) {
|
|
1880
|
-
|
|
1906
|
+
if (this.listenerVersion === undefined) {
|
|
1907
|
+
operationType = this.draftQueueStateToOperationType(event.state);
|
|
1908
|
+
}
|
|
1909
|
+
else {
|
|
1910
|
+
operationType = DraftQueueOperationType.QueueStateChanged;
|
|
1911
|
+
}
|
|
1881
1912
|
}
|
|
1882
1913
|
else {
|
|
1883
1914
|
const { action, type } = event;
|
|
@@ -1939,6 +1970,18 @@ class DraftManager {
|
|
|
1939
1970
|
return this.buildDraftQueueItem(updatedAction);
|
|
1940
1971
|
});
|
|
1941
1972
|
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Retries a draft action that is in error state without any modification.
|
|
1975
|
+
*
|
|
1976
|
+
* @param actionId The id of the draft action that should be retried
|
|
1977
|
+
* @throws If the draft action is not at the front of the draft queue or is not
|
|
1978
|
+
* in error state.
|
|
1979
|
+
*/
|
|
1980
|
+
async retryAction(actionId) {
|
|
1981
|
+
return this.draftQueue.retryAction(actionId).then((updatedAction) => {
|
|
1982
|
+
return this.buildDraftQueueItem(updatedAction);
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1942
1985
|
}
|
|
1943
1986
|
|
|
1944
1987
|
function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueue) {
|
|
@@ -72,9 +72,14 @@ export declare enum DraftQueueOperationType {
|
|
|
72
72
|
ItemCompleted = "completed",
|
|
73
73
|
ItemFailed = "failed",
|
|
74
74
|
ItemUpdated = "updated",
|
|
75
|
+
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
76
|
+
* Planned to be removed in 256 (W-16217436) */
|
|
75
77
|
QueueStarted = "started",
|
|
78
|
+
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
79
|
+
* Planned to be removed in 256 (W-16217436) */
|
|
76
80
|
QueueStopped = "stopped",
|
|
77
|
-
|
|
81
|
+
/** @since 252 */
|
|
82
|
+
QueueStateChanged = "queueStateChanged"
|
|
78
83
|
}
|
|
79
84
|
/**
|
|
80
85
|
* A closure that draft queue change listeners pass to
|
|
@@ -171,4 +176,12 @@ export declare class DraftManager {
|
|
|
171
176
|
* @param metadata The metadata to set on the specified action
|
|
172
177
|
*/
|
|
173
178
|
setMetadata(actionId: string, metadata: DraftQueueItemMetadata): Promise<DraftQueueItem>;
|
|
179
|
+
/**
|
|
180
|
+
* Retries a draft action that is in error state without any modification.
|
|
181
|
+
*
|
|
182
|
+
* @param actionId The id of the draft action that should be retried
|
|
183
|
+
* @throws If the draft action is not at the front of the draft queue or is not
|
|
184
|
+
* in error state.
|
|
185
|
+
*/
|
|
186
|
+
retryAction(actionId: string): Promise<DraftQueueItem>;
|
|
174
187
|
}
|
|
@@ -235,6 +235,14 @@ export interface DraftQueue {
|
|
|
235
235
|
* action will be removed after the merge.
|
|
236
236
|
*/
|
|
237
237
|
mergeActions<Data, Response>(targetActionId: string, sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
238
|
+
/**
|
|
239
|
+
* Retries a draft action that is in error state without any modification.
|
|
240
|
+
*
|
|
241
|
+
* @param actionId The id of the draft action that should be retried
|
|
242
|
+
* @throws If the draft action is not at the front of the draft queue or is not
|
|
243
|
+
* in error state.
|
|
244
|
+
*/
|
|
245
|
+
retryAction<Data, Response>(actionId: string): Promise<DraftAction<Data, Response>>;
|
|
238
246
|
/** Set the draft queue state to Started and process the next item */
|
|
239
247
|
startQueue(): Promise<void>;
|
|
240
248
|
/** Set the draft queue state to Stopped and don't let another item begin */
|
|
@@ -49,6 +49,7 @@ export declare class DurableDraftQueue implements DraftQueue {
|
|
|
49
49
|
private statusOfAction;
|
|
50
50
|
replaceAction<Data, Response>(targetActionId: string, sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
51
51
|
mergeActions<Data, Response>(targetActionId: string, sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
52
|
+
retryAction<Data, Response>(actionId: string): Promise<DraftAction<Data, Response>>;
|
|
52
53
|
setMetadata(actionId: string, metadata: DraftActionMetadata): Promise<DraftAction<unknown, unknown>>;
|
|
53
54
|
private scheduleRetryWithSpecifiedDelay;
|
|
54
55
|
private scheduleRetry;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-drafts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.306.0",
|
|
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.3",
|
|
28
28
|
"@luvio/environments": "0.156.3",
|
|
29
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
29
|
+
"@salesforce/lds-utils-adapters": "^1.306.0"
|
|
30
30
|
},
|
|
31
31
|
"volta": {
|
|
32
32
|
"extends": "../../package.json"
|