@salesforce/lds-worker-api 1.327.0 → 1.329.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -446,34 +446,42 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
|
|
|
446
446
|
invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResponse, nativeAdapterRequestContext);
|
|
447
447
|
}
|
|
448
448
|
else {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
449
|
+
draftManager.stopQueueWhileRunning(() => {
|
|
450
|
+
return new Promise((resolve) => {
|
|
451
|
+
invokeDmlAdapter(adapter, parse(config), async (responseValue) => {
|
|
452
|
+
const draftIds = draftIdsForResponseValue(responseValue);
|
|
453
|
+
if (responseValue.error === undefined &&
|
|
454
|
+
draftIds !== undefined &&
|
|
455
|
+
draftIds.length > 0) {
|
|
456
|
+
const draftId = draftIds[draftIds.length - 1];
|
|
457
|
+
const managerState = await draftManager.getQueue();
|
|
458
|
+
const draftItem = managerState.items.find((x) => x.id === draftId);
|
|
459
|
+
if (draftItem === undefined) {
|
|
460
|
+
// draftItem no longer exists, might have already been uploaded
|
|
461
|
+
ldsMobileInstrumentation$1.log('tried to set metadata on draft item that no longer exists');
|
|
462
|
+
resolve(responseValue);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
draftManager
|
|
466
|
+
.setMetadata(draftId, { ...draftItem.metadata, ...metadata })
|
|
467
|
+
.then(() => {
|
|
468
|
+
resolve(responseValue);
|
|
469
|
+
})
|
|
470
|
+
.catch((error) => {
|
|
471
|
+
resolve(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
let response = responseValue;
|
|
476
|
+
response.error =
|
|
477
|
+
createNativeFetchErrorResponse(NO_DRAFT_CREATED_MESSAGE);
|
|
478
|
+
resolve(response);
|
|
479
|
+
}
|
|
480
|
+
}, nativeAdapterRequestContext);
|
|
481
|
+
}).then((callbackValue) => {
|
|
482
|
+
onResponse(callbackValue);
|
|
483
|
+
});
|
|
484
|
+
});
|
|
477
485
|
}
|
|
478
486
|
}
|
|
479
487
|
/*
|
|
@@ -1098,4 +1106,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1098
1106
|
}
|
|
1099
1107
|
|
|
1100
1108
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1101
|
-
// version: 1.
|
|
1109
|
+
// version: 1.329.0-9b52e8059d
|
|
@@ -71,7 +71,7 @@ function isUnfulfilledSnapshot$6(snapshot) {
|
|
|
71
71
|
function isPendingSnapshot$1(snapshot) {
|
|
72
72
|
return snapshot.state === SnapshotState$3.Pending;
|
|
73
73
|
}
|
|
74
|
-
function createErrorSnapshot
|
|
74
|
+
function createErrorSnapshot(error, refresh) {
|
|
75
75
|
deepFreeze(error);
|
|
76
76
|
const snap = {
|
|
77
77
|
error,
|
|
@@ -2099,7 +2099,7 @@ const onlyIfCachedImplementation = function (args) {
|
|
|
2099
2099
|
return snapshot;
|
|
2100
2100
|
}
|
|
2101
2101
|
const refresh = snapshot !== undefined ? snapshot.refresh : undefined;
|
|
2102
|
-
return createErrorSnapshot
|
|
2102
|
+
return createErrorSnapshot({
|
|
2103
2103
|
body: undefined,
|
|
2104
2104
|
headers: {},
|
|
2105
2105
|
ok: false,
|
|
@@ -3753,7 +3753,7 @@ class Luvio {
|
|
|
3753
3753
|
return this.environment.createSnapshot(selector, refresh);
|
|
3754
3754
|
}
|
|
3755
3755
|
errorSnapshot(error, refresh) {
|
|
3756
|
-
return createErrorSnapshot
|
|
3756
|
+
return createErrorSnapshot(error, refresh);
|
|
3757
3757
|
}
|
|
3758
3758
|
dispatchResourceRequest(resourceRequest, context) {
|
|
3759
3759
|
let mergedResourceRequest = resourceRequest;
|
|
@@ -4265,7 +4265,7 @@ function withDefaultLuvio(callback) {
|
|
|
4265
4265
|
}
|
|
4266
4266
|
callbacks.push(callback);
|
|
4267
4267
|
}
|
|
4268
|
-
// version: 1.
|
|
4268
|
+
// version: 1.329.0-9b52e8059d
|
|
4269
4269
|
|
|
4270
4270
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4271
4271
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5213,7 +5213,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5213
5213
|
const { apiFamily, name } = metadata;
|
|
5214
5214
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5215
5215
|
}
|
|
5216
|
-
// version: 1.
|
|
5216
|
+
// version: 1.329.0-9b52e8059d
|
|
5217
5217
|
|
|
5218
5218
|
/**
|
|
5219
5219
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -9557,13 +9557,12 @@ function mergePendingFields$1(newRecord, oldRecord, existingNode) {
|
|
|
9557
9557
|
}
|
|
9558
9558
|
}
|
|
9559
9559
|
}
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
}
|
|
9560
|
+
// If the fields requested off of this spanning record are external fields, skip them to avoid creating request that exceed the SOQL limits on external data. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_limits.htm
|
|
9561
|
+
const state = fieldValueRep.linkData();
|
|
9562
|
+
if (state !== undefined) {
|
|
9563
|
+
const { fields } = state;
|
|
9564
|
+
if (includes$3.call(fields, 'ExternalId')) {
|
|
9565
|
+
continue;
|
|
9567
9566
|
}
|
|
9568
9567
|
}
|
|
9569
9568
|
}
|
|
@@ -33851,7 +33850,7 @@ withDefaultLuvio((luvio) => {
|
|
|
33851
33850
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33852
33851
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33853
33852
|
});
|
|
33854
|
-
// version: 1.
|
|
33853
|
+
// version: 1.329.0-beac2bb064
|
|
33855
33854
|
|
|
33856
33855
|
/**
|
|
33857
33856
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -47523,6 +47522,12 @@ class DurableDraftQueue {
|
|
|
47523
47522
|
draftCount: this.draftStore.getCount(),
|
|
47524
47523
|
});
|
|
47525
47524
|
}
|
|
47525
|
+
stopQueueWhileRunning(action) {
|
|
47526
|
+
this.stopQueueManually(true);
|
|
47527
|
+
return action().finally(() => {
|
|
47528
|
+
this.startQueueSafe();
|
|
47529
|
+
});
|
|
47530
|
+
}
|
|
47526
47531
|
/**
|
|
47527
47532
|
* Used to stop the queue within DraftQueue without user interaction
|
|
47528
47533
|
*/
|
|
@@ -48299,6 +48304,14 @@ class DraftManager {
|
|
|
48299
48304
|
stopQueue() {
|
|
48300
48305
|
return this.draftQueue.stopQueue();
|
|
48301
48306
|
}
|
|
48307
|
+
/**
|
|
48308
|
+
* Stops the draft queue manually without notifying the user and then runs the passed action.
|
|
48309
|
+
* After the action is completed it will safely start the queue if the user had set it to be
|
|
48310
|
+
* started.
|
|
48311
|
+
*/
|
|
48312
|
+
stopQueueWhileRunning(action) {
|
|
48313
|
+
return this.draftQueue.stopQueueWhileRunning(action);
|
|
48314
|
+
}
|
|
48302
48315
|
/**
|
|
48303
48316
|
* Subscribes the listener to changes to the draft queue.
|
|
48304
48317
|
*
|
|
@@ -80241,24 +80254,37 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
|
|
|
80241
80254
|
// so eslint doesn't complain about nimbus
|
|
80242
80255
|
/* global __nimbus */
|
|
80243
80256
|
function chunkToBase64(chunk) {
|
|
80244
|
-
|
|
80245
|
-
const
|
|
80246
|
-
for (let i = 0; i < chunk.length; i += chunkSize) {
|
|
80247
|
-
binary += String.fromCharCode.apply(null, chunk.subarray(i, i + chunkSize));
|
|
80248
|
-
}
|
|
80257
|
+
const bytes = new Uint8Array(chunk);
|
|
80258
|
+
const binary = String.fromCharCode.apply(null, bytes);
|
|
80249
80259
|
return btoa(binary);
|
|
80250
80260
|
}
|
|
80251
|
-
async function streamBufferToBinaryStore(binaryStore,
|
|
80261
|
+
async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
|
|
80252
80262
|
const uri = await binaryStore.createStream(mimeType);
|
|
80253
|
-
const
|
|
80254
|
-
const
|
|
80255
|
-
|
|
80256
|
-
|
|
80257
|
-
|
|
80258
|
-
|
|
80263
|
+
const CHUNK_SIZE = 64 * 1024; // 64KB
|
|
80264
|
+
const fileSize = file.size;
|
|
80265
|
+
let offset = 0;
|
|
80266
|
+
try {
|
|
80267
|
+
while (offset < fileSize) {
|
|
80268
|
+
const end = Math.min(offset + CHUNK_SIZE, fileSize);
|
|
80269
|
+
const chunk = file.slice(offset, end);
|
|
80270
|
+
const arrayBuffer = await chunk.arrayBuffer();
|
|
80271
|
+
const base64Chunk = chunkToBase64(arrayBuffer);
|
|
80272
|
+
await binaryStore.writeToStream(uri, base64Chunk);
|
|
80273
|
+
offset = end;
|
|
80274
|
+
}
|
|
80275
|
+
await binaryStore.closeStream(uri);
|
|
80276
|
+
return uri;
|
|
80277
|
+
}
|
|
80278
|
+
catch (error) {
|
|
80279
|
+
await binaryStore.closeStream(uri);
|
|
80280
|
+
throw error;
|
|
80259
80281
|
}
|
|
80260
|
-
|
|
80261
|
-
|
|
80282
|
+
}
|
|
80283
|
+
function isFileLike(object) {
|
|
80284
|
+
return (object &&
|
|
80285
|
+
typeof object === 'object' &&
|
|
80286
|
+
typeof object.size === 'number' &&
|
|
80287
|
+
typeof object.slice === 'function');
|
|
80262
80288
|
}
|
|
80263
80289
|
function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore, actionHandler, durableRecordStore) {
|
|
80264
80290
|
return async function createContentDocumentAndVersionDraftAdapter(config, buildResourceRequest, requestContext) {
|
|
@@ -80273,15 +80299,17 @@ function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore,
|
|
|
80273
80299
|
if (!isFileReference(config.fileData)) {
|
|
80274
80300
|
const { fileData } = config;
|
|
80275
80301
|
const { name, size, type } = fileData;
|
|
80276
|
-
|
|
80277
|
-
|
|
80278
|
-
// see if new chunking-api exists, if it doesnt fall back to memory-intensive mobile api
|
|
80302
|
+
let uri = ''; // Initialize uri with an empty string
|
|
80303
|
+
// Check if chunking API exists, fallback if it doesn't
|
|
80279
80304
|
if (!__nimbus.plugins.LdsBinaryStorePlugin.createStream) {
|
|
80305
|
+
const buffer = await fileData.arrayBuffer();
|
|
80280
80306
|
uri = await binaryStore.store(new Uint8Array(buffer), type, size);
|
|
80281
80307
|
}
|
|
80282
|
-
else {
|
|
80283
|
-
|
|
80308
|
+
else if (isFileLike(fileData)) {
|
|
80309
|
+
// Only pass to streamBufferToBinaryStore if it's FileLike
|
|
80310
|
+
uri = await streamBufferToBinaryStore(binaryStore, fileData, type);
|
|
80284
80311
|
}
|
|
80312
|
+
else ;
|
|
80285
80313
|
config.fileData = {
|
|
80286
80314
|
isFileReference: true,
|
|
80287
80315
|
handle: uri,
|
|
@@ -86680,18 +86708,6 @@ function createSeenRecords(ids, currentSnapshot) {
|
|
|
86680
86708
|
}
|
|
86681
86709
|
return seenRecords;
|
|
86682
86710
|
}
|
|
86683
|
-
function createErrorSnapshot(result, snapshot) {
|
|
86684
|
-
return {
|
|
86685
|
-
...snapshot,
|
|
86686
|
-
data: undefined,
|
|
86687
|
-
state: 'Error',
|
|
86688
|
-
error: {
|
|
86689
|
-
body: {
|
|
86690
|
-
message: result.errors,
|
|
86691
|
-
},
|
|
86692
|
-
},
|
|
86693
|
-
};
|
|
86694
|
-
}
|
|
86695
86711
|
function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
|
|
86696
86712
|
return {
|
|
86697
86713
|
refresh,
|
|
@@ -87209,7 +87225,18 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
87209
87225
|
// currently by design if there are any graphql errors we return an ErrorSnapshot
|
|
87210
87226
|
// partial results are not supported at this time
|
|
87211
87227
|
if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
|
|
87212
|
-
|
|
87228
|
+
const errors = gqlResult.errors || [];
|
|
87229
|
+
let responseErrors = errors.map((e) => {
|
|
87230
|
+
return { message: e instanceof Error ? e.message : String(e) };
|
|
87231
|
+
});
|
|
87232
|
+
return {
|
|
87233
|
+
data: undefined,
|
|
87234
|
+
state: 'Error',
|
|
87235
|
+
error: {
|
|
87236
|
+
errorType: 'adapterError',
|
|
87237
|
+
error: responseErrors,
|
|
87238
|
+
},
|
|
87239
|
+
};
|
|
87213
87240
|
}
|
|
87214
87241
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
87215
87242
|
// Fulfilled snapshot (this only happens in this code path if
|
|
@@ -88384,6 +88411,9 @@ class NimbusDraftQueue {
|
|
|
88384
88411
|
stopQueue() {
|
|
88385
88412
|
return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
|
|
88386
88413
|
}
|
|
88414
|
+
stopQueueWhileRunning(_action) {
|
|
88415
|
+
return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
|
|
88416
|
+
}
|
|
88387
88417
|
replaceAction(_actionId, _withActionId) {
|
|
88388
88418
|
return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
|
|
88389
88419
|
}
|
|
@@ -92649,7 +92679,7 @@ register$1({
|
|
|
92649
92679
|
id: '@salesforce/lds-network-adapter',
|
|
92650
92680
|
instrument: instrument$2,
|
|
92651
92681
|
});
|
|
92652
|
-
// version: 1.
|
|
92682
|
+
// version: 1.329.0-9b52e8059d
|
|
92653
92683
|
|
|
92654
92684
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92655
92685
|
const { stringify, parse } = JSON;
|
|
@@ -115216,7 +115246,7 @@ register$1({
|
|
|
115216
115246
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
115217
115247
|
instrument: instrument$1,
|
|
115218
115248
|
});
|
|
115219
|
-
// version: 1.
|
|
115249
|
+
// version: 1.329.0-beac2bb064
|
|
115220
115250
|
|
|
115221
115251
|
// On core the unstable adapters are re-exported with different names,
|
|
115222
115252
|
// we want to match them here.
|
|
@@ -115368,7 +115398,7 @@ withDefaultLuvio((luvio) => {
|
|
|
115368
115398
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
115369
115399
|
graphQLImperative = ldsAdapter;
|
|
115370
115400
|
});
|
|
115371
|
-
// version: 1.
|
|
115401
|
+
// version: 1.329.0-beac2bb064
|
|
115372
115402
|
|
|
115373
115403
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
115374
115404
|
__proto__: null,
|
|
@@ -115778,34 +115808,42 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
|
|
|
115778
115808
|
invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResponse, nativeAdapterRequestContext);
|
|
115779
115809
|
}
|
|
115780
115810
|
else {
|
|
115781
|
-
|
|
115782
|
-
|
|
115783
|
-
|
|
115784
|
-
|
|
115785
|
-
|
|
115786
|
-
|
|
115787
|
-
|
|
115788
|
-
|
|
115789
|
-
|
|
115790
|
-
|
|
115791
|
-
|
|
115792
|
-
|
|
115793
|
-
|
|
115794
|
-
|
|
115795
|
-
|
|
115796
|
-
|
|
115797
|
-
|
|
115798
|
-
|
|
115799
|
-
|
|
115800
|
-
|
|
115801
|
-
|
|
115802
|
-
|
|
115803
|
-
|
|
115804
|
-
|
|
115805
|
-
|
|
115806
|
-
|
|
115807
|
-
|
|
115808
|
-
|
|
115811
|
+
draftManager.stopQueueWhileRunning(() => {
|
|
115812
|
+
return new Promise((resolve) => {
|
|
115813
|
+
invokeDmlAdapter(adapter, parse(config), async (responseValue) => {
|
|
115814
|
+
const draftIds = draftIdsForResponseValue(responseValue);
|
|
115815
|
+
if (responseValue.error === undefined &&
|
|
115816
|
+
draftIds !== undefined &&
|
|
115817
|
+
draftIds.length > 0) {
|
|
115818
|
+
const draftId = draftIds[draftIds.length - 1];
|
|
115819
|
+
const managerState = await draftManager.getQueue();
|
|
115820
|
+
const draftItem = managerState.items.find((x) => x.id === draftId);
|
|
115821
|
+
if (draftItem === undefined) {
|
|
115822
|
+
// draftItem no longer exists, might have already been uploaded
|
|
115823
|
+
ldsMobileInstrumentation$1.log('tried to set metadata on draft item that no longer exists');
|
|
115824
|
+
resolve(responseValue);
|
|
115825
|
+
return;
|
|
115826
|
+
}
|
|
115827
|
+
draftManager
|
|
115828
|
+
.setMetadata(draftId, { ...draftItem.metadata, ...metadata })
|
|
115829
|
+
.then(() => {
|
|
115830
|
+
resolve(responseValue);
|
|
115831
|
+
})
|
|
115832
|
+
.catch((error) => {
|
|
115833
|
+
resolve(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
|
|
115834
|
+
});
|
|
115835
|
+
}
|
|
115836
|
+
else {
|
|
115837
|
+
let response = responseValue;
|
|
115838
|
+
response.error =
|
|
115839
|
+
createNativeFetchErrorResponse(NO_DRAFT_CREATED_MESSAGE);
|
|
115840
|
+
resolve(response);
|
|
115841
|
+
}
|
|
115842
|
+
}, nativeAdapterRequestContext);
|
|
115843
|
+
}).then((callbackValue) => {
|
|
115844
|
+
onResponse(callbackValue);
|
|
115845
|
+
});
|
|
115846
|
+
});
|
|
115809
115847
|
}
|
|
115810
115848
|
}
|
|
115811
115849
|
/*
|
|
@@ -116130,7 +116168,7 @@ const callbacks$1 = [];
|
|
|
116130
116168
|
function register(r) {
|
|
116131
116169
|
callbacks$1.forEach((callback) => callback(r));
|
|
116132
116170
|
}
|
|
116133
|
-
// version: 1.
|
|
116171
|
+
// version: 1.329.0-9b52e8059d
|
|
116134
116172
|
|
|
116135
116173
|
/**
|
|
116136
116174
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -117193,4 +117231,4 @@ const { luvio } = getRuntime();
|
|
|
117193
117231
|
setDefaultLuvio({ luvio });
|
|
117194
117232
|
|
|
117195
117233
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
117196
|
-
// version: 1.
|
|
117234
|
+
// version: 1.329.0-9b52e8059d
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
function isPendingSnapshot$1(snapshot) {
|
|
78
78
|
return snapshot.state === SnapshotState$3.Pending;
|
|
79
79
|
}
|
|
80
|
-
function createErrorSnapshot
|
|
80
|
+
function createErrorSnapshot(error, refresh) {
|
|
81
81
|
deepFreeze(error);
|
|
82
82
|
const snap = {
|
|
83
83
|
error,
|
|
@@ -2105,7 +2105,7 @@
|
|
|
2105
2105
|
return snapshot;
|
|
2106
2106
|
}
|
|
2107
2107
|
const refresh = snapshot !== undefined ? snapshot.refresh : undefined;
|
|
2108
|
-
return createErrorSnapshot
|
|
2108
|
+
return createErrorSnapshot({
|
|
2109
2109
|
body: undefined,
|
|
2110
2110
|
headers: {},
|
|
2111
2111
|
ok: false,
|
|
@@ -3759,7 +3759,7 @@
|
|
|
3759
3759
|
return this.environment.createSnapshot(selector, refresh);
|
|
3760
3760
|
}
|
|
3761
3761
|
errorSnapshot(error, refresh) {
|
|
3762
|
-
return createErrorSnapshot
|
|
3762
|
+
return createErrorSnapshot(error, refresh);
|
|
3763
3763
|
}
|
|
3764
3764
|
dispatchResourceRequest(resourceRequest, context) {
|
|
3765
3765
|
let mergedResourceRequest = resourceRequest;
|
|
@@ -4271,7 +4271,7 @@
|
|
|
4271
4271
|
}
|
|
4272
4272
|
callbacks.push(callback);
|
|
4273
4273
|
}
|
|
4274
|
-
// version: 1.
|
|
4274
|
+
// version: 1.329.0-9b52e8059d
|
|
4275
4275
|
|
|
4276
4276
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4277
4277
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5219,7 +5219,7 @@
|
|
|
5219
5219
|
const { apiFamily, name } = metadata;
|
|
5220
5220
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5221
5221
|
}
|
|
5222
|
-
// version: 1.
|
|
5222
|
+
// version: 1.329.0-9b52e8059d
|
|
5223
5223
|
|
|
5224
5224
|
/**
|
|
5225
5225
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -9563,13 +9563,12 @@
|
|
|
9563
9563
|
}
|
|
9564
9564
|
}
|
|
9565
9565
|
}
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
}
|
|
9566
|
+
// If the fields requested off of this spanning record are external fields, skip them to avoid creating request that exceed the SOQL limits on external data. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_limits.htm
|
|
9567
|
+
const state = fieldValueRep.linkData();
|
|
9568
|
+
if (state !== undefined) {
|
|
9569
|
+
const { fields } = state;
|
|
9570
|
+
if (includes$3.call(fields, 'ExternalId')) {
|
|
9571
|
+
continue;
|
|
9573
9572
|
}
|
|
9574
9573
|
}
|
|
9575
9574
|
}
|
|
@@ -33857,7 +33856,7 @@
|
|
|
33857
33856
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33858
33857
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33859
33858
|
});
|
|
33860
|
-
// version: 1.
|
|
33859
|
+
// version: 1.329.0-beac2bb064
|
|
33861
33860
|
|
|
33862
33861
|
/**
|
|
33863
33862
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -47529,6 +47528,12 @@
|
|
|
47529
47528
|
draftCount: this.draftStore.getCount(),
|
|
47530
47529
|
});
|
|
47531
47530
|
}
|
|
47531
|
+
stopQueueWhileRunning(action) {
|
|
47532
|
+
this.stopQueueManually(true);
|
|
47533
|
+
return action().finally(() => {
|
|
47534
|
+
this.startQueueSafe();
|
|
47535
|
+
});
|
|
47536
|
+
}
|
|
47532
47537
|
/**
|
|
47533
47538
|
* Used to stop the queue within DraftQueue without user interaction
|
|
47534
47539
|
*/
|
|
@@ -48305,6 +48310,14 @@
|
|
|
48305
48310
|
stopQueue() {
|
|
48306
48311
|
return this.draftQueue.stopQueue();
|
|
48307
48312
|
}
|
|
48313
|
+
/**
|
|
48314
|
+
* Stops the draft queue manually without notifying the user and then runs the passed action.
|
|
48315
|
+
* After the action is completed it will safely start the queue if the user had set it to be
|
|
48316
|
+
* started.
|
|
48317
|
+
*/
|
|
48318
|
+
stopQueueWhileRunning(action) {
|
|
48319
|
+
return this.draftQueue.stopQueueWhileRunning(action);
|
|
48320
|
+
}
|
|
48308
48321
|
/**
|
|
48309
48322
|
* Subscribes the listener to changes to the draft queue.
|
|
48310
48323
|
*
|
|
@@ -80247,24 +80260,37 @@
|
|
|
80247
80260
|
// so eslint doesn't complain about nimbus
|
|
80248
80261
|
/* global __nimbus */
|
|
80249
80262
|
function chunkToBase64(chunk) {
|
|
80250
|
-
|
|
80251
|
-
const
|
|
80252
|
-
for (let i = 0; i < chunk.length; i += chunkSize) {
|
|
80253
|
-
binary += String.fromCharCode.apply(null, chunk.subarray(i, i + chunkSize));
|
|
80254
|
-
}
|
|
80263
|
+
const bytes = new Uint8Array(chunk);
|
|
80264
|
+
const binary = String.fromCharCode.apply(null, bytes);
|
|
80255
80265
|
return btoa(binary);
|
|
80256
80266
|
}
|
|
80257
|
-
async function streamBufferToBinaryStore(binaryStore,
|
|
80267
|
+
async function streamBufferToBinaryStore(binaryStore, file, mimeType) {
|
|
80258
80268
|
const uri = await binaryStore.createStream(mimeType);
|
|
80259
|
-
const
|
|
80260
|
-
const
|
|
80261
|
-
|
|
80262
|
-
|
|
80263
|
-
|
|
80264
|
-
|
|
80269
|
+
const CHUNK_SIZE = 64 * 1024; // 64KB
|
|
80270
|
+
const fileSize = file.size;
|
|
80271
|
+
let offset = 0;
|
|
80272
|
+
try {
|
|
80273
|
+
while (offset < fileSize) {
|
|
80274
|
+
const end = Math.min(offset + CHUNK_SIZE, fileSize);
|
|
80275
|
+
const chunk = file.slice(offset, end);
|
|
80276
|
+
const arrayBuffer = await chunk.arrayBuffer();
|
|
80277
|
+
const base64Chunk = chunkToBase64(arrayBuffer);
|
|
80278
|
+
await binaryStore.writeToStream(uri, base64Chunk);
|
|
80279
|
+
offset = end;
|
|
80280
|
+
}
|
|
80281
|
+
await binaryStore.closeStream(uri);
|
|
80282
|
+
return uri;
|
|
80283
|
+
}
|
|
80284
|
+
catch (error) {
|
|
80285
|
+
await binaryStore.closeStream(uri);
|
|
80286
|
+
throw error;
|
|
80265
80287
|
}
|
|
80266
|
-
|
|
80267
|
-
|
|
80288
|
+
}
|
|
80289
|
+
function isFileLike(object) {
|
|
80290
|
+
return (object &&
|
|
80291
|
+
typeof object === 'object' &&
|
|
80292
|
+
typeof object.size === 'number' &&
|
|
80293
|
+
typeof object.slice === 'function');
|
|
80268
80294
|
}
|
|
80269
80295
|
function createContentDocumentAndVersionDraftAdapterFactory(luvio, binaryStore, actionHandler, durableRecordStore) {
|
|
80270
80296
|
return async function createContentDocumentAndVersionDraftAdapter(config, buildResourceRequest, requestContext) {
|
|
@@ -80279,15 +80305,17 @@
|
|
|
80279
80305
|
if (!isFileReference(config.fileData)) {
|
|
80280
80306
|
const { fileData } = config;
|
|
80281
80307
|
const { name, size, type } = fileData;
|
|
80282
|
-
|
|
80283
|
-
|
|
80284
|
-
// see if new chunking-api exists, if it doesnt fall back to memory-intensive mobile api
|
|
80308
|
+
let uri = ''; // Initialize uri with an empty string
|
|
80309
|
+
// Check if chunking API exists, fallback if it doesn't
|
|
80285
80310
|
if (!__nimbus.plugins.LdsBinaryStorePlugin.createStream) {
|
|
80311
|
+
const buffer = await fileData.arrayBuffer();
|
|
80286
80312
|
uri = await binaryStore.store(new Uint8Array(buffer), type, size);
|
|
80287
80313
|
}
|
|
80288
|
-
else {
|
|
80289
|
-
|
|
80314
|
+
else if (isFileLike(fileData)) {
|
|
80315
|
+
// Only pass to streamBufferToBinaryStore if it's FileLike
|
|
80316
|
+
uri = await streamBufferToBinaryStore(binaryStore, fileData, type);
|
|
80290
80317
|
}
|
|
80318
|
+
else ;
|
|
80291
80319
|
config.fileData = {
|
|
80292
80320
|
isFileReference: true,
|
|
80293
80321
|
handle: uri,
|
|
@@ -86686,18 +86714,6 @@
|
|
|
86686
86714
|
}
|
|
86687
86715
|
return seenRecords;
|
|
86688
86716
|
}
|
|
86689
|
-
function createErrorSnapshot(result, snapshot) {
|
|
86690
|
-
return {
|
|
86691
|
-
...snapshot,
|
|
86692
|
-
data: undefined,
|
|
86693
|
-
state: 'Error',
|
|
86694
|
-
error: {
|
|
86695
|
-
body: {
|
|
86696
|
-
message: result.errors,
|
|
86697
|
-
},
|
|
86698
|
-
},
|
|
86699
|
-
};
|
|
86700
|
-
}
|
|
86701
86717
|
function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
|
|
86702
86718
|
return {
|
|
86703
86719
|
refresh,
|
|
@@ -87215,7 +87231,18 @@
|
|
|
87215
87231
|
// currently by design if there are any graphql errors we return an ErrorSnapshot
|
|
87216
87232
|
// partial results are not supported at this time
|
|
87217
87233
|
if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
|
|
87218
|
-
|
|
87234
|
+
const errors = gqlResult.errors || [];
|
|
87235
|
+
let responseErrors = errors.map((e) => {
|
|
87236
|
+
return { message: e instanceof Error ? e.message : String(e) };
|
|
87237
|
+
});
|
|
87238
|
+
return {
|
|
87239
|
+
data: undefined,
|
|
87240
|
+
state: 'Error',
|
|
87241
|
+
error: {
|
|
87242
|
+
errorType: 'adapterError',
|
|
87243
|
+
error: responseErrors,
|
|
87244
|
+
},
|
|
87245
|
+
};
|
|
87219
87246
|
}
|
|
87220
87247
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
87221
87248
|
// Fulfilled snapshot (this only happens in this code path if
|
|
@@ -88390,6 +88417,9 @@
|
|
|
88390
88417
|
stopQueue() {
|
|
88391
88418
|
return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
|
|
88392
88419
|
}
|
|
88420
|
+
stopQueueWhileRunning(_action) {
|
|
88421
|
+
return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
|
|
88422
|
+
}
|
|
88393
88423
|
replaceAction(_actionId, _withActionId) {
|
|
88394
88424
|
return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
|
|
88395
88425
|
}
|
|
@@ -92655,7 +92685,7 @@
|
|
|
92655
92685
|
id: '@salesforce/lds-network-adapter',
|
|
92656
92686
|
instrument: instrument$2,
|
|
92657
92687
|
});
|
|
92658
|
-
// version: 1.
|
|
92688
|
+
// version: 1.329.0-9b52e8059d
|
|
92659
92689
|
|
|
92660
92690
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92661
92691
|
const { stringify, parse } = JSON;
|
|
@@ -115222,7 +115252,7 @@
|
|
|
115222
115252
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
115223
115253
|
instrument: instrument$1,
|
|
115224
115254
|
});
|
|
115225
|
-
// version: 1.
|
|
115255
|
+
// version: 1.329.0-beac2bb064
|
|
115226
115256
|
|
|
115227
115257
|
// On core the unstable adapters are re-exported with different names,
|
|
115228
115258
|
// we want to match them here.
|
|
@@ -115374,7 +115404,7 @@
|
|
|
115374
115404
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
115375
115405
|
graphQLImperative = ldsAdapter;
|
|
115376
115406
|
});
|
|
115377
|
-
// version: 1.
|
|
115407
|
+
// version: 1.329.0-beac2bb064
|
|
115378
115408
|
|
|
115379
115409
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
115380
115410
|
__proto__: null,
|
|
@@ -115784,34 +115814,42 @@
|
|
|
115784
115814
|
invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResponse, nativeAdapterRequestContext);
|
|
115785
115815
|
}
|
|
115786
115816
|
else {
|
|
115787
|
-
|
|
115788
|
-
|
|
115789
|
-
|
|
115790
|
-
|
|
115791
|
-
|
|
115792
|
-
|
|
115793
|
-
|
|
115794
|
-
|
|
115795
|
-
|
|
115796
|
-
|
|
115797
|
-
|
|
115798
|
-
|
|
115799
|
-
|
|
115800
|
-
|
|
115801
|
-
|
|
115802
|
-
|
|
115803
|
-
|
|
115804
|
-
|
|
115805
|
-
|
|
115806
|
-
|
|
115807
|
-
|
|
115808
|
-
|
|
115809
|
-
|
|
115810
|
-
|
|
115811
|
-
|
|
115812
|
-
|
|
115813
|
-
|
|
115814
|
-
|
|
115817
|
+
draftManager.stopQueueWhileRunning(() => {
|
|
115818
|
+
return new Promise((resolve) => {
|
|
115819
|
+
invokeDmlAdapter(adapter, parse(config), async (responseValue) => {
|
|
115820
|
+
const draftIds = draftIdsForResponseValue(responseValue);
|
|
115821
|
+
if (responseValue.error === undefined &&
|
|
115822
|
+
draftIds !== undefined &&
|
|
115823
|
+
draftIds.length > 0) {
|
|
115824
|
+
const draftId = draftIds[draftIds.length - 1];
|
|
115825
|
+
const managerState = await draftManager.getQueue();
|
|
115826
|
+
const draftItem = managerState.items.find((x) => x.id === draftId);
|
|
115827
|
+
if (draftItem === undefined) {
|
|
115828
|
+
// draftItem no longer exists, might have already been uploaded
|
|
115829
|
+
ldsMobileInstrumentation$1.log('tried to set metadata on draft item that no longer exists');
|
|
115830
|
+
resolve(responseValue);
|
|
115831
|
+
return;
|
|
115832
|
+
}
|
|
115833
|
+
draftManager
|
|
115834
|
+
.setMetadata(draftId, { ...draftItem.metadata, ...metadata })
|
|
115835
|
+
.then(() => {
|
|
115836
|
+
resolve(responseValue);
|
|
115837
|
+
})
|
|
115838
|
+
.catch((error) => {
|
|
115839
|
+
resolve(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
|
|
115840
|
+
});
|
|
115841
|
+
}
|
|
115842
|
+
else {
|
|
115843
|
+
let response = responseValue;
|
|
115844
|
+
response.error =
|
|
115845
|
+
createNativeFetchErrorResponse(NO_DRAFT_CREATED_MESSAGE);
|
|
115846
|
+
resolve(response);
|
|
115847
|
+
}
|
|
115848
|
+
}, nativeAdapterRequestContext);
|
|
115849
|
+
}).then((callbackValue) => {
|
|
115850
|
+
onResponse(callbackValue);
|
|
115851
|
+
});
|
|
115852
|
+
});
|
|
115815
115853
|
}
|
|
115816
115854
|
}
|
|
115817
115855
|
/*
|
|
@@ -116136,7 +116174,7 @@
|
|
|
116136
116174
|
function register(r) {
|
|
116137
116175
|
callbacks$1.forEach((callback) => callback(r));
|
|
116138
116176
|
}
|
|
116139
|
-
// version: 1.
|
|
116177
|
+
// version: 1.329.0-9b52e8059d
|
|
116140
116178
|
|
|
116141
116179
|
/**
|
|
116142
116180
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -117218,4 +117256,4 @@
|
|
|
117218
117256
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
117219
117257
|
|
|
117220
117258
|
}));
|
|
117221
|
-
// version: 1.
|
|
117259
|
+
// version: 1.329.0-9b52e8059d
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.329.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
40
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
41
|
-
"@salesforce/lds-drafts": "^1.
|
|
42
|
-
"@salesforce/lds-graphql-parser": "^1.
|
|
43
|
-
"@salesforce/lds-luvio-engine": "^1.
|
|
44
|
-
"@salesforce/lds-runtime-mobile": "^1.
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.329.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.329.0",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.329.0",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.329.0",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.329.0",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.329.0",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.329.0",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.329.0",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|