@salesforce/lds-runtime-aura 1.380.0-dev5 → 1.380.0-dev6

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';
@@ -214,6 +214,47 @@ function toError(x) {
214
214
  }
215
215
  return new Error(typeof x === "string" ? x : JSON.stringify(x));
216
216
  }
217
+ var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
218
+ HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
219
+ HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
220
+ HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
221
+ HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
222
+ HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
223
+ HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
224
+ HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
225
+ HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
226
+ HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
227
+ HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
228
+ return HttpStatusCode2;
229
+ })(HttpStatusCode$1 || {});
230
+ function getStatusText(status) {
231
+ switch (status) {
232
+ case 200:
233
+ return "OK";
234
+ case 201:
235
+ return "Created";
236
+ case 304:
237
+ return "Not Modified";
238
+ case 400:
239
+ return "Bad Request";
240
+ case 404:
241
+ return "Not Found";
242
+ case 500:
243
+ return "Server Error";
244
+ default:
245
+ return `Unexpected HTTP Status Code: ${status}`;
246
+ }
247
+ }
248
+ class FetchResponse extends Error {
249
+ constructor(status, body, headers) {
250
+ super();
251
+ this.status = status;
252
+ this.body = body;
253
+ this.headers = headers || {};
254
+ this.ok = status >= 200 && this.status <= 299;
255
+ this.statusText = getStatusText(status);
256
+ }
257
+ }
217
258
  class InternalError extends Error {
218
259
  constructor(data) {
219
260
  super();
@@ -897,9 +938,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
897
938
  super(services);
898
939
  this.services = services;
899
940
  }
900
- execute() {
901
- return super.execute();
902
- }
903
941
  readFromCache(cache) {
904
942
  var _a;
905
943
  const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
@@ -2075,6 +2113,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
2075
2113
  ];
2076
2114
  }
2077
2115
  }
2116
+ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
2117
+ execute(options) {
2118
+ const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
2119
+ return this.services.cacheInclusionPolicy.read({
2120
+ l1: this.filteredCache,
2121
+ readFromL1: (l1) => this.requestRunner.readFromCache(l1)
2122
+ }).then((result) => {
2123
+ if (result.isOk()) {
2124
+ this.collectCacheHitInstrumentation(
2125
+ startTime,
2126
+ options == null ? void 0 : options.instrumentationAttributes
2127
+ );
2128
+ return ok$2(void 0);
2129
+ }
2130
+ this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
2131
+ const error = new UserVisibleError(
2132
+ new FetchResponse(HttpStatusCode$1.GatewayTimeout, {
2133
+ error: "Cache miss for only-if-cached request"
2134
+ })
2135
+ );
2136
+ return err$1(error);
2137
+ });
2138
+ }
2139
+ get expiredChecks() {
2140
+ return [
2141
+ (cacheControlMetadata) => cacheControlMetadata.type === "no-store"
2142
+ ];
2143
+ }
2144
+ collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
2145
+ if (this.services.instrumentation) {
2146
+ const meter = this.services.instrumentation.metrics.getMeter("onestore");
2147
+ meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
2148
+ meter.createHistogram(
2149
+ `command.only-if-cached.cache-hit.duration`
2150
+ ).record(
2151
+ this.services.instrumentation.currentTimeMs() - startTime,
2152
+ instrumentationAttributes
2153
+ );
2154
+ }
2155
+ }
2156
+ collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
2157
+ if (this.services.instrumentation) {
2158
+ const meter = this.services.instrumentation.metrics.getMeter("onestore");
2159
+ meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
2160
+ meter.createHistogram(
2161
+ `command.only-if-cached.cache-miss.duration`
2162
+ ).record(
2163
+ this.services.instrumentation.currentTimeMs() - startTime,
2164
+ instrumentationAttributes
2165
+ );
2166
+ }
2167
+ }
2168
+ }
2078
2169
  class CacheController {
2079
2170
  constructor(services) {
2080
2171
  this.services = services;
@@ -2088,6 +2179,8 @@ class CacheController {
2088
2179
  return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
2089
2180
  } else if (config.type === "no-cache") {
2090
2181
  return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
2182
+ } else if (config.type === "only-if-cached") {
2183
+ return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
2091
2184
  }
2092
2185
  throw new Error(`Unknown cache control strategy ${config.type}`);
2093
2186
  }
@@ -2329,7 +2422,7 @@ function buildServiceDescriptor$5(luvio) {
2329
2422
  },
2330
2423
  };
2331
2424
  }
2332
- // version: 1.380.0-dev5-27c3b66ede
2425
+ // version: 1.380.0-dev6-9d4fd6e5dc
2333
2426
 
2334
2427
  /*!
2335
2428
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2639,7 +2732,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
2639
2732
  },
2640
2733
  };
2641
2734
  }
2642
- // version: 1.380.0-dev5-27c3b66ede
2735
+ // version: 1.380.0-dev6-9d4fd6e5dc
2643
2736
 
2644
2737
  /*!
2645
2738
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3279,7 +3372,7 @@ const platformSfapJwtResolver = {
3279
3372
  }
3280
3373
  // AuraFetchResponse errors
3281
3374
  const { status } = error;
3282
- if (status !== HttpStatusCode$1.ServerError) {
3375
+ if (status !== HttpStatusCode$2.ServerError) {
3283
3376
  // ConnectInJavaError
3284
3377
  reject(error.body.message);
3285
3378
  return;
@@ -6130,7 +6223,7 @@ function getEnvironmentSetting(name) {
6130
6223
  }
6131
6224
  return undefined;
6132
6225
  }
6133
- // version: 1.380.0-dev5-27c3b66ede
6226
+ // version: 1.380.0-dev6-9d4fd6e5dc
6134
6227
 
6135
6228
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
6136
6229
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -7097,4 +7190,4 @@ function ldsEngineCreator() {
7097
7190
  }
7098
7191
 
7099
7192
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7100
- // version: 1.380.0-dev5-94859d35c9
7193
+ // version: 1.380.0-dev6-1891f38076
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.380.0-dev5",
3
+ "version": "1.380.0-dev6",
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.380.0-dev5",
40
- "@salesforce/lds-adapters-uiapi": "^1.380.0-dev5",
37
+ "@luvio/service-provisioner": "5.60.0-dev1",
38
+ "@luvio/tools-core": "5.60.0-dev1",
39
+ "@salesforce/lds-adapters-apex": "^1.380.0-dev6",
40
+ "@salesforce/lds-adapters-uiapi": "^1.380.0-dev6",
41
41
  "@salesforce/lds-adapters-uiapi-lex": "^1.371.0",
42
- "@salesforce/lds-ads-bridge": "^1.380.0-dev5",
43
- "@salesforce/lds-aura-storage": "^1.380.0-dev5",
44
- "@salesforce/lds-bindings": "^1.380.0-dev5",
45
- "@salesforce/lds-instrumentation": "^1.380.0-dev5",
46
- "@salesforce/lds-network-aura": "^1.380.0-dev5",
47
- "@salesforce/lds-network-fetch": "^1.380.0-dev5",
42
+ "@salesforce/lds-ads-bridge": "^1.380.0-dev6",
43
+ "@salesforce/lds-aura-storage": "^1.380.0-dev6",
44
+ "@salesforce/lds-bindings": "^1.380.0-dev6",
45
+ "@salesforce/lds-instrumentation": "^1.380.0-dev6",
46
+ "@salesforce/lds-network-aura": "^1.380.0-dev6",
47
+ "@salesforce/lds-network-fetch": "^1.380.0-dev6",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@luvio/command-aura-graphql-normalized-cache-control": "5.59.0",
52
- "@luvio/command-aura-network": "5.59.0",
53
- "@luvio/command-aura-normalized-cache-control": "5.59.0",
54
- "@luvio/command-aura-resource-cache-control": "5.59.0",
55
- "@luvio/command-fetch-network": "5.59.0",
56
- "@luvio/command-http-graphql-normalized-cache-control": "5.59.0",
57
- "@luvio/command-http-normalized-cache-control": "5.59.0",
58
- "@luvio/command-ndjson": "5.59.0",
59
- "@luvio/command-network": "5.59.0",
60
- "@luvio/command-sse": "5.59.0",
61
- "@luvio/command-streaming": "5.59.0",
51
+ "@luvio/command-aura-graphql-normalized-cache-control": "5.60.0-dev1",
52
+ "@luvio/command-aura-network": "5.60.0-dev1",
53
+ "@luvio/command-aura-normalized-cache-control": "5.60.0-dev1",
54
+ "@luvio/command-aura-resource-cache-control": "5.60.0-dev1",
55
+ "@luvio/command-fetch-network": "5.60.0-dev1",
56
+ "@luvio/command-http-graphql-normalized-cache-control": "5.60.0-dev1",
57
+ "@luvio/command-http-normalized-cache-control": "5.60.0-dev1",
58
+ "@luvio/command-ndjson": "5.60.0-dev1",
59
+ "@luvio/command-network": "5.60.0-dev1",
60
+ "@luvio/command-sse": "5.60.0-dev1",
61
+ "@luvio/command-streaming": "5.60.0-dev1",
62
62
  "@luvio/network-adapter-composable": "0.158.7",
63
63
  "@luvio/network-adapter-fetch": "0.158.7",
64
- "@luvio/service-aura-network": "5.59.0",
65
- "@luvio/service-cache": "5.59.0",
66
- "@luvio/service-cache-control": "5.59.0",
67
- "@luvio/service-cache-inclusion-policy": "5.59.0",
68
- "@luvio/service-feature-flags": "5.59.0",
69
- "@luvio/service-fetch-network": "5.59.0",
70
- "@luvio/service-instrument-command": "5.59.0",
71
- "@luvio/service-pubsub": "5.59.0",
72
- "@luvio/service-store": "5.59.0",
73
- "@luvio/utils": "5.59.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.380.0-dev5",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev5",
76
- "@salesforce/lds-luvio-service": "^1.380.0-dev5",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev5"
64
+ "@luvio/service-aura-network": "5.60.0-dev1",
65
+ "@luvio/service-cache": "5.60.0-dev1",
66
+ "@luvio/service-cache-control": "5.60.0-dev1",
67
+ "@luvio/service-cache-inclusion-policy": "5.60.0-dev1",
68
+ "@luvio/service-feature-flags": "5.60.0-dev1",
69
+ "@luvio/service-fetch-network": "5.60.0-dev1",
70
+ "@luvio/service-instrument-command": "5.60.0-dev1",
71
+ "@luvio/service-pubsub": "5.60.0-dev1",
72
+ "@luvio/service-store": "5.60.0-dev1",
73
+ "@luvio/utils": "5.60.0-dev1",
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.380.0-dev6",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev6",
76
+ "@salesforce/lds-luvio-service": "^1.380.0-dev6",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev6"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {