nlcurl 0.7.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 (350) 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 +58 -36
  15. package/dist/cache/store.d.ts.map +1 -1
  16. package/dist/cache/store.js +58 -46
  17. package/dist/cache/store.js.map +1 -1
  18. package/dist/cache/types.d.ts +7 -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 +30 -39
  33. package/dist/cookies/jar.d.ts.map +1 -1
  34. package/dist/cookies/jar.js +27 -37
  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 +17 -14
  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 +30 -0
  47. package/dist/core/auth.d.ts.map +1 -0
  48. package/dist/core/auth.js +34 -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 +23 -111
  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 +105 -76
  67. package/dist/core/session.js.map +1 -1
  68. package/dist/core/validation.d.ts +44 -43
  69. package/dist/core/validation.d.ts.map +1 -1
  70. package/dist/core/validation.js +44 -56
  71. package/dist/core/validation.js.map +1 -1
  72. package/dist/dns/cache.d.ts +59 -0
  73. package/dist/dns/cache.d.ts.map +1 -0
  74. package/dist/dns/cache.js +99 -0
  75. package/dist/dns/cache.js.map +1 -0
  76. package/dist/dns/codec.d.ts +20 -18
  77. package/dist/dns/codec.d.ts.map +1 -1
  78. package/dist/dns/codec.js +20 -36
  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 +46 -47
  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 +158 -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 +83 -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 +31 -49
  145. package/dist/http/alt-svc.d.ts.map +1 -1
  146. package/dist/http/alt-svc.js +21 -55
  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 +10 -17
  161. package/dist/http/h1/encoder.d.ts.map +1 -1
  162. package/dist/http/h1/encoder.js +10 -17
  163. package/dist/http/h1/encoder.js.map +1 -1
  164. package/dist/http/h1/parser.d.ts +22 -59
  165. package/dist/http/h1/parser.d.ts.map +1 -1
  166. package/dist/http/h1/parser.js +15 -47
  167. package/dist/http/h1/parser.js.map +1 -1
  168. package/dist/http/h2/client.d.ts +18 -59
  169. package/dist/http/h2/client.d.ts.map +1 -1
  170. package/dist/http/h2/client.js +29 -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 +16 -35
  177. package/dist/http/h2/hpack.d.ts.map +1 -1
  178. package/dist/http/h2/hpack.js +16 -35
  179. package/dist/http/h2/hpack.js.map +1 -1
  180. package/dist/http/h3/detection.d.ts +5 -7
  181. package/dist/http/h3/detection.d.ts.map +1 -1
  182. package/dist/http/h3/detection.js +5 -23
  183. package/dist/http/h3/detection.js.map +1 -1
  184. package/dist/http/negotiator.d.ts +25 -38
  185. package/dist/http/negotiator.d.ts.map +1 -1
  186. package/dist/http/negotiator.js +16 -28
  187. package/dist/http/negotiator.js.map +1 -1
  188. package/dist/http/pool.d.ts +32 -62
  189. package/dist/http/pool.d.ts.map +1 -1
  190. package/dist/http/pool.js +22 -41
  191. package/dist/http/pool.js.map +1 -1
  192. package/dist/http/resumable-upload.d.ts +76 -0
  193. package/dist/http/resumable-upload.d.ts.map +1 -0
  194. package/dist/http/resumable-upload.js +104 -0
  195. package/dist/http/resumable-upload.js.map +1 -0
  196. package/dist/http/trailers.d.ts +29 -0
  197. package/dist/http/trailers.d.ts.map +1 -0
  198. package/dist/http/trailers.js +57 -0
  199. package/dist/http/trailers.js.map +1 -0
  200. package/dist/index.d.ts +21 -8
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +21 -2
  203. package/dist/index.js.map +1 -1
  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 +128 -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 +5 -8
  235. package/dist/proxy/socks.js.map +1 -1
  236. package/dist/sse/parser.d.ts +14 -37
  237. package/dist/sse/parser.d.ts.map +1 -1
  238. package/dist/sse/parser.js +14 -28
  239. package/dist/sse/parser.js.map +1 -1
  240. package/dist/tls/constants.d.ts +15 -74
  241. package/dist/tls/constants.d.ts.map +1 -1
  242. package/dist/tls/constants.js +15 -74
  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 +20 -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 +25 -44
  277. package/dist/tls/stealth/client-hello.d.ts.map +1 -1
  278. package/dist/tls/stealth/client-hello.js +17 -28
  279. package/dist/tls/stealth/client-hello.js.map +1 -1
  280. package/dist/tls/stealth/engine.d.ts +5 -15
  281. package/dist/tls/stealth/engine.d.ts.map +1 -1
  282. package/dist/tls/stealth/engine.js +11 -17
  283. package/dist/tls/stealth/engine.js.map +1 -1
  284. package/dist/tls/stealth/handshake.d.ts +21 -31
  285. package/dist/tls/stealth/handshake.d.ts.map +1 -1
  286. package/dist/tls/stealth/handshake.js +15 -43
  287. package/dist/tls/stealth/handshake.js.map +1 -1
  288. package/dist/tls/stealth/key-schedule.d.ts +59 -86
  289. package/dist/tls/stealth/key-schedule.d.ts.map +1 -1
  290. package/dist/tls/stealth/key-schedule.js +46 -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 +8 -0
  299. package/dist/tls/stealth/tls12-handshake.js.map +1 -1
  300. package/dist/tls/types.d.ts +42 -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 +33 -53
  339. package/dist/ws/client.d.ts.map +1 -1
  340. package/dist/ws/client.js +29 -30
  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 +18 -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 +62 -62
@@ -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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IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;OAOG;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"}
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/core/response.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,4BAA4B;IACZ,MAAM,CAAS;IAC/B,8BAA8B;IACd,UAAU,CAAS;IACnC,4DAA4D;IAC5C,OAAO,CAAyB;IAChD,kEAAkE;IAClD,UAAU,CAA0B;IACpD,0CAA0C;IAC1B,OAAO,CAAS;IAChC,mFAAmF;IACnE,IAAI,CAAkB;IACtC,qDAAqD;IACrC,WAAW,CAAS;IACpC,yCAAyC;IACzB,GAAG,CAAS;IAC5B,+DAA+D;IAC/C,aAAa,CAAS;IACtC,kDAAkD;IAClC,OAAO,CAAiB;IACxC,8CAA8C;IAC9B,OAAO,CAAe;IAE9B,KAAK,CAAgB;IACrB,KAAK,CAAqB;IAElC;;;;OAIG;IACH,YAAY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,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,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOlF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC;AAE5E;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,MAAM,CAAS;IAE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OAAO,CAAC,cAAc,CAAC;IAIvE;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAIzF;;;;;;;;OAQG;IACG,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IA0I5D;;;;OAIG;IACH,UAAU,IAAI,SAAS,GAAG,IAAI;IAI9B;;;;OAIG;IACH,QAAQ,IAAI,UAAU,GAAG,IAAI;IAI7B;;;;OAIG;IACH,OAAO,IAAI,SAAS,GAAG,IAAI;IAI3B;;;;OAIG;IACH,SAAS,IAAI,OAAO,oBAAoB,EAAE,WAAW;IAIrD;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,aAAa;IAoFrB,OAAO,CAAC,cAAc;YASR,oBAAoB;CA6HnC"}
@@ -12,16 +12,14 @@ import { validateSessionConfig, validateRequest, validateRateLimitConfig, valida
12
12
  import { resolveEnvProxy } from "../proxy/env-proxy.js";
13
13
  import { CacheStore } from "../cache/store.js";
14
14
  import { HSTSStore } from "../hsts/store.js";
15
+ import { buildAuthHeader } from "./auth.js";
16
+ import { compressBody, shouldCompress } from "../utils/compression.js";
15
17
  const MAX_REDIRECTS = 20;
16
18
  /**
17
- * Stateful HTTP client session that persists connections, cookies, interceptors,
18
- * and configuration across multiple requests. Prefer using a session when making
19
- * many requests to the same origin, or when you need shared cookie state.
19
+ * Manages a persistent HTTP session with connection pooling, cookie storage,
20
+ * caching, HSTS enforcement, interceptors, rate limiting, and retry logic.
20
21
  *
21
- * @example
22
- * const session = new NLcURLSession({ impersonate: 'chrome136' });
23
- * const response = await session.get('https://example.com');
24
- * session.close();
22
+ * @class
25
23
  */
26
24
  export class NLcURLSession {
27
25
  config;
@@ -34,9 +32,10 @@ export class NLcURLSession {
34
32
  hstsStore;
35
33
  closed = false;
36
34
  /**
37
- * Creates a new NLcURLSession.
35
+ * Creates a new session with the given configuration.
38
36
  *
39
- * @param {NLcURLSessionConfig} [config={}] - Session-level defaults applied to every request.
37
+ * @param {NLcURLSessionConfig} [config={}] - Session-level defaults and feature toggles.
38
+ * @throws {NLcURLError} If configuration values are invalid.
40
39
  */
41
40
  constructor(config = {}) {
42
41
  validateSessionConfig(config);
@@ -70,36 +69,31 @@ export class NLcURLSession {
70
69
  }
71
70
  }
72
71
  /**
73
- * Registers a request interceptor that is invoked (in registration order)
74
- * before each request is dispatched. The interceptor may return a modified
75
- * request object or a `Promise` that resolves to one.
72
+ * Registers a request interceptor invoked before each outgoing request.
76
73
  *
77
- * @param {RequestInterceptor} fn - The interceptor function to add.
78
- * @returns {this} The session instance, enabling a fluent call chain.
74
+ * @param {RequestInterceptor} fn - The interceptor function.
75
+ * @returns {this} The session instance for chaining.
79
76
  */
80
77
  onRequest(fn) {
81
78
  this.interceptors.addRequestInterceptor(fn);
82
79
  return this;
83
80
  }
84
81
  /**
85
- * Registers a response interceptor that is invoked (in registration order)
86
- * after each response is received. The interceptor may return a modified
87
- * response object or a `Promise` that resolves to one.
82
+ * Registers a response interceptor invoked after each incoming response.
88
83
  *
89
- * @param {ResponseInterceptor} fn - The interceptor function to add.
90
- * @returns {this} The session instance, enabling a fluent call chain.
84
+ * @param {ResponseInterceptor} fn - The interceptor function.
85
+ * @returns {this} The session instance for chaining.
91
86
  */
92
87
  onResponse(fn) {
93
88
  this.interceptors.addResponseInterceptor(fn);
94
89
  return this;
95
90
  }
96
91
  /**
97
- * Applies a token-bucket rate limit to all requests issued by this session.
98
- * Requests that exceed the configured rate will wait until a token becomes
99
- * available before proceeding.
92
+ * Configures a token-bucket rate limiter for this session.
100
93
  *
101
- * @param {RateLimitConfig} config - Rate limit parameters (`maxRequests` per `windowMs`).
102
- * @returns {this} The session instance, enabling a fluent call chain.
94
+ * @param {RateLimitConfig} config - Rate limit parameters.
95
+ * @returns {this} The session instance for chaining.
96
+ * @throws {NLcURLError} If the rate limit config is invalid.
103
97
  */
104
98
  setRateLimit(config) {
105
99
  validateRateLimitConfig(config);
@@ -107,92 +101,97 @@ export class NLcURLSession {
107
101
  return this;
108
102
  }
109
103
  /**
110
- * Issues a `GET` request and resolves with the complete response.
104
+ * Sends an HTTP GET request.
111
105
  *
112
- * @param {string} url - The URL to request.
113
- * @param {RequestOptions} [options] - Optional per-request settings.
106
+ * @param {string} url - The target URL.
107
+ * @param {RequestOptions} [options] - Additional request options.
114
108
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
115
109
  */
116
110
  get(url, options) {
117
111
  return this.request({ ...options, url, method: "GET" });
118
112
  }
119
113
  /**
120
- * Issues a `POST` request and resolves with the complete response.
114
+ * Sends an HTTP POST request.
121
115
  *
122
- * @param {string} url - The URL to request.
123
- * @param {RequestBody} [body] - Request body payload.
124
- * @param {RequestOptions} [options] - Optional per-request settings.
116
+ * @param {string} url - The target URL.
117
+ * @param {RequestBody} [body] - The request body.
118
+ * @param {RequestOptions} [options] - Additional request options.
125
119
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
126
120
  */
127
121
  post(url, body, options) {
128
122
  return this.request({ ...options, url, method: "POST", body });
129
123
  }
130
124
  /**
131
- * Issues a `PUT` request and resolves with the complete response.
125
+ * Sends an HTTP PUT request.
132
126
  *
133
- * @param {string} url - The URL to request.
134
- * @param {RequestBody} [body] - Request body payload.
135
- * @param {RequestOptions} [options] - Optional per-request settings.
127
+ * @param {string} url - The target URL.
128
+ * @param {RequestBody} [body] - The request body.
129
+ * @param {RequestOptions} [options] - Additional request options.
136
130
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
137
131
  */
138
132
  put(url, body, options) {
139
133
  return this.request({ ...options, url, method: "PUT", body });
140
134
  }
141
135
  /**
142
- * Issues a `PATCH` request and resolves with the complete response.
136
+ * Sends an HTTP PATCH request.
143
137
  *
144
- * @param {string} url - The URL to request.
145
- * @param {RequestBody} [body] - Request body payload.
146
- * @param {RequestOptions} [options] - Optional per-request settings.
138
+ * @param {string} url - The target URL.
139
+ * @param {RequestBody} [body] - The request body.
140
+ * @param {RequestOptions} [options] - Additional request options.
147
141
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
148
142
  */
149
143
  patch(url, body, options) {
150
144
  return this.request({ ...options, url, method: "PATCH", body });
151
145
  }
152
146
  /**
153
- * Issues a `DELETE` request and resolves with the complete response.
147
+ * Sends an HTTP DELETE request.
154
148
  *
155
- * @param {string} url - The URL to request.
156
- * @param {RequestOptions} [options] - Optional per-request settings.
149
+ * @param {string} url - The target URL.
150
+ * @param {RequestOptions} [options] - Additional request options.
157
151
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
158
152
  */
159
153
  delete(url, options) {
160
154
  return this.request({ ...options, url, method: "DELETE" });
161
155
  }
162
156
  /**
163
- * Issues a `HEAD` request and resolves with the complete response (no body).
157
+ * Sends an HTTP HEAD request.
164
158
  *
165
- * @param {string} url - The URL to request.
166
- * @param {RequestOptions} [options] - Optional per-request settings.
159
+ * @param {string} url - The target URL.
160
+ * @param {RequestOptions} [options] - Additional request options.
167
161
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
168
162
  */
169
163
  head(url, options) {
170
164
  return this.request({ ...options, url, method: "HEAD" });
171
165
  }
172
166
  /**
173
- * Issues an `OPTIONS` request and resolves with the complete response.
167
+ * Sends an HTTP OPTIONS request.
174
168
  *
175
- * @param {string} url - The URL to request.
176
- * @param {RequestOptions} [options] - Optional per-request settings.
169
+ * @param {string} url - The target URL.
170
+ * @param {RequestOptions} [options] - Additional request options.
177
171
  * @returns {Promise<NLcURLResponse>} Resolves with the server response.
178
172
  */
179
173
  options(url, options) {
180
174
  return this.request({ ...options, url, method: "OPTIONS" });
181
175
  }
182
176
  /**
183
- * Executes a fully described HTTP request, applying session defaults, request
184
- * interceptors, redirect following, cookie management, and response
185
- * interceptors in sequence.
177
+ * Sends an HTTP QUERY request (RFC 9110).
186
178
  *
187
- * @param {NLcURLRequest} input - The request descriptor.
188
- * @returns {Promise<NLcURLResponse>} Resolves with the final response after all redirects.
189
- * @throws {NLcURLError} If the session has been closed.
190
- * @throws {AbortError} If the provided `AbortSignal` fires before completion.
191
- * @throws {TimeoutError} If any configured timeout is exceeded.
192
- * @throws {ConnectionError} If a TCP connection cannot be established.
193
- * @throws {TLSError} If the TLS handshake fails.
194
- * @throws {ProxyError} If the proxy tunnel cannot be established.
195
- * @throws {NLcURLError} If the maximum number of redirects is exceeded (`ERR_MAX_REDIRECTS`).
179
+ * @param {string} url - The target URL.
180
+ * @param {RequestBody} [body] - The query body.
181
+ * @param {RequestOptions} [options] - Additional request options.
182
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
183
+ */
184
+ query(url, body, options) {
185
+ return this.request({ ...options, url, method: "QUERY", body });
186
+ }
187
+ /**
188
+ * Sends an HTTP request with full session features including caching,
189
+ * HSTS upgrade, cookie handling, compression, retry, and interceptors.
190
+ *
191
+ * @param {NLcURLRequest} input - The complete request descriptor.
192
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
193
+ * @throws {NLcURLError} If the session is closed.
194
+ * @throws {HTTPError} If `throwOnError` is enabled and the response is non-2xx.
196
195
  */
197
196
  async request(input) {
198
197
  if (this.closed) {
@@ -204,6 +203,28 @@ export class NLcURLSession {
204
203
  }
205
204
  let req = this.mergeDefaults(input);
206
205
  req = await this.interceptors.processRequest(req);
206
+ const compressionEncoding = req.compressBody ?? this.config.compressBody;
207
+ if (compressionEncoding && req.body) {
208
+ let bodyBuf = null;
209
+ if (Buffer.isBuffer(req.body)) {
210
+ bodyBuf = req.body;
211
+ }
212
+ else if (typeof req.body === "string") {
213
+ bodyBuf = Buffer.from(req.body, "utf-8");
214
+ }
215
+ if (bodyBuf && shouldCompress(bodyBuf.length)) {
216
+ const compressed = await compressBody(bodyBuf, compressionEncoding);
217
+ const headers = { ...req.headers };
218
+ headers["content-encoding"] = compressionEncoding === "br" ? "br" : compressionEncoding;
219
+ headers["content-length"] = String(compressed.length);
220
+ req = { ...req, body: compressed, headers };
221
+ }
222
+ }
223
+ if (req.methodOverride === "QUERY") {
224
+ const headers = { ...req.headers };
225
+ headers["x-http-method-override"] = "QUERY";
226
+ req = { ...req, method: "POST", headers };
227
+ }
207
228
  const profile = this.resolveProfile(req);
208
229
  const negotiatorOptions = {
209
230
  stealth: req.stealth,
@@ -285,43 +306,39 @@ export class NLcURLSession {
285
306
  return response;
286
307
  }
287
308
  /**
288
- * Returns the active {@link CookieJar} for this session, or `null` if
289
- * cookie management was disabled via `cookieJar: false`.
309
+ * Returns the session's cookie jar, or `null` if cookies are disabled.
290
310
  *
291
- * @returns {CookieJar|null} The shared cookie jar, or `null`.
311
+ * @returns {CookieJar|null} The cookie jar instance.
292
312
  */
293
313
  getCookies() {
294
314
  return this.cookieJar;
295
315
  }
296
316
  /**
297
- * Returns the active {@link CacheStore} for this session, or `null` if
298
- * caching was not enabled.
317
+ * Returns the session's cache store, or `null` if caching is disabled.
299
318
  *
300
- * @returns {CacheStore|null} The cache store, or `null`.
319
+ * @returns {CacheStore|null} The cache store instance.
301
320
  */
302
321
  getCache() {
303
322
  return this.cacheStore;
304
323
  }
305
324
  /**
306
- * Returns the active {@link HSTSStore} for this session, or `null` if
307
- * HSTS was not enabled.
325
+ * Returns the session's HSTS store, or `null` if HSTS is disabled.
308
326
  *
309
- * @returns {HSTSStore|null} The HSTS store, or `null`.
327
+ * @returns {HSTSStore|null} The HSTS store instance.
310
328
  */
311
329
  getHSTS() {
312
330
  return this.hstsStore;
313
331
  }
314
332
  /**
315
- * Returns the Alt-Svc store used by this session's negotiator.
316
- * The store records Alt-Svc headers from responses for HTTP/3 discovery.
333
+ * Returns the session's Alt-Svc store for HTTP alternative service lookups.
334
+ *
335
+ * @returns {import("../http/alt-svc.js").AltSvcStore} The Alt-Svc store instance.
317
336
  */
318
337
  getAltSvc() {
319
338
  return this.negotiator.altSvcStore;
320
339
  }
321
340
  /**
322
- * Closes the session, releasing any pooled connections. After calling this
323
- * method, issuing further requests will throw an `NLcURLError` with code
324
- * `ERR_SESSION_CLOSED`. Subsequent calls are no-ops.
341
+ * Closes the session and releases all pooled connections.
325
342
  */
326
343
  close() {
327
344
  if (this.closed)
@@ -362,6 +379,16 @@ export class NLcURLSession {
362
379
  if (input.range && !headers["range"]) {
363
380
  headers["range"] = input.range;
364
381
  }
382
+ const authConfig = input.auth ?? cfg.auth;
383
+ if (authConfig && !headers["authorization"]) {
384
+ const authHeader = buildAuthHeader(authConfig);
385
+ if (authHeader) {
386
+ headers["authorization"] = authHeader;
387
+ }
388
+ }
389
+ if (input.expect100Continue && input.body && !headers["expect"]) {
390
+ headers["expect"] = "100-continue";
391
+ }
365
392
  if (this.cookieJar) {
366
393
  const parsedUrl = new URL(url);
367
394
  const cookieHeader = this.cookieJar.getCookieHeader(parsedUrl);
@@ -416,14 +443,16 @@ export class NLcURLSession {
416
443
  if (currentReq.signal) {
417
444
  const sig = currentReq.signal;
418
445
  response = await new Promise((resolve, reject) => {
419
- const onAbort = () => reject(new AbortError());
446
+ const onAbort = () => {
447
+ reject(new AbortError());
448
+ };
420
449
  sig.addEventListener("abort", onAbort, { once: true });
421
450
  this.negotiator.send(currentReq, options).then((res) => {
422
451
  sig.removeEventListener("abort", onAbort);
423
452
  resolve(res);
424
453
  }, (err) => {
425
454
  sig.removeEventListener("abort", onAbort);
426
- reject(err);
455
+ reject(err instanceof Error ? err : new NLcURLError(String(err), "ERR_UNKNOWN"));
427
456
  });
428
457
  });
429
458
  }