@crawlee/core 4.0.0-beta.192 → 4.0.0-beta.194

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.192",
3
+ "version": "4.0.0-beta.194",
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.192",
57
- "@crawlee/http-client": "4.0.0-beta.192",
58
- "@crawlee/types": "4.0.0-beta.192",
59
- "@crawlee/utils": "4.0.0-beta.192",
56
+ "@crawlee/fs-storage": "4.0.0-beta.194",
57
+ "@crawlee/http-client": "4.0.0-beta.194",
58
+ "@crawlee/types": "4.0.0-beta.194",
59
+ "@crawlee/utils": "4.0.0-beta.194",
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": "729823422c7168238d8b5fcf38dcb798cbf0af0b"
79
+ "gitHead": "c1f1ba3f6d24d5de59360c0616c49ce557ceb290"
80
80
  }
@@ -41,6 +41,16 @@ export interface IRequestManager extends IRequestLoader {
41
41
  * @returns `true` if anything in the composition took responsibility for the signal.
42
42
  */
43
43
  recordPacingSignal(signal: PacingSignal): boolean;
44
+ /**
45
+ * Extends the lock on a request previously handed out by `fetchNextRequest()` and still being
46
+ * processed, on storage backends that reserve requests via locking (e.g. via
47
+ * {@link CrawlingContext.extendTimeout|`context.extendTimeout`}).
48
+ *
49
+ * @returns `true` when the lock was prolonged, `false` when this manager does not lock
50
+ * requests or no longer holds this one; non-locking implementations may leave it `undefined`,
51
+ * which callers treat as `false`.
52
+ */
53
+ extendRequestProcessingTimeSecs?(request: Request, secs: number): Promise<boolean>;
44
54
  }
45
55
  /**
46
56
  * How much of the URL space a {@link PacingSignal} covers.
@@ -92,4 +92,5 @@ export declare class RequestManagerTandem implements IRequestManager {
92
92
  * @inheritdoc
93
93
  */
94
94
  recordPacingSignal(signal: PacingSignal): boolean;
95
+ extendRequestProcessingTimeSecs(request: Request, secs: number): Promise<boolean>;
95
96
  }
@@ -196,4 +196,7 @@ export class RequestManagerTandem {
196
196
  recordPacingSignal(signal) {
197
197
  return this.#resolvedRequestManager?.recordPacingSignal(signal) ?? false;
198
198
  }
199
+ async extendRequestProcessingTimeSecs(request, secs) {
200
+ return (await this.getRequestManager()).extendRequestProcessingTimeSecs?.(request, secs) ?? false;
201
+ }
199
202
  }
@@ -195,6 +195,12 @@ export declare class RequestQueue implements IStorage, IRequestManager {
195
195
  * short the reservation of a long-lived one and have its in-flight request stolen.
196
196
  */
197
197
  setExpectedRequestProcessingTimeSecs(secs: number): Promise<void>;
198
+ /**
199
+ * @inheritdoc
200
+ * Unlike {@link RequestQueue.setExpectedRequestProcessingTimeSecs}, which sizes every future lock,
201
+ * this only touches the one request it is given.
202
+ */
203
+ extendRequestProcessingTimeSecs(request: Request, secs: number): Promise<boolean>;
198
204
  /**
199
205
  * Caches information about request to beware of unneeded addRequest() calls.
200
206
  */
@@ -674,6 +674,17 @@ export class RequestQueue {
674
674
  this.#expectedRequestProcessingSecs = secs;
675
675
  await this.backend.setExpectedRequestProcessingTimeSecs?.(secs);
676
676
  }
677
+ /**
678
+ * @inheritdoc
679
+ * Unlike {@link RequestQueue.setExpectedRequestProcessingTimeSecs}, which sizes every future lock,
680
+ * this only touches the one request it is given.
681
+ */
682
+ async extendRequestProcessingTimeSecs(request, secs) {
683
+ if (!request.id) {
684
+ return false;
685
+ }
686
+ return (await this.backend.extendRequestProcessingTimeSecs?.(request.id, secs)) ?? false;
687
+ }
677
688
  /**
678
689
  * Caches information about request to beware of unneeded addRequest() calls.
679
690
  */