@apify/n8n-nodes-apify
Version:
n8n nodes for Apify
438 lines • 14.5 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.methods = exports.properties = void 0;
const helpers = __importStar(require("../helpers"));
const methods_1 = require("../helpers/methods");
const hooks_1 = require("./hooks");
const actors = __importStar(require("./actors"));
const actorTasks = __importStar(require("./actor-tasks"));
const actorRuns = __importStar(require("./actor-runs"));
const datasets = __importStar(require("./datasets"));
const keyValueStores = __importStar(require("./key-value-stores"));
const authenticationProperties = [];
const resourceSelect = [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Actor',
value: 'Actors',
},
{
name: 'Actor Task',
value: 'Actor tasks',
},
{
name: 'Actor Run',
value: 'Actor runs',
},
{
name: 'Dataset',
value: 'Datasets',
},
{
name: 'Key-Value Store',
value: 'Key-Value Stores',
},
],
default: 'Actors',
},
];
const extraProperties = [
{
displayName: 'Use Custom Body',
name: 'useCustomBody',
type: 'boolean',
description: 'Whether to use a custom body',
default: false,
displayOptions: {
hide: {
resource: ['Actors'],
operation: ['Run actor'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "name": "MyActor",\n "description": "My favourite actor!",\n "title": "My actor",\n "isPublic": false,\n "seoTitle": "My actor",\n "seoDescription": "My actor is the best",\n "restartOnError": false,\n "versions": [\n {\n "versionNumber": "0.0",\n "sourceType": {},\n "envVars": [\n {\n "name": "MY_ENV_VAR",\n "value": "my-value",\n "isSecret": false\n }\n ],\n "applyEnvVarsToBuild": false,\n "buildTag": "latest",\n "sourceFiles": [\n {\n "format": "TEXT",\n "content": "console.log(\'This is the main.js file\');",\n "name": "src/main.js"\n },\n {\n "name": "src/placeholder",\n "folder": true\n }\n ]\n }\n ],\n "categories": [\n "string"\n ],\n "defaultRunOptions": {}\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actors'],
operation: ['Create actor'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "name": "MyActor",\n "description": "My favourite actor!",\n "isPublic": false,\n "seoTitle": "My actor",\n "seoDescription": "My actor is the best",\n "title": "My Actor",\n "restartOnError": false,\n "versions": [\n {\n "name": "MY_ENV_VAR",\n "value": "my-new-value",\n "isSecret": false\n }\n ],\n "categories": [\n "string"\n ],\n "defaultRunOptions": {}\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actors'],
operation: ['Update actor'],
},
},
},
{
displayName: 'Input (JSON)',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
resource: ['Actors'],
operation: ['Run actor'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actors'],
operation: ['With input'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actors'],
operation: ['Run actor synchronously with input and get dataset items'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "startUrls": [\n {\n "url": "https://docs.apify.com/academy/web-scraping-for-beginners"\n }\n ],\n "crawlerType": "cheerio",\n "maxCrawlDepth": 0,\n "maxCrawlPages": 1,\n "maxResults": 1,\n "proxyConfiguration": {\n "useApifyProxy": true\n },\n "removeCookieWarnings": true,\n "saveHtml": true,\n "saveMarkdown": true\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actors'],
operation: ['Scrape single URL'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "actId": "asADASadYvn4mBZmm",\n "name": "my-task",\n "options": {\n "build": "latest",\n "timeoutSecs": 300,\n "memoryMbytes": 128\n },\n "input": {\n "hello": "world"\n }\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Create task'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "id": "ZxLNxrRaZrSjuhT9y",\n "userId": "BPWZBd7Z9c746JAnF",\n "actId": "asADASadYvn4mBZmm",\n "name": "my-task",\n "username": "janedoe",\n "createdAt": "2018-10-26T07:23:14.855Z",\n "modifiedAt": "2018-10-26T13:30:49.578Z",\n "removedAt": "string",\n "stats": {},\n "options": {},\n "input": {}\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Update task'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Update task input'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Run task'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Run task synchronously (POST)'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Actor tasks'],
operation: ['Run task synchronously and get dataset items (POST)'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '{\n "name": "new-dataset-name"\n}',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Datasets'],
operation: ['Update dataset'],
},
},
},
{
displayName: 'Custom Body',
name: 'customBody',
type: 'json',
default: '[\n {\n "foo": "bar"\n },\n {\n "foo": "hotel"\n },\n {\n "foo": "restaurant"\n }\n]',
description: 'Custom body to send',
routing: {
request: {
body: {
customBody: '={{JSON.parse($value)}}',
},
},
send: {
preSend: [helpers.hooks.preSendActionCustonBody],
},
},
displayOptions: {
show: {
useCustomBody: [true],
resource: ['Datasets'],
operation: ['Put items'],
},
},
},
];
const rawProperties = [
...authenticationProperties,
...resourceSelect,
...actors.properties,
...actorTasks.properties,
...actorRuns.properties,
...datasets.properties,
...keyValueStores.properties,
...extraProperties,
];
const { properties, methods: selfMethods } = (0, hooks_1.runHooks)(rawProperties);
exports.properties = properties;
const methods = (0, methods_1.aggregateNodeMethods)([
selfMethods,
actors.methods,
actorTasks.methods,
actorRuns.methods,
datasets.methods,
keyValueStores.methods,
]);
exports.methods = methods;
//# sourceMappingURL=index.js.map