@salesforce/lds-drafts 1.444.0 → 1.446.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
@@ -307,6 +307,13 @@ function customActionHandler(executor, id, draftQueue) {
307
307
  }
308
308
 
309
309
  const DRAFT_SEGMENT = 'DRAFT';
310
+ /**
311
+ * Metadata key under which an action's upload retry-attempt count is persisted.
312
+ * Lives in the action's durable `metadata` bag so the count survives app restarts
313
+ * (the in-memory backoff interval resets on every startQueue()). Written by the
314
+ * action handler on each retry and cleared when an action is manually retried.
315
+ */
316
+ const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = 'retryCount';
310
317
  class DurableDraftQueue {
311
318
  getHandler(id) {
312
319
  const handler = this.handlers[id];
@@ -675,10 +682,14 @@ class DurableDraftQueue {
675
682
  if (!isDraftError(target)) {
676
683
  throw Error(`Action ${actionId} is not in Error state`);
677
684
  }
685
+ // A manual retry is a fresh start: clear the persisted upload retry-attempt
686
+ // count so the action doesn't immediately re-cap after a single failure.
687
+ const { [DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: _retryCount, ...metadataWithoutRetryCount } = target.metadata || {};
678
688
  let pendingAction = {
679
689
  ...target,
680
690
  status: DraftActionStatus.Pending,
681
691
  error: undefined,
692
+ metadata: metadataWithoutRetryCount,
682
693
  };
683
694
  await this.draftStore.writeAction(pendingAction);
684
695
  await this.notifyChangedListeners({
@@ -1382,4 +1393,4 @@ function isResourceRequestAction(action) {
1382
1393
  return (dataAsAny !== undefined && dataAsAny.method !== undefined && dataAsAny.body !== undefined);
1383
1394
  }
1384
1395
 
1385
- export { CustomActionResultType, DRAFT_ERROR_CODE, DRAFT_SEGMENT, DraftActionOperationType, DraftActionStatus, DraftErrorFetchResponse, DraftFetchResponse, DraftManager, DraftQueueEventType, DraftQueueState, DraftSynthesisError, DurableDraftQueue, DurableDraftStore, ProcessActionResult, QueueOperationType, createBadRequestResponse, createDeletedResponse, createDraftSynthesisErrorResponse, createInternalErrorResponse, createNotFoundResponse, createOkResponse, generateUniqueDraftActionId, isDraftSynthesisError, transformErrorToDraftSynthesisError };
1396
+ export { CustomActionResultType, DRAFT_ACTION_RETRY_COUNT_METADATA_KEY, DRAFT_ERROR_CODE, DRAFT_SEGMENT, DraftActionOperationType, DraftActionStatus, DraftErrorFetchResponse, DraftFetchResponse, DraftManager, DraftQueueEventType, DraftQueueState, DraftSynthesisError, DurableDraftQueue, DurableDraftStore, ProcessActionResult, QueueOperationType, createBadRequestResponse, createDeletedResponse, createDraftSynthesisErrorResponse, createInternalErrorResponse, createNotFoundResponse, createOkResponse, generateUniqueDraftActionId, isDraftSynthesisError, transformErrorToDraftSynthesisError };
@@ -5,6 +5,13 @@ import type { ActionHandler } from './actionHandlers/ActionHandler';
5
5
  import type { DraftStore } from './DraftStore';
6
6
  import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
7
7
  export declare const DRAFT_SEGMENT = "DRAFT";
8
+ /**
9
+ * Metadata key under which an action's upload retry-attempt count is persisted.
10
+ * Lives in the action's durable `metadata` bag so the count survives app restarts
11
+ * (the in-memory backoff interval resets on every startQueue()). Written by the
12
+ * action handler on each retry and cleared when an action is manually retried.
13
+ */
14
+ export declare const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = "retryCount";
8
15
  export declare class DurableDraftQueue implements DraftQueue {
9
16
  private retryIntervalMilliseconds;
10
17
  private minimumRetryInterval;
@@ -1,5 +1,5 @@
1
1
  export { DraftQueue, DraftQueueState, DraftAction, ErrorDraftAction, PendingDraftAction, CompletedDraftAction, DraftActionStatus, ProcessActionResult, DraftQueueChangeListener, DraftActionMetadata, DraftQueueEventType, QueueOperation, UpdateQueueOperation, QueueOperationType, type DraftQueueEvent, type DraftQueueActionFailedEvent, } from './DraftQueue';
2
- export { DurableDraftQueue, DRAFT_SEGMENT } from './DurableDraftQueue';
2
+ export { DurableDraftQueue, DRAFT_SEGMENT, DRAFT_ACTION_RETRY_COUNT_METADATA_KEY, } from './DurableDraftQueue';
3
3
  export { generateUniqueDraftActionId, uuidv4 } from './utils/id';
4
4
  export { DurableDraftStore } from './DurableDraftStore';
5
5
  export { DraftStore } from './DraftStore';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-drafts",
3
- "version": "1.444.0",
3
+ "version": "1.446.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.161.0",
28
28
  "@luvio/environments": "0.161.0",
29
- "@salesforce/lds-utils-adapters": "^1.444.0"
29
+ "@salesforce/lds-utils-adapters": "^1.446.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@salesforce/nimbus-plugin-lds": "^1.444.0"
32
+ "@salesforce/nimbus-plugin-lds": "^1.446.0"
33
33
  },
34
34
  "volta": {
35
35
  "extends": "../../package.json"