rezo 1.0.137 → 1.0.139
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 +5 -1
- package/dist/adapters/curl.js +5 -1
- package/dist/adapters/entries/curl.d.ts +50 -15
- package/dist/adapters/entries/fetch.d.ts +50 -15
- package/dist/adapters/entries/http.d.ts +50 -15
- package/dist/adapters/entries/http2.d.ts +50 -15
- package/dist/adapters/entries/react-native.cjs +6 -6
- package/dist/adapters/entries/react-native.d.ts +50 -15
- package/dist/adapters/entries/xhr.d.ts +50 -15
- package/dist/adapters/fetch.cjs +5 -0
- package/dist/adapters/fetch.js +5 -0
- package/dist/adapters/http.cjs +42 -0
- package/dist/adapters/http.js +42 -0
- package/dist/adapters/http2.cjs +5 -0
- package/dist/adapters/http2.js +5 -0
- package/dist/adapters/index.cjs +10 -10
- package/dist/adapters/index.d.ts +49 -14
- package/dist/adapters/react-native.cjs +6 -0
- package/dist/adapters/react-native.js +6 -0
- package/dist/adapters/xhr.cjs +5 -1
- package/dist/adapters/xhr.js +5 -1
- package/dist/cache/index.cjs +9 -9
- package/dist/cookies/cookie-jar.cjs +4 -4
- package/dist/cookies/index.cjs +10 -10
- package/dist/crawler/index.cjs +42 -42
- package/dist/crawler/plugin/index.cjs +1 -1
- package/dist/crawler.d.ts +49 -14
- package/dist/entries/crawler.cjs +24 -24
- package/dist/errors/rezo-error.cjs +3 -2
- package/dist/errors/rezo-error.js +3 -2
- package/dist/index.cjs +58 -58
- package/dist/index.d.ts +50 -15
- package/dist/internal/agents/index.cjs +14 -14
- package/dist/platform/browser.d.ts +50 -15
- package/dist/platform/bun.d.ts +50 -15
- package/dist/platform/deno.d.ts +50 -15
- package/dist/platform/node.d.ts +50 -15
- package/dist/platform/react-native.cjs +6 -6
- package/dist/platform/react-native.d.ts +50 -15
- package/dist/platform/worker.d.ts +50 -15
- package/dist/proxy/index.cjs +4 -4
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/universal/index.cjs +11 -11
- package/dist/stealth/index.cjs +17 -17
- package/dist/stealth/profiles/index.cjs +10 -10
- package/dist/utils/agent-pool.cjs +1 -1
- package/dist/utils/agent-pool.js +1 -1
- package/dist/utils/debug-error-dump.cjs +59 -0
- package/dist/utils/debug-error-dump.js +56 -0
- package/dist/utils/http-config.cjs +19 -2
- package/dist/utils/http-config.js +19 -2
- package/dist/utils/staged-timeout.cjs +1 -2
- package/dist/utils/staged-timeout.js +1 -2
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/wget/index.cjs +51 -51
- package/dist/wget/index.d.ts +49 -14
- package/package.json +1 -1
package/dist/adapters/curl.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const { RezoCookieJar, Cookie } = require('../cookies/cookie-jar.cjs');
|
|
|
11
11
|
const RezoFormData = require('../utils/form-data.cjs');
|
|
12
12
|
const { existsSync } = require("node:fs");
|
|
13
13
|
const { getDefaultConfig, prepareHTTPOptions, calculateRetryDelay, shouldRetry } = require('../utils/http-config.cjs');
|
|
14
|
+
const { debugErrorDump } = require('../utils/debug-error-dump.cjs');
|
|
14
15
|
const { handleRateLimitWait, shouldWaitOnStatus } = require('../utils/rate-limit-wait.cjs');
|
|
15
16
|
const { RezoHeaders } = require('../utils/headers.cjs');
|
|
16
17
|
const { StreamResponse } = require('../responses/stream.cjs');
|
|
@@ -2470,12 +2471,15 @@ async function executeRequest(options, defaultOptions, jar) {
|
|
|
2470
2471
|
}
|
|
2471
2472
|
}
|
|
2472
2473
|
}
|
|
2474
|
+
debugErrorDump(config, error);
|
|
2473
2475
|
throw error;
|
|
2474
2476
|
}
|
|
2475
2477
|
if (proxyManager && selectedProxy) {
|
|
2476
2478
|
proxyManager.reportFailure(selectedProxy, error);
|
|
2477
2479
|
}
|
|
2478
|
-
|
|
2480
|
+
const smartError = buildSmartError(config, originalRequest, error);
|
|
2481
|
+
debugErrorDump(config, smartError);
|
|
2482
|
+
throw smartError;
|
|
2479
2483
|
}
|
|
2480
2484
|
}
|
|
2481
2485
|
}
|
package/dist/adapters/curl.js
CHANGED
|
@@ -11,6 +11,7 @@ import { RezoCookieJar, Cookie } from '../cookies/cookie-jar.js';
|
|
|
11
11
|
import RezoFormData from '../utils/form-data.js';
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
13
13
|
import { getDefaultConfig, prepareHTTPOptions, calculateRetryDelay, shouldRetry } from '../utils/http-config.js';
|
|
14
|
+
import { debugErrorDump } from '../utils/debug-error-dump.js';
|
|
14
15
|
import { handleRateLimitWait, shouldWaitOnStatus } from '../utils/rate-limit-wait.js';
|
|
15
16
|
import { RezoHeaders } from '../utils/headers.js';
|
|
16
17
|
import { StreamResponse } from '../responses/stream.js';
|
|
@@ -2470,12 +2471,15 @@ export async function executeRequest(options, defaultOptions, jar) {
|
|
|
2470
2471
|
}
|
|
2471
2472
|
}
|
|
2472
2473
|
}
|
|
2474
|
+
debugErrorDump(config, error);
|
|
2473
2475
|
throw error;
|
|
2474
2476
|
}
|
|
2475
2477
|
if (proxyManager && selectedProxy) {
|
|
2476
2478
|
proxyManager.reportFailure(selectedProxy, error);
|
|
2477
2479
|
}
|
|
2478
|
-
|
|
2480
|
+
const smartError = buildSmartError(config, originalRequest, error);
|
|
2481
|
+
debugErrorDump(config, smartError);
|
|
2482
|
+
throw smartError;
|
|
2479
2483
|
}
|
|
2480
2484
|
}
|
|
2481
2485
|
}
|
|
@@ -761,6 +761,12 @@ export interface RezoResponse<T = any> {
|
|
|
761
761
|
contentLength: number;
|
|
762
762
|
urls: string[];
|
|
763
763
|
config: RezoConfig;
|
|
764
|
+
/**
|
|
765
|
+
* Present (true) only when `acceptPartialBody: true` salvaged a body whose
|
|
766
|
+
* connection was torn down before a clean end-of-stream — the data may be
|
|
767
|
+
* complete or may be missing its tail.
|
|
768
|
+
*/
|
|
769
|
+
truncated?: boolean;
|
|
764
770
|
}
|
|
765
771
|
/**
|
|
766
772
|
* Platform-agnostic base interface for event-emitting responses
|
|
@@ -2767,6 +2773,31 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2767
2773
|
maxRedirects?: number;
|
|
2768
2774
|
/** Whether to automatically decompress response data */
|
|
2769
2775
|
decompress?: boolean;
|
|
2776
|
+
/**
|
|
2777
|
+
* Accept response bodies that arrive without a clean end-of-stream.
|
|
2778
|
+
*
|
|
2779
|
+
* Some servers send the complete payload and then reset the connection
|
|
2780
|
+
* instead of closing it cleanly (or advertise a Content-Length larger than
|
|
2781
|
+
* what they send). Node reports this as `aborted`/`ECONNRESET` even though
|
|
2782
|
+
* the data may be complete and usable.
|
|
2783
|
+
*
|
|
2784
|
+
* With `acceptPartialBody: true`, if response headers passed validation and
|
|
2785
|
+
* at least one body byte arrived, the request **resolves normally** with
|
|
2786
|
+
* whatever was received instead of throwing. The response is marked with
|
|
2787
|
+
* `truncated: true` so you can decide whether to trust it.
|
|
2788
|
+
*
|
|
2789
|
+
* Off by default: a torn connection usually means missing data, and
|
|
2790
|
+
* silently returning an incomplete body is the more dangerous default.
|
|
2791
|
+
*
|
|
2792
|
+
* @example
|
|
2793
|
+
* ```typescript
|
|
2794
|
+
* const res = await rezo.get(url, { acceptPartialBody: true });
|
|
2795
|
+
* if (res.truncated) console.warn('body may be incomplete');
|
|
2796
|
+
* ```
|
|
2797
|
+
*
|
|
2798
|
+
* @default false
|
|
2799
|
+
*/
|
|
2800
|
+
acceptPartialBody?: boolean;
|
|
2770
2801
|
/**
|
|
2771
2802
|
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2772
2803
|
*
|
|
@@ -2776,34 +2807,36 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2776
2807
|
* TLS negotiation for HTTPS).
|
|
2777
2808
|
*
|
|
2778
2809
|
* **Behavior:**
|
|
2779
|
-
* - `
|
|
2780
|
-
*
|
|
2810
|
+
* - `true` (default) - Connections are pooled and reused across requests to the
|
|
2811
|
+
* same host. Idle pooled sockets are closed after ~5 seconds.
|
|
2812
|
+
* - `false` - A fresh connection is opened for every request and closed after
|
|
2813
|
+
* the response. No pooling, no reuse.
|
|
2781
2814
|
*
|
|
2782
|
-
* **When to
|
|
2815
|
+
* **When to keep the default (`keepAlive: true`):**
|
|
2783
2816
|
* - Making multiple requests to the same host in sequence
|
|
2784
2817
|
* - Long-running applications (servers, bots, scrapers)
|
|
2785
2818
|
* - Performance-critical applications where connection overhead matters
|
|
2786
2819
|
*
|
|
2787
|
-
* **When to use `keepAlive: false
|
|
2788
|
-
* -
|
|
2789
|
-
* -
|
|
2790
|
-
* -
|
|
2820
|
+
* **When to use `keepAlive: false`:**
|
|
2821
|
+
* - Hosts that reset reused connections aggressively
|
|
2822
|
+
* - Debugging connection-level issues (isolates every request)
|
|
2823
|
+
* - One-off requests where connection reuse buys nothing
|
|
2791
2824
|
*
|
|
2792
2825
|
* @example
|
|
2793
2826
|
* ```typescript
|
|
2794
|
-
* // Default:
|
|
2827
|
+
* // Default: pooled keep-alive connections
|
|
2795
2828
|
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2796
2829
|
*
|
|
2797
|
-
* //
|
|
2798
|
-
* const client =
|
|
2830
|
+
* // Fresh connection per request for this instance
|
|
2831
|
+
* const client = rezo.create({ keepAlive: false });
|
|
2799
2832
|
* await client.get('https://api.example.com/users');
|
|
2800
|
-
* await client.get('https://api.example.com/posts'); //
|
|
2833
|
+
* await client.get('https://api.example.com/posts'); // New connection again
|
|
2801
2834
|
*
|
|
2802
|
-
* //
|
|
2803
|
-
*
|
|
2835
|
+
* // Or per request
|
|
2836
|
+
* await rezo.get('https://api.example.com/data', { keepAlive: false });
|
|
2804
2837
|
* ```
|
|
2805
2838
|
*
|
|
2806
|
-
* @default
|
|
2839
|
+
* @default true
|
|
2807
2840
|
*/
|
|
2808
2841
|
keepAlive?: boolean;
|
|
2809
2842
|
/**
|
|
@@ -4013,6 +4046,8 @@ export interface RezoDefaultOptions {
|
|
|
4013
4046
|
decompress?: boolean;
|
|
4014
4047
|
/** Whether to keep the connection alive for reuse */
|
|
4015
4048
|
keepAlive?: boolean;
|
|
4049
|
+
/** Accept bodies whose connection was torn down before a clean end-of-stream (response gets `truncated: true`) */
|
|
4050
|
+
acceptPartialBody?: boolean;
|
|
4016
4051
|
/** Whether to detect and prevent redirect cycles */
|
|
4017
4052
|
enableRedirectCycleDetection?: boolean;
|
|
4018
4053
|
/** Whether to send cookies and authorization headers with cross-origin requests */
|
|
@@ -8581,7 +8616,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
8581
8616
|
*
|
|
8582
8617
|
* IMPORTANT: Update these values when bumping package version.
|
|
8583
8618
|
*/
|
|
8584
|
-
export declare const VERSION = "1.0.
|
|
8619
|
+
export declare const VERSION = "1.0.139";
|
|
8585
8620
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
8586
8621
|
export declare const Cancel: typeof RezoError;
|
|
8587
8622
|
export declare const CancelToken: {
|
|
@@ -759,6 +759,12 @@ export interface RezoResponse<T = any> {
|
|
|
759
759
|
contentLength: number;
|
|
760
760
|
urls: string[];
|
|
761
761
|
config: RezoConfig;
|
|
762
|
+
/**
|
|
763
|
+
* Present (true) only when `acceptPartialBody: true` salvaged a body whose
|
|
764
|
+
* connection was torn down before a clean end-of-stream — the data may be
|
|
765
|
+
* complete or may be missing its tail.
|
|
766
|
+
*/
|
|
767
|
+
truncated?: boolean;
|
|
762
768
|
}
|
|
763
769
|
/**
|
|
764
770
|
* Platform-agnostic base interface for event-emitting responses
|
|
@@ -3035,6 +3041,8 @@ export interface RezoDefaultOptions {
|
|
|
3035
3041
|
decompress?: boolean;
|
|
3036
3042
|
/** Whether to keep the connection alive for reuse */
|
|
3037
3043
|
keepAlive?: boolean;
|
|
3044
|
+
/** Accept bodies whose connection was torn down before a clean end-of-stream (response gets `truncated: true`) */
|
|
3045
|
+
acceptPartialBody?: boolean;
|
|
3038
3046
|
/** Whether to detect and prevent redirect cycles */
|
|
3039
3047
|
enableRedirectCycleDetection?: boolean;
|
|
3040
3048
|
/** Whether to send cookies and authorization headers with cross-origin requests */
|
|
@@ -4094,6 +4102,31 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4094
4102
|
maxRedirects?: number;
|
|
4095
4103
|
/** Whether to automatically decompress response data */
|
|
4096
4104
|
decompress?: boolean;
|
|
4105
|
+
/**
|
|
4106
|
+
* Accept response bodies that arrive without a clean end-of-stream.
|
|
4107
|
+
*
|
|
4108
|
+
* Some servers send the complete payload and then reset the connection
|
|
4109
|
+
* instead of closing it cleanly (or advertise a Content-Length larger than
|
|
4110
|
+
* what they send). Node reports this as `aborted`/`ECONNRESET` even though
|
|
4111
|
+
* the data may be complete and usable.
|
|
4112
|
+
*
|
|
4113
|
+
* With `acceptPartialBody: true`, if response headers passed validation and
|
|
4114
|
+
* at least one body byte arrived, the request **resolves normally** with
|
|
4115
|
+
* whatever was received instead of throwing. The response is marked with
|
|
4116
|
+
* `truncated: true` so you can decide whether to trust it.
|
|
4117
|
+
*
|
|
4118
|
+
* Off by default: a torn connection usually means missing data, and
|
|
4119
|
+
* silently returning an incomplete body is the more dangerous default.
|
|
4120
|
+
*
|
|
4121
|
+
* @example
|
|
4122
|
+
* ```typescript
|
|
4123
|
+
* const res = await rezo.get(url, { acceptPartialBody: true });
|
|
4124
|
+
* if (res.truncated) console.warn('body may be incomplete');
|
|
4125
|
+
* ```
|
|
4126
|
+
*
|
|
4127
|
+
* @default false
|
|
4128
|
+
*/
|
|
4129
|
+
acceptPartialBody?: boolean;
|
|
4097
4130
|
/**
|
|
4098
4131
|
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
4099
4132
|
*
|
|
@@ -4103,34 +4136,36 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4103
4136
|
* TLS negotiation for HTTPS).
|
|
4104
4137
|
*
|
|
4105
4138
|
* **Behavior:**
|
|
4106
|
-
* - `
|
|
4107
|
-
*
|
|
4139
|
+
* - `true` (default) - Connections are pooled and reused across requests to the
|
|
4140
|
+
* same host. Idle pooled sockets are closed after ~5 seconds.
|
|
4141
|
+
* - `false` - A fresh connection is opened for every request and closed after
|
|
4142
|
+
* the response. No pooling, no reuse.
|
|
4108
4143
|
*
|
|
4109
|
-
* **When to
|
|
4144
|
+
* **When to keep the default (`keepAlive: true`):**
|
|
4110
4145
|
* - Making multiple requests to the same host in sequence
|
|
4111
4146
|
* - Long-running applications (servers, bots, scrapers)
|
|
4112
4147
|
* - Performance-critical applications where connection overhead matters
|
|
4113
4148
|
*
|
|
4114
|
-
* **When to use `keepAlive: false
|
|
4115
|
-
* -
|
|
4116
|
-
* -
|
|
4117
|
-
* -
|
|
4149
|
+
* **When to use `keepAlive: false`:**
|
|
4150
|
+
* - Hosts that reset reused connections aggressively
|
|
4151
|
+
* - Debugging connection-level issues (isolates every request)
|
|
4152
|
+
* - One-off requests where connection reuse buys nothing
|
|
4118
4153
|
*
|
|
4119
4154
|
* @example
|
|
4120
4155
|
* ```typescript
|
|
4121
|
-
* // Default:
|
|
4156
|
+
* // Default: pooled keep-alive connections
|
|
4122
4157
|
* const { data } = await rezo.get('https://api.example.com/data');
|
|
4123
4158
|
*
|
|
4124
|
-
* //
|
|
4125
|
-
* const client =
|
|
4159
|
+
* // Fresh connection per request for this instance
|
|
4160
|
+
* const client = rezo.create({ keepAlive: false });
|
|
4126
4161
|
* await client.get('https://api.example.com/users');
|
|
4127
|
-
* await client.get('https://api.example.com/posts'); //
|
|
4162
|
+
* await client.get('https://api.example.com/posts'); // New connection again
|
|
4128
4163
|
*
|
|
4129
|
-
* //
|
|
4130
|
-
*
|
|
4164
|
+
* // Or per request
|
|
4165
|
+
* await rezo.get('https://api.example.com/data', { keepAlive: false });
|
|
4131
4166
|
* ```
|
|
4132
4167
|
*
|
|
4133
|
-
* @default
|
|
4168
|
+
* @default true
|
|
4134
4169
|
*/
|
|
4135
4170
|
keepAlive?: boolean;
|
|
4136
4171
|
/**
|
|
@@ -6096,7 +6131,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
6096
6131
|
*
|
|
6097
6132
|
* IMPORTANT: Update these values when bumping package version.
|
|
6098
6133
|
*/
|
|
6099
|
-
export declare const VERSION = "1.0.
|
|
6134
|
+
export declare const VERSION = "1.0.139";
|
|
6100
6135
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
6101
6136
|
export declare const Cancel: typeof RezoError;
|
|
6102
6137
|
export declare const CancelToken: {
|
|
@@ -759,6 +759,12 @@ export interface RezoResponse<T = any> {
|
|
|
759
759
|
contentLength: number;
|
|
760
760
|
urls: string[];
|
|
761
761
|
config: RezoConfig;
|
|
762
|
+
/**
|
|
763
|
+
* Present (true) only when `acceptPartialBody: true` salvaged a body whose
|
|
764
|
+
* connection was torn down before a clean end-of-stream — the data may be
|
|
765
|
+
* complete or may be missing its tail.
|
|
766
|
+
*/
|
|
767
|
+
truncated?: boolean;
|
|
762
768
|
}
|
|
763
769
|
/**
|
|
764
770
|
* Platform-agnostic base interface for event-emitting responses
|
|
@@ -3035,6 +3041,8 @@ export interface RezoDefaultOptions {
|
|
|
3035
3041
|
decompress?: boolean;
|
|
3036
3042
|
/** Whether to keep the connection alive for reuse */
|
|
3037
3043
|
keepAlive?: boolean;
|
|
3044
|
+
/** Accept bodies whose connection was torn down before a clean end-of-stream (response gets `truncated: true`) */
|
|
3045
|
+
acceptPartialBody?: boolean;
|
|
3038
3046
|
/** Whether to detect and prevent redirect cycles */
|
|
3039
3047
|
enableRedirectCycleDetection?: boolean;
|
|
3040
3048
|
/** Whether to send cookies and authorization headers with cross-origin requests */
|
|
@@ -4094,6 +4102,31 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4094
4102
|
maxRedirects?: number;
|
|
4095
4103
|
/** Whether to automatically decompress response data */
|
|
4096
4104
|
decompress?: boolean;
|
|
4105
|
+
/**
|
|
4106
|
+
* Accept response bodies that arrive without a clean end-of-stream.
|
|
4107
|
+
*
|
|
4108
|
+
* Some servers send the complete payload and then reset the connection
|
|
4109
|
+
* instead of closing it cleanly (or advertise a Content-Length larger than
|
|
4110
|
+
* what they send). Node reports this as `aborted`/`ECONNRESET` even though
|
|
4111
|
+
* the data may be complete and usable.
|
|
4112
|
+
*
|
|
4113
|
+
* With `acceptPartialBody: true`, if response headers passed validation and
|
|
4114
|
+
* at least one body byte arrived, the request **resolves normally** with
|
|
4115
|
+
* whatever was received instead of throwing. The response is marked with
|
|
4116
|
+
* `truncated: true` so you can decide whether to trust it.
|
|
4117
|
+
*
|
|
4118
|
+
* Off by default: a torn connection usually means missing data, and
|
|
4119
|
+
* silently returning an incomplete body is the more dangerous default.
|
|
4120
|
+
*
|
|
4121
|
+
* @example
|
|
4122
|
+
* ```typescript
|
|
4123
|
+
* const res = await rezo.get(url, { acceptPartialBody: true });
|
|
4124
|
+
* if (res.truncated) console.warn('body may be incomplete');
|
|
4125
|
+
* ```
|
|
4126
|
+
*
|
|
4127
|
+
* @default false
|
|
4128
|
+
*/
|
|
4129
|
+
acceptPartialBody?: boolean;
|
|
4097
4130
|
/**
|
|
4098
4131
|
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
4099
4132
|
*
|
|
@@ -4103,34 +4136,36 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4103
4136
|
* TLS negotiation for HTTPS).
|
|
4104
4137
|
*
|
|
4105
4138
|
* **Behavior:**
|
|
4106
|
-
* - `
|
|
4107
|
-
*
|
|
4139
|
+
* - `true` (default) - Connections are pooled and reused across requests to the
|
|
4140
|
+
* same host. Idle pooled sockets are closed after ~5 seconds.
|
|
4141
|
+
* - `false` - A fresh connection is opened for every request and closed after
|
|
4142
|
+
* the response. No pooling, no reuse.
|
|
4108
4143
|
*
|
|
4109
|
-
* **When to
|
|
4144
|
+
* **When to keep the default (`keepAlive: true`):**
|
|
4110
4145
|
* - Making multiple requests to the same host in sequence
|
|
4111
4146
|
* - Long-running applications (servers, bots, scrapers)
|
|
4112
4147
|
* - Performance-critical applications where connection overhead matters
|
|
4113
4148
|
*
|
|
4114
|
-
* **When to use `keepAlive: false
|
|
4115
|
-
* -
|
|
4116
|
-
* -
|
|
4117
|
-
* -
|
|
4149
|
+
* **When to use `keepAlive: false`:**
|
|
4150
|
+
* - Hosts that reset reused connections aggressively
|
|
4151
|
+
* - Debugging connection-level issues (isolates every request)
|
|
4152
|
+
* - One-off requests where connection reuse buys nothing
|
|
4118
4153
|
*
|
|
4119
4154
|
* @example
|
|
4120
4155
|
* ```typescript
|
|
4121
|
-
* // Default:
|
|
4156
|
+
* // Default: pooled keep-alive connections
|
|
4122
4157
|
* const { data } = await rezo.get('https://api.example.com/data');
|
|
4123
4158
|
*
|
|
4124
|
-
* //
|
|
4125
|
-
* const client =
|
|
4159
|
+
* // Fresh connection per request for this instance
|
|
4160
|
+
* const client = rezo.create({ keepAlive: false });
|
|
4126
4161
|
* await client.get('https://api.example.com/users');
|
|
4127
|
-
* await client.get('https://api.example.com/posts'); //
|
|
4162
|
+
* await client.get('https://api.example.com/posts'); // New connection again
|
|
4128
4163
|
*
|
|
4129
|
-
* //
|
|
4130
|
-
*
|
|
4164
|
+
* // Or per request
|
|
4165
|
+
* await rezo.get('https://api.example.com/data', { keepAlive: false });
|
|
4131
4166
|
* ```
|
|
4132
4167
|
*
|
|
4133
|
-
* @default
|
|
4168
|
+
* @default true
|
|
4134
4169
|
*/
|
|
4135
4170
|
keepAlive?: boolean;
|
|
4136
4171
|
/**
|
|
@@ -6171,7 +6206,7 @@ export declare function getSocketTelemetry(socket: Socket): SocketTelemetry | un
|
|
|
6171
6206
|
*
|
|
6172
6207
|
* IMPORTANT: Update these values when bumping package version.
|
|
6173
6208
|
*/
|
|
6174
|
-
export declare const VERSION = "1.0.
|
|
6209
|
+
export declare const VERSION = "1.0.139";
|
|
6175
6210
|
/**
|
|
6176
6211
|
* Type guard to check if an error is a RezoError instance.
|
|
6177
6212
|
*/
|
|
@@ -760,6 +760,12 @@ export interface RezoResponse<T = any> {
|
|
|
760
760
|
contentLength: number;
|
|
761
761
|
urls: string[];
|
|
762
762
|
config: RezoConfig;
|
|
763
|
+
/**
|
|
764
|
+
* Present (true) only when `acceptPartialBody: true` salvaged a body whose
|
|
765
|
+
* connection was torn down before a clean end-of-stream — the data may be
|
|
766
|
+
* complete or may be missing its tail.
|
|
767
|
+
*/
|
|
768
|
+
truncated?: boolean;
|
|
763
769
|
}
|
|
764
770
|
/**
|
|
765
771
|
* Platform-agnostic base interface for event-emitting responses
|
|
@@ -3036,6 +3042,8 @@ export interface RezoDefaultOptions {
|
|
|
3036
3042
|
decompress?: boolean;
|
|
3037
3043
|
/** Whether to keep the connection alive for reuse */
|
|
3038
3044
|
keepAlive?: boolean;
|
|
3045
|
+
/** Accept bodies whose connection was torn down before a clean end-of-stream (response gets `truncated: true`) */
|
|
3046
|
+
acceptPartialBody?: boolean;
|
|
3039
3047
|
/** Whether to detect and prevent redirect cycles */
|
|
3040
3048
|
enableRedirectCycleDetection?: boolean;
|
|
3041
3049
|
/** Whether to send cookies and authorization headers with cross-origin requests */
|
|
@@ -4095,6 +4103,31 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4095
4103
|
maxRedirects?: number;
|
|
4096
4104
|
/** Whether to automatically decompress response data */
|
|
4097
4105
|
decompress?: boolean;
|
|
4106
|
+
/**
|
|
4107
|
+
* Accept response bodies that arrive without a clean end-of-stream.
|
|
4108
|
+
*
|
|
4109
|
+
* Some servers send the complete payload and then reset the connection
|
|
4110
|
+
* instead of closing it cleanly (or advertise a Content-Length larger than
|
|
4111
|
+
* what they send). Node reports this as `aborted`/`ECONNRESET` even though
|
|
4112
|
+
* the data may be complete and usable.
|
|
4113
|
+
*
|
|
4114
|
+
* With `acceptPartialBody: true`, if response headers passed validation and
|
|
4115
|
+
* at least one body byte arrived, the request **resolves normally** with
|
|
4116
|
+
* whatever was received instead of throwing. The response is marked with
|
|
4117
|
+
* `truncated: true` so you can decide whether to trust it.
|
|
4118
|
+
*
|
|
4119
|
+
* Off by default: a torn connection usually means missing data, and
|
|
4120
|
+
* silently returning an incomplete body is the more dangerous default.
|
|
4121
|
+
*
|
|
4122
|
+
* @example
|
|
4123
|
+
* ```typescript
|
|
4124
|
+
* const res = await rezo.get(url, { acceptPartialBody: true });
|
|
4125
|
+
* if (res.truncated) console.warn('body may be incomplete');
|
|
4126
|
+
* ```
|
|
4127
|
+
*
|
|
4128
|
+
* @default false
|
|
4129
|
+
*/
|
|
4130
|
+
acceptPartialBody?: boolean;
|
|
4098
4131
|
/**
|
|
4099
4132
|
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
4100
4133
|
*
|
|
@@ -4104,34 +4137,36 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4104
4137
|
* TLS negotiation for HTTPS).
|
|
4105
4138
|
*
|
|
4106
4139
|
* **Behavior:**
|
|
4107
|
-
* - `
|
|
4108
|
-
*
|
|
4140
|
+
* - `true` (default) - Connections are pooled and reused across requests to the
|
|
4141
|
+
* same host. Idle pooled sockets are closed after ~5 seconds.
|
|
4142
|
+
* - `false` - A fresh connection is opened for every request and closed after
|
|
4143
|
+
* the response. No pooling, no reuse.
|
|
4109
4144
|
*
|
|
4110
|
-
* **When to
|
|
4145
|
+
* **When to keep the default (`keepAlive: true`):**
|
|
4111
4146
|
* - Making multiple requests to the same host in sequence
|
|
4112
4147
|
* - Long-running applications (servers, bots, scrapers)
|
|
4113
4148
|
* - Performance-critical applications where connection overhead matters
|
|
4114
4149
|
*
|
|
4115
|
-
* **When to use `keepAlive: false
|
|
4116
|
-
* -
|
|
4117
|
-
* -
|
|
4118
|
-
* -
|
|
4150
|
+
* **When to use `keepAlive: false`:**
|
|
4151
|
+
* - Hosts that reset reused connections aggressively
|
|
4152
|
+
* - Debugging connection-level issues (isolates every request)
|
|
4153
|
+
* - One-off requests where connection reuse buys nothing
|
|
4119
4154
|
*
|
|
4120
4155
|
* @example
|
|
4121
4156
|
* ```typescript
|
|
4122
|
-
* // Default:
|
|
4157
|
+
* // Default: pooled keep-alive connections
|
|
4123
4158
|
* const { data } = await rezo.get('https://api.example.com/data');
|
|
4124
4159
|
*
|
|
4125
|
-
* //
|
|
4126
|
-
* const client =
|
|
4160
|
+
* // Fresh connection per request for this instance
|
|
4161
|
+
* const client = rezo.create({ keepAlive: false });
|
|
4127
4162
|
* await client.get('https://api.example.com/users');
|
|
4128
|
-
* await client.get('https://api.example.com/posts'); //
|
|
4163
|
+
* await client.get('https://api.example.com/posts'); // New connection again
|
|
4129
4164
|
*
|
|
4130
|
-
* //
|
|
4131
|
-
*
|
|
4165
|
+
* // Or per request
|
|
4166
|
+
* await rezo.get('https://api.example.com/data', { keepAlive: false });
|
|
4132
4167
|
* ```
|
|
4133
4168
|
*
|
|
4134
|
-
* @default
|
|
4169
|
+
* @default true
|
|
4135
4170
|
*/
|
|
4136
4171
|
keepAlive?: boolean;
|
|
4137
4172
|
/**
|
|
@@ -6122,7 +6157,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
6122
6157
|
*
|
|
6123
6158
|
* IMPORTANT: Update these values when bumping package version.
|
|
6124
6159
|
*/
|
|
6125
|
-
export declare const VERSION = "1.0.
|
|
6160
|
+
export declare const VERSION = "1.0.139";
|
|
6126
6161
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
6127
6162
|
export declare const Cancel: typeof RezoError;
|
|
6128
6163
|
export declare const CancelToken: {
|
|
@@ -6,12 +6,12 @@ const { RezoFormData } = require('../../utils/form-data.cjs');
|
|
|
6
6
|
const { RezoCookieJar, Cookie } = require('../../cookies/cookie-jar.cjs');
|
|
7
7
|
const { createDefaultHooks, mergeHooks } = require('../../core/hooks.cjs');
|
|
8
8
|
const { VERSION } = require('../../version.cjs');
|
|
9
|
-
const
|
|
10
|
-
exports.createFetchStreamTransport =
|
|
11
|
-
exports.createExpoFileSystemAdapter =
|
|
12
|
-
exports.createReactNativeFsAdapter =
|
|
13
|
-
exports.createNetInfoProvider =
|
|
14
|
-
exports.createExpoBackgroundTaskProvider =
|
|
9
|
+
const _mod_hxyeij = require('../../platform/react-native-providers.cjs');
|
|
10
|
+
exports.createFetchStreamTransport = _mod_hxyeij.createFetchStreamTransport;
|
|
11
|
+
exports.createExpoFileSystemAdapter = _mod_hxyeij.createExpoFileSystemAdapter;
|
|
12
|
+
exports.createReactNativeFsAdapter = _mod_hxyeij.createReactNativeFsAdapter;
|
|
13
|
+
exports.createNetInfoProvider = _mod_hxyeij.createNetInfoProvider;
|
|
14
|
+
exports.createExpoBackgroundTaskProvider = _mod_hxyeij.createExpoBackgroundTaskProvider;;
|
|
15
15
|
exports.Rezo = Rezo;
|
|
16
16
|
exports.RezoError = RezoError;
|
|
17
17
|
exports.RezoErrorCode = RezoErrorCode;
|
|
@@ -759,6 +759,12 @@ export interface RezoResponse<T = any> {
|
|
|
759
759
|
contentLength: number;
|
|
760
760
|
urls: string[];
|
|
761
761
|
config: RezoConfig;
|
|
762
|
+
/**
|
|
763
|
+
* Present (true) only when `acceptPartialBody: true` salvaged a body whose
|
|
764
|
+
* connection was torn down before a clean end-of-stream — the data may be
|
|
765
|
+
* complete or may be missing its tail.
|
|
766
|
+
*/
|
|
767
|
+
truncated?: boolean;
|
|
762
768
|
}
|
|
763
769
|
/**
|
|
764
770
|
* Platform-agnostic base interface for event-emitting responses
|
|
@@ -3035,6 +3041,8 @@ export interface RezoDefaultOptions {
|
|
|
3035
3041
|
decompress?: boolean;
|
|
3036
3042
|
/** Whether to keep the connection alive for reuse */
|
|
3037
3043
|
keepAlive?: boolean;
|
|
3044
|
+
/** Accept bodies whose connection was torn down before a clean end-of-stream (response gets `truncated: true`) */
|
|
3045
|
+
acceptPartialBody?: boolean;
|
|
3038
3046
|
/** Whether to detect and prevent redirect cycles */
|
|
3039
3047
|
enableRedirectCycleDetection?: boolean;
|
|
3040
3048
|
/** Whether to send cookies and authorization headers with cross-origin requests */
|
|
@@ -4094,6 +4102,31 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4094
4102
|
maxRedirects?: number;
|
|
4095
4103
|
/** Whether to automatically decompress response data */
|
|
4096
4104
|
decompress?: boolean;
|
|
4105
|
+
/**
|
|
4106
|
+
* Accept response bodies that arrive without a clean end-of-stream.
|
|
4107
|
+
*
|
|
4108
|
+
* Some servers send the complete payload and then reset the connection
|
|
4109
|
+
* instead of closing it cleanly (or advertise a Content-Length larger than
|
|
4110
|
+
* what they send). Node reports this as `aborted`/`ECONNRESET` even though
|
|
4111
|
+
* the data may be complete and usable.
|
|
4112
|
+
*
|
|
4113
|
+
* With `acceptPartialBody: true`, if response headers passed validation and
|
|
4114
|
+
* at least one body byte arrived, the request **resolves normally** with
|
|
4115
|
+
* whatever was received instead of throwing. The response is marked with
|
|
4116
|
+
* `truncated: true` so you can decide whether to trust it.
|
|
4117
|
+
*
|
|
4118
|
+
* Off by default: a torn connection usually means missing data, and
|
|
4119
|
+
* silently returning an incomplete body is the more dangerous default.
|
|
4120
|
+
*
|
|
4121
|
+
* @example
|
|
4122
|
+
* ```typescript
|
|
4123
|
+
* const res = await rezo.get(url, { acceptPartialBody: true });
|
|
4124
|
+
* if (res.truncated) console.warn('body may be incomplete');
|
|
4125
|
+
* ```
|
|
4126
|
+
*
|
|
4127
|
+
* @default false
|
|
4128
|
+
*/
|
|
4129
|
+
acceptPartialBody?: boolean;
|
|
4097
4130
|
/**
|
|
4098
4131
|
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
4099
4132
|
*
|
|
@@ -4103,34 +4136,36 @@ export interface RezoRequestConfig<D = any> {
|
|
|
4103
4136
|
* TLS negotiation for HTTPS).
|
|
4104
4137
|
*
|
|
4105
4138
|
* **Behavior:**
|
|
4106
|
-
* - `
|
|
4107
|
-
*
|
|
4139
|
+
* - `true` (default) - Connections are pooled and reused across requests to the
|
|
4140
|
+
* same host. Idle pooled sockets are closed after ~5 seconds.
|
|
4141
|
+
* - `false` - A fresh connection is opened for every request and closed after
|
|
4142
|
+
* the response. No pooling, no reuse.
|
|
4108
4143
|
*
|
|
4109
|
-
* **When to
|
|
4144
|
+
* **When to keep the default (`keepAlive: true`):**
|
|
4110
4145
|
* - Making multiple requests to the same host in sequence
|
|
4111
4146
|
* - Long-running applications (servers, bots, scrapers)
|
|
4112
4147
|
* - Performance-critical applications where connection overhead matters
|
|
4113
4148
|
*
|
|
4114
|
-
* **When to use `keepAlive: false
|
|
4115
|
-
* -
|
|
4116
|
-
* -
|
|
4117
|
-
* -
|
|
4149
|
+
* **When to use `keepAlive: false`:**
|
|
4150
|
+
* - Hosts that reset reused connections aggressively
|
|
4151
|
+
* - Debugging connection-level issues (isolates every request)
|
|
4152
|
+
* - One-off requests where connection reuse buys nothing
|
|
4118
4153
|
*
|
|
4119
4154
|
* @example
|
|
4120
4155
|
* ```typescript
|
|
4121
|
-
* // Default:
|
|
4156
|
+
* // Default: pooled keep-alive connections
|
|
4122
4157
|
* const { data } = await rezo.get('https://api.example.com/data');
|
|
4123
4158
|
*
|
|
4124
|
-
* //
|
|
4125
|
-
* const client =
|
|
4159
|
+
* // Fresh connection per request for this instance
|
|
4160
|
+
* const client = rezo.create({ keepAlive: false });
|
|
4126
4161
|
* await client.get('https://api.example.com/users');
|
|
4127
|
-
* await client.get('https://api.example.com/posts'); //
|
|
4162
|
+
* await client.get('https://api.example.com/posts'); // New connection again
|
|
4128
4163
|
*
|
|
4129
|
-
* //
|
|
4130
|
-
*
|
|
4164
|
+
* // Or per request
|
|
4165
|
+
* await rezo.get('https://api.example.com/data', { keepAlive: false });
|
|
4131
4166
|
* ```
|
|
4132
4167
|
*
|
|
4133
|
-
* @default
|
|
4168
|
+
* @default true
|
|
4134
4169
|
*/
|
|
4135
4170
|
keepAlive?: boolean;
|
|
4136
4171
|
/**
|
|
@@ -6096,7 +6131,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
6096
6131
|
*
|
|
6097
6132
|
* IMPORTANT: Update these values when bumping package version.
|
|
6098
6133
|
*/
|
|
6099
|
-
export declare const VERSION = "1.0.
|
|
6134
|
+
export declare const VERSION = "1.0.139";
|
|
6100
6135
|
export interface ExpoFileSystemFileLike {
|
|
6101
6136
|
uri?: string;
|
|
6102
6137
|
size?: number;
|