hyperttp 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Hyperttp ⚡
1
+ # Hyperttp
2
2
 
3
- **HTTP without boilerplate.**
3
+ **An Axios-like HTTP client with built-in request policies for modern TypeScript applications.**
4
4
 
5
5
  > English | [Русский](https://github.com/dirold2/hyperttp/tree/main/lang/ru)
6
6
 
@@ -9,244 +9,487 @@
9
9
  [![license](https://img.shields.io/npm/l/hyperttp)](./LICENSE)
10
10
  [![typescript](https://img.shields.io/badge/TypeScript-strict-blue)](https://www.typescriptlang.org/)
11
11
 
12
- An HTTP client for **Node.js**, **Bun**, **Deno**, and the **Browser** that provides retries,
13
- caching, rate limiting, metrics, parsing, serialization, and interceptors **out of the box**.
12
+ Hyperttp keeps familiar `get`, `post`, `put`, `patch`, and `delete` methods while adding response
13
+ parsing, caching, in-flight deduplication, rate limiting, concurrency queues, and interceptors
14
+ through one client.
14
15
 
15
16
  ```ts
16
17
  import { HyperClient } from "hyperttp";
17
18
 
18
- const client = new HyperClient();
19
+ const http = new HyperClient({
20
+ baseURL: "https://api.example.com",
21
+ });
19
22
 
20
- // Parse JSON explicitly, regardless of the response Content-Type
21
- const user = await client.request("https://api.example.com/users/1").json().send();
23
+ const users = await http.get<User[]>("/users");
22
24
 
23
- console.log(user);
25
+ console.log(users);
24
26
  ```
25
27
 
26
- No manual setup.
27
- No unnecessary code.
28
- Just make requests.
28
+ Shortcuts return parsed data directly. No `response.data` step is required.
29
29
 
30
- ---
30
+ ## Why Hyperttp?
31
31
 
32
- ## What is Hyperttp?
32
+ A real API client often grows beyond `fetch()` or a basic request wrapper:
33
33
 
34
- Most HTTP clients solve one problem:
34
+ ```text
35
+ HTTP request
36
+ ├── serialization and parsing
37
+ ├── caching
38
+ ├── duplicate request prevention
39
+ ├── rate limiting
40
+ ├── concurrency control
41
+ ├── cancellation and timeouts
42
+ └── interceptors
43
+ ```
35
44
 
36
- > "Send an HTTP request."
45
+ Hyperttp provides these policies through one composable client. It is most useful for SDKs,
46
+ backend services, bots, CLI tools, API integrations, and applications that would otherwise build
47
+ and maintain this infrastructure themselves.
37
48
 
38
- But real applications need much more:
49
+ Hyperttp is not universally better than every HTTP client. If you only need a small Fetch wrapper,
50
+ Ky or ofetch may be a better fit. For a Node-only client with HTTP/2 and pagination, Got is more
51
+ specialized. See [Choosing a client](#choosing-a-client) for an objective comparison.
39
52
 
40
- - retries
41
- - rate limiting
42
- - caching
43
- - request deduplication
44
- - parsing
45
- - serialization
46
- - metrics
47
- - interceptors
48
- - request queues
49
- - timeouts
53
+ ## Installation
50
54
 
51
- With most libraries, this turns into installing many additional packages and building your own wrappers.
55
+ Node.js usage requires Node.js 22.19.0 or newer because Hyperttp uses Undici 8.
52
56
 
53
- Hyperttp provides these capabilities through a single client.
57
+ ```bash
58
+ npm install hyperttp
59
+ ```
54
60
 
55
- ---
61
+ ```bash
62
+ pnpm add hyperttp
63
+ ```
56
64
 
57
- ## Why Hyperttp?
65
+ ```bash
66
+ bun add hyperttp
67
+ ```
58
68
 
59
- Instead of building your own networking layer:
69
+ ```bash
70
+ deno add npm:hyperttp
71
+ ```
60
72
 
61
- ```text
62
- fetch
63
- ├── retry
64
- ├── cache
65
- ├── parser
66
- ├── metrics
67
- ├── serializer
68
- ├── queue
69
- ├── timeout
70
- └── custom wrappers
73
+ ## Quick start
74
+
75
+ ### Create a reusable client
76
+
77
+ ```ts
78
+ import { HyperClient } from "hyperttp";
71
79
 
80
+ export const api = new HyperClient({
81
+ baseURL: "https://api.example.com/v1/",
82
+ });
72
83
  ```
73
84
 
74
- Hyperttp provides a ready-to-use infrastructure:
85
+ Reuse the client across your application so transports, connection pools, cache entries, and
86
+ plugin state can be shared.
75
87
 
76
- ```text
77
- Hyperttp
78
- ├── Retry
79
- ├── Cache
80
- ├── Metrics
81
- ├── Parser
82
- ├── Serializer
83
- ├── Queue
84
- ├── Interceptors
85
- ├── Timeout
86
- └── Rate Limiter
88
+ ```ts
89
+ interface User {
90
+ id: string;
91
+ name: string;
92
+ active: boolean;
93
+ }
94
+
95
+ const users = await api.get<User[]>("users");
96
+ const user = await api.get<User>("users/42");
97
+ ```
98
+
99
+ ### Send data
100
+
101
+ ```ts
102
+ const created = await api.post<User>("users", {
103
+ name: "Alice",
104
+ active: true,
105
+ });
106
+
107
+ await api.put("users/42", {
108
+ name: "Alice Cooper",
109
+ });
110
+
111
+ await api.patch("users/42", {
112
+ active: false,
113
+ });
87
114
 
115
+ await api.delete("users/42");
88
116
  ```
89
117
 
90
- Create a client.
118
+ Objects and arrays are serialized as JSON by the built-in serializer.
91
119
 
92
- Start making requests.
120
+ ## Request options
93
121
 
94
- ---
122
+ ### Query parameters
95
123
 
96
- ## Quick Start
124
+ Hyperttp uses `query` where Axios uses `params`:
97
125
 
98
- ### 1. Install Hyperttp
126
+ ```ts
127
+ const users = await api.get<User[]>("users", {
128
+ query: {
129
+ page: 1,
130
+ limit: 20,
131
+ active: true,
132
+ role: ["admin", "editor"],
133
+ },
134
+ });
135
+ ```
99
136
 
100
- ```bash
101
- # Node.js
102
- npm install hyperttp
103
- pnpm add hyperttp
137
+ Array values become repeated query parameters. `null` and `undefined` values are omitted by the
138
+ fluent builder.
104
139
 
105
- # Bun
106
- bun add hyperttp
140
+ ### Headers
107
141
 
108
- # Deno
109
- deno add npm:hyperttp
142
+ ```ts
143
+ const profile = await api.get<User>("profile", {
144
+ headers: {
145
+ Authorization: `Bearer ${token}`,
146
+ "X-Request-ID": requestId,
147
+ },
148
+ });
149
+ ```
150
+
151
+ Hyperttp currently has no top-level default `headers` option. Use request options or a request
152
+ interceptor when headers must be added globally.
110
153
 
154
+ ### Timeout and cancellation
155
+
156
+ ```ts
157
+ const controller = new AbortController();
158
+
159
+ const request = api.get("reports/large", {
160
+ timeout: 10_000,
161
+ signal: controller.signal,
162
+ });
163
+
164
+ controller.abort();
165
+
166
+ await request;
111
167
  ```
112
168
 
113
- ### 2. Basic Usage
169
+ Timeouts, aborts, and transport failures reject the request. HTTP error status codes are handled
170
+ differently; see [Responses and HTTP errors](#responses-and-http-errors).
171
+
172
+ ### Explicit response format
114
173
 
115
174
  ```ts
116
- import { HyperClient } from "hyperttp";
175
+ const text = await api.get<string>("health", "text");
117
176
 
118
- const client = new HyperClient({
119
- baseURL: "https://api.example.com",
177
+ const document = await api.get("document.xml", {
178
+ responseType: "xml",
120
179
  });
180
+ ```
181
+
182
+ Supported response hints are `json`, `text`, `xml`, `html`, `buffer`, and `stream`.
183
+
184
+ ## Understanding `baseURL`
121
185
 
122
- await client.get("/users"); // Parses based on Content-Type
123
- await client.request("/users").json().send();
124
- await client.request("/users").post().jsonBody({ name: "John" }).json().send();
125
- await client.request("/users/1").put().jsonBody({ name: "Alice" }).json().send();
126
- await client.delete("/users/1");
186
+ Hyperttp resolves relative URLs with the standard `URL` rules:
187
+
188
+ ```ts
189
+ const api = new HyperClient({
190
+ baseURL: "https://api.example.com/v1/",
191
+ });
192
+
193
+ await api.get("users"); // https://api.example.com/v1/users
194
+ await api.get("/users"); // https://api.example.com/users
127
195
  ```
128
196
 
129
- ---
197
+ A leading slash starts from the origin root. Omit it when the path should remain under the
198
+ `baseURL` pathname.
130
199
 
131
- ## Hyperttp vs Other HTTP Clients
200
+ `baseURL` applies to HyperClient shortcuts, `head()`, `stream()`, and `RequestBuilder`. The directly
201
+ delegated `client.rest` namespace currently expects an absolute URL.
132
202
 
133
- | Feature | fetch | Axios | Ky | Hyperttp |
134
- | ------------------------ | ----- | ------ | ------- | -------- |
135
- | Promise API | ✅ | ✅ | ✅ | ✅ |
136
- | Retry | ❌ | Plugin | ✅ | ✅ |
137
- | Cache | ❌ | ❌ | ❌ | ✅ |
138
- | Metrics | ❌ | ❌ | ❌ | ✅ |
139
- | Rate Limiter | ❌ | ❌ | ❌ | ✅ |
140
- | Queue | ❌ | ❌ | ❌ | ✅ |
141
- | Parser | ❌ | ❌ | Partial | ✅ |
142
- | Serializer | ❌ | ❌ | ❌ | ✅ |
143
- | Interceptors | ❌ | ✅ | Hooks | ✅ |
144
- | Transport auto-detection | ❌ | ❌ | ❌ | ✅ |
203
+ ## Fluent requests
145
204
 
146
- ---
205
+ Use shortcuts for simple requests and `RequestBuilder` when a longer request reads better as a
206
+ chain:
147
207
 
148
- ## Who is Hyperttp for?
208
+ ```ts
209
+ const user = await api
210
+ .request("users")
211
+ .post()
212
+ .headers({
213
+ "X-Request-ID": requestId,
214
+ })
215
+ .query({ notify: true })
216
+ .jsonBody({
217
+ name: "Alice",
218
+ active: true,
219
+ })
220
+ .json()
221
+ .send<User>();
222
+ ```
149
223
 
150
- Perfect for:
224
+ Available builder methods include:
151
225
 
152
- - REST APIs & SDKs
153
- - CLI applications & Discord bots
154
- - Backend & Serverless services
155
- - Web scraping
156
- - Enterprise applications
226
+ - HTTP method: `get`, `post`, `put`, `patch`, `delete`, `head`, `options`, `method`
227
+ - Request data: `headers`, `query`, `body`, `jsonBody`
228
+ - Control: `timeout`, `signal`
229
+ - Response hint: `json`, `text`, `xml`, `html`, `buffer`, `stream`
230
+ - Utility: `clone`, `send`
157
231
 
158
- ---
232
+ For live response streaming, use `client.stream()` rather than the builder response hint.
159
233
 
160
- ## Advanced Configuration
234
+ ## Responses and HTTP errors
235
+
236
+ ### Convenience methods return data
161
237
 
162
238
  ```ts
163
- const client = new HyperClient({
164
- baseURL: "https://api.example.com",
239
+ const users = await api.get<User[]>("users");
240
+ ```
165
241
 
166
- retry: {
167
- maxRetries: 3,
168
- },
242
+ The return value is already the parsed response data. Status, headers, and other envelope fields
243
+ are intentionally omitted from shortcut results.
169
244
 
170
- cache: {
171
- ttl: 60_000,
172
- },
245
+ ### Access the full response
173
246
 
174
- timeout: 30_000,
175
- });
247
+ Use the REST namespace when status and headers are needed:
248
+
249
+ ```ts
250
+ const response = await api.rest.get<User[]>("https://api.example.com/v1/users");
251
+
252
+ console.log(response.ok);
253
+ console.log(response.status);
254
+ console.log(response.headers);
255
+ console.log(response.data);
176
256
  ```
177
257
 
178
- ### Built-in Plugins
258
+ The full response contains `protocol`, `ok`, `status`, `statusText`, `headers`, `url`, `data`, and
259
+ optional metadata/raw fields.
179
260
 
180
- `HyperClient` automatically registers interceptors, serialization, metrics, request deduplication,
181
- caching, rate limiting, queueing, and response parsing.
261
+ ### HTTP statuses do not throw by default
182
262
 
183
- Disable only automatic response parsing:
263
+ A `4xx` or `5xx` response resolves normally. With shortcuts, the parsed error body is returned. With
264
+ the full response API, inspect `response.ok` or `response.status`:
184
265
 
185
266
  ```ts
186
- const client = new HyperClient({
187
- responseConverter: false,
267
+ const response = await api.rest.get<ErrorPayload>("https://api.example.com/v1/users/missing");
268
+
269
+ if (!response.ok) {
270
+ console.error(response.status, response.data);
271
+ }
272
+ ```
273
+
274
+ This differs from Axios, Ky, Got, and ofetch defaults, which commonly reject non-success responses.
275
+
276
+ ## Built-in request policies
277
+
278
+ Built-in plugins are registered automatically. Policies that should be explicit, such as rate
279
+ limiting and queueing, can be enabled in client configuration:
280
+
281
+ ```ts
282
+ const api = new HyperClient({
283
+ baseURL: "https://api.example.com/v1/",
284
+
285
+ cache: {
286
+ enabled: true,
287
+ ttl: 60_000,
288
+ maxSize: 1_000,
289
+ },
290
+
291
+ inflight: {
292
+ enabled: true,
293
+ },
294
+
295
+ rateLimit: {
296
+ enabled: true,
297
+ maxRequests: 100,
298
+ windowMs: 60_000,
299
+ },
300
+
301
+ queue: {
302
+ enabled: true,
303
+ maxConcurrent: 20,
304
+ },
188
305
  });
189
306
  ```
190
307
 
191
- Disable the entire built-in plugin set for a minimal pipeline:
308
+ | Policy | Purpose |
309
+ | ----------------------- | ------------------------------------------------------------- |
310
+ | Cache | Reuse successful GET/HEAD responses according to cache policy |
311
+ | In-flight deduplication | Share compatible concurrent GET requests |
312
+ | Rate limiter | Control request volume and react to server penalties |
313
+ | Queue | Limit concurrent work per configured partition |
314
+ | Serializer | Encode object/array request bodies |
315
+ | Parser | Convert JSON, text, HTML, XML, buffer, and empty responses |
316
+ | Interceptors | Transform requests and responses |
317
+
318
+ Disable the entire built-in plugin preset when composing a custom pipeline:
192
319
 
193
320
  ```ts
194
321
  const client = new HyperClient({
195
322
  builtInPlugins: false,
323
+ plugins: [myPlugin],
196
324
  });
197
325
  ```
198
326
 
199
- The REST protocol remains available when built-in plugins are disabled. Custom plugins supplied
200
- through `plugins` or registered with `client.use()` continue to work. When `builtInPlugins` is
201
- `false`, `responseConverter` has no effect because the built-in parser is not registered.
327
+ The REST protocol and plugins explicitly supplied through `plugins` or `client.use()` remain
328
+ available.
202
329
 
203
- ---
330
+ > Retry options exist in the current type surface, but retry execution is not documented as a
331
+ > stable feature in `0.5.x`. It is therefore not counted as an active capability in the comparison
332
+ > below.
204
333
 
205
- ## Architecture
334
+ ## Streaming
206
335
 
207
- ```text
208
- Application
209
- │
210
- ▼
211
- HyperClient
212
- │
213
- Plugin Pipeline
214
- │
215
- Transport (Auto-detected)
216
- │
217
- HTTP
336
+ `stream()` returns the complete response envelope. Its `data` is an async-iterable byte stream:
337
+
338
+ ```ts
339
+ const response = await api.stream("events");
340
+ const decoder = new TextDecoder();
218
341
 
342
+ for await (const chunk of response.data) {
343
+ console.log(decoder.decode(chunk, { stream: true }));
344
+ }
219
345
  ```
220
346
 
221
- All components are independent and replaceable.
347
+ The concrete stream implementation depends on the active runtime transport.
348
+
349
+ ## TypeScript
350
+
351
+ Public request, response, client, and transport types are exported from the package root:
352
+
353
+ ```ts
354
+ import {
355
+ HyperClient,
356
+ type HyperClientOptions,
357
+ type RestRequestOptions,
358
+ type UniversalResponse,
359
+ } from "hyperttp";
360
+
361
+ interface User {
362
+ id: string;
363
+ name: string;
364
+ }
365
+
366
+ const options: RestRequestOptions = {
367
+ query: { active: true },
368
+ timeout: 5_000,
369
+ };
370
+
371
+ const users = await new HyperClient({
372
+ baseURL: "https://api.example.com",
373
+ }).get<User[]>("/users", options);
374
+ ```
222
375
 
223
- ---
376
+ Generics describe the expected response shape; they do not validate untrusted server data at
377
+ runtime.
224
378
 
225
- ## Runtime Transports
379
+ ## Lifecycle
226
380
 
227
- Hyperttp uses `@hyperttp/transport-undici` automatically on Node.js. The transport is included with
228
- the `hyperttp` package, so no additional installation or client configuration is required:
381
+ A client may own connection pools and other transport resources. Destroy long-lived clients during
382
+ application shutdown, not after every request:
229
383
 
230
384
  ```ts
231
- import { HyperClient } from "hyperttp";
385
+ const api = new HyperClient({
386
+ baseURL: "https://api.example.com",
387
+ });
232
388
 
233
- const client = new HyperClient();
234
- // Uses UndiciTransport on Node.js.
389
+ try {
390
+ await runApplication(api);
391
+ } finally {
392
+ await api.destroy(true);
393
+ }
235
394
  ```
236
395
 
237
- Other runtimes can use the standard `globalThis.fetch` fallback. Runtime-specific transport packages
238
- can be installed separately when available:
396
+ Pass `true` for graceful shutdown or `false` when resources must be destroyed immediately.
397
+
398
+ ## Coming from Axios?
399
+
400
+ The request style is intentionally familiar, but Hyperttp is not a drop-in Axios replacement.
401
+
402
+ | Axios | Hyperttp |
403
+ | ------------------------------- | ------------------------------------------------------------- |
404
+ | `axios.create({ baseURL })` | `new HyperClient({ baseURL })` |
405
+ | `axios.get(url, { params })` | `client.get(url, { query })` |
406
+ | `axios.post(url, data, config)` | `client.post(url, body, options)` |
407
+ | `response.data` | Returned directly by shortcut methods |
408
+ | `response.status` | Use an absolute URL with `client.rest.*` |
409
+ | `signal` | `signal` in request options or the positional signal argument |
410
+ | Request/response interceptors | Built-in interceptor plugin or custom plugins |
411
+ | Instance default headers | Request options or an interceptor |
412
+
413
+ Legacy `Request` and `PreparedRequest` exports remain available for compatibility but are
414
+ deprecated. New code should use `client.request()` and `RequestBuilder`.
415
+
416
+ ## Choosing a client
417
+
418
+ The goal of this table is not to declare a universal winner. It highlights when each client is a
419
+ natural fit based on its documented built-in features.
420
+
421
+ | Capability | Fetch | Axios | Ky | ofetch | Got | Hyperttp |
422
+ | -------------------------- | --------------- | ------------------------- | ------------------------ | -------------------------- | -------------------------------- | ------------------------------ |
423
+ | Primary runtimes | Runtime native | Browser, Node | Browser, Node, Bun, Deno | Node, browser, workers | Node | Node plus Fetch-based runtimes |
424
+ | Parsed-data shortcut | No | Via `response.data` | Via `.json()` | Yes | JSON mode | Yes |
425
+ | Full response access | Yes | Yes | Yes | Yes (`.raw`) | Yes | Yes (`client.rest`) |
426
+ | Automatic retries | No | No built-in | Yes | Yes | Yes | Not currently stable |
427
+ | Application response cache | No | No built-in | No built-in | No built-in | Yes | Yes |
428
+ | In-flight deduplication | No | No built-in | No built-in | No built-in | No built-in | Yes |
429
+ | Built-in rate limiting | No | No | No | No | No | Yes |
430
+ | Built-in concurrency queue | No | No | No | No | No | Yes |
431
+ | Interceptors or hooks | No | Interceptors | Hooks | Interceptors | Hooks | Interceptors and plugins |
432
+ | Notable strength | Zero dependency | Ecosystem and familiarity | Small Fetch-based API | Universal Fetch experience | Node streams, HTTP/2, pagination | Integrated request policies |
433
+
434
+ ### Choose Fetch when
435
+
436
+ - you need no dependency;
437
+ - platform APIs are enough;
438
+ - you are comfortable composing policies yourself.
439
+
440
+ ### Choose Axios when
441
+
442
+ - your team already knows its API;
443
+ - its mature ecosystem matters more than built-in operational policies;
444
+ - browser and Node support are the main targets.
445
+
446
+ ### Choose Ky when
239
447
 
240
- | Runtime | Package | Availability |
241
- | ------- | ---------------------------- | ----------------------------------- |
242
- | Node.js | `@hyperttp/transport-undici` | Included and selected automatically |
243
- | Bun | `@hyperttp/transport-bun` | Optional runtime-specific transport |
244
- | Deno | `@hyperttp/transport-deno` | Optional runtime-specific transport |
448
+ - you want a small, modern Fetch wrapper;
449
+ - retries and lifecycle hooks cover your needs;
450
+ - a Fetch-compatible response model is desirable.
245
451
 
246
- ---
452
+ ### Choose ofetch when
453
+
454
+ - you want automatic parsing and retries with a Fetch-oriented universal API;
455
+ - Node, browser, and worker portability matters;
456
+ - you do not need cache, deduplication, rate limiting, and queueing in the client itself.
457
+
458
+ ### Choose Got when
459
+
460
+ - the application is Node-only;
461
+ - advanced streams, HTTP/2, pagination, timings, and RFC caching are important.
462
+
463
+ ### Choose Hyperttp when
464
+
465
+ - you want Axios-like request methods that return parsed data directly;
466
+ - cache, deduplication, rate limiting, and concurrency control should share one pipeline;
467
+ - the client is part of an SDK, service, bot, CLI, scraper, or integration with operational limits;
468
+ - you prefer one extensible client over several unrelated wrappers.
469
+
470
+ Comparison references: [Axios](https://github.com/axios/axios),
471
+ [Ky](https://github.com/sindresorhus/ky), [ofetch](https://github.com/unjs/ofetch), and
472
+ [Got](https://github.com/sindresorhus/got). Features and runtime support can change between releases;
473
+ verify the requirements that matter to your application.
474
+
475
+ Ky, Axios, ofetch, and Got are comparison references only. They are not Hyperttp dependencies.
476
+
477
+ ## Runtime transports
478
+
479
+ - Node.js resolves the included `@hyperttp/transport-undici` transport.
480
+ - Other runtimes can use the Fetch fallback when `globalThis.fetch` is available.
481
+ - Optional Bun- and Deno-specific transport packages may be installed separately.
482
+ - A custom transport can be passed to the constructor or through `customTransport`.
483
+
484
+ Use `await client.getTransportName()` to inspect the selected transport.
485
+
486
+ Runtime code paths target Node.js, Bun, Deno, and browsers. The repository test suite currently
487
+ verifies the Node.js path; validate the other runtimes in your own deployment environment.
247
488
 
248
489
  ## Ecosystem
249
490
 
491
+ Hyperttp is composed from focused packages:
492
+
250
493
  - `@hyperttp/core`
251
494
  - `@hyperttp/types`
252
495
  - `@hyperttp/interceptors`
@@ -259,19 +502,6 @@ can be installed separately when available:
259
502
  - `@hyperttp/parser`
260
503
  - `@hyperttp/transport-undici`
261
504
 
262
- ---
263
-
264
- ## Performance
265
-
266
- The benchmark suite compares complete client stacks rather than isolated request primitives. Results
267
- from a local environment are not a guarantee of production performance, so test with your own
268
- workload, concurrency, payloads, and network conditions.
269
-
270
- Benchmark sources and current results are available in
271
- [IT-IF-OR/bench](https://github.com/IT-IF-OR/bench).
272
-
273
- ---
274
-
275
505
  ## License
276
506
 
277
- MIT © dirold2
507
+ MIT
@@ -39,12 +39,15 @@ export interface UrlExtractorInterface {
39
39
  * @ru Извлекает идентификаторы из URL для указанной сущности и платформы.
40
40
  * @en Extracts IDs from URL for the specified entity and platform.
41
41
  *
42
- * @typeParam T - ID type (string or number).
43
42
  * @param url - URL to extract from.
44
43
  * @param entity - Entity name to look for.
45
44
  * @param platform - Platform name.
45
+ * @param castNumbers - Convert safe decimal values to numbers when explicitly enabled.
46
46
  * @returns Object with extracted IDs mapped by group names.
47
47
  */
48
- extractId<T extends string | number>(url: string, entity: string, platform: string): Record<string, T>;
48
+ extractId(url: string, entity: string, platform: string): Record<string, string>;
49
+ extractId(url: string, entity: string, platform: string, castNumbers: false): Record<string, string>;
50
+ extractId(url: string, entity: string, platform: string, castNumbers: true): Record<string, string | number>;
51
+ extractId(url: string, entity: string, platform: string, castNumbers: boolean): Record<string, string | number>;
49
52
  }
50
53
  //# sourceMappingURL=url-extractor.d.ts.map