@salesforce/lds-runtime-aura 1.390.0 → 1.392.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.
@@ -28,7 +28,7 @@ import { getInstrumentation } from 'o11y/client';
28
28
  import { buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
29
29
  import { print } from 'force/luvioOnestoreGraphqlParser';
30
30
  import { setServices } from 'force/luvioServiceProvisioner1';
31
- import { unstable_loadComponentDefs, executeGlobalControllerRawResponse } from 'aura';
31
+ import { unstable_loadComponentDefs, 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';
33
33
  import { LRUCache, instrumentAdapter, instrumentLuvio, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, logError, setLdsNetworkAdapterInstrumentation, incrementStateCreatedCount, executeAsyncActivity, METRIC_KEYS, onIdleDetected } from 'force/ldsInstrumentation';
34
34
  import { REFRESH_ADAPTER_EVENT, ADAPTER_UNFULFILLED_ERROR, instrument as instrument$3 } from 'force/ldsBindings';
@@ -39,8 +39,9 @@ import { instrument as instrument$5 } from '@lwc/state';
39
39
  import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
40
40
  import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
41
41
  import { createStorage, clearStorages } from 'force/ldsStorage';
42
- import useHttpInsteadAuraTransport from '@salesforce/gate/lds.useHttpInsteadAuraTransport';
43
- import { ThirdPartyTracker } from 'instrumentation:beaconLib';
42
+ import useHttpUiapiOneApp from '@salesforce/gate/lds.useHttpUiapiOneApp';
43
+ import useHttpUiapiOneRuntime from '@salesforce/gate/lds.useHttpUiapiOneRuntime';
44
+ import { ThirdPartyTracker } from 'instrumentation:thirdPartyTracker';
44
45
 
45
46
  /*!
46
47
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2436,7 +2437,7 @@ function buildServiceDescriptor$5(luvio) {
2436
2437
  },
2437
2438
  };
2438
2439
  }
2439
- // version: 1.390.0-f59f485c2e
2440
+ // version: 1.392.0-3cd2606b7f
2440
2441
 
2441
2442
  /*!
2442
2443
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2746,7 +2747,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
2746
2747
  },
2747
2748
  };
2748
2749
  }
2749
- // version: 1.390.0-f59f485c2e
2750
+ // version: 1.392.0-3cd2606b7f
2750
2751
 
2751
2752
  /*!
2752
2753
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -6248,7 +6249,7 @@ function getEnvironmentSetting(name) {
6248
6249
  }
6249
6250
  return undefined;
6250
6251
  }
6251
- // version: 1.390.0-f59f485c2e
6252
+ // version: 1.392.0-3cd2606b7f
6252
6253
 
6253
6254
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
6254
6255
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6463,11 +6464,70 @@ function setRejectConfig(request, error) {
6463
6464
  };
6464
6465
  }
6465
6466
 
6467
+ function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger) {
6468
+ return async (response) => {
6469
+ if (response.status === 401) {
6470
+ try {
6471
+ const coercedResponse = (await coerceResponseToFetchResponse(response.clone()));
6472
+ if (coercedResponse.body.errorCode === 'INVALID_SESSION_ID') {
6473
+ logger.warn(`Received ${response.status} status code from LEX runtime service`);
6474
+ // Fire the event asynchronously, similar to the legacy setTimeout pattern
6475
+ window.setTimeout(() => {
6476
+ dispatchGlobalEvent('aura:invalidSession');
6477
+ }, 0);
6478
+ }
6479
+ }
6480
+ catch (error) {
6481
+ logger.warn(`Error parsing response from LEX runtime service: ${error}`);
6482
+ }
6483
+ }
6484
+ return response;
6485
+ };
6486
+ }
6487
+ function buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor() {
6488
+ return async (response) => {
6489
+ if (response.status === 401) {
6490
+ if (response.body.errorCode === 'INVALID_SESSION_ID') {
6491
+ window.setTimeout(() => {
6492
+ dispatchGlobalEvent('aura:invalidSession');
6493
+ }, 0);
6494
+ }
6495
+ }
6496
+ return response;
6497
+ };
6498
+ }
6499
+
6500
+ function buildLexRuntimeLuvio5xxStatusResponseInterceptor() {
6501
+ return async (response) => {
6502
+ if (response.status >= 500 && response.status < 600) {
6503
+ // Create an error object similar to Aura's current shape for system errors
6504
+ const error = {
6505
+ message: `Runtime Error: ${response.status} ${response.statusText}`,
6506
+ severity: 'ALERT',
6507
+ name: 'LEXRuntimeError',
6508
+ stack: null,
6509
+ handled: false,
6510
+ reported: false,
6511
+ };
6512
+ const evtArgs = {
6513
+ message: error.message,
6514
+ error: null,
6515
+ auraError: error,
6516
+ };
6517
+ // Fire the event asynchronously, similar to the legacy setTimeout pattern
6518
+ window.setTimeout(() => {
6519
+ dispatchGlobalEvent('markup://aura:systemError', evtArgs);
6520
+ }, 0);
6521
+ }
6522
+ return response;
6523
+ };
6524
+ }
6525
+
6466
6526
  const API_PATHS = [
6467
6527
  // getLookupActions
6468
6528
  // '/ui-api/actions/lookup/{objectApiNames}',
6469
6529
  // getRecordActions
6470
- '/ui-api/actions/record/{recordIds}',
6530
+ // '/ui-api/actions/record/{recordIds}',
6471
6531
  // getRelatedListActions
6472
6532
  // '/ui-api/actions/record/{recordIds}/related-list/{relatedListId}',
6473
6533
  // getDuplicateConfiguration
@@ -6485,9 +6545,9 @@ const API_PATHS = [
6485
6545
  // getDuplicates
6486
6546
  // '/ui-api/predupe',
6487
6547
  // getRecord
6488
- '/ui-api/records/{recordId}',
6548
+ // '/ui-api/records/{recordId}',
6489
6549
  // getRecordUi
6490
- '/ui-api/record-ui/{recordIds}',
6550
+ // '/ui-api/record-ui/{recordIds}',
6491
6551
  // getRelatedListInfo
6492
6552
  // '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
6493
6553
  // getRelatedListRecords
@@ -6521,15 +6581,34 @@ const composedFetchNetworkAdapter = {
6521
6581
  }
6522
6582
  return API_PATH_MATCHERS.some((matcher) => matcher.test(path));
6523
6583
  },
6524
- adapter: setupLexNetworkAdapter(requestTracker, requestLogger),
6584
+ adapter: setupLexNetworkAdapter(requestTracker, requestLogger, {
6585
+ request: [],
6586
+ response: [
6587
+ buildLexRuntimeLuvio5xxStatusResponseInterceptor(),
6588
+ buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(),
6589
+ ],
6590
+ }),
6525
6591
  };
6526
6592
 
6593
+ function shouldUseHttp() {
6594
+ // Check if we're in One Runtime (has LWR set)
6595
+ const isOneRuntime = !!globalThis.LWR;
6596
+ // If we're in One Runtime and the One Runtime gate is open, use HTTP
6597
+ if (isOneRuntime && useHttpUiapiOneRuntime.isOpen({ fallback: false })) {
6598
+ return true;
6599
+ }
6600
+ // If we're in one.app and the one.app gate is open, use HTTP
6601
+ if (!isOneRuntime && useHttpUiapiOneApp.isOpen({ fallback: false })) {
6602
+ return true;
6603
+ }
6604
+ return false;
6605
+ }
6527
6606
  function getComposedAdapters() {
6528
6607
  const composedAdapters = [
6529
6608
  composedNetworkAdapter$1, // SFAP adapter
6530
6609
  ];
6531
- if (useHttpInsteadAuraTransport.isOpen({ fallback: false })) {
6532
- composedAdapters.push(composedFetchNetworkAdapter); // UIAPI Fetch adapter?
6610
+ if (shouldUseHttp()) {
6611
+ composedAdapters.push(composedFetchNetworkAdapter); // UIAPI Fetch adapter
6533
6612
  }
6534
6613
  return composedAdapters;
6535
6614
  }
@@ -6846,27 +6925,6 @@ function buildInMemoryCacheInclusionPolicyService(cache) {
6846
6925
  };
6847
6926
  }
6848
6927
 
6849
- function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger) {
6850
- return async (response) => {
6851
- if (response.status === 401) {
6852
- try {
6853
- const coercedResponse = (await coerceResponseToFetchResponse(response.clone()));
6854
- if (coercedResponse.body.errorCode === 'INVALID_SESSION_ID') {
6855
- logger.warn(`Received ${response.status} status code from LEX runtime service`);
6856
- // Fire the event asynchronously, similar to the legacy setTimeout pattern
6857
- window.setTimeout(() => {
6858
- window?.$A?.get('e.aura:invalidSession').fire();
6859
- }, 0);
6860
- }
6861
- }
6862
- catch (error) {
6863
- logger.warn(`Error parsing response from LEX runtime service: ${error}`);
6864
- }
6865
- }
6866
- return response;
6867
- };
6868
- }
6869
-
6870
6928
  function buildLexRuntimeFetchServiceDescriptor(logger) {
6871
6929
  const fetchService = buildServiceDescriptor({
6872
6930
  request: [],
@@ -7212,4 +7270,4 @@ function ldsEngineCreator() {
7212
7270
  }
7213
7271
 
7214
7272
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7215
- // version: 1.390.0-40592e6d97
7273
+ // version: 1.392.0-620a222fbc
@@ -1,5 +1,6 @@
1
1
  import { LoggerService } from '@luvio/utils';
2
2
  import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
3
+ import { ResponseInterceptor as LuvioResponseInterceptor } from '@salesforce/lds-network-fetch';
3
4
  export type LexRuntimeError = {
4
5
  message: string;
5
6
  severity: string;
@@ -14,3 +15,4 @@ export type LexErrorEventArgs = {
14
15
  auraError: LexRuntimeError;
15
16
  };
16
17
  export declare function buildLexRuntime5xxStatusResponseInterceptor(logger: LoggerService): ResponseInterceptor;
18
+ export declare function buildLexRuntimeLuvio5xxStatusResponseInterceptor(): LuvioResponseInterceptor;
@@ -1,3 +1,5 @@
1
1
  import { LoggerService } from '@luvio/utils';
2
2
  import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
3
+ import { ResponseInterceptor as LuvioResponseInterceptor } from '@salesforce/lds-network-fetch';
3
4
  export declare function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger: LoggerService): ResponseInterceptor;
5
+ export declare function buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(): LuvioResponseInterceptor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.390.0",
3
+ "version": "1.392.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -36,14 +36,14 @@
36
36
  "devDependencies": {
37
37
  "@luvio/service-provisioner": "5.62.0",
38
38
  "@luvio/tools-core": "5.62.0",
39
- "@salesforce/lds-adapters-apex": "^1.390.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.390.0",
41
- "@salesforce/lds-ads-bridge": "^1.390.0",
42
- "@salesforce/lds-aura-storage": "^1.390.0",
43
- "@salesforce/lds-bindings": "^1.390.0",
44
- "@salesforce/lds-instrumentation": "^1.390.0",
45
- "@salesforce/lds-network-aura": "^1.390.0",
46
- "@salesforce/lds-network-fetch": "^1.390.0",
39
+ "@salesforce/lds-adapters-apex": "^1.392.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.392.0",
41
+ "@salesforce/lds-ads-bridge": "^1.392.0",
42
+ "@salesforce/lds-aura-storage": "^1.392.0",
43
+ "@salesforce/lds-bindings": "^1.392.0",
44
+ "@salesforce/lds-instrumentation": "^1.392.0",
45
+ "@salesforce/lds-network-aura": "^1.392.0",
46
+ "@salesforce/lds-network-fetch": "^1.392.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
@@ -71,10 +71,10 @@
71
71
  "@luvio/service-store": "5.62.0",
72
72
  "@luvio/utils": "5.62.0",
73
73
  "@lwc/state": "^0.23.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.390.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.390.0",
76
- "@salesforce/lds-luvio-service": "^1.390.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.390.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.392.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.392.0",
76
+ "@salesforce/lds-luvio-service": "^1.392.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.392.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {