rezo 1.0.17 → 1.0.19

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.
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -20,6 +20,100 @@ const { isSameDomain, RezoPerformance } = require('../utils/tools.cjs');
20
20
  const { getGlobalDNSCache } = require('../cache/dns-cache.cjs');
21
21
  const { ResponseCache } = require('../cache/response-cache.cjs');
22
22
  const dns = require("dns");
23
+ const debugLog = {
24
+ requestStart: (config, url, method) => {
25
+ if (config.debug) {
26
+ console.log(`
27
+ [Rezo Debug] ─────────────────────────────────────`);
28
+ console.log(`[Rezo Debug] ${method} ${url}`);
29
+ console.log(`[Rezo Debug] Request ID: ${config.requestId}`);
30
+ if (config.originalRequest?.headers) {
31
+ const headers = config.originalRequest.headers instanceof RezoHeaders ? config.originalRequest.headers.toObject() : config.originalRequest.headers;
32
+ console.log(`[Rezo Debug] Request Headers:`, JSON.stringify(headers, null, 2));
33
+ }
34
+ if (config.proxy && typeof config.proxy === "object") {
35
+ console.log(`[Rezo Debug] Proxy: ${config.proxy.protocol}://${config.proxy.host}:${config.proxy.port}`);
36
+ } else if (config.proxy && typeof config.proxy === "string") {
37
+ console.log(`[Rezo Debug] Proxy: ${config.proxy}`);
38
+ }
39
+ }
40
+ if (config.trackUrl) {
41
+ console.log(`[Rezo Track] → ${method} ${url}`);
42
+ }
43
+ },
44
+ redirect: (config, fromUrl, toUrl, statusCode, method) => {
45
+ if (config.debug) {
46
+ console.log(`[Rezo Debug] Redirect ${statusCode}: ${fromUrl}`);
47
+ console.log(`[Rezo Debug] → ${toUrl} (${method})`);
48
+ }
49
+ if (config.trackUrl) {
50
+ console.log(`[Rezo Track] ↳ ${statusCode} → ${toUrl}`);
51
+ }
52
+ },
53
+ retry: (config, attempt, maxRetries, statusCode, delay) => {
54
+ if (config.debug) {
55
+ console.log(`[Rezo Debug] Retry ${attempt}/${maxRetries} after status ${statusCode}${delay > 0 ? ` (waiting ${delay}ms)` : ""}`);
56
+ }
57
+ if (config.trackUrl) {
58
+ console.log(`[Rezo Track] ⟳ Retry ${attempt}/${maxRetries} (status ${statusCode})`);
59
+ }
60
+ },
61
+ maxRetries: (config, maxRetries) => {
62
+ if (config.debug) {
63
+ console.log(`[Rezo Debug] Max retries (${maxRetries}) reached, throwing error`);
64
+ }
65
+ if (config.trackUrl) {
66
+ console.log(`[Rezo Track] ✗ Max retries reached`);
67
+ }
68
+ },
69
+ response: (config, status, statusText, duration) => {
70
+ if (config.debug) {
71
+ console.log(`[Rezo Debug] Response: ${status} ${statusText} (${duration.toFixed(2)}ms)`);
72
+ }
73
+ if (config.trackUrl) {
74
+ console.log(`[Rezo Track] ✓ ${status} ${statusText}`);
75
+ }
76
+ },
77
+ responseHeaders: (config, headers) => {
78
+ if (config.debug) {
79
+ console.log(`[Rezo Debug] Response Headers:`, JSON.stringify(headers, null, 2));
80
+ }
81
+ },
82
+ cookies: (config, cookieCount) => {
83
+ if (config.debug && cookieCount > 0) {
84
+ console.log(`[Rezo Debug] Cookies received: ${cookieCount}`);
85
+ }
86
+ },
87
+ timing: (config, timing) => {
88
+ if (config.debug) {
89
+ const parts = [];
90
+ if (timing.dns)
91
+ parts.push(`DNS: ${timing.dns.toFixed(2)}ms`);
92
+ if (timing.connect)
93
+ parts.push(`Connect: ${timing.connect.toFixed(2)}ms`);
94
+ if (timing.tls)
95
+ parts.push(`TLS: ${timing.tls.toFixed(2)}ms`);
96
+ if (timing.ttfb)
97
+ parts.push(`TTFB: ${timing.ttfb.toFixed(2)}ms`);
98
+ if (timing.total)
99
+ parts.push(`Total: ${timing.total.toFixed(2)}ms`);
100
+ if (parts.length > 0) {
101
+ console.log(`[Rezo Debug] Timing: ${parts.join(" | ")}`);
102
+ }
103
+ }
104
+ },
105
+ complete: (config, finalUrl, redirectCount, duration) => {
106
+ if (config.debug) {
107
+ console.log(`[Rezo Debug] Complete: ${finalUrl}`);
108
+ if (redirectCount > 0) {
109
+ console.log(`[Rezo Debug] Redirects: ${redirectCount}`);
110
+ }
111
+ console.log(`[Rezo Debug] Total Duration: ${duration.toFixed(2)}ms`);
112
+ console.log(`[Rezo Debug] ─────────────────────────────────────
113
+ `);
114
+ }
115
+ }
116
+ };
23
117
  const responseCacheInstances = new Map;
24
118
  function getCacheConfigKey(option) {
25
119
  if (option === true)
@@ -246,6 +340,8 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
246
340
  config.setSignal();
247
341
  const timeoutClearInstanse = config.timeoutClearInstanse;
248
342
  delete config.timeoutClearInstanse;
343
+ const requestUrl = fetchOptions.fullUrl ? String(fetchOptions.fullUrl) : "";
344
+ debugLog.requestStart(config, requestUrl, fetchOptions.method || "GET");
249
345
  const eventEmitter = streamResult || downloadResult || uploadResult;
250
346
  if (eventEmitter) {
251
347
  eventEmitter.emit("initiated");
@@ -284,17 +380,14 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
284
380
  throw response;
285
381
  }
286
382
  if (maxRetries <= retries) {
287
- if (config.debug) {
288
- console.log(`Max retries (${maxRetries}) reached, throwing the last error`);
289
- }
383
+ debugLog.maxRetries(config, maxRetries);
290
384
  throw response;
291
385
  }
292
386
  retries++;
293
- if (config.debug) {
294
- console.log(`Request failed with status code ${responseStatusCode}, retrying...${retryDelay > 0 ? " in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
295
- }
387
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
388
+ debugLog.retry(config, retries, maxRetries, responseStatusCode, currentDelay);
296
389
  if (retryDelay > 0) {
297
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
390
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
298
391
  }
299
392
  }
300
393
  config.retryAttempts++;
@@ -302,6 +395,16 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
302
395
  continue;
303
396
  }
304
397
  if (statusOnNext === "success") {
398
+ const totalDuration = performance.now() - timing.startTime;
399
+ debugLog.response(config, response.status, response.statusText, totalDuration);
400
+ if (response.headers) {
401
+ const headersObj = response.headers instanceof RezoHeaders ? response.headers.toObject() : response.headers;
402
+ debugLog.responseHeaders(config, headersObj);
403
+ }
404
+ if (response.cookies?.array) {
405
+ debugLog.cookies(config, response.cookies.array.length);
406
+ }
407
+ debugLog.complete(config, response.finalUrl || requestUrl, config.redirectCount, totalDuration);
305
408
  return response;
306
409
  }
307
410
  if (statusOnNext === "redirect") {
@@ -363,8 +466,8 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
363
466
  addedOptions.customHeaders = customHeaders;
364
467
  addedOptions.fullUrl = fetchOptions.fullUrl;
365
468
  delete options.params;
469
+ const fromUrl = fetchOptions.fullUrl;
366
470
  fetchOptions.fullUrl = location;
367
- let commented = false;
368
471
  if (typeof onRedirect === "object" && onRedirect.redirect) {
369
472
  const method = onRedirect.method || fetchOptions.method;
370
473
  config.method = method;
@@ -375,26 +478,16 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
375
478
  } else if (onRedirect.body) {
376
479
  options.body = onRedirect.body;
377
480
  }
378
- if (config.debug) {
379
- commented = true;
380
- console.log(`
381
- Redirecting to: ${fetchOptions.fullUrl} using ${method} method`);
382
- }
481
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, method);
383
482
  if (onRedirect.setHeaders) {
384
483
  addedOptions.customHeaders = onRedirect.setHeaders;
385
484
  }
386
485
  } else if (response.status === 301 || response.status === 302 || response.status === 303) {
387
- if (config.debug) {
388
- commented = true;
389
- console.log(`
390
- Redirecting to: ${fetchOptions.fullUrl} using GET method`);
391
- }
486
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, "GET");
392
487
  options.method = "GET";
393
488
  delete options.body;
394
- } else
395
- commented = false;
396
- if (config.debug && !commented) {
397
- console.log(`Redirecting to: ${fetchOptions.fullUrl}`);
489
+ } else {
490
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, fetchOptions.method);
398
491
  }
399
492
  const __ = prepareHTTPOptions(fetchOptions, config.cookieJar, addedOptions, config);
400
493
  fetchOptions = __.fetchOptions;
@@ -414,11 +507,10 @@ Redirecting to: ${fetchOptions.fullUrl} using GET method`);
414
507
  duration: perform.now()
415
508
  });
416
509
  perform.reset();
417
- if (config.debug) {
418
- console.log(`Request failed with status code ${response.status}, retrying...${retryDelay > 0 ? " in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
419
- }
510
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
511
+ debugLog.retry(config, retries, maxRetries, response.status, currentDelay);
420
512
  if (retryDelay > 0) {
421
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
513
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
422
514
  }
423
515
  continue;
424
516
  }
@@ -1092,7 +1184,7 @@ async function setInitialConfig(config, fetchOptions, isSecure, url, httpModule,
1092
1184
  };
1093
1185
  config.retryAttempts = 0;
1094
1186
  config.errors = [];
1095
- config.debug = fetchOptions.debug || false;
1187
+ config.debug = config.debug || fetchOptions.debug || false;
1096
1188
  config.requestId = generateRequestId();
1097
1189
  config.sessionId = fetchOptions.sessionId || generateSessionId();
1098
1190
  config.traceId = generateTraceId();
@@ -20,6 +20,100 @@ import { isSameDomain, RezoPerformance } from '../utils/tools.js';
20
20
  import { getGlobalDNSCache } from '../cache/dns-cache.js';
21
21
  import { ResponseCache } from '../cache/response-cache.js';
22
22
  import dns from "dns";
23
+ const debugLog = {
24
+ requestStart: (config, url, method) => {
25
+ if (config.debug) {
26
+ console.log(`
27
+ [Rezo Debug] ─────────────────────────────────────`);
28
+ console.log(`[Rezo Debug] ${method} ${url}`);
29
+ console.log(`[Rezo Debug] Request ID: ${config.requestId}`);
30
+ if (config.originalRequest?.headers) {
31
+ const headers = config.originalRequest.headers instanceof RezoHeaders ? config.originalRequest.headers.toObject() : config.originalRequest.headers;
32
+ console.log(`[Rezo Debug] Request Headers:`, JSON.stringify(headers, null, 2));
33
+ }
34
+ if (config.proxy && typeof config.proxy === "object") {
35
+ console.log(`[Rezo Debug] Proxy: ${config.proxy.protocol}://${config.proxy.host}:${config.proxy.port}`);
36
+ } else if (config.proxy && typeof config.proxy === "string") {
37
+ console.log(`[Rezo Debug] Proxy: ${config.proxy}`);
38
+ }
39
+ }
40
+ if (config.trackUrl) {
41
+ console.log(`[Rezo Track] → ${method} ${url}`);
42
+ }
43
+ },
44
+ redirect: (config, fromUrl, toUrl, statusCode, method) => {
45
+ if (config.debug) {
46
+ console.log(`[Rezo Debug] Redirect ${statusCode}: ${fromUrl}`);
47
+ console.log(`[Rezo Debug] → ${toUrl} (${method})`);
48
+ }
49
+ if (config.trackUrl) {
50
+ console.log(`[Rezo Track] ↳ ${statusCode} → ${toUrl}`);
51
+ }
52
+ },
53
+ retry: (config, attempt, maxRetries, statusCode, delay) => {
54
+ if (config.debug) {
55
+ console.log(`[Rezo Debug] Retry ${attempt}/${maxRetries} after status ${statusCode}${delay > 0 ? ` (waiting ${delay}ms)` : ""}`);
56
+ }
57
+ if (config.trackUrl) {
58
+ console.log(`[Rezo Track] ⟳ Retry ${attempt}/${maxRetries} (status ${statusCode})`);
59
+ }
60
+ },
61
+ maxRetries: (config, maxRetries) => {
62
+ if (config.debug) {
63
+ console.log(`[Rezo Debug] Max retries (${maxRetries}) reached, throwing error`);
64
+ }
65
+ if (config.trackUrl) {
66
+ console.log(`[Rezo Track] ✗ Max retries reached`);
67
+ }
68
+ },
69
+ response: (config, status, statusText, duration) => {
70
+ if (config.debug) {
71
+ console.log(`[Rezo Debug] Response: ${status} ${statusText} (${duration.toFixed(2)}ms)`);
72
+ }
73
+ if (config.trackUrl) {
74
+ console.log(`[Rezo Track] ✓ ${status} ${statusText}`);
75
+ }
76
+ },
77
+ responseHeaders: (config, headers) => {
78
+ if (config.debug) {
79
+ console.log(`[Rezo Debug] Response Headers:`, JSON.stringify(headers, null, 2));
80
+ }
81
+ },
82
+ cookies: (config, cookieCount) => {
83
+ if (config.debug && cookieCount > 0) {
84
+ console.log(`[Rezo Debug] Cookies received: ${cookieCount}`);
85
+ }
86
+ },
87
+ timing: (config, timing) => {
88
+ if (config.debug) {
89
+ const parts = [];
90
+ if (timing.dns)
91
+ parts.push(`DNS: ${timing.dns.toFixed(2)}ms`);
92
+ if (timing.connect)
93
+ parts.push(`Connect: ${timing.connect.toFixed(2)}ms`);
94
+ if (timing.tls)
95
+ parts.push(`TLS: ${timing.tls.toFixed(2)}ms`);
96
+ if (timing.ttfb)
97
+ parts.push(`TTFB: ${timing.ttfb.toFixed(2)}ms`);
98
+ if (timing.total)
99
+ parts.push(`Total: ${timing.total.toFixed(2)}ms`);
100
+ if (parts.length > 0) {
101
+ console.log(`[Rezo Debug] Timing: ${parts.join(" | ")}`);
102
+ }
103
+ }
104
+ },
105
+ complete: (config, finalUrl, redirectCount, duration) => {
106
+ if (config.debug) {
107
+ console.log(`[Rezo Debug] Complete: ${finalUrl}`);
108
+ if (redirectCount > 0) {
109
+ console.log(`[Rezo Debug] Redirects: ${redirectCount}`);
110
+ }
111
+ console.log(`[Rezo Debug] Total Duration: ${duration.toFixed(2)}ms`);
112
+ console.log(`[Rezo Debug] ─────────────────────────────────────
113
+ `);
114
+ }
115
+ }
116
+ };
23
117
  const responseCacheInstances = new Map;
24
118
  function getCacheConfigKey(option) {
25
119
  if (option === true)
@@ -246,6 +340,8 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
246
340
  config.setSignal();
247
341
  const timeoutClearInstanse = config.timeoutClearInstanse;
248
342
  delete config.timeoutClearInstanse;
343
+ const requestUrl = fetchOptions.fullUrl ? String(fetchOptions.fullUrl) : "";
344
+ debugLog.requestStart(config, requestUrl, fetchOptions.method || "GET");
249
345
  const eventEmitter = streamResult || downloadResult || uploadResult;
250
346
  if (eventEmitter) {
251
347
  eventEmitter.emit("initiated");
@@ -284,17 +380,14 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
284
380
  throw response;
285
381
  }
286
382
  if (maxRetries <= retries) {
287
- if (config.debug) {
288
- console.log(`Max retries (${maxRetries}) reached, throwing the last error`);
289
- }
383
+ debugLog.maxRetries(config, maxRetries);
290
384
  throw response;
291
385
  }
292
386
  retries++;
293
- if (config.debug) {
294
- console.log(`Request failed with status code ${responseStatusCode}, retrying...${retryDelay > 0 ? " in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
295
- }
387
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
388
+ debugLog.retry(config, retries, maxRetries, responseStatusCode, currentDelay);
296
389
  if (retryDelay > 0) {
297
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
390
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
298
391
  }
299
392
  }
300
393
  config.retryAttempts++;
@@ -302,6 +395,16 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
302
395
  continue;
303
396
  }
304
397
  if (statusOnNext === "success") {
398
+ const totalDuration = performance.now() - timing.startTime;
399
+ debugLog.response(config, response.status, response.statusText, totalDuration);
400
+ if (response.headers) {
401
+ const headersObj = response.headers instanceof RezoHeaders ? response.headers.toObject() : response.headers;
402
+ debugLog.responseHeaders(config, headersObj);
403
+ }
404
+ if (response.cookies?.array) {
405
+ debugLog.cookies(config, response.cookies.array.length);
406
+ }
407
+ debugLog.complete(config, response.finalUrl || requestUrl, config.redirectCount, totalDuration);
305
408
  return response;
306
409
  }
307
410
  if (statusOnNext === "redirect") {
@@ -363,8 +466,8 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
363
466
  addedOptions.customHeaders = customHeaders;
364
467
  addedOptions.fullUrl = fetchOptions.fullUrl;
365
468
  delete options.params;
469
+ const fromUrl = fetchOptions.fullUrl;
366
470
  fetchOptions.fullUrl = location;
367
- let commented = false;
368
471
  if (typeof onRedirect === "object" && onRedirect.redirect) {
369
472
  const method = onRedirect.method || fetchOptions.method;
370
473
  config.method = method;
@@ -375,26 +478,16 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
375
478
  } else if (onRedirect.body) {
376
479
  options.body = onRedirect.body;
377
480
  }
378
- if (config.debug) {
379
- commented = true;
380
- console.log(`
381
- Redirecting to: ${fetchOptions.fullUrl} using ${method} method`);
382
- }
481
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, method);
383
482
  if (onRedirect.setHeaders) {
384
483
  addedOptions.customHeaders = onRedirect.setHeaders;
385
484
  }
386
485
  } else if (response.status === 301 || response.status === 302 || response.status === 303) {
387
- if (config.debug) {
388
- commented = true;
389
- console.log(`
390
- Redirecting to: ${fetchOptions.fullUrl} using GET method`);
391
- }
486
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, "GET");
392
487
  options.method = "GET";
393
488
  delete options.body;
394
- } else
395
- commented = false;
396
- if (config.debug && !commented) {
397
- console.log(`Redirecting to: ${fetchOptions.fullUrl}`);
489
+ } else {
490
+ debugLog.redirect(config, fromUrl, fetchOptions.fullUrl, redirectCode, fetchOptions.method);
398
491
  }
399
492
  const __ = prepareHTTPOptions(fetchOptions, config.cookieJar, addedOptions, config);
400
493
  fetchOptions = __.fetchOptions;
@@ -414,11 +507,10 @@ Redirecting to: ${fetchOptions.fullUrl} using GET method`);
414
507
  duration: perform.now()
415
508
  });
416
509
  perform.reset();
417
- if (config.debug) {
418
- console.log(`Request failed with status code ${response.status}, retrying...${retryDelay > 0 ? " in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
419
- }
510
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
511
+ debugLog.retry(config, retries, maxRetries, response.status, currentDelay);
420
512
  if (retryDelay > 0) {
421
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
513
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
422
514
  }
423
515
  continue;
424
516
  }
@@ -1092,7 +1184,7 @@ async function setInitialConfig(config, fetchOptions, isSecure, url, httpModule,
1092
1184
  };
1093
1185
  config.retryAttempts = 0;
1094
1186
  config.errors = [];
1095
- config.debug = fetchOptions.debug || false;
1187
+ config.debug = config.debug || fetchOptions.debug || false;
1096
1188
  config.requestId = generateRequestId();
1097
1189
  config.sessionId = fetchOptions.sessionId || generateSessionId();
1098
1190
  config.traceId = generateTraceId();
@@ -1,6 +1,6 @@
1
- const _mod_bqck0c = require('./picker.cjs');
2
- exports.detectRuntime = _mod_bqck0c.detectRuntime;
3
- exports.getAdapterCapabilities = _mod_bqck0c.getAdapterCapabilities;
4
- exports.buildAdapterContext = _mod_bqck0c.buildAdapterContext;
5
- exports.getAvailableAdapters = _mod_bqck0c.getAvailableAdapters;
6
- exports.selectAdapter = _mod_bqck0c.selectAdapter;;
1
+ const _mod_i8j93l = require('./picker.cjs');
2
+ exports.detectRuntime = _mod_i8j93l.detectRuntime;
3
+ exports.getAdapterCapabilities = _mod_i8j93l.getAdapterCapabilities;
4
+ exports.buildAdapterContext = _mod_i8j93l.buildAdapterContext;
5
+ exports.getAvailableAdapters = _mod_i8j93l.getAvailableAdapters;
6
+ exports.selectAdapter = _mod_i8j93l.selectAdapter;;
@@ -1,13 +1,13 @@
1
- const _mod_fg8y0s = require('./lru-cache.cjs');
2
- exports.LRUCache = _mod_fg8y0s.LRUCache;;
3
- const _mod_d9ee9q = require('./dns-cache.cjs');
4
- exports.DNSCache = _mod_d9ee9q.DNSCache;
5
- exports.getGlobalDNSCache = _mod_d9ee9q.getGlobalDNSCache;
6
- exports.resetGlobalDNSCache = _mod_d9ee9q.resetGlobalDNSCache;;
7
- const _mod_51nr1u = require('./response-cache.cjs');
8
- exports.ResponseCache = _mod_51nr1u.ResponseCache;
9
- exports.normalizeResponseCacheConfig = _mod_51nr1u.normalizeResponseCacheConfig;;
10
- const _mod_2jkzye = require('./file-cacher.cjs');
11
- exports.FileCacher = _mod_2jkzye.FileCacher;;
12
- const _mod_i5wcku = require('./url-store.cjs');
13
- exports.UrlStore = _mod_i5wcku.UrlStore;;
1
+ const _mod_u4xci6 = require('./lru-cache.cjs');
2
+ exports.LRUCache = _mod_u4xci6.LRUCache;;
3
+ const _mod_ssvr55 = require('./dns-cache.cjs');
4
+ exports.DNSCache = _mod_ssvr55.DNSCache;
5
+ exports.getGlobalDNSCache = _mod_ssvr55.getGlobalDNSCache;
6
+ exports.resetGlobalDNSCache = _mod_ssvr55.resetGlobalDNSCache;;
7
+ const _mod_j1uyaq = require('./response-cache.cjs');
8
+ exports.ResponseCache = _mod_j1uyaq.ResponseCache;
9
+ exports.normalizeResponseCacheConfig = _mod_j1uyaq.normalizeResponseCacheConfig;;
10
+ const _mod_elmslk = require('./file-cacher.cjs');
11
+ exports.FileCacher = _mod_elmslk.FileCacher;;
12
+ const _mod_2oycgy = require('./url-store.cjs');
13
+ exports.UrlStore = _mod_2oycgy.UrlStore;;
package/dist/crawler.d.ts CHANGED
@@ -2108,6 +2108,8 @@ export interface RezoConfig {
2108
2108
  };
2109
2109
  /** @description Debug mode flag */
2110
2110
  debug?: boolean;
2111
+ /** @description URL tracking mode flag - logs redirect chain and retries */
2112
+ trackUrl?: boolean;
2111
2113
  /** @description Request tracking identifier */
2112
2114
  requestId: string;
2113
2115
  /** @description Session identifier */
@@ -2871,6 +2873,12 @@ export interface RezoRequestConfig<D = any> {
2871
2873
  debug?: boolean;
2872
2874
  /** Enable verbose logging with detailed information */
2873
2875
  verbose?: boolean;
2876
+ /**
2877
+ * Enable URL tracking to log the complete redirect chain with status codes.
2878
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2879
+ * Also logs retry attempts with their status codes.
2880
+ */
2881
+ trackUrl?: boolean;
2874
2882
  /** Name of the cookie containing XSRF token */
2875
2883
  xsrfCookieName?: string;
2876
2884
  /** Name of the header to send XSRF token in */
@@ -3352,6 +3360,8 @@ export interface RezoDefaultOptions {
3352
3360
  debug?: RezoHttpRequest["debug"];
3353
3361
  /** Enable verbose logging with detailed information */
3354
3362
  verbose?: RezoHttpRequest["verbose"];
3363
+ /** Enable URL tracking to log redirect chain and retry attempts */
3364
+ trackUrl?: RezoHttpRequest["trackUrl"];
3355
3365
  /** HTTP agent for HTTP requests */
3356
3366
  httpAgent?: RezoHttpRequest["httpAgent"];
3357
3367
  /** HTTPS agent for HTTPS requests */
@@ -1,5 +1,5 @@
1
- const _mod_zp4coa = require('../plugin/crawler.cjs');
2
- exports.Crawler = _mod_zp4coa.Crawler;;
3
- const _mod_51qrvf = require('../plugin/crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_51qrvf.CrawlerOptions;
5
- exports.Domain = _mod_51qrvf.Domain;;
1
+ const _mod_kiri7j = require('../plugin/crawler.cjs');
2
+ exports.Crawler = _mod_kiri7j.Crawler;;
3
+ const _mod_ebqdnd = require('../plugin/crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_ebqdnd.CrawlerOptions;
5
+ exports.Domain = _mod_ebqdnd.Domain;;
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
- const _mod_oizfvr = require('./core/rezo.cjs');
2
- exports.Rezo = _mod_oizfvr.Rezo;
3
- exports.createRezoInstance = _mod_oizfvr.createRezoInstance;
4
- exports.createDefaultInstance = _mod_oizfvr.createDefaultInstance;;
5
- const _mod_qu51yw = require('./errors/rezo-error.cjs');
6
- exports.RezoError = _mod_qu51yw.RezoError;
7
- exports.RezoErrorCode = _mod_qu51yw.RezoErrorCode;;
8
- const _mod_bte93i = require('./utils/headers.cjs');
9
- exports.RezoHeaders = _mod_bte93i.RezoHeaders;;
10
- const _mod_4uvb34 = require('./utils/form-data.cjs');
11
- exports.RezoFormData = _mod_4uvb34.RezoFormData;;
12
- const _mod_hapyam = require('./utils/cookies.cjs');
13
- exports.RezoCookieJar = _mod_hapyam.RezoCookieJar;
14
- exports.Cookie = _mod_hapyam.Cookie;;
15
- const _mod_z3zy00 = require('./core/hooks.cjs');
16
- exports.createDefaultHooks = _mod_z3zy00.createDefaultHooks;
17
- exports.mergeHooks = _mod_z3zy00.mergeHooks;;
18
- const _mod_az3xj2 = require('./proxy/manager.cjs');
19
- exports.ProxyManager = _mod_az3xj2.ProxyManager;;
20
- const _mod_p07g34 = require('./queue/index.cjs');
21
- exports.RezoQueue = _mod_p07g34.RezoQueue;
22
- exports.HttpQueue = _mod_p07g34.HttpQueue;
23
- exports.Priority = _mod_p07g34.Priority;
24
- exports.HttpMethodPriority = _mod_p07g34.HttpMethodPriority;;
1
+ const _mod_yjmdny = require('./core/rezo.cjs');
2
+ exports.Rezo = _mod_yjmdny.Rezo;
3
+ exports.createRezoInstance = _mod_yjmdny.createRezoInstance;
4
+ exports.createDefaultInstance = _mod_yjmdny.createDefaultInstance;;
5
+ const _mod_pedo7e = require('./errors/rezo-error.cjs');
6
+ exports.RezoError = _mod_pedo7e.RezoError;
7
+ exports.RezoErrorCode = _mod_pedo7e.RezoErrorCode;;
8
+ const _mod_57z5dh = require('./utils/headers.cjs');
9
+ exports.RezoHeaders = _mod_57z5dh.RezoHeaders;;
10
+ const _mod_0b2cgv = require('./utils/form-data.cjs');
11
+ exports.RezoFormData = _mod_0b2cgv.RezoFormData;;
12
+ const _mod_9plnvx = require('./utils/cookies.cjs');
13
+ exports.RezoCookieJar = _mod_9plnvx.RezoCookieJar;
14
+ exports.Cookie = _mod_9plnvx.Cookie;;
15
+ const _mod_snalmm = require('./core/hooks.cjs');
16
+ exports.createDefaultHooks = _mod_snalmm.createDefaultHooks;
17
+ exports.mergeHooks = _mod_snalmm.mergeHooks;;
18
+ const _mod_ykdb7e = require('./proxy/manager.cjs');
19
+ exports.ProxyManager = _mod_ykdb7e.ProxyManager;;
20
+ const _mod_tkp5ey = require('./queue/index.cjs');
21
+ exports.RezoQueue = _mod_tkp5ey.RezoQueue;
22
+ exports.HttpQueue = _mod_tkp5ey.HttpQueue;
23
+ exports.Priority = _mod_tkp5ey.Priority;
24
+ exports.HttpMethodPriority = _mod_tkp5ey.HttpMethodPriority;;
25
25
  const { RezoError } = require('./errors/rezo-error.cjs');
26
26
  const isRezoError = exports.isRezoError = RezoError.isRezoError;
27
27
  const Cancel = exports.Cancel = RezoError;
package/dist/index.d.ts CHANGED
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2879,6 +2881,12 @@ export interface RezoRequestConfig<D = any> {
2879
2881
  debug?: boolean;
2880
2882
  /** Enable verbose logging with detailed information */
2881
2883
  verbose?: boolean;
2884
+ /**
2885
+ * Enable URL tracking to log the complete redirect chain with status codes.
2886
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2887
+ * Also logs retry attempts with their status codes.
2888
+ */
2889
+ trackUrl?: boolean;
2882
2890
  /** Name of the cookie containing XSRF token */
2883
2891
  xsrfCookieName?: string;
2884
2892
  /** Name of the header to send XSRF token in */
@@ -3379,6 +3387,8 @@ export interface RezoDefaultOptions {
3379
3387
  debug?: RezoHttpRequest["debug"];
3380
3388
  /** Enable verbose logging with detailed information */
3381
3389
  verbose?: RezoHttpRequest["verbose"];
3390
+ /** Enable URL tracking to log redirect chain and retry attempts */
3391
+ trackUrl?: RezoHttpRequest["trackUrl"];
3382
3392
  /** HTTP agent for HTTP requests */
3383
3393
  httpAgent?: RezoHttpRequest["httpAgent"];
3384
3394
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1894,6 +1894,8 @@ export interface RezoConfig {
1894
1894
  };
1895
1895
  /** @description Debug mode flag */
1896
1896
  debug?: boolean;
1897
+ /** @description URL tracking mode flag - logs redirect chain and retries */
1898
+ trackUrl?: boolean;
1897
1899
  /** @description Request tracking identifier */
1898
1900
  requestId: string;
1899
1901
  /** @description Session identifier */
@@ -2753,6 +2755,12 @@ export interface RezoRequestConfig<D = any> {
2753
2755
  debug?: boolean;
2754
2756
  /** Enable verbose logging with detailed information */
2755
2757
  verbose?: boolean;
2758
+ /**
2759
+ * Enable URL tracking to log the complete redirect chain with status codes.
2760
+ * When enabled, logs: initial URL -> redirect URL (status code) -> final URL
2761
+ * Also logs retry attempts with their status codes.
2762
+ */
2763
+ trackUrl?: boolean;
2756
2764
  /** Name of the cookie containing XSRF token */
2757
2765
  xsrfCookieName?: string;
2758
2766
  /** Name of the header to send XSRF token in */
@@ -3234,6 +3242,8 @@ export interface RezoDefaultOptions {
3234
3242
  debug?: RezoHttpRequest["debug"];
3235
3243
  /** Enable verbose logging with detailed information */
3236
3244
  verbose?: RezoHttpRequest["verbose"];
3245
+ /** Enable URL tracking to log redirect chain and retry attempts */
3246
+ trackUrl?: RezoHttpRequest["trackUrl"];
3237
3247
  /** HTTP agent for HTTP requests */
3238
3248
  httpAgent?: RezoHttpRequest["httpAgent"];
3239
3249
  /** HTTPS agent for HTTPS requests */
@@ -1,36 +1,36 @@
1
- const _mod_z69h94 = require('./crawler.cjs');
2
- exports.Crawler = _mod_z69h94.Crawler;;
3
- const _mod_07ety8 = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_07ety8.CrawlerOptions;;
5
- const _mod_eg5m4g = require('../cache/file-cacher.cjs');
6
- exports.FileCacher = _mod_eg5m4g.FileCacher;;
7
- const _mod_usnwut = require('../cache/url-store.cjs');
8
- exports.UrlStore = _mod_usnwut.UrlStore;;
9
- const _mod_ey86ej = require('./addon/oxylabs/index.cjs');
10
- exports.Oxylabs = _mod_ey86ej.Oxylabs;;
11
- const _mod_v4cebu = require('./addon/oxylabs/options.cjs');
12
- exports.OXYLABS_BROWSER_TYPES = _mod_v4cebu.OXYLABS_BROWSER_TYPES;
13
- exports.OXYLABS_COMMON_LOCALES = _mod_v4cebu.OXYLABS_COMMON_LOCALES;
14
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_v4cebu.OXYLABS_COMMON_GEO_LOCATIONS;
15
- exports.OXYLABS_US_STATES = _mod_v4cebu.OXYLABS_US_STATES;
16
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_v4cebu.OXYLABS_EUROPEAN_COUNTRIES;
17
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_v4cebu.OXYLABS_ASIAN_COUNTRIES;
18
- exports.getRandomOxylabsBrowserType = _mod_v4cebu.getRandomBrowserType;
19
- exports.getRandomOxylabsLocale = _mod_v4cebu.getRandomLocale;
20
- exports.getRandomOxylabsGeoLocation = _mod_v4cebu.getRandomGeoLocation;;
21
- const _mod_48cudr = require('./addon/decodo/index.cjs');
22
- exports.Decodo = _mod_48cudr.Decodo;;
23
- const _mod_xm7sss = require('./addon/decodo/options.cjs');
24
- exports.DECODO_DEVICE_TYPES = _mod_xm7sss.DECODO_DEVICE_TYPES;
25
- exports.DECODO_HEADLESS_MODES = _mod_xm7sss.DECODO_HEADLESS_MODES;
26
- exports.DECODO_COMMON_LOCALES = _mod_xm7sss.DECODO_COMMON_LOCALES;
27
- exports.DECODO_COMMON_COUNTRIES = _mod_xm7sss.DECODO_COMMON_COUNTRIES;
28
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_xm7sss.DECODO_EUROPEAN_COUNTRIES;
29
- exports.DECODO_ASIAN_COUNTRIES = _mod_xm7sss.DECODO_ASIAN_COUNTRIES;
30
- exports.DECODO_US_STATES = _mod_xm7sss.DECODO_US_STATES;
31
- exports.DECODO_COMMON_CITIES = _mod_xm7sss.DECODO_COMMON_CITIES;
32
- exports.getRandomDecodoDeviceType = _mod_xm7sss.getRandomDeviceType;
33
- exports.getRandomDecodoLocale = _mod_xm7sss.getRandomLocale;
34
- exports.getRandomDecodoCountry = _mod_xm7sss.getRandomCountry;
35
- exports.getRandomDecodoCity = _mod_xm7sss.getRandomCity;
36
- exports.generateDecodoSessionId = _mod_xm7sss.generateSessionId;;
1
+ const _mod_d2fs1r = require('./crawler.cjs');
2
+ exports.Crawler = _mod_d2fs1r.Crawler;;
3
+ const _mod_rw2tl2 = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_rw2tl2.CrawlerOptions;;
5
+ const _mod_ojfrlz = require('../cache/file-cacher.cjs');
6
+ exports.FileCacher = _mod_ojfrlz.FileCacher;;
7
+ const _mod_f7svon = require('../cache/url-store.cjs');
8
+ exports.UrlStore = _mod_f7svon.UrlStore;;
9
+ const _mod_av2vpi = require('./addon/oxylabs/index.cjs');
10
+ exports.Oxylabs = _mod_av2vpi.Oxylabs;;
11
+ const _mod_3bwnlf = require('./addon/oxylabs/options.cjs');
12
+ exports.OXYLABS_BROWSER_TYPES = _mod_3bwnlf.OXYLABS_BROWSER_TYPES;
13
+ exports.OXYLABS_COMMON_LOCALES = _mod_3bwnlf.OXYLABS_COMMON_LOCALES;
14
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_3bwnlf.OXYLABS_COMMON_GEO_LOCATIONS;
15
+ exports.OXYLABS_US_STATES = _mod_3bwnlf.OXYLABS_US_STATES;
16
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_3bwnlf.OXYLABS_EUROPEAN_COUNTRIES;
17
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_3bwnlf.OXYLABS_ASIAN_COUNTRIES;
18
+ exports.getRandomOxylabsBrowserType = _mod_3bwnlf.getRandomBrowserType;
19
+ exports.getRandomOxylabsLocale = _mod_3bwnlf.getRandomLocale;
20
+ exports.getRandomOxylabsGeoLocation = _mod_3bwnlf.getRandomGeoLocation;;
21
+ const _mod_638gbd = require('./addon/decodo/index.cjs');
22
+ exports.Decodo = _mod_638gbd.Decodo;;
23
+ const _mod_qiyxyy = require('./addon/decodo/options.cjs');
24
+ exports.DECODO_DEVICE_TYPES = _mod_qiyxyy.DECODO_DEVICE_TYPES;
25
+ exports.DECODO_HEADLESS_MODES = _mod_qiyxyy.DECODO_HEADLESS_MODES;
26
+ exports.DECODO_COMMON_LOCALES = _mod_qiyxyy.DECODO_COMMON_LOCALES;
27
+ exports.DECODO_COMMON_COUNTRIES = _mod_qiyxyy.DECODO_COMMON_COUNTRIES;
28
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_qiyxyy.DECODO_EUROPEAN_COUNTRIES;
29
+ exports.DECODO_ASIAN_COUNTRIES = _mod_qiyxyy.DECODO_ASIAN_COUNTRIES;
30
+ exports.DECODO_US_STATES = _mod_qiyxyy.DECODO_US_STATES;
31
+ exports.DECODO_COMMON_CITIES = _mod_qiyxyy.DECODO_COMMON_CITIES;
32
+ exports.getRandomDecodoDeviceType = _mod_qiyxyy.getRandomDeviceType;
33
+ exports.getRandomDecodoLocale = _mod_qiyxyy.getRandomLocale;
34
+ exports.getRandomDecodoCountry = _mod_qiyxyy.getRandomCountry;
35
+ exports.getRandomDecodoCity = _mod_qiyxyy.getRandomCity;
36
+ exports.generateDecodoSessionId = _mod_qiyxyy.generateSessionId;;
@@ -1,8 +1,8 @@
1
1
  const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
2
2
  const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
3
3
  const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
4
- const _mod_0rf8oz = require('./manager.cjs');
5
- exports.ProxyManager = _mod_0rf8oz.ProxyManager;;
4
+ const _mod_66f5p2 = require('./manager.cjs');
5
+ exports.ProxyManager = _mod_66f5p2.ProxyManager;;
6
6
  function createOptions(uri, opts) {
7
7
  if (uri instanceof URL || typeof uri === "string") {
8
8
  return {
@@ -1,8 +1,8 @@
1
- const _mod_uj0e3i = require('./queue.cjs');
2
- exports.RezoQueue = _mod_uj0e3i.RezoQueue;;
3
- const _mod_njblqt = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_njblqt.HttpQueue;
5
- exports.extractDomain = _mod_njblqt.extractDomain;;
6
- const _mod_2of4ac = require('./types.cjs');
7
- exports.Priority = _mod_2of4ac.Priority;
8
- exports.HttpMethodPriority = _mod_2of4ac.HttpMethodPriority;;
1
+ const _mod_2tqq2b = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_2tqq2b.RezoQueue;;
3
+ const _mod_q3g9kv = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_q3g9kv.HttpQueue;
5
+ exports.extractDomain = _mod_q3g9kv.extractDomain;;
6
+ const _mod_hjfp53 = require('./types.cjs');
7
+ exports.Priority = _mod_hjfp53.Priority;
8
+ exports.HttpMethodPriority = _mod_hjfp53.HttpMethodPriority;;
@@ -446,7 +446,7 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
446
446
  fetchOptions.sessionId = options.sessionId;
447
447
  }
448
448
  let resolvedProxyManager = null;
449
- const pm = addedOptions.defaultOptions.proxyManager;
449
+ const pm = addedOptions?.defaultOptions?.proxyManager;
450
450
  if (pm && options.useProxyManager !== false && !options.proxy) {
451
451
  resolvedProxyManager = pm;
452
452
  }
@@ -582,7 +582,9 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
582
582
  proxy: normalizedProxy,
583
583
  enableRedirectCycleDetection,
584
584
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
- decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
585
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true,
586
+ debug: requestOptions.debug === true || defaultOptions.debug === true,
587
+ trackUrl: requestOptions.trackUrl === true || defaultOptions.trackUrl === true
586
588
  };
587
589
  config.setSignal = setSignal.bind(config);
588
590
  if (requestOptions.encoding || defaultOptions.encoding) {
@@ -446,7 +446,7 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
446
446
  fetchOptions.sessionId = options.sessionId;
447
447
  }
448
448
  let resolvedProxyManager = null;
449
- const pm = addedOptions.defaultOptions.proxyManager;
449
+ const pm = addedOptions?.defaultOptions?.proxyManager;
450
450
  if (pm && options.useProxyManager !== false && !options.proxy) {
451
451
  resolvedProxyManager = pm;
452
452
  }
@@ -582,7 +582,9 @@ As a workaround, process.env.NODE_TLS_REJECT_UNAUTHORIZED is being set to '0'.
582
582
  proxy: normalizedProxy,
583
583
  enableRedirectCycleDetection,
584
584
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : true,
585
- decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true
585
+ decompress: typeof requestOptions.decompress === "boolean" ? requestOptions.decompress : typeof defaultOptions.decompress === "boolean" ? defaultOptions.decompress : true,
586
+ debug: requestOptions.debug === true || defaultOptions.debug === true,
587
+ trackUrl: requestOptions.trackUrl === true || defaultOptions.trackUrl === true
586
588
  };
587
589
  config.setSignal = setSignal.bind(config);
588
590
  if (requestOptions.encoding || defaultOptions.encoding) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",