@salesforce/lds-runtime-aura 1.398.0 → 1.400.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.
@@ -1674,6 +1674,7 @@ function buildInstrumentCommand(services) {
1674
1674
  return function instrumentCommand(commandClass, commandName) {
1675
1675
  const invocationCounter = meter.createCounter(`${commandName}.command.invocation.count`);
1676
1676
  const errorCounter = meter.createCounter(`${commandName}.command.error.count`);
1677
+ const abortCounter = meter.createCounter(`${commandName}.command.abort.count`);
1677
1678
  const durationHistogram = meter.createHistogram(`${commandName}.command.duration`);
1678
1679
  return class extends commandClass {
1679
1680
  execute(...args) {
@@ -1687,7 +1688,11 @@ function buildInstrumentCommand(services) {
1687
1688
  try {
1688
1689
  result = super.execute(...args);
1689
1690
  } catch (e) {
1690
- errorCounter.add(1);
1691
+ if ((e == null ? void 0 : e.name) === "AbortError") {
1692
+ abortCounter.add(1);
1693
+ } else {
1694
+ errorCounter.add(1);
1695
+ }
1691
1696
  throw e;
1692
1697
  }
1693
1698
  if (typeof result === "object" && result !== null && "then" in result) {
@@ -2671,7 +2676,7 @@ function buildServiceDescriptor$5(luvio) {
2671
2676
  },
2672
2677
  };
2673
2678
  }
2674
- // version: 1.398.0-ada864f72d
2679
+ // version: 1.400.0-3c7514a502
2675
2680
 
2676
2681
  /*!
2677
2682
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3009,7 +3014,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
3009
3014
  },
3010
3015
  };
3011
3016
  }
3012
- // version: 1.398.0-ada864f72d
3017
+ // version: 1.400.0-3c7514a502
3013
3018
 
3014
3019
  /*!
3015
3020
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3793,18 +3798,96 @@ function buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor() {
3793
3798
  };
3794
3799
  }
3795
3800
 
3801
+ /**
3802
+ * Extracts the ErrorId from a server error response message.
3803
+ * Looks for pattern: "ErrorId if you contact support: 1033627214-37969 (-1272663771)"
3804
+ * Returns the numeric value in parentheses.
3805
+ *
3806
+ * @param responseBody The response body text to parse.
3807
+ * @returns The extracted error ID, or null if not found.
3808
+ */
3809
+ function extractErrorIdFromResponse(responseBody) {
3810
+ try {
3811
+ const parsed = JSON.parse(responseBody);
3812
+ if (Array.isArray(parsed) && parsed.length > 0 && parsed[0].message) {
3813
+ const message = parsed[0].message;
3814
+ // Look for pattern: "ErrorId if you contact support: XXXXXX-XXXXX (YYYYY)"
3815
+ const match = message.match(/ErrorId[^:]*:\s*[\d-]+\s*\((-?\d+)\)/);
3816
+ if (match && match[1]) {
3817
+ return parseInt(match[1], 10);
3818
+ }
3819
+ }
3820
+ }
3821
+ catch (e) {
3822
+ // If parsing fails, return null to use fallback
3823
+ }
3824
+ return null;
3825
+ }
3826
+ /**
3827
+ * Generates a unique error ID for tracking specific error occurrences.
3828
+ * Used as fallback when server doesn't provide an ErrorId.
3829
+ *
3830
+ * @param idInput The input value to hash.
3831
+ * @returns A unique error ID in Salesforce-compatible numeric format.
3832
+ */
3833
+ function generateErrorId(idInput) {
3834
+ let hash = 0;
3835
+ if (!idInput || idInput.length === 0) {
3836
+ return hash;
3837
+ }
3838
+ let i, chr;
3839
+ for (i = 0; i < idInput.length; i++) {
3840
+ chr = idInput.charCodeAt(i);
3841
+ hash = (hash << 5) - hash + chr;
3842
+ hash |= 0; // Convert to 32bit integer
3843
+ }
3844
+ return hash;
3845
+ }
3846
+ /**
3847
+ * Gets error ID from response body or generates a fallback.
3848
+ * Tries to extract server-provided ErrorId first, falls back to generated hash.
3849
+ *
3850
+ * @param responseBody The response body to parse.
3851
+ * @param status The HTTP status code (for fallback).
3852
+ * @param statusText The HTTP status text (for fallback, optional).
3853
+ * @returns A numeric error ID.
3854
+ */
3855
+ function getOrGenerateErrorId(responseBody, status, statusText) {
3856
+ const extractedId = extractErrorIdFromResponse(responseBody);
3857
+ if (extractedId !== null) {
3858
+ return extractedId;
3859
+ }
3860
+ // Fallback to generated error ID using status and timestamp
3861
+ // statusText is optional and may not always be present
3862
+ const context = [status, statusText || '', Date.now()].join('|');
3863
+ return generateErrorId(context);
3864
+ }
3796
3865
  function buildLexRuntime5xxStatusResponseInterceptor(logger) {
3797
3866
  return async (response) => {
3798
3867
  if (response.status >= 500 && response.status < 600) {
3799
- logger.warn(`Received ${response.status} status code from LEX runtime service`);
3868
+ const internalLogMessage = `LEX runtime 5xx: ${response.status} ${response.statusText || ''}`.trim();
3869
+ logger.warn(internalLogMessage);
3870
+ const userMessage = 'A server error occurred. Please try again later.';
3871
+ // Try to extract ErrorId from response body, fallback to generated ID
3872
+ let errorId;
3873
+ try {
3874
+ const responseText = await response.clone().text();
3875
+ errorId = getOrGenerateErrorId(responseText, response.status, response.statusText);
3876
+ }
3877
+ catch (e) {
3878
+ // If reading response fails, use fallback
3879
+ const context = [response.status, response.statusText, Date.now()].join('|');
3880
+ errorId = generateErrorId(context);
3881
+ }
3800
3882
  // Create an error object similar to Aura's current shape for system errors
3801
3883
  const error = {
3802
- message: `Runtime Error: ${response.status} ${response.statusText}`,
3884
+ message: userMessage,
3803
3885
  severity: 'ALERT',
3804
3886
  name: 'LEXRuntimeError',
3805
3887
  stack: null,
3806
3888
  handled: false,
3807
3889
  reported: false,
3890
+ id: errorId,
3808
3891
  };
3809
3892
  const evtArgs = {
3810
3893
  message: error.message,
@@ -3815,6 +3898,10 @@ function buildLexRuntime5xxStatusResponseInterceptor(logger) {
3815
3898
  window.setTimeout(() => {
3816
3899
  dispatchGlobalEvent('markup://aura:systemError', evtArgs);
3817
3900
  }, 0);
3901
+ // Throw a simple error to terminate the request completely
3902
+ // The consumer has NOT opted in to handle 5xx errors, so we don't return any response
3903
+ // The systemError event above will handle showing the gack dialog
3904
+ throw new Error(error.message);
3818
3905
  }
3819
3906
  return response;
3820
3907
  };
@@ -3822,14 +3909,27 @@ function buildLexRuntime5xxStatusResponseInterceptor(logger) {
3822
3909
  function buildLexRuntimeLuvio5xxStatusResponseInterceptor() {
3823
3910
  return async (response) => {
3824
3911
  if (response.status >= 500 && response.status < 600) {
3912
+ const userMessage = 'A server error occurred. Please try again later.';
3913
+ // Try to extract ErrorId from response body, fallback to generated ID
3914
+ let errorId;
3915
+ try {
3916
+ const responseBody = response.body ? JSON.stringify(response.body) : '';
3917
+ errorId = getOrGenerateErrorId(responseBody, response.status, response.statusText);
3918
+ }
3919
+ catch (e) {
3920
+ // If reading response fails, use fallback
3921
+ const context = [response.status, response.statusText, Date.now()].join('|');
3922
+ errorId = generateErrorId(context);
3923
+ }
3825
3924
  // Create an error object similar to Aura's current shape for system errors
3826
3925
  const error = {
3827
- message: `Runtime Error: ${response.status} ${response.statusText}`,
3926
+ message: userMessage,
3828
3927
  severity: 'ALERT',
3829
3928
  name: 'LEXRuntimeError',
3830
3929
  stack: null,
3831
3930
  handled: false,
3832
3931
  reported: false,
3932
+ id: errorId,
3833
3933
  };
3834
3934
  const evtArgs = {
3835
3935
  message: error.message,
@@ -3840,6 +3940,10 @@ function buildLexRuntimeLuvio5xxStatusResponseInterceptor() {
3840
3940
  window.setTimeout(() => {
3841
3941
  dispatchGlobalEvent('markup://aura:systemError', evtArgs);
3842
3942
  }, 0);
3943
+ // Throw a simple error to terminate the request completely
3944
+ // The consumer has NOT opted in to handle 5xx errors, so we don't return any response
3945
+ // The systemError event above will handle showing the gack dialog
3946
+ throw new Error(error.message);
3843
3947
  }
3844
3948
  return response;
3845
3949
  };
@@ -3897,7 +4001,7 @@ function getEnvironmentSetting(name) {
3897
4001
  }
3898
4002
  return undefined;
3899
4003
  }
3900
- // version: 1.398.0-ada864f72d
4004
+ // version: 1.400.0-3c7514a502
3901
4005
 
3902
4006
  /**
3903
4007
  * Observability / Critical Availability Program (230+)
@@ -7370,13 +7474,13 @@ const DEFAULT_CONFIG = {
7370
7474
  exponentialFactor: 2,
7371
7475
  jitterPercent: 0.5,
7372
7476
  };
7373
- class Fetch429RetryPolicy extends RetryPolicy {
7477
+ class FetchThrottlingRetryPolicy extends RetryPolicy {
7374
7478
  constructor(config = DEFAULT_CONFIG) {
7375
7479
  super();
7376
7480
  this.config = config;
7377
7481
  }
7378
7482
  shouldRetry(result, context) {
7379
- return (result.status === 429 &&
7483
+ return ((result.status === 429 || result.status === 503) &&
7380
7484
  context.attempt < this.config.maxRetries &&
7381
7485
  context.totalElapsedMs <= this.config.maxTimeToRetry);
7382
7486
  }
@@ -7714,7 +7818,7 @@ function initializeOneStore(luvio) {
7714
7818
  reader.unMarkMissing();
7715
7819
  return linkedData.data;
7716
7820
  });
7717
- const retryPolicy = new Fetch429RetryPolicy();
7821
+ const retryPolicy = new FetchThrottlingRetryPolicy();
7718
7822
  const retryServiceDescriptor = buildServiceDescriptor(retryPolicy);
7719
7823
  const retryService = retryServiceDescriptor.service;
7720
7824
  // set flags based on gates
@@ -7764,4 +7868,4 @@ function ldsEngineCreator() {
7764
7868
  }
7765
7869
 
7766
7870
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
7767
- // version: 1.398.0-4adb9f1c88
7871
+ // version: 1.400.0-8bade3324c
@@ -1,5 +1,5 @@
1
- import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
2
- import { type LoggerService } from '@luvio/utils';
1
+ import { type FetchServiceDescriptor } from '@conduit-client/service-fetch-network/v1';
2
+ import { type LoggerService } from '@conduit-client/utils';
3
3
  export declare function buildJwtAuthorizedSfapFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
4
4
  /**
5
5
  * Returns a service descriptor for a fetch service that includes one-off copilot
@@ -1,6 +1,6 @@
1
- import { type LoggerService } from '@luvio/utils';
2
- import { Interceptors, type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
3
- import { RetryService } from '@luvio/service-retry/v1';
1
+ import { type LoggerService } from '@conduit-client/utils';
2
+ import { Interceptors, type FetchServiceDescriptor } from '@conduit-client/service-fetch-network/v1';
3
+ import { RetryService } from '@conduit-client/service-retry/v1';
4
4
  export declare function buildLexRuntimeDefaultFetchServiceDescriptor(logger: LoggerService, retryService?: RetryService<Response>): FetchServiceDescriptor;
5
5
  export declare function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger: LoggerService, retryService?: RetryService<Response>): FetchServiceDescriptor;
6
6
  export declare function buildLexConnectFetchServiceDescriptor(interceptors?: Interceptors, retryService?: RetryService<Response>): FetchServiceDescriptor;
@@ -1,5 +1,5 @@
1
1
  import type { FetchResponse, ResourceRequest, ResourceRequestContext } from '@luvio/engine';
2
- import type { JwtResolver } from '@luvio/jwt-manager';
2
+ import type { JwtResolver } from '@conduit-client/jwt-manager';
3
3
  export declare const SFAPController = "SalesforceApiPlatformController";
4
4
  export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
5
5
  export type ExtraInfo = {
@@ -1,2 +1,2 @@
1
- import { RequestInterceptor } from '@luvio/service-fetch-network/v1';
1
+ import { RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
2
2
  export declare function buildPageScopedCacheRequestInterceptor(): RequestInterceptor;
@@ -1,4 +1,4 @@
1
- import { RequestInterceptor } from '@luvio/service-fetch-network/v1';
1
+ import { RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
2
2
  import { ResourceRequest } from '@luvio/engine';
3
3
  export declare function buildRequestIdInterceptor(): RequestInterceptor;
4
4
  export declare function buildLuvioRequestIdInterceptor(): (resourceRequest: ResourceRequest) => PromiseLike<ResourceRequest>;
@@ -1,5 +1,5 @@
1
- import { LoggerService } from '@luvio/utils';
2
- import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
1
+ import { LoggerService } from '@conduit-client/utils';
2
+ import { ResponseInterceptor } from '@conduit-client/service-fetch-network/v1';
3
3
  import { ResponseInterceptor as LuvioResponseInterceptor } from '@salesforce/lds-network-fetch';
4
4
  export type LexRuntimeError = {
5
5
  message: string;
@@ -8,6 +8,7 @@ export type LexRuntimeError = {
8
8
  stack: string | null;
9
9
  handled: boolean;
10
10
  reported: boolean;
11
+ id: number;
11
12
  };
12
13
  export type LexErrorEventArgs = {
13
14
  message: string;
@@ -1,5 +1,5 @@
1
- import { LoggerService } from '@luvio/utils';
2
- import { ResponseInterceptor } from '@luvio/service-fetch-network/v1';
1
+ import { LoggerService } from '@conduit-client/utils';
2
+ import { ResponseInterceptor } from '@conduit-client/service-fetch-network/v1';
3
3
  import { ResponseInterceptor as LuvioResponseInterceptor } from '@salesforce/lds-network-fetch';
4
4
  export declare function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger: LoggerService): ResponseInterceptor;
5
5
  export declare function buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(): LuvioResponseInterceptor;
@@ -1,5 +1,5 @@
1
- import { RetryPolicy, RetryContext } from '@luvio/service-retry/v1';
2
- type Fetch429RetryPolicyConfig = {
1
+ import { RetryPolicy, RetryContext } from '@conduit-client/service-retry/v1';
2
+ type FetchThrottlingRetryPolicyConfig = {
3
3
  maxRetries: number;
4
4
  maxTimeToRetry: number;
5
5
  baseDelay: number;
@@ -7,9 +7,9 @@ type Fetch429RetryPolicyConfig = {
7
7
  exponentialFactor: number;
8
8
  jitterPercent: number;
9
9
  };
10
- export declare class Fetch429RetryPolicy extends RetryPolicy<Response> {
10
+ export declare class FetchThrottlingRetryPolicy extends RetryPolicy<Response> {
11
11
  private config;
12
- constructor(config?: Fetch429RetryPolicyConfig);
12
+ constructor(config?: FetchThrottlingRetryPolicyConfig);
13
13
  shouldRetry(result: Response, context: RetryContext<Response>): boolean;
14
14
  calculateDelay(result: Response, context: RetryContext<Response>): number;
15
15
  parseRetryAfterHeader(result: Response): number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.398.0",
3
+ "version": "1.400.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.66.0",
38
- "@luvio/tools-core": "5.66.0",
39
- "@salesforce/lds-adapters-apex": "^1.398.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.398.0",
41
- "@salesforce/lds-ads-bridge": "^1.398.0",
42
- "@salesforce/lds-aura-storage": "^1.398.0",
43
- "@salesforce/lds-bindings": "^1.398.0",
44
- "@salesforce/lds-instrumentation": "^1.398.0",
45
- "@salesforce/lds-network-aura": "^1.398.0",
46
- "@salesforce/lds-network-fetch": "^1.398.0",
37
+ "@conduit-client/service-provisioner": "2.0.1",
38
+ "@conduit-client/tools-core": "2.0.1",
39
+ "@salesforce/lds-adapters-apex": "^1.400.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.400.0",
41
+ "@salesforce/lds-ads-bridge": "^1.400.0",
42
+ "@salesforce/lds-aura-storage": "^1.400.0",
43
+ "@salesforce/lds-bindings": "^1.400.0",
44
+ "@salesforce/lds-instrumentation": "^1.400.0",
45
+ "@salesforce/lds-network-aura": "^1.400.0",
46
+ "@salesforce/lds-network-fetch": "^1.400.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-graphql-normalized-cache-control": "5.66.0",
51
- "@luvio/command-aura-network": "5.66.0",
52
- "@luvio/command-aura-normalized-cache-control": "5.66.0",
53
- "@luvio/command-aura-resource-cache-control": "5.66.0",
54
- "@luvio/command-fetch-network": "5.66.0",
55
- "@luvio/command-http-graphql-normalized-cache-control": "5.66.0",
56
- "@luvio/command-http-normalized-cache-control": "5.66.0",
57
- "@luvio/command-ndjson": "5.66.0",
58
- "@luvio/command-network": "5.66.0",
59
- "@luvio/command-sse": "5.66.0",
60
- "@luvio/command-streaming": "5.66.0",
50
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "2.0.1",
51
+ "@conduit-client/command-aura-network": "2.0.1",
52
+ "@conduit-client/command-aura-normalized-cache-control": "2.0.1",
53
+ "@conduit-client/command-aura-resource-cache-control": "2.0.1",
54
+ "@conduit-client/command-fetch-network": "2.0.1",
55
+ "@conduit-client/command-http-graphql-normalized-cache-control": "2.0.1",
56
+ "@conduit-client/command-http-normalized-cache-control": "2.0.1",
57
+ "@conduit-client/command-ndjson": "2.0.1",
58
+ "@conduit-client/command-network": "2.0.1",
59
+ "@conduit-client/command-sse": "2.0.1",
60
+ "@conduit-client/command-streaming": "2.0.1",
61
+ "@conduit-client/service-aura-network": "2.0.1",
62
+ "@conduit-client/service-cache": "2.0.1",
63
+ "@conduit-client/service-cache-control": "2.0.1",
64
+ "@conduit-client/service-cache-inclusion-policy": "2.0.1",
65
+ "@conduit-client/service-feature-flags": "2.0.1",
66
+ "@conduit-client/service-fetch-network": "2.0.1",
67
+ "@conduit-client/service-instrument-command": "2.0.1",
68
+ "@conduit-client/service-pubsub": "2.0.1",
69
+ "@conduit-client/service-store": "2.0.1",
70
+ "@conduit-client/utils": "2.0.1",
61
71
  "@luvio/network-adapter-composable": "0.158.7",
62
72
  "@luvio/network-adapter-fetch": "0.158.7",
63
- "@luvio/service-aura-network": "5.66.0",
64
- "@luvio/service-cache": "5.66.0",
65
- "@luvio/service-cache-control": "5.66.0",
66
- "@luvio/service-cache-inclusion-policy": "5.66.0",
67
- "@luvio/service-feature-flags": "5.66.0",
68
- "@luvio/service-fetch-network": "5.66.0",
69
- "@luvio/service-instrument-command": "5.66.0",
70
- "@luvio/service-pubsub": "5.66.0",
71
- "@luvio/service-store": "5.66.0",
72
- "@luvio/utils": "5.66.0",
73
73
  "@lwc/state": "^0.23.0",
74
- "@salesforce/lds-adapters-onestore-graphql": "^1.398.0",
75
- "@salesforce/lds-adapters-uiapi-lex": "^1.398.0",
76
- "@salesforce/lds-luvio-service": "^1.398.0",
77
- "@salesforce/lds-luvio-uiapi-records-service": "^1.398.0"
74
+ "@salesforce/lds-adapters-onestore-graphql": "^1.400.0",
75
+ "@salesforce/lds-adapters-uiapi-lex": "^1.400.0",
76
+ "@salesforce/lds-luvio-service": "^1.400.0",
77
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.400.0"
78
78
  },
79
79
  "luvioBundlesize": [
80
80
  {