@salesforce/lds-runtime-aura 1.404.0-dev5 → 1.404.0-dev7

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.
@@ -42,6 +42,10 @@ import { instrument as instrument$5 } from '@lwc/state';
42
42
  import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
43
43
  import { pageScopedCache } from 'instrumentation/utility';
44
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';
45
49
  import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
46
50
  import useHttpUiapiOneApp from '@salesforce/gate/lds.useHttpUiapiOneApp';
47
51
  import useHttpUiapiOneRuntime from '@salesforce/gate/lds.useHttpUiapiOneRuntime';
@@ -471,7 +475,12 @@ class AuraNetworkCommand extends NetworkCommand$1 {
471
475
  this.coerceAuraErrors
472
476
  );
473
477
  } else if (this.shouldUseFetch()) {
474
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
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
+ }
475
484
  }
476
485
  return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
477
486
  }
@@ -1069,7 +1078,12 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
1069
1078
  (errs) => this.coerceAuraErrors(errs)
1070
1079
  );
1071
1080
  } else if (this.shouldUseFetch()) {
1072
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
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
+ }
1073
1087
  }
1074
1088
  return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
1075
1089
  }
@@ -1212,7 +1226,12 @@ class AuraCacheControlCommand extends CacheControlCommand {
1212
1226
  (errs) => this.coerceAuraErrors(errs)
1213
1227
  );
1214
1228
  } else if (this.shouldUseFetch()) {
1215
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
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
+ }
1216
1235
  }
1217
1236
  return resolvedPromiseLike$2(err$1(toError("Aura/Fetch network services not found")));
1218
1237
  }
@@ -1330,7 +1349,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
1330
1349
  return this.fetch();
1331
1350
  }
1332
1351
  fetch() {
1333
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
1352
+ try {
1353
+ return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
1354
+ } catch (reason) {
1355
+ return resolvedPromiseLike$2(err$1(toError(reason)));
1356
+ }
1334
1357
  }
1335
1358
  async coerceError(errorResponse) {
1336
1359
  return toError(errorResponse.statusText);
@@ -1533,7 +1556,11 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
1533
1556
  this.services = services;
1534
1557
  }
1535
1558
  fetch() {
1536
- return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
1559
+ try {
1560
+ return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
1561
+ } catch (reason) {
1562
+ return resolvedPromiseLike$2(err$1(toError(reason)));
1563
+ }
1537
1564
  }
1538
1565
  async coerceError(errorResponse) {
1539
1566
  return toError(errorResponse.statusText);
@@ -1589,7 +1616,11 @@ class StreamingCommand extends BaseCommand {
1589
1616
  this.services = services;
1590
1617
  }
1591
1618
  execute() {
1592
- return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
1619
+ try {
1620
+ return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
1621
+ } catch (reason) {
1622
+ return resolvedPromiseLike$2(err$1(toError(reason)));
1623
+ }
1593
1624
  }
1594
1625
  convertFetchStreamResponseToData(response) {
1595
1626
  return response.then(
@@ -2425,9 +2456,13 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
2425
2456
  }
2426
2457
  get expiredChecks() {
2427
2458
  return [
2428
- (cacheControlMetadata) => cacheControlMetadata.type === "no-store"
2459
+ ...super.expiredChecks,
2460
+ (cacheControlMetadata) => cacheControlMetadata.type === "no-cache"
2429
2461
  ];
2430
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.
2431
2466
  collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
2432
2467
  if (this.services.instrumentation) {
2433
2468
  const meter = this.services.instrumentation.metrics.getMeter("onestore");
@@ -2667,7 +2702,7 @@ function buildServiceDescriptor$d(luvio) {
2667
2702
  },
2668
2703
  };
2669
2704
  }
2670
- // version: 1.404.0-dev5-38a59c52aa
2705
+ // version: 1.404.0-dev7-7d4ca687f7
2671
2706
 
2672
2707
  /*!
2673
2708
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2783,11 +2818,26 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
2783
2818
  return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
2784
2819
  });
2785
2820
  } else if (this.shouldUseFetch()) {
2786
- return this.convertFetchResponseToData(
2787
- this.services.fetch(...this.originalFetchParams)
2788
- ).then((result) => {
2789
- return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
2790
- });
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
+ }
2791
2841
  }
2792
2842
  return resolvedPromiseLike$2(
2793
2843
  buildSubscribableResult$1(
@@ -3005,7 +3055,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
3005
3055
  },
3006
3056
  };
3007
3057
  }
3008
- // version: 1.404.0-dev5-38a59c52aa
3058
+ // version: 1.404.0-dev7-7d4ca687f7
3009
3059
 
3010
3060
  /*!
3011
3061
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4708,7 +4758,7 @@ function getEnvironmentSetting(name) {
4708
4758
  }
4709
4759
  return undefined;
4710
4760
  }
4711
- // version: 1.404.0-dev5-38a59c52aa
4761
+ // version: 1.404.0-dev7-7d4ca687f7
4712
4762
 
4713
4763
  /**
4714
4764
  * Observability / Critical Availability Program (230+)
@@ -5838,6 +5888,23 @@ class CsrfTokenManager {
5838
5888
  CsrfTokenManager.instance = null;
5839
5889
 
5840
5890
  const CSRF_TOKEN_HEADER = 'X-CSRF-Token';
5891
+ /**
5892
+ * Checks if all required gates are enabled for CSRF token interceptor.
5893
+ *
5894
+ * @returns true if all gates are enabled, false otherwise
5895
+ */
5896
+ function areCsrfGatesEnabled() {
5897
+ try {
5898
+ return (lightningConnectEnabled.isOpen({ fallback: false }) &&
5899
+ bypassAppRestrictionEnabled.isOpen({ fallback: false }) &&
5900
+ csrfValidationEnabled.isOpen({ fallback: false }) &&
5901
+ sessionApiEnabled.isOpen({ fallback: false }));
5902
+ }
5903
+ catch (error) {
5904
+ // If any gate check fails, disable CSRF interceptor
5905
+ return false;
5906
+ }
5907
+ }
5841
5908
  /**
5842
5909
  * Determines if the HTTP method requires CSRF protection.
5843
5910
  * Only mutating operations (POST, PUT, PATCH, DELETE) require CSRF tokens.
@@ -5865,6 +5932,10 @@ function isCsrfMethod(method) {
5865
5932
  function buildCsrfTokenInterceptor() {
5866
5933
  const csrfTokenManager = CsrfTokenManager.getInstance();
5867
5934
  return async (fetchArgs) => {
5935
+ // Check if all required gates are enabled before running
5936
+ if (!areCsrfGatesEnabled()) {
5937
+ return resolvedPromiseLike$2(fetchArgs);
5938
+ }
5868
5939
  const [urlOrRequest, options] = fetchArgs;
5869
5940
  // Determine the method from either Request object or options
5870
5941
  let method;
@@ -5894,6 +5965,10 @@ function buildCsrfTokenInterceptor() {
5894
5965
  function buildLuvioCsrfTokenInterceptor() {
5895
5966
  const csrfTokenManager = CsrfTokenManager.getInstance();
5896
5967
  return async (resourceRequest) => {
5968
+ // Check if all required gates are enabled before running
5969
+ if (!areCsrfGatesEnabled()) {
5970
+ return resolvedPromiseLike$2(resourceRequest);
5971
+ }
5897
5972
  // Ensure headers object exists
5898
5973
  if (!resourceRequest.headers) {
5899
5974
  resourceRequest.headers = {};
@@ -6142,8 +6217,8 @@ async function isCsrfError(response) {
6142
6217
  // Clone to avoid consuming the original response
6143
6218
  const cloned = response.clone();
6144
6219
  const body = await cloned.json();
6145
- // Check the error array format: data[0].errorCode
6146
- const errorCode = body?.data?.[0]?.errorCode;
6220
+ // Check the error array format: body[0].errorCode
6221
+ const errorCode = body?.[0]?.errorCode;
6147
6222
  return errorCode === 'INVALID_ACCESS_TOKEN';
6148
6223
  }
6149
6224
  catch {
@@ -9842,4 +9917,4 @@ function ldsEngineCreator() {
9842
9917
  }
9843
9918
 
9844
9919
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
9845
- // version: 1.404.0-dev5-924c469d6b
9920
+ // version: 1.404.0-dev7-f7cbfedbf0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.404.0-dev5",
3
+ "version": "1.404.0-dev7",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,49 +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.2.0",
38
- "@conduit-client/tools-core": "3.2.0",
39
- "@salesforce/lds-adapters-apex": "^1.404.0-dev5",
40
- "@salesforce/lds-adapters-uiapi": "^1.404.0-dev5",
41
- "@salesforce/lds-ads-bridge": "^1.404.0-dev5",
42
- "@salesforce/lds-aura-storage": "^1.404.0-dev5",
43
- "@salesforce/lds-bindings": "^1.404.0-dev5",
44
- "@salesforce/lds-instrumentation": "^1.404.0-dev5",
45
- "@salesforce/lds-network-aura": "^1.404.0-dev5",
46
- "@salesforce/lds-network-fetch": "^1.404.0-dev5",
37
+ "@conduit-client/service-provisioner": "3.7.0-dev2",
38
+ "@conduit-client/tools-core": "3.7.0-dev2",
39
+ "@salesforce/lds-adapters-apex": "^1.404.0-dev7",
40
+ "@salesforce/lds-adapters-uiapi": "^1.404.0-dev7",
41
+ "@salesforce/lds-ads-bridge": "^1.404.0-dev7",
42
+ "@salesforce/lds-aura-storage": "^1.404.0-dev7",
43
+ "@salesforce/lds-bindings": "^1.404.0-dev7",
44
+ "@salesforce/lds-instrumentation": "^1.404.0-dev7",
45
+ "@salesforce/lds-network-aura": "^1.404.0-dev7",
46
+ "@salesforce/lds-network-fetch": "^1.404.0-dev7",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@conduit-client/command-aura-graphql-normalized-cache-control": "3.2.0",
51
- "@conduit-client/command-aura-network": "3.2.0",
52
- "@conduit-client/command-aura-normalized-cache-control": "3.2.0",
53
- "@conduit-client/command-aura-resource-cache-control": "3.2.0",
54
- "@conduit-client/command-fetch-network": "3.2.0",
55
- "@conduit-client/command-http-graphql-normalized-cache-control": "3.2.0",
56
- "@conduit-client/command-http-normalized-cache-control": "3.2.0",
57
- "@conduit-client/command-ndjson": "3.2.0",
58
- "@conduit-client/command-network": "3.2.0",
59
- "@conduit-client/command-sse": "3.2.0",
60
- "@conduit-client/command-streaming": "3.2.0",
61
- "@conduit-client/service-aura-network": "3.2.0",
62
- "@conduit-client/service-bindings-imperative": "3.2.0",
63
- "@conduit-client/service-bindings-lwc": "3.2.0",
64
- "@conduit-client/service-cache": "3.2.0",
65
- "@conduit-client/service-cache-control": "3.2.0",
66
- "@conduit-client/service-cache-inclusion-policy": "3.2.0",
67
- "@conduit-client/service-feature-flags": "3.2.0",
68
- "@conduit-client/service-fetch-network": "3.2.0",
69
- "@conduit-client/service-instrument-command": "3.2.0",
70
- "@conduit-client/service-pubsub": "3.2.0",
71
- "@conduit-client/service-store": "3.2.0",
72
- "@conduit-client/utils": "3.2.0",
50
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "3.7.0-dev2",
51
+ "@conduit-client/command-aura-network": "3.7.0-dev2",
52
+ "@conduit-client/command-aura-normalized-cache-control": "3.7.0-dev2",
53
+ "@conduit-client/command-aura-resource-cache-control": "3.7.0-dev2",
54
+ "@conduit-client/command-fetch-network": "3.7.0-dev2",
55
+ "@conduit-client/command-http-graphql-normalized-cache-control": "3.7.0-dev2",
56
+ "@conduit-client/command-http-normalized-cache-control": "3.7.0-dev2",
57
+ "@conduit-client/command-ndjson": "3.7.0-dev2",
58
+ "@conduit-client/command-network": "3.7.0-dev2",
59
+ "@conduit-client/command-sse": "3.7.0-dev2",
60
+ "@conduit-client/command-streaming": "3.7.0-dev2",
61
+ "@conduit-client/service-aura-network": "3.7.0-dev2",
62
+ "@conduit-client/service-bindings-imperative": "3.7.0-dev2",
63
+ "@conduit-client/service-bindings-lwc": "3.7.0-dev2",
64
+ "@conduit-client/service-cache": "3.7.0-dev2",
65
+ "@conduit-client/service-cache-control": "3.7.0-dev2",
66
+ "@conduit-client/service-cache-inclusion-policy": "3.7.0-dev2",
67
+ "@conduit-client/service-feature-flags": "3.7.0-dev2",
68
+ "@conduit-client/service-fetch-network": "3.7.0-dev2",
69
+ "@conduit-client/service-instrument-command": "3.7.0-dev2",
70
+ "@conduit-client/service-pubsub": "3.7.0-dev2",
71
+ "@conduit-client/service-store": "3.7.0-dev2",
72
+ "@conduit-client/utils": "3.7.0-dev2",
73
73
  "@luvio/network-adapter-composable": "0.158.7",
74
74
  "@luvio/network-adapter-fetch": "0.158.7",
75
75
  "@lwc/state": "^0.23.0",
76
- "@salesforce/lds-adapters-onestore-graphql": "^1.404.0-dev5",
77
- "@salesforce/lds-adapters-uiapi-lex": "^1.404.0-dev5",
78
- "@salesforce/lds-luvio-service": "^1.404.0-dev5",
79
- "@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-dev5"
76
+ "@salesforce/lds-adapters-onestore-graphql": "^1.404.0-dev7",
77
+ "@salesforce/lds-adapters-uiapi-lex": "^1.404.0-dev7",
78
+ "@salesforce/lds-luvio-service": "^1.404.0-dev7",
79
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.404.0-dev7"
80
80
  },
81
81
  "luvioBundlesize": [
82
82
  {