rezo 1.0.2 → 1.0.4
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/README.md +261 -0
- package/dist/adapters/curl.cjs +47 -1
- package/dist/adapters/curl.js +47 -1
- package/dist/adapters/entries/curl.cjs +31 -4
- package/dist/adapters/entries/curl.d.ts +2576 -847
- package/dist/adapters/entries/curl.js +29 -2
- package/dist/adapters/entries/fetch.cjs +31 -2
- package/dist/adapters/entries/fetch.d.ts +1753 -15
- package/dist/adapters/entries/fetch.js +29 -1
- package/dist/adapters/entries/http.cjs +31 -2
- package/dist/adapters/entries/http.d.ts +1774 -14
- package/dist/adapters/entries/http.js +29 -1
- package/dist/adapters/entries/http2.cjs +31 -4
- package/dist/adapters/entries/http2.d.ts +1748 -19
- package/dist/adapters/entries/http2.js +29 -2
- package/dist/adapters/entries/react-native.cjs +31 -2
- package/dist/adapters/entries/react-native.d.ts +1753 -14
- package/dist/adapters/entries/react-native.js +29 -1
- package/dist/adapters/entries/xhr.cjs +31 -2
- package/dist/adapters/entries/xhr.d.ts +1753 -15
- package/dist/adapters/entries/xhr.js +29 -1
- package/dist/adapters/fetch.cjs +24 -20
- package/dist/adapters/fetch.js +24 -20
- package/dist/adapters/http.cjs +69 -19
- package/dist/adapters/http.js +69 -19
- package/dist/adapters/http2.cjs +69 -19
- package/dist/adapters/http2.js +69 -19
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/core/hooks.cjs +16 -0
- package/dist/core/hooks.js +16 -0
- package/dist/core/rezo.cjs +23 -1
- package/dist/core/rezo.js +23 -1
- package/dist/crawler.d.ts +528 -5
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +18 -16
- package/dist/index.d.ts +564 -5
- package/dist/index.js +1 -0
- package/dist/platform/browser.cjs +24 -2
- package/dist/platform/browser.d.ts +672 -10
- package/dist/platform/browser.js +24 -2
- package/dist/platform/bun.cjs +24 -2
- package/dist/platform/bun.d.ts +672 -10
- package/dist/platform/bun.js +24 -2
- package/dist/platform/deno.cjs +24 -2
- package/dist/platform/deno.d.ts +672 -10
- package/dist/platform/deno.js +24 -2
- package/dist/platform/node.cjs +24 -2
- package/dist/platform/node.d.ts +672 -10
- package/dist/platform/node.js +24 -2
- package/dist/platform/react-native.cjs +24 -2
- package/dist/platform/react-native.d.ts +672 -10
- package/dist/platform/react-native.js +24 -2
- package/dist/platform/worker.cjs +24 -2
- package/dist/platform/worker.d.ts +672 -10
- package/dist/platform/worker.js +24 -2
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -0
- package/dist/proxy/index.js +1 -0
- package/dist/proxy/manager.cjs +446 -0
- package/dist/proxy/manager.js +444 -0
- package/dist/utils/http-config.cjs +14 -3
- package/dist/utils/http-config.js +14 -3
- package/package.json +19 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NodeFormData from 'form-data';
|
|
2
|
+
import { Blob as Blob$1 } from 'node:buffer';
|
|
2
3
|
import { EventEmitter } from 'node:events';
|
|
3
4
|
import { Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
|
|
4
5
|
import { Agent as HttpsAgent } from 'node:https';
|
|
@@ -103,7 +104,7 @@ export type RezoHeadersInit = [
|
|
|
103
104
|
string,
|
|
104
105
|
string
|
|
105
106
|
][] | Record<string, string> | Headers | RezoHttpHeaders | RezoHeaders | OutgoingHttpHeaders;
|
|
106
|
-
declare class RezoHeaders extends Headers {
|
|
107
|
+
export declare class RezoHeaders extends Headers {
|
|
107
108
|
constructor(init?: RezoHeadersInit);
|
|
108
109
|
getAll(name: "set-cookie" | "Set-Cookie"): string[];
|
|
109
110
|
getSetCookie(): string[];
|
|
@@ -193,7 +194,7 @@ declare class Cookie extends TouchCookie {
|
|
|
193
194
|
*/
|
|
194
195
|
static isCookie(cookie: any): cookie is Cookie;
|
|
195
196
|
}
|
|
196
|
-
declare class RezoCookieJar extends TouchCookieJar {
|
|
197
|
+
export declare class RezoCookieJar extends TouchCookieJar {
|
|
197
198
|
constructor();
|
|
198
199
|
constructor(cookies: Cookie[]);
|
|
199
200
|
constructor(cookies: Cookie[], url: string);
|
|
@@ -282,7 +283,7 @@ export interface Options extends ReadableOptions {
|
|
|
282
283
|
maxDataSize?: number;
|
|
283
284
|
pauseStreams?: boolean;
|
|
284
285
|
}
|
|
285
|
-
declare class RezoFormData extends NodeFormData {
|
|
286
|
+
export declare class RezoFormData extends NodeFormData {
|
|
286
287
|
constructor(options?: Options);
|
|
287
288
|
/**
|
|
288
289
|
* Get field entries as array of [name, value] pairs
|
|
@@ -898,6 +899,292 @@ export interface RezoDownloadResponse extends DownloadResponse {
|
|
|
898
899
|
*/
|
|
899
900
|
export interface RezoUploadResponse extends UploadResponse {
|
|
900
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* Rezo ProxyManager Types
|
|
904
|
+
* Type definitions for advanced proxy rotation and management
|
|
905
|
+
*
|
|
906
|
+
* @module proxy/types
|
|
907
|
+
* @author Yuniq Solutions Team
|
|
908
|
+
* @version 1.0.0
|
|
909
|
+
*/
|
|
910
|
+
/** Supported proxy protocols */
|
|
911
|
+
export type ProxyProtocol = "socks4" | "socks5" | "http" | "https";
|
|
912
|
+
/**
|
|
913
|
+
* Proxy information structure
|
|
914
|
+
* Represents a single proxy server with its connection details
|
|
915
|
+
*/
|
|
916
|
+
export interface ProxyInfo {
|
|
917
|
+
/** Unique identifier for the proxy (auto-generated if not provided) */
|
|
918
|
+
id?: string;
|
|
919
|
+
/** The proxy protocol to use */
|
|
920
|
+
protocol: ProxyProtocol;
|
|
921
|
+
/** Proxy server hostname or IP address */
|
|
922
|
+
host: string;
|
|
923
|
+
/** Proxy server port number */
|
|
924
|
+
port: number;
|
|
925
|
+
/** Optional authentication credentials for the proxy */
|
|
926
|
+
auth?: {
|
|
927
|
+
/** Username for proxy authentication */
|
|
928
|
+
username: string;
|
|
929
|
+
/** Password for proxy authentication */
|
|
930
|
+
password: string;
|
|
931
|
+
};
|
|
932
|
+
/** Optional label for identification/logging */
|
|
933
|
+
label?: string;
|
|
934
|
+
/** Optional metadata for custom tracking */
|
|
935
|
+
metadata?: Record<string, unknown>;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Proxy rotation strategies
|
|
939
|
+
* - `random`: Select a random proxy from the pool for each request
|
|
940
|
+
* - `sequential`: Use proxies in order, optionally rotating after N requests
|
|
941
|
+
* - `per-proxy-limit`: Use each proxy for a maximum number of requests, then permanently remove
|
|
942
|
+
*/
|
|
943
|
+
export type RotationStrategy = "random" | "sequential" | "per-proxy-limit";
|
|
944
|
+
/**
|
|
945
|
+
* Rotation configuration for different strategies
|
|
946
|
+
*/
|
|
947
|
+
export type RotationConfig = {
|
|
948
|
+
/** Random selection from available proxies */
|
|
949
|
+
rotation: "random";
|
|
950
|
+
} | {
|
|
951
|
+
/** Sequential rotation through proxy list */
|
|
952
|
+
rotation: "sequential";
|
|
953
|
+
/** Number of requests before rotating to next proxy (default: 1) */
|
|
954
|
+
requestsPerProxy?: number;
|
|
955
|
+
} | {
|
|
956
|
+
/** Use each proxy for a limited number of total requests, then remove */
|
|
957
|
+
rotation: "per-proxy-limit";
|
|
958
|
+
/** Maximum requests per proxy before permanent removal */
|
|
959
|
+
limit: number;
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* Cooldown configuration for disabled proxies
|
|
963
|
+
*/
|
|
964
|
+
export interface ProxyCooldownConfig {
|
|
965
|
+
/** Whether to enable automatic re-enabling after cooldown */
|
|
966
|
+
enabled: boolean;
|
|
967
|
+
/** Duration in milliseconds before re-enabling a disabled proxy */
|
|
968
|
+
durationMs: number;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Base proxy manager configuration (without rotation)
|
|
972
|
+
* Complete configuration for proxy rotation, filtering, and failure handling
|
|
973
|
+
*/
|
|
974
|
+
export interface ProxyManagerBaseConfig {
|
|
975
|
+
/** Array of proxies to manage */
|
|
976
|
+
proxies: ProxyInfo[];
|
|
977
|
+
/**
|
|
978
|
+
* Whitelist patterns for URLs that should use proxy
|
|
979
|
+
* - String: exact domain match (e.g., 'api.example.com') or subdomain match (e.g., 'example.com' matches '*.example.com')
|
|
980
|
+
* - RegExp: regex pattern to test against full URL
|
|
981
|
+
* If not set, all URLs use proxy
|
|
982
|
+
*/
|
|
983
|
+
whitelist?: (string | RegExp)[];
|
|
984
|
+
/**
|
|
985
|
+
* Blacklist patterns for URLs that should NOT use proxy (go direct)
|
|
986
|
+
* - String: exact domain match or subdomain match
|
|
987
|
+
* - RegExp: regex pattern to test against full URL
|
|
988
|
+
* Blacklist is checked after whitelist
|
|
989
|
+
*/
|
|
990
|
+
blacklist?: (string | RegExp)[];
|
|
991
|
+
/**
|
|
992
|
+
* Automatically disable proxies after consecutive failures
|
|
993
|
+
* @default false
|
|
994
|
+
*/
|
|
995
|
+
autoDisableDeadProxies?: boolean;
|
|
996
|
+
/**
|
|
997
|
+
* Number of consecutive failures before disabling a proxy
|
|
998
|
+
* Only applies when autoDisableDeadProxies is true
|
|
999
|
+
* @default 3
|
|
1000
|
+
*/
|
|
1001
|
+
maxFailures?: number;
|
|
1002
|
+
/**
|
|
1003
|
+
* Cooldown configuration for disabled proxies
|
|
1004
|
+
* If not set or enabled: false, proxies are permanently removed when disabled
|
|
1005
|
+
*/
|
|
1006
|
+
cooldown?: ProxyCooldownConfig;
|
|
1007
|
+
/**
|
|
1008
|
+
* Whether to throw error when no proxy is available
|
|
1009
|
+
* - true (default): Throw RezoError when no proxies available
|
|
1010
|
+
* - false: Proceed with direct connection (no proxy)
|
|
1011
|
+
* @default true
|
|
1012
|
+
*/
|
|
1013
|
+
failWithoutProxy?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Whether to retry the request with next proxy on failure
|
|
1016
|
+
* @default false
|
|
1017
|
+
*/
|
|
1018
|
+
retryWithNextProxy?: boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* Maximum retry attempts when retryWithNextProxy is enabled
|
|
1021
|
+
* @default 3
|
|
1022
|
+
*/
|
|
1023
|
+
maxProxyRetries?: number;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Full proxy manager configuration
|
|
1027
|
+
* Combines base config with rotation strategy
|
|
1028
|
+
*/
|
|
1029
|
+
export type ProxyManagerConfig = ProxyManagerBaseConfig & RotationConfig;
|
|
1030
|
+
/**
|
|
1031
|
+
* Internal proxy state tracking
|
|
1032
|
+
* Used internally by ProxyManager to track usage and failures
|
|
1033
|
+
*/
|
|
1034
|
+
export interface ProxyState {
|
|
1035
|
+
/** The proxy info */
|
|
1036
|
+
proxy: ProxyInfo;
|
|
1037
|
+
/** Number of requests made through this proxy */
|
|
1038
|
+
requestCount: number;
|
|
1039
|
+
/** Number of consecutive failures */
|
|
1040
|
+
failureCount: number;
|
|
1041
|
+
/** Total number of successful requests */
|
|
1042
|
+
successCount: number;
|
|
1043
|
+
/** Total number of failed requests */
|
|
1044
|
+
totalFailures: number;
|
|
1045
|
+
/** Whether the proxy is currently active */
|
|
1046
|
+
isActive: boolean;
|
|
1047
|
+
/** Reason for being disabled (if applicable) */
|
|
1048
|
+
disabledReason?: "dead" | "limit-reached" | "manual";
|
|
1049
|
+
/** Timestamp when proxy was disabled */
|
|
1050
|
+
disabledAt?: number;
|
|
1051
|
+
/** Timestamp when proxy will be re-enabled (if cooldown enabled) */
|
|
1052
|
+
reenableAt?: number;
|
|
1053
|
+
/** Last successful request timestamp */
|
|
1054
|
+
lastSuccessAt?: number;
|
|
1055
|
+
/** Last failure timestamp */
|
|
1056
|
+
lastFailureAt?: number;
|
|
1057
|
+
/** Last error message */
|
|
1058
|
+
lastError?: string;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Proxy manager status snapshot
|
|
1062
|
+
* Provides overview of all proxies in the manager
|
|
1063
|
+
*/
|
|
1064
|
+
export interface ProxyManagerStatus {
|
|
1065
|
+
/** Active proxies available for use */
|
|
1066
|
+
active: ProxyInfo[];
|
|
1067
|
+
/** Disabled proxies (dead or limit reached) */
|
|
1068
|
+
disabled: ProxyInfo[];
|
|
1069
|
+
/** Proxies in cooldown waiting to be re-enabled */
|
|
1070
|
+
cooldown: ProxyInfo[];
|
|
1071
|
+
/** Total number of proxies */
|
|
1072
|
+
total: number;
|
|
1073
|
+
/** Current rotation strategy */
|
|
1074
|
+
rotation: RotationStrategy;
|
|
1075
|
+
/** Total requests made through the manager */
|
|
1076
|
+
totalRequests: number;
|
|
1077
|
+
/** Total successful requests */
|
|
1078
|
+
totalSuccesses: number;
|
|
1079
|
+
/** Total failed requests */
|
|
1080
|
+
totalFailures: number;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Result from proxy selection
|
|
1084
|
+
*/
|
|
1085
|
+
export interface ProxySelectionResult {
|
|
1086
|
+
/** Selected proxy (null if should go direct) */
|
|
1087
|
+
proxy: ProxyInfo | null;
|
|
1088
|
+
/** Reason for selection result */
|
|
1089
|
+
reason: "selected" | "whitelist-no-match" | "blacklist-match" | "no-proxies-available" | "disabled";
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Context for beforeProxySelect hook
|
|
1093
|
+
*/
|
|
1094
|
+
export interface BeforeProxySelectContext {
|
|
1095
|
+
/** Request URL */
|
|
1096
|
+
url: string;
|
|
1097
|
+
/** Available active proxies */
|
|
1098
|
+
proxies: ProxyInfo[];
|
|
1099
|
+
/** Whether this is a retry attempt */
|
|
1100
|
+
isRetry: boolean;
|
|
1101
|
+
/** Retry count (0 for initial request) */
|
|
1102
|
+
retryCount: number;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Context for afterProxySelect hook
|
|
1106
|
+
*/
|
|
1107
|
+
export interface AfterProxySelectContext {
|
|
1108
|
+
/** Request URL */
|
|
1109
|
+
url: string;
|
|
1110
|
+
/** Selected proxy (null if going direct) */
|
|
1111
|
+
proxy: ProxyInfo | null;
|
|
1112
|
+
/** Selection reason */
|
|
1113
|
+
reason: ProxySelectionResult["reason"];
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Context for beforeProxyError hook
|
|
1117
|
+
*/
|
|
1118
|
+
export interface BeforeProxyErrorContext {
|
|
1119
|
+
/** The proxy that failed */
|
|
1120
|
+
proxy: ProxyInfo;
|
|
1121
|
+
/** The error that occurred */
|
|
1122
|
+
error: Error;
|
|
1123
|
+
/** Request URL */
|
|
1124
|
+
url: string;
|
|
1125
|
+
/** Current failure count for this proxy */
|
|
1126
|
+
failureCount: number;
|
|
1127
|
+
/** Whether proxy will be disabled after this error */
|
|
1128
|
+
willBeDisabled: boolean;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Context for afterProxyError hook
|
|
1132
|
+
*/
|
|
1133
|
+
export interface AfterProxyErrorContext {
|
|
1134
|
+
/** The proxy that failed */
|
|
1135
|
+
proxy: ProxyInfo;
|
|
1136
|
+
/** The error that occurred */
|
|
1137
|
+
error: Error;
|
|
1138
|
+
/** Action taken after error */
|
|
1139
|
+
action: "retry-next-proxy" | "disabled" | "continue";
|
|
1140
|
+
/** Next proxy for retry (if action is 'retry-next-proxy') */
|
|
1141
|
+
nextProxy?: ProxyInfo;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Context for beforeProxyDisable hook
|
|
1145
|
+
* Return false to prevent disabling
|
|
1146
|
+
*/
|
|
1147
|
+
export interface BeforeProxyDisableContext {
|
|
1148
|
+
/** The proxy about to be disabled */
|
|
1149
|
+
proxy: ProxyInfo;
|
|
1150
|
+
/** Reason for disabling */
|
|
1151
|
+
reason: "dead" | "limit-reached" | "manual";
|
|
1152
|
+
/** Current proxy state */
|
|
1153
|
+
state: ProxyState;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Context for afterProxyDisable hook
|
|
1157
|
+
*/
|
|
1158
|
+
export interface AfterProxyDisableContext {
|
|
1159
|
+
/** The proxy that was disabled */
|
|
1160
|
+
proxy: ProxyInfo;
|
|
1161
|
+
/** Reason for disabling */
|
|
1162
|
+
reason: "dead" | "limit-reached" | "manual";
|
|
1163
|
+
/** Whether cooldown is enabled for re-enabling */
|
|
1164
|
+
hasCooldown: boolean;
|
|
1165
|
+
/** Timestamp when proxy will be re-enabled (if cooldown enabled) */
|
|
1166
|
+
reenableAt?: number;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Context for afterProxyRotate hook
|
|
1170
|
+
*/
|
|
1171
|
+
export interface AfterProxyRotateContext {
|
|
1172
|
+
/** Previous proxy (null if first selection) */
|
|
1173
|
+
from: ProxyInfo | null;
|
|
1174
|
+
/** New proxy */
|
|
1175
|
+
to: ProxyInfo;
|
|
1176
|
+
/** Reason for rotation */
|
|
1177
|
+
reason: "scheduled" | "failure" | "limit-reached";
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Context for afterProxyEnable hook
|
|
1181
|
+
*/
|
|
1182
|
+
export interface AfterProxyEnableContext {
|
|
1183
|
+
/** The proxy that was enabled */
|
|
1184
|
+
proxy: ProxyInfo;
|
|
1185
|
+
/** Reason for enabling */
|
|
1186
|
+
reason: "cooldown-expired" | "manual";
|
|
1187
|
+
}
|
|
901
1188
|
/**
|
|
902
1189
|
* Context provided to beforeRequest hook
|
|
903
1190
|
* Contains metadata about the current request state
|
|
@@ -1176,6 +1463,46 @@ export type OnTimeoutHook = (event: TimeoutEvent, config: RezoConfig) => void;
|
|
|
1176
1463
|
* Use for cleanup, logging
|
|
1177
1464
|
*/
|
|
1178
1465
|
export type OnAbortHook = (event: AbortEvent, config: RezoConfig) => void;
|
|
1466
|
+
/**
|
|
1467
|
+
* Hook called before a proxy is selected
|
|
1468
|
+
* Can return a specific proxy to override selection
|
|
1469
|
+
*/
|
|
1470
|
+
export type BeforeProxySelectHook = (context: BeforeProxySelectContext) => ProxyInfo | void | Promise<ProxyInfo | void>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Hook called after a proxy is selected
|
|
1473
|
+
* Use for logging, analytics
|
|
1474
|
+
*/
|
|
1475
|
+
export type AfterProxySelectHook = (context: AfterProxySelectContext) => void | Promise<void>;
|
|
1476
|
+
/**
|
|
1477
|
+
* Hook called before a proxy error is processed
|
|
1478
|
+
* Use for error inspection, custom handling
|
|
1479
|
+
*/
|
|
1480
|
+
export type BeforeProxyErrorHook = (context: BeforeProxyErrorContext) => void | Promise<void>;
|
|
1481
|
+
/**
|
|
1482
|
+
* Hook called after a proxy error is processed
|
|
1483
|
+
* Use for error logging, fallback logic
|
|
1484
|
+
*/
|
|
1485
|
+
export type AfterProxyErrorHook = (context: AfterProxyErrorContext) => void | Promise<void>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Hook called before a proxy is disabled
|
|
1488
|
+
* Return false to prevent disabling
|
|
1489
|
+
*/
|
|
1490
|
+
export type BeforeProxyDisableHook = (context: BeforeProxyDisableContext) => boolean | void | Promise<boolean | void>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Hook called after a proxy is disabled
|
|
1493
|
+
* Use for notifications, logging
|
|
1494
|
+
*/
|
|
1495
|
+
export type AfterProxyDisableHook = (context: AfterProxyDisableContext) => void | Promise<void>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Hook called when proxy rotation occurs
|
|
1498
|
+
* Use for monitoring rotation patterns
|
|
1499
|
+
*/
|
|
1500
|
+
export type AfterProxyRotateHook = (context: AfterProxyRotateContext) => void | Promise<void>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Hook called when a proxy is re-enabled
|
|
1503
|
+
* Use for notifications, logging
|
|
1504
|
+
*/
|
|
1505
|
+
export type AfterProxyEnableHook = (context: AfterProxyEnableContext) => void | Promise<void>;
|
|
1179
1506
|
/**
|
|
1180
1507
|
* Collection of all hook types
|
|
1181
1508
|
* All hooks are arrays to allow multiple handlers
|
|
@@ -1192,12 +1519,29 @@ export interface RezoHooks {
|
|
|
1192
1519
|
afterParse: AfterParseHook[];
|
|
1193
1520
|
beforeCookie: BeforeCookieHook[];
|
|
1194
1521
|
afterCookie: AfterCookieHook[];
|
|
1522
|
+
beforeProxySelect: BeforeProxySelectHook[];
|
|
1523
|
+
afterProxySelect: AfterProxySelectHook[];
|
|
1524
|
+
beforeProxyError: BeforeProxyErrorHook[];
|
|
1525
|
+
afterProxyError: AfterProxyErrorHook[];
|
|
1526
|
+
beforeProxyDisable: BeforeProxyDisableHook[];
|
|
1527
|
+
afterProxyDisable: AfterProxyDisableHook[];
|
|
1528
|
+
afterProxyRotate: AfterProxyRotateHook[];
|
|
1529
|
+
afterProxyEnable: AfterProxyEnableHook[];
|
|
1195
1530
|
onSocket: OnSocketHook[];
|
|
1196
1531
|
onDns: OnDnsHook[];
|
|
1197
1532
|
onTls: OnTlsHook[];
|
|
1198
1533
|
onTimeout: OnTimeoutHook[];
|
|
1199
1534
|
onAbort: OnAbortHook[];
|
|
1200
1535
|
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Create empty hooks object with all arrays initialized
|
|
1538
|
+
*/
|
|
1539
|
+
export declare function createDefaultHooks(): RezoHooks;
|
|
1540
|
+
/**
|
|
1541
|
+
* Merge base hooks with override hooks
|
|
1542
|
+
* Overrides are appended to base hooks (base runs first)
|
|
1543
|
+
*/
|
|
1544
|
+
export declare function mergeHooks(base: RezoHooks, overrides?: Partial<RezoHooks>): RezoHooks;
|
|
1201
1545
|
/**
|
|
1202
1546
|
* Configuration object that encapsulates comprehensive request execution metadata and response processing information.
|
|
1203
1547
|
* This interface serves as the central configuration hub for HTTP requests, containing both input parameters
|
|
@@ -1539,7 +1883,58 @@ export interface RezoConfig {
|
|
|
1539
1883
|
*/
|
|
1540
1884
|
useCookies: boolean;
|
|
1541
1885
|
}
|
|
1542
|
-
declare
|
|
1886
|
+
export declare enum RezoErrorCode {
|
|
1887
|
+
CONNECTION_REFUSED = "ECONNREFUSED",
|
|
1888
|
+
CONNECTION_RESET = "ECONNRESET",
|
|
1889
|
+
CONNECTION_TIMEOUT = "ETIMEDOUT",
|
|
1890
|
+
DNS_LOOKUP_FAILED = "ENOTFOUND",
|
|
1891
|
+
DNS_TEMPORARY_FAILURE = "EAI_AGAIN",
|
|
1892
|
+
HOST_UNREACHABLE = "EHOSTUNREACH",
|
|
1893
|
+
NETWORK_UNREACHABLE = "ENETUNREACH",
|
|
1894
|
+
BROKEN_PIPE = "EPIPE",
|
|
1895
|
+
HTTP_ERROR = "REZ_HTTP_ERROR",
|
|
1896
|
+
REDIRECT_DENIED = "REZ_REDIRECT_DENIED",
|
|
1897
|
+
MAX_REDIRECTS = "REZ_MAX_REDIRECTS_EXCEEDED",
|
|
1898
|
+
REDIRECT_CYCLE = "REZ_REDIRECT_CYCLE_DETECTED",
|
|
1899
|
+
MISSING_REDIRECT_LOCATION = "REZ_MISSING_REDIRECT_LOCATION",
|
|
1900
|
+
DECOMPRESSION_ERROR = "REZ_DECOMPRESSION_ERROR",
|
|
1901
|
+
REQUEST_TIMEOUT = "UND_ERR_REQUEST_TIMEOUT",
|
|
1902
|
+
HEADERS_TIMEOUT = "UND_ERR_HEADERS_TIMEOUT",
|
|
1903
|
+
CONNECT_TIMEOUT = "UND_ERR_CONNECT_TIMEOUT",
|
|
1904
|
+
ABORTED = "ABORT_ERR",
|
|
1905
|
+
DOWNLOAD_FAILED = "REZ_DOWNLOAD_FAILED",
|
|
1906
|
+
UPLOAD_FAILED = "REZ_UPLOAD_FAILED",
|
|
1907
|
+
STREAM_ERROR = "REZ_STREAM_ERROR",
|
|
1908
|
+
BODY_TOO_LARGE = "REZ_BODY_TOO_LARGE",
|
|
1909
|
+
RESPONSE_TOO_LARGE = "REZ_RESPONSE_TOO_LARGE",
|
|
1910
|
+
INVALID_JSON = "REZ_INVALID_JSON",
|
|
1911
|
+
INVALID_URL = "ERR_INVALID_URL",
|
|
1912
|
+
INVALID_PROTOCOL = "ERR_INVALID_PROTOCOL",
|
|
1913
|
+
INVALID_ARGUMENT = "ERR_INVALID_ARG_TYPE",
|
|
1914
|
+
FILE_PERMISSION = "REZ_FILE_PERMISSION_ERROR",
|
|
1915
|
+
PROXY_CONNECTION_FAILED = "REZ_PROXY_CONNECTION_FAILED",
|
|
1916
|
+
PROXY_AUTH_FAILED = "REZ_PROXY_AUTHENTICATION_FAILED",
|
|
1917
|
+
PROXY_TARGET_UNREACHABLE = "REZ_PROXY_TARGET_UNREACHABLE",
|
|
1918
|
+
PROXY_TIMEOUT = "REZ_PROXY_TIMEOUT",
|
|
1919
|
+
PROXY_ERROR = "REZ_PROXY_ERROR",
|
|
1920
|
+
PROXY_INVALID_PROTOCOL = "REZ_PROXY_INVALID_PROTOCOL",
|
|
1921
|
+
PROXY_INVALID_CONFIG = "REZ_PROXY_INVALID_HOSTPORT",
|
|
1922
|
+
SOCKS_CONNECTION_FAILED = "REZ_SOCKS_CONNECTION_FAILED",
|
|
1923
|
+
SOCKS_AUTH_FAILED = "REZ_SOCKS_AUTHENTICATION_FAILED",
|
|
1924
|
+
SOCKS_TARGET_UNREACHABLE = "REZ_SOCKS_TARGET_CONNECTION_FAILED",
|
|
1925
|
+
SOCKS_PROTOCOL_ERROR = "REZ_SOCKS_PROTOCOL_ERROR",
|
|
1926
|
+
SOCKS_UNSUPPORTED_VERSION = "REZ_SOCKS_UNSUPPORTED_VERSION",
|
|
1927
|
+
TLS_HANDSHAKE_TIMEOUT = "ERR_TLS_HANDSHAKE_TIMEOUT",
|
|
1928
|
+
TLS_PROTOCOL_ERROR = "EPROTO",
|
|
1929
|
+
TLS_PROTOCOL_VERSION = "ERR_TLS_INVALID_PROTOCOL_VERSION",
|
|
1930
|
+
CERTIFICATE_HOSTNAME_MISMATCH = "ERR_TLS_CERT_ALTNAME_INVALID",
|
|
1931
|
+
CERTIFICATE_EXPIRED = "CERT_HAS_EXPIRED",
|
|
1932
|
+
CERTIFICATE_SELF_SIGNED = "SELF_SIGNED_CERT_IN_CHAIN",
|
|
1933
|
+
CERTIFICATE_VERIFY_FAILED = "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
1934
|
+
RATE_LIMITED = "REZ_RATE_LIMITED",
|
|
1935
|
+
UNKNOWN_ERROR = "REZ_UNKNOWN_ERROR"
|
|
1936
|
+
}
|
|
1937
|
+
export declare class RezoError<T = any> extends Error {
|
|
1543
1938
|
readonly code?: string;
|
|
1544
1939
|
readonly errno?: number;
|
|
1545
1940
|
readonly config: RezoConfig;
|
|
@@ -1588,16 +1983,13 @@ declare class RezoError<T = any> extends Error {
|
|
|
1588
1983
|
toString(): string;
|
|
1589
1984
|
getFullDetails(): string;
|
|
1590
1985
|
}
|
|
1591
|
-
|
|
1592
|
-
* Supported proxy protocols for network requests
|
|
1593
|
-
*/
|
|
1594
|
-
export type ProxyProtocol = "http" | "https" | "socks4" | "socks5";
|
|
1986
|
+
type ProxyProtocol$1 = "http" | "https" | "socks4" | "socks5";
|
|
1595
1987
|
/**
|
|
1596
1988
|
* Configuration options for proxy connections
|
|
1597
1989
|
*/
|
|
1598
1990
|
export type ProxyOptions = {
|
|
1599
1991
|
/** The proxy protocol to use */
|
|
1600
|
-
protocol: ProxyProtocol;
|
|
1992
|
+
protocol: ProxyProtocol$1;
|
|
1601
1993
|
/** Proxy server hostname or IP address */
|
|
1602
1994
|
host: string;
|
|
1603
1995
|
/** Proxy server port number */
|
|
@@ -1638,6 +2030,51 @@ export type RezoString = string;
|
|
|
1638
2030
|
* Standard HTTP methods supported by Rezo
|
|
1639
2031
|
*/
|
|
1640
2032
|
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE" | "CONNECT";
|
|
2033
|
+
/**
|
|
2034
|
+
* Response data types that control how Rezo parses the response body.
|
|
2035
|
+
*
|
|
2036
|
+
* @description
|
|
2037
|
+
* Specifies how the response body should be parsed and returned in `response.data`.
|
|
2038
|
+
* Choose the type that matches your expected response format.
|
|
2039
|
+
*
|
|
2040
|
+
* **Available Types:**
|
|
2041
|
+
*
|
|
2042
|
+
* - `'json'` - Parse response as JSON. Returns parsed object/array.
|
|
2043
|
+
* Best for REST APIs that return JSON data.
|
|
2044
|
+
*
|
|
2045
|
+
* - `'text'` - Return response as a string. No parsing applied.
|
|
2046
|
+
* Best for HTML, XML, plain text, or when you need raw content.
|
|
2047
|
+
*
|
|
2048
|
+
* - `'blob'` - Return as Blob object (browser environments).
|
|
2049
|
+
* Best for binary data in browsers (images, files, etc).
|
|
2050
|
+
*
|
|
2051
|
+
* - `'arrayBuffer'` - Return as ArrayBuffer.
|
|
2052
|
+
* Best for binary data processing, cryptographic operations.
|
|
2053
|
+
*
|
|
2054
|
+
* - `'buffer'` - Return as Node.js Buffer.
|
|
2055
|
+
* Best for binary data in Node.js (files, images, binary protocols).
|
|
2056
|
+
*
|
|
2057
|
+
* - `'auto'` - Auto-detect based on Content-Type header (default).
|
|
2058
|
+
* JSON for `application/json`, text for `text/*`, buffer otherwise.
|
|
2059
|
+
*
|
|
2060
|
+
* **Streaming Operations:**
|
|
2061
|
+
* For streaming, use dedicated methods instead of responseType:
|
|
2062
|
+
* - `rezo.stream(url)` - Returns StreamResponse for real-time data
|
|
2063
|
+
* - `rezo.download(url, saveTo)` - Returns DownloadResponse with progress
|
|
2064
|
+
* - `rezo.upload(url, data)` - Returns UploadResponse with progress
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* // Get JSON data (default for JSON APIs)
|
|
2068
|
+
* const { data } = await rezo.get('/api/users', { responseType: 'json' });
|
|
2069
|
+
*
|
|
2070
|
+
* // Get HTML as text
|
|
2071
|
+
* const { data: html } = await rezo.get('/page', { responseType: 'text' });
|
|
2072
|
+
*
|
|
2073
|
+
* // Get image as buffer
|
|
2074
|
+
* const { data: imageBuffer } = await rezo.get('/image.png', { responseType: 'buffer' });
|
|
2075
|
+
*
|
|
2076
|
+
* @default 'auto'
|
|
2077
|
+
*/
|
|
1641
2078
|
type ResponseType$1 = "json" | "text" | "blob" | "arrayBuffer" | "buffer" | "auto";
|
|
1642
2079
|
/**
|
|
1643
2080
|
* MIME content types for request/response bodies
|
|
@@ -1972,11 +2409,81 @@ export type ToRedirectOptions = {
|
|
|
1972
2409
|
* @internal - Do not use internally within the library
|
|
1973
2410
|
*/
|
|
1974
2411
|
export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method" | "form" | "json" | "formData" | "multipart" | "fullUrl" | "responseType">;
|
|
2412
|
+
/**
|
|
2413
|
+
* Method-aware request types for better TypeScript inference
|
|
2414
|
+
* These types remove data/body fields from methods that don't typically use them
|
|
2415
|
+
*/
|
|
2416
|
+
/**
|
|
2417
|
+
* RezoHttpGetRequest - Request options for GET requests (no request body)
|
|
2418
|
+
* @public - Use with GET method
|
|
2419
|
+
*/
|
|
2420
|
+
export type RezoHttpGetRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
2421
|
+
/**
|
|
2422
|
+
* RezoHttpPostRequest - Request options for POST requests (includes request body)
|
|
2423
|
+
* @public - Use with POST method
|
|
2424
|
+
*/
|
|
2425
|
+
export type RezoHttpPostRequest = RezoHttpRequest;
|
|
2426
|
+
/**
|
|
2427
|
+
* RezoHttpPutRequest - Request options for PUT requests (includes request body)
|
|
2428
|
+
* @public - Use with PUT method
|
|
2429
|
+
*/
|
|
2430
|
+
export type RezoHttpPutRequest = RezoHttpRequest;
|
|
2431
|
+
/**
|
|
2432
|
+
* RezoHttpPatchRequest - Request options for PATCH requests (includes request body)
|
|
2433
|
+
* @public - Use with PATCH method
|
|
2434
|
+
*/
|
|
2435
|
+
export type RezoHttpPatchRequest = RezoHttpRequest;
|
|
2436
|
+
/**
|
|
2437
|
+
* RezoHttpDeleteRequest - Request options for DELETE requests (no request body)
|
|
2438
|
+
* @public - Use with DELETE method
|
|
2439
|
+
*/
|
|
2440
|
+
export type RezoHttpDeleteRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
2441
|
+
/**
|
|
2442
|
+
* RezoHttpHeadRequest - Request options for HEAD requests (no request body)
|
|
2443
|
+
* @public - Use with HEAD method
|
|
2444
|
+
*/
|
|
2445
|
+
export type RezoHttpHeadRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
2446
|
+
/**
|
|
2447
|
+
* RezoHttpOptionsRequest - Request options for OPTIONS requests (no request body)
|
|
2448
|
+
* @public - Use with OPTIONS method
|
|
2449
|
+
*/
|
|
2450
|
+
export type RezoHttpOptionsRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
2451
|
+
/**
|
|
2452
|
+
* RezoRequestOptions - Request configuration type for the .request() method
|
|
2453
|
+
*
|
|
2454
|
+
* This type excludes internal properties and is specifically designed for public API usage.
|
|
2455
|
+
* Use this type when creating reusable request configurations for the .request() method.
|
|
2456
|
+
*
|
|
2457
|
+
* @public - For external use with .request() method only
|
|
2458
|
+
* @internal - Do not use internally within the library
|
|
2459
|
+
*/
|
|
2460
|
+
export type RezoRequestOptions = Omit<RezoRequestConfig, "fullUrl">;
|
|
1975
2461
|
export interface DNSCacheOptions {
|
|
1976
2462
|
enable?: boolean;
|
|
1977
2463
|
ttl?: number;
|
|
1978
2464
|
maxEntries?: number;
|
|
1979
2465
|
}
|
|
2466
|
+
declare class DNSCache {
|
|
2467
|
+
private cache;
|
|
2468
|
+
private enabled;
|
|
2469
|
+
constructor(options?: DNSCacheOptions);
|
|
2470
|
+
private makeKey;
|
|
2471
|
+
lookup(hostname: string, family?: 4 | 6): Promise<{
|
|
2472
|
+
address: string;
|
|
2473
|
+
family: 4 | 6;
|
|
2474
|
+
} | undefined>;
|
|
2475
|
+
lookupAll(hostname: string, family?: 4 | 6): Promise<Array<{
|
|
2476
|
+
address: string;
|
|
2477
|
+
family: 4 | 6;
|
|
2478
|
+
}>>;
|
|
2479
|
+
private resolveDNS;
|
|
2480
|
+
private resolveAllDNS;
|
|
2481
|
+
invalidate(hostname: string): void;
|
|
2482
|
+
clear(): void;
|
|
2483
|
+
get size(): number;
|
|
2484
|
+
get isEnabled(): boolean;
|
|
2485
|
+
setEnabled(enabled: boolean): void;
|
|
2486
|
+
}
|
|
1980
2487
|
export interface ResponseCacheConfig {
|
|
1981
2488
|
enable?: boolean;
|
|
1982
2489
|
cacheDir?: string;
|
|
@@ -1986,6 +2493,201 @@ export interface ResponseCacheConfig {
|
|
|
1986
2493
|
methods?: string[];
|
|
1987
2494
|
respectHeaders?: boolean;
|
|
1988
2495
|
}
|
|
2496
|
+
export type ResponseCacheOption = boolean | ResponseCacheConfig;
|
|
2497
|
+
export interface CachedResponse {
|
|
2498
|
+
status: number;
|
|
2499
|
+
statusText: string;
|
|
2500
|
+
headers: Record<string, string>;
|
|
2501
|
+
data: unknown;
|
|
2502
|
+
url: string;
|
|
2503
|
+
timestamp: number;
|
|
2504
|
+
ttl: number;
|
|
2505
|
+
etag?: string;
|
|
2506
|
+
lastModified?: string;
|
|
2507
|
+
}
|
|
2508
|
+
declare class ResponseCache {
|
|
2509
|
+
private memoryCache;
|
|
2510
|
+
private config;
|
|
2511
|
+
private persistenceEnabled;
|
|
2512
|
+
private initialized;
|
|
2513
|
+
constructor(options?: ResponseCacheOption);
|
|
2514
|
+
private initializePersistence;
|
|
2515
|
+
private initializePersistenceAsync;
|
|
2516
|
+
private getCacheFilePath;
|
|
2517
|
+
private persistToDisk;
|
|
2518
|
+
private loadFromDiskAsync;
|
|
2519
|
+
private generateKey;
|
|
2520
|
+
private parseCacheControl;
|
|
2521
|
+
isCacheable(method: string, status: number, headers?: Record<string, string>): boolean;
|
|
2522
|
+
get(method: string, url: string, headers?: Record<string, string>): CachedResponse | undefined;
|
|
2523
|
+
private loadSingleFromDisk;
|
|
2524
|
+
set(method: string, url: string, response: RezoResponse, requestHeaders?: Record<string, string>): void;
|
|
2525
|
+
private normalizeHeaders;
|
|
2526
|
+
getConditionalHeaders(method: string, url: string, requestHeaders?: Record<string, string>): Record<string, string> | undefined;
|
|
2527
|
+
updateRevalidated(method: string, url: string, newHeaders: Record<string, string>, requestHeaders?: Record<string, string>): CachedResponse | undefined;
|
|
2528
|
+
invalidate(url: string, method?: string): void;
|
|
2529
|
+
clear(): void;
|
|
2530
|
+
get size(): number;
|
|
2531
|
+
get isEnabled(): boolean;
|
|
2532
|
+
get isPersistent(): boolean;
|
|
2533
|
+
getConfig(): ResponseCacheConfig;
|
|
2534
|
+
}
|
|
2535
|
+
type BeforeProxySelectHook$1 = (context: BeforeProxySelectContext) => ProxyInfo | void | Promise<ProxyInfo | void>;
|
|
2536
|
+
type AfterProxySelectHook$1 = (context: AfterProxySelectContext) => void | Promise<void>;
|
|
2537
|
+
type BeforeProxyErrorHook$1 = (context: BeforeProxyErrorContext) => void | Promise<void>;
|
|
2538
|
+
type AfterProxyErrorHook$1 = (context: AfterProxyErrorContext) => void | Promise<void>;
|
|
2539
|
+
type BeforeProxyDisableHook$1 = (context: BeforeProxyDisableContext) => boolean | void | Promise<boolean | void>;
|
|
2540
|
+
type AfterProxyDisableHook$1 = (context: AfterProxyDisableContext) => void | Promise<void>;
|
|
2541
|
+
type AfterProxyRotateHook$1 = (context: AfterProxyRotateContext) => void | Promise<void>;
|
|
2542
|
+
type AfterProxyEnableHook$1 = (context: AfterProxyEnableContext) => void | Promise<void>;
|
|
2543
|
+
/**
|
|
2544
|
+
* Proxy hooks collection for ProxyManager events
|
|
2545
|
+
*/
|
|
2546
|
+
export interface ProxyHooks {
|
|
2547
|
+
beforeProxySelect: BeforeProxySelectHook$1[];
|
|
2548
|
+
afterProxySelect: AfterProxySelectHook$1[];
|
|
2549
|
+
beforeProxyError: BeforeProxyErrorHook$1[];
|
|
2550
|
+
afterProxyError: AfterProxyErrorHook$1[];
|
|
2551
|
+
beforeProxyDisable: BeforeProxyDisableHook$1[];
|
|
2552
|
+
afterProxyDisable: AfterProxyDisableHook$1[];
|
|
2553
|
+
afterProxyRotate: AfterProxyRotateHook$1[];
|
|
2554
|
+
afterProxyEnable: AfterProxyEnableHook$1[];
|
|
2555
|
+
}
|
|
2556
|
+
declare class ProxyManager {
|
|
2557
|
+
/** Configuration for the proxy manager */
|
|
2558
|
+
readonly config: ProxyManagerConfig;
|
|
2559
|
+
/** Internal proxy states map (proxyId -> state) */
|
|
2560
|
+
private states;
|
|
2561
|
+
/** Current index for sequential rotation */
|
|
2562
|
+
private currentIndex;
|
|
2563
|
+
/** Request counter for current proxy (sequential rotation) */
|
|
2564
|
+
private currentProxyRequests;
|
|
2565
|
+
/** Last selected proxy (for rotation tracking) */
|
|
2566
|
+
private lastSelectedProxy;
|
|
2567
|
+
/** Cooldown timers map (proxyId -> timerId) */
|
|
2568
|
+
private cooldownTimers;
|
|
2569
|
+
/** Total requests through manager */
|
|
2570
|
+
private _totalRequests;
|
|
2571
|
+
/** Total successful requests */
|
|
2572
|
+
private _totalSuccesses;
|
|
2573
|
+
/** Total failed requests */
|
|
2574
|
+
private _totalFailures;
|
|
2575
|
+
/** Proxy hooks */
|
|
2576
|
+
hooks: ProxyHooks;
|
|
2577
|
+
/**
|
|
2578
|
+
* Create a new ProxyManager instance
|
|
2579
|
+
* @param config - Proxy manager configuration
|
|
2580
|
+
*/
|
|
2581
|
+
constructor(config: ProxyManagerConfig);
|
|
2582
|
+
/**
|
|
2583
|
+
* Create initial state for a proxy
|
|
2584
|
+
*/
|
|
2585
|
+
private createInitialState;
|
|
2586
|
+
/**
|
|
2587
|
+
* Check if a URL should use proxy based on whitelist/blacklist
|
|
2588
|
+
* @param url - The request URL to check
|
|
2589
|
+
* @returns true if URL should use proxy, false if should go direct
|
|
2590
|
+
*/
|
|
2591
|
+
shouldProxy(url: string): boolean;
|
|
2592
|
+
/**
|
|
2593
|
+
* Match a URL against a pattern
|
|
2594
|
+
*/
|
|
2595
|
+
private matchPattern;
|
|
2596
|
+
/**
|
|
2597
|
+
* Get active proxies (not disabled)
|
|
2598
|
+
*/
|
|
2599
|
+
getActive(): ProxyInfo[];
|
|
2600
|
+
/**
|
|
2601
|
+
* Get disabled proxies
|
|
2602
|
+
*/
|
|
2603
|
+
getDisabled(): ProxyInfo[];
|
|
2604
|
+
/**
|
|
2605
|
+
* Get proxies in cooldown
|
|
2606
|
+
*/
|
|
2607
|
+
getCooldown(): ProxyInfo[];
|
|
2608
|
+
/**
|
|
2609
|
+
* Process expired cooldowns and re-enable proxies
|
|
2610
|
+
*/
|
|
2611
|
+
private processExpiredCooldowns;
|
|
2612
|
+
/**
|
|
2613
|
+
* Get next proxy based on rotation strategy
|
|
2614
|
+
* @param url - The request URL (for whitelist/blacklist checking)
|
|
2615
|
+
* @returns Selected proxy or null if should go direct
|
|
2616
|
+
*/
|
|
2617
|
+
next(url: string): ProxyInfo | null;
|
|
2618
|
+
/**
|
|
2619
|
+
* Get detailed selection result with reason
|
|
2620
|
+
* @param url - The request URL
|
|
2621
|
+
* @returns Selection result with proxy and reason
|
|
2622
|
+
*/
|
|
2623
|
+
select(url: string): ProxySelectionResult;
|
|
2624
|
+
/**
|
|
2625
|
+
* Select proxy based on rotation strategy
|
|
2626
|
+
*/
|
|
2627
|
+
private selectProxy;
|
|
2628
|
+
/**
|
|
2629
|
+
* Report a successful request through a proxy
|
|
2630
|
+
* @param proxy - The proxy that succeeded
|
|
2631
|
+
*/
|
|
2632
|
+
reportSuccess(proxy: ProxyInfo): void;
|
|
2633
|
+
/**
|
|
2634
|
+
* Report a failed request through a proxy
|
|
2635
|
+
* @param proxy - The proxy that failed
|
|
2636
|
+
* @param error - The error that occurred
|
|
2637
|
+
* @param url - Optional URL for hook context
|
|
2638
|
+
*/
|
|
2639
|
+
reportFailure(proxy: ProxyInfo, error: Error, url?: string): void;
|
|
2640
|
+
/**
|
|
2641
|
+
* Disable a proxy from the pool
|
|
2642
|
+
* @param proxy - The proxy to disable
|
|
2643
|
+
* @param reason - Reason for disabling
|
|
2644
|
+
*/
|
|
2645
|
+
disableProxy(proxy: ProxyInfo, reason?: "dead" | "limit-reached" | "manual"): void;
|
|
2646
|
+
/**
|
|
2647
|
+
* Enable a previously disabled proxy
|
|
2648
|
+
* @param proxy - The proxy to enable
|
|
2649
|
+
* @param reason - Reason for enabling
|
|
2650
|
+
*/
|
|
2651
|
+
enableProxy(proxy: ProxyInfo, reason?: "cooldown-expired" | "manual"): void;
|
|
2652
|
+
/**
|
|
2653
|
+
* Add proxies to the pool
|
|
2654
|
+
* @param proxies - Proxies to add
|
|
2655
|
+
*/
|
|
2656
|
+
add(proxies: ProxyInfo | ProxyInfo[]): void;
|
|
2657
|
+
/**
|
|
2658
|
+
* Remove proxies from the pool
|
|
2659
|
+
* @param proxies - Proxies to remove
|
|
2660
|
+
*/
|
|
2661
|
+
remove(proxies: ProxyInfo | ProxyInfo[]): void;
|
|
2662
|
+
/**
|
|
2663
|
+
* Reset all proxies - re-enable all and reset counters
|
|
2664
|
+
*/
|
|
2665
|
+
reset(): void;
|
|
2666
|
+
/**
|
|
2667
|
+
* Get current status of all proxies
|
|
2668
|
+
*/
|
|
2669
|
+
getStatus(): ProxyManagerStatus;
|
|
2670
|
+
/**
|
|
2671
|
+
* Get state for a specific proxy
|
|
2672
|
+
* @param proxy - The proxy to get state for
|
|
2673
|
+
*/
|
|
2674
|
+
getProxyState(proxy: ProxyInfo): ProxyState | undefined;
|
|
2675
|
+
/**
|
|
2676
|
+
* Check if any proxies are available
|
|
2677
|
+
*/
|
|
2678
|
+
hasAvailableProxies(): boolean;
|
|
2679
|
+
/**
|
|
2680
|
+
* Destroy the manager and cleanup timers
|
|
2681
|
+
*/
|
|
2682
|
+
destroy(): void;
|
|
2683
|
+
private runBeforeProxySelectHooksSync;
|
|
2684
|
+
private runAfterProxySelectHooksSync;
|
|
2685
|
+
private runBeforeProxyErrorHooksSync;
|
|
2686
|
+
private runAfterProxyErrorHooksSync;
|
|
2687
|
+
private runAfterProxyRotateHooks;
|
|
2688
|
+
private runAfterProxyDisableHooks;
|
|
2689
|
+
private runAfterProxyEnableHooks;
|
|
2690
|
+
}
|
|
1989
2691
|
export type queueOptions = Options$1<PriorityQueue, QueueAddOptions>;
|
|
1990
2692
|
export interface CacheConfig {
|
|
1991
2693
|
/** Response cache configuration */
|
|
@@ -2112,25 +2814,1052 @@ export interface RezoDefaultOptions {
|
|
|
2112
2814
|
* DNS cache defaults: 1 min TTL, 1000 entries
|
|
2113
2815
|
*/
|
|
2114
2816
|
cache?: CacheOption;
|
|
2817
|
+
/**
|
|
2818
|
+
* Proxy manager for advanced proxy rotation and pool management
|
|
2819
|
+
* - Provide a `ProxyManager` instance for full control
|
|
2820
|
+
* - Or provide `ProxyManagerConfig` to auto-create internally
|
|
2821
|
+
*
|
|
2822
|
+
* Note: ProxyManager overrides `proxy` option when set.
|
|
2823
|
+
* Use `useProxyManager: false` per-request to bypass.
|
|
2824
|
+
*
|
|
2825
|
+
* @example
|
|
2826
|
+
* ```typescript
|
|
2827
|
+
* // With config (auto-creates ProxyManager)
|
|
2828
|
+
* const client = new Rezo({
|
|
2829
|
+
* proxyManager: {
|
|
2830
|
+
* rotation: 'random',
|
|
2831
|
+
* proxies: [
|
|
2832
|
+
* { protocol: 'socks5', host: '127.0.0.1', port: 1080 },
|
|
2833
|
+
* { protocol: 'http', host: 'proxy.example.com', port: 8080 }
|
|
2834
|
+
* ],
|
|
2835
|
+
* whitelist: ['api.example.com'],
|
|
2836
|
+
* autoDisableDeadProxies: true
|
|
2837
|
+
* }
|
|
2838
|
+
* });
|
|
2839
|
+
*
|
|
2840
|
+
* // With ProxyManager instance
|
|
2841
|
+
* const pm = new ProxyManager({ rotation: 'sequential', proxies: [...] });
|
|
2842
|
+
* const client = new Rezo({ proxyManager: pm });
|
|
2843
|
+
* ```
|
|
2844
|
+
*/
|
|
2845
|
+
proxyManager?: ProxyManager | ProxyManagerConfig;
|
|
2846
|
+
}
|
|
2847
|
+
export interface httpAdapterOverloads {
|
|
2848
|
+
request<T = any>(options: RezoRequestOptions): Promise<RezoResponse<T>>;
|
|
2849
|
+
request<T = any>(options: RezoRequestOptions & {
|
|
2850
|
+
responseType: "auto";
|
|
2851
|
+
}): Promise<RezoResponse<T>>;
|
|
2852
|
+
request<T = any>(options: RezoRequestOptions & {
|
|
2853
|
+
responseType: "json";
|
|
2854
|
+
}): Promise<RezoResponse<T>>;
|
|
2855
|
+
request(options: {
|
|
2856
|
+
responseType: "stream";
|
|
2857
|
+
} & RezoRequestOptions): Promise<RezoStreamResponse>;
|
|
2858
|
+
request(options: RezoRequestOptions & {
|
|
2859
|
+
responseType: "arrayBuffer";
|
|
2860
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
2861
|
+
request(options: RezoRequestOptions & {
|
|
2862
|
+
responseType: "buffer";
|
|
2863
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
2864
|
+
request(options: RezoRequestOptions & {
|
|
2865
|
+
responseType: "blob";
|
|
2866
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
2867
|
+
request(options: RezoRequestOptions & {
|
|
2868
|
+
responseType: "text";
|
|
2869
|
+
}): Promise<RezoResponse<string>>;
|
|
2870
|
+
request(options: RezoRequestOptions & {
|
|
2871
|
+
responseType: "download";
|
|
2872
|
+
}): Promise<RezoDownloadResponse>;
|
|
2873
|
+
request(options: RezoRequestOptions & {
|
|
2874
|
+
fileName: string;
|
|
2875
|
+
}): Promise<RezoDownloadResponse>;
|
|
2876
|
+
request(options: RezoRequestOptions & {
|
|
2877
|
+
saveTo: string;
|
|
2878
|
+
}): Promise<RezoDownloadResponse>;
|
|
2879
|
+
request(options: RezoRequestOptions & {
|
|
2880
|
+
responseType: "upload";
|
|
2881
|
+
}): Promise<RezoUploadResponse>;
|
|
2882
|
+
get<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
2883
|
+
get<T = any>(url: string | URL, options?: RezoHttpGetRequest): Promise<RezoResponse<T>>;
|
|
2884
|
+
get<T = any>(url: string | URL, options: RezoHttpGetRequest & {
|
|
2885
|
+
responseType: "auto" | "json";
|
|
2886
|
+
}): Promise<RezoResponse<T>>;
|
|
2887
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2888
|
+
responseType: "stream";
|
|
2889
|
+
}): Promise<RezoStreamResponse>;
|
|
2890
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2891
|
+
responseType: "arrayBuffer";
|
|
2892
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
2893
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2894
|
+
responseType: "buffer";
|
|
2895
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
2896
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2897
|
+
responseType: "blob";
|
|
2898
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
2899
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2900
|
+
responseType: "text";
|
|
2901
|
+
}): Promise<RezoResponse<string>>;
|
|
2902
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2903
|
+
responseType: "download";
|
|
2904
|
+
}): Promise<RezoDownloadResponse>;
|
|
2905
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2906
|
+
fileName: string;
|
|
2907
|
+
}): Promise<RezoDownloadResponse>;
|
|
2908
|
+
get(url: string | URL, options: RezoHttpGetRequest & {
|
|
2909
|
+
saveTo: string;
|
|
2910
|
+
}): Promise<RezoDownloadResponse>;
|
|
2911
|
+
head(url: string | URL): Promise<RezoResponse<null>>;
|
|
2912
|
+
head(url: string | URL, options: RezoHttpHeadRequest): Promise<RezoResponse<null>>;
|
|
2913
|
+
options<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
2914
|
+
options<T = any>(url: string | URL, options: RezoHttpOptionsRequest): Promise<RezoResponse<T>>;
|
|
2915
|
+
trace<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
2916
|
+
trace<T = any>(url: string | URL, options: RezoHttpRequest): Promise<RezoResponse<T>>;
|
|
2917
|
+
delete<T = any>(url: string | URL, options?: RezoHttpDeleteRequest): Promise<RezoResponse<T>>;
|
|
2918
|
+
delete<T = any>(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2919
|
+
responseType: "auto" | "json";
|
|
2920
|
+
}): Promise<RezoResponse<T>>;
|
|
2921
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2922
|
+
responseType: "stream";
|
|
2923
|
+
}): Promise<RezoStreamResponse>;
|
|
2924
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2925
|
+
responseType: "arrayBuffer";
|
|
2926
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
2927
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2928
|
+
responseType: "buffer";
|
|
2929
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
2930
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2931
|
+
responseType: "blob";
|
|
2932
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
2933
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2934
|
+
responseType: "text";
|
|
2935
|
+
}): Promise<RezoResponse<string>>;
|
|
2936
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2937
|
+
responseType: "download";
|
|
2938
|
+
}): Promise<RezoDownloadResponse>;
|
|
2939
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2940
|
+
fileName: string;
|
|
2941
|
+
}): Promise<RezoDownloadResponse>;
|
|
2942
|
+
delete(url: string | URL, options: RezoHttpDeleteRequest & {
|
|
2943
|
+
saveTo: string;
|
|
2944
|
+
}): Promise<RezoDownloadResponse>;
|
|
2115
2945
|
}
|
|
2116
2946
|
/**
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2947
|
+
* Extended URLSearchParams that supports nested objects and arrays
|
|
2948
|
+
* for application/x-www-form-urlencoded encoding
|
|
2119
2949
|
*/
|
|
2120
|
-
|
|
2950
|
+
export type Primitive = string | number | boolean | null | undefined | Date;
|
|
2951
|
+
export type NestedValue = Primitive | NestedObject | NestedArray;
|
|
2952
|
+
export type NestedObject = {
|
|
2953
|
+
[key: string]: NestedValue;
|
|
2954
|
+
};
|
|
2955
|
+
export type NestedArray = NestedValue[];
|
|
2956
|
+
declare class RezoURLSearchParams extends URLSearchParams {
|
|
2957
|
+
constructor(init?: string | URLSearchParams | NestedObject | string[][] | RezoURLSearchParams);
|
|
2958
|
+
/**
|
|
2959
|
+
* Append a nested object to the search params
|
|
2960
|
+
*/
|
|
2961
|
+
appendObject(obj: NestedObject, prefix?: string): void;
|
|
2962
|
+
/**
|
|
2963
|
+
* Set a value (replacing existing values with the same key)
|
|
2964
|
+
*/
|
|
2965
|
+
setObject(obj: NestedObject, prefix?: string): void;
|
|
2966
|
+
/**
|
|
2967
|
+
* Append a value with proper handling for different types
|
|
2968
|
+
*/
|
|
2969
|
+
private appendValue;
|
|
2970
|
+
/**
|
|
2971
|
+
* Append an array with proper indexing
|
|
2972
|
+
*/
|
|
2973
|
+
private appendArray;
|
|
2974
|
+
/**
|
|
2975
|
+
* Convert to a plain object (useful for debugging)
|
|
2976
|
+
*/
|
|
2977
|
+
toObject(): Record<string, string>;
|
|
2978
|
+
/**
|
|
2979
|
+
* Create from a flat object with bracket notation keys
|
|
2980
|
+
*/
|
|
2981
|
+
static fromFlat(flat: Record<string, string>): RezoURLSearchParams;
|
|
2982
|
+
}
|
|
2983
|
+
export interface httpAdapterPostOverloads {
|
|
2984
|
+
post<T = any>(url: string | URL, data?: any): Promise<RezoResponse<T>>;
|
|
2985
|
+
post<T = any>(url: string | URL, data: any, options?: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
2986
|
+
post<T = any>(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
2987
|
+
responseType: "auto" | "json";
|
|
2988
|
+
}): Promise<RezoResponse<T>>;
|
|
2989
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
2990
|
+
responseType: "stream";
|
|
2991
|
+
}): Promise<RezoStreamResponse>;
|
|
2992
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
2993
|
+
responseType: "arrayBuffer";
|
|
2994
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
2995
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
2996
|
+
responseType: "buffer";
|
|
2997
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
2998
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
2999
|
+
responseType: "blob";
|
|
3000
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3001
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
3002
|
+
responseType: "text";
|
|
3003
|
+
}): Promise<RezoResponse<string>>;
|
|
3004
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
3005
|
+
responseType: "download";
|
|
3006
|
+
}): Promise<RezoDownloadResponse>;
|
|
3007
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
3008
|
+
fileName: string;
|
|
3009
|
+
}): Promise<RezoDownloadResponse>;
|
|
3010
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
3011
|
+
saveTo: string;
|
|
3012
|
+
}): Promise<RezoDownloadResponse>;
|
|
3013
|
+
post(url: string | URL, data: any, options: RezoHttpPostRequest & {
|
|
3014
|
+
responseType: "upload";
|
|
3015
|
+
}): Promise<RezoUploadResponse>;
|
|
3016
|
+
postJson<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3017
|
+
postJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>): Promise<RezoResponse<T>>;
|
|
3018
|
+
postJson<T = any>(url: string | URL, jsonString: string): Promise<RezoResponse<T>>;
|
|
3019
|
+
postJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3020
|
+
postJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3021
|
+
postJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3022
|
+
postJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3023
|
+
responseType: "auto" | "json";
|
|
3024
|
+
}): Promise<RezoResponse<T>>;
|
|
3025
|
+
postJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3026
|
+
responseType: "auto" | "json";
|
|
3027
|
+
}): Promise<RezoResponse<T>>;
|
|
3028
|
+
postJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3029
|
+
responseType: "auto" | "json";
|
|
3030
|
+
}): Promise<RezoResponse<T>>;
|
|
3031
|
+
postJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3032
|
+
responseType: "text";
|
|
3033
|
+
}): Promise<RezoResponse<string>>;
|
|
3034
|
+
postJson(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3035
|
+
responseType: "text";
|
|
3036
|
+
}): Promise<RezoResponse<string>>;
|
|
3037
|
+
postJson(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3038
|
+
responseType: "text";
|
|
3039
|
+
}): Promise<RezoResponse<string>>;
|
|
3040
|
+
postJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3041
|
+
responseType: "arrayBuffer";
|
|
3042
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3043
|
+
postJson(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3044
|
+
responseType: "arrayBuffer";
|
|
3045
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3046
|
+
postJson(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3047
|
+
responseType: "arrayBuffer";
|
|
3048
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3049
|
+
postJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3050
|
+
responseType: "buffer";
|
|
3051
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3052
|
+
postJson(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3053
|
+
responseType: "buffer";
|
|
3054
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3055
|
+
postJson(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3056
|
+
responseType: "buffer";
|
|
3057
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3058
|
+
postJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3059
|
+
responseType: "blob";
|
|
3060
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3061
|
+
postJson(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3062
|
+
responseType: "blob";
|
|
3063
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3064
|
+
postJson(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3065
|
+
responseType: "blob";
|
|
3066
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3067
|
+
postJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPostRequest & {
|
|
3068
|
+
responseType: "stream";
|
|
3069
|
+
}): Promise<RezoStreamResponse>;
|
|
3070
|
+
postJson(url: string | URL, jsonString: string, options: RezoHttpPostRequest & {
|
|
3071
|
+
responseType: "stream";
|
|
3072
|
+
}): Promise<RezoStreamResponse>;
|
|
3073
|
+
postJson(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3074
|
+
responseType: "stream";
|
|
3075
|
+
}): Promise<RezoStreamResponse>;
|
|
3076
|
+
postForm<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3077
|
+
postForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>): Promise<RezoResponse<T>>;
|
|
3078
|
+
postForm<T = any>(url: string | URL, string: string): Promise<RezoResponse<T>>;
|
|
3079
|
+
postForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3080
|
+
postForm<T = any>(url: string | URL, string: string, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3081
|
+
postForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3082
|
+
postForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3083
|
+
responseType: "auto" | "json";
|
|
3084
|
+
}): Promise<RezoResponse<T>>;
|
|
3085
|
+
postForm<T = any>(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3086
|
+
responseType: "auto" | "json";
|
|
3087
|
+
}): Promise<RezoResponse<T>>;
|
|
3088
|
+
postForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3089
|
+
responseType: "auto" | "json";
|
|
3090
|
+
}): Promise<RezoResponse<T>>;
|
|
3091
|
+
postForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3092
|
+
responseType: "text";
|
|
3093
|
+
}): Promise<RezoResponse<string>>;
|
|
3094
|
+
postForm(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3095
|
+
responseType: "text";
|
|
3096
|
+
}): Promise<RezoResponse<string>>;
|
|
3097
|
+
postForm(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3098
|
+
responseType: "text";
|
|
3099
|
+
}): Promise<RezoResponse<string>>;
|
|
3100
|
+
postForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3101
|
+
responseType: "arrayBuffer";
|
|
3102
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3103
|
+
postForm(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3104
|
+
responseType: "arrayBuffer";
|
|
3105
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3106
|
+
postForm(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3107
|
+
responseType: "arrayBuffer";
|
|
3108
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3109
|
+
postForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3110
|
+
responseType: "buffer";
|
|
3111
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3112
|
+
postForm(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3113
|
+
responseType: "buffer";
|
|
3114
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3115
|
+
postForm(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3116
|
+
responseType: "buffer";
|
|
3117
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3118
|
+
postForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3119
|
+
responseType: "blob";
|
|
3120
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3121
|
+
postForm(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3122
|
+
responseType: "blob";
|
|
3123
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3124
|
+
postForm(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3125
|
+
responseType: "blob";
|
|
3126
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3127
|
+
postForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPostRequest & {
|
|
3128
|
+
responseType: "stream";
|
|
3129
|
+
}): Promise<RezoStreamResponse>;
|
|
3130
|
+
postForm(url: string | URL, string: string, options: RezoHttpPostRequest & {
|
|
3131
|
+
responseType: "stream";
|
|
3132
|
+
}): Promise<RezoStreamResponse>;
|
|
3133
|
+
postForm(url: string | URL, nullData: null | undefined, options: RezoHttpPostRequest & {
|
|
3134
|
+
responseType: "stream";
|
|
3135
|
+
}): Promise<RezoStreamResponse>;
|
|
3136
|
+
postMultipart<T = any>(url: string | URL, formData: RezoFormData): Promise<RezoResponse<T>>;
|
|
3137
|
+
postMultipart<T = any>(url: string | URL, formData: FormData): Promise<RezoResponse<T>>;
|
|
3138
|
+
postMultipart<T = any>(url: string | URL, dataObject: Record<string, any>): Promise<RezoResponse<T>>;
|
|
3139
|
+
postMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3140
|
+
postMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3141
|
+
postMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest): Promise<RezoResponse<T>>;
|
|
3142
|
+
postMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3143
|
+
responseType: "auto";
|
|
3144
|
+
}): Promise<RezoResponse<T>>;
|
|
3145
|
+
postMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3146
|
+
responseType: "auto";
|
|
3147
|
+
}): Promise<RezoResponse<T>>;
|
|
3148
|
+
postMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3149
|
+
responseType: "auto";
|
|
3150
|
+
}): Promise<RezoResponse<T>>;
|
|
3151
|
+
postMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3152
|
+
responseType: "json";
|
|
3153
|
+
}): Promise<RezoResponse<T>>;
|
|
3154
|
+
postMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3155
|
+
responseType: "json";
|
|
3156
|
+
}): Promise<RezoResponse<T>>;
|
|
3157
|
+
postMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3158
|
+
responseType: "json";
|
|
3159
|
+
}): Promise<RezoResponse<T>>;
|
|
3160
|
+
postMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3161
|
+
responseType: "text";
|
|
3162
|
+
}): Promise<RezoResponse<string>>;
|
|
3163
|
+
postMultipart(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3164
|
+
responseType: "text";
|
|
3165
|
+
}): Promise<RezoResponse<string>>;
|
|
3166
|
+
postMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3167
|
+
responseType: "text";
|
|
3168
|
+
}): Promise<RezoResponse<string>>;
|
|
3169
|
+
postMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3170
|
+
responseType: "stream";
|
|
3171
|
+
}): Promise<RezoStreamResponse>;
|
|
3172
|
+
postMultipart(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3173
|
+
responseType: "stream";
|
|
3174
|
+
}): Promise<RezoStreamResponse>;
|
|
3175
|
+
postMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3176
|
+
responseType: "stream";
|
|
3177
|
+
}): Promise<RezoStreamResponse>;
|
|
3178
|
+
postMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3179
|
+
responseType: "arrayBuffer";
|
|
3180
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3181
|
+
postMultipart(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3182
|
+
responseType: "arrayBuffer";
|
|
3183
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3184
|
+
postMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3185
|
+
responseType: "arrayBuffer";
|
|
3186
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3187
|
+
postMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3188
|
+
responseType: "buffer";
|
|
3189
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3190
|
+
postMultipart(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3191
|
+
responseType: "buffer";
|
|
3192
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3193
|
+
postMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3194
|
+
responseType: "buffer";
|
|
3195
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3196
|
+
postMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPostRequest & {
|
|
3197
|
+
responseType: "blob";
|
|
3198
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3199
|
+
postMultipart(url: string | URL, formData: FormData, options: RezoHttpPostRequest & {
|
|
3200
|
+
responseType: "blob";
|
|
3201
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3202
|
+
postMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPostRequest & {
|
|
3203
|
+
responseType: "blob";
|
|
3204
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3205
|
+
}
|
|
3206
|
+
export interface httpAdapterPatchOverloads {
|
|
3207
|
+
patch<T = any>(url: string | URL, data?: any): Promise<RezoResponse<T>>;
|
|
3208
|
+
patch<T = any>(url: string | URL, data: any, options?: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3209
|
+
patch<T = any>(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3210
|
+
responseType: "auto" | "json";
|
|
3211
|
+
}): Promise<RezoResponse<T>>;
|
|
3212
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3213
|
+
responseType: "stream";
|
|
3214
|
+
}): RezoStreamResponse;
|
|
3215
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3216
|
+
responseType: "arrayBuffer";
|
|
3217
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3218
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3219
|
+
responseType: "buffer";
|
|
3220
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3221
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3222
|
+
responseType: "blob";
|
|
3223
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3224
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3225
|
+
responseType: "text";
|
|
3226
|
+
}): Promise<RezoResponse<string>>;
|
|
3227
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3228
|
+
responseType: "download";
|
|
3229
|
+
}): RezoDownloadResponse;
|
|
3230
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3231
|
+
fileName: string;
|
|
3232
|
+
}): RezoDownloadResponse;
|
|
3233
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3234
|
+
saveTo: string;
|
|
3235
|
+
}): RezoDownloadResponse;
|
|
3236
|
+
patch(url: string | URL, data: any, options: RezoHttpPatchRequest & {
|
|
3237
|
+
responseType: "upload";
|
|
3238
|
+
}): Promise<RezoUploadResponse>;
|
|
3239
|
+
patchJson<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3240
|
+
patchJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>): Promise<RezoResponse<T>>;
|
|
3241
|
+
patchJson<T = any>(url: string | URL, jsonString: string): Promise<RezoResponse<T>>;
|
|
3242
|
+
patchJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3243
|
+
patchJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3244
|
+
patchJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3245
|
+
patchJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3246
|
+
responseType: "auto" | "json";
|
|
3247
|
+
}): Promise<RezoResponse<T>>;
|
|
3248
|
+
patchJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3249
|
+
responseType: "auto" | "json";
|
|
3250
|
+
}): Promise<RezoResponse<T>>;
|
|
3251
|
+
patchJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3252
|
+
responseType: "auto" | "json";
|
|
3253
|
+
}): Promise<RezoResponse<T>>;
|
|
3254
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3255
|
+
responseType: "text";
|
|
3256
|
+
}): Promise<RezoResponse<string>>;
|
|
3257
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3258
|
+
responseType: "text";
|
|
3259
|
+
}): Promise<RezoResponse<string>>;
|
|
3260
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3261
|
+
responseType: "text";
|
|
3262
|
+
}): Promise<RezoResponse<string>>;
|
|
3263
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3264
|
+
responseType: "arrayBuffer";
|
|
3265
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3266
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3267
|
+
responseType: "arrayBuffer";
|
|
3268
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3269
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3270
|
+
responseType: "arrayBuffer";
|
|
3271
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3272
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3273
|
+
responseType: "buffer";
|
|
3274
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3275
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3276
|
+
responseType: "buffer";
|
|
3277
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3278
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3279
|
+
responseType: "buffer";
|
|
3280
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3281
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3282
|
+
responseType: "blob";
|
|
3283
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3284
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3285
|
+
responseType: "blob";
|
|
3286
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3287
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3288
|
+
responseType: "blob";
|
|
3289
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3290
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3291
|
+
responseType: "stream";
|
|
3292
|
+
}): RezoStreamResponse;
|
|
3293
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3294
|
+
responseType: "stream";
|
|
3295
|
+
}): RezoStreamResponse;
|
|
3296
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3297
|
+
responseType: "stream";
|
|
3298
|
+
}): RezoStreamResponse;
|
|
3299
|
+
patchJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPatchRequest & {
|
|
3300
|
+
responseType: "upload";
|
|
3301
|
+
}): Promise<RezoUploadResponse>;
|
|
3302
|
+
patchJson(url: string | URL, jsonString: string, options: RezoHttpPatchRequest & {
|
|
3303
|
+
responseType: "upload";
|
|
3304
|
+
}): Promise<RezoUploadResponse>;
|
|
3305
|
+
patchJson(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3306
|
+
responseType: "upload";
|
|
3307
|
+
}): Promise<RezoUploadResponse>;
|
|
3308
|
+
patchForm<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3309
|
+
patchForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>): Promise<RezoResponse<T>>;
|
|
3310
|
+
patchForm<T = any>(url: string | URL, string: string): Promise<RezoResponse<T>>;
|
|
3311
|
+
patchForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3312
|
+
patchForm<T = any>(url: string | URL, string: string, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3313
|
+
patchForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3314
|
+
patchForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3315
|
+
responseType: "auto" | "json";
|
|
3316
|
+
}): Promise<RezoResponse<T>>;
|
|
3317
|
+
patchForm<T = any>(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3318
|
+
responseType: "auto" | "json";
|
|
3319
|
+
}): Promise<RezoResponse<T>>;
|
|
3320
|
+
patchForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3321
|
+
responseType: "auto" | "json";
|
|
3322
|
+
}): Promise<RezoResponse<T>>;
|
|
3323
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3324
|
+
responseType: "text";
|
|
3325
|
+
}): Promise<RezoResponse<string>>;
|
|
3326
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3327
|
+
responseType: "text";
|
|
3328
|
+
}): Promise<RezoResponse<string>>;
|
|
3329
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3330
|
+
responseType: "text";
|
|
3331
|
+
}): Promise<RezoResponse<string>>;
|
|
3332
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3333
|
+
responseType: "arrayBuffer";
|
|
3334
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3335
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3336
|
+
responseType: "arrayBuffer";
|
|
3337
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3338
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3339
|
+
responseType: "arrayBuffer";
|
|
3340
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3341
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3342
|
+
responseType: "buffer";
|
|
3343
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3344
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3345
|
+
responseType: "buffer";
|
|
3346
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3347
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3348
|
+
responseType: "buffer";
|
|
3349
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3350
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3351
|
+
responseType: "blob";
|
|
3352
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3353
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3354
|
+
responseType: "blob";
|
|
3355
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3356
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3357
|
+
responseType: "blob";
|
|
3358
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3359
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3360
|
+
responseType: "stream";
|
|
3361
|
+
}): RezoStreamResponse;
|
|
3362
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3363
|
+
responseType: "stream";
|
|
3364
|
+
}): RezoStreamResponse;
|
|
3365
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3366
|
+
responseType: "stream";
|
|
3367
|
+
}): RezoStreamResponse;
|
|
3368
|
+
patchForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3369
|
+
responseType: "upload";
|
|
3370
|
+
}): Promise<RezoUploadResponse>;
|
|
3371
|
+
patchForm(url: string | URL, string: string, options: RezoHttpPatchRequest & {
|
|
3372
|
+
responseType: "upload";
|
|
3373
|
+
}): Promise<RezoUploadResponse>;
|
|
3374
|
+
patchForm(url: string | URL, nullData: null | undefined, options: RezoHttpPatchRequest & {
|
|
3375
|
+
responseType: "upload";
|
|
3376
|
+
}): Promise<RezoUploadResponse>;
|
|
3377
|
+
patchMultipart<T = any>(url: string | URL, formData: RezoFormData): Promise<RezoResponse<T>>;
|
|
3378
|
+
patchMultipart<T = any>(url: string | URL, formData: FormData): Promise<RezoResponse<T>>;
|
|
3379
|
+
patchMultipart<T = any>(url: string | URL, dataObject: Record<string, any>): Promise<RezoResponse<T>>;
|
|
3380
|
+
patchMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3381
|
+
patchMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3382
|
+
patchMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest): Promise<RezoResponse<T>>;
|
|
3383
|
+
patchMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3384
|
+
responseType: "auto" | "json";
|
|
3385
|
+
}): Promise<RezoResponse<T>>;
|
|
3386
|
+
patchMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3387
|
+
responseType: "auto" | "json";
|
|
3388
|
+
}): Promise<RezoResponse<T>>;
|
|
3389
|
+
patchMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3390
|
+
responseType: "auto" | "json";
|
|
3391
|
+
}): Promise<RezoResponse<T>>;
|
|
3392
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3393
|
+
responseType: "text";
|
|
3394
|
+
}): Promise<RezoResponse<string>>;
|
|
3395
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3396
|
+
responseType: "text";
|
|
3397
|
+
}): Promise<RezoResponse<string>>;
|
|
3398
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3399
|
+
responseType: "text";
|
|
3400
|
+
}): Promise<RezoResponse<string>>;
|
|
3401
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3402
|
+
responseType: "stream";
|
|
3403
|
+
}): RezoStreamResponse;
|
|
3404
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3405
|
+
responseType: "stream";
|
|
3406
|
+
}): RezoStreamResponse;
|
|
3407
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3408
|
+
responseType: "stream";
|
|
3409
|
+
}): RezoStreamResponse;
|
|
3410
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3411
|
+
responseType: "arrayBuffer";
|
|
3412
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3413
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3414
|
+
responseType: "arrayBuffer";
|
|
3415
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3416
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3417
|
+
responseType: "arrayBuffer";
|
|
3418
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3419
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3420
|
+
responseType: "buffer";
|
|
3421
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3422
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3423
|
+
responseType: "buffer";
|
|
3424
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3425
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3426
|
+
responseType: "buffer";
|
|
3427
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3428
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3429
|
+
responseType: "blob";
|
|
3430
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3431
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3432
|
+
responseType: "blob";
|
|
3433
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3434
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3435
|
+
responseType: "blob";
|
|
3436
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3437
|
+
patchMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPatchRequest & {
|
|
3438
|
+
responseType: "upload";
|
|
3439
|
+
}): Promise<RezoUploadResponse>;
|
|
3440
|
+
patchMultipart(url: string | URL, formData: FormData, options: RezoHttpPatchRequest & {
|
|
3441
|
+
responseType: "upload";
|
|
3442
|
+
}): Promise<RezoUploadResponse>;
|
|
3443
|
+
patchMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPatchRequest & {
|
|
3444
|
+
responseType: "upload";
|
|
3445
|
+
}): Promise<RezoUploadResponse>;
|
|
3446
|
+
}
|
|
3447
|
+
export interface httpAdapterPutOverloads {
|
|
3448
|
+
put<T = any>(url: string | URL, data?: any): Promise<RezoResponse<T>>;
|
|
3449
|
+
put<T = any>(url: string | URL, data: any, options?: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3450
|
+
put<T = any>(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3451
|
+
responseType: "auto" | "json";
|
|
3452
|
+
}): Promise<RezoResponse<T>>;
|
|
3453
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3454
|
+
responseType: "stream";
|
|
3455
|
+
}): RezoStreamResponse;
|
|
3456
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3457
|
+
responseType: "arrayBuffer";
|
|
3458
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3459
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3460
|
+
responseType: "buffer";
|
|
3461
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3462
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3463
|
+
responseType: "blob";
|
|
3464
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3465
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3466
|
+
responseType: "text";
|
|
3467
|
+
}): Promise<RezoResponse<string>>;
|
|
3468
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3469
|
+
responseType: "download";
|
|
3470
|
+
}): RezoDownloadResponse;
|
|
3471
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3472
|
+
fileName: string;
|
|
3473
|
+
}): RezoDownloadResponse;
|
|
3474
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3475
|
+
saveTo: string;
|
|
3476
|
+
}): RezoDownloadResponse;
|
|
3477
|
+
put(url: string | URL, data: any, options: RezoHttpPutRequest & {
|
|
3478
|
+
responseType: "upload";
|
|
3479
|
+
}): Promise<RezoUploadResponse>;
|
|
3480
|
+
putJson<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3481
|
+
putJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>): Promise<RezoResponse<T>>;
|
|
3482
|
+
putJson<T = any>(url: string | URL, jsonString: string): Promise<RezoResponse<T>>;
|
|
3483
|
+
putJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3484
|
+
putJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3485
|
+
putJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3486
|
+
putJson<T = any>(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3487
|
+
responseType: "auto" | "json";
|
|
3488
|
+
}): Promise<RezoResponse<T>>;
|
|
3489
|
+
putJson<T = any>(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3490
|
+
responseType: "auto" | "json";
|
|
3491
|
+
}): Promise<RezoResponse<T>>;
|
|
3492
|
+
putJson<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3493
|
+
responseType: "auto" | "json";
|
|
3494
|
+
}): Promise<RezoResponse<T>>;
|
|
3495
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3496
|
+
responseType: "text";
|
|
3497
|
+
}): Promise<RezoResponse<string>>;
|
|
3498
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3499
|
+
responseType: "text";
|
|
3500
|
+
}): Promise<RezoResponse<string>>;
|
|
3501
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3502
|
+
responseType: "text";
|
|
3503
|
+
}): Promise<RezoResponse<string>>;
|
|
3504
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3505
|
+
responseType: "arrayBuffer";
|
|
3506
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3507
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3508
|
+
responseType: "arrayBuffer";
|
|
3509
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3510
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3511
|
+
responseType: "arrayBuffer";
|
|
3512
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3513
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3514
|
+
responseType: "buffer";
|
|
3515
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3516
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3517
|
+
responseType: "buffer";
|
|
3518
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3519
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3520
|
+
responseType: "buffer";
|
|
3521
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3522
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3523
|
+
responseType: "blob";
|
|
3524
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3525
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3526
|
+
responseType: "blob";
|
|
3527
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3528
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3529
|
+
responseType: "blob";
|
|
3530
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3531
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3532
|
+
responseType: "stream";
|
|
3533
|
+
}): RezoStreamResponse;
|
|
3534
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3535
|
+
responseType: "stream";
|
|
3536
|
+
}): RezoStreamResponse;
|
|
3537
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3538
|
+
responseType: "stream";
|
|
3539
|
+
}): RezoStreamResponse;
|
|
3540
|
+
putJson(url: string | URL, data: Record<any, any> | Array<any>, options: RezoHttpPutRequest & {
|
|
3541
|
+
responseType: "upload";
|
|
3542
|
+
}): Promise<RezoUploadResponse>;
|
|
3543
|
+
putJson(url: string | URL, jsonString: string, options: RezoHttpPutRequest & {
|
|
3544
|
+
responseType: "upload";
|
|
3545
|
+
}): Promise<RezoUploadResponse>;
|
|
3546
|
+
putJson(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3547
|
+
responseType: "upload";
|
|
3548
|
+
}): Promise<RezoUploadResponse>;
|
|
3549
|
+
putForm<T = any>(url: string | URL): Promise<RezoResponse<T>>;
|
|
3550
|
+
putForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>): Promise<RezoResponse<T>>;
|
|
3551
|
+
putForm<T = any>(url: string | URL, string: string): Promise<RezoResponse<T>>;
|
|
3552
|
+
putForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3553
|
+
putForm<T = any>(url: string | URL, string: string, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3554
|
+
putForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3555
|
+
putForm<T = any>(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3556
|
+
responseType: "auto" | "json";
|
|
3557
|
+
}): Promise<RezoResponse<T>>;
|
|
3558
|
+
putForm<T = any>(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3559
|
+
responseType: "auto" | "json";
|
|
3560
|
+
}): Promise<RezoResponse<T>>;
|
|
3561
|
+
putForm<T = any>(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3562
|
+
responseType: "auto" | "json";
|
|
3563
|
+
}): Promise<RezoResponse<T>>;
|
|
3564
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3565
|
+
responseType: "text";
|
|
3566
|
+
}): Promise<RezoResponse<string>>;
|
|
3567
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3568
|
+
responseType: "text";
|
|
3569
|
+
}): Promise<RezoResponse<string>>;
|
|
3570
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3571
|
+
responseType: "text";
|
|
3572
|
+
}): Promise<RezoResponse<string>>;
|
|
3573
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3574
|
+
responseType: "arrayBuffer";
|
|
3575
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3576
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3577
|
+
responseType: "arrayBuffer";
|
|
3578
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3579
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3580
|
+
responseType: "arrayBuffer";
|
|
3581
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3582
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3583
|
+
responseType: "buffer";
|
|
3584
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3585
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3586
|
+
responseType: "buffer";
|
|
3587
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3588
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3589
|
+
responseType: "buffer";
|
|
3590
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3591
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3592
|
+
responseType: "blob";
|
|
3593
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3594
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3595
|
+
responseType: "blob";
|
|
3596
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3597
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3598
|
+
responseType: "blob";
|
|
3599
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3600
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3601
|
+
responseType: "stream";
|
|
3602
|
+
}): RezoStreamResponse;
|
|
3603
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3604
|
+
responseType: "stream";
|
|
3605
|
+
}): RezoStreamResponse;
|
|
3606
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3607
|
+
responseType: "stream";
|
|
3608
|
+
}): RezoStreamResponse;
|
|
3609
|
+
putForm(url: string | URL, data: URLSearchParams | RezoURLSearchParams | Record<string, any>, options: RezoHttpPutRequest & {
|
|
3610
|
+
responseType: "upload";
|
|
3611
|
+
}): Promise<RezoUploadResponse>;
|
|
3612
|
+
putForm(url: string | URL, string: string, options: RezoHttpPutRequest & {
|
|
3613
|
+
responseType: "upload";
|
|
3614
|
+
}): Promise<RezoUploadResponse>;
|
|
3615
|
+
putForm(url: string | URL, nullData: null | undefined, options: RezoHttpPutRequest & {
|
|
3616
|
+
responseType: "upload";
|
|
3617
|
+
}): Promise<RezoUploadResponse>;
|
|
3618
|
+
putMultipart<T = any>(url: string | URL, formData: RezoFormData): Promise<RezoResponse<T>>;
|
|
3619
|
+
putMultipart<T = any>(url: string | URL, formData: FormData): Promise<RezoResponse<T>>;
|
|
3620
|
+
putMultipart<T = any>(url: string | URL, dataObject: Record<string, any>): Promise<RezoResponse<T>>;
|
|
3621
|
+
putMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3622
|
+
putMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3623
|
+
putMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest): Promise<RezoResponse<T>>;
|
|
3624
|
+
putMultipart<T = any>(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3625
|
+
responseType: "auto" | "json";
|
|
3626
|
+
}): Promise<RezoResponse<T>>;
|
|
3627
|
+
putMultipart<T = any>(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3628
|
+
responseType: "auto" | "json";
|
|
3629
|
+
}): Promise<RezoResponse<T>>;
|
|
3630
|
+
putMultipart<T = any>(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3631
|
+
responseType: "auto" | "json";
|
|
3632
|
+
}): Promise<RezoResponse<T>>;
|
|
3633
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3634
|
+
responseType: "text";
|
|
3635
|
+
}): Promise<RezoResponse<string>>;
|
|
3636
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3637
|
+
responseType: "text";
|
|
3638
|
+
}): Promise<RezoResponse<string>>;
|
|
3639
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3640
|
+
responseType: "text";
|
|
3641
|
+
}): Promise<RezoResponse<string>>;
|
|
3642
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3643
|
+
responseType: "stream";
|
|
3644
|
+
}): RezoStreamResponse;
|
|
3645
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3646
|
+
responseType: "stream";
|
|
3647
|
+
}): RezoStreamResponse;
|
|
3648
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3649
|
+
responseType: "stream";
|
|
3650
|
+
}): RezoStreamResponse;
|
|
3651
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3652
|
+
responseType: "arrayBuffer";
|
|
3653
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3654
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3655
|
+
responseType: "arrayBuffer";
|
|
3656
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3657
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3658
|
+
responseType: "arrayBuffer";
|
|
3659
|
+
}): Promise<RezoResponse<ArrayBuffer>>;
|
|
3660
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3661
|
+
responseType: "buffer";
|
|
3662
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3663
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3664
|
+
responseType: "buffer";
|
|
3665
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3666
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3667
|
+
responseType: "buffer";
|
|
3668
|
+
}): Promise<RezoResponse<Buffer>>;
|
|
3669
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3670
|
+
responseType: "blob";
|
|
3671
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3672
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3673
|
+
responseType: "blob";
|
|
3674
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3675
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3676
|
+
responseType: "blob";
|
|
3677
|
+
}): Promise<RezoResponse<Blob$1>>;
|
|
3678
|
+
putMultipart(url: string | URL, formData: RezoFormData, options: RezoHttpPutRequest & {
|
|
3679
|
+
responseType: "upload";
|
|
3680
|
+
}): Promise<RezoUploadResponse>;
|
|
3681
|
+
putMultipart(url: string | URL, formData: FormData, options: RezoHttpPutRequest & {
|
|
3682
|
+
responseType: "upload";
|
|
3683
|
+
}): Promise<RezoUploadResponse>;
|
|
3684
|
+
putMultipart(url: string | URL, dataObject: Record<string, any>, options: RezoHttpPutRequest & {
|
|
3685
|
+
responseType: "upload";
|
|
3686
|
+
}): Promise<RezoUploadResponse>;
|
|
3687
|
+
}
|
|
2121
3688
|
/**
|
|
2122
|
-
*
|
|
3689
|
+
* Adapter function type - all adapters must implement this signature
|
|
2123
3690
|
*/
|
|
2124
|
-
|
|
3691
|
+
export type AdapterFunction<T = any> = (options: RezoRequestConfig, defaultOptions: RezoDefaultOptions, jar: RezoCookieJar) => Promise<RezoResponse<T> | RezoStreamResponse | RezoDownloadResponse | RezoUploadResponse>;
|
|
2125
3692
|
/**
|
|
2126
|
-
*
|
|
2127
|
-
* All adapters implement this signature for consistent behavior.
|
|
3693
|
+
* Main Rezo class - Enterprise-grade HTTP client with advanced features
|
|
2128
3694
|
*/
|
|
2129
|
-
export
|
|
3695
|
+
export declare class Rezo {
|
|
3696
|
+
protected queue: PQueue | null;
|
|
3697
|
+
protected isQueueEnabled: boolean;
|
|
3698
|
+
defaults: RezoDefaultOptions;
|
|
3699
|
+
hooks: RezoHooks;
|
|
3700
|
+
private jar;
|
|
3701
|
+
/** Session ID persists across all requests from this instance */
|
|
3702
|
+
readonly sessionId: string;
|
|
3703
|
+
/** Response cache for caching HTTP responses */
|
|
3704
|
+
readonly responseCache?: ResponseCache;
|
|
3705
|
+
/** DNS cache for caching DNS lookups */
|
|
3706
|
+
readonly dnsCache?: DNSCache;
|
|
3707
|
+
/** The adapter function used for HTTP requests */
|
|
3708
|
+
private readonly adapter;
|
|
3709
|
+
/** Proxy manager for advanced proxy rotation and pool management */
|
|
3710
|
+
private readonly _proxyManager;
|
|
3711
|
+
constructor(config?: RezoDefaultOptions, adapter?: AdapterFunction);
|
|
3712
|
+
/**
|
|
3713
|
+
* Get the ProxyManager instance (if configured)
|
|
3714
|
+
* @returns ProxyManager instance or null
|
|
3715
|
+
*/
|
|
3716
|
+
get proxyManager(): ProxyManager | null;
|
|
3717
|
+
/**
|
|
3718
|
+
* Clear all caches (response and DNS)
|
|
3719
|
+
*/
|
|
3720
|
+
clearCache(): void;
|
|
3721
|
+
/**
|
|
3722
|
+
* Invalidate cached response for a specific URL
|
|
3723
|
+
*/
|
|
3724
|
+
invalidateCache(url: string, method?: string): void;
|
|
3725
|
+
/**
|
|
3726
|
+
* Get cache statistics
|
|
3727
|
+
*/
|
|
3728
|
+
getCacheStats(): {
|
|
3729
|
+
response?: {
|
|
3730
|
+
size: number;
|
|
3731
|
+
enabled: boolean;
|
|
3732
|
+
persistent: boolean;
|
|
3733
|
+
};
|
|
3734
|
+
dns?: {
|
|
3735
|
+
size: number;
|
|
3736
|
+
enabled: boolean;
|
|
3737
|
+
};
|
|
3738
|
+
};
|
|
3739
|
+
get: httpAdapterOverloads["get"];
|
|
3740
|
+
head: httpAdapterOverloads["head"];
|
|
3741
|
+
options: httpAdapterOverloads["options"];
|
|
3742
|
+
trace: httpAdapterOverloads["trace"];
|
|
3743
|
+
delete: httpAdapterOverloads["delete"];
|
|
3744
|
+
request: httpAdapterOverloads["request"];
|
|
3745
|
+
post: httpAdapterPostOverloads["post"];
|
|
3746
|
+
postJson: httpAdapterPostOverloads["postJson"];
|
|
3747
|
+
postForm: httpAdapterPostOverloads["postForm"];
|
|
3748
|
+
postMultipart: httpAdapterPostOverloads["postMultipart"];
|
|
3749
|
+
put: httpAdapterPutOverloads["put"];
|
|
3750
|
+
putJson: httpAdapterPutOverloads["putJson"];
|
|
3751
|
+
putForm: httpAdapterPutOverloads["putForm"];
|
|
3752
|
+
putMultipart: httpAdapterPutOverloads["putMultipart"];
|
|
3753
|
+
patch: httpAdapterPatchOverloads["patch"];
|
|
3754
|
+
patchJson: httpAdapterPatchOverloads["patchJson"];
|
|
3755
|
+
patchForm: httpAdapterPatchOverloads["patchForm"];
|
|
3756
|
+
patchMultipart: httpAdapterPatchOverloads["patchMultipart"];
|
|
3757
|
+
private executeRequest;
|
|
3758
|
+
private buildFullUrl;
|
|
3759
|
+
private isvalidJson;
|
|
3760
|
+
private __create;
|
|
3761
|
+
/** Get the cookie jar for this instance */
|
|
3762
|
+
get cookieJar(): RezoCookieJar;
|
|
3763
|
+
/**
|
|
3764
|
+
* Save cookies to file (if cookieFile is configured).
|
|
3765
|
+
* Can also specify a different path to save to.
|
|
3766
|
+
*/
|
|
3767
|
+
saveCookies(filePath?: string): void;
|
|
3768
|
+
/**
|
|
3769
|
+
* Stream a resource - returns immediately with StreamResponse
|
|
3770
|
+
* The response data is emitted via 'data' events.
|
|
3771
|
+
*
|
|
3772
|
+
* @param url - URL to stream from
|
|
3773
|
+
* @param options - Request options (optional)
|
|
3774
|
+
* @returns StreamResponse that emits 'data', 'end', 'error' events
|
|
3775
|
+
*
|
|
3776
|
+
* @example
|
|
3777
|
+
* ```typescript
|
|
3778
|
+
* const stream = rezo.stream('https://example.com/large-file');
|
|
3779
|
+
* stream.on('data', (chunk) => console.log('Received:', chunk.length, 'bytes'));
|
|
3780
|
+
* stream.on('end', () => console.log('Stream complete'));
|
|
3781
|
+
* stream.on('error', (err) => console.error('Error:', err));
|
|
3782
|
+
* ```
|
|
3783
|
+
*/
|
|
3784
|
+
stream(url: string | URL, options?: RezoHttpRequest): RezoStreamResponse;
|
|
3785
|
+
/**
|
|
3786
|
+
* Download a resource to a file - returns immediately with DownloadResponse
|
|
3787
|
+
* The download progress and completion are emitted via events.
|
|
3788
|
+
*
|
|
3789
|
+
* @param url - URL to download from
|
|
3790
|
+
* @param saveTo - File path to save the download to
|
|
3791
|
+
* @param options - Request options (optional)
|
|
3792
|
+
* @returns DownloadResponse that emits 'progress', 'complete', 'error' events
|
|
3793
|
+
*
|
|
3794
|
+
* @example
|
|
3795
|
+
* ```typescript
|
|
3796
|
+
* const download = rezo.download('https://example.com/file.zip', './downloads/file.zip');
|
|
3797
|
+
* download.on('progress', (p) => console.log(`${p.percent}% complete`));
|
|
3798
|
+
* download.on('complete', () => console.log('Download finished'));
|
|
3799
|
+
* download.on('error', (err) => console.error('Error:', err));
|
|
3800
|
+
* ```
|
|
3801
|
+
*/
|
|
3802
|
+
download(url: string | URL, saveTo: string, options?: RezoHttpRequest): RezoDownloadResponse;
|
|
3803
|
+
/**
|
|
3804
|
+
* Upload data with progress tracking - returns immediately with UploadResponse
|
|
3805
|
+
* The upload progress and completion are emitted via events.
|
|
3806
|
+
*
|
|
3807
|
+
* @param url - URL to upload to
|
|
3808
|
+
* @param data - Data to upload (Buffer, FormData, string, etc.)
|
|
3809
|
+
* @param options - Request options (optional)
|
|
3810
|
+
* @returns UploadResponse that emits 'progress', 'complete', 'error' events
|
|
3811
|
+
*
|
|
3812
|
+
* @example
|
|
3813
|
+
* ```typescript
|
|
3814
|
+
* const upload = rezo.upload('https://example.com/upload', fileBuffer);
|
|
3815
|
+
* upload.on('progress', (p) => console.log(`${p.percent}% uploaded`));
|
|
3816
|
+
* upload.on('complete', (response) => console.log('Upload finished:', response));
|
|
3817
|
+
* upload.on('error', (err) => console.error('Error:', err));
|
|
3818
|
+
* ```
|
|
3819
|
+
*/
|
|
3820
|
+
upload(url: string | URL, data: Buffer | FormData | RezoFormData | string | Record<string, any>, options?: RezoHttpRequest): RezoUploadResponse;
|
|
3821
|
+
}
|
|
3822
|
+
/**
|
|
3823
|
+
* Extended Rezo instance with Axios-compatible static helpers.
|
|
3824
|
+
* Provides drop-in replacement API surface for Axios users.
|
|
3825
|
+
*/
|
|
3826
|
+
export interface RezoInstance extends Rezo {
|
|
3827
|
+
/** Create a new Rezo instance with custom configuration */
|
|
3828
|
+
create(config?: RezoDefaultOptions): Rezo;
|
|
3829
|
+
/** Type guard to check if an error is a RezoError instance */
|
|
3830
|
+
isRezoError: typeof RezoError.isRezoError;
|
|
3831
|
+
/** Check if an error is a cancellation error */
|
|
3832
|
+
isCancel: (error: unknown) => boolean;
|
|
3833
|
+
/** Alias for RezoError (Axios compatibility) */
|
|
3834
|
+
Cancel: typeof RezoError;
|
|
3835
|
+
/** AbortController for request cancellation (Axios compatibility) */
|
|
3836
|
+
CancelToken: typeof AbortController;
|
|
3837
|
+
/** Promise.all wrapper (Axios compatibility) */
|
|
3838
|
+
all: typeof Promise.all;
|
|
3839
|
+
/** Spread array arguments to callback function (Axios compatibility) */
|
|
3840
|
+
spread: <T extends unknown[], R>(callback: (...args: T) => R) => (array: T) => R;
|
|
3841
|
+
}
|
|
3842
|
+
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
3843
|
+
export declare const Cancel: typeof RezoError;
|
|
3844
|
+
export declare const CancelToken: {
|
|
3845
|
+
new (): AbortController;
|
|
3846
|
+
prototype: AbortController;
|
|
3847
|
+
};
|
|
3848
|
+
export declare const isCancel: (error: unknown) => boolean;
|
|
3849
|
+
export declare const all: {
|
|
3850
|
+
<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
|
|
3851
|
+
<T extends readonly unknown[] | [
|
|
3852
|
+
]>(values: T): Promise<{
|
|
3853
|
+
-readonly [P in keyof T]: Awaited<T[P]>;
|
|
3854
|
+
}>;
|
|
3855
|
+
};
|
|
3856
|
+
export declare const spread: <T extends unknown[], R>(callback: (...args: T) => R) => (array: T) => R;
|
|
3857
|
+
export declare const VERSION: string;
|
|
3858
|
+
declare const rezo: RezoInstance;
|
|
2130
3859
|
|
|
2131
3860
|
export {
|
|
2132
|
-
|
|
2133
|
-
|
|
3861
|
+
ResponseType$1 as ResponseType,
|
|
3862
|
+
rezo as default,
|
|
2134
3863
|
};
|
|
2135
3864
|
|
|
2136
3865
|
export {};
|