@salesforce/lds-runtime-one-runtime 1.470.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/oneRuntimeLdsEngineCreator.js +421 -957
- package/package.json +42 -42
|
@@ -43,8 +43,8 @@ import auraBasedRequestsEnabled from '@salesforce/gate/ui.services.auraBasedRequ
|
|
|
43
43
|
import { registerSubRequestNetworkAdapter } from 'force/ldsNetwork';
|
|
44
44
|
|
|
45
45
|
const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
|
|
46
|
-
const { isArray: isArray$
|
|
47
|
-
const { stringify: stringify$
|
|
46
|
+
const { isArray: isArray$3 } = Array;
|
|
47
|
+
const { stringify: stringify$1, parse } = JSON;
|
|
48
48
|
const WeakSetConstructor = WeakSet;
|
|
49
49
|
const LogLevelMap = {
|
|
50
50
|
TRACE: 4,
|
|
@@ -85,7 +85,7 @@ class ConsoleLogger {
|
|
|
85
85
|
function loggerService(level, printer, formatter) {
|
|
86
86
|
return new ConsoleLogger(level, printer, formatter);
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
class Ok {
|
|
89
89
|
constructor(value) {
|
|
90
90
|
this.value = value;
|
|
91
91
|
}
|
|
@@ -95,8 +95,8 @@ let Ok$2 = class Ok {
|
|
|
95
95
|
isErr() {
|
|
96
96
|
return !this.isOk();
|
|
97
97
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
98
|
+
}
|
|
99
|
+
class Err {
|
|
100
100
|
constructor(error) {
|
|
101
101
|
this.error = error;
|
|
102
102
|
}
|
|
@@ -106,12 +106,26 @@ let Err$1 = class Err {
|
|
|
106
106
|
isErr() {
|
|
107
107
|
return !this.isOk();
|
|
108
108
|
}
|
|
109
|
-
}
|
|
110
|
-
const ok
|
|
111
|
-
const err
|
|
109
|
+
}
|
|
110
|
+
const ok = (value) => new Ok(value);
|
|
111
|
+
const err = (err2) => new Err(err2);
|
|
112
112
|
function isResult(value) {
|
|
113
113
|
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);
|
|
114
114
|
}
|
|
115
|
+
function setDifference(setA, setB) {
|
|
116
|
+
const differenceSet = /* @__PURE__ */ new Set();
|
|
117
|
+
for (const element of setA) {
|
|
118
|
+
if (!setB.has(element)) {
|
|
119
|
+
differenceSet.add(element);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return differenceSet;
|
|
123
|
+
}
|
|
124
|
+
function addAllToSet(targetSet, sourceSet) {
|
|
125
|
+
for (const element of sourceSet) {
|
|
126
|
+
targetSet.add(element);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
115
129
|
function isSubscribable(obj) {
|
|
116
130
|
return typeof obj === "object" && obj !== null && "subscribe" in obj && typeof obj.subscribe === "function" && "refresh" in obj && typeof obj.refresh === "function";
|
|
117
131
|
}
|
|
@@ -121,15 +135,15 @@ function isSubscribableResult(x) {
|
|
|
121
135
|
}
|
|
122
136
|
return isSubscribable(x.isOk() ? x.value : x.error);
|
|
123
137
|
}
|
|
124
|
-
function buildSubscribableResult
|
|
138
|
+
function buildSubscribableResult(result, subscribe, refresh) {
|
|
125
139
|
if (result.isOk()) {
|
|
126
|
-
return ok
|
|
140
|
+
return ok({ data: result.value, subscribe, refresh });
|
|
127
141
|
} else {
|
|
128
|
-
return err
|
|
142
|
+
return err({ failure: result.error, subscribe, refresh });
|
|
129
143
|
}
|
|
130
144
|
}
|
|
131
|
-
function resolvedPromiseLike
|
|
132
|
-
if (isPromiseLike
|
|
145
|
+
function resolvedPromiseLike(result) {
|
|
146
|
+
if (isPromiseLike(result)) {
|
|
133
147
|
return result.then(
|
|
134
148
|
(nextResult) => nextResult
|
|
135
149
|
);
|
|
@@ -137,18 +151,18 @@ function resolvedPromiseLike$2(result) {
|
|
|
137
151
|
return {
|
|
138
152
|
then: (onFulfilled, _onRejected) => {
|
|
139
153
|
try {
|
|
140
|
-
return resolvedPromiseLike
|
|
154
|
+
return resolvedPromiseLike(onFulfilled(result));
|
|
141
155
|
} catch (e) {
|
|
142
156
|
if (onFulfilled === void 0) {
|
|
143
|
-
return resolvedPromiseLike
|
|
157
|
+
return resolvedPromiseLike(result);
|
|
144
158
|
}
|
|
145
|
-
return rejectedPromiseLike
|
|
159
|
+
return rejectedPromiseLike(e);
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
};
|
|
149
163
|
}
|
|
150
|
-
function rejectedPromiseLike
|
|
151
|
-
if (isPromiseLike
|
|
164
|
+
function rejectedPromiseLike(reason) {
|
|
165
|
+
if (isPromiseLike(reason)) {
|
|
152
166
|
return reason.then(
|
|
153
167
|
(nextResult) => nextResult
|
|
154
168
|
);
|
|
@@ -157,31 +171,31 @@ function rejectedPromiseLike$2(reason) {
|
|
|
157
171
|
then: (_onFulfilled, onRejected) => {
|
|
158
172
|
if (typeof onRejected === "function") {
|
|
159
173
|
try {
|
|
160
|
-
return resolvedPromiseLike
|
|
174
|
+
return resolvedPromiseLike(onRejected(reason));
|
|
161
175
|
} catch (e) {
|
|
162
|
-
return rejectedPromiseLike
|
|
176
|
+
return rejectedPromiseLike(e);
|
|
163
177
|
}
|
|
164
178
|
}
|
|
165
|
-
return rejectedPromiseLike
|
|
179
|
+
return rejectedPromiseLike(reason);
|
|
166
180
|
}
|
|
167
181
|
};
|
|
168
182
|
}
|
|
169
|
-
function isPromiseLike
|
|
183
|
+
function isPromiseLike(x) {
|
|
170
184
|
return typeof x?.then === "function";
|
|
171
185
|
}
|
|
172
|
-
function deepEquals$
|
|
186
|
+
function deepEquals$1(x, y) {
|
|
173
187
|
if (x === void 0) {
|
|
174
188
|
return y === void 0;
|
|
175
189
|
} else if (x === null) {
|
|
176
190
|
return y === null;
|
|
177
191
|
} else if (y === null) {
|
|
178
192
|
return x === null;
|
|
179
|
-
} else if (isArray$
|
|
180
|
-
if (!isArray$
|
|
193
|
+
} else if (isArray$3(x)) {
|
|
194
|
+
if (!isArray$3(y) || x.length !== y.length) {
|
|
181
195
|
return false;
|
|
182
196
|
}
|
|
183
197
|
for (let i = 0; i < x.length; ++i) {
|
|
184
|
-
if (!deepEquals$
|
|
198
|
+
if (!deepEquals$1(x[i], y[i])) {
|
|
185
199
|
return false;
|
|
186
200
|
}
|
|
187
201
|
}
|
|
@@ -197,7 +211,7 @@ function deepEquals$2(x, y) {
|
|
|
197
211
|
}
|
|
198
212
|
for (let i = 0; i < xkeys.length; ++i) {
|
|
199
213
|
const key = xkeys[i];
|
|
200
|
-
if (!deepEquals$
|
|
214
|
+
if (!deepEquals$1(
|
|
201
215
|
x[key],
|
|
202
216
|
y[key]
|
|
203
217
|
)) {
|
|
@@ -220,11 +234,11 @@ function stableJSONStringify$2(node) {
|
|
|
220
234
|
return isFinite(node) ? "" + node : "null";
|
|
221
235
|
}
|
|
222
236
|
if (typeof node !== "object") {
|
|
223
|
-
return stringify$
|
|
237
|
+
return stringify$1(node);
|
|
224
238
|
}
|
|
225
239
|
let i;
|
|
226
240
|
let out;
|
|
227
|
-
if (isArray$
|
|
241
|
+
if (isArray$3(node)) {
|
|
228
242
|
out = "[";
|
|
229
243
|
for (i = 0; i < node.length; i++) {
|
|
230
244
|
if (i) {
|
|
@@ -249,7 +263,7 @@ function stableJSONStringify$2(node) {
|
|
|
249
263
|
if (out) {
|
|
250
264
|
out += ",";
|
|
251
265
|
}
|
|
252
|
-
out += stringify$
|
|
266
|
+
out += stringify$1(key) + ":" + value;
|
|
253
267
|
}
|
|
254
268
|
return "{" + out + "}";
|
|
255
269
|
}
|
|
@@ -259,6 +273,10 @@ function toError(x) {
|
|
|
259
273
|
}
|
|
260
274
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
261
275
|
}
|
|
276
|
+
function deepCopy(x) {
|
|
277
|
+
const stringified = stringify$1(x);
|
|
278
|
+
return stringified ? parse(stringified) : void 0;
|
|
279
|
+
}
|
|
262
280
|
var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
263
281
|
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
264
282
|
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
@@ -332,7 +350,7 @@ function deepFreeze(value) {
|
|
|
332
350
|
return;
|
|
333
351
|
}
|
|
334
352
|
deeplyFrozen.add(value);
|
|
335
|
-
if (isArray$
|
|
353
|
+
if (isArray$3(value)) {
|
|
336
354
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
337
355
|
deepFreeze(value[i]);
|
|
338
356
|
}
|
|
@@ -372,7 +390,7 @@ function logError$1(error) {
|
|
|
372
390
|
class BaseCommand {
|
|
373
391
|
}
|
|
374
392
|
|
|
375
|
-
|
|
393
|
+
class NetworkCommand extends BaseCommand {
|
|
376
394
|
constructor(services) {
|
|
377
395
|
super();
|
|
378
396
|
this.services = services;
|
|
@@ -388,7 +406,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
388
406
|
}
|
|
389
407
|
fetchSubscribableResult(res) {
|
|
390
408
|
return res.then((networkResult) => {
|
|
391
|
-
return buildSubscribableResult
|
|
409
|
+
return buildSubscribableResult(
|
|
392
410
|
networkResult,
|
|
393
411
|
(cb) => {
|
|
394
412
|
this.subscriptions.push(cb);
|
|
@@ -403,7 +421,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
403
421
|
refresh() {
|
|
404
422
|
return this.execute().then((newResult) => {
|
|
405
423
|
if (isSubscribableResult(newResult)) {
|
|
406
|
-
const value = newResult.isOk() ? ok
|
|
424
|
+
const value = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
407
425
|
this.subscriptions.forEach((cb) => {
|
|
408
426
|
try {
|
|
409
427
|
cb(value);
|
|
@@ -411,21 +429,21 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
411
429
|
}
|
|
412
430
|
});
|
|
413
431
|
}
|
|
414
|
-
return ok
|
|
432
|
+
return ok(void 0);
|
|
415
433
|
});
|
|
416
434
|
}
|
|
417
435
|
async afterRequestHooks(_options) {
|
|
418
436
|
}
|
|
419
|
-
}
|
|
420
|
-
function buildServiceDescriptor$
|
|
437
|
+
}
|
|
438
|
+
function buildServiceDescriptor$r() {
|
|
421
439
|
return {
|
|
422
440
|
type: "networkCommandBaseClass",
|
|
423
441
|
version: "1.0",
|
|
424
|
-
service: NetworkCommand
|
|
442
|
+
service: NetworkCommand
|
|
425
443
|
};
|
|
426
444
|
}
|
|
427
445
|
|
|
428
|
-
function applyOperationRequestOptions
|
|
446
|
+
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
429
447
|
if (operationType === void 0 && requestOptions === void 0) {
|
|
430
448
|
return init;
|
|
431
449
|
}
|
|
@@ -438,7 +456,164 @@ function applyOperationRequestOptions$3(init, operationType, requestOptions) {
|
|
|
438
456
|
}
|
|
439
457
|
};
|
|
440
458
|
}
|
|
441
|
-
|
|
459
|
+
function buildServiceDescriptor$q(interceptors = {
|
|
460
|
+
request: [],
|
|
461
|
+
retry: void 0,
|
|
462
|
+
response: [],
|
|
463
|
+
finally: []
|
|
464
|
+
}, retryService) {
|
|
465
|
+
return {
|
|
466
|
+
type: "fetch",
|
|
467
|
+
version: "1.0",
|
|
468
|
+
service: function(input, init) {
|
|
469
|
+
let contextSeed;
|
|
470
|
+
let cleanInit = init;
|
|
471
|
+
if (init !== void 0 && "__contextSeed" in init) {
|
|
472
|
+
const { __contextSeed, ...initWithoutSeed } = init;
|
|
473
|
+
contextSeed = __contextSeed;
|
|
474
|
+
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
475
|
+
}
|
|
476
|
+
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
477
|
+
const baseContext = interceptors.createContext?.();
|
|
478
|
+
const onestore = cleanInit?.onestore;
|
|
479
|
+
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
480
|
+
...baseContext,
|
|
481
|
+
...contextSeed,
|
|
482
|
+
...onestore !== void 0 && { onestore }
|
|
483
|
+
};
|
|
484
|
+
const {
|
|
485
|
+
request: requestInterceptors = [],
|
|
486
|
+
retry: retryInterceptor = void 0,
|
|
487
|
+
response: responseInterceptors = [],
|
|
488
|
+
finally: finallyInterceptors = []
|
|
489
|
+
} = interceptors;
|
|
490
|
+
const pending = requestInterceptors.reduce(
|
|
491
|
+
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
492
|
+
resolvedPromiseLike(fetchArgs)
|
|
493
|
+
);
|
|
494
|
+
return Promise.resolve(pending).then((args) => {
|
|
495
|
+
if (retryInterceptor) {
|
|
496
|
+
return retryInterceptor(args, retryService, context);
|
|
497
|
+
} else {
|
|
498
|
+
if (retryService) {
|
|
499
|
+
return retryService.applyRetry(() => fetch(...args));
|
|
500
|
+
}
|
|
501
|
+
return fetch(...args);
|
|
502
|
+
}
|
|
503
|
+
}).then((response) => {
|
|
504
|
+
return responseInterceptors.reduce(
|
|
505
|
+
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
506
|
+
resolvedPromiseLike(response)
|
|
507
|
+
);
|
|
508
|
+
}).finally(() => {
|
|
509
|
+
if (finallyInterceptors.length > 0) {
|
|
510
|
+
return finallyInterceptors.reduce(
|
|
511
|
+
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
512
|
+
Promise.resolve()
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
let textEncoder;
|
|
520
|
+
function getTextEncoder() {
|
|
521
|
+
if (!textEncoder) {
|
|
522
|
+
if (typeof TextEncoder === "undefined") {
|
|
523
|
+
throw new Error(
|
|
524
|
+
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
textEncoder = new TextEncoder();
|
|
528
|
+
}
|
|
529
|
+
return textEncoder;
|
|
530
|
+
}
|
|
531
|
+
function buildCompressionInterceptor(defaultConfig) {
|
|
532
|
+
return async (args) => {
|
|
533
|
+
const [resource, options = {}] = args;
|
|
534
|
+
const config = options.onestore?.compression ?? defaultConfig;
|
|
535
|
+
if (config === void 0) {
|
|
536
|
+
return resolvedPromiseLike(args);
|
|
537
|
+
}
|
|
538
|
+
const threshold = config.threshold ?? 1024;
|
|
539
|
+
if (!options.body || typeof options.body !== "string") {
|
|
540
|
+
return resolvedPromiseLike(args);
|
|
541
|
+
}
|
|
542
|
+
if (typeof CompressionStream === "undefined") {
|
|
543
|
+
return resolvedPromiseLike(args);
|
|
544
|
+
}
|
|
545
|
+
const headers = new Headers(options.headers);
|
|
546
|
+
if (headers.has("Content-Encoding")) {
|
|
547
|
+
return resolvedPromiseLike(args);
|
|
548
|
+
}
|
|
549
|
+
const encodedBody = getTextEncoder().encode(options.body);
|
|
550
|
+
if (encodedBody.byteLength < threshold) {
|
|
551
|
+
return resolvedPromiseLike(args);
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
555
|
+
const compressedBody = await new Response(stream).blob();
|
|
556
|
+
headers.set("Content-Encoding", config.algorithm);
|
|
557
|
+
headers.delete("Content-Length");
|
|
558
|
+
const compressedOptions = {
|
|
559
|
+
...options,
|
|
560
|
+
body: compressedBody,
|
|
561
|
+
headers
|
|
562
|
+
};
|
|
563
|
+
return resolvedPromiseLike([resource, compressedOptions]);
|
|
564
|
+
} catch {
|
|
565
|
+
return resolvedPromiseLike(args);
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
570
|
+
throwOnExisting = false,
|
|
571
|
+
errorMessage = `Unexpected ${headerName} header encountered`
|
|
572
|
+
} = {}) {
|
|
573
|
+
let hasHeaderBeenSet = false;
|
|
574
|
+
if (resource instanceof Request && !options?.headers) {
|
|
575
|
+
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
576
|
+
throw new Error(errorMessage);
|
|
577
|
+
}
|
|
578
|
+
resource.headers.set(headerName, headerValue);
|
|
579
|
+
hasHeaderBeenSet = true;
|
|
580
|
+
}
|
|
581
|
+
if (options?.headers instanceof Headers) {
|
|
582
|
+
if (throwOnExisting && options.headers.has(headerName)) {
|
|
583
|
+
throw new Error(errorMessage);
|
|
584
|
+
}
|
|
585
|
+
options.headers.set(headerName, headerValue);
|
|
586
|
+
} else {
|
|
587
|
+
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
588
|
+
throw new Error(errorMessage);
|
|
589
|
+
}
|
|
590
|
+
if (!hasHeaderBeenSet) {
|
|
591
|
+
options.headers = {
|
|
592
|
+
...options?.headers,
|
|
593
|
+
[headerName]: headerValue
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return [resource, options];
|
|
598
|
+
}
|
|
599
|
+
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";
|
|
600
|
+
function setHeaderAuthorization({ token }, fetchParams) {
|
|
601
|
+
const authorizationValue = `Bearer ${token}`;
|
|
602
|
+
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
603
|
+
throwOnExisting: true,
|
|
604
|
+
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
608
|
+
return (args) => {
|
|
609
|
+
return resolvedPromiseLike(jwtManager.getJwt()).then((token) => {
|
|
610
|
+
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
611
|
+
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
612
|
+
});
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
class AuraNetworkCommand extends NetworkCommand {
|
|
442
617
|
constructor(services) {
|
|
443
618
|
super(services);
|
|
444
619
|
this.services = services;
|
|
@@ -492,19 +667,19 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
492
667
|
this.afterRequestHooks({ statusCode: 200 });
|
|
493
668
|
} catch {
|
|
494
669
|
}
|
|
495
|
-
return ok
|
|
670
|
+
return ok(auraReturnValue);
|
|
496
671
|
}).catch((error) => {
|
|
497
672
|
if (!error) {
|
|
498
|
-
return err
|
|
673
|
+
return err(toError("Failed to get error from response"));
|
|
499
674
|
}
|
|
500
675
|
if (!error.getError) {
|
|
501
|
-
return err
|
|
676
|
+
return err(toError(error));
|
|
502
677
|
}
|
|
503
678
|
const actionErrors = error.getError();
|
|
504
679
|
if (actionErrors.length > 0) {
|
|
505
|
-
return err
|
|
680
|
+
return err(coerceError(actionErrors));
|
|
506
681
|
}
|
|
507
|
-
return err
|
|
682
|
+
return err(toError("Error fetching component"));
|
|
508
683
|
});
|
|
509
684
|
}
|
|
510
685
|
isSemanticNullResponse(response) {
|
|
@@ -522,10 +697,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
522
697
|
if (response2.ok) {
|
|
523
698
|
let resultPromise;
|
|
524
699
|
if (this.isSemanticNullResponse(response2)) {
|
|
525
|
-
resultPromise = Promise.resolve(ok
|
|
700
|
+
resultPromise = Promise.resolve(ok(null));
|
|
526
701
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
527
702
|
resultPromise = Promise.resolve(
|
|
528
|
-
err
|
|
703
|
+
err(
|
|
529
704
|
toError(
|
|
530
705
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
531
706
|
)
|
|
@@ -533,8 +708,8 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
533
708
|
);
|
|
534
709
|
} else {
|
|
535
710
|
resultPromise = response2.json().then(
|
|
536
|
-
(json) => ok
|
|
537
|
-
(reason) => err
|
|
711
|
+
(json) => ok(json),
|
|
712
|
+
(reason) => err(toError(reason))
|
|
538
713
|
);
|
|
539
714
|
}
|
|
540
715
|
return resultPromise.finally(() => {
|
|
@@ -545,7 +720,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
545
720
|
});
|
|
546
721
|
} else {
|
|
547
722
|
return this.coerceError(response2).then((coercedError) => {
|
|
548
|
-
return err
|
|
723
|
+
return err(coercedError);
|
|
549
724
|
}).finally(() => {
|
|
550
725
|
try {
|
|
551
726
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -554,7 +729,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
554
729
|
});
|
|
555
730
|
}
|
|
556
731
|
},
|
|
557
|
-
(reason) => err
|
|
732
|
+
(reason) => err(toError(reason))
|
|
558
733
|
);
|
|
559
734
|
}
|
|
560
735
|
shouldUseAuraNetwork() {
|
|
@@ -578,7 +753,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
578
753
|
);
|
|
579
754
|
} else if (this.shouldUseFetch()) {
|
|
580
755
|
const [input, init] = this.fetchParams;
|
|
581
|
-
const initWithOptions = applyOperationRequestOptions
|
|
756
|
+
const initWithOptions = applyOperationRequestOptions(
|
|
582
757
|
init,
|
|
583
758
|
this.operationType,
|
|
584
759
|
this.requestOptions
|
|
@@ -587,10 +762,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
587
762
|
const fetchCall = initWithOptions === void 0 ? this.services.fetch(input) : this.services.fetch(input, initWithOptions);
|
|
588
763
|
return this.convertFetchResponseToData(fetchCall);
|
|
589
764
|
} catch (reason) {
|
|
590
|
-
return resolvedPromiseLike
|
|
765
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
591
766
|
}
|
|
592
767
|
}
|
|
593
|
-
return resolvedPromiseLike
|
|
768
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
594
769
|
}
|
|
595
770
|
}
|
|
596
771
|
function buildServiceDescriptor$p() {
|
|
@@ -601,164 +776,52 @@ function buildServiceDescriptor$p() {
|
|
|
601
776
|
};
|
|
602
777
|
}
|
|
603
778
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
779
|
+
function setOverlaps(setA, setB) {
|
|
780
|
+
if (setA.size > setB.size) {
|
|
781
|
+
for (const key of setB.keys()) {
|
|
782
|
+
if (setA.has(key)) {
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
} else {
|
|
787
|
+
for (const key of setA) {
|
|
788
|
+
if (setB.has(key)) {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
611
792
|
}
|
|
612
|
-
|
|
613
|
-
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
class CacheControlRequestRunner {
|
|
796
|
+
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
797
|
+
this.readFromCacheInternal = readFromCache;
|
|
798
|
+
this.requestFromNetworkInternal = requestFromNetwork;
|
|
799
|
+
this.writeToCacheInternal = writeToCache;
|
|
614
800
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
801
|
+
readFromCache(cache) {
|
|
802
|
+
const resultPromise = this.readFromCacheInternal(cache);
|
|
803
|
+
return resultPromise.then((result) => {
|
|
804
|
+
if (result.isErr()) {
|
|
805
|
+
return err(result.error.failure);
|
|
806
|
+
}
|
|
807
|
+
this.returnData = result;
|
|
808
|
+
return ok(void 0);
|
|
809
|
+
});
|
|
619
810
|
}
|
|
620
|
-
|
|
621
|
-
|
|
811
|
+
requestFromNetwork() {
|
|
812
|
+
const that = this;
|
|
813
|
+
return (async function* () {
|
|
814
|
+
const result = await that.requestFromNetworkInternal();
|
|
815
|
+
if (result.isErr()) {
|
|
816
|
+
that.networkError = result;
|
|
817
|
+
} else {
|
|
818
|
+
that.networkData = result;
|
|
819
|
+
}
|
|
820
|
+
yield result;
|
|
821
|
+
})();
|
|
622
822
|
}
|
|
623
|
-
|
|
624
|
-
return
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
const ok$1 = (value) => new Ok$1(value);
|
|
628
|
-
const err = (err2) => new Err(err2);
|
|
629
|
-
function buildSubscribableResult(result, subscribe, refresh) {
|
|
630
|
-
if (result.isOk()) {
|
|
631
|
-
return ok$1({ data: result.value, subscribe, refresh });
|
|
632
|
-
} else {
|
|
633
|
-
return err({ failure: result.error, subscribe, refresh });
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
function resolvedPromiseLike$1(result) {
|
|
637
|
-
if (isPromiseLike$1(result)) {
|
|
638
|
-
return result.then(
|
|
639
|
-
(nextResult) => nextResult
|
|
640
|
-
);
|
|
641
|
-
}
|
|
642
|
-
return {
|
|
643
|
-
then: (onFulfilled, _onRejected) => {
|
|
644
|
-
try {
|
|
645
|
-
return resolvedPromiseLike$1(onFulfilled(result));
|
|
646
|
-
} catch (e) {
|
|
647
|
-
if (onFulfilled === void 0) {
|
|
648
|
-
return resolvedPromiseLike$1(result);
|
|
649
|
-
}
|
|
650
|
-
return rejectedPromiseLike$1(e);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
function rejectedPromiseLike$1(reason) {
|
|
656
|
-
if (isPromiseLike$1(reason)) {
|
|
657
|
-
return reason.then(
|
|
658
|
-
(nextResult) => nextResult
|
|
659
|
-
);
|
|
660
|
-
}
|
|
661
|
-
return {
|
|
662
|
-
then: (_onFulfilled, onRejected) => {
|
|
663
|
-
if (typeof onRejected === "function") {
|
|
664
|
-
try {
|
|
665
|
-
return resolvedPromiseLike$1(onRejected(reason));
|
|
666
|
-
} catch (e) {
|
|
667
|
-
return rejectedPromiseLike$1(e);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
return rejectedPromiseLike$1(reason);
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
function isPromiseLike$1(x) {
|
|
675
|
-
return typeof x?.then === "function";
|
|
676
|
-
}
|
|
677
|
-
function deepEquals$1(x, y) {
|
|
678
|
-
if (x === void 0) {
|
|
679
|
-
return y === void 0;
|
|
680
|
-
} else if (x === null) {
|
|
681
|
-
return y === null;
|
|
682
|
-
} else if (y === null) {
|
|
683
|
-
return x === null;
|
|
684
|
-
} else if (isArray$3(x)) {
|
|
685
|
-
if (!isArray$3(y) || x.length !== y.length) {
|
|
686
|
-
return false;
|
|
687
|
-
}
|
|
688
|
-
for (let i = 0; i < x.length; ++i) {
|
|
689
|
-
if (!deepEquals$1(x[i], y[i])) {
|
|
690
|
-
return false;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
return true;
|
|
694
|
-
} else if (typeof x === "object") {
|
|
695
|
-
if (typeof y !== "object") {
|
|
696
|
-
return false;
|
|
697
|
-
}
|
|
698
|
-
const xkeys = Object.keys(x);
|
|
699
|
-
const ykeys = Object.keys(y);
|
|
700
|
-
if (xkeys.length !== ykeys.length) {
|
|
701
|
-
return false;
|
|
702
|
-
}
|
|
703
|
-
for (let i = 0; i < xkeys.length; ++i) {
|
|
704
|
-
const key = xkeys[i];
|
|
705
|
-
if (!deepEquals$1(
|
|
706
|
-
x[key],
|
|
707
|
-
y[key]
|
|
708
|
-
)) {
|
|
709
|
-
return false;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
return true;
|
|
713
|
-
}
|
|
714
|
-
return x === y;
|
|
715
|
-
}
|
|
716
|
-
function setOverlaps(setA, setB) {
|
|
717
|
-
if (setA.size > setB.size) {
|
|
718
|
-
for (const key of setB.keys()) {
|
|
719
|
-
if (setA.has(key)) {
|
|
720
|
-
return true;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
} else {
|
|
724
|
-
for (const key of setA) {
|
|
725
|
-
if (setB.has(key)) {
|
|
726
|
-
return true;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
class CacheControlRequestRunner {
|
|
733
|
-
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
734
|
-
this.readFromCacheInternal = readFromCache;
|
|
735
|
-
this.requestFromNetworkInternal = requestFromNetwork;
|
|
736
|
-
this.writeToCacheInternal = writeToCache;
|
|
737
|
-
}
|
|
738
|
-
readFromCache(cache) {
|
|
739
|
-
const resultPromise = this.readFromCacheInternal(cache);
|
|
740
|
-
return resultPromise.then((result) => {
|
|
741
|
-
if (result.isErr()) {
|
|
742
|
-
return err(result.error.failure);
|
|
743
|
-
}
|
|
744
|
-
this.returnData = result;
|
|
745
|
-
return ok$1(void 0);
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
requestFromNetwork() {
|
|
749
|
-
const that = this;
|
|
750
|
-
return (async function* () {
|
|
751
|
-
const result = await that.requestFromNetworkInternal();
|
|
752
|
-
if (result.isErr()) {
|
|
753
|
-
that.networkError = result;
|
|
754
|
-
} else {
|
|
755
|
-
that.networkData = result;
|
|
756
|
-
}
|
|
757
|
-
yield result;
|
|
758
|
-
})();
|
|
759
|
-
}
|
|
760
|
-
writeToCache(cache, networkResult) {
|
|
761
|
-
return this.writeToCacheInternal(cache, networkResult);
|
|
823
|
+
writeToCache(cache, networkResult) {
|
|
824
|
+
return this.writeToCacheInternal(cache, networkResult);
|
|
762
825
|
}
|
|
763
826
|
}
|
|
764
827
|
class CacheControlCommand extends BaseCommand {
|
|
@@ -909,7 +972,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
909
972
|
});
|
|
910
973
|
}
|
|
911
974
|
}
|
|
912
|
-
return resolvedPromiseLike
|
|
975
|
+
return resolvedPromiseLike(void 0);
|
|
913
976
|
}
|
|
914
977
|
get operationType() {
|
|
915
978
|
return "query";
|
|
@@ -1011,7 +1074,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1011
1074
|
if (result.isErr()) {
|
|
1012
1075
|
return err(result.error.failure);
|
|
1013
1076
|
}
|
|
1014
|
-
return ok
|
|
1077
|
+
return ok(void 0);
|
|
1015
1078
|
});
|
|
1016
1079
|
}
|
|
1017
1080
|
/**
|
|
@@ -1030,7 +1093,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1030
1093
|
return this.writeToCache(recordableCache, networkResult).then((result) => {
|
|
1031
1094
|
this.instantiationTime = Date.now() / 1e3;
|
|
1032
1095
|
this.keysUpdated = recordableCache.keysUpdated;
|
|
1033
|
-
return ok
|
|
1096
|
+
return ok(result);
|
|
1034
1097
|
});
|
|
1035
1098
|
}
|
|
1036
1099
|
/**
|
|
@@ -1057,7 +1120,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1057
1120
|
const data = readResult.value;
|
|
1058
1121
|
this.keysUsed = recordableCache.keysRead;
|
|
1059
1122
|
return buildSubscribableResult(
|
|
1060
|
-
ok
|
|
1123
|
+
ok(data),
|
|
1061
1124
|
this.buildSubscribe(),
|
|
1062
1125
|
() => this.refresh()
|
|
1063
1126
|
);
|
|
@@ -1110,7 +1173,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1110
1173
|
}
|
|
1111
1174
|
if (this.lastResult === void 0 || this.lastResult.type === "error" || !this.equals(this.lastResult.data, result.value.data)) {
|
|
1112
1175
|
this.lastResult = { type: "data", data: result.value.data };
|
|
1113
|
-
this.invokeConsumerCallbacks(ok
|
|
1176
|
+
this.invokeConsumerCallbacks(ok(result.value.data));
|
|
1114
1177
|
}
|
|
1115
1178
|
return result;
|
|
1116
1179
|
});
|
|
@@ -1150,19 +1213,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
1150
1213
|
};
|
|
1151
1214
|
}
|
|
1152
1215
|
|
|
1153
|
-
function applyOperationRequestOptions$2(init, operationType, requestOptions) {
|
|
1154
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1155
|
-
return init;
|
|
1156
|
-
}
|
|
1157
|
-
return {
|
|
1158
|
-
...init,
|
|
1159
|
-
onestore: {
|
|
1160
|
-
...requestOptions,
|
|
1161
|
-
...init?.onestore,
|
|
1162
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1163
|
-
}
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
1216
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
1167
1217
|
constructor(services) {
|
|
1168
1218
|
super(services);
|
|
@@ -1192,7 +1242,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1192
1242
|
input,
|
|
1193
1243
|
init
|
|
1194
1244
|
]) {
|
|
1195
|
-
return [input, applyOperationRequestOptions
|
|
1245
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1196
1246
|
}
|
|
1197
1247
|
shouldUseAuraNetwork() {
|
|
1198
1248
|
return this.services.auraNetwork !== void 0 && (this.networkPreference === "aura" || !this.services.fetch);
|
|
@@ -1216,10 +1266,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1216
1266
|
try {
|
|
1217
1267
|
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1218
1268
|
} catch (reason) {
|
|
1219
|
-
return resolvedPromiseLike
|
|
1269
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1220
1270
|
}
|
|
1221
1271
|
}
|
|
1222
|
-
return resolvedPromiseLike
|
|
1272
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
1223
1273
|
}
|
|
1224
1274
|
coerceAuraErrors(auraErrors) {
|
|
1225
1275
|
return toError(auraErrors[0]);
|
|
@@ -1228,10 +1278,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1228
1278
|
return toError(errorResponse.statusText);
|
|
1229
1279
|
}
|
|
1230
1280
|
processAuraReturnValue(auraReturnValue) {
|
|
1231
|
-
return ok
|
|
1281
|
+
return ok(auraReturnValue);
|
|
1232
1282
|
}
|
|
1233
1283
|
processFetchReturnValue(json) {
|
|
1234
|
-
return ok
|
|
1284
|
+
return ok(json);
|
|
1235
1285
|
}
|
|
1236
1286
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
1237
1287
|
return responsePromise.then((response) => {
|
|
@@ -1243,16 +1293,16 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1243
1293
|
}
|
|
1244
1294
|
}).catch((error) => {
|
|
1245
1295
|
if (!error) {
|
|
1246
|
-
return err
|
|
1296
|
+
return err(toError("Failed to get error from response"));
|
|
1247
1297
|
}
|
|
1248
1298
|
if (!error.getError) {
|
|
1249
|
-
return err
|
|
1299
|
+
return err(toError(error));
|
|
1250
1300
|
}
|
|
1251
1301
|
const actionErrors = error.getError();
|
|
1252
1302
|
if (actionErrors.length > 0) {
|
|
1253
|
-
return err
|
|
1303
|
+
return err(coerceError(actionErrors));
|
|
1254
1304
|
}
|
|
1255
|
-
return err
|
|
1305
|
+
return err(toError("Error fetching component"));
|
|
1256
1306
|
});
|
|
1257
1307
|
}
|
|
1258
1308
|
convertFetchResponseToData(response) {
|
|
@@ -1263,7 +1313,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1263
1313
|
(json) => {
|
|
1264
1314
|
return this.processFetchReturnValue(json);
|
|
1265
1315
|
},
|
|
1266
|
-
(reason) => err
|
|
1316
|
+
(reason) => err(toError(reason))
|
|
1267
1317
|
).finally(() => {
|
|
1268
1318
|
try {
|
|
1269
1319
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1272,7 +1322,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1272
1322
|
});
|
|
1273
1323
|
} else {
|
|
1274
1324
|
return this.coerceError(response2).then((coercedError) => {
|
|
1275
|
-
return err
|
|
1325
|
+
return err(coercedError);
|
|
1276
1326
|
}).finally(() => {
|
|
1277
1327
|
try {
|
|
1278
1328
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1281,10 +1331,11 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1281
1331
|
});
|
|
1282
1332
|
}
|
|
1283
1333
|
},
|
|
1284
|
-
(reason) => err
|
|
1334
|
+
(reason) => err(toError(reason))
|
|
1285
1335
|
);
|
|
1286
1336
|
}
|
|
1287
1337
|
}
|
|
1338
|
+
|
|
1288
1339
|
class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
1289
1340
|
constructor(services) {
|
|
1290
1341
|
super(services);
|
|
@@ -1293,11 +1344,11 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1293
1344
|
readFromCache(cache) {
|
|
1294
1345
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1295
1346
|
if (data.isErr()) {
|
|
1296
|
-
return resolvedPromiseLike
|
|
1297
|
-
err
|
|
1347
|
+
return resolvedPromiseLike(
|
|
1348
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1298
1349
|
);
|
|
1299
1350
|
}
|
|
1300
|
-
return resolvedPromiseLike
|
|
1351
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1301
1352
|
}
|
|
1302
1353
|
writeToCache(cache, networkResult) {
|
|
1303
1354
|
if (networkResult.isOk()) {
|
|
@@ -1306,7 +1357,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1306
1357
|
this.buildWriteInput(networkResult.value)
|
|
1307
1358
|
);
|
|
1308
1359
|
}
|
|
1309
|
-
return resolvedPromiseLike
|
|
1360
|
+
return resolvedPromiseLike(void 0);
|
|
1310
1361
|
}
|
|
1311
1362
|
}
|
|
1312
1363
|
function buildServiceDescriptor$o() {
|
|
@@ -1317,19 +1368,6 @@ function buildServiceDescriptor$o() {
|
|
|
1317
1368
|
};
|
|
1318
1369
|
}
|
|
1319
1370
|
|
|
1320
|
-
function applyOperationRequestOptions$1(init, operationType, requestOptions) {
|
|
1321
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1322
|
-
return init;
|
|
1323
|
-
}
|
|
1324
|
-
return {
|
|
1325
|
-
...init,
|
|
1326
|
-
onestore: {
|
|
1327
|
-
...requestOptions,
|
|
1328
|
-
...init?.onestore,
|
|
1329
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
1371
|
class HttpCacheControlCommand extends CacheControlCommand {
|
|
1334
1372
|
constructor(services) {
|
|
1335
1373
|
super(services);
|
|
@@ -1351,7 +1389,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1351
1389
|
input,
|
|
1352
1390
|
init
|
|
1353
1391
|
]) {
|
|
1354
|
-
return [input, applyOperationRequestOptions
|
|
1392
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1355
1393
|
}
|
|
1356
1394
|
fetch() {
|
|
1357
1395
|
try {
|
|
@@ -1359,7 +1397,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1359
1397
|
this.services.fetch(...this.withRequestOptions(this.fetchParams))
|
|
1360
1398
|
);
|
|
1361
1399
|
} catch (reason) {
|
|
1362
|
-
return resolvedPromiseLike
|
|
1400
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1363
1401
|
}
|
|
1364
1402
|
}
|
|
1365
1403
|
isSemanticNullResponse(response) {
|
|
@@ -1375,7 +1413,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1375
1413
|
return toError(errorResponse.statusText);
|
|
1376
1414
|
}
|
|
1377
1415
|
processFetchReturnValue(json) {
|
|
1378
|
-
return ok
|
|
1416
|
+
return ok(json);
|
|
1379
1417
|
}
|
|
1380
1418
|
convertFetchResponseToData(response) {
|
|
1381
1419
|
return response.then(
|
|
@@ -1383,10 +1421,10 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1383
1421
|
if (response2.ok) {
|
|
1384
1422
|
let resultPromise;
|
|
1385
1423
|
if (this.isSemanticNullResponse(response2)) {
|
|
1386
|
-
resultPromise = Promise.resolve(ok
|
|
1424
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1387
1425
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
1388
1426
|
resultPromise = Promise.resolve(
|
|
1389
|
-
err
|
|
1427
|
+
err(
|
|
1390
1428
|
toError(
|
|
1391
1429
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1392
1430
|
)
|
|
@@ -1397,7 +1435,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1397
1435
|
(json) => {
|
|
1398
1436
|
return this.processFetchReturnValue(json);
|
|
1399
1437
|
},
|
|
1400
|
-
(reason) => err
|
|
1438
|
+
(reason) => err(toError(reason))
|
|
1401
1439
|
);
|
|
1402
1440
|
}
|
|
1403
1441
|
return resultPromise.finally(() => {
|
|
@@ -1408,7 +1446,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1408
1446
|
});
|
|
1409
1447
|
} else {
|
|
1410
1448
|
return this.coerceError(response2).then((coercedError) => {
|
|
1411
|
-
return err
|
|
1449
|
+
return err(coercedError);
|
|
1412
1450
|
}).finally(() => {
|
|
1413
1451
|
try {
|
|
1414
1452
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1417,10 +1455,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1417
1455
|
});
|
|
1418
1456
|
}
|
|
1419
1457
|
},
|
|
1420
|
-
(reason) => err
|
|
1458
|
+
(reason) => err(toError(reason))
|
|
1421
1459
|
);
|
|
1422
1460
|
}
|
|
1423
1461
|
}
|
|
1462
|
+
|
|
1424
1463
|
class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
1425
1464
|
constructor(services) {
|
|
1426
1465
|
super(services);
|
|
@@ -1429,11 +1468,11 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1429
1468
|
readFromCache(cache) {
|
|
1430
1469
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1431
1470
|
if (data.isErr()) {
|
|
1432
|
-
return resolvedPromiseLike
|
|
1433
|
-
err
|
|
1471
|
+
return resolvedPromiseLike(
|
|
1472
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1434
1473
|
);
|
|
1435
1474
|
}
|
|
1436
|
-
return resolvedPromiseLike
|
|
1475
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1437
1476
|
}
|
|
1438
1477
|
writeToCache(cache, networkResult) {
|
|
1439
1478
|
if (networkResult.isOk()) {
|
|
@@ -1442,7 +1481,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1442
1481
|
this.buildWriteInput(networkResult.value)
|
|
1443
1482
|
);
|
|
1444
1483
|
}
|
|
1445
|
-
return resolvedPromiseLike
|
|
1484
|
+
return resolvedPromiseLike(void 0);
|
|
1446
1485
|
}
|
|
1447
1486
|
}
|
|
1448
1487
|
function buildServiceDescriptor$n() {
|
|
@@ -1453,64 +1492,6 @@ function buildServiceDescriptor$n() {
|
|
|
1453
1492
|
};
|
|
1454
1493
|
}
|
|
1455
1494
|
|
|
1456
|
-
class NetworkCommand extends BaseCommand {
|
|
1457
|
-
constructor(services) {
|
|
1458
|
-
super();
|
|
1459
|
-
this.services = services;
|
|
1460
|
-
this.subscriptions = [];
|
|
1461
|
-
this.exposeSubscribeAndRefresh = false;
|
|
1462
|
-
}
|
|
1463
|
-
execute() {
|
|
1464
|
-
const result = this.fetch();
|
|
1465
|
-
if (this.exposeSubscribeAndRefresh) {
|
|
1466
|
-
return this.fetchSubscribableResult(result);
|
|
1467
|
-
}
|
|
1468
|
-
return result;
|
|
1469
|
-
}
|
|
1470
|
-
fetchSubscribableResult(res) {
|
|
1471
|
-
return res.then((networkResult) => {
|
|
1472
|
-
return buildSubscribableResult$1(
|
|
1473
|
-
networkResult,
|
|
1474
|
-
(cb) => {
|
|
1475
|
-
this.subscriptions.push(cb);
|
|
1476
|
-
return () => {
|
|
1477
|
-
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
1478
|
-
};
|
|
1479
|
-
},
|
|
1480
|
-
() => this.refresh()
|
|
1481
|
-
);
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
refresh() {
|
|
1485
|
-
return this.execute().then((newResult) => {
|
|
1486
|
-
if (isSubscribableResult(newResult)) {
|
|
1487
|
-
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
1488
|
-
this.subscriptions.forEach((cb) => {
|
|
1489
|
-
try {
|
|
1490
|
-
cb(value);
|
|
1491
|
-
} catch {
|
|
1492
|
-
}
|
|
1493
|
-
});
|
|
1494
|
-
}
|
|
1495
|
-
return ok$2(void 0);
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
async afterRequestHooks(_options) {
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
1502
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1503
|
-
return init;
|
|
1504
|
-
}
|
|
1505
|
-
return {
|
|
1506
|
-
...init,
|
|
1507
|
-
onestore: {
|
|
1508
|
-
...requestOptions,
|
|
1509
|
-
...init?.onestore,
|
|
1510
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
}
|
|
1514
1495
|
function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
1515
1496
|
try {
|
|
1516
1497
|
const {
|
|
@@ -1525,7 +1506,7 @@ function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
|
1525
1506
|
const fetchCall = initWithSeed === void 0 ? services.fetch(input) : services.fetch(input, initWithSeed);
|
|
1526
1507
|
return convertFetchResponseToData(fetchCall, hooks);
|
|
1527
1508
|
} catch (reason) {
|
|
1528
|
-
return resolvedPromiseLike
|
|
1509
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1529
1510
|
}
|
|
1530
1511
|
}
|
|
1531
1512
|
function convertFetchResponseToData(response, hooks) {
|
|
@@ -1534,10 +1515,10 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1534
1515
|
if (response2.ok) {
|
|
1535
1516
|
let resultPromise;
|
|
1536
1517
|
if (hooks.isSemanticNullResponse(response2)) {
|
|
1537
|
-
resultPromise = Promise.resolve(ok
|
|
1518
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1538
1519
|
} else if (hooks.isProtocolNoBodyStatus(response2.status) && !hooks.isSemanticNullResponse(response2)) {
|
|
1539
1520
|
resultPromise = Promise.resolve(
|
|
1540
|
-
err
|
|
1521
|
+
err(
|
|
1541
1522
|
toError(
|
|
1542
1523
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1543
1524
|
)
|
|
@@ -1545,8 +1526,8 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1545
1526
|
);
|
|
1546
1527
|
} else {
|
|
1547
1528
|
resultPromise = response2.json().then(
|
|
1548
|
-
(json) => ok
|
|
1549
|
-
(reason) => err
|
|
1529
|
+
(json) => ok(json),
|
|
1530
|
+
(reason) => err(toError(reason))
|
|
1550
1531
|
);
|
|
1551
1532
|
}
|
|
1552
1533
|
return resultPromise.finally(() => {
|
|
@@ -1557,7 +1538,7 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1557
1538
|
});
|
|
1558
1539
|
} else {
|
|
1559
1540
|
return hooks.coerceError(response2).then((coercedError) => {
|
|
1560
|
-
return err
|
|
1541
|
+
return err(coercedError);
|
|
1561
1542
|
}).finally(() => {
|
|
1562
1543
|
try {
|
|
1563
1544
|
hooks.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1566,12 +1547,12 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1566
1547
|
});
|
|
1567
1548
|
}
|
|
1568
1549
|
},
|
|
1569
|
-
(reason) => err
|
|
1550
|
+
(reason) => err(toError(reason))
|
|
1570
1551
|
);
|
|
1571
1552
|
}
|
|
1572
1553
|
function completeRefresh(result, getSubscriptions, options = {}) {
|
|
1573
1554
|
const { previousResult } = options;
|
|
1574
|
-
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals$
|
|
1555
|
+
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals$1(previousResult.value, result.value)) {
|
|
1575
1556
|
const subscriptions = getSubscriptions();
|
|
1576
1557
|
const callbacks = options.skipRemovedSubscriptions ? [...subscriptions] : subscriptions;
|
|
1577
1558
|
callbacks.forEach((callback) => {
|
|
@@ -1582,7 +1563,7 @@ function completeRefresh(result, getSubscriptions, options = {}) {
|
|
|
1582
1563
|
}
|
|
1583
1564
|
});
|
|
1584
1565
|
}
|
|
1585
|
-
return options.reportFailure && result.isErr() ? result : ok
|
|
1566
|
+
return options.reportFailure && result.isErr() ? result : ok(void 0);
|
|
1586
1567
|
}
|
|
1587
1568
|
function isAbortableCommand(command) {
|
|
1588
1569
|
return !!command && typeof command === "object" && "isAbortableCommand" in command && command.isAbortableCommand === true;
|
|
@@ -1692,8 +1673,8 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1692
1673
|
}
|
|
1693
1674
|
refresh() {
|
|
1694
1675
|
return this.execute().then((newResult) => {
|
|
1695
|
-
if (!isSubscribableResult(newResult)) return ok
|
|
1696
|
-
const result = newResult.isOk() ? ok
|
|
1676
|
+
if (!isSubscribableResult(newResult)) return ok(void 0);
|
|
1677
|
+
const result = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
1697
1678
|
return completeRefresh(result, () => this.subscriptions);
|
|
1698
1679
|
});
|
|
1699
1680
|
}
|
|
@@ -1728,21 +1709,21 @@ class StreamingCommand extends BaseCommand {
|
|
|
1728
1709
|
try {
|
|
1729
1710
|
return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
|
|
1730
1711
|
} catch (reason) {
|
|
1731
|
-
return resolvedPromiseLike
|
|
1712
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1732
1713
|
}
|
|
1733
1714
|
}
|
|
1734
1715
|
convertFetchStreamResponseToData(response) {
|
|
1735
1716
|
return response.then(
|
|
1736
1717
|
(response2) => {
|
|
1737
1718
|
if (response2.ok && response2.body) {
|
|
1738
|
-
return ok
|
|
1719
|
+
return ok(this.decodeByteStream(response2.body));
|
|
1739
1720
|
} else {
|
|
1740
|
-
return err
|
|
1721
|
+
return err(
|
|
1741
1722
|
toError(response2.ok ? "Response body not present" : response2.statusText)
|
|
1742
1723
|
);
|
|
1743
1724
|
}
|
|
1744
1725
|
},
|
|
1745
|
-
(reason) => err
|
|
1726
|
+
(reason) => err(toError(reason))
|
|
1746
1727
|
);
|
|
1747
1728
|
}
|
|
1748
1729
|
}
|
|
@@ -2157,12 +2138,7 @@ function buildServiceDescriptor$i(logger) {
|
|
|
2157
2138
|
};
|
|
2158
2139
|
}
|
|
2159
2140
|
|
|
2160
|
-
|
|
2161
|
-
function deepCopy$1(x) {
|
|
2162
|
-
const stringified = stringify$2(x);
|
|
2163
|
-
return stringified ? parse$1(stringified) : void 0;
|
|
2164
|
-
}
|
|
2165
|
-
let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
2141
|
+
class DefaultRecordableCache {
|
|
2166
2142
|
constructor(baseCache) {
|
|
2167
2143
|
this.baseCache = baseCache;
|
|
2168
2144
|
this.keysRead = /* @__PURE__ */ new Set();
|
|
@@ -2181,7 +2157,7 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2181
2157
|
this.missingKeysRead.add(key);
|
|
2182
2158
|
}
|
|
2183
2159
|
if (options?.copy) {
|
|
2184
|
-
return deepCopy
|
|
2160
|
+
return deepCopy(value);
|
|
2185
2161
|
}
|
|
2186
2162
|
return value;
|
|
2187
2163
|
}
|
|
@@ -2207,13 +2183,13 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2207
2183
|
return new DefaultRecordableCache(this);
|
|
2208
2184
|
}
|
|
2209
2185
|
filter(predicate) {
|
|
2210
|
-
return new DefaultFilteredCache
|
|
2186
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2211
2187
|
}
|
|
2212
2188
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2213
|
-
return new FixedTimeWritableCache
|
|
2189
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2214
2190
|
}
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2191
|
+
}
|
|
2192
|
+
class DefaultFilteredCache {
|
|
2217
2193
|
constructor(baseCache, predicate) {
|
|
2218
2194
|
this.baseCache = baseCache;
|
|
2219
2195
|
this.predicate = predicate;
|
|
@@ -2225,7 +2201,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2225
2201
|
const result = this.baseCache.get(key);
|
|
2226
2202
|
if (result && this.predicate(key, result)) {
|
|
2227
2203
|
if (options?.copy) {
|
|
2228
|
-
return deepCopy
|
|
2204
|
+
return deepCopy(result);
|
|
2229
2205
|
}
|
|
2230
2206
|
return result;
|
|
2231
2207
|
}
|
|
@@ -2247,7 +2223,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2247
2223
|
return this.getFilteredEntries();
|
|
2248
2224
|
}
|
|
2249
2225
|
record() {
|
|
2250
|
-
return new DefaultRecordableCache
|
|
2226
|
+
return new DefaultRecordableCache(this);
|
|
2251
2227
|
}
|
|
2252
2228
|
filter(predicate) {
|
|
2253
2229
|
return new DefaultFilteredCache(this, predicate);
|
|
@@ -2267,10 +2243,10 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2267
2243
|
return filteredKeySet;
|
|
2268
2244
|
}
|
|
2269
2245
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2270
|
-
return new FixedTimeWritableCache
|
|
2246
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2271
2247
|
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2248
|
+
}
|
|
2249
|
+
class FixedTimeWritableCache {
|
|
2274
2250
|
constructor(baseCache, generatedTime) {
|
|
2275
2251
|
this.baseCache = baseCache;
|
|
2276
2252
|
this.generatedTime = generatedTime;
|
|
@@ -2306,22 +2282,22 @@ let FixedTimeWritableCache$1 = class FixedTimeWritableCache {
|
|
|
2306
2282
|
return this.baseCache.entries();
|
|
2307
2283
|
}
|
|
2308
2284
|
record() {
|
|
2309
|
-
return new DefaultRecordableCache
|
|
2285
|
+
return new DefaultRecordableCache(this);
|
|
2310
2286
|
}
|
|
2311
2287
|
filter(predicate) {
|
|
2312
|
-
return new DefaultFilteredCache
|
|
2288
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2313
2289
|
}
|
|
2314
2290
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2315
2291
|
return new FixedTimeWritableCache(this, generatedTime);
|
|
2316
2292
|
}
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2293
|
+
}
|
|
2294
|
+
class DefaultCache {
|
|
2319
2295
|
constructor() {
|
|
2320
2296
|
this.data = {};
|
|
2321
2297
|
}
|
|
2322
2298
|
get(key, options) {
|
|
2323
2299
|
if (options?.copy) {
|
|
2324
|
-
return deepCopy
|
|
2300
|
+
return deepCopy(this.data[key]);
|
|
2325
2301
|
}
|
|
2326
2302
|
return this.data[key];
|
|
2327
2303
|
}
|
|
@@ -2383,20 +2359,20 @@ let DefaultCache$1 = class DefaultCache {
|
|
|
2383
2359
|
return Object.entries(this.data);
|
|
2384
2360
|
}
|
|
2385
2361
|
record() {
|
|
2386
|
-
return new DefaultRecordableCache
|
|
2362
|
+
return new DefaultRecordableCache(this);
|
|
2387
2363
|
}
|
|
2388
2364
|
filter(predicate) {
|
|
2389
|
-
return new DefaultFilteredCache
|
|
2365
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2390
2366
|
}
|
|
2391
2367
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2392
|
-
return new FixedTimeWritableCache
|
|
2368
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2393
2369
|
}
|
|
2394
|
-
}
|
|
2370
|
+
}
|
|
2395
2371
|
function buildServiceDescriptor$h() {
|
|
2396
2372
|
return {
|
|
2397
2373
|
type: "cache",
|
|
2398
2374
|
version: "1.0",
|
|
2399
|
-
service: new DefaultCache
|
|
2375
|
+
service: new DefaultCache()
|
|
2400
2376
|
};
|
|
2401
2377
|
}
|
|
2402
2378
|
|
|
@@ -2424,7 +2400,7 @@ class NoCacheCacheControlStrategy extends CacheControlStrategy {
|
|
|
2424
2400
|
const tempCache = this.filteredCache;
|
|
2425
2401
|
return new Promise(async (resolve, reject) => {
|
|
2426
2402
|
try {
|
|
2427
|
-
let readResult = ok
|
|
2403
|
+
let readResult = ok(void 0);
|
|
2428
2404
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2429
2405
|
if (rfnResult) {
|
|
2430
2406
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2462,13 +2438,13 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2462
2438
|
startTime,
|
|
2463
2439
|
options?.instrumentationAttributes
|
|
2464
2440
|
);
|
|
2465
|
-
return ok
|
|
2441
|
+
return ok(void 0);
|
|
2466
2442
|
}
|
|
2467
2443
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2468
2444
|
const tempCache = this.filteredCache;
|
|
2469
2445
|
return new Promise(async (resolve, reject) => {
|
|
2470
2446
|
try {
|
|
2471
|
-
let readResult = ok
|
|
2447
|
+
let readResult = ok(void 0);
|
|
2472
2448
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2473
2449
|
if (rfnResult) {
|
|
2474
2450
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2476,7 +2452,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2476
2452
|
writeToL1: (l1) => this.requestRunner.writeToCache(l1, rfnResult)
|
|
2477
2453
|
});
|
|
2478
2454
|
if (result.isErr()) {
|
|
2479
|
-
return resolve(err
|
|
2455
|
+
return resolve(err(result.error));
|
|
2480
2456
|
}
|
|
2481
2457
|
}
|
|
2482
2458
|
readResult = await this.services.cacheInclusionPolicy.read({
|
|
@@ -2484,7 +2460,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2484
2460
|
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2485
2461
|
});
|
|
2486
2462
|
if (readResult.isOk()) {
|
|
2487
|
-
resolve(ok
|
|
2463
|
+
resolve(ok(void 0));
|
|
2488
2464
|
}
|
|
2489
2465
|
}
|
|
2490
2466
|
return resolve(readResult);
|
|
@@ -2536,7 +2512,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2536
2512
|
startTime,
|
|
2537
2513
|
options?.instrumentationAttributes
|
|
2538
2514
|
);
|
|
2539
|
-
return ok
|
|
2515
|
+
return ok(void 0);
|
|
2540
2516
|
}
|
|
2541
2517
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2542
2518
|
const error = new UserVisibleError(
|
|
@@ -2544,7 +2520,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2544
2520
|
error: "Cache miss for only-if-cached request"
|
|
2545
2521
|
})
|
|
2546
2522
|
);
|
|
2547
|
-
return err
|
|
2523
|
+
return err(error);
|
|
2548
2524
|
});
|
|
2549
2525
|
}
|
|
2550
2526
|
get expiredChecks() {
|
|
@@ -2649,14 +2625,14 @@ class DefaultPubSubService {
|
|
|
2649
2625
|
return;
|
|
2650
2626
|
}
|
|
2651
2627
|
const returnVal = subscription.callback.call(subscription, event);
|
|
2652
|
-
if (isPromiseLike
|
|
2628
|
+
if (isPromiseLike(returnVal)) {
|
|
2653
2629
|
promises.push(returnVal);
|
|
2654
2630
|
}
|
|
2655
2631
|
});
|
|
2656
2632
|
if (promises.length > 0) {
|
|
2657
2633
|
return Promise.all(promises).then(() => void 0);
|
|
2658
2634
|
}
|
|
2659
|
-
return resolvedPromiseLike
|
|
2635
|
+
return resolvedPromiseLike(void 0);
|
|
2660
2636
|
}
|
|
2661
2637
|
getSubscriptions(event) {
|
|
2662
2638
|
const eventTypeSubscriptions = this.subscriptions.get(event.type);
|
|
@@ -2785,7 +2761,7 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2785
2761
|
},
|
|
2786
2762
|
};
|
|
2787
2763
|
}
|
|
2788
|
-
// version: 1.
|
|
2764
|
+
// version: 1.471.0-2898c91740
|
|
2789
2765
|
|
|
2790
2766
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2791
2767
|
constructor(config, documentRootType, services) {
|
|
@@ -2824,15 +2800,15 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2824
2800
|
}
|
|
2825
2801
|
processAuraReturnValue(auraReturnValue) {
|
|
2826
2802
|
if (this.responseHasErrors(auraReturnValue)) {
|
|
2827
|
-
return err
|
|
2803
|
+
return err(new UserVisibleError(auraReturnValue));
|
|
2828
2804
|
}
|
|
2829
|
-
return ok
|
|
2805
|
+
return ok(auraReturnValue);
|
|
2830
2806
|
}
|
|
2831
2807
|
processFetchReturnValue(json) {
|
|
2832
2808
|
if (this.responseHasErrors(json)) {
|
|
2833
|
-
return err
|
|
2809
|
+
return err(new UserVisibleError(json));
|
|
2834
2810
|
}
|
|
2835
|
-
return ok
|
|
2811
|
+
return ok(json);
|
|
2836
2812
|
}
|
|
2837
2813
|
/**
|
|
2838
2814
|
* Optional body wrapper name for aura requests.
|
|
@@ -2893,14 +2869,14 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2893
2869
|
),
|
|
2894
2870
|
(errs) => this.coerceAuraErrors(errs)
|
|
2895
2871
|
).then((result) => {
|
|
2896
|
-
return buildSubscribableResult
|
|
2872
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
2897
2873
|
});
|
|
2898
2874
|
} else if (this.shouldUseFetch()) {
|
|
2899
2875
|
const params = this.withRequestOptions(this.originalFetchParams);
|
|
2900
2876
|
try {
|
|
2901
2877
|
return this.convertFetchResponseToData(this.services.fetch(...params)).then(
|
|
2902
2878
|
(result) => {
|
|
2903
|
-
return buildSubscribableResult
|
|
2879
|
+
return buildSubscribableResult(
|
|
2904
2880
|
result,
|
|
2905
2881
|
this.buildSubscribe(),
|
|
2906
2882
|
() => this.refresh()
|
|
@@ -2908,18 +2884,18 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2908
2884
|
}
|
|
2909
2885
|
);
|
|
2910
2886
|
} catch (reason) {
|
|
2911
|
-
return resolvedPromiseLike
|
|
2912
|
-
buildSubscribableResult
|
|
2913
|
-
err
|
|
2887
|
+
return resolvedPromiseLike(
|
|
2888
|
+
buildSubscribableResult(
|
|
2889
|
+
err(toError(reason)),
|
|
2914
2890
|
this.buildSubscribe(),
|
|
2915
2891
|
() => this.refresh()
|
|
2916
2892
|
)
|
|
2917
2893
|
);
|
|
2918
2894
|
}
|
|
2919
2895
|
}
|
|
2920
|
-
return resolvedPromiseLike
|
|
2921
|
-
buildSubscribableResult
|
|
2922
|
-
err
|
|
2896
|
+
return resolvedPromiseLike(
|
|
2897
|
+
buildSubscribableResult(
|
|
2898
|
+
err(toError("Aura/Fetch network services not found")),
|
|
2923
2899
|
this.buildSubscribe(),
|
|
2924
2900
|
() => this.refresh()
|
|
2925
2901
|
)
|
|
@@ -3045,15 +3021,15 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3045
3021
|
}
|
|
3046
3022
|
processFetchReturnValue(json) {
|
|
3047
3023
|
if (json.errors && json.errors.length > 0) {
|
|
3048
|
-
return err
|
|
3024
|
+
return err(new UserVisibleError(json));
|
|
3049
3025
|
}
|
|
3050
|
-
return ok
|
|
3026
|
+
return ok(json);
|
|
3051
3027
|
}
|
|
3052
3028
|
runOriginalRequest() {
|
|
3053
3029
|
return this.convertFetchResponseToData(
|
|
3054
3030
|
this.services.fetch(...this.withRequestOptions(this.originalFetchParams))
|
|
3055
3031
|
).then((result) => {
|
|
3056
|
-
return buildSubscribableResult
|
|
3032
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
3057
3033
|
});
|
|
3058
3034
|
}
|
|
3059
3035
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -3124,7 +3100,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3124
3100
|
},
|
|
3125
3101
|
};
|
|
3126
3102
|
}
|
|
3127
|
-
// version: 1.
|
|
3103
|
+
// version: 1.471.0-2898c91740
|
|
3128
3104
|
|
|
3129
3105
|
class RetryService {
|
|
3130
3106
|
constructor(defaultRetryPolicy) {
|
|
@@ -3583,7 +3559,7 @@ class LegacyImperativeBindingsService {
|
|
|
3583
3559
|
return { invoke, subscribe };
|
|
3584
3560
|
}
|
|
3585
3561
|
}
|
|
3586
|
-
function buildServiceDescriptor$3
|
|
3562
|
+
function buildServiceDescriptor$3() {
|
|
3587
3563
|
return {
|
|
3588
3564
|
type: "legacyImperativeBindings",
|
|
3589
3565
|
version: "1.0",
|
|
@@ -3783,7 +3759,7 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
3783
3759
|
return { invoke, subscribe };
|
|
3784
3760
|
}
|
|
3785
3761
|
}
|
|
3786
|
-
function buildServiceDescriptor$1$
|
|
3762
|
+
function buildServiceDescriptor$1$1() {
|
|
3787
3763
|
return {
|
|
3788
3764
|
type: "graphQLLegacyImperativeBindings",
|
|
3789
3765
|
version: "1.0",
|
|
@@ -4002,7 +3978,7 @@ class CommandWireAdapterConstructor {
|
|
|
4002
3978
|
this.emit(updatedResult);
|
|
4003
3979
|
});
|
|
4004
3980
|
this.refresh = value.refresh;
|
|
4005
|
-
this.emit(ok
|
|
3981
|
+
this.emit(ok(value.data));
|
|
4006
3982
|
} else {
|
|
4007
3983
|
this.emit(result);
|
|
4008
3984
|
}
|
|
@@ -4076,7 +4052,7 @@ class LWCWireBindingsService {
|
|
|
4076
4052
|
};
|
|
4077
4053
|
}
|
|
4078
4054
|
}
|
|
4079
|
-
function buildServiceDescriptor$1
|
|
4055
|
+
function buildServiceDescriptor$1() {
|
|
4080
4056
|
return {
|
|
4081
4057
|
type: "lwcWireBindings",
|
|
4082
4058
|
version: "1.0",
|
|
@@ -4182,7 +4158,7 @@ class LWCGraphQLWireBindingsService {
|
|
|
4182
4158
|
};
|
|
4183
4159
|
}
|
|
4184
4160
|
}
|
|
4185
|
-
function buildServiceDescriptor$
|
|
4161
|
+
function buildServiceDescriptor$2() {
|
|
4186
4162
|
return {
|
|
4187
4163
|
type: "lwcGraphQLWireBindings",
|
|
4188
4164
|
version: "1.0",
|
|
@@ -4200,7 +4176,7 @@ function createLockerCompatibleWireConstructor(DelegateCtor) {
|
|
|
4200
4176
|
return Constructor;
|
|
4201
4177
|
}
|
|
4202
4178
|
function buildLWCWireBindingsServiceDescriptor() {
|
|
4203
|
-
const base = buildServiceDescriptor$1
|
|
4179
|
+
const base = buildServiceDescriptor$1();
|
|
4204
4180
|
const originalBind = base.service.bind.bind(base.service);
|
|
4205
4181
|
const bind = (...args) => {
|
|
4206
4182
|
const ctor = originalBind(...args);
|
|
@@ -4215,7 +4191,7 @@ function buildLWCWireBindingsServiceDescriptor() {
|
|
|
4215
4191
|
};
|
|
4216
4192
|
}
|
|
4217
4193
|
function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
4218
|
-
const base = buildServiceDescriptor$
|
|
4194
|
+
const base = buildServiceDescriptor$2();
|
|
4219
4195
|
const originalBind = base.service.bind.bind(base.service);
|
|
4220
4196
|
const bind = (...args) => {
|
|
4221
4197
|
const ctor = originalBind(...args);
|
|
@@ -4230,54 +4206,8 @@ function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
|
4230
4206
|
};
|
|
4231
4207
|
}
|
|
4232
4208
|
|
|
4233
|
-
function e(
|
|
4234
|
-
|
|
4235
|
-
}
|
|
4236
|
-
e.prototype = new Error(), e.prototype.name = "InvalidCharacterError";
|
|
4237
|
-
var r = "undefined" != typeof window && window.atob && window.atob.bind(window) || function(r2) {
|
|
4238
|
-
var t2 = String(r2).replace(/=+$/, "");
|
|
4239
|
-
if (t2.length % 4 == 1) throw new e("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
4240
|
-
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);
|
|
4241
|
-
return c;
|
|
4242
|
-
};
|
|
4243
|
-
function t(e2) {
|
|
4244
|
-
var t2 = e2.replace(/-/g, "+").replace(/_/g, "/");
|
|
4245
|
-
switch (t2.length % 4) {
|
|
4246
|
-
case 0:
|
|
4247
|
-
break;
|
|
4248
|
-
case 2:
|
|
4249
|
-
t2 += "==";
|
|
4250
|
-
break;
|
|
4251
|
-
case 3:
|
|
4252
|
-
t2 += "=";
|
|
4253
|
-
break;
|
|
4254
|
-
default:
|
|
4255
|
-
throw "Illegal base64url string!";
|
|
4256
|
-
}
|
|
4257
|
-
try {
|
|
4258
|
-
return (function(e3) {
|
|
4259
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
4260
|
-
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
4261
|
-
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
4262
|
-
})));
|
|
4263
|
-
})(t2);
|
|
4264
|
-
} catch (e3) {
|
|
4265
|
-
return r(t2);
|
|
4266
|
-
}
|
|
4267
|
-
}
|
|
4268
|
-
function n(e2) {
|
|
4269
|
-
this.message = e2;
|
|
4270
|
-
}
|
|
4271
|
-
function o(e2, r2) {
|
|
4272
|
-
if ("string" != typeof e2) throw new n("Invalid token specified");
|
|
4273
|
-
var o2 = true === (r2 = r2 || {}).header ? 0 : 1;
|
|
4274
|
-
try {
|
|
4275
|
-
return JSON.parse(t(e2.split(".")[o2]));
|
|
4276
|
-
} catch (e3) {
|
|
4277
|
-
throw new n("Invalid token specified: " + e3.message);
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
n.prototype = new Error(), n.prototype.name = "InvalidTokenError";
|
|
4209
|
+
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";
|
|
4210
|
+
|
|
4281
4211
|
class JwtToken {
|
|
4282
4212
|
/**
|
|
4283
4213
|
* Create a new JwtToken.
|
|
@@ -4521,8 +4451,8 @@ class JwtRepository {
|
|
|
4521
4451
|
this.observers.forEach((cb) => {
|
|
4522
4452
|
try {
|
|
4523
4453
|
cb.call(void 0, token);
|
|
4524
|
-
} catch (
|
|
4525
|
-
this.logger.error(
|
|
4454
|
+
} catch (e) {
|
|
4455
|
+
this.logger.error(e.message);
|
|
4526
4456
|
}
|
|
4527
4457
|
});
|
|
4528
4458
|
}
|
|
@@ -4603,163 +4533,6 @@ class JwtManager {
|
|
|
4603
4533
|
}
|
|
4604
4534
|
}
|
|
4605
4535
|
|
|
4606
|
-
function buildServiceDescriptor$2(interceptors = {
|
|
4607
|
-
request: [],
|
|
4608
|
-
retry: void 0,
|
|
4609
|
-
response: [],
|
|
4610
|
-
finally: []
|
|
4611
|
-
}, retryService) {
|
|
4612
|
-
return {
|
|
4613
|
-
type: "fetch",
|
|
4614
|
-
version: "1.0",
|
|
4615
|
-
service: function(input, init) {
|
|
4616
|
-
let contextSeed;
|
|
4617
|
-
let cleanInit = init;
|
|
4618
|
-
if (init !== void 0 && "__contextSeed" in init) {
|
|
4619
|
-
const { __contextSeed, ...initWithoutSeed } = init;
|
|
4620
|
-
contextSeed = __contextSeed;
|
|
4621
|
-
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
4622
|
-
}
|
|
4623
|
-
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
4624
|
-
const baseContext = interceptors.createContext?.();
|
|
4625
|
-
const onestore = cleanInit?.onestore;
|
|
4626
|
-
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
4627
|
-
...baseContext,
|
|
4628
|
-
...contextSeed,
|
|
4629
|
-
...onestore !== void 0 && { onestore }
|
|
4630
|
-
};
|
|
4631
|
-
const {
|
|
4632
|
-
request: requestInterceptors = [],
|
|
4633
|
-
retry: retryInterceptor = void 0,
|
|
4634
|
-
response: responseInterceptors = [],
|
|
4635
|
-
finally: finallyInterceptors = []
|
|
4636
|
-
} = interceptors;
|
|
4637
|
-
const pending = requestInterceptors.reduce(
|
|
4638
|
-
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
4639
|
-
resolvedPromiseLike$2(fetchArgs)
|
|
4640
|
-
);
|
|
4641
|
-
return Promise.resolve(pending).then((args) => {
|
|
4642
|
-
if (retryInterceptor) {
|
|
4643
|
-
return retryInterceptor(args, retryService, context);
|
|
4644
|
-
} else {
|
|
4645
|
-
if (retryService) {
|
|
4646
|
-
return retryService.applyRetry(() => fetch(...args));
|
|
4647
|
-
}
|
|
4648
|
-
return fetch(...args);
|
|
4649
|
-
}
|
|
4650
|
-
}).then((response) => {
|
|
4651
|
-
return responseInterceptors.reduce(
|
|
4652
|
-
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
4653
|
-
resolvedPromiseLike$2(response)
|
|
4654
|
-
);
|
|
4655
|
-
}).finally(() => {
|
|
4656
|
-
if (finallyInterceptors.length > 0) {
|
|
4657
|
-
return finallyInterceptors.reduce(
|
|
4658
|
-
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
4659
|
-
Promise.resolve()
|
|
4660
|
-
);
|
|
4661
|
-
}
|
|
4662
|
-
});
|
|
4663
|
-
}
|
|
4664
|
-
};
|
|
4665
|
-
}
|
|
4666
|
-
let textEncoder;
|
|
4667
|
-
function getTextEncoder() {
|
|
4668
|
-
if (!textEncoder) {
|
|
4669
|
-
if (typeof TextEncoder === "undefined") {
|
|
4670
|
-
throw new Error(
|
|
4671
|
-
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
4672
|
-
);
|
|
4673
|
-
}
|
|
4674
|
-
textEncoder = new TextEncoder();
|
|
4675
|
-
}
|
|
4676
|
-
return textEncoder;
|
|
4677
|
-
}
|
|
4678
|
-
function buildCompressionInterceptor(defaultConfig) {
|
|
4679
|
-
return async (args) => {
|
|
4680
|
-
const [resource, options = {}] = args;
|
|
4681
|
-
const config = options.onestore?.compression ?? defaultConfig;
|
|
4682
|
-
if (config === void 0) {
|
|
4683
|
-
return resolvedPromiseLike$2(args);
|
|
4684
|
-
}
|
|
4685
|
-
const threshold = config.threshold ?? 1024;
|
|
4686
|
-
if (!options.body || typeof options.body !== "string") {
|
|
4687
|
-
return resolvedPromiseLike$2(args);
|
|
4688
|
-
}
|
|
4689
|
-
if (typeof CompressionStream === "undefined") {
|
|
4690
|
-
return resolvedPromiseLike$2(args);
|
|
4691
|
-
}
|
|
4692
|
-
const headers = new Headers(options.headers);
|
|
4693
|
-
if (headers.has("Content-Encoding")) {
|
|
4694
|
-
return resolvedPromiseLike$2(args);
|
|
4695
|
-
}
|
|
4696
|
-
const encodedBody = getTextEncoder().encode(options.body);
|
|
4697
|
-
if (encodedBody.byteLength < threshold) {
|
|
4698
|
-
return resolvedPromiseLike$2(args);
|
|
4699
|
-
}
|
|
4700
|
-
try {
|
|
4701
|
-
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
4702
|
-
const compressedBody = await new Response(stream).blob();
|
|
4703
|
-
headers.set("Content-Encoding", config.algorithm);
|
|
4704
|
-
headers.delete("Content-Length");
|
|
4705
|
-
const compressedOptions = {
|
|
4706
|
-
...options,
|
|
4707
|
-
body: compressedBody,
|
|
4708
|
-
headers
|
|
4709
|
-
};
|
|
4710
|
-
return resolvedPromiseLike$2([resource, compressedOptions]);
|
|
4711
|
-
} catch {
|
|
4712
|
-
return resolvedPromiseLike$2(args);
|
|
4713
|
-
}
|
|
4714
|
-
};
|
|
4715
|
-
}
|
|
4716
|
-
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
4717
|
-
throwOnExisting = false,
|
|
4718
|
-
errorMessage = `Unexpected ${headerName} header encountered`
|
|
4719
|
-
} = {}) {
|
|
4720
|
-
let hasHeaderBeenSet = false;
|
|
4721
|
-
if (resource instanceof Request && !options?.headers) {
|
|
4722
|
-
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
4723
|
-
throw new Error(errorMessage);
|
|
4724
|
-
}
|
|
4725
|
-
resource.headers.set(headerName, headerValue);
|
|
4726
|
-
hasHeaderBeenSet = true;
|
|
4727
|
-
}
|
|
4728
|
-
if (options?.headers instanceof Headers) {
|
|
4729
|
-
if (throwOnExisting && options.headers.has(headerName)) {
|
|
4730
|
-
throw new Error(errorMessage);
|
|
4731
|
-
}
|
|
4732
|
-
options.headers.set(headerName, headerValue);
|
|
4733
|
-
} else {
|
|
4734
|
-
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
4735
|
-
throw new Error(errorMessage);
|
|
4736
|
-
}
|
|
4737
|
-
if (!hasHeaderBeenSet) {
|
|
4738
|
-
options.headers = {
|
|
4739
|
-
...options?.headers,
|
|
4740
|
-
[headerName]: headerValue
|
|
4741
|
-
};
|
|
4742
|
-
}
|
|
4743
|
-
}
|
|
4744
|
-
return [resource, options];
|
|
4745
|
-
}
|
|
4746
|
-
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";
|
|
4747
|
-
function setHeaderAuthorization({ token }, fetchParams) {
|
|
4748
|
-
const authorizationValue = `Bearer ${token}`;
|
|
4749
|
-
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
4750
|
-
throwOnExisting: true,
|
|
4751
|
-
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
4752
|
-
});
|
|
4753
|
-
}
|
|
4754
|
-
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
4755
|
-
return (args) => {
|
|
4756
|
-
return resolvedPromiseLike$2(jwtManager.getJwt()).then((token) => {
|
|
4757
|
-
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
4758
|
-
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
4759
|
-
});
|
|
4760
|
-
};
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
4536
|
var SnapshotState;
|
|
4764
4537
|
(function (SnapshotState) {
|
|
4765
4538
|
SnapshotState["Fulfilled"] = "Fulfilled";
|
|
@@ -4973,315 +4746,6 @@ function generateHeaders(headers) {
|
|
|
4973
4746
|
|
|
4974
4747
|
class CacheInclusionPolicyService {
|
|
4975
4748
|
}
|
|
4976
|
-
class Ok {
|
|
4977
|
-
constructor(value) {
|
|
4978
|
-
this.value = value;
|
|
4979
|
-
}
|
|
4980
|
-
isOk() {
|
|
4981
|
-
return true;
|
|
4982
|
-
}
|
|
4983
|
-
isErr() {
|
|
4984
|
-
return !this.isOk();
|
|
4985
|
-
}
|
|
4986
|
-
}
|
|
4987
|
-
const ok = (value) => new Ok(value);
|
|
4988
|
-
function setDifference(setA, setB) {
|
|
4989
|
-
const differenceSet = /* @__PURE__ */ new Set();
|
|
4990
|
-
for (const element of setA) {
|
|
4991
|
-
if (!setB.has(element)) {
|
|
4992
|
-
differenceSet.add(element);
|
|
4993
|
-
}
|
|
4994
|
-
}
|
|
4995
|
-
return differenceSet;
|
|
4996
|
-
}
|
|
4997
|
-
function addAllToSet(targetSet, sourceSet) {
|
|
4998
|
-
for (const element of sourceSet) {
|
|
4999
|
-
targetSet.add(element);
|
|
5000
|
-
}
|
|
5001
|
-
}
|
|
5002
|
-
function resolvedPromiseLike(result) {
|
|
5003
|
-
if (isPromiseLike(result)) {
|
|
5004
|
-
return result.then(
|
|
5005
|
-
(nextResult) => nextResult
|
|
5006
|
-
);
|
|
5007
|
-
}
|
|
5008
|
-
return {
|
|
5009
|
-
then: (onFulfilled, _onRejected) => {
|
|
5010
|
-
try {
|
|
5011
|
-
return resolvedPromiseLike(onFulfilled(result));
|
|
5012
|
-
} catch (e) {
|
|
5013
|
-
if (onFulfilled === void 0) {
|
|
5014
|
-
return resolvedPromiseLike(result);
|
|
5015
|
-
}
|
|
5016
|
-
return rejectedPromiseLike(e);
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
};
|
|
5020
|
-
}
|
|
5021
|
-
function rejectedPromiseLike(reason) {
|
|
5022
|
-
if (isPromiseLike(reason)) {
|
|
5023
|
-
return reason.then(
|
|
5024
|
-
(nextResult) => nextResult
|
|
5025
|
-
);
|
|
5026
|
-
}
|
|
5027
|
-
return {
|
|
5028
|
-
then: (_onFulfilled, onRejected) => {
|
|
5029
|
-
if (typeof onRejected === "function") {
|
|
5030
|
-
try {
|
|
5031
|
-
return resolvedPromiseLike(onRejected(reason));
|
|
5032
|
-
} catch (e) {
|
|
5033
|
-
return rejectedPromiseLike(e);
|
|
5034
|
-
}
|
|
5035
|
-
}
|
|
5036
|
-
return rejectedPromiseLike(reason);
|
|
5037
|
-
}
|
|
5038
|
-
};
|
|
5039
|
-
}
|
|
5040
|
-
function isPromiseLike(x) {
|
|
5041
|
-
return typeof x?.then === "function";
|
|
5042
|
-
}
|
|
5043
|
-
const { stringify: stringify$1, parse } = JSON;
|
|
5044
|
-
function deepCopy(x) {
|
|
5045
|
-
const stringified = stringify$1(x);
|
|
5046
|
-
return stringified ? parse(stringified) : void 0;
|
|
5047
|
-
}
|
|
5048
|
-
class DefaultRecordableCache {
|
|
5049
|
-
constructor(baseCache) {
|
|
5050
|
-
this.baseCache = baseCache;
|
|
5051
|
-
this.keysRead = /* @__PURE__ */ new Set();
|
|
5052
|
-
this.missingKeysRead = /* @__PURE__ */ new Set();
|
|
5053
|
-
this.keysUpdated = /* @__PURE__ */ new Set();
|
|
5054
|
-
this.metadataKeysUpdated = /* @__PURE__ */ new Set();
|
|
5055
|
-
}
|
|
5056
|
-
delete(key) {
|
|
5057
|
-
this.keysUpdated.add(key);
|
|
5058
|
-
this.baseCache.delete(key);
|
|
5059
|
-
}
|
|
5060
|
-
get(key, options) {
|
|
5061
|
-
this.keysRead.add(key);
|
|
5062
|
-
const value = this.baseCache.get(key);
|
|
5063
|
-
if (value === void 0) {
|
|
5064
|
-
this.missingKeysRead.add(key);
|
|
5065
|
-
}
|
|
5066
|
-
if (options?.copy) {
|
|
5067
|
-
return deepCopy(value);
|
|
5068
|
-
}
|
|
5069
|
-
return value;
|
|
5070
|
-
}
|
|
5071
|
-
set(key, value) {
|
|
5072
|
-
this.keysUpdated.add(key);
|
|
5073
|
-
this.metadataKeysUpdated.add(key);
|
|
5074
|
-
this.baseCache.set(key, value);
|
|
5075
|
-
}
|
|
5076
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5077
|
-
this.metadataKeysUpdated.add(key);
|
|
5078
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5079
|
-
}
|
|
5080
|
-
length() {
|
|
5081
|
-
return this.baseCache.length();
|
|
5082
|
-
}
|
|
5083
|
-
keys() {
|
|
5084
|
-
return this.baseCache.keys();
|
|
5085
|
-
}
|
|
5086
|
-
entries() {
|
|
5087
|
-
return this.baseCache.entries();
|
|
5088
|
-
}
|
|
5089
|
-
record() {
|
|
5090
|
-
return new DefaultRecordableCache(this);
|
|
5091
|
-
}
|
|
5092
|
-
filter(predicate) {
|
|
5093
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5094
|
-
}
|
|
5095
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5096
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
class DefaultFilteredCache {
|
|
5100
|
-
constructor(baseCache, predicate) {
|
|
5101
|
-
this.baseCache = baseCache;
|
|
5102
|
-
this.predicate = predicate;
|
|
5103
|
-
}
|
|
5104
|
-
delete(key) {
|
|
5105
|
-
this.baseCache.delete(key);
|
|
5106
|
-
}
|
|
5107
|
-
get(key, options) {
|
|
5108
|
-
const result = this.baseCache.get(key);
|
|
5109
|
-
if (result && this.predicate(key, result)) {
|
|
5110
|
-
if (options?.copy) {
|
|
5111
|
-
return deepCopy(result);
|
|
5112
|
-
}
|
|
5113
|
-
return result;
|
|
5114
|
-
}
|
|
5115
|
-
return void 0;
|
|
5116
|
-
}
|
|
5117
|
-
set(key, value) {
|
|
5118
|
-
this.baseCache.set(key, value);
|
|
5119
|
-
}
|
|
5120
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5121
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5122
|
-
}
|
|
5123
|
-
length() {
|
|
5124
|
-
return this.getFilteredKeys().size;
|
|
5125
|
-
}
|
|
5126
|
-
keys() {
|
|
5127
|
-
return this.getFilteredKeys();
|
|
5128
|
-
}
|
|
5129
|
-
entries() {
|
|
5130
|
-
return this.getFilteredEntries();
|
|
5131
|
-
}
|
|
5132
|
-
record() {
|
|
5133
|
-
return new DefaultRecordableCache(this);
|
|
5134
|
-
}
|
|
5135
|
-
filter(predicate) {
|
|
5136
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5137
|
-
}
|
|
5138
|
-
getFilteredEntries() {
|
|
5139
|
-
return this.baseCache.entries().filter(([key, _value]) => {
|
|
5140
|
-
return this.get(key);
|
|
5141
|
-
});
|
|
5142
|
-
}
|
|
5143
|
-
getFilteredKeys() {
|
|
5144
|
-
const filteredKeySet = /* @__PURE__ */ new Set();
|
|
5145
|
-
this.baseCache.keys().forEach((key) => {
|
|
5146
|
-
if (this.get(key)) {
|
|
5147
|
-
filteredKeySet.add(key);
|
|
5148
|
-
}
|
|
5149
|
-
});
|
|
5150
|
-
return filteredKeySet;
|
|
5151
|
-
}
|
|
5152
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5153
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5154
|
-
}
|
|
5155
|
-
}
|
|
5156
|
-
class FixedTimeWritableCache {
|
|
5157
|
-
constructor(baseCache, generatedTime) {
|
|
5158
|
-
this.baseCache = baseCache;
|
|
5159
|
-
this.generatedTime = generatedTime;
|
|
5160
|
-
}
|
|
5161
|
-
delete(key) {
|
|
5162
|
-
this.baseCache.delete(key);
|
|
5163
|
-
}
|
|
5164
|
-
get(key, options) {
|
|
5165
|
-
return this.baseCache.get(key, options);
|
|
5166
|
-
}
|
|
5167
|
-
set(key, value) {
|
|
5168
|
-
this.baseCache.set(key, {
|
|
5169
|
-
...value,
|
|
5170
|
-
metadata: {
|
|
5171
|
-
...value.metadata,
|
|
5172
|
-
cacheControl: { ...value.metadata.cacheControl, generatedTime: this.generatedTime }
|
|
5173
|
-
}
|
|
5174
|
-
});
|
|
5175
|
-
}
|
|
5176
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5177
|
-
this.baseCache.setMetadata(key, {
|
|
5178
|
-
...cacheControlMetadata,
|
|
5179
|
-
generatedTime: this.generatedTime
|
|
5180
|
-
});
|
|
5181
|
-
}
|
|
5182
|
-
length() {
|
|
5183
|
-
return this.baseCache.length();
|
|
5184
|
-
}
|
|
5185
|
-
keys() {
|
|
5186
|
-
return this.baseCache.keys();
|
|
5187
|
-
}
|
|
5188
|
-
entries() {
|
|
5189
|
-
return this.baseCache.entries();
|
|
5190
|
-
}
|
|
5191
|
-
record() {
|
|
5192
|
-
return new DefaultRecordableCache(this);
|
|
5193
|
-
}
|
|
5194
|
-
filter(predicate) {
|
|
5195
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5196
|
-
}
|
|
5197
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5198
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5199
|
-
}
|
|
5200
|
-
}
|
|
5201
|
-
class DefaultCache {
|
|
5202
|
-
constructor() {
|
|
5203
|
-
this.data = {};
|
|
5204
|
-
}
|
|
5205
|
-
get(key, options) {
|
|
5206
|
-
if (options?.copy) {
|
|
5207
|
-
return deepCopy(this.data[key]);
|
|
5208
|
-
}
|
|
5209
|
-
return this.data[key];
|
|
5210
|
-
}
|
|
5211
|
-
/**
|
|
5212
|
-
* Adds the specified key/value to the cache.
|
|
5213
|
-
*
|
|
5214
|
-
* @param key key at which to store value
|
|
5215
|
-
* @param entry value to be stored
|
|
5216
|
-
*/
|
|
5217
|
-
set(key, entry) {
|
|
5218
|
-
if (entry.metadata.cacheControl.type === "no-store") {
|
|
5219
|
-
return;
|
|
5220
|
-
}
|
|
5221
|
-
this.data[key] = {
|
|
5222
|
-
...entry,
|
|
5223
|
-
metadata: {
|
|
5224
|
-
...entry.metadata,
|
|
5225
|
-
type: entry.metadata.type || {
|
|
5226
|
-
namespace: "OneStore:Internal",
|
|
5227
|
-
name: "UnknownType"
|
|
5228
|
-
},
|
|
5229
|
-
cacheControl: {
|
|
5230
|
-
generatedTime: Date.now() / 1e3,
|
|
5231
|
-
...entry.metadata.cacheControl
|
|
5232
|
-
}
|
|
5233
|
-
}
|
|
5234
|
-
};
|
|
5235
|
-
}
|
|
5236
|
-
/**
|
|
5237
|
-
* Removes the cache entry associated with the specified key.
|
|
5238
|
-
*
|
|
5239
|
-
* @param key key to be removed from the store
|
|
5240
|
-
*/
|
|
5241
|
-
delete(key) {
|
|
5242
|
-
delete this.data[key];
|
|
5243
|
-
}
|
|
5244
|
-
/**
|
|
5245
|
-
* Sets the metadata for the specified key if the key is in cache.
|
|
5246
|
-
* If the key doesn't exist, it does nothing.
|
|
5247
|
-
*
|
|
5248
|
-
* @param key key at which to store metadata
|
|
5249
|
-
* @param cacheControlMetadata metadata to be stored
|
|
5250
|
-
*/
|
|
5251
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5252
|
-
if (key in this.data) {
|
|
5253
|
-
this.data[key].metadata.cacheControl = {
|
|
5254
|
-
generatedTime: Date.now() / 1e3,
|
|
5255
|
-
...cacheControlMetadata
|
|
5256
|
-
};
|
|
5257
|
-
}
|
|
5258
|
-
}
|
|
5259
|
-
length() {
|
|
5260
|
-
return this.keys().size;
|
|
5261
|
-
}
|
|
5262
|
-
keys() {
|
|
5263
|
-
return new Set(Object.keys(this.data));
|
|
5264
|
-
}
|
|
5265
|
-
entries() {
|
|
5266
|
-
return Object.entries(this.data);
|
|
5267
|
-
}
|
|
5268
|
-
record() {
|
|
5269
|
-
return new DefaultRecordableCache(this);
|
|
5270
|
-
}
|
|
5271
|
-
filter(predicate) {
|
|
5272
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5273
|
-
}
|
|
5274
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5275
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5276
|
-
}
|
|
5277
|
-
}
|
|
5278
|
-
function buildServiceDescriptor$1() {
|
|
5279
|
-
return {
|
|
5280
|
-
type: "cache",
|
|
5281
|
-
version: "1.0",
|
|
5282
|
-
service: new DefaultCache()
|
|
5283
|
-
};
|
|
5284
|
-
}
|
|
5285
4749
|
class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
5286
4750
|
/**
|
|
5287
4751
|
* Reads data out of a 2 level inclusive store.
|
|
@@ -5313,7 +4777,7 @@ class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
|
5313
4777
|
*/
|
|
5314
4778
|
write(options) {
|
|
5315
4779
|
const { l1, writeToL1 } = options;
|
|
5316
|
-
const tempL1 = buildServiceDescriptor$
|
|
4780
|
+
const tempL1 = buildServiceDescriptor$h().service.record();
|
|
5317
4781
|
return writeToL1(tempL1).then(() => {
|
|
5318
4782
|
const keysToReviveRecordableCache = l1.record();
|
|
5319
4783
|
tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
|
|
@@ -6646,7 +6110,7 @@ function buildActionMarksSendInterceptor() {
|
|
|
6646
6110
|
if (context && context.instrumentationId) {
|
|
6647
6111
|
createActionStartMark(context);
|
|
6648
6112
|
}
|
|
6649
|
-
return resolvedPromiseLike
|
|
6113
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6650
6114
|
};
|
|
6651
6115
|
}
|
|
6652
6116
|
function buildLuvioActionMarksSendInterceptor() {
|
|
@@ -6654,7 +6118,7 @@ function buildLuvioActionMarksSendInterceptor() {
|
|
|
6654
6118
|
if (context && context.instrumentationId) {
|
|
6655
6119
|
createActionStartMark(context);
|
|
6656
6120
|
}
|
|
6657
|
-
return resolvedPromiseLike
|
|
6121
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6658
6122
|
};
|
|
6659
6123
|
}
|
|
6660
6124
|
|
|
@@ -6742,7 +6206,7 @@ function buildCsrfResourceStorage(getPreloadedToken) {
|
|
|
6742
6206
|
// Failures are ignored; memory stays authoritative.
|
|
6743
6207
|
const afterSeed = (write) => seeded.then(write).then(() => { }, () => { });
|
|
6744
6208
|
return {
|
|
6745
|
-
get: () => (loaded ? resolvedPromiseLike
|
|
6209
|
+
get: () => (loaded ? resolvedPromiseLike(currentToken) : seeded.then(() => currentToken)),
|
|
6746
6210
|
set: (value) => {
|
|
6747
6211
|
currentToken = value;
|
|
6748
6212
|
loaded = true;
|
|
@@ -6828,7 +6292,7 @@ function getCsrfToken() {
|
|
|
6828
6292
|
return token.then((value) => value, () => undefined);
|
|
6829
6293
|
}
|
|
6830
6294
|
catch {
|
|
6831
|
-
return resolvedPromiseLike
|
|
6295
|
+
return resolvedPromiseLike(undefined);
|
|
6832
6296
|
}
|
|
6833
6297
|
}
|
|
6834
6298
|
/**
|
|
@@ -6859,7 +6323,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6859
6323
|
return async (fetchArgs) => {
|
|
6860
6324
|
// Check if all required gates are enabled before running
|
|
6861
6325
|
if (!areCsrfGatesEnabled()) {
|
|
6862
|
-
return resolvedPromiseLike
|
|
6326
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6863
6327
|
}
|
|
6864
6328
|
// Only add CSRF token for mutating operations
|
|
6865
6329
|
if (isMutatingMethod(getFetchMethod(fetchArgs))) {
|
|
@@ -6869,7 +6333,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6869
6333
|
fetchArgs = setHeader(CSRF_TOKEN_HEADER, token, fetchArgs);
|
|
6870
6334
|
}
|
|
6871
6335
|
}
|
|
6872
|
-
return resolvedPromiseLike
|
|
6336
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6873
6337
|
};
|
|
6874
6338
|
}
|
|
6875
6339
|
/**
|
|
@@ -6884,7 +6348,7 @@ function buildLuvioCsrfTokenInterceptor() {
|
|
|
6884
6348
|
return (resourceRequest) => {
|
|
6885
6349
|
// Check if all required gates are enabled before running
|
|
6886
6350
|
if (!areCsrfGatesEnabled()) {
|
|
6887
|
-
return resolvedPromiseLike
|
|
6351
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6888
6352
|
}
|
|
6889
6353
|
// Ensure headers object exists
|
|
6890
6354
|
if (!resourceRequest.headers) {
|
|
@@ -6896,7 +6360,7 @@ function buildLuvioCsrfTokenInterceptor() {
|
|
|
6896
6360
|
}
|
|
6897
6361
|
if (!isMutatingMethod(resourceRequest.method) ||
|
|
6898
6362
|
resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6899
|
-
return resolvedPromiseLike
|
|
6363
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6900
6364
|
}
|
|
6901
6365
|
return getCsrfToken().then((token) => {
|
|
6902
6366
|
if (token) {
|
|
@@ -6917,7 +6381,7 @@ const ENTITY_ENCODING_DISABLED_VALUE = 'false';
|
|
|
6917
6381
|
*/
|
|
6918
6382
|
function buildEntityEncodingInterceptor() {
|
|
6919
6383
|
return (fetchArgs) => {
|
|
6920
|
-
return resolvedPromiseLike
|
|
6384
|
+
return resolvedPromiseLike(setHeader(ENTITY_ENCODING_HEADER, ENTITY_ENCODING_DISABLED_VALUE, fetchArgs));
|
|
6921
6385
|
};
|
|
6922
6386
|
}
|
|
6923
6387
|
/**
|
|
@@ -6933,7 +6397,7 @@ function buildLuvioEntityEncodingInterceptor() {
|
|
|
6933
6397
|
if (!resourceRequest.headers[ENTITY_ENCODING_HEADER]) {
|
|
6934
6398
|
resourceRequest.headers[ENTITY_ENCODING_HEADER] = ENTITY_ENCODING_DISABLED_VALUE;
|
|
6935
6399
|
}
|
|
6936
|
-
return resolvedPromiseLike
|
|
6400
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6937
6401
|
};
|
|
6938
6402
|
}
|
|
6939
6403
|
|
|
@@ -6948,7 +6412,7 @@ const FIRST_PARTY_VALUE = 'platform-ui';
|
|
|
6948
6412
|
function buildFirstPartyHeaderInterceptor() {
|
|
6949
6413
|
return async (fetchArgs) => {
|
|
6950
6414
|
const returnedFetchArgs = setHeader(FIRST_PARTY_HEADER, FIRST_PARTY_VALUE, fetchArgs);
|
|
6951
|
-
return resolvedPromiseLike
|
|
6415
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
6952
6416
|
};
|
|
6953
6417
|
}
|
|
6954
6418
|
/**
|
|
@@ -6967,7 +6431,7 @@ function buildLuvioFirstPartyHeaderInterceptor() {
|
|
|
6967
6431
|
if (!resourceRequest.headers[FIRST_PARTY_HEADER]) {
|
|
6968
6432
|
resourceRequest.headers[FIRST_PARTY_HEADER] = FIRST_PARTY_VALUE;
|
|
6969
6433
|
}
|
|
6970
|
-
return resolvedPromiseLike
|
|
6434
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6971
6435
|
};
|
|
6972
6436
|
}
|
|
6973
6437
|
|
|
@@ -7015,7 +6479,7 @@ function buildLuvioIdempotencyKeyInterceptor() {
|
|
|
7015
6479
|
!resourceRequest.headers[IDEMPOTENCY_KEY_HEADER]) {
|
|
7016
6480
|
resourceRequest.headers[IDEMPOTENCY_KEY_HEADER] = mintIdempotencyKey();
|
|
7017
6481
|
}
|
|
7018
|
-
return resolvedPromiseLike
|
|
6482
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7019
6483
|
};
|
|
7020
6484
|
}
|
|
7021
6485
|
|
|
@@ -7098,9 +6562,9 @@ function buildJwtParameterizationInterceptor(jwtManager, jwtRequestModifier = (_
|
|
|
7098
6562
|
// interceptor handles it. This MUST be the first statement so non-opted-in
|
|
7099
6563
|
// SFAP commands observe no work at all.
|
|
7100
6564
|
if (mintParams === undefined) {
|
|
7101
|
-
return resolvedPromiseLike
|
|
6565
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7102
6566
|
}
|
|
7103
|
-
return resolvedPromiseLike
|
|
6567
|
+
return resolvedPromiseLike(jwtManager.getJwt(mintParams)).then((token) => {
|
|
7104
6568
|
const fetchArgsWithAuthorization = setHeaderAuthorization(token, fetchArgs);
|
|
7105
6569
|
return token.extraInfo
|
|
7106
6570
|
? jwtRequestModifier(token.extraInfo, fetchArgsWithAuthorization)
|
|
@@ -7126,7 +6590,7 @@ function buildLuvioPageScopedCacheRequestInterceptor() {
|
|
|
7126
6590
|
}
|
|
7127
6591
|
// Pass the headers to pageScopedCache which will mutate them
|
|
7128
6592
|
pageScopedCache.addHeader(resourceRequest.headers);
|
|
7129
|
-
return resolvedPromiseLike
|
|
6593
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7130
6594
|
};
|
|
7131
6595
|
}
|
|
7132
6596
|
|
|
@@ -7140,7 +6604,7 @@ function buildPageScopedCacheRequestInterceptor() {
|
|
|
7140
6604
|
Object.entries(pageScopedCacheHeaders).forEach(([key, value]) => {
|
|
7141
6605
|
returnedFetchArgs = setHeader(key, value, returnedFetchArgs);
|
|
7142
6606
|
});
|
|
7143
|
-
return resolvedPromiseLike
|
|
6607
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
7144
6608
|
};
|
|
7145
6609
|
}
|
|
7146
6610
|
|
|
@@ -7155,7 +6619,7 @@ function buildTransportMarksSendInterceptor() {
|
|
|
7155
6619
|
context.startTime = performance.now();
|
|
7156
6620
|
createTransportStartMark(requestId);
|
|
7157
6621
|
}
|
|
7158
|
-
return resolvedPromiseLike
|
|
6622
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7159
6623
|
};
|
|
7160
6624
|
}
|
|
7161
6625
|
function buildLuvioTransportMarksSendInterceptor() {
|
|
@@ -7166,7 +6630,7 @@ function buildLuvioTransportMarksSendInterceptor() {
|
|
|
7166
6630
|
context.startTime = performance.now();
|
|
7167
6631
|
createTransportStartMark(requestId);
|
|
7168
6632
|
}
|
|
7169
|
-
return resolvedPromiseLike
|
|
6633
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7170
6634
|
};
|
|
7171
6635
|
}
|
|
7172
6636
|
function setLuvioRequestIdHeader(resourceRequest, requestId) {
|
|
@@ -8113,7 +7577,7 @@ class PrioritizedConfigService {
|
|
|
8113
7577
|
}
|
|
8114
7578
|
});
|
|
8115
7579
|
this.validated = errors.length === 0;
|
|
8116
|
-
return errors.length === 0 ? ok
|
|
7580
|
+
return errors.length === 0 ? ok(void 0) : err(errors);
|
|
8117
7581
|
}
|
|
8118
7582
|
// constructs a proxy for the given non-leaf object path in the config tree
|
|
8119
7583
|
buildReadonlyObjectProxy(path) {
|
|
@@ -8132,7 +7596,7 @@ class PrioritizedConfigService {
|
|
|
8132
7596
|
get: (_, property) => {
|
|
8133
7597
|
const propertyPath = [...path, property];
|
|
8134
7598
|
const value = this.valueFor(propertyPath);
|
|
8135
|
-
return typeof value === "object" && value !== null && !isArray$
|
|
7599
|
+
return typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value;
|
|
8136
7600
|
},
|
|
8137
7601
|
getOwnPropertyDescriptor: (target, property) => {
|
|
8138
7602
|
const propertyPath = [...path, property];
|
|
@@ -8140,7 +7604,7 @@ class PrioritizedConfigService {
|
|
|
8140
7604
|
return {
|
|
8141
7605
|
value: (
|
|
8142
7606
|
// TODO - need to wrap arrays in a Proxy as well
|
|
8143
|
-
typeof value === "object" && value !== null && !isArray$
|
|
7607
|
+
typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value
|
|
8144
7608
|
),
|
|
8145
7609
|
writable: false,
|
|
8146
7610
|
configurable: true,
|
|
@@ -8241,7 +7705,7 @@ function getEnvironmentSetting(name) {
|
|
|
8241
7705
|
}
|
|
8242
7706
|
return undefined;
|
|
8243
7707
|
}
|
|
8244
|
-
// version: 1.
|
|
7708
|
+
// version: 1.471.0-a0bc34effb
|
|
8245
7709
|
|
|
8246
7710
|
const auraClientService = getAuraClientService();
|
|
8247
7711
|
const defaultConfig = {
|
|
@@ -8695,7 +8159,7 @@ function buildLuvioThirdPartyTrackerRegisterInterceptor() {
|
|
|
8695
8159
|
return false;
|
|
8696
8160
|
});
|
|
8697
8161
|
}
|
|
8698
|
-
return resolvedPromiseLike
|
|
8162
|
+
return resolvedPromiseLike(resourceRequest);
|
|
8699
8163
|
};
|
|
8700
8164
|
}
|
|
8701
8165
|
|
|
@@ -8846,7 +8310,7 @@ function buildThirdPartyTrackerRegisterInterceptor() {
|
|
|
8846
8310
|
return false;
|
|
8847
8311
|
});
|
|
8848
8312
|
}
|
|
8849
|
-
return resolvedPromiseLike
|
|
8313
|
+
return resolvedPromiseLike(fetchArgs);
|
|
8850
8314
|
};
|
|
8851
8315
|
}
|
|
8852
8316
|
|
|
@@ -8949,7 +8413,7 @@ function prefetchSfapJwt() {
|
|
|
8949
8413
|
return Promise.resolve(undefined);
|
|
8950
8414
|
}
|
|
8951
8415
|
function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
8952
|
-
const jwtAuthorizedFetchService = buildServiceDescriptor$
|
|
8416
|
+
const jwtAuthorizedFetchService = buildServiceDescriptor$q({
|
|
8953
8417
|
createContext: createInstrumentationIdContext(),
|
|
8954
8418
|
request: [
|
|
8955
8419
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -8989,7 +8453,7 @@ function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
|
8989
8453
|
* the Data360 command — the SFAP fleet never flows past this interceptor.
|
|
8990
8454
|
*/
|
|
8991
8455
|
function buildJwtAuthorizedData360FetchServiceDescriptor(logger) {
|
|
8992
|
-
const data360FetchService = buildServiceDescriptor$
|
|
8456
|
+
const data360FetchService = buildServiceDescriptor$q({
|
|
8993
8457
|
createContext: createInstrumentationIdContext(),
|
|
8994
8458
|
request: [
|
|
8995
8459
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -9019,7 +8483,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9019
8483
|
// we switch to JWT authentication this will need to change to incorporate the
|
|
9020
8484
|
// Interceptor here with the logic in buildJwtAuthorizedSfapFetchServiceDescriptor()
|
|
9021
8485
|
// above.
|
|
9022
|
-
...buildServiceDescriptor$
|
|
8486
|
+
...buildServiceDescriptor$q({
|
|
9023
8487
|
createContext: createInstrumentationIdContext(),
|
|
9024
8488
|
request: [
|
|
9025
8489
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -9035,9 +8499,9 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9035
8499
|
requestInit.method !== 'POST' ||
|
|
9036
8500
|
!requestInit.body ||
|
|
9037
8501
|
typeof requestInit.body !== 'string') {
|
|
9038
|
-
return resolvedPromiseLike
|
|
8502
|
+
return resolvedPromiseLike(args);
|
|
9039
8503
|
}
|
|
9040
|
-
return resolvedPromiseLike
|
|
8504
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt()).then((token) => {
|
|
9041
8505
|
// replace the body's instanceConfig.endpoint with the JWT's iss value
|
|
9042
8506
|
const body = JSON.parse(requestInit.body);
|
|
9043
8507
|
if (!body || !token.decodedInfo || !token.decodedInfo.iss) {
|
|
@@ -9072,7 +8536,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9072
8536
|
};
|
|
9073
8537
|
}
|
|
9074
8538
|
function buildUnauthorizedFetchServiceDescriptor() {
|
|
9075
|
-
const fetchService = buildServiceDescriptor$
|
|
8539
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9076
8540
|
createContext: createInstrumentationIdContext(),
|
|
9077
8541
|
// Per-request gzip (opt-in via `init.onestore.compression`).
|
|
9078
8542
|
request: [buildThirdPartyTrackerRegisterInterceptor(), buildCompressionInterceptor()],
|
|
@@ -9148,9 +8612,9 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9148
8612
|
context?.[JWT_MINT_PARAMS_SEED_KEY];
|
|
9149
8613
|
// No mint params → not a parameterized Data360 request. Nothing to do.
|
|
9150
8614
|
if (mintParams === undefined) {
|
|
9151
|
-
return resolvedPromiseLike
|
|
8615
|
+
return resolvedPromiseLike(fetchArgs);
|
|
9152
8616
|
}
|
|
9153
|
-
return resolvedPromiseLike
|
|
8617
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt(mintParams)).then((token) => {
|
|
9154
8618
|
const [resource, request] = fetchArgs;
|
|
9155
8619
|
if (typeof resource !== 'string' && !(resource instanceof URL)) {
|
|
9156
8620
|
// istanbul ignore else: not exercised under NODE_ENV=production
|
|
@@ -9197,7 +8661,7 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9197
8661
|
*/
|
|
9198
8662
|
function buildGuardedLegacyJwtRequestInterceptor(logger) {
|
|
9199
8663
|
const legacyInterceptor = buildJwtRequestInterceptor(logger);
|
|
9200
|
-
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike
|
|
8664
|
+
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike(args) : legacyInterceptor(args);
|
|
9201
8665
|
}
|
|
9202
8666
|
|
|
9203
8667
|
const PDL_EXECUTE_ASYNC_OPTIONS = {
|
|
@@ -11329,12 +10793,12 @@ function getLexRuntimeDefaultInterceptorConfig(logger) {
|
|
|
11329
10793
|
};
|
|
11330
10794
|
}
|
|
11331
10795
|
function buildLexRuntimeDefaultFetchServiceDescriptor(logger, retryService) {
|
|
11332
|
-
const fetchService = buildServiceDescriptor$
|
|
10796
|
+
const fetchService = buildServiceDescriptor$q(getLexRuntimeDefaultInterceptorConfig(logger), retryService);
|
|
11333
10797
|
return { ...fetchService };
|
|
11334
10798
|
}
|
|
11335
10799
|
function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
11336
10800
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
11337
|
-
const fetchService = buildServiceDescriptor$
|
|
10801
|
+
const fetchService = buildServiceDescriptor$q({
|
|
11338
10802
|
...config,
|
|
11339
10803
|
// Omit 5xx interceptor - allow 5xx responses to pass through
|
|
11340
10804
|
response: [
|
|
@@ -11350,7 +10814,7 @@ function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
|
11350
10814
|
}
|
|
11351
10815
|
function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
11352
10816
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
11353
|
-
const fetchService = buildServiceDescriptor$
|
|
10817
|
+
const fetchService = buildServiceDescriptor$q({
|
|
11354
10818
|
...config,
|
|
11355
10819
|
// Append compression interceptor last, after any body-modifying interceptors
|
|
11356
10820
|
request: [...config.request, buildCompressionInterceptor({ algorithm: 'gzip' })],
|
|
@@ -11650,7 +11114,7 @@ function initializeOneStore(luvio) {
|
|
|
11650
11114
|
buildServiceDescriptor$p(),
|
|
11651
11115
|
buildServiceDescriptor$e(),
|
|
11652
11116
|
buildServiceDescriptor$m(),
|
|
11653
|
-
buildServiceDescriptor$
|
|
11117
|
+
buildServiceDescriptor$r(),
|
|
11654
11118
|
buildServiceDescriptor$l(),
|
|
11655
11119
|
buildServiceDescriptor$k(),
|
|
11656
11120
|
buildServiceDescriptor$o(),
|
|
@@ -11667,9 +11131,9 @@ function initializeOneStore(luvio) {
|
|
|
11667
11131
|
buildServiceDescriptor$5(),
|
|
11668
11132
|
buildServiceDescriptor$4(),
|
|
11669
11133
|
buildServiceDescriptor$7(),
|
|
11670
|
-
buildServiceDescriptor$3
|
|
11134
|
+
buildServiceDescriptor$3(),
|
|
11671
11135
|
buildServiceDescriptor$2$1(),
|
|
11672
|
-
buildServiceDescriptor$1$
|
|
11136
|
+
buildServiceDescriptor$1$1(),
|
|
11673
11137
|
buildServiceDescriptor$6(),
|
|
11674
11138
|
buildLWCWireBindingsServiceDescriptor(),
|
|
11675
11139
|
buildLWCGraphQLWireBindingsServiceDescriptor(),
|
|
@@ -11695,4 +11159,4 @@ function ldsEngineCreator() {
|
|
|
11695
11159
|
}
|
|
11696
11160
|
|
|
11697
11161
|
export { LexRequestStrategy, PDL_ENGINE_REGISTRATION_ID, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
|
|
11698
|
-
// version: 1.
|
|
11162
|
+
// version: 1.471.0-2898c91740
|