UNPKG

@ev1lc0rp/n8n-nodes-ninjaone

Version:

Professional NinjaOne RMM integration for n8n with complete ticketing and device management

317 lines 12.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NinjaOne = void 0; const operations_1 = require("./operations"); class NinjaOne { constructor() { this.description = { displayName: 'NinjaOne', name: 'ninjaOne', icon: { light: 'file:ninjaone.svg', dark: 'file:ninjaone.svg' }, group: ['transform'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', description: 'Interact with the NinjaOne API', defaults: { name: 'NinjaOne', }, inputs: ["main"], outputs: ["main"], usableAsTool: true, credentials: [ { name: 'ninjaOneOAuth2Api', required: true, }, ], requestDefaults: { baseURL: '={{$credentials.baseUrl || "https://app.ninjaone.com"}}', url: '', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, }, properties: [ { displayName: 'Resource', name: 'resource', type: 'options', noDataExpression: true, options: [ { name: 'Device', value: 'device', }, { name: 'Ticket', value: 'ticket', }, { name: 'Organization', value: 'organization', }, ], default: 'device', }, ...operations_1.deviceOperations, ...operations_1.ticketOperations, ...operations_1.organizationOperations, { displayName: 'Name', name: 'name', description: 'Name of the organization', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['organization'], operation: ['create'], }, }, }, { displayName: 'Organization ID', name: 'organizationId', description: 'ID of the organization', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['organization'], operation: ['get'], }, }, }, { displayName: 'Description', name: 'description', description: 'Description of the organization', type: 'string', default: '', displayOptions: { show: { resource: ['organization'], operation: ['create'], }, }, }, { displayName: 'Device ID', name: 'deviceId', description: 'ID of the device', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['device'], operation: ['get', 'getActivities', 'getAlerts', 'getCustomFields', 'getDisks', 'getJobs', 'getLastLoggedOnUser', 'getNetworkInterfaces', 'getOsPatchInstalls', 'getOsPatches', 'getPolicyOverrides', 'getProcessors', 'getSoftware', 'getSoftwarePatchInstalls', 'getSoftwarePatches', 'getVolumes', 'getWindowsServices', 'updateCustomFields', 'runScript', 'rebootDevice', 'controlWindowsService', 'getDashboardUrl'], }, }, }, { displayName: 'Limit', name: 'limit', type: 'number', default: 50, description: 'Max number of results to return', typeOptions: { minValue: 1, }, displayOptions: { show: { resource: ['device', 'ticket'], operation: ['getAll', 'getTicketsByBoard'], }, }, }, { displayName: 'Offset', name: 'offset', type: 'number', default: 0, description: 'Offset to start from', typeOptions: { minValue: 0, }, displayOptions: { show: { resource: ['device', 'ticket'], operation: ['getAll', 'getTicketsByBoard'], }, }, }, ...operations_1.ticketFields, { displayName: 'Script Type', name: 'scriptType', type: 'options', options: [ { name: 'Saved Script', value: 'SCRIPT' }, { name: 'Inline Script', value: 'ACTION' }, ], default: 'ACTION', required: true, displayOptions: { show: { resource: ['device'], operation: ['runScript'], }, }, }, { displayName: 'Script ID', name: 'scriptId', type: 'number', default: 0, description: 'ID of saved script from NinjaOne library', displayOptions: { show: { resource: ['device'], operation: ['runScript'], scriptType: ['SCRIPT'], }, }, }, { displayName: 'Script Content', name: 'scriptContent', type: 'string', typeOptions: { rows: 10, }, default: '', placeholder: 'Get-Service W3SVC | Select-Object Status', description: 'PowerShell script to execute', displayOptions: { show: { resource: ['device'], operation: ['runScript'], scriptType: ['ACTION'], }, }, }, { displayName: 'Script Parameters', name: 'scriptParameters', type: 'fixedCollection', typeOptions: { multipleValues: true, }, default: {}, placeholder: 'Add Parameter', displayOptions: { show: { resource: ['device'], operation: ['runScript'], }, }, options: [ { name: 'parameter', displayName: 'Parameter', values: [ { displayName: 'Key', name: 'key', type: 'string', default: '', }, { displayName: 'Value', name: 'value', type: 'string', default: '', }, ], }, ], }, { displayName: 'Run As', name: 'runAs', type: 'options', options: [ { name: 'System', value: 'SYSTEM' }, { name: 'Current User', value: 'CURRENT_USER' }, ], default: 'SYSTEM', displayOptions: { show: { resource: ['device'], operation: ['runScript'], }, }, }, { displayName: 'Reboot Mode', name: 'rebootMode', type: 'options', options: [ { name: 'Normal', value: 'NORMAL', description: 'Standard restart' }, { name: 'Force', value: 'FORCE', description: 'Force restart without waiting' }, { name: 'Safe Mode', value: 'SAFE_MODE', description: 'Restart in safe mode' }, ], default: 'NORMAL', displayOptions: { show: { resource: ['device'], operation: ['rebootDevice'], }, }, }, { displayName: 'Delay (seconds)', name: 'rebootDelay', type: 'number', default: 0, description: 'Delay before reboot in seconds', displayOptions: { show: { resource: ['device'], operation: ['rebootDevice'], }, }, }, { displayName: 'Service Name', name: 'serviceName', type: 'string', default: '', placeholder: 'W3SVC', description: 'Name of Windows service to control', required: true, displayOptions: { show: { resource: ['device'], operation: ['controlWindowsService'], }, }, }, { displayName: 'Action', name: 'serviceAction', type: 'options', options: [ { name: 'Start', value: 'START' }, { name: 'Stop', value: 'STOP' }, { name: 'Restart', value: 'RESTART' }, ], default: 'START', required: true, displayOptions: { show: { resource: ['device'], operation: ['controlWindowsService'], }, }, }, ], }; } } exports.NinjaOne = NinjaOne; //# sourceMappingURL=NinjaOne.node.js.map