rezo 1.0.11 → 1.0.12
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 +66 -1
- package/dist/adapters/entries/fetch.d.ts +66 -1
- package/dist/adapters/entries/http.d.ts +66 -1
- package/dist/adapters/entries/http2.d.ts +66 -1
- package/dist/adapters/entries/react-native.d.ts +66 -1
- package/dist/adapters/entries/xhr.d.ts +66 -1
- package/dist/adapters/http.cjs +8 -2
- package/dist/adapters/http.js +8 -2
- package/dist/adapters/http2.cjs +4 -0
- package/dist/adapters/http2.js +4 -0
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/crawler.d.ts +66 -1
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +66 -1
- package/dist/platform/browser.d.ts +66 -1
- package/dist/platform/bun.d.ts +66 -1
- package/dist/platform/deno.d.ts +66 -1
- package/dist/platform/node.d.ts +66 -1
- package/dist/platform/react-native.d.ts +66 -1
- package/dist/platform/worker.d.ts +66 -1
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/buildResponse.cjs +28 -3
- package/dist/responses/buildResponse.js +28 -3
- package/dist/utils/http-config.cjs +8 -1
- package/dist/utils/http-config.js +8 -1
- package/package.json +1 -1
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_ipfe1q = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_ipfe1q.RezoQueue;;
|
|
3
|
+
const _mod_sc99zf = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_sc99zf.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_sc99zf.extractDomain;;
|
|
6
|
+
const _mod_4akyyt = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_4akyyt.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_4akyyt.HttpMethodPriority;;
|
|
@@ -297,11 +297,36 @@ function buildResponse(params) {
|
|
|
297
297
|
const rezoHeaders = new RezoHeaders(headers);
|
|
298
298
|
rezoHeaders.delete("set-cookie");
|
|
299
299
|
let cookieData;
|
|
300
|
+
const mergedCookiesArray = [];
|
|
301
|
+
const cookieKeyDomainMap = new Map;
|
|
302
|
+
if (config.requestCookies && config.requestCookies.length > 0) {
|
|
303
|
+
for (const cookie of config.requestCookies) {
|
|
304
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
305
|
+
mergedCookiesArray.push(cookie);
|
|
306
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
let responseCookiesArray = [];
|
|
300
310
|
if (config.responseCookies && config.responseCookies.array && config.responseCookies.array.length > 0) {
|
|
301
|
-
|
|
311
|
+
responseCookiesArray = config.responseCookies.array;
|
|
302
312
|
} else if (cookies.length > 0) {
|
|
303
|
-
const
|
|
304
|
-
|
|
313
|
+
const tempJar = new RezoCookieJar;
|
|
314
|
+
const parsed = tempJar.setCookiesSync(cookies, url);
|
|
315
|
+
responseCookiesArray = parsed.array;
|
|
316
|
+
}
|
|
317
|
+
for (const cookie of responseCookiesArray) {
|
|
318
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
319
|
+
const existingIndex = cookieKeyDomainMap.get(key);
|
|
320
|
+
if (existingIndex !== undefined) {
|
|
321
|
+
mergedCookiesArray[existingIndex] = cookie;
|
|
322
|
+
} else {
|
|
323
|
+
mergedCookiesArray.push(cookie);
|
|
324
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (mergedCookiesArray.length > 0) {
|
|
328
|
+
const mergedJar = new RezoCookieJar(mergedCookiesArray, url);
|
|
329
|
+
cookieData = mergedJar.cookies();
|
|
305
330
|
} else {
|
|
306
331
|
cookieData = {
|
|
307
332
|
array: [],
|
|
@@ -297,11 +297,36 @@ export function buildResponse(params) {
|
|
|
297
297
|
const rezoHeaders = new RezoHeaders(headers);
|
|
298
298
|
rezoHeaders.delete("set-cookie");
|
|
299
299
|
let cookieData;
|
|
300
|
+
const mergedCookiesArray = [];
|
|
301
|
+
const cookieKeyDomainMap = new Map;
|
|
302
|
+
if (config.requestCookies && config.requestCookies.length > 0) {
|
|
303
|
+
for (const cookie of config.requestCookies) {
|
|
304
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
305
|
+
mergedCookiesArray.push(cookie);
|
|
306
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
let responseCookiesArray = [];
|
|
300
310
|
if (config.responseCookies && config.responseCookies.array && config.responseCookies.array.length > 0) {
|
|
301
|
-
|
|
311
|
+
responseCookiesArray = config.responseCookies.array;
|
|
302
312
|
} else if (cookies.length > 0) {
|
|
303
|
-
const
|
|
304
|
-
|
|
313
|
+
const tempJar = new RezoCookieJar;
|
|
314
|
+
const parsed = tempJar.setCookiesSync(cookies, url);
|
|
315
|
+
responseCookiesArray = parsed.array;
|
|
316
|
+
}
|
|
317
|
+
for (const cookie of responseCookiesArray) {
|
|
318
|
+
const key = `${cookie.key}|${cookie.domain || ""}`;
|
|
319
|
+
const existingIndex = cookieKeyDomainMap.get(key);
|
|
320
|
+
if (existingIndex !== undefined) {
|
|
321
|
+
mergedCookiesArray[existingIndex] = cookie;
|
|
322
|
+
} else {
|
|
323
|
+
mergedCookiesArray.push(cookie);
|
|
324
|
+
cookieKeyDomainMap.set(key, mergedCookiesArray.length - 1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (mergedCookiesArray.length > 0) {
|
|
328
|
+
const mergedJar = new RezoCookieJar(mergedCookiesArray, url);
|
|
329
|
+
cookieData = mergedJar.cookies();
|
|
305
330
|
} else {
|
|
306
331
|
cookieData = {
|
|
307
332
|
array: [],
|
|
@@ -170,7 +170,11 @@ function setSignal() {
|
|
|
170
170
|
clearTimeout(this.timeoutClearInstanse);
|
|
171
171
|
if (this.timeout && typeof this.timeout === "number" && this.timeout > 100) {
|
|
172
172
|
const controller = new AbortController;
|
|
173
|
-
|
|
173
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
174
|
+
if (typeof timer === "object" && "unref" in timer) {
|
|
175
|
+
timer.unref();
|
|
176
|
+
}
|
|
177
|
+
this.timeoutClearInstanse = timer;
|
|
174
178
|
this.signal = controller.signal;
|
|
175
179
|
}
|
|
176
180
|
}
|
|
@@ -285,6 +289,9 @@ function prepareHTTPOptions(options, jar, addedOptions, config) {
|
|
|
285
289
|
}
|
|
286
290
|
}
|
|
287
291
|
}
|
|
292
|
+
if (cookiesString) {
|
|
293
|
+
fetchOptions.headers.set("Cookie", cookiesString);
|
|
294
|
+
}
|
|
288
295
|
if (options.body) {
|
|
289
296
|
fetchOptions.body = options.body;
|
|
290
297
|
}
|
|
@@ -170,7 +170,11 @@ function setSignal() {
|
|
|
170
170
|
clearTimeout(this.timeoutClearInstanse);
|
|
171
171
|
if (this.timeout && typeof this.timeout === "number" && this.timeout > 100) {
|
|
172
172
|
const controller = new AbortController;
|
|
173
|
-
|
|
173
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
174
|
+
if (typeof timer === "object" && "unref" in timer) {
|
|
175
|
+
timer.unref();
|
|
176
|
+
}
|
|
177
|
+
this.timeoutClearInstanse = timer;
|
|
174
178
|
this.signal = controller.signal;
|
|
175
179
|
}
|
|
176
180
|
}
|
|
@@ -285,6 +289,9 @@ export function prepareHTTPOptions(options, jar, addedOptions, config) {
|
|
|
285
289
|
}
|
|
286
290
|
}
|
|
287
291
|
}
|
|
292
|
+
if (cookiesString) {
|
|
293
|
+
fetchOptions.headers.set("Cookie", cookiesString);
|
|
294
|
+
}
|
|
288
295
|
if (options.body) {
|
|
289
296
|
fetchOptions.body = options.body;
|
|
290
297
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rezo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|