@apify/n8n-nodes-apify
Version:
n8n nodes for Apify
33 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.actorsRouter = actorsRouter;
const n8n_workflow_1 = require("n8n-workflow");
const index_1 = require("./index");
const run_actor_1 = require("./run-actor");
const run_actor_and_get_dataset_1 = require("./run-actor-and-get-dataset");
const scrape_single_url_1 = require("./scrape-single-url");
const get_last_run_1 = require("./get-last-run");
const execute_1 = require("./run-actor/execute");
const execute_2 = require("./scrape-single-url/execute");
const execute_3 = require("./get-last-run/execute");
const execute_4 = require("./run-actor-and-get-dataset/execute");
async function actorsRouter(i) {
const resource = this.getNodeParameter('resource', i);
const operation = this.getNodeParameter('operation', i);
if (resource !== index_1.name) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Resource ${resource} is not valid for ${index_1.name}. Please use correct resource.`);
}
switch (operation) {
case run_actor_1.name:
return await execute_1.runActor.call(this, i);
case run_actor_and_get_dataset_1.name:
return await execute_4.runActorAndGetDataset.call(this, i);
case scrape_single_url_1.scrapeSingleUrlName:
return await execute_2.scrapeSingleUrl.call(this, i);
case get_last_run_1.name:
return await execute_3.getLastRun.call(this, i);
default:
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operation ${operation} not found. Please use correct operation.`);
}
}
//# sourceMappingURL=router.js.map