@salesforce/lds-runtime-aura 1.436.0 → 1.438.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.
- package/dist/ldsEngineCreator.js +223 -251
- package/dist/types/request-interceptors/csrf-manager.d.ts +6 -0
- package/dist/types/request-interceptors/csrf-token.d.ts +1 -0
- package/dist/types/retry-interceptors/luvio-fetch-retry.d.ts +8 -0
- package/dist/types/retry-policies/luvio-csrf-token-retry-policy.d.ts +32 -0
- package/dist/types/retry-policies/luvio-fetch-throttling-retry-policy.d.ts +18 -0
- package/package.json +44 -44
package/dist/ldsEngineCreator.js
CHANGED
|
@@ -49,11 +49,6 @@ import disableCreateContentDocumentAndVersionHTTPLexRuntime from '@salesforce/ga
|
|
|
49
49
|
import useHotspotLimit from '@salesforce/gate/lds.pdl.useHotspotLimit';
|
|
50
50
|
import { registerSubRequestNetworkAdapter } from 'force/ldsNetwork';
|
|
51
51
|
|
|
52
|
-
/*!
|
|
53
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
54
|
-
* All rights reserved.
|
|
55
|
-
* For full license text, see the LICENSE.txt file
|
|
56
|
-
*/
|
|
57
52
|
const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
|
|
58
53
|
const { isArray: isArray$3 } = Array;
|
|
59
54
|
const { stringify: stringify$3, parse: parse$2 } = JSON;
|
|
@@ -175,7 +170,7 @@ function rejectedPromiseLike$2(reason) {
|
|
|
175
170
|
};
|
|
176
171
|
}
|
|
177
172
|
function isPromiseLike$2(x) {
|
|
178
|
-
return typeof
|
|
173
|
+
return typeof x?.then === "function";
|
|
179
174
|
}
|
|
180
175
|
function stableJSONStringify$2(node) {
|
|
181
176
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
|
@@ -322,19 +317,9 @@ function logError$1(error) {
|
|
|
322
317
|
console.error("OneStore Command threw an error that we did not expect", error);
|
|
323
318
|
}
|
|
324
319
|
|
|
325
|
-
/*!
|
|
326
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
327
|
-
* All rights reserved.
|
|
328
|
-
* For full license text, see the LICENSE.txt file
|
|
329
|
-
*/
|
|
330
320
|
class BaseCommand {
|
|
331
321
|
}
|
|
332
322
|
|
|
333
|
-
/*!
|
|
334
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
335
|
-
* All rights reserved.
|
|
336
|
-
* For full license text, see the LICENSE.txt file
|
|
337
|
-
*/
|
|
338
323
|
let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
339
324
|
constructor(services) {
|
|
340
325
|
super();
|
|
@@ -385,11 +370,6 @@ function buildServiceDescriptor$r() {
|
|
|
385
370
|
};
|
|
386
371
|
}
|
|
387
372
|
|
|
388
|
-
/*!
|
|
389
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
390
|
-
* All rights reserved.
|
|
391
|
-
* For full license text, see the LICENSE.txt file
|
|
392
|
-
*/
|
|
393
373
|
class AuraNetworkCommand extends NetworkCommand$1 {
|
|
394
374
|
constructor(services) {
|
|
395
375
|
super(services);
|
|
@@ -496,16 +476,6 @@ function buildServiceDescriptor$q() {
|
|
|
496
476
|
};
|
|
497
477
|
}
|
|
498
478
|
|
|
499
|
-
/*!
|
|
500
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
501
|
-
* All rights reserved.
|
|
502
|
-
* For full license text, see the LICENSE.txt file
|
|
503
|
-
*/
|
|
504
|
-
/*!
|
|
505
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
506
|
-
* All rights reserved.
|
|
507
|
-
* For full license text, see the LICENSE.txt file
|
|
508
|
-
*/
|
|
509
479
|
const { isArray: isArray$2 } = Array;
|
|
510
480
|
let Ok$1 = class Ok {
|
|
511
481
|
constructor(value) {
|
|
@@ -573,7 +543,7 @@ function rejectedPromiseLike$1(reason) {
|
|
|
573
543
|
};
|
|
574
544
|
}
|
|
575
545
|
function isPromiseLike$1(x) {
|
|
576
|
-
return typeof
|
|
546
|
+
return typeof x?.then === "function";
|
|
577
547
|
}
|
|
578
548
|
function deepEquals$1(x, y) {
|
|
579
549
|
if (x === void 0) {
|
|
@@ -864,7 +834,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
864
834
|
unsubscribe() {
|
|
865
835
|
while (this.unsubscribers.length > 0) {
|
|
866
836
|
const unsubscriber = this.unsubscribers.pop();
|
|
867
|
-
unsubscriber
|
|
837
|
+
unsubscriber?.();
|
|
868
838
|
}
|
|
869
839
|
}
|
|
870
840
|
/**
|
|
@@ -1048,16 +1018,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
1048
1018
|
};
|
|
1049
1019
|
}
|
|
1050
1020
|
|
|
1051
|
-
/*!
|
|
1052
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1053
|
-
* All rights reserved.
|
|
1054
|
-
* For full license text, see the LICENSE.txt file
|
|
1055
|
-
*/
|
|
1056
|
-
/*!
|
|
1057
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1058
|
-
* All rights reserved.
|
|
1059
|
-
* For full license text, see the LICENSE.txt file
|
|
1060
|
-
*/
|
|
1061
1021
|
let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheControlCommand {
|
|
1062
1022
|
constructor(services) {
|
|
1063
1023
|
super(services);
|
|
@@ -1167,8 +1127,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
1167
1127
|
this.services = services;
|
|
1168
1128
|
}
|
|
1169
1129
|
readFromCache(cache) {
|
|
1170
|
-
|
|
1171
|
-
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
1130
|
+
const data = cache.get(this.buildKey())?.value;
|
|
1172
1131
|
if (data === void 0) {
|
|
1173
1132
|
return resolvedPromiseLike$2(err$1(new Error("Failed to find data in cache")));
|
|
1174
1133
|
}
|
|
@@ -1197,16 +1156,6 @@ function buildServiceDescriptor$p() {
|
|
|
1197
1156
|
};
|
|
1198
1157
|
}
|
|
1199
1158
|
|
|
1200
|
-
/*!
|
|
1201
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1202
|
-
* All rights reserved.
|
|
1203
|
-
* For full license text, see the LICENSE.txt file
|
|
1204
|
-
*/
|
|
1205
|
-
/*!
|
|
1206
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1207
|
-
* All rights reserved.
|
|
1208
|
-
* For full license text, see the LICENSE.txt file
|
|
1209
|
-
*/
|
|
1210
1159
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
1211
1160
|
constructor(services) {
|
|
1212
1161
|
super(services);
|
|
@@ -1342,16 +1291,6 @@ function buildServiceDescriptor$o() {
|
|
|
1342
1291
|
};
|
|
1343
1292
|
}
|
|
1344
1293
|
|
|
1345
|
-
/*!
|
|
1346
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1347
|
-
* All rights reserved.
|
|
1348
|
-
* For full license text, see the LICENSE.txt file
|
|
1349
|
-
*/
|
|
1350
|
-
/*!
|
|
1351
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1352
|
-
* All rights reserved.
|
|
1353
|
-
* For full license text, see the LICENSE.txt file
|
|
1354
|
-
*/
|
|
1355
1294
|
class HttpCacheControlCommand extends CacheControlCommand {
|
|
1356
1295
|
constructor(services) {
|
|
1357
1296
|
super(services);
|
|
@@ -1459,16 +1398,6 @@ function buildServiceDescriptor$n() {
|
|
|
1459
1398
|
};
|
|
1460
1399
|
}
|
|
1461
1400
|
|
|
1462
|
-
/*!
|
|
1463
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1464
|
-
* All rights reserved.
|
|
1465
|
-
* For full license text, see the LICENSE.txt file
|
|
1466
|
-
*/
|
|
1467
|
-
/*!
|
|
1468
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1469
|
-
* All rights reserved.
|
|
1470
|
-
* For full license text, see the LICENSE.txt file
|
|
1471
|
-
*/
|
|
1472
1401
|
class NetworkCommand extends BaseCommand {
|
|
1473
1402
|
constructor(services) {
|
|
1474
1403
|
super();
|
|
@@ -1518,7 +1447,7 @@ function hasFetchParams(command) {
|
|
|
1518
1447
|
return command && typeof command === "object" && "fetchParams" in command;
|
|
1519
1448
|
}
|
|
1520
1449
|
function createAbortableDecorator(command, options) {
|
|
1521
|
-
if (!
|
|
1450
|
+
if (!options?.signal || !(options?.signal instanceof AbortSignal)) {
|
|
1522
1451
|
return command;
|
|
1523
1452
|
}
|
|
1524
1453
|
const { signal } = options;
|
|
@@ -1665,11 +1594,6 @@ function buildServiceDescriptor$m() {
|
|
|
1665
1594
|
};
|
|
1666
1595
|
}
|
|
1667
1596
|
|
|
1668
|
-
/*!
|
|
1669
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1670
|
-
* All rights reserved.
|
|
1671
|
-
* For full license text, see the LICENSE.txt file
|
|
1672
|
-
*/
|
|
1673
1597
|
class StreamingCommand extends BaseCommand {
|
|
1674
1598
|
constructor(services) {
|
|
1675
1599
|
super();
|
|
@@ -1705,11 +1629,6 @@ function buildServiceDescriptor$l() {
|
|
|
1705
1629
|
};
|
|
1706
1630
|
}
|
|
1707
1631
|
|
|
1708
|
-
/*!
|
|
1709
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1710
|
-
* All rights reserved.
|
|
1711
|
-
* For full license text, see the LICENSE.txt file
|
|
1712
|
-
*/
|
|
1713
1632
|
class SSECommand extends StreamingCommand {
|
|
1714
1633
|
constructor(services) {
|
|
1715
1634
|
super(services);
|
|
@@ -1788,11 +1707,6 @@ function buildServiceDescriptor$k() {
|
|
|
1788
1707
|
};
|
|
1789
1708
|
}
|
|
1790
1709
|
|
|
1791
|
-
/*!
|
|
1792
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1793
|
-
* All rights reserved.
|
|
1794
|
-
* For full license text, see the LICENSE.txt file
|
|
1795
|
-
*/
|
|
1796
1710
|
function buildInstrumentCommand(services) {
|
|
1797
1711
|
const meter = services.instrumentation.metrics.getMeter("onestore");
|
|
1798
1712
|
return function instrumentCommand(commandClass, commandName) {
|
|
@@ -1812,7 +1726,7 @@ function buildInstrumentCommand(services) {
|
|
|
1812
1726
|
try {
|
|
1813
1727
|
result = super.execute(...args);
|
|
1814
1728
|
} catch (e) {
|
|
1815
|
-
if (
|
|
1729
|
+
if (e?.name === "AbortError") {
|
|
1816
1730
|
abortCounter.add(1);
|
|
1817
1731
|
} else {
|
|
1818
1732
|
errorCounter.add(1);
|
|
@@ -1839,16 +1753,6 @@ function buildServiceDescriptor$j(instrumentation) {
|
|
|
1839
1753
|
};
|
|
1840
1754
|
}
|
|
1841
1755
|
|
|
1842
|
-
/*!
|
|
1843
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1844
|
-
* All rights reserved.
|
|
1845
|
-
* For full license text, see the LICENSE.txt file
|
|
1846
|
-
*/
|
|
1847
|
-
/*!
|
|
1848
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1849
|
-
* All rights reserved.
|
|
1850
|
-
* For full license text, see the LICENSE.txt file
|
|
1851
|
-
*/
|
|
1852
1756
|
class O11yOTelTraceAPI {
|
|
1853
1757
|
constructor(services) {
|
|
1854
1758
|
this.services = services;
|
|
@@ -1864,9 +1768,9 @@ class O11yTracer {
|
|
|
1864
1768
|
this.logger = logger;
|
|
1865
1769
|
}
|
|
1866
1770
|
startSpan(name, _options, context) {
|
|
1867
|
-
const traceId = context
|
|
1868
|
-
const spanId = context
|
|
1869
|
-
const traceFlags = context
|
|
1771
|
+
const traceId = context?.getValue(/* @__PURE__ */ Symbol.for("traceId"));
|
|
1772
|
+
const spanId = context?.getValue(/* @__PURE__ */ Symbol.for("spanId"));
|
|
1773
|
+
const traceFlags = context?.getValue(/* @__PURE__ */ Symbol.for("traceFlags"));
|
|
1870
1774
|
let spanContext = void 0;
|
|
1871
1775
|
if (traceId !== void 0 && spanId !== void 0 && traceFlags !== void 0) {
|
|
1872
1776
|
spanContext = {
|
|
@@ -2109,16 +2013,6 @@ function buildServiceDescriptor$i(logger) {
|
|
|
2109
2013
|
};
|
|
2110
2014
|
}
|
|
2111
2015
|
|
|
2112
|
-
/*!
|
|
2113
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2114
|
-
* All rights reserved.
|
|
2115
|
-
* For full license text, see the LICENSE.txt file
|
|
2116
|
-
*/
|
|
2117
|
-
/*!
|
|
2118
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2119
|
-
* All rights reserved.
|
|
2120
|
-
* For full license text, see the LICENSE.txt file
|
|
2121
|
-
*/
|
|
2122
2016
|
const { stringify: stringify$2, parse: parse$1 } = JSON;
|
|
2123
2017
|
function deepCopy$1(x) {
|
|
2124
2018
|
const stringified = stringify$2(x);
|
|
@@ -2142,7 +2036,7 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2142
2036
|
if (value === void 0) {
|
|
2143
2037
|
this.missingKeysRead.add(key);
|
|
2144
2038
|
}
|
|
2145
|
-
if (options
|
|
2039
|
+
if (options?.copy) {
|
|
2146
2040
|
return deepCopy$1(value);
|
|
2147
2041
|
}
|
|
2148
2042
|
return value;
|
|
@@ -2186,7 +2080,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2186
2080
|
get(key, options) {
|
|
2187
2081
|
const result = this.baseCache.get(key);
|
|
2188
2082
|
if (result && this.predicate(key, result)) {
|
|
2189
|
-
if (options
|
|
2083
|
+
if (options?.copy) {
|
|
2190
2084
|
return deepCopy$1(result);
|
|
2191
2085
|
}
|
|
2192
2086
|
return result;
|
|
@@ -2282,7 +2176,7 @@ let DefaultCache$1 = class DefaultCache {
|
|
|
2282
2176
|
this.data = {};
|
|
2283
2177
|
}
|
|
2284
2178
|
get(key, options) {
|
|
2285
|
-
if (options
|
|
2179
|
+
if (options?.copy) {
|
|
2286
2180
|
return deepCopy$1(this.data[key]);
|
|
2287
2181
|
}
|
|
2288
2182
|
return this.data[key];
|
|
@@ -2362,11 +2256,6 @@ function buildServiceDescriptor$h() {
|
|
|
2362
2256
|
};
|
|
2363
2257
|
}
|
|
2364
2258
|
|
|
2365
|
-
/*!
|
|
2366
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2367
|
-
* All rights reserved.
|
|
2368
|
-
* For full license text, see the LICENSE.txt file
|
|
2369
|
-
*/
|
|
2370
2259
|
class CacheControlStrategy {
|
|
2371
2260
|
constructor(services, config, requestRunner) {
|
|
2372
2261
|
this.services = services;
|
|
@@ -2427,11 +2316,11 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2427
2316
|
if (value.isOk()) {
|
|
2428
2317
|
this.collectCacheHitInstrumentation(
|
|
2429
2318
|
startTime,
|
|
2430
|
-
options
|
|
2319
|
+
options?.instrumentationAttributes
|
|
2431
2320
|
);
|
|
2432
2321
|
return ok$2(void 0);
|
|
2433
2322
|
}
|
|
2434
|
-
this.collectCacheMissInstrumentation(startTime, options
|
|
2323
|
+
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2435
2324
|
const tempCache = this.filteredCache;
|
|
2436
2325
|
return new Promise(async (resolve, reject) => {
|
|
2437
2326
|
try {
|
|
@@ -2501,11 +2390,11 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2501
2390
|
if (result.isOk()) {
|
|
2502
2391
|
this.collectCacheHitInstrumentation(
|
|
2503
2392
|
startTime,
|
|
2504
|
-
options
|
|
2393
|
+
options?.instrumentationAttributes
|
|
2505
2394
|
);
|
|
2506
2395
|
return ok$2(void 0);
|
|
2507
2396
|
}
|
|
2508
|
-
this.collectCacheMissInstrumentation(startTime, options
|
|
2397
|
+
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2509
2398
|
const error = new UserVisibleError(
|
|
2510
2399
|
new FetchResponse(HttpStatusCode$1.GatewayTimeout, {
|
|
2511
2400
|
error: "Cache miss for only-if-cached request"
|
|
@@ -2589,12 +2478,7 @@ function buildServiceDescriptor$g(cache, cacheInclusionPolicy, instrumentation)
|
|
|
2589
2478
|
};
|
|
2590
2479
|
}
|
|
2591
2480
|
|
|
2592
|
-
|
|
2593
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2594
|
-
* All rights reserved.
|
|
2595
|
-
* For full license text, see the LICENSE.txt file
|
|
2596
|
-
*/
|
|
2597
|
-
const EventTypeWildcard = Symbol("EventTypeWildcard");
|
|
2481
|
+
const EventTypeWildcard = /* @__PURE__ */ Symbol("EventTypeWildcard");
|
|
2598
2482
|
class DefaultPubSubService {
|
|
2599
2483
|
constructor() {
|
|
2600
2484
|
this.subscriptions = /* @__PURE__ */ new Map();
|
|
@@ -2657,11 +2541,6 @@ function buildServiceDescriptor$f() {
|
|
|
2657
2541
|
};
|
|
2658
2542
|
}
|
|
2659
2543
|
|
|
2660
|
-
/*!
|
|
2661
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2662
|
-
* All rights reserved.
|
|
2663
|
-
* For full license text, see the LICENSE.txt file
|
|
2664
|
-
*/
|
|
2665
2544
|
class NDJSONCommand extends StreamingCommand {
|
|
2666
2545
|
constructor(services) {
|
|
2667
2546
|
super(services);
|
|
@@ -2762,13 +2641,8 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2762
2641
|
},
|
|
2763
2642
|
};
|
|
2764
2643
|
}
|
|
2765
|
-
// version: 1.
|
|
2644
|
+
// version: 1.438.0-0ec0a89235
|
|
2766
2645
|
|
|
2767
|
-
/*!
|
|
2768
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2769
|
-
* All rights reserved.
|
|
2770
|
-
* For full license text, see the LICENSE.txt file
|
|
2771
|
-
*/
|
|
2772
2646
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2773
2647
|
constructor(config, documentRootType, services) {
|
|
2774
2648
|
super(services);
|
|
@@ -2949,11 +2823,6 @@ function buildServiceDescriptor$c() {
|
|
|
2949
2823
|
};
|
|
2950
2824
|
}
|
|
2951
2825
|
|
|
2952
|
-
/*!
|
|
2953
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2954
|
-
* All rights reserved.
|
|
2955
|
-
* For full license text, see the LICENSE.txt file
|
|
2956
|
-
*/
|
|
2957
2826
|
class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheControlCommand {
|
|
2958
2827
|
constructor(config, documentRootType, services) {
|
|
2959
2828
|
super(services);
|
|
@@ -3067,11 +2936,6 @@ function buildServiceDescriptor$b() {
|
|
|
3067
2936
|
};
|
|
3068
2937
|
}
|
|
3069
2938
|
|
|
3070
|
-
/*!
|
|
3071
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3072
|
-
* All rights reserved.
|
|
3073
|
-
* For full license text, see the LICENSE.txt file
|
|
3074
|
-
*/
|
|
3075
2939
|
class FeatureFlagsService {
|
|
3076
2940
|
constructor() {
|
|
3077
2941
|
this.flags = /* @__PURE__ */ new Map();
|
|
@@ -3115,13 +2979,8 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3115
2979
|
},
|
|
3116
2980
|
};
|
|
3117
2981
|
}
|
|
3118
|
-
// version: 1.
|
|
2982
|
+
// version: 1.438.0-0ec0a89235
|
|
3119
2983
|
|
|
3120
|
-
/*!
|
|
3121
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3122
|
-
* All rights reserved.
|
|
3123
|
-
* For full license text, see the LICENSE.txt file
|
|
3124
|
-
*/
|
|
3125
2984
|
class RetryService {
|
|
3126
2985
|
constructor(defaultRetryPolicy) {
|
|
3127
2986
|
this.defaultRetryPolicy = defaultRetryPolicy;
|
|
@@ -3272,11 +3131,6 @@ function buildServiceDescriptor$8(defaultRetryPolicy) {
|
|
|
3272
3131
|
};
|
|
3273
3132
|
}
|
|
3274
3133
|
|
|
3275
|
-
/*!
|
|
3276
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3277
|
-
* All rights reserved.
|
|
3278
|
-
* For full license text, see the LICENSE.txt file
|
|
3279
|
-
*/
|
|
3280
3134
|
function isUserVisibleError(error) {
|
|
3281
3135
|
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
3282
3136
|
}
|
|
@@ -3301,11 +3155,6 @@ function logError(error) {
|
|
|
3301
3155
|
console.error("OneStore Command threw an error that we did not expect", error);
|
|
3302
3156
|
}
|
|
3303
3157
|
|
|
3304
|
-
/*!
|
|
3305
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3306
|
-
* All rights reserved.
|
|
3307
|
-
* For full license text, see the LICENSE.txt file
|
|
3308
|
-
*/
|
|
3309
3158
|
function buildBaseImperativeInvoker(getCommand, transformResult) {
|
|
3310
3159
|
return async (...params) => {
|
|
3311
3160
|
const command = getCommand({ params, assertIsValid });
|
|
@@ -3410,7 +3259,7 @@ class SubscribableImperativeBindingsService {
|
|
|
3410
3259
|
const api = {
|
|
3411
3260
|
data: result.value.data,
|
|
3412
3261
|
subscribe: (cb) => {
|
|
3413
|
-
result.value.subscribe((result2) => {
|
|
3262
|
+
return result.value.subscribe((result2) => {
|
|
3414
3263
|
if (result2.isErr()) {
|
|
3415
3264
|
return cb({ data: void 0, error: toError(result2.error) });
|
|
3416
3265
|
}
|
|
@@ -3513,10 +3362,10 @@ class GraphQLImperativeBindingsService {
|
|
|
3513
3362
|
acceptedOperations: ["query"]
|
|
3514
3363
|
};
|
|
3515
3364
|
const result = resolveAndValidateGraphQLConfig(params[0], options);
|
|
3516
|
-
if (result
|
|
3365
|
+
if (result?.isErr()) {
|
|
3517
3366
|
return result.error;
|
|
3518
3367
|
}
|
|
3519
|
-
if (result
|
|
3368
|
+
if (result?.isOk()) {
|
|
3520
3369
|
params[0] = result.value;
|
|
3521
3370
|
}
|
|
3522
3371
|
}
|
|
@@ -3535,7 +3384,7 @@ class GraphQLImperativeBindingsService {
|
|
|
3535
3384
|
deepFreeze(result.value);
|
|
3536
3385
|
consumerEmittedData.data = result.value.data.data;
|
|
3537
3386
|
consumerEmittedData.subscribe = (cb) => {
|
|
3538
|
-
result.value.subscribe((res) => {
|
|
3387
|
+
return result.value.subscribe((res) => {
|
|
3539
3388
|
const consumerEmittedData2 = {
|
|
3540
3389
|
data: void 0,
|
|
3541
3390
|
errors: void 0
|
|
@@ -3608,11 +3457,11 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
3608
3457
|
acceptedOperations: ["query"]
|
|
3609
3458
|
};
|
|
3610
3459
|
const result = resolveAndValidateGraphQLConfig(config, options);
|
|
3611
|
-
if (result
|
|
3460
|
+
if (result?.isErr()) {
|
|
3612
3461
|
callback(result.error);
|
|
3613
3462
|
return;
|
|
3614
3463
|
}
|
|
3615
|
-
if (result
|
|
3464
|
+
if (result?.isOk()) {
|
|
3616
3465
|
config = result.value;
|
|
3617
3466
|
}
|
|
3618
3467
|
}
|
|
@@ -3643,12 +3492,12 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
3643
3492
|
acceptedOperations: ["query"]
|
|
3644
3493
|
};
|
|
3645
3494
|
const result = resolveAndValidateGraphQLConfig(config, options);
|
|
3646
|
-
if (result
|
|
3495
|
+
if (result?.isErr()) {
|
|
3647
3496
|
callback(result.error);
|
|
3648
3497
|
return () => {
|
|
3649
3498
|
};
|
|
3650
3499
|
}
|
|
3651
|
-
if (result
|
|
3500
|
+
if (result?.isOk()) {
|
|
3652
3501
|
config = result.value;
|
|
3653
3502
|
}
|
|
3654
3503
|
}
|
|
@@ -3710,13 +3559,13 @@ class GraphQLMutationBindingsService {
|
|
|
3710
3559
|
acceptedOperations: ["mutation"]
|
|
3711
3560
|
};
|
|
3712
3561
|
const result2 = resolveAndValidateGraphQLConfig(params[0], options);
|
|
3713
|
-
if (result2
|
|
3562
|
+
if (result2?.isErr()) {
|
|
3714
3563
|
return {
|
|
3715
3564
|
data: void 0,
|
|
3716
3565
|
errors: result2.error.errors
|
|
3717
3566
|
};
|
|
3718
3567
|
}
|
|
3719
|
-
if (result2
|
|
3568
|
+
if (result2?.isOk()) {
|
|
3720
3569
|
params[0] = result2.value;
|
|
3721
3570
|
}
|
|
3722
3571
|
}
|
|
@@ -3742,11 +3591,6 @@ function buildServiceDescriptor$7() {
|
|
|
3742
3591
|
};
|
|
3743
3592
|
}
|
|
3744
3593
|
|
|
3745
|
-
/*!
|
|
3746
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3747
|
-
* All rights reserved.
|
|
3748
|
-
* For full license text, see the LICENSE.txt file
|
|
3749
|
-
*/
|
|
3750
3594
|
class Sanitizer {
|
|
3751
3595
|
constructor(obj) {
|
|
3752
3596
|
this.obj = obj;
|
|
@@ -3806,7 +3650,7 @@ class CommandWireAdapterConstructor {
|
|
|
3806
3650
|
this.callback = callback;
|
|
3807
3651
|
this.connected = false;
|
|
3808
3652
|
this.exposeRefresh = false;
|
|
3809
|
-
if (!
|
|
3653
|
+
if (!options?.skipEmptyEmit) {
|
|
3810
3654
|
this.emit();
|
|
3811
3655
|
}
|
|
3812
3656
|
}
|
|
@@ -4143,11 +3987,6 @@ function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
|
4143
3987
|
};
|
|
4144
3988
|
}
|
|
4145
3989
|
|
|
4146
|
-
/*!
|
|
4147
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
4148
|
-
* All rights reserved.
|
|
4149
|
-
* For full license text, see the LICENSE.txt file
|
|
4150
|
-
*/
|
|
4151
3990
|
function e$1(e2) {
|
|
4152
3991
|
this.message = e2;
|
|
4153
3992
|
}
|
|
@@ -4379,7 +4218,7 @@ class JwtManager {
|
|
|
4379
4218
|
constructor(jwtRepository, resolver, options) {
|
|
4380
4219
|
this.jwtRepository = jwtRepository;
|
|
4381
4220
|
this.resolver = resolver;
|
|
4382
|
-
if (options
|
|
4221
|
+
if (options?.keepTokenUpdated) {
|
|
4383
4222
|
jwtRepository.subscribeToTokenNearExpiration(() => this.refreshToken());
|
|
4384
4223
|
}
|
|
4385
4224
|
}
|
|
@@ -4433,11 +4272,6 @@ class JwtManager {
|
|
|
4433
4272
|
}
|
|
4434
4273
|
}
|
|
4435
4274
|
|
|
4436
|
-
/*!
|
|
4437
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
4438
|
-
* All rights reserved.
|
|
4439
|
-
* For full license text, see the LICENSE.txt file
|
|
4440
|
-
*/
|
|
4441
4275
|
function buildServiceDescriptor$2(interceptors = {
|
|
4442
4276
|
request: [],
|
|
4443
4277
|
retry: void 0,
|
|
@@ -4448,8 +4282,7 @@ function buildServiceDescriptor$2(interceptors = {
|
|
|
4448
4282
|
type: "fetch",
|
|
4449
4283
|
version: "1.0",
|
|
4450
4284
|
service: function(...args) {
|
|
4451
|
-
|
|
4452
|
-
const context = (_a = interceptors.createContext) == null ? void 0 : _a.call(interceptors);
|
|
4285
|
+
const context = interceptors.createContext?.();
|
|
4453
4286
|
const {
|
|
4454
4287
|
request: requestInterceptors = [],
|
|
4455
4288
|
retry: retryInterceptor = void 0,
|
|
@@ -4536,25 +4369,25 @@ function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
|
4536
4369
|
errorMessage = `Unexpected ${headerName} header encountered`
|
|
4537
4370
|
} = {}) {
|
|
4538
4371
|
let hasHeaderBeenSet = false;
|
|
4539
|
-
if (resource instanceof Request && !
|
|
4372
|
+
if (resource instanceof Request && !options?.headers) {
|
|
4540
4373
|
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
4541
4374
|
throw new Error(errorMessage);
|
|
4542
4375
|
}
|
|
4543
4376
|
resource.headers.set(headerName, headerValue);
|
|
4544
4377
|
hasHeaderBeenSet = true;
|
|
4545
4378
|
}
|
|
4546
|
-
if (
|
|
4379
|
+
if (options?.headers instanceof Headers) {
|
|
4547
4380
|
if (throwOnExisting && options.headers.has(headerName)) {
|
|
4548
4381
|
throw new Error(errorMessage);
|
|
4549
4382
|
}
|
|
4550
4383
|
options.headers.set(headerName, headerValue);
|
|
4551
4384
|
} else {
|
|
4552
|
-
if (throwOnExisting &&
|
|
4385
|
+
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
4553
4386
|
throw new Error(errorMessage);
|
|
4554
4387
|
}
|
|
4555
4388
|
if (!hasHeaderBeenSet) {
|
|
4556
4389
|
options.headers = {
|
|
4557
|
-
...options
|
|
4390
|
+
...options?.headers,
|
|
4558
4391
|
[headerName]: headerValue
|
|
4559
4392
|
};
|
|
4560
4393
|
}
|
|
@@ -4625,7 +4458,9 @@ var HttpStatusCode;
|
|
|
4625
4458
|
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
4626
4459
|
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
4627
4460
|
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
4461
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
4628
4462
|
HttpStatusCode[HttpStatusCode["ServerError"] = 500] = "ServerError";
|
|
4463
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
4629
4464
|
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
4630
4465
|
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
4631
4466
|
/**
|
|
@@ -4688,7 +4523,7 @@ var TypeCheckShapes;
|
|
|
4688
4523
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
4689
4524
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
4690
4525
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
4691
|
-
// engine version: 0.160.
|
|
4526
|
+
// engine version: 0.160.5-e6ada846
|
|
4692
4527
|
|
|
4693
4528
|
const { keys: keys$1 } = Object;
|
|
4694
4529
|
|
|
@@ -5573,11 +5408,6 @@ function logCRUDLightningInteraction(eventSource, attributes) {
|
|
|
5573
5408
|
}
|
|
5574
5409
|
const instrumentation = new Instrumentation();
|
|
5575
5410
|
|
|
5576
|
-
/*!
|
|
5577
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
5578
|
-
* All rights reserved.
|
|
5579
|
-
* For full license text, see the LICENSE.txt file
|
|
5580
|
-
*/
|
|
5581
5411
|
function valueFor(value, path) {
|
|
5582
5412
|
if (path.length === 0 || path[0] === "") {
|
|
5583
5413
|
return value;
|
|
@@ -5745,7 +5575,7 @@ function getEnvironmentSetting(name) {
|
|
|
5745
5575
|
}
|
|
5746
5576
|
return undefined;
|
|
5747
5577
|
}
|
|
5748
|
-
// version: 1.
|
|
5578
|
+
// version: 1.438.0-242a4ab027
|
|
5749
5579
|
|
|
5750
5580
|
const environmentHasAura = typeof window !== 'undefined' && typeof window.$A !== 'undefined';
|
|
5751
5581
|
const defaultConfig = {
|
|
@@ -6212,6 +6042,7 @@ const CSRF_STORAGE_CONFIG = {
|
|
|
6212
6042
|
class CsrfTokenManager {
|
|
6213
6043
|
constructor() {
|
|
6214
6044
|
this.tokenPromise = null;
|
|
6045
|
+
this.refreshInFlight = null;
|
|
6215
6046
|
// Initialize AuraStorage
|
|
6216
6047
|
this.storage = createStorage(CSRF_STORAGE_CONFIG);
|
|
6217
6048
|
}
|
|
@@ -6287,20 +6118,37 @@ class CsrfTokenManager {
|
|
|
6287
6118
|
/**
|
|
6288
6119
|
* Obtains and returns a new token value as a promise.
|
|
6289
6120
|
* This will clear the cached token and fetch a fresh one.
|
|
6121
|
+
*
|
|
6122
|
+
* Concurrent calls coalesce onto a single in-flight refresh — important when
|
|
6123
|
+
* multiple requests fail with INVALID_ACCESS_TOKEN simultaneously and each
|
|
6124
|
+
* retry policy independently calls refreshToken(). Without this, every caller
|
|
6125
|
+
* triggers its own /session/csrf round-trip.
|
|
6290
6126
|
*/
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6127
|
+
refreshToken() {
|
|
6128
|
+
if (this.refreshInFlight) {
|
|
6129
|
+
return this.refreshInFlight;
|
|
6130
|
+
}
|
|
6131
|
+
const refresh = (async () => {
|
|
6132
|
+
if (this.storage) {
|
|
6133
|
+
try {
|
|
6134
|
+
await this.storage.remove(CSRF_TOKEN_KEY);
|
|
6135
|
+
}
|
|
6136
|
+
catch {
|
|
6137
|
+
// Non-fatal: continue with refresh even if clear fails
|
|
6138
|
+
}
|
|
6296
6139
|
}
|
|
6297
|
-
|
|
6298
|
-
|
|
6140
|
+
return this.fetchFreshToken();
|
|
6141
|
+
})();
|
|
6142
|
+
this.refreshInFlight = refresh;
|
|
6143
|
+
this.tokenPromise = refresh;
|
|
6144
|
+
// Clear the in-flight reference once settled (success or failure) so
|
|
6145
|
+
// subsequent token expirations can trigger a fresh refresh.
|
|
6146
|
+
refresh.finally(() => {
|
|
6147
|
+
if (this.refreshInFlight === refresh) {
|
|
6148
|
+
this.refreshInFlight = null;
|
|
6299
6149
|
}
|
|
6300
|
-
}
|
|
6301
|
-
|
|
6302
|
-
this.tokenPromise = this.fetchFreshToken();
|
|
6303
|
-
return this.tokenPromise;
|
|
6150
|
+
});
|
|
6151
|
+
return refresh;
|
|
6304
6152
|
}
|
|
6305
6153
|
/**
|
|
6306
6154
|
* Reset the singleton instance (useful for testing).
|
|
@@ -6635,6 +6483,147 @@ function buildLuvioThirdPartyTrackerFinishInterceptor() {
|
|
|
6635
6483
|
};
|
|
6636
6484
|
}
|
|
6637
6485
|
|
|
6486
|
+
const DEFAULT_CONFIG$3 = {
|
|
6487
|
+
maxRetries: 1,
|
|
6488
|
+
};
|
|
6489
|
+
class LuvioCsrfTokenRetryPolicy extends RetryPolicy {
|
|
6490
|
+
constructor(config = DEFAULT_CONFIG$3) {
|
|
6491
|
+
super();
|
|
6492
|
+
this.config = config;
|
|
6493
|
+
this.csrfTokenManager = CsrfTokenManager.getInstance();
|
|
6494
|
+
}
|
|
6495
|
+
setRequestContext(context) {
|
|
6496
|
+
this.requestContext = context;
|
|
6497
|
+
}
|
|
6498
|
+
async shouldRetry(result, context) {
|
|
6499
|
+
if (context.attempt >= this.config.maxRetries) {
|
|
6500
|
+
return false;
|
|
6501
|
+
}
|
|
6502
|
+
// UIAPI returns 401 for invalid/expired CSRF tokens; the default is 400
|
|
6503
|
+
if (result.status !== 400 && result.status !== 401) {
|
|
6504
|
+
return false;
|
|
6505
|
+
}
|
|
6506
|
+
return isCsrfError$1(result);
|
|
6507
|
+
}
|
|
6508
|
+
async calculateDelay(_result, _context) {
|
|
6509
|
+
return 0;
|
|
6510
|
+
}
|
|
6511
|
+
async prepareRetry(_result, _context) {
|
|
6512
|
+
if (!this.requestContext) {
|
|
6513
|
+
return;
|
|
6514
|
+
}
|
|
6515
|
+
const newToken = await this.csrfTokenManager.refreshToken();
|
|
6516
|
+
const req = this.requestContext.request;
|
|
6517
|
+
const { [CSRF_TOKEN_HEADER]: _stale, ...remainingHeaders } = req.headers ?? {};
|
|
6518
|
+
// If refresh failed, drop the stale token entirely so the request interceptor
|
|
6519
|
+
// will fetch a fresh one via getToken() on the retry.
|
|
6520
|
+
const headers = newToken
|
|
6521
|
+
? { ...remainingHeaders, [CSRF_TOKEN_HEADER]: newToken }
|
|
6522
|
+
: remainingHeaders;
|
|
6523
|
+
this.requestContext.request = { ...req, headers };
|
|
6524
|
+
}
|
|
6525
|
+
}
|
|
6526
|
+
/**
|
|
6527
|
+
* Returns true when a Luvio FetchResponse indicates a CSRF token error.
|
|
6528
|
+
* Body is already parsed JSON on FetchResponse, so no clone/json() needed.
|
|
6529
|
+
*
|
|
6530
|
+
* UIAPI error bodies come in both shapes: an object `{ errorCode, message }`
|
|
6531
|
+
* for single errors, or an array `[{ errorCode, message }]` for endpoints that
|
|
6532
|
+
* return collections of errors. Handle both.
|
|
6533
|
+
*/
|
|
6534
|
+
function isCsrfError$1(response) {
|
|
6535
|
+
const body = response.body;
|
|
6536
|
+
const errorCode = Array.isArray(body) ? body[0]?.errorCode : body?.errorCode;
|
|
6537
|
+
return errorCode === 'INVALID_ACCESS_TOKEN';
|
|
6538
|
+
}
|
|
6539
|
+
|
|
6540
|
+
const DEFAULT_CONFIG$2 = {
|
|
6541
|
+
maxRetries: 3,
|
|
6542
|
+
maxTimeToRetry: 10000,
|
|
6543
|
+
baseDelay: 250,
|
|
6544
|
+
maxDelay: 5000,
|
|
6545
|
+
exponentialFactor: 2,
|
|
6546
|
+
jitterPercent: 0.5,
|
|
6547
|
+
};
|
|
6548
|
+
class LuvioFetchThrottlingRetryPolicy extends RetryPolicy {
|
|
6549
|
+
constructor(config = DEFAULT_CONFIG$2) {
|
|
6550
|
+
super();
|
|
6551
|
+
this.config = config;
|
|
6552
|
+
}
|
|
6553
|
+
async shouldRetry(result, context) {
|
|
6554
|
+
return ((result.status === 429 || result.status === 503) &&
|
|
6555
|
+
context.attempt < this.config.maxRetries &&
|
|
6556
|
+
context.totalElapsedMs <= this.config.maxTimeToRetry);
|
|
6557
|
+
}
|
|
6558
|
+
async calculateDelay(result, context) {
|
|
6559
|
+
let delay;
|
|
6560
|
+
const retryAfterHeader = this.parseRetryAfterHeader(result);
|
|
6561
|
+
if (retryAfterHeader !== undefined) {
|
|
6562
|
+
delay = Math.min(retryAfterHeader, this.config.maxDelay);
|
|
6563
|
+
}
|
|
6564
|
+
else {
|
|
6565
|
+
delay = Math.min(this.config.baseDelay * Math.pow(this.config.exponentialFactor, context.attempt), this.config.maxDelay);
|
|
6566
|
+
}
|
|
6567
|
+
const jitter = delay * this.config.jitterPercent * (Math.random() - 0.5);
|
|
6568
|
+
return Math.max(0, delay + jitter);
|
|
6569
|
+
}
|
|
6570
|
+
parseRetryAfterHeader(result) {
|
|
6571
|
+
const headers = result.headers;
|
|
6572
|
+
if (!headers) {
|
|
6573
|
+
return undefined;
|
|
6574
|
+
}
|
|
6575
|
+
// FetchResponse headers is a plain { [key: string]: string } object
|
|
6576
|
+
// (no Headers.get available), so do a case-insensitive lookup manually.
|
|
6577
|
+
let value;
|
|
6578
|
+
for (const key in headers) {
|
|
6579
|
+
if (key.toLowerCase() === 'retry-after') {
|
|
6580
|
+
value = headers[key];
|
|
6581
|
+
break;
|
|
6582
|
+
}
|
|
6583
|
+
}
|
|
6584
|
+
if (!value) {
|
|
6585
|
+
return undefined;
|
|
6586
|
+
}
|
|
6587
|
+
const trimmed = value.trim();
|
|
6588
|
+
if (/^\d+$/.test(trimmed)) {
|
|
6589
|
+
const seconds = Number(trimmed);
|
|
6590
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
6591
|
+
return seconds * 1000;
|
|
6592
|
+
}
|
|
6593
|
+
return undefined;
|
|
6594
|
+
}
|
|
6595
|
+
const IMF_FIXDATE = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT$/;
|
|
6596
|
+
if (!IMF_FIXDATE.test(trimmed)) {
|
|
6597
|
+
return undefined;
|
|
6598
|
+
}
|
|
6599
|
+
const millis = Date.parse(trimmed);
|
|
6600
|
+
if (Number.isFinite(millis)) {
|
|
6601
|
+
return Math.max(0, millis - Date.now());
|
|
6602
|
+
}
|
|
6603
|
+
return undefined;
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
/**
|
|
6608
|
+
* Builds the LuvioRetryInterceptor used by the UIAPI fetch adapter.
|
|
6609
|
+
*
|
|
6610
|
+
* A fresh RetryService and policy instances are created per request to keep the
|
|
6611
|
+
* CSRF policy's mutableRequest context isolated from concurrent requests.
|
|
6612
|
+
*/
|
|
6613
|
+
function buildLuvioFetchRetryInterceptor() {
|
|
6614
|
+
return (request, doFetch) => {
|
|
6615
|
+
const csrfPolicy = new LuvioCsrfTokenRetryPolicy();
|
|
6616
|
+
const composedPolicy = new ComposedRetryPolicy([
|
|
6617
|
+
new LuvioFetchThrottlingRetryPolicy(),
|
|
6618
|
+
csrfPolicy,
|
|
6619
|
+
]);
|
|
6620
|
+
const retryService = new RetryService(composedPolicy);
|
|
6621
|
+
const mutableRequest = { request };
|
|
6622
|
+
csrfPolicy.setRequestContext(mutableRequest);
|
|
6623
|
+
return retryService.applyRetry(() => doFetch(mutableRequest.request));
|
|
6624
|
+
};
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6638
6627
|
const SFDC_REQUEST_ID_KEY = 'X-SFDC-Request-Id';
|
|
6639
6628
|
function buildTransportMarksSendInterceptor() {
|
|
6640
6629
|
return async (fetchArgs, context) => {
|
|
@@ -7033,6 +7022,7 @@ const composedFetchNetworkAdapter = {
|
|
|
7033
7022
|
buildLuvioPageScopedCacheRequestInterceptor(),
|
|
7034
7023
|
buildLuvioCsrfTokenInterceptor(),
|
|
7035
7024
|
],
|
|
7025
|
+
retry: buildLuvioFetchRetryInterceptor(),
|
|
7036
7026
|
response: [
|
|
7037
7027
|
buildLexRuntimeLuvio5xxStatusResponseInterceptor(),
|
|
7038
7028
|
buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(),
|
|
@@ -7099,12 +7089,12 @@ class CsrfTokenRetryPolicy extends RetryPolicy {
|
|
|
7099
7089
|
if (context.attempt >= this.config.maxRetries) {
|
|
7100
7090
|
return false;
|
|
7101
7091
|
}
|
|
7102
|
-
//
|
|
7103
|
-
if (result.status !== 400) {
|
|
7092
|
+
// UIAPI returns 401 for invalid/expired CSRF tokens; the default is 400.
|
|
7093
|
+
if (result.status !== 400 && result.status !== 401) {
|
|
7104
7094
|
return false;
|
|
7105
7095
|
}
|
|
7106
7096
|
// Check if this is a CSRF error by examining the response body
|
|
7107
|
-
// This avoids retrying all 400s (validation errors,
|
|
7097
|
+
// This avoids retrying all 400s/401s (validation errors, auth errors, etc.)
|
|
7108
7098
|
return isCsrfError(result);
|
|
7109
7099
|
}
|
|
7110
7100
|
/**
|
|
@@ -7153,8 +7143,10 @@ async function isCsrfError(response) {
|
|
|
7153
7143
|
// Clone to avoid consuming the original response
|
|
7154
7144
|
const cloned = response.clone();
|
|
7155
7145
|
const body = await cloned.json();
|
|
7156
|
-
//
|
|
7157
|
-
|
|
7146
|
+
// UIAPI error bodies come in both shapes: an object `{ errorCode, message }`
|
|
7147
|
+
// for single errors, or an array `[{ errorCode, message }]` for endpoints
|
|
7148
|
+
// that return collections of errors. Handle both.
|
|
7149
|
+
const errorCode = Array.isArray(body) ? body[0]?.errorCode : body?.errorCode;
|
|
7158
7150
|
return errorCode === 'INVALID_ACCESS_TOKEN';
|
|
7159
7151
|
}
|
|
7160
7152
|
catch {
|
|
@@ -9442,18 +9434,8 @@ class PredictionsReadyManager {
|
|
|
9442
9434
|
}
|
|
9443
9435
|
}
|
|
9444
9436
|
|
|
9445
|
-
/*!
|
|
9446
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
9447
|
-
* All rights reserved.
|
|
9448
|
-
* For full license text, see the LICENSE.txt file
|
|
9449
|
-
*/
|
|
9450
9437
|
class CacheInclusionPolicyService {
|
|
9451
9438
|
}
|
|
9452
|
-
/*!
|
|
9453
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
9454
|
-
* All rights reserved.
|
|
9455
|
-
* For full license text, see the LICENSE.txt file
|
|
9456
|
-
*/
|
|
9457
9439
|
class Ok {
|
|
9458
9440
|
constructor(value) {
|
|
9459
9441
|
this.value = value;
|
|
@@ -9515,18 +9497,8 @@ function rejectedPromiseLike(reason) {
|
|
|
9515
9497
|
};
|
|
9516
9498
|
}
|
|
9517
9499
|
function isPromiseLike(x) {
|
|
9518
|
-
return typeof
|
|
9500
|
+
return typeof x?.then === "function";
|
|
9519
9501
|
}
|
|
9520
|
-
/*!
|
|
9521
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
9522
|
-
* All rights reserved.
|
|
9523
|
-
* For full license text, see the LICENSE.txt file
|
|
9524
|
-
*/
|
|
9525
|
-
/*!
|
|
9526
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
9527
|
-
* All rights reserved.
|
|
9528
|
-
* For full license text, see the LICENSE.txt file
|
|
9529
|
-
*/
|
|
9530
9502
|
const { stringify, parse } = JSON;
|
|
9531
9503
|
function deepCopy(x) {
|
|
9532
9504
|
const stringified = stringify(x);
|
|
@@ -9550,7 +9522,7 @@ class DefaultRecordableCache {
|
|
|
9550
9522
|
if (value === void 0) {
|
|
9551
9523
|
this.missingKeysRead.add(key);
|
|
9552
9524
|
}
|
|
9553
|
-
if (options
|
|
9525
|
+
if (options?.copy) {
|
|
9554
9526
|
return deepCopy(value);
|
|
9555
9527
|
}
|
|
9556
9528
|
return value;
|
|
@@ -9594,7 +9566,7 @@ class DefaultFilteredCache {
|
|
|
9594
9566
|
get(key, options) {
|
|
9595
9567
|
const result = this.baseCache.get(key);
|
|
9596
9568
|
if (result && this.predicate(key, result)) {
|
|
9597
|
-
if (options
|
|
9569
|
+
if (options?.copy) {
|
|
9598
9570
|
return deepCopy(result);
|
|
9599
9571
|
}
|
|
9600
9572
|
return result;
|
|
@@ -9690,7 +9662,7 @@ class DefaultCache {
|
|
|
9690
9662
|
this.data = {};
|
|
9691
9663
|
}
|
|
9692
9664
|
get(key, options) {
|
|
9693
|
-
if (options
|
|
9665
|
+
if (options?.copy) {
|
|
9694
9666
|
return deepCopy(this.data[key]);
|
|
9695
9667
|
}
|
|
9696
9668
|
return this.data[key];
|
|
@@ -10753,4 +10725,4 @@ function ldsEngineCreator() {
|
|
|
10753
10725
|
}
|
|
10754
10726
|
|
|
10755
10727
|
export { LexRequestStrategy, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
|
|
10756
|
-
// version: 1.
|
|
10728
|
+
// version: 1.438.0-0ec0a89235
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
declare class CsrfTokenManager {
|
|
6
6
|
private static instance;
|
|
7
7
|
private tokenPromise;
|
|
8
|
+
private refreshInFlight;
|
|
8
9
|
private storage;
|
|
9
10
|
private constructor();
|
|
10
11
|
static getInstance(): CsrfTokenManager;
|
|
@@ -28,6 +29,11 @@ declare class CsrfTokenManager {
|
|
|
28
29
|
/**
|
|
29
30
|
* Obtains and returns a new token value as a promise.
|
|
30
31
|
* This will clear the cached token and fetch a fresh one.
|
|
32
|
+
*
|
|
33
|
+
* Concurrent calls coalesce onto a single in-flight refresh — important when
|
|
34
|
+
* multiple requests fail with INVALID_ACCESS_TOKEN simultaneously and each
|
|
35
|
+
* retry policy independently calls refreshToken(). Without this, every caller
|
|
36
|
+
* triggers its own /session/csrf round-trip.
|
|
31
37
|
*/
|
|
32
38
|
refreshToken(): Promise<string | undefined>;
|
|
33
39
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
|
|
2
2
|
import type { ResourceRequest } from '@luvio/engine';
|
|
3
|
+
export declare const CSRF_TOKEN_HEADER = "X-CSRF-Token";
|
|
3
4
|
/**
|
|
4
5
|
* Builds a request interceptor that adds CSRF token headers to mutating requests.
|
|
5
6
|
* The CSRF token is fetched once and cached for subsequent requests.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LuvioRetryInterceptor } from '@salesforce/lds-network-fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the LuvioRetryInterceptor used by the UIAPI fetch adapter.
|
|
4
|
+
*
|
|
5
|
+
* A fresh RetryService and policy instances are created per request to keep the
|
|
6
|
+
* CSRF policy's mutableRequest context isolated from concurrent requests.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildLuvioFetchRetryInterceptor(): LuvioRetryInterceptor;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RetryContext } from '@conduit-client/service-retry/v1';
|
|
2
|
+
import { RetryPolicy } from '@conduit-client/service-retry/v1';
|
|
3
|
+
import type { FetchResponse, ResourceRequest } from '@luvio/engine';
|
|
4
|
+
type LuvioCsrfTokenRetryPolicyConfig = {
|
|
5
|
+
maxRetries: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Mutable container for the ResourceRequest that can be updated between retries.
|
|
9
|
+
*/
|
|
10
|
+
export interface MutableLuvioRequest {
|
|
11
|
+
request: ResourceRequest;
|
|
12
|
+
}
|
|
13
|
+
export declare class LuvioCsrfTokenRetryPolicy extends RetryPolicy<FetchResponse<any>> {
|
|
14
|
+
private config;
|
|
15
|
+
private csrfTokenManager;
|
|
16
|
+
private requestContext?;
|
|
17
|
+
constructor(config?: LuvioCsrfTokenRetryPolicyConfig);
|
|
18
|
+
setRequestContext(context: MutableLuvioRequest): void;
|
|
19
|
+
shouldRetry(result: FetchResponse<any>, context: RetryContext<FetchResponse<any>>): Promise<boolean>;
|
|
20
|
+
calculateDelay(_result: FetchResponse<any>, _context: RetryContext<FetchResponse<any>>): Promise<number>;
|
|
21
|
+
prepareRetry(_result: FetchResponse<any>, _context: RetryContext<FetchResponse<any>>): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns true when a Luvio FetchResponse indicates a CSRF token error.
|
|
25
|
+
* Body is already parsed JSON on FetchResponse, so no clone/json() needed.
|
|
26
|
+
*
|
|
27
|
+
* UIAPI error bodies come in both shapes: an object `{ errorCode, message }`
|
|
28
|
+
* for single errors, or an array `[{ errorCode, message }]` for endpoints that
|
|
29
|
+
* return collections of errors. Handle both.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isCsrfError(response: FetchResponse<any>): boolean;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RetryPolicy, type RetryContext } from '@conduit-client/service-retry/v1';
|
|
2
|
+
import type { FetchResponse } from '@luvio/engine';
|
|
3
|
+
type LuvioFetchThrottlingRetryPolicyConfig = {
|
|
4
|
+
maxRetries: number;
|
|
5
|
+
maxTimeToRetry: number;
|
|
6
|
+
baseDelay: number;
|
|
7
|
+
maxDelay: number;
|
|
8
|
+
exponentialFactor: number;
|
|
9
|
+
jitterPercent: number;
|
|
10
|
+
};
|
|
11
|
+
export declare class LuvioFetchThrottlingRetryPolicy extends RetryPolicy<FetchResponse<any>> {
|
|
12
|
+
private config;
|
|
13
|
+
constructor(config?: LuvioFetchThrottlingRetryPolicyConfig);
|
|
14
|
+
shouldRetry(result: FetchResponse<any>, context: RetryContext<FetchResponse<any>>): Promise<boolean>;
|
|
15
|
+
calculateDelay(result: FetchResponse<any>, context: RetryContext<FetchResponse<any>>): Promise<number>;
|
|
16
|
+
parseRetryAfterHeader(result: FetchResponse<any>): number | undefined;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.438.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -34,60 +34,60 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@conduit-client/service-provisioner": "3.
|
|
38
|
-
"@conduit-client/tools-core": "3.
|
|
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.
|
|
37
|
+
"@conduit-client/service-provisioner": "3.20.5",
|
|
38
|
+
"@conduit-client/tools-core": "3.20.5",
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.438.0",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.438.0",
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.438.0",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.438.0",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.438.0",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.438.0",
|
|
45
|
+
"@salesforce/lds-network-adapter": "^1.438.0",
|
|
46
|
+
"@salesforce/lds-network-aura": "^1.438.0",
|
|
47
|
+
"@salesforce/lds-network-fetch": "^1.438.0",
|
|
48
48
|
"jwt-encode": "1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.
|
|
52
|
-
"@conduit-client/command-aura-network": "3.
|
|
53
|
-
"@conduit-client/command-aura-normalized-cache-control": "3.
|
|
54
|
-
"@conduit-client/command-aura-resource-cache-control": "3.
|
|
55
|
-
"@conduit-client/command-fetch-network": "3.
|
|
56
|
-
"@conduit-client/command-http-graphql-normalized-cache-control": "3.
|
|
57
|
-
"@conduit-client/command-http-normalized-cache-control": "3.
|
|
58
|
-
"@conduit-client/command-ndjson": "3.
|
|
59
|
-
"@conduit-client/command-network": "3.
|
|
60
|
-
"@conduit-client/command-sse": "3.
|
|
61
|
-
"@conduit-client/command-streaming": "3.
|
|
62
|
-
"@conduit-client/service-aura-network": "3.
|
|
63
|
-
"@conduit-client/service-bindings-imperative": "3.
|
|
64
|
-
"@conduit-client/service-bindings-lwc": "3.
|
|
65
|
-
"@conduit-client/service-cache": "3.
|
|
66
|
-
"@conduit-client/service-cache-control": "3.
|
|
67
|
-
"@conduit-client/service-cache-inclusion-policy": "3.
|
|
68
|
-
"@conduit-client/service-config": "3.
|
|
69
|
-
"@conduit-client/service-feature-flags": "3.
|
|
70
|
-
"@conduit-client/service-fetch-network": "3.
|
|
71
|
-
"@conduit-client/service-instrument-command": "3.
|
|
72
|
-
"@conduit-client/service-pubsub": "3.
|
|
73
|
-
"@conduit-client/service-store": "3.
|
|
74
|
-
"@conduit-client/utils": "3.
|
|
75
|
-
"@luvio/network-adapter-composable": "0.160.
|
|
76
|
-
"@luvio/network-adapter-fetch": "0.160.
|
|
51
|
+
"@conduit-client/command-aura-graphql-normalized-cache-control": "3.20.5",
|
|
52
|
+
"@conduit-client/command-aura-network": "3.20.5",
|
|
53
|
+
"@conduit-client/command-aura-normalized-cache-control": "3.20.5",
|
|
54
|
+
"@conduit-client/command-aura-resource-cache-control": "3.20.5",
|
|
55
|
+
"@conduit-client/command-fetch-network": "3.20.5",
|
|
56
|
+
"@conduit-client/command-http-graphql-normalized-cache-control": "3.20.5",
|
|
57
|
+
"@conduit-client/command-http-normalized-cache-control": "3.20.5",
|
|
58
|
+
"@conduit-client/command-ndjson": "3.20.5",
|
|
59
|
+
"@conduit-client/command-network": "3.20.5",
|
|
60
|
+
"@conduit-client/command-sse": "3.20.5",
|
|
61
|
+
"@conduit-client/command-streaming": "3.20.5",
|
|
62
|
+
"@conduit-client/service-aura-network": "3.20.5",
|
|
63
|
+
"@conduit-client/service-bindings-imperative": "3.20.5",
|
|
64
|
+
"@conduit-client/service-bindings-lwc": "3.20.5",
|
|
65
|
+
"@conduit-client/service-cache": "3.20.5",
|
|
66
|
+
"@conduit-client/service-cache-control": "3.20.5",
|
|
67
|
+
"@conduit-client/service-cache-inclusion-policy": "3.20.5",
|
|
68
|
+
"@conduit-client/service-config": "3.20.5",
|
|
69
|
+
"@conduit-client/service-feature-flags": "3.20.5",
|
|
70
|
+
"@conduit-client/service-fetch-network": "3.20.5",
|
|
71
|
+
"@conduit-client/service-instrument-command": "3.20.5",
|
|
72
|
+
"@conduit-client/service-pubsub": "3.20.5",
|
|
73
|
+
"@conduit-client/service-store": "3.20.5",
|
|
74
|
+
"@conduit-client/utils": "3.20.5",
|
|
75
|
+
"@luvio/network-adapter-composable": "0.160.5",
|
|
76
|
+
"@luvio/network-adapter-fetch": "0.160.5",
|
|
77
77
|
"@lwc/state": "^0.29.0",
|
|
78
|
-
"@salesforce/lds-adapters-onestore-graphql": "^1.
|
|
78
|
+
"@salesforce/lds-adapters-onestore-graphql": "^1.438.0",
|
|
79
79
|
"@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
|
|
80
|
-
"@salesforce/lds-durable-storage": "^1.
|
|
81
|
-
"@salesforce/lds-luvio-service": "^1.
|
|
82
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.
|
|
80
|
+
"@salesforce/lds-durable-storage": "^1.438.0",
|
|
81
|
+
"@salesforce/lds-luvio-service": "^1.438.0",
|
|
82
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.438.0"
|
|
83
83
|
},
|
|
84
84
|
"luvioBundlesize": [
|
|
85
85
|
{
|
|
86
86
|
"path": "./dist/ldsEngineCreator.js",
|
|
87
87
|
"maxSize": {
|
|
88
|
-
"none": "
|
|
88
|
+
"none": "383 kB",
|
|
89
89
|
"min": "190 kB",
|
|
90
|
-
"compressed": "
|
|
90
|
+
"compressed": "63 kB"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
],
|