rezo 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/curl.cjs +4 -2
- package/dist/adapters/curl.js +4 -2
- package/dist/adapters/entries/curl.d.ts +45 -0
- package/dist/adapters/entries/fetch.d.ts +45 -0
- package/dist/adapters/entries/http.d.ts +45 -0
- package/dist/adapters/entries/http2.d.ts +45 -0
- package/dist/adapters/entries/react-native.d.ts +45 -0
- package/dist/adapters/entries/xhr.d.ts +45 -0
- package/dist/adapters/fetch.cjs +90 -1
- package/dist/adapters/fetch.js +90 -1
- package/dist/adapters/http.cjs +1 -1
- package/dist/adapters/http.js +1 -1
- package/dist/adapters/http2.cjs +1 -1
- package/dist/adapters/http2.js +1 -1
- package/dist/adapters/index.cjs +6 -6
- package/dist/adapters/react-native.cjs +162 -3
- package/dist/adapters/react-native.js +162 -3
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +45 -0
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +45 -0
- package/dist/platform/browser.d.ts +45 -0
- package/dist/platform/bun.d.ts +45 -0
- package/dist/platform/deno.d.ts +45 -0
- package/dist/platform/node.d.ts +45 -0
- package/dist/platform/react-native.d.ts +45 -0
- package/dist/platform/worker.d.ts +45 -0
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/utils/cookies.cjs +39 -0
- package/dist/utils/cookies.js +39 -0
- package/dist/utils/http-config.cjs +16 -4
- package/dist/utils/http-config.js +16 -4
- package/package.json +1 -1
package/dist/adapters/curl.cjs
CHANGED
|
@@ -1158,9 +1158,11 @@ class CurlCommandBuilder {
|
|
|
1158
1158
|
case "oauth1":
|
|
1159
1159
|
case "aws4":
|
|
1160
1160
|
case "custom":
|
|
1161
|
-
if (auth.custom) {
|
|
1161
|
+
if (auth?.custom && typeof auth.custom === "object") {
|
|
1162
1162
|
for (const [key, value] of Object.entries(auth.custom)) {
|
|
1163
|
-
|
|
1163
|
+
if (key && value !== undefined) {
|
|
1164
|
+
this.addArg("-H", `${key}: ${value}`);
|
|
1165
|
+
}
|
|
1164
1166
|
}
|
|
1165
1167
|
}
|
|
1166
1168
|
break;
|
package/dist/adapters/curl.js
CHANGED
|
@@ -1158,9 +1158,11 @@ class CurlCommandBuilder {
|
|
|
1158
1158
|
case "oauth1":
|
|
1159
1159
|
case "aws4":
|
|
1160
1160
|
case "custom":
|
|
1161
|
-
if (auth.custom) {
|
|
1161
|
+
if (auth?.custom && typeof auth.custom === "object") {
|
|
1162
1162
|
for (const [key, value] of Object.entries(auth.custom)) {
|
|
1163
|
-
|
|
1163
|
+
if (key && value !== undefined) {
|
|
1164
|
+
this.addArg("-H", `${key}: ${value}`);
|
|
1165
|
+
}
|
|
1164
1166
|
}
|
|
1165
1167
|
}
|
|
1166
1168
|
break;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
|
@@ -205,6 +205,51 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
205
205
|
toArray(): Cookie[];
|
|
206
206
|
toSetCookies(): string[];
|
|
207
207
|
toSerializedCookies(): SerializedCookie[];
|
|
208
|
+
/**
|
|
209
|
+
* Get cookies for a request URL with proper browser-like matching.
|
|
210
|
+
* This method properly handles:
|
|
211
|
+
* - Domain matching (exact or parent domain)
|
|
212
|
+
* - Path matching (cookie path must be prefix of request path)
|
|
213
|
+
* - Secure flag (secure cookies only over HTTPS)
|
|
214
|
+
* - Expiry (expired cookies not returned)
|
|
215
|
+
*
|
|
216
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
217
|
+
* @returns Array of Cookie objects that should be sent with the request
|
|
218
|
+
*/
|
|
219
|
+
getCookiesForRequest(requestUrl: string | URL): Cookie[];
|
|
220
|
+
/**
|
|
221
|
+
* Get the Cookie header value for a request URL with proper browser-like matching.
|
|
222
|
+
* Returns cookies in the format: "key1=value1; key2=value2"
|
|
223
|
+
*
|
|
224
|
+
* This is the browser-accurate way to build the Cookie header, properly filtering
|
|
225
|
+
* cookies by domain, path, secure flag, and expiry.
|
|
226
|
+
*
|
|
227
|
+
* @param requestUrl - The full request URL including path (e.g., 'https://example.com/api/users')
|
|
228
|
+
* @returns Cookie header string in "key=value; key=value" format
|
|
229
|
+
*/
|
|
230
|
+
getCookieHeader(requestUrl: string | URL): string;
|
|
231
|
+
/**
|
|
232
|
+
* Debug method to show which cookies would be sent for a given URL.
|
|
233
|
+
* Useful for troubleshooting cookie matching issues.
|
|
234
|
+
*
|
|
235
|
+
* @param requestUrl - The full request URL including path
|
|
236
|
+
* @returns Object with matching cookies and the Cookie header that would be sent
|
|
237
|
+
*/
|
|
238
|
+
debugCookiesForRequest(requestUrl: string | URL): {
|
|
239
|
+
url: string;
|
|
240
|
+
matchingCookies: Array<{
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
domain: string;
|
|
244
|
+
path: string;
|
|
245
|
+
}>;
|
|
246
|
+
cookieHeader: string;
|
|
247
|
+
allCookies: Array<{
|
|
248
|
+
key: string;
|
|
249
|
+
domain: string;
|
|
250
|
+
path: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
208
253
|
setCookiesSync(setCookieArray: string[]): Cookies;
|
|
209
254
|
setCookiesSync(setCookieArray: string[], url: string): Cookies;
|
|
210
255
|
setCookiesSync(cookiesString: string): Cookies;
|
package/dist/adapters/fetch.cjs
CHANGED
|
@@ -28,6 +28,85 @@ const Environment = {
|
|
|
28
28
|
return typeof AbortController !== "undefined";
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
const debugLog = {
|
|
32
|
+
requestStart: (config, url, method) => {
|
|
33
|
+
if (config.debug) {
|
|
34
|
+
console.log(`
|
|
35
|
+
[Rezo Debug] ─────────────────────────────────────`);
|
|
36
|
+
console.log(`[Rezo Debug] ${method} ${url}`);
|
|
37
|
+
console.log(`[Rezo Debug] Request ID: ${config.requestId}`);
|
|
38
|
+
console.log(`[Rezo Debug] Adapter: fetch`);
|
|
39
|
+
if (config.originalRequest?.headers) {
|
|
40
|
+
const headers = config.originalRequest.headers instanceof RezoHeaders ? config.originalRequest.headers.toObject() : config.originalRequest.headers;
|
|
41
|
+
console.log(`[Rezo Debug] Request Headers:`, JSON.stringify(headers, null, 2));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (config.trackUrl) {
|
|
45
|
+
console.log(`[Rezo Track] → ${method} ${url}`);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
retry: (config, attempt, maxRetries, statusCode, delay) => {
|
|
49
|
+
if (config.debug) {
|
|
50
|
+
console.log(`[Rezo Debug] Retry ${attempt}/${maxRetries} after status ${statusCode}${delay > 0 ? ` (waiting ${delay}ms)` : ""}`);
|
|
51
|
+
}
|
|
52
|
+
if (config.trackUrl) {
|
|
53
|
+
console.log(`[Rezo Track] ⟳ Retry ${attempt}/${maxRetries} (status ${statusCode})`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
maxRetries: (config, maxRetries) => {
|
|
57
|
+
if (config.debug) {
|
|
58
|
+
console.log(`[Rezo Debug] Max retries (${maxRetries}) reached, throwing error`);
|
|
59
|
+
}
|
|
60
|
+
if (config.trackUrl) {
|
|
61
|
+
console.log(`[Rezo Track] ✗ Max retries reached`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
response: (config, status, statusText, duration) => {
|
|
65
|
+
if (config.debug) {
|
|
66
|
+
console.log(`[Rezo Debug] Response: ${status} ${statusText} (${duration.toFixed(2)}ms)`);
|
|
67
|
+
}
|
|
68
|
+
if (config.trackUrl) {
|
|
69
|
+
console.log(`[Rezo Track] ✓ ${status} ${statusText}`);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
responseHeaders: (config, headers) => {
|
|
73
|
+
if (config.debug) {
|
|
74
|
+
console.log(`[Rezo Debug] Response Headers:`, JSON.stringify(headers, null, 2));
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
cookies: (config, cookieCount) => {
|
|
78
|
+
if (config.debug && cookieCount > 0) {
|
|
79
|
+
console.log(`[Rezo Debug] Cookies received: ${cookieCount}`);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
timing: (config, timing) => {
|
|
83
|
+
if (config.debug) {
|
|
84
|
+
const parts = [];
|
|
85
|
+
if (timing.ttfb)
|
|
86
|
+
parts.push(`TTFB: ${timing.ttfb.toFixed(2)}ms`);
|
|
87
|
+
if (timing.total)
|
|
88
|
+
parts.push(`Total: ${timing.total.toFixed(2)}ms`);
|
|
89
|
+
if (parts.length > 0) {
|
|
90
|
+
console.log(`[Rezo Debug] Timing: ${parts.join(" | ")}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
complete: (config, url) => {
|
|
95
|
+
if (config.debug) {
|
|
96
|
+
console.log(`[Rezo Debug] Request complete: ${url}`);
|
|
97
|
+
console.log(`[Rezo Debug] ─────────────────────────────────────
|
|
98
|
+
`);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
error: (config, error) => {
|
|
102
|
+
if (config.debug) {
|
|
103
|
+
console.log(`[Rezo Debug] Error: ${error instanceof Error ? error.message : error}`);
|
|
104
|
+
}
|
|
105
|
+
if (config.trackUrl) {
|
|
106
|
+
console.log(`[Rezo Track] ✗ Error: ${error instanceof Error ? error.message : error}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
31
110
|
function updateTiming(config, timing, bodySize) {
|
|
32
111
|
const now = performance.now();
|
|
33
112
|
config.timing.domainLookupStart = config.timing.startTime;
|
|
@@ -183,7 +262,7 @@ async function parseCookiesFromHeaders(headers, url, config) {
|
|
|
183
262
|
} else {
|
|
184
263
|
acceptedCookies.push(...parsedCookies.array);
|
|
185
264
|
}
|
|
186
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
265
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
187
266
|
const jar = new RezoCookieJar;
|
|
188
267
|
jar.setCookiesSync(acceptedCookieStrings, url);
|
|
189
268
|
if (config?.enableCookieJar && config?.cookieJar) {
|
|
@@ -554,6 +633,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
554
633
|
} else if (config.transfer.requestSize === undefined) {
|
|
555
634
|
config.transfer.requestSize = 0;
|
|
556
635
|
}
|
|
636
|
+
debugLog.requestStart(config, url.href, fetchOptions.method?.toUpperCase() || "GET");
|
|
557
637
|
}
|
|
558
638
|
const reqHeaders = fetchOptions.headers instanceof RezoHeaders ? fetchOptions.headers.toObject() : fetchOptions.headers || {};
|
|
559
639
|
const headers = toFetchHeaders(reqHeaders);
|
|
@@ -722,6 +802,14 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
722
802
|
config.statusText = statusText;
|
|
723
803
|
_stats.statusOnNext = status >= 400 ? "error" : "success";
|
|
724
804
|
const mergedCookies = mergeRequestAndResponseCookies(config, cookies, url.href);
|
|
805
|
+
const duration = performance.now() - timing.startTime;
|
|
806
|
+
debugLog.response(config, status, statusText, duration);
|
|
807
|
+
debugLog.responseHeaders(config, responseHeaders.toObject());
|
|
808
|
+
debugLog.cookies(config, mergedCookies.array.length);
|
|
809
|
+
debugLog.timing(config, {
|
|
810
|
+
ttfb: timing.firstByteTime ? timing.firstByteTime - timing.startTime : undefined,
|
|
811
|
+
total: duration
|
|
812
|
+
});
|
|
725
813
|
const finalResponse = {
|
|
726
814
|
data: responseData,
|
|
727
815
|
status,
|
|
@@ -805,6 +893,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
805
893
|
uploadResult.emit("done", uploadFinishEvent);
|
|
806
894
|
uploadResult._markFinished();
|
|
807
895
|
}
|
|
896
|
+
debugLog.complete(config, url.href);
|
|
808
897
|
return finalResponse;
|
|
809
898
|
} catch (error) {
|
|
810
899
|
_stats.statusOnNext = "error";
|
package/dist/adapters/fetch.js
CHANGED
|
@@ -28,6 +28,85 @@ const Environment = {
|
|
|
28
28
|
return typeof AbortController !== "undefined";
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
const debugLog = {
|
|
32
|
+
requestStart: (config, url, method) => {
|
|
33
|
+
if (config.debug) {
|
|
34
|
+
console.log(`
|
|
35
|
+
[Rezo Debug] ─────────────────────────────────────`);
|
|
36
|
+
console.log(`[Rezo Debug] ${method} ${url}`);
|
|
37
|
+
console.log(`[Rezo Debug] Request ID: ${config.requestId}`);
|
|
38
|
+
console.log(`[Rezo Debug] Adapter: fetch`);
|
|
39
|
+
if (config.originalRequest?.headers) {
|
|
40
|
+
const headers = config.originalRequest.headers instanceof RezoHeaders ? config.originalRequest.headers.toObject() : config.originalRequest.headers;
|
|
41
|
+
console.log(`[Rezo Debug] Request Headers:`, JSON.stringify(headers, null, 2));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (config.trackUrl) {
|
|
45
|
+
console.log(`[Rezo Track] → ${method} ${url}`);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
retry: (config, attempt, maxRetries, statusCode, delay) => {
|
|
49
|
+
if (config.debug) {
|
|
50
|
+
console.log(`[Rezo Debug] Retry ${attempt}/${maxRetries} after status ${statusCode}${delay > 0 ? ` (waiting ${delay}ms)` : ""}`);
|
|
51
|
+
}
|
|
52
|
+
if (config.trackUrl) {
|
|
53
|
+
console.log(`[Rezo Track] ⟳ Retry ${attempt}/${maxRetries} (status ${statusCode})`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
maxRetries: (config, maxRetries) => {
|
|
57
|
+
if (config.debug) {
|
|
58
|
+
console.log(`[Rezo Debug] Max retries (${maxRetries}) reached, throwing error`);
|
|
59
|
+
}
|
|
60
|
+
if (config.trackUrl) {
|
|
61
|
+
console.log(`[Rezo Track] ✗ Max retries reached`);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
response: (config, status, statusText, duration) => {
|
|
65
|
+
if (config.debug) {
|
|
66
|
+
console.log(`[Rezo Debug] Response: ${status} ${statusText} (${duration.toFixed(2)}ms)`);
|
|
67
|
+
}
|
|
68
|
+
if (config.trackUrl) {
|
|
69
|
+
console.log(`[Rezo Track] ✓ ${status} ${statusText}`);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
responseHeaders: (config, headers) => {
|
|
73
|
+
if (config.debug) {
|
|
74
|
+
console.log(`[Rezo Debug] Response Headers:`, JSON.stringify(headers, null, 2));
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
cookies: (config, cookieCount) => {
|
|
78
|
+
if (config.debug && cookieCount > 0) {
|
|
79
|
+
console.log(`[Rezo Debug] Cookies received: ${cookieCount}`);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
timing: (config, timing) => {
|
|
83
|
+
if (config.debug) {
|
|
84
|
+
const parts = [];
|
|
85
|
+
if (timing.ttfb)
|
|
86
|
+
parts.push(`TTFB: ${timing.ttfb.toFixed(2)}ms`);
|
|
87
|
+
if (timing.total)
|
|
88
|
+
parts.push(`Total: ${timing.total.toFixed(2)}ms`);
|
|
89
|
+
if (parts.length > 0) {
|
|
90
|
+
console.log(`[Rezo Debug] Timing: ${parts.join(" | ")}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
complete: (config, url) => {
|
|
95
|
+
if (config.debug) {
|
|
96
|
+
console.log(`[Rezo Debug] Request complete: ${url}`);
|
|
97
|
+
console.log(`[Rezo Debug] ─────────────────────────────────────
|
|
98
|
+
`);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
error: (config, error) => {
|
|
102
|
+
if (config.debug) {
|
|
103
|
+
console.log(`[Rezo Debug] Error: ${error instanceof Error ? error.message : error}`);
|
|
104
|
+
}
|
|
105
|
+
if (config.trackUrl) {
|
|
106
|
+
console.log(`[Rezo Track] ✗ Error: ${error instanceof Error ? error.message : error}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
31
110
|
function updateTiming(config, timing, bodySize) {
|
|
32
111
|
const now = performance.now();
|
|
33
112
|
config.timing.domainLookupStart = config.timing.startTime;
|
|
@@ -183,7 +262,7 @@ async function parseCookiesFromHeaders(headers, url, config) {
|
|
|
183
262
|
} else {
|
|
184
263
|
acceptedCookies.push(...parsedCookies.array);
|
|
185
264
|
}
|
|
186
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
265
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
187
266
|
const jar = new RezoCookieJar;
|
|
188
267
|
jar.setCookiesSync(acceptedCookieStrings, url);
|
|
189
268
|
if (config?.enableCookieJar && config?.cookieJar) {
|
|
@@ -554,6 +633,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
554
633
|
} else if (config.transfer.requestSize === undefined) {
|
|
555
634
|
config.transfer.requestSize = 0;
|
|
556
635
|
}
|
|
636
|
+
debugLog.requestStart(config, url.href, fetchOptions.method?.toUpperCase() || "GET");
|
|
557
637
|
}
|
|
558
638
|
const reqHeaders = fetchOptions.headers instanceof RezoHeaders ? fetchOptions.headers.toObject() : fetchOptions.headers || {};
|
|
559
639
|
const headers = toFetchHeaders(reqHeaders);
|
|
@@ -722,6 +802,14 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
722
802
|
config.statusText = statusText;
|
|
723
803
|
_stats.statusOnNext = status >= 400 ? "error" : "success";
|
|
724
804
|
const mergedCookies = mergeRequestAndResponseCookies(config, cookies, url.href);
|
|
805
|
+
const duration = performance.now() - timing.startTime;
|
|
806
|
+
debugLog.response(config, status, statusText, duration);
|
|
807
|
+
debugLog.responseHeaders(config, responseHeaders.toObject());
|
|
808
|
+
debugLog.cookies(config, mergedCookies.array.length);
|
|
809
|
+
debugLog.timing(config, {
|
|
810
|
+
ttfb: timing.firstByteTime ? timing.firstByteTime - timing.startTime : undefined,
|
|
811
|
+
total: duration
|
|
812
|
+
});
|
|
725
813
|
const finalResponse = {
|
|
726
814
|
data: responseData,
|
|
727
815
|
status,
|
|
@@ -805,6 +893,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
|
|
|
805
893
|
uploadResult.emit("done", uploadFinishEvent);
|
|
806
894
|
uploadResult._markFinished();
|
|
807
895
|
}
|
|
896
|
+
debugLog.complete(config, url.href);
|
|
808
897
|
return finalResponse;
|
|
809
898
|
} catch (error) {
|
|
810
899
|
_stats.statusOnNext = "error";
|
package/dist/adapters/http.cjs
CHANGED
|
@@ -1482,7 +1482,7 @@ async function updateCookies(config, headers, url) {
|
|
|
1482
1482
|
} else {
|
|
1483
1483
|
acceptedCookies.push(...parsedCookies.array);
|
|
1484
1484
|
}
|
|
1485
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
1485
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
1486
1486
|
if (config.enableCookieJar && config.cookieJar) {
|
|
1487
1487
|
config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
|
|
1488
1488
|
}
|
package/dist/adapters/http.js
CHANGED
|
@@ -1482,7 +1482,7 @@ async function updateCookies(config, headers, url) {
|
|
|
1482
1482
|
} else {
|
|
1483
1483
|
acceptedCookies.push(...parsedCookies.array);
|
|
1484
1484
|
}
|
|
1485
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
1485
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
1486
1486
|
if (config.enableCookieJar && config.cookieJar) {
|
|
1487
1487
|
config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
|
|
1488
1488
|
}
|
package/dist/adapters/http2.cjs
CHANGED
|
@@ -341,7 +341,7 @@ async function updateCookies(config, headers, url) {
|
|
|
341
341
|
} else {
|
|
342
342
|
acceptedCookies.push(...parsedCookies.array);
|
|
343
343
|
}
|
|
344
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
344
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
345
345
|
const jar = new RezoCookieJar;
|
|
346
346
|
jar.setCookiesSync(acceptedCookieStrings, url);
|
|
347
347
|
if (config.enableCookieJar && config.cookieJar) {
|
package/dist/adapters/http2.js
CHANGED
|
@@ -341,7 +341,7 @@ async function updateCookies(config, headers, url) {
|
|
|
341
341
|
} else {
|
|
342
342
|
acceptedCookies.push(...parsedCookies.array);
|
|
343
343
|
}
|
|
344
|
-
const acceptedCookieStrings = acceptedCookies.map((c) => c.
|
|
344
|
+
const acceptedCookieStrings = acceptedCookies.map((c) => c.toSetCookieString());
|
|
345
345
|
const jar = new RezoCookieJar;
|
|
346
346
|
jar.setCookiesSync(acceptedCookieStrings, url);
|
|
347
347
|
if (config.enableCookieJar && config.cookieJar) {
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.detectRuntime =
|
|
3
|
-
exports.getAdapterCapabilities =
|
|
4
|
-
exports.buildAdapterContext =
|
|
5
|
-
exports.getAvailableAdapters =
|
|
6
|
-
exports.selectAdapter =
|
|
1
|
+
const _mod_zvdk6z = require('./picker.cjs');
|
|
2
|
+
exports.detectRuntime = _mod_zvdk6z.detectRuntime;
|
|
3
|
+
exports.getAdapterCapabilities = _mod_zvdk6z.getAdapterCapabilities;
|
|
4
|
+
exports.buildAdapterContext = _mod_zvdk6z.buildAdapterContext;
|
|
5
|
+
exports.getAvailableAdapters = _mod_zvdk6z.getAvailableAdapters;
|
|
6
|
+
exports.selectAdapter = _mod_zvdk6z.selectAdapter;;
|