rezo 1.0.5 → 1.0.7

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.
Files changed (49) hide show
  1. package/README.md +352 -9
  2. package/dist/adapters/curl.cjs +796 -0
  3. package/dist/adapters/curl.js +796 -0
  4. package/dist/adapters/entries/curl.d.ts +2407 -20
  5. package/dist/adapters/entries/fetch.d.ts +364 -20
  6. package/dist/adapters/entries/http.d.ts +364 -20
  7. package/dist/adapters/entries/http2.d.ts +364 -20
  8. package/dist/adapters/entries/react-native.d.ts +364 -20
  9. package/dist/adapters/entries/xhr.d.ts +364 -20
  10. package/dist/adapters/index.cjs +6 -6
  11. package/dist/adapters/picker.cjs +2 -2
  12. package/dist/adapters/picker.js +2 -2
  13. package/dist/cache/index.cjs +13 -13
  14. package/dist/core/hooks.cjs +2 -0
  15. package/dist/core/hooks.js +2 -0
  16. package/dist/core/rezo.cjs +2 -2
  17. package/dist/core/rezo.js +2 -2
  18. package/dist/crawler.d.ts +366 -22
  19. package/dist/entries/crawler.cjs +5 -5
  20. package/dist/index.cjs +23 -18
  21. package/dist/index.d.ts +631 -20
  22. package/dist/index.js +1 -0
  23. package/dist/platform/browser.d.ts +364 -20
  24. package/dist/platform/bun.d.ts +364 -20
  25. package/dist/platform/deno.d.ts +364 -20
  26. package/dist/platform/node.d.ts +364 -20
  27. package/dist/platform/react-native.d.ts +364 -20
  28. package/dist/platform/worker.d.ts +364 -20
  29. package/dist/plugin/crawler-options.cjs +1 -1
  30. package/dist/plugin/crawler-options.js +1 -1
  31. package/dist/plugin/crawler.cjs +2 -2
  32. package/dist/plugin/crawler.js +2 -2
  33. package/dist/plugin/index.cjs +36 -36
  34. package/dist/proxy/index.cjs +2 -2
  35. package/dist/proxy/manager.cjs +57 -2
  36. package/dist/proxy/manager.js +57 -2
  37. package/dist/queue/http-queue.cjs +313 -0
  38. package/dist/queue/http-queue.js +312 -0
  39. package/dist/queue/index.cjs +8 -0
  40. package/dist/queue/index.js +6 -0
  41. package/dist/queue/queue.cjs +346 -0
  42. package/dist/queue/queue.js +344 -0
  43. package/dist/queue/types.cjs +17 -0
  44. package/dist/queue/types.js +17 -0
  45. package/dist/types/curl-options.cjs +25 -0
  46. package/dist/types/curl-options.js +25 -0
  47. package/dist/utils/http-config.cjs +0 -15
  48. package/dist/utils/http-config.js +0 -15
  49. package/package.json +1 -2
@@ -6,9 +6,6 @@ import { Agent as HttpsAgent } from 'node:https';
6
6
  import { Socket } from 'node:net';
7
7
  import { Readable, Writable, WritableOptions } from 'node:stream';
8
8
  import { SecureContext, TLSSocket } from 'node:tls';
9
- import PQueue from 'p-queue';
10
- import { Options as Options$1, QueueAddOptions } from 'p-queue';
11
- import PriorityQueue from 'p-queue/dist/priority-queue';
12
9
  import { Cookie as TouchCookie, CookieJar as TouchCookieJar, CreateCookieOptions } from 'tough-cookie';
13
10
 
14
11
  export interface RezoHttpHeaders {
@@ -972,8 +969,17 @@ export interface ProxyCooldownConfig {
972
969
  * Complete configuration for proxy rotation, filtering, and failure handling
973
970
  */
974
971
  export interface ProxyManagerBaseConfig {
975
- /** Array of proxies to manage */
976
- proxies: ProxyInfo[];
972
+ /**
973
+ * Array of proxies to manage
974
+ * Accepts ProxyInfo objects or proxy URL strings (parsed via parseProxyString)
975
+ * @example
976
+ * proxies: [
977
+ * { protocol: 'http', host: '127.0.0.1', port: 8080 },
978
+ * 'socks5://user:pass@proxy.example.com:1080',
979
+ * 'http://proxy.example.com:3128'
980
+ * ]
981
+ */
982
+ proxies: (ProxyInfo | string)[];
977
983
  /**
978
984
  * Whitelist patterns for URLs that should use proxy
979
985
  * - String: exact domain match (e.g., 'api.example.com') or subdomain match (e.g., 'example.com' matches '*.example.com')
@@ -1185,6 +1191,35 @@ export interface AfterProxyEnableContext {
1185
1191
  /** Reason for enabling */
1186
1192
  reason: "cooldown-expired" | "manual";
1187
1193
  }
1194
+ /**
1195
+ * Context for onNoProxiesAvailable hook
1196
+ * Triggered when no proxies are available and an error would be thrown
1197
+ */
1198
+ export interface OnNoProxiesAvailableContext {
1199
+ /** Request URL that needed a proxy */
1200
+ url: string;
1201
+ /** The error that will be thrown */
1202
+ error: Error;
1203
+ /** All proxies (including disabled ones) */
1204
+ allProxies: ProxyState[];
1205
+ /** Number of active proxies (should be 0) */
1206
+ activeCount: number;
1207
+ /** Number of disabled proxies */
1208
+ disabledCount: number;
1209
+ /** Number of proxies in cooldown */
1210
+ cooldownCount: number;
1211
+ /** Reasons why proxies are unavailable */
1212
+ disabledReasons: {
1213
+ /** Proxies disabled due to failures */
1214
+ dead: number;
1215
+ /** Proxies disabled due to request limit */
1216
+ limitReached: number;
1217
+ /** Proxies manually disabled */
1218
+ manual: number;
1219
+ };
1220
+ /** Timestamp when this event occurred */
1221
+ timestamp: number;
1222
+ }
1188
1223
  /**
1189
1224
  * Context provided to beforeRequest hook
1190
1225
  * Contains metadata about the current request state
@@ -1503,6 +1538,16 @@ export type AfterProxyRotateHook = (context: AfterProxyRotateContext) => void |
1503
1538
  * Use for notifications, logging
1504
1539
  */
1505
1540
  export type AfterProxyEnableHook = (context: AfterProxyEnableContext) => void | Promise<void>;
1541
+ /**
1542
+ * Hook called when no proxies are available and an error is about to be thrown
1543
+ * Use for alerting, logging exhausted proxy pools, or triggering proxy refresh
1544
+ * This hook is called just before the error is thrown, allowing you to:
1545
+ * - Log the exhaustion event for monitoring
1546
+ * - Trigger external proxy pool refresh
1547
+ * - Send alerts to monitoring systems
1548
+ * - Record statistics about proxy pool health
1549
+ */
1550
+ export type OnNoProxiesAvailableHook = (context: OnNoProxiesAvailableContext) => void | Promise<void>;
1506
1551
  /**
1507
1552
  * Collection of all hook types
1508
1553
  * All hooks are arrays to allow multiple handlers
@@ -1527,6 +1572,7 @@ export interface RezoHooks {
1527
1572
  afterProxyDisable: AfterProxyDisableHook[];
1528
1573
  afterProxyRotate: AfterProxyRotateHook[];
1529
1574
  afterProxyEnable: AfterProxyEnableHook[];
1575
+ onNoProxiesAvailable: OnNoProxiesAvailableHook[];
1530
1576
  onSocket: OnSocketHook[];
1531
1577
  onDns: OnDnsHook[];
1532
1578
  onTls: OnTlsHook[];
@@ -1983,6 +2029,275 @@ export declare class RezoError<T = any> extends Error {
1983
2029
  toString(): string;
1984
2030
  getFullDetails(): string;
1985
2031
  }
2032
+ /**
2033
+ * Queue configuration options
2034
+ */
2035
+ export interface QueueConfig {
2036
+ /** Maximum concurrent tasks (default: Infinity) */
2037
+ concurrency?: number;
2038
+ /** Auto-start processing when tasks are added (default: true) */
2039
+ autoStart?: boolean;
2040
+ /** Timeout per task in milliseconds (default: none) */
2041
+ timeout?: number;
2042
+ /** Throw on timeout vs silently fail (default: true) */
2043
+ throwOnTimeout?: boolean;
2044
+ /** Interval between task starts in ms for rate limiting */
2045
+ interval?: number;
2046
+ /** Max tasks to start per interval (default: Infinity) */
2047
+ intervalCap?: number;
2048
+ /** Carry over unused interval capacity to next interval */
2049
+ carryoverConcurrencyCount?: boolean;
2050
+ }
2051
+ /**
2052
+ * Task options when adding to queue
2053
+ */
2054
+ export interface TaskOptions {
2055
+ /** Task priority (higher runs first, default: 0) */
2056
+ priority?: number;
2057
+ /** Task-specific timeout (overrides queue default) */
2058
+ timeout?: number;
2059
+ /** Unique ID for tracking/cancellation */
2060
+ id?: string;
2061
+ /** Signal for external cancellation */
2062
+ signal?: AbortSignal;
2063
+ }
2064
+ /**
2065
+ * Current queue state
2066
+ */
2067
+ export interface QueueState {
2068
+ /** Number of tasks currently running */
2069
+ pending: number;
2070
+ /** Number of tasks waiting in queue */
2071
+ size: number;
2072
+ /** Total tasks (pending + size) */
2073
+ total: number;
2074
+ /** Is queue paused */
2075
+ isPaused: boolean;
2076
+ /** Is queue idle (no tasks) */
2077
+ isIdle: boolean;
2078
+ }
2079
+ /**
2080
+ * Queue statistics
2081
+ */
2082
+ export interface QueueStats {
2083
+ /** Total tasks added since creation */
2084
+ added: number;
2085
+ /** Total tasks processed (started) */
2086
+ processed: number;
2087
+ /** Total successful completions */
2088
+ completed: number;
2089
+ /** Total failures */
2090
+ failed: number;
2091
+ /** Total timeouts */
2092
+ timedOut: number;
2093
+ /** Total cancellations */
2094
+ cancelled: number;
2095
+ /** Average task duration (ms) */
2096
+ averageDuration: number;
2097
+ /** Tasks per second (rolling average) */
2098
+ throughput: number;
2099
+ }
2100
+ /**
2101
+ * Queue event types
2102
+ */
2103
+ export interface QueueEvents {
2104
+ /** Task added to queue */
2105
+ add: {
2106
+ id: string;
2107
+ priority: number;
2108
+ };
2109
+ /** Task started executing */
2110
+ start: {
2111
+ id: string;
2112
+ };
2113
+ /** Task completed successfully */
2114
+ completed: {
2115
+ id: string;
2116
+ result: any;
2117
+ duration: number;
2118
+ };
2119
+ /** Task failed with error */
2120
+ error: {
2121
+ id: string;
2122
+ error: Error;
2123
+ };
2124
+ /** Task timed out */
2125
+ timeout: {
2126
+ id: string;
2127
+ };
2128
+ /** Task cancelled */
2129
+ cancelled: {
2130
+ id: string;
2131
+ };
2132
+ /** Queue became active (was idle, now processing) */
2133
+ active: undefined;
2134
+ /** Queue became idle (all tasks done) */
2135
+ idle: undefined;
2136
+ /** Queue was paused */
2137
+ paused: undefined;
2138
+ /** Queue was resumed */
2139
+ resumed: undefined;
2140
+ /** Next task about to run */
2141
+ next: undefined;
2142
+ /** Queue was emptied (no pending tasks) */
2143
+ empty: undefined;
2144
+ }
2145
+ /**
2146
+ * Event handler type
2147
+ */
2148
+ export type EventHandler<T> = (data: T) => void;
2149
+ /**
2150
+ * Task function type
2151
+ */
2152
+ export type TaskFunction<T> = () => Promise<T>;
2153
+ declare class RezoQueue<T = any> {
2154
+ private queue;
2155
+ private pendingCount;
2156
+ private isPausedFlag;
2157
+ private intervalId?;
2158
+ private intervalCount;
2159
+ private intervalStart;
2160
+ private eventHandlers;
2161
+ private statsData;
2162
+ private totalDuration;
2163
+ private throughputWindow;
2164
+ private readonly throughputWindowSize;
2165
+ private idlePromise?;
2166
+ private emptyPromise?;
2167
+ readonly config: Required<QueueConfig>;
2168
+ /**
2169
+ * Create a new RezoQueue
2170
+ * @param config - Queue configuration options
2171
+ */
2172
+ constructor(config?: QueueConfig);
2173
+ /**
2174
+ * Get current queue state
2175
+ */
2176
+ get state(): QueueState;
2177
+ /**
2178
+ * Get queue statistics
2179
+ */
2180
+ get stats(): QueueStats;
2181
+ /**
2182
+ * Get/set concurrency limit
2183
+ */
2184
+ get concurrency(): number;
2185
+ set concurrency(value: number);
2186
+ /**
2187
+ * Number of pending (running) tasks
2188
+ */
2189
+ get pending(): number;
2190
+ /**
2191
+ * Number of tasks waiting in queue
2192
+ */
2193
+ get size(): number;
2194
+ /**
2195
+ * Check if queue is paused
2196
+ */
2197
+ get isPaused(): boolean;
2198
+ /**
2199
+ * Add a task to the queue
2200
+ * @param fn - Async function to execute
2201
+ * @param options - Task options
2202
+ * @returns Promise resolving to task result
2203
+ */
2204
+ add<R = T>(fn: TaskFunction<R>, options?: TaskOptions): Promise<R>;
2205
+ /**
2206
+ * Add multiple tasks to the queue
2207
+ * @param fns - Array of async functions
2208
+ * @param options - Task options (applied to all)
2209
+ * @returns Promise resolving to array of results
2210
+ */
2211
+ addAll<R = T>(fns: TaskFunction<R>[], options?: TaskOptions): Promise<R[]>;
2212
+ /**
2213
+ * Pause queue processing (running tasks continue)
2214
+ */
2215
+ pause(): void;
2216
+ /**
2217
+ * Resume queue processing
2218
+ */
2219
+ start(): void;
2220
+ /**
2221
+ * Clear all pending tasks from queue
2222
+ */
2223
+ clear(): void;
2224
+ /**
2225
+ * Cancel a specific task by ID
2226
+ * @param id - Task ID to cancel
2227
+ * @returns true if task was found and cancelled
2228
+ */
2229
+ cancel(id: string): boolean;
2230
+ /**
2231
+ * Cancel all tasks matching a predicate
2232
+ * @param predicate - Function to test each task
2233
+ * @returns Number of tasks cancelled
2234
+ */
2235
+ cancelBy(predicate: (task: {
2236
+ id: string;
2237
+ priority: number;
2238
+ }) => boolean): number;
2239
+ /**
2240
+ * Wait for queue to become idle (no running or pending tasks)
2241
+ */
2242
+ onIdle(): Promise<void>;
2243
+ /**
2244
+ * Wait for queue to be empty (no pending tasks, but may have running)
2245
+ */
2246
+ onEmpty(): Promise<void>;
2247
+ /**
2248
+ * Wait for queue size to be less than limit
2249
+ * @param limit - Size threshold
2250
+ */
2251
+ onSizeLessThan(limit: number): Promise<void>;
2252
+ /**
2253
+ * Register an event handler
2254
+ * @param event - Event name
2255
+ * @param handler - Handler function
2256
+ */
2257
+ on<E extends keyof QueueEvents>(event: E, handler: EventHandler<QueueEvents[E]>): void;
2258
+ /**
2259
+ * Remove an event handler
2260
+ * @param event - Event name
2261
+ * @param handler - Handler function to remove
2262
+ */
2263
+ off<E extends keyof QueueEvents>(event: E, handler: EventHandler<QueueEvents[E]>): void;
2264
+ /**
2265
+ * Destroy the queue and cleanup resources
2266
+ */
2267
+ destroy(): void;
2268
+ /**
2269
+ * Insert task into queue maintaining priority order (highest first)
2270
+ */
2271
+ private insertByPriority;
2272
+ /**
2273
+ * Try to run next task if capacity available
2274
+ */
2275
+ private tryRunNext;
2276
+ /**
2277
+ * Execute a task
2278
+ */
2279
+ private runTask;
2280
+ /**
2281
+ * Record task duration for statistics
2282
+ */
2283
+ private recordDuration;
2284
+ /**
2285
+ * Start interval-based rate limiting
2286
+ */
2287
+ private startInterval;
2288
+ /**
2289
+ * Emit an event
2290
+ */
2291
+ protected emit<E extends keyof QueueEvents>(event: E, data: QueueEvents[E]): void;
2292
+ /**
2293
+ * Check if queue became empty
2294
+ */
2295
+ private checkEmpty;
2296
+ /**
2297
+ * Check if queue became idle
2298
+ */
2299
+ private checkIdle;
2300
+ }
1986
2301
  type ProxyProtocol$1 = "http" | "https" | "socks4" | "socks5";
1987
2302
  /**
1988
2303
  * Configuration options for proxy connections
@@ -2104,7 +2419,7 @@ export interface RezoRequestConfig<D = any> {
2104
2419
  /**
2105
2420
  * Queue to use for request execution
2106
2421
  */
2107
- queue?: PQueue | null;
2422
+ queue?: RezoQueue | null;
2108
2423
  /**
2109
2424
  * Controls how the response body is parsed and returned in `response.data`.
2110
2425
  *
@@ -2194,10 +2509,6 @@ export interface RezoRequestConfig<D = any> {
2194
2509
  autoSetOrigin?: boolean;
2195
2510
  treat302As303?: boolean;
2196
2511
  startNewRequest?: boolean;
2197
- /** Whether to use HTTP/2 protocol */
2198
- http2?: boolean;
2199
- /** Whether to use cURL adapter */
2200
- curl?: boolean;
2201
2512
  /**
2202
2513
  * DNS cache configuration for faster repeated requests.
2203
2514
  *
@@ -2301,6 +2612,12 @@ export interface RezoRequestConfig<D = any> {
2301
2612
  withCredentials?: boolean;
2302
2613
  /** Proxy configuration (URL string or detailed options) */
2303
2614
  proxy?: string | ProxyOptions;
2615
+ /**
2616
+ * Whether to use ProxyManager for this request
2617
+ * Set to false to bypass ProxyManager even when one is configured
2618
+ * @default true (uses ProxyManager if configured)
2619
+ */
2620
+ useProxyManager?: boolean;
2304
2621
  /** Whether to enable automatic cookie handling */
2305
2622
  useCookies?: boolean;
2306
2623
  /** Custom cookie jar for managing cookies */
@@ -2322,8 +2639,6 @@ export interface RezoRequestConfig<D = any> {
2322
2639
  transformRequest?: Array<(data: any, headers: RezoHeaders) => any>;
2323
2640
  /** Array of functions to transform response data */
2324
2641
  transformResponse?: Array<(data: any) => any>;
2325
- /** Adapter to use for the request (name or custom function) */
2326
- adapter?: string | ((config: RezoRequestConfig) => Promise<any>);
2327
2642
  /** AbortSignal to cancel the request */
2328
2643
  signal?: AbortSignal;
2329
2644
  /** File path to save the response to (for downloads) */
@@ -2540,6 +2855,7 @@ type BeforeProxyDisableHook$1 = (context: BeforeProxyDisableContext) => boolean
2540
2855
  type AfterProxyDisableHook$1 = (context: AfterProxyDisableContext) => void | Promise<void>;
2541
2856
  type AfterProxyRotateHook$1 = (context: AfterProxyRotateContext) => void | Promise<void>;
2542
2857
  type AfterProxyEnableHook$1 = (context: AfterProxyEnableContext) => void | Promise<void>;
2858
+ type OnNoProxiesAvailableHook$1 = (context: OnNoProxiesAvailableContext) => void | Promise<void>;
2543
2859
  /**
2544
2860
  * Proxy hooks collection for ProxyManager events
2545
2861
  */
@@ -2552,6 +2868,8 @@ export interface ProxyHooks {
2552
2868
  afterProxyDisable: AfterProxyDisableHook$1[];
2553
2869
  afterProxyRotate: AfterProxyRotateHook$1[];
2554
2870
  afterProxyEnable: AfterProxyEnableHook$1[];
2871
+ /** Hook triggered when no proxies are available */
2872
+ onNoProxiesAvailable: OnNoProxiesAvailableHook$1[];
2555
2873
  }
2556
2874
  declare class ProxyManager {
2557
2875
  /** Configuration for the proxy manager */
@@ -2687,8 +3005,40 @@ declare class ProxyManager {
2687
3005
  private runAfterProxyRotateHooks;
2688
3006
  private runAfterProxyDisableHooks;
2689
3007
  private runAfterProxyEnableHooks;
3008
+ /**
3009
+ * Run onNoProxiesAvailable hooks synchronously
3010
+ * Called when no proxies are available and an error is about to be thrown
3011
+ */
3012
+ private runOnNoProxiesAvailableHooksSync;
3013
+ /**
3014
+ * Run onNoProxiesAvailable hooks asynchronously
3015
+ * Called when no proxies are available and an error is about to be thrown
3016
+ */
3017
+ runOnNoProxiesAvailableHooks(context: OnNoProxiesAvailableContext): Promise<void>;
3018
+ /**
3019
+ * Notify that no proxies are available and trigger hooks
3020
+ * This method is called when proxy selection fails due to pool exhaustion
3021
+ *
3022
+ * @param url - The request URL that needed a proxy
3023
+ * @param error - The error that will be thrown
3024
+ * @returns The context object with detailed information about the proxy pool state
3025
+ *
3026
+ * @example
3027
+ * ```typescript
3028
+ * manager.hooks.onNoProxiesAvailable.push((context) => {
3029
+ * console.error(`No proxies available for ${context.url}`);
3030
+ * console.log(`Dead: ${context.disabledReasons.dead}, Limit: ${context.disabledReasons.limitReached}`);
3031
+ * // Trigger external alert or proxy refresh
3032
+ * alertSystem.notify('Proxy pool exhausted', context);
3033
+ * });
3034
+ *
3035
+ * // Called internally or by adapters when no proxies are available
3036
+ * const context = manager.notifyNoProxiesAvailable('https://api.example.com', new Error('No proxies'));
3037
+ * ```
3038
+ */
3039
+ notifyNoProxiesAvailable(url: string, error: Error): OnNoProxiesAvailableContext;
2690
3040
  }
2691
- export type queueOptions = Options$1<PriorityQueue, QueueAddOptions>;
3041
+ export type queueOptions = QueueConfig;
2692
3042
  export interface CacheConfig {
2693
3043
  /** Response cache configuration */
2694
3044
  response?: boolean | ResponseCacheConfig;
@@ -2747,10 +3097,6 @@ export interface RezoDefaultOptions {
2747
3097
  keepAlive?: boolean;
2748
3098
  /** Whether to detect and prevent redirect cycles */
2749
3099
  enableRedirectCycleDetection?: boolean;
2750
- /** Whether to use HTTP/2 protocol */
2751
- http2?: boolean;
2752
- /** Whether to use cURL adapter */
2753
- curl?: boolean;
2754
3100
  /** Whether to send cookies and authorization headers with cross-origin requests */
2755
3101
  withCredentials?: boolean;
2756
3102
  /** Proxy configuration (URL string or detailed options) */
@@ -2789,8 +3135,6 @@ export interface RezoDefaultOptions {
2789
3135
  transformRequest?: RezoHttpRequest["transformRequest"];
2790
3136
  /** Array of functions to transform response data */
2791
3137
  transformResponse?: RezoHttpRequest["transformResponse"];
2792
- /** Adapter to use for the request (name or custom function) */
2793
- adapter?: RezoHttpRequest["adapter"];
2794
3138
  /** Browser simulation configuration for user agent spoofing */
2795
3139
  browser?: RezoHttpRequest["browser"];
2796
3140
  /** Enable debug logging for the request */
@@ -3693,7 +4037,7 @@ export type AdapterFunction<T = any> = (options: RezoRequestConfig, defaultOptio
3693
4037
  * Main Rezo class - Enterprise-grade HTTP client with advanced features
3694
4038
  */
3695
4039
  export declare class Rezo {
3696
- protected queue: PQueue | null;
4040
+ protected queue: RezoQueue | null;
3697
4041
  protected isQueueEnabled: boolean;
3698
4042
  defaults: RezoDefaultOptions;
3699
4043
  hooks: RezoHooks;
@@ -3839,6 +4183,2048 @@ export interface RezoInstance extends Rezo {
3839
4183
  /** Spread array arguments to callback function (Axios compatibility) */
3840
4184
  spread: <T extends unknown[], R>(callback: (...args: T) => R) => (array: T) => R;
3841
4185
  }
4186
+ /**
4187
+ * cURL Options Configuration
4188
+ *
4189
+ * Comprehensive type definitions for 100+ cURL command-line options.
4190
+ * These options are ONLY available when using the cURL adapter via:
4191
+ * `import rezo from 'rezo/adapters/curl'`
4192
+ *
4193
+ * @remarks
4194
+ * - Headers, cookies, and body are handled separately via standard Rezo options
4195
+ * - These options map directly to cURL command-line flags
4196
+ * - All time values are in seconds unless otherwise specified
4197
+ * - Options are applied after internal configuration, allowing safe overrides
4198
+ *
4199
+ * @see https://curl.se/docs/manpage.html for complete cURL documentation
4200
+ * @author Yuniq Solutions Team
4201
+ * @version 2.0.0
4202
+ */
4203
+ /**
4204
+ * IP version preference for cURL connections
4205
+ * @see --ipv4, --ipv6
4206
+ */
4207
+ export type CurlIpVersion = "v4" | "v6" | "any";
4208
+ /**
4209
+ * SSL/TLS version options
4210
+ * @see --sslv2, --sslv3, --tlsv1, --tlsv1.0, --tlsv1.1, --tlsv1.2, --tlsv1.3
4211
+ */
4212
+ export type CurlSslVersion = "default" | "tlsv1" | "tlsv1.0" | "tlsv1.1" | "tlsv1.2" | "tlsv1.3" | "sslv2" | "sslv3";
4213
+ /**
4214
+ * HTTP version options for cURL
4215
+ * @see --http1.0, --http1.1, --http2, --http2-prior-knowledge, --http3, --http3-only
4216
+ */
4217
+ export type CurlHttpVersion = "1.0" | "1.1" | "2" | "2-prior-knowledge" | "3" | "3-only";
4218
+ /**
4219
+ * Authentication methods supported by cURL
4220
+ * @see --basic, --digest, --ntlm, --negotiate, --anyauth
4221
+ */
4222
+ export type CurlAuthMethod = "basic" | "digest" | "ntlm" | "negotiate" | "bearer" | "aws-sigv4" | "anyauth";
4223
+ /**
4224
+ * Certificate type for TLS
4225
+ * @see --cert-type
4226
+ */
4227
+ export type CurlCertType = "PEM" | "DER" | "ENG" | "P12";
4228
+ /**
4229
+ * Key type for TLS
4230
+ * @see --key-type
4231
+ */
4232
+ export type CurlKeyType = "PEM" | "DER" | "ENG";
4233
+ /**
4234
+ * FTP SSL level
4235
+ * @see --ftp-ssl-ccc-mode
4236
+ */
4237
+ export type CurlFtpSslCccMode = "active" | "passive";
4238
+ /**
4239
+ * FTP file method
4240
+ * @see --ftp-method
4241
+ */
4242
+ export type CurlFtpMethod = "multicwd" | "nocwd" | "singlecwd";
4243
+ /**
4244
+ * Kerberos/GSS-API delegation level
4245
+ * @see --delegation
4246
+ */
4247
+ export type CurlDelegation = "none" | "policy" | "always";
4248
+ /**
4249
+ * Retry configuration for cURL requests
4250
+ */
4251
+ export interface CurlRetryOptions {
4252
+ /**
4253
+ * Number of retry attempts
4254
+ * Maps to: --retry <num>
4255
+ * @default 0
4256
+ */
4257
+ attempts?: number;
4258
+ /**
4259
+ * Delay between retries in seconds
4260
+ * Maps to: --retry-delay <seconds>
4261
+ * @default 1
4262
+ */
4263
+ delay?: number;
4264
+ /**
4265
+ * Maximum time in seconds to spend on retries
4266
+ * Maps to: --retry-max-time <seconds>
4267
+ */
4268
+ maxTime?: number;
4269
+ /**
4270
+ * Retry on all errors (not just transient ones)
4271
+ * Maps to: --retry-all-errors
4272
+ * @default false
4273
+ */
4274
+ allErrors?: boolean;
4275
+ /**
4276
+ * Retry on connection refused errors
4277
+ * Maps to: --retry-connrefused
4278
+ * @default false
4279
+ */
4280
+ connRefused?: boolean;
4281
+ }
4282
+ /**
4283
+ * Local port range configuration
4284
+ */
4285
+ export interface CurlLocalPortRange {
4286
+ /**
4287
+ * Starting port number
4288
+ */
4289
+ start: number;
4290
+ /**
4291
+ * Ending port number (optional, uses single port if not specified)
4292
+ */
4293
+ end?: number;
4294
+ }
4295
+ /**
4296
+ * DNS resolve override entry
4297
+ *
4298
+ * @example
4299
+ * // Resolve example.com:443 to specific IP
4300
+ * { host: 'example.com', port: 443, address: '192.168.1.1' }
4301
+ */
4302
+ export interface CurlResolveEntry {
4303
+ /**
4304
+ * Hostname to override
4305
+ */
4306
+ host: string;
4307
+ /**
4308
+ * Port number for the override
4309
+ */
4310
+ port: number;
4311
+ /**
4312
+ * IP address(es) to resolve to (comma-separated for multiple)
4313
+ */
4314
+ address: string;
4315
+ }
4316
+ /**
4317
+ * Connect-to override entry for routing connections
4318
+ *
4319
+ * @example
4320
+ * // Connect requests for example.com:443 to other.com:8443
4321
+ * { host: 'example.com', port: 443, connectHost: 'other.com', connectPort: 8443 }
4322
+ */
4323
+ export interface CurlConnectToEntry {
4324
+ /**
4325
+ * Original hostname in the request
4326
+ */
4327
+ host: string;
4328
+ /**
4329
+ * Original port in the request
4330
+ */
4331
+ port: number;
4332
+ /**
4333
+ * Target hostname to connect to
4334
+ */
4335
+ connectHost: string;
4336
+ /**
4337
+ * Target port to connect to
4338
+ */
4339
+ connectPort: number;
4340
+ }
4341
+ /**
4342
+ * Speed limit configuration for bandwidth throttling
4343
+ */
4344
+ export interface CurlSpeedLimit {
4345
+ /**
4346
+ * Minimum speed in bytes per second
4347
+ * If speed drops below this for speedTime seconds, transfer aborts
4348
+ * Maps to: --speed-limit <speed>
4349
+ */
4350
+ limit: number;
4351
+ /**
4352
+ * Time in seconds the speed must stay below limit to abort
4353
+ * Maps to: --speed-time <seconds>
4354
+ * @default 30
4355
+ */
4356
+ time?: number;
4357
+ }
4358
+ /**
4359
+ * Proxy header configuration
4360
+ * Headers to send only to the proxy (not the final destination)
4361
+ */
4362
+ export type CurlProxyHeaders = Record<string, string>;
4363
+ /**
4364
+ * Proxy TLS/SSL configuration
4365
+ */
4366
+ export interface CurlProxyTlsOptions {
4367
+ /**
4368
+ * TLS version for proxy connection
4369
+ * Maps to: --proxy-tlsv1, --proxy-tlsv1.0, etc.
4370
+ */
4371
+ version?: CurlSslVersion;
4372
+ /**
4373
+ * Path to client certificate for proxy
4374
+ * Maps to: --proxy-cert <cert>
4375
+ */
4376
+ cert?: string;
4377
+ /**
4378
+ * Path to client key for proxy
4379
+ * Maps to: --proxy-key <key>
4380
+ */
4381
+ key?: string;
4382
+ /**
4383
+ * Path to CA certificate for proxy verification
4384
+ * Maps to: --proxy-cacert <file>
4385
+ */
4386
+ cacert?: string;
4387
+ /**
4388
+ * CA path directory for proxy
4389
+ * Maps to: --proxy-capath <dir>
4390
+ */
4391
+ capath?: string;
4392
+ /**
4393
+ * Skip proxy certificate verification
4394
+ * Maps to: --proxy-insecure
4395
+ * @default false
4396
+ */
4397
+ insecure?: boolean;
4398
+ /**
4399
+ * Specify proxy certificate type
4400
+ * Maps to: --proxy-cert-type <type>
4401
+ */
4402
+ certType?: CurlCertType;
4403
+ /**
4404
+ * Specify proxy key type
4405
+ * Maps to: --proxy-key-type <type>
4406
+ */
4407
+ keyType?: CurlKeyType;
4408
+ /**
4409
+ * Specify proxy key password
4410
+ * Maps to: --proxy-pass <phrase>
4411
+ */
4412
+ keyPassword?: string;
4413
+ /**
4414
+ * Ciphers for proxy connection
4415
+ * Maps to: --proxy-ciphers <list>
4416
+ */
4417
+ ciphers?: string;
4418
+ /**
4419
+ * TLS 1.3 ciphers for proxy
4420
+ * Maps to: --proxy-tls13-ciphers <list>
4421
+ */
4422
+ tls13Ciphers?: string;
4423
+ /**
4424
+ * Pinned public key for proxy
4425
+ * Maps to: --proxy-pinnedpubkey <hashes>
4426
+ */
4427
+ pinnedPubKey?: string | string[];
4428
+ /**
4429
+ * CRL file for proxy
4430
+ * Maps to: --proxy-crlfile <file>
4431
+ */
4432
+ crlfile?: string;
4433
+ /**
4434
+ * Check proxy cert status via OCSP
4435
+ * Maps to: --proxy-ssl-allow-beast
4436
+ */
4437
+ allowBeast?: boolean;
4438
+ /**
4439
+ * Auto client cert for proxy
4440
+ * Maps to: --proxy-ssl-auto-client-cert
4441
+ */
4442
+ autoClientCert?: boolean;
4443
+ }
4444
+ /**
4445
+ * HSTS (HTTP Strict Transport Security) configuration
4446
+ */
4447
+ export interface CurlHstsOptions {
4448
+ /**
4449
+ * Path to HSTS cache file
4450
+ * Maps to: --hsts <filename>
4451
+ */
4452
+ file?: string;
4453
+ }
4454
+ /**
4455
+ * DNS configuration options
4456
+ */
4457
+ export interface CurlDnsOptions {
4458
+ /**
4459
+ * DNS servers to use (comma-separated)
4460
+ * Maps to: --dns-servers <addresses>
4461
+ * @example '8.8.8.8,8.8.4.4'
4462
+ */
4463
+ servers?: string;
4464
+ /**
4465
+ * DNS-over-HTTPS URL
4466
+ * Maps to: --doh-url <URL>
4467
+ * @example 'https://dns.google/dns-query'
4468
+ */
4469
+ dohUrl?: string;
4470
+ /**
4471
+ * Force DNS-over-HTTPS insecure mode
4472
+ * Maps to: --doh-insecure
4473
+ * @default false
4474
+ */
4475
+ dohInsecure?: boolean;
4476
+ /**
4477
+ * DNS-over-HTTPS using POST
4478
+ * Maps to: --doh-cert-status
4479
+ */
4480
+ dohCertStatus?: boolean;
4481
+ /**
4482
+ * DNS interface to use
4483
+ * Maps to: --dns-interface <interface>
4484
+ */
4485
+ interface?: string;
4486
+ /**
4487
+ * Local IPv4 address for DNS
4488
+ * Maps to: --dns-ipv4-addr <address>
4489
+ */
4490
+ ipv4Addr?: string;
4491
+ /**
4492
+ * Local IPv6 address for DNS
4493
+ * Maps to: --dns-ipv6-addr <address>
4494
+ */
4495
+ ipv6Addr?: string;
4496
+ }
4497
+ /**
4498
+ * FTP configuration options
4499
+ */
4500
+ export interface CurlFtpOptions {
4501
+ /**
4502
+ * FTP account data
4503
+ * Maps to: --ftp-account <data>
4504
+ */
4505
+ account?: string;
4506
+ /**
4507
+ * FTP alternative user
4508
+ * Maps to: --ftp-alternative-to-user <command>
4509
+ */
4510
+ alternativeToUser?: string;
4511
+ /**
4512
+ * Create missing remote dirs
4513
+ * Maps to: --ftp-create-dirs
4514
+ */
4515
+ createDirs?: boolean;
4516
+ /**
4517
+ * FTP method to use
4518
+ * Maps to: --ftp-method <method>
4519
+ */
4520
+ method?: CurlFtpMethod;
4521
+ /**
4522
+ * FTP passive mode
4523
+ * Maps to: --ftp-pasv
4524
+ */
4525
+ pasv?: boolean;
4526
+ /**
4527
+ * FTP port command
4528
+ * Maps to: --ftp-port <address>
4529
+ */
4530
+ port?: string;
4531
+ /**
4532
+ * Send PRET before PASV
4533
+ * Maps to: --ftp-pret
4534
+ */
4535
+ pret?: boolean;
4536
+ /**
4537
+ * Skip PASV IP address
4538
+ * Maps to: --ftp-skip-pasv-ip
4539
+ */
4540
+ skipPasvIp?: boolean;
4541
+ /**
4542
+ * FTP SSL clear command channel mode
4543
+ * Maps to: --ftp-ssl-ccc-mode <mode>
4544
+ */
4545
+ sslCccMode?: CurlFtpSslCccMode;
4546
+ /**
4547
+ * Require SSL for control connection
4548
+ * Maps to: --ftp-ssl-control
4549
+ */
4550
+ sslControl?: boolean;
4551
+ /**
4552
+ * Enable active mode for FTP
4553
+ * Maps to: --ftp-port -
4554
+ */
4555
+ activeMode?: boolean;
4556
+ /**
4557
+ * Append to remote file
4558
+ * Maps to: --append
4559
+ */
4560
+ append?: boolean;
4561
+ /**
4562
+ * Use ASCII transfer
4563
+ * Maps to: --use-ascii
4564
+ */
4565
+ ascii?: boolean;
4566
+ }
4567
+ /**
4568
+ * SSH configuration options
4569
+ */
4570
+ export interface CurlSshOptions {
4571
+ /**
4572
+ * SSH private key file
4573
+ * Maps to: --key <file>
4574
+ */
4575
+ privateKey?: string;
4576
+ /**
4577
+ * SSH private key password
4578
+ * Maps to: --pass <phrase>
4579
+ */
4580
+ privateKeyPassword?: string;
4581
+ /**
4582
+ * SSH public key file
4583
+ * Maps to: --pubkey <file>
4584
+ */
4585
+ publicKey?: string;
4586
+ /**
4587
+ * SSH host public key SHA256
4588
+ * Maps to: --hostpubsha256 <sha256>
4589
+ */
4590
+ hostPubSha256?: string;
4591
+ /**
4592
+ * SSH host public key MD5
4593
+ * Maps to: --hostpubmd5 <md5>
4594
+ */
4595
+ hostPubMd5?: string;
4596
+ /**
4597
+ * Known hosts file
4598
+ * Maps to: --known-hosts <file>
4599
+ */
4600
+ knownHosts?: string;
4601
+ /**
4602
+ * Enable SSH compression
4603
+ * Maps to: --compressed-ssh
4604
+ */
4605
+ compression?: boolean;
4606
+ }
4607
+ /**
4608
+ * TLS/SSL configuration options
4609
+ */
4610
+ export interface CurlTlsOptions {
4611
+ /**
4612
+ * SSL/TLS version to use
4613
+ * Maps to: --sslv2, --sslv3, --tlsv1, --tlsv1.0, etc.
4614
+ */
4615
+ version?: CurlSslVersion;
4616
+ /**
4617
+ * Minimum TLS version
4618
+ * Maps to: --tls-min <VERSION>
4619
+ */
4620
+ min?: CurlSslVersion;
4621
+ /**
4622
+ * Maximum TLS version
4623
+ * Maps to: --tls-max <VERSION>
4624
+ */
4625
+ max?: CurlSslVersion;
4626
+ /**
4627
+ * TLS 1.3 cipher suites
4628
+ * Maps to: --tls13-ciphers <ciphers>
4629
+ */
4630
+ tls13Ciphers?: string;
4631
+ /**
4632
+ * TLS 1.2 and below cipher suites
4633
+ * Maps to: --ciphers <ciphers>
4634
+ */
4635
+ ciphers?: string;
4636
+ /**
4637
+ * Pinned public key(s)
4638
+ * Maps to: --pinnedpubkey <hashes>
4639
+ */
4640
+ pinnedPubKey?: string | string[];
4641
+ /**
4642
+ * Request OCSP stapling
4643
+ * Maps to: --cert-status
4644
+ */
4645
+ certStatus?: boolean;
4646
+ /**
4647
+ * Certificate Revocation List file
4648
+ * Maps to: --crlfile <file>
4649
+ */
4650
+ crlfile?: string;
4651
+ /**
4652
+ * Client certificate file
4653
+ * Maps to: --cert <certificate[:password]>
4654
+ */
4655
+ cert?: string;
4656
+ /**
4657
+ * Client certificate type
4658
+ * Maps to: --cert-type <type>
4659
+ */
4660
+ certType?: CurlCertType;
4661
+ /**
4662
+ * Client key file
4663
+ * Maps to: --key <key>
4664
+ */
4665
+ key?: string;
4666
+ /**
4667
+ * Client key type
4668
+ * Maps to: --key-type <type>
4669
+ */
4670
+ keyType?: CurlKeyType;
4671
+ /**
4672
+ * Client key password
4673
+ * Maps to: --pass <phrase>
4674
+ */
4675
+ keyPassword?: string;
4676
+ /**
4677
+ * CA certificate bundle file
4678
+ * Maps to: --cacert <file>
4679
+ */
4680
+ cacert?: string;
4681
+ /**
4682
+ * CA certificate directory
4683
+ * Maps to: --capath <dir>
4684
+ */
4685
+ capath?: string;
4686
+ /**
4687
+ * Skip certificate verification
4688
+ * Maps to: --insecure, -k
4689
+ */
4690
+ insecure?: boolean;
4691
+ /**
4692
+ * Use native CA store
4693
+ * Maps to: --ca-native
4694
+ */
4695
+ caNative?: boolean;
4696
+ /**
4697
+ * Disable SSL session ID reuse
4698
+ * Maps to: --no-sessionid
4699
+ */
4700
+ noSessionId?: boolean;
4701
+ /**
4702
+ * SSL engine to use
4703
+ * Maps to: --engine <name>
4704
+ */
4705
+ engine?: string;
4706
+ /**
4707
+ * Random file for SSL
4708
+ * Maps to: --random-file <file>
4709
+ */
4710
+ randomFile?: string;
4711
+ /**
4712
+ * EGD socket path
4713
+ * Maps to: --egd-file <file>
4714
+ */
4715
+ egdFile?: string;
4716
+ /**
4717
+ * SSL allow BEAST attack
4718
+ * Maps to: --ssl-allow-beast
4719
+ */
4720
+ allowBeast?: boolean;
4721
+ /**
4722
+ * SSL no revoke
4723
+ * Maps to: --ssl-no-revoke
4724
+ */
4725
+ noRevoke?: boolean;
4726
+ /**
4727
+ * SSL revoke best effort
4728
+ * Maps to: --ssl-revoke-best-effort
4729
+ */
4730
+ revokeBestEffort?: boolean;
4731
+ /**
4732
+ * Auto client certificate
4733
+ * Maps to: --ssl-auto-client-cert
4734
+ */
4735
+ autoClientCert?: boolean;
4736
+ /**
4737
+ * Force SSL/TLS
4738
+ * Maps to: --ssl
4739
+ */
4740
+ forceSsl?: boolean;
4741
+ /**
4742
+ * Require SSL/TLS
4743
+ * Maps to: --ssl-reqd
4744
+ */
4745
+ sslRequired?: boolean;
4746
+ /**
4747
+ * ALPN protocols to offer
4748
+ * Maps to: --alpn <protocols>
4749
+ */
4750
+ alpn?: string | string[];
4751
+ /**
4752
+ * Disable ALPN
4753
+ * Maps to: --no-alpn
4754
+ */
4755
+ noAlpn?: boolean;
4756
+ /**
4757
+ * NPN protocols to offer
4758
+ * Maps to: --no-npn
4759
+ */
4760
+ noNpn?: boolean;
4761
+ /**
4762
+ * False start for TLS
4763
+ * Maps to: --false-start
4764
+ */
4765
+ falseStart?: boolean;
4766
+ /**
4767
+ * Curves to use for TLS
4768
+ * Maps to: --curves <list>
4769
+ */
4770
+ curves?: string;
4771
+ /**
4772
+ * ECH config
4773
+ * Maps to: --ech <config>
4774
+ */
4775
+ ech?: string;
4776
+ }
4777
+ /**
4778
+ * SMTP/Email configuration options
4779
+ */
4780
+ export interface CurlSmtpOptions {
4781
+ /**
4782
+ * SMTP mail from address
4783
+ * Maps to: --mail-from <address>
4784
+ */
4785
+ mailFrom?: string;
4786
+ /**
4787
+ * SMTP mail recipients
4788
+ * Maps to: --mail-rcpt <address>
4789
+ */
4790
+ mailRcpt?: string | string[];
4791
+ /**
4792
+ * Allow SMTP recipient failures
4793
+ * Maps to: --mail-rcpt-allowfails
4794
+ */
4795
+ mailRcptAllowFails?: boolean;
4796
+ /**
4797
+ * SMTP authentication
4798
+ * Maps to: --mail-auth <address>
4799
+ */
4800
+ mailAuth?: string;
4801
+ }
4802
+ /**
4803
+ * Telnet options
4804
+ */
4805
+ export interface CurlTelnetOptions {
4806
+ /**
4807
+ * Telnet option
4808
+ * Maps to: --telnet-option <opt=val>
4809
+ */
4810
+ options?: Record<string, string>;
4811
+ }
4812
+ /**
4813
+ * Progress/Output configuration
4814
+ */
4815
+ export interface CurlOutputOptions {
4816
+ /**
4817
+ * Show verbose output
4818
+ * Maps to: --verbose, -v
4819
+ */
4820
+ verbose?: boolean;
4821
+ /**
4822
+ * Trace file path
4823
+ * Maps to: --trace <file>
4824
+ */
4825
+ trace?: string;
4826
+ /**
4827
+ * Trace in ASCII format
4828
+ * Maps to: --trace-ascii <file>
4829
+ */
4830
+ traceAscii?: string;
4831
+ /**
4832
+ * Include timestamp in trace
4833
+ * Maps to: --trace-time
4834
+ */
4835
+ traceTime?: boolean;
4836
+ /**
4837
+ * Trace ID strings
4838
+ * Maps to: --trace-ids
4839
+ */
4840
+ traceIds?: boolean;
4841
+ /**
4842
+ * Trace configuration
4843
+ * Maps to: --trace-config <string>
4844
+ */
4845
+ traceConfig?: string;
4846
+ /**
4847
+ * Dump headers to stderr
4848
+ * Maps to: --dump-header <filename>
4849
+ */
4850
+ dumpHeader?: string;
4851
+ /**
4852
+ * Progress meter type
4853
+ * Maps to: --progress-bar (bar), --no-progress-meter (none)
4854
+ */
4855
+ progressMeter?: "bar" | "none" | "default";
4856
+ /**
4857
+ * Styled output
4858
+ * Maps to: --styled-output
4859
+ */
4860
+ styledOutput?: boolean;
4861
+ }
4862
+ /**
4863
+ * Write-out variables for custom output format
4864
+ */
4865
+ export interface CurlWriteOut {
4866
+ /**
4867
+ * Write-out format string
4868
+ * Maps to: --write-out <format>
4869
+ * @example '%{http_code}' or '%{time_total}'
4870
+ */
4871
+ format?: string;
4872
+ /**
4873
+ * Output to file instead of stdout
4874
+ */
4875
+ file?: string;
4876
+ }
4877
+ /**
4878
+ * AWS Signature Version 4 authentication
4879
+ */
4880
+ export interface CurlAwsSigV4 {
4881
+ /**
4882
+ * AWS provider
4883
+ * @example 'aws:amz'
4884
+ */
4885
+ provider: string;
4886
+ /**
4887
+ * AWS region
4888
+ * @example 'us-east-1'
4889
+ */
4890
+ region: string;
4891
+ /**
4892
+ * AWS service
4893
+ * @example 's3'
4894
+ */
4895
+ service: string;
4896
+ }
4897
+ /**
4898
+ * Parallel transfer configuration
4899
+ */
4900
+ export interface CurlParallelOptions {
4901
+ /**
4902
+ * Enable parallel transfers
4903
+ * Maps to: --parallel
4904
+ */
4905
+ enabled: boolean;
4906
+ /**
4907
+ * Maximum concurrent transfers
4908
+ * Maps to: --parallel-max <num>
4909
+ * @default 50
4910
+ */
4911
+ max?: number;
4912
+ /**
4913
+ * Start transfers immediately as added
4914
+ * Maps to: --parallel-immediate
4915
+ */
4916
+ immediate?: boolean;
4917
+ }
4918
+ /**
4919
+ * Comprehensive cURL options configuration (100+ options)
4920
+ *
4921
+ * @remarks
4922
+ * These options provide fine-grained control over cURL behavior.
4923
+ * They are applied after internal options and can override defaults.
4924
+ *
4925
+ * **IMPORTANT**: These options are ONLY available when using the cURL adapter:
4926
+ * ```typescript
4927
+ * import rezo from 'rezo/adapters/curl';
4928
+ * ```
4929
+ *
4930
+ * Options that are handled internally and should NOT be set here:
4931
+ * - Headers (-H) → Use `headers` option
4932
+ * - Cookies (-b, -c) → Use cookie jar or `cookies` option
4933
+ * - Body/Data (-d, --form) → Use `data` or `body` option
4934
+ * - Output files (-o, -O) → Use `saveTo` option
4935
+ * - Include headers (-i) → Always enabled internally
4936
+ * - Write-out format (-w) → Used for stats parsing
4937
+ *
4938
+ * @example
4939
+ * ```typescript
4940
+ * import rezo from 'rezo/adapters/curl';
4941
+ *
4942
+ * // Simple usage
4943
+ * await rezo.get('https://api.example.com/data', {
4944
+ * curl: {
4945
+ * connectTimeout: 10,
4946
+ * maxTime: 300,
4947
+ * limitRate: '500K',
4948
+ * ipVersion: 'v4',
4949
+ * tcpFastOpen: true
4950
+ * }
4951
+ * });
4952
+ *
4953
+ * // Advanced TLS configuration
4954
+ * await rezo.get('https://secure.example.com/api', {
4955
+ * curl: {
4956
+ * tls: {
4957
+ * min: 'tlsv1.2',
4958
+ * tls13Ciphers: 'TLS_AES_256_GCM_SHA384',
4959
+ * certStatus: true,
4960
+ * pinnedPubKey: 'sha256//base64hash='
4961
+ * }
4962
+ * }
4963
+ * });
4964
+ *
4965
+ * // Retry with exponential backoff
4966
+ * await rezo.get('https://unreliable-api.com/data', {
4967
+ * curl: {
4968
+ * retry: {
4969
+ * attempts: 5,
4970
+ * delay: 2,
4971
+ * maxTime: 60,
4972
+ * allErrors: true
4973
+ * }
4974
+ * }
4975
+ * });
4976
+ *
4977
+ * // Custom DNS resolution
4978
+ * await rezo.get('https://api.example.com/data', {
4979
+ * curl: {
4980
+ * resolve: [{ host: 'api.example.com', port: 443, address: '10.0.0.1' }],
4981
+ * dns: {
4982
+ * servers: '8.8.8.8,8.8.4.4',
4983
+ * dohUrl: 'https://dns.google/dns-query'
4984
+ * }
4985
+ * }
4986
+ * });
4987
+ * ```
4988
+ */
4989
+ export interface CurlOptions {
4990
+ /**
4991
+ * Maximum time in seconds for the connection phase
4992
+ * Maps to: --connect-timeout <seconds>
4993
+ *
4994
+ * @remarks
4995
+ * This is the time allowed for establishing the TCP connection.
4996
+ * Does not include DNS lookup or TLS handshake if separate.
4997
+ *
4998
+ * @example
4999
+ * connectTimeout: 10 // 10 seconds max for connection
5000
+ */
5001
+ connectTimeout?: number;
5002
+ /**
5003
+ * Maximum time in seconds for the entire operation
5004
+ * Maps to: --max-time <seconds>
5005
+ *
5006
+ * @remarks
5007
+ * This overrides the standard `timeout` option when using cURL adapter.
5008
+ * Includes all phases: DNS, connect, TLS, transfer.
5009
+ *
5010
+ * @example
5011
+ * maxTime: 300 // 5 minutes max for entire request
5012
+ */
5013
+ maxTime?: number;
5014
+ /**
5015
+ * Time in seconds to wait for 100-continue response
5016
+ * Maps to: --expect100-timeout <seconds>
5017
+ *
5018
+ * @remarks
5019
+ * When sending a request with Expect: 100-continue header,
5020
+ * this is how long to wait for the server's 100 response.
5021
+ *
5022
+ * @default 1
5023
+ */
5024
+ expect100Timeout?: number;
5025
+ /**
5026
+ * Time in seconds to wait before sending keepalive probes
5027
+ * Maps to: --keepalive-time <seconds>
5028
+ *
5029
+ * @remarks
5030
+ * Sets the TCP keepalive idle time. The connection will send
5031
+ * keepalive probes after this many seconds of inactivity.
5032
+ *
5033
+ * @example
5034
+ * keepaliveTime: 60 // Send keepalive after 60 seconds idle
5035
+ */
5036
+ keepaliveTime?: number;
5037
+ /**
5038
+ * Interval between keepalive probes in seconds
5039
+ * Maps to: --keepalive-cnt (via environment)
5040
+ */
5041
+ keepaliveInterval?: number;
5042
+ /**
5043
+ * Number of keepalive probes before giving up
5044
+ * Maps to: configuration
5045
+ */
5046
+ keepaliveCnt?: number;
5047
+ /**
5048
+ * Disable keepalive on the connection
5049
+ * Maps to: --no-keepalive
5050
+ *
5051
+ * @default false
5052
+ */
5053
+ noKeepalive?: boolean;
5054
+ /**
5055
+ * Enable TCP Fast Open
5056
+ * Maps to: --tcp-fastopen
5057
+ *
5058
+ * @remarks
5059
+ * Enables TCP Fast Open (TFO) which can reduce connection latency
5060
+ * by sending data in the SYN packet. Requires OS and server support.
5061
+ *
5062
+ * @default false
5063
+ */
5064
+ tcpFastOpen?: boolean;
5065
+ /**
5066
+ * Disable TCP Nagle algorithm
5067
+ * Maps to: --tcp-nodelay
5068
+ *
5069
+ * @remarks
5070
+ * Disables Nagle's algorithm which can reduce latency for small packets
5071
+ * at the cost of slightly increased network traffic.
5072
+ *
5073
+ * @default false (Nagle enabled)
5074
+ */
5075
+ tcpNodelay?: boolean;
5076
+ /**
5077
+ * Connection idle timeout in seconds
5078
+ * Maps to: --keepalive-time for connection reuse
5079
+ */
5080
+ idleTimeout?: number;
5081
+ /**
5082
+ * Maximum connection time per host
5083
+ * Maps to: --connect-to for routing
5084
+ */
5085
+ maxHostConnections?: number;
5086
+ /**
5087
+ * Maximum total connections
5088
+ * Maps to: environment configuration
5089
+ */
5090
+ maxTotalConnections?: number;
5091
+ /**
5092
+ * Maximum transfer rate (bandwidth limit)
5093
+ * Maps to: --limit-rate <speed>
5094
+ *
5095
+ * @remarks
5096
+ * Limits the transfer speed. Can use suffixes:
5097
+ * - K or k: Kilobytes
5098
+ * - M or m: Megabytes
5099
+ * - G or g: Gigabytes
5100
+ *
5101
+ * @example
5102
+ * limitRate: '100K' // Limit to 100 KB/s
5103
+ * limitRate: '1M' // Limit to 1 MB/s
5104
+ * limitRate: '500' // Limit to 500 bytes/s
5105
+ */
5106
+ limitRate?: string;
5107
+ /**
5108
+ * Speed limit configuration for abort threshold
5109
+ *
5110
+ * @remarks
5111
+ * If transfer speed drops below the limit for the specified time,
5112
+ * the transfer will be aborted. Useful for detecting stalled transfers.
5113
+ *
5114
+ * @example
5115
+ * speedLimit: { limit: 1000, time: 30 } // Abort if <1KB/s for 30 seconds
5116
+ */
5117
+ speedLimit?: CurlSpeedLimit;
5118
+ /**
5119
+ * Maximum number of redirects to follow
5120
+ * Maps to: --max-redirs <num>
5121
+ *
5122
+ * @default 50
5123
+ */
5124
+ maxRedirs?: number;
5125
+ /**
5126
+ * Maximum response size in bytes
5127
+ * Maps to: --max-filesize <bytes>
5128
+ */
5129
+ maxFilesize?: number;
5130
+ /**
5131
+ * Retry configuration for failed requests
5132
+ *
5133
+ * @remarks
5134
+ * By default, cURL only retries on transient errors (timeouts, etc).
5135
+ * Use `allErrors: true` to retry on all errors including HTTP errors.
5136
+ *
5137
+ * @example
5138
+ * retry: { attempts: 3, delay: 2, allErrors: true }
5139
+ */
5140
+ retry?: CurlRetryOptions;
5141
+ /**
5142
+ * Network interface to use for the request
5143
+ * Maps to: --interface <name>
5144
+ *
5145
+ * @remarks
5146
+ * Specifies which network interface to use. Can be interface name,
5147
+ * IP address, or hostname.
5148
+ *
5149
+ * @example
5150
+ * interface: 'eth0'
5151
+ * interface: '192.168.1.100'
5152
+ */
5153
+ interface?: string;
5154
+ /**
5155
+ * Local IP address to use for outgoing connection
5156
+ * Maps to: --local-address <address>
5157
+ *
5158
+ * @remarks
5159
+ * Binds the local end of the connection to this IP address.
5160
+ * Useful on multi-homed systems.
5161
+ *
5162
+ * @example
5163
+ * localAddress: '192.168.1.100'
5164
+ */
5165
+ localAddress?: string;
5166
+ /**
5167
+ * Local port or port range to use
5168
+ * Maps to: --local-port <num>[-num]
5169
+ *
5170
+ * @remarks
5171
+ * Forces cURL to use a specific local port or port range.
5172
+ * Useful for firewall configurations.
5173
+ *
5174
+ * @example
5175
+ * localPort: 45000
5176
+ * localPort: { start: 45000, end: 45100 }
5177
+ */
5178
+ localPort?: number | CurlLocalPortRange;
5179
+ /**
5180
+ * IP version preference
5181
+ * Maps to: --ipv4 (v4), --ipv6 (v6), or default (any)
5182
+ *
5183
+ * @remarks
5184
+ * Forces cURL to resolve names to IPv4 or IPv6 addresses only.
5185
+ *
5186
+ * @example
5187
+ * ipVersion: 'v4' // Force IPv4 only
5188
+ */
5189
+ ipVersion?: CurlIpVersion;
5190
+ /**
5191
+ * DNS resolve overrides
5192
+ * Maps to: --resolve <host:port:address>
5193
+ *
5194
+ * @remarks
5195
+ * Provides custom DNS resolution, bypassing the system resolver.
5196
+ * Useful for testing or accessing services on specific IPs.
5197
+ *
5198
+ * @example
5199
+ * resolve: [{ host: 'example.com', port: 443, address: '192.168.1.1' }]
5200
+ * resolve: ['example.com:443:192.168.1.1']
5201
+ */
5202
+ resolve?: Array<CurlResolveEntry | string>;
5203
+ /**
5204
+ * Connect-to overrides for routing
5205
+ * Maps to: --connect-to <host:port:connect-host:connect-port>
5206
+ *
5207
+ * @remarks
5208
+ * Routes connections to different host:port than specified in URL.
5209
+ * Unlike resolve, this also changes the Host header.
5210
+ *
5211
+ * @example
5212
+ * connectTo: [{ host: 'example.com', port: 443, connectHost: 'backend.local', connectPort: 8443 }]
5213
+ * connectTo: ['example.com:443:backend.local:8443']
5214
+ */
5215
+ connectTo?: Array<CurlConnectToEntry | string>;
5216
+ /**
5217
+ * Hosts to bypass proxy for
5218
+ * Maps to: --noproxy <hosts>
5219
+ *
5220
+ * @remarks
5221
+ * Comma-separated list of hosts that should not go through proxy.
5222
+ * Supports wildcards like *.example.com
5223
+ *
5224
+ * @example
5225
+ * noProxy: 'localhost,127.0.0.1,*.internal.com'
5226
+ * noProxy: ['localhost', '127.0.0.1', '*.internal.com']
5227
+ */
5228
+ noProxy?: string | string[];
5229
+ /**
5230
+ * Unix domain socket to use
5231
+ * Maps to: --unix-socket <path>
5232
+ *
5233
+ * @remarks
5234
+ * Connects via Unix domain socket instead of TCP.
5235
+ * Useful for Docker API, local services, etc.
5236
+ *
5237
+ * @example
5238
+ * unixSocket: '/var/run/docker.sock'
5239
+ */
5240
+ unixSocket?: string;
5241
+ /**
5242
+ * Abstract Unix domain socket (Linux only)
5243
+ * Maps to: --abstract-unix-socket <path>
5244
+ *
5245
+ * @remarks
5246
+ * Like unixSocket but for abstract namespace sockets (prefixed with @)
5247
+ */
5248
+ abstractUnixSocket?: string;
5249
+ /**
5250
+ * Happy Eyeballs timeout in milliseconds
5251
+ * Maps to: --happy-eyeballs-timeout-ms <ms>
5252
+ *
5253
+ * @remarks
5254
+ * Time to wait for IPv6 before falling back to IPv4.
5255
+ * Set to 0 to disable Happy Eyeballs.
5256
+ *
5257
+ * @default 200
5258
+ */
5259
+ happyEyeballsTimeout?: number;
5260
+ /**
5261
+ * Network namespace to use (Linux)
5262
+ * Maps to: --netns <name>
5263
+ */
5264
+ netns?: string;
5265
+ /**
5266
+ * Disable TCP's use of PMTU discovery
5267
+ * Maps to: --disable-epsv
5268
+ */
5269
+ disablePmtu?: boolean;
5270
+ /**
5271
+ * Force using a new connection
5272
+ * Maps to: --no-connection
5273
+ */
5274
+ forceNewConnection?: boolean;
5275
+ /**
5276
+ * SOCKSv5 hostname resolution
5277
+ * Maps to: --socks5-hostname
5278
+ */
5279
+ socks5ResolveLocal?: boolean;
5280
+ /**
5281
+ * Disable session reuse on proxied connections
5282
+ * Maps to: --suppress-connect-headers
5283
+ */
5284
+ suppressConnectHeaders?: boolean;
5285
+ /**
5286
+ * HTTP version to use
5287
+ * Maps to: --http1.0, --http1.1, --http2, --http2-prior-knowledge, --http3, --http3-only
5288
+ *
5289
+ * @remarks
5290
+ * - '1.0': Force HTTP/1.0
5291
+ * - '1.1': Force HTTP/1.1
5292
+ * - '2': Use HTTP/2 if available (with HTTP/1.1 fallback)
5293
+ * - '2-prior-knowledge': HTTP/2 without upgrade (for known HTTP/2 servers)
5294
+ * - '3': Use HTTP/3 if available
5295
+ * - '3-only': Force HTTP/3 only
5296
+ *
5297
+ * @example
5298
+ * httpVersion: '2' // Prefer HTTP/2
5299
+ */
5300
+ httpVersion?: CurlHttpVersion;
5301
+ /**
5302
+ * Use HTTP/0.9 if server sends it
5303
+ * Maps to: --http0.9
5304
+ */
5305
+ http09?: boolean;
5306
+ /**
5307
+ * Path-as-is: don't squash .. and . in URL path
5308
+ * Maps to: --path-as-is
5309
+ *
5310
+ * @remarks
5311
+ * Prevents cURL from normalizing the URL path.
5312
+ * Useful for APIs that require exact paths.
5313
+ *
5314
+ * @default false
5315
+ */
5316
+ pathAsIs?: boolean;
5317
+ /**
5318
+ * Request target to use instead of path from URL
5319
+ * Maps to: --request-target <target>
5320
+ *
5321
+ * @remarks
5322
+ * Overrides the request target (path) in the request line.
5323
+ * Advanced feature for proxy requests.
5324
+ */
5325
+ requestTarget?: string;
5326
+ /**
5327
+ * Disable URL globbing
5328
+ * Maps to: --globoff
5329
+ *
5330
+ * @remarks
5331
+ * Prevents cURL from interpreting {}, [] in URLs as glob patterns.
5332
+ *
5333
+ * @default false
5334
+ */
5335
+ globOff?: boolean;
5336
+ /**
5337
+ * Disable buffering of the output stream
5338
+ * Maps to: --no-buffer
5339
+ */
5340
+ noBuffer?: boolean;
5341
+ /**
5342
+ * Do not use a username in the URL
5343
+ * Maps to: --disallow-username-in-url
5344
+ */
5345
+ disallowUsernameInUrl?: boolean;
5346
+ /**
5347
+ * Strip credentials from referrer URL
5348
+ * Maps to: --strip-credentials
5349
+ */
5350
+ stripCredentials?: boolean;
5351
+ /**
5352
+ * Use GET request after redirect (legacy)
5353
+ * Maps to: --post301, --post302, --post303
5354
+ */
5355
+ postRedirect?: 301 | 302 | 303 | boolean;
5356
+ /**
5357
+ * Referer URL to use
5358
+ * Maps to: --referer <URL>
5359
+ */
5360
+ referer?: string;
5361
+ /**
5362
+ * Automatic referer on redirect
5363
+ * Maps to: --referer ";auto"
5364
+ */
5365
+ autoReferer?: boolean;
5366
+ /**
5367
+ * SSL/TLS version to use
5368
+ * Maps to: --sslv2, --sslv3, --tlsv1, --tlsv1.0, --tlsv1.1, --tlsv1.2, --tlsv1.3
5369
+ *
5370
+ * @deprecated Use `tls.version` instead
5371
+ * @remarks
5372
+ * Forces a specific TLS version. Use with caution as older
5373
+ * versions have security vulnerabilities.
5374
+ *
5375
+ * @example
5376
+ * sslVersion: 'tlsv1.2' // Force TLS 1.2
5377
+ */
5378
+ sslVersion?: CurlSslVersion;
5379
+ /**
5380
+ * Minimum TLS version
5381
+ * Maps to: --tls-min <VERSION>
5382
+ *
5383
+ * @deprecated Use `tls.min` instead
5384
+ * @remarks
5385
+ * Sets the minimum acceptable TLS version for the connection.
5386
+ * Recommended: 'tlsv1.2' or higher.
5387
+ *
5388
+ * @example
5389
+ * tlsMin: 'tlsv1.2' // Require at least TLS 1.2
5390
+ */
5391
+ tlsMin?: CurlSslVersion;
5392
+ /**
5393
+ * Maximum TLS version
5394
+ * Maps to: --tls-max <VERSION>
5395
+ *
5396
+ * @deprecated Use `tls.max` instead
5397
+ * @remarks
5398
+ * Sets the maximum TLS version. Rarely needed, mainly for testing.
5399
+ */
5400
+ tlsMax?: CurlSslVersion;
5401
+ /**
5402
+ * TLS 1.3 cipher suites
5403
+ * Maps to: --tls13-ciphers <ciphers>
5404
+ *
5405
+ * @deprecated Use `tls.tls13Ciphers` instead
5406
+ * @remarks
5407
+ * Colon-separated list of TLS 1.3 cipher suites.
5408
+ *
5409
+ * @example
5410
+ * tls13Ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256'
5411
+ */
5412
+ tls13Ciphers?: string;
5413
+ /**
5414
+ * TLS 1.2 and below cipher suites
5415
+ * Maps to: --ciphers <ciphers>
5416
+ *
5417
+ * @deprecated Use `tls.ciphers` instead
5418
+ * @remarks
5419
+ * OpenSSL cipher list for TLS 1.2 and earlier.
5420
+ *
5421
+ * @example
5422
+ * ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256'
5423
+ */
5424
+ ciphers?: string;
5425
+ /**
5426
+ * Pinned public key(s) for certificate validation
5427
+ * Maps to: --pinnedpubkey <hashes>
5428
+ *
5429
+ * @deprecated Use `tls.pinnedPubKey` instead
5430
+ * @remarks
5431
+ * SHA256 hash(es) of the public key to pin against.
5432
+ * Provides additional security against certificate substitution.
5433
+ *
5434
+ * @example
5435
+ * pinnedPubKey: 'sha256//base64hash='
5436
+ * pinnedPubKey: ['sha256//hash1=', 'sha256//hash2=']
5437
+ */
5438
+ pinnedPubKey?: string | string[];
5439
+ /**
5440
+ * Request OCSP stapling for certificate status
5441
+ * Maps to: --cert-status
5442
+ *
5443
+ * @deprecated Use `tls.certStatus` instead
5444
+ * @remarks
5445
+ * Asks the server to provide OCSP stapling for certificate revocation check.
5446
+ *
5447
+ * @default false
5448
+ */
5449
+ certStatus?: boolean;
5450
+ /**
5451
+ * Path to Certificate Revocation List file
5452
+ * Maps to: --crlfile <file>
5453
+ *
5454
+ * @deprecated Use `tls.crlfile` instead
5455
+ * @remarks
5456
+ * PEM file containing Certificate Revocation Lists for validation.
5457
+ */
5458
+ crlfile?: string;
5459
+ /**
5460
+ * ALPN protocols to offer
5461
+ * Maps to: --alpn <protocols>
5462
+ *
5463
+ * @deprecated Use `tls.alpn` instead
5464
+ * @remarks
5465
+ * Application-Layer Protocol Negotiation protocols to offer.
5466
+ * Comma-separated or array of protocol names.
5467
+ *
5468
+ * @example
5469
+ * alpn: ['h2', 'http/1.1']
5470
+ * alpn: 'h2,http/1.1'
5471
+ */
5472
+ alpn?: string | string[];
5473
+ /**
5474
+ * Disable ALPN negotiation
5475
+ * Maps to: --no-alpn
5476
+ *
5477
+ * @deprecated Use `tls.noAlpn` instead
5478
+ * @default false
5479
+ */
5480
+ noAlpn?: boolean;
5481
+ /**
5482
+ * SSL session ID reuse control
5483
+ * Maps to: --no-sessionid (when false)
5484
+ *
5485
+ * @deprecated Use `tls.noSessionId` instead
5486
+ * @remarks
5487
+ * Disable SSL session ID caching. Normally sessions are reused
5488
+ * for performance.
5489
+ *
5490
+ * @default true
5491
+ */
5492
+ sessionId?: boolean;
5493
+ /**
5494
+ * SSL Engine to use
5495
+ * Maps to: --engine <name>
5496
+ *
5497
+ * @deprecated Use `tls.engine` instead
5498
+ * @remarks
5499
+ * Crypto engine to use for SSL operations.
5500
+ */
5501
+ engine?: string;
5502
+ /**
5503
+ * Custom CA path (directory of certificates)
5504
+ * Maps to: --capath <dir>
5505
+ *
5506
+ * @deprecated Use `tls.capath` instead
5507
+ * @remarks
5508
+ * Directory containing CA certificates in PEM format.
5509
+ * Certificates must be named by their hash values.
5510
+ */
5511
+ capath?: string;
5512
+ /**
5513
+ * Enable certificate type specification
5514
+ * Maps to: --cert-type <type>
5515
+ *
5516
+ * @deprecated Use `tls.certType` instead
5517
+ * @remarks
5518
+ * Specify certificate type: PEM, DER, ENG, P12.
5519
+ *
5520
+ * @default 'PEM'
5521
+ */
5522
+ certType?: CurlCertType;
5523
+ /**
5524
+ * Key type specification
5525
+ * Maps to: --key-type <type>
5526
+ *
5527
+ * @deprecated Use `tls.keyType` instead
5528
+ * @remarks
5529
+ * Specify key type: PEM, DER, ENG.
5530
+ *
5531
+ * @default 'PEM'
5532
+ */
5533
+ keyType?: CurlKeyType;
5534
+ /**
5535
+ * Skip TLS certificate verification (insecure)
5536
+ * Maps to: --insecure, -k
5537
+ *
5538
+ * @remarks
5539
+ * Allows connections to TLS sites without valid certificates.
5540
+ * WARNING: Only use for development/testing. Never in production!
5541
+ *
5542
+ * @default false
5543
+ */
5544
+ insecure?: boolean;
5545
+ /**
5546
+ * Comprehensive TLS/SSL configuration object
5547
+ *
5548
+ * @remarks
5549
+ * Preferred way to configure TLS settings. Individual TLS properties
5550
+ * on CurlOptions are deprecated in favor of this object.
5551
+ *
5552
+ * @example
5553
+ * tls: {
5554
+ * min: 'tlsv1.2',
5555
+ * tls13Ciphers: 'TLS_AES_256_GCM_SHA384',
5556
+ * certStatus: true,
5557
+ * cert: '/path/to/client.crt',
5558
+ * key: '/path/to/client.key',
5559
+ * cacert: '/path/to/ca-bundle.crt'
5560
+ * }
5561
+ */
5562
+ tls?: CurlTlsOptions;
5563
+ /**
5564
+ * Headers to send to the proxy only
5565
+ * Maps to: --proxy-header <header>
5566
+ *
5567
+ * @remarks
5568
+ * These headers are sent only to the proxy, not to the final destination.
5569
+ * Useful for proxy authentication or identification.
5570
+ *
5571
+ * @example
5572
+ * proxyHeaders: { 'X-Proxy-Auth': 'token123' }
5573
+ */
5574
+ proxyHeaders?: CurlProxyHeaders;
5575
+ /**
5576
+ * Proxy TLS/SSL configuration
5577
+ *
5578
+ * @remarks
5579
+ * Separate TLS settings for the connection to the proxy itself.
5580
+ * Useful when proxy requires client certificates or specific TLS version.
5581
+ *
5582
+ * @example
5583
+ * proxyTls: { version: 'tlsv1.2', insecure: false }
5584
+ */
5585
+ proxyTls?: CurlProxyTlsOptions;
5586
+ /**
5587
+ * Pre-proxy to use
5588
+ * Maps to: --preproxy <[protocol://]host[:port]>
5589
+ *
5590
+ * @remarks
5591
+ * Proxy to use before connecting to the main proxy.
5592
+ * Useful for proxy chains.
5593
+ */
5594
+ preProxy?: string;
5595
+ /**
5596
+ * SOCKS5 with GSSAPI
5597
+ * Maps to: --socks5-gssapi
5598
+ */
5599
+ socks5Gssapi?: boolean;
5600
+ /**
5601
+ * SOCKS5 GSSAPI service name
5602
+ * Maps to: --socks5-gssapi-service <name>
5603
+ */
5604
+ socks5GssapiService?: string;
5605
+ /**
5606
+ * SOCKS5 GSSAPI NEC mode
5607
+ * Maps to: --socks5-gssapi-nec
5608
+ */
5609
+ socks5GssapiNec?: boolean;
5610
+ /**
5611
+ * Use HTTP/1.0 for CONNECT tunneling
5612
+ * Maps to: --proxy1.0
5613
+ */
5614
+ proxyHttp10?: boolean;
5615
+ /**
5616
+ * Use HTTP digest auth with proxy
5617
+ * Maps to: --proxy-digest
5618
+ */
5619
+ proxyDigest?: boolean;
5620
+ /**
5621
+ * Use HTTP basic auth with proxy
5622
+ * Maps to: --proxy-basic
5623
+ */
5624
+ proxyBasic?: boolean;
5625
+ /**
5626
+ * Use NTLM auth with proxy
5627
+ * Maps to: --proxy-ntlm
5628
+ */
5629
+ proxyNtlm?: boolean;
5630
+ /**
5631
+ * Use Negotiate auth with proxy
5632
+ * Maps to: --proxy-negotiate
5633
+ */
5634
+ proxyNegotiate?: boolean;
5635
+ /**
5636
+ * Use any auth with proxy
5637
+ * Maps to: --proxy-anyauth
5638
+ */
5639
+ proxyAnyAuth?: boolean;
5640
+ /**
5641
+ * Proxy service name
5642
+ * Maps to: --proxy-service-name <name>
5643
+ */
5644
+ proxyServiceName?: string;
5645
+ /**
5646
+ * Tunnel through HTTP proxy
5647
+ * Maps to: --proxytunnel
5648
+ */
5649
+ proxyTunnel?: boolean;
5650
+ /**
5651
+ * Haproxy client IP
5652
+ * Maps to: --haproxy-clientip <ip>
5653
+ */
5654
+ haproxyClientIp?: string;
5655
+ /**
5656
+ * Haproxy protocol
5657
+ * Maps to: --haproxy-protocol
5658
+ */
5659
+ haproxyProtocol?: boolean;
5660
+ /**
5661
+ * DNS configuration
5662
+ *
5663
+ * @remarks
5664
+ * Advanced DNS settings including custom servers, DNS-over-HTTPS,
5665
+ * and interface bindings.
5666
+ *
5667
+ * @example
5668
+ * dns: {
5669
+ * servers: '8.8.8.8,8.8.4.4',
5670
+ * dohUrl: 'https://dns.google/dns-query'
5671
+ * }
5672
+ */
5673
+ dns?: CurlDnsOptions;
5674
+ /**
5675
+ * HSTS configuration
5676
+ * Maps to: --hsts <filename>
5677
+ */
5678
+ hsts?: CurlHstsOptions;
5679
+ /**
5680
+ * Alt-Svc cache file
5681
+ * Maps to: --alt-svc <filename>
5682
+ *
5683
+ * @remarks
5684
+ * File to read/write Alt-Svc cache for HTTP/3 upgrades.
5685
+ */
5686
+ altSvc?: string;
5687
+ /**
5688
+ * Disable Alt-Svc
5689
+ * Maps to: --no-alt-svc
5690
+ *
5691
+ * @default false
5692
+ */
5693
+ noAltSvc?: boolean;
5694
+ /**
5695
+ * Trust credentials on redirect
5696
+ * Maps to: --location-trusted
5697
+ *
5698
+ * @remarks
5699
+ * Send authentication credentials to hosts after redirect.
5700
+ * Use with caution for security reasons.
5701
+ *
5702
+ * @default false
5703
+ */
5704
+ locationTrusted?: boolean;
5705
+ /**
5706
+ * Discard session cookies on redirect
5707
+ * Maps to: --junk-session-cookies
5708
+ *
5709
+ * @default false
5710
+ */
5711
+ junkSessionCookies?: boolean;
5712
+ /**
5713
+ * Fail silently on HTTP errors
5714
+ * Maps to: --fail
5715
+ *
5716
+ * @remarks
5717
+ * Exit with error code 22 if server returns error (4xx, 5xx).
5718
+ * Suppresses error page output.
5719
+ *
5720
+ * @default false
5721
+ */
5722
+ fail?: boolean;
5723
+ /**
5724
+ * Fail early on first error
5725
+ * Maps to: --fail-early
5726
+ */
5727
+ failEarly?: boolean;
5728
+ /**
5729
+ * Fail with body on HTTP errors
5730
+ * Maps to: --fail-with-body
5731
+ */
5732
+ failWithBody?: boolean;
5733
+ /**
5734
+ * Enable verbose output
5735
+ * Maps to: --verbose, -v
5736
+ *
5737
+ * @remarks
5738
+ * Shows detailed request/response information including headers
5739
+ * and connection details. Useful for debugging.
5740
+ *
5741
+ * @default false
5742
+ */
5743
+ verbose?: boolean;
5744
+ /**
5745
+ * Trace file path
5746
+ * Maps to: --trace <file>
5747
+ *
5748
+ * @remarks
5749
+ * Write full trace including binary data to file.
5750
+ * More detailed than verbose.
5751
+ */
5752
+ trace?: string;
5753
+ /**
5754
+ * Trace ASCII file
5755
+ * Maps to: --trace-ascii <file>
5756
+ *
5757
+ * @remarks
5758
+ * Like trace but without hex dump of binary data.
5759
+ */
5760
+ traceAscii?: string;
5761
+ /**
5762
+ * Include timestamp in trace output
5763
+ * Maps to: --trace-time
5764
+ *
5765
+ * @default false
5766
+ */
5767
+ traceTime?: boolean;
5768
+ /**
5769
+ * Include transfer IDs in trace
5770
+ * Maps to: --trace-ids
5771
+ */
5772
+ traceIds?: boolean;
5773
+ /**
5774
+ * Trace configuration
5775
+ * Maps to: --trace-config <string>
5776
+ */
5777
+ traceConfig?: string;
5778
+ /**
5779
+ * Raw output (disable content decoding)
5780
+ * Maps to: --raw
5781
+ *
5782
+ * @default false
5783
+ */
5784
+ raw?: boolean;
5785
+ /**
5786
+ * Disable compression for response
5787
+ * Maps to: (internal - removes --compressed)
5788
+ *
5789
+ * @default false
5790
+ */
5791
+ noCompressed?: boolean;
5792
+ /**
5793
+ * Buffer size for receive
5794
+ * Maps to: --buffer-size <size>
5795
+ *
5796
+ * @remarks
5797
+ * Maximum receive buffer size with suffix (K, M).
5798
+ *
5799
+ * @example
5800
+ * bufferSize: '1M'
5801
+ */
5802
+ bufferSize?: string;
5803
+ /**
5804
+ * Styled output
5805
+ * Maps to: --styled-output
5806
+ */
5807
+ styledOutput?: boolean;
5808
+ /**
5809
+ * Dump header to file
5810
+ * Maps to: --dump-header <filename>
5811
+ */
5812
+ dumpHeader?: string;
5813
+ /**
5814
+ * Progress meter type
5815
+ * Maps to: --progress-bar, --no-progress-meter
5816
+ */
5817
+ progressMeter?: "bar" | "none" | "default";
5818
+ /**
5819
+ * Write-out format
5820
+ * Maps to: --write-out <format>
5821
+ */
5822
+ writeOut?: string | CurlWriteOut;
5823
+ /**
5824
+ * Output configuration
5825
+ * Comprehensive output/debugging settings
5826
+ */
5827
+ output?: CurlOutputOptions;
5828
+ /**
5829
+ * Use netrc file for credentials
5830
+ * Maps to: --netrc, --netrc-optional, --netrc-file <filename>
5831
+ *
5832
+ * @remarks
5833
+ * - true: Use ~/.netrc (fail if not found)
5834
+ * - 'optional': Use ~/.netrc (don't fail if not found)
5835
+ * - string: Path to custom netrc file
5836
+ */
5837
+ netrc?: boolean | "optional" | string;
5838
+ /**
5839
+ * Delegation level for GSS-API/Kerberos
5840
+ * Maps to: --delegation <level>
5841
+ *
5842
+ * @remarks
5843
+ * Controls credential delegation in GSS-API.
5844
+ * - 'none': No delegation
5845
+ * - 'policy': Delegate if OK according to policy
5846
+ * - 'always': Always delegate
5847
+ */
5848
+ delegation?: CurlDelegation;
5849
+ /**
5850
+ * Service name for SPNEGO
5851
+ * Maps to: --service-name <name>
5852
+ *
5853
+ * @remarks
5854
+ * Override the default service name for SPNEGO authentication.
5855
+ */
5856
+ serviceName?: string;
5857
+ /**
5858
+ * Negotiate authentication
5859
+ * Maps to: --negotiate
5860
+ *
5861
+ * @remarks
5862
+ * Enable SPNEGO/Negotiate authentication (Kerberos, NTLM).
5863
+ *
5864
+ * @default false
5865
+ */
5866
+ negotiate?: boolean;
5867
+ /**
5868
+ * NTLM authentication with winbind
5869
+ * Maps to: --ntlm-wb
5870
+ */
5871
+ ntlmWb?: boolean;
5872
+ /**
5873
+ * SASL IR (Initial Response)
5874
+ * Maps to: --sasl-ir
5875
+ *
5876
+ * @remarks
5877
+ * Enable SASL initial response for protocols that support it.
5878
+ *
5879
+ * @default false
5880
+ */
5881
+ saslIr?: boolean;
5882
+ /**
5883
+ * SASL authentication mechanism
5884
+ * Maps to: --sasl-authzid <identity>
5885
+ */
5886
+ saslAuthzid?: string;
5887
+ /**
5888
+ * AWS Signature Version 4 authentication
5889
+ * Maps to: --aws-sigv4 <provider1[:provider2[:region[:service]]]>
5890
+ *
5891
+ * @example
5892
+ * awsSigv4: { provider: 'aws:amz', region: 'us-east-1', service: 's3' }
5893
+ * awsSigv4: 'aws:amz:us-east-1:s3'
5894
+ */
5895
+ awsSigv4?: string | CurlAwsSigV4;
5896
+ /**
5897
+ * OAuth 2.0 bearer token
5898
+ * Maps to: --oauth2-bearer <token>
5899
+ */
5900
+ oauth2Bearer?: string;
5901
+ /**
5902
+ * Login options
5903
+ * Maps to: --login-options <options>
5904
+ */
5905
+ loginOptions?: string;
5906
+ /**
5907
+ * Kerberos authentication level
5908
+ * Maps to: --krb <level>
5909
+ */
5910
+ kerberos?: "clear" | "safe" | "confidential" | "private";
5911
+ /**
5912
+ * XOAUTH2 bearer token
5913
+ * Maps to: --xoauth2-bearer <token>
5914
+ */
5915
+ xoauth2Bearer?: string;
5916
+ /**
5917
+ * Digest authentication
5918
+ * Maps to: --digest
5919
+ */
5920
+ digest?: boolean;
5921
+ /**
5922
+ * Basic authentication
5923
+ * Maps to: --basic
5924
+ */
5925
+ basic?: boolean;
5926
+ /**
5927
+ * Any authentication method
5928
+ * Maps to: --anyauth
5929
+ */
5930
+ anyAuth?: boolean;
5931
+ /**
5932
+ * FTP configuration
5933
+ *
5934
+ * @example
5935
+ * ftp: {
5936
+ * createDirs: true,
5937
+ * pasv: true,
5938
+ * method: 'singlecwd'
5939
+ * }
5940
+ */
5941
+ ftp?: CurlFtpOptions;
5942
+ /**
5943
+ * Use EPRT command for active mode
5944
+ * Maps to: --disable-eprt
5945
+ */
5946
+ disableEprt?: boolean;
5947
+ /**
5948
+ * Use EPSV command for passive mode
5949
+ * Maps to: --disable-epsv
5950
+ */
5951
+ disableEpsv?: boolean;
5952
+ /**
5953
+ * Quote commands
5954
+ * Maps to: --quote <command>
5955
+ */
5956
+ quote?: string | string[];
5957
+ /**
5958
+ * Pre-transfer quote commands
5959
+ * Maps to: --prequote <command>
5960
+ */
5961
+ prequote?: string | string[];
5962
+ /**
5963
+ * Post-transfer quote commands
5964
+ * Maps to: --postquote <command>
5965
+ */
5966
+ postquote?: string | string[];
5967
+ /**
5968
+ * Continue at offset
5969
+ * Maps to: --continue-at <offset>
5970
+ */
5971
+ continueAt?: number | "-";
5972
+ /**
5973
+ * CRLF conversion
5974
+ * Maps to: --crlf
5975
+ */
5976
+ crlf?: boolean;
5977
+ /**
5978
+ * Range request
5979
+ * Maps to: --range <range>
5980
+ */
5981
+ range?: string;
5982
+ /**
5983
+ * Remove file after download
5984
+ * Maps to: --remote-header-name
5985
+ */
5986
+ remoteHeaderName?: boolean;
5987
+ /**
5988
+ * Request compression
5989
+ * Maps to: --tr-encoding
5990
+ */
5991
+ trEncoding?: boolean;
5992
+ /**
5993
+ * Ignore content length
5994
+ * Maps to: --ignore-content-length
5995
+ */
5996
+ ignoreContentLength?: boolean;
5997
+ /**
5998
+ * SSH configuration
5999
+ *
6000
+ * @example
6001
+ * ssh: {
6002
+ * privateKey: '/path/to/key',
6003
+ * knownHosts: '/path/to/known_hosts',
6004
+ * compression: true
6005
+ * }
6006
+ */
6007
+ ssh?: CurlSshOptions;
6008
+ /**
6009
+ * Enable compressed SSH protocols
6010
+ * Maps to: --compressed-ssh
6011
+ *
6012
+ * @deprecated Use `ssh.compression` instead
6013
+ * @remarks
6014
+ * Enable compression for SSH connections (SCP, SFTP).
6015
+ *
6016
+ * @default false
6017
+ */
6018
+ compressedSsh?: boolean;
6019
+ /**
6020
+ * SMTP configuration
6021
+ *
6022
+ * @example
6023
+ * smtp: {
6024
+ * mailFrom: 'sender@example.com',
6025
+ * mailRcpt: ['recipient@example.com']
6026
+ * }
6027
+ */
6028
+ smtp?: CurlSmtpOptions;
6029
+ /**
6030
+ * Telnet configuration
6031
+ */
6032
+ telnet?: CurlTelnetOptions;
6033
+ /**
6034
+ * TFTP block size
6035
+ * Maps to: --tftp-blksize <value>
6036
+ */
6037
+ tftpBlksize?: number;
6038
+ /**
6039
+ * TFTP no options
6040
+ * Maps to: --tftp-no-options
6041
+ */
6042
+ tftpNoOptions?: boolean;
6043
+ /**
6044
+ * Parallel transfer configuration (for multiple URLs)
6045
+ * Maps to: --parallel, --parallel-max, --parallel-immediate
6046
+ *
6047
+ * @remarks
6048
+ * Only applicable when making multiple requests.
6049
+ */
6050
+ parallel?: CurlParallelOptions;
6051
+ /**
6052
+ * Time condition for request
6053
+ * Maps to: --time-cond <time>
6054
+ */
6055
+ timeCond?: string | Date;
6056
+ /**
6057
+ * Create required local dirs
6058
+ * Maps to: --create-dirs
6059
+ */
6060
+ createDirs?: boolean;
6061
+ /**
6062
+ * Create required remote dirs
6063
+ * Maps to: --ftp-create-dirs
6064
+ */
6065
+ createRemoteDirs?: boolean;
6066
+ /**
6067
+ * Request compressed transfer encoding
6068
+ * Maps to: --compressed
6069
+ */
6070
+ compressed?: boolean;
6071
+ /**
6072
+ * Use file for config
6073
+ * Maps to: --config <file>
6074
+ */
6075
+ configFile?: string;
6076
+ /**
6077
+ * Disable config file
6078
+ * Maps to: --disable
6079
+ */
6080
+ disableConfig?: boolean;
6081
+ /**
6082
+ * Disable environment variable use
6083
+ * Maps to: --disable-env
6084
+ */
6085
+ disableEnv?: boolean;
6086
+ /**
6087
+ * Engine list
6088
+ * Maps to: --engine list
6089
+ */
6090
+ engineList?: boolean;
6091
+ /**
6092
+ * Form escape
6093
+ * Maps to: --form-escape
6094
+ */
6095
+ formEscape?: boolean;
6096
+ /**
6097
+ * Form string
6098
+ * Maps to: --form-string <name=string>
6099
+ */
6100
+ formString?: Record<string, string>;
6101
+ /**
6102
+ * Globoff for URLs
6103
+ * Maps to: --globoff
6104
+ */
6105
+ globoff?: boolean;
6106
+ /**
6107
+ * Data binary
6108
+ * Maps to: --data-binary <data>
6109
+ */
6110
+ dataBinary?: string | Buffer;
6111
+ /**
6112
+ * Data raw
6113
+ * Maps to: --data-raw <data>
6114
+ */
6115
+ dataRaw?: string;
6116
+ /**
6117
+ * Data URL encode
6118
+ * Maps to: --data-urlencode <data>
6119
+ */
6120
+ dataUrlencode?: string | Record<string, string>;
6121
+ /**
6122
+ * JSON data
6123
+ * Maps to: --json <data>
6124
+ */
6125
+ json?: string | Record<string, unknown>;
6126
+ /**
6127
+ * URL encode
6128
+ * Maps to: --url-query <data>
6129
+ */
6130
+ urlQuery?: string | Record<string, string>;
6131
+ /**
6132
+ * Variable
6133
+ * Maps to: --variable <name=value>
6134
+ */
6135
+ variable?: Record<string, string>;
6136
+ /**
6137
+ * Expand variables in URL
6138
+ * Maps to: --expand-url
6139
+ */
6140
+ expandUrl?: boolean;
6141
+ /**
6142
+ * MIME type for content
6143
+ * Maps to: used with multipart
6144
+ */
6145
+ mimeType?: string;
6146
+ /**
6147
+ * Remote time
6148
+ * Maps to: --remote-time
6149
+ */
6150
+ remoteTime?: boolean;
6151
+ /**
6152
+ * Output directory
6153
+ * Maps to: --output-dir <dir>
6154
+ */
6155
+ outputDir?: string;
6156
+ /**
6157
+ * Xattr
6158
+ * Maps to: --xattr
6159
+ */
6160
+ xattr?: boolean;
6161
+ /**
6162
+ * ECH config list
6163
+ * Maps to: --ech <config>
6164
+ */
6165
+ ech?: string;
6166
+ }
6167
+ /**
6168
+ * Extended request configuration for cURL adapter
6169
+ *
6170
+ * @remarks
6171
+ * This type extends the base RezoRequestConfig with cURL-specific options.
6172
+ * It is ONLY available when importing from `rezo/adapters/curl`.
6173
+ *
6174
+ * @example
6175
+ * ```typescript
6176
+ * import rezo, { CurlRequestConfig } from 'rezo/adapters/curl';
6177
+ *
6178
+ * const config: CurlRequestConfig = {
6179
+ * url: 'https://api.example.com/data',
6180
+ * method: 'GET',
6181
+ * curl: {
6182
+ * connectTimeout: 10,
6183
+ * limitRate: '500K',
6184
+ * retry: { attempts: 3, allErrors: true }
6185
+ * }
6186
+ * };
6187
+ *
6188
+ * const response = await rezo.request(config);
6189
+ * ```
6190
+ */
6191
+ export interface CurlRequestConfig extends RezoRequestConfig {
6192
+ /**
6193
+ * cURL-specific options
6194
+ *
6195
+ * @remarks
6196
+ * These options are only available when using the cURL adapter.
6197
+ * They provide fine-grained control over cURL command-line behavior
6198
+ * and will override internal defaults when set.
6199
+ *
6200
+ * Options that are handled internally and should NOT be set here:
6201
+ * - Headers → Use `headers` option
6202
+ * - Cookies → Use cookie jar or `cookies` option
6203
+ * - Body/Data → Use `data` or `body` option
6204
+ * - Output files → Use `saveTo` option
6205
+ *
6206
+ * @example
6207
+ * ```typescript
6208
+ * import rezo from 'rezo/adapters/curl';
6209
+ *
6210
+ * await rezo.get('https://api.example.com/data', {
6211
+ * curl: {
6212
+ * connectTimeout: 10,
6213
+ * limitRate: '500K',
6214
+ * retry: { attempts: 3, allErrors: true },
6215
+ * ipVersion: 'v4',
6216
+ * tcpFastOpen: true,
6217
+ * tls: {
6218
+ * min: 'tlsv1.2',
6219
+ * certStatus: true
6220
+ * },
6221
+ * resolve: [{ host: 'example.com', port: 443, address: '192.168.1.1' }]
6222
+ * }
6223
+ * });
6224
+ * ```
6225
+ */
6226
+ curl?: CurlOptions;
6227
+ }
3842
6228
  export declare const isRezoError: typeof RezoError.isRezoError;
3843
6229
  export declare const Cancel: typeof RezoError;
3844
6230
  export declare const CancelToken: {
@@ -3858,6 +6244,7 @@ export declare const VERSION: string;
3858
6244
  declare const rezo: RezoInstance;
3859
6245
 
3860
6246
  export {
6247
+ CurlRequestConfig as RezoRequestConfig,
3861
6248
  ResponseType$1 as ResponseType,
3862
6249
  rezo as default,
3863
6250
  };