nlcurl 0.7.0 → 0.9.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 +149 -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 +75 -37
  15. package/dist/cache/store.d.ts.map +1 -1
  16. package/dist/cache/store.js +217 -85
  17. package/dist/cache/store.js.map +1 -1
  18. package/dist/cache/types.d.ts +10 -39
  19. package/dist/cache/types.d.ts.map +1 -1
  20. package/dist/cli/args.d.ts +4 -37
  21. package/dist/cli/args.d.ts.map +1 -1
  22. package/dist/cli/args.js +3 -4
  23. package/dist/cli/args.js.map +1 -1
  24. package/dist/cli/index.d.ts +0 -5
  25. package/dist/cli/index.d.ts.map +1 -1
  26. package/dist/cli/index.js +1 -6
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cli/output.d.ts +14 -20
  29. package/dist/cli/output.d.ts.map +1 -1
  30. package/dist/cli/output.js +14 -20
  31. package/dist/cli/output.js.map +1 -1
  32. package/dist/cookies/jar.d.ts +41 -40
  33. package/dist/cookies/jar.d.ts.map +1 -1
  34. package/dist/cookies/jar.js +65 -42
  35. package/dist/cookies/jar.js.map +1 -1
  36. package/dist/cookies/parser.d.ts +13 -17
  37. package/dist/cookies/parser.d.ts.map +1 -1
  38. package/dist/cookies/parser.js +23 -15
  39. package/dist/cookies/parser.js.map +1 -1
  40. package/dist/cookies/psl-data.d.ts +1 -1
  41. package/dist/cookies/psl-data.js +1 -1
  42. package/dist/cookies/public-suffix.d.ts +5 -27
  43. package/dist/cookies/public-suffix.d.ts.map +1 -1
  44. package/dist/cookies/public-suffix.js +5 -37
  45. package/dist/cookies/public-suffix.js.map +1 -1
  46. package/dist/core/auth.d.ts +61 -0
  47. package/dist/core/auth.d.ts.map +1 -0
  48. package/dist/core/auth.js +159 -0
  49. package/dist/core/auth.js.map +1 -0
  50. package/dist/core/client.d.ts +28 -40
  51. package/dist/core/client.d.ts.map +1 -1
  52. package/dist/core/client.js +31 -41
  53. package/dist/core/client.js.map +1 -1
  54. package/dist/core/errors.d.ts +64 -88
  55. package/dist/core/errors.d.ts.map +1 -1
  56. package/dist/core/errors.js +64 -88
  57. package/dist/core/errors.js.map +1 -1
  58. package/dist/core/request.d.ts +33 -113
  59. package/dist/core/request.d.ts.map +1 -1
  60. package/dist/core/response.d.ts +49 -66
  61. package/dist/core/response.d.ts.map +1 -1
  62. package/dist/core/response.js +45 -59
  63. package/dist/core/response.js.map +1 -1
  64. package/dist/core/session.d.ts +66 -78
  65. package/dist/core/session.d.ts.map +1 -1
  66. package/dist/core/session.js +136 -77
  67. package/dist/core/session.js.map +1 -1
  68. package/dist/core/validation.d.ts +58 -43
  69. package/dist/core/validation.d.ts.map +1 -1
  70. package/dist/core/validation.js +141 -56
  71. package/dist/core/validation.js.map +1 -1
  72. package/dist/dns/cache.d.ts +65 -0
  73. package/dist/dns/cache.d.ts.map +1 -0
  74. package/dist/dns/cache.js +119 -0
  75. package/dist/dns/cache.js.map +1 -0
  76. package/dist/dns/codec.d.ts +29 -19
  77. package/dist/dns/codec.d.ts.map +1 -1
  78. package/dist/dns/codec.js +73 -39
  79. package/dist/dns/codec.js.map +1 -1
  80. package/dist/dns/doh-resolver.d.ts +17 -31
  81. package/dist/dns/doh-resolver.d.ts.map +1 -1
  82. package/dist/dns/doh-resolver.js +47 -48
  83. package/dist/dns/doh-resolver.js.map +1 -1
  84. package/dist/dns/dot-resolver.d.ts +89 -0
  85. package/dist/dns/dot-resolver.d.ts.map +1 -0
  86. package/dist/dns/dot-resolver.js +166 -0
  87. package/dist/dns/dot-resolver.js.map +1 -0
  88. package/dist/dns/https-rr.d.ts +19 -30
  89. package/dist/dns/https-rr.d.ts.map +1 -1
  90. package/dist/dns/https-rr.js +22 -40
  91. package/dist/dns/https-rr.js.map +1 -1
  92. package/dist/dns/types.d.ts +31 -59
  93. package/dist/dns/types.d.ts.map +1 -1
  94. package/dist/dns/types.js +3 -14
  95. package/dist/dns/types.js.map +1 -1
  96. package/dist/fingerprints/akamai.d.ts +3 -11
  97. package/dist/fingerprints/akamai.d.ts.map +1 -1
  98. package/dist/fingerprints/akamai.js +3 -11
  99. package/dist/fingerprints/akamai.js.map +1 -1
  100. package/dist/fingerprints/database.d.ts +6 -14
  101. package/dist/fingerprints/database.d.ts.map +1 -1
  102. package/dist/fingerprints/database.js +6 -14
  103. package/dist/fingerprints/database.js.map +1 -1
  104. package/dist/fingerprints/extensions.d.ts +56 -71
  105. package/dist/fingerprints/extensions.d.ts.map +1 -1
  106. package/dist/fingerprints/extensions.js +58 -71
  107. package/dist/fingerprints/extensions.js.map +1 -1
  108. package/dist/fingerprints/ja3.d.ts +12 -30
  109. package/dist/fingerprints/ja3.d.ts.map +1 -1
  110. package/dist/fingerprints/ja3.js +12 -30
  111. package/dist/fingerprints/ja3.js.map +1 -1
  112. package/dist/fingerprints/ja4.d.ts +18 -0
  113. package/dist/fingerprints/ja4.d.ts.map +1 -0
  114. package/dist/fingerprints/ja4.js +81 -0
  115. package/dist/fingerprints/ja4.js.map +1 -0
  116. package/dist/fingerprints/profiles/chrome.d.ts +18 -21
  117. package/dist/fingerprints/profiles/chrome.d.ts.map +1 -1
  118. package/dist/fingerprints/profiles/chrome.js +35 -31
  119. package/dist/fingerprints/profiles/chrome.js.map +1 -1
  120. package/dist/fingerprints/profiles/edge.d.ts +7 -10
  121. package/dist/fingerprints/profiles/edge.d.ts.map +1 -1
  122. package/dist/fingerprints/profiles/edge.js +7 -10
  123. package/dist/fingerprints/profiles/edge.js.map +1 -1
  124. package/dist/fingerprints/profiles/firefox.d.ts +8 -11
  125. package/dist/fingerprints/profiles/firefox.d.ts.map +1 -1
  126. package/dist/fingerprints/profiles/firefox.js +8 -11
  127. package/dist/fingerprints/profiles/firefox.js.map +1 -1
  128. package/dist/fingerprints/profiles/safari.d.ts +11 -14
  129. package/dist/fingerprints/profiles/safari.d.ts.map +1 -1
  130. package/dist/fingerprints/profiles/safari.js +11 -14
  131. package/dist/fingerprints/profiles/safari.js.map +1 -1
  132. package/dist/fingerprints/profiles/tor.d.ts +5 -8
  133. package/dist/fingerprints/profiles/tor.d.ts.map +1 -1
  134. package/dist/fingerprints/profiles/tor.js +5 -8
  135. package/dist/fingerprints/profiles/tor.js.map +1 -1
  136. package/dist/fingerprints/types.d.ts +42 -73
  137. package/dist/fingerprints/types.d.ts.map +1 -1
  138. package/dist/hsts/store.d.ts +19 -21
  139. package/dist/hsts/store.d.ts.map +1 -1
  140. package/dist/hsts/store.js +20 -28
  141. package/dist/hsts/store.js.map +1 -1
  142. package/dist/hsts/types.d.ts +10 -14
  143. package/dist/hsts/types.d.ts.map +1 -1
  144. package/dist/http/alt-svc.d.ts +27 -52
  145. package/dist/http/alt-svc.d.ts.map +1 -1
  146. package/dist/http/alt-svc.js +17 -67
  147. package/dist/http/alt-svc.js.map +1 -1
  148. package/dist/http/early-hints.d.ts +23 -0
  149. package/dist/http/early-hints.d.ts.map +1 -0
  150. package/dist/http/early-hints.js +33 -0
  151. package/dist/http/early-hints.js.map +1 -0
  152. package/dist/http/form-data.d.ts +17 -35
  153. package/dist/http/form-data.d.ts.map +1 -1
  154. package/dist/http/form-data.js +12 -34
  155. package/dist/http/form-data.js.map +1 -1
  156. package/dist/http/h1/client.d.ts +14 -26
  157. package/dist/http/h1/client.d.ts.map +1 -1
  158. package/dist/http/h1/client.js +14 -23
  159. package/dist/http/h1/client.js.map +1 -1
  160. package/dist/http/h1/encoder.d.ts +21 -17
  161. package/dist/http/h1/encoder.d.ts.map +1 -1
  162. package/dist/http/h1/encoder.js +56 -20
  163. package/dist/http/h1/encoder.js.map +1 -1
  164. package/dist/http/h1/parser.d.ts +23 -59
  165. package/dist/http/h1/parser.d.ts.map +1 -1
  166. package/dist/http/h1/parser.js +61 -55
  167. package/dist/http/h1/parser.js.map +1 -1
  168. package/dist/http/h2/client.d.ts +23 -59
  169. package/dist/http/h2/client.d.ts.map +1 -1
  170. package/dist/http/h2/client.js +107 -64
  171. package/dist/http/h2/client.js.map +1 -1
  172. package/dist/http/h2/frames.d.ts +53 -84
  173. package/dist/http/h2/frames.d.ts.map +1 -1
  174. package/dist/http/h2/frames.js +48 -76
  175. package/dist/http/h2/frames.js.map +1 -1
  176. package/dist/http/h2/hpack.d.ts +20 -36
  177. package/dist/http/h2/hpack.d.ts.map +1 -1
  178. package/dist/http/h2/hpack.js +41 -36
  179. package/dist/http/h2/hpack.js.map +1 -1
  180. package/dist/http/negotiator.d.ts +25 -38
  181. package/dist/http/negotiator.d.ts.map +1 -1
  182. package/dist/http/negotiator.js +17 -38
  183. package/dist/http/negotiator.js.map +1 -1
  184. package/dist/http/pool.d.ts +34 -64
  185. package/dist/http/pool.d.ts.map +1 -1
  186. package/dist/http/pool.js +22 -41
  187. package/dist/http/pool.js.map +1 -1
  188. package/dist/http/resumable-upload.d.ts +76 -0
  189. package/dist/http/resumable-upload.d.ts.map +1 -0
  190. package/dist/http/resumable-upload.js +104 -0
  191. package/dist/http/resumable-upload.js.map +1 -0
  192. package/dist/http/trailers.d.ts +29 -0
  193. package/dist/http/trailers.d.ts.map +1 -0
  194. package/dist/http/trailers.js +57 -0
  195. package/dist/http/trailers.js.map +1 -0
  196. package/dist/index.d.ts +24 -9
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +24 -3
  199. package/dist/index.js.map +1 -1
  200. package/dist/middleware/circuit-breaker.d.ts +44 -0
  201. package/dist/middleware/circuit-breaker.d.ts.map +1 -0
  202. package/dist/middleware/circuit-breaker.js +96 -0
  203. package/dist/middleware/circuit-breaker.js.map +1 -0
  204. package/dist/middleware/interceptor.d.ts +13 -32
  205. package/dist/middleware/interceptor.d.ts.map +1 -1
  206. package/dist/middleware/interceptor.js +11 -16
  207. package/dist/middleware/interceptor.js.map +1 -1
  208. package/dist/middleware/rate-limiter.d.ts +8 -17
  209. package/dist/middleware/rate-limiter.d.ts.map +1 -1
  210. package/dist/middleware/rate-limiter.js +11 -12
  211. package/dist/middleware/rate-limiter.js.map +1 -1
  212. package/dist/middleware/retry-after.d.ts +15 -0
  213. package/dist/middleware/retry-after.d.ts.map +1 -0
  214. package/dist/middleware/retry-after.js +36 -0
  215. package/dist/middleware/retry-after.js.map +1 -0
  216. package/dist/middleware/retry.d.ts +9 -18
  217. package/dist/middleware/retry.d.ts.map +1 -1
  218. package/dist/middleware/retry.js +12 -9
  219. package/dist/middleware/retry.js.map +1 -1
  220. package/dist/proxy/auth.d.ts +73 -0
  221. package/dist/proxy/auth.d.ts.map +1 -0
  222. package/dist/proxy/auth.js +129 -0
  223. package/dist/proxy/auth.js.map +1 -0
  224. package/dist/proxy/env-proxy.d.ts +5 -15
  225. package/dist/proxy/env-proxy.d.ts.map +1 -1
  226. package/dist/proxy/env-proxy.js +5 -23
  227. package/dist/proxy/env-proxy.js.map +1 -1
  228. package/dist/proxy/http-proxy.d.ts +12 -19
  229. package/dist/proxy/http-proxy.d.ts.map +1 -1
  230. package/dist/proxy/http-proxy.js +5 -8
  231. package/dist/proxy/http-proxy.js.map +1 -1
  232. package/dist/proxy/socks.d.ts +13 -20
  233. package/dist/proxy/socks.d.ts.map +1 -1
  234. package/dist/proxy/socks.js +8 -10
  235. package/dist/proxy/socks.js.map +1 -1
  236. package/dist/sse/parser.d.ts +16 -37
  237. package/dist/sse/parser.d.ts.map +1 -1
  238. package/dist/sse/parser.js +31 -28
  239. package/dist/sse/parser.js.map +1 -1
  240. package/dist/tls/constants.d.ts +21 -72
  241. package/dist/tls/constants.d.ts.map +1 -1
  242. package/dist/tls/constants.js +21 -72
  243. package/dist/tls/constants.js.map +1 -1
  244. package/dist/tls/ct.d.ts +78 -0
  245. package/dist/tls/ct.d.ts.map +1 -0
  246. package/dist/tls/ct.js +175 -0
  247. package/dist/tls/ct.js.map +1 -0
  248. package/dist/tls/early-data.d.ts +45 -0
  249. package/dist/tls/early-data.d.ts.map +1 -0
  250. package/dist/tls/early-data.js +46 -0
  251. package/dist/tls/early-data.js.map +1 -0
  252. package/dist/tls/ech.d.ts +68 -85
  253. package/dist/tls/ech.d.ts.map +1 -1
  254. package/dist/tls/ech.js +54 -102
  255. package/dist/tls/ech.js.map +1 -1
  256. package/dist/tls/keylog.d.ts +34 -0
  257. package/dist/tls/keylog.d.ts.map +1 -0
  258. package/dist/tls/keylog.js +64 -0
  259. package/dist/tls/keylog.js.map +1 -0
  260. package/dist/tls/node-engine.d.ts +10 -17
  261. package/dist/tls/node-engine.d.ts.map +1 -1
  262. package/dist/tls/node-engine.js +41 -18
  263. package/dist/tls/node-engine.js.map +1 -1
  264. package/dist/tls/ocsp.d.ts +55 -0
  265. package/dist/tls/ocsp.d.ts.map +1 -0
  266. package/dist/tls/ocsp.js +131 -0
  267. package/dist/tls/ocsp.js.map +1 -0
  268. package/dist/tls/pin-verification.d.ts +5 -4
  269. package/dist/tls/pin-verification.d.ts.map +1 -1
  270. package/dist/tls/pin-verification.js +5 -11
  271. package/dist/tls/pin-verification.js.map +1 -1
  272. package/dist/tls/session-cache.d.ts +27 -39
  273. package/dist/tls/session-cache.d.ts.map +1 -1
  274. package/dist/tls/session-cache.js +20 -24
  275. package/dist/tls/session-cache.js.map +1 -1
  276. package/dist/tls/stealth/client-hello.d.ts +26 -45
  277. package/dist/tls/stealth/client-hello.d.ts.map +1 -1
  278. package/dist/tls/stealth/client-hello.js +15 -31
  279. package/dist/tls/stealth/client-hello.js.map +1 -1
  280. package/dist/tls/stealth/engine.d.ts +10 -15
  281. package/dist/tls/stealth/engine.d.ts.map +1 -1
  282. package/dist/tls/stealth/engine.js +98 -18
  283. package/dist/tls/stealth/engine.js.map +1 -1
  284. package/dist/tls/stealth/handshake.d.ts +32 -31
  285. package/dist/tls/stealth/handshake.d.ts.map +1 -1
  286. package/dist/tls/stealth/handshake.js +74 -47
  287. package/dist/tls/stealth/handshake.js.map +1 -1
  288. package/dist/tls/stealth/key-schedule.d.ts +81 -86
  289. package/dist/tls/stealth/key-schedule.d.ts.map +1 -1
  290. package/dist/tls/stealth/key-schedule.js +70 -58
  291. package/dist/tls/stealth/key-schedule.js.map +1 -1
  292. package/dist/tls/stealth/record-layer.d.ts +52 -75
  293. package/dist/tls/stealth/record-layer.d.ts.map +1 -1
  294. package/dist/tls/stealth/record-layer.js +47 -63
  295. package/dist/tls/stealth/record-layer.js.map +1 -1
  296. package/dist/tls/stealth/tls12-handshake.d.ts +16 -0
  297. package/dist/tls/stealth/tls12-handshake.d.ts.map +1 -1
  298. package/dist/tls/stealth/tls12-handshake.js +10 -2
  299. package/dist/tls/stealth/tls12-handshake.js.map +1 -1
  300. package/dist/tls/types.d.ts +46 -60
  301. package/dist/tls/types.d.ts.map +1 -1
  302. package/dist/utils/buffer-reader.d.ts +26 -81
  303. package/dist/utils/buffer-reader.d.ts.map +1 -1
  304. package/dist/utils/buffer-reader.js +26 -81
  305. package/dist/utils/buffer-reader.js.map +1 -1
  306. package/dist/utils/buffer-writer.d.ts +30 -66
  307. package/dist/utils/buffer-writer.d.ts.map +1 -1
  308. package/dist/utils/buffer-writer.js +30 -66
  309. package/dist/utils/buffer-writer.js.map +1 -1
  310. package/dist/utils/compression.d.ts +18 -0
  311. package/dist/utils/compression.d.ts.map +1 -0
  312. package/dist/utils/compression.js +34 -0
  313. package/dist/utils/compression.js.map +1 -0
  314. package/dist/utils/dictionary-transport.d.ts +97 -0
  315. package/dist/utils/dictionary-transport.d.ts.map +1 -0
  316. package/dist/utils/dictionary-transport.js +171 -0
  317. package/dist/utils/dictionary-transport.js.map +1 -0
  318. package/dist/utils/encoding.d.ts +12 -30
  319. package/dist/utils/encoding.d.ts.map +1 -1
  320. package/dist/utils/encoding.js +15 -46
  321. package/dist/utils/encoding.js.map +1 -1
  322. package/dist/utils/happy-eyeballs.d.ts +18 -8
  323. package/dist/utils/happy-eyeballs.d.ts.map +1 -1
  324. package/dist/utils/happy-eyeballs.js +19 -27
  325. package/dist/utils/happy-eyeballs.js.map +1 -1
  326. package/dist/utils/logger.d.ts +54 -81
  327. package/dist/utils/logger.d.ts.map +1 -1
  328. package/dist/utils/logger.js +92 -64
  329. package/dist/utils/logger.js.map +1 -1
  330. package/dist/utils/tcp-fast-open.d.ts +30 -0
  331. package/dist/utils/tcp-fast-open.d.ts.map +1 -0
  332. package/dist/utils/tcp-fast-open.js +36 -0
  333. package/dist/utils/tcp-fast-open.js.map +1 -0
  334. package/dist/utils/url.d.ts +18 -25
  335. package/dist/utils/url.d.ts.map +1 -1
  336. package/dist/utils/url.js +18 -25
  337. package/dist/utils/url.js.map +1 -1
  338. package/dist/ws/client.d.ts +35 -53
  339. package/dist/ws/client.d.ts.map +1 -1
  340. package/dist/ws/client.js +96 -38
  341. package/dist/ws/client.js.map +1 -1
  342. package/dist/ws/frame.d.ts +24 -41
  343. package/dist/ws/frame.d.ts.map +1 -1
  344. package/dist/ws/frame.js +26 -33
  345. package/dist/ws/frame.js.map +1 -1
  346. package/dist/ws/permessage-deflate.d.ts +23 -28
  347. package/dist/ws/permessage-deflate.d.ts.map +1 -1
  348. package/dist/ws/permessage-deflate.js +18 -26
  349. package/dist/ws/permessage-deflate.js.map +1 -1
  350. package/package.json +2 -2
  351. package/dist/http/h3/detection.d.ts +0 -17
  352. package/dist/http/h3/detection.d.ts.map +0 -1
  353. package/dist/http/h3/detection.js +0 -59
  354. package/dist/http/h3/detection.js.map +0 -1
@@ -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,53 +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 the `ETag` response header value, or `undefined` when absent.
116
+ * Returns the ETag header value, if present.
117
+ *
118
+ * @returns {string|undefined} The entity tag.
137
119
  */
138
120
  get etag() {
139
121
  return this.headers["etag"];
140
122
  }
141
123
  /**
142
- * Returns the `Last-Modified` response header value, or `undefined` when absent.
124
+ * Returns the Last-Modified header value, if present.
125
+ *
126
+ * @returns {string|undefined} The last modified date string.
143
127
  */
144
128
  get lastModified() {
145
129
  return this.headers["last-modified"];
146
130
  }
147
131
  /**
148
- * Returns the `Cache-Control` response header value, or `undefined` when absent.
132
+ * Returns the Cache-Control header value, if present.
133
+ *
134
+ * @returns {string|undefined} The cache control directive string.
149
135
  */
150
136
  get cacheControl() {
151
137
  return this.headers["cache-control"];
152
138
  }
153
139
  /**
154
- * Returns the `Content-Range` response header value, or `undefined` when absent.
155
- * Present on 206 Partial Content responses (RFC 9110 §14.4).
140
+ * Returns the Content-Range header value, if present.
141
+ *
142
+ * @returns {string|undefined} The content range descriptor.
156
143
  */
157
144
  get contentRange() {
158
145
  return this.headers["content-range"];
159
146
  }
160
147
  /**
161
- * Returns the `Accept-Ranges` response header value, or `undefined` when absent.
162
- * Indicates whether the server supports range requests (RFC 9110 §14.3).
148
+ * Returns the Accept-Ranges header value, if present.
149
+ *
150
+ * @returns {string|undefined} The accepted range unit.
163
151
  */
164
152
  get acceptRanges() {
165
153
  return this.headers["accept-ranges"];
166
154
  }
167
155
  /**
168
- * Returns all values for a response header, in transmission order,
169
- * supporting multi-value headers such as `Set-Cookie` which are joined
170
- * when accessed through `headers`.
156
+ * Retrieves all values for a given header name from the raw headers array.
171
157
  *
172
- * @param {string} name - The case-insensitive header name to look up.
173
- * @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.
174
160
  */
175
161
  getAll(name) {
176
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,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,C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,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAAE,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAY;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;CACF"}
@@ -6,21 +6,14 @@ import { type RateLimitConfig } from "../middleware/rate-limiter.js";
6
6
  import { CacheStore } from "../cache/store.js";
7
7
  import { HSTSStore } from "../hsts/store.js";
8
8
  /**
9
- * Request options that can be passed alongside a URL and HTTP method. All
10
- * fields from {@link NLcURLRequest} except `url`, `method`, and `body`.
11
- *
12
- * @typedef {Omit<NLcURLRequest, 'url'|'method'|'body'>} RequestOptions
9
+ * Request options excluding URL, method, and body used for convenience method signatures.
13
10
  */
14
11
  export type RequestOptions = Omit<NLcURLRequest, "url" | "method" | "body">;
15
12
  /**
16
- * Stateful HTTP client session that persists connections, cookies, interceptors,
17
- * and configuration across multiple requests. Prefer using a session when making
18
- * many requests to the same origin, or when you need shared cookie state.
13
+ * Manages a persistent HTTP session with connection pooling, cookie storage,
14
+ * caching, HSTS enforcement, interceptors, rate limiting, and retry logic.
19
15
  *
20
- * @example
21
- * const session = new NLcURLSession({ impersonate: 'chrome136' });
22
- * const response = await session.get('https://example.com');
23
- * session.close();
16
+ * @class
24
17
  */
25
18
  export declare class NLcURLSession {
26
19
  private readonly config;
@@ -33,143 +26,138 @@ export declare class NLcURLSession {
33
26
  private readonly hstsStore;
34
27
  private closed;
35
28
  /**
36
- * Creates a new NLcURLSession.
29
+ * Creates a new session with the given configuration.
37
30
  *
38
- * @param {NLcURLSessionConfig} [config={}] - Session-level defaults applied to every request.
31
+ * @param {NLcURLSessionConfig} [config={}] - Session-level defaults and feature toggles.
32
+ * @throws {NLcURLError} If configuration values are invalid.
39
33
  */
40
34
  constructor(config?: NLcURLSessionConfig);
41
35
  /**
42
- * Registers a request interceptor that is invoked (in registration order)
43
- * before each request is dispatched. The interceptor may return a modified
44
- * request object or a `Promise` that resolves to one.
36
+ * Registers a request interceptor invoked before each outgoing request.
45
37
  *
46
- * @param {RequestInterceptor} fn - The interceptor function to add.
47
- * @returns {this} The session instance, enabling a fluent call chain.
38
+ * @param {RequestInterceptor} fn - The interceptor function.
39
+ * @returns {this} The session instance for chaining.
48
40
  */
49
41
  onRequest(fn: RequestInterceptor): this;
50
42
  /**
51
- * Registers a response interceptor that is invoked (in registration order)
52
- * after each response is received. The interceptor may return a modified
53
- * response object or a `Promise` that resolves to one.
43
+ * Registers a response interceptor invoked after each incoming response.
54
44
  *
55
- * @param {ResponseInterceptor} fn - The interceptor function to add.
56
- * @returns {this} The session instance, enabling a fluent call chain.
45
+ * @param {ResponseInterceptor} fn - The interceptor function.
46
+ * @returns {this} The session instance for chaining.
57
47
  */
58
48
  onResponse(fn: ResponseInterceptor): this;
59
49
  /**
60
- * Applies a token-bucket rate limit to all requests issued by this session.
61
- * Requests that exceed the configured rate will wait until a token becomes
62
- * available before proceeding.
50
+ * Configures a token-bucket rate limiter for this session.
63
51
  *
64
- * @param {RateLimitConfig} config - Rate limit parameters (`maxRequests` per `windowMs`).
65
- * @returns {this} The session instance, enabling a fluent call chain.
52
+ * @param {RateLimitConfig} config - Rate limit parameters.
53
+ * @returns {this} The session instance for chaining.
54
+ * @throws {NLcURLError} If the rate limit config is invalid.
66
55
  */
67
56
  setRateLimit(config: RateLimitConfig): this;
68
57
  /**
69
- * Issues a `GET` request and resolves with the complete response.
58
+ * Sends an HTTP GET request.
70
59
  *
71
- * @param {string} url - The URL to request.
72
- * @param {RequestOptions} [options] - Optional per-request settings.
60
+ * @param {string} url - The target URL.
61
+ * @param {RequestOptions} [options] - Additional request options.
73
62
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
74
63
  */
75
64
  get(url: string, options?: RequestOptions): Promise<NLcURLResponse>;
76
65
  /**
77
- * Issues a `POST` request and resolves with the complete response.
66
+ * Sends an HTTP POST request.
78
67
  *
79
- * @param {string} url - The URL to request.
80
- * @param {RequestBody} [body] - Request body payload.
81
- * @param {RequestOptions} [options] - Optional per-request settings.
68
+ * @param {string} url - The target URL.
69
+ * @param {RequestBody} [body] - The request body.
70
+ * @param {RequestOptions} [options] - Additional request options.
82
71
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
83
72
  */
84
73
  post(url: string, body?: RequestBody, options?: RequestOptions): Promise<NLcURLResponse>;
85
74
  /**
86
- * Issues a `PUT` request and resolves with the complete response.
75
+ * Sends an HTTP PUT request.
87
76
  *
88
- * @param {string} url - The URL to request.
89
- * @param {RequestBody} [body] - Request body payload.
90
- * @param {RequestOptions} [options] - Optional per-request settings.
77
+ * @param {string} url - The target URL.
78
+ * @param {RequestBody} [body] - The request body.
79
+ * @param {RequestOptions} [options] - Additional request options.
91
80
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
92
81
  */
93
82
  put(url: string, body?: RequestBody, options?: RequestOptions): Promise<NLcURLResponse>;
94
83
  /**
95
- * Issues a `PATCH` request and resolves with the complete response.
84
+ * Sends an HTTP PATCH request.
96
85
  *
97
- * @param {string} url - The URL to request.
98
- * @param {RequestBody} [body] - Request body payload.
99
- * @param {RequestOptions} [options] - Optional per-request settings.
86
+ * @param {string} url - The target URL.
87
+ * @param {RequestBody} [body] - The request body.
88
+ * @param {RequestOptions} [options] - Additional request options.
100
89
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
101
90
  */
102
91
  patch(url: string, body?: RequestBody, options?: RequestOptions): Promise<NLcURLResponse>;
103
92
  /**
104
- * Issues a `DELETE` request and resolves with the complete response.
93
+ * Sends an HTTP DELETE request.
105
94
  *
106
- * @param {string} url - The URL to request.
107
- * @param {RequestOptions} [options] - Optional per-request settings.
95
+ * @param {string} url - The target URL.
96
+ * @param {RequestOptions} [options] - Additional request options.
108
97
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
109
98
  */
110
99
  delete(url: string, options?: RequestOptions): Promise<NLcURLResponse>;
111
100
  /**
112
- * Issues a `HEAD` request and resolves with the complete response (no body).
101
+ * Sends an HTTP HEAD request.
113
102
  *
114
- * @param {string} url - The URL to request.
115
- * @param {RequestOptions} [options] - Optional per-request settings.
103
+ * @param {string} url - The target URL.
104
+ * @param {RequestOptions} [options] - Additional request options.
116
105
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
117
106
  */
118
107
  head(url: string, options?: RequestOptions): Promise<NLcURLResponse>;
119
108
  /**
120
- * Issues an `OPTIONS` request and resolves with the complete response.
109
+ * Sends an HTTP OPTIONS request.
121
110
  *
122
- * @param {string} url - The URL to request.
123
- * @param {RequestOptions} [options] - Optional per-request settings.
111
+ * @param {string} url - The target URL.
112
+ * @param {RequestOptions} [options] - Additional request options.
124
113
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
125
114
  */
126
115
  options(url: string, options?: RequestOptions): Promise<NLcURLResponse>;
127
116
  /**
128
- * Executes a fully described HTTP request, applying session defaults, request
129
- * interceptors, redirect following, cookie management, and response
130
- * interceptors in sequence.
117
+ * Sends an HTTP QUERY request (RFC 9110).
131
118
  *
132
- * @param {NLcURLRequest} input - The request descriptor.
133
- * @returns {Promise<NLcURLResponse>} Resolves with the final response after all redirects.
134
- * @throws {NLcURLError} If the session has been closed.
135
- * @throws {AbortError} If the provided `AbortSignal` fires before completion.
136
- * @throws {TimeoutError} If any configured timeout is exceeded.
137
- * @throws {ConnectionError} If a TCP connection cannot be established.
138
- * @throws {TLSError} If the TLS handshake fails.
139
- * @throws {ProxyError} If the proxy tunnel cannot be established.
140
- * @throws {NLcURLError} If the maximum number of redirects is exceeded (`ERR_MAX_REDIRECTS`).
119
+ * @param {string} url - The target URL.
120
+ * @param {RequestBody} [body] - The query body.
121
+ * @param {RequestOptions} [options] - Additional request options.
122
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
123
+ */
124
+ query(url: string, body?: RequestBody, options?: RequestOptions): Promise<NLcURLResponse>;
125
+ /**
126
+ * Sends an HTTP request with full session features including caching,
127
+ * HSTS upgrade, cookie handling, compression, retry, and interceptors.
128
+ *
129
+ * @param {NLcURLRequest} input - The complete request descriptor.
130
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
131
+ * @throws {NLcURLError} If the session is closed.
132
+ * @throws {HTTPError} If `throwOnError` is enabled and the response is non-2xx.
141
133
  */
142
134
  request(input: NLcURLRequest): Promise<NLcURLResponse>;
143
135
  /**
144
- * Returns the active {@link CookieJar} for this session, or `null` if
145
- * cookie management was disabled via `cookieJar: false`.
136
+ * Returns the session's cookie jar, or `null` if cookies are disabled.
146
137
  *
147
- * @returns {CookieJar|null} The shared cookie jar, or `null`.
138
+ * @returns {CookieJar|null} The cookie jar instance.
148
139
  */
149
140
  getCookies(): CookieJar | null;
150
141
  /**
151
- * Returns the active {@link CacheStore} for this session, or `null` if
152
- * caching was not enabled.
142
+ * Returns the session's cache store, or `null` if caching is disabled.
153
143
  *
154
- * @returns {CacheStore|null} The cache store, or `null`.
144
+ * @returns {CacheStore|null} The cache store instance.
155
145
  */
156
146
  getCache(): CacheStore | null;
157
147
  /**
158
- * Returns the active {@link HSTSStore} for this session, or `null` if
159
- * HSTS was not enabled.
148
+ * Returns the session's HSTS store, or `null` if HSTS is disabled.
160
149
  *
161
- * @returns {HSTSStore|null} The HSTS store, or `null`.
150
+ * @returns {HSTSStore|null} The HSTS store instance.
162
151
  */
163
152
  getHSTS(): HSTSStore | null;
164
153
  /**
165
- * Returns the Alt-Svc store used by this session's negotiator.
166
- * The store records Alt-Svc headers from responses for HTTP/3 discovery.
154
+ * Returns the session's Alt-Svc store for HTTP alternative service lookups.
155
+ *
156
+ * @returns {import("../http/alt-svc.js").AltSvcStore} The Alt-Svc store instance.
167
157
  */
168
158
  getAltSvc(): import("../http/alt-svc.js").AltSvcStore;
169
159
  /**
170
- * Closes the session, releasing any pooled connections. After calling this
171
- * method, issuing further requests will throw an `NLcURLError` with code
172
- * `ERR_SESSION_CLOSED`. Subsequent calls are no-ops.
160
+ * Closes the session and releases all pooled connections.
173
161
  */
174
162
  close(): void;
175
163
  private mergeDefaults;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAA2B,WAAW,EAAmD,MAAM,cAAc,CAAC;AAC9J,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAoB,KAAK,kBAAkB,EAAE,KAAK,mBA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