@salesforce/lds-runtime-one-runtime 1.457.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.
Files changed (112) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/oneRuntimeLdsEngineCreator.js +11525 -0
  3. package/dist/types/__mocks__/@salesforce/lds-ads-bridge.d.ts +2 -0
  4. package/dist/types/__mocks__/@salesforce/lds-durable-storage.d.ts +5 -0
  5. package/dist/types/__mocks__/@salesforce/lds-environment-settings.d.ts +2 -0
  6. package/dist/types/__mocks__/@salesforce/lds-instrumentation.d.ts +15 -0
  7. package/dist/types/__mocks__/@salesforce/lds-network-aura.d.ts +4 -0
  8. package/dist/types/__mocks__/@salesforce/lds-network-fetch.d.ts +2 -0
  9. package/dist/types/__mocks__/aura.d.ts +3 -0
  10. package/dist/types/__mocks__/force/ldsGraphqlParser.d.ts +3 -0
  11. package/dist/types/__mocks__/instrumentation/service.d.ts +33 -0
  12. package/dist/types/__mocks__/instrumentation:thirdPartyTracker.d.ts +4 -0
  13. package/dist/types/__mocks__/lwc.d.ts +6 -0
  14. package/dist/types/__mocks__/o11y/activity.d.ts +12 -0
  15. package/dist/types/__mocks__/o11y/client.d.ts +11 -0
  16. package/dist/types/__mocks__/o11y/idleDetector.d.ts +18 -0
  17. package/dist/types/__mocks__/o11y/instrumentation.d.ts +15 -0
  18. package/dist/types/__mocks__/o11y_schema/sf_lds.d.ts +1 -0
  19. package/dist/types/aura-instrumentation/main.d.ts +182 -0
  20. package/dist/types/aura-instrumentation/state-managers.d.ts +4 -0
  21. package/dist/types/aura-instrumentation/utils/observability.d.ts +36 -0
  22. package/dist/types/aura-instrumentation/utils/utils.d.ts +13 -0
  23. package/dist/types/aura-utils.d.ts +45 -0
  24. package/dist/types/config-service-util.d.ts +6 -0
  25. package/dist/types/fetch-service-descriptors/jwt-authorized-fetch-service.d.ts +35 -0
  26. package/dist/types/fetch-service-descriptors/lex-fetch-service.d.ts +6 -0
  27. package/dist/types/finally-interceptors/luvio-third-party-tracker-finish.d.ts +1 -0
  28. package/dist/types/finally-interceptors/third-party-tracker-finish.d.ts +2 -0
  29. package/dist/types/instrumentation-utils.d.ts +14 -0
  30. package/dist/types/language.d.ts +23 -0
  31. package/dist/types/locker-wire-bindings.d.ts +3 -0
  32. package/dist/types/main.d.ts +77 -0
  33. package/dist/types/metadata.d.ts +5 -0
  34. package/dist/types/network-adapter.d.ts +2 -0
  35. package/dist/types/network-fetch.d.ts +51 -0
  36. package/dist/types/network-instrumentation.d.ts +2 -0
  37. package/dist/types/network-sfap.d.ts +18 -0
  38. package/dist/types/parameterized-sfap-jwt-aura-resolver.d.ts +34 -0
  39. package/dist/types/predictive-loading/common/index.d.ts +17 -0
  40. package/dist/types/predictive-loading/index.d.ts +7 -0
  41. package/dist/types/predictive-loading/lex/index.d.ts +17 -0
  42. package/dist/types/predictive-loading/lex/predictions-ready-manager.d.ts +32 -0
  43. package/dist/types/predictive-loading/pages/abstract-home-page.d.ts +17 -0
  44. package/dist/types/predictive-loading/pages/index.d.ts +4 -0
  45. package/dist/types/predictive-loading/pages/lex-default-page.d.ts +15 -0
  46. package/dist/types/predictive-loading/pages/object-home-page.d.ts +23 -0
  47. package/dist/types/predictive-loading/pages/predictive-prefetch-page.d.ts +12 -0
  48. package/dist/types/predictive-loading/pages/record-home-page.d.ts +26 -0
  49. package/dist/types/predictive-loading/prefetcher/events.d.ts +25 -0
  50. package/dist/types/predictive-loading/prefetcher/index.d.ts +4 -0
  51. package/dist/types/predictive-loading/prefetcher/lex-predictive-prefetcher.d.ts +18 -0
  52. package/dist/types/predictive-loading/prefetcher/predictive-prefetcher.d.ts +38 -0
  53. package/dist/types/predictive-loading/prefetcher/utils.d.ts +52 -0
  54. package/dist/types/predictive-loading/repository/index.d.ts +2 -0
  55. package/dist/types/predictive-loading/repository/prefetch-repository.d.ts +31 -0
  56. package/dist/types/predictive-loading/repository/utils.d.ts +13 -0
  57. package/dist/types/predictive-loading/request-runner/index.d.ts +2 -0
  58. package/dist/types/predictive-loading/request-runner/lex-request-runner.d.ts +10 -0
  59. package/dist/types/predictive-loading/request-runner/request-runner.d.ts +5 -0
  60. package/dist/types/predictive-loading/request-strategy/get-apex-request-strategy.d.ts +30 -0
  61. package/dist/types/predictive-loading/request-strategy/get-list-info-by-name-request-strategy.d.ts +19 -0
  62. package/dist/types/predictive-loading/request-strategy/get-list-infos-by-object-name-request-strategy.d.ts +19 -0
  63. package/dist/types/predictive-loading/request-strategy/get-list-object-info-request-strategy.d.ts +18 -0
  64. package/dist/types/predictive-loading/request-strategy/get-list-records-by-name-request-strategy.d.ts +19 -0
  65. package/dist/types/predictive-loading/request-strategy/get-object-info-request-strategy.d.ts +26 -0
  66. package/dist/types/predictive-loading/request-strategy/get-object-infos-request-strategy.d.ts +25 -0
  67. package/dist/types/predictive-loading/request-strategy/get-record-actions-request-strategy.d.ts +20 -0
  68. package/dist/types/predictive-loading/request-strategy/get-record-avatars-request-strategy.d.ts +20 -0
  69. package/dist/types/predictive-loading/request-strategy/get-record-request-strategy.d.ts +26 -0
  70. package/dist/types/predictive-loading/request-strategy/get-records-request-strategy.d.ts +18 -0
  71. package/dist/types/predictive-loading/request-strategy/get-related-list-actions-request-strategy.d.ts +21 -0
  72. package/dist/types/predictive-loading/request-strategy/get-related-list-info-batch-request-strategy.d.ts +24 -0
  73. package/dist/types/predictive-loading/request-strategy/get-related-list-info-request-strategy.d.ts +50 -0
  74. package/dist/types/predictive-loading/request-strategy/get-related-list-records-batch-request-strategy.d.ts +32 -0
  75. package/dist/types/predictive-loading/request-strategy/get-related-list-records-request-strategy.d.ts +34 -0
  76. package/dist/types/predictive-loading/request-strategy/get-related-lists-actions-request-strategy.d.ts +28 -0
  77. package/dist/types/predictive-loading/request-strategy/get-related-lists-info-strategy.d.ts +30 -0
  78. package/dist/types/predictive-loading/request-strategy/index.d.ts +20 -0
  79. package/dist/types/predictive-loading/request-strategy/lex-request-strategy.d.ts +13 -0
  80. package/dist/types/predictive-loading/request-strategy/luvio-adapter-request-strategy.d.ts +27 -0
  81. package/dist/types/predictive-loading/request-strategy/request-strategy.d.ts +79 -0
  82. package/dist/types/predictive-loading/request-strategy-manager/request-strategy-manager.d.ts +12 -0
  83. package/dist/types/predictive-loading/storage/aura-prefetch-storage.d.ts +25 -0
  84. package/dist/types/predictive-loading/storage/in-memory-prefetch-storage.d.ts +6 -0
  85. package/dist/types/predictive-loading/storage/index.d.ts +8 -0
  86. package/dist/types/predictive-loading/storage/local-prefetch-storage.d.ts +7 -0
  87. package/dist/types/request-interceptors/action-enqueue.d.ts +4 -0
  88. package/dist/types/request-interceptors/csrf-manager.d.ts +8 -0
  89. package/dist/types/request-interceptors/csrf-service.d.ts +19 -0
  90. package/dist/types/request-interceptors/csrf-token.d.ts +19 -0
  91. package/dist/types/request-interceptors/entity-encoding.d.ts +17 -0
  92. package/dist/types/request-interceptors/first-party-header.d.ts +17 -0
  93. package/dist/types/request-interceptors/jwt-parameterization.d.ts +50 -0
  94. package/dist/types/request-interceptors/luvio-page-scoped-cache.d.ts +11 -0
  95. package/dist/types/request-interceptors/luvio-third-party-tracker-register.d.ts +2 -0
  96. package/dist/types/request-interceptors/page-scoped-cache.d.ts +2 -0
  97. package/dist/types/request-interceptors/third-party-tracker-register.d.ts +2 -0
  98. package/dist/types/request-interceptors/transport-send.d.ts +5 -0
  99. package/dist/types/response-interceptors/action-finish.d.ts +4 -0
  100. package/dist/types/response-interceptors/error-body-normalization.d.ts +20 -0
  101. package/dist/types/response-interceptors/lex-runtime-5xx-status.d.ts +19 -0
  102. package/dist/types/response-interceptors/lex-runtime-session-expiration.d.ts +5 -0
  103. package/dist/types/response-interceptors/transport-receive.d.ts +4 -0
  104. package/dist/types/retry-interceptors/csrf-retry.d.ts +2 -0
  105. package/dist/types/retry-interceptors/luvio-fetch-retry.d.ts +8 -0
  106. package/dist/types/retry-policies/csrf-token-retry-policy.d.ts +72 -0
  107. package/dist/types/retry-policies/fetch-throttling-retry-policy.d.ts +18 -0
  108. package/dist/types/retry-policies/luvio-csrf-token-retry-policy.d.ts +31 -0
  109. package/dist/types/retry-policies/luvio-fetch-throttling-retry-policy.d.ts +18 -0
  110. package/dist/types/service-variants/durable-cache-inclusion-policy.d.ts +82 -0
  111. package/dist/types/sfap-jwt-mint-params.d.ts +80 -0
  112. package/package.json +98 -0
@@ -0,0 +1,51 @@
1
+ import { type ResourceRequest } from '@luvio/engine';
2
+ import type { RequestLogger } from '@salesforce/lds-network-fetch';
3
+ import type { RequestTracker } from './instrumentation-utils';
4
+ /**
5
+ * Public UIAPI url paths verified for HTTP transport.
6
+ *
7
+ * Inclusion criteria:
8
+ * 1. The path's underlying Connect resource does NOT carry
9
+ * `clientFilters=@ConnectClientFilters({@ConnectClientFilter(key = "UiTier")...})`.
10
+ * 2. LDS actually invokes this URL via a Luvio adapter wired into
11
+ * `ldsEngineCreator.js` (i.e. there is a corresponding `*AdapterFactory`
12
+ * import). Connect resources with no LDS adapter are intentionally
13
+ * excluded — adding them produces no traffic and just bloats the matcher.
14
+ *
15
+ * Where a single Connect resource exposes multiple URL shapes (e.g. a 4-segment
16
+ * GET form alongside a 3-segment POST form), all forms LDS adapters can hit at
17
+ * runtime are registered.
18
+ */
19
+ export declare const UIAPI_PUBLIC_PATHS: string[];
20
+ /**
21
+ * Private UIAPI url paths gated by the private-endpoint gates per runtime.
22
+ *
23
+ * Inclusion criteria:
24
+ * 1. The path's underlying Connect resource carries
25
+ * `clientFilters=@ConnectClientFilters({@ConnectClientFilter(key = "UiTier")...})`,
26
+ * which restricts callers to the UI tier (one.app / One Runtime / UISDK runtime) and
27
+ * excludes the public REST API.
28
+ * 2. LDS actually invokes this URL via a Luvio adapter wired into
29
+ * `ldsEngineCreator.js`.
30
+ */
31
+ export declare const UIAPI_PRIVATE_PATHS: string[];
32
+ /**
33
+ * Single content documents version URL enabled/disabled by killswitch.
34
+ * Exported for reuse in tests.
35
+ */
36
+ export declare const CONTENT_DOCUMENTS_VERSIONS_PATH = "/ui-api/records/content-documents/content-versions";
37
+ /**
38
+ * Indicates whether any predicate-enabled path sets are active.
39
+ * Used by adapter composition to decide whether to include the fetch adapter.
40
+ */
41
+ export declare function isFetchAdapterEnabled(): boolean;
42
+ export declare const instrumentationTracker: RequestTracker;
43
+ export declare const requestLogger: RequestLogger;
44
+ export declare const composedFetchNetworkAdapter: {
45
+ /**
46
+ * Handles only the enabled paths. The incoming path is normalized
47
+ * (trailing slash removed) before matching against the precomputed matchers.
48
+ */
49
+ shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
50
+ adapter: import("@luvio/engine").NetworkAdapter;
51
+ };
@@ -0,0 +1,2 @@
1
+ import type { FetchResponse, ResourceRequest } from '@luvio/engine';
2
+ export declare function checkAndLogCrudInteraction(request: ResourceRequest, isResolve: boolean, error: any, response?: FetchResponse<any>): void;
@@ -0,0 +1,18 @@
1
+ import type { FetchResponse, ResourceRequest, ResourceRequestContext } from '@luvio/engine';
2
+ import type { JwtResolver } from '@conduit-client/jwt-manager';
3
+ export declare const SFAPController = "SalesforceApiPlatformController";
4
+ export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
5
+ export declare const SFAPJwtPostMethod = "postSFAPLightningJwtService";
6
+ export type ExtraInfo = {
7
+ baseUri: string;
8
+ };
9
+ /**
10
+ * Resolves Jwt token for SFAP by calling Aura action
11
+ * {@link JwtResolver} for platform SFAP
12
+ */
13
+ export declare const platformSfapJwtResolver: JwtResolver<ExtraInfo>;
14
+ declare const composedNetworkAdapter: {
15
+ shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
16
+ adapter: (resourceRequest: ResourceRequest, resourceRequestContext: ResourceRequestContext) => Promise<FetchResponse<any>>;
17
+ };
18
+ export default composedNetworkAdapter;
@@ -0,0 +1,34 @@
1
+ import type { JwtMintParams, JwtResolver } from '@conduit-client/jwt-manager';
2
+ import { type ParameterizedSfapExtraInfo } from './sfap-jwt-mint-params';
3
+ /**
4
+ * Parameterized SFAP JWT resolver that mints over **Aura transport** instead of a
5
+ * direct HTTP `fetch`.
6
+ *
7
+ * It dispatches the SFAP Lightning JWT Service's parameterized POST via its
8
+ * auto-generated Aura controller method
9
+ * `SalesforceApiPlatformController.postSFAPLightningJwtService` (generated by
10
+ * `@ConnectSignature(..., generateAuraMethod = true)` on the Connect resource).
11
+ * The mint inputs ride as the single `requestBody` named param, in the same
12
+ * `{ scopes, dynamicParameters: { items } }` shape the HTTP resolver POSTs — built
13
+ * by the shared {@link buildRequestBody}, so the two transports stay in lockstep.
14
+ *
15
+ * Why Aura (not the HTTP resolver): the mint endpoint is a same-origin core
16
+ * resource, and routing it over Aura keeps session/CSRF handling inside the Aura
17
+ * stack rather than issuing a credentialed cross-cutting `fetch` from the client.
18
+ * This mirrors the legacy parameterless `platformSfapJwtResolver` in
19
+ * `network-sfap.ts`, which already mints over Aura via the `getSFAPLightningJwtService`
20
+ * generated method — this is the parameterized sibling of that call.
21
+ *
22
+ * A `JwtResolver` is invoked directly by `JwtManager` (not through Luvio's
23
+ * `appRouter`/`ResourceRequest` pipeline), so the correct mechanism is a direct
24
+ * named-controller `dispatchAuraAction`, not the `auraNetworkAdapter`/connect-route
25
+ * table. The SFAP JWT endpoint is not registered as a connect-over-Aura route, and
26
+ * a resolver has no `ResourceRequest` for the router to look up.
27
+ */
28
+ export declare class ParameterizedSfapJwtAuraResolver implements JwtResolver<ParameterizedSfapExtraInfo> {
29
+ getJwt(params?: JwtMintParams): Promise<{
30
+ jwt: string;
31
+ extraInfo: ParameterizedSfapExtraInfo;
32
+ }>;
33
+ }
34
+ export declare function buildParameterizedSfapJwtAuraResolver(): ParameterizedSfapJwtAuraResolver;
@@ -0,0 +1,17 @@
1
+ export declare const PDL_EXECUTE_ASYNC_OPTIONS: {
2
+ LOG_ERROR_ONLY: boolean;
3
+ ERROR_SCOPE: string;
4
+ };
5
+ export type RequestEntry<Request> = {
6
+ request: Request;
7
+ requestMetadata: {
8
+ requestTime: number;
9
+ };
10
+ };
11
+ /**
12
+ * Request and context-based Key data to be saved.
13
+ */
14
+ export type SaveRequestData<Request, Context> = {
15
+ request: Request;
16
+ key: Context;
17
+ };
@@ -0,0 +1,7 @@
1
+ export * from './common';
2
+ export * from './pages';
3
+ export * from './prefetcher';
4
+ export * from './repository';
5
+ export * from './request-runner';
6
+ export * from './request-strategy';
7
+ export * from './storage';
@@ -0,0 +1,17 @@
1
+ import type { BaseAdapterRequest } from '../../predictive-loading';
2
+ import type { DefaultPageContext, ObjectHomePageContext, RecordHomePageContext } from '../pages';
3
+ /**
4
+ * Options for the predictive prefetcher.
5
+ */
6
+ export type LexPrefetcherOptions = {
7
+ /**
8
+ * Limit on the number of requests that can be inflight at any given time.
9
+ */
10
+ inflightRequestLimit: number;
11
+ };
12
+ export { PredictionsReadyManager } from './predictions-ready-manager';
13
+ export type LexRequest<Config = unknown> = BaseAdapterRequest<Config>;
14
+ export type LexRequestOptions = {
15
+ disableHotspot?: boolean;
16
+ };
17
+ export type LexContext = RecordHomePageContext | ObjectHomePageContext | DefaultPageContext;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Manages the state of predictions and notifies registered callbacks when predictions are ready.
3
+ */
4
+ export declare class PredictionsReadyManager {
5
+ /**
6
+ * Array of callbacks to be executed when predictions are ready.
7
+ * @private
8
+ */
9
+ private predictionsReadyCallbacks;
10
+ /**
11
+ * Indicates whether the predictions are ready.
12
+ * @private
13
+ */
14
+ private predictionsReady;
15
+ /**
16
+ * Registers a callback to be called when predictions are ready.
17
+ * If predictions are already ready, the callback is invoked immediately.
18
+ *
19
+ * @param {() => void} callback - The callback function to be executed when predictions are ready.
20
+ */
21
+ whenPredictionsReady(callback: () => void): void;
22
+ /**
23
+ * Notifies that predictions are ready by invoking all registered callbacks.
24
+ */
25
+ notifyPredictionsReady(): void;
26
+ /**
27
+ * Retrieves the list of callbacks registered to be executed when predictions are ready.
28
+ *
29
+ * @returns {Array<() => void>} Array of callback functions.
30
+ */
31
+ getCallbacks(): Array<() => void>;
32
+ }
@@ -0,0 +1,17 @@
1
+ import { LexDefaultPage } from './lex-default-page';
2
+ import type { LexRequest } from '../lex';
3
+ import type { DefaultPageContext } from './lex-default-page';
4
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
5
+ /**
6
+ * Base implementation of a home page
7
+ */
8
+ export declare abstract class AbstractHomePage<HomePageContext extends DefaultPageContext> extends LexDefaultPage<LexRequest, HomePageContext> {
9
+ protected requestStrategyManager: RequestStrategyManager;
10
+ private supportedAdapters;
11
+ protected constructor(context: HomePageContext, similarContext: HomePageContext, requestStrategyManager: RequestStrategyManager, supportedAdapters: Set<string>);
12
+ supportsRequest(request: LexRequest): boolean;
13
+ buildSaveRequestData(request: LexRequest): {
14
+ key: HomePageContext;
15
+ request: LexRequest<unknown>;
16
+ }[];
17
+ }
@@ -0,0 +1,4 @@
1
+ export * from './predictive-prefetch-page';
2
+ export * from './lex-default-page';
3
+ export * from './record-home-page';
4
+ export * from './object-home-page';
@@ -0,0 +1,15 @@
1
+ import type { BaseAdapterRequest } from '../request-strategy';
2
+ import { PredictivePrefetchPage } from './predictive-prefetch-page';
3
+ export type DefaultPageContext = Record<string, any>;
4
+ export declare class LexDefaultPage<Request extends BaseAdapterRequest, Context extends DefaultPageContext> extends PredictivePrefetchPage<Request, Context> {
5
+ constructor(context: Context, similarContext?: Context);
6
+ supportsRequest(_request: Request): boolean;
7
+ buildSaveRequestData(request: Request): {
8
+ key: Context;
9
+ request: Request;
10
+ }[];
11
+ resolveSimilarRequest(similarRequest: Request): Request;
12
+ getAlwaysRunRequests(): Request[];
13
+ shouldReduceAlwaysRequestsWithPredictions(): boolean;
14
+ shouldExecuteAlwaysRequestByThemself(): boolean;
15
+ }
@@ -0,0 +1,23 @@
1
+ import type { LexRequest } from '../lex';
2
+ import type { DefaultPageContext } from './lex-default-page';
3
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
4
+ import { AbstractHomePage } from './abstract-home-page';
5
+ export type ObjectHomePageContext = {
6
+ objectApiName: string;
7
+ listViewApiName: string;
8
+ type: 'objectHomePage';
9
+ };
10
+ export declare const OBJECT_HOME_SUPPORTED_ADAPTERS: Set<string>;
11
+ export declare class ObjectHomePage extends AbstractHomePage<ObjectHomePageContext> {
12
+ constructor(context: ObjectHomePageContext, requestStrategyManager: RequestStrategyManager);
13
+ getAlwaysRunRequests(): LexRequest[];
14
+ /**
15
+ * In OH, the always requests are reduced with predictions, and because they
16
+ * can't be merged with other predictions, they will always run by themself.
17
+ * This value must be `false`, otherwise we may see repeated requests.
18
+ *
19
+ * @returns false
20
+ */
21
+ shouldExecuteAlwaysRequestByThemself(): boolean;
22
+ static handlesContext(context: DefaultPageContext): context is ObjectHomePageContext;
23
+ }
@@ -0,0 +1,12 @@
1
+ import type { SaveRequestData } from '../common';
2
+ export declare abstract class PredictivePrefetchPage<Request, Context> {
3
+ protected context: Context;
4
+ protected similarContext?: Context | undefined;
5
+ protected constructor(context: Context, similarContext?: Context | undefined);
6
+ abstract supportsRequest(request: Request): boolean;
7
+ abstract buildSaveRequestData(request: Request): SaveRequestData<Request, Context>[];
8
+ abstract resolveSimilarRequest(similarRequest: Request): Request;
9
+ abstract getAlwaysRunRequests(): Request[];
10
+ getExactKey(): Context;
11
+ getSimilarKey(): Context;
12
+ }
@@ -0,0 +1,26 @@
1
+ import type { LexRequest } from '../lex';
2
+ import type { DefaultPageContext } from './lex-default-page';
3
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
4
+ import { AbstractHomePage } from './abstract-home-page';
5
+ export declare const RECORD_HOME_SUPPORTED_ADAPTERS: Set<string>;
6
+ export type RecordHomePageContext = {
7
+ objectApiName: string;
8
+ recordId: string;
9
+ recordTypeId?: string;
10
+ actionName: string;
11
+ type: 'recordPage';
12
+ };
13
+ export declare class RecordHomePage extends AbstractHomePage<RecordHomePageContext> {
14
+ constructor(context: RecordHomePageContext, requestStrategyManager: RequestStrategyManager);
15
+ getExactKey(): RecordHomePageContext;
16
+ resolveSimilarRequest(similarRequest: LexRequest): LexRequest;
17
+ getAlwaysRunRequests(): LexRequest[];
18
+ /**
19
+ * In RH, we should execute the getRecord(id, type) by itself as we want the result asap, so
20
+ * it does not stop rendering.
21
+ * @returns true
22
+ */
23
+ shouldExecuteAlwaysRequestByThemself(): boolean;
24
+ static handlesContext(context: DefaultPageContext): context is RecordHomePageContext;
25
+ static contextToExactKey(context: RecordHomePageContext): RecordHomePageContext;
26
+ }
@@ -0,0 +1,25 @@
1
+ import type { PredictivePrefetchPage } from '../pages';
2
+ export declare enum PdlPrefetcherEventType {
3
+ STARTED_RECORDING = "started-recording",
4
+ STOPPED_RECORDING = "stopped-recording"
5
+ }
6
+ export type StartedRecordingEvent = {
7
+ type: PdlPrefetcherEventType.STARTED_RECORDING;
8
+ page: PredictivePrefetchPage<any, any>;
9
+ };
10
+ export type StoppedRecordingEvent = {
11
+ type: PdlPrefetcherEventType.STOPPED_RECORDING;
12
+ page: PredictivePrefetchPage<any, any>;
13
+ };
14
+ export type PrefetcherEvent = StartedRecordingEvent | StoppedRecordingEvent;
15
+ export type PrefetcherEventMap = {
16
+ [PdlPrefetcherEventType.STARTED_RECORDING]: StartedRecordingEvent;
17
+ [PdlPrefetcherEventType.STOPPED_RECORDING]: StoppedRecordingEvent;
18
+ };
19
+ type ListenerFn<T extends PdlPrefetcherEventType> = (event: PrefetcherEventMap[T]) => void;
20
+ export declare class PrefetcherEventEmitter {
21
+ private listeners;
22
+ subscribeTo<T extends PdlPrefetcherEventType>(type: T, listener: ListenerFn<T>): () => void;
23
+ emit<T extends PdlPrefetcherEventType>(event: PrefetcherEventMap[T]): void;
24
+ }
25
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './predictive-prefetcher';
2
+ export * from './lex-predictive-prefetcher';
3
+ export type { PrefetcherEvent, StartedRecordingEvent, StoppedRecordingEvent, PrefetcherEventMap, } from './events';
4
+ export { PdlPrefetcherEventType } from './events';
@@ -0,0 +1,18 @@
1
+ import { LexDefaultPage } from '../pages';
2
+ import { ApplicationPredictivePrefetcher } from './predictive-prefetcher';
3
+ import type { RequestRunner } from '../request-runner';
4
+ import type { PrefetchRepository } from '../repository';
5
+ import type { RequestEntry } from '../common';
6
+ import type { LexContext, LexPrefetcherOptions, LexRequest } from '../lex';
7
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
8
+ import type { PrefetcherEventEmitter } from './events';
9
+ export declare class LexPredictivePrefetcher extends ApplicationPredictivePrefetcher<LexRequest, LexContext, LexDefaultPage<LexRequest, LexContext>> {
10
+ protected options: LexPrefetcherOptions;
11
+ page: LexDefaultPage<LexRequest, LexContext>;
12
+ private requestStrategyManager;
13
+ constructor(context: LexContext, repository: PrefetchRepository<LexRequest>, requestRunner: RequestRunner<LexRequest>, eventEmitter: PrefetcherEventEmitter, requestStrategyManager: RequestStrategyManager, options: LexPrefetcherOptions);
14
+ getPage(): LexDefaultPage<LexRequest, LexContext>;
15
+ getAllPageRequests(): RequestEntry<LexRequest>[];
16
+ getPredictedRequestsOrderedByPriority(): RequestEntry<LexRequest>[];
17
+ predict(): Promise<void>;
18
+ }
@@ -0,0 +1,38 @@
1
+ import type { PrefetchRepository } from '../repository';
2
+ import type { PredictivePrefetchPage } from '../pages';
3
+ import type { RequestRunner } from '../request-runner';
4
+ import type { BaseAdapterRequest } from '../request-strategy';
5
+ import type { PrefetcherEventEmitter, PrefetcherEventMap } from './events';
6
+ import { PdlPrefetcherEventType } from './events';
7
+ export declare abstract class ApplicationPredictivePrefetcher<Request extends BaseAdapterRequest, Context extends Record<string, any>, Page extends PredictivePrefetchPage<Request, Context>> {
8
+ protected repository: PrefetchRepository<Request>;
9
+ protected requestRunner: RequestRunner<Request>;
10
+ protected eventEmitter: PrefetcherEventEmitter;
11
+ private _context;
12
+ isRecording: boolean;
13
+ totalRequestCount: Number;
14
+ page: Page;
15
+ queuedPredictionRequests: Request[];
16
+ protected constructor(context: Context, repository: PrefetchRepository<Request>, requestRunner: RequestRunner<Request>, eventEmitter: PrefetcherEventEmitter);
17
+ abstract getPage(): Page;
18
+ set context(value: Context);
19
+ get context(): Context;
20
+ subscribeToEvent<T extends PdlPrefetcherEventType>(type: T, callback: (event: PrefetcherEventMap[T]) => void): () => void;
21
+ stopRecording(): Promise<void>;
22
+ startRecording(): void;
23
+ saveRequest(request: Request): void;
24
+ predict(): Promise<void>;
25
+ getPredictionSummary(): {
26
+ exact: number;
27
+ similar: number;
28
+ totalRequestCount: Number;
29
+ };
30
+ hasPredictions(): boolean;
31
+ getSimilarPageRequests(): {
32
+ request: Request;
33
+ requestMetadata: {
34
+ requestTime: number;
35
+ };
36
+ }[];
37
+ getExactPageRequests(): import("../common").RequestEntry<Request>[];
38
+ }
@@ -0,0 +1,52 @@
1
+ import type { RequestRunner } from '../request-runner';
2
+ import type { RequestEntry } from '../common';
3
+ import type { LexRequest, LexRequestOptions } from '../lex';
4
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
5
+ import type { DefaultPageContext } from '../pages';
6
+ /**
7
+ * Runs a list of requests with a specified concurrency limit.
8
+ *
9
+ * @template Request - The type of the requests being processed.
10
+ * @param {RequestEntry<Request>[]} requests - An array of request entries to be processed in the array order.
11
+ * @param {RequestRunner<Request>} runner - The runner instance responsible for executing the requests.
12
+ * @param {number} concurrentRequestsLimit - The maximum number of concurrent requests allowed.
13
+ * @param {number} pageStartTime - The start time of the page load, used to calculate the time elapsed since the page starts loading.
14
+ * @returns {Promise<void>} A promise that resolves when all requests have been processed.
15
+ *
16
+ * This function manages a queue of pending requests and processes them with a concurrency limit.
17
+ * Requests are only processed if their `requestTime` is less than the time elapsed since `pageStartTime`.
18
+ */
19
+ export declare function runRequestsWithLimit<Request>(requests: RequestEntry<Request>[], runner: RequestRunner<Request>, concurrentRequestsLimit: number, pageStartTime: number): Promise<void>;
20
+ /**
21
+ * Runs entire list of LEX requests, applying hotspot up to the specified limit and disabling for all remaining
22
+ *
23
+ * @param {RequestEntry<LexRequest>[]} requests - An array of request entries to be processed in the array order.
24
+ * @param {RequestRunner<LexRequest, LexRequestOptions>} runner - The runner instance responsible for executing the requests.
25
+ * @param {number} hotspotLimit - The number of hotspot requests allowed.
26
+ * @returns {Promise<void>} A promise that resolves when all requests have been processed.
27
+ *
28
+ * This function processes a queue of pending requests, enabling hotspot for the first N requests,
29
+ * as specified by the hotspotLimit argument. The remaining requests have hotspot disabled.
30
+ */
31
+ export declare function runRequestsWithHotspotLimit(requests: RequestEntry<LexRequest>[], runner: RequestRunner<LexRequest, LexRequestOptions>, hotspotLimit: number): Promise<void>;
32
+ /**
33
+ * Compares two request entries based on their priority and, if the priorities are the same, their request times.
34
+ * This function is typically used for sorting requests where priority takes precedence, and timing is used
35
+ * as a secondary criterion. The function assumes that any necessary filtering of requests has already been done.
36
+ *
37
+ * @template Context - Extends `DefaultPageContext`, provides additional context for the request priority determination.
38
+ *
39
+ * @param {RequestEntry<LexRequest>} requestA - The first request entry containing the request and its metadata.
40
+ * @param {RequestEntry<LexRequest>} requestB - The second request entry containing the request and its metadata.
41
+ * @param {RequestStrategyManager} requestStrategyManager - Manager that provides access to request strategies based on adapter names.
42
+ * @param {Context} context - The context in which the requests are being compared, used to determine request priority.
43
+ *
44
+ * @returns {number} A negative number if the first request should come before the second, a positive number if the
45
+ * second should come before the first, or zero if they are considered equal for sorting purposes.
46
+ * This is determined first by the priority (higher priority comes first) and then by the request
47
+ * time (earlier request comes first) if priorities are the same. The priorities are fetched from
48
+ * the `requestStrategyManager` for each request's `adapterName`. If a strategy is not found,
49
+ * the priority defaults to `RequestPriority.LOW`.
50
+ */
51
+ export declare function compareByPriorityThenTime<Context extends DefaultPageContext = DefaultPageContext>({ request: requestA, requestMetadata: requestMetadataA }: RequestEntry<LexRequest>, { request: requestB, requestMetadata: requestMetadataB }: RequestEntry<LexRequest>, requestStrategyManager: RequestStrategyManager, context: Context): number;
52
+ export declare function isUseHotspotLimitOpen(): boolean;
@@ -0,0 +1,2 @@
1
+ export * from './prefetch-repository';
2
+ export * from './utils';
@@ -0,0 +1,31 @@
1
+ import type { PrefetchStorage } from '../storage';
2
+ import type { RequestEntry } from '../common';
3
+ type Key = Record<string, any>;
4
+ export type History = {
5
+ version: '1.0';
6
+ pages: Key[];
7
+ };
8
+ export type PageEntry<Request> = {
9
+ id: string;
10
+ recordTypeId?: string;
11
+ requests: RequestEntry<Request>[];
12
+ };
13
+ export type PrefetchRepositoryOptions<Request> = {
14
+ modifyBeforeSaveHook?: (requests: RequestEntry<Request>[]) => RequestEntry<Request>[];
15
+ modifyPageBeforeSavingHook?: (page: PageEntry<Request>) => void;
16
+ };
17
+ export declare class PrefetchRepository<Request> {
18
+ private storage;
19
+ private options;
20
+ private requestBuffer;
21
+ constructor(storage: PrefetchStorage, options?: PrefetchRepositoryOptions<Request>);
22
+ clearRequestBuffer(): void;
23
+ pageStartTime: number;
24
+ markPageStart(): void;
25
+ flushRequestsToStorage(): Promise<void>;
26
+ getKeyId(key: Key): string;
27
+ saveRequest<Request>(key: Key, request: Request): void;
28
+ getPage(key: Key): PageEntry<Request> | undefined;
29
+ getPageRequests(key: Key): RequestEntry<Request>[];
30
+ }
31
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
3
+ * This is needed because insertion order for JSON.stringify(object) affects output:
4
+ * JSON.stringify({a: 1, b: 2})
5
+ * "{"a":1,"b":2}"
6
+ * JSON.stringify({b: 2, a: 1})
7
+ * "{"b":2,"a":1}"
8
+ * @param data Data to be JSON-stringified.
9
+ * @returns JSON.stringified value with consistent ordering of keys.
10
+ */
11
+ export declare function stableJSONStringify(node: any): string | undefined;
12
+ export declare function isObject(obj: any): obj is Record<string, unknown>;
13
+ export declare function deepEquals(objA: any, objB: any): boolean;
@@ -0,0 +1,2 @@
1
+ export * from './request-runner';
2
+ export * from './lex-request-runner';
@@ -0,0 +1,10 @@
1
+ import type { RequestRunner } from './request-runner';
2
+ import type { RequestEntry } from '../common';
3
+ import type { LexRequest, LexRequestOptions } from '../lex';
4
+ import type { RequestStrategyManager } from '../request-strategy-manager/request-strategy-manager';
5
+ export declare class LexRequestRunner implements RequestRunner<LexRequest, LexRequestOptions> {
6
+ private requestStrategyManager;
7
+ constructor(requestStrategyManager: RequestStrategyManager);
8
+ reduceRequests(requests: RequestEntry<LexRequest>[]): RequestEntry<LexRequest>[];
9
+ runRequest(request: LexRequest, options?: LexRequestOptions): Promise<void>;
10
+ }
@@ -0,0 +1,5 @@
1
+ import type { RequestEntry } from '../common';
2
+ export type RequestRunner<Request, Options = Record<string, any>> = {
3
+ runRequest(request: Request, options?: Options): Promise<void>;
4
+ reduceRequests(requests: RequestEntry<Request>[]): RequestEntry<Request>[];
5
+ };
@@ -0,0 +1,30 @@
1
+ import type { ApexInvokerParams } from '@salesforce/lds-adapters-apex';
2
+ import type { AdapterRequestContext, Luvio } from '@luvio/engine';
3
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
4
+ import { RequestPriority } from './request-strategy';
5
+ import type { LexRequestOptions } from '../lex';
6
+ export type GetApexConfig = {
7
+ name: string;
8
+ invokerParams: ApexInvokerParams;
9
+ config: Record<string, any>;
10
+ };
11
+ export type GetApexRequest = {
12
+ adapterName: 'getApex';
13
+ config: GetApexConfig;
14
+ };
15
+ export declare function getApexPdlFactory(luvio: Luvio): ({ invokerParams, config }: GetApexConfig, requestContext?: AdapterRequestContext) => import("@luvio/engine").Snapshot<any> | Promise<import("@luvio/engine").Snapshot<any>> | null;
16
+ type GetApexContext = Record<string, unknown>;
17
+ export declare const GET_APEX_ADAPTER_NAME = "getApex";
18
+ export declare class GetApexRequestStrategy extends LuvioAdapterRequestStrategy<GetApexConfig, GetApexRequest, GetApexContext> {
19
+ adapterName: string;
20
+ adapterFactory: typeof getApexPdlFactory;
21
+ buildConcreteRequest(similarRequest: GetApexRequest): GetApexRequest;
22
+ protected createAdapterContext(_options: LexRequestOptions): {
23
+ sourceContext: {
24
+ actionConfig: undefined;
25
+ tagName: string;
26
+ };
27
+ };
28
+ getRequestPriority(_request: GetApexRequest, _context: GetApexContext): RequestPriority;
29
+ }
30
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { GetListInfoByNameConfig } from '@salesforce/lds-adapters-uiapi';
2
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
3
+ export type GetListInfoByNameRequest = {
4
+ adapterName: 'getListInfoByName';
5
+ config: GetListInfoByNameConfig;
6
+ };
7
+ export declare const GET_LIST_INFO_BY_NAME_ADAPTER_NAME = "getListInfoByName";
8
+ export type GetListInfoByNameContext = {
9
+ objectApiName: string;
10
+ listViewApiName: string;
11
+ };
12
+ export declare class GetListInfoByNameRequestStrategy extends LuvioAdapterRequestStrategy<GetListInfoByNameConfig, GetListInfoByNameRequest, GetListInfoByNameContext> {
13
+ adapterName: string;
14
+ adapterFactory: import("@luvio/engine").AdapterFactory<GetListInfoByNameConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListInfoRepresentation").ListInfoRepresentation>;
15
+ buildConcreteRequest(similarRequest: GetListInfoByNameRequest): GetListInfoByNameRequest;
16
+ transformForSave(request: GetListInfoByNameRequest): GetListInfoByNameRequest;
17
+ canCombine(reqA: GetListInfoByNameConfig, reqB: GetListInfoByNameConfig): boolean;
18
+ combineRequests(reqA: GetListInfoByNameConfig, _reqB: GetListInfoByNameConfig): GetListInfoByNameConfig;
19
+ }
@@ -0,0 +1,19 @@
1
+ import type { GetListInfosByObjectNameConfig } from '@salesforce/lds-adapters-uiapi';
2
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
3
+ export type GetListInfosByObjectNameRequest = {
4
+ adapterName: 'getListInfosByObjectName';
5
+ config: GetListInfosByObjectNameConfig;
6
+ };
7
+ export declare const GET_LIST_INFOS_BY_OBJECT_NAME_ADAPTER_NAME = "getListInfosByObjectName";
8
+ export type GetListInfosByObjectNameContext = {
9
+ objectApiName: string;
10
+ listViewApiName: string;
11
+ };
12
+ export declare class GetListInfosByObjectNameRequestStrategy extends LuvioAdapterRequestStrategy<GetListInfosByObjectNameConfig, GetListInfosByObjectNameRequest, GetListInfosByObjectNameContext> {
13
+ adapterName: string;
14
+ adapterFactory: import("@luvio/engine").AdapterFactory<GetListInfosByObjectNameConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListInfoSummaryCollectionRepresentation").ListInfoSummaryCollectionRepresentation>;
15
+ buildConcreteRequest(similarRequest: GetListInfosByObjectNameRequest): GetListInfosByObjectNameRequest;
16
+ transformForSave(request: GetListInfosByObjectNameRequest): GetListInfosByObjectNameRequest;
17
+ canCombine(reqA: GetListInfosByObjectNameConfig, reqB: GetListInfosByObjectNameConfig): boolean;
18
+ combineRequests(reqA: GetListInfosByObjectNameConfig, _reqB: GetListInfosByObjectNameConfig): GetListInfosByObjectNameConfig;
19
+ }
@@ -0,0 +1,18 @@
1
+ import type { GetListObjectInfoConfig } from '@salesforce/lds-adapters-uiapi';
2
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
3
+ export type GetListObjectInfoRequest = {
4
+ adapterName: 'getListObjectInfo';
5
+ config: GetListObjectInfoConfig;
6
+ };
7
+ export declare const GET_LIST_OBJECT_INFO_ADAPTER_NAME = "getListObjectInfo";
8
+ export type GetListObjectInfoContext = {
9
+ objectApiName: string;
10
+ };
11
+ export declare class GetListObjectInfoRequestStrategy extends LuvioAdapterRequestStrategy<GetListObjectInfoConfig, GetListObjectInfoRequest, GetListObjectInfoContext> {
12
+ adapterName: string;
13
+ adapterFactory: import("@luvio/engine").AdapterFactory<GetListObjectInfoConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListObjectInfoRepresentation").ListObjectInfoRepresentation>;
14
+ buildConcreteRequest(similarRequest: GetListObjectInfoRequest): GetListObjectInfoRequest;
15
+ transformForSave(request: GetListObjectInfoRequest): GetListObjectInfoRequest;
16
+ canCombine(reqA: GetListObjectInfoConfig, reqB: GetListObjectInfoConfig): boolean;
17
+ combineRequests(reqA: GetListObjectInfoConfig, _reqB: GetListObjectInfoConfig): GetListObjectInfoConfig;
18
+ }
@@ -0,0 +1,19 @@
1
+ import type { GetListRecordsByNameConfig } from '@salesforce/lds-adapters-uiapi';
2
+ import { LuvioAdapterRequestStrategy } from './luvio-adapter-request-strategy';
3
+ export type GetListRecordsByNameRequest = {
4
+ adapterName: 'getListRecordsByName';
5
+ config: GetListRecordsByNameConfig;
6
+ };
7
+ export declare const GET_LIST_RECORDS_BY_NAME_ADAPTER_NAME = "getListRecordsByName";
8
+ export type GetListRecordsByNameContext = {
9
+ objectApiName: string;
10
+ listViewApiName: string;
11
+ };
12
+ export declare class GetListRecordsByNameRequestStrategy extends LuvioAdapterRequestStrategy<GetListRecordsByNameConfig, GetListRecordsByNameRequest, GetListRecordsByNameContext> {
13
+ adapterName: string;
14
+ adapterFactory: import("@luvio/engine").AdapterFactory<GetListRecordsByNameConfig, import("packages/lds-adapters-uiapi/dist/es/es2018/types/src/generated/types/ListRecordCollectionRepresentation").ListRecordCollectionRepresentation>;
15
+ buildConcreteRequest(similarRequest: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
16
+ transformForSave(request: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
17
+ canCombine(reqA: GetListRecordsByNameConfig, reqB: GetListRecordsByNameConfig): boolean;
18
+ combineRequests(reqA: GetListRecordsByNameConfig, _reqB: GetListRecordsByNameConfig): GetListRecordsByNameConfig;
19
+ }