@salesforce/lds-runtime-aura 1.450.0 → 1.451.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.
@@ -22,9 +22,9 @@ import { instrument, getRecordAvatarsAdapterFactory, getRecordAdapterFactory, co
22
22
  import { getInstrumentation } from 'o11y/client';
23
23
  import { findExecutableOperation, buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
24
24
  import { print, resolveAndValidateGraphQLConfig, toGraphQLErrorResponse } from 'force/luvioOnestoreGraphqlParser';
25
- import getServices, { setServices } from 'force/luvioServiceProvisioner1';
26
- import { assertIsValid, JsonSchemaViolationError, MissingRequiredPropertyError } from 'force/luvioJsonschemaValidate5';
25
+ import getServices, { buildStaticServiceResolver, setServiceResolver, setServices } from 'force/luvioServiceProvisioner1';
27
26
  import { dispatchGlobalEvent as dispatchGlobalEvent$1, executeGlobalControllerRawResponse } from 'aura';
27
+ import { assertIsValid, JsonSchemaViolationError, MissingRequiredPropertyError } from 'force/luvioJsonschemaValidate5';
28
28
  import auraNetworkAdapter, { dispatchAuraAction, defaultActionConfig, instrument as instrument$1, forceRecordTransactionsDisabled as forceRecordTransactionsDisabled$1, ldsNetworkAdapterInstrument, CrudEventState, CrudEventType, UIAPI_RECORDS_PATH, UIAPI_RELATED_LIST_RECORDS_BATCH_PATH, UIAPI_RELATED_LIST_RECORDS_PATH } from 'force/ldsNetwork';
29
29
  import { ThirdPartyTracker } from 'instrumentation:thirdPartyTracker';
30
30
  import { markStart, markEnd, counter, registerCacheStats, perfStart, perfEnd, registerPeriodicLogger, interaction, timer, mark } from 'instrumentation/service';
@@ -2590,7 +2590,7 @@ function buildServiceDescriptor$d(luvio) {
2590
2590
  },
2591
2591
  };
2592
2592
  }
2593
- // version: 1.450.0-163071957b
2593
+ // version: 1.451.0-b776d3eb45
2594
2594
 
2595
2595
  class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
2596
2596
  constructor(config, documentRootType, services) {
@@ -2929,7 +2929,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
2929
2929
  },
2930
2930
  };
2931
2931
  }
2932
- // version: 1.450.0-163071957b
2932
+ // version: 1.451.0-b776d3eb45
2933
2933
 
2934
2934
  class RetryService {
2935
2935
  constructor(defaultRetryPolicy) {
@@ -3081,6 +3081,90 @@ function buildServiceDescriptor$8(defaultRetryPolicy) {
3081
3081
  };
3082
3082
  }
3083
3083
 
3084
+ function tagsEqual(a, b) {
3085
+ const keys = Object.keys(b);
3086
+ return (a !== undefined && keys.length === Object.keys(a).length && keys.every((k) => a[k] === b[k]));
3087
+ }
3088
+ // W-23092947: on Aura sites HTTP-to-core is broken, so withhold every `fetch` service
3089
+ // except those whose request tags are in `allowedFetchTags` (the external hosts). A
3090
+ // withheld optional fetch resolves to `undefined`, making `AuraNetworkCommand` use Aura.
3091
+ function buildAuraSiteServiceResolver(services, allowedFetchTags) {
3092
+ const staticResolver = buildStaticServiceResolver(services);
3093
+ const isWithheld = (req) => req.type === 'fetch' && !allowedFetchTags.some((allowed) => tagsEqual(req.tags, allowed));
3094
+ return (requested) => {
3095
+ const passthrough = {};
3096
+ const withheldUnresolved = [];
3097
+ for (const [name, req] of Object.entries(requested)) {
3098
+ if (!isWithheld(req)) {
3099
+ passthrough[name] = req;
3100
+ }
3101
+ else if (!('optional' in req && req.optional)) {
3102
+ withheldUnresolved.push(name);
3103
+ }
3104
+ }
3105
+ return staticResolver(passthrough).then(([resolved, unresolved]) => [
3106
+ resolved,
3107
+ [...unresolved, ...withheldUnresolved],
3108
+ ]);
3109
+ };
3110
+ }
3111
+
3112
+ /**
3113
+ * Helpers for reaching the Aura framework from the LDS Aura runtime.
3114
+ *
3115
+ * `window.$A` is only present when the runtime is hosted inside Aura (LEX or
3116
+ * an Aura site); in tests and non-Aura runtimes it is absent. `getAura()`
3117
+ * centralizes the guarded lookup so the `$A` access lives in one place instead
3118
+ * of being duplicated across modules.
3119
+ */
3120
+ /**
3121
+ * Returns the Aura framework global (`window.$A`) when running inside Aura
3122
+ * (LEX or an Aura site), or `undefined` in tests and non-Aura runtimes.
3123
+ * Centralizes the guarded `$A` lookup so callers reach for it once and read
3124
+ * intent instead of repeating `typeof window` / `$A` guards.
3125
+ */
3126
+ function getAura() {
3127
+ if (typeof window === 'undefined') {
3128
+ return undefined;
3129
+ }
3130
+ return window.$A;
3131
+ }
3132
+ /**
3133
+ * Fires an Aura application-level event (e.g. `aura:invalidSession`). Thin
3134
+ * pass-through to the `aura` framework module so callers depend on this util
3135
+ * rather than importing `aura` directly.
3136
+ */
3137
+ function dispatchGlobalEvent(...args) {
3138
+ dispatchGlobalEvent$1(...args);
3139
+ }
3140
+ /**
3141
+ * Returns `$A.clientService` when running inside an Aura environment, or
3142
+ * `undefined` otherwise. Defensive: never throws.
3143
+ */
3144
+ function getAuraClientService() {
3145
+ return getAura()?.clientService;
3146
+ }
3147
+ /**
3148
+ * Returns `true` when the Aura runtime is hosted inside an Aura/Experience
3149
+ * site (Experience Builder / `communityApp`) rather than LEX (one.app).
3150
+ * `$A.get('$Site')` is present and truthy on Aura sites and absent/falsy in
3151
+ * LEX. A stable per-page signal, so it is safe to evaluate once at module
3152
+ * load. Defensive: never throws.
3153
+ *
3154
+ * Used to keep the OneStore GraphQL adapter — and the HTTP UIAPI fetch path —
3155
+ * on the Aura transport for sites, because the HTTP transport's CSRF handling
3156
+ * does not work in the Aura Sites runtime (W-23092947).
3157
+ */
3158
+ function isAuraSite() {
3159
+ const aura = getAura();
3160
+ try {
3161
+ return !!aura?.get?.('$Site');
3162
+ }
3163
+ catch {
3164
+ return false;
3165
+ }
3166
+ }
3167
+
3084
3168
  class BasicRenewableResourceManager {
3085
3169
  constructor(config) {
3086
3170
  this.config = config;
@@ -5843,63 +5927,7 @@ function getEnvironmentSetting(name) {
5843
5927
  }
5844
5928
  return undefined;
5845
5929
  }
5846
- // version: 1.450.0-b7557fd74b
5847
-
5848
- /**
5849
- * Helpers for reaching the Aura framework from the LDS Aura runtime.
5850
- *
5851
- * `window.$A` is only present when the runtime is hosted inside Aura (LEX or
5852
- * an Aura site); in tests and non-Aura runtimes it is absent. `getAura()`
5853
- * centralizes the guarded lookup so the `$A` access lives in one place instead
5854
- * of being duplicated across modules.
5855
- */
5856
- /**
5857
- * Returns the Aura framework global (`window.$A`) when running inside Aura
5858
- * (LEX or an Aura site), or `undefined` in tests and non-Aura runtimes.
5859
- * Centralizes the guarded `$A` lookup so callers reach for it once and read
5860
- * intent instead of repeating `typeof window` / `$A` guards.
5861
- */
5862
- function getAura() {
5863
- if (typeof window === 'undefined') {
5864
- return undefined;
5865
- }
5866
- return window.$A;
5867
- }
5868
- /**
5869
- * Fires an Aura application-level event (e.g. `aura:invalidSession`). Thin
5870
- * pass-through to the `aura` framework module so callers depend on this util
5871
- * rather than importing `aura` directly.
5872
- */
5873
- function dispatchGlobalEvent(...args) {
5874
- dispatchGlobalEvent$1(...args);
5875
- }
5876
- /**
5877
- * Returns `$A.clientService` when running inside an Aura environment, or
5878
- * `undefined` otherwise. Defensive: never throws.
5879
- */
5880
- function getAuraClientService() {
5881
- return getAura()?.clientService;
5882
- }
5883
- /**
5884
- * Returns `true` when the Aura runtime is hosted inside an Aura/Experience
5885
- * site (Experience Builder / `communityApp`) rather than LEX (one.app).
5886
- * `$A.get('$Site')` is present and truthy on Aura sites and absent/falsy in
5887
- * LEX. A stable per-page signal, so it is safe to evaluate once at module
5888
- * load. Defensive: never throws.
5889
- *
5890
- * Used to keep the OneStore GraphQL adapter — and the HTTP UIAPI fetch path —
5891
- * on the Aura transport for sites, because the HTTP transport's CSRF handling
5892
- * does not work in the Aura Sites runtime (W-23092947).
5893
- */
5894
- function isAuraSite() {
5895
- const aura = getAura();
5896
- try {
5897
- return !!aura?.get?.('$Site');
5898
- }
5899
- catch {
5900
- return false;
5901
- }
5902
- }
5930
+ // version: 1.451.0-231643dd9a
5903
5931
 
5904
5932
  const auraClientService = getAuraClientService();
5905
5933
  const defaultConfig = {
@@ -6622,7 +6650,11 @@ function createTransportStartMark(requestId) {
6622
6650
  startMark.context = {
6623
6651
  auraXHRId: requestId,
6624
6652
  background: false,
6625
- actionDefs: ['lds-fetch'],
6653
+ // The Perf App waterfall fabricates a zero-width stub action row per actionDefs
6654
+ // entry and merges it with the real action mark only when their ids match. The
6655
+ // action mark's id is the requestId, so actionDefs must carry the requestId (not a
6656
+ // constant tag) for that merge to happen and the real duration to render.
6657
+ actionDefs: [requestId],
6626
6658
  requestId,
6627
6659
  requestLength: -1, // not known
6628
6660
  };
@@ -6633,6 +6665,13 @@ function createActionStartMark(context) {
6633
6665
  id: context.instrumentationId,
6634
6666
  cmp: context.cmp || 'none',
6635
6667
  source: 'lds-fetch',
6668
+ // These fields don't semantically apply to an HTTP fetch (there's no Aura action
6669
+ // to abort or store), but the Perf App waterfall keys on them: getType() classifies
6670
+ // a mark as an action only when `abortable` is present, and it appends an "(interim)"
6671
+ // label when `storable` is null. `false` is accurate (these requests are neither
6672
+ // abortable nor Aura-storable) and lets the waterfall render the mark at full width.
6673
+ abortable: false,
6674
+ storable: false,
6636
6675
  };
6637
6676
  mark('actions', 'sendQueued', startMark.context);
6638
6677
  mark('actions', 'sendStart', startMark.context);
@@ -11434,6 +11473,13 @@ function initializeLDS() {
11434
11473
  }
11435
11474
  return luvio; // Return the luvio instance so that we can inject it for OneStore
11436
11475
  }
11476
+ // W-23092947: fetch request tags allowed to stay on HTTP on Aura sites (external hosts).
11477
+ // Everything else (core UIAPI/GraphQL) is withheld so it falls back to Aura transport.
11478
+ const AURA_SITE_ALLOWED_FETCH_TAGS = [
11479
+ { authenticationScopes: 'sfap_api' },
11480
+ { authenticationScopes: 'data_360_cdp_url_rewrite' },
11481
+ { specialHacksFor: 'copilot' }, // copilot
11482
+ ];
11437
11483
  // Initializes OneStore in LEX
11438
11484
  function initializeOneStore(luvio) {
11439
11485
  const loggerService = new ConsoleLogger('ERROR');
@@ -11528,7 +11574,13 @@ function initializeOneStore(luvio) {
11528
11574
  prefetchSfapJwtServiceDescriptor,
11529
11575
  csrfTokenManagerServiceDescriptor,
11530
11576
  ];
11531
- setServices(services);
11577
+ // W-23092947: Aura sites route core-bound commands over Aura (see the resolver).
11578
+ if (isAuraSite()) {
11579
+ setServiceResolver(buildAuraSiteServiceResolver(services, AURA_SITE_ALLOWED_FETCH_TAGS));
11580
+ }
11581
+ else {
11582
+ setServices(services);
11583
+ }
11532
11584
  }
11533
11585
  function buildAuraNetworkService() {
11534
11586
  return {
@@ -11546,4 +11598,4 @@ function ldsEngineCreator() {
11546
11598
  }
11547
11599
 
11548
11600
  export { LexRequestStrategy, PDL_ENGINE_REGISTRATION_ID, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
11549
- // version: 1.450.0-163071957b
11601
+ // version: 1.451.0-b776d3eb45
@@ -0,0 +1,5 @@
1
+ import { type PublishedService, type ServiceResolver, type ServicesRequest } from '@conduit-client/service-provisioner/v1';
2
+ import { type ServiceDescriptor } from '@conduit-client/utils';
3
+ type Tags = Record<string, string>;
4
+ export declare function buildAuraSiteServiceResolver<R extends ServicesRequest<ServiceDescriptor<unknown>>>(services: PublishedService[], allowedFetchTags: ReadonlyArray<Tags>): ServiceResolver<R>;
5
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.450.0",
3
+ "version": "1.451.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime.",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -36,15 +36,15 @@
36
36
  "devDependencies": {
37
37
  "@conduit-client/service-provisioner": "3.26.0",
38
38
  "@conduit-client/tools-core": "3.26.0",
39
- "@salesforce/lds-adapters-apex": "^1.450.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.450.0",
41
- "@salesforce/lds-ads-bridge": "^1.450.0",
42
- "@salesforce/lds-aura-storage": "^1.450.0",
43
- "@salesforce/lds-bindings": "^1.450.0",
44
- "@salesforce/lds-instrumentation": "^1.450.0",
45
- "@salesforce/lds-network-adapter": "^1.450.0",
46
- "@salesforce/lds-network-aura": "^1.450.0",
47
- "@salesforce/lds-network-fetch": "^1.450.0",
39
+ "@salesforce/lds-adapters-apex": "^1.451.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.451.0",
41
+ "@salesforce/lds-ads-bridge": "^1.451.0",
42
+ "@salesforce/lds-aura-storage": "^1.451.0",
43
+ "@salesforce/lds-bindings": "^1.451.0",
44
+ "@salesforce/lds-instrumentation": "^1.451.0",
45
+ "@salesforce/lds-network-adapter": "^1.451.0",
46
+ "@salesforce/lds-network-aura": "^1.451.0",
47
+ "@salesforce/lds-network-fetch": "^1.451.0",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
@@ -76,19 +76,19 @@
76
76
  "@luvio/network-adapter-composable": "0.161.0",
77
77
  "@luvio/network-adapter-fetch": "0.161.0",
78
78
  "@lwc/state": "^0.29.0",
79
- "@salesforce/lds-adapters-onestore-graphql": "^1.450.0",
79
+ "@salesforce/lds-adapters-onestore-graphql": "^1.451.0",
80
80
  "@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
81
- "@salesforce/lds-durable-storage": "^1.450.0",
82
- "@salesforce/lds-luvio-service": "^1.450.0",
83
- "@salesforce/lds-luvio-uiapi-records-service": "^1.450.0"
81
+ "@salesforce/lds-durable-storage": "^1.451.0",
82
+ "@salesforce/lds-luvio-service": "^1.451.0",
83
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.451.0"
84
84
  },
85
85
  "luvioBundlesize": [
86
86
  {
87
87
  "path": "./dist/ldsEngineCreator.js",
88
88
  "maxSize": {
89
- "none": "415 kB",
89
+ "none": "418 kB",
90
90
  "min": "190 kB",
91
- "compressed": "73 kB"
91
+ "compressed": "74 kB"
92
92
  }
93
93
  }
94
94
  ],