@salesforce/lds-runtime-aura 1.386.0 → 1.387.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.
@@ -12,7 +12,7 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
- import { HttpStatusCode as HttpStatusCode$1, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
15
+ import { HttpStatusCode as HttpStatusCode$2, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
16
16
  import ldsTrackedFieldsBehaviorGate from '@salesforce/gate/lds.useNewTrackedFieldBehavior';
17
17
  import usePredictiveLoading from '@salesforce/gate/lds.usePredictiveLoading';
18
18
  import useApexPredictions from '@salesforce/gate/lds.pdl.useApexPredictions';
@@ -215,6 +215,47 @@ function toError(x) {
215
215
  }
216
216
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
217
217
  }
218
+ var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
219
+ HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
220
+ HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
221
+ HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
222
+ HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
223
+ HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
224
+ HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
225
+ HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
226
+ HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
227
+ HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
228
+ HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
229
+ return HttpStatusCode2;
230
+ })(HttpStatusCode$1 || {});
231
+ function getStatusText(status) {
232
+ switch (status) {
233
+ case 200:
234
+ return "OK";
235
+ case 201:
236
+ return "Created";
237
+ case 304:
238
+ return "Not Modified";
239
+ case 400:
240
+ return "Bad Request";
241
+ case 404:
242
+ return "Not Found";
243
+ case 500:
244
+ return "Server Error";
245
+ default:
246
+ return `Unexpected HTTP Status Code: ${status}`;
247
+ }
248
+ }
249
+ class FetchResponse extends Error {
250
+ constructor(status, body, headers) {
251
+ super();
252
+ this.status = status;
253
+ this.body = body;
254
+ this.headers = headers || {};
255
+ this.ok = status >= 200 && this.status <= 299;
256
+ this.statusText = getStatusText(status);
257
+ }
258
+ }
218
259
  class InternalError extends Error {
219
260
  constructor(data) {
220
261
  super();
@@ -898,9 +939,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
898
939
  super(services);
899
940
  this.services = services;
900
941
  }
901
- execute() {
902
- return super.execute();
903
- }
904
942
  readFromCache(cache) {
905
943
  var _a;
906
944
  const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
@@ -2076,6 +2114,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
2076
2114
  ];
2077
2115
  }
2078
2116
  }
2117
+ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
2118
+ execute(options) {
2119
+ const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
2120
+ return this.services.cacheInclusionPolicy.read({
2121
+ l1: this.filteredCache,
2122
+ readFromL1: (l1) => this.requestRunner.readFromCache(l1)
2123
+ }).then((result) => {
2124
+ if (result.isOk()) {
2125
+ this.collectCacheHitInstrumentation(
2126
+ startTime,
2127
+ options == null ? void 0 : options.instrumentationAttributes
2128
+ );
2129
+ return ok$2(void 0);
2130
+ }
2131
+ this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
2132
+ const error = new UserVisibleError(
2133
+ new FetchResponse(HttpStatusCode$1.GatewayTimeout, {
2134
+ error: "Cache miss for only-if-cached request"
2135
+ })
2136
+ );
2137
+ return err$1(error);
2138
+ });
2139
+ }
2140
+ get expiredChecks() {
2141
+ return [
2142
+ (cacheControlMetadata) => cacheControlMetadata.type === "no-store"
2143
+ ];
2144
+ }
2145
+ collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
2146
+ if (this.services.instrumentation) {
2147
+ const meter = this.services.instrumentation.metrics.getMeter("onestore");
2148
+ meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
2149
+ meter.createHistogram(
2150
+ `command.only-if-cached.cache-hit.duration`
2151
+ ).record(
2152
+ this.services.instrumentation.currentTimeMs() - startTime,
2153
+ instrumentationAttributes
2154
+ );
2155
+ }
2156
+ }
2157
+ collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
2158
+ if (this.services.instrumentation) {
2159
+ const meter = this.services.instrumentation.metrics.getMeter("onestore");
2160
+ meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
2161
+ meter.createHistogram(
2162
+ `command.only-if-cached.cache-miss.duration`
2163
+ ).record(
2164
+ this.services.instrumentation.currentTimeMs() - startTime,
2165
+ instrumentationAttributes
2166
+ );
2167
+ }
2168
+ }
2169
+ }
2079
2170
  class CacheController {
2080
2171
  constructor(services) {
2081
2172
  this.services = services;
@@ -2089,6 +2180,8 @@ class CacheController {
2089
2180
  return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
2090
2181
  } else if (config.type === "no-cache") {
2091
2182
  return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
2183
+ } else if (config.type === "only-if-cached") {
2184
+ return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
2092
2185
  }
2093
2186
  throw new Error(`Unknown cache control strategy ${config.type}`);
2094
2187
  }
@@ -2330,7 +2423,7 @@ function buildServiceDescriptor$5(luvio) {
2330
2423
  },
2331
2424
  };
2332
2425
  }
2333
- // version: 1.386.0-521094e838
2426
+ // version: 1.387.0-1c34f8f965
2334
2427
 
2335
2428
  /*!
2336
2429
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2640,7 +2733,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
2640
2733
  },
2641
2734
  };
2642
2735
  }
2643
- // version: 1.386.0-521094e838
2736
+ // version: 1.387.0-1c34f8f965
2644
2737
 
2645
2738
  /*!
2646
2739
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3280,7 +3373,7 @@ const platformSfapJwtResolver = {
3280
3373
  }
3281
3374
  // AuraFetchResponse errors
3282
3375
  const { status } = error;
3283
- if (status !== HttpStatusCode$1.ServerError) {
3376
+ if (status !== HttpStatusCode$2.ServerError) {
3284
3377
  // ConnectInJavaError
3285
3378
  reject(error.body.message);
3286
3379
  return;
@@ -6142,7 +6235,7 @@ function getEnvironmentSetting(name) {
6142
6235
  }
6143
6236
  return undefined;
6144
6237
  }
6145
- // version: 1.386.0-521094e838
6238
+ // version: 1.387.0-1c34f8f965
6146
6239
 
6147
6240
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
6148
6241
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -7109,4 +7202,4 @@ function ldsEngineCreator() {
7109
7202
  }
7110
7203
 
7111
7204
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7112
- // version: 1.386.0-667e615528
7205
+ // version: 1.387.0-8c93a5dd2c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.386.0",
3
+ "version": "1.387.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,47 +34,47 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@luvio/service-provisioner": "5.59.0",
38
- "@luvio/tools-core": "5.59.0",
39
- "@salesforce/lds-adapters-apex": "^1.386.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.386.0",
41
- "@salesforce/lds-ads-bridge": "^1.386.0",
42
- "@salesforce/lds-aura-storage": "^1.386.0",
43
- "@salesforce/lds-bindings": "^1.386.0",
44
- "@salesforce/lds-instrumentation": "^1.386.0",
45
- "@salesforce/lds-network-aura": "^1.386.0",
46
- "@salesforce/lds-network-fetch": "^1.386.0",
37
+ "@luvio/service-provisioner": "5.60.0",
38
+ "@luvio/tools-core": "5.60.0",
39
+ "@salesforce/lds-adapters-apex": "^1.387.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.387.0",
41
+ "@salesforce/lds-ads-bridge": "^1.387.0",
42
+ "@salesforce/lds-aura-storage": "^1.387.0",
43
+ "@salesforce/lds-bindings": "^1.387.0",
44
+ "@salesforce/lds-instrumentation": "^1.387.0",
45
+ "@salesforce/lds-network-aura": "^1.387.0",
46
+ "@salesforce/lds-network-fetch": "^1.387.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-graphql-normalized-cache-control": "5.59.0",
51
- "@luvio/command-aura-network": "5.59.0",
52
- "@luvio/command-aura-normalized-cache-control": "5.59.0",
53
- "@luvio/command-aura-resource-cache-control": "5.59.0",
54
- "@luvio/command-fetch-network": "5.59.0",
55
- "@luvio/command-http-graphql-normalized-cache-control": "5.59.0",
56
- "@luvio/command-http-normalized-cache-control": "5.59.0",
57
- "@luvio/command-ndjson": "5.59.0",
58
- "@luvio/command-network": "5.59.0",
59
- "@luvio/command-sse": "5.59.0",
60
- "@luvio/command-streaming": "5.59.0",
50
+ "@luvio/command-aura-graphql-normalized-cache-control": "5.60.0",
51
+ "@luvio/command-aura-network": "5.60.0",
52
+ "@luvio/command-aura-normalized-cache-control": "5.60.0",
53
+ "@luvio/command-aura-resource-cache-control": "5.60.0",
54
+ "@luvio/command-fetch-network": "5.60.0",
55
+ "@luvio/command-http-graphql-normalized-cache-control": "5.60.0",
56
+ "@luvio/command-http-normalized-cache-control": "5.60.0",
57
+ "@luvio/command-ndjson": "5.60.0",
58
+ "@luvio/command-network": "5.60.0",
59
+ "@luvio/command-sse": "5.60.0",
60
+ "@luvio/command-streaming": "5.60.0",
61
61
  "@luvio/network-adapter-composable": "0.158.7",
62
62
  "@luvio/network-adapter-fetch": "0.158.7",
63
- "@luvio/service-aura-network": "5.59.0",
64
- "@luvio/service-cache": "5.59.0",
65
- "@luvio/service-cache-control": "5.59.0",
66
- "@luvio/service-cache-inclusion-policy": "5.59.0",
67
- "@luvio/service-feature-flags": "5.59.0",
68
- "@luvio/service-fetch-network": "5.59.0",
69
- "@luvio/service-instrument-command": "5.59.0",
70
- "@luvio/service-pubsub": "5.59.0",
71
- "@luvio/service-store": "5.59.0",
72
- "@luvio/utils": "5.59.0",
63
+ "@luvio/service-aura-network": "5.60.0",
64
+ "@luvio/service-cache": "5.60.0",
65
+ "@luvio/service-cache-control": "5.60.0",
66
+ "@luvio/service-cache-inclusion-policy": "5.60.0",
67
+ "@luvio/service-feature-flags": "5.60.0",
68
+ "@luvio/service-fetch-network": "5.60.0",
69
+ "@luvio/service-instrument-command": "5.60.0",
70
+ "@luvio/service-pubsub": "5.60.0",
71
+ "@luvio/service-store": "5.60.0",
72
+ "@luvio/utils": "5.60.0",
73
73
  "@lwc/state": "^0.23.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.386.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.386.0",
76
- "@salesforce/lds-luvio-service": "^1.386.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.386.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.387.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.387.0",
76
+ "@salesforce/lds-luvio-service": "^1.387.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.387.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {