@apify/n8n-nodes-apify
Version:
n8n nodes for Apify
35 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRun = getRun;
const n8n_workflow_1 = require("n8n-workflow");
const genericFunctions_1 = require("../../../resources/genericFunctions");
async function getRun(i) {
const runId = this.getNodeParameter('runId', i, undefined, {
extractValue: true,
});
if (!runId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Run ID is required');
}
try {
const apiResult = await genericFunctions_1.apiRequest.call(this, {
method: 'GET',
uri: `/v2/actor-runs/${runId}`,
});
if (!apiResult) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
message: `Run ${runId} not found`,
});
}
if (apiResult.error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
message: apiResult.error.message,
type: apiResult.error.type,
});
}
return { json: { ...apiResult.data } };
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=execute.js.map