rezo 1.0.20 → 1.0.22

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.
@@ -424,6 +424,40 @@ export function getHttpErrorMessage(statusCode) {
424
424
  };
425
425
  return statusMessages[statusCode] || `HTTP Error ${statusCode}: The server responded with a non-successful status code.`;
426
426
  }
427
+ export function getHttpStatusText(statusCode) {
428
+ const statusTexts = {
429
+ 200: "OK",
430
+ 201: "Created",
431
+ 202: "Accepted",
432
+ 204: "No Content",
433
+ 301: "Moved Permanently",
434
+ 302: "Found",
435
+ 303: "See Other",
436
+ 304: "Not Modified",
437
+ 307: "Temporary Redirect",
438
+ 308: "Permanent Redirect",
439
+ 400: "Bad Request",
440
+ 401: "Unauthorized",
441
+ 403: "Forbidden",
442
+ 404: "Not Found",
443
+ 405: "Method Not Allowed",
444
+ 408: "Request Timeout",
445
+ 409: "Conflict",
446
+ 410: "Gone",
447
+ 413: "Payload Too Large",
448
+ 414: "URI Too Long",
449
+ 415: "Unsupported Media Type",
450
+ 422: "Unprocessable Entity",
451
+ 429: "Too Many Requests",
452
+ 500: "Internal Server Error",
453
+ 501: "Not Implemented",
454
+ 502: "Bad Gateway",
455
+ 503: "Service Unavailable",
456
+ 504: "Gateway Timeout",
457
+ 505: "HTTP Version Not Supported"
458
+ };
459
+ return statusTexts[statusCode] || "Unknown Status";
460
+ }
427
461
  export function getCode(code) {
428
462
  const error = ERROR_INFO[code];
429
463
  if (error) {
@@ -544,17 +578,15 @@ export class RezoError extends Error {
544
578
  if (code) {
545
579
  const errorInfo = getCode(code);
546
580
  Object.defineProperty(this, "errno", { value: errorInfo.errno, enumerable: false });
547
- Object.defineProperty(this, "details", { value: errorInfo.details, enumerable: false });
548
581
  Object.defineProperty(this, "suggestion", { value: errorInfo.suggestion, enumerable: false });
549
582
  this.message = errorInfo.message;
550
583
  } else {
551
584
  this.message = message;
552
- Object.defineProperty(this, "details", { value: message, enumerable: false });
553
- Object.defineProperty(this, "suggestion", { value: "Check the error details for more information.", enumerable: false });
585
+ Object.defineProperty(this, "suggestion", { value: "Check the error for more information.", enumerable: false });
554
586
  }
555
587
  if (response) {
556
- Object.defineProperty(this, "status", { value: response.status, enumerable: false });
557
- Object.defineProperty(this, "statusText", { value: response.statusText, enumerable: false });
588
+ Object.defineProperty(this, "status", { value: response.status, enumerable: false, configurable: true });
589
+ Object.defineProperty(this, "statusText", { value: response.statusText, enumerable: false, configurable: true });
558
590
  }
559
591
  this.name = this.constructor.name;
560
592
  Object.setPrototypeOf(this, RezoError.prototype);
@@ -568,17 +600,71 @@ export class RezoError extends Error {
568
600
  }
569
601
  }
570
602
  }
571
- [Symbol.for("nodejs.util.inspect.custom")](_depth, _options) {
603
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, options) {
572
604
  const parts = [];
605
+ const isDebug = this.config?.debug === true;
606
+ const inspect = options?.stylize ? (v) => require("util").inspect(v, { depth: 3, colors: true }) : JSON.stringify;
573
607
  parts.push(`${this.name}: ${this.message}`);
574
- if (this.code) {
608
+ if (this.code)
575
609
  parts.push(` code: '${this.code}'`);
610
+ if (this.method)
611
+ parts.push(` method: '${this.method}'`);
612
+ if (this.url)
613
+ parts.push(` url: '${this.url}'`);
614
+ if (this.finalUrl && this.finalUrl !== this.url) {
615
+ parts.push(` finalUrl: '${this.finalUrl}'`);
576
616
  }
577
- if (this.details && this.details !== this.message) {
578
- parts.push(` details: ${this.details}`);
617
+ if (this.status)
618
+ parts.push(` status: ${this.status}`);
619
+ if (this.statusText)
620
+ parts.push(` statusText: '${this.statusText}'`);
621
+ if (this.urls && this.urls.length > 1) {
622
+ parts.push(` urls: [${this.urls.map((u) => `'${u}'`).join(", ")}]`);
579
623
  }
580
- if (this.suggestion) {
624
+ if (this.suggestion)
581
625
  parts.push(` suggestion: ${this.suggestion}`);
626
+ if (isDebug) {
627
+ parts.push("");
628
+ parts.push(" --- Debug Info ---");
629
+ if (this.cause) {
630
+ const causeMsg = typeof this.cause === "string" ? this.cause : this.cause?.message || String(this.cause);
631
+ parts.push(` cause: ${causeMsg}`);
632
+ }
633
+ if (this.errno)
634
+ parts.push(` errno: ${this.errno}`);
635
+ if (this.hostname)
636
+ parts.push(` hostname: '${this.hostname}'`);
637
+ if (this.port)
638
+ parts.push(` port: ${this.port}`);
639
+ if (this.address)
640
+ parts.push(` address: '${this.address}'`);
641
+ if (this.syscall)
642
+ parts.push(` syscall: '${this.syscall}'`);
643
+ if (this.response) {
644
+ parts.push("");
645
+ parts.push(" --- Response ---");
646
+ parts.push(` response.status: ${this.response.status}`);
647
+ parts.push(` response.statusText: '${this.response.statusText || ""}'`);
648
+ parts.push(` response.finalUrl: '${this.response.finalUrl || ""}'`);
649
+ if (this.response.headers) {
650
+ parts.push(` response.headers: ${inspect(this.response.headers)}`);
651
+ }
652
+ if (this.response.data !== undefined) {
653
+ const dataStr = typeof this.response.data === "string" ? this.response.data.substring(0, 500) + (this.response.data.length > 500 ? "..." : "") : inspect(this.response.data);
654
+ parts.push(` response.data: ${dataStr}`);
655
+ }
656
+ }
657
+ if (this.response?.config) {
658
+ parts.push("");
659
+ parts.push(" --- Request Config ---");
660
+ const { cookieJar, ...configWithoutJar } = this.response.config;
661
+ parts.push(` config: ${inspect(configWithoutJar)}`);
662
+ }
663
+ if (this.stack) {
664
+ parts.push("");
665
+ parts.push(" --- Stack Trace ---");
666
+ parts.push(this.stack);
667
+ }
582
668
  }
583
669
  return parts.join(`
584
670
  `);
@@ -612,8 +698,20 @@ export class RezoError extends Error {
612
698
  return new RezoError(message, config, code, request);
613
699
  }
614
700
  static createHttpError(statusCode, config, request, response) {
615
- const error = new RezoError(getHttpErrorMessage(statusCode), config, "REZ_HTTP_ERROR", request, response);
616
- Object.defineProperty(error, "status", { value: statusCode, enumerable: false });
701
+ const method = (config.method || request?.method || "GET").toUpperCase();
702
+ const url = config.fullUrl || config.url || request?.url || "unknown";
703
+ const statusText = response?.statusText || getHttpStatusText(statusCode);
704
+ const finalUrl = response?.finalUrl || url;
705
+ const urls = response?.urls || [url];
706
+ const message = `Request failed with status code ${statusCode}`;
707
+ const error = new RezoError(message, config, "REZ_HTTP_ERROR", request, response);
708
+ error.message = message;
709
+ Object.defineProperty(error, "status", { value: statusCode, enumerable: true });
710
+ Object.defineProperty(error, "statusText", { value: statusText, enumerable: true });
711
+ Object.defineProperty(error, "method", { value: method, enumerable: true });
712
+ Object.defineProperty(error, "url", { value: url, enumerable: true });
713
+ Object.defineProperty(error, "finalUrl", { value: finalUrl, enumerable: true });
714
+ Object.defineProperty(error, "urls", { value: urls, enumerable: true });
617
715
  return error;
618
716
  }
619
717
  static createTimeoutError(message, config, request) {
@@ -670,14 +768,20 @@ export class RezoError extends Error {
670
768
  };
671
769
  if (this.code !== undefined)
672
770
  result.code = this.code;
673
- if (this.details !== undefined)
674
- result.details = this.details;
675
- if (this.suggestion !== undefined)
676
- result.suggestion = this.suggestion;
771
+ if (this.method !== undefined)
772
+ result.method = this.method;
773
+ if (this.url !== undefined)
774
+ result.url = this.url;
775
+ if (this.finalUrl !== undefined)
776
+ result.finalUrl = this.finalUrl;
677
777
  if (this.status !== undefined)
678
778
  result.status = this.status;
679
779
  if (this.statusText !== undefined)
680
780
  result.statusText = this.statusText;
781
+ if (this.urls !== undefined)
782
+ result.urls = this.urls;
783
+ if (this.cause)
784
+ result.cause = typeof this.cause === "string" ? this.cause : this.cause?.message || null;
681
785
  return result;
682
786
  }
683
787
  toString() {
@@ -689,26 +793,39 @@ export class RezoError extends Error {
689
793
  }
690
794
  getFullDetails() {
691
795
  let result = `${this.name}: ${this.message}
692
- `;
693
- result += `
694
- Details: ${this.details}
695
- `;
696
- result += `Suggestion: ${this.suggestion}
697
796
  `;
698
797
  if (this.code)
699
798
  result += `Code: ${this.code}
700
799
  `;
701
- if (this.errno)
702
- result += `Error Number: ${this.errno}
800
+ if (this.method)
801
+ result += `Method: ${this.method}
802
+ `;
803
+ if (this.url)
804
+ result += `URL: ${this.url}
703
805
  `;
806
+ if (this.finalUrl && this.finalUrl !== this.url) {
807
+ result += `Final URL: ${this.finalUrl}
808
+ `;
809
+ }
704
810
  if (this.status)
705
811
  result += `HTTP Status: ${this.status} ${this.statusText || ""}
812
+ `;
813
+ if (this.urls && this.urls.length > 1) {
814
+ result += `Redirect Chain: ${this.urls.join(" -> ")}
815
+ `;
816
+ }
817
+ if (this.errno)
818
+ result += `Error Number: ${this.errno}
706
819
  `;
707
820
  if (this.hostname)
708
821
  result += `Host: ${this.hostname}
709
822
  `;
710
823
  if (this.port)
711
824
  result += `Port: ${this.port}
825
+ `;
826
+ if (this.suggestion)
827
+ result += `
828
+ Suggestion: ${this.suggestion}
712
829
  `;
713
830
  return result;
714
831
  }
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
- const _mod_duhs83 = require('./core/rezo.cjs');
2
- exports.Rezo = _mod_duhs83.Rezo;
3
- exports.createRezoInstance = _mod_duhs83.createRezoInstance;
4
- exports.createDefaultInstance = _mod_duhs83.createDefaultInstance;;
5
- const _mod_8z3sz9 = require('./errors/rezo-error.cjs');
6
- exports.RezoError = _mod_8z3sz9.RezoError;
7
- exports.RezoErrorCode = _mod_8z3sz9.RezoErrorCode;;
8
- const _mod_o75xf9 = require('./utils/headers.cjs');
9
- exports.RezoHeaders = _mod_o75xf9.RezoHeaders;;
10
- const _mod_igc0kq = require('./utils/form-data.cjs');
11
- exports.RezoFormData = _mod_igc0kq.RezoFormData;;
12
- const _mod_kuocqq = require('./utils/cookies.cjs');
13
- exports.RezoCookieJar = _mod_kuocqq.RezoCookieJar;
14
- exports.Cookie = _mod_kuocqq.Cookie;;
15
- const _mod_k7ozxh = require('./core/hooks.cjs');
16
- exports.createDefaultHooks = _mod_k7ozxh.createDefaultHooks;
17
- exports.mergeHooks = _mod_k7ozxh.mergeHooks;;
18
- const _mod_5af6mv = require('./proxy/manager.cjs');
19
- exports.ProxyManager = _mod_5af6mv.ProxyManager;;
20
- const _mod_ahusy5 = require('./queue/index.cjs');
21
- exports.RezoQueue = _mod_ahusy5.RezoQueue;
22
- exports.HttpQueue = _mod_ahusy5.HttpQueue;
23
- exports.Priority = _mod_ahusy5.Priority;
24
- exports.HttpMethodPriority = _mod_ahusy5.HttpMethodPriority;;
1
+ const _mod_hre6ec = require('./core/rezo.cjs');
2
+ exports.Rezo = _mod_hre6ec.Rezo;
3
+ exports.createRezoInstance = _mod_hre6ec.createRezoInstance;
4
+ exports.createDefaultInstance = _mod_hre6ec.createDefaultInstance;;
5
+ const _mod_wwq78e = require('./errors/rezo-error.cjs');
6
+ exports.RezoError = _mod_wwq78e.RezoError;
7
+ exports.RezoErrorCode = _mod_wwq78e.RezoErrorCode;;
8
+ const _mod_5wpolq = require('./utils/headers.cjs');
9
+ exports.RezoHeaders = _mod_5wpolq.RezoHeaders;;
10
+ const _mod_yody95 = require('./utils/form-data.cjs');
11
+ exports.RezoFormData = _mod_yody95.RezoFormData;;
12
+ const _mod_f843yl = require('./utils/cookies.cjs');
13
+ exports.RezoCookieJar = _mod_f843yl.RezoCookieJar;
14
+ exports.Cookie = _mod_f843yl.Cookie;;
15
+ const _mod_8zpp5z = require('./core/hooks.cjs');
16
+ exports.createDefaultHooks = _mod_8zpp5z.createDefaultHooks;
17
+ exports.mergeHooks = _mod_8zpp5z.mergeHooks;;
18
+ const _mod_60gu5s = require('./proxy/manager.cjs');
19
+ exports.ProxyManager = _mod_60gu5s.ProxyManager;;
20
+ const _mod_zuny9f = require('./queue/index.cjs');
21
+ exports.RezoQueue = _mod_zuny9f.RezoQueue;
22
+ exports.HttpQueue = _mod_zuny9f.HttpQueue;
23
+ exports.Priority = _mod_zuny9f.Priority;
24
+ exports.HttpMethodPriority = _mod_zuny9f.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
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2811,6 +2812,11 @@ export interface RezoRequestConfig<D = any> {
2811
2812
  * ```
2812
2813
  */
2813
2814
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2815
+ /**
2816
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2817
+ * @see beforeRedirect
2818
+ */
2819
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2814
2820
  /** Whether to send cookies and authorization headers with cross-origin requests */
2815
2821
  withCredentials?: boolean;
2816
2822
  /** Proxy configuration (URL string or detailed options) */
@@ -3379,6 +3385,8 @@ export interface RezoDefaultOptions {
3379
3385
  * ```
3380
3386
  */
3381
3387
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3388
+ /** Alias for beforeRedirect */
3389
+ onRedirect?: RezoHttpRequest["onRedirect"];
3382
3390
  /** Array of functions to transform request data */
3383
3391
  transformRequest?: RezoHttpRequest["transformRequest"];
3384
3392
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1934,6 +1934,8 @@ export interface RezoConfig {
1934
1934
  * ```
1935
1935
  */
1936
1936
  beforeRedirect?: RezoRequestConfig["beforeRedirect"];
1937
+ /** Alias for beforeRedirect */
1938
+ onRedirect?: RezoRequestConfig["beforeRedirect"];
1937
1939
  /** Character encoding for request body and response data */
1938
1940
  encoding?: BufferEncoding;
1939
1941
  /**
@@ -2014,7 +2016,6 @@ export declare class RezoError<T = any> extends Error {
2014
2016
  readonly isSocksError: boolean;
2015
2017
  readonly isTlsError: boolean;
2016
2018
  readonly isRetryable: boolean;
2017
- readonly details: string;
2018
2019
  readonly suggestion: string;
2019
2020
  constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
2020
2021
  static isRezoError(error: unknown): error is RezoError;
@@ -2685,6 +2686,11 @@ export interface RezoRequestConfig<D = any> {
2685
2686
  * ```
2686
2687
  */
2687
2688
  beforeRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2689
+ /**
2690
+ * Alias for beforeRedirect - callback invoked when a redirect response is received.
2691
+ * @see beforeRedirect
2692
+ */
2693
+ onRedirect?: (options: OnRedirectOptions) => OnRedirectResponse;
2688
2694
  /** Whether to send cookies and authorization headers with cross-origin requests */
2689
2695
  withCredentials?: boolean;
2690
2696
  /** Proxy configuration (URL string or detailed options) */
@@ -3234,6 +3240,8 @@ export interface RezoDefaultOptions {
3234
3240
  * ```
3235
3241
  */
3236
3242
  beforeRedirect?: RezoHttpRequest["beforeRedirect"];
3243
+ /** Alias for beforeRedirect */
3244
+ onRedirect?: RezoHttpRequest["onRedirect"];
3237
3245
  /** Array of functions to transform request data */
3238
3246
  transformRequest?: RezoHttpRequest["transformRequest"];
3239
3247
  /** Array of functions to transform response data */
@@ -1,36 +1,36 @@
1
- const _mod_2ijd3k = require('./crawler.cjs');
2
- exports.Crawler = _mod_2ijd3k.Crawler;;
3
- const _mod_gc69uh = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_gc69uh.CrawlerOptions;;
5
- const _mod_4wjcb5 = require('../cache/file-cacher.cjs');
6
- exports.FileCacher = _mod_4wjcb5.FileCacher;;
7
- const _mod_hoe0p4 = require('../cache/url-store.cjs');
8
- exports.UrlStore = _mod_hoe0p4.UrlStore;;
9
- const _mod_87dbqg = require('./addon/oxylabs/index.cjs');
10
- exports.Oxylabs = _mod_87dbqg.Oxylabs;;
11
- const _mod_0u3ysd = require('./addon/oxylabs/options.cjs');
12
- exports.OXYLABS_BROWSER_TYPES = _mod_0u3ysd.OXYLABS_BROWSER_TYPES;
13
- exports.OXYLABS_COMMON_LOCALES = _mod_0u3ysd.OXYLABS_COMMON_LOCALES;
14
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_0u3ysd.OXYLABS_COMMON_GEO_LOCATIONS;
15
- exports.OXYLABS_US_STATES = _mod_0u3ysd.OXYLABS_US_STATES;
16
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_0u3ysd.OXYLABS_EUROPEAN_COUNTRIES;
17
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_0u3ysd.OXYLABS_ASIAN_COUNTRIES;
18
- exports.getRandomOxylabsBrowserType = _mod_0u3ysd.getRandomBrowserType;
19
- exports.getRandomOxylabsLocale = _mod_0u3ysd.getRandomLocale;
20
- exports.getRandomOxylabsGeoLocation = _mod_0u3ysd.getRandomGeoLocation;;
21
- const _mod_qvvezh = require('./addon/decodo/index.cjs');
22
- exports.Decodo = _mod_qvvezh.Decodo;;
23
- const _mod_c8oa9x = require('./addon/decodo/options.cjs');
24
- exports.DECODO_DEVICE_TYPES = _mod_c8oa9x.DECODO_DEVICE_TYPES;
25
- exports.DECODO_HEADLESS_MODES = _mod_c8oa9x.DECODO_HEADLESS_MODES;
26
- exports.DECODO_COMMON_LOCALES = _mod_c8oa9x.DECODO_COMMON_LOCALES;
27
- exports.DECODO_COMMON_COUNTRIES = _mod_c8oa9x.DECODO_COMMON_COUNTRIES;
28
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_c8oa9x.DECODO_EUROPEAN_COUNTRIES;
29
- exports.DECODO_ASIAN_COUNTRIES = _mod_c8oa9x.DECODO_ASIAN_COUNTRIES;
30
- exports.DECODO_US_STATES = _mod_c8oa9x.DECODO_US_STATES;
31
- exports.DECODO_COMMON_CITIES = _mod_c8oa9x.DECODO_COMMON_CITIES;
32
- exports.getRandomDecodoDeviceType = _mod_c8oa9x.getRandomDeviceType;
33
- exports.getRandomDecodoLocale = _mod_c8oa9x.getRandomLocale;
34
- exports.getRandomDecodoCountry = _mod_c8oa9x.getRandomCountry;
35
- exports.getRandomDecodoCity = _mod_c8oa9x.getRandomCity;
36
- exports.generateDecodoSessionId = _mod_c8oa9x.generateSessionId;;
1
+ const _mod_yuwab2 = require('./crawler.cjs');
2
+ exports.Crawler = _mod_yuwab2.Crawler;;
3
+ const _mod_ke9y75 = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_ke9y75.CrawlerOptions;;
5
+ const _mod_rmkqk2 = require('../cache/file-cacher.cjs');
6
+ exports.FileCacher = _mod_rmkqk2.FileCacher;;
7
+ const _mod_qvrjfw = require('../cache/url-store.cjs');
8
+ exports.UrlStore = _mod_qvrjfw.UrlStore;;
9
+ const _mod_6wo293 = require('./addon/oxylabs/index.cjs');
10
+ exports.Oxylabs = _mod_6wo293.Oxylabs;;
11
+ const _mod_5jzs00 = require('./addon/oxylabs/options.cjs');
12
+ exports.OXYLABS_BROWSER_TYPES = _mod_5jzs00.OXYLABS_BROWSER_TYPES;
13
+ exports.OXYLABS_COMMON_LOCALES = _mod_5jzs00.OXYLABS_COMMON_LOCALES;
14
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_5jzs00.OXYLABS_COMMON_GEO_LOCATIONS;
15
+ exports.OXYLABS_US_STATES = _mod_5jzs00.OXYLABS_US_STATES;
16
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_5jzs00.OXYLABS_EUROPEAN_COUNTRIES;
17
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_5jzs00.OXYLABS_ASIAN_COUNTRIES;
18
+ exports.getRandomOxylabsBrowserType = _mod_5jzs00.getRandomBrowserType;
19
+ exports.getRandomOxylabsLocale = _mod_5jzs00.getRandomLocale;
20
+ exports.getRandomOxylabsGeoLocation = _mod_5jzs00.getRandomGeoLocation;;
21
+ const _mod_xzulah = require('./addon/decodo/index.cjs');
22
+ exports.Decodo = _mod_xzulah.Decodo;;
23
+ const _mod_96s3w3 = require('./addon/decodo/options.cjs');
24
+ exports.DECODO_DEVICE_TYPES = _mod_96s3w3.DECODO_DEVICE_TYPES;
25
+ exports.DECODO_HEADLESS_MODES = _mod_96s3w3.DECODO_HEADLESS_MODES;
26
+ exports.DECODO_COMMON_LOCALES = _mod_96s3w3.DECODO_COMMON_LOCALES;
27
+ exports.DECODO_COMMON_COUNTRIES = _mod_96s3w3.DECODO_COMMON_COUNTRIES;
28
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_96s3w3.DECODO_EUROPEAN_COUNTRIES;
29
+ exports.DECODO_ASIAN_COUNTRIES = _mod_96s3w3.DECODO_ASIAN_COUNTRIES;
30
+ exports.DECODO_US_STATES = _mod_96s3w3.DECODO_US_STATES;
31
+ exports.DECODO_COMMON_CITIES = _mod_96s3w3.DECODO_COMMON_CITIES;
32
+ exports.getRandomDecodoDeviceType = _mod_96s3w3.getRandomDeviceType;
33
+ exports.getRandomDecodoLocale = _mod_96s3w3.getRandomLocale;
34
+ exports.getRandomDecodoCountry = _mod_96s3w3.getRandomCountry;
35
+ exports.getRandomDecodoCity = _mod_96s3w3.getRandomCity;
36
+ exports.generateDecodoSessionId = _mod_96s3w3.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_iw6rg6 = require('./manager.cjs');
5
- exports.ProxyManager = _mod_iw6rg6.ProxyManager;;
4
+ const _mod_1jfmwa = require('./manager.cjs');
5
+ exports.ProxyManager = _mod_1jfmwa.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_sdr4pe = require('./queue.cjs');
2
- exports.RezoQueue = _mod_sdr4pe.RezoQueue;;
3
- const _mod_p0tjg8 = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_p0tjg8.HttpQueue;
5
- exports.extractDomain = _mod_p0tjg8.extractDomain;;
6
- const _mod_tfd6vx = require('./types.cjs');
7
- exports.Priority = _mod_tfd6vx.Priority;
8
- exports.HttpMethodPriority = _mod_tfd6vx.HttpMethodPriority;;
1
+ const _mod_1rrd9x = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_1rrd9x.RezoQueue;;
3
+ const _mod_2zy0yg = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_2zy0yg.HttpQueue;
5
+ exports.extractDomain = _mod_2zy0yg.extractDomain;;
6
+ const _mod_5lfu3b = require('./types.cjs');
7
+ exports.Priority = _mod_5lfu3b.Priority;
8
+ exports.HttpMethodPriority = _mod_5lfu3b.HttpMethodPriority;;