@salesforce/lds-runtime-aura 1.387.0 → 1.388.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.
@@ -228,6 +228,19 @@ var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
228
228
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
229
229
  return HttpStatusCode2;
230
230
  })(HttpStatusCode$1 || {});
231
+ async function coerceResponseToFetchResponse(response) {
232
+ const { status } = response;
233
+ const responseHeaders = {};
234
+ response.headers.forEach((value, key) => {
235
+ responseHeaders[key] = value;
236
+ });
237
+ let responseBody = null;
238
+ if (status !== 204) {
239
+ const contentType = responseHeaders["content-type"];
240
+ responseBody = contentType && contentType.startsWith("application/json") ? await response.json() : await response.text();
241
+ }
242
+ return new FetchResponse(status, responseBody, responseHeaders);
243
+ }
231
244
  function getStatusText(status) {
232
245
  switch (status) {
233
246
  case 200:
@@ -775,7 +788,7 @@ class CacheControlCommand extends BaseCommand {
775
788
  */
776
789
  buildSubscribe() {
777
790
  return (consumerCallback) => {
778
- if (this.subscriptions.length === 0 && this.operationType === "query") {
791
+ if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
779
792
  this.subscribeToKeysUsed();
780
793
  }
781
794
  this.subscriptions.push(consumerCallback);
@@ -2423,7 +2436,7 @@ function buildServiceDescriptor$5(luvio) {
2423
2436
  },
2424
2437
  };
2425
2438
  }
2426
- // version: 1.387.0-1c34f8f965
2439
+ // version: 1.388.0-fabb0e5a71
2427
2440
 
2428
2441
  /*!
2429
2442
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -2733,7 +2746,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
2733
2746
  },
2734
2747
  };
2735
2748
  }
2736
- // version: 1.387.0-1c34f8f965
2749
+ // version: 1.388.0-fabb0e5a71
2737
2750
 
2738
2751
  /*!
2739
2752
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -6235,7 +6248,7 @@ function getEnvironmentSetting(name) {
6235
6248
  }
6236
6249
  return undefined;
6237
6250
  }
6238
- // version: 1.387.0-1c34f8f965
6251
+ // version: 1.388.0-fabb0e5a71
6239
6252
 
6240
6253
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
6241
6254
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6833,44 +6846,41 @@ function buildInMemoryCacheInclusionPolicyService(cache) {
6833
6846
  };
6834
6847
  }
6835
6848
 
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
+
6836
6870
  function buildLexRuntimeFetchServiceDescriptor(logger) {
6837
6871
  const fetchService = buildServiceDescriptor({
6838
6872
  request: [],
6839
- response: [buildLexRuntimeResponseInterceptor(logger)],
6873
+ response: [
6874
+ // TODO: Revisit after ADR for 5xx error propagation in W-19363628
6875
+ // buildLexRuntime5xxStatusResponseInterceptor(logger),
6876
+ buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger),
6877
+ ],
6840
6878
  });
6841
6879
  return {
6842
6880
  ...fetchService,
6843
6881
  tags: { runtimeInterceptors: 'lex_runtime_interceptors' },
6844
6882
  };
6845
6883
  }
6846
- function buildLexRuntimeResponseInterceptor(logger) {
6847
- return async (response) => {
6848
- if (response.status >= 500 && response.status < 600) {
6849
- logger.warn(`Received ${response.status} status code from LEX runtime service`);
6850
- // Create an error object similar to Aura's current shape for system errors
6851
- const error = {
6852
- message: `Runtime Error: ${response.status} ${response.statusText}`,
6853
- severity: 'ALERT',
6854
- name: 'LEXRuntimeError',
6855
- stack: null,
6856
- handled: false,
6857
- reported: false,
6858
- };
6859
- const evtArgs = {
6860
- message: error.message,
6861
- error: null,
6862
- auraError: error,
6863
- };
6864
- // Fire the event asynchronously, similar to the legacy setTimeout pattern
6865
- window.setTimeout(() => {
6866
- if (window && window.$A && window.$A.eventService) {
6867
- window.$A.eventService.getNewEvent('markup://aura:systemError').fire(evtArgs);
6868
- }
6869
- }, 0);
6870
- }
6871
- return response;
6872
- };
6873
- }
6874
6884
 
6875
6885
  // This code *should* be in lds-network-adapter, but when combined with the Aura
6876
6886
  // component test workaround in lds-default-luvio it creates a circular dependecy
@@ -7202,4 +7212,4 @@ function ldsEngineCreator() {
7202
7212
  }
7203
7213
 
7204
7214
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7205
- // version: 1.387.0-8c93a5dd2c
7215
+ // version: 1.388.0-d914c9e6b5
@@ -1,17 +1,3 @@
1
1
  import { type LoggerService } from '@luvio/utils';
2
- import { type FetchServiceDescriptor, type ResponseInterceptor } from '@luvio/service-fetch-network/v1';
3
- export type LexRuntimeError = {
4
- message: string;
5
- severity: string;
6
- name: string;
7
- stack: string | null;
8
- handled: boolean;
9
- reported: boolean;
10
- };
11
- export type LexErrorEventArgs = {
12
- message: string;
13
- error: string | null;
14
- auraError: LexRuntimeError;
15
- };
2
+ import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
16
3
  export declare function buildLexRuntimeFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
17
- export declare function buildLexRuntimeResponseInterceptor(logger: LoggerService): ResponseInterceptor;
@@ -0,0 +1,16 @@
1
+ import { LoggerService } from '@luvio/utils';
2
+ import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
3
+ export type LexRuntimeError = {
4
+ message: string;
5
+ severity: string;
6
+ name: string;
7
+ stack: string | null;
8
+ handled: boolean;
9
+ reported: boolean;
10
+ };
11
+ export type LexErrorEventArgs = {
12
+ message: string;
13
+ error: string | null;
14
+ auraError: LexRuntimeError;
15
+ };
16
+ export declare function buildLexRuntime5xxStatusResponseInterceptor(logger: LoggerService): ResponseInterceptor;
@@ -0,0 +1,3 @@
1
+ import { LoggerService } from '@luvio/utils';
2
+ import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
3
+ export declare function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger: LoggerService): ResponseInterceptor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.387.0",
3
+ "version": "1.388.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,47 +34,47 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@luvio/service-provisioner": "5.60.0",
38
- "@luvio/tools-core": "5.60.0",
39
- "@salesforce/lds-adapters-apex": "^1.387.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.387.0",
41
- "@salesforce/lds-ads-bridge": "^1.387.0",
42
- "@salesforce/lds-aura-storage": "^1.387.0",
43
- "@salesforce/lds-bindings": "^1.387.0",
44
- "@salesforce/lds-instrumentation": "^1.387.0",
45
- "@salesforce/lds-network-aura": "^1.387.0",
46
- "@salesforce/lds-network-fetch": "^1.387.0",
37
+ "@luvio/service-provisioner": "5.61.0",
38
+ "@luvio/tools-core": "5.61.0",
39
+ "@salesforce/lds-adapters-apex": "^1.388.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.388.0",
41
+ "@salesforce/lds-ads-bridge": "^1.388.0",
42
+ "@salesforce/lds-aura-storage": "^1.388.0",
43
+ "@salesforce/lds-bindings": "^1.388.0",
44
+ "@salesforce/lds-instrumentation": "^1.388.0",
45
+ "@salesforce/lds-network-aura": "^1.388.0",
46
+ "@salesforce/lds-network-fetch": "^1.388.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-graphql-normalized-cache-control": "5.60.0",
51
- "@luvio/command-aura-network": "5.60.0",
52
- "@luvio/command-aura-normalized-cache-control": "5.60.0",
53
- "@luvio/command-aura-resource-cache-control": "5.60.0",
54
- "@luvio/command-fetch-network": "5.60.0",
55
- "@luvio/command-http-graphql-normalized-cache-control": "5.60.0",
56
- "@luvio/command-http-normalized-cache-control": "5.60.0",
57
- "@luvio/command-ndjson": "5.60.0",
58
- "@luvio/command-network": "5.60.0",
59
- "@luvio/command-sse": "5.60.0",
60
- "@luvio/command-streaming": "5.60.0",
50
+ "@luvio/command-aura-graphql-normalized-cache-control": "5.61.0",
51
+ "@luvio/command-aura-network": "5.61.0",
52
+ "@luvio/command-aura-normalized-cache-control": "5.61.0",
53
+ "@luvio/command-aura-resource-cache-control": "5.61.0",
54
+ "@luvio/command-fetch-network": "5.61.0",
55
+ "@luvio/command-http-graphql-normalized-cache-control": "5.61.0",
56
+ "@luvio/command-http-normalized-cache-control": "5.61.0",
57
+ "@luvio/command-ndjson": "5.61.0",
58
+ "@luvio/command-network": "5.61.0",
59
+ "@luvio/command-sse": "5.61.0",
60
+ "@luvio/command-streaming": "5.61.0",
61
61
  "@luvio/network-adapter-composable": "0.158.7",
62
62
  "@luvio/network-adapter-fetch": "0.158.7",
63
- "@luvio/service-aura-network": "5.60.0",
64
- "@luvio/service-cache": "5.60.0",
65
- "@luvio/service-cache-control": "5.60.0",
66
- "@luvio/service-cache-inclusion-policy": "5.60.0",
67
- "@luvio/service-feature-flags": "5.60.0",
68
- "@luvio/service-fetch-network": "5.60.0",
69
- "@luvio/service-instrument-command": "5.60.0",
70
- "@luvio/service-pubsub": "5.60.0",
71
- "@luvio/service-store": "5.60.0",
72
- "@luvio/utils": "5.60.0",
63
+ "@luvio/service-aura-network": "5.61.0",
64
+ "@luvio/service-cache": "5.61.0",
65
+ "@luvio/service-cache-control": "5.61.0",
66
+ "@luvio/service-cache-inclusion-policy": "5.61.0",
67
+ "@luvio/service-feature-flags": "5.61.0",
68
+ "@luvio/service-fetch-network": "5.61.0",
69
+ "@luvio/service-instrument-command": "5.61.0",
70
+ "@luvio/service-pubsub": "5.61.0",
71
+ "@luvio/service-store": "5.61.0",
72
+ "@luvio/utils": "5.61.0",
73
73
  "@lwc/state": "^0.23.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.387.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.387.0",
76
- "@salesforce/lds-luvio-service": "^1.387.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.387.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.388.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.388.0",
76
+ "@salesforce/lds-luvio-service": "^1.388.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.388.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {