brass-runtime 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -3
- package/dist/agent/cli/main.cjs +31 -32
- package/dist/agent/cli/main.js +3 -4
- package/dist/agent/cli/main.mjs +3 -4
- package/dist/agent/index.cjs +4 -5
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +3 -4
- package/dist/agent/index.mjs +3 -4
- package/dist/{chunk-GYM3LLGS.mjs → chunk-2QNREG6K.mjs} +188 -5
- package/dist/{chunk-4ROBZFL6.cjs → chunk-2SLT3X6G.cjs} +6 -8
- package/dist/{chunk-KZJQ723N.cjs → chunk-3PFZGP23.cjs} +13 -15
- package/dist/{chunk-VWIPB6I5.js → chunk-3PHU7FWS.js} +528 -23
- package/dist/{chunk-BKK77SBA.js → chunk-4YQHPIWJ.js} +32 -11
- package/dist/chunk-5XADBMSU.cjs +33 -0
- package/dist/{chunk-DNFJLJMW.mjs → chunk-6MLAZPBL.mjs} +48 -24
- package/dist/chunk-7TKI527D.cjs +123 -0
- package/dist/{chunk-AGR5B2BC.cjs → chunk-7TXQJFZX.cjs} +564 -12
- package/dist/{chunk-RKGKFN2A.js → chunk-AADFFVYS.js} +1 -1
- package/dist/{chunk-52PPNNI4.cjs → chunk-AJMKZXRB.cjs} +2 -2
- package/dist/{chunk-3AYM6WPJ.js → chunk-BG5RNEA2.js} +20 -299
- package/dist/{chunk-2HQTDLHF.mjs → chunk-ELLF55ER.mjs} +555 -3
- package/dist/{chunk-EOC4UHBS.mjs → chunk-G5JTCFMI.mjs} +2 -2
- package/dist/chunk-H5GYX7RZ.js +6126 -0
- package/dist/{chunk-C3MDXTRZ.js → chunk-HCJ4S3YB.js} +48 -24
- package/dist/{chunk-6IXXWIUM.js → chunk-IBRHSH5H.js} +555 -3
- package/dist/{chunk-Q2I37RP3.cjs → chunk-IFRBVMWJ.cjs} +44 -323
- package/dist/{chunk-52OB2ROS.js → chunk-ITG6I7ZS.js} +2 -4
- package/dist/chunk-ITZQ526U.mjs +33 -0
- package/dist/{chunk-7JIJOVCT.js → chunk-JH4GI3DW.js} +2 -4
- package/dist/{chunk-F6XWZQY4.cjs → chunk-KHACHFBQ.cjs} +583 -78
- package/dist/{chunk-4P2HHGAX.mjs → chunk-KRYP6CAE.mjs} +32 -11
- package/dist/chunk-KTGDLBLD.mjs +123 -0
- package/dist/{chunk-WBGRHGBP.cjs → chunk-LXBU5E77.cjs} +114 -93
- package/dist/{chunk-PD4EJTQC.cjs → chunk-N6QNSTWD.cjs} +5 -5
- package/dist/{chunk-6RY2FFN4.mjs → chunk-OI4ESUMC.mjs} +9 -11
- package/dist/{chunk-EJ6BPYVR.mjs → chunk-OT2TESZU.mjs} +1 -1
- package/dist/{chunk-7X3K5RMS.js → chunk-PSEU65ND.js} +9 -11
- package/dist/{chunk-SK7UZRNI.mjs → chunk-QCOLAHU3.mjs} +528 -23
- package/dist/{chunk-KH4SYAOS.mjs → chunk-QZ6QFJNM.mjs} +20 -299
- package/dist/{chunk-MBEJI5HF.mjs → chunk-R6WDSZA6.mjs} +2 -4
- package/dist/{chunk-FHQGHPMO.mjs → chunk-RREBJX2S.mjs} +2 -4
- package/dist/{chunk-5QC7LRZ3.js → chunk-S4HHFUYP.js} +2 -2
- package/dist/{chunk-GLE2WY7Z.cjs → chunk-SSQJKDN3.cjs} +194 -11
- package/dist/{chunk-CZIVE6NT.cjs → chunk-UUMKZJRJ.cjs} +48 -24
- package/dist/chunk-VIFA4DPN.cjs +6126 -0
- package/dist/chunk-W6WR37HN.js +33 -0
- package/dist/{chunk-FH2X7BVP.js → chunk-XSAHV5HQ.js} +188 -5
- package/dist/chunk-YM3EDNYD.js +123 -0
- package/dist/{chunk-7ZPEZ57L.cjs → chunk-YTX2JYYP.cjs} +18 -20
- package/dist/chunk-Z3PSSXP3.mjs +6126 -0
- package/dist/core/index.cjs +31 -9
- package/dist/core/index.d.ts +19 -152
- package/dist/core/index.js +80 -58
- package/dist/core/index.mjs +80 -58
- package/dist/defaultClient-DhpCQW9m.d.ts +1623 -0
- package/dist/{effect-DIUHZ9IN.d.ts → effect-CtUDl5M5.d.ts} +1 -1
- package/dist/http/index.cjs +202 -59
- package/dist/http/index.d.ts +55 -819
- package/dist/http/index.js +216 -73
- package/dist/http/index.mjs +216 -73
- package/dist/http/testing.cjs +31 -10
- package/dist/http/testing.d.ts +16 -5
- package/dist/http/testing.js +29 -8
- package/dist/http/testing.mjs +29 -8
- package/dist/index.cjs +110 -88
- package/dist/index.d.ts +9 -8
- package/dist/index.js +81 -59
- package/dist/index.mjs +81 -59
- package/dist/{schedule-CK3Ml_7p.d.ts → layer-BalPI6cN.d.ts} +176 -2
- package/dist/observability/index.cjs +20 -7
- package/dist/observability/index.d.ts +32 -8
- package/dist/observability/index.js +19 -6
- package/dist/observability/index.mjs +19 -6
- package/dist/perf/cli.cjs +26 -28
- package/dist/perf/cli.js +11 -13
- package/dist/perf/cli.mjs +11 -13
- package/dist/perf/index.cjs +13 -15
- package/dist/perf/index.js +11 -13
- package/dist/perf/index.mjs +11 -13
- package/dist/schema/index.cjs +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/index.mjs +1 -1
- package/dist/{server-D6JZ15_e.d.ts → server-C1zVmqE6.d.ts} +5 -5
- package/dist/{stream-B4oK9JFP.d.ts → stream-Bb4FTejt.d.ts} +1 -1
- package/dist/{tracer-Hwt1cl7h.d.ts → tracer-DzfuE6um.d.ts} +2 -2
- package/dist/{tracing-DqbTKGcf.d.ts → tracing-BABA5arE.d.ts} +1 -1
- package/docs/README.md +2 -0
- package/docs/ai/PUBLIC_API.md +28 -7
- package/docs/articles/brass-runtime-http-observability.md +467 -0
- package/docs/frameworks/angular.md +51 -0
- package/docs/frameworks/express.md +58 -0
- package/docs/frameworks/fastify.md +49 -0
- package/docs/frameworks/nestjs.md +53 -0
- package/docs/frameworks/nextjs.md +55 -0
- package/docs/frameworks/react.md +44 -0
- package/docs/frameworks/vanilla.md +56 -0
- package/docs/guides/layers.md +130 -0
- package/docs/http-recipes.md +31 -1
- package/docs/http.md +50 -1
- package/docs/observability.md +132 -0
- package/docs/performance-profiler.md +6 -2
- package/docs/recipes/layers.md +46 -2
- package/docs/recipes/testing.md +25 -0
- package/package.json +4 -1
- package/dist/chunk-3LOYJFRR.cjs +0 -300
- package/dist/chunk-3Y2RIUMM.js +0 -300
- package/dist/chunk-5EC274J5.cjs +0 -2874
- package/dist/chunk-5VRJNBLZ.mjs +0 -2874
- package/dist/chunk-62AZW6UT.cjs +0 -313
- package/dist/chunk-74ZTY6CP.js +0 -2871
- package/dist/chunk-7CMJS3QE.mjs +0 -2871
- package/dist/chunk-A2OM6NEH.mjs +0 -194
- package/dist/chunk-B33ICAKP.js +0 -313
- package/dist/chunk-JF5WGYJJ.cjs +0 -194
- package/dist/chunk-KN32XNTH.mjs +0 -313
- package/dist/chunk-KQLYONSE.cjs +0 -2871
- package/dist/chunk-L2SYFEBS.js +0 -194
- package/dist/chunk-MIIYDLGM.js +0 -2874
- package/dist/chunk-PWC3RBQE.mjs +0 -300
- package/dist/client-CZHU674n.d.ts +0 -820
|
@@ -1159,4 +1159,4 @@ declare function uninterruptibleMask<R, E, A>(body: (restore: RestoreInterruptib
|
|
|
1159
1159
|
declare function orElseOptional<R, E, A, R2, A2>(fa: ZIO<R, Option<E>, A>, that: () => ZIO<R2, Option<E>, A2>): ZIO<R & R2, Option<E>, A | A2>;
|
|
1160
1160
|
declare const end: <E>() => ZIO<unknown, Option<E>, never>;
|
|
1161
1161
|
|
|
1162
|
-
export { type FiberEngineKind as $, Async as A, type Baggage as B, type AsyncWithPromise as C, type RingLike as D, Exit as E, type FiberEngine as F, type CancelToken as G, type Canceler as H, Cause as I, type JSONValue as J, type CausePrettyOptions as K, type ContextNode as L, type CustomHostAction as M, type NodeId as N, type Option as O, type DbHostAction as P, type DecodeRef as Q, type RuntimeHooks as R, Scope as S, type TraceContext as T, DefaultHostExecutor as U, type EngineKind as V, type WasmEngineRuntime as W, type EngineSelection as X, type EngineSelectionMode as Y, type ZIO as Z, type FiberContext as _, type
|
|
1162
|
+
export { type FiberEngineKind as $, Async as A, type Baggage as B, type AsyncWithPromise as C, type RingLike as D, Exit as E, type FiberEngine as F, type CancelToken as G, type Canceler as H, Cause as I, type JSONValue as J, type CausePrettyOptions as K, type ContextNode as L, type CustomHostAction as M, type NodeId as N, type Option as O, type DbHostAction as P, type DecodeRef as Q, type RuntimeHooks as R, Scope as S, type TraceContext as T, DefaultHostExecutor as U, type EngineKind as V, type WasmEngineRuntime as W, type EngineSelection as X, type EngineSelectionMode as Y, type ZIO as Z, type FiberContext as _, type RuntimeOptions as a, emptyContext as a$, type FiberInfo as a0, type FiberReadyQueue as a1, type FiberReadyQueueOptions as a2, type FiberReadyQueueStats as a3, type FiberRunState as a4, type FlatMapRef as a5, type FoldFailureRef as a6, type FoldSuccessRef as a7, type HostAction as a8, type HostActionKind as a9, type SchedulerLaneMode as aA, type SchedulerOptions as aB, type SchedulerStats as aC, type SchedulerStatsData as aD, type ScopeId as aE, type ScopeInfo as aF, type Some as aG, type SyncRef as aH, type Task as aI, WasmFiberEngine as aJ, type WasmFiberEngineOptions as aK, abortablePromiseStats as aL, acquireRelease as aM, asyncEffect as aN, asyncCatchAll as aO, asyncFail as aP, asyncFlatMap as aQ, asyncFold as aR, asyncInterruptible as aS, asyncMap as aT, asyncMapError as aU, asyncSucceed as aV, asyncSync as aW, asyncTotal as aX, catchAll as aY, ctxExtend as aZ, ctxToObject as a_, type HostActionResult as aa, type HostExecutionContext as ab, type HostExecutor as ac, HostRegistry as ad, type HostRegistryStats as ae, type HttpHostAction as af, type Interrupted as ag, type InterruptibilityMode as ah, type Joiner as ai, type LaneStatsData as aj, type None as ak, NoopHooks as al, ProgramBuilder as am, type ProgramPatch as an, PushStatus as ao, type QueueHostAction as ap, type ReadyQueueScheduleKind as aq, type RestoreInterruptibility as ar, RingBuffer as as, type RingBufferEngine as at, type RingBufferStatsData as au, type RuntimeCapabilities as av, type RuntimeEngineMode as aw, type ScheduleResult as ax, Scheduler as ay, type SchedulerEngine as az, Runtime as b, end as b0, engineStats as b1, fail as b2, flatMap as b3, fork as b4, formatCause as b5, fromPromiseAbortable as b6, getBenchmarkBudget as b7, getCurrentFiber as b8, globalScheduler as b9, toPromise as bA, toPromiseByCaller as bB, uninterruptible as bC, uninterruptibleMask as bD, unit as bE, unsafeGetCurrentRuntime as bF, unsafeRunAsync as bG, unsafeRunFoldWithEnv as bH, withAsyncPromise as bI, withCurrentFiber as bJ, withScope as bK, withScopeAsync as bL, inferCallerLaneFromStack as ba, interruptible as bb, isCause as bc, laneTag as bd, linkAbortController as be, makeBoundedRingBuffer as bf, makeCancelToken as bg, makeFiberReadyQueue as bh, makeRuntimeEventRecord as bi, map as bj, mapAsync as bk, mapError as bl, mapTryAsync as bm, none as bn, orElseOptional as bo, prettyCause as bp, resetAbortablePromiseStats as bq, runtimeCapabilities as br, runtimeEventRecordContext as bs, runtimeForCaller as bt, sanitizeLaneKey as bu, selectedEngineStats as bv, setBenchmarkBudget as bw, some as bx, succeed as by, sync as bz, type RingBufferOptions as c, type RuntimeEvent as d, type RuntimeEmitContext as e, type RuntimeEventRecord as f, type RuntimeSpanLink as g, RuntimeRegistry as h, RuntimeFiber as i, type FiberEngineStats as j, type Fiber as k, type FiberId as l, type FiberStatus as m, type WasmBridge as n, type OpcodeProgram as o, type FiberId$1 as p, type EngineEvent as q, type RefId as r, type OpcodeNode as s, type EngineStats as t, type AbortablePromiseFinish as u, type AbortablePromiseLabelStats as v, type AbortablePromiseOptions as w, type AbortablePromiseOutcome as x, type AbortablePromiseStats as y, type AsyncRegisterRef as z };
|
package/dist/http/index.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }
|
|
2
2
|
|
|
3
|
+
var _chunk7TKI527Dcjs = require('../chunk-7TKI527D.cjs');
|
|
3
4
|
|
|
4
|
-
var _chunk62AZW6UTcjs = require('../chunk-62AZW6UT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _chunkLXBU5E77cjs = require('../chunk-LXBU5E77.cjs');
|
|
9
|
+
require('../chunk-AJMKZXRB.cjs');
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
|
|
@@ -37,7 +39,6 @@ var _chunk62AZW6UTcjs = require('../chunk-62AZW6UT.cjs');
|
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
|
|
40
|
-
var _chunkKQLYONSEcjs = require('../chunk-KQLYONSE.cjs');
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
|
|
@@ -75,24 +76,16 @@ var _chunkKQLYONSEcjs = require('../chunk-KQLYONSE.cjs');
|
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
|
|
78
|
-
var _chunk5EC274J5cjs = require('../chunk-5EC274J5.cjs');
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
var _chunkL6VB5N7Qcjs = require('../chunk-L6VB5N7Q.cjs');
|
|
82
|
-
require('../chunk-KZJQ723N.cjs');
|
|
83
|
-
require('../chunk-SA6HUJVI.cjs');
|
|
84
81
|
|
|
85
82
|
|
|
86
83
|
|
|
87
84
|
|
|
88
|
-
var _chunkAGR5B2BCcjs = require('../chunk-AGR5B2BC.cjs');
|
|
89
|
-
require('../chunk-JF5WGYJJ.cjs');
|
|
90
85
|
|
|
91
86
|
|
|
92
87
|
|
|
93
88
|
|
|
94
|
-
var _chunkWBGRHGBPcjs = require('../chunk-WBGRHGBP.cjs');
|
|
95
|
-
require('../chunk-52PPNNI4.cjs');
|
|
96
89
|
|
|
97
90
|
|
|
98
91
|
|
|
@@ -110,17 +103,23 @@ require('../chunk-52PPNNI4.cjs');
|
|
|
110
103
|
|
|
111
104
|
|
|
112
105
|
|
|
106
|
+
var _chunkVIFA4DPNcjs = require('../chunk-VIFA4DPN.cjs');
|
|
113
107
|
|
|
114
108
|
|
|
109
|
+
var _chunkL6VB5N7Qcjs = require('../chunk-L6VB5N7Q.cjs');
|
|
110
|
+
require('../chunk-3PFZGP23.cjs');
|
|
111
|
+
require('../chunk-SA6HUJVI.cjs');
|
|
115
112
|
|
|
116
113
|
|
|
117
114
|
|
|
118
|
-
var _chunk3LOYJFRRcjs = require('../chunk-3LOYJFRR.cjs');
|
|
119
115
|
|
|
120
116
|
|
|
117
|
+
var _chunk7TXQJFZXcjs = require('../chunk-7TXQJFZX.cjs');
|
|
121
118
|
|
|
122
119
|
|
|
123
|
-
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var _chunkSSQJKDN3cjs = require('../chunk-SSQJKDN3.cjs');
|
|
124
123
|
|
|
125
124
|
|
|
126
125
|
|
|
@@ -144,9 +143,142 @@ var _chunkMVGUEJ5Zcjs = require('../chunk-MVGUEJ5Z.cjs');
|
|
|
144
143
|
|
|
145
144
|
|
|
146
145
|
|
|
147
|
-
var
|
|
146
|
+
var _chunkUUMKZJRJcjs = require('../chunk-UUMKZJRJ.cjs');
|
|
148
147
|
require('../chunk-OBGZSXTJ.cjs');
|
|
149
148
|
|
|
149
|
+
// src/http/nodeTransport.ts
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
var _http = require('http');
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
var _https = require('https');
|
|
158
|
+
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
159
|
+
var toAgentOptions = (config) => ({
|
|
160
|
+
keepAlive: _nullishCoalesce(config.keepAlive, () => ( true)),
|
|
161
|
+
...config.maxSockets !== void 0 ? { maxSockets: config.maxSockets } : {},
|
|
162
|
+
...config.maxFreeSockets !== void 0 ? { maxFreeSockets: config.maxFreeSockets } : {}
|
|
163
|
+
});
|
|
164
|
+
var isError = (value) => value instanceof Error;
|
|
165
|
+
function unsupportedProtocol(url) {
|
|
166
|
+
return {
|
|
167
|
+
_tag: "BadUrl",
|
|
168
|
+
message: `Unsupported URL protocol for node HTTP transport: ${url.protocol}`
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function runNodeRequest(context, config, httpAgent, httpsAgent) {
|
|
172
|
+
return _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
173
|
+
const { request, url, signal } = context;
|
|
174
|
+
const isHttps = url.protocol === "https:";
|
|
175
|
+
const isHttp = url.protocol === "http:";
|
|
176
|
+
if (!isHttp && !isHttps) {
|
|
177
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(unsupportedProtocol(url)) });
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (signal.aborted) {
|
|
181
|
+
cb({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(_chunkVIFA4DPNcjs.abortErrorForSignal.call(void 0, signal)) });
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const started = nowMs();
|
|
185
|
+
const chunks = [];
|
|
186
|
+
let byteLength = 0;
|
|
187
|
+
let done = false;
|
|
188
|
+
let abort = () => void 0;
|
|
189
|
+
const finish = (exit) => {
|
|
190
|
+
if (done) return;
|
|
191
|
+
done = true;
|
|
192
|
+
signal.removeEventListener("abort", abort);
|
|
193
|
+
cb(exit);
|
|
194
|
+
};
|
|
195
|
+
const fail = (error) => {
|
|
196
|
+
finish({
|
|
197
|
+
_tag: "Failure",
|
|
198
|
+
cause: _chunkMVGUEJ5Zcjs.Cause.fail(_chunkVIFA4DPNcjs.normalizeHttpError.call(void 0, error, { signal }))
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
const options = {
|
|
202
|
+
method: request.method,
|
|
203
|
+
headers: _chunkVIFA4DPNcjs.Request.headers.get(request),
|
|
204
|
+
agent: isHttps ? httpsAgent : httpAgent,
|
|
205
|
+
signal
|
|
206
|
+
};
|
|
207
|
+
const nodeRequest = (isHttps ? _https.request : (0, _http.request))(url, options, (response) => {
|
|
208
|
+
response.on("data", (chunk) => {
|
|
209
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
210
|
+
chunks.push(buffer);
|
|
211
|
+
byteLength += buffer.length;
|
|
212
|
+
});
|
|
213
|
+
response.on("end", () => {
|
|
214
|
+
finish({
|
|
215
|
+
_tag: "Success",
|
|
216
|
+
value: {
|
|
217
|
+
status: _nullishCoalesce(response.statusCode, () => ( 0)),
|
|
218
|
+
statusText: _nullishCoalesce(response.statusMessage, () => ( "")),
|
|
219
|
+
headers: _chunkVIFA4DPNcjs.normalizeHttpHeaders.call(void 0, response.headers),
|
|
220
|
+
bodyText: Buffer.concat(chunks, byteLength).toString("utf8"),
|
|
221
|
+
ms: Math.round(nowMs() - started)
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
response.on("error", fail);
|
|
226
|
+
});
|
|
227
|
+
abort = () => {
|
|
228
|
+
nodeRequest.destroy(isError(signal.reason) ? signal.reason : void 0);
|
|
229
|
+
finish({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail(_chunkVIFA4DPNcjs.abortErrorForSignal.call(void 0, signal)) });
|
|
230
|
+
};
|
|
231
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
232
|
+
nodeRequest.on("error", fail);
|
|
233
|
+
if (config.socketTimeoutMs !== void 0 && config.socketTimeoutMs > 0) {
|
|
234
|
+
nodeRequest.setTimeout(config.socketTimeoutMs, () => {
|
|
235
|
+
nodeRequest.destroy(Object.assign(new Error("Node HTTP socket timed out"), {
|
|
236
|
+
code: "ETIMEDOUT"
|
|
237
|
+
}));
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (request.body !== void 0) {
|
|
241
|
+
nodeRequest.write(request.body);
|
|
242
|
+
}
|
|
243
|
+
nodeRequest.end();
|
|
244
|
+
return () => {
|
|
245
|
+
if (done) return;
|
|
246
|
+
nodeRequest.destroy(Object.assign(new Error("Node HTTP transport aborted"), {
|
|
247
|
+
name: "AbortError",
|
|
248
|
+
code: "ABORT_ERR"
|
|
249
|
+
}));
|
|
250
|
+
finish({ _tag: "Failure", cause: _chunkMVGUEJ5Zcjs.Cause.fail({ _tag: "Abort" }) });
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function makeNodeHttpTransport(config = {}) {
|
|
255
|
+
const agentOptions = toAgentOptions(config);
|
|
256
|
+
const httpAgent = _nullishCoalesce(config.httpAgent, () => ( new (0, _http.Agent)(agentOptions)));
|
|
257
|
+
const httpsAgent = _nullishCoalesce(config.httpsAgent, () => ( new (0, _https.Agent)(agentOptions)));
|
|
258
|
+
const ownsHttpAgent = config.httpAgent === void 0;
|
|
259
|
+
const ownsHttpsAgent = config.httpsAgent === void 0;
|
|
260
|
+
const transport = (context) => runNodeRequest(context, config, httpAgent, httpsAgent);
|
|
261
|
+
return Object.assign(transport, {
|
|
262
|
+
destroy: () => {
|
|
263
|
+
if (ownsHttpAgent) httpAgent.destroy();
|
|
264
|
+
if (ownsHttpsAgent) httpsAgent.destroy();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function makeNodeHttpProxyClient(config = {}) {
|
|
269
|
+
const {
|
|
270
|
+
preset = "highThroughputProxy",
|
|
271
|
+
transport,
|
|
272
|
+
nodeTransport,
|
|
273
|
+
...clientConfig
|
|
274
|
+
} = config;
|
|
275
|
+
return _chunkVIFA4DPNcjs.makeDefaultHttpClient.call(void 0, {
|
|
276
|
+
...clientConfig,
|
|
277
|
+
preset,
|
|
278
|
+
transport: _nullishCoalesce(transport, () => ( makeNodeHttpTransport(nodeTransport)))
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
150
282
|
// src/http/httpClient.ts
|
|
151
283
|
var resolveFinalUrl = (baseUrl, url) => {
|
|
152
284
|
try {
|
|
@@ -156,8 +288,8 @@ var resolveFinalUrl = (baseUrl, url) => {
|
|
|
156
288
|
}
|
|
157
289
|
};
|
|
158
290
|
var createHttpCore = (cfg = {}) => {
|
|
159
|
-
const wire =
|
|
160
|
-
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) =>
|
|
291
|
+
const wire = _chunkVIFA4DPNcjs.makeHttp.call(void 0, cfg);
|
|
292
|
+
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunkSSQJKDN3cjs.toPromise.call(void 0, e, env))(eff);
|
|
161
293
|
const requestRaw = (req) => wire(req);
|
|
162
294
|
const toResponse = (w, body) => ({
|
|
163
295
|
status: w.status,
|
|
@@ -166,7 +298,7 @@ var createHttpCore = (cfg = {}) => {
|
|
|
166
298
|
body
|
|
167
299
|
});
|
|
168
300
|
const decodeResponse = (w, validator, schemaName) => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
169
|
-
|
|
301
|
+
_chunkVIFA4DPNcjs.decodeJsonBodyEffect.call(void 0, w.bodyText, validator, { schemaName }),
|
|
170
302
|
(body) => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, toResponse(w, body))
|
|
171
303
|
);
|
|
172
304
|
return {
|
|
@@ -174,7 +306,7 @@ var createHttpCore = (cfg = {}) => {
|
|
|
174
306
|
wire,
|
|
175
307
|
withPromise,
|
|
176
308
|
requestRaw,
|
|
177
|
-
buildReq:
|
|
309
|
+
buildReq: _chunkVIFA4DPNcjs.buildHttpRequest,
|
|
178
310
|
toResponse,
|
|
179
311
|
decodeResponse
|
|
180
312
|
};
|
|
@@ -192,17 +324,17 @@ function httpClient(cfg = {}) {
|
|
|
192
324
|
};
|
|
193
325
|
const getJson = ((url, init) => {
|
|
194
326
|
const base = core.buildReq("GET", url, init);
|
|
195
|
-
const req =
|
|
327
|
+
const req = _chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "accept", "application/json")(base);
|
|
196
328
|
return core.withPromise(_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => core.decodeResponse(w, _optionalChain([init, 'optionalAccess', _ => _.schema]), _optionalChain([init, 'optionalAccess', _2 => _2.schemaName]))));
|
|
197
329
|
});
|
|
198
330
|
const postJson = ((url, bodyObj, init) => {
|
|
199
331
|
return core.withPromise(
|
|
200
332
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
201
|
-
|
|
333
|
+
_chunkVIFA4DPNcjs.encodeJsonBodyEffect.call(void 0, bodyObj, _optionalChain([init, 'optionalAccess', _3 => _3.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _4 => _4.bodySchemaName]) }),
|
|
202
334
|
(bodyText) => {
|
|
203
335
|
const base = core.buildReq("POST", url, init, bodyText);
|
|
204
|
-
const req =
|
|
205
|
-
|
|
336
|
+
const req = _chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "content-type", "application/json")(
|
|
337
|
+
_chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "accept", "application/json")(base)
|
|
206
338
|
);
|
|
207
339
|
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0, requestRaw(req), (w) => core.decodeResponse(w, _optionalChain([init, 'optionalAccess', _5 => _5.schema]), _optionalChain([init, 'optionalAccess', _6 => _6.schemaName])));
|
|
208
340
|
}
|
|
@@ -217,7 +349,7 @@ function httpClient(cfg = {}) {
|
|
|
217
349
|
getJson,
|
|
218
350
|
postJson,
|
|
219
351
|
with: (mw) => make(wire.with(mw)),
|
|
220
|
-
withRetry: (p) => make(wire.with(
|
|
352
|
+
withRetry: (p) => make(wire.with(_chunkVIFA4DPNcjs.withRetry.call(void 0, p))),
|
|
221
353
|
wire,
|
|
222
354
|
stats: () => wire.stats()
|
|
223
355
|
};
|
|
@@ -253,11 +385,11 @@ function httpClientWithMeta(cfg = {}) {
|
|
|
253
385
|
const startedAt = Date.now();
|
|
254
386
|
return core.withPromise(
|
|
255
387
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
256
|
-
|
|
388
|
+
_chunkVIFA4DPNcjs.encodeJsonBodyEffect.call(void 0, bodyObj, _optionalChain([init, 'optionalAccess', _7 => _7.bodySchema]), { schemaName: _optionalChain([init, 'optionalAccess', _8 => _8.bodySchemaName]) }),
|
|
257
389
|
(bodyText) => {
|
|
258
390
|
const base = core.buildReq("POST", url, init, bodyText);
|
|
259
|
-
const req =
|
|
260
|
-
|
|
391
|
+
const req = _chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "content-type", "application/json")(
|
|
392
|
+
_chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "accept", "application/json")(base)
|
|
261
393
|
);
|
|
262
394
|
return _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
263
395
|
core.requestRaw(req),
|
|
@@ -287,7 +419,7 @@ function httpClientWithMeta(cfg = {}) {
|
|
|
287
419
|
};
|
|
288
420
|
const getJson = (url, init) => {
|
|
289
421
|
const base = core.buildReq("GET", url, init);
|
|
290
|
-
const req =
|
|
422
|
+
const req = _chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "accept", "application/json")(base);
|
|
291
423
|
const startedAt = Date.now();
|
|
292
424
|
return core.withPromise(
|
|
293
425
|
_chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
@@ -319,13 +451,13 @@ function httpClientWithMeta(cfg = {}) {
|
|
|
319
451
|
};
|
|
320
452
|
}
|
|
321
453
|
function httpClientStream(cfg = {}) {
|
|
322
|
-
const wire =
|
|
454
|
+
const wire = _chunkVIFA4DPNcjs.makeHttpStream.call(void 0, cfg);
|
|
323
455
|
const make = (w) => {
|
|
324
|
-
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) =>
|
|
456
|
+
const withPromise = (eff) => _chunkMVGUEJ5Zcjs.withAsyncPromise.call(void 0, (e, env) => _chunkSSQJKDN3cjs.toPromise.call(void 0, e, env))(eff);
|
|
325
457
|
const request = (req) => withPromise(w(req));
|
|
326
458
|
const getStream = (url, init) => {
|
|
327
459
|
const base = { method: "GET", url, init };
|
|
328
|
-
const req =
|
|
460
|
+
const req = _chunkVIFA4DPNcjs.setHeaderIfMissing.call(void 0, "accept", "*/*")(base);
|
|
329
461
|
return request(req);
|
|
330
462
|
};
|
|
331
463
|
return {
|
|
@@ -333,7 +465,7 @@ function httpClientStream(cfg = {}) {
|
|
|
333
465
|
getStream,
|
|
334
466
|
get: getStream,
|
|
335
467
|
with: (mw) => make(mw(w)),
|
|
336
|
-
withRetry: (p) => make(
|
|
468
|
+
withRetry: (p) => make(_chunkVIFA4DPNcjs.withRetryStream.call(void 0, p)(w)),
|
|
337
469
|
wire: w,
|
|
338
470
|
stats: () => w.stats()
|
|
339
471
|
};
|
|
@@ -349,7 +481,7 @@ function withCircuitBreaker(config = {}) {
|
|
|
349
481
|
try {
|
|
350
482
|
const origin = new URL(url).origin;
|
|
351
483
|
if (!breakers.has(origin)) {
|
|
352
|
-
breakers.set(origin,
|
|
484
|
+
breakers.set(origin, _chunk7TKI527Dcjs.makeCircuitBreaker.call(void 0, {
|
|
353
485
|
...config,
|
|
354
486
|
onStateChange: (from, to) => {
|
|
355
487
|
_optionalChain([config, 'access', _13 => _13.onStateChange, 'optionalCall', _14 => _14(from, to)]);
|
|
@@ -360,7 +492,7 @@ function withCircuitBreaker(config = {}) {
|
|
|
360
492
|
return breakers.get(origin);
|
|
361
493
|
} catch (e3) {
|
|
362
494
|
if (!breakers.has("__global__")) {
|
|
363
|
-
breakers.set("__global__",
|
|
495
|
+
breakers.set("__global__", _chunk7TKI527Dcjs.makeCircuitBreaker.call(void 0, {
|
|
364
496
|
...config,
|
|
365
497
|
onStateChange: (from, to) => {
|
|
366
498
|
_optionalChain([config, 'access', _15 => _15.onStateChange, 'optionalCall', _16 => _16(from, to)]);
|
|
@@ -379,7 +511,7 @@ function withCircuitBreaker(config = {}) {
|
|
|
379
511
|
return protectLazy(breaker2, next, req, onOpen);
|
|
380
512
|
};
|
|
381
513
|
}
|
|
382
|
-
const breaker =
|
|
514
|
+
const breaker = _chunk7TKI527Dcjs.makeCircuitBreaker.call(void 0, {
|
|
383
515
|
...config,
|
|
384
516
|
onStateChange: (from, to) => {
|
|
385
517
|
_optionalChain([config, 'access', _19 => _19.onStateChange, 'optionalCall', _20 => _20(from, to)]);
|
|
@@ -431,7 +563,7 @@ function resolveAdaptiveLimiter(config, next) {
|
|
|
431
563
|
function resolveAdaptiveLimiterKey(config, limiter, req) {
|
|
432
564
|
if (!limiter) return void 0;
|
|
433
565
|
if (config.adaptiveLimiterKey) return config.adaptiveLimiterKey(req);
|
|
434
|
-
const poolKey =
|
|
566
|
+
const poolKey = _chunkVIFA4DPNcjs.getHttpRequestPolicy.call(void 0, req).poolKey;
|
|
435
567
|
if (poolKey) return poolKey;
|
|
436
568
|
if (limiter.keyResolver === "global") return "global";
|
|
437
569
|
try {
|
|
@@ -482,11 +614,11 @@ function withLogging(logger) {
|
|
|
482
614
|
logger({ phase: "request", req });
|
|
483
615
|
} catch (e5) {
|
|
484
616
|
}
|
|
485
|
-
const startedAt =
|
|
617
|
+
const startedAt = _chunkVIFA4DPNcjs.now.call(void 0, );
|
|
486
618
|
return _chunkMVGUEJ5Zcjs.asyncFold.call(void 0,
|
|
487
619
|
next(req),
|
|
488
620
|
(error) => {
|
|
489
|
-
const durationMs = Math.round(
|
|
621
|
+
const durationMs = Math.round(_chunkVIFA4DPNcjs.now.call(void 0, ) - startedAt);
|
|
490
622
|
try {
|
|
491
623
|
logger({ phase: "error", req, error, durationMs });
|
|
492
624
|
} catch (e6) {
|
|
@@ -494,7 +626,7 @@ function withLogging(logger) {
|
|
|
494
626
|
return _chunkMVGUEJ5Zcjs.asyncFail.call(void 0, error);
|
|
495
627
|
},
|
|
496
628
|
(res) => {
|
|
497
|
-
const durationMs = Math.round(
|
|
629
|
+
const durationMs = Math.round(_chunkVIFA4DPNcjs.now.call(void 0, ) - startedAt);
|
|
498
630
|
try {
|
|
499
631
|
logger({ phase: "response", req, res, durationMs });
|
|
500
632
|
} catch (e7) {
|
|
@@ -750,7 +882,7 @@ function prewarmConnections(config = {}) {
|
|
|
750
882
|
const fetchImpl = _nullishCoalesce(config.fetchImpl, () => ( globalThis.fetch));
|
|
751
883
|
const method = _nullishCoalesce(config.method, () => ( "HEAD"));
|
|
752
884
|
const targets = resolveTargets(config);
|
|
753
|
-
return
|
|
885
|
+
return _chunkSSQJKDN3cjs.fromPromiseAbortable.call(void 0,
|
|
754
886
|
async (signal) => {
|
|
755
887
|
if (typeof fetchImpl !== "function" || targets.length === 0) {
|
|
756
888
|
return { attempted: 0, warmed: 0, failed: 0, skipped: targets.length, attempts: [] };
|
|
@@ -941,6 +1073,7 @@ function makeBuilder(config) {
|
|
|
941
1073
|
transport: (transport) => replace({ transport }),
|
|
942
1074
|
preset: (preset) => replace({ preset }),
|
|
943
1075
|
minimal: () => replace({ preset: "minimal" }),
|
|
1076
|
+
proxy: () => replace({ preset: "proxy" }),
|
|
944
1077
|
balanced: () => replace({ preset: "balanced" }),
|
|
945
1078
|
defaultPreset: () => replace({ preset: "default" }),
|
|
946
1079
|
production: () => replace({ preset: "production" }),
|
|
@@ -957,10 +1090,10 @@ function makeBuilder(config) {
|
|
|
957
1090
|
prewarm: (layer = {}) => setLayer("prewarm", layer),
|
|
958
1091
|
noPrewarm: () => setLayer("prewarm", false),
|
|
959
1092
|
adaptiveLimiter: (layer = {}) => setLayer("adaptiveLimiter", layer),
|
|
960
|
-
adaptiveLimiterPreset: (preset, overrides = {}) => setLayer("adaptiveLimiter",
|
|
961
|
-
conservativeLimiter: (overrides = {}) => setLayer("adaptiveLimiter",
|
|
962
|
-
balancedLimiter: (overrides = {}) => setLayer("adaptiveLimiter",
|
|
963
|
-
aggressiveLimiter: (overrides = {}) => setLayer("adaptiveLimiter",
|
|
1093
|
+
adaptiveLimiterPreset: (preset, overrides = {}) => setLayer("adaptiveLimiter", _chunkVIFA4DPNcjs.makeAdaptiveLimiterConfig.call(void 0, preset, overrides)),
|
|
1094
|
+
conservativeLimiter: (overrides = {}) => setLayer("adaptiveLimiter", _chunkVIFA4DPNcjs.makeAdaptiveLimiterConfig.call(void 0, "conservative", overrides)),
|
|
1095
|
+
balancedLimiter: (overrides = {}) => setLayer("adaptiveLimiter", _chunkVIFA4DPNcjs.makeAdaptiveLimiterConfig.call(void 0, "balanced", overrides)),
|
|
1096
|
+
aggressiveLimiter: (overrides = {}) => setLayer("adaptiveLimiter", _chunkVIFA4DPNcjs.makeAdaptiveLimiterConfig.call(void 0, "aggressive", overrides)),
|
|
964
1097
|
noAdaptiveLimiter: () => setLayer("adaptiveLimiter", false),
|
|
965
1098
|
pool: (layer = {}) => setLayer("pool", layer),
|
|
966
1099
|
noPool: () => setLayer("pool", false),
|
|
@@ -969,8 +1102,8 @@ function makeBuilder(config) {
|
|
|
969
1102
|
middleware,
|
|
970
1103
|
use: middleware,
|
|
971
1104
|
configure: (next) => makeBuilder(mergeConfig(config, next)),
|
|
972
|
-
build: () =>
|
|
973
|
-
buildWire: () =>
|
|
1105
|
+
build: () => _chunkVIFA4DPNcjs.makeDefaultHttpClient.call(void 0, freezeConfig(config)),
|
|
1106
|
+
buildWire: () => _chunkVIFA4DPNcjs.makeDefaultHttpClient.call(void 0, freezeConfig(config)).wire
|
|
974
1107
|
});
|
|
975
1108
|
}
|
|
976
1109
|
function httpClientBuilder(config = {}) {
|
|
@@ -980,7 +1113,7 @@ var makeHttpClientBuilder = httpClientBuilder;
|
|
|
980
1113
|
var httpBuilder = httpClientBuilder;
|
|
981
1114
|
|
|
982
1115
|
// src/http/server.ts
|
|
983
|
-
|
|
1116
|
+
|
|
984
1117
|
var DEFAULT_MAX_BODY_BYTES = 1024 * 1024;
|
|
985
1118
|
function route(method, path, optionsOrHandler, maybeHandler) {
|
|
986
1119
|
const options = typeof optionsOrHandler === "function" ? {} : optionsOrHandler;
|
|
@@ -1038,7 +1171,7 @@ function makeRuntimeHealthRoute(options = {}) {
|
|
|
1038
1171
|
"GET",
|
|
1039
1172
|
path,
|
|
1040
1173
|
() => _chunkMVGUEJ5Zcjs.asyncFlatMap.call(void 0,
|
|
1041
|
-
|
|
1174
|
+
_chunkLXBU5E77cjs.makeRuntimeHealth.call(void 0, healthOptions),
|
|
1042
1175
|
(report) => _chunkMVGUEJ5Zcjs.asyncSucceed.call(void 0, healthReportToServerResponse(report))
|
|
1043
1176
|
)
|
|
1044
1177
|
);
|
|
@@ -1061,7 +1194,7 @@ function withResponseHeader(name, value) {
|
|
|
1061
1194
|
);
|
|
1062
1195
|
}
|
|
1063
1196
|
function healthReportToServerResponse(report) {
|
|
1064
|
-
return healthHttpResponseToServerResponse(
|
|
1197
|
+
return healthHttpResponseToServerResponse(_chunkLXBU5E77cjs.healthToHttpResponse.call(void 0, report));
|
|
1065
1198
|
}
|
|
1066
1199
|
function healthHttpResponseToServerResponse(response) {
|
|
1067
1200
|
return {
|
|
@@ -1124,7 +1257,7 @@ function makeNodeHttpServer(options) {
|
|
|
1124
1257
|
});
|
|
1125
1258
|
}
|
|
1126
1259
|
function nodeHttpServerResource(options) {
|
|
1127
|
-
return
|
|
1260
|
+
return _chunk7TXQJFZXcjs.resource.call(void 0,
|
|
1128
1261
|
makeNodeHttpServer(options),
|
|
1129
1262
|
(handle) => _chunkMVGUEJ5Zcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
1130
1263
|
handle.close().then(() => cb({ _tag: "Success", value: void 0 })).catch(() => cb({ _tag: "Success", value: void 0 }));
|
|
@@ -1203,7 +1336,7 @@ function prepareRouteContext(request, params, routeWithSchemas) {
|
|
|
1203
1336
|
body: request.bodyText,
|
|
1204
1337
|
phase: "request",
|
|
1205
1338
|
schema: _nullishCoalesce(routeWithSchemas.options.bodySchemaName, () => ( "body")),
|
|
1206
|
-
issues: [
|
|
1339
|
+
issues: [_chunkUUMKZJRJcjs.makeSchemaIssue.call(void 0, [], "valid JSON", request.bodyText, bodyInput.message)]
|
|
1207
1340
|
})
|
|
1208
1341
|
};
|
|
1209
1342
|
}
|
|
@@ -1227,12 +1360,12 @@ function prepareRouteContext(request, params, routeWithSchemas) {
|
|
|
1227
1360
|
function validateResponseBody(response, routeWithSchemas) {
|
|
1228
1361
|
const schema2 = routeWithSchemas.options.response;
|
|
1229
1362
|
if (!schema2) return { success: true };
|
|
1230
|
-
const result =
|
|
1363
|
+
const result = _chunkUUMKZJRJcjs.validateValue.call(void 0, response.body, schema2);
|
|
1231
1364
|
if (result.success) return { success: true };
|
|
1232
1365
|
return {
|
|
1233
1366
|
success: false,
|
|
1234
1367
|
error: makeValidationError({
|
|
1235
|
-
message: `HTTP response failed validation: ${
|
|
1368
|
+
message: `HTTP response failed validation: ${_chunkUUMKZJRJcjs.formatIssues.call(void 0, result.issues)}`,
|
|
1236
1369
|
body: previewJson(response.body),
|
|
1237
1370
|
phase: "response",
|
|
1238
1371
|
schema: _nullishCoalesce(routeWithSchemas.options.responseSchemaName, () => ( "response")),
|
|
@@ -1242,12 +1375,12 @@ function validateResponseBody(response, routeWithSchemas) {
|
|
|
1242
1375
|
}
|
|
1243
1376
|
function validatePart(input, schema2, options) {
|
|
1244
1377
|
if (!schema2) return { success: true, data: input };
|
|
1245
|
-
const result =
|
|
1378
|
+
const result = _chunkUUMKZJRJcjs.validateValue.call(void 0, input, schema2);
|
|
1246
1379
|
if (result.success) return { success: true, data: result.data };
|
|
1247
1380
|
return {
|
|
1248
1381
|
success: false,
|
|
1249
1382
|
error: makeValidationError({
|
|
1250
|
-
message: `HTTP ${options.schemaName} failed validation: ${
|
|
1383
|
+
message: `HTTP ${options.schemaName} failed validation: ${_chunkUUMKZJRJcjs.formatIssues.call(void 0, result.issues)}`,
|
|
1251
1384
|
body: options.body,
|
|
1252
1385
|
phase: options.phase,
|
|
1253
1386
|
schema: options.schemaName,
|
|
@@ -1305,7 +1438,7 @@ async function handleNodeRequest(req, res, router, options) {
|
|
|
1305
1438
|
target: serverRequest.target,
|
|
1306
1439
|
headers: serverRequest.headers
|
|
1307
1440
|
};
|
|
1308
|
-
const response = options.observability ? (await
|
|
1441
|
+
const response = options.observability ? (await _chunkLXBU5E77cjs.runObservedHttpServerEffect.call(void 0,
|
|
1309
1442
|
options.observability,
|
|
1310
1443
|
observedInput,
|
|
1311
1444
|
effect,
|
|
@@ -1315,7 +1448,7 @@ async function handleNodeRequest(req, res, router, options) {
|
|
|
1315
1448
|
},
|
|
1316
1449
|
options.env,
|
|
1317
1450
|
options.runtimeOptions
|
|
1318
|
-
)).value : await (_nullishCoalesce(options.runtime, () => ( new (0,
|
|
1451
|
+
)).value : await (_nullishCoalesce(options.runtime, () => ( new (0, _chunkSSQJKDN3cjs.Runtime)({
|
|
1319
1452
|
env: _nullishCoalesce(options.env, () => ( {})),
|
|
1320
1453
|
..._nullishCoalesce(options.runtimeOptions, () => ( {}))
|
|
1321
1454
|
})))).toPromise(effect);
|
|
@@ -1401,7 +1534,7 @@ function closeNodeServer(server, options) {
|
|
|
1401
1534
|
return new Promise((resolve, reject) => {
|
|
1402
1535
|
const startedAt = Date.now();
|
|
1403
1536
|
const schedule = _nullishCoalesce(options.shutdownPollSchedule, () => ( defaultShutdownPollSchedule(_nullishCoalesce(options.gracefulShutdownMs, () => ( 5e3)))));
|
|
1404
|
-
const driver =
|
|
1537
|
+
const driver = _chunk7TXQJFZXcjs.makeScheduleDriver.call(void 0, schedule, { name: _nullishCoalesce(schedule.name, () => ( "http.server.shutdown")), startedAtMs: startedAt });
|
|
1405
1538
|
let finished = false;
|
|
1406
1539
|
const done = (error) => {
|
|
1407
1540
|
if (finished) return;
|
|
@@ -1435,7 +1568,7 @@ function closeNodeServer(server, options) {
|
|
|
1435
1568
|
}
|
|
1436
1569
|
function defaultShutdownPollSchedule(maxMs) {
|
|
1437
1570
|
const intervalMs = 25;
|
|
1438
|
-
return
|
|
1571
|
+
return _chunk7TXQJFZXcjs.take.call(void 0, _chunk7TXQJFZXcjs.fixed.call(void 0, intervalMs), Math.max(1, Math.ceil(Math.max(0, maxMs) / intervalMs)));
|
|
1439
1572
|
}
|
|
1440
1573
|
function matchRoute(routes, method, path) {
|
|
1441
1574
|
const requestedMethod = method.toUpperCase();
|
|
@@ -1504,7 +1637,12 @@ function normalizeRouteMethod(method) {
|
|
|
1504
1637
|
function normalizeRoutePath(path) {
|
|
1505
1638
|
if (!path || path === "*") return "/";
|
|
1506
1639
|
const withSlash = path.startsWith("/") ? path : `/${path}`;
|
|
1507
|
-
|
|
1640
|
+
if (withSlash.length <= 1) return withSlash;
|
|
1641
|
+
let end = withSlash.length;
|
|
1642
|
+
while (end > 0 && withSlash.charCodeAt(end - 1) === 47) {
|
|
1643
|
+
end -= 1;
|
|
1644
|
+
}
|
|
1645
|
+
return withSlash.slice(0, end);
|
|
1508
1646
|
}
|
|
1509
1647
|
function parseRequestUrl(target, host) {
|
|
1510
1648
|
try {
|
|
@@ -1696,4 +1834,9 @@ function escapeRegExp(value) {
|
|
|
1696
1834
|
|
|
1697
1835
|
|
|
1698
1836
|
|
|
1699
|
-
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
exports.AdaptiveLimiter = _chunkVIFA4DPNcjs.AdaptiveLimiter; exports.ConfigValidationError = _chunkUUMKZJRJcjs.ConfigValidationError; exports.DEFAULT_CACHE_RELEVANT_HEADERS = _chunkVIFA4DPNcjs.DEFAULT_CACHE_RELEVANT_HEADERS; exports.EmaComputer = _chunkVIFA4DPNcjs.EmaComputer; exports.HttpClientService = _chunkVIFA4DPNcjs.HttpClientService; exports.HttpConcurrencyPool = _chunkVIFA4DPNcjs.HttpConcurrencyPool; exports.HttpServer = HttpServer; exports.LRUCache = _chunkVIFA4DPNcjs.LRUCache; exports.LatencyWindow = _chunkVIFA4DPNcjs.LatencyWindow; exports.LifecycleStatsTracker = _chunkVIFA4DPNcjs.LifecycleStatsTracker; exports.PriorityQueue = _chunkVIFA4DPNcjs.PriorityQueue; exports.SEPARATOR = _chunkVIFA4DPNcjs.SEPARATOR; exports.SUPPORTED_ENCODINGS = _chunkVIFA4DPNcjs.SUPPORTED_ENCODINGS; exports.Schema = _chunkUUMKZJRJcjs.Schema; exports.SchemaValidationException = _chunkUUMKZJRJcjs.SchemaValidationException; exports.abortErrorForSignal = _chunkVIFA4DPNcjs.abortErrorForSignal; exports.adaptiveLimiterPresets = _chunkVIFA4DPNcjs.adaptiveLimiterPresets; exports.backoffDelayMs = _chunkVIFA4DPNcjs.backoffDelayMs; exports.clampPriority = _chunkVIFA4DPNcjs.clampPriority; exports.computeCacheKey = _chunkVIFA4DPNcjs.computeCacheKey; exports.computeGradient = _chunkVIFA4DPNcjs.computeGradient; exports.computeNewLimit = _chunkVIFA4DPNcjs.computeNewLimit; exports.decodeJsonBody = _chunkVIFA4DPNcjs.decodeJsonBody; exports.decodeJsonBodyEffect = _chunkVIFA4DPNcjs.decodeJsonBodyEffect; exports.decorate = _chunkVIFA4DPNcjs.decorate; exports.defaultHttpClientPreset = _chunkVIFA4DPNcjs.defaultHttpClientPreset; exports.defaultRetryOnError = _chunkVIFA4DPNcjs.defaultRetryOnError; exports.defaultRetryOnStatus = _chunkVIFA4DPNcjs.defaultRetryOnStatus; exports.defaultRetryableMethods = _chunkVIFA4DPNcjs.defaultRetryableMethods; exports.defineHttpPolicyPresets = _chunkVIFA4DPNcjs.defineHttpPolicyPresets; exports.detectPlatform = _chunkVIFA4DPNcjs.detectPlatform; exports.empty = empty; exports.encodeJsonBodyEffect = _chunkVIFA4DPNcjs.encodeJsonBodyEffect; exports.executeProbe = _chunkVIFA4DPNcjs.executeProbe; exports.formatConfigError = _chunkUUMKZJRJcjs.formatConfigError; exports.formatHttpError = _chunkVIFA4DPNcjs.formatHttpError; exports.formatIssues = _chunkUUMKZJRJcjs.formatIssues; exports.getHttpRequestPolicy = _chunkVIFA4DPNcjs.getHttpRequestPolicy; exports.headersOf = _chunkVIFA4DPNcjs.headersOf; exports.httpBuilder = httpBuilder; exports.httpClient = httpClient; exports.httpClientBuilder = httpClientBuilder; exports.httpClientStream = httpClientStream; exports.httpClientWithMeta = httpClientWithMeta; exports.httpErrorStatus = _chunkVIFA4DPNcjs.httpErrorStatus; exports.httpPolicy = _chunkVIFA4DPNcjs.httpPolicy; exports.httpRoute = httpRoute; exports.isAbortError = _chunkVIFA4DPNcjs.isAbortError; exports.isAbortHttpError = _chunkVIFA4DPNcjs.isAbortHttpError; exports.isCircuitBreakerOpen = _chunkVIFA4DPNcjs.isCircuitBreakerOpen; exports.isConfigValidationError = _chunkUUMKZJRJcjs.isConfigValidationError; exports.isExternalAbortError = _chunkVIFA4DPNcjs.isExternalAbortError; exports.isExternalTimeoutError = _chunkVIFA4DPNcjs.isExternalTimeoutError; exports.isFetchHttpError = _chunkVIFA4DPNcjs.isFetchHttpError; exports.isHttpError = _chunkVIFA4DPNcjs.isHttpError; exports.isKnownHttpError = _chunkVIFA4DPNcjs.isKnownHttpError; exports.isRetryableHttpError = _chunkVIFA4DPNcjs.isRetryableHttpError; exports.isRetryableHttpStatus = _chunkVIFA4DPNcjs.isRetryableHttpStatus; exports.isSchema = _chunkUUMKZJRJcjs.isSchema; exports.isTaggedHttpError = _chunkVIFA4DPNcjs.isTaggedHttpError; exports.isTimeoutHttpError = _chunkVIFA4DPNcjs.isTimeoutHttpError; exports.isValidationError = _chunkVIFA4DPNcjs.isValidationError; exports.json = json; exports.linkAbortSignals = _chunkVIFA4DPNcjs.linkAbortSignals; exports.makeAdaptiveLimiterConfig = _chunkVIFA4DPNcjs.makeAdaptiveLimiterConfig; exports.makeBudgetSemaphore = _chunkVIFA4DPNcjs.makeBudgetSemaphore; exports.makeCompressionMiddleware = _chunkVIFA4DPNcjs.makeCompressionMiddleware; exports.makeConnectionStateMap = _chunkVIFA4DPNcjs.makeConnectionStateMap; exports.makeDefaultHttpClient = _chunkVIFA4DPNcjs.makeDefaultHttpClient; exports.makeDefaultHttpClientLayer = _chunkVIFA4DPNcjs.makeDefaultHttpClientLayer; exports.makeFetchStreamTransport = _chunkVIFA4DPNcjs.makeFetchStreamTransport; exports.makeFetchTransport = _chunkVIFA4DPNcjs.makeFetchTransport; exports.makeHttp = _chunkVIFA4DPNcjs.makeHttp; exports.makeHttpClient = _chunkVIFA4DPNcjs.makeHttpClient; exports.makeHttpClientBuilder = makeHttpClientBuilder; exports.makeHttpRouter = makeHttpRouter; exports.makeHttpServerResource = makeHttpServerResource; exports.makeHttpStream = _chunkVIFA4DPNcjs.makeHttpStream; exports.makeJsonParseValidationError = _chunkVIFA4DPNcjs.makeJsonParseValidationError; exports.makeLifecycleClient = _chunkVIFA4DPNcjs.makeLifecycleClient; exports.makeNodeHttpProxyClient = makeNodeHttpProxyClient; exports.makeNodeHttpServer = makeNodeHttpServer; exports.makeNodeHttpServerResource = makeNodeHttpServerResource; exports.makeNodeHttpTransport = makeNodeHttpTransport; exports.makePrewarmManager = _chunkVIFA4DPNcjs.makePrewarmManager; exports.makePromiseHttpTransport = _chunkVIFA4DPNcjs.makePromiseHttpTransport; exports.makeRequestCompressionMiddleware = _chunkVIFA4DPNcjs.makeRequestCompressionMiddleware; exports.makeResponseCompressionMiddleware = _chunkVIFA4DPNcjs.makeResponseCompressionMiddleware; exports.makeRuntimeHealthRoute = makeRuntimeHealthRoute; exports.makeRuntimeReadinessRoute = makeRuntimeReadinessRoute; exports.makeSchemaIssue = _chunkUUMKZJRJcjs.makeSchemaIssue; exports.matchHttpError = _chunkVIFA4DPNcjs.matchHttpError; exports.nodeHttpServerResource = nodeHttpServerResource; exports.normalizeHeadersInit = _chunkVIFA4DPNcjs.normalizeHeadersInit; exports.normalizeHttpError = _chunkVIFA4DPNcjs.normalizeHttpError; exports.normalizeHttpHeaders = _chunkVIFA4DPNcjs.normalizeHttpHeaders; exports.normalizeRetryBudget = _chunkVIFA4DPNcjs.normalizeRetryBudget; exports.parseCacheKey = _chunkVIFA4DPNcjs.parseCacheKey; exports.parseConfig = _chunkUUMKZJRJcjs.parseConfig; exports.prewarmConnections = prewarmConnections; exports.prewarmHttpConnections = prewarmHttpConnections; exports.promiseHttpTransport = _chunkVIFA4DPNcjs.promiseHttpTransport; exports.resolveConfig = _chunkVIFA4DPNcjs.resolveConfig; exports.resolveHttpPoolKey = _chunkVIFA4DPNcjs.resolveHttpPoolKey; exports.resolveHttpRequestPolicyPresets = _chunkVIFA4DPNcjs.resolveHttpRequestPolicyPresets; exports.retryAfterMs = _chunkVIFA4DPNcjs.retryAfterMs; exports.route = route; exports.runtimeHealthRoute = runtimeHealthRoute; exports.runtimeReadinessRoute = runtimeReadinessRoute; exports.s = _chunkUUMKZJRJcjs.s; exports.schema = _chunkUUMKZJRJcjs.schema; exports.text = text; exports.toHttpError = _chunkVIFA4DPNcjs.toHttpError; exports.validateConfig = _chunkVIFA4DPNcjs.validateConfig; exports.validateFetchAvailable = _chunkVIFA4DPNcjs.validateFetchAvailable; exports.validateOrigin = _chunkVIFA4DPNcjs.validateOrigin; exports.validateValue = _chunkUUMKZJRJcjs.validateValue; exports.validatedJson = _chunkVIFA4DPNcjs.validatedJson; exports.validatedJsonResponse = _chunkVIFA4DPNcjs.validatedJsonResponse; exports.withAuth = withAuth; exports.withBatch = _chunkVIFA4DPNcjs.withBatch; exports.withCache = _chunkVIFA4DPNcjs.withCache; exports.withCircuitBreaker = withCircuitBreaker; exports.withConnectionPrewarming = withConnectionPrewarming; exports.withDedup = _chunkVIFA4DPNcjs.withDedup; exports.withHttpPolicyPresets = _chunkVIFA4DPNcjs.withHttpPolicyPresets; exports.withHttpRequestPolicy = _chunkVIFA4DPNcjs.withHttpRequestPolicy; exports.withLogging = withLogging; exports.withMiddleware = _chunkVIFA4DPNcjs.withMiddleware; exports.withPriority = _chunkVIFA4DPNcjs.withPriority; exports.withRequestBatching = withRequestBatching; exports.withResponseHeader = withResponseHeader; exports.withResponseTransform = withResponseTransform; exports.withRetry = _chunkVIFA4DPNcjs.withRetry; exports.withRetryStream = _chunkVIFA4DPNcjs.withRetryStream; exports.withTracing = withTracing;
|