@hyperttp/core 1.3.1 → 1.3.3

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 CHANGED
@@ -12,167 +12,240 @@
12
12
  ---
13
13
 
14
14
  **Hyperttp** is a high-performance, isomorphic HTTP client designed for modern Node.js and Bun environments.
15
- It is built as a thin core with an intelligent transport selection strategy and a powerful plugin system.
15
+ It is built as a highly optimized, thin core featuring an intelligent transport layer and an advanced
16
+ pipeline‑based plugin architecture.
17
+
18
+ ## 🔥 Key Features
19
+
20
+ - **⚡ Zero-Overhead Hot Paths:** Fast header merging, response mapping, and object creation loops optimized for
21
+ high-throughput environments.
22
+ - **📍 LRU URL Caching:** Built-in string URL parsing cache (up to 512 entries) with automatic eviction to bypass
23
+ repetitive `new URL()` overhead.
24
+ - **🔀 Intelligent Isomorphism:** Automatically switches between optimal underlying transports (Native Bun, Undici,
25
+ or Node.js native `http`) while maintaining a unified, clean API.
26
+ - **🔌 Multi-Stage Hooks & Pipelines:** Granular control over the request lifecycle with sorted hook priorities
27
+ and short-circuit capabilities.
28
+ - **🗜️ Transparent Decompression:** Automatic out-of-the-box handling of `gzip`, `deflate`, and `br` (Brotli)
29
+ content-encodings for both standard `Uint8Array` buffers and `ReadableStream` data.
30
+ - **💎 Prototype Preservation:** Safe internal mapping that respects and carries forward custom prototypes passed
31
+ via request configurations.
16
32
 
17
- ## Why Hyperttp?
33
+ ---
34
+
35
+ ## 🏗️ Architecture & Lifecycle
36
+
37
+ Hyperttp shifts heavy lifting into structured execution pipelines:
18
38
 
19
- - **⚡ Performance:** optimized hot-path HTTP request execution for Node.js and Bun
20
- - **🧩 Isomorphism:** unified API for Node.js and Bun. The system automatically selects the best transport
21
- (native Bun, Undici, or standard Node.js `http`)
22
- - **🔌 Plugin system:** easily extend functionality via hooks
23
- (`onRequest`, `onResponse`, `onError`)
24
- - **🛠️ Transport strategy:** easily add support for new runtimes
25
- (Deno, Browser) via the `HyperTransport` interface
39
+ 1. **Request Pipeline (`onRequest`):** Intercepts configurations before execution. Supports **short-circuiting**—
40
+ if a hook returns a response, the actual network transport layer is bypassed.
41
+ 2. **Transport Execution (`HyperTransport`):** The underlying engine (e.g., Undici, Bun) processes the low-level
42
+ socket request.
43
+ 3. **Response Data Pipeline (`onResponseData`):** Transforms or intercepts raw transport responses directly before
44
+ mapping and extraction.
45
+ 4. **Internal Processing:** Transparent decompression is applied to raw buffers or streams.
46
+ 5. **Response Pipeline (`onResponse`):**
47
+
48
+ - **Mutators:** Synchronously or asynchronously modify the client-facing response.
49
+ - **Side Effects / Background:** Runs parallel processing or logging blocks if `plugin.mode === "background"`.
50
+
51
+ 6. **Error Pipeline (`onError`):** Catches connection drops, invalid parses, or protocol errors, allowing plugins
52
+ to recover and gracefully fallback to alternative responses.
26
53
 
27
54
  ---
28
55
 
29
- ## Benchmarks
56
+ ## 📊 Benchmarks
30
57
 
31
- ### Test configuration
58
+ ### Test Configuration
32
59
 
33
60
  ```txt
34
- Requests 100000
35
- Concurrency 500
36
- Warmup 500
61
+ Requests 20000
62
+ Concurrency 200
63
+ Duration 20000
37
64
  Timeout 60000 ms
65
+
38
66
  ```
39
67
 
40
- Run benchmark:
68
+ To run your own suite:
41
69
 
42
70
  ```bash
43
71
  bun run bench.ts && npx tsx bench.ts
44
- ```
45
-
46
- ---
47
72
 
48
- ## [Benchmark results](https://github.com/IT-IF-OR/bench)
49
-
50
- ---
73
+ ```
51
74
 
52
- # 🟦 Node.js v24.14.1 — Undici transport
75
+ ## Node.js v24.14.1 — UndiciTransport
53
76
 
54
- ### 🏆 Leaderboard (by RPS)
77
+ ```bash
78
+ npm install @hyperttp/transport-undici
79
+ ```
55
80
 
56
- | Rank | Client | RPS | p99 | AVG | Heap |
57
- | ---- | -------------- | ------ | -------- | ------- | ------- |
58
- | 🥇 1 | @hyperttp/core | 27.72K | 43.45ms | 17.95ms | 18.7 MB |
59
- | 🥈 2 | undici | 19.80K | 59.51ms | 25.17ms | 20.6 MB |
60
- | 🥉 3 | ky | 7.82K | 119.80ms | 63.86ms | 34.1 MB |
61
- | 4 | node-fetch | 6.39K | 125.38ms | 77.95ms | 15.2 MB |
62
- | 5 | superagent | 6.28K | 127.06ms | 79.50ms | 15.1 MB |
63
- | 6 | axios | 6.19K | 110.82ms | 80.53ms | 21.4 MB |
64
- | 7 | got | 5.84K | 130.92ms | 85.49ms | 15.7 MB |
81
+ | Rank | Client | RPS | Avg | p50 | p90 | p99 | Errors |
82
+ | ---- | -------------- | ------ | -------- | -------- | -------- | -------- | ------ |
83
+ | 🥇 1 | undici | 16.11K | 12.38 ms | 12.17 ms | 12.62 ms | 16.75 ms | 0 |
84
+ | 🥈 2 | @hyperttp/core | 16.08K | 12.41 ms | 11.99 ms | 12.47 ms | 14.57 ms | 0 |
85
+ | 🥉 3 | hyperttp | 11.98K | 16.64 ms | 16.01 ms | 16.52 ms | 18.91 ms | 0 |
86
+ | 4 | bun-fetch | 8.48K | 23.47 ms | 21.98 ms | 29.27 ms | 35.54 ms | 0 |
87
+ | 5 | request | 7.50K | 26.63 ms | 25.82 ms | 30.20 ms | 33.27 ms | 0 |
88
+ | 6 | ky | 6.44K | 30.97 ms | 28.38 ms | 36.48 ms | 64.38 ms | 0 |
89
+ | 7 | axios | 4.99K | 39.97 ms | 38.81 ms | 43.82 ms | 51.39 ms | 0 |
90
+ | 8 | node-fetch | 4.61K | 43.28 ms | 41.23 ms | 49.00 ms | 63.58 ms | 0 |
91
+ | 9 | got | 4.61K | 43.33 ms | 41.42 ms | 47.81 ms | 64.51 ms | 0 |
92
+ | 10 | superagent | 3.42K | 58.41 ms | 57.53 ms | 63.26 ms | 67.41 ms | 0 |
65
93
 
66
94
  ---
67
95
 
68
- # 🟨 Bun v1.3.14 — Bun transport
96
+ ## Bun 1.3.14 — BunTransport
69
97
 
70
- ### 🏆 Leaderboard (by RPS)
98
+ ```bash
99
+ npm install @hyperttp/transport-bun
100
+ ```
71
101
 
72
- | Rank | Client | RPS | p99 | AVG | Heap |
73
- | ---- | -------------- | ------ | ------- | ------- | ------- |
74
- | 🥇 1 | undici | 36.42K | 15.67ms | 13.68ms | 31.8 MB |
75
- | 🥈 2 | node-fetch | 36.29K | 16.70ms | 13.74ms | 4.07 MB |
76
- | 🥉 3 | @hyperttp/core | 34.26K | 21.61ms | 14.54ms | 34.9 MB |
77
- | 4 | ky | 31.10K | 22.78ms | 16.05ms | 9.88 MB |
78
- | 5 | superagent | 13.86K | 69.78ms | 36.00ms | 18.1 MB |
79
- | 6 | axios | 8.98K | 66.58ms | 55.52ms | 18.8 MB |
80
- | 7 | got | 7.15K | 86.70ms | 69.83ms | 25.2 MB |
102
+ | Rank | Client | RPS | Avg | p50 | p90 | p99 | Errors |
103
+ | ---- | -------------- | ------ | -------- | -------- | -------- | -------- | ------ |
104
+ | 🥇 1 | bun-fetch | 26.29K | 7.57 ms | 7.91 ms | 9.95 ms | 12.43 ms | 0 |
105
+ | 🥈 2 | node-fetch | 22.91K | 8.69 ms | 8.79 ms | 12.34 ms | 13.28 ms | 0 |
106
+ | 🥉 3 | undici | 21.66K | 9.21 ms | 9.40 ms | 12.87 ms | 14.86 ms | 0 |
107
+ | 4 | @hyperttp/core | 13.73K | 14.53 ms | 14.42 ms | 15.74 ms | 22.15 ms | 0 |
108
+ | 5 | ky | 13.56K | 14.73 ms | 13.09 ms | 19.64 ms | 21.30 ms | 0 |
109
+ | 6 | hyperttp | 12.87K | 15.52 ms | 13.52 ms | 21.09 ms | 22.00 ms | 0 |
110
+ | 7 | request | 8.56K | 23.31 ms | 22.74 ms | 25.36 ms | 28.64 ms | 0 |
111
+ | 8 | superagent | 8.36K | 23.90 ms | 23.72 ms | 25.51 ms | 27.55 ms | 0 |
112
+ | 9 | axios | 6.35K | 31.41 ms | 31.53 ms | 33.56 ms | 38.03 ms | 0 |
113
+ | 10 | got | 5.28K | 37.84 ms | 30.25 ms | 56.91 ms | 59.92 ms | 0 |
81
114
 
82
115
  ---
83
116
 
84
- # 🟩 Node.js v24.14.1 — Node transport
85
-
86
- ### 🏆 Leaderboard (by RPS)
87
-
88
- | Rank | Client | RPS | p99 | AVG | Heap |
89
- | ---- | -------------- | ------ | -------- | ------- | ------- |
90
- | 🥇 1 | undici | 20.08K | 66.21ms | 24.76ms | 20.6 MB |
91
- | 🥈 2 | @hyperttp/core | 12.52K | 66.42ms | 39.80ms | 14.1 MB |
92
- | 🥉 3 | ky | 7.98K | 113.21ms | 62.55ms | 23.1 MB |
93
- | 4 | node-fetch | 6.71K | 114.06ms | 74.23ms | 15.9 MB |
94
- | 5 | axios | 6.29K | 116.21ms | 79.22ms | 22.2 MB |
95
- | 6 | superagent | 6.19K | 125.31ms | 80.73ms | 15.2 MB |
96
- | 7 | got | 5.86K | 135.85ms | 85.18ms | 19.3 MB |
117
+ ## Node.js v24.14.1 — NodeTransport
118
+
119
+ | Rank | Client | RPS | Avg | p50 | p90 | p99 | Errors |
120
+ | ---- | -------------- | ------ | -------- | -------- | -------- | -------- | ------ |
121
+ | 🥇 1 | undici | 15.92K | 12.53 ms | 12.38 ms | 12.88 ms | 16.75 ms | 0 |
122
+ | 🥈 2 | bun-fetch | 8.45K | 23.58 ms | 22.05 ms | 29.49 ms | 35.63 ms | 0 |
123
+ | 🥉 3 | @hyperttp/core | 7.47K | 26.70 ms | 25.03 ms | 32.76 ms | 41.48 ms | 0 |
124
+ | 4 | request | 7.42K | 26.91 ms | 26.06 ms | 30.98 ms | 35.71 ms | 0 |
125
+ | 5 | hyperttp | 6.84K | 29.16 ms | 27.72 ms | 34.39 ms | 43.95 ms | 0 |
126
+ | 6 | ky | 6.57K | 30.38 ms | 27.74 ms | 36.11 ms | 69.57 ms | 0 |
127
+ | 7 | axios | 4.80K | 41.57 ms | 40.46 ms | 45.35 ms | 56.94 ms | 0 |
128
+ | 8 | node-fetch | 4.59K | 43.43 ms | 41.54 ms | 48.93 ms | 63.88 ms | 0 |
129
+ | 9 | got | 4.44K | 44.96 ms | 43.24 ms | 49.36 ms | 65.20 ms | 0 |
130
+ | 10 | superagent | 3.39K | 58.86 ms | 57.93 ms | 64.18 ms | 69.88 ms | 0 |
97
131
 
98
132
  ---
99
133
 
100
- # 🟪 Bun v1.3.14 — Node transport
101
-
102
- ### 🏆 Leaderboard (by RPS)
103
-
104
- | Rank | Client | RPS | p99 | AVG | Heap |
105
- | ---- | -------------- | ------ | -------- | ------- | ------- |
106
- | 🥇 1 | node-fetch | 35.87K | 17.00ms | 13.90ms | 6.21 MB |
107
- | 🥈 2 | undici | 35.79K | 16.59ms | 13.92ms | 25.4 MB |
108
- | 🥉 3 | ky | 29.68K | 37.27ms | 16.80ms | 17.3 MB |
109
- | 4 | @hyperttp/core | 17.32K | 50.71ms | 28.79ms | 17.5 MB |
110
- | 5 | superagent | 13.73K | 122.70ms | 36.37ms | 34.4 MB |
111
- | 6 | axios | 8.77K | 86.39ms | 56.84ms | 18.9 MB |
112
- | 7 | got | 6.97K | 98.33ms | 71.64ms | 25.3 MB |
134
+ ## Bun 1.3.14 — NodeTransport
135
+
136
+ | Rank | Client | RPS | Avg | p50 | p90 | p99 | Errors |
137
+ | ---- | -------------- | ------ | -------- | -------- | -------- | -------- | ------ |
138
+ | 🥇 1 | bun-fetch | 26.28K | 7.58 ms | 7.79 ms | 9.83 ms | 13.03 ms | 0 |
139
+ | 🥈 2 | undici | 22.22K | 8.97 ms | 9.34 ms | 12.85 ms | 13.46 ms | 0 |
140
+ | 🥉 3 | node-fetch | 21.24K | 9.38 ms | 8.85 ms | 13.65 ms | 15.67 ms | 0 |
141
+ | 4 | @hyperttp/core | 18.39K | 10.85 ms | 11.87 ms | 14.68 ms | 15.30 ms | 0 |
142
+ | 5 | hyperttp | 13.51K | 14.76 ms | 14.04 ms | 19.81 ms | 23.84 ms | 0 |
143
+ | 6 | ky | 11.94K | 16.73 ms | 16.45 ms | 23.50 ms | 25.49 ms | 0 |
144
+ | 7 | request | 7.50K | 26.60 ms | 25.55 ms | 30.96 ms | 41.62 ms | 0 |
145
+ | 8 | superagent | 7.33K | 27.27 ms | 26.89 ms | 29.35 ms | 33.68 ms | 0 |
146
+ | 9 | axios | 5.63K | 35.42 ms | 34.99 ms | 37.70 ms | 52.08 ms | 0 |
147
+ | 10 | got | 4.71K | 42.33 ms | 40.26 ms | 47.68 ms | 77.55 ms | 0 |
113
148
 
114
149
  ---
115
150
 
116
- ## Quick start
151
+ ## 🚀 Quick Start
117
152
 
118
153
  ### Installation
119
154
 
120
155
  ```bash
121
156
  npm install @hyperttp/core
122
- ```
123
157
 
124
- ---
158
+ ```
125
159
 
126
- ### Usage
160
+ ### Basic HTTP Operations
127
161
 
128
162
  ```typescript
129
163
  import { HyperCore } from "@hyperttp/core";
130
164
 
131
165
  const http = new HyperCore({
132
- network: { userAgent: "MyApp/1.0" },
166
+ network: {
167
+ userAgent: "MyApp/2.0",
168
+ headers: { "X-Custom-Global": "Hyperttp" },
169
+ },
133
170
  });
134
171
 
135
- // GET request
172
+ // Standard responses
136
173
  const response = await http.get("https://api.example.com/data");
137
174
 
138
- // POST request
139
- const result = await http.post("/users", { name: "John" });
175
+ // Shortcut data utilities
176
+ const userJson = await http.json<{ name: string }>("/users/123");
177
+ const logsText = await http.text("/logs/latest");
178
+
179
+ // Safely consume/drain a response without allocations
180
+ await http.dump("/analytics/ping");
181
+ ```
182
+
183
+ ### High-Performance Streaming
184
+
185
+ ```typescript
186
+ // GET Streams
187
+ const streamResponse = await http.stream("https://stream.example.com/audio");
188
+ const reader = streamResponse.body.getReader();
189
+
190
+ // POST Streams (e.g., LLM Completions / Audio Pipes)
191
+ const chatStream = await http.postStream("/v1/chat/completions", {
192
+ model: "gpt-4",
193
+ stream: true,
194
+ });
140
195
  ```
141
196
 
142
197
  ---
143
198
 
144
- ### Extending and plugins
199
+ ## 🔌 Advanced Plugins & Extensions
145
200
 
146
- `HyperCore` supports creating isolated instances with custom configuration and plugins.
201
+ You can extend existing configurations contextually via `.extend()` (or its alias `.create()`) and install
202
+ prioritized hooks.
147
203
 
148
204
  ```typescript
149
- const apiClient = http.extend({
150
- network: { headers: { "X-Auth": "secret" } },
205
+ // Inherit global pools and layers while changing specific presets
206
+ const authenticatedClient = http.extend({
207
+ network: { headers: { Authorization: "Bearer token_abc" } },
151
208
  });
152
209
 
153
- apiClient.use({
154
- name: "logger-plugin",
155
- enabled: () => true,
156
- onRequest: async (req) => {
157
- console.log(`Sending ${req.method} to ${req.url}`);
210
+ authenticatedClient.use({
211
+ name: "performance-logger",
212
+ priority: 100, // Sorted execution priority (higher runs first)
213
+ mode: "background", // Forces onResponse to run as a non-blocking side-effect
214
+
215
+ setup: (ctx) => {
216
+ // Fired immediately on registration
217
+ ctx.config.logger?.info?.("Plugin active");
218
+ },
219
+
220
+ onRequest: async (req, ctx) => {
221
+ req.meta.startTime = performance.now();
222
+ },
223
+
224
+ onResponse: async (res, req, ctx) => {
225
+ const duration = performance.now() - req.meta.startTime;
226
+ console.log(
227
+ `[${req.method}] ${req.url} -> ${res.status} (${duration.toFixed(2)}ms)`,
228
+ );
229
+ },
230
+
231
+ onError: async (error, req, ctx) => {
232
+ console.error(`Request failed to ${req.url}: ${error.message}`);
233
+ // Return a response object here if you want to bypass/recover from the failure
158
234
  },
159
235
  });
160
236
  ```
161
237
 
162
- ---
163
-
164
- ## Architecture
238
+ ### Graceful Resource Destruction
165
239
 
166
- Hyperttp is built on the **Strategy pattern**.
240
+ Always clean up underlying transport configurations, socket pools, and keep‑alive timers in microservice tear-downs:
167
241
 
168
- 1. **Core (`HyperCore`)**: orchestrates the request lifecycle
169
- 2. **Transports (`HyperTransport`)**: low-level implementations for different runtimes
170
- dynamically selected to minimize bundle size
171
- 3. **Hooks**: executed during request lifecycle (before request, after response, on error)
172
- allowing interception and modification without changing core logic
242
+ ```typescript
243
+ // Performs a graceful or rapid shutdown sequence across transport selectors
244
+ await http.destroy(true);
245
+ ```
173
246
 
174
247
  ---
175
248
 
176
- ## License
249
+ ## 📄 License
177
250
 
178
251
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperttp/core",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "High-performance, extensible HTTP client for Node.js and Bun and other",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -28,7 +28,7 @@
28
28
  "url": "git+https://github.com/IT-IF-OR/hyperttp-core.git"
29
29
  },
30
30
  "peerDependencies": {
31
- "@hyperttp/transport-bun": "^0.2.0",
31
+ "@hyperttp/transport-bun": "^0.2.1",
32
32
  "@hyperttp/transport-undici": "^0.2.0"
33
33
  },
34
34
  "peerDependenciesMeta": {
@@ -1,13 +1,5 @@
1
1
  import type { HttpClientOptions, HyperTransport, HttpResponse, StreamResponse } from "@hyperttp/types";
2
- /**
3
- * @ru Тип среды выполнения: Bun или Node.js.
4
- * @en Runtime environment: Bun or Node.js.
5
- */
6
2
  export type Runtime = "bun" | "node";
7
- /**
8
- * @ru Описание доступного транспорта: имя, поддерживаемые рантаймы, пакет, экспортируемое имя, приоритет.
9
- * @en Transport definition: name, supported runtimes, package, export name, priority.
10
- */
11
3
  type TransportDef = {
12
4
  name: string;
13
5
  runtime: Runtime[];
@@ -15,86 +7,78 @@ type TransportDef = {
15
7
  export: string;
16
8
  priority: number;
17
9
  };
18
- /**
19
- * @ru Определение текущей среды выполнения (Bun или Node) на основе глобальных объектов.
20
- * @en Detects the current runtime (Bun or Node) based on global objects.
21
- */
22
10
  export declare const CURRENT_RUNTIME: Runtime;
23
- /**
24
- * @ru Возвращает текущую среду выполнения.
25
- * @en Returns the current runtime.
26
- * @returns The current runtime ('bun' or 'node').
27
- */
28
11
  export declare function getRuntime(): Runtime;
29
- /**
30
- * @ru Список доступных транспортов с приоритетами. Высший приоритет — предпочтительный транспорт для рантайма.
31
- * @en List of available transports with priorities. Higher priority means preferred transport for the runtime.
32
- */
33
12
  export declare const TRANSPORTS: TransportDef[];
34
13
  /**
35
- * @ru Разрешает и создаёт экземпляр транспорта на основе конфигурации и текущей среды выполнения. Использует кэш классов.
36
- * @en Resolves and creates a transport instance based on configuration and the current runtime. Uses class cache.
37
- * @param config - Client configuration.
38
- * @returns Promise resolving to a transport instance.
39
- * @throws If no compatible transport is available.
14
+ * @ru Главный резолвер транспорта (диагностический и детерминированный).
15
+ * @en Main transport resolver (diagnostic and deterministic).
16
+ * @param config - Client configuration (may contain customTransport).
17
+ * @returns Promise resolving to a HyperTransport instance.
18
+ * @throws If no compatible transport can be loaded.
40
19
  */
41
20
  export declare function resolveTransport(config: HttpClientOptions): Promise<HyperTransport>;
21
+ export interface TransportDebugInfo {
22
+ name: string;
23
+ pkg: string;
24
+ runtime: Runtime;
25
+ }
42
26
  /**
43
- * @ru Менеджер транспорта: ленивая загрузка, кэширование, синхронизация конфигурации, выполнение запросов, уничтожение.
44
- * @en Transport manager: lazy loading, caching, config synchronization, request execution, destruction.
27
+ * @ru Управляет жизненным циклом транспортного слоя: ленивая инициализация, кеширование, синхронизация конфигурации.
28
+ * @en Manages the transport layer lifecycle: lazy initialization, caching, configuration synchronization.
45
29
  */
46
30
  export declare class TransportManager {
47
31
  private transport;
48
- private transportPromise;
32
+ private promise;
49
33
  private config;
50
34
  /**
51
35
  * @ru Создаёт менеджер транспорта.
52
36
  * @en Creates a transport manager.
53
37
  * @param config - Client configuration.
54
- * @param customTransport - Optional pre-created transport instance.
38
+ * @param custom - Optional externally provided transport instance.
55
39
  */
56
- constructor(config: HttpClientOptions, customTransport?: HyperTransport);
40
+ constructor(config: HttpClientOptions, custom?: HyperTransport);
57
41
  /**
58
- * @ru Обновляет конфигурацию клиента и синхронизирует её с активным транспортом (если есть).
59
- * @en Updates the client configuration and syncs it with the active transport (if any).
42
+ * @ru Обновляет конфигурацию клиента.
43
+ * @en Updates the client configuration.
60
44
  * @param config - New configuration.
61
45
  */
62
46
  setConfig(config: HttpClientOptions): void;
63
47
  /**
64
- * @ru Возвращает текущий экземпляр транспорта (если уже загружен).
65
- * @en Returns the current transport instance (if already loaded).
48
+ * @ru Возвращает текущий экземпляр транспорта (если уже инициализирован).
49
+ * @en Returns the current transport instance (if already initialised).
66
50
  */
67
51
  get instance(): HyperTransport | null;
68
52
  /**
69
- * @ru Асинхронно получает транспорт (ленивая загрузка).
70
- * @en Asynchronously gets the transport (lazy loading).
71
- * @returns Promise resolving to transport instance.
53
+ * @ru Асинхронно получает экземпляр транспорта (инициализирует при необходимости).
54
+ * @en Asynchronously obtains a transport instance (initialises if needed).
55
+ * @returns Promise resolving to a HyperTransport.
72
56
  */
73
57
  get(): Promise<HyperTransport>;
74
58
  /**
75
- * @ru Синхронизирует конфигурацию с транспортом, если транспорт имеет свойство config.
76
- * @en Syncs configuration with the transport if the transport has a config property.
77
- */
78
- private syncConfig;
79
- /**
80
- * @ru Выполняет запрос и возвращает стандартный HttpResponse (не поток).
81
- * @en Executes a request and returns a standard HttpResponse (non-stream).
82
- * @param req - Request parameters for transport.
83
- * @returns Promise with HTTP response.
59
+ * @ru Выполняет запрос через транспорт и возвращает обычный (не стриминговый) ответ.
60
+ * @en Executes a request through the transport and returns a regular (non‑streaming) response.
61
+ * @param req - Request parameters.
62
+ * @returns Promise resolving to HttpResponse.
84
63
  */
85
64
  execute<T = unknown>(req: Parameters<HyperTransport["execute"]>[0]): Promise<HttpResponse<T>>;
86
65
  /**
87
- * @ru Выполняет запрос и возвращает потоковый ответ (StreamResponse).
88
- * @en Executes a request and returns a stream response (StreamResponse).
89
- * @param req - Request parameters for transport.
90
- * @returns Promise with stream response.
66
+ * @ru Выполняет запрос через транспорт и возвращает стриминговый ответ.
67
+ * @en Executes a request through the transport and returns a streaming response.
68
+ * @param req - Request parameters.
69
+ * @returns Promise resolving to StreamResponse.
91
70
  */
92
71
  executeStream<T = unknown>(req: Parameters<HyperTransport["execute"]>[0]): Promise<StreamResponse<T>>;
93
72
  /**
94
- * @ru Уничтожает транспорт: закрывает соединения (graceful) или принудительно разрушает.
95
- * @en Destroys the transport: closes connections (graceful) or forces destruction.
96
- * @param graceful - If true, attempts graceful shutdown via close(). Otherwise destroys.
97
- * @returns Promise that resolves when destruction is complete.
73
+ * @ru Возвращает отладочную информацию о текущем транспорте.
74
+ * @en Returns debug information about the current transport.
75
+ */
76
+ get debug(): TransportDebugInfo | null;
77
+ /**
78
+ * @ru Завершает работу транспорта (закрывает соединения при graceful shutdown, иначе принудительно уничтожает).
79
+ * @en Shuts down the transport (gracefully closes connections or forcefully destroys).
80
+ * @param graceful - If true, attempt graceful close; otherwise call destroy.
81
+ * @returns Promise that resolves when shutdown is complete.
98
82
  */
99
83
  destroy(graceful?: boolean): Promise<void>;
100
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/transports/manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAIzB;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAQrC;;;GAGG;AACH,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,OACe,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,EAwBpC,CAAC;AAqIF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAiFzB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,MAAM,CAAoB;IAElC;;;;;OAKG;gBACS,MA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