@salesforce/lds-runtime-aura 1.391.0 → 1.393.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.391.0-763f006296
2440
+ // version: 1.393.0-94e6d2aef3
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.391.0-763f006296
2750
+ // version: 1.393.0-94e6d2aef3
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.391.0-763f006296
6252
+ // version: 1.393.0-94e6d2aef3
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,96 @@ 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 buildLexRuntime5xxStatusResponseInterceptor(logger) {
6501
+ return async (response) => {
6502
+ if (response.status >= 500 && response.status < 600) {
6503
+ logger.warn(`Received ${response.status} status code from LEX runtime service`);
6504
+ // Create an error object similar to Aura's current shape for system errors
6505
+ const error = {
6506
+ message: `Runtime Error: ${response.status} ${response.statusText}`,
6507
+ severity: 'ALERT',
6508
+ name: 'LEXRuntimeError',
6509
+ stack: null,
6510
+ handled: false,
6511
+ reported: false,
6512
+ };
6513
+ const evtArgs = {
6514
+ message: error.message,
6515
+ error: null,
6516
+ auraError: error,
6517
+ };
6518
+ // Fire the event asynchronously, similar to the legacy setTimeout pattern
6519
+ window.setTimeout(() => {
6520
+ dispatchGlobalEvent('markup://aura:systemError', evtArgs);
6521
+ }, 0);
6522
+ }
6523
+ return response;
6524
+ };
6525
+ }
6526
+ function buildLexRuntimeLuvio5xxStatusResponseInterceptor() {
6527
+ return async (response) => {
6528
+ if (response.status >= 500 && response.status < 600) {
6529
+ // Create an error object similar to Aura's current shape for system errors
6530
+ const error = {
6531
+ message: `Runtime Error: ${response.status} ${response.statusText}`,
6532
+ severity: 'ALERT',
6533
+ name: 'LEXRuntimeError',
6534
+ stack: null,
6535
+ handled: false,
6536
+ reported: false,
6537
+ };
6538
+ const evtArgs = {
6539
+ message: error.message,
6540
+ error: null,
6541
+ auraError: error,
6542
+ };
6543
+ // Fire the event asynchronously, similar to the legacy setTimeout pattern
6544
+ window.setTimeout(() => {
6545
+ dispatchGlobalEvent('markup://aura:systemError', evtArgs);
6546
+ }, 0);
6547
+ }
6548
+ return response;
6549
+ };
6550
+ }
6551
+
6466
6552
  const API_PATHS = [
6467
6553
  // getLookupActions
6468
6554
  // '/ui-api/actions/lookup/{objectApiNames}',
6469
6555
  // getRecordActions
6470
- '/ui-api/actions/record/{recordIds}',
6556
+ // '/ui-api/actions/record/{recordIds}',
6471
6557
  // getRelatedListActions
6472
6558
  // '/ui-api/actions/record/{recordIds}/related-list/{relatedListId}',
6473
6559
  // getDuplicateConfiguration
@@ -6485,9 +6571,9 @@ const API_PATHS = [
6485
6571
  // getDuplicates
6486
6572
  // '/ui-api/predupe',
6487
6573
  // getRecord
6488
- '/ui-api/records/{recordId}',
6574
+ // '/ui-api/records/{recordId}',
6489
6575
  // getRecordUi
6490
- '/ui-api/record-ui/{recordIds}',
6576
+ // '/ui-api/record-ui/{recordIds}',
6491
6577
  // getRelatedListInfo
6492
6578
  // '/ui-api/related-list-info/{parentObjectApiName}/{relatedListId}',
6493
6579
  // getRelatedListRecords
@@ -6521,15 +6607,34 @@ const composedFetchNetworkAdapter = {
6521
6607
  }
6522
6608
  return API_PATH_MATCHERS.some((matcher) => matcher.test(path));
6523
6609
  },
6524
- adapter: setupLexNetworkAdapter(requestTracker, requestLogger),
6610
+ adapter: setupLexNetworkAdapter(requestTracker, requestLogger, {
6611
+ request: [],
6612
+ response: [
6613
+ buildLexRuntimeLuvio5xxStatusResponseInterceptor(),
6614
+ buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(),
6615
+ ],
6616
+ }),
6525
6617
  };
6526
6618
 
6619
+ function shouldUseHttp() {
6620
+ // Check if we're in One Runtime (has LWR set)
6621
+ const isOneRuntime = !!globalThis.LWR;
6622
+ // If we're in One Runtime and the One Runtime gate is open, use HTTP
6623
+ if (isOneRuntime && useHttpUiapiOneRuntime.isOpen({ fallback: false })) {
6624
+ return true;
6625
+ }
6626
+ // If we're in one.app and the one.app gate is open, use HTTP
6627
+ if (!isOneRuntime && useHttpUiapiOneApp.isOpen({ fallback: false })) {
6628
+ return true;
6629
+ }
6630
+ return false;
6631
+ }
6527
6632
  function getComposedAdapters() {
6528
6633
  const composedAdapters = [
6529
6634
  composedNetworkAdapter$1, // SFAP adapter
6530
6635
  ];
6531
- if (useHttpInsteadAuraTransport.isOpen({ fallback: false })) {
6532
- composedAdapters.push(composedFetchNetworkAdapter); // UIAPI Fetch adapter?
6636
+ if (shouldUseHttp()) {
6637
+ composedAdapters.push(composedFetchNetworkAdapter); // UIAPI Fetch adapter
6533
6638
  }
6534
6639
  return composedAdapters;
6535
6640
  }
@@ -6846,39 +6951,26 @@ function buildInMemoryCacheInclusionPolicyService(cache) {
6846
6951
  };
6847
6952
  }
6848
6953
 
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
- function buildLexRuntimeFetchServiceDescriptor(logger) {
6954
+ function buildLexRuntimeDefaultFetchServiceDescriptor(logger) {
6871
6955
  const fetchService = buildServiceDescriptor({
6872
6956
  request: [],
6873
6957
  response: [
6874
- // TODO: Revisit after ADR for 5xx error propagation in W-19363628
6875
- // buildLexRuntime5xxStatusResponseInterceptor(logger),
6958
+ buildLexRuntime5xxStatusResponseInterceptor(logger),
6876
6959
  buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger),
6877
6960
  ],
6878
6961
  });
6879
6962
  return {
6880
6963
  ...fetchService,
6881
- tags: { runtimeInterceptors: 'lex_runtime_interceptors' },
6964
+ };
6965
+ }
6966
+ function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger) {
6967
+ const fetchService = buildServiceDescriptor({
6968
+ request: [],
6969
+ response: [buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger)],
6970
+ });
6971
+ return {
6972
+ ...fetchService,
6973
+ tags: { interceptors: 'allow_500s' },
6882
6974
  };
6883
6975
  }
6884
6976
 
@@ -7187,7 +7279,8 @@ function initializeOneStore(luvio) {
7187
7279
  buildServiceDescriptor$g(),
7188
7280
  buildServiceDescriptor$f(),
7189
7281
  buildServiceDescriptor$7(),
7190
- buildLexRuntimeFetchServiceDescriptor(loggerService),
7282
+ buildLexRuntimeDefaultFetchServiceDescriptor(loggerService),
7283
+ buildLexRuntimeAllow5xxFetchServiceDescriptor(loggerService),
7191
7284
  buildServiceDescriptor$5(luvio),
7192
7285
  luvioUiapiRecordsServiceDescriptor,
7193
7286
  buildServiceDescriptor$4(),
@@ -7212,4 +7305,4 @@ function ldsEngineCreator() {
7212
7305
  }
7213
7306
 
7214
7307
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7215
- // version: 1.391.0-192e7f2c41
7308
+ // version: 1.393.0-fe4eaa97f2
@@ -0,0 +1,4 @@
1
+ import { type LoggerService } from '@luvio/utils';
2
+ import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
3
+ export declare function buildLexRuntimeDefaultFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
4
+ export declare function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
@@ -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.391.0",
3
+ "version": "1.393.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.391.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.391.0",
41
- "@salesforce/lds-ads-bridge": "^1.391.0",
42
- "@salesforce/lds-aura-storage": "^1.391.0",
43
- "@salesforce/lds-bindings": "^1.391.0",
44
- "@salesforce/lds-instrumentation": "^1.391.0",
45
- "@salesforce/lds-network-aura": "^1.391.0",
46
- "@salesforce/lds-network-fetch": "^1.391.0",
39
+ "@salesforce/lds-adapters-apex": "^1.393.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.393.0",
41
+ "@salesforce/lds-ads-bridge": "^1.393.0",
42
+ "@salesforce/lds-aura-storage": "^1.393.0",
43
+ "@salesforce/lds-bindings": "^1.393.0",
44
+ "@salesforce/lds-instrumentation": "^1.393.0",
45
+ "@salesforce/lds-network-aura": "^1.393.0",
46
+ "@salesforce/lds-network-fetch": "^1.393.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.391.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.391.0",
76
- "@salesforce/lds-luvio-service": "^1.391.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.391.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.393.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.393.0",
76
+ "@salesforce/lds-luvio-service": "^1.393.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.393.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {
@@ -1,3 +0,0 @@
1
- import { type LoggerService } from '@luvio/utils';
2
- import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
3
- export declare function buildLexRuntimeFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;