rezo 1.0.66 → 1.0.67

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.
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -1,6 +1,6 @@
1
- const _mod_hjzrbn = require('./picker.cjs');
2
- exports.detectRuntime = _mod_hjzrbn.detectRuntime;
3
- exports.getAdapterCapabilities = _mod_hjzrbn.getAdapterCapabilities;
4
- exports.buildAdapterContext = _mod_hjzrbn.buildAdapterContext;
5
- exports.getAvailableAdapters = _mod_hjzrbn.getAvailableAdapters;
6
- exports.selectAdapter = _mod_hjzrbn.selectAdapter;;
1
+ const _mod_o5f1yk = require('./picker.cjs');
2
+ exports.detectRuntime = _mod_o5f1yk.detectRuntime;
3
+ exports.getAdapterCapabilities = _mod_o5f1yk.getAdapterCapabilities;
4
+ exports.buildAdapterContext = _mod_o5f1yk.buildAdapterContext;
5
+ exports.getAvailableAdapters = _mod_o5f1yk.getAvailableAdapters;
6
+ exports.selectAdapter = _mod_o5f1yk.selectAdapter;;
@@ -1,9 +1,9 @@
1
- const _mod_q7t2ir = require('./lru-cache.cjs');
2
- exports.LRUCache = _mod_q7t2ir.LRUCache;;
3
- const _mod_sa1kxt = require('./dns-cache.cjs');
4
- exports.DNSCache = _mod_sa1kxt.DNSCache;
5
- exports.getGlobalDNSCache = _mod_sa1kxt.getGlobalDNSCache;
6
- exports.resetGlobalDNSCache = _mod_sa1kxt.resetGlobalDNSCache;;
7
- const _mod_r6s1np = require('./response-cache.cjs');
8
- exports.ResponseCache = _mod_r6s1np.ResponseCache;
9
- exports.normalizeResponseCacheConfig = _mod_r6s1np.normalizeResponseCacheConfig;;
1
+ const _mod_9pgxof = require('./lru-cache.cjs');
2
+ exports.LRUCache = _mod_9pgxof.LRUCache;;
3
+ const _mod_x6onk1 = require('./dns-cache.cjs');
4
+ exports.DNSCache = _mod_x6onk1.DNSCache;
5
+ exports.getGlobalDNSCache = _mod_x6onk1.getGlobalDNSCache;
6
+ exports.resetGlobalDNSCache = _mod_x6onk1.resetGlobalDNSCache;;
7
+ const _mod_ez6b9b = require('./response-cache.cjs');
8
+ exports.ResponseCache = _mod_ez6b9b.ResponseCache;
9
+ exports.normalizeResponseCacheConfig = _mod_ez6b9b.normalizeResponseCacheConfig;;
@@ -57,6 +57,7 @@ class Crawler {
57
57
  adapterExecutor = null;
58
58
  adapterType;
59
59
  pendingExecutions = new Set;
60
+ pendingVisitCount = 0;
60
61
  isDestroyed = false;
61
62
  queueOptions = { concurrency: 1000 };
62
63
  robotsTxt;
@@ -827,7 +828,6 @@ class Crawler {
827
828
  maxRedirects = this.config.maxRedirects,
828
829
  useProxy = this.config.hasDomain(url, "proxies", options?.useProxy),
829
830
  extractLeads = false,
830
- params,
831
831
  rejectUnauthorized,
832
832
  useQueue = false,
833
833
  deepEmailFinder = false,
@@ -841,7 +841,6 @@ class Crawler {
841
841
  headers: this.config.pickHeaders(url, true, headers, true),
842
842
  timeout,
843
843
  maxRedirects,
844
- params,
845
844
  proxy: useProxy ? this.config.getAdapter(url, "proxies", true, true) || undefined : undefined,
846
845
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : this.config.rejectUnauthorized,
847
846
  queue: this.config.getAdapter(url, "limiters", useQueue, useQueue) || undefined
@@ -868,16 +867,21 @@ class Crawler {
868
867
  };
869
868
  decodoInstanse = this.config.getAdapter(url, "decodo", false, useOxylabsRotation) || undefined;
870
869
  }
870
+ url = this.buildUrl(url, options?.params);
871
871
  if (this.config.enableNavigationHistory) {
872
872
  const headersObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : headers;
873
873
  this.addToNavigationQueue(url, method, body, headersObj);
874
874
  }
875
+ if (url.includes(`/www.yellowpages.com/search?`))
876
+ console.log("Visiting: ", url);
875
877
  if (deepEmailFinder) {
878
+ this.pendingVisitCount++;
876
879
  const p = this.execute2(method, url, body, _options, forceRevisit, emailMetadata);
877
880
  this.pendingExecutions.add(p);
878
881
  p.finally(() => this.pendingExecutions.delete(p));
879
882
  return this;
880
883
  }
884
+ this.pendingVisitCount++;
881
885
  const p = this.execute(method, url, body, _options, extractLeads, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, skipCache, emailMetadata);
882
886
  this.pendingExecutions.add(p);
883
887
  p.finally(() => this.pendingExecutions.delete(p));
@@ -892,6 +896,7 @@ class Crawler {
892
896
  await this.waitForNavigationHistory();
893
897
  }
894
898
  const task = this.queue.add(() => this.executeHttp(method, url, body, options, isEmail, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, 0, undefined, skipCache, emailMetadata));
899
+ this.pendingVisitCount--;
895
900
  task.finally(() => this.pendingExecutions.delete(task));
896
901
  }
897
902
  async execute2(method, url, body, options = {}, forceRevisit, emailMetadata) {
@@ -915,6 +920,7 @@ class Crawler {
915
920
  allowCrossDomainTravel: true,
916
921
  emailMetadata
917
922
  }, forceRevisit, true)).then();
923
+ this.pendingVisitCount--;
918
924
  }
919
925
  async executeHttp(method, url, body, options = {}, isEmail, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, retryCount = 0, parentUrl, skipCache, emailMetadata) {
920
926
  try {
@@ -1066,10 +1072,25 @@ class Crawler {
1066
1072
  }
1067
1073
  }
1068
1074
  async waitForAll() {
1069
- if (this.pendingExecutions.size > 0) {
1070
- await Promise.allSettled([...this.pendingExecutions]);
1075
+ if (this.pendingVisitCount === 0 && this.pendingExecutions.size === 0 && this.queue.size === 0 && this.queue.pending === 0 && !this.crawlStarted) {
1076
+ await this.triggerFinishHandlers();
1077
+ await this.destroy();
1078
+ return;
1079
+ }
1080
+ while (true) {
1081
+ while (this.pendingVisitCount > 0) {
1082
+ await new Promise((resolve) => setTimeout(resolve, 10));
1083
+ }
1084
+ if (this.pendingExecutions.size > 0) {
1085
+ await Promise.allSettled([...this.pendingExecutions]);
1086
+ }
1087
+ if (this.queue.size > 0 || this.queue.pending > 0) {
1088
+ await this.queue.onIdle();
1089
+ }
1090
+ if (this.pendingVisitCount === 0 && this.pendingExecutions.size === 0 && this.queue.size === 0 && this.queue.pending === 0) {
1091
+ break;
1092
+ }
1071
1093
  }
1072
- await this.queue.onIdle();
1073
1094
  await this.triggerFinishHandlers();
1074
1095
  await this.destroy();
1075
1096
  }
@@ -57,6 +57,7 @@ export class Crawler {
57
57
  adapterExecutor = null;
58
58
  adapterType;
59
59
  pendingExecutions = new Set;
60
+ pendingVisitCount = 0;
60
61
  isDestroyed = false;
61
62
  queueOptions = { concurrency: 1000 };
62
63
  robotsTxt;
@@ -827,7 +828,6 @@ export class Crawler {
827
828
  maxRedirects = this.config.maxRedirects,
828
829
  useProxy = this.config.hasDomain(url, "proxies", options?.useProxy),
829
830
  extractLeads = false,
830
- params,
831
831
  rejectUnauthorized,
832
832
  useQueue = false,
833
833
  deepEmailFinder = false,
@@ -841,7 +841,6 @@ export class Crawler {
841
841
  headers: this.config.pickHeaders(url, true, headers, true),
842
842
  timeout,
843
843
  maxRedirects,
844
- params,
845
844
  proxy: useProxy ? this.config.getAdapter(url, "proxies", true, true) || undefined : undefined,
846
845
  rejectUnauthorized: typeof rejectUnauthorized === "boolean" ? rejectUnauthorized : this.config.rejectUnauthorized,
847
846
  queue: this.config.getAdapter(url, "limiters", useQueue, useQueue) || undefined
@@ -868,16 +867,21 @@ export class Crawler {
868
867
  };
869
868
  decodoInstanse = this.config.getAdapter(url, "decodo", false, useOxylabsRotation) || undefined;
870
869
  }
870
+ url = this.buildUrl(url, options?.params);
871
871
  if (this.config.enableNavigationHistory) {
872
872
  const headersObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : headers;
873
873
  this.addToNavigationQueue(url, method, body, headersObj);
874
874
  }
875
+ if (url.includes(`/www.yellowpages.com/search?`))
876
+ console.log("Visiting: ", url);
875
877
  if (deepEmailFinder) {
878
+ this.pendingVisitCount++;
876
879
  const p = this.execute2(method, url, body, _options, forceRevisit, emailMetadata);
877
880
  this.pendingExecutions.add(p);
878
881
  p.finally(() => this.pendingExecutions.delete(p));
879
882
  return this;
880
883
  }
884
+ this.pendingVisitCount++;
881
885
  const p = this.execute(method, url, body, _options, extractLeads, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, skipCache, emailMetadata);
882
886
  this.pendingExecutions.add(p);
883
887
  p.finally(() => this.pendingExecutions.delete(p));
@@ -892,6 +896,7 @@ export class Crawler {
892
896
  await this.waitForNavigationHistory();
893
897
  }
894
898
  const task = this.queue.add(() => this.executeHttp(method, url, body, options, isEmail, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, 0, undefined, skipCache, emailMetadata));
899
+ this.pendingVisitCount--;
895
900
  task.finally(() => this.pendingExecutions.delete(task));
896
901
  }
897
902
  async execute2(method, url, body, options = {}, forceRevisit, emailMetadata) {
@@ -915,6 +920,7 @@ export class Crawler {
915
920
  allowCrossDomainTravel: true,
916
921
  emailMetadata
917
922
  }, forceRevisit, true)).then();
923
+ this.pendingVisitCount--;
918
924
  }
919
925
  async executeHttp(method, url, body, options = {}, isEmail, forceRevisit, oxylabsOptions, oxylabsInstanse, decodoInstanse, decodoOptions, retryCount = 0, parentUrl, skipCache, emailMetadata) {
920
926
  try {
@@ -1066,10 +1072,25 @@ export class Crawler {
1066
1072
  }
1067
1073
  }
1068
1074
  async waitForAll() {
1069
- if (this.pendingExecutions.size > 0) {
1070
- await Promise.allSettled([...this.pendingExecutions]);
1075
+ if (this.pendingVisitCount === 0 && this.pendingExecutions.size === 0 && this.queue.size === 0 && this.queue.pending === 0 && !this.crawlStarted) {
1076
+ await this.triggerFinishHandlers();
1077
+ await this.destroy();
1078
+ return;
1079
+ }
1080
+ while (true) {
1081
+ while (this.pendingVisitCount > 0) {
1082
+ await new Promise((resolve) => setTimeout(resolve, 10));
1083
+ }
1084
+ if (this.pendingExecutions.size > 0) {
1085
+ await Promise.allSettled([...this.pendingExecutions]);
1086
+ }
1087
+ if (this.queue.size > 0 || this.queue.pending > 0) {
1088
+ await this.queue.onIdle();
1089
+ }
1090
+ if (this.pendingVisitCount === 0 && this.pendingExecutions.size === 0 && this.queue.size === 0 && this.queue.pending === 0) {
1091
+ break;
1092
+ }
1071
1093
  }
1072
- await this.queue.onIdle();
1073
1094
  await this.triggerFinishHandlers();
1074
1095
  await this.destroy();
1075
1096
  }
@@ -1,40 +1,40 @@
1
- const _mod_ysn0d5 = require('./crawler.cjs');
2
- exports.Crawler = _mod_ysn0d5.Crawler;;
3
- const _mod_9bawe3 = require('./crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_9bawe3.CrawlerOptions;;
5
- const _mod_6prluk = require('./plugin/robots-txt.cjs');
6
- exports.RobotsTxt = _mod_6prluk.RobotsTxt;;
7
- const _mod_ixpf59 = require('./plugin/file-cacher.cjs');
8
- exports.FileCacher = _mod_ixpf59.FileCacher;;
9
- const _mod_bms0ov = require('./plugin/url-store.cjs');
10
- exports.UrlStore = _mod_bms0ov.UrlStore;;
11
- const _mod_wuzjow = require('./plugin/navigation-history.cjs');
12
- exports.NavigationHistory = _mod_wuzjow.NavigationHistory;;
13
- const _mod_uhf8sk = require('./addon/oxylabs/index.cjs');
14
- exports.Oxylabs = _mod_uhf8sk.Oxylabs;;
15
- const _mod_7o8pzc = require('./addon/oxylabs/options.cjs');
16
- exports.OXYLABS_BROWSER_TYPES = _mod_7o8pzc.OXYLABS_BROWSER_TYPES;
17
- exports.OXYLABS_COMMON_LOCALES = _mod_7o8pzc.OXYLABS_COMMON_LOCALES;
18
- exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_7o8pzc.OXYLABS_COMMON_GEO_LOCATIONS;
19
- exports.OXYLABS_US_STATES = _mod_7o8pzc.OXYLABS_US_STATES;
20
- exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_7o8pzc.OXYLABS_EUROPEAN_COUNTRIES;
21
- exports.OXYLABS_ASIAN_COUNTRIES = _mod_7o8pzc.OXYLABS_ASIAN_COUNTRIES;
22
- exports.getRandomOxylabsBrowserType = _mod_7o8pzc.getRandomBrowserType;
23
- exports.getRandomOxylabsLocale = _mod_7o8pzc.getRandomLocale;
24
- exports.getRandomOxylabsGeoLocation = _mod_7o8pzc.getRandomGeoLocation;;
25
- const _mod_2w0w24 = require('./addon/decodo/index.cjs');
26
- exports.Decodo = _mod_2w0w24.Decodo;;
27
- const _mod_wkuxky = require('./addon/decodo/options.cjs');
28
- exports.DECODO_DEVICE_TYPES = _mod_wkuxky.DECODO_DEVICE_TYPES;
29
- exports.DECODO_HEADLESS_MODES = _mod_wkuxky.DECODO_HEADLESS_MODES;
30
- exports.DECODO_COMMON_LOCALES = _mod_wkuxky.DECODO_COMMON_LOCALES;
31
- exports.DECODO_COMMON_COUNTRIES = _mod_wkuxky.DECODO_COMMON_COUNTRIES;
32
- exports.DECODO_EUROPEAN_COUNTRIES = _mod_wkuxky.DECODO_EUROPEAN_COUNTRIES;
33
- exports.DECODO_ASIAN_COUNTRIES = _mod_wkuxky.DECODO_ASIAN_COUNTRIES;
34
- exports.DECODO_US_STATES = _mod_wkuxky.DECODO_US_STATES;
35
- exports.DECODO_COMMON_CITIES = _mod_wkuxky.DECODO_COMMON_CITIES;
36
- exports.getRandomDecodoDeviceType = _mod_wkuxky.getRandomDeviceType;
37
- exports.getRandomDecodoLocale = _mod_wkuxky.getRandomLocale;
38
- exports.getRandomDecodoCountry = _mod_wkuxky.getRandomCountry;
39
- exports.getRandomDecodoCity = _mod_wkuxky.getRandomCity;
40
- exports.generateDecodoSessionId = _mod_wkuxky.generateSessionId;;
1
+ const _mod_i6ezcr = require('./crawler.cjs');
2
+ exports.Crawler = _mod_i6ezcr.Crawler;;
3
+ const _mod_516ezs = require('./crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_516ezs.CrawlerOptions;;
5
+ const _mod_4ztrh6 = require('./plugin/robots-txt.cjs');
6
+ exports.RobotsTxt = _mod_4ztrh6.RobotsTxt;;
7
+ const _mod_bj33tl = require('./plugin/file-cacher.cjs');
8
+ exports.FileCacher = _mod_bj33tl.FileCacher;;
9
+ const _mod_5ndio7 = require('./plugin/url-store.cjs');
10
+ exports.UrlStore = _mod_5ndio7.UrlStore;;
11
+ const _mod_ettbd1 = require('./plugin/navigation-history.cjs');
12
+ exports.NavigationHistory = _mod_ettbd1.NavigationHistory;;
13
+ const _mod_cr5jnk = require('./addon/oxylabs/index.cjs');
14
+ exports.Oxylabs = _mod_cr5jnk.Oxylabs;;
15
+ const _mod_p0m5uw = require('./addon/oxylabs/options.cjs');
16
+ exports.OXYLABS_BROWSER_TYPES = _mod_p0m5uw.OXYLABS_BROWSER_TYPES;
17
+ exports.OXYLABS_COMMON_LOCALES = _mod_p0m5uw.OXYLABS_COMMON_LOCALES;
18
+ exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_p0m5uw.OXYLABS_COMMON_GEO_LOCATIONS;
19
+ exports.OXYLABS_US_STATES = _mod_p0m5uw.OXYLABS_US_STATES;
20
+ exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_p0m5uw.OXYLABS_EUROPEAN_COUNTRIES;
21
+ exports.OXYLABS_ASIAN_COUNTRIES = _mod_p0m5uw.OXYLABS_ASIAN_COUNTRIES;
22
+ exports.getRandomOxylabsBrowserType = _mod_p0m5uw.getRandomBrowserType;
23
+ exports.getRandomOxylabsLocale = _mod_p0m5uw.getRandomLocale;
24
+ exports.getRandomOxylabsGeoLocation = _mod_p0m5uw.getRandomGeoLocation;;
25
+ const _mod_7ubnxc = require('./addon/decodo/index.cjs');
26
+ exports.Decodo = _mod_7ubnxc.Decodo;;
27
+ const _mod_qvvtgu = require('./addon/decodo/options.cjs');
28
+ exports.DECODO_DEVICE_TYPES = _mod_qvvtgu.DECODO_DEVICE_TYPES;
29
+ exports.DECODO_HEADLESS_MODES = _mod_qvvtgu.DECODO_HEADLESS_MODES;
30
+ exports.DECODO_COMMON_LOCALES = _mod_qvvtgu.DECODO_COMMON_LOCALES;
31
+ exports.DECODO_COMMON_COUNTRIES = _mod_qvvtgu.DECODO_COMMON_COUNTRIES;
32
+ exports.DECODO_EUROPEAN_COUNTRIES = _mod_qvvtgu.DECODO_EUROPEAN_COUNTRIES;
33
+ exports.DECODO_ASIAN_COUNTRIES = _mod_qvvtgu.DECODO_ASIAN_COUNTRIES;
34
+ exports.DECODO_US_STATES = _mod_qvvtgu.DECODO_US_STATES;
35
+ exports.DECODO_COMMON_CITIES = _mod_qvvtgu.DECODO_COMMON_CITIES;
36
+ exports.getRandomDecodoDeviceType = _mod_qvvtgu.getRandomDeviceType;
37
+ exports.getRandomDecodoLocale = _mod_qvvtgu.getRandomLocale;
38
+ exports.getRandomDecodoCountry = _mod_qvvtgu.getRandomCountry;
39
+ exports.getRandomDecodoCity = _mod_qvvtgu.getRandomCity;
40
+ exports.generateDecodoSessionId = _mod_qvvtgu.generateSessionId;;
package/dist/crawler.d.ts CHANGED
@@ -2180,6 +2180,8 @@ declare class RezoQueue<T = any> {
2180
2180
  private readonly throughputWindowSize;
2181
2181
  private idlePromise?;
2182
2182
  private emptyPromise?;
2183
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2184
+ private hasEverBeenActive;
2183
2185
  readonly config: Required<QueueConfig>;
2184
2186
  /**
2185
2187
  * Create a new RezoQueue
@@ -2254,6 +2256,9 @@ declare class RezoQueue<T = any> {
2254
2256
  }) => boolean): number;
2255
2257
  /**
2256
2258
  * Wait for queue to become idle (no running or pending tasks)
2259
+ *
2260
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2261
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2257
2262
  */
2258
2263
  onIdle(): Promise<void>;
2259
2264
  /**
@@ -7082,6 +7087,11 @@ export declare class Crawler {
7082
7087
  private adapterType;
7083
7088
  /** Track pending execute() calls for proper done() behavior */
7084
7089
  private pendingExecutions;
7090
+ /**
7091
+ * Track pending visits that haven't yet added to the queue.
7092
+ * This prevents waitForAll() from exiting when execute() is still in its async preamble.
7093
+ */
7094
+ private pendingVisitCount;
7085
7095
  /** Track if the crawler has been destroyed */
7086
7096
  private isDestroyed;
7087
7097
  /** Original queue options for restoration */
@@ -1,4 +1,4 @@
1
- const _mod_zoj9w3 = require('../crawler/crawler.cjs');
2
- exports.Crawler = _mod_zoj9w3.Crawler;;
3
- const _mod_hxjem3 = require('../crawler/crawler-options.cjs');
4
- exports.CrawlerOptions = _mod_hxjem3.CrawlerOptions;;
1
+ const _mod_0b8gth = require('../crawler/crawler.cjs');
2
+ exports.Crawler = _mod_0b8gth.Crawler;;
3
+ const _mod_9mmp5y = require('../crawler/crawler-options.cjs');
4
+ exports.CrawlerOptions = _mod_9mmp5y.CrawlerOptions;;
package/dist/index.cjs CHANGED
@@ -1,30 +1,30 @@
1
- const _mod_p3krsk = require('./core/rezo.cjs');
2
- exports.Rezo = _mod_p3krsk.Rezo;
3
- exports.createRezoInstance = _mod_p3krsk.createRezoInstance;
4
- exports.createDefaultInstance = _mod_p3krsk.createDefaultInstance;;
5
- const _mod_nycqy3 = require('./errors/rezo-error.cjs');
6
- exports.RezoError = _mod_nycqy3.RezoError;
7
- exports.RezoErrorCode = _mod_nycqy3.RezoErrorCode;;
8
- const _mod_0cy8uv = require('./utils/headers.cjs');
9
- exports.RezoHeaders = _mod_0cy8uv.RezoHeaders;;
10
- const _mod_70z3jb = require('./utils/form-data.cjs');
11
- exports.RezoFormData = _mod_70z3jb.RezoFormData;;
12
- const _mod_nh98e4 = require('./utils/cookies.cjs');
13
- exports.RezoCookieJar = _mod_nh98e4.RezoCookieJar;
14
- exports.Cookie = _mod_nh98e4.Cookie;;
15
- const _mod_8ffkly = require('./utils/curl.cjs');
16
- exports.toCurl = _mod_8ffkly.toCurl;
17
- exports.fromCurl = _mod_8ffkly.fromCurl;;
18
- const _mod_b04yh2 = require('./core/hooks.cjs');
19
- exports.createDefaultHooks = _mod_b04yh2.createDefaultHooks;
20
- exports.mergeHooks = _mod_b04yh2.mergeHooks;;
21
- const _mod_t2dau4 = require('./proxy/manager.cjs');
22
- exports.ProxyManager = _mod_t2dau4.ProxyManager;;
23
- const _mod_v8kv6x = require('./queue/index.cjs');
24
- exports.RezoQueue = _mod_v8kv6x.RezoQueue;
25
- exports.HttpQueue = _mod_v8kv6x.HttpQueue;
26
- exports.Priority = _mod_v8kv6x.Priority;
27
- exports.HttpMethodPriority = _mod_v8kv6x.HttpMethodPriority;;
1
+ const _mod_uvppc7 = require('./core/rezo.cjs');
2
+ exports.Rezo = _mod_uvppc7.Rezo;
3
+ exports.createRezoInstance = _mod_uvppc7.createRezoInstance;
4
+ exports.createDefaultInstance = _mod_uvppc7.createDefaultInstance;;
5
+ const _mod_ojscq0 = require('./errors/rezo-error.cjs');
6
+ exports.RezoError = _mod_ojscq0.RezoError;
7
+ exports.RezoErrorCode = _mod_ojscq0.RezoErrorCode;;
8
+ const _mod_4bwpyx = require('./utils/headers.cjs');
9
+ exports.RezoHeaders = _mod_4bwpyx.RezoHeaders;;
10
+ const _mod_hfzjvd = require('./utils/form-data.cjs');
11
+ exports.RezoFormData = _mod_hfzjvd.RezoFormData;;
12
+ const _mod_zu32c6 = require('./utils/cookies.cjs');
13
+ exports.RezoCookieJar = _mod_zu32c6.RezoCookieJar;
14
+ exports.Cookie = _mod_zu32c6.Cookie;;
15
+ const _mod_vifvvc = require('./utils/curl.cjs');
16
+ exports.toCurl = _mod_vifvvc.toCurl;
17
+ exports.fromCurl = _mod_vifvvc.fromCurl;;
18
+ const _mod_yrwmg8 = require('./core/hooks.cjs');
19
+ exports.createDefaultHooks = _mod_yrwmg8.createDefaultHooks;
20
+ exports.mergeHooks = _mod_yrwmg8.mergeHooks;;
21
+ const _mod_ppzbvj = require('./proxy/manager.cjs');
22
+ exports.ProxyManager = _mod_ppzbvj.ProxyManager;;
23
+ const _mod_arvo2t = require('./queue/index.cjs');
24
+ exports.RezoQueue = _mod_arvo2t.RezoQueue;
25
+ exports.HttpQueue = _mod_arvo2t.HttpQueue;
26
+ exports.Priority = _mod_arvo2t.Priority;
27
+ exports.HttpMethodPriority = _mod_arvo2t.HttpMethodPriority;;
28
28
  const { RezoError } = require('./errors/rezo-error.cjs');
29
29
  const isRezoError = exports.isRezoError = RezoError.isRezoError;
30
30
  const Cancel = exports.Cancel = RezoError;
package/dist/index.d.ts CHANGED
@@ -2254,6 +2254,8 @@ export declare class RezoQueue<T = any> {
2254
2254
  private readonly throughputWindowSize;
2255
2255
  private idlePromise?;
2256
2256
  private emptyPromise?;
2257
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2258
+ private hasEverBeenActive;
2257
2259
  readonly config: Required<QueueConfig>;
2258
2260
  /**
2259
2261
  * Create a new RezoQueue
@@ -2328,6 +2330,9 @@ export declare class RezoQueue<T = any> {
2328
2330
  }) => boolean): number;
2329
2331
  /**
2330
2332
  * Wait for queue to become idle (no running or pending tasks)
2333
+ *
2334
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2335
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2331
2336
  */
2332
2337
  onIdle(): Promise<void>;
2333
2338
  /**
@@ -1,10 +1,10 @@
1
- const _mod_i74201 = require('./base.cjs');
2
- exports.Agent = _mod_i74201.Agent;;
3
- const _mod_zuse17 = require('./http-proxy.cjs');
4
- exports.HttpProxyAgent = _mod_zuse17.HttpProxyAgent;;
5
- const _mod_jal5o3 = require('./https-proxy.cjs');
6
- exports.HttpsProxyAgent = _mod_jal5o3.HttpsProxyAgent;;
7
- const _mod_qhpd82 = require('./socks-proxy.cjs');
8
- exports.SocksProxyAgent = _mod_qhpd82.SocksProxyAgent;;
9
- const _mod_qis1ax = require('./socks-client.cjs');
10
- exports.SocksClient = _mod_qis1ax.SocksClient;;
1
+ const _mod_q7ggbs = require('./base.cjs');
2
+ exports.Agent = _mod_q7ggbs.Agent;;
3
+ const _mod_knujcd = require('./http-proxy.cjs');
4
+ exports.HttpProxyAgent = _mod_knujcd.HttpProxyAgent;;
5
+ const _mod_3dg04n = require('./https-proxy.cjs');
6
+ exports.HttpsProxyAgent = _mod_3dg04n.HttpsProxyAgent;;
7
+ const _mod_xlxqgg = require('./socks-proxy.cjs');
8
+ exports.SocksProxyAgent = _mod_xlxqgg.SocksProxyAgent;;
9
+ const _mod_l5iwmw = require('./socks-client.cjs');
10
+ exports.SocksClient = _mod_l5iwmw.SocksClient;;
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -2128,6 +2128,8 @@ declare class RezoQueue<T = any> {
2128
2128
  private readonly throughputWindowSize;
2129
2129
  private idlePromise?;
2130
2130
  private emptyPromise?;
2131
+ /** Tracks if queue has ever had work added - ensures onIdle waits for first task */
2132
+ private hasEverBeenActive;
2131
2133
  readonly config: Required<QueueConfig>;
2132
2134
  /**
2133
2135
  * Create a new RezoQueue
@@ -2202,6 +2204,9 @@ declare class RezoQueue<T = any> {
2202
2204
  }) => boolean): number;
2203
2205
  /**
2204
2206
  * Wait for queue to become idle (no running or pending tasks)
2207
+ *
2208
+ * Unlike a simple "isIdle" check, this properly waits for work to be added
2209
+ * and completed if called before any tasks are queued (matches p-queue behavior).
2205
2210
  */
2206
2211
  onIdle(): Promise<void>;
2207
2212
  /**
@@ -1,9 +1,9 @@
1
1
  const { Agent, HttpProxyAgent, HttpsProxyAgent, SocksProxyAgent } = require('../internal/agents/index.cjs');
2
2
  const { parseProxyString } = require('./parse.cjs');
3
- const _mod_8l1pku = require('./manager.cjs');
4
- exports.ProxyManager = _mod_8l1pku.ProxyManager;;
5
- const _mod_ampgfr = require('./parse.cjs');
6
- exports.parseProxyString = _mod_ampgfr.parseProxyString;;
3
+ const _mod_ah5ldr = require('./manager.cjs');
4
+ exports.ProxyManager = _mod_ah5ldr.ProxyManager;;
5
+ const _mod_ly2s4h = require('./parse.cjs');
6
+ exports.parseProxyString = _mod_ly2s4h.parseProxyString;;
7
7
  function createOptions(uri, opts) {
8
8
  if (uri instanceof URL || typeof uri === "string") {
9
9
  return {
@@ -1,4 +1,4 @@
1
- const { parseProxyString } = require('./index.cjs');
1
+ const { parseProxyString } = require('./parse.cjs');
2
2
  function generateProxyId() {
3
3
  return `proxy_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { parseProxyString } from './index.js';
1
+ import { parseProxyString } from './parse.js';
2
2
  function generateProxyId() {
3
3
  return `proxy_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
4
4
  }
@@ -1,8 +1,8 @@
1
- const _mod_3rd9kt = require('./queue.cjs');
2
- exports.RezoQueue = _mod_3rd9kt.RezoQueue;;
3
- const _mod_yfrbwq = require('./http-queue.cjs');
4
- exports.HttpQueue = _mod_yfrbwq.HttpQueue;
5
- exports.extractDomain = _mod_yfrbwq.extractDomain;;
6
- const _mod_2qwp27 = require('./types.cjs');
7
- exports.Priority = _mod_2qwp27.Priority;
8
- exports.HttpMethodPriority = _mod_2qwp27.HttpMethodPriority;;
1
+ const _mod_rypeoi = require('./queue.cjs');
2
+ exports.RezoQueue = _mod_rypeoi.RezoQueue;;
3
+ const _mod_i9q4si = require('./http-queue.cjs');
4
+ exports.HttpQueue = _mod_i9q4si.HttpQueue;
5
+ exports.extractDomain = _mod_i9q4si.extractDomain;;
6
+ const _mod_hdz18x = require('./types.cjs');
7
+ exports.Priority = _mod_hdz18x.Priority;
8
+ exports.HttpMethodPriority = _mod_hdz18x.HttpMethodPriority;;
@@ -25,6 +25,7 @@ class RezoQueue {
25
25
  throughputWindowSize = 60;
26
26
  idlePromise;
27
27
  emptyPromise;
28
+ hasEverBeenActive = false;
28
29
  config;
29
30
  constructor(config = {}) {
30
31
  this.config = {
@@ -92,6 +93,7 @@ class RezoQueue {
92
93
  });
93
94
  this.insertByPriority(task);
94
95
  this.statsData.added++;
96
+ this.hasEverBeenActive = true;
95
97
  this.emit("add", { id: task.id, priority: task.priority });
96
98
  if (this.config.autoStart && !this.isPausedFlag) {
97
99
  this.tryRunNext();
@@ -156,7 +158,7 @@ class RezoQueue {
156
158
  return count;
157
159
  }
158
160
  onIdle() {
159
- if (this.state.isIdle) {
161
+ if (this.hasEverBeenActive && this.state.isIdle) {
160
162
  return Promise.resolve();
161
163
  }
162
164
  if (!this.idlePromise) {
@@ -25,6 +25,7 @@ export class RezoQueue {
25
25
  throughputWindowSize = 60;
26
26
  idlePromise;
27
27
  emptyPromise;
28
+ hasEverBeenActive = false;
28
29
  config;
29
30
  constructor(config = {}) {
30
31
  this.config = {
@@ -92,6 +93,7 @@ export class RezoQueue {
92
93
  });
93
94
  this.insertByPriority(task);
94
95
  this.statsData.added++;
96
+ this.hasEverBeenActive = true;
95
97
  this.emit("add", { id: task.id, priority: task.priority });
96
98
  if (this.config.autoStart && !this.isPausedFlag) {
97
99
  this.tryRunNext();
@@ -156,7 +158,7 @@ export class RezoQueue {
156
158
  return count;
157
159
  }
158
160
  onIdle() {
159
- if (this.state.isIdle) {
161
+ if (this.hasEverBeenActive && this.state.isIdle) {
160
162
  return Promise.resolve();
161
163
  }
162
164
  if (!this.idlePromise) {
@@ -1,11 +1,11 @@
1
- const _mod_v16hwz = require('./event-emitter.cjs');
2
- exports.UniversalEventEmitter = _mod_v16hwz.UniversalEventEmitter;;
3
- const _mod_495yjz = require('./stream.cjs');
4
- exports.UniversalStreamResponse = _mod_495yjz.UniversalStreamResponse;
5
- exports.StreamResponse = _mod_495yjz.StreamResponse;;
6
- const _mod_rc9q4g = require('./download.cjs');
7
- exports.UniversalDownloadResponse = _mod_rc9q4g.UniversalDownloadResponse;
8
- exports.DownloadResponse = _mod_rc9q4g.DownloadResponse;;
9
- const _mod_q7jgxt = require('./upload.cjs');
10
- exports.UniversalUploadResponse = _mod_q7jgxt.UniversalUploadResponse;
11
- exports.UploadResponse = _mod_q7jgxt.UploadResponse;;
1
+ const _mod_z7z0mo = require('./event-emitter.cjs');
2
+ exports.UniversalEventEmitter = _mod_z7z0mo.UniversalEventEmitter;;
3
+ const _mod_2b14qb = require('./stream.cjs');
4
+ exports.UniversalStreamResponse = _mod_2b14qb.UniversalStreamResponse;
5
+ exports.StreamResponse = _mod_2b14qb.StreamResponse;;
6
+ const _mod_3cmp4o = require('./download.cjs');
7
+ exports.UniversalDownloadResponse = _mod_3cmp4o.UniversalDownloadResponse;
8
+ exports.DownloadResponse = _mod_3cmp4o.DownloadResponse;;
9
+ const _mod_tr15s1 = require('./upload.cjs');
10
+ exports.UniversalUploadResponse = _mod_tr15s1.UniversalUploadResponse;
11
+ exports.UploadResponse = _mod_tr15s1.UploadResponse;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rezo",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
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",