@salesforce/lds-runtime-aura 1.428.0-dev21 → 1.428.0-dev22

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.
@@ -26,7 +26,7 @@ import { instrument, getRecordAvatarsAdapterFactory, getRecordAdapterFactory, co
26
26
  import { getInstrumentation } from 'o11y/client';
27
27
  import { findExecutableOperation, buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
28
28
  import { print, resolveAndValidateGraphQLConfig } from 'force/luvioOnestoreGraphqlParser';
29
- import { setServices } from 'force/luvioServiceProvisioner1';
29
+ import { buildStaticServiceResolver, setServiceResolver, setServices } from 'force/luvioServiceProvisioner1';
30
30
  import { assertIsValid, MissingRequiredPropertyError, JsonSchemaViolationError } from 'force/luvioJsonschemaValidate5';
31
31
  import { dispatchGlobalEvent, executeGlobalControllerRawResponse } from 'aura';
32
32
  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';
@@ -402,6 +402,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
402
402
  storable: false
403
403
  };
404
404
  this.networkPreference = "aura";
405
+ this.additionalNullResponses = [];
405
406
  }
406
407
  get fetchParams() {
407
408
  throw new Error(
@@ -438,14 +439,37 @@ class AuraNetworkCommand extends NetworkCommand$1 {
438
439
  }
439
440
  });
440
441
  }
442
+ isSemanticNullResponse(response) {
443
+ return this.additionalNullResponses.includes(response.status);
444
+ }
445
+ isProtocolNoBodyStatus(status) {
446
+ return status === 204 || status === 205;
447
+ }
448
+ isUndeclaredNoBodyResponse(response) {
449
+ return this.isProtocolNoBodyStatus(response.status) && !this.isSemanticNullResponse(response);
450
+ }
441
451
  convertFetchResponseToData(response) {
442
452
  return response.then(
443
453
  (response2) => {
444
454
  if (response2.ok) {
445
- return response2.json().then(
446
- (json) => ok$2(json),
447
- (reason) => err$1(toError(reason))
448
- ).finally(() => {
455
+ let resultPromise;
456
+ if (this.isSemanticNullResponse(response2)) {
457
+ resultPromise = Promise.resolve(ok$2(null));
458
+ } else if (this.isUndeclaredNoBodyResponse(response2)) {
459
+ resultPromise = Promise.resolve(
460
+ err$1(
461
+ toError(
462
+ `Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
463
+ )
464
+ )
465
+ );
466
+ } else {
467
+ resultPromise = response2.json().then(
468
+ (json) => ok$2(json),
469
+ (reason) => err$1(toError(reason))
470
+ );
471
+ }
472
+ return resultPromise.finally(() => {
449
473
  try {
450
474
  this.afterRequestHooks({ statusCode: response2.status });
451
475
  } catch {
@@ -2763,7 +2787,7 @@ function buildServiceDescriptor$d(luvio) {
2763
2787
  },
2764
2788
  };
2765
2789
  }
2766
- // version: 1.428.0-dev21-133a7da4f5
2790
+ // version: 1.428.0-dev22-bfcb919e66
2767
2791
 
2768
2792
  /*!
2769
2793
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3116,7 +3140,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
3116
3140
  },
3117
3141
  };
3118
3142
  }
3119
- // version: 1.428.0-dev21-133a7da4f5
3143
+ // version: 1.428.0-dev22-bfcb919e66
3120
3144
 
3121
3145
  /*!
3122
3146
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3273,6 +3297,66 @@ function buildServiceDescriptor$8(defaultRetryPolicy) {
3273
3297
  };
3274
3298
  }
3275
3299
 
3300
+ function tagsEqual(a, b) {
3301
+ const keys = Object.keys(b);
3302
+ return (a !== undefined && keys.length === Object.keys(a).length && keys.every((k) => a[k] === b[k]));
3303
+ }
3304
+ // W-23092947: on Aura sites HTTP-to-core is broken, so withhold every `fetch` service
3305
+ // except those whose request tags are in `allowedFetchTags` (the external hosts). A
3306
+ // withheld optional fetch resolves to `undefined`, making `AuraNetworkCommand` use Aura.
3307
+ function buildAuraSiteServiceResolver(services, allowedFetchTags) {
3308
+ const staticResolver = buildStaticServiceResolver(services);
3309
+ const isWithheld = (req) => req.type === 'fetch' && !allowedFetchTags.some((allowed) => tagsEqual(req.tags, allowed));
3310
+ return (requested) => {
3311
+ const passthrough = {};
3312
+ const withheldUnresolved = [];
3313
+ for (const [name, req] of Object.entries(requested)) {
3314
+ if (!isWithheld(req)) {
3315
+ passthrough[name] = req;
3316
+ }
3317
+ else if (!('optional' in req && req.optional)) {
3318
+ withheldUnresolved.push(name);
3319
+ }
3320
+ }
3321
+ return staticResolver(passthrough).then(([resolved, unresolved]) => [
3322
+ resolved,
3323
+ [...unresolved, ...withheldUnresolved],
3324
+ ]);
3325
+ };
3326
+ }
3327
+
3328
+ /**
3329
+ * Helpers for reaching the Aura framework from the LDS Aura runtime.
3330
+ *
3331
+ * `window.$A` is only present when the runtime is hosted inside Aura (LEX or an
3332
+ * Aura site); in tests and non-Aura runtimes it is absent.
3333
+ */
3334
+ /**
3335
+ * Returns the Aura framework global (`window.$A`) when running inside Aura, or
3336
+ * `undefined` in tests and non-Aura runtimes. Never throws.
3337
+ */
3338
+ function getAura() {
3339
+ if (typeof window === 'undefined') {
3340
+ return undefined;
3341
+ }
3342
+ return window.$A;
3343
+ }
3344
+ /**
3345
+ * Returns `true` when the Aura runtime is hosted inside an Aura/Experience site
3346
+ * (Experience Builder / `communityApp`) rather than LEX (one.app).
3347
+ * `$A.get('$Site')` is present and truthy on Aura sites, absent/falsy in LEX. A
3348
+ * stable per-page signal. Defensive: never throws. (W-23092947)
3349
+ */
3350
+ function isAuraSite() {
3351
+ const aura = getAura();
3352
+ try {
3353
+ return !!aura?.get?.('$Site');
3354
+ }
3355
+ catch {
3356
+ return false;
3357
+ }
3358
+ }
3359
+
3276
3360
  /*!
3277
3361
  * Copyright (c) 2022, Salesforce, Inc.,
3278
3362
  * All rights reserved.
@@ -5992,7 +6076,7 @@ function getEnvironmentSetting(name) {
5992
6076
  }
5993
6077
  return undefined;
5994
6078
  }
5995
- // version: 1.428.0-dev21-133a7da4f5
6079
+ // version: 1.428.0-dev22-bfcb919e66
5996
6080
 
5997
6081
  const environmentHasAura = typeof window !== 'undefined' && typeof window.$A !== 'undefined';
5998
6082
  const defaultConfig = {
@@ -7369,10 +7453,9 @@ const DATA_360_CDP_URL_REWRITE_AUTH_SCOPE = 'data_360_cdp_url_rewrite';
7369
7453
  // The server's `SFAPJwtClaimHandlerImpl` emits it for CDP-provisioned orgs as a
7370
7454
  // verbatim passthrough of `DataCloudTenant.getApiEndpoint()` — no normalization.
7371
7455
  // The exact FORM therefore varies and must not be assumed: it may be a bare host
7372
- // (`<hash>.c360a.salesforce.com`) or a full URL with scheme
7373
- // (`https://a360.cdp.<region>.aws.sfdc.cl`), and the suffix is cloud-dependent
7374
- // (commercial `.salesforce.com`, substrate `.aws.sfdc.cl`, GovCloud
7375
- // `.salesforce.mil`). This is why the interceptor strips any scheme before parsing
7456
+ // (`<host>`) or a full URL with scheme (`<scheme>://<host>`), and the host suffix
7457
+ // (`<domain-suffix>`) is environment-dependent it differs per deployment
7458
+ // environment. This is why the interceptor strips any scheme before parsing
7376
7459
  // and applies no host-suffix policy — see the interceptor docblock's trust boundary.
7377
7460
  const CDP_URL_CLAIM = 'cdp_url';
7378
7461
  function buildDispatchingSfapJwtResolver(legacyResolver, parameterizedResolver) {
@@ -10984,6 +11067,13 @@ function initializeLDS() {
10984
11067
  }
10985
11068
  return luvio; // Return the luvio instance so that we can inject it for OneStore
10986
11069
  }
11070
+ // W-23092947: fetch request tags allowed to stay on HTTP on Aura sites (external hosts).
11071
+ // Everything else (core UIAPI/GraphQL) is withheld so it falls back to Aura transport.
11072
+ const AURA_SITE_ALLOWED_FETCH_TAGS = [
11073
+ { authenticationScopes: 'sfap_api' },
11074
+ { authenticationScopes: 'data_360_cdp_url_rewrite' },
11075
+ { specialHacksFor: 'copilot' }, // copilot
11076
+ ];
10987
11077
  // Initializes OneStore in LEX
10988
11078
  function initializeOneStore(luvio) {
10989
11079
  const loggerService = new ConsoleLogger('ERROR');
@@ -11071,7 +11161,13 @@ function initializeOneStore(luvio) {
11071
11161
  configServiceDescriptor,
11072
11162
  prefetchSfapJwtServiceDescriptor,
11073
11163
  ];
11074
- setServices(services);
11164
+ // W-23092947: Aura sites route core-bound commands over Aura (see the resolver).
11165
+ if (isAuraSite()) {
11166
+ setServiceResolver(buildAuraSiteServiceResolver(services, AURA_SITE_ALLOWED_FETCH_TAGS));
11167
+ }
11168
+ else {
11169
+ setServices(services);
11170
+ }
11075
11171
  }
11076
11172
  function buildAuraNetworkService() {
11077
11173
  return {
@@ -11089,4 +11185,4 @@ function ldsEngineCreator() {
11089
11185
  }
11090
11186
 
11091
11187
  export { LexRequestStrategy, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
11092
- // version: 1.428.0-dev21-c9faba50c9
11188
+ // version: 1.428.0-dev22-319313a317
@@ -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 {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Helpers for reaching the Aura framework from the LDS Aura runtime.
3
+ *
4
+ * `window.$A` is only present when the runtime is hosted inside Aura (LEX or an
5
+ * Aura site); in tests and non-Aura runtimes it is absent.
6
+ */
7
+ interface Aura {
8
+ get?: (expression: string) => unknown;
9
+ }
10
+ /**
11
+ * Returns the Aura framework global (`window.$A`) when running inside Aura, or
12
+ * `undefined` in tests and non-Aura runtimes. Never throws.
13
+ */
14
+ export declare function getAura(): Aura | undefined;
15
+ /**
16
+ * Returns `true` when the Aura runtime is hosted inside an Aura/Experience site
17
+ * (Experience Builder / `communityApp`) rather than LEX (one.app).
18
+ * `$A.get('$Site')` is present and truthy on Aura sites, absent/falsy in LEX. A
19
+ * stable per-page signal. Defensive: never throws. (W-23092947)
20
+ */
21
+ export declare function isAuraSite(): boolean;
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.428.0-dev21",
3
+ "version": "1.428.0-dev22",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,60 +34,60 @@
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.19.0-dev3",
38
- "@conduit-client/tools-core": "3.19.0-dev3",
39
- "@salesforce/lds-adapters-apex": "^1.428.0-dev21",
40
- "@salesforce/lds-adapters-uiapi": "^1.428.0-dev21",
41
- "@salesforce/lds-ads-bridge": "^1.428.0-dev21",
42
- "@salesforce/lds-aura-storage": "^1.428.0-dev21",
43
- "@salesforce/lds-bindings": "^1.428.0-dev21",
44
- "@salesforce/lds-instrumentation": "^1.428.0-dev21",
45
- "@salesforce/lds-network-aura": "^1.428.0-dev21",
46
- "@salesforce/lds-network-fetch": "^1.428.0-dev21",
37
+ "@conduit-client/service-provisioner": "3.19.0-dev4",
38
+ "@conduit-client/tools-core": "3.19.0-dev4",
39
+ "@salesforce/lds-adapters-apex": "^1.428.0-dev22",
40
+ "@salesforce/lds-adapters-uiapi": "^1.428.0-dev22",
41
+ "@salesforce/lds-ads-bridge": "^1.428.0-dev22",
42
+ "@salesforce/lds-aura-storage": "^1.428.0-dev22",
43
+ "@salesforce/lds-bindings": "^1.428.0-dev22",
44
+ "@salesforce/lds-instrumentation": "^1.428.0-dev22",
45
+ "@salesforce/lds-network-aura": "^1.428.0-dev22",
46
+ "@salesforce/lds-network-fetch": "^1.428.0-dev22",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@conduit-client/command-aura-graphql-normalized-cache-control": "3.19.0-dev3",
51
- "@conduit-client/command-aura-network": "3.19.0-dev3",
52
- "@conduit-client/command-aura-normalized-cache-control": "3.19.0-dev3",
53
- "@conduit-client/command-aura-resource-cache-control": "3.19.0-dev3",
54
- "@conduit-client/command-fetch-network": "3.19.0-dev3",
55
- "@conduit-client/command-http-graphql-normalized-cache-control": "3.19.0-dev3",
56
- "@conduit-client/command-http-normalized-cache-control": "3.19.0-dev3",
57
- "@conduit-client/command-ndjson": "3.19.0-dev3",
58
- "@conduit-client/command-network": "3.19.0-dev3",
59
- "@conduit-client/command-sse": "3.19.0-dev3",
60
- "@conduit-client/command-streaming": "3.19.0-dev3",
61
- "@conduit-client/jwt-manager": "3.19.0-dev3",
62
- "@conduit-client/service-aura-network": "3.19.0-dev3",
63
- "@conduit-client/service-bindings-imperative": "3.19.0-dev3",
64
- "@conduit-client/service-bindings-lwc": "3.19.0-dev3",
65
- "@conduit-client/service-cache": "3.19.0-dev3",
66
- "@conduit-client/service-cache-control": "3.19.0-dev3",
67
- "@conduit-client/service-cache-inclusion-policy": "3.19.0-dev3",
68
- "@conduit-client/service-config": "3.19.0-dev3",
69
- "@conduit-client/service-feature-flags": "3.19.0-dev3",
70
- "@conduit-client/service-fetch-network": "3.19.0-dev3",
71
- "@conduit-client/service-instrument-command": "3.19.0-dev3",
72
- "@conduit-client/service-pubsub": "3.19.0-dev3",
73
- "@conduit-client/service-store": "3.19.0-dev3",
74
- "@conduit-client/utils": "3.19.0-dev3",
50
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "3.19.0-dev4",
51
+ "@conduit-client/command-aura-network": "3.19.0-dev4",
52
+ "@conduit-client/command-aura-normalized-cache-control": "3.19.0-dev4",
53
+ "@conduit-client/command-aura-resource-cache-control": "3.19.0-dev4",
54
+ "@conduit-client/command-fetch-network": "3.19.0-dev4",
55
+ "@conduit-client/command-http-graphql-normalized-cache-control": "3.19.0-dev4",
56
+ "@conduit-client/command-http-normalized-cache-control": "3.19.0-dev4",
57
+ "@conduit-client/command-ndjson": "3.19.0-dev4",
58
+ "@conduit-client/command-network": "3.19.0-dev4",
59
+ "@conduit-client/command-sse": "3.19.0-dev4",
60
+ "@conduit-client/command-streaming": "3.19.0-dev4",
61
+ "@conduit-client/jwt-manager": "3.19.0-dev4",
62
+ "@conduit-client/service-aura-network": "3.19.0-dev4",
63
+ "@conduit-client/service-bindings-imperative": "3.19.0-dev4",
64
+ "@conduit-client/service-bindings-lwc": "3.19.0-dev4",
65
+ "@conduit-client/service-cache": "3.19.0-dev4",
66
+ "@conduit-client/service-cache-control": "3.19.0-dev4",
67
+ "@conduit-client/service-cache-inclusion-policy": "3.19.0-dev4",
68
+ "@conduit-client/service-config": "3.19.0-dev4",
69
+ "@conduit-client/service-feature-flags": "3.19.0-dev4",
70
+ "@conduit-client/service-fetch-network": "3.19.0-dev4",
71
+ "@conduit-client/service-instrument-command": "3.19.0-dev4",
72
+ "@conduit-client/service-pubsub": "3.19.0-dev4",
73
+ "@conduit-client/service-store": "3.19.0-dev4",
74
+ "@conduit-client/utils": "3.19.0-dev4",
75
75
  "@luvio/network-adapter-composable": "0.160.4-dev1",
76
76
  "@luvio/network-adapter-fetch": "0.160.4-dev1",
77
77
  "@lwc/state": "^0.29.0",
78
- "@salesforce/lds-adapters-onestore-graphql": "^1.428.0-dev21",
78
+ "@salesforce/lds-adapters-onestore-graphql": "^1.428.0-dev22",
79
79
  "@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
80
- "@salesforce/lds-durable-storage": "^1.428.0-dev21",
81
- "@salesforce/lds-luvio-service": "^1.428.0-dev21",
82
- "@salesforce/lds-luvio-uiapi-records-service": "^1.428.0-dev21"
80
+ "@salesforce/lds-durable-storage": "^1.428.0-dev22",
81
+ "@salesforce/lds-luvio-service": "^1.428.0-dev22",
82
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.428.0-dev22"
83
83
  },
84
84
  "luvioBundlesize": [
85
85
  {
86
86
  "path": "./dist/ldsEngineCreator.js",
87
87
  "maxSize": {
88
- "none": "410 kB",
88
+ "none": "413 kB",
89
89
  "min": "190 kB",
90
- "compressed": "71.5 kB"
90
+ "compressed": "73 kB"
91
91
  }
92
92
  }
93
93
  ],