apify 3.2.0 → 3.2.1-beta.13
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/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-copy.log +4 -0
- package/README.md +4 -4
- package/dist/LICENSE.md +201 -0
- package/dist/README.md +98 -0
- package/{actor.d.ts → dist/actor.d.ts} +110 -110
- package/{actor.d.ts.map → dist/actor.d.ts.map} +1 -1
- package/{actor.js → dist/actor.js} +90 -89
- package/dist/actor.js.map +1 -0
- package/dist/package.json +80 -0
- package/{platform_event_manager.d.ts → dist/platform_event_manager.d.ts} +8 -8
- package/{platform_event_manager.js → dist/platform_event_manager.js} +9 -9
- package/{proxy_configuration.d.ts → dist/proxy_configuration.d.ts} +2 -2
- package/{utils.d.ts → dist/utils.d.ts} +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/{utils.js → dist/utils.js} +36 -1
- package/dist/utils.js.map +1 -0
- package/package.json +10 -9
- package/actor.js.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
- package/utils.d.ts.map +0 -1
- package/utils.js.map +0 -1
- /package/{configuration.d.ts → dist/configuration.d.ts} +0 -0
- /package/{configuration.d.ts.map → dist/configuration.d.ts.map} +0 -0
- /package/{configuration.js → dist/configuration.js} +0 -0
- /package/{configuration.js.map → dist/configuration.js.map} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.d.ts.map → dist/index.d.ts.map} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{index.js.map → dist/index.js.map} +0 -0
- /package/{index.mjs → dist/index.mjs} +0 -0
- /package/{key_value_store.d.ts → dist/key_value_store.d.ts} +0 -0
- /package/{key_value_store.d.ts.map → dist/key_value_store.d.ts.map} +0 -0
- /package/{key_value_store.js → dist/key_value_store.js} +0 -0
- /package/{key_value_store.js.map → dist/key_value_store.js.map} +0 -0
- /package/{platform_event_manager.d.ts.map → dist/platform_event_manager.d.ts.map} +0 -0
- /package/{platform_event_manager.js.map → dist/platform_event_manager.js.map} +0 -0
- /package/{proxy_configuration.d.ts.map → dist/proxy_configuration.d.ts.map} +0 -0
- /package/{proxy_configuration.js → dist/proxy_configuration.js} +0 -0
- /package/{proxy_configuration.js.map → dist/proxy_configuration.js.map} +0 -0
|
@@ -32,21 +32,21 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
32
32
|
*/
|
|
33
33
|
readonly eventManager: EventManager;
|
|
34
34
|
/**
|
|
35
|
-
* Whether the
|
|
35
|
+
* Whether the Actor instance was initialized. This is set by calling {@apilink Actor.init}.
|
|
36
36
|
*/
|
|
37
37
|
initialized: boolean;
|
|
38
38
|
/**
|
|
39
|
-
* Set if the
|
|
39
|
+
* Set if the Actor called a method that requires the instance to be initialized, but did not do so.
|
|
40
40
|
* A call to `init` after this warning is emitted is considered an invalid state and will throw an error.
|
|
41
41
|
*/
|
|
42
42
|
private warnedAboutMissingInitCall;
|
|
43
43
|
constructor(options?: ConfigurationOptions);
|
|
44
44
|
/**
|
|
45
|
-
* Runs the main user function that performs the job of the
|
|
45
|
+
* Runs the main user function that performs the job of the Actor
|
|
46
46
|
* and terminates the process when the user function finishes.
|
|
47
47
|
*
|
|
48
48
|
* **The `Actor.main()` function is optional** and is provided merely for your convenience.
|
|
49
|
-
* It is mainly useful when you're running your code as an
|
|
49
|
+
* It is mainly useful when you're running your code as an Actor on the [Apify platform](https://apify.com/actors).
|
|
50
50
|
* However, if you want to use Apify SDK tools directly inside your existing projects, e.g.
|
|
51
51
|
* running in an [Express](https://expressjs.com/) server, on
|
|
52
52
|
* [Google Cloud functions](https://cloud.google.com/functions)
|
|
@@ -73,7 +73,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
73
73
|
* ```javascript
|
|
74
74
|
* await Actor.main(() => {
|
|
75
75
|
* // My synchronous function that returns immediately
|
|
76
|
-
* console.log('Hello world from
|
|
76
|
+
* console.log('Hello world from Actor!');
|
|
77
77
|
* });
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
@@ -128,13 +128,13 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
128
128
|
*/
|
|
129
129
|
off(event: EventTypeName, listener?: (...args: any[]) => any): void;
|
|
130
130
|
/**
|
|
131
|
-
* Runs an
|
|
131
|
+
* Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
132
132
|
*
|
|
133
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
133
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
134
134
|
*
|
|
135
|
-
* If you want to run an
|
|
135
|
+
* If you want to run an Actor task rather than an Actor, please use the {@apilink Actor.callTask} function instead.
|
|
136
136
|
*
|
|
137
|
-
* For more information about
|
|
137
|
+
* For more information about Actors, read the [documentation](https://docs.apify.com/actor).
|
|
138
138
|
*
|
|
139
139
|
* **Example usage:**
|
|
140
140
|
*
|
|
@@ -143,9 +143,9 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
143
143
|
* ```
|
|
144
144
|
*
|
|
145
145
|
* @param actorId
|
|
146
|
-
* Allowed formats are `username/actor-name`, `userId/actor-name` or
|
|
146
|
+
* Allowed formats are `username/actor-name`, `userId/actor-name` or Actor ID.
|
|
147
147
|
* @param [input]
|
|
148
|
-
* Input for the
|
|
148
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
149
149
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
150
150
|
* Otherwise the `options.contentType` parameter must be provided.
|
|
151
151
|
* @param [options]
|
|
@@ -153,12 +153,12 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
153
153
|
*/
|
|
154
154
|
call(actorId: string, input?: unknown, options?: CallOptions): Promise<ClientActorRun>;
|
|
155
155
|
/**
|
|
156
|
-
* Runs an
|
|
156
|
+
* Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
|
|
157
157
|
* unlike `Actor.call`, this method just starts the run without waiting for finish.
|
|
158
158
|
*
|
|
159
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
159
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
160
160
|
*
|
|
161
|
-
* For more information about
|
|
161
|
+
* For more information about Actors, read the
|
|
162
162
|
* [documentation](https://docs.apify.com/actor).
|
|
163
163
|
*
|
|
164
164
|
* **Example usage:**
|
|
@@ -168,9 +168,9 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
168
168
|
* ```
|
|
169
169
|
*
|
|
170
170
|
* @param actorId
|
|
171
|
-
* Allowed formats are `username/actor-name`, `userId/actor-name` or
|
|
171
|
+
* Allowed formats are `username/actor-name`, `userId/actor-name` or Actor ID.
|
|
172
172
|
* @param [input]
|
|
173
|
-
* Input for the
|
|
173
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
174
174
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
175
175
|
* Otherwise the `options.contentType` parameter must be provided.
|
|
176
176
|
* @param [options]
|
|
@@ -178,11 +178,11 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
178
178
|
*/
|
|
179
179
|
start(actorId: string, input?: unknown, options?: CallOptions): Promise<ClientActorRun>;
|
|
180
180
|
/**
|
|
181
|
-
* Aborts given
|
|
181
|
+
* Aborts given Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
182
182
|
*
|
|
183
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
183
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
184
184
|
*
|
|
185
|
-
* For more information about
|
|
185
|
+
* For more information about Actors, read the
|
|
186
186
|
* [documentation](https://docs.apify.com/actor).
|
|
187
187
|
*
|
|
188
188
|
* **Example usage:**
|
|
@@ -196,13 +196,13 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
196
196
|
/**
|
|
197
197
|
* Runs an actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
198
198
|
*
|
|
199
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
199
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
200
200
|
*
|
|
201
|
-
* Note that an
|
|
202
|
-
* If you want to run an
|
|
201
|
+
* Note that an Actor task is a saved input configuration and options for an Actor.
|
|
202
|
+
* If you want to run an Actor directly rather than an Actor task, please use the
|
|
203
203
|
* {@apilink Actor.call} function instead.
|
|
204
204
|
*
|
|
205
|
-
* For more information about
|
|
205
|
+
* For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
|
|
206
206
|
*
|
|
207
207
|
* **Example usage:**
|
|
208
208
|
*
|
|
@@ -213,22 +213,22 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
213
213
|
* @param taskId
|
|
214
214
|
* Allowed formats are `username/task-name`, `userId/task-name` or task ID.
|
|
215
215
|
* @param [input]
|
|
216
|
-
* Input overrides for the
|
|
216
|
+
* Input overrides for the Actor task. If it is an object, it will be stringified to
|
|
217
217
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
218
|
-
* Provided input will be merged with
|
|
218
|
+
* Provided input will be merged with Actor task input.
|
|
219
219
|
* @param [options]
|
|
220
220
|
* @ignore
|
|
221
221
|
*/
|
|
222
222
|
callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
|
|
223
223
|
/**
|
|
224
|
-
* Transforms this
|
|
224
|
+
* Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
|
|
225
225
|
* the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
|
|
226
226
|
* in the same default key-value store.
|
|
227
227
|
*
|
|
228
228
|
* @param targetActorId
|
|
229
|
-
* Either `username/actor-name` or
|
|
229
|
+
* Either `username/actor-name` or Actor ID of an Actor to which we want to metamorph.
|
|
230
230
|
* @param [input]
|
|
231
|
-
* Input for the
|
|
231
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
232
232
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
233
233
|
* Otherwise, the `options.contentType` parameter must be provided.
|
|
234
234
|
* @param [options]
|
|
@@ -236,7 +236,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
236
236
|
*/
|
|
237
237
|
metamorph(targetActorId: string, input?: unknown, options?: MetamorphOptions): Promise<void>;
|
|
238
238
|
/**
|
|
239
|
-
* Internally reboots this
|
|
239
|
+
* Internally reboots this Actor. The system stops the current container and starts
|
|
240
240
|
* a new container with the same run ID.
|
|
241
241
|
* This can be used to get the Actor out of irrecoverable error state and continue where it left off.
|
|
242
242
|
*
|
|
@@ -244,10 +244,10 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
244
244
|
*/
|
|
245
245
|
reboot(options?: RebootOptions): Promise<void>;
|
|
246
246
|
/**
|
|
247
|
-
* Creates an ad-hoc webhook for the current
|
|
248
|
-
* For more information about Apify
|
|
247
|
+
* Creates an ad-hoc webhook for the current Actor run, which lets you receive a notification when the Actor run finished or failed.
|
|
248
|
+
* For more information about Apify Actor webhooks, please see the [documentation](https://docs.apify.com/webhooks).
|
|
249
249
|
*
|
|
250
|
-
* Note that webhooks are only supported for
|
|
250
|
+
* Note that webhooks are only supported for Actors running on the Apify platform.
|
|
251
251
|
* In local environment, the function will print a warning and have no effect.
|
|
252
252
|
*
|
|
253
253
|
* @param options
|
|
@@ -257,7 +257,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
257
257
|
*/
|
|
258
258
|
addWebhook(options: WebhookOptions): Promise<Webhook | undefined>;
|
|
259
259
|
/**
|
|
260
|
-
* Sets the status message for the current
|
|
260
|
+
* Sets the status message for the current Actor run.
|
|
261
261
|
*
|
|
262
262
|
* @returns The return value is the Run object.
|
|
263
263
|
* For more information, see the [Actor Runs](https://docs.apify.com/api/v2#/reference/actor-runs/) API endpoints.
|
|
@@ -265,7 +265,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
265
265
|
*/
|
|
266
266
|
setStatusMessage(statusMessage: string, options?: SetStatusMessageOptions): Promise<ClientActorRun>;
|
|
267
267
|
/**
|
|
268
|
-
* Stores an object or an array of objects to the default {@apilink Dataset} of the current
|
|
268
|
+
* Stores an object or an array of objects to the default {@apilink Dataset} of the current Actor run.
|
|
269
269
|
*
|
|
270
270
|
* This is just a convenient shortcut for {@apilink Dataset.pushData}.
|
|
271
271
|
* For example, calling the following code:
|
|
@@ -282,7 +282,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
282
282
|
* For more information, see {@apilink Actor.openDataset} and {@apilink Dataset.pushData}
|
|
283
283
|
*
|
|
284
284
|
* **IMPORTANT**: Make sure to use the `await` keyword when calling `pushData()`,
|
|
285
|
-
* otherwise the
|
|
285
|
+
* otherwise the Actor process might finish before the data are stored!
|
|
286
286
|
*
|
|
287
287
|
* @param item Object or array of objects containing data to be stored in the default dataset.
|
|
288
288
|
* The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.
|
|
@@ -300,13 +300,13 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
300
300
|
*
|
|
301
301
|
* @param [datasetIdOrName]
|
|
302
302
|
* ID or name of the dataset to be opened. If `null` or `undefined`,
|
|
303
|
-
* the function returns the default dataset associated with the
|
|
303
|
+
* the function returns the default dataset associated with the Actor run.
|
|
304
304
|
* @param [options]
|
|
305
305
|
* @ignore
|
|
306
306
|
*/
|
|
307
307
|
openDataset(datasetIdOrName?: string | null, options?: OpenStorageOptions): Promise<Dataset<Data>>;
|
|
308
308
|
/**
|
|
309
|
-
* Gets a value from the default {@apilink KeyValueStore} associated with the current
|
|
309
|
+
* Gets a value from the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
310
310
|
*
|
|
311
311
|
* This is just a convenient shortcut for {@apilink KeyValueStore.getValue}.
|
|
312
312
|
* For example, calling the following code:
|
|
@@ -335,7 +335,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
335
335
|
*/
|
|
336
336
|
getValue<T = unknown>(key: string): Promise<T | null>;
|
|
337
337
|
/**
|
|
338
|
-
* Stores or deletes a value in the default {@apilink KeyValueStore} associated with the current
|
|
338
|
+
* Stores or deletes a value in the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
339
339
|
*
|
|
340
340
|
* This is just a convenient shortcut for {@apilink KeyValueStore.setValue}.
|
|
341
341
|
* For example, calling the following code:
|
|
@@ -367,7 +367,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
367
367
|
*/
|
|
368
368
|
setValue<T>(key: string, value: T | null, options?: RecordOptions): Promise<void>;
|
|
369
369
|
/**
|
|
370
|
-
* Gets the
|
|
370
|
+
* Gets the Actor input value from the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
371
371
|
*
|
|
372
372
|
* This is just a convenient shortcut for [`keyValueStore.getValue('INPUT')`](core/class/KeyValueStore#getValue).
|
|
373
373
|
* For example, calling the following code:
|
|
@@ -382,7 +382,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
382
382
|
* ```
|
|
383
383
|
*
|
|
384
384
|
* Note that the `getInput()` function does not cache the value read from the key-value store.
|
|
385
|
-
* If you need to use the input multiple times in your
|
|
385
|
+
* If you need to use the input multiple times in your Actor,
|
|
386
386
|
* it is far more efficient to read it once and store it locally.
|
|
387
387
|
*
|
|
388
388
|
* For more information, see {@apilink Actor.openKeyValueStore}
|
|
@@ -397,7 +397,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
397
397
|
*/
|
|
398
398
|
getInput<T = Dictionary | string | Buffer>(): Promise<T | null>;
|
|
399
399
|
/**
|
|
400
|
-
* Gets the
|
|
400
|
+
* Gets the Actor input value just like the {@apilink Actor.getInput} method,
|
|
401
401
|
* but throws if it is not found.
|
|
402
402
|
*/
|
|
403
403
|
getInputOrThrow<T = Dictionary | string | Buffer>(): Promise<T>;
|
|
@@ -412,7 +412,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
412
412
|
*
|
|
413
413
|
* @param [storeIdOrName]
|
|
414
414
|
* ID or name of the key-value store to be opened. If `null` or `undefined`,
|
|
415
|
-
* the function returns the default key-value store associated with the
|
|
415
|
+
* the function returns the default key-value store associated with the Actor run.
|
|
416
416
|
* @param [options]
|
|
417
417
|
* @ignore
|
|
418
418
|
*/
|
|
@@ -430,7 +430,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
430
430
|
*
|
|
431
431
|
* @param [queueIdOrName]
|
|
432
432
|
* ID or name of the request queue to be opened. If `null` or `undefined`,
|
|
433
|
-
* the function returns the default request queue associated with the
|
|
433
|
+
* the function returns the default request queue associated with the Actor run.
|
|
434
434
|
* @param [options]
|
|
435
435
|
* @ignore
|
|
436
436
|
*/
|
|
@@ -522,11 +522,11 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
522
522
|
*/
|
|
523
523
|
static useState<State extends Dictionary = Dictionary>(name?: string, defaultValue?: State, options?: UseStateOptions): Promise<State>;
|
|
524
524
|
/**
|
|
525
|
-
* Runs the main user function that performs the job of the
|
|
525
|
+
* Runs the main user function that performs the job of the Actor
|
|
526
526
|
* and terminates the process when the user function finishes.
|
|
527
527
|
*
|
|
528
528
|
* **The `Actor.main()` function is optional** and is provided merely for your convenience.
|
|
529
|
-
* It is mainly useful when you're running your code as an
|
|
529
|
+
* It is mainly useful when you're running your code as an Actor on the [Apify platform](https://apify.com/actors).
|
|
530
530
|
* However, if you want to use Apify SDK tools directly inside your existing projects, e.g.
|
|
531
531
|
* running in an [Express](https://expressjs.com/) server, on
|
|
532
532
|
* [Google Cloud functions](https://cloud.google.com/functions)
|
|
@@ -553,7 +553,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
553
553
|
* ```javascript
|
|
554
554
|
* await Actor.main(() => {
|
|
555
555
|
* // My synchronous function that returns immediately
|
|
556
|
-
* console.log('Hello world from
|
|
556
|
+
* console.log('Hello world from Actor!');
|
|
557
557
|
* });
|
|
558
558
|
* ```
|
|
559
559
|
*
|
|
@@ -588,7 +588,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
588
588
|
static main<T>(userFunc: UserFunc<T>, options?: MainOptions): Promise<T>;
|
|
589
589
|
static init(options?: InitOptions): Promise<void>;
|
|
590
590
|
/**
|
|
591
|
-
* Gracefully exits the
|
|
591
|
+
* Gracefully exits the Actor run with the provided status message and exit code.
|
|
592
592
|
* @param messageOrOptions First parameter accepts either a string (a terminal status message) or an `ExitOptions` object.
|
|
593
593
|
* @param options Second parameter accepts an `ExitOptions` object.
|
|
594
594
|
*/
|
|
@@ -602,13 +602,13 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
602
602
|
static on(event: EventTypeName, listener: (...args: any[]) => any): void;
|
|
603
603
|
static off(event: EventTypeName, listener?: (...args: any[]) => any): void;
|
|
604
604
|
/**
|
|
605
|
-
* Runs an
|
|
605
|
+
* Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
606
606
|
*
|
|
607
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
607
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
608
608
|
*
|
|
609
|
-
* If you want to run an
|
|
609
|
+
* If you want to run an Actor task rather than an Actor, please use the {@apilink Actor.callTask} function instead.
|
|
610
610
|
*
|
|
611
|
-
* For more information about
|
|
611
|
+
* For more information about Actors, read the [documentation](https://docs.apify.com/actor).
|
|
612
612
|
*
|
|
613
613
|
* **Example usage:**
|
|
614
614
|
*
|
|
@@ -617,24 +617,24 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
617
617
|
* ```
|
|
618
618
|
*
|
|
619
619
|
* @param actorId
|
|
620
|
-
* Allowed formats are `username/actor-name`, `userId/actor-name` or
|
|
620
|
+
* Allowed formats are `username/actor-name`, `userId/actor-name` or Actor ID.
|
|
621
621
|
* @param [input]
|
|
622
|
-
* Input for the
|
|
622
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
623
623
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
624
624
|
* Otherwise the `options.contentType` parameter must be provided.
|
|
625
625
|
* @param [options]
|
|
626
626
|
*/
|
|
627
627
|
static call(actorId: string, input?: unknown, options?: CallOptions): Promise<ClientActorRun>;
|
|
628
628
|
/**
|
|
629
|
-
* Runs an
|
|
629
|
+
* Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
630
630
|
*
|
|
631
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
631
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
632
632
|
*
|
|
633
|
-
* Note that an
|
|
634
|
-
* If you want to run an
|
|
633
|
+
* Note that an Actor task is a saved input configuration and options for an Actor.
|
|
634
|
+
* If you want to run an Actor directly rather than an Actor task, please use the
|
|
635
635
|
* {@apilink Actor.call} function instead.
|
|
636
636
|
*
|
|
637
|
-
* For more information about
|
|
637
|
+
* For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
|
|
638
638
|
*
|
|
639
639
|
* **Example usage:**
|
|
640
640
|
*
|
|
@@ -645,19 +645,19 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
645
645
|
* @param taskId
|
|
646
646
|
* Allowed formats are `username/task-name`, `userId/task-name` or task ID.
|
|
647
647
|
* @param [input]
|
|
648
|
-
* Input overrides for the
|
|
648
|
+
* Input overrides for the Actor task. If it is an object, it will be stringified to
|
|
649
649
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
650
|
-
* Provided input will be merged with
|
|
650
|
+
* Provided input will be merged with Actor task input.
|
|
651
651
|
* @param [options]
|
|
652
652
|
*/
|
|
653
653
|
static callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
|
|
654
654
|
/**
|
|
655
|
-
* Runs an
|
|
655
|
+
* Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
|
|
656
656
|
* unlike `Actor.call`, this method just starts the run without waiting for finish.
|
|
657
657
|
*
|
|
658
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
658
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
659
659
|
*
|
|
660
|
-
* For more information about
|
|
660
|
+
* For more information about Actors, read the
|
|
661
661
|
* [documentation](https://docs.apify.com/actor).
|
|
662
662
|
*
|
|
663
663
|
* **Example usage:**
|
|
@@ -667,20 +667,20 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
667
667
|
* ```
|
|
668
668
|
*
|
|
669
669
|
* @param actorId
|
|
670
|
-
* Allowed formats are `username/actor-name`, `userId/actor-name` or
|
|
670
|
+
* Allowed formats are `username/actor-name`, `userId/actor-name` or Actor ID.
|
|
671
671
|
* @param [input]
|
|
672
|
-
* Input for the
|
|
672
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
673
673
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
674
674
|
* Otherwise the `options.contentType` parameter must be provided.
|
|
675
675
|
* @param [options]
|
|
676
676
|
*/
|
|
677
677
|
static start(actorId: string, input?: Dictionary, options?: CallOptions): Promise<ClientActorRun>;
|
|
678
678
|
/**
|
|
679
|
-
* Aborts given
|
|
679
|
+
* Aborts given Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
|
|
680
680
|
*
|
|
681
|
-
* The result of the function is an {@apilink ActorRun} object that contains details about the
|
|
681
|
+
* The result of the function is an {@apilink ActorRun} object that contains details about the Actor run.
|
|
682
682
|
*
|
|
683
|
-
* For more information about
|
|
683
|
+
* For more information about Actors, read the
|
|
684
684
|
* [documentation](https://docs.apify.com/actor).
|
|
685
685
|
*
|
|
686
686
|
* **Example usage:**
|
|
@@ -691,30 +691,30 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
691
691
|
*/
|
|
692
692
|
static abort(runId: string, options?: AbortOptions): Promise<ClientActorRun>;
|
|
693
693
|
/**
|
|
694
|
-
* Transforms this
|
|
694
|
+
* Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
|
|
695
695
|
* the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
|
|
696
696
|
* in the same default key-value store.
|
|
697
697
|
*
|
|
698
698
|
* @param targetActorId
|
|
699
|
-
* Either `username/actor-name` or
|
|
699
|
+
* Either `username/actor-name` or Actor ID of an Actor to which we want to metamorph.
|
|
700
700
|
* @param [input]
|
|
701
|
-
* Input for the
|
|
701
|
+
* Input for the Actor. If it is an object, it will be stringified to
|
|
702
702
|
* JSON and its content type set to `application/json; charset=utf-8`.
|
|
703
703
|
* Otherwise, the `options.contentType` parameter must be provided.
|
|
704
704
|
* @param [options]
|
|
705
705
|
*/
|
|
706
706
|
static metamorph(targetActorId: string, input?: unknown, options?: MetamorphOptions): Promise<void>;
|
|
707
707
|
/**
|
|
708
|
-
* Internally reboots this
|
|
708
|
+
* Internally reboots this Actor run. The system stops the current container and starts
|
|
709
709
|
* a new container with the same run id.
|
|
710
710
|
* This can be used to get the Actor out of irrecoverable error state and continue where it left off.
|
|
711
711
|
*/
|
|
712
712
|
static reboot(options?: RebootOptions): Promise<void>;
|
|
713
713
|
/**
|
|
714
|
-
* Creates an ad-hoc webhook for the current
|
|
715
|
-
* For more information about Apify
|
|
714
|
+
* Creates an ad-hoc webhook for the current Actor run, which lets you receive a notification when the Actor run finished or failed.
|
|
715
|
+
* For more information about Apify Actor webhooks, please see the [documentation](https://docs.apify.com/webhooks).
|
|
716
716
|
*
|
|
717
|
-
* Note that webhooks are only supported for
|
|
717
|
+
* Note that webhooks are only supported for Actors running on the Apify platform.
|
|
718
718
|
* In local environment, the function will print a warning and have no effect.
|
|
719
719
|
*
|
|
720
720
|
* @param options
|
|
@@ -723,7 +723,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
723
723
|
*/
|
|
724
724
|
static addWebhook(options: WebhookOptions): Promise<Webhook | undefined>;
|
|
725
725
|
/**
|
|
726
|
-
* Sets the status message for the current
|
|
726
|
+
* Sets the status message for the current Actor run.
|
|
727
727
|
*
|
|
728
728
|
* @param statusMessage The status message to set.
|
|
729
729
|
* @param [options]
|
|
@@ -734,7 +734,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
734
734
|
*/
|
|
735
735
|
static setStatusMessage(statusMessage: string, options?: SetStatusMessageOptions): Promise<ClientActorRun>;
|
|
736
736
|
/**
|
|
737
|
-
* Stores an object or an array of objects to the default {@apilink Dataset} of the current
|
|
737
|
+
* Stores an object or an array of objects to the default {@apilink Dataset} of the current Actor run.
|
|
738
738
|
*
|
|
739
739
|
* This is just a convenient shortcut for {@apilink Dataset.pushData}.
|
|
740
740
|
* For example, calling the following code:
|
|
@@ -751,7 +751,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
751
751
|
* For more information, see {@apilink Actor.openDataset} and {@apilink Dataset.pushData}
|
|
752
752
|
*
|
|
753
753
|
* **IMPORTANT**: Make sure to use the `await` keyword when calling `pushData()`,
|
|
754
|
-
* otherwise the
|
|
754
|
+
* otherwise the Actor process might finish before the data are stored!
|
|
755
755
|
*
|
|
756
756
|
* @param item Object or array of objects containing data to be stored in the default dataset.
|
|
757
757
|
* The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.
|
|
@@ -768,12 +768,12 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
768
768
|
*
|
|
769
769
|
* @param [datasetIdOrName]
|
|
770
770
|
* ID or name of the dataset to be opened. If `null` or `undefined`,
|
|
771
|
-
* the function returns the default dataset associated with the
|
|
771
|
+
* the function returns the default dataset associated with the Actor run.
|
|
772
772
|
* @param [options]
|
|
773
773
|
*/
|
|
774
774
|
static openDataset<Data extends Dictionary = Dictionary>(datasetIdOrName?: string | null, options?: OpenStorageOptions): Promise<Dataset<Data>>;
|
|
775
775
|
/**
|
|
776
|
-
* Gets a value from the default {@apilink KeyValueStore} associated with the current
|
|
776
|
+
* Gets a value from the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
777
777
|
*
|
|
778
778
|
* This is just a convenient shortcut for {@apilink KeyValueStore.getValue}.
|
|
779
779
|
* For example, calling the following code:
|
|
@@ -801,7 +801,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
801
801
|
*/
|
|
802
802
|
static getValue<T = unknown>(key: string): Promise<T | null>;
|
|
803
803
|
/**
|
|
804
|
-
* Stores or deletes a value in the default {@apilink KeyValueStore} associated with the current
|
|
804
|
+
* Stores or deletes a value in the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
805
805
|
*
|
|
806
806
|
* This is just a convenient shortcut for {@apilink KeyValueStore.setValue}.
|
|
807
807
|
* For example, calling the following code:
|
|
@@ -832,7 +832,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
832
832
|
*/
|
|
833
833
|
static setValue<T>(key: string, value: T | null, options?: RecordOptions): Promise<void>;
|
|
834
834
|
/**
|
|
835
|
-
* Gets the
|
|
835
|
+
* Gets the Actor input value from the default {@apilink KeyValueStore} associated with the current Actor run.
|
|
836
836
|
*
|
|
837
837
|
* This is just a convenient shortcut for {@apilink KeyValueStore.getValue | `keyValueStore.getValue('INPUT')`}.
|
|
838
838
|
* For example, calling the following code:
|
|
@@ -847,7 +847,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
847
847
|
* ```
|
|
848
848
|
*
|
|
849
849
|
* Note that the `getInput()` function does not cache the value read from the key-value store.
|
|
850
|
-
* If you need to use the input multiple times in your
|
|
850
|
+
* If you need to use the input multiple times in your Actor,
|
|
851
851
|
* it is far more efficient to read it once and store it locally.
|
|
852
852
|
*
|
|
853
853
|
* For more information, see {@apilink Actor.openKeyValueStore} and {@apilink KeyValueStore.getValue}.
|
|
@@ -860,7 +860,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
860
860
|
*/
|
|
861
861
|
static getInput<T = Dictionary | string | Buffer>(): Promise<T | null>;
|
|
862
862
|
/**
|
|
863
|
-
* Gets the
|
|
863
|
+
* Gets the Actor input value just like the {@apilink Actor.getInput} method,
|
|
864
864
|
* but throws if it is not found.
|
|
865
865
|
*/
|
|
866
866
|
static getInputOrThrow<T = Dictionary | string | Buffer>(): Promise<T>;
|
|
@@ -875,7 +875,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
875
875
|
*
|
|
876
876
|
* @param [storeIdOrName]
|
|
877
877
|
* ID or name of the key-value store to be opened. If `null` or `undefined`,
|
|
878
|
-
* the function returns the default key-value store associated with the
|
|
878
|
+
* the function returns the default key-value store associated with the Actor run.
|
|
879
879
|
* @param [options]
|
|
880
880
|
*/
|
|
881
881
|
static openKeyValueStore(storeIdOrName?: string | null, options?: OpenStorageOptions): Promise<KeyValueStore>;
|
|
@@ -892,7 +892,7 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
|
|
|
892
892
|
*
|
|
893
893
|
* @param [queueIdOrName]
|
|
894
894
|
* ID or name of the request queue to be opened. If `null` or `undefined`,
|
|
895
|
-
* the function returns the default request queue associated with the
|
|
895
|
+
* the function returns the default request queue associated with the Actor run.
|
|
896
896
|
* @param [options]
|
|
897
897
|
*/
|
|
898
898
|
static openRequestQueue(queueIdOrName?: string | null, options?: OpenStorageOptions): Promise<RequestQueue>;
|
|
@@ -974,15 +974,15 @@ export interface MainOptions extends ExitOptions, InitOptions {
|
|
|
974
974
|
*/
|
|
975
975
|
export interface ApifyEnv {
|
|
976
976
|
/**
|
|
977
|
-
* ID of the
|
|
977
|
+
* ID of the Actor (ACTOR_ID)
|
|
978
978
|
*/
|
|
979
979
|
actorId: string | null;
|
|
980
980
|
/**
|
|
981
|
-
* ID of the
|
|
981
|
+
* ID of the Actor run (ACTOR_RUN_ID)
|
|
982
982
|
*/
|
|
983
983
|
actorRunId: string | null;
|
|
984
984
|
/**
|
|
985
|
-
* ID of the
|
|
985
|
+
* ID of the Actor task (ACTOR_TASK_ID)
|
|
986
986
|
*/
|
|
987
987
|
actorTaskId: string | null;
|
|
988
988
|
/**
|
|
@@ -990,35 +990,35 @@ export interface ApifyEnv {
|
|
|
990
990
|
*/
|
|
991
991
|
actorBuildId: string | null;
|
|
992
992
|
/**
|
|
993
|
-
* ID of the user who started the
|
|
994
|
-
* different than the owner of the
|
|
993
|
+
* ID of the user who started the Actor - note that it might be
|
|
994
|
+
* different than the owner of the Actor (APIFY_USER_ID)
|
|
995
995
|
*/
|
|
996
996
|
userId: string | null;
|
|
997
997
|
/**
|
|
998
|
-
* Authentication token representing privileges given to the
|
|
998
|
+
* Authentication token representing privileges given to the Actor run,
|
|
999
999
|
* it can be passed to various Apify APIs (APIFY_TOKEN)
|
|
1000
1000
|
*/
|
|
1001
1001
|
token: string | null;
|
|
1002
1002
|
/**
|
|
1003
|
-
* Date when the
|
|
1003
|
+
* Date when the Actor was started (ACTOR_STARTED_AT)
|
|
1004
1004
|
*/
|
|
1005
1005
|
startedAt: Date | null;
|
|
1006
1006
|
/**
|
|
1007
|
-
* Date when the
|
|
1007
|
+
* Date when the Actor will time out (ACTOR_TIMEOUT_AT)
|
|
1008
1008
|
*/
|
|
1009
1009
|
timeoutAt: Date | null;
|
|
1010
1010
|
/**
|
|
1011
1011
|
* ID of the key-value store where input and output data of this
|
|
1012
|
-
*
|
|
1012
|
+
* Actor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)
|
|
1013
1013
|
*/
|
|
1014
1014
|
defaultKeyValueStoreId: string | null;
|
|
1015
1015
|
/**
|
|
1016
1016
|
* ID of the dataset where input and output data of this
|
|
1017
|
-
*
|
|
1017
|
+
* Actor is stored (ACTOR_DEFAULT_DATASET_ID)
|
|
1018
1018
|
*/
|
|
1019
1019
|
defaultDatasetId: string | null;
|
|
1020
1020
|
/**
|
|
1021
|
-
* Amount of memory allocated for the
|
|
1021
|
+
* Amount of memory allocated for the Actor,
|
|
1022
1022
|
* in megabytes (ACTOR_MEMORY_MBYTES)
|
|
1023
1023
|
*/
|
|
1024
1024
|
memoryMbytes: number | null;
|
|
@@ -1064,12 +1064,12 @@ export interface ApifyEnv {
|
|
|
1064
1064
|
logLevel: string | null;
|
|
1065
1065
|
logFormat: string | null;
|
|
1066
1066
|
/**
|
|
1067
|
-
* Origin for the
|
|
1067
|
+
* Origin for the Actor run, i.e. how it was started. See [here](https://docs.apify.com/sdk/python/reference/enum/MetaOrigin)
|
|
1068
1068
|
* for more details. (APIFY_META_ORIGIN)
|
|
1069
1069
|
*/
|
|
1070
1070
|
metaOrigin: string | null;
|
|
1071
1071
|
/**
|
|
1072
|
-
* The key of the input record in the
|
|
1072
|
+
* The key of the input record in the Actor’s default key-value store (ACTOR_INPUT_KEY)
|
|
1073
1073
|
*/
|
|
1074
1074
|
inputKey: string | null;
|
|
1075
1075
|
sdkLatestVersion: string | null;
|
|
@@ -1085,19 +1085,19 @@ export interface ApifyEnv {
|
|
|
1085
1085
|
export type UserFunc<T = unknown> = () => Awaitable<T>;
|
|
1086
1086
|
export interface CallOptions extends ActorCallOptions {
|
|
1087
1087
|
/**
|
|
1088
|
-
* User API token that is used to run the
|
|
1088
|
+
* User API token that is used to run the Actor. By default, it is taken from the `APIFY_TOKEN` environment variable.
|
|
1089
1089
|
*/
|
|
1090
1090
|
token?: string;
|
|
1091
1091
|
}
|
|
1092
1092
|
export interface CallTaskOptions extends TaskCallOptions {
|
|
1093
1093
|
/**
|
|
1094
|
-
* User API token that is used to run the
|
|
1094
|
+
* User API token that is used to run the Actor. By default, it is taken from the `APIFY_TOKEN` environment variable.
|
|
1095
1095
|
*/
|
|
1096
1096
|
token?: string;
|
|
1097
1097
|
}
|
|
1098
1098
|
export interface AbortOptions extends RunAbortOptions {
|
|
1099
1099
|
/**
|
|
1100
|
-
* User API token that is used to run the
|
|
1100
|
+
* User API token that is used to run the Actor. By default, it is taken from the `APIFY_TOKEN` environment variable.
|
|
1101
1101
|
*/
|
|
1102
1102
|
token?: string;
|
|
1103
1103
|
/** Exit with given status message */
|
|
@@ -1105,12 +1105,12 @@ export interface AbortOptions extends RunAbortOptions {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
export interface WebhookOptions {
|
|
1107
1107
|
/**
|
|
1108
|
-
* Array of event types, which you can set for
|
|
1109
|
-
* the [
|
|
1108
|
+
* Array of event types, which you can set for Actor run, see
|
|
1109
|
+
* the [Actor run events](https://docs.apify.com/webhooks/events#actor-run) in the Apify doc.
|
|
1110
1110
|
*/
|
|
1111
1111
|
eventTypes: readonly WebhookEventType[];
|
|
1112
1112
|
/**
|
|
1113
|
-
* URL which will be requested using HTTP POST request, when
|
|
1113
|
+
* URL which will be requested using HTTP POST request, when Actor run will reach the set event type.
|
|
1114
1114
|
*/
|
|
1115
1115
|
requestUrl: string;
|
|
1116
1116
|
/**
|
|
@@ -1124,8 +1124,8 @@ export interface WebhookOptions {
|
|
|
1124
1124
|
payloadTemplate?: string;
|
|
1125
1125
|
/**
|
|
1126
1126
|
* Idempotency key enables you to ensure that a webhook will not be added multiple times in case of
|
|
1127
|
-
* an
|
|
1128
|
-
* We suggest using the
|
|
1127
|
+
* an Actor restart or other situation that would cause the `addWebhook()` function to be called again.
|
|
1128
|
+
* We suggest using the Actor run ID as the idempotency key. You can get the run ID by calling
|
|
1129
1129
|
* {@apilink Actor.getEnv} function.
|
|
1130
1130
|
*/
|
|
1131
1131
|
idempotencyKey?: string;
|
|
@@ -1139,8 +1139,8 @@ export interface MetamorphOptions {
|
|
|
1139
1139
|
*/
|
|
1140
1140
|
contentType?: string;
|
|
1141
1141
|
/**
|
|
1142
|
-
* Tag or number of the target
|
|
1143
|
-
* If not provided, the run uses build tag or number from the default
|
|
1142
|
+
* Tag or number of the target Actor build to metamorph into (e.g. `beta` or `1.2.345`).
|
|
1143
|
+
* If not provided, the run uses build tag or number from the default Actor run configuration (typically `latest`).
|
|
1144
1144
|
*/
|
|
1145
1145
|
build?: string;
|
|
1146
1146
|
/** @internal */
|
|
@@ -1173,7 +1173,7 @@ export interface OpenStorageOptions {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
export { ClientActorRun as ActorRun };
|
|
1175
1175
|
/**
|
|
1176
|
-
* Exit codes for the
|
|
1176
|
+
* Exit codes for the Actor process.
|
|
1177
1177
|
* The error codes must be in the range 1-128, to avoid collision with signal exits
|
|
1178
1178
|
* and to ensure Docker will handle them correctly!
|
|
1179
1179
|
* @internal should be removed if we decide to remove `Actor.main()`
|