apify-client 3.0.0-beta.2 → 3.0.0-beta.21

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.
Files changed (99) hide show
  1. package/README.md +7 -3
  2. package/dist/apify_api_error.d.ts +60 -19
  3. package/dist/apify_api_error.js +88 -22
  4. package/dist/apify_client.d.ts +22 -3
  5. package/dist/apify_client.js +37 -31
  6. package/dist/base/api_client.d.ts +6 -6
  7. package/dist/base/api_client.js +24 -16
  8. package/dist/base/resource_client.d.ts +23 -9
  9. package/dist/base/resource_client.js +49 -25
  10. package/dist/base/resource_collection_client.d.ts +7 -4
  11. package/dist/base/resource_collection_client.js +21 -15
  12. package/dist/body_parser.d.ts +3 -4
  13. package/dist/body_parser.js +17 -24
  14. package/dist/bundle.js +38 -48
  15. package/dist/bundle.js.map +1 -1
  16. package/dist/generated/api.d.ts +287 -214
  17. package/dist/generated/schemas.d.ts +6699 -0
  18. package/dist/generated/schemas.js +1521 -0
  19. package/dist/http_client.d.ts +18 -51
  20. package/dist/http_client.js +90 -85
  21. package/dist/index.d.ts +3 -1
  22. package/dist/index.js +2 -1
  23. package/dist/interceptors.js +24 -6
  24. package/dist/lazy_schema.d.ts +8 -0
  25. package/dist/lazy_schema.js +11 -0
  26. package/dist/models.d.ts +32 -52
  27. package/dist/resource_clients/actor.d.ts +46 -31
  28. package/dist/resource_clients/actor.js +71 -53
  29. package/dist/resource_clients/actor_collection.d.ts +9 -5
  30. package/dist/resource_clients/actor_collection.js +12 -3
  31. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  32. package/dist/resource_clients/actor_env_var.js +17 -6
  33. package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
  34. package/dist/resource_clients/actor_env_var_collection.js +18 -11
  35. package/dist/resource_clients/actor_version.d.ts +18 -3
  36. package/dist/resource_clients/actor_version.js +20 -9
  37. package/dist/resource_clients/actor_version_collection.d.ts +16 -17
  38. package/dist/resource_clients/actor_version_collection.js +20 -11
  39. package/dist/resource_clients/build.d.ts +18 -6
  40. package/dist/resource_clients/build.js +35 -17
  41. package/dist/resource_clients/build_collection.d.ts +3 -1
  42. package/dist/resource_clients/build_collection.js +5 -1
  43. package/dist/resource_clients/dataset.d.ts +23 -9
  44. package/dist/resource_clients/dataset.js +70 -48
  45. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  46. package/dist/resource_clients/dataset_collection.js +13 -2
  47. package/dist/resource_clients/key_value_store.d.ts +48 -15
  48. package/dist/resource_clients/key_value_store.js +71 -40
  49. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  50. package/dist/resource_clients/key_value_store_collection.js +13 -2
  51. package/dist/resource_clients/log.d.ts +9 -19
  52. package/dist/resource_clients/log.js +57 -45
  53. package/dist/resource_clients/request_queue.d.ts +56 -26
  54. package/dist/resource_clients/request_queue.js +178 -113
  55. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  56. package/dist/resource_clients/request_queue_collection.js +10 -3
  57. package/dist/resource_clients/run.d.ts +51 -17
  58. package/dist/resource_clients/run.js +85 -44
  59. package/dist/resource_clients/run_collection.d.ts +3 -1
  60. package/dist/resource_clients/run_collection.js +5 -1
  61. package/dist/resource_clients/schedule.d.ts +16 -7
  62. package/dist/resource_clients/schedule.js +31 -21
  63. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  64. package/dist/resource_clients/schedule_collection.js +10 -3
  65. package/dist/resource_clients/store_collection.d.ts +3 -1
  66. package/dist/resource_clients/store_collection.js +5 -1
  67. package/dist/resource_clients/task.d.ts +28 -10
  68. package/dist/resource_clients/task.js +67 -44
  69. package/dist/resource_clients/task_collection.d.ts +6 -2
  70. package/dist/resource_clients/task_collection.js +10 -3
  71. package/dist/resource_clients/user.d.ts +17 -8
  72. package/dist/resource_clients/user.js +40 -39
  73. package/dist/resource_clients/webhook.d.ts +14 -5
  74. package/dist/resource_clients/webhook.js +30 -22
  75. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  76. package/dist/resource_clients/webhook_collection.js +10 -3
  77. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  78. package/dist/resource_clients/webhook_dispatch.js +8 -2
  79. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  80. package/dist/resource_clients/webhook_dispatch_collection.js +5 -1
  81. package/dist/response_validation_error.d.ts +26 -0
  82. package/dist/response_validation_error.js +37 -0
  83. package/dist/runtime/node.d.ts +6 -0
  84. package/dist/runtime/node.js +58 -0
  85. package/dist/runtime/types.d.ts +50 -0
  86. package/dist/runtime/types.js +1 -0
  87. package/dist/runtime/web.d.ts +5 -0
  88. package/dist/runtime/web.js +17 -0
  89. package/dist/schemas.d.ts +15 -0
  90. package/dist/schemas.js +15 -0
  91. package/dist/statistics.d.ts +1 -6
  92. package/dist/statistics.js +2 -2
  93. package/dist/timeouts.d.ts +72 -0
  94. package/dist/timeouts.js +31 -0
  95. package/dist/utils.d.ts +75 -55
  96. package/dist/utils.js +201 -180
  97. package/package.json +42 -35
  98. package/dist/argument_validation_error.d.ts +0 -17
  99. package/dist/argument_validation_error.js +0 -153
package/dist/models.d.ts CHANGED
@@ -48,6 +48,12 @@ export declare enum WebhookDispatchStatus {
48
48
  Succeeded = "SUCCEEDED",
49
49
  Failed = "FAILED"
50
50
  }
51
+ /**
52
+ * Machine-readable type of an error returned by the Apify API, carried by `ApifyApiError.type`.
53
+ *
54
+ * Declared here, next to the other spec-derived types, and re-exported from `./apify_api_error`.
55
+ */
56
+ export type ApifyApiErrorType = Schemas['ErrorType'];
51
57
  /**
52
58
  * Fields the API returns on a dataset that the OpenAPI spec does not describe yet.
53
59
  *
@@ -59,9 +65,9 @@ export interface DatasetSpecGaps {
59
65
  }
60
66
  export interface DatasetRePointed {
61
67
  stats?: DatasetStats;
68
+ generalAccess?: STORAGE_GENERAL_ACCESS | null;
62
69
  }
63
70
  export interface DatasetSpecNarrowings {
64
- generalAccess?: STORAGE_GENERAL_ACCESS | null;
65
71
  consoleUrl?: string;
66
72
  }
67
73
  /**
@@ -145,8 +151,6 @@ export interface KeyValueStoreSpecGaps {
145
151
  }
146
152
  export interface KeyValueStoreRePointed {
147
153
  stats?: KeyValueStoreStats;
148
- }
149
- export interface KeyValueStoreSpecNarrowings {
150
154
  generalAccess?: STORAGE_GENERAL_ACCESS | null;
151
155
  }
152
156
  /**
@@ -155,7 +159,7 @@ export interface KeyValueStoreSpecNarrowings {
155
159
  * Key-value stores are used to store arbitrary data records or files. Each record is identified
156
160
  * by a unique key and can contain any data - JSON objects, strings, binary files, etc.
157
161
  */
158
- export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed | keyof KeyValueStoreSpecNarrowings>, KeyValueStoreRePointed, KeyValueStoreSpecNarrowings, KeyValueStoreSpecGaps {
162
+ export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed>, KeyValueStoreRePointed, KeyValueStoreSpecGaps {
159
163
  }
160
164
  /** Statistics about Key-Value Store usage and storage. */
161
165
  export interface KeyValueStoreStats extends GeneratedKeyValueStoreStats {
@@ -215,7 +219,7 @@ export interface ActorVersionRePointed {
215
219
  envVars?: ActorEnvironmentVariable[] | null;
216
220
  }
217
221
  export interface ActorVersionClientNarrowings {
218
- sourceType: ActorSourceType;
222
+ sourceType: `${ActorSourceType}`;
219
223
  }
220
224
  /**
221
225
  * Fields every Actor version carries, whatever its source type.
@@ -224,26 +228,26 @@ export interface ActorVersionClientNarrowings {
224
228
  * keeps a union discriminated on `sourceType` instead, because that narrows the source location down
225
229
  * to the single field which applies -- so the four are dropped here and reinstated per variant.
226
230
  */
227
- export interface BaseActorVersion<SourceType extends ActorSourceType> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {
231
+ export interface BaseActorVersion<SourceType extends `${ActorSourceType}`> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {
228
232
  sourceType: SourceType;
229
233
  }
230
234
  /**
231
235
  * An Actor version whose source code is stored on the Apify platform.
232
236
  * @since Added in 2.6.1
233
237
  */
234
- export interface ActorVersionSourceFiles extends BaseActorVersion<ActorSourceType.SourceFiles> {
238
+ export interface ActorVersionSourceFiles extends BaseActorVersion<`${ActorSourceType.SourceFiles}`> {
235
239
  sourceFiles: (ActorVersionSourceFile | ActorVersionSourceFolder)[];
236
240
  }
237
241
  /** An Actor version built from a Git repository. */
238
- export interface ActorVersionGitRepo extends BaseActorVersion<ActorSourceType.GitRepo> {
242
+ export interface ActorVersionGitRepo extends BaseActorVersion<`${ActorSourceType.GitRepo}`> {
239
243
  gitRepoUrl: NonNullable<GeneratedVersion['gitRepoUrl']>;
240
244
  }
241
245
  /** An Actor version built from a downloadable tarball or ZIP archive. */
242
- export interface ActorVersionTarball extends BaseActorVersion<ActorSourceType.Tarball> {
246
+ export interface ActorVersionTarball extends BaseActorVersion<`${ActorSourceType.Tarball}`> {
243
247
  tarballUrl: NonNullable<GeneratedVersion['tarballUrl']>;
244
248
  }
245
249
  /** An Actor version built from a GitHub Gist. */
246
- export interface ActorVersionGitHubGist extends BaseActorVersion<ActorSourceType.GitHubGist> {
250
+ export interface ActorVersionGitHubGist extends BaseActorVersion<`${ActorSourceType.GitHubGist}`> {
247
251
  gitHubGistUrl: NonNullable<GeneratedVersion['gitHubGistUrl']>;
248
252
  }
249
253
  /**
@@ -252,7 +256,7 @@ export interface ActorVersionGitHubGist extends BaseActorVersion<ActorSourceType
252
256
  * It carries no source location of its own, so it adds nothing to `BaseActorVersion`; the variant
253
257
  * exists so that `SOURCE_CODE`, which both the spec and `@apify/consts` list, is representable.
254
258
  */
255
- export interface ActorVersionSourceCode extends BaseActorVersion<ActorSourceType.SourceCode> {
259
+ export interface ActorVersionSourceCode extends BaseActorVersion<`${ActorSourceType.SourceCode}`> {
256
260
  }
257
261
  /** A version of an Actor, discriminated on where its source code comes from. */
258
262
  export type ActorVersion = ActorVersionSourceFiles | ActorVersionGitRepo | ActorVersionTarball | ActorVersionGitHubGist | ActorVersionSourceCode;
@@ -310,11 +314,7 @@ export interface ActorDefinitionSpecGaps {
310
314
  */
311
315
  output?: object | null;
312
316
  }
313
- export interface ActorDefinitionSpecNarrowings {
314
- readme?: string | null;
315
- input?: object | null;
316
- changelog?: string | null;
317
- }
317
+ type GeneratedActorDefinition = Schemas['ActorDefinition'];
318
318
  /**
319
319
  * Actor definition from the `.actor/actor.json` file.
320
320
  *
@@ -322,7 +322,7 @@ export interface ActorDefinitionSpecNarrowings {
322
322
  * @see https://docs.apify.com/platform/actors/development/actor-definition/actor-json
323
323
  * @since Added in 2.11.0
324
324
  */
325
- export interface ActorDefinition extends Omit<Schemas['ActorDefinition'], keyof ActorDefinitionSpecNarrowings>, ActorDefinitionSpecNarrowings, ActorDefinitionSpecGaps {
325
+ export interface ActorDefinition extends GeneratedActorDefinition, ActorDefinitionSpecGaps {
326
326
  }
327
327
  export interface ActorChargeEventRePointed {
328
328
  eventTieredPricingUsd?: TieredPricingPerEvent;
@@ -571,6 +571,7 @@ export interface ActorRun extends Omit<Schemas['Run'], keyof ActorRunRePointed |
571
571
  }
572
572
  type GeneratedTaskStats = Schemas['TaskStats'];
573
573
  type GeneratedTaskOptions = Schemas['TaskOptions'];
574
+ type GeneratedTaskPublicConfig = Schemas['TaskPublicConfig'];
574
575
  type GeneratedCurrentPricingInfo = Schemas['CurrentPricingInfo'];
575
576
  /** Statistics about Actor task usage. */
576
577
  export interface TaskStats extends GeneratedTaskStats {
@@ -586,14 +587,7 @@ export interface TaskOptions extends GeneratedTaskOptions {
586
587
  * {@apilink TaskClient.unpublish} to change the publication state.
587
588
  * @since Added in 2.25.0
588
589
  */
589
- export interface TaskPublicConfig {
590
- publishedAt: Date | null;
591
- seoTitle?: string | null;
592
- seoDescription?: string | null;
593
- categorization?: string | null;
594
- inputSchemaFields?: string[] | null;
595
- datasetName?: string | null;
596
- datasetView?: string | null;
590
+ export interface TaskPublicConfig extends GeneratedTaskPublicConfig {
597
591
  }
598
592
  /**
599
593
  * Fields the API returns on a task that the OpenAPI spec does not describe yet.
@@ -602,23 +596,12 @@ export interface TaskPublicConfig {
602
596
  */
603
597
  export interface TaskSpecGaps {
604
598
  description?: string;
605
- /**
606
- * Whether the task is published on its public landing page. Derived from
607
- * `publicConfig.publishedAt` -- set it on update to publish or unpublish the task.
608
- * @since Added in 2.25.0
609
- */
610
- isPublic?: boolean;
611
- /**
612
- * @since Added in 2.25.0
613
- */
614
- publicConfig?: TaskPublicConfig | null;
615
599
  }
616
600
  export interface TaskRePointed {
617
601
  stats?: TaskStats | null;
618
602
  options?: TaskOptions | null;
619
603
  actorStandby?: ActorStandby | null;
620
- }
621
- export interface TaskSpecNarrowings {
604
+ publicConfig?: TaskPublicConfig | null;
622
605
  input?: Dictionary | Dictionary[] | null;
623
606
  }
624
607
  /**
@@ -627,7 +610,7 @@ export interface TaskSpecNarrowings {
627
610
  * Tasks are saved Actor configurations with input and settings that can be executed
628
611
  * repeatedly without having to specify the full input each time.
629
612
  */
630
- export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed | keyof TaskSpecNarrowings>, TaskRePointed, TaskSpecNarrowings, TaskSpecGaps {
613
+ export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed>, TaskRePointed, TaskSpecGaps {
631
614
  }
632
615
  export interface TaskListRePointed {
633
616
  stats?: TaskStats | null;
@@ -756,7 +739,7 @@ export interface ScheduledActorRunInput extends GeneratedScheduleActionRunInput
756
739
  export interface ScheduledActorRunOptions extends GeneratedTaskOptions {
757
740
  }
758
741
  export interface ScheduleActionRunActorRePointed {
759
- type: ScheduleActions.RunActor;
742
+ type: `${ScheduleActions.RunActor}`;
760
743
  runInput?: ScheduledActorRunInput | null;
761
744
  runOptions?: ScheduledActorRunOptions | null;
762
745
  }
@@ -764,13 +747,17 @@ export interface ScheduleActionRunActorRePointed {
764
747
  export interface ScheduleActionRunActor extends Omit<Schemas['ScheduleActionRunActor'], keyof ScheduleActionRunActorRePointed>, ScheduleActionRunActorRePointed {
765
748
  }
766
749
  export interface ScheduleActionRunActorTaskRePointed {
767
- type: ScheduleActions.RunActorTask;
750
+ type: `${ScheduleActions.RunActorTask}`;
768
751
  }
769
752
  /** Scheduled action to run an Actor task. */
770
753
  export interface ScheduleActionRunActorTask extends Omit<Schemas['ScheduleActionRunActorTask'], keyof ScheduleActionRunActorTaskRePointed>, ScheduleActionRunActorTaskRePointed {
771
754
  }
772
755
  /** Union type representing all possible scheduled actions. */
773
756
  export type ScheduleAction = ScheduleActionRunActor | ScheduleActionRunActorTask;
757
+ type GeneratedScheduleInvoked = Schemas['ScheduleInvoked'];
758
+ /** One entry of a schedule's log: an invocation of the schedule and how it went. */
759
+ export interface ScheduleInvoked extends GeneratedScheduleInvoked {
760
+ }
774
761
  export interface ScheduleRePointed {
775
762
  actions: ScheduleAction[];
776
763
  }
@@ -850,11 +837,8 @@ export interface UserPlan extends Omit<Schemas['Plan'], keyof UserPlanRePointed>
850
837
  export interface UserRePointed {
851
838
  profile?: UserProfile;
852
839
  proxy?: UserProxy;
853
- }
854
- export interface UserSpecNarrowings {
855
840
  plan?: UserPlan;
856
841
  effectivePlatformFeatures?: EffectivePlatformFeatures;
857
- isPaying?: boolean;
858
842
  }
859
843
  /**
860
844
  * A user account.
@@ -862,7 +846,7 @@ export interface UserSpecNarrowings {
862
846
  * The private fields are only populated for `GET /v2/users/me`, which needs a token; the public
863
847
  * endpoint returns the username and profile alone.
864
848
  */
865
- export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed | keyof UserSpecNarrowings>, UserRePointed, UserSpecNarrowings {
849
+ export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed>, UserRePointed {
866
850
  }
867
851
  /**
868
852
  * The start and end of a billing cycle.
@@ -897,11 +881,8 @@ export interface ServiceUsage {
897
881
  export interface DailyServiceUsageRePointed {
898
882
  serviceUsage: ServiceUsage;
899
883
  }
900
- export interface DailyServiceUsageClientConversions {
901
- date: Date;
902
- }
903
884
  /** A single day's usage within a monthly cycle. The spec names this schema `DailyServiceUsages`. */
904
- export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed | keyof DailyServiceUsageClientConversions>, DailyServiceUsageRePointed, DailyServiceUsageClientConversions {
885
+ export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed>, DailyServiceUsageRePointed {
905
886
  }
906
887
  export interface MonthlyUsageRePointed {
907
888
  usageCycle: UsageCycle;
@@ -954,21 +935,20 @@ export interface RequestQueueStats extends GeneratedRequestQueueStats {
954
935
  /**
955
936
  * Fields the API returns on a request queue that the OpenAPI spec does not describe yet.
956
937
  *
957
- * The spec does carry `username` and `expireAt` on `RequestQueueShort`, the listing shape, and simply
958
- * omits both from the full `RequestQueue` schema. `title` is absent from either.
938
+ * The spec does carry `username` on `RequestQueueShort`, the listing shape, and simply omits it from the
939
+ * full `RequestQueue` schema. `title` is absent from either.
959
940
  *
960
941
  * TODO: Remove once the spec covers them.
961
942
  */
962
943
  export interface RequestQueueSpecGaps {
963
944
  title?: string;
964
945
  username?: string;
965
- expireAt?: Date;
966
946
  }
967
947
  export interface RequestQueueRePointed {
968
948
  stats?: RequestQueueStats;
949
+ generalAccess?: STORAGE_GENERAL_ACCESS | null;
969
950
  }
970
951
  export interface RequestQueueSpecNarrowings {
971
- generalAccess?: STORAGE_GENERAL_ACCESS | null;
972
952
  consoleUrl?: string;
973
953
  }
974
954
  /**
@@ -3,6 +3,7 @@ import { Log } from '@apify/log';
3
3
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
4
4
  import { ResourceClient } from '../base/resource_client.js';
5
5
  import type { Actor, ActorRun } from '../models.js';
6
+ import type { TimeoutOptions } from '../timeouts.js';
6
7
  import { ActorVersionClient } from './actor_version.js';
7
8
  import { ActorVersionCollectionClient } from './actor_version_collection.js';
8
9
  import type { Build, BuildClientGetOptions } from './build.js';
@@ -42,24 +43,30 @@ export declare class ActorClient extends ResourceClient {
42
43
  /**
43
44
  * Gets the Actor object from the Apify API.
44
45
  *
46
+ * @param options - Request options
47
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
45
48
  * @returns The Actor object, or `undefined` if it does not exist
46
49
  * @see https://docs.apify.com/api/v2/act-get
47
50
  */
48
- get(): Promise<Actor | undefined>;
51
+ get(options?: TimeoutOptions): Promise<Actor | undefined>;
49
52
  /**
50
53
  * Updates the Actor with specified fields.
51
54
  *
52
55
  * @param newFields - Fields to update in the Actor
56
+ * @param options - Request options
57
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
53
58
  * @returns The updated Actor object
54
59
  * @see https://docs.apify.com/api/v2/act-put
55
60
  */
56
- update(newFields: ActorUpdateOptions): Promise<Actor>;
61
+ update(newFields: ActorUpdateOptions, options?: TimeoutOptions): Promise<Actor>;
57
62
  /**
58
63
  * Deletes the Actor.
59
64
  *
65
+ * @param options - Request options
66
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
60
67
  * @see https://docs.apify.com/api/v2/act-delete
61
68
  */
62
- delete(): Promise<void>;
69
+ delete(options?: TimeoutOptions): Promise<void>;
63
70
  /**
64
71
  * Starts the Actor and immediately returns the Run object.
65
72
  *
@@ -67,17 +74,17 @@ export declare class ActorClient extends ResourceClient {
67
74
  * asynchronously and this method returns immediately without waiting for completion.
68
75
  * Use the {@link call} method if you want to wait for the Actor to finish.
69
76
  *
70
- * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number).
71
- * If `contentType` is specified in options, input should be a string or Buffer.
77
+ * @param input - Input for the Actor, serialized to JSON. Omit it to run the Actor without input.
72
78
  * @param options - Run configuration options
73
79
  * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`). If not provided, uses the default build.
74
80
  * @param options.memory - Memory in megabytes allocated for the run. If not provided, uses the Actor's default memory setting.
75
- * @param options.timeout - Timeout for the run in seconds. Zero means no timeout. If not provided, uses the Actor's default timeout.
81
+ * @param options.runTimeoutSecs - Timeout for the run in seconds. Zero means no timeout. If not provided, uses the Actor's default timeout.
76
82
  * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the run to finish on the API side before returning. Default is 0 (returns immediately).
77
83
  * @param options.webhooks - Webhooks to trigger when the Actor run reaches a specific state (e.g., `SUCCEEDED`, `FAILED`).
78
84
  * @param options.maxItems - Maximum number of dataset items that will be charged (only for pay-per-result Actors).
79
85
  * @param options.maxTotalChargeUsd - Maximum cost in USD (only for pay-per-event Actors).
80
- * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer.
86
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
87
+ * when the API is asked to hold the response.
81
88
  * @returns The Actor run object with status, usage, and storage IDs
82
89
  * @see https://docs.apify.com/api/v2/act-runs-post
83
90
  *
@@ -90,11 +97,11 @@ export declare class ActorClient extends ResourceClient {
90
97
  * // Start Actor with specific build and memory
91
98
  * const run = await client.actor('my-actor').start(
92
99
  * { url: 'https://example.com' },
93
- * { build: '0.1.2', memory: 512, timeout: 300 }
100
+ * { build: '0.1.2', memory: 512, runTimeoutSecs: 300 }
94
101
  * );
95
102
  * ```
96
103
  */
97
- start(input?: unknown, options?: ActorStartOptions): Promise<ActorRun>;
104
+ start(input?: ActorInput, options?: ActorStartOptions): Promise<ActorRun>;
98
105
  /**
99
106
  * Starts the Actor and waits for it to finish before returning the Run object.
100
107
  *
@@ -102,14 +109,14 @@ export declare class ActorClient extends ResourceClient {
102
109
  * by polling the run status. It optionally streams logs to the console or a custom Log instance.
103
110
  * By default, it waits indefinitely unless the `waitSecs` option is provided.
104
111
  *
105
- * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number).
106
- * If `contentType` is specified in options, input should be a string or Buffer.
112
+ * @param input - Input for the Actor, serialized to JSON. Omit it to run the Actor without input.
107
113
  * @param options - Run configuration options (extends all options from {@link start})
108
114
  * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely.
109
115
  * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance.
110
116
  * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`).
111
117
  * @param options.memory - Memory in megabytes allocated for the run.
112
- * @param options.timeout - Maximum run duration in seconds.
118
+ * @param options.runTimeoutSecs - Maximum run duration in seconds.
119
+ * @param options.timeoutSecs - Timeout for each API request, the start and every poll alike. Default is `'noTimeout'`.
113
120
  * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`)
114
121
  * @see https://docs.apify.com/api/v2/act-runs-post
115
122
  *
@@ -132,7 +139,7 @@ export declare class ActorClient extends ResourceClient {
132
139
  * const run = await client.actor('my-actor').call({ url: 'https://example.com' }, { log });
133
140
  * ```
134
141
  */
135
- call(input?: unknown, options?: ActorCallOptions): Promise<ActorRun>;
142
+ call(input?: ActorInput, options?: ActorCallOptions): Promise<ActorRun>;
136
143
  /**
137
144
  * Validates the provided input for the Actor against its input schema.
138
145
  *
@@ -141,13 +148,11 @@ export declare class ActorClient extends ResourceClient {
141
148
  * invalid, the API responds with an error that is thrown as an `ApifyApiError` describing the
142
149
  * validation problem.
143
150
  *
144
- * @param input - Input to validate against the Actor's input schema. Can be any JSON-serializable
145
- * value (object, array, string, number). If `contentType` is specified in options,
146
- * input should be a string or Buffer.
151
+ * @param input - Input to validate against the Actor's input schema, serialized to JSON.
147
152
  * @param options - Validation options
148
153
  * @param options.build - Tag or number of the build whose input schema the input is validated against
149
154
  * (e.g., `'latest'` or `'1.2.345'`). If not provided, uses the default build.
150
- * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer.
155
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
151
156
  * @returns `true` if the input is valid. Invalid input causes the underlying API call to throw an `ApifyApiError`.
152
157
  * @see https://docs.apify.com/api/v2/act-validate-input-post
153
158
  *
@@ -164,7 +169,7 @@ export declare class ActorClient extends ResourceClient {
164
169
  * ```
165
170
  * @since Added in 2.24.0
166
171
  */
167
- validateInput(input?: unknown, options?: ActorValidateInputOptions): Promise<boolean>;
172
+ validateInput(input?: ActorInput, options?: ActorValidateInputOptions): Promise<boolean>;
168
173
  /**
169
174
  * Builds the Actor.
170
175
  *
@@ -177,6 +182,8 @@ export declare class ActorClient extends ResourceClient {
177
182
  * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced.
178
183
  * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`.
179
184
  * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
185
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
186
+ * when the API is asked to hold the response.
180
187
  * @returns The Build object with status and build details
181
188
  * @see https://docs.apify.com/api/v2/act-builds-post
182
189
  *
@@ -204,6 +211,8 @@ export declare class ActorClient extends ResourceClient {
204
211
  *
205
212
  * @param options - Options for getting the default build
206
213
  * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
214
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
215
+ * when the API is asked to hold the response.
207
216
  * @returns A client for the default build
208
217
  * @see https://docs.apify.com/api/v2/act-build-default-get
209
218
  *
@@ -280,17 +289,24 @@ export declare class ActorClient extends ResourceClient {
280
289
  * Fields that can be updated when modifying an Actor.
281
290
  */
282
291
  export type ActorUpdateOptions = Partial<Pick<Actor, 'name' | 'description' | 'isPublic' | 'isDeprecated' | 'seoTitle' | 'seoDescription' | 'title' | 'restartOnError' | 'versions' | 'categories' | 'defaultRunOptions' | 'actorStandby' | 'actorPermissionLevel' | 'taggedBuilds'>>;
283
- export interface ActorStartOptions {
292
+ /**
293
+ * Input for an Actor run, as taken by {@link ActorClient.start}, {@link ActorClient.call},
294
+ * {@link ActorClient.validateInput} and {@link RunClient.metamorph}.
295
+ *
296
+ * An object or an array. Declared as `object` rather than an index-signature type such as
297
+ * `Dictionary`, which would reject a caller's own `interface`.
298
+ */
299
+ export type ActorInput = object;
300
+ export interface ActorStartOptions extends TimeoutOptions {
284
301
  /**
285
302
  * Tag or number of the Actor build to run (e.g. `beta` or `1.2.345`).
286
303
  * If not provided, the run uses build tag or number from the default Actor run configuration (typically `latest`).
287
304
  */
288
305
  build?: string;
289
306
  /**
290
- * Content type for the `input`. If not specified,
291
- * `input` is expected to be an object that will be stringified to JSON and content type set to
292
- * `application/json; charset=utf-8`. If `options.contentType` is specified, then `input` must be a
293
- * `String` or `Buffer`.
307
+ * Content type of the request body, which becomes the content type of the run's `INPUT` record.
308
+ * Without it, an input is serialized to JSON and sent as `application/json`. Pairing an object
309
+ * with `application/x-www-form-urlencoded` form-encodes it instead.
294
310
  */
295
311
  contentType?: string;
296
312
  /**
@@ -300,9 +316,9 @@ export interface ActorStartOptions {
300
316
  memory?: number;
301
317
  /**
302
318
  * Timeout for the Actor run in seconds. Zero value means there is no timeout.
303
- * If not provided, the run uses timeout of the default Actor run configuration.
319
+ * If not provided, the run uses the timeout of the default Actor run configuration.
304
320
  */
305
- timeout?: number;
321
+ runTimeoutSecs?: number;
306
322
  /**
307
323
  * Maximum time to wait for the Actor run to finish, in seconds.
308
324
  * If the limit is reached, the returned promise is resolved to a run object that will have
@@ -369,24 +385,23 @@ export interface ActorCallOptions extends Omit<ActorStartOptions, 'waitForFinish
369
385
  * Options for validating an Actor input.
370
386
  * @since Added in 2.24.0
371
387
  */
372
- export interface ActorValidateInputOptions {
388
+ export interface ActorValidateInputOptions extends TimeoutOptions {
373
389
  /**
374
390
  * Tag or number of the Actor build whose input schema the input is validated against
375
391
  * (e.g. `beta` or `1.2.345`). If not provided, the default build is used.
376
392
  */
377
393
  build?: string;
378
394
  /**
379
- * Content type for the `input`. If not specified,
380
- * `input` is expected to be an object that will be stringified to JSON and content type set to
381
- * `application/json; charset=utf-8`. If `options.contentType` is specified, then `input` must be a
382
- * `String` or `Buffer`.
395
+ * Content type of the request body carrying the input to validate. Without it, the input is
396
+ * serialized to JSON and sent as `application/json`. Pairing an object with
397
+ * `application/x-www-form-urlencoded` form-encodes it instead.
383
398
  */
384
399
  contentType?: string;
385
400
  }
386
401
  /**
387
402
  * Options for building an Actor.
388
403
  */
389
- export interface ActorBuildOptions {
404
+ export interface ActorBuildOptions extends TimeoutOptions {
390
405
  betaPackages?: boolean;
391
406
  tag?: string;
392
407
  useCache?: boolean;