nlcurl 0.1.0 → 0.2.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 (197) hide show
  1. package/README.md +5 -13
  2. package/dist/cli/args.d.ts +37 -5
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +6 -17
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli/index.d.ts +3 -3
  7. package/dist/cli/index.js +25 -10
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/output.d.ts +24 -7
  10. package/dist/cli/output.d.ts.map +1 -1
  11. package/dist/cli/output.js +24 -12
  12. package/dist/cli/output.js.map +1 -1
  13. package/dist/cookies/jar.d.ts +45 -13
  14. package/dist/cookies/jar.d.ts.map +1 -1
  15. package/dist/cookies/jar.js +88 -29
  16. package/dist/cookies/jar.js.map +1 -1
  17. package/dist/cookies/parser.d.ts +25 -3
  18. package/dist/cookies/parser.d.ts.map +1 -1
  19. package/dist/cookies/parser.js +12 -7
  20. package/dist/cookies/parser.js.map +1 -1
  21. package/dist/core/client.d.ts +49 -33
  22. package/dist/core/client.d.ts.map +1 -1
  23. package/dist/core/client.js +64 -38
  24. package/dist/core/client.js.map +1 -1
  25. package/dist/core/errors.d.ts +94 -6
  26. package/dist/core/errors.d.ts.map +1 -1
  27. package/dist/core/errors.js +95 -6
  28. package/dist/core/errors.js.map +1 -1
  29. package/dist/core/request.d.ts +96 -30
  30. package/dist/core/request.d.ts.map +1 -1
  31. package/dist/core/request.js +0 -3
  32. package/dist/core/request.js.map +1 -1
  33. package/dist/core/response.d.ts +92 -8
  34. package/dist/core/response.d.ts.map +1 -1
  35. package/dist/core/response.js +92 -7
  36. package/dist/core/response.js.map +1 -1
  37. package/dist/core/session.d.ts +109 -14
  38. package/dist/core/session.d.ts.map +1 -1
  39. package/dist/core/session.js +124 -46
  40. package/dist/core/session.js.map +1 -1
  41. package/dist/fingerprints/akamai.d.ts +11 -11
  42. package/dist/fingerprints/akamai.d.ts.map +1 -1
  43. package/dist/fingerprints/akamai.js +10 -14
  44. package/dist/fingerprints/akamai.js.map +1 -1
  45. package/dist/fingerprints/database.d.ts +14 -15
  46. package/dist/fingerprints/database.d.ts.map +1 -1
  47. package/dist/fingerprints/database.js +14 -19
  48. package/dist/fingerprints/database.js.map +1 -1
  49. package/dist/fingerprints/extensions.d.ts +121 -27
  50. package/dist/fingerprints/extensions.d.ts.map +1 -1
  51. package/dist/fingerprints/extensions.js +132 -49
  52. package/dist/fingerprints/extensions.js.map +1 -1
  53. package/dist/fingerprints/ja3.d.ts +34 -18
  54. package/dist/fingerprints/ja3.d.ts.map +1 -1
  55. package/dist/fingerprints/ja3.js +34 -18
  56. package/dist/fingerprints/ja3.js.map +1 -1
  57. package/dist/fingerprints/profiles/chrome.d.ts +21 -10
  58. package/dist/fingerprints/profiles/chrome.d.ts.map +1 -1
  59. package/dist/fingerprints/profiles/chrome.js +25 -22
  60. package/dist/fingerprints/profiles/chrome.js.map +1 -1
  61. package/dist/fingerprints/profiles/edge.d.ts +10 -7
  62. package/dist/fingerprints/profiles/edge.d.ts.map +1 -1
  63. package/dist/fingerprints/profiles/edge.js +10 -10
  64. package/dist/fingerprints/profiles/edge.js.map +1 -1
  65. package/dist/fingerprints/profiles/firefox.d.ts +11 -3
  66. package/dist/fingerprints/profiles/firefox.d.ts.map +1 -1
  67. package/dist/fingerprints/profiles/firefox.js +15 -14
  68. package/dist/fingerprints/profiles/firefox.js.map +1 -1
  69. package/dist/fingerprints/profiles/safari.d.ts +14 -3
  70. package/dist/fingerprints/profiles/safari.d.ts.map +1 -1
  71. package/dist/fingerprints/profiles/safari.js +16 -13
  72. package/dist/fingerprints/profiles/safari.js.map +1 -1
  73. package/dist/fingerprints/profiles/tor.d.ts +8 -7
  74. package/dist/fingerprints/profiles/tor.d.ts.map +1 -1
  75. package/dist/fingerprints/profiles/tor.js +8 -14
  76. package/dist/fingerprints/profiles/tor.js.map +1 -1
  77. package/dist/fingerprints/types.d.ts +70 -47
  78. package/dist/fingerprints/types.d.ts.map +1 -1
  79. package/dist/fingerprints/types.js +0 -7
  80. package/dist/fingerprints/types.js.map +1 -1
  81. package/dist/http/h1/client.d.ts +30 -9
  82. package/dist/http/h1/client.d.ts.map +1 -1
  83. package/dist/http/h1/client.js +152 -15
  84. package/dist/http/h1/client.js.map +1 -1
  85. package/dist/http/h1/encoder.d.ts +9 -6
  86. package/dist/http/h1/encoder.d.ts.map +1 -1
  87. package/dist/http/h1/encoder.js +8 -12
  88. package/dist/http/h1/encoder.js.map +1 -1
  89. package/dist/http/h1/parser.d.ts +68 -14
  90. package/dist/http/h1/parser.d.ts.map +1 -1
  91. package/dist/http/h1/parser.js +92 -37
  92. package/dist/http/h1/parser.js.map +1 -1
  93. package/dist/http/h2/client.d.ts +81 -14
  94. package/dist/http/h2/client.d.ts.map +1 -1
  95. package/dist/http/h2/client.js +465 -63
  96. package/dist/http/h2/client.js.map +1 -1
  97. package/dist/http/h2/frames.d.ts +103 -6
  98. package/dist/http/h2/frames.d.ts.map +1 -1
  99. package/dist/http/h2/frames.js +96 -17
  100. package/dist/http/h2/frames.js.map +1 -1
  101. package/dist/http/h2/hpack.d.ts +30 -5
  102. package/dist/http/h2/hpack.d.ts.map +1 -1
  103. package/dist/http/h2/hpack.js +39 -35
  104. package/dist/http/h2/hpack.js.map +1 -1
  105. package/dist/http/negotiator.d.ts +35 -12
  106. package/dist/http/negotiator.d.ts.map +1 -1
  107. package/dist/http/negotiator.js +89 -24
  108. package/dist/http/negotiator.js.map +1 -1
  109. package/dist/http/pool.d.ts +66 -17
  110. package/dist/http/pool.d.ts.map +1 -1
  111. package/dist/http/pool.js +47 -20
  112. package/dist/http/pool.js.map +1 -1
  113. package/dist/index.d.ts +2 -3
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +0 -13
  116. package/dist/index.js.map +1 -1
  117. package/dist/middleware/interceptor.d.ts +40 -8
  118. package/dist/middleware/interceptor.d.ts.map +1 -1
  119. package/dist/middleware/interceptor.js +28 -6
  120. package/dist/middleware/interceptor.js.map +1 -1
  121. package/dist/middleware/rate-limiter.d.ts +18 -5
  122. package/dist/middleware/rate-limiter.d.ts.map +1 -1
  123. package/dist/middleware/rate-limiter.js +12 -7
  124. package/dist/middleware/rate-limiter.js.map +1 -1
  125. package/dist/middleware/retry.d.ts +17 -5
  126. package/dist/middleware/retry.d.ts.map +1 -1
  127. package/dist/middleware/retry.js +13 -11
  128. package/dist/middleware/retry.js.map +1 -1
  129. package/dist/proxy/http-proxy.d.ts +17 -9
  130. package/dist/proxy/http-proxy.d.ts.map +1 -1
  131. package/dist/proxy/http-proxy.js +9 -13
  132. package/dist/proxy/http-proxy.js.map +1 -1
  133. package/dist/proxy/socks.d.ts +20 -9
  134. package/dist/proxy/socks.d.ts.map +1 -1
  135. package/dist/proxy/socks.js +20 -31
  136. package/dist/proxy/socks.js.map +1 -1
  137. package/dist/tls/constants.d.ts +74 -4
  138. package/dist/tls/constants.d.ts.map +1 -1
  139. package/dist/tls/constants.js +75 -21
  140. package/dist/tls/constants.js.map +1 -1
  141. package/dist/tls/node-engine.d.ts +17 -16
  142. package/dist/tls/node-engine.d.ts.map +1 -1
  143. package/dist/tls/node-engine.js +20 -27
  144. package/dist/tls/node-engine.js.map +1 -1
  145. package/dist/tls/stealth/client-hello.d.ts +32 -16
  146. package/dist/tls/stealth/client-hello.d.ts.map +1 -1
  147. package/dist/tls/stealth/client-hello.js +13 -37
  148. package/dist/tls/stealth/client-hello.js.map +1 -1
  149. package/dist/tls/stealth/engine.d.ts +18 -10
  150. package/dist/tls/stealth/engine.d.ts.map +1 -1
  151. package/dist/tls/stealth/engine.js +18 -24
  152. package/dist/tls/stealth/engine.js.map +1 -1
  153. package/dist/tls/stealth/handshake.d.ts +31 -17
  154. package/dist/tls/stealth/handshake.d.ts.map +1 -1
  155. package/dist/tls/stealth/handshake.js +173 -74
  156. package/dist/tls/stealth/handshake.js.map +1 -1
  157. package/dist/tls/stealth/key-schedule.d.ts +89 -32
  158. package/dist/tls/stealth/key-schedule.d.ts.map +1 -1
  159. package/dist/tls/stealth/key-schedule.js +62 -42
  160. package/dist/tls/stealth/key-schedule.js.map +1 -1
  161. package/dist/tls/stealth/record-layer.d.ts +76 -25
  162. package/dist/tls/stealth/record-layer.d.ts.map +1 -1
  163. package/dist/tls/stealth/record-layer.js +66 -36
  164. package/dist/tls/stealth/record-layer.js.map +1 -1
  165. package/dist/tls/types.d.ts +33 -25
  166. package/dist/tls/types.d.ts.map +1 -1
  167. package/dist/tls/types.js +0 -4
  168. package/dist/tls/types.js.map +1 -1
  169. package/dist/utils/buffer-reader.d.ts +99 -7
  170. package/dist/utils/buffer-reader.d.ts.map +1 -1
  171. package/dist/utils/buffer-reader.js +99 -7
  172. package/dist/utils/buffer-reader.js.map +1 -1
  173. package/dist/utils/buffer-writer.d.ts +99 -10
  174. package/dist/utils/buffer-writer.d.ts.map +1 -1
  175. package/dist/utils/buffer-writer.js +101 -12
  176. package/dist/utils/buffer-writer.js.map +1 -1
  177. package/dist/utils/encoding.d.ts +33 -8
  178. package/dist/utils/encoding.d.ts.map +1 -1
  179. package/dist/utils/encoding.js +58 -13
  180. package/dist/utils/encoding.js.map +1 -1
  181. package/dist/utils/logger.d.ts +61 -2
  182. package/dist/utils/logger.d.ts.map +1 -1
  183. package/dist/utils/logger.js +52 -4
  184. package/dist/utils/logger.js.map +1 -1
  185. package/dist/utils/url.d.ts +47 -7
  186. package/dist/utils/url.d.ts.map +1 -1
  187. package/dist/utils/url.js +47 -7
  188. package/dist/utils/url.js.map +1 -1
  189. package/dist/ws/client.d.ts +59 -15
  190. package/dist/ws/client.d.ts.map +1 -1
  191. package/dist/ws/client.js +34 -27
  192. package/dist/ws/client.js.map +1 -1
  193. package/dist/ws/frame.d.ts +43 -9
  194. package/dist/ws/frame.d.ts.map +1 -1
  195. package/dist/ws/frame.js +35 -19
  196. package/dist/ws/frame.js.map +1 -1
  197. package/package.json +2 -2
@@ -1,18 +1,23 @@
1
- /**
2
- * NLcURL Session.
3
- *
4
- * A persistent session that maintains cookies, connection pools,
5
- * default configuration, and middleware across multiple requests.
6
- */
7
1
  import { NLcURLResponse } from './response.js';
8
2
  import { AbortError, NLcURLError } from './errors.js';
9
3
  import { ProtocolNegotiator } from '../http/negotiator.js';
10
4
  import { CookieJar } from '../cookies/jar.js';
11
5
  import { InterceptorChain } from '../middleware/interceptor.js';
12
6
  import { RateLimiter } from '../middleware/rate-limiter.js';
7
+ import { withRetry } from '../middleware/retry.js';
13
8
  import { getProfile } from '../fingerprints/database.js';
14
9
  import { resolveURL, appendParams } from '../utils/url.js';
15
10
  const MAX_REDIRECTS = 20;
11
+ /**
12
+ * Stateful HTTP client session that persists connections, cookies, interceptors,
13
+ * and configuration across multiple requests. Prefer using a session when making
14
+ * many requests to the same origin, or when you need shared cookie state.
15
+ *
16
+ * @example
17
+ * const session = new NLcURLSession({ impersonate: 'chrome136' });
18
+ * const response = await session.get('https://example.com');
19
+ * session.close();
20
+ */
16
21
  export class NLcURLSession {
17
22
  config;
18
23
  negotiator;
@@ -20,11 +25,15 @@ export class NLcURLSession {
20
25
  interceptors;
21
26
  rateLimiter = null;
22
27
  closed = false;
28
+ /**
29
+ * Creates a new NLcURLSession.
30
+ *
31
+ * @param {NLcURLSessionConfig} [config={}] - Session-level defaults applied to every request.
32
+ */
23
33
  constructor(config = {}) {
24
34
  this.config = config;
25
35
  this.negotiator = new ProtocolNegotiator();
26
36
  this.interceptors = new InterceptorChain();
27
- // Cookie jar: true = create internal jar, string = unsupported (reserved)
28
37
  if (config.cookieJar === true || config.cookieJar === undefined) {
29
38
  this.cookieJar = new CookieJar();
30
39
  }
@@ -35,96 +44,182 @@ export class NLcURLSession {
35
44
  this.cookieJar = new CookieJar();
36
45
  }
37
46
  }
38
- // ---- Middleware registration ----
39
47
  /**
40
- * Register a request interceptor.
48
+ * Registers a request interceptor that is invoked (in registration order)
49
+ * before each request is dispatched. The interceptor may return a modified
50
+ * request object or a `Promise` that resolves to one.
41
51
  *
42
- * Interceptors run before dispatch and may modify the outgoing request.
52
+ * @param {RequestInterceptor} fn - The interceptor function to add.
53
+ * @returns {this} The session instance, enabling a fluent call chain.
43
54
  */
44
55
  onRequest(fn) {
45
56
  this.interceptors.addRequestInterceptor(fn);
46
57
  return this;
47
58
  }
48
59
  /**
49
- * Register a response interceptor.
60
+ * Registers a response interceptor that is invoked (in registration order)
61
+ * after each response is received. The interceptor may return a modified
62
+ * response object or a `Promise` that resolves to one.
50
63
  *
51
- * Interceptors run after a response is received and may transform it.
64
+ * @param {ResponseInterceptor} fn - The interceptor function to add.
65
+ * @returns {this} The session instance, enabling a fluent call chain.
52
66
  */
53
67
  onResponse(fn) {
54
68
  this.interceptors.addResponseInterceptor(fn);
55
69
  return this;
56
70
  }
57
71
  /**
58
- * Enable per-session rate limiting.
72
+ * Applies a token-bucket rate limit to all requests issued by this session.
73
+ * Requests that exceed the configured rate will wait until a token becomes
74
+ * available before proceeding.
75
+ *
76
+ * @param {RateLimitConfig} config - Rate limit parameters (`maxRequests` per `windowMs`).
77
+ * @returns {this} The session instance, enabling a fluent call chain.
59
78
  */
60
79
  setRateLimit(config) {
61
80
  this.rateLimiter = new RateLimiter(config);
62
81
  return this;
63
82
  }
64
- // ---- HTTP method shortcuts ----
83
+ /**
84
+ * Issues a `GET` request and resolves with the complete response.
85
+ *
86
+ * @param {string} url - The URL to request.
87
+ * @param {RequestOptions} [options] - Optional per-request settings.
88
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
89
+ */
65
90
  get(url, options) {
66
91
  return this.request({ ...options, url, method: 'GET' });
67
92
  }
93
+ /**
94
+ * Issues a `POST` request and resolves with the complete response.
95
+ *
96
+ * @param {string} url - The URL to request.
97
+ * @param {RequestBody} [body] - Request body payload.
98
+ * @param {RequestOptions} [options] - Optional per-request settings.
99
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
100
+ */
68
101
  post(url, body, options) {
69
102
  return this.request({ ...options, url, method: 'POST', body });
70
103
  }
104
+ /**
105
+ * Issues a `PUT` request and resolves with the complete response.
106
+ *
107
+ * @param {string} url - The URL to request.
108
+ * @param {RequestBody} [body] - Request body payload.
109
+ * @param {RequestOptions} [options] - Optional per-request settings.
110
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
111
+ */
71
112
  put(url, body, options) {
72
113
  return this.request({ ...options, url, method: 'PUT', body });
73
114
  }
115
+ /**
116
+ * Issues a `PATCH` request and resolves with the complete response.
117
+ *
118
+ * @param {string} url - The URL to request.
119
+ * @param {RequestBody} [body] - Request body payload.
120
+ * @param {RequestOptions} [options] - Optional per-request settings.
121
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
122
+ */
74
123
  patch(url, body, options) {
75
124
  return this.request({ ...options, url, method: 'PATCH', body });
76
125
  }
126
+ /**
127
+ * Issues a `DELETE` request and resolves with the complete response.
128
+ *
129
+ * @param {string} url - The URL to request.
130
+ * @param {RequestOptions} [options] - Optional per-request settings.
131
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
132
+ */
77
133
  delete(url, options) {
78
134
  return this.request({ ...options, url, method: 'DELETE' });
79
135
  }
136
+ /**
137
+ * Issues a `HEAD` request and resolves with the complete response (no body).
138
+ *
139
+ * @param {string} url - The URL to request.
140
+ * @param {RequestOptions} [options] - Optional per-request settings.
141
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
142
+ */
80
143
  head(url, options) {
81
144
  return this.request({ ...options, url, method: 'HEAD' });
82
145
  }
146
+ /**
147
+ * Issues an `OPTIONS` request and resolves with the complete response.
148
+ *
149
+ * @param {string} url - The URL to request.
150
+ * @param {RequestOptions} [options] - Optional per-request settings.
151
+ * @returns {Promise<NLcURLResponse>} Resolves with the server response.
152
+ */
83
153
  options(url, options) {
84
154
  return this.request({ ...options, url, method: 'OPTIONS' });
85
155
  }
86
- // ---- Core request method ----
156
+ /**
157
+ * Executes a fully described HTTP request, applying session defaults, request
158
+ * interceptors, redirect following, cookie management, and response
159
+ * interceptors in sequence.
160
+ *
161
+ * @param {NLcURLRequest} input - The request descriptor.
162
+ * @returns {Promise<NLcURLResponse>} Resolves with the final response after all redirects.
163
+ * @throws {NLcURLError} If the session has been closed.
164
+ * @throws {AbortError} If the provided `AbortSignal` fires before completion.
165
+ * @throws {TimeoutError} If any configured timeout is exceeded.
166
+ * @throws {ConnectionError} If a TCP connection cannot be established.
167
+ * @throws {TLSError} If the TLS handshake fails.
168
+ * @throws {ProxyError} If the proxy tunnel cannot be established.
169
+ * @throws {NLcURLError} If the maximum number of redirects is exceeded (`ERR_MAX_REDIRECTS`).
170
+ */
87
171
  async request(input) {
88
172
  if (this.closed) {
89
173
  throw new NLcURLError('Session is closed', 'ERR_SESSION_CLOSED');
90
174
  }
91
- // Rate limiting
92
175
  if (this.rateLimiter) {
93
176
  await this.rateLimiter.acquire();
94
177
  }
95
- // Merge session defaults with per-request options
96
178
  let req = this.mergeDefaults(input);
97
- // Run request interceptors
98
179
  req = await this.interceptors.processRequest(req);
99
- // Resolve the profile
100
180
  const profile = this.resolveProfile(req);
101
- // Build negotiator options
102
181
  const negotiatorOptions = {
103
182
  stealth: req.stealth,
104
183
  profile,
105
184
  insecure: req.insecure,
106
185
  };
107
- // Execute with redirect following
108
- let response = await this.executeWithRedirects(req, negotiatorOptions);
109
- // Store cookies from response
186
+ const totalStart = Date.now();
187
+ let response;
188
+ if (this.config.retry && this.config.retry.count && this.config.retry.count > 0) {
189
+ response = await withRetry({
190
+ count: this.config.retry.count,
191
+ delay: this.config.retry.delay ?? 1000,
192
+ backoff: this.config.retry.backoff ?? 'exponential',
193
+ jitter: this.config.retry.jitter ?? 200,
194
+ retryOn: this.config.retry.retryOn,
195
+ }, () => this.executeWithRedirects(req, negotiatorOptions));
196
+ }
197
+ else {
198
+ response = await this.executeWithRedirects(req, negotiatorOptions);
199
+ }
200
+ if (response.timings) {
201
+ response.timings.total = Date.now() - totalStart;
202
+ }
110
203
  if (this.cookieJar) {
111
204
  const url = new URL(response.url);
112
205
  this.cookieJar.setCookies(response.headers, url, response.rawHeaders);
113
206
  }
114
- // Run response interceptors
115
207
  response = await this.interceptors.processResponse(response);
116
208
  return response;
117
209
  }
118
- // ---- Cookie access ----
119
210
  /**
120
- * Return the session cookie jar, or `null` when cookie management is disabled.
211
+ * Returns the active {@link CookieJar} for this session, or `null` if
212
+ * cookie management was disabled via `cookieJar: false`.
213
+ *
214
+ * @returns {CookieJar|null} The shared cookie jar, or `null`.
121
215
  */
122
216
  getCookies() {
123
217
  return this.cookieJar;
124
218
  }
125
- // ---- Lifecycle ----
126
219
  /**
127
- * Close the session and release pooled connections.
220
+ * Closes the session, releasing any pooled connections. After calling this
221
+ * method, issuing further requests will throw an `NLcURLError` with code
222
+ * `ERR_SESSION_CLOSED`. Subsequent calls are no-ops.
128
223
  */
129
224
  close() {
130
225
  if (this.closed)
@@ -132,10 +227,8 @@ export class NLcURLSession {
132
227
  this.closed = true;
133
228
  this.negotiator.close();
134
229
  }
135
- // ---- Internal helpers ----
136
230
  mergeDefaults(input) {
137
231
  const cfg = this.config;
138
- // Resolve base URL
139
232
  let url = input.url;
140
233
  if (cfg.baseURL && !url.startsWith('http://') && !url.startsWith('https://')) {
141
234
  url = resolveURL(cfg.baseURL, url);
@@ -143,11 +236,9 @@ export class NLcURLSession {
143
236
  else if (input.baseURL && !url.startsWith('http://') && !url.startsWith('https://')) {
144
237
  url = resolveURL(input.baseURL, url);
145
238
  }
146
- // Append query params
147
239
  if (input.params) {
148
240
  url = appendParams(url, input.params);
149
241
  }
150
- // Merge headers (session defaults first, request headers override)
151
242
  const headers = {};
152
243
  if (cfg.headers) {
153
244
  for (const [k, v] of Object.entries(cfg.headers)) {
@@ -159,12 +250,10 @@ export class NLcURLSession {
159
250
  headers[k.toLowerCase()] = v;
160
251
  }
161
252
  }
162
- // Inject cookies
163
253
  if (this.cookieJar) {
164
254
  const parsedUrl = new URL(url);
165
255
  const cookieHeader = this.cookieJar.getCookieHeader(parsedUrl);
166
256
  if (cookieHeader) {
167
- // Merge with any explicitly set cookie header
168
257
  const existing = headers['cookie'];
169
258
  headers['cookie'] = existing ? `${existing}; ${cookieHeader}` : cookieHeader;
170
259
  }
@@ -186,6 +275,7 @@ export class NLcURLSession {
186
275
  httpVersion: input.httpVersion ?? cfg.httpVersion,
187
276
  timeout: input.timeout ?? cfg.timeout,
188
277
  acceptEncoding: input.acceptEncoding ?? cfg.acceptEncoding,
278
+ dnsFamily: input.dnsFamily ?? cfg.dnsFamily,
189
279
  };
190
280
  }
191
281
  resolveProfile(req) {
@@ -203,15 +293,12 @@ export class NLcURLSession {
203
293
  const maxRedirects = req.maxRedirects ?? MAX_REDIRECTS;
204
294
  const shouldFollow = req.followRedirects ?? true;
205
295
  while (true) {
206
- // Check abort signal
207
296
  if (currentReq.signal?.aborted) {
208
297
  throw new AbortError();
209
298
  }
210
299
  const response = await this.negotiator.send(currentReq, options);
211
- // Check if we should follow a redirect
212
300
  const isRedirect = [301, 302, 303, 307, 308].includes(response.status);
213
301
  if (!isRedirect || !shouldFollow) {
214
- // Attach redirect tracking to the final response
215
302
  if (redirectCount > 0) {
216
303
  return new NLcURLResponse({
217
304
  status: response.status,
@@ -232,12 +319,10 @@ export class NLcURLSession {
232
319
  if (redirectCount > maxRedirects) {
233
320
  throw new NLcURLError(`Maximum redirect limit (${maxRedirects}) exceeded`, 'ERR_MAX_REDIRECTS');
234
321
  }
235
- // Extract Location header
236
322
  const location = response.headers['location'];
237
323
  if (!location) {
238
324
  return response;
239
325
  }
240
- // Resolve redirect URL and validate protocol
241
326
  let redirectUrl;
242
327
  try {
243
328
  redirectUrl = resolveURL(currentReq.url, location);
@@ -251,15 +336,10 @@ export class NLcURLSession {
251
336
  throw err;
252
337
  throw new NLcURLError(`Invalid redirect URL: ${location}`, 'ERR_INVALID_REDIRECT');
253
338
  }
254
- // Store cookies from redirect response
255
339
  if (this.cookieJar) {
256
340
  const url = new URL(response.url);
257
341
  this.cookieJar.setCookies(response.headers, url, response.rawHeaders);
258
342
  }
259
- // Determine new method:
260
- // 303: always GET
261
- // 301/302: GET for POST (historical behavior), keep for others
262
- // 307/308: keep method and body
263
343
  let method = currentReq.method ?? 'GET';
264
344
  let body = currentReq.body;
265
345
  if (response.status === 303) {
@@ -271,7 +351,6 @@ export class NLcURLSession {
271
351
  method = 'GET';
272
352
  body = null;
273
353
  }
274
- // Inject cookies for the new URL
275
354
  const headers = { ...currentReq.headers };
276
355
  delete headers['content-type'];
277
356
  delete headers['content-length'];
@@ -285,7 +364,6 @@ export class NLcURLSession {
285
364
  delete headers['cookie'];
286
365
  }
287
366
  }
288
- // Strip sensitive headers on cross-origin redirects
289
367
  const originalOrigin = new URL(currentReq.url).origin;
290
368
  const redirectOrigin = new URL(redirectUrl).origin;
291
369
  if (originalOrigin !== redirectOrigin) {
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAA0B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAqD,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,WAAW,EAAwB,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAwC,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,aAAa,GAAG,EAAE,CAAC;AAOzB,MAAM,OAAO,aAAa;IACP,MAAM,CAAsB;IAC5B,UAAU,CAAqB;IAC/B,SAAS,CAAmB;IAC5B,YAAY,CAAmB;IACxC,WAAW,GAAuB,IAAI,CAAC;IACvC,MAAM,GAAG,KAAK,CA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;gBACb,GAAG,EAAE,WAAW;gBAChB,MAAM;gBACN,IAAI;gBACJ,OAAO;aACR,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1,17 +1,17 @@
1
+ import type { H2Profile } from './types.js';
1
2
  /**
2
- * Akamai HTTP/2 fingerprint computation.
3
+ * Computes the Akamai HTTP/2 fingerprint string for a browser profile. The
4
+ * string encodes the SETTINGS frame parameters, connection window update,
5
+ * optional PRIORITY frame configuration, and pseudo-header ordering,
6
+ * separated by pipe characters (`|`).
3
7
  *
4
- * The Akamai fingerprint identifies HTTP/2 clients based on:
5
- * S[id:value;...]|WU[value]|P[frames...]|PS[order]
8
+ * @param {H2Profile} profile - The HTTP/2 profile to fingerprint.
9
+ * @returns {string} The Akamai fingerprint string in the format
10
+ * `"S1:V1;S2:V2|WU|P1:E1:D1:W1,...|:method,:path,..."`.
6
11
  *
7
- * - S: SETTINGS frame parameters (id:value pairs, semicolon-separated)
8
- * - WU: WINDOW_UPDATE value
9
- * - P: PRIORITY frames (not used by most modern browsers)
10
- * - PS: Pseudo-header order
11
- */
12
- import type { H2Profile } from './types.js';
13
- /**
14
- * Build the Akamai HTTP/2 fingerprint string from an H2 profile.
12
+ * @example
13
+ * const fp = akamaiFingerprint(chromeLatest.h2);
14
+ * // => "1:65536;2:0;3:1000;4:6291456;6:262144|15663105|0:0:0:255|m,p,a,s"
15
15
  */
16
16
  export declare function akamaiFingerprint(profile: H2Profile): string;
17
17
  //# sourceMappingURL=akamai.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"akamai.d.ts","sourceRoot":"","sources":["../../src/fingerprints/akamai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAqB5D"}
1
+ {"version":3,"file":"akamai.d.ts","sourceRoot":"","sources":["../../src/fingerprints/akamai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAiB5D"}
@@ -1,29 +1,25 @@
1
1
  /**
2
- * Akamai HTTP/2 fingerprint computation.
2
+ * Computes the Akamai HTTP/2 fingerprint string for a browser profile. The
3
+ * string encodes the SETTINGS frame parameters, connection window update,
4
+ * optional PRIORITY frame configuration, and pseudo-header ordering,
5
+ * separated by pipe characters (`|`).
3
6
  *
4
- * The Akamai fingerprint identifies HTTP/2 clients based on:
5
- * S[id:value;...]|WU[value]|P[frames...]|PS[order]
7
+ * @param {H2Profile} profile - The HTTP/2 profile to fingerprint.
8
+ * @returns {string} The Akamai fingerprint string in the format
9
+ * `"S1:V1;S2:V2|WU|P1:E1:D1:W1,...|:method,:path,..."`.
6
10
  *
7
- * - S: SETTINGS frame parameters (id:value pairs, semicolon-separated)
8
- * - WU: WINDOW_UPDATE value
9
- * - P: PRIORITY frames (not used by most modern browsers)
10
- * - PS: Pseudo-header order
11
- */
12
- /**
13
- * Build the Akamai HTTP/2 fingerprint string from an H2 profile.
11
+ * @example
12
+ * const fp = akamaiFingerprint(chromeLatest.h2);
13
+ * // => "1:65536;2:0;3:1000;4:6291456;6:262144|15663105|0:0:0:255|m,p,a,s"
14
14
  */
15
15
  export function akamaiFingerprint(profile) {
16
- // Settings section
17
16
  const settings = profile.settings
18
17
  .map((s) => `${s.id}:${s.value}`)
19
18
  .join(';');
20
- // Window update section
21
19
  const wu = String(profile.windowUpdate);
22
- // Priority frames section
23
20
  const priority = (profile.priorityFrames ?? [])
24
21
  .map((f) => `${f.streamId}:${f.exclusive ? 1 : 0}:${f.dependsOn}:${f.weight}`)
25
22
  .join(',');
26
- // Pseudo-header order section
27
23
  const pseudo = profile.pseudoHeaderOrder.join(',');
28
24
  return `${settings}|${wu}|${priority}|${pseudo}`;
29
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"akamai.js","sourceRoot":"","sources":["../../src/fingerprints/akamai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAkB;IAClD,mBAAmB;IACnB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ;SAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;SAChC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,wBAAwB;IACxB,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAExC,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;SAC5C,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,EAAE,CACpE;SACA,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,8BAA8B;IAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"akamai.js","sourceRoot":"","sources":["../../src/fingerprints/akamai.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAkB;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ;SAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;SAChC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAExC,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;SAC5C,GAAG,CACF,CAAC,CAAC,EAAE,EAAE,CACJ,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,EAAE,CACpE;SACA,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;AACnD,CAAC"}
@@ -1,9 +1,3 @@
1
- /**
2
- * Browser fingerprint database.
3
- *
4
- * Provides a unified lookup for all browser profiles by canonical name
5
- * (e.g. "chrome136", "firefox138", "safari_latest").
6
- */
7
1
  import type { BrowserProfile } from './types.js';
8
2
  import { chromeLatest } from './profiles/chrome.js';
9
3
  import { firefoxLatest } from './profiles/firefox.js';
@@ -11,22 +5,27 @@ import { safariLatest } from './profiles/safari.js';
11
5
  import { edgeLatest } from './profiles/edge.js';
12
6
  import { torLatest } from './profiles/tor.js';
13
7
  /**
14
- * Look up a browser profile by canonical name.
8
+ * Looks up a browser profile by name, accepting flexible casing and separators.
9
+ * Returns the latest version of the named browser when given a bare browser
10
+ * family name (e.g. `"chrome"`, `"firefox"`).
15
11
  *
16
- * Accepted formats:
17
- * - Exact name: "chrome136", "firefox138"
18
- * - Latest alias: "chrome_latest", "firefox_latest"
19
- * - Family only: "chrome", "firefox" (resolves to latest)
12
+ * @param {string} name - Profile identifier such as `"chrome136"`, `"firefox"`, or `"safari"`. Case-insensitive; hyphens and spaces are ignored.
13
+ * @returns {BrowserProfile|undefined} The matching profile, or `undefined` if no profile is registered under that name.
20
14
  *
21
- * Returns `undefined` if no match is found.
15
+ * @example
16
+ * const profile = getProfile('chrome136');
17
+ * const latest = getProfile('chrome'); // resolves to the latest Chrome profile
22
18
  */
23
19
  export declare function getProfile(name: string): BrowserProfile | undefined;
24
20
  /**
25
- * List all available profile names.
21
+ * Returns a sorted list of all registered browser profile identifiers
22
+ * (e.g. `["chrome120", "chrome124", "firefox120", ...]`). Use these names
23
+ * with {@link getProfile} or the `impersonate` request option.
24
+ *
25
+ * @returns {string[]} Alphabetically sorted array of profile names.
26
26
  */
27
27
  export declare function listProfiles(): string[];
28
- /** The default profile used when `impersonate` is set without a
29
- * specific version. */
28
+ /** The default browser profile used when no `impersonate` option is specified. Points to the latest bundled Chrome profile. */
30
29
  export declare const DEFAULT_PROFILE: BrowserProfile;
31
30
  export { chromeLatest, firefoxLatest, safariLatest, edgeLatest, torLatest };
32
31
  export type { BrowserProfile } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/fingerprints/database.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAgB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAe,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkB3D;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAsBnE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED;wBACwB;AACxB,eAAO,MAAM,eAAe,EAAE,cAA6B,CAAC;AAG5D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/fingerprints/database.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAgB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAe,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgB3D;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAoBnE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED,+HAA+H;AAC/H,eAAO,MAAM,eAAe,EAAE,cAA6B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -1,15 +1,8 @@
1
- /**
2
- * Browser fingerprint database.
3
- *
4
- * Provides a unified lookup for all browser profiles by canonical name
5
- * (e.g. "chrome136", "firefox138", "safari_latest").
6
- */
7
1
  import { chromeProfiles, chromeLatest } from './profiles/chrome.js';
8
2
  import { firefoxProfiles, firefoxLatest } from './profiles/firefox.js';
9
3
  import { safariProfiles, safariLatest } from './profiles/safari.js';
10
4
  import { edgeProfiles, edgeLatest } from './profiles/edge.js';
11
5
  import { torProfiles, torLatest } from './profiles/tor.js';
12
- // ---- Merged database ----
13
6
  const allProfiles = new Map();
14
7
  for (const source of [
15
8
  chromeProfiles,
@@ -23,22 +16,22 @@ for (const source of [
23
16
  }
24
17
  }
25
18
  /**
26
- * Look up a browser profile by canonical name.
19
+ * Looks up a browser profile by name, accepting flexible casing and separators.
20
+ * Returns the latest version of the named browser when given a bare browser
21
+ * family name (e.g. `"chrome"`, `"firefox"`).
27
22
  *
28
- * Accepted formats:
29
- * - Exact name: "chrome136", "firefox138"
30
- * - Latest alias: "chrome_latest", "firefox_latest"
31
- * - Family only: "chrome", "firefox" (resolves to latest)
23
+ * @param {string} name - Profile identifier such as `"chrome136"`, `"firefox"`, or `"safari"`. Case-insensitive; hyphens and spaces are ignored.
24
+ * @returns {BrowserProfile|undefined} The matching profile, or `undefined` if no profile is registered under that name.
32
25
  *
33
- * Returns `undefined` if no match is found.
26
+ * @example
27
+ * const profile = getProfile('chrome136');
28
+ * const latest = getProfile('chrome'); // resolves to the latest Chrome profile
34
29
  */
35
30
  export function getProfile(name) {
36
31
  const lower = name.toLowerCase().replace(/[-\s]/g, '');
37
- // Direct match
38
32
  const direct = allProfiles.get(lower);
39
33
  if (direct)
40
34
  return direct;
41
- // Family-only shorthand
42
35
  switch (lower) {
43
36
  case 'chrome':
44
37
  return chromeLatest;
@@ -55,14 +48,16 @@ export function getProfile(name) {
55
48
  }
56
49
  }
57
50
  /**
58
- * List all available profile names.
51
+ * Returns a sorted list of all registered browser profile identifiers
52
+ * (e.g. `["chrome120", "chrome124", "firefox120", ...]`). Use these names
53
+ * with {@link getProfile} or the `impersonate` request option.
54
+ *
55
+ * @returns {string[]} Alphabetically sorted array of profile names.
59
56
  */
60
57
  export function listProfiles() {
61
58
  return [...allProfiles.keys()].sort();
62
59
  }
63
- /** The default profile used when `impersonate` is set without a
64
- * specific version. */
60
+ /** The default browser profile used when no `impersonate` option is specified. Points to the latest bundled Chrome profile. */
65
61
  export const DEFAULT_PROFILE = chromeLatest;
66
- // Re-exports for convenience
67
62
  export { chromeLatest, firefoxLatest, safariLatest, edgeLatest, torLatest };
68
63
  //# sourceMappingURL=database.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/fingerprints/database.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE3D,4BAA4B;AAE5B,MAAM,WAAW,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEtD,KAAK,MAAM,MAAM,IAAI;IACnB,cAAc;IACd,eAAe;IACf,cAAc;IACd,YAAY;IACZ,WAAW;CACZ,EAAE,CAAC;IACF,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEvD,eAAe;IACf,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,wBAAwB;IACxB,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,YAAY,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;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