apify 4.0.0-beta.15 → 4.0.0-beta.151

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 (49) hide show
  1. package/README.md +28 -2
  2. package/dist/actor.d.ts +416 -281
  3. package/dist/actor.js +743 -417
  4. package/dist/apify_dataset_backend.d.ts +22 -0
  5. package/dist/apify_dataset_backend.js +77 -0
  6. package/dist/apify_file_system_storage_backend.d.ts +34 -0
  7. package/dist/apify_file_system_storage_backend.js +41 -0
  8. package/dist/apify_key_value_store_backend.d.ts +26 -0
  9. package/dist/apify_key_value_store_backend.js +57 -0
  10. package/dist/apify_request_queue_backend.d.ts +88 -0
  11. package/dist/apify_request_queue_backend.js +123 -0
  12. package/dist/apify_request_queue_shared_backend.d.ts +31 -0
  13. package/dist/apify_request_queue_shared_backend.js +201 -0
  14. package/dist/apify_request_queue_single_backend.d.ts +43 -0
  15. package/dist/apify_request_queue_single_backend.js +265 -0
  16. package/dist/apify_storage_backend.d.ts +95 -0
  17. package/dist/apify_storage_backend.js +219 -0
  18. package/dist/charging.d.ts +77 -47
  19. package/dist/charging.js +348 -226
  20. package/dist/charging_storage_backend.d.ts +53 -0
  21. package/dist/charging_storage_backend.js +109 -0
  22. package/dist/child_run_tracker.d.ts +110 -0
  23. package/dist/child_run_tracker.js +333 -0
  24. package/dist/configuration.d.ts +48 -28
  25. package/dist/configuration.js +66 -12
  26. package/dist/enqueue_links_filters.d.ts +29 -0
  27. package/dist/enqueue_links_filters.js +52 -0
  28. package/dist/errors.d.ts +31 -0
  29. package/dist/errors.js +22 -0
  30. package/dist/google_sheets.d.ts +12 -0
  31. package/dist/google_sheets.js +26 -0
  32. package/dist/index.d.ts +13 -4
  33. package/dist/index.js +8 -3
  34. package/dist/input-schemas.d.ts +1 -1
  35. package/dist/platform_event_manager.d.ts +24 -9
  36. package/dist/platform_event_manager.js +213 -43
  37. package/dist/proxy_configuration.d.ts +32 -21
  38. package/dist/proxy_configuration.js +137 -79
  39. package/dist/smart_apify_storage_backend.d.ts +52 -0
  40. package/dist/smart_apify_storage_backend.js +73 -0
  41. package/dist/storage.d.ts +6 -26
  42. package/dist/storage.js +1 -79
  43. package/dist/utils.d.ts +28 -3
  44. package/dist/utils.js +59 -17
  45. package/package.json +38 -44
  46. package/dist/apify_storage_client.d.ts +0 -54
  47. package/dist/apify_storage_client.js +0 -152
  48. package/dist/key_value_store.d.ts +0 -21
  49. package/dist/key_value_store.js +0 -41
@@ -2,55 +2,65 @@ import type { ConfigField, FieldsInput, FieldsOutput } from '@crawlee/core';
2
2
  import { Configuration as CoreConfiguration } from '@crawlee/core';
3
3
  import { z } from 'zod';
4
4
  export declare const apifyConfigFields: {
5
+ maxUsedCpuRatio: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
6
+ internalTimeoutMillis: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber, unknown>>>;
7
+ systemInfoIntervalMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
8
+ logLevel: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodEnum<typeof import("@crawlee/core").LogLevel>, unknown>>>;
9
+ persistStorage: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
10
+ storageDir: ConfigField<z.ZodDefault<z.ZodString>>;
11
+ containerized: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
12
+ memoryMbytes: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber, unknown>>>;
13
+ availableMemoryRatio: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
14
+ disableBrowserSandbox: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
15
+ persistStateIntervalMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
16
+ headless: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
17
+ xvfb: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
18
+ chromeExecutablePath: ConfigField<z.ZodOptional<z.ZodString>>;
19
+ defaultBrowserPath: ConfigField<z.ZodOptional<z.ZodString>>;
20
+ purgeOnStart: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
5
21
  defaultDatasetId: ConfigField<z.ZodDefault<z.ZodString>>;
6
22
  defaultKeyValueStoreId: ConfigField<z.ZodDefault<z.ZodString>>;
7
23
  defaultRequestQueueId: ConfigField<z.ZodDefault<z.ZodString>>;
8
24
  inputKey: ConfigField<z.ZodDefault<z.ZodString>>;
9
- memoryMbytes: ConfigField<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
10
- availableMemoryRatio: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
11
- disableBrowserSandbox: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
12
- persistStateIntervalMillis: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
13
- headless: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
14
- xvfb: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
15
- chromeExecutablePath: ConfigField<z.ZodOptional<z.ZodString>>;
16
- defaultBrowserPath: ConfigField<z.ZodOptional<z.ZodString>>;
17
- purgeOnStart: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
18
- metamorphAfterSleepMillis: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
25
+ metamorphAfterSleepMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
19
26
  actorEventsWsUrl: ConfigField<z.ZodOptional<z.ZodString>>;
20
27
  token: ConfigField<z.ZodOptional<z.ZodString>>;
21
28
  actorId: ConfigField<z.ZodOptional<z.ZodString>>;
22
29
  actorRunId: ConfigField<z.ZodOptional<z.ZodString>>;
23
30
  actorTaskId: ConfigField<z.ZodOptional<z.ZodString>>;
31
+ actorBuildId: ConfigField<z.ZodOptional<z.ZodString>>;
32
+ actorBuildNumber: ConfigField<z.ZodOptional<z.ZodString>>;
33
+ actorBuildTags: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodString>, unknown>>>;
34
+ actorFullName: ConfigField<z.ZodOptional<z.ZodString>>;
35
+ workflowKey: ConfigField<z.ZodOptional<z.ZodString>>;
36
+ startedAt: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodDate, unknown>>>;
37
+ timeoutAt: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodDate, unknown>>>;
38
+ maxPaidDatasetItems: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber, unknown>>>;
39
+ dedicatedCpus: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber, unknown>>>;
24
40
  apiBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
25
41
  apiPublicBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
26
- containerPort: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
42
+ containerPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
27
43
  containerUrl: ConfigField<z.ZodDefault<z.ZodString>>;
28
44
  proxyHostname: ConfigField<z.ZodDefault<z.ZodString>>;
29
45
  proxyPassword: ConfigField<z.ZodOptional<z.ZodString>>;
30
- proxyPort: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
46
+ proxyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
31
47
  proxyStatusUrl: ConfigField<z.ZodDefault<z.ZodString>>;
32
48
  /** @deprecated use `containerPort` instead */
33
- standbyPort: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
49
+ standbyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
34
50
  standbyUrl: ConfigField<z.ZodOptional<z.ZodString>>;
35
- isAtHome: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
51
+ isAtHome: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
36
52
  userId: ConfigField<z.ZodOptional<z.ZodString>>;
37
- userIsPaying: ConfigField<z.ZodOptional<z.ZodString>>;
53
+ userIsPaying: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
38
54
  actorPermissionLevel: ConfigField<z.ZodOptional<z.ZodString>>;
39
55
  inputSecretsPrivateKeyPassphrase: ConfigField<z.ZodOptional<z.ZodString>>;
40
56
  inputSecretsPrivateKeyFile: ConfigField<z.ZodOptional<z.ZodString>>;
41
- maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodTransform<number, number>>>>;
57
+ maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodPreprocess<z.ZodNumber, unknown>, z.ZodTransform<number, number>>>>;
42
58
  metaOrigin: ConfigField<z.ZodOptional<z.ZodString>>;
43
- testPayPerEvent: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
44
- useChargingLogDataset: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
59
+ testPayPerEvent: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
45
60
  actorPricingInfo: ConfigField<z.ZodOptional<z.ZodString>>;
46
61
  chargedEventCounts: ConfigField<z.ZodOptional<z.ZodString>>;
47
62
  actorStoragesJson: ConfigField<z.ZodOptional<z.ZodString>>;
48
63
  storageClientOptions: ConfigField<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
49
- maxUsedCpuRatio: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
50
- systemInfoIntervalMillis: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>>>;
51
- logLevel: ConfigField<z.ZodOptional<z.ZodPipe<z.ZodTransform<{} | null | undefined, unknown>, z.ZodEnum<typeof import("@apify/log").LogLevel>>>>;
52
- persistStorage: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
53
- containerized: ConfigField<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
54
64
  };
55
65
  export type ApifyConfigurationInput = FieldsInput<typeof apifyConfigFields>;
56
66
  export type ApifyResolvedConfigValues = FieldsOutput<typeof apifyConfigFields>;
@@ -61,13 +71,13 @@ export interface Configuration extends ApifyResolvedConfigValues {
61
71
  /**
62
72
  * `Configuration` is a value object holding the SDK configuration. We can use it in two ways:
63
73
  *
64
- * 1. When using `Actor` class, we can get the instance configuration via `sdk.config`
74
+ * 1. When using `Actor` class, we can get the instance configuration via `sdk.configuration`
65
75
  *
66
76
  * ```javascript
67
77
  * import { Actor } from 'apify';
68
78
  *
69
79
  * const sdk = new Actor({ token: '123' });
70
- * console.log(sdk.config.token); // '123'
80
+ * console.log(sdk.configuration.token); // '123'
71
81
  * ```
72
82
  *
73
83
  * 2. To get the global configuration (singleton instance). It will respect the environment variables.
@@ -75,7 +85,7 @@ export interface Configuration extends ApifyResolvedConfigValues {
75
85
  * ```javascript
76
86
  * import { Configuration } from 'apify';
77
87
  *
78
- * const config = Configuration.getGlobalConfig();
88
+ * const config = Configuration.getGlobalConfiguration();
79
89
  * console.log(config.headless);
80
90
  * console.log(config.persistStateIntervalMillis);
81
91
  * ```
@@ -108,7 +118,16 @@ export interface Configuration extends ApifyResolvedConfigValues {
108
118
  * `actorId` | `ACTOR_ID` | -
109
119
  * `actorRunId` | `ACTOR_RUN_ID` | -
110
120
  * `actorTaskId` | `ACTOR_TASK_ID` | -
111
- * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com'`
121
+ * `actorBuildId` | `ACTOR_BUILD_ID` | -
122
+ * `actorBuildNumber` | `ACTOR_BUILD_NUMBER` | -
123
+ * `actorBuildTags` | `ACTOR_BUILD_TAGS` | -
124
+ * `actorFullName` | `ACTOR_FULL_NAME` | -
125
+ * `workflowKey` | `APIFY_WORKFLOW_KEY` | -
126
+ * `startedAt` | `ACTOR_STARTED_AT` | -
127
+ * `timeoutAt` | `ACTOR_TIMEOUT_AT` | -
128
+ * `maxPaidDatasetItems` | `ACTOR_MAX_PAID_DATASET_ITEMS` | -
129
+ * `dedicatedCpus` | `APIFY_DEDICATED_CPUS` | -
130
+ * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
112
131
  * `containerPort` | `ACTOR_WEB_SERVER_PORT` | `4321`
113
132
  * `containerUrl` | `ACTOR_WEB_SERVER_URL` | `'http://localhost:4321'`
114
133
  * `inputKey` | `ACTOR_INPUT_KEY` | `'INPUT'`
@@ -119,6 +138,7 @@ export interface Configuration extends ApifyResolvedConfigValues {
119
138
  * `proxyPort` | `APIFY_PROXY_PORT` | `8000`
120
139
  * `proxyStatusUrl` | `APIFY_PROXY_STATUS_URL` | `'http://proxy.apify.com'`
121
140
  * `userId` | `APIFY_USER_ID` | -
141
+ * `userIsPaying` | `APIFY_USER_IS_PAYING` | `false`
122
142
  * `xvfb` | `APIFY_XVFB` | -
123
143
  * `standbyPort` | `ACTOR_STANDBY_PORT` | `4321`
124
144
  * `standbyUrl` | `ACTOR_STANDBY_URL` | -
@@ -139,5 +159,5 @@ export declare class Configuration extends CoreConfiguration {
139
159
  * what crawlee internals resolve against; this singleton is only the
140
160
  * fallback for code reaching for a configuration without an explicit one.
141
161
  */
142
- static getGlobalConfig(): Configuration;
162
+ static getGlobalConfiguration(): Configuration;
143
163
  }
@@ -8,6 +8,22 @@ import { ACTOR_ENV_VARS, APIFY_ENV_VARS, LOCAL_ACTOR_ENV_VARS, LOCAL_APIFY_ENV_V
8
8
  // Reads the env var, not the resolved `isAtHome` field, so an explicit
9
9
  // `new Configuration({ isAtHome: true })` won't flip these — env is the source.
10
10
  const isAtHome = () => !!process.env[APIFY_ENV_VARS.IS_AT_HOME];
11
+ // Zod preprocessors for the Apify-specific field types; crawlee's
12
+ // `coerceBoolean` / `coerceNumber` cover the rest.
13
+ const coerceDate = z.preprocess((val) => {
14
+ if (typeof val === 'string')
15
+ return new Date(Date.parse(val));
16
+ return val;
17
+ }, z.date());
18
+ const coerceStringList = z.preprocess((val) => {
19
+ if (typeof val === 'string') {
20
+ return val
21
+ .split(',')
22
+ .map((item) => item.trim())
23
+ .filter(Boolean);
24
+ }
25
+ return val;
26
+ }, z.array(z.string()));
11
27
  function withApifyEnv(base, apifyEnvVars, schema) {
12
28
  const crawleeVars = base.envVar == null ? [] : [base.envVar].flat();
13
29
  return field((schema ?? base.schema), [...[apifyEnvVars].flat(), ...crawleeVars]);
@@ -20,10 +36,6 @@ export const apifyConfigFields = {
20
36
  // take precedence; crawlee's own CRAWLEE_* var is reused as the fallback,
21
37
  // never re-typed). A schema is passed only where the SDK needs a different
22
38
  // default than crawlee's.
23
- defaultDatasetId: withApifyEnv(crawleeConfigFields.defaultDatasetId, [ACTOR_ENV_VARS.DEFAULT_DATASET_ID, APIFY_ENV_VARS.DEFAULT_DATASET_ID], z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_DATASET_ID])),
24
- defaultKeyValueStoreId: withApifyEnv(crawleeConfigFields.defaultKeyValueStoreId, [ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID, APIFY_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID], z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID])),
25
- defaultRequestQueueId: withApifyEnv(crawleeConfigFields.defaultRequestQueueId, [ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID, APIFY_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID], z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID])),
26
- inputKey: withApifyEnv(crawleeConfigFields.inputKey, [ACTOR_ENV_VARS.INPUT_KEY, APIFY_ENV_VARS.INPUT_KEY]),
27
39
  memoryMbytes: withApifyEnv(crawleeConfigFields.memoryMbytes, [
28
40
  ACTOR_ENV_VARS.MEMORY_MBYTES,
29
41
  APIFY_ENV_VARS.MEMORY_MBYTES,
@@ -39,7 +51,28 @@ export const apifyConfigFields = {
39
51
  chromeExecutablePath: withApifyEnv(crawleeConfigFields.chromeExecutablePath, APIFY_ENV_VARS.CHROME_EXECUTABLE_PATH),
40
52
  defaultBrowserPath: withApifyEnv(crawleeConfigFields.defaultBrowserPath, 'APIFY_DEFAULT_BROWSER_PATH'),
41
53
  purgeOnStart: withApifyEnv(crawleeConfigFields.purgeOnStart, APIFY_ENV_VARS.PURGE_ON_START),
54
+ // Crawlee addresses the default storage by a reserved alias; on the platform
55
+ // each run gets real storage IDs, which the API calls need.
56
+ defaultDatasetId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_DATASET_ID]), [
57
+ ACTOR_ENV_VARS.DEFAULT_DATASET_ID,
58
+ APIFY_ENV_VARS.DEFAULT_DATASET_ID,
59
+ ]),
60
+ defaultKeyValueStoreId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID]), [
61
+ ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID,
62
+ APIFY_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID,
63
+ ]),
64
+ defaultRequestQueueId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID]), [
65
+ ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID,
66
+ APIFY_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID,
67
+ ]),
42
68
  // Apify-specific fields
69
+ // Crawlee has no notion of a run input; `CRAWLEE_INPUT_KEY` stays as the
70
+ // lowest-priority alias because the Apify CLI sets all three variables.
71
+ inputKey: field(z.string().default('INPUT'), [
72
+ ACTOR_ENV_VARS.INPUT_KEY,
73
+ APIFY_ENV_VARS.INPUT_KEY,
74
+ 'CRAWLEE_INPUT_KEY',
75
+ ]),
43
76
  metamorphAfterSleepMillis: field(coerceNumber.default(300_000), APIFY_ENV_VARS.METAMORPH_AFTER_SLEEP_MILLIS),
44
77
  actorEventsWsUrl: field(z.string().optional(), [
45
78
  ACTOR_ENV_VARS.EVENTS_WEBSOCKET_URL,
@@ -49,7 +82,19 @@ export const apifyConfigFields = {
49
82
  actorId: field(z.string().optional(), [ACTOR_ENV_VARS.ID, APIFY_ENV_VARS.ACTOR_ID]),
50
83
  actorRunId: field(z.string().optional(), [ACTOR_ENV_VARS.RUN_ID, APIFY_ENV_VARS.ACTOR_RUN_ID]),
51
84
  actorTaskId: field(z.string().optional(), [ACTOR_ENV_VARS.TASK_ID, APIFY_ENV_VARS.ACTOR_TASK_ID]),
52
- apiBaseUrl: field(z.string().default('https://api.apify.com'), APIFY_ENV_VARS.API_BASE_URL),
85
+ actorBuildId: field(z.string().optional(), [ACTOR_ENV_VARS.BUILD_ID, APIFY_ENV_VARS.ACTOR_BUILD_ID]),
86
+ actorBuildNumber: field(z.string().optional(), [ACTOR_ENV_VARS.BUILD_NUMBER, APIFY_ENV_VARS.ACTOR_BUILD_NUMBER]),
87
+ actorBuildTags: field(coerceStringList.optional(), ACTOR_ENV_VARS.BUILD_TAGS),
88
+ actorFullName: field(z.string().optional(), ACTOR_ENV_VARS.FULL_NAME),
89
+ workflowKey: field(z.string().optional(), APIFY_ENV_VARS.WORKFLOW_KEY),
90
+ startedAt: field(coerceDate.optional(), [ACTOR_ENV_VARS.STARTED_AT, APIFY_ENV_VARS.STARTED_AT]),
91
+ timeoutAt: field(coerceDate.optional(), [ACTOR_ENV_VARS.TIMEOUT_AT, APIFY_ENV_VARS.TIMEOUT_AT]),
92
+ maxPaidDatasetItems: field(coerceNumber.optional(), [
93
+ ACTOR_ENV_VARS.MAX_PAID_DATASET_ITEMS,
94
+ APIFY_ENV_VARS.ACTOR_MAX_PAID_DATASET_ITEMS,
95
+ ]),
96
+ dedicatedCpus: field(coerceNumber.optional(), APIFY_ENV_VARS.DEDICATED_CPUS),
97
+ apiBaseUrl: field(z.string().default('https://api.apify.com/'), APIFY_ENV_VARS.API_BASE_URL),
53
98
  apiPublicBaseUrl: field(z.string().default('https://api.apify.com'), APIFY_ENV_VARS.API_PUBLIC_BASE_URL),
54
99
  containerPort: field(coerceNumber.default(+LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.WEB_SERVER_PORT]), [
55
100
  ACTOR_ENV_VARS.WEB_SERVER_PORT,
@@ -68,7 +113,7 @@ export const apifyConfigFields = {
68
113
  standbyUrl: field(z.string().optional(), ACTOR_ENV_VARS.STANDBY_URL),
69
114
  isAtHome: field(coerceBoolean.default(false), APIFY_ENV_VARS.IS_AT_HOME),
70
115
  userId: field(z.string().optional(), APIFY_ENV_VARS.USER_ID),
71
- userIsPaying: field(z.string().optional(), APIFY_ENV_VARS.USER_IS_PAYING),
116
+ userIsPaying: field(coerceBoolean.default(false), APIFY_ENV_VARS.USER_IS_PAYING),
72
117
  actorPermissionLevel: field(z.string().optional(), ACTOR_ENV_VARS.PERMISSION_LEVEL),
73
118
  inputSecretsPrivateKeyPassphrase: field(z.string().optional(), APIFY_ENV_VARS.INPUT_SECRETS_PRIVATE_KEY_PASSPHRASE),
74
119
  inputSecretsPrivateKeyFile: field(z.string().optional(), APIFY_ENV_VARS.INPUT_SECRETS_PRIVATE_KEY_FILE),
@@ -76,7 +121,6 @@ export const apifyConfigFields = {
76
121
  maxTotalChargeUsd: field(coerceNumber.transform((val) => (val === 0 ? Infinity : val)).default(Infinity), ACTOR_ENV_VARS.MAX_TOTAL_CHARGE_USD),
77
122
  metaOrigin: field(z.string().optional(), APIFY_ENV_VARS.META_ORIGIN),
78
123
  testPayPerEvent: field(coerceBoolean.default(false), 'ACTOR_TEST_PAY_PER_EVENT'),
79
- useChargingLogDataset: field(coerceBoolean.default(false), 'ACTOR_USE_CHARGING_LOG_DATASET'),
80
124
  // Pay-per-event charging metadata injected by the platform (JSON strings).
81
125
  actorPricingInfo: field(z.string().optional(), 'APIFY_ACTOR_PRICING_INFO'),
82
126
  chargedEventCounts: field(z.string().optional(), 'APIFY_CHARGED_ACTOR_EVENT_COUNTS'),
@@ -89,13 +133,13 @@ export const apifyConfigFields = {
89
133
  /**
90
134
  * `Configuration` is a value object holding the SDK configuration. We can use it in two ways:
91
135
  *
92
- * 1. When using `Actor` class, we can get the instance configuration via `sdk.config`
136
+ * 1. When using `Actor` class, we can get the instance configuration via `sdk.configuration`
93
137
  *
94
138
  * ```javascript
95
139
  * import { Actor } from 'apify';
96
140
  *
97
141
  * const sdk = new Actor({ token: '123' });
98
- * console.log(sdk.config.token); // '123'
142
+ * console.log(sdk.configuration.token); // '123'
99
143
  * ```
100
144
  *
101
145
  * 2. To get the global configuration (singleton instance). It will respect the environment variables.
@@ -103,7 +147,7 @@ export const apifyConfigFields = {
103
147
  * ```javascript
104
148
  * import { Configuration } from 'apify';
105
149
  *
106
- * const config = Configuration.getGlobalConfig();
150
+ * const config = Configuration.getGlobalConfiguration();
107
151
  * console.log(config.headless);
108
152
  * console.log(config.persistStateIntervalMillis);
109
153
  * ```
@@ -136,7 +180,16 @@ export const apifyConfigFields = {
136
180
  * `actorId` | `ACTOR_ID` | -
137
181
  * `actorRunId` | `ACTOR_RUN_ID` | -
138
182
  * `actorTaskId` | `ACTOR_TASK_ID` | -
139
- * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com'`
183
+ * `actorBuildId` | `ACTOR_BUILD_ID` | -
184
+ * `actorBuildNumber` | `ACTOR_BUILD_NUMBER` | -
185
+ * `actorBuildTags` | `ACTOR_BUILD_TAGS` | -
186
+ * `actorFullName` | `ACTOR_FULL_NAME` | -
187
+ * `workflowKey` | `APIFY_WORKFLOW_KEY` | -
188
+ * `startedAt` | `ACTOR_STARTED_AT` | -
189
+ * `timeoutAt` | `ACTOR_TIMEOUT_AT` | -
190
+ * `maxPaidDatasetItems` | `ACTOR_MAX_PAID_DATASET_ITEMS` | -
191
+ * `dedicatedCpus` | `APIFY_DEDICATED_CPUS` | -
192
+ * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
140
193
  * `containerPort` | `ACTOR_WEB_SERVER_PORT` | `4321`
141
194
  * `containerUrl` | `ACTOR_WEB_SERVER_URL` | `'http://localhost:4321'`
142
195
  * `inputKey` | `ACTOR_INPUT_KEY` | `'INPUT'`
@@ -147,6 +200,7 @@ export const apifyConfigFields = {
147
200
  * `proxyPort` | `APIFY_PROXY_PORT` | `8000`
148
201
  * `proxyStatusUrl` | `APIFY_PROXY_STATUS_URL` | `'http://proxy.apify.com'`
149
202
  * `userId` | `APIFY_USER_ID` | -
203
+ * `userIsPaying` | `APIFY_USER_IS_PAYING` | `false`
150
204
  * `xvfb` | `APIFY_XVFB` | -
151
205
  * `standbyPort` | `ACTOR_STANDBY_PORT` | `4321`
152
206
  * `standbyUrl` | `ACTOR_STANDBY_URL` | -
@@ -173,7 +227,7 @@ export class Configuration extends CoreConfiguration {
173
227
  * what crawlee internals resolve against; this singleton is only the
174
228
  * fallback for code reaching for a configuration without an explicit one.
175
229
  */
176
- static getGlobalConfig() {
230
+ static getGlobalConfiguration() {
177
231
  Configuration.globalConfig ??= new Configuration();
178
232
  return Configuration.globalConfig;
179
233
  }
@@ -0,0 +1,29 @@
1
+ import type { RequestOptions } from '@crawlee/core';
2
+ /** Request options that the `globs` and `pseudoUrls` input editors can attach to a single URL pattern. */
3
+ export interface UrlPatternRequestOptions extends Pick<RequestOptions, 'method' | 'payload' | 'label' | 'userData' | 'headers'> {
4
+ }
5
+ /** A single item of an input schema array field using the `globs` editor. */
6
+ export interface GlobInput extends UrlPatternRequestOptions {
7
+ glob: string;
8
+ }
9
+ /** A single item of an input schema array field using the `pseudoUrls` editor. */
10
+ export interface PseudoUrlInput extends UrlPatternRequestOptions {
11
+ purl: string;
12
+ }
13
+ export interface UrlPatternFilters {
14
+ /** Value of an input schema field using the `globs` editor. */
15
+ globs?: readonly (string | GlobInput)[];
16
+ /** Value of an input schema field using the `pseudoUrls` editor. */
17
+ pseudoUrls?: readonly (string | PseudoUrlInput)[];
18
+ }
19
+ /**
20
+ * Turns the `globs` and `pseudoUrls` input editor values into a `transformRequestFunction` that skips requests
21
+ * matching no pattern (all requests pass when no pattern is given) and applies the options of the matched pattern.
22
+ * When a URL matches multiple patterns, the first one wins, with globs checked before pseudo-URLs. The matched
23
+ * pattern's options shallowly override the request's fields, including `userData` (no deep merge, like in v3).
24
+ *
25
+ * ```ts
26
+ * await enqueueLinks({ transformRequestFunction: createTransformRequestFunction({ globs: input.globs }) });
27
+ * ```
28
+ */
29
+ export declare function createTransformRequestFunction({ globs, pseudoUrls, }: UrlPatternFilters): (request: RequestOptions) => RequestOptions | false | 'unchanged';
@@ -0,0 +1,52 @@
1
+ import { Minimatch } from 'minimatch';
2
+ import { purlToRegExp } from '@apify/pseudo_url';
3
+ /**
4
+ * Turns the `globs` and `pseudoUrls` input editor values into a `transformRequestFunction` that skips requests
5
+ * matching no pattern (all requests pass when no pattern is given) and applies the options of the matched pattern.
6
+ * When a URL matches multiple patterns, the first one wins, with globs checked before pseudo-URLs. The matched
7
+ * pattern's options shallowly override the request's fields, including `userData` (no deep merge, like in v3).
8
+ *
9
+ * ```ts
10
+ * await enqueueLinks({ transformRequestFunction: createTransformRequestFunction({ globs: input.globs }) });
11
+ * ```
12
+ */
13
+ export function createTransformRequestFunction({ globs = [], pseudoUrls = [], }) {
14
+ const patterns = [
15
+ ...globs.flatMap((item) => {
16
+ if (item == null) {
17
+ return [];
18
+ }
19
+ const { glob, ...options } = typeof item === 'string' ? { glob: item } : item;
20
+ const trimmedGlob = typeof glob === 'string' ? glob.trim() : '';
21
+ if (trimmedGlob.length === 0) {
22
+ return [];
23
+ }
24
+ const minimatch = new Minimatch(trimmedGlob, { nocase: true });
25
+ return [{ matches: (url) => minimatch.match(url), options }];
26
+ }),
27
+ ...pseudoUrls.flatMap((item) => {
28
+ if (item == null) {
29
+ return [];
30
+ }
31
+ const { purl, ...options } = typeof item === 'string' ? { purl: item } : item;
32
+ if (typeof purl !== 'string' || purl.trim().length === 0) {
33
+ return [];
34
+ }
35
+ let regexp;
36
+ try {
37
+ regexp = purlToRegExp(purl);
38
+ }
39
+ catch (cause) {
40
+ throw new Error(`Invalid pseudoUrl pattern '${purl}': ${cause.message}`, { cause });
41
+ }
42
+ return [{ matches: (url) => regexp.test(url), options }];
43
+ }),
44
+ ];
45
+ if (patterns.length === 0) {
46
+ return () => 'unchanged';
47
+ }
48
+ return (request) => {
49
+ const matched = patterns.find(({ matches }) => matches(request.url));
50
+ return matched ? { ...request, ...matched.options } : false;
51
+ };
52
+ }
@@ -0,0 +1,31 @@
1
+ /** Why {@link Actor.getInput} could not produce the input. */
2
+ export type ActorInputErrorCode =
3
+ /** No input record in the default key-value store, and locally no input file either. */
4
+ 'NOT_FOUND'
5
+ /** The input is in more than one place — both `<inputKey>` and `<inputKey>.json` in one directory, or in the store and in the working directory — so none is picked. */
6
+ | 'MULTIPLE_FILES'
7
+ /** The secret fields of the input could not be decrypted; `cause` holds the underlying error. */
8
+ | 'DECRYPTION_FAILED'
9
+ /** A JSON input record or file does not parse; `cause` holds the parser error. */
10
+ | 'PARSE_FAILED';
11
+ /**
12
+ * Thrown by {@link Actor.getInput} when the Actor input cannot be produced. `code` says why, and
13
+ * `cause` carries the underlying error where there is one. Anything else thrown by `getInput()`, such as
14
+ * an Apify API error, is not an input problem and is passed through as is.
15
+ *
16
+ * ```js
17
+ * try {
18
+ * input = await Actor.getInput();
19
+ * } catch (error) {
20
+ * if (!(error instanceof ActorInputError) || error.code !== 'NOT_FOUND') throw error;
21
+ * input = {};
22
+ * }
23
+ * ```
24
+ */
25
+ export declare class ActorInputError extends Error {
26
+ readonly name = "ActorInputError";
27
+ readonly code: ActorInputErrorCode;
28
+ constructor(code: ActorInputErrorCode, message: string, options?: {
29
+ cause?: unknown;
30
+ });
31
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Thrown by {@link Actor.getInput} when the Actor input cannot be produced. `code` says why, and
3
+ * `cause` carries the underlying error where there is one. Anything else thrown by `getInput()`, such as
4
+ * an Apify API error, is not an input problem and is passed through as is.
5
+ *
6
+ * ```js
7
+ * try {
8
+ * input = await Actor.getInput();
9
+ * } catch (error) {
10
+ * if (!(error instanceof ActorInputError) || error.code !== 'NOT_FOUND') throw error;
11
+ * input = {};
12
+ * }
13
+ * ```
14
+ */
15
+ export class ActorInputError extends Error {
16
+ name = 'ActorInputError';
17
+ code;
18
+ constructor(code, message, options) {
19
+ super(message, options);
20
+ this.code = code;
21
+ }
22
+ }
@@ -0,0 +1,12 @@
1
+ import type { Dictionary } from '@crawlee/types';
2
+ /**
3
+ * Turns a Google Sheets sharing link into the link of its CSV export, other URLs are returned unchanged.
4
+ * @internal
5
+ */
6
+ export declare function toGoogleSheetsCsvUrl(url: string): string;
7
+ /**
8
+ * Replaces Google Sheets sharing links in the `requestsFromUrl` entries of the input's array fields (as produced by
9
+ * the "Link remote text file" option of the `requestListSources` editor) with the links of their CSV exports.
10
+ * @internal
11
+ */
12
+ export declare function fixGoogleSheetsUrls<T extends Dictionary>(input: T): T;
@@ -0,0 +1,26 @@
1
+ // Links published to the web (`/spreadsheets/d/e/<id>/pub?output=csv`) and links that already point at an export
2
+ // (`/gviz/...`, `/export...`) are downloadable as they are, so they're left alone.
3
+ const GOOGLE_SHEETS_URL_REGEX = /^(https:\/\/docs\.google\.com\/spreadsheets\/d\/(?!e\/)(?:\w|-)+)(\/(?:gviz|export)\b)?/;
4
+ /**
5
+ * Turns a Google Sheets sharing link into the link of its CSV export, other URLs are returned unchanged.
6
+ * @internal
7
+ */
8
+ export function toGoogleSheetsCsvUrl(url) {
9
+ const match = GOOGLE_SHEETS_URL_REGEX.exec(url);
10
+ return match && !match[2] ? `${match[1]}/gviz/tq?tqx=out:csv` : url;
11
+ }
12
+ /**
13
+ * Replaces Google Sheets sharing links in the `requestsFromUrl` entries of the input's array fields (as produced by
14
+ * the "Link remote text file" option of the `requestListSources` editor) with the links of their CSV exports.
15
+ * @internal
16
+ */
17
+ export function fixGoogleSheetsUrls(input) {
18
+ return Object.fromEntries(Object.entries(input).map(([key, value]) => [
19
+ key,
20
+ Array.isArray(value)
21
+ ? value.map((item) => typeof item?.requestsFromUrl === 'string'
22
+ ? { ...item, requestsFromUrl: toGoogleSheetsCsvUrl(item.requestsFromUrl) }
23
+ : item)
24
+ : value,
25
+ ]));
26
+ }
package/dist/index.d.ts CHANGED
@@ -1,9 +1,18 @@
1
1
  export * from './actor.js';
2
- export type { OpenStorageOptions, StorageAlias, StorageId, StorageName, StorageIdentifier, StorageIdentifierWithoutAlias, } from './storage.js';
2
+ export { ApifyStorageBackend, type ApifyStorageBackendOptions } from './apify_storage_backend.js';
3
+ export { ApifyFileSystemStorageBackend, type ApifyFileSystemStorageOptions, } from './apify_file_system_storage_backend.js';
4
+ export type { ApifyDatasetInfo } from './apify_dataset_backend.js';
5
+ export type { ApifyKeyValueStoreInfo } from './apify_key_value_store_backend.js';
6
+ export type { ApifyRequestQueueInfo, RequestQueueAccessMode } from './apify_request_queue_backend.js';
7
+ export { ArgumentValidationError } from './utils.js';
8
+ export { ActorInputError, type ActorInputErrorCode } from './errors.js';
9
+ export { createTransformRequestFunction, type GlobInput, type PseudoUrlInput, type UrlPatternFilters, type UrlPatternRequestOptions, } from './enqueue_links_filters.js';
10
+ export type { OpenStorageOptions, StorageAlias, StorageId, StorageName, StorageIdentifier } from './storage.js';
3
11
  export { ChargeOptions, ChargeResult, ActorPricingInfo, ChargingManager } from './charging.js';
4
12
  export * from './configuration.js';
5
13
  export * from './proxy_configuration.js';
6
14
  export * from './platform_event_manager.js';
7
- export * from './key_value_store.js';
8
- export { Dataset, DatasetDataOptions, DatasetIteratorOptions, DatasetConsumer, DatasetMapper, DatasetReducer, DatasetOptions, DatasetContent, RequestQueue, QueueOperationInfo, RequestQueueOperationOptions, RequestQueueOptions, KeyConsumer, KeyValueStoreOptions, RecordOptions, KeyValueStoreIteratorOptions, log, Log, LoggerOptions, LogLevel, Logger, LoggerJson, LoggerText, } from '@crawlee/core';
9
- export { ApifyClient, ApifyClientOptions } from 'apify-client';
15
+ export { Dataset, DatasetDataOptions, DatasetIteratorOptions, DatasetConsumer, DatasetMapper, DatasetReducer, DatasetOptions, DatasetContent, RequestQueue, RequestQueueOperationOptions, RequestQueueOptions, KeyValueStore, KeyConsumer, KeyValueStoreOptions, RecordOptions, KeyValueStoreIteratorOptions, log, Log, LoggerOptions, LogLevel, Logger, LoggerJson, LoggerText, } from '@crawlee/core';
16
+ export type { QueueOperationInfo } from '@crawlee/types';
17
+ export { ACTOR_ENV_VARS, APIFY_ENV_VARS } from '@apify/consts';
18
+ export { ApifyClient, ApifyClientOptions, ApifyClientError, ApifyApiError, InvalidRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, InvalidResponseBodyError, ResponseValidationError, } from 'apify-client';
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  export * from './actor.js';
2
+ export { ApifyStorageBackend } from './apify_storage_backend.js';
3
+ export { ApifyFileSystemStorageBackend, } from './apify_file_system_storage_backend.js';
4
+ export { ArgumentValidationError } from './utils.js';
5
+ export { ActorInputError } from './errors.js';
6
+ export { createTransformRequestFunction, } from './enqueue_links_filters.js';
2
7
  export { ChargingManager } from './charging.js';
3
8
  export * from './configuration.js';
4
9
  export * from './proxy_configuration.js';
5
10
  export * from './platform_event_manager.js';
6
- export * from './key_value_store.js';
7
- export { Dataset, RequestQueue, log, Log, LogLevel, Logger, LoggerJson, LoggerText, } from '@crawlee/core';
8
- export { ApifyClient } from 'apify-client';
11
+ export { Dataset, RequestQueue, KeyValueStore, log, Log, LogLevel, Logger, LoggerJson, LoggerText, } from '@crawlee/core';
12
+ export { ACTOR_ENV_VARS, APIFY_ENV_VARS } from '@apify/consts';
13
+ export { ApifyClient, ApifyClientError, ApifyApiError, InvalidRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, InvalidResponseBodyError, ResponseValidationError, } from 'apify-client';
@@ -1,4 +1,4 @@
1
- import type { Dictionary } from '@crawlee/utils';
1
+ import type { Dictionary } from '@crawlee/types';
2
2
  /**
3
3
  * @ignore
4
4
  */
@@ -1,3 +1,4 @@
1
+ import type { EventTypeName } from '@crawlee/core';
1
2
  import { EventManager } from '@crawlee/core';
2
3
  import { Configuration } from './configuration.js';
3
4
  /**
@@ -9,16 +10,16 @@ import { Configuration } from './configuration.js';
9
10
  * **Example usage:**
10
11
  *
11
12
  * ```javascript
12
- * Actor.on('cpuInfo', (data) => {
13
+ * Actor.on('systemInfo', (data) => {
13
14
  * if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');
14
15
  * });
15
16
  * ```
16
17
  *
17
18
  * The following events are emitted:
18
19
  *
19
- * - `cpuInfo`: `{ "isCpuOverloaded": Boolean }`
20
- * The event is emitted approximately every second
21
- * and it indicates whether the Actor is using the maximum of available CPU resources.
20
+ * - `systemInfo`: `{ "cpuCurrentUsage": Number, "isCpuOverloaded": Boolean, "memCurrentBytes": Number, ... }`
21
+ * The event is emitted approximately every second and it describes the CPU and memory usage of the Actor.
22
+ * `isCpuOverloaded` indicates whether the Actor is using the maximum of available CPU resources.
22
23
  * If that's the case, the Actor should not add more workload.
23
24
  * For example, this event is used by the {@link AutoscaledPool} class.
24
25
  * - `migrating`: `void`
@@ -37,18 +38,32 @@ import { Configuration } from './configuration.js';
37
38
  * in which case the `isMigrating` flag is set to `true`. Otherwise the flag is `false`.
38
39
  * Note that the `persistState` event is provided merely for user convenience,
39
40
  * you can achieve the same effect using `setInterval()` and listening for the `migrating` event.
41
+ *
42
+ * Messages with any other name are not emitted. This includes the deprecated `cpuInfo` event, which the platform
43
+ * sends next to `systemInfo` for backward compatibility. Registering a `cpuInfo` listener logs a warning.
44
+ * Unknown names are logged at the debug level.
45
+ *
46
+ * The connection to the platform events websocket is re-established after it drops, unless it was closed
47
+ * with a code signalling a permanent condition (e.g. `1008` for an unknown run ID).
40
48
  */
41
49
  export declare class PlatformEventManager extends EventManager {
42
- readonly config: Configuration;
43
- /** Websocket connection to Actor events. */
44
- private eventsWs?;
45
- constructor(config?: Configuration);
50
+ #private;
51
+ readonly configuration: Configuration;
52
+ /**
53
+ * @param internalListeners Listeners of the SDK itself, kept apart from the ones registered with `on()`, so that
54
+ * user code can neither remove them with `off()` nor see them in `listeners()`.
55
+ */
56
+ constructor(configuration?: Configuration, internalListeners?: Partial<Record<EventTypeName, (...args: any[]) => unknown>>);
57
+ on(event: EventTypeName, listener: (...args: any[]) => any): void;
58
+ emit(event: EventTypeName, ...args: unknown[]): void;
59
+ waitForAllListenersToComplete(): Promise<boolean>;
46
60
  /**
47
61
  * Initializes `Actor.events` event emitter by creating a connection to a websocket that provides them.
48
62
  * This is an internal function that is automatically called by `Actor.main()`.
63
+ *
64
+ * Rejects if the first connection cannot be established. Later drops are handled by reconnecting.
49
65
  */
50
66
  init(): Promise<void>;
51
- private createWebSocketConnection;
52
67
  /**
53
68
  * Closes websocket providing events from Actor infrastructure and also stops sending internal events
54
69
  * of Apify package such as `persistState`.