rezo 1.0.88 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/entries/curl.d.ts +53 -12
- package/dist/adapters/entries/fetch.d.ts +53 -12
- package/dist/adapters/entries/http.d.ts +53 -12
- package/dist/adapters/entries/http2.d.ts +53 -12
- package/dist/adapters/entries/react-native.d.ts +53 -12
- package/dist/adapters/entries/xhr.d.ts +53 -12
- package/dist/adapters/fetch.cjs +62 -0
- package/dist/adapters/fetch.js +62 -0
- package/dist/adapters/http.cjs +64 -0
- package/dist/adapters/http.js +64 -0
- package/dist/adapters/http2.cjs +17 -0
- package/dist/adapters/http2.js +17 -0
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +9 -9
- package/dist/core/rezo.cjs +21 -5
- package/dist/core/rezo.js +21 -5
- package/dist/crawler/index.cjs +42 -42
- package/dist/crawler/plugin/index.cjs +1 -1
- package/dist/crawler.d.ts +27 -1
- package/dist/entries/crawler.cjs +6 -6
- package/dist/index.cjs +31 -31
- package/dist/index.d.ts +53 -12
- package/dist/internal/agents/index.cjs +14 -14
- package/dist/platform/browser.d.ts +53 -12
- package/dist/platform/bun.d.ts +53 -12
- package/dist/platform/deno.d.ts +53 -12
- package/dist/platform/node.d.ts +53 -12
- package/dist/platform/react-native.d.ts +53 -12
- package/dist/platform/worker.d.ts +53 -12
- package/dist/proxy/index.cjs +4 -4
- package/dist/proxy/manager.cjs +11 -0
- package/dist/proxy/manager.js +11 -0
- package/dist/queue/index.cjs +9 -9
- package/dist/responses/buildResponse.cjs +18 -1
- package/dist/responses/buildResponse.js +18 -1
- package/dist/responses/universal/index.cjs +11 -11
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/wget/index.cjs +51 -51
- package/dist/wget/index.d.ts +27 -1
- package/package.json +1 -1
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
/**
|
|
5078
5119
|
* cURL Options Configuration
|
|
5079
5120
|
*
|
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5078
5119
|
export declare const Cancel: typeof RezoError;
|
|
5079
5120
|
export declare const CancelToken: {
|
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
/**
|
|
5078
5119
|
* Type guard to check if an error is a RezoError instance.
|
|
5079
5120
|
*/
|
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5078
5119
|
export declare const Cancel: typeof RezoError;
|
|
5079
5120
|
export declare const CancelToken: {
|
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5078
5119
|
export declare const Cancel: typeof RezoError;
|
|
5079
5120
|
export declare const CancelToken: {
|
|
@@ -1364,11 +1364,37 @@ export type InitHook = (plainOptions: Partial<RezoRequestConfig>, options: RezoR
|
|
|
1364
1364
|
* Can return early with a Response to bypass actual request
|
|
1365
1365
|
*/
|
|
1366
1366
|
export type BeforeRequestHook = (config: RezoConfig, context: BeforeRequestContext) => void | Response | Promise<void | Response>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Context provided to beforeRedirect hook
|
|
1369
|
+
* Contains full request and redirect details
|
|
1370
|
+
*/
|
|
1371
|
+
export interface BeforeRedirectContext {
|
|
1372
|
+
/** The URL being redirected to */
|
|
1373
|
+
redirectUrl: URL;
|
|
1374
|
+
/** The URL being redirected from */
|
|
1375
|
+
fromUrl: string;
|
|
1376
|
+
/** HTTP status code that triggered the redirect (301, 302, 303, 307, 308) */
|
|
1377
|
+
status: number;
|
|
1378
|
+
/** Response headers from the redirect response */
|
|
1379
|
+
headers: RezoHeaders;
|
|
1380
|
+
/** Whether the redirect stays on the same domain */
|
|
1381
|
+
sameDomain: boolean;
|
|
1382
|
+
/** HTTP method of the current request */
|
|
1383
|
+
method: string;
|
|
1384
|
+
/** The original request body */
|
|
1385
|
+
body?: any;
|
|
1386
|
+
/** The full request configuration */
|
|
1387
|
+
request: RezoRequestConfig;
|
|
1388
|
+
/** Number of redirects followed so far */
|
|
1389
|
+
redirectCount: number;
|
|
1390
|
+
/** Timestamp */
|
|
1391
|
+
timestamp: number;
|
|
1392
|
+
}
|
|
1367
1393
|
/**
|
|
1368
1394
|
* Hook called before following a redirect
|
|
1369
1395
|
* Use to inspect/modify redirect behavior
|
|
1370
1396
|
*/
|
|
1371
|
-
export type BeforeRedirectHook = (config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1397
|
+
export type BeforeRedirectHook = (context: BeforeRedirectContext, config: RezoConfig, response: RezoResponse) => void | Promise<void>;
|
|
1372
1398
|
/**
|
|
1373
1399
|
* Hook called before a retry attempt
|
|
1374
1400
|
* Use for custom backoff logic, logging
|
|
@@ -5007,10 +5033,11 @@ export declare class Rezo {
|
|
|
5007
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
5008
5034
|
}
|
|
5009
5035
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*
|
|
5036
|
+
* Request options for the callable rezo(url, options) form.
|
|
5037
|
+
* Fetch API compatible + supports all Rezo-specific options (json, form, formData, multipart, responseType).
|
|
5038
|
+
* Automatically routes to the correct HTTP method handler.
|
|
5012
5039
|
*/
|
|
5013
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5014
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5015
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5016
5043
|
}
|
|
@@ -5020,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5020
5047
|
*/
|
|
5021
5048
|
export interface RezoCallable {
|
|
5022
5049
|
/**
|
|
5023
|
-
* Make an HTTP request
|
|
5050
|
+
* Make an HTTP request. Fetch API compatible with full Rezo features.
|
|
5051
|
+
* Automatically routes to the correct method handler based on `options.method`.
|
|
5024
5052
|
*
|
|
5025
5053
|
* @param url - The URL to request
|
|
5026
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5031,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5031
5059
|
* // Simple GET request
|
|
5032
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5033
5061
|
*
|
|
5034
|
-
* //
|
|
5035
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5036
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5037
|
-
* });
|
|
5038
|
-
*
|
|
5039
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5040
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5041
5064
|
* method: 'POST',
|
|
5042
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5043
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5044
5067
|
* });
|
|
5068
|
+
*
|
|
5069
|
+
* // POST with Rezo json shorthand
|
|
5070
|
+
* const response = await rezo('https://api.example.com/users', {
|
|
5071
|
+
* method: 'POST',
|
|
5072
|
+
* json: { name: 'John' }
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // POST form data
|
|
5076
|
+
* const response = await rezo('https://api.example.com/login', {
|
|
5077
|
+
* method: 'POST',
|
|
5078
|
+
* form: { username: 'john', password: 'secret' }
|
|
5079
|
+
* });
|
|
5080
|
+
*
|
|
5081
|
+
* // POST multipart
|
|
5082
|
+
* const response = await rezo('https://api.example.com/upload', {
|
|
5083
|
+
* method: 'POST',
|
|
5084
|
+
* formData: { file: buffer, name: 'photo.jpg' }
|
|
5085
|
+
* });
|
|
5045
5086
|
* ```
|
|
5046
5087
|
*/
|
|
5047
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5073,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5073
5114
|
*
|
|
5074
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5075
5116
|
*/
|
|
5076
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.90";
|
|
5077
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5078
5119
|
export declare const Cancel: typeof RezoError;
|
|
5079
5120
|
export declare const CancelToken: {
|