rezo 1.0.19 → 1.0.21
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.
- package/dist/adapters/curl.cjs +39 -34
- package/dist/adapters/curl.js +39 -34
- package/dist/adapters/entries/curl.d.ts +19 -18
- package/dist/adapters/entries/fetch.d.ts +19 -18
- package/dist/adapters/entries/http.d.ts +19 -18
- package/dist/adapters/entries/http2.d.ts +19 -18
- package/dist/adapters/entries/react-native.d.ts +19 -18
- package/dist/adapters/entries/xhr.d.ts +19 -18
- package/dist/adapters/fetch.cjs +42 -41
- package/dist/adapters/fetch.js +42 -41
- package/dist/adapters/http.cjs +65 -46
- package/dist/adapters/http.js +65 -46
- package/dist/adapters/http2.cjs +41 -36
- package/dist/adapters/http2.js +41 -36
- package/dist/adapters/index.cjs +6 -6
- package/dist/adapters/react-native.cjs +41 -27
- package/dist/adapters/react-native.js +41 -27
- package/dist/adapters/xhr.cjs +43 -38
- package/dist/adapters/xhr.js +43 -38
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +19 -18
- package/dist/entries/crawler.cjs +5 -5
- package/dist/errors/rezo-error.cjs +139 -21
- package/dist/errors/rezo-error.js +138 -21
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +19 -18
- package/dist/platform/browser.d.ts +19 -18
- package/dist/platform/bun.d.ts +19 -18
- package/dist/platform/deno.d.ts +19 -18
- package/dist/platform/node.d.ts +19 -18
- package/dist/platform/react-native.d.ts +19 -18
- package/dist/platform/worker.d.ts +19 -18
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/utils/http-config.cjs +6 -3
- package/dist/utils/http-config.js +6 -3
- package/dist/utils/timing.cjs +90 -0
- package/dist/utils/timing.js +78 -0
- package/package.json +1 -1
|
@@ -424,6 +424,40 @@ 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
|
+
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
|
function getCode(code) {
|
|
428
462
|
const error = ERROR_INFO[code];
|
|
429
463
|
if (error) {
|
|
@@ -544,13 +578,11 @@ 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, "
|
|
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
588
|
Object.defineProperty(this, "status", { value: response.status, enumerable: false });
|
|
@@ -568,17 +600,71 @@ class RezoError extends Error {
|
|
|
568
600
|
}
|
|
569
601
|
}
|
|
570
602
|
}
|
|
571
|
-
[Symbol.for("nodejs.util.inspect.custom")](_depth,
|
|
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.
|
|
578
|
-
parts.push(`
|
|
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 @@ 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
|
|
616
|
-
|
|
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 @@ class RezoError extends Error {
|
|
|
670
768
|
};
|
|
671
769
|
if (this.code !== undefined)
|
|
672
770
|
result.code = this.code;
|
|
673
|
-
if (this.
|
|
674
|
-
result.
|
|
675
|
-
if (this.
|
|
676
|
-
result.
|
|
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,32 +793,46 @@ 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.
|
|
702
|
-
result += `
|
|
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
|
}
|
|
715
832
|
}
|
|
716
833
|
|
|
717
834
|
exports.getHttpErrorMessage = getHttpErrorMessage;
|
|
835
|
+
exports.getHttpStatusText = getHttpStatusText;
|
|
718
836
|
exports.getCode = getCode;
|
|
719
837
|
exports.getErrorInfo = getErrorInfo;
|
|
720
838
|
exports.RezoError = RezoError;
|
|
@@ -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,13 +578,11 @@ 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, "
|
|
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
588
|
Object.defineProperty(this, "status", { value: response.status, enumerable: false });
|
|
@@ -568,17 +600,71 @@ export class RezoError extends Error {
|
|
|
568
600
|
}
|
|
569
601
|
}
|
|
570
602
|
}
|
|
571
|
-
[Symbol.for("nodejs.util.inspect.custom")](_depth,
|
|
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.
|
|
578
|
-
parts.push(`
|
|
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
|
|
616
|
-
|
|
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.
|
|
674
|
-
result.
|
|
675
|
-
if (this.
|
|
676
|
-
result.
|
|
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.
|
|
702
|
-
result += `
|
|
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
|
|
2
|
-
exports.Rezo =
|
|
3
|
-
exports.createRezoInstance =
|
|
4
|
-
exports.createDefaultInstance =
|
|
5
|
-
const
|
|
6
|
-
exports.RezoError =
|
|
7
|
-
exports.RezoErrorCode =
|
|
8
|
-
const
|
|
9
|
-
exports.RezoHeaders =
|
|
10
|
-
const
|
|
11
|
-
exports.RezoFormData =
|
|
12
|
-
const
|
|
13
|
-
exports.RezoCookieJar =
|
|
14
|
-
exports.Cookie =
|
|
15
|
-
const
|
|
16
|
-
exports.createDefaultHooks =
|
|
17
|
-
exports.mergeHooks =
|
|
18
|
-
const
|
|
19
|
-
exports.ProxyManager =
|
|
20
|
-
const
|
|
21
|
-
exports.RezoQueue =
|
|
22
|
-
exports.HttpQueue =
|
|
23
|
-
exports.Priority =
|
|
24
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_l63c18 = require('./core/rezo.cjs');
|
|
2
|
+
exports.Rezo = _mod_l63c18.Rezo;
|
|
3
|
+
exports.createRezoInstance = _mod_l63c18.createRezoInstance;
|
|
4
|
+
exports.createDefaultInstance = _mod_l63c18.createDefaultInstance;;
|
|
5
|
+
const _mod_wb9vn2 = require('./errors/rezo-error.cjs');
|
|
6
|
+
exports.RezoError = _mod_wb9vn2.RezoError;
|
|
7
|
+
exports.RezoErrorCode = _mod_wb9vn2.RezoErrorCode;;
|
|
8
|
+
const _mod_4bxq6e = require('./utils/headers.cjs');
|
|
9
|
+
exports.RezoHeaders = _mod_4bxq6e.RezoHeaders;;
|
|
10
|
+
const _mod_gxwkvw = require('./utils/form-data.cjs');
|
|
11
|
+
exports.RezoFormData = _mod_gxwkvw.RezoFormData;;
|
|
12
|
+
const _mod_iqdevw = require('./utils/cookies.cjs');
|
|
13
|
+
exports.RezoCookieJar = _mod_iqdevw.RezoCookieJar;
|
|
14
|
+
exports.Cookie = _mod_iqdevw.Cookie;;
|
|
15
|
+
const _mod_aj2qcb = require('./core/hooks.cjs');
|
|
16
|
+
exports.createDefaultHooks = _mod_aj2qcb.createDefaultHooks;
|
|
17
|
+
exports.mergeHooks = _mod_aj2qcb.mergeHooks;;
|
|
18
|
+
const _mod_5nufcq = require('./proxy/manager.cjs');
|
|
19
|
+
exports.ProxyManager = _mod_5nufcq.ProxyManager;;
|
|
20
|
+
const _mod_0sh353 = require('./queue/index.cjs');
|
|
21
|
+
exports.RezoQueue = _mod_0sh353.RezoQueue;
|
|
22
|
+
exports.HttpQueue = _mod_0sh353.HttpQueue;
|
|
23
|
+
exports.Priority = _mod_0sh353.Priority;
|
|
24
|
+
exports.HttpMethodPriority = _mod_0sh353.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
|
@@ -1815,24 +1815,26 @@ export interface RezoConfig {
|
|
|
1815
1815
|
* - removeAllCookiesSync(): Clear all cookies
|
|
1816
1816
|
*/
|
|
1817
1817
|
cookieJar: RezoCookieJar;
|
|
1818
|
-
/** @description Comprehensive timing information */
|
|
1818
|
+
/** @description Comprehensive timing information (matches PerformanceResourceTiming API) */
|
|
1819
1819
|
timing: {
|
|
1820
|
-
/** @description Request start timestamp (
|
|
1821
|
-
|
|
1822
|
-
/** @description
|
|
1823
|
-
|
|
1824
|
-
/** @description DNS lookup
|
|
1825
|
-
|
|
1826
|
-
/** @description
|
|
1827
|
-
|
|
1828
|
-
/** @description TLS handshake
|
|
1829
|
-
|
|
1830
|
-
/** @description
|
|
1831
|
-
|
|
1832
|
-
/** @description
|
|
1833
|
-
|
|
1834
|
-
/** @description
|
|
1835
|
-
|
|
1820
|
+
/** @description Request start timestamp (performance.now() value when request began) */
|
|
1821
|
+
startTime: number;
|
|
1822
|
+
/** @description Timestamp when DNS lookup started */
|
|
1823
|
+
domainLookupStart: number;
|
|
1824
|
+
/** @description Timestamp when DNS lookup ended */
|
|
1825
|
+
domainLookupEnd: number;
|
|
1826
|
+
/** @description Timestamp when connection started */
|
|
1827
|
+
connectStart: number;
|
|
1828
|
+
/** @description Timestamp when TLS handshake started (0 for HTTP) */
|
|
1829
|
+
secureConnectionStart: number;
|
|
1830
|
+
/** @description Timestamp when connection completed */
|
|
1831
|
+
connectEnd: number;
|
|
1832
|
+
/** @description Timestamp when request was sent */
|
|
1833
|
+
requestStart: number;
|
|
1834
|
+
/** @description Timestamp when first byte of response received */
|
|
1835
|
+
responseStart: number;
|
|
1836
|
+
/** @description Timestamp when response completed */
|
|
1837
|
+
responseEnd: number;
|
|
1836
1838
|
};
|
|
1837
1839
|
/** @description Network connection information */
|
|
1838
1840
|
network: {
|
|
@@ -2012,7 +2014,6 @@ export declare class RezoError<T = any> extends Error {
|
|
|
2012
2014
|
readonly isSocksError: boolean;
|
|
2013
2015
|
readonly isTlsError: boolean;
|
|
2014
2016
|
readonly isRetryable: boolean;
|
|
2015
|
-
readonly details: string;
|
|
2016
2017
|
readonly suggestion: string;
|
|
2017
2018
|
constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
|
|
2018
2019
|
static isRezoError(error: unknown): error is RezoError;
|
|
@@ -1815,24 +1815,26 @@ export interface RezoConfig {
|
|
|
1815
1815
|
* - removeAllCookiesSync(): Clear all cookies
|
|
1816
1816
|
*/
|
|
1817
1817
|
cookieJar: RezoCookieJar;
|
|
1818
|
-
/** @description Comprehensive timing information */
|
|
1818
|
+
/** @description Comprehensive timing information (matches PerformanceResourceTiming API) */
|
|
1819
1819
|
timing: {
|
|
1820
|
-
/** @description Request start timestamp (
|
|
1821
|
-
|
|
1822
|
-
/** @description
|
|
1823
|
-
|
|
1824
|
-
/** @description DNS lookup
|
|
1825
|
-
|
|
1826
|
-
/** @description
|
|
1827
|
-
|
|
1828
|
-
/** @description TLS handshake
|
|
1829
|
-
|
|
1830
|
-
/** @description
|
|
1831
|
-
|
|
1832
|
-
/** @description
|
|
1833
|
-
|
|
1834
|
-
/** @description
|
|
1835
|
-
|
|
1820
|
+
/** @description Request start timestamp (performance.now() value when request began) */
|
|
1821
|
+
startTime: number;
|
|
1822
|
+
/** @description Timestamp when DNS lookup started */
|
|
1823
|
+
domainLookupStart: number;
|
|
1824
|
+
/** @description Timestamp when DNS lookup ended */
|
|
1825
|
+
domainLookupEnd: number;
|
|
1826
|
+
/** @description Timestamp when connection started */
|
|
1827
|
+
connectStart: number;
|
|
1828
|
+
/** @description Timestamp when TLS handshake started (0 for HTTP) */
|
|
1829
|
+
secureConnectionStart: number;
|
|
1830
|
+
/** @description Timestamp when connection completed */
|
|
1831
|
+
connectEnd: number;
|
|
1832
|
+
/** @description Timestamp when request was sent */
|
|
1833
|
+
requestStart: number;
|
|
1834
|
+
/** @description Timestamp when first byte of response received */
|
|
1835
|
+
responseStart: number;
|
|
1836
|
+
/** @description Timestamp when response completed */
|
|
1837
|
+
responseEnd: number;
|
|
1836
1838
|
};
|
|
1837
1839
|
/** @description Network connection information */
|
|
1838
1840
|
network: {
|
|
@@ -2012,7 +2014,6 @@ export declare class RezoError<T = any> extends Error {
|
|
|
2012
2014
|
readonly isSocksError: boolean;
|
|
2013
2015
|
readonly isTlsError: boolean;
|
|
2014
2016
|
readonly isRetryable: boolean;
|
|
2015
|
-
readonly details: string;
|
|
2016
2017
|
readonly suggestion: string;
|
|
2017
2018
|
constructor(message: string, config: RezoConfig, code?: string, request?: RezoHttpRequest, response?: RezoResponse<T>);
|
|
2018
2019
|
static isRezoError(error: unknown): error is RezoError;
|