brass-runtime 1.18.1 → 1.19.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/agent/cli/main.cjs +31 -31
  3. package/dist/agent/cli/main.js +3 -3
  4. package/dist/agent/cli/main.mjs +3 -3
  5. package/dist/agent/index.cjs +4 -4
  6. package/dist/agent/index.js +3 -3
  7. package/dist/agent/index.mjs +3 -3
  8. package/dist/{chunk-22HZQG5F.js → chunk-2R3RVNS2.js} +6 -6
  9. package/dist/{chunk-YWLLH27R.mjs → chunk-3NKXUX4T.mjs} +2 -2
  10. package/dist/{chunk-IPSMXUWA.js → chunk-4PKBNG2H.js} +38 -18
  11. package/dist/{chunk-Z3ZZMQUZ.mjs → chunk-5RVHSBJ6.mjs} +182 -34
  12. package/dist/{chunk-B5FKOLTB.mjs → chunk-5UBJT4RW.mjs} +4 -4
  13. package/dist/{chunk-5RZ7YITF.cjs → chunk-6STX4PS3.cjs} +13 -13
  14. package/dist/{chunk-XPIMJQYS.cjs → chunk-7FZUTJM3.cjs} +400 -252
  15. package/dist/{chunk-YZ5LQ32F.js → chunk-A6EG5WRL.js} +3 -3
  16. package/dist/{chunk-TTSPIU3U.js → chunk-APQBU7TM.js} +53 -32
  17. package/dist/{chunk-BC6Q6BCO.mjs → chunk-AQQQFNYD.mjs} +38 -18
  18. package/dist/{chunk-OW5VHAOE.js → chunk-B2VXVNIS.js} +1 -1
  19. package/dist/{chunk-WCBNXPN6.mjs → chunk-BLXBZ6RE.mjs} +1 -1
  20. package/dist/{chunk-7VQLEN37.js → chunk-C3CWI42G.js} +1 -1
  21. package/dist/{chunk-WI7GZF3B.cjs → chunk-DV644N7P.cjs} +85 -85
  22. package/dist/{chunk-RBHNOKH4.mjs → chunk-EKLEDIVJ.mjs} +2 -2
  23. package/dist/{chunk-S4HXADU4.js → chunk-EXBGIC66.js} +1 -1
  24. package/dist/{chunk-LSYQ3C2M.js → chunk-FC5N5QHJ.js} +2 -2
  25. package/dist/{chunk-6MLAZPBL.mjs → chunk-FNWOH2T2.js} +18 -6
  26. package/dist/{chunk-WGE2FEZE.cjs → chunk-FYWWU3Z7.cjs} +2 -2
  27. package/dist/{chunk-2OW6IFY2.cjs → chunk-GOEO763K.cjs} +21 -21
  28. package/dist/{chunk-UAKAF32U.js → chunk-GXOIUBKE.js} +2 -2
  29. package/dist/{chunk-7DU7IQHK.js → chunk-H4ZRUQZL.js} +4 -4
  30. package/dist/{chunk-JWIEMBE6.mjs → chunk-HW2CLRJ3.mjs} +6 -6
  31. package/dist/{chunk-YGR2IN4R.js → chunk-JWFOWPMB.js} +163 -155
  32. package/dist/{chunk-6V2AWT4R.mjs → chunk-KAPZHDO4.mjs} +1 -1
  33. package/dist/{chunk-EEN5OTCR.mjs → chunk-KDXNWGPB.mjs} +1 -1
  34. package/dist/{chunk-UUMKZJRJ.cjs → chunk-KPOL2YEO.cjs} +18 -6
  35. package/dist/{chunk-J6DUHITE.cjs → chunk-MA74OYCI.cjs} +6 -6
  36. package/dist/{chunk-H626ZTDZ.mjs → chunk-MUMBUXU6.mjs} +53 -32
  37. package/dist/{chunk-5LC7V2OZ.cjs → chunk-NQW3YUFN.cjs} +18 -18
  38. package/dist/{chunk-EICAJDNX.cjs → chunk-OO7BGCC3.cjs} +54 -34
  39. package/dist/{chunk-7GBJYOX7.mjs → chunk-OX6MF7SZ.mjs} +163 -155
  40. package/dist/{chunk-WVSZOPGQ.cjs → chunk-QBVS3UYN.cjs} +245 -237
  41. package/dist/{chunk-WUDHOZIH.js → chunk-RZGB3DXR.js} +182 -34
  42. package/dist/{chunk-COOW7BJX.mjs → chunk-URVS2OE2.mjs} +3 -3
  43. package/dist/{chunk-HCJ4S3YB.js → chunk-UZQ3BB6W.mjs} +18 -6
  44. package/dist/{chunk-KNTJ7FQB.cjs → chunk-YQWZ7FZX.cjs} +5 -5
  45. package/dist/{chunk-ELIECDYN.cjs → chunk-Z2YIDHRI.cjs} +5 -5
  46. package/dist/{chunk-2JHJ4YHS.cjs → chunk-ZDZNV6NA.cjs} +59 -38
  47. package/dist/core/index.cjs +8 -8
  48. package/dist/core/index.js +7 -7
  49. package/dist/core/index.mjs +7 -7
  50. package/dist/http/index.cjs +54 -54
  51. package/dist/http/index.js +7 -7
  52. package/dist/http/index.mjs +7 -7
  53. package/dist/http/testing.cjs +9 -9
  54. package/dist/http/testing.js +5 -5
  55. package/dist/http/testing.mjs +5 -5
  56. package/dist/index.cjs +86 -86
  57. package/dist/index.js +8 -8
  58. package/dist/index.mjs +8 -8
  59. package/dist/observability/index.cjs +10 -10
  60. package/dist/observability/index.js +9 -9
  61. package/dist/observability/index.mjs +9 -9
  62. package/dist/perf/cli.cjs +26 -26
  63. package/dist/perf/cli.js +11 -11
  64. package/dist/perf/cli.mjs +11 -11
  65. package/dist/perf/index.cjs +13 -13
  66. package/dist/perf/index.js +11 -11
  67. package/dist/perf/index.mjs +11 -11
  68. package/dist/schema/index.cjs +2 -2
  69. package/dist/schema/index.js +1 -1
  70. package/dist/schema/index.mjs +1 -1
  71. package/package.json +1 -1
@@ -3,18 +3,18 @@
3
3
  var _chunkL6VB5N7Qcjs = require('./chunk-L6VB5N7Q.cjs');
4
4
 
5
5
 
6
- var _chunkEICAJDNXcjs = require('./chunk-EICAJDNX.cjs');
6
+ var _chunkOO7BGCC3cjs = require('./chunk-OO7BGCC3.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunk5RZ7YITFcjs = require('./chunk-5RZ7YITF.cjs');
12
+ var _chunk6STX4PS3cjs = require('./chunk-6STX4PS3.cjs');
13
13
 
14
14
 
15
15
 
16
16
 
17
- var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
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 _chunkUUMKZJRJcjs = require('./chunk-UUMKZJRJ.cjs');
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 = _chunk2JHJ4YHScjs.resolveWasmModule.call(void 0, );
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 ? _chunk5RZ7YITFcjs.makeScheduleDriver.call(void 0, 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 = _chunk2JHJ4YHScjs.resolveWasmModule.call(void 0, );
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);
@@ -2314,6 +2314,7 @@ var linkAbortSignals = (...signals) => {
2314
2314
  };
2315
2315
  };
2316
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";
2317
2318
  var hasMethod = (value, name) => typeof value === "object" && value !== null && typeof value[name] === "function";
2318
2319
  var defaultPromiseBody = (response, mode) => {
2319
2320
  if (mode === "json" && hasMethod(response, "json")) return response.json();
@@ -2360,45 +2361,89 @@ var toPromiseTransportResponse = (bodyText, info) => ({
2360
2361
  function makePromiseHttpTransport(config) {
2361
2362
  const transport = (context) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
2362
2363
  let done = false;
2364
+ const signal = context.signal;
2365
+ const needsAbortListener = signal !== globalThis.__brassNoopSignal;
2366
+ let abort;
2363
2367
  const finish = (exit) => {
2364
2368
  if (done) return;
2365
2369
  done = true;
2366
- context.signal.removeEventListener("abort", abort);
2370
+ if (needsAbortListener && abort) signal.removeEventListener("abort", abort);
2367
2371
  cb(exit);
2368
2372
  };
2369
2373
  const fail = (error) => finish({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(error) });
2370
- const abort = () => fail(abortErrorForSignal(context.signal));
2371
- if (context.signal.aborted) {
2372
- abort();
2374
+ if (signal.aborted) {
2375
+ fail(abortErrorForSignal(signal));
2373
2376
  return;
2374
2377
  }
2375
- context.signal.addEventListener("abort", abort, { once: true });
2376
- const run = async () => {
2377
- const startedAt = nowMs();
2378
- try {
2379
- const raw = await config.request(context);
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;
2380
2398
  const durationMs = Math.round(nowMs() - startedAt);
2381
- const mapped = await config.response(raw, context, { startedAt, durationMs });
2382
- finish({
2383
- _tag: "Success",
2384
- value: {
2385
- ...mapped,
2386
- ms: _nullishCoalesce(mapped.ms, () => ( durationMs))
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;
2387
2408
  }
2388
- });
2389
- } catch (error) {
2390
- if (context.signal.aborted) {
2391
- fail(abortErrorForSignal(context.signal));
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));
2392
2438
  return;
2393
2439
  }
2394
- fail(_nullishCoalesce(_optionalChain([config, 'access', _47 => _47.error, 'optionalCall', _48 => _48(error, context)]), () => ( normalizeHttpError(error, { signal: context.signal }))));
2440
+ fail(_nullishCoalesce(_optionalChain([config, 'access', _53 => _53.error, 'optionalCall', _54 => _54(error, context)]), () => ( normalizeHttpError(error, { signal }))));
2395
2441
  }
2396
- };
2397
- void run();
2442
+ );
2398
2443
  return () => {
2399
2444
  if (done) return;
2400
2445
  done = true;
2401
- context.signal.removeEventListener("abort", abort);
2446
+ if (needsAbortListener && abort) signal.removeEventListener("abort", abort);
2402
2447
  };
2403
2448
  });
2404
2449
  const marked = transport;
@@ -2411,7 +2456,7 @@ function makePromiseHttpTransport(config) {
2411
2456
  const mapped = await config.response(raw, context, { startedAt, durationMs });
2412
2457
  return { ...mapped, ms: _nullishCoalesce(mapped.ms, () => ( durationMs)) };
2413
2458
  } catch (error) {
2414
- throw _nullishCoalesce(_optionalChain([config, 'access', _49 => _49.error, 'optionalCall', _50 => _50(error, context)]), () => ( normalizeHttpError(error, { signal: context.signal })));
2459
+ throw _nullishCoalesce(_optionalChain([config, 'access', _55 => _55.error, 'optionalCall', _56 => _56(error, context)]), () => ( normalizeHttpError(error, { signal: context.signal })));
2415
2460
  }
2416
2461
  };
2417
2462
  return marked;
@@ -2475,7 +2520,7 @@ function makeFetchTransport() {
2475
2520
  return;
2476
2521
  }
2477
2522
  const localController = new AbortController();
2478
- const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.signal]), localController.signal);
2523
+ const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.signal]), localController.signal);
2479
2524
  let done = false;
2480
2525
  const finish = (exit) => {
2481
2526
  if (done) return;
@@ -2530,7 +2575,7 @@ function makeFetchStreamTransport() {
2530
2575
  return;
2531
2576
  }
2532
2577
  const localController = new AbortController();
2533
- const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.signal]), localController.signal);
2578
+ const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.signal]), localController.signal);
2534
2579
  let done = false;
2535
2580
  let cleanupTransferredToBody = false;
2536
2581
  const cleanup = () => {
@@ -2555,7 +2600,7 @@ function makeFetchStreamTransport() {
2555
2600
  });
2556
2601
  const headers = headersOf(response);
2557
2602
  const latencyMs = Math.round(nowMs() - started);
2558
- const body = _chunkEICAJDNXcjs.streamFromReadableStream.call(void 0, response.body, normalizeHttpError, {
2603
+ const body = _chunkOO7BGCC3cjs.streamFromReadableStream.call(void 0, response.body, normalizeHttpError, {
2559
2604
  signal: linkedSignal.signal,
2560
2605
  onRelease: linkedSignal.cleanup
2561
2606
  });
@@ -2589,181 +2634,181 @@ function makeFetchStreamTransport() {
2589
2634
  }
2590
2635
 
2591
2636
  // src/http/configValidation.ts
2592
- var fn = _chunkUUMKZJRJcjs.Schema.custom((value) => typeof value === "function", "function");
2593
- var object = _chunkUUMKZJRJcjs.Schema.custom(
2637
+ var fn = _chunkKPOL2YEOcjs.Schema.custom((value) => typeof value === "function", "function");
2638
+ var object = _chunkKPOL2YEOcjs.Schema.custom(
2594
2639
  (value) => typeof value === "object" && value !== null && !Array.isArray(value),
2595
2640
  "object"
2596
2641
  );
2597
- var keyResolver = _chunkUUMKZJRJcjs.Schema.union([
2598
- _chunkUUMKZJRJcjs.Schema.enum(["global", "origin", "host"]),
2642
+ var keyResolver = _chunkKPOL2YEOcjs.Schema.union([
2643
+ _chunkKPOL2YEOcjs.Schema.enum(["global", "origin", "host"]),
2599
2644
  fn
2600
2645
  ]);
2601
- var headroomStrategyConfig = _chunkUUMKZJRJcjs.Schema.union([
2602
- _chunkUUMKZJRJcjs.Schema.number({ min: 1 }),
2603
- _chunkUUMKZJRJcjs.Schema.enum(["fixed", "proportional"]),
2646
+ var headroomStrategyConfig = _chunkKPOL2YEOcjs.Schema.union([
2647
+ _chunkKPOL2YEOcjs.Schema.number({ min: 1 }),
2648
+ _chunkKPOL2YEOcjs.Schema.enum(["fixed", "proportional"]),
2604
2649
  fn,
2605
- _chunkUUMKZJRJcjs.Schema.object({
2606
- type: _chunkUUMKZJRJcjs.Schema.literal("fixed"),
2607
- value: _chunkUUMKZJRJcjs.Schema.number({ min: 1 }).optional()
2650
+ _chunkKPOL2YEOcjs.Schema.object({
2651
+ type: _chunkKPOL2YEOcjs.Schema.literal("fixed"),
2652
+ value: _chunkKPOL2YEOcjs.Schema.number({ min: 1 }).optional()
2608
2653
  }, { unknownKeys: "passthrough" }),
2609
- _chunkUUMKZJRJcjs.Schema.object({
2610
- type: _chunkUUMKZJRJcjs.Schema.literal("proportional"),
2611
- ratio: _chunkUUMKZJRJcjs.Schema.number({ min: 0 }).refine((n) => n > 0, "ratio must be > 0").optional(),
2612
- min: _chunkUUMKZJRJcjs.Schema.number({ min: 1 }).optional(),
2613
- max: _chunkUUMKZJRJcjs.Schema.number({ min: 1 }).optional()
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()
2614
2659
  }, { unknownKeys: "passthrough" })
2615
2660
  ]);
2616
- var poolConfig = _chunkUUMKZJRJcjs.Schema.union([
2617
- _chunkUUMKZJRJcjs.Schema.literal(false),
2618
- _chunkUUMKZJRJcjs.Schema.object({
2619
- concurrency: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2620
- maxQueue: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2621
- queueTimeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2622
2667
  key: keyResolver.optional(),
2623
- engine: _chunkUUMKZJRJcjs.Schema.enum(["ts", "wasm"]).optional(),
2624
- wasm: _chunkUUMKZJRJcjs.Schema.boolean().optional()
2668
+ engine: _chunkKPOL2YEOcjs.Schema.enum(["ts", "wasm"]).optional(),
2669
+ wasm: _chunkKPOL2YEOcjs.Schema.boolean().optional()
2625
2670
  }, { unknownKeys: "passthrough" })
2626
2671
  ]);
2627
- var adaptiveLimiterConfig = _chunkUUMKZJRJcjs.Schema.union([
2628
- _chunkUUMKZJRJcjs.Schema.literal(false),
2629
- _chunkUUMKZJRJcjs.Schema.object({
2630
- preset: _chunkUUMKZJRJcjs.Schema.enum(["conservative", "balanced", "aggressive"]).optional(),
2631
- initialLimit: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2632
- minLimit: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2633
- maxLimit: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2634
- smoothingFactor: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "smoothingFactor must be in (0, 1]").optional(),
2635
- probeInterval: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2636
- probeJitterRatio: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).optional(),
2637
- windowSize: _chunkUUMKZJRJcjs.Schema.number({ min: 2, int: true }).optional(),
2638
- minSamples: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2639
- baselineStrategy: _chunkUUMKZJRJcjs.Schema.enum(["min", "p5", "ema-low"]).optional(),
2640
- decreaseCooldownSamples: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2641
- historySize: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2642
- windowDecayFactor: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "windowDecayFactor must be in (0, 1]").optional(),
2643
- errorWeight: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).optional(),
2644
- errorSmoothingFactor: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "errorSmoothingFactor must be in (0, 1]").optional(),
2645
- errorStatusThreshold: _chunkUUMKZJRJcjs.Schema.number({ min: 100, max: 599, int: true }).optional(),
2646
- queueStrategy: _chunkUUMKZJRJcjs.Schema.enum(["fifo", "priority"]).optional(),
2647
- queueLoadShedding: _chunkUUMKZJRJcjs.Schema.enum(["reject-new", "priority-evict"]).optional(),
2648
- rejectionBackoffThreshold: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2649
- rejectionBackoffMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2650
- stateTtlMs: _chunkUUMKZJRJcjs.Schema.union([_chunkUUMKZJRJcjs.Schema.literal(false), _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true })]).optional(),
2651
- warmupRequests: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2652
- decreaseThreshold: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "decreaseThreshold must be in (0, 1]").optional(),
2653
- increaseThreshold: _chunkUUMKZJRJcjs.Schema.number({ min: 1 }).optional(),
2654
- maxDecreaseRatio: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "maxDecreaseRatio must be in (0, 1]").optional(),
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(),
2655
2700
  headroomStrategy: headroomStrategyConfig.optional(),
2656
- slowStartRecovery: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
2657
- slowStartSaturationThreshold: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 1 }).refine((n) => n > 0, "slowStartSaturationThreshold must be in (0, 1]").optional(),
2658
- slowStartSaturationSamples: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2659
2704
  key: keyResolver.optional(),
2660
- maxQueue: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2661
- queueTimeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2705
+ maxQueue: _chunkKPOL2YEOcjs.Schema.number({ min: 0, int: true }).optional(),
2706
+ queueTimeoutMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }).optional(),
2662
2707
  onLimitChange: fn.optional(),
2663
- percentile: _chunkUUMKZJRJcjs.Schema.enum(["p50", "p99"]).optional()
2708
+ percentile: _chunkKPOL2YEOcjs.Schema.enum(["p50", "p99"]).optional()
2664
2709
  }, { unknownKeys: "passthrough" })
2665
2710
  ]);
2666
- var cacheConfig = _chunkUUMKZJRJcjs.Schema.union([
2667
- _chunkUUMKZJRJcjs.Schema.literal(false),
2668
- _chunkUUMKZJRJcjs.Schema.object({
2669
- ttlSeconds: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2670
- maxEntries: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2671
- staleWhileRevalidate: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
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(),
2672
2717
  cachePolicy: fn.optional(),
2673
- cacheRelevantHeaders: _chunkUUMKZJRJcjs.Schema.array(_chunkUUMKZJRJcjs.Schema.string()).optional(),
2718
+ cacheRelevantHeaders: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.string()).optional(),
2674
2719
  onEvent: fn.optional(),
2675
2720
  onLifecycleEvent: fn.optional()
2676
2721
  }, { unknownKeys: "passthrough" })
2677
2722
  ]);
2678
- var priorityConfig = _chunkUUMKZJRJcjs.Schema.union([
2679
- _chunkUUMKZJRJcjs.Schema.literal(false),
2680
- _chunkUUMKZJRJcjs.Schema.object({
2681
- concurrency: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2682
- queueTimeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2683
2728
  onEvent: fn.optional()
2684
2729
  }, { unknownKeys: "passthrough" })
2685
2730
  ]);
2686
- var retryConfig = _chunkUUMKZJRJcjs.Schema.union([
2687
- _chunkUUMKZJRJcjs.Schema.literal(false),
2688
- _chunkUUMKZJRJcjs.Schema.object({
2689
- maxRetries: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2690
- baseDelayMs: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2691
- maxDelayMs: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2692
- maxElapsedMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2693
- respectRetryAfter: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
2694
- retryOnMethods: _chunkUUMKZJRJcjs.Schema.array(_chunkUUMKZJRJcjs.Schema.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"])).optional(),
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(),
2695
2740
  retryOnStatus: fn.optional(),
2696
2741
  retryOnError: fn.optional(),
2697
- engine: _chunkUUMKZJRJcjs.Schema.enum(["ts", "wasm"]).optional(),
2698
- wasm: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
2742
+ engine: _chunkKPOL2YEOcjs.Schema.enum(["ts", "wasm"]).optional(),
2743
+ wasm: _chunkKPOL2YEOcjs.Schema.boolean().optional(),
2699
2744
  onRetry: fn.optional()
2700
2745
  }, { unknownKeys: "passthrough" })
2701
2746
  ]);
2702
- var requestRetryOverrideConfig = _chunkUUMKZJRJcjs.Schema.union([
2703
- _chunkUUMKZJRJcjs.Schema.literal(false),
2704
- _chunkUUMKZJRJcjs.Schema.object({
2705
- maxRetries: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2706
- baseDelayMs: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
2707
- maxDelayMs: _chunkUUMKZJRJcjs.Schema.number({ min: 0, int: true }).optional(),
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(),
2708
2753
  schedule: object.optional(),
2709
2754
  retryOnStatus: fn.optional()
2710
2755
  }, { unknownKeys: "passthrough" })
2711
2756
  ]);
2712
- var requestPolicyConfig = _chunkUUMKZJRJcjs.Schema.object({
2713
- preset: _chunkUUMKZJRJcjs.Schema.string({ minLength: 1 }).optional(),
2714
- lane: _chunkUUMKZJRJcjs.Schema.string({ minLength: 1 }).optional(),
2715
- dedupKey: _chunkUUMKZJRJcjs.Schema.string({ minLength: 1 }).optional(),
2716
- priority: _chunkUUMKZJRJcjs.Schema.number({ min: 0, max: 9, int: true }).optional(),
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(),
2717
2762
  retry: requestRetryOverrideConfig.optional(),
2718
- poolKey: _chunkUUMKZJRJcjs.Schema.string({ minLength: 1 }).optional()
2763
+ poolKey: _chunkKPOL2YEOcjs.Schema.string({ minLength: 1 }).optional()
2719
2764
  }, { unknownKeys: "passthrough" });
2720
- var policyPresetsConfig = _chunkUUMKZJRJcjs.Schema.record(_chunkUUMKZJRJcjs.Schema.union([requestPolicyConfig, fn]));
2721
- var compressionConfig = _chunkUUMKZJRJcjs.Schema.union([
2722
- _chunkUUMKZJRJcjs.Schema.literal(false),
2723
- _chunkUUMKZJRJcjs.Schema.object({
2724
- encodings: _chunkUUMKZJRJcjs.Schema.array(_chunkUUMKZJRJcjs.Schema.enum(["gzip", "br", "deflate"])).optional()
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()
2725
2770
  }, { unknownKeys: "passthrough" })
2726
2771
  ]);
2727
- var prewarmConfig = _chunkUUMKZJRJcjs.Schema.union([
2728
- _chunkUUMKZJRJcjs.Schema.literal(false),
2729
- _chunkUUMKZJRJcjs.Schema.object({
2730
- origins: _chunkUUMKZJRJcjs.Schema.array(_chunkUUMKZJRJcjs.Schema.string()).optional(),
2772
+ var prewarmConfig = _chunkKPOL2YEOcjs.Schema.union([
2773
+ _chunkKPOL2YEOcjs.Schema.literal(false),
2774
+ _chunkKPOL2YEOcjs.Schema.object({
2775
+ origins: _chunkKPOL2YEOcjs.Schema.array(_chunkKPOL2YEOcjs.Schema.string()).optional(),
2731
2776
  afterResponse: fn.optional(),
2732
- keepAliveDurationMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2733
- budget: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2734
- probeTimeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
2735
- autoRefresh: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
2736
- useClientPool: _chunkUUMKZJRJcjs.Schema.boolean().optional(),
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(),
2737
2782
  onEvent: fn.optional()
2738
2783
  }, { unknownKeys: "passthrough" })
2739
2784
  ]);
2740
- var batchConfig = _chunkUUMKZJRJcjs.Schema.union([
2741
- _chunkUUMKZJRJcjs.Schema.literal(false),
2742
- _chunkUUMKZJRJcjs.Schema.object({
2785
+ var batchConfig = _chunkKPOL2YEOcjs.Schema.union([
2786
+ _chunkKPOL2YEOcjs.Schema.literal(false),
2787
+ _chunkKPOL2YEOcjs.Schema.object({
2743
2788
  batch: object,
2744
- windowMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }),
2745
- maxBatchSize: _chunkUUMKZJRJcjs.Schema.number({ min: 2, int: true }),
2789
+ windowMs: _chunkKPOL2YEOcjs.Schema.number({ min: 1, int: true }),
2790
+ maxBatchSize: _chunkKPOL2YEOcjs.Schema.number({ min: 2, int: true }),
2746
2791
  batchKey: fn
2747
2792
  }, { unknownKeys: "passthrough" })
2748
2793
  ]);
2749
- var wireConfig = _chunkUUMKZJRJcjs.Schema.object({
2750
- baseUrl: _chunkUUMKZJRJcjs.Schema.string().optional(),
2751
- headers: _chunkUUMKZJRJcjs.Schema.record(_chunkUUMKZJRJcjs.Schema.string()).optional(),
2752
- timeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2753
2798
  transport: fn.optional(),
2754
2799
  streamTransport: fn.optional(),
2755
2800
  pool: poolConfig.optional(),
2756
2801
  adaptiveLimiter: adaptiveLimiterConfig.optional()
2757
2802
  }, { unknownKeys: "passthrough" });
2758
- var lifecycleConfig = _chunkUUMKZJRJcjs.Schema.object({
2759
- baseUrl: _chunkUUMKZJRJcjs.Schema.string().optional(),
2760
- headers: _chunkUUMKZJRJcjs.Schema.record(_chunkUUMKZJRJcjs.Schema.string()).optional(),
2761
- timeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2762
2807
  transport: fn.optional(),
2763
2808
  streamTransport: fn.optional(),
2764
2809
  pool: poolConfig.optional(),
2765
2810
  adaptiveLimiter: adaptiveLimiterConfig.optional(),
2766
- dedup: _chunkUUMKZJRJcjs.Schema.union([_chunkUUMKZJRJcjs.Schema.literal(false), object]).optional(),
2811
+ dedup: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), object]).optional(),
2767
2812
  batch: batchConfig.optional(),
2768
2813
  cache: cacheConfig.optional(),
2769
2814
  priority: priorityConfig.optional(),
@@ -2772,34 +2817,34 @@ var lifecycleConfig = _chunkUUMKZJRJcjs.Schema.object({
2772
2817
  onEvent: fn.optional(),
2773
2818
  policyPresets: policyPresetsConfig.optional()
2774
2819
  }, { unknownKeys: "passthrough" });
2775
- var defaultClientConfig = _chunkUUMKZJRJcjs.Schema.object({
2776
- baseUrl: _chunkUUMKZJRJcjs.Schema.string().optional(),
2777
- headers: _chunkUUMKZJRJcjs.Schema.record(_chunkUUMKZJRJcjs.Schema.string()).optional(),
2778
- timeoutMs: _chunkUUMKZJRJcjs.Schema.number({ min: 1, int: true }).optional(),
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(),
2779
2824
  transport: fn.optional(),
2780
2825
  streamTransport: fn.optional(),
2781
2826
  pool: poolConfig.optional(),
2782
2827
  adaptiveLimiter: adaptiveLimiterConfig.optional(),
2783
- dedup: _chunkUUMKZJRJcjs.Schema.union([_chunkUUMKZJRJcjs.Schema.literal(false), object]).optional(),
2828
+ dedup: _chunkKPOL2YEOcjs.Schema.union([_chunkKPOL2YEOcjs.Schema.literal(false), object]).optional(),
2784
2829
  batch: batchConfig.optional(),
2785
2830
  cache: cacheConfig.optional(),
2786
2831
  priority: priorityConfig.optional(),
2787
2832
  retry: retryConfig.optional(),
2788
2833
  prewarm: prewarmConfig.optional(),
2789
2834
  onEvent: fn.optional(),
2790
- preset: _chunkUUMKZJRJcjs.Schema.enum(["minimal", "proxy", "highThroughputProxy", "balanced", "default", "production"]).optional(),
2835
+ preset: _chunkKPOL2YEOcjs.Schema.enum(["minimal", "proxy", "highThroughputProxy", "balanced", "default", "production"]).optional(),
2791
2836
  compression: compressionConfig.optional(),
2792
- middleware: _chunkUUMKZJRJcjs.Schema.array(fn).optional(),
2837
+ middleware: _chunkKPOL2YEOcjs.Schema.array(fn).optional(),
2793
2838
  policyPresets: policyPresetsConfig.optional()
2794
2839
  }, { unknownKeys: "passthrough" });
2795
2840
  function validateMakeHttpConfig(config) {
2796
- _chunkUUMKZJRJcjs.parseConfig.call(void 0, "MakeHttpConfig", wireConfig, config);
2841
+ _chunkKPOL2YEOcjs.parseConfig.call(void 0, "MakeHttpConfig", wireConfig, config);
2797
2842
  }
2798
2843
  function validateLifecycleClientConfig(config) {
2799
- _chunkUUMKZJRJcjs.parseConfig.call(void 0, "LifecycleClientConfig", lifecycleConfig, config);
2844
+ _chunkKPOL2YEOcjs.parseConfig.call(void 0, "LifecycleClientConfig", lifecycleConfig, config);
2800
2845
  }
2801
2846
  function validateDefaultHttpClientConfig(config) {
2802
- _chunkUUMKZJRJcjs.parseConfig.call(void 0, "DefaultHttpClientConfig", defaultClientConfig, config);
2847
+ _chunkKPOL2YEOcjs.parseConfig.call(void 0, "DefaultHttpClientConfig", defaultClientConfig, config);
2803
2848
  }
2804
2849
 
2805
2850
  // src/http/client.ts
@@ -2840,7 +2885,7 @@ var normalizeHeadersInit = (h) => {
2840
2885
  };
2841
2886
  var normalizeRequest = (defaultHeaders) => (req0) => {
2842
2887
  let req = Object.keys(defaultHeaders).length ? mergeHeadersUnder(defaultHeaders)(req0) : req0;
2843
- const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.headers]));
2888
+ const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.headers]));
2844
2889
  if (initHeaders && Object.keys(initHeaders).length) {
2845
2890
  req = mergeHeadersUnder(initHeaders)(req);
2846
2891
  }
@@ -2928,7 +2973,7 @@ var timeoutReason = (req, url, timeoutMs) => ({
2928
2973
  var requestPriority = (req) => {
2929
2974
  const fromPolicy = getHttpRequestPolicy(req).priority;
2930
2975
  if (fromPolicy !== void 0) return fromPolicy;
2931
- return _optionalChain([req, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.priority]);
2976
+ return _optionalChain([req, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.priority]);
2932
2977
  };
2933
2978
  var exitError = (exit) => {
2934
2979
  if (exit._tag === "Success") return void 0;
@@ -2959,7 +3004,7 @@ var runTransportEffect = (effect, env, signal) => new Promise((resolve, reject)
2959
3004
  signal.removeEventListener("abort", abort);
2960
3005
  const currentCancel = cancel;
2961
3006
  cancel = void 0;
2962
- _optionalChain([currentCancel, 'optionalCall', _59 => _59()]);
3007
+ _optionalChain([currentCancel, 'optionalCall', _65 => _65()]);
2963
3008
  reject(abortErrorForSignal(signal));
2964
3009
  };
2965
3010
  if (signal.aborted) {
@@ -2980,13 +3025,13 @@ var runDirectTransport = (req, url, transport, metrics) => ({
2980
3025
  _tag: "Async",
2981
3026
  register: (env, cb) => {
2982
3027
  const controller = new AbortController();
2983
- const previousSignal = _optionalChain([req, 'access', _60 => _60.init, 'optionalAccess', _61 => _61.signal]);
3028
+ const previousSignal = _optionalChain([req, 'access', _66 => _66.init, 'optionalAccess', _67 => _67.signal]);
2984
3029
  const label = fetchLabel(req, url);
2985
3030
  const startedAt = performance.now();
2986
3031
  let done = false;
2987
3032
  let cancelInner;
2988
3033
  const cleanup = () => {
2989
- _optionalChain([previousSignal, 'optionalAccess', _62 => _62.removeEventListener, 'call', _63 => _63("abort", abortFromPrevious)]);
3034
+ _optionalChain([previousSignal, 'optionalAccess', _68 => _68.removeEventListener, 'call', _69 => _69("abort", abortFromPrevious)]);
2990
3035
  };
2991
3036
  const finish = (outcome, exit, error) => {
2992
3037
  if (done) return;
@@ -3012,20 +3057,20 @@ var runDirectTransport = (req, url, transport, metrics) => ({
3012
3057
  };
3013
3058
  function abortFromPrevious() {
3014
3059
  const error = previousSignal ? abortErrorForSignal(previousSignal) : { _tag: "Abort" };
3015
- abortCurrent(_optionalChain([previousSignal, 'optionalAccess', _64 => _64.reason]));
3060
+ abortCurrent(_optionalChain([previousSignal, 'optionalAccess', _70 => _70.reason]));
3016
3061
  const cancel = cancelInner;
3017
3062
  cancelInner = void 0;
3018
3063
  queueMicrotask(() => {
3019
3064
  finishFailure(error);
3020
- _optionalChain([cancel, 'optionalCall', _65 => _65()]);
3065
+ _optionalChain([cancel, 'optionalCall', _71 => _71()]);
3021
3066
  });
3022
3067
  }
3023
3068
  metrics.onStart();
3024
- if (_optionalChain([previousSignal, 'optionalAccess', _66 => _66.aborted])) {
3069
+ if (_optionalChain([previousSignal, 'optionalAccess', _72 => _72.aborted])) {
3025
3070
  abortFromPrevious();
3026
3071
  return () => void 0;
3027
3072
  }
3028
- _optionalChain([previousSignal, 'optionalAccess', _67 => _67.addEventListener, 'call', _68 => _68("abort", abortFromPrevious, { once: true })]);
3073
+ _optionalChain([previousSignal, 'optionalAccess', _73 => _73.addEventListener, 'call', _74 => _74("abort", abortFromPrevious, { once: true })]);
3029
3074
  try {
3030
3075
  const innerCancel = _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0,
3031
3076
  transport({ request: req, url, signal: controller.signal }),
@@ -3050,7 +3095,7 @@ var runDirectTransport = (req, url, transport, metrics) => ({
3050
3095
  cancelInner = void 0;
3051
3096
  abortCurrent();
3052
3097
  finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
3053
- _optionalChain([cancel, 'optionalCall', _69 => _69()]);
3098
+ _optionalChain([cancel, 'optionalCall', _75 => _75()]);
3054
3099
  };
3055
3100
  }
3056
3101
  });
@@ -3090,10 +3135,10 @@ function makeHttpStream(cfg = {}) {
3090
3135
  const url = resolveRequestUrl(req, baseUrl);
3091
3136
  if (!(url instanceof URL)) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, url);
3092
3137
  const timeoutMs = resolvePositiveTimeout(_nullishCoalesce(req.timeoutMs, () => ( cfg.timeoutMs)));
3093
- return _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
3138
+ return _chunkZDZNV6NAcjs.fromPromiseAbortable.call(void 0,
3094
3139
  async (signal, env) => {
3095
3140
  let lease;
3096
- const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _70 => _70.init, 'optionalAccess', _71 => _71.signal]));
3141
+ const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _76 => _76.init, 'optionalAccess', _77 => _77.signal]));
3097
3142
  try {
3098
3143
  if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
3099
3144
  if (adaptiveLimiter) {
@@ -3155,10 +3200,10 @@ function makeHttp(cfg = {}) {
3155
3200
  if (!adaptiveLimiter && !pool && timeoutMs === void 0) {
3156
3201
  return runDirectTransport(req, url, transport, metrics);
3157
3202
  }
3158
- return _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
3203
+ return _chunkZDZNV6NAcjs.fromPromiseAbortable.call(void 0,
3159
3204
  async (signal, env) => {
3160
3205
  let lease;
3161
- const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _72 => _72.init, 'optionalAccess', _73 => _73.signal]));
3206
+ const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _78 => _78.init, 'optionalAccess', _79 => _79.signal]));
3162
3207
  try {
3163
3208
  if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
3164
3209
  if (adaptiveLimiter) {
@@ -3196,12 +3241,12 @@ function makeHttp(cfg = {}) {
3196
3241
  if (adaptiveLimiter) metadata.adaptiveLimiter = adaptiveLimiter;
3197
3242
  if (adaptiveLimiter || destroyTransport) {
3198
3243
  metadata.destroy = () => {
3199
- _optionalChain([adaptiveLimiter, 'optionalAccess', _74 => _74.destroy, 'call', _75 => _75()]);
3200
- _optionalChain([destroyTransport, 'optionalCall', _76 => _76()]);
3244
+ _optionalChain([adaptiveLimiter, 'optionalAccess', _80 => _80.destroy, 'call', _81 => _81()]);
3245
+ _optionalChain([destroyTransport, 'optionalCall', _82 => _82()]);
3201
3246
  };
3202
3247
  metadata.shutdown = () => {
3203
- _optionalChain([adaptiveLimiter, 'optionalAccess', _77 => _77.shutdown, 'call', _78 => _78()]);
3204
- _optionalChain([destroyTransport, 'optionalCall', _79 => _79()]);
3248
+ _optionalChain([adaptiveLimiter, 'optionalAccess', _83 => _83.shutdown, 'call', _84 => _84()]);
3249
+ _optionalChain([destroyTransport, 'optionalCall', _85 => _85()]);
3205
3250
  };
3206
3251
  }
3207
3252
  return decorate(run, metrics.snapshot, metadata);
@@ -3224,7 +3269,7 @@ var withRetryStream = (p) => (next) => {
3224
3269
  if (!canRetry) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
3225
3270
  const d = delayWithinBudget(backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs));
3226
3271
  if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
3227
- _optionalChain([p, 'access', _80 => _80.onRetry, 'optionalCall', _81 => _81({
3272
+ _optionalChain([p, 'access', _86 => _86.onRetry, 'optionalCall', _87 => _87({
3228
3273
  attempt,
3229
3274
  delayMs: d,
3230
3275
  error: e,
@@ -3233,7 +3278,7 @@ var withRetryStream = (p) => (next) => {
3233
3278
  method: req.method,
3234
3279
  timestamp: Date.now()
3235
3280
  })]);
3236
- return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk5RZ7YITFcjs.sleep.call(void 0, d), () => loop(attempt + 1));
3281
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk6STX4PS3cjs.sleep.call(void 0, d), () => loop(attempt + 1));
3237
3282
  },
3238
3283
  (w) => {
3239
3284
  const canRetry = attempt < p.maxRetries && retryOnStatus(w.status) && remainingBudget() > 0;
@@ -3242,7 +3287,7 @@ var withRetryStream = (p) => (next) => {
3242
3287
  const rawDelay = ra === void 0 ? backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs) : Math.min(ra, p.maxDelayMs);
3243
3288
  const d = delayWithinBudget(rawDelay);
3244
3289
  if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, w);
3245
- _optionalChain([p, 'access', _82 => _82.onRetry, 'optionalCall', _83 => _83({
3290
+ _optionalChain([p, 'access', _88 => _88.onRetry, 'optionalCall', _89 => _89({
3246
3291
  attempt,
3247
3292
  delayMs: d,
3248
3293
  error: void 0,
@@ -3251,7 +3296,7 @@ var withRetryStream = (p) => (next) => {
3251
3296
  method: req.method,
3252
3297
  timestamp: Date.now()
3253
3298
  })]);
3254
- return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk5RZ7YITFcjs.sleep.call(void 0, d), () => loop(attempt + 1));
3299
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk6STX4PS3cjs.sleep.call(void 0, d), () => loop(attempt + 1));
3255
3300
  }
3256
3301
  );
3257
3302
  return loop(0);
@@ -3280,6 +3325,53 @@ function httpBodyKeyPart(body) {
3280
3325
  // src/http/lifecycle/cacheKey.ts
3281
3326
  var SEPARATOR = "\0";
3282
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
+ }
3283
3375
  function computeCacheKey(req, baseUrl, extraHeaders = []) {
3284
3376
  const method = req.method.toUpperCase();
3285
3377
  const resolvedUrl = resolveKeyUrl(req.url, baseUrl);
@@ -3333,6 +3425,48 @@ var HOP_BY_HOP = /* @__PURE__ */ new Set([
3333
3425
  "upgrade"
3334
3426
  ]);
3335
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
+ }
3336
3470
  function computeDedupKey(req, baseUrl) {
3337
3471
  const method = req.method.toUpperCase();
3338
3472
  const resolvedUrl = resolveKeyUrl(req.url, baseUrl);
@@ -3360,8 +3494,9 @@ function causeDefectMessage(cause) {
3360
3494
  }
3361
3495
  function withDedup(config) {
3362
3496
  const inFlight = /* @__PURE__ */ new Map();
3363
- const customKeyFn = _optionalChain([config, 'optionalAccess', _84 => _84.dedupKey]);
3364
- const onEvent = _optionalChain([config, 'optionalAccess', _85 => _85.onEvent]);
3497
+ const customKeyFn = _optionalChain([config, 'optionalAccess', _90 => _90.dedupKey]);
3498
+ const onEvent = _optionalChain([config, 'optionalAccess', _91 => _91.onEvent]);
3499
+ const dedupKeyCtx = makeDedupKeyContext("");
3365
3500
  return (next) => {
3366
3501
  return (req) => {
3367
3502
  if (!SAFE_METHODS.has(req.method.toUpperCase())) {
@@ -3384,7 +3519,7 @@ function withDedup(config) {
3384
3519
  return next(req);
3385
3520
  }
3386
3521
  } else {
3387
- key = computeDedupKey(req, "");
3522
+ key = computeDedupKeyFast(req, dedupKeyCtx);
3388
3523
  }
3389
3524
  return {
3390
3525
  _tag: "Async",
@@ -3904,18 +4039,19 @@ function safeEmit2(onEvent, event) {
3904
4039
  }
3905
4040
  }
3906
4041
  function withCache(config) {
3907
- const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _86 => _86.ttlSeconds]), () => ( 60)), 1, 86400);
4042
+ const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _92 => _92.ttlSeconds]), () => ( 60)), 1, 86400);
3908
4043
  const ttlMs = ttlSeconds * 1e3;
3909
- const maxEntries = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _87 => _87.maxEntries]), () => ( 1024))));
3910
- const staleWhileRevalidate = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _88 => _88.staleWhileRevalidate]), () => ( false));
3911
- const cachePolicy = _optionalChain([config, 'optionalAccess', _89 => _89.cachePolicy]);
3912
- const cacheRelevantHeaders = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _90 => _90.cacheRelevantHeaders]), () => ( []));
3913
- const baseUrl = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _91 => _91.baseUrl]), () => ( ""));
3914
- const onEvent = _optionalChain([config, 'optionalAccess', _92 => _92.onEvent]);
3915
- const onLifecycleEvent = _optionalChain([config, 'optionalAccess', _93 => _93.onLifecycleEvent]);
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);
3916
4052
  const cache = new LRUCache({
3917
4053
  maxEntries,
3918
- onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall', _94 => _94({ type: "cache-eviction", count })])
4054
+ onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall', _100 => _100({ type: "cache-eviction", count })])
3919
4055
  });
3920
4056
  const revalidating = /* @__PURE__ */ new Set();
3921
4057
  const invalidate = (key) => {
@@ -3930,17 +4066,17 @@ function withCache(config) {
3930
4066
  if (!SAFE_METHODS.has(method) && !cachePolicy) {
3931
4067
  return next(req);
3932
4068
  }
3933
- const key = computeCacheKey(req, baseUrl, cacheRelevantHeaders);
4069
+ const key = computeCacheKeyFast(req, cacheKeyCtx);
3934
4070
  return {
3935
4071
  _tag: "Async",
3936
4072
  register: (env, cb) => {
3937
4073
  const cached = cache.get(key);
3938
4074
  if (cached !== void 0) {
3939
- _optionalChain([onLifecycleEvent, 'optionalCall', _95 => _95({ type: "cache-hit", cacheKey: key })]);
4075
+ _optionalChain([onLifecycleEvent, 'optionalCall', _101 => _101({ type: "cache-hit", cacheKey: key })]);
3940
4076
  cb({ _tag: "Success", value: cached });
3941
4077
  return;
3942
4078
  }
3943
- _optionalChain([onLifecycleEvent, 'optionalCall', _96 => _96({ type: "cache-miss", cacheKey: key })]);
4079
+ _optionalChain([onLifecycleEvent, 'optionalCall', _102 => _102({ type: "cache-miss", cacheKey: key })]);
3944
4080
  const innerEffect = next(req);
3945
4081
  return _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, innerEffect, env, (exit) => {
3946
4082
  if (exit._tag === "Success") {
@@ -3989,7 +4125,7 @@ function withCache(config) {
3989
4125
  if (!SAFE_METHODS.has(method) && !cachePolicy) {
3990
4126
  return next(req);
3991
4127
  }
3992
- const key = computeCacheKey(req, baseUrl, cacheRelevantHeaders);
4128
+ const key = computeCacheKeyFast(req, cacheKeyCtx);
3993
4129
  return {
3994
4130
  _tag: "Async",
3995
4131
  register: (env, cb) => {
@@ -3997,16 +4133,16 @@ function withCache(config) {
3997
4133
  if (cached !== void 0) {
3998
4134
  const expiresAt = expirationMap.get(key);
3999
4135
  if (expiresAt !== void 0 && now() < expiresAt) {
4000
- _optionalChain([onLifecycleEvent, 'optionalCall', _97 => _97({ type: "cache-hit", cacheKey: key })]);
4136
+ _optionalChain([onLifecycleEvent, 'optionalCall', _103 => _103({ type: "cache-hit", cacheKey: key })]);
4001
4137
  cb({ _tag: "Success", value: cached });
4002
4138
  return;
4003
4139
  }
4004
- _optionalChain([onLifecycleEvent, 'optionalCall', _98 => _98({ type: "cache-hit", cacheKey: key })]);
4140
+ _optionalChain([onLifecycleEvent, 'optionalCall', _104 => _104({ type: "cache-hit", cacheKey: key })]);
4005
4141
  cb({ _tag: "Success", value: cached });
4006
4142
  triggerRevalidation(next, req, key);
4007
4143
  return;
4008
4144
  }
4009
- _optionalChain([onLifecycleEvent, 'optionalCall', _99 => _99({ type: "cache-miss", cacheKey: key })]);
4145
+ _optionalChain([onLifecycleEvent, 'optionalCall', _105 => _105({ type: "cache-miss", cacheKey: key })]);
4010
4146
  const innerEffect = next(req);
4011
4147
  const handleSuccess = (res) => {
4012
4148
  swrStoreIfCacheable(req, res, key);
@@ -4259,7 +4395,7 @@ var DEFAULT_CONCURRENCY2 = 32;
4259
4395
  function extractPriority(req) {
4260
4396
  const fromPolicy = getHttpRequestPolicy(req).priority;
4261
4397
  if (fromPolicy !== void 0) return clampPriority2(fromPolicy);
4262
- const fromInit = _optionalChain([req, 'access', _100 => _100.init, 'optionalAccess', _101 => _101.priority]);
4398
+ const fromInit = _optionalChain([req, 'access', _106 => _106.init, 'optionalAccess', _107 => _107.priority]);
4263
4399
  if (fromInit !== void 0) return clampPriority2(fromInit);
4264
4400
  return 5;
4265
4401
  }
@@ -4271,9 +4407,9 @@ function safeEmit3(onEvent, event) {
4271
4407
  }
4272
4408
  }
4273
4409
  function withPriority(config) {
4274
- const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess', _102 => _102.concurrency]));
4275
- const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess', _103 => _103.queueTimeoutMs]));
4276
- const onEvent = _optionalChain([config, 'optionalAccess', _104 => _104.onEvent]);
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]);
4277
4413
  const queue = new PriorityQueue();
4278
4414
  let inFlight = 0;
4279
4415
  const queueDepth = () => {
@@ -4318,7 +4454,7 @@ function withPriority(config) {
4318
4454
  cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
4319
4455
  };
4320
4456
  signal.addEventListener("abort", abortHandler, { once: true });
4321
- } else if (_optionalChain([signal, 'optionalAccess', _105 => _105.aborted])) {
4457
+ } else if (_optionalChain([signal, 'optionalAccess', _111 => _111.aborted])) {
4322
4458
  entry.cancelled = true;
4323
4459
  cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
4324
4460
  return;
@@ -4364,7 +4500,7 @@ function withPriority(config) {
4364
4500
  clearTimeout(queued.timer);
4365
4501
  queued.timer = void 0;
4366
4502
  }
4367
- if (_optionalChain([queued, 'access', _106 => _106.signal, 'optionalAccess', _107 => _107.aborted])) {
4503
+ if (_optionalChain([queued, 'access', _112 => _112.signal, 'optionalAccess', _113 => _113.aborted])) {
4368
4504
  queued.cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
4369
4505
  continue;
4370
4506
  }
@@ -4384,7 +4520,7 @@ function resolveQueueTimeout(value) {
4384
4520
  return n > 0 ? n : void 0;
4385
4521
  }
4386
4522
  function getSignal(req) {
4387
- return _optionalChain([req, 'access', _108 => _108.init, 'optionalAccess', _109 => _109.signal]);
4523
+ return _optionalChain([req, 'access', _114 => _114.init, 'optionalAccess', _115 => _115.signal]);
4388
4524
  }
4389
4525
 
4390
4526
  // src/http/lifecycle/stats.ts
@@ -4773,9 +4909,9 @@ async function executeProbeViaClient(client, url, signal) {
4773
4909
  resolve({ ok: true });
4774
4910
  } else {
4775
4911
  const cause = exit.cause;
4776
- if (_optionalChain([cause, 'optionalAccess', _110 => _110._tag]) === "Fail") {
4912
+ if (_optionalChain([cause, 'optionalAccess', _116 => _116._tag]) === "Fail") {
4777
4913
  const err = cause.error;
4778
- resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _111 => _111.message]), () => ( _optionalChain([err, 'optionalAccess', _112 => _112._tag]))), () => ( "Unknown error")) });
4914
+ resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _117 => _117.message]), () => ( _optionalChain([err, 'optionalAccess', _118 => _118._tag]))), () => ( "Unknown error")) });
4779
4915
  } else {
4780
4916
  resolve({ ok: false, error: "cancelled" });
4781
4917
  }
@@ -5151,7 +5287,7 @@ function makeLifecycleClient(config = {}) {
5151
5287
  priorityMiddleware = withPriority({
5152
5288
  ...priorityConfig2,
5153
5289
  onEvent: (event) => {
5154
- tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess', _113 => _113.queueDepth, 'call', _114 => _114()]), () => ( 0)));
5290
+ tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess', _119 => _119.queueDepth, 'call', _120 => _120()]), () => ( 0)));
5155
5291
  tracker.emit(event.type, { priority: event.priority });
5156
5292
  }
5157
5293
  });
@@ -5214,9 +5350,9 @@ function makeLifecycleClient(config = {}) {
5214
5350
  attempt: event.attempt,
5215
5351
  delayMs: event.delayMs,
5216
5352
  status: event.status,
5217
- errorTag: _optionalChain([event, 'access', _115 => _115.error, 'optionalAccess', _116 => _116._tag])
5353
+ errorTag: _optionalChain([event, 'access', _121 => _121.error, 'optionalAccess', _122 => _122._tag])
5218
5354
  });
5219
- _optionalChain([retryConfig2, 'access', _117 => _117.onRetry, 'optionalCall', _118 => _118(event)]);
5355
+ _optionalChain([retryConfig2, 'access', _123 => _123.onRetry, 'optionalCall', _124 => _124(event)]);
5220
5356
  }
5221
5357
  })(composedFn);
5222
5358
  }
@@ -5248,13 +5384,13 @@ function makeLifecycleClient(config = {}) {
5248
5384
  }
5249
5385
  }
5250
5386
  return buildLifecycleClient(composedFn, tracker, {
5251
- cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _119 => _119.invalidate]), () => ( noopInvalidate)),
5252
- cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _120 => _120.clear]), () => ( noopClear)),
5387
+ cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _125 => _125.invalidate]), () => ( noopInvalidate)),
5388
+ cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _126 => _126.clear]), () => ( noopClear)),
5253
5389
  cancelAll: () => cancelActiveRequests(activeCancelers, prewarmMgr),
5254
5390
  shutdown: () => shutdownClient(activeCancelers, prewarmMgr, wireClient.shutdown),
5255
5391
  activeCancelers,
5256
5392
  adaptiveLimiter: wireClient.adaptiveLimiter,
5257
- queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess', _121 => _121.queueDepth]),
5393
+ queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess', _127 => _127.queueDepth]),
5258
5394
  prewarmManager: prewarmMgr,
5259
5395
  afterResponse: hasPrewarm ? config.prewarm.afterResponse : void 0
5260
5396
  });
@@ -5269,7 +5405,7 @@ function noopClear() {
5269
5405
  function buildLifecycleClient(fn2, tracker, internals) {
5270
5406
  const client = (req) => trackRequest(fn2, req, tracker, internals);
5271
5407
  const stats = () => {
5272
- tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access', _122 => _122.queueDepth, 'optionalCall', _123 => _123()]), () => ( 0)));
5408
+ tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access', _128 => _128.queueDepth, 'optionalCall', _129 => _129()]), () => ( 0)));
5273
5409
  return tracker.snapshot();
5274
5410
  };
5275
5411
  const withMw = (mw) => {
@@ -5309,14 +5445,14 @@ function cancelActiveRequests(activeCancelers, prewarmMgr) {
5309
5445
  }
5310
5446
  function shutdownClient(activeCancelers, prewarmMgr, wireShutdown) {
5311
5447
  cancelActiveRequests(activeCancelers, prewarmMgr);
5312
- _optionalChain([wireShutdown, 'optionalCall', _124 => _124()]);
5448
+ _optionalChain([wireShutdown, 'optionalCall', _130 => _130()]);
5313
5449
  return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
5314
5450
  }
5315
5451
  function trackRequest(fn2, req, tracker, internals) {
5316
5452
  return {
5317
5453
  _tag: "Async",
5318
5454
  register: (env, cb) => {
5319
- const previousSignal = _optionalChain([req, 'access', _125 => _125.init, 'optionalAccess', _126 => _126.signal]);
5455
+ const previousSignal = _optionalChain([req, 'access', _131 => _131.init, 'optionalAccess', _132 => _132.signal]);
5320
5456
  let done = false;
5321
5457
  let abortedByPreviousSignal = false;
5322
5458
  let abortedByLifecycle = false;
@@ -5325,7 +5461,7 @@ function trackRequest(fn2, req, tracker, internals) {
5325
5461
  if (done) return;
5326
5462
  done = true;
5327
5463
  const exit = (abortedByPreviousSignal || abortedByLifecycle) && exit0._tag === "Failure" && _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit0.cause) ? { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) } : exit0;
5328
- _optionalChain([previousSignal, 'optionalAccess', _127 => _127.removeEventListener, 'call', _128 => _128("abort", abortFromPrevious)]);
5464
+ _optionalChain([previousSignal, 'optionalAccess', _133 => _133.removeEventListener, 'call', _134 => _134("abort", abortFromPrevious)]);
5329
5465
  internals.activeCancelers.delete(cancelFromLifecycle);
5330
5466
  if (exit._tag === "Success") {
5331
5467
  tracker.requestCompleted();
@@ -5363,13 +5499,13 @@ function trackRequest(fn2, req, tracker, internals) {
5363
5499
  abortedByPreviousSignal = true;
5364
5500
  cancelActive();
5365
5501
  };
5366
- if (!_optionalChain([previousSignal, 'optionalAccess', _129 => _129.aborted])) {
5367
- _optionalChain([previousSignal, 'optionalAccess', _130 => _130.addEventListener, 'call', _131 => _131("abort", abortFromPrevious, { once: true })]);
5502
+ if (!_optionalChain([previousSignal, 'optionalAccess', _135 => _135.aborted])) {
5503
+ _optionalChain([previousSignal, 'optionalAccess', _136 => _136.addEventListener, 'call', _137 => _137("abort", abortFromPrevious, { once: true })]);
5368
5504
  }
5369
5505
  internals.activeCancelers.add(cancelFromLifecycle);
5370
5506
  tracker.requestStarted();
5371
5507
  tracker.emit("request-start");
5372
- if (_optionalChain([previousSignal, 'optionalAccess', _132 => _132.aborted])) {
5508
+ if (_optionalChain([previousSignal, 'optionalAccess', _138 => _138.aborted])) {
5373
5509
  abortFromPrevious();
5374
5510
  return () => void 0;
5375
5511
  }
@@ -5489,7 +5625,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
5489
5625
  const contentEncodingKey = Object.keys(res.headers).find(
5490
5626
  (k) => k.toLowerCase() === "content-encoding"
5491
5627
  );
5492
- const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access', _133 => _133.headers, 'access', _134 => _134[contentEncodingKey], 'optionalAccess', _135 => _135.trim, 'call', _136 => _136()]) : void 0;
5628
+ const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access', _139 => _139.headers, 'access', _140 => _140[contentEncodingKey], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]) : void 0;
5493
5629
  if (!contentEncodingValue || contentEncodingValue.toLowerCase() === "identity") {
5494
5630
  stats.passthroughCount++;
5495
5631
  return res;
@@ -5564,7 +5700,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
5564
5700
  };
5565
5701
  }
5566
5702
  function makeCompressionMiddleware(config) {
5567
- const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _137 => _137.encodings]), () => ( [...SUPPORTED_ENCODINGS]));
5703
+ const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _143 => _143.encodings]), () => ( [...SUPPORTED_ENCODINGS]));
5568
5704
  const decompressor = createDecompressor();
5569
5705
  const mutableStats = emptyStats2();
5570
5706
  const middleware = (next) => {
@@ -5604,9 +5740,9 @@ function makeCompressionMiddleware(config) {
5604
5740
  var makeResponseCompressionMiddleware = makeCompressionMiddleware;
5605
5741
  var DEFAULT_REQUEST_COMPRESS_METHODS = ["POST", "PUT", "PATCH"];
5606
5742
  function makeRequestCompressionMiddleware(config) {
5607
- const encoding = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _138 => _138.encoding]), () => ( "gzip"));
5608
- const minBytes = Math.max(0, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _139 => _139.minBytes]), () => ( 1024))));
5609
- const methods = new Set((_nullishCoalesce(_optionalChain([config, 'optionalAccess', _140 => _140.methods]), () => ( DEFAULT_REQUEST_COMPRESS_METHODS))).map((m) => m.toUpperCase()));
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()));
5610
5746
  const mutableStats = emptyRequestCompressionStats();
5611
5747
  const middleware = (next) => {
5612
5748
  return (req) => {
@@ -5689,7 +5825,7 @@ function makeJsonParseValidationError(bodyText, error, options = {}) {
5689
5825
  body: bodyText,
5690
5826
  phase: "response",
5691
5827
  schema: options.schemaName,
5692
- issues: [_chunkUUMKZJRJcjs.makeSchemaIssue.call(void 0, [], "valid JSON", bodyText, "Response body is not valid JSON")]
5828
+ issues: [_chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "valid JSON", bodyText, "Response body is not valid JSON")]
5693
5829
  };
5694
5830
  }
5695
5831
  function decodeJsonBody(bodyText, validator, options = {}) {
@@ -5703,22 +5839,27 @@ function decodeJsonBody(bodyText, validator, options = {}) {
5703
5839
  };
5704
5840
  }
5705
5841
  if (!validator) return { success: true, data: parsed };
5842
+ let validation;
5706
5843
  let legacyMessage;
5707
- const validation = _chunkUUMKZJRJcjs.isSchema.call(void 0, validator) ? validator.safeParse(parsed) : (() => {
5844
+ if (_chunkKPOL2YEOcjs.isSchema.call(void 0, validator)) {
5845
+ validation = validator.safeParse(parsed);
5846
+ } else {
5708
5847
  const result = validator(parsed);
5709
- if (result.success) return { success: true, data: result.data };
5848
+ if (result.success) {
5849
+ return { success: true, data: result.data };
5850
+ }
5710
5851
  legacyMessage = result.error;
5711
- return {
5852
+ validation = {
5712
5853
  success: false,
5713
- issues: _nullishCoalesce(result.issues, () => ( [_chunkUUMKZJRJcjs.makeSchemaIssue.call(void 0, [], "valid JSON shape", parsed, result.error)]))
5854
+ issues: _nullishCoalesce(result.issues, () => ( [_chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "valid JSON shape", parsed, result.error)]))
5714
5855
  };
5715
- })();
5856
+ }
5716
5857
  if (validation.success) return { success: true, data: validation.data };
5717
5858
  return {
5718
5859
  success: false,
5719
5860
  error: {
5720
5861
  _tag: "ValidationError",
5721
- message: _nullishCoalesce(legacyMessage, () => ( `JSON response failed validation: ${_chunkUUMKZJRJcjs.formatIssues.call(void 0, validation.issues)}`)),
5862
+ message: _nullishCoalesce(legacyMessage, () => ( `JSON response failed validation: ${_chunkKPOL2YEOcjs.formatIssues.call(void 0, validation.issues)}`)),
5722
5863
  body: bodyText,
5723
5864
  phase: "response",
5724
5865
  schema: options.schemaName,
@@ -5728,11 +5869,11 @@ function decodeJsonBody(bodyText, validator, options = {}) {
5728
5869
  }
5729
5870
  function encodeJsonBodyEffect(bodyObj, validator, options = {}) {
5730
5871
  if (validator) {
5731
- const validation = _chunkUUMKZJRJcjs.validateValue.call(void 0, bodyObj, validator);
5872
+ const validation = _chunkKPOL2YEOcjs.validateValue.call(void 0, bodyObj, validator);
5732
5873
  if (!validation.success) {
5733
5874
  return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, {
5734
5875
  _tag: "ValidationError",
5735
- message: `JSON request body failed validation: ${_chunkUUMKZJRJcjs.formatIssues.call(void 0, validation.issues)}`,
5876
+ message: `JSON request body failed validation: ${_chunkKPOL2YEOcjs.formatIssues.call(void 0, validation.issues)}`,
5736
5877
  body: previewJson(bodyObj),
5737
5878
  phase: "request",
5738
5879
  schema: options.schemaName,
@@ -5750,12 +5891,19 @@ function encodeJsonBodyEffect(bodyObj, validator, options = {}) {
5750
5891
  phase: "request",
5751
5892
  schema: options.schemaName,
5752
5893
  issues: [
5753
- _chunkUUMKZJRJcjs.makeSchemaIssue.call(void 0, [], "JSON-serializable value", bodyObj, "Request body could not be serialized to JSON")
5894
+ _chunkKPOL2YEOcjs.makeSchemaIssue.call(void 0, [], "JSON-serializable value", bodyObj, "Request body could not be serialized to JSON")
5754
5895
  ]
5755
5896
  });
5756
5897
  }
5757
5898
  }
5758
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
+ }
5759
5907
  const result = decodeJsonBody(bodyText, validator, options);
5760
5908
  return result.success ? _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, result.data) : _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, result.error);
5761
5909
  }
@@ -5886,12 +6034,12 @@ var PRESET_CONFIGS = {
5886
6034
  function isDefaultCacheableResponse(req, res) {
5887
6035
  if (!DEFAULT_CACHEABLE_METHODS.has(req.method)) return false;
5888
6036
  if (res.status < 200 || res.status >= 400) return false;
5889
- const cacheControl = _optionalChain([headerValue, 'call', _141 => _141(res.headers, "cache-control"), 'optionalAccess', _142 => _142.toLowerCase, 'call', _143 => _143()]);
6037
+ const cacheControl = _optionalChain([headerValue, 'call', _147 => _147(res.headers, "cache-control"), 'optionalAccess', _148 => _148.toLowerCase, 'call', _149 => _149()]);
5890
6038
  if (cacheControl) {
5891
6039
  const directives = cacheControl.split(",").map((part) => part.trim());
5892
6040
  if (directives.includes("no-store") || directives.includes("no-cache")) return false;
5893
6041
  }
5894
- if (_optionalChain([headerValue, 'call', _144 => _144(res.headers, "pragma"), 'optionalAccess', _145 => _145.toLowerCase, 'call', _146 => _146()]) === "no-cache") return false;
6042
+ if (_optionalChain([headerValue, 'call', _150 => _150(res.headers, "pragma"), 'optionalAccess', _151 => _151.toLowerCase, 'call', _152 => _152()]) === "no-cache") return false;
5895
6043
  if (headerValue(res.headers, "set-cookie") !== void 0) return false;
5896
6044
  return true;
5897
6045
  }
@@ -5927,12 +6075,12 @@ function makeDefaultHttpClient(config = {}) {
5927
6075
  return buildDefaultClient(wire, {
5928
6076
  preset,
5929
6077
  features,
5930
- compressionStats: _optionalChain([compressionResult, 'optionalAccess', _147 => _147.stats]),
6078
+ compressionStats: _optionalChain([compressionResult, 'optionalAccess', _153 => _153.stats]),
5931
6079
  useInlineDecode
5932
6080
  });
5933
6081
  }
5934
6082
  function buildDefaultClient(wire, meta) {
5935
- const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunk2JHJ4YHScjs.toPromise.call(void 0, e, env))(eff);
6083
+ const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunkZDZNV6NAcjs.toPromise.call(void 0, e, env))(eff);
5936
6084
  const requestRaw = (req) => wire(req);
5937
6085
  const request = (req) => withPromise(requestRaw(req));
5938
6086
  const get = (url, init) => request(buildHttpRequest("GET", url, init));
@@ -5949,24 +6097,24 @@ function buildDefaultClient(wire, meta) {
5949
6097
  );
5950
6098
  if (meta.useInlineDecode) {
5951
6099
  return withPromise(
5952
- fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess', _148 => _148.schema]), _optionalChain([init, 'optionalAccess', _149 => _149.schemaName]))
6100
+ fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess', _154 => _154.schema]), _optionalChain([init, 'optionalAccess', _155 => _155.schemaName]))
5953
6101
  );
5954
6102
  }
5955
6103
  return withPromise(
5956
- _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _150 => _150.schema]), _optionalChain([init, 'optionalAccess', _151 => _151.schemaName])))
6104
+ _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _156 => _156.schema]), _optionalChain([init, 'optionalAccess', _157 => _157.schemaName])))
5957
6105
  );
5958
6106
  });
5959
6107
  const postJson = ((url, bodyObj, init) => {
5960
6108
  return withPromise(
5961
6109
  _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
5962
- encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess', _152 => _152.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _153 => _153.bodySchemaName]) }),
6110
+ encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess', _158 => _158.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _159 => _159.bodySchemaName]) }),
5963
6111
  (bodyText) => {
5964
6112
  const req = setHeaderIfMissing("content-type", "application/json")(
5965
6113
  setHeaderIfMissing("accept", "application/json")(
5966
6114
  buildHttpRequest("POST", url, init, bodyText)
5967
6115
  )
5968
6116
  );
5969
- return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _154 => _154.schema]), _optionalChain([init, 'optionalAccess', _155 => _155.schemaName])));
6117
+ return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _160 => _160.schema]), _optionalChain([init, 'optionalAccess', _161 => _161.schemaName])));
5970
6118
  }
5971
6119
  )
5972
6120
  );
@@ -6115,10 +6263,10 @@ function isLeanPreset(preset) {
6115
6263
  }
6116
6264
 
6117
6265
  // src/http/layer.ts
6118
- var HttpClientService = _chunk5RZ7YITFcjs.makeServiceTag.call(void 0, "HttpClient");
6266
+ var HttpClientService = _chunk6STX4PS3cjs.makeServiceTag.call(void 0, "HttpClient");
6119
6267
  function makeDefaultHttpClientLayer(config = {}, options = {}) {
6120
6268
  const tag = _nullishCoalesce(options.tag, () => ( HttpClientService));
6121
- return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
6269
+ return _chunk6STX4PS3cjs.layerEffect.call(void 0,
6122
6270
  tag,
6123
6271
  (context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0,
6124
6272
  () => makeDefaultHttpClient(resolveDefaultHttpClientLayerConfig(config, context))