apify-client 3.0.0-beta.15 → 3.0.0-beta.16

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 (71) hide show
  1. package/dist/apify_api_error.js +23 -7
  2. package/dist/apify_client.d.ts +22 -3
  3. package/dist/apify_client.js +35 -29
  4. package/dist/base/api_client.d.ts +6 -6
  5. package/dist/base/api_client.js +11 -10
  6. package/dist/base/resource_client.d.ts +13 -8
  7. package/dist/base/resource_client.js +35 -19
  8. package/dist/base/resource_collection_client.d.ts +6 -4
  9. package/dist/base/resource_collection_client.js +17 -11
  10. package/dist/bundle.js +13 -13
  11. package/dist/bundle.js.map +1 -1
  12. package/dist/http_client.d.ts +34 -13
  13. package/dist/http_client.js +58 -28
  14. package/dist/index.d.ts +1 -0
  15. package/dist/resource_clients/actor.d.ts +26 -11
  16. package/dist/resource_clients/actor.js +62 -33
  17. package/dist/resource_clients/actor_collection.d.ts +6 -2
  18. package/dist/resource_clients/actor_collection.js +9 -3
  19. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  20. package/dist/resource_clients/actor_env_var.js +16 -6
  21. package/dist/resource_clients/actor_env_var_collection.d.ts +7 -2
  22. package/dist/resource_clients/actor_env_var_collection.js +11 -4
  23. package/dist/resource_clients/actor_version.d.ts +10 -3
  24. package/dist/resource_clients/actor_version.js +18 -8
  25. package/dist/resource_clients/actor_version_collection.d.ts +7 -2
  26. package/dist/resource_clients/actor_version_collection.js +11 -4
  27. package/dist/resource_clients/build.d.ts +16 -6
  28. package/dist/resource_clients/build.js +30 -15
  29. package/dist/resource_clients/build_collection.d.ts +3 -1
  30. package/dist/resource_clients/build_collection.js +4 -1
  31. package/dist/resource_clients/dataset.d.ts +21 -7
  32. package/dist/resource_clients/dataset.js +56 -34
  33. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  34. package/dist/resource_clients/dataset_collection.js +12 -2
  35. package/dist/resource_clients/key_value_store.d.ts +31 -11
  36. package/dist/resource_clients/key_value_store.js +58 -34
  37. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  38. package/dist/resource_clients/key_value_store_collection.js +12 -2
  39. package/dist/resource_clients/log.d.ts +4 -1
  40. package/dist/resource_clients/log.js +15 -6
  41. package/dist/resource_clients/request_queue.d.ts +52 -18
  42. package/dist/resource_clients/request_queue.js +114 -60
  43. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  44. package/dist/resource_clients/request_queue_collection.js +9 -3
  45. package/dist/resource_clients/run.d.ts +33 -13
  46. package/dist/resource_clients/run.js +65 -35
  47. package/dist/resource_clients/run_collection.d.ts +3 -1
  48. package/dist/resource_clients/run_collection.js +4 -1
  49. package/dist/resource_clients/schedule.d.ts +13 -4
  50. package/dist/resource_clients/schedule.js +23 -9
  51. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  52. package/dist/resource_clients/schedule_collection.js +9 -3
  53. package/dist/resource_clients/store_collection.d.ts +3 -1
  54. package/dist/resource_clients/store_collection.js +4 -1
  55. package/dist/resource_clients/task.d.ts +27 -9
  56. package/dist/resource_clients/task.js +60 -31
  57. package/dist/resource_clients/task_collection.d.ts +6 -2
  58. package/dist/resource_clients/task_collection.js +9 -3
  59. package/dist/resource_clients/user.d.ts +14 -5
  60. package/dist/resource_clients/user.js +30 -14
  61. package/dist/resource_clients/webhook.d.ts +13 -4
  62. package/dist/resource_clients/webhook.js +24 -10
  63. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  64. package/dist/resource_clients/webhook_collection.js +9 -3
  65. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  66. package/dist/resource_clients/webhook_dispatch.js +7 -2
  67. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  68. package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
  69. package/dist/timeouts.d.ts +72 -0
  70. package/dist/timeouts.js +31 -0
  71. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { ACTOR_JOB_STATUSES, ACTOR_PERMISSION_LEVEL, META_ORIGINS } from '@apify
3
3
  import { Log } from '@apify/log';
4
4
  import { ResourceClient } from '../base/resource_client.js';
5
5
  import * as schemas from '../schemas.js';
6
+ import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
6
7
  import { anyObjectSchema, parseArgument, parseResponse, stringifyWebhooksToBase64 } from '../utils.js';
7
8
  import { ActorVersionClient } from './actor_version.js';
8
9
  import { ActorVersionCollectionClient } from './actor_version_collection.js';
@@ -15,19 +16,20 @@ const startOptionsSchema = z.strictObject({
15
16
  build: z.string().optional(),
16
17
  contentType: z.string().optional(),
17
18
  memory: z.number().optional(),
18
- timeout: z.number().optional(),
19
+ runTimeoutSecs: z.number().min(0).optional(),
19
20
  waitForFinish: z.number().optional(),
20
21
  webhooks: z.array(anyObjectSchema).optional(),
21
22
  maxItems: z.number().min(0).optional(),
22
23
  maxTotalChargeUsd: z.number().min(0).optional(),
23
24
  restartOnError: z.boolean().optional(),
24
25
  forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
26
+ ...timeoutOptionsShape,
25
27
  });
26
28
  const callOptionsSchema = z.strictObject({
27
29
  build: z.string().optional(),
28
30
  contentType: z.string().optional(),
29
31
  memory: z.number().optional(),
30
- timeout: z.number().min(0).optional(),
32
+ runTimeoutSecs: z.number().min(0).optional(),
31
33
  waitSecs: z.number().min(0).optional(),
32
34
  webhooks: z.array(anyObjectSchema).optional(),
33
35
  maxItems: z.number().min(0).optional(),
@@ -35,10 +37,12 @@ const callOptionsSchema = z.strictObject({
35
37
  log: z.union([z.null(), z.instanceof(Log), z.literal('default')]).optional(),
36
38
  restartOnError: z.boolean().optional(),
37
39
  forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
40
+ ...timeoutOptionsShape,
38
41
  });
39
42
  const validateInputOptionsSchema = z.strictObject({
40
43
  build: z.string().optional(),
41
44
  contentType: z.string().optional(),
45
+ ...timeoutOptionsShape,
42
46
  });
43
47
  const versionNumberSchema = z.string().min(1);
44
48
  const buildOptionsSchema = z.strictObject({
@@ -46,7 +50,9 @@ const buildOptionsSchema = z.strictObject({
46
50
  tag: z.string().optional(),
47
51
  useCache: z.boolean().optional(),
48
52
  waitForFinish: z.number().optional(),
53
+ ...timeoutOptionsShape,
49
54
  });
55
+ const defaultBuildOptionsSchema = z.strictObject({ waitForFinish: z.number().optional(), ...timeoutOptionsShape });
50
56
  const lastRunOptionsSchema = z.strictObject({
51
57
  status: z.enum(ACTOR_JOB_STATUSES).optional(),
52
58
  origin: z.enum(META_ORIGINS).optional(),
@@ -84,30 +90,39 @@ export class ActorClient extends ResourceClient {
84
90
  /**
85
91
  * Gets the Actor object from the Apify API.
86
92
  *
93
+ * @param options - Request options
94
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
87
95
  * @returns The Actor object, or `undefined` if it does not exist
88
96
  * @see https://docs.apify.com/api/v2/act-get
89
97
  */
90
- async get() {
91
- return this._get(schemas.Actor());
98
+ async get(options = {}) {
99
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
100
+ return this.getResource(schemas.Actor(), {}, timeoutSecs);
92
101
  }
93
102
  /**
94
103
  * Updates the Actor with specified fields.
95
104
  *
96
105
  * @param newFields - Fields to update in the Actor
106
+ * @param options - Request options
107
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
97
108
  * @returns The updated Actor object
98
109
  * @see https://docs.apify.com/api/v2/act-put
99
110
  */
100
- async update(newFields) {
111
+ async update(newFields, options = {}) {
101
112
  parseArgument(newFields, anyObjectSchema);
102
- return this._update(schemas.Actor(), newFields);
113
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
114
+ return this.updateResource(schemas.Actor(), newFields, timeoutSecs);
103
115
  }
104
116
  /**
105
117
  * Deletes the Actor.
106
118
  *
119
+ * @param options - Request options
120
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
107
121
  * @see https://docs.apify.com/api/v2/act-delete
108
122
  */
109
- async delete() {
110
- return this._delete();
123
+ async delete(options = {}) {
124
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
125
+ return this.deleteResource(timeoutSecs);
111
126
  }
112
127
  /**
113
128
  * Starts the Actor and immediately returns the Run object.
@@ -120,11 +135,13 @@ export class ActorClient extends ResourceClient {
120
135
  * @param options - Run configuration options
121
136
  * @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.
122
137
  * @param options.memory - Memory in megabytes allocated for the run. If not provided, uses the Actor's default memory setting.
123
- * @param options.timeout - Timeout for the run in seconds. Zero means no timeout. If not provided, uses the Actor's default timeout.
138
+ * @param options.runTimeoutSecs - Timeout for the run in seconds. Zero means no timeout. If not provided, uses the Actor's default timeout.
124
139
  * @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).
125
140
  * @param options.webhooks - Webhooks to trigger when the Actor run reaches a specific state (e.g., `SUCCEEDED`, `FAILED`).
126
141
  * @param options.maxItems - Maximum number of dataset items that will be charged (only for pay-per-result Actors).
127
142
  * @param options.maxTotalChargeUsd - Maximum cost in USD (only for pay-per-event Actors).
143
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
144
+ * when the API is asked to hold the response.
128
145
  * @returns The Actor run object with status, usage, and storage IDs
129
146
  * @see https://docs.apify.com/api/v2/act-runs-post
130
147
  *
@@ -137,16 +154,17 @@ export class ActorClient extends ResourceClient {
137
154
  * // Start Actor with specific build and memory
138
155
  * const run = await client.actor('my-actor').start(
139
156
  * { url: 'https://example.com' },
140
- * { build: '0.1.2', memory: 512, timeout: 300 }
157
+ * { build: '0.1.2', memory: 512, runTimeoutSecs: 300 }
141
158
  * );
142
159
  * ```
143
160
  */
144
161
  async start(input, options = {}) {
145
162
  const parsed = parseArgument(options, startOptionsSchema, 'ActorStartOptions');
146
- const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, } = parsed;
163
+ const { waitForFinish, runTimeoutSecs, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, timeoutSecs, } = parsed;
164
+ // The API's `timeout` parameter bounds the run, not the request.
147
165
  const params = {
148
166
  waitForFinish,
149
- timeout,
167
+ timeout: runTimeoutSecs,
150
168
  memory,
151
169
  build,
152
170
  webhooks: stringifyWebhooksToBase64(parsed.webhooks),
@@ -156,13 +174,14 @@ export class ActorClient extends ResourceClient {
156
174
  forcePermissionLevel,
157
175
  };
158
176
  const request = {
159
- url: this._url('runs'),
177
+ url: this.buildUrl('runs'),
160
178
  method: 'POST',
161
179
  data: input,
162
- params: this._params(params),
180
+ params: this.buildParams(params),
163
181
  // Apify internal property. Tells the request serialization interceptor
164
182
  // to stringify functions to JSON, instead of omitting them.
165
183
  stringifyFunctions: true,
184
+ timeoutSecs: this.timeoutForWaitForFinish(timeoutSecs, 'medium', waitForFinish),
166
185
  };
167
186
  if (parsed.contentType) {
168
187
  request.headers = {
@@ -185,7 +204,8 @@ export class ActorClient extends ResourceClient {
185
204
  * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance.
186
205
  * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`).
187
206
  * @param options.memory - Memory in megabytes allocated for the run.
188
- * @param options.timeout - Maximum run duration in seconds.
207
+ * @param options.runTimeoutSecs - Maximum run duration in seconds.
208
+ * @param options.timeoutSecs - Timeout for each API request, the start and every poll alike. Default is `'noTimeout'`.
189
209
  * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`)
190
210
  * @see https://docs.apify.com/api/v2/act-runs-post
191
211
  *
@@ -210,8 +230,8 @@ export class ActorClient extends ResourceClient {
210
230
  */
211
231
  async call(input, options = {}) {
212
232
  const parsed = parseArgument(options, callOptionsSchema, 'ActorCallOptions');
213
- const { waitSecs, log, ...startOptions } = parsed;
214
- const { id } = await this.start(input, startOptions);
233
+ const { waitSecs, log, timeoutSecs = 'noTimeout', ...startOptions } = parsed;
234
+ const { id } = await this.start(input, { ...startOptions, timeoutSecs });
215
235
  // Calling root client because we need access to top level API.
216
236
  // Creating a new instance of RunClient here would only allow
217
237
  // setting it up as a nested route under actor API.
@@ -220,7 +240,7 @@ export class ActorClient extends ResourceClient {
220
240
  streamedLog?.start();
221
241
  return this.apifyClient
222
242
  .run(id)
223
- .waitForFinish({ waitSecs })
243
+ .waitForFinish({ waitSecs, timeoutSecs })
224
244
  .finally(async () => {
225
245
  await streamedLog?.stop();
226
246
  });
@@ -237,6 +257,7 @@ export class ActorClient extends ResourceClient {
237
257
  * @param options - Validation options
238
258
  * @param options.build - Tag or number of the build whose input schema the input is validated against
239
259
  * (e.g., `'latest'` or `'1.2.345'`). If not provided, uses the default build.
260
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
240
261
  * @returns `true` if the input is valid. Invalid input causes the underlying API call to throw an `ApifyApiError`.
241
262
  * @see https://docs.apify.com/api/v2/act-validate-input-post
242
263
  *
@@ -256,13 +277,14 @@ export class ActorClient extends ResourceClient {
256
277
  async validateInput(input, options = {}) {
257
278
  const parsed = parseArgument(options, validateInputOptionsSchema, 'ActorValidateInputOptions');
258
279
  const request = {
259
- url: this._url('validate-input'),
280
+ url: this.buildUrl('validate-input'),
260
281
  method: 'POST',
261
282
  data: input,
262
- params: this._params({ build: parsed.build }),
283
+ params: this.buildParams({ build: parsed.build }),
263
284
  // Apify internal property. Tells the request serialization interceptor
264
285
  // to stringify functions to JSON, instead of omitting them.
265
286
  stringifyFunctions: true,
287
+ timeoutSecs: parsed.timeoutSecs ?? 'short',
266
288
  };
267
289
  if (parsed.contentType) {
268
290
  request.headers = {
@@ -284,6 +306,8 @@ export class ActorClient extends ResourceClient {
284
306
  * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced.
285
307
  * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`.
286
308
  * @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).
309
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`, extended to cover `waitForFinish`
310
+ * when the API is asked to hold the response.
287
311
  * @returns The Build object with status and build details
288
312
  * @see https://docs.apify.com/api/v2/act-builds-post
289
313
  *
@@ -303,14 +327,15 @@ export class ActorClient extends ResourceClient {
303
327
  */
304
328
  async build(versionNumber, options = {}) {
305
329
  parseArgument(versionNumber, versionNumberSchema);
306
- const parsed = parseArgument(options, buildOptionsSchema, 'ActorBuildOptions');
330
+ const { timeoutSecs, ...params } = parseArgument(options, buildOptionsSchema, 'ActorBuildOptions');
307
331
  const response = await this.httpClient.call({
308
- url: this._url('builds'),
332
+ url: this.buildUrl('builds'),
309
333
  method: 'POST',
310
- params: this._params({
334
+ params: this.buildParams({
311
335
  version: versionNumber,
312
- ...parsed,
336
+ ...params,
313
337
  }),
338
+ timeoutSecs: this.timeoutForWaitForFinish(timeoutSecs, 'medium', params.waitForFinish),
314
339
  });
315
340
  return parseResponse(response, schemas.Build());
316
341
  }
@@ -323,6 +348,8 @@ export class ActorClient extends ResourceClient {
323
348
  *
324
349
  * @param options - Options for getting the default build
325
350
  * @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).
351
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
352
+ * when the API is asked to hold the response.
326
353
  * @returns A client for the default build
327
354
  * @see https://docs.apify.com/api/v2/act-build-default-get
328
355
  *
@@ -340,10 +367,12 @@ export class ActorClient extends ResourceClient {
340
367
  * @since Added in 2.12.2
341
368
  */
342
369
  async defaultBuild(options = {}) {
370
+ const { timeoutSecs, ...params } = parseArgument(options, defaultBuildOptionsSchema, 'BuildClientGetOptions');
343
371
  const response = await this.httpClient.call({
344
- url: this._url('builds/default'),
372
+ url: this.buildUrl('builds/default'),
345
373
  method: 'GET',
346
- params: this._params(options),
374
+ params: this.buildParams(params),
375
+ timeoutSecs: this.timeoutForWaitForFinish(timeoutSecs, 'short', params.waitForFinish),
347
376
  });
348
377
  const { id } = parseResponse(response, schemas.Build());
349
378
  return new BuildClient({
@@ -373,9 +402,9 @@ export class ActorClient extends ResourceClient {
373
402
  */
374
403
  lastRun(options = {}) {
375
404
  const parsed = parseArgument(options, lastRunOptionsSchema, 'ActorLastRunOptions');
376
- return new RunClient(this._subResourceOptions({
405
+ return new RunClient(this.subResourceOptions({
377
406
  id: 'last',
378
- params: this._params(parsed),
407
+ params: this.buildParams(parsed),
379
408
  resourcePath: 'runs',
380
409
  }));
381
410
  }
@@ -386,7 +415,7 @@ export class ActorClient extends ResourceClient {
386
415
  * @see https://docs.apify.com/api/v2/act-builds-get
387
416
  */
388
417
  builds() {
389
- return new BuildCollectionClient(this._subResourceOptions({
418
+ return new BuildCollectionClient(this.subResourceOptions({
390
419
  resourcePath: 'builds',
391
420
  }));
392
421
  }
@@ -397,7 +426,7 @@ export class ActorClient extends ResourceClient {
397
426
  * @see https://docs.apify.com/api/v2/act-runs-get
398
427
  */
399
428
  runs() {
400
- return new RunCollectionClient(this._subResourceOptions({
429
+ return new RunCollectionClient(this.subResourceOptions({
401
430
  resourcePath: 'runs',
402
431
  }));
403
432
  }
@@ -410,7 +439,7 @@ export class ActorClient extends ResourceClient {
410
439
  */
411
440
  version(versionNumber) {
412
441
  parseArgument(versionNumber, versionNumberSchema);
413
- return new ActorVersionClient(this._subResourceOptions({
442
+ return new ActorVersionClient(this.subResourceOptions({
414
443
  id: versionNumber,
415
444
  }));
416
445
  }
@@ -421,7 +450,7 @@ export class ActorClient extends ResourceClient {
421
450
  * @see https://docs.apify.com/api/v2/act-versions-get
422
451
  */
423
452
  versions() {
424
- return new ActorVersionCollectionClient(this._subResourceOptions());
453
+ return new ActorVersionCollectionClient(this.subResourceOptions());
425
454
  }
426
455
  /**
427
456
  * Returns a client for managing webhooks associated with this Actor.
@@ -430,6 +459,6 @@ export class ActorClient extends ResourceClient {
430
459
  * @see https://docs.apify.com/api/v2/act-webhooks-get
431
460
  */
432
461
  webhooks() {
433
- return new WebhookCollectionClient(this._subResourceOptions());
462
+ return new WebhookCollectionClient(this.subResourceOptions());
434
463
  }
435
464
  }
@@ -2,6 +2,7 @@ import type { ACTOR_PERMISSION_LEVEL } from '@apify/consts';
2
2
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
3
3
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
4
4
  import type { ActorCollectionListItem } from '../models.js';
5
+ import type { TimeoutOptions } from '../timeouts.js';
5
6
  import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils.js';
6
7
  import type { Actor, ActorDefaultRunOptions, ActorExampleRunInput, ActorStandby } from './actor.js';
7
8
  import type { ActorVersion } from './actor_version.js';
@@ -51,6 +52,7 @@ export declare class ActorCollectionClient extends ResourceCollectionClient {
51
52
  * ```
52
53
  *
53
54
  * @param options - Pagination options.
55
+ * @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
54
56
  * @returns A paginated iterator of Actors.
55
57
  * @see https://docs.apify.com/api/v2/acts-get
56
58
  */
@@ -59,10 +61,12 @@ export declare class ActorCollectionClient extends ResourceCollectionClient {
59
61
  * Creates a new Actor.
60
62
  *
61
63
  * @param actor - The Actor data.
64
+ * @param options - Request options
65
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
62
66
  * @returns The created Actor object.
63
67
  * @see https://docs.apify.com/api/v2/acts-post
64
68
  */
65
- create(actor: ActorCollectionCreateOptions): Promise<Actor>;
69
+ create(actor: ActorCollectionCreateOptions, options?: TimeoutOptions): Promise<Actor>;
66
70
  }
67
71
  /**
68
72
  * Field to order a list of Actors by.
@@ -73,7 +77,7 @@ export declare enum ActorListSortBy {
73
77
  CREATED_AT = "createdAt",
74
78
  LAST_RUN_STARTED_AT = "stats.lastRunStartedAt"
75
79
  }
76
- export interface ActorCollectionListOptions extends PaginationOptions {
80
+ export interface ActorCollectionListOptions extends PaginationOptions, TimeoutOptions {
77
81
  my?: boolean;
78
82
  desc?: boolean;
79
83
  /**
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
3
  import * as schemas from '../schemas.js';
4
+ import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
4
5
  import { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
5
6
  const actorCreateSchema = anyObjectSchema.optional();
6
7
  /**
@@ -53,23 +54,27 @@ export class ActorCollectionClient extends ResourceCollectionClient {
53
54
  * ```
54
55
  *
55
56
  * @param options - Pagination options.
57
+ * @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
56
58
  * @returns A paginated iterator of Actors.
57
59
  * @see https://docs.apify.com/api/v2/acts-get
58
60
  */
59
61
  list(options = {}) {
60
62
  const parsed = parseArgument(options, listOptionsSchema, 'ActorCollectionListOptions');
61
- return this._listPaginated(schemas.ListOfActors(), parsed);
63
+ return this.listResourcesPaginated(schemas.ListOfActors(), parsed, 'medium');
62
64
  }
63
65
  /**
64
66
  * Creates a new Actor.
65
67
  *
66
68
  * @param actor - The Actor data.
69
+ * @param options - Request options
70
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
67
71
  * @returns The created Actor object.
68
72
  * @see https://docs.apify.com/api/v2/acts-post
69
73
  */
70
- async create(actor) {
74
+ async create(actor, options = {}) {
71
75
  parseArgument(actor, actorCreateSchema);
72
- return this._create(schemas.Actor(), actor);
76
+ const { timeoutSecs = 'medium' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
77
+ return this.createResource(schemas.Actor(), actor, timeoutSecs);
73
78
  }
74
79
  }
75
80
  /**
@@ -88,4 +93,5 @@ const listOptionsSchema = z.strictObject({
88
93
  ...paginationOptionsShape,
89
94
  desc: z.boolean().optional(),
90
95
  sortBy: z.enum(ActorListSortBy).optional(),
96
+ ...timeoutOptionsShape,
91
97
  });
@@ -1,5 +1,6 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
2
  import { ResourceClient } from '../base/resource_client.js';
3
+ import type { TimeoutOptions } from '../timeouts.js';
3
4
  import type { ActorEnvironmentVariable } from './actor_version.js';
4
5
  /**
5
6
  * Client for managing a specific Actor environment variable.
@@ -32,22 +33,28 @@ export declare class ActorEnvVarClient extends ResourceClient {
32
33
  /**
33
34
  * Retrieves the environment variable.
34
35
  *
36
+ * @param options - Request options
37
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
35
38
  * @returns The environment variable object, or `undefined` if it does not exist.
36
39
  * @see https://docs.apify.com/api/v2/act-version-env-var-get
37
40
  */
38
- get(): Promise<ActorEnvironmentVariable | undefined>;
41
+ get(options?: TimeoutOptions): Promise<ActorEnvironmentVariable | undefined>;
39
42
  /**
40
43
  * Updates the environment variable.
41
44
  *
42
45
  * @param actorEnvVar - The updated environment variable data.
46
+ * @param options - Request options
47
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
43
48
  * @returns The updated environment variable object.
44
49
  * @see https://docs.apify.com/api/v2/act-version-env-var-put
45
50
  */
46
- update(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable>;
51
+ update(actorEnvVar: ActorEnvironmentVariable, options?: TimeoutOptions): Promise<ActorEnvironmentVariable>;
47
52
  /**
48
53
  * Deletes the environment variable.
49
54
  *
55
+ * @param options - Request options
56
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
50
57
  * @see https://docs.apify.com/api/v2/act-version-env-var-delete
51
58
  */
52
- delete(): Promise<void>;
59
+ delete(options?: TimeoutOptions): Promise<void>;
53
60
  }
@@ -1,5 +1,6 @@
1
1
  import { ResourceClient } from '../base/resource_client.js';
2
2
  import * as schemas from '../schemas.js';
3
+ import { timeoutOptionsSchema } from '../timeouts.js';
3
4
  import { anyObjectSchema, parseArgument } from '../utils.js';
4
5
  /**
5
6
  * Client for managing a specific Actor environment variable.
@@ -37,29 +38,38 @@ export class ActorEnvVarClient extends ResourceClient {
37
38
  /**
38
39
  * Retrieves the environment variable.
39
40
  *
41
+ * @param options - Request options
42
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
40
43
  * @returns The environment variable object, or `undefined` if it does not exist.
41
44
  * @see https://docs.apify.com/api/v2/act-version-env-var-get
42
45
  */
43
- async get() {
44
- return this._get(schemas.EnvVar());
46
+ async get(options = {}) {
47
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
48
+ return this.getResource(schemas.EnvVar(), {}, timeoutSecs);
45
49
  }
46
50
  /**
47
51
  * Updates the environment variable.
48
52
  *
49
53
  * @param actorEnvVar - The updated environment variable data.
54
+ * @param options - Request options
55
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
50
56
  * @returns The updated environment variable object.
51
57
  * @see https://docs.apify.com/api/v2/act-version-env-var-put
52
58
  */
53
- async update(actorEnvVar) {
59
+ async update(actorEnvVar, options = {}) {
54
60
  parseArgument(actorEnvVar, anyObjectSchema);
55
- return this._update(schemas.EnvVar(), actorEnvVar);
61
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
62
+ return this.updateResource(schemas.EnvVar(), actorEnvVar, timeoutSecs);
56
63
  }
57
64
  /**
58
65
  * Deletes the environment variable.
59
66
  *
67
+ * @param options - Request options
68
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
60
69
  * @see https://docs.apify.com/api/v2/act-version-env-var-delete
61
70
  */
62
- async delete() {
63
- return this._delete();
71
+ async delete(options = {}) {
72
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
73
+ return this.deleteResource(timeoutSecs);
64
74
  }
65
75
  }
@@ -1,5 +1,6 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import type { TimeoutOptions } from '../timeouts.js';
3
4
  import type { PaginatedList } from '../utils.js';
4
5
  import type { ActorEnvironmentVariable } from './actor_version.js';
5
6
  /**
@@ -49,18 +50,22 @@ export declare class ActorEnvVarCollectionClient extends ResourceCollectionClien
49
50
  * for await (const singleItem of client.list()) {...}
50
51
  * ```
51
52
  *
53
+ * @param options - Request options
54
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
52
55
  * @returns The environment variables, awaitable as a whole list or iterable one by one.
53
56
  * @see https://docs.apify.com/api/v2/act-version-env-vars-get
54
57
  */
55
- list(): Promise<ActorEnvVarListResult> & AsyncIterable<ActorEnvironmentVariable>;
58
+ list(options?: TimeoutOptions): Promise<ActorEnvVarListResult> & AsyncIterable<ActorEnvironmentVariable>;
56
59
  /**
57
60
  * Creates a new environment variable for this Actor version.
58
61
  *
59
62
  * @param actorEnvVar - The environment variable data.
63
+ * @param options - Request options
64
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
60
65
  * @returns The created environment variable object.
61
66
  * @see https://docs.apify.com/api/v2/act-version-env-vars-post
62
67
  */
63
- create(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable>;
68
+ create(actorEnvVar: ActorEnvironmentVariable, options?: TimeoutOptions): Promise<ActorEnvironmentVariable>;
64
69
  }
65
70
  /**
66
71
  * @since Added in 2.1.0
@@ -1,5 +1,6 @@
1
1
  import { ResourceCollectionClient } from '../base/resource_collection_client.js';
2
2
  import * as schemas from '../schemas.js';
3
+ import { timeoutOptionsSchema } from '../timeouts.js';
3
4
  import { anyObjectSchema, parseArgument } from '../utils.js';
4
5
  const actorEnvVarSchema = anyObjectSchema.optional();
5
6
  /**
@@ -54,21 +55,27 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient {
54
55
  * for await (const singleItem of client.list()) {...}
55
56
  * ```
56
57
  *
58
+ * @param options - Request options
59
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
57
60
  * @returns The environment variables, awaitable as a whole list or iterable one by one.
58
61
  * @see https://docs.apify.com/api/v2/act-version-env-vars-get
59
62
  */
60
- list() {
61
- return this._listPaginated(schemas.ListOfEnvVars());
63
+ list(options = {}) {
64
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
65
+ return this.listResourcesPaginated(schemas.ListOfEnvVars(), {}, timeoutSecs);
62
66
  }
63
67
  /**
64
68
  * Creates a new environment variable for this Actor version.
65
69
  *
66
70
  * @param actorEnvVar - The environment variable data.
71
+ * @param options - Request options
72
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
67
73
  * @returns The created environment variable object.
68
74
  * @see https://docs.apify.com/api/v2/act-version-env-vars-post
69
75
  */
70
- async create(actorEnvVar) {
76
+ async create(actorEnvVar, options = {}) {
71
77
  parseArgument(actorEnvVar, actorEnvVarSchema);
72
- return this._create(schemas.EnvVar(), actorEnvVar);
78
+ const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
79
+ return this.createResource(schemas.EnvVar(), actorEnvVar, timeoutSecs);
73
80
  }
74
81
  }
@@ -1,6 +1,7 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
2
  import { ResourceClient } from '../base/resource_client.js';
3
3
  import type { ActorVersion, FinalActorVersion } from '../models.js';
4
+ import type { TimeoutOptions } from '../timeouts.js';
4
5
  import { ActorEnvVarClient } from './actor_env_var.js';
5
6
  import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
6
7
  export type { ActorEnvironmentVariable, ActorVersion, ActorVersionGitHubGist, ActorVersionGitRepo, ActorVersionSourceCode, ActorVersionSourceFile, ActorVersionSourceFiles, ActorVersionSourceFolder, ActorVersionTarball, BaseActorVersion, FinalActorVersion, } from '../models.js';
@@ -34,24 +35,30 @@ export declare class ActorVersionClient extends ResourceClient {
34
35
  /**
35
36
  * Retrieves the Actor version.
36
37
  *
38
+ * @param options - Request options
39
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
37
40
  * @returns The Actor version object, or `undefined` if it does not exist.
38
41
  * @see https://docs.apify.com/api/v2/act-version-get
39
42
  */
40
- get(): Promise<FinalActorVersion | undefined>;
43
+ get(options?: TimeoutOptions): Promise<FinalActorVersion | undefined>;
41
44
  /**
42
45
  * Updates the Actor version with the specified fields.
43
46
  *
44
47
  * @param newFields - Fields to update.
48
+ * @param options - Request options
49
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
45
50
  * @returns The updated Actor version object.
46
51
  * @see https://docs.apify.com/api/v2/act-version-put
47
52
  */
48
- update(newFields: ActorVersionUpdateData): Promise<FinalActorVersion>;
53
+ update(newFields: ActorVersionUpdateData, options?: TimeoutOptions): Promise<FinalActorVersion>;
49
54
  /**
50
55
  * Deletes the Actor version.
51
56
  *
57
+ * @param options - Request options
58
+ * @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
52
59
  * @see https://docs.apify.com/api/v2/act-version-delete
53
60
  */
54
- delete(): Promise<void>;
61
+ delete(options?: TimeoutOptions): Promise<void>;
55
62
  /**
56
63
  * Returns a client for the specified environment variable of this Actor version.
57
64
  *