apify-client 2.20.1-beta.6 → 2.20.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apify_client.d.ts +237 -25
- package/dist/apify_client.d.ts.map +1 -1
- package/dist/apify_client.js +234 -25
- package/dist/apify_client.js.map +1 -1
- package/dist/bundle.js +2042 -253
- package/dist/bundle.js.map +1 -1
- package/dist/resource_clients/actor.d.ts +322 -31
- package/dist/resource_clients/actor.d.ts.map +1 -1
- package/dist/resource_clients/actor.js +167 -19
- package/dist/resource_clients/actor.js.map +1 -1
- package/dist/resource_clients/actor_collection.d.ts +34 -3
- package/dist/resource_clients/actor_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_collection.js +34 -3
- package/dist/resource_clients/actor_collection.js.map +1 -1
- package/dist/resource_clients/actor_env_var.d.ts +34 -3
- package/dist/resource_clients/actor_env_var.d.ts.map +1 -1
- package/dist/resource_clients/actor_env_var.js +34 -3
- package/dist/resource_clients/actor_env_var.js.map +1 -1
- package/dist/resource_clients/actor_env_var_collection.d.ts +37 -3
- package/dist/resource_clients/actor_env_var_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_env_var_collection.js +37 -3
- package/dist/resource_clients/actor_env_var_collection.js.map +1 -1
- package/dist/resource_clients/actor_version.d.ts +42 -6
- package/dist/resource_clients/actor_version.d.ts.map +1 -1
- package/dist/resource_clients/actor_version.js +42 -6
- package/dist/resource_clients/actor_version.js.map +1 -1
- package/dist/resource_clients/actor_version_collection.d.ts +35 -3
- package/dist/resource_clients/actor_version_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_version_collection.js +35 -3
- package/dist/resource_clients/actor_version_collection.js.map +1 -1
- package/dist/resource_clients/build.d.ts +123 -11
- package/dist/resource_clients/build.d.ts.map +1 -1
- package/dist/resource_clients/build.js +93 -11
- package/dist/resource_clients/build.js.map +1 -1
- package/dist/resource_clients/build_collection.d.ts +27 -2
- package/dist/resource_clients/build_collection.d.ts.map +1 -1
- package/dist/resource_clients/build_collection.js +27 -2
- package/dist/resource_clients/build_collection.js.map +1 -1
- package/dist/resource_clients/dataset.d.ts +221 -15
- package/dist/resource_clients/dataset.d.ts.map +1 -1
- package/dist/resource_clients/dataset.js +185 -15
- package/dist/resource_clients/dataset.js.map +1 -1
- package/dist/resource_clients/dataset_collection.d.ts +32 -3
- package/dist/resource_clients/dataset_collection.d.ts.map +1 -1
- package/dist/resource_clients/dataset_collection.js +32 -3
- package/dist/resource_clients/dataset_collection.js.map +1 -1
- package/dist/resource_clients/key_value_store.d.ts +219 -26
- package/dist/resource_clients/key_value_store.d.ts.map +1 -1
- package/dist/resource_clients/key_value_store.js +172 -25
- package/dist/resource_clients/key_value_store.js.map +1 -1
- package/dist/resource_clients/key_value_store_collection.d.ts +32 -3
- package/dist/resource_clients/key_value_store_collection.d.ts.map +1 -1
- package/dist/resource_clients/key_value_store_collection.js +32 -3
- package/dist/resource_clients/key_value_store_collection.js.map +1 -1
- package/dist/resource_clients/log.d.ts +34 -3
- package/dist/resource_clients/log.d.ts.map +1 -1
- package/dist/resource_clients/log.js +34 -3
- package/dist/resource_clients/log.js.map +1 -1
- package/dist/resource_clients/request_queue.d.ts +290 -19
- package/dist/resource_clients/request_queue.d.ts.map +1 -1
- package/dist/resource_clients/request_queue.js +233 -19
- package/dist/resource_clients/request_queue.js.map +1 -1
- package/dist/resource_clients/request_queue_collection.d.ts +31 -3
- package/dist/resource_clients/request_queue_collection.d.ts.map +1 -1
- package/dist/resource_clients/request_queue_collection.js +31 -3
- package/dist/resource_clients/request_queue_collection.js.map +1 -1
- package/dist/resource_clients/run.d.ts +224 -27
- package/dist/resource_clients/run.d.ts.map +1 -1
- package/dist/resource_clients/run.js +200 -27
- package/dist/resource_clients/run.js.map +1 -1
- package/dist/resource_clients/run_collection.d.ts +27 -2
- package/dist/resource_clients/run_collection.d.ts.map +1 -1
- package/dist/resource_clients/run_collection.js +27 -2
- package/dist/resource_clients/run_collection.js.map +1 -1
- package/dist/resource_clients/schedule.d.ts +65 -4
- package/dist/resource_clients/schedule.d.ts.map +1 -1
- package/dist/resource_clients/schedule.js +42 -4
- package/dist/resource_clients/schedule.js.map +1 -1
- package/dist/resource_clients/schedule_collection.d.ts +35 -3
- package/dist/resource_clients/schedule_collection.d.ts.map +1 -1
- package/dist/resource_clients/schedule_collection.js +35 -3
- package/dist/resource_clients/schedule_collection.js.map +1 -1
- package/dist/resource_clients/store_collection.d.ts +26 -2
- package/dist/resource_clients/store_collection.d.ts.map +1 -1
- package/dist/resource_clients/store_collection.js +26 -2
- package/dist/resource_clients/store_collection.js.map +1 -1
- package/dist/resource_clients/task.d.ts +110 -11
- package/dist/resource_clients/task.d.ts.map +1 -1
- package/dist/resource_clients/task.js +83 -11
- package/dist/resource_clients/task.js.map +1 -1
- package/dist/resource_clients/task_collection.d.ts +35 -8
- package/dist/resource_clients/task_collection.d.ts.map +1 -1
- package/dist/resource_clients/task_collection.js +35 -8
- package/dist/resource_clients/task_collection.js.map +1 -1
- package/dist/resource_clients/user.d.ts +41 -4
- package/dist/resource_clients/user.d.ts.map +1 -1
- package/dist/resource_clients/user.js +41 -4
- package/dist/resource_clients/user.js.map +1 -1
- package/dist/resource_clients/webhook.d.ts +66 -5
- package/dist/resource_clients/webhook.d.ts.map +1 -1
- package/dist/resource_clients/webhook.js +48 -5
- package/dist/resource_clients/webhook.js.map +1 -1
- package/dist/resource_clients/webhook_collection.d.ts +34 -3
- package/dist/resource_clients/webhook_collection.d.ts.map +1 -1
- package/dist/resource_clients/webhook_collection.js +34 -3
- package/dist/resource_clients/webhook_collection.js.map +1 -1
- package/dist/resource_clients/webhook_dispatch.d.ts +22 -1
- package/dist/resource_clients/webhook_dispatch.d.ts.map +1 -1
- package/dist/resource_clients/webhook_dispatch.js +22 -1
- package/dist/resource_clients/webhook_dispatch.js.map +1 -1
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +24 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts.map +1 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +24 -2
- package/dist/resource_clients/webhook_dispatch_collection.js.map +1 -1
- package/dist/utils.d.ts +42 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,29 @@ const key_value_store_1 = require("./key_value_store");
|
|
|
11
11
|
const log_2 = require("./log");
|
|
12
12
|
const request_queue_1 = require("./request_queue");
|
|
13
13
|
const RUN_CHARGE_IDEMPOTENCY_HEADER = 'idempotency-key';
|
|
14
|
+
/**
|
|
15
|
+
* Client for managing a specific Actor run.
|
|
16
|
+
*
|
|
17
|
+
* Provides methods to get run details, abort, metamorph, resurrect, wait for completion,
|
|
18
|
+
* and access the run's dataset, key-value store, request queue, and logs.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
23
|
+
* const runClient = client.run('my-run-id');
|
|
24
|
+
*
|
|
25
|
+
* // Get run details
|
|
26
|
+
* const run = await runClient.get();
|
|
27
|
+
*
|
|
28
|
+
* // Wait for the run to finish
|
|
29
|
+
* const finishedRun = await runClient.waitForFinish();
|
|
30
|
+
*
|
|
31
|
+
* // Access the run's dataset
|
|
32
|
+
* const { items } = await runClient.dataset().listItems();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see https://docs.apify.com/platform/actors/running/runs-and-builds
|
|
36
|
+
*/
|
|
14
37
|
class RunClient extends resource_client_1.ResourceClient {
|
|
15
38
|
/**
|
|
16
39
|
* @hidden
|
|
@@ -22,7 +45,22 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
22
45
|
});
|
|
23
46
|
}
|
|
24
47
|
/**
|
|
25
|
-
*
|
|
48
|
+
* Gets the Actor run object from the Apify API.
|
|
49
|
+
*
|
|
50
|
+
* @param options - Get options
|
|
51
|
+
* @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).
|
|
52
|
+
* @returns The ActorRun object, or `undefined` if it does not exist
|
|
53
|
+
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```javascript
|
|
57
|
+
* // Get run status immediately
|
|
58
|
+
* const run = await client.run('run-id').get();
|
|
59
|
+
* console.log(`Status: ${run.status}`);
|
|
60
|
+
*
|
|
61
|
+
* // Wait up to 60 seconds for run to finish
|
|
62
|
+
* const run = await client.run('run-id').get({ waitForFinish: 60 });
|
|
63
|
+
* ```
|
|
26
64
|
*/
|
|
27
65
|
async get(options = {}) {
|
|
28
66
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -31,7 +69,21 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
31
69
|
return this._get(options);
|
|
32
70
|
}
|
|
33
71
|
/**
|
|
34
|
-
*
|
|
72
|
+
* Aborts the Actor run.
|
|
73
|
+
*
|
|
74
|
+
* @param options - Abort options
|
|
75
|
+
* @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort).
|
|
76
|
+
* @returns The updated ActorRun object with `ABORTING` or `ABORTED` status
|
|
77
|
+
* @see https://docs.apify.com/api/v2/actor-run-abort-post
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```javascript
|
|
81
|
+
* // Abort immediately
|
|
82
|
+
* await client.run('run-id').abort();
|
|
83
|
+
*
|
|
84
|
+
* // Abort gracefully (allows cleanup)
|
|
85
|
+
* await client.run('run-id').abort({ gracefully: true });
|
|
86
|
+
* ```
|
|
35
87
|
*/
|
|
36
88
|
async abort(options = {}) {
|
|
37
89
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -45,13 +97,37 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
45
97
|
return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
|
|
46
98
|
}
|
|
47
99
|
/**
|
|
48
|
-
*
|
|
100
|
+
* Deletes the Actor run.
|
|
101
|
+
*
|
|
102
|
+
* @see https://docs.apify.com/api/v2/actor-run-delete
|
|
49
103
|
*/
|
|
50
104
|
async delete() {
|
|
51
105
|
return this._delete();
|
|
52
106
|
}
|
|
53
107
|
/**
|
|
54
|
-
*
|
|
108
|
+
* Transforms the Actor run into a run of another Actor (metamorph).
|
|
109
|
+
*
|
|
110
|
+
* This operation preserves the run ID, storages (dataset, key-value store, request queue),
|
|
111
|
+
* and resource allocation. The run effectively becomes a run of the target Actor with new input.
|
|
112
|
+
* This is useful for chaining Actor executions or implementing complex workflows.
|
|
113
|
+
*
|
|
114
|
+
* @param targetActorId - ID or username/name of the target Actor
|
|
115
|
+
* @param input - Input for the target Actor. Can be any JSON-serializable value.
|
|
116
|
+
* @param options - Metamorph options
|
|
117
|
+
* @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build.
|
|
118
|
+
* @param options.contentType - Content type of the input. If specified, input must be a string or Buffer.
|
|
119
|
+
* @returns The metamorphed ActorRun object (same ID, but now running the target Actor)
|
|
120
|
+
* @see https://docs.apify.com/api/v2/actor-run-metamorph-post
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```javascript
|
|
124
|
+
* // Transform current run into another Actor
|
|
125
|
+
* const metamorphedRun = await client.run('original-run-id').metamorph(
|
|
126
|
+
* 'target-actor-id',
|
|
127
|
+
* { url: 'https://example.com' }
|
|
128
|
+
* );
|
|
129
|
+
* console.log(`Run ${metamorphedRun.id} is now running ${metamorphedRun.actId}`);
|
|
130
|
+
* ```
|
|
55
131
|
*/
|
|
56
132
|
async metamorph(targetActorId, input, options = {}) {
|
|
57
133
|
(0, ow_1.default)(targetActorId, ow_1.default.string);
|
|
@@ -85,7 +161,19 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
85
161
|
return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
|
|
86
162
|
}
|
|
87
163
|
/**
|
|
88
|
-
*
|
|
164
|
+
* Reboots the Actor run.
|
|
165
|
+
*
|
|
166
|
+
* Rebooting restarts the Actor's Docker container while preserving the run ID and storages.
|
|
167
|
+
* This can be useful to recover from certain errors or to force the Actor to restart
|
|
168
|
+
* with a fresh environment.
|
|
169
|
+
*
|
|
170
|
+
* @returns The updated ActorRun object
|
|
171
|
+
* @see https://docs.apify.com/api/v2/actor-run-reboot-post
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```javascript
|
|
175
|
+
* const run = await client.run('run-id').reboot();
|
|
176
|
+
* ```
|
|
89
177
|
*/
|
|
90
178
|
async reboot() {
|
|
91
179
|
const request = {
|
|
@@ -95,12 +183,49 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
95
183
|
const response = await this.httpClient.call(request);
|
|
96
184
|
return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
|
|
97
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Updates the Actor run with specified fields.
|
|
188
|
+
*
|
|
189
|
+
* @param newFields - Fields to update
|
|
190
|
+
* @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100")
|
|
191
|
+
* @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`.
|
|
192
|
+
* @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED')
|
|
193
|
+
* @returns The updated ActorRun object
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```javascript
|
|
197
|
+
* // Set a status message
|
|
198
|
+
* await client.run('run-id').update({
|
|
199
|
+
* statusMessage: 'Processing items: 50/100'
|
|
200
|
+
* });
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
98
203
|
async update(newFields) {
|
|
99
204
|
(0, ow_1.default)(newFields, ow_1.default.object);
|
|
100
205
|
return this._update(newFields);
|
|
101
206
|
}
|
|
102
207
|
/**
|
|
103
|
-
*
|
|
208
|
+
* Resurrects a finished Actor run, starting it again with the same settings.
|
|
209
|
+
*
|
|
210
|
+
* This creates a new run with the same configuration as the original run. The original
|
|
211
|
+
* run's storages (dataset, key-value store, request queue) are preserved and reused.
|
|
212
|
+
*
|
|
213
|
+
* @param options - Resurrection options (override original run settings)
|
|
214
|
+
* @param options.build - Tag or number of the build to use. If not provided, uses the original run's build.
|
|
215
|
+
* @param options.memory - Memory in megabytes. If not provided, uses the original run's memory.
|
|
216
|
+
* @param options.timeout - Timeout in seconds. If not provided, uses the original run's timeout.
|
|
217
|
+
* @param options.maxItems - Maximum number of dataset items (pay-per-result Actors).
|
|
218
|
+
* @param options.maxTotalChargeUsd - Maximum cost in USD (pay-per-event Actors).
|
|
219
|
+
* @param options.restartOnError - Whether to restart on error.
|
|
220
|
+
* @returns The new (resurrected) ActorRun object
|
|
221
|
+
* @see https://docs.apify.com/api/v2/post-resurrect-run
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```javascript
|
|
225
|
+
* // Resurrect a failed run with more memory
|
|
226
|
+
* const newRun = await client.run('failed-run-id').resurrect({ memory: 2048 });
|
|
227
|
+
* console.log(`New run started: ${newRun.id}`);
|
|
228
|
+
* ```
|
|
104
229
|
*/
|
|
105
230
|
async resurrect(options = {}) {
|
|
106
231
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -119,7 +244,14 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
119
244
|
return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
|
|
120
245
|
}
|
|
121
246
|
/**
|
|
122
|
-
*
|
|
247
|
+
* Charges the Actor run for a specific event.
|
|
248
|
+
*
|
|
249
|
+
* @param options - Charge options including event name and count.
|
|
250
|
+
* @param options.eventName - **Required.** Name of the event to charge for.
|
|
251
|
+
* @param options.count - Number of times to charge the event. Default is 1.
|
|
252
|
+
* @param options.idempotencyKey - Optional key to ensure the charge is not duplicated. If not provided, one is auto-generated.
|
|
253
|
+
* @returns Empty response object.
|
|
254
|
+
* @see https://docs.apify.com/api/v2/post-charge-run
|
|
123
255
|
*/
|
|
124
256
|
async charge(options) {
|
|
125
257
|
var _a, _b;
|
|
@@ -147,16 +279,32 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
147
279
|
return response;
|
|
148
280
|
}
|
|
149
281
|
/**
|
|
150
|
-
*
|
|
151
|
-
* or with the unfinished Run object when the `waitSecs` timeout lapses. The promise is NOT rejected
|
|
152
|
-
* based on run status. You can inspect the `status` property of the Run object to find out its status.
|
|
282
|
+
* Waits for the Actor run to finish and returns the finished Run object.
|
|
153
283
|
*
|
|
154
|
-
* The
|
|
155
|
-
*
|
|
156
|
-
* `
|
|
284
|
+
* The promise resolves when the run reaches a terminal state (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`).
|
|
285
|
+
* If `waitSecs` is provided and the timeout is reached, the promise resolves with the unfinished
|
|
286
|
+
* Run object (status will be `RUNNING` or `READY`). The promise is NOT rejected based on run status.
|
|
157
287
|
*
|
|
158
|
-
*
|
|
159
|
-
* by
|
|
288
|
+
* Unlike the `waitForFinish` parameter in {@link get}, this method can wait indefinitely
|
|
289
|
+
* by polling the run status. It uses the `waitForFinish` parameter internally (max 60s per call)
|
|
290
|
+
* and continuously polls until the run finishes or the timeout is reached.
|
|
291
|
+
*
|
|
292
|
+
* @param options - Wait options
|
|
293
|
+
* @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.
|
|
294
|
+
* @returns The ActorRun object (finished or still running if timeout was reached)
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```javascript
|
|
298
|
+
* // Wait indefinitely for run to finish
|
|
299
|
+
* const run = await client.run('run-id').waitForFinish();
|
|
300
|
+
* console.log(`Run finished with status: ${run.status}`);
|
|
301
|
+
*
|
|
302
|
+
* // Wait up to 5 minutes
|
|
303
|
+
* const run = await client.run('run-id').waitForFinish({ waitSecs: 300 });
|
|
304
|
+
* if (run.status === 'SUCCEEDED') {
|
|
305
|
+
* console.log('Run succeeded!');
|
|
306
|
+
* }
|
|
307
|
+
* ```
|
|
160
308
|
*/
|
|
161
309
|
async waitForFinish(options = {}) {
|
|
162
310
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -165,10 +313,16 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
165
313
|
return this._waitForFinish(options);
|
|
166
314
|
}
|
|
167
315
|
/**
|
|
168
|
-
*
|
|
316
|
+
* Returns a client for the default dataset of this Actor run.
|
|
317
|
+
*
|
|
318
|
+
* @returns A client for accessing the run's default dataset
|
|
319
|
+
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
169
320
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```javascript
|
|
323
|
+
* // Access run's dataset
|
|
324
|
+
* const { items } = await client.run('run-id').dataset().listItems();
|
|
325
|
+
* ```
|
|
172
326
|
*/
|
|
173
327
|
dataset() {
|
|
174
328
|
return new dataset_1.DatasetClient(this._subResourceOptions({
|
|
@@ -176,10 +330,16 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
176
330
|
}));
|
|
177
331
|
}
|
|
178
332
|
/**
|
|
179
|
-
*
|
|
333
|
+
* Returns a client for the default key-value store of this Actor run.
|
|
180
334
|
*
|
|
181
|
-
*
|
|
182
|
-
* https://docs.apify.com/api/v2
|
|
335
|
+
* @returns A client for accessing the run's default key-value store
|
|
336
|
+
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```javascript
|
|
340
|
+
* // Access run's key-value store
|
|
341
|
+
* const output = await client.run('run-id').keyValueStore().getRecord('OUTPUT');
|
|
342
|
+
* ```
|
|
183
343
|
*/
|
|
184
344
|
keyValueStore() {
|
|
185
345
|
return new key_value_store_1.KeyValueStoreClient(this._subResourceOptions({
|
|
@@ -187,10 +347,16 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
187
347
|
}));
|
|
188
348
|
}
|
|
189
349
|
/**
|
|
190
|
-
*
|
|
350
|
+
* Returns a client for the default Request queue of this Actor run.
|
|
351
|
+
*
|
|
352
|
+
* @returns A client for accessing the run's default Request queue
|
|
353
|
+
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
191
354
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```javascript
|
|
357
|
+
* // Access run's Request queue
|
|
358
|
+
* const { items } = await client.run('run-id').requestQueue().listHead();
|
|
359
|
+
* ```
|
|
194
360
|
*/
|
|
195
361
|
requestQueue() {
|
|
196
362
|
return new request_queue_1.RequestQueueClient(this._subResourceOptions({
|
|
@@ -198,10 +364,17 @@ class RunClient extends resource_client_1.ResourceClient {
|
|
|
198
364
|
}));
|
|
199
365
|
}
|
|
200
366
|
/**
|
|
201
|
-
*
|
|
367
|
+
* Returns a client for accessing the log of this Actor run.
|
|
368
|
+
*
|
|
369
|
+
* @returns A client for accessing the run's log
|
|
370
|
+
* @see https://docs.apify.com/api/v2/actor-run-get
|
|
202
371
|
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```javascript
|
|
374
|
+
* // Get run log
|
|
375
|
+
* const log = await client.run('run-id').log().get();
|
|
376
|
+
* console.log(log);
|
|
377
|
+
* ```
|
|
205
378
|
*/
|
|
206
379
|
log() {
|
|
207
380
|
return new log_2.LogClient(this._subResourceOptions({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/resource_clients/run.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AAGpB,oCAAyC;AAGzC,6DAAyD;AAEzD,oCAAoE;AAEpE,uCAA0C;AAC1C,uDAAwD;AACxD,+BAAoE;A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AK,EAAE,SAAS,EAAE,CAAC,CAAC;IACxE,CAAC;CACJ;AA7aD,8BA6aC"}
|
|
@@ -3,19 +3,40 @@ import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_clien
|
|
|
3
3
|
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
4
4
|
import type { PaginatedIterator, PaginationOptions } from '../utils';
|
|
5
5
|
import type { ActorRunListItem } from './actor';
|
|
6
|
+
/**
|
|
7
|
+
* Client for managing the collection of Actor runs.
|
|
8
|
+
*
|
|
9
|
+
* Provides methods to list Actor runs across all Actors or for a specific Actor.
|
|
10
|
+
* To access an individual run, use the `run()` method on the main ApifyClient.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
15
|
+
*
|
|
16
|
+
* // List all runs
|
|
17
|
+
* const runsClient = client.runs();
|
|
18
|
+
* const { items } = await runsClient.list();
|
|
19
|
+
*
|
|
20
|
+
* // List runs for a specific Actor
|
|
21
|
+
* const actorRunsClient = client.actor('my-actor-id').runs();
|
|
22
|
+
* const { items: actorRuns } = await actorRunsClient.list();
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @see https://docs.apify.com/platform/actors/running/runs-and-builds
|
|
26
|
+
*/
|
|
6
27
|
export declare class RunCollectionClient extends ResourceCollectionClient {
|
|
7
28
|
/**
|
|
8
29
|
* @hidden
|
|
9
30
|
*/
|
|
10
31
|
constructor(options: ApiClientOptionsWithOptionalResourcePath);
|
|
11
32
|
/**
|
|
12
|
-
*
|
|
33
|
+
* Lists all Actor runs.
|
|
13
34
|
*
|
|
14
35
|
* Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched
|
|
15
36
|
* items in a single API call is limited.
|
|
16
37
|
* ```javascript
|
|
17
38
|
* const paginatedList = await client.list(options);
|
|
18
|
-
|
|
39
|
+
* ```
|
|
19
40
|
*
|
|
20
41
|
* Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are
|
|
21
42
|
* retrieved.
|
|
@@ -23,6 +44,10 @@ export declare class RunCollectionClient extends ResourceCollectionClient {
|
|
|
23
44
|
* ```javascript
|
|
24
45
|
* for await (const singleItem of client.list(options)) {...}
|
|
25
46
|
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param options - Pagination and filtering options.
|
|
49
|
+
* @returns A paginated iterator of Actor runs.
|
|
50
|
+
* @see https://docs.apify.com/api/v2/actor-runs-get
|
|
26
51
|
*/
|
|
27
52
|
list(options?: RunCollectionListOptions): PaginatedIterator<ActorRunListItem>;
|
|
28
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_collection.d.ts","sourceRoot":"","sources":["../../src/resource_clients/run_collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,mBAAoB,SAAQ,wBAAwB;IAC7D;;OAEG;gBACS,OAAO,EAAE,wCAAwC;IAO7D
|
|
1
|
+
{"version":3,"file":"run_collection.d.ts","sourceRoot":"","sources":["../../src/resource_clients/run_collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,mBAAoB,SAAQ,wBAAwB;IAC7D;;OAEG;gBACS,OAAO,EAAE,wCAAwC;IAO7D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,OAAO,GAAE,wBAA6B,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;CAkBpF;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EACD,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,GAC5D,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,EAAE,CAAC;IACrE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CAChC"}
|
|
@@ -5,6 +5,27 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
6
|
const consts_1 = require("@apify/consts");
|
|
7
7
|
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
8
|
+
/**
|
|
9
|
+
* Client for managing the collection of Actor runs.
|
|
10
|
+
*
|
|
11
|
+
* Provides methods to list Actor runs across all Actors or for a specific Actor.
|
|
12
|
+
* To access an individual run, use the `run()` method on the main ApifyClient.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
17
|
+
*
|
|
18
|
+
* // List all runs
|
|
19
|
+
* const runsClient = client.runs();
|
|
20
|
+
* const { items } = await runsClient.list();
|
|
21
|
+
*
|
|
22
|
+
* // List runs for a specific Actor
|
|
23
|
+
* const actorRunsClient = client.actor('my-actor-id').runs();
|
|
24
|
+
* const { items: actorRuns } = await actorRunsClient.list();
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see https://docs.apify.com/platform/actors/running/runs-and-builds
|
|
28
|
+
*/
|
|
8
29
|
class RunCollectionClient extends resource_collection_client_1.ResourceCollectionClient {
|
|
9
30
|
/**
|
|
10
31
|
* @hidden
|
|
@@ -16,13 +37,13 @@ class RunCollectionClient extends resource_collection_client_1.ResourceCollectio
|
|
|
16
37
|
});
|
|
17
38
|
}
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
40
|
+
* Lists all Actor runs.
|
|
20
41
|
*
|
|
21
42
|
* Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched
|
|
22
43
|
* items in a single API call is limited.
|
|
23
44
|
* ```javascript
|
|
24
45
|
* const paginatedList = await client.list(options);
|
|
25
|
-
|
|
46
|
+
* ```
|
|
26
47
|
*
|
|
27
48
|
* Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are
|
|
28
49
|
* retrieved.
|
|
@@ -30,6 +51,10 @@ class RunCollectionClient extends resource_collection_client_1.ResourceCollectio
|
|
|
30
51
|
* ```javascript
|
|
31
52
|
* for await (const singleItem of client.list(options)) {...}
|
|
32
53
|
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param options - Pagination and filtering options.
|
|
56
|
+
* @returns A paginated iterator of Actor runs.
|
|
57
|
+
* @see https://docs.apify.com/api/v2/actor-runs-get
|
|
33
58
|
*/
|
|
34
59
|
list(options = {}) {
|
|
35
60
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_collection.js","sourceRoot":"","sources":["../../src/resource_clients/run_collection.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AAEpB,0CAAmD;AAGnD,mFAA8E;AAI9E,MAAa,mBAAoB,SAAQ,qDAAwB;IAC7D;;OAEG;IACH,YAAY,OAAiD;QACzD,KAAK,CAAC;YACF,YAAY,EAAE,MAAM;YACpB,GAAG,OAAO;SACb,CAAC,CAAC;IACP,CAAC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CACJ;AAjDD,kDAiDC"}
|
|
@@ -2,28 +2,68 @@ import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
|
2
2
|
import { ResourceClient } from '../base/resource_client';
|
|
3
3
|
import type { Timezone } from '../timezones';
|
|
4
4
|
import type { DistributiveOptional } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Client for managing a specific Schedule.
|
|
7
|
+
*
|
|
8
|
+
* Schedules are used to automatically start Actors or tasks at specified times. This client provides
|
|
9
|
+
* methods to get, update, and delete schedules, as well as retrieve schedule logs.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
14
|
+
* const scheduleClient = client.schedule('my-schedule-id');
|
|
15
|
+
*
|
|
16
|
+
* // Get schedule details
|
|
17
|
+
* const schedule = await scheduleClient.get();
|
|
18
|
+
*
|
|
19
|
+
* // Update schedule
|
|
20
|
+
* await scheduleClient.update({
|
|
21
|
+
* cronExpression: '0 12 * * *',
|
|
22
|
+
* isEnabled: true
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://docs.apify.com/platform/schedules
|
|
27
|
+
*/
|
|
5
28
|
export declare class ScheduleClient extends ResourceClient {
|
|
6
29
|
/**
|
|
7
30
|
* @hidden
|
|
8
31
|
*/
|
|
9
32
|
constructor(options: ApiClientSubResourceOptions);
|
|
10
33
|
/**
|
|
11
|
-
*
|
|
34
|
+
* Retrieves the schedule.
|
|
35
|
+
*
|
|
36
|
+
* @returns The schedule object, or `undefined` if it does not exist.
|
|
37
|
+
* @see https://docs.apify.com/api/v2/schedule-get
|
|
12
38
|
*/
|
|
13
39
|
get(): Promise<Schedule | undefined>;
|
|
14
40
|
/**
|
|
15
|
-
*
|
|
41
|
+
* Updates the schedule with the specified fields.
|
|
42
|
+
*
|
|
43
|
+
* @param newFields - Fields to update.
|
|
44
|
+
* @returns The updated schedule object.
|
|
45
|
+
* @see https://docs.apify.com/api/v2/schedule-put
|
|
16
46
|
*/
|
|
17
47
|
update(newFields: ScheduleCreateOrUpdateData): Promise<Schedule>;
|
|
18
48
|
/**
|
|
19
|
-
*
|
|
49
|
+
* Deletes the schedule.
|
|
50
|
+
*
|
|
51
|
+
* @see https://docs.apify.com/api/v2/schedule-delete
|
|
20
52
|
*/
|
|
21
53
|
delete(): Promise<void>;
|
|
22
54
|
/**
|
|
23
|
-
*
|
|
55
|
+
* Retrieves the schedule's log.
|
|
56
|
+
*
|
|
57
|
+
* @returns The schedule log as a string, or `undefined` if it does not exist.
|
|
58
|
+
* @see https://docs.apify.com/api/v2/schedule-log-get
|
|
24
59
|
*/
|
|
25
60
|
getLog(): Promise<string | undefined>;
|
|
26
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Represents a schedule for automated Actor or Task runs.
|
|
64
|
+
*
|
|
65
|
+
* Schedules use cron expressions to define when Actors or Tasks should run automatically.
|
|
66
|
+
*/
|
|
27
67
|
export interface Schedule {
|
|
28
68
|
id: string;
|
|
29
69
|
userId: string;
|
|
@@ -43,9 +83,15 @@ export interface Schedule {
|
|
|
43
83
|
email: boolean;
|
|
44
84
|
};
|
|
45
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Data for creating or updating a Schedule.
|
|
88
|
+
*/
|
|
46
89
|
export type ScheduleCreateOrUpdateData = Partial<Pick<Schedule, 'name' | 'title' | 'cronExpression' | 'timezone' | 'isEnabled' | 'isExclusive' | 'description' | 'notifications'> & {
|
|
47
90
|
actions: DistributiveOptional<ScheduleAction, 'id'>[];
|
|
48
91
|
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Types of actions that can be scheduled.
|
|
94
|
+
*/
|
|
49
95
|
export declare enum ScheduleActions {
|
|
50
96
|
RunActor = "RUN_ACTOR",
|
|
51
97
|
RunActorTask = "RUN_ACTOR_TASK"
|
|
@@ -54,22 +100,37 @@ interface BaseScheduleAction<Type extends ScheduleActions> {
|
|
|
54
100
|
id: string;
|
|
55
101
|
type: Type;
|
|
56
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Union type representing all possible scheduled actions.
|
|
105
|
+
*/
|
|
57
106
|
export type ScheduleAction = ScheduleActionRunActor | ScheduleActionRunActorTask;
|
|
107
|
+
/**
|
|
108
|
+
* Scheduled action to run an Actor.
|
|
109
|
+
*/
|
|
58
110
|
export interface ScheduleActionRunActor extends BaseScheduleAction<ScheduleActions.RunActor> {
|
|
59
111
|
actorId: string;
|
|
60
112
|
runInput?: ScheduledActorRunInput;
|
|
61
113
|
runOptions?: ScheduledActorRunOptions;
|
|
62
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Input configuration for a scheduled Actor run.
|
|
117
|
+
*/
|
|
63
118
|
export interface ScheduledActorRunInput {
|
|
64
119
|
body: string;
|
|
65
120
|
contentType: string;
|
|
66
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Run options for a scheduled Actor run.
|
|
124
|
+
*/
|
|
67
125
|
export interface ScheduledActorRunOptions {
|
|
68
126
|
build: string;
|
|
69
127
|
timeoutSecs: number;
|
|
70
128
|
memoryMbytes: number;
|
|
71
129
|
restartOnError?: boolean;
|
|
72
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Scheduled action to run an Actor task.
|
|
133
|
+
*/
|
|
73
134
|
export interface ScheduleActionRunActorTask extends BaseScheduleAction<ScheduleActions.RunActorTask> {
|
|
74
135
|
actorTaskId: string;
|
|
75
136
|
input?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../src/resource_clients/schedule.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,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