hyperttp 0.4.16 → 0.5.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/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,242 +9,496 @@
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
- // Automatically parses response based on the second argument
21
- const user = await client.get("https://api.example.com/users/1", "json");
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
+ ```bash
56
+ npm install hyperttp
57
+ ```
52
58
 
53
- Hyperttp provides these capabilities through a single client.
59
+ ```bash
60
+ pnpm add hyperttp
61
+ ```
54
62
 
55
- ---
63
+ ```bash
64
+ bun add hyperttp
65
+ ```
56
66
 
57
- ## Why Hyperttp?
67
+ ```bash
68
+ deno add npm:hyperttp
69
+ ```
58
70
 
59
- Instead of building your own networking layer:
71
+ ## Quick start
60
72
 
61
- ```text
62
- fetch
63
- ├── retry
64
- ├── cache
65
- ├── parser
66
- ├── metrics
67
- ├── serializer
68
- ├── queue
69
- ├── timeout
70
- └── custom wrappers
73
+ ### Create a reusable client
74
+
75
+ ```ts
76
+ import { HyperClient } from "hyperttp";
71
77
 
78
+ export const api = new HyperClient({
79
+ baseURL: "https://api.example.com/v1/",
80
+ });
72
81
  ```
73
82
 
74
- Hyperttp provides a ready-to-use infrastructure:
83
+ Reuse the client across your application so transports, connection pools, cache entries, and
84
+ plugin state can be shared.
75
85
 
76
- ```text
77
- Hyperttp
78
- ├── Retry
79
- ├── Cache
80
- ├── Metrics
81
- ├── Parser
82
- ├── Serializer
83
- ├── Queue
84
- ├── Interceptors
85
- ├── Timeout
86
- └── Rate Limiter
86
+ ```ts
87
+ interface User {
88
+ id: string;
89
+ name: string;
90
+ active: boolean;
91
+ }
92
+
93
+ const users = await api.get<User[]>("users");
94
+ const user = await api.get<User>("users/42");
95
+ ```
96
+
97
+ ### Send data
98
+
99
+ ```ts
100
+ const created = await api.post<User>("users", {
101
+ name: "Alice",
102
+ active: true,
103
+ });
104
+
105
+ await api.put("users/42", {
106
+ name: "Alice Cooper",
107
+ });
108
+
109
+ await api.patch("users/42", {
110
+ active: false,
111
+ });
87
112
 
113
+ await api.delete("users/42");
88
114
  ```
89
115
 
90
- Create a client.
116
+ Objects and arrays are serialized as JSON by the built-in serializer.
91
117
 
92
- Start making requests.
118
+ ## Request options
93
119
 
94
- ---
120
+ ### Query parameters
95
121
 
96
- ## Quick Start
122
+ Hyperttp uses `query` where Axios uses `params`:
97
123
 
98
- ### 1. Install core package
124
+ ```ts
125
+ const users = await api.get<User[]>("users", {
126
+ query: {
127
+ page: 1,
128
+ limit: 20,
129
+ active: true,
130
+ role: ["admin", "editor"],
131
+ },
132
+ });
133
+ ```
99
134
 
100
- ```bash
101
- # Node.js
102
- npm install hyperttp
103
- pnpm add hyperttp
135
+ Array values become repeated query parameters. `null` and `undefined` values are omitted by the
136
+ fluent builder.
104
137
 
105
- # Bun
106
- bun add hyperttp
138
+ ### Headers
107
139
 
108
- # Deno
109
- deno add npm:hyperttp
140
+ ```ts
141
+ const profile = await api.get<User>("profile", {
142
+ headers: {
143
+ Authorization: `Bearer ${token}`,
144
+ "X-Request-ID": requestId,
145
+ },
146
+ });
147
+ ```
148
+
149
+ Hyperttp currently has no top-level default `headers` option. Use request options or a request
150
+ interceptor when headers must be added globally.
151
+
152
+ ### Timeout and cancellation
153
+
154
+ ```ts
155
+ const controller = new AbortController();
110
156
 
157
+ const request = api.get("reports/large", {
158
+ timeout: 10_000,
159
+ signal: controller.signal,
160
+ });
161
+
162
+ controller.abort();
163
+
164
+ await request;
111
165
  ```
112
166
 
113
- ### 2. Basic Usage
167
+ Timeouts, aborts, and transport failures reject the request. HTTP error status codes are handled
168
+ differently; see [Responses and HTTP errors](#responses-and-http-errors).
169
+
170
+ ### Explicit response format
114
171
 
115
172
  ```ts
116
- import { HyperClient } from "hyperttp";
173
+ const text = await api.get<string>("health", "text");
117
174
 
118
- const client = new HyperClient({
119
- baseURL: "https://api.example.com",
175
+ const document = await api.get("document.xml", {
176
+ responseType: "xml",
177
+ });
178
+ ```
179
+
180
+ Supported response hints are `json`, `text`, `xml`, `html`, `buffer`, and `stream`.
181
+
182
+ ## Understanding `baseURL`
183
+
184
+ Hyperttp resolves relative URLs with the standard `URL` rules:
185
+
186
+ ```ts
187
+ const api = new HyperClient({
188
+ baseURL: "https://api.example.com/v1/",
120
189
  });
121
190
 
122
- await client.get("/users", "json");
123
- await client.post("/users", { name: "John" }, "json");
124
- await client.put("/users/1", { name: "Alice" }, "json");
125
- await client.delete("/users/1");
191
+ await api.get("users"); // https://api.example.com/v1/users
192
+ await api.get("/users"); // https://api.example.com/users
193
+ ```
194
+
195
+ A leading slash starts from the origin root. Omit it when the path should remain under the
196
+ `baseURL` pathname.
197
+
198
+ `baseURL` applies to HyperClient shortcuts, `head()`, `stream()`, and `RequestBuilder`. The directly
199
+ delegated `client.rest` namespace currently expects an absolute URL.
200
+
201
+ ## Fluent requests
202
+
203
+ Use shortcuts for simple requests and `RequestBuilder` when a longer request reads better as a
204
+ chain:
205
+
206
+ ```ts
207
+ const user = await api
208
+ .request("users")
209
+ .post()
210
+ .headers({
211
+ "X-Request-ID": requestId,
212
+ })
213
+ .query({ notify: true })
214
+ .jsonBody({
215
+ name: "Alice",
216
+ active: true,
217
+ })
218
+ .json()
219
+ .send<User>();
126
220
  ```
127
221
 
128
- ---
222
+ Available builder methods include:
129
223
 
130
- ## Hyperttp vs Other HTTP Clients
224
+ - HTTP method: `get`, `post`, `put`, `patch`, `delete`, `head`, `options`, `method`
225
+ - Request data: `headers`, `query`, `body`, `jsonBody`
226
+ - Control: `timeout`, `signal`
227
+ - Response hint: `json`, `text`, `xml`, `html`, `buffer`, `stream`
228
+ - Utility: `clone`, `send`
131
229
 
132
- | Feature | fetch | Axios | Ky | Hyperttp |
133
- | ------------------------ | ----- | ------ | ------- | -------- |
134
- | Promise API | ✅ | ✅ | ✅ | ✅ |
135
- | Retry | ❌ | Plugin | ✅ | ✅ |
136
- | Cache | ❌ | ❌ | ❌ | ✅ |
137
- | Metrics | ❌ | ❌ | ❌ | ✅ |
138
- | Rate Limiter | ❌ | ❌ | ❌ | ✅ |
139
- | Queue | ❌ | ❌ | ❌ | ✅ |
140
- | Parser | ❌ | ❌ | Partial | ✅ |
141
- | Serializer | ❌ | ❌ | ❌ | ✅ |
142
- | Interceptors | ❌ | ✅ | Hooks | ✅ |
143
- | Transport auto-detection | ❌ | ❌ | ❌ | ✅ |
230
+ For live response streaming, use `client.stream()` rather than the builder response hint.
144
231
 
145
- ---
232
+ ## Responses and HTTP errors
146
233
 
147
- ## Who is Hyperttp for?
234
+ ### Convenience methods return data
148
235
 
149
- Perfect for:
236
+ ```ts
237
+ const users = await api.get<User[]>("users");
238
+ ```
150
239
 
151
- - REST APIs & SDKs
152
- - CLI applications & Discord bots
153
- - Backend & Serverless services
154
- - Web scraping
155
- - Enterprise applications
240
+ The return value is already the parsed response data. Status, headers, and other envelope fields
241
+ are intentionally omitted from shortcut results.
156
242
 
157
- ---
243
+ ### Access the full response
158
244
 
159
- ## Advanced Configuration
245
+ Use the REST namespace when status and headers are needed:
160
246
 
161
247
  ```ts
162
- const client = new HyperClient({
163
- baseURL: "https://api.example.com",
248
+ const response = await api.rest.get<User[]>("https://api.example.com/v1/users");
164
249
 
165
- retry: {
166
- retries: 3,
167
- },
250
+ console.log(response.ok);
251
+ console.log(response.status);
252
+ console.log(response.headers);
253
+ console.log(response.data);
254
+ ```
255
+
256
+ The full response contains `protocol`, `ok`, `status`, `statusText`, `headers`, `url`, `data`, and
257
+ optional metadata/raw fields.
258
+
259
+ ### HTTP statuses do not throw by default
260
+
261
+ A `4xx` or `5xx` response resolves normally. With shortcuts, the parsed error body is returned. With
262
+ the full response API, inspect `response.ok` or `response.status`:
263
+
264
+ ```ts
265
+ const response = await api.rest.get<ErrorPayload>("https://api.example.com/v1/users/missing");
266
+
267
+ if (!response.ok) {
268
+ console.error(response.status, response.data);
269
+ }
270
+ ```
271
+
272
+ This differs from Axios, Ky, Got, and ofetch defaults, which commonly reject non-success responses.
273
+
274
+ ## Built-in request policies
275
+
276
+ Built-in plugins are registered automatically. Policies that should be explicit, such as rate
277
+ limiting and queueing, can be enabled in client configuration:
278
+
279
+ ```ts
280
+ const api = new HyperClient({
281
+ baseURL: "https://api.example.com/v1/",
168
282
 
169
283
  cache: {
284
+ enabled: true,
170
285
  ttl: 60_000,
286
+ maxSize: 1_000,
287
+ },
288
+
289
+ inflight: {
290
+ enabled: true,
171
291
  },
172
292
 
173
- timeout: 30_000,
293
+ rateLimit: {
294
+ enabled: true,
295
+ maxRequests: 100,
296
+ windowMs: 60_000,
297
+ },
298
+
299
+ queue: {
300
+ enabled: true,
301
+ maxConcurrent: 20,
302
+ },
174
303
  });
175
304
  ```
176
305
 
177
- ---
306
+ | Policy | Purpose |
307
+ | ----------------------- | ------------------------------------------------------------- |
308
+ | Cache | Reuse successful GET/HEAD responses according to cache policy |
309
+ | In-flight deduplication | Share compatible concurrent GET requests |
310
+ | Rate limiter | Control request volume and react to server penalties |
311
+ | Queue | Limit concurrent work per configured partition |
312
+ | Serializer | Encode object/array request bodies |
313
+ | Parser | Convert JSON, text, HTML, XML, buffer, and empty responses |
314
+ | Interceptors | Transform requests and responses |
178
315
 
179
- ## Architecture
316
+ Disable the entire built-in plugin preset when composing a custom pipeline:
180
317
 
181
- ```text
182
- Application
183
- │
184
- ▼
185
- HyperClient
186
- │
187
- Plugin Pipeline
188
- │
189
- Transport (Auto-detected)
190
- │
191
- HTTP
318
+ ```ts
319
+ const client = new HyperClient({
320
+ builtInPlugins: false,
321
+ plugins: [myPlugin],
322
+ });
323
+ ```
324
+
325
+ The REST protocol and plugins explicitly supplied through `plugins` or `client.use()` remain
326
+ available.
192
327
 
328
+ > Retry options exist in the current type surface, but retry execution is not documented as a
329
+ > stable feature in `0.5.x`. It is therefore not counted as an active capability in the comparison
330
+ > below.
331
+
332
+ ## Streaming
333
+
334
+ `stream()` returns the complete response envelope. Its `data` is an async-iterable byte stream:
335
+
336
+ ```ts
337
+ const response = await api.stream("events");
338
+ const decoder = new TextDecoder();
339
+
340
+ for await (const chunk of response.data) {
341
+ console.log(decoder.decode(chunk, { stream: true }));
342
+ }
193
343
  ```
194
344
 
195
- All components are independent and replaceable.
345
+ The concrete stream implementation depends on the active runtime transport.
196
346
 
197
- ---
347
+ ## TypeScript
198
348
 
199
- ## Runtime Transports
349
+ Public request, response, client, and transport types are exported from the package root:
200
350
 
201
- Hyperttp works **out of the box** in any environment using standard `globalThis.fetch`.
351
+ ```ts
352
+ import {
353
+ HyperClient,
354
+ type HyperClientOptions,
355
+ type RestRequestOptions,
356
+ type UniversalResponse,
357
+ } from "hyperttp";
358
+
359
+ interface User {
360
+ id: string;
361
+ name: string;
362
+ }
363
+
364
+ const options: RestRequestOptions = {
365
+ query: { active: true },
366
+ timeout: 5_000,
367
+ };
368
+
369
+ const users = await new HyperClient({
370
+ baseURL: "https://api.example.com",
371
+ }).get<User[]>("/users", options);
372
+ ```
202
373
 
203
- For maximum performance and native features,
204
- you can optionally install an optimized transport package tailored for your specific runtime:
374
+ Generics describe the expected response shape; they do not validate untrusted server data at
375
+ runtime.
205
376
 
206
- | Runtime | Package | Description |
207
- | ------- | ---------------------------- | -------------------------------------------- |
208
- | Node.js | `@hyperttp/transport-undici` | Uses high-performance native `undici` client |
209
- | Bun | `@hyperttp/transport-bun` | Leverages native `Bun.fetch` optimizations |
210
- | Deno | `@hyperttp/transport-deno` | Optimized for native Deno network layer |
377
+ ## Lifecycle
211
378
 
212
- Once installed, no additional configuration is required:
379
+ A client may own connection pools and other transport resources. Destroy long-lived clients during
380
+ application shutdown, not after every request:
213
381
 
214
382
  ```ts
215
- import { HyperClient } from "hyperttp";
383
+ const api = new HyperClient({
384
+ baseURL: "https://api.example.com",
385
+ });
216
386
 
217
- const client = new HyperClient();
218
- // Automatically discovers and uses UndiciTransport on Node.js, BunTransport on Bun, etc.
387
+ try {
388
+ await runApplication(api);
389
+ } finally {
390
+ await api.destroy(true);
391
+ }
219
392
  ```
220
393
 
221
- ---
394
+ Pass `true` for graceful shutdown or `false` when resources must be destroyed immediately.
222
395
 
223
- ## Ecosystem
396
+ ## Coming from Axios?
397
+
398
+ The request style is intentionally familiar, but Hyperttp is not a drop-in Axios replacement.
399
+
400
+ | Axios | Hyperttp |
401
+ | ------------------------------- | ------------------------------------------------------------- |
402
+ | `axios.create({ baseURL })` | `new HyperClient({ baseURL })` |
403
+ | `axios.get(url, { params })` | `client.get(url, { query })` |
404
+ | `axios.post(url, data, config)` | `client.post(url, body, options)` |
405
+ | `response.data` | Returned directly by shortcut methods |
406
+ | `response.status` | Use an absolute URL with `client.rest.*` |
407
+ | `signal` | `signal` in request options or the positional signal argument |
408
+ | Request/response interceptors | Built-in interceptor plugin or custom plugins |
409
+ | Instance default headers | Request options or an interceptor |
410
+
411
+ Legacy `Request` and `PreparedRequest` exports remain available for compatibility but are
412
+ deprecated. New code should use `client.request()` and `RequestBuilder`.
413
+
414
+ ## Choosing a client
415
+
416
+ The goal of this table is not to declare a universal winner. It highlights when each client is a
417
+ natural fit based on its documented built-in features.
224
418
 
225
- - hyperttp
226
- - @hyperttp/core
227
- - @hyperttp/types
228
- - @hyperttp/parser
229
- - @hyperttp/cache
230
- - @hyperttp/retry
231
- - @hyperttp/metrics
232
- - @hyperttp/serializer
233
- - @hyperttp/transport-undici
234
- - @hyperttp/transport-bun
235
- - @hyperttp/transport-deno
419
+ | Capability | Fetch | Axios | Ky | ofetch | Got | Hyperttp |
420
+ | -------------------------- | --------------- | ------------------------- | ------------------------ | -------------------------- | -------------------------------- | ------------------------------ |
421
+ | Primary runtimes | Runtime native | Browser, Node | Browser, Node, Bun, Deno | Node, browser, workers | Node | Node plus Fetch-based runtimes |
422
+ | Parsed-data shortcut | No | Via `response.data` | Via `.json()` | Yes | JSON mode | Yes |
423
+ | Full response access | Yes | Yes | Yes | Yes (`.raw`) | Yes | Yes (`client.rest`) |
424
+ | Automatic retries | No | No built-in | Yes | Yes | Yes | Not currently stable |
425
+ | Application response cache | No | No built-in | No built-in | No built-in | Yes | Yes |
426
+ | In-flight deduplication | No | No built-in | No built-in | No built-in | No built-in | Yes |
427
+ | Built-in rate limiting | No | No | No | No | No | Yes |
428
+ | Built-in concurrency queue | No | No | No | No | No | Yes |
429
+ | Interceptors or hooks | No | Interceptors | Hooks | Interceptors | Hooks | Interceptors and plugins |
430
+ | Notable strength | Zero dependency | Ecosystem and familiarity | Small Fetch-based API | Universal Fetch experience | Node streams, HTTP/2, pagination | Integrated request policies |
236
431
 
237
- ---
432
+ ### Choose Fetch when
238
433
 
239
- ## Performance
434
+ - you need no dependency;
435
+ - platform APIs are enough;
436
+ - you are comfortable composing policies yourself.
240
437
 
241
- Hyperttp is designed with zero-allocation middleware pipelines and minimal overhead.
242
- By using native runtime transports, it achieves near-raw-fetch speeds while providing a full feature set.
438
+ ### Choose Axios when
243
439
 
244
- Detailed benchmarks comparing memory footprints and
245
- request execution times across runtimes are available in the [IT-IF-OR/bench](https://github.com/IT-IF-OR/bench) repository.
440
+ - your team already knows its API;
441
+ - its mature ecosystem matters more than built-in operational policies;
442
+ - browser and Node support are the main targets.
443
+
444
+ ### Choose Ky when
445
+
446
+ - you want a small, modern Fetch wrapper;
447
+ - retries and lifecycle hooks cover your needs;
448
+ - a Fetch-compatible response model is desirable.
449
+
450
+ ### Choose ofetch when
451
+
452
+ - you want automatic parsing and retries with a Fetch-oriented universal API;
453
+ - Node, browser, and worker portability matters;
454
+ - you do not need cache, deduplication, rate limiting, and queueing in the client itself.
455
+
456
+ ### Choose Got when
457
+
458
+ - the application is Node-only;
459
+ - advanced streams, HTTP/2, pagination, timings, and RFC caching are important.
460
+
461
+ ### Choose Hyperttp when
462
+
463
+ - you want Axios-like request methods that return parsed data directly;
464
+ - cache, deduplication, rate limiting, and concurrency control should share one pipeline;
465
+ - the client is part of an SDK, service, bot, CLI, scraper, or integration with operational limits;
466
+ - you prefer one extensible client over several unrelated wrappers.
467
+
468
+ Comparison references: [Axios](https://github.com/axios/axios),
469
+ [Ky](https://github.com/sindresorhus/ky), [ofetch](https://github.com/unjs/ofetch), and
470
+ [Got](https://github.com/sindresorhus/got). Features and runtime support can change between releases;
471
+ verify the requirements that matter to your application.
472
+
473
+ Ky, Axios, ofetch, and Got are comparison references only. They are not Hyperttp dependencies.
474
+
475
+ ## Runtime transports
476
+
477
+ - Node.js resolves the included `@hyperttp/transport-undici` transport.
478
+ - Other runtimes can use the Fetch fallback when `globalThis.fetch` is available.
479
+ - Optional Bun- and Deno-specific transport packages may be installed separately.
480
+ - A custom transport can be passed to the constructor or through `customTransport`.
481
+
482
+ Use `await client.getTransportName()` to inspect the selected transport.
483
+
484
+ Runtime code paths target Node.js, Bun, Deno, and browsers. The repository test suite currently
485
+ verifies the Node.js path; validate the other runtimes in your own deployment environment.
486
+
487
+ ## Ecosystem
246
488
 
247
- ---
489
+ Hyperttp is composed from focused packages:
490
+
491
+ - `@hyperttp/core`
492
+ - `@hyperttp/types`
493
+ - `@hyperttp/interceptors`
494
+ - `@hyperttp/serializer`
495
+ - `@hyperttp/metrics`
496
+ - `@hyperttp/inflight`
497
+ - `@hyperttp/cache`
498
+ - `@hyperttp/ratelimit`
499
+ - `@hyperttp/queue`
500
+ - `@hyperttp/parser`
501
+ - `@hyperttp/transport-undici`
248
502
 
249
503
  ## License
250
504
 
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"url-extractor.d.ts","sourceRoot":"","sources":["../../src/Types/url-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,EAAE,CAAC,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAEjE;;;;;;;;;OASG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACjC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CACtB"}
1
+ {"version":3,"file":"url-extractor.d.ts","sourceRoot":"","sources":["../../src/Types/url-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,EAAE,CAAC,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAEjE;;;;;;;;;OASG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjF,SAAS,CACP,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,KAAK,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,SAAS,CACP,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,IAAI,GAChB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACnC,SAAS,CACP,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,OAAO,GACnB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC"}