brass-runtime 1.16.1 → 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 +40 -8
- 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-AVNQLJ5V.js → chunk-3PHU7FWS.js} +528 -23
- package/dist/{chunk-CIZFIMK5.js → chunk-4YQHPIWJ.js} +60 -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-76YMRMH2.cjs → chunk-KHACHFBQ.cjs} +583 -78
- package/dist/{chunk-MT3OWDPC.mjs → chunk-KRYP6CAE.mjs} +60 -11
- package/dist/chunk-KTGDLBLD.mjs +123 -0
- package/dist/{chunk-ENKODRU3.cjs → chunk-LXBU5E77.cjs} +143 -94
- package/dist/{chunk-PD4EJTQC.cjs → chunk-N6QNSTWD.cjs} +5 -5
- package/dist/{chunk-HLWLMW2F.mjs → chunk-OI4ESUMC.mjs} +9 -11
- package/dist/{chunk-EJ6BPYVR.mjs → chunk-OT2TESZU.mjs} +1 -1
- package/dist/{chunk-BABBZK4Y.js → chunk-PSEU65ND.js} +9 -11
- package/dist/{chunk-DNFO2EIZ.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-VN44DYYT.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 +22 -7
- package/dist/observability/index.d.ts +32 -8
- package/dist/observability/index.js +21 -6
- package/dist/observability/index.mjs +21 -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-GJPg8ZSG.d.ts → server-C1zVmqE6.d.ts} +16 -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 +4 -0
- package/docs/ai/PUBLIC_API.md +31 -7
- package/docs/articles/brass-runtime-http-observability.md +467 -0
- package/docs/framework-integrations.md +38 -0
- package/docs/frameworks/angular.md +204 -0
- package/docs/frameworks/express.md +183 -0
- package/docs/frameworks/fastify.md +173 -0
- package/docs/frameworks/nestjs.md +335 -0
- package/docs/frameworks/nextjs.md +202 -0
- package/docs/frameworks/react.md +183 -0
- package/docs/frameworks/vanilla.md +280 -0
- package/docs/guides/layers.md +130 -0
- package/docs/http-recipes.md +31 -1
- package/docs/http.md +50 -1
- package/docs/nestjs.md +6 -0
- package/docs/observability-framework-examples.md +12 -0
- package/docs/observability.md +239 -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
package/dist/http/index.js
CHANGED
|
@@ -1,126 +1,125 @@
|
|
|
1
1
|
import {
|
|
2
|
-
makeCircuitBreaker
|
|
3
|
-
|
|
4
|
-
} from "../chunk-B33ICAKP.js";
|
|
2
|
+
makeCircuitBreaker
|
|
3
|
+
} from "../chunk-YM3EDNYD.js";
|
|
5
4
|
import {
|
|
5
|
+
healthToHttpResponse,
|
|
6
|
+
makeRuntimeHealth,
|
|
7
|
+
runObservedHttpServerEffect
|
|
8
|
+
} from "../chunk-4YQHPIWJ.js";
|
|
9
|
+
import "../chunk-AADFFVYS.js";
|
|
10
|
+
import {
|
|
11
|
+
AdaptiveLimiter,
|
|
6
12
|
DEFAULT_CACHE_RELEVANT_HEADERS,
|
|
13
|
+
EmaComputer,
|
|
14
|
+
HttpClientService,
|
|
15
|
+
HttpConcurrencyPool,
|
|
7
16
|
LRUCache,
|
|
17
|
+
LatencyWindow,
|
|
8
18
|
LifecycleStatsTracker,
|
|
9
19
|
PriorityQueue,
|
|
20
|
+
Request,
|
|
10
21
|
SEPARATOR,
|
|
11
22
|
SUPPORTED_ENCODINGS,
|
|
12
|
-
buildHttpRequest,
|
|
13
|
-
clampPriority,
|
|
14
|
-
computeCacheKey,
|
|
15
|
-
decodeJsonBody,
|
|
16
|
-
decodeJsonBodyEffect,
|
|
17
|
-
defaultHttpClientPreset,
|
|
18
|
-
detectPlatform,
|
|
19
|
-
encodeJsonBodyEffect,
|
|
20
|
-
executeProbe,
|
|
21
|
-
makeBudgetSemaphore,
|
|
22
|
-
makeCompressionMiddleware,
|
|
23
|
-
makeConnectionStateMap,
|
|
24
|
-
makeDefaultHttpClient,
|
|
25
|
-
makeHttpClient,
|
|
26
|
-
makeLifecycleClient,
|
|
27
|
-
makePrewarmManager,
|
|
28
|
-
makeRequestCompressionMiddleware,
|
|
29
|
-
makeResponseCompressionMiddleware,
|
|
30
|
-
now,
|
|
31
|
-
parseCacheKey,
|
|
32
|
-
validateFetchAvailable,
|
|
33
|
-
validateOrigin,
|
|
34
|
-
validatedJson,
|
|
35
|
-
validatedJsonResponse,
|
|
36
|
-
withBatch,
|
|
37
|
-
withCache,
|
|
38
|
-
withDedup,
|
|
39
|
-
withPriority
|
|
40
|
-
} from "../chunk-74ZTY6CP.js";
|
|
41
|
-
import {
|
|
42
|
-
AdaptiveLimiter,
|
|
43
|
-
EmaComputer,
|
|
44
|
-
HttpConcurrencyPool,
|
|
45
|
-
LatencyWindow,
|
|
46
23
|
abortErrorForSignal,
|
|
47
24
|
adaptiveLimiterPresets,
|
|
48
25
|
backoffDelayMs,
|
|
26
|
+
buildHttpRequest,
|
|
27
|
+
clampPriority,
|
|
28
|
+
computeCacheKey,
|
|
49
29
|
computeGradient,
|
|
50
30
|
computeNewLimit,
|
|
31
|
+
decodeJsonBody,
|
|
32
|
+
decodeJsonBodyEffect,
|
|
51
33
|
decorate,
|
|
34
|
+
defaultHttpClientPreset,
|
|
52
35
|
defaultRetryOnError,
|
|
53
36
|
defaultRetryOnStatus,
|
|
54
37
|
defaultRetryableMethods,
|
|
38
|
+
defineHttpPolicyPresets,
|
|
39
|
+
detectPlatform,
|
|
40
|
+
encodeJsonBodyEffect,
|
|
41
|
+
executeProbe,
|
|
42
|
+
formatHttpError,
|
|
43
|
+
getHttpRequestPolicy,
|
|
55
44
|
headersOf,
|
|
45
|
+
httpErrorStatus,
|
|
46
|
+
httpPolicy,
|
|
56
47
|
isAbortError,
|
|
48
|
+
isAbortHttpError,
|
|
49
|
+
isCircuitBreakerOpen,
|
|
50
|
+
isExternalAbortError,
|
|
51
|
+
isExternalTimeoutError,
|
|
52
|
+
isFetchHttpError,
|
|
53
|
+
isHttpError,
|
|
54
|
+
isKnownHttpError,
|
|
55
|
+
isRetryableHttpError,
|
|
56
|
+
isRetryableHttpStatus,
|
|
57
57
|
isTaggedHttpError,
|
|
58
|
+
isTimeoutHttpError,
|
|
59
|
+
isValidationError,
|
|
58
60
|
linkAbortSignals,
|
|
59
61
|
makeAdaptiveLimiterConfig,
|
|
62
|
+
makeBudgetSemaphore,
|
|
63
|
+
makeCompressionMiddleware,
|
|
64
|
+
makeConnectionStateMap,
|
|
65
|
+
makeDefaultHttpClient,
|
|
66
|
+
makeDefaultHttpClientLayer,
|
|
60
67
|
makeFetchStreamTransport,
|
|
61
68
|
makeFetchTransport,
|
|
62
69
|
makeHttp,
|
|
70
|
+
makeHttpClient,
|
|
63
71
|
makeHttpStream,
|
|
72
|
+
makeJsonParseValidationError,
|
|
73
|
+
makeLifecycleClient,
|
|
74
|
+
makePrewarmManager,
|
|
64
75
|
makePromiseHttpTransport,
|
|
76
|
+
makeRequestCompressionMiddleware,
|
|
77
|
+
makeResponseCompressionMiddleware,
|
|
78
|
+
matchHttpError,
|
|
65
79
|
normalizeHeadersInit,
|
|
66
80
|
normalizeHttpError,
|
|
67
81
|
normalizeHttpHeaders,
|
|
68
82
|
normalizeRetryBudget,
|
|
83
|
+
now,
|
|
84
|
+
parseCacheKey,
|
|
69
85
|
promiseHttpTransport,
|
|
70
86
|
resolveConfig,
|
|
71
87
|
resolveHttpPoolKey,
|
|
88
|
+
resolveHttpRequestPolicyPresets,
|
|
72
89
|
retryAfterMs,
|
|
73
90
|
setHeaderIfMissing,
|
|
91
|
+
toHttpError,
|
|
74
92
|
validateConfig,
|
|
93
|
+
validateFetchAvailable,
|
|
94
|
+
validateOrigin,
|
|
95
|
+
validatedJson,
|
|
96
|
+
validatedJsonResponse,
|
|
97
|
+
withBatch,
|
|
98
|
+
withCache,
|
|
99
|
+
withDedup,
|
|
100
|
+
withHttpPolicyPresets,
|
|
101
|
+
withHttpRequestPolicy,
|
|
75
102
|
withMiddleware,
|
|
103
|
+
withPriority,
|
|
76
104
|
withRetry,
|
|
77
105
|
withRetryStream
|
|
78
|
-
} from "../chunk-
|
|
106
|
+
} from "../chunk-H5GYX7RZ.js";
|
|
79
107
|
import {
|
|
80
108
|
registerHttpEffect
|
|
81
109
|
} from "../chunk-TRM4JUZQ.js";
|
|
82
|
-
import "../chunk-
|
|
110
|
+
import "../chunk-JH4GI3DW.js";
|
|
83
111
|
import "../chunk-UCUBNWM2.js";
|
|
84
112
|
import {
|
|
85
113
|
fixed,
|
|
86
114
|
makeScheduleDriver,
|
|
115
|
+
resource,
|
|
87
116
|
take
|
|
88
|
-
} from "../chunk-
|
|
89
|
-
import "../chunk-L2SYFEBS.js";
|
|
90
|
-
import {
|
|
91
|
-
healthToHttpResponse,
|
|
92
|
-
makeRuntimeHealth,
|
|
93
|
-
runObservedHttpServerEffect
|
|
94
|
-
} from "../chunk-CIZFIMK5.js";
|
|
95
|
-
import "../chunk-RKGKFN2A.js";
|
|
96
|
-
import {
|
|
97
|
-
defineHttpPolicyPresets,
|
|
98
|
-
formatHttpError,
|
|
99
|
-
getHttpRequestPolicy,
|
|
100
|
-
httpErrorStatus,
|
|
101
|
-
httpPolicy,
|
|
102
|
-
isAbortHttpError,
|
|
103
|
-
isCircuitBreakerOpen,
|
|
104
|
-
isExternalAbortError,
|
|
105
|
-
isExternalTimeoutError,
|
|
106
|
-
isFetchHttpError,
|
|
107
|
-
isHttpError,
|
|
108
|
-
isKnownHttpError,
|
|
109
|
-
isRetryableHttpError,
|
|
110
|
-
isRetryableHttpStatus,
|
|
111
|
-
isTimeoutHttpError,
|
|
112
|
-
isValidationError,
|
|
113
|
-
matchHttpError,
|
|
114
|
-
resolveHttpRequestPolicyPresets,
|
|
115
|
-
toHttpError,
|
|
116
|
-
withHttpPolicyPresets,
|
|
117
|
-
withHttpRequestPolicy
|
|
118
|
-
} from "../chunk-3Y2RIUMM.js";
|
|
117
|
+
} from "../chunk-IBRHSH5H.js";
|
|
119
118
|
import {
|
|
120
119
|
Runtime,
|
|
121
120
|
fromPromiseAbortable,
|
|
122
121
|
toPromise
|
|
123
|
-
} from "../chunk-
|
|
122
|
+
} from "../chunk-XSAHV5HQ.js";
|
|
124
123
|
import {
|
|
125
124
|
Cause,
|
|
126
125
|
asyncEffect,
|
|
@@ -144,9 +143,142 @@ import {
|
|
|
144
143
|
s,
|
|
145
144
|
schema,
|
|
146
145
|
validateValue
|
|
147
|
-
} from "../chunk-
|
|
146
|
+
} from "../chunk-HCJ4S3YB.js";
|
|
148
147
|
import "../chunk-3RG5ZIWI.js";
|
|
149
148
|
|
|
149
|
+
// src/http/nodeTransport.ts
|
|
150
|
+
import {
|
|
151
|
+
Agent as HttpAgent,
|
|
152
|
+
request as httpRequest
|
|
153
|
+
} from "http";
|
|
154
|
+
import {
|
|
155
|
+
Agent as HttpsAgent,
|
|
156
|
+
request as httpsRequest
|
|
157
|
+
} from "https";
|
|
158
|
+
var nowMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
159
|
+
var toAgentOptions = (config) => ({
|
|
160
|
+
keepAlive: 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 asyncEffect((_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: Cause.fail(unsupportedProtocol(url)) });
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (signal.aborted) {
|
|
181
|
+
cb({ _tag: "Failure", cause: Cause.fail(abortErrorForSignal(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: Cause.fail(normalizeHttpError(error, { signal }))
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
const options = {
|
|
202
|
+
method: request.method,
|
|
203
|
+
headers: Request.headers.get(request),
|
|
204
|
+
agent: isHttps ? httpsAgent : httpAgent,
|
|
205
|
+
signal
|
|
206
|
+
};
|
|
207
|
+
const nodeRequest = (isHttps ? httpsRequest : httpRequest)(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: response.statusCode ?? 0,
|
|
218
|
+
statusText: response.statusMessage ?? "",
|
|
219
|
+
headers: normalizeHttpHeaders(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: Cause.fail(abortErrorForSignal(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: Cause.fail({ _tag: "Abort" }) });
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function makeNodeHttpTransport(config = {}) {
|
|
255
|
+
const agentOptions = toAgentOptions(config);
|
|
256
|
+
const httpAgent = config.httpAgent ?? new HttpAgent(agentOptions);
|
|
257
|
+
const httpsAgent = config.httpsAgent ?? new HttpsAgent(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 makeDefaultHttpClient({
|
|
276
|
+
...clientConfig,
|
|
277
|
+
preset,
|
|
278
|
+
transport: transport ?? makeNodeHttpTransport(nodeTransport)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
150
282
|
// src/http/httpClient.ts
|
|
151
283
|
var resolveFinalUrl = (baseUrl, url) => {
|
|
152
284
|
try {
|
|
@@ -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" }),
|
|
@@ -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 {
|
|
@@ -1569,6 +1707,7 @@ export {
|
|
|
1569
1707
|
ConfigValidationError,
|
|
1570
1708
|
DEFAULT_CACHE_RELEVANT_HEADERS,
|
|
1571
1709
|
EmaComputer,
|
|
1710
|
+
HttpClientService,
|
|
1572
1711
|
HttpConcurrencyPool,
|
|
1573
1712
|
HttpServer,
|
|
1574
1713
|
LRUCache,
|
|
@@ -1633,6 +1772,7 @@ export {
|
|
|
1633
1772
|
makeCompressionMiddleware,
|
|
1634
1773
|
makeConnectionStateMap,
|
|
1635
1774
|
makeDefaultHttpClient,
|
|
1775
|
+
makeDefaultHttpClientLayer,
|
|
1636
1776
|
makeFetchStreamTransport,
|
|
1637
1777
|
makeFetchTransport,
|
|
1638
1778
|
makeHttp,
|
|
@@ -1641,9 +1781,12 @@ export {
|
|
|
1641
1781
|
makeHttpRouter,
|
|
1642
1782
|
makeHttpServerResource,
|
|
1643
1783
|
makeHttpStream,
|
|
1784
|
+
makeJsonParseValidationError,
|
|
1644
1785
|
makeLifecycleClient,
|
|
1786
|
+
makeNodeHttpProxyClient,
|
|
1645
1787
|
makeNodeHttpServer,
|
|
1646
1788
|
makeNodeHttpServerResource,
|
|
1789
|
+
makeNodeHttpTransport,
|
|
1647
1790
|
makePrewarmManager,
|
|
1648
1791
|
makePromiseHttpTransport,
|
|
1649
1792
|
makeRequestCompressionMiddleware,
|