@crawlee/core 4.0.0-beta.64 → 4.0.0-beta.66
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/crawlers/crawler_commons.d.ts +3 -3
- package/crawlers/crawler_commons.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.d.ts +7 -6
- package/enqueue_links/enqueue_links.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.js +4 -4
- package/enqueue_links/enqueue_links.js.map +1 -1
- package/package.json +5 -5
- package/storages/index.d.ts +4 -6
- package/storages/index.d.ts.map +1 -1
- package/storages/index.js +2 -6
- package/storages/index.js.map +1 -1
- package/storages/request_list.d.ts +23 -72
- package/storages/request_list.d.ts.map +1 -1
- package/storages/request_list.js +34 -29
- package/storages/request_list.js.map +1 -1
- package/storages/request_loader.d.ts +97 -0
- package/storages/request_loader.d.ts.map +1 -0
- package/storages/request_loader.js +2 -0
- package/storages/request_loader.js.map +1 -0
- package/storages/request_manager.d.ts +34 -0
- package/storages/request_manager.d.ts.map +1 -0
- package/storages/request_manager.js +2 -0
- package/storages/request_manager.js.map +1 -0
- package/storages/request_manager_tandem.d.ts +56 -17
- package/storages/request_manager_tandem.d.ts.map +1 -1
- package/storages/request_manager_tandem.js +114 -41
- package/storages/request_manager_tandem.js.map +1 -1
- package/storages/request_queue.d.ts +276 -44
- package/storages/request_queue.d.ts.map +1 -1
- package/storages/request_queue.js +576 -212
- package/storages/request_queue.js.map +1 -1
- package/storages/{sitemap_request_list.d.ts → sitemap_request_loader.d.ts} +24 -19
- package/storages/sitemap_request_loader.d.ts.map +1 -0
- package/storages/{sitemap_request_list.js → sitemap_request_loader.js} +41 -40
- package/storages/sitemap_request_loader.js.map +1 -0
- package/validators.d.ts +4 -0
- package/validators.d.ts.map +1 -1
- package/validators.js +4 -0
- package/validators.js.map +1 -1
- package/storages/request_list_adapter.d.ts +0 -58
- package/storages/request_list_adapter.d.ts.map +0 -1
- package/storages/request_list_adapter.js +0 -81
- package/storages/request_list_adapter.js.map +0 -1
- package/storages/request_provider.d.ts +0 -384
- package/storages/request_provider.d.ts.map +0 -1
- package/storages/request_provider.js +0 -624
- package/storages/request_provider.js.map +0 -1
- package/storages/request_queue_v2.d.ts +0 -87
- package/storages/request_queue_v2.d.ts.map +0 -1
- package/storages/request_queue_v2.js +0 -437
- package/storages/request_queue_v2.js.map +0 -1
- package/storages/sitemap_request_list.d.ts.map +0 -1
- package/storages/sitemap_request_list.js.map +0 -1
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import type { Dictionary } from '@crawlee/types';
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import type { BaseHttpClient, BatchAddRequestsResult, Dictionary, ProcessedRequest, QueueOperationInfo, RequestQueueClient, RequestQueueInfo } from '@crawlee/types';
|
|
2
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
3
|
+
import { LruCache } from '@apify/datastructures';
|
|
4
|
+
import { Configuration } from '../configuration.js';
|
|
5
|
+
import type { EventManager } from '../events/event_manager.js';
|
|
6
|
+
import type { CrawleeLogger } from '../log.js';
|
|
7
|
+
import type { ProxyConfiguration } from '../proxy_configuration.js';
|
|
8
|
+
import type { InternalSource, RequestOptions, Source } from '../request.js';
|
|
9
|
+
import { Request } from '../request.js';
|
|
10
|
+
import type { IRequestManager, RequestsLike } from './request_manager.js';
|
|
11
|
+
import type { IStorage, StorageIdentifier } from './storage_instance_manager.js';
|
|
12
|
+
import type { StorageOpenOptions } from './utils.js';
|
|
6
13
|
/**
|
|
7
14
|
* Represents a queue of URLs to crawl, which is used for deep crawling of websites
|
|
8
15
|
* where you start with several URLs and then recursively
|
|
@@ -21,18 +28,6 @@ import { RequestProvider } from './request_provider.js';
|
|
|
21
28
|
* Unlike {@link RequestList}, `RequestQueue` supports dynamic adding and removing of requests.
|
|
22
29
|
* On the other hand, the queue is not optimized for operations that add or remove a large number of URLs in a batch.
|
|
23
30
|
*
|
|
24
|
-
* `RequestQueue` stores its data either on local disk or in the Apify Cloud,
|
|
25
|
-
* depending on whether the `APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variable is set.
|
|
26
|
-
*
|
|
27
|
-
* If the `APIFY_LOCAL_STORAGE_DIR` environment variable is set, the queue data is stored in
|
|
28
|
-
* that directory in an SQLite database file.
|
|
29
|
-
*
|
|
30
|
-
* If the `APIFY_TOKEN` environment variable is set but `APIFY_LOCAL_STORAGE_DIR` is not, the data is stored in the
|
|
31
|
-
* [Apify Request Queue](https://docs.apify.com/storage/request-queue)
|
|
32
|
-
* cloud storage. Note that you can force usage of the cloud storage also by passing the `forceCloud`
|
|
33
|
-
* option to {@link RequestQueue.open} function,
|
|
34
|
-
* even if the `APIFY_LOCAL_STORAGE_DIR` variable is set.
|
|
35
|
-
*
|
|
36
31
|
* **Example usage:**
|
|
37
32
|
*
|
|
38
33
|
* ```javascript
|
|
@@ -49,22 +44,95 @@ import { RequestProvider } from './request_provider.js';
|
|
|
49
44
|
* ```
|
|
50
45
|
* @category Sources
|
|
51
46
|
*/
|
|
52
|
-
declare class RequestQueue
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
export declare class RequestQueue implements IStorage, IRequestManager {
|
|
48
|
+
protected readonly config: Configuration;
|
|
49
|
+
id: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
timeoutSecs: number;
|
|
52
|
+
clientKey: string;
|
|
53
|
+
client: RequestQueueClient;
|
|
54
|
+
protected proxyConfiguration?: ProxyConfiguration;
|
|
55
|
+
log: CrawleeLogger;
|
|
56
|
+
private isInitialized;
|
|
57
|
+
protected requestCache: LruCache<RequestLruItem>;
|
|
58
|
+
protected queuePausedForMigration: boolean;
|
|
59
|
+
protected inProgressRequestBatchCount: number;
|
|
55
60
|
/**
|
|
56
|
-
*
|
|
61
|
+
* The largest expected request-processing time (in seconds) seen so far via
|
|
62
|
+
* {@link setExpectedRequestProcessingTimeSecs}. Used to ensure that value is only ever raised, never
|
|
63
|
+
* lowered, before being forwarded to the storage client.
|
|
57
64
|
*/
|
|
58
|
-
|
|
65
|
+
protected expectedRequestProcessingSecs: number;
|
|
66
|
+
protected httpClient?: BaseHttpClient;
|
|
67
|
+
protected readonly events: EventManager;
|
|
59
68
|
/**
|
|
60
69
|
* @internal
|
|
61
70
|
*/
|
|
62
|
-
|
|
71
|
+
constructor(options: RequestQueueOptions, config?: Configuration);
|
|
72
|
+
/**
|
|
73
|
+
* Returns the total number of requests in the queue (i.e. pending + handled).
|
|
74
|
+
*
|
|
75
|
+
* Survives restarts and actor migrations.
|
|
76
|
+
*/
|
|
77
|
+
getTotalCount(): Promise<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the total number of pending requests in the queue.
|
|
80
|
+
*
|
|
81
|
+
* Survives restarts and Actor migrations.
|
|
82
|
+
*/
|
|
83
|
+
getPendingCount(): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a request to the queue.
|
|
86
|
+
*
|
|
87
|
+
* If a request with the same `uniqueKey` property is already present in the queue,
|
|
88
|
+
* it will not be updated. You can find out whether this happened from the resulting
|
|
89
|
+
* {@link QueueOperationInfo} object.
|
|
90
|
+
*
|
|
91
|
+
* To add multiple requests to the queue by extracting links from a webpage,
|
|
92
|
+
* see the {@link enqueueLinks} helper function.
|
|
93
|
+
*
|
|
94
|
+
* @param requestLike {@link Request} object or vanilla object with request data.
|
|
95
|
+
* Note that the function sets the `uniqueKey` and `id` fields to the passed Request.
|
|
96
|
+
* @param [options] Request queue operation options.
|
|
97
|
+
*/
|
|
98
|
+
addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
|
|
99
|
+
/**
|
|
100
|
+
* Adds requests to the queue in batches of 25. This method will wait till all the requests are added
|
|
101
|
+
* to the queue before resolving. You should prefer using `queue.addRequestsBatched()` or `crawler.addRequests()`
|
|
102
|
+
* if you don't want to block the processing, as those methods will only wait for the initial 1000 requests,
|
|
103
|
+
* start processing right after that happens, and continue adding more in the background.
|
|
104
|
+
*
|
|
105
|
+
* If a request passed in is already present due to its `uniqueKey` property being the same,
|
|
106
|
+
* it will not be updated. You can find out whether this happened by finding the request in the resulting
|
|
107
|
+
* {@link BatchAddRequestsResult} object.
|
|
108
|
+
*
|
|
109
|
+
* @param requestsLike {@link Request} objects or vanilla objects with request data.
|
|
110
|
+
* Note that the function sets the `uniqueKey` and `id` fields to the passed requests if missing.
|
|
111
|
+
* @param [options] Request queue operation options.
|
|
112
|
+
*/
|
|
113
|
+
addRequests(requestsLike: RequestsLike, options?: RequestQueueOperationOptions): Promise<BatchAddRequestsResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Adds requests to the queue in batches. By default, it will resolve after the initial batch is added, and continue
|
|
116
|
+
* adding the rest in the background. You can configure the batch size via `batchSize` option and the sleep time in between
|
|
117
|
+
* the batches via `waitBetweenBatchesMillis`. If you want to wait for all batches to be added to the queue, you can use
|
|
118
|
+
* the `waitForAllRequestsToBeAdded` promise you get in the response object.
|
|
119
|
+
*
|
|
120
|
+
* @param requests The requests to add
|
|
121
|
+
* @param options Options for the request queue
|
|
122
|
+
*/
|
|
123
|
+
addRequestsBatched(requests: ReadonlyDeep<RequestsLike>, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
|
|
124
|
+
/**
|
|
125
|
+
* Gets the request from the queue specified by its `uniqueKey`.
|
|
126
|
+
*
|
|
127
|
+
* @param uniqueKey Unique key of the request.
|
|
128
|
+
* @returns Returns the request object, or `null` if it was not found.
|
|
129
|
+
*/
|
|
130
|
+
getRequest<T extends Dictionary = Dictionary>(uniqueKey: string): Promise<Request<T> | null>;
|
|
63
131
|
/**
|
|
64
132
|
* Returns a next request in the queue to be processed, or `null` if there are no more pending requests.
|
|
65
133
|
*
|
|
66
134
|
* Once you successfully finish processing of the request, you need to call
|
|
67
|
-
* {@link RequestQueue.
|
|
135
|
+
* {@link RequestQueue.markRequestAsHandled}
|
|
68
136
|
* to mark the request as handled in the queue. If there was some error in processing the request,
|
|
69
137
|
* call {@link RequestQueue.reclaimRequest} instead,
|
|
70
138
|
* so that the queue will give the request to some other consumer in another call to the `fetchNextRequest` function.
|
|
@@ -78,32 +146,112 @@ declare class RequestQueue extends RequestProvider {
|
|
|
78
146
|
* Returns the request object or `null` if there are no more pending requests.
|
|
79
147
|
*/
|
|
80
148
|
fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
|
|
81
|
-
protected ensureHeadIsNonEmpty(): Promise<void>;
|
|
82
149
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* head is consistent.
|
|
88
|
-
* @default false
|
|
89
|
-
* @param [limit] How many queue head items will be fetched.
|
|
90
|
-
* @param [iteration] Used when this function is called recursively to limit the recursion.
|
|
91
|
-
* @returns Indicates if queue head is consistent (true) or inconsistent (false).
|
|
150
|
+
* Marks a request that was previously returned by the
|
|
151
|
+
* {@link RequestQueue.fetchNextRequest}
|
|
152
|
+
* function as handled after successful processing.
|
|
153
|
+
* Handled requests will never again be returned by the `fetchNextRequest` function.
|
|
92
154
|
*/
|
|
93
|
-
|
|
94
|
-
isFinished(): Promise<boolean>;
|
|
155
|
+
markRequestAsHandled(request: Request): Promise<RequestQueueOperationInfo | null>;
|
|
95
156
|
/**
|
|
96
157
|
* Reclaims a failed request back to the queue, so that it can be returned for processing later again
|
|
97
158
|
* by another call to {@link RequestQueue.fetchNextRequest}.
|
|
98
159
|
* The request record in the queue is updated using the provided `request` parameter.
|
|
99
160
|
* For example, this lets you store the number of retries or error messages for the request.
|
|
100
161
|
*/
|
|
101
|
-
reclaimRequest(
|
|
162
|
+
reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
|
|
163
|
+
/**
|
|
164
|
+
* Resolves to `true` if the next call to {@link RequestQueue.fetchNextRequest} would return
|
|
165
|
+
* `null`, i.e. there are no pending requests to fetch right now. Otherwise it resolves to `false`.
|
|
166
|
+
*
|
|
167
|
+
* Note that even if the queue is empty, there might be some requests currently being processed
|
|
168
|
+
* (fetched but not yet handled or reclaimed). An empty queue therefore does not mean crawling is
|
|
169
|
+
* finished — those in-progress requests may still be reclaimed, and background tasks may still be
|
|
170
|
+
* adding more requests. To check whether all activity in the queue has finished, use
|
|
171
|
+
* {@link RequestQueue.isFinished}.
|
|
172
|
+
*/
|
|
173
|
+
isEmpty(): Promise<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* Resolves to `true` if all requests were already handled and there are no more left — including no
|
|
176
|
+
* requests currently in progress (fetched but not yet handled or reclaimed, including requests
|
|
177
|
+
* locked by other clients sharing the same queue) and no background add operations still in flight.
|
|
178
|
+
*
|
|
179
|
+
* Due to the nature of distributed storage used by the queue, the function may occasionally return
|
|
180
|
+
* a false negative, but it shall never return a false positive.
|
|
181
|
+
*/
|
|
182
|
+
isFinished(): Promise<boolean>;
|
|
183
|
+
/**
|
|
184
|
+
* Tells the queue how long a consumer expects to hold a fetched request before marking it handled
|
|
185
|
+
* or reclaiming it (typically the request-handler timeout plus padding), so that a storage client
|
|
186
|
+
* that reserves requests via locking does not hand the same request out again while it is still
|
|
187
|
+
* being processed.
|
|
188
|
+
*
|
|
189
|
+
* Several consumers may share one queue (and therefore one client) in a single process, so we only
|
|
190
|
+
* ever raise the reservation duration, never lower it — otherwise a short-lived consumer could cut
|
|
191
|
+
* short the reservation of a long-lived one and have its in-flight request stolen.
|
|
192
|
+
*/
|
|
193
|
+
setExpectedRequestProcessingTimeSecs(secs: number): void;
|
|
194
|
+
/**
|
|
195
|
+
* Caches information about request to beware of unneeded addRequest() calls.
|
|
196
|
+
*/
|
|
197
|
+
protected _cacheRequest(cacheKey: string, queueOperationInfo: RequestQueueOperationInfo): void;
|
|
198
|
+
/**
|
|
199
|
+
* Removes the queue either from the Apify Cloud storage or from the local database,
|
|
200
|
+
* depending on the mode of operation.
|
|
201
|
+
*/
|
|
202
|
+
drop(): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Remove all requests from the queue but keep the queue itself, resetting it
|
|
205
|
+
* so it can be reused (e.g. across multiple `crawler.run()` calls).
|
|
206
|
+
*/
|
|
207
|
+
purge(): Promise<void>;
|
|
102
208
|
/**
|
|
103
209
|
* @inheritdoc
|
|
104
210
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
211
|
+
[Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
|
|
212
|
+
/**
|
|
213
|
+
* Returns the number of handled requests.
|
|
214
|
+
*
|
|
215
|
+
* This function is just a convenient shortcut for:
|
|
216
|
+
*
|
|
217
|
+
* ```javascript
|
|
218
|
+
* const { handledRequestCount } = await queue.getInfo();
|
|
219
|
+
* ```
|
|
220
|
+
* @inheritdoc
|
|
221
|
+
*/
|
|
222
|
+
getHandledCount(): Promise<number>;
|
|
223
|
+
/**
|
|
224
|
+
* Returns an object containing general information about the request queue.
|
|
225
|
+
*
|
|
226
|
+
* **Example:**
|
|
227
|
+
* ```
|
|
228
|
+
* {
|
|
229
|
+
* id: "WkzbQMuFYuamGv3YF",
|
|
230
|
+
* name: "my-queue",
|
|
231
|
+
* createdAt: new Date("2015-12-12T07:34:14.202Z"),
|
|
232
|
+
* modifiedAt: new Date("2015-12-13T08:36:13.202Z"),
|
|
233
|
+
* accessedAt: new Date("2015-12-14T08:36:13.202Z"),
|
|
234
|
+
* totalRequestCount: 25,
|
|
235
|
+
* handledRequestCount: 5,
|
|
236
|
+
* pendingRequestCount: 20,
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* @throws If the underlying storage no longer exists (e.g. it was deleted externally).
|
|
241
|
+
*/
|
|
242
|
+
getInfo(): Promise<RequestQueueInfo>;
|
|
243
|
+
/**
|
|
244
|
+
* Fetches URLs from requestsFromUrl and returns them in format of list of requests
|
|
245
|
+
*/
|
|
246
|
+
protected _fetchRequestsFromUrl(source: InternalSource): Promise<RequestOptions[]>;
|
|
247
|
+
/**
|
|
248
|
+
* Adds all fetched requests from a URL from a remote resource.
|
|
249
|
+
*/
|
|
250
|
+
protected _addFetchedRequests(source: InternalSource, fetchedRequests: RequestOptions[], options: RequestQueueOperationOptions): Promise<ProcessedRequest[]>;
|
|
251
|
+
/**
|
|
252
|
+
* @internal wraps public utility for mocking purposes
|
|
253
|
+
*/
|
|
254
|
+
private _downloadListOfUrls;
|
|
107
255
|
/**
|
|
108
256
|
* Opens a request queue and returns a promise resolving to an instance
|
|
109
257
|
* of the {@link RequestQueue} class.
|
|
@@ -115,12 +263,96 @@ declare class RequestQueue extends RequestProvider {
|
|
|
115
263
|
*
|
|
116
264
|
* For more details and code examples, see the {@link RequestQueue} class.
|
|
117
265
|
*
|
|
118
|
-
* @param [
|
|
119
|
-
* ID or name of the request queue to be opened. If
|
|
120
|
-
*
|
|
266
|
+
* @param [identifier]
|
|
267
|
+
* ID or name of the request queue to be opened. If a string is provided, it will first be
|
|
268
|
+
* looked up as an ID; if no such storage exists, it will be treated as a name.
|
|
269
|
+
* If `null` or `undefined`, the function returns the default request queue associated with the crawler run.
|
|
121
270
|
* @param [options] Open Request Queue options.
|
|
122
271
|
*/
|
|
123
|
-
static open(
|
|
272
|
+
static open(identifier?: string | StorageIdentifier | null, options?: StorageOpenOptions): Promise<RequestQueue>;
|
|
273
|
+
}
|
|
274
|
+
interface RequestLruItem {
|
|
275
|
+
uniqueKey: string;
|
|
276
|
+
isHandled: boolean;
|
|
277
|
+
id: string;
|
|
278
|
+
hydrated: Request | null;
|
|
279
|
+
lockExpiresAt: number | null;
|
|
280
|
+
forefront: boolean;
|
|
281
|
+
}
|
|
282
|
+
export interface RequestQueueOptions {
|
|
283
|
+
id: string;
|
|
284
|
+
name?: string;
|
|
285
|
+
client: RequestQueueClient;
|
|
286
|
+
/**
|
|
287
|
+
* Used to pass the proxy configuration for the `requestsFromUrl` objects.
|
|
288
|
+
* Takes advantage of the internal address rotation and authentication process.
|
|
289
|
+
* If undefined, the `requestsFromUrl` requests will be made without proxy.
|
|
290
|
+
*/
|
|
291
|
+
proxyConfiguration?: ProxyConfiguration;
|
|
292
|
+
}
|
|
293
|
+
export interface RequestQueueOperationOptions {
|
|
294
|
+
/**
|
|
295
|
+
* If set to `true`:
|
|
296
|
+
* - while adding the request to the queue: the request will be added to the foremost position in the queue.
|
|
297
|
+
* - while reclaiming the request: the request will be placed to the beginning of the queue, so that it's returned
|
|
298
|
+
* in the next call to {@link RequestQueue.fetchNextRequest}.
|
|
299
|
+
* By default, it's put to the end of the queue.
|
|
300
|
+
*
|
|
301
|
+
* In case the request is already present in the queue, this option has no effect.
|
|
302
|
+
*
|
|
303
|
+
* If more requests are added with this option at once, their order in the following `fetchNextRequest` call
|
|
304
|
+
* is arbitrary.
|
|
305
|
+
* @default false
|
|
306
|
+
*/
|
|
307
|
+
forefront?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Should the requests be added to the local LRU cache?
|
|
310
|
+
* @default false
|
|
311
|
+
* @internal
|
|
312
|
+
*/
|
|
313
|
+
cache?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
export interface RequestQueueOperationInfo extends QueueOperationInfo {
|
|
319
|
+
uniqueKey: string;
|
|
320
|
+
forefront: boolean;
|
|
321
|
+
}
|
|
322
|
+
export interface AddRequestsBatchedOptions extends RequestQueueOperationOptions {
|
|
323
|
+
/**
|
|
324
|
+
* Whether to wait for all the provided requests to be added, instead of waiting just for the initial batch of up to `batchSize`.
|
|
325
|
+
* @default false
|
|
326
|
+
*/
|
|
327
|
+
waitForAllRequestsToBeAdded?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* @default 1000
|
|
330
|
+
*/
|
|
331
|
+
batchSize?: number;
|
|
332
|
+
/**
|
|
333
|
+
* @default 1000
|
|
334
|
+
*/
|
|
335
|
+
waitBetweenBatchesMillis?: number;
|
|
336
|
+
}
|
|
337
|
+
export interface AddRequestsBatchedResult {
|
|
338
|
+
addedRequests: ProcessedRequest[];
|
|
339
|
+
/**
|
|
340
|
+
* A promise which will resolve with the rest of the requests that were added to the queue.
|
|
341
|
+
*
|
|
342
|
+
* Alternatively, we can set {@link AddRequestsBatchedOptions.waitForAllRequestsToBeAdded|`waitForAllRequestsToBeAdded`} to `true`
|
|
343
|
+
* in the {@link BasicCrawler.addRequests|`crawler.addRequests()`} options.
|
|
344
|
+
*
|
|
345
|
+
* **Example:**
|
|
346
|
+
*
|
|
347
|
+
* ```ts
|
|
348
|
+
* // Assuming `requests` is a list of requests.
|
|
349
|
+
* const result = await crawler.addRequests(requests);
|
|
350
|
+
*
|
|
351
|
+
* // If we want to wait for the rest of the requests to be added to the queue:
|
|
352
|
+
* await result.waitForAllRequestsToBeAdded;
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
waitForAllRequestsToBeAdded: Promise<ProcessedRequest[]>;
|
|
124
356
|
}
|
|
125
|
-
export {
|
|
357
|
+
export {};
|
|
126
358
|
//# sourceMappingURL=request_queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_queue.d.ts","sourceRoot":"","sources":["../../src/storages/request_queue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"request_queue.d.ts","sourceRoot":"","sources":["../../src/storages/request_queue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACnB,MAAM,gBAAgB,CAAC;AAWxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,a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