@salesforce/lds-worker-api 1.124.3 → 1.124.5
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.
|
@@ -751,4 +751,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
754
|
-
// version: 1.124.
|
|
754
|
+
// version: 1.124.5-f65e6d350
|
|
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
callbacks.push(callback);
|
|
3778
3778
|
}
|
|
3779
|
-
// version: 1.124.
|
|
3779
|
+
// version: 1.124.5-f65e6d350
|
|
3780
3780
|
|
|
3781
3781
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3782
3782
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15200,7 +15200,7 @@ function parseAndVisit(source) {
|
|
|
15200
15200
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15201
15201
|
return luvioDocumentNode;
|
|
15202
15202
|
}
|
|
15203
|
-
// version: 1.124.
|
|
15203
|
+
// version: 1.124.5-f65e6d350
|
|
15204
15204
|
|
|
15205
15205
|
function unwrap(data) {
|
|
15206
15206
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16113,7 +16113,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16113
16113
|
const { apiFamily, name } = metadata;
|
|
16114
16114
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16115
16115
|
}
|
|
16116
|
-
// version: 1.124.
|
|
16116
|
+
// version: 1.124.5-f65e6d350
|
|
16117
16117
|
|
|
16118
16118
|
/**
|
|
16119
16119
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44347,7 +44347,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44347
44347
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44348
44348
|
});
|
|
44349
44349
|
});
|
|
44350
|
-
// version: 1.124.
|
|
44350
|
+
// version: 1.124.5-bc91bd7b2
|
|
44351
44351
|
|
|
44352
44352
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44353
44353
|
|
|
@@ -49175,10 +49175,6 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
49175
49175
|
});
|
|
49176
49176
|
return queueOperations;
|
|
49177
49177
|
};
|
|
49178
|
-
const replaceAction = (actionId, _withActionId, _uploadingActionId, _actions) => {
|
|
49179
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
49180
|
-
throw new Error(`${actionId} does not support action replacing. You can only delete ${actionId}`);
|
|
49181
|
-
};
|
|
49182
49178
|
const getRedirectMappings = (_action) => {
|
|
49183
49179
|
return undefined;
|
|
49184
49180
|
};
|
|
@@ -49190,7 +49186,9 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
49190
49186
|
handleAction: handle,
|
|
49191
49187
|
buildPendingAction,
|
|
49192
49188
|
getQueueOperationsForCompletingDrafts: getQueueOperationsForCompletingDrafts,
|
|
49193
|
-
handleReplaceAction:
|
|
49189
|
+
handleReplaceAction: () => {
|
|
49190
|
+
throw Error('replaceAction not supported for custom actions');
|
|
49191
|
+
},
|
|
49194
49192
|
getRedirectMappings,
|
|
49195
49193
|
handleActionRemoved: () => Promise.resolve(),
|
|
49196
49194
|
handleActionCompleted: () => Promise.resolve(),
|
|
@@ -49257,13 +49255,13 @@ class DurableDraftQueue {
|
|
|
49257
49255
|
this.userState = DraftQueueState.Started;
|
|
49258
49256
|
if (this.state === DraftQueueState.Started) {
|
|
49259
49257
|
// Do nothing if the queue state is already started
|
|
49260
|
-
return
|
|
49258
|
+
return;
|
|
49261
49259
|
}
|
|
49262
49260
|
if (this.replacingAction !== undefined) {
|
|
49263
49261
|
// If we're replacing an action do nothing
|
|
49264
49262
|
// replace will restart the queue for us as long as the user
|
|
49265
49263
|
// has last set the queue to be started
|
|
49266
|
-
return
|
|
49264
|
+
return;
|
|
49267
49265
|
}
|
|
49268
49266
|
this.retryIntervalMilliseconds = 0;
|
|
49269
49267
|
this.state = DraftQueueState.Started;
|
|
@@ -49503,92 +49501,11 @@ class DurableDraftQueue {
|
|
|
49503
49501
|
await this.startQueue();
|
|
49504
49502
|
}
|
|
49505
49503
|
}
|
|
49506
|
-
replaceAction(
|
|
49507
|
-
|
|
49508
|
-
if (actionId === withActionId) {
|
|
49509
|
-
return Promise.reject('Swapped and swapping action ids cannot be the same');
|
|
49510
|
-
}
|
|
49511
|
-
// cannot have a replace action already in progress
|
|
49512
|
-
if (this.replacingAction !== undefined) {
|
|
49513
|
-
return Promise.reject('Cannot replace actions while a replace action is in progress');
|
|
49514
|
-
}
|
|
49515
|
-
this.stopQueueManually();
|
|
49516
|
-
const replacing = this.getQueueActions().then(async (actions) => {
|
|
49517
|
-
const first = actions.filter((action) => action.id === actionId)[0];
|
|
49518
|
-
if (first === undefined) {
|
|
49519
|
-
this.replacingAction = undefined;
|
|
49520
|
-
await this.startQueueSafe();
|
|
49521
|
-
return Promise.reject('No action to replace');
|
|
49522
|
-
}
|
|
49523
|
-
// put in a try/finally block so we don't leave this.replacingAction
|
|
49524
|
-
// indefinitely set
|
|
49525
|
-
let actionToReplace;
|
|
49526
|
-
try {
|
|
49527
|
-
const replaceResult = this.getHandler(first.handler).handleReplaceAction(actionId, withActionId, this.uploadingActionId, actions);
|
|
49528
|
-
actionToReplace = replaceResult.actionToReplace;
|
|
49529
|
-
// TODO [W-8873834]: Will add batching support to durable store
|
|
49530
|
-
// we should use that here to remove and set both actions in one operation
|
|
49531
|
-
await this.removeDraftAction(replaceResult.replacingAction.id);
|
|
49532
|
-
await this.draftStore.writeAction(actionToReplace);
|
|
49533
|
-
await this.notifyChangedListeners({
|
|
49534
|
-
type: DraftQueueEventType.ActionUpdated,
|
|
49535
|
-
action: actionToReplace,
|
|
49536
|
-
});
|
|
49537
|
-
}
|
|
49538
|
-
finally {
|
|
49539
|
-
this.replacingAction = undefined;
|
|
49540
|
-
}
|
|
49541
|
-
await this.startQueueSafe();
|
|
49542
|
-
return actionToReplace;
|
|
49543
|
-
});
|
|
49544
|
-
this.replacingAction = replacing;
|
|
49545
|
-
return replacing;
|
|
49504
|
+
replaceAction(targetActionId, sourceActionId) {
|
|
49505
|
+
return this.replaceOrMergeActions(targetActionId, sourceActionId, false);
|
|
49546
49506
|
}
|
|
49547
49507
|
mergeActions(targetActionId, sourceActionId) {
|
|
49548
|
-
|
|
49549
|
-
if (targetActionId === sourceActionId) {
|
|
49550
|
-
return Promise.reject(new Error('targetActionId and sourceActionId cannot be the same.'));
|
|
49551
|
-
}
|
|
49552
|
-
// cannot have a replace action already in progress
|
|
49553
|
-
if (this.replacingAction !== undefined) {
|
|
49554
|
-
return Promise.reject(new Error('Cannot merge actions while a replace/merge action operation is in progress.'));
|
|
49555
|
-
}
|
|
49556
|
-
this.stopQueueManually();
|
|
49557
|
-
const promise = this.getQueueActions().then(async (actions) => {
|
|
49558
|
-
const target = actions.find((action) => action.id === targetActionId);
|
|
49559
|
-
if (target === undefined) {
|
|
49560
|
-
this.replacingAction = undefined;
|
|
49561
|
-
await this.startQueueSafe();
|
|
49562
|
-
throw Error('targetActionId not found in the draft queue.');
|
|
49563
|
-
}
|
|
49564
|
-
const source = actions.find((action) => action.id === sourceActionId);
|
|
49565
|
-
if (source === undefined) {
|
|
49566
|
-
this.replacingAction = undefined;
|
|
49567
|
-
await this.startQueueSafe();
|
|
49568
|
-
throw Error('sourceActionId not found in the draft queue.');
|
|
49569
|
-
}
|
|
49570
|
-
// put in a try/finally block so we don't leave this.replacingAction
|
|
49571
|
-
// indefinitely set
|
|
49572
|
-
let merged;
|
|
49573
|
-
try {
|
|
49574
|
-
merged = this.getHandler(target.handler).mergeActions(target, source);
|
|
49575
|
-
// update the target
|
|
49576
|
-
await this.draftStore.writeAction(merged);
|
|
49577
|
-
await this.notifyChangedListeners({
|
|
49578
|
-
type: DraftQueueEventType.ActionUpdated,
|
|
49579
|
-
action: merged,
|
|
49580
|
-
});
|
|
49581
|
-
// remove the source from queue
|
|
49582
|
-
await this.removeDraftAction(sourceActionId);
|
|
49583
|
-
}
|
|
49584
|
-
finally {
|
|
49585
|
-
this.replacingAction = undefined;
|
|
49586
|
-
}
|
|
49587
|
-
await this.startQueueSafe();
|
|
49588
|
-
return merged;
|
|
49589
|
-
});
|
|
49590
|
-
this.replacingAction = promise;
|
|
49591
|
-
return promise;
|
|
49508
|
+
return this.replaceOrMergeActions(targetActionId, sourceActionId, true);
|
|
49592
49509
|
}
|
|
49593
49510
|
async setMetadata(actionId, metadata) {
|
|
49594
49511
|
const keys$1 = keys$4(metadata);
|
|
@@ -49623,6 +49540,81 @@ class DurableDraftQueue {
|
|
|
49623
49540
|
}
|
|
49624
49541
|
}, this.retryIntervalMilliseconds);
|
|
49625
49542
|
}
|
|
49543
|
+
async getActionsForReplaceOrMerge(targetActionId, sourceActionId) {
|
|
49544
|
+
const actions = await this.getQueueActions();
|
|
49545
|
+
const target = actions.find((action) => action.id === targetActionId);
|
|
49546
|
+
if (target === undefined) {
|
|
49547
|
+
this.replacingAction = undefined;
|
|
49548
|
+
await this.startQueueSafe();
|
|
49549
|
+
throw Error(`targetActionId ${targetActionId} not found in the draft queue.`);
|
|
49550
|
+
}
|
|
49551
|
+
const source = actions.find((action) => action.id === sourceActionId);
|
|
49552
|
+
if (source === undefined) {
|
|
49553
|
+
this.replacingAction = undefined;
|
|
49554
|
+
await this.startQueueSafe();
|
|
49555
|
+
throw Error(`sourceActionId ${sourceActionId} not found in the draft queue.`);
|
|
49556
|
+
}
|
|
49557
|
+
return { target, source };
|
|
49558
|
+
}
|
|
49559
|
+
assertReplaceOrMergePrerequisites(target, source) {
|
|
49560
|
+
// ensure actions are in a state to be replaced/merged
|
|
49561
|
+
const { targetId: targetCacheKey, tag: targetTag, status: targetStatus, version: targetVersion, } = target;
|
|
49562
|
+
const { targetId: sourceCacheKey, tag: sourceTag, status: sourceStatus, version: sourceVersion, } = source;
|
|
49563
|
+
if (targetCacheKey !== sourceCacheKey) {
|
|
49564
|
+
throw Error('Cannot replace/merge actions for different targetIds.');
|
|
49565
|
+
}
|
|
49566
|
+
if (targetTag !== sourceTag) {
|
|
49567
|
+
throw Error('Cannot replace/merge actions for different tags.');
|
|
49568
|
+
}
|
|
49569
|
+
if (targetStatus === DraftActionStatus.Completed ||
|
|
49570
|
+
targetStatus === DraftActionStatus.Uploading) {
|
|
49571
|
+
throw Error(`Cannot replace/merge actions when targetAction is in ${targetStatus} status.`);
|
|
49572
|
+
}
|
|
49573
|
+
if (sourceStatus !== DraftActionStatus.Pending) {
|
|
49574
|
+
throw Error(`Cannot replace/merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
49575
|
+
}
|
|
49576
|
+
if (targetVersion !== sourceVersion) {
|
|
49577
|
+
throw Error('Cannot replace/merge actions with different versions.');
|
|
49578
|
+
}
|
|
49579
|
+
}
|
|
49580
|
+
async replaceOrMergeActions(targetActionId, sourceActionId, merge) {
|
|
49581
|
+
// ids must be unique
|
|
49582
|
+
if (targetActionId === sourceActionId) {
|
|
49583
|
+
throw Error('targetActionId and sourceActionId cannot be the same.');
|
|
49584
|
+
}
|
|
49585
|
+
// cannot have a replace action already in progress
|
|
49586
|
+
if (this.replacingAction !== undefined) {
|
|
49587
|
+
throw Error('Cannot replace/merge actions while a replace/merge action operation is in progress.');
|
|
49588
|
+
}
|
|
49589
|
+
this.stopQueueManually();
|
|
49590
|
+
const promise = this.getActionsForReplaceOrMerge(targetActionId, sourceActionId).then(async ({ target, source }) => {
|
|
49591
|
+
// put in a try/finally block so we don't leave this.replacingAction
|
|
49592
|
+
// indefinitely set
|
|
49593
|
+
let updatedTarget;
|
|
49594
|
+
try {
|
|
49595
|
+
this.assertReplaceOrMergePrerequisites(target, source);
|
|
49596
|
+
const handler = this.getHandler(target.handler);
|
|
49597
|
+
updatedTarget = merge
|
|
49598
|
+
? handler.mergeActions(target, source)
|
|
49599
|
+
: handler.handleReplaceAction(target, source);
|
|
49600
|
+
// update the target
|
|
49601
|
+
await this.draftStore.writeAction(updatedTarget);
|
|
49602
|
+
await this.notifyChangedListeners({
|
|
49603
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
49604
|
+
action: updatedTarget,
|
|
49605
|
+
});
|
|
49606
|
+
// remove the source from queue
|
|
49607
|
+
await this.removeDraftAction(sourceActionId);
|
|
49608
|
+
}
|
|
49609
|
+
finally {
|
|
49610
|
+
this.replacingAction = undefined;
|
|
49611
|
+
await this.startQueueSafe();
|
|
49612
|
+
}
|
|
49613
|
+
return updatedTarget;
|
|
49614
|
+
});
|
|
49615
|
+
this.replacingAction = promise;
|
|
49616
|
+
return promise;
|
|
49617
|
+
}
|
|
49626
49618
|
}
|
|
49627
49619
|
|
|
49628
49620
|
const DRAFT_ACTION_KEY_JUNCTION = '__DraftAction__';
|
|
@@ -50042,56 +50034,53 @@ class AbstractResourceRequestActionHandler {
|
|
|
50042
50034
|
}
|
|
50043
50035
|
await this.ingestResponses(recordsToIngest, action);
|
|
50044
50036
|
}
|
|
50045
|
-
handleReplaceAction(
|
|
50046
|
-
// get the action to replace
|
|
50047
|
-
const actionToReplace = actions.filter((action) => action.id === actionId)[0];
|
|
50048
|
-
// get the replacing action
|
|
50049
|
-
const replacingAction = actions.filter((action) => action.id === withActionId)[0];
|
|
50050
|
-
// reject if either action is undefined
|
|
50051
|
-
if (actionToReplace === undefined || replacingAction === undefined) {
|
|
50052
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50053
|
-
throw new Error('One or both actions does not exist');
|
|
50054
|
-
}
|
|
50055
|
-
// reject if either action is uploading
|
|
50056
|
-
if (actionToReplace.id === uploadingActionId || replacingAction.id === uploadingActionId) {
|
|
50057
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50058
|
-
throw new Error('Cannot replace an draft action that is uploading');
|
|
50059
|
-
}
|
|
50060
|
-
// reject if these two draft actions aren't acting on the same target
|
|
50061
|
-
if (actionToReplace.tag !== replacingAction.tag) {
|
|
50062
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50063
|
-
throw new Error('Cannot swap actions targeting different targets');
|
|
50064
|
-
}
|
|
50065
|
-
// reject if the replacing action is not pending
|
|
50066
|
-
if (replacingAction.status !== DraftActionStatus.Pending) {
|
|
50067
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50068
|
-
throw new Error('Cannot replace with a non-pending action');
|
|
50069
|
-
}
|
|
50037
|
+
handleReplaceAction(targetAction, sourceAction) {
|
|
50070
50038
|
//reject if the action to replace is a POST action
|
|
50071
|
-
const pendingAction =
|
|
50039
|
+
const pendingAction = targetAction;
|
|
50072
50040
|
if (pendingAction.data.method === 'post') {
|
|
50073
|
-
|
|
50074
|
-
throw new Error('Cannot replace a POST action');
|
|
50041
|
+
throw Error('Cannot replace a POST action');
|
|
50075
50042
|
}
|
|
50076
|
-
if (this.isActionOfType(
|
|
50077
|
-
this.isActionOfType(
|
|
50078
|
-
|
|
50079
|
-
|
|
50080
|
-
|
|
50081
|
-
};
|
|
50082
|
-
actionToReplace.status = DraftActionStatus.Pending;
|
|
50083
|
-
actionToReplace.data = replacingAction.data;
|
|
50084
|
-
return {
|
|
50085
|
-
original: actionToReplaceCopy,
|
|
50086
|
-
actionToReplace: actionToReplace,
|
|
50087
|
-
replacingAction: replacingAction,
|
|
50088
|
-
};
|
|
50043
|
+
if (this.isActionOfType(targetAction) &&
|
|
50044
|
+
this.isActionOfType(sourceAction)) {
|
|
50045
|
+
targetAction.status = DraftActionStatus.Pending;
|
|
50046
|
+
targetAction.data = sourceAction.data;
|
|
50047
|
+
return targetAction;
|
|
50089
50048
|
}
|
|
50090
50049
|
else {
|
|
50091
|
-
|
|
50092
|
-
throw new Error('Incompatible Action types to replace one another');
|
|
50050
|
+
throw Error('Incompatible Action types to replace one another');
|
|
50093
50051
|
}
|
|
50094
50052
|
}
|
|
50053
|
+
mergeActions(targetAction, sourceAction) {
|
|
50054
|
+
const { id: targetId, data: targetData, metadata: targetMetadata, timestamp: targetTimestamp, } = targetAction;
|
|
50055
|
+
const { method: targetMethod, body: targetBody } = targetData;
|
|
50056
|
+
const { data: sourceData, metadata: sourceMetadata } = sourceAction;
|
|
50057
|
+
const { method: sourceMethod, body: sourceBody } = sourceData;
|
|
50058
|
+
if (targetMethod.toLowerCase() === 'delete' || sourceMethod.toLowerCase() === 'delete') {
|
|
50059
|
+
throw Error('Cannot merge DELETE actions.');
|
|
50060
|
+
}
|
|
50061
|
+
if (targetMethod.toLowerCase() === 'patch' && sourceMethod.toLowerCase() === 'post') {
|
|
50062
|
+
// overlaying a POST over a PATCH is not supported
|
|
50063
|
+
throw Error('Cannot merge a POST action over top of a PATCH action.');
|
|
50064
|
+
}
|
|
50065
|
+
// overlay top-level properties, maintain target's timestamp and id
|
|
50066
|
+
const merged = {
|
|
50067
|
+
...targetAction,
|
|
50068
|
+
...sourceAction,
|
|
50069
|
+
timestamp: targetTimestamp,
|
|
50070
|
+
id: targetId,
|
|
50071
|
+
};
|
|
50072
|
+
// overlay data
|
|
50073
|
+
// NOTE: we stick to the target's ResourceRequest properties (except body
|
|
50074
|
+
// which is merged) because we don't want to overwrite a POST with a PATCH
|
|
50075
|
+
// (all other cases should be fine or wouldn't have passed pre-requisites)
|
|
50076
|
+
merged.data = {
|
|
50077
|
+
...targetData,
|
|
50078
|
+
body: this.mergeRequestBody(targetBody, sourceBody),
|
|
50079
|
+
};
|
|
50080
|
+
// overlay metadata
|
|
50081
|
+
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
50082
|
+
return merged;
|
|
50083
|
+
}
|
|
50095
50084
|
shouldDeleteActionByTagOnRemoval(action) {
|
|
50096
50085
|
return action.data.method === 'post';
|
|
50097
50086
|
}
|
|
@@ -55942,68 +55931,17 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55942
55931
|
synchronousIngest(response) {
|
|
55943
55932
|
return this.recordService.synchronousIngestRecord(response);
|
|
55944
55933
|
}
|
|
55945
|
-
|
|
55946
|
-
// NOTE: a lot of the logic in this method could be hoisted to the
|
|
55947
|
-
// AbstractResourceRequestActionHandler, and then some new abstract mergeBody()
|
|
55948
|
-
// method could be called there and implemented here. As of right now there
|
|
55949
|
-
// are no other concrete ResourceRequest handlers implementing mergeActions
|
|
55950
|
-
// so to keep this simple we aren't hoisting the shared stuff yet.
|
|
55951
|
-
const { id: targetId, targetId: targetCacheKey, tag: targetTag, status: targetStatus, data: targetData, metadata: targetMetadata, timestamp: targetTimestamp, version: targetVersion, } = targetAction;
|
|
55952
|
-
const { method: targetMethod, body: targetBody } = targetData;
|
|
55953
|
-
const { targetId: sourceCacheKey, tag: sourceTag, status: sourceStatus, data: sourceData, metadata: sourceMetadata, version: sourceVersion, } = sourceAction;
|
|
55954
|
-
const { method: sourceMethod, body: sourceBody } = sourceData;
|
|
55955
|
-
// pre-requisites
|
|
55956
|
-
if (targetCacheKey !== sourceCacheKey) {
|
|
55957
|
-
throw Error('Cannot merge actions for different targetIds.');
|
|
55958
|
-
}
|
|
55959
|
-
if (targetTag !== sourceTag) {
|
|
55960
|
-
throw Error('Cannot merge actions for different tags.');
|
|
55961
|
-
}
|
|
55962
|
-
if (targetStatus === DraftActionStatus.Completed ||
|
|
55963
|
-
targetStatus === DraftActionStatus.Uploading) {
|
|
55964
|
-
throw Error(`Cannot merge actions when targetAction is in ${targetStatus} status.`);
|
|
55965
|
-
}
|
|
55966
|
-
if (sourceStatus === DraftActionStatus.Completed ||
|
|
55967
|
-
sourceStatus === DraftActionStatus.Uploading) {
|
|
55968
|
-
throw Error(`Cannot merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
55969
|
-
}
|
|
55970
|
-
if (targetMethod.toLowerCase() === 'delete' || sourceMethod.toLowerCase() === 'delete') {
|
|
55971
|
-
throw Error('Cannot merge DELETE actions.');
|
|
55972
|
-
}
|
|
55973
|
-
if (targetMethod.toLowerCase() === 'patch' && sourceMethod.toLowerCase() === 'post') {
|
|
55974
|
-
// overlaying a POST over a PATCH is not supported
|
|
55975
|
-
throw Error('Cannot merge a POST action over top of a PATCH action.');
|
|
55976
|
-
}
|
|
55977
|
-
if (targetVersion !== sourceVersion) {
|
|
55978
|
-
throw Error('Cannot merge actions with different versions.');
|
|
55979
|
-
}
|
|
55980
|
-
// overlay top-level properties, maintain target's timestamp and id
|
|
55981
|
-
const merged = {
|
|
55982
|
-
...targetAction,
|
|
55983
|
-
...sourceAction,
|
|
55984
|
-
timestamp: targetTimestamp,
|
|
55985
|
-
id: targetId,
|
|
55986
|
-
};
|
|
55987
|
-
// overlay data
|
|
55934
|
+
mergeRequestBody(targetBody, sourceBody) {
|
|
55988
55935
|
// IMPORTANT: spread operator isn't deep clone so we have to individually
|
|
55989
55936
|
// spread nested objects (just "fields" for RecordInputReps)
|
|
55990
|
-
|
|
55991
|
-
|
|
55992
|
-
|
|
55993
|
-
|
|
55994
|
-
|
|
55995
|
-
|
|
55996
|
-
...targetBody,
|
|
55997
|
-
...sourceBody,
|
|
55998
|
-
fields: {
|
|
55999
|
-
...targetBody.fields,
|
|
56000
|
-
...sourceBody.fields,
|
|
56001
|
-
},
|
|
55937
|
+
return {
|
|
55938
|
+
...targetBody,
|
|
55939
|
+
...sourceBody,
|
|
55940
|
+
fields: {
|
|
55941
|
+
...targetBody.fields,
|
|
55942
|
+
...sourceBody.fields,
|
|
56002
55943
|
},
|
|
56003
55944
|
};
|
|
56004
|
-
// overlay metadata
|
|
56005
|
-
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
56006
|
-
return merged;
|
|
56007
55945
|
}
|
|
56008
55946
|
}
|
|
56009
55947
|
function isField(key, data) {
|
|
@@ -56518,7 +56456,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
|
|
|
56518
56456
|
});
|
|
56519
56457
|
luvio.storeIngest(key, ingest$x$1, response);
|
|
56520
56458
|
}
|
|
56521
|
-
|
|
56459
|
+
mergeRequestBody() {
|
|
56522
56460
|
throw Error('mergeActions not supported for QuickActionExecutionRepresentationHandler');
|
|
56523
56461
|
}
|
|
56524
56462
|
}
|
|
@@ -57205,7 +57143,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
57205
57143
|
this.binaryStoreUrlsToUpdate.set(fileReference.handle, versionDataUrl);
|
|
57206
57144
|
}
|
|
57207
57145
|
}
|
|
57208
|
-
|
|
57146
|
+
mergeRequestBody() {
|
|
57209
57147
|
throw Error('mergeActions not supported for ContentDocumentCompositeRepresentationActionHandler');
|
|
57210
57148
|
}
|
|
57211
57149
|
async ingestResponses(responses, action) {
|
|
@@ -59902,7 +59840,7 @@ register({
|
|
|
59902
59840
|
id: '@salesforce/lds-network-adapter',
|
|
59903
59841
|
instrument: instrument$1,
|
|
59904
59842
|
});
|
|
59905
|
-
// version: 1.124.
|
|
59843
|
+
// version: 1.124.5-f65e6d350
|
|
59906
59844
|
|
|
59907
59845
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59908
59846
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -74167,7 +74105,7 @@ register({
|
|
|
74167
74105
|
configuration: { ...configurationForGraphQLAdapters },
|
|
74168
74106
|
instrument,
|
|
74169
74107
|
});
|
|
74170
|
-
// version: 1.124.
|
|
74108
|
+
// version: 1.124.5-bc91bd7b2
|
|
74171
74109
|
|
|
74172
74110
|
// On core the unstable adapters are re-exported with different names,
|
|
74173
74111
|
|
|
@@ -76296,7 +76234,7 @@ withDefaultLuvio((luvio) => {
|
|
|
76296
76234
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
76297
76235
|
graphQLImperative = ldsAdapter;
|
|
76298
76236
|
});
|
|
76299
|
-
// version: 1.124.
|
|
76237
|
+
// version: 1.124.5-bc91bd7b2
|
|
76300
76238
|
|
|
76301
76239
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
76302
76240
|
__proto__: null,
|
|
@@ -76978,4 +76916,4 @@ const { luvio } = getRuntime();
|
|
|
76978
76916
|
setDefaultLuvio({ luvio });
|
|
76979
76917
|
|
|
76980
76918
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
76981
|
-
// version: 1.124.
|
|
76919
|
+
// version: 1.124.5-f65e6d350
|
|
@@ -3782,7 +3782,7 @@
|
|
|
3782
3782
|
}
|
|
3783
3783
|
callbacks.push(callback);
|
|
3784
3784
|
}
|
|
3785
|
-
// version: 1.124.
|
|
3785
|
+
// version: 1.124.5-f65e6d350
|
|
3786
3786
|
|
|
3787
3787
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3788
3788
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15206,7 +15206,7 @@
|
|
|
15206
15206
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15207
15207
|
return luvioDocumentNode;
|
|
15208
15208
|
}
|
|
15209
|
-
// version: 1.124.
|
|
15209
|
+
// version: 1.124.5-f65e6d350
|
|
15210
15210
|
|
|
15211
15211
|
function unwrap(data) {
|
|
15212
15212
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16119,7 +16119,7 @@
|
|
|
16119
16119
|
const { apiFamily, name } = metadata;
|
|
16120
16120
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16121
16121
|
}
|
|
16122
|
-
// version: 1.124.
|
|
16122
|
+
// version: 1.124.5-f65e6d350
|
|
16123
16123
|
|
|
16124
16124
|
/**
|
|
16125
16125
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44353,7 +44353,7 @@
|
|
|
44353
44353
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44354
44354
|
});
|
|
44355
44355
|
});
|
|
44356
|
-
// version: 1.124.
|
|
44356
|
+
// version: 1.124.5-bc91bd7b2
|
|
44357
44357
|
|
|
44358
44358
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44359
44359
|
|
|
@@ -49181,10 +49181,6 @@
|
|
|
49181
49181
|
});
|
|
49182
49182
|
return queueOperations;
|
|
49183
49183
|
};
|
|
49184
|
-
const replaceAction = (actionId, _withActionId, _uploadingActionId, _actions) => {
|
|
49185
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
49186
|
-
throw new Error(`${actionId} does not support action replacing. You can only delete ${actionId}`);
|
|
49187
|
-
};
|
|
49188
49184
|
const getRedirectMappings = (_action) => {
|
|
49189
49185
|
return undefined;
|
|
49190
49186
|
};
|
|
@@ -49196,7 +49192,9 @@
|
|
|
49196
49192
|
handleAction: handle,
|
|
49197
49193
|
buildPendingAction,
|
|
49198
49194
|
getQueueOperationsForCompletingDrafts: getQueueOperationsForCompletingDrafts,
|
|
49199
|
-
handleReplaceAction:
|
|
49195
|
+
handleReplaceAction: () => {
|
|
49196
|
+
throw Error('replaceAction not supported for custom actions');
|
|
49197
|
+
},
|
|
49200
49198
|
getRedirectMappings,
|
|
49201
49199
|
handleActionRemoved: () => Promise.resolve(),
|
|
49202
49200
|
handleActionCompleted: () => Promise.resolve(),
|
|
@@ -49263,13 +49261,13 @@
|
|
|
49263
49261
|
this.userState = DraftQueueState.Started;
|
|
49264
49262
|
if (this.state === DraftQueueState.Started) {
|
|
49265
49263
|
// Do nothing if the queue state is already started
|
|
49266
|
-
return
|
|
49264
|
+
return;
|
|
49267
49265
|
}
|
|
49268
49266
|
if (this.replacingAction !== undefined) {
|
|
49269
49267
|
// If we're replacing an action do nothing
|
|
49270
49268
|
// replace will restart the queue for us as long as the user
|
|
49271
49269
|
// has last set the queue to be started
|
|
49272
|
-
return
|
|
49270
|
+
return;
|
|
49273
49271
|
}
|
|
49274
49272
|
this.retryIntervalMilliseconds = 0;
|
|
49275
49273
|
this.state = DraftQueueState.Started;
|
|
@@ -49509,92 +49507,11 @@
|
|
|
49509
49507
|
await this.startQueue();
|
|
49510
49508
|
}
|
|
49511
49509
|
}
|
|
49512
|
-
replaceAction(
|
|
49513
|
-
|
|
49514
|
-
if (actionId === withActionId) {
|
|
49515
|
-
return Promise.reject('Swapped and swapping action ids cannot be the same');
|
|
49516
|
-
}
|
|
49517
|
-
// cannot have a replace action already in progress
|
|
49518
|
-
if (this.replacingAction !== undefined) {
|
|
49519
|
-
return Promise.reject('Cannot replace actions while a replace action is in progress');
|
|
49520
|
-
}
|
|
49521
|
-
this.stopQueueManually();
|
|
49522
|
-
const replacing = this.getQueueActions().then(async (actions) => {
|
|
49523
|
-
const first = actions.filter((action) => action.id === actionId)[0];
|
|
49524
|
-
if (first === undefined) {
|
|
49525
|
-
this.replacingAction = undefined;
|
|
49526
|
-
await this.startQueueSafe();
|
|
49527
|
-
return Promise.reject('No action to replace');
|
|
49528
|
-
}
|
|
49529
|
-
// put in a try/finally block so we don't leave this.replacingAction
|
|
49530
|
-
// indefinitely set
|
|
49531
|
-
let actionToReplace;
|
|
49532
|
-
try {
|
|
49533
|
-
const replaceResult = this.getHandler(first.handler).handleReplaceAction(actionId, withActionId, this.uploadingActionId, actions);
|
|
49534
|
-
actionToReplace = replaceResult.actionToReplace;
|
|
49535
|
-
// TODO [W-8873834]: Will add batching support to durable store
|
|
49536
|
-
// we should use that here to remove and set both actions in one operation
|
|
49537
|
-
await this.removeDraftAction(replaceResult.replacingAction.id);
|
|
49538
|
-
await this.draftStore.writeAction(actionToReplace);
|
|
49539
|
-
await this.notifyChangedListeners({
|
|
49540
|
-
type: DraftQueueEventType.ActionUpdated,
|
|
49541
|
-
action: actionToReplace,
|
|
49542
|
-
});
|
|
49543
|
-
}
|
|
49544
|
-
finally {
|
|
49545
|
-
this.replacingAction = undefined;
|
|
49546
|
-
}
|
|
49547
|
-
await this.startQueueSafe();
|
|
49548
|
-
return actionToReplace;
|
|
49549
|
-
});
|
|
49550
|
-
this.replacingAction = replacing;
|
|
49551
|
-
return replacing;
|
|
49510
|
+
replaceAction(targetActionId, sourceActionId) {
|
|
49511
|
+
return this.replaceOrMergeActions(targetActionId, sourceActionId, false);
|
|
49552
49512
|
}
|
|
49553
49513
|
mergeActions(targetActionId, sourceActionId) {
|
|
49554
|
-
|
|
49555
|
-
if (targetActionId === sourceActionId) {
|
|
49556
|
-
return Promise.reject(new Error('targetActionId and sourceActionId cannot be the same.'));
|
|
49557
|
-
}
|
|
49558
|
-
// cannot have a replace action already in progress
|
|
49559
|
-
if (this.replacingAction !== undefined) {
|
|
49560
|
-
return Promise.reject(new Error('Cannot merge actions while a replace/merge action operation is in progress.'));
|
|
49561
|
-
}
|
|
49562
|
-
this.stopQueueManually();
|
|
49563
|
-
const promise = this.getQueueActions().then(async (actions) => {
|
|
49564
|
-
const target = actions.find((action) => action.id === targetActionId);
|
|
49565
|
-
if (target === undefined) {
|
|
49566
|
-
this.replacingAction = undefined;
|
|
49567
|
-
await this.startQueueSafe();
|
|
49568
|
-
throw Error('targetActionId not found in the draft queue.');
|
|
49569
|
-
}
|
|
49570
|
-
const source = actions.find((action) => action.id === sourceActionId);
|
|
49571
|
-
if (source === undefined) {
|
|
49572
|
-
this.replacingAction = undefined;
|
|
49573
|
-
await this.startQueueSafe();
|
|
49574
|
-
throw Error('sourceActionId not found in the draft queue.');
|
|
49575
|
-
}
|
|
49576
|
-
// put in a try/finally block so we don't leave this.replacingAction
|
|
49577
|
-
// indefinitely set
|
|
49578
|
-
let merged;
|
|
49579
|
-
try {
|
|
49580
|
-
merged = this.getHandler(target.handler).mergeActions(target, source);
|
|
49581
|
-
// update the target
|
|
49582
|
-
await this.draftStore.writeAction(merged);
|
|
49583
|
-
await this.notifyChangedListeners({
|
|
49584
|
-
type: DraftQueueEventType.ActionUpdated,
|
|
49585
|
-
action: merged,
|
|
49586
|
-
});
|
|
49587
|
-
// remove the source from queue
|
|
49588
|
-
await this.removeDraftAction(sourceActionId);
|
|
49589
|
-
}
|
|
49590
|
-
finally {
|
|
49591
|
-
this.replacingAction = undefined;
|
|
49592
|
-
}
|
|
49593
|
-
await this.startQueueSafe();
|
|
49594
|
-
return merged;
|
|
49595
|
-
});
|
|
49596
|
-
this.replacingAction = promise;
|
|
49597
|
-
return promise;
|
|
49514
|
+
return this.replaceOrMergeActions(targetActionId, sourceActionId, true);
|
|
49598
49515
|
}
|
|
49599
49516
|
async setMetadata(actionId, metadata) {
|
|
49600
49517
|
const keys$1 = keys$4(metadata);
|
|
@@ -49629,6 +49546,81 @@
|
|
|
49629
49546
|
}
|
|
49630
49547
|
}, this.retryIntervalMilliseconds);
|
|
49631
49548
|
}
|
|
49549
|
+
async getActionsForReplaceOrMerge(targetActionId, sourceActionId) {
|
|
49550
|
+
const actions = await this.getQueueActions();
|
|
49551
|
+
const target = actions.find((action) => action.id === targetActionId);
|
|
49552
|
+
if (target === undefined) {
|
|
49553
|
+
this.replacingAction = undefined;
|
|
49554
|
+
await this.startQueueSafe();
|
|
49555
|
+
throw Error(`targetActionId ${targetActionId} not found in the draft queue.`);
|
|
49556
|
+
}
|
|
49557
|
+
const source = actions.find((action) => action.id === sourceActionId);
|
|
49558
|
+
if (source === undefined) {
|
|
49559
|
+
this.replacingAction = undefined;
|
|
49560
|
+
await this.startQueueSafe();
|
|
49561
|
+
throw Error(`sourceActionId ${sourceActionId} not found in the draft queue.`);
|
|
49562
|
+
}
|
|
49563
|
+
return { target, source };
|
|
49564
|
+
}
|
|
49565
|
+
assertReplaceOrMergePrerequisites(target, source) {
|
|
49566
|
+
// ensure actions are in a state to be replaced/merged
|
|
49567
|
+
const { targetId: targetCacheKey, tag: targetTag, status: targetStatus, version: targetVersion, } = target;
|
|
49568
|
+
const { targetId: sourceCacheKey, tag: sourceTag, status: sourceStatus, version: sourceVersion, } = source;
|
|
49569
|
+
if (targetCacheKey !== sourceCacheKey) {
|
|
49570
|
+
throw Error('Cannot replace/merge actions for different targetIds.');
|
|
49571
|
+
}
|
|
49572
|
+
if (targetTag !== sourceTag) {
|
|
49573
|
+
throw Error('Cannot replace/merge actions for different tags.');
|
|
49574
|
+
}
|
|
49575
|
+
if (targetStatus === DraftActionStatus.Completed ||
|
|
49576
|
+
targetStatus === DraftActionStatus.Uploading) {
|
|
49577
|
+
throw Error(`Cannot replace/merge actions when targetAction is in ${targetStatus} status.`);
|
|
49578
|
+
}
|
|
49579
|
+
if (sourceStatus !== DraftActionStatus.Pending) {
|
|
49580
|
+
throw Error(`Cannot replace/merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
49581
|
+
}
|
|
49582
|
+
if (targetVersion !== sourceVersion) {
|
|
49583
|
+
throw Error('Cannot replace/merge actions with different versions.');
|
|
49584
|
+
}
|
|
49585
|
+
}
|
|
49586
|
+
async replaceOrMergeActions(targetActionId, sourceActionId, merge) {
|
|
49587
|
+
// ids must be unique
|
|
49588
|
+
if (targetActionId === sourceActionId) {
|
|
49589
|
+
throw Error('targetActionId and sourceActionId cannot be the same.');
|
|
49590
|
+
}
|
|
49591
|
+
// cannot have a replace action already in progress
|
|
49592
|
+
if (this.replacingAction !== undefined) {
|
|
49593
|
+
throw Error('Cannot replace/merge actions while a replace/merge action operation is in progress.');
|
|
49594
|
+
}
|
|
49595
|
+
this.stopQueueManually();
|
|
49596
|
+
const promise = this.getActionsForReplaceOrMerge(targetActionId, sourceActionId).then(async ({ target, source }) => {
|
|
49597
|
+
// put in a try/finally block so we don't leave this.replacingAction
|
|
49598
|
+
// indefinitely set
|
|
49599
|
+
let updatedTarget;
|
|
49600
|
+
try {
|
|
49601
|
+
this.assertReplaceOrMergePrerequisites(target, source);
|
|
49602
|
+
const handler = this.getHandler(target.handler);
|
|
49603
|
+
updatedTarget = merge
|
|
49604
|
+
? handler.mergeActions(target, source)
|
|
49605
|
+
: handler.handleReplaceAction(target, source);
|
|
49606
|
+
// update the target
|
|
49607
|
+
await this.draftStore.writeAction(updatedTarget);
|
|
49608
|
+
await this.notifyChangedListeners({
|
|
49609
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
49610
|
+
action: updatedTarget,
|
|
49611
|
+
});
|
|
49612
|
+
// remove the source from queue
|
|
49613
|
+
await this.removeDraftAction(sourceActionId);
|
|
49614
|
+
}
|
|
49615
|
+
finally {
|
|
49616
|
+
this.replacingAction = undefined;
|
|
49617
|
+
await this.startQueueSafe();
|
|
49618
|
+
}
|
|
49619
|
+
return updatedTarget;
|
|
49620
|
+
});
|
|
49621
|
+
this.replacingAction = promise;
|
|
49622
|
+
return promise;
|
|
49623
|
+
}
|
|
49632
49624
|
}
|
|
49633
49625
|
|
|
49634
49626
|
const DRAFT_ACTION_KEY_JUNCTION = '__DraftAction__';
|
|
@@ -50048,56 +50040,53 @@
|
|
|
50048
50040
|
}
|
|
50049
50041
|
await this.ingestResponses(recordsToIngest, action);
|
|
50050
50042
|
}
|
|
50051
|
-
handleReplaceAction(
|
|
50052
|
-
// get the action to replace
|
|
50053
|
-
const actionToReplace = actions.filter((action) => action.id === actionId)[0];
|
|
50054
|
-
// get the replacing action
|
|
50055
|
-
const replacingAction = actions.filter((action) => action.id === withActionId)[0];
|
|
50056
|
-
// reject if either action is undefined
|
|
50057
|
-
if (actionToReplace === undefined || replacingAction === undefined) {
|
|
50058
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50059
|
-
throw new Error('One or both actions does not exist');
|
|
50060
|
-
}
|
|
50061
|
-
// reject if either action is uploading
|
|
50062
|
-
if (actionToReplace.id === uploadingActionId || replacingAction.id === uploadingActionId) {
|
|
50063
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50064
|
-
throw new Error('Cannot replace an draft action that is uploading');
|
|
50065
|
-
}
|
|
50066
|
-
// reject if these two draft actions aren't acting on the same target
|
|
50067
|
-
if (actionToReplace.tag !== replacingAction.tag) {
|
|
50068
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50069
|
-
throw new Error('Cannot swap actions targeting different targets');
|
|
50070
|
-
}
|
|
50071
|
-
// reject if the replacing action is not pending
|
|
50072
|
-
if (replacingAction.status !== DraftActionStatus.Pending) {
|
|
50073
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
50074
|
-
throw new Error('Cannot replace with a non-pending action');
|
|
50075
|
-
}
|
|
50043
|
+
handleReplaceAction(targetAction, sourceAction) {
|
|
50076
50044
|
//reject if the action to replace is a POST action
|
|
50077
|
-
const pendingAction =
|
|
50045
|
+
const pendingAction = targetAction;
|
|
50078
50046
|
if (pendingAction.data.method === 'post') {
|
|
50079
|
-
|
|
50080
|
-
throw new Error('Cannot replace a POST action');
|
|
50047
|
+
throw Error('Cannot replace a POST action');
|
|
50081
50048
|
}
|
|
50082
|
-
if (this.isActionOfType(
|
|
50083
|
-
this.isActionOfType(
|
|
50084
|
-
|
|
50085
|
-
|
|
50086
|
-
|
|
50087
|
-
};
|
|
50088
|
-
actionToReplace.status = DraftActionStatus.Pending;
|
|
50089
|
-
actionToReplace.data = replacingAction.data;
|
|
50090
|
-
return {
|
|
50091
|
-
original: actionToReplaceCopy,
|
|
50092
|
-
actionToReplace: actionToReplace,
|
|
50093
|
-
replacingAction: replacingAction,
|
|
50094
|
-
};
|
|
50049
|
+
if (this.isActionOfType(targetAction) &&
|
|
50050
|
+
this.isActionOfType(sourceAction)) {
|
|
50051
|
+
targetAction.status = DraftActionStatus.Pending;
|
|
50052
|
+
targetAction.data = sourceAction.data;
|
|
50053
|
+
return targetAction;
|
|
50095
50054
|
}
|
|
50096
50055
|
else {
|
|
50097
|
-
|
|
50098
|
-
throw new Error('Incompatible Action types to replace one another');
|
|
50056
|
+
throw Error('Incompatible Action types to replace one another');
|
|
50099
50057
|
}
|
|
50100
50058
|
}
|
|
50059
|
+
mergeActions(targetAction, sourceAction) {
|
|
50060
|
+
const { id: targetId, data: targetData, metadata: targetMetadata, timestamp: targetTimestamp, } = targetAction;
|
|
50061
|
+
const { method: targetMethod, body: targetBody } = targetData;
|
|
50062
|
+
const { data: sourceData, metadata: sourceMetadata } = sourceAction;
|
|
50063
|
+
const { method: sourceMethod, body: sourceBody } = sourceData;
|
|
50064
|
+
if (targetMethod.toLowerCase() === 'delete' || sourceMethod.toLowerCase() === 'delete') {
|
|
50065
|
+
throw Error('Cannot merge DELETE actions.');
|
|
50066
|
+
}
|
|
50067
|
+
if (targetMethod.toLowerCase() === 'patch' && sourceMethod.toLowerCase() === 'post') {
|
|
50068
|
+
// overlaying a POST over a PATCH is not supported
|
|
50069
|
+
throw Error('Cannot merge a POST action over top of a PATCH action.');
|
|
50070
|
+
}
|
|
50071
|
+
// overlay top-level properties, maintain target's timestamp and id
|
|
50072
|
+
const merged = {
|
|
50073
|
+
...targetAction,
|
|
50074
|
+
...sourceAction,
|
|
50075
|
+
timestamp: targetTimestamp,
|
|
50076
|
+
id: targetId,
|
|
50077
|
+
};
|
|
50078
|
+
// overlay data
|
|
50079
|
+
// NOTE: we stick to the target's ResourceRequest properties (except body
|
|
50080
|
+
// which is merged) because we don't want to overwrite a POST with a PATCH
|
|
50081
|
+
// (all other cases should be fine or wouldn't have passed pre-requisites)
|
|
50082
|
+
merged.data = {
|
|
50083
|
+
...targetData,
|
|
50084
|
+
body: this.mergeRequestBody(targetBody, sourceBody),
|
|
50085
|
+
};
|
|
50086
|
+
// overlay metadata
|
|
50087
|
+
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
50088
|
+
return merged;
|
|
50089
|
+
}
|
|
50101
50090
|
shouldDeleteActionByTagOnRemoval(action) {
|
|
50102
50091
|
return action.data.method === 'post';
|
|
50103
50092
|
}
|
|
@@ -55948,68 +55937,17 @@
|
|
|
55948
55937
|
synchronousIngest(response) {
|
|
55949
55938
|
return this.recordService.synchronousIngestRecord(response);
|
|
55950
55939
|
}
|
|
55951
|
-
|
|
55952
|
-
// NOTE: a lot of the logic in this method could be hoisted to the
|
|
55953
|
-
// AbstractResourceRequestActionHandler, and then some new abstract mergeBody()
|
|
55954
|
-
// method could be called there and implemented here. As of right now there
|
|
55955
|
-
// are no other concrete ResourceRequest handlers implementing mergeActions
|
|
55956
|
-
// so to keep this simple we aren't hoisting the shared stuff yet.
|
|
55957
|
-
const { id: targetId, targetId: targetCacheKey, tag: targetTag, status: targetStatus, data: targetData, metadata: targetMetadata, timestamp: targetTimestamp, version: targetVersion, } = targetAction;
|
|
55958
|
-
const { method: targetMethod, body: targetBody } = targetData;
|
|
55959
|
-
const { targetId: sourceCacheKey, tag: sourceTag, status: sourceStatus, data: sourceData, metadata: sourceMetadata, version: sourceVersion, } = sourceAction;
|
|
55960
|
-
const { method: sourceMethod, body: sourceBody } = sourceData;
|
|
55961
|
-
// pre-requisites
|
|
55962
|
-
if (targetCacheKey !== sourceCacheKey) {
|
|
55963
|
-
throw Error('Cannot merge actions for different targetIds.');
|
|
55964
|
-
}
|
|
55965
|
-
if (targetTag !== sourceTag) {
|
|
55966
|
-
throw Error('Cannot merge actions for different tags.');
|
|
55967
|
-
}
|
|
55968
|
-
if (targetStatus === DraftActionStatus.Completed ||
|
|
55969
|
-
targetStatus === DraftActionStatus.Uploading) {
|
|
55970
|
-
throw Error(`Cannot merge actions when targetAction is in ${targetStatus} status.`);
|
|
55971
|
-
}
|
|
55972
|
-
if (sourceStatus === DraftActionStatus.Completed ||
|
|
55973
|
-
sourceStatus === DraftActionStatus.Uploading) {
|
|
55974
|
-
throw Error(`Cannot merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
55975
|
-
}
|
|
55976
|
-
if (targetMethod.toLowerCase() === 'delete' || sourceMethod.toLowerCase() === 'delete') {
|
|
55977
|
-
throw Error('Cannot merge DELETE actions.');
|
|
55978
|
-
}
|
|
55979
|
-
if (targetMethod.toLowerCase() === 'patch' && sourceMethod.toLowerCase() === 'post') {
|
|
55980
|
-
// overlaying a POST over a PATCH is not supported
|
|
55981
|
-
throw Error('Cannot merge a POST action over top of a PATCH action.');
|
|
55982
|
-
}
|
|
55983
|
-
if (targetVersion !== sourceVersion) {
|
|
55984
|
-
throw Error('Cannot merge actions with different versions.');
|
|
55985
|
-
}
|
|
55986
|
-
// overlay top-level properties, maintain target's timestamp and id
|
|
55987
|
-
const merged = {
|
|
55988
|
-
...targetAction,
|
|
55989
|
-
...sourceAction,
|
|
55990
|
-
timestamp: targetTimestamp,
|
|
55991
|
-
id: targetId,
|
|
55992
|
-
};
|
|
55993
|
-
// overlay data
|
|
55940
|
+
mergeRequestBody(targetBody, sourceBody) {
|
|
55994
55941
|
// IMPORTANT: spread operator isn't deep clone so we have to individually
|
|
55995
55942
|
// spread nested objects (just "fields" for RecordInputReps)
|
|
55996
|
-
|
|
55997
|
-
|
|
55998
|
-
|
|
55999
|
-
|
|
56000
|
-
|
|
56001
|
-
|
|
56002
|
-
...targetBody,
|
|
56003
|
-
...sourceBody,
|
|
56004
|
-
fields: {
|
|
56005
|
-
...targetBody.fields,
|
|
56006
|
-
...sourceBody.fields,
|
|
56007
|
-
},
|
|
55943
|
+
return {
|
|
55944
|
+
...targetBody,
|
|
55945
|
+
...sourceBody,
|
|
55946
|
+
fields: {
|
|
55947
|
+
...targetBody.fields,
|
|
55948
|
+
...sourceBody.fields,
|
|
56008
55949
|
},
|
|
56009
55950
|
};
|
|
56010
|
-
// overlay metadata
|
|
56011
|
-
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
56012
|
-
return merged;
|
|
56013
55951
|
}
|
|
56014
55952
|
}
|
|
56015
55953
|
function isField(key, data) {
|
|
@@ -56524,7 +56462,7 @@
|
|
|
56524
56462
|
});
|
|
56525
56463
|
luvio.storeIngest(key, ingest$x$1, response);
|
|
56526
56464
|
}
|
|
56527
|
-
|
|
56465
|
+
mergeRequestBody() {
|
|
56528
56466
|
throw Error('mergeActions not supported for QuickActionExecutionRepresentationHandler');
|
|
56529
56467
|
}
|
|
56530
56468
|
}
|
|
@@ -57211,7 +57149,7 @@
|
|
|
57211
57149
|
this.binaryStoreUrlsToUpdate.set(fileReference.handle, versionDataUrl);
|
|
57212
57150
|
}
|
|
57213
57151
|
}
|
|
57214
|
-
|
|
57152
|
+
mergeRequestBody() {
|
|
57215
57153
|
throw Error('mergeActions not supported for ContentDocumentCompositeRepresentationActionHandler');
|
|
57216
57154
|
}
|
|
57217
57155
|
async ingestResponses(responses, action) {
|
|
@@ -59908,7 +59846,7 @@
|
|
|
59908
59846
|
id: '@salesforce/lds-network-adapter',
|
|
59909
59847
|
instrument: instrument$1,
|
|
59910
59848
|
});
|
|
59911
|
-
// version: 1.124.
|
|
59849
|
+
// version: 1.124.5-f65e6d350
|
|
59912
59850
|
|
|
59913
59851
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59914
59852
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -74173,7 +74111,7 @@
|
|
|
74173
74111
|
configuration: { ...configurationForGraphQLAdapters },
|
|
74174
74112
|
instrument,
|
|
74175
74113
|
});
|
|
74176
|
-
// version: 1.124.
|
|
74114
|
+
// version: 1.124.5-bc91bd7b2
|
|
74177
74115
|
|
|
74178
74116
|
// On core the unstable adapters are re-exported with different names,
|
|
74179
74117
|
|
|
@@ -76302,7 +76240,7 @@
|
|
|
76302
76240
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
76303
76241
|
graphQLImperative = ldsAdapter;
|
|
76304
76242
|
});
|
|
76305
|
-
// version: 1.124.
|
|
76243
|
+
// version: 1.124.5-bc91bd7b2
|
|
76306
76244
|
|
|
76307
76245
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
76308
76246
|
__proto__: null,
|
|
@@ -77001,4 +76939,4 @@
|
|
|
77001
76939
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
77002
76940
|
|
|
77003
76941
|
}));
|
|
77004
|
-
// version: 1.124.
|
|
76942
|
+
// version: 1.124.5-f65e6d350
|