rezo 1.0.22 → 1.0.23

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.
@@ -129,7 +129,7 @@ function sanitizeConfig(config) {
129
129
  delete sanitized.data;
130
130
  return sanitized;
131
131
  }
132
- function parseCookiesFromHeaders(headers, url, config) {
132
+ async function parseCookiesFromHeaders(headers, url, config) {
133
133
  let setCookieHeaders = [];
134
134
  if (typeof headers.getSetCookie === "function") {
135
135
  setCookieHeaders = headers.getSetCookie() || [];
@@ -149,13 +149,59 @@ function parseCookiesFromHeaders(headers, url, config) {
149
149
  setCookiesString: []
150
150
  };
151
151
  }
152
+ const tempJar = new RezoCookieJar;
153
+ tempJar.setCookiesSync(setCookieHeaders, url);
154
+ const parsedCookies = tempJar.cookies();
155
+ const acceptedCookies = [];
156
+ let hookError = null;
157
+ if (config?.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
158
+ for (const cookie of parsedCookies.array) {
159
+ let shouldAccept = true;
160
+ for (const hook of config.hooks.beforeCookie) {
161
+ try {
162
+ const result = await hook({
163
+ cookie,
164
+ source: "response",
165
+ url,
166
+ isValid: true
167
+ }, config);
168
+ if (result === false) {
169
+ shouldAccept = false;
170
+ break;
171
+ }
172
+ } catch (err) {
173
+ hookError = err;
174
+ if (config.debug) {
175
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
176
+ }
177
+ }
178
+ }
179
+ if (shouldAccept) {
180
+ acceptedCookies.push(cookie);
181
+ }
182
+ }
183
+ } else {
184
+ acceptedCookies.push(...parsedCookies.array);
185
+ }
186
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
152
187
  const jar = new RezoCookieJar;
153
- jar.setCookiesSync(setCookieHeaders, url);
188
+ jar.setCookiesSync(acceptedCookieStrings, url);
154
189
  if (config?.enableCookieJar && config?.cookieJar) {
155
- config.cookieJar.setCookiesSync(setCookieHeaders, url);
190
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
156
191
  }
157
192
  const cookies = jar.cookies();
158
193
  cookies.setCookiesString = setCookieHeaders;
194
+ if (!hookError && config?.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
195
+ for (const hook of config.hooks.afterCookie) {
196
+ try {
197
+ await hook(acceptedCookies, config);
198
+ } catch (err) {
199
+ if (config.debug) {
200
+ console.log("[Rezo Debug] afterCookie hook error:", err);
201
+ }
202
+ }
203
+ }
204
+ }
159
205
  return cookies;
160
206
  }
161
207
  function mergeRequestAndResponseCookies(config, responseCookies, url) {
@@ -385,8 +431,14 @@ async function executeFetchRequest(fetchOptions, config, options, perform, strea
385
431
  }
386
432
  retries++;
387
433
  config.retryAttempts++;
434
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
435
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
436
+ for (const hook of config.hooks.beforeRetry) {
437
+ await hook(config, response, retries);
438
+ }
439
+ }
388
440
  if (retryDelay > 0) {
389
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
441
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
390
442
  }
391
443
  }
392
444
  continue;
@@ -584,7 +636,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
584
636
  const responseHeaders = fromFetchHeaders(response.headers);
585
637
  const contentType = response.headers.get("content-type") || "";
586
638
  const contentLength = response.headers.get("content-length");
587
- const cookies = parseCookiesFromHeaders(response.headers, url.href, config);
639
+ const cookies = await parseCookiesFromHeaders(response.headers, url.href, config);
588
640
  config.responseCookies = cookies;
589
641
  const location = response.headers.get("location");
590
642
  const isRedirect = status >= 300 && status < 400 && location;
@@ -129,7 +129,7 @@ function sanitizeConfig(config) {
129
129
  delete sanitized.data;
130
130
  return sanitized;
131
131
  }
132
- function parseCookiesFromHeaders(headers, url, config) {
132
+ async function parseCookiesFromHeaders(headers, url, config) {
133
133
  let setCookieHeaders = [];
134
134
  if (typeof headers.getSetCookie === "function") {
135
135
  setCookieHeaders = headers.getSetCookie() || [];
@@ -149,13 +149,59 @@ function parseCookiesFromHeaders(headers, url, config) {
149
149
  setCookiesString: []
150
150
  };
151
151
  }
152
+ const tempJar = new RezoCookieJar;
153
+ tempJar.setCookiesSync(setCookieHeaders, url);
154
+ const parsedCookies = tempJar.cookies();
155
+ const acceptedCookies = [];
156
+ let hookError = null;
157
+ if (config?.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
158
+ for (const cookie of parsedCookies.array) {
159
+ let shouldAccept = true;
160
+ for (const hook of config.hooks.beforeCookie) {
161
+ try {
162
+ const result = await hook({
163
+ cookie,
164
+ source: "response",
165
+ url,
166
+ isValid: true
167
+ }, config);
168
+ if (result === false) {
169
+ shouldAccept = false;
170
+ break;
171
+ }
172
+ } catch (err) {
173
+ hookError = err;
174
+ if (config.debug) {
175
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
176
+ }
177
+ }
178
+ }
179
+ if (shouldAccept) {
180
+ acceptedCookies.push(cookie);
181
+ }
182
+ }
183
+ } else {
184
+ acceptedCookies.push(...parsedCookies.array);
185
+ }
186
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
152
187
  const jar = new RezoCookieJar;
153
- jar.setCookiesSync(setCookieHeaders, url);
188
+ jar.setCookiesSync(acceptedCookieStrings, url);
154
189
  if (config?.enableCookieJar && config?.cookieJar) {
155
- config.cookieJar.setCookiesSync(setCookieHeaders, url);
190
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
156
191
  }
157
192
  const cookies = jar.cookies();
158
193
  cookies.setCookiesString = setCookieHeaders;
194
+ if (!hookError && config?.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
195
+ for (const hook of config.hooks.afterCookie) {
196
+ try {
197
+ await hook(acceptedCookies, config);
198
+ } catch (err) {
199
+ if (config.debug) {
200
+ console.log("[Rezo Debug] afterCookie hook error:", err);
201
+ }
202
+ }
203
+ }
204
+ }
159
205
  return cookies;
160
206
  }
161
207
  function mergeRequestAndResponseCookies(config, responseCookies, url) {
@@ -385,8 +431,14 @@ async function executeFetchRequest(fetchOptions, config, options, perform, strea
385
431
  }
386
432
  retries++;
387
433
  config.retryAttempts++;
434
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
435
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
436
+ for (const hook of config.hooks.beforeRetry) {
437
+ await hook(config, response, retries);
438
+ }
439
+ }
388
440
  if (retryDelay > 0) {
389
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
441
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
390
442
  }
391
443
  }
392
444
  continue;
@@ -584,7 +636,7 @@ async function executeSingleFetchRequest(config, fetchOptions, requestCount, tim
584
636
  const responseHeaders = fromFetchHeaders(response.headers);
585
637
  const contentType = response.headers.get("content-type") || "";
586
638
  const contentLength = response.headers.get("content-length");
587
- const cookies = parseCookiesFromHeaders(response.headers, url.href, config);
639
+ const cookies = await parseCookiesFromHeaders(response.headers, url.href, config);
588
640
  config.responseCookies = cookies;
589
641
  const location = response.headers.get("location");
590
642
  const isRedirect = status >= 300 && status < 400 && location;
@@ -386,6 +386,11 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
386
386
  retries++;
387
387
  const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
388
388
  debugLog.retry(config, retries, maxRetries, responseStatusCode, currentDelay);
389
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
390
+ for (const hook of config.hooks.beforeRetry) {
391
+ await hook(config, response, retries);
392
+ }
393
+ }
389
394
  if (retryDelay > 0) {
390
395
  await new Promise((resolve) => setTimeout(resolve, currentDelay));
391
396
  }
@@ -574,7 +579,7 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
574
579
  const location = headers["location"] || headers["Location"];
575
580
  const contentLength = headers["content-length"];
576
581
  const cookies = headers["set-cookie"];
577
- updateCookies(config, headers, url.href);
582
+ await updateCookies(config, headers, url.href);
578
583
  const cookieArray = config.responseCookies?.array || [];
579
584
  delete headers["set-cookie"];
580
585
  _stats.redirectUrl = undefined;
@@ -877,13 +882,31 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
877
882
  }
878
883
  timing.dnsStart = performance.now();
879
884
  config.timing.domainLookupStart = timing.dnsStart;
880
- socket.on("lookup", () => {
885
+ socket.on("lookup", (err, address, family) => {
881
886
  if (!timing.dnsEnd) {
882
887
  timing.dnsEnd = performance.now();
883
888
  config.timing.domainLookupEnd = timing.dnsEnd;
884
889
  timing.tcpStart = performance.now();
885
890
  config.timing.connectStart = timing.tcpStart;
886
891
  }
892
+ if (config.hooks?.onDns && config.hooks.onDns.length > 0) {
893
+ const familyNum = typeof family === "number" ? family : family === "IPv6" ? 6 : 4;
894
+ for (const hook of config.hooks.onDns) {
895
+ try {
896
+ hook({
897
+ hostname: url.hostname,
898
+ address: address || "",
899
+ family: familyNum,
900
+ duration: timing.dnsEnd - timing.dnsStart,
901
+ timestamp: Date.now()
902
+ }, config);
903
+ } catch (err) {
904
+ if (config.debug) {
905
+ console.log("[Rezo Debug] onDns hook error:", err);
906
+ }
907
+ }
908
+ }
909
+ }
887
910
  });
888
911
  socket.on("secureConnect", () => {
889
912
  if (!timing.tlsEnd && timing.tlsStart) {
@@ -910,6 +933,31 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
910
933
  hostnameMatch: cert.subject?.CN === url.hostname,
911
934
  chainValid: true
912
935
  };
936
+ if (config.hooks?.onTls && config.hooks.onTls.length > 0) {
937
+ for (const hook of config.hooks.onTls) {
938
+ try {
939
+ hook({
940
+ protocol: tlsVersion,
941
+ cipher: cipher?.name || "",
942
+ authorized: !socket.authorizationError,
943
+ authorizationError: socket.authorizationError,
944
+ certificate: cert ? {
945
+ subject: cert.subject?.CN || "",
946
+ issuer: cert.issuer?.CN || "",
947
+ validFrom: cert.valid_from || "",
948
+ validTo: cert.valid_to || "",
949
+ fingerprint: cert.fingerprint || ""
950
+ } : undefined,
951
+ duration: timing.tlsEnd - timing.tlsStart,
952
+ timestamp: Date.now()
953
+ }, config);
954
+ } catch (err) {
955
+ if (config.debug) {
956
+ console.log("[Rezo Debug] onTls hook error:", err);
957
+ }
958
+ }
959
+ }
960
+ }
913
961
  });
914
962
  socket.on("connect", () => {
915
963
  if (!timing.tcpEnd) {
@@ -928,6 +976,24 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
928
976
  config.network.localPort = localPort;
929
977
  config.network.family = remoteFamily;
930
978
  }
979
+ if (config.hooks?.onSocket && config.hooks.onSocket.length > 0) {
980
+ for (const hook of config.hooks.onSocket) {
981
+ try {
982
+ hook({
983
+ type: "connect",
984
+ localAddress,
985
+ localPort,
986
+ remoteAddress,
987
+ remotePort,
988
+ timestamp: Date.now()
989
+ }, socket);
990
+ } catch (err) {
991
+ if (config.debug) {
992
+ console.log("[Rezo Debug] onSocket hook error:", err);
993
+ }
994
+ }
995
+ }
996
+ }
931
997
  });
932
998
  });
933
999
  req.on("error", (error) => {
@@ -1323,18 +1389,52 @@ function parseProxy(proxy, isScure = true, rejectUnauthorized = false) {
1323
1389
  }
1324
1390
  return rezoProxy(proxy);
1325
1391
  }
1326
- function updateCookies(config, headers, url) {
1392
+ async function updateCookies(config, headers, url) {
1327
1393
  const cookies = headers["set-cookie"];
1328
1394
  if (cookies) {
1329
1395
  const jar = new RezoCookieJar;
1396
+ const tempJar = new RezoCookieJar;
1397
+ tempJar.setCookiesSync(cookies, url);
1398
+ const parsedCookies = tempJar.cookies();
1399
+ const acceptedCookies = [];
1400
+ let hookError = null;
1401
+ if (config.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
1402
+ for (const cookie of parsedCookies.array) {
1403
+ let shouldAccept = true;
1404
+ for (const hook of config.hooks.beforeCookie) {
1405
+ try {
1406
+ const result = await hook({
1407
+ cookie,
1408
+ source: "response",
1409
+ url,
1410
+ isValid: true
1411
+ }, config);
1412
+ if (result === false) {
1413
+ shouldAccept = false;
1414
+ break;
1415
+ }
1416
+ } catch (err) {
1417
+ hookError = err;
1418
+ if (config.debug) {
1419
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
1420
+ }
1421
+ }
1422
+ }
1423
+ if (shouldAccept) {
1424
+ acceptedCookies.push(cookie);
1425
+ }
1426
+ }
1427
+ } else {
1428
+ acceptedCookies.push(...parsedCookies.array);
1429
+ }
1430
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
1330
1431
  if (config.enableCookieJar && config.cookieJar) {
1331
- config.cookieJar.setCookiesSync(cookies, url);
1432
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
1332
1433
  }
1333
- jar.setCookiesSync(cookies, url);
1434
+ jar.setCookiesSync(acceptedCookieStrings, url);
1334
1435
  if (config.useCookies) {
1335
- const parsedCookies = jar.cookies();
1336
1436
  const existingArray = config.responseCookies?.array || [];
1337
- for (const cookie of parsedCookies.array) {
1437
+ for (const cookie of acceptedCookies) {
1338
1438
  const existingIndex = existingArray.findIndex((c) => c.key === cookie.key && c.domain === cookie.domain);
1339
1439
  if (existingIndex >= 0) {
1340
1440
  existingArray[existingIndex] = cookie;
@@ -1345,6 +1445,17 @@ function updateCookies(config, headers, url) {
1345
1445
  const mergedJar = new RezoCookieJar(existingArray, url);
1346
1446
  config.responseCookies = mergedJar.cookies();
1347
1447
  }
1448
+ if (!hookError && config.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
1449
+ for (const hook of config.hooks.afterCookie) {
1450
+ try {
1451
+ await hook(acceptedCookies, config);
1452
+ } catch (err) {
1453
+ if (config.debug) {
1454
+ console.log("[Rezo Debug] afterCookie hook error:", err);
1455
+ }
1456
+ }
1457
+ }
1458
+ }
1348
1459
  }
1349
1460
  }
1350
1461
 
@@ -386,6 +386,11 @@ async function executeHttp1Request(fetchOptions, config, options, perform, fs, s
386
386
  retries++;
387
387
  const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
388
388
  debugLog.retry(config, retries, maxRetries, responseStatusCode, currentDelay);
389
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
390
+ for (const hook of config.hooks.beforeRetry) {
391
+ await hook(config, response, retries);
392
+ }
393
+ }
389
394
  if (retryDelay > 0) {
390
395
  await new Promise((resolve) => setTimeout(resolve, currentDelay));
391
396
  }
@@ -574,7 +579,7 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
574
579
  const location = headers["location"] || headers["Location"];
575
580
  const contentLength = headers["content-length"];
576
581
  const cookies = headers["set-cookie"];
577
- updateCookies(config, headers, url.href);
582
+ await updateCookies(config, headers, url.href);
578
583
  const cookieArray = config.responseCookies?.array || [];
579
584
  delete headers["set-cookie"];
580
585
  _stats.redirectUrl = undefined;
@@ -877,13 +882,31 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
877
882
  }
878
883
  timing.dnsStart = performance.now();
879
884
  config.timing.domainLookupStart = timing.dnsStart;
880
- socket.on("lookup", () => {
885
+ socket.on("lookup", (err, address, family) => {
881
886
  if (!timing.dnsEnd) {
882
887
  timing.dnsEnd = performance.now();
883
888
  config.timing.domainLookupEnd = timing.dnsEnd;
884
889
  timing.tcpStart = performance.now();
885
890
  config.timing.connectStart = timing.tcpStart;
886
891
  }
892
+ if (config.hooks?.onDns && config.hooks.onDns.length > 0) {
893
+ const familyNum = typeof family === "number" ? family : family === "IPv6" ? 6 : 4;
894
+ for (const hook of config.hooks.onDns) {
895
+ try {
896
+ hook({
897
+ hostname: url.hostname,
898
+ address: address || "",
899
+ family: familyNum,
900
+ duration: timing.dnsEnd - timing.dnsStart,
901
+ timestamp: Date.now()
902
+ }, config);
903
+ } catch (err) {
904
+ if (config.debug) {
905
+ console.log("[Rezo Debug] onDns hook error:", err);
906
+ }
907
+ }
908
+ }
909
+ }
887
910
  });
888
911
  socket.on("secureConnect", () => {
889
912
  if (!timing.tlsEnd && timing.tlsStart) {
@@ -910,6 +933,31 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
910
933
  hostnameMatch: cert.subject?.CN === url.hostname,
911
934
  chainValid: true
912
935
  };
936
+ if (config.hooks?.onTls && config.hooks.onTls.length > 0) {
937
+ for (const hook of config.hooks.onTls) {
938
+ try {
939
+ hook({
940
+ protocol: tlsVersion,
941
+ cipher: cipher?.name || "",
942
+ authorized: !socket.authorizationError,
943
+ authorizationError: socket.authorizationError,
944
+ certificate: cert ? {
945
+ subject: cert.subject?.CN || "",
946
+ issuer: cert.issuer?.CN || "",
947
+ validFrom: cert.valid_from || "",
948
+ validTo: cert.valid_to || "",
949
+ fingerprint: cert.fingerprint || ""
950
+ } : undefined,
951
+ duration: timing.tlsEnd - timing.tlsStart,
952
+ timestamp: Date.now()
953
+ }, config);
954
+ } catch (err) {
955
+ if (config.debug) {
956
+ console.log("[Rezo Debug] onTls hook error:", err);
957
+ }
958
+ }
959
+ }
960
+ }
913
961
  });
914
962
  socket.on("connect", () => {
915
963
  if (!timing.tcpEnd) {
@@ -928,6 +976,24 @@ async function request(config, fetchOptions, requestCount, timing, _stats, respo
928
976
  config.network.localPort = localPort;
929
977
  config.network.family = remoteFamily;
930
978
  }
979
+ if (config.hooks?.onSocket && config.hooks.onSocket.length > 0) {
980
+ for (const hook of config.hooks.onSocket) {
981
+ try {
982
+ hook({
983
+ type: "connect",
984
+ localAddress,
985
+ localPort,
986
+ remoteAddress,
987
+ remotePort,
988
+ timestamp: Date.now()
989
+ }, socket);
990
+ } catch (err) {
991
+ if (config.debug) {
992
+ console.log("[Rezo Debug] onSocket hook error:", err);
993
+ }
994
+ }
995
+ }
996
+ }
931
997
  });
932
998
  });
933
999
  req.on("error", (error) => {
@@ -1323,18 +1389,52 @@ function parseProxy(proxy, isScure = true, rejectUnauthorized = false) {
1323
1389
  }
1324
1390
  return rezoProxy(proxy);
1325
1391
  }
1326
- function updateCookies(config, headers, url) {
1392
+ async function updateCookies(config, headers, url) {
1327
1393
  const cookies = headers["set-cookie"];
1328
1394
  if (cookies) {
1329
1395
  const jar = new RezoCookieJar;
1396
+ const tempJar = new RezoCookieJar;
1397
+ tempJar.setCookiesSync(cookies, url);
1398
+ const parsedCookies = tempJar.cookies();
1399
+ const acceptedCookies = [];
1400
+ let hookError = null;
1401
+ if (config.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
1402
+ for (const cookie of parsedCookies.array) {
1403
+ let shouldAccept = true;
1404
+ for (const hook of config.hooks.beforeCookie) {
1405
+ try {
1406
+ const result = await hook({
1407
+ cookie,
1408
+ source: "response",
1409
+ url,
1410
+ isValid: true
1411
+ }, config);
1412
+ if (result === false) {
1413
+ shouldAccept = false;
1414
+ break;
1415
+ }
1416
+ } catch (err) {
1417
+ hookError = err;
1418
+ if (config.debug) {
1419
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
1420
+ }
1421
+ }
1422
+ }
1423
+ if (shouldAccept) {
1424
+ acceptedCookies.push(cookie);
1425
+ }
1426
+ }
1427
+ } else {
1428
+ acceptedCookies.push(...parsedCookies.array);
1429
+ }
1430
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
1330
1431
  if (config.enableCookieJar && config.cookieJar) {
1331
- config.cookieJar.setCookiesSync(cookies, url);
1432
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
1332
1433
  }
1333
- jar.setCookiesSync(cookies, url);
1434
+ jar.setCookiesSync(acceptedCookieStrings, url);
1334
1435
  if (config.useCookies) {
1335
- const parsedCookies = jar.cookies();
1336
1436
  const existingArray = config.responseCookies?.array || [];
1337
- for (const cookie of parsedCookies.array) {
1437
+ for (const cookie of acceptedCookies) {
1338
1438
  const existingIndex = existingArray.findIndex((c) => c.key === cookie.key && c.domain === cookie.domain);
1339
1439
  if (existingIndex >= 0) {
1340
1440
  existingArray[existingIndex] = cookie;
@@ -1345,5 +1445,16 @@ function updateCookies(config, headers, url) {
1345
1445
  const mergedJar = new RezoCookieJar(existingArray, url);
1346
1446
  config.responseCookies = mergedJar.cookies();
1347
1447
  }
1448
+ if (!hookError && config.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
1449
+ for (const hook of config.hooks.afterCookie) {
1450
+ try {
1451
+ await hook(acceptedCookies, config);
1452
+ } catch (err) {
1453
+ if (config.debug) {
1454
+ console.log("[Rezo Debug] afterCookie hook error:", err);
1455
+ }
1456
+ }
1457
+ }
1458
+ }
1348
1459
  }
1349
1460
  }
@@ -300,23 +300,58 @@ function sanitizeConfig(config) {
300
300
  const { data: _data, ...sanitized } = config;
301
301
  return sanitized;
302
302
  }
303
- function updateCookies(config, headers, url) {
303
+ async function updateCookies(config, headers, url) {
304
304
  const setCookieHeaders = headers["set-cookie"];
305
305
  if (!setCookieHeaders)
306
306
  return;
307
307
  const cookieHeaderArray = Array.isArray(setCookieHeaders) ? setCookieHeaders : [setCookieHeaders];
308
308
  if (cookieHeaderArray.length === 0)
309
309
  return;
310
+ const tempJar = new RezoCookieJar;
311
+ tempJar.setCookiesSync(cookieHeaderArray, url);
312
+ const parsedCookies = tempJar.cookies();
313
+ const acceptedCookies = [];
314
+ let hookError = null;
315
+ if (config.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
316
+ for (const cookie of parsedCookies.array) {
317
+ let shouldAccept = true;
318
+ for (const hook of config.hooks.beforeCookie) {
319
+ try {
320
+ const result = await hook({
321
+ cookie,
322
+ source: "response",
323
+ url,
324
+ isValid: true
325
+ }, config);
326
+ if (result === false) {
327
+ shouldAccept = false;
328
+ break;
329
+ }
330
+ } catch (err) {
331
+ hookError = err;
332
+ if (config.debug) {
333
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
334
+ }
335
+ }
336
+ }
337
+ if (shouldAccept) {
338
+ acceptedCookies.push(cookie);
339
+ }
340
+ }
341
+ } else {
342
+ acceptedCookies.push(...parsedCookies.array);
343
+ }
344
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
310
345
  const jar = new RezoCookieJar;
311
- jar.setCookiesSync(cookieHeaderArray, url);
346
+ jar.setCookiesSync(acceptedCookieStrings, url);
312
347
  if (config.enableCookieJar && config.cookieJar) {
313
- config.cookieJar.setCookiesSync(cookieHeaderArray, url);
348
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
314
349
  }
315
350
  const cookies = jar.cookies();
316
351
  cookies.setCookiesString = cookieHeaderArray;
317
352
  if (config.useCookies) {
318
353
  const existingArray = config.responseCookies?.array || [];
319
- for (const cookie of cookies.array) {
354
+ for (const cookie of acceptedCookies) {
320
355
  const existingIndex = existingArray.findIndex((c) => c.key === cookie.key && c.domain === cookie.domain);
321
356
  if (existingIndex >= 0) {
322
357
  existingArray[existingIndex] = cookie;
@@ -330,6 +365,17 @@ function updateCookies(config, headers, url) {
330
365
  } else {
331
366
  config.responseCookies = cookies;
332
367
  }
368
+ if (!hookError && config.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
369
+ for (const hook of config.hooks.afterCookie) {
370
+ try {
371
+ await hook(acceptedCookies, config);
372
+ } catch (err) {
373
+ if (config.debug) {
374
+ console.log("[Rezo Debug] afterCookie hook error:", err);
375
+ }
376
+ }
377
+ }
378
+ }
333
379
  }
334
380
  function mergeRequestAndResponseCookies(config, responseCookies, url) {
335
381
  const mergedCookiesArray = [];
@@ -571,11 +617,17 @@ async function executeHttp2Request(fetchOptions, config, options, perform, fs, s
571
617
  throw response;
572
618
  }
573
619
  retries++;
620
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
574
621
  if (config.debug) {
575
- console.log(`Retrying... ${retryDelay > 0 ? "in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
622
+ console.log(`Retrying... ${retryDelay > 0 ? "in " + currentDelay + "ms" : ""}`);
623
+ }
624
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
625
+ for (const hook of config.hooks.beforeRetry) {
626
+ await hook(config, response, retries);
627
+ }
576
628
  }
577
629
  if (retryDelay > 0) {
578
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
630
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
579
631
  }
580
632
  }
581
633
  config.retryAttempts++;
@@ -775,7 +827,15 @@ async function executeHttp2Stream(config, fetchOptions, requestCount, timing, _s
775
827
  _stats.redirectUrl = new URL(location, url).href;
776
828
  }
777
829
  config.network.httpVersion = "h2";
778
- updateCookies(config, headers, url.href);
830
+ (async () => {
831
+ try {
832
+ await updateCookies(config, headers, url.href);
833
+ } catch (err) {
834
+ if (config.debug) {
835
+ console.log("[Rezo Debug] Cookie hook error:", err);
836
+ }
837
+ }
838
+ })();
779
839
  if (eventEmitter && !isRedirect) {
780
840
  const headersEvent = {
781
841
  status,
@@ -300,23 +300,58 @@ function sanitizeConfig(config) {
300
300
  const { data: _data, ...sanitized } = config;
301
301
  return sanitized;
302
302
  }
303
- function updateCookies(config, headers, url) {
303
+ async function updateCookies(config, headers, url) {
304
304
  const setCookieHeaders = headers["set-cookie"];
305
305
  if (!setCookieHeaders)
306
306
  return;
307
307
  const cookieHeaderArray = Array.isArray(setCookieHeaders) ? setCookieHeaders : [setCookieHeaders];
308
308
  if (cookieHeaderArray.length === 0)
309
309
  return;
310
+ const tempJar = new RezoCookieJar;
311
+ tempJar.setCookiesSync(cookieHeaderArray, url);
312
+ const parsedCookies = tempJar.cookies();
313
+ const acceptedCookies = [];
314
+ let hookError = null;
315
+ if (config.hooks?.beforeCookie && config.hooks.beforeCookie.length > 0) {
316
+ for (const cookie of parsedCookies.array) {
317
+ let shouldAccept = true;
318
+ for (const hook of config.hooks.beforeCookie) {
319
+ try {
320
+ const result = await hook({
321
+ cookie,
322
+ source: "response",
323
+ url,
324
+ isValid: true
325
+ }, config);
326
+ if (result === false) {
327
+ shouldAccept = false;
328
+ break;
329
+ }
330
+ } catch (err) {
331
+ hookError = err;
332
+ if (config.debug) {
333
+ console.log("[Rezo Debug] beforeCookie hook error:", err);
334
+ }
335
+ }
336
+ }
337
+ if (shouldAccept) {
338
+ acceptedCookies.push(cookie);
339
+ }
340
+ }
341
+ } else {
342
+ acceptedCookies.push(...parsedCookies.array);
343
+ }
344
+ const acceptedCookieStrings = acceptedCookies.map((c) => c.cookieString());
310
345
  const jar = new RezoCookieJar;
311
- jar.setCookiesSync(cookieHeaderArray, url);
346
+ jar.setCookiesSync(acceptedCookieStrings, url);
312
347
  if (config.enableCookieJar && config.cookieJar) {
313
- config.cookieJar.setCookiesSync(cookieHeaderArray, url);
348
+ config.cookieJar.setCookiesSync(acceptedCookieStrings, url);
314
349
  }
315
350
  const cookies = jar.cookies();
316
351
  cookies.setCookiesString = cookieHeaderArray;
317
352
  if (config.useCookies) {
318
353
  const existingArray = config.responseCookies?.array || [];
319
- for (const cookie of cookies.array) {
354
+ for (const cookie of acceptedCookies) {
320
355
  const existingIndex = existingArray.findIndex((c) => c.key === cookie.key && c.domain === cookie.domain);
321
356
  if (existingIndex >= 0) {
322
357
  existingArray[existingIndex] = cookie;
@@ -330,6 +365,17 @@ function updateCookies(config, headers, url) {
330
365
  } else {
331
366
  config.responseCookies = cookies;
332
367
  }
368
+ if (!hookError && config.hooks?.afterCookie && config.hooks.afterCookie.length > 0) {
369
+ for (const hook of config.hooks.afterCookie) {
370
+ try {
371
+ await hook(acceptedCookies, config);
372
+ } catch (err) {
373
+ if (config.debug) {
374
+ console.log("[Rezo Debug] afterCookie hook error:", err);
375
+ }
376
+ }
377
+ }
378
+ }
333
379
  }
334
380
  function mergeRequestAndResponseCookies(config, responseCookies, url) {
335
381
  const mergedCookiesArray = [];
@@ -571,11 +617,17 @@ async function executeHttp2Request(fetchOptions, config, options, perform, fs, s
571
617
  throw response;
572
618
  }
573
619
  retries++;
620
+ const currentDelay = incrementDelay ? retryDelay * retries : retryDelay;
574
621
  if (config.debug) {
575
- console.log(`Retrying... ${retryDelay > 0 ? "in " + (incrementDelay ? retryDelay * retries : retryDelay) + "ms" : ""}`);
622
+ console.log(`Retrying... ${retryDelay > 0 ? "in " + currentDelay + "ms" : ""}`);
623
+ }
624
+ if (config.hooks?.beforeRetry && config.hooks.beforeRetry.length > 0) {
625
+ for (const hook of config.hooks.beforeRetry) {
626
+ await hook(config, response, retries);
627
+ }
576
628
  }
577
629
  if (retryDelay > 0) {
578
- await new Promise((resolve) => setTimeout(resolve, incrementDelay ? retryDelay * retries : retryDelay));
630
+ await new Promise((resolve) => setTimeout(resolve, currentDelay));
579
631
  }
580
632
  }
581
633
  config.retryAttempts++;
@@ -775,7 +827,15 @@ async function executeHttp2Stream(config, fetchOptions, requestCount, timing, _s
775
827
  _stats.redirectUrl = new URL(location, url).href;
776
828
  }
777
829
  config.network.httpVersion = "h2";
778
- updateCookies(config, headers, url.href);
830
+ (async () => {
831
+ try {
832
+ await updateCookies(config, headers, url.href);
833
+ } catch (err) {
834
+ if (config.debug) {
835
+ console.log("[Rezo Debug] Cookie hook error:", err);
836
+ }
837
+ }
838
+ })();
779
839
  if (eventEmitter && !isRedirect) {
780
840
  const headersEvent = {
781
841
  status,
@@ -1,6 +1,6 @@
1
- const _mod_bvuup4 = require('./picker.cjs');
2
- exports.detectRuntime = _mod_bvuup4.detectRuntime;
3
- exports.getAdapterCapabilities = _mod_bvuup4.getAdapterCapabilities;
4
- exports.buildAdapterContext = _mod_bvuup4.buildAdapterContext;
5
- exports.getAvailableAdapters = _mod_bvuup4.getAvailableAdapters;
6
- exports.selectAdapter = _mod_bvuup4.selectAdapter;;
1
+ const _mod_nbovud = require('./picker.cjs');
2
+ exports.detectRuntime = _mod_nbovud.detectRuntime;
3
+ exports.getAdapterCapabilities = _mod_nbovud.getAdapterCapabilities;
4
+ exports.buildAdapterContext = _mod_nbovud.buildAdapterContext;
5
+ exports.getAvailableAdapters = _mod_nbovud.getAvailableAdapters;
6
+ exports.selectAdapter = _mod_nbovud.selectAdapter;;
@@ -1,13 +1,13 @@
1
- const _mod_sqwaw0 = require('./lru-cache.cjs');
2
- exports.LRUCache = _mod_sqwaw0.LRUCache;;
3
- const _mod_wv7mbf = require('./dns-cache.cjs');
4
- exports.DNSCache = _mod_wv7mbf.DNSCache;
5
- exports.getGlobalDNSCache = _mod_wv7mbf.getGlobalDNSCache;
6
- exports.resetGlobalDNSCache = _mod_wv7mbf.resetGlobalDNSCache;;
7
- const _mod_v9gfkh = require('./response-cache.cjs');
8
- exports.ResponseCache = _mod_v9gfkh.ResponseCache;
9
- exports.normalizeResponseCacheConfig = _mod_v9gfkh.normalizeResponseCacheConfig;;
10
- const _mod_17mnwt = require('./file-cacher.cjs');
11
- exports.FileCacher = _mod_17mnwt.FileCacher;;
12
- const _mod_qtim1g = require('./url-store.cjs');
13
- exports.UrlStore = _mod_qtim1g.UrlStore;;
1
+ const _mod_gcibom = require('./lru-cache.cjs');
2
+ exports.LRUCache = _mod_gcibom.LRUCache;;
3
+ const _mod_1nnd9l = require('./dns-cache.cjs');
4
+ exports.DNSCache = _mod_1nnd9l.DNSCache;
5
+ exports.getGlobalDNSCache = _mod_1nnd9l.getGlobalDNSCache;
6
+ exports.resetGlobalDNSCache = _mod_1nnd9l.resetGlobalDNSCache;;
7
+ const _mod_lmofxo = require('./response-cache.cjs');
8
+ exports.ResponseCache = _mod_lmofxo.ResponseCache;
9
+ exports.normalizeResponseCacheConfig = _mod_lmofxo.normalizeResponseCacheConfig;;
10
+ const _mod_xgo0i6 = require('./file-cacher.cjs');
11
+ exports.FileCacher = _mod_xgo0i6.FileCacher;;
12
+ const _mod_9ouiu9 = require('./url-store.cjs');
13
+ exports.UrlStore = _mod_9ouiu9.UrlStore;;
@@ -328,13 +328,59 @@ class Rezo {
328
328
  }
329
329
  }
330
330
  const executeWithHooks = async () => {
331
- const mergedDefaults = this._proxyManager ? { ...defaultOptions, _proxyManager: this._proxyManager } : defaultOptions;
332
- const response = await this.adapter(options, mergedDefaults, jar);
331
+ const startTime = Date.now();
332
+ const beforeRequestContext = {
333
+ retryCount: 0,
334
+ isRedirect: false,
335
+ redirectCount: 0,
336
+ startTime
337
+ };
338
+ if (requestHooks.beforeRequest.length > 0) {
339
+ for (const hook of requestHooks.beforeRequest) {
340
+ const result = await hook(options, beforeRequestContext);
341
+ if (result && typeof result === "object" && "status" in result) {
342
+ return result;
343
+ }
344
+ }
345
+ }
346
+ const mergedDefaults = {
347
+ ...defaultOptions,
348
+ _proxyManager: this._proxyManager || null,
349
+ _hooks: requestHooks
350
+ };
351
+ let response;
352
+ try {
353
+ response = await this.adapter(options, mergedDefaults, jar);
354
+ } catch (error) {
355
+ if (requestHooks.beforeError.length > 0) {
356
+ let transformedError = error;
357
+ for (const hook of requestHooks.beforeError) {
358
+ transformedError = await hook(transformedError);
359
+ }
360
+ throw transformedError;
361
+ }
362
+ throw error;
363
+ }
333
364
  if (jar.cookieFile) {
334
365
  try {
335
366
  jar.saveToFile();
336
367
  } catch (e) {}
337
368
  }
369
+ if (requestHooks.beforeCache.length > 0 && response && typeof response === "object" && "data" in response) {
370
+ const cacheEvent = {
371
+ url: fullUrl,
372
+ status: response.status,
373
+ headers: response.headers,
374
+ cacheKey: `${method}:${fullUrl}`,
375
+ isCacheable: ["GET", "HEAD"].includes(method) && response.status >= 200 && response.status < 300
376
+ };
377
+ for (const hook of requestHooks.beforeCache) {
378
+ const shouldCache = hook(cacheEvent);
379
+ if (shouldCache === false) {
380
+ return response;
381
+ }
382
+ }
383
+ }
338
384
  if (this.responseCache && cacheMode !== "no-store" && response && typeof response === "object" && "data" in response && !(options._isStream || options._isDownload || options._isUpload)) {
339
385
  this.responseCache.set(method, fullUrl, response, requestHeaders);
340
386
  }
package/dist/core/rezo.js CHANGED
@@ -328,13 +328,59 @@ export class Rezo {
328
328
  }
329
329
  }
330
330
  const executeWithHooks = async () => {
331
- const mergedDefaults = this._proxyManager ? { ...defaultOptions, _proxyManager: this._proxyManager } : defaultOptions;
332
- const response = await this.adapter(options, mergedDefaults, jar);
331
+ const startTime = Date.now();
332
+ const beforeRequestContext = {
333
+ retryCount: 0,
334
+ isRedirect: false,
335
+ redirectCount: 0,
336
+ startTime
337
+ };
338
+ if (requestHooks.beforeRequest.length > 0) {
339
+ for (const hook of requestHooks.beforeRequest) {
340
+ const result = await hook(options, beforeRequestContext);
341
+ if (result && typeof result === "object" && "status" in result) {
342
+ return result;
343
+ }
344
+ }
345
+ }
346
+ const mergedDefaults = {
347
+ ...defaultOptions,
348
+ _proxyManager: this._proxyManager || null,
349
+ _hooks: requestHooks
350
+ };
351
+ let response;
352
+ try {
353
+ response = await this.adapter(options, mergedDefaults, jar);
354
+ } catch (error) {
355
+ if (requestHooks.beforeError.length > 0) {
356
+ let transformedError = error;
357
+ for (const hook of requestHooks.beforeError) {
358
+ transformedError = await hook(transformedError);
359
+ }
360
+ throw transformedError;
361
+ }
362
+ throw error;
363
+ }
333
364
  if (jar.cookieFile) {
334
365
  try {
335
366
  jar.saveToFile();
336
367
  } catch (e) {}
337
368
  }
369
+ if (requestHooks.beforeCache.length > 0 && response && typeof response === "object" && "data" in response) {
370
+ const cacheEvent = {
371
+ url: fullUrl,
372
+ status: response.status,
373
+ headers: response.headers,
374
+ cacheKey: `${method}:${fullUrl}`,
375
+ isCacheable: ["GET", "HEAD"].includes(method) && response.status >= 200 && response.status < 300
376
+ };
377
+ for (const hook of requestHooks.beforeCache) {
378
+ const shouldCache = hook(cacheEvent);
379
+ if (shouldCache === false) {
380
+ return response;
381
+ }
382
+ }
383
+ }
338
384
  if (this.responseCache && cacheMode !== "no-store" && response && typeof response === "object" && "data" in response && !(options._isStream || options._isDownload || options._isUpload)) {
339
385
  this.responseCache.set(method, fullUrl, response, requestHeaders);
340
386
  }
@@ -1,5 +1,5 @@
1
- const _mod_svsktw = require('../plugin/crawler.cjs');
2
- exports.Crawler = _mod_svsktw.Crawler;;
3
- const _mod_hcjbxq = require('../plugin/crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_hcjbxq.CrawlerOptions;
5
- exports.Domain = _mod_hcjbxq.Domain;;
1
+ const _mod_j6t9ay = require('../plugin/crawler.cjs');
2
+ exports.Crawler = _mod_j6t9ay.Crawler;;
3
+ const _mod_jqrm0t = require('../plugin/crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_jqrm0t.CrawlerOptions;
5
+ exports.Domain = _mod_jqrm0t.Domain;;
package/dist/index.cjs CHANGED
@@ -1,27 +1,27 @@
1
- const _mod_hre6ec = require('./core/rezo.cjs');
2
- exports.Rezo = _mod_hre6ec.Rezo;
3
- exports.createRezoInstance = _mod_hre6ec.createRezoInstance;
4
- exports.createDefaultInstance = _mod_hre6ec.createDefaultInstance;;
5
- const _mod_wwq78e = require('./errors/rezo-error.cjs');
6
- exports.RezoError = _mod_wwq78e.RezoError;
7
- exports.RezoErrorCode = _mod_wwq78e.RezoErrorCode;;
8
- const _mod_5wpolq = require('./utils/headers.cjs');
9
- exports.RezoHeaders = _mod_5wpolq.RezoHeaders;;
10
- const _mod_yody95 = require('./utils/form-data.cjs');
11
- exports.RezoFormData = _mod_yody95.RezoFormData;;
12
- const _mod_f843yl = require('./utils/cookies.cjs');
13
- exports.RezoCookieJar = _mod_f843yl.RezoCookieJar;
14
- exports.Cookie = _mod_f843yl.Cookie;;
15
- const _mod_8zpp5z = require('./core/hooks.cjs');
16
- exports.createDefaultHooks = _mod_8zpp5z.createDefaultHooks;
17
- exports.mergeHooks = _mod_8zpp5z.mergeHooks;;
18
- const _mod_60gu5s = require('./proxy/manager.cjs');
19
- exports.ProxyManager = _mod_60gu5s.ProxyManager;;
20
- const _mod_zuny9f = require('./queue/index.cjs');
21
- exports.RezoQueue = _mod_zuny9f.RezoQueue;
22
- exports.HttpQueue = _mod_zuny9f.HttpQueue;
23
- exports.Priority = _mod_zuny9f.Priority;
24
- exports.HttpMethodPriority = _mod_zuny9f.HttpMethodPriority;;
1
+ const _mod_bseuia = require('./core/rezo.cjs');
2
+ exports.Rezo = _mod_bseuia.Rezo;
3
+ exports.createRezoInstance = _mod_bseuia.createRezoInstance;
4
+ exports.createDefaultInstance = _mod_bseuia.createDefaultInstance;;
5
+ const _mod_mzimmd = require('./errors/rezo-error.cjs');
6
+ exports.RezoError = _mod_mzimmd.RezoError;
7
+ exports.RezoErrorCode = _mod_mzimmd.RezoErrorCode;;
8
+ const _mod_r9peyg = require('./utils/headers.cjs');
9
+ exports.RezoHeaders = _mod_r9peyg.RezoHeaders;;
10
+ const _mod_7pvqmp = require('./utils/form-data.cjs');
11
+ exports.RezoFormData = _mod_7pvqmp.RezoFormData;;
12
+ const _mod_vdykyy = require('./utils/cookies.cjs');
13
+ exports.RezoCookieJar = _mod_vdykyy.RezoCookieJar;
14
+ exports.Cookie = _mod_vdykyy.Cookie;;
15
+ const _mod_3p5c5b = require('./core/hooks.cjs');
16
+ exports.createDefaultHooks = _mod_3p5c5b.createDefaultHooks;
17
+ exports.mergeHooks = _mod_3p5c5b.mergeHooks;;
18
+ const _mod_vd73s2 = require('./proxy/manager.cjs');
19
+ exports.ProxyManager = _mod_vd73s2.ProxyManager;;
20
+ const _mod_dqq646 = require('./queue/index.cjs');
21
+ exports.RezoQueue = _mod_dqq646.RezoQueue;
22
+ exports.HttpQueue = _mod_dqq646.HttpQueue;
23
+ exports.Priority = _mod_dqq646.Priority;
24
+ exports.HttpMethodPriority = _mod_dqq646.HttpMethodPriority;;
25
25
  const { RezoError } = require('./errors/rezo-error.cjs');
26
26
  const isRezoError = exports.isRezoError = RezoError.isRezoError;
27
27
  const Cancel = exports.Cancel = RezoError;
@@ -1,36 +1,36 @@
1
- const _mod_yuwab2 = require('./crawler.cjs');
2
- exports.Crawler = _mod_yuwab2.Crawler;;
3
- const _mod_ke9y75 = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_ke9y75.CrawlerOptions;;
5
- const _mod_rmkqk2 = require('../cache/file-cacher.cjs');
6
- exports.FileCacher = _mod_rmkqk2.FileCacher;;
7
- const _mod_qvrjfw = require('../cache/url-store.cjs');
8
- exports.UrlStore = _mod_qvrjfw.UrlStore;;
9
- const _mod_6wo293 = require('./addon/oxylabs/index.cjs');
10
- exports.Oxylabs = _mod_6wo293.Oxylabs;;
11
- const _mod_5jzs00 = require('./addon/oxylabs/options.cjs');
12
- exports.OXYLABS_BROWSER_TYPES = _mod_5jzs00.OXYLABS_BROWSER_TYPES;
13
- exports.OXYLABS_COMMON_LOCALES = _mod_5jzs00.OXYLABS_COMMON_LOCALES;
14
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_5jzs00.OXYLABS_COMMON_GEO_LOCATIONS;
15
- exports.OXYLABS_US_STATES = _mod_5jzs00.OXYLABS_US_STATES;
16
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_5jzs00.OXYLABS_EUROPEAN_COUNTRIES;
17
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_5jzs00.OXYLABS_ASIAN_COUNTRIES;
18
- exports.getRandomOxylabsBrowserType = _mod_5jzs00.getRandomBrowserType;
19
- exports.getRandomOxylabsLocale = _mod_5jzs00.getRandomLocale;
20
- exports.getRandomOxylabsGeoLocation = _mod_5jzs00.getRandomGeoLocation;;
21
- const _mod_xzulah = require('./addon/decodo/index.cjs');
22
- exports.Decodo = _mod_xzulah.Decodo;;
23
- const _mod_96s3w3 = require('./addon/decodo/options.cjs');
24
- exports.DECODO_DEVICE_TYPES = _mod_96s3w3.DECODO_DEVICE_TYPES;
25
- exports.DECODO_HEADLESS_MODES = _mod_96s3w3.DECODO_HEADLESS_MODES;
26
- exports.DECODO_COMMON_LOCALES = _mod_96s3w3.DECODO_COMMON_LOCALES;
27
- exports.DECODO_COMMON_COUNTRIES = _mod_96s3w3.DECODO_COMMON_COUNTRIES;
28
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_96s3w3.DECODO_EUROPEAN_COUNTRIES;
29
- exports.DECODO_ASIAN_COUNTRIES = _mod_96s3w3.DECODO_ASIAN_COUNTRIES;
30
- exports.DECODO_US_STATES = _mod_96s3w3.DECODO_US_STATES;
31
- exports.DECODO_COMMON_CITIES = _mod_96s3w3.DECODO_COMMON_CITIES;
32
- exports.getRandomDecodoDeviceType = _mod_96s3w3.getRandomDeviceType;
33
- exports.getRandomDecodoLocale = _mod_96s3w3.getRandomLocale;
34
- exports.getRandomDecodoCountry = _mod_96s3w3.getRandomCountry;
35
- exports.getRandomDecodoCity = _mod_96s3w3.getRandomCity;
36
- exports.generateDecodoSessionId = _mod_96s3w3.generateSessionId;;
1
+ const _mod_ey9wal = require('./crawler.cjs');
2
+ exports.Crawler = _mod_ey9wal.Crawler;;
3
+ const _mod_1a0svj = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_1a0svj.CrawlerOptions;;
5
+ const _mod_ldpz72 = require('../cache/file-cacher.cjs');
6
+ exports.FileCacher = _mod_ldpz72.FileCacher;;
7
+ const _mod_n14nrr = require('../cache/url-store.cjs');
8
+ exports.UrlStore = _mod_n14nrr.UrlStore;;
9
+ const _mod_cg7bvo = require('./addon/oxylabs/index.cjs');
10
+ exports.Oxylabs = _mod_cg7bvo.Oxylabs;;
11
+ const _mod_06iufd = require('./addon/oxylabs/options.cjs');
12
+ exports.OXYLABS_BROWSER_TYPES = _mod_06iufd.OXYLABS_BROWSER_TYPES;
13
+ exports.OXYLABS_COMMON_LOCALES = _mod_06iufd.OXYLABS_COMMON_LOCALES;
14
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_06iufd.OXYLABS_COMMON_GEO_LOCATIONS;
15
+ exports.OXYLABS_US_STATES = _mod_06iufd.OXYLABS_US_STATES;
16
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_06iufd.OXYLABS_EUROPEAN_COUNTRIES;
17
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_06iufd.OXYLABS_ASIAN_COUNTRIES;
18
+ exports.getRandomOxylabsBrowserType = _mod_06iufd.getRandomBrowserType;
19
+ exports.getRandomOxylabsLocale = _mod_06iufd.getRandomLocale;
20
+ exports.getRandomOxylabsGeoLocation = _mod_06iufd.getRandomGeoLocation;;
21
+ const _mod_1mm4n9 = require('./addon/decodo/index.cjs');
22
+ exports.Decodo = _mod_1mm4n9.Decodo;;
23
+ const _mod_hramg2 = require('./addon/decodo/options.cjs');
24
+ exports.DECODO_DEVICE_TYPES = _mod_hramg2.DECODO_DEVICE_TYPES;
25
+ exports.DECODO_HEADLESS_MODES = _mod_hramg2.DECODO_HEADLESS_MODES;
26
+ exports.DECODO_COMMON_LOCALES = _mod_hramg2.DECODO_COMMON_LOCALES;
27
+ exports.DECODO_COMMON_COUNTRIES = _mod_hramg2.DECODO_COMMON_COUNTRIES;
28
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_hramg2.DECODO_EUROPEAN_COUNTRIES;
29
+ exports.DECODO_ASIAN_COUNTRIES = _mod_hramg2.DECODO_ASIAN_COUNTRIES;
30
+ exports.DECODO_US_STATES = _mod_hramg2.DECODO_US_STATES;
31
+ exports.DECODO_COMMON_CITIES = _mod_hramg2.DECODO_COMMON_CITIES;
32
+ exports.getRandomDecodoDeviceType = _mod_hramg2.getRandomDeviceType;
33
+ exports.getRandomDecodoLocale = _mod_hramg2.getRandomLocale;
34
+ exports.getRandomDecodoCountry = _mod_hramg2.getRandomCountry;
35
+ exports.getRandomDecodoCity = _mod_hramg2.getRandomCity;
36
+ exports.generateDecodoSessionId = _mod_hramg2.generateSessionId;;
@@ -1,8 +1,8 @@
1
1
  const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
2
2
  const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
3
3
  const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
4
- const _mod_1jfmwa = require('./manager.cjs');
5
- exports.ProxyManager = _mod_1jfmwa.ProxyManager;;
4
+ const _mod_mpoy0o = require('./manager.cjs');
5
+ exports.ProxyManager = _mod_mpoy0o.ProxyManager;;
6
6
  function createOptions(uri, opts) {
7
7
  if (uri instanceof URL || typeof uri === "string") {
8
8
  return {
@@ -1,8 +1,8 @@
1
- const _mod_1rrd9x = require('./queue.cjs');
2
- exports.RezoQueue = _mod_1rrd9x.RezoQueue;;
3
- const _mod_2zy0yg = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_2zy0yg.HttpQueue;
5
- exports.extractDomain = _mod_2zy0yg.extractDomain;;
6
- const _mod_5lfu3b = require('./types.cjs');
7
- exports.Priority = _mod_5lfu3b.Priority;
8
- exports.HttpMethodPriority = _mod_5lfu3b.HttpMethodPriority;;
1
+ const _mod_aupzai = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_aupzai.RezoQueue;;
3
+ const _mod_6g163q = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_6g163q.HttpQueue;
5
+ exports.extractDomain = _mod_6g163q.extractDomain;;
6
+ const _mod_sqrola = require('./types.cjs');
7
+ exports.Priority = _mod_sqrola.Priority;
8
+ exports.HttpMethodPriority = _mod_sqrola.HttpMethodPriority;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
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",