@salesforce/lds-runtime-aura 1.341.0 → 1.343.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.
@@ -21,7 +21,7 @@ import useRelatedListPlus from '@salesforce/gate/lds.pdl.useRelatedListPlus';
21
21
  import useCmpDefPredictions from '@salesforce/gate/lds.pdl.useCmpDefPredictions';
22
22
  import applyPredictionRequestLimit from '@salesforce/gate/lds.pdl.applyRequestLimit';
23
23
  import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
24
- import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, instrument, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher } from 'force/ldsAdaptersUiapi';
24
+ import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, instrument, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher } from 'force/ldsAdaptersUiapi';
25
25
  import { getInstrumentation } from 'o11y/client';
26
26
  import { setServices } from 'force/luvioServiceProvisioner1';
27
27
  import oneStoreEnabled from '@salesforce/gate/lds.oneStoreEnabled.ltng';
@@ -90,7 +90,7 @@ function buildServiceDescriptor$a() {
90
90
 
91
91
  const { create: create$1, freeze, keys: keys$2 } = Object;
92
92
  const { isArray: isArray$2 } = Array;
93
- const { stringify: stringify$1 } = JSON;
93
+ const { stringify: stringify$1, parse } = JSON;
94
94
 
95
95
  const LogLevelMap$1 = {
96
96
  TRACE: 4,
@@ -286,6 +286,14 @@ function toError(x) {
286
286
  }
287
287
  return new Error(typeof x === 'string' ? x : JSON.stringify(x));
288
288
  }
289
+ /**
290
+ * Deep copies a JSON object. Only works for non-complex values.
291
+ * No Date or Functions etc.
292
+ */
293
+ function deepCopy(x) {
294
+ const stringified = stringify$1(x);
295
+ return stringified ? parse(stringified) : undefined;
296
+ }
289
297
 
290
298
  var HttpStatusCode$2;
291
299
  (function (HttpStatusCode) {
@@ -966,6 +974,7 @@ function buildServiceDescriptor$3(logger) {
966
974
  * For full license text, see the LICENSE.txt file
967
975
  */
968
976
 
977
+
969
978
  /**
970
979
  * A collection of keys, in no particular order.
971
980
  */
@@ -1023,6 +1032,7 @@ class KeySetImpl {
1023
1032
  }
1024
1033
  }
1025
1034
 
1035
+ /* eslint-disable no-dupe-class-members */
1026
1036
  /**
1027
1037
  A utility class for recording actions made on a cache.
1028
1038
  */
@@ -1037,12 +1047,15 @@ class DefaultRecordableCache {
1037
1047
  this.keysUpdated.add(key);
1038
1048
  this.baseCache.delete(key);
1039
1049
  }
1040
- get(key) {
1050
+ get(key, options) {
1041
1051
  this.keysRead.add(key);
1042
1052
  const value = this.baseCache.get(key);
1043
1053
  if (value === undefined) {
1044
1054
  this.missingKeysRead.add(key);
1045
1055
  }
1056
+ if (options === null || options === void 0 ? void 0 : options.copy) {
1057
+ return deepCopy(value);
1058
+ }
1046
1059
  return value;
1047
1060
  }
1048
1061
  set(key, value) {
@@ -1076,10 +1089,13 @@ class DefaultFilteredCache {
1076
1089
  delete(key) {
1077
1090
  this.baseCache.delete(key);
1078
1091
  }
1079
- get(key) {
1092
+ get(key, options) {
1080
1093
  const result = this.baseCache.get(key);
1081
1094
  // if we're chaining filtered caches together, then it's possible the result will be undefined here
1082
1095
  if (result && this.predicate(key, result)) {
1096
+ if (options === null || options === void 0 ? void 0 : options.copy) {
1097
+ return deepCopy(result);
1098
+ }
1083
1099
  return result;
1084
1100
  }
1085
1101
  return undefined;
@@ -1116,17 +1132,15 @@ class DefaultFilteredCache {
1116
1132
  }
1117
1133
  }
1118
1134
 
1135
+ /* eslint-disable no-dupe-class-members */
1119
1136
  class DefaultCache {
1120
1137
  constructor() {
1121
1138
  this.data = {};
1122
1139
  }
1123
- /**
1124
- * Returns the cache entry at the specified key; undefined if no
1125
- * such entry exists.
1126
- *
1127
- * @param key store key
1128
- */
1129
- get(key) {
1140
+ get(key, options) {
1141
+ if (options === null || options === void 0 ? void 0 : options.copy) {
1142
+ return deepCopy(this.data[key]);
1143
+ }
1130
1144
  return this.data[key];
1131
1145
  }
1132
1146
  /**
@@ -1185,13 +1199,14 @@ class CacheControlStrategy {
1185
1199
  constructor(services, config, buildRequestRunner) {
1186
1200
  this.services = services;
1187
1201
  this.config = config;
1188
- this.recordableCache = this.services.cache.record();
1189
- this.requestRunner = buildRequestRunner(this.recordableCache);
1202
+ const requestRunnerCache = this.services.cache.filter((_, entry) => {
1203
+ const { cacheControl } = entry.metadata;
1204
+ return !this.expiredChecks.some((check) => check(cacheControl));
1205
+ });
1206
+ this.requestRunner = buildRequestRunner(requestRunnerCache);
1190
1207
  }
1191
1208
  isCacheHit(cacheReadValue) {
1192
- const isCacheMiss = cacheReadValue.isErr() ||
1193
- cacheReadValue.value === undefined ||
1194
- this.areUsedCacheEntriesExpired();
1209
+ const isCacheMiss = cacheReadValue.isErr() || cacheReadValue.value === undefined;
1195
1210
  return !isCacheMiss;
1196
1211
  }
1197
1212
  get expiredChecks() {
@@ -1202,17 +1217,6 @@ class CacheControlStrategy {
1202
1217
  cacheControlMetadata.type === 'no-store',
1203
1218
  ];
1204
1219
  }
1205
- areUsedCacheEntriesExpired() {
1206
- return this.recordableCache.keysRead.elements().some((key) => {
1207
- const entry = this.recordableCache.get(key);
1208
- if (entry === undefined) {
1209
- // Not sure how this would be possible, but we'll just say it's expired
1210
- return true;
1211
- }
1212
- const { cacheControl } = entry.metadata;
1213
- return this.expiredChecks.some((check) => check(cacheControl));
1214
- });
1215
- }
1216
1220
  }
1217
1221
 
1218
1222
  class MaxAgeCacheControlStrategy extends CacheControlStrategy {
@@ -2202,7 +2206,7 @@ class RequestStrategy {
2202
2206
  * @param request - The request to transform
2203
2207
  * @returns
2204
2208
  */
2205
- transformForSave(request) {
2209
+ transformForSave(request, _context) {
2206
2210
  return request;
2207
2211
  }
2208
2212
  /**
@@ -2210,8 +2214,8 @@ class RequestStrategy {
2210
2214
  * @param request Request to transform for saving similar requests
2211
2215
  * @returns Transformed request
2212
2216
  */
2213
- transformForSaveSimilarRequest(request) {
2214
- return this.transformForSave(request);
2217
+ transformForSaveSimilarRequest(request, _context) {
2218
+ return this.transformForSave(request, _context);
2215
2219
  }
2216
2220
  /**
2217
2221
  * Filter requests to only those that are for this strategy.
@@ -3531,6 +3535,81 @@ class GetRelatedListsInfoRequestStrategy extends LuvioAdapterRequestStrategy {
3531
3535
  }
3532
3536
  }
3533
3537
 
3538
+ const GET_RELATED_LIST_ACTIONS_ADAPTER_NAME = 'getRelatedListActions';
3539
+ /**
3540
+ * Returns true if the config is only the required configuration.
3541
+ *
3542
+ * @param config - The related list actions config
3543
+ * @returns boolean - true if the config is only the required configuration
3544
+ */
3545
+ function isRequiredOnlyConfig(config) {
3546
+ return (config.apiNames === undefined &&
3547
+ config.actionTypes === undefined &&
3548
+ config.formFactor === undefined &&
3549
+ config.retrievalMode === undefined &&
3550
+ config.sections === undefined);
3551
+ }
3552
+ class GetRelatedListActionsRequestStrategy extends LuvioAdapterRequestStrategy {
3553
+ constructor() {
3554
+ super(...arguments);
3555
+ this.adapterName = GET_RELATED_LIST_ACTIONS_ADAPTER_NAME;
3556
+ this.adapterFactory = getRelatedListActionsAdapterFactory;
3557
+ }
3558
+ buildConcreteRequest(similarRequest, context) {
3559
+ return {
3560
+ ...similarRequest,
3561
+ config: {
3562
+ ...similarRequest.config,
3563
+ recordIds: [context.recordId],
3564
+ },
3565
+ };
3566
+ }
3567
+ transformForSave(request) {
3568
+ // we only need to coerce the required configuration because only those fields are
3569
+ // manipulated by the strategy.
3570
+ return {
3571
+ ...request,
3572
+ config: {
3573
+ ...request.config,
3574
+ // (!): if is recorded in PDL, it was already validated by the adapter.
3575
+ recordIds: getRecordId18Array(request.config.recordIds) || [],
3576
+ },
3577
+ };
3578
+ }
3579
+ transformForSaveSimilarRequest(request) {
3580
+ return {
3581
+ ...request,
3582
+ config: {
3583
+ ...request.config,
3584
+ recordIds: ['*'],
3585
+ },
3586
+ };
3587
+ }
3588
+ isContextDependent(context, { config }) {
3589
+ // Note: despite recordIds being an array, it is common to send just one recordId as a string.
3590
+ // Also, recordIds is a required param, and the factory would have failed if recordIds is missing,
3591
+ // normalizing to an empty array to avoid an error from PDL if that logic fails.
3592
+ const requestRecordsIds = getRecordId18Array(config.recordIds) || [];
3593
+ const configHasOnlyOneRecord = requestRecordsIds.length === 1;
3594
+ return (configHasOnlyOneRecord &&
3595
+ requestRecordsIds[0] === context.recordId &&
3596
+ isRequiredOnlyConfig(config));
3597
+ }
3598
+ canCombine(reqA, reqB) {
3599
+ // At the moment, these are not combinable by this strategy, except when they are the same request
3600
+ return (isRequiredOnlyConfig(reqA) &&
3601
+ isRequiredOnlyConfig(reqB) &&
3602
+ reqA.recordIds.length === 1 &&
3603
+ reqB.recordIds.length === 1 &&
3604
+ reqA.recordIds[0] === reqB.recordIds[0] &&
3605
+ reqA.relatedListId === reqB.relatedListId);
3606
+ }
3607
+ combineRequests(reqA, _reqB) {
3608
+ // both request are the same, return only one of them.
3609
+ return reqA;
3610
+ }
3611
+ }
3612
+
3534
3613
  /**
3535
3614
  * Base implementation of a home page
3536
3615
  */
@@ -3553,13 +3632,13 @@ class AbstractHomePage extends LexDefaultPage {
3553
3632
  if (matchingRequestStrategy.isContextDependent(this.context, request)) {
3554
3633
  requestBuckets.push({
3555
3634
  key: this.getSimilarKey(),
3556
- request: matchingRequestStrategy.transformForSaveSimilarRequest(request),
3635
+ request: matchingRequestStrategy.transformForSaveSimilarRequest(request, this.context),
3557
3636
  });
3558
3637
  }
3559
3638
  else {
3560
3639
  requestBuckets.push({
3561
3640
  key: this.getExactKey(),
3562
- request: matchingRequestStrategy.transformForSave(request),
3641
+ request: matchingRequestStrategy.transformForSave(request, this.context),
3563
3642
  });
3564
3643
  }
3565
3644
  return requestBuckets;
@@ -3581,6 +3660,7 @@ const RECORD_HOME_SUPPORTED_ADAPTERS = new Set([
3581
3660
  GET_RELATED_LIST_RECORDS_ADAPTER_NAME,
3582
3661
  GET_RELATED_LISTS_ACTIONS_ADAPTER_NAME,
3583
3662
  GET_RELATED_LISTS_INFO_ADAPTER_NAME,
3663
+ GET_RELATED_LIST_ACTIONS_ADAPTER_NAME,
3584
3664
  'templateApi', // external - getTemplateDescriptorWithExpansionBundle
3585
3665
  ]);
3586
3666
  class RecordHomePage extends AbstractHomePage {
@@ -4710,7 +4790,7 @@ function getEnvironmentSetting(name) {
4710
4790
  }
4711
4791
  return undefined;
4712
4792
  }
4713
- // version: 1.341.0-7420e11050
4793
+ // version: 1.343.0-823df4356c
4714
4794
 
4715
4795
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
4716
4796
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -5200,6 +5280,7 @@ function setupPredictivePrefetcher(luvio) {
5200
5280
  new GetListInfosByObjectNameRequestStrategy(luvio),
5201
5281
  new GetListObjectInfoRequestStrategy(luvio),
5202
5282
  new GetRelatedListsInfoRequestStrategy(luvio),
5283
+ new GetRelatedListActionsRequestStrategy(luvio),
5203
5284
  ];
5204
5285
  requestStrategyManager.register(allStrategies);
5205
5286
  const storage = buildAuraPrefetchStorage({
@@ -5398,4 +5479,4 @@ function ldsEngineCreator() {
5398
5479
  }
5399
5480
 
5400
5481
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
5401
- // version: 1.341.0-3e459abc99
5482
+ // version: 1.343.0-f39f04aaf6
@@ -0,0 +1,21 @@
1
+ import type { GetRelatedListActionsConfig } from '@salesforce/lds-adapters-uiapi';
2
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
3
+ export type GetRelatedListActionsRequest = {
4
+ adapterName: 'getRelatedListActions';
5
+ config: GetRelatedListActionsConfig;
6
+ };
7
+ type GetRelatedListActionsContext = {
8
+ recordId: string;
9
+ };
10
+ export declare const GET_RELATED_LIST_ACTIONS_ADAPTER_NAME = "getRelatedListActions";
11
+ export declare class GetRelatedListActionsRequestStrategy extends LuvioAdapterRequestStrategy<GetRelatedListActionsConfig, GetRelatedListActionsRequest, GetRelatedListActionsContext> {
12
+ adapterName: string;
13
+ adapterFactory: import("@luvio/engine").AdapterFactory<GetRelatedListActionsConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ActionRepresentation").ActionRepresentation>;
14
+ buildConcreteRequest(similarRequest: GetRelatedListActionsRequest, context: GetRelatedListActionsContext): GetRelatedListActionsRequest;
15
+ transformForSave(request: GetRelatedListActionsRequest): GetRelatedListActionsRequest;
16
+ transformForSaveSimilarRequest(request: GetRelatedListActionsRequest): GetRelatedListActionsRequest;
17
+ isContextDependent(context: GetRelatedListActionsContext, { config }: GetRelatedListActionsRequest): boolean;
18
+ canCombine(reqA: GetRelatedListActionsConfig, reqB: GetRelatedListActionsConfig): boolean;
19
+ combineRequests(reqA: GetRelatedListActionsConfig, _reqB: GetRelatedListActionsConfig): GetRelatedListActionsConfig;
20
+ }
21
+ export {};
@@ -18,3 +18,4 @@ export * from './get-list-infos-by-object-name-request-strategy';
18
18
  export * from './get-list-records-by-name-request-strategy';
19
19
  export * from './get-list-object-info-request-strategy';
20
20
  export * from './get-related-lists-info-strategy';
21
+ export * from './get-related-list-actions-request-strategy';
@@ -30,13 +30,13 @@ export declare abstract class RequestStrategy<Config, Request extends BaseAdapte
30
30
  * @param request - The request to transform
31
31
  * @returns
32
32
  */
33
- transformForSave(request: Request): Request;
33
+ transformForSave(request: Request, _context?: Context): Request;
34
34
  /**
35
35
  * Transforms the request for saving similar requests
36
36
  * @param request Request to transform for saving similar requests
37
37
  * @returns Transformed request
38
38
  */
39
- transformForSaveSimilarRequest(request: Request): Request;
39
+ transformForSaveSimilarRequest(request: Request, _context?: Context): Request;
40
40
  /**
41
41
  * Filter requests to only those that are for this strategy.
42
42
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.341.0",
3
+ "version": "1.343.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,43 +34,43 @@
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.26.0",
38
- "@salesforce/lds-adapters-apex": "^1.341.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.341.0",
37
+ "@luvio/service-provisioner": "5.27.1",
38
+ "@salesforce/lds-adapters-apex": "^1.343.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.343.0",
40
40
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
41
- "@salesforce/lds-ads-bridge": "^1.341.0",
42
- "@salesforce/lds-aura-storage": "^1.341.0",
43
- "@salesforce/lds-bindings": "^1.341.0",
44
- "@salesforce/lds-instrumentation": "^1.341.0",
45
- "@salesforce/lds-network-aura": "^1.341.0",
46
- "@salesforce/lds-network-fetch": "^1.341.0",
41
+ "@salesforce/lds-ads-bridge": "^1.343.0",
42
+ "@salesforce/lds-aura-storage": "^1.343.0",
43
+ "@salesforce/lds-bindings": "^1.343.0",
44
+ "@salesforce/lds-instrumentation": "^1.343.0",
45
+ "@salesforce/lds-network-aura": "^1.343.0",
46
+ "@salesforce/lds-network-fetch": "^1.343.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-network": "5.26.0",
51
- "@luvio/command-aura-resource-cache-control": "5.26.0",
52
- "@luvio/command-fetch-network": "5.26.0",
53
- "@luvio/command-network": "5.26.0",
54
- "@luvio/command-sse": "5.26.0",
55
- "@luvio/command-streaming": "5.26.0",
50
+ "@luvio/command-aura-network": "5.27.1",
51
+ "@luvio/command-aura-resource-cache-control": "5.27.1",
52
+ "@luvio/command-fetch-network": "5.27.1",
53
+ "@luvio/command-network": "5.27.1",
54
+ "@luvio/command-sse": "5.27.1",
55
+ "@luvio/command-streaming": "5.27.1",
56
56
  "@luvio/network-adapter-composable": "0.156.5",
57
57
  "@luvio/network-adapter-fetch": "0.156.5",
58
- "@luvio/service-aura-network": "5.26.0",
59
- "@luvio/service-cache": "5.26.0",
60
- "@luvio/service-cache-control": "5.26.0",
61
- "@luvio/service-fetch-network": "5.26.0",
62
- "@luvio/service-instrument-command": "5.26.0",
63
- "@luvio/service-store": "5.26.0",
64
- "@luvio/utils": "5.26.0",
65
- "@salesforce/lds-adapters-uiapi-lex": "^1.341.0"
58
+ "@luvio/service-aura-network": "5.27.1",
59
+ "@luvio/service-cache": "5.27.1",
60
+ "@luvio/service-cache-control": "5.27.1",
61
+ "@luvio/service-fetch-network": "5.27.1",
62
+ "@luvio/service-instrument-command": "5.27.1",
63
+ "@luvio/service-store": "5.27.1",
64
+ "@luvio/utils": "5.27.1",
65
+ "@salesforce/lds-adapters-uiapi-lex": "^1.343.0"
66
66
  },
67
67
  "luvioBundlesize": [
68
68
  {
69
69
  "path": "./dist/ldsEngineCreator.js",
70
70
  "maxSize": {
71
- "none": "205 kB",
72
- "min": "84.5 kB",
73
- "compressed": "36 kB"
71
+ "none": "207 kB",
72
+ "min": "86 kB",
73
+ "compressed": "36.5 kB"
74
74
  }
75
75
  }
76
76
  ],