@salesforce/lds-drafts 1.428.0-dev13 → 1.428.0-dev15

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
@@ -306,6 +306,13 @@ function customActionHandler(executor, id, draftQueue) {
306
306
  }
307
307
 
308
308
  const DRAFT_SEGMENT = 'DRAFT';
309
+ /**
310
+ * Metadata key under which an action's upload retry-attempt count is persisted.
311
+ * Lives in the action's durable `metadata` bag so the count survives app restarts
312
+ * (the in-memory backoff interval resets on every startQueue()). Written by the
313
+ * action handler on each retry and cleared when an action is manually retried.
314
+ */
315
+ const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = 'retryCount';
309
316
  class DurableDraftQueue {
310
317
  getHandler(id) {
311
318
  const handler = this.handlers[id];
@@ -664,10 +671,14 @@ class DurableDraftQueue {
664
671
  if (!isDraftError(target)) {
665
672
  throw Error(`Action ${actionId} is not in Error state`);
666
673
  }
674
+ // A manual retry is a fresh start: clear the persisted upload retry-attempt
675
+ // count so the action doesn't immediately re-cap after a single failure.
676
+ const { [DRAFT_ACTION_RETRY_COUNT_METADATA_KEY]: _retryCount, ...metadataWithoutRetryCount } = target.metadata || {};
667
677
  let pendingAction = {
668
678
  ...target,
669
679
  status: DraftActionStatus.Pending,
670
680
  error: undefined,
681
+ metadata: metadataWithoutRetryCount,
671
682
  };
672
683
  await this.draftStore.writeAction(pendingAction);
673
684
  await this.notifyChangedListeners({
@@ -1370,4 +1381,4 @@ function isResourceRequestAction(action) {
1370
1381
  return (dataAsAny !== undefined && dataAsAny.method !== undefined && dataAsAny.body !== undefined);
1371
1382
  }
1372
1383
 
1373
- 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 };
1384
+ 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 };
@@ -4,6 +4,13 @@ import type { CustomActionExecutor } from './actionHandlers/CustomActionHandler'
4
4
  import type { ActionHandler } from './actionHandlers/ActionHandler';
5
5
  import type { DraftStore } from './DraftStore';
6
6
  export declare const DRAFT_SEGMENT = "DRAFT";
7
+ /**
8
+ * Metadata key under which an action's upload retry-attempt count is persisted.
9
+ * Lives in the action's durable `metadata` bag so the count survives app restarts
10
+ * (the in-memory backoff interval resets on every startQueue()). Written by the
11
+ * action handler on each retry and cleared when an action is manually retried.
12
+ */
13
+ export declare const DRAFT_ACTION_RETRY_COUNT_METADATA_KEY = "retryCount";
7
14
  export declare class DurableDraftQueue implements DraftQueue {
8
15
  private retryIntervalMilliseconds;
9
16
  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.428.0-dev13",
3
+ "version": "1.428.0-dev15",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS Drafts",
6
6
  "main": "dist/ldsDrafts.js",
@@ -24,12 +24,12 @@
24
24
  "release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-drafts"
25
25
  },
26
26
  "dependencies": {
27
- "@luvio/engine": "0.160.3",
28
- "@luvio/environments": "0.160.3",
29
- "@salesforce/lds-utils-adapters": "^1.428.0-dev13"
27
+ "@luvio/engine": "0.160.4-dev1",
28
+ "@luvio/environments": "0.160.4-dev1",
29
+ "@salesforce/lds-utils-adapters": "^1.428.0-dev15"
30
30
  },
31
31
  "devDependencies": {
32
- "@salesforce/nimbus-plugin-lds": "^1.428.0-dev13"
32
+ "@salesforce/nimbus-plugin-lds": "^1.428.0-dev15"
33
33
  },
34
34
  "volta": {
35
35
  "extends": "../../package.json"