brass-runtime 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/cli/main.cjs +30 -30
- package/dist/agent/cli/main.js +2 -2
- package/dist/agent/cli/main.mjs +2 -2
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/index.mjs +2 -2
- package/dist/{chunk-PSEU65ND.js → chunk-22HZQG5F.js} +6 -6
- package/dist/{chunk-SSQJKDN3.cjs → chunk-2JHJ4YHS.cjs} +227 -117
- package/dist/{chunk-IFRBVMWJ.cjs → chunk-2OW6IFY2.cjs} +19 -19
- package/dist/{chunk-YTX2JYYP.cjs → chunk-5LC7V2OZ.cjs} +18 -18
- package/dist/{chunk-7TXQJFZX.cjs → chunk-5RZ7YITF.cjs} +13 -13
- package/dist/{chunk-OT2TESZU.mjs → chunk-6V2AWT4R.mjs} +1 -1
- package/dist/{chunk-BG5RNEA2.js → chunk-7DU7IQHK.js} +3 -3
- package/dist/{chunk-QCOLAHU3.mjs → chunk-7GBJYOX7.mjs} +5 -5
- package/dist/{chunk-ITG6I7ZS.js → chunk-7VQLEN37.js} +1 -1
- package/dist/{chunk-QZ6QFJNM.mjs → chunk-B5FKOLTB.mjs} +3 -3
- package/dist/{chunk-RREBJX2S.mjs → chunk-BC6Q6BCO.mjs} +1 -1
- package/dist/{chunk-KRYP6CAE.mjs → chunk-COOW7BJX.mjs} +2 -2
- package/dist/{chunk-ELLF55ER.mjs → chunk-EEN5OTCR.mjs} +1 -1
- package/dist/{chunk-3PFZGP23.cjs → chunk-EICAJDNX.cjs} +13 -13
- package/dist/{chunk-5XADBMSU.cjs → chunk-ELIECDYN.cjs} +5 -5
- package/dist/{chunk-2QNREG6K.mjs → chunk-H626ZTDZ.mjs} +211 -101
- package/dist/{chunk-JH4GI3DW.js → chunk-IPSMXUWA.js} +1 -1
- package/dist/{chunk-2SLT3X6G.cjs → chunk-J6DUHITE.cjs} +6 -6
- package/dist/{chunk-OI4ESUMC.mjs → chunk-JWIEMBE6.mjs} +6 -6
- package/dist/{chunk-N6QNSTWD.cjs → chunk-KNTJ7FQB.cjs} +5 -5
- package/dist/{chunk-W6WR37HN.js → chunk-LSYQ3C2M.js} +2 -2
- package/dist/{chunk-AADFFVYS.js → chunk-OW5VHAOE.js} +1 -1
- package/dist/{chunk-G5JTCFMI.mjs → chunk-RBHNOKH4.mjs} +2 -2
- package/dist/{chunk-IBRHSH5H.js → chunk-S4HXADU4.js} +1 -1
- package/dist/{chunk-XSAHV5HQ.js → chunk-TTSPIU3U.js} +211 -101
- package/dist/{chunk-S4HHFUYP.js → chunk-UAKAF32U.js} +2 -2
- package/dist/{chunk-R6WDSZA6.mjs → chunk-WCBNXPN6.mjs} +1 -1
- package/dist/{chunk-AJMKZXRB.cjs → chunk-WGE2FEZE.cjs} +2 -2
- package/dist/{chunk-LXBU5E77.cjs → chunk-WI7GZF3B.cjs} +16 -16
- package/dist/{chunk-H5GYX7RZ.js → chunk-WUDHOZIH.js} +113 -5
- package/dist/{chunk-KHACHFBQ.cjs → chunk-WVSZOPGQ.cjs} +54 -54
- package/dist/{chunk-VIFA4DPN.cjs → chunk-XPIMJQYS.cjs} +193 -85
- package/dist/{chunk-3PHU7FWS.js → chunk-YGR2IN4R.js} +5 -5
- package/dist/{chunk-ITZQ526U.mjs → chunk-YWLLH27R.mjs} +2 -2
- package/dist/{chunk-4YQHPIWJ.js → chunk-YZ5LQ32F.js} +2 -2
- package/dist/{chunk-Z3PSSXP3.mjs → chunk-Z3ZZMQUZ.mjs} +113 -5
- package/dist/core/index.cjs +13 -7
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +12 -6
- package/dist/core/index.mjs +12 -6
- 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 +52 -48
- package/dist/http/index.d.ts +8 -8
- package/dist/http/index.js +10 -6
- package/dist/http/index.mjs +10 -6
- package/dist/http/testing.cjs +8 -8
- package/dist/http/testing.d.ts +4 -4
- package/dist/http/testing.js +4 -4
- package/dist/http/testing.mjs +4 -4
- package/dist/index.cjs +91 -85
- package/dist/index.d.ts +7 -7
- package/dist/index.js +13 -7
- package/dist/index.mjs +13 -7
- package/dist/{layer-BalPI6cN.d.ts → layer-D2LFcBVx.d.ts} +1 -1
- package/dist/observability/index.cjs +9 -9
- package/dist/observability/index.d.ts +7 -7
- package/dist/observability/index.js +8 -8
- package/dist/observability/index.mjs +8 -8
- package/dist/perf/cli.cjs +25 -25
- package/dist/perf/cli.js +10 -10
- package/dist/perf/cli.mjs +10 -10
- package/dist/perf/index.cjs +12 -12
- package/dist/perf/index.js +10 -10
- package/dist/perf/index.mjs +10 -10
- 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 _chunkEICAJDNXcjs = require('./chunk-EICAJDNX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk5RZ7YITFcjs = require('./chunk-5RZ7YITF.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunk2JHJ4YHScjs = require('./chunk-2JHJ4YHS.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -346,7 +346,7 @@ var WasmRetryPlannerBridge = class {
|
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
348
|
function makeWasmRetryPlanner() {
|
|
349
|
-
const mod =
|
|
349
|
+
const mod = _chunk2JHJ4YHScjs.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 ? _chunk5RZ7YITFcjs.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 = _chunk2JHJ4YHScjs.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
|
};
|
|
@@ -2325,7 +2358,7 @@ var toPromiseTransportResponse = (bodyText, info) => ({
|
|
|
2325
2358
|
...info.transportMeta !== void 0 ? { transportMeta: info.transportMeta } : {}
|
|
2326
2359
|
});
|
|
2327
2360
|
function makePromiseHttpTransport(config) {
|
|
2328
|
-
|
|
2361
|
+
const transport = (context) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
2329
2362
|
let done = false;
|
|
2330
2363
|
const finish = (exit) => {
|
|
2331
2364
|
if (done) return;
|
|
@@ -2368,6 +2401,20 @@ function makePromiseHttpTransport(config) {
|
|
|
2368
2401
|
context.signal.removeEventListener("abort", abort);
|
|
2369
2402
|
};
|
|
2370
2403
|
});
|
|
2404
|
+
const marked = transport;
|
|
2405
|
+
marked.__promiseTransport = true;
|
|
2406
|
+
marked.requestDirect = async (context) => {
|
|
2407
|
+
const startedAt = nowMs();
|
|
2408
|
+
try {
|
|
2409
|
+
const raw = await config.request(context);
|
|
2410
|
+
const durationMs = Math.round(nowMs() - startedAt);
|
|
2411
|
+
const mapped = await config.response(raw, context, { startedAt, durationMs });
|
|
2412
|
+
return { ...mapped, ms: _nullishCoalesce(mapped.ms, () => ( durationMs)) };
|
|
2413
|
+
} catch (error) {
|
|
2414
|
+
throw _nullishCoalesce(_optionalChain([config, 'access', _49 => _49.error, 'optionalCall', _50 => _50(error, context)]), () => ( normalizeHttpError(error, { signal: context.signal })));
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
return marked;
|
|
2371
2418
|
}
|
|
2372
2419
|
function makePromiseHttpTransportBodyBuilder(config) {
|
|
2373
2420
|
const makeBodyTransport = (mode, body, responseMapper, currentConfig = config) => makePromiseHttpTransport({
|
|
@@ -2428,7 +2475,7 @@ function makeFetchTransport() {
|
|
|
2428
2475
|
return;
|
|
2429
2476
|
}
|
|
2430
2477
|
const localController = new AbortController();
|
|
2431
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access',
|
|
2478
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.signal]), localController.signal);
|
|
2432
2479
|
let done = false;
|
|
2433
2480
|
const finish = (exit) => {
|
|
2434
2481
|
if (done) return;
|
|
@@ -2483,7 +2530,7 @@ function makeFetchStreamTransport() {
|
|
|
2483
2530
|
return;
|
|
2484
2531
|
}
|
|
2485
2532
|
const localController = new AbortController();
|
|
2486
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access',
|
|
2533
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([request, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.signal]), localController.signal);
|
|
2487
2534
|
let done = false;
|
|
2488
2535
|
let cleanupTransferredToBody = false;
|
|
2489
2536
|
const cleanup = () => {
|
|
@@ -2508,7 +2555,7 @@ function makeFetchStreamTransport() {
|
|
|
2508
2555
|
});
|
|
2509
2556
|
const headers = headersOf(response);
|
|
2510
2557
|
const latencyMs = Math.round(nowMs() - started);
|
|
2511
|
-
const body =
|
|
2558
|
+
const body = _chunkEICAJDNXcjs.streamFromReadableStream.call(void 0, response.body, normalizeHttpError, {
|
|
2512
2559
|
signal: linkedSignal.signal,
|
|
2513
2560
|
onRelease: linkedSignal.cleanup
|
|
2514
2561
|
});
|
|
@@ -2793,7 +2840,7 @@ var normalizeHeadersInit = (h) => {
|
|
|
2793
2840
|
};
|
|
2794
2841
|
var normalizeRequest = (defaultHeaders) => (req0) => {
|
|
2795
2842
|
let req = Object.keys(defaultHeaders).length ? mergeHeadersUnder(defaultHeaders)(req0) : req0;
|
|
2796
|
-
const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access',
|
|
2843
|
+
const initHeaders = normalizeHeadersInit(_optionalChain([req0, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.headers]));
|
|
2797
2844
|
if (initHeaders && Object.keys(initHeaders).length) {
|
|
2798
2845
|
req = mergeHeadersUnder(initHeaders)(req);
|
|
2799
2846
|
}
|
|
@@ -2881,7 +2928,7 @@ var timeoutReason = (req, url, timeoutMs) => ({
|
|
|
2881
2928
|
var requestPriority = (req) => {
|
|
2882
2929
|
const fromPolicy = getHttpRequestPolicy(req).priority;
|
|
2883
2930
|
if (fromPolicy !== void 0) return fromPolicy;
|
|
2884
|
-
return _optionalChain([req, 'access',
|
|
2931
|
+
return _optionalChain([req, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.priority]);
|
|
2885
2932
|
};
|
|
2886
2933
|
var exitError = (exit) => {
|
|
2887
2934
|
if (exit._tag === "Success") return void 0;
|
|
@@ -2912,7 +2959,7 @@ var runTransportEffect = (effect, env, signal) => new Promise((resolve, reject)
|
|
|
2912
2959
|
signal.removeEventListener("abort", abort);
|
|
2913
2960
|
const currentCancel = cancel;
|
|
2914
2961
|
cancel = void 0;
|
|
2915
|
-
_optionalChain([currentCancel, 'optionalCall',
|
|
2962
|
+
_optionalChain([currentCancel, 'optionalCall', _59 => _59()]);
|
|
2916
2963
|
reject(abortErrorForSignal(signal));
|
|
2917
2964
|
};
|
|
2918
2965
|
if (signal.aborted) {
|
|
@@ -2933,13 +2980,13 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
2933
2980
|
_tag: "Async",
|
|
2934
2981
|
register: (env, cb) => {
|
|
2935
2982
|
const controller = new AbortController();
|
|
2936
|
-
const previousSignal = _optionalChain([req, 'access',
|
|
2983
|
+
const previousSignal = _optionalChain([req, 'access', _60 => _60.init, 'optionalAccess', _61 => _61.signal]);
|
|
2937
2984
|
const label = fetchLabel(req, url);
|
|
2938
2985
|
const startedAt = performance.now();
|
|
2939
2986
|
let done = false;
|
|
2940
2987
|
let cancelInner;
|
|
2941
2988
|
const cleanup = () => {
|
|
2942
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
2989
|
+
_optionalChain([previousSignal, 'optionalAccess', _62 => _62.removeEventListener, 'call', _63 => _63("abort", abortFromPrevious)]);
|
|
2943
2990
|
};
|
|
2944
2991
|
const finish = (outcome, exit, error) => {
|
|
2945
2992
|
if (done) return;
|
|
@@ -2965,20 +3012,20 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
2965
3012
|
};
|
|
2966
3013
|
function abortFromPrevious() {
|
|
2967
3014
|
const error = previousSignal ? abortErrorForSignal(previousSignal) : { _tag: "Abort" };
|
|
2968
|
-
abortCurrent(_optionalChain([previousSignal, 'optionalAccess',
|
|
3015
|
+
abortCurrent(_optionalChain([previousSignal, 'optionalAccess', _64 => _64.reason]));
|
|
2969
3016
|
const cancel = cancelInner;
|
|
2970
3017
|
cancelInner = void 0;
|
|
2971
3018
|
queueMicrotask(() => {
|
|
2972
3019
|
finishFailure(error);
|
|
2973
|
-
_optionalChain([cancel, 'optionalCall',
|
|
3020
|
+
_optionalChain([cancel, 'optionalCall', _65 => _65()]);
|
|
2974
3021
|
});
|
|
2975
3022
|
}
|
|
2976
3023
|
metrics.onStart();
|
|
2977
|
-
if (_optionalChain([previousSignal, 'optionalAccess',
|
|
3024
|
+
if (_optionalChain([previousSignal, 'optionalAccess', _66 => _66.aborted])) {
|
|
2978
3025
|
abortFromPrevious();
|
|
2979
3026
|
return () => void 0;
|
|
2980
3027
|
}
|
|
2981
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
3028
|
+
_optionalChain([previousSignal, 'optionalAccess', _67 => _67.addEventListener, 'call', _68 => _68("abort", abortFromPrevious, { once: true })]);
|
|
2982
3029
|
try {
|
|
2983
3030
|
const innerCancel = _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0,
|
|
2984
3031
|
transport({ request: req, url, signal: controller.signal }),
|
|
@@ -3003,7 +3050,7 @@ var runDirectTransport = (req, url, transport, metrics) => ({
|
|
|
3003
3050
|
cancelInner = void 0;
|
|
3004
3051
|
abortCurrent();
|
|
3005
3052
|
finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
3006
|
-
_optionalChain([cancel, 'optionalCall',
|
|
3053
|
+
_optionalChain([cancel, 'optionalCall', _69 => _69()]);
|
|
3007
3054
|
};
|
|
3008
3055
|
}
|
|
3009
3056
|
});
|
|
@@ -3043,10 +3090,10 @@ function makeHttpStream(cfg = {}) {
|
|
|
3043
3090
|
const url = resolveRequestUrl(req, baseUrl);
|
|
3044
3091
|
if (!(url instanceof URL)) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, url);
|
|
3045
3092
|
const timeoutMs = resolvePositiveTimeout(_nullishCoalesce(req.timeoutMs, () => ( cfg.timeoutMs)));
|
|
3046
|
-
return
|
|
3093
|
+
return _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
3047
3094
|
async (signal, env) => {
|
|
3048
3095
|
let lease;
|
|
3049
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access',
|
|
3096
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _70 => _70.init, 'optionalAccess', _71 => _71.signal]));
|
|
3050
3097
|
try {
|
|
3051
3098
|
if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
|
|
3052
3099
|
if (adaptiveLimiter) {
|
|
@@ -3083,6 +3130,13 @@ function makeHttpStream(cfg = {}) {
|
|
|
3083
3130
|
};
|
|
3084
3131
|
return decorateStream(run, metrics.snapshot);
|
|
3085
3132
|
}
|
|
3133
|
+
var ONCE_OPTIONS = Object.freeze({ once: true });
|
|
3134
|
+
var noopSignal = (() => {
|
|
3135
|
+
const c = new AbortController();
|
|
3136
|
+
const s = c.signal;
|
|
3137
|
+
globalThis.__brassNoopSignal = s;
|
|
3138
|
+
return s;
|
|
3139
|
+
})();
|
|
3086
3140
|
function makeHttp(cfg = {}) {
|
|
3087
3141
|
validateMakeHttpConfig(cfg);
|
|
3088
3142
|
const baseUrl = _nullishCoalesce(cfg.baseUrl, () => ( ""));
|
|
@@ -3101,10 +3155,10 @@ function makeHttp(cfg = {}) {
|
|
|
3101
3155
|
if (!adaptiveLimiter && !pool && timeoutMs === void 0) {
|
|
3102
3156
|
return runDirectTransport(req, url, transport, metrics);
|
|
3103
3157
|
}
|
|
3104
|
-
return
|
|
3158
|
+
return _chunk2JHJ4YHScjs.fromPromiseAbortable.call(void 0,
|
|
3105
3159
|
async (signal, env) => {
|
|
3106
3160
|
let lease;
|
|
3107
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access',
|
|
3161
|
+
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _72 => _72.init, 'optionalAccess', _73 => _73.signal]));
|
|
3108
3162
|
try {
|
|
3109
3163
|
if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
|
|
3110
3164
|
if (adaptiveLimiter) {
|
|
@@ -3142,12 +3196,12 @@ function makeHttp(cfg = {}) {
|
|
|
3142
3196
|
if (adaptiveLimiter) metadata.adaptiveLimiter = adaptiveLimiter;
|
|
3143
3197
|
if (adaptiveLimiter || destroyTransport) {
|
|
3144
3198
|
metadata.destroy = () => {
|
|
3145
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3146
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3199
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _74 => _74.destroy, 'call', _75 => _75()]);
|
|
3200
|
+
_optionalChain([destroyTransport, 'optionalCall', _76 => _76()]);
|
|
3147
3201
|
};
|
|
3148
3202
|
metadata.shutdown = () => {
|
|
3149
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3150
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3203
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _77 => _77.shutdown, 'call', _78 => _78()]);
|
|
3204
|
+
_optionalChain([destroyTransport, 'optionalCall', _79 => _79()]);
|
|
3151
3205
|
};
|
|
3152
3206
|
}
|
|
3153
3207
|
return decorate(run, metrics.snapshot, metadata);
|
|
@@ -3170,7 +3224,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3170
3224
|
if (!canRetry) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3171
3225
|
const d = delayWithinBudget(backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs));
|
|
3172
3226
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3173
|
-
_optionalChain([p, 'access',
|
|
3227
|
+
_optionalChain([p, 'access', _80 => _80.onRetry, 'optionalCall', _81 => _81({
|
|
3174
3228
|
attempt,
|
|
3175
3229
|
delayMs: d,
|
|
3176
3230
|
error: e,
|
|
@@ -3179,7 +3233,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3179
3233
|
method: req.method,
|
|
3180
3234
|
timestamp: Date.now()
|
|
3181
3235
|
})]);
|
|
3182
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3236
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk5RZ7YITFcjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3183
3237
|
},
|
|
3184
3238
|
(w) => {
|
|
3185
3239
|
const canRetry = attempt < p.maxRetries && retryOnStatus(w.status) && remainingBudget() > 0;
|
|
@@ -3188,7 +3242,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3188
3242
|
const rawDelay = ra === void 0 ? backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs) : Math.min(ra, p.maxDelayMs);
|
|
3189
3243
|
const d = delayWithinBudget(rawDelay);
|
|
3190
3244
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, w);
|
|
3191
|
-
_optionalChain([p, 'access',
|
|
3245
|
+
_optionalChain([p, 'access', _82 => _82.onRetry, 'optionalCall', _83 => _83({
|
|
3192
3246
|
attempt,
|
|
3193
3247
|
delayMs: d,
|
|
3194
3248
|
error: void 0,
|
|
@@ -3197,7 +3251,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3197
3251
|
method: req.method,
|
|
3198
3252
|
timestamp: Date.now()
|
|
3199
3253
|
})]);
|
|
3200
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3254
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunk5RZ7YITFcjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3201
3255
|
}
|
|
3202
3256
|
);
|
|
3203
3257
|
return loop(0);
|
|
@@ -3306,8 +3360,8 @@ function causeDefectMessage(cause) {
|
|
|
3306
3360
|
}
|
|
3307
3361
|
function withDedup(config) {
|
|
3308
3362
|
const inFlight = /* @__PURE__ */ new Map();
|
|
3309
|
-
const customKeyFn = _optionalChain([config, 'optionalAccess',
|
|
3310
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
3363
|
+
const customKeyFn = _optionalChain([config, 'optionalAccess', _84 => _84.dedupKey]);
|
|
3364
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _85 => _85.onEvent]);
|
|
3311
3365
|
return (next) => {
|
|
3312
3366
|
return (req) => {
|
|
3313
3367
|
if (!SAFE_METHODS.has(req.method.toUpperCase())) {
|
|
@@ -3850,18 +3904,18 @@ function safeEmit2(onEvent, event) {
|
|
|
3850
3904
|
}
|
|
3851
3905
|
}
|
|
3852
3906
|
function withCache(config) {
|
|
3853
|
-
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3907
|
+
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _86 => _86.ttlSeconds]), () => ( 60)), 1, 86400);
|
|
3854
3908
|
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',
|
|
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]);
|
|
3862
3916
|
const cache = new LRUCache({
|
|
3863
3917
|
maxEntries,
|
|
3864
|
-
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall',
|
|
3918
|
+
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall', _94 => _94({ type: "cache-eviction", count })])
|
|
3865
3919
|
});
|
|
3866
3920
|
const revalidating = /* @__PURE__ */ new Set();
|
|
3867
3921
|
const invalidate = (key) => {
|
|
@@ -3882,11 +3936,11 @@ function withCache(config) {
|
|
|
3882
3936
|
register: (env, cb) => {
|
|
3883
3937
|
const cached = cache.get(key);
|
|
3884
3938
|
if (cached !== void 0) {
|
|
3885
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
3939
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _95 => _95({ type: "cache-hit", cacheKey: key })]);
|
|
3886
3940
|
cb({ _tag: "Success", value: cached });
|
|
3887
3941
|
return;
|
|
3888
3942
|
}
|
|
3889
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
3943
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _96 => _96({ type: "cache-miss", cacheKey: key })]);
|
|
3890
3944
|
const innerEffect = next(req);
|
|
3891
3945
|
return _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, innerEffect, env, (exit) => {
|
|
3892
3946
|
if (exit._tag === "Success") {
|
|
@@ -3943,16 +3997,16 @@ function withCache(config) {
|
|
|
3943
3997
|
if (cached !== void 0) {
|
|
3944
3998
|
const expiresAt = expirationMap.get(key);
|
|
3945
3999
|
if (expiresAt !== void 0 && now() < expiresAt) {
|
|
3946
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4000
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _97 => _97({ type: "cache-hit", cacheKey: key })]);
|
|
3947
4001
|
cb({ _tag: "Success", value: cached });
|
|
3948
4002
|
return;
|
|
3949
4003
|
}
|
|
3950
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4004
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _98 => _98({ type: "cache-hit", cacheKey: key })]);
|
|
3951
4005
|
cb({ _tag: "Success", value: cached });
|
|
3952
4006
|
triggerRevalidation(next, req, key);
|
|
3953
4007
|
return;
|
|
3954
4008
|
}
|
|
3955
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4009
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _99 => _99({ type: "cache-miss", cacheKey: key })]);
|
|
3956
4010
|
const innerEffect = next(req);
|
|
3957
4011
|
const handleSuccess = (res) => {
|
|
3958
4012
|
swrStoreIfCacheable(req, res, key);
|
|
@@ -4205,7 +4259,7 @@ var DEFAULT_CONCURRENCY2 = 32;
|
|
|
4205
4259
|
function extractPriority(req) {
|
|
4206
4260
|
const fromPolicy = getHttpRequestPolicy(req).priority;
|
|
4207
4261
|
if (fromPolicy !== void 0) return clampPriority2(fromPolicy);
|
|
4208
|
-
const fromInit = _optionalChain([req, 'access',
|
|
4262
|
+
const fromInit = _optionalChain([req, 'access', _100 => _100.init, 'optionalAccess', _101 => _101.priority]);
|
|
4209
4263
|
if (fromInit !== void 0) return clampPriority2(fromInit);
|
|
4210
4264
|
return 5;
|
|
4211
4265
|
}
|
|
@@ -4217,9 +4271,9 @@ function safeEmit3(onEvent, event) {
|
|
|
4217
4271
|
}
|
|
4218
4272
|
}
|
|
4219
4273
|
function withPriority(config) {
|
|
4220
|
-
const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess',
|
|
4221
|
-
const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess',
|
|
4222
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
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]);
|
|
4223
4277
|
const queue = new PriorityQueue();
|
|
4224
4278
|
let inFlight = 0;
|
|
4225
4279
|
const queueDepth = () => {
|
|
@@ -4264,7 +4318,7 @@ function withPriority(config) {
|
|
|
4264
4318
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4265
4319
|
};
|
|
4266
4320
|
signal.addEventListener("abort", abortHandler, { once: true });
|
|
4267
|
-
} else if (_optionalChain([signal, 'optionalAccess',
|
|
4321
|
+
} else if (_optionalChain([signal, 'optionalAccess', _105 => _105.aborted])) {
|
|
4268
4322
|
entry.cancelled = true;
|
|
4269
4323
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4270
4324
|
return;
|
|
@@ -4310,7 +4364,7 @@ function withPriority(config) {
|
|
|
4310
4364
|
clearTimeout(queued.timer);
|
|
4311
4365
|
queued.timer = void 0;
|
|
4312
4366
|
}
|
|
4313
|
-
if (_optionalChain([queued, 'access',
|
|
4367
|
+
if (_optionalChain([queued, 'access', _106 => _106.signal, 'optionalAccess', _107 => _107.aborted])) {
|
|
4314
4368
|
queued.cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4315
4369
|
continue;
|
|
4316
4370
|
}
|
|
@@ -4330,7 +4384,7 @@ function resolveQueueTimeout(value) {
|
|
|
4330
4384
|
return n > 0 ? n : void 0;
|
|
4331
4385
|
}
|
|
4332
4386
|
function getSignal(req) {
|
|
4333
|
-
return _optionalChain([req, 'access',
|
|
4387
|
+
return _optionalChain([req, 'access', _108 => _108.init, 'optionalAccess', _109 => _109.signal]);
|
|
4334
4388
|
}
|
|
4335
4389
|
|
|
4336
4390
|
// src/http/lifecycle/stats.ts
|
|
@@ -4719,9 +4773,9 @@ async function executeProbeViaClient(client, url, signal) {
|
|
|
4719
4773
|
resolve({ ok: true });
|
|
4720
4774
|
} else {
|
|
4721
4775
|
const cause = exit.cause;
|
|
4722
|
-
if (_optionalChain([cause, 'optionalAccess',
|
|
4776
|
+
if (_optionalChain([cause, 'optionalAccess', _110 => _110._tag]) === "Fail") {
|
|
4723
4777
|
const err = cause.error;
|
|
4724
|
-
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
4778
|
+
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _111 => _111.message]), () => ( _optionalChain([err, 'optionalAccess', _112 => _112._tag]))), () => ( "Unknown error")) });
|
|
4725
4779
|
} else {
|
|
4726
4780
|
resolve({ ok: false, error: "cancelled" });
|
|
4727
4781
|
}
|
|
@@ -5097,7 +5151,7 @@ function makeLifecycleClient(config = {}) {
|
|
|
5097
5151
|
priorityMiddleware = withPriority({
|
|
5098
5152
|
...priorityConfig2,
|
|
5099
5153
|
onEvent: (event) => {
|
|
5100
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5154
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess', _113 => _113.queueDepth, 'call', _114 => _114()]), () => ( 0)));
|
|
5101
5155
|
tracker.emit(event.type, { priority: event.priority });
|
|
5102
5156
|
}
|
|
5103
5157
|
});
|
|
@@ -5160,9 +5214,9 @@ function makeLifecycleClient(config = {}) {
|
|
|
5160
5214
|
attempt: event.attempt,
|
|
5161
5215
|
delayMs: event.delayMs,
|
|
5162
5216
|
status: event.status,
|
|
5163
|
-
errorTag: _optionalChain([event, 'access',
|
|
5217
|
+
errorTag: _optionalChain([event, 'access', _115 => _115.error, 'optionalAccess', _116 => _116._tag])
|
|
5164
5218
|
});
|
|
5165
|
-
_optionalChain([retryConfig2, 'access',
|
|
5219
|
+
_optionalChain([retryConfig2, 'access', _117 => _117.onRetry, 'optionalCall', _118 => _118(event)]);
|
|
5166
5220
|
}
|
|
5167
5221
|
})(composedFn);
|
|
5168
5222
|
}
|
|
@@ -5194,13 +5248,13 @@ function makeLifecycleClient(config = {}) {
|
|
|
5194
5248
|
}
|
|
5195
5249
|
}
|
|
5196
5250
|
return buildLifecycleClient(composedFn, tracker, {
|
|
5197
|
-
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5198
|
-
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5251
|
+
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _119 => _119.invalidate]), () => ( noopInvalidate)),
|
|
5252
|
+
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _120 => _120.clear]), () => ( noopClear)),
|
|
5199
5253
|
cancelAll: () => cancelActiveRequests(activeCancelers, prewarmMgr),
|
|
5200
5254
|
shutdown: () => shutdownClient(activeCancelers, prewarmMgr, wireClient.shutdown),
|
|
5201
5255
|
activeCancelers,
|
|
5202
5256
|
adaptiveLimiter: wireClient.adaptiveLimiter,
|
|
5203
|
-
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5257
|
+
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess', _121 => _121.queueDepth]),
|
|
5204
5258
|
prewarmManager: prewarmMgr,
|
|
5205
5259
|
afterResponse: hasPrewarm ? config.prewarm.afterResponse : void 0
|
|
5206
5260
|
});
|
|
@@ -5215,7 +5269,7 @@ function noopClear() {
|
|
|
5215
5269
|
function buildLifecycleClient(fn2, tracker, internals) {
|
|
5216
5270
|
const client = (req) => trackRequest(fn2, req, tracker, internals);
|
|
5217
5271
|
const stats = () => {
|
|
5218
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access',
|
|
5272
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access', _122 => _122.queueDepth, 'optionalCall', _123 => _123()]), () => ( 0)));
|
|
5219
5273
|
return tracker.snapshot();
|
|
5220
5274
|
};
|
|
5221
5275
|
const withMw = (mw) => {
|
|
@@ -5255,14 +5309,14 @@ function cancelActiveRequests(activeCancelers, prewarmMgr) {
|
|
|
5255
5309
|
}
|
|
5256
5310
|
function shutdownClient(activeCancelers, prewarmMgr, wireShutdown) {
|
|
5257
5311
|
cancelActiveRequests(activeCancelers, prewarmMgr);
|
|
5258
|
-
_optionalChain([wireShutdown, 'optionalCall',
|
|
5312
|
+
_optionalChain([wireShutdown, 'optionalCall', _124 => _124()]);
|
|
5259
5313
|
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
5260
5314
|
}
|
|
5261
5315
|
function trackRequest(fn2, req, tracker, internals) {
|
|
5262
5316
|
return {
|
|
5263
5317
|
_tag: "Async",
|
|
5264
5318
|
register: (env, cb) => {
|
|
5265
|
-
const previousSignal = _optionalChain([req, 'access',
|
|
5319
|
+
const previousSignal = _optionalChain([req, 'access', _125 => _125.init, 'optionalAccess', _126 => _126.signal]);
|
|
5266
5320
|
let done = false;
|
|
5267
5321
|
let abortedByPreviousSignal = false;
|
|
5268
5322
|
let abortedByLifecycle = false;
|
|
@@ -5271,7 +5325,7 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5271
5325
|
if (done) return;
|
|
5272
5326
|
done = true;
|
|
5273
5327
|
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',
|
|
5328
|
+
_optionalChain([previousSignal, 'optionalAccess', _127 => _127.removeEventListener, 'call', _128 => _128("abort", abortFromPrevious)]);
|
|
5275
5329
|
internals.activeCancelers.delete(cancelFromLifecycle);
|
|
5276
5330
|
if (exit._tag === "Success") {
|
|
5277
5331
|
tracker.requestCompleted();
|
|
@@ -5309,13 +5363,13 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5309
5363
|
abortedByPreviousSignal = true;
|
|
5310
5364
|
cancelActive();
|
|
5311
5365
|
};
|
|
5312
|
-
if (!_optionalChain([previousSignal, 'optionalAccess',
|
|
5313
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
5366
|
+
if (!_optionalChain([previousSignal, 'optionalAccess', _129 => _129.aborted])) {
|
|
5367
|
+
_optionalChain([previousSignal, 'optionalAccess', _130 => _130.addEventListener, 'call', _131 => _131("abort", abortFromPrevious, { once: true })]);
|
|
5314
5368
|
}
|
|
5315
5369
|
internals.activeCancelers.add(cancelFromLifecycle);
|
|
5316
5370
|
tracker.requestStarted();
|
|
5317
5371
|
tracker.emit("request-start");
|
|
5318
|
-
if (_optionalChain([previousSignal, 'optionalAccess',
|
|
5372
|
+
if (_optionalChain([previousSignal, 'optionalAccess', _132 => _132.aborted])) {
|
|
5319
5373
|
abortFromPrevious();
|
|
5320
5374
|
return () => void 0;
|
|
5321
5375
|
}
|
|
@@ -5435,7 +5489,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5435
5489
|
const contentEncodingKey = Object.keys(res.headers).find(
|
|
5436
5490
|
(k) => k.toLowerCase() === "content-encoding"
|
|
5437
5491
|
);
|
|
5438
|
-
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access',
|
|
5492
|
+
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access', _133 => _133.headers, 'access', _134 => _134[contentEncodingKey], 'optionalAccess', _135 => _135.trim, 'call', _136 => _136()]) : void 0;
|
|
5439
5493
|
if (!contentEncodingValue || contentEncodingValue.toLowerCase() === "identity") {
|
|
5440
5494
|
stats.passthroughCount++;
|
|
5441
5495
|
return res;
|
|
@@ -5510,7 +5564,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5510
5564
|
};
|
|
5511
5565
|
}
|
|
5512
5566
|
function makeCompressionMiddleware(config) {
|
|
5513
|
-
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5567
|
+
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _137 => _137.encodings]), () => ( [...SUPPORTED_ENCODINGS]));
|
|
5514
5568
|
const decompressor = createDecompressor();
|
|
5515
5569
|
const mutableStats = emptyStats2();
|
|
5516
5570
|
const middleware = (next) => {
|
|
@@ -5550,9 +5604,9 @@ function makeCompressionMiddleware(config) {
|
|
|
5550
5604
|
var makeResponseCompressionMiddleware = makeCompressionMiddleware;
|
|
5551
5605
|
var DEFAULT_REQUEST_COMPRESS_METHODS = ["POST", "PUT", "PATCH"];
|
|
5552
5606
|
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',
|
|
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()));
|
|
5556
5610
|
const mutableStats = emptyRequestCompressionStats();
|
|
5557
5611
|
const middleware = (next) => {
|
|
5558
5612
|
return (req) => {
|
|
@@ -5832,12 +5886,12 @@ var PRESET_CONFIGS = {
|
|
|
5832
5886
|
function isDefaultCacheableResponse(req, res) {
|
|
5833
5887
|
if (!DEFAULT_CACHEABLE_METHODS.has(req.method)) return false;
|
|
5834
5888
|
if (res.status < 200 || res.status >= 400) return false;
|
|
5835
|
-
const cacheControl = _optionalChain([headerValue, 'call',
|
|
5889
|
+
const cacheControl = _optionalChain([headerValue, 'call', _141 => _141(res.headers, "cache-control"), 'optionalAccess', _142 => _142.toLowerCase, 'call', _143 => _143()]);
|
|
5836
5890
|
if (cacheControl) {
|
|
5837
5891
|
const directives = cacheControl.split(",").map((part) => part.trim());
|
|
5838
5892
|
if (directives.includes("no-store") || directives.includes("no-cache")) return false;
|
|
5839
5893
|
}
|
|
5840
|
-
if (_optionalChain([headerValue, 'call',
|
|
5894
|
+
if (_optionalChain([headerValue, 'call', _144 => _144(res.headers, "pragma"), 'optionalAccess', _145 => _145.toLowerCase, 'call', _146 => _146()]) === "no-cache") return false;
|
|
5841
5895
|
if (headerValue(res.headers, "set-cookie") !== void 0) return false;
|
|
5842
5896
|
return true;
|
|
5843
5897
|
}
|
|
@@ -5867,14 +5921,18 @@ function makeDefaultHttpClient(config = {}) {
|
|
|
5867
5921
|
wire = wire.with(withHttpPolicyPresets(policyPresets));
|
|
5868
5922
|
}
|
|
5869
5923
|
const features = featureSnapshot(lifecycleConfig2, compressionResult !== void 0, middleware.length);
|
|
5924
|
+
const hasMiddleware = compressionResult !== void 0 || middleware.length > 0 || policyPresets !== void 0 && Object.keys(policyPresets).length > 0;
|
|
5925
|
+
const transport = lifecycleConfig2.transport;
|
|
5926
|
+
const useInlineDecode = !hasMiddleware && transport !== void 0;
|
|
5870
5927
|
return buildDefaultClient(wire, {
|
|
5871
5928
|
preset,
|
|
5872
5929
|
features,
|
|
5873
|
-
compressionStats: _optionalChain([compressionResult, 'optionalAccess',
|
|
5930
|
+
compressionStats: _optionalChain([compressionResult, 'optionalAccess', _147 => _147.stats]),
|
|
5931
|
+
useInlineDecode
|
|
5874
5932
|
});
|
|
5875
5933
|
}
|
|
5876
5934
|
function buildDefaultClient(wire, meta) {
|
|
5877
|
-
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) =>
|
|
5935
|
+
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunk2JHJ4YHScjs.toPromise.call(void 0, e, env))(eff);
|
|
5878
5936
|
const requestRaw = (req) => wire(req);
|
|
5879
5937
|
const request = (req) => withPromise(requestRaw(req));
|
|
5880
5938
|
const get = (url, init) => request(buildHttpRequest("GET", url, init));
|
|
@@ -5889,21 +5947,26 @@ function buildDefaultClient(wire, meta) {
|
|
|
5889
5947
|
const req = setHeaderIfMissing("accept", "application/json")(
|
|
5890
5948
|
buildHttpRequest("GET", url, init)
|
|
5891
5949
|
);
|
|
5950
|
+
if (meta.useInlineDecode) {
|
|
5951
|
+
return withPromise(
|
|
5952
|
+
fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess', _148 => _148.schema]), _optionalChain([init, 'optionalAccess', _149 => _149.schemaName]))
|
|
5953
|
+
);
|
|
5954
|
+
}
|
|
5892
5955
|
return withPromise(
|
|
5893
|
-
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
5956
|
+
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _150 => _150.schema]), _optionalChain([init, 'optionalAccess', _151 => _151.schemaName])))
|
|
5894
5957
|
);
|
|
5895
5958
|
});
|
|
5896
5959
|
const postJson = ((url, bodyObj, init) => {
|
|
5897
5960
|
return withPromise(
|
|
5898
5961
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
5899
|
-
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess',
|
|
5962
|
+
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess', _152 => _152.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _153 => _153.bodySchemaName]) }),
|
|
5900
5963
|
(bodyText) => {
|
|
5901
5964
|
const req = setHeaderIfMissing("content-type", "application/json")(
|
|
5902
5965
|
setHeaderIfMissing("accept", "application/json")(
|
|
5903
5966
|
buildHttpRequest("POST", url, init, bodyText)
|
|
5904
5967
|
)
|
|
5905
5968
|
);
|
|
5906
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
5969
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _154 => _154.schema]), _optionalChain([init, 'optionalAccess', _155 => _155.schemaName])));
|
|
5907
5970
|
}
|
|
5908
5971
|
)
|
|
5909
5972
|
);
|
|
@@ -5917,6 +5980,7 @@ function buildDefaultClient(wire, meta) {
|
|
|
5917
5980
|
postJson,
|
|
5918
5981
|
with: (mw) => buildDefaultClient(wire.with(mw), {
|
|
5919
5982
|
...meta,
|
|
5983
|
+
useInlineDecode: false,
|
|
5920
5984
|
features: {
|
|
5921
5985
|
...meta.features,
|
|
5922
5986
|
middleware: meta.features.middleware + 1
|
|
@@ -5944,6 +6008,48 @@ function toResponse(wire, body) {
|
|
|
5944
6008
|
body
|
|
5945
6009
|
};
|
|
5946
6010
|
}
|
|
6011
|
+
function fusedWireAndDecode(wireEffect, schema, schemaName) {
|
|
6012
|
+
return {
|
|
6013
|
+
_tag: "Async",
|
|
6014
|
+
register: (env, cb) => {
|
|
6015
|
+
const innerEffect = wireEffect;
|
|
6016
|
+
if (innerEffect._tag === "Async" && innerEffect.register) {
|
|
6017
|
+
return innerEffect.register(env, (exit) => {
|
|
6018
|
+
if (exit._tag !== "Success") {
|
|
6019
|
+
cb(exit);
|
|
6020
|
+
return;
|
|
6021
|
+
}
|
|
6022
|
+
const wire = exit.value;
|
|
6023
|
+
inlineDecodeJson(wire, schema, schemaName, cb);
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
const decoded = _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, wireEffect, (w) => decodeResponse(w, schema, schemaName));
|
|
6027
|
+
if (decoded._tag === "Async" && decoded.register) {
|
|
6028
|
+
return decoded.register(env, cb);
|
|
6029
|
+
}
|
|
6030
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "ValidationError", message: "Internal: unexpected effect shape", body: "", issues: [], phase: "response" }) });
|
|
6031
|
+
}
|
|
6032
|
+
};
|
|
6033
|
+
}
|
|
6034
|
+
function inlineDecodeJson(wire, schema, schemaName, cb) {
|
|
6035
|
+
if (!schema) {
|
|
6036
|
+
let parsed;
|
|
6037
|
+
try {
|
|
6038
|
+
parsed = JSON.parse(wire.bodyText);
|
|
6039
|
+
} catch (error) {
|
|
6040
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(makeJsonParseValidationError(wire.bodyText, error, { schemaName })) });
|
|
6041
|
+
return;
|
|
6042
|
+
}
|
|
6043
|
+
cb({ _tag: "Success", value: toResponse(wire, parsed) });
|
|
6044
|
+
return;
|
|
6045
|
+
}
|
|
6046
|
+
const result = decodeJsonBody(wire.bodyText, schema, { schemaName });
|
|
6047
|
+
if (result.success) {
|
|
6048
|
+
cb({ _tag: "Success", value: toResponse(wire, result.data) });
|
|
6049
|
+
} else {
|
|
6050
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(result.error) });
|
|
6051
|
+
}
|
|
6052
|
+
}
|
|
5947
6053
|
function decodeResponse(wire, schema, schemaName) {
|
|
5948
6054
|
if (!schema) {
|
|
5949
6055
|
try {
|
|
@@ -6009,10 +6115,10 @@ function isLeanPreset(preset) {
|
|
|
6009
6115
|
}
|
|
6010
6116
|
|
|
6011
6117
|
// src/http/layer.ts
|
|
6012
|
-
var HttpClientService =
|
|
6118
|
+
var HttpClientService = _chunk5RZ7YITFcjs.makeServiceTag.call(void 0, "HttpClient");
|
|
6013
6119
|
function makeDefaultHttpClientLayer(config = {}, options = {}) {
|
|
6014
6120
|
const tag = _nullishCoalesce(options.tag, () => ( HttpClientService));
|
|
6015
|
-
return
|
|
6121
|
+
return _chunk5RZ7YITFcjs.layerEffect.call(void 0,
|
|
6016
6122
|
tag,
|
|
6017
6123
|
(context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0,
|
|
6018
6124
|
() => makeDefaultHttpClient(resolveDefaultHttpClientLayerConfig(config, context))
|
|
@@ -6123,4 +6229,6 @@ function shutdownDefaultHttpClient(client) {
|
|
|
6123
6229
|
|
|
6124
6230
|
|
|
6125
6231
|
|
|
6126
|
-
|
|
6232
|
+
|
|
6233
|
+
|
|
6234
|
+
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;
|