@salesforce/lds-runtime-aura 1.342.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.
@@ -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.
@@ -3628,13 +3632,13 @@ class AbstractHomePage extends LexDefaultPage {
3628
3632
  if (matchingRequestStrategy.isContextDependent(this.context, request)) {
3629
3633
  requestBuckets.push({
3630
3634
  key: this.getSimilarKey(),
3631
- request: matchingRequestStrategy.transformForSaveSimilarRequest(request),
3635
+ request: matchingRequestStrategy.transformForSaveSimilarRequest(request, this.context),
3632
3636
  });
3633
3637
  }
3634
3638
  else {
3635
3639
  requestBuckets.push({
3636
3640
  key: this.getExactKey(),
3637
- request: matchingRequestStrategy.transformForSave(request),
3641
+ request: matchingRequestStrategy.transformForSave(request, this.context),
3638
3642
  });
3639
3643
  }
3640
3644
  return requestBuckets;
@@ -4786,7 +4790,7 @@ function getEnvironmentSetting(name) {
4786
4790
  }
4787
4791
  return undefined;
4788
4792
  }
4789
- // version: 1.342.0-f478af8b93
4793
+ // version: 1.343.0-823df4356c
4790
4794
 
4791
4795
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
4792
4796
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -5475,4 +5479,4 @@ function ldsEngineCreator() {
5475
5479
  }
5476
5480
 
5477
5481
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
5478
- // version: 1.342.0-651bed9637
5482
+ // version: 1.343.0-f39f04aaf6
@@ -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.342.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,35 +34,35 @@
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.342.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.342.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.342.0",
42
- "@salesforce/lds-aura-storage": "^1.342.0",
43
- "@salesforce/lds-bindings": "^1.342.0",
44
- "@salesforce/lds-instrumentation": "^1.342.0",
45
- "@salesforce/lds-network-aura": "^1.342.0",
46
- "@salesforce/lds-network-fetch": "^1.342.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.342.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
  {