@salesforce/lds-runtime-aura 1.319.0 → 1.321.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 +129 -87
- package/dist/types/predictive-loading/common/index.d.ts +2 -2
- package/dist/types/predictive-loading/pages/lex-default-page.d.ts +2 -2
- package/dist/types/predictive-loading/pages/object-home-page.d.ts +1 -2
- package/dist/types/predictive-loading/pages/predictive-prefetch-page.d.ts +5 -3
- package/dist/types/predictive-loading/pages/record-home-page.d.ts +4 -2
- package/dist/types/predictive-loading/prefetcher/lex-predictive-prefetcher.d.ts +3 -3
- package/dist/types/predictive-loading/prefetcher/predictive-prefetcher.d.ts +11 -6
- package/dist/types/predictive-loading/repository/prefetch-repository.d.ts +8 -6
- package/dist/types/predictive-loading/request-strategy/get-related-list-info-batch-request-strategy.d.ts +2 -0
- package/dist/types/predictive-loading/request-strategy/get-related-list-info-request-strategy.d.ts +1 -0
- package/package.json +25 -25
package/dist/ldsEngineCreator.js
CHANGED
|
@@ -130,9 +130,40 @@ let ConsoleLogger$1 = class ConsoleLogger {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
class Ok {
|
|
134
|
+
constructor(value) {
|
|
135
|
+
this.value = value;
|
|
136
|
+
}
|
|
137
|
+
isOk() {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
isErr() {
|
|
141
|
+
return !this.isOk();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
class Err {
|
|
145
|
+
constructor(error) {
|
|
146
|
+
this.error = error;
|
|
147
|
+
}
|
|
148
|
+
isOk() {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
isErr() {
|
|
152
|
+
return !this.isOk();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const ok = (value) => new Ok(value);
|
|
156
|
+
const err = (err) => new Err(err);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Returns a PromiseLike object that resolves with the specified result.
|
|
160
|
+
*
|
|
161
|
+
* @param result resolved result
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
133
164
|
function resolvedPromiseLike(result) {
|
|
134
165
|
// Don't nest anything promise like
|
|
135
|
-
if (
|
|
166
|
+
if (isPromiseLike(result)) {
|
|
136
167
|
return result.then((nextResult) => nextResult);
|
|
137
168
|
}
|
|
138
169
|
return {
|
|
@@ -157,7 +188,7 @@ function resolvedPromiseLike(result) {
|
|
|
157
188
|
* @returns PromiseLike that rejects with reason
|
|
158
189
|
*/
|
|
159
190
|
function rejectedPromiseLike(reason) {
|
|
160
|
-
if (
|
|
191
|
+
if (isPromiseLike(reason)) {
|
|
161
192
|
return reason.then((nextResult) => nextResult);
|
|
162
193
|
}
|
|
163
194
|
return {
|
|
@@ -175,11 +206,15 @@ function rejectedPromiseLike(reason) {
|
|
|
175
206
|
},
|
|
176
207
|
};
|
|
177
208
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Indicates if an object is PromiseLike.
|
|
211
|
+
*
|
|
212
|
+
* @param x anything
|
|
213
|
+
* @returns true if x is PromiseLike; false if not
|
|
214
|
+
*/
|
|
215
|
+
function isPromiseLike(x) {
|
|
216
|
+
return typeof x === 'object' && typeof (x === null || x === void 0 ? void 0 : x.then) === 'function';
|
|
181
217
|
}
|
|
182
|
-
|
|
183
218
|
/**
|
|
184
219
|
* Converts an arbitrary value to an Error.
|
|
185
220
|
*
|
|
@@ -193,31 +228,6 @@ function toError(x) {
|
|
|
193
228
|
return new Error(typeof x === 'string' ? x : JSON.stringify(x));
|
|
194
229
|
}
|
|
195
230
|
|
|
196
|
-
class Ok {
|
|
197
|
-
constructor(value) {
|
|
198
|
-
this.value = value;
|
|
199
|
-
}
|
|
200
|
-
isOk() {
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
isErr() {
|
|
204
|
-
return !this.isOk();
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
class Err {
|
|
208
|
-
constructor(error) {
|
|
209
|
-
this.error = error;
|
|
210
|
-
}
|
|
211
|
-
isOk() {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
isErr() {
|
|
215
|
-
return !this.isOk();
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const ok = (value) => new Ok(value);
|
|
219
|
-
const err = (err) => new Err(err);
|
|
220
|
-
|
|
221
231
|
/**
|
|
222
232
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
223
233
|
* All rights reserved.
|
|
@@ -1584,21 +1594,27 @@ const PDL_EXECUTE_ASYNC_OPTIONS = {
|
|
|
1584
1594
|
};
|
|
1585
1595
|
|
|
1586
1596
|
class PredictivePrefetchPage {
|
|
1587
|
-
constructor(context) {
|
|
1597
|
+
constructor(context, similarContext) {
|
|
1588
1598
|
this.context = context;
|
|
1589
|
-
this.similarContext =
|
|
1599
|
+
this.similarContext = similarContext;
|
|
1600
|
+
}
|
|
1601
|
+
getExactKey() {
|
|
1602
|
+
return { ...this.context };
|
|
1603
|
+
}
|
|
1604
|
+
getSimilarKey() {
|
|
1605
|
+
return { ...this.similarContext };
|
|
1590
1606
|
}
|
|
1591
1607
|
}
|
|
1592
1608
|
|
|
1593
1609
|
class LexDefaultPage extends PredictivePrefetchPage {
|
|
1594
|
-
constructor(context) {
|
|
1595
|
-
super(context);
|
|
1610
|
+
constructor(context, similarContext) {
|
|
1611
|
+
super(context, similarContext);
|
|
1596
1612
|
}
|
|
1597
1613
|
supportsRequest(_request) {
|
|
1598
1614
|
return true;
|
|
1599
1615
|
}
|
|
1600
1616
|
buildSaveRequestData(request) {
|
|
1601
|
-
return [{
|
|
1617
|
+
return [{ key: this.getExactKey(), request }];
|
|
1602
1618
|
}
|
|
1603
1619
|
resolveSimilarRequest(similarRequest) {
|
|
1604
1620
|
return similarRequest;
|
|
@@ -2369,6 +2385,15 @@ class GetRelatedListInfoBatchRequestStrategy extends LuvioAdapterRequestStrategy
|
|
|
2369
2385
|
},
|
|
2370
2386
|
};
|
|
2371
2387
|
}
|
|
2388
|
+
isContextDependent(context, request) {
|
|
2389
|
+
// We have a higher degree of confidence of being able to use a similar request when
|
|
2390
|
+
// optional config is not set AND the object type of the page context is the same as the
|
|
2391
|
+
// object type related list is for. This approach is based heavily with early predictions
|
|
2392
|
+
// and the max of 12 aura requests in mind. Same approach is taken in the single version of
|
|
2393
|
+
// this request
|
|
2394
|
+
return (context.objectApiName === request.config.parentObjectApiName &&
|
|
2395
|
+
request.config.recordTypeId === undefined);
|
|
2396
|
+
}
|
|
2372
2397
|
canCombine(reqA, reqB) {
|
|
2373
2398
|
return reqA.parentObjectApiName === reqB.parentObjectApiName;
|
|
2374
2399
|
}
|
|
@@ -2390,9 +2415,11 @@ class GetRelatedListInfoRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
|
2390
2415
|
* @override
|
|
2391
2416
|
*/
|
|
2392
2417
|
isContextDependent(context, request) {
|
|
2393
|
-
//
|
|
2418
|
+
// We have a higher degree of confidence of being able to use a similar request when
|
|
2394
2419
|
// optional config is not set AND the object type of the page context is the same as the
|
|
2395
|
-
// object type related list is for
|
|
2420
|
+
// object type related list is for. This approach is based heavily with early predictions
|
|
2421
|
+
// and the max of 12 aura requests in mind. Same approach is taken in the batch version of
|
|
2422
|
+
// this request
|
|
2396
2423
|
return (context.objectApiName === request.config.parentObjectApiName &&
|
|
2397
2424
|
this.isRequiredOnlyConfig(request.config));
|
|
2398
2425
|
}
|
|
@@ -2587,10 +2614,13 @@ class PrefetchRepository {
|
|
|
2587
2614
|
existingRequestEntry.requestMetadata.requestTime = requestTime;
|
|
2588
2615
|
}
|
|
2589
2616
|
});
|
|
2590
|
-
const { modifyBeforeSaveHook } = this.options;
|
|
2617
|
+
const { modifyBeforeSaveHook, modifyPageBeforeSavingHook } = this.options;
|
|
2591
2618
|
if (modifyBeforeSaveHook !== undefined) {
|
|
2592
2619
|
page.requests = modifyBeforeSaveHook(page.requests);
|
|
2593
2620
|
}
|
|
2621
|
+
if (modifyPageBeforeSavingHook !== undefined) {
|
|
2622
|
+
modifyPageBeforeSavingHook(page);
|
|
2623
|
+
}
|
|
2594
2624
|
setPromises.push(this.storage.set(id, page));
|
|
2595
2625
|
}
|
|
2596
2626
|
this.clearRequestBuffer();
|
|
@@ -2609,10 +2639,13 @@ class PrefetchRepository {
|
|
|
2609
2639
|
this.requestBuffer.set(identifier, batchForKey);
|
|
2610
2640
|
}
|
|
2611
2641
|
getPage(key) {
|
|
2612
|
-
const identifier =
|
|
2642
|
+
const identifier = this.getKeyId(key);
|
|
2613
2643
|
return this.storage.get(identifier);
|
|
2614
2644
|
}
|
|
2615
2645
|
getPageRequests(key) {
|
|
2646
|
+
if (!key) {
|
|
2647
|
+
return [];
|
|
2648
|
+
}
|
|
2616
2649
|
const page = this.getPage(key);
|
|
2617
2650
|
if (page === undefined) {
|
|
2618
2651
|
return [];
|
|
@@ -2913,18 +2946,19 @@ const RECORD_HOME_SUPPORTED_ADAPTERS = new Set([
|
|
|
2913
2946
|
]);
|
|
2914
2947
|
class RecordHomePage extends LexDefaultPage {
|
|
2915
2948
|
constructor(context, requestStrategyManager, options) {
|
|
2916
|
-
super(context
|
|
2949
|
+
super(context, {
|
|
2950
|
+
...context,
|
|
2951
|
+
recordId: '*',
|
|
2952
|
+
});
|
|
2917
2953
|
this.requestStrategyManager = requestStrategyManager;
|
|
2918
2954
|
this.options = options;
|
|
2919
|
-
const { recordId: _, ...rest } = this.context;
|
|
2920
|
-
this.similarContext = {
|
|
2921
|
-
recordId: '*',
|
|
2922
|
-
...rest,
|
|
2923
|
-
};
|
|
2924
2955
|
}
|
|
2925
2956
|
supportsRequest(request) {
|
|
2926
2957
|
return RECORD_HOME_SUPPORTED_ADAPTERS.has(request.adapterName);
|
|
2927
2958
|
}
|
|
2959
|
+
getExactKey() {
|
|
2960
|
+
return RecordHomePage.contextToExactKey(this.context);
|
|
2961
|
+
}
|
|
2928
2962
|
buildSaveRequestData(request) {
|
|
2929
2963
|
const requestBuckets = [];
|
|
2930
2964
|
const { adapterName } = request;
|
|
@@ -2934,7 +2968,7 @@ class RecordHomePage extends LexDefaultPage {
|
|
|
2934
2968
|
}
|
|
2935
2969
|
if (matchingRequestStrategy.isContextDependent(this.context, request)) {
|
|
2936
2970
|
requestBuckets.push({
|
|
2937
|
-
|
|
2971
|
+
key: this.getSimilarKey(),
|
|
2938
2972
|
request: matchingRequestStrategy.transformForSaveSimilarRequest(request),
|
|
2939
2973
|
});
|
|
2940
2974
|
// When `options.useExactMatchesPlus` is not enabled, we can save this request on the similar bucket only
|
|
@@ -2944,7 +2978,7 @@ class RecordHomePage extends LexDefaultPage {
|
|
|
2944
2978
|
}
|
|
2945
2979
|
if (!matchingRequestStrategy.onlySavedInSimilar) {
|
|
2946
2980
|
requestBuckets.push({
|
|
2947
|
-
|
|
2981
|
+
key: this.getExactKey(),
|
|
2948
2982
|
request: matchingRequestStrategy.transformForSave(request),
|
|
2949
2983
|
});
|
|
2950
2984
|
}
|
|
@@ -2995,6 +3029,10 @@ class RecordHomePage extends LexDefaultPage {
|
|
|
2995
3029
|
context.recordId !== undefined &&
|
|
2996
3030
|
context.type === 'recordPage');
|
|
2997
3031
|
}
|
|
3032
|
+
static contextToExactKey(context) {
|
|
3033
|
+
const { recordTypeId: _, ...key } = context;
|
|
3034
|
+
return key;
|
|
3035
|
+
}
|
|
2998
3036
|
}
|
|
2999
3037
|
|
|
3000
3038
|
const OBJECT_HOME_SUPPORTED_ADAPTERS = new Set([
|
|
@@ -3006,10 +3044,9 @@ const OBJECT_HOME_SUPPORTED_ADAPTERS = new Set([
|
|
|
3006
3044
|
]);
|
|
3007
3045
|
class ObjectHomePage extends LexDefaultPage {
|
|
3008
3046
|
constructor(context, requestStrategyManager, options) {
|
|
3009
|
-
super(context);
|
|
3047
|
+
super(context, context);
|
|
3010
3048
|
this.requestStrategyManager = requestStrategyManager;
|
|
3011
3049
|
this.options = options;
|
|
3012
|
-
this.similarContext = context;
|
|
3013
3050
|
}
|
|
3014
3051
|
supportsRequest(request) {
|
|
3015
3052
|
return OBJECT_HOME_SUPPORTED_ADAPTERS.has(request.adapterName);
|
|
@@ -3023,7 +3060,7 @@ class ObjectHomePage extends LexDefaultPage {
|
|
|
3023
3060
|
}
|
|
3024
3061
|
if (matchingRequestStrategy.isContextDependent(this.context, request)) {
|
|
3025
3062
|
requestBuckets.push({
|
|
3026
|
-
|
|
3063
|
+
key: this.getSimilarKey(),
|
|
3027
3064
|
request: matchingRequestStrategy.transformForSaveSimilarRequest(request),
|
|
3028
3065
|
});
|
|
3029
3066
|
// When `options.useExactMatchesPlus` is not enabled, we can save this request on the similar bucket only
|
|
@@ -3032,7 +3069,7 @@ class ObjectHomePage extends LexDefaultPage {
|
|
|
3032
3069
|
}
|
|
3033
3070
|
}
|
|
3034
3071
|
requestBuckets.push({
|
|
3035
|
-
|
|
3072
|
+
key: this.getExactKey(),
|
|
3036
3073
|
request: matchingRequestStrategy.transformForSave(request),
|
|
3037
3074
|
});
|
|
3038
3075
|
return requestBuckets;
|
|
@@ -3711,10 +3748,10 @@ class ApplicationPredictivePrefetcher {
|
|
|
3711
3748
|
if (this.page.supportsRequest(request)) {
|
|
3712
3749
|
const saveBuckets = this.page.buildSaveRequestData(request);
|
|
3713
3750
|
saveBuckets.forEach((saveBucket) => {
|
|
3714
|
-
const { request: requestToSave,
|
|
3751
|
+
const { request: requestToSave, key } = saveBucket;
|
|
3715
3752
|
// No need to differentiate from predictions requests because these
|
|
3716
3753
|
// are made from the adapters factory, which are not prediction aware.
|
|
3717
|
-
this.repository.saveRequest(
|
|
3754
|
+
this.repository.saveRequest(key, requestToSave);
|
|
3718
3755
|
});
|
|
3719
3756
|
}
|
|
3720
3757
|
return Promise.resolve().then();
|
|
@@ -3722,8 +3759,8 @@ class ApplicationPredictivePrefetcher {
|
|
|
3722
3759
|
}
|
|
3723
3760
|
async predict() {
|
|
3724
3761
|
const alwaysRequests = this.page.getAlwaysRunRequests();
|
|
3725
|
-
const similarPageRequests =
|
|
3726
|
-
const exactPageRequests =
|
|
3762
|
+
const similarPageRequests = this.getSimilarPageRequests();
|
|
3763
|
+
const exactPageRequests = this.getExactPageRequests();
|
|
3727
3764
|
// Always requests can't be reduced in - Some of them are essential to keep the page rendering at the beginning.
|
|
3728
3765
|
const reducedRequests = this.requestRunner
|
|
3729
3766
|
.reduceRequests([...exactPageRequests, ...similarPageRequests])
|
|
@@ -3734,13 +3771,9 @@ class ApplicationPredictivePrefetcher {
|
|
|
3734
3771
|
return Promise.all(predictedRequests.map((request) => this.requestRunner.runRequest(request))).then();
|
|
3735
3772
|
}
|
|
3736
3773
|
getPredictionSummary() {
|
|
3737
|
-
const exactPageRequests = this.repository.getPageRequests(this.context) || [];
|
|
3738
|
-
const similarPageRequests = this.page.similarContext !== undefined
|
|
3739
|
-
? this.repository.getPageRequests(this.page.similarContext)
|
|
3740
|
-
: [];
|
|
3741
3774
|
return {
|
|
3742
|
-
exact:
|
|
3743
|
-
similar:
|
|
3775
|
+
exact: this.getExactPageRequests().length,
|
|
3776
|
+
similar: this.getSimilarPageRequests().length,
|
|
3744
3777
|
totalRequestCount: this.totalRequestCount,
|
|
3745
3778
|
};
|
|
3746
3779
|
}
|
|
@@ -3749,22 +3782,15 @@ class ApplicationPredictivePrefetcher {
|
|
|
3749
3782
|
return summary.exact > 0 || summary.similar > 0;
|
|
3750
3783
|
}
|
|
3751
3784
|
getSimilarPageRequests() {
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
...entry,
|
|
3759
|
-
request: this.page.resolveSimilarRequest(entry.request),
|
|
3760
|
-
};
|
|
3761
|
-
});
|
|
3762
|
-
}
|
|
3763
|
-
}
|
|
3764
|
-
return resolvedSimilarPageRequests;
|
|
3785
|
+
return this.repository.getPageRequests(this.page.getSimilarKey()).map((entry) => {
|
|
3786
|
+
return {
|
|
3787
|
+
...entry,
|
|
3788
|
+
request: this.page.resolveSimilarRequest(entry.request),
|
|
3789
|
+
};
|
|
3790
|
+
});
|
|
3765
3791
|
}
|
|
3766
|
-
|
|
3767
|
-
return this.repository.getPageRequests(this.
|
|
3792
|
+
getExactPageRequests() {
|
|
3793
|
+
return this.repository.getPageRequests(this.page.getExactKey()) || [];
|
|
3768
3794
|
}
|
|
3769
3795
|
}
|
|
3770
3796
|
|
|
@@ -3828,6 +3854,7 @@ function predictNonBoxcarableRequest(nonBoxcaredPredictions, requestRunner) {
|
|
|
3828
3854
|
const reducedPredictions = requestRunner.reduceRequests(nonBoxcaredPredictions);
|
|
3829
3855
|
reducedPredictions.map((request) => requestRunner.runRequest(request.request));
|
|
3830
3856
|
}
|
|
3857
|
+
const DEFAULT_RECORD_TYPE_ID = '012000000000000AAA';
|
|
3831
3858
|
class LexPredictivePrefetcher extends ApplicationPredictivePrefetcher {
|
|
3832
3859
|
constructor(context, repository, requestRunner,
|
|
3833
3860
|
// These strategies need to be in sync with the "predictiveDataLoadCapable" list
|
|
@@ -3840,6 +3867,17 @@ class LexPredictivePrefetcher extends ApplicationPredictivePrefetcher {
|
|
|
3840
3867
|
}
|
|
3841
3868
|
getPage() {
|
|
3842
3869
|
if (RecordHomePage.handlesContext(this.context)) {
|
|
3870
|
+
/*
|
|
3871
|
+
* `recordTypeId` is required in order to create similar request keys. However, the means by which it is
|
|
3872
|
+
* obtained varies based on when in the app lifecycle predictions are requested.
|
|
3873
|
+
*/
|
|
3874
|
+
// check context for record type
|
|
3875
|
+
if (!this.context.recordTypeId) {
|
|
3876
|
+
// don't have it (i.e., early predictions), so need try to obtain via exact matches
|
|
3877
|
+
const exact = this.repository.getPage(RecordHomePage.contextToExactKey(this.context));
|
|
3878
|
+
// use found recordTypeId, otherwise fallback to default
|
|
3879
|
+
this.context.recordTypeId = (exact && exact.recordTypeId) || DEFAULT_RECORD_TYPE_ID;
|
|
3880
|
+
}
|
|
3843
3881
|
return new RecordHomePage(this.context, this.requestStrategyManager, this.options);
|
|
3844
3882
|
}
|
|
3845
3883
|
else if (ObjectHomePage.handlesContext(this.context)) {
|
|
@@ -3848,7 +3886,7 @@ class LexPredictivePrefetcher extends ApplicationPredictivePrefetcher {
|
|
|
3848
3886
|
return new LexDefaultPage(this.context);
|
|
3849
3887
|
}
|
|
3850
3888
|
getAllPageRequests() {
|
|
3851
|
-
const exactPageRequests = this.
|
|
3889
|
+
const exactPageRequests = this.getExactPageRequests();
|
|
3852
3890
|
let similarPageRequests = this.getSimilarPageRequests();
|
|
3853
3891
|
if (exactPageRequests.length > 0 && this.options.useExactMatchesPlus === true) {
|
|
3854
3892
|
similarPageRequests = similarPageRequests.filter((requestEntry) => {
|
|
@@ -3861,7 +3899,7 @@ class LexPredictivePrefetcher extends ApplicationPredictivePrefetcher {
|
|
|
3861
3899
|
async predict() {
|
|
3862
3900
|
const alwaysRequests = this.page.getAlwaysRunRequests();
|
|
3863
3901
|
const pageRequests = this.getAllPageRequests();
|
|
3864
|
-
// IMPORTANT: Because there's no way to
|
|
3902
|
+
// IMPORTANT: Because there's no way to differentiate a cmpDef prediction from the page
|
|
3865
3903
|
// requesting the cmpDef, we need to predict cmpDefs before we start watching
|
|
3866
3904
|
// for predictions in the page. Having this code after an
|
|
3867
3905
|
// await will make the predictions to be saved as predictions too.
|
|
@@ -4038,7 +4076,7 @@ function getEnvironmentSetting(name) {
|
|
|
4038
4076
|
}
|
|
4039
4077
|
return undefined;
|
|
4040
4078
|
}
|
|
4041
|
-
// version: 1.
|
|
4079
|
+
// version: 1.321.0-40847d67a8
|
|
4042
4080
|
|
|
4043
4081
|
const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
|
|
4044
4082
|
//TODO: Some duplication here that can be most likely moved to a util class
|
|
@@ -4542,6 +4580,11 @@ function setupPredictivePrefetcher(luvio) {
|
|
|
4542
4580
|
const requestRunner = new LexRequestRunner(requestStrategyManager);
|
|
4543
4581
|
const repository = new PrefetchRepository(storage, {
|
|
4544
4582
|
modifyBeforeSaveHook: (requests) => requestRunner.reduceRequests(requests),
|
|
4583
|
+
modifyPageBeforeSavingHook: (page) => {
|
|
4584
|
+
if (RecordHomePage.handlesContext(__lexPrefetcher.context)) {
|
|
4585
|
+
page.recordTypeId = __lexPrefetcher.context.recordTypeId;
|
|
4586
|
+
}
|
|
4587
|
+
},
|
|
4545
4588
|
});
|
|
4546
4589
|
const inflightRequestLimit = applyPredictionRequestLimit.isOpen({ fallback: false })
|
|
4547
4590
|
? getInflightRequestLimit()
|
|
@@ -4620,13 +4663,12 @@ function buildPredictorForContext(context) {
|
|
|
4620
4663
|
}
|
|
4621
4664
|
const currentContext = __lexPrefetcher.context;
|
|
4622
4665
|
let isSameContext = false;
|
|
4623
|
-
if (currentContext
|
|
4624
|
-
const rhPageContext = currentContext;
|
|
4666
|
+
if (RecordHomePage.handlesContext(currentContext)) {
|
|
4625
4667
|
isSameContext =
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4668
|
+
currentContext.actionName === context.actionName &&
|
|
4669
|
+
currentContext.objectApiName === context.objectApiName &&
|
|
4670
|
+
currentContext.recordId === context.recordId &&
|
|
4671
|
+
currentContext.type === context.type;
|
|
4630
4672
|
}
|
|
4631
4673
|
// // This chunk configures which page we're going to use to try and preload.
|
|
4632
4674
|
__lexPrefetcher.context = context;
|
|
@@ -4733,4 +4775,4 @@ function ldsEngineCreator() {
|
|
|
4733
4775
|
}
|
|
4734
4776
|
|
|
4735
4777
|
export { LexRequestStrategy, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
4736
|
-
// version: 1.
|
|
4778
|
+
// version: 1.321.0-1fd3fba1c4
|
|
@@ -9,9 +9,9 @@ export type RequestEntry<Request> = {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* Request and
|
|
12
|
+
* Request and context-based Key data to be saved.
|
|
13
13
|
*/
|
|
14
14
|
export type SaveRequestData<Request, Context> = {
|
|
15
15
|
request: Request;
|
|
16
|
-
|
|
16
|
+
key: Context;
|
|
17
17
|
};
|
|
@@ -2,10 +2,10 @@ import type { BaseAdapterRequest } from '../request-strategy';
|
|
|
2
2
|
import { PredictivePrefetchPage } from './predictive-prefetch-page';
|
|
3
3
|
export type DefaultPageContext = Record<string, any>;
|
|
4
4
|
export declare class LexDefaultPage<Request extends BaseAdapterRequest, Context extends DefaultPageContext> extends PredictivePrefetchPage<Request, Context> {
|
|
5
|
-
constructor(context: Context);
|
|
5
|
+
constructor(context: Context, similarContext?: Context);
|
|
6
6
|
supportsRequest(_request: Request): boolean;
|
|
7
7
|
buildSaveRequestData(request: Request): {
|
|
8
|
-
|
|
8
|
+
key: Context;
|
|
9
9
|
request: Request;
|
|
10
10
|
}[];
|
|
11
11
|
resolveSimilarRequest(similarRequest: Request): Request;
|
|
@@ -11,11 +11,10 @@ export declare const OBJECT_HOME_SUPPORTED_ADAPTERS: Set<string>;
|
|
|
11
11
|
export declare class ObjectHomePage extends LexDefaultPage<LexRequest, ObjectHomePageContext> {
|
|
12
12
|
private requestStrategyManager;
|
|
13
13
|
private options;
|
|
14
|
-
similarContext: ObjectHomePageContext;
|
|
15
14
|
constructor(context: ObjectHomePageContext, requestStrategyManager: RequestStrategyManager, options: LexPrefetcherOptions);
|
|
16
15
|
supportsRequest(request: LexRequest): boolean;
|
|
17
16
|
buildSaveRequestData(request: LexRequest): {
|
|
18
|
-
|
|
17
|
+
key: ObjectHomePageContext;
|
|
19
18
|
request: LexRequest<unknown>;
|
|
20
19
|
}[];
|
|
21
20
|
resolveSimilarRequest(similarRequest: LexRequest): LexRequest;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SaveRequestData } from '../common';
|
|
2
2
|
export declare abstract class PredictivePrefetchPage<Request, Context> {
|
|
3
|
-
context: Context;
|
|
4
|
-
similarContext
|
|
5
|
-
constructor(context: Context);
|
|
3
|
+
protected context: Context;
|
|
4
|
+
protected similarContext?: Context | undefined;
|
|
5
|
+
protected constructor(context: Context, similarContext?: Context | undefined);
|
|
6
6
|
abstract supportsRequest(request: Request): boolean;
|
|
7
7
|
abstract buildSaveRequestData(request: Request): SaveRequestData<Request, Context>[];
|
|
8
8
|
abstract resolveSimilarRequest(similarRequest: Request): Request;
|
|
9
9
|
abstract getAlwaysRunRequests(): Request[];
|
|
10
|
+
getExactKey(): Context;
|
|
11
|
+
getSimilarKey(): Context;
|
|
10
12
|
}
|
|
@@ -6,17 +6,18 @@ export declare const RECORD_HOME_SUPPORTED_ADAPTERS: Set<string>;
|
|
|
6
6
|
export type RecordHomePageContext = {
|
|
7
7
|
objectApiName: string;
|
|
8
8
|
recordId: string;
|
|
9
|
+
recordTypeId?: string;
|
|
9
10
|
actionName: string;
|
|
10
11
|
type: 'recordPage';
|
|
11
12
|
};
|
|
12
13
|
export declare class RecordHomePage extends LexDefaultPage<LexRequest, RecordHomePageContext> {
|
|
13
14
|
private requestStrategyManager;
|
|
14
15
|
private options;
|
|
15
|
-
similarContext: RecordHomePageContext;
|
|
16
16
|
constructor(context: RecordHomePageContext, requestStrategyManager: RequestStrategyManager, options: LexPrefetcherOptions);
|
|
17
17
|
supportsRequest(request: LexRequest): boolean;
|
|
18
|
+
getExactKey(): RecordHomePageContext;
|
|
18
19
|
buildSaveRequestData(request: LexRequest): {
|
|
19
|
-
|
|
20
|
+
key: RecordHomePageContext;
|
|
20
21
|
request: LexRequest<unknown>;
|
|
21
22
|
}[];
|
|
22
23
|
resolveSimilarRequest(similarRequest: LexRequest): LexRequest;
|
|
@@ -35,4 +36,5 @@ export declare class RecordHomePage extends LexDefaultPage<LexRequest, RecordHom
|
|
|
35
36
|
*/
|
|
36
37
|
shouldExecuteAlwaysRequestByThemself(): boolean;
|
|
37
38
|
static handlesContext(context: DefaultPageContext): context is RecordHomePageContext;
|
|
39
|
+
static contextToExactKey(context: RecordHomePageContext): RecordHomePageContext;
|
|
38
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { LexDefaultPage } from '../pages';
|
|
1
2
|
import { ApplicationPredictivePrefetcher } from './predictive-prefetcher';
|
|
2
|
-
import { LexDefaultPage } from '../pages/lex-default-page';
|
|
3
3
|
import type { RequestRunner } from '../request-runner';
|
|
4
|
-
import type { PrefetchRepository } from '../repository
|
|
4
|
+
import type { PrefetchRepository } from '../repository';
|
|
5
5
|
import type { RequestEntry } from '../common';
|
|
6
6
|
import type { LexContext, LexPrefetcherOptions, LexRequest } from '../lex';
|
|
7
7
|
import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
|
|
@@ -9,7 +9,7 @@ export declare class LexPredictivePrefetcher extends ApplicationPredictivePrefet
|
|
|
9
9
|
protected options: LexPrefetcherOptions;
|
|
10
10
|
page: LexDefaultPage<LexRequest, LexContext>;
|
|
11
11
|
private requestStrategyManager;
|
|
12
|
-
constructor(context: LexContext, repository: PrefetchRepository
|
|
12
|
+
constructor(context: LexContext, repository: PrefetchRepository<LexRequest>, requestRunner: RequestRunner<LexRequest>, requestStrategyManager: RequestStrategyManager, options: LexPrefetcherOptions);
|
|
13
13
|
getPage(): LexDefaultPage<LexRequest, LexContext>;
|
|
14
14
|
getAllPageRequests(): RequestEntry<LexRequest>[];
|
|
15
15
|
predict(): Promise<void>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { PrefetchRepository } from '../repository';
|
|
2
2
|
import type { PredictivePrefetchPage } from '../pages';
|
|
3
3
|
import type { RequestRunner } from '../request-runner';
|
|
4
|
-
import type {
|
|
5
|
-
export declare abstract class ApplicationPredictivePrefetcher<Request, Context extends Record<string, any>> {
|
|
6
|
-
protected repository: PrefetchRepository
|
|
4
|
+
import type { BaseAdapterRequest } from '../request-strategy';
|
|
5
|
+
export declare abstract class ApplicationPredictivePrefetcher<Request extends BaseAdapterRequest, Context extends Record<string, any>> {
|
|
6
|
+
protected repository: PrefetchRepository<Request>;
|
|
7
7
|
protected requestRunner: RequestRunner<Request>;
|
|
8
8
|
private _context;
|
|
9
9
|
isRecording: boolean;
|
|
10
10
|
totalRequestCount: Number;
|
|
11
11
|
page: PredictivePrefetchPage<Request, Context>;
|
|
12
12
|
queuedPredictionRequests: Request[];
|
|
13
|
-
constructor(context: Context, repository: PrefetchRepository
|
|
13
|
+
protected constructor(context: Context, repository: PrefetchRepository<Request>, requestRunner: RequestRunner<Request>);
|
|
14
14
|
abstract getPage(): PredictivePrefetchPage<Request, Context>;
|
|
15
15
|
set context(value: Context);
|
|
16
16
|
get context(): Context;
|
|
@@ -24,6 +24,11 @@ export declare abstract class ApplicationPredictivePrefetcher<Request, Context e
|
|
|
24
24
|
totalRequestCount: Number;
|
|
25
25
|
};
|
|
26
26
|
hasPredictions(): boolean;
|
|
27
|
-
getSimilarPageRequests():
|
|
28
|
-
|
|
27
|
+
getSimilarPageRequests(): {
|
|
28
|
+
request: Request;
|
|
29
|
+
requestMetadata: {
|
|
30
|
+
requestTime: number;
|
|
31
|
+
};
|
|
32
|
+
}[];
|
|
33
|
+
getExactPageRequests(): import("../common").RequestEntry<Request>[];
|
|
29
34
|
}
|
|
@@ -7,23 +7,25 @@ export type History = {
|
|
|
7
7
|
};
|
|
8
8
|
export type PageEntry<Request> = {
|
|
9
9
|
id: string;
|
|
10
|
+
recordTypeId?: string;
|
|
10
11
|
requests: RequestEntry<Request>[];
|
|
11
12
|
};
|
|
12
|
-
export type PrefetchRepositoryOptions = {
|
|
13
|
-
modifyBeforeSaveHook?: (requests: RequestEntry<
|
|
13
|
+
export type PrefetchRepositoryOptions<Request> = {
|
|
14
|
+
modifyBeforeSaveHook?: (requests: RequestEntry<Request>[]) => RequestEntry<Request>[];
|
|
15
|
+
modifyPageBeforeSavingHook?: (page: PageEntry<Request>) => void;
|
|
14
16
|
};
|
|
15
|
-
export declare class PrefetchRepository {
|
|
17
|
+
export declare class PrefetchRepository<Request> {
|
|
16
18
|
private storage;
|
|
17
19
|
private options;
|
|
18
20
|
private requestBuffer;
|
|
19
|
-
constructor(storage: PrefetchStorage, options?: PrefetchRepositoryOptions);
|
|
21
|
+
constructor(storage: PrefetchStorage, options?: PrefetchRepositoryOptions<Request>);
|
|
20
22
|
clearRequestBuffer(): void;
|
|
21
23
|
pageStartTime: number;
|
|
22
24
|
markPageStart(): void;
|
|
23
25
|
flushRequestsToStorage(): Promise<void>;
|
|
24
26
|
getKeyId(key: Key): string;
|
|
25
27
|
saveRequest<Request>(key: Key, request: Request): void;
|
|
26
|
-
getPage
|
|
27
|
-
getPageRequests
|
|
28
|
+
getPage(key: Key): PageEntry<Request> | undefined;
|
|
29
|
+
getPageRequests(key: Key): RequestEntry<Request>[];
|
|
28
30
|
}
|
|
29
31
|
export {};
|
|
@@ -6,6 +6,7 @@ export type GetRelatedListInfoBatchRequest = {
|
|
|
6
6
|
};
|
|
7
7
|
type GetRelatedListInfoBatchContext = {
|
|
8
8
|
objectApiName: string;
|
|
9
|
+
recordTypeId: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const GET_RELATED_LIST_INFO_BATCH_ADAPTER_NAME = "getRelatedListInfoBatch";
|
|
11
12
|
export declare class GetRelatedListInfoBatchRequestStrategy extends LuvioAdapterRequestStrategy<GetRelatedListInfoBatchConfig, GetRelatedListInfoBatchRequest, GetRelatedListInfoBatchContext> {
|
|
@@ -16,6 +17,7 @@ export declare class GetRelatedListInfoBatchRequestStrategy extends LuvioAdapter
|
|
|
16
17
|
* @override
|
|
17
18
|
*/
|
|
18
19
|
transformForSave(request: GetRelatedListInfoBatchRequest): GetRelatedListInfoBatchRequest;
|
|
20
|
+
isContextDependent(context: GetRelatedListInfoBatchContext, request: GetRelatedListInfoBatchRequest): boolean;
|
|
19
21
|
canCombine(reqA: GetRelatedListInfoBatchConfig, reqB: GetRelatedListInfoBatchConfig): boolean;
|
|
20
22
|
combineRequests(reqA: GetRelatedListInfoBatchConfig, reqB: GetRelatedListInfoBatchConfig): GetRelatedListInfoBatchConfig;
|
|
21
23
|
}
|
package/dist/types/predictive-loading/request-strategy/get-related-list-info-request-strategy.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type GetRelatedListInfoRequest = {
|
|
|
8
8
|
};
|
|
9
9
|
type GetRelatedListInfoContext = {
|
|
10
10
|
objectApiName: string;
|
|
11
|
+
recordTypeId: string;
|
|
11
12
|
};
|
|
12
13
|
export declare const GET_RELATED_LIST_INFO_ADAPTER_NAME = "getRelatedListInfo";
|
|
13
14
|
export declare class GetRelatedListInfoRequestStrategy extends LuvioAdapterRequestStrategy<GetRelatedListInfoConfig, GetRelatedListInfoRequest, GetRelatedListInfoContext> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.321.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -34,33 +34,33 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@luvio/service-broker": "5.
|
|
38
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
37
|
+
"@luvio/service-broker": "5.12.0",
|
|
38
|
+
"@salesforce/lds-adapters-apex": "^1.321.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.321.0",
|
|
40
40
|
"@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
43
|
-
"@salesforce/lds-bindings": "^1.
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.
|
|
46
|
-
"@salesforce/lds-network-fetch-with-jwt": "^1.
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.321.0",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.321.0",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.321.0",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.321.0",
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.321.0",
|
|
46
|
+
"@salesforce/lds-network-fetch-with-jwt": "^1.321.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@luvio/command-aura-network": "5.
|
|
50
|
-
"@luvio/command-fetch-network": "5.
|
|
51
|
-
"@luvio/command-network": "5.
|
|
52
|
-
"@luvio/command-sse": "5.
|
|
53
|
-
"@luvio/command-streaming": "5.
|
|
54
|
-
"@luvio/network-adapter-composable": "0.156.
|
|
55
|
-
"@luvio/network-adapter-fetch": "0.156.
|
|
56
|
-
"@luvio/service-aura-network": "5.
|
|
57
|
-
"@luvio/service-cache": "5.
|
|
58
|
-
"@luvio/service-cache-control": "5.
|
|
59
|
-
"@luvio/service-fetch-network": "5.
|
|
60
|
-
"@luvio/service-instrument-command": "5.
|
|
61
|
-
"@luvio/service-store": "5.
|
|
62
|
-
"@luvio/utils": "5.
|
|
63
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.
|
|
49
|
+
"@luvio/command-aura-network": "5.12.0",
|
|
50
|
+
"@luvio/command-fetch-network": "5.12.0",
|
|
51
|
+
"@luvio/command-network": "5.12.0",
|
|
52
|
+
"@luvio/command-sse": "5.12.0",
|
|
53
|
+
"@luvio/command-streaming": "5.12.0",
|
|
54
|
+
"@luvio/network-adapter-composable": "0.156.5",
|
|
55
|
+
"@luvio/network-adapter-fetch": "0.156.5",
|
|
56
|
+
"@luvio/service-aura-network": "5.12.0",
|
|
57
|
+
"@luvio/service-cache": "5.12.0",
|
|
58
|
+
"@luvio/service-cache-control": "5.12.0",
|
|
59
|
+
"@luvio/service-fetch-network": "5.12.0",
|
|
60
|
+
"@luvio/service-instrument-command": "5.12.0",
|
|
61
|
+
"@luvio/service-store": "5.12.0",
|
|
62
|
+
"@luvio/utils": "5.12.0",
|
|
63
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.321.0"
|
|
64
64
|
},
|
|
65
65
|
"luvioBundlesize": [
|
|
66
66
|
{
|