UNPKG

@socradar/n8n-nodes-socradar

Version:

Production-ready n8n integration for SOCRadar Extended Threat Intelligence platform

181 lines 7.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Socradar = void 0; const utils_1 = require("./utils"); const index_1 = require("./nodeProperties/index"); class Socradar { constructor() { this.description = { displayName: 'SOCRadar', name: 'socradar', icon: 'file:socradar.svg', group: ['transform'], version: 1, subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}', description: 'Comprehensive SOCRadar API integration', defaults: { name: 'SOCRadar', }, inputs: ["main"], outputs: ["main"], credentials: [ { name: 'socradarApi', required: true, }, ], properties: index_1.nodeProperties, }; } async execute() { var _a, _b, _c, _d, _e, _f; const items = this.getInputData(); const returnData = []; const length = items.length; const credentials = await this.getCredentials('socradarApi'); const baseUrl = credentials.baseUrl; const apiKey = credentials.apiKey; const headers = { 'Api-Key': apiKey, 'Content-Type': 'application/json', }; for (let i = 0; i < length; i++) { try { const resource = this.getNodeParameter('resource', i); if (resource === 'incident') { const result = await utils_1.handleIncidentOperations.call(this, baseUrl, headers, i); returnData.push(result); } else if (resource === 'takedown') { try { const result = await utils_1.handleTakedownOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } else if (resource === 'auditLogs') { try { const result = await utils_1.handleAuditLogsOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } else if (resource === 'digitalFootprint') { try { const result = await utils_1.handleDigitalFootprintOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_c = error.response) === null || _c === void 0 ? void 0 : _c.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } else if (resource === 'darkWebMonitoring') { try { const result = await utils_1.handleDarkWebMonitoringOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_d = error.response) === null || _d === void 0 ? void 0 : _d.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } else if (resource === 'fraudProtection') { try { const result = await utils_1.handleFraudProtectionOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_e = error.response) === null || _e === void 0 ? void 0 : _e.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } else if (resource === 'brandProtection') { try { const result = await utils_1.handleBrandProtectionOperations.call(this, baseUrl, headers, i); returnData.push(result); } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, details: ((_f = error.response) === null || _f === void 0 ? void 0 : _f.data) || 'No additional error details', }, pairedItem: { item: i }, }); continue; } throw error; } } } catch (error) { if (this.continueOnFail()) { returnData.push({ json: { error: error.message, }, pairedItem: { item: i }, }); continue; } throw error; } } return [returnData]; } } exports.Socradar = Socradar; //# sourceMappingURL=Socradar.node.js.map