@crawlee/core 4.0.0-beta.179 → 4.0.0-beta.180

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.179",
3
+ "version": "4.0.0-beta.180",
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,10 +53,10 @@
53
53
  "@apify/log": "^3.0.1",
54
54
  "@apify/timeout": "^1.0.1",
55
55
  "@apify/utilities": "^3.0.1",
56
- "@crawlee/fs-storage": "4.0.0-beta.179",
57
- "@crawlee/http-client": "4.0.0-beta.179",
58
- "@crawlee/types": "4.0.0-beta.179",
59
- "@crawlee/utils": "4.0.0-beta.179",
56
+ "@crawlee/fs-storage": "4.0.0-beta.180",
57
+ "@crawlee/http-client": "4.0.0-beta.180",
58
+ "@crawlee/types": "4.0.0-beta.180",
59
+ "@crawlee/utils": "4.0.0-beta.180",
60
60
  "@sapphire/async-queue": "^1.5.5",
61
61
  "@standard-schema/spec": "^1.0.0",
62
62
  "@vladfrangu/async_event_emitter": "^2.4.6",
@@ -76,5 +76,5 @@
76
76
  }
77
77
  }
78
78
  },
79
- "gitHead": "8b7816439436b46bad1007a48df9e8bef0564bd0"
79
+ "gitHead": "4adb7b0a96ee16824ee53d18f437961d9287f977"
80
80
  }
@@ -1,5 +1,6 @@
1
- import type { Configuration, CrawleeLogger } from '@crawlee/core';
2
- import { KeyValueStore } from '@crawlee/core';
1
+ import type { Configuration } from './configuration.js';
2
+ import type { CrawleeLogger } from './log.js';
3
+ import { KeyValueStore } from './storages/key_value_store.js';
3
4
  import type { Awaitable } from '@crawlee/types';
4
5
  import type { StandardSchemaV1 } from '@standard-schema/spec';
5
6
  /**
@@ -1,5 +1,8 @@
1
1
  import { addTimeoutToPromise, storage as timeoutStorage } from '@apify/timeout';
2
- import { EventType, KeyValueStore, serviceLocator, StateValidationError } from '@crawlee/core';
2
+ import { StateValidationError } from './errors.js';
3
+ import { EventType } from './events/event_manager.js';
4
+ import { serviceLocator } from './service_locator.js';
5
+ import { KeyValueStore } from './storages/key_value_store.js';
3
6
  const DEFAULT_PERSISTENCE_TIMEOUT_MILLIS = 60_000;
4
7
  /**
5
8
  * Applies a {@link SyncStateConversion}, throwing a {@link StateValidationError} for a schema that rejects
@@ -59,7 +59,7 @@ export declare function joinRequestSourceStatuses(a: RequestSourceStatus, b: Req
59
59
  * "finished with this request", whether processing succeeded or was abandoned after exhausting retries.
60
60
  *
61
61
  * Honoring this contract matters for three reasons:
62
- * - **Restarts and migrations:** loaders that persist their state (see {@link IRequestLoader.persistState})
62
+ * - **Restarts and migrations:** loaders that persist their state (such as {@link RequestList})
63
63
  * treat in-progress requests as interrupted and re-serve them after a restart. A request that is fetched
64
64
  * but never marked handled will be crawled again.
65
65
  * - **Termination detection:** {@link IRequestLoader.checkReadiness} only reports `finished` once nothing is
@@ -117,12 +117,6 @@ export interface IRequestLoader {
117
117
  * {@link IRequestLoader}.
118
118
  */
119
119
  markRequestAsHandled(request: Request): Promise<RequestQueueOperationInfo | void | null>;
120
- /**
121
- * Persists the current state of the loader into the default {@link KeyValueStore}.
122
- *
123
- * Not all loaders support persistence; implementations that do not should leave this `undefined`.
124
- */
125
- persistState?(): Promise<void>;
126
120
  /**
127
121
  * Combines the loader with a request manager to support adding and reclaiming requests.
128
122
  *
@@ -73,11 +73,6 @@ export declare class RequestManagerTandem implements IRequestManager {
73
73
  * @inheritdoc
74
74
  */
75
75
  addRequestsBatched(requests: RequestsLike, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
76
- /**
77
- * Persists the state of the underlying read-only loader, if it supports persistence.
78
- * @inheritdoc
79
- */
80
- persistState(): Promise<void>;
81
76
  /**
82
77
  * Purges the writable request manager so the tandem can be reused (e.g. across repeated `crawler.run()` calls).
83
78
  * The read-only loader is immutable and cannot be purged, so only the manager side is reset.
@@ -170,13 +170,6 @@ export class RequestManagerTandem {
170
170
  async addRequestsBatched(requests, options) {
171
171
  return (await this.getRequestManager()).addRequestsBatched(requests, options);
172
172
  }
173
- /**
174
- * Persists the state of the underlying read-only loader, if it supports persistence.
175
- * @inheritdoc
176
- */
177
- async persistState() {
178
- await this.#requestLoader.persistState?.();
179
- }
180
173
  /**
181
174
  * Purges the writable request manager so the tandem can be reused (e.g. across repeated `crawler.run()` calls).
182
175
  * The read-only loader is immutable and cannot be purged, so only the manager side is reset.
package/validators.js CHANGED
@@ -7,7 +7,7 @@ export const validators = {
7
7
  // Naming it browser page for future proofing with Playwright
8
8
  browserPage: schemas.objectWithKeys(['goto', 'evaluate', '$', 'on'], 'Expected a Puppeteer Page, got something else.'),
9
9
  proxyConfiguration: schemas.objectWithKeys(['newProxyInfo'], "Expected an object implementing the IProxyConfiguration interface (missing 'newProxyInfo'), got something else."),
10
- requestList: schemas.objectWithKeys(['fetchNextRequest', 'persistState'], 'Expected a RequestList, got something else.'),
10
+ requestList: schemas.objectWithKeys(['fetchNextRequest', 'checkReadiness'], 'Expected a RequestList, got something else.'),
11
11
  requestQueue: schemas.objectWithKeys(['fetchNextRequest', 'addRequest'], 'Expected a RequestQueue, got something else.'),
12
12
  browserPool: schemas.objectWithKeys(['newPage', 'closePage', 'extractPageState', 'injectPageState'], "Expected an object implementing the IBrowserPool interface (missing one of 'newPage', 'closePage', 'extractPageState', 'injectPageState'), got something else."),
13
13
  sessionPool: schemas.objectWithKeys(['getSession'], "Expected an object implementing the ISessionPool interface (missing 'getSession'), got something else."),