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.
- package/dist/actor.d.ts +250 -29
- package/dist/actor.js +377 -126
- package/dist/apify_request_queue_backend.d.ts +1 -1
- package/dist/apify_request_queue_backend.js +1 -1
- package/dist/apify_request_queue_shared_backend.d.ts +2 -2
- package/dist/apify_request_queue_shared_backend.js +4 -4
- package/dist/apify_storage_backend.js +6 -13
- package/dist/charging.d.ts +27 -5
- package/dist/charging.js +155 -29
- package/dist/charging_storage_backend.js +6 -2
- package/dist/child_run_tracker.d.ts +88 -0
- package/dist/child_run_tracker.js +239 -0
- package/dist/configuration.d.ts +2 -1
- package/dist/configuration.js +2 -1
- package/dist/errors.d.ts +2 -2
- package/dist/google_sheets.d.ts +12 -0
- package/dist/google_sheets.js +26 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/platform_event_manager.d.ts +13 -2
- package/dist/platform_event_manager.js +178 -32
- package/dist/proxy_configuration.js +5 -2
- package/dist/utils.d.ts +5 -3
- package/dist/utils.js +14 -13
- package/package.json +31 -33
|
@@ -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
|
-
*
|
|
41
|
-
* @ignore
|
|
40
|
+
* A FIFO mutex that a critical section may re-enter from a nested call without deadlocking.
|
|
42
41
|
*/
|
|
43
|
-
export declare
|
|
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
|
-
*
|
|
112
|
-
* @ignore
|
|
109
|
+
* A FIFO mutex that a critical section may re-enter from a nested call without deadlocking.
|
|
113
110
|
*/
|
|
114
|
-
export
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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.
|
|
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
|
|
56
|
+
"@apify/consts": "^3.1.0",
|
|
57
57
|
"@apify/datastructures": "^3.0.1",
|
|
58
|
-
"@apify/input_secrets": "^2.0.
|
|
59
|
-
"@apify/log": "^3.0.
|
|
60
|
-
"@apify/pseudo_url": "^3.0.
|
|
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.
|
|
63
|
-
"@apify/validations": "^1.1.
|
|
64
|
-
"@crawlee/core": "4.0.0-rc.
|
|
65
|
-
"@crawlee/fs-storage": "4.0.0-rc.
|
|
66
|
-
"@crawlee/types": "4.0.0-rc.
|
|
67
|
-
"@crawlee/utils": "4.0.0-rc.
|
|
68
|
-
"apify-client": "^3.0.0-rc.
|
|
69
|
-
"minimatch": "^
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
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.
|
|
79
|
-
"@playwright/browser-chromium": "^1.
|
|
80
|
-
"@types/node": "^26.6.
|
|
81
|
-
"@types/
|
|
82
|
-
"
|
|
83
|
-
"
|
|
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.
|
|
87
|
-
"oxfmt": "0.
|
|
88
|
-
"oxlint": "1.
|
|
89
|
-
"oxlint-tsgolint": "7.0.
|
|
90
|
-
"playwright": "^1.
|
|
91
|
-
"puppeteer": "^25.
|
|
92
|
-
"rimraf": "^6.1.
|
|
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
|
|
93
|
+
"vitest": "^5.1.0"
|
|
96
94
|
},
|
|
97
95
|
"devEngines": {
|
|
98
96
|
"packageManager": {
|
|
99
97
|
"name": "pnpm",
|
|
100
|
-
"version": "12.
|
|
98
|
+
"version": "12.21.0",
|
|
101
99
|
"onFail": "warn"
|
|
102
100
|
}
|
|
103
101
|
},
|