brass-runtime 1.15.0 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +673 -136
- package/dist/agent/cli/main.cjs +40 -35
- package/dist/agent/cli/main.js +9 -4
- package/dist/agent/cli/main.mjs +9 -4
- package/dist/agent/index.cjs +8 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -3
- package/dist/agent/index.mjs +7 -3
- package/dist/chunk-2HQTDLHF.mjs +683 -0
- package/dist/chunk-36I3M4UC.mjs +370 -0
- package/dist/chunk-3AYM6WPJ.js +1629 -0
- package/dist/chunk-3LOYJFRR.cjs +300 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-3Y2RIUMM.js +300 -0
- package/dist/{chunk-VEZNF5GZ.cjs → chunk-4ROBZFL6.cjs} +130 -126
- package/dist/{chunk-3QMOKAS5.js → chunk-52OB2ROS.js} +9 -5
- package/dist/chunk-52PPNNI4.cjs +416 -0
- package/dist/chunk-5EC274J5.cjs +2874 -0
- package/dist/chunk-5QC7LRZ3.js +229 -0
- package/dist/chunk-5VRJNBLZ.mjs +2874 -0
- package/dist/chunk-62AZW6UT.cjs +313 -0
- package/dist/chunk-6IXXWIUM.js +683 -0
- package/dist/chunk-74ZTY6CP.js +2871 -0
- package/dist/chunk-76YMRMH2.cjs +777 -0
- package/dist/chunk-7CMJS3QE.mjs +2871 -0
- package/dist/{chunk-4NHES7VK.mjs → chunk-7JIJOVCT.js} +27 -13
- package/dist/chunk-A2OM6NEH.mjs +194 -0
- package/dist/chunk-AGR5B2BC.cjs +683 -0
- package/dist/chunk-AVNQLJ5V.js +777 -0
- package/dist/chunk-B33ICAKP.js +313 -0
- package/dist/{chunk-ELOOF35R.mjs → chunk-B5JD23U7.mjs} +1 -1
- package/dist/chunk-BABBZK4Y.js +2024 -0
- package/dist/chunk-C3MDXTRZ.js +354 -0
- package/dist/chunk-CIZFIMK5.js +2193 -0
- package/dist/chunk-CZIVE6NT.cjs +354 -0
- package/dist/chunk-DNFJLJMW.mjs +354 -0
- package/dist/chunk-DNFO2EIZ.mjs +777 -0
- package/dist/chunk-EJ6BPYVR.mjs +416 -0
- package/dist/chunk-ENKODRU3.cjs +2193 -0
- package/dist/chunk-EOC4UHBS.mjs +229 -0
- package/dist/{chunk-BMH5AV44.js → chunk-FH2X7BVP.js} +756 -440
- package/dist/{chunk-PPUXIH5R.js → chunk-FHQGHPMO.mjs} +27 -13
- package/dist/{chunk-TGIFUAK4.cjs → chunk-GLE2WY7Z.cjs} +951 -635
- package/dist/{chunk-BDF4AMWX.mjs → chunk-GYM3LLGS.mjs} +756 -440
- package/dist/chunk-HLWLMW2F.mjs +2024 -0
- package/dist/chunk-JF5WGYJJ.cjs +194 -0
- package/dist/chunk-KH4SYAOS.mjs +1629 -0
- package/dist/chunk-KN32XNTH.mjs +313 -0
- package/dist/chunk-KQLYONSE.cjs +2871 -0
- package/dist/{chunk-STVLQ3XD.cjs → chunk-KZJQ723N.cjs} +92 -78
- package/dist/chunk-L2SYFEBS.js +194 -0
- package/dist/chunk-L6VB5N7Q.cjs +104 -0
- package/dist/{chunk-K6M7MDZ4.mjs → chunk-MBEJI5HF.mjs} +9 -5
- package/dist/chunk-MIIYDLGM.js +2874 -0
- package/dist/chunk-MOO4L7F4.mjs +104 -0
- package/dist/chunk-MT3OWDPC.mjs +2193 -0
- package/dist/chunk-MVGUEJ5Z.cjs +370 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-PD4EJTQC.cjs +229 -0
- package/dist/chunk-PWC3RBQE.mjs +300 -0
- package/dist/chunk-Q2I37RP3.cjs +1629 -0
- package/dist/chunk-RKGKFN2A.js +416 -0
- package/dist/{chunk-R3R2FVLG.cjs → chunk-SA6HUJVI.cjs} +5 -5
- package/dist/chunk-TRM4JUZQ.js +104 -0
- package/dist/chunk-UB4B6OFY.js +370 -0
- package/dist/{chunk-TO7IKXYT.js → chunk-UCUBNWM2.js} +1 -1
- package/dist/chunk-VN44DYYT.cjs +2024 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/client-CZHU674n.d.ts +820 -0
- package/dist/core/index.cjs +198 -4
- package/dist/core/index.d.ts +311 -212
- package/dist/core/index.js +237 -43
- package/dist/core/index.mjs +237 -43
- package/dist/{effect-CMOQKX8y.d.ts → effect-DIUHZ9IN.d.ts} +195 -1
- package/dist/effectRunner-CFLC32IK.cjs +8 -0
- package/dist/effectRunner-L4S7IPT3.js +8 -0
- package/dist/effectRunner-NNGG75QA.mjs +8 -0
- package/dist/http/index.cjs +1227 -2971
- package/dist/http/index.d.ts +826 -280
- package/dist/http/index.js +1089 -2833
- package/dist/http/index.mjs +1089 -2833
- package/dist/http/testing.cjs +161 -0
- package/dist/http/testing.d.ts +43 -0
- package/dist/http/testing.js +161 -0
- package/dist/http/testing.mjs +161 -0
- package/dist/index.cjs +486 -250
- package/dist/index.d.ts +87 -95
- package/dist/index.js +391 -155
- package/dist/index.mjs +391 -155
- package/dist/observability/index.cjs +162 -0
- package/dist/observability/index.d.ts +152 -0
- package/dist/observability/index.js +162 -0
- package/dist/observability/index.mjs +162 -0
- package/dist/perf/cli.cjs +401 -0
- package/dist/perf/cli.d.ts +1 -0
- package/dist/perf/cli.js +401 -0
- package/dist/perf/cli.mjs +401 -0
- package/dist/perf/index.cjs +141 -0
- package/dist/perf/index.d.ts +483 -0
- package/dist/perf/index.js +141 -0
- package/dist/perf/index.mjs +141 -0
- package/dist/schedule-CK3Ml_7p.d.ts +259 -0
- package/dist/schema/index.cjs +29 -0
- package/dist/schema/index.d.ts +179 -0
- package/dist/schema/index.js +29 -0
- package/dist/schema/index.mjs +29 -0
- package/dist/server-GJPg8ZSG.d.ts +675 -0
- package/dist/{stream-FQm9h4Mg.d.ts → stream-B4oK9JFP.d.ts} +1 -1
- package/dist/tracer-Hwt1cl7h.d.ts +189 -0
- package/dist/tracing-DqbTKGcf.d.ts +148 -0
- package/docs/ARCHITECTURE.md +292 -0
- package/docs/README.md +63 -0
- package/docs/adr/0001-ai-context-pack.md +32 -0
- package/docs/agent-apply-mode.md +104 -0
- package/docs/agent-approvals.md +110 -0
- package/docs/agent-batch.md +185 -0
- package/docs/agent-boundaries.md +112 -0
- package/docs/agent-chat-sessions.md +160 -0
- package/docs/agent-ci.md +17 -0
- package/docs/agent-cli.md +405 -0
- package/docs/agent-config.md +480 -0
- package/docs/agent-context-discovery.md +159 -0
- package/docs/agent-copilot-like-dx.md +126 -0
- package/docs/agent-declarative-optimized-planning.md +138 -0
- package/docs/agent-dx.md +224 -0
- package/docs/agent-env-files.md +126 -0
- package/docs/agent-follow-up-context.md +43 -0
- package/docs/agent-global-usage.md +180 -0
- package/docs/agent-init.md +109 -0
- package/docs/agent-install-and-configure.md +516 -0
- package/docs/agent-language-workspace-ux.md +99 -0
- package/docs/agent-llm-adapters.md +123 -0
- package/docs/agent-local-install.md +190 -0
- package/docs/agent-local-tests.md +51 -0
- package/docs/agent-observability.md +155 -0
- package/docs/agent-patch-quality-loop.md +162 -0
- package/docs/agent-presets.md +22 -0
- package/docs/agent-project-commands.md +237 -0
- package/docs/agent-project-intelligence.md +156 -0
- package/docs/agent-redaction.md +18 -0
- package/docs/agent-release-readiness.md +76 -0
- package/docs/agent-rollback-safety.md +162 -0
- package/docs/agent-rollback.md +23 -0
- package/docs/agent-run-artifacts.md +16 -0
- package/docs/agent-vscode-auto-discovery.md +137 -0
- package/docs/agent-vscode-batch-runner.md +100 -0
- package/docs/agent-vscode-chat-layout.md +90 -0
- package/docs/agent-vscode-clean-install.md +147 -0
- package/docs/agent-vscode-code-actions.md +70 -0
- package/docs/agent-vscode-diff-preview.md +45 -0
- package/docs/agent-vscode-inline-assist.md +56 -0
- package/docs/agent-vscode-install.md +186 -0
- package/docs/agent-vscode-model-setup.md +97 -0
- package/docs/agent-vscode-patch-preview.md +92 -0
- package/docs/agent-vscode-problems.md +79 -0
- package/docs/agent-vscode-project-dashboard.md +106 -0
- package/docs/agent-vscode-run-history.md +92 -0
- package/docs/agent-vscode-ux.md +73 -0
- package/docs/ai/INVARIANTS.md +84 -0
- package/docs/ai/PROJECT_MAP.md +338 -0
- package/docs/ai/PUBLIC_API.md +336 -0
- package/docs/ai/VALIDATION_MATRIX.md +67 -0
- package/docs/api-polish.md +37 -0
- package/docs/cancellation.md +162 -0
- package/docs/coverage.md +46 -0
- package/docs/getting-started.md +159 -0
- package/docs/guides/README.md +40 -0
- package/docs/guides/circuit-breaker.md +89 -0
- package/docs/guides/error-handling.md +91 -0
- package/docs/guides/getting-started.md +107 -0
- package/docs/guides/layers.md +189 -0
- package/docs/guides/metrics.md +101 -0
- package/docs/guides/resource-management.md +141 -0
- package/docs/guides/retry.md +215 -0
- package/docs/guides/semaphore.md +66 -0
- package/docs/guides/streams.md +117 -0
- package/docs/guides/supervisors.md +98 -0
- package/docs/guides/testing.md +162 -0
- package/docs/guides/tracing.md +71 -0
- package/docs/http-recipes.md +399 -0
- package/docs/http.md +749 -0
- package/docs/modules.md +285 -0
- package/docs/observability-collector-smoke.md +31 -0
- package/docs/observability-framework-examples.md +98 -0
- package/docs/observability.md +542 -0
- package/docs/otel-collector-smoke.yaml +27 -0
- package/docs/performance-profiler.md +199 -0
- package/docs/production-readiness.md +73 -0
- package/docs/recipes/README.md +12 -0
- package/docs/recipes/http-server.md +45 -0
- package/docs/recipes/layers.md +44 -0
- package/docs/recipes/performance.md +47 -0
- package/docs/recipes/runtime.md +41 -0
- package/docs/recipes/testing.md +41 -0
- package/docs/release.md +53 -0
- package/docs/wasm-bounded-queues.md +44 -0
- package/docs/wasm-engine-observability-benchmarks.md +85 -0
- package/docs/wasm-fiber-engine.md +117 -0
- package/docs/wasm-scheduler-state-machine.md +122 -0
- package/docs/wasm-stream-chunks.md +54 -0
- package/package.json +48 -2
- package/dist/chunk-AR22SXML.js +0 -1043
- package/dist/chunk-BDYEENHT.js +0 -224
- package/dist/chunk-JFPU5GQI.mjs +0 -1043
- package/dist/chunk-MS34J5LY.cjs +0 -224
- package/dist/chunk-UMAZLXAB.mjs +0 -224
- package/dist/chunk-XPZNXSVN.cjs +0 -1043
- package/dist/tracing-DNT9jEbr.d.ts +0 -106
package/dist/http/index.d.ts
CHANGED
|
@@ -1,242 +1,157 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { e as HttpRequestPolicyRef, f as HttpRequestRetryOverride, a as HttpRequest, c as HttpError, b as HttpWireResponse, V as ValidationError, d as HttpMiddleware, R as RetryPolicy, H as HttpClient, M as MakeHttpConfig, g as HttpWireResponseStream, h as HttpClientStream, i as HttpClientStats, j as AdaptiveLimiter, k as HttpClientFn, l as AdaptiveLimiterConfig, m as HttpMethod, n as HttpPolicyPresets, o as HttpTransport, p as AdaptiveLimiterPreset, q as HttpPoolConfig } from '../client-CZHU674n.js';
|
|
2
|
+
export { r as AdaptiveAcquireOptions, s as AdaptiveBaselineStrategy, t as AdaptiveHeadroomContext, u as AdaptiveHeadroomMode, v as AdaptiveHeadroomStrategy, w as AdaptiveLease, x as AdaptiveLimiterDiagnostics, y as AdaptiveLimiterKeySnapshot, A as AdaptiveLimiterStats, z as AdaptiveQueueLoadShedding, B as AdaptiveQueueStrategy, C as AdaptiveReleaseInfo, D as HttpBody, E as HttpClientStreamFn, F as HttpConcurrencyPool, G as HttpErrorHandlers, I as HttpInit, J as HttpPolicyPreset, K as HttpPoolKeyResolver, L as HttpPoolKeyStats, N as HttpPoolLease, O as HttpPoolStats, P as HttpRequestPolicy, Q as HttpRetryScheduleInput, S as HttpStreamTransport, T as HttpTransportContext, U as HttpTransportTiming, W as JsonDecodeResult, X as KnownHttpError, Y as KnownHttpErrorTag, Z as LimitChangeEvent, _ as PerRequestRetryOverride, $ as PromiseHttpTransportBodyBuilder, a0 as PromiseHttpTransportBodySelector, a1 as PromiseHttpTransportConfig, a2 as PromiseHttpTransportConfigWithSignal, a3 as PromiseHttpTransportFluentResponseBuilder, a4 as PromiseHttpTransportRequestConfigBuilder, a5 as PromiseHttpTransportRequestConfigContext, a6 as PromiseHttpTransportRequestConfigMapper, a7 as PromiseHttpTransportResponse, a8 as PromiseHttpTransportResponseInfo, a9 as PromiseHttpTransportResponseInfoMapper, aa as PromiseHttpTransportStartBuilder, ab as ResolveHttpRequestPolicyOptions, ac as ResolvedConfig, ad as RetryEvent, ae as RetryScheduleInput, af as RetryableHttpErrorOptions, ag as ToHttpErrorOptions, ah as abortErrorForSignal, ai as adaptiveLimiterPresets, aj as backoffDelayMs, ak as decodeJsonBody, al as decodeJsonBodyEffect, am as decorate, an as defaultRetryOnError, ao as defaultRetryOnStatus, ap as defaultRetryableMethods, aq as defineHttpPolicyPresets, ar as encodeJsonBodyEffect, as as formatHttpError, at as getHttpRequestPolicy, au as headersOf, av as httpErrorStatus, aw as httpPolicy, ax as isAbortError, ay as isAbortHttpError, az as isCircuitBreakerOpen, aA as isExternalAbortError, aB as isExternalTimeoutError, aC as isFetchHttpError, aD as isHttpError, aE as isKnownHttpError, aF as isRetryableHttpError, aG as isRetryableHttpStatus, aH as isTaggedHttpError, aI as isTimeoutHttpError, aJ as isValidationError, aK as linkAbortSignals, aL as makeAdaptiveLimiterConfig, aM as makeFetchStreamTransport, aN as makeFetchTransport, aO as makeHttp, aP as makeHttpStream, aQ as makePromiseHttpTransport, aR as matchHttpError, aS as normalizeHeadersInit, aT as normalizeHttpError, aU as normalizeHttpHeaders, aV as normalizeRetryBudget, aW as promiseHttpTransport, aX as resolveConfig, aY as resolveHttpPoolKey, aZ as resolveHttpRequestPolicyPresets, a_ as retryAfterMs, a$ as toHttpError, b0 as validateConfig, b1 as validatedJson, b2 as validatedJsonResponse, b3 as withHttpPolicyPresets, b4 as withHttpRequestPolicy, b5 as withMiddleware, b6 as withRetry, b7 as withRetryStream } from '../client-CZHU674n.js';
|
|
3
|
+
import { C as AsyncWithPromise, A as Async, f as Runtime, h as RuntimeOptions } from '../effect-DIUHZ9IN.js';
|
|
4
|
+
import { AnyJsonSchemaLike, InferJsonSchema } from '../schema/index.js';
|
|
5
|
+
export { AnySchema, ConfigValidationError, InferObject, InferSchema, JsonSchemaLike, JsonValidator, JsonValidatorResult, NumberSchemaOptions, ObjectSchemaOptions, Schema, SchemaIssue, SchemaPathPart, SchemaResult, SchemaShape, SchemaValidationException, StringSchemaOptions, formatConfigError, formatIssues, isConfigValidationError, isSchema, makeSchemaIssue, parseConfig, s, schema, validateValue } from '../schema/index.js';
|
|
6
|
+
import { d as CircuitBreakerConfig, S as Schedule } from '../schedule-CK3Ml_7p.js';
|
|
7
|
+
import { T as Tracer, R as Resource } from '../tracing-DqbTKGcf.js';
|
|
8
|
+
import { Server } from 'node:http';
|
|
9
|
+
import { AddressInfo } from 'node:net';
|
|
10
|
+
import { O as Observability, p as HttpServerObservabilityOptions, Z as RuntimeHealthOptions } from '../server-GJPg8ZSG.js';
|
|
11
|
+
import '../stream-B4oK9JFP.js';
|
|
12
|
+
import '../tracer-Hwt1cl7h.js';
|
|
4
13
|
|
|
5
14
|
/**
|
|
6
|
-
*
|
|
15
|
+
* A fixed-size circular buffer that stores latency samples and supports
|
|
16
|
+
* efficient min and percentile computation using the nearest-rank method.
|
|
17
|
+
*
|
|
18
|
+
* The ring preserves eviction order while `sorted` keeps an exact sorted view.
|
|
19
|
+
* Recording is O(windowSize) because it removes/inserts by binary search +
|
|
20
|
+
* splice, but percentile reads are O(1) and avoid sorting on every call.
|
|
7
21
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Strict engine selector for retry planning. Defaults to ts. */
|
|
47
|
-
engine?: "ts" | "wasm";
|
|
48
|
-
/** Back-compat knob: wasm=true maps to engine="wasm", wasm=false maps to engine="ts". */
|
|
49
|
-
wasm?: boolean;
|
|
50
|
-
/** Called synchronously before each retry delay begins. Zero overhead when omitted. */
|
|
51
|
-
onRetry?: (event: RetryEvent) => void;
|
|
52
|
-
};
|
|
53
|
-
declare const defaultRetryableMethods: HttpMethod[];
|
|
54
|
-
declare const defaultRetryOnStatus: (s: number) => s is 408 | 429 | 500 | 502 | 503 | 504;
|
|
55
|
-
declare const defaultRetryOnError: (e: HttpError) => e is {
|
|
56
|
-
_tag: "FetchError";
|
|
57
|
-
message: string;
|
|
58
|
-
} | {
|
|
59
|
-
_tag: "Timeout";
|
|
60
|
-
timeoutMs: number;
|
|
61
|
-
message: string;
|
|
62
|
-
phase?: "request" | "queue" | "retry";
|
|
63
|
-
} | {
|
|
64
|
-
_tag: "PoolTimeout";
|
|
65
|
-
key: string;
|
|
66
|
-
timeoutMs: number;
|
|
67
|
-
message: string;
|
|
68
|
-
};
|
|
69
|
-
declare const backoffDelayMs: (attempt: number, base: number, cap: number) => number;
|
|
70
|
-
declare const retryAfterMs: (headers: Record<string, string>) => number | undefined;
|
|
71
|
-
declare const normalizeRetryBudget: (ms: number | undefined) => number | undefined;
|
|
72
|
-
declare const withRetry: (p: RetryPolicy) => HttpMiddleware;
|
|
22
|
+
declare class LatencyWindow {
|
|
23
|
+
private readonly buffer;
|
|
24
|
+
private readonly sorted;
|
|
25
|
+
private readonly size;
|
|
26
|
+
private head;
|
|
27
|
+
private count;
|
|
28
|
+
constructor(size: number);
|
|
29
|
+
/**
|
|
30
|
+
* Record a latency sample. Discards non-positive, NaN, and Infinity values.
|
|
31
|
+
* Evicts the oldest sample when the buffer is full.
|
|
32
|
+
*/
|
|
33
|
+
record(latencyMs: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the minimum latency in the current window, or undefined if empty.
|
|
36
|
+
*/
|
|
37
|
+
min(): number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Computes the percentile using the nearest-rank method.
|
|
40
|
+
* Returns undefined if fewer than 2 samples are present.
|
|
41
|
+
* @param p - Percentile value in [0, 100]
|
|
42
|
+
*/
|
|
43
|
+
percentile(p: number): number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Computes a percentile where newer samples receive exponentially higher
|
|
46
|
+
* weight. A decay of 1 is identical to `percentile`; lower values adapt
|
|
47
|
+
* faster to recent latency shifts.
|
|
48
|
+
*/
|
|
49
|
+
weightedPercentile(p: number, decay: number): number | undefined;
|
|
50
|
+
/** Number of samples currently in the window. */
|
|
51
|
+
get length(): number;
|
|
52
|
+
/** Maximum capacity of the window. */
|
|
53
|
+
get capacity(): number;
|
|
54
|
+
/** Returns a copy of the current samples (oldest to newest). */
|
|
55
|
+
samples(): number[];
|
|
56
|
+
private insertSorted;
|
|
57
|
+
private removeSorted;
|
|
58
|
+
private lowerBound;
|
|
59
|
+
}
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
readonly
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Exponential Moving Average computer.
|
|
63
|
+
* Smooths latency samples using the formula: ema = α * sample + (1 - α) * previous_ema
|
|
64
|
+
*/
|
|
65
|
+
declare class EmaComputer {
|
|
66
|
+
private readonly alpha;
|
|
67
|
+
private current;
|
|
68
|
+
/**
|
|
69
|
+
* @param alpha - Smoothing factor in (0, 1]. Higher values weight recent samples more.
|
|
70
|
+
*/
|
|
71
|
+
constructor(alpha: number);
|
|
84
72
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* - wasm: require BrassWasmHttpPermitPool from wasm/pkg; never falls back.
|
|
73
|
+
* Update the EMA with a new sample and return the new EMA value.
|
|
74
|
+
* On the first sample, the EMA is initialized to that sample.
|
|
88
75
|
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
readonly key: string;
|
|
95
|
-
readonly running: number;
|
|
96
|
-
readonly queued: number;
|
|
97
|
-
readonly concurrency: number;
|
|
98
|
-
readonly maxQueue: number;
|
|
99
|
-
readonly acquired: number;
|
|
100
|
-
readonly released: number;
|
|
101
|
-
readonly rejected: number;
|
|
102
|
-
readonly queueTimeouts: number;
|
|
103
|
-
readonly abortedWhileQueued: number;
|
|
104
|
-
};
|
|
105
|
-
type HttpPoolStats = {
|
|
106
|
-
readonly running: number;
|
|
107
|
-
readonly queued: number;
|
|
108
|
-
readonly acquired: number;
|
|
109
|
-
readonly released: number;
|
|
110
|
-
readonly rejected: number;
|
|
111
|
-
readonly queueTimeouts: number;
|
|
112
|
-
readonly abortedWhileQueued: number;
|
|
113
|
-
readonly wasm?: unknown;
|
|
114
|
-
readonly keys: HttpPoolKeyStats[];
|
|
115
|
-
};
|
|
116
|
-
type HttpPoolLease = {
|
|
117
|
-
readonly key: string;
|
|
118
|
-
release: () => void;
|
|
119
|
-
};
|
|
120
|
-
declare function resolveHttpPoolKey(resolver: HttpPoolKeyResolver | undefined, req: HttpRequest, url: URL): string;
|
|
121
|
-
declare class HttpConcurrencyPool {
|
|
122
|
-
private readonly states;
|
|
123
|
-
private readonly concurrency;
|
|
124
|
-
private readonly maxQueue;
|
|
125
|
-
private readonly queueTimeoutMs;
|
|
126
|
-
readonly keyResolver: HttpPoolKeyResolver | undefined;
|
|
127
|
-
private readonly wasm;
|
|
128
|
-
private readonly wasmWaiters;
|
|
129
|
-
private wasmTimer;
|
|
130
|
-
private nextSubjectId;
|
|
131
|
-
constructor(config?: HttpPoolConfig);
|
|
132
|
-
acquire(key: string, signal: AbortSignal): Promise<HttpPoolLease>;
|
|
133
|
-
stats(): HttpPoolStats;
|
|
134
|
-
private acquireJs;
|
|
135
|
-
private acquireWasm;
|
|
136
|
-
private getState;
|
|
137
|
-
private makeLease;
|
|
138
|
-
private drain;
|
|
139
|
-
private handleWasmGrants;
|
|
140
|
-
private handleWasmTimeouts;
|
|
141
|
-
private scheduleWasmTimeoutPump;
|
|
142
|
-
private cleanupWaiter;
|
|
143
|
-
private removeWaiter;
|
|
144
|
-
private allocateSubjectId;
|
|
76
|
+
update(sample: number): number;
|
|
77
|
+
/** Returns the current EMA value, or undefined if no samples have been recorded. */
|
|
78
|
+
get value(): number | undefined;
|
|
79
|
+
/** Resets the EMA state. */
|
|
80
|
+
reset(): void;
|
|
145
81
|
}
|
|
146
82
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Computes the gradient as the ratio of minimum latency to current (smoothed) latency.
|
|
85
|
+
* A gradient < 1.0 indicates latency is increasing (saturation).
|
|
86
|
+
* A gradient >= 1.0 indicates latency is stable or decreasing.
|
|
87
|
+
*/
|
|
88
|
+
declare function computeGradient(minLatency: number, currentLatency: number): number;
|
|
89
|
+
/**
|
|
90
|
+
* Computes the new concurrency limit based on the gradient.
|
|
91
|
+
*
|
|
92
|
+
* - If gradient < decreaseThreshold: decrease toward `currentLimit * gradient`
|
|
93
|
+
* - If gradient >= increaseThreshold: newLimit = currentLimit + headroom
|
|
94
|
+
* - Otherwise: hold the current limit
|
|
95
|
+
*
|
|
96
|
+
* Decreases are capped by `maxDecreaseRatio` so a single noisy latency sample
|
|
97
|
+
* cannot collapse concurrency.
|
|
98
|
+
*
|
|
99
|
+
* The result is clamped to [minBound, maxBound].
|
|
100
|
+
*/
|
|
101
|
+
declare function computeNewLimit(currentLimit: number, gradient: number, headroom: number, minBound: number, maxBound: number, options?: {
|
|
102
|
+
readonly decreaseThreshold?: number;
|
|
103
|
+
readonly increaseThreshold?: number;
|
|
104
|
+
readonly maxDecreaseRatio?: number;
|
|
105
|
+
}): number;
|
|
106
|
+
|
|
107
|
+
type HttpRequestPolicyInit = {
|
|
108
|
+
readonly policy?: HttpRequestPolicyRef;
|
|
109
|
+
readonly lane?: string;
|
|
110
|
+
readonly dedupKey?: string;
|
|
111
|
+
readonly priority?: number;
|
|
112
|
+
readonly retry?: HttpRequestRetryOverride;
|
|
170
113
|
};
|
|
171
|
-
|
|
172
|
-
type
|
|
173
|
-
type HttpBody = string | Uint8Array | ArrayBuffer;
|
|
174
|
-
type HttpRequest = {
|
|
175
|
-
method: HttpMethod;
|
|
176
|
-
url: string;
|
|
177
|
-
headers?: Record<string, string>;
|
|
178
|
-
body?: HttpBody;
|
|
179
|
-
init?: HttpInit;
|
|
180
|
-
/** Per-request override for `MakeHttpConfig.timeoutMs`. */
|
|
114
|
+
|
|
115
|
+
type InitNoMethodBody$1 = Omit<RequestInit, "method" | "body"> & HttpRequestPolicyInit & {
|
|
181
116
|
timeoutMs?: number;
|
|
182
|
-
/** Optional stable key for downstream isolation. When omitted, the pool uses origin/host/global config. */
|
|
183
117
|
poolKey?: string;
|
|
118
|
+
headers?: any;
|
|
184
119
|
};
|
|
185
|
-
type
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
headers: Record<string, string>;
|
|
189
|
-
bodyText: string;
|
|
190
|
-
ms: number;
|
|
120
|
+
type JsonInitNoSchema$1 = InitNoMethodBody$1 & {
|
|
121
|
+
schema?: undefined;
|
|
122
|
+
schemaName?: string;
|
|
191
123
|
};
|
|
192
|
-
type
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
readonly succeeded: number;
|
|
196
|
-
readonly failed: number;
|
|
197
|
-
readonly aborted: number;
|
|
198
|
-
readonly timedOut: number;
|
|
199
|
-
readonly poolRejected: number;
|
|
200
|
-
readonly poolTimeouts: number;
|
|
201
|
-
readonly lastDurationMs?: number;
|
|
202
|
-
readonly pool?: HttpPoolStats;
|
|
203
|
-
};
|
|
204
|
-
type MakeHttpConfig = {
|
|
205
|
-
baseUrl?: string;
|
|
206
|
-
headers?: Record<string, string>;
|
|
207
|
-
/** Request budget covering pool wait + fetch + body read. Disabled when omitted. */
|
|
208
|
-
timeoutMs?: number;
|
|
209
|
-
/** Downstream pool/concurrency limiter. Disabled by default to preserve existing behavior. */
|
|
210
|
-
pool?: false | HttpPoolConfig;
|
|
124
|
+
type JsonInitWithSchema<Validator extends AnyJsonSchemaLike> = InitNoMethodBody$1 & {
|
|
125
|
+
schema: Validator;
|
|
126
|
+
schemaName?: string;
|
|
211
127
|
};
|
|
212
|
-
type
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
ms: number;
|
|
128
|
+
type PostJsonInitNoSchema$1 = AnyInitWithHeaders & {
|
|
129
|
+
schema?: undefined;
|
|
130
|
+
schemaName?: string;
|
|
131
|
+
bodySchema?: undefined;
|
|
132
|
+
bodySchemaName?: string;
|
|
218
133
|
};
|
|
219
|
-
type
|
|
220
|
-
|
|
221
|
-
|
|
134
|
+
type PostJsonInitWithBodySchema<BodyValidator extends AnyJsonSchemaLike> = AnyInitWithHeaders & {
|
|
135
|
+
schema?: undefined;
|
|
136
|
+
schemaName?: string;
|
|
137
|
+
bodySchema: BodyValidator;
|
|
138
|
+
bodySchemaName?: string;
|
|
222
139
|
};
|
|
223
|
-
type
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
140
|
+
type PostJsonInitWithSchema<Validator extends AnyJsonSchemaLike> = AnyInitWithHeaders & {
|
|
141
|
+
schema: Validator;
|
|
142
|
+
schemaName?: string;
|
|
143
|
+
bodySchema?: undefined;
|
|
144
|
+
bodySchemaName?: string;
|
|
228
145
|
};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
poolKey?: string;
|
|
239
|
-
headers?: any;
|
|
146
|
+
type PostJsonInitWithSchemaAndBody<Validator extends AnyJsonSchemaLike, BodyValidator extends AnyJsonSchemaLike> = AnyInitWithHeaders & {
|
|
147
|
+
schema: Validator;
|
|
148
|
+
schemaName?: string;
|
|
149
|
+
bodySchema: BodyValidator;
|
|
150
|
+
bodySchemaName?: string;
|
|
151
|
+
};
|
|
152
|
+
type AnyJsonInit = InitNoMethodBody$1 & {
|
|
153
|
+
schema?: AnyJsonSchemaLike;
|
|
154
|
+
schemaName?: string;
|
|
240
155
|
};
|
|
241
156
|
type HttpMeta = {
|
|
242
157
|
request: HttpRequest;
|
|
@@ -259,7 +174,7 @@ type HttpResponseWithMeta<A> = {
|
|
|
259
174
|
response: HttpResponse<A>;
|
|
260
175
|
meta: HttpMeta;
|
|
261
176
|
};
|
|
262
|
-
type AnyInitWithHeaders = {
|
|
177
|
+
type AnyInitWithHeaders = HttpRequestPolicyInit & {
|
|
263
178
|
headers?: any;
|
|
264
179
|
timeoutMs?: number;
|
|
265
180
|
poolKey?: string;
|
|
@@ -268,9 +183,17 @@ type Dx = {
|
|
|
268
183
|
request: (req: HttpRequest) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
269
184
|
get: (url: string, init?: AnyInitWithHeaders) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
270
185
|
post: (url: string, body?: string, init?: AnyInitWithHeaders) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
271
|
-
getText: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, HttpResponse<string>>;
|
|
272
|
-
getJson:
|
|
273
|
-
|
|
186
|
+
getText: (url: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, HttpResponse<string>>;
|
|
187
|
+
getJson: {
|
|
188
|
+
<Validator extends AnyJsonSchemaLike>(url: string, init: JsonInitWithSchema<Validator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
189
|
+
<A = unknown>(url: string, init?: JsonInitNoSchema$1): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
190
|
+
};
|
|
191
|
+
postJson: {
|
|
192
|
+
<Validator extends AnyJsonSchemaLike, BodyValidator extends AnyJsonSchemaLike>(url: string, bodyObj: InferJsonSchema<BodyValidator>, init: PostJsonInitWithSchemaAndBody<Validator, BodyValidator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
193
|
+
<BodyValidator extends AnyJsonSchemaLike, A = unknown>(url: string, bodyObj: InferJsonSchema<BodyValidator>, init: PostJsonInitWithBodySchema<BodyValidator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
194
|
+
<Validator extends AnyJsonSchemaLike>(url: string, bodyObj: unknown, init: PostJsonInitWithSchema<Validator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
195
|
+
<A = unknown>(url: string, bodyObj: unknown, init?: PostJsonInitNoSchema$1): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
196
|
+
};
|
|
274
197
|
with: (mw: HttpMiddleware) => Dx;
|
|
275
198
|
withRetry: (p: RetryPolicy) => Dx;
|
|
276
199
|
wire: HttpClient;
|
|
@@ -279,15 +202,15 @@ type Dx = {
|
|
|
279
202
|
declare function httpClient(cfg?: MakeHttpConfig): Dx;
|
|
280
203
|
declare function httpClientWithMeta(cfg?: MakeHttpConfig): {
|
|
281
204
|
request: (req: HttpRequest) => AsyncWithPromise<unknown, HttpError, {
|
|
282
|
-
wire: HttpWireResponse
|
|
205
|
+
wire: HttpWireResponse<unknown>;
|
|
283
206
|
meta: HttpMeta;
|
|
284
207
|
}>;
|
|
285
|
-
get: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, {
|
|
286
|
-
wire: HttpWireResponse
|
|
208
|
+
get: (url: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, {
|
|
209
|
+
wire: HttpWireResponse<unknown>;
|
|
287
210
|
meta: HttpMeta;
|
|
288
211
|
}>;
|
|
289
|
-
getText: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, {
|
|
290
|
-
wire: HttpWireResponse
|
|
212
|
+
getText: (url: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, {
|
|
213
|
+
wire: HttpWireResponse<unknown>;
|
|
291
214
|
response: {
|
|
292
215
|
status: number;
|
|
293
216
|
statusText: string;
|
|
@@ -296,37 +219,30 @@ declare function httpClientWithMeta(cfg?: MakeHttpConfig): {
|
|
|
296
219
|
};
|
|
297
220
|
meta: HttpMeta;
|
|
298
221
|
}>;
|
|
299
|
-
getJson: <A>(url: string, init?:
|
|
300
|
-
wire: HttpWireResponse
|
|
301
|
-
response:
|
|
302
|
-
status: number;
|
|
303
|
-
statusText: string;
|
|
304
|
-
headers: Record<string, string>;
|
|
305
|
-
body: A;
|
|
306
|
-
};
|
|
222
|
+
getJson: <A>(url: string, init?: AnyJsonInit) => AsyncWithPromise<unknown, HttpError | ValidationError, {
|
|
223
|
+
wire: HttpWireResponse<unknown>;
|
|
224
|
+
response: HttpResponse<A>;
|
|
307
225
|
meta: HttpMeta;
|
|
308
226
|
}>;
|
|
309
|
-
post: (url: string, body?: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, {
|
|
310
|
-
wire: HttpWireResponse
|
|
227
|
+
post: (url: string, body?: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, {
|
|
228
|
+
wire: HttpWireResponse<unknown>;
|
|
311
229
|
meta: HttpMeta;
|
|
312
230
|
}>;
|
|
313
|
-
postJson: <A>(url: string, bodyObj: unknown, init?:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
body: A;
|
|
322
|
-
};
|
|
231
|
+
postJson: <A>(url: string, bodyObj: unknown, init?: AnyInitWithHeaders & {
|
|
232
|
+
schema?: AnyJsonSchemaLike;
|
|
233
|
+
schemaName?: string;
|
|
234
|
+
bodySchema?: AnyJsonSchemaLike;
|
|
235
|
+
bodySchemaName?: string;
|
|
236
|
+
}) => AsyncWithPromise<unknown, HttpError | ValidationError, {
|
|
237
|
+
wire: HttpWireResponse<unknown>;
|
|
238
|
+
response: HttpResponse<A>;
|
|
323
239
|
meta: HttpMeta;
|
|
324
240
|
}>;
|
|
325
241
|
};
|
|
326
242
|
declare function httpClientStream(cfg?: MakeHttpConfig): {
|
|
327
|
-
request: (req: HttpRequest) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream
|
|
328
|
-
getStream: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream
|
|
329
|
-
get: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream
|
|
243
|
+
request: (req: HttpRequest) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream<unknown>>;
|
|
244
|
+
getStream: (url: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream<unknown>>;
|
|
245
|
+
get: (url: string, init?: InitNoMethodBody$1) => AsyncWithPromise<unknown, HttpError, HttpWireResponseStream<unknown>>;
|
|
330
246
|
with: (mw: (n: HttpClientStream) => HttpClientStream) => /*elided*/ any;
|
|
331
247
|
withRetry: (p: RetryPolicy) => /*elided*/ any;
|
|
332
248
|
wire: HttpClientStream;
|
|
@@ -336,6 +252,10 @@ declare function httpClientStream(cfg?: MakeHttpConfig): {
|
|
|
336
252
|
type HttpCircuitBreakerConfig = CircuitBreakerConfig & {
|
|
337
253
|
/** Key resolver for per-origin circuit breakers. Default: per-origin. */
|
|
338
254
|
perOrigin?: boolean;
|
|
255
|
+
/** Optional limiter to notify when this breaker is already/opened. Defaults to `next.adaptiveLimiter` when available. */
|
|
256
|
+
adaptiveLimiter?: Pick<AdaptiveLimiter, "keyResolver" | "markCircuitOpen">;
|
|
257
|
+
/** Optional resolver when the limiter key differs from the request URL origin/global fallback. */
|
|
258
|
+
adaptiveLimiterKey?: (req: HttpRequest) => string;
|
|
339
259
|
};
|
|
340
260
|
/**
|
|
341
261
|
* HTTP middleware that wraps requests in a circuit breaker.
|
|
@@ -348,36 +268,177 @@ declare function withCircuitBreaker(config?: HttpCircuitBreakerConfig): HttpMidd
|
|
|
348
268
|
*/
|
|
349
269
|
declare function withTracing(tracer: Tracer): HttpMiddleware;
|
|
350
270
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Developer-provided function that defines how to combine multiple requests
|
|
273
|
+
* into one and split the response back.
|
|
274
|
+
*
|
|
275
|
+
* @typeParam K - The item type extracted from individual requests, ensuring
|
|
276
|
+
* type consistency between coalesce and split.
|
|
277
|
+
*/
|
|
278
|
+
type BatchFunction<K> = {
|
|
279
|
+
/**
|
|
280
|
+
* Combines multiple HttpRequest objects into a single batched HttpRequest.
|
|
281
|
+
* The items array corresponds 1:1 with the requests array.
|
|
282
|
+
*/
|
|
283
|
+
coalesce: (requests: readonly HttpRequest[]) => HttpRequest;
|
|
284
|
+
/**
|
|
285
|
+
* Splits the batched response back into individual responses.
|
|
286
|
+
* Must return an array of the same length as the original requests array.
|
|
287
|
+
*/
|
|
288
|
+
split: (response: HttpWireResponse, requests: readonly HttpRequest[]) => HttpWireResponse[];
|
|
363
289
|
};
|
|
364
290
|
/**
|
|
365
|
-
*
|
|
291
|
+
* Configuration for the Batch_Middleware.
|
|
366
292
|
*
|
|
367
|
-
*
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
293
|
+
* @typeParam K - The item type linking coalesce and split operations.
|
|
294
|
+
*/
|
|
295
|
+
type BatchConfig<K = unknown> = {
|
|
296
|
+
/** The batch function defining coalesce/split logic. Required. */
|
|
297
|
+
batch: BatchFunction<K>;
|
|
298
|
+
/**
|
|
299
|
+
* Time window in milliseconds to collect requests before dispatching.
|
|
300
|
+
* Valid range: [1, 5000]. Required.
|
|
301
|
+
*/
|
|
302
|
+
windowMs: number;
|
|
303
|
+
/**
|
|
304
|
+
* Maximum number of requests in a single batch.
|
|
305
|
+
* When reached, the batch dispatches immediately.
|
|
306
|
+
* Valid range: [2, 10000]. Required.
|
|
307
|
+
*/
|
|
308
|
+
maxBatchSize: number;
|
|
309
|
+
/**
|
|
310
|
+
* Computes the Batch_Key from a request.
|
|
311
|
+
* Requests with the same key are batched together.
|
|
312
|
+
* Return empty string to bypass batching for a request.
|
|
313
|
+
* Throwing bypasses batching for that request.
|
|
314
|
+
*/
|
|
315
|
+
batchKey: (req: HttpRequest) => string;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Optional observer callback for batch lifecycle events.
|
|
319
|
+
*/
|
|
320
|
+
type BatchEventCallback = (event: {
|
|
321
|
+
type: "batch-hit" | "batch-dispatch";
|
|
322
|
+
batchKey: string;
|
|
323
|
+
batchSize?: number;
|
|
324
|
+
}) => void;
|
|
325
|
+
/**
|
|
326
|
+
* Creates a Batch_Middleware that collects requests by Batch_Key during
|
|
327
|
+
* a time window and dispatches them as a single batched request.
|
|
375
328
|
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
329
|
+
* @typeParam K - Inferred from the provided BatchFunction.
|
|
330
|
+
* @param config - Batch configuration.
|
|
331
|
+
* @param onEvent - Optional lifecycle event observer.
|
|
332
|
+
* @returns An HttpMiddleware conforming to (next: HttpClientFn) => HttpClientFn.
|
|
378
333
|
*/
|
|
379
|
-
declare function
|
|
334
|
+
declare function withBatch<K>(config: BatchConfig<K>, onEvent?: BatchEventCallback): HttpMiddleware;
|
|
380
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Status of a pre-warm probe result.
|
|
338
|
+
*/
|
|
339
|
+
type PrewarmResultStatus = "warmed" | "already-warm" | "failed" | "cancelled";
|
|
340
|
+
/**
|
|
341
|
+
* Result of a single pre-warm probe operation.
|
|
342
|
+
*/
|
|
343
|
+
type PrewarmResult = {
|
|
344
|
+
/** The origin that was probed. */
|
|
345
|
+
origin: string;
|
|
346
|
+
/** Outcome of the probe operation. */
|
|
347
|
+
status: PrewarmResultStatus;
|
|
348
|
+
/** Duration of the probe in milliseconds (0 for "already-warm"). */
|
|
349
|
+
durationMs: number;
|
|
350
|
+
/** Error information if status is "failed". */
|
|
351
|
+
error?: string;
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Event types emitted by the PrewarmManager during connection state changes.
|
|
355
|
+
*/
|
|
356
|
+
type PrewarmEventType = "connection-warmed" | "connection-expired" | "connection-failed" | "connection-cancelled";
|
|
357
|
+
/**
|
|
358
|
+
* An event emitted by the PrewarmManager to notify observers of connection state changes.
|
|
359
|
+
*/
|
|
360
|
+
type PrewarmEvent = {
|
|
361
|
+
/** The type of prewarm event. */
|
|
362
|
+
type: PrewarmEventType;
|
|
363
|
+
/** The origin associated with the event. */
|
|
364
|
+
origin: string;
|
|
365
|
+
/** Timestamp (ms) when the event occurred. */
|
|
366
|
+
timestamp: number;
|
|
367
|
+
/** Duration of the probe in milliseconds, if applicable. */
|
|
368
|
+
durationMs?: number;
|
|
369
|
+
/** Error information, if applicable. */
|
|
370
|
+
error?: string;
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Per-origin connection state in the state machine.
|
|
374
|
+
*/
|
|
375
|
+
type PrewarmOriginStatus = "idle" | "probing" | "warm" | "expired";
|
|
376
|
+
/**
|
|
377
|
+
* State information for a single managed origin.
|
|
378
|
+
*/
|
|
379
|
+
type PrewarmOriginState = {
|
|
380
|
+
/** The origin string. */
|
|
381
|
+
origin: string;
|
|
382
|
+
/** Current state of the origin. */
|
|
383
|
+
status: PrewarmOriginStatus;
|
|
384
|
+
/** Timestamp of the last successful probe, if any. */
|
|
385
|
+
lastProbeAt?: number;
|
|
386
|
+
/** Timestamp until which the connection is considered warm. */
|
|
387
|
+
warmUntil?: number;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Snapshot of all managed origins and their current states.
|
|
391
|
+
*/
|
|
392
|
+
type PrewarmStatusSnapshot = {
|
|
393
|
+
/** State of each managed origin. */
|
|
394
|
+
origins: PrewarmOriginState[];
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Configuration for creating a PrewarmManager.
|
|
398
|
+
*/
|
|
399
|
+
type PrewarmConfig = {
|
|
400
|
+
/** Origins to pre-warm. Each must be a valid URL origin (scheme + host + optional port). */
|
|
401
|
+
origins: string[];
|
|
402
|
+
/** Keep-alive duration in ms. Default: 55000. */
|
|
403
|
+
keepAliveDurationMs?: number;
|
|
404
|
+
/** Max concurrent in-flight probes. Default: 4. */
|
|
405
|
+
budget?: number;
|
|
406
|
+
/** Probe timeout in ms. Default: 5000. */
|
|
407
|
+
probeTimeoutMs?: number;
|
|
408
|
+
/** Auto-refresh expired connections. Default: false. */
|
|
409
|
+
autoRefresh?: boolean;
|
|
410
|
+
/** Route probes through the Wire_Client pool. Default: false. */
|
|
411
|
+
useClientPool?: boolean;
|
|
412
|
+
/** Optional Wire_Client to use when useClientPool is true. */
|
|
413
|
+
client?: HttpClientFn;
|
|
414
|
+
/** Event observer callback. */
|
|
415
|
+
onEvent?: (event: PrewarmEvent) => void;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Configuration for the prewarm layer within the lifecycle client.
|
|
420
|
+
*
|
|
421
|
+
* When provided to `makeLifecycleClient`, the lifecycle client creates and manages
|
|
422
|
+
* a PrewarmManager internally, triggering pre-warming based on the `afterResponse` hook.
|
|
423
|
+
*/
|
|
424
|
+
type PrewarmLifecycleConfig = {
|
|
425
|
+
/** Origins to pre-warm at client creation. */
|
|
426
|
+
origins?: string[];
|
|
427
|
+
/** Hook called after each successful response to determine origins to pre-warm. */
|
|
428
|
+
afterResponse?: (response: HttpWireResponse, request: HttpRequest) => string[];
|
|
429
|
+
/** Keep-alive duration in ms. Default: 55000. */
|
|
430
|
+
keepAliveDurationMs?: number;
|
|
431
|
+
/** Max concurrent in-flight probes. Default: 4. */
|
|
432
|
+
budget?: number;
|
|
433
|
+
/** Probe timeout in ms. Default: 5000. */
|
|
434
|
+
probeTimeoutMs?: number;
|
|
435
|
+
/** Auto-refresh expired connections. Default: false. */
|
|
436
|
+
autoRefresh?: boolean;
|
|
437
|
+
/** Route probes through the Wire_Client pool. Default: false. */
|
|
438
|
+
useClientPool?: boolean;
|
|
439
|
+
/** Event observer for prewarm events. */
|
|
440
|
+
onEvent?: (event: PrewarmEvent) => void;
|
|
441
|
+
};
|
|
381
442
|
/**
|
|
382
443
|
* Configuration for the deduplication layer.
|
|
383
444
|
*
|
|
@@ -484,12 +545,18 @@ type PriorityConfig$1 = {
|
|
|
484
545
|
type LifecycleClientConfig = MakeHttpConfig & {
|
|
485
546
|
/** Dedup layer config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
486
547
|
dedup?: DedupConfig$1 | false;
|
|
548
|
+
/** Batch layer config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
549
|
+
batch?: BatchConfig | false;
|
|
487
550
|
/** Cache layer config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
488
551
|
cache?: CacheConfig$1 | false;
|
|
489
552
|
/** Priority scheduler config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
490
553
|
priority?: PriorityConfig$1 | false;
|
|
491
554
|
/** Retry policy. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
492
555
|
retry?: RetryPolicy | false;
|
|
556
|
+
/** Prewarm layer config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
557
|
+
prewarm?: PrewarmLifecycleConfig | false;
|
|
558
|
+
/** Adaptive concurrency limiter config. Set to `false` to explicitly disable. Default: undefined (disabled). */
|
|
559
|
+
adaptiveLimiter?: AdaptiveLimiterConfig | false;
|
|
493
560
|
/** Optional event observer for lifecycle events. */
|
|
494
561
|
onEvent?: (event: LifecycleEvent) => void;
|
|
495
562
|
};
|
|
@@ -514,6 +581,10 @@ type LifecycleClient = HttpClientFn & {
|
|
|
514
581
|
stats: () => LifecycleStats;
|
|
515
582
|
/** Cancel all in-flight and queued requests. Returns an Async_Effect that resolves when complete. */
|
|
516
583
|
cancelAll: () => Async<unknown, never, void>;
|
|
584
|
+
/** Cancel active work and release owned resources such as adaptive limiter timers. */
|
|
585
|
+
shutdown: () => Async<unknown, never, void>;
|
|
586
|
+
/** Adaptive limiter owned by the underlying wire client, when enabled. */
|
|
587
|
+
adaptiveLimiter?: AdaptiveLimiter;
|
|
517
588
|
/** Cache management methods. */
|
|
518
589
|
cache: {
|
|
519
590
|
/** Invalidate a specific cache entry by Cache_Key. */
|
|
@@ -536,7 +607,7 @@ type LifecycleClient = HttpClientFn & {
|
|
|
536
607
|
* - `"queue-dispatch"` — Emitted when a queued request is dispatched to the Wire_Client.
|
|
537
608
|
* - `"retry"` — Emitted when the retry middleware schedules another attempt.
|
|
538
609
|
*/
|
|
539
|
-
type LifecycleEventType = "request-start" | "request-end" | "cache-hit" | "cache-miss" | "dedup-hit" | "dedup-miss" | "queue-enqueue" | "queue-dispatch" | "retry";
|
|
610
|
+
type LifecycleEventType = "request-start" | "request-end" | "cache-hit" | "cache-miss" | "dedup-hit" | "dedup-miss" | "queue-enqueue" | "queue-dispatch" | "retry" | "batch-hit" | "batch-dispatch" | "limit-change";
|
|
540
611
|
/**
|
|
541
612
|
* A lifecycle event emitted to the onEvent observer.
|
|
542
613
|
*
|
|
@@ -561,6 +632,10 @@ type LifecycleEvent = {
|
|
|
561
632
|
cacheKey?: string;
|
|
562
633
|
/** Priority level associated with the event, if applicable. Valid range: 0-9. */
|
|
563
634
|
priority?: number;
|
|
635
|
+
/** Batch_Key associated with the event, if applicable. Present for batch events. */
|
|
636
|
+
batchKey?: string;
|
|
637
|
+
/** Number of requests in the batch, if applicable. Present for batch-dispatch events. */
|
|
638
|
+
batchSize?: number;
|
|
564
639
|
/** Zero-based retry attempt, if applicable. */
|
|
565
640
|
attempt?: number;
|
|
566
641
|
/** Retry delay in milliseconds, if applicable. */
|
|
@@ -569,6 +644,14 @@ type LifecycleEvent = {
|
|
|
569
644
|
status?: number;
|
|
570
645
|
/** HttpError tag that triggered retry, if applicable. */
|
|
571
646
|
errorTag?: string;
|
|
647
|
+
/** Previous concurrency limit, present for limit-change events. */
|
|
648
|
+
previousLimit?: number;
|
|
649
|
+
/** New concurrency limit, present for limit-change events. */
|
|
650
|
+
newLimit?: number;
|
|
651
|
+
/** Gradient value, present for limit-change events. */
|
|
652
|
+
gradient?: number;
|
|
653
|
+
/** Smoothed latency value, present for limit-change events. */
|
|
654
|
+
smoothedLatency?: number;
|
|
572
655
|
};
|
|
573
656
|
/**
|
|
574
657
|
* Lifecycle statistics snapshot.
|
|
@@ -609,6 +692,10 @@ type LifecycleStats = {
|
|
|
609
692
|
requestsFailed: number;
|
|
610
693
|
/** Total number of retry attempts scheduled. */
|
|
611
694
|
retries: number;
|
|
695
|
+
/** Total number of batch dispatches. */
|
|
696
|
+
batchDispatches: number;
|
|
697
|
+
/** Total number of individual requests that were coalesced into batches. */
|
|
698
|
+
batchedRequests: number;
|
|
612
699
|
/** Underlying Wire_Client stats. */
|
|
613
700
|
wire: HttpClientStats;
|
|
614
701
|
};
|
|
@@ -1252,6 +1339,8 @@ declare class LifecycleStatsTracker {
|
|
|
1252
1339
|
private _requestsCompleted;
|
|
1253
1340
|
private _requestsFailed;
|
|
1254
1341
|
private _retries;
|
|
1342
|
+
private _batchDispatches;
|
|
1343
|
+
private _batchedRequests;
|
|
1255
1344
|
private readonly _onEvent;
|
|
1256
1345
|
private readonly _wireStats;
|
|
1257
1346
|
/**
|
|
@@ -1391,6 +1480,15 @@ declare class LifecycleStatsTracker {
|
|
|
1391
1480
|
*/
|
|
1392
1481
|
requestFailed(): void;
|
|
1393
1482
|
retry(): void;
|
|
1483
|
+
/**
|
|
1484
|
+
* Records a batch dispatch. Increments the batch dispatches counter by 1.
|
|
1485
|
+
*/
|
|
1486
|
+
batchDispatch(): void;
|
|
1487
|
+
/**
|
|
1488
|
+
* Records requests that were coalesced into a batch.
|
|
1489
|
+
* @param count - The number of individual requests in the batch.
|
|
1490
|
+
*/
|
|
1491
|
+
batchedRequests(count: number): void;
|
|
1394
1492
|
/**
|
|
1395
1493
|
* Emits a lifecycle event to the registered `onEvent` callback.
|
|
1396
1494
|
*
|
|
@@ -1415,6 +1513,8 @@ declare class LifecycleStatsTracker {
|
|
|
1415
1513
|
emit(type: LifecycleEventType, extra?: {
|
|
1416
1514
|
cacheKey?: string;
|
|
1417
1515
|
priority?: number;
|
|
1516
|
+
batchKey?: string;
|
|
1517
|
+
batchSize?: number;
|
|
1418
1518
|
attempt?: number;
|
|
1419
1519
|
delayMs?: number;
|
|
1420
1520
|
status?: number;
|
|
@@ -1781,6 +1881,149 @@ type RequestBatchingConfig = {
|
|
|
1781
1881
|
};
|
|
1782
1882
|
declare function withRequestBatching(config: RequestBatchingConfig): HttpMiddleware;
|
|
1783
1883
|
|
|
1884
|
+
/**
|
|
1885
|
+
* The PrewarmManager interface for managing connection pre-warming.
|
|
1886
|
+
*/
|
|
1887
|
+
type PrewarmManager = {
|
|
1888
|
+
/** Warm a single origin. Skips if already warm. */
|
|
1889
|
+
warm: (origin: string) => Promise<PrewarmResult>;
|
|
1890
|
+
/** Warm all configured origins. Skips already-warm origins. */
|
|
1891
|
+
warmAll: () => Promise<PrewarmResult[]>;
|
|
1892
|
+
/** Check if an origin has an active warm connection. */
|
|
1893
|
+
isWarm: (origin: string) => boolean;
|
|
1894
|
+
/** Cancel in-flight probe for a specific origin. */
|
|
1895
|
+
cancel: (origin: string) => void;
|
|
1896
|
+
/** Cancel all in-flight and queued probes. */
|
|
1897
|
+
cancelAll: () => void;
|
|
1898
|
+
/** Get a snapshot of all managed origins and their states. */
|
|
1899
|
+
status: () => PrewarmStatusSnapshot;
|
|
1900
|
+
/** Dispose the manager: cancel all, stop timers, release resources. */
|
|
1901
|
+
dispose: () => void;
|
|
1902
|
+
};
|
|
1903
|
+
/**
|
|
1904
|
+
* Creates a PrewarmManager that proactively establishes TCP+TLS connections
|
|
1905
|
+
* to known origins using lightweight HEAD probe requests.
|
|
1906
|
+
*
|
|
1907
|
+
* @param config - Configuration for the prewarm manager.
|
|
1908
|
+
* @returns A PrewarmManager instance.
|
|
1909
|
+
* @throws Error if fetch/AbortController is unavailable or origins are invalid.
|
|
1910
|
+
*/
|
|
1911
|
+
declare function makePrewarmManager(config: PrewarmConfig): PrewarmManager;
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Validates and normalizes an origin string.
|
|
1915
|
+
*
|
|
1916
|
+
* A valid origin is: scheme + host + optional port (e.g., "https://api.example.com" or "http://localhost:3000").
|
|
1917
|
+
* Trailing slashes are stripped. Paths, query strings, and fragments are rejected.
|
|
1918
|
+
*
|
|
1919
|
+
* @param origin - The origin string to validate.
|
|
1920
|
+
* @returns The normalized origin string.
|
|
1921
|
+
* @throws Error if the origin is invalid.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function validateOrigin(origin: string): string;
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* Detects the current runtime platform.
|
|
1927
|
+
*
|
|
1928
|
+
* @returns "browser" if running in a browser environment, "node" otherwise.
|
|
1929
|
+
*/
|
|
1930
|
+
declare function detectPlatform(): "browser" | "node";
|
|
1931
|
+
/**
|
|
1932
|
+
* Validates that the global `fetch` API is available.
|
|
1933
|
+
*
|
|
1934
|
+
* @throws Error if `fetch` or `AbortController` is not available.
|
|
1935
|
+
*/
|
|
1936
|
+
declare function validateFetchAvailable(): void;
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Outcome of a probe request.
|
|
1940
|
+
*/
|
|
1941
|
+
type ProbeOutcome = {
|
|
1942
|
+
/** Whether the probe succeeded (connection established). */
|
|
1943
|
+
ok: boolean;
|
|
1944
|
+
/** Duration of the probe in milliseconds. */
|
|
1945
|
+
durationMs: number;
|
|
1946
|
+
/** Error message if the probe failed. */
|
|
1947
|
+
error?: string;
|
|
1948
|
+
};
|
|
1949
|
+
/**
|
|
1950
|
+
* Options for executing a probe request.
|
|
1951
|
+
*/
|
|
1952
|
+
type ProbeOptions = {
|
|
1953
|
+
/** Probe timeout in milliseconds. */
|
|
1954
|
+
timeoutMs: number;
|
|
1955
|
+
/** AbortSignal for external cancellation. */
|
|
1956
|
+
signal: AbortSignal;
|
|
1957
|
+
/** Runtime platform. */
|
|
1958
|
+
platform: "browser" | "node";
|
|
1959
|
+
/** Optional Wire_Client to route through (when useClientPool is true). */
|
|
1960
|
+
client?: HttpClientFn;
|
|
1961
|
+
};
|
|
1962
|
+
/**
|
|
1963
|
+
* Executes a HEAD probe request to the root path of the given origin.
|
|
1964
|
+
*
|
|
1965
|
+
* The probe is a lightweight HEAD request to `${origin}/` designed to trigger
|
|
1966
|
+
* TCP+TLS connection establishment in the platform's connection pool.
|
|
1967
|
+
*
|
|
1968
|
+
* @param origin - The validated origin to probe (e.g., "https://api.example.com").
|
|
1969
|
+
* @param options - Probe configuration options.
|
|
1970
|
+
* @returns A ProbeOutcome indicating success or failure.
|
|
1971
|
+
*/
|
|
1972
|
+
declare function executeProbe(origin: string, options: ProbeOptions): Promise<ProbeOutcome>;
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Interface for the connection state map.
|
|
1976
|
+
*/
|
|
1977
|
+
type ConnectionStateMap = {
|
|
1978
|
+
/** Mark an origin as warm with the current timestamp. */
|
|
1979
|
+
markWarm: (origin: string, now?: number) => void;
|
|
1980
|
+
/** Mark an origin as expired. */
|
|
1981
|
+
markExpired: (origin: string) => void;
|
|
1982
|
+
/** Mark an origin as idle (reset state). */
|
|
1983
|
+
markIdle: (origin: string) => void;
|
|
1984
|
+
/** Mark an origin as probing. */
|
|
1985
|
+
markProbing: (origin: string) => void;
|
|
1986
|
+
/** Check if an origin is currently warm (not expired). */
|
|
1987
|
+
isWarm: (origin: string, now?: number) => boolean;
|
|
1988
|
+
/** Get the current state of an origin. */
|
|
1989
|
+
getState: (origin: string) => PrewarmOriginState | undefined;
|
|
1990
|
+
/** Get a snapshot of all managed origins. */
|
|
1991
|
+
snapshot: () => PrewarmStatusSnapshot;
|
|
1992
|
+
};
|
|
1993
|
+
/**
|
|
1994
|
+
* Creates a connection state map for tracking per-origin warm/expired/idle states.
|
|
1995
|
+
*
|
|
1996
|
+
* @param origins - Array of origin strings to manage.
|
|
1997
|
+
* @param keepAliveDurationMs - Duration in ms after which a warm connection expires.
|
|
1998
|
+
* @returns A ConnectionStateMap instance.
|
|
1999
|
+
*/
|
|
2000
|
+
declare function makeConnectionStateMap(origins: string[], keepAliveDurationMs: number): ConnectionStateMap;
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* A lightweight counting semaphore that limits concurrent in-flight operations.
|
|
2004
|
+
*/
|
|
2005
|
+
type BudgetSemaphore = {
|
|
2006
|
+
/** Acquire a slot. Resolves with a release handle when a slot is available. */
|
|
2007
|
+
acquire: () => Promise<{
|
|
2008
|
+
release: () => void;
|
|
2009
|
+
}>;
|
|
2010
|
+
/** Try to acquire a slot synchronously. Returns undefined if no slot is available. */
|
|
2011
|
+
tryAcquire: () => {
|
|
2012
|
+
release: () => void;
|
|
2013
|
+
} | undefined;
|
|
2014
|
+
/** Number of currently available slots. */
|
|
2015
|
+
available: () => number;
|
|
2016
|
+
/** Number of waiters currently queued. */
|
|
2017
|
+
queued: () => number;
|
|
2018
|
+
};
|
|
2019
|
+
/**
|
|
2020
|
+
* Creates a budget semaphore with the given capacity.
|
|
2021
|
+
*
|
|
2022
|
+
* @param capacity - Maximum number of concurrent slots. Must be >= 1.
|
|
2023
|
+
* @returns A BudgetSemaphore instance.
|
|
2024
|
+
*/
|
|
2025
|
+
declare function makeBudgetSemaphore(capacity: number): BudgetSemaphore;
|
|
2026
|
+
|
|
1784
2027
|
type ConnectionPrewarmAttempt = {
|
|
1785
2028
|
url: string;
|
|
1786
2029
|
origin: string;
|
|
@@ -1834,4 +2077,307 @@ declare function prewarmConnections(config?: ConnectionPrewarmConfig): Async<unk
|
|
|
1834
2077
|
declare const prewarmHttpConnections: typeof prewarmConnections;
|
|
1835
2078
|
declare function withConnectionPrewarming(config?: ConnectionPrewarmingMiddlewareConfig): HttpMiddleware;
|
|
1836
2079
|
|
|
1837
|
-
|
|
2080
|
+
type InitNoMethodBody = Omit<RequestInit, "method" | "body"> & {
|
|
2081
|
+
timeoutMs?: number;
|
|
2082
|
+
poolKey?: string;
|
|
2083
|
+
headers?: unknown;
|
|
2084
|
+
} & HttpRequestPolicyInit;
|
|
2085
|
+
type InitWithHeaders = {
|
|
2086
|
+
headers?: unknown;
|
|
2087
|
+
timeoutMs?: number;
|
|
2088
|
+
poolKey?: string;
|
|
2089
|
+
} & HttpRequestPolicyInit & Record<string, unknown>;
|
|
2090
|
+
type HttpJsonInit<Validator extends AnyJsonSchemaLike> = InitNoMethodBody & {
|
|
2091
|
+
readonly schema: Validator;
|
|
2092
|
+
readonly schemaName?: string;
|
|
2093
|
+
};
|
|
2094
|
+
type HttpPostJsonInit<Validator extends AnyJsonSchemaLike> = InitWithHeaders & {
|
|
2095
|
+
readonly schema: Validator;
|
|
2096
|
+
readonly schemaName?: string;
|
|
2097
|
+
readonly bodySchema?: undefined;
|
|
2098
|
+
readonly bodySchemaName?: string;
|
|
2099
|
+
};
|
|
2100
|
+
type HttpPostJsonSchemaBodyInit<Validator extends AnyJsonSchemaLike, BodyValidator extends AnyJsonSchemaLike> = InitWithHeaders & {
|
|
2101
|
+
readonly schema: Validator;
|
|
2102
|
+
readonly schemaName?: string;
|
|
2103
|
+
readonly bodySchema: BodyValidator;
|
|
2104
|
+
readonly bodySchemaName?: string;
|
|
2105
|
+
};
|
|
2106
|
+
type HttpPostJsonBodyInit<BodyValidator extends AnyJsonSchemaLike> = InitWithHeaders & {
|
|
2107
|
+
readonly schema?: undefined;
|
|
2108
|
+
readonly schemaName?: string;
|
|
2109
|
+
readonly bodySchema: BodyValidator;
|
|
2110
|
+
readonly bodySchemaName?: string;
|
|
2111
|
+
};
|
|
2112
|
+
type JsonInitNoSchema = InitNoMethodBody & {
|
|
2113
|
+
readonly schema?: undefined;
|
|
2114
|
+
readonly schemaName?: string;
|
|
2115
|
+
};
|
|
2116
|
+
type PostJsonInitNoSchema = InitWithHeaders & {
|
|
2117
|
+
readonly schema?: undefined;
|
|
2118
|
+
readonly schemaName?: string;
|
|
2119
|
+
readonly bodySchema?: undefined;
|
|
2120
|
+
readonly bodySchemaName?: string;
|
|
2121
|
+
};
|
|
2122
|
+
type DefaultGetJson = {
|
|
2123
|
+
<Validator extends AnyJsonSchemaLike>(url: string, init: HttpJsonInit<Validator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
2124
|
+
<A = unknown>(url: string, init?: JsonInitNoSchema): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
2125
|
+
};
|
|
2126
|
+
type DefaultPostJson = {
|
|
2127
|
+
<Validator extends AnyJsonSchemaLike, BodyValidator extends AnyJsonSchemaLike>(url: string, bodyObj: InferJsonSchema<BodyValidator>, init: HttpPostJsonSchemaBodyInit<Validator, BodyValidator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
2128
|
+
<BodyValidator extends AnyJsonSchemaLike, A = unknown>(url: string, bodyObj: InferJsonSchema<BodyValidator>, init: HttpPostJsonBodyInit<BodyValidator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
2129
|
+
<Validator extends AnyJsonSchemaLike>(url: string, bodyObj: unknown, init: HttpPostJsonInit<Validator>): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<InferJsonSchema<Validator>>>;
|
|
2130
|
+
<A = unknown>(url: string, bodyObj: unknown, init?: PostJsonInitNoSchema): AsyncWithPromise<unknown, HttpError | ValidationError, HttpResponse<A>>;
|
|
2131
|
+
};
|
|
2132
|
+
type DefaultHttpClientPreset = "minimal" | "balanced" | "default" | "production";
|
|
2133
|
+
type DefaultHttpClientFeatures = {
|
|
2134
|
+
readonly dedup: boolean;
|
|
2135
|
+
readonly batch: boolean;
|
|
2136
|
+
readonly cache: boolean;
|
|
2137
|
+
readonly priority: boolean;
|
|
2138
|
+
readonly retry: boolean;
|
|
2139
|
+
readonly prewarm: boolean;
|
|
2140
|
+
readonly adaptiveLimiter: boolean;
|
|
2141
|
+
readonly compression: boolean;
|
|
2142
|
+
readonly middleware: number;
|
|
2143
|
+
};
|
|
2144
|
+
type DefaultHttpClientConfig = LifecycleClientConfig & {
|
|
2145
|
+
/**
|
|
2146
|
+
* Preset used as the baseline before caller overrides are applied.
|
|
2147
|
+
* - minimal: wire client + timeout only.
|
|
2148
|
+
* - balanced: retry, priority, dedup, adaptive limiter, response compression.
|
|
2149
|
+
* - default: balanced + short safe-method response cache.
|
|
2150
|
+
* - production: stable alias for the full production-ready default preset.
|
|
2151
|
+
*/
|
|
2152
|
+
readonly preset?: DefaultHttpClientPreset;
|
|
2153
|
+
/** Response decompression. Enabled by balanced/default presets; set false to disable. */
|
|
2154
|
+
readonly compression?: CompressionConfig | false;
|
|
2155
|
+
/** Extra middleware applied outermost after the preset stack, e.g. withHttpObservability(obs). */
|
|
2156
|
+
readonly middleware?: readonly HttpMiddleware[];
|
|
2157
|
+
/**
|
|
2158
|
+
* Named per-request policy presets. Requests can use `policy: "readModel"` or
|
|
2159
|
+
* `policy: { preset: "readModel", ...overrides }`.
|
|
2160
|
+
*/
|
|
2161
|
+
readonly policyPresets?: HttpPolicyPresets;
|
|
2162
|
+
};
|
|
2163
|
+
type DefaultHttpClient = {
|
|
2164
|
+
readonly request: (req: HttpRequest) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
2165
|
+
readonly get: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
2166
|
+
readonly post: (url: string, body?: string, init?: InitWithHeaders) => AsyncWithPromise<unknown, HttpError, HttpWireResponse>;
|
|
2167
|
+
readonly getText: (url: string, init?: InitNoMethodBody) => AsyncWithPromise<unknown, HttpError, HttpResponse<string>>;
|
|
2168
|
+
readonly getJson: DefaultGetJson;
|
|
2169
|
+
readonly postJson: DefaultPostJson;
|
|
2170
|
+
readonly with: (mw: HttpMiddleware) => DefaultHttpClient;
|
|
2171
|
+
readonly wire: LifecycleClient;
|
|
2172
|
+
readonly stats: () => LifecycleStats;
|
|
2173
|
+
readonly cache: LifecycleClient["cache"];
|
|
2174
|
+
readonly cancelAll: LifecycleClient["cancelAll"];
|
|
2175
|
+
readonly shutdown: LifecycleClient["shutdown"];
|
|
2176
|
+
readonly preset: DefaultHttpClientPreset;
|
|
2177
|
+
readonly features: DefaultHttpClientFeatures;
|
|
2178
|
+
readonly compression?: {
|
|
2179
|
+
readonly stats: () => CompressionStats;
|
|
2180
|
+
};
|
|
2181
|
+
};
|
|
2182
|
+
declare const defaultHttpClientPreset: DefaultHttpClientPreset;
|
|
2183
|
+
/**
|
|
2184
|
+
* Creates the recommended default HTTP client.
|
|
2185
|
+
*
|
|
2186
|
+
* The returned client has the easy JSON/text helpers from `httpClient`, but its
|
|
2187
|
+
* wire path is the full lifecycle stack: priority, retry, cache, batch, dedup,
|
|
2188
|
+
* adaptive concurrency, optional prewarm, compression, stats, and cancelAll.
|
|
2189
|
+
*/
|
|
2190
|
+
declare function makeDefaultHttpClient(config?: DefaultHttpClientConfig): DefaultHttpClient;
|
|
2191
|
+
|
|
2192
|
+
type HttpClientBuilder = {
|
|
2193
|
+
readonly config: () => DefaultHttpClientConfig;
|
|
2194
|
+
readonly baseUrl: (baseUrl: string) => HttpClientBuilder;
|
|
2195
|
+
readonly header: (name: string, value: string) => HttpClientBuilder;
|
|
2196
|
+
readonly headers: (headers: Record<string, string>) => HttpClientBuilder;
|
|
2197
|
+
readonly timeoutMs: (timeoutMs: number) => HttpClientBuilder;
|
|
2198
|
+
readonly timeout: (timeoutMs: number) => HttpClientBuilder;
|
|
2199
|
+
readonly transport: (transport: HttpTransport) => HttpClientBuilder;
|
|
2200
|
+
readonly preset: (preset: DefaultHttpClientPreset) => HttpClientBuilder;
|
|
2201
|
+
readonly minimal: () => HttpClientBuilder;
|
|
2202
|
+
readonly balanced: () => HttpClientBuilder;
|
|
2203
|
+
readonly defaultPreset: () => HttpClientBuilder;
|
|
2204
|
+
readonly production: () => HttpClientBuilder;
|
|
2205
|
+
readonly dedup: (config?: DedupConfig$1 | false) => HttpClientBuilder;
|
|
2206
|
+
readonly noDedup: () => HttpClientBuilder;
|
|
2207
|
+
readonly batch: (config: BatchConfig | false) => HttpClientBuilder;
|
|
2208
|
+
readonly noBatch: () => HttpClientBuilder;
|
|
2209
|
+
readonly cache: (config?: CacheConfig$1 | false) => HttpClientBuilder;
|
|
2210
|
+
readonly noCache: () => HttpClientBuilder;
|
|
2211
|
+
readonly priority: (config?: PriorityConfig$1 | false) => HttpClientBuilder;
|
|
2212
|
+
readonly noPriority: () => HttpClientBuilder;
|
|
2213
|
+
readonly retry: (config?: RetryPolicy | false) => HttpClientBuilder;
|
|
2214
|
+
readonly noRetry: () => HttpClientBuilder;
|
|
2215
|
+
readonly prewarm: (config?: PrewarmLifecycleConfig | false) => HttpClientBuilder;
|
|
2216
|
+
readonly noPrewarm: () => HttpClientBuilder;
|
|
2217
|
+
readonly adaptiveLimiter: (config?: AdaptiveLimiterConfig | false) => HttpClientBuilder;
|
|
2218
|
+
readonly adaptiveLimiterPreset: (preset: AdaptiveLimiterPreset, overrides?: AdaptiveLimiterConfig) => HttpClientBuilder;
|
|
2219
|
+
readonly conservativeLimiter: (overrides?: AdaptiveLimiterConfig) => HttpClientBuilder;
|
|
2220
|
+
readonly balancedLimiter: (overrides?: AdaptiveLimiterConfig) => HttpClientBuilder;
|
|
2221
|
+
readonly aggressiveLimiter: (overrides?: AdaptiveLimiterConfig) => HttpClientBuilder;
|
|
2222
|
+
readonly noAdaptiveLimiter: () => HttpClientBuilder;
|
|
2223
|
+
readonly pool: (config?: HttpPoolConfig | false) => HttpClientBuilder;
|
|
2224
|
+
readonly noPool: () => HttpClientBuilder;
|
|
2225
|
+
readonly compression: (config?: CompressionConfig | false) => HttpClientBuilder;
|
|
2226
|
+
readonly noCompression: () => HttpClientBuilder;
|
|
2227
|
+
readonly middleware: (mw: HttpMiddleware) => HttpClientBuilder;
|
|
2228
|
+
readonly use: (mw: HttpMiddleware) => HttpClientBuilder;
|
|
2229
|
+
readonly configure: (config: DefaultHttpClientConfig) => HttpClientBuilder;
|
|
2230
|
+
readonly build: () => DefaultHttpClient;
|
|
2231
|
+
readonly buildWire: () => LifecycleClient;
|
|
2232
|
+
};
|
|
2233
|
+
declare function httpClientBuilder(config?: DefaultHttpClientConfig): HttpClientBuilder;
|
|
2234
|
+
declare const makeHttpClientBuilder: typeof httpClientBuilder;
|
|
2235
|
+
declare const httpBuilder: typeof httpClientBuilder;
|
|
2236
|
+
|
|
2237
|
+
type HttpServerMethod = HttpMethod | "ALL";
|
|
2238
|
+
type HttpServerHeaders = Record<string, string>;
|
|
2239
|
+
type HttpServerQuery = Record<string, string | readonly string[]>;
|
|
2240
|
+
type HttpServerParams = Record<string, string>;
|
|
2241
|
+
type HttpServerBody = string | Uint8Array | ArrayBuffer | unknown;
|
|
2242
|
+
type HttpServerRequest = {
|
|
2243
|
+
readonly method: string;
|
|
2244
|
+
readonly url: string;
|
|
2245
|
+
readonly path: string;
|
|
2246
|
+
readonly target: string;
|
|
2247
|
+
readonly headers: HttpServerHeaders;
|
|
2248
|
+
readonly query: HttpServerQuery;
|
|
2249
|
+
readonly params: HttpServerParams;
|
|
2250
|
+
readonly bodyText: string;
|
|
2251
|
+
readonly raw?: unknown;
|
|
2252
|
+
};
|
|
2253
|
+
type HttpServerContext<Params = HttpServerParams, Query = HttpServerQuery, Body = unknown> = Omit<HttpServerRequest, "params" | "query"> & {
|
|
2254
|
+
readonly route: string;
|
|
2255
|
+
readonly params: Params;
|
|
2256
|
+
readonly query: Query;
|
|
2257
|
+
readonly body: Body;
|
|
2258
|
+
};
|
|
2259
|
+
type HttpServerResponse<Body = unknown> = {
|
|
2260
|
+
readonly status?: number;
|
|
2261
|
+
readonly headers?: HttpServerHeaders;
|
|
2262
|
+
readonly body?: Body;
|
|
2263
|
+
};
|
|
2264
|
+
type HttpServerHandler<R = unknown, E = unknown, Params = HttpServerParams, Query = HttpServerQuery, Body = unknown, ResponseBody = unknown> = (ctx: HttpServerContext<Params, Query, Body>) => Async<R, E, HttpServerResponse<ResponseBody>>;
|
|
2265
|
+
type HttpServerMiddleware = (next: HttpServerHandler<any, any, any, any, any, any>) => HttpServerHandler<any, any, any, any, any, any>;
|
|
2266
|
+
type HttpRouteSchemas<ParamsSchema extends AnyJsonSchemaLike | undefined = undefined, QuerySchema extends AnyJsonSchemaLike | undefined = undefined, BodySchema extends AnyJsonSchemaLike | undefined = undefined, ResponseSchema extends AnyJsonSchemaLike | undefined = undefined> = {
|
|
2267
|
+
readonly params?: ParamsSchema;
|
|
2268
|
+
readonly paramsSchemaName?: string;
|
|
2269
|
+
readonly query?: QuerySchema;
|
|
2270
|
+
readonly querySchemaName?: string;
|
|
2271
|
+
readonly body?: BodySchema;
|
|
2272
|
+
readonly bodySchemaName?: string;
|
|
2273
|
+
readonly response?: ResponseSchema;
|
|
2274
|
+
readonly responseSchemaName?: string;
|
|
2275
|
+
};
|
|
2276
|
+
type HttpRouteOptions<ParamsSchema extends AnyJsonSchemaLike | undefined = undefined, QuerySchema extends AnyJsonSchemaLike | undefined = undefined, BodySchema extends AnyJsonSchemaLike | undefined = undefined, ResponseSchema extends AnyJsonSchemaLike | undefined = undefined> = HttpRouteSchemas<ParamsSchema, QuerySchema, BodySchema, ResponseSchema> & {
|
|
2277
|
+
readonly middleware?: readonly HttpServerMiddleware[];
|
|
2278
|
+
};
|
|
2279
|
+
type HttpRuntimeHealthRouteOptions = RuntimeHealthOptions & {
|
|
2280
|
+
readonly path?: string;
|
|
2281
|
+
};
|
|
2282
|
+
type InferServerPart<Schema, Fallback> = Schema extends AnyJsonSchemaLike ? InferJsonSchema<Schema> : Fallback;
|
|
2283
|
+
type RoutePathParamNames<Path extends string> = Path extends `${string}:${infer Param}/${infer Rest}` ? StripRouteParamModifier<Param> | RoutePathParamNames<`/${Rest}`> : Path extends `${string}:${infer Param}` ? StripRouteParamModifier<Param> : never;
|
|
2284
|
+
type RoutePathParams<Path extends string> = [
|
|
2285
|
+
RoutePathParamNames<Path>
|
|
2286
|
+
] extends [never] ? {} : {
|
|
2287
|
+
readonly [Key in RoutePathParamNames<Path>]: string;
|
|
2288
|
+
};
|
|
2289
|
+
type StripRouteParamModifier<Param extends string> = Param extends `${infer Name}?` ? Name : Param extends `${infer Name}+` ? Name : Param extends `${infer Name}*` ? Name : Param;
|
|
2290
|
+
type HttpServerRoute<R = unknown, E = unknown, Path extends string = string, ParamsSchema extends AnyJsonSchemaLike | undefined = AnyJsonSchemaLike | undefined, QuerySchema extends AnyJsonSchemaLike | undefined = AnyJsonSchemaLike | undefined, BodySchema extends AnyJsonSchemaLike | undefined = AnyJsonSchemaLike | undefined, ResponseSchema extends AnyJsonSchemaLike | undefined = AnyJsonSchemaLike | undefined> = {
|
|
2291
|
+
readonly method: HttpServerMethod;
|
|
2292
|
+
readonly path: Path;
|
|
2293
|
+
readonly options: HttpRouteOptions<ParamsSchema, QuerySchema, BodySchema, ResponseSchema>;
|
|
2294
|
+
readonly handler: HttpServerHandler<R, E, InferServerPart<ParamsSchema, RoutePathParams<Path>>, InferServerPart<QuerySchema, HttpServerQuery>, InferServerPart<BodySchema, unknown>, InferServerPart<ResponseSchema, unknown>>;
|
|
2295
|
+
readonly match: (path: string) => HttpServerParams | undefined;
|
|
2296
|
+
};
|
|
2297
|
+
type HttpRouterOptions = {
|
|
2298
|
+
readonly middleware?: readonly HttpServerMiddleware[];
|
|
2299
|
+
readonly includeErrorDetails?: boolean;
|
|
2300
|
+
};
|
|
2301
|
+
type HttpRouteMatch = {
|
|
2302
|
+
readonly _tag: "Match";
|
|
2303
|
+
readonly route: HttpServerRoute<any, any, any, any, any, any, any>;
|
|
2304
|
+
readonly params: HttpServerParams;
|
|
2305
|
+
} | {
|
|
2306
|
+
readonly _tag: "MethodNotAllowed";
|
|
2307
|
+
readonly route: HttpServerRoute<any, any, any, any, any, any, any>;
|
|
2308
|
+
readonly allowed: readonly HttpServerMethod[];
|
|
2309
|
+
} | {
|
|
2310
|
+
readonly _tag: "NotFound";
|
|
2311
|
+
};
|
|
2312
|
+
type HttpRouter = {
|
|
2313
|
+
readonly routes: readonly HttpServerRoute<any, any, any, any, any, any, any>[];
|
|
2314
|
+
readonly match: (method: string, path: string) => HttpRouteMatch;
|
|
2315
|
+
readonly handle: (request: HttpServerRequest, match?: HttpRouteMatch) => Async<unknown, never, HttpServerResponse>;
|
|
2316
|
+
readonly listen: <R extends object = {}>(options?: Omit<NodeHttpServerOptions<R>, "router">) => Resource<unknown, NodeHttpServerError, NodeHttpServerHandle>;
|
|
2317
|
+
};
|
|
2318
|
+
type NodeHttpServerError = {
|
|
2319
|
+
readonly _tag: "ListenError";
|
|
2320
|
+
readonly error: unknown;
|
|
2321
|
+
readonly message: string;
|
|
2322
|
+
} | {
|
|
2323
|
+
readonly _tag: "ServerClosed";
|
|
2324
|
+
readonly message: string;
|
|
2325
|
+
};
|
|
2326
|
+
type NodeHttpServerHandle = {
|
|
2327
|
+
readonly server: Server;
|
|
2328
|
+
readonly router: HttpRouter;
|
|
2329
|
+
readonly address: () => AddressInfo | string | null;
|
|
2330
|
+
readonly url: () => string | undefined;
|
|
2331
|
+
readonly close: () => Promise<void>;
|
|
2332
|
+
};
|
|
2333
|
+
type NodeHttpServerOptions<R extends object = {}> = {
|
|
2334
|
+
readonly router: HttpRouter | readonly HttpServerRoute<any, any, any, any, any, any, any>[];
|
|
2335
|
+
readonly host?: string;
|
|
2336
|
+
readonly port?: number;
|
|
2337
|
+
readonly env?: R;
|
|
2338
|
+
readonly runtime?: Runtime<R>;
|
|
2339
|
+
readonly runtimeOptions?: Omit<RuntimeOptions<R>, "env" | "hooks">;
|
|
2340
|
+
readonly observability?: Observability;
|
|
2341
|
+
readonly observabilityOptions?: HttpServerObservabilityOptions<HttpServerResponse>;
|
|
2342
|
+
readonly maxBodyBytes?: number;
|
|
2343
|
+
readonly gracefulShutdownMs?: number;
|
|
2344
|
+
readonly shutdownPollSchedule?: Schedule<NodeHttpServerShutdownState, unknown>;
|
|
2345
|
+
readonly onError?: (error: unknown) => void;
|
|
2346
|
+
};
|
|
2347
|
+
type NodeHttpServerShutdownState = {
|
|
2348
|
+
readonly listening: boolean;
|
|
2349
|
+
readonly elapsedMs: number;
|
|
2350
|
+
};
|
|
2351
|
+
declare function route<Path extends string, ParamsSchema extends AnyJsonSchemaLike | undefined = undefined, QuerySchema extends AnyJsonSchemaLike | undefined = undefined, BodySchema extends AnyJsonSchemaLike | undefined = undefined, ResponseSchema extends AnyJsonSchemaLike | undefined = undefined, R = unknown, E = unknown>(method: HttpServerMethod, path: Path, options: HttpRouteOptions<ParamsSchema, QuerySchema, BodySchema, ResponseSchema>, handler: HttpServerHandler<R, E, InferServerPart<ParamsSchema, RoutePathParams<Path>>, InferServerPart<QuerySchema, HttpServerQuery>, InferServerPart<BodySchema, unknown>, InferServerPart<ResponseSchema, unknown>>): HttpServerRoute<R, E, Path, ParamsSchema, QuerySchema, BodySchema, ResponseSchema>;
|
|
2352
|
+
declare function route<Path extends string, R = unknown, E = unknown>(method: HttpServerMethod, path: Path, handler: HttpServerHandler<R, E, RoutePathParams<Path>>): HttpServerRoute<R, E, Path, undefined, undefined, undefined, undefined>;
|
|
2353
|
+
declare const httpRoute: typeof route;
|
|
2354
|
+
declare function makeHttpRouter(routes: readonly HttpServerRoute<any, any, any, any, any, any, any>[], options?: HttpRouterOptions): HttpRouter;
|
|
2355
|
+
declare function json<Body>(body: Body, init?: Omit<HttpServerResponse<Body>, "body">): HttpServerResponse<Body>;
|
|
2356
|
+
declare function text(body: string, init?: Omit<HttpServerResponse<string>, "body">): HttpServerResponse<string>;
|
|
2357
|
+
declare function empty(status?: number, headers?: HttpServerHeaders): HttpServerResponse<void>;
|
|
2358
|
+
declare function makeRuntimeHealthRoute(options?: HttpRuntimeHealthRouteOptions): HttpServerRoute<unknown, never, string, undefined, undefined, undefined, undefined>;
|
|
2359
|
+
declare function makeRuntimeReadinessRoute(options?: HttpRuntimeHealthRouteOptions): HttpServerRoute<unknown, never, string, undefined, undefined, undefined, undefined>;
|
|
2360
|
+
declare const runtimeHealthRoute: typeof makeRuntimeHealthRoute;
|
|
2361
|
+
declare const runtimeReadinessRoute: typeof makeRuntimeReadinessRoute;
|
|
2362
|
+
declare function withResponseHeader(name: string, value: string): HttpServerMiddleware;
|
|
2363
|
+
declare function makeNodeHttpServer<R extends object = {}>(options: NodeHttpServerOptions<R>): Async<unknown, NodeHttpServerError, NodeHttpServerHandle>;
|
|
2364
|
+
declare function nodeHttpServerResource<R extends object = {}>(options: NodeHttpServerOptions<R>): Resource<unknown, NodeHttpServerError, NodeHttpServerHandle>;
|
|
2365
|
+
declare const makeNodeHttpServerResource: typeof nodeHttpServerResource;
|
|
2366
|
+
declare const makeHttpServerResource: typeof nodeHttpServerResource;
|
|
2367
|
+
declare const HttpServer: Readonly<{
|
|
2368
|
+
route: typeof route;
|
|
2369
|
+
httpRoute: typeof route;
|
|
2370
|
+
router: typeof makeHttpRouter;
|
|
2371
|
+
listen: typeof makeNodeHttpServer;
|
|
2372
|
+
resource: typeof nodeHttpServerResource;
|
|
2373
|
+
json: typeof json;
|
|
2374
|
+
text: typeof text;
|
|
2375
|
+
empty: typeof empty;
|
|
2376
|
+
healthRoute: typeof makeRuntimeHealthRoute;
|
|
2377
|
+
readinessRoute: typeof makeRuntimeReadinessRoute;
|
|
2378
|
+
middleware: Readonly<{
|
|
2379
|
+
header: typeof withResponseHeader;
|
|
2380
|
+
}>;
|
|
2381
|
+
}>;
|
|
2382
|
+
|
|
2383
|
+
export { AdaptiveLimiter, AdaptiveLimiterConfig, AdaptiveLimiterPreset, AnyJsonSchemaLike, type BatchConfig, type BatchFunction, type BudgetSemaphore, type CacheConfig$1 as CacheConfig, type CacheKeyComponents, type CachePolicyResult$1 as CachePolicyResult, type CompressionConfig, type CompressionMiddlewareResult, type CompressionStats, type ConnectionPrewarmAttempt, type ConnectionPrewarmConfig, type ConnectionPrewarmEvent, type ConnectionPrewarmResult, type ConnectionPrewarmingMiddlewareConfig, type ConnectionStateMap, DEFAULT_CACHE_RELEVANT_HEADERS, type DecompressResult, type Decompressor, type DedupConfig$1 as DedupConfig, type DefaultGetJson, type DefaultHttpClient, type DefaultHttpClientConfig, type DefaultHttpClientFeatures, type DefaultHttpClientPreset, type DefaultPostJson, type Dx, EmaComputer, type HttpCircuitBreakerConfig, HttpClient, type HttpClientBuilder, HttpClientFn, HttpClientStats, HttpClientStream, HttpError, type HttpJsonInit, type HttpMeta, HttpMethod, HttpMiddleware, HttpPolicyPresets, HttpPoolConfig, type HttpPostJsonBodyInit, type HttpPostJsonInit, type HttpPostJsonSchemaBodyInit, HttpRequest, HttpRequestPolicyRef, HttpRequestRetryOverride, type HttpResponse, type HttpResponseWithMeta, type HttpRouteMatch, type HttpRouteOptions, type HttpRouteSchemas, type HttpRouter, type HttpRouterOptions, type HttpRuntimeHealthRouteOptions, HttpServer, type HttpServerBody, type HttpServerContext, type HttpServerHandler, type HttpServerHeaders, type HttpServerMethod, type HttpServerMiddleware, type HttpServerParams, type HttpServerQuery, type HttpServerRequest, type HttpServerResponse, type HttpServerRoute, HttpTransport, HttpWireResponse, HttpWireResponseStream, type HttpWireWithMeta, InferJsonSchema, type InferServerPart, LRUCache, type LRUCacheConfig, LatencyWindow, type LifecycleClient, type LifecycleClientConfig, type LifecycleEvent, type LifecycleEventType, type LifecycleRequestOptions, type LifecycleStats, LifecycleStatsTracker, type LogEvent, MakeHttpConfig, type NodeHttpServerError, type NodeHttpServerHandle, type NodeHttpServerOptions, type NodeHttpServerShutdownState, type PrewarmConfig, type PrewarmEvent, type PrewarmEventType, type PrewarmLifecycleConfig, type PrewarmManager, type PrewarmOriginState, type PrewarmOriginStatus, type PrewarmResult, type PrewarmResultStatus, type PrewarmStatusSnapshot, type PriorityConfig$1 as PriorityConfig, PriorityQueue, type PriorityQueueEntry, type ProbeOutcome, type RequestBatchingConfig, type RequestBatchingEvent, type RequestCompressionConfig, type RequestCompressionMiddlewareResult, type RequestCompressionStats, RetryPolicy, type RoutePathParamNames, type RoutePathParams, SEPARATOR, SUPPORTED_ENCODINGS, type SupportedEncoding, ValidationError, clampPriority, computeCacheKey, computeGradient, computeNewLimit, defaultHttpClientPreset, detectPlatform, empty, executeProbe, httpBuilder, httpClient, httpClientBuilder, httpClientStream, httpClientWithMeta, httpRoute, json, makeBudgetSemaphore, makeCompressionMiddleware, makeConnectionStateMap, makeDefaultHttpClient, makeHttpClient, makeHttpClientBuilder, makeHttpRouter, makeHttpServerResource, makeLifecycleClient, makeNodeHttpServer, makeNodeHttpServerResource, makePrewarmManager, makeRequestCompressionMiddleware, makeResponseCompressionMiddleware, makeRuntimeHealthRoute, makeRuntimeReadinessRoute, nodeHttpServerResource, parseCacheKey, prewarmConnections, prewarmHttpConnections, route, runtimeHealthRoute, runtimeReadinessRoute, text, validateFetchAvailable, validateOrigin, withAuth, withBatch, withCache, withCircuitBreaker, withConnectionPrewarming, withDedup, withLogging, withPriority, withRequestBatching, withResponseHeader, withResponseTransform, withTracing };
|