@salesforce/lds-runtime-aura 1.404.0-dev2 → 1.404.0-dev20
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
CHANGED
|
@@ -22,8 +22,9 @@ import useCmpDefPredictions from '@salesforce/gate/lds.pdl.useCmpDefPredictions'
|
|
|
22
22
|
import applyPredictionRequestLimit from '@salesforce/gate/lds.pdl.applyRequestLimit';
|
|
23
23
|
import useLocalStorage from '@salesforce/gate/lds.pdl.useLocalStorage';
|
|
24
24
|
import useOneStoreGraphql from '@salesforce/gate/lds.oneStoreGraphqlEnabled.ltng';
|
|
25
|
+
import canCombineRecordLayoutRequests from '@salesforce/gate/lds.pdl.canCombineRecordLayoutRequests';
|
|
25
26
|
import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
|
|
26
|
-
import { instrument, getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, buildRecordRepKeyFromId, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
|
|
27
|
+
import { instrument, getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, coerceLayoutTypeArray, coerceLayoutModeArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, buildRecordRepKeyFromId, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
|
|
27
28
|
import { getInstrumentation } from 'o11y/client';
|
|
28
29
|
import { findExecutableOperation, buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
|
|
29
30
|
import { print, wrapConfigAndVerify, resolveAst, validateGraphQLOperations } from 'force/luvioOnestoreGraphqlParser';
|
|
@@ -41,6 +42,10 @@ import { instrument as instrument$5 } from '@lwc/state';
|
|
|
41
42
|
import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
|
|
42
43
|
import { pageScopedCache } from 'instrumentation/utility';
|
|
43
44
|
import { createStorage, clearStorages } from 'force/ldsStorage';
|
|
45
|
+
import lightningConnectEnabled from '@salesforce/gate/ui.services.LightningConnect.enabled';
|
|
46
|
+
import bypassAppRestrictionEnabled from '@salesforce/gate/ui.services.LightningConnect.BypassAppRestriction.enabled';
|
|
47
|
+
import csrfValidationEnabled from '@salesforce/gate/ui.services.LightningConnect.CsrfValidation.enabled';
|
|
48
|
+
import sessionApiEnabled from '@salesforce/gate/ui.uisdk.session.api.enabled';
|
|
44
49
|
import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
|
|
45
50
|
import useHttpUiapiOneApp from '@salesforce/gate/lds.useHttpUiapiOneApp';
|
|
46
51
|
import useHttpUiapiOneRuntime from '@salesforce/gate/lds.useHttpUiapiOneRuntime';
|
|
@@ -470,7 +475,12 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
470
475
|
this.coerceAuraErrors
|
|
471
476
|
);
|
|
472
477
|
} else if (this.shouldUseFetch()) {
|
|
473
|
-
|
|
478
|
+
const params = this.fetchParams;
|
|
479
|
+
try {
|
|
480
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
481
|
+
} catch (reason) {
|
|
482
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
483
|
+
}
|
|
474
484
|
}
|
|
475
485
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
476
486
|
}
|
|
@@ -1068,7 +1078,12 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
|
|
|
1068
1078
|
(errs) => this.coerceAuraErrors(errs)
|
|
1069
1079
|
);
|
|
1070
1080
|
} else if (this.shouldUseFetch()) {
|
|
1071
|
-
|
|
1081
|
+
const params = this.fetchParams;
|
|
1082
|
+
try {
|
|
1083
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1084
|
+
} catch (reason) {
|
|
1085
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1086
|
+
}
|
|
1072
1087
|
}
|
|
1073
1088
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
1074
1089
|
}
|
|
@@ -1211,7 +1226,12 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1211
1226
|
(errs) => this.coerceAuraErrors(errs)
|
|
1212
1227
|
);
|
|
1213
1228
|
} else if (this.shouldUseFetch()) {
|
|
1214
|
-
|
|
1229
|
+
const params = this.fetchParams;
|
|
1230
|
+
try {
|
|
1231
|
+
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1232
|
+
} catch (reason) {
|
|
1233
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1234
|
+
}
|
|
1215
1235
|
}
|
|
1216
1236
|
return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
|
|
1217
1237
|
}
|
|
@@ -1329,7 +1349,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1329
1349
|
return this.fetch();
|
|
1330
1350
|
}
|
|
1331
1351
|
fetch() {
|
|
1332
|
-
|
|
1352
|
+
try {
|
|
1353
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
1354
|
+
} catch (reason) {
|
|
1355
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1356
|
+
}
|
|
1333
1357
|
}
|
|
1334
1358
|
async coerceError(errorResponse) {
|
|
1335
1359
|
return toError(errorResponse.statusText);
|
|
@@ -1532,7 +1556,11 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1532
1556
|
this.services = services;
|
|
1533
1557
|
}
|
|
1534
1558
|
fetch() {
|
|
1535
|
-
|
|
1559
|
+
try {
|
|
1560
|
+
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
1561
|
+
} catch (reason) {
|
|
1562
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1563
|
+
}
|
|
1536
1564
|
}
|
|
1537
1565
|
async coerceError(errorResponse) {
|
|
1538
1566
|
return toError(errorResponse.statusText);
|
|
@@ -1588,7 +1616,11 @@ class StreamingCommand extends BaseCommand {
|
|
|
1588
1616
|
this.services = services;
|
|
1589
1617
|
}
|
|
1590
1618
|
execute() {
|
|
1591
|
-
|
|
1619
|
+
try {
|
|
1620
|
+
return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
|
|
1621
|
+
} catch (reason) {
|
|
1622
|
+
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1623
|
+
}
|
|
1592
1624
|
}
|
|
1593
1625
|
convertFetchStreamResponseToData(response) {
|
|
1594
1626
|
return response.then(
|
|
@@ -2424,9 +2456,13 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2424
2456
|
}
|
|
2425
2457
|
get expiredChecks() {
|
|
2426
2458
|
return [
|
|
2427
|
-
|
|
2459
|
+
...super.expiredChecks,
|
|
2460
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-cache"
|
|
2428
2461
|
];
|
|
2429
2462
|
}
|
|
2463
|
+
// Note: If we add support for `stale-while-revalidate` in the future, we may
|
|
2464
|
+
// need to further override expiredChecks to allow stale entries that are within the
|
|
2465
|
+
// stale-while-revalidate window to be returned for only-if-cached requests.
|
|
2430
2466
|
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
2431
2467
|
if (this.services.instrumentation) {
|
|
2432
2468
|
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
@@ -2666,7 +2702,7 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2666
2702
|
},
|
|
2667
2703
|
};
|
|
2668
2704
|
}
|
|
2669
|
-
// version: 1.404.0-
|
|
2705
|
+
// version: 1.404.0-dev20-d07b5007e7
|
|
2670
2706
|
|
|
2671
2707
|
/*!
|
|
2672
2708
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -2782,11 +2818,26 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2782
2818
|
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
2783
2819
|
});
|
|
2784
2820
|
} else if (this.shouldUseFetch()) {
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2821
|
+
const params = this.originalFetchParams;
|
|
2822
|
+
try {
|
|
2823
|
+
return this.convertFetchResponseToData(this.services.fetch(...params)).then(
|
|
2824
|
+
(result) => {
|
|
2825
|
+
return buildSubscribableResult$1(
|
|
2826
|
+
result,
|
|
2827
|
+
this.buildSubscribe(),
|
|
2828
|
+
() => this.refresh()
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
);
|
|
2832
|
+
} catch (reason) {
|
|
2833
|
+
return resolvedPromiseLike$2(
|
|
2834
|
+
buildSubscribableResult$1(
|
|
2835
|
+
err$1(toError(reason)),
|
|
2836
|
+
this.buildSubscribe(),
|
|
2837
|
+
() => this.refresh()
|
|
2838
|
+
)
|
|
2839
|
+
);
|
|
2840
|
+
}
|
|
2790
2841
|
}
|
|
2791
2842
|
return resolvedPromiseLike$2(
|
|
2792
2843
|
buildSubscribableResult$1(
|
|
@@ -3004,7 +3055,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3004
3055
|
},
|
|
3005
3056
|
};
|
|
3006
3057
|
}
|
|
3007
|
-
// version: 1.404.0-
|
|
3058
|
+
// version: 1.404.0-dev20-d07b5007e7
|
|
3008
3059
|
|
|
3009
3060
|
/*!
|
|
3010
3061
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4270,6 +4321,52 @@ class JwtManager {
|
|
|
4270
4321
|
* All rights reserved.
|
|
4271
4322
|
* For full license text, see the LICENSE.txt file
|
|
4272
4323
|
*/
|
|
4324
|
+
let textEncoder;
|
|
4325
|
+
function getTextEncoder() {
|
|
4326
|
+
if (!textEncoder) {
|
|
4327
|
+
if (typeof TextEncoder === "undefined") {
|
|
4328
|
+
throw new Error(
|
|
4329
|
+
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
4330
|
+
);
|
|
4331
|
+
}
|
|
4332
|
+
textEncoder = new TextEncoder();
|
|
4333
|
+
}
|
|
4334
|
+
return textEncoder;
|
|
4335
|
+
}
|
|
4336
|
+
function buildCompressionInterceptor(config) {
|
|
4337
|
+
const threshold = config.threshold ?? 1024;
|
|
4338
|
+
return async (args) => {
|
|
4339
|
+
const [resource, options = {}] = args;
|
|
4340
|
+
if (!options.body || typeof options.body !== "string") {
|
|
4341
|
+
return resolvedPromiseLike$2(args);
|
|
4342
|
+
}
|
|
4343
|
+
if (typeof CompressionStream === "undefined") {
|
|
4344
|
+
return resolvedPromiseLike$2(args);
|
|
4345
|
+
}
|
|
4346
|
+
const headers = new Headers(options.headers);
|
|
4347
|
+
if (headers.has("Content-Encoding")) {
|
|
4348
|
+
return resolvedPromiseLike$2(args);
|
|
4349
|
+
}
|
|
4350
|
+
const encodedBody = getTextEncoder().encode(options.body);
|
|
4351
|
+
if (encodedBody.byteLength < threshold) {
|
|
4352
|
+
return resolvedPromiseLike$2(args);
|
|
4353
|
+
}
|
|
4354
|
+
try {
|
|
4355
|
+
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
4356
|
+
const compressedBody = await new Response(stream).blob();
|
|
4357
|
+
headers.set("Content-Encoding", config.algorithm);
|
|
4358
|
+
headers.delete("Content-Length");
|
|
4359
|
+
const compressedOptions = {
|
|
4360
|
+
...options,
|
|
4361
|
+
body: compressedBody,
|
|
4362
|
+
headers
|
|
4363
|
+
};
|
|
4364
|
+
return resolvedPromiseLike$2([resource, compressedOptions]);
|
|
4365
|
+
} catch {
|
|
4366
|
+
return resolvedPromiseLike$2(args);
|
|
4367
|
+
}
|
|
4368
|
+
};
|
|
4369
|
+
}
|
|
4273
4370
|
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
4274
4371
|
throwOnExisting = false,
|
|
4275
4372
|
errorMessage = `Unexpected ${headerName} header encountered`
|
|
@@ -4707,7 +4804,7 @@ function getEnvironmentSetting(name) {
|
|
|
4707
4804
|
}
|
|
4708
4805
|
return undefined;
|
|
4709
4806
|
}
|
|
4710
|
-
// version: 1.404.0-
|
|
4807
|
+
// version: 1.404.0-dev20-d07b5007e7
|
|
4711
4808
|
|
|
4712
4809
|
/**
|
|
4713
4810
|
* Observability / Critical Availability Program (230+)
|
|
@@ -5837,6 +5934,23 @@ class CsrfTokenManager {
|
|
|
5837
5934
|
CsrfTokenManager.instance = null;
|
|
5838
5935
|
|
|
5839
5936
|
const CSRF_TOKEN_HEADER = 'X-CSRF-Token';
|
|
5937
|
+
/**
|
|
5938
|
+
* Checks if all required gates are enabled for CSRF token interceptor.
|
|
5939
|
+
*
|
|
5940
|
+
* @returns true if all gates are enabled, false otherwise
|
|
5941
|
+
*/
|
|
5942
|
+
function areCsrfGatesEnabled() {
|
|
5943
|
+
try {
|
|
5944
|
+
return (lightningConnectEnabled.isOpen({ fallback: false }) &&
|
|
5945
|
+
bypassAppRestrictionEnabled.isOpen({ fallback: false }) &&
|
|
5946
|
+
csrfValidationEnabled.isOpen({ fallback: false }) &&
|
|
5947
|
+
sessionApiEnabled.isOpen({ fallback: false }));
|
|
5948
|
+
}
|
|
5949
|
+
catch (error) {
|
|
5950
|
+
// If any gate check fails, disable CSRF interceptor
|
|
5951
|
+
return false;
|
|
5952
|
+
}
|
|
5953
|
+
}
|
|
5840
5954
|
/**
|
|
5841
5955
|
* Determines if the HTTP method requires CSRF protection.
|
|
5842
5956
|
* Only mutating operations (POST, PUT, PATCH, DELETE) require CSRF tokens.
|
|
@@ -5864,6 +5978,10 @@ function isCsrfMethod(method) {
|
|
|
5864
5978
|
function buildCsrfTokenInterceptor() {
|
|
5865
5979
|
const csrfTokenManager = CsrfTokenManager.getInstance();
|
|
5866
5980
|
return async (fetchArgs) => {
|
|
5981
|
+
// Check if all required gates are enabled before running
|
|
5982
|
+
if (!areCsrfGatesEnabled()) {
|
|
5983
|
+
return resolvedPromiseLike$2(fetchArgs);
|
|
5984
|
+
}
|
|
5867
5985
|
const [urlOrRequest, options] = fetchArgs;
|
|
5868
5986
|
// Determine the method from either Request object or options
|
|
5869
5987
|
let method;
|
|
@@ -5893,6 +6011,10 @@ function buildCsrfTokenInterceptor() {
|
|
|
5893
6011
|
function buildLuvioCsrfTokenInterceptor() {
|
|
5894
6012
|
const csrfTokenManager = CsrfTokenManager.getInstance();
|
|
5895
6013
|
return async (resourceRequest) => {
|
|
6014
|
+
// Check if all required gates are enabled before running
|
|
6015
|
+
if (!areCsrfGatesEnabled()) {
|
|
6016
|
+
return resolvedPromiseLike$2(resourceRequest);
|
|
6017
|
+
}
|
|
5896
6018
|
// Ensure headers object exists
|
|
5897
6019
|
if (!resourceRequest.headers) {
|
|
5898
6020
|
resourceRequest.headers = {};
|
|
@@ -6141,8 +6263,8 @@ async function isCsrfError(response) {
|
|
|
6141
6263
|
// Clone to avoid consuming the original response
|
|
6142
6264
|
const cloned = response.clone();
|
|
6143
6265
|
const body = await cloned.json();
|
|
6144
|
-
// Check the error array format:
|
|
6145
|
-
const errorCode = body?.
|
|
6266
|
+
// Check the error array format: body[0].errorCode
|
|
6267
|
+
const errorCode = body?.[0]?.errorCode;
|
|
6146
6268
|
return errorCode === 'INVALID_ACCESS_TOKEN';
|
|
6147
6269
|
}
|
|
6148
6270
|
catch {
|
|
@@ -6152,8 +6274,12 @@ async function isCsrfError(response) {
|
|
|
6152
6274
|
}
|
|
6153
6275
|
}
|
|
6154
6276
|
|
|
6155
|
-
|
|
6156
|
-
|
|
6277
|
+
/**
|
|
6278
|
+
* Returns the default interceptor configuration for LEX runtime fetch services.
|
|
6279
|
+
* This shared config ensures consistency across all LEX fetch service variants.
|
|
6280
|
+
*/
|
|
6281
|
+
function getLexRuntimeDefaultInterceptorConfig(logger) {
|
|
6282
|
+
return {
|
|
6157
6283
|
createContext: createInstrumentationIdContext(),
|
|
6158
6284
|
request: [
|
|
6159
6285
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -6169,31 +6295,36 @@ function buildLexRuntimeDefaultFetchServiceDescriptor(logger, retryService) {
|
|
|
6169
6295
|
buildTransportMarksReceiveInterceptor(),
|
|
6170
6296
|
buildThirdPartyTrackerFinishInterceptor(),
|
|
6171
6297
|
],
|
|
6172
|
-
}, retryService);
|
|
6173
|
-
return {
|
|
6174
|
-
...fetchService,
|
|
6175
6298
|
};
|
|
6176
6299
|
}
|
|
6300
|
+
function buildLexRuntimeDefaultFetchServiceDescriptor(logger, retryService) {
|
|
6301
|
+
const fetchService = buildLexConnectFetchServiceDescriptor(getLexRuntimeDefaultInterceptorConfig(logger), retryService);
|
|
6302
|
+
return { ...fetchService };
|
|
6303
|
+
}
|
|
6177
6304
|
function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
6305
|
+
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
6178
6306
|
const fetchService = buildLexConnectFetchServiceDescriptor({
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
buildThirdPartyTrackerRegisterInterceptor(),
|
|
6182
|
-
buildPageScopedCacheRequestInterceptor(),
|
|
6183
|
-
buildTransportMarksSendInterceptor(),
|
|
6184
|
-
buildCsrfTokenInterceptor(),
|
|
6185
|
-
],
|
|
6307
|
+
...config,
|
|
6308
|
+
// Omit 5xx interceptor - allow 5xx responses to pass through
|
|
6186
6309
|
response: [buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger)],
|
|
6187
|
-
finally: [
|
|
6188
|
-
buildTransportMarksReceiveInterceptor(),
|
|
6189
|
-
buildThirdPartyTrackerFinishInterceptor(),
|
|
6190
|
-
],
|
|
6191
6310
|
}, retryService);
|
|
6192
6311
|
return {
|
|
6193
6312
|
...fetchService,
|
|
6194
6313
|
tags: { interceptors: 'allow_500s' },
|
|
6195
6314
|
};
|
|
6196
6315
|
}
|
|
6316
|
+
function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
6317
|
+
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
6318
|
+
const fetchService = buildLexConnectFetchServiceDescriptor({
|
|
6319
|
+
...config,
|
|
6320
|
+
// Append compression interceptor last, after any body-modifying interceptors
|
|
6321
|
+
request: [...config.request, buildCompressionInterceptor({ algorithm: 'gzip' })],
|
|
6322
|
+
}, retryService);
|
|
6323
|
+
return {
|
|
6324
|
+
...fetchService,
|
|
6325
|
+
tags: { compression: 'gzip' },
|
|
6326
|
+
};
|
|
6327
|
+
}
|
|
6197
6328
|
// Temporarily cloned from conduit fetch until the retry service is updated there
|
|
6198
6329
|
function buildLexConnectFetchServiceDescriptor(interceptors = { request: [], response: [], finally: [] }, retryService) {
|
|
6199
6330
|
return {
|
|
@@ -6775,9 +6906,31 @@ function isFieldsRequest(config) {
|
|
|
6775
6906
|
config.modes === undefined &&
|
|
6776
6907
|
(config.fields !== undefined || config.optionalFields !== undefined));
|
|
6777
6908
|
}
|
|
6909
|
+
function isCombinableLayoutRequest(config) {
|
|
6910
|
+
// We will only consider a layout request combinable if it is a single layout type request
|
|
6911
|
+
// and the only request parameters are:
|
|
6912
|
+
// - layoutTypes
|
|
6913
|
+
// - optionalFields
|
|
6914
|
+
// - modes
|
|
6915
|
+
const hasExtraParams = config.childRelationships !== undefined ||
|
|
6916
|
+
config.pageSize !== undefined ||
|
|
6917
|
+
config.updateMru !== undefined;
|
|
6918
|
+
return config.layoutTypes !== undefined && !hasExtraParams;
|
|
6919
|
+
}
|
|
6920
|
+
function areCombinableLayoutRequests(reqA, reqB) {
|
|
6921
|
+
const normilizedLayoutTypesA = coerceLayoutTypeArray(reqA.layoutTypes) || [];
|
|
6922
|
+
const normilizedLayoutTypesB = coerceLayoutTypeArray(reqB.layoutTypes) || [];
|
|
6923
|
+
// Let's only combine when the layoutTypes are the same
|
|
6924
|
+
return (isCombinableLayoutRequest(reqA) &&
|
|
6925
|
+
isCombinableLayoutRequest(reqB) &&
|
|
6926
|
+
reqA.recordId === reqB.recordId &&
|
|
6927
|
+
normilizedLayoutTypesA.length === normilizedLayoutTypesB.length &&
|
|
6928
|
+
normilizedLayoutTypesA.every((type, index) => type === normilizedLayoutTypesB[index]));
|
|
6929
|
+
}
|
|
6778
6930
|
class GetRecordRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
6779
|
-
constructor() {
|
|
6780
|
-
super(
|
|
6931
|
+
constructor(luvio, canCombineRecordLayoutRequests = false) {
|
|
6932
|
+
super(luvio);
|
|
6933
|
+
this.canCombineRecordLayoutRequests = canCombineRecordLayoutRequests;
|
|
6781
6934
|
this.adapterName = GET_RECORD_ADAPTER_NAME;
|
|
6782
6935
|
this.adapterFactory = getRecordAdapterFactory;
|
|
6783
6936
|
}
|
|
@@ -6806,10 +6959,41 @@ class GetRecordRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
|
6806
6959
|
};
|
|
6807
6960
|
}
|
|
6808
6961
|
canCombine(reqA, reqB) {
|
|
6809
|
-
// must be same record and
|
|
6810
|
-
return reqA.recordId === reqB.recordId &&
|
|
6962
|
+
// must be same record and either both are fields requests or both are combinable layout requests
|
|
6963
|
+
return (reqA.recordId === reqB.recordId &&
|
|
6964
|
+
((isFieldsRequest(reqA) && isFieldsRequest(reqB)) ||
|
|
6965
|
+
(this.canCombineRecordLayoutRequests && areCombinableLayoutRequests(reqA, reqB))));
|
|
6811
6966
|
}
|
|
6812
6967
|
combineRequests(reqA, reqB) {
|
|
6968
|
+
if (isFieldsRequest(reqA)) {
|
|
6969
|
+
return this.combineFieldsRequests(reqA, reqB);
|
|
6970
|
+
}
|
|
6971
|
+
else {
|
|
6972
|
+
return this.combineLayoutRequests(reqA, reqB);
|
|
6973
|
+
}
|
|
6974
|
+
}
|
|
6975
|
+
combineLayoutRequests(reqA, reqB) {
|
|
6976
|
+
const combined = {
|
|
6977
|
+
recordId: reqA.recordId,
|
|
6978
|
+
layoutTypes: coerceLayoutTypeArray(reqA.layoutTypes),
|
|
6979
|
+
};
|
|
6980
|
+
// combine Modes.
|
|
6981
|
+
// Note: the || ['View'] is important; it is to cover the case in which it needs to
|
|
6982
|
+
// combine mode: undefined (defaults to View) with mode: ['something else than View']
|
|
6983
|
+
const modeA = coerceLayoutModeArray(reqA.modes) || ['View'];
|
|
6984
|
+
const modeB = coerceLayoutModeArray(reqB.modes) || ['View'];
|
|
6985
|
+
if (reqA.modes !== undefined || reqB.modes !== undefined) {
|
|
6986
|
+
combined.modes = Array.from(new Set([...modeA, ...modeB]));
|
|
6987
|
+
}
|
|
6988
|
+
// combine Optional Fields.
|
|
6989
|
+
const optionalFieldsA = coerceFieldIdArray(reqA.optionalFields, COERCE_FIELD_ID_ARRAY_OPTIONS) || [];
|
|
6990
|
+
const optionalFieldsB = coerceFieldIdArray(reqB.optionalFields, COERCE_FIELD_ID_ARRAY_OPTIONS) || [];
|
|
6991
|
+
if (optionalFieldsA !== undefined || optionalFieldsB !== undefined) {
|
|
6992
|
+
combined.optionalFields = Array.from(new Set([...optionalFieldsA, ...optionalFieldsB]));
|
|
6993
|
+
}
|
|
6994
|
+
return combined;
|
|
6995
|
+
}
|
|
6996
|
+
combineFieldsRequests(reqA, reqB) {
|
|
6813
6997
|
const fields = new Set();
|
|
6814
6998
|
const optionalFields = new Set();
|
|
6815
6999
|
if (reqA.fields !== undefined) {
|
|
@@ -9495,7 +9679,7 @@ function whenPredictionsReady(callback) {
|
|
|
9495
9679
|
}
|
|
9496
9680
|
function setupPredictivePrefetcher(luvio) {
|
|
9497
9681
|
const allStrategies = [
|
|
9498
|
-
new GetRecordRequestStrategy(luvio),
|
|
9682
|
+
new GetRecordRequestStrategy(luvio, canCombineRecordLayoutRequests.isOpen({ fallback: false })),
|
|
9499
9683
|
new GetRecordsRequestStrategy(luvio),
|
|
9500
9684
|
new GetRecordActionsRequestStrategy(luvio),
|
|
9501
9685
|
new GetRecordAvatarsRequestStrategy(luvio),
|
|
@@ -9754,6 +9938,7 @@ function initializeOneStore(luvio) {
|
|
|
9754
9938
|
buildServiceDescriptor$n(),
|
|
9755
9939
|
buildServiceDescriptor$f(),
|
|
9756
9940
|
buildLexRuntimeAllow5xxFetchServiceDescriptor(loggerService, retryService),
|
|
9941
|
+
buildLexRuntimeCompressedFetchServiceDescriptor(loggerService, retryService),
|
|
9757
9942
|
buildServiceDescriptor$d(luvio),
|
|
9758
9943
|
luvioUiapiRecordsServiceDescriptor,
|
|
9759
9944
|
buildServiceDescriptor$c(),
|
|
@@ -9788,4 +9973,4 @@ function ldsEngineCreator() {
|
|
|
9788
9973
|
}
|
|
9789
9974
|
|
|
9790
9975
|
export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
9791
|
-
// version: 1.404.0-
|
|
9976
|
+
// version: 1.404.0-dev20-189624d2e3
|
|
@@ -3,4 +3,5 @@ import { Interceptors, type FetchServiceDescriptor } from '@conduit-client/servi
|
|
|
3
3
|
import { RetryService } from '@conduit-client/service-retry/v1';
|
|
4
4
|
export declare function buildLexRuntimeDefaultFetchServiceDescriptor(logger: LoggerService, retryService?: RetryService<Response>): FetchServiceDescriptor;
|
|
5
5
|
export declare function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger: LoggerService, retryService?: RetryService<Response>): FetchServiceDescriptor;
|
|
6
|
+
export declare function buildLexRuntimeCompressedFetchServiceDescriptor(logger: LoggerService, retryService?: RetryService<Response>): FetchServiceDescriptor;
|
|
6
7
|
export declare function buildLexConnectFetchServiceDescriptor<Context = any>(interceptors?: Interceptors<Context>, retryService?: RetryService<Response>): FetchServiceDescriptor;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Luvio } from '@luvio/engine';
|
|
1
2
|
import type { GetRecordConfig } from '@salesforce/lds-adapters-uiapi';
|
|
2
3
|
import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
|
|
3
4
|
export type GetRecordRequest = {
|
|
@@ -9,12 +10,16 @@ type GetRecordContext = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare const GET_RECORD_ADAPTER_NAME = "getRecord";
|
|
11
12
|
export declare class GetRecordRequestStrategy extends LuvioAdapterRequestStrategy<GetRecordConfig, GetRecordRequest, GetRecordContext> {
|
|
13
|
+
private readonly canCombineRecordLayoutRequests;
|
|
12
14
|
adapterName: string;
|
|
13
15
|
adapterFactory: import("@luvio/engine").AdapterFactory<GetRecordConfig, import("@salesforce/lds-adapters-uiapi").RecordRepresentation>;
|
|
16
|
+
constructor(luvio: Luvio, canCombineRecordLayoutRequests?: boolean);
|
|
14
17
|
buildConcreteRequest(similarRequest: GetRecordRequest, context: GetRecordContext): GetRecordRequest;
|
|
15
18
|
transformForSave(request: GetRecordRequest): GetRecordRequest;
|
|
16
19
|
canCombine(reqA: GetRecordConfig, reqB: GetRecordConfig): boolean;
|
|
17
20
|
combineRequests(reqA: GetRecordConfig, reqB: GetRecordConfig): GetRecordConfig;
|
|
21
|
+
combineLayoutRequests(reqA: GetRecordConfig, reqB: GetRecordConfig): GetRecordConfig;
|
|
22
|
+
combineFieldsRequests(reqA: GetRecordConfig, reqB: GetRecordConfig): GetRecordConfig;
|
|
18
23
|
isContextDependent(context: GetRecordContext, request: GetRecordRequest): boolean;
|
|
19
24
|
transformForSaveSimilarRequest(request: GetRecordRequest): GetRecordRequest;
|
|
20
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.404.0-
|
|
3
|
+
"version": "1.404.0-dev20",
|
|
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,49 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@conduit-client/service-provisioner": "3.
|
|
38
|
-
"@conduit-client/tools-core": "3.
|
|
39
|
-
"@salesforce/lds-adapters-apex": "^1.404.0-
|
|
40
|
-
"@salesforce/lds-adapters-uiapi": "^1.404.0-
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.404.0-
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.404.0-
|
|
43
|
-
"@salesforce/lds-bindings": "^1.404.0-
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.404.0-
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.404.0-
|
|
46
|
-
"@salesforce/lds-network-fetch": "^1.404.0-
|
|
37
|
+
"@conduit-client/service-provisioner": "3.7.0-dev3",
|
|
38
|
+
"@conduit-client/tools-core": "3.7.0-dev3",
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.404.0-dev20",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.404.0-dev20",
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.404.0-dev20",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.404.0-dev20",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.404.0-dev20",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.404.0-dev20",
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.404.0-dev20",
|
|
46
|
+
"@salesforce/lds-network-fetch": "^1.404.0-dev20",
|
|
47
47
|
"jwt-encode": "1.0.1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.
|
|
51
|
-
"@conduit-client/command-aura-network": "3.
|
|
52
|
-
"@conduit-client/command-aura-normalized-cache-control": "3.
|
|
53
|
-
"@conduit-client/command-aura-resource-cache-control": "3.
|
|
54
|
-
"@conduit-client/command-fetch-network": "3.
|
|
55
|
-
"@conduit-client/command-http-graphql-normalized-cache-control": "3.
|
|
56
|
-
"@conduit-client/command-http-normalized-cache-control": "3.
|
|
57
|
-
"@conduit-client/command-ndjson": "3.
|
|
58
|
-
"@conduit-client/command-network": "3.
|
|
59
|
-
"@conduit-client/command-sse": "3.
|
|
60
|
-
"@conduit-client/command-streaming": "3.
|
|
61
|
-
"@conduit-client/service-aura-network": "3.
|
|
62
|
-
"@conduit-client/service-
|
|
63
|
-
"@conduit-client/service-
|
|
64
|
-
"@conduit-client/service-cache
|
|
65
|
-
"@conduit-client/service-
|
|
66
|
-
"@conduit-client/service-
|
|
67
|
-
"@conduit-client/service-
|
|
68
|
-
"@conduit-client/service-
|
|
69
|
-
"@conduit-client/service-
|
|
70
|
-
"@conduit-client/
|
|
50
|
+
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.7.0-dev3",
|
|
51
|
+
"@conduit-client/command-aura-network": "3.7.0-dev3",
|
|
52
|
+
"@conduit-client/command-aura-normalized-cache-control": "3.7.0-dev3",
|
|
53
|
+
"@conduit-client/command-aura-resource-cache-control": "3.7.0-dev3",
|
|
54
|
+
"@conduit-client/command-fetch-network": "3.7.0-dev3",
|
|
55
|
+
"@conduit-client/command-http-graphql-normalized-cache-control": "3.7.0-dev3",
|
|
56
|
+
"@conduit-client/command-http-normalized-cache-control": "3.7.0-dev3",
|
|
57
|
+
"@conduit-client/command-ndjson": "3.7.0-dev3",
|
|
58
|
+
"@conduit-client/command-network": "3.7.0-dev3",
|
|
59
|
+
"@conduit-client/command-sse": "3.7.0-dev3",
|
|
60
|
+
"@conduit-client/command-streaming": "3.7.0-dev3",
|
|
61
|
+
"@conduit-client/service-aura-network": "3.7.0-dev3",
|
|
62
|
+
"@conduit-client/service-bindings-imperative": "3.7.0-dev3",
|
|
63
|
+
"@conduit-client/service-bindings-lwc": "3.7.0-dev3",
|
|
64
|
+
"@conduit-client/service-cache": "3.7.0-dev3",
|
|
65
|
+
"@conduit-client/service-cache-control": "3.7.0-dev3",
|
|
66
|
+
"@conduit-client/service-cache-inclusion-policy": "3.7.0-dev3",
|
|
67
|
+
"@conduit-client/service-feature-flags": "3.7.0-dev3",
|
|
68
|
+
"@conduit-client/service-fetch-network": "3.7.0-dev3",
|
|
69
|
+
"@conduit-client/service-instrument-command": "3.7.0-dev3",
|
|
70
|
+
"@conduit-client/service-pubsub": "3.7.0-dev3",
|
|
71
|
+
"@conduit-client/service-store": "3.7.0-dev3",
|
|
72
|
+
"@conduit-client/utils": "3.7.0-dev3",
|
|
71
73
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
72
74
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
73
75
|
"@lwc/state": "^0.23.0",
|
|
74
|
-
"@salesforce/lds-adapters-onestore-graphql": "^1.404.0-
|
|
75
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.404.0-
|
|
76
|
-
"@salesforce/lds-luvio-service": "^1.404.0-
|
|
77
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-
|
|
76
|
+
"@salesforce/lds-adapters-onestore-graphql": "^1.404.0-dev20",
|
|
77
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.404.0-dev20",
|
|
78
|
+
"@salesforce/lds-luvio-service": "^1.404.0-dev20",
|
|
79
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-dev20"
|
|
78
80
|
},
|
|
79
81
|
"luvioBundlesize": [
|
|
80
82
|
{
|
|
@@ -82,7 +84,7 @@
|
|
|
82
84
|
"maxSize": {
|
|
83
85
|
"none": "350 kB",
|
|
84
86
|
"min": "190 kB",
|
|
85
|
-
"compressed": "
|
|
87
|
+
"compressed": "59.8 kB"
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
],
|