apify-client 3.0.0-beta.5 → 3.0.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -3
- package/dist/apify_api_error.d.ts +62 -21
- package/dist/apify_api_error.js +96 -23
- package/dist/apify_client.d.ts +125 -10
- package/dist/apify_client.js +133 -48
- package/dist/base/api_client.d.ts +7 -7
- package/dist/base/api_client.js +36 -24
- package/dist/base/resource_client.d.ts +21 -8
- package/dist/base/resource_client.js +54 -26
- package/dist/base/resource_collection_client.d.ts +12 -4
- package/dist/base/resource_collection_client.js +34 -11
- package/dist/body_parser.d.ts +3 -4
- package/dist/body_parser.js +19 -26
- package/dist/bundle.js +27 -22
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +610 -112
- package/dist/generated/schemas.d.ts +726 -703
- package/dist/generated/schemas.js +92 -85
- package/dist/http_clients/axios.d.ts +60 -0
- package/dist/http_clients/axios.js +117 -0
- package/dist/http_clients/base.d.ts +333 -0
- package/dist/http_clients/base.js +563 -0
- package/dist/http_clients/index.d.ts +4 -0
- package/dist/http_clients/index.js +2 -0
- package/dist/http_compressors/base.d.ts +40 -0
- package/dist/http_compressors/base.js +9 -0
- package/dist/http_compressors/brotli.d.ts +33 -0
- package/dist/http_compressors/brotli.js +39 -0
- package/dist/http_compressors/gzip.d.ts +33 -0
- package/dist/http_compressors/gzip.js +39 -0
- package/dist/http_compressors/index.d.ts +6 -0
- package/dist/http_compressors/index.js +2 -0
- package/dist/http_compressors/resolve.d.ts +23 -0
- package/dist/http_compressors/resolve.js +27 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/invalid_response_body_error.d.ts +13 -0
- package/dist/invalid_response_body_error.js +17 -0
- package/dist/models.d.ts +19 -22
- package/dist/resource_clients/actor.d.ts +72 -32
- package/dist/resource_clients/actor.js +87 -56
- package/dist/resource_clients/actor_collection.d.ts +9 -5
- package/dist/resource_clients/actor_collection.js +11 -3
- package/dist/resource_clients/actor_env_var.d.ts +10 -3
- package/dist/resource_clients/actor_env_var.js +16 -6
- package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
- package/dist/resource_clients/actor_env_var_collection.js +17 -11
- package/dist/resource_clients/actor_version.d.ts +18 -3
- package/dist/resource_clients/actor_version.js +19 -9
- package/dist/resource_clients/actor_version_collection.d.ts +16 -17
- package/dist/resource_clients/actor_version_collection.js +19 -11
- package/dist/resource_clients/build.d.ts +18 -6
- package/dist/resource_clients/build.js +34 -15
- package/dist/resource_clients/build_collection.d.ts +3 -1
- package/dist/resource_clients/build_collection.js +4 -1
- package/dist/resource_clients/dataset.d.ts +51 -33
- package/dist/resource_clients/dataset.js +105 -80
- package/dist/resource_clients/dataset_collection.d.ts +6 -2
- package/dist/resource_clients/dataset_collection.js +13 -2
- package/dist/resource_clients/key_value_store.d.ts +58 -16
- package/dist/resource_clients/key_value_store.js +78 -40
- package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
- package/dist/resource_clients/key_value_store_collection.js +13 -2
- package/dist/resource_clients/log.d.ts +12 -20
- package/dist/resource_clients/log.js +93 -58
- package/dist/resource_clients/request_queue.d.ts +56 -26
- package/dist/resource_clients/request_queue.js +176 -103
- package/dist/resource_clients/request_queue_collection.d.ts +6 -2
- package/dist/resource_clients/request_queue_collection.js +9 -3
- package/dist/resource_clients/run.d.ts +108 -18
- package/dist/resource_clients/run.js +183 -43
- package/dist/resource_clients/run_collection.d.ts +3 -1
- package/dist/resource_clients/run_collection.js +4 -1
- package/dist/resource_clients/schedule.d.ts +14 -5
- package/dist/resource_clients/schedule.js +29 -21
- package/dist/resource_clients/schedule_collection.d.ts +6 -2
- package/dist/resource_clients/schedule_collection.js +9 -3
- package/dist/resource_clients/store_collection.d.ts +3 -1
- package/dist/resource_clients/store_collection.js +4 -1
- package/dist/resource_clients/task.d.ts +33 -10
- package/dist/resource_clients/task.js +79 -46
- package/dist/resource_clients/task_collection.d.ts +6 -2
- package/dist/resource_clients/task_collection.js +9 -3
- package/dist/resource_clients/user.d.ts +17 -8
- package/dist/resource_clients/user.js +42 -38
- package/dist/resource_clients/webhook.d.ts +14 -5
- package/dist/resource_clients/webhook.js +30 -22
- package/dist/resource_clients/webhook_collection.d.ts +6 -2
- package/dist/resource_clients/webhook_collection.js +9 -3
- package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
- package/dist/resource_clients/webhook_dispatch.js +7 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
- package/dist/runtime/node.d.ts +6 -0
- package/dist/runtime/node.js +49 -0
- package/dist/runtime/types.d.ts +52 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/web.d.ts +5 -0
- package/dist/runtime/web.js +18 -0
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/dist/statistics.d.ts +1 -6
- package/dist/statistics.js +2 -2
- package/dist/timeouts.d.ts +84 -0
- package/dist/timeouts.js +37 -0
- package/dist/timezones.d.ts +1 -1
- package/dist/utils.d.ts +81 -52
- package/dist/utils.js +201 -170
- package/dist/wait_for_resources.d.ts +8 -0
- package/dist/wait_for_resources.js +39 -0
- package/package.json +32 -29
- package/dist/http_client.d.ts +0 -88
- package/dist/http_client.js +0 -255
- package/dist/interceptors.d.ts +0 -19
- package/dist/interceptors.js +0 -105
|
@@ -2,12 +2,14 @@ import { z } from 'zod';
|
|
|
2
2
|
import { STORAGE_OWNERSHIP_FILTER } from '@apify/consts';
|
|
3
3
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
4
4
|
import * as schemas from '../schemas.js';
|
|
5
|
+
import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
|
|
5
6
|
import { paginationOptionsShape, parseArgument } from '../utils.js';
|
|
6
7
|
const listOptionsSchema = z.strictObject({
|
|
7
8
|
unnamed: z.boolean().optional(),
|
|
8
9
|
...paginationOptionsShape,
|
|
9
10
|
desc: z.boolean().optional(),
|
|
10
11
|
ownership: z.enum(STORAGE_OWNERSHIP_FILTER).optional(),
|
|
12
|
+
...timeoutOptionsShape,
|
|
11
13
|
});
|
|
12
14
|
const nameSchema = z.string().optional();
|
|
13
15
|
/**
|
|
@@ -57,22 +59,26 @@ export class RequestQueueCollectionClient extends ResourceCollectionClient {
|
|
|
57
59
|
* ```
|
|
58
60
|
*
|
|
59
61
|
* @param options - Pagination options.
|
|
62
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
|
|
60
63
|
* @returns A paginated iterator of Request queues.
|
|
61
64
|
* @see https://docs.apify.com/api/v2/request-queues-get
|
|
62
65
|
*/
|
|
63
66
|
list(options = {}) {
|
|
64
67
|
const parsed = parseArgument(options, listOptionsSchema, 'RequestQueueCollectionListOptions');
|
|
65
|
-
return this.
|
|
68
|
+
return this.listResourcesPaginated(schemas.ListOfRequestQueues(), parsed, 'medium');
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
71
|
* Gets or creates a Request queue with the specified name.
|
|
69
72
|
*
|
|
70
73
|
* @param name - Name of the Request queue. If not provided, a default queue is used.
|
|
74
|
+
* @param options - Request options
|
|
75
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
71
76
|
* @returns The Request queue object.
|
|
72
77
|
* @see https://docs.apify.com/api/v2/request-queues-post
|
|
73
78
|
*/
|
|
74
|
-
async getOrCreate(name) {
|
|
79
|
+
async getOrCreate(name, options = {}) {
|
|
75
80
|
parseArgument(name, nameSchema);
|
|
76
|
-
|
|
81
|
+
const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
82
|
+
return this.getOrCreateResource(schemas.RequestQueue(), name, undefined, timeoutSecs, signal);
|
|
77
83
|
}
|
|
78
84
|
}
|
|
@@ -2,8 +2,10 @@ import type { RUN_GENERAL_ACCESS } from '@apify/consts';
|
|
|
2
2
|
import { Log } from '@apify/log';
|
|
3
3
|
import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client.js';
|
|
4
4
|
import { ResourceClient } from '../base/resource_client.js';
|
|
5
|
-
import type { ApifyResponse } from '../
|
|
6
|
-
import type {
|
|
5
|
+
import type { ApifyResponse } from '../http_clients/index.js';
|
|
6
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
7
|
+
import type { PaginationOptions } from '../utils.js';
|
|
8
|
+
import type { ActorInput, ActorRun } from './actor.js';
|
|
7
9
|
import { DatasetClient } from './dataset.js';
|
|
8
10
|
import { KeyValueStoreClient } from './key_value_store.js';
|
|
9
11
|
import { LogClient, StreamedLog } from './log.js';
|
|
@@ -41,6 +43,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
41
43
|
*
|
|
42
44
|
* @param options - Get options
|
|
43
45
|
* @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).
|
|
46
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
|
|
47
|
+
* when the API is asked to hold the response.
|
|
44
48
|
* @returns The ActorRun object, or `undefined` if it does not exist
|
|
45
49
|
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
46
50
|
*
|
|
@@ -60,6 +64,7 @@ export declare class RunClient extends ResourceClient {
|
|
|
60
64
|
*
|
|
61
65
|
* @param options - Abort options
|
|
62
66
|
* @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort).
|
|
67
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
63
68
|
* @returns The updated ActorRun object with `ABORTING` or `ABORTED` status
|
|
64
69
|
* @see https://docs.apify.com/api/v2/actor-run-abort-post
|
|
65
70
|
*
|
|
@@ -76,10 +81,12 @@ export declare class RunClient extends ResourceClient {
|
|
|
76
81
|
/**
|
|
77
82
|
* Deletes the Actor run.
|
|
78
83
|
*
|
|
84
|
+
* @param options - Request options
|
|
85
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
79
86
|
* @see https://docs.apify.com/api/v2/actor-run-delete
|
|
80
87
|
* @since Added in 2.8.1
|
|
81
88
|
*/
|
|
82
|
-
delete(): Promise<void>;
|
|
89
|
+
delete(options?: TimeoutOptions): Promise<void>;
|
|
83
90
|
/**
|
|
84
91
|
* Transforms the Actor run into a run of another Actor (metamorph).
|
|
85
92
|
*
|
|
@@ -88,10 +95,11 @@ export declare class RunClient extends ResourceClient {
|
|
|
88
95
|
* This is useful for chaining Actor executions or implementing complex workflows.
|
|
89
96
|
*
|
|
90
97
|
* @param targetActorId - ID or username/name of the target Actor
|
|
91
|
-
* @param input - Input for the target Actor
|
|
98
|
+
* @param input - Input for the target Actor: an object or array serialized to JSON, or raw bytes sent as they
|
|
99
|
+
* are. Omit it to metamorph without input.
|
|
92
100
|
* @param options - Metamorph options
|
|
93
101
|
* @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build.
|
|
94
|
-
* @param options.
|
|
102
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
95
103
|
* @returns The metamorphed ActorRun object (same ID, but now running the target Actor)
|
|
96
104
|
* @see https://docs.apify.com/api/v2/actor-run-metamorph-post
|
|
97
105
|
*
|
|
@@ -105,7 +113,7 @@ export declare class RunClient extends ResourceClient {
|
|
|
105
113
|
* console.log(`Run ${metamorphedRun.id} is now running ${metamorphedRun.actId}`);
|
|
106
114
|
* ```
|
|
107
115
|
*/
|
|
108
|
-
metamorph(targetActorId: string, input
|
|
116
|
+
metamorph(targetActorId: string, input?: ActorInput, options?: RunMetamorphOptions): Promise<ActorRun>;
|
|
109
117
|
/**
|
|
110
118
|
* Reboots the Actor run.
|
|
111
119
|
*
|
|
@@ -113,6 +121,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
113
121
|
* This can be useful to recover from certain errors or to force the Actor to restart
|
|
114
122
|
* with a fresh environment.
|
|
115
123
|
*
|
|
124
|
+
* @param options - Request options
|
|
125
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
116
126
|
* @returns The updated ActorRun object
|
|
117
127
|
* @see https://docs.apify.com/api/v2/actor-run-reboot-post
|
|
118
128
|
*
|
|
@@ -122,7 +132,7 @@ export declare class RunClient extends ResourceClient {
|
|
|
122
132
|
* ```
|
|
123
133
|
* @since Added in 2.8.0
|
|
124
134
|
*/
|
|
125
|
-
reboot(): Promise<ActorRun>;
|
|
135
|
+
reboot(options?: TimeoutOptions): Promise<ActorRun>;
|
|
126
136
|
/**
|
|
127
137
|
* Updates the Actor run with specified fields.
|
|
128
138
|
*
|
|
@@ -130,6 +140,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
130
140
|
* @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100")
|
|
131
141
|
* @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`.
|
|
132
142
|
* @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED')
|
|
143
|
+
* @param options - Request options
|
|
144
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
133
145
|
* @returns The updated ActorRun object
|
|
134
146
|
*
|
|
135
147
|
* @example
|
|
@@ -141,7 +153,7 @@ export declare class RunClient extends ResourceClient {
|
|
|
141
153
|
* ```
|
|
142
154
|
* @since Added in 2.6.0
|
|
143
155
|
*/
|
|
144
|
-
update(newFields: RunUpdateOptions): Promise<ActorRun>;
|
|
156
|
+
update(newFields: RunUpdateOptions, options?: TimeoutOptions): Promise<ActorRun>;
|
|
145
157
|
/**
|
|
146
158
|
* Resurrects a finished Actor run, starting it again with the same settings.
|
|
147
159
|
*
|
|
@@ -151,10 +163,11 @@ export declare class RunClient extends ResourceClient {
|
|
|
151
163
|
* @param options - Resurrection options (override original run settings)
|
|
152
164
|
* @param options.build - Tag or number of the build to use. If not provided, uses the original run's build.
|
|
153
165
|
* @param options.memory - Memory in megabytes. If not provided, uses the original run's memory.
|
|
154
|
-
* @param options.
|
|
166
|
+
* @param options.runTimeoutSecs - Timeout for the resurrected run in seconds. If not provided, uses the original run's timeout.
|
|
155
167
|
* @param options.maxItems - Maximum number of dataset items (pay-per-result Actors).
|
|
156
168
|
* @param options.maxTotalChargeUsd - Maximum cost in USD (pay-per-event Actors).
|
|
157
169
|
* @param options.restartOnError - Whether to restart on error.
|
|
170
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
158
171
|
* @returns The new (resurrected) ActorRun object
|
|
159
172
|
* @see https://docs.apify.com/api/v2/post-resurrect-run
|
|
160
173
|
*
|
|
@@ -173,6 +186,7 @@ export declare class RunClient extends ResourceClient {
|
|
|
173
186
|
* @param options.eventName - **Required.** Name of the event to charge for.
|
|
174
187
|
* @param options.count - Number of times to charge the event. Default is 1.
|
|
175
188
|
* @param options.idempotencyKey - Optional key to ensure the charge is not duplicated. If not provided, one is auto-generated.
|
|
189
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
176
190
|
* @returns Empty response object.
|
|
177
191
|
* @see https://docs.apify.com/api/v2/post-charge-run
|
|
178
192
|
* @since Added in 2.11.0
|
|
@@ -191,7 +205,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
191
205
|
*
|
|
192
206
|
* @param options - Wait options
|
|
193
207
|
* @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If the limit is reached, the returned promise resolves to a run object that will have status `READY` or `RUNNING`. If omitted, waits indefinitely.
|
|
194
|
-
* @
|
|
208
|
+
* @param options.timeoutSecs - Timeout for each polling API request. Default is `'noTimeout'`.
|
|
209
|
+
* @returns The ActorRun object (finished or still running if the timeout was reached)
|
|
195
210
|
*
|
|
196
211
|
* @example
|
|
197
212
|
* ```javascript
|
|
@@ -210,6 +225,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
210
225
|
/**
|
|
211
226
|
* Returns a client for the default dataset of this Actor run.
|
|
212
227
|
*
|
|
228
|
+
* A 404 from this client throws an `ApifyApiError`, since the run itself may be what is missing.
|
|
229
|
+
*
|
|
213
230
|
* @returns A client for accessing the run's default dataset
|
|
214
231
|
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
215
232
|
*
|
|
@@ -223,6 +240,9 @@ export declare class RunClient extends ResourceClient {
|
|
|
223
240
|
/**
|
|
224
241
|
* Returns a client for the default key-value store of this Actor run.
|
|
225
242
|
*
|
|
243
|
+
* `get()` and `delete()` throw an `ApifyApiError` on a 404, since the run itself may be what is missing. Record
|
|
244
|
+
* lookups such as `getRecord()` read a 404 as a missing record.
|
|
245
|
+
*
|
|
226
246
|
* @returns A client for accessing the run's default key-value store
|
|
227
247
|
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
228
248
|
*
|
|
@@ -236,6 +256,9 @@ export declare class RunClient extends ResourceClient {
|
|
|
236
256
|
/**
|
|
237
257
|
* Returns a client for the default Request queue of this Actor run.
|
|
238
258
|
*
|
|
259
|
+
* `get()` and `delete()` throw an `ApifyApiError` on a 404, since the run itself may be what is missing.
|
|
260
|
+
* `getRequest()` reads a 404 as a missing request.
|
|
261
|
+
*
|
|
239
262
|
* @returns A client for accessing the run's default Request queue
|
|
240
263
|
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
241
264
|
*
|
|
@@ -249,6 +272,8 @@ export declare class RunClient extends ResourceClient {
|
|
|
249
272
|
/**
|
|
250
273
|
* Returns a client for accessing the log of this Actor run.
|
|
251
274
|
*
|
|
275
|
+
* A 404 from this client throws an `ApifyApiError`, since the run itself may be what is missing.
|
|
276
|
+
*
|
|
252
277
|
* @returns A client for accessing the run's log
|
|
253
278
|
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
254
279
|
*
|
|
@@ -262,34 +287,79 @@ export declare class RunClient extends ResourceClient {
|
|
|
262
287
|
log(): LogClient;
|
|
263
288
|
/**
|
|
264
289
|
* Get StreamedLog for convenient streaming of the run log and their redirection.
|
|
290
|
+
*
|
|
291
|
+
* @param options - Streaming options
|
|
292
|
+
* @param options.toLog - Log instance to redirect the run log to. Use `'default'` for a preconfigured one, or `null` to disable the redirection.
|
|
293
|
+
* @param options.fromStart - If `true`, the log is streamed from its beginning. Default is `true`.
|
|
294
|
+
* @param options.timeoutSecs - Timeout for the API requests that fetch the run and its Actor. Default is `'long'`.
|
|
265
295
|
* @since Added in 2.20.0
|
|
266
296
|
*/
|
|
267
297
|
getStreamedLog(options?: GetStreamedLogOptions): Promise<StreamedLog | undefined>;
|
|
298
|
+
/**
|
|
299
|
+
* Iterates over the items of the run's default dataset while the run is still producing them.
|
|
300
|
+
*
|
|
301
|
+
* While the run has not finished, each poll yields the rows below the dataset's `itemCount` and then waits up to
|
|
302
|
+
* `pollIntervalSecs` for the run to finish, so the last rows are read as soon as it does. Each page is requested
|
|
303
|
+
* with a `limit` that ends at `itemCount`, so it covers exactly the rows it asks for, whatever the filters or
|
|
304
|
+
* `unwind` do to the items. `itemCount` lags a few seconds behind
|
|
305
|
+
* the pushed items, so once the run reaches a terminal status, the rows past it are read a page at a time until
|
|
306
|
+
* none are left, and the iterator returns. On a `lastRun()` client, the iterator sticks to the run that its first
|
|
307
|
+
* request resolves to.
|
|
308
|
+
*
|
|
309
|
+
* @param options - Iteration options
|
|
310
|
+
* @param options.offset - Number of rows to skip from the beginning. Default is 0.
|
|
311
|
+
* @param options.limit - Maximum number of dataset rows to scan. Fewer items are yielded when filters drop some,
|
|
312
|
+
* more when `unwind` splits a row into several. Default is no limit.
|
|
313
|
+
* @param options.clean - If `true`, returns only non-empty items and skips hidden fields. Default is `false`.
|
|
314
|
+
* @param options.fields - Array of field names to include in the results. Omits all other fields.
|
|
315
|
+
* @param options.omit - Array of field names to exclude from the results.
|
|
316
|
+
* @param options.unwind - Array of field names to unwind. Each array value creates a separate item.
|
|
317
|
+
* @param options.skipEmpty - If `true`, skips empty items. Default is `false`.
|
|
318
|
+
* @param options.skipHidden - If `true`, skips hidden fields (fields starting with `#`). Default is `false`.
|
|
319
|
+
* @param options.chunkSize - Maximum number of dataset rows requested per API call. Default is 1000.
|
|
320
|
+
* @param options.pollIntervalSecs - How long to wait for the run to finish between polls, in seconds. Default is 5.
|
|
321
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'long'`.
|
|
322
|
+
* @returns An async iterable of the dataset items
|
|
323
|
+
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```javascript
|
|
327
|
+
* for await (const item of client.run('run-id').iterateDatasetItems()) {
|
|
328
|
+
* console.log(item);
|
|
329
|
+
* }
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
iterateDatasetItems<Data extends Record<string | number, any> = Record<string | number, unknown>>(options?: RunIterateDatasetItemsOptions): AsyncGenerator<Data, void, undefined>;
|
|
268
333
|
}
|
|
269
334
|
/**
|
|
270
335
|
* Options for getting a streamed log.
|
|
271
336
|
* @since Added in 2.20.0
|
|
272
337
|
*/
|
|
273
|
-
export interface GetStreamedLogOptions {
|
|
338
|
+
export interface GetStreamedLogOptions extends TimeoutOptions {
|
|
274
339
|
toLog?: Log | null | 'default';
|
|
275
340
|
fromStart?: boolean;
|
|
276
341
|
}
|
|
277
342
|
/**
|
|
278
343
|
* Options for getting a Run.
|
|
279
344
|
*/
|
|
280
|
-
export interface RunGetOptions {
|
|
345
|
+
export interface RunGetOptions extends TimeoutOptions {
|
|
281
346
|
waitForFinish?: number;
|
|
282
347
|
}
|
|
283
348
|
/**
|
|
284
349
|
* Options for aborting a Run.
|
|
285
350
|
*/
|
|
286
|
-
export interface RunAbortOptions {
|
|
351
|
+
export interface RunAbortOptions extends TimeoutOptions {
|
|
287
352
|
gracefully?: boolean;
|
|
288
353
|
}
|
|
289
354
|
/**
|
|
290
355
|
* Options for metamorphing a Run into another Actor.
|
|
291
356
|
*/
|
|
292
|
-
export interface RunMetamorphOptions {
|
|
357
|
+
export interface RunMetamorphOptions extends TimeoutOptions {
|
|
358
|
+
/**
|
|
359
|
+
* Content type of the request body, which becomes the content type of the run's `INPUT` record.
|
|
360
|
+
* Without it, an input is serialized to JSON and sent as `application/json`. Pairing an object
|
|
361
|
+
* with `application/x-www-form-urlencoded` form-encodes it instead.
|
|
362
|
+
*/
|
|
293
363
|
contentType?: string;
|
|
294
364
|
build?: string;
|
|
295
365
|
}
|
|
@@ -311,10 +381,11 @@ export interface RunUpdateOptions {
|
|
|
311
381
|
/**
|
|
312
382
|
* Options for resurrecting a finished Run.
|
|
313
383
|
*/
|
|
314
|
-
export interface RunResurrectOptions {
|
|
384
|
+
export interface RunResurrectOptions extends TimeoutOptions {
|
|
315
385
|
build?: string;
|
|
316
386
|
memory?: number;
|
|
317
|
-
timeout
|
|
387
|
+
/** Timeout for the resurrected run in seconds. If not provided, the run keeps its original timeout. */
|
|
388
|
+
runTimeoutSecs?: number;
|
|
318
389
|
/**
|
|
319
390
|
* @since Added in 2.12.1
|
|
320
391
|
*/
|
|
@@ -332,7 +403,7 @@ export interface RunResurrectOptions {
|
|
|
332
403
|
* Options for charging events in a pay-per-event Actor run.
|
|
333
404
|
* @since Added in 2.11.0
|
|
334
405
|
*/
|
|
335
|
-
export interface RunChargeOptions {
|
|
406
|
+
export interface RunChargeOptions extends TimeoutOptions {
|
|
336
407
|
/** Name of the event to charge. Must be defined in the Actor's pricing info else the API will throw. */
|
|
337
408
|
eventName: string;
|
|
338
409
|
/** Defaults to 1 */
|
|
@@ -343,7 +414,7 @@ export interface RunChargeOptions {
|
|
|
343
414
|
/**
|
|
344
415
|
* Options for waiting for a Run to finish.
|
|
345
416
|
*/
|
|
346
|
-
export interface RunWaitForFinishOptions {
|
|
417
|
+
export interface RunWaitForFinishOptions extends TimeoutOptions {
|
|
347
418
|
/**
|
|
348
419
|
* Maximum time to wait for the run to finish, in seconds.
|
|
349
420
|
* If the limit is reached, the returned promise is resolved to a run object that will have
|
|
@@ -351,3 +422,22 @@ export interface RunWaitForFinishOptions {
|
|
|
351
422
|
*/
|
|
352
423
|
waitSecs?: number;
|
|
353
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Options for iterating over the items of a run's default dataset while the run is still producing them.
|
|
427
|
+
*/
|
|
428
|
+
export interface RunIterateDatasetItemsOptions extends PaginationOptions, TimeoutOptions {
|
|
429
|
+
/** If `true`, returns only non-empty items and skips hidden fields. */
|
|
430
|
+
clean?: boolean;
|
|
431
|
+
/** Field names to include in the items. Omits all other fields. */
|
|
432
|
+
fields?: string[];
|
|
433
|
+
/** Field names to exclude from the items. */
|
|
434
|
+
omit?: string[];
|
|
435
|
+
/** If `true`, skips empty items. */
|
|
436
|
+
skipEmpty?: boolean;
|
|
437
|
+
/** If `true`, skips hidden fields (fields starting with `#`). */
|
|
438
|
+
skipHidden?: boolean;
|
|
439
|
+
/** Field names to unwind. Each array value creates a separate item. */
|
|
440
|
+
unwind?: string[];
|
|
441
|
+
/** How long to wait for the run to finish between polls, in seconds. Default is 5. */
|
|
442
|
+
pollIntervalSecs?: number;
|
|
443
|
+
}
|