@salesforce/lds-worker-api 1.281.0 → 1.283.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sfdc/es/ldsWorkerApi.js +26 -12
- package/dist/standalone/es/lds-worker-api.js +196 -82
- package/dist/standalone/umd/lds-worker-api.js +196 -82
- package/package.json +12 -12
|
@@ -385,16 +385,7 @@ function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, on
|
|
|
385
385
|
onResponse(responseValue);
|
|
386
386
|
})
|
|
387
387
|
.catch((error) => {
|
|
388
|
-
|
|
389
|
-
if (error instanceof Error) {
|
|
390
|
-
message = error.message;
|
|
391
|
-
}
|
|
392
|
-
else if (typeof error === 'string') {
|
|
393
|
-
message = error;
|
|
394
|
-
}
|
|
395
|
-
onResponse({
|
|
396
|
-
error: createNativeFetchErrorResponse(message),
|
|
397
|
-
});
|
|
388
|
+
onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
|
|
398
389
|
});
|
|
399
390
|
}
|
|
400
391
|
else {
|
|
@@ -445,6 +436,9 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
|
|
|
445
436
|
.setMetadata(draftId, { ...existingMetadata, ...metadata })
|
|
446
437
|
.then(() => {
|
|
447
438
|
onResponse(responseValue);
|
|
439
|
+
})
|
|
440
|
+
.catch((error) => {
|
|
441
|
+
onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
|
|
448
442
|
});
|
|
449
443
|
}
|
|
450
444
|
else {
|
|
@@ -487,8 +481,13 @@ function invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResp
|
|
|
487
481
|
onResponse(response);
|
|
488
482
|
}
|
|
489
483
|
else {
|
|
490
|
-
draftManager
|
|
484
|
+
draftManager
|
|
485
|
+
.setMetadata(addedDrafts[0].id, metadata)
|
|
486
|
+
.then(() => {
|
|
491
487
|
onResponse(responseValue);
|
|
488
|
+
})
|
|
489
|
+
.catch((error) => {
|
|
490
|
+
onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
|
|
492
491
|
});
|
|
493
492
|
}
|
|
494
493
|
});
|
|
@@ -537,6 +536,9 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
|
|
|
537
536
|
.replaceAction(draftIdToReplace, addedDrafts[0].id)
|
|
538
537
|
.then(() => {
|
|
539
538
|
onResponse(responseValue);
|
|
539
|
+
})
|
|
540
|
+
.catch((error) => {
|
|
541
|
+
onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
|
|
540
542
|
});
|
|
541
543
|
}
|
|
542
544
|
});
|
|
@@ -549,6 +551,18 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
|
|
|
549
551
|
}, nativeAdapterRequestContext);
|
|
550
552
|
});
|
|
551
553
|
}
|
|
554
|
+
function convertErrorIntoNativeFetchError(error, defaultMessage) {
|
|
555
|
+
let message = defaultMessage;
|
|
556
|
+
if (error instanceof Error) {
|
|
557
|
+
message = error.message;
|
|
558
|
+
}
|
|
559
|
+
else if (typeof error === 'string') {
|
|
560
|
+
message = error;
|
|
561
|
+
}
|
|
562
|
+
return {
|
|
563
|
+
error: createNativeFetchErrorResponse(message),
|
|
564
|
+
};
|
|
565
|
+
}
|
|
552
566
|
function draftIdsForResponseValue(response) {
|
|
553
567
|
if (response.data !== undefined &&
|
|
554
568
|
response.data.drafts !== undefined &&
|
|
@@ -1048,4 +1062,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1048
1062
|
}
|
|
1049
1063
|
|
|
1050
1064
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1051
|
-
// version: 1.
|
|
1065
|
+
// version: 1.283.0-a330da944
|