apify 3.7.3-beta.97 → 4.0.0-beta.101
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 +1 -1
- package/dist/actor.d.ts +379 -139
- package/dist/actor.js +764 -500
- package/dist/apify_dataset_backend.d.ts +19 -0
- package/dist/apify_dataset_backend.js +77 -0
- package/dist/apify_file_system_storage_backend.d.ts +34 -0
- package/dist/apify_file_system_storage_backend.js +41 -0
- package/dist/apify_key_value_store_backend.d.ts +23 -0
- package/dist/apify_key_value_store_backend.js +56 -0
- package/dist/apify_request_queue_backend.d.ts +78 -0
- package/dist/apify_request_queue_backend.js +114 -0
- package/dist/apify_request_queue_shared_backend.d.ts +31 -0
- package/dist/apify_request_queue_shared_backend.js +193 -0
- package/dist/apify_request_queue_single_backend.d.ts +43 -0
- package/dist/apify_request_queue_single_backend.js +256 -0
- package/dist/apify_storage_backend.d.ts +90 -0
- package/dist/apify_storage_backend.js +210 -0
- package/dist/charging.d.ts +39 -44
- package/dist/charging.js +237 -293
- package/dist/charging_storage_backend.d.ts +53 -0
- package/dist/charging_storage_backend.js +105 -0
- package/dist/child_run_tracker.d.ts +88 -0
- package/dist/child_run_tracker.js +239 -0
- package/dist/configuration.d.ts +85 -144
- package/dist/configuration.js +138 -174
- package/dist/enqueue_links_filters.d.ts +29 -0
- package/dist/enqueue_links_filters.js +52 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +22 -0
- package/dist/google_sheets.d.ts +12 -0
- package/dist/google_sheets.js +26 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.js +12 -22
- package/dist/input-schemas.d.ts +1 -1
- package/dist/input-schemas.js +12 -18
- package/dist/platform_event_manager.d.ts +15 -10
- package/dist/platform_event_manager.js +193 -63
- package/dist/proxy_configuration.d.ts +52 -72
- package/dist/proxy_configuration.js +176 -221
- package/dist/smart_apify_storage_backend.d.ts +52 -0
- package/dist/smart_apify_storage_backend.js +73 -0
- package/dist/storage.d.ts +6 -24
- package/dist/storage.js +1 -79
- package/dist/utils.d.ts +30 -0
- package/dist/utils.js +81 -23
- package/package.json +38 -43
- package/dist/index.mjs +0 -19
- package/dist/key_value_store.d.ts +0 -16
- package/dist/key_value_store.js +0 -40
- package/dist/patched_apify_client.d.ts +0 -25
- package/dist/patched_apify_client.js +0 -75
package/dist/configuration.d.ts
CHANGED
|
@@ -1,77 +1,100 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConfigField, FieldsInput, FieldsOutput } from '@crawlee/core';
|
|
2
2
|
import { Configuration as CoreConfiguration } from '@crawlee/core';
|
|
3
|
-
import
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
import { z } from 'zod';
|
|
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>>>;
|
|
21
|
+
defaultDatasetId: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
22
|
+
defaultKeyValueStoreId: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
23
|
+
defaultRequestQueueId: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
24
|
+
inputKey: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
25
|
+
metamorphAfterSleepMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
|
|
26
|
+
actorEventsWsUrl: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
27
|
+
token: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
28
|
+
actorId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
actorRunId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
30
|
+
actorTaskId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
apiBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
32
|
+
apiPublicBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
33
|
+
containerPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
|
|
34
|
+
containerUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
35
|
+
proxyHostname: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
36
|
+
proxyPassword: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
37
|
+
proxyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
|
|
38
|
+
proxyStatusUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
39
|
+
/** @deprecated use `containerPort` instead */
|
|
40
|
+
standbyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
|
|
41
|
+
standbyUrl: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
42
|
+
isAtHome: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
|
|
43
|
+
userId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
44
|
+
userIsPaying: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
|
|
45
|
+
actorPermissionLevel: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
46
|
+
inputSecretsPrivateKeyPassphrase: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
47
|
+
inputSecretsPrivateKeyFile: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
48
|
+
maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodPreprocess<z.ZodNumber, unknown>, z.ZodTransform<number, number>>>>;
|
|
49
|
+
metaOrigin: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
50
|
+
testPayPerEvent: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
|
|
51
|
+
useChargingLogDataset: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
|
|
52
|
+
actorPricingInfo: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
53
|
+
chargedEventCounts: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
54
|
+
actorStoragesJson: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
55
|
+
storageClientOptions: ConfigField<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
56
|
+
};
|
|
57
|
+
export type ApifyConfigurationInput = FieldsInput<typeof apifyConfigFields>;
|
|
58
|
+
export type ApifyResolvedConfigValues = FieldsOutput<typeof apifyConfigFields>;
|
|
59
|
+
/** @deprecated Use {@link ApifyConfigurationInput} instead. */
|
|
60
|
+
export type ConfigurationOptions = ApifyConfigurationInput;
|
|
61
|
+
export interface Configuration extends ApifyResolvedConfigValues {
|
|
35
62
|
}
|
|
36
63
|
/**
|
|
37
64
|
* `Configuration` is a value object holding the SDK configuration. We can use it in two ways:
|
|
38
65
|
*
|
|
39
|
-
* 1. When using `Actor` class, we can get the instance configuration via `sdk.
|
|
66
|
+
* 1. When using `Actor` class, we can get the instance configuration via `sdk.configuration`
|
|
40
67
|
*
|
|
41
68
|
* ```javascript
|
|
42
69
|
* import { Actor } from 'apify';
|
|
43
|
-
* import { BasicCrawler } from 'crawlee';
|
|
44
70
|
*
|
|
45
71
|
* const sdk = new Actor({ token: '123' });
|
|
46
|
-
* console.log(sdk.
|
|
47
|
-
*
|
|
48
|
-
* const crawler = new BasicCrawler({
|
|
49
|
-
* // ... crawler options
|
|
50
|
-
* }, sdk.config);
|
|
72
|
+
* console.log(sdk.configuration.token); // '123'
|
|
51
73
|
* ```
|
|
52
74
|
*
|
|
53
75
|
* 2. To get the global configuration (singleton instance). It will respect the environment variables.
|
|
54
76
|
*
|
|
55
77
|
* ```javascript
|
|
56
|
-
* import {
|
|
57
|
-
*
|
|
58
|
-
* // Get the global configuration
|
|
59
|
-
* const config = Configuration.getGlobalConfig();
|
|
60
|
-
* // Set the 'persistStateIntervalMillis' option
|
|
61
|
-
* // of global configuration to 30 seconds
|
|
62
|
-
* config.set('persistStateIntervalMillis', 30_000);
|
|
78
|
+
* import { Configuration } from 'apify';
|
|
63
79
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
80
|
+
* const config = Configuration.getGlobalConfiguration();
|
|
81
|
+
* console.log(config.headless);
|
|
82
|
+
* console.log(config.persistStateIntervalMillis);
|
|
67
83
|
* ```
|
|
68
84
|
*
|
|
85
|
+
* Configuration is immutable — values are set via the constructor and cannot be changed afterwards.
|
|
86
|
+
* The priority order for resolving values is (highest to lowest):
|
|
87
|
+
*
|
|
88
|
+
* ```text
|
|
89
|
+
* constructor options > environment variables > crawlee.json > schema defaults
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
69
92
|
* ## Supported Configuration Options
|
|
70
93
|
*
|
|
71
94
|
* Key | Environment Variable | Default Value
|
|
72
95
|
* ---|---|---
|
|
73
96
|
* `memoryMbytes` | `ACTOR_MEMORY_MBYTES` | -
|
|
74
|
-
* `headless` | `APIFY_HEADLESS` |
|
|
97
|
+
* `headless` | `APIFY_HEADLESS` | `true`
|
|
75
98
|
* `persistStateIntervalMillis` | `APIFY_PERSIST_STATE_INTERVAL_MILLIS` | `60e3`
|
|
76
99
|
* `token` | `APIFY_TOKEN` | -
|
|
77
100
|
* `isAtHome` | `APIFY_IS_AT_HOME` | -
|
|
@@ -85,7 +108,6 @@ export interface ConfigurationOptions extends CoreConfigurationOptions {
|
|
|
85
108
|
* ---|---|---
|
|
86
109
|
* `actorEventsWsUrl` | `ACTOR_EVENTS_WEBSOCKET_URL` | -
|
|
87
110
|
* `actorId` | `ACTOR_ID` | -
|
|
88
|
-
* `actorPermissionLevel` | `ACTOR_PERMISSION_LEVEL` | -
|
|
89
111
|
* `actorRunId` | `ACTOR_RUN_ID` | -
|
|
90
112
|
* `actorTaskId` | `ACTOR_TASK_ID` | -
|
|
91
113
|
* `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
|
|
@@ -99,7 +121,7 @@ export interface ConfigurationOptions extends CoreConfigurationOptions {
|
|
|
99
121
|
* `proxyPort` | `APIFY_PROXY_PORT` | `8000`
|
|
100
122
|
* `proxyStatusUrl` | `APIFY_PROXY_STATUS_URL` | `'http://proxy.apify.com'`
|
|
101
123
|
* `userId` | `APIFY_USER_ID` | -
|
|
102
|
-
* `userIsPaying` | `APIFY_USER_IS_PAYING` |
|
|
124
|
+
* `userIsPaying` | `APIFY_USER_IS_PAYING` | `false`
|
|
103
125
|
* `xvfb` | `APIFY_XVFB` | -
|
|
104
126
|
* `standbyPort` | `ACTOR_STANDBY_PORT` | `4321`
|
|
105
127
|
* `standbyUrl` | `ACTOR_STANDBY_URL` | -
|
|
@@ -107,99 +129,18 @@ export interface ConfigurationOptions extends CoreConfigurationOptions {
|
|
|
107
129
|
* `defaultBrowserPath` | `APIFY_DEFAULT_BROWSER_PATH` | -
|
|
108
130
|
*/
|
|
109
131
|
export declare class Configuration extends CoreConfiguration {
|
|
110
|
-
/** @
|
|
132
|
+
/** @internal */
|
|
111
133
|
static globalConfig?: Configuration;
|
|
112
|
-
protected static
|
|
113
|
-
|
|
114
|
-
APIFY_PURGE_ON_START: string;
|
|
115
|
-
APIFY_MEMORY_MBYTES: string;
|
|
116
|
-
APIFY_DEFAULT_DATASET_ID: string;
|
|
117
|
-
APIFY_DEFAULT_KEY_VALUE_STORE_ID: string;
|
|
118
|
-
APIFY_DEFAULT_REQUEST_QUEUE_ID: string;
|
|
119
|
-
APIFY_INPUT_KEY: string;
|
|
120
|
-
APIFY_PERSIST_STATE_INTERVAL_MILLIS: string;
|
|
121
|
-
APIFY_HEADLESS: string;
|
|
122
|
-
APIFY_XVFB: string;
|
|
123
|
-
APIFY_CHROME_EXECUTABLE_PATH: string;
|
|
124
|
-
APIFY_DEFAULT_BROWSER_PATH: string;
|
|
125
|
-
APIFY_DISABLE_BROWSER_SANDBOX: string;
|
|
126
|
-
APIFY_TOKEN: string;
|
|
127
|
-
APIFY_METAMORPH_AFTER_SLEEP_MILLIS: string;
|
|
128
|
-
APIFY_TEST_PERSIST_INTERVAL_MILLIS: string;
|
|
129
|
-
APIFY_ACTOR_EVENTS_WS_URL: string;
|
|
130
|
-
APIFY_ACTOR_ID: string;
|
|
131
|
-
APIFY_API_BASE_URL: string;
|
|
132
|
-
APIFY_API_PUBLIC_BASE_URL: string;
|
|
133
|
-
APIFY_IS_AT_HOME: string;
|
|
134
|
-
APIFY_ACTOR_RUN_ID: string;
|
|
135
|
-
APIFY_ACTOR_TASK_ID: string;
|
|
136
|
-
APIFY_CONTAINER_PORT: string;
|
|
137
|
-
APIFY_CONTAINER_URL: string;
|
|
138
|
-
APIFY_USER_ID: string;
|
|
139
|
-
APIFY_USER_IS_PAYING: string;
|
|
140
|
-
APIFY_PROXY_HOSTNAME: string;
|
|
141
|
-
APIFY_PROXY_PASSWORD: string;
|
|
142
|
-
APIFY_PROXY_STATUS_URL: string;
|
|
143
|
-
APIFY_PROXY_PORT: string;
|
|
144
|
-
APIFY_INPUT_SECRETS_PRIVATE_KEY_FILE: string;
|
|
145
|
-
APIFY_INPUT_SECRETS_PRIVATE_KEY_PASSPHRASE: string;
|
|
146
|
-
APIFY_META_ORIGIN: string;
|
|
147
|
-
ACTOR_DEFAULT_DATASET_ID: string;
|
|
148
|
-
ACTOR_DEFAULT_KEY_VALUE_STORE_ID: string;
|
|
149
|
-
ACTOR_DEFAULT_REQUEST_QUEUE_ID: string;
|
|
150
|
-
ACTOR_EVENTS_WEBSOCKET_URL: string;
|
|
151
|
-
ACTOR_ID: string;
|
|
152
|
-
ACTOR_INPUT_KEY: string;
|
|
153
|
-
ACTOR_MEMORY_MBYTES: string;
|
|
154
|
-
ACTOR_PERMISSION_LEVEL: string;
|
|
155
|
-
ACTOR_RUN_ID: string;
|
|
156
|
-
ACTOR_STANDBY_PORT: string;
|
|
157
|
-
ACTOR_STANDBY_URL: string;
|
|
158
|
-
ACTOR_TASK_ID: string;
|
|
159
|
-
ACTOR_WEB_SERVER_PORT: string;
|
|
160
|
-
ACTOR_WEB_SERVER_URL: string;
|
|
161
|
-
ACTOR_MAX_TOTAL_CHARGE_USD: string;
|
|
162
|
-
ACTOR_TEST_PAY_PER_EVENT: string;
|
|
163
|
-
ACTOR_USE_CHARGING_LOG_DATASET: string;
|
|
164
|
-
APIFY_ACTOR_PRICING_INFO: string;
|
|
165
|
-
APIFY_CHARGED_ACTOR_EVENT_COUNTS: string;
|
|
166
|
-
ACTOR_STORAGES_JSON: string;
|
|
167
|
-
};
|
|
168
|
-
protected static INTEGER_VARS: string[];
|
|
169
|
-
protected static BOOLEAN_VARS: string[];
|
|
170
|
-
protected static DEFAULTS: {
|
|
171
|
-
defaultKeyValueStoreId: string;
|
|
172
|
-
defaultDatasetId: string;
|
|
173
|
-
defaultRequestQueueId: string;
|
|
174
|
-
inputKey: string;
|
|
175
|
-
apiBaseUrl: string;
|
|
176
|
-
apiPublicBaseUrl: string;
|
|
177
|
-
proxyStatusUrl: string;
|
|
178
|
-
proxyHostname: string;
|
|
179
|
-
proxyPort: number;
|
|
180
|
-
containerPort: number;
|
|
181
|
-
containerUrl: string;
|
|
182
|
-
standbyPort: number;
|
|
183
|
-
metamorphAfterSleepMillis: number;
|
|
184
|
-
persistStateIntervalMillis: number;
|
|
185
|
-
testPayPerEvent: boolean;
|
|
186
|
-
useChargingLogDataset: boolean;
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* @inheritDoc
|
|
190
|
-
*/
|
|
191
|
-
get<T extends keyof ConfigurationOptions, U extends ConfigurationOptions[T]>(key: T, defaultValue?: U): U;
|
|
134
|
+
protected static fields: Record<string, ConfigField>;
|
|
135
|
+
constructor(options?: ApifyConfigurationInput);
|
|
192
136
|
/**
|
|
193
137
|
* @inheritDoc
|
|
138
|
+
*
|
|
139
|
+
* Returns the SDK's global {@link Configuration} singleton (an
|
|
140
|
+
* Apify-typed default that parses `APIFY_*` env vars). During an Actor run
|
|
141
|
+
* the active configuration is held by crawlee's `serviceLocator`, which is
|
|
142
|
+
* what crawlee internals resolve against; this singleton is only the
|
|
143
|
+
* fallback for code reaching for a configuration without an explicit one.
|
|
194
144
|
*/
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @inheritDoc
|
|
198
|
-
*/
|
|
199
|
-
static getGlobalConfig(): Configuration;
|
|
200
|
-
/**
|
|
201
|
-
* Resets global configuration instance. The default instance holds configuration based on env vars,
|
|
202
|
-
* if we want to change them, we need to first reset the global state. Used mainly for testing purposes.
|
|
203
|
-
*/
|
|
204
|
-
static resetGlobalState(): void;
|
|
145
|
+
static getGlobalConfiguration(): Configuration;
|
|
205
146
|
}
|
package/dist/configuration.js
CHANGED
|
@@ -1,47 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
import { coerceBoolean, coerceNumber, Configuration as CoreConfiguration, crawleeConfigFields, field, } from '@crawlee/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { ACTOR_ENV_VARS, APIFY_ENV_VARS, LOCAL_ACTOR_ENV_VARS, LOCAL_APIFY_ENV_VARS } from '@apify/consts';
|
|
5
|
+
// Evaluated lazily (per Configuration construction, not at import) so the
|
|
6
|
+
// at-home defaults for `availableMemoryRatio` / `disableBrowserSandbox` below
|
|
7
|
+
// react to `APIFY_IS_AT_HOME` even if it changes after import (tests, embedding).
|
|
8
|
+
// Reads the env var, not the resolved `isAtHome` field, so an explicit
|
|
9
|
+
// `new Configuration({ isAtHome: true })` won't flip these — env is the source.
|
|
10
|
+
const isAtHome = () => !!process.env[APIFY_ENV_VARS.IS_AT_HOME];
|
|
11
|
+
function withApifyEnv(base, apifyEnvVars, schema) {
|
|
12
|
+
const crawleeVars = base.envVar == null ? [] : [base.envVar].flat();
|
|
13
|
+
return field((schema ?? base.schema), [...[apifyEnvVars].flat(), ...crawleeVars]);
|
|
14
|
+
}
|
|
15
|
+
// --- Apify config field definitions ---
|
|
16
|
+
export const apifyConfigFields = {
|
|
17
|
+
// Inherit all crawlee fields as-is.
|
|
18
|
+
...crawleeConfigFields,
|
|
19
|
+
// Crawlee fields the SDK extends with ACTOR_/APIFY_ env-var aliases (which
|
|
20
|
+
// take precedence; crawlee's own CRAWLEE_* var is reused as the fallback,
|
|
21
|
+
// never re-typed). A schema is passed only where the SDK needs a different
|
|
22
|
+
// default than crawlee's.
|
|
23
|
+
memoryMbytes: withApifyEnv(crawleeConfigFields.memoryMbytes, [
|
|
24
|
+
ACTOR_ENV_VARS.MEMORY_MBYTES,
|
|
25
|
+
APIFY_ENV_VARS.MEMORY_MBYTES,
|
|
26
|
+
]),
|
|
27
|
+
availableMemoryRatio: withApifyEnv(crawleeConfigFields.availableMemoryRatio, 'APIFY_AVAILABLE_MEMORY_RATIO', coerceNumber.default(() => (isAtHome() ? 1 : 0.25))),
|
|
28
|
+
disableBrowserSandbox: withApifyEnv(crawleeConfigFields.disableBrowserSandbox, 'APIFY_DISABLE_BROWSER_SANDBOX', coerceBoolean.default(() => isAtHome())),
|
|
29
|
+
persistStateIntervalMillis: withApifyEnv(crawleeConfigFields.persistStateIntervalMillis, [
|
|
30
|
+
APIFY_ENV_VARS.PERSIST_STATE_INTERVAL_MILLIS,
|
|
31
|
+
'APIFY_TEST_PERSIST_INTERVAL_MILLIS',
|
|
32
|
+
]),
|
|
33
|
+
headless: withApifyEnv(crawleeConfigFields.headless, APIFY_ENV_VARS.HEADLESS),
|
|
34
|
+
xvfb: withApifyEnv(crawleeConfigFields.xvfb, APIFY_ENV_VARS.XVFB),
|
|
35
|
+
chromeExecutablePath: withApifyEnv(crawleeConfigFields.chromeExecutablePath, APIFY_ENV_VARS.CHROME_EXECUTABLE_PATH),
|
|
36
|
+
defaultBrowserPath: withApifyEnv(crawleeConfigFields.defaultBrowserPath, 'APIFY_DEFAULT_BROWSER_PATH'),
|
|
37
|
+
purgeOnStart: withApifyEnv(crawleeConfigFields.purgeOnStart, APIFY_ENV_VARS.PURGE_ON_START),
|
|
38
|
+
// Crawlee addresses the default storage by a reserved alias; on the platform
|
|
39
|
+
// each run gets real storage IDs, which the API calls need.
|
|
40
|
+
defaultDatasetId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_DATASET_ID]), [
|
|
41
|
+
ACTOR_ENV_VARS.DEFAULT_DATASET_ID,
|
|
42
|
+
APIFY_ENV_VARS.DEFAULT_DATASET_ID,
|
|
43
|
+
]),
|
|
44
|
+
defaultKeyValueStoreId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID]), [
|
|
45
|
+
ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID,
|
|
46
|
+
APIFY_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID,
|
|
47
|
+
]),
|
|
48
|
+
defaultRequestQueueId: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID]), [
|
|
49
|
+
ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID,
|
|
50
|
+
APIFY_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID,
|
|
51
|
+
]),
|
|
52
|
+
// Apify-specific fields
|
|
53
|
+
// Crawlee has no notion of a run input; `CRAWLEE_INPUT_KEY` stays as the
|
|
54
|
+
// lowest-priority alias because the Apify CLI sets all three variables.
|
|
55
|
+
inputKey: field(z.string().default('INPUT'), [
|
|
56
|
+
ACTOR_ENV_VARS.INPUT_KEY,
|
|
57
|
+
APIFY_ENV_VARS.INPUT_KEY,
|
|
58
|
+
'CRAWLEE_INPUT_KEY',
|
|
59
|
+
]),
|
|
60
|
+
metamorphAfterSleepMillis: field(coerceNumber.default(300_000), APIFY_ENV_VARS.METAMORPH_AFTER_SLEEP_MILLIS),
|
|
61
|
+
actorEventsWsUrl: field(z.string().optional(), [
|
|
62
|
+
ACTOR_ENV_VARS.EVENTS_WEBSOCKET_URL,
|
|
63
|
+
APIFY_ENV_VARS.ACTOR_EVENTS_WS_URL,
|
|
64
|
+
]),
|
|
65
|
+
token: field(z.string().optional(), APIFY_ENV_VARS.TOKEN),
|
|
66
|
+
actorId: field(z.string().optional(), [ACTOR_ENV_VARS.ID, APIFY_ENV_VARS.ACTOR_ID]),
|
|
67
|
+
actorRunId: field(z.string().optional(), [ACTOR_ENV_VARS.RUN_ID, APIFY_ENV_VARS.ACTOR_RUN_ID]),
|
|
68
|
+
actorTaskId: field(z.string().optional(), [ACTOR_ENV_VARS.TASK_ID, APIFY_ENV_VARS.ACTOR_TASK_ID]),
|
|
69
|
+
apiBaseUrl: field(z.string().default('https://api.apify.com/'), APIFY_ENV_VARS.API_BASE_URL),
|
|
70
|
+
apiPublicBaseUrl: field(z.string().default('https://api.apify.com'), APIFY_ENV_VARS.API_PUBLIC_BASE_URL),
|
|
71
|
+
containerPort: field(coerceNumber.default(+LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.WEB_SERVER_PORT]), [
|
|
72
|
+
ACTOR_ENV_VARS.WEB_SERVER_PORT,
|
|
73
|
+
APIFY_ENV_VARS.CONTAINER_PORT,
|
|
74
|
+
]),
|
|
75
|
+
containerUrl: field(z.string().default(LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.WEB_SERVER_URL]), [
|
|
76
|
+
ACTOR_ENV_VARS.WEB_SERVER_URL,
|
|
77
|
+
APIFY_ENV_VARS.CONTAINER_URL,
|
|
78
|
+
]),
|
|
79
|
+
proxyHostname: field(z.string().default(LOCAL_APIFY_ENV_VARS[APIFY_ENV_VARS.PROXY_HOSTNAME]), APIFY_ENV_VARS.PROXY_HOSTNAME),
|
|
80
|
+
proxyPassword: field(z.string().optional(), APIFY_ENV_VARS.PROXY_PASSWORD),
|
|
81
|
+
proxyPort: field(coerceNumber.default(+LOCAL_APIFY_ENV_VARS[APIFY_ENV_VARS.PROXY_PORT]), APIFY_ENV_VARS.PROXY_PORT),
|
|
82
|
+
proxyStatusUrl: field(z.string().default('http://proxy.apify.com'), APIFY_ENV_VARS.PROXY_STATUS_URL),
|
|
83
|
+
/** @deprecated use `containerPort` instead */
|
|
84
|
+
standbyPort: field(coerceNumber.default(+LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.STANDBY_PORT]), ACTOR_ENV_VARS.STANDBY_PORT),
|
|
85
|
+
standbyUrl: field(z.string().optional(), ACTOR_ENV_VARS.STANDBY_URL),
|
|
86
|
+
isAtHome: field(coerceBoolean.default(false), APIFY_ENV_VARS.IS_AT_HOME),
|
|
87
|
+
userId: field(z.string().optional(), APIFY_ENV_VARS.USER_ID),
|
|
88
|
+
userIsPaying: field(coerceBoolean.default(false), APIFY_ENV_VARS.USER_IS_PAYING),
|
|
89
|
+
actorPermissionLevel: field(z.string().optional(), ACTOR_ENV_VARS.PERMISSION_LEVEL),
|
|
90
|
+
inputSecretsPrivateKeyPassphrase: field(z.string().optional(), APIFY_ENV_VARS.INPUT_SECRETS_PRIVATE_KEY_PASSPHRASE),
|
|
91
|
+
inputSecretsPrivateKeyFile: field(z.string().optional(), APIFY_ENV_VARS.INPUT_SECRETS_PRIVATE_KEY_FILE),
|
|
92
|
+
// `0` is treated as "no limit" (mirrors the Apify platform contract).
|
|
93
|
+
maxTotalChargeUsd: field(coerceNumber.transform((val) => (val === 0 ? Infinity : val)).default(Infinity), ACTOR_ENV_VARS.MAX_TOTAL_CHARGE_USD),
|
|
94
|
+
metaOrigin: field(z.string().optional(), APIFY_ENV_VARS.META_ORIGIN),
|
|
95
|
+
testPayPerEvent: field(coerceBoolean.default(false), 'ACTOR_TEST_PAY_PER_EVENT'),
|
|
96
|
+
useChargingLogDataset: field(coerceBoolean.default(false), 'ACTOR_USE_CHARGING_LOG_DATASET'),
|
|
97
|
+
// Pay-per-event charging metadata injected by the platform (JSON strings).
|
|
98
|
+
actorPricingInfo: field(z.string().optional(), 'APIFY_ACTOR_PRICING_INFO'),
|
|
99
|
+
chargedEventCounts: field(z.string().optional(), 'APIFY_CHARGED_ACTOR_EVENT_COUNTS'),
|
|
100
|
+
actorStoragesJson: field(z.string().optional(), 'ACTOR_STORAGES_JSON'),
|
|
101
|
+
// Grab-bag of ApifyClient constructor options; the `storageDir` key is
|
|
102
|
+
// pulled out separately for local storage emulation, the rest is spread
|
|
103
|
+
// into `new ApifyClient({...})` in `Actor.newClient()`. No env var alias.
|
|
104
|
+
storageClientOptions: field(z.record(z.string(), z.unknown()).optional()),
|
|
105
|
+
};
|
|
6
106
|
/**
|
|
7
107
|
* `Configuration` is a value object holding the SDK configuration. We can use it in two ways:
|
|
8
108
|
*
|
|
9
|
-
* 1. When using `Actor` class, we can get the instance configuration via `sdk.
|
|
109
|
+
* 1. When using `Actor` class, we can get the instance configuration via `sdk.configuration`
|
|
10
110
|
*
|
|
11
111
|
* ```javascript
|
|
12
112
|
* import { Actor } from 'apify';
|
|
13
|
-
* import { BasicCrawler } from 'crawlee';
|
|
14
113
|
*
|
|
15
114
|
* const sdk = new Actor({ token: '123' });
|
|
16
|
-
* console.log(sdk.
|
|
17
|
-
*
|
|
18
|
-
* const crawler = new BasicCrawler({
|
|
19
|
-
* // ... crawler options
|
|
20
|
-
* }, sdk.config);
|
|
115
|
+
* console.log(sdk.configuration.token); // '123'
|
|
21
116
|
* ```
|
|
22
117
|
*
|
|
23
118
|
* 2. To get the global configuration (singleton instance). It will respect the environment variables.
|
|
24
119
|
*
|
|
25
120
|
* ```javascript
|
|
26
|
-
* import {
|
|
27
|
-
*
|
|
28
|
-
* // Get the global configuration
|
|
29
|
-
* const config = Configuration.getGlobalConfig();
|
|
30
|
-
* // Set the 'persistStateIntervalMillis' option
|
|
31
|
-
* // of global configuration to 30 seconds
|
|
32
|
-
* config.set('persistStateIntervalMillis', 30_000);
|
|
121
|
+
* import { Configuration } from 'apify';
|
|
33
122
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
123
|
+
* const config = Configuration.getGlobalConfiguration();
|
|
124
|
+
* console.log(config.headless);
|
|
125
|
+
* console.log(config.persistStateIntervalMillis);
|
|
37
126
|
* ```
|
|
38
127
|
*
|
|
128
|
+
* Configuration is immutable — values are set via the constructor and cannot be changed afterwards.
|
|
129
|
+
* The priority order for resolving values is (highest to lowest):
|
|
130
|
+
*
|
|
131
|
+
* ```text
|
|
132
|
+
* constructor options > environment variables > crawlee.json > schema defaults
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
39
135
|
* ## Supported Configuration Options
|
|
40
136
|
*
|
|
41
137
|
* Key | Environment Variable | Default Value
|
|
42
138
|
* ---|---|---
|
|
43
139
|
* `memoryMbytes` | `ACTOR_MEMORY_MBYTES` | -
|
|
44
|
-
* `headless` | `APIFY_HEADLESS` |
|
|
140
|
+
* `headless` | `APIFY_HEADLESS` | `true`
|
|
45
141
|
* `persistStateIntervalMillis` | `APIFY_PERSIST_STATE_INTERVAL_MILLIS` | `60e3`
|
|
46
142
|
* `token` | `APIFY_TOKEN` | -
|
|
47
143
|
* `isAtHome` | `APIFY_IS_AT_HOME` | -
|
|
@@ -55,7 +151,6 @@ const consts_1 = require("@apify/consts");
|
|
|
55
151
|
* ---|---|---
|
|
56
152
|
* `actorEventsWsUrl` | `ACTOR_EVENTS_WEBSOCKET_URL` | -
|
|
57
153
|
* `actorId` | `ACTOR_ID` | -
|
|
58
|
-
* `actorPermissionLevel` | `ACTOR_PERMISSION_LEVEL` | -
|
|
59
154
|
* `actorRunId` | `ACTOR_RUN_ID` | -
|
|
60
155
|
* `actorTaskId` | `ACTOR_TASK_ID` | -
|
|
61
156
|
* `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
|
|
@@ -69,166 +164,35 @@ const consts_1 = require("@apify/consts");
|
|
|
69
164
|
* `proxyPort` | `APIFY_PROXY_PORT` | `8000`
|
|
70
165
|
* `proxyStatusUrl` | `APIFY_PROXY_STATUS_URL` | `'http://proxy.apify.com'`
|
|
71
166
|
* `userId` | `APIFY_USER_ID` | -
|
|
72
|
-
* `userIsPaying` | `APIFY_USER_IS_PAYING` |
|
|
167
|
+
* `userIsPaying` | `APIFY_USER_IS_PAYING` | `false`
|
|
73
168
|
* `xvfb` | `APIFY_XVFB` | -
|
|
74
169
|
* `standbyPort` | `ACTOR_STANDBY_PORT` | `4321`
|
|
75
170
|
* `standbyUrl` | `ACTOR_STANDBY_URL` | -
|
|
76
171
|
* `chromeExecutablePath` | `APIFY_CHROME_EXECUTABLE_PATH` | -
|
|
77
172
|
* `defaultBrowserPath` | `APIFY_DEFAULT_BROWSER_PATH` | -
|
|
78
173
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
175
|
+
export class Configuration extends CoreConfiguration {
|
|
176
|
+
/** @internal */
|
|
177
|
+
static globalConfig;
|
|
178
|
+
static fields = apifyConfigFields;
|
|
179
|
+
constructor(options = {}) {
|
|
180
|
+
// `super` types its options against crawlee's field set; ours is a
|
|
181
|
+
// superset (apifyConfigFields spreads crawleeConfigFields), so the
|
|
182
|
+
// shapes are runtime-compatible but not TS-assignable — hence the cast.
|
|
183
|
+
super(options);
|
|
85
184
|
}
|
|
86
185
|
/**
|
|
87
186
|
* @inheritDoc
|
|
187
|
+
*
|
|
188
|
+
* Returns the SDK's global {@link Configuration} singleton (an
|
|
189
|
+
* Apify-typed default that parses `APIFY_*` env vars). During an Actor run
|
|
190
|
+
* the active configuration is held by crawlee's `serviceLocator`, which is
|
|
191
|
+
* what crawlee internals resolve against; this singleton is only the
|
|
192
|
+
* fallback for code reaching for a configuration without an explicit one.
|
|
88
193
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* @inheritDoc
|
|
94
|
-
*/
|
|
95
|
-
static getGlobalConfig() {
|
|
96
|
-
if (Configuration.storage.getStore()) {
|
|
97
|
-
return Configuration.storage.getStore();
|
|
98
|
-
}
|
|
99
|
-
Configuration.globalConfig ?? (Configuration.globalConfig = new Configuration());
|
|
194
|
+
static getGlobalConfiguration() {
|
|
195
|
+
Configuration.globalConfig ??= new Configuration();
|
|
100
196
|
return Configuration.globalConfig;
|
|
101
197
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Resets global configuration instance. The default instance holds configuration based on env vars,
|
|
104
|
-
* if we want to change them, we need to first reset the global state. Used mainly for testing purposes.
|
|
105
|
-
*/
|
|
106
|
-
static resetGlobalState() {
|
|
107
|
-
delete this.globalConfig;
|
|
108
|
-
}
|
|
109
198
|
}
|
|
110
|
-
exports.Configuration = Configuration;
|
|
111
|
-
// maps environment variables to config keys (e.g. `APIFY_MEMORY_MBYTES` to `memoryMbytes`)
|
|
112
|
-
Object.defineProperty(Configuration, "ENV_MAP", {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
configurable: true,
|
|
115
|
-
writable: true,
|
|
116
|
-
value: {
|
|
117
|
-
// regular crawlee env vars are also supported
|
|
118
|
-
...core_1.Configuration.ENV_MAP,
|
|
119
|
-
// support crawlee env vars prefixed with `APIFY_` too
|
|
120
|
-
APIFY_AVAILABLE_MEMORY_RATIO: 'availableMemoryRatio',
|
|
121
|
-
APIFY_PURGE_ON_START: 'purgeOnStart',
|
|
122
|
-
APIFY_MEMORY_MBYTES: 'memoryMbytes',
|
|
123
|
-
APIFY_DEFAULT_DATASET_ID: 'defaultDatasetId',
|
|
124
|
-
APIFY_DEFAULT_KEY_VALUE_STORE_ID: 'defaultKeyValueStoreId',
|
|
125
|
-
APIFY_DEFAULT_REQUEST_QUEUE_ID: 'defaultRequestQueueId',
|
|
126
|
-
APIFY_INPUT_KEY: 'inputKey',
|
|
127
|
-
APIFY_PERSIST_STATE_INTERVAL_MILLIS: 'persistStateIntervalMillis',
|
|
128
|
-
APIFY_HEADLESS: 'headless',
|
|
129
|
-
APIFY_XVFB: 'xvfb',
|
|
130
|
-
APIFY_CHROME_EXECUTABLE_PATH: 'chromeExecutablePath',
|
|
131
|
-
APIFY_DEFAULT_BROWSER_PATH: 'defaultBrowserPath',
|
|
132
|
-
APIFY_DISABLE_BROWSER_SANDBOX: 'disableBrowserSandbox',
|
|
133
|
-
// as well as apify specific ones
|
|
134
|
-
APIFY_TOKEN: 'token',
|
|
135
|
-
APIFY_METAMORPH_AFTER_SLEEP_MILLIS: 'metamorphAfterSleepMillis',
|
|
136
|
-
APIFY_TEST_PERSIST_INTERVAL_MILLIS: 'persistStateIntervalMillis', // for BC, seems to be unused
|
|
137
|
-
APIFY_ACTOR_EVENTS_WS_URL: 'actorEventsWsUrl',
|
|
138
|
-
APIFY_ACTOR_ID: 'actorId',
|
|
139
|
-
APIFY_API_BASE_URL: 'apiBaseUrl',
|
|
140
|
-
APIFY_API_PUBLIC_BASE_URL: 'apiPublicBaseUrl',
|
|
141
|
-
APIFY_IS_AT_HOME: 'isAtHome',
|
|
142
|
-
APIFY_ACTOR_RUN_ID: 'actorRunId',
|
|
143
|
-
APIFY_ACTOR_TASK_ID: 'actorTaskId',
|
|
144
|
-
APIFY_CONTAINER_PORT: 'containerPort',
|
|
145
|
-
APIFY_CONTAINER_URL: 'containerUrl',
|
|
146
|
-
APIFY_USER_ID: 'userId',
|
|
147
|
-
APIFY_USER_IS_PAYING: 'userIsPaying',
|
|
148
|
-
APIFY_PROXY_HOSTNAME: 'proxyHostname',
|
|
149
|
-
APIFY_PROXY_PASSWORD: 'proxyPassword',
|
|
150
|
-
APIFY_PROXY_STATUS_URL: 'proxyStatusUrl',
|
|
151
|
-
APIFY_PROXY_PORT: 'proxyPort',
|
|
152
|
-
APIFY_INPUT_SECRETS_PRIVATE_KEY_FILE: 'inputSecretsPrivateKeyFile',
|
|
153
|
-
APIFY_INPUT_SECRETS_PRIVATE_KEY_PASSPHRASE: 'inputSecretsPrivateKeyPassphrase',
|
|
154
|
-
APIFY_META_ORIGIN: 'metaOrigin',
|
|
155
|
-
// Actor env vars
|
|
156
|
-
ACTOR_DEFAULT_DATASET_ID: 'defaultDatasetId',
|
|
157
|
-
ACTOR_DEFAULT_KEY_VALUE_STORE_ID: 'defaultKeyValueStoreId',
|
|
158
|
-
ACTOR_DEFAULT_REQUEST_QUEUE_ID: 'defaultRequestQueueId',
|
|
159
|
-
ACTOR_EVENTS_WEBSOCKET_URL: 'actorEventsWsUrl',
|
|
160
|
-
ACTOR_ID: 'actorId',
|
|
161
|
-
ACTOR_INPUT_KEY: 'inputKey',
|
|
162
|
-
ACTOR_MEMORY_MBYTES: 'memoryMbytes',
|
|
163
|
-
ACTOR_PERMISSION_LEVEL: 'actorPermissionLevel',
|
|
164
|
-
ACTOR_RUN_ID: 'actorRunId',
|
|
165
|
-
ACTOR_STANDBY_PORT: 'standbyPort',
|
|
166
|
-
ACTOR_STANDBY_URL: 'standbyUrl',
|
|
167
|
-
ACTOR_TASK_ID: 'actorTaskId',
|
|
168
|
-
ACTOR_WEB_SERVER_PORT: 'containerPort',
|
|
169
|
-
ACTOR_WEB_SERVER_URL: 'containerUrl',
|
|
170
|
-
ACTOR_MAX_TOTAL_CHARGE_USD: 'maxTotalChargeUsd',
|
|
171
|
-
ACTOR_TEST_PAY_PER_EVENT: 'testPayPerEvent',
|
|
172
|
-
ACTOR_USE_CHARGING_LOG_DATASET: 'useChargingLogDataset',
|
|
173
|
-
APIFY_ACTOR_PRICING_INFO: 'actorPricingInfo',
|
|
174
|
-
APIFY_CHARGED_ACTOR_EVENT_COUNTS: 'chargedEventCounts',
|
|
175
|
-
ACTOR_STORAGES_JSON: 'actorStoragesJson',
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
Object.defineProperty(Configuration, "INTEGER_VARS", {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
configurable: true,
|
|
181
|
-
writable: true,
|
|
182
|
-
value: [
|
|
183
|
-
...core_1.Configuration.INTEGER_VARS,
|
|
184
|
-
'proxyPort',
|
|
185
|
-
'containerPort',
|
|
186
|
-
'metamorphAfterSleepMillis',
|
|
187
|
-
'maxTotalChargeUsd',
|
|
188
|
-
]
|
|
189
|
-
});
|
|
190
|
-
Object.defineProperty(Configuration, "BOOLEAN_VARS", {
|
|
191
|
-
enumerable: true,
|
|
192
|
-
configurable: true,
|
|
193
|
-
writable: true,
|
|
194
|
-
value: [
|
|
195
|
-
...core_1.Configuration.BOOLEAN_VARS,
|
|
196
|
-
'isAtHome',
|
|
197
|
-
'testPayPerEvent',
|
|
198
|
-
'useChargingLogDataset',
|
|
199
|
-
]
|
|
200
|
-
});
|
|
201
|
-
Object.defineProperty(Configuration, "DEFAULTS", {
|
|
202
|
-
enumerable: true,
|
|
203
|
-
configurable: true,
|
|
204
|
-
writable: true,
|
|
205
|
-
value: {
|
|
206
|
-
...core_1.Configuration.DEFAULTS,
|
|
207
|
-
defaultKeyValueStoreId: consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.DEFAULT_KEY_VALUE_STORE_ID],
|
|
208
|
-
defaultDatasetId: consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.DEFAULT_DATASET_ID],
|
|
209
|
-
defaultRequestQueueId: consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID],
|
|
210
|
-
inputKey: 'INPUT',
|
|
211
|
-
apiBaseUrl: 'https://api.apify.com/',
|
|
212
|
-
apiPublicBaseUrl: 'https://api.apify.com',
|
|
213
|
-
proxyStatusUrl: 'http://proxy.apify.com',
|
|
214
|
-
proxyHostname: consts_1.LOCAL_APIFY_ENV_VARS[consts_1.APIFY_ENV_VARS.PROXY_HOSTNAME],
|
|
215
|
-
proxyPort: +consts_1.LOCAL_APIFY_ENV_VARS[consts_1.APIFY_ENV_VARS.PROXY_PORT],
|
|
216
|
-
containerPort: +consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.WEB_SERVER_PORT],
|
|
217
|
-
containerUrl: consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.WEB_SERVER_URL],
|
|
218
|
-
standbyPort: +consts_1.LOCAL_ACTOR_ENV_VARS[consts_1.ACTOR_ENV_VARS.STANDBY_PORT],
|
|
219
|
-
metamorphAfterSleepMillis: 300e3,
|
|
220
|
-
persistStateIntervalMillis: 60e3, // This value is mentioned in jsdoc in `events.js`, if you update it here, update it there too.
|
|
221
|
-
testPayPerEvent: false,
|
|
222
|
-
useChargingLogDataset: false,
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
// monkey patch the core class so it respects the new options too
|
|
226
|
-
core_1.Configuration.getGlobalConfig = Configuration.getGlobalConfig;
|
|
227
|
-
// @ts-expect-error protected property
|
|
228
|
-
core_1.Configuration.ENV_MAP = Configuration.ENV_MAP;
|
|
229
|
-
// @ts-expect-error protected property
|
|
230
|
-
core_1.Configuration.INTEGER_VARS = Configuration.INTEGER_VARS;
|
|
231
|
-
// @ts-expect-error protected property
|
|
232
|
-
core_1.Configuration.BOOLEAN_VARS = Configuration.BOOLEAN_VARS;
|
|
233
|
-
// @ts-expect-error protected property
|
|
234
|
-
core_1.Configuration.DEFAULTS = Configuration.DEFAULTS;
|