apify-client 3.0.0-beta.9 → 3.0.0-beta.90

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 (122) hide show
  1. package/README.md +16 -2
  2. package/dist/apify_api_error.d.ts +13 -27
  3. package/dist/apify_api_error.js +33 -23
  4. package/dist/apify_client.d.ts +125 -10
  5. package/dist/apify_client.js +133 -48
  6. package/dist/apify_client_error.d.ts +10 -0
  7. package/dist/apify_client_error.js +10 -0
  8. package/dist/base/api_client.d.ts +7 -7
  9. package/dist/base/api_client.js +36 -36
  10. package/dist/base/resource_client.d.ts +21 -8
  11. package/dist/base/resource_client.js +70 -36
  12. package/dist/base/resource_collection_client.d.ts +12 -4
  13. package/dist/base/resource_collection_client.js +34 -11
  14. package/dist/body_parser.d.ts +3 -4
  15. package/dist/body_parser.js +19 -26
  16. package/dist/bundle.js +27 -22
  17. package/dist/bundle.js.map +1 -1
  18. package/dist/generated/api.d.ts +3040 -971
  19. package/dist/generated/schemas.d.ts +2369 -934
  20. package/dist/generated/schemas.js +570 -229
  21. package/dist/http_clients/axios.d.ts +61 -0
  22. package/dist/http_clients/axios.js +119 -0
  23. package/dist/http_clients/base.d.ts +386 -0
  24. package/dist/http_clients/base.js +650 -0
  25. package/dist/http_clients/index.d.ts +4 -0
  26. package/dist/http_clients/index.js +2 -0
  27. package/dist/http_compressors/base.d.ts +40 -0
  28. package/dist/http_compressors/base.js +9 -0
  29. package/dist/http_compressors/brotli.d.ts +33 -0
  30. package/dist/http_compressors/brotli.js +39 -0
  31. package/dist/http_compressors/gzip.d.ts +33 -0
  32. package/dist/http_compressors/gzip.js +39 -0
  33. package/dist/http_compressors/index.d.ts +6 -0
  34. package/dist/http_compressors/index.js +2 -0
  35. package/dist/http_compressors/resolve.d.ts +23 -0
  36. package/dist/http_compressors/resolve.js +27 -0
  37. package/dist/index.d.ts +6 -1
  38. package/dist/index.js +5 -1
  39. package/dist/invalid_response_body_error.d.ts +14 -0
  40. package/dist/invalid_response_body_error.js +18 -0
  41. package/dist/models.d.ts +166 -243
  42. package/dist/models.js +6 -4
  43. package/dist/resource_clients/actor.d.ts +104 -34
  44. package/dist/resource_clients/actor.js +130 -56
  45. package/dist/resource_clients/actor_collection.d.ts +18 -12
  46. package/dist/resource_clients/actor_collection.js +11 -3
  47. package/dist/resource_clients/actor_env_var.d.ts +11 -4
  48. package/dist/resource_clients/actor_env_var.js +16 -6
  49. package/dist/resource_clients/actor_env_var_collection.d.ts +9 -4
  50. package/dist/resource_clients/actor_env_var_collection.js +11 -4
  51. package/dist/resource_clients/actor_server.d.ts +141 -0
  52. package/dist/resource_clients/actor_server.js +195 -0
  53. package/dist/resource_clients/actor_version.d.ts +20 -5
  54. package/dist/resource_clients/actor_version.js +19 -9
  55. package/dist/resource_clients/actor_version_collection.d.ts +11 -4
  56. package/dist/resource_clients/actor_version_collection.js +13 -4
  57. package/dist/resource_clients/build.d.ts +20 -7
  58. package/dist/resource_clients/build.js +35 -15
  59. package/dist/resource_clients/build_collection.d.ts +7 -5
  60. package/dist/resource_clients/build_collection.js +4 -1
  61. package/dist/resource_clients/dataset.d.ts +83 -37
  62. package/dist/resource_clients/dataset.js +107 -121
  63. package/dist/resource_clients/dataset_collection.d.ts +10 -6
  64. package/dist/resource_clients/dataset_collection.js +13 -2
  65. package/dist/resource_clients/key_value_store.d.ts +108 -26
  66. package/dist/resource_clients/key_value_store.js +134 -52
  67. package/dist/resource_clients/key_value_store_collection.d.ts +10 -6
  68. package/dist/resource_clients/key_value_store_collection.js +13 -2
  69. package/dist/resource_clients/log.d.ts +40 -21
  70. package/dist/resource_clients/log.js +144 -66
  71. package/dist/resource_clients/request_queue.d.ts +76 -31
  72. package/dist/resource_clients/request_queue.js +178 -93
  73. package/dist/resource_clients/request_queue_collection.d.ts +9 -5
  74. package/dist/resource_clients/request_queue_collection.js +9 -3
  75. package/dist/resource_clients/run.d.ts +126 -28
  76. package/dist/resource_clients/run.js +193 -49
  77. package/dist/resource_clients/run_collection.d.ts +5 -3
  78. package/dist/resource_clients/run_collection.js +4 -1
  79. package/dist/resource_clients/schedule.d.ts +16 -7
  80. package/dist/resource_clients/schedule.js +30 -22
  81. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  82. package/dist/resource_clients/schedule_collection.js +9 -3
  83. package/dist/resource_clients/store_collection.d.ts +6 -4
  84. package/dist/resource_clients/store_collection.js +4 -1
  85. package/dist/resource_clients/task.d.ts +36 -13
  86. package/dist/resource_clients/task.js +79 -46
  87. package/dist/resource_clients/task_collection.d.ts +9 -5
  88. package/dist/resource_clients/task_collection.js +9 -3
  89. package/dist/resource_clients/user.d.ts +19 -10
  90. package/dist/resource_clients/user.js +42 -38
  91. package/dist/resource_clients/webhook.d.ts +17 -8
  92. package/dist/resource_clients/webhook.js +30 -22
  93. package/dist/resource_clients/webhook_collection.d.ts +8 -4
  94. package/dist/resource_clients/webhook_collection.js +9 -3
  95. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  96. package/dist/resource_clients/webhook_dispatch.js +7 -2
  97. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  98. package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
  99. package/dist/response_validation_error.d.ts +2 -1
  100. package/dist/response_validation_error.js +2 -1
  101. package/dist/runtime/node.d.ts +6 -0
  102. package/dist/runtime/node.js +80 -0
  103. package/dist/runtime/types.d.ts +60 -0
  104. package/dist/runtime/types.js +1 -0
  105. package/dist/runtime/web.d.ts +5 -0
  106. package/dist/runtime/web.js +21 -0
  107. package/dist/schemas.d.ts +368 -4
  108. package/dist/schemas.js +26 -4
  109. package/dist/statistics.d.ts +1 -6
  110. package/dist/statistics.js +2 -2
  111. package/dist/timeouts.d.ts +84 -0
  112. package/dist/timeouts.js +37 -0
  113. package/dist/timezones.d.ts +1 -1
  114. package/dist/utils.d.ts +89 -59
  115. package/dist/utils.js +216 -158
  116. package/dist/wait_for_resources.d.ts +8 -0
  117. package/dist/wait_for_resources.js +39 -0
  118. package/package.json +37 -34
  119. package/dist/http_client.d.ts +0 -88
  120. package/dist/http_client.js +0 -255
  121. package/dist/interceptors.d.ts +0 -19
  122. package/dist/interceptors.js +0 -105
package/dist/models.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Public models adapted from the generated OpenAPI types in `./generated/api`.
3
3
  *
4
+ * Each model takes the name of the spec schema it is declared on, as the Python client does.
5
+ *
4
6
  * The generated file is never re-exported directly. Every type here is declared on top of a generated
5
7
  * schema so the compiler reports drift, and the spec is adopted as-is wherever it is trustworthy. What
6
8
  * remains is deliberately small, and each deviation falls into exactly one of five kinds, one block per
@@ -66,10 +68,10 @@ export var ScheduleActions;
66
68
  /**
67
69
  * Platform features a plan can enable.
68
70
  *
69
- * This enum is not the element type of `UserPlan.enabledPlatformFeatures`, which the spec types
70
- * as a plain `string[]`: the platform has features this list never gained -- `PROXY_RESIDENTIAL`,
71
- * `ACTORS_PUBLIC_ALL` and `ACTORS_PUBLIC_DEVELOPER` all appear as keys of `EffectivePlatformFeatures`
72
- * -- so using it there promised a completeness that was not real. It stays published for comparisons.
71
+ * This enum is not the element type of `UserPlan.enabledPlatformFeatures`, which the spec types as a plain
72
+ * `string[]`: the platform has features this list never gained -- `PROXY_RESIDENTIAL`, `ACTORS_PUBLIC_ALL`
73
+ * and `ACTORS_PUBLIC_DEVELOPER` all appear as keys of `EffectivePlatformFeatures` -- so using it there
74
+ * promised a completeness that was not real. It stays published for comparisons.
73
75
  *
74
76
  * Declared here rather than in `./resource_clients/user` so the user types can live alongside it. It is
75
77
  * re-exported from there, so the public name and import path are unchanged.
@@ -2,7 +2,10 @@ import { ACTOR_JOB_STATUSES, ACTOR_PERMISSION_LEVEL, META_ORIGINS } from '@apify
2
2
  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
- import type { Actor, ActorRun } from '../models.js';
5
+ import type { ActorResource, Run } from '../models.js';
6
+ import type { TimeoutOptions } from '../timeouts.js';
7
+ import type { Dictionary } from '../utils.js';
8
+ import { ActorServerClient } from './actor_server.js';
6
9
  import { ActorVersionClient } from './actor_version.js';
7
10
  import { ActorVersionCollectionClient } from './actor_version_collection.js';
8
11
  import type { Build, BuildClientGetOptions } from './build.js';
@@ -13,7 +16,7 @@ import { RunCollectionClient } from './run_collection.js';
13
16
  import type { WebhookUpdateData } from './webhook.js';
14
17
  import { WebhookCollectionClient } from './webhook_collection.js';
15
18
  import type { ValueOf } from 'type-fest';
16
- export type { Actor, ActorChargeEvent, ActorChargeEvents, ActorDefaultRunOptions, ActorDefinition, ActorExampleRunInput, ActorRun, ActorRunListItem, ActorRunMeta, ActorRunMetamorph, ActorRunOptions, ActorRunPricingInfo, ActorRunStats, ActorRunStorageIds, ActorRunUsage, ActorStandby, ActorStats, ActorTaggedBuild, ActorTaggedBuilds, FlatPricePerMonthActorPricingInfo, FreeActorPricingInfo, PricePerDatasetItemActorPricingInfo, PricePerEventActorPricingInfo, TieredPricingPerDatasetItem, TieredPricingPerDatasetItemEntry, TieredPricingPerEvent, TieredPricingPerEventEntry, } from '../models.js';
19
+ export type { ActorResource, ActorChargeEvent, ActorChargeEvents, ActorDefinition, ActorRunPricingInfo, ActorRunStorageIds, ActorStandby, ActorStats, DefaultRunOptions, ExampleRunInput, FlatPricePerMonthActorPricingInfo, FreeActorPricingInfo, RunMetamorphEvent, PayPerEventActorPricingInfo, PricePerDatasetItemActorPricingInfo, Run, RunMeta, RunOptions, RunListItem, RunStats, RunUsage, TaggedBuildInfo, TaggedBuilds, TieredPricingPerDatasetItem, TieredPricingPerDatasetItemEntry, TieredPricingPerEvent, TieredPricingPerEventEntry, } from '../models.js';
17
20
  /**
18
21
  * Client for managing a specific Actor.
19
22
  *
@@ -35,6 +38,7 @@ export type { Actor, ActorChargeEvent, ActorChargeEvents, ActorDefaultRunOptions
35
38
  * @see https://docs.apify.com/platform/actors
36
39
  */
37
40
  export declare class ActorClient extends ResourceClient {
41
+ #private;
38
42
  /**
39
43
  * @hidden
40
44
  */
@@ -42,24 +46,30 @@ export declare class ActorClient extends ResourceClient {
42
46
  /**
43
47
  * Gets the Actor object from the Apify API.
44
48
  *
49
+ * @param options - Request options
50
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
45
51
  * @returns The Actor object, or `undefined` if it does not exist
46
52
  * @see https://docs.apify.com/api/v2/act-get
47
53
  */
48
- get(): Promise<Actor | undefined>;
54
+ get(options?: TimeoutOptions): Promise<ActorResource | undefined>;
49
55
  /**
50
56
  * Updates the Actor with specified fields.
51
57
  *
52
58
  * @param newFields - Fields to update in the Actor
59
+ * @param options - Request options
60
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
53
61
  * @returns The updated Actor object
54
62
  * @see https://docs.apify.com/api/v2/act-put
55
63
  */
56
- update(newFields: ActorUpdateOptions): Promise<Actor>;
64
+ update(newFields: ActorUpdateOptions, options?: TimeoutOptions): Promise<ActorResource>;
57
65
  /**
58
66
  * Deletes the Actor.
59
67
  *
68
+ * @param options - Request options
69
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
60
70
  * @see https://docs.apify.com/api/v2/act-delete
61
71
  */
62
- delete(): Promise<void>;
72
+ delete(options?: TimeoutOptions): Promise<void>;
63
73
  /**
64
74
  * Starts the Actor and immediately returns the Run object.
65
75
  *
@@ -67,17 +77,20 @@ export declare class ActorClient extends ResourceClient {
67
77
  * asynchronously and this method returns immediately without waiting for completion.
68
78
  * Use the {@link call} method if you want to wait for the Actor to finish.
69
79
  *
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.
80
+ * @param input - Input for the Actor: an object or array serialized to JSON, or raw bytes sent as they are.
81
+ * Omit it to run the Actor without input.
72
82
  * @param options - Run configuration options
73
83
  * @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
84
  * @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.
85
+ * @param options.runTimeoutSecs - Timeout for the run in seconds. Zero means no timeout. If not provided, uses the Actor's default timeout.
76
86
  * @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
87
  * @param options.webhooks - Webhooks to trigger when the Actor run reaches a specific state (e.g., `SUCCEEDED`, `FAILED`).
78
88
  * @param options.maxItems - Maximum number of dataset items that will be charged (only for pay-per-result Actors).
79
89
  * @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.
90
+ * @param options.waitForResources - Retry the start while the account lacks the memory or a concurrent-run slot for
91
+ * the run. `true` retries until the run starts, a number stops retrying after that many seconds.
92
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
93
+ * when the API is asked to hold the response.
81
94
  * @returns The Actor run object with status, usage, and storage IDs
82
95
  * @see https://docs.apify.com/api/v2/act-runs-post
83
96
  *
@@ -90,11 +103,11 @@ export declare class ActorClient extends ResourceClient {
90
103
  * // Start Actor with specific build and memory
91
104
  * const run = await client.actor('my-actor').start(
92
105
  * { url: 'https://example.com' },
93
- * { build: '0.1.2', memory: 512, timeout: 300 }
106
+ * { build: '0.1.2', memory: 512, runTimeoutSecs: 300 }
94
107
  * );
95
108
  * ```
96
109
  */
97
- start(input?: unknown, options?: ActorStartOptions): Promise<ActorRun>;
110
+ start(input?: ActorInput, options?: ActorStartOptions): Promise<Run>;
98
111
  /**
99
112
  * Starts the Actor and waits for it to finish before returning the Run object.
100
113
  *
@@ -102,14 +115,18 @@ export declare class ActorClient extends ResourceClient {
102
115
  * by polling the run status. It optionally streams logs to the console or a custom Log instance.
103
116
  * By default, it waits indefinitely unless the `waitSecs` option is provided.
104
117
  *
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.
118
+ * @param input - Input for the Actor: an object or array serialized to JSON, or raw bytes sent as they are.
119
+ * Omit it to run the Actor without input.
107
120
  * @param options - Run configuration options (extends all options from {@link start})
108
121
  * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely.
109
122
  * @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
123
  * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`).
111
124
  * @param options.memory - Memory in megabytes allocated for the run.
112
- * @param options.timeout - Maximum run duration in seconds.
125
+ * @param options.runTimeoutSecs - Maximum run duration in seconds.
126
+ * @param options.waitForResources - Retry the start while the account lacks the memory or a concurrent-run slot for
127
+ * the run. `true` retries until the run starts, a number stops retrying after that many seconds. The time spent
128
+ * retrying doesn't count toward `waitSecs`.
129
+ * @param options.timeoutSecs - Timeout for each API request, the start and every poll alike. Default is `'noTimeout'`.
113
130
  * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`)
114
131
  * @see https://docs.apify.com/api/v2/act-runs-post
115
132
  *
@@ -132,7 +149,7 @@ export declare class ActorClient extends ResourceClient {
132
149
  * const run = await client.actor('my-actor').call({ url: 'https://example.com' }, { log });
133
150
  * ```
134
151
  */
135
- call(input?: unknown, options?: ActorCallOptions): Promise<ActorRun>;
152
+ call(input?: ActorInput, options?: ActorCallOptions): Promise<Run>;
136
153
  /**
137
154
  * Validates the provided input for the Actor against its input schema.
138
155
  *
@@ -141,13 +158,12 @@ export declare class ActorClient extends ResourceClient {
141
158
  * invalid, the API responds with an error that is thrown as an `ApifyApiError` describing the
142
159
  * validation problem.
143
160
  *
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.
161
+ * @param input - Input to validate against the Actor's input schema: an object or array serialized to JSON, or
162
+ * raw bytes sent as they are.
147
163
  * @param options - Validation options
148
164
  * @param options.build - Tag or number of the build whose input schema the input is validated against
149
165
  * (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.
166
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
151
167
  * @returns `true` if the input is valid. Invalid input causes the underlying API call to throw an `ApifyApiError`.
152
168
  * @see https://docs.apify.com/api/v2/act-validate-input-post
153
169
  *
@@ -164,7 +180,7 @@ export declare class ActorClient extends ResourceClient {
164
180
  * ```
165
181
  * @since Added in 2.24.0
166
182
  */
167
- validateInput(input?: unknown, options?: ActorValidateInputOptions): Promise<boolean>;
183
+ validateInput(input?: ActorInput, options?: ActorValidateInputOptions): Promise<boolean>;
168
184
  /**
169
185
  * Builds the Actor.
170
186
  *
@@ -177,6 +193,8 @@ export declare class ActorClient extends ResourceClient {
177
193
  * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced.
178
194
  * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`.
179
195
  * @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).
196
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
197
+ * when the API is asked to hold the response.
180
198
  * @returns The Build object with status and build details
181
199
  * @see https://docs.apify.com/api/v2/act-builds-post
182
200
  *
@@ -204,6 +222,8 @@ export declare class ActorClient extends ResourceClient {
204
222
  *
205
223
  * @param options - Options for getting the default build
206
224
  * @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).
225
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
226
+ * when the API is asked to hold the response.
207
227
  * @returns A client for the default build
208
228
  * @see https://docs.apify.com/api/v2/act-build-default-get
209
229
  *
@@ -275,22 +295,59 @@ export declare class ActorClient extends ResourceClient {
275
295
  * @see https://docs.apify.com/api/v2/act-webhooks-get
276
296
  */
277
297
  webhooks(): WebhookCollectionClient;
298
+ /**
299
+ * Returns a client for the server interface of this Actor.
300
+ *
301
+ * A Server Actor runs a web server, its server interface, that is called over HTTP without starting a run for
302
+ * each call. Server Actors were formerly called Actor Standby, and {@link standby} is a deprecated alias of this
303
+ * method. Every call returns the same client, so the server URL it fetches is reused.
304
+ *
305
+ * @returns The client for the server interface of this Actor
306
+ * @see https://docs.apify.com/platform/actors/running/standby
307
+ *
308
+ * @example
309
+ * ```javascript
310
+ * const response = await client.actor('username/actor-name').server().request('/search', {
311
+ * params: { q: 'apify' },
312
+ * });
313
+ * ```
314
+ */
315
+ server(): ActorServerClient;
316
+ /**
317
+ * Returns a client for the server interface of this Actor in Standby mode.
318
+ *
319
+ * Named after Actor Standby, the former name of Server Actors.
320
+ *
321
+ * @deprecated Use {@link server} instead. Will be removed in v4.
322
+ * @returns The client for the server interface of this Actor
323
+ * @see https://docs.apify.com/platform/actors/running/standby
324
+ */
325
+ standby(): ActorServerClient;
278
326
  }
279
327
  /**
280
328
  * Fields that can be updated when modifying an Actor.
281
329
  */
282
- export type ActorUpdateOptions = Partial<Pick<Actor, 'name' | 'description' | 'isPublic' | 'isDeprecated' | 'seoTitle' | 'seoDescription' | 'title' | 'restartOnError' | 'versions' | 'categories' | 'defaultRunOptions' | 'actorStandby' | 'actorPermissionLevel' | 'taggedBuilds'>>;
283
- export interface ActorStartOptions {
330
+ export type ActorUpdateOptions = Partial<Pick<ActorResource, 'name' | 'description' | 'isPublic' | 'isDeprecated' | 'seoTitle' | 'seoDescription' | 'title' | 'versions' | 'categories' | 'defaultRunOptions' | 'actorStandby' | 'actorPermissionLevel' | 'taggedBuilds' | 'pricingInfos' | 'exampleRunInput'>>;
331
+ /**
332
+ * Input for an Actor run, as taken by {@link ActorClient.start}, {@link ActorClient.call},
333
+ * {@link ActorClient.validateInput} and {@link RunClient.metamorph}.
334
+ *
335
+ * A plain object or an array of plain objects, serialized into the request body, or raw bytes
336
+ * (a `Uint8Array` such as a `Buffer`, or an `ArrayBuffer`) sent as they are, typically with a
337
+ * `contentType`. An input typed as an `interface` or a class needs a spread (`{ ...input }`), or for
338
+ * an interface a `type` alias, to compile.
339
+ */
340
+ export type ActorInput = Dictionary | readonly Dictionary[] | Uint8Array | ArrayBuffer;
341
+ export interface ActorStartOptions extends TimeoutOptions {
284
342
  /**
285
343
  * Tag or number of the Actor build to run (e.g. `beta` or `1.2.345`).
286
344
  * If not provided, the run uses build tag or number from the default Actor run configuration (typically `latest`).
287
345
  */
288
346
  build?: string;
289
347
  /**
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`.
348
+ * Content type of the request body, which becomes the content type of the run's `INPUT` record.
349
+ * Without it, an input is serialized to JSON and sent as `application/json`. Pairing an object
350
+ * with `application/x-www-form-urlencoded` form-encodes it instead.
294
351
  */
295
352
  contentType?: string;
296
353
  /**
@@ -300,9 +357,9 @@ export interface ActorStartOptions {
300
357
  memory?: number;
301
358
  /**
302
359
  * 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.
360
+ * If not provided, the run uses the timeout of the default Actor run configuration.
304
361
  */
305
- timeout?: number;
362
+ runTimeoutSecs?: number;
306
363
  /**
307
364
  * Maximum time to wait for the Actor run to finish, in seconds.
308
365
  * If the limit is reached, the returned promise is resolved to a run object that will have
@@ -345,6 +402,20 @@ export interface ActorStartOptions {
345
402
  * @since Added in 2.17.0
346
403
  */
347
404
  forcePermissionLevel?: ACTOR_PERMISSION_LEVEL;
405
+ /**
406
+ * Retry the start while the account lacks the resources for the run, that is while the API rejects it with an
407
+ * `ApifyApiError` of type `actor-memory-limit-exceeded` or `concurrent-runs-limit-exceeded`. Both clear as
408
+ * other runs or builds finish. The start is retried every 10 seconds, and any other error is thrown right away.
409
+ *
410
+ * `true` retries until the run starts. A number stops retrying after that many seconds and throws the last
411
+ * error. Omitted or `false`, the first rejection is thrown.
412
+ *
413
+ * A run that requests more memory than the whole memory limit of the account is rejected with
414
+ * `actor-memory-limit-exceeded` as well and never starts, so `true` retries it forever.
415
+ *
416
+ * A `Readable` input can't be sent twice, so its start is never retried and the first rejection is thrown.
417
+ */
418
+ waitForResources?: boolean | number;
348
419
  }
349
420
  /**
350
421
  * Options for calling an Actor and waiting for it to finish.
@@ -369,24 +440,23 @@ export interface ActorCallOptions extends Omit<ActorStartOptions, 'waitForFinish
369
440
  * Options for validating an Actor input.
370
441
  * @since Added in 2.24.0
371
442
  */
372
- export interface ActorValidateInputOptions {
443
+ export interface ActorValidateInputOptions extends TimeoutOptions {
373
444
  /**
374
445
  * Tag or number of the Actor build whose input schema the input is validated against
375
446
  * (e.g. `beta` or `1.2.345`). If not provided, the default build is used.
376
447
  */
377
448
  build?: string;
378
449
  /**
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`.
450
+ * Content type of the request body carrying the input to validate. Without it, the input is
451
+ * serialized to JSON and sent as `application/json`. Pairing an object with
452
+ * `application/x-www-form-urlencoded` form-encodes it instead.
383
453
  */
384
454
  contentType?: string;
385
455
  }
386
456
  /**
387
457
  * Options for building an Actor.
388
458
  */
389
- export interface ActorBuildOptions {
459
+ export interface ActorBuildOptions extends TimeoutOptions {
390
460
  betaPackages?: boolean;
391
461
  tag?: string;
392
462
  useCache?: boolean;