@salesforce/lds-drafts 1.248.0 → 1.249.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
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { HttpStatusCode, StoreKeyMap } from '@luvio/engine';
|
|
8
|
-
import { AsyncWorkerPool } from '@salesforce/lds-utils-adapters';
|
|
8
|
+
import { uuidv4, AsyncWorkerPool } from '@salesforce/lds-utils-adapters';
|
|
9
|
+
import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
|
|
9
10
|
|
|
10
11
|
var DraftActionStatus;
|
|
11
12
|
(function (DraftActionStatus) {
|
|
@@ -219,20 +220,6 @@ function generateUniqueDraftActionId(existingIds) {
|
|
|
219
220
|
}
|
|
220
221
|
return newId.toString();
|
|
221
222
|
}
|
|
222
|
-
/**
|
|
223
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
224
|
-
*/
|
|
225
|
-
function uuidv4() {
|
|
226
|
-
const uuid = [];
|
|
227
|
-
for (let i = 0; i < 32; i++) {
|
|
228
|
-
const random = (Math.random() * 16) | 0;
|
|
229
|
-
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
230
|
-
uuid.push('-');
|
|
231
|
-
}
|
|
232
|
-
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
233
|
-
}
|
|
234
|
-
return uuid.join('');
|
|
235
|
-
}
|
|
236
223
|
|
|
237
224
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
238
225
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
@@ -1109,7 +1096,12 @@ class AbstractResourceRequestActionHandler {
|
|
|
1109
1096
|
// the luvio store redirect table, during which a new draft might be enqueued
|
|
1110
1097
|
// which would not see a necessary mapping.
|
|
1111
1098
|
this.ephemeralRedirects = {};
|
|
1099
|
+
// determined by Server setup.
|
|
1112
1100
|
this.isIdempotencySupported = true;
|
|
1101
|
+
// idempotency write flag set by lds
|
|
1102
|
+
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
1103
|
+
fallback: false,
|
|
1104
|
+
});
|
|
1113
1105
|
}
|
|
1114
1106
|
enqueue(data) {
|
|
1115
1107
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -1466,7 +1458,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
1466
1458
|
return [action.targetId];
|
|
1467
1459
|
}
|
|
1468
1460
|
hasIdempotencySupport() {
|
|
1469
|
-
return this.isIdempotencySupported;
|
|
1461
|
+
return this.isIdempotencySupported && !this.isLdsIdempotencyWriteDisabled;
|
|
1470
1462
|
}
|
|
1471
1463
|
async ingestResponses(responses, action) {
|
|
1472
1464
|
const luvio = this.getLuvio();
|
|
@@ -1899,4 +1891,4 @@ function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueu
|
|
|
1899
1891
|
});
|
|
1900
1892
|
}
|
|
1901
1893
|
|
|
1902
|
-
export { AbstractResourceRequestActionHandler, CustomActionResultType, DRAFT_ERROR_CODE, DRAFT_ID_MAPPINGS_SEGMENT, DRAFT_SEGMENT, DraftActionOperationType, DraftActionStatus, DraftErrorFetchResponse, DraftFetchResponse, DraftManager, DraftQueueEventType, DraftQueueState, DraftSynthesisError, DurableDraftQueue, DurableDraftStore, ProcessActionResult, buildLuvioOverrideForDraftAdapters, createBadRequestResponse, createDeletedResponse, createDraftSynthesisErrorResponse, createInternalErrorResponse, createNotFoundResponse, createOkResponse, generateUniqueDraftActionId, isDraftSynthesisError, makeEnvironmentDraftAware, transformErrorToDraftSynthesisError
|
|
1894
|
+
export { AbstractResourceRequestActionHandler, CustomActionResultType, DRAFT_ERROR_CODE, DRAFT_ID_MAPPINGS_SEGMENT, DRAFT_SEGMENT, DraftActionOperationType, DraftActionStatus, DraftErrorFetchResponse, DraftFetchResponse, DraftManager, DraftQueueEventType, DraftQueueState, DraftSynthesisError, DurableDraftQueue, DurableDraftStore, ProcessActionResult, buildLuvioOverrideForDraftAdapters, createBadRequestResponse, createDeletedResponse, createDraftSynthesisErrorResponse, createInternalErrorResponse, createNotFoundResponse, createOkResponse, generateUniqueDraftActionId, isDraftSynthesisError, makeEnvironmentDraftAware, transformErrorToDraftSynthesisError };
|
|
@@ -15,6 +15,7 @@ export declare abstract class AbstractResourceRequestActionHandler<ResponseType,
|
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
};
|
|
17
17
|
isIdempotencySupported: boolean;
|
|
18
|
+
isLdsIdempotencyWriteDisabled: boolean;
|
|
18
19
|
constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio);
|
|
19
20
|
enqueue(data: ResourceRequest): Promise<EnqueueResult<ResourceRequest, ResponseType>>;
|
|
20
21
|
handleAction(action: DraftAction<ResourceRequest, ResponseType>, actionCompleted: (action: CompletedDraftAction<ResourceRequest, ResponseType>) => Promise<void>, actionErrored: (action: DraftAction<ResourceRequest, ResponseType>, retry: boolean, retryDelayInMs?: number, actionDataChanged?: boolean) => Promise<void>): Promise<ProcessActionResult>;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { DraftQueue, DraftQueueState, DraftAction, ErrorDraftAction, PendingDraf
|
|
|
2
2
|
export { AdapterBuildNetworkSnapshot, buildLuvioOverrideForDraftAdapters, } from './DraftAwareAdapter';
|
|
3
3
|
export { DRAFT_ID_MAPPINGS_SEGMENT, DraftKeyMapping } from './DraftIdMapping';
|
|
4
4
|
export { DurableDraftQueue, DRAFT_SEGMENT } from './DurableDraftQueue';
|
|
5
|
-
export { generateUniqueDraftActionId
|
|
5
|
+
export { generateUniqueDraftActionId } from './utils/id';
|
|
6
6
|
export { DurableDraftStore } from './DurableDraftStore';
|
|
7
7
|
export { DraftStore } from './DraftStore';
|
|
8
8
|
export { DraftManager, DraftManagerState, DraftActionOperationType, DraftQueueItem, DraftQueueItemMetadata, } from './DraftManager';
|
package/dist/types/utils/id.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
export { uuidv4 } from '@salesforce/lds-utils-adapters';
|
|
1
2
|
/**
|
|
2
3
|
* Generates a time-ordered, unique id to associate with a DraftAction. Ensures
|
|
3
4
|
* no collisions with existing draft action IDs.
|
|
4
5
|
*/
|
|
5
6
|
export declare function generateUniqueDraftActionId(existingIds: string[]): string;
|
|
6
|
-
/**
|
|
7
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
8
|
-
*/
|
|
9
|
-
export declare function uuidv4(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-drafts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.249.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS Drafts",
|
|
6
6
|
"main": "dist/ldsDrafts.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-drafts"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@luvio/engine": "0.
|
|
28
|
-
"@luvio/environments": "0.
|
|
27
|
+
"@luvio/engine": "0.152.2",
|
|
28
|
+
"@luvio/environments": "0.152.2",
|
|
29
29
|
"@salesforce/lds-utils-adapters": "*"
|
|
30
30
|
}
|
|
31
31
|
}
|