@salesforce/lds-runtime-aura 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/ldsEngineCreator.js +421 -957
- package/package.json +42 -42
package/dist/ldsEngineCreator.js
CHANGED
|
@@ -41,8 +41,8 @@ import auraBasedRequestsEnabled from '@salesforce/gate/ui.services.auraBasedRequ
|
|
|
41
41
|
import { registerSubRequestNetworkAdapter } from 'force/ldsNetwork';
|
|
42
42
|
|
|
43
43
|
const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
|
|
44
|
-
const { isArray: isArray$
|
|
45
|
-
const { stringify: stringify$
|
|
44
|
+
const { isArray: isArray$3 } = Array;
|
|
45
|
+
const { stringify: stringify$1, parse } = JSON;
|
|
46
46
|
const WeakSetConstructor = WeakSet;
|
|
47
47
|
const LogLevelMap = {
|
|
48
48
|
TRACE: 4,
|
|
@@ -83,7 +83,7 @@ class ConsoleLogger {
|
|
|
83
83
|
function loggerService(level, printer, formatter) {
|
|
84
84
|
return new ConsoleLogger(level, printer, formatter);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
class Ok {
|
|
87
87
|
constructor(value) {
|
|
88
88
|
this.value = value;
|
|
89
89
|
}
|
|
@@ -93,8 +93,8 @@ let Ok$2 = class Ok {
|
|
|
93
93
|
isErr() {
|
|
94
94
|
return !this.isOk();
|
|
95
95
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
96
|
+
}
|
|
97
|
+
class Err {
|
|
98
98
|
constructor(error) {
|
|
99
99
|
this.error = error;
|
|
100
100
|
}
|
|
@@ -104,12 +104,26 @@ let Err$1 = class Err {
|
|
|
104
104
|
isErr() {
|
|
105
105
|
return !this.isOk();
|
|
106
106
|
}
|
|
107
|
-
}
|
|
108
|
-
const ok
|
|
109
|
-
const err
|
|
107
|
+
}
|
|
108
|
+
const ok = (value) => new Ok(value);
|
|
109
|
+
const err = (err2) => new Err(err2);
|
|
110
110
|
function isResult(value) {
|
|
111
111
|
return value !== null && value !== void 0 && typeof value === "object" && "isOk" in value && "isErr" in value && typeof value.isOk === "function" && typeof value.isErr === "function" && (value.isOk() === true && value.isErr() === false && "value" in value || value.isOk() === false && value.isErr() === true && "error" in value);
|
|
112
112
|
}
|
|
113
|
+
function setDifference(setA, setB) {
|
|
114
|
+
const differenceSet = /* @__PURE__ */ new Set();
|
|
115
|
+
for (const element of setA) {
|
|
116
|
+
if (!setB.has(element)) {
|
|
117
|
+
differenceSet.add(element);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return differenceSet;
|
|
121
|
+
}
|
|
122
|
+
function addAllToSet(targetSet, sourceSet) {
|
|
123
|
+
for (const element of sourceSet) {
|
|
124
|
+
targetSet.add(element);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
113
127
|
function isSubscribable(obj) {
|
|
114
128
|
return typeof obj === "object" && obj !== null && "subscribe" in obj && typeof obj.subscribe === "function" && "refresh" in obj && typeof obj.refresh === "function";
|
|
115
129
|
}
|
|
@@ -119,15 +133,15 @@ function isSubscribableResult(x) {
|
|
|
119
133
|
}
|
|
120
134
|
return isSubscribable(x.isOk() ? x.value : x.error);
|
|
121
135
|
}
|
|
122
|
-
function buildSubscribableResult
|
|
136
|
+
function buildSubscribableResult(result, subscribe, refresh) {
|
|
123
137
|
if (result.isOk()) {
|
|
124
|
-
return ok
|
|
138
|
+
return ok({ data: result.value, subscribe, refresh });
|
|
125
139
|
} else {
|
|
126
|
-
return err
|
|
140
|
+
return err({ failure: result.error, subscribe, refresh });
|
|
127
141
|
}
|
|
128
142
|
}
|
|
129
|
-
function resolvedPromiseLike
|
|
130
|
-
if (isPromiseLike
|
|
143
|
+
function resolvedPromiseLike(result) {
|
|
144
|
+
if (isPromiseLike(result)) {
|
|
131
145
|
return result.then(
|
|
132
146
|
(nextResult) => nextResult
|
|
133
147
|
);
|
|
@@ -135,18 +149,18 @@ function resolvedPromiseLike$2(result) {
|
|
|
135
149
|
return {
|
|
136
150
|
then: (onFulfilled, _onRejected) => {
|
|
137
151
|
try {
|
|
138
|
-
return resolvedPromiseLike
|
|
152
|
+
return resolvedPromiseLike(onFulfilled(result));
|
|
139
153
|
} catch (e) {
|
|
140
154
|
if (onFulfilled === void 0) {
|
|
141
|
-
return resolvedPromiseLike
|
|
155
|
+
return resolvedPromiseLike(result);
|
|
142
156
|
}
|
|
143
|
-
return rejectedPromiseLike
|
|
157
|
+
return rejectedPromiseLike(e);
|
|
144
158
|
}
|
|
145
159
|
}
|
|
146
160
|
};
|
|
147
161
|
}
|
|
148
|
-
function rejectedPromiseLike
|
|
149
|
-
if (isPromiseLike
|
|
162
|
+
function rejectedPromiseLike(reason) {
|
|
163
|
+
if (isPromiseLike(reason)) {
|
|
150
164
|
return reason.then(
|
|
151
165
|
(nextResult) => nextResult
|
|
152
166
|
);
|
|
@@ -155,31 +169,31 @@ function rejectedPromiseLike$2(reason) {
|
|
|
155
169
|
then: (_onFulfilled, onRejected) => {
|
|
156
170
|
if (typeof onRejected === "function") {
|
|
157
171
|
try {
|
|
158
|
-
return resolvedPromiseLike
|
|
172
|
+
return resolvedPromiseLike(onRejected(reason));
|
|
159
173
|
} catch (e) {
|
|
160
|
-
return rejectedPromiseLike
|
|
174
|
+
return rejectedPromiseLike(e);
|
|
161
175
|
}
|
|
162
176
|
}
|
|
163
|
-
return rejectedPromiseLike
|
|
177
|
+
return rejectedPromiseLike(reason);
|
|
164
178
|
}
|
|
165
179
|
};
|
|
166
180
|
}
|
|
167
|
-
function isPromiseLike
|
|
181
|
+
function isPromiseLike(x) {
|
|
168
182
|
return typeof x?.then === "function";
|
|
169
183
|
}
|
|
170
|
-
function deepEquals
|
|
184
|
+
function deepEquals(x, y) {
|
|
171
185
|
if (x === void 0) {
|
|
172
186
|
return y === void 0;
|
|
173
187
|
} else if (x === null) {
|
|
174
188
|
return y === null;
|
|
175
189
|
} else if (y === null) {
|
|
176
190
|
return x === null;
|
|
177
|
-
} else if (isArray$
|
|
178
|
-
if (!isArray$
|
|
191
|
+
} else if (isArray$3(x)) {
|
|
192
|
+
if (!isArray$3(y) || x.length !== y.length) {
|
|
179
193
|
return false;
|
|
180
194
|
}
|
|
181
195
|
for (let i = 0; i < x.length; ++i) {
|
|
182
|
-
if (!deepEquals
|
|
196
|
+
if (!deepEquals(x[i], y[i])) {
|
|
183
197
|
return false;
|
|
184
198
|
}
|
|
185
199
|
}
|
|
@@ -195,7 +209,7 @@ function deepEquals$1(x, y) {
|
|
|
195
209
|
}
|
|
196
210
|
for (let i = 0; i < xkeys.length; ++i) {
|
|
197
211
|
const key = xkeys[i];
|
|
198
|
-
if (!deepEquals
|
|
212
|
+
if (!deepEquals(
|
|
199
213
|
x[key],
|
|
200
214
|
y[key]
|
|
201
215
|
)) {
|
|
@@ -218,11 +232,11 @@ function stableJSONStringify$1(node) {
|
|
|
218
232
|
return isFinite(node) ? "" + node : "null";
|
|
219
233
|
}
|
|
220
234
|
if (typeof node !== "object") {
|
|
221
|
-
return stringify$
|
|
235
|
+
return stringify$1(node);
|
|
222
236
|
}
|
|
223
237
|
let i;
|
|
224
238
|
let out;
|
|
225
|
-
if (isArray$
|
|
239
|
+
if (isArray$3(node)) {
|
|
226
240
|
out = "[";
|
|
227
241
|
for (i = 0; i < node.length; i++) {
|
|
228
242
|
if (i) {
|
|
@@ -247,7 +261,7 @@ function stableJSONStringify$1(node) {
|
|
|
247
261
|
if (out) {
|
|
248
262
|
out += ",";
|
|
249
263
|
}
|
|
250
|
-
out += stringify$
|
|
264
|
+
out += stringify$1(key) + ":" + value;
|
|
251
265
|
}
|
|
252
266
|
return "{" + out + "}";
|
|
253
267
|
}
|
|
@@ -257,6 +271,10 @@ function toError(x) {
|
|
|
257
271
|
}
|
|
258
272
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
259
273
|
}
|
|
274
|
+
function deepCopy(x) {
|
|
275
|
+
const stringified = stringify$1(x);
|
|
276
|
+
return stringified ? parse(stringified) : void 0;
|
|
277
|
+
}
|
|
260
278
|
var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
261
279
|
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
262
280
|
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
@@ -330,7 +348,7 @@ function deepFreeze(value) {
|
|
|
330
348
|
return;
|
|
331
349
|
}
|
|
332
350
|
deeplyFrozen.add(value);
|
|
333
|
-
if (isArray$
|
|
351
|
+
if (isArray$3(value)) {
|
|
334
352
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
335
353
|
deepFreeze(value[i]);
|
|
336
354
|
}
|
|
@@ -370,7 +388,7 @@ function logError$1(error) {
|
|
|
370
388
|
class BaseCommand {
|
|
371
389
|
}
|
|
372
390
|
|
|
373
|
-
|
|
391
|
+
class NetworkCommand extends BaseCommand {
|
|
374
392
|
constructor(services) {
|
|
375
393
|
super();
|
|
376
394
|
this.services = services;
|
|
@@ -386,7 +404,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
386
404
|
}
|
|
387
405
|
fetchSubscribableResult(res) {
|
|
388
406
|
return res.then((networkResult) => {
|
|
389
|
-
return buildSubscribableResult
|
|
407
|
+
return buildSubscribableResult(
|
|
390
408
|
networkResult,
|
|
391
409
|
(cb) => {
|
|
392
410
|
this.subscriptions.push(cb);
|
|
@@ -401,7 +419,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
401
419
|
refresh() {
|
|
402
420
|
return this.execute().then((newResult) => {
|
|
403
421
|
if (isSubscribableResult(newResult)) {
|
|
404
|
-
const value = newResult.isOk() ? ok
|
|
422
|
+
const value = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
405
423
|
this.subscriptions.forEach((cb) => {
|
|
406
424
|
try {
|
|
407
425
|
cb(value);
|
|
@@ -409,21 +427,21 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
409
427
|
}
|
|
410
428
|
});
|
|
411
429
|
}
|
|
412
|
-
return ok
|
|
430
|
+
return ok(void 0);
|
|
413
431
|
});
|
|
414
432
|
}
|
|
415
433
|
async afterRequestHooks(_options) {
|
|
416
434
|
}
|
|
417
|
-
}
|
|
418
|
-
function buildServiceDescriptor$
|
|
435
|
+
}
|
|
436
|
+
function buildServiceDescriptor$r() {
|
|
419
437
|
return {
|
|
420
438
|
type: "networkCommandBaseClass",
|
|
421
439
|
version: "1.0",
|
|
422
|
-
service: NetworkCommand
|
|
440
|
+
service: NetworkCommand
|
|
423
441
|
};
|
|
424
442
|
}
|
|
425
443
|
|
|
426
|
-
function applyOperationRequestOptions
|
|
444
|
+
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
427
445
|
if (operationType === void 0 && requestOptions === void 0) {
|
|
428
446
|
return init;
|
|
429
447
|
}
|
|
@@ -436,7 +454,164 @@ function applyOperationRequestOptions$3(init, operationType, requestOptions) {
|
|
|
436
454
|
}
|
|
437
455
|
};
|
|
438
456
|
}
|
|
439
|
-
|
|
457
|
+
function buildServiceDescriptor$q(interceptors = {
|
|
458
|
+
request: [],
|
|
459
|
+
retry: void 0,
|
|
460
|
+
response: [],
|
|
461
|
+
finally: []
|
|
462
|
+
}, retryService) {
|
|
463
|
+
return {
|
|
464
|
+
type: "fetch",
|
|
465
|
+
version: "1.0",
|
|
466
|
+
service: function(input, init) {
|
|
467
|
+
let contextSeed;
|
|
468
|
+
let cleanInit = init;
|
|
469
|
+
if (init !== void 0 && "__contextSeed" in init) {
|
|
470
|
+
const { __contextSeed, ...initWithoutSeed } = init;
|
|
471
|
+
contextSeed = __contextSeed;
|
|
472
|
+
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
473
|
+
}
|
|
474
|
+
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
475
|
+
const baseContext = interceptors.createContext?.();
|
|
476
|
+
const onestore = cleanInit?.onestore;
|
|
477
|
+
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
478
|
+
...baseContext,
|
|
479
|
+
...contextSeed,
|
|
480
|
+
...onestore !== void 0 && { onestore }
|
|
481
|
+
};
|
|
482
|
+
const {
|
|
483
|
+
request: requestInterceptors = [],
|
|
484
|
+
retry: retryInterceptor = void 0,
|
|
485
|
+
response: responseInterceptors = [],
|
|
486
|
+
finally: finallyInterceptors = []
|
|
487
|
+
} = interceptors;
|
|
488
|
+
const pending = requestInterceptors.reduce(
|
|
489
|
+
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
490
|
+
resolvedPromiseLike(fetchArgs)
|
|
491
|
+
);
|
|
492
|
+
return Promise.resolve(pending).then((args) => {
|
|
493
|
+
if (retryInterceptor) {
|
|
494
|
+
return retryInterceptor(args, retryService, context);
|
|
495
|
+
} else {
|
|
496
|
+
if (retryService) {
|
|
497
|
+
return retryService.applyRetry(() => fetch(...args));
|
|
498
|
+
}
|
|
499
|
+
return fetch(...args);
|
|
500
|
+
}
|
|
501
|
+
}).then((response) => {
|
|
502
|
+
return responseInterceptors.reduce(
|
|
503
|
+
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
504
|
+
resolvedPromiseLike(response)
|
|
505
|
+
);
|
|
506
|
+
}).finally(() => {
|
|
507
|
+
if (finallyInterceptors.length > 0) {
|
|
508
|
+
return finallyInterceptors.reduce(
|
|
509
|
+
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
510
|
+
Promise.resolve()
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
let textEncoder;
|
|
518
|
+
function getTextEncoder() {
|
|
519
|
+
if (!textEncoder) {
|
|
520
|
+
if (typeof TextEncoder === "undefined") {
|
|
521
|
+
throw new Error(
|
|
522
|
+
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
textEncoder = new TextEncoder();
|
|
526
|
+
}
|
|
527
|
+
return textEncoder;
|
|
528
|
+
}
|
|
529
|
+
function buildCompressionInterceptor(defaultConfig) {
|
|
530
|
+
return async (args) => {
|
|
531
|
+
const [resource, options = {}] = args;
|
|
532
|
+
const config = options.onestore?.compression ?? defaultConfig;
|
|
533
|
+
if (config === void 0) {
|
|
534
|
+
return resolvedPromiseLike(args);
|
|
535
|
+
}
|
|
536
|
+
const threshold = config.threshold ?? 1024;
|
|
537
|
+
if (!options.body || typeof options.body !== "string") {
|
|
538
|
+
return resolvedPromiseLike(args);
|
|
539
|
+
}
|
|
540
|
+
if (typeof CompressionStream === "undefined") {
|
|
541
|
+
return resolvedPromiseLike(args);
|
|
542
|
+
}
|
|
543
|
+
const headers = new Headers(options.headers);
|
|
544
|
+
if (headers.has("Content-Encoding")) {
|
|
545
|
+
return resolvedPromiseLike(args);
|
|
546
|
+
}
|
|
547
|
+
const encodedBody = getTextEncoder().encode(options.body);
|
|
548
|
+
if (encodedBody.byteLength < threshold) {
|
|
549
|
+
return resolvedPromiseLike(args);
|
|
550
|
+
}
|
|
551
|
+
try {
|
|
552
|
+
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
553
|
+
const compressedBody = await new Response(stream).blob();
|
|
554
|
+
headers.set("Content-Encoding", config.algorithm);
|
|
555
|
+
headers.delete("Content-Length");
|
|
556
|
+
const compressedOptions = {
|
|
557
|
+
...options,
|
|
558
|
+
body: compressedBody,
|
|
559
|
+
headers
|
|
560
|
+
};
|
|
561
|
+
return resolvedPromiseLike([resource, compressedOptions]);
|
|
562
|
+
} catch {
|
|
563
|
+
return resolvedPromiseLike(args);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
568
|
+
throwOnExisting = false,
|
|
569
|
+
errorMessage = `Unexpected ${headerName} header encountered`
|
|
570
|
+
} = {}) {
|
|
571
|
+
let hasHeaderBeenSet = false;
|
|
572
|
+
if (resource instanceof Request && !options?.headers) {
|
|
573
|
+
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
574
|
+
throw new Error(errorMessage);
|
|
575
|
+
}
|
|
576
|
+
resource.headers.set(headerName, headerValue);
|
|
577
|
+
hasHeaderBeenSet = true;
|
|
578
|
+
}
|
|
579
|
+
if (options?.headers instanceof Headers) {
|
|
580
|
+
if (throwOnExisting && options.headers.has(headerName)) {
|
|
581
|
+
throw new Error(errorMessage);
|
|
582
|
+
}
|
|
583
|
+
options.headers.set(headerName, headerValue);
|
|
584
|
+
} else {
|
|
585
|
+
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
586
|
+
throw new Error(errorMessage);
|
|
587
|
+
}
|
|
588
|
+
if (!hasHeaderBeenSet) {
|
|
589
|
+
options.headers = {
|
|
590
|
+
...options?.headers,
|
|
591
|
+
[headerName]: headerValue
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return [resource, options];
|
|
596
|
+
}
|
|
597
|
+
const UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE = "Unexpected Authorization header encountered. To specify a custom Authorization header, use a Fetch service that is not configured with JwtRequestHeaderInterceptor";
|
|
598
|
+
function setHeaderAuthorization({ token }, fetchParams) {
|
|
599
|
+
const authorizationValue = `Bearer ${token}`;
|
|
600
|
+
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
601
|
+
throwOnExisting: true,
|
|
602
|
+
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
606
|
+
return (args) => {
|
|
607
|
+
return resolvedPromiseLike(jwtManager.getJwt()).then((token) => {
|
|
608
|
+
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
609
|
+
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
class AuraNetworkCommand extends NetworkCommand {
|
|
440
615
|
constructor(services) {
|
|
441
616
|
super(services);
|
|
442
617
|
this.services = services;
|
|
@@ -490,19 +665,19 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
490
665
|
this.afterRequestHooks({ statusCode: 200 });
|
|
491
666
|
} catch {
|
|
492
667
|
}
|
|
493
|
-
return ok
|
|
668
|
+
return ok(auraReturnValue);
|
|
494
669
|
}).catch((error) => {
|
|
495
670
|
if (!error) {
|
|
496
|
-
return err
|
|
671
|
+
return err(toError("Failed to get error from response"));
|
|
497
672
|
}
|
|
498
673
|
if (!error.getError) {
|
|
499
|
-
return err
|
|
674
|
+
return err(toError(error));
|
|
500
675
|
}
|
|
501
676
|
const actionErrors = error.getError();
|
|
502
677
|
if (actionErrors.length > 0) {
|
|
503
|
-
return err
|
|
678
|
+
return err(coerceError(actionErrors));
|
|
504
679
|
}
|
|
505
|
-
return err
|
|
680
|
+
return err(toError("Error fetching component"));
|
|
506
681
|
});
|
|
507
682
|
}
|
|
508
683
|
isSemanticNullResponse(response) {
|
|
@@ -520,10 +695,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
520
695
|
if (response2.ok) {
|
|
521
696
|
let resultPromise;
|
|
522
697
|
if (this.isSemanticNullResponse(response2)) {
|
|
523
|
-
resultPromise = Promise.resolve(ok
|
|
698
|
+
resultPromise = Promise.resolve(ok(null));
|
|
524
699
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
525
700
|
resultPromise = Promise.resolve(
|
|
526
|
-
err
|
|
701
|
+
err(
|
|
527
702
|
toError(
|
|
528
703
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
529
704
|
)
|
|
@@ -531,8 +706,8 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
531
706
|
);
|
|
532
707
|
} else {
|
|
533
708
|
resultPromise = response2.json().then(
|
|
534
|
-
(json) => ok
|
|
535
|
-
(reason) => err
|
|
709
|
+
(json) => ok(json),
|
|
710
|
+
(reason) => err(toError(reason))
|
|
536
711
|
);
|
|
537
712
|
}
|
|
538
713
|
return resultPromise.finally(() => {
|
|
@@ -543,7 +718,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
543
718
|
});
|
|
544
719
|
} else {
|
|
545
720
|
return this.coerceError(response2).then((coercedError) => {
|
|
546
|
-
return err
|
|
721
|
+
return err(coercedError);
|
|
547
722
|
}).finally(() => {
|
|
548
723
|
try {
|
|
549
724
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -552,7 +727,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
552
727
|
});
|
|
553
728
|
}
|
|
554
729
|
},
|
|
555
|
-
(reason) => err
|
|
730
|
+
(reason) => err(toError(reason))
|
|
556
731
|
);
|
|
557
732
|
}
|
|
558
733
|
shouldUseAuraNetwork() {
|
|
@@ -576,7 +751,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
576
751
|
);
|
|
577
752
|
} else if (this.shouldUseFetch()) {
|
|
578
753
|
const [input, init] = this.fetchParams;
|
|
579
|
-
const initWithOptions = applyOperationRequestOptions
|
|
754
|
+
const initWithOptions = applyOperationRequestOptions(
|
|
580
755
|
init,
|
|
581
756
|
this.operationType,
|
|
582
757
|
this.requestOptions
|
|
@@ -585,10 +760,10 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
585
760
|
const fetchCall = initWithOptions === void 0 ? this.services.fetch(input) : this.services.fetch(input, initWithOptions);
|
|
586
761
|
return this.convertFetchResponseToData(fetchCall);
|
|
587
762
|
} catch (reason) {
|
|
588
|
-
return resolvedPromiseLike
|
|
763
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
589
764
|
}
|
|
590
765
|
}
|
|
591
|
-
return resolvedPromiseLike
|
|
766
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
592
767
|
}
|
|
593
768
|
}
|
|
594
769
|
function buildServiceDescriptor$p() {
|
|
@@ -599,164 +774,52 @@ function buildServiceDescriptor$p() {
|
|
|
599
774
|
};
|
|
600
775
|
}
|
|
601
776
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
777
|
+
function setOverlaps(setA, setB) {
|
|
778
|
+
if (setA.size > setB.size) {
|
|
779
|
+
for (const key of setB.keys()) {
|
|
780
|
+
if (setA.has(key)) {
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
} else {
|
|
785
|
+
for (const key of setA) {
|
|
786
|
+
if (setB.has(key)) {
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
609
790
|
}
|
|
610
|
-
|
|
611
|
-
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
class CacheControlRequestRunner {
|
|
794
|
+
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
795
|
+
this.readFromCacheInternal = readFromCache;
|
|
796
|
+
this.requestFromNetworkInternal = requestFromNetwork;
|
|
797
|
+
this.writeToCacheInternal = writeToCache;
|
|
612
798
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
799
|
+
readFromCache(cache) {
|
|
800
|
+
const resultPromise = this.readFromCacheInternal(cache);
|
|
801
|
+
return resultPromise.then((result) => {
|
|
802
|
+
if (result.isErr()) {
|
|
803
|
+
return err(result.error.failure);
|
|
804
|
+
}
|
|
805
|
+
this.returnData = result;
|
|
806
|
+
return ok(void 0);
|
|
807
|
+
});
|
|
617
808
|
}
|
|
618
|
-
|
|
619
|
-
|
|
809
|
+
requestFromNetwork() {
|
|
810
|
+
const that = this;
|
|
811
|
+
return (async function* () {
|
|
812
|
+
const result = await that.requestFromNetworkInternal();
|
|
813
|
+
if (result.isErr()) {
|
|
814
|
+
that.networkError = result;
|
|
815
|
+
} else {
|
|
816
|
+
that.networkData = result;
|
|
817
|
+
}
|
|
818
|
+
yield result;
|
|
819
|
+
})();
|
|
620
820
|
}
|
|
621
|
-
|
|
622
|
-
return
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
const ok$1 = (value) => new Ok$1(value);
|
|
626
|
-
const err = (err2) => new Err(err2);
|
|
627
|
-
function buildSubscribableResult(result, subscribe, refresh) {
|
|
628
|
-
if (result.isOk()) {
|
|
629
|
-
return ok$1({ data: result.value, subscribe, refresh });
|
|
630
|
-
} else {
|
|
631
|
-
return err({ failure: result.error, subscribe, refresh });
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
function resolvedPromiseLike$1(result) {
|
|
635
|
-
if (isPromiseLike$1(result)) {
|
|
636
|
-
return result.then(
|
|
637
|
-
(nextResult) => nextResult
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
return {
|
|
641
|
-
then: (onFulfilled, _onRejected) => {
|
|
642
|
-
try {
|
|
643
|
-
return resolvedPromiseLike$1(onFulfilled(result));
|
|
644
|
-
} catch (e) {
|
|
645
|
-
if (onFulfilled === void 0) {
|
|
646
|
-
return resolvedPromiseLike$1(result);
|
|
647
|
-
}
|
|
648
|
-
return rejectedPromiseLike$1(e);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
function rejectedPromiseLike$1(reason) {
|
|
654
|
-
if (isPromiseLike$1(reason)) {
|
|
655
|
-
return reason.then(
|
|
656
|
-
(nextResult) => nextResult
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
return {
|
|
660
|
-
then: (_onFulfilled, onRejected) => {
|
|
661
|
-
if (typeof onRejected === "function") {
|
|
662
|
-
try {
|
|
663
|
-
return resolvedPromiseLike$1(onRejected(reason));
|
|
664
|
-
} catch (e) {
|
|
665
|
-
return rejectedPromiseLike$1(e);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return rejectedPromiseLike$1(reason);
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
function isPromiseLike$1(x) {
|
|
673
|
-
return typeof x?.then === "function";
|
|
674
|
-
}
|
|
675
|
-
function deepEquals(x, y) {
|
|
676
|
-
if (x === void 0) {
|
|
677
|
-
return y === void 0;
|
|
678
|
-
} else if (x === null) {
|
|
679
|
-
return y === null;
|
|
680
|
-
} else if (y === null) {
|
|
681
|
-
return x === null;
|
|
682
|
-
} else if (isArray$3(x)) {
|
|
683
|
-
if (!isArray$3(y) || x.length !== y.length) {
|
|
684
|
-
return false;
|
|
685
|
-
}
|
|
686
|
-
for (let i = 0; i < x.length; ++i) {
|
|
687
|
-
if (!deepEquals(x[i], y[i])) {
|
|
688
|
-
return false;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
return true;
|
|
692
|
-
} else if (typeof x === "object") {
|
|
693
|
-
if (typeof y !== "object") {
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
const xkeys = Object.keys(x);
|
|
697
|
-
const ykeys = Object.keys(y);
|
|
698
|
-
if (xkeys.length !== ykeys.length) {
|
|
699
|
-
return false;
|
|
700
|
-
}
|
|
701
|
-
for (let i = 0; i < xkeys.length; ++i) {
|
|
702
|
-
const key = xkeys[i];
|
|
703
|
-
if (!deepEquals(
|
|
704
|
-
x[key],
|
|
705
|
-
y[key]
|
|
706
|
-
)) {
|
|
707
|
-
return false;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
return x === y;
|
|
713
|
-
}
|
|
714
|
-
function setOverlaps(setA, setB) {
|
|
715
|
-
if (setA.size > setB.size) {
|
|
716
|
-
for (const key of setB.keys()) {
|
|
717
|
-
if (setA.has(key)) {
|
|
718
|
-
return true;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
} else {
|
|
722
|
-
for (const key of setA) {
|
|
723
|
-
if (setB.has(key)) {
|
|
724
|
-
return true;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return false;
|
|
729
|
-
}
|
|
730
|
-
class CacheControlRequestRunner {
|
|
731
|
-
constructor(readFromCache, requestFromNetwork, writeToCache) {
|
|
732
|
-
this.readFromCacheInternal = readFromCache;
|
|
733
|
-
this.requestFromNetworkInternal = requestFromNetwork;
|
|
734
|
-
this.writeToCacheInternal = writeToCache;
|
|
735
|
-
}
|
|
736
|
-
readFromCache(cache) {
|
|
737
|
-
const resultPromise = this.readFromCacheInternal(cache);
|
|
738
|
-
return resultPromise.then((result) => {
|
|
739
|
-
if (result.isErr()) {
|
|
740
|
-
return err(result.error.failure);
|
|
741
|
-
}
|
|
742
|
-
this.returnData = result;
|
|
743
|
-
return ok$1(void 0);
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
requestFromNetwork() {
|
|
747
|
-
const that = this;
|
|
748
|
-
return (async function* () {
|
|
749
|
-
const result = await that.requestFromNetworkInternal();
|
|
750
|
-
if (result.isErr()) {
|
|
751
|
-
that.networkError = result;
|
|
752
|
-
} else {
|
|
753
|
-
that.networkData = result;
|
|
754
|
-
}
|
|
755
|
-
yield result;
|
|
756
|
-
})();
|
|
757
|
-
}
|
|
758
|
-
writeToCache(cache, networkResult) {
|
|
759
|
-
return this.writeToCacheInternal(cache, networkResult);
|
|
821
|
+
writeToCache(cache, networkResult) {
|
|
822
|
+
return this.writeToCacheInternal(cache, networkResult);
|
|
760
823
|
}
|
|
761
824
|
}
|
|
762
825
|
class CacheControlCommand extends BaseCommand {
|
|
@@ -907,7 +970,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
907
970
|
});
|
|
908
971
|
}
|
|
909
972
|
}
|
|
910
|
-
return resolvedPromiseLike
|
|
973
|
+
return resolvedPromiseLike(void 0);
|
|
911
974
|
}
|
|
912
975
|
get operationType() {
|
|
913
976
|
return "query";
|
|
@@ -1009,7 +1072,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1009
1072
|
if (result.isErr()) {
|
|
1010
1073
|
return err(result.error.failure);
|
|
1011
1074
|
}
|
|
1012
|
-
return ok
|
|
1075
|
+
return ok(void 0);
|
|
1013
1076
|
});
|
|
1014
1077
|
}
|
|
1015
1078
|
/**
|
|
@@ -1028,7 +1091,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1028
1091
|
return this.writeToCache(recordableCache, networkResult).then((result) => {
|
|
1029
1092
|
this.instantiationTime = Date.now() / 1e3;
|
|
1030
1093
|
this.keysUpdated = recordableCache.keysUpdated;
|
|
1031
|
-
return ok
|
|
1094
|
+
return ok(result);
|
|
1032
1095
|
});
|
|
1033
1096
|
}
|
|
1034
1097
|
/**
|
|
@@ -1055,7 +1118,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1055
1118
|
const data = readResult.value;
|
|
1056
1119
|
this.keysUsed = recordableCache.keysRead;
|
|
1057
1120
|
return buildSubscribableResult(
|
|
1058
|
-
ok
|
|
1121
|
+
ok(data),
|
|
1059
1122
|
this.buildSubscribe(),
|
|
1060
1123
|
() => this.refresh()
|
|
1061
1124
|
);
|
|
@@ -1108,7 +1171,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
1108
1171
|
}
|
|
1109
1172
|
if (this.lastResult === void 0 || this.lastResult.type === "error" || !this.equals(this.lastResult.data, result.value.data)) {
|
|
1110
1173
|
this.lastResult = { type: "data", data: result.value.data };
|
|
1111
|
-
this.invokeConsumerCallbacks(ok
|
|
1174
|
+
this.invokeConsumerCallbacks(ok(result.value.data));
|
|
1112
1175
|
}
|
|
1113
1176
|
return result;
|
|
1114
1177
|
});
|
|
@@ -1148,19 +1211,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
|
|
|
1148
1211
|
};
|
|
1149
1212
|
}
|
|
1150
1213
|
|
|
1151
|
-
function applyOperationRequestOptions$2(init, operationType, requestOptions) {
|
|
1152
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1153
|
-
return init;
|
|
1154
|
-
}
|
|
1155
|
-
return {
|
|
1156
|
-
...init,
|
|
1157
|
-
onestore: {
|
|
1158
|
-
...requestOptions,
|
|
1159
|
-
...init?.onestore,
|
|
1160
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
1214
|
class AuraCacheControlCommand extends CacheControlCommand {
|
|
1165
1215
|
constructor(services) {
|
|
1166
1216
|
super(services);
|
|
@@ -1190,7 +1240,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1190
1240
|
input,
|
|
1191
1241
|
init
|
|
1192
1242
|
]) {
|
|
1193
|
-
return [input, applyOperationRequestOptions
|
|
1243
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1194
1244
|
}
|
|
1195
1245
|
shouldUseAuraNetwork() {
|
|
1196
1246
|
return this.services.auraNetwork !== void 0 && (this.networkPreference === "aura" || !this.services.fetch);
|
|
@@ -1214,10 +1264,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1214
1264
|
try {
|
|
1215
1265
|
return this.convertFetchResponseToData(this.services.fetch(...params));
|
|
1216
1266
|
} catch (reason) {
|
|
1217
|
-
return resolvedPromiseLike
|
|
1267
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1218
1268
|
}
|
|
1219
1269
|
}
|
|
1220
|
-
return resolvedPromiseLike
|
|
1270
|
+
return resolvedPromiseLike(err(toError("Aura/Fetch network services not found")));
|
|
1221
1271
|
}
|
|
1222
1272
|
coerceAuraErrors(auraErrors) {
|
|
1223
1273
|
return toError(auraErrors[0]);
|
|
@@ -1226,10 +1276,10 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1226
1276
|
return toError(errorResponse.statusText);
|
|
1227
1277
|
}
|
|
1228
1278
|
processAuraReturnValue(auraReturnValue) {
|
|
1229
|
-
return ok
|
|
1279
|
+
return ok(auraReturnValue);
|
|
1230
1280
|
}
|
|
1231
1281
|
processFetchReturnValue(json) {
|
|
1232
|
-
return ok
|
|
1282
|
+
return ok(json);
|
|
1233
1283
|
}
|
|
1234
1284
|
convertAuraResponseToData(responsePromise, coerceError) {
|
|
1235
1285
|
return responsePromise.then((response) => {
|
|
@@ -1241,16 +1291,16 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1241
1291
|
}
|
|
1242
1292
|
}).catch((error) => {
|
|
1243
1293
|
if (!error) {
|
|
1244
|
-
return err
|
|
1294
|
+
return err(toError("Failed to get error from response"));
|
|
1245
1295
|
}
|
|
1246
1296
|
if (!error.getError) {
|
|
1247
|
-
return err
|
|
1297
|
+
return err(toError(error));
|
|
1248
1298
|
}
|
|
1249
1299
|
const actionErrors = error.getError();
|
|
1250
1300
|
if (actionErrors.length > 0) {
|
|
1251
|
-
return err
|
|
1301
|
+
return err(coerceError(actionErrors));
|
|
1252
1302
|
}
|
|
1253
|
-
return err
|
|
1303
|
+
return err(toError("Error fetching component"));
|
|
1254
1304
|
});
|
|
1255
1305
|
}
|
|
1256
1306
|
convertFetchResponseToData(response) {
|
|
@@ -1261,7 +1311,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1261
1311
|
(json) => {
|
|
1262
1312
|
return this.processFetchReturnValue(json);
|
|
1263
1313
|
},
|
|
1264
|
-
(reason) => err
|
|
1314
|
+
(reason) => err(toError(reason))
|
|
1265
1315
|
).finally(() => {
|
|
1266
1316
|
try {
|
|
1267
1317
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1270,7 +1320,7 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1270
1320
|
});
|
|
1271
1321
|
} else {
|
|
1272
1322
|
return this.coerceError(response2).then((coercedError) => {
|
|
1273
|
-
return err
|
|
1323
|
+
return err(coercedError);
|
|
1274
1324
|
}).finally(() => {
|
|
1275
1325
|
try {
|
|
1276
1326
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1279,10 +1329,11 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
1279
1329
|
});
|
|
1280
1330
|
}
|
|
1281
1331
|
},
|
|
1282
|
-
(reason) => err
|
|
1332
|
+
(reason) => err(toError(reason))
|
|
1283
1333
|
);
|
|
1284
1334
|
}
|
|
1285
1335
|
}
|
|
1336
|
+
|
|
1286
1337
|
class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
1287
1338
|
constructor(services) {
|
|
1288
1339
|
super(services);
|
|
@@ -1291,11 +1342,11 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1291
1342
|
readFromCache(cache) {
|
|
1292
1343
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1293
1344
|
if (data.isErr()) {
|
|
1294
|
-
return resolvedPromiseLike
|
|
1295
|
-
err
|
|
1345
|
+
return resolvedPromiseLike(
|
|
1346
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1296
1347
|
);
|
|
1297
1348
|
}
|
|
1298
|
-
return resolvedPromiseLike
|
|
1349
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1299
1350
|
}
|
|
1300
1351
|
writeToCache(cache, networkResult) {
|
|
1301
1352
|
if (networkResult.isOk()) {
|
|
@@ -1304,7 +1355,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1304
1355
|
this.buildWriteInput(networkResult.value)
|
|
1305
1356
|
);
|
|
1306
1357
|
}
|
|
1307
|
-
return resolvedPromiseLike
|
|
1358
|
+
return resolvedPromiseLike(void 0);
|
|
1308
1359
|
}
|
|
1309
1360
|
}
|
|
1310
1361
|
function buildServiceDescriptor$o() {
|
|
@@ -1315,19 +1366,6 @@ function buildServiceDescriptor$o() {
|
|
|
1315
1366
|
};
|
|
1316
1367
|
}
|
|
1317
1368
|
|
|
1318
|
-
function applyOperationRequestOptions$1(init, operationType, requestOptions) {
|
|
1319
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1320
|
-
return init;
|
|
1321
|
-
}
|
|
1322
|
-
return {
|
|
1323
|
-
...init,
|
|
1324
|
-
onestore: {
|
|
1325
|
-
...requestOptions,
|
|
1326
|
-
...init?.onestore,
|
|
1327
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
1369
|
class HttpCacheControlCommand extends CacheControlCommand {
|
|
1332
1370
|
constructor(services) {
|
|
1333
1371
|
super(services);
|
|
@@ -1349,7 +1387,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1349
1387
|
input,
|
|
1350
1388
|
init
|
|
1351
1389
|
]) {
|
|
1352
|
-
return [input, applyOperationRequestOptions
|
|
1390
|
+
return [input, applyOperationRequestOptions(init, this.operationType, this.requestOptions)];
|
|
1353
1391
|
}
|
|
1354
1392
|
fetch() {
|
|
1355
1393
|
try {
|
|
@@ -1357,7 +1395,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1357
1395
|
this.services.fetch(...this.withRequestOptions(this.fetchParams))
|
|
1358
1396
|
);
|
|
1359
1397
|
} catch (reason) {
|
|
1360
|
-
return resolvedPromiseLike
|
|
1398
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1361
1399
|
}
|
|
1362
1400
|
}
|
|
1363
1401
|
isSemanticNullResponse(response) {
|
|
@@ -1373,7 +1411,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1373
1411
|
return toError(errorResponse.statusText);
|
|
1374
1412
|
}
|
|
1375
1413
|
processFetchReturnValue(json) {
|
|
1376
|
-
return ok
|
|
1414
|
+
return ok(json);
|
|
1377
1415
|
}
|
|
1378
1416
|
convertFetchResponseToData(response) {
|
|
1379
1417
|
return response.then(
|
|
@@ -1381,10 +1419,10 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1381
1419
|
if (response2.ok) {
|
|
1382
1420
|
let resultPromise;
|
|
1383
1421
|
if (this.isSemanticNullResponse(response2)) {
|
|
1384
|
-
resultPromise = Promise.resolve(ok
|
|
1422
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1385
1423
|
} else if (this.isUndeclaredNoBodyResponse(response2)) {
|
|
1386
1424
|
resultPromise = Promise.resolve(
|
|
1387
|
-
err
|
|
1425
|
+
err(
|
|
1388
1426
|
toError(
|
|
1389
1427
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1390
1428
|
)
|
|
@@ -1395,7 +1433,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1395
1433
|
(json) => {
|
|
1396
1434
|
return this.processFetchReturnValue(json);
|
|
1397
1435
|
},
|
|
1398
|
-
(reason) => err
|
|
1436
|
+
(reason) => err(toError(reason))
|
|
1399
1437
|
);
|
|
1400
1438
|
}
|
|
1401
1439
|
return resultPromise.finally(() => {
|
|
@@ -1406,7 +1444,7 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1406
1444
|
});
|
|
1407
1445
|
} else {
|
|
1408
1446
|
return this.coerceError(response2).then((coercedError) => {
|
|
1409
|
-
return err
|
|
1447
|
+
return err(coercedError);
|
|
1410
1448
|
}).finally(() => {
|
|
1411
1449
|
try {
|
|
1412
1450
|
this.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1415,10 +1453,11 @@ class HttpCacheControlCommand extends CacheControlCommand {
|
|
|
1415
1453
|
});
|
|
1416
1454
|
}
|
|
1417
1455
|
},
|
|
1418
|
-
(reason) => err
|
|
1456
|
+
(reason) => err(toError(reason))
|
|
1419
1457
|
);
|
|
1420
1458
|
}
|
|
1421
1459
|
}
|
|
1460
|
+
|
|
1422
1461
|
class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
1423
1462
|
constructor(services) {
|
|
1424
1463
|
super(services);
|
|
@@ -1427,11 +1466,11 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1427
1466
|
readFromCache(cache) {
|
|
1428
1467
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1429
1468
|
if (data.isErr()) {
|
|
1430
|
-
return resolvedPromiseLike
|
|
1431
|
-
err
|
|
1469
|
+
return resolvedPromiseLike(
|
|
1470
|
+
err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`))
|
|
1432
1471
|
);
|
|
1433
1472
|
}
|
|
1434
|
-
return resolvedPromiseLike
|
|
1473
|
+
return resolvedPromiseLike(ok(data.value));
|
|
1435
1474
|
}
|
|
1436
1475
|
writeToCache(cache, networkResult) {
|
|
1437
1476
|
if (networkResult.isOk()) {
|
|
@@ -1440,7 +1479,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1440
1479
|
this.buildWriteInput(networkResult.value)
|
|
1441
1480
|
);
|
|
1442
1481
|
}
|
|
1443
|
-
return resolvedPromiseLike
|
|
1482
|
+
return resolvedPromiseLike(void 0);
|
|
1444
1483
|
}
|
|
1445
1484
|
}
|
|
1446
1485
|
function buildServiceDescriptor$n() {
|
|
@@ -1451,64 +1490,6 @@ function buildServiceDescriptor$n() {
|
|
|
1451
1490
|
};
|
|
1452
1491
|
}
|
|
1453
1492
|
|
|
1454
|
-
class NetworkCommand extends BaseCommand {
|
|
1455
|
-
constructor(services) {
|
|
1456
|
-
super();
|
|
1457
|
-
this.services = services;
|
|
1458
|
-
this.subscriptions = [];
|
|
1459
|
-
this.exposeSubscribeAndRefresh = false;
|
|
1460
|
-
}
|
|
1461
|
-
execute() {
|
|
1462
|
-
const result = this.fetch();
|
|
1463
|
-
if (this.exposeSubscribeAndRefresh) {
|
|
1464
|
-
return this.fetchSubscribableResult(result);
|
|
1465
|
-
}
|
|
1466
|
-
return result;
|
|
1467
|
-
}
|
|
1468
|
-
fetchSubscribableResult(res) {
|
|
1469
|
-
return res.then((networkResult) => {
|
|
1470
|
-
return buildSubscribableResult$1(
|
|
1471
|
-
networkResult,
|
|
1472
|
-
(cb) => {
|
|
1473
|
-
this.subscriptions.push(cb);
|
|
1474
|
-
return () => {
|
|
1475
|
-
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
1476
|
-
};
|
|
1477
|
-
},
|
|
1478
|
-
() => this.refresh()
|
|
1479
|
-
);
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
refresh() {
|
|
1483
|
-
return this.execute().then((newResult) => {
|
|
1484
|
-
if (isSubscribableResult(newResult)) {
|
|
1485
|
-
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
1486
|
-
this.subscriptions.forEach((cb) => {
|
|
1487
|
-
try {
|
|
1488
|
-
cb(value);
|
|
1489
|
-
} catch {
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
return ok$2(void 0);
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
async afterRequestHooks(_options) {
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
function applyOperationRequestOptions(init, operationType, requestOptions) {
|
|
1500
|
-
if (operationType === void 0 && requestOptions === void 0) {
|
|
1501
|
-
return init;
|
|
1502
|
-
}
|
|
1503
|
-
return {
|
|
1504
|
-
...init,
|
|
1505
|
-
onestore: {
|
|
1506
|
-
...requestOptions,
|
|
1507
|
-
...init?.onestore,
|
|
1508
|
-
...operationType !== void 0 && { retrySafe: operationType === "query" }
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
}
|
|
1512
1493
|
function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
1513
1494
|
try {
|
|
1514
1495
|
const {
|
|
@@ -1523,7 +1504,7 @@ function fetchFromNetwork(getRequest, hooks, contextSeed) {
|
|
|
1523
1504
|
const fetchCall = initWithSeed === void 0 ? services.fetch(input) : services.fetch(input, initWithSeed);
|
|
1524
1505
|
return convertFetchResponseToData(fetchCall, hooks);
|
|
1525
1506
|
} catch (reason) {
|
|
1526
|
-
return resolvedPromiseLike
|
|
1507
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1527
1508
|
}
|
|
1528
1509
|
}
|
|
1529
1510
|
function convertFetchResponseToData(response, hooks) {
|
|
@@ -1532,10 +1513,10 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1532
1513
|
if (response2.ok) {
|
|
1533
1514
|
let resultPromise;
|
|
1534
1515
|
if (hooks.isSemanticNullResponse(response2)) {
|
|
1535
|
-
resultPromise = Promise.resolve(ok
|
|
1516
|
+
resultPromise = Promise.resolve(ok(null));
|
|
1536
1517
|
} else if (hooks.isProtocolNoBodyStatus(response2.status) && !hooks.isSemanticNullResponse(response2)) {
|
|
1537
1518
|
resultPromise = Promise.resolve(
|
|
1538
|
-
err
|
|
1519
|
+
err(
|
|
1539
1520
|
toError(
|
|
1540
1521
|
`Unexpected ${response2.status} response: no-content status was not declared in the API specification. Declare this response in your OAS without a content property.`
|
|
1541
1522
|
)
|
|
@@ -1543,8 +1524,8 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1543
1524
|
);
|
|
1544
1525
|
} else {
|
|
1545
1526
|
resultPromise = response2.json().then(
|
|
1546
|
-
(json) => ok
|
|
1547
|
-
(reason) => err
|
|
1527
|
+
(json) => ok(json),
|
|
1528
|
+
(reason) => err(toError(reason))
|
|
1548
1529
|
);
|
|
1549
1530
|
}
|
|
1550
1531
|
return resultPromise.finally(() => {
|
|
@@ -1555,7 +1536,7 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1555
1536
|
});
|
|
1556
1537
|
} else {
|
|
1557
1538
|
return hooks.coerceError(response2).then((coercedError) => {
|
|
1558
|
-
return err
|
|
1539
|
+
return err(coercedError);
|
|
1559
1540
|
}).finally(() => {
|
|
1560
1541
|
try {
|
|
1561
1542
|
hooks.afterRequestHooks({ statusCode: response2.status });
|
|
@@ -1564,12 +1545,12 @@ function convertFetchResponseToData(response, hooks) {
|
|
|
1564
1545
|
});
|
|
1565
1546
|
}
|
|
1566
1547
|
},
|
|
1567
|
-
(reason) => err
|
|
1548
|
+
(reason) => err(toError(reason))
|
|
1568
1549
|
);
|
|
1569
1550
|
}
|
|
1570
1551
|
function completeRefresh(result, getSubscriptions, options = {}) {
|
|
1571
1552
|
const { previousResult } = options;
|
|
1572
|
-
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals
|
|
1553
|
+
if (!options.suppressEqualSuccesses || result.isErr() || !previousResult || previousResult.isErr() || !deepEquals(previousResult.value, result.value)) {
|
|
1573
1554
|
const subscriptions = getSubscriptions();
|
|
1574
1555
|
const callbacks = options.skipRemovedSubscriptions ? [...subscriptions] : subscriptions;
|
|
1575
1556
|
callbacks.forEach((callback) => {
|
|
@@ -1580,7 +1561,7 @@ function completeRefresh(result, getSubscriptions, options = {}) {
|
|
|
1580
1561
|
}
|
|
1581
1562
|
});
|
|
1582
1563
|
}
|
|
1583
|
-
return options.reportFailure && result.isErr() ? result : ok
|
|
1564
|
+
return options.reportFailure && result.isErr() ? result : ok(void 0);
|
|
1584
1565
|
}
|
|
1585
1566
|
function isAbortableCommand(command) {
|
|
1586
1567
|
return !!command && typeof command === "object" && "isAbortableCommand" in command && command.isAbortableCommand === true;
|
|
@@ -1690,8 +1671,8 @@ const _FetchNetworkCommand = class _FetchNetworkCommand extends NetworkCommand {
|
|
|
1690
1671
|
}
|
|
1691
1672
|
refresh() {
|
|
1692
1673
|
return this.execute().then((newResult) => {
|
|
1693
|
-
if (!isSubscribableResult(newResult)) return ok
|
|
1694
|
-
const result = newResult.isOk() ? ok
|
|
1674
|
+
if (!isSubscribableResult(newResult)) return ok(void 0);
|
|
1675
|
+
const result = newResult.isOk() ? ok(newResult.value.data) : err(newResult.error.failure);
|
|
1695
1676
|
return completeRefresh(result, () => this.subscriptions);
|
|
1696
1677
|
});
|
|
1697
1678
|
}
|
|
@@ -1726,21 +1707,21 @@ class StreamingCommand extends BaseCommand {
|
|
|
1726
1707
|
try {
|
|
1727
1708
|
return this.convertFetchStreamResponseToData(this.services.fetch(...this.fetchParams));
|
|
1728
1709
|
} catch (reason) {
|
|
1729
|
-
return resolvedPromiseLike
|
|
1710
|
+
return resolvedPromiseLike(err(toError(reason)));
|
|
1730
1711
|
}
|
|
1731
1712
|
}
|
|
1732
1713
|
convertFetchStreamResponseToData(response) {
|
|
1733
1714
|
return response.then(
|
|
1734
1715
|
(response2) => {
|
|
1735
1716
|
if (response2.ok && response2.body) {
|
|
1736
|
-
return ok
|
|
1717
|
+
return ok(this.decodeByteStream(response2.body));
|
|
1737
1718
|
} else {
|
|
1738
|
-
return err
|
|
1719
|
+
return err(
|
|
1739
1720
|
toError(response2.ok ? "Response body not present" : response2.statusText)
|
|
1740
1721
|
);
|
|
1741
1722
|
}
|
|
1742
1723
|
},
|
|
1743
|
-
(reason) => err
|
|
1724
|
+
(reason) => err(toError(reason))
|
|
1744
1725
|
);
|
|
1745
1726
|
}
|
|
1746
1727
|
}
|
|
@@ -2155,12 +2136,7 @@ function buildServiceDescriptor$i(logger) {
|
|
|
2155
2136
|
};
|
|
2156
2137
|
}
|
|
2157
2138
|
|
|
2158
|
-
|
|
2159
|
-
function deepCopy$1(x) {
|
|
2160
|
-
const stringified = stringify$2(x);
|
|
2161
|
-
return stringified ? parse$1(stringified) : void 0;
|
|
2162
|
-
}
|
|
2163
|
-
let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
2139
|
+
class DefaultRecordableCache {
|
|
2164
2140
|
constructor(baseCache) {
|
|
2165
2141
|
this.baseCache = baseCache;
|
|
2166
2142
|
this.keysRead = /* @__PURE__ */ new Set();
|
|
@@ -2179,7 +2155,7 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2179
2155
|
this.missingKeysRead.add(key);
|
|
2180
2156
|
}
|
|
2181
2157
|
if (options?.copy) {
|
|
2182
|
-
return deepCopy
|
|
2158
|
+
return deepCopy(value);
|
|
2183
2159
|
}
|
|
2184
2160
|
return value;
|
|
2185
2161
|
}
|
|
@@ -2205,13 +2181,13 @@ let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
|
2205
2181
|
return new DefaultRecordableCache(this);
|
|
2206
2182
|
}
|
|
2207
2183
|
filter(predicate) {
|
|
2208
|
-
return new DefaultFilteredCache
|
|
2184
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2209
2185
|
}
|
|
2210
2186
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2211
|
-
return new FixedTimeWritableCache
|
|
2187
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2212
2188
|
}
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2189
|
+
}
|
|
2190
|
+
class DefaultFilteredCache {
|
|
2215
2191
|
constructor(baseCache, predicate) {
|
|
2216
2192
|
this.baseCache = baseCache;
|
|
2217
2193
|
this.predicate = predicate;
|
|
@@ -2223,7 +2199,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2223
2199
|
const result = this.baseCache.get(key);
|
|
2224
2200
|
if (result && this.predicate(key, result)) {
|
|
2225
2201
|
if (options?.copy) {
|
|
2226
|
-
return deepCopy
|
|
2202
|
+
return deepCopy(result);
|
|
2227
2203
|
}
|
|
2228
2204
|
return result;
|
|
2229
2205
|
}
|
|
@@ -2245,7 +2221,7 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2245
2221
|
return this.getFilteredEntries();
|
|
2246
2222
|
}
|
|
2247
2223
|
record() {
|
|
2248
|
-
return new DefaultRecordableCache
|
|
2224
|
+
return new DefaultRecordableCache(this);
|
|
2249
2225
|
}
|
|
2250
2226
|
filter(predicate) {
|
|
2251
2227
|
return new DefaultFilteredCache(this, predicate);
|
|
@@ -2265,10 +2241,10 @@ let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
|
2265
2241
|
return filteredKeySet;
|
|
2266
2242
|
}
|
|
2267
2243
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2268
|
-
return new FixedTimeWritableCache
|
|
2244
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2269
2245
|
}
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2246
|
+
}
|
|
2247
|
+
class FixedTimeWritableCache {
|
|
2272
2248
|
constructor(baseCache, generatedTime) {
|
|
2273
2249
|
this.baseCache = baseCache;
|
|
2274
2250
|
this.generatedTime = generatedTime;
|
|
@@ -2304,22 +2280,22 @@ let FixedTimeWritableCache$1 = class FixedTimeWritableCache {
|
|
|
2304
2280
|
return this.baseCache.entries();
|
|
2305
2281
|
}
|
|
2306
2282
|
record() {
|
|
2307
|
-
return new DefaultRecordableCache
|
|
2283
|
+
return new DefaultRecordableCache(this);
|
|
2308
2284
|
}
|
|
2309
2285
|
filter(predicate) {
|
|
2310
|
-
return new DefaultFilteredCache
|
|
2286
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2311
2287
|
}
|
|
2312
2288
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2313
2289
|
return new FixedTimeWritableCache(this, generatedTime);
|
|
2314
2290
|
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2291
|
+
}
|
|
2292
|
+
class DefaultCache {
|
|
2317
2293
|
constructor() {
|
|
2318
2294
|
this.data = {};
|
|
2319
2295
|
}
|
|
2320
2296
|
get(key, options) {
|
|
2321
2297
|
if (options?.copy) {
|
|
2322
|
-
return deepCopy
|
|
2298
|
+
return deepCopy(this.data[key]);
|
|
2323
2299
|
}
|
|
2324
2300
|
return this.data[key];
|
|
2325
2301
|
}
|
|
@@ -2381,20 +2357,20 @@ let DefaultCache$1 = class DefaultCache {
|
|
|
2381
2357
|
return Object.entries(this.data);
|
|
2382
2358
|
}
|
|
2383
2359
|
record() {
|
|
2384
|
-
return new DefaultRecordableCache
|
|
2360
|
+
return new DefaultRecordableCache(this);
|
|
2385
2361
|
}
|
|
2386
2362
|
filter(predicate) {
|
|
2387
|
-
return new DefaultFilteredCache
|
|
2363
|
+
return new DefaultFilteredCache(this, predicate);
|
|
2388
2364
|
}
|
|
2389
2365
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2390
|
-
return new FixedTimeWritableCache
|
|
2366
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
2391
2367
|
}
|
|
2392
|
-
}
|
|
2368
|
+
}
|
|
2393
2369
|
function buildServiceDescriptor$h() {
|
|
2394
2370
|
return {
|
|
2395
2371
|
type: "cache",
|
|
2396
2372
|
version: "1.0",
|
|
2397
|
-
service: new DefaultCache
|
|
2373
|
+
service: new DefaultCache()
|
|
2398
2374
|
};
|
|
2399
2375
|
}
|
|
2400
2376
|
|
|
@@ -2422,7 +2398,7 @@ class NoCacheCacheControlStrategy extends CacheControlStrategy {
|
|
|
2422
2398
|
const tempCache = this.filteredCache;
|
|
2423
2399
|
return new Promise(async (resolve, reject) => {
|
|
2424
2400
|
try {
|
|
2425
|
-
let readResult = ok
|
|
2401
|
+
let readResult = ok(void 0);
|
|
2426
2402
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2427
2403
|
if (rfnResult) {
|
|
2428
2404
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2460,13 +2436,13 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2460
2436
|
startTime,
|
|
2461
2437
|
options?.instrumentationAttributes
|
|
2462
2438
|
);
|
|
2463
|
-
return ok
|
|
2439
|
+
return ok(void 0);
|
|
2464
2440
|
}
|
|
2465
2441
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2466
2442
|
const tempCache = this.filteredCache;
|
|
2467
2443
|
return new Promise(async (resolve, reject) => {
|
|
2468
2444
|
try {
|
|
2469
|
-
let readResult = ok
|
|
2445
|
+
let readResult = ok(void 0);
|
|
2470
2446
|
for await (const rfnResult of this.requestRunner.requestFromNetwork()) {
|
|
2471
2447
|
if (rfnResult) {
|
|
2472
2448
|
const result = await this.services.cacheInclusionPolicy.write({
|
|
@@ -2474,7 +2450,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2474
2450
|
writeToL1: (l1) => this.requestRunner.writeToCache(l1, rfnResult)
|
|
2475
2451
|
});
|
|
2476
2452
|
if (result.isErr()) {
|
|
2477
|
-
return resolve(err
|
|
2453
|
+
return resolve(err(result.error));
|
|
2478
2454
|
}
|
|
2479
2455
|
}
|
|
2480
2456
|
readResult = await this.services.cacheInclusionPolicy.read({
|
|
@@ -2482,7 +2458,7 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2482
2458
|
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2483
2459
|
});
|
|
2484
2460
|
if (readResult.isOk()) {
|
|
2485
|
-
resolve(ok
|
|
2461
|
+
resolve(ok(void 0));
|
|
2486
2462
|
}
|
|
2487
2463
|
}
|
|
2488
2464
|
return resolve(readResult);
|
|
@@ -2534,7 +2510,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2534
2510
|
startTime,
|
|
2535
2511
|
options?.instrumentationAttributes
|
|
2536
2512
|
);
|
|
2537
|
-
return ok
|
|
2513
|
+
return ok(void 0);
|
|
2538
2514
|
}
|
|
2539
2515
|
this.collectCacheMissInstrumentation(startTime, options?.instrumentationAttributes);
|
|
2540
2516
|
const error = new UserVisibleError(
|
|
@@ -2542,7 +2518,7 @@ class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
|
2542
2518
|
error: "Cache miss for only-if-cached request"
|
|
2543
2519
|
})
|
|
2544
2520
|
);
|
|
2545
|
-
return err
|
|
2521
|
+
return err(error);
|
|
2546
2522
|
});
|
|
2547
2523
|
}
|
|
2548
2524
|
get expiredChecks() {
|
|
@@ -2647,14 +2623,14 @@ class DefaultPubSubService {
|
|
|
2647
2623
|
return;
|
|
2648
2624
|
}
|
|
2649
2625
|
const returnVal = subscription.callback.call(subscription, event);
|
|
2650
|
-
if (isPromiseLike
|
|
2626
|
+
if (isPromiseLike(returnVal)) {
|
|
2651
2627
|
promises.push(returnVal);
|
|
2652
2628
|
}
|
|
2653
2629
|
});
|
|
2654
2630
|
if (promises.length > 0) {
|
|
2655
2631
|
return Promise.all(promises).then(() => void 0);
|
|
2656
2632
|
}
|
|
2657
|
-
return resolvedPromiseLike
|
|
2633
|
+
return resolvedPromiseLike(void 0);
|
|
2658
2634
|
}
|
|
2659
2635
|
getSubscriptions(event) {
|
|
2660
2636
|
const eventTypeSubscriptions = this.subscriptions.get(event.type);
|
|
@@ -2783,7 +2759,7 @@ function buildServiceDescriptor$d(luvio) {
|
|
|
2783
2759
|
},
|
|
2784
2760
|
};
|
|
2785
2761
|
}
|
|
2786
|
-
// version: 1.
|
|
2762
|
+
// version: 1.471.0-2898c91740
|
|
2787
2763
|
|
|
2788
2764
|
class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheControlCommand {
|
|
2789
2765
|
constructor(config, documentRootType, services) {
|
|
@@ -2822,15 +2798,15 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2822
2798
|
}
|
|
2823
2799
|
processAuraReturnValue(auraReturnValue) {
|
|
2824
2800
|
if (this.responseHasErrors(auraReturnValue)) {
|
|
2825
|
-
return err
|
|
2801
|
+
return err(new UserVisibleError(auraReturnValue));
|
|
2826
2802
|
}
|
|
2827
|
-
return ok
|
|
2803
|
+
return ok(auraReturnValue);
|
|
2828
2804
|
}
|
|
2829
2805
|
processFetchReturnValue(json) {
|
|
2830
2806
|
if (this.responseHasErrors(json)) {
|
|
2831
|
-
return err
|
|
2807
|
+
return err(new UserVisibleError(json));
|
|
2832
2808
|
}
|
|
2833
|
-
return ok
|
|
2809
|
+
return ok(json);
|
|
2834
2810
|
}
|
|
2835
2811
|
/**
|
|
2836
2812
|
* Optional body wrapper name for aura requests.
|
|
@@ -2891,14 +2867,14 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2891
2867
|
),
|
|
2892
2868
|
(errs) => this.coerceAuraErrors(errs)
|
|
2893
2869
|
).then((result) => {
|
|
2894
|
-
return buildSubscribableResult
|
|
2870
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
2895
2871
|
});
|
|
2896
2872
|
} else if (this.shouldUseFetch()) {
|
|
2897
2873
|
const params = this.withRequestOptions(this.originalFetchParams);
|
|
2898
2874
|
try {
|
|
2899
2875
|
return this.convertFetchResponseToData(this.services.fetch(...params)).then(
|
|
2900
2876
|
(result) => {
|
|
2901
|
-
return buildSubscribableResult
|
|
2877
|
+
return buildSubscribableResult(
|
|
2902
2878
|
result,
|
|
2903
2879
|
this.buildSubscribe(),
|
|
2904
2880
|
() => this.refresh()
|
|
@@ -2906,18 +2882,18 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2906
2882
|
}
|
|
2907
2883
|
);
|
|
2908
2884
|
} catch (reason) {
|
|
2909
|
-
return resolvedPromiseLike
|
|
2910
|
-
buildSubscribableResult
|
|
2911
|
-
err
|
|
2885
|
+
return resolvedPromiseLike(
|
|
2886
|
+
buildSubscribableResult(
|
|
2887
|
+
err(toError(reason)),
|
|
2912
2888
|
this.buildSubscribe(),
|
|
2913
2889
|
() => this.refresh()
|
|
2914
2890
|
)
|
|
2915
2891
|
);
|
|
2916
2892
|
}
|
|
2917
2893
|
}
|
|
2918
|
-
return resolvedPromiseLike
|
|
2919
|
-
buildSubscribableResult
|
|
2920
|
-
err
|
|
2894
|
+
return resolvedPromiseLike(
|
|
2895
|
+
buildSubscribableResult(
|
|
2896
|
+
err(toError("Aura/Fetch network services not found")),
|
|
2921
2897
|
this.buildSubscribe(),
|
|
2922
2898
|
() => this.refresh()
|
|
2923
2899
|
)
|
|
@@ -3043,15 +3019,15 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3043
3019
|
}
|
|
3044
3020
|
processFetchReturnValue(json) {
|
|
3045
3021
|
if (json.errors && json.errors.length > 0) {
|
|
3046
|
-
return err
|
|
3022
|
+
return err(new UserVisibleError(json));
|
|
3047
3023
|
}
|
|
3048
|
-
return ok
|
|
3024
|
+
return ok(json);
|
|
3049
3025
|
}
|
|
3050
3026
|
runOriginalRequest() {
|
|
3051
3027
|
return this.convertFetchResponseToData(
|
|
3052
3028
|
this.services.fetch(...this.withRequestOptions(this.originalFetchParams))
|
|
3053
3029
|
).then((result) => {
|
|
3054
|
-
return buildSubscribableResult
|
|
3030
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
3055
3031
|
});
|
|
3056
3032
|
}
|
|
3057
3033
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -3122,7 +3098,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3122
3098
|
},
|
|
3123
3099
|
};
|
|
3124
3100
|
}
|
|
3125
|
-
// version: 1.
|
|
3101
|
+
// version: 1.471.0-2898c91740
|
|
3126
3102
|
|
|
3127
3103
|
class RetryService {
|
|
3128
3104
|
constructor(defaultRetryPolicy) {
|
|
@@ -3629,7 +3605,7 @@ class LegacyImperativeBindingsService {
|
|
|
3629
3605
|
return { invoke, subscribe };
|
|
3630
3606
|
}
|
|
3631
3607
|
}
|
|
3632
|
-
function buildServiceDescriptor$3
|
|
3608
|
+
function buildServiceDescriptor$3() {
|
|
3633
3609
|
return {
|
|
3634
3610
|
type: "legacyImperativeBindings",
|
|
3635
3611
|
version: "1.0",
|
|
@@ -3829,7 +3805,7 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
3829
3805
|
return { invoke, subscribe };
|
|
3830
3806
|
}
|
|
3831
3807
|
}
|
|
3832
|
-
function buildServiceDescriptor$1$
|
|
3808
|
+
function buildServiceDescriptor$1$1() {
|
|
3833
3809
|
return {
|
|
3834
3810
|
type: "graphQLLegacyImperativeBindings",
|
|
3835
3811
|
version: "1.0",
|
|
@@ -4048,7 +4024,7 @@ class CommandWireAdapterConstructor {
|
|
|
4048
4024
|
this.emit(updatedResult);
|
|
4049
4025
|
});
|
|
4050
4026
|
this.refresh = value.refresh;
|
|
4051
|
-
this.emit(ok
|
|
4027
|
+
this.emit(ok(value.data));
|
|
4052
4028
|
} else {
|
|
4053
4029
|
this.emit(result);
|
|
4054
4030
|
}
|
|
@@ -4122,7 +4098,7 @@ class LWCWireBindingsService {
|
|
|
4122
4098
|
};
|
|
4123
4099
|
}
|
|
4124
4100
|
}
|
|
4125
|
-
function buildServiceDescriptor$1
|
|
4101
|
+
function buildServiceDescriptor$1() {
|
|
4126
4102
|
return {
|
|
4127
4103
|
type: "lwcWireBindings",
|
|
4128
4104
|
version: "1.0",
|
|
@@ -4228,7 +4204,7 @@ class LWCGraphQLWireBindingsService {
|
|
|
4228
4204
|
};
|
|
4229
4205
|
}
|
|
4230
4206
|
}
|
|
4231
|
-
function buildServiceDescriptor$
|
|
4207
|
+
function buildServiceDescriptor$2() {
|
|
4232
4208
|
return {
|
|
4233
4209
|
type: "lwcGraphQLWireBindings",
|
|
4234
4210
|
version: "1.0",
|
|
@@ -4246,7 +4222,7 @@ function createLockerCompatibleWireConstructor(DelegateCtor) {
|
|
|
4246
4222
|
return Constructor;
|
|
4247
4223
|
}
|
|
4248
4224
|
function buildLWCWireBindingsServiceDescriptor() {
|
|
4249
|
-
const base = buildServiceDescriptor$1
|
|
4225
|
+
const base = buildServiceDescriptor$1();
|
|
4250
4226
|
const originalBind = base.service.bind.bind(base.service);
|
|
4251
4227
|
const bind = (...args) => {
|
|
4252
4228
|
const ctor = originalBind(...args);
|
|
@@ -4261,7 +4237,7 @@ function buildLWCWireBindingsServiceDescriptor() {
|
|
|
4261
4237
|
};
|
|
4262
4238
|
}
|
|
4263
4239
|
function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
4264
|
-
const base = buildServiceDescriptor$
|
|
4240
|
+
const base = buildServiceDescriptor$2();
|
|
4265
4241
|
const originalBind = base.service.bind.bind(base.service);
|
|
4266
4242
|
const bind = (...args) => {
|
|
4267
4243
|
const ctor = originalBind(...args);
|
|
@@ -4276,54 +4252,8 @@ function buildLWCGraphQLWireBindingsServiceDescriptor() {
|
|
|
4276
4252
|
};
|
|
4277
4253
|
}
|
|
4278
4254
|
|
|
4279
|
-
function e(
|
|
4280
|
-
|
|
4281
|
-
}
|
|
4282
|
-
e.prototype = new Error(), e.prototype.name = "InvalidCharacterError";
|
|
4283
|
-
var r = "undefined" != typeof window && window.atob && window.atob.bind(window) || function(r2) {
|
|
4284
|
-
var t2 = String(r2).replace(/=+$/, "");
|
|
4285
|
-
if (t2.length % 4 == 1) throw new e("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
4286
|
-
for (var n2, o2, a = 0, i = 0, c = ""; o2 = t2.charAt(i++); ~o2 && (n2 = a % 4 ? 64 * n2 + o2 : o2, a++ % 4) ? c += String.fromCharCode(255 & n2 >> (-2 * a & 6)) : 0) o2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o2);
|
|
4287
|
-
return c;
|
|
4288
|
-
};
|
|
4289
|
-
function t(e2) {
|
|
4290
|
-
var t2 = e2.replace(/-/g, "+").replace(/_/g, "/");
|
|
4291
|
-
switch (t2.length % 4) {
|
|
4292
|
-
case 0:
|
|
4293
|
-
break;
|
|
4294
|
-
case 2:
|
|
4295
|
-
t2 += "==";
|
|
4296
|
-
break;
|
|
4297
|
-
case 3:
|
|
4298
|
-
t2 += "=";
|
|
4299
|
-
break;
|
|
4300
|
-
default:
|
|
4301
|
-
throw "Illegal base64url string!";
|
|
4302
|
-
}
|
|
4303
|
-
try {
|
|
4304
|
-
return (function(e3) {
|
|
4305
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
4306
|
-
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
4307
|
-
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
4308
|
-
})));
|
|
4309
|
-
})(t2);
|
|
4310
|
-
} catch (e3) {
|
|
4311
|
-
return r(t2);
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4314
|
-
function n(e2) {
|
|
4315
|
-
this.message = e2;
|
|
4316
|
-
}
|
|
4317
|
-
function o(e2, r2) {
|
|
4318
|
-
if ("string" != typeof e2) throw new n("Invalid token specified");
|
|
4319
|
-
var o2 = true === (r2 = r2 || {}).header ? 0 : 1;
|
|
4320
|
-
try {
|
|
4321
|
-
return JSON.parse(t(e2.split(".")[o2]));
|
|
4322
|
-
} catch (e3) {
|
|
4323
|
-
throw new n("Invalid token specified: " + e3.message);
|
|
4324
|
-
}
|
|
4325
|
-
}
|
|
4326
|
-
n.prototype = new Error(), n.prototype.name = "InvalidTokenError";
|
|
4255
|
+
function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n("Invalid token specified");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(".")[o]))}catch(e){throw new n("Invalid token specified: "+e.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";
|
|
4256
|
+
|
|
4327
4257
|
class JwtToken {
|
|
4328
4258
|
/**
|
|
4329
4259
|
* Create a new JwtToken.
|
|
@@ -4567,8 +4497,8 @@ class JwtRepository {
|
|
|
4567
4497
|
this.observers.forEach((cb) => {
|
|
4568
4498
|
try {
|
|
4569
4499
|
cb.call(void 0, token);
|
|
4570
|
-
} catch (
|
|
4571
|
-
this.logger.error(
|
|
4500
|
+
} catch (e) {
|
|
4501
|
+
this.logger.error(e.message);
|
|
4572
4502
|
}
|
|
4573
4503
|
});
|
|
4574
4504
|
}
|
|
@@ -4649,163 +4579,6 @@ class JwtManager {
|
|
|
4649
4579
|
}
|
|
4650
4580
|
}
|
|
4651
4581
|
|
|
4652
|
-
function buildServiceDescriptor$2(interceptors = {
|
|
4653
|
-
request: [],
|
|
4654
|
-
retry: void 0,
|
|
4655
|
-
response: [],
|
|
4656
|
-
finally: []
|
|
4657
|
-
}, retryService) {
|
|
4658
|
-
return {
|
|
4659
|
-
type: "fetch",
|
|
4660
|
-
version: "1.0",
|
|
4661
|
-
service: function(input, init) {
|
|
4662
|
-
let contextSeed;
|
|
4663
|
-
let cleanInit = init;
|
|
4664
|
-
if (init !== void 0 && "__contextSeed" in init) {
|
|
4665
|
-
const { __contextSeed, ...initWithoutSeed } = init;
|
|
4666
|
-
contextSeed = __contextSeed;
|
|
4667
|
-
cleanInit = Object.keys(initWithoutSeed).length === 0 ? void 0 : initWithoutSeed;
|
|
4668
|
-
}
|
|
4669
|
-
const fetchArgs = cleanInit === void 0 ? [input] : [input, cleanInit];
|
|
4670
|
-
const baseContext = interceptors.createContext?.();
|
|
4671
|
-
const onestore = cleanInit?.onestore;
|
|
4672
|
-
const context = contextSeed === void 0 && onestore === void 0 ? baseContext : {
|
|
4673
|
-
...baseContext,
|
|
4674
|
-
...contextSeed,
|
|
4675
|
-
...onestore !== void 0 && { onestore }
|
|
4676
|
-
};
|
|
4677
|
-
const {
|
|
4678
|
-
request: requestInterceptors = [],
|
|
4679
|
-
retry: retryInterceptor = void 0,
|
|
4680
|
-
response: responseInterceptors = [],
|
|
4681
|
-
finally: finallyInterceptors = []
|
|
4682
|
-
} = interceptors;
|
|
4683
|
-
const pending = requestInterceptors.reduce(
|
|
4684
|
-
(previousPromise, interceptor) => previousPromise.then((args) => interceptor(args, context)),
|
|
4685
|
-
resolvedPromiseLike$2(fetchArgs)
|
|
4686
|
-
);
|
|
4687
|
-
return Promise.resolve(pending).then((args) => {
|
|
4688
|
-
if (retryInterceptor) {
|
|
4689
|
-
return retryInterceptor(args, retryService, context);
|
|
4690
|
-
} else {
|
|
4691
|
-
if (retryService) {
|
|
4692
|
-
return retryService.applyRetry(() => fetch(...args));
|
|
4693
|
-
}
|
|
4694
|
-
return fetch(...args);
|
|
4695
|
-
}
|
|
4696
|
-
}).then((response) => {
|
|
4697
|
-
return responseInterceptors.reduce(
|
|
4698
|
-
(previousPromise, interceptor) => previousPromise.then((response2) => interceptor(response2, context)),
|
|
4699
|
-
resolvedPromiseLike$2(response)
|
|
4700
|
-
);
|
|
4701
|
-
}).finally(() => {
|
|
4702
|
-
if (finallyInterceptors.length > 0) {
|
|
4703
|
-
return finallyInterceptors.reduce(
|
|
4704
|
-
(previousPromise, interceptor) => previousPromise.then(() => interceptor(context)),
|
|
4705
|
-
Promise.resolve()
|
|
4706
|
-
);
|
|
4707
|
-
}
|
|
4708
|
-
});
|
|
4709
|
-
}
|
|
4710
|
-
};
|
|
4711
|
-
}
|
|
4712
|
-
let textEncoder;
|
|
4713
|
-
function getTextEncoder() {
|
|
4714
|
-
if (!textEncoder) {
|
|
4715
|
-
if (typeof TextEncoder === "undefined") {
|
|
4716
|
-
throw new Error(
|
|
4717
|
-
"TextEncoder is not available in this environment. Request body compression requires TextEncoder support."
|
|
4718
|
-
);
|
|
4719
|
-
}
|
|
4720
|
-
textEncoder = new TextEncoder();
|
|
4721
|
-
}
|
|
4722
|
-
return textEncoder;
|
|
4723
|
-
}
|
|
4724
|
-
function buildCompressionInterceptor(defaultConfig) {
|
|
4725
|
-
return async (args) => {
|
|
4726
|
-
const [resource, options = {}] = args;
|
|
4727
|
-
const config = options.onestore?.compression ?? defaultConfig;
|
|
4728
|
-
if (config === void 0) {
|
|
4729
|
-
return resolvedPromiseLike$2(args);
|
|
4730
|
-
}
|
|
4731
|
-
const threshold = config.threshold ?? 1024;
|
|
4732
|
-
if (!options.body || typeof options.body !== "string") {
|
|
4733
|
-
return resolvedPromiseLike$2(args);
|
|
4734
|
-
}
|
|
4735
|
-
if (typeof CompressionStream === "undefined") {
|
|
4736
|
-
return resolvedPromiseLike$2(args);
|
|
4737
|
-
}
|
|
4738
|
-
const headers = new Headers(options.headers);
|
|
4739
|
-
if (headers.has("Content-Encoding")) {
|
|
4740
|
-
return resolvedPromiseLike$2(args);
|
|
4741
|
-
}
|
|
4742
|
-
const encodedBody = getTextEncoder().encode(options.body);
|
|
4743
|
-
if (encodedBody.byteLength < threshold) {
|
|
4744
|
-
return resolvedPromiseLike$2(args);
|
|
4745
|
-
}
|
|
4746
|
-
try {
|
|
4747
|
-
const stream = new Blob([encodedBody]).stream().pipeThrough(new CompressionStream(config.algorithm));
|
|
4748
|
-
const compressedBody = await new Response(stream).blob();
|
|
4749
|
-
headers.set("Content-Encoding", config.algorithm);
|
|
4750
|
-
headers.delete("Content-Length");
|
|
4751
|
-
const compressedOptions = {
|
|
4752
|
-
...options,
|
|
4753
|
-
body: compressedBody,
|
|
4754
|
-
headers
|
|
4755
|
-
};
|
|
4756
|
-
return resolvedPromiseLike$2([resource, compressedOptions]);
|
|
4757
|
-
} catch {
|
|
4758
|
-
return resolvedPromiseLike$2(args);
|
|
4759
|
-
}
|
|
4760
|
-
};
|
|
4761
|
-
}
|
|
4762
|
-
function setHeader(headerName, headerValue, [resource, options = {}], {
|
|
4763
|
-
throwOnExisting = false,
|
|
4764
|
-
errorMessage = `Unexpected ${headerName} header encountered`
|
|
4765
|
-
} = {}) {
|
|
4766
|
-
let hasHeaderBeenSet = false;
|
|
4767
|
-
if (resource instanceof Request && !options?.headers) {
|
|
4768
|
-
if (throwOnExisting && resource.headers.has(headerName)) {
|
|
4769
|
-
throw new Error(errorMessage);
|
|
4770
|
-
}
|
|
4771
|
-
resource.headers.set(headerName, headerValue);
|
|
4772
|
-
hasHeaderBeenSet = true;
|
|
4773
|
-
}
|
|
4774
|
-
if (options?.headers instanceof Headers) {
|
|
4775
|
-
if (throwOnExisting && options.headers.has(headerName)) {
|
|
4776
|
-
throw new Error(errorMessage);
|
|
4777
|
-
}
|
|
4778
|
-
options.headers.set(headerName, headerValue);
|
|
4779
|
-
} else {
|
|
4780
|
-
if (throwOnExisting && options?.headers && Reflect.has(options.headers, headerName)) {
|
|
4781
|
-
throw new Error(errorMessage);
|
|
4782
|
-
}
|
|
4783
|
-
if (!hasHeaderBeenSet) {
|
|
4784
|
-
options.headers = {
|
|
4785
|
-
...options?.headers,
|
|
4786
|
-
[headerName]: headerValue
|
|
4787
|
-
};
|
|
4788
|
-
}
|
|
4789
|
-
}
|
|
4790
|
-
return [resource, options];
|
|
4791
|
-
}
|
|
4792
|
-
const UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE = "Unexpected Authorization header encountered. To specify a custom Authorization header, use a Fetch service that is not configured with JwtRequestHeaderInterceptor";
|
|
4793
|
-
function setHeaderAuthorization({ token }, fetchParams) {
|
|
4794
|
-
const authorizationValue = `Bearer ${token}`;
|
|
4795
|
-
return setHeader("Authorization", authorizationValue, fetchParams, {
|
|
4796
|
-
throwOnExisting: true,
|
|
4797
|
-
errorMessage: UNEXPECTED_AUTHORIZATION_HEADER_MESSAGE
|
|
4798
|
-
});
|
|
4799
|
-
}
|
|
4800
|
-
function buildJwtRequestHeaderInterceptor(jwtManager, jwtRequestModifier = (_e, fetchArgs) => fetchArgs) {
|
|
4801
|
-
return (args) => {
|
|
4802
|
-
return resolvedPromiseLike$2(jwtManager.getJwt()).then((token) => {
|
|
4803
|
-
const fetchArgsWithRequestHeaderAuthorization = setHeaderAuthorization(token, args);
|
|
4804
|
-
return token.extraInfo ? jwtRequestModifier(token.extraInfo, fetchArgsWithRequestHeaderAuthorization) : fetchArgsWithRequestHeaderAuthorization;
|
|
4805
|
-
});
|
|
4806
|
-
};
|
|
4807
|
-
}
|
|
4808
|
-
|
|
4809
4582
|
var SnapshotState;
|
|
4810
4583
|
(function (SnapshotState) {
|
|
4811
4584
|
SnapshotState["Fulfilled"] = "Fulfilled";
|
|
@@ -5019,315 +4792,6 @@ function generateHeaders(headers) {
|
|
|
5019
4792
|
|
|
5020
4793
|
class CacheInclusionPolicyService {
|
|
5021
4794
|
}
|
|
5022
|
-
class Ok {
|
|
5023
|
-
constructor(value) {
|
|
5024
|
-
this.value = value;
|
|
5025
|
-
}
|
|
5026
|
-
isOk() {
|
|
5027
|
-
return true;
|
|
5028
|
-
}
|
|
5029
|
-
isErr() {
|
|
5030
|
-
return !this.isOk();
|
|
5031
|
-
}
|
|
5032
|
-
}
|
|
5033
|
-
const ok = (value) => new Ok(value);
|
|
5034
|
-
function setDifference(setA, setB) {
|
|
5035
|
-
const differenceSet = /* @__PURE__ */ new Set();
|
|
5036
|
-
for (const element of setA) {
|
|
5037
|
-
if (!setB.has(element)) {
|
|
5038
|
-
differenceSet.add(element);
|
|
5039
|
-
}
|
|
5040
|
-
}
|
|
5041
|
-
return differenceSet;
|
|
5042
|
-
}
|
|
5043
|
-
function addAllToSet(targetSet, sourceSet) {
|
|
5044
|
-
for (const element of sourceSet) {
|
|
5045
|
-
targetSet.add(element);
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
function resolvedPromiseLike(result) {
|
|
5049
|
-
if (isPromiseLike(result)) {
|
|
5050
|
-
return result.then(
|
|
5051
|
-
(nextResult) => nextResult
|
|
5052
|
-
);
|
|
5053
|
-
}
|
|
5054
|
-
return {
|
|
5055
|
-
then: (onFulfilled, _onRejected) => {
|
|
5056
|
-
try {
|
|
5057
|
-
return resolvedPromiseLike(onFulfilled(result));
|
|
5058
|
-
} catch (e) {
|
|
5059
|
-
if (onFulfilled === void 0) {
|
|
5060
|
-
return resolvedPromiseLike(result);
|
|
5061
|
-
}
|
|
5062
|
-
return rejectedPromiseLike(e);
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
|
-
};
|
|
5066
|
-
}
|
|
5067
|
-
function rejectedPromiseLike(reason) {
|
|
5068
|
-
if (isPromiseLike(reason)) {
|
|
5069
|
-
return reason.then(
|
|
5070
|
-
(nextResult) => nextResult
|
|
5071
|
-
);
|
|
5072
|
-
}
|
|
5073
|
-
return {
|
|
5074
|
-
then: (_onFulfilled, onRejected) => {
|
|
5075
|
-
if (typeof onRejected === "function") {
|
|
5076
|
-
try {
|
|
5077
|
-
return resolvedPromiseLike(onRejected(reason));
|
|
5078
|
-
} catch (e) {
|
|
5079
|
-
return rejectedPromiseLike(e);
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
return rejectedPromiseLike(reason);
|
|
5083
|
-
}
|
|
5084
|
-
};
|
|
5085
|
-
}
|
|
5086
|
-
function isPromiseLike(x) {
|
|
5087
|
-
return typeof x?.then === "function";
|
|
5088
|
-
}
|
|
5089
|
-
const { stringify: stringify$1, parse } = JSON;
|
|
5090
|
-
function deepCopy(x) {
|
|
5091
|
-
const stringified = stringify$1(x);
|
|
5092
|
-
return stringified ? parse(stringified) : void 0;
|
|
5093
|
-
}
|
|
5094
|
-
class DefaultRecordableCache {
|
|
5095
|
-
constructor(baseCache) {
|
|
5096
|
-
this.baseCache = baseCache;
|
|
5097
|
-
this.keysRead = /* @__PURE__ */ new Set();
|
|
5098
|
-
this.missingKeysRead = /* @__PURE__ */ new Set();
|
|
5099
|
-
this.keysUpdated = /* @__PURE__ */ new Set();
|
|
5100
|
-
this.metadataKeysUpdated = /* @__PURE__ */ new Set();
|
|
5101
|
-
}
|
|
5102
|
-
delete(key) {
|
|
5103
|
-
this.keysUpdated.add(key);
|
|
5104
|
-
this.baseCache.delete(key);
|
|
5105
|
-
}
|
|
5106
|
-
get(key, options) {
|
|
5107
|
-
this.keysRead.add(key);
|
|
5108
|
-
const value = this.baseCache.get(key);
|
|
5109
|
-
if (value === void 0) {
|
|
5110
|
-
this.missingKeysRead.add(key);
|
|
5111
|
-
}
|
|
5112
|
-
if (options?.copy) {
|
|
5113
|
-
return deepCopy(value);
|
|
5114
|
-
}
|
|
5115
|
-
return value;
|
|
5116
|
-
}
|
|
5117
|
-
set(key, value) {
|
|
5118
|
-
this.keysUpdated.add(key);
|
|
5119
|
-
this.metadataKeysUpdated.add(key);
|
|
5120
|
-
this.baseCache.set(key, value);
|
|
5121
|
-
}
|
|
5122
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5123
|
-
this.metadataKeysUpdated.add(key);
|
|
5124
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5125
|
-
}
|
|
5126
|
-
length() {
|
|
5127
|
-
return this.baseCache.length();
|
|
5128
|
-
}
|
|
5129
|
-
keys() {
|
|
5130
|
-
return this.baseCache.keys();
|
|
5131
|
-
}
|
|
5132
|
-
entries() {
|
|
5133
|
-
return this.baseCache.entries();
|
|
5134
|
-
}
|
|
5135
|
-
record() {
|
|
5136
|
-
return new DefaultRecordableCache(this);
|
|
5137
|
-
}
|
|
5138
|
-
filter(predicate) {
|
|
5139
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5140
|
-
}
|
|
5141
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5142
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5143
|
-
}
|
|
5144
|
-
}
|
|
5145
|
-
class DefaultFilteredCache {
|
|
5146
|
-
constructor(baseCache, predicate) {
|
|
5147
|
-
this.baseCache = baseCache;
|
|
5148
|
-
this.predicate = predicate;
|
|
5149
|
-
}
|
|
5150
|
-
delete(key) {
|
|
5151
|
-
this.baseCache.delete(key);
|
|
5152
|
-
}
|
|
5153
|
-
get(key, options) {
|
|
5154
|
-
const result = this.baseCache.get(key);
|
|
5155
|
-
if (result && this.predicate(key, result)) {
|
|
5156
|
-
if (options?.copy) {
|
|
5157
|
-
return deepCopy(result);
|
|
5158
|
-
}
|
|
5159
|
-
return result;
|
|
5160
|
-
}
|
|
5161
|
-
return void 0;
|
|
5162
|
-
}
|
|
5163
|
-
set(key, value) {
|
|
5164
|
-
this.baseCache.set(key, value);
|
|
5165
|
-
}
|
|
5166
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5167
|
-
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
5168
|
-
}
|
|
5169
|
-
length() {
|
|
5170
|
-
return this.getFilteredKeys().size;
|
|
5171
|
-
}
|
|
5172
|
-
keys() {
|
|
5173
|
-
return this.getFilteredKeys();
|
|
5174
|
-
}
|
|
5175
|
-
entries() {
|
|
5176
|
-
return this.getFilteredEntries();
|
|
5177
|
-
}
|
|
5178
|
-
record() {
|
|
5179
|
-
return new DefaultRecordableCache(this);
|
|
5180
|
-
}
|
|
5181
|
-
filter(predicate) {
|
|
5182
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5183
|
-
}
|
|
5184
|
-
getFilteredEntries() {
|
|
5185
|
-
return this.baseCache.entries().filter(([key, _value]) => {
|
|
5186
|
-
return this.get(key);
|
|
5187
|
-
});
|
|
5188
|
-
}
|
|
5189
|
-
getFilteredKeys() {
|
|
5190
|
-
const filteredKeySet = /* @__PURE__ */ new Set();
|
|
5191
|
-
this.baseCache.keys().forEach((key) => {
|
|
5192
|
-
if (this.get(key)) {
|
|
5193
|
-
filteredKeySet.add(key);
|
|
5194
|
-
}
|
|
5195
|
-
});
|
|
5196
|
-
return filteredKeySet;
|
|
5197
|
-
}
|
|
5198
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5199
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5200
|
-
}
|
|
5201
|
-
}
|
|
5202
|
-
class FixedTimeWritableCache {
|
|
5203
|
-
constructor(baseCache, generatedTime) {
|
|
5204
|
-
this.baseCache = baseCache;
|
|
5205
|
-
this.generatedTime = generatedTime;
|
|
5206
|
-
}
|
|
5207
|
-
delete(key) {
|
|
5208
|
-
this.baseCache.delete(key);
|
|
5209
|
-
}
|
|
5210
|
-
get(key, options) {
|
|
5211
|
-
return this.baseCache.get(key, options);
|
|
5212
|
-
}
|
|
5213
|
-
set(key, value) {
|
|
5214
|
-
this.baseCache.set(key, {
|
|
5215
|
-
...value,
|
|
5216
|
-
metadata: {
|
|
5217
|
-
...value.metadata,
|
|
5218
|
-
cacheControl: { ...value.metadata.cacheControl, generatedTime: this.generatedTime }
|
|
5219
|
-
}
|
|
5220
|
-
});
|
|
5221
|
-
}
|
|
5222
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5223
|
-
this.baseCache.setMetadata(key, {
|
|
5224
|
-
...cacheControlMetadata,
|
|
5225
|
-
generatedTime: this.generatedTime
|
|
5226
|
-
});
|
|
5227
|
-
}
|
|
5228
|
-
length() {
|
|
5229
|
-
return this.baseCache.length();
|
|
5230
|
-
}
|
|
5231
|
-
keys() {
|
|
5232
|
-
return this.baseCache.keys();
|
|
5233
|
-
}
|
|
5234
|
-
entries() {
|
|
5235
|
-
return this.baseCache.entries();
|
|
5236
|
-
}
|
|
5237
|
-
record() {
|
|
5238
|
-
return new DefaultRecordableCache(this);
|
|
5239
|
-
}
|
|
5240
|
-
filter(predicate) {
|
|
5241
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5242
|
-
}
|
|
5243
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5244
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5245
|
-
}
|
|
5246
|
-
}
|
|
5247
|
-
class DefaultCache {
|
|
5248
|
-
constructor() {
|
|
5249
|
-
this.data = {};
|
|
5250
|
-
}
|
|
5251
|
-
get(key, options) {
|
|
5252
|
-
if (options?.copy) {
|
|
5253
|
-
return deepCopy(this.data[key]);
|
|
5254
|
-
}
|
|
5255
|
-
return this.data[key];
|
|
5256
|
-
}
|
|
5257
|
-
/**
|
|
5258
|
-
* Adds the specified key/value to the cache.
|
|
5259
|
-
*
|
|
5260
|
-
* @param key key at which to store value
|
|
5261
|
-
* @param entry value to be stored
|
|
5262
|
-
*/
|
|
5263
|
-
set(key, entry) {
|
|
5264
|
-
if (entry.metadata.cacheControl.type === "no-store") {
|
|
5265
|
-
return;
|
|
5266
|
-
}
|
|
5267
|
-
this.data[key] = {
|
|
5268
|
-
...entry,
|
|
5269
|
-
metadata: {
|
|
5270
|
-
...entry.metadata,
|
|
5271
|
-
type: entry.metadata.type || {
|
|
5272
|
-
namespace: "OneStore:Internal",
|
|
5273
|
-
name: "UnknownType"
|
|
5274
|
-
},
|
|
5275
|
-
cacheControl: {
|
|
5276
|
-
generatedTime: Date.now() / 1e3,
|
|
5277
|
-
...entry.metadata.cacheControl
|
|
5278
|
-
}
|
|
5279
|
-
}
|
|
5280
|
-
};
|
|
5281
|
-
}
|
|
5282
|
-
/**
|
|
5283
|
-
* Removes the cache entry associated with the specified key.
|
|
5284
|
-
*
|
|
5285
|
-
* @param key key to be removed from the store
|
|
5286
|
-
*/
|
|
5287
|
-
delete(key) {
|
|
5288
|
-
delete this.data[key];
|
|
5289
|
-
}
|
|
5290
|
-
/**
|
|
5291
|
-
* Sets the metadata for the specified key if the key is in cache.
|
|
5292
|
-
* If the key doesn't exist, it does nothing.
|
|
5293
|
-
*
|
|
5294
|
-
* @param key key at which to store metadata
|
|
5295
|
-
* @param cacheControlMetadata metadata to be stored
|
|
5296
|
-
*/
|
|
5297
|
-
setMetadata(key, cacheControlMetadata) {
|
|
5298
|
-
if (key in this.data) {
|
|
5299
|
-
this.data[key].metadata.cacheControl = {
|
|
5300
|
-
generatedTime: Date.now() / 1e3,
|
|
5301
|
-
...cacheControlMetadata
|
|
5302
|
-
};
|
|
5303
|
-
}
|
|
5304
|
-
}
|
|
5305
|
-
length() {
|
|
5306
|
-
return this.keys().size;
|
|
5307
|
-
}
|
|
5308
|
-
keys() {
|
|
5309
|
-
return new Set(Object.keys(this.data));
|
|
5310
|
-
}
|
|
5311
|
-
entries() {
|
|
5312
|
-
return Object.entries(this.data);
|
|
5313
|
-
}
|
|
5314
|
-
record() {
|
|
5315
|
-
return new DefaultRecordableCache(this);
|
|
5316
|
-
}
|
|
5317
|
-
filter(predicate) {
|
|
5318
|
-
return new DefaultFilteredCache(this, predicate);
|
|
5319
|
-
}
|
|
5320
|
-
buildFixedTimeWritableCache(generatedTime) {
|
|
5321
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
function buildServiceDescriptor$1() {
|
|
5325
|
-
return {
|
|
5326
|
-
type: "cache",
|
|
5327
|
-
version: "1.0",
|
|
5328
|
-
service: new DefaultCache()
|
|
5329
|
-
};
|
|
5330
|
-
}
|
|
5331
4795
|
class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
5332
4796
|
/**
|
|
5333
4797
|
* Reads data out of a 2 level inclusive store.
|
|
@@ -5359,7 +4823,7 @@ class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
|
5359
4823
|
*/
|
|
5360
4824
|
write(options) {
|
|
5361
4825
|
const { l1, writeToL1 } = options;
|
|
5362
|
-
const tempL1 = buildServiceDescriptor$
|
|
4826
|
+
const tempL1 = buildServiceDescriptor$h().service.record();
|
|
5363
4827
|
return writeToL1(tempL1).then(() => {
|
|
5364
4828
|
const keysToReviveRecordableCache = l1.record();
|
|
5365
4829
|
tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
|
|
@@ -6692,7 +6156,7 @@ function buildActionMarksSendInterceptor() {
|
|
|
6692
6156
|
if (context && context.instrumentationId) {
|
|
6693
6157
|
createActionStartMark(context);
|
|
6694
6158
|
}
|
|
6695
|
-
return resolvedPromiseLike
|
|
6159
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6696
6160
|
};
|
|
6697
6161
|
}
|
|
6698
6162
|
function buildLuvioActionMarksSendInterceptor() {
|
|
@@ -6700,7 +6164,7 @@ function buildLuvioActionMarksSendInterceptor() {
|
|
|
6700
6164
|
if (context && context.instrumentationId) {
|
|
6701
6165
|
createActionStartMark(context);
|
|
6702
6166
|
}
|
|
6703
|
-
return resolvedPromiseLike
|
|
6167
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6704
6168
|
};
|
|
6705
6169
|
}
|
|
6706
6170
|
|
|
@@ -6788,7 +6252,7 @@ function buildCsrfResourceStorage(getPreloadedToken) {
|
|
|
6788
6252
|
// Failures are ignored; memory stays authoritative.
|
|
6789
6253
|
const afterSeed = (write) => seeded.then(write).then(() => { }, () => { });
|
|
6790
6254
|
return {
|
|
6791
|
-
get: () => (loaded ? resolvedPromiseLike
|
|
6255
|
+
get: () => (loaded ? resolvedPromiseLike(currentToken) : seeded.then(() => currentToken)),
|
|
6792
6256
|
set: (value) => {
|
|
6793
6257
|
currentToken = value;
|
|
6794
6258
|
loaded = true;
|
|
@@ -6874,7 +6338,7 @@ function getCsrfToken() {
|
|
|
6874
6338
|
return token.then((value) => value, () => undefined);
|
|
6875
6339
|
}
|
|
6876
6340
|
catch {
|
|
6877
|
-
return resolvedPromiseLike
|
|
6341
|
+
return resolvedPromiseLike(undefined);
|
|
6878
6342
|
}
|
|
6879
6343
|
}
|
|
6880
6344
|
/**
|
|
@@ -6905,7 +6369,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6905
6369
|
return async (fetchArgs) => {
|
|
6906
6370
|
// Check if all required gates are enabled before running
|
|
6907
6371
|
if (!areCsrfGatesEnabled()) {
|
|
6908
|
-
return resolvedPromiseLike
|
|
6372
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6909
6373
|
}
|
|
6910
6374
|
// Only add CSRF token for mutating operations
|
|
6911
6375
|
if (isMutatingMethod(getFetchMethod(fetchArgs))) {
|
|
@@ -6915,7 +6379,7 @@ function buildCsrfTokenInterceptor() {
|
|
|
6915
6379
|
fetchArgs = setHeader(CSRF_TOKEN_HEADER, token, fetchArgs);
|
|
6916
6380
|
}
|
|
6917
6381
|
}
|
|
6918
|
-
return resolvedPromiseLike
|
|
6382
|
+
return resolvedPromiseLike(fetchArgs);
|
|
6919
6383
|
};
|
|
6920
6384
|
}
|
|
6921
6385
|
/**
|
|
@@ -6930,7 +6394,7 @@ function buildLuvioCsrfTokenInterceptor() {
|
|
|
6930
6394
|
return (resourceRequest) => {
|
|
6931
6395
|
// Check if all required gates are enabled before running
|
|
6932
6396
|
if (!areCsrfGatesEnabled()) {
|
|
6933
|
-
return resolvedPromiseLike
|
|
6397
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6934
6398
|
}
|
|
6935
6399
|
// Ensure headers object exists
|
|
6936
6400
|
if (!resourceRequest.headers) {
|
|
@@ -6942,7 +6406,7 @@ function buildLuvioCsrfTokenInterceptor() {
|
|
|
6942
6406
|
}
|
|
6943
6407
|
if (!isMutatingMethod(resourceRequest.method) ||
|
|
6944
6408
|
resourceRequest.headers[CSRF_TOKEN_HEADER]) {
|
|
6945
|
-
return resolvedPromiseLike
|
|
6409
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6946
6410
|
}
|
|
6947
6411
|
return getCsrfToken().then((token) => {
|
|
6948
6412
|
if (token) {
|
|
@@ -6963,7 +6427,7 @@ const ENTITY_ENCODING_DISABLED_VALUE = 'false';
|
|
|
6963
6427
|
*/
|
|
6964
6428
|
function buildEntityEncodingInterceptor() {
|
|
6965
6429
|
return (fetchArgs) => {
|
|
6966
|
-
return resolvedPromiseLike
|
|
6430
|
+
return resolvedPromiseLike(setHeader(ENTITY_ENCODING_HEADER, ENTITY_ENCODING_DISABLED_VALUE, fetchArgs));
|
|
6967
6431
|
};
|
|
6968
6432
|
}
|
|
6969
6433
|
/**
|
|
@@ -6979,7 +6443,7 @@ function buildLuvioEntityEncodingInterceptor() {
|
|
|
6979
6443
|
if (!resourceRequest.headers[ENTITY_ENCODING_HEADER]) {
|
|
6980
6444
|
resourceRequest.headers[ENTITY_ENCODING_HEADER] = ENTITY_ENCODING_DISABLED_VALUE;
|
|
6981
6445
|
}
|
|
6982
|
-
return resolvedPromiseLike
|
|
6446
|
+
return resolvedPromiseLike(resourceRequest);
|
|
6983
6447
|
};
|
|
6984
6448
|
}
|
|
6985
6449
|
|
|
@@ -6994,7 +6458,7 @@ const FIRST_PARTY_VALUE = 'platform-ui';
|
|
|
6994
6458
|
function buildFirstPartyHeaderInterceptor() {
|
|
6995
6459
|
return async (fetchArgs) => {
|
|
6996
6460
|
const returnedFetchArgs = setHeader(FIRST_PARTY_HEADER, FIRST_PARTY_VALUE, fetchArgs);
|
|
6997
|
-
return resolvedPromiseLike
|
|
6461
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
6998
6462
|
};
|
|
6999
6463
|
}
|
|
7000
6464
|
/**
|
|
@@ -7013,7 +6477,7 @@ function buildLuvioFirstPartyHeaderInterceptor() {
|
|
|
7013
6477
|
if (!resourceRequest.headers[FIRST_PARTY_HEADER]) {
|
|
7014
6478
|
resourceRequest.headers[FIRST_PARTY_HEADER] = FIRST_PARTY_VALUE;
|
|
7015
6479
|
}
|
|
7016
|
-
return resolvedPromiseLike
|
|
6480
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7017
6481
|
};
|
|
7018
6482
|
}
|
|
7019
6483
|
|
|
@@ -7061,7 +6525,7 @@ function buildLuvioIdempotencyKeyInterceptor() {
|
|
|
7061
6525
|
!resourceRequest.headers[IDEMPOTENCY_KEY_HEADER]) {
|
|
7062
6526
|
resourceRequest.headers[IDEMPOTENCY_KEY_HEADER] = mintIdempotencyKey();
|
|
7063
6527
|
}
|
|
7064
|
-
return resolvedPromiseLike
|
|
6528
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7065
6529
|
};
|
|
7066
6530
|
}
|
|
7067
6531
|
|
|
@@ -7144,9 +6608,9 @@ function buildJwtParameterizationInterceptor(jwtManager, jwtRequestModifier = (_
|
|
|
7144
6608
|
// interceptor handles it. This MUST be the first statement so non-opted-in
|
|
7145
6609
|
// SFAP commands observe no work at all.
|
|
7146
6610
|
if (mintParams === undefined) {
|
|
7147
|
-
return resolvedPromiseLike
|
|
6611
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7148
6612
|
}
|
|
7149
|
-
return resolvedPromiseLike
|
|
6613
|
+
return resolvedPromiseLike(jwtManager.getJwt(mintParams)).then((token) => {
|
|
7150
6614
|
const fetchArgsWithAuthorization = setHeaderAuthorization(token, fetchArgs);
|
|
7151
6615
|
return token.extraInfo
|
|
7152
6616
|
? jwtRequestModifier(token.extraInfo, fetchArgsWithAuthorization)
|
|
@@ -7172,7 +6636,7 @@ function buildLuvioPageScopedCacheRequestInterceptor() {
|
|
|
7172
6636
|
}
|
|
7173
6637
|
// Pass the headers to pageScopedCache which will mutate them
|
|
7174
6638
|
pageScopedCache.addHeader(resourceRequest.headers);
|
|
7175
|
-
return resolvedPromiseLike
|
|
6639
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7176
6640
|
};
|
|
7177
6641
|
}
|
|
7178
6642
|
|
|
@@ -7186,7 +6650,7 @@ function buildPageScopedCacheRequestInterceptor() {
|
|
|
7186
6650
|
Object.entries(pageScopedCacheHeaders).forEach(([key, value]) => {
|
|
7187
6651
|
returnedFetchArgs = setHeader(key, value, returnedFetchArgs);
|
|
7188
6652
|
});
|
|
7189
|
-
return resolvedPromiseLike
|
|
6653
|
+
return resolvedPromiseLike(returnedFetchArgs);
|
|
7190
6654
|
};
|
|
7191
6655
|
}
|
|
7192
6656
|
|
|
@@ -7201,7 +6665,7 @@ function buildTransportMarksSendInterceptor() {
|
|
|
7201
6665
|
context.startTime = performance.now();
|
|
7202
6666
|
createTransportStartMark(requestId);
|
|
7203
6667
|
}
|
|
7204
|
-
return resolvedPromiseLike
|
|
6668
|
+
return resolvedPromiseLike(fetchArgs);
|
|
7205
6669
|
};
|
|
7206
6670
|
}
|
|
7207
6671
|
function buildLuvioTransportMarksSendInterceptor() {
|
|
@@ -7212,7 +6676,7 @@ function buildLuvioTransportMarksSendInterceptor() {
|
|
|
7212
6676
|
context.startTime = performance.now();
|
|
7213
6677
|
createTransportStartMark(requestId);
|
|
7214
6678
|
}
|
|
7215
|
-
return resolvedPromiseLike
|
|
6679
|
+
return resolvedPromiseLike(resourceRequest);
|
|
7216
6680
|
};
|
|
7217
6681
|
}
|
|
7218
6682
|
function setLuvioRequestIdHeader(resourceRequest, requestId) {
|
|
@@ -8159,7 +7623,7 @@ class PrioritizedConfigService {
|
|
|
8159
7623
|
}
|
|
8160
7624
|
});
|
|
8161
7625
|
this.validated = errors.length === 0;
|
|
8162
|
-
return errors.length === 0 ? ok
|
|
7626
|
+
return errors.length === 0 ? ok(void 0) : err(errors);
|
|
8163
7627
|
}
|
|
8164
7628
|
// constructs a proxy for the given non-leaf object path in the config tree
|
|
8165
7629
|
buildReadonlyObjectProxy(path) {
|
|
@@ -8178,7 +7642,7 @@ class PrioritizedConfigService {
|
|
|
8178
7642
|
get: (_, property) => {
|
|
8179
7643
|
const propertyPath = [...path, property];
|
|
8180
7644
|
const value = this.valueFor(propertyPath);
|
|
8181
|
-
return typeof value === "object" && value !== null && !isArray$
|
|
7645
|
+
return typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value;
|
|
8182
7646
|
},
|
|
8183
7647
|
getOwnPropertyDescriptor: (target, property) => {
|
|
8184
7648
|
const propertyPath = [...path, property];
|
|
@@ -8186,7 +7650,7 @@ class PrioritizedConfigService {
|
|
|
8186
7650
|
return {
|
|
8187
7651
|
value: (
|
|
8188
7652
|
// TODO - need to wrap arrays in a Proxy as well
|
|
8189
|
-
typeof value === "object" && value !== null && !isArray$
|
|
7653
|
+
typeof value === "object" && value !== null && !isArray$3(value) ? this.buildReadonlyObjectProxy(propertyPath) : value
|
|
8190
7654
|
),
|
|
8191
7655
|
writable: false,
|
|
8192
7656
|
configurable: true,
|
|
@@ -8287,7 +7751,7 @@ function getEnvironmentSetting(name) {
|
|
|
8287
7751
|
}
|
|
8288
7752
|
return undefined;
|
|
8289
7753
|
}
|
|
8290
|
-
// version: 1.
|
|
7754
|
+
// version: 1.471.0-a0bc34effb
|
|
8291
7755
|
|
|
8292
7756
|
const auraClientService = getAuraClientService();
|
|
8293
7757
|
const defaultConfig = {
|
|
@@ -8742,7 +8206,7 @@ function buildLuvioThirdPartyTrackerRegisterInterceptor() {
|
|
|
8742
8206
|
return false;
|
|
8743
8207
|
});
|
|
8744
8208
|
}
|
|
8745
|
-
return resolvedPromiseLike
|
|
8209
|
+
return resolvedPromiseLike(resourceRequest);
|
|
8746
8210
|
};
|
|
8747
8211
|
}
|
|
8748
8212
|
|
|
@@ -8899,7 +8363,7 @@ function buildThirdPartyTrackerRegisterInterceptor() {
|
|
|
8899
8363
|
return false;
|
|
8900
8364
|
});
|
|
8901
8365
|
}
|
|
8902
|
-
return resolvedPromiseLike
|
|
8366
|
+
return resolvedPromiseLike(fetchArgs);
|
|
8903
8367
|
};
|
|
8904
8368
|
}
|
|
8905
8369
|
|
|
@@ -8996,7 +8460,7 @@ function prefetchSfapJwt() {
|
|
|
8996
8460
|
return Promise.resolve(undefined);
|
|
8997
8461
|
}
|
|
8998
8462
|
function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
8999
|
-
const jwtAuthorizedFetchService = buildServiceDescriptor$
|
|
8463
|
+
const jwtAuthorizedFetchService = buildServiceDescriptor$q({
|
|
9000
8464
|
createContext: createInstrumentationIdContext(),
|
|
9001
8465
|
request: [
|
|
9002
8466
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -9036,7 +8500,7 @@ function buildJwtAuthorizedSfapFetchServiceDescriptor(logger) {
|
|
|
9036
8500
|
* the Data360 command — the SFAP fleet never flows past this interceptor.
|
|
9037
8501
|
*/
|
|
9038
8502
|
function buildJwtAuthorizedData360FetchServiceDescriptor(logger) {
|
|
9039
|
-
const data360FetchService = buildServiceDescriptor$
|
|
8503
|
+
const data360FetchService = buildServiceDescriptor$q({
|
|
9040
8504
|
createContext: createInstrumentationIdContext(),
|
|
9041
8505
|
request: [
|
|
9042
8506
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -9066,7 +8530,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9066
8530
|
// we switch to JWT authentication this will need to change to incorporate the
|
|
9067
8531
|
// Interceptor here with the logic in buildJwtAuthorizedSfapFetchServiceDescriptor()
|
|
9068
8532
|
// above.
|
|
9069
|
-
...buildServiceDescriptor$
|
|
8533
|
+
...buildServiceDescriptor$q({
|
|
9070
8534
|
createContext: createInstrumentationIdContext(),
|
|
9071
8535
|
request: [
|
|
9072
8536
|
buildThirdPartyTrackerRegisterInterceptor(),
|
|
@@ -9082,9 +8546,9 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9082
8546
|
requestInit.method !== 'POST' ||
|
|
9083
8547
|
!requestInit.body ||
|
|
9084
8548
|
typeof requestInit.body !== 'string') {
|
|
9085
|
-
return resolvedPromiseLike
|
|
8549
|
+
return resolvedPromiseLike(args);
|
|
9086
8550
|
}
|
|
9087
|
-
return resolvedPromiseLike
|
|
8551
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt()).then((token) => {
|
|
9088
8552
|
// replace the body's instanceConfig.endpoint with the JWT's iss value
|
|
9089
8553
|
const body = JSON.parse(requestInit.body);
|
|
9090
8554
|
if (!body || !token.decodedInfo || !token.decodedInfo.iss) {
|
|
@@ -9119,7 +8583,7 @@ function buildCopilotFetchServiceDescriptor(logger) {
|
|
|
9119
8583
|
};
|
|
9120
8584
|
}
|
|
9121
8585
|
function buildUnauthorizedFetchServiceDescriptor() {
|
|
9122
|
-
const fetchService = buildServiceDescriptor$
|
|
8586
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9123
8587
|
createContext: createInstrumentationIdContext(),
|
|
9124
8588
|
// Per-request gzip (opt-in via `init.onestore.compression`).
|
|
9125
8589
|
request: [buildThirdPartyTrackerRegisterInterceptor(), buildCompressionInterceptor()],
|
|
@@ -9195,9 +8659,9 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9195
8659
|
context?.[JWT_MINT_PARAMS_SEED_KEY];
|
|
9196
8660
|
// No mint params → not a parameterized Data360 request. Nothing to do.
|
|
9197
8661
|
if (mintParams === undefined) {
|
|
9198
|
-
return resolvedPromiseLike
|
|
8662
|
+
return resolvedPromiseLike(fetchArgs);
|
|
9199
8663
|
}
|
|
9200
|
-
return resolvedPromiseLike
|
|
8664
|
+
return resolvedPromiseLike(sfapJwtManager.getJwt(mintParams)).then((token) => {
|
|
9201
8665
|
const [resource, request] = fetchArgs;
|
|
9202
8666
|
if (typeof resource !== 'string' && !(resource instanceof URL)) {
|
|
9203
8667
|
// istanbul ignore else: not exercised under NODE_ENV=production
|
|
@@ -9244,7 +8708,7 @@ function buildData360HostRewriteInterceptor(logger) {
|
|
|
9244
8708
|
*/
|
|
9245
8709
|
function buildGuardedLegacyJwtRequestInterceptor(logger) {
|
|
9246
8710
|
const legacyInterceptor = buildJwtRequestInterceptor(logger);
|
|
9247
|
-
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike
|
|
8711
|
+
return (args) => hasAuthorizationHeader(args) ? resolvedPromiseLike(args) : legacyInterceptor(args);
|
|
9248
8712
|
}
|
|
9249
8713
|
|
|
9250
8714
|
class NoComposedAdapterTypeError extends TypeError {
|
|
@@ -9342,12 +8806,12 @@ function getLexRuntimeDefaultInterceptorConfig(logger) {
|
|
|
9342
8806
|
};
|
|
9343
8807
|
}
|
|
9344
8808
|
function buildLexRuntimeDefaultFetchServiceDescriptor(logger, retryService) {
|
|
9345
|
-
const fetchService = buildServiceDescriptor$
|
|
8809
|
+
const fetchService = buildServiceDescriptor$q(getLexRuntimeDefaultInterceptorConfig(logger), retryService);
|
|
9346
8810
|
return { ...fetchService };
|
|
9347
8811
|
}
|
|
9348
8812
|
function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
9349
8813
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
9350
|
-
const fetchService = buildServiceDescriptor$
|
|
8814
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9351
8815
|
...config,
|
|
9352
8816
|
// Omit 5xx interceptor - allow 5xx responses to pass through
|
|
9353
8817
|
response: [
|
|
@@ -9363,7 +8827,7 @@ function buildLexRuntimeAllow5xxFetchServiceDescriptor(logger, retryService) {
|
|
|
9363
8827
|
}
|
|
9364
8828
|
function buildLexRuntimeCompressedFetchServiceDescriptor(logger, retryService) {
|
|
9365
8829
|
const config = getLexRuntimeDefaultInterceptorConfig(logger);
|
|
9366
|
-
const fetchService = buildServiceDescriptor$
|
|
8830
|
+
const fetchService = buildServiceDescriptor$q({
|
|
9367
8831
|
...config,
|
|
9368
8832
|
// Append compression interceptor last, after any body-modifying interceptors
|
|
9369
8833
|
request: [...config.request, buildCompressionInterceptor({ algorithm: 'gzip' })],
|
|
@@ -9537,7 +9001,7 @@ function initializeOneStore(luvio) {
|
|
|
9537
9001
|
buildServiceDescriptor$p(),
|
|
9538
9002
|
buildServiceDescriptor$e(),
|
|
9539
9003
|
buildServiceDescriptor$m(),
|
|
9540
|
-
buildServiceDescriptor$
|
|
9004
|
+
buildServiceDescriptor$r(),
|
|
9541
9005
|
buildServiceDescriptor$l(),
|
|
9542
9006
|
buildServiceDescriptor$k(),
|
|
9543
9007
|
buildServiceDescriptor$o(),
|
|
@@ -9554,9 +9018,9 @@ function initializeOneStore(luvio) {
|
|
|
9554
9018
|
buildServiceDescriptor$5(),
|
|
9555
9019
|
buildServiceDescriptor$4(),
|
|
9556
9020
|
buildServiceDescriptor$7(),
|
|
9557
|
-
buildServiceDescriptor$3
|
|
9021
|
+
buildServiceDescriptor$3(),
|
|
9558
9022
|
buildServiceDescriptor$2$1(),
|
|
9559
|
-
buildServiceDescriptor$1$
|
|
9023
|
+
buildServiceDescriptor$1$1(),
|
|
9560
9024
|
buildServiceDescriptor$6(),
|
|
9561
9025
|
buildLWCWireBindingsServiceDescriptor(),
|
|
9562
9026
|
buildLWCGraphQLWireBindingsServiceDescriptor(),
|
|
@@ -9588,4 +9052,4 @@ function ldsEngineCreator() {
|
|
|
9588
9052
|
}
|
|
9589
9053
|
|
|
9590
9054
|
export { PDL_ENGINE_REGISTRATION_ID, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory };
|
|
9591
|
-
// version: 1.
|
|
9055
|
+
// version: 1.471.0-2898c91740
|