@salesforce/lds-drafts 1.103.1 → 1.105.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 (2) hide show
  1. package/dist/ldsDrafts.js +44 -40
  2. package/package.json +2 -2
package/dist/ldsDrafts.js CHANGED
@@ -520,25 +520,27 @@ class DurableDraftQueue {
520
520
  });
521
521
  }
522
522
  async enqueue(handlerId, data) {
523
- return this.workerPool.push(async () => {
524
- let queue = await this.getQueueActions();
525
- const handler = this.getHandler(handlerId);
526
- const pendingAction = (await handler.buildPendingAction(data, queue));
527
- await this.draftStore.writeAction(pendingAction);
528
- queue = await this.getQueueActions();
529
- await this.notifyChangedListeners({
530
- type: DraftQueueEventType.ActionAdded,
531
- action: pendingAction,
532
- });
533
- await handler.handleActionEnqueued(pendingAction, queue);
534
- if (this.state === DraftQueueState.Started) {
535
- this.processNextAction();
536
- }
537
- const actionData = (await handler.getDataForAction(pendingAction));
538
- return {
539
- action: pendingAction,
540
- data: actionData,
541
- };
523
+ return this.workerPool.push({
524
+ workFn: async () => {
525
+ let queue = await this.getQueueActions();
526
+ const handler = this.getHandler(handlerId);
527
+ const pendingAction = (await handler.buildPendingAction(data, queue));
528
+ await this.draftStore.writeAction(pendingAction);
529
+ queue = await this.getQueueActions();
530
+ await this.notifyChangedListeners({
531
+ type: DraftQueueEventType.ActionAdded,
532
+ action: pendingAction,
533
+ });
534
+ await handler.handleActionEnqueued(pendingAction, queue);
535
+ if (this.state === DraftQueueState.Started) {
536
+ this.processNextAction();
537
+ }
538
+ const actionData = (await handler.getDataForAction(pendingAction));
539
+ return {
540
+ action: pendingAction,
541
+ data: actionData,
542
+ };
543
+ },
542
544
  });
543
545
  }
544
546
  registerOnChangedListener(listener) {
@@ -551,28 +553,30 @@ class DurableDraftQueue {
551
553
  };
552
554
  }
553
555
  async actionCompleted(action) {
554
- return this.workerPool.push(async () => {
555
- const handler = this.getHandler(action.handler);
556
- let queue = await this.getQueueActions();
557
- const queueOperations = handler.getQueueOperationsForCompletingDrafts(queue, action);
558
- const idAndKeyMappings = handler.getRedirectMappings(action);
559
- const keyMappings = idAndKeyMappings === undefined
560
- ? undefined
561
- : idAndKeyMappings.map((m) => {
562
- return { draftKey: m.draftKey, canonicalKey: m.canonicalKey };
556
+ return this.workerPool.push({
557
+ workFn: async () => {
558
+ const handler = this.getHandler(action.handler);
559
+ let queue = await this.getQueueActions();
560
+ const queueOperations = handler.getQueueOperationsForCompletingDrafts(queue, action);
561
+ const idAndKeyMappings = handler.getRedirectMappings(action);
562
+ const keyMappings = idAndKeyMappings === undefined
563
+ ? undefined
564
+ : idAndKeyMappings.map((m) => {
565
+ return { draftKey: m.draftKey, canonicalKey: m.canonicalKey };
566
+ });
567
+ await this.draftStore.completeAction(queueOperations, keyMappings);
568
+ queue = await this.getQueueActions();
569
+ this.retryIntervalMilliseconds = 0;
570
+ this.uploadingActionId = undefined;
571
+ await handler.handleActionCompleted(action, queueOperations, queue, values(this.handlers));
572
+ await this.notifyChangedListeners({
573
+ type: DraftQueueEventType.ActionCompleted,
574
+ action,
563
575
  });
564
- await this.draftStore.completeAction(queueOperations, keyMappings);
565
- queue = await this.getQueueActions();
566
- this.retryIntervalMilliseconds = 0;
567
- this.uploadingActionId = undefined;
568
- await handler.handleActionCompleted(action, queueOperations, queue, values(this.handlers));
569
- await this.notifyChangedListeners({
570
- type: DraftQueueEventType.ActionCompleted,
571
- action,
572
- });
573
- if (this.state === DraftQueueState.Started) {
574
- this.processNextAction();
575
- }
576
+ if (this.state === DraftQueueState.Started) {
577
+ this.processNextAction();
578
+ }
579
+ },
576
580
  });
577
581
  }
578
582
  async actionFailed(action, retry) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-drafts",
3
- "version": "1.103.1",
3
+ "version": "1.105.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS Drafts",
6
6
  "main": "dist/ldsDrafts.js",
@@ -26,6 +26,6 @@
26
26
  "dependencies": {
27
27
  "@luvio/engine": "0.135.4",
28
28
  "@luvio/environments": "0.135.4",
29
- "@salesforce/lds-utils-adapters": "^1.103.1"
29
+ "@salesforce/lds-utils-adapters": "^1.105.0"
30
30
  }
31
31
  }