apify 2.3.1-beta.4 → 3.0.0-alpha.0
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/README.md +6 -5
- package/package.json +69 -128
- package/build/actor.d.ts +0 -113
- package/build/actor.d.ts.map +0 -1
- package/build/actor.js +0 -582
- package/build/actor.js.map +0 -1
- package/build/apify.d.ts +0 -752
- package/build/apify.d.ts.map +0 -1
- package/build/apify.js +0 -877
- package/build/apify.js.map +0 -1
- package/build/autoscaling/autoscaled_pool.d.ts +0 -384
- package/build/autoscaling/autoscaled_pool.d.ts.map +0 -1
- package/build/autoscaling/autoscaled_pool.js +0 -557
- package/build/autoscaling/autoscaled_pool.js.map +0 -1
- package/build/autoscaling/snapshotter.d.ts +0 -278
- package/build/autoscaling/snapshotter.d.ts.map +0 -1
- package/build/autoscaling/snapshotter.js +0 -447
- package/build/autoscaling/snapshotter.js.map +0 -1
- package/build/autoscaling/system_status.d.ts +0 -224
- package/build/autoscaling/system_status.d.ts.map +0 -1
- package/build/autoscaling/system_status.js +0 -228
- package/build/autoscaling/system_status.js.map +0 -1
- package/build/browser_launchers/browser_launcher.d.ts +0 -154
- package/build/browser_launchers/browser_launcher.d.ts.map +0 -1
- package/build/browser_launchers/browser_launcher.js +0 -160
- package/build/browser_launchers/browser_launcher.js.map +0 -1
- package/build/browser_launchers/browser_plugin.d.ts +0 -23
- package/build/browser_launchers/browser_plugin.d.ts.map +0 -1
- package/build/browser_launchers/browser_plugin.js +0 -25
- package/build/browser_launchers/browser_plugin.js.map +0 -1
- package/build/browser_launchers/playwright_launcher.d.ts +0 -131
- package/build/browser_launchers/playwright_launcher.d.ts.map +0 -1
- package/build/browser_launchers/playwright_launcher.js +0 -150
- package/build/browser_launchers/playwright_launcher.js.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.d.ts +0 -153
- package/build/browser_launchers/puppeteer_launcher.d.ts.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.js +0 -197
- package/build/browser_launchers/puppeteer_launcher.js.map +0 -1
- package/build/cache_container.d.ts +0 -31
- package/build/cache_container.d.ts.map +0 -1
- package/build/cache_container.js +0 -48
- package/build/cache_container.js.map +0 -1
- package/build/configuration.d.ts +0 -226
- package/build/configuration.d.ts.map +0 -1
- package/build/configuration.js +0 -325
- package/build/configuration.js.map +0 -1
- package/build/constants.d.ts +0 -37
- package/build/constants.d.ts.map +0 -1
- package/build/constants.js +0 -41
- package/build/constants.js.map +0 -1
- package/build/crawlers/basic_crawler.d.ts +0 -443
- package/build/crawlers/basic_crawler.d.ts.map +0 -1
- package/build/crawlers/basic_crawler.js +0 -664
- package/build/crawlers/basic_crawler.js.map +0 -1
- package/build/crawlers/browser_crawler.d.ts +0 -512
- package/build/crawlers/browser_crawler.d.ts.map +0 -1
- package/build/crawlers/browser_crawler.js +0 -540
- package/build/crawlers/browser_crawler.js.map +0 -1
- package/build/crawlers/cheerio_crawler.d.ts +0 -931
- package/build/crawlers/cheerio_crawler.d.ts.map +0 -1
- package/build/crawlers/cheerio_crawler.js +0 -913
- package/build/crawlers/cheerio_crawler.js.map +0 -1
- package/build/crawlers/crawler_extension.d.ts +0 -10
- package/build/crawlers/crawler_extension.d.ts.map +0 -1
- package/build/crawlers/crawler_extension.js +0 -19
- package/build/crawlers/crawler_extension.js.map +0 -1
- package/build/crawlers/crawler_utils.d.ts +0 -34
- package/build/crawlers/crawler_utils.d.ts.map +0 -1
- package/build/crawlers/crawler_utils.js +0 -87
- package/build/crawlers/crawler_utils.js.map +0 -1
- package/build/crawlers/playwright_crawler.d.ts +0 -448
- package/build/crawlers/playwright_crawler.d.ts.map +0 -1
- package/build/crawlers/playwright_crawler.js +0 -299
- package/build/crawlers/playwright_crawler.js.map +0 -1
- package/build/crawlers/puppeteer_crawler.d.ts +0 -425
- package/build/crawlers/puppeteer_crawler.d.ts.map +0 -1
- package/build/crawlers/puppeteer_crawler.js +0 -299
- package/build/crawlers/puppeteer_crawler.js.map +0 -1
- package/build/crawlers/statistics.d.ts +0 -185
- package/build/crawlers/statistics.d.ts.map +0 -1
- package/build/crawlers/statistics.js +0 -331
- package/build/crawlers/statistics.js.map +0 -1
- package/build/enqueue_links/click_elements.d.ts +0 -179
- package/build/enqueue_links/click_elements.d.ts.map +0 -1
- package/build/enqueue_links/click_elements.js +0 -434
- package/build/enqueue_links/click_elements.js.map +0 -1
- package/build/enqueue_links/enqueue_links.d.ts +0 -117
- package/build/enqueue_links/enqueue_links.d.ts.map +0 -1
- package/build/enqueue_links/enqueue_links.js +0 -163
- package/build/enqueue_links/enqueue_links.js.map +0 -1
- package/build/enqueue_links/shared.d.ts +0 -42
- package/build/enqueue_links/shared.d.ts.map +0 -1
- package/build/enqueue_links/shared.js +0 -121
- package/build/enqueue_links/shared.js.map +0 -1
- package/build/errors.d.ts +0 -29
- package/build/errors.d.ts.map +0 -1
- package/build/errors.js +0 -38
- package/build/errors.js.map +0 -1
- package/build/events.d.ts +0 -11
- package/build/events.d.ts.map +0 -1
- package/build/events.js +0 -147
- package/build/events.js.map +0 -1
- package/build/index.d.ts +0 -4
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -7
- package/build/index.js.map +0 -1
- package/build/main.d.ts +0 -179
- package/build/main.d.ts.map +0 -1
- package/build/main.js +0 -81
- package/build/main.js.map +0 -1
- package/build/playwright_utils.d.ts +0 -9
- package/build/playwright_utils.d.ts.map +0 -1
- package/build/playwright_utils.js +0 -90
- package/build/playwright_utils.js.map +0 -1
- package/build/proxy_configuration.d.ts +0 -411
- package/build/proxy_configuration.d.ts.map +0 -1
- package/build/proxy_configuration.js +0 -517
- package/build/proxy_configuration.js.map +0 -1
- package/build/pseudo_url.d.ts +0 -86
- package/build/pseudo_url.d.ts.map +0 -1
- package/build/pseudo_url.js +0 -153
- package/build/pseudo_url.js.map +0 -1
- package/build/puppeteer_request_interception.d.ts +0 -8
- package/build/puppeteer_request_interception.d.ts.map +0 -1
- package/build/puppeteer_request_interception.js +0 -235
- package/build/puppeteer_request_interception.js.map +0 -1
- package/build/puppeteer_utils.d.ts +0 -250
- package/build/puppeteer_utils.d.ts.map +0 -1
- package/build/puppeteer_utils.js +0 -551
- package/build/puppeteer_utils.js.map +0 -1
- package/build/request.d.ts +0 -180
- package/build/request.d.ts.map +0 -1
- package/build/request.js +0 -261
- package/build/request.js.map +0 -1
- package/build/request_list.d.ts +0 -581
- package/build/request_list.d.ts.map +0 -1
- package/build/request_list.js +0 -826
- package/build/request_list.js.map +0 -1
- package/build/serialization.d.ts +0 -5
- package/build/serialization.d.ts.map +0 -1
- package/build/serialization.js +0 -139
- package/build/serialization.js.map +0 -1
- package/build/session_pool/errors.d.ts +0 -11
- package/build/session_pool/errors.d.ts.map +0 -1
- package/build/session_pool/errors.js +0 -18
- package/build/session_pool/errors.js.map +0 -1
- package/build/session_pool/events.d.ts +0 -5
- package/build/session_pool/events.d.ts.map +0 -1
- package/build/session_pool/events.js +0 -6
- package/build/session_pool/events.js.map +0 -1
- package/build/session_pool/session.d.ts +0 -286
- package/build/session_pool/session.d.ts.map +0 -1
- package/build/session_pool/session.js +0 -355
- package/build/session_pool/session.js.map +0 -1
- package/build/session_pool/session_pool.d.ts +0 -280
- package/build/session_pool/session_pool.d.ts.map +0 -1
- package/build/session_pool/session_pool.js +0 -393
- package/build/session_pool/session_pool.js.map +0 -1
- package/build/session_pool/session_utils.d.ts +0 -4
- package/build/session_pool/session_utils.d.ts.map +0 -1
- package/build/session_pool/session_utils.js +0 -24
- package/build/session_pool/session_utils.js.map +0 -1
- package/build/stealth/hiding_tricks.d.ts +0 -22
- package/build/stealth/hiding_tricks.d.ts.map +0 -1
- package/build/stealth/hiding_tricks.js +0 -308
- package/build/stealth/hiding_tricks.js.map +0 -1
- package/build/stealth/stealth.d.ts +0 -56
- package/build/stealth/stealth.d.ts.map +0 -1
- package/build/stealth/stealth.js +0 -125
- package/build/stealth/stealth.js.map +0 -1
- package/build/storages/dataset.d.ts +0 -288
- package/build/storages/dataset.d.ts.map +0 -1
- package/build/storages/dataset.js +0 -480
- package/build/storages/dataset.js.map +0 -1
- package/build/storages/key_value_store.d.ts +0 -243
- package/build/storages/key_value_store.d.ts.map +0 -1
- package/build/storages/key_value_store.js +0 -462
- package/build/storages/key_value_store.js.map +0 -1
- package/build/storages/request_queue.d.ts +0 -318
- package/build/storages/request_queue.d.ts.map +0 -1
- package/build/storages/request_queue.js +0 -636
- package/build/storages/request_queue.js.map +0 -1
- package/build/storages/storage_manager.d.ts +0 -87
- package/build/storages/storage_manager.d.ts.map +0 -1
- package/build/storages/storage_manager.js +0 -150
- package/build/storages/storage_manager.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/build/typedefs.d.ts +0 -146
- package/build/typedefs.d.ts.map +0 -1
- package/build/typedefs.js +0 -88
- package/build/typedefs.js.map +0 -1
- package/build/utils.d.ts +0 -175
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -731
- package/build/utils.js.map +0 -1
- package/build/utils_log.d.ts +0 -41
- package/build/utils_log.d.ts.map +0 -1
- package/build/utils_log.js +0 -192
- package/build/utils_log.js.map +0 -1
- package/build/utils_request.d.ts +0 -77
- package/build/utils_request.d.ts.map +0 -1
- package/build/utils_request.js +0 -385
- package/build/utils_request.js.map +0 -1
- package/build/utils_social.d.ts +0 -210
- package/build/utils_social.d.ts.map +0 -1
- package/build/utils_social.js +0 -787
- package/build/utils_social.js.map +0 -1
- package/build/validators.d.ts +0 -23
- package/build/validators.d.ts.map +0 -1
- package/build/validators.js +0 -29
- package/build/validators.js.map +0 -1
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
export const QUERY_HEAD_MIN_LENGTH: 100;
|
|
2
|
-
export const QUERY_HEAD_BUFFER: 3;
|
|
3
|
-
export const API_PROCESSED_REQUESTS_DELAY_MILLIS: number;
|
|
4
|
-
export const MAX_QUERIES_FOR_CONSISTENCY: 6;
|
|
5
|
-
export const STORAGE_CONSISTENCY_DELAY_MILLIS: 3000;
|
|
6
|
-
export function getRequestId(uniqueKey: any): string;
|
|
7
|
-
/**
|
|
8
|
-
* A helper class that is used to report results from various
|
|
9
|
-
* {@link RequestQueue} functions as well as
|
|
10
|
-
* {@link utils#enqueueLinks}.
|
|
11
|
-
*
|
|
12
|
-
* @typedef QueueOperationInfo
|
|
13
|
-
* @property {boolean} wasAlreadyPresent Indicates if request was already present in the queue.
|
|
14
|
-
* @property {boolean} wasAlreadyHandled Indicates if request was already marked as handled.
|
|
15
|
-
* @property {string} requestId The ID of the added request
|
|
16
|
-
* @property {Request} request The original {@link Request} object passed to the `RequestQueue` function.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Represents a queue of URLs to crawl, which is used for deep crawling of websites
|
|
20
|
-
* where you start with several URLs and then recursively
|
|
21
|
-
* follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.
|
|
22
|
-
*
|
|
23
|
-
* Each URL is represented using an instance of the {@link Request} class.
|
|
24
|
-
* The queue can only contain unique URLs. More precisely, it can only contain {@link Request} instances
|
|
25
|
-
* with distinct `uniqueKey` properties. By default, `uniqueKey` is generated from the URL, but it can also be overridden.
|
|
26
|
-
* To add a single URL multiple times to the queue,
|
|
27
|
-
* corresponding {@link Request} objects will need to have different `uniqueKey` properties.
|
|
28
|
-
*
|
|
29
|
-
* Do not instantiate this class directly, use the
|
|
30
|
-
* {@link Apify#openRequestQueue} function instead.
|
|
31
|
-
*
|
|
32
|
-
* `RequestQueue` is used by {@link BasicCrawler}, {@link CheerioCrawler}, {@link PuppeteerCrawler}
|
|
33
|
-
* and {@link PlaywrightCrawler} as a source of URLs to crawl.
|
|
34
|
-
* Unlike {@link RequestList}, `RequestQueue` supports dynamic adding and removing of requests.
|
|
35
|
-
* On the other hand, the queue is not optimized for operations that add or remove a large number of URLs in a batch.
|
|
36
|
-
*
|
|
37
|
-
* `RequestQueue` stores its data either on local disk or in the Apify Cloud,
|
|
38
|
-
* depending on whether the `APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variable is set.
|
|
39
|
-
*
|
|
40
|
-
* If the `APIFY_LOCAL_STORAGE_DIR` environment variable is set, the queue data is stored in
|
|
41
|
-
* that directory in an SQLite database file.
|
|
42
|
-
*
|
|
43
|
-
* If the `APIFY_TOKEN` environment variable is set but `APIFY_LOCAL_STORAGE_DIR` is not, the data is stored in the
|
|
44
|
-
* [Apify Request Queue](https://docs.apify.com/storage/request-queue)
|
|
45
|
-
* cloud storage. Note that you can force usage of the cloud storage also by passing the `forceCloud`
|
|
46
|
-
* option to {@link Apify#openRequestQueue} function,
|
|
47
|
-
* even if the `APIFY_LOCAL_STORAGE_DIR` variable is set.
|
|
48
|
-
*
|
|
49
|
-
* **Example usage:**
|
|
50
|
-
*
|
|
51
|
-
* ```javascript
|
|
52
|
-
* // Open the default request queue associated with the actor run
|
|
53
|
-
* const queue = await Apify.openRequestQueue();
|
|
54
|
-
*
|
|
55
|
-
* // Open a named request queue
|
|
56
|
-
* const queueWithName = await Apify.openRequestQueue('some-name');
|
|
57
|
-
*
|
|
58
|
-
* // Enqueue few requests
|
|
59
|
-
* await queue.addRequest({ url: 'http://example.com/aaa' });
|
|
60
|
-
* await queue.addRequest({ url: 'http://example.com/bbb' });
|
|
61
|
-
* await queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });
|
|
62
|
-
* ```
|
|
63
|
-
* @hideconstructor
|
|
64
|
-
*/
|
|
65
|
-
export class RequestQueue {
|
|
66
|
-
/**
|
|
67
|
-
* @param {object} options
|
|
68
|
-
* @param {string} options.id
|
|
69
|
-
* @param {string} [options.name]
|
|
70
|
-
* @param {boolean} options.isLocal
|
|
71
|
-
* @param {ApifyClient|ApifyStorageLocal} options.client
|
|
72
|
-
*/
|
|
73
|
-
constructor(options: {
|
|
74
|
-
id: string;
|
|
75
|
-
name?: string | undefined;
|
|
76
|
-
isLocal: boolean;
|
|
77
|
-
client: ApifyClient | ApifyStorageLocal;
|
|
78
|
-
});
|
|
79
|
-
id: string;
|
|
80
|
-
name: string | undefined;
|
|
81
|
-
isLocal: boolean;
|
|
82
|
-
timeoutSecs: number;
|
|
83
|
-
clientKey: string;
|
|
84
|
-
client: import("@apify/storage-local/dist/resource_clients/request_queue").RequestQueueClient | import("apify-client").RequestQueueClient;
|
|
85
|
-
log: import("@apify/log/log").Log;
|
|
86
|
-
/**
|
|
87
|
-
* @type {*}
|
|
88
|
-
* @ignore
|
|
89
|
-
*/
|
|
90
|
-
queueHeadDict: any;
|
|
91
|
-
queryQueueHeadPromise: any;
|
|
92
|
-
inProgress: Set<any>;
|
|
93
|
-
lastActivity: Date;
|
|
94
|
-
internalTimeoutMillis: number;
|
|
95
|
-
recentlyHandled: LruCache<any>;
|
|
96
|
-
assumedTotalCount: number;
|
|
97
|
-
assumedHandledCount: number;
|
|
98
|
-
requestsCache: LruCache<any>;
|
|
99
|
-
/**
|
|
100
|
-
* @ignore
|
|
101
|
-
*/
|
|
102
|
-
inProgressCount(): number;
|
|
103
|
-
/**
|
|
104
|
-
* Adds a request to the queue.
|
|
105
|
-
*
|
|
106
|
-
* If a request with the same `uniqueKey` property is already present in the queue,
|
|
107
|
-
* it will not be updated. You can find out whether this happened from the resulting
|
|
108
|
-
* {@link QueueOperationInfo} object.
|
|
109
|
-
*
|
|
110
|
-
* To add multiple requests to the queue by extracting links from a webpage,
|
|
111
|
-
* see the {@link utils#enqueueLinks} helper function.
|
|
112
|
-
*
|
|
113
|
-
* @param {(Request|RequestOptions)} requestLike {@link Request} object or vanilla object with request data.
|
|
114
|
-
* Note that the function sets the `uniqueKey` and `id` fields to the passed Request.
|
|
115
|
-
* @param {Object} [options]
|
|
116
|
-
* @param {boolean} [options.forefront=false] If `true`, the request will be added to the foremost position in the queue.
|
|
117
|
-
* @return {Promise<QueueOperationInfo>}
|
|
118
|
-
*/
|
|
119
|
-
addRequest(requestLike: (Request | RequestOptions), options?: {
|
|
120
|
-
forefront?: boolean | undefined;
|
|
121
|
-
} | undefined): Promise<QueueOperationInfo>;
|
|
122
|
-
/**
|
|
123
|
-
* Gets the request from the queue specified by ID.
|
|
124
|
-
*
|
|
125
|
-
* @param {string} id ID of the request.
|
|
126
|
-
* @return {Promise<(Request|null)>} Returns the request object, or `null` if it was not found.
|
|
127
|
-
*/
|
|
128
|
-
getRequest(id: string): Promise<(Request | null)>;
|
|
129
|
-
/**
|
|
130
|
-
* Returns a next request in the queue to be processed, or `null` if there are no more pending requests.
|
|
131
|
-
*
|
|
132
|
-
* Once you successfully finish processing of the request, you need to call
|
|
133
|
-
* {@link RequestQueue#markRequestHandled}
|
|
134
|
-
* to mark the request as handled in the queue. If there was some error in processing the request,
|
|
135
|
-
* call {@link RequestQueue#reclaimRequest} instead,
|
|
136
|
-
* so that the queue will give the request to some other consumer in another call to the `fetchNextRequest` function.
|
|
137
|
-
*
|
|
138
|
-
* Note that the `null` return value doesn't mean the queue processing finished,
|
|
139
|
-
* it means there are currently no pending requests.
|
|
140
|
-
* To check whether all requests in queue were finished,
|
|
141
|
-
* use {@link RequestQueue#isFinished} instead.
|
|
142
|
-
*
|
|
143
|
-
* @returns {Promise<(Request|null)>}
|
|
144
|
-
* Returns the request object or `null` if there are no more pending requests.
|
|
145
|
-
*/
|
|
146
|
-
fetchNextRequest(): Promise<(Request | null)>;
|
|
147
|
-
/**
|
|
148
|
-
* Marks a request that was previously returned by the
|
|
149
|
-
* {@link RequestQueue#fetchNextRequest}
|
|
150
|
-
* function as handled after successful processing.
|
|
151
|
-
* Handled requests will never again be returned by the `fetchNextRequest` function.
|
|
152
|
-
*
|
|
153
|
-
* @param {Request} request
|
|
154
|
-
* @return {Promise<QueueOperationInfo | null>}
|
|
155
|
-
*/
|
|
156
|
-
markRequestHandled(request: Request): Promise<QueueOperationInfo | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Reclaims a failed request back to the queue, so that it can be returned for processed later again
|
|
159
|
-
* by another call to {@link RequestQueue#fetchNextRequest}.
|
|
160
|
-
* The request record in the queue is updated using the provided `request` parameter.
|
|
161
|
-
* For example, this lets you store the number of retries or error messages for the request.
|
|
162
|
-
*
|
|
163
|
-
* @param {Request} request
|
|
164
|
-
* @param {object} [options]
|
|
165
|
-
* @param {boolean} [options.forefront=false]
|
|
166
|
-
* If `true` then the request it placed to the beginning of the queue, so that it's returned
|
|
167
|
-
* in the next call to {@link RequestQueue#fetchNextRequest}.
|
|
168
|
-
* By default, it's put to the end of the queue.
|
|
169
|
-
* @return {Promise<QueueOperationInfo | null>}
|
|
170
|
-
*/
|
|
171
|
-
reclaimRequest(request: Request, options?: {
|
|
172
|
-
forefront?: boolean | undefined;
|
|
173
|
-
} | undefined): Promise<QueueOperationInfo | null>;
|
|
174
|
-
/**
|
|
175
|
-
* Resolves to `true` if the next call to {@link RequestQueue#fetchNextRequest}
|
|
176
|
-
* would return `null`, otherwise it resolves to `false`.
|
|
177
|
-
* Note that even if the queue is empty, there might be some pending requests currently being processed.
|
|
178
|
-
* If you need to ensure that there is no activity in the queue, use {@link RequestQueue#isFinished}.
|
|
179
|
-
*
|
|
180
|
-
* @returns {Promise<boolean>}
|
|
181
|
-
*/
|
|
182
|
-
isEmpty(): Promise<boolean>;
|
|
183
|
-
/**
|
|
184
|
-
* Resolves to `true` if all requests were already handled and there are no more left.
|
|
185
|
-
* Due to the nature of distributed storage used by the queue,
|
|
186
|
-
* the function might occasionally return a false negative,
|
|
187
|
-
* but it will never return a false positive.
|
|
188
|
-
*
|
|
189
|
-
* @returns {Promise<boolean>}
|
|
190
|
-
*/
|
|
191
|
-
isFinished(): Promise<boolean>;
|
|
192
|
-
/**
|
|
193
|
-
* @internal
|
|
194
|
-
*/
|
|
195
|
-
_reset(): void;
|
|
196
|
-
/**
|
|
197
|
-
* Caches information about request to beware of unneeded addRequest() calls.
|
|
198
|
-
* @param {string} cacheKey
|
|
199
|
-
* @param {object} queueOperationInfo
|
|
200
|
-
* @param {string} queueOperationInfo.requestId
|
|
201
|
-
* @param {boolean} queueOperationInfo.wasAlreadyHandled
|
|
202
|
-
* @ignore
|
|
203
|
-
* @protected
|
|
204
|
-
* @internal
|
|
205
|
-
*/
|
|
206
|
-
protected _cacheRequest(cacheKey: string, queueOperationInfo: {
|
|
207
|
-
requestId: string;
|
|
208
|
-
wasAlreadyHandled: boolean;
|
|
209
|
-
}): void;
|
|
210
|
-
/**
|
|
211
|
-
* We always request more items than is in progress to ensure that something falls into head.
|
|
212
|
-
*
|
|
213
|
-
* @param {boolean} [ensureConsistency=false] If true then query for queue head is retried until queueModifiedAt
|
|
214
|
-
* is older than queryStartedAt by at least API_PROCESSED_REQUESTS_DELAY_MILLIS to ensure that queue
|
|
215
|
-
* head is consistent.
|
|
216
|
-
* @param {number} [limit] How many queue head items will be fetched.
|
|
217
|
-
* @param {number} [iteration] Used when this function is called recursively to limit the recursion.
|
|
218
|
-
* @return {Promise<boolean>} Indicates if queue head is consistent (true) or inconsistent (false).
|
|
219
|
-
* @ignore
|
|
220
|
-
* @protected
|
|
221
|
-
* @internal
|
|
222
|
-
*/
|
|
223
|
-
protected _ensureHeadIsNonEmpty(ensureConsistency?: boolean | undefined, limit?: number | undefined, iteration?: number | undefined): Promise<boolean>;
|
|
224
|
-
/**
|
|
225
|
-
* Adds a request straight to the queueHeadDict, to improve performance.
|
|
226
|
-
* @private
|
|
227
|
-
*/
|
|
228
|
-
private _maybeAddRequestToQueueHead;
|
|
229
|
-
/**
|
|
230
|
-
* Removes the queue either from the Apify Cloud storage or from the local database,
|
|
231
|
-
* depending on the mode of operation.
|
|
232
|
-
*
|
|
233
|
-
* @return {Promise<void>}
|
|
234
|
-
*/
|
|
235
|
-
drop(): Promise<void>;
|
|
236
|
-
/**
|
|
237
|
-
* Returns the number of handled requests.
|
|
238
|
-
*
|
|
239
|
-
* This function is just a convenient shortcut for:
|
|
240
|
-
*
|
|
241
|
-
* ```javascript
|
|
242
|
-
* const { handledRequestCount } = await queue.getInfo();
|
|
243
|
-
* ```
|
|
244
|
-
*
|
|
245
|
-
* @return {Promise<number>}
|
|
246
|
-
*/
|
|
247
|
-
handledCount(): Promise<number>;
|
|
248
|
-
/**
|
|
249
|
-
* Returns an object containing general information about the request queue.
|
|
250
|
-
*
|
|
251
|
-
* The function returns the same object as the Apify API Client's
|
|
252
|
-
* [getQueue](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues)
|
|
253
|
-
* function, which in turn calls the
|
|
254
|
-
* [Get request queue](https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue)
|
|
255
|
-
* API endpoint.
|
|
256
|
-
*
|
|
257
|
-
* **Example:**
|
|
258
|
-
* ```
|
|
259
|
-
* {
|
|
260
|
-
* id: "WkzbQMuFYuamGv3YF",
|
|
261
|
-
* name: "my-queue",
|
|
262
|
-
* userId: "wRsJZtadYvn4mBZmm",
|
|
263
|
-
* createdAt: new Date("2015-12-12T07:34:14.202Z"),
|
|
264
|
-
* modifiedAt: new Date("2015-12-13T08:36:13.202Z"),
|
|
265
|
-
* accessedAt: new Date("2015-12-14T08:36:13.202Z"),
|
|
266
|
-
* totalRequestCount: 25,
|
|
267
|
-
* handledRequestCount: 5,
|
|
268
|
-
* pendingRequestCount: 20,
|
|
269
|
-
* }
|
|
270
|
-
* ```
|
|
271
|
-
*
|
|
272
|
-
* @returns {Promise<RequestQueueInfo>}
|
|
273
|
-
*/
|
|
274
|
-
getInfo(): Promise<RequestQueueInfo>;
|
|
275
|
-
}
|
|
276
|
-
export function openRequestQueue(queueIdOrName?: string | undefined, options?: {
|
|
277
|
-
forceCloud?: boolean | undefined;
|
|
278
|
-
} | undefined): Promise<RequestQueue>;
|
|
279
|
-
/**
|
|
280
|
-
* A helper class that is used to report results from various
|
|
281
|
-
* {@link RequestQueue } functions as well as
|
|
282
|
-
* {@link utilsenqueueLinks }.
|
|
283
|
-
*/
|
|
284
|
-
export type QueueOperationInfo = {
|
|
285
|
-
/**
|
|
286
|
-
* Indicates if request was already present in the queue.
|
|
287
|
-
*/
|
|
288
|
-
wasAlreadyPresent: boolean;
|
|
289
|
-
/**
|
|
290
|
-
* Indicates if request was already marked as handled.
|
|
291
|
-
*/
|
|
292
|
-
wasAlreadyHandled: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* The ID of the added request
|
|
295
|
-
*/
|
|
296
|
-
requestId: string;
|
|
297
|
-
/**
|
|
298
|
-
* The original {@link Request } object passed to the `RequestQueue` function.
|
|
299
|
-
*/
|
|
300
|
-
request: Request;
|
|
301
|
-
};
|
|
302
|
-
export type RequestQueueInfo = {
|
|
303
|
-
id: string;
|
|
304
|
-
name: string;
|
|
305
|
-
userId: string;
|
|
306
|
-
createdAt: Date;
|
|
307
|
-
modifiedAt: Date;
|
|
308
|
-
accessedAt: Date;
|
|
309
|
-
totalRequestCount: number;
|
|
310
|
-
handledRequestCount: number;
|
|
311
|
-
pendingRequestCount: number;
|
|
312
|
-
};
|
|
313
|
-
import { LruCache } from "@apify/datastructures/lru_cache";
|
|
314
|
-
import Request from "../request";
|
|
315
|
-
import { RequestOptions } from "../request";
|
|
316
|
-
import { ApifyClient } from "apify-client/dist/apify_client";
|
|
317
|
-
import { ApifyStorageLocal } from "@apify/storage-local";
|
|
318
|
-
//# sourceMappingURL=request_queue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request_queue.d.ts","sourceRoot":"","sources":["../../src/storages/request_queue.js"],"names":[],"mappings":"AAqBA,wCAAyC;AACzC,kCAAmC;AAInC,yDAA6D;AAG7D,4CAA6C;AAQ7C,oDAAqD;AAW9C,qDAQN;AAED;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH;IACI;;;;;;OAMG;IACH;QAL2B,EAAE,EAAlB,MAAM;QACW,IAAI;QACJ,OAAO,EAAxB,OAAO;QACgC,MAAM,EAA7C,WAAW,GAAC,iBAAiB;OAiDvC;IA9CG,WAAoB;IACpB,yBAAwB;IACxB,iBAA8B;IAC9B,oBAAqB;IACrB,kBAAuC;IACvC,0IAGE;IACF,kCAAgD;IAKhD;;;OAGG;IACH,mBAAyC;IACzC,2BAAiC;IAIjC,qBAA2B;IAK3B,mBAA8B;IAC9B,8BAAqC;IAKrC,+BAA+E;IAI/E,0BAA0B;IAC1B,4BAA4B;IAM5B,6BAAqE;IAGzE;;OAEG;IACH,0BAEC;IAED;;;;;;;;;;;;;;;OAeG;IACH,wBANW,CAAC,OAAO,GAAC,cAAc,CAAC;;oBAIvB,QAAQ,kBAAkB,CAAC,CA+CtC;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACL,QAAQ,CAAC,OAAO,GAAC,IAAI,CAAC,CAAC,CAmBlC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,oBAHa,QAAQ,CAAC,OAAO,GAAC,IAAI,CAAC,CAAC,CA2DnC;IAED;;;;;;;;OAQG;IACH,4BAHW,OAAO,GACN,QAAQ,kBAAkB,GAAG,IAAI,CAAC,CA+B7C;IAED;;;;;;;;;;;;;OAaG;IACH,wBARW,OAAO;;oBAMN,QAAQ,kBAAkB,GAAG,IAAI,CAAC,CAwC7C;IAED;;;;;;;OAOG;IACH,WAFa,QAAQ,OAAO,CAAC,CAK5B;IAED;;;;;;;OAOG;IACH,cAFa,QAAQ,OAAO,CAAC,CAa5B;IAED;;OAEG;IACH,eASC;IAED;;;;;;;;;OASG;IACH,kCARW,MAAM;QAEqB,SAAS,EAApC,MAAM;QACsB,iBAAiB,EAA7C,OAAO;aAUjB;IAED;;;;;;;;;;;;OAYG;IACH,sIALY,QAAQ,OAAO,CAAC,CAqF3B;IAED;;;OAGG;IACH,oCAMC;IAED;;;;;OAKG;IACH,QAFY,QAAQ,IAAI,CAAC,CAMxB;IAED;;;;;;;;;;OAUG;IACH,gBAFY,QAAQ,MAAM,CAAC,CAM1B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAFa,QAAQ,gBAAgB,CAAC,CAIrC;CACJ;AAyBM;;gBALM,QAAQ,YAAY,CAAC,CAYjC;;;;;;;;;;uBA5nBa,OAAO;;;;uBACP,OAAO;;;;eACP,MAAM;;;;aACN,OAAO;;;QA6nBP,MAAM;UACN,MAAM;YACN,MAAM;eACN,IAAI;gBACJ,IAAI;gBACJ,IAAI;uBACJ,MAAM;yBACN,MAAM;yBACN,MAAM"}
|