apify 4.0.0-rc.1 → 4.0.0-rc.2

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/dist/actor.d.ts CHANGED
@@ -3,7 +3,6 @@ import { Dataset, KeyValueStore, RequestQueue } from '@crawlee/core';
3
3
  import type { Awaitable, Dictionary, StorageBackend } from '@crawlee/types';
4
4
  import type { ActorCallOptions, ActorInput, ActorStartOptions, ApifyClientOptions, RunAbortOptions, RunClient, RunResurrectOptions, TaskCallOptions, TaskStartOptions, WebhookResource, WebhookEventType } from 'apify-client';
5
5
  import { ApifyClient, Run as ClientActorRun } from 'apify-client';
6
- import { type ACTOR_PERMISSION_LEVEL } from '@apify/consts';
7
6
  import type { RequestQueueAccessMode } from './apify_request_queue_backend.js';
8
7
  import type { ChargeOptions, ChargeResult } from './charging.js';
9
8
  import { ChargingManager } from './charging.js';
@@ -84,119 +83,6 @@ export interface SetStatusMessageOptions {
84
83
  /** Log level used when the status message is also logged locally. Defaults to `INFO`. */
85
84
  level?: 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR';
86
85
  }
87
- /**
88
- * Parsed representation of the Apify environment variables.
89
- * This object is returned by the {@link Actor.getEnv} function.
90
- */
91
- export interface ApifyEnv {
92
- /**
93
- * ID of the Actor (ACTOR_ID)
94
- */
95
- actorId: string | null;
96
- /**
97
- * ID of the Actor run (ACTOR_RUN_ID)
98
- */
99
- actorRunId: string | null;
100
- /**
101
- * ID of the Actor task (ACTOR_TASK_ID)
102
- */
103
- actorTaskId: string | null;
104
- /**
105
- * ID of the Actor build used in the run. (ACTOR_BUILD_ID)
106
- */
107
- actorBuildId: string | null;
108
- /**
109
- * [Permission level](https://docs.apify.com/platform/actors/development/permissions) the Actor is run under. (ACTOR_PERMISSION_LEVEL)
110
- */
111
- actorPermissionLevel: ACTOR_PERMISSION_LEVEL | null;
112
- /**
113
- * ID of the user who started the Actor - note that it might be
114
- * different than the owner of the Actor (APIFY_USER_ID)
115
- */
116
- userId: string | null;
117
- /**
118
- * Whether the user who started the Actor is a paying user. `false` when not set. (APIFY_USER_IS_PAYING)
119
- */
120
- userIsPaying: boolean;
121
- /**
122
- * Authentication token representing privileges given to the Actor run,
123
- * it can be passed to various Apify APIs (APIFY_TOKEN)
124
- */
125
- token: string | null;
126
- /**
127
- * Date when the Actor was started (ACTOR_STARTED_AT)
128
- */
129
- startedAt: Date | null;
130
- /**
131
- * Date when the Actor will time out (ACTOR_TIMEOUT_AT)
132
- */
133
- timeoutAt: Date | null;
134
- /**
135
- * ID of the key-value store where input and output data of this
136
- * Actor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)
137
- */
138
- defaultKeyValueStoreId: string | null;
139
- /**
140
- * ID of the dataset where input and output data of this
141
- * Actor is stored (ACTOR_DEFAULT_DATASET_ID)
142
- */
143
- defaultDatasetId: string | null;
144
- /**
145
- * Amount of memory allocated for the Actor,
146
- * in megabytes (ACTOR_MEMORY_MBYTES)
147
- */
148
- memoryMbytes: number | null;
149
- /**
150
- * If set to "1", the web browsers inside the Actor should run in headless
151
- * mode because there is no windowing system available. (APIFY_HEADLESS)
152
- */
153
- headless: string | null;
154
- /**
155
- * Is set to "1" if the Actor is running on Apify servers.
156
- * (APIFY_IS_AT_HOME)
157
- */
158
- isAtHome: string | null;
159
- /**
160
- * The Apify Proxy password of the user who started the Actor. (APIFY_PROXY_PASSWORD)
161
- */
162
- proxyPassword: string | null;
163
- proxyHostname: string | null;
164
- proxyPort: string | null;
165
- /**
166
- * You can visit this page to troubleshoot your proxy connection. (APIFY_PROXY_STATUS_URL)
167
- */
168
- proxyStatusUrl: string | null;
169
- apiBaseUrl: string | null;
170
- apiPublicBaseUrl: string | null;
171
- chromeExecutablePath: string | null;
172
- dedicatedCpus: string | null;
173
- fact: string | null;
174
- inputSecretsPrivateKeyFile: string | null;
175
- inputSecretsPrivateKeyPassphrase: string | null;
176
- /**
177
- * Specifies the minimum log level, which can be one of the following values (in order of severity): DEBUG, INFO, WARNING and ERROR
178
- * (APIFY_LOG_LEVEL)
179
- */
180
- logLevel: string | null;
181
- logFormat: string | null;
182
- /**
183
- * Origin for the Actor run, i.e. how it was started. See [here](https://docs.apify.com/platform/actors/running/runs-and-builds#origin)
184
- * for more details. (APIFY_META_ORIGIN)
185
- */
186
- metaOrigin: string | null;
187
- /**
188
- * The key of the input record in the Actor’s default key-value store (ACTOR_INPUT_KEY)
189
- */
190
- inputKey: string | null;
191
- systemInfoIntervalMillis: string | null;
192
- workflowKey: string | null;
193
- actorBuildNumber: string | null;
194
- actorEventsWsUrl: string | null;
195
- actorMaxPaidDatasetItems: number | null;
196
- containerPort: number | null;
197
- containerUrl: string | null;
198
- defaultRequestQueueId: string | null;
199
- }
200
86
  export type UserFunc<T = unknown> = () => Awaitable<T>;
201
87
  export interface Token {
202
88
  /**
@@ -272,8 +158,7 @@ export interface WebhookOptions {
272
158
  /**
273
159
  * Idempotency key enables you to ensure that a webhook will not be added multiple times in case of
274
160
  * an Actor restart or other situation that would cause the `addWebhook()` function to be called again.
275
- * We suggest using the Actor run ID as the idempotency key. You can get the run ID by calling
276
- * {@link Actor.getEnv} function.
161
+ * We suggest using the Actor run ID as the idempotency key, available as `Actor.configuration.actorRunId`.
277
162
  */
278
163
  idempotencyKey?: string;
279
164
  /**
@@ -571,7 +456,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
571
456
  *
572
457
  * A run started with a custom `token` uses that token, except for a run started before a migration or
573
458
  * resurrection, which uses the default client. The tracked runs, including the earlier runs replaced
574
- * under the same name, are stored in the default key-value store under the `__ACTOR_CHILD_RUNS` key.
459
+ * under the same name, are stored in the default key-value store under the `APIFY_ACTOR_CHILD_RUNS` key.
575
460
  */
576
461
  get childRuns(): Record<string, RunClient>;
577
462
  /**
@@ -937,19 +822,6 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
937
822
  * Resolves to `undefined` when not running on the Apify platform.
938
823
  */
939
824
  getCurrentRun(): Promise<ClientActorRun | undefined>;
940
- /**
941
- * Modifies Actor env vars so parsing respects the structure of {@link ApifyEnv} interface.
942
- */
943
- private getModifiedActorEnvVars;
944
- /**
945
- * Returns a new {@link ApifyEnv} object which contains information parsed from all the Apify environment variables.
946
- *
947
- * For the list of the Apify environment variables, see
948
- * [Actor documentation](https://docs.apify.com/platform/actors/development/programming-interface/environment-variables).
949
- * If some variables are not defined or are invalid, the corresponding value in the resulting object will be null.
950
- * @ignore
951
- */
952
- getEnv(): ApifyEnv;
953
825
  /**
954
826
  * Returns a new instance of the Apify API client. The `ApifyClient` class is provided
955
827
  * by the [apify-client](https://www.npmjs.com/package/apify-client)
@@ -969,7 +841,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
969
841
  *
970
842
  * Values can be modified by simply using the assignment operator.
971
843
  *
972
- * @param name The name of the store to use.
844
+ * @param name The key of the record that holds the state. Defaults to `APIFY_GLOBAL_STATE`.
973
845
  * @param defaultValue If the store does not yet have a value in it, the value will be initialized with the `defaultValue` you provide.
974
846
  * @param options An optional object parameter where a custom `keyValueStoreName` and `config` can be passed in.
975
847
  */
@@ -979,7 +851,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
979
851
  *
980
852
  * Values can be modified by simply using the assignment operator.
981
853
  *
982
- * @param name The name of the store to use.
854
+ * @param name The key of the record that holds the state. Defaults to `APIFY_GLOBAL_STATE`.
983
855
  * @param defaultValue If the store does not yet have a value in it, the value will be initialized with the `defaultValue` you provide.
984
856
  * @param options An optional object parameter where a custom `keyValueStoreName` and `config` can be passed in.
985
857
  */
@@ -1190,7 +1062,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1190
1062
  *
1191
1063
  * A run started with a custom `token` uses that token, except for a run started before a migration or
1192
1064
  * resurrection, which uses the default client. The tracked runs, including the earlier runs replaced
1193
- * under the same name, are stored in the default key-value store under the `__ACTOR_CHILD_RUNS` key.
1065
+ * under the same name, are stored in the default key-value store under the `APIFY_ACTOR_CHILD_RUNS` key.
1194
1066
  */
1195
1067
  static get childRuns(): Record<string, RunClient>;
1196
1068
  /**
@@ -1570,14 +1442,6 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1570
1442
  * Retrieve the charging manager to access granular pricing information.
1571
1443
  */
1572
1444
  static getChargingManager(): ChargingManager;
1573
- /**
1574
- * Returns a new {@link ApifyEnv} object which contains information parsed from all the Apify environment variables.
1575
- *
1576
- * For the list of the Apify environment variables, see
1577
- * [Actor documentation](https://docs.apify.com/platform/actors/development/programming-interface/environment-variables).
1578
- * If some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null.
1579
- */
1580
- static getEnv(): ApifyEnv;
1581
1445
  /**
1582
1446
  * Returns a new instance of the Apify API client. The `ApifyClient` class is provided
1583
1447
  * by the [apify-client](https://www.npmjs.com/package/apify-client)
package/dist/actor.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import { createPrivateKey } from 'node:crypto';
2
2
  import { readFile, stat } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
- import { coerceBoolean, Dataset, EventType, KeyValueStore, MemoryStorageBackend, purgeDefaultStorages, rejectOperationInTransaction, RequestQueue, serviceLocator, } from '@crawlee/core';
4
+ import { Dataset, EventType, KeyValueStore, MemoryStorageBackend, purgeDefaultStorages, rejectOperationInTransaction, RequestQueue, serviceLocator, } from '@crawlee/core';
5
5
  import { sleep } from '@crawlee/utils';
6
6
  import { ApifyClient } from 'apify-client';
7
7
  import { z } from 'zod';
8
- import { ACTOR_ENV_VARS, ACTOR_EVENT_NAMES, APIFY_ENV_VARS, INTEGER_ENV_VARS, META_ORIGINS, } from '@apify/consts';
8
+ import { ACTOR_ENV_VARS, ACTOR_EVENT_NAMES, APIFY_ENV_VARS, META_ORIGINS } from '@apify/consts';
9
9
  import { decryptInputSecrets } from '@apify/input_secrets';
10
10
  import log from '@apify/log';
11
11
  import { addTimeoutToPromise } from '@apify/timeout';
12
- import { timeoutPromise } from '@apify/utilities';
13
12
  import { parseArgument } from '@apify/validations';
14
13
  import { ApifyFileSystemStorageBackend } from './apify_file_system_storage_backend.js';
15
14
  import { ApifyStorageBackend } from './apify_storage_backend.js';
@@ -23,15 +22,7 @@ import { getDefaultsFromInputSchema, noActorInputSchemaDefinedMarker, readInputS
23
22
  import { PlatformEventManager } from './platform_event_manager.js';
24
23
  import { ProxyConfiguration } from './proxy_configuration.js';
25
24
  import { SmartApifyStorageBackend } from './smart_apify_storage_backend.js';
26
- import { BINARY_CONTENT_TYPE, checkCrawleeVersion, getSystemInfo, isNonEmptyObject, JSON_CONTENT_TYPE, parseInputValue, snakeCaseToCamelCase, } from './utils.js';
27
- // `@apify/consts` has no boolean counterpart to `INTEGER_ENV_VARS`.
28
- const BOOLEAN_ENV_VARS = [APIFY_ENV_VARS.USER_IS_PAYING];
29
- // Still listed in `@apify/consts`, but not read by the SDK.
30
- const IGNORED_ENV_VARS = [
31
- APIFY_ENV_VARS.DISABLE_OUTDATED_WARNING,
32
- APIFY_ENV_VARS.SDK_LATEST_VERSION,
33
- APIFY_ENV_VARS.LOCAL_STORAGE_DIR,
34
- ];
25
+ import { BINARY_CONTENT_TYPE, checkCrawleeVersion, getSystemInfo, isNonEmptyObject, JSON_CONTENT_TYPE, parseInputValue, } from './utils.js';
35
26
  /**
36
27
  * {@link parseInputValue} with the parser error wrapped as an {@link ActorInputError}, so a malformed
37
28
  * JSON input reports where it came from.
@@ -605,7 +596,7 @@ export class Actor {
605
596
  *
606
597
  * A run started with a custom `token` uses that token, except for a run started before a migration or
607
598
  * resurrection, which uses the default client. The tracked runs, including the earlier runs replaced
608
- * under the same name, are stored in the default key-value store under the `__ACTOR_CHILD_RUNS` key.
599
+ * under the same name, are stored in the default key-value store under the `APIFY_ACTOR_CHILD_RUNS` key.
609
600
  */
610
601
  get childRuns() {
611
602
  this.ensureActorInit('childRuns');
@@ -701,13 +692,14 @@ export class Actor {
701
692
  }
702
693
  });
703
694
  // Waiting for all the listeners to finish, as `.reboot()` kills the container.
704
- // Not using `addTimeoutToPromise`, its timeout would also cancel the enclosing one (e.g. a request handler).
705
- await timeoutPromise(Promise.all([
706
- // `persistState` for individual RequestLists, RequestQueue... instances to be persisted
707
- ...callListeners(EventType.PERSIST_STATE, { isMigrating: true }),
708
- // `migrating` to pause Apify crawlers
709
- ...callListeners(EventType.MIGRATING, {}),
710
- ]), timeoutSecs * 1000, `Pre-reboot event listeners did not finish within ${timeoutSecs} seconds, proceeding with the reboot`).catch((err) => log.warning(err.message));
695
+ await addTimeoutToPromise(async () => {
696
+ await Promise.all([
697
+ // `persistState` for individual RequestLists, RequestQueue... instances to be persisted
698
+ ...callListeners(EventType.PERSIST_STATE, { isMigrating: true }),
699
+ // `migrating` to pause Apify crawlers
700
+ ...callListeners(EventType.MIGRATING, {}),
701
+ ]);
702
+ }, timeoutSecs * 1000, `Pre-reboot event listeners did not finish within ${timeoutSecs} seconds, proceeding with the reboot`).catch((err) => log.warning(err.message));
711
703
  const runId = this.configuration.actorRunId;
712
704
  try {
713
705
  await this.apifyClient.run(runId).reboot();
@@ -1242,57 +1234,6 @@ export class Actor {
1242
1234
  });
1243
1235
  return this.#actorPromise;
1244
1236
  }
1245
- /**
1246
- * Modifies Actor env vars so parsing respects the structure of {@link ApifyEnv} interface.
1247
- */
1248
- getModifiedActorEnvVars() {
1249
- const modifiedActorEnvVars = {};
1250
- Object.entries(ACTOR_ENV_VARS).forEach(([k, v]) => {
1251
- // Prepend `ACTOR_` to env vars so ApifyEnv structure is preserved
1252
- if (['ID', 'RUN_ID', 'TASK_ID'].includes(k)) {
1253
- modifiedActorEnvVars[`ACTOR_${k}`] = v;
1254
- }
1255
- else {
1256
- modifiedActorEnvVars[k] = v;
1257
- }
1258
- });
1259
- return modifiedActorEnvVars;
1260
- }
1261
- /**
1262
- * Returns a new {@link ApifyEnv} object which contains information parsed from all the Apify environment variables.
1263
- *
1264
- * For the list of the Apify environment variables, see
1265
- * [Actor documentation](https://docs.apify.com/platform/actors/development/programming-interface/environment-variables).
1266
- * If some variables are not defined or are invalid, the corresponding value in the resulting object will be null.
1267
- * @ignore
1268
- */
1269
- getEnv() {
1270
- // NOTE: Don't throw if env vars are invalid to simplify local development and debugging of Actors
1271
- const env = process.env || {};
1272
- const envVars = {};
1273
- for (const [shortName, fullName] of Object.entries({
1274
- ...APIFY_ENV_VARS,
1275
- ...this.getModifiedActorEnvVars(),
1276
- })) {
1277
- if (IGNORED_ENV_VARS.includes(fullName))
1278
- continue;
1279
- const camelCaseName = snakeCaseToCamelCase(shortName);
1280
- let value = env[fullName];
1281
- // Parse booleans, dates and integers.
1282
- if (BOOLEAN_ENV_VARS.includes(fullName)) {
1283
- value = !!value && coerceBoolean.parse(value);
1284
- }
1285
- else if (value && fullName.endsWith('_AT')) {
1286
- const unix = Date.parse(value);
1287
- value = unix > 0 ? new Date(unix) : undefined;
1288
- }
1289
- else if (INTEGER_ENV_VARS.includes(fullName)) {
1290
- value = parseInt(value, 10);
1291
- }
1292
- Reflect.set(envVars, camelCaseName, value || value === 0 || value === false ? value : null);
1293
- }
1294
- return envVars;
1295
- }
1296
1237
  /**
1297
1238
  * Returns a new instance of the Apify API client. The `ApifyClient` class is provided
1298
1239
  * by the [apify-client](https://www.npmjs.com/package/apify-client)
@@ -1325,7 +1266,7 @@ export class Actor {
1325
1266
  *
1326
1267
  * Values can be modified by simply using the assignment operator.
1327
1268
  *
1328
- * @param name The name of the store to use.
1269
+ * @param name The key of the record that holds the state. Defaults to `APIFY_GLOBAL_STATE`.
1329
1270
  * @param defaultValue If the store does not yet have a value in it, the value will be initialized with the `defaultValue` you provide.
1330
1271
  * @param options An optional object parameter where a custom `keyValueStoreName` and `config` can be passed in.
1331
1272
  */
@@ -1341,7 +1282,7 @@ export class Actor {
1341
1282
  *
1342
1283
  * Values can be modified by simply using the assignment operator.
1343
1284
  *
1344
- * @param name The name of the store to use.
1285
+ * @param name The key of the record that holds the state. Defaults to `APIFY_GLOBAL_STATE`.
1345
1286
  * @param defaultValue If the store does not yet have a value in it, the value will be initialized with the `defaultValue` you provide.
1346
1287
  * @param options An optional object parameter where a custom `keyValueStoreName` and `config` can be passed in.
1347
1288
  */
@@ -1574,7 +1515,7 @@ export class Actor {
1574
1515
  *
1575
1516
  * A run started with a custom `token` uses that token, except for a run started before a migration or
1576
1517
  * resurrection, which uses the default client. The tracked runs, including the earlier runs replaced
1577
- * under the same name, are stored in the default key-value store under the `__ACTOR_CHILD_RUNS` key.
1518
+ * under the same name, are stored in the default key-value store under the `APIFY_ACTOR_CHILD_RUNS` key.
1578
1519
  */
1579
1520
  static get childRuns() {
1580
1521
  return Actor.getDefaultInstance().childRuns;
@@ -1906,16 +1847,6 @@ export class Actor {
1906
1847
  static getChargingManager() {
1907
1848
  return Actor.getDefaultInstance().getChargingManager();
1908
1849
  }
1909
- /**
1910
- * Returns a new {@link ApifyEnv} object which contains information parsed from all the Apify environment variables.
1911
- *
1912
- * For the list of the Apify environment variables, see
1913
- * [Actor documentation](https://docs.apify.com/platform/actors/development/programming-interface/environment-variables).
1914
- * If some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null.
1915
- */
1916
- static getEnv() {
1917
- return Actor.getDefaultInstance().getEnv();
1918
- }
1919
1850
  /**
1920
1851
  * Returns a new instance of the Apify API client. The `ApifyClient` class is provided
1921
1852
  * by the [apify-client](https://www.npmjs.com/package/apify-client)
@@ -2043,10 +1974,10 @@ export class Actor {
2043
1974
  * Returns `undefined` if not on the Apify platform or the current run was started without a timeout.
2044
1975
  */
2045
1976
  getRemainingTimeSecs() {
2046
- const env = this.getEnv();
1977
+ const { timeoutAt } = this.configuration;
2047
1978
  const MINIMUM_API_TIMEOUT_SECS = 1;
2048
- if (this.isAtHome() && env.timeoutAt !== null) {
2049
- return Math.max(Math.ceil((env.timeoutAt.getTime() - Date.now()) / 1000), MINIMUM_API_TIMEOUT_SECS);
1979
+ if (this.isAtHome() && timeoutAt !== undefined) {
1980
+ return Math.max(Math.ceil((timeoutAt.getTime() - Date.now()) / 1000), MINIMUM_API_TIMEOUT_SECS);
2050
1981
  }
2051
1982
  log.warning('Using `inherit` argument is only possible when the Actor is running on the Apify platform and when the ' +
2052
1983
  'timeout for the Actor run is set.');
@@ -28,6 +28,7 @@ export class ApifyKeyValueStoreBackend {
28
28
  async getValue(key) {
29
29
  // Storage backends are byte transports — the KeyValueStore frontend parses values
30
30
  // according to their content type, so the record must be returned unparsed.
31
+ // The client may type the bytes as a `Uint8Array`; in Node.js they are always a `Buffer`.
31
32
  return this.#client.getRecord(key, { buffer: true });
32
33
  }
33
34
  async setValue(record) {
@@ -9,7 +9,7 @@ import { ApifyRequestQueueSingleBackend } from './apify_request_queue_single_bac
9
9
  /** The reserved alias crawlee uses for the default (unnamed) storage. */
10
10
  export const DEFAULT_STORAGE_ALIAS = '__default__';
11
11
  /** The key of the default key-value store record holding this run's alias -> storage id mapping. */
12
- const ALIAS_MAPPING_RECORD_KEY = '__STORAGE_ALIASES_MAPPING';
12
+ const ALIAS_MAPPING_RECORD_KEY = 'APIFY_STORAGE_ALIASES_MAPPING';
13
13
  async function readAliasMapping(store) {
14
14
  const record = await store.getRecord(ALIAS_MAPPING_RECORD_KEY);
15
15
  return record?.value ?? {};
@@ -77,7 +77,6 @@ export declare class ChargingManager {
77
77
  * Initialize the ChargingManager by loading pricing information and charging state via Apify API.
78
78
  */
79
79
  init(): Promise<void>;
80
- private ensureChargingLogDatasetOnPlatform;
81
80
  /**
82
81
  * Whether {@link ChargingManager.init} has run. All charging operations (including
83
82
  * {@link ChargingManager.getPricingInfo}) require an initialized manager.
package/dist/charging.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Dataset, KeyValueStore } from '@crawlee/core';
1
+ import { Dataset, withDirectStorageAccess } from '@crawlee/core';
2
2
  import { META_ORIGINS } from '@apify/consts';
3
3
  import log from '@apify/log';
4
4
  import { ReentrantAsyncLock } from './utils.js';
@@ -22,8 +22,7 @@ function getEffectivePricingInfo(pricingInfos, now = new Date()) {
22
22
  * Handles pay-per-event charging.
23
23
  */
24
24
  export class ChargingManager {
25
- #LOCAL_CHARGING_LOG_DATASET_NAME = 'charging_log';
26
- #PLATFORM_CHARGING_LOG_DATASET_ID_KEY = 'CHARGING_LOG_DATASET_ID';
25
+ #LOCAL_CHARGING_LOG_DATASET_NAME = 'charging-log';
27
26
  #maxTotalChargeUsd;
28
27
  #isAtHome;
29
28
  #actorRunId;
@@ -31,7 +30,6 @@ export class ChargingManager {
31
30
  /** Multi-tenant Server Actor runs carry no pricing snapshot; pricing comes from the Actor and the platform prices per caller. */
32
31
  #isMultiTenant = false;
33
32
  #purgeChargingLogDataset;
34
- #useChargingLogDataset;
35
33
  #notPpeWarningPrinted = false;
36
34
  #pricingInfo = {};
37
35
  #chargingState;
@@ -49,7 +47,6 @@ export class ChargingManager {
49
47
  this.#isAtHome = configuration.isAtHome;
50
48
  this.#actorRunId = configuration.actorRunId;
51
49
  this.#purgeChargingLogDataset = configuration.purgeOnStart;
52
- this.#useChargingLogDataset = configuration.useChargingLogDataset;
53
50
  this.#apifyClient = apifyClient;
54
51
  this.#getCurrentRun = getCurrentRun;
55
52
  this.#getCurrentActor = getCurrentActor;
@@ -114,9 +111,6 @@ export class ChargingManager {
114
111
  */
115
112
  async init() {
116
113
  // Validate config - it may have changed since the instantiation
117
- if (this.#useChargingLogDataset && this.#isAtHome) {
118
- throw new Error('Using the ACTOR_USE_CHARGING_LOG_DATASET environment variable is only supported in a local development environment');
119
- }
120
114
  if (this.#configuration.testPayPerEvent) {
121
115
  if (this.#isAtHome) {
122
116
  throw new Error('Using the ACTOR_TEST_PAY_PER_EVENT environment variable is only supported in a local development environment');
@@ -147,31 +141,15 @@ export class ChargingManager {
147
141
  totalChargedAmount: chargeCount * (this.#pricingInfo[eventName]?.price ?? 0),
148
142
  };
149
143
  }
150
- if (!this.isPayPerEvent || !this.#useChargingLogDataset) {
144
+ if (this.#isAtHome || !this.isPayPerEvent) {
151
145
  return;
152
146
  }
153
- // Set up charging log dataset
154
- if (this.#isAtHome) {
155
- const datasetId = await this.ensureChargingLogDatasetOnPlatform();
156
- this.#chargingLogDataset = await Dataset.open(datasetId);
157
- }
158
- else {
159
- if (this.#purgeChargingLogDataset) {
160
- const dataset = await Dataset.open(this.#LOCAL_CHARGING_LOG_DATASET_NAME);
161
- await dataset.drop();
162
- }
163
- this.#chargingLogDataset = await Dataset.open(this.#LOCAL_CHARGING_LOG_DATASET_NAME);
147
+ // Local pay-per-event runs log every charge into a dataset for debugging.
148
+ if (this.#purgeChargingLogDataset) {
149
+ const dataset = await Dataset.open(this.#LOCAL_CHARGING_LOG_DATASET_NAME);
150
+ await dataset.drop();
164
151
  }
165
- }
166
- async ensureChargingLogDatasetOnPlatform() {
167
- const defaultStore = await KeyValueStore.open();
168
- const storedDatasetId = await defaultStore.getValue(this.#PLATFORM_CHARGING_LOG_DATASET_ID_KEY);
169
- if (storedDatasetId !== null) {
170
- return storedDatasetId;
171
- }
172
- const dataset = await this.#apifyClient.datasets().getOrCreate();
173
- await defaultStore.setValue(this.#PLATFORM_CHARGING_LOG_DATASET_ID_KEY, dataset.id);
174
- return dataset.id;
152
+ this.#chargingLogDataset = await Dataset.open(this.#LOCAL_CHARGING_LOG_DATASET_NAME);
175
153
  }
176
154
  /**
177
155
  * Whether {@link ChargingManager.init} has run. All charging operations (including
@@ -319,8 +297,10 @@ export class ChargingManager {
319
297
  if (idempotencyKey !== undefined) {
320
298
  this.setIdempotentCharge(idempotencyKey, { eventName, chargedCount });
321
299
  }
322
- if (this.#chargingLogDataset !== undefined) {
323
- await this.#chargingLogDataset.pushData({
300
+ // The charge is not rolled back with a storage transaction, so neither is its log entry.
301
+ const chargingLogDataset = this.#chargingLogDataset;
302
+ if (chargingLogDataset !== undefined) {
303
+ await withDirectStorageAccess(async () => chargingLogDataset.pushData({
324
304
  eventName,
325
305
  eventTitle: pricingInfo.title,
326
306
  eventPriceUsd: pricingInfo.price,
@@ -328,7 +308,7 @@ export class ChargingManager {
328
308
  idempotencyKey,
329
309
  requestId,
330
310
  timestamp: new Date().toISOString(),
331
- });
311
+ }));
332
312
  }
333
313
  if (chargedCount < count) {
334
314
  const subject = count === 1 ? 'instance' : 'instances';
@@ -26,7 +26,7 @@ const toInfo = (run) => ({
26
26
  status: run.status,
27
27
  startedAt: run.startedAt.toISOString(),
28
28
  });
29
- const CHILD_RUNS_KVS_KEY = '__ACTOR_CHILD_RUNS';
29
+ const CHILD_RUNS_KVS_KEY = 'APIFY_ACTOR_CHILD_RUNS';
30
30
  const childRunInfoSchema = z.object({ runId: z.string(), status: z.string(), startedAt: z.string() });
31
31
  const trackedRunsSchema = z.record(z.string(), childRunInfoSchema.extend({
32
32
  checksum: z.string(),
@@ -28,6 +28,15 @@ export declare const apifyConfigFields: {
28
28
  actorId: ConfigField<z.ZodOptional<z.ZodString>>;
29
29
  actorRunId: ConfigField<z.ZodOptional<z.ZodString>>;
30
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>>>;
31
40
  apiBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
32
41
  apiPublicBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
33
42
  containerPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber, unknown>>>;
@@ -48,7 +57,6 @@ export declare const apifyConfigFields: {
48
57
  maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodPreprocess<z.ZodNumber, unknown>, z.ZodTransform<number, number>>>>;
49
58
  metaOrigin: ConfigField<z.ZodOptional<z.ZodString>>;
50
59
  testPayPerEvent: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
51
- useChargingLogDataset: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean, unknown>>>;
52
60
  actorPricingInfo: ConfigField<z.ZodOptional<z.ZodString>>;
53
61
  chargedEventCounts: ConfigField<z.ZodOptional<z.ZodString>>;
54
62
  actorStoragesJson: ConfigField<z.ZodOptional<z.ZodString>>;
@@ -110,6 +118,15 @@ export interface Configuration extends ApifyResolvedConfigValues {
110
118
  * `actorId` | `ACTOR_ID` | -
111
119
  * `actorRunId` | `ACTOR_RUN_ID` | -
112
120
  * `actorTaskId` | `ACTOR_TASK_ID` | -
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` | -
113
130
  * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
114
131
  * `containerPort` | `ACTOR_WEB_SERVER_PORT` | `4321`
115
132
  * `containerUrl` | `ACTOR_WEB_SERVER_URL` | `'http://localhost:4321'`
@@ -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]);
@@ -66,6 +82,18 @@ export const apifyConfigFields = {
66
82
  actorId: field(z.string().optional(), [ACTOR_ENV_VARS.ID, APIFY_ENV_VARS.ACTOR_ID]),
67
83
  actorRunId: field(z.string().optional(), [ACTOR_ENV_VARS.RUN_ID, APIFY_ENV_VARS.ACTOR_RUN_ID]),
68
84
  actorTaskId: field(z.string().optional(), [ACTOR_ENV_VARS.TASK_ID, APIFY_ENV_VARS.ACTOR_TASK_ID]),
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),
69
97
  apiBaseUrl: field(z.string().default('https://api.apify.com/'), APIFY_ENV_VARS.API_BASE_URL),
70
98
  apiPublicBaseUrl: field(z.string().default('https://api.apify.com'), APIFY_ENV_VARS.API_PUBLIC_BASE_URL),
71
99
  containerPort: field(coerceNumber.default(+LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.WEB_SERVER_PORT]), [
@@ -93,7 +121,6 @@ export const apifyConfigFields = {
93
121
  maxTotalChargeUsd: field(coerceNumber.transform((val) => (val === 0 ? Infinity : val)).default(Infinity), ACTOR_ENV_VARS.MAX_TOTAL_CHARGE_USD),
94
122
  metaOrigin: field(z.string().optional(), APIFY_ENV_VARS.META_ORIGIN),
95
123
  testPayPerEvent: field(coerceBoolean.default(false), 'ACTOR_TEST_PAY_PER_EVENT'),
96
- useChargingLogDataset: field(coerceBoolean.default(false), 'ACTOR_USE_CHARGING_LOG_DATASET'),
97
124
  // Pay-per-event charging metadata injected by the platform (JSON strings).
98
125
  actorPricingInfo: field(z.string().optional(), 'APIFY_ACTOR_PRICING_INFO'),
99
126
  chargedEventCounts: field(z.string().optional(), 'APIFY_CHARGED_ACTOR_EVENT_COUNTS'),
@@ -153,6 +180,15 @@ export const apifyConfigFields = {
153
180
  * `actorId` | `ACTOR_ID` | -
154
181
  * `actorRunId` | `ACTOR_RUN_ID` | -
155
182
  * `actorTaskId` | `ACTOR_TASK_ID` | -
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` | -
156
192
  * `apiBaseUrl` | `APIFY_API_BASE_URL` | `'https://api.apify.com/'`
157
193
  * `containerPort` | `ACTOR_WEB_SERVER_PORT` | `4321`
158
194
  * `containerUrl` | `ACTOR_WEB_SERVER_URL` | `'http://localhost:4321'`
package/dist/index.d.ts CHANGED
@@ -12,4 +12,5 @@ export * from './proxy_configuration.js';
12
12
  export * from './platform_event_manager.js';
13
13
  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';
14
14
  export type { QueueOperationInfo } from '@crawlee/types';
15
+ export { ACTOR_ENV_VARS, APIFY_ENV_VARS } from '@apify/consts';
15
16
  export { ApifyClient, ApifyClientOptions, ApifyClientError, ApifyApiError, InvalidRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, InvalidResponseBodyError, ResponseValidationError, } from 'apify-client';
package/dist/index.js CHANGED
@@ -9,4 +9,5 @@ export * from './configuration.js';
9
9
  export * from './proxy_configuration.js';
10
10
  export * from './platform_event_manager.js';
11
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';
12
13
  export { ApifyClient, ApifyClientError, ApifyApiError, InvalidRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, InvalidResponseBodyError, ResponseValidationError, } from 'apify-client';
@@ -10,16 +10,16 @@ import { Configuration } from './configuration.js';
10
10
  * **Example usage:**
11
11
  *
12
12
  * ```javascript
13
- * Actor.on('cpuInfo', (data) => {
13
+ * Actor.on('systemInfo', (data) => {
14
14
  * if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');
15
15
  * });
16
16
  * ```
17
17
  *
18
18
  * The following events are emitted:
19
19
  *
20
- * - `cpuInfo`: `{ "isCpuOverloaded": Boolean }`
21
- * The event is emitted approximately every second
22
- * 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.
23
23
  * If that's the case, the Actor should not add more workload.
24
24
  * For example, this event is used by the {@link AutoscaledPool} class.
25
25
  * - `migrating`: `void`
@@ -39,6 +39,10 @@ import { Configuration } from './configuration.js';
39
39
  * Note that the `persistState` event is provided merely for user convenience,
40
40
  * you can achieve the same effect using `setInterval()` and listening for the `migrating` event.
41
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
+ *
42
46
  * The connection to the platform events websocket is re-established after it drops, unless it was closed
43
47
  * with a code signalling a permanent condition (e.g. `1008` for an unknown run ID).
44
48
  */
@@ -50,6 +54,7 @@ export declare class PlatformEventManager extends EventManager {
50
54
  * user code can neither remove them with `off()` nor see them in `listeners()`.
51
55
  */
52
56
  constructor(configuration?: Configuration, internalListeners?: Partial<Record<EventTypeName, (...args: any[]) => unknown>>);
57
+ on(event: EventTypeName, listener: (...args: any[]) => any): void;
53
58
  emit(event: EventTypeName, ...args: unknown[]): void;
54
59
  waitForAllListenersToComplete(): Promise<boolean>;
55
60
  /**
@@ -15,6 +15,13 @@ const NON_RETRYABLE_CLOSE_CODES = new Set([1002, 1003, 1007, 1008, 1010]);
15
15
  const CLEAN_CLOSE_CODES = new Set([1000, 1001]);
16
16
  /** How long a connection must stay open to count as healthy, after which a drop reconnects without backoff. */
17
17
  const HEALTHY_CONNECTION_MIN_DURATION_MILLIS = 1000;
18
+ /** Names of the platform events that are emitted to listeners. Messages with any other name are dropped. */
19
+ const PLATFORM_EVENT_NAMES = new Set([
20
+ ACTOR_EVENT_NAMES.SYSTEM_INFO,
21
+ ACTOR_EVENT_NAMES.MIGRATING,
22
+ ACTOR_EVENT_NAMES.ABORTING,
23
+ ACTOR_EVENT_NAMES.PERSIST_STATE,
24
+ ]);
18
25
  /**
19
26
  * Delays between reconnection attempts, mirroring the Python `websockets` library
20
27
  * (see RFC 6455, section 7.2.3): a random initial delay, then exponential growth up to a cap.
@@ -38,16 +45,16 @@ function* backoffDelays() {
38
45
  * **Example usage:**
39
46
  *
40
47
  * ```javascript
41
- * Actor.on('cpuInfo', (data) => {
48
+ * Actor.on('systemInfo', (data) => {
42
49
  * if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');
43
50
  * });
44
51
  * ```
45
52
  *
46
53
  * The following events are emitted:
47
54
  *
48
- * - `cpuInfo`: `{ "isCpuOverloaded": Boolean }`
49
- * The event is emitted approximately every second
50
- * and it indicates whether the Actor is using the maximum of available CPU resources.
55
+ * - `systemInfo`: `{ "cpuCurrentUsage": Number, "isCpuOverloaded": Boolean, "memCurrentBytes": Number, ... }`
56
+ * The event is emitted approximately every second and it describes the CPU and memory usage of the Actor.
57
+ * `isCpuOverloaded` indicates whether the Actor is using the maximum of available CPU resources.
51
58
  * If that's the case, the Actor should not add more workload.
52
59
  * For example, this event is used by the {@link AutoscaledPool} class.
53
60
  * - `migrating`: `void`
@@ -67,6 +74,10 @@ function* backoffDelays() {
67
74
  * Note that the `persistState` event is provided merely for user convenience,
68
75
  * you can achieve the same effect using `setInterval()` and listening for the `migrating` event.
69
76
  *
77
+ * Messages with any other name are not emitted. This includes the deprecated `cpuInfo` event, which the platform
78
+ * sends next to `systemInfo` for backward compatibility. Registering a `cpuInfo` listener logs a warning.
79
+ * Unknown names are logged at the debug level.
80
+ *
70
81
  * The connection to the platform events websocket is re-established after it drops, unless it was closed
71
82
  * with a code signalling a permanent condition (e.g. `1008` for an unknown run ID).
72
83
  */
@@ -92,6 +103,13 @@ export class PlatformEventManager extends EventManager {
92
103
  this.configuration = configuration;
93
104
  this.#internalListeners = internalListeners;
94
105
  }
106
+ on(event, listener) {
107
+ if (event === ACTOR_EVENT_NAMES.CPU_INFO) {
108
+ this.log.warning('The "cpuInfo" event is deprecated and never emitted. ' +
109
+ 'Listen to "systemInfo" instead, which has the same "isCpuOverloaded" field.');
110
+ }
111
+ super.on(event, listener);
112
+ }
95
113
  emit(event, ...args) {
96
114
  super.emit(event, ...args);
97
115
  const listener = this.#internalListeners[event];
@@ -183,6 +201,12 @@ export class PlatformEventManager extends EventManager {
183
201
  return;
184
202
  try {
185
203
  const { name, data } = JSON.parse(String(message));
204
+ if (name === ACTOR_EVENT_NAMES.CPU_INFO)
205
+ return;
206
+ if (!PLATFORM_EVENT_NAMES.has(name)) {
207
+ this.log.debug('Unknown platform event received', { name, data });
208
+ return;
209
+ }
186
210
  this.emit(name, data);
187
211
  if (name === ACTOR_EVENT_NAMES.MIGRATING) {
188
212
  betterClearInterval(this.intervals.persistState); // Don't send any other persist state event.
@@ -138,6 +138,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
138
138
  `provide options.password or "${APIFY_ENV_VARS.PROXY_PASSWORD}" environment variable. ` +
139
139
  `You can also provide your Apify token via the "${APIFY_ENV_VARS.TOKEN}" environment variable, ` +
140
140
  `so that the SDK can fetch the proxy password from Apify API, when ${APIFY_ENV_VARS.PROXY_PASSWORD} is not defined`);
141
+ return false;
141
142
  }
142
143
  }
143
144
  if ((options?.checkAccess ?? this.#checkAccess) !== false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "4.0.0-rc.1",
3
+ "version": "4.0.0-rc.2",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.13.0"
@@ -58,44 +58,44 @@
58
58
  "@apify/input_secrets": "^2.0.9",
59
59
  "@apify/log": "^3.0.2",
60
60
  "@apify/pseudo_url": "^3.0.2",
61
- "@apify/timeout": "^1.0.1",
61
+ "@apify/timeout": "^1.1.0",
62
62
  "@apify/utilities": "^3.1.1",
63
63
  "@apify/validations": "^1.1.4",
64
- "@crawlee/core": "4.0.0-rc.2",
65
- "@crawlee/fs-storage": "4.0.0-rc.2",
66
- "@crawlee/types": "4.0.0-rc.2",
67
- "@crawlee/utils": "4.0.0-rc.2",
68
- "apify-client": "^3.0.0-rc.1",
64
+ "@crawlee/core": "4.0.0-rc.3",
65
+ "@crawlee/fs-storage": "4.0.0-rc.3",
66
+ "@crawlee/types": "4.0.0-rc.3",
67
+ "@crawlee/utils": "4.0.0-rc.3",
68
+ "apify-client": "^3.0.0-rc.2",
69
69
  "minimatch": "^11.0.9",
70
70
  "tslib": "^2.9.1",
71
71
  "ws": "^8.23.0",
72
72
  "zod": "^4.6.7"
73
73
  },
74
74
  "devDependencies": {
75
- "@apify/oxlint-config": "^0.3.0",
75
+ "@apify/oxlint-config": "^0.4.0",
76
76
  "@apify/tsconfig": "^0.2.0",
77
77
  "@commitlint/config-conventional": "^21.2.4",
78
78
  "@playwright/browser-chromium": "^1.65.1",
79
79
  "@types/node": "^26.6.6",
80
80
  "@types/ws": "^8.18.2",
81
81
  "commitlint": "^21.2.4",
82
- "crawlee": "4.0.0-rc.2",
82
+ "crawlee": "4.0.0-rc.3",
83
83
  "husky": "^9.1.7",
84
84
  "lint-staged": "^17.6.1",
85
- "oxfmt": "0.79.0",
86
- "oxlint": "1.94.0",
87
- "oxlint-tsgolint": "7.0.2007",
85
+ "oxfmt": "0.80.0",
86
+ "oxlint": "1.95.0",
87
+ "oxlint-tsgolint": "7.0.2008",
88
88
  "playwright": "^1.65.1",
89
- "puppeteer": "^25.17.0",
89
+ "puppeteer": "^25.18.1",
90
90
  "rimraf": "^6.1.4",
91
91
  "tsx": "^4.23.15",
92
92
  "typescript": "~7.0.2",
93
- "vitest": "^5.1.0"
93
+ "vitest": "^5.1.1"
94
94
  },
95
95
  "devEngines": {
96
96
  "packageManager": {
97
97
  "name": "pnpm",
98
- "version": "12.21.0",
98
+ "version": "12.23.0",
99
99
  "onFail": "warn"
100
100
  }
101
101
  },