@crawlee/core 4.0.0-beta.7 → 4.0.0-beta.71

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.
Files changed (253) hide show
  1. package/README.md +17 -13
  2. package/autoscaling/autoscaled_pool.d.ts +3 -5
  3. package/autoscaling/autoscaled_pool.d.ts.map +1 -1
  4. package/autoscaling/autoscaled_pool.js +3 -9
  5. package/autoscaling/autoscaled_pool.js.map +1 -1
  6. package/autoscaling/snapshotter.d.ts +3 -13
  7. package/autoscaling/snapshotter.d.ts.map +1 -1
  8. package/autoscaling/snapshotter.js +18 -29
  9. package/autoscaling/snapshotter.js.map +1 -1
  10. package/autoscaling/system_status.d.ts +0 -3
  11. package/autoscaling/system_status.d.ts.map +1 -1
  12. package/autoscaling/system_status.js +2 -3
  13. package/autoscaling/system_status.js.map +1 -1
  14. package/configuration.d.ts +88 -227
  15. package/configuration.d.ts.map +1 -1
  16. package/configuration.js +162 -223
  17. package/configuration.js.map +1 -1
  18. package/cookie_utils.d.ts +4 -2
  19. package/cookie_utils.d.ts.map +1 -1
  20. package/cookie_utils.js +18 -12
  21. package/cookie_utils.js.map +1 -1
  22. package/crawlers/context_pipeline.d.ts +71 -0
  23. package/crawlers/context_pipeline.d.ts.map +1 -0
  24. package/crawlers/context_pipeline.js +123 -0
  25. package/crawlers/context_pipeline.js.map +1 -0
  26. package/crawlers/crawler_commons.d.ts +20 -29
  27. package/crawlers/crawler_commons.d.ts.map +1 -1
  28. package/crawlers/crawler_commons.js +12 -20
  29. package/crawlers/crawler_commons.js.map +1 -1
  30. package/crawlers/crawler_utils.d.ts +2 -2
  31. package/crawlers/crawler_utils.d.ts.map +1 -1
  32. package/crawlers/crawler_utils.js +1 -1
  33. package/crawlers/crawler_utils.js.map +1 -1
  34. package/crawlers/error_snapshotter.d.ts +3 -2
  35. package/crawlers/error_snapshotter.d.ts.map +1 -1
  36. package/crawlers/error_snapshotter.js +2 -2
  37. package/crawlers/error_snapshotter.js.map +1 -1
  38. package/crawlers/error_tracker.d.ts +2 -1
  39. package/crawlers/error_tracker.d.ts.map +1 -1
  40. package/crawlers/error_tracker.js.map +1 -1
  41. package/crawlers/index.d.ts +1 -1
  42. package/crawlers/index.d.ts.map +1 -1
  43. package/crawlers/index.js +1 -1
  44. package/crawlers/index.js.map +1 -1
  45. package/crawlers/internals/types.d.ts +8 -0
  46. package/crawlers/internals/types.d.ts.map +1 -0
  47. package/crawlers/internals/types.js +2 -0
  48. package/crawlers/internals/types.js.map +1 -0
  49. package/crawlers/statistics.d.ts +16 -16
  50. package/crawlers/statistics.d.ts.map +1 -1
  51. package/crawlers/statistics.js +22 -25
  52. package/crawlers/statistics.js.map +1 -1
  53. package/enqueue_links/enqueue_links.d.ts +36 -21
  54. package/enqueue_links/enqueue_links.d.ts.map +1 -1
  55. package/enqueue_links/enqueue_links.js +47 -26
  56. package/enqueue_links/enqueue_links.js.map +1 -1
  57. package/enqueue_links/shared.d.ts +25 -8
  58. package/enqueue_links/shared.d.ts.map +1 -1
  59. package/enqueue_links/shared.js +69 -37
  60. package/enqueue_links/shared.js.map +1 -1
  61. package/errors.d.ts +33 -3
  62. package/errors.d.ts.map +1 -1
  63. package/errors.js +48 -4
  64. package/errors.js.map +1 -1
  65. package/events/event_manager.d.ts +34 -7
  66. package/events/event_manager.d.ts.map +1 -1
  67. package/events/event_manager.js +8 -9
  68. package/events/event_manager.js.map +1 -1
  69. package/events/local_event_manager.d.ts +14 -4
  70. package/events/local_event_manager.d.ts.map +1 -1
  71. package/events/local_event_manager.js +33 -39
  72. package/events/local_event_manager.js.map +1 -1
  73. package/index.d.ts +4 -2
  74. package/index.d.ts.map +1 -1
  75. package/index.js +3 -1
  76. package/index.js.map +1 -1
  77. package/log.d.ts +82 -2
  78. package/log.d.ts.map +1 -1
  79. package/log.js +102 -0
  80. package/log.js.map +1 -1
  81. package/memory-storage/consts.d.ts +5 -0
  82. package/memory-storage/consts.d.ts.map +1 -0
  83. package/memory-storage/consts.js +5 -0
  84. package/memory-storage/consts.js.map +1 -0
  85. package/memory-storage/index.d.ts +2 -0
  86. package/memory-storage/index.d.ts.map +1 -0
  87. package/memory-storage/index.js +2 -0
  88. package/memory-storage/index.js.map +1 -0
  89. package/memory-storage/memory-storage.d.ts +47 -0
  90. package/memory-storage/memory-storage.d.ts.map +1 -0
  91. package/memory-storage/memory-storage.js +137 -0
  92. package/memory-storage/memory-storage.js.map +1 -0
  93. package/memory-storage/resource-clients/common/base-client.d.ts +5 -0
  94. package/memory-storage/resource-clients/common/base-client.d.ts.map +1 -0
  95. package/memory-storage/resource-clients/common/base-client.js +7 -0
  96. package/memory-storage/resource-clients/common/base-client.js.map +1 -0
  97. package/memory-storage/resource-clients/dataset.d.ts +41 -0
  98. package/memory-storage/resource-clients/dataset.d.ts.map +1 -0
  99. package/memory-storage/resource-clients/dataset.js +114 -0
  100. package/memory-storage/resource-clients/dataset.js.map +1 -0
  101. package/memory-storage/resource-clients/key-value-store.d.ts +64 -0
  102. package/memory-storage/resource-clients/key-value-store.d.ts.map +1 -0
  103. package/memory-storage/resource-clients/key-value-store.js +204 -0
  104. package/memory-storage/resource-clients/key-value-store.js.map +1 -0
  105. package/memory-storage/resource-clients/request-queue.d.ts +97 -0
  106. package/memory-storage/resource-clients/request-queue.d.ts.map +1 -0
  107. package/memory-storage/resource-clients/request-queue.js +422 -0
  108. package/memory-storage/resource-clients/request-queue.js.map +1 -0
  109. package/memory-storage/utils.d.ts +12 -0
  110. package/memory-storage/utils.d.ts.map +1 -0
  111. package/memory-storage/utils.js +28 -0
  112. package/memory-storage/utils.js.map +1 -0
  113. package/package.json +12 -10
  114. package/proxy_configuration.d.ts +14 -148
  115. package/proxy_configuration.d.ts.map +1 -1
  116. package/proxy_configuration.js +19 -167
  117. package/proxy_configuration.js.map +1 -1
  118. package/recoverable_state.d.ts +121 -0
  119. package/recoverable_state.d.ts.map +1 -0
  120. package/recoverable_state.js +142 -0
  121. package/recoverable_state.js.map +1 -0
  122. package/request.d.ts +84 -12
  123. package/request.d.ts.map +1 -1
  124. package/request.js +107 -27
  125. package/request.js.map +1 -1
  126. package/router.d.ts.map +1 -1
  127. package/router.js.map +1 -1
  128. package/serialization.js +1 -1
  129. package/serialization.js.map +1 -1
  130. package/service_locator.d.ts +157 -0
  131. package/service_locator.d.ts.map +1 -0
  132. package/service_locator.js +239 -0
  133. package/service_locator.js.map +1 -0
  134. package/session_pool/consts.d.ts +1 -1
  135. package/session_pool/consts.d.ts.map +1 -1
  136. package/session_pool/consts.js +1 -1
  137. package/session_pool/consts.js.map +1 -1
  138. package/session_pool/fingerprint.d.ts +10 -0
  139. package/session_pool/fingerprint.d.ts.map +1 -0
  140. package/session_pool/fingerprint.js +31 -0
  141. package/session_pool/fingerprint.js.map +1 -0
  142. package/session_pool/index.d.ts +0 -1
  143. package/session_pool/index.d.ts.map +1 -1
  144. package/session_pool/index.js +0 -1
  145. package/session_pool/index.js.map +1 -1
  146. package/session_pool/session.d.ts +35 -72
  147. package/session_pool/session.d.ts.map +1 -1
  148. package/session_pool/session.js +46 -98
  149. package/session_pool/session.js.map +1 -1
  150. package/session_pool/session_pool.d.ts +71 -71
  151. package/session_pool/session_pool.d.ts.map +1 -1
  152. package/session_pool/session_pool.js +111 -99
  153. package/session_pool/session_pool.js.map +1 -1
  154. package/storages/access_checking.d.ts.map +1 -1
  155. package/storages/access_checking.js +5 -1
  156. package/storages/access_checking.js.map +1 -1
  157. package/storages/dataset.d.ts +98 -47
  158. package/storages/dataset.d.ts.map +1 -1
  159. package/storages/dataset.js +166 -123
  160. package/storages/dataset.js.map +1 -1
  161. package/storages/index.d.ts +8 -6
  162. package/storages/index.d.ts.map +1 -1
  163. package/storages/index.js +6 -6
  164. package/storages/index.js.map +1 -1
  165. package/storages/key_value_store.d.ts +163 -33
  166. package/storages/key_value_store.d.ts.map +1 -1
  167. package/storages/key_value_store.js +267 -119
  168. package/storages/key_value_store.js.map +1 -1
  169. package/storages/key_value_store_codec.d.ts +33 -0
  170. package/storages/key_value_store_codec.d.ts.map +1 -0
  171. package/storages/key_value_store_codec.js +114 -0
  172. package/storages/key_value_store_codec.js.map +1 -0
  173. package/storages/request_list.d.ts +32 -81
  174. package/storages/request_list.d.ts.map +1 -1
  175. package/storages/request_list.js +49 -39
  176. package/storages/request_list.js.map +1 -1
  177. package/storages/request_loader.d.ts +97 -0
  178. package/storages/request_loader.d.ts.map +1 -0
  179. package/storages/request_loader.js +2 -0
  180. package/storages/request_loader.js.map +1 -0
  181. package/storages/request_manager.d.ts +34 -0
  182. package/storages/request_manager.d.ts.map +1 -0
  183. package/storages/request_manager.js +2 -0
  184. package/storages/request_manager.js.map +1 -0
  185. package/storages/request_manager_tandem.d.ts +107 -0
  186. package/storages/request_manager_tandem.d.ts.map +1 -0
  187. package/storages/request_manager_tandem.js +198 -0
  188. package/storages/request_manager_tandem.js.map +1 -0
  189. package/storages/request_queue.d.ts +282 -45
  190. package/storages/request_queue.d.ts.map +1 -1
  191. package/storages/request_queue.js +592 -213
  192. package/storages/request_queue.js.map +1 -1
  193. package/storages/{sitemap_request_list.d.ts → sitemap_request_loader.d.ts} +29 -24
  194. package/storages/sitemap_request_loader.d.ts.map +1 -0
  195. package/storages/{sitemap_request_list.js → sitemap_request_loader.js} +50 -46
  196. package/storages/sitemap_request_loader.js.map +1 -0
  197. package/storages/storage_instance_manager.d.ts +92 -0
  198. package/storages/storage_instance_manager.d.ts.map +1 -0
  199. package/storages/storage_instance_manager.js +261 -0
  200. package/storages/storage_instance_manager.js.map +1 -0
  201. package/storages/storage_stats.d.ts +49 -0
  202. package/storages/storage_stats.d.ts.map +1 -0
  203. package/storages/storage_stats.js +30 -0
  204. package/storages/storage_stats.js.map +1 -0
  205. package/storages/utils.d.ts +51 -5
  206. package/storages/utils.d.ts.map +1 -1
  207. package/storages/utils.js +60 -8
  208. package/storages/utils.js.map +1 -1
  209. package/typedefs.d.ts +1 -1
  210. package/typedefs.d.ts.map +1 -1
  211. package/validators.d.ts +8 -0
  212. package/validators.d.ts.map +1 -1
  213. package/validators.js +8 -0
  214. package/validators.js.map +1 -1
  215. package/crawlers/crawler_extension.d.ts +0 -12
  216. package/crawlers/crawler_extension.d.ts.map +0 -1
  217. package/crawlers/crawler_extension.js +0 -14
  218. package/crawlers/crawler_extension.js.map +0 -1
  219. package/http_clients/base-http-client.d.ts +0 -134
  220. package/http_clients/base-http-client.d.ts.map +0 -1
  221. package/http_clients/base-http-client.js +0 -33
  222. package/http_clients/base-http-client.js.map +0 -1
  223. package/http_clients/form-data-like.d.ts +0 -67
  224. package/http_clients/form-data-like.d.ts.map +0 -1
  225. package/http_clients/form-data-like.js +0 -5
  226. package/http_clients/form-data-like.js.map +0 -1
  227. package/http_clients/got-scraping-http-client.d.ts +0 -15
  228. package/http_clients/got-scraping-http-client.d.ts.map +0 -1
  229. package/http_clients/got-scraping-http-client.js +0 -69
  230. package/http_clients/got-scraping-http-client.js.map +0 -1
  231. package/http_clients/index.d.ts +0 -3
  232. package/http_clients/index.d.ts.map +0 -1
  233. package/http_clients/index.js +0 -3
  234. package/http_clients/index.js.map +0 -1
  235. package/session_pool/events.d.ts +0 -3
  236. package/session_pool/events.d.ts.map +0 -1
  237. package/session_pool/events.js +0 -3
  238. package/session_pool/events.js.map +0 -1
  239. package/storages/request_provider.d.ts +0 -307
  240. package/storages/request_provider.d.ts.map +0 -1
  241. package/storages/request_provider.js +0 -555
  242. package/storages/request_provider.js.map +0 -1
  243. package/storages/request_queue_v2.d.ts +0 -87
  244. package/storages/request_queue_v2.d.ts.map +0 -1
  245. package/storages/request_queue_v2.js +0 -438
  246. package/storages/request_queue_v2.js.map +0 -1
  247. package/storages/sitemap_request_list.d.ts.map +0 -1
  248. package/storages/sitemap_request_list.js.map +0 -1
  249. package/storages/storage_manager.d.ts +0 -58
  250. package/storages/storage_manager.d.ts.map +0 -1
  251. package/storages/storage_manager.js +0 -105
  252. package/storages/storage_manager.js.map +0 -1
  253. package/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,97 @@
1
+ import type { Dictionary } from '@crawlee/types';
2
+ import type { Request } from '../request.js';
3
+ import type { IRequestManager } from './request_manager.js';
4
+ import type { RequestQueueOperationInfo } from './request_queue.js';
5
+ /**
6
+ * An abstract interface defining a read-only stream of requests to crawl.
7
+ *
8
+ * Request loaders are used to manage and provide access to a storage of crawling requests.
9
+ *
10
+ * Key responsibilities:
11
+ * - Fetching the next request to be processed.
12
+ * - Marking requests as handled once they are no longer in progress.
13
+ * - Managing state information such as the total and handled request counts.
14
+ *
15
+ * ## Request lifecycle contract
16
+ *
17
+ * Every request returned by {@link IRequestLoader.fetchNextRequest} is considered **in progress**
18
+ * until it is passed to {@link IRequestLoader.markRequestAsHandled}. Once you fetch a request, you are
19
+ * obligated to eventually mark it as handled — there is no way to hand a request back to a loader
20
+ * (only an {@link IRequestManager} can reclaim requests for a retry). "Handled" therefore means
21
+ * "finished with this request", whether processing succeeded or was abandoned after exhausting retries.
22
+ *
23
+ * Honoring this contract matters for three reasons:
24
+ * - **Restarts and migrations:** loaders that persist their state (see {@link IRequestLoader.persistState})
25
+ * treat in-progress requests as interrupted and re-serve them after a restart. A request that is fetched
26
+ * but never marked handled will be crawled again.
27
+ * - **Termination detection:** {@link IRequestLoader.isFinished} only resolves to `true` once nothing is
28
+ * in progress. Leaving a request unmarked keeps the crawler running indefinitely.
29
+ * - **Bookkeeping:** the handled and pending counts are derived from the set of in-progress requests, so
30
+ * skipping {@link IRequestLoader.markRequestAsHandled} corrupts {@link IRequestLoader.getHandledCount}
31
+ * and {@link IRequestLoader.getPendingCount}.
32
+ *
33
+ * Concrete implementations such as {@link RequestList} or {@link SitemapRequestLoader} build on this interface.
34
+ * The {@link IRequestManager} interface extends it with the capability to enqueue and reclaim requests.
35
+ */
36
+ export interface IRequestLoader {
37
+ /**
38
+ * Returns an approximation of the total number of requests in the loader (i.e. pending + handled).
39
+ */
40
+ getTotalCount(): Promise<number>;
41
+ /**
42
+ * Returns an approximation of the number of pending requests in the loader.
43
+ */
44
+ getPendingCount(): Promise<number>;
45
+ /**
46
+ * Returns the number of requests in the loader that have been handled.
47
+ */
48
+ getHandledCount(): Promise<number>;
49
+ /**
50
+ * Returns `true` if all requests were already handled and there are no more left.
51
+ */
52
+ isFinished(): Promise<boolean>;
53
+ /**
54
+ * Resolves to `true` if the next call to {@link IRequestLoader.fetchNextRequest} function
55
+ * would return `null`, otherwise it resolves to `false`.
56
+ * Note that even if the loader is empty, there might be some pending requests currently being processed.
57
+ */
58
+ isEmpty(): Promise<boolean>;
59
+ /**
60
+ * Gets the next {@link Request} to process, or `null` if there are no more pending requests.
61
+ *
62
+ * The returned request is marked as **in progress** and remains so until it is passed to
63
+ * {@link IRequestLoader.markRequestAsHandled}. The caller is responsible for eventually marking
64
+ * every fetched request as handled; otherwise the loader never considers itself finished and the
65
+ * request may be re-served after a restart. See the request lifecycle contract on {@link IRequestLoader}.
66
+ */
67
+ fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
68
+ /**
69
+ * Can be used to iterate over the loader instance in a `for await .. of` loop.
70
+ * Provides an alternative for the repeated use of `fetchNextRequest`.
71
+ */
72
+ [Symbol.asyncIterator](): AsyncGenerator<Request>;
73
+ /**
74
+ * Marks a request previously returned by {@link IRequestLoader.fetchNextRequest} as handled,
75
+ * removing it from the set of in-progress requests.
76
+ *
77
+ * Call this once you are done with the request — whether processing succeeded or was abandoned after
78
+ * exhausting retries. Because a loader cannot take a request back, marking it handled is the only way to
79
+ * signal completion; failing to do so prevents {@link IRequestLoader.isFinished} from ever resolving to
80
+ * `true` and skews the handled and pending counts. See the request lifecycle contract on {@link IRequestLoader}.
81
+ */
82
+ markRequestAsHandled(request: Request): Promise<RequestQueueOperationInfo | void | null>;
83
+ /**
84
+ * Persists the current state of the loader into the default {@link KeyValueStore}.
85
+ *
86
+ * Not all loaders support persistence; implementations that do not should leave this `undefined`.
87
+ */
88
+ persistState?(): Promise<void>;
89
+ /**
90
+ * Combines the loader with a request manager to support adding and reclaiming requests.
91
+ *
92
+ * @param requestManager Request manager to combine the loader with. If not provided, the default
93
+ * {@link RequestQueue} is used.
94
+ */
95
+ toTandem?(requestManager?: IRequestManager): Promise<IRequestManager>;
96
+ }
97
+ //# sourceMappingURL=request_loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_loader.d.ts","sourceRoot":"","sources":["../../src/storages/request_loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnC;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnC;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/B;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5B;;;;;;;OAOG;IACH,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAElF;;;OAGG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAElD;;;;;;;;OAQG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAEzF;;;;OAIG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACzE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request_loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_loader.js","sourceRoot":"","sources":["../../src/storages/request_loader.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import type { Request, Source } from '../request.js';
2
+ import type { IRequestLoader } from './request_loader.js';
3
+ import type { AddRequestsBatchedOptions, AddRequestsBatchedResult, RequestQueueOperationInfo, RequestQueueOperationOptions } from './request_queue.js';
4
+ export type RequestsLike = AsyncIterable<Source | string> | Iterable<Source | string> | (Source | string)[];
5
+ /**
6
+ * Extends the read-only {@link IRequestLoader} interface with the capability to enqueue new requests
7
+ * and reclaim failed ones.
8
+ */
9
+ export interface IRequestManager extends IRequestLoader {
10
+ /**
11
+ * Reclaims request to the provider if its processing failed.
12
+ * The request will be returned by some subsequent `fetchNextRequest()` call.
13
+ */
14
+ reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
15
+ addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
16
+ addRequestsBatched(requests: RequestsLike, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
17
+ /**
18
+ * Remove all requests from the queue but keep the queue itself, resetting it
19
+ * so it can be reused (e.g. across multiple `crawler.run()` calls).
20
+ *
21
+ * Implementations that do not support purging may leave this `undefined`.
22
+ */
23
+ purge?(): Promise<void>;
24
+ /**
25
+ * Tells the manager how long a consumer expects to hold a request fetched via `fetchNextRequest()`
26
+ * before marking it handled or reclaiming it (typically the request-handler timeout plus padding).
27
+ *
28
+ * Managers backed by a storage backend that reserves requests via locking use this to avoid handing
29
+ * the same request out again while it is still being processed. Implementations that do not need
30
+ * this hint may leave it `undefined`.
31
+ */
32
+ setExpectedRequestProcessingTimeSecs?(secs: number): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=request_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_manager.d.ts","sourceRoot":"","sources":["../../src/storages/request_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EACR,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAE5G;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;IAEpH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAE5G,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAEnH;;;;;OAKG;IACH,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB;;;;;;;OAOG;IACH,oCAAoC,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request_manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_manager.js","sourceRoot":"","sources":["../../src/storages/request_manager.ts"],"names":[],"mappings":""}
@@ -0,0 +1,107 @@
1
+ import type { Dictionary } from '@crawlee/types';
2
+ import type { Request, Source } from '../request.js';
3
+ import type { IRequestLoader } from './request_loader.js';
4
+ import type { IRequestManager, RequestsLike } from './request_manager.js';
5
+ import type { AddRequestsBatchedOptions, AddRequestsBatchedResult, RequestQueueOperationInfo, RequestQueueOperationOptions } from './request_queue.js';
6
+ /**
7
+ * A request manager that combines a {@link IRequestLoader} (such as a `RequestList`) with a writable
8
+ * {@link IRequestManager} (such as a `RequestQueue`).
9
+ * It first reads requests from the loader and then, when needed, transfers them in batches to the manager.
10
+ */
11
+ export declare class RequestManagerTandem implements IRequestManager {
12
+ private log;
13
+ private requestLoader;
14
+ private requestManagerPromise?;
15
+ private resolvedRequestManager?;
16
+ private requestManagerFactory;
17
+ /**
18
+ * The latest expected request-processing time hinted via {@link setExpectedRequestProcessingTimeSecs}.
19
+ * Remembered so it can be applied to the writable manager once it is lazily resolved.
20
+ */
21
+ private expectedRequestProcessingSecs?;
22
+ /**
23
+ * @param requestLoader The read-only loader to read requests from first.
24
+ * @param requestManager The writable manager to transfer requests into and enqueue new ones. May be passed as a
25
+ * factory function so that the tandem can be constructed synchronously and the manager opened lazily on first use
26
+ * (e.g. a lazily-opened default {@link RequestQueue}).
27
+ */
28
+ constructor(requestLoader: IRequestLoader, requestManager: IRequestManager | (() => IRequestManager | Promise<IRequestManager>));
29
+ /**
30
+ * Resolves the writable request manager, opening it lazily (via the factory) on first use and memoizing the result.
31
+ * @private
32
+ */
33
+ private getRequestManager;
34
+ /**
35
+ * Transfers a single request from the read-only loader to the writable manager.
36
+ * If the transfer fails, the request is dropped (and logged) rather than reclaimed.
37
+ *
38
+ * @returns `true` if a request was successfully transferred (or there was nothing to transfer), and `false` if a
39
+ * transfer was attempted but failed - in which case the caller should not fetch from the manager this round.
40
+ * @private
41
+ */
42
+ private transferNextRequestToQueue;
43
+ /**
44
+ * Fetches the next request from the request manager. If the manager is empty and the loader
45
+ * is not finished, it will transfer a request from the loader to the manager first.
46
+ * @inheritdoc
47
+ */
48
+ fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
49
+ /**
50
+ * @inheritdoc
51
+ */
52
+ isFinished(): Promise<boolean>;
53
+ /**
54
+ * @inheritdoc
55
+ */
56
+ isEmpty(): Promise<boolean>;
57
+ /**
58
+ * @inheritdoc
59
+ */
60
+ getHandledCount(): Promise<number>;
61
+ /**
62
+ * @inheritdoc
63
+ */
64
+ getTotalCount(): Promise<number>;
65
+ /**
66
+ * @inheritdoc
67
+ */
68
+ getPendingCount(): Promise<number>;
69
+ /**
70
+ * @inheritdoc
71
+ */
72
+ [Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
73
+ /**
74
+ * @inheritdoc
75
+ */
76
+ markRequestAsHandled(request: Request): Promise<RequestQueueOperationInfo | void | null>;
77
+ /**
78
+ * @inheritdoc
79
+ */
80
+ reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
81
+ /**
82
+ * @inheritdoc
83
+ */
84
+ addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
85
+ /**
86
+ * @inheritdoc
87
+ */
88
+ addRequestsBatched(requests: RequestsLike, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
89
+ /**
90
+ * Persists the state of the underlying read-only loader, if it supports persistence.
91
+ * @inheritdoc
92
+ */
93
+ persistState(): Promise<void>;
94
+ /**
95
+ * Purges the writable request manager so the tandem can be reused (e.g. across repeated `crawler.run()` calls).
96
+ * The read-only loader is immutable and cannot be purged, so only the manager side is reset.
97
+ * @inheritdoc
98
+ */
99
+ purge(): Promise<void>;
100
+ /**
101
+ * Forwards the hint to the writable request manager — that is where requests are fetched from and
102
+ * reserved. The manager is opened lazily, so the value is remembered and applied once it resolves.
103
+ * @inheritdoc
104
+ */
105
+ setExpectedRequestProcessingTimeSecs(secs: number): Promise<void>;
106
+ }
107
+ //# sourceMappingURL=request_manager_tandem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_manager_tandem.d.ts","sourceRoot":"","sources":["../../src/storages/request_manager_tandem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EACR,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAA2B;IACzD,OAAO,CAAC,sBAAsB,CAAC,CAAkB;IAEjD,OAAO,CAAC,qBAAqB,CAAmD;IAEhF;;;OAGG;IACH,OAAO,CAAC,6BAA6B,CAAC,CAAS;IAE/C;;;;;OAKG;gBAEC,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,eAAe,GAAG,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAOxF;;;OAGG;YACW,iBAAiB;IAe/B;;;;;;;OAOG;YACW,0BAA0B;IAyBxC;;;;OAIG;IACG,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAmBvF;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAMpC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAMjC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAKxC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAUtC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IASxC;;OAEG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC;IAQ7B;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAC;IAI9F;;OAEG;IACG,cAAc,CAChB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,4BAA4B,GACvC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAI5C;;OAEG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIjH;;OAEG;IACG,kBAAkB,CACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,wBAAwB,CAAC;IAIpC;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACG,oCAAoC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI1E"}
@@ -0,0 +1,198 @@
1
+ import { serviceLocator } from '../service_locator.js';
2
+ /**
3
+ * A request manager that combines a {@link IRequestLoader} (such as a `RequestList`) with a writable
4
+ * {@link IRequestManager} (such as a `RequestQueue`).
5
+ * It first reads requests from the loader and then, when needed, transfers them in batches to the manager.
6
+ */
7
+ export class RequestManagerTandem {
8
+ log;
9
+ requestLoader;
10
+ requestManagerPromise;
11
+ resolvedRequestManager;
12
+ requestManagerFactory;
13
+ /**
14
+ * The latest expected request-processing time hinted via {@link setExpectedRequestProcessingTimeSecs}.
15
+ * Remembered so it can be applied to the writable manager once it is lazily resolved.
16
+ */
17
+ expectedRequestProcessingSecs;
18
+ /**
19
+ * @param requestLoader The read-only loader to read requests from first.
20
+ * @param requestManager The writable manager to transfer requests into and enqueue new ones. May be passed as a
21
+ * factory function so that the tandem can be constructed synchronously and the manager opened lazily on first use
22
+ * (e.g. a lazily-opened default {@link RequestQueue}).
23
+ */
24
+ constructor(requestLoader, requestManager) {
25
+ this.log = serviceLocator.getLogger().child({ prefix: 'RequestManagerTandem' });
26
+ this.requestLoader = requestLoader;
27
+ this.requestManagerFactory = typeof requestManager === 'function' ? requestManager : () => requestManager;
28
+ }
29
+ /**
30
+ * Resolves the writable request manager, opening it lazily (via the factory) on first use and memoizing the result.
31
+ * @private
32
+ */
33
+ async getRequestManager() {
34
+ if (this.resolvedRequestManager === undefined) {
35
+ this.requestManagerPromise ??= Promise.resolve(this.requestManagerFactory());
36
+ this.resolvedRequestManager = await this.requestManagerPromise;
37
+ // Apply any hint received before the manager was resolved.
38
+ if (this.expectedRequestProcessingSecs !== undefined) {
39
+ await this.resolvedRequestManager.setExpectedRequestProcessingTimeSecs?.(this.expectedRequestProcessingSecs);
40
+ }
41
+ }
42
+ return this.resolvedRequestManager;
43
+ }
44
+ /**
45
+ * Transfers a single request from the read-only loader to the writable manager.
46
+ * If the transfer fails, the request is dropped (and logged) rather than reclaimed.
47
+ *
48
+ * @returns `true` if a request was successfully transferred (or there was nothing to transfer), and `false` if a
49
+ * transfer was attempted but failed - in which case the caller should not fetch from the manager this round.
50
+ * @private
51
+ */
52
+ async transferNextRequestToQueue() {
53
+ const request = await this.requestLoader.fetchNextRequest();
54
+ if (request === null) {
55
+ return true;
56
+ }
57
+ const requestManager = await this.getRequestManager();
58
+ try {
59
+ await requestManager.addRequest(request, { forefront: true });
60
+ return true;
61
+ }
62
+ catch (error) {
63
+ this.log.exception(error, 'Adding request from the RequestLoader to the RequestManager failed, the request has been dropped.', { url: request.url, uniqueKey: request.uniqueKey });
64
+ return false;
65
+ }
66
+ finally {
67
+ // Mark it as handled so that the request doesn't get stuck in the `inProgress` state in the loader.
68
+ await this.requestLoader.markRequestAsHandled(request);
69
+ }
70
+ }
71
+ /**
72
+ * Fetches the next request from the request manager. If the manager is empty and the loader
73
+ * is not finished, it will transfer a request from the loader to the manager first.
74
+ * @inheritdoc
75
+ */
76
+ async fetchNextRequest() {
77
+ // First, try to transfer a request from the requestList
78
+ const [listEmpty, listFinished] = await Promise.all([
79
+ this.requestLoader.isEmpty(),
80
+ this.requestLoader.isFinished(),
81
+ ]);
82
+ if (!listEmpty && !listFinished) {
83
+ // If the transfer failed, the request was dropped; don't fetch from the manager this round (matching
84
+ // crawlee-python behaviour). The next `fetchNextRequest()` call will pick up where we left off.
85
+ if (!(await this.transferNextRequestToQueue())) {
86
+ return null;
87
+ }
88
+ }
89
+ // Try to fetch from manager after the transfer
90
+ return (await this.getRequestManager()).fetchNextRequest();
91
+ }
92
+ /**
93
+ * @inheritdoc
94
+ */
95
+ async isFinished() {
96
+ const requestManager = await this.getRequestManager();
97
+ const storagesFinished = await Promise.all([this.requestLoader.isFinished(), requestManager.isFinished()]);
98
+ return storagesFinished.every(Boolean);
99
+ }
100
+ /**
101
+ * @inheritdoc
102
+ */
103
+ async isEmpty() {
104
+ const requestManager = await this.getRequestManager();
105
+ const storagesEmpty = await Promise.all([this.requestLoader.isEmpty(), requestManager.isEmpty()]);
106
+ return storagesEmpty.every(Boolean);
107
+ }
108
+ /**
109
+ * @inheritdoc
110
+ */
111
+ async getHandledCount() {
112
+ // Since one of the stores needs to have priority when both are present, we query the request manager - the request loader will first be dumped into the manager and then left empty.
113
+ return (await this.getRequestManager()).getHandledCount();
114
+ }
115
+ /**
116
+ * @inheritdoc
117
+ */
118
+ async getTotalCount() {
119
+ const requestManager = await this.getRequestManager();
120
+ const [managerTotal, loaderTotal] = await Promise.all([
121
+ requestManager.getTotalCount(),
122
+ // count only pending to avoid double counting, requests marked as "handled" have been moved to requestManager
123
+ this.requestLoader.getPendingCount(),
124
+ ]);
125
+ return managerTotal + loaderTotal;
126
+ }
127
+ /**
128
+ * @inheritdoc
129
+ */
130
+ async getPendingCount() {
131
+ const requestManager = await this.getRequestManager();
132
+ const [managerPending, loaderPending] = await Promise.all([
133
+ requestManager.getPendingCount(),
134
+ this.requestLoader.getPendingCount(),
135
+ ]);
136
+ return managerPending + loaderPending;
137
+ }
138
+ /**
139
+ * @inheritdoc
140
+ */
141
+ async *[Symbol.asyncIterator]() {
142
+ while (true) {
143
+ const req = await this.fetchNextRequest();
144
+ if (!req)
145
+ break;
146
+ yield req;
147
+ }
148
+ }
149
+ /**
150
+ * @inheritdoc
151
+ */
152
+ async markRequestAsHandled(request) {
153
+ return (await this.getRequestManager()).markRequestAsHandled(request);
154
+ }
155
+ /**
156
+ * @inheritdoc
157
+ */
158
+ async reclaimRequest(request, options) {
159
+ return (await this.getRequestManager()).reclaimRequest(request, options);
160
+ }
161
+ /**
162
+ * @inheritdoc
163
+ */
164
+ async addRequest(requestLike, options) {
165
+ return (await this.getRequestManager()).addRequest(requestLike, options);
166
+ }
167
+ /**
168
+ * @inheritdoc
169
+ */
170
+ async addRequestsBatched(requests, options) {
171
+ return (await this.getRequestManager()).addRequestsBatched(requests, options);
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
+ /**
181
+ * Purges the writable request manager so the tandem can be reused (e.g. across repeated `crawler.run()` calls).
182
+ * The read-only loader is immutable and cannot be purged, so only the manager side is reset.
183
+ * @inheritdoc
184
+ */
185
+ async purge() {
186
+ await (await this.getRequestManager()).purge?.();
187
+ }
188
+ /**
189
+ * Forwards the hint to the writable request manager — that is where requests are fetched from and
190
+ * reserved. The manager is opened lazily, so the value is remembered and applied once it resolves.
191
+ * @inheritdoc
192
+ */
193
+ async setExpectedRequestProcessingTimeSecs(secs) {
194
+ this.expectedRequestProcessingSecs = secs;
195
+ await this.resolvedRequestManager?.setExpectedRequestProcessingTimeSecs?.(secs);
196
+ }
197
+ }
198
+ //# sourceMappingURL=request_manager_tandem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_manager_tandem.js","sourceRoot":"","sources":["../../src/storages/request_manager_tandem.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUvD;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACrB,GAAG,CAAgB;IACnB,aAAa,CAAiB;IAC9B,qBAAqB,CAA4B;IACjD,sBAAsB,CAAmB;IAEzC,qBAAqB,CAAmD;IAEhF;;;OAGG;IACK,6BAA6B,CAAU;IAE/C;;;;;OAKG;IACH,YACI,aAA6B,EAC7B,cAAoF;QAEpF,IAAI,CAAC,GAAG,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,qBAAqB,GAAG,OAAO,cAAc,KAAK,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC;IAC9G,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,iBAAiB;QAC3B,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,EAAE,CAAC;YAC5C,IAAI,CAAC,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,sBAAsB,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC;YAE/D,2DAA2D;YAC3D,IAAI,IAAI,CAAC,6BAA6B,KAAK,SAAS,EAAE,CAAC;gBACnD,MAAM,IAAI,CAAC,sBAAsB,CAAC,oCAAoC,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