@crawlee/core 4.0.0-beta.3 → 4.0.0-beta.30
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 +5 -1
- package/autoscaling/autoscaled_pool.d.ts +1 -3
- package/autoscaling/autoscaled_pool.d.ts.map +1 -1
- package/autoscaling/autoscaled_pool.js +1 -7
- package/autoscaling/autoscaled_pool.js.map +1 -1
- package/autoscaling/snapshotter.d.ts +0 -10
- package/autoscaling/snapshotter.d.ts.map +1 -1
- package/autoscaling/snapshotter.js +15 -28
- package/autoscaling/snapshotter.js.map +1 -1
- package/autoscaling/system_status.d.ts +0 -3
- package/autoscaling/system_status.d.ts.map +1 -1
- package/autoscaling/system_status.js +2 -3
- package/autoscaling/system_status.js.map +1 -1
- package/configuration.d.ts +4 -77
- package/configuration.d.ts.map +1 -1
- package/configuration.js +5 -101
- package/configuration.js.map +1 -1
- package/cookie_utils.d.ts +1 -1
- package/cookie_utils.d.ts.map +1 -1
- package/cookie_utils.js +4 -6
- package/cookie_utils.js.map +1 -1
- package/crawlers/context_pipeline.d.ts +61 -0
- package/crawlers/context_pipeline.d.ts.map +1 -0
- package/crawlers/context_pipeline.js +99 -0
- package/crawlers/context_pipeline.js.map +1 -0
- package/crawlers/crawler_commons.d.ts +12 -20
- package/crawlers/crawler_commons.d.ts.map +1 -1
- package/crawlers/crawler_commons.js +0 -8
- package/crawlers/crawler_commons.js.map +1 -1
- package/crawlers/error_snapshotter.d.ts +3 -2
- package/crawlers/error_snapshotter.d.ts.map +1 -1
- package/crawlers/error_snapshotter.js +2 -2
- package/crawlers/error_snapshotter.js.map +1 -1
- package/crawlers/error_tracker.d.ts +2 -1
- package/crawlers/error_tracker.d.ts.map +1 -1
- package/crawlers/error_tracker.js.map +1 -1
- package/crawlers/index.d.ts +1 -1
- package/crawlers/index.d.ts.map +1 -1
- package/crawlers/index.js +1 -1
- package/crawlers/index.js.map +1 -1
- package/crawlers/internals/types.d.ts +8 -0
- package/crawlers/internals/types.d.ts.map +1 -0
- package/crawlers/internals/types.js +2 -0
- package/crawlers/internals/types.js.map +1 -0
- package/crawlers/statistics.d.ts +13 -13
- package/crawlers/statistics.d.ts.map +1 -1
- package/crawlers/statistics.js +20 -16
- package/crawlers/statistics.js.map +1 -1
- package/enqueue_links/enqueue_links.d.ts +30 -18
- package/enqueue_links/enqueue_links.d.ts.map +1 -1
- package/enqueue_links/enqueue_links.js +39 -21
- package/enqueue_links/enqueue_links.js.map +1 -1
- package/enqueue_links/shared.d.ts +24 -7
- package/enqueue_links/shared.d.ts.map +1 -1
- package/enqueue_links/shared.js +66 -37
- package/enqueue_links/shared.js.map +1 -1
- package/errors.d.ts +18 -0
- package/errors.d.ts.map +1 -1
- package/errors.js +29 -0
- package/errors.js.map +1 -1
- package/events/event_manager.d.ts +7 -4
- package/events/event_manager.d.ts.map +1 -1
- package/events/event_manager.js +5 -7
- package/events/event_manager.js.map +1 -1
- package/events/local_event_manager.d.ts +14 -4
- package/events/local_event_manager.d.ts.map +1 -1
- package/events/local_event_manager.js +26 -37
- package/events/local_event_manager.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/log.d.ts +4 -2
- package/log.d.ts.map +1 -1
- package/log.js.map +1 -1
- package/package.json +6 -7
- package/proxy_configuration.d.ts +16 -93
- package/proxy_configuration.d.ts.map +1 -1
- package/proxy_configuration.js +15 -51
- package/proxy_configuration.js.map +1 -1
- package/recoverable_state.d.ts +122 -0
- package/recoverable_state.d.ts.map +1 -0
- package/recoverable_state.js +138 -0
- package/recoverable_state.js.map +1 -0
- package/request.d.ts +39 -5
- package/request.d.ts.map +1 -1
- package/request.js +52 -12
- package/request.js.map +1 -1
- package/service_locator.d.ts +139 -0
- package/service_locator.d.ts.map +1 -0
- package/service_locator.js +252 -0
- package/service_locator.js.map +1 -0
- package/session_pool/session.d.ts +7 -20
- package/session_pool/session.d.ts.map +1 -1
- package/session_pool/session.js +16 -4
- package/session_pool/session.js.map +1 -1
- package/session_pool/session_pool.d.ts +12 -7
- package/session_pool/session_pool.d.ts.map +1 -1
- package/session_pool/session_pool.js +22 -11
- package/session_pool/session_pool.js.map +1 -1
- package/storages/dataset.d.ts +7 -0
- package/storages/dataset.d.ts.map +1 -1
- package/storages/dataset.js +14 -4
- package/storages/dataset.js.map +1 -1
- package/storages/index.d.ts +2 -0
- package/storages/index.d.ts.map +1 -1
- package/storages/index.js +2 -0
- package/storages/index.js.map +1 -1
- package/storages/key_value_store.d.ts +13 -1
- package/storages/key_value_store.d.ts.map +1 -1
- package/storages/key_value_store.js +16 -10
- package/storages/key_value_store.js.map +1 -1
- package/storages/request_list.d.ts +9 -9
- package/storages/request_list.d.ts.map +1 -1
- package/storages/request_list.js +10 -6
- package/storages/request_list.js.map +1 -1
- package/storages/request_list_adapter.d.ts +58 -0
- package/storages/request_list_adapter.d.ts.map +1 -0
- package/storages/request_list_adapter.js +81 -0
- package/storages/request_list_adapter.js.map +1 -0
- package/storages/request_manager_tandem.d.ts +68 -0
- package/storages/request_manager_tandem.d.ts.map +1 -0
- package/storages/request_manager_tandem.js +124 -0
- package/storages/request_manager_tandem.js.map +1 -0
- package/storages/request_provider.d.ts +74 -7
- package/storages/request_provider.d.ts.map +1 -1
- package/storages/request_provider.js +89 -52
- package/storages/request_provider.js.map +1 -1
- package/storages/request_queue.d.ts +1 -1
- package/storages/request_queue.d.ts.map +1 -1
- package/storages/request_queue.js +2 -2
- package/storages/request_queue.js.map +1 -1
- package/storages/request_queue_v2.d.ts +3 -3
- package/storages/request_queue_v2.d.ts.map +1 -1
- package/storages/request_queue_v2.js +4 -5
- package/storages/request_queue_v2.js.map +1 -1
- package/storages/sitemap_request_list.d.ts +5 -5
- package/storages/sitemap_request_list.d.ts.map +1 -1
- package/storages/sitemap_request_list.js +6 -5
- package/storages/sitemap_request_list.js.map +1 -1
- package/storages/storage_manager.d.ts +10 -8
- package/storages/storage_manager.d.ts.map +1 -1
- package/storages/storage_manager.js +12 -22
- package/storages/storage_manager.js.map +1 -1
- package/storages/utils.d.ts.map +1 -1
- package/storages/utils.js +4 -3
- package/storages/utils.js.map +1 -1
- package/typedefs.d.ts +1 -1
- package/typedefs.d.ts.map +1 -1
- package/crawlers/crawler_extension.d.ts +0 -12
- package/crawlers/crawler_extension.d.ts.map +0 -1
- package/crawlers/crawler_extension.js +0 -14
- package/crawlers/crawler_extension.js.map +0 -1
- package/http_clients/base-http-client.d.ts +0 -134
- package/http_clients/base-http-client.d.ts.map +0 -1
- package/http_clients/base-http-client.js +0 -33
- package/http_clients/base-http-client.js.map +0 -1
- package/http_clients/form-data-like.d.ts +0 -67
- package/http_clients/form-data-like.d.ts.map +0 -1
- package/http_clients/form-data-like.js +0 -5
- package/http_clients/form-data-like.js.map +0 -1
- package/http_clients/got-scraping-http-client.d.ts +0 -15
- package/http_clients/got-scraping-http-client.d.ts.map +0 -1
- package/http_clients/got-scraping-http-client.js +0 -69
- package/http_clients/got-scraping-http-client.js.map +0 -1
- package/http_clients/index.d.ts +0 -3
- package/http_clients/index.d.ts.map +0 -1
- package/http_clients/index.js +0 -3
- package/http_clients/index.js.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Dictionary } from '@crawlee/types';
|
|
2
|
+
import type { Request } from '../request.js';
|
|
3
|
+
import type { IRequestList } from './request_list.js';
|
|
4
|
+
import type { AddRequestsBatchedResult, IRequestManager, RequestQueueOperationInfo, RequestQueueOperationOptions } from './request_provider.js';
|
|
5
|
+
/**
|
|
6
|
+
* Adapts the IRequestList interface to the IRequestManager interface.
|
|
7
|
+
* It simply throws an exception when inserting requests is attempted.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class RequestListAdapter implements IRequestManager {
|
|
11
|
+
private requestList;
|
|
12
|
+
constructor(requestList: IRequestList);
|
|
13
|
+
/**
|
|
14
|
+
* @inheritdoc
|
|
15
|
+
*/
|
|
16
|
+
isFinished(): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* @inheritdoc
|
|
19
|
+
*/
|
|
20
|
+
isEmpty(): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritdoc
|
|
23
|
+
*/
|
|
24
|
+
handledCount(): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritdoc
|
|
27
|
+
*/
|
|
28
|
+
getTotalCount(): number;
|
|
29
|
+
/**
|
|
30
|
+
* @inheritdoc
|
|
31
|
+
*/
|
|
32
|
+
getPendingCount(): number;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritdoc
|
|
35
|
+
*/
|
|
36
|
+
fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
|
|
37
|
+
/**
|
|
38
|
+
* @inheritdoc
|
|
39
|
+
*/
|
|
40
|
+
markRequestHandled(request: Request): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* @inheritdoc
|
|
43
|
+
*/
|
|
44
|
+
reclaimRequest(request: Request, _options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
|
|
45
|
+
/**
|
|
46
|
+
* @inheritdoc
|
|
47
|
+
*/
|
|
48
|
+
[Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* @inheritdoc
|
|
51
|
+
*/
|
|
52
|
+
addRequestsBatched(): Promise<AddRequestsBatchedResult>;
|
|
53
|
+
/**
|
|
54
|
+
* @inheritdoc
|
|
55
|
+
*/
|
|
56
|
+
addRequest(): Promise<RequestQueueOperationInfo>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=request_list_adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request_list_adapter.d.ts","sourceRoot":"","sources":["../../src/storages/request_list_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACR,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IAC1C,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,YAAY;IAE7C;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAIrC;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACG,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAIvF;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;OAEG;IACG,cAAc,CAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,4BAA4B,GACxC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAK5C;;OAEG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC;IAM7B;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAIvD;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAGnD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapts the IRequestList interface to the IRequestManager interface.
|
|
3
|
+
* It simply throws an exception when inserting requests is attempted.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export class RequestListAdapter {
|
|
7
|
+
requestList;
|
|
8
|
+
constructor(requestList) {
|
|
9
|
+
this.requestList = requestList;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @inheritdoc
|
|
13
|
+
*/
|
|
14
|
+
async isFinished() {
|
|
15
|
+
return this.requestList.isFinished();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @inheritdoc
|
|
19
|
+
*/
|
|
20
|
+
async isEmpty() {
|
|
21
|
+
return this.requestList.isEmpty();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @inheritdoc
|
|
25
|
+
*/
|
|
26
|
+
async handledCount() {
|
|
27
|
+
return Promise.resolve(this.requestList.handledCount());
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @inheritdoc
|
|
31
|
+
*/
|
|
32
|
+
getTotalCount() {
|
|
33
|
+
return this.requestList.length();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @inheritdoc
|
|
37
|
+
*/
|
|
38
|
+
getPendingCount() {
|
|
39
|
+
return this.requestList.length() - this.requestList.handledCount();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @inheritdoc
|
|
43
|
+
*/
|
|
44
|
+
async fetchNextRequest() {
|
|
45
|
+
return await this.requestList.fetchNextRequest();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @inheritdoc
|
|
49
|
+
*/
|
|
50
|
+
async markRequestHandled(request) {
|
|
51
|
+
return this.requestList.markRequestHandled(request);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @inheritdoc
|
|
55
|
+
*/
|
|
56
|
+
async reclaimRequest(request, _options) {
|
|
57
|
+
await this.requestList.reclaimRequest(request);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @inheritdoc
|
|
62
|
+
*/
|
|
63
|
+
async *[Symbol.asyncIterator]() {
|
|
64
|
+
for await (const request of this.requestList) {
|
|
65
|
+
yield request;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @inheritdoc
|
|
70
|
+
*/
|
|
71
|
+
addRequestsBatched() {
|
|
72
|
+
throw new Error('Cannot add requests to a read-only request list');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @inheritdoc
|
|
76
|
+
*/
|
|
77
|
+
addRequest() {
|
|
78
|
+
throw new Error('Cannot add requests to a read-only request list');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=request_list_adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request_list_adapter.js","sourceRoot":"","sources":["../../src/storages/request_list_adapter.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACP;IAApB,YAAoB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QACd,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,aAAa;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,eAAe;QACX,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB;QAClB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAgB;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAChB,OAAgB,EAChB,QAAuC;QAEvC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3C,MAAM,OAAO,CAAC;QAClB,CAAC;IACL,CAAC;IAED;;OAEG;IACH,kBAAkB;QACd,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,UAAU;QACN,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACvE,CAAC;CACJ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Dictionary } from '@crawlee/types';
|
|
2
|
+
import type { Request, Source } from '../request.js';
|
|
3
|
+
import type { IRequestList } from './request_list.js';
|
|
4
|
+
import type { AddRequestsBatchedOptions, AddRequestsBatchedResult, IRequestManager, RequestQueueOperationInfo, RequestQueueOperationOptions, RequestsLike } from './request_provider.js';
|
|
5
|
+
/**
|
|
6
|
+
* A request manager that combines a RequestList and a RequestQueue.
|
|
7
|
+
* It first reads requests from the RequestList and then, when needed,
|
|
8
|
+
* transfers them in batches to the RequestQueue.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RequestManagerTandem implements IRequestManager {
|
|
11
|
+
private log;
|
|
12
|
+
private requestList;
|
|
13
|
+
private requestQueue;
|
|
14
|
+
constructor(requestList: IRequestList, requestQueue: IRequestManager);
|
|
15
|
+
/**
|
|
16
|
+
* Transfers a batch of requests from the RequestList to the RequestQueue.
|
|
17
|
+
* Handles both successful transfers and failures appropriately.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private transferNextBatchToQueue;
|
|
21
|
+
/**
|
|
22
|
+
* Fetches the next request from the RequestQueue. If the queue is empty and the RequestList
|
|
23
|
+
* is not finished, it will transfer a batch of requests from the list to the queue first.
|
|
24
|
+
* @inheritdoc
|
|
25
|
+
*/
|
|
26
|
+
fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritdoc
|
|
29
|
+
*/
|
|
30
|
+
isFinished(): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritdoc
|
|
33
|
+
*/
|
|
34
|
+
isEmpty(): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* @inheritdoc
|
|
37
|
+
*/
|
|
38
|
+
handledCount(): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritdoc
|
|
41
|
+
*/
|
|
42
|
+
getTotalCount(): number;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritdoc
|
|
45
|
+
*/
|
|
46
|
+
getPendingCount(): number;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritdoc
|
|
49
|
+
*/
|
|
50
|
+
[Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* @inheritdoc
|
|
53
|
+
*/
|
|
54
|
+
markRequestHandled(request: Request): Promise<RequestQueueOperationInfo | void | null>;
|
|
55
|
+
/**
|
|
56
|
+
* @inheritdoc
|
|
57
|
+
*/
|
|
58
|
+
reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
|
|
59
|
+
/**
|
|
60
|
+
* @inheritdoc
|
|
61
|
+
*/
|
|
62
|
+
addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
|
|
63
|
+
/**
|
|
64
|
+
* @inheritdoc
|
|
65
|
+
*/
|
|
66
|
+
addRequestsBatched(requests: RequestsLike, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=request_manager_tandem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request_manager_tandem.d.ts","sourceRoot":"","sources":["../../src/storages/request_manager_tandem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACR,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACf,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,YAAY,CAAkB;gBAE1B,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe;IAMpE;;;;OAIG;YACW,wBAAwB;IAuBtC;;;;OAIG;IACG,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAevF;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAKjC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAKrC;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC;IAQ7B;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAC;IAI5F;;OAEG;IACG,cAAc,CAChB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,4BAA4B,GACvC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAI5C;;OAEG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIjH;;OAEG;IACG,kBAAkB,CACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,yBAAyB,GACpC,OAAO,CAAC,wBAAwB,CAAC;CAGvC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { log } from '../log.js';
|
|
2
|
+
/**
|
|
3
|
+
* A request manager that combines a RequestList and a RequestQueue.
|
|
4
|
+
* It first reads requests from the RequestList and then, when needed,
|
|
5
|
+
* transfers them in batches to the RequestQueue.
|
|
6
|
+
*/
|
|
7
|
+
export class RequestManagerTandem {
|
|
8
|
+
log;
|
|
9
|
+
requestList;
|
|
10
|
+
requestQueue;
|
|
11
|
+
constructor(requestList, requestQueue) {
|
|
12
|
+
this.log = log.child({ prefix: 'RequestManagerTandem' });
|
|
13
|
+
this.requestList = requestList;
|
|
14
|
+
this.requestQueue = requestQueue;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Transfers a batch of requests from the RequestList to the RequestQueue.
|
|
18
|
+
* Handles both successful transfers and failures appropriately.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
async transferNextBatchToQueue() {
|
|
22
|
+
const request = await this.requestList.fetchNextRequest();
|
|
23
|
+
if (request === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
await this.requestQueue.addRequest(request, { forefront: true });
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// If requestQueue.addRequest() fails here then we must reclaim it back to
|
|
31
|
+
// the RequestList because probably it's not yet in the queue!
|
|
32
|
+
this.log.error('Adding of request from the RequestList to the RequestQueue failed, reclaiming request back to the list.', { request });
|
|
33
|
+
await this.requestList.reclaimRequest(request);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await this.requestList.markRequestHandled(request);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fetches the next request from the RequestQueue. If the queue is empty and the RequestList
|
|
40
|
+
* is not finished, it will transfer a batch of requests from the list to the queue first.
|
|
41
|
+
* @inheritdoc
|
|
42
|
+
*/
|
|
43
|
+
async fetchNextRequest() {
|
|
44
|
+
// First, try to transfer a request from the requestList
|
|
45
|
+
const [listEmpty, listFinished] = await Promise.all([
|
|
46
|
+
this.requestList.isEmpty(),
|
|
47
|
+
this.requestList.isFinished(),
|
|
48
|
+
]);
|
|
49
|
+
if (!listEmpty && !listFinished) {
|
|
50
|
+
await this.transferNextBatchToQueue();
|
|
51
|
+
}
|
|
52
|
+
// Try to fetch from queue after potential transfer
|
|
53
|
+
return this.requestQueue.fetchNextRequest();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @inheritdoc
|
|
57
|
+
*/
|
|
58
|
+
async isFinished() {
|
|
59
|
+
const storagesFinished = await Promise.all([this.requestList.isFinished(), this.requestQueue.isFinished()]);
|
|
60
|
+
return storagesFinished.every(Boolean);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @inheritdoc
|
|
64
|
+
*/
|
|
65
|
+
async isEmpty() {
|
|
66
|
+
const storagesEmpty = await Promise.all([this.requestList.isEmpty(), this.requestQueue.isEmpty()]);
|
|
67
|
+
return storagesEmpty.every(Boolean);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @inheritdoc
|
|
71
|
+
*/
|
|
72
|
+
async handledCount() {
|
|
73
|
+
// Since one of the stores needs to have priority when both are present, we query the request queue - the request list will first be dumped into the queue and then left empty.
|
|
74
|
+
return await this.requestQueue.handledCount();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @inheritdoc
|
|
78
|
+
*/
|
|
79
|
+
getTotalCount() {
|
|
80
|
+
return this.requestQueue.getTotalCount();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @inheritdoc
|
|
84
|
+
*/
|
|
85
|
+
getPendingCount() {
|
|
86
|
+
return this.requestQueue.getPendingCount() + this.requestList.length() - this.requestList.handledCount();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @inheritdoc
|
|
90
|
+
*/
|
|
91
|
+
async *[Symbol.asyncIterator]() {
|
|
92
|
+
while (true) {
|
|
93
|
+
const req = await this.fetchNextRequest();
|
|
94
|
+
if (!req)
|
|
95
|
+
break;
|
|
96
|
+
yield req;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @inheritdoc
|
|
101
|
+
*/
|
|
102
|
+
async markRequestHandled(request) {
|
|
103
|
+
return this.requestQueue.markRequestHandled(request);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @inheritdoc
|
|
107
|
+
*/
|
|
108
|
+
async reclaimRequest(request, options) {
|
|
109
|
+
return await this.requestQueue.reclaimRequest(request, options);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @inheritdoc
|
|
113
|
+
*/
|
|
114
|
+
async addRequest(requestLike, options) {
|
|
115
|
+
return await this.requestQueue.addRequest(requestLike, options);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @inheritdoc
|
|
119
|
+
*/
|
|
120
|
+
async addRequestsBatched(requests, options) {
|
|
121
|
+
return await this.requestQueue.addRequestsBatched(requests, options);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=request_manager_tandem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request_manager_tandem.js","sourceRoot":"","sources":["../../src/storages/request_manager_tandem.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAYhC;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IACrB,GAAG,CAAM;IACT,WAAW,CAAe;IAC1B,YAAY,CAAkB;IAEtC,YAAY,WAAyB,EAAE,YAA6B;QAChE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,wBAAwB;QAClC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;QAE1D,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,0EAA0E;YAC1E,8DAA8D;YAC9D,IAAI,CAAC,GAAG,CAAC,KAAK,CACV,yGAAyG,EACzG,EAAE,OAAO,EAAE,CACd,CAAC;YACF,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC/C,OAAO;QACX,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB;QAClB,wDAAwD;QACxD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAChD,IAAI,CAAC,WA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AC,aAAa,CAAC;QACzB,OAAO,IAAI,EAAE,CAAC;YACV,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1C,IAAI,CAAC,GAAG;gBAAE,MAAM;YAChB,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAgB;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAChB,OAAgB,EAChB,OAAsC;QAEtC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,OAAsC;QACxE,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACpB,QAAsB,EACtB,OAAmC;QAEnC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACJ"}
|
|
@@ -1,13 +1,66 @@
|
|
|
1
|
-
import type { BatchAddRequestsResult, Dictionary, ProcessedRequest, QueueOperationInfo, RequestQueueClient, RequestQueueInfo, StorageClient } from '@crawlee/types';
|
|
1
|
+
import type { BaseHttpClient, BatchAddRequestsResult, Dictionary, ProcessedRequest, QueueOperationInfo, RequestQueueClient, RequestQueueInfo, StorageClient } from '@crawlee/types';
|
|
2
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
2
3
|
import { ListDictionary, LruCache } from '@apify/datastructures';
|
|
3
4
|
import type { Log } from '@apify/log';
|
|
4
5
|
import { Configuration } from '../configuration.js';
|
|
6
|
+
import type { EventManager } from '../events/event_manager.js';
|
|
5
7
|
import type { ProxyConfiguration } from '../proxy_configuration.js';
|
|
6
8
|
import type { InternalSource, RequestOptions, Source } from '../request.js';
|
|
7
9
|
import { Request } from '../request.js';
|
|
8
10
|
import type { IStorage, StorageManagerOptions } from './storage_manager.js';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
+
export type RequestsLike = AsyncIterable<Source | string> | Iterable<Source | string> | (Source | string)[];
|
|
12
|
+
/**
|
|
13
|
+
* Represents a provider of requests/URLs to crawl.
|
|
14
|
+
*/
|
|
15
|
+
export interface IRequestManager {
|
|
16
|
+
/**
|
|
17
|
+
* Returns `true` if all requests were already handled and there are no more left.
|
|
18
|
+
*/
|
|
19
|
+
isFinished(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves to `true` if the next call to {@link IRequestManager.fetchNextRequest} function
|
|
22
|
+
* would return `null`, otherwise it resolves to `false`.
|
|
23
|
+
* Note that even if the provider is empty, there might be some pending requests currently being processed.
|
|
24
|
+
*/
|
|
25
|
+
isEmpty(): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns number of handled requests.
|
|
28
|
+
*/
|
|
29
|
+
handledCount(): Promise<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the total number of requests known to the request manager.
|
|
32
|
+
*/
|
|
33
|
+
getTotalCount(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Get an offline approximation of the number of pending requests.
|
|
36
|
+
*/
|
|
37
|
+
getPendingCount(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the next {@link Request} to process.
|
|
40
|
+
*
|
|
41
|
+
* The function's `Promise` resolves to `null` if there are no more
|
|
42
|
+
* requests to process.
|
|
43
|
+
*/
|
|
44
|
+
fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Can be used to iterate over the `RequestManager` instance in a `for await .. of` loop.
|
|
47
|
+
* Provides an alternative for the repeated use of `fetchNextRequest`.
|
|
48
|
+
*/
|
|
49
|
+
[Symbol.asyncIterator](): AsyncGenerator<Request>;
|
|
50
|
+
/**
|
|
51
|
+
* Marks request as handled after successful processing.
|
|
52
|
+
*/
|
|
53
|
+
markRequestHandled(request: Request): Promise<RequestQueueOperationInfo | void | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Reclaims request to the provider if its processing failed.
|
|
56
|
+
* The request will become available in the next `fetchNextRequest()`.
|
|
57
|
+
*/
|
|
58
|
+
reclaimRequest(request: Request, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo | null>;
|
|
59
|
+
addRequest(requestLike: Source, options?: RequestQueueOperationOptions): Promise<RequestQueueOperationInfo>;
|
|
60
|
+
addRequestsBatched(requests: RequestsLike, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
|
|
61
|
+
}
|
|
62
|
+
export declare abstract class RequestProvider implements IStorage, IRequestManager {
|
|
63
|
+
protected readonly config: Configuration;
|
|
11
64
|
id: string;
|
|
12
65
|
name?: string;
|
|
13
66
|
timeoutSecs: number;
|
|
@@ -20,6 +73,7 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
20
73
|
assumedTotalCount: number;
|
|
21
74
|
assumedHandledCount: number;
|
|
22
75
|
private initialCount;
|
|
76
|
+
private initialHandledCount;
|
|
23
77
|
protected queueHeadIds: ListDictionary<string>;
|
|
24
78
|
protected requestCache: LruCache<RequestLruItem>;
|
|
25
79
|
protected recentlyHandledRequestsCache: LruCache<boolean>;
|
|
@@ -27,13 +81,21 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
27
81
|
protected lastActivity: Date;
|
|
28
82
|
protected isFinishedCalledWhileHeadWasNotEmpty: number;
|
|
29
83
|
protected inProgressRequestBatchCount: number;
|
|
30
|
-
|
|
84
|
+
protected httpClient?: BaseHttpClient;
|
|
85
|
+
protected readonly events: EventManager;
|
|
86
|
+
constructor(options: InternalRequestProviderOptions, config: Configuration);
|
|
31
87
|
/**
|
|
32
88
|
* Returns an offline approximation of the total number of requests in the queue (i.e. pending + handled).
|
|
33
89
|
*
|
|
34
90
|
* Survives restarts and actor migrations.
|
|
35
91
|
*/
|
|
36
92
|
getTotalCount(): number;
|
|
93
|
+
/**
|
|
94
|
+
* Returns an offline approximation of the total number of pending requests in the queue.
|
|
95
|
+
*
|
|
96
|
+
* Survives restarts and Actor migrations.
|
|
97
|
+
*/
|
|
98
|
+
getPendingCount(): number;
|
|
37
99
|
/**
|
|
38
100
|
* Adds a request to the queue.
|
|
39
101
|
*
|
|
@@ -63,7 +125,7 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
63
125
|
* Note that the function sets the `uniqueKey` and `id` fields to the passed requests if missing.
|
|
64
126
|
* @param [options] Request queue operation options.
|
|
65
127
|
*/
|
|
66
|
-
addRequests(requestsLike:
|
|
128
|
+
addRequests(requestsLike: RequestsLike, options?: RequestQueueOperationOptions): Promise<BatchAddRequestsResult>;
|
|
67
129
|
/**
|
|
68
130
|
* Adds requests to the queue in batches. By default, it will resolve after the initial batch is added, and continue
|
|
69
131
|
* adding the rest in the background. You can configure the batch size via `batchSize` option and the sleep time in between
|
|
@@ -73,7 +135,7 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
73
135
|
* @param requests The requests to add
|
|
74
136
|
* @param options Options for the request queue
|
|
75
137
|
*/
|
|
76
|
-
addRequestsBatched(requests:
|
|
138
|
+
addRequestsBatched(requests: ReadonlyDeep<RequestsLike>, options?: AddRequestsBatchedOptions): Promise<AddRequestsBatchedResult>;
|
|
77
139
|
/**
|
|
78
140
|
* Gets the request from the queue specified by ID.
|
|
79
141
|
*
|
|
@@ -98,7 +160,7 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
98
160
|
* @returns
|
|
99
161
|
* Returns the request object or `null` if there are no more pending requests.
|
|
100
162
|
*/
|
|
101
|
-
abstract fetchNextRequest<T extends Dictionary = Dictionary>(
|
|
163
|
+
abstract fetchNextRequest<T extends Dictionary = Dictionary>(): Promise<Request<T> | null>;
|
|
102
164
|
/**
|
|
103
165
|
* Marks a request that was previously returned by the
|
|
104
166
|
* {@link RequestQueue.fetchNextRequest}
|
|
@@ -142,6 +204,10 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
142
204
|
* depending on the mode of operation.
|
|
143
205
|
*/
|
|
144
206
|
drop(): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* @inheritdoc
|
|
209
|
+
*/
|
|
210
|
+
[Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
|
|
145
211
|
/**
|
|
146
212
|
* Returns the number of handled requests.
|
|
147
213
|
*
|
|
@@ -150,6 +216,7 @@ export declare abstract class RequestProvider implements IStorage {
|
|
|
150
216
|
* ```javascript
|
|
151
217
|
* const { handledRequestCount } = await queue.getInfo();
|
|
152
218
|
* ```
|
|
219
|
+
* @inheritdoc
|
|
153
220
|
*/
|
|
154
221
|
handledCount(): Promise<number>;
|
|
155
222
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_provider.d.ts","sourceRoot":"","sources":["../../src/storages/request_provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAChB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"request_provider.d.ts","sourceRoot":"","sources":["../../src/storages/request_provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EAChB,MAAM,gBAAgB,CAAC;AAWxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,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