@salesforce/lds-runtime-one-runtime 1.468.0 → 1.470.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.
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
15
|
import { HttpStatusCode as HttpStatusCode$2, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
|
|
16
|
+
import useHttpUiapiLex from '@salesforce/gate/lds.usehttpuiapilex';
|
|
16
17
|
import usePersistedQueries from '@salesforce/gate/lds.graphqlusepersistedqueries';
|
|
17
18
|
import canCombineRecordLayoutRequests from '@salesforce/gate/lds.pdl.canCombineRecordLayoutRequests';
|
|
18
19
|
import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
|
|
@@ -21,8 +22,8 @@ import { getInstrumentation } from 'o11y/client';
|
|
|
21
22
|
import { findExecutableOperation, buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
|
|
22
23
|
import { print, resolveAndValidateGraphQLConfig, toGraphQLErrorResponse } from 'force/luvioOnestoreGraphqlParser';
|
|
23
24
|
import getServices, { setServices } from 'force/luvioServiceProvisioner1';
|
|
24
|
-
import { assertIsValid, JsonSchemaViolationError, MissingRequiredPropertyError } from 'force/luvioJsonschemaValidate5';
|
|
25
25
|
import { dispatchGlobalEvent as dispatchGlobalEvent$1, executeGlobalControllerRawResponse } from 'aura';
|
|
26
|
+
import { assertIsValid, JsonSchemaViolationError, MissingRequiredPropertyError } from 'force/luvioJsonschemaValidate5';
|
|
26
27
|
import { REFRESH_ADAPTER_EVENT, ADAPTER_UNFULFILLED_ERROR, instrument as instrument$3 } from 'force/ldsBindings';
|
|
27
28
|
import { counter, registerCacheStats, perfStart, perfEnd, registerPeriodicLogger, interaction, markStart, mark, markEnd, timer } from 'instrumentation/service';
|
|
28
29
|
import { LRUCache, instrumentAdapter, instrumentLuvio, logMessage as logMessage$1, setupInstrumentation as setupInstrumentation$1, logObjectInfoChanged as logObjectInfoChanged$1, updatePercentileHistogramMetric, incrementCounterMetric, incrementGetRecordNotifyChangeAllowCount, incrementGetRecordNotifyChangeDropCount, incrementNotifyRecordUpdateAvailableAllowCount, incrementNotifyRecordUpdateAvailableDropCount, setLdsAdaptersUiapiInstrumentation, logError as logError$2, setLdsNetworkAdapterInstrumentation, stateManagerInstrumentation, OperationTypeValue, executeAsyncActivity, METRIC_KEYS, onIdleDetected } from 'force/ldsInstrumentation';
|
|
@@ -32,13 +33,12 @@ import { instrument as instrument$4 } from 'force/adsBridge';
|
|
|
32
33
|
import { instrument as instrument$5 } from '@lwc/state';
|
|
33
34
|
import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
|
|
34
35
|
import { ThirdPartyTracker } from 'instrumentation:thirdPartyTracker';
|
|
36
|
+
import { createStorage, clearStorages } from 'force/ldsDurableStorage';
|
|
35
37
|
import lightningConnectEnabled from '@salesforce/gate/ui.services.LightningConnect.enabled';
|
|
36
38
|
import bypassAppRestrictionEnabled from '@salesforce/gate/ui.services.LightningConnect.BypassAppRestriction.enabled';
|
|
37
39
|
import csrfValidationEnabled from '@salesforce/gate/ui.services.LightningConnect.CsrfValidation.enabled';
|
|
38
40
|
import sessionApiEnabled from '@salesforce/gate/ui.uisdk.session.api.enabled';
|
|
39
41
|
import { pageScopedCache } from 'instrumentation/utility';
|
|
40
|
-
import { createStorage, clearStorages } from 'force/ldsDurableStorage';
|
|
41
|
-
import useHttpUiapiLex from '@salesforce/gate/lds.usehttpuiapilex';
|
|
42
42
|
import auraBasedRequestsEnabled from '@salesforce/gate/ui.services.auraBasedRequests.enabled';
|
|
43
43
|
import { registerSubRequestNetworkAdapter } from 'force/ldsNetwork';
|
|
44
44
|
|
|
@@ -2785,7 +2785,7 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2785
2785
|
},
|
|
2786
2786
|
};
|
|
2787
2787
|
}
|
|
2788
|
-
// version: 1.
|
|
2788
|
+
// version: 1.470.0-ba8b11db3a
|
|
2789
2789
|
|
|
2790
2790
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2791
2791
|
constructor(config, documentRootType, services) {
|
|
@@ -3124,7 +3124,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3124
3124
|
},
|
|
3125
3125
|
};
|
|
3126
3126
|
}
|
|
3127
|
-
// version: 1.
|
|
3127
|
+
// version: 1.470.0-ba8b11db3a
|
|
3128
3128
|
|
|
3129
3129
|
class RetryService {
|
|
3130
3130
|
constructor(defaultRetryPolicy) {
|
|
@@ -3320,6 +3320,42 @@ function buildRenewableResourceManagerDescriptor(type, service) {
|
|
|
3320
3320
|
};
|
|
3321
3321
|
}
|
|
3322
3322
|
|
|
3323
|
+
/**
|
|
3324
|
+
* Helpers for reaching the Aura framework from the LDS Aura runtime.
|
|
3325
|
+
*
|
|
3326
|
+
* `window.$A` is only present when the runtime is hosted inside Aura (LEX or
|
|
3327
|
+
* an Aura site); in tests and non-Aura runtimes it is absent. `getAura()`
|
|
3328
|
+
* centralizes the guarded lookup so the `$A` access lives in one place instead
|
|
3329
|
+
* of being duplicated across modules.
|
|
3330
|
+
*/
|
|
3331
|
+
/**
|
|
3332
|
+
* Returns the Aura framework global (`window.$A`) when running inside Aura
|
|
3333
|
+
* (LEX or an Aura site), or `undefined` in tests and non-Aura runtimes.
|
|
3334
|
+
* Centralizes the guarded `$A` lookup so callers reach for it once and read
|
|
3335
|
+
* intent instead of repeating `typeof window` / `$A` guards.
|
|
3336
|
+
*/
|
|
3337
|
+
function getAura() {
|
|
3338
|
+
if (typeof window === 'undefined') {
|
|
3339
|
+
return undefined;
|
|
3340
|
+
}
|
|
3341
|
+
return window.$A;
|
|
3342
|
+
}
|
|
3343
|
+
/**
|
|
3344
|
+
* Fires an Aura application-level event (e.g. `aura:invalidSession`). Thin
|
|
3345
|
+
* pass-through to the `aura` framework module so callers depend on this util
|
|
3346
|
+
* rather than importing `aura` directly.
|
|
3347
|
+
*/
|
|
3348
|
+
function dispatchGlobalEvent(...args) {
|
|
3349
|
+
dispatchGlobalEvent$1(...args);
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Returns `$A.clientService` when running inside an Aura environment, or
|
|
3353
|
+
* `undefined` otherwise. Defensive: never throws.
|
|
3354
|
+
*/
|
|
3355
|
+
function getAuraClientService() {
|
|
3356
|
+
return getAura()?.clientService;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3323
3359
|
function isUserVisibleError(error) {
|
|
3324
3360
|
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
3325
3361
|
}
|
|
@@ -6121,7 +6157,7 @@ function createActionEndMark(responseStatus, responseStatusText, serverTiming, u
|
|
|
6121
6157
|
const ctx = {
|
|
6122
6158
|
id: instrumentationId,
|
|
6123
6159
|
state: responseStatusText || getResponseStatusText(responseStatus.toString()),
|
|
6124
|
-
def: url,
|
|
6160
|
+
def: toMarkDef(url),
|
|
6125
6161
|
};
|
|
6126
6162
|
// this step adds the serverTime to the base object, as opposed to being in the context field
|
|
6127
6163
|
const receiveCtx = { ...ctx, serverTime: getServerTimeObject(serverTiming) };
|
|
@@ -6129,6 +6165,18 @@ function createActionEndMark(responseStatus, responseStatusText, serverTiming, u
|
|
|
6129
6165
|
mark('actions', 'finishStart', ctx);
|
|
6130
6166
|
mark('actions', 'finishEnd', ctx);
|
|
6131
6167
|
}
|
|
6168
|
+
// A path segment (or comma-separated item within one, e.g. records/batch/001..,005..,
|
|
6169
|
+
// with the comma raw or percent-encoded) that looks like a 15- or 18-char Salesforce ID.
|
|
6170
|
+
// Requiring a digit keeps alphabetic API names of the same length (e.g.
|
|
6171
|
+
// OpportunityHistory) intact.
|
|
6172
|
+
const RECORD_ID_SEGMENT = /(\/|,|%2[Cc])(?=[A-Za-z]*\d)[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?(?=\/|,|%2[Cc]|$)/g;
|
|
6173
|
+
// The action mark `def` is beaconed to the server, whose PII check flags user IDs (005...)
|
|
6174
|
+
// anywhere under marks.actions and then re-tokenizes the entire payload. Drop the query
|
|
6175
|
+
// string and template record IDs so `def` identifies the endpoint without carrying data,
|
|
6176
|
+
// analogous to the Aura action name it replaces.
|
|
6177
|
+
function toMarkDef(url) {
|
|
6178
|
+
return url.split(/[?#]/)[0].replace(RECORD_ID_SEGMENT, '$1{id}');
|
|
6179
|
+
}
|
|
6132
6180
|
const seenResources = new WeakSet();
|
|
6133
6181
|
function createTransportEndMark(responseStatus, responseStatusText, url, context, errorMessage) {
|
|
6134
6182
|
if (context && context.instrumentationId) {
|
|
@@ -6610,6 +6658,116 @@ function buildLuvioActionMarksSendInterceptor() {
|
|
|
6610
6658
|
};
|
|
6611
6659
|
}
|
|
6612
6660
|
|
|
6661
|
+
const CSRF_TOKEN_KEY = 'salesforce_csrf_token';
|
|
6662
|
+
const CSRF_STORAGE_NAME = 'ldsCSRFToken';
|
|
6663
|
+
const BASE_URI = '/services/data/v69.0';
|
|
6664
|
+
const UI_API_BASE_URI = `${BASE_URI}/ui-api`;
|
|
6665
|
+
const CSRF_TOKEN_ENDPOINT = `${UI_API_BASE_URI}/session/csrf`;
|
|
6666
|
+
const CSRF_STORAGE_CONFIG = {
|
|
6667
|
+
name: CSRF_STORAGE_NAME,
|
|
6668
|
+
persistent: true,
|
|
6669
|
+
secure: true,
|
|
6670
|
+
maxSize: 1024,
|
|
6671
|
+
expiration: 24 * 60 * 60,
|
|
6672
|
+
clearOnInit: false,
|
|
6673
|
+
debugLogging: false,
|
|
6674
|
+
};
|
|
6675
|
+
function readPreloadedToken(getPreloadedToken) {
|
|
6676
|
+
try {
|
|
6677
|
+
const token = getPreloadedToken?.();
|
|
6678
|
+
return typeof token === 'string' && token ? token : undefined;
|
|
6679
|
+
}
|
|
6680
|
+
catch {
|
|
6681
|
+
return undefined;
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
/**
|
|
6685
|
+
* Fetches a fresh CSRF token from the server. Resolves `undefined` (not a
|
|
6686
|
+
* rejection) on any non-ok response, missing token, or network/parse error so
|
|
6687
|
+
* the manager treats it as "no value" and leaves any cached token intact. The
|
|
6688
|
+
* CSRF retry policy — not this fetch — owns retry semantics.
|
|
6689
|
+
*/
|
|
6690
|
+
async function fetchFreshToken() {
|
|
6691
|
+
try {
|
|
6692
|
+
const response = await fetch(CSRF_TOKEN_ENDPOINT, {
|
|
6693
|
+
method: 'GET',
|
|
6694
|
+
credentials: 'same-origin',
|
|
6695
|
+
});
|
|
6696
|
+
if (!response.ok) {
|
|
6697
|
+
return undefined;
|
|
6698
|
+
}
|
|
6699
|
+
const data = await response.json();
|
|
6700
|
+
const token = data.csrfToken;
|
|
6701
|
+
return typeof token === 'string' && token ? token : undefined;
|
|
6702
|
+
}
|
|
6703
|
+
catch {
|
|
6704
|
+
return undefined;
|
|
6705
|
+
}
|
|
6706
|
+
}
|
|
6707
|
+
/**
|
|
6708
|
+
* Durable store fronted by memory so `get()` is sync once loaded (W-24883855).
|
|
6709
|
+
* No TTL: a stale token is replaced via the CSRF retry policy's `refresh()`.
|
|
6710
|
+
*/
|
|
6711
|
+
function buildCsrfResourceStorage(getPreloadedToken) {
|
|
6712
|
+
const storage = createStorage(CSRF_STORAGE_CONFIG);
|
|
6713
|
+
let currentToken;
|
|
6714
|
+
let loaded = false;
|
|
6715
|
+
// Seed once (stored, else preloaded) so a later clear() isn't resurrected by
|
|
6716
|
+
// the preload. A set()/clear() during the read wins.
|
|
6717
|
+
const seeded = (async () => {
|
|
6718
|
+
const preloadedToken = readPreloadedToken(getPreloadedToken);
|
|
6719
|
+
let existing;
|
|
6720
|
+
try {
|
|
6721
|
+
const cached = await storage?.get(CSRF_TOKEN_KEY);
|
|
6722
|
+
existing = typeof cached === 'string' && cached ? cached : undefined;
|
|
6723
|
+
}
|
|
6724
|
+
catch {
|
|
6725
|
+
// Treated as a miss; the manager fetches.
|
|
6726
|
+
}
|
|
6727
|
+
if (loaded) {
|
|
6728
|
+
return;
|
|
6729
|
+
}
|
|
6730
|
+
currentToken = existing ?? preloadedToken;
|
|
6731
|
+
loaded = true;
|
|
6732
|
+
if (storage && !existing && preloadedToken) {
|
|
6733
|
+
try {
|
|
6734
|
+
await storage.set(CSRF_TOKEN_KEY, preloadedToken);
|
|
6735
|
+
}
|
|
6736
|
+
catch {
|
|
6737
|
+
// Still usable from memory.
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
})();
|
|
6741
|
+
// Durable writes wait for the seed so they land after its preload write.
|
|
6742
|
+
// Failures are ignored; memory stays authoritative.
|
|
6743
|
+
const afterSeed = (write) => seeded.then(write).then(() => { }, () => { });
|
|
6744
|
+
return {
|
|
6745
|
+
get: () => (loaded ? resolvedPromiseLike$2(currentToken) : seeded.then(() => currentToken)),
|
|
6746
|
+
set: (value) => {
|
|
6747
|
+
currentToken = value;
|
|
6748
|
+
loaded = true;
|
|
6749
|
+
return afterSeed(() => storage?.set(CSRF_TOKEN_KEY, value));
|
|
6750
|
+
},
|
|
6751
|
+
clear: () => {
|
|
6752
|
+
currentToken = undefined;
|
|
6753
|
+
loaded = true;
|
|
6754
|
+
return afterSeed(() => storage?.remove(CSRF_TOKEN_KEY));
|
|
6755
|
+
},
|
|
6756
|
+
};
|
|
6757
|
+
}
|
|
6758
|
+
/**
|
|
6759
|
+
* Builds the CSRF token manager: a {@link BasicRenewableResourceManager} that
|
|
6760
|
+
* lazily caches the token in durable storage, coalesces concurrent fetches onto
|
|
6761
|
+
* a single in-flight request, and dedups refresh storms. Registered as a
|
|
6762
|
+
* provisioner service (`csrfTokenManager`) by `initializeOneStore`.
|
|
6763
|
+
*/
|
|
6764
|
+
function buildCsrfTokenManager(options = {}) {
|
|
6765
|
+
return new BasicRenewableResourceManager({
|
|
6766
|
+
fetch: fetchFreshToken,
|
|
6767
|
+
storage: buildCsrfResourceStorage(options.getPreloadedToken),
|
|
6768
|
+
});
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6613
6771
|
/**
|
|
6614
6772
|
* Service name the CSRF token manager is registered under by
|
|
6615
6773
|
* `initializeOneStore` (see `buildRenewableResourceManagerDescriptor`).
|
|
@@ -6622,6 +6780,11 @@ const CSRF_TOKEN_MANAGER_REQUEST = {
|
|
|
6622
6780
|
},
|
|
6623
6781
|
};
|
|
6624
6782
|
let cached;
|
|
6783
|
+
let resolvedManager;
|
|
6784
|
+
/** The manager if {@link getCsrfTokenManager} has resolved it, else `undefined`. */
|
|
6785
|
+
function peekCsrfTokenManager() {
|
|
6786
|
+
return resolvedManager;
|
|
6787
|
+
}
|
|
6625
6788
|
/**
|
|
6626
6789
|
* Resolves the CSRF token manager from the service provisioner.
|
|
6627
6790
|
*
|
|
@@ -6637,7 +6800,10 @@ let cached;
|
|
|
6637
6800
|
function getCsrfTokenManager() {
|
|
6638
6801
|
if (!cached) {
|
|
6639
6802
|
cached = Promise.resolve(getServices(CSRF_TOKEN_MANAGER_REQUEST))
|
|
6640
|
-
.then((services) =>
|
|
6803
|
+
.then((services) => {
|
|
6804
|
+
resolvedManager = services[CSRF_TOKEN_MANAGER_SERVICE];
|
|
6805
|
+
return resolvedManager;
|
|
6806
|
+
})
|
|
6641
6807
|
.catch((error) => {
|
|
6642
6808
|
cached = undefined;
|
|
6643
6809
|
throw error;
|
|
@@ -6651,14 +6817,18 @@ const CSRF_TOKEN_HEADER = 'X-CSRF-Token';
|
|
|
6651
6817
|
* Resolves the CSRF token manager and returns the current token. Returns
|
|
6652
6818
|
* `undefined` if the manager cannot be resolved (service not yet provisioned)
|
|
6653
6819
|
* or has no token, so a request is never blocked by token resolution.
|
|
6820
|
+
* Synchronous once the manager has resolved and the token is loaded (W-24883855).
|
|
6654
6821
|
*/
|
|
6655
|
-
|
|
6822
|
+
function getCsrfToken() {
|
|
6656
6823
|
try {
|
|
6657
|
-
const manager =
|
|
6658
|
-
|
|
6824
|
+
const manager = peekCsrfTokenManager();
|
|
6825
|
+
const token = manager
|
|
6826
|
+
? manager.get()
|
|
6827
|
+
: getCsrfTokenManager().then((resolved) => resolved.get());
|
|
6828
|
+
return token.then((value) => value, () => undefined);
|
|
6659
6829
|
}
|
|
6660
6830
|
catch {
|
|
6661
|
-
return undefined;
|
|
6831
|
+
return resolvedPromiseLike$2(undefined);
|
|
6662
6832
|
}
|
|
6663
6833
|
}
|
|
6664
6834
|
/**
|
|
@@ -6710,7 +6880,8 @@ function buildCsrfTokenInterceptor() {
|
|
|
6710
6880
|
* @returns A request interceptor function for Luvio ResourceRequest objects
|
|
6711
6881
|
*/
|
|
6712
6882
|
function buildLuvioCsrfTokenInterceptor() {
|
|
6713
|
-
|
|
6883
|
+
// Sync on purpose (W-24883855).
|
|
6884
|
+
return (resourceRequest) => {
|
|
6714
6885
|
// Check if all required gates are enabled before running
|
|
6715
6886
|
if (!areCsrfGatesEnabled()) {
|
|
6716
6887
|
return resolvedPromiseLike$2(resourceRequest);
|
|
@@ -6719,17 +6890,20 @@ function buildLuvioCsrfTokenInterceptor() {
|
|
|
6719
6890
|
if (!resourceRequest.headers) {
|
|
6720
6891
|
resourceRequest.headers = {};
|
|
6721
6892
|
}
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
if (!resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6726
|
-
const token = await getCsrfToken();
|
|
6727
|
-
if (token) {
|
|
6728
|
-
resourceRequest.headers[CSRF_TOKEN_HEADER] = token;
|
|
6729
|
-
}
|
|
6730
|
-
}
|
|
6893
|
+
if (!peekCsrfTokenManager()) {
|
|
6894
|
+
// Warm it (GETs too) so mutations attach the token synchronously.
|
|
6895
|
+
getCsrfTokenManager().catch(() => { });
|
|
6731
6896
|
}
|
|
6732
|
-
|
|
6897
|
+
if (!isMutatingMethod(resourceRequest.method) ||
|
|
6898
|
+
resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6899
|
+
return resolvedPromiseLike$2(resourceRequest);
|
|
6900
|
+
}
|
|
6901
|
+
return getCsrfToken().then((token) => {
|
|
6902
|
+
if (token) {
|
|
6903
|
+
resourceRequest.headers[CSRF_TOKEN_HEADER] = token;
|
|
6904
|
+
}
|
|
6905
|
+
return resourceRequest;
|
|
6906
|
+
});
|
|
6733
6907
|
};
|
|
6734
6908
|
}
|
|
6735
6909
|
|
|
@@ -6785,7 +6959,8 @@ function buildFirstPartyHeaderInterceptor() {
|
|
|
6785
6959
|
* @returns A request interceptor for Luvio ResourceRequest objects
|
|
6786
6960
|
*/
|
|
6787
6961
|
function buildLuvioFirstPartyHeaderInterceptor() {
|
|
6788
|
-
|
|
6962
|
+
// Sync on purpose (W-24883855).
|
|
6963
|
+
return (resourceRequest) => {
|
|
6789
6964
|
if (!resourceRequest.headers) {
|
|
6790
6965
|
resourceRequest.headers = {};
|
|
6791
6966
|
}
|
|
@@ -6830,7 +7005,8 @@ function mintIdempotencyKey() {
|
|
|
6830
7005
|
* registry flag can never cause an unsafe replay.
|
|
6831
7006
|
*/
|
|
6832
7007
|
function buildLuvioIdempotencyKeyInterceptor() {
|
|
6833
|
-
|
|
7008
|
+
// Sync on purpose (W-24883855).
|
|
7009
|
+
return (resourceRequest) => {
|
|
6834
7010
|
if (!resourceRequest.headers) {
|
|
6835
7011
|
resourceRequest.headers = {};
|
|
6836
7012
|
}
|
|
@@ -8065,43 +8241,7 @@ function getEnvironmentSetting(name) {
|
|
|
8065
8241
|
}
|
|
8066
8242
|
return undefined;
|
|
8067
8243
|
}
|
|
8068
|
-
// version: 1.
|
|
8069
|
-
|
|
8070
|
-
/**
|
|
8071
|
-
* Helpers for reaching the Aura framework from the LDS Aura runtime.
|
|
8072
|
-
*
|
|
8073
|
-
* `window.$A` is only present when the runtime is hosted inside Aura (LEX or
|
|
8074
|
-
* an Aura site); in tests and non-Aura runtimes it is absent. `getAura()`
|
|
8075
|
-
* centralizes the guarded lookup so the `$A` access lives in one place instead
|
|
8076
|
-
* of being duplicated across modules.
|
|
8077
|
-
*/
|
|
8078
|
-
/**
|
|
8079
|
-
* Returns the Aura framework global (`window.$A`) when running inside Aura
|
|
8080
|
-
* (LEX or an Aura site), or `undefined` in tests and non-Aura runtimes.
|
|
8081
|
-
* Centralizes the guarded `$A` lookup so callers reach for it once and read
|
|
8082
|
-
* intent instead of repeating `typeof window` / `$A` guards.
|
|
8083
|
-
*/
|
|
8084
|
-
function getAura() {
|
|
8085
|
-
if (typeof window === 'undefined') {
|
|
8086
|
-
return undefined;
|
|
8087
|
-
}
|
|
8088
|
-
return window.$A;
|
|
8089
|
-
}
|
|
8090
|
-
/**
|
|
8091
|
-
* Fires an Aura application-level event (e.g. `aura:invalidSession`). Thin
|
|
8092
|
-
* pass-through to the `aura` framework module so callers depend on this util
|
|
8093
|
-
* rather than importing `aura` directly.
|
|
8094
|
-
*/
|
|
8095
|
-
function dispatchGlobalEvent(...args) {
|
|
8096
|
-
dispatchGlobalEvent$1(...args);
|
|
8097
|
-
}
|
|
8098
|
-
/**
|
|
8099
|
-
* Returns `$A.clientService` when running inside an Aura environment, or
|
|
8100
|
-
* `undefined` otherwise. Defensive: never throws.
|
|
8101
|
-
*/
|
|
8102
|
-
function getAuraClientService() {
|
|
8103
|
-
return getAura()?.clientService;
|
|
8104
|
-
}
|
|
8244
|
+
// version: 1.470.0-41a8c88685
|
|
8105
8245
|
|
|
8106
8246
|
const auraClientService = getAuraClientService();
|
|
8107
8247
|
const defaultConfig = {
|
|
@@ -11221,149 +11361,6 @@ function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
|
11221
11361
|
};
|
|
11222
11362
|
}
|
|
11223
11363
|
|
|
11224
|
-
const CSRF_TOKEN_KEY = 'salesforce_csrf_token';
|
|
11225
|
-
const CSRF_STORAGE_NAME = 'ldsCSRFToken';
|
|
11226
|
-
const BASE_URI = '/services/data/v69.0';
|
|
11227
|
-
const UI_API_BASE_URI = `${BASE_URI}/ui-api`;
|
|
11228
|
-
const CSRF_TOKEN_ENDPOINT = `${UI_API_BASE_URI}/session/csrf`;
|
|
11229
|
-
const CSRF_STORAGE_CONFIG = {
|
|
11230
|
-
name: CSRF_STORAGE_NAME,
|
|
11231
|
-
persistent: true,
|
|
11232
|
-
secure: true,
|
|
11233
|
-
maxSize: 1024,
|
|
11234
|
-
expiration: 24 * 60 * 60,
|
|
11235
|
-
clearOnInit: false,
|
|
11236
|
-
debugLogging: false,
|
|
11237
|
-
};
|
|
11238
|
-
/**
|
|
11239
|
-
* Reads the CSRF token Aura preloads onto the bootstrap payload. When the
|
|
11240
|
-
* Connect Framework CSRF token is minted at template-render time it is exposed
|
|
11241
|
-
* via `$A.clientService.getConnectCsrfToken()`. Reading it here lets the first
|
|
11242
|
-
* state-changing request skip the cold `/ui-api/session/csrf` round trip.
|
|
11243
|
-
*
|
|
11244
|
-
* Defensive against a missing getter or server killswitch: returns `undefined`,
|
|
11245
|
-
* never throws.
|
|
11246
|
-
*/
|
|
11247
|
-
function readPreloadedToken() {
|
|
11248
|
-
const clientService = getAuraClientService();
|
|
11249
|
-
if (typeof clientService?.getConnectCsrfToken !== 'function') {
|
|
11250
|
-
return undefined;
|
|
11251
|
-
}
|
|
11252
|
-
try {
|
|
11253
|
-
const token = clientService.getConnectCsrfToken();
|
|
11254
|
-
return typeof token === 'string' && token ? token : undefined;
|
|
11255
|
-
}
|
|
11256
|
-
catch {
|
|
11257
|
-
return undefined;
|
|
11258
|
-
}
|
|
11259
|
-
}
|
|
11260
|
-
/**
|
|
11261
|
-
* Fetches a fresh CSRF token from the server. Resolves `undefined` (not a
|
|
11262
|
-
* rejection) on any non-ok response, missing token, or network/parse error so
|
|
11263
|
-
* the manager treats it as "no value" and leaves any cached token intact. The
|
|
11264
|
-
* CSRF retry policy — not this fetch — owns retry semantics.
|
|
11265
|
-
*/
|
|
11266
|
-
async function fetchFreshToken() {
|
|
11267
|
-
try {
|
|
11268
|
-
const response = await fetch(CSRF_TOKEN_ENDPOINT, {
|
|
11269
|
-
method: 'GET',
|
|
11270
|
-
credentials: 'same-origin',
|
|
11271
|
-
});
|
|
11272
|
-
if (!response.ok) {
|
|
11273
|
-
return undefined;
|
|
11274
|
-
}
|
|
11275
|
-
const data = await response.json();
|
|
11276
|
-
const token = data.csrfToken;
|
|
11277
|
-
return typeof token === 'string' && token ? token : undefined;
|
|
11278
|
-
}
|
|
11279
|
-
catch {
|
|
11280
|
-
return undefined;
|
|
11281
|
-
}
|
|
11282
|
-
}
|
|
11283
|
-
/**
|
|
11284
|
-
* Adapts the durable AuraStorage backing store to the {@link ResourceStorage}
|
|
11285
|
-
* contract the renewable-resource manager expects.
|
|
11286
|
-
*
|
|
11287
|
-
* The Aura-preloaded token is written into the store **once at creation** (only
|
|
11288
|
-
* when the store is otherwise empty), so the first `get()` finds it and the
|
|
11289
|
-
* first mutation skips the network. Seeding the store — rather than having
|
|
11290
|
-
* `get()` fall back to the preload on every empty read — means a later
|
|
11291
|
-
* `clear()` (logout / org switch) is not silently resurrected by the preload.
|
|
11292
|
-
*
|
|
11293
|
-
* Every operation awaits the one-time seed so reads and writes observe a
|
|
11294
|
-
* consistent store. Storage read/write failures are non-fatal.
|
|
11295
|
-
*/
|
|
11296
|
-
function buildCsrfResourceStorage() {
|
|
11297
|
-
const storage = createStorage(CSRF_STORAGE_CONFIG);
|
|
11298
|
-
// Pre-seed the preloaded token into the store, once, if the store is empty.
|
|
11299
|
-
const seeded = (async () => {
|
|
11300
|
-
const preloadedToken = readPreloadedToken();
|
|
11301
|
-
if (!storage || !preloadedToken) {
|
|
11302
|
-
return;
|
|
11303
|
-
}
|
|
11304
|
-
try {
|
|
11305
|
-
const existing = await storage.get(CSRF_TOKEN_KEY);
|
|
11306
|
-
if (typeof existing !== 'string' || !existing) {
|
|
11307
|
-
await storage.set(CSRF_TOKEN_KEY, preloadedToken);
|
|
11308
|
-
}
|
|
11309
|
-
}
|
|
11310
|
-
catch {
|
|
11311
|
-
// Non-fatal: fall back to fetching a fresh token on first use.
|
|
11312
|
-
}
|
|
11313
|
-
})();
|
|
11314
|
-
return {
|
|
11315
|
-
get: async () => {
|
|
11316
|
-
await seeded;
|
|
11317
|
-
if (storage) {
|
|
11318
|
-
try {
|
|
11319
|
-
const cached = await storage.get(CSRF_TOKEN_KEY);
|
|
11320
|
-
if (typeof cached === 'string' && cached) {
|
|
11321
|
-
return cached;
|
|
11322
|
-
}
|
|
11323
|
-
}
|
|
11324
|
-
catch {
|
|
11325
|
-
// Non-fatal: treat as a cache miss so the manager fetches.
|
|
11326
|
-
}
|
|
11327
|
-
}
|
|
11328
|
-
return undefined;
|
|
11329
|
-
},
|
|
11330
|
-
set: async (value) => {
|
|
11331
|
-
await seeded;
|
|
11332
|
-
if (storage) {
|
|
11333
|
-
try {
|
|
11334
|
-
await storage.set(CSRF_TOKEN_KEY, value);
|
|
11335
|
-
}
|
|
11336
|
-
catch {
|
|
11337
|
-
// Non-fatal: token is still usable even if caching fails.
|
|
11338
|
-
}
|
|
11339
|
-
}
|
|
11340
|
-
},
|
|
11341
|
-
clear: async () => {
|
|
11342
|
-
await seeded;
|
|
11343
|
-
if (storage) {
|
|
11344
|
-
try {
|
|
11345
|
-
await storage.remove(CSRF_TOKEN_KEY);
|
|
11346
|
-
}
|
|
11347
|
-
catch {
|
|
11348
|
-
// Non-fatal: continue even if the clear fails.
|
|
11349
|
-
}
|
|
11350
|
-
}
|
|
11351
|
-
},
|
|
11352
|
-
};
|
|
11353
|
-
}
|
|
11354
|
-
/**
|
|
11355
|
-
* Builds the CSRF token manager: a {@link BasicRenewableResourceManager} that
|
|
11356
|
-
* lazily caches the token in durable storage, coalesces concurrent fetches onto
|
|
11357
|
-
* a single in-flight request, and dedups refresh storms. Registered as a
|
|
11358
|
-
* provisioner service (`csrfTokenManager`) by `initializeOneStore`.
|
|
11359
|
-
*/
|
|
11360
|
-
function buildCsrfTokenManager() {
|
|
11361
|
-
return new BasicRenewableResourceManager({
|
|
11362
|
-
fetch: fetchFreshToken,
|
|
11363
|
-
storage: buildCsrfResourceStorage(),
|
|
11364
|
-
});
|
|
11365
|
-
}
|
|
11366
|
-
|
|
11367
11364
|
// Registration published on the force/ldsEngine bus so shared (cross-runtime) laf
|
|
11368
11365
|
// loaders can read buildPredictorForContext without importing a bootstrap bundle.
|
|
11369
11366
|
const PDL_ENGINE_REGISTRATION_ID = '@salesforce/lds-pdl-engine';
|
|
@@ -11626,18 +11623,16 @@ function initializeOneStore(luvio) {
|
|
|
11626
11623
|
// loudly in development instead.
|
|
11627
11624
|
const retryServiceDescriptor = buildServiceDescriptor$8(new UnconfiguredRetryPolicy());
|
|
11628
11625
|
const retryService = retryServiceDescriptor.service;
|
|
11629
|
-
const csrfTokenManagerServiceDescriptor = buildRenewableResourceManagerDescriptor(CSRF_TOKEN_MANAGER_SERVICE, buildCsrfTokenManager(
|
|
11626
|
+
const csrfTokenManagerServiceDescriptor = buildRenewableResourceManagerDescriptor(CSRF_TOKEN_MANAGER_SERVICE, buildCsrfTokenManager({
|
|
11627
|
+
getPreloadedToken: () => getAuraClientService()?.getConnectCsrfToken?.(),
|
|
11628
|
+
}));
|
|
11630
11629
|
const prefetchSfapJwtServiceDescriptor = {
|
|
11631
11630
|
type: 'prefetchSfapJwt',
|
|
11632
11631
|
version: '1.0',
|
|
11633
11632
|
service: prefetchSfapJwt,
|
|
11634
11633
|
};
|
|
11635
|
-
//
|
|
11636
|
-
|
|
11637
|
-
// (W-23092947), and defaulting to Aura keeps a single, known-good transport
|
|
11638
|
-
// across LEX and sites. Paired with the HTTP UIAPI fetch path being
|
|
11639
|
-
// disabled on sites (see network-fetch.ts).
|
|
11640
|
-
featureFlagsService.set('graphQLUseAura', true);
|
|
11634
|
+
// OneStore GraphQL follows the HTTP UIAPI gate (LEX never runs on sites).
|
|
11635
|
+
featureFlagsService.set('graphQLUseAura', !useHttpUiapiLex.isOpen({ fallback: false }));
|
|
11641
11636
|
// Persisted (named) GraphQL queries; no consumers yet (W-23971639).
|
|
11642
11637
|
featureFlagsService.set('graphQLUsePersistedQueries', usePersistedQueries.isOpen({ fallback: false }));
|
|
11643
11638
|
const services = [
|
|
@@ -11700,4 +11695,4 @@ function ldsEngineCreator() {
|
|
|
11700
11695
|
}
|
|
11701
11696
|
|
|
11702
11697
|
export { LexRequestStrategy, PDL_ENGINE_REGISTRATION_ID, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
|
|
11703
|
-
// version: 1.
|
|
11698
|
+
// version: 1.470.0-ba8b11db3a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-one-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.470.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for the LEX on One Runtime (LWR) runtime.",
|
|
6
6
|
"main": "dist/oneRuntimeLdsEngineCreator.js",
|
|
@@ -34,62 +34,62 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-one-runtime"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@conduit-client/service-provisioner": "3.35.
|
|
38
|
-
"@conduit-client/tools-core": "3.35.
|
|
39
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
40
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
43
|
-
"@salesforce/lds-bindings": "^1.
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
45
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
46
|
-
"@salesforce/lds-network-aura": "^1.
|
|
47
|
-
"@salesforce/lds-network-fetch": "^1.
|
|
48
|
-
"@salesforce/lds-runtime-shared": "^1.
|
|
37
|
+
"@conduit-client/service-provisioner": "3.35.1",
|
|
38
|
+
"@conduit-client/tools-core": "3.35.1",
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.470.0",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.470.0",
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.470.0",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.470.0",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.470.0",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.470.0",
|
|
45
|
+
"@salesforce/lds-network-adapter": "^1.470.0",
|
|
46
|
+
"@salesforce/lds-network-aura": "^1.470.0",
|
|
47
|
+
"@salesforce/lds-network-fetch": "^1.470.0",
|
|
48
|
+
"@salesforce/lds-runtime-shared": "^1.470.0",
|
|
49
49
|
"jwt-encode": "1.0.1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.35.
|
|
53
|
-
"@conduit-client/command-aura-network": "3.35.
|
|
54
|
-
"@conduit-client/command-aura-normalized-cache-control": "3.35.
|
|
55
|
-
"@conduit-client/command-fetch-network": "3.35.
|
|
56
|
-
"@conduit-client/command-http-graphql-normalized-cache-control": "3.35.
|
|
57
|
-
"@conduit-client/command-http-normalized-cache-control": "3.35.
|
|
58
|
-
"@conduit-client/command-ndjson": "3.35.
|
|
59
|
-
"@conduit-client/command-network": "3.35.
|
|
60
|
-
"@conduit-client/command-sse": "3.35.
|
|
61
|
-
"@conduit-client/command-streaming": "3.35.
|
|
62
|
-
"@conduit-client/jwt-manager": "3.35.
|
|
63
|
-
"@conduit-client/service-aura-network": "3.35.
|
|
64
|
-
"@conduit-client/service-bindings-imperative": "3.35.
|
|
65
|
-
"@conduit-client/service-bindings-lwc": "3.35.
|
|
66
|
-
"@conduit-client/service-cache": "3.35.
|
|
67
|
-
"@conduit-client/service-cache-control": "3.35.
|
|
68
|
-
"@conduit-client/service-cache-inclusion-policy": "3.35.
|
|
69
|
-
"@conduit-client/service-config": "3.35.
|
|
70
|
-
"@conduit-client/service-feature-flags": "3.35.
|
|
71
|
-
"@conduit-client/service-fetch-network": "3.35.
|
|
72
|
-
"@conduit-client/service-instrument-command": "3.35.
|
|
73
|
-
"@conduit-client/service-pubsub": "3.35.
|
|
74
|
-
"@conduit-client/service-renewable-resource-manager": "3.35.
|
|
75
|
-
"@conduit-client/service-store": "3.35.
|
|
76
|
-
"@conduit-client/utils": "3.35.
|
|
52
|
+
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.35.1",
|
|
53
|
+
"@conduit-client/command-aura-network": "3.35.1",
|
|
54
|
+
"@conduit-client/command-aura-normalized-cache-control": "3.35.1",
|
|
55
|
+
"@conduit-client/command-fetch-network": "3.35.1",
|
|
56
|
+
"@conduit-client/command-http-graphql-normalized-cache-control": "3.35.1",
|
|
57
|
+
"@conduit-client/command-http-normalized-cache-control": "3.35.1",
|
|
58
|
+
"@conduit-client/command-ndjson": "3.35.1",
|
|
59
|
+
"@conduit-client/command-network": "3.35.1",
|
|
60
|
+
"@conduit-client/command-sse": "3.35.1",
|
|
61
|
+
"@conduit-client/command-streaming": "3.35.1",
|
|
62
|
+
"@conduit-client/jwt-manager": "3.35.1",
|
|
63
|
+
"@conduit-client/service-aura-network": "3.35.1",
|
|
64
|
+
"@conduit-client/service-bindings-imperative": "3.35.1",
|
|
65
|
+
"@conduit-client/service-bindings-lwc": "3.35.1",
|
|
66
|
+
"@conduit-client/service-cache": "3.35.1",
|
|
67
|
+
"@conduit-client/service-cache-control": "3.35.1",
|
|
68
|
+
"@conduit-client/service-cache-inclusion-policy": "3.35.1",
|
|
69
|
+
"@conduit-client/service-config": "3.35.1",
|
|
70
|
+
"@conduit-client/service-feature-flags": "3.35.1",
|
|
71
|
+
"@conduit-client/service-fetch-network": "3.35.1",
|
|
72
|
+
"@conduit-client/service-instrument-command": "3.35.1",
|
|
73
|
+
"@conduit-client/service-pubsub": "3.35.1",
|
|
74
|
+
"@conduit-client/service-renewable-resource-manager": "3.35.1",
|
|
75
|
+
"@conduit-client/service-store": "3.35.1",
|
|
76
|
+
"@conduit-client/utils": "3.35.1",
|
|
77
77
|
"@luvio/network-adapter-composable": "0.161.2",
|
|
78
78
|
"@luvio/network-adapter-fetch": "0.161.2",
|
|
79
79
|
"@lwc/state": "^0.29.0",
|
|
80
|
-
"@salesforce/lds-adapters-onestore-graphql": "^1.
|
|
80
|
+
"@salesforce/lds-adapters-onestore-graphql": "^1.470.0",
|
|
81
81
|
"@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
|
|
82
|
-
"@salesforce/lds-durable-storage": "^1.
|
|
83
|
-
"@salesforce/lds-luvio-service": "^1.
|
|
84
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.
|
|
82
|
+
"@salesforce/lds-durable-storage": "^1.470.0",
|
|
83
|
+
"@salesforce/lds-luvio-service": "^1.470.0",
|
|
84
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.470.0"
|
|
85
85
|
},
|
|
86
86
|
"luvioBundlesize": [
|
|
87
87
|
{
|
|
88
88
|
"path": "./dist/oneRuntimeLdsEngineCreator.js",
|
|
89
89
|
"maxSize": {
|
|
90
|
-
"none": "
|
|
90
|
+
"none": "425 kB",
|
|
91
91
|
"min": "190 kB",
|
|
92
|
-
"compressed": "
|
|
92
|
+
"compressed": "76 kB"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
],
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type RenewableResourceManager } from '@conduit-client/service-renewable-resource-manager/v1';
|
|
2
|
-
/**
|
|
3
|
-
* Builds the CSRF token manager: a {@link BasicRenewableResourceManager} that
|
|
4
|
-
* lazily caches the token in durable storage, coalesces concurrent fetches onto
|
|
5
|
-
* a single in-flight request, and dedups refresh storms. Registered as a
|
|
6
|
-
* provisioner service (`csrfTokenManager`) by `initializeOneStore`.
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildCsrfTokenManager(): RenewableResourceManager<string>;
|