@salesforce/lds-runtime-aura 0.1.0-dev1

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 (80) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/ldsEngineCreator.js +7215 -0
  3. package/dist/types/__mocks__/@salesforce/lds-ads-bridge.d.ts +2 -0
  4. package/dist/types/__mocks__/@salesforce/lds-aura-storage.d.ts +1 -0
  5. package/dist/types/__mocks__/@salesforce/lds-instrumentation.d.ts +15 -0
  6. package/dist/types/__mocks__/@salesforce/lds-network-aura.d.ts +4 -0
  7. package/dist/types/__mocks__/@salesforce/lds-network-fetch.d.ts +2 -0
  8. package/dist/types/__mocks__/aura.d.ts +3 -0
  9. package/dist/types/__mocks__/force/ldsGraphqlParser.d.ts +3 -0
  10. package/dist/types/__mocks__/instrumentation/service.d.ts +33 -0
  11. package/dist/types/__mocks__/instrumentation:beaconLib.d.ts +7 -0
  12. package/dist/types/__mocks__/lwc.d.ts +6 -0
  13. package/dist/types/__mocks__/o11y/activity.d.ts +12 -0
  14. package/dist/types/__mocks__/o11y/client.d.ts +11 -0
  15. package/dist/types/__mocks__/o11y/idleDetector.d.ts +18 -0
  16. package/dist/types/__mocks__/o11y/instrumentation.d.ts +15 -0
  17. package/dist/types/__mocks__/o11y_schema/sf_lds.d.ts +1 -0
  18. package/dist/types/aura-instrumentation/main.d.ts +181 -0
  19. package/dist/types/aura-instrumentation/utils/observability.d.ts +36 -0
  20. package/dist/types/aura-instrumentation/utils/utils.d.ts +13 -0
  21. package/dist/types/jwt-authorized-fetch-service.d.ts +14 -0
  22. package/dist/types/language.d.ts +23 -0
  23. package/dist/types/lex-fetch-service.d.ts +3 -0
  24. package/dist/types/main.d.ts +63 -0
  25. package/dist/types/metadata.d.ts +5 -0
  26. package/dist/types/network-adapter.d.ts +2 -0
  27. package/dist/types/network-fetch.d.ts +7 -0
  28. package/dist/types/network-instrumentation.d.ts +2 -0
  29. package/dist/types/network-sfap.d.ts +17 -0
  30. package/dist/types/predictive-loading/common/index.d.ts +17 -0
  31. package/dist/types/predictive-loading/index.d.ts +7 -0
  32. package/dist/types/predictive-loading/lex/index.d.ts +17 -0
  33. package/dist/types/predictive-loading/lex/predictions-ready-manager.d.ts +32 -0
  34. package/dist/types/predictive-loading/pages/abstract-home-page.d.ts +17 -0
  35. package/dist/types/predictive-loading/pages/index.d.ts +4 -0
  36. package/dist/types/predictive-loading/pages/lex-default-page.d.ts +15 -0
  37. package/dist/types/predictive-loading/pages/object-home-page.d.ts +23 -0
  38. package/dist/types/predictive-loading/pages/predictive-prefetch-page.d.ts +12 -0
  39. package/dist/types/predictive-loading/pages/record-home-page.d.ts +26 -0
  40. package/dist/types/predictive-loading/prefetcher/index.d.ts +2 -0
  41. package/dist/types/predictive-loading/prefetcher/lex-predictive-prefetcher.d.ts +17 -0
  42. package/dist/types/predictive-loading/prefetcher/predictive-prefetcher.d.ts +34 -0
  43. package/dist/types/predictive-loading/prefetcher/utils.d.ts +52 -0
  44. package/dist/types/predictive-loading/repository/index.d.ts +2 -0
  45. package/dist/types/predictive-loading/repository/prefetch-repository.d.ts +31 -0
  46. package/dist/types/predictive-loading/repository/utils.d.ts +13 -0
  47. package/dist/types/predictive-loading/request-runner/index.d.ts +2 -0
  48. package/dist/types/predictive-loading/request-runner/lex-request-runner.d.ts +10 -0
  49. package/dist/types/predictive-loading/request-runner/request-runner.d.ts +5 -0
  50. package/dist/types/predictive-loading/request-strategy/get-apex-request-strategy.d.ts +30 -0
  51. package/dist/types/predictive-loading/request-strategy/get-components-request-strategy.d.ts +31 -0
  52. package/dist/types/predictive-loading/request-strategy/get-list-info-by-name-request-strategy.d.ts +19 -0
  53. package/dist/types/predictive-loading/request-strategy/get-list-infos-by-object-name-request-strategy.d.ts +19 -0
  54. package/dist/types/predictive-loading/request-strategy/get-list-object-info-request-strategy.d.ts +18 -0
  55. package/dist/types/predictive-loading/request-strategy/get-list-records-by-name-request-strategy.d.ts +19 -0
  56. package/dist/types/predictive-loading/request-strategy/get-object-info-request-strategy.d.ts +26 -0
  57. package/dist/types/predictive-loading/request-strategy/get-object-infos-request-strategy.d.ts +25 -0
  58. package/dist/types/predictive-loading/request-strategy/get-record-actions-request-strategy.d.ts +20 -0
  59. package/dist/types/predictive-loading/request-strategy/get-record-avatars-request-strategy.d.ts +20 -0
  60. package/dist/types/predictive-loading/request-strategy/get-record-request-strategy.d.ts +21 -0
  61. package/dist/types/predictive-loading/request-strategy/get-records-request-strategy.d.ts +18 -0
  62. package/dist/types/predictive-loading/request-strategy/get-related-list-actions-request-strategy.d.ts +21 -0
  63. package/dist/types/predictive-loading/request-strategy/get-related-list-info-batch-request-strategy.d.ts +24 -0
  64. package/dist/types/predictive-loading/request-strategy/get-related-list-info-request-strategy.d.ts +50 -0
  65. package/dist/types/predictive-loading/request-strategy/get-related-list-records-batch-request-strategy.d.ts +32 -0
  66. package/dist/types/predictive-loading/request-strategy/get-related-list-records-request-strategy.d.ts +34 -0
  67. package/dist/types/predictive-loading/request-strategy/get-related-lists-actions-request-strategy.d.ts +28 -0
  68. package/dist/types/predictive-loading/request-strategy/get-related-lists-info-strategy.d.ts +30 -0
  69. package/dist/types/predictive-loading/request-strategy/index.d.ts +21 -0
  70. package/dist/types/predictive-loading/request-strategy/lex-request-strategy.d.ts +13 -0
  71. package/dist/types/predictive-loading/request-strategy/luvio-adapter-request-strategy.d.ts +27 -0
  72. package/dist/types/predictive-loading/request-strategy/request-strategy.d.ts +79 -0
  73. package/dist/types/predictive-loading/request-strategy-manager/request-strategy-manager.d.ts +12 -0
  74. package/dist/types/predictive-loading/storage/aura-prefetch-storage.d.ts +25 -0
  75. package/dist/types/predictive-loading/storage/in-memory-prefetch-storage.d.ts +6 -0
  76. package/dist/types/predictive-loading/storage/index.d.ts +8 -0
  77. package/dist/types/predictive-loading/storage/local-prefetch-storage.d.ts +7 -0
  78. package/dist/types/response-interceptors/lex-runtime-5xx-status.d.ts +16 -0
  79. package/dist/types/response-interceptors/lex-runtime-auth-expiration-redirect.d.ts +3 -0
  80. package/package.json +92 -0
@@ -0,0 +1,2 @@
1
+ export default function (): void;
2
+ export declare function instrument(): void;
@@ -0,0 +1 @@
1
+ export declare function clearStorages(): Promise<void>;
@@ -0,0 +1,15 @@
1
+ export declare function setupInstrumentation(): void;
2
+ export declare function LRUCache(): Map<any, any>;
3
+ export declare function incrementCounterMetric(): void;
4
+ export declare function updatePercentileHistogramMetric(): void;
5
+ export declare function instrumentAdapter<_C, _D>(adapter: any, _metadata: any): any;
6
+ export declare function instrumentLuvio(): void;
7
+ export declare function instrumentStoreMethods(): void;
8
+ export declare function setLdsAdaptersUiapiInstrumentation(): void;
9
+ export declare function setLdsNetworkAdapterInstrumentation(): void;
10
+ export declare function logObjectInfoChanged(): void;
11
+ export declare function executeAsyncActivity(_name: string, execute: (act: any) => Promise<void>, _options?: any): Promise<void>;
12
+ export declare const METRIC_KEYS: {
13
+ PREDICTIVE_DATA_LOADING_PREDICT: string;
14
+ PREDICTIVE_DATA_LOADING_SAVE_REQUEST: string;
15
+ };
@@ -0,0 +1,4 @@
1
+ export default function (): void;
2
+ export declare function instrument(): void;
3
+ export declare function ldsNetworkAdapterInstrument(): void;
4
+ export declare const forceRecordTransactionsDisabled = false;
@@ -0,0 +1,2 @@
1
+ export declare function setupLexNetworkAdapter(): void;
2
+ export declare function instrument(): void;
@@ -0,0 +1,3 @@
1
+ /// <reference types="jest" />
2
+ declare const executeGlobalControllerRawResponse: jest.Mock<any, any, any>;
3
+ export { executeGlobalControllerRawResponse };
@@ -0,0 +1,3 @@
1
+ /// <reference types="jest" />
2
+ declare const astResolver: jest.Mock<any, any, any>;
3
+ export { astResolver };
@@ -0,0 +1,33 @@
1
+ export declare function counter(): {
2
+ increment(): void;
3
+ decrement(): void;
4
+ getValue(): void;
5
+ reset(): void;
6
+ };
7
+ export declare function gauge(): {
8
+ setValue(): void;
9
+ getValue(): void;
10
+ reset(): void;
11
+ };
12
+ export declare function mark(): void;
13
+ export declare function markStart(): void;
14
+ export declare function markEnd(): void;
15
+ export declare function perfStart(): void;
16
+ export declare function perfEnd(): void;
17
+ export declare function percentileHistogram(): {
18
+ update(): void;
19
+ getValue(): void;
20
+ reset(): void;
21
+ };
22
+ export declare function time(): void;
23
+ export declare function timer(): {
24
+ addDuration(): void;
25
+ getValue(): void;
26
+ time(): void;
27
+ };
28
+ export declare function registerCacheStats(): {
29
+ logHits(): void;
30
+ logMisses(): void;
31
+ };
32
+ export declare function registerPlugin(): void;
33
+ export declare function registerPeriodicLogger(): void;
@@ -0,0 +1,7 @@
1
+ declare function registerHandler(_cmp: any, _name: string, _loadedCheck: () => boolean): void;
2
+ declare function markLoaded(_cmp: any): void;
3
+ export declare const ThirdPartyTracker: {
4
+ registerHandler: typeof registerHandler;
5
+ markLoaded: typeof markLoaded;
6
+ };
7
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="jest" />
2
+ export declare const setTrustedSignalSet: jest.Mock<any, any, any>;
3
+ export declare const setTrustedContextSet: jest.Mock<any, any, any>;
4
+ export declare const setContextKeys: jest.Mock<any, any, any>;
5
+ export declare const __dangerous_do_not_use_addTrustedContext: jest.Mock<any, any, any>;
6
+ export declare const isTrustedSignal: jest.Mock<any, any, any>;
@@ -0,0 +1,12 @@
1
+ declare function stop(_userSchemaOrText?: any | string, _userData?: any): void;
2
+ declare function error(_error: Error, _userSchemaOrText?: any | string, _userData?: any): void;
3
+ declare function discard(): void;
4
+ declare function terminate(): void;
5
+ export declare const activity: {
6
+ stop: typeof stop;
7
+ error: typeof error;
8
+ discard: typeof discard;
9
+ terminate: typeof terminate;
10
+ getId: () => string;
11
+ };
12
+ export {};
@@ -0,0 +1,11 @@
1
+ export { activity } from './activity';
2
+ export { instrumentation } from './instrumentation';
3
+ export { idleDetector } from './idleDetector';
4
+ export declare function getInstrumentation(_name: string): {
5
+ log: (_schema: any, _data?: any) => void;
6
+ error: (_error: unknown, _userSchemaOrText?: any, _userData?: any) => void;
7
+ startActivity: (_name: string) => any;
8
+ incrementCounter: (_operation: string, _increment?: number | undefined, _hasError?: boolean | undefined, _tags?: any) => void;
9
+ trackValue: (_operation: string, _value: number, _hasError?: boolean | undefined, _tags?: any) => void;
10
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
11
+ };
@@ -0,0 +1,18 @@
1
+ declare function requestIdleDetectedCallback(_callback: any): void;
2
+ declare function declareNotifierTaskSingle(_name: string): {
3
+ isBusy: boolean;
4
+ done: () => void;
5
+ };
6
+ declare function declareNotifierTaskMulti(_name: string, _existingBusyCount?: number): {
7
+ isBusy: boolean;
8
+ add: () => void;
9
+ done: () => void;
10
+ };
11
+ declare function declarePollableTaskMulti(_name: string, _isBusyChecker: any): void;
12
+ export declare const idleDetector: {
13
+ requestIdleDetectedCallback: typeof requestIdleDetectedCallback;
14
+ declareNotifierTaskSingle: typeof declareNotifierTaskSingle;
15
+ declareNotifierTaskMulti: typeof declareNotifierTaskMulti;
16
+ declarePollableTaskMulti: typeof declarePollableTaskMulti;
17
+ };
18
+ export {};
@@ -0,0 +1,15 @@
1
+ declare function log(_schema: any, _data?: any): void;
2
+ declare function error(_error: unknown, _userSchemaOrText?: any | string, _userData?: any): void;
3
+ declare function startActivity(_name: string): any;
4
+ declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
5
+ declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
6
+ declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
7
+ export declare const instrumentation: {
8
+ log: typeof log;
9
+ error: typeof error;
10
+ startActivity: typeof startActivity;
11
+ incrementCounter: typeof incrementCounter;
12
+ trackValue: typeof trackValue;
13
+ bucketValue: typeof bucketValue;
14
+ };
15
+ export {};
@@ -0,0 +1 @@
1
+ export declare const adapterUnfulfilledErrorSchema: {};
@@ -0,0 +1,181 @@
1
+ import type { FetchResponse, Luvio, InMemoryStore, Adapter, UnfulfilledSnapshot } from '@luvio/engine';
2
+ import type { AdapterMetadata } from '@salesforce/lds-bindings';
3
+ import { ADAPTER_UNFULFILLED_ERROR } from '@salesforce/lds-bindings';
4
+ import type { CacheStatsLogger, Timer } from 'instrumentation/service';
5
+ import { onIdleDetected, executeAsyncActivity } from '@salesforce/lds-instrumentation';
6
+ export { onIdleDetected, executeAsyncActivity };
7
+ export interface AdapterUnfulfilledError {
8
+ [ADAPTER_UNFULFILLED_ERROR]: boolean;
9
+ adapterName: string;
10
+ missingPaths: UnfulfilledSnapshot<any, any>['missingPaths'];
11
+ missingLinks: UnfulfilledSnapshot<any, any>['missingLinks'];
12
+ }
13
+ export declare const APEX_ADAPTER_NAME = "getApex";
14
+ export declare const NORMALIZED_APEX_ADAPTER_NAME: string;
15
+ export declare const REFRESH_APEX_KEY = "refreshApex";
16
+ export declare const REFRESH_UIAPI_KEY = "refreshUiApi";
17
+ export declare const SUPPORTED_KEY = "refreshSupported";
18
+ export declare const UNSUPPORTED_KEY = "refreshUnsupported";
19
+ type refreshApiNames = {
20
+ refreshApex: string;
21
+ refreshUiApi: string;
22
+ };
23
+ export interface LightningInteractionSchema {
24
+ target: string;
25
+ scope: string;
26
+ context: unknown;
27
+ eventSource: string;
28
+ eventType: string;
29
+ attributes: unknown;
30
+ }
31
+ export declare class Instrumentation {
32
+ private adapterUnfulfilledErrorCounters;
33
+ private recordApiNameChangeCounters;
34
+ private refreshAdapterEvents;
35
+ private refreshApiCallEventStats;
36
+ private lastRefreshApiCall;
37
+ private weakEtagZeroEvents;
38
+ private adapterCacheMisses;
39
+ constructor();
40
+ /**
41
+ * Instruments an existing adapter to log argus metrics and cache stats.
42
+ * @param adapter The adapter function.
43
+ * @param metadata The adapter metadata.
44
+ * @param wireConfigKeyFn Optional function to transform wire configs to a unique key.
45
+ * @returns The wrapped adapter.
46
+ */
47
+ instrumentAdapter<C, D>(adapter: Adapter<C, D>, metadata: AdapterMetadata): Adapter<C, D>;
48
+ /**
49
+ * Logs when adapter requests come in. If we have subsequent cache misses on a given config, beyond its TTL then log the duration to metrics.
50
+ * Backed by an LRU Cache implementation to prevent too many record entries from being stored in-memory.
51
+ * @param name The wire adapter name.
52
+ * @param config The config passed into wire adapter.
53
+ * @param ttlMissStats CacheStatsLogger to log misses out of TTL.
54
+ * @param currentCacheMissTimestamp Timestamp for when the request was made.
55
+ * @param ttl TTL for the wire adapter.
56
+ */
57
+ private logAdapterCacheMissOutOfTtlDuration;
58
+ /**
59
+ * Injected to LDS for Luvio specific instrumentation.
60
+ *
61
+ * @param context The transaction context.
62
+ */
63
+ instrumentLuvio(context: unknown): void;
64
+ /**
65
+ * Returns whether or not this is a RefreshAdapterEvent.
66
+ * @param context The transaction context.
67
+ * @returns Whether or not this is a RefreshAdapterEvent.
68
+ */
69
+ private isRefreshAdapterEvent;
70
+ /**
71
+ * Returns whether or not this is an AdapterUnfulfilledError.
72
+ * @param context The transaction context.
73
+ * @returns Whether or not this is an AdapterUnfulfilledError.
74
+ */
75
+ private isAdapterUnfulfilledError;
76
+ /**
77
+ * Specific instrumentation for getRecordNotifyChange.
78
+ * temporary implementation to match existing aura call for now
79
+ *
80
+ * @param uniqueWeakEtags whether weakEtags match or not
81
+ * @param error if dispatchResourceRequest fails for any reason
82
+ */
83
+ notifyChangeNetwork(uniqueWeakEtags: boolean | null, error?: boolean): void;
84
+ /**
85
+ * Parses and aggregates weakETagZero events to be sent in summarized log line.
86
+ * @param context The transaction context.
87
+ */
88
+ aggregateWeakETagEvents(incomingWeakEtagZero: boolean, existingWeakEtagZero: boolean, apiName: string): void;
89
+ /**
90
+ * Aggregates refresh adapter events to be sent in summarized log line.
91
+ * - how many times refreshApex is called
92
+ * - how many times refresh from lightning/uiRecordApi is called
93
+ * - number of supported calls: refreshApex called on apex adapter
94
+ * - number of unsupported calls: refreshApex on non-apex adapter
95
+ * + any use of refresh from uiRecordApi module
96
+ * - count of refresh calls per adapter
97
+ * @param context The refresh adapter event.
98
+ */
99
+ private aggregateRefreshAdapterEvents;
100
+ /**
101
+ * Increments call stat for incoming refresh api call, and sets the name
102
+ * to be used in {@link aggregateRefreshCalls}
103
+ * @param from The name of the refresh function called.
104
+ */
105
+ handleRefreshApiCall(apiName: keyof refreshApiNames): void;
106
+ /**
107
+ * W-7302241
108
+ * Logs refresh call summary stats as a LightningInteraction.
109
+ */
110
+ logRefreshStats(): void;
111
+ /**
112
+ * Resets the stat trackers for refresh call events.
113
+ */
114
+ private resetRefreshStats;
115
+ /**
116
+ * W-7801618
117
+ * Counter for occurrences where the incoming record to be merged has a different apiName.
118
+ * Dynamically generated metric, stored in an {@link RecordApiNameChangeCounters} object.
119
+ *
120
+ * @param context The transaction context.
121
+ *
122
+ * Note: Short-lived metric candidate, remove at the end of 230
123
+ */
124
+ incrementRecordApiNameChangeCount(_incomingApiName: string, existingApiName: string): void;
125
+ /**
126
+ * W-8620679
127
+ * Increment the counter for an UnfulfilledSnapshotError coming from luvio
128
+ *
129
+ * @param context The transaction context.
130
+ */
131
+ private incrementAdapterRequestErrorCount;
132
+ }
133
+ /**
134
+ * Calls instrumentation/service interaction API. Function name and parameters mapped to `o11y`
135
+ * implementation for Log Lines.
136
+ * @param schema Expected shape of the payload (Currently unused)
137
+ * @param payload Content to be logged, shape matches schema
138
+ */
139
+ export declare function log(_schema: any, payload: LightningInteractionSchema): void;
140
+ /**
141
+ * Calls instrumentation/service telemetry timer
142
+ * @param name Name of the metric
143
+ * @param duration number to update backing percentile histogram, negative numbers ignored
144
+ */
145
+ export declare function updateTimerMetric(name: string, duration: number): void;
146
+ export declare function timerMetricAddDuration(timer: Timer, duration: number): void;
147
+ export declare function incrementRequestResponseCount(cb: () => FetchResponse<unknown>): void;
148
+ /**
149
+ * Add a mark to the metrics service.
150
+ *
151
+ * @param name The mark name.
152
+ * @param content The mark content.
153
+ */
154
+ export declare function mark(name: string, content?: any): void;
155
+ export declare function logObjectInfoChanged(): void;
156
+ /**
157
+ * Create a new instrumentation cache stats and return it.
158
+ *
159
+ * @param name The cache logger name.
160
+ */
161
+ export declare function registerLdsCacheStats(name: string): CacheStatsLogger;
162
+ /**
163
+ * Add or overwrite hooks that require aura implementations
164
+ */
165
+ export declare function setAuraInstrumentationHooks(): void;
166
+ export declare function setStateManagerInstrumentationHooks(): void;
167
+ /**
168
+ * Initialize the instrumentation and instrument the LDS instance and the InMemoryStore.
169
+ *
170
+ * @param luvio The Luvio instance to instrument.
171
+ * @param store The InMemoryStore to instrument.
172
+ */
173
+ export declare function setupInstrumentation(luvio: Luvio, store: InMemoryStore): void;
174
+ /**
175
+ * Note: locator.scope is set to 'force_record' in order for the instrumentation gate to work, which will
176
+ * disable all crud operations if it is on.
177
+ * @param eventSource - Source of the logging event.
178
+ * @param attributes - Free form object of attributes to log.
179
+ */
180
+ export declare function logCRUDLightningInteraction(eventSource: string, attributes: object): void;
181
+ export declare const instrumentation: Instrumentation;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Observability / Critical Availability Program (230+)
3
+ *
4
+ * This file is intended to be used as a consolidated place for all definitions, functions,
5
+ * and helpers related to "M1"[1].
6
+ *
7
+ * Below are the R.E.A.D.S. metrics for the Lightning Data Service, defined here[2].
8
+ *
9
+ * [1] Search "[M1] Lightning Data Service Design Spike" in Quip
10
+ * [2] Search "Lightning Data Service R.E.A.D.S. Metrics" in Quip
11
+ */
12
+ import type { MetricsKey } from 'instrumentation/service';
13
+ export declare const OBSERVABILITY_NAMESPACE = "LIGHTNING.lds.service";
14
+ export declare const ADAPTER_INVOCATION_COUNT_METRIC_NAME = "request";
15
+ export declare const ADAPTER_ERROR_COUNT_METRIC_NAME = "error";
16
+ export declare const NETWORK_ADAPTER_RESPONSE_METRIC_NAME = "network-response";
17
+ /**
18
+ * W-8379680
19
+ * Counter for number of getApex requests.
20
+ */
21
+ export declare const GET_APEX_REQUEST_COUNT: MetricsKey;
22
+ /**
23
+ * W-8379680
24
+ * Counter for number of getApex errors.
25
+ */
26
+ export declare const GET_APEX_ERROR_COUNT: MetricsKey;
27
+ /**
28
+ * W-8828410
29
+ * Counter for the number of UnfulfilledSnapshotErrors the luvio engine has.
30
+ */
31
+ export declare const TOTAL_ADAPTER_ERROR_COUNT: MetricsKey;
32
+ /**
33
+ * W-8828410
34
+ * Counter for the number of invocations made into LDS by a wire adapter.
35
+ */
36
+ export declare const TOTAL_ADAPTER_REQUEST_SUCCESS_COUNT: MetricsKey;
@@ -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
+ * Modified from the apex implementation to sort arrays non-destructively.
9
+ * @param data Data to be JSON-stringified.
10
+ * @returns JSON.stringified value with consistent ordering of keys.
11
+ */
12
+ export declare function stableJSONStringify(node: any): string | undefined;
13
+ export declare function isPromise<D>(value: D | Promise<D> | null): value is Promise<D>;
@@ -0,0 +1,14 @@
1
+ import { type FetchServiceDescriptor } from '@luvio/service-fetch-network/v1';
2
+ import { type LoggerService } from '@luvio/utils';
3
+ export declare function buildJwtAuthorizedSfapFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
4
+ /**
5
+ * Returns a service descriptor for a fetch service that includes one-off copilot
6
+ * hacks. This fetch service is not intended for use by anything other than
7
+ * copilot commands.
8
+ */
9
+ export declare function buildCopilotFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
10
+ export declare const lightningJwtResolver: {
11
+ getJwt(): Promise<any>;
12
+ };
13
+ export declare function buildJwtAuthorizedLightningFetchServiceDescriptor(): FetchServiceDescriptor;
14
+ export declare function buildUnauthorizedFetchServiceDescriptor(): FetchServiceDescriptor;
@@ -0,0 +1,23 @@
1
+ declare const create: {
2
+ (o: object | null): any;
3
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
4
+ }, keys: {
5
+ (o: object): string[];
6
+ (o: {}): string[];
7
+ }, hasOwnProperty: (v: PropertyKey) => boolean, entries: {
8
+ <T>(o: {
9
+ [s: string]: T;
10
+ } | ArrayLike<T>): [string, T][];
11
+ (o: {}): [string, any][];
12
+ };
13
+ declare const isArray: (arg: any) => arg is any[], from: {
14
+ <T>(arrayLike: ArrayLike<T>): T[];
15
+ <T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
16
+ <T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
17
+ <T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
18
+ };
19
+ declare const stringify: {
20
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
21
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
22
+ };
23
+ export { create as ObjectCreate, keys as ObjectKeys, hasOwnProperty as ObjectHasOwnProperty, entries as ObjectEntries, isArray as ArrayIsArray, from as ArrayFrom, stringify as JSONStringify, };
@@ -0,0 +1,3 @@
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;
@@ -0,0 +1,63 @@
1
+ import { Luvio } from '@luvio/engine';
2
+ import { KeyParamsRecord } from '@salesforce/lds-adapters-uiapi';
3
+ import { ObjectHomePageContext, type RecordHomePageContext } from './predictive-loading';
4
+ import type { LexRequestStrategy } from './predictive-loading/request-strategy/lex-request-strategy';
5
+ import { type LexRequest } from './predictive-loading/lex';
6
+ export { PdlRequestPriority } from './predictive-loading';
7
+ export { LexRequestStrategy } from './predictive-loading/request-strategy/lex-request-strategy';
8
+ /**
9
+ * Registers a request strategy to be utilized by PDL.
10
+ * @param requestStrategy - {@link LexRequestStrategy} The request strategy/strategies to register.
11
+ * @returns boolean | boolean[] - true/false depending on registration success.
12
+ */
13
+ export declare function registerRequestStrategy(...requestStrategy: LexRequestStrategy[]): boolean | boolean[];
14
+ /**
15
+ * Unregisters a request strategy to be utilized by PDL.
16
+ * @param requestStrategy - {@link LexRequestStrategy} The request strategy to unregister.
17
+ * @returns boolean | boolean[] - true/false depending on unregistration success.
18
+ */
19
+ export declare function unregisterRequestStrategy(...requestStrategy: LexRequestStrategy[]): boolean | boolean[];
20
+ export declare function whenPredictionsReady(callback: () => void): void;
21
+ export declare function saveRequestAsPrediction(request: LexRequest): void;
22
+ export declare const notifyUpdateAvailableFactory: (luvio: Luvio) => (configs: Partial<KeyParamsRecord>[]) => Promise<void>;
23
+ /**
24
+ * @typedef {Object} RecordHomePageContext
25
+ * @property {string} objectApiName - The API name of the object.
26
+ * @property {string} recordId - The unique identifier for the record.
27
+ * @property {string} actionName - The name of the action being performed.
28
+ * @property {'recordPage'} type - The type of the context, specifically for a record page.
29
+ */
30
+ /**
31
+ * Builds a predictor for a given record home page context. This predictor is responsible for
32
+ * preloading data based on predictions for the current context and create new predictions based
33
+ * on page requests of this context.
34
+ *
35
+ * @param {RecordHomePageContext} context - The context for which the predictor is to be built.
36
+ * @returns {{
37
+ * hasPredictions: () => boolean,
38
+ * watchPageLoadForPredictions: () => void,
39
+ * runPredictions: () => ReturnType<Promise<void>>,
40
+ * getPredictionSummary: () => Map<String,Number>
41
+ * }} An object containing methods to handle predictions:
42
+ * - hasPredictions: Checks if there are any predictions available.
43
+ * - watchPageLoadForPredictions: Starts recording the page request for prediction purposes.
44
+ * - runPredictions: Executes the predictions based on the recorded data and returns a promise
45
+ * of when those predictions are completed.
46
+ * - getPredictionSummary: Returns the count of exact and similar prediction requests
47
+ */
48
+ export declare function buildPredictorForContext(context: RecordHomePageContext | ObjectHomePageContext): {
49
+ hasPredictions(): boolean;
50
+ watchPageLoadForPredictions(): void;
51
+ runPredictions(): Promise<void>;
52
+ getPredictionSummary(): {
53
+ exact: number;
54
+ similar: number;
55
+ totalRequestCount: Number;
56
+ };
57
+ } | undefined;
58
+ export declare function initializeLDS(): Luvio;
59
+ export declare function initializeOneStore(luvio: Luvio): void;
60
+ declare function ldsEngineCreator(): {
61
+ name: string;
62
+ };
63
+ export default ldsEngineCreator;
@@ -0,0 +1,5 @@
1
+ import type { Luvio } from '@luvio/engine';
2
+ /**
3
+ * Watch a Luvio instance for metadata changes.
4
+ */
5
+ export declare function setupMetadataWatcher(luvio: Luvio): void;
@@ -0,0 +1,2 @@
1
+ declare const composedNetworkAdapter: import("@luvio/engine").NetworkAdapter;
2
+ export default composedNetworkAdapter;
@@ -0,0 +1,7 @@
1
+ import { type ResourceRequest } from '@luvio/engine';
2
+ import type { RequestLogger } from '@salesforce/lds-network-fetch';
3
+ export declare const requestLogger: RequestLogger;
4
+ export declare const composedFetchNetworkAdapter: {
5
+ shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
6
+ adapter: import("@luvio/engine").NetworkAdapter;
7
+ };
@@ -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,17 @@
1
+ import type { FetchResponse, ResourceRequest, ResourceRequestContext } from '@luvio/engine';
2
+ import type { JwtResolver } from '@luvio/jwt-manager';
3
+ export declare const SFAPController = "SalesforceApiPlatformController";
4
+ export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
5
+ export type ExtraInfo = {
6
+ baseUri: string;
7
+ };
8
+ /**
9
+ * Resolves Jwt token for SFAP by calling Aura action
10
+ * {@link JwtResolver} for platform SFAP
11
+ */
12
+ export declare const platformSfapJwtResolver: JwtResolver<ExtraInfo>;
13
+ declare const composedNetworkAdapter: {
14
+ shouldHandleRequest(resourceRequest: ResourceRequest): boolean;
15
+ adapter: (resourceRequest: ResourceRequest, resourceRequestContext: ResourceRequestContext) => Promise<FetchResponse<any>>;
16
+ };
17
+ export default composedNetworkAdapter;
@@ -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';