brass-runtime 1.18.0 → 1.18.2
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/CHANGELOG.md +54 -0
- package/dist/agent/cli/main.cjs +31 -31
- package/dist/agent/cli/main.js +3 -3
- package/dist/agent/cli/main.mjs +3 -3
- package/dist/agent/index.cjs +4 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +3 -3
- package/dist/agent/index.mjs +3 -3
- package/dist/{chunk-PSEU65ND.js → chunk-2R3RVNS2.js} +6 -6
- package/dist/{chunk-ITZQ526U.mjs → chunk-3NKXUX4T.mjs} +2 -2
- package/dist/{chunk-JH4GI3DW.js → chunk-4PKBNG2H.js} +38 -18
- package/dist/{chunk-Z3PSSXP3.mjs → chunk-5RVHSBJ6.mjs} +292 -36
- package/dist/{chunk-QZ6QFJNM.mjs → chunk-5UBJT4RW.mjs} +4 -4
- package/dist/{chunk-7TXQJFZX.cjs → chunk-6STX4PS3.cjs} +13 -13
- package/dist/{chunk-VIFA4DPN.cjs → chunk-7FZUTJM3.cjs} +508 -252
- package/dist/{chunk-4YQHPIWJ.js → chunk-A6EG5WRL.js} +3 -3
- package/dist/{chunk-XSAHV5HQ.js → chunk-APQBU7TM.js} +264 -133
- package/dist/{chunk-RREBJX2S.mjs → chunk-AQQQFNYD.mjs} +38 -18
- package/dist/{chunk-AADFFVYS.js → chunk-B2VXVNIS.js} +1 -1
- package/dist/{chunk-R6WDSZA6.mjs → chunk-BLXBZ6RE.mjs} +1 -1
- package/dist/{chunk-ITG6I7ZS.js → chunk-C3CWI42G.js} +1 -1
- package/dist/{chunk-LXBU5E77.cjs → chunk-DV644N7P.cjs} +85 -85
- package/dist/{chunk-G5JTCFMI.mjs → chunk-EKLEDIVJ.mjs} +2 -2
- package/dist/{chunk-IBRHSH5H.js → chunk-EXBGIC66.js} +1 -1
- package/dist/{chunk-W6WR37HN.js → chunk-FC5N5QHJ.js} +2 -2
- package/dist/{chunk-6MLAZPBL.mjs → chunk-FNWOH2T2.js} +18 -6
- package/dist/{chunk-AJMKZXRB.cjs → chunk-FYWWU3Z7.cjs} +2 -2
- package/dist/{chunk-IFRBVMWJ.cjs → chunk-GOEO763K.cjs} +21 -21
- package/dist/{chunk-S4HHFUYP.js → chunk-GXOIUBKE.js} +2 -2
- package/dist/{chunk-BG5RNEA2.js → chunk-H4ZRUQZL.js} +4 -4
- package/dist/{chunk-OI4ESUMC.mjs → chunk-HW2CLRJ3.mjs} +6 -6
- package/dist/{chunk-3PHU7FWS.js → chunk-JWFOWPMB.js} +163 -155
- package/dist/{chunk-OT2TESZU.mjs → chunk-KAPZHDO4.mjs} +1 -1
- package/dist/{chunk-ELLF55ER.mjs → chunk-KDXNWGPB.mjs} +1 -1
- package/dist/{chunk-UUMKZJRJ.cjs → chunk-KPOL2YEO.cjs} +18 -6
- package/dist/{chunk-2SLT3X6G.cjs → chunk-MA74OYCI.cjs} +6 -6
- package/dist/{chunk-2QNREG6K.mjs → chunk-MUMBUXU6.mjs} +264 -133
- package/dist/{chunk-YTX2JYYP.cjs → chunk-NQW3YUFN.cjs} +18 -18
- package/dist/{chunk-3PFZGP23.cjs → chunk-OO7BGCC3.cjs} +54 -34
- package/dist/{chunk-QCOLAHU3.mjs → chunk-OX6MF7SZ.mjs} +163 -155
- package/dist/{chunk-KHACHFBQ.cjs → chunk-QBVS3UYN.cjs} +245 -237
- package/dist/{chunk-H5GYX7RZ.js → chunk-RZGB3DXR.js} +292 -36
- package/dist/{chunk-KRYP6CAE.mjs → chunk-URVS2OE2.mjs} +3 -3
- package/dist/{chunk-HCJ4S3YB.js → chunk-UZQ3BB6W.mjs} +18 -6
- package/dist/{chunk-N6QNSTWD.cjs → chunk-YQWZ7FZX.cjs} +5 -5
- package/dist/{chunk-5XADBMSU.cjs → chunk-Z2YIDHRI.cjs} +5 -5
- package/dist/{chunk-SSQJKDN3.cjs → chunk-ZDZNV6NA.cjs} +286 -155
- package/dist/core/index.cjs +14 -8
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +13 -7
- package/dist/core/index.mjs +13 -7
- package/dist/{defaultClient-DhpCQW9m.d.ts → defaultClient-Cid0JoUR.d.ts} +29 -4
- package/dist/{effect-CtUDl5M5.d.ts → effect-DnGUuhw6.d.ts} +22 -1
- package/dist/http/index.cjs +58 -54
- package/dist/http/index.d.ts +8 -8
- package/dist/http/index.js +11 -7
- package/dist/http/index.mjs +11 -7
- package/dist/http/testing.cjs +9 -9
- package/dist/http/testing.d.ts +4 -4
- package/dist/http/testing.js +5 -5
- package/dist/http/testing.mjs +5 -5
- package/dist/index.cjs +92 -86
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -8
- package/dist/index.mjs +14 -8
- package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
- package/dist/observability/index.cjs +10 -10
- package/dist/observability/index.d.ts +7 -7
- package/dist/observability/index.js +9 -9
- package/dist/observability/index.mjs +9 -9
- package/dist/perf/cli.cjs +26 -26
- package/dist/perf/cli.js +11 -11
- package/dist/perf/cli.mjs +11 -11
- package/dist/perf/index.cjs +13 -13
- package/dist/perf/index.js +11 -11
- package/dist/perf/index.mjs +11 -11
- package/dist/schema/index.cjs +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/index.mjs +1 -1
- package/dist/{server-C1zVmqE6.d.ts → server-Bf1zNYZk.d.ts} +4 -4
- package/dist/{stream-Bb4FTejt.d.ts → stream-I7bkvF7a.d.ts} +1 -1
- package/dist/{tracer-DzfuE6um.d.ts → tracer-DF83nLn6.d.ts} +2 -2
- package/dist/{tracing-BABA5arE.d.ts → tracing-CWV4gT0u.d.ts} +1 -1
- package/package.json +3 -2
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
var _chunkL6VB5N7Qcjs = require('./chunk-L6VB5N7Q.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkOO7BGCC3cjs = require('./chunk-OO7BGCC3.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk6STX4PS3cjs = require('./chunk-6STX4PS3.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkZDZNV6NAcjs = require('./chunk-ZDZNV6NA.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -33,7 +33,7 @@ var _chunkMVGUEJ5Zcjs = require('./chunk-MVGUEJ5Z.cjs');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkKPOL2YEOcjs = require('./chunk-KPOL2YEO.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
|
|
@@ -346,7 +346,7 @@ var WasmRetryPlannerBridge = class {
|
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
348
|
function makeWasmRetryPlanner() {
|
|
349
|
-
const mod =
|
|
349
|
+
const mod = _chunkZDZNV6NAcjs.resolveWasmModule.call(void 0, );
|
|
350
350
|
const Ctor = _optionalChain([mod, 'optionalAccess', _9 => _9.BrassWasmRetryPlanner]);
|
|
351
351
|
if (!Ctor) throw new Error("brass-runtime wasm retry planner is not available. Run npm run build:wasm first.");
|
|
352
352
|
return new WasmRetryPlannerBridge(Ctor);
|
|
@@ -528,7 +528,7 @@ var withRetry = (p) => (next) => {
|
|
|
528
528
|
_optionalChain([wasmPlanner, 'optionalAccess', _15 => _15.drop, 'call', _16 => _16(id)]);
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
-
const scheduleDriver = effectivePolicy.schedule ?
|
|
531
|
+
const scheduleDriver = effectivePolicy.schedule ? _chunk6STX4PS3cjs.makeScheduleDriver.call(void 0, effectivePolicy.schedule, {
|
|
532
532
|
name: _nullishCoalesce(effectivePolicy.schedule.name, () => ( "http.retry")),
|
|
533
533
|
startedAtMs: startedAt,
|
|
534
534
|
onDecision: effectivePolicy.onScheduleDecision
|
|
@@ -606,7 +606,7 @@ var WasmHttpPermitPoolBridge = (_class = class {
|
|
|
606
606
|
}
|
|
607
607
|
}, _class);
|
|
608
608
|
function makeWasmHttpPermitPool(options) {
|
|
609
|
-
const mod =
|
|
609
|
+
const mod = _chunkZDZNV6NAcjs.resolveWasmModule.call(void 0, );
|
|
610
610
|
const Ctor = _optionalChain([mod, 'optionalAccess', _17 => _17.BrassWasmHttpPermitPool]);
|
|
611
611
|
if (!Ctor) throw new Error("brass-runtime wasm HTTP permit pool is not available. Run npm run build:wasm first.");
|
|
612
612
|
return new WasmHttpPermitPoolBridge(Ctor, options);
|
|
@@ -678,6 +678,18 @@ var HttpConcurrencyPool = (_class2 = class {
|
|
|
678
678
|
acquire(key, signal) {
|
|
679
679
|
return this.wasm ? this.acquireWasm(key, signal) : this.acquireJs(key, signal);
|
|
680
680
|
}
|
|
681
|
+
/** Try synchronous acquire. Returns lease directly or undefined if contended. */
|
|
682
|
+
tryAcquireSync(key, signal) {
|
|
683
|
+
if (this.wasm) return void 0;
|
|
684
|
+
if (signal.aborted) return void 0;
|
|
685
|
+
const state = this.getState(key);
|
|
686
|
+
if (state.running < this.concurrency) {
|
|
687
|
+
state.running++;
|
|
688
|
+
state.acquired++;
|
|
689
|
+
return this.makeLease(state);
|
|
690
|
+
}
|
|
691
|
+
return void 0;
|
|
692
|
+
}
|
|
681
693
|
stats() {
|
|
682
694
|
const keys = Array.from(this.states.values()).map((state) => ({
|
|
683
695
|
key: state.key,
|
|
@@ -1516,6 +1528,24 @@ var AdaptiveLimiter = (_class5 = class {
|
|
|
1516
1528
|
this.enqueueWaiter(state, waiter);
|
|
1517
1529
|
});
|
|
1518
1530
|
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Try to acquire a concurrency slot synchronously.
|
|
1533
|
+
* Returns a lease directly if under the limit, or undefined if contended/aborted/destroyed.
|
|
1534
|
+
* This avoids Promise.resolve() allocation and microtask scheduling on the uncontended path.
|
|
1535
|
+
*/
|
|
1536
|
+
tryAcquireSync(key, signal) {
|
|
1537
|
+
if (this.destroyed) return void 0;
|
|
1538
|
+
if (signal.aborted) return void 0;
|
|
1539
|
+
const state = this.getOrCreateState(key);
|
|
1540
|
+
this.touch(state);
|
|
1541
|
+
if (state.inFlight < state.limit) {
|
|
1542
|
+
state.inFlight++;
|
|
1543
|
+
state.acquired++;
|
|
1544
|
+
state.rejectionStreak = 0;
|
|
1545
|
+
return this.makeLease(state);
|
|
1546
|
+
}
|
|
1547
|
+
return void 0;
|
|
1548
|
+
}
|
|
1519
1549
|
/**
|
|
1520
1550
|
* Get stats for a specific key, or aggregate stats if no key is provided.
|
|
1521
1551
|
*/
|
|
@@ -2194,6 +2224,9 @@ var mergeHeadersUnder = (under) => (req) => Lens.over(Request.headers, (h) => ({
|
|
|
2194
2224
|
var setHeaderIfMissing = (k, v) => (req) => Lens.over(Request.headers, (h) => h[k] ? h : { ...h, [k]: v })(req);
|
|
2195
2225
|
|
|
2196
2226
|
// src/http/transport.ts
|
|
2227
|
+
function isPromiseTransportDirect(transport) {
|
|
2228
|
+
return transport.__promiseTransport === true;
|
|
2229
|
+
}
|
|
2197
2230
|
var isTaggedHttpError = (error) => {
|
|
2198
2231
|
return isHttpError(error);
|
|
2199
2232
|
};
|
|
@@ -2281,6 +2314,7 @@ var linkAbortSignals = (...signals) => {
|
|
|
2281
2314
|
};
|
|
2282
2315
|
};
|
|
2283
2316
|
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
2317
|
+
var isThenable = (value) => value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2284
2318
|
var hasMethod = (value, name) => typeof value === "object" && value !== null && typeof value[name] === "function";
|
|
2285
2319
|
var defaultPromiseBody = (response, mode) => {
|
|
2286
2320
|
if (mode === "json" && hasMethod(response, "json")) return response.json();
|
|
@@ -2325,49 +2359,107 @@ var toPromiseTransportResponse = (bodyText, info) => ({
|
|
|
2325
2359
|
...info.transportMeta !== void 0 ? { transportMeta: info.transportMeta } : {}
|
|
2326
2360
|
});
|
|
2327
2361
|
function makePromiseHttpTransport(config) {
|
|
2328
|
-
|
|
2362
|
+
const transport = (context) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
2329
2363
|
let done = false;
|
|
2364
|
+
const signal = context.signal;
|
|
2365
|
+
const needsAbortListener = signal !== globalThis.__brassNoopSignal;
|
|
2366
|
+
let abort;
|
|
2330
2367
|
const finish = (exit) => {
|
|
2331
2368
|
if (done) return;
|
|
2332
2369
|
done = true;
|
|
2333
|
-
|
|
2370
|
+
if (needsAbortListener && abort) signal.removeEventListener("abort", abort);
|
|
2334
2371
|
cb(exit);
|
|
2335
2372
|
};
|
|
2336
2373
|
const fail = (error) => finish({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(error) });
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
abort();
|
|
2374
|
+
if (signal.aborted) {
|
|
2375
|
+
fail(abortErrorForSignal(signal));
|
|
2340
2376
|
return;
|
|
2341
2377
|
}
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2378
|
+
if (needsAbortListener) {
|
|
2379
|
+
abort = () => fail(abortErrorForSignal(signal));
|
|
2380
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
2381
|
+
}
|
|
2382
|
+
const startedAt = nowMs();
|
|
2383
|
+
let requestPromise;
|
|
2384
|
+
try {
|
|
2385
|
+
const result = config.request(context);
|
|
2386
|
+
requestPromise = isThenable(result) ? result : Promise.resolve(result);
|
|
2387
|
+
} catch (error) {
|
|
2388
|
+
if (signal.aborted) {
|
|
2389
|
+
fail(abortErrorForSignal(signal));
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
fail(_nullishCoalesce(_optionalChain([config, 'access', _47 => _47.error, 'optionalCall', _48 => _48(error, context)]), () => ( normalizeHttpError(error, { signal }))));
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
requestPromise.then(
|
|
2396
|
+
(raw) => {
|
|
2397
|
+
if (done) return;
|
|
2347
2398
|
const durationMs = Math.round(nowMs() - startedAt);
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2399
|
+
try {
|
|
2400
|
+
const r = config.response(raw, context, { startedAt, durationMs });
|
|
2401
|
+
if (!isThenable(r)) {
|
|
2402
|
+
const mapped = r;
|
|
2403
|
+
finish({
|
|
2404
|
+
_tag: "Success",
|
|
2405
|
+
value: mapped.ms !== void 0 ? mapped : { ...mapped, ms: durationMs }
|
|
2406
|
+
});
|
|
2407
|
+
return;
|
|
2354
2408
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2409
|
+
r.then(
|
|
2410
|
+
(m) => {
|
|
2411
|
+
if (done) return;
|
|
2412
|
+
finish({
|
|
2413
|
+
_tag: "Success",
|
|
2414
|
+
value: m.ms !== void 0 ? m : { ...m, ms: durationMs }
|
|
2415
|
+
});
|
|
2416
|
+
},
|
|
2417
|
+
(error) => {
|
|
2418
|
+
if (done) return;
|
|
2419
|
+
if (signal.aborted) {
|
|
2420
|
+
fail(abortErrorForSignal(signal));
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
fail(_nullishCoalesce(_optionalChain([config, 'access', _49 => _49.error, 'optionalCall', _50 => _50(error, context)]), () => ( normalizeHttpError(error, { signal }))));
|
|
2424
|
+
}
|
|
2425
|
+
);
|
|
2426
|
+
} catch (error) {
|
|
2427
|
+
if (signal.aborted) {
|
|
2428
|
+
fail(abortErrorForSignal(signal));
|
|
2429
|
+
return;
|
|
2430
|
+
}
|
|
2431
|
+
fail(_nullishCoalesce(_optionalChain([config, 'access', _51 => _51.error, 'optionalCall', _52 => _52(error, context)]), () => ( normalizeHttpError(error, { signal }))));
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
(error) => {
|
|
2435
|
+
if (done) return;
|
|
2436
|
+
if (signal.aborted) {
|
|
2437
|
+
fail(abortErrorForSignal(signal));
|
|
2359
2438
|
return;
|
|
2360
2439
|
}
|
|
2361
|
-
fail(_nullishCoalesce(_optionalChain([config, 'access',
|
|
2440
|
+
fail(_nullishCoalesce(_optionalChain([config, 'access', _53 => _53.error, 'optionalCall', _54 => _54(error, context)]), () => ( normalizeHttpError(error, { signal }))));
|
|
2362
2441
|
}
|
|
2363
|
-
|
|
2364
|
-
void run();
|
|
2442
|
+
);
|
|
2365
2443
|
return () => {
|
|
2366
2444
|
if (done) return;
|
|
2367
2445
|
done = true;
|
|
2368
|
-
|
|
2446
|
+
if (needsAbortListener && abort) signal.removeEventListener("abort", abort);
|
|
2369
2447
|
};
|
|
2370
2448
|
});
|
|
2449
|
+
const marked = transport;
|
|
2450
|
+
marked.__promiseTransport = true;
|
|
2451
|
+
marked.requestDirect = async (context) => {
|
|
2452
|
+
const startedAt = nowMs();
|
|
2453
|
+
try {
|
|
2454
|
+
const raw = await config.request(context);
|
|
2455
|
+
const durationMs = Math.round(nowMs() - startedAt);
|
|
2456
|
+
const mapped = await config.response(raw, context, { startedAt, durationMs });
|
|
2457
|
+
return { ...mapped, ms: _nullishCoalesce(mapped.ms, () => ( durationMs)) };
|
|
2458
|
+
} catch (error) {
|
|
2459
|
+
throw _nullishCoalesce(_optionalChain([config, 'access', _55 => _55.error, 'optionalCall', _56 => _56(error, context)]), () => ( normalizeHttpError(error, { signal: context.signal })));
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
return marked;
|
|
2371
2463
|
}
|
|
2372
2464
|
function makePromiseHttpTransportBodyBuilder(config) {
|
|
2373
2465
|
const makeBodyTransport = (mode, body, responseMapper, currentConfig = config) => makePromiseHttpTransport({
|
|
@@ -2428,7 +2520,7 @@ function makeFetchTransport() {
|
|
|
2428
2520
|
return;
|
|
2429
2521
|
}
|
|
2430
2522
|
const localController = new AbortController();
|
|
2431
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access',
|
|
2523
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.signal]), localController.signal);
|
|
2432
2524
|
let done = false;
|
|
2433
2525
|
const finish = (exit) => {
|
|
2434
2526
|
if (done) return;
|
|
@@ -2483,7 +2575,7 @@ function makeFetchStreamTransport() {
|
|
|
2483
2575
|
return;
|
|
2484
2576
|
}
|
|
2485
2577
|
const localController = new AbortController();
|
|
2486
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access',
|
|
2578
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.signal]), localController.signal);
|
|
2487
2579
|
let done = false;
|
|
2488
2580
|
let cleanupTransferredToBody = false;
|
|
2489
2581
|
const cleanup = () => {
|
|
@@ -2508,7 +2600,7 @@ function makeFetchStreamTransport() {
|
|
|
2508
2600
|
});
|
|
2509
2601
|
const headers = headersOf(response);
|
|
2510
2602
|
const latencyMs = Math.round(nowMs() - started);
|
|
2511
|
-
const body =
|
|
2603
|
+
const body = _chunkOO7BGCC3cjs.streamFromReadableStream.call(void 0, response.body, normalizeHttpError, {
|
|
2512
2604
|
signal: linkedSignal.signal,
|
|
2513
2605
|
onRelease: linkedSignal.cleanup
|
|
2514
2606
|
});
|
|
@@ -2542,181 +2634,181 @@ function makeFetchStreamTransport() {
|
|
|
2542
2634
|
}
|
|
2543
2635
|
|
|
2544
2636
|
// src/http/configValidation.ts
|
|
2545
|
-
var fn =
|
|
2546
|
-
var object =
|
|
2637
|
+
var fn = _chunkKPOL2YEOcjs.Schema.custom((value) => typeof value === "function", "function");
|
|
2638
|
+
var object = _chunkKPOL2YEOcjs.Schema.custom(
|
|
2547
2639
|
(value) => typeof value === "object" && value !== null && !Array.isArray(value),
|
|
2548
2640
|
"object"
|
|
2549
2641
|
);
|
|
2550
|
-
var keyResolver =
|
|
2551
|
-
|
|
2642
|
+
var keyResolver = _chunkKPOL2YEOcjs.Schema.union([
|
|
2643
|
+
_chunkKPOL2YEOcjs.Schema.enum(["global", "origin", "host"]),
|
|
2552
2644
|
fn
|
|
2553
2645
|
]);
|
|
2554
|
-
var headroomStrategyConfig =
|
|
2555
|
-
|
|
2556
|
-
|
|
2646
|
+
var headroomStrategyConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2647
|
+
_chunkKPOL2YEOcjs.Schema.number({ min: 1 }),
|
|
2648
|
+
_chunkKPOL2YEOcjs.Schema.enum(["fixed", "proportional"]),
|
|
2557
2649
|
fn,
|
|
2558
|
-
|
|
2559
|
-
type:
|
|
2560
|
-
value:
|
|
2650
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2651
|
+
type: _chunkKPOL2YEOcjs.Schema.literal("fixed"),
|
|
2652
|
+
value: _chunkKPOL2YEOcjs.Schema.number({ min: 1 }).optional()
|
|
2561
2653
|
}, { unknownKeys: "passthrough" }),
|
|
2562
|
-
|
|
2563
|
-
type:
|
|
2564
|
-
ratio:
|
|
2565
|
-
min:
|
|
2566
|
-
max:
|
|
2654
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2655
|
+
type: _chunkKPOL2YEOcjs.Schema.literal("proportional"),
|
|
2656
|
+
ratio: _chunkKPOL2YEOcjs.Schema.number({ min: 0 }).refine((n) => n > 0, "ratio must be > 0").optional(),
|
|
2657
|
+
min: _chunkKPOL2YEOcjs.Schema.number({ min: 1 }).optional(),
|
|
2658
|
+
max: _chunkKPOL2YEOcjs.Schema.number({ min: 1 }).optional()
|
|
2567
2659
|
}, { unknownKeys: "passthrough" })
|
|
2568
2660
|
]);
|
|
2569
|
-
var poolConfig =
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
concurrency:
|
|
2573
|
-
maxQueue:
|
|
2574
|
-
queueTimeoutMs:
|
|
2661
|
+
var poolConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2662
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2663
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2664
|
+
concurrency: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2665
|
+
maxQueue: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2666
|
+
queueTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2575
2667
|
key: keyResolver.optional(),
|
|
2576
|
-
engine:
|
|
2577
|
-
wasm:
|
|
2668
|
+
engine: _chunkKPOL2YEOcjs.Schema.enum(["ts", "wasm"]).optional(),
|
|
2669
|
+
wasm: _chunkKPOL2YEOcjs.Schema.boolean().optional()
|
|
2578
2670
|
}, { unknownKeys: "passthrough" })
|
|
2579
2671
|
]);
|
|
2580
|
-
var adaptiveLimiterConfig =
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
preset:
|
|
2584
|
-
initialLimit:
|
|
2585
|
-
minLimit:
|
|
2586
|
-
maxLimit:
|
|
2587
|
-
smoothingFactor:
|
|
2588
|
-
probeInterval:
|
|
2589
|
-
probeJitterRatio:
|
|
2590
|
-
windowSize:
|
|
2591
|
-
minSamples:
|
|
2592
|
-
baselineStrategy:
|
|
2593
|
-
decreaseCooldownSamples:
|
|
2594
|
-
historySize:
|
|
2595
|
-
windowDecayFactor:
|
|
2596
|
-
errorWeight:
|
|
2597
|
-
errorSmoothingFactor:
|
|
2598
|
-
errorStatusThreshold:
|
|
2599
|
-
queueStrategy:
|
|
2600
|
-
queueLoadShedding:
|
|
2601
|
-
rejectionBackoffThreshold:
|
|
2602
|
-
rejectionBackoffMs:
|
|
2603
|
-
stateTtlMs:
|
|
2604
|
-
warmupRequests:
|
|
2605
|
-
decreaseThreshold:
|
|
2606
|
-
increaseThreshold:
|
|
2607
|
-
maxDecreaseRatio:
|
|
2672
|
+
var adaptiveLimiterConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2673
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2674
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2675
|
+
preset: _chunkKPOL2YEOcjs.Schema.enum(["conservative", "balanced", "aggressive"]).optional(),
|
|
2676
|
+
initialLimit: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2677
|
+
minLimit: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2678
|
+
maxLimit: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2679
|
+
smoothingFactor: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "smoothingFactor must be in (0, 1]").optional(),
|
|
2680
|
+
probeInterval: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2681
|
+
probeJitterRatio: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).optional(),
|
|
2682
|
+
windowSize: _chunkKPOL2YEOcjs.Schema.number({ min: 2, int: true }).optional(),
|
|
2683
|
+
minSamples: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2684
|
+
baselineStrategy: _chunkKPOL2YEOcjs.Schema.enum(["min", "p5", "ema-low"]).optional(),
|
|
2685
|
+
decreaseCooldownSamples: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2686
|
+
historySize: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2687
|
+
windowDecayFactor: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "windowDecayFactor must be in (0, 1]").optional(),
|
|
2688
|
+
errorWeight: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).optional(),
|
|
2689
|
+
errorSmoothingFactor: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "errorSmoothingFactor must be in (0, 1]").optional(),
|
|
2690
|
+
errorStatusThreshold: _chunkKPOL2YEOcjs.Schema.number({ min: 100, max: 599, int: true }).optional(),
|
|
2691
|
+
queueStrategy: _chunkKPOL2YEOcjs.Schema.enum(["fifo", "priority"]).optional(),
|
|
2692
|
+
queueLoadShedding: _chunkKPOL2YEOcjs.Schema.enum(["reject-new", "priority-evict"]).optional(),
|
|
2693
|
+
rejectionBackoffThreshold: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2694
|
+
rejectionBackoffMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2695
|
+
stateTtlMs: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true })]).optional(),
|
|
2696
|
+
warmupRequests: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2697
|
+
decreaseThreshold: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "decreaseThreshold must be in (0, 1]").optional(),
|
|
2698
|
+
increaseThreshold: _chunkKPOL2YEOcjs.Schema.number({ min: 1 }).optional(),
|
|
2699
|
+
maxDecreaseRatio: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "maxDecreaseRatio must be in (0, 1]").optional(),
|
|
2608
2700
|
headroomStrategy: headroomStrategyConfig.optional(),
|
|
2609
|
-
slowStartRecovery:
|
|
2610
|
-
slowStartSaturationThreshold:
|
|
2611
|
-
slowStartSaturationSamples:
|
|
2701
|
+
slowStartRecovery: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2702
|
+
slowStartSaturationThreshold: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "slowStartSaturationThreshold must be in (0, 1]").optional(),
|
|
2703
|
+
slowStartSaturationSamples: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2612
2704
|
key: keyResolver.optional(),
|
|
2613
|
-
maxQueue:
|
|
2614
|
-
queueTimeoutMs:
|
|
2705
|
+
maxQueue: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2706
|
+
queueTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2615
2707
|
onLimitChange: fn.optional(),
|
|
2616
|
-
percentile:
|
|
2708
|
+
percentile: _chunkKPOL2YEOcjs.Schema.enum(["p50", "p99"]).optional()
|
|
2617
2709
|
}, { unknownKeys: "passthrough" })
|
|
2618
2710
|
]);
|
|
2619
|
-
var cacheConfig =
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
ttlSeconds:
|
|
2623
|
-
maxEntries:
|
|
2624
|
-
staleWhileRevalidate:
|
|
2711
|
+
var cacheConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2712
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2713
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2714
|
+
ttlSeconds: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2715
|
+
maxEntries: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2716
|
+
staleWhileRevalidate: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2625
2717
|
cachePolicy: fn.optional(),
|
|
2626
|
-
cacheRelevantHeaders:
|
|
2718
|
+
cacheRelevantHeaders: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
2627
2719
|
onEvent: fn.optional(),
|
|
2628
2720
|
onLifecycleEvent: fn.optional()
|
|
2629
2721
|
}, { unknownKeys: "passthrough" })
|
|
2630
2722
|
]);
|
|
2631
|
-
var priorityConfig =
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
concurrency:
|
|
2635
|
-
queueTimeoutMs:
|
|
2723
|
+
var priorityConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2724
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2725
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2726
|
+
concurrency: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2727
|
+
queueTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2636
2728
|
onEvent: fn.optional()
|
|
2637
2729
|
}, { unknownKeys: "passthrough" })
|
|
2638
2730
|
]);
|
|
2639
|
-
var retryConfig =
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
maxRetries:
|
|
2643
|
-
baseDelayMs:
|
|
2644
|
-
maxDelayMs:
|
|
2645
|
-
maxElapsedMs:
|
|
2646
|
-
respectRetryAfter:
|
|
2647
|
-
retryOnMethods:
|
|
2731
|
+
var retryConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2732
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2733
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2734
|
+
maxRetries: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2735
|
+
baseDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2736
|
+
maxDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2737
|
+
maxElapsedMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2738
|
+
respectRetryAfter: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2739
|
+
retryOnMethods: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"])).optional(),
|
|
2648
2740
|
retryOnStatus: fn.optional(),
|
|
2649
2741
|
retryOnError: fn.optional(),
|
|
2650
|
-
engine:
|
|
2651
|
-
wasm:
|
|
2742
|
+
engine: _chunkKPOL2YEOcjs.Schema.enum(["ts", "wasm"]).optional(),
|
|
2743
|
+
wasm: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2652
2744
|
onRetry: fn.optional()
|
|
2653
2745
|
}, { unknownKeys: "passthrough" })
|
|
2654
2746
|
]);
|
|
2655
|
-
var requestRetryOverrideConfig =
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
maxRetries:
|
|
2659
|
-
baseDelayMs:
|
|
2660
|
-
maxDelayMs:
|
|
2747
|
+
var requestRetryOverrideConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2748
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2749
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2750
|
+
maxRetries: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2751
|
+
baseDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2752
|
+
maxDelayMs: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
|
|
2661
2753
|
schedule: object.optional(),
|
|
2662
2754
|
retryOnStatus: fn.optional()
|
|
2663
2755
|
}, { unknownKeys: "passthrough" })
|
|
2664
2756
|
]);
|
|
2665
|
-
var requestPolicyConfig =
|
|
2666
|
-
preset:
|
|
2667
|
-
lane:
|
|
2668
|
-
dedupKey:
|
|
2669
|
-
priority:
|
|
2757
|
+
var requestPolicyConfig = _chunkKPOL2YEOcjs.Schema.object({
|
|
2758
|
+
preset: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional(),
|
|
2759
|
+
lane: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional(),
|
|
2760
|
+
dedupKey: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional(),
|
|
2761
|
+
priority: _chunkKPOL2YEOcjs.Schema.number({ min: 0, max: 9, int: true }).optional(),
|
|
2670
2762
|
retry: requestRetryOverrideConfig.optional(),
|
|
2671
|
-
poolKey:
|
|
2763
|
+
poolKey: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional()
|
|
2672
2764
|
}, { unknownKeys: "passthrough" });
|
|
2673
|
-
var policyPresetsConfig =
|
|
2674
|
-
var compressionConfig =
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
encodings:
|
|
2765
|
+
var policyPresetsConfig = _chunkKPOL2YEOcjs.Schema.record(_chunkKPOL2YEOcjs.Schema.union([requestPolicyConfig, fn]));
|
|
2766
|
+
var compressionConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2767
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2768
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2769
|
+
encodings: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.enum(["gzip", "br", "deflate"])).optional()
|
|
2678
2770
|
}, { unknownKeys: "passthrough" })
|
|
2679
2771
|
]);
|
|
2680
|
-
var prewarmConfig =
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
origins:
|
|
2772
|
+
var prewarmConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2773
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2774
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2775
|
+
origins: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
2684
2776
|
afterResponse: fn.optional(),
|
|
2685
|
-
keepAliveDurationMs:
|
|
2686
|
-
budget:
|
|
2687
|
-
probeTimeoutMs:
|
|
2688
|
-
autoRefresh:
|
|
2689
|
-
useClientPool:
|
|
2777
|
+
keepAliveDurationMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2778
|
+
budget: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2779
|
+
probeTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2780
|
+
autoRefresh: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2781
|
+
useClientPool: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
|
|
2690
2782
|
onEvent: fn.optional()
|
|
2691
2783
|
}, { unknownKeys: "passthrough" })
|
|
2692
2784
|
]);
|
|
2693
|
-
var batchConfig =
|
|
2694
|
-
|
|
2695
|
-
|
|
2785
|
+
var batchConfig = _chunkKPOL2YEOcjs.Schema.union([
|
|
2786
|
+
_chunkKPOL2YEOcjs.Schema.literal(false),
|
|
2787
|
+
_chunkKPOL2YEOcjs.Schema.object({
|
|
2696
2788
|
batch: object,
|
|
2697
|
-
windowMs:
|
|
2698
|
-
maxBatchSize:
|
|
2789
|
+
windowMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }),
|
|
2790
|
+
maxBatchSize: _chunkKPOL2YEOcjs.Schema.number({ min: 2, int: true }),
|
|
2699
2791
|
batchKey: fn
|
|
2700
2792
|
}, { unknownKeys: "passthrough" })
|
|
2701
2793
|
]);
|
|
2702
|
-
var wireConfig =
|
|
2703
|
-
baseUrl:
|
|
2704
|
-
headers:
|
|
2705
|
-
timeoutMs:
|
|
2794
|
+
var wireConfig = _chunkKPOL2YEOcjs.Schema.object({
|
|
2795
|
+
baseUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
2796
|
+
headers: _chunkKPOL2YEOcjs.Schema.record(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
2797
|
+
timeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2706
2798
|
transport: fn.optional(),
|
|
2707
2799
|
streamTransport: fn.optional(),
|
|
2708
2800
|
pool: poolConfig.optional(),
|
|
2709
2801
|
adaptiveLimiter: adaptiveLimiterConfig.optional()
|
|
2710
2802
|
}, { unknownKeys: "passthrough" });
|
|
2711
|
-
var lifecycleConfig =
|
|
2712
|
-
baseUrl:
|
|
2713
|
-
headers:
|
|
2714
|
-
timeoutMs:
|
|
2803
|
+
var lifecycleConfig = _chunkKPOL2YEOcjs.Schema.object({
|
|
2804
|
+
baseUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
2805
|
+
headers: _chunkKPOL2YEOcjs.Schema.record(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
2806
|
+
timeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2715
2807
|
transport: fn.optional(),
|
|
2716
2808
|
streamTransport: fn.optional(),
|
|
2717
2809
|
pool: poolConfig.optional(),
|
|
2718
2810
|
adaptiveLimiter: adaptiveLimiterConfig.optional(),
|
|
2719
|
-
dedup:
|
|
2811
|
+
dedup: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), object]).optional(),
|
|
2720
2812
|
batch: batchConfig.optional(),
|
|
2721
2813
|
cache: cacheConfig.optional(),
|
|
2722
2814
|
priority: priorityConfig.optional(),
|
|
@@ -2725,34 +2817,34 @@ var lifecycleConfig = _chunkUUMKZJRJcjs.Schema.object({
|
|
|
2725
2817
|
onEvent: fn.optional(),
|
|
2726
2818
|
policyPresets: policyPresetsConfig.optional()
|
|
2727
2819
|
}, { unknownKeys: "passthrough" });
|
|
2728
|
-
var defaultClientConfig =
|
|
2729
|
-
baseUrl:
|
|
2730
|
-
headers:
|
|
2731
|
-
timeoutMs:
|
|
2820
|
+
var defaultClientConfig = _chunkKPOL2YEOcjs.Schema.object({
|
|
2821
|
+
baseUrl: _chunkKPOL2YEOcjs.Schema.string().optional(),
|
|
2822
|
+
headers: _chunkKPOL2YEOcjs.Schema.record(_chunkKPOL2YEOcjs.Schema.string()).optional(),
|
|
2823
|
+
timeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
|
|
2732
2824
|
transport: fn.optional(),
|
|
2733
2825
|
streamTransport: fn.optional(),
|
|
2734
2826
|
pool: poolConfig.optional(),
|
|
2735
2827
|
adaptiveLimiter: adaptiveLimiterConfig.optional(),
|
|
2736
|
-
dedup:
|
|
2828
|
+
dedup: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), object]).optional(),
|
|
2737
2829
|
batch: batchConfig.optional(),
|
|
2738
2830
|
cache: cacheConfig.optional(),
|
|
2739
2831
|
priority: priorityConfig.optional(),
|
|
2740
2832
|
retry: retryConfig.optional(),
|
|
2741
2833
|
prewarm: prewarmConfig.optional(),
|
|
2742
2834
|
onEvent: fn.optional(),
|
|
2743
|
-
preset:
|
|
2835
|
+
preset: _chunkKPOL2YEOcjs.Schema.enum(["minimal", "proxy", "highThroughputProxy", "balanced", "default", "production"]).optional(),
|
|
2744
2836
|
compression: compressionConfig.optional(),
|
|
2745
|
-
middleware:
|
|
2837
|
+
middleware: _chunkKPOL2YEOcjs.Schema.array(fn).optional(),
|
|
2746
2838
|
policyPresets: policyPresetsConfig.optional()
|
|
2747
2839
|
}, { unknownKeys: "passthrough" });
|
|
2748
2840
|
function validateMakeHttpConfig(config) {
|
|
2749
|
-
|
|
2841
|
+
_chunkKPOL2YEOcjs.parseConfig.call(void 0, "MakeHttpConfig", wireConfig, config);
|
|
2750
2842
|
}
|
|
2751
2843
|
function validateLifecycleClientConfig(config) {
|
|
2752
|
-
|
|
2844
|
+
_chunkKPOL2YEOcjs.parseConfig.call(void 0, "LifecycleClientConfig", lifecycleConfig, config);
|
|
2753
2845
|
}
|
|
2754
2846
|
function validateDefaultHttpClientConfig(config) {
|
|
2755
|
-
|
|
2847
|
+
_chunkKPOL2YEOcjs.parseConfig.call(void 0, "DefaultHttpClientConfig", defaultClientConfig, config);
|
|
2756
2848
|
}
|
|
2757
2849
|
|
|
2758
2850
|
// src/http/client.ts
|
|
@@ -2793,7 +2885,7 @@ var normalizeHeadersInit = (h) => {
|
|
|
2793
2885
|
};
|
|
2794
2886
|
var normalizeRequest = (defaultHeaders) => (req0) => {
|
|
2795
2887
|
let req = Object.keys(defaultHeaders).length ? mergeHeadersUnder(defaultHeaders)(req0) : req0;
|
|
2796
|
-
const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access',
|
|
2888
|
+
const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.headers]));
|
|
2797
2889
|
if (initHeaders && Object.keys(initHeaders).length) {
|
|
2798
2890
|
req = mergeHeadersUnder(initHeaders)(req);
|
|
2799
2891
|
}
|
|
@@ -2881,7 +2973,7 @@ var timeoutReason = (req, url, timeoutMs) => ({
|
|
|
2881
2973
|
var requestPriority = (req) => {
|
|
2882
2974
|
const fromPolicy = getHttpRequestPolicy(req).priority;
|
|
2883
2975
|
if (fromPolicy !== void 0) return fromPolicy;
|
|
2884
|
-
return _optionalChain([req, 'access',
|
|
2976
|
+
return _optionalChain([req, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.priority]);
|
|
2885
2977
|
};
|
|
2886
2978
|
var exitError = (exit) => {
|
|
2887
2979
|
if (exit._tag === "Success") return void 0;
|
|
@@ -2912,7 +3004,7 @@ var runTransportEffect = (effect, env, signal) => new Promise((resolve, reject)
|
|
|
2912
3004
|
signal.removeEventListener("abort", abort);
|
|
2913
3005
|
const currentCancel = cancel;
|
|
2914
3006
|
cancel = void 0;
|
|
2915
|
-
_optionalChain([currentCancel, 'optionalCall',
|
|
3007
|
+
_optionalChain([currentCancel, 'optionalCall', _65 => _65()]);
|
|
2916
3008
|
reject(abortErrorForSignal(signal));
|
|
2917
3009
|
};
|
|
2918
3010
|
if (signal.aborted) {
|
|
@@ -2933,13 +3025,13 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
2933
3025
|
_tag: "Async",
|
|
2934
3026
|
register: (env, cb) => {
|
|
2935
3027
|
const controller = new AbortController();
|
|
2936
|
-
const previousSignal = _optionalChain([req, 'access',
|
|
3028
|
+
const previousSignal = _optionalChain([req, 'access', _66 => _66.init, 'optionalAccess', _67 => _67.signal]);
|
|
2937
3029
|
const label = fetchLabel(req, url);
|
|
2938
3030
|
const startedAt = performance.now();
|
|
2939
3031
|
let done = false;
|
|
2940
3032
|
let cancelInner;
|
|
2941
3033
|
const cleanup = () => {
|
|
2942
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
3034
|
+
_optionalChain([previousSignal, 'optionalAccess', _68 => _68.removeEventListener, 'call', _69 => _69("abort", abortFromPrevious)]);
|
|
2943
3035
|
};
|
|
2944
3036
|
const finish = (outcome, exit, error) => {
|
|
2945
3037
|
if (done) return;
|
|
@@ -2965,20 +3057,20 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
2965
3057
|
};
|
|
2966
3058
|
function abortFromPrevious() {
|
|
2967
3059
|
const error = previousSignal ? abortErrorForSignal(previousSignal) : { _tag: "Abort" };
|
|
2968
|
-
abortCurrent(_optionalChain([previousSignal, 'optionalAccess',
|
|
3060
|
+
abortCurrent(_optionalChain([previousSignal, 'optionalAccess', _70 => _70.reason]));
|
|
2969
3061
|
const cancel = cancelInner;
|
|
2970
3062
|
cancelInner = void 0;
|
|
2971
3063
|
queueMicrotask(() => {
|
|
2972
3064
|
finishFailure(error);
|
|
2973
|
-
_optionalChain([cancel, 'optionalCall',
|
|
3065
|
+
_optionalChain([cancel, 'optionalCall', _71 => _71()]);
|
|
2974
3066
|
});
|
|
2975
3067
|
}
|
|
2976
3068
|
metrics.onStart();
|
|
2977
|
-
if (_optionalChain([previousSignal, 'optionalAccess',
|
|
3069
|
+
if (_optionalChain([previousSignal, 'optionalAccess', _72 => _72.aborted])) {
|
|
2978
3070
|
abortFromPrevious();
|
|
2979
3071
|
return () => void 0;
|
|
2980
3072
|
}
|
|
2981
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
3073
|
+
_optionalChain([previousSignal, 'optionalAccess', _73 => _73.addEventListener, 'call', _74 => _74("abort", abortFromPrevious, { once: true })]);
|
|
2982
3074
|
try {
|
|
2983
3075
|
const innerCancel = _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0,
|
|
2984
3076
|
transport({ request: req, url, signal: controller.signal }),
|
|
@@ -3003,7 +3095,7 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
3003
3095
|
cancelInner = void 0;
|
|
3004
3096
|
abortCurrent();
|
|
3005
3097
|
finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
3006
|
-
_optionalChain([cancel, 'optionalCall',
|
|
3098
|
+
_optionalChain([cancel, 'optionalCall', _75 => _75()]);
|
|
3007
3099
|
};
|
|
3008
3100
|
}
|
|
3009
3101
|
});
|
|
@@ -3043,10 +3135,10 @@ function makeHttpStream(cfg = {}) {
|
|
|
3043
3135
|
const url = resolveRequestUrl(req, baseUrl);
|
|
3044
3136
|
if (!(url instanceof URL)) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, url);
|
|
3045
3137
|
const timeoutMs = resolvePositiveTimeout(_nullishCoalesce(req.timeoutMs, () => ( cfg.timeoutMs)));
|
|
3046
|
-
return
|
|
3138
|
+
return _chunkZDZNV6NAcjs.fromPromiseAbortable.call(void 0,
|
|
3047
3139
|
async (signal, env) => {
|
|
3048
3140
|
let lease;
|
|
3049
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access',
|
|
3141
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _76 => _76.init, 'optionalAccess', _77 => _77.signal]));
|
|
3050
3142
|
try {
|
|
3051
3143
|
if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
|
|
3052
3144
|
if (adaptiveLimiter) {
|
|
@@ -3083,6 +3175,13 @@ function makeHttpStream(cfg = {}) {
|
|
|
3083
3175
|
};
|
|
3084
3176
|
return decorateStream(run, metrics.snapshot);
|
|
3085
3177
|
}
|
|
3178
|
+
var ONCE_OPTIONS = Object.freeze({ once: true });
|
|
3179
|
+
var noopSignal = (() => {
|
|
3180
|
+
const c = new AbortController();
|
|
3181
|
+
const s = c.signal;
|
|
3182
|
+
globalThis.__brassNoopSignal = s;
|
|
3183
|
+
return s;
|
|
3184
|
+
})();
|
|
3086
3185
|
function makeHttp(cfg = {}) {
|
|
3087
3186
|
validateMakeHttpConfig(cfg);
|
|
3088
3187
|
const baseUrl = _nullishCoalesce(cfg.baseUrl, () => ( ""));
|
|
@@ -3101,10 +3200,10 @@ function makeHttp(cfg = {}) {
|
|
|
3101
3200
|
if (!adaptiveLimiter && !pool && timeoutMs === void 0) {
|
|
3102
3201
|
return runDirectTransport(req, url, transport, metrics);
|
|
3103
3202
|
}
|
|
3104
|
-
return
|
|
3203
|
+
return _chunkZDZNV6NAcjs.fromPromiseAbortable.call(void 0,
|
|
3105
3204
|
async (signal, env) => {
|
|
3106
3205
|
let lease;
|
|
3107
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access',
|
|
3206
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _78 => _78.init, 'optionalAccess', _79 => _79.signal]));
|
|
3108
3207
|
try {
|
|
3109
3208
|
if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
|
|
3110
3209
|
if (adaptiveLimiter) {
|
|
@@ -3142,12 +3241,12 @@ function makeHttp(cfg = {}) {
|
|
|
3142
3241
|
if (adaptiveLimiter) metadata.adaptiveLimiter = adaptiveLimiter;
|
|
3143
3242
|
if (adaptiveLimiter || destroyTransport) {
|
|
3144
3243
|
metadata.destroy = () => {
|
|
3145
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3146
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3244
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _80 => _80.destroy, 'call', _81 => _81()]);
|
|
3245
|
+
_optionalChain([destroyTransport, 'optionalCall', _82 => _82()]);
|
|
3147
3246
|
};
|
|
3148
3247
|
metadata.shutdown = () => {
|
|
3149
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3150
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3248
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _83 => _83.shutdown, 'call', _84 => _84()]);
|
|
3249
|
+
_optionalChain([destroyTransport, 'optionalCall', _85 => _85()]);
|
|
3151
3250
|
};
|
|
3152
3251
|
}
|
|
3153
3252
|
return decorate(run, metrics.snapshot, metadata);
|
|
@@ -3170,7 +3269,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3170
3269
|
if (!canRetry) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3171
3270
|
const d = delayWithinBudget(backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs));
|
|
3172
3271
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3173
|
-
_optionalChain([p, 'access',
|
|
3272
|
+
_optionalChain([p, 'access', _86 => _86.onRetry, 'optionalCall', _87 => _87({
|
|
3174
3273
|
attempt,
|
|
3175
3274
|
delayMs: d,
|
|
3176
3275
|
error: e,
|
|
@@ -3179,7 +3278,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3179
3278
|
method: req.method,
|
|
3180
3279
|
timestamp: Date.now()
|
|
3181
3280
|
})]);
|
|
3182
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3281
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk6STX4PS3cjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3183
3282
|
},
|
|
3184
3283
|
(w) => {
|
|
3185
3284
|
const canRetry = attempt < p.maxRetries && retryOnStatus(w.status) && remainingBudget() > 0;
|
|
@@ -3188,7 +3287,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3188
3287
|
const rawDelay = ra === void 0 ? backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs) : Math.min(ra, p.maxDelayMs);
|
|
3189
3288
|
const d = delayWithinBudget(rawDelay);
|
|
3190
3289
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, w);
|
|
3191
|
-
_optionalChain([p, 'access',
|
|
3290
|
+
_optionalChain([p, 'access', _88 => _88.onRetry, 'optionalCall', _89 => _89({
|
|
3192
3291
|
attempt,
|
|
3193
3292
|
delayMs: d,
|
|
3194
3293
|
error: void 0,
|
|
@@ -3197,7 +3296,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3197
3296
|
method: req.method,
|
|
3198
3297
|
timestamp: Date.now()
|
|
3199
3298
|
})]);
|
|
3200
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3299
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk6STX4PS3cjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3201
3300
|
}
|
|
3202
3301
|
);
|
|
3203
3302
|
return loop(0);
|
|
@@ -3226,6 +3325,53 @@ function httpBodyKeyPart(body) {
|
|
|
3226
3325
|
// src/http/lifecycle/cacheKey.ts
|
|
3227
3326
|
var SEPARATOR = "\0";
|
|
3228
3327
|
var DEFAULT_CACHE_RELEVANT_HEADERS = ["accept", "authorization", "content-type"];
|
|
3328
|
+
function makeCacheKeyContext(baseUrl, extraHeaders = []) {
|
|
3329
|
+
const relevantSet = new Set(DEFAULT_CACHE_RELEVANT_HEADERS);
|
|
3330
|
+
for (let i = 0; i < extraHeaders.length; i++) {
|
|
3331
|
+
relevantSet.add(extraHeaders[i].toLowerCase());
|
|
3332
|
+
}
|
|
3333
|
+
return {
|
|
3334
|
+
baseUrl,
|
|
3335
|
+
relevantSet,
|
|
3336
|
+
cachedOrigin: baseUrl ? absoluteOrigin(baseUrl) : void 0
|
|
3337
|
+
};
|
|
3338
|
+
}
|
|
3339
|
+
function computeCacheKeyFast(req, ctx) {
|
|
3340
|
+
const m = req.method;
|
|
3341
|
+
const method = m === "GET" || m === "POST" || m === "PUT" || m === "DELETE" || m === "PATCH" || m === "HEAD" || m === "OPTIONS" ? m : m.toUpperCase();
|
|
3342
|
+
let resolvedUrl;
|
|
3343
|
+
const url = req.url;
|
|
3344
|
+
if (ctx.cachedOrigin && url.length > 0 && url.charCodeAt(0) === 47 && url.charCodeAt(1) !== 47) {
|
|
3345
|
+
resolvedUrl = ctx.cachedOrigin + url;
|
|
3346
|
+
} else {
|
|
3347
|
+
resolvedUrl = new URL(url, ctx.baseUrl || void 0).toString();
|
|
3348
|
+
}
|
|
3349
|
+
const headers = req.headers;
|
|
3350
|
+
let sortedHeaders = "";
|
|
3351
|
+
if (headers) {
|
|
3352
|
+
const keys = Object.keys(headers);
|
|
3353
|
+
if (keys.length > 0) {
|
|
3354
|
+
const matched = [];
|
|
3355
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3356
|
+
const k = keys[i];
|
|
3357
|
+
const lk = k.toLowerCase();
|
|
3358
|
+
if (ctx.relevantSet.has(lk)) {
|
|
3359
|
+
matched.push(`${lk}:${headers[k]}`);
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
if (matched.length > 0) {
|
|
3363
|
+
if (matched.length === 1) {
|
|
3364
|
+
sortedHeaders = matched[0];
|
|
3365
|
+
} else {
|
|
3366
|
+
matched.sort();
|
|
3367
|
+
sortedHeaders = matched.join(",");
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
const body = httpBodyKeyPart(req.body);
|
|
3373
|
+
return `${method}${SEPARATOR}${resolvedUrl}${SEPARATOR}${sortedHeaders}${SEPARATOR}${body}`;
|
|
3374
|
+
}
|
|
3229
3375
|
function computeCacheKey(req, baseUrl, extraHeaders = []) {
|
|
3230
3376
|
const method = req.method.toUpperCase();
|
|
3231
3377
|
const resolvedUrl = resolveKeyUrl(req.url, baseUrl);
|
|
@@ -3279,6 +3425,48 @@ var HOP_BY_HOP = /* @__PURE__ */ new Set([
|
|
|
3279
3425
|
"upgrade"
|
|
3280
3426
|
]);
|
|
3281
3427
|
var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
3428
|
+
function makeDedupKeyContext(baseUrl) {
|
|
3429
|
+
return {
|
|
3430
|
+
baseUrl,
|
|
3431
|
+
cachedOrigin: baseUrl ? absoluteOrigin(baseUrl) : void 0
|
|
3432
|
+
};
|
|
3433
|
+
}
|
|
3434
|
+
function computeDedupKeyFast(req, ctx) {
|
|
3435
|
+
const m = req.method;
|
|
3436
|
+
const method = m === "GET" || m === "POST" || m === "PUT" || m === "DELETE" || m === "PATCH" || m === "HEAD" || m === "OPTIONS" ? m : m.toUpperCase();
|
|
3437
|
+
let resolvedUrl;
|
|
3438
|
+
const url = req.url;
|
|
3439
|
+
if (ctx.cachedOrigin && url.length > 0 && url.charCodeAt(0) === 47 && url.charCodeAt(1) !== 47) {
|
|
3440
|
+
resolvedUrl = ctx.cachedOrigin + url;
|
|
3441
|
+
} else {
|
|
3442
|
+
resolvedUrl = resolveKeyUrl(url, ctx.baseUrl);
|
|
3443
|
+
}
|
|
3444
|
+
const headers = req.headers;
|
|
3445
|
+
let sortedHeaders = "";
|
|
3446
|
+
if (headers) {
|
|
3447
|
+
const keys = Object.keys(headers);
|
|
3448
|
+
if (keys.length > 0) {
|
|
3449
|
+
const matched = [];
|
|
3450
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3451
|
+
const k = keys[i];
|
|
3452
|
+
const lk = k.toLowerCase();
|
|
3453
|
+
if (!HOP_BY_HOP.has(lk) && lk !== "authorization") {
|
|
3454
|
+
matched.push(`${lk}:${headers[k]}`);
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
if (matched.length > 0) {
|
|
3458
|
+
if (matched.length === 1) {
|
|
3459
|
+
sortedHeaders = matched[0];
|
|
3460
|
+
} else {
|
|
3461
|
+
matched.sort();
|
|
3462
|
+
sortedHeaders = matched.join(",");
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
const body = httpBodyKeyPart(req.body);
|
|
3468
|
+
return `${method}${SEPARATOR}${resolvedUrl}${SEPARATOR}${sortedHeaders}${SEPARATOR}${body}`;
|
|
3469
|
+
}
|
|
3282
3470
|
function computeDedupKey(req, baseUrl) {
|
|
3283
3471
|
const method = req.method.toUpperCase();
|
|
3284
3472
|
const resolvedUrl = resolveKeyUrl(req.url, baseUrl);
|
|
@@ -3306,8 +3494,9 @@ function causeDefectMessage(cause) {
|
|
|
3306
3494
|
}
|
|
3307
3495
|
function withDedup(config) {
|
|
3308
3496
|
const inFlight = /* @__PURE__ */ new Map();
|
|
3309
|
-
const customKeyFn = _optionalChain([config, 'optionalAccess',
|
|
3310
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
3497
|
+
const customKeyFn = _optionalChain([config, 'optionalAccess', _90 => _90.dedupKey]);
|
|
3498
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _91 => _91.onEvent]);
|
|
3499
|
+
const dedupKeyCtx = makeDedupKeyContext("");
|
|
3311
3500
|
return (next) => {
|
|
3312
3501
|
return (req) => {
|
|
3313
3502
|
if (!SAFE_METHODS.has(req.method.toUpperCase())) {
|
|
@@ -3330,7 +3519,7 @@ function withDedup(config) {
|
|
|
3330
3519
|
return next(req);
|
|
3331
3520
|
}
|
|
3332
3521
|
} else {
|
|
3333
|
-
key =
|
|
3522
|
+
key = computeDedupKeyFast(req, dedupKeyCtx);
|
|
3334
3523
|
}
|
|
3335
3524
|
return {
|
|
3336
3525
|
_tag: "Async",
|
|
@@ -3850,18 +4039,19 @@ function safeEmit2(onEvent, event) {
|
|
|
3850
4039
|
}
|
|
3851
4040
|
}
|
|
3852
4041
|
function withCache(config) {
|
|
3853
|
-
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4042
|
+
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _92 => _92.ttlSeconds]), () => ( 60)), 1, 86400);
|
|
3854
4043
|
const ttlMs = ttlSeconds * 1e3;
|
|
3855
|
-
const maxEntries = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3856
|
-
const staleWhileRevalidate = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3857
|
-
const cachePolicy = _optionalChain([config, 'optionalAccess',
|
|
3858
|
-
const cacheRelevantHeaders = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3859
|
-
const baseUrl = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3860
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
3861
|
-
const onLifecycleEvent = _optionalChain([config, 'optionalAccess',
|
|
4044
|
+
const maxEntries = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _93 => _93.maxEntries]), () => ( 1024))));
|
|
4045
|
+
const staleWhileRevalidate = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _94 => _94.staleWhileRevalidate]), () => ( false));
|
|
4046
|
+
const cachePolicy = _optionalChain([config, 'optionalAccess', _95 => _95.cachePolicy]);
|
|
4047
|
+
const cacheRelevantHeaders = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _96 => _96.cacheRelevantHeaders]), () => ( []));
|
|
4048
|
+
const baseUrl = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _97 => _97.baseUrl]), () => ( ""));
|
|
4049
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _98 => _98.onEvent]);
|
|
4050
|
+
const onLifecycleEvent = _optionalChain([config, 'optionalAccess', _99 => _99.onLifecycleEvent]);
|
|
4051
|
+
const cacheKeyCtx = makeCacheKeyContext(baseUrl, cacheRelevantHeaders);
|
|
3862
4052
|
const cache = new LRUCache({
|
|
3863
4053
|
maxEntries,
|
|
3864
|
-
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4054
|
+
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall', _100 => _100({ type: "cache-eviction", count })])
|
|
3865
4055
|
});
|
|
3866
4056
|
const revalidating = /* @__PURE__ */ new Set();
|
|
3867
4057
|
const invalidate = (key) => {
|
|
@@ -3876,17 +4066,17 @@ function withCache(config) {
|
|
|
3876
4066
|
if (!SAFE_METHODS.has(method) && !cachePolicy) {
|
|
3877
4067
|
return next(req);
|
|
3878
4068
|
}
|
|
3879
|
-
const key =
|
|
4069
|
+
const key = computeCacheKeyFast(req, cacheKeyCtx);
|
|
3880
4070
|
return {
|
|
3881
4071
|
_tag: "Async",
|
|
3882
4072
|
register: (env, cb) => {
|
|
3883
4073
|
const cached = cache.get(key);
|
|
3884
4074
|
if (cached !== void 0) {
|
|
3885
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4075
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _101 => _101({ type: "cache-hit", cacheKey: key })]);
|
|
3886
4076
|
cb({ _tag: "Success", value: cached });
|
|
3887
4077
|
return;
|
|
3888
4078
|
}
|
|
3889
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4079
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _102 => _102({ type: "cache-miss", cacheKey: key })]);
|
|
3890
4080
|
const innerEffect = next(req);
|
|
3891
4081
|
return _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, innerEffect, env, (exit) => {
|
|
3892
4082
|
if (exit._tag === "Success") {
|
|
@@ -3935,7 +4125,7 @@ function withCache(config) {
|
|
|
3935
4125
|
if (!SAFE_METHODS.has(method) && !cachePolicy) {
|
|
3936
4126
|
return next(req);
|
|
3937
4127
|
}
|
|
3938
|
-
const key =
|
|
4128
|
+
const key = computeCacheKeyFast(req, cacheKeyCtx);
|
|
3939
4129
|
return {
|
|
3940
4130
|
_tag: "Async",
|
|
3941
4131
|
register: (env, cb) => {
|
|
@@ -3943,16 +4133,16 @@ function withCache(config) {
|
|
|
3943
4133
|
if (cached !== void 0) {
|
|
3944
4134
|
const expiresAt = expirationMap.get(key);
|
|
3945
4135
|
if (expiresAt !== void 0 && now() < expiresAt) {
|
|
3946
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4136
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _103 => _103({ type: "cache-hit", cacheKey: key })]);
|
|
3947
4137
|
cb({ _tag: "Success", value: cached });
|
|
3948
4138
|
return;
|
|
3949
4139
|
}
|
|
3950
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4140
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _104 => _104({ type: "cache-hit", cacheKey: key })]);
|
|
3951
4141
|
cb({ _tag: "Success", value: cached });
|
|
3952
4142
|
triggerRevalidation(next, req, key);
|
|
3953
4143
|
return;
|
|
3954
4144
|
}
|
|
3955
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4145
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _105 => _105({ type: "cache-miss", cacheKey: key })]);
|
|
3956
4146
|
const innerEffect = next(req);
|
|
3957
4147
|
const handleSuccess = (res) => {
|
|
3958
4148
|
swrStoreIfCacheable(req, res, key);
|
|
@@ -4205,7 +4395,7 @@ var DEFAULT_CONCURRENCY2 = 32;
|
|
|
4205
4395
|
function extractPriority(req) {
|
|
4206
4396
|
const fromPolicy = getHttpRequestPolicy(req).priority;
|
|
4207
4397
|
if (fromPolicy !== void 0) return clampPriority2(fromPolicy);
|
|
4208
|
-
const fromInit = _optionalChain([req, 'access',
|
|
4398
|
+
const fromInit = _optionalChain([req, 'access', _106 => _106.init, 'optionalAccess', _107 => _107.priority]);
|
|
4209
4399
|
if (fromInit !== void 0) return clampPriority2(fromInit);
|
|
4210
4400
|
return 5;
|
|
4211
4401
|
}
|
|
@@ -4217,9 +4407,9 @@ function safeEmit3(onEvent, event) {
|
|
|
4217
4407
|
}
|
|
4218
4408
|
}
|
|
4219
4409
|
function withPriority(config) {
|
|
4220
|
-
const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess',
|
|
4221
|
-
const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess',
|
|
4222
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
4410
|
+
const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess', _108 => _108.concurrency]));
|
|
4411
|
+
const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess', _109 => _109.queueTimeoutMs]));
|
|
4412
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _110 => _110.onEvent]);
|
|
4223
4413
|
const queue = new PriorityQueue();
|
|
4224
4414
|
let inFlight = 0;
|
|
4225
4415
|
const queueDepth = () => {
|
|
@@ -4264,7 +4454,7 @@ function withPriority(config) {
|
|
|
4264
4454
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4265
4455
|
};
|
|
4266
4456
|
signal.addEventListener("abort", abortHandler, { once: true });
|
|
4267
|
-
} else if (_optionalChain([signal, 'optionalAccess',
|
|
4457
|
+
} else if (_optionalChain([signal, 'optionalAccess', _111 => _111.aborted])) {
|
|
4268
4458
|
entry.cancelled = true;
|
|
4269
4459
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4270
4460
|
return;
|
|
@@ -4310,7 +4500,7 @@ function withPriority(config) {
|
|
|
4310
4500
|
clearTimeout(queued.timer);
|
|
4311
4501
|
queued.timer = void 0;
|
|
4312
4502
|
}
|
|
4313
|
-
if (_optionalChain([queued, 'access',
|
|
4503
|
+
if (_optionalChain([queued, 'access', _112 => _112.signal, 'optionalAccess', _113 => _113.aborted])) {
|
|
4314
4504
|
queued.cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4315
4505
|
continue;
|
|
4316
4506
|
}
|
|
@@ -4330,7 +4520,7 @@ function resolveQueueTimeout(value) {
|
|
|
4330
4520
|
return n > 0 ? n : void 0;
|
|
4331
4521
|
}
|
|
4332
4522
|
function getSignal(req) {
|
|
4333
|
-
return _optionalChain([req, 'access',
|
|
4523
|
+
return _optionalChain([req, 'access', _114 => _114.init, 'optionalAccess', _115 => _115.signal]);
|
|
4334
4524
|
}
|
|
4335
4525
|
|
|
4336
4526
|
// src/http/lifecycle/stats.ts
|
|
@@ -4719,9 +4909,9 @@ async function executeProbeViaClient(client, url, signal) {
|
|
|
4719
4909
|
resolve({ ok: true });
|
|
4720
4910
|
} else {
|
|
4721
4911
|
const cause = exit.cause;
|
|
4722
|
-
if (_optionalChain([cause, 'optionalAccess',
|
|
4912
|
+
if (_optionalChain([cause, 'optionalAccess', _116 => _116._tag]) === "Fail") {
|
|
4723
4913
|
const err = cause.error;
|
|
4724
|
-
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
4914
|
+
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _117 => _117.message]), () => ( _optionalChain([err, 'optionalAccess', _118 => _118._tag]))), () => ( "Unknown error")) });
|
|
4725
4915
|
} else {
|
|
4726
4916
|
resolve({ ok: false, error: "cancelled" });
|
|
4727
4917
|
}
|
|
@@ -5097,7 +5287,7 @@ function makeLifecycleClient(config = {}) {
|
|
|
5097
5287
|
priorityMiddleware = withPriority({
|
|
5098
5288
|
...priorityConfig2,
|
|
5099
5289
|
onEvent: (event) => {
|
|
5100
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5290
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess', _119 => _119.queueDepth, 'call', _120 => _120()]), () => ( 0)));
|
|
5101
5291
|
tracker.emit(event.type, { priority: event.priority });
|
|
5102
5292
|
}
|
|
5103
5293
|
});
|
|
@@ -5160,9 +5350,9 @@ function makeLifecycleClient(config = {}) {
|
|
|
5160
5350
|
attempt: event.attempt,
|
|
5161
5351
|
delayMs: event.delayMs,
|
|
5162
5352
|
status: event.status,
|
|
5163
|
-
errorTag: _optionalChain([event, 'access',
|
|
5353
|
+
errorTag: _optionalChain([event, 'access', _121 => _121.error, 'optionalAccess', _122 => _122._tag])
|
|
5164
5354
|
});
|
|
5165
|
-
_optionalChain([retryConfig2, 'access',
|
|
5355
|
+
_optionalChain([retryConfig2, 'access', _123 => _123.onRetry, 'optionalCall', _124 => _124(event)]);
|
|
5166
5356
|
}
|
|
5167
5357
|
})(composedFn);
|
|
5168
5358
|
}
|
|
@@ -5194,13 +5384,13 @@ function makeLifecycleClient(config = {}) {
|
|
|
5194
5384
|
}
|
|
5195
5385
|
}
|
|
5196
5386
|
return buildLifecycleClient(composedFn, tracker, {
|
|
5197
|
-
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5198
|
-
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5387
|
+
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _125 => _125.invalidate]), () => ( noopInvalidate)),
|
|
5388
|
+
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _126 => _126.clear]), () => ( noopClear)),
|
|
5199
5389
|
cancelAll: () => cancelActiveRequests(activeCancelers, prewarmMgr),
|
|
5200
5390
|
shutdown: () => shutdownClient(activeCancelers, prewarmMgr, wireClient.shutdown),
|
|
5201
5391
|
activeCancelers,
|
|
5202
5392
|
adaptiveLimiter: wireClient.adaptiveLimiter,
|
|
5203
|
-
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5393
|
+
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess', _127 => _127.queueDepth]),
|
|
5204
5394
|
prewarmManager: prewarmMgr,
|
|
5205
5395
|
afterResponse: hasPrewarm ? config.prewarm.afterResponse : void 0
|
|
5206
5396
|
});
|
|
@@ -5215,7 +5405,7 @@ function noopClear() {
|
|
|
5215
5405
|
function buildLifecycleClient(fn2, tracker, internals) {
|
|
5216
5406
|
const client = (req) => trackRequest(fn2, req, tracker, internals);
|
|
5217
5407
|
const stats = () => {
|
|
5218
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access',
|
|
5408
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access', _128 => _128.queueDepth, 'optionalCall', _129 => _129()]), () => ( 0)));
|
|
5219
5409
|
return tracker.snapshot();
|
|
5220
5410
|
};
|
|
5221
5411
|
const withMw = (mw) => {
|
|
@@ -5255,14 +5445,14 @@ function cancelActiveRequests(activeCancelers, prewarmMgr) {
|
|
|
5255
5445
|
}
|
|
5256
5446
|
function shutdownClient(activeCancelers, prewarmMgr, wireShutdown) {
|
|
5257
5447
|
cancelActiveRequests(activeCancelers, prewarmMgr);
|
|
5258
|
-
_optionalChain([wireShutdown, 'optionalCall',
|
|
5448
|
+
_optionalChain([wireShutdown, 'optionalCall', _130 => _130()]);
|
|
5259
5449
|
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
5260
5450
|
}
|
|
5261
5451
|
function trackRequest(fn2, req, tracker, internals) {
|
|
5262
5452
|
return {
|
|
5263
5453
|
_tag: "Async",
|
|
5264
5454
|
register: (env, cb) => {
|
|
5265
|
-
const previousSignal = _optionalChain([req, 'access',
|
|
5455
|
+
const previousSignal = _optionalChain([req, 'access', _131 => _131.init, 'optionalAccess', _132 => _132.signal]);
|
|
5266
5456
|
let done = false;
|
|
5267
5457
|
let abortedByPreviousSignal = false;
|
|
5268
5458
|
let abortedByLifecycle = false;
|
|
@@ -5271,7 +5461,7 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5271
5461
|
if (done) return;
|
|
5272
5462
|
done = true;
|
|
5273
5463
|
const exit = (abortedByPreviousSignal || abortedByLifecycle) && exit0._tag === "Failure" && _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit0.cause) ? { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) } : exit0;
|
|
5274
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
5464
|
+
_optionalChain([previousSignal, 'optionalAccess', _133 => _133.removeEventListener, 'call', _134 => _134("abort", abortFromPrevious)]);
|
|
5275
5465
|
internals.activeCancelers.delete(cancelFromLifecycle);
|
|
5276
5466
|
if (exit._tag === "Success") {
|
|
5277
5467
|
tracker.requestCompleted();
|
|
@@ -5309,13 +5499,13 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5309
5499
|
abortedByPreviousSignal = true;
|
|
5310
5500
|
cancelActive();
|
|
5311
5501
|
};
|
|
5312
|
-
if (!_optionalChain([previousSignal, 'optionalAccess',
|
|
5313
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
5502
|
+
if (!_optionalChain([previousSignal, 'optionalAccess', _135 => _135.aborted])) {
|
|
5503
|
+
_optionalChain([previousSignal, 'optionalAccess', _136 => _136.addEventListener, 'call', _137 => _137("abort", abortFromPrevious, { once: true })]);
|
|
5314
5504
|
}
|
|
5315
5505
|
internals.activeCancelers.add(cancelFromLifecycle);
|
|
5316
5506
|
tracker.requestStarted();
|
|
5317
5507
|
tracker.emit("request-start");
|
|
5318
|
-
if (_optionalChain([previousSignal, 'optionalAccess',
|
|
5508
|
+
if (_optionalChain([previousSignal, 'optionalAccess', _138 => _138.aborted])) {
|
|
5319
5509
|
abortFromPrevious();
|
|
5320
5510
|
return () => void 0;
|
|
5321
5511
|
}
|
|
@@ -5435,7 +5625,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5435
5625
|
const contentEncodingKey = Object.keys(res.headers).find(
|
|
5436
5626
|
(k) => k.toLowerCase() === "content-encoding"
|
|
5437
5627
|
);
|
|
5438
|
-
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access',
|
|
5628
|
+
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access', _139 => _139.headers, 'access', _140 => _140[contentEncodingKey], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]) : void 0;
|
|
5439
5629
|
if (!contentEncodingValue || contentEncodingValue.toLowerCase() === "identity") {
|
|
5440
5630
|
stats.passthroughCount++;
|
|
5441
5631
|
return res;
|
|
@@ -5510,7 +5700,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5510
5700
|
};
|
|
5511
5701
|
}
|
|
5512
5702
|
function makeCompressionMiddleware(config) {
|
|
5513
|
-
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5703
|
+
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _143 => _143.encodings]), () => ( [...SUPPORTED_ENCODINGS]));
|
|
5514
5704
|
const decompressor = createDecompressor();
|
|
5515
5705
|
const mutableStats = emptyStats2();
|
|
5516
5706
|
const middleware = (next) => {
|
|
@@ -5550,9 +5740,9 @@ function makeCompressionMiddleware(config) {
|
|
|
5550
5740
|
var makeResponseCompressionMiddleware = makeCompressionMiddleware;
|
|
5551
5741
|
var DEFAULT_REQUEST_COMPRESS_METHODS = ["POST", "PUT", "PATCH"];
|
|
5552
5742
|
function makeRequestCompressionMiddleware(config) {
|
|
5553
|
-
const encoding = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5554
|
-
const minBytes = Math.max(0, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5555
|
-
const methods = new Set((_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5743
|
+
const encoding = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _144 => _144.encoding]), () => ( "gzip"));
|
|
5744
|
+
const minBytes = Math.max(0, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _145 => _145.minBytes]), () => ( 1024))));
|
|
5745
|
+
const methods = new Set((_nullishCoalesce(_optionalChain([config, 'optionalAccess', _146 => _146.methods]), () => ( DEFAULT_REQUEST_COMPRESS_METHODS))).map((m) => m.toUpperCase()));
|
|
5556
5746
|
const mutableStats = emptyRequestCompressionStats();
|
|
5557
5747
|
const middleware = (next) => {
|
|
5558
5748
|
return (req) => {
|
|
@@ -5635,7 +5825,7 @@ function makeJsonParseValidationError(bodyText, error, options = {}) {
|
|
|
5635
5825
|
body: bodyText,
|
|
5636
5826
|
phase: "response",
|
|
5637
5827
|
schema: options.schemaName,
|
|
5638
|
-
issues: [
|
|
5828
|
+
issues: [_chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "valid JSON", bodyText, "Response body is not valid JSON")]
|
|
5639
5829
|
};
|
|
5640
5830
|
}
|
|
5641
5831
|
function decodeJsonBody(bodyText, validator, options = {}) {
|
|
@@ -5649,22 +5839,27 @@ function decodeJsonBody(bodyText, validator, options = {}) {
|
|
|
5649
5839
|
};
|
|
5650
5840
|
}
|
|
5651
5841
|
if (!validator) return { success: true, data: parsed };
|
|
5842
|
+
let validation;
|
|
5652
5843
|
let legacyMessage;
|
|
5653
|
-
|
|
5844
|
+
if (_chunkKPOL2YEOcjs.isSchema.call(void 0, validator)) {
|
|
5845
|
+
validation = validator.safeParse(parsed);
|
|
5846
|
+
} else {
|
|
5654
5847
|
const result = validator(parsed);
|
|
5655
|
-
if (result.success)
|
|
5848
|
+
if (result.success) {
|
|
5849
|
+
return { success: true, data: result.data };
|
|
5850
|
+
}
|
|
5656
5851
|
legacyMessage = result.error;
|
|
5657
|
-
|
|
5852
|
+
validation = {
|
|
5658
5853
|
success: false,
|
|
5659
|
-
issues: _nullishCoalesce(result.issues, () => ( [
|
|
5854
|
+
issues: _nullishCoalesce(result.issues, () => ( [_chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "valid JSON shape", parsed, result.error)]))
|
|
5660
5855
|
};
|
|
5661
|
-
}
|
|
5856
|
+
}
|
|
5662
5857
|
if (validation.success) return { success: true, data: validation.data };
|
|
5663
5858
|
return {
|
|
5664
5859
|
success: false,
|
|
5665
5860
|
error: {
|
|
5666
5861
|
_tag: "ValidationError",
|
|
5667
|
-
message: _nullishCoalesce(legacyMessage, () => ( `JSON response failed validation: ${
|
|
5862
|
+
message: _nullishCoalesce(legacyMessage, () => ( `JSON response failed validation: ${_chunkKPOL2YEOcjs.formatIssues.call(void 0, validation.issues)}`)),
|
|
5668
5863
|
body: bodyText,
|
|
5669
5864
|
phase: "response",
|
|
5670
5865
|
schema: options.schemaName,
|
|
@@ -5674,11 +5869,11 @@ function decodeJsonBody(bodyText, validator, options = {}) {
|
|
|
5674
5869
|
}
|
|
5675
5870
|
function encodeJsonBodyEffect(bodyObj, validator, options = {}) {
|
|
5676
5871
|
if (validator) {
|
|
5677
|
-
const validation =
|
|
5872
|
+
const validation = _chunkKPOL2YEOcjs.validateValue.call(void 0, bodyObj, validator);
|
|
5678
5873
|
if (!validation.success) {
|
|
5679
5874
|
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, {
|
|
5680
5875
|
_tag: "ValidationError",
|
|
5681
|
-
message: `JSON request body failed validation: ${
|
|
5876
|
+
message: `JSON request body failed validation: ${_chunkKPOL2YEOcjs.formatIssues.call(void 0, validation.issues)}`,
|
|
5682
5877
|
body: previewJson(bodyObj),
|
|
5683
5878
|
phase: "request",
|
|
5684
5879
|
schema: options.schemaName,
|
|
@@ -5696,12 +5891,19 @@ function encodeJsonBodyEffect(bodyObj, validator, options = {}) {
|
|
|
5696
5891
|
phase: "request",
|
|
5697
5892
|
schema: options.schemaName,
|
|
5698
5893
|
issues: [
|
|
5699
|
-
|
|
5894
|
+
_chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "JSON-serializable value", bodyObj, "Request body could not be serialized to JSON")
|
|
5700
5895
|
]
|
|
5701
5896
|
});
|
|
5702
5897
|
}
|
|
5703
5898
|
}
|
|
5704
5899
|
function decodeJsonBodyEffect(bodyText, validator, options) {
|
|
5900
|
+
if (!validator) {
|
|
5901
|
+
try {
|
|
5902
|
+
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, JSON.parse(bodyText));
|
|
5903
|
+
} catch (error) {
|
|
5904
|
+
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, makeJsonParseValidationError(bodyText, error, _nullishCoalesce(options, () => ( {}))));
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5705
5907
|
const result = decodeJsonBody(bodyText, validator, options);
|
|
5706
5908
|
return result.success ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, result.data) : _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, result.error);
|
|
5707
5909
|
}
|
|
@@ -5832,12 +6034,12 @@ var PRESET_CONFIGS = {
|
|
|
5832
6034
|
function isDefaultCacheableResponse(req, res) {
|
|
5833
6035
|
if (!DEFAULT_CACHEABLE_METHODS.has(req.method)) return false;
|
|
5834
6036
|
if (res.status < 200 || res.status >= 400) return false;
|
|
5835
|
-
const cacheControl = _optionalChain([headerValue, 'call',
|
|
6037
|
+
const cacheControl = _optionalChain([headerValue, 'call', _147 => _147(res.headers, "cache-control"), 'optionalAccess', _148 => _148.toLowerCase, 'call', _149 => _149()]);
|
|
5836
6038
|
if (cacheControl) {
|
|
5837
6039
|
const directives = cacheControl.split(",").map((part) => part.trim());
|
|
5838
6040
|
if (directives.includes("no-store") || directives.includes("no-cache")) return false;
|
|
5839
6041
|
}
|
|
5840
|
-
if (_optionalChain([headerValue, 'call',
|
|
6042
|
+
if (_optionalChain([headerValue, 'call', _150 => _150(res.headers, "pragma"), 'optionalAccess', _151 => _151.toLowerCase, 'call', _152 => _152()]) === "no-cache") return false;
|
|
5841
6043
|
if (headerValue(res.headers, "set-cookie") !== void 0) return false;
|
|
5842
6044
|
return true;
|
|
5843
6045
|
}
|
|
@@ -5867,14 +6069,18 @@ function makeDefaultHttpClient(config = {}) {
|
|
|
5867
6069
|
wire = wire.with(withHttpPolicyPresets(policyPresets));
|
|
5868
6070
|
}
|
|
5869
6071
|
const features = featureSnapshot(lifecycleConfig2, compressionResult !== void 0, middleware.length);
|
|
6072
|
+
const hasMiddleware = compressionResult !== void 0 || middleware.length > 0 || policyPresets !== void 0 && Object.keys(policyPresets).length > 0;
|
|
6073
|
+
const transport = lifecycleConfig2.transport;
|
|
6074
|
+
const useInlineDecode = !hasMiddleware && transport !== void 0;
|
|
5870
6075
|
return buildDefaultClient(wire, {
|
|
5871
6076
|
preset,
|
|
5872
6077
|
features,
|
|
5873
|
-
compressionStats: _optionalChain([compressionResult, 'optionalAccess',
|
|
6078
|
+
compressionStats: _optionalChain([compressionResult, 'optionalAccess', _153 => _153.stats]),
|
|
6079
|
+
useInlineDecode
|
|
5874
6080
|
});
|
|
5875
6081
|
}
|
|
5876
6082
|
function buildDefaultClient(wire, meta) {
|
|
5877
|
-
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) =>
|
|
6083
|
+
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunkZDZNV6NAcjs.toPromise.call(void 0, e, env))(eff);
|
|
5878
6084
|
const requestRaw = (req) => wire(req);
|
|
5879
6085
|
const request = (req) => withPromise(requestRaw(req));
|
|
5880
6086
|
const get = (url, init) => request(buildHttpRequest("GET", url, init));
|
|
@@ -5889,21 +6095,26 @@ function buildDefaultClient(wire, meta) {
|
|
|
5889
6095
|
const req = setHeaderIfMissing("accept", "application/json")(
|
|
5890
6096
|
buildHttpRequest("GET", url, init)
|
|
5891
6097
|
);
|
|
6098
|
+
if (meta.useInlineDecode) {
|
|
6099
|
+
return withPromise(
|
|
6100
|
+
fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess', _154 => _154.schema]), _optionalChain([init, 'optionalAccess', _155 => _155.schemaName]))
|
|
6101
|
+
);
|
|
6102
|
+
}
|
|
5892
6103
|
return withPromise(
|
|
5893
|
-
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
6104
|
+
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _156 => _156.schema]), _optionalChain([init, 'optionalAccess', _157 => _157.schemaName])))
|
|
5894
6105
|
);
|
|
5895
6106
|
});
|
|
5896
6107
|
const postJson = ((url, bodyObj, init) => {
|
|
5897
6108
|
return withPromise(
|
|
5898
6109
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
5899
|
-
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess',
|
|
6110
|
+
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess', _158 => _158.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _159 => _159.bodySchemaName]) }),
|
|
5900
6111
|
(bodyText) => {
|
|
5901
6112
|
const req = setHeaderIfMissing("content-type", "application/json")(
|
|
5902
6113
|
setHeaderIfMissing("accept", "application/json")(
|
|
5903
6114
|
buildHttpRequest("POST", url, init, bodyText)
|
|
5904
6115
|
)
|
|
5905
6116
|
);
|
|
5906
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
6117
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _160 => _160.schema]), _optionalChain([init, 'optionalAccess', _161 => _161.schemaName])));
|
|
5907
6118
|
}
|
|
5908
6119
|
)
|
|
5909
6120
|
);
|
|
@@ -5917,6 +6128,7 @@ function buildDefaultClient(wire, meta) {
|
|
|
5917
6128
|
postJson,
|
|
5918
6129
|
with: (mw) => buildDefaultClient(wire.with(mw), {
|
|
5919
6130
|
...meta,
|
|
6131
|
+
useInlineDecode: false,
|
|
5920
6132
|
features: {
|
|
5921
6133
|
...meta.features,
|
|
5922
6134
|
middleware: meta.features.middleware + 1
|
|
@@ -5944,6 +6156,48 @@ function toResponse(wire, body) {
|
|
|
5944
6156
|
body
|
|
5945
6157
|
};
|
|
5946
6158
|
}
|
|
6159
|
+
function fusedWireAndDecode(wireEffect, schema, schemaName) {
|
|
6160
|
+
return {
|
|
6161
|
+
_tag: "Async",
|
|
6162
|
+
register: (env, cb) => {
|
|
6163
|
+
const innerEffect = wireEffect;
|
|
6164
|
+
if (innerEffect._tag === "Async" && innerEffect.register) {
|
|
6165
|
+
return innerEffect.register(env, (exit) => {
|
|
6166
|
+
if (exit._tag !== "Success") {
|
|
6167
|
+
cb(exit);
|
|
6168
|
+
return;
|
|
6169
|
+
}
|
|
6170
|
+
const wire = exit.value;
|
|
6171
|
+
inlineDecodeJson(wire, schema, schemaName, cb);
|
|
6172
|
+
});
|
|
6173
|
+
}
|
|
6174
|
+
const decoded = _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, wireEffect, (w) => decodeResponse(w, schema, schemaName));
|
|
6175
|
+
if (decoded._tag === "Async" && decoded.register) {
|
|
6176
|
+
return decoded.register(env, cb);
|
|
6177
|
+
}
|
|
6178
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "ValidationError", message: "Internal: unexpected effect shape", body: "", issues: [], phase: "response" }) });
|
|
6179
|
+
}
|
|
6180
|
+
};
|
|
6181
|
+
}
|
|
6182
|
+
function inlineDecodeJson(wire, schema, schemaName, cb) {
|
|
6183
|
+
if (!schema) {
|
|
6184
|
+
let parsed;
|
|
6185
|
+
try {
|
|
6186
|
+
parsed = JSON.parse(wire.bodyText);
|
|
6187
|
+
} catch (error) {
|
|
6188
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(makeJsonParseValidationError(wire.bodyText, error, { schemaName })) });
|
|
6189
|
+
return;
|
|
6190
|
+
}
|
|
6191
|
+
cb({ _tag: "Success", value: toResponse(wire, parsed) });
|
|
6192
|
+
return;
|
|
6193
|
+
}
|
|
6194
|
+
const result = decodeJsonBody(wire.bodyText, schema, { schemaName });
|
|
6195
|
+
if (result.success) {
|
|
6196
|
+
cb({ _tag: "Success", value: toResponse(wire, result.data) });
|
|
6197
|
+
} else {
|
|
6198
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(result.error) });
|
|
6199
|
+
}
|
|
6200
|
+
}
|
|
5947
6201
|
function decodeResponse(wire, schema, schemaName) {
|
|
5948
6202
|
if (!schema) {
|
|
5949
6203
|
try {
|
|
@@ -6009,10 +6263,10 @@ function isLeanPreset(preset) {
|
|
|
6009
6263
|
}
|
|
6010
6264
|
|
|
6011
6265
|
// src/http/layer.ts
|
|
6012
|
-
var HttpClientService =
|
|
6266
|
+
var HttpClientService = _chunk6STX4PS3cjs.makeServiceTag.call(void 0, "HttpClient");
|
|
6013
6267
|
function makeDefaultHttpClientLayer(config = {}, options = {}) {
|
|
6014
6268
|
const tag = _nullishCoalesce(options.tag, () => ( HttpClientService));
|
|
6015
|
-
return
|
|
6269
|
+
return _chunk6STX4PS3cjs.layerEffect.call(void 0,
|
|
6016
6270
|
tag,
|
|
6017
6271
|
(context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0,
|
|
6018
6272
|
() => makeDefaultHttpClient(resolveDefaultHttpClientLayerConfig(config, context))
|
|
@@ -6123,4 +6377,6 @@ function shutdownDefaultHttpClient(client) {
|
|
|
6123
6377
|
|
|
6124
6378
|
|
|
6125
6379
|
|
|
6126
|
-
|
|
6380
|
+
|
|
6381
|
+
|
|
6382
|
+
exports.Request = Request; exports.setHeaderIfMissing = setHeaderIfMissing; exports.defineHttpPolicyPresets = defineHttpPolicyPresets; exports.httpPolicy = httpPolicy; exports.getHttpRequestPolicy = getHttpRequestPolicy; exports.withHttpRequestPolicy = withHttpRequestPolicy; exports.resolveHttpRequestPolicyPresets = resolveHttpRequestPolicyPresets; exports.withHttpPolicyPresets = withHttpPolicyPresets; exports.isHttpError = isHttpError; exports.isValidationError = isValidationError; exports.isCircuitBreakerOpen = isCircuitBreakerOpen; exports.isKnownHttpError = isKnownHttpError; exports.isAbortHttpError = isAbortHttpError; exports.isTimeoutHttpError = isTimeoutHttpError; exports.isFetchHttpError = isFetchHttpError; exports.httpErrorStatus = httpErrorStatus; exports.isRetryableHttpStatus = isRetryableHttpStatus; exports.isRetryableHttpError = isRetryableHttpError; exports.isExternalAbortError = isExternalAbortError; exports.isExternalTimeoutError = isExternalTimeoutError; exports.toHttpError = toHttpError; exports.matchHttpError = matchHttpError; exports.formatHttpError = formatHttpError; exports.defaultRetryableMethods = defaultRetryableMethods; exports.defaultRetryOnStatus = defaultRetryOnStatus; exports.defaultRetryOnError = defaultRetryOnError; exports.backoffDelayMs = backoffDelayMs; exports.retryAfterMs = retryAfterMs; exports.normalizeRetryBudget = normalizeRetryBudget; exports.withRetry = withRetry; exports.resolveHttpPoolKey = resolveHttpPoolKey; exports.HttpConcurrencyPool = HttpConcurrencyPool; exports.LatencyWindow = LatencyWindow; exports.EmaComputer = EmaComputer; exports.computeGradient = computeGradient; exports.computeNewLimit = computeNewLimit; exports.adaptiveLimiterPresets = adaptiveLimiterPresets; exports.makeAdaptiveLimiterConfig = makeAdaptiveLimiterConfig; exports.validateConfig = validateConfig; exports.resolveConfig = resolveConfig; exports.AdaptiveLimiter = AdaptiveLimiter; exports.isPromiseTransportDirect = isPromiseTransportDirect; exports.isTaggedHttpError = isTaggedHttpError; exports.isAbortError = isAbortError; exports.normalizeHttpError = normalizeHttpError; exports.headersOf = headersOf; exports.normalizeHttpHeaders = normalizeHttpHeaders; exports.abortErrorForSignal = abortErrorForSignal; exports.linkAbortSignals = linkAbortSignals; exports.makePromiseHttpTransport = makePromiseHttpTransport; exports.promiseHttpTransport = promiseHttpTransport; exports.makeFetchTransport = makeFetchTransport; exports.makeFetchStreamTransport = makeFetchStreamTransport; exports.decorate = decorate; exports.withMiddleware = withMiddleware; exports.normalizeHeadersInit = normalizeHeadersInit; exports.makeHttpStream = makeHttpStream; exports.noopSignal = noopSignal; exports.makeHttp = makeHttp; exports.withRetryStream = withRetryStream; exports.SEPARATOR = SEPARATOR; exports.DEFAULT_CACHE_RELEVANT_HEADERS = DEFAULT_CACHE_RELEVANT_HEADERS; exports.computeCacheKey = computeCacheKey; exports.parseCacheKey = parseCacheKey; exports.withDedup = withDedup; exports.withBatch = withBatch; exports.now = now; exports.LRUCache = LRUCache; exports.withCache = withCache; exports.clampPriority = clampPriority2; exports.PriorityQueue = PriorityQueue; exports.withPriority = withPriority; exports.LifecycleStatsTracker = LifecycleStatsTracker; exports.validateOrigin = validateOrigin; exports.detectPlatform = detectPlatform; exports.validateFetchAvailable = validateFetchAvailable; exports.executeProbe = executeProbe; exports.makeConnectionStateMap = makeConnectionStateMap; exports.makeBudgetSemaphore = makeBudgetSemaphore; exports.makePrewarmManager = makePrewarmManager; exports.makeLifecycleClient = makeLifecycleClient; exports.makeHttpClient = makeHttpClient; exports.SUPPORTED_ENCODINGS = SUPPORTED_ENCODINGS; exports.makeCompressionMiddleware = makeCompressionMiddleware; exports.makeResponseCompressionMiddleware = makeResponseCompressionMiddleware; exports.makeRequestCompressionMiddleware = makeRequestCompressionMiddleware; exports.makeJsonParseValidationError = makeJsonParseValidationError; exports.decodeJsonBody = decodeJsonBody; exports.encodeJsonBodyEffect = encodeJsonBodyEffect; exports.decodeJsonBodyEffect = decodeJsonBodyEffect; exports.validatedJson = validatedJson; exports.validatedJsonResponse = validatedJsonResponse; exports.buildHttpRequest = buildHttpRequest; exports.defaultHttpClientPreset = defaultHttpClientPreset; exports.makeDefaultHttpClient = makeDefaultHttpClient; exports.HttpClientService = HttpClientService; exports.makeDefaultHttpClientLayer = makeDefaultHttpClientLayer;
|