@crawlee/core 4.0.0-beta.92 → 4.0.0-beta.93

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.
@@ -1,11 +1,10 @@
1
1
  import type { ConcurrencyConsumer, IConcurrencySystem } from './concurrency_system.js';
2
2
  import type { CrawleeLogger } from '../log.js';
3
3
  /**
4
- * The task-readiness predicates a consumer may supply to steer an {@link AutoscaledPool}'s run loop the parts of
5
- * the loop a higher-level driver (e.g. a crawler) legitimately overrides, as opposed to the crawler-owned
6
- * `runTaskFunction`.
4
+ * The two predicates that steer a task loop: *is there work ready?* and *are we done?* These are the parts of the loop
5
+ * a caller legitimately overrides, as opposed to the task itself (`runTaskFunction`), which the loop's driver owns.
7
6
  */
8
- export interface AutoscaledPoolPredicateOptions {
7
+ export interface TaskLoopPredicates {
9
8
  /**
10
9
  * A function that indicates whether `runTaskFunction` should be called.
11
10
  * This function is called every time there is free capacity for a new task and it should
@@ -15,14 +14,14 @@ export interface AutoscaledPoolPredicateOptions {
15
14
  isTaskReadyFunction?: () => Promise<boolean>;
16
15
  /**
17
16
  * A function that is called only when there are no tasks to be processed.
18
- * If it resolves to `true` then the pool's run finishes. Being called only
17
+ * If it resolves to `true` then the run finishes. Being called only
19
18
  * when there are no tasks being processed means that as long as `isTaskReadyFunction()`
20
19
  * keeps resolving to `true`, `isFinishedFunction()` will never be called.
21
- * To abort a run, use the {@link AutoscaledPool.abort} method.
22
20
  */
23
21
  isFinishedFunction?: () => Promise<boolean>;
24
22
  }
25
- export interface AutoscaledPoolOptions extends AutoscaledPoolPredicateOptions {
23
+ /** @internal */
24
+ export interface AutoscaledPoolOptions extends TaskLoopPredicates {
26
25
  /**
27
26
  * The governor that decides whether there is free compute for one more task. Typically a
28
27
  * {@link ConcurrencySystem}, but any {@link IConcurrencySystem} works. Share a single instance across
@@ -62,8 +61,8 @@ export interface AutoscaledPoolOptions extends AutoscaledPoolPredicateOptions {
62
61
  *
63
62
  * Before running the pool, you need to implement the following three functions:
64
63
  * {@link AutoscaledPoolOptions.runTaskFunction|`runTaskFunction`},
65
- * {@link AutoscaledPoolPredicateOptions.isTaskReadyFunction|`isTaskReadyFunction`} and
66
- * {@link AutoscaledPoolPredicateOptions.isFinishedFunction|`isFinishedFunction`}.
64
+ * {@link TaskLoopPredicates.isTaskReadyFunction|`isTaskReadyFunction`} and
65
+ * {@link TaskLoopPredicates.isFinishedFunction|`isFinishedFunction`}.
67
66
  *
68
67
  * The auto-scaled pool is started by calling the {@link AutoscaledPool.run} function.
69
68
  * The pool periodically queries `isTaskReadyFunction` for more tasks, managing optimal concurrency, until the function
@@ -104,7 +103,8 @@ export interface AutoscaledPoolOptions extends AutoscaledPoolPredicateOptions {
104
103
  * await concurrencySystem.stop();
105
104
  * }
106
105
  * ```
107
- * @category Scaling
106
+ *
107
+ * @internal
108
108
  */
109
109
  export declare class AutoscaledPool {
110
110
  private readonly log;
@@ -10,8 +10,8 @@ import { serviceLocator } from '../service_locator.js';
10
10
  *
11
11
  * Before running the pool, you need to implement the following three functions:
12
12
  * {@link AutoscaledPoolOptions.runTaskFunction|`runTaskFunction`},
13
- * {@link AutoscaledPoolPredicateOptions.isTaskReadyFunction|`isTaskReadyFunction`} and
14
- * {@link AutoscaledPoolPredicateOptions.isFinishedFunction|`isFinishedFunction`}.
13
+ * {@link TaskLoopPredicates.isTaskReadyFunction|`isTaskReadyFunction`} and
14
+ * {@link TaskLoopPredicates.isFinishedFunction|`isFinishedFunction`}.
15
15
  *
16
16
  * The auto-scaled pool is started by calling the {@link AutoscaledPool.run} function.
17
17
  * The pool periodically queries `isTaskReadyFunction` for more tasks, managing optimal concurrency, until the function
@@ -52,7 +52,8 @@ import { serviceLocator } from '../service_locator.js';
52
52
  * await concurrencySystem.stop();
53
53
  * }
54
54
  * ```
55
- * @category Scaling
55
+ *
56
+ * @internal
56
57
  */
57
58
  export class AutoscaledPool {
58
59
  log;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.92",
3
+ "version": "4.0.0-beta.93",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -53,9 +53,9 @@
53
53
  "@apify/pseudo_url": "^2.0.59",
54
54
  "@apify/timeout": "^0.3.2",
55
55
  "@apify/utilities": "^2.15.5",
56
- "@crawlee/fs-storage": "4.0.0-beta.92",
57
- "@crawlee/types": "4.0.0-beta.92",
58
- "@crawlee/utils": "4.0.0-beta.92",
56
+ "@crawlee/fs-storage": "4.0.0-beta.93",
57
+ "@crawlee/types": "4.0.0-beta.93",
58
+ "@crawlee/utils": "4.0.0-beta.93",
59
59
  "@sapphire/async-queue": "^1.5.5",
60
60
  "@sapphire/shapeshift": "^4.0.0",
61
61
  "@vladfrangu/async_event_emitter": "^2.4.6",
@@ -79,5 +79,5 @@
79
79
  }
80
80
  }
81
81
  },
82
- "gitHead": "9470e6cd2fe57b354ba30643a2348f2e737c37fe"
82
+ "gitHead": "b9d21e80d94d01e21d4e1c19191610d0157dd172"
83
83
  }