@crawlee/core 4.0.0-beta.4 → 4.0.0-beta.41
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 +9 -5
- package/autoscaling/autoscaled_pool.d.ts +3 -5
- package/autoscaling/autoscaled_pool.d.ts.map +1 -1
- package/autoscaling/autoscaled_pool.js +3 -9
- package/autoscaling/autoscaled_pool.js.map +1 -1
- package/autoscaling/snapshotter.d.ts +3 -13
- package/autoscaling/snapshotter.d.ts.map +1 -1
- package/autoscaling/snapshotter.js +18 -29
- 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 +5 -78
- package/configuration.d.ts.map +1 -1
- package/configuration.js +6 -102
- 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 +8 -8
- package/cookie_utils.js.map +1 -1
- package/crawlers/context_pipeline.d.ts +71 -0
- package/crawlers/context_pipeline.d.ts.map +1 -0
- package/crawlers/context_pipeline.js +123 -0
- package/crawlers/context_pipeline.js.map +1 -0
- package/crawlers/crawler_commons.d.ts +15 -23
- 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 +15 -15
- package/crawlers/statistics.d.ts.map +1 -1
- package/crawlers/statistics.js +21 -18
- 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 +41 -23
- 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 +35 -0
- package/errors.js.map +1 -1
- package/events/event_manager.d.ts +8 -5
- package/events/event_manager.d.ts.map +1 -1
- package/events/event_manager.js +7 -9
- 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 +33 -39
- 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 +82 -2
- package/log.d.ts.map +1 -1
- package/log.js +102 -0
- package/log.js.map +1 -1
- package/package.json +6 -7
- package/proxy_configuration.d.ts +17 -94
- package/proxy_configuration.d.ts.map +1 -1
- package/proxy_configuration.js +18 -54
- package/proxy_configuration.js.map +1 -1
- package/recoverable_state.d.ts +121 -0
- package/recoverable_state.d.ts.map +1 -0
- package/recoverable_state.js +137 -0
- package/recoverable_state.js.map +1 -0
- package/request.d.ts +48 -6
- package/request.d.ts.map +1 -1
- package/request.js +62 -16
- package/request.js.map +1 -1
- package/service_locator.d.ts +162 -0
- package/service_locator.d.ts.map +1 -0
- package/service_locator.js +247 -0
- package/service_locator.js.map +1 -0
- package/session_pool/session.d.ts +9 -31
- package/session_pool/session.d.ts.map +1 -1
- package/session_pool/session.js +17 -21
- package/session_pool/session.js.map +1 -1
- package/session_pool/session_pool.d.ts +27 -54
- package/session_pool/session_pool.d.ts.map +1 -1
- package/session_pool/session_pool.js +54 -69
- package/session_pool/session_pool.js.map +1 -1
- package/storages/dataset.d.ts +53 -3
- package/storages/dataset.d.ts.map +1 -1
- package/storages/dataset.js +78 -6
- 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 +71 -1
- package/storages/key_value_store.d.ts.map +1 -1
- package/storages/key_value_store.js +95 -12
- 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 +11 -8
- 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 +76 -9
- package/storages/request_provider.d.ts.map +1 -1
- package/storages/request_provider.js +92 -54
- package/storages/request_provider.js.map +1 -1
- package/storages/request_queue.d.ts +1 -3
- package/storages/request_queue.d.ts.map +1 -1
- package/storages/request_queue.js +2 -4
- 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 +10 -7
- 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
package/proxy_configuration.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ow from 'ow';
|
|
2
|
-
import
|
|
3
|
-
import { cryptoRandomObjectId } from '@apify/utilities';
|
|
2
|
+
import { serviceLocator } from './service_locator.js';
|
|
4
3
|
/**
|
|
5
4
|
* Internal class for tracking the proxy tier history for a specific domain.
|
|
6
5
|
*
|
|
@@ -85,7 +84,7 @@ export class ProxyConfiguration {
|
|
|
85
84
|
tieredProxyUrls;
|
|
86
85
|
usedProxyUrls = new Map();
|
|
87
86
|
newUrlFunction;
|
|
88
|
-
log =
|
|
87
|
+
log = serviceLocator.getLogger().child({ prefix: 'ProxyConfiguration' });
|
|
89
88
|
domainTiers = new Map();
|
|
90
89
|
/**
|
|
91
90
|
* Creates a {@link ProxyConfiguration} instance based on the provided options. Proxy servers are used to prevent target websites from
|
|
@@ -110,7 +109,7 @@ export class ProxyConfiguration {
|
|
|
110
109
|
constructor(options = {}) {
|
|
111
110
|
const { validateRequired, ...rest } = options;
|
|
112
111
|
ow(rest, ow.object.exactShape({
|
|
113
|
-
proxyUrls: ow.optional.array.nonEmpty.ofType(ow.string.url),
|
|
112
|
+
proxyUrls: ow.optional.array.nonEmpty.ofType(ow.any(ow.string.url, ow.null)),
|
|
114
113
|
newUrlFunction: ow.optional.function,
|
|
115
114
|
tieredProxyUrls: ow.optional.array.nonEmpty.ofType(ow.array.nonEmpty.ofType(ow.any(ow.string.url, ow.null))),
|
|
116
115
|
}));
|
|
@@ -129,35 +128,24 @@ export class ProxyConfiguration {
|
|
|
129
128
|
* the currently used proxy via the requestHandler parameter `proxyInfo`.
|
|
130
129
|
* Use it if you want to work with a rich representation of a proxy URL.
|
|
131
130
|
* If you need the URL string only, use {@link ProxyConfiguration.newUrl}.
|
|
132
|
-
* @param [sessionId]
|
|
133
|
-
* Represents the identifier of user {@link Session} that can be managed by the {@link SessionPool} or
|
|
134
|
-
* you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.
|
|
135
|
-
* When the provided sessionId is a number, it's converted to a string. Property sessionId of
|
|
136
|
-
* {@link ProxyInfo} is always returned as a type string.
|
|
137
131
|
*
|
|
138
|
-
* All the HTTP requests going through the proxy with the same session identifier
|
|
139
|
-
* will use the same target proxy server (i.e. the same IP address).
|
|
140
|
-
* The identifier must not be longer than 50 characters and include only the following: `0-9`, `a-z`, `A-Z`, `"."`, `"_"` and `"~"`.
|
|
141
132
|
* @return Represents information about used proxy and its configuration.
|
|
142
133
|
*/
|
|
143
|
-
async newProxyInfo(
|
|
144
|
-
if (typeof sessionId === 'number')
|
|
145
|
-
sessionId = `${sessionId}`;
|
|
134
|
+
async newProxyInfo(options) {
|
|
146
135
|
let url;
|
|
147
136
|
let tier;
|
|
148
137
|
if (this.tieredProxyUrls) {
|
|
149
|
-
const { proxyUrl, proxyTier } = this._handleTieredUrl(
|
|
138
|
+
const { proxyUrl, proxyTier } = this._handleTieredUrl(options);
|
|
150
139
|
url = proxyUrl ?? undefined;
|
|
151
140
|
tier = proxyTier;
|
|
152
141
|
}
|
|
153
142
|
else {
|
|
154
|
-
url = await this.newUrl(
|
|
143
|
+
url = await this.newUrl(options);
|
|
155
144
|
}
|
|
156
145
|
if (!url)
|
|
157
146
|
return undefined;
|
|
158
147
|
const { username, password, port, hostname } = new URL(url);
|
|
159
148
|
return {
|
|
160
|
-
sessionId,
|
|
161
149
|
url,
|
|
162
150
|
username: decodeURIComponent(username),
|
|
163
151
|
password: decodeURIComponent(password),
|
|
@@ -167,12 +155,11 @@ export class ProxyConfiguration {
|
|
|
167
155
|
};
|
|
168
156
|
}
|
|
169
157
|
/**
|
|
170
|
-
* Given a
|
|
171
|
-
* @param _sessionId Session identifier
|
|
158
|
+
* Given a request / proxy tier, this function returns a new proxy URL based on the provided configuration options.
|
|
172
159
|
* @param options Options for the tiered proxy rotation
|
|
173
160
|
* @returns An object with the proxy URL and the proxy tier used.
|
|
174
161
|
*/
|
|
175
|
-
_handleTieredUrl(
|
|
162
|
+
_handleTieredUrl(options) {
|
|
176
163
|
if (!this.tieredProxyUrls)
|
|
177
164
|
throw new Error('Tiered proxy URLs are not set');
|
|
178
165
|
if (!options || (!options?.request && options?.proxyTier === undefined)) {
|
|
@@ -211,58 +198,35 @@ export class ProxyConfiguration {
|
|
|
211
198
|
const tierPrediction = tracker.predictTier();
|
|
212
199
|
if (typeof request.userData.__crawlee.lastProxyTier === 'number' &&
|
|
213
200
|
request.userData.__crawlee.lastProxyTier !== tierPrediction) {
|
|
214
|
-
log.debug(`Changing proxy tier for domain "${domain}" from ${request.userData.__crawlee.lastProxyTier} to ${tierPrediction}.`);
|
|
201
|
+
this.log.debug(`Changing proxy tier for domain "${domain}" from ${request.userData.__crawlee.lastProxyTier} to ${tierPrediction}.`);
|
|
215
202
|
}
|
|
216
203
|
request.userData.__crawlee.lastProxyTier = tierPrediction;
|
|
217
204
|
request.userData.__crawlee.forefront = true;
|
|
218
205
|
return tierPrediction;
|
|
219
206
|
}
|
|
220
207
|
/**
|
|
221
|
-
* Returns a new proxy URL based on provided configuration options
|
|
222
|
-
* @param [sessionId]
|
|
223
|
-
* Represents the identifier of user {@link Session} that can be managed by the {@link SessionPool} or
|
|
224
|
-
* you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.
|
|
225
|
-
* When the provided sessionId is a number, it's converted to a string.
|
|
208
|
+
* Returns a new proxy URL based on provided configuration options.
|
|
226
209
|
*
|
|
227
|
-
* All the HTTP requests going through the proxy with the same session identifier
|
|
228
|
-
* will use the same target proxy server (i.e. the same IP address).
|
|
229
|
-
* The identifier must not be longer than 50 characters and include only the following: `0-9`, `a-z`, `A-Z`, `"."`, `"_"` and `"~"`.
|
|
230
210
|
* @return A string with a proxy URL, including authentication credentials and port number.
|
|
231
211
|
* For example, `http://bob:password123@proxy.example.com:8000`
|
|
232
212
|
*/
|
|
233
|
-
async newUrl(
|
|
234
|
-
if (typeof sessionId === 'number')
|
|
235
|
-
sessionId = `${sessionId}`;
|
|
213
|
+
async newUrl(options) {
|
|
236
214
|
if (this.newUrlFunction) {
|
|
237
|
-
return (await this._callNewUrlFunction(
|
|
215
|
+
return (await this._callNewUrlFunction({ request: options?.request })) ?? undefined;
|
|
238
216
|
}
|
|
239
217
|
if (this.tieredProxyUrls) {
|
|
240
|
-
return this._handleTieredUrl(
|
|
218
|
+
return this._handleTieredUrl(options).proxyUrl ?? undefined;
|
|
241
219
|
}
|
|
242
|
-
return this.
|
|
220
|
+
return this._handleProxyUrlsList() ?? undefined;
|
|
243
221
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
*/
|
|
247
|
-
_handleCustomUrl(sessionId) {
|
|
248
|
-
let customUrlToUse;
|
|
249
|
-
if (!sessionId) {
|
|
250
|
-
return this.proxyUrls[this.nextCustomUrlIndex++ % this.proxyUrls.length];
|
|
251
|
-
}
|
|
252
|
-
if (this.usedProxyUrls.has(sessionId)) {
|
|
253
|
-
customUrlToUse = this.usedProxyUrls.get(sessionId);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
customUrlToUse = this.proxyUrls[this.nextCustomUrlIndex++ % this.proxyUrls.length];
|
|
257
|
-
this.usedProxyUrls.set(sessionId, customUrlToUse);
|
|
258
|
-
}
|
|
259
|
-
return customUrlToUse;
|
|
222
|
+
_handleProxyUrlsList() {
|
|
223
|
+
return this.proxyUrls[this.nextCustomUrlIndex++ % this.proxyUrls.length];
|
|
260
224
|
}
|
|
261
225
|
/**
|
|
262
226
|
* Calls the custom newUrlFunction and checks format of its return value
|
|
263
227
|
*/
|
|
264
|
-
async _callNewUrlFunction(
|
|
265
|
-
const proxyUrl = await this.newUrlFunction(
|
|
228
|
+
async _callNewUrlFunction(options) {
|
|
229
|
+
const proxyUrl = await this.newUrlFunction(options);
|
|
266
230
|
try {
|
|
267
231
|
if (proxyUrl) {
|
|
268
232
|
new URL(proxyUrl); // eslint-disable-line no-new
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy_configuration.js","sourceRoot":"","sources":["../src/proxy_configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy_configuration.js","sourceRoot":"","sources":["../src/proxy_configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgDtD;;;;GAIG;AACH,MAAM,gBAAgB;IACV,SAAS,CAAW;IACpB,WAAW,CAAS;IAE5B,YAAY,eAAoC;QAC5C,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAI,CAA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B;QAC1B,OAAO,IAAI,CAAC,SAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,SAAU,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,mBAAmB,CAAC,OAA+B;QAC/D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC;YACD,IAAI,QAAQ,EAAE,CAAC;gBACX,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,6BAA6B;YACpD,CAAC;YACD,OAAO,QAAQ,CAAC;QACpB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACX,mEAAoE,GAAa,CAAC,OAAO,EAAE,CAC9F,CAAC;QACN,CAAC;IACL,CAAC;IAES,gCAAgC;QACtC,MAAM,IAAI,KAAK,CACX,6GAA6G,CAChH,CAAC;IACN,CAAC;IAES,uBAAuB;QAC7B,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IACpG,CAAC;CACJ"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Configuration, CrawleeLogger } from '@crawlee/core';
|
|
2
|
+
export interface RecoverableStatePersistenceOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The key under which the state is stored in the KeyValueStore
|
|
5
|
+
*/
|
|
6
|
+
persistStateKey: string;
|
|
7
|
+
/**
|
|
8
|
+
* Flag to enable or disable state persistence
|
|
9
|
+
*/
|
|
10
|
+
persistenceEnabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The name of the KeyValueStore to use for persistence.
|
|
13
|
+
* If neither a name nor an id are supplied, the default store will be used.
|
|
14
|
+
*/
|
|
15
|
+
persistStateKvsName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The identifier of the KeyValueStore to use for persistence.
|
|
18
|
+
* If neither a name nor an id are supplied, the default store will be used.
|
|
19
|
+
*/
|
|
20
|
+
persistStateKvsId?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for configuring the RecoverableState
|
|
24
|
+
*/
|
|
25
|
+
export interface RecoverableStateOptions<TStateModel = Record<string, unknown>> extends RecoverableStatePersistenceOptions {
|
|
26
|
+
/**
|
|
27
|
+
* The default state used if no persisted state is found.
|
|
28
|
+
* A deep copy is made each time the state is used.
|
|
29
|
+
*/
|
|
30
|
+
defaultState: TStateModel;
|
|
31
|
+
/**
|
|
32
|
+
* A logger instance for logging operations related to state persistence
|
|
33
|
+
*/
|
|
34
|
+
logger?: CrawleeLogger;
|
|
35
|
+
/**
|
|
36
|
+
* Configuration instance to use
|
|
37
|
+
*/
|
|
38
|
+
config?: Configuration;
|
|
39
|
+
/**
|
|
40
|
+
* Optional function to transform the state to a JSON string before persistence.
|
|
41
|
+
* If not provided, JSON.stringify will be used.
|
|
42
|
+
*/
|
|
43
|
+
serialize?: (state: TStateModel) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional function to transform a JSON-serialized object back to the state model.
|
|
46
|
+
* If not provided, JSON.parse is used.
|
|
47
|
+
* It is advisable to perform validation in this function and to throw an exception if it fails.
|
|
48
|
+
*/
|
|
49
|
+
deserialize?: (serializedState: string) => TStateModel;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A class for managing persistent recoverable state using a plain JavaScript object.
|
|
53
|
+
*
|
|
54
|
+
* This class facilitates state persistence to a `KeyValueStore`, allowing data to be saved and retrieved
|
|
55
|
+
* across migrations or restarts. It manages the loading, saving, and resetting of state data,
|
|
56
|
+
* with optional persistence capabilities.
|
|
57
|
+
*
|
|
58
|
+
* The state is represented by a plain JavaScript object that can be serialized to and deserialized from JSON.
|
|
59
|
+
* The class automatically hooks into the event system to persist state when needed.
|
|
60
|
+
*/
|
|
61
|
+
export declare class RecoverableState<TStateModel = Record<string, unknown>> {
|
|
62
|
+
private readonly defaultState;
|
|
63
|
+
private state;
|
|
64
|
+
private readonly persistenceEnabled;
|
|
65
|
+
private readonly persistStateKey;
|
|
66
|
+
private readonly persistStateKvsName?;
|
|
67
|
+
private readonly persistStateKvsId?;
|
|
68
|
+
private keyValueStore;
|
|
69
|
+
private readonly log;
|
|
70
|
+
private readonly serialize;
|
|
71
|
+
private readonly deserialize;
|
|
72
|
+
/**
|
|
73
|
+
* Initialize a new recoverable state object.
|
|
74
|
+
*
|
|
75
|
+
* @param options Configuration options for the recoverable state
|
|
76
|
+
*/
|
|
77
|
+
constructor(options: RecoverableStateOptions<TStateModel>);
|
|
78
|
+
/**
|
|
79
|
+
* Initialize the recoverable state.
|
|
80
|
+
*
|
|
81
|
+
* This method must be called before using the recoverable state. It loads the saved state
|
|
82
|
+
* if persistence is enabled and registers the object to listen for PERSIST_STATE events.
|
|
83
|
+
*
|
|
84
|
+
* @returns The loaded state object
|
|
85
|
+
*/
|
|
86
|
+
initialize(): Promise<TStateModel>;
|
|
87
|
+
/**
|
|
88
|
+
* Clean up resources used by the recoverable state.
|
|
89
|
+
*
|
|
90
|
+
* If persistence is enabled, this method deregisters the object from PERSIST_STATE events
|
|
91
|
+
* and persists the current state one last time.
|
|
92
|
+
*/
|
|
93
|
+
teardown(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Get the current state.
|
|
96
|
+
*/
|
|
97
|
+
get currentValue(): TStateModel;
|
|
98
|
+
/**
|
|
99
|
+
* Reset the state to the default values and clear any persisted state.
|
|
100
|
+
*
|
|
101
|
+
* Resets the current state to the default state and, if persistence is enabled,
|
|
102
|
+
* clears the persisted state from the KeyValueStore.
|
|
103
|
+
*/
|
|
104
|
+
reset(): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Persist the current state to the KeyValueStore.
|
|
107
|
+
*
|
|
108
|
+
* This method is typically called in response to a PERSIST_STATE event, but can also be called
|
|
109
|
+
* directly when needed.
|
|
110
|
+
*
|
|
111
|
+
* @param eventData Optional data associated with a PERSIST_STATE event
|
|
112
|
+
*/
|
|
113
|
+
persistState(eventData?: {
|
|
114
|
+
isMigrating: boolean;
|
|
115
|
+
}): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Load the saved state from the KeyValueStore
|
|
118
|
+
*/
|
|
119
|
+
private loadSavedState;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=recoverable_state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoverable_state.d.ts","sourceRoot":"","sources":["../src/recoverable_state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGlE,MAAM,WAAW,kCAAkC;IAC/C;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC1E,SAAQ,kCAAkC;IAC1C;;;OAGG;IACH,YAAY,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,MAAM,CAAC;IAE3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,WAAW,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,qBAAa,gBAAgB,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAU;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAS;IAC5C,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IAEvE;;;;OAIG;gBACS,OAAO,EAAE,uBAAuB,CAAC,WAAW,CAAC;IAazD;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IAuBxC;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B;;OAEG;IACH,IAAI,YAAY,IAAI,WAAW,CAM9B;IAED;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B;;;;;;;OAOG;IACG,YAAY,CAAC,SAAS,CAAC,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvE;;OAEG;YACW,cAAc;CAY/B"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { KeyValueStore, serviceLocator } from '@crawlee/core';
|
|
2
|
+
/**
|
|
3
|
+
* A class for managing persistent recoverable state using a plain JavaScript object.
|
|
4
|
+
*
|
|
5
|
+
* This class facilitates state persistence to a `KeyValueStore`, allowing data to be saved and retrieved
|
|
6
|
+
* across migrations or restarts. It manages the loading, saving, and resetting of state data,
|
|
7
|
+
* with optional persistence capabilities.
|
|
8
|
+
*
|
|
9
|
+
* The state is represented by a plain JavaScript object that can be serialized to and deserialized from JSON.
|
|
10
|
+
* The class automatically hooks into the event system to persist state when needed.
|
|
11
|
+
*/
|
|
12
|
+
export class RecoverableState {
|
|
13
|
+
defaultState;
|
|
14
|
+
state = null;
|
|
15
|
+
persistenceEnabled;
|
|
16
|
+
persistStateKey;
|
|
17
|
+
persistStateKvsName;
|
|
18
|
+
persistStateKvsId;
|
|
19
|
+
keyValueStore = null;
|
|
20
|
+
log;
|
|
21
|
+
serialize;
|
|
22
|
+
deserialize;
|
|
23
|
+
/**
|
|
24
|
+
* Initialize a new recoverable state object.
|
|
25
|
+
*
|
|
26
|
+
* @param options Configuration options for the recoverable state
|
|
27
|
+
*/
|
|
28
|
+
constructor(options) {
|
|
29
|
+
this.defaultState = options.defaultState;
|
|
30
|
+
this.persistStateKey = options.persistStateKey;
|
|
31
|
+
this.persistenceEnabled = options.persistenceEnabled ?? false;
|
|
32
|
+
this.persistStateKvsName = options.persistStateKvsName;
|
|
33
|
+
this.persistStateKvsId = options.persistStateKvsId;
|
|
34
|
+
this.log = options.logger ?? serviceLocator.getLogger().child({ prefix: 'RecoverableState' });
|
|
35
|
+
this.serialize = options.serialize ?? JSON.stringify;
|
|
36
|
+
this.deserialize = options.deserialize ?? JSON.parse;
|
|
37
|
+
this.persistState = this.persistState.bind(this);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the recoverable state.
|
|
41
|
+
*
|
|
42
|
+
* This method must be called before using the recoverable state. It loads the saved state
|
|
43
|
+
* if persistence is enabled and registers the object to listen for PERSIST_STATE events.
|
|
44
|
+
*
|
|
45
|
+
* @returns The loaded state object
|
|
46
|
+
*/
|
|
47
|
+
async initialize() {
|
|
48
|
+
if (this.state !== null && this.state !== undefined) {
|
|
49
|
+
return this.currentValue;
|
|
50
|
+
}
|
|
51
|
+
if (!this.persistenceEnabled) {
|
|
52
|
+
this.state = this.deserialize(this.serialize(this.defaultState));
|
|
53
|
+
return this.currentValue;
|
|
54
|
+
}
|
|
55
|
+
this.keyValueStore = await KeyValueStore.open(this.persistStateKvsName ?? this.persistStateKvsId, {
|
|
56
|
+
config: serviceLocator.getConfiguration(),
|
|
57
|
+
});
|
|
58
|
+
await this.loadSavedState();
|
|
59
|
+
// Register for persist state events
|
|
60
|
+
const eventManager = serviceLocator.getEventManager();
|
|
61
|
+
eventManager.on("persistState" /* EventType.PERSIST_STATE */, this.persistState);
|
|
62
|
+
return this.currentValue;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Clean up resources used by the recoverable state.
|
|
66
|
+
*
|
|
67
|
+
* If persistence is enabled, this method deregisters the object from PERSIST_STATE events
|
|
68
|
+
* and persists the current state one last time.
|
|
69
|
+
*/
|
|
70
|
+
async teardown() {
|
|
71
|
+
if (!this.persistenceEnabled || !this.persistState) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const eventManager = serviceLocator.getEventManager();
|
|
75
|
+
eventManager.off("persistState" /* EventType.PERSIST_STATE */, this.persistState);
|
|
76
|
+
await this.persistState();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get the current state.
|
|
80
|
+
*/
|
|
81
|
+
get currentValue() {
|
|
82
|
+
if (this.state === null) {
|
|
83
|
+
throw new Error('Recoverable state has not yet been loaded');
|
|
84
|
+
}
|
|
85
|
+
return this.state;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Reset the state to the default values and clear any persisted state.
|
|
89
|
+
*
|
|
90
|
+
* Resets the current state to the default state and, if persistence is enabled,
|
|
91
|
+
* clears the persisted state from the KeyValueStore.
|
|
92
|
+
*/
|
|
93
|
+
async reset() {
|
|
94
|
+
this.state = this.deserialize(this.serialize(this.defaultState));
|
|
95
|
+
if (this.persistenceEnabled) {
|
|
96
|
+
if (this.keyValueStore === null) {
|
|
97
|
+
throw new Error('Recoverable state has not yet been initialized');
|
|
98
|
+
}
|
|
99
|
+
await this.keyValueStore.setValue(this.persistStateKey, null);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Persist the current state to the KeyValueStore.
|
|
104
|
+
*
|
|
105
|
+
* This method is typically called in response to a PERSIST_STATE event, but can also be called
|
|
106
|
+
* directly when needed.
|
|
107
|
+
*
|
|
108
|
+
* @param eventData Optional data associated with a PERSIST_STATE event
|
|
109
|
+
*/
|
|
110
|
+
async persistState(eventData) {
|
|
111
|
+
this.log.debug(`Persisting state of the RecoverableState (eventData=${JSON.stringify(eventData)}).`);
|
|
112
|
+
if (this.keyValueStore === null || this.state === null) {
|
|
113
|
+
throw new Error('Recoverable state has not yet been initialized');
|
|
114
|
+
}
|
|
115
|
+
if (this.persistenceEnabled) {
|
|
116
|
+
await this.keyValueStore.setValue(this.persistStateKey, this.serialize(this.state), {
|
|
117
|
+
contentType: 'text/plain', // HACK - the result is expected to be JSON, but we do this to avoid the implicit JSON.parse in `KeyValueStore.getValue`
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Load the saved state from the KeyValueStore
|
|
123
|
+
*/
|
|
124
|
+
async loadSavedState() {
|
|
125
|
+
if (this.keyValueStore === null) {
|
|
126
|
+
throw new Error('Recoverable state has not yet been initialized');
|
|
127
|
+
}
|
|
128
|
+
const storedState = await this.keyValueStore.getValue(this.persistStateKey);
|
|
129
|
+
if (storedState === null || storedState === undefined) {
|
|
130
|
+
this.state = this.deserialize(this.serialize(this.defaultState));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.state = this.deserialize(storedState);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=recoverable_state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoverable_state.js","sourceRoot":"","sources":["../src/recoverable_state.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA6DzE;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAgB;IACR,YAAY,CAAc;IACnC,KAAK,GAAuB,IAAI,CAAC;IACxB,kBAAkB,CAAU;IAC5B,eAAe,CAAS;IACxB,mBAAmB,C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ACJ"}
|
package/request.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BinaryLike } from 'node:crypto';
|
|
2
2
|
import type { Dictionary } from '@crawlee/types';
|
|
3
3
|
import type { EnqueueLinksOptions } from './enqueue_links/enqueue_links.js';
|
|
4
|
+
import type { SkippedRequestReason } from './enqueue_links/shared.js';
|
|
4
5
|
import type { AllowedHttpMethods } from './typedefs.js';
|
|
5
6
|
export declare enum RequestState {
|
|
6
7
|
UNPROCESSED = 0,
|
|
@@ -43,7 +44,7 @@ export declare enum RequestState {
|
|
|
43
44
|
* ```
|
|
44
45
|
* @category Sources
|
|
45
46
|
*/
|
|
46
|
-
|
|
47
|
+
declare class CrawleeRequest<UserData extends Dictionary = Dictionary> {
|
|
47
48
|
/** Request ID */
|
|
48
49
|
id?: string;
|
|
49
50
|
/** URL of the web page to crawl. */
|
|
@@ -76,7 +77,12 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
76
77
|
headers?: Record<string, string>;
|
|
77
78
|
/** Private store for the custom user data assigned to the request. */
|
|
78
79
|
private _userData;
|
|
79
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Custom user data assigned to the request.
|
|
82
|
+
*
|
|
83
|
+
* All data stored in `userData` must be JSON-serializable.
|
|
84
|
+
* Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
|
|
85
|
+
*/
|
|
80
86
|
userData: UserData;
|
|
81
87
|
/**
|
|
82
88
|
* ISO datetime string that indicates the time when the request has been processed.
|
|
@@ -87,10 +93,25 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
87
93
|
* `Request` parameters including the URL, HTTP method and headers, and others.
|
|
88
94
|
*/
|
|
89
95
|
constructor(options: RequestOptions<UserData>);
|
|
96
|
+
/**
|
|
97
|
+
* Converts the Crawlee Request object to a `fetch` API Request object.
|
|
98
|
+
* @returns The native `fetch` API Request object.
|
|
99
|
+
*/
|
|
100
|
+
intoFetchAPIRequest(): Request;
|
|
90
101
|
/** Tells the crawler processing this request to skip the navigation and process the request directly. */
|
|
91
102
|
get skipNavigation(): boolean;
|
|
92
103
|
/** Tells the crawler processing this request to skip the navigation and process the request directly. */
|
|
93
104
|
set skipNavigation(value: boolean);
|
|
105
|
+
/**
|
|
106
|
+
* Depth of the request in the current crawl tree.
|
|
107
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
108
|
+
*/
|
|
109
|
+
get crawlDepth(): number;
|
|
110
|
+
/**
|
|
111
|
+
* Depth of the request in the current crawl tree.
|
|
112
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
113
|
+
*/
|
|
114
|
+
set crawlDepth(value: number);
|
|
94
115
|
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
|
|
95
116
|
get sessionRotationCount(): number;
|
|
96
117
|
/** Indicates the number of times the crawling of the request has rotated the session due to a session or a proxy error. */
|
|
@@ -107,6 +128,14 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
107
128
|
get state(): RequestState;
|
|
108
129
|
/** Describes the request's current lifecycle state. */
|
|
109
130
|
set state(value: RequestState);
|
|
131
|
+
/**
|
|
132
|
+
* Reason for skipping this request.
|
|
133
|
+
*/
|
|
134
|
+
get skippedReason(): SkippedRequestReason | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Reason for skipping this request.
|
|
137
|
+
*/
|
|
138
|
+
set skippedReason(value: SkippedRequestReason | undefined);
|
|
110
139
|
private get enqueueStrategy();
|
|
111
140
|
private set enqueueStrategy(value);
|
|
112
141
|
/**
|
|
@@ -123,8 +152,6 @@ export declare class Request<UserData extends Dictionary = Dictionary> {
|
|
|
123
152
|
* @param [options]
|
|
124
153
|
*/
|
|
125
154
|
pushErrorMessage(errorOrMessage: unknown, options?: PushErrorMessageOptions): void;
|
|
126
|
-
protected _computeUniqueKey(options: ComputeUniqueKeyOptions): string;
|
|
127
|
-
protected _hashPayload(payload: BinaryLike): string;
|
|
128
155
|
/** @internal */
|
|
129
156
|
static computeUniqueKey({ url, method, payload, keepUrlFragment, useExtendedUniqueKey, }: ComputeUniqueKeyOptions): string;
|
|
130
157
|
/** @internal */
|
|
@@ -171,6 +198,9 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
|
|
|
171
198
|
/**
|
|
172
199
|
* Custom user data assigned to the request. Use this to save any request related data to the
|
|
173
200
|
* request's scope, keeping them accessible on retries, failures etc.
|
|
201
|
+
*
|
|
202
|
+
* All data stored in `userData` must be JSON-serializable.
|
|
203
|
+
* Storing non-serializable values (e.g. functions, symbols) may result in unexpected results.
|
|
174
204
|
*/
|
|
175
205
|
userData?: UserData;
|
|
176
206
|
/**
|
|
@@ -203,6 +233,18 @@ export interface RequestOptions<UserData extends Dictionary = Dictionary> {
|
|
|
203
233
|
* @default false
|
|
204
234
|
*/
|
|
205
235
|
skipNavigation?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Depth of the request in the current crawl tree.
|
|
238
|
+
* Note that this is dependent on the crawler setup and might produce unexpected results when used with multiple crawlers.
|
|
239
|
+
* @default 0
|
|
240
|
+
*/
|
|
241
|
+
crawlDepth?: number;
|
|
242
|
+
/**
|
|
243
|
+
* Reason for skipping this request.
|
|
244
|
+
* This is used to provide more information about why the request was skipped.
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
skippedReason?: SkippedRequestReason;
|
|
206
248
|
/**
|
|
207
249
|
* Maximum number of retries for this request. Allows to override the global `maxRequestRetries` option of `BasicCrawler`.
|
|
208
250
|
*/
|
|
@@ -233,11 +275,11 @@ interface ComputeUniqueKeyOptions {
|
|
|
233
275
|
export type Source = (Partial<RequestOptions> & {
|
|
234
276
|
requestsFromUrl?: string;
|
|
235
277
|
regex?: RegExp;
|
|
236
|
-
}) |
|
|
278
|
+
}) | CrawleeRequest;
|
|
237
279
|
/** @internal */
|
|
238
280
|
export interface InternalSource {
|
|
239
281
|
requestsFromUrl: string;
|
|
240
282
|
regex?: RegExp;
|
|
241
283
|
}
|
|
242
|
-
export {};
|
|
284
|
+
export { CrawleeRequest as Request };
|
|
243
285
|
//# sourceMappingURL=request.d.ts.map
|
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;
|
|
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;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,yCAAyC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