apify 4.0.0-beta.57 → 4.0.0-beta.59

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, 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,8 @@ 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 StartTaskOptions extends Omit<TaskStartOptions, 'waitForFinish' | 'runTimeoutSecs'>, Token, Timeout {
232
+ }
231
233
  export interface AbortOptions extends RunAbortOptions, Token {
232
234
  /** Exit with given status message */
233
235
  statusMessage?: string;
@@ -519,6 +521,30 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
519
521
  * @ignore
520
522
  */
521
523
  callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
524
+ /**
525
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
526
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
527
+ *
528
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
529
+ *
530
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
531
+ *
532
+ * **Example usage:**
533
+ *
534
+ * ```js
535
+ * const run = await Actor.startTask('bob/some-task');
536
+ * ```
537
+ *
538
+ * @param taskId
539
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
540
+ * @param [input]
541
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
542
+ * JSON and its content type set to `application/json; charset=utf-8`.
543
+ * Provided input will be merged with Actor task input.
544
+ * @param [options]
545
+ * @ignore
546
+ */
547
+ startTask(taskId: string, input?: Dictionary, options?: StartTaskOptions): Promise<ClientActorRun>;
522
548
  /**
523
549
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
524
550
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
@@ -1010,6 +1036,29 @@ export declare class Actor<Data extends Dictionary = Dictionary> {
1010
1036
  * @param [options]
1011
1037
  */
1012
1038
  static callTask(taskId: string, input?: Dictionary, options?: CallTaskOptions): Promise<ClientActorRun>;
1039
+ /**
1040
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1041
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
1042
+ *
1043
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1044
+ *
1045
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
1046
+ *
1047
+ * **Example usage:**
1048
+ *
1049
+ * ```js
1050
+ * const run = await Actor.startTask('bob/some-task');
1051
+ * ```
1052
+ *
1053
+ * @param taskId
1054
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
1055
+ * @param [input]
1056
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
1057
+ * JSON and its content type set to `application/json; charset=utf-8`.
1058
+ * Provided input will be merged with Actor task input.
1059
+ * @param [options]
1060
+ */
1061
+ static startTask(taskId: string, input?: Dictionary, options?: StartTaskOptions): Promise<ClientActorRun>;
1013
1062
  /**
1014
1063
  * Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1015
1064
  * unlike `Actor.call`, this method just starts the run without waiting for finish.
package/dist/actor.js CHANGED
@@ -491,6 +491,35 @@ export class Actor {
491
491
  const client = token ? this.newClient({ token }) : this.apifyClient;
492
492
  return client.task(taskId).call(input, { ...rest, runTimeoutSecs });
493
493
  }
494
+ /**
495
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
496
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
497
+ *
498
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
499
+ *
500
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
501
+ *
502
+ * **Example usage:**
503
+ *
504
+ * ```js
505
+ * const run = await Actor.startTask('bob/some-task');
506
+ * ```
507
+ *
508
+ * @param taskId
509
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
510
+ * @param [input]
511
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
512
+ * JSON and its content type set to `application/json; charset=utf-8`.
513
+ * Provided input will be merged with Actor task input.
514
+ * @param [options]
515
+ * @ignore
516
+ */
517
+ async startTask(taskId, input, options = {}) {
518
+ const runTimeoutSecs = options.timeout === 'inherit' ? this.getRemainingTimeSecs() : options.timeout;
519
+ const { token, timeout: _timeout, ...rest } = options;
520
+ const client = token ? this.newClient({ token }) : this.apifyClient;
521
+ return client.task(taskId).start(input, { ...rest, runTimeoutSecs });
522
+ }
494
523
  /**
495
524
  * Transforms this Actor run to an Actor run of a given Actor. The system stops the current container and starts
496
525
  * the new container instead. All the default storages are preserved and the new input is stored under the `INPUT-METAMORPH-1` key
@@ -1313,6 +1342,31 @@ export class Actor {
1313
1342
  static async callTask(taskId, input, options = {}) {
1314
1343
  return Actor.getDefaultInstance().callTask(taskId, input, options);
1315
1344
  }
1345
+ /**
1346
+ * Runs an Actor task on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1347
+ * unlike `Actor.callTask`, this method just starts the run without waiting for finish.
1348
+ *
1349
+ * The result of the function is an {@link ActorRun} object that contains details about the Actor run.
1350
+ *
1351
+ * For more information about Actor tasks, read the [documentation](https://docs.apify.com/tasks).
1352
+ *
1353
+ * **Example usage:**
1354
+ *
1355
+ * ```js
1356
+ * const run = await Actor.startTask('bob/some-task');
1357
+ * ```
1358
+ *
1359
+ * @param taskId
1360
+ * Allowed formats are `username/task-name`, `userId/task-name` or task ID.
1361
+ * @param [input]
1362
+ * Input overrides for the Actor task. If it is an object, it will be stringified to
1363
+ * JSON and its content type set to `application/json; charset=utf-8`.
1364
+ * Provided input will be merged with Actor task input.
1365
+ * @param [options]
1366
+ */
1367
+ static async startTask(taskId, input, options = {}) {
1368
+ return Actor.getDefaultInstance().startTask(taskId, input, options);
1369
+ }
1316
1370
  /**
1317
1371
  * Runs an Actor on the Apify platform using the current user account (determined by the `APIFY_TOKEN` environment variable),
1318
1372
  * unlike `Actor.call`, this method just starts the run without waiting for finish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "4.0.0-beta.57",
3
+ "version": "4.0.0-beta.59",
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"