@salesforce/lds-runtime-webruntime 1.362.0 → 1.363.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/ldsWebruntimeOneStoreInit.js +106 -6
- package/package.json +23 -23
|
@@ -417,10 +417,17 @@ class AuraNetworkCommand extends NetworkCommand {
|
|
|
417
417
|
longRunning: false,
|
|
418
418
|
storable: false,
|
|
419
419
|
};
|
|
420
|
+
this.networkPreference = 'aura';
|
|
421
|
+
}
|
|
422
|
+
get fetchParams() {
|
|
423
|
+
throw new Error('Fetch parameters must be specified when using HTTP transport on an Aura adapter');
|
|
420
424
|
}
|
|
421
425
|
coerceAuraErrors(auraErrors) {
|
|
422
426
|
return toError(auraErrors[0]); // Default Implmentation stringifies the response
|
|
423
427
|
}
|
|
428
|
+
async coerceFetchErrors(errorResponse) {
|
|
429
|
+
return toError(errorResponse.statusText); // Default Behavior
|
|
430
|
+
}
|
|
424
431
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
425
432
|
return responsePromise
|
|
426
433
|
.then((response) => {
|
|
@@ -446,8 +453,49 @@ class AuraNetworkCommand extends NetworkCommand {
|
|
|
446
453
|
}
|
|
447
454
|
});
|
|
448
455
|
}
|
|
456
|
+
convertFetchResponseToData(response) {
|
|
457
|
+
return response.then((response) => {
|
|
458
|
+
if (response.ok) {
|
|
459
|
+
return response
|
|
460
|
+
.json()
|
|
461
|
+
.then((json) => ok(json), (reason) => err(toError(reason)))
|
|
462
|
+
.finally(() => {
|
|
463
|
+
try {
|
|
464
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
465
|
+
}
|
|
466
|
+
catch (e) { }
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
return this.coerceFetchErrors(response)
|
|
471
|
+
.then((coercedError) => {
|
|
472
|
+
return err(coercedError);
|
|
473
|
+
})
|
|
474
|
+
.finally(() => {
|
|
475
|
+
try {
|
|
476
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
477
|
+
}
|
|
478
|
+
catch (e) { }
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}, (reason) => err(toError(reason)));
|
|
482
|
+
}
|
|
483
|
+
shouldUseAuraNetwork() {
|
|
484
|
+
return (this.services.auraNetwork !== undefined &&
|
|
485
|
+
(this.networkPreference === 'aura' || !this.services.fetch));
|
|
486
|
+
}
|
|
487
|
+
shouldUseFetch() {
|
|
488
|
+
return (this.services.fetch !== undefined &&
|
|
489
|
+
(this.networkPreference === 'http' || !this.services.auraNetwork));
|
|
490
|
+
}
|
|
449
491
|
fetch() {
|
|
450
|
-
|
|
492
|
+
if (this.shouldUseAuraNetwork()) {
|
|
493
|
+
return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig), this.coerceAuraErrors);
|
|
494
|
+
}
|
|
495
|
+
else if (this.shouldUseFetch()) {
|
|
496
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
497
|
+
}
|
|
498
|
+
return resolvedPromiseLike(err(toError('Aura/Fetch network services not found')));
|
|
451
499
|
}
|
|
452
500
|
}
|
|
453
501
|
|
|
@@ -723,6 +771,9 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
723
771
|
* @typeParam ExtraServices additional named services needed by a subclass
|
|
724
772
|
*/
|
|
725
773
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
774
|
+
get fetchParams() {
|
|
775
|
+
throw new Error('Fetch parameters must be specified when using HTTP transport on an Aura adapter');
|
|
776
|
+
}
|
|
726
777
|
constructor(services) {
|
|
727
778
|
super(services);
|
|
728
779
|
this.services = services;
|
|
@@ -732,13 +783,31 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
732
783
|
longRunning: false,
|
|
733
784
|
storable: false,
|
|
734
785
|
};
|
|
786
|
+
this.networkPreference = 'aura';
|
|
787
|
+
}
|
|
788
|
+
shouldUseAuraNetwork() {
|
|
789
|
+
return (this.services.auraNetwork !== undefined &&
|
|
790
|
+
(this.networkPreference === 'aura' || !this.services.fetch));
|
|
791
|
+
}
|
|
792
|
+
shouldUseFetch() {
|
|
793
|
+
return (this.services.fetch !== undefined &&
|
|
794
|
+
(this.networkPreference === 'http' || !this.services.auraNetwork));
|
|
735
795
|
}
|
|
736
796
|
requestFromNetwork() {
|
|
737
|
-
|
|
797
|
+
if (this.shouldUseAuraNetwork()) {
|
|
798
|
+
return this.convertAuraResponseToData(this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig), (errs) => this.coerceError(errs));
|
|
799
|
+
}
|
|
800
|
+
else if (this.shouldUseFetch()) {
|
|
801
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
802
|
+
}
|
|
803
|
+
return resolvedPromiseLike(err(toError('Aura/Fetch network services not found')));
|
|
738
804
|
}
|
|
739
805
|
coerceError(auraErrors) {
|
|
740
806
|
return toError(auraErrors[0]); // Default Implementation stringifies the response
|
|
741
807
|
}
|
|
808
|
+
async coerceFetchError(errorResponse) {
|
|
809
|
+
return toError(errorResponse.statusText); // Default Behavior
|
|
810
|
+
}
|
|
742
811
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
743
812
|
return responsePromise
|
|
744
813
|
.then((response) => {
|
|
@@ -764,6 +833,33 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
764
833
|
}
|
|
765
834
|
});
|
|
766
835
|
}
|
|
836
|
+
convertFetchResponseToData(response) {
|
|
837
|
+
return response.then((response) => {
|
|
838
|
+
if (response.ok) {
|
|
839
|
+
return response
|
|
840
|
+
.json()
|
|
841
|
+
.then((json) => ok(json), (reason) => err(toError(reason)))
|
|
842
|
+
.finally(() => {
|
|
843
|
+
try {
|
|
844
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
845
|
+
}
|
|
846
|
+
catch (e) { }
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
return this.coerceFetchError(response)
|
|
851
|
+
.then((coercedError) => {
|
|
852
|
+
return err(coercedError);
|
|
853
|
+
})
|
|
854
|
+
.finally(() => {
|
|
855
|
+
try {
|
|
856
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
857
|
+
}
|
|
858
|
+
catch (e) { }
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}, (reason) => err(toError(reason)));
|
|
862
|
+
}
|
|
767
863
|
}
|
|
768
864
|
|
|
769
865
|
/**
|
|
@@ -2628,14 +2724,18 @@ class JwtManager {
|
|
|
2628
2724
|
*/
|
|
2629
2725
|
|
|
2630
2726
|
|
|
2631
|
-
function buildServiceDescriptor(interceptors = { request: [] }) {
|
|
2727
|
+
function buildServiceDescriptor(interceptors = { request: [], response: [] }) {
|
|
2632
2728
|
return {
|
|
2633
2729
|
type: 'fetch',
|
|
2634
2730
|
version: '1.0',
|
|
2635
2731
|
service: function (...args) {
|
|
2636
|
-
const { request: requestInterceptors = [] } = interceptors;
|
|
2732
|
+
const { request: requestInterceptors = [], response: responseInterceptors = [] } = interceptors;
|
|
2637
2733
|
const pending = requestInterceptors.reduce((previousPromise, interceptor) => previousPromise.then(interceptor), resolvedPromiseLike(args));
|
|
2638
|
-
return pending
|
|
2734
|
+
return pending
|
|
2735
|
+
.then((args) => fetch(...args))
|
|
2736
|
+
.then((response) => {
|
|
2737
|
+
return responseInterceptors.reduce((previousPromise, interceptor) => previousPromise.then(interceptor), resolvedPromiseLike(response));
|
|
2738
|
+
});
|
|
2639
2739
|
},
|
|
2640
2740
|
};
|
|
2641
2741
|
}
|
|
@@ -2870,4 +2970,4 @@ const services = [
|
|
|
2870
2970
|
buildServiceDescriptor$2(),
|
|
2871
2971
|
];
|
|
2872
2972
|
setServices(services);
|
|
2873
|
-
// version: 1.
|
|
2973
|
+
// version: 1.363.0-99132bb508
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.363.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Webruntime runtime",
|
|
6
6
|
"main": "dist/ldsWebruntimeOneStoreInit.js",
|
|
@@ -35,33 +35,33 @@
|
|
|
35
35
|
"ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@luvio/service-provisioner": "5.
|
|
39
|
-
"@luvio/tools-core": "5.
|
|
38
|
+
"@luvio/service-provisioner": "5.41.0",
|
|
39
|
+
"@luvio/tools-core": "5.41.0",
|
|
40
40
|
"jwt-encode": "1.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@luvio/command-aura-network": "5.
|
|
44
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
45
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
46
|
-
"@luvio/command-fetch-network": "5.
|
|
47
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
48
|
-
"@luvio/command-ndjson": "5.
|
|
49
|
-
"@luvio/command-network": "5.
|
|
50
|
-
"@luvio/command-sse": "5.
|
|
51
|
-
"@luvio/command-streaming": "5.
|
|
52
|
-
"@luvio/jwt-manager": "5.
|
|
43
|
+
"@luvio/command-aura-network": "5.41.0",
|
|
44
|
+
"@luvio/command-aura-normalized-cache-control": "5.41.0",
|
|
45
|
+
"@luvio/command-aura-resource-cache-control": "5.41.0",
|
|
46
|
+
"@luvio/command-fetch-network": "5.41.0",
|
|
47
|
+
"@luvio/command-http-normalized-cache-control": "5.41.0",
|
|
48
|
+
"@luvio/command-ndjson": "5.41.0",
|
|
49
|
+
"@luvio/command-network": "5.41.0",
|
|
50
|
+
"@luvio/command-sse": "5.41.0",
|
|
51
|
+
"@luvio/command-streaming": "5.41.0",
|
|
52
|
+
"@luvio/jwt-manager": "5.41.0",
|
|
53
53
|
"@luvio/network-adapter-composable": "0.158.1",
|
|
54
54
|
"@luvio/network-adapter-fetch": "0.158.1",
|
|
55
|
-
"@luvio/service-aura-network": "5.
|
|
56
|
-
"@luvio/service-cache": "5.
|
|
57
|
-
"@luvio/service-cache-control": "5.
|
|
58
|
-
"@luvio/service-cache-inclusion-policy": "5.
|
|
59
|
-
"@luvio/service-fetch-network": "5.
|
|
60
|
-
"@luvio/service-instrument-command": "5.
|
|
61
|
-
"@luvio/service-pubsub": "5.
|
|
62
|
-
"@luvio/service-store": "5.
|
|
63
|
-
"@luvio/utils": "5.
|
|
64
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.
|
|
55
|
+
"@luvio/service-aura-network": "5.41.0",
|
|
56
|
+
"@luvio/service-cache": "5.41.0",
|
|
57
|
+
"@luvio/service-cache-control": "5.41.0",
|
|
58
|
+
"@luvio/service-cache-inclusion-policy": "5.41.0",
|
|
59
|
+
"@luvio/service-fetch-network": "5.41.0",
|
|
60
|
+
"@luvio/service-instrument-command": "5.41.0",
|
|
61
|
+
"@luvio/service-pubsub": "5.41.0",
|
|
62
|
+
"@luvio/service-store": "5.41.0",
|
|
63
|
+
"@luvio/utils": "5.41.0",
|
|
64
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.363.0"
|
|
65
65
|
},
|
|
66
66
|
"luvioBundlesize": [
|
|
67
67
|
{
|