brass-runtime 1.19.0 → 1.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- 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-GOEO763K.cjs → chunk-2XXQ3NVT.cjs} +19 -19
- package/dist/{chunk-5RVHSBJ6.mjs → chunk-5X3MPWTR.mjs} +275 -39
- package/dist/{chunk-2R3RVNS2.js → chunk-6AGAZD32.js} +6 -6
- package/dist/{chunk-BLXBZ6RE.mjs → chunk-6BNZS2A4.mjs} +1 -1
- package/dist/{chunk-EXBGIC66.js → chunk-6W5DC3TX.js} +1 -1
- package/dist/{chunk-MUMBUXU6.mjs → chunk-BFNBU47C.mjs} +22 -6
- package/dist/{chunk-JWFOWPMB.js → chunk-BHX4MD35.js} +5 -5
- package/dist/{chunk-OO7BGCC3.cjs → chunk-CXWJII2N.cjs} +13 -13
- package/dist/{chunk-Z2YIDHRI.cjs → chunk-ENMKEX3N.cjs} +5 -5
- package/dist/{chunk-RZGB3DXR.js → chunk-HKLZJ5UK.js} +275 -39
- package/dist/{chunk-HW2CLRJ3.mjs → chunk-IA6BDGXW.mjs} +6 -6
- package/dist/{chunk-MA74OYCI.cjs → chunk-IHY2EJTT.cjs} +6 -6
- package/dist/{chunk-AQQQFNYD.mjs → chunk-IWAQQDYE.mjs} +1 -1
- package/dist/{chunk-C3CWI42G.js → chunk-J4F5KC3U.js} +1 -1
- package/dist/{chunk-ZDZNV6NA.cjs → chunk-JKHBEWQA.cjs} +23 -7
- package/dist/{chunk-5UBJT4RW.mjs → chunk-JM7WMSRR.mjs} +3 -3
- package/dist/{chunk-YQWZ7FZX.cjs → chunk-JQCQWO47.cjs} +5 -5
- package/dist/{chunk-B2VXVNIS.js → chunk-LI7WUVJN.js} +1 -1
- package/dist/{chunk-FC5N5QHJ.js → chunk-NWONRWBT.js} +2 -2
- package/dist/{chunk-H4ZRUQZL.js → chunk-PG6CHG34.js} +3 -3
- package/dist/{chunk-NQW3YUFN.cjs → chunk-QAHW7S3Q.cjs} +18 -18
- package/dist/{chunk-GXOIUBKE.js → chunk-RZQK32C6.js} +2 -2
- package/dist/{chunk-EKLEDIVJ.mjs → chunk-S6KSHYAT.mjs} +2 -2
- package/dist/{chunk-URVS2OE2.mjs → chunk-SCHM2MDA.mjs} +2 -2
- package/dist/{chunk-A6EG5WRL.js → chunk-TAPB4NN5.js} +2 -2
- package/dist/{chunk-APQBU7TM.js → chunk-TN2P7RNK.js} +22 -6
- package/dist/{chunk-QBVS3UYN.cjs → chunk-TWEHIAUE.cjs} +54 -54
- package/dist/{chunk-7FZUTJM3.cjs → chunk-UOKXJQAI.cjs} +380 -144
- package/dist/{chunk-FYWWU3Z7.cjs → chunk-VXNWVAIG.cjs} +2 -2
- package/dist/{chunk-KAPZHDO4.mjs → chunk-WA65XP2P.mjs} +1 -1
- package/dist/{chunk-4PKBNG2H.js → chunk-XO3TDAJE.js} +1 -1
- package/dist/{chunk-KDXNWGPB.mjs → chunk-XRRC5BBM.mjs} +1 -1
- package/dist/{chunk-DV644N7P.cjs → chunk-ZJC3JZIE.cjs} +16 -16
- package/dist/{chunk-3NKXUX4T.mjs → chunk-ZXLETUGQ.mjs} +2 -2
- package/dist/{chunk-OX6MF7SZ.mjs → chunk-ZXXOXB3T.mjs} +5 -5
- package/dist/{chunk-6STX4PS3.cjs → chunk-ZZ2CMYJL.cjs} +13 -13
- package/dist/core/index.cjs +9 -7
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +8 -6
- package/dist/core/index.mjs +8 -6
- package/dist/{defaultClient-Cid0JoUR.d.ts → defaultClient-hyVSNzSJ.d.ts} +3 -3
- package/dist/{effect-DnGUuhw6.d.ts → effect-DbEMiMvv.d.ts} +8 -1
- package/dist/http/index.cjs +48 -48
- package/dist/http/index.d.ts +8 -8
- package/dist/http/index.js +6 -6
- package/dist/http/index.mjs +6 -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 +87 -85
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/dist/{layer-D2LFcBVx.d.ts → layer-CsNGeVee.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-Bf1zNYZk.d.ts → server-BKKuzAW9.d.ts} +4 -4
- package/dist/{stream-I7bkvF7a.d.ts → stream-B8c_UKZq.d.ts} +1 -1
- package/dist/{tracer-DF83nLn6.d.ts → tracer-CS3yOXZx.d.ts} +2 -2
- package/dist/{tracing-CWV4gT0u.d.ts → tracing-DIAUf2x8.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;
|
|
2
2
|
|
|
3
3
|
var _chunkL6VB5N7Qcjs = require('./chunk-L6VB5N7Q.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkCXWJII2Ncjs = require('./chunk-CXWJII2N.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkZZ2CMYJLcjs = require('./chunk-ZZ2CMYJL.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkJKHBEWQAcjs = require('./chunk-JKHBEWQA.cjs');
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
@@ -346,7 +348,7 @@ var WasmRetryPlannerBridge = class {
|
|
|
346
348
|
}
|
|
347
349
|
};
|
|
348
350
|
function makeWasmRetryPlanner() {
|
|
349
|
-
const mod =
|
|
351
|
+
const mod = _chunkJKHBEWQAcjs.resolveWasmModule.call(void 0, );
|
|
350
352
|
const Ctor = _optionalChain([mod, 'optionalAccess', _9 => _9.BrassWasmRetryPlanner]);
|
|
351
353
|
if (!Ctor) throw new Error("brass-runtime wasm retry planner is not available. Run npm run build:wasm first.");
|
|
352
354
|
return new WasmRetryPlannerBridge(Ctor);
|
|
@@ -528,7 +530,7 @@ var withRetry = (p) => (next) => {
|
|
|
528
530
|
_optionalChain([wasmPlanner, 'optionalAccess', _15 => _15.drop, 'call', _16 => _16(id)]);
|
|
529
531
|
}
|
|
530
532
|
};
|
|
531
|
-
const scheduleDriver = effectivePolicy.schedule ?
|
|
533
|
+
const scheduleDriver = effectivePolicy.schedule ? _chunkZZ2CMYJLcjs.makeScheduleDriver.call(void 0, effectivePolicy.schedule, {
|
|
532
534
|
name: _nullishCoalesce(effectivePolicy.schedule.name, () => ( "http.retry")),
|
|
533
535
|
startedAtMs: startedAt,
|
|
534
536
|
onDecision: effectivePolicy.onScheduleDecision
|
|
@@ -606,7 +608,7 @@ var WasmHttpPermitPoolBridge = (_class = class {
|
|
|
606
608
|
}
|
|
607
609
|
}, _class);
|
|
608
610
|
function makeWasmHttpPermitPool(options) {
|
|
609
|
-
const mod =
|
|
611
|
+
const mod = _chunkJKHBEWQAcjs.resolveWasmModule.call(void 0, );
|
|
610
612
|
const Ctor = _optionalChain([mod, 'optionalAccess', _17 => _17.BrassWasmHttpPermitPool]);
|
|
611
613
|
if (!Ctor) throw new Error("brass-runtime wasm HTTP permit pool is not available. Run npm run build:wasm first.");
|
|
612
614
|
return new WasmHttpPermitPoolBridge(Ctor, options);
|
|
@@ -2600,7 +2602,7 @@ function makeFetchStreamTransport() {
|
|
|
2600
2602
|
});
|
|
2601
2603
|
const headers = headersOf(response);
|
|
2602
2604
|
const latencyMs = Math.round(nowMs() - started);
|
|
2603
|
-
const body =
|
|
2605
|
+
const body = _chunkCXWJII2Ncjs.streamFromReadableStream.call(void 0, response.body, normalizeHttpError, {
|
|
2604
2606
|
signal: linkedSignal.signal,
|
|
2605
2607
|
onRelease: linkedSignal.cleanup
|
|
2606
2608
|
});
|
|
@@ -3135,7 +3137,7 @@ function makeHttpStream(cfg = {}) {
|
|
|
3135
3137
|
const url = resolveRequestUrl(req, baseUrl);
|
|
3136
3138
|
if (!(url instanceof URL)) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, url);
|
|
3137
3139
|
const timeoutMs = resolvePositiveTimeout(_nullishCoalesce(req.timeoutMs, () => ( cfg.timeoutMs)));
|
|
3138
|
-
return
|
|
3140
|
+
return _chunkJKHBEWQAcjs.fromPromiseAbortable.call(void 0,
|
|
3139
3141
|
async (signal, env) => {
|
|
3140
3142
|
let lease;
|
|
3141
3143
|
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _76 => _76.init, 'optionalAccess', _77 => _77.signal]));
|
|
@@ -3182,6 +3184,275 @@ var noopSignal = (() => {
|
|
|
3182
3184
|
globalThis.__brassNoopSignal = s;
|
|
3183
3185
|
return s;
|
|
3184
3186
|
})();
|
|
3187
|
+
var PoolRequestState = (_class6 = class {
|
|
3188
|
+
constructor(req, url, transport, metrics, pool, adaptiveLimiter, timerWheel, timeoutMs, env, cb, previousSignal, controller, signal, label, startedAt) {;_class6.prototype.__init11.call(this);_class6.prototype.__init12.call(this);_class6.prototype.__init13.call(this);_class6.prototype.__init14.call(this);_class6.prototype.__init15.call(this);_class6.prototype.__init16.call(this);
|
|
3189
|
+
this.req = req;
|
|
3190
|
+
this.url = url;
|
|
3191
|
+
this.transport = transport;
|
|
3192
|
+
this.metrics = metrics;
|
|
3193
|
+
this.pool = pool;
|
|
3194
|
+
this.adaptiveLimiter = adaptiveLimiter;
|
|
3195
|
+
this.timerWheel = timerWheel;
|
|
3196
|
+
this.timeoutMs = timeoutMs;
|
|
3197
|
+
this.env = env;
|
|
3198
|
+
this.cb = cb;
|
|
3199
|
+
this.previousSignal = previousSignal;
|
|
3200
|
+
this.controller = controller;
|
|
3201
|
+
this.signal = signal;
|
|
3202
|
+
this.label = label;
|
|
3203
|
+
this.startedAt = startedAt;
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
|
|
3209
|
+
|
|
3210
|
+
|
|
3211
|
+
|
|
3212
|
+
|
|
3213
|
+
|
|
3214
|
+
|
|
3215
|
+
|
|
3216
|
+
|
|
3217
|
+
|
|
3218
|
+
|
|
3219
|
+
|
|
3220
|
+
__init11() {this.done = false}
|
|
3221
|
+
__init12() {this.cancelInner = void 0}
|
|
3222
|
+
__init13() {this.timerHandle = void 0}
|
|
3223
|
+
__init14() {this.timeoutHandle = void 0}
|
|
3224
|
+
__init15() {this.lease = void 0}
|
|
3225
|
+
finish(outcome, exit, error) {
|
|
3226
|
+
if (this.done) return;
|
|
3227
|
+
this.done = true;
|
|
3228
|
+
if (this.timerHandle) {
|
|
3229
|
+
this.timerHandle.cancel();
|
|
3230
|
+
this.timerHandle = void 0;
|
|
3231
|
+
}
|
|
3232
|
+
if (this.timeoutHandle !== void 0) {
|
|
3233
|
+
clearTimeout(this.timeoutHandle);
|
|
3234
|
+
this.timeoutHandle = void 0;
|
|
3235
|
+
}
|
|
3236
|
+
if (this.previousSignal) this.previousSignal.removeEventListener("abort", this.boundAbortFromPrevious);
|
|
3237
|
+
this.cancelInner = void 0;
|
|
3238
|
+
_chunkJKHBEWQAcjs.recordAbortablePromiseFinish.call(void 0, this.label, outcome);
|
|
3239
|
+
this.metrics.onFinish({
|
|
3240
|
+
label: this.label,
|
|
3241
|
+
outcome,
|
|
3242
|
+
durationMs: Math.round(performance.now() - this.startedAt),
|
|
3243
|
+
error
|
|
3244
|
+
});
|
|
3245
|
+
this.cb(exit);
|
|
3246
|
+
}
|
|
3247
|
+
finishFailure(error, outcome = "failure") {
|
|
3248
|
+
this.finish(outcome, { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(error) }, error);
|
|
3249
|
+
}
|
|
3250
|
+
abortCurrent(reason) {
|
|
3251
|
+
if (!this.controller) return;
|
|
3252
|
+
try {
|
|
3253
|
+
this.controller.abort(reason);
|
|
3254
|
+
} catch (e7) {
|
|
3255
|
+
this.controller.abort();
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
/**
|
|
3259
|
+
* Bound reference for addEventListener/removeEventListener.
|
|
3260
|
+
* Only allocated when previousSignal is present (not on the hot path).
|
|
3261
|
+
*/
|
|
3262
|
+
__init16() {this.boundAbortFromPrevious = void 0}
|
|
3263
|
+
abortFromPrevious() {
|
|
3264
|
+
const error = this.previousSignal ? abortErrorForSignal(this.previousSignal) : { _tag: "Abort" };
|
|
3265
|
+
this.abortCurrent(_optionalChain([this, 'access', _78 => _78.previousSignal, 'optionalAccess', _79 => _79.reason]));
|
|
3266
|
+
const cancel = this.cancelInner;
|
|
3267
|
+
this.cancelInner = void 0;
|
|
3268
|
+
if (this.lease) {
|
|
3269
|
+
releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3270
|
+
this.lease = void 0;
|
|
3271
|
+
}
|
|
3272
|
+
queueMicrotask(() => {
|
|
3273
|
+
this.finishFailure(error);
|
|
3274
|
+
_optionalChain([cancel, 'optionalCall', _80 => _80()]);
|
|
3275
|
+
});
|
|
3276
|
+
}
|
|
3277
|
+
runTransportInner() {
|
|
3278
|
+
const { transport, req, url, signal, env } = this;
|
|
3279
|
+
try {
|
|
3280
|
+
const effect = transport({ request: req, url, signal });
|
|
3281
|
+
if (effect._tag === "Succeed") {
|
|
3282
|
+
if (this.lease) releaseSuccess(this.lease, this.adaptiveLimiter, effect.value);
|
|
3283
|
+
this.finish("success", { _tag: "Success", value: effect.value });
|
|
3284
|
+
} else if (effect._tag === "Fail") {
|
|
3285
|
+
if (this.lease) releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3286
|
+
this.finishFailure(effect.error);
|
|
3287
|
+
} else if (effect._tag === "Async") {
|
|
3288
|
+
try {
|
|
3289
|
+
const cancel = effect.register(env, (exit) => {
|
|
3290
|
+
if (this.done) return;
|
|
3291
|
+
this.cancelInner = void 0;
|
|
3292
|
+
if (exit._tag === "Success") {
|
|
3293
|
+
if (this.lease) releaseSuccess(this.lease, this.adaptiveLimiter, exit.value);
|
|
3294
|
+
this.finish("success", exit);
|
|
3295
|
+
} else {
|
|
3296
|
+
if (this.lease) releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3297
|
+
this.finish("failure", exit, exitError(exit));
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
if (!this.done) this.cancelInner = typeof cancel === "function" ? cancel : void 0;
|
|
3301
|
+
} catch (error) {
|
|
3302
|
+
if (this.lease) releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3303
|
+
this.finishFailure(normalizeHttpError(error));
|
|
3304
|
+
}
|
|
3305
|
+
} else {
|
|
3306
|
+
const innerCancel = _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0,
|
|
3307
|
+
effect,
|
|
3308
|
+
env,
|
|
3309
|
+
(exit) => {
|
|
3310
|
+
if (this.done) return;
|
|
3311
|
+
this.cancelInner = void 0;
|
|
3312
|
+
if (exit._tag === "Success") {
|
|
3313
|
+
if (this.lease) releaseSuccess(this.lease, this.adaptiveLimiter, exit.value);
|
|
3314
|
+
this.finish("success", exit);
|
|
3315
|
+
} else {
|
|
3316
|
+
if (this.lease) releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3317
|
+
this.finish("failure", exit, exitError(exit));
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
);
|
|
3321
|
+
if (!this.done) this.cancelInner = innerCancel;
|
|
3322
|
+
}
|
|
3323
|
+
} catch (error) {
|
|
3324
|
+
if (this.lease) releaseFailure(this.lease, this.adaptiveLimiter);
|
|
3325
|
+
this.finishFailure(normalizeHttpError(error));
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
}, _class6);
|
|
3329
|
+
var runPoolTransport = (req, url, transport, metrics, pool, adaptiveLimiter, timerWheel, timeoutMs) => ({
|
|
3330
|
+
_tag: "Async",
|
|
3331
|
+
register: (env, cb) => {
|
|
3332
|
+
const previousSignal = _optionalChain([req, 'access', _81 => _81.init, 'optionalAccess', _82 => _82.signal]);
|
|
3333
|
+
const controller = new AbortController();
|
|
3334
|
+
const signal = controller.signal;
|
|
3335
|
+
const label = fetchLabel(req, url);
|
|
3336
|
+
const startedAt = performance.now();
|
|
3337
|
+
const state = new PoolRequestState(
|
|
3338
|
+
req,
|
|
3339
|
+
url,
|
|
3340
|
+
transport,
|
|
3341
|
+
metrics,
|
|
3342
|
+
pool,
|
|
3343
|
+
adaptiveLimiter,
|
|
3344
|
+
timerWheel,
|
|
3345
|
+
timeoutMs,
|
|
3346
|
+
env,
|
|
3347
|
+
cb,
|
|
3348
|
+
previousSignal,
|
|
3349
|
+
controller,
|
|
3350
|
+
signal,
|
|
3351
|
+
label,
|
|
3352
|
+
startedAt
|
|
3353
|
+
);
|
|
3354
|
+
_chunkJKHBEWQAcjs.recordAbortablePromiseStart.call(void 0, label);
|
|
3355
|
+
metrics.onStart();
|
|
3356
|
+
if (previousSignal) {
|
|
3357
|
+
state.boundAbortFromPrevious = () => state.abortFromPrevious();
|
|
3358
|
+
if (previousSignal.aborted) {
|
|
3359
|
+
state.abortFromPrevious();
|
|
3360
|
+
return () => void 0;
|
|
3361
|
+
}
|
|
3362
|
+
previousSignal.addEventListener("abort", state.boundAbortFromPrevious, ONCE_OPTIONS);
|
|
3363
|
+
}
|
|
3364
|
+
if (timeoutMs !== void 0 && timeoutMs > 0) {
|
|
3365
|
+
const onTimeout = () => {
|
|
3366
|
+
const reason = timeoutReason(req, url, timeoutMs);
|
|
3367
|
+
if (state.lease) {
|
|
3368
|
+
releaseFailure(state.lease, adaptiveLimiter);
|
|
3369
|
+
state.lease = void 0;
|
|
3370
|
+
}
|
|
3371
|
+
const cancel = state.cancelInner;
|
|
3372
|
+
state.cancelInner = void 0;
|
|
3373
|
+
state.finishFailure(reason, "timeout");
|
|
3374
|
+
state.abortCurrent(reason);
|
|
3375
|
+
_optionalChain([cancel, 'optionalCall', _83 => _83()]);
|
|
3376
|
+
};
|
|
3377
|
+
if (timerWheel) {
|
|
3378
|
+
state.timerHandle = timerWheel.schedule(timeoutMs, onTimeout, startedAt);
|
|
3379
|
+
} else {
|
|
3380
|
+
state.timeoutHandle = setTimeout(onTimeout, timeoutMs);
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
if (adaptiveLimiter) {
|
|
3384
|
+
const key = resolveHttpPoolKey(adaptiveLimiter.keyResolver, req, url);
|
|
3385
|
+
const syncLease = adaptiveLimiter.tryAcquireSync(key, signal);
|
|
3386
|
+
if (syncLease) {
|
|
3387
|
+
state.lease = syncLease;
|
|
3388
|
+
} else {
|
|
3389
|
+
adaptiveLimiter.acquire(key, signal, { priority: requestPriority(req) }).then(
|
|
3390
|
+
(asyncLease) => {
|
|
3391
|
+
if (state.done) {
|
|
3392
|
+
asyncLease.release(0);
|
|
3393
|
+
return;
|
|
3394
|
+
}
|
|
3395
|
+
state.lease = asyncLease;
|
|
3396
|
+
state.runTransportInner();
|
|
3397
|
+
},
|
|
3398
|
+
(err) => {
|
|
3399
|
+
if (state.done) return;
|
|
3400
|
+
state.finishFailure(normalizeHttpError(err));
|
|
3401
|
+
}
|
|
3402
|
+
);
|
|
3403
|
+
return () => {
|
|
3404
|
+
if (state.done) return;
|
|
3405
|
+
const cancel = state.cancelInner;
|
|
3406
|
+
state.cancelInner = void 0;
|
|
3407
|
+
state.abortCurrent();
|
|
3408
|
+
if (state.lease) releaseFailure(state.lease, adaptiveLimiter);
|
|
3409
|
+
state.finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
3410
|
+
_optionalChain([cancel, 'optionalCall', _84 => _84()]);
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
} else if (pool) {
|
|
3414
|
+
const key = resolveHttpPoolKey(pool.keyResolver, req, url);
|
|
3415
|
+
const syncLease = pool.tryAcquireSync(key, signal);
|
|
3416
|
+
if (syncLease) {
|
|
3417
|
+
state.lease = syncLease;
|
|
3418
|
+
} else {
|
|
3419
|
+
pool.acquire(key, signal).then(
|
|
3420
|
+
(asyncLease) => {
|
|
3421
|
+
if (state.done) {
|
|
3422
|
+
asyncLease.release();
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
state.lease = asyncLease;
|
|
3426
|
+
state.runTransportInner();
|
|
3427
|
+
},
|
|
3428
|
+
(err) => {
|
|
3429
|
+
if (state.done) return;
|
|
3430
|
+
state.finishFailure(normalizeHttpError(err));
|
|
3431
|
+
}
|
|
3432
|
+
);
|
|
3433
|
+
return () => {
|
|
3434
|
+
if (state.done) return;
|
|
3435
|
+
const cancel = state.cancelInner;
|
|
3436
|
+
state.cancelInner = void 0;
|
|
3437
|
+
state.abortCurrent();
|
|
3438
|
+
if (state.lease) releaseFailure(state.lease, void 0);
|
|
3439
|
+
state.finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
3440
|
+
_optionalChain([cancel, 'optionalCall', _85 => _85()]);
|
|
3441
|
+
};
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
state.runTransportInner();
|
|
3445
|
+
return () => {
|
|
3446
|
+
if (state.done) return;
|
|
3447
|
+
const cancel = state.cancelInner;
|
|
3448
|
+
state.cancelInner = void 0;
|
|
3449
|
+
state.abortCurrent();
|
|
3450
|
+
if (state.lease) releaseFailure(state.lease, adaptiveLimiter);
|
|
3451
|
+
state.finish("interrupt", { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.interrupt() });
|
|
3452
|
+
_optionalChain([cancel, 'optionalCall', _86 => _86()]);
|
|
3453
|
+
};
|
|
3454
|
+
}
|
|
3455
|
+
});
|
|
3185
3456
|
function makeHttp(cfg = {}) {
|
|
3186
3457
|
validateMakeHttpConfig(cfg);
|
|
3187
3458
|
const baseUrl = _nullishCoalesce(cfg.baseUrl, () => ( ""));
|
|
@@ -3200,53 +3471,18 @@ function makeHttp(cfg = {}) {
|
|
|
3200
3471
|
if (!adaptiveLimiter && !pool && timeoutMs === void 0) {
|
|
3201
3472
|
return runDirectTransport(req, url, transport, metrics);
|
|
3202
3473
|
}
|
|
3203
|
-
return
|
|
3204
|
-
async (signal, env) => {
|
|
3205
|
-
let lease;
|
|
3206
|
-
const linkedSignal = linkAbortSignals(signal, _optionalChain([req, 'access', _78 => _78.init, 'optionalAccess', _79 => _79.signal]));
|
|
3207
|
-
try {
|
|
3208
|
-
if (linkedSignal.signal.aborted) throw abortErrorForSignal(linkedSignal.signal);
|
|
3209
|
-
if (adaptiveLimiter) {
|
|
3210
|
-
const key = resolveHttpPoolKey(adaptiveLimiter.keyResolver, req, url);
|
|
3211
|
-
lease = await adaptiveLimiter.acquire(key, linkedSignal.signal, { priority: requestPriority(req) });
|
|
3212
|
-
} else if (pool) {
|
|
3213
|
-
const key = resolveHttpPoolKey(pool.keyResolver, req, url);
|
|
3214
|
-
lease = await pool.acquire(key, linkedSignal.signal);
|
|
3215
|
-
}
|
|
3216
|
-
const response = await runTransportEffect(
|
|
3217
|
-
transport({ request: req, url, signal: linkedSignal.signal }),
|
|
3218
|
-
env,
|
|
3219
|
-
linkedSignal.signal
|
|
3220
|
-
);
|
|
3221
|
-
lease = releaseSuccess(lease, adaptiveLimiter, response);
|
|
3222
|
-
return response;
|
|
3223
|
-
} finally {
|
|
3224
|
-
linkedSignal.cleanup();
|
|
3225
|
-
if (lease) {
|
|
3226
|
-
releaseFailure(lease, adaptiveLimiter);
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
},
|
|
3230
|
-
normalizeHttpError,
|
|
3231
|
-
{
|
|
3232
|
-
label: fetchLabel(req, url),
|
|
3233
|
-
timeoutMs,
|
|
3234
|
-
timeoutReason: timeoutMs ? () => timeoutReason(req, url, timeoutMs) : void 0,
|
|
3235
|
-
onStart: metrics.onStart,
|
|
3236
|
-
onFinish: metrics.onFinish
|
|
3237
|
-
}
|
|
3238
|
-
);
|
|
3474
|
+
return runPoolTransport(req, url, transport, metrics, pool, adaptiveLimiter, void 0, timeoutMs);
|
|
3239
3475
|
};
|
|
3240
3476
|
const metadata = {};
|
|
3241
3477
|
if (adaptiveLimiter) metadata.adaptiveLimiter = adaptiveLimiter;
|
|
3242
3478
|
if (adaptiveLimiter || destroyTransport) {
|
|
3243
3479
|
metadata.destroy = () => {
|
|
3244
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3245
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3480
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _87 => _87.destroy, 'call', _88 => _88()]);
|
|
3481
|
+
_optionalChain([destroyTransport, 'optionalCall', _89 => _89()]);
|
|
3246
3482
|
};
|
|
3247
3483
|
metadata.shutdown = () => {
|
|
3248
|
-
_optionalChain([adaptiveLimiter, 'optionalAccess',
|
|
3249
|
-
_optionalChain([destroyTransport, 'optionalCall',
|
|
3484
|
+
_optionalChain([adaptiveLimiter, 'optionalAccess', _90 => _90.shutdown, 'call', _91 => _91()]);
|
|
3485
|
+
_optionalChain([destroyTransport, 'optionalCall', _92 => _92()]);
|
|
3250
3486
|
};
|
|
3251
3487
|
}
|
|
3252
3488
|
return decorate(run, metrics.snapshot, metadata);
|
|
@@ -3269,7 +3505,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3269
3505
|
if (!canRetry) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3270
3506
|
const d = delayWithinBudget(backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs));
|
|
3271
3507
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, e);
|
|
3272
|
-
_optionalChain([p, 'access',
|
|
3508
|
+
_optionalChain([p, 'access', _93 => _93.onRetry, 'optionalCall', _94 => _94({
|
|
3273
3509
|
attempt,
|
|
3274
3510
|
delayMs: d,
|
|
3275
3511
|
error: e,
|
|
@@ -3278,7 +3514,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3278
3514
|
method: req.method,
|
|
3279
3515
|
timestamp: Date.now()
|
|
3280
3516
|
})]);
|
|
3281
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3517
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunkZZ2CMYJLcjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3282
3518
|
},
|
|
3283
3519
|
(w) => {
|
|
3284
3520
|
const canRetry = attempt < p.maxRetries && retryOnStatus(w.status) && remainingBudget() > 0;
|
|
@@ -3287,7 +3523,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3287
3523
|
const rawDelay = ra === void 0 ? backoffDelayMs(attempt, p.baseDelayMs, p.maxDelayMs) : Math.min(ra, p.maxDelayMs);
|
|
3288
3524
|
const d = delayWithinBudget(rawDelay);
|
|
3289
3525
|
if (d <= 0 && maxElapsedMs !== void 0) return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, w);
|
|
3290
|
-
_optionalChain([p, 'access',
|
|
3526
|
+
_optionalChain([p, 'access', _95 => _95.onRetry, 'optionalCall', _96 => _96({
|
|
3291
3527
|
attempt,
|
|
3292
3528
|
delayMs: d,
|
|
3293
3529
|
error: void 0,
|
|
@@ -3296,7 +3532,7 @@ var withRetryStream = (p) => (next) => {
|
|
|
3296
3532
|
method: req.method,
|
|
3297
3533
|
timestamp: Date.now()
|
|
3298
3534
|
})]);
|
|
3299
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
3535
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, _chunkZZ2CMYJLcjs.sleep.call(void 0, d), () => loop(attempt + 1));
|
|
3300
3536
|
}
|
|
3301
3537
|
);
|
|
3302
3538
|
return loop(0);
|
|
@@ -3484,7 +3720,7 @@ function safeEmit(onEvent, event) {
|
|
|
3484
3720
|
if (!onEvent) return;
|
|
3485
3721
|
try {
|
|
3486
3722
|
onEvent(event);
|
|
3487
|
-
} catch (
|
|
3723
|
+
} catch (e8) {
|
|
3488
3724
|
}
|
|
3489
3725
|
}
|
|
3490
3726
|
function causeDefectMessage(cause) {
|
|
@@ -3494,8 +3730,8 @@ function causeDefectMessage(cause) {
|
|
|
3494
3730
|
}
|
|
3495
3731
|
function withDedup(config) {
|
|
3496
3732
|
const inFlight = /* @__PURE__ */ new Map();
|
|
3497
|
-
const customKeyFn = _optionalChain([config, 'optionalAccess',
|
|
3498
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
3733
|
+
const customKeyFn = _optionalChain([config, 'optionalAccess', _97 => _97.dedupKey]);
|
|
3734
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _98 => _98.onEvent]);
|
|
3499
3735
|
const dedupKeyCtx = makeDedupKeyContext("");
|
|
3500
3736
|
return (next) => {
|
|
3501
3737
|
return (req) => {
|
|
@@ -3512,7 +3748,7 @@ function withDedup(config) {
|
|
|
3512
3748
|
} else if (customKeyFn) {
|
|
3513
3749
|
try {
|
|
3514
3750
|
key = customKeyFn(req);
|
|
3515
|
-
} catch (
|
|
3751
|
+
} catch (e9) {
|
|
3516
3752
|
return next(req);
|
|
3517
3753
|
}
|
|
3518
3754
|
if (!key) {
|
|
@@ -3639,7 +3875,7 @@ function safeEmitBatch(onEvent, event) {
|
|
|
3639
3875
|
if (!onEvent) return;
|
|
3640
3876
|
try {
|
|
3641
3877
|
onEvent(event);
|
|
3642
|
-
} catch (
|
|
3878
|
+
} catch (e10) {
|
|
3643
3879
|
}
|
|
3644
3880
|
}
|
|
3645
3881
|
function causeDefectMessage2(cause) {
|
|
@@ -3722,7 +3958,7 @@ function withBatch(config, onEvent) {
|
|
|
3722
3958
|
let key;
|
|
3723
3959
|
try {
|
|
3724
3960
|
key = batchKey(req);
|
|
3725
|
-
} catch (
|
|
3961
|
+
} catch (e11) {
|
|
3726
3962
|
return next(req);
|
|
3727
3963
|
}
|
|
3728
3964
|
if (!key) {
|
|
@@ -3823,10 +4059,10 @@ var now = typeof performance !== "undefined" && typeof performance.now === "func
|
|
|
3823
4059
|
function isExpired(node) {
|
|
3824
4060
|
return now() - node.storedAt >= node.ttlMs;
|
|
3825
4061
|
}
|
|
3826
|
-
var LRUCache = (
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
4062
|
+
var LRUCache = (_class7 = class {
|
|
4063
|
+
__init17() {this.map = /* @__PURE__ */ new Map()}
|
|
4064
|
+
__init18() {this.head = null}
|
|
4065
|
+
__init19() {this.tail = null}
|
|
3830
4066
|
|
|
3831
4067
|
|
|
3832
4068
|
/**
|
|
@@ -3843,7 +4079,7 @@ var LRUCache = (_class6 = class {
|
|
|
3843
4079
|
* const cache = new LRUCache<number>({ maxEntries: 50 });
|
|
3844
4080
|
* ```
|
|
3845
4081
|
*/
|
|
3846
|
-
constructor(config = {}) {;
|
|
4082
|
+
constructor(config = {}) {;_class7.prototype.__init17.call(this);_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);
|
|
3847
4083
|
const max = _nullishCoalesce(config.maxEntries, () => ( 1024));
|
|
3848
4084
|
this.maxEntries = Math.max(1, Math.floor(max));
|
|
3849
4085
|
this.onEvict = config.onEvict;
|
|
@@ -4025,7 +4261,7 @@ var LRUCache = (_class6 = class {
|
|
|
4025
4261
|
this.onEvict(1);
|
|
4026
4262
|
}
|
|
4027
4263
|
}
|
|
4028
|
-
},
|
|
4264
|
+
}, _class7);
|
|
4029
4265
|
|
|
4030
4266
|
// src/http/lifecycle/responseCache.ts
|
|
4031
4267
|
function clamp3(n, min, max) {
|
|
@@ -4035,23 +4271,23 @@ function safeEmit2(onEvent, event) {
|
|
|
4035
4271
|
if (!onEvent) return;
|
|
4036
4272
|
try {
|
|
4037
4273
|
onEvent(event);
|
|
4038
|
-
} catch (
|
|
4274
|
+
} catch (e12) {
|
|
4039
4275
|
}
|
|
4040
4276
|
}
|
|
4041
4277
|
function withCache(config) {
|
|
4042
|
-
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4278
|
+
const ttlSeconds = clamp3(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _99 => _99.ttlSeconds]), () => ( 60)), 1, 86400);
|
|
4043
4279
|
const ttlMs = ttlSeconds * 1e3;
|
|
4044
|
-
const maxEntries = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4045
|
-
const staleWhileRevalidate = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4046
|
-
const cachePolicy = _optionalChain([config, 'optionalAccess',
|
|
4047
|
-
const cacheRelevantHeaders = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4048
|
-
const baseUrl = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
4049
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
4050
|
-
const onLifecycleEvent = _optionalChain([config, 'optionalAccess',
|
|
4280
|
+
const maxEntries = Math.max(1, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _100 => _100.maxEntries]), () => ( 1024))));
|
|
4281
|
+
const staleWhileRevalidate = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _101 => _101.staleWhileRevalidate]), () => ( false));
|
|
4282
|
+
const cachePolicy = _optionalChain([config, 'optionalAccess', _102 => _102.cachePolicy]);
|
|
4283
|
+
const cacheRelevantHeaders = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _103 => _103.cacheRelevantHeaders]), () => ( []));
|
|
4284
|
+
const baseUrl = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _104 => _104.baseUrl]), () => ( ""));
|
|
4285
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _105 => _105.onEvent]);
|
|
4286
|
+
const onLifecycleEvent = _optionalChain([config, 'optionalAccess', _106 => _106.onLifecycleEvent]);
|
|
4051
4287
|
const cacheKeyCtx = makeCacheKeyContext(baseUrl, cacheRelevantHeaders);
|
|
4052
4288
|
const cache = new LRUCache({
|
|
4053
4289
|
maxEntries,
|
|
4054
|
-
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4290
|
+
onEvict: (count) => _optionalChain([onLifecycleEvent, 'optionalCall', _107 => _107({ type: "cache-eviction", count })])
|
|
4055
4291
|
});
|
|
4056
4292
|
const revalidating = /* @__PURE__ */ new Set();
|
|
4057
4293
|
const invalidate = (key) => {
|
|
@@ -4072,11 +4308,11 @@ function withCache(config) {
|
|
|
4072
4308
|
register: (env, cb) => {
|
|
4073
4309
|
const cached = cache.get(key);
|
|
4074
4310
|
if (cached !== void 0) {
|
|
4075
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4311
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _108 => _108({ type: "cache-hit", cacheKey: key })]);
|
|
4076
4312
|
cb({ _tag: "Success", value: cached });
|
|
4077
4313
|
return;
|
|
4078
4314
|
}
|
|
4079
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4315
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _109 => _109({ type: "cache-miss", cacheKey: key })]);
|
|
4080
4316
|
const innerEffect = next(req);
|
|
4081
4317
|
return _chunkL6VB5N7Qcjs.registerHttpEffect.call(void 0, innerEffect, env, (exit) => {
|
|
4082
4318
|
if (exit._tag === "Success") {
|
|
@@ -4133,16 +4369,16 @@ function withCache(config) {
|
|
|
4133
4369
|
if (cached !== void 0) {
|
|
4134
4370
|
const expiresAt = expirationMap.get(key);
|
|
4135
4371
|
if (expiresAt !== void 0 && now() < expiresAt) {
|
|
4136
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4372
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _110 => _110({ type: "cache-hit", cacheKey: key })]);
|
|
4137
4373
|
cb({ _tag: "Success", value: cached });
|
|
4138
4374
|
return;
|
|
4139
4375
|
}
|
|
4140
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4376
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _111 => _111({ type: "cache-hit", cacheKey: key })]);
|
|
4141
4377
|
cb({ _tag: "Success", value: cached });
|
|
4142
4378
|
triggerRevalidation(next, req, key);
|
|
4143
4379
|
return;
|
|
4144
4380
|
}
|
|
4145
|
-
_optionalChain([onLifecycleEvent, 'optionalCall',
|
|
4381
|
+
_optionalChain([onLifecycleEvent, 'optionalCall', _112 => _112({ type: "cache-miss", cacheKey: key })]);
|
|
4146
4382
|
const innerEffect = next(req);
|
|
4147
4383
|
const handleSuccess = (res) => {
|
|
4148
4384
|
swrStoreIfCacheable(req, res, key);
|
|
@@ -4202,9 +4438,9 @@ function comparePriority(a, b) {
|
|
|
4202
4438
|
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
4203
4439
|
return a.arrivalOrder - b.arrivalOrder;
|
|
4204
4440
|
}
|
|
4205
|
-
var PriorityQueue = (
|
|
4206
|
-
|
|
4207
|
-
|
|
4441
|
+
var PriorityQueue = (_class8 = class {constructor() { _class8.prototype.__init20.call(this);_class8.prototype.__init21.call(this); }
|
|
4442
|
+
__init20() {this.heap = []}
|
|
4443
|
+
__init21() {this.counter = 0}
|
|
4208
4444
|
/**
|
|
4209
4445
|
* Returns the number of entries in the queue (including cancelled entries).
|
|
4210
4446
|
*
|
|
@@ -4388,14 +4624,14 @@ var PriorityQueue = (_class7 = class {constructor() { _class7.prototype.__init14
|
|
|
4388
4624
|
index = smallest;
|
|
4389
4625
|
}
|
|
4390
4626
|
}
|
|
4391
|
-
},
|
|
4627
|
+
}, _class8);
|
|
4392
4628
|
|
|
4393
4629
|
// src/http/lifecycle/priorityScheduler.ts
|
|
4394
4630
|
var DEFAULT_CONCURRENCY2 = 32;
|
|
4395
4631
|
function extractPriority(req) {
|
|
4396
4632
|
const fromPolicy = getHttpRequestPolicy(req).priority;
|
|
4397
4633
|
if (fromPolicy !== void 0) return clampPriority2(fromPolicy);
|
|
4398
|
-
const fromInit = _optionalChain([req, 'access',
|
|
4634
|
+
const fromInit = _optionalChain([req, 'access', _113 => _113.init, 'optionalAccess', _114 => _114.priority]);
|
|
4399
4635
|
if (fromInit !== void 0) return clampPriority2(fromInit);
|
|
4400
4636
|
return 5;
|
|
4401
4637
|
}
|
|
@@ -4403,13 +4639,13 @@ function safeEmit3(onEvent, event) {
|
|
|
4403
4639
|
if (!onEvent) return;
|
|
4404
4640
|
try {
|
|
4405
4641
|
onEvent(event);
|
|
4406
|
-
} catch (
|
|
4642
|
+
} catch (e13) {
|
|
4407
4643
|
}
|
|
4408
4644
|
}
|
|
4409
4645
|
function withPriority(config) {
|
|
4410
|
-
const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess',
|
|
4411
|
-
const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess',
|
|
4412
|
-
const onEvent = _optionalChain([config, 'optionalAccess',
|
|
4646
|
+
const concurrency = resolveConcurrency(_optionalChain([config, 'optionalAccess', _115 => _115.concurrency]));
|
|
4647
|
+
const queueTimeoutMs = resolveQueueTimeout(_optionalChain([config, 'optionalAccess', _116 => _116.queueTimeoutMs]));
|
|
4648
|
+
const onEvent = _optionalChain([config, 'optionalAccess', _117 => _117.onEvent]);
|
|
4413
4649
|
const queue = new PriorityQueue();
|
|
4414
4650
|
let inFlight = 0;
|
|
4415
4651
|
const queueDepth = () => {
|
|
@@ -4454,7 +4690,7 @@ function withPriority(config) {
|
|
|
4454
4690
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4455
4691
|
};
|
|
4456
4692
|
signal.addEventListener("abort", abortHandler, { once: true });
|
|
4457
|
-
} else if (_optionalChain([signal, 'optionalAccess',
|
|
4693
|
+
} else if (_optionalChain([signal, 'optionalAccess', _118 => _118.aborted])) {
|
|
4458
4694
|
entry.cancelled = true;
|
|
4459
4695
|
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4460
4696
|
return;
|
|
@@ -4500,7 +4736,7 @@ function withPriority(config) {
|
|
|
4500
4736
|
clearTimeout(queued.timer);
|
|
4501
4737
|
queued.timer = void 0;
|
|
4502
4738
|
}
|
|
4503
|
-
if (_optionalChain([queued, 'access',
|
|
4739
|
+
if (_optionalChain([queued, 'access', _119 => _119.signal, 'optionalAccess', _120 => _120.aborted])) {
|
|
4504
4740
|
queued.cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
4505
4741
|
continue;
|
|
4506
4742
|
}
|
|
@@ -4520,23 +4756,23 @@ function resolveQueueTimeout(value) {
|
|
|
4520
4756
|
return n > 0 ? n : void 0;
|
|
4521
4757
|
}
|
|
4522
4758
|
function getSignal(req) {
|
|
4523
|
-
return _optionalChain([req, 'access',
|
|
4759
|
+
return _optionalChain([req, 'access', _121 => _121.init, 'optionalAccess', _122 => _122.signal]);
|
|
4524
4760
|
}
|
|
4525
4761
|
|
|
4526
4762
|
// src/http/lifecycle/stats.ts
|
|
4527
|
-
var LifecycleStatsTracker = (
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4763
|
+
var LifecycleStatsTracker = (_class9 = class {
|
|
4764
|
+
__init22() {this._cacheHits = 0}
|
|
4765
|
+
__init23() {this._cacheMisses = 0}
|
|
4766
|
+
__init24() {this._cacheEvictions = 0}
|
|
4767
|
+
__init25() {this._dedupHits = 0}
|
|
4768
|
+
__init26() {this._dedupActive = 0}
|
|
4769
|
+
__init27() {this._queueDepth = 0}
|
|
4770
|
+
__init28() {this._requestsStarted = 0}
|
|
4771
|
+
__init29() {this._requestsCompleted = 0}
|
|
4772
|
+
__init30() {this._requestsFailed = 0}
|
|
4773
|
+
__init31() {this._retries = 0}
|
|
4774
|
+
__init32() {this._batchDispatches = 0}
|
|
4775
|
+
__init33() {this._batchedRequests = 0}
|
|
4540
4776
|
|
|
4541
4777
|
|
|
4542
4778
|
/**
|
|
@@ -4556,7 +4792,7 @@ var LifecycleStatsTracker = (_class8 = class {
|
|
|
4556
4792
|
* });
|
|
4557
4793
|
* ```
|
|
4558
4794
|
*/
|
|
4559
|
-
constructor(opts) {;
|
|
4795
|
+
constructor(opts) {;_class9.prototype.__init22.call(this);_class9.prototype.__init23.call(this);_class9.prototype.__init24.call(this);_class9.prototype.__init25.call(this);_class9.prototype.__init26.call(this);_class9.prototype.__init27.call(this);_class9.prototype.__init28.call(this);_class9.prototype.__init29.call(this);_class9.prototype.__init30.call(this);_class9.prototype.__init31.call(this);_class9.prototype.__init32.call(this);_class9.prototype.__init33.call(this);
|
|
4560
4796
|
this._onEvent = opts.onEvent;
|
|
4561
4797
|
this._wireStats = opts.wireStats;
|
|
4562
4798
|
}
|
|
@@ -4741,7 +4977,7 @@ var LifecycleStatsTracker = (_class8 = class {
|
|
|
4741
4977
|
...extra
|
|
4742
4978
|
};
|
|
4743
4979
|
this._onEvent(event);
|
|
4744
|
-
} catch (
|
|
4980
|
+
} catch (e14) {
|
|
4745
4981
|
}
|
|
4746
4982
|
}
|
|
4747
4983
|
// --- Snapshot ---
|
|
@@ -4783,7 +5019,7 @@ var LifecycleStatsTracker = (_class8 = class {
|
|
|
4783
5019
|
wire: this._wireStats()
|
|
4784
5020
|
});
|
|
4785
5021
|
}
|
|
4786
|
-
},
|
|
5022
|
+
}, _class9);
|
|
4787
5023
|
|
|
4788
5024
|
// src/http/prewarm/validation.ts
|
|
4789
5025
|
function validateOrigin(origin) {
|
|
@@ -4804,7 +5040,7 @@ function validateOrigin(origin) {
|
|
|
4804
5040
|
let parsed;
|
|
4805
5041
|
try {
|
|
4806
5042
|
parsed = new URL(stripped);
|
|
4807
|
-
} catch (
|
|
5043
|
+
} catch (e15) {
|
|
4808
5044
|
throw new Error(
|
|
4809
5045
|
`validateOrigin: invalid origin "${origin}" \u2014 must be a valid URL origin (scheme + host + optional port)`
|
|
4810
5046
|
);
|
|
@@ -4909,9 +5145,9 @@ async function executeProbeViaClient(client, url, signal) {
|
|
|
4909
5145
|
resolve({ ok: true });
|
|
4910
5146
|
} else {
|
|
4911
5147
|
const cause = exit.cause;
|
|
4912
|
-
if (_optionalChain([cause, 'optionalAccess',
|
|
5148
|
+
if (_optionalChain([cause, 'optionalAccess', _123 => _123._tag]) === "Fail") {
|
|
4913
5149
|
const err = cause.error;
|
|
4914
|
-
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
5150
|
+
resolve({ ok: false, error: _nullishCoalesce(_nullishCoalesce(_optionalChain([err, 'optionalAccess', _124 => _124.message]), () => ( _optionalChain([err, 'optionalAccess', _125 => _125._tag]))), () => ( "Unknown error")) });
|
|
4915
5151
|
} else {
|
|
4916
5152
|
resolve({ ok: false, error: "cancelled" });
|
|
4917
5153
|
}
|
|
@@ -5069,7 +5305,7 @@ function makePrewarmManager(config) {
|
|
|
5069
5305
|
if (onEvent) {
|
|
5070
5306
|
try {
|
|
5071
5307
|
onEvent(event);
|
|
5072
|
-
} catch (
|
|
5308
|
+
} catch (e16) {
|
|
5073
5309
|
}
|
|
5074
5310
|
}
|
|
5075
5311
|
}
|
|
@@ -5287,7 +5523,7 @@ function makeLifecycleClient(config = {}) {
|
|
|
5287
5523
|
priorityMiddleware = withPriority({
|
|
5288
5524
|
...priorityConfig2,
|
|
5289
5525
|
onEvent: (event) => {
|
|
5290
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5526
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([priorityMiddleware, 'optionalAccess', _126 => _126.queueDepth, 'call', _127 => _127()]), () => ( 0)));
|
|
5291
5527
|
tracker.emit(event.type, { priority: event.priority });
|
|
5292
5528
|
}
|
|
5293
5529
|
});
|
|
@@ -5350,9 +5586,9 @@ function makeLifecycleClient(config = {}) {
|
|
|
5350
5586
|
attempt: event.attempt,
|
|
5351
5587
|
delayMs: event.delayMs,
|
|
5352
5588
|
status: event.status,
|
|
5353
|
-
errorTag: _optionalChain([event, 'access',
|
|
5589
|
+
errorTag: _optionalChain([event, 'access', _128 => _128.error, 'optionalAccess', _129 => _129._tag])
|
|
5354
5590
|
});
|
|
5355
|
-
_optionalChain([retryConfig2, 'access',
|
|
5591
|
+
_optionalChain([retryConfig2, 'access', _130 => _130.onRetry, 'optionalCall', _131 => _131(event)]);
|
|
5356
5592
|
}
|
|
5357
5593
|
})(composedFn);
|
|
5358
5594
|
}
|
|
@@ -5384,13 +5620,13 @@ function makeLifecycleClient(config = {}) {
|
|
|
5384
5620
|
}
|
|
5385
5621
|
}
|
|
5386
5622
|
return buildLifecycleClient(composedFn, tracker, {
|
|
5387
|
-
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5388
|
-
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess',
|
|
5623
|
+
cacheInvalidate: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _132 => _132.invalidate]), () => ( noopInvalidate)),
|
|
5624
|
+
cacheClear: _nullishCoalesce(_optionalChain([cacheLayer, 'optionalAccess', _133 => _133.clear]), () => ( noopClear)),
|
|
5389
5625
|
cancelAll: () => cancelActiveRequests(activeCancelers, prewarmMgr),
|
|
5390
5626
|
shutdown: () => shutdownClient(activeCancelers, prewarmMgr, wireClient.shutdown),
|
|
5391
5627
|
activeCancelers,
|
|
5392
5628
|
adaptiveLimiter: wireClient.adaptiveLimiter,
|
|
5393
|
-
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess',
|
|
5629
|
+
queueDepth: _optionalChain([priorityMiddleware, 'optionalAccess', _134 => _134.queueDepth]),
|
|
5394
5630
|
prewarmManager: prewarmMgr,
|
|
5395
5631
|
afterResponse: hasPrewarm ? config.prewarm.afterResponse : void 0
|
|
5396
5632
|
});
|
|
@@ -5405,7 +5641,7 @@ function noopClear() {
|
|
|
5405
5641
|
function buildLifecycleClient(fn2, tracker, internals) {
|
|
5406
5642
|
const client = (req) => trackRequest(fn2, req, tracker, internals);
|
|
5407
5643
|
const stats = () => {
|
|
5408
|
-
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access',
|
|
5644
|
+
tracker.setQueueDepth(_nullishCoalesce(_optionalChain([internals, 'access', _135 => _135.queueDepth, 'optionalCall', _136 => _136()]), () => ( 0)));
|
|
5409
5645
|
return tracker.snapshot();
|
|
5410
5646
|
};
|
|
5411
5647
|
const withMw = (mw) => {
|
|
@@ -5435,7 +5671,7 @@ function cancelActiveRequests(activeCancelers, prewarmMgr) {
|
|
|
5435
5671
|
for (const cancel of Array.from(activeCancelers).reverse()) {
|
|
5436
5672
|
try {
|
|
5437
5673
|
cancel();
|
|
5438
|
-
} catch (
|
|
5674
|
+
} catch (e17) {
|
|
5439
5675
|
}
|
|
5440
5676
|
}
|
|
5441
5677
|
if (prewarmMgr) {
|
|
@@ -5445,14 +5681,14 @@ function cancelActiveRequests(activeCancelers, prewarmMgr) {
|
|
|
5445
5681
|
}
|
|
5446
5682
|
function shutdownClient(activeCancelers, prewarmMgr, wireShutdown) {
|
|
5447
5683
|
cancelActiveRequests(activeCancelers, prewarmMgr);
|
|
5448
|
-
_optionalChain([wireShutdown, 'optionalCall',
|
|
5684
|
+
_optionalChain([wireShutdown, 'optionalCall', _137 => _137()]);
|
|
5449
5685
|
return _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, void 0);
|
|
5450
5686
|
}
|
|
5451
5687
|
function trackRequest(fn2, req, tracker, internals) {
|
|
5452
5688
|
return {
|
|
5453
5689
|
_tag: "Async",
|
|
5454
5690
|
register: (env, cb) => {
|
|
5455
|
-
const previousSignal = _optionalChain([req, 'access',
|
|
5691
|
+
const previousSignal = _optionalChain([req, 'access', _138 => _138.init, 'optionalAccess', _139 => _139.signal]);
|
|
5456
5692
|
let done = false;
|
|
5457
5693
|
let abortedByPreviousSignal = false;
|
|
5458
5694
|
let abortedByLifecycle = false;
|
|
@@ -5461,7 +5697,7 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5461
5697
|
if (done) return;
|
|
5462
5698
|
done = true;
|
|
5463
5699
|
const exit = (abortedByPreviousSignal || abortedByLifecycle) && exit0._tag === "Failure" && _chunkMVGUEJ5Zcjs.Cause.isInterruptedOnly(exit0.cause) ? { _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) } : exit0;
|
|
5464
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
5700
|
+
_optionalChain([previousSignal, 'optionalAccess', _140 => _140.removeEventListener, 'call', _141 => _141("abort", abortFromPrevious)]);
|
|
5465
5701
|
internals.activeCancelers.delete(cancelFromLifecycle);
|
|
5466
5702
|
if (exit._tag === "Success") {
|
|
5467
5703
|
tracker.requestCompleted();
|
|
@@ -5474,7 +5710,7 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5474
5710
|
});
|
|
5475
5711
|
}
|
|
5476
5712
|
}
|
|
5477
|
-
} catch (
|
|
5713
|
+
} catch (e18) {
|
|
5478
5714
|
}
|
|
5479
5715
|
}
|
|
5480
5716
|
} else {
|
|
@@ -5499,13 +5735,13 @@ function trackRequest(fn2, req, tracker, internals) {
|
|
|
5499
5735
|
abortedByPreviousSignal = true;
|
|
5500
5736
|
cancelActive();
|
|
5501
5737
|
};
|
|
5502
|
-
if (!_optionalChain([previousSignal, 'optionalAccess',
|
|
5503
|
-
_optionalChain([previousSignal, 'optionalAccess',
|
|
5738
|
+
if (!_optionalChain([previousSignal, 'optionalAccess', _142 => _142.aborted])) {
|
|
5739
|
+
_optionalChain([previousSignal, 'optionalAccess', _143 => _143.addEventListener, 'call', _144 => _144("abort", abortFromPrevious, { once: true })]);
|
|
5504
5740
|
}
|
|
5505
5741
|
internals.activeCancelers.add(cancelFromLifecycle);
|
|
5506
5742
|
tracker.requestStarted();
|
|
5507
5743
|
tracker.emit("request-start");
|
|
5508
|
-
if (_optionalChain([previousSignal, 'optionalAccess',
|
|
5744
|
+
if (_optionalChain([previousSignal, 'optionalAccess', _145 => _145.aborted])) {
|
|
5509
5745
|
abortFromPrevious();
|
|
5510
5746
|
return () => void 0;
|
|
5511
5747
|
}
|
|
@@ -5625,7 +5861,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5625
5861
|
const contentEncodingKey = Object.keys(res.headers).find(
|
|
5626
5862
|
(k) => k.toLowerCase() === "content-encoding"
|
|
5627
5863
|
);
|
|
5628
|
-
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access',
|
|
5864
|
+
const contentEncodingValue = contentEncodingKey ? _optionalChain([res, 'access', _146 => _146.headers, 'access', _147 => _147[contentEncodingKey], 'optionalAccess', _148 => _148.trim, 'call', _149 => _149()]) : void 0;
|
|
5629
5865
|
if (!contentEncodingValue || contentEncodingValue.toLowerCase() === "identity") {
|
|
5630
5866
|
stats.passthroughCount++;
|
|
5631
5867
|
return res;
|
|
@@ -5700,7 +5936,7 @@ function processResponse(res, decompressor, enabledEncodings, stats) {
|
|
|
5700
5936
|
};
|
|
5701
5937
|
}
|
|
5702
5938
|
function makeCompressionMiddleware(config) {
|
|
5703
|
-
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5939
|
+
const enabledEncodings = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _150 => _150.encodings]), () => ( [...SUPPORTED_ENCODINGS]));
|
|
5704
5940
|
const decompressor = createDecompressor();
|
|
5705
5941
|
const mutableStats = emptyStats2();
|
|
5706
5942
|
const middleware = (next) => {
|
|
@@ -5740,9 +5976,9 @@ function makeCompressionMiddleware(config) {
|
|
|
5740
5976
|
var makeResponseCompressionMiddleware = makeCompressionMiddleware;
|
|
5741
5977
|
var DEFAULT_REQUEST_COMPRESS_METHODS = ["POST", "PUT", "PATCH"];
|
|
5742
5978
|
function makeRequestCompressionMiddleware(config) {
|
|
5743
|
-
const encoding = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5744
|
-
const minBytes = Math.max(0, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5745
|
-
const methods = new Set((_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
5979
|
+
const encoding = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _151 => _151.encoding]), () => ( "gzip"));
|
|
5980
|
+
const minBytes = Math.max(0, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _152 => _152.minBytes]), () => ( 1024))));
|
|
5981
|
+
const methods = new Set((_nullishCoalesce(_optionalChain([config, 'optionalAccess', _153 => _153.methods]), () => ( DEFAULT_REQUEST_COMPRESS_METHODS))).map((m) => m.toUpperCase()));
|
|
5746
5982
|
const mutableStats = emptyRequestCompressionStats();
|
|
5747
5983
|
const middleware = (next) => {
|
|
5748
5984
|
return (req) => {
|
|
@@ -5786,7 +6022,7 @@ function compressRequest(req, encoding, minBytes, methods, stats) {
|
|
|
5786
6022
|
"Content-Length": String(compressed.byteLength)
|
|
5787
6023
|
})
|
|
5788
6024
|
};
|
|
5789
|
-
} catch (
|
|
6025
|
+
} catch (e19) {
|
|
5790
6026
|
stats.errorCount++;
|
|
5791
6027
|
return req;
|
|
5792
6028
|
}
|
|
@@ -5927,7 +6163,7 @@ function validatedJsonResponse(client, validator) {
|
|
|
5927
6163
|
function previewJson(value) {
|
|
5928
6164
|
try {
|
|
5929
6165
|
return JSON.stringify(value);
|
|
5930
|
-
} catch (
|
|
6166
|
+
} catch (e20) {
|
|
5931
6167
|
return "[unserializable]";
|
|
5932
6168
|
}
|
|
5933
6169
|
}
|
|
@@ -6034,12 +6270,12 @@ var PRESET_CONFIGS = {
|
|
|
6034
6270
|
function isDefaultCacheableResponse(req, res) {
|
|
6035
6271
|
if (!DEFAULT_CACHEABLE_METHODS.has(req.method)) return false;
|
|
6036
6272
|
if (res.status < 200 || res.status >= 400) return false;
|
|
6037
|
-
const cacheControl = _optionalChain([headerValue, 'call',
|
|
6273
|
+
const cacheControl = _optionalChain([headerValue, 'call', _154 => _154(res.headers, "cache-control"), 'optionalAccess', _155 => _155.toLowerCase, 'call', _156 => _156()]);
|
|
6038
6274
|
if (cacheControl) {
|
|
6039
6275
|
const directives = cacheControl.split(",").map((part) => part.trim());
|
|
6040
6276
|
if (directives.includes("no-store") || directives.includes("no-cache")) return false;
|
|
6041
6277
|
}
|
|
6042
|
-
if (_optionalChain([headerValue, 'call',
|
|
6278
|
+
if (_optionalChain([headerValue, 'call', _157 => _157(res.headers, "pragma"), 'optionalAccess', _158 => _158.toLowerCase, 'call', _159 => _159()]) === "no-cache") return false;
|
|
6043
6279
|
if (headerValue(res.headers, "set-cookie") !== void 0) return false;
|
|
6044
6280
|
return true;
|
|
6045
6281
|
}
|
|
@@ -6075,12 +6311,12 @@ function makeDefaultHttpClient(config = {}) {
|
|
|
6075
6311
|
return buildDefaultClient(wire, {
|
|
6076
6312
|
preset,
|
|
6077
6313
|
features,
|
|
6078
|
-
compressionStats: _optionalChain([compressionResult, 'optionalAccess',
|
|
6314
|
+
compressionStats: _optionalChain([compressionResult, 'optionalAccess', _160 => _160.stats]),
|
|
6079
6315
|
useInlineDecode
|
|
6080
6316
|
});
|
|
6081
6317
|
}
|
|
6082
6318
|
function buildDefaultClient(wire, meta) {
|
|
6083
|
-
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) =>
|
|
6319
|
+
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunkJKHBEWQAcjs.toPromise.call(void 0, e, env))(eff);
|
|
6084
6320
|
const requestRaw = (req) => wire(req);
|
|
6085
6321
|
const request = (req) => withPromise(requestRaw(req));
|
|
6086
6322
|
const get = (url, init) => request(buildHttpRequest("GET", url, init));
|
|
@@ -6097,24 +6333,24 @@ function buildDefaultClient(wire, meta) {
|
|
|
6097
6333
|
);
|
|
6098
6334
|
if (meta.useInlineDecode) {
|
|
6099
6335
|
return withPromise(
|
|
6100
|
-
fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess',
|
|
6336
|
+
fusedWireAndDecode(requestRaw(req), _optionalChain([init, 'optionalAccess', _161 => _161.schema]), _optionalChain([init, 'optionalAccess', _162 => _162.schemaName]))
|
|
6101
6337
|
);
|
|
6102
6338
|
}
|
|
6103
6339
|
return withPromise(
|
|
6104
|
-
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
6340
|
+
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _163 => _163.schema]), _optionalChain([init, 'optionalAccess', _164 => _164.schemaName])))
|
|
6105
6341
|
);
|
|
6106
6342
|
});
|
|
6107
6343
|
const postJson = ((url, bodyObj, init) => {
|
|
6108
6344
|
return withPromise(
|
|
6109
6345
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
6110
|
-
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess',
|
|
6346
|
+
encodeJsonBodyEffect(bodyObj, _optionalChain([init, 'optionalAccess', _165 => _165.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _166 => _166.bodySchemaName]) }),
|
|
6111
6347
|
(bodyText) => {
|
|
6112
6348
|
const req = setHeaderIfMissing("content-type", "application/json")(
|
|
6113
6349
|
setHeaderIfMissing("accept", "application/json")(
|
|
6114
6350
|
buildHttpRequest("POST", url, init, bodyText)
|
|
6115
6351
|
)
|
|
6116
6352
|
);
|
|
6117
|
-
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess',
|
|
6353
|
+
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => decodeResponse(w, _optionalChain([init, 'optionalAccess', _167 => _167.schema]), _optionalChain([init, 'optionalAccess', _168 => _168.schemaName])));
|
|
6118
6354
|
}
|
|
6119
6355
|
)
|
|
6120
6356
|
);
|
|
@@ -6263,10 +6499,10 @@ function isLeanPreset(preset) {
|
|
|
6263
6499
|
}
|
|
6264
6500
|
|
|
6265
6501
|
// src/http/layer.ts
|
|
6266
|
-
var HttpClientService =
|
|
6502
|
+
var HttpClientService = _chunkZZ2CMYJLcjs.makeServiceTag.call(void 0, "HttpClient");
|
|
6267
6503
|
function makeDefaultHttpClientLayer(config = {}, options = {}) {
|
|
6268
6504
|
const tag = _nullishCoalesce(options.tag, () => ( HttpClientService));
|
|
6269
|
-
return
|
|
6505
|
+
return _chunkZZ2CMYJLcjs.layerEffect.call(void 0,
|
|
6270
6506
|
tag,
|
|
6271
6507
|
(context) => _chunkMVGUEJ5Zcjs.asyncSync.call(void 0,
|
|
6272
6508
|
() => makeDefaultHttpClient(resolveDefaultHttpClientLayerConfig(config, context))
|