hyperttp 0.4.16 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,8 +17,8 @@ import { HyperClient } from "hyperttp";
17
17
 
18
18
  const client = new HyperClient();
19
19
 
20
- // Automatically parses response based on the second argument
21
- const user = await client.get("https://api.example.com/users/1", "json");
20
+ // Parse JSON explicitly, regardless of the response Content-Type
21
+ const user = await client.request("https://api.example.com/users/1").json().send();
22
22
 
23
23
  console.log(user);
24
24
  ```
@@ -95,7 +95,7 @@ Start making requests.
95
95
 
96
96
  ## Quick Start
97
97
 
98
- ### 1. Install core package
98
+ ### 1. Install Hyperttp
99
99
 
100
100
  ```bash
101
101
  # Node.js
@@ -119,9 +119,10 @@ const client = new HyperClient({
119
119
  baseURL: "https://api.example.com",
120
120
  });
121
121
 
122
- await client.get("/users", "json");
123
- await client.post("/users", { name: "John" }, "json");
124
- await client.put("/users/1", { name: "Alice" }, "json");
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();
125
126
  await client.delete("/users/1");
126
127
  ```
127
128
 
@@ -163,7 +164,7 @@ const client = new HyperClient({
163
164
  baseURL: "https://api.example.com",
164
165
 
165
166
  retry: {
166
- retries: 3,
167
+ maxRetries: 3,
167
168
  },
168
169
 
169
170
  cache: {
@@ -174,6 +175,31 @@ const client = new HyperClient({
174
175
  });
175
176
  ```
176
177
 
178
+ ### Built-in Plugins
179
+
180
+ `HyperClient` automatically registers interceptors, serialization, metrics, request deduplication,
181
+ caching, rate limiting, queueing, and response parsing.
182
+
183
+ Disable only automatic response parsing:
184
+
185
+ ```ts
186
+ const client = new HyperClient({
187
+ responseConverter: false,
188
+ });
189
+ ```
190
+
191
+ Disable the entire built-in plugin set for a minimal pipeline:
192
+
193
+ ```ts
194
+ const client = new HyperClient({
195
+ builtInPlugins: false,
196
+ });
197
+ ```
198
+
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.
202
+
177
203
  ---
178
204
 
179
205
  ## Architecture
@@ -198,54 +224,54 @@ All components are independent and replaceable.
198
224
 
199
225
  ## Runtime Transports
200
226
 
201
- Hyperttp works **out of the box** in any environment using standard `globalThis.fetch`.
202
-
203
- For maximum performance and native features,
204
- you can optionally install an optimized transport package tailored for your specific runtime:
205
-
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 |
211
-
212
- Once installed, no additional configuration is required:
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:
213
229
 
214
230
  ```ts
215
231
  import { HyperClient } from "hyperttp";
216
232
 
217
233
  const client = new HyperClient();
218
- // Automatically discovers and uses UndiciTransport on Node.js, BunTransport on Bun, etc.
234
+ // Uses UndiciTransport on Node.js.
219
235
  ```
220
236
 
237
+ Other runtimes can use the standard `globalThis.fetch` fallback. Runtime-specific transport packages
238
+ can be installed separately when available:
239
+
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 |
245
+
221
246
  ---
222
247
 
223
248
  ## Ecosystem
224
249
 
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
250
+ - `@hyperttp/core`
251
+ - `@hyperttp/types`
252
+ - `@hyperttp/interceptors`
253
+ - `@hyperttp/serializer`
254
+ - `@hyperttp/metrics`
255
+ - `@hyperttp/inflight`
256
+ - `@hyperttp/cache`
257
+ - `@hyperttp/ratelimit`
258
+ - `@hyperttp/queue`
259
+ - `@hyperttp/parser`
260
+ - `@hyperttp/transport-undici`
236
261
 
237
262
  ---
238
263
 
239
264
  ## Performance
240
265
 
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.
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.
243
269
 
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.
270
+ Benchmark sources and current results are available in
271
+ [IT-IF-OR/bench](https://github.com/IT-IF-OR/bench).
246
272
 
247
273
  ---
248
274
 
249
275
  ## License
250
276
 
251
- MIT
277
+ MIT © dirold2
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { HyperClient, RequestBuilder } from "./Hyperttp/index.js";
2
2
  export { Request, PreparedRequest, UrlExtractor } from "./Hyperttp/index.js";
3
+ export type { RequestQuery } from "./Hyperttp/Utils/query.js";
4
+ export type { RequestHeaders, RequestBodyData, RequestConfig } from "./Hyperttp/Request.js";
3
5
  export type * from "./Types/index.js";
4
6
  export * from "@hyperttp/cache";
5
7
  export * from "@hyperttp/queue";
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7E,mBAAmB,kBAAkB,CAAC;AAEtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7E,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE5F,mBAAmB,kBAAkB,CAAC;AAEtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
package/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export { HyperClient, RequestBuilder } from \"./Hyperttp/index.js\";\nexport { Request, PreparedRequest, UrlExtractor } from \"./Hyperttp/index.js\";\n\nexport type * from \"./Types/index.js\";\n\nexport * from \"@hyperttp/cache\";\nexport * from \"@hyperttp/queue\";\nexport * from \"@hyperttp/ratelimit\";\nexport * from \"@hyperttp/interceptors\";\nexport * from \"@hyperttp/metrics\";\nexport * from \"@hyperttp/inflight\";\nexport * from \"@hyperttp/parser\";\nexport * from \"@hyperttp/serializer\";\n"],
5
- "mappings": "aAAA,OAAS,YAAa,mBAAsB,sBAC5C,OAAS,QAAS,gBAAiB,iBAAoB,sBAIvD,WAAc,kBACd,WAAc,kBACd,WAAc,sBACd,WAAc,yBACd,WAAc,oBACd,WAAc,qBACd,WAAc,mBACd,WAAc",
4
+ "sourcesContent": ["export { HyperClient, RequestBuilder } from \"./Hyperttp/index.js\";\nexport { Request, PreparedRequest, UrlExtractor } from \"./Hyperttp/index.js\";\n\nexport type { RequestQuery } from \"./Hyperttp/Utils/query.js\";\nexport type { RequestHeaders, RequestBodyData, RequestConfig } from \"./Hyperttp/Request.js\";\n\nexport type * from \"./Types/index.js\";\n\nexport * from \"@hyperttp/cache\";\nexport * from \"@hyperttp/queue\";\nexport * from \"@hyperttp/ratelimit\";\nexport * from \"@hyperttp/interceptors\";\nexport * from \"@hyperttp/metrics\";\nexport * from \"@hyperttp/inflight\";\nexport * from \"@hyperttp/parser\";\nexport * from \"@hyperttp/serializer\";\n"],
5
+ "mappings": "aAAA,OAAS,YAAa,mBAAsB,sBAC5C,OAAS,QAAS,gBAAiB,iBAAoB,sBAOvD,WAAc,kBACd,WAAc,kBACd,WAAc,sBACd,WAAc,yBACd,WAAc,oBACd,WAAc,qBACd,WAAc,mBACd,WAAc",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperttp",
3
- "version": "0.4.16",
3
+ "version": "0.5.0",
4
4
  "description": "A high-performance, universal HTTP client for Node.js, Bun, Deno and Browser with caching, retries, queueing, rate limiting, cookies and logging.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -35,16 +35,19 @@
35
35
  "url": "git+https://github.com/dirold2/hyperttp.git"
36
36
  },
37
37
  "dependencies": {
38
- "@hyperttp/cache": "^1.2.0",
39
- "@hyperttp/core": "^1.5.5",
40
- "@hyperttp/inflight": "^1.1.6",
41
- "@hyperttp/interceptors": "^1.1.5",
42
- "@hyperttp/metrics": "^1.2.0",
43
- "@hyperttp/parser": "^1.2.0",
44
- "@hyperttp/queue": "^1.1.5",
45
- "@hyperttp/ratelimit": "^1.1.5",
46
- "@hyperttp/serializer": "^1.2.0",
47
- "@hyperttp/types": "^0.2.5"
38
+ "@hyperttp/cache": "^2.0.0",
39
+ "@hyperttp/core": "^2.0.0",
40
+ "@hyperttp/inflight": "^2.0.0",
41
+ "@hyperttp/interceptors": "^2.0.0",
42
+ "@hyperttp/metrics": "^2.0.0",
43
+ "@hyperttp/parser": "^2.0.0",
44
+ "@hyperttp/queue": "^2.0.0",
45
+ "@hyperttp/ratelimit": "^2.0.0",
46
+ "@hyperttp/serializer": "^2.0.0",
47
+ "@hyperttp/transport-undici": "^0.3.0",
48
+ "@hyperttp/types": "^0.3.0",
49
+ "hcacher": "^0.2.0",
50
+ "undici": "^8.10.0"
48
51
  },
49
52
  "private": false
50
53
  }