@salesforce/lds-drafts 1.341.0 → 1.343.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 +2 -32
- package/dist/types/DraftManager.d.ts +1 -10
- package/package.json +3 -3
package/dist/ldsDrafts.js
CHANGED
|
@@ -1030,13 +1030,6 @@ var DraftQueueOperationType;
|
|
|
1030
1030
|
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
1031
1031
|
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
1032
1032
|
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
1033
|
-
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
1034
|
-
* Planned to be removed in 256 (W-16217436) */
|
|
1035
|
-
DraftQueueOperationType["QueueStarted"] = "started";
|
|
1036
|
-
/** @deprecated in 252. All Queue state changed events are consolidated in QueueStateChanged
|
|
1037
|
-
* Planned to be removed in 256 (W-16217436) */
|
|
1038
|
-
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
1039
|
-
/** @since 252 */
|
|
1040
1033
|
DraftQueueOperationType["QueueStateChanged"] = "queueStateChanged";
|
|
1041
1034
|
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
1042
1035
|
/**
|
|
@@ -1081,13 +1074,6 @@ function toQueueState(queue) {
|
|
|
1081
1074
|
}
|
|
1082
1075
|
class DraftManager {
|
|
1083
1076
|
shouldEmitEvent(event) {
|
|
1084
|
-
// Waiting events cannot be emitted prior to 252 native clients
|
|
1085
|
-
// TODO [W-16102411]: we can safely remove this backwards compatible code in 256
|
|
1086
|
-
if (isDraftQueueStateChangeEvent(event) &&
|
|
1087
|
-
event.state === DraftQueueState.Waiting &&
|
|
1088
|
-
this.listenerVersion === undefined) {
|
|
1089
|
-
return false;
|
|
1090
|
-
}
|
|
1091
1077
|
return this.draftEventsShouldBeEmitted.includes(event.type);
|
|
1092
1078
|
}
|
|
1093
1079
|
constructor(draftQueue) {
|
|
@@ -1127,16 +1113,6 @@ class DraftManager {
|
|
|
1127
1113
|
throw Error('Unsupported event type');
|
|
1128
1114
|
}
|
|
1129
1115
|
}
|
|
1130
|
-
draftQueueStateToOperationType(state) {
|
|
1131
|
-
switch (state) {
|
|
1132
|
-
case DraftQueueState.Started:
|
|
1133
|
-
return DraftQueueOperationType.QueueStarted;
|
|
1134
|
-
case DraftQueueState.Stopped:
|
|
1135
|
-
return DraftQueueOperationType.QueueStopped;
|
|
1136
|
-
default:
|
|
1137
|
-
throw Error('Unsupported event type');
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
1116
|
/**
|
|
1141
1117
|
* Enqueue a custom action on the DraftQueue for a handler
|
|
1142
1118
|
* @param handler the handler's id
|
|
@@ -1198,8 +1174,7 @@ class DraftManager {
|
|
|
1198
1174
|
*
|
|
1199
1175
|
* @param listener The listener closure to subscribe to changes
|
|
1200
1176
|
*/
|
|
1201
|
-
registerDraftQueueChangedListener(listener,
|
|
1202
|
-
this.listenerVersion = version;
|
|
1177
|
+
registerDraftQueueChangedListener(listener, _version = undefined) {
|
|
1203
1178
|
this.listeners.push(listener);
|
|
1204
1179
|
return () => {
|
|
1205
1180
|
this.listeners = this.listeners.filter((l) => {
|
|
@@ -1315,12 +1290,7 @@ class DraftManager {
|
|
|
1315
1290
|
const managerState = await this.getQueue();
|
|
1316
1291
|
let operationType, item;
|
|
1317
1292
|
if (isDraftQueueStateChangeEvent(event)) {
|
|
1318
|
-
|
|
1319
|
-
operationType = this.draftQueueStateToOperationType(event.state);
|
|
1320
|
-
}
|
|
1321
|
-
else {
|
|
1322
|
-
operationType = DraftQueueOperationType.QueueStateChanged;
|
|
1323
|
-
}
|
|
1293
|
+
operationType = DraftQueueOperationType.QueueStateChanged;
|
|
1324
1294
|
}
|
|
1325
1295
|
else {
|
|
1326
1296
|
const { action, type } = event;
|
|
@@ -72,13 +72,6 @@ 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) */
|
|
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) */
|
|
80
|
-
QueueStopped = "stopped",
|
|
81
|
-
/** @since 252 */
|
|
82
75
|
QueueStateChanged = "queueStateChanged"
|
|
83
76
|
}
|
|
84
77
|
/**
|
|
@@ -89,12 +82,10 @@ export declare type DraftQueueListener = (state: DraftManagerState, operationTyp
|
|
|
89
82
|
export declare class DraftManager {
|
|
90
83
|
private draftQueue;
|
|
91
84
|
private listeners;
|
|
92
|
-
private listenerVersion;
|
|
93
85
|
private draftEventsShouldBeEmitted;
|
|
94
86
|
private shouldEmitEvent;
|
|
95
87
|
constructor(draftQueue: DraftQueue);
|
|
96
88
|
private draftQueueEventTypeToOperationType;
|
|
97
|
-
private draftQueueStateToOperationType;
|
|
98
89
|
/**
|
|
99
90
|
* Enqueue a custom action on the DraftQueue for a handler
|
|
100
91
|
* @param handler the handler's id
|
|
@@ -132,7 +123,7 @@ export declare class DraftManager {
|
|
|
132
123
|
*
|
|
133
124
|
* @param listener The listener closure to subscribe to changes
|
|
134
125
|
*/
|
|
135
|
-
registerDraftQueueChangedListener(listener: DraftQueueListener,
|
|
126
|
+
registerDraftQueueChangedListener(listener: DraftQueueListener, _version?: 252 | undefined): () => Promise<void>;
|
|
136
127
|
/**
|
|
137
128
|
* Creates a custom action handler for the given handler
|
|
138
129
|
* @param handlerId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-drafts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.343.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS Drafts",
|
|
6
6
|
"main": "dist/ldsDrafts.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@luvio/engine": "0.156.5",
|
|
28
28
|
"@luvio/environments": "0.156.5",
|
|
29
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
29
|
+
"@salesforce/lds-utils-adapters": "^1.343.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
32
|
+
"@salesforce/nimbus-plugin-lds": "^1.343.0"
|
|
33
33
|
},
|
|
34
34
|
"volta": {
|
|
35
35
|
"extends": "../../package.json"
|