You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Performs an execution of a selected actor in Apify. [See the documentation](https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor)",
8
-
version: "0.0.2",
10
+
version: "0.0.3",
9
11
type: "action",
10
12
props: {
11
13
apify,
@@ -14,6 +16,52 @@ export default {
14
16
apify,
15
17
"actorId",
16
18
],
19
+
},
20
+
buildId: {
21
+
propDefinition: [
22
+
apify,
23
+
"buildId",
24
+
(c)=>({
25
+
actorId: c.actorId,
26
+
}),
27
+
],
28
+
reloadProps: true,
29
+
},
30
+
runAsynchronously: {
31
+
type: "boolean",
32
+
label: "Run Asynchronously",
33
+
description: "Set to `true` to run the actor asynchronously",
34
+
reloadProps: true,
35
+
},
36
+
timeout: {
37
+
type: "string",
38
+
label: "Timeout",
39
+
description: "Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor.",
40
+
optional: true,
41
+
},
42
+
memory: {
43
+
type: "string",
44
+
label: "Memory",
45
+
description: "Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor.",
46
+
optional: true,
47
+
},
48
+
maxItems: {
49
+
type: "string",
50
+
label: "Max Items",
51
+
description: "The maximum number of items that the Actor run should return. This is useful for pay-per-result Actors, as it allows you to limit the number of results that will be charged to your subscription. You can access the maximum number of items in your Actor by using the ACTOR_MAX_PAID_DATASET_ITEMS environment variable.",
52
+
optional: true,
53
+
},
54
+
maxTotalChargeUsd: {
55
+
type: "string",
56
+
label: "Max Total Charge USD",
57
+
description: "Specifies the maximum cost of the Actor run. This parameter is useful for pay-per-event Actors, as it allows you to limit the amount charged to your subscription. You can access the maximum cost in your Actor by using the ACTOR_MAX_TOTAL_CHARGE_USD environment variable.",
58
+
optional: true,
59
+
},
60
+
webhook: {
61
+
type: "string",
62
+
label: "Webhook",
63
+
description: "Specifies optional webhook associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed.",
if(props[key].type!=="object"){// default values don't work properly for object props
157
+
props[key].default=value.default;
158
+
}
159
+
}
160
+
}
161
+
}catch{
162
+
props.properties={
163
+
type: "object",
164
+
label: "Properties",
165
+
description: "Properties to set for this actor",
166
+
};
167
+
}
168
+
if(this.runAsynchronously){
169
+
props.outputRecordKey={
170
+
type: "string",
171
+
label: "Output Record Key",
172
+
description: "Key of the record from run's default key-value store to be returned in the response. By default, it is OUTPUT.",
173
+
optional: true,
174
+
};
175
+
}else{
176
+
props.waitForFinish={
177
+
type: "string",
178
+
label: "Wait For Finish",
179
+
description: "The maximum number of seconds the server waits for the run to finish. By default, it is 0, the maximum value is 60. If the build finishes in time then the returned run object will have a terminal status (e.g. SUCCEEDED), otherwise it will have a transitional status (e.g. RUNNING).",
180
+
optional: true,
104
181
};
105
-
constoptions=this.prepareOptions(value);
106
-
if(options)props[key].options=options;
107
182
}
108
183
}
184
+
if(this.webhook){
185
+
props.eventTypes={
186
+
type: "string[]",
187
+
label: "Event Types",
188
+
description: "The types of events to send to the webhook",
189
+
options: EVENT_TYPES,
190
+
};
191
+
}
109
192
returnprops;
110
193
},
111
194
asyncrun({ $ }){
@@ -117,14 +200,50 @@ export default {
117
200
prepareData,
118
201
apify,
119
202
actorId,
203
+
buildId,
204
+
properties,
205
+
runAsynchronously,
206
+
outputRecordKey,
207
+
timeout,
208
+
memory,
209
+
maxItems,
210
+
maxTotalChargeUsd,
211
+
waitForFinish,
212
+
webhook,
213
+
eventTypes,
120
214
...data
121
215
}=this;
122
216
123
-
constresponse=awaitapify.runActor({
217
+
constfn=runAsynchronously
218
+
? apify.runActorAsynchronously
219
+
: apify.runActor;
220
+
221
+
constresponse=awaitfn({
124
222
actorId,
125
-
data: awaitprepareData(data),
223
+
data: properties
224
+
? parseObject(properties)
225
+
: awaitprepareData(data),
226
+
params: {
227
+
outputRecordKey,
228
+
timeout,
229
+
memory,
230
+
maxItems,
231
+
maxTotalChargeUsd,
232
+
waitForFinish,
233
+
webhooks: webhook
234
+
? btoa(JSON.stringify([
235
+
{
236
+
eventTypes,
237
+
requestUrl: webhook,
238
+
},
239
+
]))
240
+
: undefined,
241
+
},
126
242
});
127
-
$.export("$summary",`Successfully started actor run with ID: ${response.data.id}`);
243
+
constsummary=this.runAsynchronously
244
+
? `Successfully started actor run with ID: ${response.data.id}`
245
+
: `Successfully ran actor with ID: ${this.actorId}`;
Copy file name to clipboardExpand all lines: components/apify/actions/run-task-synchronously/run-task-synchronously.mjs
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ export default {
4
4
key: "apify-run-task-synchronously",
5
5
name: "Run Task Synchronously",
6
6
description: "Run a specific task and return its dataset items. [See the documentation](https://docs.apify.com/api/v2/actor-task-run-sync-get-dataset-items-get)",
Copy file name to clipboardExpand all lines: components/apify/actions/scrape-single-url/scrape-single-url.mjs
+1-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ export default {
5
5
key: "apify-scrape-single-url",
6
6
name: "Scrape Single URL",
7
7
description: "Executes a scraper on a specific website and returns its content as text. This action is perfect for extracting content from a single page.",
Copy file name to clipboardExpand all lines: components/apify/actions/set-key-value-store-record/set-key-value-store-record.mjs
+1-1
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ export default {
5
5
key: "apify-set-key-value-store-record",
6
6
name: "Set Key-Value Store Record",
7
7
description: "Create or update a record in the key-value store of Apify. [See the documentation](https://docs.apify.com/api/v2#/reference/key-value-stores/record-collection/put-record)",
0 commit comments