rezo 1.0.11 → 1.0.13
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 +73 -10
- package/dist/adapters/curl.js +73 -10
- package/dist/adapters/entries/curl.d.ts +66 -1
- package/dist/adapters/entries/fetch.d.ts +66 -1
- package/dist/adapters/entries/http.d.ts +66 -1
- package/dist/adapters/entries/http2.d.ts +66 -1
- package/dist/adapters/entries/react-native.d.ts +66 -1
- package/dist/adapters/entries/xhr.d.ts +66 -1
- package/dist/adapters/fetch.cjs +106 -59
- package/dist/adapters/fetch.js +106 -59
- package/dist/adapters/http.cjs +28 -15
- package/dist/adapters/http.js +28 -15
- package/dist/adapters/http2.cjs +114 -55
- package/dist/adapters/http2.js +114 -55
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +66 -1
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +66 -1
- package/dist/platform/browser.d.ts +66 -1
- package/dist/platform/bun.d.ts +66 -1
- package/dist/platform/deno.d.ts +66 -1
- package/dist/platform/node.d.ts +66 -1
- package/dist/platform/react-native.d.ts +66 -1
- package/dist/platform/worker.d.ts +66 -1
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/buildError.cjs +5 -1
- package/dist/responses/buildError.js +5 -1
- package/dist/responses/buildResponse.cjs +30 -3
- package/dist/responses/buildResponse.js +30 -3
- package/dist/utils/compression.cjs +6 -6
- package/dist/utils/compression.js +6 -6
- package/dist/utils/headers.cjs +17 -0
- package/dist/utils/headers.js +17 -1
- package/dist/utils/http-config.cjs +47 -5
- package/dist/utils/http-config.js +47 -5
- package/package.json +1 -1
package/dist/platform/bun.d.ts
CHANGED
|
@@ -2502,8 +2502,73 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2502
2502
|
maxRedirects?: number;
|
|
2503
2503
|
/** Whether to automatically decompress response data */
|
|
2504
2504
|
decompress?: boolean;
|
|
2505
|
-
/**
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2507
|
+
*
|
|
2508
|
+
* When enabled, the underlying TCP connection is kept open after a request completes,
|
|
2509
|
+
* allowing subsequent requests to the same host to reuse the connection. This reduces
|
|
2510
|
+
* latency by avoiding the overhead of establishing new connections (TCP handshake,
|
|
2511
|
+
* TLS negotiation for HTTPS).
|
|
2512
|
+
*
|
|
2513
|
+
* **Behavior:**
|
|
2514
|
+
* - `false` (default) - Connection closes after each request. Process exits immediately.
|
|
2515
|
+
* - `true` - Connection stays open for reuse. Idle connections close after `keepAliveMsecs`.
|
|
2516
|
+
*
|
|
2517
|
+
* **When to use `keepAlive: true`:**
|
|
2518
|
+
* - Making multiple requests to the same host in sequence
|
|
2519
|
+
* - Long-running applications (servers, bots, scrapers)
|
|
2520
|
+
* - Performance-critical applications where connection overhead matters
|
|
2521
|
+
*
|
|
2522
|
+
* **When to use `keepAlive: false` (default):**
|
|
2523
|
+
* - Single requests or scripts that should exit immediately
|
|
2524
|
+
* - CLI tools that make one-off requests
|
|
2525
|
+
* - When you need predictable process termination
|
|
2526
|
+
*
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```typescript
|
|
2529
|
+
* // Default: process exits immediately after request
|
|
2530
|
+
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2531
|
+
*
|
|
2532
|
+
* // Keep connection alive for 1 minute (default) for subsequent requests
|
|
2533
|
+
* const client = new Rezo({ keepAlive: true });
|
|
2534
|
+
* await client.get('https://api.example.com/users');
|
|
2535
|
+
* await client.get('https://api.example.com/posts'); // Reuses connection
|
|
2536
|
+
*
|
|
2537
|
+
* // Custom keep-alive timeout (30 seconds)
|
|
2538
|
+
* const client = new Rezo({ keepAlive: true, keepAliveMsecs: 30000 });
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @default false
|
|
2542
|
+
*/
|
|
2506
2543
|
keepAlive?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* How long to keep idle connections alive in milliseconds.
|
|
2546
|
+
*
|
|
2547
|
+
* Only applies when `keepAlive: true`. After this duration of inactivity,
|
|
2548
|
+
* the connection is closed automatically. This prevents resource leaks
|
|
2549
|
+
* from connections that are no longer needed.
|
|
2550
|
+
*
|
|
2551
|
+
* **Note:** Even with keep-alive enabled, the Node.js process can still exit
|
|
2552
|
+
* cleanly when there's no other work to do, thanks to socket unreferencing.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
* ```typescript
|
|
2556
|
+
* // Keep connections alive for 30 seconds
|
|
2557
|
+
* const client = new Rezo({
|
|
2558
|
+
* keepAlive: true,
|
|
2559
|
+
* keepAliveMsecs: 30000
|
|
2560
|
+
* });
|
|
2561
|
+
*
|
|
2562
|
+
* // Keep connections alive for 2 minutes
|
|
2563
|
+
* const client = new Rezo({
|
|
2564
|
+
* keepAlive: true,
|
|
2565
|
+
* keepAliveMsecs: 120000
|
|
2566
|
+
* });
|
|
2567
|
+
* ```
|
|
2568
|
+
*
|
|
2569
|
+
* @default 60000 (1 minute)
|
|
2570
|
+
*/
|
|
2571
|
+
keepAliveMsecs?: number;
|
|
2507
2572
|
withoutBodyOnRedirect?: boolean;
|
|
2508
2573
|
autoSetReferer?: boolean;
|
|
2509
2574
|
autoSetOrigin?: boolean;
|
package/dist/platform/deno.d.ts
CHANGED
|
@@ -2502,8 +2502,73 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2502
2502
|
maxRedirects?: number;
|
|
2503
2503
|
/** Whether to automatically decompress response data */
|
|
2504
2504
|
decompress?: boolean;
|
|
2505
|
-
/**
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2507
|
+
*
|
|
2508
|
+
* When enabled, the underlying TCP connection is kept open after a request completes,
|
|
2509
|
+
* allowing subsequent requests to the same host to reuse the connection. This reduces
|
|
2510
|
+
* latency by avoiding the overhead of establishing new connections (TCP handshake,
|
|
2511
|
+
* TLS negotiation for HTTPS).
|
|
2512
|
+
*
|
|
2513
|
+
* **Behavior:**
|
|
2514
|
+
* - `false` (default) - Connection closes after each request. Process exits immediately.
|
|
2515
|
+
* - `true` - Connection stays open for reuse. Idle connections close after `keepAliveMsecs`.
|
|
2516
|
+
*
|
|
2517
|
+
* **When to use `keepAlive: true`:**
|
|
2518
|
+
* - Making multiple requests to the same host in sequence
|
|
2519
|
+
* - Long-running applications (servers, bots, scrapers)
|
|
2520
|
+
* - Performance-critical applications where connection overhead matters
|
|
2521
|
+
*
|
|
2522
|
+
* **When to use `keepAlive: false` (default):**
|
|
2523
|
+
* - Single requests or scripts that should exit immediately
|
|
2524
|
+
* - CLI tools that make one-off requests
|
|
2525
|
+
* - When you need predictable process termination
|
|
2526
|
+
*
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```typescript
|
|
2529
|
+
* // Default: process exits immediately after request
|
|
2530
|
+
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2531
|
+
*
|
|
2532
|
+
* // Keep connection alive for 1 minute (default) for subsequent requests
|
|
2533
|
+
* const client = new Rezo({ keepAlive: true });
|
|
2534
|
+
* await client.get('https://api.example.com/users');
|
|
2535
|
+
* await client.get('https://api.example.com/posts'); // Reuses connection
|
|
2536
|
+
*
|
|
2537
|
+
* // Custom keep-alive timeout (30 seconds)
|
|
2538
|
+
* const client = new Rezo({ keepAlive: true, keepAliveMsecs: 30000 });
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @default false
|
|
2542
|
+
*/
|
|
2506
2543
|
keepAlive?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* How long to keep idle connections alive in milliseconds.
|
|
2546
|
+
*
|
|
2547
|
+
* Only applies when `keepAlive: true`. After this duration of inactivity,
|
|
2548
|
+
* the connection is closed automatically. This prevents resource leaks
|
|
2549
|
+
* from connections that are no longer needed.
|
|
2550
|
+
*
|
|
2551
|
+
* **Note:** Even with keep-alive enabled, the Node.js process can still exit
|
|
2552
|
+
* cleanly when there's no other work to do, thanks to socket unreferencing.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
* ```typescript
|
|
2556
|
+
* // Keep connections alive for 30 seconds
|
|
2557
|
+
* const client = new Rezo({
|
|
2558
|
+
* keepAlive: true,
|
|
2559
|
+
* keepAliveMsecs: 30000
|
|
2560
|
+
* });
|
|
2561
|
+
*
|
|
2562
|
+
* // Keep connections alive for 2 minutes
|
|
2563
|
+
* const client = new Rezo({
|
|
2564
|
+
* keepAlive: true,
|
|
2565
|
+
* keepAliveMsecs: 120000
|
|
2566
|
+
* });
|
|
2567
|
+
* ```
|
|
2568
|
+
*
|
|
2569
|
+
* @default 60000 (1 minute)
|
|
2570
|
+
*/
|
|
2571
|
+
keepAliveMsecs?: number;
|
|
2507
2572
|
withoutBodyOnRedirect?: boolean;
|
|
2508
2573
|
autoSetReferer?: boolean;
|
|
2509
2574
|
autoSetOrigin?: boolean;
|
package/dist/platform/node.d.ts
CHANGED
|
@@ -2502,8 +2502,73 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2502
2502
|
maxRedirects?: number;
|
|
2503
2503
|
/** Whether to automatically decompress response data */
|
|
2504
2504
|
decompress?: boolean;
|
|
2505
|
-
/**
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2507
|
+
*
|
|
2508
|
+
* When enabled, the underlying TCP connection is kept open after a request completes,
|
|
2509
|
+
* allowing subsequent requests to the same host to reuse the connection. This reduces
|
|
2510
|
+
* latency by avoiding the overhead of establishing new connections (TCP handshake,
|
|
2511
|
+
* TLS negotiation for HTTPS).
|
|
2512
|
+
*
|
|
2513
|
+
* **Behavior:**
|
|
2514
|
+
* - `false` (default) - Connection closes after each request. Process exits immediately.
|
|
2515
|
+
* - `true` - Connection stays open for reuse. Idle connections close after `keepAliveMsecs`.
|
|
2516
|
+
*
|
|
2517
|
+
* **When to use `keepAlive: true`:**
|
|
2518
|
+
* - Making multiple requests to the same host in sequence
|
|
2519
|
+
* - Long-running applications (servers, bots, scrapers)
|
|
2520
|
+
* - Performance-critical applications where connection overhead matters
|
|
2521
|
+
*
|
|
2522
|
+
* **When to use `keepAlive: false` (default):**
|
|
2523
|
+
* - Single requests or scripts that should exit immediately
|
|
2524
|
+
* - CLI tools that make one-off requests
|
|
2525
|
+
* - When you need predictable process termination
|
|
2526
|
+
*
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```typescript
|
|
2529
|
+
* // Default: process exits immediately after request
|
|
2530
|
+
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2531
|
+
*
|
|
2532
|
+
* // Keep connection alive for 1 minute (default) for subsequent requests
|
|
2533
|
+
* const client = new Rezo({ keepAlive: true });
|
|
2534
|
+
* await client.get('https://api.example.com/users');
|
|
2535
|
+
* await client.get('https://api.example.com/posts'); // Reuses connection
|
|
2536
|
+
*
|
|
2537
|
+
* // Custom keep-alive timeout (30 seconds)
|
|
2538
|
+
* const client = new Rezo({ keepAlive: true, keepAliveMsecs: 30000 });
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @default false
|
|
2542
|
+
*/
|
|
2506
2543
|
keepAlive?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* How long to keep idle connections alive in milliseconds.
|
|
2546
|
+
*
|
|
2547
|
+
* Only applies when `keepAlive: true`. After this duration of inactivity,
|
|
2548
|
+
* the connection is closed automatically. This prevents resource leaks
|
|
2549
|
+
* from connections that are no longer needed.
|
|
2550
|
+
*
|
|
2551
|
+
* **Note:** Even with keep-alive enabled, the Node.js process can still exit
|
|
2552
|
+
* cleanly when there's no other work to do, thanks to socket unreferencing.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
* ```typescript
|
|
2556
|
+
* // Keep connections alive for 30 seconds
|
|
2557
|
+
* const client = new Rezo({
|
|
2558
|
+
* keepAlive: true,
|
|
2559
|
+
* keepAliveMsecs: 30000
|
|
2560
|
+
* });
|
|
2561
|
+
*
|
|
2562
|
+
* // Keep connections alive for 2 minutes
|
|
2563
|
+
* const client = new Rezo({
|
|
2564
|
+
* keepAlive: true,
|
|
2565
|
+
* keepAliveMsecs: 120000
|
|
2566
|
+
* });
|
|
2567
|
+
* ```
|
|
2568
|
+
*
|
|
2569
|
+
* @default 60000 (1 minute)
|
|
2570
|
+
*/
|
|
2571
|
+
keepAliveMsecs?: number;
|
|
2507
2572
|
withoutBodyOnRedirect?: boolean;
|
|
2508
2573
|
autoSetReferer?: boolean;
|
|
2509
2574
|
autoSetOrigin?: boolean;
|
|
@@ -2502,8 +2502,73 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2502
2502
|
maxRedirects?: number;
|
|
2503
2503
|
/** Whether to automatically decompress response data */
|
|
2504
2504
|
decompress?: boolean;
|
|
2505
|
-
/**
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2507
|
+
*
|
|
2508
|
+
* When enabled, the underlying TCP connection is kept open after a request completes,
|
|
2509
|
+
* allowing subsequent requests to the same host to reuse the connection. This reduces
|
|
2510
|
+
* latency by avoiding the overhead of establishing new connections (TCP handshake,
|
|
2511
|
+
* TLS negotiation for HTTPS).
|
|
2512
|
+
*
|
|
2513
|
+
* **Behavior:**
|
|
2514
|
+
* - `false` (default) - Connection closes after each request. Process exits immediately.
|
|
2515
|
+
* - `true` - Connection stays open for reuse. Idle connections close after `keepAliveMsecs`.
|
|
2516
|
+
*
|
|
2517
|
+
* **When to use `keepAlive: true`:**
|
|
2518
|
+
* - Making multiple requests to the same host in sequence
|
|
2519
|
+
* - Long-running applications (servers, bots, scrapers)
|
|
2520
|
+
* - Performance-critical applications where connection overhead matters
|
|
2521
|
+
*
|
|
2522
|
+
* **When to use `keepAlive: false` (default):**
|
|
2523
|
+
* - Single requests or scripts that should exit immediately
|
|
2524
|
+
* - CLI tools that make one-off requests
|
|
2525
|
+
* - When you need predictable process termination
|
|
2526
|
+
*
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```typescript
|
|
2529
|
+
* // Default: process exits immediately after request
|
|
2530
|
+
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2531
|
+
*
|
|
2532
|
+
* // Keep connection alive for 1 minute (default) for subsequent requests
|
|
2533
|
+
* const client = new Rezo({ keepAlive: true });
|
|
2534
|
+
* await client.get('https://api.example.com/users');
|
|
2535
|
+
* await client.get('https://api.example.com/posts'); // Reuses connection
|
|
2536
|
+
*
|
|
2537
|
+
* // Custom keep-alive timeout (30 seconds)
|
|
2538
|
+
* const client = new Rezo({ keepAlive: true, keepAliveMsecs: 30000 });
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @default false
|
|
2542
|
+
*/
|
|
2506
2543
|
keepAlive?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* How long to keep idle connections alive in milliseconds.
|
|
2546
|
+
*
|
|
2547
|
+
* Only applies when `keepAlive: true`. After this duration of inactivity,
|
|
2548
|
+
* the connection is closed automatically. This prevents resource leaks
|
|
2549
|
+
* from connections that are no longer needed.
|
|
2550
|
+
*
|
|
2551
|
+
* **Note:** Even with keep-alive enabled, the Node.js process can still exit
|
|
2552
|
+
* cleanly when there's no other work to do, thanks to socket unreferencing.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
* ```typescript
|
|
2556
|
+
* // Keep connections alive for 30 seconds
|
|
2557
|
+
* const client = new Rezo({
|
|
2558
|
+
* keepAlive: true,
|
|
2559
|
+
* keepAliveMsecs: 30000
|
|
2560
|
+
* });
|
|
2561
|
+
*
|
|
2562
|
+
* // Keep connections alive for 2 minutes
|
|
2563
|
+
* const client = new Rezo({
|
|
2564
|
+
* keepAlive: true,
|
|
2565
|
+
* keepAliveMsecs: 120000
|
|
2566
|
+
* });
|
|
2567
|
+
* ```
|
|
2568
|
+
*
|
|
2569
|
+
* @default 60000 (1 minute)
|
|
2570
|
+
*/
|
|
2571
|
+
keepAliveMsecs?: number;
|
|
2507
2572
|
withoutBodyOnRedirect?: boolean;
|
|
2508
2573
|
autoSetReferer?: boolean;
|
|
2509
2574
|
autoSetOrigin?: boolean;
|
|
@@ -2502,8 +2502,73 @@ export interface RezoRequestConfig<D = any> {
|
|
|
2502
2502
|
maxRedirects?: number;
|
|
2503
2503
|
/** Whether to automatically decompress response data */
|
|
2504
2504
|
decompress?: boolean;
|
|
2505
|
-
/**
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether to keep TCP connections alive for reuse across multiple requests.
|
|
2507
|
+
*
|
|
2508
|
+
* When enabled, the underlying TCP connection is kept open after a request completes,
|
|
2509
|
+
* allowing subsequent requests to the same host to reuse the connection. This reduces
|
|
2510
|
+
* latency by avoiding the overhead of establishing new connections (TCP handshake,
|
|
2511
|
+
* TLS negotiation for HTTPS).
|
|
2512
|
+
*
|
|
2513
|
+
* **Behavior:**
|
|
2514
|
+
* - `false` (default) - Connection closes after each request. Process exits immediately.
|
|
2515
|
+
* - `true` - Connection stays open for reuse. Idle connections close after `keepAliveMsecs`.
|
|
2516
|
+
*
|
|
2517
|
+
* **When to use `keepAlive: true`:**
|
|
2518
|
+
* - Making multiple requests to the same host in sequence
|
|
2519
|
+
* - Long-running applications (servers, bots, scrapers)
|
|
2520
|
+
* - Performance-critical applications where connection overhead matters
|
|
2521
|
+
*
|
|
2522
|
+
* **When to use `keepAlive: false` (default):**
|
|
2523
|
+
* - Single requests or scripts that should exit immediately
|
|
2524
|
+
* - CLI tools that make one-off requests
|
|
2525
|
+
* - When you need predictable process termination
|
|
2526
|
+
*
|
|
2527
|
+
* @example
|
|
2528
|
+
* ```typescript
|
|
2529
|
+
* // Default: process exits immediately after request
|
|
2530
|
+
* const { data } = await rezo.get('https://api.example.com/data');
|
|
2531
|
+
*
|
|
2532
|
+
* // Keep connection alive for 1 minute (default) for subsequent requests
|
|
2533
|
+
* const client = new Rezo({ keepAlive: true });
|
|
2534
|
+
* await client.get('https://api.example.com/users');
|
|
2535
|
+
* await client.get('https://api.example.com/posts'); // Reuses connection
|
|
2536
|
+
*
|
|
2537
|
+
* // Custom keep-alive timeout (30 seconds)
|
|
2538
|
+
* const client = new Rezo({ keepAlive: true, keepAliveMsecs: 30000 });
|
|
2539
|
+
* ```
|
|
2540
|
+
*
|
|
2541
|
+
* @default false
|
|
2542
|
+
*/
|
|
2506
2543
|
keepAlive?: boolean;
|
|
2544
|
+
/**
|
|
2545
|
+
* How long to keep idle connections alive in milliseconds.
|
|
2546
|
+
*
|
|
2547
|
+
* Only applies when `keepAlive: true`. After this duration of inactivity,
|
|
2548
|
+
* the connection is closed automatically. This prevents resource leaks
|
|
2549
|
+
* from connections that are no longer needed.
|
|
2550
|
+
*
|
|
2551
|
+
* **Note:** Even with keep-alive enabled, the Node.js process can still exit
|
|
2552
|
+
* cleanly when there's no other work to do, thanks to socket unreferencing.
|
|
2553
|
+
*
|
|
2554
|
+
* @example
|
|
2555
|
+
* ```typescript
|
|
2556
|
+
* // Keep connections alive for 30 seconds
|
|
2557
|
+
* const client = new Rezo({
|
|
2558
|
+
* keepAlive: true,
|
|
2559
|
+
* keepAliveMsecs: 30000
|
|
2560
|
+
* });
|
|
2561
|
+
*
|
|
2562
|
+
* // Keep connections alive for 2 minutes
|
|
2563
|
+
* const client = new Rezo({
|
|
2564
|
+
* keepAlive: true,
|
|
2565
|
+
* keepAliveMsecs: 120000
|
|
2566
|
+
* });
|
|
2567
|
+
* ```
|
|
2568
|
+
*
|
|
2569
|
+
* @default 60000 (1 minute)
|
|
2570
|
+
*/
|
|
2571
|
+
keepAliveMsecs?: number;
|
|
2507
2572
|
withoutBodyOnRedirect?: boolean;
|
|
2508
2573
|
autoSetReferer?: boolean;
|
|
2509
2574
|
autoSetOrigin?: boolean;
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.FileCacher =
|
|
7
|
-
const
|
|
8
|
-
exports.UrlStore =
|
|
9
|
-
const
|
|
10
|
-
exports.Oxylabs =
|
|
11
|
-
const
|
|
12
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
13
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
14
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
15
|
-
exports.OXYLABS_US_STATES =
|
|
16
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
17
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
18
|
-
exports.getRandomOxylabsBrowserType =
|
|
19
|
-
exports.getRandomOxylabsLocale =
|
|
20
|
-
exports.getRandomOxylabsGeoLocation =
|
|
21
|
-
const
|
|
22
|
-
exports.Decodo =
|
|
23
|
-
const
|
|
24
|
-
exports.DECODO_DEVICE_TYPES =
|
|
25
|
-
exports.DECODO_HEADLESS_MODES =
|
|
26
|
-
exports.DECODO_COMMON_LOCALES =
|
|
27
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
28
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
29
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
30
|
-
exports.DECODO_US_STATES =
|
|
31
|
-
exports.DECODO_COMMON_CITIES =
|
|
32
|
-
exports.getRandomDecodoDeviceType =
|
|
33
|
-
exports.getRandomDecodoLocale =
|
|
34
|
-
exports.getRandomDecodoCountry =
|
|
35
|
-
exports.getRandomDecodoCity =
|
|
36
|
-
exports.generateDecodoSessionId =
|
|
1
|
+
const _mod_dq9ozb = require('./crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_dq9ozb.Crawler;;
|
|
3
|
+
const _mod_d0jsak = require('./crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_d0jsak.CrawlerOptions;;
|
|
5
|
+
const _mod_wbhzam = require('../cache/file-cacher.cjs');
|
|
6
|
+
exports.FileCacher = _mod_wbhzam.FileCacher;;
|
|
7
|
+
const _mod_ic6xnp = require('../cache/url-store.cjs');
|
|
8
|
+
exports.UrlStore = _mod_ic6xnp.UrlStore;;
|
|
9
|
+
const _mod_u5fn2x = require('./addon/oxylabs/index.cjs');
|
|
10
|
+
exports.Oxylabs = _mod_u5fn2x.Oxylabs;;
|
|
11
|
+
const _mod_mc3i9t = require('./addon/oxylabs/options.cjs');
|
|
12
|
+
exports.OXYLABS_BROWSER_TYPES = _mod_mc3i9t.OXYLABS_BROWSER_TYPES;
|
|
13
|
+
exports.OXYLABS_COMMON_LOCALES = _mod_mc3i9t.OXYLABS_COMMON_LOCALES;
|
|
14
|
+
exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_mc3i9t.OXYLABS_COMMON_GEO_LOCATIONS;
|
|
15
|
+
exports.OXYLABS_US_STATES = _mod_mc3i9t.OXYLABS_US_STATES;
|
|
16
|
+
exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_mc3i9t.OXYLABS_EUROPEAN_COUNTRIES;
|
|
17
|
+
exports.OXYLABS_ASIAN_COUNTRIES = _mod_mc3i9t.OXYLABS_ASIAN_COUNTRIES;
|
|
18
|
+
exports.getRandomOxylabsBrowserType = _mod_mc3i9t.getRandomBrowserType;
|
|
19
|
+
exports.getRandomOxylabsLocale = _mod_mc3i9t.getRandomLocale;
|
|
20
|
+
exports.getRandomOxylabsGeoLocation = _mod_mc3i9t.getRandomGeoLocation;;
|
|
21
|
+
const _mod_d70cyo = require('./addon/decodo/index.cjs');
|
|
22
|
+
exports.Decodo = _mod_d70cyo.Decodo;;
|
|
23
|
+
const _mod_cmnvxg = require('./addon/decodo/options.cjs');
|
|
24
|
+
exports.DECODO_DEVICE_TYPES = _mod_cmnvxg.DECODO_DEVICE_TYPES;
|
|
25
|
+
exports.DECODO_HEADLESS_MODES = _mod_cmnvxg.DECODO_HEADLESS_MODES;
|
|
26
|
+
exports.DECODO_COMMON_LOCALES = _mod_cmnvxg.DECODO_COMMON_LOCALES;
|
|
27
|
+
exports.DECODO_COMMON_COUNTRIES = _mod_cmnvxg.DECODO_COMMON_COUNTRIES;
|
|
28
|
+
exports.DECODO_EUROPEAN_COUNTRIES = _mod_cmnvxg.DECODO_EUROPEAN_COUNTRIES;
|
|
29
|
+
exports.DECODO_ASIAN_COUNTRIES = _mod_cmnvxg.DECODO_ASIAN_COUNTRIES;
|
|
30
|
+
exports.DECODO_US_STATES = _mod_cmnvxg.DECODO_US_STATES;
|
|
31
|
+
exports.DECODO_COMMON_CITIES = _mod_cmnvxg.DECODO_COMMON_CITIES;
|
|
32
|
+
exports.getRandomDecodoDeviceType = _mod_cmnvxg.getRandomDeviceType;
|
|
33
|
+
exports.getRandomDecodoLocale = _mod_cmnvxg.getRandomLocale;
|
|
34
|
+
exports.getRandomDecodoCountry = _mod_cmnvxg.getRandomCountry;
|
|
35
|
+
exports.getRandomDecodoCity = _mod_cmnvxg.getRandomCity;
|
|
36
|
+
exports.generateDecodoSessionId = _mod_cmnvxg.generateSessionId;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -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
|
|
5
|
-
exports.ProxyManager =
|
|
4
|
+
const _mod_p28kf5 = require('./manager.cjs');
|
|
5
|
+
exports.ProxyManager = _mod_p28kf5.ProxyManager;;
|
|
6
6
|
function createOptions(uri, opts) {
|
|
7
7
|
if (uri instanceof URL || typeof uri === "string") {
|
|
8
8
|
return {
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_5bxokv = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_5bxokv.RezoQueue;;
|
|
3
|
+
const _mod_12mknl = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_12mknl.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_12mknl.extractDomain;;
|
|
6
|
+
const _mod_u9vq92 = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_u9vq92.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_u9vq92.HttpMethodPriority;;
|
|
@@ -348,7 +348,11 @@ function buildRedirectError(messageOrParams, config, request, response) {
|
|
|
348
348
|
return RezoError.createRedirectError("Redirect location not found", errorConfig, errorRequest, errorResponse);
|
|
349
349
|
}
|
|
350
350
|
function builErrorFromResponse(message, response, config, request) {
|
|
351
|
-
|
|
351
|
+
const statusCode = response?.status || 0;
|
|
352
|
+
if (statusCode >= 400) {
|
|
353
|
+
return RezoError.createHttpError(statusCode, config, request, response);
|
|
354
|
+
}
|
|
355
|
+
return new RezoError(message, config, "REZ_UNKNOWN_ERROR", request, response);
|
|
352
356
|
}
|
|
353
357
|
function buildNetworkError(message, code, config, request) {
|
|
354
358
|
return RezoError.createNetworkError(message, code, config, request);
|
|
@@ -348,7 +348,11 @@ export function buildRedirectError(messageOrParams, config, request, response) {
|
|
|
348
348
|
return RezoError.createRedirectError("Redirect location not found", errorConfig, errorRequest, errorResponse);
|
|
349
349
|
}
|
|
350
350
|
export function builErrorFromResponse(message, response, config, request) {
|
|
351
|
-
|
|
351
|
+
const statusCode = response?.status || 0;
|
|
352
|
+
if (statusCode >= 400) {
|
|
353
|
+
return RezoError.createHttpError(statusCode, config, request, response);
|
|
354
|
+
}
|
|
355
|
+
return new RezoError(message, config, "REZ_UNKNOWN_ERROR", request, response);
|
|
352
356
|
}
|
|
353
357
|
export function buildNetworkError(message, code, config, request) {
|
|
354
358
|
return RezoError.createNetworkError(message, code, config, request);
|
|
@@ -297,11 +297,36 @@ function buildResponse(params) {
|
|
|
297
297
|
const rezoHeaders = new RezoHeaders(headers);
|
|
298
298
|
rezoHeaders.delete("set-cookie");
|
|
299
299
|
let cookieData;
|
|
300
|
+
const mergedCookiesArray = [];
|
|
301
|
+
const cookieKeyDomainMap = new Map;
|
|
302
|
+
if (config.requestCookies && config.requestCookies.length > 0) {
|
|
303
|
+
for (const cookie of config.requestCookies) {
|
|
304
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
305
|
+
mergedCookiesArray.push(cookie);
|
|
306
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
let responseCookiesArray = [];
|
|
300
310
|
if (config.responseCookies && config.responseCookies.array && config.responseCookies.array.length > 0) {
|
|
301
|
-
|
|
311
|
+
responseCookiesArray = config.responseCookies.array;
|
|
302
312
|
} else if (cookies.length > 0) {
|
|
303
|
-
const
|
|
304
|
-
|
|
313
|
+
const tempJar = new RezoCookieJar;
|
|
314
|
+
const parsed = tempJar.setCookiesSync(cookies, url);
|
|
315
|
+
responseCookiesArray = parsed.array;
|
|
316
|
+
}
|
|
317
|
+
for (const cookie of responseCookiesArray) {
|
|
318
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
319
|
+
const existingIndex = cookieKeyDomainMap.get(key);
|
|
320
|
+
if (existingIndex !== undefined) {
|
|
321
|
+
mergedCookiesArray[existingIndex] = cookie;
|
|
322
|
+
} else {
|
|
323
|
+
mergedCookiesArray.push(cookie);
|
|
324
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (mergedCookiesArray.length > 0) {
|
|
328
|
+
const mergedJar = new RezoCookieJar(mergedCookiesArray, url);
|
|
329
|
+
cookieData = mergedJar.cookies();
|
|
305
330
|
} else {
|
|
306
331
|
cookieData = {
|
|
307
332
|
array: [],
|
|
@@ -314,6 +339,8 @@ function buildResponse(params) {
|
|
|
314
339
|
setCookiesString: []
|
|
315
340
|
};
|
|
316
341
|
}
|
|
342
|
+
config.status = statusCode;
|
|
343
|
+
config.statusText = statusMessage;
|
|
317
344
|
return {
|
|
318
345
|
data: formatResponse(body, config, rezoHeaders),
|
|
319
346
|
status: statusCode,
|
|
@@ -297,11 +297,36 @@ export function buildResponse(params) {
|
|
|
297
297
|
const rezoHeaders = new RezoHeaders(headers);
|
|
298
298
|
rezoHeaders.delete("set-cookie");
|
|
299
299
|
let cookieData;
|
|
300
|
+
const mergedCookiesArray = [];
|
|
301
|
+
const cookieKeyDomainMap = new Map;
|
|
302
|
+
if (config.requestCookies && config.requestCookies.length > 0) {
|
|
303
|
+
for (const cookie of config.requestCookies) {
|
|
304
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
305
|
+
mergedCookiesArray.push(cookie);
|
|
306
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
let responseCookiesArray = [];
|
|
300
310
|
if (config.responseCookies && config.responseCookies.array && config.responseCookies.array.length > 0) {
|
|
301
|
-
|
|
311
|
+
responseCookiesArray = config.responseCookies.array;
|
|
302
312
|
} else if (cookies.length > 0) {
|
|
303
|
-
const
|
|
304
|
-
|
|
313
|
+
const tempJar = new RezoCookieJar;
|
|
314
|
+
const parsed = tempJar.setCookiesSync(cookies, url);
|
|
315
|
+
responseCookiesArray = parsed.array;
|
|
316
|
+
}
|
|
317
|
+
for (const cookie of responseCookiesArray) {
|
|
318
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
319
|
+
const existingIndex = cookieKeyDomainMap.get(key);
|
|
320
|
+
if (existingIndex !== undefined) {
|
|
321
|
+
mergedCookiesArray[existingIndex] = cookie;
|
|
322
|
+
} else {
|
|
323
|
+
mergedCookiesArray.push(cookie);
|
|
324
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (mergedCookiesArray.length > 0) {
|
|
328
|
+
const mergedJar = new RezoCookieJar(mergedCookiesArray, url);
|
|
329
|
+
cookieData = mergedJar.cookies();
|
|
305
330
|
} else {
|
|
306
331
|
cookieData = {
|
|
307
332
|
array: [],
|
|
@@ -314,6 +339,8 @@ export function buildResponse(params) {
|
|
|
314
339
|
setCookiesString: []
|
|
315
340
|
};
|
|
316
341
|
}
|
|
342
|
+
config.status = statusCode;
|
|
343
|
+
config.statusText = statusMessage;
|
|
317
344
|
return {
|
|
318
345
|
data: formatResponse(body, config, rezoHeaders),
|
|
319
346
|
status: statusCode,
|
|
@@ -50,16 +50,16 @@ class CompressionUtil {
|
|
|
50
50
|
if (!config) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
|
+
if (config.decompress === false) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
53
56
|
if (config.compression?.enabled === false) {
|
|
54
57
|
return false;
|
|
55
58
|
}
|
|
56
|
-
if (config.compression?.
|
|
57
|
-
|
|
58
|
-
return config.compression.algorithms.includes(contentEncoding.toLowerCase());
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
59
|
+
if (config.compression?.algorithms) {
|
|
60
|
+
return config.compression.algorithms.includes(contentEncoding.toLowerCase());
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return true;
|
|
63
63
|
}
|
|
64
64
|
static createZstdDecompressStream(response) {
|
|
65
65
|
const decompressor = getZstdDecompressor();
|
|
@@ -50,16 +50,16 @@ export class CompressionUtil {
|
|
|
50
50
|
if (!config) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
|
+
if (config.decompress === false) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
53
56
|
if (config.compression?.enabled === false) {
|
|
54
57
|
return false;
|
|
55
58
|
}
|
|
56
|
-
if (config.compression?.
|
|
57
|
-
|
|
58
|
-
return config.compression.algorithms.includes(contentEncoding.toLowerCase());
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
59
|
+
if (config.compression?.algorithms) {
|
|
60
|
+
return config.compression.algorithms.includes(contentEncoding.toLowerCase());
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return true;
|
|
63
63
|
}
|
|
64
64
|
static createZstdDecompressStream(response) {
|
|
65
65
|
const decompressor = getZstdDecompressor();
|