apify 4.0.0-beta.24 → 4.0.0-beta.25
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.js +4 -4
- package/dist/configuration.d.ts +21 -21
- package/dist/platform_event_manager.js +2 -2
- package/package.json +5 -5
package/dist/actor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPrivateKey } from 'node:crypto';
|
|
2
|
-
import { Dataset, KeyValueStore, purgeDefaultStorages, RequestQueue, serviceLocator } from '@crawlee/core';
|
|
2
|
+
import { Dataset, EventType, KeyValueStore, purgeDefaultStorages, RequestQueue, serviceLocator } from '@crawlee/core';
|
|
3
3
|
import { sleep } from '@crawlee/utils';
|
|
4
4
|
import { ApifyClient } from 'apify-client';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -281,7 +281,7 @@ export class Actor {
|
|
|
281
281
|
await events.close();
|
|
282
282
|
log.debug(`Events closed`);
|
|
283
283
|
// Emit the exit event
|
|
284
|
-
events.emit(
|
|
284
|
+
events.emit(EventType.EXIT, options);
|
|
285
285
|
// Wait for all event listeners to be processed
|
|
286
286
|
log.debug(`Waiting for all event listeners to complete their execution (with ${options.timeoutSecs} seconds timeout)`);
|
|
287
287
|
if (options.exit) {
|
|
@@ -507,12 +507,12 @@ export class Actor {
|
|
|
507
507
|
// `persistState` for individual RequestLists, RequestQueue... instances to be persisted
|
|
508
508
|
...serviceLocator
|
|
509
509
|
.getEventManager()
|
|
510
|
-
.listeners(
|
|
510
|
+
.listeners(EventType.PERSIST_STATE)
|
|
511
511
|
.map(async (x) => x({})),
|
|
512
512
|
// `migrating` to pause Apify crawlers
|
|
513
513
|
...serviceLocator
|
|
514
514
|
.getEventManager()
|
|
515
|
-
.listeners(
|
|
515
|
+
.listeners(EventType.MIGRATING)
|
|
516
516
|
.map(async (x) => x({})),
|
|
517
517
|
]);
|
|
518
518
|
const runId = this.configuration.actorRunId;
|
package/dist/configuration.d.ts
CHANGED
|
@@ -6,16 +6,16 @@ export declare const apifyConfigFields: {
|
|
|
6
6
|
defaultKeyValueStoreId: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
7
7
|
defaultRequestQueueId: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
8
8
|
inputKey: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
9
|
-
memoryMbytes: ConfigField<z.ZodOptional<z.
|
|
10
|
-
availableMemoryRatio: ConfigField<z.ZodDefault<z.
|
|
11
|
-
disableBrowserSandbox: ConfigField<z.ZodDefault<z.
|
|
12
|
-
persistStateIntervalMillis: ConfigField<z.ZodDefault<z.
|
|
13
|
-
headless: ConfigField<z.ZodDefault<z.
|
|
14
|
-
xvfb: ConfigField<z.ZodDefault<z.
|
|
9
|
+
memoryMbytes: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>>;
|
|
10
|
+
availableMemoryRatio: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
11
|
+
disableBrowserSandbox: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
12
|
+
persistStateIntervalMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
13
|
+
headless: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
14
|
+
xvfb: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
15
15
|
chromeExecutablePath: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
16
16
|
defaultBrowserPath: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
17
|
-
purgeOnStart: ConfigField<z.ZodDefault<z.
|
|
18
|
-
metamorphAfterSleepMillis: ConfigField<z.ZodDefault<z.
|
|
17
|
+
purgeOnStart: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
18
|
+
metamorphAfterSleepMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
19
19
|
actorEventsWsUrl: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
20
20
|
token: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
21
21
|
actorId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
@@ -23,36 +23,36 @@ export declare const apifyConfigFields: {
|
|
|
23
23
|
actorTaskId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
24
24
|
apiBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
25
25
|
apiPublicBaseUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
26
|
-
containerPort: ConfigField<z.ZodDefault<z.
|
|
26
|
+
containerPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
27
27
|
containerUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
28
28
|
proxyHostname: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
29
29
|
proxyPassword: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
30
|
-
proxyPort: ConfigField<z.ZodDefault<z.
|
|
30
|
+
proxyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
31
31
|
proxyStatusUrl: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
32
32
|
/** @deprecated use `containerPort` instead */
|
|
33
|
-
standbyPort: ConfigField<z.ZodDefault<z.
|
|
33
|
+
standbyPort: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
34
34
|
standbyUrl: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
35
|
-
isAtHome: ConfigField<z.ZodDefault<z.
|
|
35
|
+
isAtHome: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
36
36
|
userId: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
37
37
|
userIsPaying: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
38
38
|
actorPermissionLevel: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
39
39
|
inputSecretsPrivateKeyPassphrase: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
40
40
|
inputSecretsPrivateKeyFile: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
41
|
-
maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.
|
|
41
|
+
maxTotalChargeUsd: ConfigField<z.ZodDefault<z.ZodPipe<z.ZodPreprocess<z.ZodNumber>, z.ZodTransform<number, number>>>>;
|
|
42
42
|
metaOrigin: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
43
|
-
testPayPerEvent: ConfigField<z.ZodDefault<z.
|
|
44
|
-
useChargingLogDataset: ConfigField<z.ZodDefault<z.
|
|
43
|
+
testPayPerEvent: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
44
|
+
useChargingLogDataset: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
45
45
|
actorPricingInfo: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
46
46
|
chargedEventCounts: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
47
47
|
actorStoragesJson: ConfigField<z.ZodOptional<z.ZodString>>;
|
|
48
48
|
storageClientOptions: ConfigField<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
49
|
-
maxUsedCpuRatio: ConfigField<z.ZodDefault<z.
|
|
50
|
-
internalTimeoutMillis: ConfigField<z.ZodOptional<z.
|
|
51
|
-
systemInfoIntervalMillis: ConfigField<z.ZodDefault<z.
|
|
52
|
-
logLevel: ConfigField<z.ZodOptional<z.
|
|
53
|
-
persistStorage: ConfigField<z.ZodDefault<z.
|
|
49
|
+
maxUsedCpuRatio: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
50
|
+
internalTimeoutMillis: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>>;
|
|
51
|
+
systemInfoIntervalMillis: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodNumber>>>;
|
|
52
|
+
logLevel: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodEnum<typeof import("@apify/log").LogLevel>>>>;
|
|
53
|
+
persistStorage: ConfigField<z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
54
54
|
storageDir: ConfigField<z.ZodDefault<z.ZodString>>;
|
|
55
|
-
containerized: ConfigField<z.ZodOptional<z.
|
|
55
|
+
containerized: ConfigField<z.ZodOptional<z.ZodPreprocess<z.ZodBoolean>>>;
|
|
56
56
|
};
|
|
57
57
|
export type ApifyConfigurationInput = FieldsInput<typeof apifyConfigFields>;
|
|
58
58
|
export type ApifyResolvedConfigValues = FieldsOutput<typeof apifyConfigFields>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventManager } from '@crawlee/core';
|
|
1
|
+
import { EventManager, EventType } from '@crawlee/core';
|
|
2
2
|
import { WebSocket } from 'ws';
|
|
3
3
|
import { ACTOR_ENV_VARS, ACTOR_EVENT_NAMES } from '@apify/consts';
|
|
4
4
|
import { betterClearInterval } from '@apify/utilities';
|
|
@@ -78,7 +78,7 @@ export class PlatformEventManager extends EventManager {
|
|
|
78
78
|
this.events.emit(name, data);
|
|
79
79
|
if (name === ACTOR_EVENT_NAMES.MIGRATING) {
|
|
80
80
|
betterClearInterval(this.intervals.persistState); // Don't send any other persist state event.
|
|
81
|
-
this.events.emit(
|
|
81
|
+
this.events.emit(EventType.PERSIST_STATE, {
|
|
82
82
|
isMigrating: true,
|
|
83
83
|
});
|
|
84
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.25",
|
|
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.0.0"
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@apify/log": "^2.4.3",
|
|
60
60
|
"@apify/timeout": "^0.4.0",
|
|
61
61
|
"@apify/utilities": "^2.13.0",
|
|
62
|
-
"@crawlee/core": "^4.0.0-beta.
|
|
63
|
-
"@crawlee/types": "^4.0.0-beta.
|
|
64
|
-
"@crawlee/utils": "^4.0.0-beta.
|
|
62
|
+
"@crawlee/core": "^4.0.0-beta.128",
|
|
63
|
+
"@crawlee/types": "^4.0.0-beta.128",
|
|
64
|
+
"@crawlee/utils": "^4.0.0-beta.128",
|
|
65
65
|
"apify-client": "^2.23.4",
|
|
66
66
|
"semver": "^7.5.4",
|
|
67
67
|
"tslib": "^2.6.2",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@types/tough-cookie": "^4.0.5",
|
|
80
80
|
"@types/ws": "^8.5.12",
|
|
81
81
|
"commitlint": "^21.0.0",
|
|
82
|
-
"crawlee": "^4.0.0-beta.
|
|
82
|
+
"crawlee": "^4.0.0-beta.128",
|
|
83
83
|
"globby": "^16.0.0",
|
|
84
84
|
"husky": "^9.1.7",
|
|
85
85
|
"lint-staged": "^17.0.0",
|