apify 4.0.0-rc.0 → 4.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,6 +61,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
61
61
  #hostname;
62
62
  #port;
63
63
  #usesApifyProxy;
64
+ #checkAccess;
64
65
  log = defaultLog.child({ prefix: 'ProxyConfiguration' });
65
66
  /**
66
67
  * @internal
@@ -82,6 +83,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
82
83
  subdivisionCode: z.string().regex(SUBDIVISION_CODE_REGEX).optional(),
83
84
  apifyProxySubdivision: z.string().regex(SUBDIVISION_CODE_REGEX).optional(),
84
85
  password: z.string().optional(),
86
+ checkAccess: z.boolean().optional(),
85
87
  })
86
88
  .strict());
87
89
  const { groups = [], apifyProxyGroups = [], countryCode, apifyProxyCountry, subdivisionCode, apifyProxySubdivision, password = configuration.proxyPassword, } = options;
@@ -106,6 +108,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
106
108
  this.#hostname = hostname;
107
109
  this.#port = port;
108
110
  this.#usesApifyProxy = !proxyUrls && !newUrlFunction;
111
+ this.#checkAccess = options.checkAccess;
109
112
  if (proxyUrls && proxyUrls.some((url) => url?.includes('apify.com'))) {
110
113
  this.log.warning('Some Apify proxy features may work incorrectly. Please consider setting up Apify properties instead of `proxyUrls`.\n' +
111
114
  'See https://docs.apify.com/sdk/js/docs/concepts/proxy-management#apify-proxy-configuration');
@@ -137,7 +140,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
137
140
  `so that the SDK can fetch the proxy password from Apify API, when ${APIFY_ENV_VARS.PROXY_PASSWORD} is not defined`);
138
141
  }
139
142
  }
140
- if (options?.checkAccess !== false) {
143
+ if ((options?.checkAccess ?? this.#checkAccess) !== false) {
141
144
  return this.checkAccess();
142
145
  }
143
146
  }
@@ -228,7 +231,7 @@ export class ProxyConfiguration extends CoreProxyConfiguration {
228
231
  return;
229
232
  try {
230
233
  const user = await Actor.apifyClient.user().get();
231
- this.#password = user?.proxy?.password;
234
+ this.#password = user?.proxy?.password ?? undefined;
232
235
  }
233
236
  catch (error) {
234
237
  if (Actor.isAtHome()) {
package/dist/utils.d.ts CHANGED
@@ -37,7 +37,9 @@ export declare function getSystemInfo(): {
37
37
  */
38
38
  export declare function checkCrawleeVersion(): void;
39
39
  /**
40
- * Prints a warning if this version of Apify SDK is outdated.
41
- * @ignore
40
+ * A FIFO mutex that a critical section may re-enter from a nested call without deadlocking.
42
41
  */
43
- export declare function printOutdatedSdkWarning(): void;
42
+ export declare class ReentrantAsyncLock {
43
+ #private;
44
+ runExclusive<T>(fn: () => Promise<T>): Promise<T>;
45
+ }
package/dist/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
1
2
  import { existsSync, readFileSync } from 'node:fs';
2
3
  import { createRequire } from 'node:module';
3
4
  import { type } from 'node:os';
@@ -7,9 +8,6 @@ import { parseValue } from '@crawlee/core';
7
8
  import crawleePkgJson from '@crawlee/core/package.json' with { type: 'json' };
8
9
  // @ts-ignore if we enable resolveJsonModule, we end up with `src` folder in `dist`
9
10
  import apifyClientPkgJson from 'apify-client/package.json' with { type: 'json' };
10
- import semver from 'semver';
11
- import { APIFY_ENV_VARS } from '@apify/consts';
12
- import log from '@apify/log';
13
11
  // @ts-ignore if we enable resolveJsonModule, we end up with `src` folder in `dist`
14
12
  import apifyPkgJson from '../package.json' with { type: 'json' };
15
13
  export { ArgumentValidationError } from '@apify/validations';
@@ -108,15 +106,18 @@ export function checkCrawleeVersion() {
108
106
  }
109
107
  }
110
108
  /**
111
- * Prints a warning if this version of Apify SDK is outdated.
112
- * @ignore
109
+ * A FIFO mutex that a critical section may re-enter from a nested call without deadlocking.
113
110
  */
114
- export function printOutdatedSdkWarning() {
115
- if (process.env[APIFY_ENV_VARS.DISABLE_OUTDATED_WARNING])
116
- return;
117
- const latestApifyVersion = process.env[APIFY_ENV_VARS.SDK_LATEST_VERSION];
118
- if (!latestApifyVersion || !semver.lt(apifyPkgJson.version, latestApifyVersion))
119
- return;
120
- log.warning(`You are using an outdated version (${apifyPkgJson.version}) of Apify SDK. We recommend you to update to the latest version (${latestApifyVersion}).
121
- Read more about Apify SDK versioning at: https://help.apify.com/en/articles/3184510-updates-and-versioning-of-apify-sdk`);
111
+ export class ReentrantAsyncLock {
112
+ #tail = Promise.resolve();
113
+ #held = new AsyncLocalStorage();
114
+ async runExclusive(fn) {
115
+ if (this.#held.getStore()) {
116
+ return await fn();
117
+ }
118
+ const run = this.#tail.then(async () => this.#held.run(true, fn));
119
+ // Keep the chain alive even when the critical section throws.
120
+ this.#tail = run.catch(() => { });
121
+ return await run;
122
+ }
122
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.0.0-rc.1",
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"
@@ -53,51 +53,49 @@
53
53
  ]
54
54
  },
55
55
  "dependencies": {
56
- "@apify/consts": "^3.0.1",
56
+ "@apify/consts": "^3.1.0",
57
57
  "@apify/datastructures": "^3.0.1",
58
- "@apify/input_secrets": "^2.0.5",
59
- "@apify/log": "^3.0.1",
60
- "@apify/pseudo_url": "^3.0.1",
58
+ "@apify/input_secrets": "^2.0.9",
59
+ "@apify/log": "^3.0.2",
60
+ "@apify/pseudo_url": "^3.0.2",
61
61
  "@apify/timeout": "^1.0.1",
62
- "@apify/utilities": "^3.1.0",
63
- "@apify/validations": "^1.1.1",
64
- "@crawlee/core": "4.0.0-rc.1",
65
- "@crawlee/fs-storage": "4.0.0-rc.1",
66
- "@crawlee/types": "4.0.0-rc.1",
67
- "@crawlee/utils": "4.0.0-rc.1",
68
- "apify-client": "^3.0.0-rc.0",
69
- "minimatch": "^10.2.6",
70
- "semver": "^7.8.5",
71
- "tslib": "^2.8.1",
72
- "ws": "^8.22.0",
73
- "zod": "^4.6.5"
62
+ "@apify/utilities": "^3.1.1",
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",
69
+ "minimatch": "^11.0.9",
70
+ "tslib": "^2.9.1",
71
+ "ws": "^8.23.0",
72
+ "zod": "^4.6.7"
74
73
  },
75
74
  "devDependencies": {
76
75
  "@apify/oxlint-config": "^0.3.0",
77
76
  "@apify/tsconfig": "^0.2.0",
78
- "@commitlint/config-conventional": "^21.2.3",
79
- "@playwright/browser-chromium": "^1.63.0",
80
- "@types/node": "^26.6.3",
81
- "@types/semver": "^7.8.0",
82
- "@types/ws": "^8.18.1",
83
- "commitlint": "^21.2.3",
84
- "crawlee": "4.0.0-rc.1",
77
+ "@commitlint/config-conventional": "^21.2.4",
78
+ "@playwright/browser-chromium": "^1.65.1",
79
+ "@types/node": "^26.6.6",
80
+ "@types/ws": "^8.18.2",
81
+ "commitlint": "^21.2.4",
82
+ "crawlee": "4.0.0-rc.2",
85
83
  "husky": "^9.1.7",
86
- "lint-staged": "^17.6.0",
87
- "oxfmt": "0.72.0",
88
- "oxlint": "1.87.0",
89
- "oxlint-tsgolint": "7.0.2004",
90
- "playwright": "^1.63.0",
91
- "puppeteer": "^25.12.0",
92
- "rimraf": "^6.1.3",
84
+ "lint-staged": "^17.6.1",
85
+ "oxfmt": "0.79.0",
86
+ "oxlint": "1.94.0",
87
+ "oxlint-tsgolint": "7.0.2007",
88
+ "playwright": "^1.65.1",
89
+ "puppeteer": "^25.17.0",
90
+ "rimraf": "^6.1.4",
93
91
  "tsx": "^4.23.15",
94
92
  "typescript": "~7.0.2",
95
- "vitest": "^5.0.2"
93
+ "vitest": "^5.1.0"
96
94
  },
97
95
  "devEngines": {
98
96
  "packageManager": {
99
97
  "name": "pnpm",
100
- "version": "12.11.2",
98
+ "version": "12.21.0",
101
99
  "onFail": "warn"
102
100
  }
103
101
  },