n8n-nodes-tenable-community
Version:
n8n node for the Tenable One platform
72 lines (71 loc) • 2.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecurityCenter = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const SecurityCenter_node_options_1 = require("./SecurityCenter.node.options");
class SecurityCenter {
constructor() {
this.description = {
displayName: 'Tenable Security Center',
name: 'tenableSecurityCenter',
icon: 'file:tenable.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Interact with the Tenable Security Center API',
defaults: {
name: 'Tenable Security Center',
},
inputs: ["main" /* NodeConnectionType.Main */],
outputs: ["main" /* NodeConnectionType.Main */],
credentials: [
{
name: 'tenableApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{ name: 'Asset', value: 'asset' },
{ name: 'Dashboard', value: 'dashboard' },
{ name: 'Policy', value: 'policy' },
{ name: 'Report', value: 'report' },
{ name: 'Scan', value: 'scan' },
{ name: 'User', value: 'user' },
{ name: 'Vulnerability', value: 'vulnerability' },
],
default: 'vulnerability',
},
...SecurityCenter_node_options_1.securityCenterFields,
],
};
}
async execute() {
const items = this.getInputData();
const returnData = [];
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
for (let i = 0; i < items.length; i++) {
try {
// This is a mock implementation since the API is not defined
const response = { "message": "Operation not implemented due to PDF specification", "resource": resource, "operation": operation };
returnData.push({ json: response });
}
catch (error) {
if (this.continueOnFail()) {
const nodeError = new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
returnData.push({ json: { error: nodeError.message }, error: nodeError });
continue;
}
throw error;
}
}
return [this.helpers.returnJsonArray(returnData)];
}
}
exports.SecurityCenter = SecurityCenter;