apify 4.0.0-beta.58 → 4.0.0-beta.60

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
@@ -1,7 +1,7 @@
1
1
  import type { EventManager, EventTypeName, RecordOptions, UseStateOptions } from '@crawlee/core';
2
2
  import { Dataset, KeyValueStore, RequestQueue } from '@crawlee/core';
3
3
  import type { Awaitable, Dictionary, StorageBackend } from '@crawlee/types';
4
- import type { ActorCallOptions, ActorInput, ActorStartOptions, ApifyClientOptions, RunAbortOptions, TaskCallOptions, WebhookResource, WebhookEventType } from 'apify-client';
4
+ import type { ActorCallOptions, ActorInput, ActorStartOptions, ApifyClientOptions, RunAbortOptions, RunResurrectOptions, TaskCallOptions, TaskStartOptions, WebhookResource, WebhookEventType } from 'apify-client';
5
5
  import { ApifyClient, Run as ClientActorRun } from 'apify-client';
6
6
  import { type ACTOR_PERMISSION_LEVEL } from '@apify/consts';
7
7
  import type { RequestQueueAccessMode } from './apify_request_queue_backend.js';
@@ -228,6 +228,10 @@ export interface StartOptions extends Omit<ActorStartOptions, 'waitForFinish' |
228
228
  }
229
229
  export interface CallTaskOptions extends Omit<TaskCallOptions, 'runTimeoutSecs'>, Token, Timeout {
230
230
  }
231
+ export interface ResurrectOptions extends Omit<RunResurrectOptions, 'runTimeoutSecs'>, Token, Timeout {
232
+ }
233
+ export interface StartTaskOptions extends Omit<TaskStartOptions, 'waitForFinish' | 'runTimeoutSecs'>, Token, Timeout {
234
+ }
231
235
  export interface AbortOptions extends RunAbortOptions, Token {
232
236
  /** Exit with given status message */
233
237
  statusMessage?: string;
@@ -492,6 +496,25 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
492
496
  * @ignore
493
497
  */
494
498
  abort(runId: string, options?: AbortOptions): Promise<ClientActorRun>;
499
+ /**
500
+ * Resurrects a finished Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
501
+ *
502
+ * Only finished runs (SUCCEEDED, FAILED, ABORTED or TIMED-OUT) can be resurrected. The run goes back to the RUNNING
503
+ * status and keeps its default storages. Options you leave out keep the values of the original run.
504
+ *
505
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
506
+ *
507
+ * For more information about Actors, read the
508
+ * [documentation](https://docs.apify.com/actor).
509
+ *
510
+ * **Example usage:**
511
+ *
512
+ * ```js
513
+ * const run = await Actor.resurrect(runId);
514
+ * ```
515
+ * @ignore
516
+ */
517
+ resurrect(runId: string, options?: ResurrectOptions): Promise<ClientActorRun>;
495
518
  /**
496
519
  * Runs an actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
497
520
  *
@@ -519,6 +542,30 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
519
542
  * @ignore
520
543
  */
521
544
  callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
545
+ /**
546
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
547
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
548
+ *
549
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
550
+ *
551
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
552
+ *
553
+ * **Example usage:**
554
+ *
555
+ * ```js
556
+ * const run = await Actor.startTask('bob/some-task');
557
+ * ```
558
+ *
559
+ * @param taskId
560
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
561
+ * @param [input]
562
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
563
+ * JSON and its content type set to `application/json; charset=utf-8`.
564
+ * Provided input will be merged with Actor task input.
565
+ * @param [options]
566
+ * @ignore
567
+ */
568
+ startTask(taskId: string, input?: Dictionary, options?: StartTaskOptions): Promise<ClientActorRun>;
522
569
  /**
523
570
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
524
571
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
@@ -1010,6 +1057,29 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1010
1057
  * @param [options]
1011
1058
  */
1012
1059
  static callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
1060
+ /**
1061
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1062
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
1063
+ *
1064
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1065
+ *
1066
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
1067
+ *
1068
+ * **Example usage:**
1069
+ *
1070
+ * ```js
1071
+ * const run = await Actor.startTask('bob/some-task');
1072
+ * ```
1073
+ *
1074
+ * @param taskId
1075
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
1076
+ * @param [input]
1077
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
1078
+ * JSON and its content type set to `application/json; charset=utf-8`.
1079
+ * Provided input will be merged with Actor task input.
1080
+ * @param [options]
1081
+ */
1082
+ static startTask(taskId: string, input?: Dictionary, options?: StartTaskOptions): Promise<ClientActorRun>;
1013
1083
  /**
1014
1084
  * Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1015
1085
  * unlike `Actor.call`, this method just starts the run without waiting for finish.
@@ -1048,6 +1118,24 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1048
1118
  * ```
1049
1119
  */
1050
1120
  static abort(runId: string, options?: AbortOptions): Promise<ClientActorRun>;
1121
+ /**
1122
+ * Resurrects a finished Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
1123
+ *
1124
+ * Only finished runs (SUCCEEDED, FAILED, ABORTED or TIMED-OUT) can be resurrected. The run goes back to the RUNNING
1125
+ * status and keeps its default storages. Options you leave out keep the values of the original run.
1126
+ *
1127
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1128
+ *
1129
+ * For more information about Actors, read the
1130
+ * [documentation](https://docs.apify.com/actor).
1131
+ *
1132
+ * **Example usage:**
1133
+ *
1134
+ * ```js
1135
+ * const run = await Actor.resurrect(runId);
1136
+ * ```
1137
+ */
1138
+ static resurrect(runId: string, options?: ResurrectOptions): Promise<ClientActorRun>;
1051
1139
  /**
1052
1140
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
1053
1141
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
package/dist/actor.js CHANGED
@@ -459,6 +459,30 @@ export class Actor {
459
459
  }
460
460
  return client.run(runId).abort(rest);
461
461
  }
462
+ /**
463
+ * Resurrects a finished Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
464
+ *
465
+ * Only finished runs (SUCCEEDED, FAILED, ABORTED or TIMED-OUT) can be resurrected. The run goes back to the RUNNING
466
+ * status and keeps its default storages. Options you leave out keep the values of the original run.
467
+ *
468
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
469
+ *
470
+ * For more information about Actors, read the
471
+ * [documentation](https://docs.apify.com/actor).
472
+ *
473
+ * **Example usage:**
474
+ *
475
+ * ```js
476
+ * const run = await Actor.resurrect(runId);
477
+ * ```
478
+ * @ignore
479
+ */
480
+ async resurrect(runId, options = {}) {
481
+ const runTimeoutSecs = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
482
+ const { token, timeout: _timeout, ...rest } = options;
483
+ const client = token ? this.newClient({ token }) : this.apifyClient;
484
+ return client.run(runId).resurrect({ ...rest, runTimeoutSecs });
485
+ }
462
486
  /**
463
487
  * Runs an actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
464
488
  *
@@ -491,6 +515,35 @@ export class Actor {
491
515
  const client = token ? this.newClient({ token }) : this.apifyClient;
492
516
  return client.task(taskId).call(input, { ...rest, runTimeoutSecs });
493
517
  }
518
+ /**
519
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
520
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
521
+ *
522
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
523
+ *
524
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
525
+ *
526
+ * **Example usage:**
527
+ *
528
+ * ```js
529
+ * const run = await Actor.startTask('bob/some-task');
530
+ * ```
531
+ *
532
+ * @param taskId
533
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
534
+ * @param [input]
535
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
536
+ * JSON and its content type set to `application/json; charset=utf-8`.
537
+ * Provided input will be merged with Actor task input.
538
+ * @param [options]
539
+ * @ignore
540
+ */
541
+ async startTask(taskId, input, options = {}) {
542
+ const runTimeoutSecs = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
543
+ const { token, timeout: _timeout, ...rest } = options;
544
+ const client = token ? this.newClient({ token }) : this.apifyClient;
545
+ return client.task(taskId).start(input, { ...rest, runTimeoutSecs });
546
+ }
494
547
  /**
495
548
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
496
549
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
@@ -1313,6 +1366,31 @@ export class Actor {
1313
1366
  static async callTask(taskId, input, options = {}) {
1314
1367
  return Actor.getDefaultInstance().callTask(taskId, input, options);
1315
1368
  }
1369
+ /**
1370
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1371
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
1372
+ *
1373
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1374
+ *
1375
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
1376
+ *
1377
+ * **Example usage:**
1378
+ *
1379
+ * ```js
1380
+ * const run = await Actor.startTask('bob/some-task');
1381
+ * ```
1382
+ *
1383
+ * @param taskId
1384
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
1385
+ * @param [input]
1386
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
1387
+ * JSON and its content type set to `application/json; charset=utf-8`.
1388
+ * Provided input will be merged with Actor task input.
1389
+ * @param [options]
1390
+ */
1391
+ static async startTask(taskId, input, options = {}) {
1392
+ return Actor.getDefaultInstance().startTask(taskId, input, options);
1393
+ }
1316
1394
  /**
1317
1395
  * Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1318
1396
  * unlike `Actor.call`, this method just starts the run without waiting for finish.
@@ -1355,6 +1433,26 @@ export class Actor {
1355
1433
  static async abort(runId, options = {}) {
1356
1434
  return Actor.getDefaultInstance().abort(runId, options);
1357
1435
  }
1436
+ /**
1437
+ * Resurrects a finished Actor run on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable).
1438
+ *
1439
+ * Only finished runs (SUCCEEDED, FAILED, ABORTED or TIMED-OUT) can be resurrected. The run goes back to the RUNNING
1440
+ * status and keeps its default storages. Options you leave out keep the values of the original run.
1441
+ *
1442
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1443
+ *
1444
+ * For more information about Actors, read the
1445
+ * [documentation](https://docs.apify.com/actor).
1446
+ *
1447
+ * **Example usage:**
1448
+ *
1449
+ * ```js
1450
+ * const run = await Actor.resurrect(runId);
1451
+ * ```
1452
+ */
1453
+ static async resurrect(runId, options = {}) {
1454
+ return Actor.getDefaultInstance().resurrect(runId, options);
1455
+ }
1358
1456
  /**
1359
1457
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
1360
1458
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "4.0.0-beta.58",
3
+ "version": "4.0.0-beta.60",
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"