UNPKG

n8n-nodes-base

Version:

Base nodes of n8n

190 lines 6.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.description = exports.properties = void 0; exports.execute = execute; const utilities_1 = require("../../../../../../utils/utilities"); const descriptions_1 = require("../../descriptions"); const utils_1 = require("../../helpers/utils"); const transport_1 = require("../../transport"); exports.properties = [ descriptions_1.draftRLC, { displayName: 'Update Fields', name: 'updateFields', type: 'collection', placeholder: 'Add Field', default: {}, options: [ { displayName: 'BCC Recipients', name: 'bccRecipients', description: 'Comma-separated list of email addresses of BCC recipients', type: 'string', placeholder: 'e.g. john@example.com', default: '', }, { displayName: 'Category Names or IDs', name: 'categories', type: 'multiOptions', description: 'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>', typeOptions: { loadOptionsMethod: 'getCategoriesNames', }, default: [], }, { displayName: 'CC Recipients', name: 'ccRecipients', description: 'Comma-separated list of email addresses of CC recipients', type: 'string', placeholder: 'e.g. john@example.com', default: '', }, { displayName: 'Custom Headers', name: 'internetMessageHeaders', placeholder: 'Add Header', type: 'fixedCollection', typeOptions: { multipleValues: true, }, default: {}, options: [ { name: 'headers', displayName: 'Header', values: [ { displayName: 'Name', name: 'name', type: 'string', default: '', description: 'Name of the header', }, { displayName: 'Value', name: 'value', type: 'string', default: '', description: 'Value to set for the header', }, ], }, ], }, { displayName: 'From', name: 'from', description: 'The owner of the mailbox from which the message is sent. Must correspond to the actual mailbox used.', type: 'string', placeholder: 'e.g. john@example.com', default: '', }, { displayName: 'Importance', name: 'importance', description: 'The importance of the message', type: 'options', options: [ { name: 'Low', value: 'Low', }, { name: 'Normal', value: 'Normal', }, { name: 'High', value: 'High', }, ], default: 'Normal', }, { displayName: 'Is Read', name: 'isRead', description: 'Whether the message must be marked as read', type: 'boolean', default: false, }, { displayName: 'Message', name: 'bodyContent', description: 'Message body content', type: 'string', typeOptions: { rows: 2, }, default: '', }, { displayName: 'Message Type', name: 'bodyContentType', description: 'Message body content type', type: 'options', options: [ { name: 'HTML', value: 'html', }, { name: 'Text', value: 'Text', }, ], default: 'html', }, { displayName: 'Read Receipt Requested', name: 'isReadReceiptRequested', description: 'Whether a read receipt is requested for the message', type: 'boolean', default: false, }, { displayName: 'Reply To', name: 'replyTo', description: 'Email address to use when replying', type: 'string', placeholder: 'e.g. replyto@example.com', default: '', }, { displayName: 'Subject', name: 'subject', description: 'The subject of the message', type: 'string', default: '', }, { displayName: 'To', name: 'toRecipients', description: 'Comma-separated list of email addresses of recipients', type: 'string', placeholder: 'e.g. john@example.com', default: '', }, ], }, ]; const displayOptions = { show: { resource: ['draft'], operation: ['update'], }, }; exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, exports.properties); async function execute(index) { const draftId = this.getNodeParameter('draftId', index, undefined, { extractValue: true, }); const updateFields = this.getNodeParameter('updateFields', index); // Create message from optional fields const body = (0, utils_1.createMessage)(updateFields); const responseData = await transport_1.microsoftApiRequest.call(this, 'PATCH', `/messages/${draftId}`, body, {}); const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: index } }); return executionData; } //# sourceMappingURL=update.operation.js.map