@salesforce/lds-runtime-aura 1.352.0 → 1.353.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/ldsEngineCreator.js +110 -36
- package/package.json +31 -31
package/dist/ldsEngineCreator.js
CHANGED
|
@@ -409,6 +409,7 @@ class NetworkCommand extends BaseCommand {
|
|
|
409
409
|
return err(newResult.error);
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
|
+
async afterRequestHooks(_options) { }
|
|
412
413
|
}
|
|
413
414
|
function buildServiceDescriptor$d() {
|
|
414
415
|
return {
|
|
@@ -445,17 +446,26 @@ class AuraNetworkCommand extends NetworkCommand {
|
|
|
445
446
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
446
447
|
return responsePromise
|
|
447
448
|
.then((response) => {
|
|
448
|
-
|
|
449
|
+
const auraReturnValue = response.getReturnValue();
|
|
450
|
+
try {
|
|
451
|
+
this.afterRequestHooks({ statusCode: 200 }); // Treat all aura success as 200
|
|
452
|
+
}
|
|
453
|
+
catch (e) { }
|
|
454
|
+
return ok(auraReturnValue);
|
|
449
455
|
})
|
|
450
456
|
.catch((error) => {
|
|
451
457
|
if (!error || !error.getError) {
|
|
452
458
|
return err(toError('Failed to get error from response'));
|
|
453
459
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
460
|
+
else {
|
|
461
|
+
const actionErrors = error.getError();
|
|
462
|
+
if (actionErrors.length > 0) {
|
|
463
|
+
return err(coerceError(actionErrors));
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
return err(toError('Error fetching component'));
|
|
467
|
+
}
|
|
457
468
|
}
|
|
458
|
-
return err(toError('Error fetching component'));
|
|
459
469
|
});
|
|
460
470
|
}
|
|
461
471
|
fetch() {
|
|
@@ -489,19 +499,31 @@ class CacheControlCommand extends BaseCommand {
|
|
|
489
499
|
constructor(services) {
|
|
490
500
|
super();
|
|
491
501
|
this.services = services;
|
|
502
|
+
this.operationType = 'query';
|
|
492
503
|
this.rebuildUnsubscribe = () => { };
|
|
493
504
|
this.refreshUnsubscribe = () => { };
|
|
505
|
+
this.lastEmittedData = undefined;
|
|
506
|
+
this.subscribeToMostRecentKeys = () => undefined;
|
|
494
507
|
this.subscriptions = [];
|
|
495
508
|
this.instantiationTime = Date.now() / 1000; // in seconds
|
|
496
509
|
}
|
|
497
510
|
execute(overrides) {
|
|
511
|
+
this.subscribeToMostRecentKeys = () => undefined;
|
|
498
512
|
this.rebuildUnsubscribe();
|
|
499
513
|
this.refreshUnsubscribe();
|
|
500
514
|
const mergedCacheControlConfig = mergeCacheControlConfigs(this.cacheControlStrategyConfig, overrides);
|
|
501
515
|
const resultPromise = this.services.cacheController.execute(mergedCacheControlConfig, (cache) => this.buildRequestRunner(cache), {
|
|
502
516
|
instrumentationAttributes: this.instrumentationAttributes,
|
|
503
517
|
});
|
|
504
|
-
return resultPromise
|
|
518
|
+
return resultPromise.then((result) => {
|
|
519
|
+
if (this.operationType === 'query') {
|
|
520
|
+
this.subscribeToMostRecentKeys();
|
|
521
|
+
}
|
|
522
|
+
if (result.isOk() && this.lastEmittedData === undefined) {
|
|
523
|
+
this.lastEmittedData = result.value.data;
|
|
524
|
+
}
|
|
525
|
+
return result;
|
|
526
|
+
});
|
|
505
527
|
}
|
|
506
528
|
// TODO: This should likely be abstract in v2. For v1, provide default comparison logic.
|
|
507
529
|
equals(result1, result2) {
|
|
@@ -514,12 +536,13 @@ class CacheControlCommand extends BaseCommand {
|
|
|
514
536
|
writeToCache: (networkResult) => this.writeToCacheAndPublish(cache, networkResult),
|
|
515
537
|
};
|
|
516
538
|
}
|
|
539
|
+
async afterRequestHooks(_options) { }
|
|
517
540
|
refresh() {
|
|
518
|
-
return this.
|
|
519
|
-
if (
|
|
520
|
-
return
|
|
541
|
+
return this.rerun({ cacheControlConfig: { type: 'no-cache' } }).then((result) => {
|
|
542
|
+
if (result.isErr()) {
|
|
543
|
+
return result;
|
|
521
544
|
}
|
|
522
|
-
return
|
|
545
|
+
return ok(undefined);
|
|
523
546
|
});
|
|
524
547
|
}
|
|
525
548
|
// TODO: This is added as a temporary measure for ensuring that cache write events are
|
|
@@ -546,7 +569,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
546
569
|
else {
|
|
547
570
|
const data = readResult.value;
|
|
548
571
|
if (data !== undefined) {
|
|
549
|
-
this.subscribeToKeys(recordableCache.keysRead
|
|
572
|
+
this.subscribeToMostRecentKeys = () => this.subscribeToKeys(recordableCache.keysRead);
|
|
550
573
|
return ok({
|
|
551
574
|
data,
|
|
552
575
|
subscribe: this.buildSubscribe(),
|
|
@@ -574,29 +597,36 @@ class CacheControlCommand extends BaseCommand {
|
|
|
574
597
|
};
|
|
575
598
|
};
|
|
576
599
|
}
|
|
577
|
-
|
|
600
|
+
rerun(overrides) {
|
|
601
|
+
return this.execute(overrides).then((result) => {
|
|
602
|
+
if (result.isErr()) {
|
|
603
|
+
this.invokeConsumerCallbacks(result);
|
|
604
|
+
return result;
|
|
605
|
+
}
|
|
606
|
+
if (!this.equals(this.lastEmittedData, result.value.data)) {
|
|
607
|
+
this.lastEmittedData = result.value.data;
|
|
608
|
+
this.invokeConsumerCallbacks(ok(result.value.data));
|
|
609
|
+
}
|
|
610
|
+
return result;
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
subscribeToKeys(keysRead) {
|
|
578
614
|
const { pubSub } = this.services;
|
|
579
615
|
if (!pubSub) {
|
|
580
616
|
return;
|
|
581
617
|
}
|
|
582
|
-
const executeAndHandleResult = (overrides) => {
|
|
583
|
-
return this.execute(overrides).then((result) => {
|
|
584
|
-
if (result.isErr()) {
|
|
585
|
-
this.invokeConsumerCallbacks(result);
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
if (!this.equals(lastResult, result.value.data)) {
|
|
589
|
-
this.invokeConsumerCallbacks(ok(result.value.data));
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
};
|
|
593
618
|
const createKeySubscriber = (type, callback) => pubSub.subscribe({
|
|
594
619
|
type,
|
|
595
620
|
predicate: (event) => setOverlaps(event.data, keysRead),
|
|
596
621
|
callback,
|
|
597
622
|
});
|
|
598
|
-
this
|
|
599
|
-
|
|
623
|
+
// Unsubscribe to be sure that this command didn't re-execute and re-subscribe in between the start of command execution and now
|
|
624
|
+
// it shouldn't be possible for this command to resubscribe between the beginning of execution and now
|
|
625
|
+
// ...but lets be defensive.
|
|
626
|
+
this.rebuildUnsubscribe();
|
|
627
|
+
this.refreshUnsubscribe();
|
|
628
|
+
this.rebuildUnsubscribe = createKeySubscriber('cacheUpdate', () => this.rerun({ now: this.instantiationTime }).then(() => undefined));
|
|
629
|
+
this.refreshUnsubscribe = createKeySubscriber('cacheInvalidation', () => this.rerun().then(() => undefined));
|
|
600
630
|
}
|
|
601
631
|
invokeConsumerCallbacks(data) {
|
|
602
632
|
this.subscriptions.forEach((cb) => {
|
|
@@ -683,17 +713,26 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
683
713
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
684
714
|
return responsePromise
|
|
685
715
|
.then((response) => {
|
|
686
|
-
|
|
716
|
+
const auraReturnValue = response.getReturnValue();
|
|
717
|
+
try {
|
|
718
|
+
this.afterRequestHooks({ statusCode: 200 }); // Treat all aura success as 200
|
|
719
|
+
}
|
|
720
|
+
catch (e) { }
|
|
721
|
+
return ok(auraReturnValue);
|
|
687
722
|
})
|
|
688
723
|
.catch((error) => {
|
|
689
724
|
if (!error || !error.getError) {
|
|
690
725
|
return err(toError('Failed to get error from response'));
|
|
691
726
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
727
|
+
else {
|
|
728
|
+
const actionErrors = error.getError();
|
|
729
|
+
if (actionErrors.length > 0) {
|
|
730
|
+
return err(coerceError(actionErrors));
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
return err(toError('Error fetching component'));
|
|
734
|
+
}
|
|
695
735
|
}
|
|
696
|
-
return err(toError('Error fetching component'));
|
|
697
736
|
});
|
|
698
737
|
}
|
|
699
738
|
}
|
|
@@ -819,10 +858,27 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
819
858
|
convertFetchResponseToData(response) {
|
|
820
859
|
return response.then((response) => {
|
|
821
860
|
if (response.ok) {
|
|
822
|
-
return response
|
|
861
|
+
return response
|
|
862
|
+
.json()
|
|
863
|
+
.then((json) => ok(json), (reason) => err(toError(reason)))
|
|
864
|
+
.finally(() => {
|
|
865
|
+
try {
|
|
866
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
867
|
+
}
|
|
868
|
+
catch (e) { }
|
|
869
|
+
});
|
|
823
870
|
}
|
|
824
871
|
else {
|
|
825
|
-
return this.coerceError(response)
|
|
872
|
+
return this.coerceError(response)
|
|
873
|
+
.then((coercedError) => {
|
|
874
|
+
return err(coercedError);
|
|
875
|
+
})
|
|
876
|
+
.finally(() => {
|
|
877
|
+
try {
|
|
878
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
879
|
+
}
|
|
880
|
+
catch (e) { }
|
|
881
|
+
});
|
|
826
882
|
}
|
|
827
883
|
}, (reason) => err(toError(reason)));
|
|
828
884
|
}
|
|
@@ -894,10 +950,27 @@ class FetchNetworkCommand extends NetworkCommand {
|
|
|
894
950
|
convertFetchResponseToData(response) {
|
|
895
951
|
return response.then((response) => {
|
|
896
952
|
if (response.ok) {
|
|
897
|
-
return response
|
|
953
|
+
return response
|
|
954
|
+
.json()
|
|
955
|
+
.then((json) => ok(json), (reason) => err(toError(reason)))
|
|
956
|
+
.finally(() => {
|
|
957
|
+
try {
|
|
958
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
959
|
+
}
|
|
960
|
+
catch (e) { }
|
|
961
|
+
});
|
|
898
962
|
}
|
|
899
963
|
else {
|
|
900
|
-
return this.coerceError(response)
|
|
964
|
+
return this.coerceError(response)
|
|
965
|
+
.then((coercedError) => {
|
|
966
|
+
return err(coercedError);
|
|
967
|
+
})
|
|
968
|
+
.finally(() => {
|
|
969
|
+
try {
|
|
970
|
+
this.afterRequestHooks({ statusCode: response.status });
|
|
971
|
+
}
|
|
972
|
+
catch (e) { }
|
|
973
|
+
});
|
|
901
974
|
}
|
|
902
975
|
}, (reason) => err(toError(reason)));
|
|
903
976
|
}
|
|
@@ -1665,6 +1738,7 @@ class CacheControlStrategy {
|
|
|
1665
1738
|
return [
|
|
1666
1739
|
(cacheControlMetadata) => cacheControlMetadata.type === 'max-age' &&
|
|
1667
1740
|
this.config.now > cacheControlMetadata.generatedTime + cacheControlMetadata.maxAge,
|
|
1741
|
+
(cacheControlMetadata) => cacheControlMetadata.type === 'max-age' && cacheControlMetadata.maxAge <= 0,
|
|
1668
1742
|
(cacheControlMetadata) => cacheControlMetadata.type === 'no-store',
|
|
1669
1743
|
];
|
|
1670
1744
|
}
|
|
@@ -5522,7 +5596,7 @@ function getEnvironmentSetting(name) {
|
|
|
5522
5596
|
}
|
|
5523
5597
|
return undefined;
|
|
5524
5598
|
}
|
|
5525
|
-
// version: 1.
|
|
5599
|
+
// version: 1.353.0-330d59cfcb
|
|
5526
5600
|
|
|
5527
5601
|
const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
|
|
5528
5602
|
//TODO: Some duplication here that can be most likely moved to a util class
|
|
@@ -6214,4 +6288,4 @@ function ldsEngineCreator() {
|
|
|
6214
6288
|
}
|
|
6215
6289
|
|
|
6216
6290
|
export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
6217
|
-
// version: 1.
|
|
6291
|
+
// version: 1.353.0-cc9b469dc4
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.353.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -34,47 +34,47 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@luvio/service-provisioner": "5.
|
|
38
|
-
"@luvio/tools-core": "5.
|
|
39
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
40
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
37
|
+
"@luvio/service-provisioner": "5.38.0",
|
|
38
|
+
"@luvio/tools-core": "5.38.0",
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.353.0",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.353.0",
|
|
41
41
|
"@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
|
|
42
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
43
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
44
|
-
"@salesforce/lds-bindings": "^1.
|
|
45
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
46
|
-
"@salesforce/lds-network-aura": "^1.
|
|
47
|
-
"@salesforce/lds-network-fetch": "^1.
|
|
42
|
+
"@salesforce/lds-ads-bridge": "^1.353.0",
|
|
43
|
+
"@salesforce/lds-aura-storage": "^1.353.0",
|
|
44
|
+
"@salesforce/lds-bindings": "^1.353.0",
|
|
45
|
+
"@salesforce/lds-instrumentation": "^1.353.0",
|
|
46
|
+
"@salesforce/lds-network-aura": "^1.353.0",
|
|
47
|
+
"@salesforce/lds-network-fetch": "^1.353.0",
|
|
48
48
|
"jwt-encode": "1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@luvio/command-aura-network": "5.
|
|
52
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
53
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
54
|
-
"@luvio/command-fetch-network": "5.
|
|
55
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
56
|
-
"@luvio/command-network": "5.
|
|
57
|
-
"@luvio/command-sse": "5.
|
|
58
|
-
"@luvio/command-streaming": "5.
|
|
51
|
+
"@luvio/command-aura-network": "5.38.0",
|
|
52
|
+
"@luvio/command-aura-normalized-cache-control": "5.38.0",
|
|
53
|
+
"@luvio/command-aura-resource-cache-control": "5.38.0",
|
|
54
|
+
"@luvio/command-fetch-network": "5.38.0",
|
|
55
|
+
"@luvio/command-http-normalized-cache-control": "5.38.0",
|
|
56
|
+
"@luvio/command-network": "5.38.0",
|
|
57
|
+
"@luvio/command-sse": "5.38.0",
|
|
58
|
+
"@luvio/command-streaming": "5.38.0",
|
|
59
59
|
"@luvio/network-adapter-composable": "0.156.7",
|
|
60
60
|
"@luvio/network-adapter-fetch": "0.156.7",
|
|
61
|
-
"@luvio/service-aura-network": "5.
|
|
62
|
-
"@luvio/service-cache": "5.
|
|
63
|
-
"@luvio/service-cache-control": "5.
|
|
64
|
-
"@luvio/service-fetch-network": "5.
|
|
65
|
-
"@luvio/service-instrument-command": "5.
|
|
66
|
-
"@luvio/service-pubsub": "5.
|
|
67
|
-
"@luvio/service-store": "5.
|
|
68
|
-
"@luvio/utils": "5.
|
|
69
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.
|
|
61
|
+
"@luvio/service-aura-network": "5.38.0",
|
|
62
|
+
"@luvio/service-cache": "5.38.0",
|
|
63
|
+
"@luvio/service-cache-control": "5.38.0",
|
|
64
|
+
"@luvio/service-fetch-network": "5.38.0",
|
|
65
|
+
"@luvio/service-instrument-command": "5.38.0",
|
|
66
|
+
"@luvio/service-pubsub": "5.38.0",
|
|
67
|
+
"@luvio/service-store": "5.38.0",
|
|
68
|
+
"@luvio/utils": "5.38.0",
|
|
69
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.353.0"
|
|
70
70
|
},
|
|
71
71
|
"luvioBundlesize": [
|
|
72
72
|
{
|
|
73
73
|
"path": "./dist/ldsEngineCreator.js",
|
|
74
74
|
"maxSize": {
|
|
75
|
-
"none": "
|
|
76
|
-
"min": "
|
|
77
|
-
"compressed": "
|
|
75
|
+
"none": "235 kB",
|
|
76
|
+
"min": "97 kB",
|
|
77
|
+
"compressed": "40 kB"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
],
|