@crawlee/core 3.10.6-beta.8 → 3.11.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/configuration.d.ts +0 -2
- package/configuration.d.ts.map +1 -1
- package/cookie_utils.d.ts +0 -2
- package/cookie_utils.d.ts.map +1 -1
- package/cookie_utils.js +6 -7
- package/cookie_utils.js.map +1 -1
- package/crawlers/crawler_utils.js +1 -2
- package/crawlers/crawler_utils.js.map +1 -1
- package/enqueue_links/enqueue_links.d.ts +5 -5
- package/enqueue_links/enqueue_links.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.js +3 -3
- package/enqueue_links/enqueue_links.js.map +1 -1
- package/enqueue_links/shared.d.ts +3 -3
- package/enqueue_links/shared.d.ts.map +1 -1
- package/enqueue_links/shared.js +9 -9
- package/enqueue_links/shared.js.map +1 -1
- package/events/event_manager.d.ts +1 -2
- package/events/event_manager.d.ts.map +1 -1
- package/index.mjs +1 -0
- package/package.json +5 -5
- package/request.d.ts +0 -4
- package/request.d.ts.map +1 -1
- package/serialization.d.ts +0 -4
- package/serialization.d.ts.map +1 -1
- package/serialization.js +3 -4
- package/serialization.js.map +1 -1
- package/session_pool/session.d.ts +0 -2
- package/session_pool/session.d.ts.map +1 -1
- package/session_pool/session_pool.d.ts +0 -2
- package/session_pool/session_pool.d.ts.map +1 -1
- package/storages/access_checking.d.ts.map +1 -1
- package/storages/dataset.js +3 -3
- package/storages/dataset.js.map +1 -1
- package/storages/index.d.ts +1 -0
- package/storages/index.d.ts.map +1 -1
- package/storages/index.js +1 -0
- package/storages/index.js.map +1 -1
- package/storages/key_value_store.d.ts +0 -2
- package/storages/key_value_store.d.ts.map +1 -1
- package/storages/request_list.d.ts +77 -22
- package/storages/request_list.d.ts.map +1 -1
- package/storages/request_list.js +18 -19
- package/storages/request_list.js.map +1 -1
- package/storages/sitemap_request_list.d.ts +158 -0
- package/storages/sitemap_request_list.d.ts.map +1 -0
- package/storages/sitemap_request_list.js +388 -0
- package/storages/sitemap_request_list.js.map +1 -0
- package/storages/storage_manager.d.ts +2 -2
- package/storages/storage_manager.d.ts.map +1 -1
- package/storages/utils.d.ts.map +1 -1
- package/storages/utils.js +4 -4
- package/storages/utils.js.map +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typedefs.d.ts.map +1 -1
- package/typedefs.js +2 -3
- package/typedefs.js.map +1 -1
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SitemapRequestList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_stream_1 = require("node:stream");
|
|
6
|
+
const log_1 = tslib_1.__importDefault(require("@apify/log"));
|
|
7
|
+
const utils_1 = require("@crawlee/utils");
|
|
8
|
+
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
9
|
+
const key_value_store_1 = require("./key_value_store");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const request_1 = require("../request");
|
|
12
|
+
/**
|
|
13
|
+
* A list of URLs to crawl parsed from a sitemap.
|
|
14
|
+
*
|
|
15
|
+
* The loading of the sitemap is performed in the background so that crawling can start before the sitemap is fully loaded.
|
|
16
|
+
*/
|
|
17
|
+
class SitemapRequestList {
|
|
18
|
+
/** @internal */
|
|
19
|
+
constructor(options) {
|
|
20
|
+
/**
|
|
21
|
+
* Set of URLs that were returned by `fetchNextRequest()` and not marked as handled yet.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(this, "inProgress", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: new Set()
|
|
29
|
+
});
|
|
30
|
+
/** Set of URLs for which `reclaimRequest()` was called. */
|
|
31
|
+
Object.defineProperty(this, "reclaimed", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: new Set()
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Map of returned Request objects that have not been marked as handled yet.
|
|
39
|
+
*
|
|
40
|
+
* We use this to persist custom user fields on the in-progress (or reclaimed) requests.
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(this, "requestData", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: new Map()
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Object for keeping track of the sitemap parsing progress.
|
|
50
|
+
*/
|
|
51
|
+
Object.defineProperty(this, "sitemapParsingProgress", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true,
|
|
55
|
+
value: {
|
|
56
|
+
/**
|
|
57
|
+
* URL of the sitemap that is currently being parsed. `null` if no sitemap is being parsed.
|
|
58
|
+
*/
|
|
59
|
+
inProgressSitemapUrl: null,
|
|
60
|
+
/**
|
|
61
|
+
* Buffer for URLs from the currently parsed sitemap. Used for tracking partially loaded sitemaps across migrations.
|
|
62
|
+
*/
|
|
63
|
+
inProgressEntries: new Set(),
|
|
64
|
+
/**
|
|
65
|
+
* Set of sitemap URLs that have not been fully parsed yet. If the set is empty and `inProgressSitemapUrl` is `null`, the sitemap loading is finished.
|
|
66
|
+
*/
|
|
67
|
+
pendingSitemapUrls: new Set(),
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Object stream of URLs parsed from the sitemaps.
|
|
72
|
+
* Using `highWaterMark`, this can manage the speed of the sitemap loading.
|
|
73
|
+
*
|
|
74
|
+
* Fetch the next URL to be processed using `fetchNextRequest()`.
|
|
75
|
+
*/
|
|
76
|
+
Object.defineProperty(this, "urlQueueStream", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
value: void 0
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Indicates whether the request list sitemap loading was aborted.
|
|
84
|
+
*
|
|
85
|
+
* If the loading was aborted before the sitemaps were fully loaded, the request list might be missing some URLs.
|
|
86
|
+
* The `isSitemapFullyLoaded` method can be used to check if the sitemaps were fully loaded.
|
|
87
|
+
*
|
|
88
|
+
* If the loading is aborted and all the requests are handled, `isFinished()` will return `true`.
|
|
89
|
+
*/
|
|
90
|
+
Object.defineProperty(this, "abortLoading", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: false
|
|
95
|
+
});
|
|
96
|
+
/** Number of URLs that were marked as handled */
|
|
97
|
+
Object.defineProperty(this, "handledUrlCount", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true,
|
|
100
|
+
writable: true,
|
|
101
|
+
value: 0
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(this, "persistStateKey", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
configurable: true,
|
|
106
|
+
writable: true,
|
|
107
|
+
value: void 0
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(this, "store", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
configurable: true,
|
|
112
|
+
writable: true,
|
|
113
|
+
value: void 0
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* Proxy URL to be used for sitemap loading.
|
|
117
|
+
*/
|
|
118
|
+
Object.defineProperty(this, "proxyUrl", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
configurable: true,
|
|
121
|
+
writable: true,
|
|
122
|
+
value: void 0
|
|
123
|
+
});
|
|
124
|
+
/**
|
|
125
|
+
* Logger instance.
|
|
126
|
+
*/
|
|
127
|
+
Object.defineProperty(this, "log", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true,
|
|
130
|
+
writable: true,
|
|
131
|
+
value: log_1.default.child({ prefix: 'SitemapRequestList' })
|
|
132
|
+
});
|
|
133
|
+
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
134
|
+
sitemapUrls: ow_1.default.array.ofType(ow_1.default.string),
|
|
135
|
+
proxyUrl: ow_1.default.optional.string,
|
|
136
|
+
persistStateKey: ow_1.default.optional.string,
|
|
137
|
+
signal: ow_1.default.optional.any(),
|
|
138
|
+
timeoutMillis: ow_1.default.optional.number,
|
|
139
|
+
maxBufferSize: ow_1.default.optional.number,
|
|
140
|
+
}));
|
|
141
|
+
this.persistStateKey = options.persistStateKey;
|
|
142
|
+
this.proxyUrl = options.proxyUrl;
|
|
143
|
+
this.urlQueueStream = new node_stream_1.Transform({
|
|
144
|
+
objectMode: true,
|
|
145
|
+
highWaterMark: options.maxBufferSize ?? 200,
|
|
146
|
+
});
|
|
147
|
+
this.urlQueueStream.pause();
|
|
148
|
+
this.sitemapParsingProgress.pendingSitemapUrls = new Set(options.sitemapUrls);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Adds a URL to the queue of parsed URLs.
|
|
152
|
+
*
|
|
153
|
+
* Blocks if the stream is full until it is drained.
|
|
154
|
+
*/
|
|
155
|
+
async pushNextUrl(url) {
|
|
156
|
+
return new Promise((resolve) => {
|
|
157
|
+
if (!this.urlQueueStream.push(url)) {
|
|
158
|
+
// This doesn't work with the 'drain' event (it's not emitted for some reason).
|
|
159
|
+
this.urlQueueStream.once('readdata', () => {
|
|
160
|
+
resolve();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
resolve();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reads the next URL from the queue of parsed URLs.
|
|
170
|
+
*
|
|
171
|
+
* If the stream is empty, blocks until a new URL is pushed.
|
|
172
|
+
* @returns The next URL from the queue or `null` if we have read all URLs.
|
|
173
|
+
*/
|
|
174
|
+
async readNextUrl() {
|
|
175
|
+
return new Promise((resolve) => {
|
|
176
|
+
const result = this.urlQueueStream.read();
|
|
177
|
+
if (!result && !this.isSitemapFullyLoaded()) {
|
|
178
|
+
this.urlQueueStream.once('readable', () => {
|
|
179
|
+
const nextUrl = this.urlQueueStream.read();
|
|
180
|
+
resolve(nextUrl);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
resolve(result);
|
|
185
|
+
}
|
|
186
|
+
this.urlQueueStream.emit('readdata');
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Indicates whether the background processing of sitemap contents has successfully finished.
|
|
191
|
+
*
|
|
192
|
+
* If this is `false`, the background processing is either still in progress or was aborted.
|
|
193
|
+
*/
|
|
194
|
+
isSitemapFullyLoaded() {
|
|
195
|
+
return (this.sitemapParsingProgress.inProgressSitemapUrl === null &&
|
|
196
|
+
this.sitemapParsingProgress.pendingSitemapUrls.size === 0);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Start processing the sitemaps and loading the URLs.
|
|
200
|
+
*
|
|
201
|
+
* Resolves once all the sitemaps URLs have been fully loaded (sets `isSitemapFullyLoaded` to `true`).
|
|
202
|
+
*/
|
|
203
|
+
async load() {
|
|
204
|
+
while (!this.isSitemapFullyLoaded() && !this.abortLoading) {
|
|
205
|
+
const sitemapUrl = this.sitemapParsingProgress.inProgressSitemapUrl ??
|
|
206
|
+
this.sitemapParsingProgress.pendingSitemapUrls.values().next().value;
|
|
207
|
+
try {
|
|
208
|
+
for await (const item of (0, utils_1.parseSitemap)([{ type: 'url', url: sitemapUrl }], this.proxyUrl, {
|
|
209
|
+
maxDepth: 0,
|
|
210
|
+
emitNestedSitemaps: true,
|
|
211
|
+
})) {
|
|
212
|
+
if (!item.originSitemapUrl) {
|
|
213
|
+
// This is a nested sitemap
|
|
214
|
+
this.sitemapParsingProgress.pendingSitemapUrls.add(item.loc);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!this.sitemapParsingProgress.inProgressEntries.has(item.loc)) {
|
|
218
|
+
await this.pushNextUrl(item.loc);
|
|
219
|
+
this.sitemapParsingProgress.inProgressEntries.add(item.loc);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
this.log.error('Error loading sitemap contents:', e);
|
|
225
|
+
}
|
|
226
|
+
this.sitemapParsingProgress.pendingSitemapUrls.delete(sitemapUrl);
|
|
227
|
+
this.sitemapParsingProgress.inProgressEntries.clear();
|
|
228
|
+
this.sitemapParsingProgress.inProgressSitemapUrl = null;
|
|
229
|
+
}
|
|
230
|
+
await this.pushNextUrl(null);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Open a sitemap and start processing it.
|
|
234
|
+
*
|
|
235
|
+
* Resolves to a new instance of `SitemapRequestList`, which **might not be fully loaded yet** - i.e. the sitemap might still be loading in the background.
|
|
236
|
+
*
|
|
237
|
+
* Track the loading progress using the `isSitemapFullyLoaded` property.
|
|
238
|
+
*/
|
|
239
|
+
static async open(options) {
|
|
240
|
+
const requestList = new SitemapRequestList(options);
|
|
241
|
+
await requestList.restoreState();
|
|
242
|
+
void requestList.load();
|
|
243
|
+
options?.signal?.addEventListener('abort', () => {
|
|
244
|
+
requestList.abortLoading = true;
|
|
245
|
+
});
|
|
246
|
+
if (options.timeoutMillis) {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
requestList.abortLoading = true;
|
|
249
|
+
}, options.timeoutMillis);
|
|
250
|
+
}
|
|
251
|
+
return requestList;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* @inheritDoc
|
|
255
|
+
*/
|
|
256
|
+
length() {
|
|
257
|
+
return this.urlQueueStream.readableLength + this.handledUrlCount - this.inProgress.size - this.reclaimed.size;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @inheritDoc
|
|
261
|
+
*/
|
|
262
|
+
async isFinished() {
|
|
263
|
+
return ((await this.isEmpty()) && this.inProgress.size === 0 && (this.isSitemapFullyLoaded() || this.abortLoading));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* @inheritDoc
|
|
267
|
+
*/
|
|
268
|
+
async isEmpty() {
|
|
269
|
+
return this.reclaimed.size === 0 && this.urlQueueStream.readableLength === 0;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* @inheritDoc
|
|
273
|
+
*/
|
|
274
|
+
handledCount() {
|
|
275
|
+
return this.handledUrlCount;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @inheritDoc
|
|
279
|
+
*/
|
|
280
|
+
async persistState() {
|
|
281
|
+
if (this.persistStateKey === undefined) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
this.store ?? (this.store = await key_value_store_1.KeyValueStore.open());
|
|
285
|
+
const urlQueue = [];
|
|
286
|
+
while (this.urlQueueStream.readableLength > 0) {
|
|
287
|
+
const url = this.urlQueueStream.read();
|
|
288
|
+
if (url === null) {
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
urlQueue.push(url);
|
|
292
|
+
}
|
|
293
|
+
for (const url of urlQueue) {
|
|
294
|
+
this.urlQueueStream.push(url);
|
|
295
|
+
}
|
|
296
|
+
await this.store.setValue(this.persistStateKey, {
|
|
297
|
+
sitemapParsingProgress: {
|
|
298
|
+
pendingSitemapUrls: Array.from(this.sitemapParsingProgress.pendingSitemapUrls),
|
|
299
|
+
inProgressSitemapUrl: this.sitemapParsingProgress.inProgressSitemapUrl,
|
|
300
|
+
inProgressEntries: Array.from(this.sitemapParsingProgress.inProgressEntries),
|
|
301
|
+
},
|
|
302
|
+
urlQueue,
|
|
303
|
+
reclaimed: [...this.inProgress, ...this.reclaimed], // In-progress and reclaimed requests will be both retried if state is restored
|
|
304
|
+
requestData: Array.from(this.requestData.entries()),
|
|
305
|
+
abortLoading: this.abortLoading,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
async restoreState() {
|
|
309
|
+
await (0, utils_2.purgeDefaultStorages)({ onlyPurgeOnce: true });
|
|
310
|
+
if (this.persistStateKey === undefined) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
this.store ?? (this.store = await key_value_store_1.KeyValueStore.open());
|
|
314
|
+
const state = await this.store.getValue(this.persistStateKey);
|
|
315
|
+
if (state === null) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
this.reclaimed = new Set(state.reclaimed);
|
|
319
|
+
this.sitemapParsingProgress = {
|
|
320
|
+
pendingSitemapUrls: new Set(state.sitemapParsingProgress.pendingSitemapUrls),
|
|
321
|
+
inProgressSitemapUrl: state.sitemapParsingProgress.inProgressSitemapUrl,
|
|
322
|
+
inProgressEntries: new Set(state.sitemapParsingProgress.inProgressEntries),
|
|
323
|
+
};
|
|
324
|
+
this.requestData = new Map(state.requestData ?? []);
|
|
325
|
+
for (const url of state.urlQueue) {
|
|
326
|
+
this.urlQueueStream.push(url);
|
|
327
|
+
}
|
|
328
|
+
this.abortLoading = state.abortLoading;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @inheritDoc
|
|
332
|
+
*/
|
|
333
|
+
async fetchNextRequest() {
|
|
334
|
+
// Try to return a reclaimed request first
|
|
335
|
+
let nextUrl = this.reclaimed.values().next().value;
|
|
336
|
+
if (nextUrl) {
|
|
337
|
+
this.reclaimed.delete(nextUrl);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
// Otherwise read next url from the stream
|
|
341
|
+
nextUrl = await this.readNextUrl();
|
|
342
|
+
if (!nextUrl) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
this.requestData.set(nextUrl, new request_1.Request({ url: nextUrl }));
|
|
346
|
+
}
|
|
347
|
+
this.inProgress.add(nextUrl);
|
|
348
|
+
return this.requestData.get(nextUrl);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* @inheritDoc
|
|
352
|
+
*/
|
|
353
|
+
async *[Symbol.asyncIterator]() {
|
|
354
|
+
while ((!this.isSitemapFullyLoaded() && !this.abortLoading) || !(await this.isEmpty())) {
|
|
355
|
+
const request = await this.fetchNextRequest();
|
|
356
|
+
if (!request)
|
|
357
|
+
break;
|
|
358
|
+
yield request;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* @inheritDoc
|
|
363
|
+
*/
|
|
364
|
+
async reclaimRequest(request) {
|
|
365
|
+
this.ensureInProgressAndNotReclaimed(request.url);
|
|
366
|
+
this.reclaimed.add(request.url);
|
|
367
|
+
this.inProgress.delete(request.url);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @inheritDoc
|
|
371
|
+
*/
|
|
372
|
+
async markRequestHandled(request) {
|
|
373
|
+
this.handledUrlCount += 1;
|
|
374
|
+
this.ensureInProgressAndNotReclaimed(request.url);
|
|
375
|
+
this.inProgress.delete(request.url);
|
|
376
|
+
this.requestData.delete(request.url);
|
|
377
|
+
}
|
|
378
|
+
ensureInProgressAndNotReclaimed(url) {
|
|
379
|
+
if (!this.inProgress.has(url)) {
|
|
380
|
+
throw new Error(`The request is not being processed (url: ${url})`);
|
|
381
|
+
}
|
|
382
|
+
if (this.reclaimed.has(url)) {
|
|
383
|
+
throw new Error(`The request was already reclaimed (url: ${url})`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
exports.SitemapRequestList = SitemapRequestList;
|
|
388
|
+
//# sourceMappingURL=sitemap_request_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap_request_list.js","sourceRoot":"","sources":["../../src/storages/sitemap_request_list.ts"],"names":[],"mappings":";;;;AAAA,6CAAwC;AAExC,6DAAoC;AACpC,0CAA8C;AAC9C,oDAAoB;AAEpB,uDAAkD;AAElD,mCAA+C;AAC/C,wCAAqC;AA8CrC;;;;GAIG;AACH,MAAa,kBAAkB;IAsE3B,gBAAgB;IAChB,YAAoB,OAAkC;QAtEtD;;;WAGG;QACH;;;;mBAAa,IAAI,GAAG,EAAU;WAAC;QAE/B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C,+BAA+B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAgB;QACrC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAEO,+BAA+B,CAAC,GAAW;QAC/C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,GAAG,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,GAAG,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;CACJ;AAjXD,gDAiXC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StorageClient } from '@crawlee/types';
|
|
2
2
|
import { Configuration } from '../configuration';
|
|
3
3
|
import type { ProxyConfiguration } from '../proxy_configuration';
|
|
4
4
|
import type { Constructor } from '../typedefs';
|
|
@@ -33,7 +33,7 @@ export declare class StorageManager<T extends IStorage = IStorage> {
|
|
|
33
33
|
protected _getOrCreateStorage(storageIdOrName: string, storageConstructorName: string, apiClient: StorageClient): Promise<import("@crawlee/types").DatasetCollectionData>;
|
|
34
34
|
protected _getStorageClientFactories(client: StorageClient, storageConstructorName: string): {
|
|
35
35
|
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
36
|
-
createStorageClient: ((id: string) => import("@crawlee/types").DatasetClient
|
|
36
|
+
createStorageClient: ((id: string) => import("@crawlee/types").DatasetClient) | ((id: string) => import("@crawlee/types").KeyValueStoreClient) | ((id: string, options?: import("@crawlee/types").RequestQueueOptions) => import("@crawlee/types").RequestQueueClient);
|
|
37
37
|
// @ts-ignore optional peer dependency or compatibility with es2022
|
|
38
38
|
createStorageCollectionClient: (() => import("@crawlee/types").DatasetCollectionClient) | (() => import("@crawlee/types").KeyValueStoreCollectionClient) | (() => import("@crawlee/types").RequestQueueCollectionClient);
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage_manager.d.ts","sourceRoot":"","sources":["../../src/storages/storage_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"storage_manager.d.ts","sourceRoot":"","sources":["../../src/storages/storage_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ/C,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,qBAAa,cAAc,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IAQjD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAP3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+C;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoC;IACvE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/storages/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;GAEG;AACH,UAAU,0BAA0B;IAChC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAChG;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAwB1G,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAChE,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/storages/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;GAEG;AACH,UAAU,0BAA0B;IAChC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAChG;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAwB1G,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAChE,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAS,KAAK,EAC1B,OAAO,CAAC,EAAE,eAAe,kBAM5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,UAI7C;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAErD,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC"}
|
package/storages/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_QUERIES_FOR_CONSISTENCY = exports.API_PROCESSED_REQUESTS_DELAY_MILLIS = exports.QUERY_HEAD_BUFFER = exports.STORAGE_CONSISTENCY_DELAY_MILLIS = exports.QUERY_HEAD_MIN_LENGTH =
|
|
3
|
+
exports.MAX_QUERIES_FOR_CONSISTENCY = exports.API_PROCESSED_REQUESTS_DELAY_MILLIS = exports.QUERY_HEAD_BUFFER = exports.STORAGE_CONSISTENCY_DELAY_MILLIS = exports.QUERY_HEAD_MIN_LENGTH = void 0;
|
|
4
|
+
exports.purgeDefaultStorages = purgeDefaultStorages;
|
|
5
|
+
exports.useState = useState;
|
|
6
|
+
exports.getRequestId = getRequestId;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
6
9
|
const key_value_store_1 = require("./key_value_store");
|
|
@@ -21,7 +24,6 @@ async function purgeDefaultStorages(configOrOptions, client) {
|
|
|
21
24
|
await casted.purge?.();
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
exports.purgeDefaultStorages = purgeDefaultStorages;
|
|
25
27
|
/**
|
|
26
28
|
* Easily create and manage state values. All state values are automatically persisted.
|
|
27
29
|
*
|
|
@@ -37,7 +39,6 @@ async function useState(name, defaultValue = {}, options) {
|
|
|
37
39
|
});
|
|
38
40
|
return kvStore.getAutoSavedValue(name || 'CRAWLEE_GLOBAL_STATE', defaultValue);
|
|
39
41
|
}
|
|
40
|
-
exports.useState = useState;
|
|
41
42
|
/**
|
|
42
43
|
* Helper function that creates ID from uniqueKey for local emulation of request queue.
|
|
43
44
|
* It's also used for local cache of remote request queue.
|
|
@@ -51,7 +52,6 @@ function getRequestId(uniqueKey) {
|
|
|
51
52
|
const str = node_crypto_1.default.createHash('sha256').update(uniqueKey).digest('base64').replace(/[+/=]/g, '');
|
|
52
53
|
return str.slice(0, 15);
|
|
53
54
|
}
|
|
54
|
-
exports.getRequestId = getRequestId;
|
|
55
55
|
/**
|
|
56
56
|
* When requesting queue head we always fetch requestsInProgressCount * QUERY_HEAD_BUFFER number of requests.
|
|
57
57
|
* @internal
|
package/storages/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/storages/utils.ts"],"names":[],"mappings":"
|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