@crawlee/core 4.0.0-beta.66 → 4.0.0-beta.68

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 (107) hide show
  1. package/README.md +10 -10
  2. package/autoscaling/snapshotter.js +1 -1
  3. package/autoscaling/snapshotter.js.map +1 -1
  4. package/configuration.d.ts +3 -0
  5. package/configuration.d.ts.map +1 -1
  6. package/configuration.js +3 -0
  7. package/configuration.js.map +1 -1
  8. package/crawlers/statistics.d.ts +1 -1
  9. package/crawlers/statistics.js +2 -2
  10. package/crawlers/statistics.js.map +1 -1
  11. package/events/event_manager.d.ts +26 -2
  12. package/events/event_manager.d.ts.map +1 -1
  13. package/events/event_manager.js +1 -0
  14. package/events/event_manager.js.map +1 -1
  15. package/index.d.ts +2 -1
  16. package/index.d.ts.map +1 -1
  17. package/index.js +1 -0
  18. package/index.js.map +1 -1
  19. package/memory-storage/consts.d.ts +5 -0
  20. package/memory-storage/consts.d.ts.map +1 -0
  21. package/memory-storage/consts.js +5 -0
  22. package/memory-storage/consts.js.map +1 -0
  23. package/memory-storage/index.d.ts +2 -0
  24. package/memory-storage/index.d.ts.map +1 -0
  25. package/memory-storage/index.js +2 -0
  26. package/memory-storage/index.js.map +1 -0
  27. package/memory-storage/memory-storage.d.ts +47 -0
  28. package/memory-storage/memory-storage.d.ts.map +1 -0
  29. package/memory-storage/memory-storage.js +137 -0
  30. package/memory-storage/memory-storage.js.map +1 -0
  31. package/memory-storage/resource-clients/common/base-client.d.ts +5 -0
  32. package/memory-storage/resource-clients/common/base-client.d.ts.map +1 -0
  33. package/memory-storage/resource-clients/common/base-client.js +7 -0
  34. package/memory-storage/resource-clients/common/base-client.js.map +1 -0
  35. package/memory-storage/resource-clients/dataset.d.ts +41 -0
  36. package/memory-storage/resource-clients/dataset.d.ts.map +1 -0
  37. package/memory-storage/resource-clients/dataset.js +114 -0
  38. package/memory-storage/resource-clients/dataset.js.map +1 -0
  39. package/memory-storage/resource-clients/key-value-store.d.ts +64 -0
  40. package/memory-storage/resource-clients/key-value-store.d.ts.map +1 -0
  41. package/memory-storage/resource-clients/key-value-store.js +204 -0
  42. package/memory-storage/resource-clients/key-value-store.js.map +1 -0
  43. package/memory-storage/resource-clients/request-queue.d.ts +97 -0
  44. package/memory-storage/resource-clients/request-queue.d.ts.map +1 -0
  45. package/memory-storage/resource-clients/request-queue.js +422 -0
  46. package/memory-storage/resource-clients/request-queue.js.map +1 -0
  47. package/memory-storage/utils.d.ts +12 -0
  48. package/memory-storage/utils.d.ts.map +1 -0
  49. package/memory-storage/utils.js +28 -0
  50. package/memory-storage/utils.js.map +1 -0
  51. package/package.json +8 -5
  52. package/request.d.ts +10 -2
  53. package/request.d.ts.map +1 -1
  54. package/request.js +25 -7
  55. package/request.js.map +1 -1
  56. package/service_locator.d.ts +17 -17
  57. package/service_locator.d.ts.map +1 -1
  58. package/service_locator.js +31 -26
  59. package/service_locator.js.map +1 -1
  60. package/session_pool/consts.d.ts +1 -1
  61. package/session_pool/consts.d.ts.map +1 -1
  62. package/session_pool/consts.js +1 -1
  63. package/session_pool/consts.js.map +1 -1
  64. package/session_pool/session_pool.d.ts +1 -1
  65. package/storages/access_checking.d.ts.map +1 -1
  66. package/storages/access_checking.js +5 -1
  67. package/storages/access_checking.js.map +1 -1
  68. package/storages/dataset.d.ts +10 -3
  69. package/storages/dataset.d.ts.map +1 -1
  70. package/storages/dataset.js +28 -13
  71. package/storages/dataset.js.map +1 -1
  72. package/storages/index.d.ts +2 -0
  73. package/storages/index.d.ts.map +1 -1
  74. package/storages/index.js +2 -0
  75. package/storages/index.js.map +1 -1
  76. package/storages/key_value_store.d.ts +61 -13
  77. package/storages/key_value_store.d.ts.map +1 -1
  78. package/storages/key_value_store.js +119 -86
  79. package/storages/key_value_store.js.map +1 -1
  80. package/storages/key_value_store_codec.d.ts +33 -0
  81. package/storages/key_value_store_codec.d.ts.map +1 -0
  82. package/storages/key_value_store_codec.js +114 -0
  83. package/storages/key_value_store_codec.js.map +1 -0
  84. package/storages/request_list.js +2 -2
  85. package/storages/request_list.js.map +1 -1
  86. package/storages/request_manager.d.ts +2 -2
  87. package/storages/request_manager.d.ts.map +1 -1
  88. package/storages/request_manager_tandem.d.ts +1 -1
  89. package/storages/request_manager_tandem.d.ts.map +1 -1
  90. package/storages/request_manager_tandem.js +5 -4
  91. package/storages/request_manager_tandem.js.map +1 -1
  92. package/storages/request_queue.d.ts +13 -6
  93. package/storages/request_queue.d.ts.map +1 -1
  94. package/storages/request_queue.js +44 -27
  95. package/storages/request_queue.js.map +1 -1
  96. package/storages/storage_instance_manager.d.ts +10 -10
  97. package/storages/storage_instance_manager.d.ts.map +1 -1
  98. package/storages/storage_instance_manager.js +33 -33
  99. package/storages/storage_instance_manager.js.map +1 -1
  100. package/storages/storage_stats.d.ts +49 -0
  101. package/storages/storage_stats.d.ts.map +1 -0
  102. package/storages/storage_stats.js +30 -0
  103. package/storages/storage_stats.js.map +1 -0
  104. package/storages/utils.d.ts +7 -7
  105. package/storages/utils.d.ts.map +1 -1
  106. package/storages/utils.js +4 -4
  107. package/storages/utils.js.map +1 -1
@@ -0,0 +1,422 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { AsyncQueue } from '@sapphire/async-queue';
3
+ import { s } from '@sapphire/shapeshift';
4
+ import { purgeNullsFromObject, uniqueKeyToRequestId } from '../utils.js';
5
+ import { BaseClient } from './common/base-client.js';
6
+ const requestShape = s
7
+ .object({
8
+ id: s.string(),
9
+ url: s.string().url({ allowedProtocols: ['http:', 'https:'] }),
10
+ uniqueKey: s.string(),
11
+ method: s.string().optional(),
12
+ retryCount: s.number().int().optional(),
13
+ handledAt: s.union([s.string(), s.date().valid()]).optional(),
14
+ })
15
+ .passthrough();
16
+ const requestShapeWithoutId = requestShape.omit(['id']);
17
+ const batchRequestShapeWithoutId = requestShapeWithoutId.array();
18
+ const requestOptionsShape = s.object({
19
+ forefront: s.boolean().optional(),
20
+ });
21
+ export class RequestQueueBackend extends BaseClient {
22
+ name;
23
+ /**
24
+ * The key used for cache lookup. For named storages, this equals the name. For alias (unnamed)
25
+ * storages, this is the alias string. Falls back to id.
26
+ */
27
+ cacheKey;
28
+ createdAt = new Date();
29
+ accessedAt = new Date();
30
+ modifiedAt = new Date();
31
+ handledRequestCount = 0;
32
+ pendingRequestCount = 0;
33
+ /**
34
+ * Serializes every operation that reads-then-writes this backend's shared queue state — the
35
+ * `requests` map, the `forefrontRequestIds` array, the `inProgressRequestIds` set and the request
36
+ * counts. Those mutations span `await` points, so without this mutex a concurrent operation could
37
+ * interleave and corrupt them (e.g. a head scan pruning `forefrontRequestIds` while
38
+ * `addBatchOfRequests` pushes to it). Held by every mutating method as well as by `isEmpty`/
39
+ * `isFinished`, whose head scan also prunes `forefrontRequestIds`.
40
+ */
41
+ queueStateMutex = new AsyncQueue();
42
+ forefrontRequestIds = [];
43
+ /**
44
+ * IDs of requests currently fetched but not yet handled or reclaimed. A request in this set is
45
+ * "in progress" and will not be handed out again by {@link fetchNextRequest}.
46
+ *
47
+ * Unlike the file-system / platform clients, the in-memory queue lives entirely within a single
48
+ * process and is never shared with another consumer, so there is no need for an expiring,
49
+ * cross-process-visible lock — tracking in-progress requests in this set is enough.
50
+ */
51
+ inProgressRequestIds = new Set();
52
+ requests = new Map();
53
+ storageBackend;
54
+ constructor(options) {
55
+ super(options.id ?? randomUUID());
56
+ this.name = options.name;
57
+ this.cacheKey = options.cacheKey ?? this.name ?? this.id;
58
+ this.storageBackend = options.storageBackend;
59
+ }
60
+ async getMetadata() {
61
+ this.updateTimestamps(false);
62
+ return this.toRequestQueueInfo();
63
+ }
64
+ async drop() {
65
+ // Serialize against other mutators (and the head scans in `isEmpty`/`isFinished`) so a concurrent
66
+ // operation cannot observe half-cleared state — e.g. a forefront id whose request has already been
67
+ // removed, which `listPendingHead` would then dereference as `undefined`.
68
+ await this.queueStateMutex.wait();
69
+ try {
70
+ const storeIndex = this.storageBackend.requestQueueBackendCache.findIndex((queue) => queue.id === this.id);
71
+ if (storeIndex !== -1) {
72
+ const [oldBackend] = this.storageBackend.requestQueueBackendCache.splice(storeIndex, 1);
73
+ oldBackend.pendingRequestCount = 0;
74
+ // Clear all in-memory state, consistent with `purge`. Clearing `requests` alone would
75
+ // leave dangling ids in `forefrontRequestIds`/`inProgressRequestIds`, which a later head
76
+ // scan would resolve to a missing request and dereference.
77
+ oldBackend.requests.clear();
78
+ oldBackend.forefrontRequestIds = [];
79
+ oldBackend.inProgressRequestIds.clear();
80
+ }
81
+ }
82
+ finally {
83
+ this.queueStateMutex.shift();
84
+ }
85
+ }
86
+ async purge() {
87
+ // Serialize against other mutators (and the head scans in `isEmpty`/`isFinished`) so a concurrent
88
+ // operation cannot observe or repopulate half-cleared state across the `await` below.
89
+ await this.queueStateMutex.wait();
90
+ try {
91
+ // Clear all in-memory state
92
+ this.requests.clear();
93
+ this.forefrontRequestIds = [];
94
+ this.inProgressRequestIds.clear();
95
+ this.handledRequestCount = 0;
96
+ this.pendingRequestCount = 0;
97
+ this.updateTimestamps(true);
98
+ }
99
+ finally {
100
+ this.queueStateMutex.shift();
101
+ }
102
+ }
103
+ *requestKeyIterator() {
104
+ for (let i = this.forefrontRequestIds.length - 1; i >= 0; i--) {
105
+ yield this.forefrontRequestIds[i];
106
+ }
107
+ for (const key of this.requests.keys()) {
108
+ yield key;
109
+ }
110
+ }
111
+ /**
112
+ * Scans the queue and returns the pending head — requests that are neither handled nor currently
113
+ * in progress — ordered by `orderNo`, deduplicated.
114
+ *
115
+ * When `detectInProgressRequests` is set, the result also carries an `hasInProgressRequests` flag
116
+ * telling whether any unhandled-but-in-progress request was skipped along the way. It lets
117
+ * {@link isFinished} distinguish "no work left at all" from "work remains, but it is currently being
118
+ * processed". Without it, a consumer with concurrency could consider the queue finished and shut the
119
+ * crawler down while it is still handling the last requests.
120
+ *
121
+ * Computing the flag is expensive: because an in-progress request may sit anywhere in the queue, it
122
+ * forces a scan of every pending entry even when only `limit` items are wanted. Callers that only
123
+ * need the head (e.g. {@link fetchNextRequest}, {@link isEmpty}) leave it off so the scan can stop as
124
+ * soon as the page is filled, keeping those calls O(head) instead of O(N).
125
+ */
126
+ async listPendingHead(limit, detectInProgressRequests = false) {
127
+ const items = [];
128
+ let hasInProgressRequests = false;
129
+ // Tracks processed request IDs to avoid duplicates (request in both `forefrontRequestIds` and `requests`).
130
+ const seenRequestIds = new Set();
131
+ // Tracks handled request IDs from `forefrontRequestIds` to be removed.
132
+ const handledForefrontIds = new Set();
133
+ for (const requestId of this.requestKeyIterator()) {
134
+ // Once the requested page is filled we can stop — unless the caller asked us to detect
135
+ // in-progress requests and we have not yet seen one, in which case we must keep scanning.
136
+ if (items.length >= limit && (!detectInProgressRequests || hasInProgressRequests)) {
137
+ break;
138
+ }
139
+ if (seenRequestIds.has(requestId)) {
140
+ continue;
141
+ }
142
+ seenRequestIds.add(requestId);
143
+ const request = this.requests.get(requestId);
144
+ // Permanently-handled requests (`orderNo === null`) are in a terminal state and can be skipped.
145
+ if (request.orderNo === null) {
146
+ if (this.forefrontRequestIds.includes(requestId)) {
147
+ handledForefrontIds.add(requestId);
148
+ }
149
+ continue;
150
+ }
151
+ // In progress (fetched but not yet handled or reclaimed) — skip it, but remember that the
152
+ // queue is not truly empty.
153
+ if (this.inProgressRequestIds.has(requestId)) {
154
+ hasInProgressRequests = true;
155
+ continue;
156
+ }
157
+ if (items.length < limit) {
158
+ items.push(request);
159
+ }
160
+ }
161
+ this.forefrontRequestIds = this.forefrontRequestIds.filter((id) => !handledForefrontIds.has(id));
162
+ return {
163
+ items: items.sort((a, b) => a.orderNo - b.orderNo),
164
+ hasInProgressRequests: detectInProgressRequests ? hasInProgressRequests : undefined,
165
+ };
166
+ }
167
+ async fetchNextRequest() {
168
+ this.updateTimestamps(false);
169
+ await this.queueStateMutex.wait();
170
+ try {
171
+ const { items: [head], } = await this.listPendingHead(1);
172
+ if (!head) {
173
+ return undefined;
174
+ }
175
+ // Mark the request as in progress so it is not handed out again until it is handled or
176
+ // reclaimed. The request keeps its `orderNo` (and thus its forefront / normal ordering).
177
+ this.inProgressRequestIds.add(head.id);
178
+ return this._jsonToRequest(head.json) ?? undefined;
179
+ }
180
+ finally {
181
+ this.queueStateMutex.shift();
182
+ }
183
+ }
184
+ async addBatchOfRequests(requests, options = {}) {
185
+ batchRequestShapeWithoutId.parse(requests);
186
+ requestOptionsShape.parse(options);
187
+ // Serialize against other mutators (and the head scans in `isEmpty`/`isFinished`) so that the
188
+ // shared `requests` map, `forefrontRequestIds` array and request counts are not corrupted by a
189
+ // concurrent operation interleaving at one of the `await` points below.
190
+ await this.queueStateMutex.wait();
191
+ try {
192
+ const result = {
193
+ processedRequests: [],
194
+ unprocessedRequests: [],
195
+ };
196
+ for (const model of requests) {
197
+ const requestModel = this._createInternalRequest(model, options.forefront);
198
+ const existingRequestWithId = this.requests.get(requestModel.id);
199
+ if (existingRequestWithId) {
200
+ result.processedRequests.push({
201
+ requestId: existingRequestWithId.id,
202
+ uniqueKey: existingRequestWithId.uniqueKey,
203
+ wasAlreadyHandled: existingRequestWithId.orderNo === null,
204
+ wasAlreadyPresent: true,
205
+ });
206
+ continue;
207
+ }
208
+ this.requests.set(requestModel.id, requestModel);
209
+ if (requestModel.orderNo) {
210
+ this.pendingRequestCount += 1;
211
+ }
212
+ else {
213
+ this.handledRequestCount += 1;
214
+ }
215
+ if (options.forefront) {
216
+ this.forefrontRequestIds.push(requestModel.id);
217
+ }
218
+ result.processedRequests.push({
219
+ requestId: requestModel.id,
220
+ uniqueKey: requestModel.uniqueKey,
221
+ // We return wasAlreadyHandled: false even though the request may
222
+ // have been added as handled, because that's how API behaves.
223
+ wasAlreadyHandled: false,
224
+ wasAlreadyPresent: false,
225
+ });
226
+ }
227
+ this.updateTimestamps(true);
228
+ return result;
229
+ }
230
+ finally {
231
+ this.queueStateMutex.shift();
232
+ }
233
+ }
234
+ async getRequest(uniqueKey) {
235
+ s.string().parse(uniqueKey);
236
+ this.updateTimestamps(false);
237
+ const id = uniqueKeyToRequestId(uniqueKey);
238
+ const json = this.requests.get(id)?.json;
239
+ return this._jsonToRequest(json);
240
+ }
241
+ async markRequestAsHandled(request) {
242
+ requestShape.parse(request);
243
+ this.updateTimestamps(false);
244
+ // Serialize against other mutators (and the head scans in `isEmpty`/`isFinished`) so the shared
245
+ // `requests` map, `inProgressRequestIds` set and request counts stay consistent across the
246
+ // `await` points below.
247
+ await this.queueStateMutex.wait();
248
+ try {
249
+ const id = uniqueKeyToRequestId(request.uniqueKey);
250
+ const existingRequest = this.requests.get(id);
251
+ // The request must exist to be marked as handled. We intentionally do NOT require it to still
252
+ // be in progress: marking an already-released request handled must still succeed, otherwise
253
+ // the request could be handed out again and the queue would never finish.
254
+ if (!existingRequest) {
255
+ return undefined;
256
+ }
257
+ // A handled request has `orderNo === null`. Marking it again is an idempotent no-op.
258
+ const wasAlreadyHandled = existingRequest.orderNo === null;
259
+ const handledAt = request.handledAt ?? new Date().toISOString();
260
+ const requestModel = this._createInternalRequest({ ...request, handledAt }, false);
261
+ this.requests.set(id, requestModel);
262
+ // The request is no longer in progress for this client.
263
+ this.inProgressRequestIds.delete(id);
264
+ if (!wasAlreadyHandled) {
265
+ this.pendingRequestCount -= 1;
266
+ this.handledRequestCount += 1;
267
+ }
268
+ this.updateTimestamps(true);
269
+ return {
270
+ requestId: id,
271
+ wasAlreadyHandled,
272
+ wasAlreadyPresent: true,
273
+ };
274
+ }
275
+ finally {
276
+ this.queueStateMutex.shift();
277
+ }
278
+ }
279
+ async reclaimRequest(request, options = {}) {
280
+ requestShape.parse(request);
281
+ requestOptionsShape.parse(options);
282
+ this.updateTimestamps(false);
283
+ // Serialize against other mutators (and the head scans in `isEmpty`/`isFinished`) so the shared
284
+ // `requests` map, `forefrontRequestIds` array and `inProgressRequestIds` set stay consistent
285
+ // across the `await` points below.
286
+ await this.queueStateMutex.wait();
287
+ try {
288
+ const id = uniqueKeyToRequestId(request.uniqueKey);
289
+ const existingRequest = this.requests.get(id);
290
+ // The request must exist and not already be handled to be reclaimed. As with
291
+ // `markRequestAsHandled`, we do NOT require it to still be in progress — returning an
292
+ // already-released request to the queue (e.g. to honor a `forefront` reorder) must still
293
+ // work, rather than have the reclaim silently dropped.
294
+ if (!existingRequest || existingRequest.orderNo === null) {
295
+ return undefined;
296
+ }
297
+ // Reclaiming resets the `orderNo` to a fresh timestamp, restoring the request to the queue
298
+ // (at the front if `forefront`).
299
+ const requestModel = this._createInternalRequest(request, options.forefront);
300
+ this.requests.set(id, requestModel);
301
+ // The request is no longer in progress for this client.
302
+ this.inProgressRequestIds.delete(id);
303
+ if (options.forefront) {
304
+ this.forefrontRequestIds.push(id);
305
+ }
306
+ this.updateTimestamps(true);
307
+ return {
308
+ requestId: id,
309
+ wasAlreadyHandled: false,
310
+ wasAlreadyPresent: true,
311
+ };
312
+ }
313
+ finally {
314
+ this.queueStateMutex.shift();
315
+ }
316
+ }
317
+ async isEmpty() {
318
+ this.updateTimestamps(false);
319
+ // "Empty" means there is nothing left to fetch right now — i.e. the next `fetchNextRequest`
320
+ // would return `null`. Requests that are currently in progress are intentionally NOT counted
321
+ // here: they are not fetchable, so the queue is empty from a consumer's point of view. Whether
322
+ // those in-progress requests mean crawling is not yet done is a separate question, answered by
323
+ // `isFinished`.
324
+ //
325
+ // `listPendingHead` prunes `forefrontRequestIds` as it scans, so we must hold the queue-state mutex to avoid
326
+ // racing a concurrent mutator (e.g. `addBatchOfRequests`) at its `await` points.
327
+ await this.queueStateMutex.wait();
328
+ try {
329
+ const { items } = await this.listPendingHead(1);
330
+ return items.length === 0;
331
+ }
332
+ finally {
333
+ this.queueStateMutex.shift();
334
+ }
335
+ }
336
+ async isFinished() {
337
+ this.updateTimestamps(false);
338
+ // The queue is finished only when there is nothing left to fetch AND nothing currently in
339
+ // progress. Counting in-progress requests is what allows a crawler with concurrency to keep
340
+ // waiting while it still holds the last requests, instead of finishing prematurely.
341
+ //
342
+ // Detecting in-progress requests requires a full scan, hence the `detectInProgressRequests`
343
+ // flag — unlike `fetchNextRequest`/`isEmpty`, which only need the head and can stop early.
344
+ //
345
+ // `listPendingHead` prunes `forefrontRequestIds` as it scans, so we must hold the queue-state mutex to avoid
346
+ // racing a concurrent mutator (e.g. `addBatchOfRequests`) at its `await` points.
347
+ await this.queueStateMutex.wait();
348
+ try {
349
+ const { items, hasInProgressRequests } = await this.listPendingHead(1, true);
350
+ return items.length === 0 && !hasInProgressRequests;
351
+ }
352
+ finally {
353
+ this.queueStateMutex.shift();
354
+ }
355
+ }
356
+ /**
357
+ * Returns all pending (not yet handled, not currently in progress) requests in the queue, ordered
358
+ * the same way {@link fetchNextRequest} would hand them out. This does not mutate the queue,
359
+ * nothing is marked in progress.
360
+ */
361
+ async listItems() {
362
+ this.updateTimestamps(false);
363
+ // `listPendingHead` prunes `forefrontRequestIds` as it scans, so we must hold the queue-state
364
+ // mutex to avoid racing a concurrent mutator at its `await` points.
365
+ await this.queueStateMutex.wait();
366
+ try {
367
+ const { items } = await this.listPendingHead(Number.POSITIVE_INFINITY);
368
+ return items.map((request) => this._jsonToRequest(request.json));
369
+ }
370
+ finally {
371
+ this.queueStateMutex.shift();
372
+ }
373
+ }
374
+ toRequestQueueInfo() {
375
+ return {
376
+ accessedAt: this.accessedAt,
377
+ createdAt: this.createdAt,
378
+ handledRequestCount: this.handledRequestCount,
379
+ id: this.id,
380
+ modifiedAt: this.modifiedAt,
381
+ name: this.name,
382
+ pendingRequestCount: this.pendingRequestCount,
383
+ totalRequestCount: this.requests.size,
384
+ };
385
+ }
386
+ updateTimestamps(hasBeenModified) {
387
+ this.accessedAt = new Date();
388
+ if (hasBeenModified) {
389
+ this.modifiedAt = new Date();
390
+ }
391
+ }
392
+ _jsonToRequest(requestJson) {
393
+ if (!requestJson)
394
+ return undefined;
395
+ const request = JSON.parse(requestJson);
396
+ return purgeNullsFromObject(request);
397
+ }
398
+ _createInternalRequest(request, forefront) {
399
+ const orderNo = this._calculateOrderNo(request, forefront);
400
+ const id = uniqueKeyToRequestId(request.uniqueKey);
401
+ if (request.id && request.id !== id) {
402
+ throw new Error('Request ID does not match its uniqueKey.');
403
+ }
404
+ const json = JSON.stringify({ ...request, id });
405
+ return {
406
+ id,
407
+ json,
408
+ method: request.method,
409
+ orderNo,
410
+ retryCount: request.retryCount ?? 0,
411
+ uniqueKey: request.uniqueKey,
412
+ url: request.url,
413
+ };
414
+ }
415
+ _calculateOrderNo(request, forefront) {
416
+ if (request.handledAt)
417
+ return null;
418
+ const timestamp = Date.now();
419
+ return forefront ? -timestamp : timestamp;
420
+ }
421
+ }
422
+ //# sourceMappingURL=request-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-queue.js","sourceRoot":"","sources":["../../../src/memory-storage/resource-clients/request-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,YAAY,GAAG,CAAC;KACjB,MAAM,CAAC;IACJ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;IAC9D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAA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AAC,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC3D,MAAM,EAAE,GAAG,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO;YACH,EAAE;YACF,IAAI;YACJ,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO;YACP,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC;YACnC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,GAAG,EAAE,OAAO,CAAC,GAAG;SACnB,CAAC;IACN,CAAC;IAEO,iBAAiB,CAAC,OAA8B,EAAE,SAAmB;QACzE,IAAI,OAAO,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9C,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ import { isBuffer, isStream, toBuffer } from '@crawlee/utils';
2
+ /**
3
+ * Removes all properties with a null value
4
+ * from the provided object.
5
+ */
6
+ export declare function purgeNullsFromObject<T>(object: T): T;
7
+ /**
8
+ * Creates a standard request ID (same as Platform).
9
+ */
10
+ export declare function uniqueKeyToRequestId(uniqueKey: string): string;
11
+ export { isBuffer, isStream, toBuffer };
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/memory-storage/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAQpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAO9D;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { isBuffer, isStream, toBuffer } from '@crawlee/utils';
3
+ import { REQUEST_ID_LENGTH } from './consts.js';
4
+ /**
5
+ * Removes all properties with a null value
6
+ * from the provided object.
7
+ */
8
+ export function purgeNullsFromObject(object) {
9
+ if (object && typeof object === 'object' && !Array.isArray(object)) {
10
+ for (const [key, value] of Object.entries(object)) {
11
+ if (value === null)
12
+ Reflect.deleteProperty(object, key);
13
+ }
14
+ }
15
+ return object;
16
+ }
17
+ /**
18
+ * Creates a standard request ID (same as Platform).
19
+ */
20
+ export function uniqueKeyToRequestId(uniqueKey) {
21
+ const str = createHash('sha256')
22
+ .update(uniqueKey)
23
+ .digest('base64')
24
+ .replace(/(\+|\/|=)/g, '');
25
+ return str.length > REQUEST_ID_LENGTH ? str.slice(0, REQUEST_ID_LENGTH) : str;
26
+ }
27
+ export { isBuffer, isStream, toBuffer };
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/memory-storage/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAI,MAAS;IAC7C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,CAAC,cAAc,CAAC,MAAiC,EAAE,GAAG,CAAC,CAAC;QACvF,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IAClD,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC;SAC3B,MAAM,CAAC,SAAS,CAAC;SACjB,MAAM,CAAC,QAAQ,CAAC;SAChB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAE/B,OAAO,GAAG,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClF,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.66",
3
+ "version": "4.0.0-beta.68",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -53,13 +53,16 @@
53
53
  "@apify/pseudo_url": "^2.0.59",
54
54
  "@apify/timeout": "^0.3.2",
55
55
  "@apify/utilities": "^2.15.5",
56
- "@crawlee/memory-storage": "4.0.0-beta.66",
57
- "@crawlee/types": "4.0.0-beta.66",
58
- "@crawlee/utils": "4.0.0-beta.66",
56
+ "@crawlee/fs-storage": "4.0.0-beta.68",
57
+ "@crawlee/types": "4.0.0-beta.68",
58
+ "@crawlee/utils": "4.0.0-beta.68",
59
59
  "@sapphire/async-queue": "^1.5.5",
60
+ "@sapphire/shapeshift": "^4.0.0",
60
61
  "@vladfrangu/async_event_emitter": "^2.4.6",
62
+ "content-type": "^1.0.5",
61
63
  "csv-stringify": "^6.5.2",
62
64
  "json5": "^2.2.3",
65
+ "mime-types": "^3.0.1",
63
66
  "minimatch": "^10.0.1",
64
67
  "ow": "^2.0.0",
65
68
  "stream-json": "^1.9.1",
@@ -76,5 +79,5 @@
76
79
  }
77
80
  }
78
81
  },
79
- "gitHead": "0890633b51caf16d93940be6f7da7881ad839992"
82
+ "gitHead": "0856e557d3eaa0ec8a5facc775bf4ba98dd6b020"
80
83
  }
package/request.d.ts CHANGED
@@ -164,7 +164,7 @@ declare class CrawleeRequest<UserData extends Dictionary = Dictionary> {
164
164
  */
165
165
  pushErrorMessage(errorOrMessage: unknown, options?: PushErrorMessageOptions): void;
166
166
  /** @internal */
167
- static computeUniqueKey({ url, method, payload, keepUrlFragment, useExtendedUniqueKey, }: ComputeUniqueKeyOptions): string;
167
+ static computeUniqueKey({ url, method, payload, keepUrlFragment, useExtendedUniqueKey, alwaysEnqueue, }: ComputeUniqueKeyOptions): string;
168
168
  /** @internal */
169
169
  static hashPayload(payload: BinaryLike): string;
170
170
  }
@@ -185,7 +185,7 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
185
185
  * The `keepUrlFragment` option determines whether URL hash fragment is included in the `uniqueKey` or not.
186
186
  *
187
187
  * The `useExtendedUniqueKey` options determines whether method and payload are included in the `uniqueKey`,
188
- * producing a `uniqueKey` in the following format: `METHOD(payloadHash):normalizedUrl`. This is useful
188
+ * producing a `uniqueKey` in the following format: `METHOD|payloadHash|normalizedUrl`. This is useful
189
189
  * when requests point to the same URL, but with different methods and payloads. For example: form submits.
190
190
  *
191
191
  * Pass an arbitrary non-empty text value to the `uniqueKey` property
@@ -233,6 +233,13 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
233
233
  * @default false
234
234
  */
235
235
  useExtendedUniqueKey?: boolean;
236
+ /**
237
+ * If `true` then a random value is included in the `uniqueKey` computation, ensuring the request
238
+ * is always enqueued even if a request with the same URL (and method/payload) is already present
239
+ * in the queue. Cannot be used together with a custom `uniqueKey`.
240
+ * @default false
241
+ */
242
+ alwaysEnqueue?: boolean;
236
243
  /**
237
244
  * The `true` value indicates that the request will not be automatically retried on error.
238
245
  * @default false
@@ -291,6 +298,7 @@ interface ComputeUniqueKeyOptions {
291
298
  payload?: string | Buffer;
292
299
  keepUrlFragment?: boolean;
293
300
  useExtendedUniqueKey?: boolean;
301
+ alwaysEnqueue?: boolean;
294
302
  }
295
303
  export type Source = (Partial<RequestOptions> & {
296
304
  requestsFromUrl?: string;
package/request.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AA0BxD,oBAAY,YAAY;IACpB,WAAW,IAAA;IACX,UAAU,IAAA;IACV,SAAS,IAAA;IACT,eAAe,IAAA;IACf,IAAI,IAAA;IACJ,aAAa,IAAA;IACb,KAAK,IAAA;IACL,OAAO,IAAA;CACV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,cAAM,cAAc,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU;IACzD,iBAAiB;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,oCAAoC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