nlcurl 0.6.0 → 0.8.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.
Files changed (354) hide show
  1. package/README.md +143 -140
  2. package/dist/cache/groups.d.ts +75 -0
  3. package/dist/cache/groups.d.ts.map +1 -0
  4. package/dist/cache/groups.js +118 -0
  5. package/dist/cache/groups.js.map +1 -0
  6. package/dist/cache/no-vary-search.d.ts +33 -0
  7. package/dist/cache/no-vary-search.d.ts.map +1 -0
  8. package/dist/cache/no-vary-search.js +148 -0
  9. package/dist/cache/no-vary-search.js.map +1 -0
  10. package/dist/cache/range.d.ts +120 -0
  11. package/dist/cache/range.d.ts.map +1 -0
  12. package/dist/cache/range.js +193 -0
  13. package/dist/cache/range.js.map +1 -0
  14. package/dist/cache/store.d.ts +111 -0
  15. package/dist/cache/store.d.ts.map +1 -0
  16. package/dist/cache/store.js +414 -0
  17. package/dist/cache/store.js.map +1 -0
  18. package/dist/cache/types.d.ts +69 -0
  19. package/dist/cache/types.d.ts.map +1 -0
  20. package/dist/cache/types.js +2 -0
  21. package/dist/cache/types.js.map +1 -0
  22. package/dist/cli/args.d.ts +4 -37
  23. package/dist/cli/args.d.ts.map +1 -1
  24. package/dist/cli/args.js +3 -4
  25. package/dist/cli/args.js.map +1 -1
  26. package/dist/cli/index.d.ts +0 -5
  27. package/dist/cli/index.d.ts.map +1 -1
  28. package/dist/cli/index.js +1 -6
  29. package/dist/cli/index.js.map +1 -1
  30. package/dist/cli/output.d.ts +14 -20
  31. package/dist/cli/output.d.ts.map +1 -1
  32. package/dist/cli/output.js +14 -20
  33. package/dist/cli/output.js.map +1 -1
  34. package/dist/cookies/jar.d.ts +33 -31
  35. package/dist/cookies/jar.d.ts.map +1 -1
  36. package/dist/cookies/jar.js +69 -33
  37. package/dist/cookies/jar.js.map +1 -1
  38. package/dist/cookies/parser.d.ts +14 -16
  39. package/dist/cookies/parser.d.ts.map +1 -1
  40. package/dist/cookies/parser.js +30 -13
  41. package/dist/cookies/parser.js.map +1 -1
  42. package/dist/cookies/psl-data.d.ts +1 -1
  43. package/dist/cookies/psl-data.js +1 -1
  44. package/dist/cookies/public-suffix.d.ts +5 -27
  45. package/dist/cookies/public-suffix.d.ts.map +1 -1
  46. package/dist/cookies/public-suffix.js +5 -37
  47. package/dist/cookies/public-suffix.js.map +1 -1
  48. package/dist/core/auth.d.ts +30 -0
  49. package/dist/core/auth.d.ts.map +1 -0
  50. package/dist/core/auth.js +34 -0
  51. package/dist/core/auth.js.map +1 -0
  52. package/dist/core/client.d.ts +28 -40
  53. package/dist/core/client.d.ts.map +1 -1
  54. package/dist/core/client.js +34 -41
  55. package/dist/core/client.js.map +1 -1
  56. package/dist/core/errors.d.ts +64 -88
  57. package/dist/core/errors.d.ts.map +1 -1
  58. package/dist/core/errors.js +64 -88
  59. package/dist/core/errors.js.map +1 -1
  60. package/dist/core/request.d.ts +63 -85
  61. package/dist/core/request.d.ts.map +1 -1
  62. package/dist/core/response.d.ts +64 -59
  63. package/dist/core/response.d.ts.map +1 -1
  64. package/dist/core/response.js +70 -52
  65. package/dist/core/response.js.map +1 -1
  66. package/dist/core/session.d.ts +81 -70
  67. package/dist/core/session.d.ts.map +1 -1
  68. package/dist/core/session.js +198 -71
  69. package/dist/core/session.js.map +1 -1
  70. package/dist/core/validation.d.ts +44 -42
  71. package/dist/core/validation.d.ts.map +1 -1
  72. package/dist/core/validation.js +47 -58
  73. package/dist/core/validation.js.map +1 -1
  74. package/dist/dns/cache.d.ts +59 -0
  75. package/dist/dns/cache.d.ts.map +1 -0
  76. package/dist/dns/cache.js +99 -0
  77. package/dist/dns/cache.js.map +1 -0
  78. package/dist/dns/codec.d.ts +39 -0
  79. package/dist/dns/codec.d.ts.map +1 -0
  80. package/dist/dns/codec.js +238 -0
  81. package/dist/dns/codec.js.map +1 -0
  82. package/dist/dns/doh-resolver.d.ts +38 -0
  83. package/dist/dns/doh-resolver.d.ts.map +1 -0
  84. package/dist/dns/doh-resolver.js +191 -0
  85. package/dist/dns/doh-resolver.js.map +1 -0
  86. package/dist/dns/dot-resolver.d.ts +89 -0
  87. package/dist/dns/dot-resolver.d.ts.map +1 -0
  88. package/dist/dns/dot-resolver.js +158 -0
  89. package/dist/dns/dot-resolver.js.map +1 -0
  90. package/dist/dns/https-rr.d.ts +40 -0
  91. package/dist/dns/https-rr.d.ts.map +1 -0
  92. package/dist/dns/https-rr.js +109 -0
  93. package/dist/dns/https-rr.js.map +1 -0
  94. package/dist/dns/types.d.ts +82 -0
  95. package/dist/dns/types.d.ts.map +1 -0
  96. package/dist/dns/types.js +23 -0
  97. package/dist/dns/types.js.map +1 -0
  98. package/dist/fingerprints/akamai.d.ts +3 -11
  99. package/dist/fingerprints/akamai.d.ts.map +1 -1
  100. package/dist/fingerprints/akamai.js +3 -11
  101. package/dist/fingerprints/akamai.js.map +1 -1
  102. package/dist/fingerprints/database.d.ts +6 -14
  103. package/dist/fingerprints/database.d.ts.map +1 -1
  104. package/dist/fingerprints/database.js +6 -14
  105. package/dist/fingerprints/database.js.map +1 -1
  106. package/dist/fingerprints/extensions.d.ts +56 -71
  107. package/dist/fingerprints/extensions.d.ts.map +1 -1
  108. package/dist/fingerprints/extensions.js +58 -71
  109. package/dist/fingerprints/extensions.js.map +1 -1
  110. package/dist/fingerprints/ja3.d.ts +12 -30
  111. package/dist/fingerprints/ja3.d.ts.map +1 -1
  112. package/dist/fingerprints/ja3.js +12 -30
  113. package/dist/fingerprints/ja3.js.map +1 -1
  114. package/dist/fingerprints/ja4.d.ts +18 -0
  115. package/dist/fingerprints/ja4.d.ts.map +1 -0
  116. package/dist/fingerprints/ja4.js +83 -0
  117. package/dist/fingerprints/ja4.js.map +1 -0
  118. package/dist/fingerprints/profiles/chrome.d.ts +18 -21
  119. package/dist/fingerprints/profiles/chrome.d.ts.map +1 -1
  120. package/dist/fingerprints/profiles/chrome.js +35 -31
  121. package/dist/fingerprints/profiles/chrome.js.map +1 -1
  122. package/dist/fingerprints/profiles/edge.d.ts +7 -10
  123. package/dist/fingerprints/profiles/edge.d.ts.map +1 -1
  124. package/dist/fingerprints/profiles/edge.js +7 -10
  125. package/dist/fingerprints/profiles/edge.js.map +1 -1
  126. package/dist/fingerprints/profiles/firefox.d.ts +8 -11
  127. package/dist/fingerprints/profiles/firefox.d.ts.map +1 -1
  128. package/dist/fingerprints/profiles/firefox.js +8 -11
  129. package/dist/fingerprints/profiles/firefox.js.map +1 -1
  130. package/dist/fingerprints/profiles/safari.d.ts +11 -14
  131. package/dist/fingerprints/profiles/safari.d.ts.map +1 -1
  132. package/dist/fingerprints/profiles/safari.js +11 -14
  133. package/dist/fingerprints/profiles/safari.js.map +1 -1
  134. package/dist/fingerprints/profiles/tor.d.ts +5 -8
  135. package/dist/fingerprints/profiles/tor.d.ts.map +1 -1
  136. package/dist/fingerprints/profiles/tor.js +5 -8
  137. package/dist/fingerprints/profiles/tor.js.map +1 -1
  138. package/dist/fingerprints/types.d.ts +42 -73
  139. package/dist/fingerprints/types.d.ts.map +1 -1
  140. package/dist/hsts/store.d.ts +39 -0
  141. package/dist/hsts/store.d.ts.map +1 -0
  142. package/dist/hsts/store.js +163 -0
  143. package/dist/hsts/store.js.map +1 -0
  144. package/dist/hsts/types.d.ts +24 -0
  145. package/dist/hsts/types.d.ts.map +1 -0
  146. package/dist/hsts/types.js +2 -0
  147. package/dist/hsts/types.js.map +1 -0
  148. package/dist/http/alt-svc.d.ts +67 -0
  149. package/dist/http/alt-svc.d.ts.map +1 -0
  150. package/dist/http/alt-svc.js +186 -0
  151. package/dist/http/alt-svc.js.map +1 -0
  152. package/dist/http/early-hints.d.ts +23 -0
  153. package/dist/http/early-hints.d.ts.map +1 -0
  154. package/dist/http/early-hints.js +33 -0
  155. package/dist/http/early-hints.js.map +1 -0
  156. package/dist/http/form-data.d.ts +17 -35
  157. package/dist/http/form-data.d.ts.map +1 -1
  158. package/dist/http/form-data.js +12 -34
  159. package/dist/http/form-data.js.map +1 -1
  160. package/dist/http/h1/client.d.ts +14 -26
  161. package/dist/http/h1/client.d.ts.map +1 -1
  162. package/dist/http/h1/client.js +29 -22
  163. package/dist/http/h1/client.js.map +1 -1
  164. package/dist/http/h1/encoder.d.ts +10 -17
  165. package/dist/http/h1/encoder.d.ts.map +1 -1
  166. package/dist/http/h1/encoder.js +10 -17
  167. package/dist/http/h1/encoder.js.map +1 -1
  168. package/dist/http/h1/parser.d.ts +22 -59
  169. package/dist/http/h1/parser.d.ts.map +1 -1
  170. package/dist/http/h1/parser.js +15 -47
  171. package/dist/http/h1/parser.js.map +1 -1
  172. package/dist/http/h2/client.d.ts +18 -59
  173. package/dist/http/h2/client.d.ts.map +1 -1
  174. package/dist/http/h2/client.js +29 -64
  175. package/dist/http/h2/client.js.map +1 -1
  176. package/dist/http/h2/frames.d.ts +53 -84
  177. package/dist/http/h2/frames.d.ts.map +1 -1
  178. package/dist/http/h2/frames.js +48 -76
  179. package/dist/http/h2/frames.js.map +1 -1
  180. package/dist/http/h2/hpack.d.ts +16 -35
  181. package/dist/http/h2/hpack.d.ts.map +1 -1
  182. package/dist/http/h2/hpack.js +16 -35
  183. package/dist/http/h2/hpack.js.map +1 -1
  184. package/dist/http/h3/detection.d.ts +15 -0
  185. package/dist/http/h3/detection.d.ts.map +1 -0
  186. package/dist/http/h3/detection.js +41 -0
  187. package/dist/http/h3/detection.js.map +1 -0
  188. package/dist/http/negotiator.d.ts +43 -33
  189. package/dist/http/negotiator.d.ts.map +1 -1
  190. package/dist/http/negotiator.js +99 -41
  191. package/dist/http/negotiator.js.map +1 -1
  192. package/dist/http/pool.d.ts +34 -64
  193. package/dist/http/pool.d.ts.map +1 -1
  194. package/dist/http/pool.js +22 -41
  195. package/dist/http/pool.js.map +1 -1
  196. package/dist/http/resumable-upload.d.ts +76 -0
  197. package/dist/http/resumable-upload.d.ts.map +1 -0
  198. package/dist/http/resumable-upload.js +104 -0
  199. package/dist/http/resumable-upload.js.map +1 -0
  200. package/dist/http/trailers.d.ts +29 -0
  201. package/dist/http/trailers.d.ts.map +1 -0
  202. package/dist/http/trailers.js +57 -0
  203. package/dist/http/trailers.js.map +1 -0
  204. package/dist/index.d.ts +36 -8
  205. package/dist/index.d.ts.map +1 -1
  206. package/dist/index.js +32 -1
  207. package/dist/index.js.map +1 -1
  208. package/dist/middleware/interceptor.d.ts +13 -32
  209. package/dist/middleware/interceptor.d.ts.map +1 -1
  210. package/dist/middleware/interceptor.js +11 -16
  211. package/dist/middleware/interceptor.js.map +1 -1
  212. package/dist/middleware/rate-limiter.d.ts +8 -17
  213. package/dist/middleware/rate-limiter.d.ts.map +1 -1
  214. package/dist/middleware/rate-limiter.js +15 -12
  215. package/dist/middleware/rate-limiter.js.map +1 -1
  216. package/dist/middleware/retry-after.d.ts +15 -0
  217. package/dist/middleware/retry-after.d.ts.map +1 -0
  218. package/dist/middleware/retry-after.js +36 -0
  219. package/dist/middleware/retry-after.js.map +1 -0
  220. package/dist/middleware/retry.d.ts +9 -18
  221. package/dist/middleware/retry.d.ts.map +1 -1
  222. package/dist/middleware/retry.js +12 -9
  223. package/dist/middleware/retry.js.map +1 -1
  224. package/dist/proxy/auth.d.ts +73 -0
  225. package/dist/proxy/auth.d.ts.map +1 -0
  226. package/dist/proxy/auth.js +128 -0
  227. package/dist/proxy/auth.js.map +1 -0
  228. package/dist/proxy/env-proxy.d.ts +11 -0
  229. package/dist/proxy/env-proxy.d.ts.map +1 -0
  230. package/dist/proxy/env-proxy.js +56 -0
  231. package/dist/proxy/env-proxy.js.map +1 -0
  232. package/dist/proxy/http-proxy.d.ts +13 -18
  233. package/dist/proxy/http-proxy.d.ts.map +1 -1
  234. package/dist/proxy/http-proxy.js +24 -14
  235. package/dist/proxy/http-proxy.js.map +1 -1
  236. package/dist/proxy/socks.d.ts +13 -20
  237. package/dist/proxy/socks.d.ts.map +1 -1
  238. package/dist/proxy/socks.js +6 -9
  239. package/dist/proxy/socks.js.map +1 -1
  240. package/dist/sse/parser.d.ts +47 -0
  241. package/dist/sse/parser.d.ts.map +1 -0
  242. package/dist/sse/parser.js +139 -0
  243. package/dist/sse/parser.js.map +1 -0
  244. package/dist/tls/constants.d.ts +15 -74
  245. package/dist/tls/constants.d.ts.map +1 -1
  246. package/dist/tls/constants.js +15 -74
  247. package/dist/tls/constants.js.map +1 -1
  248. package/dist/tls/ct.d.ts +78 -0
  249. package/dist/tls/ct.d.ts.map +1 -0
  250. package/dist/tls/ct.js +175 -0
  251. package/dist/tls/ct.js.map +1 -0
  252. package/dist/tls/early-data.d.ts +45 -0
  253. package/dist/tls/early-data.d.ts.map +1 -0
  254. package/dist/tls/early-data.js +46 -0
  255. package/dist/tls/early-data.js.map +1 -0
  256. package/dist/tls/ech.d.ts +130 -0
  257. package/dist/tls/ech.d.ts.map +1 -0
  258. package/dist/tls/ech.js +353 -0
  259. package/dist/tls/ech.js.map +1 -0
  260. package/dist/tls/keylog.d.ts +34 -0
  261. package/dist/tls/keylog.d.ts.map +1 -0
  262. package/dist/tls/keylog.js +64 -0
  263. package/dist/tls/keylog.js.map +1 -0
  264. package/dist/tls/node-engine.d.ts +15 -14
  265. package/dist/tls/node-engine.d.ts.map +1 -1
  266. package/dist/tls/node-engine.js +54 -14
  267. package/dist/tls/node-engine.js.map +1 -1
  268. package/dist/tls/ocsp.d.ts +55 -0
  269. package/dist/tls/ocsp.d.ts.map +1 -0
  270. package/dist/tls/ocsp.js +131 -0
  271. package/dist/tls/ocsp.js.map +1 -0
  272. package/dist/tls/pin-verification.d.ts +10 -0
  273. package/dist/tls/pin-verification.d.ts.map +1 -0
  274. package/dist/tls/pin-verification.js +28 -0
  275. package/dist/tls/pin-verification.js.map +1 -0
  276. package/dist/tls/session-cache.d.ts +58 -0
  277. package/dist/tls/session-cache.d.ts.map +1 -0
  278. package/dist/tls/session-cache.js +76 -0
  279. package/dist/tls/session-cache.js.map +1 -0
  280. package/dist/tls/stealth/client-hello.d.ts +34 -32
  281. package/dist/tls/stealth/client-hello.d.ts.map +1 -1
  282. package/dist/tls/stealth/client-hello.js +116 -11
  283. package/dist/tls/stealth/client-hello.js.map +1 -1
  284. package/dist/tls/stealth/engine.d.ts +5 -15
  285. package/dist/tls/stealth/engine.d.ts.map +1 -1
  286. package/dist/tls/stealth/engine.js +163 -47
  287. package/dist/tls/stealth/engine.js.map +1 -1
  288. package/dist/tls/stealth/handshake.d.ts +23 -32
  289. package/dist/tls/stealth/handshake.d.ts.map +1 -1
  290. package/dist/tls/stealth/handshake.js +112 -27
  291. package/dist/tls/stealth/handshake.js.map +1 -1
  292. package/dist/tls/stealth/key-schedule.d.ts +59 -86
  293. package/dist/tls/stealth/key-schedule.d.ts.map +1 -1
  294. package/dist/tls/stealth/key-schedule.js +46 -58
  295. package/dist/tls/stealth/key-schedule.js.map +1 -1
  296. package/dist/tls/stealth/record-layer.d.ts +52 -75
  297. package/dist/tls/stealth/record-layer.d.ts.map +1 -1
  298. package/dist/tls/stealth/record-layer.js +47 -63
  299. package/dist/tls/stealth/record-layer.js.map +1 -1
  300. package/dist/tls/stealth/tls12-handshake.d.ts +30 -0
  301. package/dist/tls/stealth/tls12-handshake.d.ts.map +1 -0
  302. package/dist/tls/stealth/tls12-handshake.js +470 -0
  303. package/dist/tls/stealth/tls12-handshake.js.map +1 -0
  304. package/dist/tls/types.d.ts +46 -48
  305. package/dist/tls/types.d.ts.map +1 -1
  306. package/dist/utils/buffer-reader.d.ts +26 -81
  307. package/dist/utils/buffer-reader.d.ts.map +1 -1
  308. package/dist/utils/buffer-reader.js +26 -81
  309. package/dist/utils/buffer-reader.js.map +1 -1
  310. package/dist/utils/buffer-writer.d.ts +30 -66
  311. package/dist/utils/buffer-writer.d.ts.map +1 -1
  312. package/dist/utils/buffer-writer.js +30 -66
  313. package/dist/utils/buffer-writer.js.map +1 -1
  314. package/dist/utils/compression.d.ts +18 -0
  315. package/dist/utils/compression.d.ts.map +1 -0
  316. package/dist/utils/compression.js +34 -0
  317. package/dist/utils/compression.js.map +1 -0
  318. package/dist/utils/dictionary-transport.d.ts +97 -0
  319. package/dist/utils/dictionary-transport.d.ts.map +1 -0
  320. package/dist/utils/dictionary-transport.js +171 -0
  321. package/dist/utils/dictionary-transport.js.map +1 -0
  322. package/dist/utils/encoding.d.ts +12 -28
  323. package/dist/utils/encoding.d.ts.map +1 -1
  324. package/dist/utils/encoding.js +77 -40
  325. package/dist/utils/encoding.js.map +1 -1
  326. package/dist/utils/happy-eyeballs.d.ts +20 -7
  327. package/dist/utils/happy-eyeballs.d.ts.map +1 -1
  328. package/dist/utils/happy-eyeballs.js +57 -25
  329. package/dist/utils/happy-eyeballs.js.map +1 -1
  330. package/dist/utils/logger.d.ts +54 -81
  331. package/dist/utils/logger.d.ts.map +1 -1
  332. package/dist/utils/logger.js +92 -64
  333. package/dist/utils/logger.js.map +1 -1
  334. package/dist/utils/tcp-fast-open.d.ts +30 -0
  335. package/dist/utils/tcp-fast-open.d.ts.map +1 -0
  336. package/dist/utils/tcp-fast-open.js +36 -0
  337. package/dist/utils/tcp-fast-open.js.map +1 -0
  338. package/dist/utils/url.d.ts +18 -25
  339. package/dist/utils/url.d.ts.map +1 -1
  340. package/dist/utils/url.js +18 -25
  341. package/dist/utils/url.js.map +1 -1
  342. package/dist/ws/client.d.ts +35 -52
  343. package/dist/ws/client.d.ts.map +1 -1
  344. package/dist/ws/client.js +92 -37
  345. package/dist/ws/client.js.map +1 -1
  346. package/dist/ws/frame.d.ts +27 -42
  347. package/dist/ws/frame.d.ts.map +1 -1
  348. package/dist/ws/frame.js +25 -37
  349. package/dist/ws/frame.js.map +1 -1
  350. package/dist/ws/permessage-deflate.d.ts +53 -0
  351. package/dist/ws/permessage-deflate.d.ts.map +1 -0
  352. package/dist/ws/permessage-deflate.js +140 -0
  353. package/dist/ws/permessage-deflate.js.map +1 -0
  354. package/package.json +62 -62
@@ -2,22 +2,34 @@ import type { CookieJar } from "../cookies/jar.js";
2
2
  import type { Logger } from "../utils/logger.js";
3
3
  import type { FormData } from "../http/form-data.js";
4
4
  import type { TLSOptions } from "../tls/types.js";
5
+ import type { CacheConfig, CacheMode } from "../cache/types.js";
6
+ import type { HSTSConfig } from "../hsts/types.js";
7
+ import type { DNSConfig } from "../dns/types.js";
8
+ import type { ECHOptions } from "../tls/ech.js";
9
+ import type { AuthConfig } from "./auth.js";
10
+ import type { EarlyHintsCallback } from "../http/early-hints.js";
11
+ import type { RequestEncoding } from "../utils/compression.js";
5
12
  /**
6
- * Union of all HTTP method strings accepted by the library.
7
- *
8
- * @typedef {'GET'|'POST'|'PUT'|'PATCH'|'DELETE'|'HEAD'|'OPTIONS'} HttpMethod
13
+ * Describes the progress of an upload or download operation.
9
14
  */
10
- export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
15
+ export interface ProgressEvent {
16
+ bytes: number;
17
+ totalBytes: number;
18
+ percent: number;
19
+ }
11
20
  /**
12
- * Granular timing measurements recorded during a single request, in
13
- * milliseconds elapsed from request initiation.
21
+ * Callback invoked during upload or download progress.
14
22
  *
15
- * @typedef {Object} RequestTimings
16
- * @property {number} dns - Time spent resolving the hostname via DNS.
17
- * @property {number} connect - Time spent establishing the TCP connection.
18
- * @property {number} tls - Time spent completing the TLS handshake.
19
- * @property {number} firstByte - Time from connection open to the first response byte received.
20
- * @property {number} total - Total wall-clock time for the entire request.
23
+ * @callback ProgressCallback
24
+ * @param {ProgressEvent} event - The current progress snapshot.
25
+ */
26
+ export type ProgressCallback = (event: ProgressEvent) => void;
27
+ /**
28
+ * Supported HTTP request methods.
29
+ */
30
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "QUERY";
31
+ /**
32
+ * Timing measurements for each phase of a request lifecycle, in milliseconds.
21
33
  */
22
34
  export interface RequestTimings {
23
35
  dns: number;
@@ -27,14 +39,7 @@ export interface RequestTimings {
27
39
  total: number;
28
40
  }
29
41
  /**
30
- * Per-phase timeout limits for a single request, in milliseconds. Omitting
31
- * a field means no limit is applied for that phase.
32
- *
33
- * @typedef {Object} TimeoutConfig
34
- * @property {number} [connect] - Maximum milliseconds to establish the TCP connection.
35
- * @property {number} [tls] - Maximum milliseconds to complete the TLS handshake.
36
- * @property {number} [response] - Maximum milliseconds to receive the first response byte.
37
- * @property {number} [total] - Maximum total milliseconds for the whole request.
42
+ * Per-phase timeout thresholds for a request, in milliseconds.
38
43
  */
39
44
  export interface TimeoutConfig {
40
45
  connect?: number;
@@ -43,42 +48,12 @@ export interface TimeoutConfig {
43
48
  total?: number;
44
49
  }
45
50
  /**
46
- * Accepted body types for an outgoing request. Arrays, plain objects, and
47
- * plain strings are serialized automatically; raw `Buffer`s and
48
- * `URLSearchParams` are used verbatim.
49
- *
50
- * @typedef {string|Buffer|URLSearchParams|Record<string,unknown>|ReadableStream<Uint8Array>|null} RequestBody
51
+ * Acceptable request body types for outgoing HTTP requests.
51
52
  */
52
53
  export type RequestBody = string | Buffer | URLSearchParams | Record<string, unknown> | ReadableStream<Uint8Array> | FormData | null;
53
54
  /**
54
- * Describes a single HTTP request. All options at the request level override
55
- * any matching session-level defaults set on {@link NLcURLSessionConfig}.
56
- *
57
- * @typedef {Object} NLcURLRequest
58
- * @property {string} url - Absolute or relative URL to request.
59
- * @property {HttpMethod} [method='GET'] - HTTP method.
60
- * @property {Record<string,string>} [headers] - Request headers to merge with session defaults.
61
- * @property {RequestBody} [body] - Request body payload.
62
- * @property {number|TimeoutConfig} [timeout] - Timeout in ms (flat) or per-phase config object.
63
- * @property {AbortSignal} [signal] - Signal used to cancel the request early.
64
- * @property {string} [impersonate] - Browser profile name (e.g. `"chrome136"`).
65
- * @property {string} [ja3] - Custom JA3 fingerprint string override.
66
- * @property {string} [akamai] - Custom Akamai HTTP/2 fingerprint override.
67
- * @property {boolean} [stealth] - Use the custom stealth TLS engine.
68
- * @property {boolean} [followRedirects=true] - Follow HTTP redirects automatically.
69
- * @property {number} [maxRedirects=20] - Maximum number of redirects to follow.
70
- * @property {boolean} [insecure] - Skip TLS certificate verification.
71
- * @property {string} [proxy] - Proxy URL (`http://`, `socks4://`, `socks5://`).
72
- * @property {[string,string]} [proxyAuth] - Proxy credentials as `[username, password]`.
73
- * @property {'1.1'|'2'} [httpVersion] - Force a specific HTTP protocol version.
74
- * @property {string} [baseURL] - Base URL prepended to relative `url` values.
75
- * @property {Record<string,string|number|boolean>} [params] - Query parameters appended to the URL.
76
- * @property {boolean|string} [cookieJar] - Enable a per-request cookie jar.
77
- * @property {string} [acceptEncoding] - Override the `Accept-Encoding` header value.
78
- * @property {string[]} [headerOrder] - Explicit header ordering for fingerprinting.
79
- * @property {4|6} [dnsFamily] - Force IPv4 (`4`) or IPv6 (`6`) DNS resolution.
80
- * @property {boolean} [stream] - Return a streaming response body.
81
- * @property {Logger} [logger] - Logger instance for request-scoped diagnostics.
55
+ * Full request descriptor for a single HTTP request, including URL, method,
56
+ * headers, body, TLS fingerprinting, proxy, caching, and timeout options.
82
57
  */
83
58
  export interface NLcURLRequest {
84
59
  url: string;
@@ -96,7 +71,7 @@ export interface NLcURLRequest {
96
71
  insecure?: boolean;
97
72
  proxy?: string;
98
73
  proxyAuth?: [string, string];
99
- httpVersion?: "1.1" | "2";
74
+ httpVersion?: "1.1" | "2" | "3";
100
75
  baseURL?: string;
101
76
  params?: Record<string, string | number | boolean>;
102
77
  cookieJar?: boolean | string | CookieJar;
@@ -106,16 +81,30 @@ export interface NLcURLRequest {
106
81
  stream?: boolean;
107
82
  logger?: Logger;
108
83
  tls?: TLSOptions;
84
+ dns?: DNSConfig;
85
+ ech?: ECHOptions;
86
+ onUploadProgress?: ProgressCallback;
87
+ onDownloadProgress?: ProgressCallback;
88
+ throwOnError?: boolean;
89
+ cache?: CacheMode;
90
+ range?: string;
91
+ auth?: AuthConfig;
92
+ onEarlyHints?: EarlyHintsCallback;
93
+ expect100Continue?: boolean;
94
+ compressBody?: RequestEncoding;
95
+ methodOverride?: "QUERY";
109
96
  }
110
97
  /**
111
- * Configuration for automatic request retry with backoff.
112
- *
113
- * @typedef {Object} RetryConfig
114
- * @property {number} count - Maximum number of retry attempts after the initial request.
115
- * @property {number} delay - Base delay in milliseconds between attempts.
116
- * @property {'linear'|'exponential'} backoff - Strategy for increasing the delay on repeated failures.
117
- * @property {number} jitter - Maximum random jitter in milliseconds added to each delay.
118
- * @property {Function} [retryOn] - Optional predicate; return `true` to allow a retry.
98
+ * Represents a single server-sent event from an SSE stream.
99
+ */
100
+ export interface ServerSentEvent {
101
+ event: string;
102
+ data: string;
103
+ id: string;
104
+ retry?: number;
105
+ }
106
+ /**
107
+ * Configuration for automatic request retry behavior.
119
108
  */
120
109
  export interface RetryConfig {
121
110
  count: number;
@@ -125,28 +114,7 @@ export interface RetryConfig {
125
114
  retryOn?: (error: Error | null, statusCode?: number) => boolean;
126
115
  }
127
116
  /**
128
- * Session-level defaults applied to every request issued through an
129
- * {@link NLcURLSession}. Individual request options always take precedence.
130
- *
131
- * @typedef {Object} NLcURLSessionConfig
132
- * @property {string} [baseURL] - Base URL prepended to relative request URLs.
133
- * @property {Record<string,string>} [headers] - Headers merged into every request.
134
- * @property {number|TimeoutConfig} [timeout] - Default timeout applied to all requests.
135
- * @property {string} [impersonate] - Default browser profile for fingerprinting.
136
- * @property {string} [ja3] - Default JA3 fingerprint string.
137
- * @property {string} [akamai] - Default Akamai HTTP/2 fingerprint.
138
- * @property {boolean} [stealth] - Use the stealth TLS engine by default.
139
- * @property {string} [proxy] - Default proxy URL.
140
- * @property {[string,string]} [proxyAuth] - Default proxy credentials.
141
- * @property {boolean} [followRedirects=true] - Follow redirects by default.
142
- * @property {number} [maxRedirects=20] - Default maximum redirect count.
143
- * @property {boolean} [insecure] - Skip TLS verification by default.
144
- * @property {'1.1'|'2'} [httpVersion] - Force an HTTP protocol version for all requests.
145
- * @property {boolean|string} [cookieJar] - Persistent cookie jar for the session.
146
- * @property {Partial<RetryConfig>} [retry] - Automatic retry configuration.
147
- * @property {string} [acceptEncoding] - Default `Accept-Encoding` header value.
148
- * @property {4|6} [dnsFamily] - Force IPv4 or IPv6 for DNS resolution.
149
- * @property {Logger} [logger] - Logger instance for session-scoped diagnostics.
117
+ * Session-level configuration shared across all requests in a session.
150
118
  */
151
119
  export interface NLcURLSessionConfig {
152
120
  baseURL?: string;
@@ -161,12 +129,22 @@ export interface NLcURLSessionConfig {
161
129
  followRedirects?: boolean;
162
130
  maxRedirects?: number;
163
131
  insecure?: boolean;
164
- httpVersion?: "1.1" | "2";
132
+ httpVersion?: "1.1" | "2" | "3";
165
133
  cookieJar?: boolean | string | CookieJar;
166
134
  retry?: Partial<RetryConfig>;
167
135
  acceptEncoding?: string;
168
136
  dnsFamily?: 4 | 6;
169
137
  logger?: Logger;
170
138
  tls?: TLSOptions;
139
+ throwOnError?: boolean;
140
+ onUploadProgress?: ProgressCallback;
141
+ onDownloadProgress?: ProgressCallback;
142
+ cacheConfig?: CacheConfig;
143
+ hsts?: HSTSConfig;
144
+ dns?: DNSConfig;
145
+ ech?: ECHOptions;
146
+ altSvc?: boolean;
147
+ auth?: AuthConfig;
148
+ compressBody?: RequestEncoding;
171
149
  }
172
150
  //# sourceMappingURL=request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/core/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1F;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;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AAC,EAAE,gBAAgB,CAAC;IACpC,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAEtC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB,GAAG,CAAC,EAAE,SAAS,CAAC;IAEhB,GAAG,CAAC,EAAE,UAAU,CAAC;IAEjB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC"}
@@ -1,67 +1,53 @@
1
1
  import type { RequestTimings, HttpMethod } from "./request.js";
2
2
  import type { Readable } from "node:stream";
3
3
  /**
4
- * Metadata about the originating request that produced a response.
5
- *
6
- * @typedef {Object} ResponseMeta
7
- * @property {string} url - The final URL after all redirects.
8
- * @property {HttpMethod} method - The HTTP method used for the request.
9
- * @property {Record<string,string>} headers - The request headers that were sent.
10
- * @property {string} [command] - An optional cURL-equivalent command string for debugging.
4
+ * Metadata about the request that produced a given response.
11
5
  */
12
6
  export interface ResponseMeta {
13
7
  url: string;
14
8
  method: HttpMethod;
15
9
  headers: Record<string, string>;
16
10
  command?: string;
11
+ tlsVersion?: string;
12
+ tlsCipher?: string;
13
+ alpnProtocol?: string;
17
14
  }
18
15
  /**
19
- * Represents the complete HTTP response from a successful request. Provides
20
- * convenience accessors for common content-type parsing, streaming, and
21
- * header inspection.
16
+ * Encapsulates an HTTP response with status, headers, body, timing data,
17
+ * and convenience accessors for common header values and body parsing.
22
18
  *
23
- * @template T - Expected shape of the JSON-decoded body when calling {@link NLcURLResponse.json}.
19
+ * @class
20
+ * @template T - The expected JSON body type.
24
21
  */
25
22
  export declare class NLcURLResponse<T = unknown> {
26
- /** HTTP status code (e.g. `200`, `404`). */
23
+ /** The HTTP status code. */
27
24
  readonly status: number;
28
- /** HTTP status text (e.g. `"OK"`, `"Not Found"`). */
25
+ /** The HTTP reason phrase. */
29
26
  readonly statusText: string;
30
- /** Normalized, lowercase response headers. Duplicate values are joined by `, `. */
27
+ /** Response headers as a case-insensitive key-value map. */
31
28
  readonly headers: Record<string, string>;
32
- /** All response header name-value pairs exactly as received, in transmission order. */
29
+ /** Raw header pairs preserving original casing and duplicates. */
33
30
  readonly rawHeaders: Array<[string, string]>;
34
- /** Fully buffered response body. Empty when the response was opened in streaming mode. */
31
+ /** The full response body as a Buffer. */
35
32
  readonly rawBody: Buffer;
36
- /** Readable stream of the response body, or `null` for buffered responses. */
33
+ /** A readable stream for streaming responses, or `null` for buffered responses. */
37
34
  readonly body: Readable | null;
38
- /** HTTP protocol version string (e.g. `"HTTP/1.1"`, `"HTTP/2.0"`). */
35
+ /** The negotiated HTTP version (e.g. "1.1", "2"). */
39
36
  readonly httpVersion: string;
40
- /** Final URL of the response after any redirects. */
37
+ /** The final URL after any redirects. */
41
38
  readonly url: string;
42
- /** Number of redirects followed before this response was received. */
39
+ /** The number of redirects followed to reach this response. */
43
40
  readonly redirectCount: number;
44
- /** Granular timing measurements for each phase of the request lifecycle. */
41
+ /** Timing measurements for each request phase. */
45
42
  readonly timings: RequestTimings;
46
43
  /** Metadata about the originating request. */
47
44
  readonly request: ResponseMeta;
48
45
  private _json;
49
46
  private _text;
50
47
  /**
51
- * Creates a new NLcURLResponse instance.
48
+ * Creates a new NLcURLResponse from the provided initialization fields.
52
49
  *
53
- * @param {Object} init - Response initialization data.
54
- * @param {number} init.status - HTTP status code.
55
- * @param {string} init.statusText - HTTP status text.
56
- * @param {Record<string,string>} init.headers - Normalized response headers.
57
- * @param {Array<[string,string]>} [init.rawHeaders] - Raw header pairs; defaults to entries of `headers`.
58
- * @param {Buffer} init.rawBody - Fully buffered response body.
59
- * @param {Readable|null} [init.body] - Streaming body, or `null`.
60
- * @param {string} init.httpVersion - Protocol version string.
61
- * @param {string} init.url - Final URL after redirects.
62
- * @param {number} init.redirectCount - Number of redirects followed.
63
- * @param {RequestTimings} init.timings - Lifecycle timing measurements.
64
- * @param {ResponseMeta} init.request - Originating request metadata.
50
+ * @param {Object} init - Response initialization fields.
65
51
  */
66
52
  constructor(init: {
67
53
  status: number;
@@ -77,55 +63,74 @@ export declare class NLcURLResponse<T = unknown> {
77
63
  request: ResponseMeta;
78
64
  });
79
65
  /**
80
- * Returns `true` when the HTTP status code is in the 200–299 (successful)
81
- * range, `false` otherwise.
66
+ * Returns `true` if the response status is in the 2xx range.
82
67
  *
83
68
  * @returns {boolean} Whether the response indicates success.
84
69
  */
85
70
  get ok(): boolean;
86
71
  /**
87
- * Decodes the raw body as a UTF-8 string and returns it. The result is
88
- * memoized after the first call.
72
+ * Decodes the raw body as a UTF-8 string. Throws if the response is streaming.
89
73
  *
90
- * @returns {string} The response body decoded as UTF-8.
91
- * @throws {Error} If the response was opened in streaming mode (`stream: true`).
74
+ * @returns {string} The response body as text.
75
+ * @throws {Error} If the response is a streaming response.
92
76
  */
93
77
  text(): string;
94
78
  /**
95
- * Parses the raw body as JSON and returns the decoded value. The result is
96
- * memoized after the first call.
79
+ * Parses the response body as JSON. Throws if the response is streaming.
97
80
  *
98
- * @template R - Expected type of the decoded JSON value; defaults to `T`.
99
- * @returns {R} The JSON-decoded response body.
100
- * @throws {Error} If the response was opened in streaming mode (`stream: true`).
81
+ * @template R - The expected parsed type.
82
+ * @returns {R} The parsed JSON value.
83
+ * @throws {Error} If the response is a streaming response.
101
84
  * @throws {SyntaxError} If the body is not valid JSON.
102
- *
103
- * @example
104
- * const data = response.json<{ id: number; name: string }>();
105
- * console.log(data.id);
106
85
  */
107
86
  json<R = T>(): R;
108
87
  /**
109
- * Returns the `Content-Length` as a number. Falls back to the buffer byte
110
- * length when the header is absent or unparseable.
88
+ * Returns the Content-Length header value, or the raw body length as a fallback.
111
89
  *
112
90
  * @returns {number} The content length in bytes.
113
91
  */
114
92
  get contentLength(): number;
115
93
  /**
116
- * Returns the value of the `Content-Type` response header, or an empty
117
- * string when the header is absent.
94
+ * Returns the Content-Type header value.
118
95
  *
119
- * @returns {string} The `Content-Type` header value.
96
+ * @returns {string} The content type, or an empty string if absent.
120
97
  */
121
98
  get contentType(): string;
122
99
  /**
123
- * Returns all values for a response header, in transmission order,
124
- * supporting multi-value headers such as `Set-Cookie` which are joined
125
- * when accessed through `headers`.
100
+ * Returns the ETag header value, if present.
101
+ *
102
+ * @returns {string|undefined} The entity tag.
103
+ */
104
+ get etag(): string | undefined;
105
+ /**
106
+ * Returns the Last-Modified header value, if present.
107
+ *
108
+ * @returns {string|undefined} The last modified date string.
109
+ */
110
+ get lastModified(): string | undefined;
111
+ /**
112
+ * Returns the Cache-Control header value, if present.
113
+ *
114
+ * @returns {string|undefined} The cache control directive string.
115
+ */
116
+ get cacheControl(): string | undefined;
117
+ /**
118
+ * Returns the Content-Range header value, if present.
119
+ *
120
+ * @returns {string|undefined} The content range descriptor.
121
+ */
122
+ get contentRange(): string | undefined;
123
+ /**
124
+ * Returns the Accept-Ranges header value, if present.
125
+ *
126
+ * @returns {string|undefined} The accepted range unit.
127
+ */
128
+ get acceptRanges(): string | undefined;
129
+ /**
130
+ * Retrieves all values for a given header name from the raw headers array.
126
131
  *
127
- * @param {string} name - The case-insensitive header name to look up.
128
- * @returns {string[]} All header values for the given name, or an empty array.
132
+ * @param {string} name - The header name (case-insensitive).
133
+ * @returns {string[]} All values for the specified header.
129
134
  */
130
135
  getAll(name: string): string[];
131
136
  }
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/core/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;C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CAE7B;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAI/B"}
@@ -1,50 +1,39 @@
1
1
  /**
2
- * Represents the complete HTTP response from a successful request. Provides
3
- * convenience accessors for common content-type parsing, streaming, and
4
- * header inspection.
2
+ * Encapsulates an HTTP response with status, headers, body, timing data,
3
+ * and convenience accessors for common header values and body parsing.
5
4
  *
6
- * @template T - Expected shape of the JSON-decoded body when calling {@link NLcURLResponse.json}.
5
+ * @class
6
+ * @template T - The expected JSON body type.
7
7
  */
8
8
  export class NLcURLResponse {
9
- /** HTTP status code (e.g. `200`, `404`). */
9
+ /** The HTTP status code. */
10
10
  status;
11
- /** HTTP status text (e.g. `"OK"`, `"Not Found"`). */
11
+ /** The HTTP reason phrase. */
12
12
  statusText;
13
- /** Normalized, lowercase response headers. Duplicate values are joined by `, `. */
13
+ /** Response headers as a case-insensitive key-value map. */
14
14
  headers;
15
- /** All response header name-value pairs exactly as received, in transmission order. */
15
+ /** Raw header pairs preserving original casing and duplicates. */
16
16
  rawHeaders;
17
- /** Fully buffered response body. Empty when the response was opened in streaming mode. */
17
+ /** The full response body as a Buffer. */
18
18
  rawBody;
19
- /** Readable stream of the response body, or `null` for buffered responses. */
19
+ /** A readable stream for streaming responses, or `null` for buffered responses. */
20
20
  body;
21
- /** HTTP protocol version string (e.g. `"HTTP/1.1"`, `"HTTP/2.0"`). */
21
+ /** The negotiated HTTP version (e.g. "1.1", "2"). */
22
22
  httpVersion;
23
- /** Final URL of the response after any redirects. */
23
+ /** The final URL after any redirects. */
24
24
  url;
25
- /** Number of redirects followed before this response was received. */
25
+ /** The number of redirects followed to reach this response. */
26
26
  redirectCount;
27
- /** Granular timing measurements for each phase of the request lifecycle. */
27
+ /** Timing measurements for each request phase. */
28
28
  timings;
29
29
  /** Metadata about the originating request. */
30
30
  request;
31
31
  _json;
32
32
  _text;
33
33
  /**
34
- * Creates a new NLcURLResponse instance.
34
+ * Creates a new NLcURLResponse from the provided initialization fields.
35
35
  *
36
- * @param {Object} init - Response initialization data.
37
- * @param {number} init.status - HTTP status code.
38
- * @param {string} init.statusText - HTTP status text.
39
- * @param {Record<string,string>} init.headers - Normalized response headers.
40
- * @param {Array<[string,string]>} [init.rawHeaders] - Raw header pairs; defaults to entries of `headers`.
41
- * @param {Buffer} init.rawBody - Fully buffered response body.
42
- * @param {Readable|null} [init.body] - Streaming body, or `null`.
43
- * @param {string} init.httpVersion - Protocol version string.
44
- * @param {string} init.url - Final URL after redirects.
45
- * @param {number} init.redirectCount - Number of redirects followed.
46
- * @param {RequestTimings} init.timings - Lifecycle timing measurements.
47
- * @param {ResponseMeta} init.request - Originating request metadata.
36
+ * @param {Object} init - Response initialization fields.
48
37
  */
49
38
  constructor(init) {
50
39
  this.status = init.status;
@@ -60,8 +49,7 @@ export class NLcURLResponse {
60
49
  this.request = init.request;
61
50
  }
62
51
  /**
63
- * Returns `true` when the HTTP status code is in the 200–299 (successful)
64
- * range, `false` otherwise.
52
+ * Returns `true` if the response status is in the 2xx range.
65
53
  *
66
54
  * @returns {boolean} Whether the response indicates success.
67
55
  */
@@ -69,11 +57,10 @@ export class NLcURLResponse {
69
57
  return this.status >= 200 && this.status < 300;
70
58
  }
71
59
  /**
72
- * Decodes the raw body as a UTF-8 string and returns it. The result is
73
- * memoized after the first call.
60
+ * Decodes the raw body as a UTF-8 string. Throws if the response is streaming.
74
61
  *
75
- * @returns {string} The response body decoded as UTF-8.
76
- * @throws {Error} If the response was opened in streaming mode (`stream: true`).
62
+ * @returns {string} The response body as text.
63
+ * @throws {Error} If the response is a streaming response.
77
64
  */
78
65
  text() {
79
66
  if (this.body) {
@@ -87,17 +74,12 @@ export class NLcURLResponse {
87
74
  return cached;
88
75
  }
89
76
  /**
90
- * Parses the raw body as JSON and returns the decoded value. The result is
91
- * memoized after the first call.
77
+ * Parses the response body as JSON. Throws if the response is streaming.
92
78
  *
93
- * @template R - Expected type of the decoded JSON value; defaults to `T`.
94
- * @returns {R} The JSON-decoded response body.
95
- * @throws {Error} If the response was opened in streaming mode (`stream: true`).
79
+ * @template R - The expected parsed type.
80
+ * @returns {R} The parsed JSON value.
81
+ * @throws {Error} If the response is a streaming response.
96
82
  * @throws {SyntaxError} If the body is not valid JSON.
97
- *
98
- * @example
99
- * const data = response.json<{ id: number; name: string }>();
100
- * console.log(data.id);
101
83
  */
102
84
  json() {
103
85
  if (this.body) {
@@ -109,8 +91,7 @@ export class NLcURLResponse {
109
91
  return this._json;
110
92
  }
111
93
  /**
112
- * Returns the `Content-Length` as a number. Falls back to the buffer byte
113
- * length when the header is absent or unparseable.
94
+ * Returns the Content-Length header value, or the raw body length as a fallback.
114
95
  *
115
96
  * @returns {number} The content length in bytes.
116
97
  */
@@ -124,21 +105,58 @@ export class NLcURLResponse {
124
105
  return this.rawBody.length;
125
106
  }
126
107
  /**
127
- * Returns the value of the `Content-Type` response header, or an empty
128
- * string when the header is absent.
108
+ * Returns the Content-Type header value.
129
109
  *
130
- * @returns {string} The `Content-Type` header value.
110
+ * @returns {string} The content type, or an empty string if absent.
131
111
  */
132
112
  get contentType() {
133
113
  return this.headers["content-type"] ?? "";
134
114
  }
135
115
  /**
136
- * Returns all values for a response header, in transmission order,
137
- * supporting multi-value headers such as `Set-Cookie` which are joined
138
- * when accessed through `headers`.
116
+ * Returns the ETag header value, if present.
117
+ *
118
+ * @returns {string|undefined} The entity tag.
119
+ */
120
+ get etag() {
121
+ return this.headers["etag"];
122
+ }
123
+ /**
124
+ * Returns the Last-Modified header value, if present.
125
+ *
126
+ * @returns {string|undefined} The last modified date string.
127
+ */
128
+ get lastModified() {
129
+ return this.headers["last-modified"];
130
+ }
131
+ /**
132
+ * Returns the Cache-Control header value, if present.
133
+ *
134
+ * @returns {string|undefined} The cache control directive string.
135
+ */
136
+ get cacheControl() {
137
+ return this.headers["cache-control"];
138
+ }
139
+ /**
140
+ * Returns the Content-Range header value, if present.
141
+ *
142
+ * @returns {string|undefined} The content range descriptor.
143
+ */
144
+ get contentRange() {
145
+ return this.headers["content-range"];
146
+ }
147
+ /**
148
+ * Returns the Accept-Ranges header value, if present.
149
+ *
150
+ * @returns {string|undefined} The accepted range unit.
151
+ */
152
+ get acceptRanges() {
153
+ return this.headers["accept-ranges"];
154
+ }
155
+ /**
156
+ * Retrieves all values for a given header name from the raw headers array.
139
157
  *
140
- * @param {string} name - The case-insensitive header name to look up.
141
- * @returns {string[]} All header values for the given name, or an empty array.
158
+ * @param {string} name - The header name (case-insensitive).
159
+ * @returns {string[]} All values for the specified header.
142
160
  */
143
161
  getAll(name) {
144
162
  const lower = name.toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/core/response.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,4CAA4C;IAC5B,MAAM,CAAS;IAC/B,qDAAqD;IACrC,UAAU,CAAS;IACnC,mFAAmF;IACnE,OAAO,CAAyB;IAChD,uFAAuF;IACvE,UAAU,CAA0B;IACpD,0FAA0F;IAC1E,OAAO,CAAS;IAChC,8EAA8E;IAC9D,IAAI,CAAkB;IACtC,sEAAsE;IACtD,WAAW,CAAS;IACpC,qDAAqD;IACrC,GAAG,CAAS;IAC5B,sEAAsE;IACtD,aAAa,CAAS;IACtC,4EAA4E;IAC5D,OAAO,CAAiB;IACxC,8CAA8C;IAC9B,OAAO,CAAe;IAE9B,KAAK,CAAgB;IACrB,KAAK,CAAqB;IAElC;;;;;;;;;;;;;;;OAeG;IACH,YAAY,IAAqQ;QAC/Q,IAAI,CAAC,MAAM,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