@salesforce/lds-runtime-aura 1.469.0 → 1.471.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
CHANGED
|
@@ -30,19 +30,19 @@ import { instrument as instrument$4 } from 'force/adsBridge';
|
|
|
30
30
|
import { instrument as instrument$5 } from '@lwc/state';
|
|
31
31
|
import { withRegistration, register, setDefaultLuvio } from 'force/ldsEngine';
|
|
32
32
|
import { ThirdPartyTracker } from 'instrumentation:thirdPartyTracker';
|
|
33
|
+
import { createStorage, clearStorages } from 'force/ldsDurableStorage';
|
|
33
34
|
import lightningConnectEnabled from '@salesforce/gate/ui.services.LightningConnect.enabled';
|
|
34
35
|
import bypassAppRestrictionEnabled from '@salesforce/gate/ui.services.LightningConnect.BypassAppRestriction.enabled';
|
|
35
36
|
import csrfValidationEnabled from '@salesforce/gate/ui.services.LightningConnect.CsrfValidation.enabled';
|
|
36
37
|
import sessionApiEnabled from '@salesforce/gate/ui.uisdk.session.api.enabled';
|
|
37
38
|
import { pageScopedCache } from 'instrumentation/utility';
|
|
38
|
-
import { createStorage, clearStorages } from 'force/ldsDurableStorage';
|
|
39
39
|
import useHttpUiapiAuraSites from '@salesforce/gate/lds.usehttpuiapiaurasites';
|
|
40
40
|
import auraBasedRequestsEnabled from '@salesforce/gate/ui.services.auraBasedRequests.enabled';
|
|
41
41
|
import { registerSubRequestNetworkAdapter } from 'force/ldsNetwork';
|
|
42
42
|
|
|
43
43
|
const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
|
|
44
|
-
const { isArray: isArray$
|
|
45
|
-
const { stringify: stringify$
|
|
44
|
+
const { isArray: isArray$3 } = Array;
|
|
45
|
+
const { stringify: stringify$1, parse } = JSON;
|
|
46
46
|
const WeakSetConstructor = WeakSet;
|
|
47
47
|
const LogLevelMap = {
|
|
48
48
|
TRACE: 4,
|
|
@@ -83,7 +83,7 @@ class ConsoleLogger {
|
|
|
83
83
|
function loggerService(level, printer, formatter) {
|
|
84
84
|
return new ConsoleLogger(level, printer, formatter);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
class Ok {
|
|
87
87
|
constructor(value) {
|
|
88
88
|
this.value = value;
|
|
89
89
|
}
|
|
@@ -93,8 +93,8 @@ let Ok$2 = class Ok {
|
|
|
93
93
|
isErr() {
|
|
94
94
|
return !this.isOk();
|
|
95
95
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
96
|
+
}
|
|
97
|
+
class Err {
|
|
98
98
|
constructor(error) {
|
|
99
99
|
this.error = error;
|
|
100
100
|
}
|
|
@@ -104,12 +104,26 @@ let Err$1 = class Err {
|
|
|
104
104
|
isErr() {
|
|
105
105
|
return !this.isOk();
|
|
106
106
|
}
|
|
107
|
-
}
|
|
108
|
-
const ok
|
|
109
|
-
const err
|
|
107
|
+
}
|
|
108
|
+
const ok = (value) => new Ok(value);
|
|
109
|
+
const err = (err2) => new Err(err2);
|
|
110
110
|
function isResult(value) {
|
|
111
111
|
return value !== null && value !== void 0 && typeof value === "object" && "isOk" in value && "isErr" in value && typeof value.isOk === "function" && typeof value.isErr === "function" && (value.isOk() === true && value.isErr() === false && "value" in value || value.isOk() === false && value.isErr() === true && "error" in value);
|
|
112
112
|
}
|
|
113
|
+
function setDifference(setA, setB) {
|
|
114
|
+
const differenceSet = /* @__PURE__ */ new Set();
|
|
115
|
+
for (const element of setA) {
|
|
116
|
+
if (!setB.has(element)) {
|
|
117
|
+
differenceSet.add(element);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return differenceSet;
|
|
121
|
+
}
|
|
122
|
+
function addAllToSet(targetSet, sourceSet) {
|
|
123
|
+
for (const element of sourceSet) {
|
|
124
|
+
targetSet.add(element);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
113
127
|
function isSubscribable(obj) {
|
|
114
128
|
return typeof obj === "object" && obj !== null && "subscribe" in obj && typeof obj.subscribe === "function" && "refresh" in obj && typeof obj.refresh === "function";
|
|
115
129
|
}
|
|
@@ -119,15 +133,15 @@ function isSubscribableResult(x) {
|
|
|
119
133
|
}
|
|
120
134
|
return isSubscribable(x.isOk() ? x.value : x.error);
|
|
121
135
|
}
|
|
122
|
-
function buildSubscribableResult
|
|
136
|
+
function buildSubscribableResult(result, subscribe, refresh) {
|
|
123
137
|
if (result.isOk()) {
|
|
124
|
-
return ok
|
|
138
|
+
return ok({ data: result.value, subscribe, refresh });
|
|
125
139
|
} else {
|
|
126
|
-
return err
|
|
140
|
+
return err({ failure: result.error, subscribe, refresh });
|
|
127
141
|
}
|
|
128
142
|
}
|
|
129
|
-
function resolvedPromiseLike
|
|
130
|
-
if (isPromiseLike
|
|
143
|
+
function resolvedPromiseLike(result) {
|
|
144
|
+
if (isPromiseLike(result)) {
|
|
131
145
|
return result.then(
|
|
132
146
|
(nextResult) => nextResult
|
|
133
147
|
);
|
|
@@ -135,18 +149,18 @@ function resolvedPromiseLike$2(result) {
|
|
|
135
149
|
return {
|
|
136
150
|
then: (onFulfilled, _onRejected) => {
|
|
137
151
|
try {
|
|
138
|
-
return resolvedPromiseLike
|
|
152
|
+
return resolvedPromiseLike(onFulfilled(result));
|
|
139
153
|
} catch (e) {
|
|
140
154
|
if (onFulfilled === void 0) {
|
|
141
|
-
return resolvedPromiseLike
|
|
155
|
+
return resolvedPromiseLike(result);
|
|
142
156
|
}
|
|
143
|
-
return rejectedPromiseLike
|
|
157
|
+
return rejectedPromiseLike(e);
|
|
144
158
|
}
|
|
145
159
|
}
|
|
146
160
|
};
|
|
147
161
|
}
|
|
148
|
-
function rejectedPromiseLike
|
|
149
|
-
if (isPromiseLike
|
|
162
|
+
function rejectedPromiseLike(reason) {
|
|
163
|
+
if (isPromiseLike(reason)) {
|
|
150
164
|
return reason.then(
|
|
151
165
|
(nextResult) => nextResult
|
|
152
166
|
);
|
|
@@ -155,31 +169,31 @@ function rejectedPromiseLike$2(reason) {
|
|
|
155
169
|
then: (_onFulfilled, onRejected) => {
|
|
156
170
|
if (typeof onRejected === "function") {
|
|
157
171
|
try {
|
|
158
|
-
return resolvedPromiseLike
|
|
172
|
+
return resolvedPromiseLike(onRejected(reason));
|
|
159
173
|
} catch (e) {
|
|
160
|
-
return rejectedPromiseLike
|
|
174
|
+
return rejectedPromiseLike(e);
|
|
161
175
|
}
|
|
162
176
|
}
|
|
163
|
-
return rejectedPromiseLike
|
|
177
|
+
return rejectedPromiseLike(reason);
|
|
164
178
|
}
|
|
165
179
|
};
|
|
166
180
|
}
|
|
167
|
-
function isPromiseLike
|
|
181
|
+
function isPromiseLike(x) {
|
|
168
182
|
return typeof x?.then === "function";
|
|
169
183
|
}
|
|
170
|
-
function deepEquals
|
|
184
|
+
function deepEquals(x, y) {
|
|
171
185
|
if (x === void 0) {
|
|
172
186
|
return y === void 0;
|
|
173
187
|
} else if (x === null) {
|
|
174
188
|
return y === null;
|
|
175
189
|
} else if (y === null) {
|
|
176
190
|
return x === null;
|
|
177
|
-
} else if (isArray$
|
|
178
|
-
if (!isArray$
|
|
191
|
+
} else if (isArray$3(x)) {
|
|
192
|
+
if (!isArray$3(y) || x.length !== y.length) {
|
|
179
193
|
return false;
|
|
180
194
|
}
|
|
181
195
|
for (let i = 0; i < x.length; ++i) {
|
|
182
|
-
if (!deepEquals
|
|
196
|
+
if (!deepEquals(x[i], y[i])) {
|
|
183
197
|
return false;
|
|
184
198
|
}
|
|
185
199
|
}
|
|
@@ -195,7 +209,7 @@ function deepEquals$1(x, y) {
|
|
|
195
209
|
}
|
|
196
210
|
for (let i = 0; i < xkeys.length; ++i) {
|
|
197
211
|
const key = xkeys[i];
|
|
198
|
-
if (!deepEquals
|
|
212
|
+
if (!deepEquals(
|
|
199
213
|
x[key],
|
|
200
214
|
y[key]
|
|
201
215
|
)) {
|
|
@@ -218,11 +232,11 @@ function stableJSONStringify$1(node) {
|
|
|
218
232
|
return isFinite(node) ? "" + node : "null";
|
|
219
233
|
}
|
|
220
234
|
if (typeof node !== "object") {
|
|
221
|
-
return stringify$
|
|
235
|
+
return stringify$1(node);
|
|
222
236
|
}
|
|
223
237
|
let i;
|
|
224
238
|
let out;
|
|
225
|
-
if (isArray$
|
|
239
|
+
if (isArray$3(node)) {
|
|
226
240
|
out = "[";
|
|
227
241
|
for (i = 0; i < node.length; i++) {
|
|
228
242
|
if (i) {
|
|
@@ -247,7 +261,7 @@ function stableJSONStringify$1(node) {
|
|
|
247
261
|
if (out) {
|
|
248
262
|
out += ",";
|
|
249
263
|
}
|
|
250
|
-
out += stringify$
|
|
264
|
+
out += stringify$1(key) + ":" + value;
|
|
251
265
|
}
|
|
252
266
|
return "{" + out + "}";
|
|
253
267
|
}
|
|
@@ -257,6 +271,10 @@ function toError(x) {
|
|
|
257
271
|
}
|
|
258
272
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
259
273
|
}
|
|
274
|
+
function deepCopy(x) {
|
|
275
|
+
const stringified = stringify$1(x);
|
|
276
|
+
return stringified ? parse(stringified) : void 0;
|
|
277
|
+
}
|
|
260
278
|
var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
261
279
|
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
262
280
|
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
@@ -330,7 +348,7 @@ function deepFreeze(value) {
|
|
|
330
348
|
return;
|
|
331
349
|
}
|
|
332
350
|
deeplyFrozen.add(value);
|
|
333
|
-
if (isArray$
|
|
351
|
+
if (isArray$3(value)) {
|
|
334
352
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
335
353
|
deepFreeze(value[i]);
|
|
336
354
|
}
|
|
@@ -370,7 +388,7 @@ function logError$1(error) {
|
|
|
370
388
|
class BaseCommand {
|
|
371
389
|
}
|
|
372
390
|
|
|
373
|
-
|
|
391
|
+
class NetworkCommand extends BaseCommand {
|
|
374
392
|
constructor(services) {
|
|
375
393
|
super();
|
|
376
394
|
this.services = services;
|
|
@@ -386,7 +404,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
386
404
|
}
|
|
387
405
|
fetchSubscribableResult(res) {
|
|
388
406
|
return res.then((networkResult) => {
|
|
389
|
-
return buildSubscribableResult
|
|
407
|
+
return buildSubscribableResult(
|
|
390
408
|
networkResult,
|
|
391
409
|
(cb) => {
|
|
392
410
|
this.subscriptions.push(cb);
|
|
@@ -401,7 +419,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
401
419
|
refresh() {
|
|
402
420
|
return this.execute().then((newResult) => {
|
|
403
421
|
if (isSubscribableResult(newResult)) {
|
|
404
|
-
const value = newResult.isOk() ? ok
|
|
422
|
+
const value = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
405
423
|
this.subscriptions.forEach((cb) => {
|
|
406
424
|
try {
|
|
407
425
|
cb(value);
|
|
@@ -409,21 +427,21 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
409
427
|
}
|
|
410
428
|
});
|
|
411
429
|
}
|
|
412
|
-
return ok
|
|
430
|
+
return ok(void 0);
|
|
413
431
|
});
|
|
414
432
|
}
|
|
415
433
|
async afterRequestHooks(_options) {
|
|
416
434
|
}
|
|
417
|
-
}
|
|
418
|
-
function buildServiceDescriptor$
|
|
435
|
+
}
|
|
436
|
+
function buildServiceDescriptor$r() {
|
|
419
437
|
return {
|
|
420
438
|
type: "networkCommandBaseClass",
|
|
421
439
|
version: "1.0",
|
|
422
|
-
service: NetworkCommand
|
|
440
|
+
service: NetworkCommand
|
|
423
441
|
};
|
|
424
442
|
}
|
|
425
443
|
|
|
426
|
-
function applyOperationRequestOptions
|
|
444
|
+
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
427
445
|
if (operationType === void 0 && requestOptions === void 0) {
|
|
428
446
|
return init;
|
|
429
447
|
}
|
|
@@ -436,7 +454,164 @@ function applyOperationRequestOptions$3(init, operationType, requestOptions) {
|
|
|
436
454
|
}
|
|
437
455
|
};
|
|
438
456
|
}
|
|
439
|
-
|
|
457
|
+
function buildServiceDescriptor$q(interceptors = {
|
|
458
|
+
request: [],
|
|
459
|
+
retry: void 0,
|
|
460
|
+
response: [],
|
|
461
|
+
finally: []
|
|
462
|
+
}, retryService) {
|
|
463
|
+
return {
|
|
464
|
+
type: "fetch",
|
|
465
|
+
version: "1.0",
|
|
466
|
+
service: function(input, init) {
|
|
467
|
+
let contextSeed;
|
|
468
|
+
let cleanInit = init;
|
|
469
|
+
if (init !== void 0 && "__contextSeed" in init) {
|
|
470
|
+
const { __contextSeed, ...initWithoutSeed } = init;
|
|
471
|
+
contextSeed = __contextSeed;
|
|
472
|
+
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
473
|
+
}
|
|
474
|
+
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
475
|
+
const baseContext = interceptors.createContext?.();
|
|
476
|
+
const onestore = cleanInit?.onestore;
|
|
477
|
+
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
478
|
+
...baseContext,
|
|
479
|
+
...contextSeed,
|
|
480
|
+
...onestore !== void 0 && { onestore }
|
|
481
|
+
};
|
|
482
|
+
const {
|
|
483
|
+
request: requestInterceptors = [],
|
|
484
|
+
retry: retryInterceptor = void 0,
|
|
485
|
+
response: responseInterceptors = [],
|
|
486
|
+
finally: finallyInterceptors = []
|
|
487
|
+
} = interceptors;
|
|
488
|
+
const pending = requestInterceptors.reduce(
|
|
489
|
+
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
490
|
+
resolvedPromiseLike(fetchArgs)
|
|
491
|
+
);
|
|
492
|
+
return Promise.resolve(pending).then((args) => {
|
|
493
|
+
if (retryInterceptor) {
|
|
494
|
+
return retryInterceptor(args, retryService, context);
|
|
495
|
+
} else {
|
|
496
|
+
if (retryService) {
|
|
497
|
+
return retryService.applyRetry(() => fetch(...args));
|
|
498
|
+
}
|
|
499
|
+
return fetch(...args);
|
|
500
|
+
}
|
|
501
|
+
}).then((response) => {
|
|
502
|
+
return responseInterceptors.reduce(
|
|
503
|
+
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
504
|
+
resolvedPromiseLike(response)
|
|
505
|
+
);
|
|
506
|
+
}).finally(() => {
|
|
507
|
+
if (finallyInterceptors.length > 0) {
|
|
508
|
+
return finallyInterceptors.reduce(
|
|
509
|
+
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
510
|
+
Promise.resolve()
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
let textEncoder;
|
|
518
|
+
function getTextEncoder() {
|
|
519
|
+
if (!textEncoder) {
|
|
520
|
+
if (typeof TextEncoder === "undefined") {
|
|
521
|
+
throw new Error(
|
|
522
|
+
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
textEncoder = new TextEncoder();
|
|
526
|
+
}
|
|
527
|
+
return textEncoder;
|
|
528
|
+
}
|
|
529
|
+
function buildCompressionInterceptor(defaultConfig) {
|
|
530
|
+
return async (args) => {
|
|
531
|
+
const [resource, options = {}] = args;
|
|
532
|
+
const config = options.onestore?.compression ?? defaultConfig;
|
|
533
|
+
if (config === void 0) {
|
|
534
|
+
return resolvedPromiseLike(args);
|
|
535
|
+
}
|
|
536
|
+
const threshold = config.threshold ?? 1024;
|
|
537
|
+
if (!options.body || typeof options.body !== "string") {
|
|
538
|
+
return resolvedPromiseLike(args);
|
|
539
|
+
}
|
|
540
|
+
if (typeof CompressionStream === "undefined") {
|
|
541
|
+
return resolvedPromiseLike(args);
|
|
542
|
+
}
|
|
543
|
+
const headers = new Headers(options.headers);
|
|
544
|
+
if (headers.has("Content-Encoding")) {
|
|
545
|
+
return resolvedPromiseLike(args);
|
|
546
|
+
}
|
|
547
|
+
const encodedBody = getTextEncoder().encode(options.body);
|
|
548
|
+
if (encodedBody.byteLength < threshold) {
|
|
549
|
+
return resolvedPromiseLike(args);
|
|
550
|
+
}
|
|
551
|
+
try {
|
|
552
|
+
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
553
|
+
const compressedBody = await new Response(stream).blob();
|
|
554
|
+
headers.set("Content-Encoding", config.algorithm);
|
|
555
|
+
headers.delete("Content-Length");
|
|
556
|
+
const compressedOptions = {
|
|
557
|
+
...options,
|
|
558
|
+
body: compressedBody,
|
|
559
|
+
headers
|
|
560
|
+
};
|
|
561
|
+
return resolvedPromiseLike([resource, compressedOptions]);
|
|
562
|
+
} catch {
|
|
563
|
+
return resolvedPromiseLike(args);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
568
|
+
throwOnExisting = false,
|
|
569
|
+
errorMessage = `Unexpected ${headerName} header encountered`
|
|
570
|
+
} = {}) {
|
|
571
|
+
let hasHeaderBeenSet = false;
|
|
572
|
+
if (resource instanceof Request && !options?.headers) {
|
|
573
|
+
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
574
|
+
throw new Error(errorMessage);
|
|
575
|
+
}
|
|
576
|
+
resource.headers.set(headerName, headerValue);
|
|
577
|
+
hasHeaderBeenSet = true;
|
|
578
|
+
}
|
|
579
|
+
if (options?.headers instanceof Headers) {
|
|
580
|
+
if (throwOnExisting && options.headers.has(headerName)) {
|
|
581
|
+
throw new Error(errorMessage);
|
|
582
|
+
}
|
|
583
|
+
options.headers.set(headerName, headerValue);
|
|
584
|
+
} else {
|
|
585
|
+
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
586
|
+
throw new Error(errorMessage);
|
|
587
|
+
}
|
|
588
|
+
if (!hasHeaderBeenSet) {
|
|
589
|
+
options.headers = {
|
|
590
|
+
...options?.headers,
|
|
591
|
+
[headerName]: headerValue
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return [resource, options];
|
|
596
|
+
}
|
|
597
|
+
const UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE = "Unexpected Authorization header encountered. To specify a custom Authorization header, use a Fetch service that is not configured with JwtRequestHeaderInterceptor";
|
|
598
|
+
function setHeaderAuthorization({ token }, fetchParams) {
|
|
599
|
+
const authorizationValue = `Bearer ${token}`;
|
|
600
|
+
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
601
|
+
throwOnExisting: true,
|
|
602
|
+
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
606
|
+
return (args) => {
|
|
607
|
+
return resolvedPromiseLike(jwtManager.getJwt()).then((token) => {
|
|
608
|
+
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
609
|
+
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
class AuraNetworkCommand extends NetworkCommand {
|
|
440
615
|
constructor(services) {
|
|
441
616
|
super(services);
|
|
442
617
|
this.services = services;
|
|
@@ -490,19 +665,19 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
490
665
|
this.afterRequestHooks({ statusCode: 200 });
|
|
491
666
|
} catch {
|
|
492
667
|
}
|
|
493
|
-
return ok
|
|
668
|
+
return ok(auraReturnValue);
|
|
494
669
|
}).catch((error) => {
|
|
495
670
|
if (!error) {
|
|
496
|
-
return err
|
|
671
|
+
return err(toError("Failed to get error from response"));
|
|
497
672
|
}
|
|
498
673
|
if (!error.getError) {
|
|
499
|
-
return err
|
|
674
|
+
return err(toError(error));
|
|
500
675
|
}
|
|
501
676
|
const actionErrors = error.getError();
|
|
502
677
|
if (actionErrors.length > 0) {
|
|
503
|
-
return err
|
|
678
|
+
return err(coerceError(actionErrors));
|
|
504
679
|
}
|
|
505
|
-
return err
|
|
680
|
+
return err(toError("Error fetching component"));
|
|
506
681
|
});
|
|
507
682
|
}
|
|
508
683
|
isSemanticNullResponse(response) {
|
|
@@ -520,10 +695,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
520
695
|
if (response2.ok) {
|
|
521
696
|
let resultPromise;
|
|
522
697
|
if (this.isSemanticNullResponse(response2)) {
|
|
523
|
-
resultPromise = Promise.resolve(ok
|
|
698
|
+
resultPromise = Promise.resolve(ok(null));
|
|
524
699
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
525
700
|
resultPromise = Promise.resolve(
|
|
526
|
-
err
|
|
701
|
+
err(
|
|
527
702
|
toError(
|
|
528
703
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
529
704
|
)
|
|
@@ -531,8 +706,8 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
531
706
|
);
|
|
532
707
|
} else {
|
|
533
708
|
resultPromise = response2.json().then(
|
|
534
|
-
(json) => ok
|
|
535
|
-
(reason) => err
|
|
709
|
+
(json) => ok(json),
|
|
710
|
+
(reason) => err(toError(reason))
|
|
536
711
|
);
|
|
537
712
|
}
|
|
538
713
|
return resultPromise.finally(() => {
|
|
@@ -543,7 +718,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
543
718
|
});
|
|
544
719
|
} else {
|
|
545
720
|
return this.coerceError(response2).then((coercedError) => {
|
|
546
|
-
return err
|
|
721
|
+
return err(coercedError);
|
|
547
722
|
}).finally(() => {
|
|
548
723
|
try {
|
|
549
724
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -552,7 +727,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
552
727
|
});
|
|
553
728
|
}
|
|
554
729
|
},
|
|
555
|
-
(reason) => err
|
|
730
|
+
(reason) => err(toError(reason))
|
|
556
731
|
);
|
|
557
732
|
}
|
|
558
733
|
shouldUseAuraNetwork() {
|
|
@@ -576,7 +751,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
576
751
|
);
|
|
577
752
|
} else if (this.shouldUseFetch()) {
|
|
578
753
|
const [input, init] = this.fetchParams;
|
|
579
|
-
const initWithOptions = applyOperationRequestOptions
|
|
754
|
+
const initWithOptions = applyOperationRequestOptions(
|
|
580
755
|
init,
|
|
581
756
|
this.operationType,
|
|
582
757
|
this.requestOptions
|
|
@@ -585,10 +760,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
585
760
|
const fetchCall = initWithOptions === void 0 ? this.services.fetch(input) : this.services.fetch(input, initWithOptions);
|
|
586
761
|
return this.convertFetchResponseToData(fetchCall);
|
|
587
762
|
} catch (reason) {
|
|
588
|
-
return resolvedPromiseLike
|
|
763
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
589
764
|
}
|
|
590
765
|
}
|
|
591
|
-
return resolvedPromiseLike
|
|
766
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
592
767
|
}
|
|
593
768
|
}
|
|
594
769
|
function buildServiceDescriptor$p() {
|
|
@@ -599,164 +774,52 @@ function buildServiceDescriptor$p() {
|
|
|
599
774
|
};
|
|
600
775
|
}
|
|
601
776
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
777
|
+
function setOverlaps(setA, setB) {
|
|
778
|
+
if (setA.size > setB.size) {
|
|
779
|
+
for (const key of setB.keys()) {
|
|
780
|
+
if (setA.has(key)) {
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
} else {
|
|
785
|
+
for (const key of setA) {
|
|
786
|
+
if (setB.has(key)) {
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
609
790
|
}
|
|
610
|
-
|
|
611
|
-
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
class CacheControlRequestRunner {
|
|
794
|
+
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
795
|
+
this.readFromCacheInternal = readFromCache;
|
|
796
|
+
this.requestFromNetworkInternal = requestFromNetwork;
|
|
797
|
+
this.writeToCacheInternal = writeToCache;
|
|
612
798
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
799
|
+
readFromCache(cache) {
|
|
800
|
+
const resultPromise = this.readFromCacheInternal(cache);
|
|
801
|
+
return resultPromise.then((result) => {
|
|
802
|
+
if (result.isErr()) {
|
|
803
|
+
return err(result.error.failure);
|
|
804
|
+
}
|
|
805
|
+
this.returnData = result;
|
|
806
|
+
return ok(void 0);
|
|
807
|
+
});
|
|
617
808
|
}
|
|
618
|
-
|
|
619
|
-
|
|
809
|
+
requestFromNetwork() {
|
|
810
|
+
const that = this;
|
|
811
|
+
return (async function* () {
|
|
812
|
+
const result = await that.requestFromNetworkInternal();
|
|
813
|
+
if (result.isErr()) {
|
|
814
|
+
that.networkError = result;
|
|
815
|
+
} else {
|
|
816
|
+
that.networkData = result;
|
|
817
|
+
}
|
|
818
|
+
yield result;
|
|
819
|
+
})();
|
|
620
820
|
}
|
|
621
|
-
|
|
622
|
-
return
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
const ok$1 = (value) => new Ok$1(value);
|
|
626
|
-
const err = (err2) => new Err(err2);
|
|
627
|
-
function buildSubscribableResult(result, subscribe, refresh) {
|
|
628
|
-
if (result.isOk()) {
|
|
629
|
-
return ok$1({ data: result.value, subscribe, refresh });
|
|
630
|
-
} else {
|
|
631
|
-
return err({ failure: result.error, subscribe, refresh });
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
function resolvedPromiseLike$1(result) {
|
|
635
|
-
if (isPromiseLike$1(result)) {
|
|
636
|
-
return result.then(
|
|
637
|
-
(nextResult) => nextResult
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
return {
|
|
641
|
-
then: (onFulfilled, _onRejected) => {
|
|
642
|
-
try {
|
|
643
|
-
return resolvedPromiseLike$1(onFulfilled(result));
|
|
644
|
-
} catch (e) {
|
|
645
|
-
if (onFulfilled === void 0) {
|
|
646
|
-
return resolvedPromiseLike$1(result);
|
|
647
|
-
}
|
|
648
|
-
return rejectedPromiseLike$1(e);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
function rejectedPromiseLike$1(reason) {
|
|
654
|
-
if (isPromiseLike$1(reason)) {
|
|
655
|
-
return reason.then(
|
|
656
|
-
(nextResult) => nextResult
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
return {
|
|
660
|
-
then: (_onFulfilled, onRejected) => {
|
|
661
|
-
if (typeof onRejected === "function") {
|
|
662
|
-
try {
|
|
663
|
-
return resolvedPromiseLike$1(onRejected(reason));
|
|
664
|
-
} catch (e) {
|
|
665
|
-
return rejectedPromiseLike$1(e);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return rejectedPromiseLike$1(reason);
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
function isPromiseLike$1(x) {
|
|
673
|
-
return typeof x?.then === "function";
|
|
674
|
-
}
|
|
675
|
-
function deepEquals(x, y) {
|
|
676
|
-
if (x === void 0) {
|
|
677
|
-
return y === void 0;
|
|
678
|
-
} else if (x === null) {
|
|
679
|
-
return y === null;
|
|
680
|
-
} else if (y === null) {
|
|
681
|
-
return x === null;
|
|
682
|
-
} else if (isArray$3(x)) {
|
|
683
|
-
if (!isArray$3(y) || x.length !== y.length) {
|
|
684
|
-
return false;
|
|
685
|
-
}
|
|
686
|
-
for (let i = 0; i < x.length; ++i) {
|
|
687
|
-
if (!deepEquals(x[i], y[i])) {
|
|
688
|
-
return false;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
return true;
|
|
692
|
-
} else if (typeof x === "object") {
|
|
693
|
-
if (typeof y !== "object") {
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
const xkeys = Object.keys(x);
|
|
697
|
-
const ykeys = Object.keys(y);
|
|
698
|
-
if (xkeys.length !== ykeys.length) {
|
|
699
|
-
return false;
|
|
700
|
-
}
|
|
701
|
-
for (let i = 0; i < xkeys.length; ++i) {
|
|
702
|
-
const key = xkeys[i];
|
|
703
|
-
if (!deepEquals(
|
|
704
|
-
x[key],
|
|
705
|
-
y[key]
|
|
706
|
-
)) {
|
|
707
|
-
return false;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
return x === y;
|
|
713
|
-
}
|
|
714
|
-
function setOverlaps(setA, setB) {
|
|
715
|
-
if (setA.size > setB.size) {
|
|
716
|
-
for (const key of setB.keys()) {
|
|
717
|
-
if (setA.has(key)) {
|
|
718
|
-
return true;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
} else {
|
|
722
|
-
for (const key of setA) {
|
|
723
|
-
if (setB.has(key)) {
|
|
724
|
-
return true;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return false;
|
|
729
|
-
}
|
|
730
|
-
class CacheControlRequestRunner {
|
|
731
|
-
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
732
|
-
this.readFromCacheInternal = readFromCache;
|
|
733
|
-
this.requestFromNetworkInternal = requestFromNetwork;
|
|
734
|
-
this.writeToCacheInternal = writeToCache;
|
|
735
|
-
}
|
|
736
|
-
readFromCache(cache) {
|
|
737
|
-
const resultPromise = this.readFromCacheInternal(cache);
|
|
738
|
-
return resultPromise.then((result) => {
|
|
739
|
-
if (result.isErr()) {
|
|
740
|
-
return err(result.error.failure);
|
|
741
|
-
}
|
|
742
|
-
this.returnData = result;
|
|
743
|
-
return ok$1(void 0);
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
requestFromNetwork() {
|
|
747
|
-
const that = this;
|
|
748
|
-
return (async function* () {
|
|
749
|
-
const result = await that.requestFromNetworkInternal();
|
|
750
|
-
if (result.isErr()) {
|
|
751
|
-
that.networkError = result;
|
|
752
|
-
} else {
|
|
753
|
-
that.networkData = result;
|
|
754
|
-
}
|
|
755
|
-
yield result;
|
|
756
|
-
})();
|
|
757
|
-
}
|
|
758
|
-
writeToCache(cache, networkResult) {
|
|
759
|
-
return this.writeToCacheInternal(cache, networkResult);
|
|
821
|
+
writeToCache(cache, networkResult) {
|
|
822
|
+
return this.writeToCacheInternal(cache, networkResult);
|
|
760
823
|
}
|
|
761
824
|
}
|
|
762
825
|
class CacheControlCommand extends BaseCommand {
|
|
@@ -907,7 +970,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
907
970
|
});
|
|
908
971
|
}
|
|
909
972
|
}
|
|
910
|
-
return resolvedPromiseLike
|
|
973
|
+
return resolvedPromiseLike(void 0);
|
|
911
974
|
}
|
|
912
975
|
get operationType() {
|
|
913
976
|
return "query";
|
|
@@ -1009,7 +1072,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1009
1072
|
if (result.isErr()) {
|
|
1010
1073
|
return err(result.error.failure);
|
|
1011
1074
|
}
|
|
1012
|
-
return ok
|
|
1075
|
+
return ok(void 0);
|
|
1013
1076
|
});
|
|
1014
1077
|
}
|
|
1015
1078
|
/**
|
|
@@ -1028,7 +1091,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1028
1091
|
return this.writeToCache(recordableCache, networkResult).then((result) => {
|
|
1029
1092
|
this.instantiationTime = Date.now() / 1e3;
|
|
1030
1093
|
this.keysUpdated = recordableCache.keysUpdated;
|
|
1031
|
-
return ok
|
|
1094
|
+
return ok(result);
|
|
1032
1095
|
});
|
|
1033
1096
|
}
|
|
1034
1097
|
/**
|
|
@@ -1055,7 +1118,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1055
1118
|
const data = readResult.value;
|
|
1056
1119
|
this.keysUsed = recordableCache.keysRead;
|
|
1057
1120
|
return buildSubscribableResult(
|
|
1058
|
-
ok
|
|
1121
|
+
ok(data),
|
|
1059
1122
|
this.buildSubscribe(),
|
|
1060
1123
|
() => this.refresh()
|
|
1061
1124
|
);
|
|
@@ -1108,7 +1171,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1108
1171
|
}
|
|
1109
1172
|
if (this.lastResult === void 0 || this.lastResult.type === "error" || !this.equals(this.lastResult.data, result.value.data)) {
|
|
1110
1173
|
this.lastResult = { type: "data", data: result.value.data };
|
|
1111
|
-
this.invokeConsumerCallbacks(ok
|
|
1174
|
+
this.invokeConsumerCallbacks(ok(result.value.data));
|
|
1112
1175
|
}
|
|
1113
1176
|
return result;
|
|
1114
1177
|
});
|
|
@@ -1148,19 +1211,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
1148
1211
|
};
|
|
1149
1212
|
}
|
|
1150
1213
|
|
|
1151
|
-
function applyOperationRequestOptions$2(init, operationType, requestOptions) {
|
|
1152
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1153
|
-
return init;
|
|
1154
|
-
}
|
|
1155
|
-
return {
|
|
1156
|
-
...init,
|
|
1157
|
-
onestore: {
|
|
1158
|
-
...requestOptions,
|
|
1159
|
-
...init?.onestore,
|
|
1160
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
1214
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
1165
1215
|
constructor(services) {
|
|
1166
1216
|
super(services);
|
|
@@ -1190,7 +1240,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1190
1240
|
input,
|
|
1191
1241
|
init
|
|
1192
1242
|
]) {
|
|
1193
|
-
return [input, applyOperationRequestOptions
|
|
1243
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1194
1244
|
}
|
|
1195
1245
|
shouldUseAuraNetwork() {
|
|
1196
1246
|
return this.services.auraNetwork !== void 0 && (this.networkPreference === "aura" || !this.services.fetch);
|
|
@@ -1214,10 +1264,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1214
1264
|
try {
|
|
1215
1265
|
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1216
1266
|
} catch (reason) {
|
|
1217
|
-
return resolvedPromiseLike
|
|
1267
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1218
1268
|
}
|
|
1219
1269
|
}
|
|
1220
|
-
return resolvedPromiseLike
|
|
1270
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
1221
1271
|
}
|
|
1222
1272
|
coerceAuraErrors(auraErrors) {
|
|
1223
1273
|
return toError(auraErrors[0]);
|
|
@@ -1226,10 +1276,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1226
1276
|
return toError(errorResponse.statusText);
|
|
1227
1277
|
}
|
|
1228
1278
|
processAuraReturnValue(auraReturnValue) {
|
|
1229
|
-
return ok
|
|
1279
|
+
return ok(auraReturnValue);
|
|
1230
1280
|
}
|
|
1231
1281
|
processFetchReturnValue(json) {
|
|
1232
|
-
return ok
|
|
1282
|
+
return ok(json);
|
|
1233
1283
|
}
|
|
1234
1284
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
1235
1285
|
return responsePromise.then((response) => {
|
|
@@ -1241,16 +1291,16 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1241
1291
|
}
|
|
1242
1292
|
}).catch((error) => {
|
|
1243
1293
|
if (!error) {
|
|
1244
|
-
return err
|
|
1294
|
+
return err(toError("Failed to get error from response"));
|
|
1245
1295
|
}
|
|
1246
1296
|
if (!error.getError) {
|
|
1247
|
-
return err
|
|
1297
|
+
return err(toError(error));
|
|
1248
1298
|
}
|
|
1249
1299
|
const actionErrors = error.getError();
|
|
1250
1300
|
if (actionErrors.length > 0) {
|
|
1251
|
-
return err
|
|
1301
|
+
return err(coerceError(actionErrors));
|
|
1252
1302
|
}
|
|
1253
|
-
return err
|
|
1303
|
+
return err(toError("Error fetching component"));
|
|
1254
1304
|
});
|
|
1255
1305
|
}
|
|
1256
1306
|
convertFetchResponseToData(response) {
|
|
@@ -1261,7 +1311,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1261
1311
|
(json) => {
|
|
1262
1312
|
return this.processFetchReturnValue(json);
|
|
1263
1313
|
},
|
|
1264
|
-
(reason) => err
|
|
1314
|
+
(reason) => err(toError(reason))
|
|
1265
1315
|
).finally(() => {
|
|
1266
1316
|
try {
|
|
1267
1317
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1270,7 +1320,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1270
1320
|
});
|
|
1271
1321
|
} else {
|
|
1272
1322
|
return this.coerceError(response2).then((coercedError) => {
|
|
1273
|
-
return err
|
|
1323
|
+
return err(coercedError);
|
|
1274
1324
|
}).finally(() => {
|
|
1275
1325
|
try {
|
|
1276
1326
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1279,10 +1329,11 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1279
1329
|
});
|
|
1280
1330
|
}
|
|
1281
1331
|
},
|
|
1282
|
-
(reason) => err
|
|
1332
|
+
(reason) => err(toError(reason))
|
|
1283
1333
|
);
|
|
1284
1334
|
}
|
|
1285
1335
|
}
|
|
1336
|
+
|
|
1286
1337
|
class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
1287
1338
|
constructor(services) {
|
|
1288
1339
|
super(services);
|
|
@@ -1291,11 +1342,11 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1291
1342
|
readFromCache(cache) {
|
|
1292
1343
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1293
1344
|
if (data.isErr()) {
|
|
1294
|
-
return resolvedPromiseLike
|
|
1295
|
-
err
|
|
1345
|
+
return resolvedPromiseLike(
|
|
1346
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1296
1347
|
);
|
|
1297
1348
|
}
|
|
1298
|
-
return resolvedPromiseLike
|
|
1349
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1299
1350
|
}
|
|
1300
1351
|
writeToCache(cache, networkResult) {
|
|
1301
1352
|
if (networkResult.isOk()) {
|
|
@@ -1304,7 +1355,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1304
1355
|
this.buildWriteInput(networkResult.value)
|
|
1305
1356
|
);
|
|
1306
1357
|
}
|
|
1307
|
-
return resolvedPromiseLike
|
|
1358
|
+
return resolvedPromiseLike(void 0);
|
|
1308
1359
|
}
|
|
1309
1360
|
}
|
|
1310
1361
|
function buildServiceDescriptor$o() {
|
|
@@ -1315,19 +1366,6 @@ function buildServiceDescriptor$o() {
|
|
|
1315
1366
|
};
|
|
1316
1367
|
}
|
|
1317
1368
|
|
|
1318
|
-
function applyOperationRequestOptions$1(init, operationType, requestOptions) {
|
|
1319
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1320
|
-
return init;
|
|
1321
|
-
}
|
|
1322
|
-
return {
|
|
1323
|
-
...init,
|
|
1324
|
-
onestore: {
|
|
1325
|
-
...requestOptions,
|
|
1326
|
-
...init?.onestore,
|
|
1327
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
1369
|
class HttpCacheControlCommand extends CacheControlCommand {
|
|
1332
1370
|
constructor(services) {
|
|
1333
1371
|
super(services);
|
|
@@ -1349,7 +1387,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1349
1387
|
input,
|
|
1350
1388
|
init
|
|
1351
1389
|
]) {
|
|
1352
|
-
return [input, applyOperationRequestOptions
|
|
1390
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1353
1391
|
}
|
|
1354
1392
|
fetch() {
|
|
1355
1393
|
try {
|
|
@@ -1357,7 +1395,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1357
1395
|
this.services.fetch(...this.withRequestOptions(this.fetchParams))
|
|
1358
1396
|
);
|
|
1359
1397
|
} catch (reason) {
|
|
1360
|
-
return resolvedPromiseLike
|
|
1398
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1361
1399
|
}
|
|
1362
1400
|
}
|
|
1363
1401
|
isSemanticNullResponse(response) {
|
|
@@ -1373,7 +1411,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1373
1411
|
return toError(errorResponse.statusText);
|
|
1374
1412
|
}
|
|
1375
1413
|
processFetchReturnValue(json) {
|
|
1376
|
-
return ok
|
|
1414
|
+
return ok(json);
|
|
1377
1415
|
}
|
|
1378
1416
|
convertFetchResponseToData(response) {
|
|
1379
1417
|
return response.then(
|
|
@@ -1381,10 +1419,10 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1381
1419
|
if (response2.ok) {
|
|
1382
1420
|
let resultPromise;
|
|
1383
1421
|
if (this.isSemanticNullResponse(response2)) {
|
|
1384
|
-
resultPromise = Promise.resolve(ok
|
|
1422
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1385
1423
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
1386
1424
|
resultPromise = Promise.resolve(
|
|
1387
|
-
err
|
|
1425
|
+
err(
|
|
1388
1426
|
toError(
|
|
1389
1427
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1390
1428
|
)
|
|
@@ -1395,7 +1433,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1395
1433
|
(json) => {
|
|
1396
1434
|
return this.processFetchReturnValue(json);
|
|
1397
1435
|
},
|
|
1398
|
-
(reason) => err
|
|
1436
|
+
(reason) => err(toError(reason))
|
|
1399
1437
|
);
|
|
1400
1438
|
}
|
|
1401
1439
|
return resultPromise.finally(() => {
|
|
@@ -1406,7 +1444,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1406
1444
|
});
|
|
1407
1445
|
} else {
|
|
1408
1446
|
return this.coerceError(response2).then((coercedError) => {
|
|
1409
|
-
return err
|
|
1447
|
+
return err(coercedError);
|
|
1410
1448
|
}).finally(() => {
|
|
1411
1449
|
try {
|
|
1412
1450
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1415,10 +1453,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1415
1453
|
});
|
|
1416
1454
|
}
|
|
1417
1455
|
},
|
|
1418
|
-
(reason) => err
|
|
1456
|
+
(reason) => err(toError(reason))
|
|
1419
1457
|
);
|
|
1420
1458
|
}
|
|
1421
1459
|
}
|
|
1460
|
+
|
|
1422
1461
|
class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
1423
1462
|
constructor(services) {
|
|
1424
1463
|
super(services);
|
|
@@ -1427,11 +1466,11 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1427
1466
|
readFromCache(cache) {
|
|
1428
1467
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1429
1468
|
if (data.isErr()) {
|
|
1430
|
-
return resolvedPromiseLike
|
|
1431
|
-
err
|
|
1469
|
+
return resolvedPromiseLike(
|
|
1470
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1432
1471
|
);
|
|
1433
1472
|
}
|
|
1434
|
-
return resolvedPromiseLike
|
|
1473
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1435
1474
|
}
|
|
1436
1475
|
writeToCache(cache, networkResult) {
|
|
1437
1476
|
if (networkResult.isOk()) {
|
|
@@ -1440,7 +1479,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1440
1479
|
this.buildWriteInput(networkResult.value)
|
|
1441
1480
|
);
|
|
1442
1481
|
}
|
|
1443
|
-
return resolvedPromiseLike
|
|
1482
|
+
return resolvedPromiseLike(void 0);
|
|
1444
1483
|
}
|
|
1445
1484
|
}
|
|
1446
1485
|
function buildServiceDescriptor$n() {
|
|
@@ -1451,64 +1490,6 @@ function buildServiceDescriptor$n() {
|
|
|
1451
1490
|
};
|
|
1452
1491
|
}
|
|
1453
1492
|
|
|
1454
|
-
class NetworkCommand extends BaseCommand {
|
|
1455
|
-
constructor(services) {
|
|
1456
|
-
super();
|
|
1457
|
-
this.services = services;
|
|
1458
|
-
this.subscriptions = [];
|
|
1459
|
-
this.exposeSubscribeAndRefresh = false;
|
|
1460
|
-
}
|
|
1461
|
-
execute() {
|
|
1462
|
-
const result = this.fetch();
|
|
1463
|
-
if (this.exposeSubscribeAndRefresh) {
|
|
1464
|
-
return this.fetchSubscribableResult(result);
|
|
1465
|
-
}
|
|
1466
|
-
return result;
|
|
1467
|
-
}
|
|
1468
|
-
fetchSubscribableResult(res) {
|
|
1469
|
-
return res.then((networkResult) => {
|
|
1470
|
-
return buildSubscribableResult$1(
|
|
1471
|
-
networkResult,
|
|
1472
|
-
(cb) => {
|
|
1473
|
-
this.subscriptions.push(cb);
|
|
1474
|
-
return () => {
|
|
1475
|
-
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
1476
|
-
};
|
|
1477
|
-
},
|
|
1478
|
-
() => this.refresh()
|
|
1479
|
-
);
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
refresh() {
|
|
1483
|
-
return this.execute().then((newResult) => {
|
|
1484
|
-
if (isSubscribableResult(newResult)) {
|
|
1485
|
-
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
1486
|
-
this.subscriptions.forEach((cb) => {
|
|
1487
|
-
try {
|
|
1488
|
-
cb(value);
|
|
1489
|
-
} catch {
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
return ok$2(void 0);
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
async afterRequestHooks(_options) {
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
1500
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1501
|
-
return init;
|
|
1502
|
-
}
|
|
1503
|
-
return {
|
|
1504
|
-
...init,
|
|
1505
|
-
onestore: {
|
|
1506
|
-
...requestOptions,
|
|
1507
|
-
...init?.onestore,
|
|
1508
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
}
|
|
1512
1493
|
function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
1513
1494
|
try {
|
|
1514
1495
|
const {
|
|
@@ -1523,7 +1504,7 @@ function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
|
1523
1504
|
const fetchCall = initWithSeed === void 0 ? services.fetch(input) : services.fetch(input, initWithSeed);
|
|
1524
1505
|
return convertFetchResponseToData(fetchCall, hooks);
|
|
1525
1506
|
} catch (reason) {
|
|
1526
|
-
return resolvedPromiseLike
|
|
1507
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1527
1508
|
}
|
|
1528
1509
|
}
|
|
1529
1510
|
function convertFetchResponseToData(response, hooks) {
|
|
@@ -1532,10 +1513,10 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1532
1513
|
if (response2.ok) {
|
|
1533
1514
|
let resultPromise;
|
|
1534
1515
|
if (hooks.isSemanticNullResponse(response2)) {
|
|
1535
|
-
resultPromise = Promise.resolve(ok
|
|
1516
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1536
1517
|
} else if (hooks.isProtocolNoBodyStatus(response2.status) && !hooks.isSemanticNullResponse(response2)) {
|
|
1537
1518
|
resultPromise = Promise.resolve(
|
|
1538
|
-
err
|
|
1519
|
+
err(
|
|
1539
1520
|
toError(
|
|
1540
1521
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1541
1522
|
)
|
|
@@ -1543,8 +1524,8 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1543
1524
|
);
|
|
1544
1525
|
} else {
|
|
1545
1526
|
resultPromise = response2.json().then(
|
|
1546
|
-
(json) => ok
|
|
1547
|
-
(reason) => err
|
|
1527
|
+
(json) => ok(json),
|
|
1528
|
+
(reason) => err(toError(reason))
|
|
1548
1529
|
);
|
|
1549
1530
|
}
|
|
1550
1531
|
return resultPromise.finally(() => {
|
|
@@ -1555,7 +1536,7 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1555
1536
|
});
|
|
1556
1537
|
} else {
|
|
1557
1538
|
return hooks.coerceError(response2).then((coercedError) => {
|
|
1558
|
-
return err
|
|
1539
|
+
return err(coercedError);
|
|
1559
1540
|
}).finally(() => {
|
|
1560
1541
|
try {
|
|
1561
1542
|
hooks.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1564,12 +1545,12 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1564
1545
|
});
|
|
1565
1546
|
}
|
|
1566
1547
|
},
|
|
1567
|
-
(reason) => err
|
|
1548
|
+
(reason) => err(toError(reason))
|
|
1568
1549
|
);
|
|
1569
1550
|
}
|
|
1570
1551
|
function completeRefresh(result, getSubscriptions, options = {}) {
|
|
1571
1552
|
const { previousResult } = options;
|
|
1572
|
-
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals
|
|
1553
|
+
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals(previousResult.value, result.value)) {
|
|
1573
1554
|
const subscriptions = getSubscriptions();
|
|
1574
1555
|
const callbacks = options.skipRemovedSubscriptions ? [...subscriptions] : subscriptions;
|
|
1575
1556
|
callbacks.forEach((callback) => {
|
|
@@ -1580,7 +1561,7 @@ function completeRefresh(result, getSubscriptions, options = {}) {
|
|
|
1580
1561
|
}
|
|
1581
1562
|
});
|
|
1582
1563
|
}
|
|
1583
|
-
return options.reportFailure && result.isErr() ? result : ok
|
|
1564
|
+
return options.reportFailure && result.isErr() ? result : ok(void 0);
|
|
1584
1565
|
}
|
|
1585
1566
|
function isAbortableCommand(command) {
|
|
1586
1567
|
return !!command && typeof command === "object" && "isAbortableCommand" in command && command.isAbortableCommand === true;
|
|
@@ -1690,8 +1671,8 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1690
1671
|
}
|
|
1691
1672
|
refresh() {
|
|
1692
1673
|
return this.execute().then((newResult) => {
|
|
1693
|
-
if (!isSubscribableResult(newResult)) return ok
|
|
1694
|
-
const result = newResult.isOk() ? ok
|
|
1674
|
+
if (!isSubscribableResult(newResult)) return ok(void 0);
|
|
1675
|
+
const result = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
1695
1676
|
return completeRefresh(result, () => this.subscriptions);
|
|
1696
1677
|
});
|
|
1697
1678
|
}
|
|
@@ -1726,21 +1707,21 @@ class StreamingCommand extends BaseCommand {
|
|
|
1726
1707
|
try {
|
|
1727
1708
|
return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
|
|
1728
1709
|
} catch (reason) {
|
|
1729
|
-
return resolvedPromiseLike
|
|
1710
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1730
1711
|
}
|
|
1731
1712
|
}
|
|
1732
1713
|
convertFetchStreamResponseToData(response) {
|
|
1733
1714
|
return response.then(
|
|
1734
1715
|
(response2) => {
|
|
1735
1716
|
if (response2.ok && response2.body) {
|
|
1736
|
-
return ok
|
|
1717
|
+
return ok(this.decodeByteStream(response2.body));
|
|
1737
1718
|
} else {
|
|
1738
|
-
return err
|
|
1719
|
+
return err(
|
|
1739
1720
|
toError(response2.ok ? "Response body not present" : response2.statusText)
|
|
1740
1721
|
);
|
|
1741
1722
|
}
|
|
1742
1723
|
},
|
|
1743
|
-
(reason) => err
|
|
1724
|
+
(reason) => err(toError(reason))
|
|
1744
1725
|
);
|
|
1745
1726
|
}
|
|
1746
1727
|
}
|
|
@@ -2155,12 +2136,7 @@ function buildServiceDescriptor$i(logger) {
|
|
|
2155
2136
|
};
|
|
2156
2137
|
}
|
|
2157
2138
|
|
|
2158
|
-
|
|
2159
|
-
function deepCopy$1(x) {
|
|
2160
|
-
const stringified = stringify$2(x);
|
|
2161
|
-
return stringified ? parse$1(stringified) : void 0;
|
|
2162
|
-
}
|
|
2163
|
-
let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
2139
|
+
class DefaultRecordableCache {
|
|
2164
2140
|
constructor(baseCache) {
|
|
2165
2141
|
this.baseCache = baseCache;
|
|
2166
2142
|
this.keysRead = /* @__PURE__ */ new Set();
|
|
@@ -2179,7 +2155,7 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2179
2155
|
this.missingKeysRead.add(key);
|
|
2180
2156
|
}
|
|
2181
2157
|
if (options?.copy) {
|
|
2182
|
-
return deepCopy
|
|
2158
|
+
return deepCopy(value);
|
|
2183
2159
|
}
|
|
2184
2160
|
return value;
|
|
2185
2161
|
}
|
|
@@ -2205,13 +2181,13 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2205
2181
|
return new DefaultRecordableCache(this);
|
|
2206
2182
|
}
|
|
2207
2183
|
filter(predicate) {
|
|
2208
|
-
return new DefaultFilteredCache
|
|
2184
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2209
2185
|
}
|
|
2210
2186
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2211
|
-
return new FixedTimeWritableCache
|
|
2187
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2212
2188
|
}
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2189
|
+
}
|
|
2190
|
+
class DefaultFilteredCache {
|
|
2215
2191
|
constructor(baseCache, predicate) {
|
|
2216
2192
|
this.baseCache = baseCache;
|
|
2217
2193
|
this.predicate = predicate;
|
|
@@ -2223,7 +2199,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2223
2199
|
const result = this.baseCache.get(key);
|
|
2224
2200
|
if (result && this.predicate(key, result)) {
|
|
2225
2201
|
if (options?.copy) {
|
|
2226
|
-
return deepCopy
|
|
2202
|
+
return deepCopy(result);
|
|
2227
2203
|
}
|
|
2228
2204
|
return result;
|
|
2229
2205
|
}
|
|
@@ -2245,7 +2221,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2245
2221
|
return this.getFilteredEntries();
|
|
2246
2222
|
}
|
|
2247
2223
|
record() {
|
|
2248
|
-
return new DefaultRecordableCache
|
|
2224
|
+
return new DefaultRecordableCache(this);
|
|
2249
2225
|
}
|
|
2250
2226
|
filter(predicate) {
|
|
2251
2227
|
return new DefaultFilteredCache(this, predicate);
|
|
@@ -2265,10 +2241,10 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2265
2241
|
return filteredKeySet;
|
|
2266
2242
|
}
|
|
2267
2243
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2268
|
-
return new FixedTimeWritableCache
|
|
2244
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2269
2245
|
}
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2246
|
+
}
|
|
2247
|
+
class FixedTimeWritableCache {
|
|
2272
2248
|
constructor(baseCache, generatedTime) {
|
|
2273
2249
|
this.baseCache = baseCache;
|
|
2274
2250
|
this.generatedTime = generatedTime;
|
|
@@ -2304,22 +2280,22 @@ let FixedTimeWritableCache$1 = class FixedTimeWritableCache {
|
|
|
2304
2280
|
return this.baseCache.entries();
|
|
2305
2281
|
}
|
|
2306
2282
|
record() {
|
|
2307
|
-
return new DefaultRecordableCache
|
|
2283
|
+
return new DefaultRecordableCache(this);
|
|
2308
2284
|
}
|
|
2309
2285
|
filter(predicate) {
|
|
2310
|
-
return new DefaultFilteredCache
|
|
2286
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2311
2287
|
}
|
|
2312
2288
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2313
2289
|
return new FixedTimeWritableCache(this, generatedTime);
|
|
2314
2290
|
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2291
|
+
}
|
|
2292
|
+
class DefaultCache {
|
|
2317
2293
|
constructor() {
|
|
2318
2294
|
this.data = {};
|
|
2319
2295
|
}
|
|
2320
2296
|
get(key, options) {
|
|
2321
2297
|
if (options?.copy) {
|
|
2322
|
-
return deepCopy
|
|
2298
|
+
return deepCopy(this.data[key]);
|
|
2323
2299
|
}
|
|
2324
2300
|
return this.data[key];
|
|
2325
2301
|
}
|
|
@@ -2381,20 +2357,20 @@ let DefaultCache$1 = class DefaultCache {
|
|
|
2381
2357
|
return Object.entries(this.data);
|
|
2382
2358
|
}
|
|
2383
2359
|
record() {
|
|
2384
|
-
return new DefaultRecordableCache
|
|
2360
|
+
return new DefaultRecordableCache(this);
|
|
2385
2361
|
}
|
|
2386
2362
|
filter(predicate) {
|
|
2387
|
-
return new DefaultFilteredCache
|
|
2363
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2388
2364
|
}
|
|
2389
2365
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2390
|
-
return new FixedTimeWritableCache
|
|
2366
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2391
2367
|
}
|
|
2392
|
-
}
|
|
2368
|
+
}
|
|
2393
2369
|
function buildServiceDescriptor$h() {
|
|
2394
2370
|
return {
|
|
2395
2371
|
type: "cache",
|
|
2396
2372
|
version: "1.0",
|
|
2397
|
-
service: new DefaultCache
|
|
2373
|
+
service: new DefaultCache()
|
|
2398
2374
|
};
|
|
2399
2375
|
}
|
|
2400
2376
|
|
|
@@ -2422,7 +2398,7 @@ class NoCacheCacheControlStrategy extends CacheControlStrategy {
|
|
|
2422
2398
|
const tempCache = this.filteredCache;
|
|
2423
2399
|
return new Promise(async (resolve, reject) => {
|
|
2424
2400
|
try {
|
|
2425
|
-
let readResult = ok
|
|
2401
|
+
let readResult = ok(void 0);
|
|
2426
2402
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2427
2403
|
if (rfnResult) {
|
|
2428
2404
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2460,13 +2436,13 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2460
2436
|
startTime,
|
|
2461
2437
|
options?.instrumentationAttributes
|
|
2462
2438
|
);
|
|
2463
|
-
return ok
|
|
2439
|
+
return ok(void 0);
|
|
2464
2440
|
}
|
|
2465
2441
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2466
2442
|
const tempCache = this.filteredCache;
|
|
2467
2443
|
return new Promise(async (resolve, reject) => {
|
|
2468
2444
|
try {
|
|
2469
|
-
let readResult = ok
|
|
2445
|
+
let readResult = ok(void 0);
|
|
2470
2446
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2471
2447
|
if (rfnResult) {
|
|
2472
2448
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2474,7 +2450,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2474
2450
|
writeToL1: (l1) => this.requestRunner.writeToCache(l1, rfnResult)
|
|
2475
2451
|
});
|
|
2476
2452
|
if (result.isErr()) {
|
|
2477
|
-
return resolve(err
|
|
2453
|
+
return resolve(err(result.error));
|
|
2478
2454
|
}
|
|
2479
2455
|
}
|
|
2480
2456
|
readResult = await this.services.cacheInclusionPolicy.read({
|
|
@@ -2482,7 +2458,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2482
2458
|
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2483
2459
|
});
|
|
2484
2460
|
if (readResult.isOk()) {
|
|
2485
|
-
resolve(ok
|
|
2461
|
+
resolve(ok(void 0));
|
|
2486
2462
|
}
|
|
2487
2463
|
}
|
|
2488
2464
|
return resolve(readResult);
|
|
@@ -2534,7 +2510,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2534
2510
|
startTime,
|
|
2535
2511
|
options?.instrumentationAttributes
|
|
2536
2512
|
);
|
|
2537
|
-
return ok
|
|
2513
|
+
return ok(void 0);
|
|
2538
2514
|
}
|
|
2539
2515
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2540
2516
|
const error = new UserVisibleError(
|
|
@@ -2542,7 +2518,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2542
2518
|
error: "Cache miss for only-if-cached request"
|
|
2543
2519
|
})
|
|
2544
2520
|
);
|
|
2545
|
-
return err
|
|
2521
|
+
return err(error);
|
|
2546
2522
|
});
|
|
2547
2523
|
}
|
|
2548
2524
|
get expiredChecks() {
|
|
@@ -2647,14 +2623,14 @@ class DefaultPubSubService {
|
|
|
2647
2623
|
return;
|
|
2648
2624
|
}
|
|
2649
2625
|
const returnVal = subscription.callback.call(subscription, event);
|
|
2650
|
-
if (isPromiseLike
|
|
2626
|
+
if (isPromiseLike(returnVal)) {
|
|
2651
2627
|
promises.push(returnVal);
|
|
2652
2628
|
}
|
|
2653
2629
|
});
|
|
2654
2630
|
if (promises.length > 0) {
|
|
2655
2631
|
return Promise.all(promises).then(() => void 0);
|
|
2656
2632
|
}
|
|
2657
|
-
return resolvedPromiseLike
|
|
2633
|
+
return resolvedPromiseLike(void 0);
|
|
2658
2634
|
}
|
|
2659
2635
|
getSubscriptions(event) {
|
|
2660
2636
|
const eventTypeSubscriptions = this.subscriptions.get(event.type);
|
|
@@ -2783,7 +2759,7 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2783
2759
|
},
|
|
2784
2760
|
};
|
|
2785
2761
|
}
|
|
2786
|
-
// version: 1.
|
|
2762
|
+
// version: 1.471.0-2898c91740
|
|
2787
2763
|
|
|
2788
2764
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2789
2765
|
constructor(config, documentRootType, services) {
|
|
@@ -2822,15 +2798,15 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2822
2798
|
}
|
|
2823
2799
|
processAuraReturnValue(auraReturnValue) {
|
|
2824
2800
|
if (this.responseHasErrors(auraReturnValue)) {
|
|
2825
|
-
return err
|
|
2801
|
+
return err(new UserVisibleError(auraReturnValue));
|
|
2826
2802
|
}
|
|
2827
|
-
return ok
|
|
2803
|
+
return ok(auraReturnValue);
|
|
2828
2804
|
}
|
|
2829
2805
|
processFetchReturnValue(json) {
|
|
2830
2806
|
if (this.responseHasErrors(json)) {
|
|
2831
|
-
return err
|
|
2807
|
+
return err(new UserVisibleError(json));
|
|
2832
2808
|
}
|
|
2833
|
-
return ok
|
|
2809
|
+
return ok(json);
|
|
2834
2810
|
}
|
|
2835
2811
|
/**
|
|
2836
2812
|
* Optional body wrapper name for aura requests.
|
|
@@ -2891,14 +2867,14 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2891
2867
|
),
|
|
2892
2868
|
(errs) => this.coerceAuraErrors(errs)
|
|
2893
2869
|
).then((result) => {
|
|
2894
|
-
return buildSubscribableResult
|
|
2870
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
2895
2871
|
});
|
|
2896
2872
|
} else if (this.shouldUseFetch()) {
|
|
2897
2873
|
const params = this.withRequestOptions(this.originalFetchParams);
|
|
2898
2874
|
try {
|
|
2899
2875
|
return this.convertFetchResponseToData(this.services.fetch(...params)).then(
|
|
2900
2876
|
(result) => {
|
|
2901
|
-
return buildSubscribableResult
|
|
2877
|
+
return buildSubscribableResult(
|
|
2902
2878
|
result,
|
|
2903
2879
|
this.buildSubscribe(),
|
|
2904
2880
|
() => this.refresh()
|
|
@@ -2906,18 +2882,18 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2906
2882
|
}
|
|
2907
2883
|
);
|
|
2908
2884
|
} catch (reason) {
|
|
2909
|
-
return resolvedPromiseLike
|
|
2910
|
-
buildSubscribableResult
|
|
2911
|
-
err
|
|
2885
|
+
return resolvedPromiseLike(
|
|
2886
|
+
buildSubscribableResult(
|
|
2887
|
+
err(toError(reason)),
|
|
2912
2888
|
this.buildSubscribe(),
|
|
2913
2889
|
() => this.refresh()
|
|
2914
2890
|
)
|
|
2915
2891
|
);
|
|
2916
2892
|
}
|
|
2917
2893
|
}
|
|
2918
|
-
return resolvedPromiseLike
|
|
2919
|
-
buildSubscribableResult
|
|
2920
|
-
err
|
|
2894
|
+
return resolvedPromiseLike(
|
|
2895
|
+
buildSubscribableResult(
|
|
2896
|
+
err(toError("Aura/Fetch network services not found")),
|
|
2921
2897
|
this.buildSubscribe(),
|
|
2922
2898
|
() => this.refresh()
|
|
2923
2899
|
)
|
|
@@ -3043,15 +3019,15 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3043
3019
|
}
|
|
3044
3020
|
processFetchReturnValue(json) {
|
|
3045
3021
|
if (json.errors && json.errors.length > 0) {
|
|
3046
|
-
return err
|
|
3022
|
+
return err(new UserVisibleError(json));
|
|
3047
3023
|
}
|
|
3048
|
-
return ok
|
|
3024
|
+
return ok(json);
|
|
3049
3025
|
}
|
|
3050
3026
|
runOriginalRequest() {
|
|
3051
3027
|
return this.convertFetchResponseToData(
|
|
3052
3028
|
this.services.fetch(...this.withRequestOptions(this.originalFetchParams))
|
|
3053
3029
|
).then((result) => {
|
|
3054
|
-
return buildSubscribableResult
|
|
3030
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
3055
3031
|
});
|
|
3056
3032
|
}
|
|
3057
3033
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -3122,7 +3098,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3122
3098
|
},
|
|
3123
3099
|
};
|
|
3124
3100
|
}
|
|
3125
|
-
// version: 1.
|
|
3101
|
+
// version: 1.471.0-2898c91740
|
|
3126
3102
|
|
|
3127
3103
|
class RetryService {
|
|
3128
3104
|
constructor(defaultRetryPolicy) {
|
|
@@ -3629,7 +3605,7 @@ class LegacyImperativeBindingsService {
|
|
|
3629
3605
|
return { invoke, subscribe };
|
|
3630
3606
|
}
|
|
3631
3607
|
}
|
|
3632
|
-
function buildServiceDescriptor$3
|
|
3608
|
+
function buildServiceDescriptor$3() {
|
|
3633
3609
|
return {
|
|
3634
3610
|
type: "legacyImperativeBindings",
|
|
3635
3611
|
version: "1.0",
|
|
@@ -3829,7 +3805,7 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
3829
3805
|
return { invoke, subscribe };
|
|
3830
3806
|
}
|
|
3831
3807
|
}
|
|
3832
|
-
function buildServiceDescriptor$1$
|
|
3808
|
+
function buildServiceDescriptor$1$1() {
|
|
3833
3809
|
return {
|
|
3834
3810
|
type: "graphQLLegacyImperativeBindings",
|
|
3835
3811
|
version: "1.0",
|
|
@@ -4048,7 +4024,7 @@ class CommandWireAdapterConstructor {
|
|
|
4048
4024
|
this.emit(updatedResult);
|
|
4049
4025
|
});
|
|
4050
4026
|
this.refresh = value.refresh;
|
|
4051
|
-
this.emit(ok
|
|
4027
|
+
this.emit(ok(value.data));
|
|
4052
4028
|
} else {
|
|
4053
4029
|
this.emit(result);
|
|
4054
4030
|
}
|
|
@@ -4122,7 +4098,7 @@ class LWCWireBindingsService {
|
|
|
4122
4098
|
};
|
|
4123
4099
|
}
|
|
4124
4100
|
}
|
|
4125
|
-
function buildServiceDescriptor$1
|
|
4101
|
+
function buildServiceDescriptor$1() {
|
|
4126
4102
|
return {
|
|
4127
4103
|
type: "lwcWireBindings",
|
|
4128
4104
|
version: "1.0",
|
|
@@ -4228,7 +4204,7 @@ class LWCGraphQLWireBindingsService {
|
|
|
4228
4204
|
};
|
|
4229
4205
|
}
|
|
4230
4206
|
}
|
|
4231
|
-
function buildServiceDescriptor$
|
|
4207
|
+
function buildServiceDescriptor$2() {
|
|
4232
4208
|
return {
|
|
4233
4209
|
type: "lwcGraphQLWireBindings",
|
|
4234
4210
|
version: "1.0",
|
|
@@ -4246,7 +4222,7 @@ function createLockerCompatibleWireConstructor(DelegateCtor) {
|
|
|
4246
4222
|
return Constructor;
|
|
4247
4223
|
}
|
|
4248
4224
|
function buildLWCWireBindingsServiceDescriptor() {
|
|
4249
|
-
const base = buildServiceDescriptor$1
|
|
4225
|
+
const base = buildServiceDescriptor$1();
|
|
4250
4226
|
const originalBind = base.service.bind.bind(base.service);
|
|
4251
4227
|
const bind = (...args) => {
|
|
4252
4228
|
const ctor = originalBind(...args);
|
|
@@ -4261,7 +4237,7 @@ function buildLWCWireBindingsServiceDescriptor() {
|
|
|
4261
4237
|
};
|
|
4262
4238
|
}
|
|
4263
4239
|
function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
4264
|
-
const base = buildServiceDescriptor$
|
|
4240
|
+
const base = buildServiceDescriptor$2();
|
|
4265
4241
|
const originalBind = base.service.bind.bind(base.service);
|
|
4266
4242
|
const bind = (...args) => {
|
|
4267
4243
|
const ctor = originalBind(...args);
|
|
@@ -4276,54 +4252,8 @@ function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
|
4276
4252
|
};
|
|
4277
4253
|
}
|
|
4278
4254
|
|
|
4279
|
-
function e(
|
|
4280
|
-
|
|
4281
|
-
}
|
|
4282
|
-
e.prototype = new Error(), e.prototype.name = "InvalidCharacterError";
|
|
4283
|
-
var r = "undefined" != typeof window && window.atob && window.atob.bind(window) || function(r2) {
|
|
4284
|
-
var t2 = String(r2).replace(/=+$/, "");
|
|
4285
|
-
if (t2.length % 4 == 1) throw new e("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
4286
|
-
for (var n2, o2, a = 0, i = 0, c = ""; o2 = t2.charAt(i++); ~o2 && (n2 = a % 4 ? 64 * n2 + o2 : o2, a++ % 4) ? c += String.fromCharCode(255 & n2 >> (-2 * a & 6)) : 0) o2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o2);
|
|
4287
|
-
return c;
|
|
4288
|
-
};
|
|
4289
|
-
function t(e2) {
|
|
4290
|
-
var t2 = e2.replace(/-/g, "+").replace(/_/g, "/");
|
|
4291
|
-
switch (t2.length % 4) {
|
|
4292
|
-
case 0:
|
|
4293
|
-
break;
|
|
4294
|
-
case 2:
|
|
4295
|
-
t2 += "==";
|
|
4296
|
-
break;
|
|
4297
|
-
case 3:
|
|
4298
|
-
t2 += "=";
|
|
4299
|
-
break;
|
|
4300
|
-
default:
|
|
4301
|
-
throw "Illegal base64url string!";
|
|
4302
|
-
}
|
|
4303
|
-
try {
|
|
4304
|
-
return (function(e3) {
|
|
4305
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
4306
|
-
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
4307
|
-
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
4308
|
-
})));
|
|
4309
|
-
})(t2);
|
|
4310
|
-
} catch (e3) {
|
|
4311
|
-
return r(t2);
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4314
|
-
function n(e2) {
|
|
4315
|
-
this.message = e2;
|
|
4316
|
-
}
|
|
4317
|
-
function o(e2, r2) {
|
|
4318
|
-
if ("string" != typeof e2) throw new n("Invalid token specified");
|
|
4319
|
-
var o2 = true === (r2 = r2 || {}).header ? 0 : 1;
|
|
4320
|
-
try {
|
|
4321
|
-
return JSON.parse(t(e2.split(".")[o2]));
|
|
4322
|
-
} catch (e3) {
|
|
4323
|
-
throw new n("Invalid token specified: " + e3.message);
|
|
4324
|
-
}
|
|
4325
|
-
}
|
|
4326
|
-
n.prototype = new Error(), n.prototype.name = "InvalidTokenError";
|
|
4255
|
+
function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
|
|
4256
|
+
|
|
4327
4257
|
class JwtToken {
|
|
4328
4258
|
/**
|
|
4329
4259
|
* Create a new JwtToken.
|
|
@@ -4567,8 +4497,8 @@ class JwtRepository {
|
|
|
4567
4497
|
this.observers.forEach((cb) => {
|
|
4568
4498
|
try {
|
|
4569
4499
|
cb.call(void 0, token);
|
|
4570
|
-
} catch (
|
|
4571
|
-
this.logger.error(
|
|
4500
|
+
} catch (e) {
|
|
4501
|
+
this.logger.error(e.message);
|
|
4572
4502
|
}
|
|
4573
4503
|
});
|
|
4574
4504
|
}
|
|
@@ -4649,163 +4579,6 @@ class JwtManager {
|
|
|
4649
4579
|
}
|
|
4650
4580
|
}
|
|
4651
4581
|
|
|
4652
|
-
function buildServiceDescriptor$2(interceptors = {
|
|
4653
|
-
request: [],
|
|
4654
|
-
retry: void 0,
|
|
4655
|
-
response: [],
|
|
4656
|
-
finally: []
|
|
4657
|
-
}, retryService) {
|
|
4658
|
-
return {
|
|
4659
|
-
type: "fetch",
|
|
4660
|
-
version: "1.0",
|
|
4661
|
-
service: function(input, init) {
|
|
4662
|
-
let contextSeed;
|
|
4663
|
-
let cleanInit = init;
|
|
4664
|
-
if (init !== void 0 && "__contextSeed" in init) {
|
|
4665
|
-
const { __contextSeed, ...initWithoutSeed } = init;
|
|
4666
|
-
contextSeed = __contextSeed;
|
|
4667
|
-
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
4668
|
-
}
|
|
4669
|
-
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
4670
|
-
const baseContext = interceptors.createContext?.();
|
|
4671
|
-
const onestore = cleanInit?.onestore;
|
|
4672
|
-
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
4673
|
-
...baseContext,
|
|
4674
|
-
...contextSeed,
|
|
4675
|
-
...onestore !== void 0 && { onestore }
|
|
4676
|
-
};
|
|
4677
|
-
const {
|
|
4678
|
-
request: requestInterceptors = [],
|
|
4679
|
-
retry: retryInterceptor = void 0,
|
|
4680
|
-
response: responseInterceptors = [],
|
|
4681
|
-
finally: finallyInterceptors = []
|
|
4682
|
-
} = interceptors;
|
|
4683
|
-
const pending = requestInterceptors.reduce(
|
|
4684
|
-
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
4685
|
-
resolvedPromiseLike$2(fetchArgs)
|
|
4686
|
-
);
|
|
4687
|
-
return Promise.resolve(pending).then((args) => {
|
|
4688
|
-
if (retryInterceptor) {
|
|
4689
|
-
return retryInterceptor(args, retryService, context);
|
|
4690
|
-
} else {
|
|
4691
|
-
if (retryService) {
|
|
4692
|
-
return retryService.applyRetry(() => fetch(...args));
|
|
4693
|
-
}
|
|
4694
|
-
return fetch(...args);
|
|
4695
|
-
}
|
|
4696
|
-
}).then((response) => {
|
|
4697
|
-
return responseInterceptors.reduce(
|
|
4698
|
-
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
4699
|
-
resolvedPromiseLike$2(response)
|
|
4700
|
-
);
|
|
4701
|
-
}).finally(() => {
|
|
4702
|
-
if (finallyInterceptors.length > 0) {
|
|
4703
|
-
return finallyInterceptors.reduce(
|
|
4704
|
-
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
4705
|
-
Promise.resolve()
|
|
4706
|
-
);
|
|
4707
|
-
}
|
|
4708
|
-
});
|
|
4709
|
-
}
|
|
4710
|
-
};
|
|
4711
|
-
}
|
|
4712
|
-
let textEncoder;
|
|
4713
|
-
function getTextEncoder() {
|
|
4714
|
-
if (!textEncoder) {
|
|
4715
|
-
if (typeof TextEncoder === "undefined") {
|
|
4716
|
-
throw new Error(
|
|
4717
|
-
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
4718
|
-
);
|
|
4719
|
-
}
|
|
4720
|
-
textEncoder = new TextEncoder();
|
|
4721
|
-
}
|
|
4722
|
-
return textEncoder;
|
|
4723
|
-
}
|
|
4724
|
-
function buildCompressionInterceptor(defaultConfig) {
|
|
4725
|
-
return async (args) => {
|
|
4726
|
-
const [resource, options = {}] = args;
|
|
4727
|
-
const config = options.onestore?.compression ?? defaultConfig;
|
|
4728
|
-
if (config === void 0) {
|
|
4729
|
-
return resolvedPromiseLike$2(args);
|
|
4730
|
-
}
|
|
4731
|
-
const threshold = config.threshold ?? 1024;
|
|
4732
|
-
if (!options.body || typeof options.body !== "string") {
|
|
4733
|
-
return resolvedPromiseLike$2(args);
|
|
4734
|
-
}
|
|
4735
|
-
if (typeof CompressionStream === "undefined") {
|
|
4736
|
-
return resolvedPromiseLike$2(args);
|
|
4737
|
-
}
|
|
4738
|
-
const headers = new Headers(options.headers);
|
|
4739
|
-
if (headers.has("Content-Encoding")) {
|
|
4740
|
-
return resolvedPromiseLike$2(args);
|
|
4741
|
-
}
|
|
4742
|
-
const encodedBody = getTextEncoder().encode(options.body);
|
|
4743
|
-
if (encodedBody.byteLength < threshold) {
|
|
4744
|
-
return resolvedPromiseLike$2(args);
|
|
4745
|
-
}
|
|
4746
|
-
try {
|
|
4747
|
-
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
4748
|
-
const compressedBody = await new Response(stream).blob();
|
|
4749
|
-
headers.set("Content-Encoding", config.algorithm);
|
|
4750
|
-
headers.delete("Content-Length");
|
|
4751
|
-
const compressedOptions = {
|
|
4752
|
-
...options,
|
|
4753
|
-
body: compressedBody,
|
|
4754
|
-
headers
|
|
4755
|
-
};
|
|
4756
|
-
return resolvedPromiseLike$2([resource, compressedOptions]);
|
|
4757
|
-
} catch {
|
|
4758
|
-
return resolvedPromiseLike$2(args);
|
|
4759
|
-
}
|
|
4760
|
-
};
|
|
4761
|
-
}
|
|
4762
|
-
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
4763
|
-
throwOnExisting = false,
|
|
4764
|
-
errorMessage = `Unexpected ${headerName} header encountered`
|
|
4765
|
-
} = {}) {
|
|
4766
|
-
let hasHeaderBeenSet = false;
|
|
4767
|
-
if (resource instanceof Request && !options?.headers) {
|
|
4768
|
-
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
4769
|
-
throw new Error(errorMessage);
|
|
4770
|
-
}
|
|
4771
|
-
resource.headers.set(headerName, headerValue);
|
|
4772
|
-
hasHeaderBeenSet = true;
|
|
4773
|
-
}
|
|
4774
|
-
if (options?.headers instanceof Headers) {
|
|
4775
|
-
if (throwOnExisting && options.headers.has(headerName)) {
|
|
4776
|
-
throw new Error(errorMessage);
|
|
4777
|
-
}
|
|
4778
|
-
options.headers.set(headerName, headerValue);
|
|
4779
|
-
} else {
|
|
4780
|
-
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
4781
|
-
throw new Error(errorMessage);
|
|
4782
|
-
}
|
|
4783
|
-
if (!hasHeaderBeenSet) {
|
|
4784
|
-
options.headers = {
|
|
4785
|
-
...options?.headers,
|
|
4786
|
-
[headerName]: headerValue
|
|
4787
|
-
};
|
|
4788
|
-
}
|
|
4789
|
-
}
|
|
4790
|
-
return [resource, options];
|
|
4791
|
-
}
|
|
4792
|
-
const UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE = "Unexpected Authorization header encountered. To specify a custom Authorization header, use a Fetch service that is not configured with JwtRequestHeaderInterceptor";
|
|
4793
|
-
function setHeaderAuthorization({ token }, fetchParams) {
|
|
4794
|
-
const authorizationValue = `Bearer ${token}`;
|
|
4795
|
-
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
4796
|
-
throwOnExisting: true,
|
|
4797
|
-
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
4798
|
-
});
|
|
4799
|
-
}
|
|
4800
|
-
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
4801
|
-
return (args) => {
|
|
4802
|
-
return resolvedPromiseLike$2(jwtManager.getJwt()).then((token) => {
|
|
4803
|
-
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
4804
|
-
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
4805
|
-
});
|
|
4806
|
-
};
|
|
4807
|
-
}
|
|
4808
|
-
|
|
4809
4582
|
var SnapshotState;
|
|
4810
4583
|
(function (SnapshotState) {
|
|
4811
4584
|
SnapshotState["Fulfilled"] = "Fulfilled";
|
|
@@ -4987,346 +4760,37 @@ const fetchNetworkAdapter = async (resourceRequest, _resourceRequestContext) =>
|
|
|
4987
4760
|
body: responseBody,
|
|
4988
4761
|
status,
|
|
4989
4762
|
statusText,
|
|
4990
|
-
ok,
|
|
4991
|
-
headers: responseHeaders,
|
|
4992
|
-
};
|
|
4993
|
-
};
|
|
4994
|
-
function generateQueryString(params) {
|
|
4995
|
-
const searchParams = new URLSearchParams();
|
|
4996
|
-
for (const key of keys$1(params)) {
|
|
4997
|
-
const value = params[key];
|
|
4998
|
-
// omit undefined and empty-array values entirely: String(undefined) === 'undefined'
|
|
4999
|
-
// and String([]) === '', both of which would otherwise serialize as a valueless
|
|
5000
|
-
// `key=` or literal `key=undefined` query param that servers can reject.
|
|
5001
|
-
if (value === undefined || (isArray$2(value) && value.length === 0)) {
|
|
5002
|
-
continue;
|
|
5003
|
-
}
|
|
5004
|
-
searchParams.append(key, String(value));
|
|
5005
|
-
}
|
|
5006
|
-
const queryString = searchParams.toString();
|
|
5007
|
-
if (queryString.length > 0) {
|
|
5008
|
-
return `?${queryString}`;
|
|
5009
|
-
}
|
|
5010
|
-
return '';
|
|
5011
|
-
}
|
|
5012
|
-
function generateHeaders(headers) {
|
|
5013
|
-
const fetchHeaders = new Headers();
|
|
5014
|
-
for (const key of keys$1(headers)) {
|
|
5015
|
-
fetchHeaders.set(key, headers[key]);
|
|
5016
|
-
}
|
|
5017
|
-
return fetchHeaders;
|
|
5018
|
-
}
|
|
5019
|
-
|
|
5020
|
-
class CacheInclusionPolicyService {
|
|
5021
|
-
}
|
|
5022
|
-
class Ok {
|
|
5023
|
-
constructor(value) {
|
|
5024
|
-
this.value = value;
|
|
5025
|
-
}
|
|
5026
|
-
isOk() {
|
|
5027
|
-
return true;
|
|
5028
|
-
}
|
|
5029
|
-
isErr() {
|
|
5030
|
-
return !this.isOk();
|
|
5031
|
-
}
|
|
5032
|
-
}
|
|
5033
|
-
const ok = (value) => new Ok(value);
|
|
5034
|
-
function setDifference(setA, setB) {
|
|
5035
|
-
const differenceSet = /* @__PURE__ */ new Set();
|
|
5036
|
-
for (const element of setA) {
|
|
5037
|
-
if (!setB.has(element)) {
|
|
5038
|
-
differenceSet.add(element);
|
|
5039
|
-
}
|
|
5040
|
-
}
|
|
5041
|
-
return differenceSet;
|
|
5042
|
-
}
|
|
5043
|
-
function addAllToSet(targetSet, sourceSet) {
|
|
5044
|
-
for (const element of sourceSet) {
|
|
5045
|
-
targetSet.add(element);
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
function resolvedPromiseLike(result) {
|
|
5049
|
-
if (isPromiseLike(result)) {
|
|
5050
|
-
return result.then(
|
|
5051
|
-
(nextResult) => nextResult
|
|
5052
|
-
);
|
|
5053
|
-
}
|
|
5054
|
-
return {
|
|
5055
|
-
then: (onFulfilled, _onRejected) => {
|
|
5056
|
-
try {
|
|
5057
|
-
return resolvedPromiseLike(onFulfilled(result));
|
|
5058
|
-
} catch (e) {
|
|
5059
|
-
if (onFulfilled === void 0) {
|
|
5060
|
-
return resolvedPromiseLike(result);
|
|
5061
|
-
}
|
|
5062
|
-
return rejectedPromiseLike(e);
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
|
-
};
|
|
5066
|
-
}
|
|
5067
|
-
function rejectedPromiseLike(reason) {
|
|
5068
|
-
if (isPromiseLike(reason)) {
|
|
5069
|
-
return reason.then(
|
|
5070
|
-
(nextResult) => nextResult
|
|
5071
|
-
);
|
|
5072
|
-
}
|
|
5073
|
-
return {
|
|
5074
|
-
then: (_onFulfilled, onRejected) => {
|
|
5075
|
-
if (typeof onRejected === "function") {
|
|
5076
|
-
try {
|
|
5077
|
-
return resolvedPromiseLike(onRejected(reason));
|
|
5078
|
-
} catch (e) {
|
|
5079
|
-
return rejectedPromiseLike(e);
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
return rejectedPromiseLike(reason);
|
|
5083
|
-
}
|
|
5084
|
-
};
|
|
5085
|
-
}
|
|
5086
|
-
function isPromiseLike(x) {
|
|
5087
|
-
return typeof x?.then === "function";
|
|
5088
|
-
}
|
|
5089
|
-
const { stringify: stringify$1, parse } = JSON;
|
|
5090
|
-
function deepCopy(x) {
|
|
5091
|
-
const stringified = stringify$1(x);
|
|
5092
|
-
return stringified ? parse(stringified) : void 0;
|
|
5093
|
-
}
|
|
5094
|
-
class DefaultRecordableCache {
|
|
5095
|
-
constructor(baseCache) {
|
|
5096
|
-
this.baseCache = baseCache;
|
|
5097
|
-
this.keysRead = /* @__PURE__ */ new Set();
|
|
5098
|
-
this.missingKeysRead = /* @__PURE__ */ new Set();
|
|
5099
|
-
this.keysUpdated = /* @__PURE__ */ new Set();
|
|
5100
|
-
this.metadataKeysUpdated = /* @__PURE__ */ new Set();
|
|
5101
|
-
}
|
|
5102
|
-
delete(key) {
|
|
5103
|
-
this.keysUpdated.add(key);
|
|
5104
|
-
this.baseCache.delete(key);
|
|
5105
|
-
}
|
|
5106
|
-
get(key, options) {
|
|
5107
|
-
this.keysRead.add(key);
|
|
5108
|
-
const value = this.baseCache.get(key);
|
|
5109
|
-
if (value === void 0) {
|
|
5110
|
-
this.missingKeysRead.add(key);
|
|
5111
|
-
}
|
|
5112
|
-
if (options?.copy) {
|
|
5113
|
-
return deepCopy(value);
|
|
5114
|
-
}
|
|
5115
|
-
return value;
|
|
5116
|
-
}
|
|
5117
|
-
set(key, value) {
|
|
5118
|
-
this.keysUpdated.add(key);
|
|
5119
|
-
this.metadataKeysUpdated.add(key);
|
|
5120
|
-
this.baseCache.set(key, value);
|
|
5121
|
-
}
|
|
5122
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5123
|
-
this.metadataKeysUpdated.add(key);
|
|
5124
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5125
|
-
}
|
|
5126
|
-
length() {
|
|
5127
|
-
return this.baseCache.length();
|
|
5128
|
-
}
|
|
5129
|
-
keys() {
|
|
5130
|
-
return this.baseCache.keys();
|
|
5131
|
-
}
|
|
5132
|
-
entries() {
|
|
5133
|
-
return this.baseCache.entries();
|
|
5134
|
-
}
|
|
5135
|
-
record() {
|
|
5136
|
-
return new DefaultRecordableCache(this);
|
|
5137
|
-
}
|
|
5138
|
-
filter(predicate) {
|
|
5139
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5140
|
-
}
|
|
5141
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5142
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5143
|
-
}
|
|
5144
|
-
}
|
|
5145
|
-
class DefaultFilteredCache {
|
|
5146
|
-
constructor(baseCache, predicate) {
|
|
5147
|
-
this.baseCache = baseCache;
|
|
5148
|
-
this.predicate = predicate;
|
|
5149
|
-
}
|
|
5150
|
-
delete(key) {
|
|
5151
|
-
this.baseCache.delete(key);
|
|
5152
|
-
}
|
|
5153
|
-
get(key, options) {
|
|
5154
|
-
const result = this.baseCache.get(key);
|
|
5155
|
-
if (result && this.predicate(key, result)) {
|
|
5156
|
-
if (options?.copy) {
|
|
5157
|
-
return deepCopy(result);
|
|
5158
|
-
}
|
|
5159
|
-
return result;
|
|
5160
|
-
}
|
|
5161
|
-
return void 0;
|
|
5162
|
-
}
|
|
5163
|
-
set(key, value) {
|
|
5164
|
-
this.baseCache.set(key, value);
|
|
5165
|
-
}
|
|
5166
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5167
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5168
|
-
}
|
|
5169
|
-
length() {
|
|
5170
|
-
return this.getFilteredKeys().size;
|
|
5171
|
-
}
|
|
5172
|
-
keys() {
|
|
5173
|
-
return this.getFilteredKeys();
|
|
5174
|
-
}
|
|
5175
|
-
entries() {
|
|
5176
|
-
return this.getFilteredEntries();
|
|
5177
|
-
}
|
|
5178
|
-
record() {
|
|
5179
|
-
return new DefaultRecordableCache(this);
|
|
5180
|
-
}
|
|
5181
|
-
filter(predicate) {
|
|
5182
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5183
|
-
}
|
|
5184
|
-
getFilteredEntries() {
|
|
5185
|
-
return this.baseCache.entries().filter(([key, _value]) => {
|
|
5186
|
-
return this.get(key);
|
|
5187
|
-
});
|
|
5188
|
-
}
|
|
5189
|
-
getFilteredKeys() {
|
|
5190
|
-
const filteredKeySet = /* @__PURE__ */ new Set();
|
|
5191
|
-
this.baseCache.keys().forEach((key) => {
|
|
5192
|
-
if (this.get(key)) {
|
|
5193
|
-
filteredKeySet.add(key);
|
|
5194
|
-
}
|
|
5195
|
-
});
|
|
5196
|
-
return filteredKeySet;
|
|
5197
|
-
}
|
|
5198
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5199
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5200
|
-
}
|
|
5201
|
-
}
|
|
5202
|
-
class FixedTimeWritableCache {
|
|
5203
|
-
constructor(baseCache, generatedTime) {
|
|
5204
|
-
this.baseCache = baseCache;
|
|
5205
|
-
this.generatedTime = generatedTime;
|
|
5206
|
-
}
|
|
5207
|
-
delete(key) {
|
|
5208
|
-
this.baseCache.delete(key);
|
|
5209
|
-
}
|
|
5210
|
-
get(key, options) {
|
|
5211
|
-
return this.baseCache.get(key, options);
|
|
5212
|
-
}
|
|
5213
|
-
set(key, value) {
|
|
5214
|
-
this.baseCache.set(key, {
|
|
5215
|
-
...value,
|
|
5216
|
-
metadata: {
|
|
5217
|
-
...value.metadata,
|
|
5218
|
-
cacheControl: { ...value.metadata.cacheControl, generatedTime: this.generatedTime }
|
|
5219
|
-
}
|
|
5220
|
-
});
|
|
5221
|
-
}
|
|
5222
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5223
|
-
this.baseCache.setMetadata(key, {
|
|
5224
|
-
...cacheControlMetadata,
|
|
5225
|
-
generatedTime: this.generatedTime
|
|
5226
|
-
});
|
|
5227
|
-
}
|
|
5228
|
-
length() {
|
|
5229
|
-
return this.baseCache.length();
|
|
5230
|
-
}
|
|
5231
|
-
keys() {
|
|
5232
|
-
return this.baseCache.keys();
|
|
5233
|
-
}
|
|
5234
|
-
entries() {
|
|
5235
|
-
return this.baseCache.entries();
|
|
5236
|
-
}
|
|
5237
|
-
record() {
|
|
5238
|
-
return new DefaultRecordableCache(this);
|
|
5239
|
-
}
|
|
5240
|
-
filter(predicate) {
|
|
5241
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5242
|
-
}
|
|
5243
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5244
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5245
|
-
}
|
|
5246
|
-
}
|
|
5247
|
-
class DefaultCache {
|
|
5248
|
-
constructor() {
|
|
5249
|
-
this.data = {};
|
|
5250
|
-
}
|
|
5251
|
-
get(key, options) {
|
|
5252
|
-
if (options?.copy) {
|
|
5253
|
-
return deepCopy(this.data[key]);
|
|
5254
|
-
}
|
|
5255
|
-
return this.data[key];
|
|
5256
|
-
}
|
|
5257
|
-
/**
|
|
5258
|
-
* Adds the specified key/value to the cache.
|
|
5259
|
-
*
|
|
5260
|
-
* @param key key at which to store value
|
|
5261
|
-
* @param entry value to be stored
|
|
5262
|
-
*/
|
|
5263
|
-
set(key, entry) {
|
|
5264
|
-
if (entry.metadata.cacheControl.type === "no-store") {
|
|
5265
|
-
return;
|
|
5266
|
-
}
|
|
5267
|
-
this.data[key] = {
|
|
5268
|
-
...entry,
|
|
5269
|
-
metadata: {
|
|
5270
|
-
...entry.metadata,
|
|
5271
|
-
type: entry.metadata.type || {
|
|
5272
|
-
namespace: "OneStore:Internal",
|
|
5273
|
-
name: "UnknownType"
|
|
5274
|
-
},
|
|
5275
|
-
cacheControl: {
|
|
5276
|
-
generatedTime: Date.now() / 1e3,
|
|
5277
|
-
...entry.metadata.cacheControl
|
|
5278
|
-
}
|
|
5279
|
-
}
|
|
4763
|
+
ok,
|
|
4764
|
+
headers: responseHeaders,
|
|
5280
4765
|
};
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
*
|
|
5294
|
-
* @param key key at which to store metadata
|
|
5295
|
-
* @param cacheControlMetadata metadata to be stored
|
|
5296
|
-
*/
|
|
5297
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5298
|
-
if (key in this.data) {
|
|
5299
|
-
this.data[key].metadata.cacheControl = {
|
|
5300
|
-
generatedTime: Date.now() / 1e3,
|
|
5301
|
-
...cacheControlMetadata
|
|
5302
|
-
};
|
|
4766
|
+
};
|
|
4767
|
+
function generateQueryString(params) {
|
|
4768
|
+
const searchParams = new URLSearchParams();
|
|
4769
|
+
for (const key of keys$1(params)) {
|
|
4770
|
+
const value = params[key];
|
|
4771
|
+
// omit undefined and empty-array values entirely: String(undefined) === 'undefined'
|
|
4772
|
+
// and String([]) === '', both of which would otherwise serialize as a valueless
|
|
4773
|
+
// `key=` or literal `key=undefined` query param that servers can reject.
|
|
4774
|
+
if (value === undefined || (isArray$2(value) && value.length === 0)) {
|
|
4775
|
+
continue;
|
|
4776
|
+
}
|
|
4777
|
+
searchParams.append(key, String(value));
|
|
5303
4778
|
}
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
return new Set(Object.keys(this.data));
|
|
5310
|
-
}
|
|
5311
|
-
entries() {
|
|
5312
|
-
return Object.entries(this.data);
|
|
5313
|
-
}
|
|
5314
|
-
record() {
|
|
5315
|
-
return new DefaultRecordableCache(this);
|
|
5316
|
-
}
|
|
5317
|
-
filter(predicate) {
|
|
5318
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5319
|
-
}
|
|
5320
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5321
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5322
|
-
}
|
|
4779
|
+
const queryString = searchParams.toString();
|
|
4780
|
+
if (queryString.length > 0) {
|
|
4781
|
+
return `?${queryString}`;
|
|
4782
|
+
}
|
|
4783
|
+
return '';
|
|
5323
4784
|
}
|
|
5324
|
-
function
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
4785
|
+
function generateHeaders(headers) {
|
|
4786
|
+
const fetchHeaders = new Headers();
|
|
4787
|
+
for (const key of keys$1(headers)) {
|
|
4788
|
+
fetchHeaders.set(key, headers[key]);
|
|
4789
|
+
}
|
|
4790
|
+
return fetchHeaders;
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
class CacheInclusionPolicyService {
|
|
5330
4794
|
}
|
|
5331
4795
|
class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
5332
4796
|
/**
|
|
@@ -5359,7 +4823,7 @@ class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
|
5359
4823
|
*/
|
|
5360
4824
|
write(options) {
|
|
5361
4825
|
const { l1, writeToL1 } = options;
|
|
5362
|
-
const tempL1 = buildServiceDescriptor$
|
|
4826
|
+
const tempL1 = buildServiceDescriptor$h().service.record();
|
|
5363
4827
|
return writeToL1(tempL1).then(() => {
|
|
5364
4828
|
const keysToReviveRecordableCache = l1.record();
|
|
5365
4829
|
tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
|
|
@@ -6692,7 +6156,7 @@ function buildActionMarksSendInterceptor() {
|
|
|
6692
6156
|
if (context && context.instrumentationId) {
|
|
6693
6157
|
createActionStartMark(context);
|
|
6694
6158
|
}
|
|
6695
|
-
return resolvedPromiseLike
|
|
6159
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6696
6160
|
};
|
|
6697
6161
|
}
|
|
6698
6162
|
function buildLuvioActionMarksSendInterceptor() {
|
|
@@ -6700,9 +6164,119 @@ function buildLuvioActionMarksSendInterceptor() {
|
|
|
6700
6164
|
if (context && context.instrumentationId) {
|
|
6701
6165
|
createActionStartMark(context);
|
|
6702
6166
|
}
|
|
6703
|
-
return resolvedPromiseLike
|
|
6167
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
|
|
6171
|
+
const CSRF_TOKEN_KEY = 'salesforce_csrf_token';
|
|
6172
|
+
const CSRF_STORAGE_NAME = 'ldsCSRFToken';
|
|
6173
|
+
const BASE_URI = '/services/data/v69.0';
|
|
6174
|
+
const UI_API_BASE_URI = `${BASE_URI}/ui-api`;
|
|
6175
|
+
const CSRF_TOKEN_ENDPOINT = `${UI_API_BASE_URI}/session/csrf`;
|
|
6176
|
+
const CSRF_STORAGE_CONFIG = {
|
|
6177
|
+
name: CSRF_STORAGE_NAME,
|
|
6178
|
+
persistent: true,
|
|
6179
|
+
secure: true,
|
|
6180
|
+
maxSize: 1024,
|
|
6181
|
+
expiration: 24 * 60 * 60,
|
|
6182
|
+
clearOnInit: false,
|
|
6183
|
+
debugLogging: false,
|
|
6184
|
+
};
|
|
6185
|
+
function readPreloadedToken(getPreloadedToken) {
|
|
6186
|
+
try {
|
|
6187
|
+
const token = getPreloadedToken?.();
|
|
6188
|
+
return typeof token === 'string' && token ? token : undefined;
|
|
6189
|
+
}
|
|
6190
|
+
catch {
|
|
6191
|
+
return undefined;
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
6194
|
+
/**
|
|
6195
|
+
* Fetches a fresh CSRF token from the server. Resolves `undefined` (not a
|
|
6196
|
+
* rejection) on any non-ok response, missing token, or network/parse error so
|
|
6197
|
+
* the manager treats it as "no value" and leaves any cached token intact. The
|
|
6198
|
+
* CSRF retry policy — not this fetch — owns retry semantics.
|
|
6199
|
+
*/
|
|
6200
|
+
async function fetchFreshToken() {
|
|
6201
|
+
try {
|
|
6202
|
+
const response = await fetch(CSRF_TOKEN_ENDPOINT, {
|
|
6203
|
+
method: 'GET',
|
|
6204
|
+
credentials: 'same-origin',
|
|
6205
|
+
});
|
|
6206
|
+
if (!response.ok) {
|
|
6207
|
+
return undefined;
|
|
6208
|
+
}
|
|
6209
|
+
const data = await response.json();
|
|
6210
|
+
const token = data.csrfToken;
|
|
6211
|
+
return typeof token === 'string' && token ? token : undefined;
|
|
6212
|
+
}
|
|
6213
|
+
catch {
|
|
6214
|
+
return undefined;
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
/**
|
|
6218
|
+
* Durable store fronted by memory so `get()` is sync once loaded (W-24883855).
|
|
6219
|
+
* No TTL: a stale token is replaced via the CSRF retry policy's `refresh()`.
|
|
6220
|
+
*/
|
|
6221
|
+
function buildCsrfResourceStorage(getPreloadedToken) {
|
|
6222
|
+
const storage = createStorage(CSRF_STORAGE_CONFIG);
|
|
6223
|
+
let currentToken;
|
|
6224
|
+
let loaded = false;
|
|
6225
|
+
// Seed once (stored, else preloaded) so a later clear() isn't resurrected by
|
|
6226
|
+
// the preload. A set()/clear() during the read wins.
|
|
6227
|
+
const seeded = (async () => {
|
|
6228
|
+
const preloadedToken = readPreloadedToken(getPreloadedToken);
|
|
6229
|
+
let existing;
|
|
6230
|
+
try {
|
|
6231
|
+
const cached = await storage?.get(CSRF_TOKEN_KEY);
|
|
6232
|
+
existing = typeof cached === 'string' && cached ? cached : undefined;
|
|
6233
|
+
}
|
|
6234
|
+
catch {
|
|
6235
|
+
// Treated as a miss; the manager fetches.
|
|
6236
|
+
}
|
|
6237
|
+
if (loaded) {
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6240
|
+
currentToken = existing ?? preloadedToken;
|
|
6241
|
+
loaded = true;
|
|
6242
|
+
if (storage && !existing && preloadedToken) {
|
|
6243
|
+
try {
|
|
6244
|
+
await storage.set(CSRF_TOKEN_KEY, preloadedToken);
|
|
6245
|
+
}
|
|
6246
|
+
catch {
|
|
6247
|
+
// Still usable from memory.
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
})();
|
|
6251
|
+
// Durable writes wait for the seed so they land after its preload write.
|
|
6252
|
+
// Failures are ignored; memory stays authoritative.
|
|
6253
|
+
const afterSeed = (write) => seeded.then(write).then(() => { }, () => { });
|
|
6254
|
+
return {
|
|
6255
|
+
get: () => (loaded ? resolvedPromiseLike(currentToken) : seeded.then(() => currentToken)),
|
|
6256
|
+
set: (value) => {
|
|
6257
|
+
currentToken = value;
|
|
6258
|
+
loaded = true;
|
|
6259
|
+
return afterSeed(() => storage?.set(CSRF_TOKEN_KEY, value));
|
|
6260
|
+
},
|
|
6261
|
+
clear: () => {
|
|
6262
|
+
currentToken = undefined;
|
|
6263
|
+
loaded = true;
|
|
6264
|
+
return afterSeed(() => storage?.remove(CSRF_TOKEN_KEY));
|
|
6265
|
+
},
|
|
6704
6266
|
};
|
|
6705
6267
|
}
|
|
6268
|
+
/**
|
|
6269
|
+
* Builds the CSRF token manager: a {@link BasicRenewableResourceManager} that
|
|
6270
|
+
* lazily caches the token in durable storage, coalesces concurrent fetches onto
|
|
6271
|
+
* a single in-flight request, and dedups refresh storms. Registered as a
|
|
6272
|
+
* provisioner service (`csrfTokenManager`) by `initializeOneStore`.
|
|
6273
|
+
*/
|
|
6274
|
+
function buildCsrfTokenManager(options = {}) {
|
|
6275
|
+
return new BasicRenewableResourceManager({
|
|
6276
|
+
fetch: fetchFreshToken,
|
|
6277
|
+
storage: buildCsrfResourceStorage(options.getPreloadedToken),
|
|
6278
|
+
});
|
|
6279
|
+
}
|
|
6706
6280
|
|
|
6707
6281
|
/**
|
|
6708
6282
|
* Service name the CSRF token manager is registered under by
|
|
@@ -6716,6 +6290,11 @@ const CSRF_TOKEN_MANAGER_REQUEST = {
|
|
|
6716
6290
|
},
|
|
6717
6291
|
};
|
|
6718
6292
|
let cached;
|
|
6293
|
+
let resolvedManager;
|
|
6294
|
+
/** The manager if {@link getCsrfTokenManager} has resolved it, else `undefined`. */
|
|
6295
|
+
function peekCsrfTokenManager() {
|
|
6296
|
+
return resolvedManager;
|
|
6297
|
+
}
|
|
6719
6298
|
/**
|
|
6720
6299
|
* Resolves the CSRF token manager from the service provisioner.
|
|
6721
6300
|
*
|
|
@@ -6731,7 +6310,10 @@ let cached;
|
|
|
6731
6310
|
function getCsrfTokenManager() {
|
|
6732
6311
|
if (!cached) {
|
|
6733
6312
|
cached = Promise.resolve(getServices(CSRF_TOKEN_MANAGER_REQUEST))
|
|
6734
|
-
.then((services) =>
|
|
6313
|
+
.then((services) => {
|
|
6314
|
+
resolvedManager = services[CSRF_TOKEN_MANAGER_SERVICE];
|
|
6315
|
+
return resolvedManager;
|
|
6316
|
+
})
|
|
6735
6317
|
.catch((error) => {
|
|
6736
6318
|
cached = undefined;
|
|
6737
6319
|
throw error;
|
|
@@ -6745,14 +6327,18 @@ const CSRF_TOKEN_HEADER = 'X-CSRF-Token';
|
|
|
6745
6327
|
* Resolves the CSRF token manager and returns the current token. Returns
|
|
6746
6328
|
* `undefined` if the manager cannot be resolved (service not yet provisioned)
|
|
6747
6329
|
* or has no token, so a request is never blocked by token resolution.
|
|
6330
|
+
* Synchronous once the manager has resolved and the token is loaded (W-24883855).
|
|
6748
6331
|
*/
|
|
6749
|
-
|
|
6332
|
+
function getCsrfToken() {
|
|
6750
6333
|
try {
|
|
6751
|
-
const manager =
|
|
6752
|
-
|
|
6334
|
+
const manager = peekCsrfTokenManager();
|
|
6335
|
+
const token = manager
|
|
6336
|
+
? manager.get()
|
|
6337
|
+
: getCsrfTokenManager().then((resolved) => resolved.get());
|
|
6338
|
+
return token.then((value) => value, () => undefined);
|
|
6753
6339
|
}
|
|
6754
6340
|
catch {
|
|
6755
|
-
return undefined;
|
|
6341
|
+
return resolvedPromiseLike(undefined);
|
|
6756
6342
|
}
|
|
6757
6343
|
}
|
|
6758
6344
|
/**
|
|
@@ -6783,7 +6369,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6783
6369
|
return async (fetchArgs) => {
|
|
6784
6370
|
// Check if all required gates are enabled before running
|
|
6785
6371
|
if (!areCsrfGatesEnabled()) {
|
|
6786
|
-
return resolvedPromiseLike
|
|
6372
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6787
6373
|
}
|
|
6788
6374
|
// Only add CSRF token for mutating operations
|
|
6789
6375
|
if (isMutatingMethod(getFetchMethod(fetchArgs))) {
|
|
@@ -6793,7 +6379,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6793
6379
|
fetchArgs = setHeader(CSRF_TOKEN_HEADER, token, fetchArgs);
|
|
6794
6380
|
}
|
|
6795
6381
|
}
|
|
6796
|
-
return resolvedPromiseLike
|
|
6382
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6797
6383
|
};
|
|
6798
6384
|
}
|
|
6799
6385
|
/**
|
|
@@ -6804,26 +6390,30 @@ function buildCsrfTokenInterceptor() {
|
|
|
6804
6390
|
* @returns A request interceptor function for Luvio ResourceRequest objects
|
|
6805
6391
|
*/
|
|
6806
6392
|
function buildLuvioCsrfTokenInterceptor() {
|
|
6807
|
-
|
|
6393
|
+
// Sync on purpose (W-24883855).
|
|
6394
|
+
return (resourceRequest) => {
|
|
6808
6395
|
// Check if all required gates are enabled before running
|
|
6809
6396
|
if (!areCsrfGatesEnabled()) {
|
|
6810
|
-
return resolvedPromiseLike
|
|
6397
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6811
6398
|
}
|
|
6812
6399
|
// Ensure headers object exists
|
|
6813
6400
|
if (!resourceRequest.headers) {
|
|
6814
6401
|
resourceRequest.headers = {};
|
|
6815
6402
|
}
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
if (!resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6820
|
-
const token = await getCsrfToken();
|
|
6821
|
-
if (token) {
|
|
6822
|
-
resourceRequest.headers[CSRF_TOKEN_HEADER] = token;
|
|
6823
|
-
}
|
|
6824
|
-
}
|
|
6403
|
+
if (!peekCsrfTokenManager()) {
|
|
6404
|
+
// Warm it (GETs too) so mutations attach the token synchronously.
|
|
6405
|
+
getCsrfTokenManager().catch(() => { });
|
|
6825
6406
|
}
|
|
6826
|
-
|
|
6407
|
+
if (!isMutatingMethod(resourceRequest.method) ||
|
|
6408
|
+
resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6409
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6410
|
+
}
|
|
6411
|
+
return getCsrfToken().then((token) => {
|
|
6412
|
+
if (token) {
|
|
6413
|
+
resourceRequest.headers[CSRF_TOKEN_HEADER] = token;
|
|
6414
|
+
}
|
|
6415
|
+
return resourceRequest;
|
|
6416
|
+
});
|
|
6827
6417
|
};
|
|
6828
6418
|
}
|
|
6829
6419
|
|
|
@@ -6837,7 +6427,7 @@ const ENTITY_ENCODING_DISABLED_VALUE = 'false';
|
|
|
6837
6427
|
*/
|
|
6838
6428
|
function buildEntityEncodingInterceptor() {
|
|
6839
6429
|
return (fetchArgs) => {
|
|
6840
|
-
return resolvedPromiseLike
|
|
6430
|
+
return resolvedPromiseLike(setHeader(ENTITY_ENCODING_HEADER, ENTITY_ENCODING_DISABLED_VALUE, fetchArgs));
|
|
6841
6431
|
};
|
|
6842
6432
|
}
|
|
6843
6433
|
/**
|
|
@@ -6853,7 +6443,7 @@ function buildLuvioEntityEncodingInterceptor() {
|
|
|
6853
6443
|
if (!resourceRequest.headers[ENTITY_ENCODING_HEADER]) {
|
|
6854
6444
|
resourceRequest.headers[ENTITY_ENCODING_HEADER] = ENTITY_ENCODING_DISABLED_VALUE;
|
|
6855
6445
|
}
|
|
6856
|
-
return resolvedPromiseLike
|
|
6446
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6857
6447
|
};
|
|
6858
6448
|
}
|
|
6859
6449
|
|
|
@@ -6868,7 +6458,7 @@ const FIRST_PARTY_VALUE = 'platform-ui';
|
|
|
6868
6458
|
function buildFirstPartyHeaderInterceptor() {
|
|
6869
6459
|
return async (fetchArgs) => {
|
|
6870
6460
|
const returnedFetchArgs = setHeader(FIRST_PARTY_HEADER, FIRST_PARTY_VALUE, fetchArgs);
|
|
6871
|
-
return resolvedPromiseLike
|
|
6461
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
6872
6462
|
};
|
|
6873
6463
|
}
|
|
6874
6464
|
/**
|
|
@@ -6879,14 +6469,15 @@ function buildFirstPartyHeaderInterceptor() {
|
|
|
6879
6469
|
* @returns A request interceptor for Luvio ResourceRequest objects
|
|
6880
6470
|
*/
|
|
6881
6471
|
function buildLuvioFirstPartyHeaderInterceptor() {
|
|
6882
|
-
|
|
6472
|
+
// Sync on purpose (W-24883855).
|
|
6473
|
+
return (resourceRequest) => {
|
|
6883
6474
|
if (!resourceRequest.headers) {
|
|
6884
6475
|
resourceRequest.headers = {};
|
|
6885
6476
|
}
|
|
6886
6477
|
if (!resourceRequest.headers[FIRST_PARTY_HEADER]) {
|
|
6887
6478
|
resourceRequest.headers[FIRST_PARTY_HEADER] = FIRST_PARTY_VALUE;
|
|
6888
6479
|
}
|
|
6889
|
-
return resolvedPromiseLike
|
|
6480
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6890
6481
|
};
|
|
6891
6482
|
}
|
|
6892
6483
|
|
|
@@ -6924,7 +6515,8 @@ function mintIdempotencyKey() {
|
|
|
6924
6515
|
* registry flag can never cause an unsafe replay.
|
|
6925
6516
|
*/
|
|
6926
6517
|
function buildLuvioIdempotencyKeyInterceptor() {
|
|
6927
|
-
|
|
6518
|
+
// Sync on purpose (W-24883855).
|
|
6519
|
+
return (resourceRequest) => {
|
|
6928
6520
|
if (!resourceRequest.headers) {
|
|
6929
6521
|
resourceRequest.headers = {};
|
|
6930
6522
|
}
|
|
@@ -6933,7 +6525,7 @@ function buildLuvioIdempotencyKeyInterceptor() {
|
|
|
6933
6525
|
!resourceRequest.headers[IDEMPOTENCY_KEY_HEADER]) {
|
|
6934
6526
|
resourceRequest.headers[IDEMPOTENCY_KEY_HEADER] = mintIdempotencyKey();
|
|
6935
6527
|
}
|
|
6936
|
-
return resolvedPromiseLike
|
|
6528
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6937
6529
|
};
|
|
6938
6530
|
}
|
|
6939
6531
|
|
|
@@ -7016,9 +6608,9 @@ function buildJwtParameterizationInterceptor(jwtManager, jwtRequestModifier = (_
|
|
|
7016
6608
|
// interceptor handles it. This MUST be the first statement so non-opted-in
|
|
7017
6609
|
// SFAP commands observe no work at all.
|
|
7018
6610
|
if (mintParams === undefined) {
|
|
7019
|
-
return resolvedPromiseLike
|
|
6611
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7020
6612
|
}
|
|
7021
|
-
return resolvedPromiseLike
|
|
6613
|
+
return resolvedPromiseLike(jwtManager.getJwt(mintParams)).then((token) => {
|
|
7022
6614
|
const fetchArgsWithAuthorization = setHeaderAuthorization(token, fetchArgs);
|
|
7023
6615
|
return token.extraInfo
|
|
7024
6616
|
? jwtRequestModifier(token.extraInfo, fetchArgsWithAuthorization)
|
|
@@ -7044,7 +6636,7 @@ function buildLuvioPageScopedCacheRequestInterceptor() {
|
|
|
7044
6636
|
}
|
|
7045
6637
|
// Pass the headers to pageScopedCache which will mutate them
|
|
7046
6638
|
pageScopedCache.addHeader(resourceRequest.headers);
|
|
7047
|
-
return resolvedPromiseLike
|
|
6639
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7048
6640
|
};
|
|
7049
6641
|
}
|
|
7050
6642
|
|
|
@@ -7058,7 +6650,7 @@ function buildPageScopedCacheRequestInterceptor() {
|
|
|
7058
6650
|
Object.entries(pageScopedCacheHeaders).forEach(([key, value]) => {
|
|
7059
6651
|
returnedFetchArgs = setHeader(key, value, returnedFetchArgs);
|
|
7060
6652
|
});
|
|
7061
|
-
return resolvedPromiseLike
|
|
6653
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
7062
6654
|
};
|
|
7063
6655
|
}
|
|
7064
6656
|
|
|
@@ -7073,7 +6665,7 @@ function buildTransportMarksSendInterceptor() {
|
|
|
7073
6665
|
context.startTime = performance.now();
|
|
7074
6666
|
createTransportStartMark(requestId);
|
|
7075
6667
|
}
|
|
7076
|
-
return resolvedPromiseLike
|
|
6668
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7077
6669
|
};
|
|
7078
6670
|
}
|
|
7079
6671
|
function buildLuvioTransportMarksSendInterceptor() {
|
|
@@ -7084,7 +6676,7 @@ function buildLuvioTransportMarksSendInterceptor() {
|
|
|
7084
6676
|
context.startTime = performance.now();
|
|
7085
6677
|
createTransportStartMark(requestId);
|
|
7086
6678
|
}
|
|
7087
|
-
return resolvedPromiseLike
|
|
6679
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7088
6680
|
};
|
|
7089
6681
|
}
|
|
7090
6682
|
function setLuvioRequestIdHeader(resourceRequest, requestId) {
|
|
@@ -8031,7 +7623,7 @@ class PrioritizedConfigService {
|
|
|
8031
7623
|
}
|
|
8032
7624
|
});
|
|
8033
7625
|
this.validated = errors.length === 0;
|
|
8034
|
-
return errors.length === 0 ? ok
|
|
7626
|
+
return errors.length === 0 ? ok(void 0) : err(errors);
|
|
8035
7627
|
}
|
|
8036
7628
|
// constructs a proxy for the given non-leaf object path in the config tree
|
|
8037
7629
|
buildReadonlyObjectProxy(path) {
|
|
@@ -8050,7 +7642,7 @@ class PrioritizedConfigService {
|
|
|
8050
7642
|
get: (_, property) => {
|
|
8051
7643
|
const propertyPath = [...path, property];
|
|
8052
7644
|
const value = this.valueFor(propertyPath);
|
|
8053
|
-
return typeof value === "object" && value !== null && !isArray$
|
|
7645
|
+
return typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value;
|
|
8054
7646
|
},
|
|
8055
7647
|
getOwnPropertyDescriptor: (target, property) => {
|
|
8056
7648
|
const propertyPath = [...path, property];
|
|
@@ -8058,7 +7650,7 @@ class PrioritizedConfigService {
|
|
|
8058
7650
|
return {
|
|
8059
7651
|
value: (
|
|
8060
7652
|
// TODO - need to wrap arrays in a Proxy as well
|
|
8061
|
-
typeof value === "object" && value !== null && !isArray$
|
|
7653
|
+
typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value
|
|
8062
7654
|
),
|
|
8063
7655
|
writable: false,
|
|
8064
7656
|
configurable: true,
|
|
@@ -8159,7 +7751,7 @@ function getEnvironmentSetting(name) {
|
|
|
8159
7751
|
}
|
|
8160
7752
|
return undefined;
|
|
8161
7753
|
}
|
|
8162
|
-
// version: 1.
|
|
7754
|
+
// version: 1.471.0-a0bc34effb
|
|
8163
7755
|
|
|
8164
7756
|
const auraClientService = getAuraClientService();
|
|
8165
7757
|
const defaultConfig = {
|
|
@@ -8614,7 +8206,7 @@ function buildLuvioThirdPartyTrackerRegisterInterceptor() {
|
|
|
8614
8206
|
return false;
|
|
8615
8207
|
});
|
|
8616
8208
|
}
|
|
8617
|
-
return resolvedPromiseLike
|
|
8209
|
+
return resolvedPromiseLike(resourceRequest);
|
|
8618
8210
|
};
|
|
8619
8211
|
}
|
|
8620
8212
|
|
|
@@ -8771,7 +8363,7 @@ function buildThirdPartyTrackerRegisterInterceptor() {
|
|
|
8771
8363
|
return false;
|
|
8772
8364
|
});
|
|
8773
8365
|
}
|
|
8774
|
-
return resolvedPromiseLike
|
|
8366
|
+
return resolvedPromiseLike(fetchArgs);
|
|
8775
8367
|
};
|
|
8776
8368
|
}
|
|
8777
8369
|
|
|
@@ -8868,7 +8460,7 @@ function prefetchSfapJwt() {
|
|
|
8868
8460
|
return Promise.resolve(undefined);
|
|
8869
8461
|
}
|
|
8870
8462
|
function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
8871
|
-
const jwtAuthorizedFetchService = buildServiceDescriptor$
|
|
8463
|
+
const jwtAuthorizedFetchService = buildServiceDescriptor$q({
|
|
8872
8464
|
createContext: createInstrumentationIdContext(),
|
|
8873
8465
|
request: [
|
|
8874
8466
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -8908,7 +8500,7 @@ function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
|
8908
8500
|
* the Data360 command — the SFAP fleet never flows past this interceptor.
|
|
8909
8501
|
*/
|
|
8910
8502
|
function buildJwtAuthorizedData360FetchServiceDescriptor(logger) {
|
|
8911
|
-
const data360FetchService = buildServiceDescriptor$
|
|
8503
|
+
const data360FetchService = buildServiceDescriptor$q({
|
|
8912
8504
|
createContext: createInstrumentationIdContext(),
|
|
8913
8505
|
request: [
|
|
8914
8506
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -8938,7 +8530,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
8938
8530
|
// we switch to JWT authentication this will need to change to incorporate the
|
|
8939
8531
|
// Interceptor here with the logic in buildJwtAuthorizedSfapFetchServiceDescriptor()
|
|
8940
8532
|
// above.
|
|
8941
|
-
...buildServiceDescriptor$
|
|
8533
|
+
...buildServiceDescriptor$q({
|
|
8942
8534
|
createContext: createInstrumentationIdContext(),
|
|
8943
8535
|
request: [
|
|
8944
8536
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -8954,9 +8546,9 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
8954
8546
|
requestInit.method !== 'POST' ||
|
|
8955
8547
|
!requestInit.body ||
|
|
8956
8548
|
typeof requestInit.body !== 'string') {
|
|
8957
|
-
return resolvedPromiseLike
|
|
8549
|
+
return resolvedPromiseLike(args);
|
|
8958
8550
|
}
|
|
8959
|
-
return resolvedPromiseLike
|
|
8551
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt()).then((token) => {
|
|
8960
8552
|
// replace the body's instanceConfig.endpoint with the JWT's iss value
|
|
8961
8553
|
const body = JSON.parse(requestInit.body);
|
|
8962
8554
|
if (!body || !token.decodedInfo || !token.decodedInfo.iss) {
|
|
@@ -8991,7 +8583,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
8991
8583
|
};
|
|
8992
8584
|
}
|
|
8993
8585
|
function buildUnauthorizedFetchServiceDescriptor() {
|
|
8994
|
-
const fetchService = buildServiceDescriptor$
|
|
8586
|
+
const fetchService = buildServiceDescriptor$q({
|
|
8995
8587
|
createContext: createInstrumentationIdContext(),
|
|
8996
8588
|
// Per-request gzip (opt-in via `init.onestore.compression`).
|
|
8997
8589
|
request: [buildThirdPartyTrackerRegisterInterceptor(), buildCompressionInterceptor()],
|
|
@@ -9067,9 +8659,9 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9067
8659
|
context?.[JWT_MINT_PARAMS_SEED_KEY];
|
|
9068
8660
|
// No mint params → not a parameterized Data360 request. Nothing to do.
|
|
9069
8661
|
if (mintParams === undefined) {
|
|
9070
|
-
return resolvedPromiseLike
|
|
8662
|
+
return resolvedPromiseLike(fetchArgs);
|
|
9071
8663
|
}
|
|
9072
|
-
return resolvedPromiseLike
|
|
8664
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt(mintParams)).then((token) => {
|
|
9073
8665
|
const [resource, request] = fetchArgs;
|
|
9074
8666
|
if (typeof resource !== 'string' && !(resource instanceof URL)) {
|
|
9075
8667
|
// istanbul ignore else: not exercised under NODE_ENV=production
|
|
@@ -9116,7 +8708,7 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9116
8708
|
*/
|
|
9117
8709
|
function buildGuardedLegacyJwtRequestInterceptor(logger) {
|
|
9118
8710
|
const legacyInterceptor = buildJwtRequestInterceptor(logger);
|
|
9119
|
-
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike
|
|
8711
|
+
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike(args) : legacyInterceptor(args);
|
|
9120
8712
|
}
|
|
9121
8713
|
|
|
9122
8714
|
class NoComposedAdapterTypeError extends TypeError {
|
|
@@ -9214,12 +8806,12 @@ function getLexRuntimeDefaultInterceptorConfig(logger) {
|
|
|
9214
8806
|
};
|
|
9215
8807
|
}
|
|
9216
8808
|
function buildLexRuntimeDefaultFetchServiceDescriptor(logger, retryService) {
|
|
9217
|
-
const fetchService = buildServiceDescriptor$
|
|
8809
|
+
const fetchService = buildServiceDescriptor$q(getLexRuntimeDefaultInterceptorConfig(logger), retryService);
|
|
9218
8810
|
return { ...fetchService };
|
|
9219
8811
|
}
|
|
9220
8812
|
function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
9221
8813
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
9222
|
-
const fetchService = buildServiceDescriptor$
|
|
8814
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9223
8815
|
...config,
|
|
9224
8816
|
// Omit 5xx interceptor - allow 5xx responses to pass through
|
|
9225
8817
|
response: [
|
|
@@ -9235,7 +8827,7 @@ function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
|
9235
8827
|
}
|
|
9236
8828
|
function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
9237
8829
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
9238
|
-
const fetchService = buildServiceDescriptor$
|
|
8830
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9239
8831
|
...config,
|
|
9240
8832
|
// Append compression interceptor last, after any body-modifying interceptors
|
|
9241
8833
|
request: [...config.request, buildCompressionInterceptor({ algorithm: 'gzip' })],
|
|
@@ -9246,149 +8838,6 @@ function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
|
9246
8838
|
};
|
|
9247
8839
|
}
|
|
9248
8840
|
|
|
9249
|
-
const CSRF_TOKEN_KEY = 'salesforce_csrf_token';
|
|
9250
|
-
const CSRF_STORAGE_NAME = 'ldsCSRFToken';
|
|
9251
|
-
const BASE_URI = '/services/data/v69.0';
|
|
9252
|
-
const UI_API_BASE_URI = `${BASE_URI}/ui-api`;
|
|
9253
|
-
const CSRF_TOKEN_ENDPOINT = `${UI_API_BASE_URI}/session/csrf`;
|
|
9254
|
-
const CSRF_STORAGE_CONFIG = {
|
|
9255
|
-
name: CSRF_STORAGE_NAME,
|
|
9256
|
-
persistent: true,
|
|
9257
|
-
secure: true,
|
|
9258
|
-
maxSize: 1024,
|
|
9259
|
-
expiration: 24 * 60 * 60,
|
|
9260
|
-
clearOnInit: false,
|
|
9261
|
-
debugLogging: false,
|
|
9262
|
-
};
|
|
9263
|
-
/**
|
|
9264
|
-
* Reads the CSRF token Aura preloads onto the bootstrap payload. When the
|
|
9265
|
-
* Connect Framework CSRF token is minted at template-render time it is exposed
|
|
9266
|
-
* via `$A.clientService.getConnectCsrfToken()`. Reading it here lets the first
|
|
9267
|
-
* state-changing request skip the cold `/ui-api/session/csrf` round trip.
|
|
9268
|
-
*
|
|
9269
|
-
* Defensive against a missing getter or server killswitch: returns `undefined`,
|
|
9270
|
-
* never throws.
|
|
9271
|
-
*/
|
|
9272
|
-
function readPreloadedToken() {
|
|
9273
|
-
const clientService = getAuraClientService();
|
|
9274
|
-
if (typeof clientService?.getConnectCsrfToken !== 'function') {
|
|
9275
|
-
return undefined;
|
|
9276
|
-
}
|
|
9277
|
-
try {
|
|
9278
|
-
const token = clientService.getConnectCsrfToken();
|
|
9279
|
-
return typeof token === 'string' && token ? token : undefined;
|
|
9280
|
-
}
|
|
9281
|
-
catch {
|
|
9282
|
-
return undefined;
|
|
9283
|
-
}
|
|
9284
|
-
}
|
|
9285
|
-
/**
|
|
9286
|
-
* Fetches a fresh CSRF token from the server. Resolves `undefined` (not a
|
|
9287
|
-
* rejection) on any non-ok response, missing token, or network/parse error so
|
|
9288
|
-
* the manager treats it as "no value" and leaves any cached token intact. The
|
|
9289
|
-
* CSRF retry policy — not this fetch — owns retry semantics.
|
|
9290
|
-
*/
|
|
9291
|
-
async function fetchFreshToken() {
|
|
9292
|
-
try {
|
|
9293
|
-
const response = await fetch(CSRF_TOKEN_ENDPOINT, {
|
|
9294
|
-
method: 'GET',
|
|
9295
|
-
credentials: 'same-origin',
|
|
9296
|
-
});
|
|
9297
|
-
if (!response.ok) {
|
|
9298
|
-
return undefined;
|
|
9299
|
-
}
|
|
9300
|
-
const data = await response.json();
|
|
9301
|
-
const token = data.csrfToken;
|
|
9302
|
-
return typeof token === 'string' && token ? token : undefined;
|
|
9303
|
-
}
|
|
9304
|
-
catch {
|
|
9305
|
-
return undefined;
|
|
9306
|
-
}
|
|
9307
|
-
}
|
|
9308
|
-
/**
|
|
9309
|
-
* Adapts the durable AuraStorage backing store to the {@link ResourceStorage}
|
|
9310
|
-
* contract the renewable-resource manager expects.
|
|
9311
|
-
*
|
|
9312
|
-
* The Aura-preloaded token is written into the store **once at creation** (only
|
|
9313
|
-
* when the store is otherwise empty), so the first `get()` finds it and the
|
|
9314
|
-
* first mutation skips the network. Seeding the store — rather than having
|
|
9315
|
-
* `get()` fall back to the preload on every empty read — means a later
|
|
9316
|
-
* `clear()` (logout / org switch) is not silently resurrected by the preload.
|
|
9317
|
-
*
|
|
9318
|
-
* Every operation awaits the one-time seed so reads and writes observe a
|
|
9319
|
-
* consistent store. Storage read/write failures are non-fatal.
|
|
9320
|
-
*/
|
|
9321
|
-
function buildCsrfResourceStorage() {
|
|
9322
|
-
const storage = createStorage(CSRF_STORAGE_CONFIG);
|
|
9323
|
-
// Pre-seed the preloaded token into the store, once, if the store is empty.
|
|
9324
|
-
const seeded = (async () => {
|
|
9325
|
-
const preloadedToken = readPreloadedToken();
|
|
9326
|
-
if (!storage || !preloadedToken) {
|
|
9327
|
-
return;
|
|
9328
|
-
}
|
|
9329
|
-
try {
|
|
9330
|
-
const existing = await storage.get(CSRF_TOKEN_KEY);
|
|
9331
|
-
if (typeof existing !== 'string' || !existing) {
|
|
9332
|
-
await storage.set(CSRF_TOKEN_KEY, preloadedToken);
|
|
9333
|
-
}
|
|
9334
|
-
}
|
|
9335
|
-
catch {
|
|
9336
|
-
// Non-fatal: fall back to fetching a fresh token on first use.
|
|
9337
|
-
}
|
|
9338
|
-
})();
|
|
9339
|
-
return {
|
|
9340
|
-
get: async () => {
|
|
9341
|
-
await seeded;
|
|
9342
|
-
if (storage) {
|
|
9343
|
-
try {
|
|
9344
|
-
const cached = await storage.get(CSRF_TOKEN_KEY);
|
|
9345
|
-
if (typeof cached === 'string' && cached) {
|
|
9346
|
-
return cached;
|
|
9347
|
-
}
|
|
9348
|
-
}
|
|
9349
|
-
catch {
|
|
9350
|
-
// Non-fatal: treat as a cache miss so the manager fetches.
|
|
9351
|
-
}
|
|
9352
|
-
}
|
|
9353
|
-
return undefined;
|
|
9354
|
-
},
|
|
9355
|
-
set: async (value) => {
|
|
9356
|
-
await seeded;
|
|
9357
|
-
if (storage) {
|
|
9358
|
-
try {
|
|
9359
|
-
await storage.set(CSRF_TOKEN_KEY, value);
|
|
9360
|
-
}
|
|
9361
|
-
catch {
|
|
9362
|
-
// Non-fatal: token is still usable even if caching fails.
|
|
9363
|
-
}
|
|
9364
|
-
}
|
|
9365
|
-
},
|
|
9366
|
-
clear: async () => {
|
|
9367
|
-
await seeded;
|
|
9368
|
-
if (storage) {
|
|
9369
|
-
try {
|
|
9370
|
-
await storage.remove(CSRF_TOKEN_KEY);
|
|
9371
|
-
}
|
|
9372
|
-
catch {
|
|
9373
|
-
// Non-fatal: continue even if the clear fails.
|
|
9374
|
-
}
|
|
9375
|
-
}
|
|
9376
|
-
},
|
|
9377
|
-
};
|
|
9378
|
-
}
|
|
9379
|
-
/**
|
|
9380
|
-
* Builds the CSRF token manager: a {@link BasicRenewableResourceManager} that
|
|
9381
|
-
* lazily caches the token in durable storage, coalesces concurrent fetches onto
|
|
9382
|
-
* a single in-flight request, and dedups refresh storms. Registered as a
|
|
9383
|
-
* provisioner service (`csrfTokenManager`) by `initializeOneStore`.
|
|
9384
|
-
*/
|
|
9385
|
-
function buildCsrfTokenManager() {
|
|
9386
|
-
return new BasicRenewableResourceManager({
|
|
9387
|
-
fetch: fetchFreshToken,
|
|
9388
|
-
storage: buildCsrfResourceStorage(),
|
|
9389
|
-
});
|
|
9390
|
-
}
|
|
9391
|
-
|
|
9392
8841
|
// Registration published on the force/ldsEngine bus so shared (cross-runtime) laf
|
|
9393
8842
|
// loaders can read buildPredictorForContext without importing a bootstrap bundle.
|
|
9394
8843
|
const PDL_ENGINE_REGISTRATION_ID = '@salesforce/lds-pdl-engine';
|
|
@@ -9521,7 +8970,9 @@ function initializeOneStore(luvio) {
|
|
|
9521
8970
|
// loudly in development instead.
|
|
9522
8971
|
const retryServiceDescriptor = buildServiceDescriptor$8(new UnconfiguredRetryPolicy());
|
|
9523
8972
|
const retryService = retryServiceDescriptor.service;
|
|
9524
|
-
const csrfTokenManagerServiceDescriptor = buildRenewableResourceManagerDescriptor(CSRF_TOKEN_MANAGER_SERVICE, buildCsrfTokenManager(
|
|
8973
|
+
const csrfTokenManagerServiceDescriptor = buildRenewableResourceManagerDescriptor(CSRF_TOKEN_MANAGER_SERVICE, buildCsrfTokenManager({
|
|
8974
|
+
getPreloadedToken: () => getAuraClientService()?.getConnectCsrfToken?.(),
|
|
8975
|
+
}));
|
|
9525
8976
|
const prefetchSfapJwtServiceDescriptor = {
|
|
9526
8977
|
type: 'prefetchSfapJwt',
|
|
9527
8978
|
version: '1.0',
|
|
@@ -9550,7 +9001,7 @@ function initializeOneStore(luvio) {
|
|
|
9550
9001
|
buildServiceDescriptor$p(),
|
|
9551
9002
|
buildServiceDescriptor$e(),
|
|
9552
9003
|
buildServiceDescriptor$m(),
|
|
9553
|
-
buildServiceDescriptor$
|
|
9004
|
+
buildServiceDescriptor$r(),
|
|
9554
9005
|
buildServiceDescriptor$l(),
|
|
9555
9006
|
buildServiceDescriptor$k(),
|
|
9556
9007
|
buildServiceDescriptor$o(),
|
|
@@ -9567,9 +9018,9 @@ function initializeOneStore(luvio) {
|
|
|
9567
9018
|
buildServiceDescriptor$5(),
|
|
9568
9019
|
buildServiceDescriptor$4(),
|
|
9569
9020
|
buildServiceDescriptor$7(),
|
|
9570
|
-
buildServiceDescriptor$3
|
|
9021
|
+
buildServiceDescriptor$3(),
|
|
9571
9022
|
buildServiceDescriptor$2$1(),
|
|
9572
|
-
buildServiceDescriptor$1$
|
|
9023
|
+
buildServiceDescriptor$1$1(),
|
|
9573
9024
|
buildServiceDescriptor$6(),
|
|
9574
9025
|
buildLWCWireBindingsServiceDescriptor(),
|
|
9575
9026
|
buildLWCGraphQLWireBindingsServiceDescriptor(),
|
|
@@ -9601,4 +9052,4 @@ function ldsEngineCreator() {
|
|
|
9601
9052
|
}
|
|
9602
9053
|
|
|
9603
9054
|
export { PDL_ENGINE_REGISTRATION_ID, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory };
|
|
9604
|
-
// version: 1.
|
|
9055
|
+
// version: 1.471.0-2898c91740
|