@salesforce/lds-runtime-webruntime 1.439.0 → 1.441.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/ldsWebruntimeOneStoreInit.js +215 -301
- package/package.json +28 -28
|
@@ -25,11 +25,6 @@ import isPreviewMode from '@app/isPreviewMode';
|
|
|
25
25
|
import authenticationCookieName from '@app/authenticationCookieName';
|
|
26
26
|
import apiBasePath from '@app/apiBasePath';
|
|
27
27
|
|
|
28
|
-
/*!
|
|
29
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
30
|
-
* All rights reserved.
|
|
31
|
-
* For full license text, see the LICENSE.txt file
|
|
32
|
-
*/
|
|
33
28
|
const { create, freeze, keys, entries } = Object;
|
|
34
29
|
const { isArray: isArray$1 } = Array;
|
|
35
30
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -151,7 +146,7 @@ function rejectedPromiseLike$2(reason) {
|
|
|
151
146
|
};
|
|
152
147
|
}
|
|
153
148
|
function isPromiseLike$2(x) {
|
|
154
|
-
return typeof
|
|
149
|
+
return typeof x?.then === "function";
|
|
155
150
|
}
|
|
156
151
|
function deepEquals$1(x, y) {
|
|
157
152
|
if (x === void 0) {
|
|
@@ -321,19 +316,9 @@ function logError$1(error) {
|
|
|
321
316
|
console.error("OneStore Command threw an error that we did not expect", error);
|
|
322
317
|
}
|
|
323
318
|
|
|
324
|
-
/*!
|
|
325
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
326
|
-
* All rights reserved.
|
|
327
|
-
* For full license text, see the LICENSE.txt file
|
|
328
|
-
*/
|
|
329
319
|
class BaseCommand {
|
|
330
320
|
}
|
|
331
321
|
|
|
332
|
-
/*!
|
|
333
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
334
|
-
* All rights reserved.
|
|
335
|
-
* For full license text, see the LICENSE.txt file
|
|
336
|
-
*/
|
|
337
322
|
let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
338
323
|
constructor(services) {
|
|
339
324
|
super();
|
|
@@ -384,11 +369,6 @@ function buildServiceDescriptor$q() {
|
|
|
384
369
|
};
|
|
385
370
|
}
|
|
386
371
|
|
|
387
|
-
/*!
|
|
388
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
389
|
-
* All rights reserved.
|
|
390
|
-
* For full license text, see the LICENSE.txt file
|
|
391
|
-
*/
|
|
392
372
|
class AuraNetworkCommand extends NetworkCommand$1 {
|
|
393
373
|
constructor(services) {
|
|
394
374
|
super(services);
|
|
@@ -495,16 +475,6 @@ function buildServiceDescriptor$p() {
|
|
|
495
475
|
};
|
|
496
476
|
}
|
|
497
477
|
|
|
498
|
-
/*!
|
|
499
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
500
|
-
* All rights reserved.
|
|
501
|
-
* For full license text, see the LICENSE.txt file
|
|
502
|
-
*/
|
|
503
|
-
/*!
|
|
504
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
505
|
-
* All rights reserved.
|
|
506
|
-
* For full license text, see the LICENSE.txt file
|
|
507
|
-
*/
|
|
508
478
|
const { isArray } = Array;
|
|
509
479
|
let Ok$1 = class Ok {
|
|
510
480
|
constructor(value) {
|
|
@@ -572,7 +542,7 @@ function rejectedPromiseLike$1(reason) {
|
|
|
572
542
|
};
|
|
573
543
|
}
|
|
574
544
|
function isPromiseLike$1(x) {
|
|
575
|
-
return typeof
|
|
545
|
+
return typeof x?.then === "function";
|
|
576
546
|
}
|
|
577
547
|
function deepEquals(x, y) {
|
|
578
548
|
if (x === void 0) {
|
|
@@ -863,7 +833,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
863
833
|
unsubscribe() {
|
|
864
834
|
while (this.unsubscribers.length > 0) {
|
|
865
835
|
const unsubscriber = this.unsubscribers.pop();
|
|
866
|
-
unsubscriber
|
|
836
|
+
unsubscriber?.();
|
|
867
837
|
}
|
|
868
838
|
}
|
|
869
839
|
/**
|
|
@@ -1047,16 +1017,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
1047
1017
|
};
|
|
1048
1018
|
}
|
|
1049
1019
|
|
|
1050
|
-
/*!
|
|
1051
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1052
|
-
* All rights reserved.
|
|
1053
|
-
* For full license text, see the LICENSE.txt file
|
|
1054
|
-
*/
|
|
1055
|
-
/*!
|
|
1056
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1057
|
-
* All rights reserved.
|
|
1058
|
-
* For full license text, see the LICENSE.txt file
|
|
1059
|
-
*/
|
|
1060
1020
|
let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheControlCommand {
|
|
1061
1021
|
constructor(services) {
|
|
1062
1022
|
super(services);
|
|
@@ -1166,8 +1126,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
1166
1126
|
this.services = services;
|
|
1167
1127
|
}
|
|
1168
1128
|
readFromCache(cache) {
|
|
1169
|
-
|
|
1170
|
-
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
1129
|
+
const data = cache.get(this.buildKey())?.value;
|
|
1171
1130
|
if (data === void 0) {
|
|
1172
1131
|
return resolvedPromiseLike$2(err$1(new Error("Failed to find data in cache")));
|
|
1173
1132
|
}
|
|
@@ -1196,16 +1155,6 @@ function buildServiceDescriptor$o() {
|
|
|
1196
1155
|
};
|
|
1197
1156
|
}
|
|
1198
1157
|
|
|
1199
|
-
/*!
|
|
1200
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1201
|
-
* All rights reserved.
|
|
1202
|
-
* For full license text, see the LICENSE.txt file
|
|
1203
|
-
*/
|
|
1204
|
-
/*!
|
|
1205
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1206
|
-
* All rights reserved.
|
|
1207
|
-
* For full license text, see the LICENSE.txt file
|
|
1208
|
-
*/
|
|
1209
1158
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
1210
1159
|
constructor(services) {
|
|
1211
1160
|
super(services);
|
|
@@ -1341,16 +1290,6 @@ function buildServiceDescriptor$n() {
|
|
|
1341
1290
|
};
|
|
1342
1291
|
}
|
|
1343
1292
|
|
|
1344
|
-
/*!
|
|
1345
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1346
|
-
* All rights reserved.
|
|
1347
|
-
* For full license text, see the LICENSE.txt file
|
|
1348
|
-
*/
|
|
1349
|
-
/*!
|
|
1350
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1351
|
-
* All rights reserved.
|
|
1352
|
-
* For full license text, see the LICENSE.txt file
|
|
1353
|
-
*/
|
|
1354
1293
|
class HttpCacheControlCommand extends CacheControlCommand {
|
|
1355
1294
|
constructor(services) {
|
|
1356
1295
|
super(services);
|
|
@@ -1458,16 +1397,6 @@ function buildServiceDescriptor$m() {
|
|
|
1458
1397
|
};
|
|
1459
1398
|
}
|
|
1460
1399
|
|
|
1461
|
-
/*!
|
|
1462
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1463
|
-
* All rights reserved.
|
|
1464
|
-
* For full license text, see the LICENSE.txt file
|
|
1465
|
-
*/
|
|
1466
|
-
/*!
|
|
1467
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1468
|
-
* All rights reserved.
|
|
1469
|
-
* For full license text, see the LICENSE.txt file
|
|
1470
|
-
*/
|
|
1471
1400
|
class NetworkCommand extends BaseCommand {
|
|
1472
1401
|
constructor(services) {
|
|
1473
1402
|
super();
|
|
@@ -1517,7 +1446,7 @@ function hasFetchParams(command) {
|
|
|
1517
1446
|
return command && typeof command === "object" && "fetchParams" in command;
|
|
1518
1447
|
}
|
|
1519
1448
|
function createAbortableDecorator(command, options) {
|
|
1520
|
-
if (!
|
|
1449
|
+
if (!options?.signal || !(options?.signal instanceof AbortSignal)) {
|
|
1521
1450
|
return command;
|
|
1522
1451
|
}
|
|
1523
1452
|
const { signal } = options;
|
|
@@ -1591,9 +1520,12 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1591
1520
|
this.services = services;
|
|
1592
1521
|
this.additionalNullResponses = [];
|
|
1593
1522
|
}
|
|
1594
|
-
fetch() {
|
|
1523
|
+
fetch(contextSeed) {
|
|
1595
1524
|
try {
|
|
1596
|
-
|
|
1525
|
+
const [input, init] = this.fetchParams;
|
|
1526
|
+
const initWithSeed = contextSeed === void 0 ? init : { ...init, __contextSeed: contextSeed };
|
|
1527
|
+
const fetchCall = initWithSeed === void 0 ? this.services.fetch(input) : this.services.fetch(input, initWithSeed);
|
|
1528
|
+
return this.convertFetchResponseToData(fetchCall);
|
|
1597
1529
|
} catch (reason) {
|
|
1598
1530
|
return resolvedPromiseLike$2(err$1(toError(reason)));
|
|
1599
1531
|
}
|
|
@@ -1664,11 +1596,6 @@ function buildServiceDescriptor$l() {
|
|
|
1664
1596
|
};
|
|
1665
1597
|
}
|
|
1666
1598
|
|
|
1667
|
-
/*!
|
|
1668
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1669
|
-
* All rights reserved.
|
|
1670
|
-
* For full license text, see the LICENSE.txt file
|
|
1671
|
-
*/
|
|
1672
1599
|
class StreamingCommand extends BaseCommand {
|
|
1673
1600
|
constructor(services) {
|
|
1674
1601
|
super();
|
|
@@ -1704,11 +1631,6 @@ function buildServiceDescriptor$k() {
|
|
|
1704
1631
|
};
|
|
1705
1632
|
}
|
|
1706
1633
|
|
|
1707
|
-
/*!
|
|
1708
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1709
|
-
* All rights reserved.
|
|
1710
|
-
* For full license text, see the LICENSE.txt file
|
|
1711
|
-
*/
|
|
1712
1634
|
class SSECommand extends StreamingCommand {
|
|
1713
1635
|
constructor(services) {
|
|
1714
1636
|
super(services);
|
|
@@ -1787,11 +1709,6 @@ function buildServiceDescriptor$j() {
|
|
|
1787
1709
|
};
|
|
1788
1710
|
}
|
|
1789
1711
|
|
|
1790
|
-
/*!
|
|
1791
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1792
|
-
* All rights reserved.
|
|
1793
|
-
* For full license text, see the LICENSE.txt file
|
|
1794
|
-
*/
|
|
1795
1712
|
function buildInstrumentCommand(services) {
|
|
1796
1713
|
const meter = services.instrumentation.metrics.getMeter("onestore");
|
|
1797
1714
|
return function instrumentCommand(commandClass, commandName) {
|
|
@@ -1811,7 +1728,7 @@ function buildInstrumentCommand(services) {
|
|
|
1811
1728
|
try {
|
|
1812
1729
|
result = super.execute(...args);
|
|
1813
1730
|
} catch (e) {
|
|
1814
|
-
if (
|
|
1731
|
+
if (e?.name === "AbortError") {
|
|
1815
1732
|
abortCounter.add(1);
|
|
1816
1733
|
} else {
|
|
1817
1734
|
errorCounter.add(1);
|
|
@@ -1838,16 +1755,6 @@ function buildServiceDescriptor$i(instrumentation) {
|
|
|
1838
1755
|
};
|
|
1839
1756
|
}
|
|
1840
1757
|
|
|
1841
|
-
/*!
|
|
1842
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1843
|
-
* All rights reserved.
|
|
1844
|
-
* For full license text, see the LICENSE.txt file
|
|
1845
|
-
*/
|
|
1846
|
-
/*!
|
|
1847
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
1848
|
-
* All rights reserved.
|
|
1849
|
-
* For full license text, see the LICENSE.txt file
|
|
1850
|
-
*/
|
|
1851
1758
|
class O11yOTelTraceAPI {
|
|
1852
1759
|
constructor(services) {
|
|
1853
1760
|
this.services = services;
|
|
@@ -1863,9 +1770,9 @@ class O11yTracer {
|
|
|
1863
1770
|
this.logger = logger;
|
|
1864
1771
|
}
|
|
1865
1772
|
startSpan(name, _options, context) {
|
|
1866
|
-
const traceId = context
|
|
1867
|
-
const spanId = context
|
|
1868
|
-
const traceFlags = context
|
|
1773
|
+
const traceId = context?.getValue(/* @__PURE__ */ Symbol.for("traceId"));
|
|
1774
|
+
const spanId = context?.getValue(/* @__PURE__ */ Symbol.for("spanId"));
|
|
1775
|
+
const traceFlags = context?.getValue(/* @__PURE__ */ Symbol.for("traceFlags"));
|
|
1869
1776
|
let spanContext = void 0;
|
|
1870
1777
|
if (traceId !== void 0 && spanId !== void 0 && traceFlags !== void 0) {
|
|
1871
1778
|
spanContext = {
|
|
@@ -2108,16 +2015,6 @@ function buildServiceDescriptor$h(logger) {
|
|
|
2108
2015
|
};
|
|
2109
2016
|
}
|
|
2110
2017
|
|
|
2111
|
-
/*!
|
|
2112
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2113
|
-
* All rights reserved.
|
|
2114
|
-
* For full license text, see the LICENSE.txt file
|
|
2115
|
-
*/
|
|
2116
|
-
/*!
|
|
2117
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2118
|
-
* All rights reserved.
|
|
2119
|
-
* For full license text, see the LICENSE.txt file
|
|
2120
|
-
*/
|
|
2121
2018
|
const { stringify, parse } = JSON;
|
|
2122
2019
|
function deepCopy(x) {
|
|
2123
2020
|
const stringified = stringify(x);
|
|
@@ -2141,7 +2038,7 @@ class DefaultRecordableCache {
|
|
|
2141
2038
|
if (value === void 0) {
|
|
2142
2039
|
this.missingKeysRead.add(key);
|
|
2143
2040
|
}
|
|
2144
|
-
if (options
|
|
2041
|
+
if (options?.copy) {
|
|
2145
2042
|
return deepCopy(value);
|
|
2146
2043
|
}
|
|
2147
2044
|
return value;
|
|
@@ -2185,7 +2082,7 @@ class DefaultFilteredCache {
|
|
|
2185
2082
|
get(key, options) {
|
|
2186
2083
|
const result = this.baseCache.get(key);
|
|
2187
2084
|
if (result && this.predicate(key, result)) {
|
|
2188
|
-
if (options
|
|
2085
|
+
if (options?.copy) {
|
|
2189
2086
|
return deepCopy(result);
|
|
2190
2087
|
}
|
|
2191
2088
|
return result;
|
|
@@ -2281,7 +2178,7 @@ class DefaultCache {
|
|
|
2281
2178
|
this.data = {};
|
|
2282
2179
|
}
|
|
2283
2180
|
get(key, options) {
|
|
2284
|
-
if (options
|
|
2181
|
+
if (options?.copy) {
|
|
2285
2182
|
return deepCopy(this.data[key]);
|
|
2286
2183
|
}
|
|
2287
2184
|
return this.data[key];
|
|
@@ -2361,11 +2258,6 @@ function buildServiceDescriptor$g() {
|
|
|
2361
2258
|
};
|
|
2362
2259
|
}
|
|
2363
2260
|
|
|
2364
|
-
/*!
|
|
2365
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2366
|
-
* All rights reserved.
|
|
2367
|
-
* For full license text, see the LICENSE.txt file
|
|
2368
|
-
*/
|
|
2369
2261
|
class CacheControlStrategy {
|
|
2370
2262
|
constructor(services, config, requestRunner) {
|
|
2371
2263
|
this.services = services;
|
|
@@ -2426,11 +2318,11 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2426
2318
|
if (value.isOk()) {
|
|
2427
2319
|
this.collectCacheHitInstrumentation(
|
|
2428
2320
|
startTime,
|
|
2429
|
-
options
|
|
2321
|
+
options?.instrumentationAttributes
|
|
2430
2322
|
);
|
|
2431
2323
|
return ok$2(void 0);
|
|
2432
2324
|
}
|
|
2433
|
-
this.collectCacheMissInstrumentation(startTime, options
|
|
2325
|
+
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2434
2326
|
const tempCache = this.filteredCache;
|
|
2435
2327
|
return new Promise(async (resolve, reject) => {
|
|
2436
2328
|
try {
|
|
@@ -2500,11 +2392,11 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2500
2392
|
if (result.isOk()) {
|
|
2501
2393
|
this.collectCacheHitInstrumentation(
|
|
2502
2394
|
startTime,
|
|
2503
|
-
options
|
|
2395
|
+
options?.instrumentationAttributes
|
|
2504
2396
|
);
|
|
2505
2397
|
return ok$2(void 0);
|
|
2506
2398
|
}
|
|
2507
|
-
this.collectCacheMissInstrumentation(startTime, options
|
|
2399
|
+
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2508
2400
|
const error = new UserVisibleError(
|
|
2509
2401
|
new FetchResponse(HttpStatusCode.GatewayTimeout, {
|
|
2510
2402
|
error: "Cache miss for only-if-cached request"
|
|
@@ -2588,12 +2480,7 @@ function buildServiceDescriptor$f(cache, cacheInclusionPolicy, instrumentation)
|
|
|
2588
2480
|
};
|
|
2589
2481
|
}
|
|
2590
2482
|
|
|
2591
|
-
|
|
2592
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2593
|
-
* All rights reserved.
|
|
2594
|
-
* For full license text, see the LICENSE.txt file
|
|
2595
|
-
*/
|
|
2596
|
-
const EventTypeWildcard = Symbol("EventTypeWildcard");
|
|
2483
|
+
const EventTypeWildcard = /* @__PURE__ */ Symbol("EventTypeWildcard");
|
|
2597
2484
|
class DefaultPubSubService {
|
|
2598
2485
|
constructor() {
|
|
2599
2486
|
this.subscriptions = /* @__PURE__ */ new Map();
|
|
@@ -2656,18 +2543,8 @@ function buildServiceDescriptor$e() {
|
|
|
2656
2543
|
};
|
|
2657
2544
|
}
|
|
2658
2545
|
|
|
2659
|
-
/*!
|
|
2660
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2661
|
-
* All rights reserved.
|
|
2662
|
-
* For full license text, see the LICENSE.txt file
|
|
2663
|
-
*/
|
|
2664
2546
|
class CacheInclusionPolicyService {
|
|
2665
2547
|
}
|
|
2666
|
-
/*!
|
|
2667
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2668
|
-
* All rights reserved.
|
|
2669
|
-
* For full license text, see the LICENSE.txt file
|
|
2670
|
-
*/
|
|
2671
2548
|
class Ok {
|
|
2672
2549
|
constructor(value) {
|
|
2673
2550
|
this.value = value;
|
|
@@ -2715,7 +2592,7 @@ function rejectedPromiseLike(reason) {
|
|
|
2715
2592
|
};
|
|
2716
2593
|
}
|
|
2717
2594
|
function isPromiseLike(x) {
|
|
2718
|
-
return typeof
|
|
2595
|
+
return typeof x?.then === "function";
|
|
2719
2596
|
}
|
|
2720
2597
|
const isAndQuery = (query) => "$and" in query;
|
|
2721
2598
|
const isOrQuery = (query) => "$or" in query;
|
|
@@ -2855,11 +2732,6 @@ function buildInMemoryCacheInclusionPolicyService(cache) {
|
|
|
2855
2732
|
};
|
|
2856
2733
|
}
|
|
2857
2734
|
|
|
2858
|
-
/*!
|
|
2859
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2860
|
-
* All rights reserved.
|
|
2861
|
-
* For full license text, see the LICENSE.txt file
|
|
2862
|
-
*/
|
|
2863
2735
|
class FeatureFlagsService {
|
|
2864
2736
|
constructor() {
|
|
2865
2737
|
this.flags = /* @__PURE__ */ new Map();
|
|
@@ -2879,11 +2751,6 @@ function buildServiceDescriptor$d() {
|
|
|
2879
2751
|
};
|
|
2880
2752
|
}
|
|
2881
2753
|
|
|
2882
|
-
/*!
|
|
2883
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2884
|
-
* All rights reserved.
|
|
2885
|
-
* For full license text, see the LICENSE.txt file
|
|
2886
|
-
*/
|
|
2887
2754
|
function findExecutableOperation(input) {
|
|
2888
2755
|
const operations = input.query.definitions.filter(
|
|
2889
2756
|
(def) => def.kind === Kind.OPERATION_DEFINITION
|
|
@@ -2895,10 +2762,7 @@ function findExecutableOperation(input) {
|
|
|
2895
2762
|
return ok$2(operations[0]);
|
|
2896
2763
|
}
|
|
2897
2764
|
if (input.operationName) {
|
|
2898
|
-
const specifiedOperation = operations.find((op) =>
|
|
2899
|
-
var _a;
|
|
2900
|
-
return ((_a = op.name) == null ? void 0 : _a.value) === input.operationName;
|
|
2901
|
-
});
|
|
2765
|
+
const specifiedOperation = operations.find((op) => op.name?.value === input.operationName);
|
|
2902
2766
|
if (specifiedOperation) {
|
|
2903
2767
|
return ok$2(specifiedOperation);
|
|
2904
2768
|
}
|
|
@@ -2914,14 +2778,13 @@ function buildGraphQLInputExtension(input) {
|
|
|
2914
2778
|
const operation = operationResult.value;
|
|
2915
2779
|
const selections = operation.selectionSet.selections;
|
|
2916
2780
|
const variableDefinitions = operation.variableDefinitions;
|
|
2917
|
-
const variables =
|
|
2918
|
-
var _a;
|
|
2781
|
+
const variables = variableDefinitions?.reduce((prev, def) => {
|
|
2919
2782
|
prev[def.variable.name.value] = {
|
|
2920
2783
|
definition: def,
|
|
2921
|
-
value:
|
|
2784
|
+
value: input.variables?.[def.variable.name.value]
|
|
2922
2785
|
};
|
|
2923
2786
|
return prev;
|
|
2924
|
-
}, {})
|
|
2787
|
+
}, {}) || {};
|
|
2925
2788
|
const fragments = input.query.definitions.filter(isFragmentDefinition).reduce((prev, fragment) => {
|
|
2926
2789
|
prev[fragment.name.value] = fragment;
|
|
2927
2790
|
return prev;
|
|
@@ -2974,11 +2837,6 @@ function isFragmentDefinition(node) {
|
|
|
2974
2837
|
return node.kind === Kind.FRAGMENT_DEFINITION;
|
|
2975
2838
|
}
|
|
2976
2839
|
|
|
2977
|
-
/*!
|
|
2978
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
2979
|
-
* All rights reserved.
|
|
2980
|
-
* For full license text, see the LICENSE.txt file
|
|
2981
|
-
*/
|
|
2982
2840
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2983
2841
|
constructor(config, documentRootType, services) {
|
|
2984
2842
|
super(services);
|
|
@@ -3159,11 +3017,6 @@ function buildServiceDescriptor$c() {
|
|
|
3159
3017
|
};
|
|
3160
3018
|
}
|
|
3161
3019
|
|
|
3162
|
-
/*!
|
|
3163
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3164
|
-
* All rights reserved.
|
|
3165
|
-
* For full license text, see the LICENSE.txt file
|
|
3166
|
-
*/
|
|
3167
3020
|
class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheControlCommand {
|
|
3168
3021
|
constructor(config, documentRootType, services) {
|
|
3169
3022
|
super(services);
|
|
@@ -3277,11 +3130,6 @@ function buildServiceDescriptor$b() {
|
|
|
3277
3130
|
};
|
|
3278
3131
|
}
|
|
3279
3132
|
|
|
3280
|
-
/*!
|
|
3281
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3282
|
-
* All rights reserved.
|
|
3283
|
-
* For full license text, see the LICENSE.txt file
|
|
3284
|
-
*/
|
|
3285
3133
|
class NDJSONCommand extends StreamingCommand {
|
|
3286
3134
|
constructor(services) {
|
|
3287
3135
|
super(services);
|
|
@@ -3382,7 +3230,7 @@ function buildServiceDescriptor$9(luvio) {
|
|
|
3382
3230
|
},
|
|
3383
3231
|
};
|
|
3384
3232
|
}
|
|
3385
|
-
// version: 1.
|
|
3233
|
+
// version: 1.441.0-5e7d04c146
|
|
3386
3234
|
|
|
3387
3235
|
/**
|
|
3388
3236
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3408,13 +3256,8 @@ function buildServiceDescriptor$8(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3408
3256
|
},
|
|
3409
3257
|
};
|
|
3410
3258
|
}
|
|
3411
|
-
// version: 1.
|
|
3259
|
+
// version: 1.441.0-5e7d04c146
|
|
3412
3260
|
|
|
3413
|
-
/*!
|
|
3414
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3415
|
-
* All rights reserved.
|
|
3416
|
-
* For full license text, see the LICENSE.txt file
|
|
3417
|
-
*/
|
|
3418
3261
|
class JsonSchemaViolationError extends Error {
|
|
3419
3262
|
constructor(message, validationErrors) {
|
|
3420
3263
|
super(message);
|
|
@@ -3844,11 +3687,6 @@ function findSchemaAtPath(document, ref) {
|
|
|
3844
3687
|
return current;
|
|
3845
3688
|
}
|
|
3846
3689
|
|
|
3847
|
-
/*!
|
|
3848
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3849
|
-
* All rights reserved.
|
|
3850
|
-
* For full license text, see the LICENSE.txt file
|
|
3851
|
-
*/
|
|
3852
3690
|
function isUserVisibleError(error) {
|
|
3853
3691
|
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
3854
3692
|
}
|
|
@@ -3873,11 +3711,6 @@ function logError(error) {
|
|
|
3873
3711
|
console.error("OneStore Command threw an error that we did not expect", error);
|
|
3874
3712
|
}
|
|
3875
3713
|
|
|
3876
|
-
/*!
|
|
3877
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3878
|
-
* All rights reserved.
|
|
3879
|
-
* For full license text, see the LICENSE.txt file
|
|
3880
|
-
*/
|
|
3881
3714
|
function buildBaseImperativeInvoker(getCommand, transformResult) {
|
|
3882
3715
|
return async (...params) => {
|
|
3883
3716
|
const command = getCommand({ params, assertIsValid });
|
|
@@ -3982,7 +3815,7 @@ class SubscribableImperativeBindingsService {
|
|
|
3982
3815
|
const api = {
|
|
3983
3816
|
data: result.value.data,
|
|
3984
3817
|
subscribe: (cb) => {
|
|
3985
|
-
result.value.subscribe((result2) => {
|
|
3818
|
+
return result.value.subscribe((result2) => {
|
|
3986
3819
|
if (result2.isErr()) {
|
|
3987
3820
|
return cb({ data: void 0, error: toError(result2.error) });
|
|
3988
3821
|
}
|
|
@@ -4085,10 +3918,10 @@ class GraphQLImperativeBindingsService {
|
|
|
4085
3918
|
acceptedOperations: ["query"]
|
|
4086
3919
|
};
|
|
4087
3920
|
const result = resolveAndValidateGraphQLConfig(params[0], options);
|
|
4088
|
-
if (result
|
|
3921
|
+
if (result?.isErr()) {
|
|
4089
3922
|
return result.error;
|
|
4090
3923
|
}
|
|
4091
|
-
if (result
|
|
3924
|
+
if (result?.isOk()) {
|
|
4092
3925
|
params[0] = result.value;
|
|
4093
3926
|
}
|
|
4094
3927
|
}
|
|
@@ -4107,7 +3940,7 @@ class GraphQLImperativeBindingsService {
|
|
|
4107
3940
|
deepFreeze(result.value);
|
|
4108
3941
|
consumerEmittedData.data = result.value.data.data;
|
|
4109
3942
|
consumerEmittedData.subscribe = (cb) => {
|
|
4110
|
-
result.value.subscribe((res) => {
|
|
3943
|
+
return result.value.subscribe((res) => {
|
|
4111
3944
|
const consumerEmittedData2 = {
|
|
4112
3945
|
data: void 0,
|
|
4113
3946
|
errors: void 0
|
|
@@ -4180,11 +4013,11 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
4180
4013
|
acceptedOperations: ["query"]
|
|
4181
4014
|
};
|
|
4182
4015
|
const result = resolveAndValidateGraphQLConfig(config, options);
|
|
4183
|
-
if (result
|
|
4016
|
+
if (result?.isErr()) {
|
|
4184
4017
|
callback(result.error);
|
|
4185
4018
|
return;
|
|
4186
4019
|
}
|
|
4187
|
-
if (result
|
|
4020
|
+
if (result?.isOk()) {
|
|
4188
4021
|
config = result.value;
|
|
4189
4022
|
}
|
|
4190
4023
|
}
|
|
@@ -4215,12 +4048,12 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
4215
4048
|
acceptedOperations: ["query"]
|
|
4216
4049
|
};
|
|
4217
4050
|
const result = resolveAndValidateGraphQLConfig(config, options);
|
|
4218
|
-
if (result
|
|
4051
|
+
if (result?.isErr()) {
|
|
4219
4052
|
callback(result.error);
|
|
4220
4053
|
return () => {
|
|
4221
4054
|
};
|
|
4222
4055
|
}
|
|
4223
|
-
if (result
|
|
4056
|
+
if (result?.isOk()) {
|
|
4224
4057
|
config = result.value;
|
|
4225
4058
|
}
|
|
4226
4059
|
}
|
|
@@ -4282,13 +4115,13 @@ class GraphQLMutationBindingsService {
|
|
|
4282
4115
|
acceptedOperations: ["mutation"]
|
|
4283
4116
|
};
|
|
4284
4117
|
const result2 = resolveAndValidateGraphQLConfig(params[0], options);
|
|
4285
|
-
if (result2
|
|
4118
|
+
if (result2?.isErr()) {
|
|
4286
4119
|
return {
|
|
4287
4120
|
data: void 0,
|
|
4288
4121
|
errors: result2.error.errors
|
|
4289
4122
|
};
|
|
4290
4123
|
}
|
|
4291
|
-
if (result2
|
|
4124
|
+
if (result2?.isOk()) {
|
|
4292
4125
|
params[0] = result2.value;
|
|
4293
4126
|
}
|
|
4294
4127
|
}
|
|
@@ -4314,11 +4147,6 @@ function buildServiceDescriptor$7() {
|
|
|
4314
4147
|
};
|
|
4315
4148
|
}
|
|
4316
4149
|
|
|
4317
|
-
/*!
|
|
4318
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
4319
|
-
* All rights reserved.
|
|
4320
|
-
* For full license text, see the LICENSE.txt file
|
|
4321
|
-
*/
|
|
4322
4150
|
class Sanitizer {
|
|
4323
4151
|
constructor(obj) {
|
|
4324
4152
|
this.obj = obj;
|
|
@@ -4378,7 +4206,7 @@ class CommandWireAdapterConstructor {
|
|
|
4378
4206
|
this.callback = callback;
|
|
4379
4207
|
this.connected = false;
|
|
4380
4208
|
this.exposeRefresh = false;
|
|
4381
|
-
if (!
|
|
4209
|
+
if (!options?.skipEmptyEmit) {
|
|
4382
4210
|
this.emit();
|
|
4383
4211
|
}
|
|
4384
4212
|
}
|
|
@@ -4675,11 +4503,6 @@ function buildServiceDescriptor$2() {
|
|
|
4675
4503
|
};
|
|
4676
4504
|
}
|
|
4677
4505
|
|
|
4678
|
-
/*!
|
|
4679
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
4680
|
-
* All rights reserved.
|
|
4681
|
-
* For full license text, see the LICENSE.txt file
|
|
4682
|
-
*/
|
|
4683
4506
|
function e(e2) {
|
|
4684
4507
|
this.message = e2;
|
|
4685
4508
|
}
|
|
@@ -4735,11 +4558,13 @@ class JwtToken {
|
|
|
4735
4558
|
* @param _token - The JWT string.
|
|
4736
4559
|
* @param _decodedInfo - The decoded information from the JWT.
|
|
4737
4560
|
* @param _extraInfo - Any additional information associated with the JWT.
|
|
4561
|
+
* @param _mintParams - The parameters used to mint this token. Undefined for legacy parameterless tokens.
|
|
4738
4562
|
*/
|
|
4739
|
-
constructor(_token, _decodedInfo, _extraInfo) {
|
|
4563
|
+
constructor(_token, _decodedInfo, _extraInfo, _mintParams) {
|
|
4740
4564
|
this._token = _token;
|
|
4741
4565
|
this._decodedInfo = _decodedInfo;
|
|
4742
4566
|
this._extraInfo = _extraInfo;
|
|
4567
|
+
this._mintParams = _mintParams;
|
|
4743
4568
|
}
|
|
4744
4569
|
/**
|
|
4745
4570
|
* Get the JWT string.
|
|
@@ -4765,6 +4590,14 @@ class JwtToken {
|
|
|
4765
4590
|
get decodedInfo() {
|
|
4766
4591
|
return this._decodedInfo;
|
|
4767
4592
|
}
|
|
4593
|
+
/**
|
|
4594
|
+
* Get the mint parameters used to produce this token.
|
|
4595
|
+
*
|
|
4596
|
+
* @returns The mint parameters, or undefined for legacy parameterless tokens.
|
|
4597
|
+
*/
|
|
4598
|
+
get mintParams() {
|
|
4599
|
+
return this._mintParams;
|
|
4600
|
+
}
|
|
4768
4601
|
/**
|
|
4769
4602
|
* Get the remaining time in seconds until the JWT expires.
|
|
4770
4603
|
*
|
|
@@ -4782,6 +4615,12 @@ class JwtToken {
|
|
|
4782
4615
|
return this.tokenRemainingSeconds <= 0;
|
|
4783
4616
|
}
|
|
4784
4617
|
}
|
|
4618
|
+
function cacheKeyFor(params) {
|
|
4619
|
+
if (params === void 0) {
|
|
4620
|
+
return "jwt:";
|
|
4621
|
+
}
|
|
4622
|
+
return `jwt:${stableJSONStringify(params) ?? ""}`;
|
|
4623
|
+
}
|
|
4785
4624
|
let defaultLogger = {
|
|
4786
4625
|
trace: () => {
|
|
4787
4626
|
},
|
|
@@ -4815,85 +4654,146 @@ class JwtRepository {
|
|
|
4815
4654
|
this.limitInSeconds = limitInSeconds;
|
|
4816
4655
|
this.defaultTokenTTLInSeconds = defaultTokenTTLInSeconds;
|
|
4817
4656
|
this.logger = logger;
|
|
4657
|
+
this._tokens = /* @__PURE__ */ new Map();
|
|
4658
|
+
this.timeoutHandlers = /* @__PURE__ */ new Map();
|
|
4818
4659
|
this.observers = [];
|
|
4819
4660
|
}
|
|
4820
4661
|
/**
|
|
4821
|
-
* Get the
|
|
4662
|
+
* Get the legacy (parameterless) token. Equivalent to `getToken()` with
|
|
4663
|
+
* no args. Preserved for backward compatibility with code that reads the
|
|
4664
|
+
* `token` property directly.
|
|
4822
4665
|
*/
|
|
4823
4666
|
get token() {
|
|
4824
|
-
return this.
|
|
4667
|
+
return this.getToken();
|
|
4825
4668
|
}
|
|
4826
4669
|
/**
|
|
4827
|
-
*
|
|
4670
|
+
* Get the cached token for the given mint params.
|
|
4671
|
+
*
|
|
4672
|
+
* @param params - The mint params identifying the token. Omit for the legacy global token.
|
|
4673
|
+
*/
|
|
4674
|
+
getToken(params) {
|
|
4675
|
+
return this._tokens.get(cacheKeyFor(params));
|
|
4676
|
+
}
|
|
4677
|
+
/**
|
|
4678
|
+
* Set the cached token for the given mint params.
|
|
4828
4679
|
*
|
|
4829
4680
|
* @param token - JWT token as a string.
|
|
4830
4681
|
* @param extraInfo - Optional extra information.
|
|
4682
|
+
* @param params - The mint params identifying the token. Omit for the legacy global token.
|
|
4831
4683
|
*/
|
|
4832
|
-
setToken(token, extraInfo) {
|
|
4684
|
+
setToken(token, extraInfo, params) {
|
|
4833
4685
|
const decodedInfo = computeDecodedInfo(
|
|
4834
4686
|
token,
|
|
4835
4687
|
this.defaultTokenTTLInSeconds,
|
|
4836
4688
|
this.logger
|
|
4837
4689
|
);
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4690
|
+
const key = cacheKeyFor(params);
|
|
4691
|
+
const jwtToken = new JwtToken(token, decodedInfo, extraInfo, params);
|
|
4692
|
+
this._tokens.set(key, jwtToken);
|
|
4693
|
+
this.observeTokenExpiration(key);
|
|
4694
|
+
return jwtToken;
|
|
4841
4695
|
}
|
|
4842
4696
|
/**
|
|
4843
|
-
* Remove the
|
|
4697
|
+
* Remove the cached token for the given mint params.
|
|
4698
|
+
*
|
|
4699
|
+
* @param params - The mint params identifying the token. Omit to remove
|
|
4700
|
+
* only the legacy global-key entry (matches today's behavior of "remove
|
|
4701
|
+
* the only token there is").
|
|
4844
4702
|
*/
|
|
4845
|
-
removeToken() {
|
|
4846
|
-
|
|
4847
|
-
this.
|
|
4703
|
+
removeToken(params) {
|
|
4704
|
+
const key = cacheKeyFor(params);
|
|
4705
|
+
this._tokens.delete(key);
|
|
4706
|
+
this.clearTimeoutHandler(key);
|
|
4848
4707
|
}
|
|
4849
4708
|
/**
|
|
4850
|
-
*
|
|
4709
|
+
* Remove every cached token and clear every near-expiry timer. Used by
|
|
4710
|
+
* test teardown and full auth-reset paths that previously called
|
|
4711
|
+
* `removeToken()` to clear the single token.
|
|
4712
|
+
*/
|
|
4713
|
+
clearAllTokens() {
|
|
4714
|
+
for (const key of Array.from(this.timeoutHandlers.keys())) {
|
|
4715
|
+
this.clearTimeoutHandler(key);
|
|
4716
|
+
}
|
|
4717
|
+
this._tokens.clear();
|
|
4718
|
+
}
|
|
4719
|
+
/**
|
|
4720
|
+
* Subscribe to any cached token nearing its expiration.
|
|
4721
|
+
*
|
|
4722
|
+
* The callback receives the specific token whose timer fired. Use
|
|
4723
|
+
* `token.mintParams` to determine which token-set the expiry belongs to.
|
|
4851
4724
|
*
|
|
4852
|
-
*
|
|
4725
|
+
* Already-cached tokens are armed at subscribe time. Tokens added later
|
|
4726
|
+
* via `setToken` arm their own timers from inside `setToken`, so this
|
|
4727
|
+
* loop only needs to cover the existing entries.
|
|
4728
|
+
*
|
|
4729
|
+
* @param cb - Callback function to execute when a token is nearing expiration.
|
|
4853
4730
|
*/
|
|
4854
4731
|
subscribeToTokenNearExpiration(cb) {
|
|
4855
4732
|
this.observers.push(cb);
|
|
4856
|
-
this.
|
|
4733
|
+
for (const key of this._tokens.keys()) {
|
|
4734
|
+
this.observeTokenExpiration(key);
|
|
4735
|
+
}
|
|
4857
4736
|
return () => {
|
|
4858
4737
|
this.observers = this.observers.filter((observer) => observer !== cb);
|
|
4738
|
+
if (this.observers.length === 0) {
|
|
4739
|
+
for (const key of Array.from(this.timeoutHandlers.keys())) {
|
|
4740
|
+
this.clearTimeoutHandler(key);
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4859
4743
|
};
|
|
4860
4744
|
}
|
|
4861
4745
|
/**
|
|
4862
|
-
*
|
|
4746
|
+
* Number of currently cached tokens. Exposed for size observability so
|
|
4747
|
+
* runtime callers can emit a metric on cache growth and detect adapters
|
|
4748
|
+
* that misuse `dynamicParams` for per-request values.
|
|
4863
4749
|
*/
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4750
|
+
get size() {
|
|
4751
|
+
return this._tokens.size;
|
|
4752
|
+
}
|
|
4753
|
+
/**
|
|
4754
|
+
* Clear the timeout handler for a specific cache key.
|
|
4755
|
+
*/
|
|
4756
|
+
clearTimeoutHandler(key) {
|
|
4757
|
+
const handler = this.timeoutHandlers.get(key);
|
|
4758
|
+
if (handler !== void 0) {
|
|
4759
|
+
clearTimeout(handler);
|
|
4760
|
+
this.timeoutHandlers.delete(key);
|
|
4867
4761
|
}
|
|
4868
4762
|
}
|
|
4869
4763
|
/**
|
|
4870
|
-
* Observe and handle token
|
|
4764
|
+
* Observe and handle expiration of the token at the given cache key.
|
|
4871
4765
|
*/
|
|
4872
|
-
observeTokenExpiration() {
|
|
4873
|
-
this.clearTimeoutHandler();
|
|
4874
|
-
|
|
4766
|
+
observeTokenExpiration(key) {
|
|
4767
|
+
this.clearTimeoutHandler(key);
|
|
4768
|
+
const token = this._tokens.get(key);
|
|
4769
|
+
if (this.observers.length === 0 || token === void 0) {
|
|
4875
4770
|
return;
|
|
4876
4771
|
}
|
|
4877
|
-
|
|
4878
|
-
() => this.notifyTokenIsExpiring(),
|
|
4879
|
-
this.computeTimeoutTimeInMs()
|
|
4772
|
+
const handler = setTimeout(
|
|
4773
|
+
() => this.notifyTokenIsExpiring(key),
|
|
4774
|
+
this.computeTimeoutTimeInMs(token)
|
|
4880
4775
|
);
|
|
4776
|
+
this.timeoutHandlers.set(key, handler);
|
|
4881
4777
|
}
|
|
4882
4778
|
/**
|
|
4883
|
-
* Compute the timeout time in milliseconds.
|
|
4779
|
+
* Compute the timeout time in milliseconds for the given token.
|
|
4884
4780
|
*/
|
|
4885
|
-
computeTimeoutTimeInMs() {
|
|
4886
|
-
const remainingSeconds =
|
|
4887
|
-
|
|
4781
|
+
computeTimeoutTimeInMs(token) {
|
|
4782
|
+
const remainingSeconds = token.tokenRemainingSeconds;
|
|
4783
|
+
const timeoutTimeInSeconds = remainingSeconds - this.limitInSeconds;
|
|
4888
4784
|
return timeoutTimeInSeconds < 0 ? 0 : timeoutTimeInSeconds * 1e3;
|
|
4889
4785
|
}
|
|
4890
4786
|
/**
|
|
4891
|
-
* Notify all observers that the token is expiring.
|
|
4787
|
+
* Notify all observers that the token at the given cache key is expiring.
|
|
4892
4788
|
*/
|
|
4893
|
-
notifyTokenIsExpiring() {
|
|
4789
|
+
notifyTokenIsExpiring(key) {
|
|
4790
|
+
const token = this._tokens.get(key);
|
|
4791
|
+
if (token === void 0) {
|
|
4792
|
+
return;
|
|
4793
|
+
}
|
|
4894
4794
|
this.observers.forEach((cb) => {
|
|
4895
4795
|
try {
|
|
4896
|
-
cb.call(void 0,
|
|
4796
|
+
cb.call(void 0, token);
|
|
4897
4797
|
} catch (e2) {
|
|
4898
4798
|
this.logger.error(e2.message);
|
|
4899
4799
|
}
|
|
@@ -4911,65 +4811,71 @@ class JwtManager {
|
|
|
4911
4811
|
constructor(jwtRepository, resolver, options) {
|
|
4912
4812
|
this.jwtRepository = jwtRepository;
|
|
4913
4813
|
this.resolver = resolver;
|
|
4914
|
-
|
|
4915
|
-
|
|
4814
|
+
this.inflightPromises = /* @__PURE__ */ new Map();
|
|
4815
|
+
if (options?.keepTokenUpdated) {
|
|
4816
|
+
jwtRepository.subscribeToTokenNearExpiration(
|
|
4817
|
+
(token) => this.refreshToken(token.mintParams)
|
|
4818
|
+
);
|
|
4916
4819
|
}
|
|
4917
4820
|
}
|
|
4918
4821
|
/**
|
|
4919
|
-
* Method to get a JWT token.
|
|
4920
|
-
*
|
|
4921
|
-
* If the
|
|
4922
|
-
*
|
|
4822
|
+
* Method to get a JWT token for the given mint params.
|
|
4823
|
+
*
|
|
4824
|
+
* If a request for the same params is in flight, returns its promise. If
|
|
4825
|
+
* a cached token for those params exists and is not expired, returns it
|
|
4826
|
+
* synchronously. Otherwise initiates a refresh.
|
|
4923
4827
|
*
|
|
4924
|
-
* @
|
|
4828
|
+
* @param params - Optional mint parameters. Omit for the legacy parameterless token.
|
|
4829
|
+
* @returns The cached token (sync) or a promise that resolves to the refreshed token.
|
|
4925
4830
|
*/
|
|
4926
|
-
getJwt() {
|
|
4927
|
-
|
|
4928
|
-
|
|
4831
|
+
getJwt(params) {
|
|
4832
|
+
const key = cacheKeyFor(params);
|
|
4833
|
+
const inflight = this.inflightPromises.get(key);
|
|
4834
|
+
if (inflight) {
|
|
4835
|
+
return inflight;
|
|
4929
4836
|
}
|
|
4930
|
-
const token = this.jwtRepository.
|
|
4837
|
+
const token = this.jwtRepository.getToken(params);
|
|
4931
4838
|
if (token === void 0 || token.isExpired) {
|
|
4932
|
-
return this.refreshToken();
|
|
4839
|
+
return this.refreshToken(params);
|
|
4933
4840
|
}
|
|
4934
4841
|
return token;
|
|
4935
4842
|
}
|
|
4936
4843
|
/**
|
|
4937
|
-
* Method to refresh a JWT token.
|
|
4938
|
-
* If a refresh request is already in progress, it will return the Promise of this request.
|
|
4939
|
-
* Otherwise, it will start a new refresh request and return its Promise.
|
|
4844
|
+
* Method to refresh a JWT token for the given mint params.
|
|
4940
4845
|
*
|
|
4941
|
-
* @
|
|
4846
|
+
* @param params - Optional mint parameters. Omit for the legacy parameterless token.
|
|
4847
|
+
* @returns Promise of the refreshed token.
|
|
4942
4848
|
*/
|
|
4943
|
-
refreshToken() {
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4849
|
+
refreshToken(params) {
|
|
4850
|
+
const key = cacheKeyFor(params);
|
|
4851
|
+
const existing = this.inflightPromises.get(key);
|
|
4852
|
+
if (existing !== void 0) {
|
|
4853
|
+
return existing;
|
|
4854
|
+
}
|
|
4855
|
+
const resolverPromise = params === void 0 ? this.resolver.getJwt() : this.resolver.getJwt(params);
|
|
4856
|
+
const promise = new Promise((resolve, reject) => {
|
|
4857
|
+
resolverPromise.then(({ jwt, extraInfo }) => {
|
|
4858
|
+
this.inflightPromises.delete(key);
|
|
4859
|
+
const token = this.jwtRepository.setToken(jwt, extraInfo, params);
|
|
4860
|
+
resolve(token);
|
|
4861
|
+
}).catch((reason) => {
|
|
4862
|
+
this.inflightPromises.delete(key);
|
|
4863
|
+
reject(reason);
|
|
4954
4864
|
});
|
|
4955
|
-
}
|
|
4956
|
-
|
|
4865
|
+
});
|
|
4866
|
+
this.inflightPromises.set(key, promise);
|
|
4867
|
+
return promise;
|
|
4957
4868
|
}
|
|
4958
4869
|
/**
|
|
4959
|
-
* Method to check if
|
|
4870
|
+
* Method to check if any token refresh is in progress.
|
|
4960
4871
|
*
|
|
4961
|
-
* @returns {boolean} true if
|
|
4872
|
+
* @returns {boolean} true if at least one refresh is in flight, false otherwise.
|
|
4962
4873
|
*/
|
|
4963
4874
|
get isRefreshingToken() {
|
|
4964
|
-
return this.
|
|
4875
|
+
return this.inflightPromises.size > 0;
|
|
4965
4876
|
}
|
|
4966
4877
|
}
|
|
4967
4878
|
|
|
4968
|
-
/*!
|
|
4969
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
4970
|
-
* All rights reserved.
|
|
4971
|
-
* For full license text, see the LICENSE.txt file
|
|
4972
|
-
*/
|
|
4973
4879
|
function buildServiceDescriptor(interceptors = {
|
|
4974
4880
|
request: [],
|
|
4975
4881
|
retry: void 0,
|
|
@@ -4979,9 +4885,17 @@ function buildServiceDescriptor(interceptors = {
|
|
|
4979
4885
|
return {
|
|
4980
4886
|
type: "fetch",
|
|
4981
4887
|
version: "1.0",
|
|
4982
|
-
service: function(
|
|
4983
|
-
|
|
4984
|
-
|
|
4888
|
+
service: function(input, init) {
|
|
4889
|
+
let contextSeed;
|
|
4890
|
+
let cleanInit = init;
|
|
4891
|
+
if (init !== void 0 && "__contextSeed" in init) {
|
|
4892
|
+
const { __contextSeed, ...initWithoutSeed } = init;
|
|
4893
|
+
contextSeed = __contextSeed;
|
|
4894
|
+
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
4895
|
+
}
|
|
4896
|
+
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
4897
|
+
const baseContext = interceptors.createContext?.();
|
|
4898
|
+
const context = contextSeed === void 0 ? baseContext : { ...baseContext, ...contextSeed };
|
|
4985
4899
|
const {
|
|
4986
4900
|
request: requestInterceptors = [],
|
|
4987
4901
|
retry: retryInterceptor = void 0,
|
|
@@ -4989,17 +4903,17 @@ function buildServiceDescriptor(interceptors = {
|
|
|
4989
4903
|
finally: finallyInterceptors = []
|
|
4990
4904
|
} = interceptors;
|
|
4991
4905
|
const pending = requestInterceptors.reduce(
|
|
4992
|
-
(previousPromise, interceptor) => previousPromise.then((
|
|
4993
|
-
resolvedPromiseLike$2(
|
|
4906
|
+
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
4907
|
+
resolvedPromiseLike$2(fetchArgs)
|
|
4994
4908
|
);
|
|
4995
|
-
return Promise.resolve(pending).then((
|
|
4909
|
+
return Promise.resolve(pending).then((args) => {
|
|
4996
4910
|
if (retryInterceptor) {
|
|
4997
|
-
return retryInterceptor(
|
|
4911
|
+
return retryInterceptor(args, retryService, context);
|
|
4998
4912
|
} else {
|
|
4999
4913
|
if (retryService) {
|
|
5000
|
-
return retryService.applyRetry(() => fetch(...
|
|
4914
|
+
return retryService.applyRetry(() => fetch(...args));
|
|
5001
4915
|
}
|
|
5002
|
-
return fetch(...
|
|
4916
|
+
return fetch(...args);
|
|
5003
4917
|
}
|
|
5004
4918
|
}).then((response) => {
|
|
5005
4919
|
return responseInterceptors.reduce(
|
|
@@ -5022,25 +4936,25 @@ function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
|
5022
4936
|
errorMessage = `Unexpected ${headerName} header encountered`
|
|
5023
4937
|
} = {}) {
|
|
5024
4938
|
let hasHeaderBeenSet = false;
|
|
5025
|
-
if (resource instanceof Request && !
|
|
4939
|
+
if (resource instanceof Request && !options?.headers) {
|
|
5026
4940
|
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
5027
4941
|
throw new Error(errorMessage);
|
|
5028
4942
|
}
|
|
5029
4943
|
resource.headers.set(headerName, headerValue);
|
|
5030
4944
|
hasHeaderBeenSet = true;
|
|
5031
4945
|
}
|
|
5032
|
-
if (
|
|
4946
|
+
if (options?.headers instanceof Headers) {
|
|
5033
4947
|
if (throwOnExisting && options.headers.has(headerName)) {
|
|
5034
4948
|
throw new Error(errorMessage);
|
|
5035
4949
|
}
|
|
5036
4950
|
options.headers.set(headerName, headerValue);
|
|
5037
4951
|
} else {
|
|
5038
|
-
if (throwOnExisting &&
|
|
4952
|
+
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
5039
4953
|
throw new Error(errorMessage);
|
|
5040
4954
|
}
|
|
5041
4955
|
if (!hasHeaderBeenSet) {
|
|
5042
4956
|
options.headers = {
|
|
5043
|
-
...options
|
|
4957
|
+
...options?.headers,
|
|
5044
4958
|
[headerName]: headerValue
|
|
5045
4959
|
};
|
|
5046
4960
|
}
|
|
@@ -5332,4 +5246,4 @@ withDefaultLuvio((luvio) => {
|
|
|
5332
5246
|
];
|
|
5333
5247
|
setServices(services);
|
|
5334
5248
|
});
|
|
5335
|
-
// version: 1.
|
|
5249
|
+
// version: 1.441.0-5e7d04c146
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.441.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Webruntime runtime",
|
|
6
6
|
"main": "dist/ldsWebruntimeOneStoreInit.js",
|
|
@@ -35,38 +35,38 @@
|
|
|
35
35
|
"ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@conduit-client/service-provisioner": "3.
|
|
39
|
-
"@conduit-client/tools-core": "3.
|
|
38
|
+
"@conduit-client/service-provisioner": "3.21.0",
|
|
39
|
+
"@conduit-client/tools-core": "3.21.0",
|
|
40
40
|
"jwt-encode": "1.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@conduit-client/command-aura-network": "3.
|
|
44
|
-
"@conduit-client/command-aura-normalized-cache-control": "3.
|
|
45
|
-
"@conduit-client/command-aura-resource-cache-control": "3.
|
|
46
|
-
"@conduit-client/command-fetch-network": "3.
|
|
47
|
-
"@conduit-client/command-http-normalized-cache-control": "3.
|
|
48
|
-
"@conduit-client/command-ndjson": "3.
|
|
49
|
-
"@conduit-client/command-network": "3.
|
|
50
|
-
"@conduit-client/command-sse": "3.
|
|
51
|
-
"@conduit-client/command-streaming": "3.
|
|
52
|
-
"@conduit-client/jwt-manager": "3.
|
|
53
|
-
"@conduit-client/service-aura-network": "3.
|
|
54
|
-
"@conduit-client/service-bindings-imperative": "3.
|
|
55
|
-
"@conduit-client/service-bindings-lwc": "3.
|
|
56
|
-
"@conduit-client/service-cache": "3.
|
|
57
|
-
"@conduit-client/service-cache-control": "3.
|
|
58
|
-
"@conduit-client/service-cache-inclusion-policy": "3.
|
|
59
|
-
"@conduit-client/service-fetch-network": "3.
|
|
60
|
-
"@conduit-client/service-instrument-command": "3.
|
|
61
|
-
"@conduit-client/service-pubsub": "3.
|
|
62
|
-
"@conduit-client/service-store": "3.
|
|
63
|
-
"@conduit-client/utils": "3.
|
|
43
|
+
"@conduit-client/command-aura-network": "3.21.0",
|
|
44
|
+
"@conduit-client/command-aura-normalized-cache-control": "3.21.0",
|
|
45
|
+
"@conduit-client/command-aura-resource-cache-control": "3.21.0",
|
|
46
|
+
"@conduit-client/command-fetch-network": "3.21.0",
|
|
47
|
+
"@conduit-client/command-http-normalized-cache-control": "3.21.0",
|
|
48
|
+
"@conduit-client/command-ndjson": "3.21.0",
|
|
49
|
+
"@conduit-client/command-network": "3.21.0",
|
|
50
|
+
"@conduit-client/command-sse": "3.21.0",
|
|
51
|
+
"@conduit-client/command-streaming": "3.21.0",
|
|
52
|
+
"@conduit-client/jwt-manager": "3.21.0",
|
|
53
|
+
"@conduit-client/service-aura-network": "3.21.0",
|
|
54
|
+
"@conduit-client/service-bindings-imperative": "3.21.0",
|
|
55
|
+
"@conduit-client/service-bindings-lwc": "3.21.0",
|
|
56
|
+
"@conduit-client/service-cache": "3.21.0",
|
|
57
|
+
"@conduit-client/service-cache-control": "3.21.0",
|
|
58
|
+
"@conduit-client/service-cache-inclusion-policy": "3.21.0",
|
|
59
|
+
"@conduit-client/service-fetch-network": "3.21.0",
|
|
60
|
+
"@conduit-client/service-instrument-command": "3.21.0",
|
|
61
|
+
"@conduit-client/service-pubsub": "3.21.0",
|
|
62
|
+
"@conduit-client/service-store": "3.21.0",
|
|
63
|
+
"@conduit-client/utils": "3.21.0",
|
|
64
64
|
"@luvio/network-adapter-composable": "0.160.5",
|
|
65
65
|
"@luvio/network-adapter-fetch": "0.160.5",
|
|
66
66
|
"@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
|
|
67
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
68
|
-
"@salesforce/lds-luvio-service": "^1.
|
|
69
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.
|
|
67
|
+
"@salesforce/lds-default-luvio": "^1.441.0",
|
|
68
|
+
"@salesforce/lds-luvio-service": "^1.441.0",
|
|
69
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.441.0"
|
|
70
70
|
},
|
|
71
71
|
"luvioBundlesize": [
|
|
72
72
|
{
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"maxSize": {
|
|
75
75
|
"none": "163 kB",
|
|
76
76
|
"min": "85 kB",
|
|
77
|
-
"compressed": "
|
|
77
|
+
"compressed": "26 kB"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
],
|