rezo 1.0.87 → 1.0.89
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 +64 -13
- package/dist/adapters/entries/fetch.d.ts +64 -13
- package/dist/adapters/entries/http.d.ts +64 -13
- package/dist/adapters/entries/http2.d.ts +64 -13
- package/dist/adapters/entries/react-native.d.ts +64 -13
- package/dist/adapters/entries/xhr.d.ts +64 -13
- 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 +18 -5
- package/dist/core/rezo.js +18 -5
- package/dist/crawler/index.cjs +42 -42
- package/dist/crawler/plugin/index.cjs +1 -1
- package/dist/crawler.d.ts +38 -2
- package/dist/entries/crawler.cjs +6 -6
- package/dist/index.cjs +31 -31
- package/dist/index.d.ts +64 -13
- package/dist/internal/agents/index.cjs +14 -14
- package/dist/platform/browser.d.ts +64 -13
- package/dist/platform/bun.d.ts +64 -13
- package/dist/platform/deno.d.ts +64 -13
- package/dist/platform/node.d.ts +64 -13
- package/dist/platform/react-native.d.ts +64 -13
- package/dist/platform/worker.d.ts +64 -13
- 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/queue/queue.cjs +31 -15
- package/dist/queue/queue.js +31 -15
- 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 +38 -2
- 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
|
|
@@ -2182,9 +2208,19 @@ declare class RezoQueue<T = any> {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
private insertByPriority;
|
|
2184
2210
|
/**
|
|
2185
|
-
* Try to run next task if capacity available
|
|
2211
|
+
* Try to run next task if capacity available.
|
|
2212
|
+
*
|
|
2213
|
+
* Like p-queue's #tryToStartAnother(), this method handles idle/empty
|
|
2214
|
+
* checks INSIDE itself — only after confirming there's nothing left to
|
|
2215
|
+
* dequeue. This prevents the false-idle race where idle fires while
|
|
2216
|
+
* tasks are still in the queue waiting to be shifted.
|
|
2186
2217
|
*/
|
|
2187
2218
|
private tryRunNext;
|
|
2219
|
+
/**
|
|
2220
|
+
* Clear the interval timer (called when queue empties).
|
|
2221
|
+
* The interval will be re-created when new tasks are added.
|
|
2222
|
+
*/
|
|
2223
|
+
private clearIntervalTimer;
|
|
2188
2224
|
/**
|
|
2189
2225
|
* Execute a task
|
|
2190
2226
|
*/
|
|
@@ -4997,10 +5033,11 @@ export declare class Rezo {
|
|
|
4997
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
4998
5034
|
}
|
|
4999
5035
|
/**
|
|
5000
|
-
*
|
|
5001
|
-
*
|
|
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.
|
|
5002
5039
|
*/
|
|
5003
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5004
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5005
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5006
5043
|
}
|
|
@@ -5010,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5010
5047
|
*/
|
|
5011
5048
|
export interface RezoCallable {
|
|
5012
5049
|
/**
|
|
5013
|
-
* 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`.
|
|
5014
5052
|
*
|
|
5015
5053
|
* @param url - The URL to request
|
|
5016
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5021,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5021
5059
|
* // Simple GET request
|
|
5022
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5023
5061
|
*
|
|
5024
|
-
* //
|
|
5025
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5026
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5027
|
-
* });
|
|
5028
|
-
*
|
|
5029
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5030
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5031
5064
|
* method: 'POST',
|
|
5032
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5033
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5034
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
|
+
* });
|
|
5035
5086
|
* ```
|
|
5036
5087
|
*/
|
|
5037
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5063,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5063
5114
|
*
|
|
5064
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5065
5116
|
*/
|
|
5066
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.89";
|
|
5067
5118
|
/**
|
|
5068
5119
|
* cURL Options Configuration
|
|
5069
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
|
|
@@ -2182,9 +2208,19 @@ declare class RezoQueue<T = any> {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
private insertByPriority;
|
|
2184
2210
|
/**
|
|
2185
|
-
* Try to run next task if capacity available
|
|
2211
|
+
* Try to run next task if capacity available.
|
|
2212
|
+
*
|
|
2213
|
+
* Like p-queue's #tryToStartAnother(), this method handles idle/empty
|
|
2214
|
+
* checks INSIDE itself — only after confirming there's nothing left to
|
|
2215
|
+
* dequeue. This prevents the false-idle race where idle fires while
|
|
2216
|
+
* tasks are still in the queue waiting to be shifted.
|
|
2186
2217
|
*/
|
|
2187
2218
|
private tryRunNext;
|
|
2219
|
+
/**
|
|
2220
|
+
* Clear the interval timer (called when queue empties).
|
|
2221
|
+
* The interval will be re-created when new tasks are added.
|
|
2222
|
+
*/
|
|
2223
|
+
private clearIntervalTimer;
|
|
2188
2224
|
/**
|
|
2189
2225
|
* Execute a task
|
|
2190
2226
|
*/
|
|
@@ -4997,10 +5033,11 @@ export declare class Rezo {
|
|
|
4997
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
4998
5034
|
}
|
|
4999
5035
|
/**
|
|
5000
|
-
*
|
|
5001
|
-
*
|
|
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.
|
|
5002
5039
|
*/
|
|
5003
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5004
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5005
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5006
5043
|
}
|
|
@@ -5010,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5010
5047
|
*/
|
|
5011
5048
|
export interface RezoCallable {
|
|
5012
5049
|
/**
|
|
5013
|
-
* 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`.
|
|
5014
5052
|
*
|
|
5015
5053
|
* @param url - The URL to request
|
|
5016
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5021,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5021
5059
|
* // Simple GET request
|
|
5022
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5023
5061
|
*
|
|
5024
|
-
* //
|
|
5025
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5026
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5027
|
-
* });
|
|
5028
|
-
*
|
|
5029
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5030
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5031
5064
|
* method: 'POST',
|
|
5032
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5033
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5034
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
|
+
* });
|
|
5035
5086
|
* ```
|
|
5036
5087
|
*/
|
|
5037
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5063,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5063
5114
|
*
|
|
5064
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5065
5116
|
*/
|
|
5066
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.89";
|
|
5067
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5068
5119
|
export declare const Cancel: typeof RezoError;
|
|
5069
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
|
|
@@ -2182,9 +2208,19 @@ declare class RezoQueue<T = any> {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
private insertByPriority;
|
|
2184
2210
|
/**
|
|
2185
|
-
* Try to run next task if capacity available
|
|
2211
|
+
* Try to run next task if capacity available.
|
|
2212
|
+
*
|
|
2213
|
+
* Like p-queue's #tryToStartAnother(), this method handles idle/empty
|
|
2214
|
+
* checks INSIDE itself — only after confirming there's nothing left to
|
|
2215
|
+
* dequeue. This prevents the false-idle race where idle fires while
|
|
2216
|
+
* tasks are still in the queue waiting to be shifted.
|
|
2186
2217
|
*/
|
|
2187
2218
|
private tryRunNext;
|
|
2219
|
+
/**
|
|
2220
|
+
* Clear the interval timer (called when queue empties).
|
|
2221
|
+
* The interval will be re-created when new tasks are added.
|
|
2222
|
+
*/
|
|
2223
|
+
private clearIntervalTimer;
|
|
2188
2224
|
/**
|
|
2189
2225
|
* Execute a task
|
|
2190
2226
|
*/
|
|
@@ -4997,10 +5033,11 @@ export declare class Rezo {
|
|
|
4997
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
4998
5034
|
}
|
|
4999
5035
|
/**
|
|
5000
|
-
*
|
|
5001
|
-
*
|
|
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.
|
|
5002
5039
|
*/
|
|
5003
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5004
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5005
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5006
5043
|
}
|
|
@@ -5010,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5010
5047
|
*/
|
|
5011
5048
|
export interface RezoCallable {
|
|
5012
5049
|
/**
|
|
5013
|
-
* 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`.
|
|
5014
5052
|
*
|
|
5015
5053
|
* @param url - The URL to request
|
|
5016
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5021,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5021
5059
|
* // Simple GET request
|
|
5022
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5023
5061
|
*
|
|
5024
|
-
* //
|
|
5025
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5026
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5027
|
-
* });
|
|
5028
|
-
*
|
|
5029
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5030
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5031
5064
|
* method: 'POST',
|
|
5032
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5033
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5034
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
|
+
* });
|
|
5035
5086
|
* ```
|
|
5036
5087
|
*/
|
|
5037
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5063,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5063
5114
|
*
|
|
5064
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5065
5116
|
*/
|
|
5066
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.89";
|
|
5067
5118
|
/**
|
|
5068
5119
|
* Type guard to check if an error is a RezoError instance.
|
|
5069
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
|
|
@@ -2182,9 +2208,19 @@ declare class RezoQueue<T = any> {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
private insertByPriority;
|
|
2184
2210
|
/**
|
|
2185
|
-
* Try to run next task if capacity available
|
|
2211
|
+
* Try to run next task if capacity available.
|
|
2212
|
+
*
|
|
2213
|
+
* Like p-queue's #tryToStartAnother(), this method handles idle/empty
|
|
2214
|
+
* checks INSIDE itself — only after confirming there's nothing left to
|
|
2215
|
+
* dequeue. This prevents the false-idle race where idle fires while
|
|
2216
|
+
* tasks are still in the queue waiting to be shifted.
|
|
2186
2217
|
*/
|
|
2187
2218
|
private tryRunNext;
|
|
2219
|
+
/**
|
|
2220
|
+
* Clear the interval timer (called when queue empties).
|
|
2221
|
+
* The interval will be re-created when new tasks are added.
|
|
2222
|
+
*/
|
|
2223
|
+
private clearIntervalTimer;
|
|
2188
2224
|
/**
|
|
2189
2225
|
* Execute a task
|
|
2190
2226
|
*/
|
|
@@ -4997,10 +5033,11 @@ export declare class Rezo {
|
|
|
4997
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
4998
5034
|
}
|
|
4999
5035
|
/**
|
|
5000
|
-
*
|
|
5001
|
-
*
|
|
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.
|
|
5002
5039
|
*/
|
|
5003
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5004
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5005
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5006
5043
|
}
|
|
@@ -5010,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5010
5047
|
*/
|
|
5011
5048
|
export interface RezoCallable {
|
|
5012
5049
|
/**
|
|
5013
|
-
* 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`.
|
|
5014
5052
|
*
|
|
5015
5053
|
* @param url - The URL to request
|
|
5016
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5021,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5021
5059
|
* // Simple GET request
|
|
5022
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5023
5061
|
*
|
|
5024
|
-
* //
|
|
5025
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5026
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5027
|
-
* });
|
|
5028
|
-
*
|
|
5029
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5030
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5031
5064
|
* method: 'POST',
|
|
5032
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5033
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5034
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
|
+
* });
|
|
5035
5086
|
* ```
|
|
5036
5087
|
*/
|
|
5037
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5063,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5063
5114
|
*
|
|
5064
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5065
5116
|
*/
|
|
5066
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.89";
|
|
5067
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5068
5119
|
export declare const Cancel: typeof RezoError;
|
|
5069
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
|
|
@@ -2182,9 +2208,19 @@ declare class RezoQueue<T = any> {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
private insertByPriority;
|
|
2184
2210
|
/**
|
|
2185
|
-
* Try to run next task if capacity available
|
|
2211
|
+
* Try to run next task if capacity available.
|
|
2212
|
+
*
|
|
2213
|
+
* Like p-queue's #tryToStartAnother(), this method handles idle/empty
|
|
2214
|
+
* checks INSIDE itself — only after confirming there's nothing left to
|
|
2215
|
+
* dequeue. This prevents the false-idle race where idle fires while
|
|
2216
|
+
* tasks are still in the queue waiting to be shifted.
|
|
2186
2217
|
*/
|
|
2187
2218
|
private tryRunNext;
|
|
2219
|
+
/**
|
|
2220
|
+
* Clear the interval timer (called when queue empties).
|
|
2221
|
+
* The interval will be re-created when new tasks are added.
|
|
2222
|
+
*/
|
|
2223
|
+
private clearIntervalTimer;
|
|
2188
2224
|
/**
|
|
2189
2225
|
* Execute a task
|
|
2190
2226
|
*/
|
|
@@ -4997,10 +5033,11 @@ export declare class Rezo {
|
|
|
4997
5033
|
static fromCurl(curlCommand: string): RezoRequestOptions;
|
|
4998
5034
|
}
|
|
4999
5035
|
/**
|
|
5000
|
-
*
|
|
5001
|
-
*
|
|
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.
|
|
5002
5039
|
*/
|
|
5003
|
-
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "
|
|
5040
|
+
export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "method" | "fullUrl"> {
|
|
5004
5041
|
/** HTTP method (GET, POST, PUT, DELETE, etc.) - defaults to GET */
|
|
5005
5042
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
|
|
5006
5043
|
}
|
|
@@ -5010,7 +5047,8 @@ export interface FetchRequestInit extends Omit<RezoRequestConfig, "url" | "metho
|
|
|
5010
5047
|
*/
|
|
5011
5048
|
export interface RezoCallable {
|
|
5012
5049
|
/**
|
|
5013
|
-
* 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`.
|
|
5014
5052
|
*
|
|
5015
5053
|
* @param url - The URL to request
|
|
5016
5054
|
* @param options - Request options (method defaults to GET)
|
|
@@ -5021,17 +5059,30 @@ export interface RezoCallable {
|
|
|
5021
5059
|
* // Simple GET request
|
|
5022
5060
|
* const response = await rezo('https://api.example.com/data');
|
|
5023
5061
|
*
|
|
5024
|
-
* //
|
|
5025
|
-
* const response = await rezo('https://api.example.com/data', {
|
|
5026
|
-
* headers: { 'Authorization': 'Bearer token' }
|
|
5027
|
-
* });
|
|
5028
|
-
*
|
|
5029
|
-
* // POST request with body
|
|
5062
|
+
* // POST with JSON body (Fetch API style)
|
|
5030
5063
|
* const response = await rezo('https://api.example.com/users', {
|
|
5031
5064
|
* method: 'POST',
|
|
5032
5065
|
* headers: { 'Content-Type': 'application/json' },
|
|
5033
5066
|
* body: JSON.stringify({ name: 'John' })
|
|
5034
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
|
+
* });
|
|
5035
5086
|
* ```
|
|
5036
5087
|
*/
|
|
5037
5088
|
<T = any>(url: string | URL, options?: FetchRequestInit): Promise<RezoResponse<T>>;
|
|
@@ -5063,7 +5114,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5063
5114
|
*
|
|
5064
5115
|
* IMPORTANT: Update these values when bumping package version.
|
|
5065
5116
|
*/
|
|
5066
|
-
export declare const VERSION = "1.0.
|
|
5117
|
+
export declare const VERSION = "1.0.89";
|
|
5067
5118
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5068
5119
|
export declare const Cancel: typeof RezoError;
|
|
5069
5120
|
export declare const CancelToken: {
|