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
package/README.md CHANGED
@@ -1,31 +1,37 @@
1
1
  # NLcURL
2
2
 
3
- Pure TypeScript HTTP client with browser fingerprint impersonation.
4
-
5
- NLcURL provides session-based and one-shot HTTP APIs, browser profile impersonation, HTTP/2 support, cookie management, and a CLI. The project has zero runtime dependencies and uses only Node.js built-in modules.
6
-
7
- ## Highlights
8
-
9
- - Zero runtime dependencies
10
- - Session API with connection pooling
11
- - HTTP/1.1 and HTTP/2 (ALPN negotiated) with RFC 9113 flow control
12
- - Browser profile impersonation (Chrome, Firefox, Safari, Edge, Tor)
13
- - Optional custom JA3 and Akamai H2 fingerprint values in request model
14
- - Cookie jar with RFC 6265 behavior, Public Suffix List enforcement, `SameSite=Lax` default, and `__Host-`/`__Secure-` prefix validation
15
- - `FormData` class for `multipart/form-data` uploads (RFC 7578)
16
- - mTLS and custom CA trust via `TLSOptions` (`cert`, `key`, `pfx`, `ca`, `passphrase`)
17
- - `ReadableStream<Uint8Array>` upload bodies (auto-drained before encoding)
18
- - Header validation per RFC 7230 (rejects CR/LF/NUL injection)
19
- - Streaming response support (`stream: true`) with automatic decompression
20
- - Automatic dual-stack connectivity via Happy Eyeballs (RFC 8305) — falls back to IPv4 instantly when IPv6 is unreachable, with optional `dnsFamily` pin
21
- - Automatic retry on H2 RST_STREAM protocol errors (codes 1, 2, 7, 8, 11, 13) with capped exponential backoff
22
- - CLI (`nlcurl`) for scripted and interactive use
23
- - WebSocket client with optional impersonated TLS handshake
24
-
25
- ## Requirements
26
-
27
- - Node.js `>= 18.17.0`
28
- - npm (or compatible package manager)
3
+ A pure TypeScript HTTP client with native TLS fingerprint impersonation. Zero runtime dependencies.
4
+
5
+ NLcURL provides HTTP/1.1 and HTTP/2 request capabilities with a custom stealth TLS engine that reproduces browser-grade TLS and HTTP/2 fingerprints. It is designed for environments where accurate browser impersonation, advanced protocol control, and strict standards compliance are required.
6
+
7
+ ## Features
8
+
9
+ - **TLS Fingerprint Impersonation** — Reproduce the exact TLS ClientHello of Chrome, Firefox, Safari, Edge, and Tor across 49 resolvable browser profiles, covering JA3, JA4, and Akamai HTTP/2 fingerprints.
10
+ - **Custom Stealth TLS Engine** — A from-scratch TLS 1.2/1.3 implementation with GREASE injection (RFC 8701), configurable cipher suites, extension ordering, and Encrypted Client Hello (ECH) support.
11
+ - **HTTP/1.1 & HTTP/2** Full HTTP/1.1 with chunked transfer encoding and HTTP/2 with HPACK compression, stream multiplexing, and configurable flow control.
12
+ - **Connection Pooling** Per-origin connection reuse with idle eviction, configurable pool limits, and automatic HTTP/2 multiplexing.
13
+ - **RFC 6265 Cookie Jar** Persistent cookie storage with Public Suffix List validation, `__Host-`/`__Secure-` prefix enforcement, `SameSite` defaults, and Netscape file format import/export.
14
+ - **HTTP Caching (RFC 9111)** In-memory cache with `max-age`, `ETag`/`Last-Modified` conditional revalidation, `stale-while-revalidate`, heuristic freshness, and five cache modes.
15
+ - **HSTS (RFC 6797)** — Automatic `http://` to `https://` upgrading with `includeSubDomains` support and configurable preload lists.
16
+ - **DNS-over-HTTPS (RFC 8484)** Wire-format DoH with GET/POST methods, bootstrap resolution, and integrated DNS caching.
17
+ - **DNS-over-TLS (RFC 7858)** — Secure DNS resolution over TLS port 853 with persistent connection support and pre-configured public resolvers.
18
+ - **HTTPS Resource Records (RFC 9460)** SVCB/HTTPS DNS record resolution for ALPN hints, ECH config delivery, and address hints.
19
+ - **Proxy Support** HTTP CONNECT tunneling, HTTPS proxies, SOCKS4/4a, and SOCKS5 with optional username/password authentication. Environment variable resolution (`HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`).
20
+ - **WebSocket (RFC 6455)**Full WebSocket client with TLS fingerprinting, per-message deflate compression (RFC 7692), ping/pong, and binary/text framing.
21
+ - **Server-Sent Events** W3C EventSource-compliant SSE parser with streaming async generator interface.
22
+ - **Request/Response Interceptors** — Middleware pipeline for modifying requests before send and responses after receipt.
23
+ - **Retry with Backoff** — Configurable automatic retry with linear or exponential backoff, jitter, `Retry-After` header respect, and custom retry predicates.
24
+ - **Rate Limiting** — Token-bucket rate limiter with configurable request quotas and automatic queuing.
25
+ - **Request Body Compression** — Outgoing body compression with gzip, deflate, and Brotli.
26
+ - **Response Decompression** — Automatic decompression of gzip, deflate, Brotli, and zstd (Node.js 20.10+) with multi-layer encoding support.
27
+ - **Happy Eyeballs v2 (RFC 8305)** — Dual-stack connection racing with 250ms stagger for optimal latency.
28
+ - **Alt-Svc (RFC 7838)** HTTP Alternative Services tracking with automatic protocol upgrade preference.
29
+ - **FormData (RFC 7578)** — Multipart form-data encoding with file upload support.
30
+ - **Authentication** — Built-in Basic and Bearer authentication, plus Digest proxy authentication (RFC 7616).
31
+ - **Progress Callbacks** — Upload and download progress events with byte counts and percentages.
32
+ - **Structured Logging** — Console and JSON logger implementations with child logger support and configurable log levels.
33
+ - **CLI Tool** — `nlcurl` command-line interface with curl-compatible flags for scripting and interactive use.
34
+ - **Zero Dependencies** — Pure TypeScript with no runtime dependencies. Requires only Node.js ≥ 18.17.0.
29
35
 
30
36
  ## Installation
31
37
 
@@ -33,155 +39,152 @@ NLcURL provides session-based and one-shot HTTP APIs, browser profile impersonat
33
39
  npm install nlcurl
34
40
  ```
35
41
 
36
- For local development:
37
-
38
- ```bash
39
- npm install
40
- npm run build
41
- ```
42
+ **Requirements:** Node.js ≥ 18.17.0
42
43
 
43
44
  ## Quick Start
44
45
 
45
- ### One-shot request
46
+ ### One-Shot Requests
46
47
 
47
- ```ts
48
- import { request } from "nlcurl";
48
+ ```typescript
49
+ import { get, post } from "nlcurl";
49
50
 
50
- const response = await request({
51
- url: "https://httpbin.org/get",
52
- impersonate: "chrome136",
53
- });
51
+ // Simple GET
52
+ const response = await get("https://httpbin.org/get");
53
+ console.log(response.status); // 200
54
+ console.log(response.json()); // parsed JSON body
54
55
 
55
- console.log(response.status);
56
- console.log(response.json());
56
+ // POST with JSON body
57
+ const res = await post("https://httpbin.org/post", { key: "value" });
58
+ console.log(res.text());
57
59
  ```
58
60
 
59
- ### Multipart form upload
60
-
61
- ```ts
62
- import { post, FormData } from "nlcurl";
63
-
64
- const form = new FormData();
65
- form.append("username", "alice");
66
- form.append("avatar", { data: Buffer.from("..."), filename: "avatar.png", contentType: "image/png" });
67
-
68
- const res = await post("https://httpbin.org/post", form);
69
- console.log(res.json());
70
- ```
61
+ ### Browser Impersonation
71
62
 
72
- ### mTLS / custom CA
63
+ ```typescript
64
+ import { get } from "nlcurl";
73
65
 
74
- ```ts
75
- import { request } from "nlcurl";
76
-
77
- const res = await request({
78
- url: "https://internal-api.example.com/data",
79
- tls: {
80
- cert: fs.readFileSync("client.pem"),
81
- key: fs.readFileSync("client-key.pem"),
82
- ca: fs.readFileSync("ca.pem"),
83
- },
66
+ const response = await get("https://example.com", {
67
+ impersonate: "chrome136",
84
68
  });
85
69
  ```
86
70
 
87
- ### Session-based usage
71
+ ### Session with Connection Reuse
88
72
 
89
- ```ts
73
+ ```typescript
90
74
  import { createSession } from "nlcurl";
91
75
 
92
76
  const session = createSession({
93
- baseURL: "https://httpbin.org",
94
- impersonate: "firefox138",
95
- followRedirects: true,
77
+ baseURL: "https://api.example.com",
78
+ impersonate: "chrome136",
79
+ headers: { "authorization": "Bearer token" },
80
+ retry: { count: 3, backoff: "exponential" },
96
81
  });
97
82
 
98
- const res = await session.get("/headers");
99
- console.log(res.json());
83
+ const users = await session.get("/users");
84
+ const user = await session.post("/users", { name: "Alice" });
100
85
 
101
86
  session.close();
102
87
  ```
103
88
 
104
- ### CLI usage
89
+ ### Stealth TLS
105
90
 
106
- ```bash
107
- nlcurl --impersonate chrome136 https://tls.browserleaks.com/json
91
+ ```typescript
92
+ import { get } from "nlcurl";
93
+
94
+ // Uses the custom stealth TLS engine (bypasses Node.js TLS)
95
+ const response = await get("https://example.com", {
96
+ stealth: true,
97
+ impersonate: "chrome136",
98
+ });
108
99
  ```
109
100
 
110
- ## CLI Reference
101
+ ### WebSocket
111
102
 
112
- ```text
113
- nlcurl [OPTIONS] <URL>
103
+ ```typescript
104
+ import { WebSocketClient } from "nlcurl";
105
+
106
+ const ws = new WebSocketClient("wss://echo.websocket.events", {
107
+ impersonate: "chrome136",
108
+ compress: true,
109
+ });
110
+
111
+ ws.on("open", () => ws.sendText("Hello"));
112
+ ws.on("message", (data) => console.log(data));
113
+ ws.on("close", (code, reason) => console.log("Closed:", code));
114
114
  ```
115
115
 
116
- Key options:
117
-
118
- - `-X, --request <METHOD>` HTTP method
119
- - `-H, --header <Name: Value>` add request header
120
- - `-d, --data <DATA>` request body
121
- - `--data-raw <DATA>` raw request body
122
- - `-A, --user-agent <AGENT>` custom User-Agent
123
- - `-o, --output <FILE>` write response body to file
124
- - `-I, --head` send HEAD request
125
- - `-i, --include` include response headers
126
- - `-v, --verbose` verbose request/response output
127
- - `-s, --silent` suppress error output
128
- - `--compressed` request compressed response
129
- - `--impersonate <PROFILE>` browser profile
130
- - `--stealth` use stealth TLS engine
131
- - `--ja3 <FINGERPRINT>` custom JA3 fingerprint string
132
- - `--akamai <FINGERPRINT>` custom Akamai HTTP/2 fingerprint string
133
- - `--list-profiles` list available profiles
134
- - `-x, --proxy <URL>` proxy URL (request model supports it)
135
- - `-U, --proxy-user <USER:PASS>` proxy auth pair
136
- - `-k, --insecure` disable TLS verification
137
- - `-L, --location` follow redirects (default behavior)
138
- - `--no-location` disable redirect following
139
- - `--max-redirs <NUM>` max redirects (default `20`)
140
- - `-m, --max-time <SECONDS>` total timeout
141
- - `--http1.1` force HTTP/1.1
142
- - `--http2` force HTTP/2
143
- - `-b, --cookie <DATA>` send cookie header
144
- - `-c, --cookie-jar <FILE>` capture cookie jar target file
145
- - `-h, --help` show help
146
- - `-V, --version` show version
147
-
148
- For examples, see `docs/SETUP.md` and `docs/API.md`.
149
-
150
- ## Supported Browser Families
151
-
152
- - Chrome (`chrome99` through `chrome136`, plus `chrome_latest` and `chrome` alias)
153
- - Firefox (`firefox133` through `firefox138`, plus `firefox_latest` and `firefox` alias)
154
- - Safari (`safari153` through `safari182`, plus `safari_latest` and `safari` alias)
155
- - Edge (`edge99`, `edge101`, `edge126`, `edge131`, `edge136`, `edge_latest`, `edge` alias)
156
- - Tor (`tor133`, `tor140`, `tor145`, `tor_latest`, `tor` alias)
157
-
158
- Run `nlcurl --list-profiles` to view the exact runtime list.
159
-
160
- ## Development
116
+ ### CLI
161
117
 
162
118
  ```bash
163
- npm install
164
- npm run lint
165
- npm run test
166
- npm run test:integration
167
- npm run build
168
- ```
119
+ # Simple GET
120
+ nlcurl https://httpbin.org/get
169
121
 
170
- Additional commands:
122
+ # Impersonate Chrome with verbose output
123
+ nlcurl -v --impersonate chrome136 https://example.com
171
124
 
172
- - `npm run clean` remove `dist`
173
- - `npm run test:all` run all tests
125
+ # POST with data
126
+ nlcurl -X POST -d '{"key":"value"}' -H "Content-Type: application/json" https://httpbin.org/post
174
127
 
175
- ## Documentation Index
128
+ # Through a proxy
129
+ nlcurl -x socks5://127.0.0.1:1080 https://example.com
130
+ ```
176
131
 
177
- - `docs/API.md` — exported API reference
178
- - `docs/MODULES.md` — module-by-module usage guide
179
- - `docs/ARCHITECTURE.md` system architecture and request flow
180
- - `docs/SETUP.md` — setup, build, and test instructions
181
- - `docs/CONFIGURATION.md` request/session/CLI configuration
182
- - `docs/EXAMPLES.md` comprehensive usage examples (API + CLI)
183
- - `docs/ONBOARDING.md` contributor onboarding guide
132
+ ## Documentation
133
+
134
+ | Document | Description |
135
+ |----------|-------------|
136
+ | [API Reference](docs/API.md) | Complete API for all exported classes, functions, types, and interfaces |
137
+ | [Configuration](docs/CONFIGURATION.md) | All configuration options for requests, sessions, TLS, DNS, caching, and proxies |
138
+ | [Examples](docs/EXAMPLES.md) | Practical usage patterns covering common and advanced scenarios |
139
+ | [Modules](docs/MODULES.md) | Architecture overview and detailed breakdown of every module |
140
+ | [Onboarding](docs/ONBOARDING.md) | Getting started guide for new contributors and integrators |
141
+ | [Setup](docs/SETUP.md) | Build, test, and development environment instructions |
142
+
143
+ ## Browser Profiles
144
+
145
+ 49 resolvable browser profile names across 5 browser families:
146
+
147
+ | Browser | Profiles |
148
+ |---------|----------|
149
+ | Chrome | `chrome99` through `chrome136`, `chrome_latest`, `chrome` |
150
+ | Firefox | `firefox133` through `firefox138`, `firefox_latest`, `firefox` |
151
+ | Safari | `safari153` through `safari182`, `safari_latest`, `safari` |
152
+ | Edge | `edge99` through `edge136`, `edge_latest`, `edge` |
153
+ | Tor | `tor133` through `tor145`, `tor_latest`, `tor` |
154
+
155
+ Each profile includes a complete TLS fingerprint (cipher suites, extensions, supported groups, signature algorithms), HTTP/2 settings fingerprint (SETTINGS frame, WINDOW_UPDATE, pseudo-header order, priority frames), and default HTTP headers with an accurate User-Agent string.
156
+
157
+ ## Standards Compliance
158
+
159
+ NLcURL implements or references the following RFCs and standards:
160
+
161
+ | Standard | Coverage |
162
+ |----------|----------|
163
+ | RFC 8446 | TLS 1.3 — full handshake, key schedule, AEAD record encryption |
164
+ | RFC 5246 | TLS 1.2 — ECDHE key exchange, GCM/ChaCha20 cipher suites |
165
+ | RFC 8701 | GREASE — randomized TLS extension values for anti-fingerprinting |
166
+ | RFC 9113 | HTTP/2 — frames, HPACK, flow control, GOAWAY, stream multiplexing |
167
+ | RFC 7541 | HPACK — header compression with Huffman encoding |
168
+ | RFC 9112 | HTTP/1.1 — message syntax, chunked transfer encoding |
169
+ | RFC 9111 | HTTP Caching — freshness, conditional requests, cache modes |
170
+ | RFC 9110 | HTTP Semantics — methods, status codes, range requests |
171
+ | RFC 6265 | HTTP Cookies — Set-Cookie parsing, domain/path scoping, prefixes |
172
+ | RFC 6797 | HSTS — Strict-Transport-Security header processing |
173
+ | RFC 8484 | DNS-over-HTTPS — wire-format queries, GET/POST methods |
174
+ | RFC 7858 | DNS-over-TLS — encrypted DNS over port 853 |
175
+ | RFC 9460 | SVCB/HTTPS DNS Records — service binding, ALPN, ECH delivery |
176
+ | RFC 8305 | Happy Eyeballs v2 — dual-stack connection racing |
177
+ | RFC 6455 | WebSocket — upgrade handshake, framing, close protocol |
178
+ | RFC 7692 | WebSocket Compression — permessage-deflate negotiation |
179
+ | RFC 7838 | HTTP Alt-Svc — alternative service advertisement |
180
+ | RFC 7578 | Multipart Form Data — multipart/form-data encoding |
181
+ | RFC 7616 | HTTP Digest Authentication — MD5/SHA-256, qop=auth |
182
+ | RFC 1928 | SOCKS5 — proxy protocol with auth negotiation |
183
+ | RFC 5869 | HKDF — key derivation for TLS key schedule |
184
+ | RFC 9180 | HPKE — Hybrid Public Key Encryption for ECH |
185
+ | RFC 7413 | TCP Fast Open — platform-aware TFO support |
186
+ | RFC 8297 | 103 Early Hints — Link header parsing |
184
187
 
185
188
  ## License
186
189
 
187
- MIT. See `LICENSE`.
190
+ MIT
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Represents a named group of cache keys for batch invalidation.
3
+ */
4
+ export interface CacheGroup {
5
+ name: string;
6
+ keys: Set<string>;
7
+ lastInvalidated: number;
8
+ }
9
+ /**
10
+ * Parses a comma-separated Cache-Groups header into an array of group names.
11
+ *
12
+ * @param {string} header - The raw Cache-Groups header value.
13
+ * @returns {string[]} Parsed group names.
14
+ */
15
+ export declare function parseCacheGroups(header: string): string[];
16
+ /**
17
+ * Manages cache key groupings for targeted invalidation of related cache entries.
18
+ *
19
+ * @class
20
+ */
21
+ export declare class CacheGroupStore {
22
+ private readonly groups;
23
+ /**
24
+ * Associates a cache key with one or more named groups.
25
+ *
26
+ * @param {string} cacheKey - The cache key to associate.
27
+ * @param {string[]} groupNames - The groups to add the key to.
28
+ */
29
+ addToGroups(cacheKey: string, groupNames: string[]): void;
30
+ /**
31
+ * Removes a cache key from all groups.
32
+ *
33
+ * @param {string} cacheKey - The cache key to remove.
34
+ */
35
+ removeFromAll(cacheKey: string): void;
36
+ /**
37
+ * Returns the set of cache keys belonging to a specific group.
38
+ *
39
+ * @param {string} groupName - The group name.
40
+ * @returns {Set<string>} The cache keys in the group.
41
+ */
42
+ getGroupKeys(groupName: string): Set<string>;
43
+ /**
44
+ * Invalidates a single group, clearing its keys and recording the timestamp.
45
+ *
46
+ * @param {string} groupName - The group name to invalidate.
47
+ * @returns {string[]} The cache keys that were in the invalidated group.
48
+ */
49
+ invalidate(groupName: string): string[];
50
+ /**
51
+ * Invalidates all groups, clearing their keys and recording the timestamp.
52
+ *
53
+ * @returns {string[]} All unique cache keys that were invalidated.
54
+ */
55
+ invalidateAll(): string[];
56
+ /**
57
+ * Checks whether a cache key has been invalidated since a given timestamp.
58
+ *
59
+ * @param {string} cacheKey - The cache key to check.
60
+ * @param {number} storedAt - The timestamp when the entry was stored.
61
+ * @returns {boolean} `true` if the key was invalidated after `storedAt`.
62
+ */
63
+ isInvalidatedSince(cacheKey: string, storedAt: number): boolean;
64
+ /**
65
+ * Returns the number of tracked groups.
66
+ *
67
+ * @returns {number} The group count.
68
+ */
69
+ get size(): number;
70
+ /**
71
+ * Removes all groups and their key associations.
72
+ */
73
+ clear(): void;
74
+ }
75
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/cache/groups.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAMzD;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IAExD;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAWzD;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMrC;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAI5C;;;;;OAKG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAUvC;;;;OAIG;IACH,aAAa,IAAI,MAAM,EAAE;IAYzB;;;;;;OAMG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAS/D;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Parses a comma-separated Cache-Groups header into an array of group names.
3
+ *
4
+ * @param {string} header - The raw Cache-Groups header value.
5
+ * @returns {string[]} Parsed group names.
6
+ */
7
+ export function parseCacheGroups(header) {
8
+ if (!header)
9
+ return [];
10
+ return header
11
+ .split(",")
12
+ .map((s) => s.trim().replace(/"/g, ""))
13
+ .filter(Boolean);
14
+ }
15
+ /**
16
+ * Manages cache key groupings for targeted invalidation of related cache entries.
17
+ *
18
+ * @class
19
+ */
20
+ export class CacheGroupStore {
21
+ groups = new Map();
22
+ /**
23
+ * Associates a cache key with one or more named groups.
24
+ *
25
+ * @param {string} cacheKey - The cache key to associate.
26
+ * @param {string[]} groupNames - The groups to add the key to.
27
+ */
28
+ addToGroups(cacheKey, groupNames) {
29
+ for (const name of groupNames) {
30
+ let group = this.groups.get(name);
31
+ if (!group) {
32
+ group = { name, keys: new Set(), lastInvalidated: 0 };
33
+ this.groups.set(name, group);
34
+ }
35
+ group.keys.add(cacheKey);
36
+ }
37
+ }
38
+ /**
39
+ * Removes a cache key from all groups.
40
+ *
41
+ * @param {string} cacheKey - The cache key to remove.
42
+ */
43
+ removeFromAll(cacheKey) {
44
+ for (const group of this.groups.values()) {
45
+ group.keys.delete(cacheKey);
46
+ }
47
+ }
48
+ /**
49
+ * Returns the set of cache keys belonging to a specific group.
50
+ *
51
+ * @param {string} groupName - The group name.
52
+ * @returns {Set<string>} The cache keys in the group.
53
+ */
54
+ getGroupKeys(groupName) {
55
+ return this.groups.get(groupName)?.keys ?? new Set();
56
+ }
57
+ /**
58
+ * Invalidates a single group, clearing its keys and recording the timestamp.
59
+ *
60
+ * @param {string} groupName - The group name to invalidate.
61
+ * @returns {string[]} The cache keys that were in the invalidated group.
62
+ */
63
+ invalidate(groupName) {
64
+ const group = this.groups.get(groupName);
65
+ if (!group)
66
+ return [];
67
+ const keys = [...group.keys];
68
+ group.keys.clear();
69
+ group.lastInvalidated = Date.now();
70
+ return keys;
71
+ }
72
+ /**
73
+ * Invalidates all groups, clearing their keys and recording the timestamp.
74
+ *
75
+ * @returns {string[]} All unique cache keys that were invalidated.
76
+ */
77
+ invalidateAll() {
78
+ const allKeys = new Set();
79
+ for (const group of this.groups.values()) {
80
+ for (const key of group.keys) {
81
+ allKeys.add(key);
82
+ }
83
+ group.keys.clear();
84
+ group.lastInvalidated = Date.now();
85
+ }
86
+ return [...allKeys];
87
+ }
88
+ /**
89
+ * Checks whether a cache key has been invalidated since a given timestamp.
90
+ *
91
+ * @param {string} cacheKey - The cache key to check.
92
+ * @param {number} storedAt - The timestamp when the entry was stored.
93
+ * @returns {boolean} `true` if the key was invalidated after `storedAt`.
94
+ */
95
+ isInvalidatedSince(cacheKey, storedAt) {
96
+ for (const group of this.groups.values()) {
97
+ if (group.keys.has(cacheKey) && group.lastInvalidated > storedAt) {
98
+ return true;
99
+ }
100
+ }
101
+ return false;
102
+ }
103
+ /**
104
+ * Returns the number of tracked groups.
105
+ *
106
+ * @returns {number} The group count.
107
+ */
108
+ get size() {
109
+ return this.groups.size;
110
+ }
111
+ /**
112
+ * Removes all groups and their key associations.
113
+ */
114
+ clear() {
115
+ this.groups.clear();
116
+ }
117
+ }
118
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/cache/groups.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Parsed No-Vary-Search header directive (proposal spec).
3
+ */
4
+ export interface NoVarySearchDirective {
5
+ params: boolean | string[];
6
+ except: string[];
7
+ keyOrder: boolean;
8
+ }
9
+ /**
10
+ * Parses a No-Vary-Search header value into a structured directive.
11
+ *
12
+ * @param {string} header - The raw No-Vary-Search header value.
13
+ * @returns {NoVarySearchDirective|null} The parsed directive, or `null` if the header is empty.
14
+ */
15
+ export declare function parseNoVarySearch(header: string): NoVarySearchDirective | null;
16
+ /**
17
+ * Determines whether two URLs match according to a No-Vary-Search directive.
18
+ *
19
+ * @param {string} cachedUrl - The URL of the cached response.
20
+ * @param {string} requestUrl - The URL of the incoming request.
21
+ * @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
22
+ * @returns {boolean} `true` if the URLs are considered equivalent under the directive.
23
+ */
24
+ export declare function urlsMatchWithNoVarySearch(cachedUrl: string, requestUrl: string, directive: NoVarySearchDirective): boolean;
25
+ /**
26
+ * Normalizes a URL for cache key generation by applying No-Vary-Search filtering.
27
+ *
28
+ * @param {string} url - The URL to normalize.
29
+ * @param {NoVarySearchDirective} directive - The No-Vary-Search directive to apply.
30
+ * @returns {string} The normalized URL string.
31
+ */
32
+ export declare function normalizeUrlForCache(url: string, directive: NoVarySearchDirective): string;
33
+ //# sourceMappingURL=no-vary-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-vary-search.d.ts","sourceRoot":"","sources":["../../src/cache/no-vary-search.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CA4B9E;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAwB1H;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,MAAM,CAiB1F"}