UNPKG

@ev1lc0rp/n8n-nodes-ninjaone

Version:

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

659 lines 20.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ticketFields = exports.ticketOperations = void 0; exports.ticketOperations = [ { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, displayOptions: { show: { resource: ['ticket'], }, }, options: [ { name: 'Add Comment', value: 'comment', action: 'Add comment to ticket', routing: { request: { method: 'POST', url: '=/v2/ticketing/ticket/{{$parameter.ticketId}}/comment', headers: { 'Content-Type': 'multipart/form-data', }, body: { comment: { body: '={{$parameter.commentBody}}', public: '={{$parameter.commentPublic || true}}', timeTracked: '={{$parameter.commentTimeTracked || 0}}', }, files: '={{ $parameter.binaryProperty ? $binary[$parameter.binaryProperty] : undefined }}', }, }, }, }, { name: 'Create', value: 'create', action: 'Create ticket', routing: { request: { method: 'POST', url: '/v2/ticketing/ticket', }, }, }, { name: 'Get', value: 'get', action: 'Get ticket', routing: { request: { method: 'GET', url: '=/v2/ticketing/ticket/{{$parameter.ticketId}}', }, }, }, { name: 'Get Many', value: 'getAll', action: 'Get many tickets', routing: { request: { method: 'GET', url: '/v2/ticketing/tickets', qs: { limit: '={{$parameter.limit}}', offset: '={{$parameter.offset}}', }, }, }, }, { name: 'Get Tickets by Board', value: 'getTicketsByBoard', action: 'Get tickets by board', routing: { request: { method: 'POST', url: '=/v2/ticketing/trigger/board/{{$parameter.boardId}}/run', body: { pageSize: '={{$parameter.limit}}', lastCursorId: '={{$parameter.offset}}', }, }, }, }, { name: 'List Ticketing Boards', value: 'listBoards', action: 'List ticketing boards', routing: { request: { method: 'GET', url: '/v2/ticketing/trigger/boards', }, }, }, { name: 'Update', value: 'update', action: 'Update ticket', routing: { request: { method: 'PUT', url: '=/v2/ticketing/ticket/{{$parameter.ticketId}}', }, }, }, ], default: 'listBoards', }, ]; const startDateField = { displayName: 'Start Date', name: 'startDate', description: 'Return tickets created at or after this date', type: 'dateTime', default: '', routing: { send: { type: 'query', property: 'startDate', value: '={{ $value || undefined }}' }, }, displayOptions: { show: { resource: ['ticket'], operation: ['getAll'], }, }, }; const endDateField = { displayName: 'End Date', name: 'endDate', description: 'Return tickets created up to this date', type: 'dateTime', default: '', routing: { send: { type: 'query', property: 'endDate', value: '={{ $value || undefined }}' }, }, displayOptions: { show: { resource: ['ticket'], operation: ['getAll'], }, }, }; const statusOptions = [ { name: 'New', value: '1000' }, { name: 'Open', value: '2000' }, { name: 'Waiting for Customer', value: '3000' }, { name: 'Hold', value: '4000' }, ]; const typeOptions = [ { name: 'Problem', value: 'PROBLEM' }, { name: 'Task', value: 'TASK' }, { name: 'Question', value: 'QUESTION' }, ]; const severityOptions = [ { name: 'None', value: 'NONE' }, { name: 'Minor', value: 'MINOR' }, { name: 'Moderate', value: 'MODERATE' }, { name: 'Major', value: 'MAJOR' }, { name: 'Critical', value: 'CRITICAL' }, ]; const priorityOptions = [ { name: 'None', value: 'NONE' }, { name: 'Low', value: 'LOW' }, { name: 'Medium', value: 'MEDIUM' }, { name: 'High', value: 'HIGH' }, { name: 'Critical', value: 'CRITICAL' }, ]; const createAdditionalFields = { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', default: {}, displayOptions: { show: { resource: ['ticket'], operation: ['create'], }, }, options: [ { displayName: 'Assigned App User ID', name: 'assignedAppUserId', type: 'number', default: 0, description: 'ID of the technician to assign the ticket to', routing: { send: { type: 'body', property: 'assignedAppUserId' } }, }, { displayName: 'Attributes (JSON)', name: 'attributes', type: 'json', default: '[]', description: 'Array of custom attribute objects, e.g. [{"attributeId":1,"value":"foo"}]', routing: { send: { type: 'body', property: 'attributes' } }, }, { displayName: 'CC Emails', name: 'ccEmails', type: 'string', default: '', description: 'Comma-separated list of email addresses to CC on the ticket', routing: { send: { type: 'body', property: 'cc.emails', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'CC User IDs', name: 'ccUids', type: 'string', default: '', description: 'Comma-separated list of user UIDs to CC on the ticket', routing: { send: { type: 'body', property: 'cc.uids', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'Client ID', name: 'clientId', type: 'number', default: 0, description: 'Organization (client) ID the ticket belongs to', routing: { send: { type: 'body', property: 'clientId' } }, }, { displayName: 'Description Is Public', name: 'descriptionPublic', type: 'boolean', default: true, description: 'Whether the description is visible to the end user', routing: { send: { type: 'body', property: 'description.public' } }, }, { displayName: 'Duplicate in Incidents', name: 'duplicateInIncidents', type: 'boolean', default: false, description: 'Whether to duplicate the ticket in incidents', routing: { send: { type: 'body', property: 'description.duplicateInIncidents' } }, }, { displayName: 'HTML Body', name: 'htmlBody', type: 'string', default: '', description: 'HTML formatted description body', routing: { send: { type: 'body', property: 'description.htmlBody' } }, }, { displayName: 'Location ID', name: 'locationId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'locationId' } }, }, { displayName: 'Node (Device) ID', name: 'nodeId', type: 'number', default: 0, description: 'Device/node ID to associate with the ticket', routing: { send: { type: 'body', property: 'nodeId' } }, }, { displayName: 'Organization', name: 'organization', type: 'string', default: '', description: 'Department or organization assignment', routing: { send: { type: 'body', property: 'organization' } }, }, { displayName: 'Parent Ticket ID', name: 'parentTicketId', type: 'number', default: 0, description: 'ID of the parent ticket when creating a sub-ticket', routing: { send: { type: 'body', property: 'parentTicketId' } }, }, { displayName: 'Priority', name: 'priority', type: 'options', options: priorityOptions, default: 'NONE', routing: { send: { type: 'body', property: 'priority' } }, }, { displayName: 'Requester UID', name: 'requesterUid', type: 'string', default: '', description: 'UID of the ticket requester', routing: { send: { type: 'body', property: 'requesterUid' } }, }, { displayName: 'Severity', name: 'severity', type: 'options', options: severityOptions, default: 'NONE', routing: { send: { type: 'body', property: 'severity' } }, }, { displayName: 'Status', name: 'status', type: 'options', options: statusOptions, default: '1000', routing: { send: { type: 'body', property: 'status' } }, }, { displayName: 'Tags', name: 'tags', type: 'string', default: '', description: 'Comma-separated list of tags', routing: { send: { type: 'body', property: 'tags', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'Ticket Form ID', name: 'ticketFormId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'ticketFormId' } }, }, { displayName: 'Time Tracked (Seconds)', name: 'timeTracked', type: 'number', default: 0, routing: { send: { type: 'body', property: 'description.timeTracked' } }, }, { displayName: 'Type', name: 'type', type: 'options', options: typeOptions, default: 'PROBLEM', routing: { send: { type: 'body', property: 'type' } }, }, ], }; const updateFields = { displayName: 'Update Fields', name: 'updateFields', type: 'collection', placeholder: 'Add Field', default: {}, displayOptions: { show: { resource: ['ticket'], operation: ['update'], }, }, options: [ { displayName: 'Assigned App User ID', name: 'assignedAppUserId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'assignedAppUserId' } }, }, { displayName: 'Attributes (JSON)', name: 'attributes', type: 'json', default: '[]', description: 'Array of custom attribute objects, e.g. [{"attributeId":1,"value":"foo"}]', routing: { send: { type: 'body', property: 'attributes' } }, }, { displayName: 'CC Emails', name: 'ccEmails', type: 'string', default: '', description: 'Comma-separated list of email addresses to CC on the ticket', routing: { send: { type: 'body', property: 'cc.emails', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'CC User IDs', name: 'ccUids', type: 'string', default: '', description: 'Comma-separated list of user UIDs to CC on the ticket', routing: { send: { type: 'body', property: 'cc.uids', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'Client ID', name: 'clientId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'clientId' } }, }, { displayName: 'Location ID', name: 'locationId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'locationId' } }, }, { displayName: 'Node (Device) ID', name: 'nodeId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'nodeId' } }, }, { displayName: 'Organization', name: 'organization', type: 'string', default: '', description: 'Department or organization assignment', routing: { send: { type: 'body', property: 'organization' } }, }, { displayName: 'Parent Ticket ID', name: 'parentTicketId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'parentTicketId' } }, }, { displayName: 'Priority', name: 'priority', type: 'options', options: priorityOptions, default: 'NONE', routing: { send: { type: 'body', property: 'priority' } }, }, { displayName: 'Requester UID', name: 'requesterUid', type: 'string', default: '', routing: { send: { type: 'body', property: 'requesterUid' } }, }, { displayName: 'Severity', name: 'severity', type: 'options', options: severityOptions, default: 'NONE', routing: { send: { type: 'body', property: 'severity' } }, }, { displayName: 'Status', name: 'status', type: 'options', options: statusOptions, default: '1000', routing: { send: { type: 'body', property: 'status' } }, }, { displayName: 'Summary', name: 'summary', type: 'string', default: '', description: 'Ticket summary/subject', routing: { send: { type: 'body', property: 'subject' } }, }, { displayName: 'Tags', name: 'tags', type: 'string', default: '', description: 'Comma-separated list of tags', routing: { send: { type: 'body', property: 'tags', value: '={{ $value.split(",").map(item => item.trim()) }}', }, }, }, { displayName: 'Ticket Form ID', name: 'ticketFormId', type: 'number', default: 0, routing: { send: { type: 'body', property: 'ticketFormId' } }, }, { displayName: 'Total Time Tracked (Seconds)', name: 'totalTimeTracked', type: 'number', default: 0, routing: { send: { type: 'body', property: 'totalTimeTracked' } }, }, { displayName: 'Type', name: 'type', type: 'options', options: typeOptions, default: 'PROBLEM', routing: { send: { type: 'body', property: 'type' } }, }, { displayName: 'Version', name: 'version', type: 'number', default: 0, description: 'Current version of the ticket, used for optimistic locking. Supply the value returned by a previous "Get" if your instance enforces it.', routing: { send: { type: 'body', property: 'version' } }, }, ], }; exports.ticketFields = [ { displayName: 'Ticket ID', name: 'ticketId', description: 'ID of the ticket', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['ticket'], operation: ['get', 'update', 'comment'], }, }, }, { displayName: 'Board ID', name: 'boardId', description: 'ID of the ticketing board to list tickets from', type: 'number', default: 0, required: true, displayOptions: { show: { resource: ['ticket'], operation: ['getTicketsByBoard'], }, }, }, startDateField, endDateField, { displayName: 'Summary', name: 'summary', description: 'Ticket summary/subject', type: 'string', default: '', required: true, displayOptions: { show: { resource: ['ticket'], operation: ['create'], }, }, routing: { send: { type: 'body', property: 'subject' } }, }, { displayName: 'Description', name: 'description', description: 'Ticket description body', type: 'string', typeOptions: { rows: 4 }, default: '', required: true, displayOptions: { show: { resource: ['ticket'], operation: ['create'], }, }, routing: { send: { type: 'body', property: 'description.body' } }, }, createAdditionalFields, updateFields, { displayName: 'Comment Body', name: 'commentBody', description: 'Comment text', type: 'string', typeOptions: { rows: 3 }, default: '', required: true, displayOptions: { show: { resource: ['ticket'], operation: ['comment'], }, }, }, { displayName: 'Comment Is Public', name: 'commentPublic', description: 'Whether the comment is visible to the end user', type: 'boolean', default: true, displayOptions: { show: { resource: ['ticket'], operation: ['comment'], }, }, }, { displayName: 'Comment Time Tracked (Seconds)', name: 'commentTimeTracked', description: 'Time tracked for this comment in seconds', type: 'number', default: 0, displayOptions: { show: { resource: ['ticket'], operation: ['comment'], }, }, }, { displayName: 'Binary Property', name: 'binaryProperty', description: 'Name of the binary property that holds a file to attach to the comment. Leave empty for no attachment.', type: 'string', default: '', displayOptions: { show: { resource: ['ticket'], operation: ['comment'], }, }, }, ]; //# sourceMappingURL=ticket.js.map