@salesforce/lds-worker-api 1.100.3 → 1.100.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.
- package/dist/sfdc/es/ldsWorkerApi.js +2 -2
- package/dist/standalone/es/lds-worker-api.js +193 -159
- package/dist/standalone/umd/lds-worker-api.js +193 -159
- package/package.json +10 -10
|
@@ -623,7 +623,7 @@ function executeMutatingAdapter(adapterId, config, onResult, nativeAdapterReques
|
|
|
623
623
|
|
|
624
624
|
/* istanbul ignore file */
|
|
625
625
|
// A allowlist of methods that we allow to be proxied from another LDS instance
|
|
626
|
-
const allowList = ['enqueue', 'getQueueActions'
|
|
626
|
+
const allowList = ['enqueue', 'getQueueActions'];
|
|
627
627
|
/**
|
|
628
628
|
* Implements the DraftQueue interface from nimbus-plugin-lds by passing requests
|
|
629
629
|
* to the instance of the lds-drafts' DraftQueue implementation
|
|
@@ -743,4 +743,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
743
743
|
}
|
|
744
744
|
|
|
745
745
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
746
|
-
// version: 1.100.
|
|
746
|
+
// version: 1.100.5-bd2d67d6a
|
|
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
callbacks.push(callback);
|
|
3778
3778
|
}
|
|
3779
|
-
// version: 1.100.
|
|
3779
|
+
// version: 1.100.5-bd2d67d6a
|
|
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.100.
|
|
15203
|
+
// version: 1.100.5-bd2d67d6a
|
|
15204
15204
|
|
|
15205
15205
|
function unwrap(data) {
|
|
15206
15206
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16081,7 +16081,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata) {
|
|
|
16081
16081
|
const { apiFamily, name } = metadata;
|
|
16082
16082
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16083
16083
|
}
|
|
16084
|
-
// version: 1.100.
|
|
16084
|
+
// version: 1.100.5-bd2d67d6a
|
|
16085
16085
|
|
|
16086
16086
|
/**
|
|
16087
16087
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -43634,7 +43634,7 @@ withDefaultLuvio((luvio) => {
|
|
|
43634
43634
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
43635
43635
|
});
|
|
43636
43636
|
});
|
|
43637
|
-
// version: 1.100.
|
|
43637
|
+
// version: 1.100.5-bd2d67d6a
|
|
43638
43638
|
|
|
43639
43639
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
43640
43640
|
|
|
@@ -48006,6 +48006,44 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
|
|
|
48006
48006
|
return wrapStartEndEvents(storeEval);
|
|
48007
48007
|
}
|
|
48008
48008
|
|
|
48009
|
+
/**
|
|
48010
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48011
|
+
* All rights reserved.
|
|
48012
|
+
* For full license text, see the LICENSE.txt file
|
|
48013
|
+
*/
|
|
48014
|
+
|
|
48015
|
+
class AsyncWorkerPool {
|
|
48016
|
+
constructor(concurrency) {
|
|
48017
|
+
this.queue = [];
|
|
48018
|
+
this.activeWorkers = 0;
|
|
48019
|
+
this.concurrency = concurrency;
|
|
48020
|
+
}
|
|
48021
|
+
push(workFn) {
|
|
48022
|
+
return new Promise((resolve, reject) => {
|
|
48023
|
+
this.queue.push(async () => {
|
|
48024
|
+
return workFn().then(resolve).catch(reject);
|
|
48025
|
+
});
|
|
48026
|
+
this.work();
|
|
48027
|
+
});
|
|
48028
|
+
}
|
|
48029
|
+
cancel() {
|
|
48030
|
+
this.queue = [];
|
|
48031
|
+
// TODO [W-12513105]: thread cancellation through to active workers
|
|
48032
|
+
}
|
|
48033
|
+
work() {
|
|
48034
|
+
while (this.queue.length > 0 && this.activeWorkers < this.concurrency) {
|
|
48035
|
+
this.activeWorkers += 1;
|
|
48036
|
+
const next = this.queue.shift();
|
|
48037
|
+
if (next) {
|
|
48038
|
+
next().finally(() => {
|
|
48039
|
+
this.activeWorkers -= 1;
|
|
48040
|
+
this.work();
|
|
48041
|
+
});
|
|
48042
|
+
}
|
|
48043
|
+
}
|
|
48044
|
+
}
|
|
48045
|
+
}
|
|
48046
|
+
|
|
48009
48047
|
/**
|
|
48010
48048
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48011
48049
|
* All rights reserved.
|
|
@@ -48190,14 +48228,13 @@ const { isArray: isArray$3 } = Array;
|
|
|
48190
48228
|
function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromCacheKey, options = {}) {
|
|
48191
48229
|
// override this to create and enqueue a new draft action, and return synthetic response
|
|
48192
48230
|
const dispatchResourceRequest = async function (resourceRequest, _context) {
|
|
48193
|
-
const
|
|
48231
|
+
const { data } = await handler.enqueue(resourceRequest).catch((err) => {
|
|
48194
48232
|
throw transformErrorToDraftSynthesisError(err);
|
|
48195
48233
|
});
|
|
48196
|
-
|
|
48197
|
-
if (record === undefined) {
|
|
48234
|
+
if (data === undefined) {
|
|
48198
48235
|
return Promise.reject(createDraftSynthesisErrorResponse());
|
|
48199
48236
|
}
|
|
48200
|
-
return createOkResponse(
|
|
48237
|
+
return createOkResponse(data);
|
|
48201
48238
|
};
|
|
48202
48239
|
// override this to use an infinitely large ttl so the cache entry never expires
|
|
48203
48240
|
const publishStoreMetadata = function (key, storeMetadataParams) {
|
|
@@ -48424,6 +48461,7 @@ class DurableDraftQueue {
|
|
|
48424
48461
|
this.timeoutHandler = undefined;
|
|
48425
48462
|
this.handlers = {};
|
|
48426
48463
|
this.draftStore = draftStore;
|
|
48464
|
+
this.workerPool = new AsyncWorkerPool(1);
|
|
48427
48465
|
}
|
|
48428
48466
|
addHandler(handler) {
|
|
48429
48467
|
const id = handler.handlerId;
|
|
@@ -48441,10 +48479,6 @@ class DurableDraftQueue {
|
|
|
48441
48479
|
const handler = customActionHandler(executor, id, this);
|
|
48442
48480
|
return this.addHandler(handler);
|
|
48443
48481
|
}
|
|
48444
|
-
async getDataForAction(action) {
|
|
48445
|
-
const handler = this.getHandler(action.handler);
|
|
48446
|
-
return handler.getDataForAction(action);
|
|
48447
|
-
}
|
|
48448
48482
|
getQueueState() {
|
|
48449
48483
|
return this.state;
|
|
48450
48484
|
}
|
|
@@ -48523,20 +48557,26 @@ class DurableDraftQueue {
|
|
|
48523
48557
|
});
|
|
48524
48558
|
}
|
|
48525
48559
|
async enqueue(handlerId, data) {
|
|
48526
|
-
|
|
48527
|
-
|
|
48528
|
-
|
|
48529
|
-
|
|
48530
|
-
|
|
48531
|
-
|
|
48532
|
-
|
|
48533
|
-
|
|
48560
|
+
return this.workerPool.push(async () => {
|
|
48561
|
+
let queue = await this.getQueueActions();
|
|
48562
|
+
const handler = this.getHandler(handlerId);
|
|
48563
|
+
const pendingAction = (await handler.buildPendingAction(data, queue));
|
|
48564
|
+
await this.draftStore.writeAction(pendingAction);
|
|
48565
|
+
queue = await this.getQueueActions();
|
|
48566
|
+
await this.notifyChangedListeners({
|
|
48567
|
+
type: DraftQueueEventType.ActionAdded,
|
|
48568
|
+
action: pendingAction,
|
|
48569
|
+
});
|
|
48570
|
+
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48571
|
+
if (this.state === DraftQueueState.Started) {
|
|
48572
|
+
this.processNextAction();
|
|
48573
|
+
}
|
|
48574
|
+
const actionData = (await handler.getDataForAction(pendingAction));
|
|
48575
|
+
return {
|
|
48576
|
+
action: pendingAction,
|
|
48577
|
+
data: actionData,
|
|
48578
|
+
};
|
|
48534
48579
|
});
|
|
48535
|
-
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48536
|
-
if (this.state === DraftQueueState.Started) {
|
|
48537
|
-
this.processNextAction();
|
|
48538
|
-
}
|
|
48539
|
-
return pendingAction;
|
|
48540
48580
|
}
|
|
48541
48581
|
registerOnChangedListener(listener) {
|
|
48542
48582
|
this.draftQueueChangedListeners.push(listener);
|
|
@@ -48548,27 +48588,29 @@ class DurableDraftQueue {
|
|
|
48548
48588
|
};
|
|
48549
48589
|
}
|
|
48550
48590
|
async actionCompleted(action) {
|
|
48551
|
-
|
|
48552
|
-
|
|
48553
|
-
|
|
48554
|
-
|
|
48555
|
-
|
|
48556
|
-
|
|
48557
|
-
|
|
48558
|
-
|
|
48591
|
+
return this.workerPool.push(async () => {
|
|
48592
|
+
const handler = this.getHandler(action.handler);
|
|
48593
|
+
let queue = await this.getQueueActions();
|
|
48594
|
+
const queueOperations = handler.getQueueOperationsForCompletingDrafts(queue, action);
|
|
48595
|
+
const idAndKeyMappings = handler.getRedirectMappings(action);
|
|
48596
|
+
const keyMappings = idAndKeyMappings === undefined
|
|
48597
|
+
? undefined
|
|
48598
|
+
: idAndKeyMappings.map((m) => {
|
|
48599
|
+
return { draftKey: m.draftKey, canonicalKey: m.canonicalKey };
|
|
48600
|
+
});
|
|
48601
|
+
await this.draftStore.completeAction(queueOperations, keyMappings);
|
|
48602
|
+
queue = await this.getQueueActions();
|
|
48603
|
+
this.retryIntervalMilliseconds = 0;
|
|
48604
|
+
this.uploadingActionId = undefined;
|
|
48605
|
+
await handler.handleActionCompleted(action, queueOperations, queue, values$1(this.handlers));
|
|
48606
|
+
await this.notifyChangedListeners({
|
|
48607
|
+
type: DraftQueueEventType.ActionCompleted,
|
|
48608
|
+
action,
|
|
48559
48609
|
});
|
|
48560
|
-
|
|
48561
|
-
|
|
48562
|
-
|
|
48563
|
-
this.uploadingActionId = undefined;
|
|
48564
|
-
await handler.handleActionCompleted(action, queueOperations, queue, values$1(this.handlers));
|
|
48565
|
-
await this.notifyChangedListeners({
|
|
48566
|
-
type: DraftQueueEventType.ActionCompleted,
|
|
48567
|
-
action,
|
|
48610
|
+
if (this.state === DraftQueueState.Started) {
|
|
48611
|
+
this.processNextAction();
|
|
48612
|
+
}
|
|
48568
48613
|
});
|
|
48569
|
-
if (this.state === DraftQueueState.Started) {
|
|
48570
|
-
this.processNextAction();
|
|
48571
|
-
}
|
|
48572
48614
|
}
|
|
48573
48615
|
async actionFailed(action, retry) {
|
|
48574
48616
|
this.uploadingActionId = undefined;
|
|
@@ -49004,6 +49046,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
49004
49046
|
this.draftQueue = draftQueue;
|
|
49005
49047
|
this.networkAdapter = networkAdapter;
|
|
49006
49048
|
this.getLuvio = getLuvio;
|
|
49049
|
+
// NOTE[W-12567340]: This property stores in-memory mappings between draft
|
|
49050
|
+
// ids and canonical ids for the current session. Having a local copy of
|
|
49051
|
+
// these mappings is necessary to avoid a race condition between publishing
|
|
49052
|
+
// new mappings to the durable store and those mappings being loaded into
|
|
49053
|
+
// the luvio store redirect table, during which a new draft might be enqueued
|
|
49054
|
+
// which would not see a necessary mapping.
|
|
49055
|
+
this.ephemeralRedirects = {};
|
|
49007
49056
|
}
|
|
49008
49057
|
enqueue(data) {
|
|
49009
49058
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -49071,7 +49120,8 @@ class AbstractResourceRequestActionHandler {
|
|
|
49071
49120
|
}
|
|
49072
49121
|
getQueueOperationsForCompletingDrafts(queue, action) {
|
|
49073
49122
|
const queueOperations = [];
|
|
49074
|
-
|
|
49123
|
+
const redirects = this.getRedirectMappings(action);
|
|
49124
|
+
if (redirects !== undefined) {
|
|
49075
49125
|
const { length } = queue;
|
|
49076
49126
|
for (let i = 0; i < length; i++) {
|
|
49077
49127
|
const queueAction = queue[i];
|
|
@@ -49081,69 +49131,64 @@ class AbstractResourceRequestActionHandler {
|
|
|
49081
49131
|
continue;
|
|
49082
49132
|
}
|
|
49083
49133
|
if (isResourceRequestAction(queueAction)) {
|
|
49084
|
-
|
|
49085
|
-
|
|
49086
|
-
|
|
49087
|
-
|
|
49088
|
-
|
|
49089
|
-
|
|
49090
|
-
|
|
49091
|
-
|
|
49092
|
-
|
|
49093
|
-
|
|
49094
|
-
|
|
49095
|
-
|
|
49096
|
-
|
|
49097
|
-
basePath = basePath.replace(draftId, canonicalId);
|
|
49098
|
-
stringifiedBody = stringifiedBody.replace(draftId, canonicalId);
|
|
49099
|
-
queueOperationMutated = true;
|
|
49100
|
-
}
|
|
49101
|
-
// if the action is performed on a previous draft id, we need to replace the action
|
|
49102
|
-
// with a new one at the updated canonical key
|
|
49103
|
-
if (queueActionTag === draftKey) {
|
|
49104
|
-
updatedActionTag = canonicalKey;
|
|
49105
|
-
updatedActionTargetId = canonicalId;
|
|
49106
|
-
}
|
|
49134
|
+
let queueOperationMutated = false;
|
|
49135
|
+
let updatedActionTag = undefined;
|
|
49136
|
+
let updatedActionTargetId = undefined;
|
|
49137
|
+
const { tag: queueActionTag, data: queueActionRequest, id: queueActionId, } = queueAction;
|
|
49138
|
+
let { basePath, body } = queueActionRequest;
|
|
49139
|
+
let stringifiedBody = stringify$4(body);
|
|
49140
|
+
// for each redirected ID/key we loop over the operation to see if it needs
|
|
49141
|
+
// to be updated
|
|
49142
|
+
for (const { draftId, draftKey, canonicalId, canonicalKey } of redirects) {
|
|
49143
|
+
if (basePath.search(draftId) >= 0 || stringifiedBody.search(draftId) >= 0) {
|
|
49144
|
+
basePath = basePath.replace(draftId, canonicalId);
|
|
49145
|
+
stringifiedBody = stringifiedBody.replace(draftId, canonicalId);
|
|
49146
|
+
queueOperationMutated = true;
|
|
49107
49147
|
}
|
|
49108
|
-
if
|
|
49109
|
-
|
|
49110
|
-
|
|
49111
|
-
|
|
49112
|
-
|
|
49113
|
-
|
|
49114
|
-
|
|
49115
|
-
|
|
49116
|
-
|
|
49117
|
-
|
|
49118
|
-
|
|
49119
|
-
|
|
49120
|
-
|
|
49121
|
-
|
|
49122
|
-
|
|
49123
|
-
|
|
49124
|
-
|
|
49125
|
-
}
|
|
49126
|
-
|
|
49127
|
-
|
|
49128
|
-
|
|
49129
|
-
|
|
49130
|
-
|
|
49131
|
-
|
|
49132
|
-
|
|
49133
|
-
|
|
49134
|
-
|
|
49135
|
-
|
|
49136
|
-
|
|
49137
|
-
|
|
49138
|
-
|
|
49139
|
-
|
|
49140
|
-
|
|
49141
|
-
|
|
49142
|
-
|
|
49143
|
-
|
|
49144
|
-
|
|
49145
|
-
|
|
49146
|
-
|
|
49148
|
+
// if the action is performed on a previous draft id, we need to replace the action
|
|
49149
|
+
// with a new one at the updated canonical key
|
|
49150
|
+
if (queueActionTag === draftKey) {
|
|
49151
|
+
updatedActionTag = canonicalKey;
|
|
49152
|
+
updatedActionTargetId = canonicalId;
|
|
49153
|
+
}
|
|
49154
|
+
}
|
|
49155
|
+
if (queueOperationMutated) {
|
|
49156
|
+
if (updatedActionTag !== undefined && updatedActionTargetId !== undefined) {
|
|
49157
|
+
const updatedAction = {
|
|
49158
|
+
...queueAction,
|
|
49159
|
+
tag: updatedActionTag,
|
|
49160
|
+
targetId: updatedActionTargetId,
|
|
49161
|
+
data: {
|
|
49162
|
+
...queueActionRequest,
|
|
49163
|
+
basePath: basePath,
|
|
49164
|
+
body: parse$4(stringifiedBody),
|
|
49165
|
+
},
|
|
49166
|
+
};
|
|
49167
|
+
// item needs to be replaced with a new item at the new record key
|
|
49168
|
+
queueOperations.push({
|
|
49169
|
+
type: QueueOperationType.Delete,
|
|
49170
|
+
id: queueActionId,
|
|
49171
|
+
});
|
|
49172
|
+
queueOperations.push({
|
|
49173
|
+
type: QueueOperationType.Add,
|
|
49174
|
+
action: updatedAction,
|
|
49175
|
+
});
|
|
49176
|
+
}
|
|
49177
|
+
else {
|
|
49178
|
+
const updatedAction = {
|
|
49179
|
+
...queueAction,
|
|
49180
|
+
data: {
|
|
49181
|
+
...queueActionRequest,
|
|
49182
|
+
basePath: basePath,
|
|
49183
|
+
body: parse$4(stringifiedBody),
|
|
49184
|
+
},
|
|
49185
|
+
};
|
|
49186
|
+
// item needs to be updated
|
|
49187
|
+
queueOperations.push({
|
|
49188
|
+
type: QueueOperationType.Update,
|
|
49189
|
+
id: queueActionId,
|
|
49190
|
+
action: updatedAction,
|
|
49191
|
+
});
|
|
49147
49192
|
}
|
|
49148
49193
|
}
|
|
49149
49194
|
}
|
|
@@ -49163,6 +49208,9 @@ class AbstractResourceRequestActionHandler {
|
|
|
49163
49208
|
const body = action.response.body;
|
|
49164
49209
|
const canonicalId = this.getIdFromResponseBody(body);
|
|
49165
49210
|
const draftId = action.targetId;
|
|
49211
|
+
if (draftId !== undefined && canonicalId !== undefined && draftId !== canonicalId) {
|
|
49212
|
+
this.ephemeralRedirects[draftId] = canonicalId;
|
|
49213
|
+
}
|
|
49166
49214
|
return [
|
|
49167
49215
|
{
|
|
49168
49216
|
draftId,
|
|
@@ -49457,7 +49505,9 @@ class DraftManager {
|
|
|
49457
49505
|
targetId,
|
|
49458
49506
|
tag,
|
|
49459
49507
|
})
|
|
49460
|
-
.then(
|
|
49508
|
+
.then((result) => {
|
|
49509
|
+
return this.buildDraftQueueItem(result.action);
|
|
49510
|
+
});
|
|
49461
49511
|
}
|
|
49462
49512
|
/**
|
|
49463
49513
|
* Get the current state of each of the DraftActions in the DraftQueue
|
|
@@ -54944,12 +54994,18 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
54944
54994
|
const fieldName = fieldNames[i];
|
|
54945
54995
|
const fieldValue = bodyFields[fieldName];
|
|
54946
54996
|
if (typeof fieldValue === 'string' && this.isDraftId(fieldValue)) {
|
|
54947
|
-
const
|
|
54948
|
-
|
|
54949
|
-
|
|
54950
|
-
|
|
54951
|
-
|
|
54952
|
-
|
|
54997
|
+
const canonicalId = this.ephemeralRedirects[fieldValue];
|
|
54998
|
+
if (canonicalId !== undefined) {
|
|
54999
|
+
bodyFields[fieldName] = canonicalId;
|
|
55000
|
+
}
|
|
55001
|
+
else {
|
|
55002
|
+
const draftKey = this.buildTagForTargetId(fieldValue);
|
|
55003
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
55004
|
+
if (draftKey !== canonicalKey) {
|
|
55005
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
55006
|
+
if (canonicalId !== undefined) {
|
|
55007
|
+
bodyFields[fieldName] = canonicalId;
|
|
55008
|
+
}
|
|
54953
55009
|
}
|
|
54954
55010
|
}
|
|
54955
55011
|
}
|
|
@@ -54957,17 +55013,24 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
54957
55013
|
}
|
|
54958
55014
|
if (request.method === 'patch' || request.method === 'delete') {
|
|
54959
55015
|
const recordId = request.urlParams['recordId'];
|
|
54960
|
-
const
|
|
54961
|
-
|
|
54962
|
-
if (recordKey !== canonicalKey) {
|
|
54963
|
-
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
54964
|
-
if (canonicalId === undefined) {
|
|
54965
|
-
// could not resolve id from request -- return the request un-modified
|
|
54966
|
-
return request;
|
|
54967
|
-
}
|
|
55016
|
+
const canonicalId = this.ephemeralRedirects[recordId];
|
|
55017
|
+
if (canonicalId !== undefined) {
|
|
54968
55018
|
resolvedBasePath = resolvedBasePath.replace(recordId, canonicalId);
|
|
54969
55019
|
resolvedUrlParams = { ...resolvedUrlParams, recordId: canonicalId };
|
|
54970
55020
|
}
|
|
55021
|
+
else {
|
|
55022
|
+
const recordKey = this.buildTagForTargetId(recordId);
|
|
55023
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(recordKey);
|
|
55024
|
+
if (recordKey !== canonicalKey) {
|
|
55025
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
55026
|
+
if (canonicalId === undefined) {
|
|
55027
|
+
// could not resolve id from request -- return the request un-modified
|
|
55028
|
+
return request;
|
|
55029
|
+
}
|
|
55030
|
+
resolvedBasePath = resolvedBasePath.replace(recordId, canonicalId);
|
|
55031
|
+
resolvedUrlParams = { ...resolvedUrlParams, recordId: canonicalId };
|
|
55032
|
+
}
|
|
55033
|
+
}
|
|
54971
55034
|
}
|
|
54972
55035
|
return {
|
|
54973
55036
|
...request,
|
|
@@ -55303,14 +55366,13 @@ function performQuickActionDraftEnvironment(luvio, env, handler) {
|
|
|
55303
55366
|
// only override requests to createRecord endpoint
|
|
55304
55367
|
return env.dispatchResourceRequest(request, context, eventObservers);
|
|
55305
55368
|
}
|
|
55306
|
-
const
|
|
55369
|
+
const { data } = await handler.enqueue(request).catch((err) => {
|
|
55307
55370
|
throw createDraftSynthesisErrorResponse(err.message);
|
|
55308
55371
|
});
|
|
55309
|
-
|
|
55310
|
-
if (record === undefined) {
|
|
55372
|
+
if (data === undefined) {
|
|
55311
55373
|
return Promise.reject(createDraftSynthesisErrorResponse());
|
|
55312
55374
|
}
|
|
55313
|
-
return createOkResponse(
|
|
55375
|
+
return createOkResponse(data);
|
|
55314
55376
|
};
|
|
55315
55377
|
return create$2$1(env, {
|
|
55316
55378
|
dispatchResourceRequest: { value: dispatchResourceRequest },
|
|
@@ -58200,34 +58262,6 @@ function setupInspection(luvio) {
|
|
|
58200
58262
|
* For full license text, see the LICENSE.txt file
|
|
58201
58263
|
*/
|
|
58202
58264
|
|
|
58203
|
-
class AsyncWorkerPool {
|
|
58204
|
-
constructor(concurrency) {
|
|
58205
|
-
this.queue = [];
|
|
58206
|
-
this.activeWorkers = 0;
|
|
58207
|
-
this.concurrency = concurrency;
|
|
58208
|
-
}
|
|
58209
|
-
push(workFn) {
|
|
58210
|
-
this.queue.push(workFn);
|
|
58211
|
-
this.work();
|
|
58212
|
-
}
|
|
58213
|
-
cancel() {
|
|
58214
|
-
this.queue = [];
|
|
58215
|
-
// TODO [W-12513105]: thread cancellation through to active workers
|
|
58216
|
-
}
|
|
58217
|
-
work() {
|
|
58218
|
-
while (this.queue.length > 0 && this.activeWorkers < this.concurrency) {
|
|
58219
|
-
this.activeWorkers += 1;
|
|
58220
|
-
const next = this.queue.shift();
|
|
58221
|
-
if (next) {
|
|
58222
|
-
next().finally(() => {
|
|
58223
|
-
this.activeWorkers -= 1;
|
|
58224
|
-
this.work();
|
|
58225
|
-
});
|
|
58226
|
-
}
|
|
58227
|
-
}
|
|
58228
|
-
}
|
|
58229
|
-
}
|
|
58230
|
-
|
|
58231
58265
|
class EventEmitter {
|
|
58232
58266
|
constructor() {
|
|
58233
58267
|
// @ts-ignore typescript doesn't like us setting this to an empty object for some reason
|
|
@@ -58776,7 +58810,7 @@ register({
|
|
|
58776
58810
|
id: '@salesforce/lds-network-adapter',
|
|
58777
58811
|
instrument: instrument$1,
|
|
58778
58812
|
});
|
|
58779
|
-
// version: 1.100.
|
|
58813
|
+
// version: 1.100.5-bd2d67d6a
|
|
58780
58814
|
|
|
58781
58815
|
const { create: create$2, keys: keys$2 } = Object;
|
|
58782
58816
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -76429,7 +76463,7 @@ register({
|
|
|
76429
76463
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76430
76464
|
instrument,
|
|
76431
76465
|
});
|
|
76432
|
-
// version: 1.100.
|
|
76466
|
+
// version: 1.100.5-bd2d67d6a
|
|
76433
76467
|
|
|
76434
76468
|
// On core the unstable adapters are re-exported with different names,
|
|
76435
76469
|
|
|
@@ -78558,7 +78592,7 @@ withDefaultLuvio((luvio) => {
|
|
|
78558
78592
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
78559
78593
|
graphQLImperative = ldsAdapter;
|
|
78560
78594
|
});
|
|
78561
|
-
// version: 1.100.
|
|
78595
|
+
// version: 1.100.5-bd2d67d6a
|
|
78562
78596
|
|
|
78563
78597
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
78564
78598
|
__proto__: null,
|
|
@@ -79148,7 +79182,7 @@ function executeMutatingAdapter(adapterId, config, onResult, nativeAdapterReques
|
|
|
79148
79182
|
|
|
79149
79183
|
/* istanbul ignore file */
|
|
79150
79184
|
// A allowlist of methods that we allow to be proxied from another LDS instance
|
|
79151
|
-
const allowList = ['enqueue', 'getQueueActions'
|
|
79185
|
+
const allowList = ['enqueue', 'getQueueActions'];
|
|
79152
79186
|
/**
|
|
79153
79187
|
* Implements the DraftQueue interface from nimbus-plugin-lds by passing requests
|
|
79154
79188
|
* to the instance of the lds-drafts' DraftQueue implementation
|
|
@@ -79232,4 +79266,4 @@ const { luvio } = getRuntime();
|
|
|
79232
79266
|
setDefaultLuvio({ luvio });
|
|
79233
79267
|
|
|
79234
79268
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
79235
|
-
// version: 1.100.
|
|
79269
|
+
// version: 1.100.5-bd2d67d6a
|
|
@@ -3782,7 +3782,7 @@
|
|
|
3782
3782
|
}
|
|
3783
3783
|
callbacks.push(callback);
|
|
3784
3784
|
}
|
|
3785
|
-
// version: 1.100.
|
|
3785
|
+
// version: 1.100.5-bd2d67d6a
|
|
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.100.
|
|
15209
|
+
// version: 1.100.5-bd2d67d6a
|
|
15210
15210
|
|
|
15211
15211
|
function unwrap(data) {
|
|
15212
15212
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16087,7 +16087,7 @@
|
|
|
16087
16087
|
const { apiFamily, name } = metadata;
|
|
16088
16088
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16089
16089
|
}
|
|
16090
|
-
// version: 1.100.
|
|
16090
|
+
// version: 1.100.5-bd2d67d6a
|
|
16091
16091
|
|
|
16092
16092
|
/**
|
|
16093
16093
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -43640,7 +43640,7 @@
|
|
|
43640
43640
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
43641
43641
|
});
|
|
43642
43642
|
});
|
|
43643
|
-
// version: 1.100.
|
|
43643
|
+
// version: 1.100.5-bd2d67d6a
|
|
43644
43644
|
|
|
43645
43645
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
43646
43646
|
|
|
@@ -48012,6 +48012,44 @@
|
|
|
48012
48012
|
return wrapStartEndEvents(storeEval);
|
|
48013
48013
|
}
|
|
48014
48014
|
|
|
48015
|
+
/**
|
|
48016
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48017
|
+
* All rights reserved.
|
|
48018
|
+
* For full license text, see the LICENSE.txt file
|
|
48019
|
+
*/
|
|
48020
|
+
|
|
48021
|
+
class AsyncWorkerPool {
|
|
48022
|
+
constructor(concurrency) {
|
|
48023
|
+
this.queue = [];
|
|
48024
|
+
this.activeWorkers = 0;
|
|
48025
|
+
this.concurrency = concurrency;
|
|
48026
|
+
}
|
|
48027
|
+
push(workFn) {
|
|
48028
|
+
return new Promise((resolve, reject) => {
|
|
48029
|
+
this.queue.push(async () => {
|
|
48030
|
+
return workFn().then(resolve).catch(reject);
|
|
48031
|
+
});
|
|
48032
|
+
this.work();
|
|
48033
|
+
});
|
|
48034
|
+
}
|
|
48035
|
+
cancel() {
|
|
48036
|
+
this.queue = [];
|
|
48037
|
+
// TODO [W-12513105]: thread cancellation through to active workers
|
|
48038
|
+
}
|
|
48039
|
+
work() {
|
|
48040
|
+
while (this.queue.length > 0 && this.activeWorkers < this.concurrency) {
|
|
48041
|
+
this.activeWorkers += 1;
|
|
48042
|
+
const next = this.queue.shift();
|
|
48043
|
+
if (next) {
|
|
48044
|
+
next().finally(() => {
|
|
48045
|
+
this.activeWorkers -= 1;
|
|
48046
|
+
this.work();
|
|
48047
|
+
});
|
|
48048
|
+
}
|
|
48049
|
+
}
|
|
48050
|
+
}
|
|
48051
|
+
}
|
|
48052
|
+
|
|
48015
48053
|
/**
|
|
48016
48054
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48017
48055
|
* All rights reserved.
|
|
@@ -48196,14 +48234,13 @@
|
|
|
48196
48234
|
function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromCacheKey, options = {}) {
|
|
48197
48235
|
// override this to create and enqueue a new draft action, and return synthetic response
|
|
48198
48236
|
const dispatchResourceRequest = async function (resourceRequest, _context) {
|
|
48199
|
-
const
|
|
48237
|
+
const { data } = await handler.enqueue(resourceRequest).catch((err) => {
|
|
48200
48238
|
throw transformErrorToDraftSynthesisError(err);
|
|
48201
48239
|
});
|
|
48202
|
-
|
|
48203
|
-
if (record === undefined) {
|
|
48240
|
+
if (data === undefined) {
|
|
48204
48241
|
return Promise.reject(createDraftSynthesisErrorResponse());
|
|
48205
48242
|
}
|
|
48206
|
-
return createOkResponse(
|
|
48243
|
+
return createOkResponse(data);
|
|
48207
48244
|
};
|
|
48208
48245
|
// override this to use an infinitely large ttl so the cache entry never expires
|
|
48209
48246
|
const publishStoreMetadata = function (key, storeMetadataParams) {
|
|
@@ -48430,6 +48467,7 @@
|
|
|
48430
48467
|
this.timeoutHandler = undefined;
|
|
48431
48468
|
this.handlers = {};
|
|
48432
48469
|
this.draftStore = draftStore;
|
|
48470
|
+
this.workerPool = new AsyncWorkerPool(1);
|
|
48433
48471
|
}
|
|
48434
48472
|
addHandler(handler) {
|
|
48435
48473
|
const id = handler.handlerId;
|
|
@@ -48447,10 +48485,6 @@
|
|
|
48447
48485
|
const handler = customActionHandler(executor, id, this);
|
|
48448
48486
|
return this.addHandler(handler);
|
|
48449
48487
|
}
|
|
48450
|
-
async getDataForAction(action) {
|
|
48451
|
-
const handler = this.getHandler(action.handler);
|
|
48452
|
-
return handler.getDataForAction(action);
|
|
48453
|
-
}
|
|
48454
48488
|
getQueueState() {
|
|
48455
48489
|
return this.state;
|
|
48456
48490
|
}
|
|
@@ -48529,20 +48563,26 @@
|
|
|
48529
48563
|
});
|
|
48530
48564
|
}
|
|
48531
48565
|
async enqueue(handlerId, data) {
|
|
48532
|
-
|
|
48533
|
-
|
|
48534
|
-
|
|
48535
|
-
|
|
48536
|
-
|
|
48537
|
-
|
|
48538
|
-
|
|
48539
|
-
|
|
48566
|
+
return this.workerPool.push(async () => {
|
|
48567
|
+
let queue = await this.getQueueActions();
|
|
48568
|
+
const handler = this.getHandler(handlerId);
|
|
48569
|
+
const pendingAction = (await handler.buildPendingAction(data, queue));
|
|
48570
|
+
await this.draftStore.writeAction(pendingAction);
|
|
48571
|
+
queue = await this.getQueueActions();
|
|
48572
|
+
await this.notifyChangedListeners({
|
|
48573
|
+
type: DraftQueueEventType.ActionAdded,
|
|
48574
|
+
action: pendingAction,
|
|
48575
|
+
});
|
|
48576
|
+
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48577
|
+
if (this.state === DraftQueueState.Started) {
|
|
48578
|
+
this.processNextAction();
|
|
48579
|
+
}
|
|
48580
|
+
const actionData = (await handler.getDataForAction(pendingAction));
|
|
48581
|
+
return {
|
|
48582
|
+
action: pendingAction,
|
|
48583
|
+
data: actionData,
|
|
48584
|
+
};
|
|
48540
48585
|
});
|
|
48541
|
-
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48542
|
-
if (this.state === DraftQueueState.Started) {
|
|
48543
|
-
this.processNextAction();
|
|
48544
|
-
}
|
|
48545
|
-
return pendingAction;
|
|
48546
48586
|
}
|
|
48547
48587
|
registerOnChangedListener(listener) {
|
|
48548
48588
|
this.draftQueueChangedListeners.push(listener);
|
|
@@ -48554,27 +48594,29 @@
|
|
|
48554
48594
|
};
|
|
48555
48595
|
}
|
|
48556
48596
|
async actionCompleted(action) {
|
|
48557
|
-
|
|
48558
|
-
|
|
48559
|
-
|
|
48560
|
-
|
|
48561
|
-
|
|
48562
|
-
|
|
48563
|
-
|
|
48564
|
-
|
|
48597
|
+
return this.workerPool.push(async () => {
|
|
48598
|
+
const handler = this.getHandler(action.handler);
|
|
48599
|
+
let queue = await this.getQueueActions();
|
|
48600
|
+
const queueOperations = handler.getQueueOperationsForCompletingDrafts(queue, action);
|
|
48601
|
+
const idAndKeyMappings = handler.getRedirectMappings(action);
|
|
48602
|
+
const keyMappings = idAndKeyMappings === undefined
|
|
48603
|
+
? undefined
|
|
48604
|
+
: idAndKeyMappings.map((m) => {
|
|
48605
|
+
return { draftKey: m.draftKey, canonicalKey: m.canonicalKey };
|
|
48606
|
+
});
|
|
48607
|
+
await this.draftStore.completeAction(queueOperations, keyMappings);
|
|
48608
|
+
queue = await this.getQueueActions();
|
|
48609
|
+
this.retryIntervalMilliseconds = 0;
|
|
48610
|
+
this.uploadingActionId = undefined;
|
|
48611
|
+
await handler.handleActionCompleted(action, queueOperations, queue, values$1(this.handlers));
|
|
48612
|
+
await this.notifyChangedListeners({
|
|
48613
|
+
type: DraftQueueEventType.ActionCompleted,
|
|
48614
|
+
action,
|
|
48565
48615
|
});
|
|
48566
|
-
|
|
48567
|
-
|
|
48568
|
-
|
|
48569
|
-
this.uploadingActionId = undefined;
|
|
48570
|
-
await handler.handleActionCompleted(action, queueOperations, queue, values$1(this.handlers));
|
|
48571
|
-
await this.notifyChangedListeners({
|
|
48572
|
-
type: DraftQueueEventType.ActionCompleted,
|
|
48573
|
-
action,
|
|
48616
|
+
if (this.state === DraftQueueState.Started) {
|
|
48617
|
+
this.processNextAction();
|
|
48618
|
+
}
|
|
48574
48619
|
});
|
|
48575
|
-
if (this.state === DraftQueueState.Started) {
|
|
48576
|
-
this.processNextAction();
|
|
48577
|
-
}
|
|
48578
48620
|
}
|
|
48579
48621
|
async actionFailed(action, retry) {
|
|
48580
48622
|
this.uploadingActionId = undefined;
|
|
@@ -49010,6 +49052,13 @@
|
|
|
49010
49052
|
this.draftQueue = draftQueue;
|
|
49011
49053
|
this.networkAdapter = networkAdapter;
|
|
49012
49054
|
this.getLuvio = getLuvio;
|
|
49055
|
+
// NOTE[W-12567340]: This property stores in-memory mappings between draft
|
|
49056
|
+
// ids and canonical ids for the current session. Having a local copy of
|
|
49057
|
+
// these mappings is necessary to avoid a race condition between publishing
|
|
49058
|
+
// new mappings to the durable store and those mappings being loaded into
|
|
49059
|
+
// the luvio store redirect table, during which a new draft might be enqueued
|
|
49060
|
+
// which would not see a necessary mapping.
|
|
49061
|
+
this.ephemeralRedirects = {};
|
|
49013
49062
|
}
|
|
49014
49063
|
enqueue(data) {
|
|
49015
49064
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -49077,7 +49126,8 @@
|
|
|
49077
49126
|
}
|
|
49078
49127
|
getQueueOperationsForCompletingDrafts(queue, action) {
|
|
49079
49128
|
const queueOperations = [];
|
|
49080
|
-
|
|
49129
|
+
const redirects = this.getRedirectMappings(action);
|
|
49130
|
+
if (redirects !== undefined) {
|
|
49081
49131
|
const { length } = queue;
|
|
49082
49132
|
for (let i = 0; i < length; i++) {
|
|
49083
49133
|
const queueAction = queue[i];
|
|
@@ -49087,69 +49137,64 @@
|
|
|
49087
49137
|
continue;
|
|
49088
49138
|
}
|
|
49089
49139
|
if (isResourceRequestAction(queueAction)) {
|
|
49090
|
-
|
|
49091
|
-
|
|
49092
|
-
|
|
49093
|
-
|
|
49094
|
-
|
|
49095
|
-
|
|
49096
|
-
|
|
49097
|
-
|
|
49098
|
-
|
|
49099
|
-
|
|
49100
|
-
|
|
49101
|
-
|
|
49102
|
-
|
|
49103
|
-
basePath = basePath.replace(draftId, canonicalId);
|
|
49104
|
-
stringifiedBody = stringifiedBody.replace(draftId, canonicalId);
|
|
49105
|
-
queueOperationMutated = true;
|
|
49106
|
-
}
|
|
49107
|
-
// if the action is performed on a previous draft id, we need to replace the action
|
|
49108
|
-
// with a new one at the updated canonical key
|
|
49109
|
-
if (queueActionTag === draftKey) {
|
|
49110
|
-
updatedActionTag = canonicalKey;
|
|
49111
|
-
updatedActionTargetId = canonicalId;
|
|
49112
|
-
}
|
|
49140
|
+
let queueOperationMutated = false;
|
|
49141
|
+
let updatedActionTag = undefined;
|
|
49142
|
+
let updatedActionTargetId = undefined;
|
|
49143
|
+
const { tag: queueActionTag, data: queueActionRequest, id: queueActionId, } = queueAction;
|
|
49144
|
+
let { basePath, body } = queueActionRequest;
|
|
49145
|
+
let stringifiedBody = stringify$4(body);
|
|
49146
|
+
// for each redirected ID/key we loop over the operation to see if it needs
|
|
49147
|
+
// to be updated
|
|
49148
|
+
for (const { draftId, draftKey, canonicalId, canonicalKey } of redirects) {
|
|
49149
|
+
if (basePath.search(draftId) >= 0 || stringifiedBody.search(draftId) >= 0) {
|
|
49150
|
+
basePath = basePath.replace(draftId, canonicalId);
|
|
49151
|
+
stringifiedBody = stringifiedBody.replace(draftId, canonicalId);
|
|
49152
|
+
queueOperationMutated = true;
|
|
49113
49153
|
}
|
|
49114
|
-
if
|
|
49115
|
-
|
|
49116
|
-
|
|
49117
|
-
|
|
49118
|
-
|
|
49119
|
-
|
|
49120
|
-
|
|
49121
|
-
|
|
49122
|
-
|
|
49123
|
-
|
|
49124
|
-
|
|
49125
|
-
|
|
49126
|
-
|
|
49127
|
-
|
|
49128
|
-
|
|
49129
|
-
|
|
49130
|
-
|
|
49131
|
-
}
|
|
49132
|
-
|
|
49133
|
-
|
|
49134
|
-
|
|
49135
|
-
|
|
49136
|
-
|
|
49137
|
-
|
|
49138
|
-
|
|
49139
|
-
|
|
49140
|
-
|
|
49141
|
-
|
|
49142
|
-
|
|
49143
|
-
|
|
49144
|
-
|
|
49145
|
-
|
|
49146
|
-
|
|
49147
|
-
|
|
49148
|
-
|
|
49149
|
-
|
|
49150
|
-
|
|
49151
|
-
|
|
49152
|
-
|
|
49154
|
+
// if the action is performed on a previous draft id, we need to replace the action
|
|
49155
|
+
// with a new one at the updated canonical key
|
|
49156
|
+
if (queueActionTag === draftKey) {
|
|
49157
|
+
updatedActionTag = canonicalKey;
|
|
49158
|
+
updatedActionTargetId = canonicalId;
|
|
49159
|
+
}
|
|
49160
|
+
}
|
|
49161
|
+
if (queueOperationMutated) {
|
|
49162
|
+
if (updatedActionTag !== undefined && updatedActionTargetId !== undefined) {
|
|
49163
|
+
const updatedAction = {
|
|
49164
|
+
...queueAction,
|
|
49165
|
+
tag: updatedActionTag,
|
|
49166
|
+
targetId: updatedActionTargetId,
|
|
49167
|
+
data: {
|
|
49168
|
+
...queueActionRequest,
|
|
49169
|
+
basePath: basePath,
|
|
49170
|
+
body: parse$4(stringifiedBody),
|
|
49171
|
+
},
|
|
49172
|
+
};
|
|
49173
|
+
// item needs to be replaced with a new item at the new record key
|
|
49174
|
+
queueOperations.push({
|
|
49175
|
+
type: QueueOperationType.Delete,
|
|
49176
|
+
id: queueActionId,
|
|
49177
|
+
});
|
|
49178
|
+
queueOperations.push({
|
|
49179
|
+
type: QueueOperationType.Add,
|
|
49180
|
+
action: updatedAction,
|
|
49181
|
+
});
|
|
49182
|
+
}
|
|
49183
|
+
else {
|
|
49184
|
+
const updatedAction = {
|
|
49185
|
+
...queueAction,
|
|
49186
|
+
data: {
|
|
49187
|
+
...queueActionRequest,
|
|
49188
|
+
basePath: basePath,
|
|
49189
|
+
body: parse$4(stringifiedBody),
|
|
49190
|
+
},
|
|
49191
|
+
};
|
|
49192
|
+
// item needs to be updated
|
|
49193
|
+
queueOperations.push({
|
|
49194
|
+
type: QueueOperationType.Update,
|
|
49195
|
+
id: queueActionId,
|
|
49196
|
+
action: updatedAction,
|
|
49197
|
+
});
|
|
49153
49198
|
}
|
|
49154
49199
|
}
|
|
49155
49200
|
}
|
|
@@ -49169,6 +49214,9 @@
|
|
|
49169
49214
|
const body = action.response.body;
|
|
49170
49215
|
const canonicalId = this.getIdFromResponseBody(body);
|
|
49171
49216
|
const draftId = action.targetId;
|
|
49217
|
+
if (draftId !== undefined && canonicalId !== undefined && draftId !== canonicalId) {
|
|
49218
|
+
this.ephemeralRedirects[draftId] = canonicalId;
|
|
49219
|
+
}
|
|
49172
49220
|
return [
|
|
49173
49221
|
{
|
|
49174
49222
|
draftId,
|
|
@@ -49463,7 +49511,9 @@
|
|
|
49463
49511
|
targetId,
|
|
49464
49512
|
tag,
|
|
49465
49513
|
})
|
|
49466
|
-
.then(
|
|
49514
|
+
.then((result) => {
|
|
49515
|
+
return this.buildDraftQueueItem(result.action);
|
|
49516
|
+
});
|
|
49467
49517
|
}
|
|
49468
49518
|
/**
|
|
49469
49519
|
* Get the current state of each of the DraftActions in the DraftQueue
|
|
@@ -54950,12 +55000,18 @@
|
|
|
54950
55000
|
const fieldName = fieldNames[i];
|
|
54951
55001
|
const fieldValue = bodyFields[fieldName];
|
|
54952
55002
|
if (typeof fieldValue === 'string' && this.isDraftId(fieldValue)) {
|
|
54953
|
-
const
|
|
54954
|
-
|
|
54955
|
-
|
|
54956
|
-
|
|
54957
|
-
|
|
54958
|
-
|
|
55003
|
+
const canonicalId = this.ephemeralRedirects[fieldValue];
|
|
55004
|
+
if (canonicalId !== undefined) {
|
|
55005
|
+
bodyFields[fieldName] = canonicalId;
|
|
55006
|
+
}
|
|
55007
|
+
else {
|
|
55008
|
+
const draftKey = this.buildTagForTargetId(fieldValue);
|
|
55009
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
55010
|
+
if (draftKey !== canonicalKey) {
|
|
55011
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
55012
|
+
if (canonicalId !== undefined) {
|
|
55013
|
+
bodyFields[fieldName] = canonicalId;
|
|
55014
|
+
}
|
|
54959
55015
|
}
|
|
54960
55016
|
}
|
|
54961
55017
|
}
|
|
@@ -54963,17 +55019,24 @@
|
|
|
54963
55019
|
}
|
|
54964
55020
|
if (request.method === 'patch' || request.method === 'delete') {
|
|
54965
55021
|
const recordId = request.urlParams['recordId'];
|
|
54966
|
-
const
|
|
54967
|
-
|
|
54968
|
-
if (recordKey !== canonicalKey) {
|
|
54969
|
-
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
54970
|
-
if (canonicalId === undefined) {
|
|
54971
|
-
// could not resolve id from request -- return the request un-modified
|
|
54972
|
-
return request;
|
|
54973
|
-
}
|
|
55022
|
+
const canonicalId = this.ephemeralRedirects[recordId];
|
|
55023
|
+
if (canonicalId !== undefined) {
|
|
54974
55024
|
resolvedBasePath = resolvedBasePath.replace(recordId, canonicalId);
|
|
54975
55025
|
resolvedUrlParams = { ...resolvedUrlParams, recordId: canonicalId };
|
|
54976
55026
|
}
|
|
55027
|
+
else {
|
|
55028
|
+
const recordKey = this.buildTagForTargetId(recordId);
|
|
55029
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(recordKey);
|
|
55030
|
+
if (recordKey !== canonicalKey) {
|
|
55031
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
55032
|
+
if (canonicalId === undefined) {
|
|
55033
|
+
// could not resolve id from request -- return the request un-modified
|
|
55034
|
+
return request;
|
|
55035
|
+
}
|
|
55036
|
+
resolvedBasePath = resolvedBasePath.replace(recordId, canonicalId);
|
|
55037
|
+
resolvedUrlParams = { ...resolvedUrlParams, recordId: canonicalId };
|
|
55038
|
+
}
|
|
55039
|
+
}
|
|
54977
55040
|
}
|
|
54978
55041
|
return {
|
|
54979
55042
|
...request,
|
|
@@ -55309,14 +55372,13 @@
|
|
|
55309
55372
|
// only override requests to createRecord endpoint
|
|
55310
55373
|
return env.dispatchResourceRequest(request, context, eventObservers);
|
|
55311
55374
|
}
|
|
55312
|
-
const
|
|
55375
|
+
const { data } = await handler.enqueue(request).catch((err) => {
|
|
55313
55376
|
throw createDraftSynthesisErrorResponse(err.message);
|
|
55314
55377
|
});
|
|
55315
|
-
|
|
55316
|
-
if (record === undefined) {
|
|
55378
|
+
if (data === undefined) {
|
|
55317
55379
|
return Promise.reject(createDraftSynthesisErrorResponse());
|
|
55318
55380
|
}
|
|
55319
|
-
return createOkResponse(
|
|
55381
|
+
return createOkResponse(data);
|
|
55320
55382
|
};
|
|
55321
55383
|
return create$2$1(env, {
|
|
55322
55384
|
dispatchResourceRequest: { value: dispatchResourceRequest },
|
|
@@ -58206,34 +58268,6 @@
|
|
|
58206
58268
|
* For full license text, see the LICENSE.txt file
|
|
58207
58269
|
*/
|
|
58208
58270
|
|
|
58209
|
-
class AsyncWorkerPool {
|
|
58210
|
-
constructor(concurrency) {
|
|
58211
|
-
this.queue = [];
|
|
58212
|
-
this.activeWorkers = 0;
|
|
58213
|
-
this.concurrency = concurrency;
|
|
58214
|
-
}
|
|
58215
|
-
push(workFn) {
|
|
58216
|
-
this.queue.push(workFn);
|
|
58217
|
-
this.work();
|
|
58218
|
-
}
|
|
58219
|
-
cancel() {
|
|
58220
|
-
this.queue = [];
|
|
58221
|
-
// TODO [W-12513105]: thread cancellation through to active workers
|
|
58222
|
-
}
|
|
58223
|
-
work() {
|
|
58224
|
-
while (this.queue.length > 0 && this.activeWorkers < this.concurrency) {
|
|
58225
|
-
this.activeWorkers += 1;
|
|
58226
|
-
const next = this.queue.shift();
|
|
58227
|
-
if (next) {
|
|
58228
|
-
next().finally(() => {
|
|
58229
|
-
this.activeWorkers -= 1;
|
|
58230
|
-
this.work();
|
|
58231
|
-
});
|
|
58232
|
-
}
|
|
58233
|
-
}
|
|
58234
|
-
}
|
|
58235
|
-
}
|
|
58236
|
-
|
|
58237
58271
|
class EventEmitter {
|
|
58238
58272
|
constructor() {
|
|
58239
58273
|
// @ts-ignore typescript doesn't like us setting this to an empty object for some reason
|
|
@@ -58782,7 +58816,7 @@
|
|
|
58782
58816
|
id: '@salesforce/lds-network-adapter',
|
|
58783
58817
|
instrument: instrument$1,
|
|
58784
58818
|
});
|
|
58785
|
-
// version: 1.100.
|
|
58819
|
+
// version: 1.100.5-bd2d67d6a
|
|
58786
58820
|
|
|
58787
58821
|
const { create: create$2, keys: keys$2 } = Object;
|
|
58788
58822
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -76435,7 +76469,7 @@
|
|
|
76435
76469
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76436
76470
|
instrument,
|
|
76437
76471
|
});
|
|
76438
|
-
// version: 1.100.
|
|
76472
|
+
// version: 1.100.5-bd2d67d6a
|
|
76439
76473
|
|
|
76440
76474
|
// On core the unstable adapters are re-exported with different names,
|
|
76441
76475
|
|
|
@@ -78564,7 +78598,7 @@
|
|
|
78564
78598
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
78565
78599
|
graphQLImperative = ldsAdapter;
|
|
78566
78600
|
});
|
|
78567
|
-
// version: 1.100.
|
|
78601
|
+
// version: 1.100.5-bd2d67d6a
|
|
78568
78602
|
|
|
78569
78603
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
78570
78604
|
__proto__: null,
|
|
@@ -79154,7 +79188,7 @@
|
|
|
79154
79188
|
|
|
79155
79189
|
/* istanbul ignore file */
|
|
79156
79190
|
// A allowlist of methods that we allow to be proxied from another LDS instance
|
|
79157
|
-
const allowList = ['enqueue', 'getQueueActions'
|
|
79191
|
+
const allowList = ['enqueue', 'getQueueActions'];
|
|
79158
79192
|
/**
|
|
79159
79193
|
* Implements the DraftQueue interface from nimbus-plugin-lds by passing requests
|
|
79160
79194
|
* to the instance of the lds-drafts' DraftQueue implementation
|
|
@@ -79255,4 +79289,4 @@
|
|
|
79255
79289
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
79256
79290
|
|
|
79257
79291
|
}));
|
|
79258
|
-
// version: 1.100.
|
|
79292
|
+
// version: 1.100.5-bd2d67d6a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.100.
|
|
3
|
+
"version": "1.100.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/umd/lds-worker-api.js",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"@luvio/engine": "0.135.4",
|
|
38
38
|
"@luvio/environments": "0.135.4",
|
|
39
39
|
"@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
|
|
40
|
-
"@salesforce/lds-adapters-graphql": "^1.100.
|
|
41
|
-
"@salesforce/lds-adapters-uiapi": "^1.100.
|
|
42
|
-
"@salesforce/lds-default-luvio": "^1.100.
|
|
43
|
-
"@salesforce/lds-drafts": "^1.100.
|
|
44
|
-
"@salesforce/lds-graphql-parser": "^1.100.
|
|
45
|
-
"@salesforce/lds-luvio-engine": "^1.100.
|
|
46
|
-
"@salesforce/lds-priming": "^1.100.
|
|
47
|
-
"@salesforce/lds-runtime-mobile": "^1.100.
|
|
48
|
-
"@salesforce/nimbus-plugin-lds": "^1.100.
|
|
40
|
+
"@salesforce/lds-adapters-graphql": "^1.100.5",
|
|
41
|
+
"@salesforce/lds-adapters-uiapi": "^1.100.5",
|
|
42
|
+
"@salesforce/lds-default-luvio": "^1.100.5",
|
|
43
|
+
"@salesforce/lds-drafts": "^1.100.5",
|
|
44
|
+
"@salesforce/lds-graphql-parser": "^1.100.5",
|
|
45
|
+
"@salesforce/lds-luvio-engine": "^1.100.5",
|
|
46
|
+
"@salesforce/lds-priming": "^1.100.5",
|
|
47
|
+
"@salesforce/lds-runtime-mobile": "^1.100.5",
|
|
48
|
+
"@salesforce/nimbus-plugin-lds": "^1.100.5",
|
|
49
49
|
"ajv": "^8.11.0",
|
|
50
50
|
"glob": "^7.1.5",
|
|
51
51
|
"nimbus-types": "^2.0.0-alpha1",
|