@crawlee/core 4.0.0-rc.0 → 4.0.0-rc.1

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 (122) hide show
  1. package/README.md +1 -1
  2. package/configuration.d.ts +15 -46
  3. package/configuration.js +8 -20
  4. package/errors.d.ts +12 -53
  5. package/errors.js +13 -66
  6. package/events/index.d.ts +1 -0
  7. package/events/local_event_manager.d.ts +0 -7
  8. package/events/local_event_manager.js +8 -8
  9. package/events/system_info.d.ts +38 -0
  10. package/index.d.ts +2 -8
  11. package/index.js +4 -8
  12. package/internal.d.ts +8 -0
  13. package/internal.js +9 -0
  14. package/log.d.ts +10 -11
  15. package/log.js +53 -25
  16. package/memory-storage/memory-storage.d.ts +12 -7
  17. package/memory-storage/memory-storage.js +45 -17
  18. package/memory-storage/resource-clients/dataset.d.ts +0 -5
  19. package/memory-storage/resource-clients/dataset.js +17 -20
  20. package/memory-storage/resource-clients/key-value-store.d.ts +0 -9
  21. package/memory-storage/resource-clients/key-value-store.js +11 -33
  22. package/memory-storage/resource-clients/request-queue.d.ts +0 -22
  23. package/memory-storage/resource-clients/request-queue.js +57 -53
  24. package/package.json +16 -18
  25. package/proxy_configuration.d.ts +20 -23
  26. package/proxy_configuration.js +18 -12
  27. package/recoverable_state.d.ts +28 -6
  28. package/recoverable_state.js +51 -14
  29. package/request.d.ts +18 -104
  30. package/request.js +41 -220
  31. package/serialization.js +3 -3
  32. package/service_locator.d.ts +3 -0
  33. package/service_locator.js +2 -0
  34. package/storages/dataset.d.ts +9 -15
  35. package/storages/dataset.js +22 -14
  36. package/storages/index.d.ts +3 -4
  37. package/storages/index.js +1 -4
  38. package/storages/key_value_store.d.ts +12 -46
  39. package/storages/key_value_store.js +31 -47
  40. package/storages/key_value_store_codec.js +6 -11
  41. package/storages/request_dedup_cache.d.ts +0 -2
  42. package/storages/request_dedup_cache.js +8 -8
  43. package/storages/request_list.d.ts +6 -82
  44. package/storages/request_list.js +175 -179
  45. package/storages/request_loader.d.ts +48 -22
  46. package/storages/request_loader.js +36 -1
  47. package/storages/request_manager.d.ts +86 -0
  48. package/storages/request_manager_tandem.d.ts +13 -28
  49. package/storages/request_manager_tandem.js +46 -43
  50. package/storages/request_queue.d.ts +19 -49
  51. package/storages/request_queue.js +92 -88
  52. package/storages/storage_instance_manager.d.ts +1 -2
  53. package/storages/storage_instance_manager.js +4 -4
  54. package/storages/transaction.d.ts +27 -9
  55. package/storages/transaction.js +56 -11
  56. package/storages/utils.d.ts +2 -2
  57. package/validators.d.ts +3 -2
  58. package/validators.js +3 -2
  59. package/autoscaling/autoscaled_pool.d.ts +0 -195
  60. package/autoscaling/autoscaled_pool.js +0 -386
  61. package/autoscaling/concurrency_system.d.ts +0 -268
  62. package/autoscaling/concurrency_system.js +0 -362
  63. package/autoscaling/cpu_load_signal.d.ts +0 -43
  64. package/autoscaling/cpu_load_signal.js +0 -47
  65. package/autoscaling/event_loop_load_signal.d.ts +0 -51
  66. package/autoscaling/event_loop_load_signal.js +0 -60
  67. package/autoscaling/index.d.ts +0 -9
  68. package/autoscaling/index.js +0 -9
  69. package/autoscaling/load_signal.d.ts +0 -100
  70. package/autoscaling/load_signal.js +0 -105
  71. package/autoscaling/memory_load_signal.d.ts +0 -47
  72. package/autoscaling/memory_load_signal.js +0 -106
  73. package/autoscaling/snapshotter.d.ts +0 -84
  74. package/autoscaling/snapshotter.js +0 -67
  75. package/autoscaling/storage_backend_load_signal.d.ts +0 -56
  76. package/autoscaling/storage_backend_load_signal.js +0 -73
  77. package/autoscaling/system_status.d.ts +0 -159
  78. package/autoscaling/system_status.js +0 -139
  79. package/autoscaling/weighted_avg.d.ts +0 -5
  80. package/autoscaling/weighted_avg.js +0 -14
  81. package/cookie_utils.d.ts +0 -44
  82. package/cookie_utils.js +0 -122
  83. package/crawlers/context_pipeline.d.ts +0 -70
  84. package/crawlers/context_pipeline.js +0 -122
  85. package/crawlers/crawler_commons.d.ts +0 -159
  86. package/crawlers/error_snapshotter.d.ts +0 -57
  87. package/crawlers/error_snapshotter.js +0 -117
  88. package/crawlers/error_tracker.d.ts +0 -54
  89. package/crawlers/error_tracker.js +0 -308
  90. package/crawlers/index.d.ts +0 -5
  91. package/crawlers/index.js +0 -4
  92. package/crawlers/internals/types.d.ts +0 -7
  93. package/crawlers/internals/types.js +0 -1
  94. package/crawlers/statistics.d.ts +0 -328
  95. package/crawlers/statistics.js +0 -536
  96. package/enqueue_links/enqueue_links.d.ts +0 -156
  97. package/enqueue_links/enqueue_links.js +0 -78
  98. package/enqueue_links/index.d.ts +0 -2
  99. package/enqueue_links/index.js +0 -2
  100. package/enqueue_links/shared.d.ts +0 -93
  101. package/enqueue_links/shared.js +0 -239
  102. package/http.d.ts +0 -9
  103. package/http.js +0 -28
  104. package/router.d.ts +0 -306
  105. package/router.js +0 -309
  106. package/session_pool/consts.d.ts +0 -3
  107. package/session_pool/consts.js +0 -3
  108. package/session_pool/errors.d.ts +0 -7
  109. package/session_pool/errors.js +0 -11
  110. package/session_pool/fingerprint.d.ts +0 -9
  111. package/session_pool/fingerprint.js +0 -30
  112. package/session_pool/index.d.ts +0 -4
  113. package/session_pool/index.js +0 -4
  114. package/session_pool/session.d.ts +0 -150
  115. package/session_pool/session.js +0 -220
  116. package/session_pool/session_pool.d.ts +0 -240
  117. package/session_pool/session_pool.js +0 -394
  118. package/storages/sitemap_request_loader.d.ts +0 -201
  119. package/storages/sitemap_request_loader.js +0 -438
  120. package/storages/throttling_request_manager.d.ts +0 -239
  121. package/storages/throttling_request_manager.js +0 -646
  122. /package/{crawlers/crawler_commons.js → events/system_info.js} +0 -0
@@ -1,159 +0,0 @@
1
- import type { Dictionary, HttpRequestOptions, ISession, ProxyInfo, SendRequestOptions } from '@crawlee/types';
2
- import type { ReadonlyDeep } from 'type-fest';
3
- import type { EnqueueUrlsOptions } from '../enqueue_links/enqueue_links.js';
4
- import type { CrawleeLogger } from '../log.js';
5
- import type { Request, RequestOptions, Source } from '../request.js';
6
- import type { StorageIdentifier } from '../storages/storage_instance_manager.js';
7
- import type { Dataset } from '../storages/dataset.js';
8
- import type { KeyValueStore } from '../storages/key_value_store.js';
9
- import type { AddRequestsBatchedResult } from '../storages/request_queue.js';
10
- /** @internal */
11
- export type IsAny<T> = 0 extends 1 & T ? true : false;
12
- /**
13
- * A request input (URL string, request-options object, or {@link Request}) whose `userData` is typed
14
- * according to its `label`, based on a router's route map.
15
- *
16
- * When the route map is open (the default `Record<string, ...>`), this is just the regular loose
17
- * {@link Source} input. When the map declares concrete labels, providing a `label` requires the matching
18
- * `userData` shape and rejects labels not present in the map; unlabeled requests keep loose `userData`.
19
- */
20
- export type LabeledSource<Routes extends Record<keyof Routes, Dictionary>> = string extends keyof Routes ? string | Source : string | Request | ({
21
- requestsFromUrl?: string;
22
- regex?: RegExp;
23
- } & ({
24
- [Label in keyof Routes & string]: Omit<Partial<RequestOptions<Routes[Label]>>, 'label'> & {
25
- label: Label;
26
- };
27
- }[keyof Routes & string] | (Omit<Partial<RequestOptions>, 'label'> & {
28
- label?: undefined;
29
- })));
30
- /**
31
- * The iterable/array of {@link LabeledSource} inputs accepted by the label-aware `addRequests`/`run`
32
- * methods of a crawler bound to a typed router.
33
- * @internal
34
- */
35
- export type TypedRequestsLike<Routes extends Record<keyof Routes, Dictionary>> = AsyncIterable<LabeledSource<Routes>> | Iterable<LabeledSource<Routes>> | LabeledSource<Routes>[];
36
- /**
37
- * The label-aware `addRequests` method signature exposed on a request handler's context when the crawler is
38
- * bound to a typed router. Mirrors {@link RestrictedCrawlingContext.addRequests} with typed sources.
39
- */
40
- export type TypedContextAddRequests<Routes extends Record<keyof Routes, Dictionary>> = (requestsLike: ReadonlyDeep<LabeledSource<Routes>[]>, options?: ReadonlyDeep<EnqueueUrlsOptions>) => Promise<AddRequestsBatchedResult>;
41
- /**
42
- * An `enqueueLinks`-options object with its `label`/`userData` retyped according to a router's route map: a
43
- * declared `label` requires the matching `userData` shape (unknown labels are rejected), while unlabeled
44
- * calls keep loose `userData`. Returns the options unchanged when the route map is open (the default).
45
- */
46
- type TypedEnqueueLinksOptions<Options, Routes extends Record<keyof Routes, Dictionary>> = string extends keyof Routes ? Options : Omit<Options, 'label' | 'userData'> & ({
47
- [Label in keyof Routes & string]: {
48
- label: Label;
49
- userData?: Routes[Label];
50
- };
51
- }[keyof Routes & string] | {
52
- label?: undefined;
53
- userData?: Dictionary;
54
- });
55
- /**
56
- * Transforms a context's existing `enqueueLinks` method so that the `label`/`userData` in its options follow
57
- * the router's route map, while preserving everything else about the signature (argument optionality and
58
- * return type, which differ between crawler types).
59
- */
60
- export type TypedContextEnqueueLinks<EnqueueLinks, Routes extends Record<keyof Routes, Dictionary>> = EnqueueLinks extends (options?: infer Options) => infer Result ? (options?: TypedEnqueueLinksOptions<Options, Routes>) => Result : EnqueueLinks extends (options: infer Options) => infer Result ? (options: TypedEnqueueLinksOptions<Options, Routes>) => Result : EnqueueLinks;
61
- export type WithRequired<T, K extends keyof T> = T & {
62
- [P in K]-?: T[P];
63
- };
64
- export type LoadedRequest<R extends Request> = WithRequired<R, 'id' | 'loadedUrl'>;
65
- /** @internal */
66
- export type LoadedContext<Context extends RestrictedCrawlingContext> = IsAny<Context> extends true ? Context : {
67
- request: LoadedRequest<Context['request']>;
68
- } & Omit<Context, 'request'>;
69
- export interface RestrictedCrawlingContext<UserData extends Dictionary = Dictionary> {
70
- id: string;
71
- session: ISession;
72
- /**
73
- * An object with information about currently used proxy by the crawler
74
- * and configured by the {@link ProxyConfiguration} class.
75
- */
76
- proxyInfo?: ProxyInfo;
77
- /**
78
- * The original {@link Request} object.
79
- */
80
- request: Request<UserData>;
81
- /**
82
- * This function allows you to push data to a {@link Dataset} specified by name, or the one currently used by the crawler.
83
- *
84
- * Shortcut for `crawler.pushData()`.
85
- *
86
- * @param [data] Data to be pushed to the default dataset.
87
- */
88
- pushData(data: ReadonlyDeep<Parameters<Dataset['pushData']>[0]>, datasetIdentifier?: string | StorageIdentifier): Promise<void>;
89
- /**
90
- * Add requests directly to the request queue currently used by the crawler.
91
- *
92
- * Optionally, the function allows you to filter the target URLs using an array of glob or regexp patterns,
93
- * the same way {@link CrawlingContext.enqueueLinks|`enqueueLinks`} does for extracted links.
94
- *
95
- * @param requests The requests to add
96
- * @param options Options for the request queue
97
- */
98
- addRequests: (requestsLike: ReadonlyDeep<(string | Source)[]>, options?: ReadonlyDeep<EnqueueUrlsOptions>) => Promise<AddRequestsBatchedResult>;
99
- /**
100
- * Returns the state - a piece of mutable persistent data shared across all the request handler runs.
101
- */
102
- useState: <State extends Dictionary = Dictionary>(defaultValue?: State) => Promise<State>;
103
- /**
104
- * Get a key-value store with given name or id, or the default one for the crawler.
105
- */
106
- getKeyValueStore: (identifier?: string | StorageIdentifier) => Promise<Pick<KeyValueStore, 'id' | 'name' | 'getValue' | 'getAutoSavedValue' | 'setValue' | 'getPublicUrl'>>;
107
- /**
108
- * A preconfigured logger for the request handler.
109
- */
110
- log: CrawleeLogger;
111
- }
112
- export interface CrawlingContext<UserData extends Dictionary = Dictionary> extends RestrictedCrawlingContext<UserData> {
113
- /**
114
- * Fires HTTP request via the internal HTTP client, allowing to override the request options on the fly.
115
- *
116
- * This is handy when you work with a browser crawler but want to execute some requests outside it (e.g. API requests).
117
- * Check the [Skipping navigations for certain requests](https://crawlee.dev/js/docs/examples/skip-navigation) example for
118
- * more detailed explanation of how to do that.
119
- *
120
- * ```ts
121
- * async requestHandler({ sendRequest }) {
122
- * const { body } = await sendRequest({
123
- * // override headers only
124
- * headers: { ... },
125
- * });
126
- * },
127
- * ```
128
- */
129
- sendRequest: (requestOverrides?: Partial<HttpRequestOptions>, optionsOverrides?: SendRequestOptions) => Promise<Response>;
130
- /**
131
- * Register a function to be called at the very end of the request handling process. This is useful for resources that should be accessible to error handlers, for instance.
132
- *
133
- * The callback runs *outside* the request's storage transaction, so storage writes made here are
134
- * applied immediately and are **not** rolled back when the request fails. In
135
- * {@link AdaptivePlaywrightCrawler} it also runs once per request handler attempt, so a write
136
- * here can land more than once for a single request. Push results from the request handler itself.
137
- */
138
- registerDeferredCleanup(cleanup: () => Promise<unknown>): void;
139
- /**
140
- * Gives the current request `secs` more seconds to finish, for when how long it needs is only apparent
141
- * once it is already running - a listing page that turns out to have far more to scroll through than
142
- * usual, say. Prefer `requestHandlerTimeoutSecs`, or a per-route override via
143
- * {@link Router.addHandler|`router.addHandler`}, whenever the time needed is known up front.
144
- *
145
- * ```ts
146
- * router.addHandler('LIST', async ({ extendTimeout, page }) => {
147
- * const pageCount = await countPages(page);
148
- * extendTimeout(pageCount * 10);
149
- * await scrapeAllPages(page);
150
- * });
151
- * ```
152
- *
153
- * Extends the request handler's own timeout and the crawler's internal one together, so the extension
154
- * is not immediately undone by the latter. Calling it from a handler that has already timed out does
155
- * nothing.
156
- */
157
- extendTimeout(secs: number): void;
158
- }
159
- export {};
@@ -1,57 +0,0 @@
1
- import type { CrawlingContext } from '../crawlers/crawler_commons.js';
2
- import type { KeyValueStore } from '../storages/key_value_store.js';
3
- import type { ErrnoException } from './error_tracker.js';
4
- import type { SnapshottableProperties } from './internals/types.js';
5
- interface BrowserCrawlingContext {
6
- saveSnapshot: (options: {
7
- key: string;
8
- }) => Promise<void>;
9
- }
10
- export interface SnapshotResult {
11
- screenshotFileName?: string;
12
- htmlFileName?: string;
13
- }
14
- interface ErrorSnapshot {
15
- screenshotFileName?: string;
16
- screenshotFileUrl?: string;
17
- htmlFileName?: string;
18
- htmlFileUrl?: string;
19
- }
20
- /**
21
- * ErrorSnapshotter class is used to capture a screenshot of the page and a snapshot of the HTML when an error occurs during web crawling.
22
- *
23
- * This functionality is opt-in, and can be enabled via the crawler options:
24
- *
25
- * ```ts
26
- * const crawler = new BasicCrawler({
27
- * // ...
28
- * statistics: new Statistics({ saveErrorSnapshots: true }),
29
- * });
30
- * ```
31
- */
32
- export declare class ErrorSnapshotter {
33
- static readonly MAX_ERROR_CHARACTERS = 30;
34
- static readonly MAX_HASH_LENGTH = 30;
35
- static readonly MAX_FILENAME_LENGTH = 250;
36
- static readonly BASE_MESSAGE = "An error occurred";
37
- static readonly SNAPSHOT_PREFIX = "ERROR_SNAPSHOT";
38
- /**
39
- * Capture a snapshot of the error context.
40
- */
41
- captureSnapshot(error: ErrnoException, context: CrawlingContext & SnapshottableProperties): Promise<ErrorSnapshot>;
42
- /**
43
- * Captures a snapshot of the current page using the context.saveSnapshot function.
44
- * This function is applicable for browser contexts only.
45
- * Returns an object containing the filenames of the screenshot and HTML file.
46
- */
47
- contextCaptureSnapshot(context: BrowserCrawlingContext, fileName: string): Promise<SnapshotResult | undefined>;
48
- /**
49
- * Save the HTML snapshot of the page, and return the key it was stored under.
50
- */
51
- saveHTMLSnapshot(html: string, keyValueStore: Pick<KeyValueStore, 'setValue'>, fileName: string): Promise<string | undefined>;
52
- /**
53
- * Generate a unique fileName for each error snapshot.
54
- */
55
- generateFilename(error: ErrnoException): string;
56
- }
57
- export {};
@@ -1,117 +0,0 @@
1
- import crypto from 'node:crypto';
2
- /**
3
- * ErrorSnapshotter class is used to capture a screenshot of the page and a snapshot of the HTML when an error occurs during web crawling.
4
- *
5
- * This functionality is opt-in, and can be enabled via the crawler options:
6
- *
7
- * ```ts
8
- * const crawler = new BasicCrawler({
9
- * // ...
10
- * statistics: new Statistics({ saveErrorSnapshots: true }),
11
- * });
12
- * ```
13
- */
14
- export class ErrorSnapshotter {
15
- static MAX_ERROR_CHARACTERS = 30;
16
- static MAX_HASH_LENGTH = 30;
17
- static MAX_FILENAME_LENGTH = 250;
18
- static BASE_MESSAGE = 'An error occurred';
19
- static SNAPSHOT_PREFIX = 'ERROR_SNAPSHOT';
20
- /**
21
- * Capture a snapshot of the error context.
22
- */
23
- async captureSnapshot(error, context) {
24
- try {
25
- const page = context?.page;
26
- const body = context?.body;
27
- const keyValueStore = await context?.getKeyValueStore();
28
- // If the key-value store is not available, or the body and page are not available, return empty filenames
29
- if (!keyValueStore || (!body && !page)) {
30
- return {};
31
- }
32
- const fileName = this.generateFilename(error);
33
- let screenshotFileName;
34
- let htmlFileName;
35
- if (page) {
36
- const capturedFiles = await this.contextCaptureSnapshot(context, fileName);
37
- if (capturedFiles) {
38
- screenshotFileName = capturedFiles.screenshotFileName;
39
- htmlFileName = capturedFiles.htmlFileName;
40
- }
41
- // If the snapshot for browsers failed to capture the HTML, try to capture it from the page content
42
- if (!htmlFileName) {
43
- const html = await page.content();
44
- htmlFileName = html ? await this.saveHTMLSnapshot(html, keyValueStore, fileName) : undefined;
45
- }
46
- }
47
- else if (typeof body === 'string') {
48
- // for non-browser contexts
49
- htmlFileName = await this.saveHTMLSnapshot(body, keyValueStore, fileName);
50
- }
51
- return {
52
- screenshotFileName,
53
- screenshotFileUrl: screenshotFileName && (await keyValueStore.getPublicUrl(screenshotFileName)),
54
- htmlFileName,
55
- htmlFileUrl: htmlFileName && (await keyValueStore.getPublicUrl(htmlFileName)),
56
- };
57
- }
58
- catch {
59
- return {};
60
- }
61
- }
62
- /**
63
- * Captures a snapshot of the current page using the context.saveSnapshot function.
64
- * This function is applicable for browser contexts only.
65
- * Returns an object containing the filenames of the screenshot and HTML file.
66
- */
67
- async contextCaptureSnapshot(context, fileName) {
68
- try {
69
- await context.saveSnapshot({ key: fileName });
70
- return {
71
- screenshotFileName: `${fileName}.jpg`,
72
- htmlFileName: `${fileName}.html`,
73
- };
74
- }
75
- catch {
76
- return undefined;
77
- }
78
- }
79
- /**
80
- * Save the HTML snapshot of the page, and return the key it was stored under.
81
- */
82
- async saveHTMLSnapshot(html, keyValueStore, fileName) {
83
- try {
84
- await keyValueStore.setValue(fileName, html, { contentType: 'text/html' });
85
- // The record key is `fileName` - returning it with an `.html` suffix (as v3 did,
86
- // where local storage put the extension in the key) would break `getPublicUrl`.
87
- return fileName;
88
- }
89
- catch {
90
- return undefined;
91
- }
92
- }
93
- /**
94
- * Generate a unique fileName for each error snapshot.
95
- */
96
- generateFilename(error) {
97
- const { SNAPSHOT_PREFIX, BASE_MESSAGE, MAX_HASH_LENGTH, MAX_ERROR_CHARACTERS, MAX_FILENAME_LENGTH } = ErrorSnapshotter;
98
- // Create a hash of the error stack trace
99
- const errorStackHash = crypto
100
- .createHash('sha1')
101
- .update(error.stack || error.message || '')
102
- .digest('hex')
103
- .slice(0, MAX_HASH_LENGTH);
104
- const errorMessagePrefix = (error.message || BASE_MESSAGE).slice(0, MAX_ERROR_CHARACTERS).trim();
105
- /**
106
- * Remove non-word characters from the start and end of a string.
107
- */
108
- const sanitizeString = (str) => {
109
- return str.replace(/^\W+|\W+$/g, '');
110
- };
111
- // Generate fileName and remove disallowed characters
112
- const fileName = `${SNAPSHOT_PREFIX}_${sanitizeString(errorStackHash)}_${sanitizeString(errorMessagePrefix)}`
113
- .replace(/\W+/g, '-') // Replace non-word characters with a dash
114
- .slice(0, MAX_FILENAME_LENGTH);
115
- return fileName;
116
- }
117
- }
@@ -1,54 +0,0 @@
1
- import type { CrawlingContext } from '../crawlers/crawler_commons.js';
2
- import { ErrorSnapshotter } from './error_snapshotter.js';
3
- import type { SnapshottableProperties } from './internals/types.js';
4
- /**
5
- * Node.js Error interface
6
- */
7
- export interface ErrnoException extends Error {
8
- errno?: number;
9
- code?: string | number;
10
- path?: string;
11
- syscall?: string;
12
- cause?: any;
13
- }
14
- export interface ErrorTrackerOptions {
15
- showErrorCode: boolean;
16
- showErrorName: boolean;
17
- showStackTrace: boolean;
18
- showFullStack: boolean;
19
- showErrorMessage: boolean;
20
- showFullMessage: boolean;
21
- saveErrorSnapshots: boolean;
22
- }
23
- /**
24
- * This class tracks errors and computes a summary of information like:
25
- * - where the errors happened
26
- * - what the error names are
27
- * - what the error codes are
28
- * - what is the general error message
29
- *
30
- * This is extremely useful when there are dynamic error messages, such as argument validation.
31
- *
32
- * Since the structure of the `tracker.result` object differs when using different options,
33
- * it's typed as `Record<string, unknown>`. The most deep object has a `count` property, which is a number.
34
- *
35
- * It's possible to get the total amount of errors via the `tracker.total` property.
36
- */
37
- export declare class ErrorTracker {
38
- #private;
39
- result: Record<string, unknown>;
40
- total: number;
41
- errorSnapshotter?: ErrorSnapshotter;
42
- constructor(options?: Partial<ErrorTrackerOptions>);
43
- private updateGroup;
44
- add(error: ErrnoException): void;
45
- /**
46
- * This method is async, because it captures a snapshot of the error context.
47
- * We added this new method to avoid breaking changes.
48
- */
49
- addAsync(error: ErrnoException, context?: CrawlingContext): Promise<void>;
50
- getUniqueErrorCount(): number;
51
- getMostPopularErrors(count: number): [number, string[]][];
52
- captureSnapshot(storage: Record<string, unknown>, error: ErrnoException, context: CrawlingContext & SnapshottableProperties): Promise<void>;
53
- reset(): void;
54
- }