@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
@@ -1,307 +0,0 @@
1
- import type { BatchAddRequestsResult, Dictionary, ProcessedRequest, QueueOperationInfo, RequestQueueClient, RequestQueueInfo, StorageClient } from '@crawlee/types';
2
- import { ListDictionary, LruCache } from '@apify/datastructures';
3
- import type { Log } from '@apify/log';
4
- import { Configuration } from '../configuration.js';
5
- import type { ProxyConfiguration } from '../proxy_configuration.js';
6
- import type { InternalSource, RequestOptions, Source } from '../request.js';
7
- import { Request } from '../request.js';
8
- import type { IStorage, StorageManagerOptions } from './storage_manager.js';
9
- export declare abstract class RequestProvider implements IStorage {
10
- readonly config: Configuration;
11
- id: string;
12
- name?: string;
13
- timeoutSecs: number;
14
- clientKey: string;
15
- client: RequestQueueClient;
16
- protected proxyConfiguration?: ProxyConfiguration;
17
- log: Log;
18
- internalTimeoutMillis: number;
19
- requestLockSecs: number;
20
- assumedTotalCount: number;
21
- assumedHandledCount: number;
22
- private initialCount;
23
- protected queueHeadIds: ListDictionary<string>;
24
- protected requestCache: LruCache<RequestLruItem>;
25
- protected recentlyHandledRequestsCache: LruCache<boolean>;
26
- protected queuePausedForMigration: boolean;
27
- protected lastActivity: Date;
28
- protected isFinishedCalledWhileHeadWasNotEmpty: number;
29
- protected inProgressRequestBatchCount: number;
30
- constructor(options: InternalRequestProviderOptions, config?: Configuration);
31
- /**
32
- * Returns an offline approximation of the total number of requests in the queue (i.e. pending + handled).
33
- *
34
- * Survives restarts and actor migrations.
35
- */
36
- getTotalCount(): number;
37
- /**
38
- * Adds a request to the queue.
39
- *
40
- * If a request with the same `uniqueKey` property is already present in the queue,
41
- * it will not be updated. You can find out whether this happened from the resulting
42
- * {@link QueueOperationInfo} object.
43
- *
44
- * To add multiple requests to the queue by extracting links from a webpage,
45
- * see the {@link enqueueLinks} helper function.
46
- *
47
- * @param requestLike {@link Request} object or vanilla object with request data.
48
- * Note that the function sets the `uniqueKey` and `id` fields to the passed Request.
49
- * @param [options] Request queue operation options.
50
- */
51
- addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
52
- /**
53
- * Adds requests to the queue in batches of 25. This method will wait till all the requests are added
54
- * to the queue before resolving. You should prefer using `queue.addRequestsBatched()` or `crawler.addRequests()`
55
- * if you don't want to block the processing, as those methods will only wait for the initial 1000 requests,
56
- * start processing right after that happens, and continue adding more in the background.
57
- *
58
- * If a request passed in is already present due to its `uniqueKey` property being the same,
59
- * it will not be updated. You can find out whether this happened by finding the request in the resulting
60
- * {@link BatchAddRequestsResult} object.
61
- *
62
- * @param requestsLike {@link Request} objects or vanilla objects with request data.
63
- * Note that the function sets the `uniqueKey` and `id` fields to the passed requests if missing.
64
- * @param [options] Request queue operation options.
65
- */
66
- addRequests(requestsLike: Source[], options?: RequestQueueOperationOptions): Promise<BatchAddRequestsResult>;
67
- /**
68
- * Adds requests to the queue in batches. By default, it will resolve after the initial batch is added, and continue
69
- * adding the rest in the background. You can configure the batch size via `batchSize` option and the sleep time in between
70
- * the batches via `waitBetweenBatchesMillis`. If you want to wait for all batches to be added to the queue, you can use
71
- * the `waitForAllRequestsToBeAdded` promise you get in the response object.
72
- *
73
- * @param requests The requests to add
74
- * @param options Options for the request queue
75
- */
76
- addRequestsBatched(requests: (string | Source)[], options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
77
- /**
78
- * Gets the request from the queue specified by ID.
79
- *
80
- * @param id ID of the request.
81
- * @returns Returns the request object, or `null` if it was not found.
82
- */
83
- getRequest<T extends Dictionary = Dictionary>(id: string): Promise<Request<T> | null>;
84
- /**
85
- * Returns a next request in the queue to be processed, or `null` if there are no more pending requests.
86
- *
87
- * Once you successfully finish processing of the request, you need to call
88
- * {@link RequestQueue.markRequestHandled}
89
- * to mark the request as handled in the queue. If there was some error in processing the request,
90
- * call {@link RequestQueue.reclaimRequest} instead,
91
- * so that the queue will give the request to some other consumer in another call to the `fetchNextRequest` function.
92
- *
93
- * Note that the `null` return value doesn't mean the queue processing finished,
94
- * it means there are currently no pending requests.
95
- * To check whether all requests in queue were finished,
96
- * use {@link RequestQueue.isFinished} instead.
97
- *
98
- * @returns
99
- * Returns the request object or `null` if there are no more pending requests.
100
- */
101
- abstract fetchNextRequest<T extends Dictionary = Dictionary>(options?: RequestOptions): Promise<Request<T> | null>;
102
- /**
103
- * Marks a request that was previously returned by the
104
- * {@link RequestQueue.fetchNextRequest}
105
- * function as handled after successful processing.
106
- * Handled requests will never again be returned by the `fetchNextRequest` function.
107
- */
108
- markRequestHandled(request: Request): Promise<RequestQueueOperationInfo | null>;
109
- /**
110
- * Reclaims a failed request back to the queue, so that it can be returned for processing later again
111
- * by another call to {@link RequestQueue.fetchNextRequest}.
112
- * The request record in the queue is updated using the provided `request` parameter.
113
- * For example, this lets you store the number of retries or error messages for the request.
114
- */
115
- reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
116
- protected abstract ensureHeadIsNonEmpty(): Promise<void>;
117
- /**
118
- * Resolves to `true` if the next call to {@link RequestQueue.fetchNextRequest}
119
- * would return `null`, otherwise it resolves to `false`.
120
- * Note that even if the queue is empty, there might be some pending requests currently being processed.
121
- * If you need to ensure that there is no activity in the queue, use {@link RequestQueue.isFinished}.
122
- */
123
- isEmpty(): Promise<boolean>;
124
- /**
125
- * Resolves to `true` if all requests were already handled and there are no more left.
126
- * Due to the nature of distributed storage used by the queue,
127
- * the function may occasionally return a false negative,
128
- * but it shall never return a false positive.
129
- */
130
- abstract isFinished(): Promise<boolean>;
131
- protected _reset(): void;
132
- /**
133
- * Caches information about request to beware of unneeded addRequest() calls.
134
- */
135
- protected _cacheRequest(cacheKey: string, queueOperationInfo: RequestQueueOperationInfo): void;
136
- /**
137
- * Adds a request straight to the queueHeadDict, to improve performance.
138
- */
139
- protected _maybeAddRequestToQueueHead(requestId: string, forefront: boolean): void;
140
- /**
141
- * Removes the queue either from the Apify Cloud storage or from the local database,
142
- * depending on the mode of operation.
143
- */
144
- drop(): Promise<void>;
145
- /**
146
- * Returns the number of handled requests.
147
- *
148
- * This function is just a convenient shortcut for:
149
- *
150
- * ```javascript
151
- * const { handledRequestCount } = await queue.getInfo();
152
- * ```
153
- */
154
- handledCount(): Promise<number>;
155
- /**
156
- * Returns an object containing general information about the request queue.
157
- *
158
- * The function returns the same object as the Apify API Client's
159
- * [getQueue](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues)
160
- * function, which in turn calls the
161
- * [Get request queue](https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue)
162
- * API endpoint.
163
- *
164
- * **Example:**
165
- * ```
166
- * {
167
- * id: "WkzbQMuFYuamGv3YF",
168
- * name: "my-queue",
169
- * userId: "wRsJZtadYvn4mBZmm",
170
- * createdAt: new Date("2015-12-12T07:34:14.202Z"),
171
- * modifiedAt: new Date("2015-12-13T08:36:13.202Z"),
172
- * accessedAt: new Date("2015-12-14T08:36:13.202Z"),
173
- * totalRequestCount: 25,
174
- * handledRequestCount: 5,
175
- * pendingRequestCount: 20,
176
- * }
177
- * ```
178
- */
179
- getInfo(): Promise<RequestQueueInfo | undefined>;
180
- /**
181
- * Fetches URLs from requestsFromUrl and returns them in format of list of requests
182
- */
183
- protected _fetchRequestsFromUrl(source: InternalSource): Promise<RequestOptions[]>;
184
- /**
185
- * Adds all fetched requests from a URL from a remote resource.
186
- */
187
- protected _addFetchedRequests(source: InternalSource, fetchedRequests: RequestOptions[], options: RequestQueueOperationOptions): Promise<ProcessedRequest[]>;
188
- /**
189
- * @internal wraps public utility for mocking purposes
190
- */
191
- private _downloadListOfUrls;
192
- /**
193
- * Opens a request queue and returns a promise resolving to an instance
194
- * of the {@link RequestQueue} class.
195
- *
196
- * {@link RequestQueue} represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud.
197
- * The queue is used for deep crawling of websites, where you start with several URLs and then
198
- * recursively follow links to other pages. The data structure supports both breadth-first
199
- * and depth-first crawling orders.
200
- *
201
- * For more details and code examples, see the {@link RequestQueue} class.
202
- *
203
- * @param [queueIdOrName]
204
- * ID or name of the request queue to be opened. If `null` or `undefined`,
205
- * the function returns the default request queue associated with the crawler run.
206
- * @param [options] Open Request Queue options.
207
- */
208
- static open(queueIdOrName?: string | null, options?: StorageManagerOptions): Promise<RequestProvider>;
209
- }
210
- interface RequestLruItem {
211
- uniqueKey: string;
212
- isHandled: boolean;
213
- id: string;
214
- hydrated: Request | null;
215
- lockExpiresAt: number | null;
216
- forefront: boolean;
217
- }
218
- export interface RequestProviderOptions {
219
- id: string;
220
- name?: string;
221
- client: StorageClient;
222
- /**
223
- * Used to pass the proxy configuration for the `requestsFromUrl` objects.
224
- * Takes advantage of the internal address rotation and authentication process.
225
- * If undefined, the `requestsFromUrl` requests will be made without proxy.
226
- */
227
- proxyConfiguration?: ProxyConfiguration;
228
- }
229
- /**
230
- * @deprecated Use {@link RequestProviderOptions} instead.
231
- */
232
- export interface RequestQueueOptions extends RequestProviderOptions {
233
- }
234
- /**
235
- * @internal
236
- */
237
- export interface InternalRequestProviderOptions extends RequestProviderOptions {
238
- logPrefix: string;
239
- requestCacheMaxSize: number;
240
- recentlyHandledRequestsMaxSize: number;
241
- }
242
- export interface RequestQueueOperationOptions {
243
- /**
244
- * If set to `true`:
245
- * - while adding the request to the queue: the request will be added to the foremost position in the queue.
246
- * - while reclaiming the request: the request will be placed to the beginning of the queue, so that it's returned
247
- * in the next call to {@link RequestQueue.fetchNextRequest}.
248
- * By default, it's put to the end of the queue.
249
- *
250
- * In case the request is already present in the queue, this option has no effect.
251
- *
252
- * If more requests are added with this option at once, their order in the following `fetchNextRequest` call
253
- * is arbitrary.
254
- * @default false
255
- */
256
- forefront?: boolean;
257
- /**
258
- * Should the requests be added to the local LRU cache?
259
- * @default false
260
- * @internal
261
- */
262
- cache?: boolean;
263
- }
264
- /**
265
- * @internal
266
- */
267
- export interface RequestQueueOperationInfo extends QueueOperationInfo {
268
- uniqueKey: string;
269
- forefront: boolean;
270
- }
271
- export interface AddRequestsBatchedOptions extends RequestQueueOperationOptions {
272
- /**
273
- * Whether to wait for all the provided requests to be added, instead of waiting just for the initial batch of up to `batchSize`.
274
- * @default false
275
- */
276
- waitForAllRequestsToBeAdded?: boolean;
277
- /**
278
- * @default 1000
279
- */
280
- batchSize?: number;
281
- /**
282
- * @default 1000
283
- */
284
- waitBetweenBatchesMillis?: number;
285
- }
286
- export interface AddRequestsBatchedResult {
287
- addedRequests: ProcessedRequest[];
288
- /**
289
- * A promise which will resolve with the rest of the requests that were added to the queue.
290
- *
291
- * Alternatively, we can set {@link AddRequestsBatchedOptions.waitForAllRequestsToBeAdded|`waitForAllRequestsToBeAdded`} to `true`
292
- * in the {@link BasicCrawler.addRequests|`crawler.addRequests()`} options.
293
- *
294
- * **Example:**
295
- *
296
- * ```ts
297
- * // Assuming `requests` is a list of requests.
298
- * const result = await crawler.addRequests(requests);
299
- *
300
- * // If we want to wait for the rest of the requests to be added to the queue:
301
- * await result.waitForAllRequestsToBeAdded;
302
- * ```
303
- */
304
- waitForAllRequestsToBeAdded: Promise<ProcessedRequest[]>;
305
- }
306
- export {};
307
- //# sourceMappingURL=request_provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request_provider.d.ts","sourceRoot":"","sources":["../../src/storages/request_provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAChB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAA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