recker 1.0.2-0 → 1.0.4

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 (287) hide show
  1. package/LICENSE +0 -2
  2. package/README.md +121 -72
  3. package/dist/cache/memory-storage.d.ts.map +1 -1
  4. package/dist/cache/memory-storage.js +7 -1
  5. package/dist/constants/http-status.d.ts +74 -0
  6. package/dist/constants/http-status.d.ts.map +1 -0
  7. package/dist/constants/http-status.js +156 -0
  8. package/dist/constants.d.ts.map +1 -1
  9. package/dist/constants.js +6 -6
  10. package/dist/cookies/memory-cookie-jar.d.ts +31 -0
  11. package/dist/cookies/memory-cookie-jar.d.ts.map +1 -0
  12. package/dist/cookies/memory-cookie-jar.js +210 -0
  13. package/dist/core/client.d.ts +9 -0
  14. package/dist/core/client.d.ts.map +1 -1
  15. package/dist/core/client.js +252 -53
  16. package/dist/core/errors.d.ts +18 -2
  17. package/dist/core/errors.d.ts.map +1 -1
  18. package/dist/core/errors.js +66 -5
  19. package/dist/core/index.d.ts +6 -0
  20. package/dist/core/index.d.ts.map +1 -0
  21. package/dist/core/index.js +5 -0
  22. package/dist/core/request-promise.d.ts.map +1 -1
  23. package/dist/core/request-promise.js +8 -2
  24. package/dist/core/request.d.ts +7 -1
  25. package/dist/core/request.d.ts.map +1 -1
  26. package/dist/core/request.js +32 -0
  27. package/dist/core/response.d.ts +2 -0
  28. package/dist/core/response.d.ts.map +1 -1
  29. package/dist/core/response.js +44 -19
  30. package/dist/events/request-events.d.ts +48 -0
  31. package/dist/events/request-events.d.ts.map +1 -0
  32. package/dist/events/request-events.js +85 -0
  33. package/dist/index.d.ts +28 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +28 -2
  36. package/dist/mcp/client.d.ts.map +1 -1
  37. package/dist/mcp/client.js +16 -5
  38. package/dist/mcp/contract.d.ts +77 -0
  39. package/dist/mcp/contract.d.ts.map +1 -0
  40. package/dist/mcp/contract.js +278 -0
  41. package/dist/mcp/types.d.ts +1 -0
  42. package/dist/mcp/types.d.ts.map +1 -1
  43. package/dist/plugins/auth.d.ts +45 -0
  44. package/dist/plugins/auth.d.ts.map +1 -0
  45. package/dist/plugins/auth.js +268 -0
  46. package/dist/plugins/cache.d.ts +7 -1
  47. package/dist/plugins/cache.d.ts.map +1 -1
  48. package/dist/plugins/cache.js +470 -49
  49. package/dist/plugins/circuit-breaker.js +1 -1
  50. package/dist/plugins/compression.d.ts.map +1 -1
  51. package/dist/plugins/compression.js +3 -3
  52. package/dist/plugins/dedup.d.ts.map +1 -1
  53. package/dist/plugins/dedup.js +2 -1
  54. package/dist/plugins/graphql.d.ts +4 -3
  55. package/dist/plugins/graphql.d.ts.map +1 -1
  56. package/dist/plugins/graphql.js +24 -5
  57. package/dist/plugins/grpc-web.d.ts +80 -0
  58. package/dist/plugins/grpc-web.d.ts.map +1 -0
  59. package/dist/plugins/grpc-web.js +261 -0
  60. package/dist/plugins/har-player.d.ts.map +1 -1
  61. package/dist/plugins/har-player.js +11 -2
  62. package/dist/plugins/hls.d.ts +33 -0
  63. package/dist/plugins/hls.d.ts.map +1 -0
  64. package/dist/plugins/hls.js +225 -0
  65. package/dist/plugins/http2-push.d.ts +64 -0
  66. package/dist/plugins/http2-push.d.ts.map +1 -0
  67. package/dist/plugins/http2-push.js +274 -0
  68. package/dist/plugins/http3.d.ts +76 -0
  69. package/dist/plugins/http3.d.ts.map +1 -0
  70. package/dist/plugins/http3.js +231 -0
  71. package/dist/plugins/interface-rotator.d.ts +10 -0
  72. package/dist/plugins/interface-rotator.d.ts.map +1 -0
  73. package/dist/plugins/interface-rotator.js +57 -0
  74. package/dist/plugins/jsonrpc.d.ts +76 -0
  75. package/dist/plugins/jsonrpc.d.ts.map +1 -0
  76. package/dist/plugins/jsonrpc.js +143 -0
  77. package/dist/plugins/logger.d.ts +8 -5
  78. package/dist/plugins/logger.d.ts.map +1 -1
  79. package/dist/plugins/logger.js +66 -30
  80. package/dist/plugins/odata.d.ts +182 -0
  81. package/dist/plugins/odata.d.ts.map +1 -0
  82. package/dist/plugins/odata.js +561 -0
  83. package/dist/plugins/retry.d.ts +1 -0
  84. package/dist/plugins/retry.d.ts.map +1 -1
  85. package/dist/plugins/retry.js +26 -2
  86. package/dist/plugins/scrape.d.ts +22 -0
  87. package/dist/plugins/scrape.d.ts.map +1 -0
  88. package/dist/plugins/scrape.js +87 -0
  89. package/dist/plugins/soap.d.ts +73 -0
  90. package/dist/plugins/soap.d.ts.map +1 -0
  91. package/dist/plugins/soap.js +347 -0
  92. package/dist/plugins/user-agent.d.ts +8 -0
  93. package/dist/plugins/user-agent.d.ts.map +1 -0
  94. package/dist/plugins/user-agent.js +46 -0
  95. package/dist/plugins/xml.d.ts +10 -0
  96. package/dist/plugins/xml.d.ts.map +1 -0
  97. package/dist/plugins/xml.js +194 -0
  98. package/dist/presets/anthropic.d.ts +7 -0
  99. package/dist/presets/anthropic.d.ts.map +1 -0
  100. package/dist/presets/anthropic.js +17 -0
  101. package/dist/presets/azure-openai.d.ts +9 -0
  102. package/dist/presets/azure-openai.d.ts.map +1 -0
  103. package/dist/presets/azure-openai.js +25 -0
  104. package/dist/presets/cloudflare.d.ts +13 -0
  105. package/dist/presets/cloudflare.d.ts.map +1 -0
  106. package/dist/presets/cloudflare.js +39 -0
  107. package/dist/presets/cohere.d.ts +6 -0
  108. package/dist/presets/cohere.d.ts.map +1 -0
  109. package/dist/presets/cohere.js +16 -0
  110. package/dist/presets/deepseek.d.ts +6 -0
  111. package/dist/presets/deepseek.d.ts.map +1 -0
  112. package/dist/presets/deepseek.js +16 -0
  113. package/dist/presets/digitalocean.d.ts +6 -0
  114. package/dist/presets/digitalocean.d.ts.map +1 -0
  115. package/dist/presets/digitalocean.js +16 -0
  116. package/dist/presets/discord.d.ts +7 -0
  117. package/dist/presets/discord.d.ts.map +1 -0
  118. package/dist/presets/discord.js +17 -0
  119. package/dist/presets/fireworks.d.ts +6 -0
  120. package/dist/presets/fireworks.d.ts.map +1 -0
  121. package/dist/presets/fireworks.js +16 -0
  122. package/dist/presets/gemini.d.ts +6 -0
  123. package/dist/presets/gemini.d.ts.map +1 -0
  124. package/dist/presets/gemini.js +16 -0
  125. package/dist/presets/github.d.ts +7 -0
  126. package/dist/presets/github.d.ts.map +1 -0
  127. package/dist/presets/github.js +17 -0
  128. package/dist/presets/gitlab.d.ts +7 -0
  129. package/dist/presets/gitlab.d.ts.map +1 -0
  130. package/dist/presets/gitlab.js +16 -0
  131. package/dist/presets/groq.d.ts +6 -0
  132. package/dist/presets/groq.d.ts.map +1 -0
  133. package/dist/presets/groq.js +16 -0
  134. package/dist/presets/huggingface.d.ts +6 -0
  135. package/dist/presets/huggingface.d.ts.map +1 -0
  136. package/dist/presets/huggingface.js +16 -0
  137. package/dist/presets/index.d.ts +28 -0
  138. package/dist/presets/index.d.ts.map +1 -0
  139. package/dist/presets/index.js +27 -0
  140. package/dist/presets/linear.d.ts +6 -0
  141. package/dist/presets/linear.d.ts.map +1 -0
  142. package/dist/presets/linear.js +16 -0
  143. package/dist/presets/mistral.d.ts +6 -0
  144. package/dist/presets/mistral.d.ts.map +1 -0
  145. package/dist/presets/mistral.js +16 -0
  146. package/dist/presets/notion.d.ts +7 -0
  147. package/dist/presets/notion.d.ts.map +1 -0
  148. package/dist/presets/notion.js +17 -0
  149. package/dist/presets/openai.d.ts +8 -0
  150. package/dist/presets/openai.d.ts.map +1 -0
  151. package/dist/presets/openai.js +23 -0
  152. package/dist/presets/perplexity.d.ts +6 -0
  153. package/dist/presets/perplexity.d.ts.map +1 -0
  154. package/dist/presets/perplexity.js +16 -0
  155. package/dist/presets/registry.d.ts +20 -0
  156. package/dist/presets/registry.d.ts.map +1 -0
  157. package/dist/presets/registry.js +311 -0
  158. package/dist/presets/replicate.d.ts +6 -0
  159. package/dist/presets/replicate.d.ts.map +1 -0
  160. package/dist/presets/replicate.js +16 -0
  161. package/dist/presets/slack.d.ts +6 -0
  162. package/dist/presets/slack.d.ts.map +1 -0
  163. package/dist/presets/slack.js +16 -0
  164. package/dist/presets/stripe.d.ts +8 -0
  165. package/dist/presets/stripe.d.ts.map +1 -0
  166. package/dist/presets/stripe.js +23 -0
  167. package/dist/presets/supabase.d.ts +7 -0
  168. package/dist/presets/supabase.d.ts.map +1 -0
  169. package/dist/presets/supabase.js +18 -0
  170. package/dist/presets/together.d.ts +6 -0
  171. package/dist/presets/together.d.ts.map +1 -0
  172. package/dist/presets/together.js +16 -0
  173. package/dist/presets/twilio.d.ts +7 -0
  174. package/dist/presets/twilio.d.ts.map +1 -0
  175. package/dist/presets/twilio.js +17 -0
  176. package/dist/presets/vercel.d.ts +7 -0
  177. package/dist/presets/vercel.d.ts.map +1 -0
  178. package/dist/presets/vercel.js +23 -0
  179. package/dist/presets/xai.d.ts +7 -0
  180. package/dist/presets/xai.d.ts.map +1 -0
  181. package/dist/presets/xai.js +17 -0
  182. package/dist/protocols/ftp.d.ts +63 -0
  183. package/dist/protocols/ftp.d.ts.map +1 -0
  184. package/dist/protocols/ftp.js +388 -0
  185. package/dist/protocols/index.d.ts +4 -0
  186. package/dist/protocols/index.d.ts.map +1 -0
  187. package/dist/protocols/index.js +3 -0
  188. package/dist/protocols/sftp.d.ts +65 -0
  189. package/dist/protocols/sftp.d.ts.map +1 -0
  190. package/dist/protocols/sftp.js +346 -0
  191. package/dist/protocols/telnet.d.ts +50 -0
  192. package/dist/protocols/telnet.d.ts.map +1 -0
  193. package/dist/protocols/telnet.js +139 -0
  194. package/dist/runner/request-runner.d.ts.map +1 -1
  195. package/dist/runner/request-runner.js +1 -0
  196. package/dist/scrape/document.d.ts +44 -0
  197. package/dist/scrape/document.d.ts.map +1 -0
  198. package/dist/scrape/document.js +198 -0
  199. package/dist/scrape/element.d.ts +50 -0
  200. package/dist/scrape/element.d.ts.map +1 -0
  201. package/dist/scrape/element.js +176 -0
  202. package/dist/scrape/extractors.d.ts +17 -0
  203. package/dist/scrape/extractors.d.ts.map +1 -0
  204. package/dist/scrape/extractors.js +356 -0
  205. package/dist/scrape/index.d.ts +5 -0
  206. package/dist/scrape/index.d.ts.map +1 -0
  207. package/dist/scrape/index.js +3 -0
  208. package/dist/scrape/types.d.ts +108 -0
  209. package/dist/scrape/types.d.ts.map +1 -0
  210. package/dist/scrape/types.js +1 -0
  211. package/dist/testing/index.d.ts +3 -0
  212. package/dist/testing/index.d.ts.map +1 -0
  213. package/dist/testing/index.js +1 -0
  214. package/dist/testing/mock.d.ts +58 -0
  215. package/dist/testing/mock.d.ts.map +1 -0
  216. package/dist/testing/mock.js +252 -0
  217. package/dist/transport/fetch.d.ts.map +1 -1
  218. package/dist/transport/fetch.js +12 -4
  219. package/dist/transport/undici.d.ts +17 -1
  220. package/dist/transport/undici.d.ts.map +1 -1
  221. package/dist/transport/undici.js +708 -47
  222. package/dist/types/index.d.ts +111 -10
  223. package/dist/types/index.d.ts.map +1 -1
  224. package/dist/types/index.js +1 -1
  225. package/dist/types/logger.d.ts +17 -0
  226. package/dist/types/logger.d.ts.map +1 -0
  227. package/dist/types/logger.js +66 -0
  228. package/dist/utils/agent-manager.d.ts.map +1 -1
  229. package/dist/utils/agent-manager.js +20 -4
  230. package/dist/utils/body.d.ts.map +1 -1
  231. package/dist/utils/body.js +14 -2
  232. package/dist/utils/charset.d.ts +16 -0
  233. package/dist/utils/charset.d.ts.map +1 -0
  234. package/dist/utils/charset.js +169 -0
  235. package/dist/utils/client-pool.d.ts +21 -0
  236. package/dist/utils/client-pool.d.ts.map +1 -0
  237. package/dist/utils/client-pool.js +49 -0
  238. package/dist/utils/concurrency.d.ts.map +1 -1
  239. package/dist/utils/concurrency.js +8 -4
  240. package/dist/utils/dns-toolkit.d.ts +13 -0
  241. package/dist/utils/dns-toolkit.d.ts.map +1 -0
  242. package/dist/utils/dns-toolkit.js +48 -0
  243. package/dist/utils/doh.d.ts.map +1 -1
  244. package/dist/utils/doh.js +16 -3
  245. package/dist/utils/download.d.ts +15 -0
  246. package/dist/utils/download.d.ts.map +1 -0
  247. package/dist/utils/download.js +44 -0
  248. package/dist/utils/env-proxy.d.ts +13 -0
  249. package/dist/utils/env-proxy.d.ts.map +1 -0
  250. package/dist/utils/env-proxy.js +105 -0
  251. package/dist/utils/header-parser.d.ts +15 -1
  252. package/dist/utils/header-parser.d.ts.map +1 -1
  253. package/dist/utils/header-parser.js +161 -1
  254. package/dist/utils/link-header.d.ts +70 -0
  255. package/dist/utils/link-header.d.ts.map +1 -0
  256. package/dist/utils/link-header.js +190 -0
  257. package/dist/utils/progress.d.ts +7 -2
  258. package/dist/utils/progress.d.ts.map +1 -1
  259. package/dist/utils/progress.js +48 -15
  260. package/dist/utils/rdap.d.ts +17 -0
  261. package/dist/utils/rdap.d.ts.map +1 -0
  262. package/dist/utils/rdap.js +32 -0
  263. package/dist/utils/request-pool.d.ts.map +1 -1
  264. package/dist/utils/request-pool.js +4 -3
  265. package/dist/utils/sse.d.ts.map +1 -1
  266. package/dist/utils/sse.js +8 -2
  267. package/dist/utils/status-codes.d.ts +84 -0
  268. package/dist/utils/status-codes.d.ts.map +1 -0
  269. package/dist/utils/status-codes.js +204 -0
  270. package/dist/utils/streaming.d.ts.map +1 -1
  271. package/dist/utils/streaming.js +1 -0
  272. package/dist/utils/tls-inspector.d.ts +21 -0
  273. package/dist/utils/tls-inspector.d.ts.map +1 -0
  274. package/dist/utils/tls-inspector.js +39 -0
  275. package/dist/utils/try-fn.d.ts.map +1 -1
  276. package/dist/utils/try-fn.js +11 -5
  277. package/dist/utils/upload.d.ts +1 -0
  278. package/dist/utils/upload.d.ts.map +1 -1
  279. package/dist/utils/upload.js +20 -3
  280. package/dist/utils/user-agent.d.ts +9 -9
  281. package/dist/utils/user-agent.js +9 -9
  282. package/dist/utils/whois.d.ts.map +1 -1
  283. package/dist/utils/whois.js +11 -2
  284. package/dist/websocket/client.d.ts +29 -1
  285. package/dist/websocket/client.d.ts.map +1 -1
  286. package/dist/websocket/client.js +145 -13
  287. package/package.json +45 -8
package/LICENSE CHANGED
@@ -1,7 +1,5 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Forattini Development
4
-
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
7
5
  in the Software without restriction, including without limitation the rights
package/README.md CHANGED
@@ -1,109 +1,158 @@
1
1
  # Recker
2
2
 
3
3
  <div align="center">
4
- <h1>The HTTP Client for the AI Era</h1>
5
-
6
- <p>
7
- Build resilient, type-safe, and high-performance integrations with the
8
- <strong>Smart SDK Builder</strong> designed for modern backend ecosystems.
9
- </p>
10
-
11
- <p>
12
- <a href="https://www.npmjs.com/package/recker">
13
- <img src="https://img.shields.io/npm/v/recker.svg?style=flat-square&color=F5A623" alt="npm version" />
14
- </a>
15
- <a href="https://github.com/your-org/recker/blob/main/LICENSE">
16
- <img src="https://img.shields.io/npm/l/recker.svg?style=flat-square&color=007AFF" alt="license" />
17
- </a>
18
- <img src="https://img.shields.io/badge/coverage-100%25-34C759?style=flat-square" alt="coverage" />
19
- <img src="https://img.shields.io/badge/types-included-34C759?style=flat-square" alt="types" />
20
- </p>
21
-
22
- <br />
23
- </div>
24
4
 
25
- ---
5
+ <img src="docs/assets/logo.svg" alt="Recker Logo" width="200" />
26
6
 
27
- **Recker** is not just another `fetch` wrapper. It combines the ergonomics of `ky` with the resilience of `got` and the raw performance of `undici` into a unified **DevX Powerhouse**.
7
+ ### The HTTP SDK for the AI Era
28
8
 
29
- ## Why Recker?
9
+ **Stop fetching. Start orchestrating.**
30
10
 
31
- | Feature | Description |
32
- | :--- | :--- |
33
- | **🛡️ Contract-First** | Define Zod schemas and get a fully typed SDK. No more `any`. |
34
- | **🚦 Task Pool** | Global Rate Limiting & Concurrency Control (Semaphore/Token Bucket). |
35
- | **👁️ Visual Debug** | Beautiful "Matrix-style" logs and cURL export. |
36
- | **🤖 AI Ready** | First-class Server-Sent Events (SSE) support for LLM streaming. |
37
- | **🔌 Plug & Play** | Circuit Breaker, Deduplication, Caching (SWR), and Retry built-in. |
38
- | **🌐 Universal** | Works in Node.js (Undici) and Edge/Browsers (Fetch). |
11
+ [![npm version](https://img.shields.io/npm/v/recker.svg?style=flat-square&color=F5A623)](https://www.npmjs.com/package/recker)
12
+ [![npm downloads](https://img.shields.io/npm/dm/recker.svg?style=flat-square&color=34C759)](https://www.npmjs.com/package/recker)
13
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
14
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
15
+ [![Coverage](https://img.shields.io/badge/coverage-78%25-F5A623?style=flat-square)](https://github.com/forattini-dev/recker)
16
+ [![License](https://img.shields.io/npm/l/recker.svg?style=flat-square&color=007AFF)](https://github.com/forattini-dev/recker/blob/main/LICENSE)
17
+
18
+ [Documentation](https://forattini-dev.github.io/recker) · [Examples](./docs/examples/README.md) · [Migration](./docs/migration.md)
19
+
20
+ </div>
39
21
 
40
- ## 📦 Installation
22
+ ---
23
+
24
+ ## 📦 Install
41
25
 
42
26
  ```bash
43
- npm install recker undici zod
27
+ npm install recker
44
28
  ```
45
29
 
46
30
  ## 🚀 Quick Start
47
31
 
48
- ### 1. The "Classic" Way
49
- Simple and intuitive API with better defaults and full type safety.
50
-
51
32
  ```typescript
52
33
  import { createClient } from 'recker';
53
34
 
54
- const client = createClient({
55
- baseUrl: 'https://jsonplaceholder.typicode.com'
56
- });
35
+ const client = createClient({ baseUrl: 'https://api.example.com' });
36
+
37
+ // GET with JSON
38
+ const users = await client.get('/users').json();
57
39
 
58
- // Auto-parse JSON, Typed response
59
- const todo = await client.get<{ title: string }>('/todos/1').json();
60
- console.log(todo.title);
40
+ // POST with body
41
+ await client.post('/users', { json: { name: 'John' } });
42
+
43
+ // Path params + query
44
+ await client.get('/users/:id', { params: { id: '123', expand: 'profile' } });
61
45
  ```
62
46
 
63
- ### 2. The "Pro" Way (Contract-First)
64
- Stop guessing URLs. Define your API contract.
47
+ ## Why Recker?
65
48
 
66
- ```typescript
67
- import { z } from 'zod';
68
- import { createContract } from 'recker';
69
-
70
- const api = createContract(client, {
71
- getUser: {
72
- method: 'GET',
73
- path: '/users/:id',
74
- params: z.object({ id: z.string() }),
75
- response: z.object({ name: z.string() })
76
- }
77
- });
49
+ Recker isn't just another HTTP client. It's a **complete orchestration layer** designed for modern, data-intensive applications.
50
+
51
+ | Feature | Description |
52
+ |:---|:---|
53
+ | 🔮 **19 HTTP Methods** | Beyond CRUD: WebDAV, CDN Purging, and specialized verbs. |
54
+ | 🤖 **AI-First** | Native Server-Sent Events (SSE) parsing optimized for LLMs. |
55
+ | 🕷️ **Scraping Ready** | jQuery-like HTML parsing, HLS downloading, and proxy rotation. |
56
+ | 🛡️ **Security Suite** | Built-in SSL inspection, WHOIS/RDAP, and DNS analysis. |
57
+ | **Performance** | Connection pooling, deduplication, and deep network metrics. |
58
+ | 🛡️ **Resilience** | Circuit breakers, smart retries, and rate limit awareness. |
59
+
60
+ ## 💡 Feature Highlights
78
61
 
79
- // Fully typed! Typescript errors if you forget 'params.id'
80
- const user = await api.getUser({ params: { id: '1' } });
62
+ ### Stream AI Responses
63
+ Handle LLM streams effortlessly with the `.sse()` iterator.
64
+
65
+ ```typescript
66
+ for await (const event of client.post('/v1/chat/completions', {
67
+ json: { model: 'gpt-5', messages, stream: true }
68
+ }).sse()) {
69
+ process.stdout.write(event.data);
70
+ }
81
71
  ```
82
72
 
83
- ### 3. The "Resilient" Way
84
- Protect your downstream services with Circuit Breakers and Rate Limiting.
73
+ ### Scrape & Extract
74
+ Turn any webpage into structured data with the `.scrape()` method.
85
75
 
86
76
  ```typescript
87
- import { circuitBreaker, rateLimit } from 'recker';
77
+ const doc = await client.scrape('https://example.com');
78
+ const titles = doc.selectAll('h1').map(el => el.text());
79
+ ```
88
80
 
89
- const resilientClient = createClient({
90
- // Never send more than 10 requests/sec
91
- rateLimit: { requestsPerInterval: 10, interval: 1000 },
81
+ ### Reliability Built-in
82
+ Configure advanced retry policies in declarative style.
83
+
84
+ ```typescript
85
+ const client = createClient({
92
86
  plugins: [
93
- // Stop calling if 50% of requests fail
94
- circuitBreaker({ threshold: 5 })
87
+ retry({ maxAttempts: 3, backoff: 'exponential', jitter: true })
95
88
  ]
96
89
  });
97
90
  ```
98
91
 
92
+ ### Deep Observability
93
+ Know exactly where your latency comes from.
94
+
95
+ ```typescript
96
+ const { timings } = await client.get('/api/data');
97
+ console.log(timings);
98
+ // { dns: 12ms, tcp: 8ms, tls: 45ms, firstByte: 23ms, total: 156ms }
99
+ ```
100
+
99
101
  ## 📚 Documentation
100
102
 
101
- Read the full documentation at [recker.js.org](https://recker.js.org) (mock link).
103
+ **Getting Started**
104
+ - [Installation](./docs/getting-started/installation.md)
105
+ - [Quick Start](./docs/getting-started/quickstart.md)
106
+ - [Client Configuration](./docs/guides/client-config.md)
107
+
108
+ **Core Features**
109
+ - [HTTP Methods (19)](./docs/guides/http-methods.md)
110
+ - [Streaming & SSE](./docs/guides/streaming.md)
111
+ - [Retry & Backoff](./docs/guides/advanced/retry.md)
112
+ - [Caching](./docs/guides/caching.md)
113
+ - [Pagination](./docs/guides/pagination.md)
114
+
115
+ **Integrations**
116
+ - [GraphQL](./docs/guides/graphql.md)
117
+ - [Scraping](./docs/guides/scraping.md)
118
+ - [Hooks](./docs/guides/hooks.md)
119
+
120
+ **Reference**
121
+ - [API Reference](./docs/api/README.md)
122
+ - [Troubleshooting](./docs/guides/troubleshooting.md)
123
+ - [Examples](./docs/examples/README.md)
124
+
125
+ ## ❤️ Acknowledgements
126
+
127
+ At Recker, we are passionate about these incredible open-source technologies. We are here to celebrate the past achievements that shaped the internet as we know it today, and to prepare ourselves for the future of web development.
128
+
129
+ Recker stands on the shoulders of giants. We extend our deepest gratitude to these projects:
130
+
131
+ <div align="center">
132
+
133
+ | | | |
134
+ |:---|:---|:---|
135
+ | **[Apollo Client](https://github.com/apollographql/apollo-client)** | **[Axios](https://github.com/axios/axios)** | **[Cheerio](https://github.com/cheeriojs/cheerio)** |
136
+ | **[Cookie](https://github.com/jshttp/cookie)** | **[Got](https://github.com/sindresorhus/got)** | **[GraphQL.js](https://github.com/graphql/graphql-js)** |
137
+ | **[Ky](https://github.com/sindresorhus/ky)** | **[Needle](https://github.com/tomas/needle)** | **[Node-libcurl](https://github.com/JCMais/node-libcurl)** |
138
+ | **[SuperAgent](https://github.com/ladjs/superagent)** | **[Undici](https://github.com/nodejs/undici)** | **[WS](https://github.com/websockets/ws)** |
139
+
140
+ </div>
141
+
142
+ ## 🤝 Contributing
143
+
144
+ We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
145
+
146
+ ## 📄 License
147
+
148
+ MIT © [Forattini](https://github.com/forattini-dev)
149
+
150
+ ---
151
+
152
+ <div align="center">
102
153
 
103
- - [Client Configuration](/docs/guides/client-config.md)
104
- - [Concurrency Guide](/docs/guides/concurrency.md)
105
- - [Streaming & SSE](/docs/guides/streaming.md)
154
+ **Built for the AI era.**
106
155
 
107
- ## License
156
+ [Documentation](https://forattini-dev.github.io/recker) · [GitHub](https://github.com/forattini-dev/recker) · [npm](https://www.npmjs.com/package/recker)
108
157
 
109
- MIT
158
+ </div>
@@ -1 +1 @@
1
- {"version":3,"file":"memory-storage.d.ts","sourceRoot":"","sources":["../../src/cache/memory-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE7D,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,IAAI,CAA6B;IAEnC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAajD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC,KAAK;CAIN"}
1
+ {"version":3,"file":"memory-storage.d.ts","sourceRoot":"","sources":["../../src/cache/memory-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE7D,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,IAAI,CAA6B;IAEnC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAmBjD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC,KAAK;CAIN"}
@@ -2,17 +2,23 @@ export class MemoryStorage {
2
2
  storage = new Map();
3
3
  ttls = new Map();
4
4
  async get(key) {
5
+ console.log(`[DEBUG MemoryStorage] Getting key: ${key}`);
5
6
  const entry = this.storage.get(key);
6
- if (!entry)
7
+ if (!entry) {
8
+ console.log(`[DEBUG MemoryStorage] Key not found: ${key}`);
7
9
  return undefined;
10
+ }
8
11
  const expiry = this.ttls.get(key);
9
12
  if (expiry && Date.now() > expiry) {
13
+ console.log(`[DEBUG MemoryStorage] Key expired: ${key} (expiry: ${expiry}, now: ${Date.now()})`);
10
14
  this.delete(key);
11
15
  return undefined;
12
16
  }
17
+ console.log(`[DEBUG MemoryStorage] Key found: ${key}`);
13
18
  return entry;
14
19
  }
15
20
  async set(key, entry, ttl) {
21
+ console.log(`[DEBUG MemoryStorage] Setting key: ${key}, ttl: ${ttl}`);
16
22
  this.storage.set(key, entry);
17
23
  if (ttl) {
18
24
  this.ttls.set(key, Date.now() + ttl);
@@ -0,0 +1,74 @@
1
+ export declare const HttpStatus: {
2
+ readonly CONTINUE: 100;
3
+ readonly SWITCHING_PROTOCOLS: 101;
4
+ readonly PROCESSING: 102;
5
+ readonly EARLY_HINTS: 103;
6
+ readonly OK: 200;
7
+ readonly CREATED: 201;
8
+ readonly ACCEPTED: 202;
9
+ readonly NON_AUTHORITATIVE_INFORMATION: 203;
10
+ readonly NO_CONTENT: 204;
11
+ readonly RESET_CONTENT: 205;
12
+ readonly PARTIAL_CONTENT: 206;
13
+ readonly MULTI_STATUS: 207;
14
+ readonly ALREADY_REPORTED: 208;
15
+ readonly IM_USED: 226;
16
+ readonly MULTIPLE_CHOICES: 300;
17
+ readonly MOVED_PERMANENTLY: 301;
18
+ readonly FOUND: 302;
19
+ readonly SEE_OTHER: 303;
20
+ readonly NOT_MODIFIED: 304;
21
+ readonly USE_PROXY: 305;
22
+ readonly TEMPORARY_REDIRECT: 307;
23
+ readonly PERMANENT_REDIRECT: 308;
24
+ readonly BAD_REQUEST: 400;
25
+ readonly UNAUTHORIZED: 401;
26
+ readonly PAYMENT_REQUIRED: 402;
27
+ readonly FORBIDDEN: 403;
28
+ readonly NOT_FOUND: 404;
29
+ readonly METHOD_NOT_ALLOWED: 405;
30
+ readonly NOT_ACCEPTABLE: 406;
31
+ readonly PROXY_AUTHENTICATION_REQUIRED: 407;
32
+ readonly REQUEST_TIMEOUT: 408;
33
+ readonly CONFLICT: 409;
34
+ readonly GONE: 410;
35
+ readonly LENGTH_REQUIRED: 411;
36
+ readonly PRECONDITION_FAILED: 412;
37
+ readonly PAYLOAD_TOO_LARGE: 413;
38
+ readonly URI_TOO_LONG: 414;
39
+ readonly UNSUPPORTED_MEDIA_TYPE: 415;
40
+ readonly RANGE_NOT_SATISFIABLE: 416;
41
+ readonly EXPECTATION_FAILED: 417;
42
+ readonly IM_A_TEAPOT: 418;
43
+ readonly MISDIRECTED_REQUEST: 421;
44
+ readonly UNPROCESSABLE_ENTITY: 422;
45
+ readonly LOCKED: 423;
46
+ readonly FAILED_DEPENDENCY: 424;
47
+ readonly TOO_EARLY: 425;
48
+ readonly UPGRADE_REQUIRED: 426;
49
+ readonly PRECONDITION_REQUIRED: 428;
50
+ readonly TOO_MANY_REQUESTS: 429;
51
+ readonly REQUEST_HEADER_FIELDS_TOO_LARGE: 431;
52
+ readonly UNAVAILABLE_FOR_LEGAL_REASONS: 451;
53
+ readonly INTERNAL_SERVER_ERROR: 500;
54
+ readonly NOT_IMPLEMENTED: 501;
55
+ readonly BAD_GATEWAY: 502;
56
+ readonly SERVICE_UNAVAILABLE: 503;
57
+ readonly GATEWAY_TIMEOUT: 504;
58
+ readonly HTTP_VERSION_NOT_SUPPORTED: 505;
59
+ readonly VARIANT_ALSO_NEGOTIATES: 506;
60
+ readonly INSUFFICIENT_STORAGE: 507;
61
+ readonly LOOP_DETECTED: 508;
62
+ readonly NOT_EXTENDED: 510;
63
+ readonly NETWORK_AUTHENTICATION_REQUIRED: 511;
64
+ };
65
+ export type HttpStatusCode = (typeof HttpStatus)[keyof typeof HttpStatus];
66
+ export declare const HttpStatusText: Record<HttpStatusCode, string>;
67
+ export declare function isSuccess(status: number): boolean;
68
+ export declare function isRedirect(status: number): boolean;
69
+ export declare function isClientError(status: number): boolean;
70
+ export declare function isServerError(status: number): boolean;
71
+ export declare function isError(status: number): boolean;
72
+ export declare function isRetryable(status: number): boolean;
73
+ export declare function getStatusText(status: number): string;
74
+ //# sourceMappingURL=http-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-status.d.ts","sourceRoot":"","sources":["../../src/constants/http-status.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEb,CAAC;AAKX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAK1E,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAwEzD,CAAC;AAKF,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjD;AAKD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD;AAKD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAKD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAKD,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/C;AAKD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CASnD;AAKD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,156 @@
1
+ export const HttpStatus = {
2
+ CONTINUE: 100,
3
+ SWITCHING_PROTOCOLS: 101,
4
+ PROCESSING: 102,
5
+ EARLY_HINTS: 103,
6
+ OK: 200,
7
+ CREATED: 201,
8
+ ACCEPTED: 202,
9
+ NON_AUTHORITATIVE_INFORMATION: 203,
10
+ NO_CONTENT: 204,
11
+ RESET_CONTENT: 205,
12
+ PARTIAL_CONTENT: 206,
13
+ MULTI_STATUS: 207,
14
+ ALREADY_REPORTED: 208,
15
+ IM_USED: 226,
16
+ MULTIPLE_CHOICES: 300,
17
+ MOVED_PERMANENTLY: 301,
18
+ FOUND: 302,
19
+ SEE_OTHER: 303,
20
+ NOT_MODIFIED: 304,
21
+ USE_PROXY: 305,
22
+ TEMPORARY_REDIRECT: 307,
23
+ PERMANENT_REDIRECT: 308,
24
+ BAD_REQUEST: 400,
25
+ UNAUTHORIZED: 401,
26
+ PAYMENT_REQUIRED: 402,
27
+ FORBIDDEN: 403,
28
+ NOT_FOUND: 404,
29
+ METHOD_NOT_ALLOWED: 405,
30
+ NOT_ACCEPTABLE: 406,
31
+ PROXY_AUTHENTICATION_REQUIRED: 407,
32
+ REQUEST_TIMEOUT: 408,
33
+ CONFLICT: 409,
34
+ GONE: 410,
35
+ LENGTH_REQUIRED: 411,
36
+ PRECONDITION_FAILED: 412,
37
+ PAYLOAD_TOO_LARGE: 413,
38
+ URI_TOO_LONG: 414,
39
+ UNSUPPORTED_MEDIA_TYPE: 415,
40
+ RANGE_NOT_SATISFIABLE: 416,
41
+ EXPECTATION_FAILED: 417,
42
+ IM_A_TEAPOT: 418,
43
+ MISDIRECTED_REQUEST: 421,
44
+ UNPROCESSABLE_ENTITY: 422,
45
+ LOCKED: 423,
46
+ FAILED_DEPENDENCY: 424,
47
+ TOO_EARLY: 425,
48
+ UPGRADE_REQUIRED: 426,
49
+ PRECONDITION_REQUIRED: 428,
50
+ TOO_MANY_REQUESTS: 429,
51
+ REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
52
+ UNAVAILABLE_FOR_LEGAL_REASONS: 451,
53
+ INTERNAL_SERVER_ERROR: 500,
54
+ NOT_IMPLEMENTED: 501,
55
+ BAD_GATEWAY: 502,
56
+ SERVICE_UNAVAILABLE: 503,
57
+ GATEWAY_TIMEOUT: 504,
58
+ HTTP_VERSION_NOT_SUPPORTED: 505,
59
+ VARIANT_ALSO_NEGOTIATES: 506,
60
+ INSUFFICIENT_STORAGE: 507,
61
+ LOOP_DETECTED: 508,
62
+ NOT_EXTENDED: 510,
63
+ NETWORK_AUTHENTICATION_REQUIRED: 511,
64
+ };
65
+ export const HttpStatusText = {
66
+ 100: 'Continue',
67
+ 101: 'Switching Protocols',
68
+ 102: 'Processing',
69
+ 103: 'Early Hints',
70
+ 200: 'OK',
71
+ 201: 'Created',
72
+ 202: 'Accepted',
73
+ 203: 'Non-Authoritative Information',
74
+ 204: 'No Content',
75
+ 205: 'Reset Content',
76
+ 206: 'Partial Content',
77
+ 207: 'Multi-Status',
78
+ 208: 'Already Reported',
79
+ 226: 'IM Used',
80
+ 300: 'Multiple Choices',
81
+ 301: 'Moved Permanently',
82
+ 302: 'Found',
83
+ 303: 'See Other',
84
+ 304: 'Not Modified',
85
+ 305: 'Use Proxy',
86
+ 307: 'Temporary Redirect',
87
+ 308: 'Permanent Redirect',
88
+ 400: 'Bad Request',
89
+ 401: 'Unauthorized',
90
+ 402: 'Payment Required',
91
+ 403: 'Forbidden',
92
+ 404: 'Not Found',
93
+ 405: 'Method Not Allowed',
94
+ 406: 'Not Acceptable',
95
+ 407: 'Proxy Authentication Required',
96
+ 408: 'Request Timeout',
97
+ 409: 'Conflict',
98
+ 410: 'Gone',
99
+ 411: 'Length Required',
100
+ 412: 'Precondition Failed',
101
+ 413: 'Payload Too Large',
102
+ 414: 'URI Too Long',
103
+ 415: 'Unsupported Media Type',
104
+ 416: 'Range Not Satisfiable',
105
+ 417: 'Expectation Failed',
106
+ 418: "I'm a Teapot",
107
+ 421: 'Misdirected Request',
108
+ 422: 'Unprocessable Entity',
109
+ 423: 'Locked',
110
+ 424: 'Failed Dependency',
111
+ 425: 'Too Early',
112
+ 426: 'Upgrade Required',
113
+ 428: 'Precondition Required',
114
+ 429: 'Too Many Requests',
115
+ 431: 'Request Header Fields Too Large',
116
+ 451: 'Unavailable For Legal Reasons',
117
+ 500: 'Internal Server Error',
118
+ 501: 'Not Implemented',
119
+ 502: 'Bad Gateway',
120
+ 503: 'Service Unavailable',
121
+ 504: 'Gateway Timeout',
122
+ 505: 'HTTP Version Not Supported',
123
+ 506: 'Variant Also Negotiates',
124
+ 507: 'Insufficient Storage',
125
+ 508: 'Loop Detected',
126
+ 510: 'Not Extended',
127
+ 511: 'Network Authentication Required',
128
+ };
129
+ export function isSuccess(status) {
130
+ return status >= 200 && status < 300;
131
+ }
132
+ export function isRedirect(status) {
133
+ return status >= 300 && status < 400;
134
+ }
135
+ export function isClientError(status) {
136
+ return status >= 400 && status < 500;
137
+ }
138
+ export function isServerError(status) {
139
+ return status >= 500 && status < 600;
140
+ }
141
+ export function isError(status) {
142
+ return status >= 400;
143
+ }
144
+ export function isRetryable(status) {
145
+ const retryableCodes = [
146
+ HttpStatus.TOO_MANY_REQUESTS,
147
+ HttpStatus.INTERNAL_SERVER_ERROR,
148
+ HttpStatus.BAD_GATEWAY,
149
+ HttpStatus.SERVICE_UNAVAILABLE,
150
+ HttpStatus.GATEWAY_TIMEOUT,
151
+ ];
152
+ return retryableCodes.includes(status);
153
+ }
154
+ export function getStatusText(status) {
155
+ return HttpStatusText[status] || 'Unknown Status';
156
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAG9C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAGjD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,eAAO,MAAM,oBAAoB,SAAU,CAAC;AAG5C,eAAO,MAAM,oCAAoC,MAAM,CAAC;AACxD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAG1C,eAAO,MAAM,mCAAmC,OAAO,CAAC;AACxD,eAAO,MAAM,6BAA6B,EAAG,MAAe,CAAC;AAG7D,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAC1C,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAG3C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,wBAAwB,QAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAChD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAG9C,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAChD,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAGhD,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAC1C,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAG3C,eAAO,MAAM,oCAAoC,MAAM,CAAC;AACxD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAG1C,eAAO,MAAM,mCAAmC,OAAO,CAAC;AACxD,eAAO,MAAM,6BAA6B,EAAG,MAAe,CAAC;AAG7D,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAC1C,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAG3C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,wBAAwB,QAAQ,CAAC"}
package/dist/constants.js CHANGED
@@ -1,12 +1,12 @@
1
- export const DEFAULT_MAX_RETRY_DELAY_MS = 30_000;
1
+ export const DEFAULT_MAX_RETRY_DELAY_MS = 30000;
2
2
  export const DEFAULT_RETRY_ATTEMPTS = 3;
3
3
  export const DEFAULT_BASE_DELAY_MS = 100;
4
4
  export const PROGRESS_THROTTLE_INTERVAL_MS = 100;
5
5
  export const PROGRESS_UPDATES_PER_SECOND = 10;
6
- export const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
7
- export const DEFAULT_CONNECT_TIMEOUT_MS = 10_000;
8
- export const DEFAULT_CACHE_TTL_MS = 60_000;
9
- export const DEFAULT_STALE_TTL_MS = 300_000;
6
+ export const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
7
+ export const DEFAULT_CONNECT_TIMEOUT_MS = 10000;
8
+ export const DEFAULT_CACHE_TTL_MS = 60000;
9
+ export const DEFAULT_STALE_TTL_MS = 300000;
10
10
  export const DEFAULT_HTTP2_MAX_CONCURRENT_STREAMS = 100;
11
11
  export const DEFAULT_HTTP1_PIPELINING = 1;
12
12
  export const DEFAULT_COMPRESSION_THRESHOLD_BYTES = 1024;
@@ -15,4 +15,4 @@ export const DEFAULT_MAX_PAGES = Infinity;
15
15
  export const DEFAULT_PAGE_PARAM = 'page';
16
16
  export const DEFAULT_LIMIT_PARAM = 'limit';
17
17
  export const DEFAULT_FAILURE_THRESHOLD = 5;
18
- export const DEFAULT_RESET_TIMEOUT_MS = 60_000;
18
+ export const DEFAULT_RESET_TIMEOUT_MS = 60000;
@@ -0,0 +1,31 @@
1
+ import type { CookieJar } from '../types/index.js';
2
+ interface ParsedCookie {
3
+ name: string;
4
+ value: string;
5
+ domain: string;
6
+ path: string;
7
+ expires?: Date;
8
+ maxAge?: number;
9
+ secure: boolean;
10
+ httpOnly: boolean;
11
+ sameSite?: 'Strict' | 'Lax' | 'None';
12
+ partitioned?: boolean;
13
+ priority?: 'Low' | 'Medium' | 'High';
14
+ createdAt: number;
15
+ }
16
+ export declare class MemoryCookieJar implements CookieJar {
17
+ private cookies;
18
+ getCookieString(url: string): string;
19
+ setCookie(rawCookie: string, url: string): void;
20
+ clear(): void;
21
+ clearDomain(domain: string): void;
22
+ getAllCookies(): ParsedCookie[];
23
+ private parseCookie;
24
+ private decode;
25
+ private domainMatches;
26
+ private pathMatches;
27
+ private defaultPath;
28
+ private isExpired;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=memory-cookie-jar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-cookie-jar.d.ts","sourceRoot":"","sources":["../../src/cookies/memory-cookie-jar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAwBnD,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;CACnB;AAyBD,qBAAa,eAAgB,YAAW,SAAS;IAE/C,OAAO,CAAC,OAAO,CAA6D;IAK5E,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IA4CpC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAiC/C,KAAK,IAAI,IAAI;IAOb,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOjC,aAAa,IAAI,YAAY,EAAE;IAgB/B,OAAO,CAAC,WAAW;IAuFnB,OAAO,CAAC,MAAM;IAcd,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,SAAS;CAiBlB"}