# nodes

node_type: n8n-nodes-base.ItemLists
name: ItemLists
package_name: n8n-nodes-base
display_name: Item Lists
description: Helper for working with lists of items and transforming arrays
code_hash: e750bcc12fe1f8b89195a70c6bb909c54066a02e91dbb0a0618e250b5dc9ec74
source_location: node_modules/n8n-nodes-base/dist/nodes/ItemLists/ItemLists.node.js
extracted_at: 2025-06-07 19:36:36
updated_at: 2025-06-07 19:36:36
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ItemLists = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const ItemListsV1_node_1 = require("./V1/ItemListsV1.node");
  const ItemListsV2_node_1 = require("./V2/ItemListsV2.node");
  const ItemListsV3_node_1 = require("./V3/ItemListsV3.node");
  class ItemLists extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Item Lists',
              name: 'itemLists',
              icon: 'file:itemLists.svg',
              group: ['input'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Helper for working with lists of items and transforming arrays',
              defaultVersion: 3,
          };
          const nodeVersions = {
              1: new ItemListsV1_node_1.ItemListsV1(baseDescription),
              2: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              2.1: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              2.2: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              3: new ItemListsV3_node_1.ItemListsV3(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.ItemLists = ItemLists;
  //# sourceMappingURL=ItemLists.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Iterable
name: Iterable
package_name: n8n-nodes-base
display_name: Iterable
description: Consume Iterable API
code_hash: a25bf56399e021962735e8a204bbfbeb4be8a9760a2650eb2534acd7ffed11d6
source_location: node_modules/n8n-nodes-base/dist/nodes/Iterable/Iterable.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Iterable = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const EventDescription_1 = require("./EventDescription");
  const UserDescription_1 = require("./UserDescription");
  const UserListDescription_1 = require("./UserListDescription");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Iterable {
      constructor() {
          this.description = {
              displayName: 'Iterable',
              name: 'iterable',
              icon: 'file:iterable.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Iterable API',
              defaults: {
                  name: 'Iterable',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'iterableApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Event',
                              value: 'event',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                          {
                              name: 'User List',
                              value: 'userList',
                          },
                      ],
                      default: 'user',
                  },
                  ...EventDescription_1.eventOperations,
                  ...EventDescription_1.eventFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
                  ...UserListDescription_1.userListOperations,
                  ...UserListDescription_1.userListFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      const { lists } = await GenericFunctions_1.iterableApiRequest.call(this, 'GET', '/lists');
                      const returnData = [];
                      for (const list of lists) {
                          returnData.push({
                              name: list.name,
                              value: list.id,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const timezone = this.getTimezone();
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'event') {
              if (operation === 'track') {
                  const events = [];
                  for (let i = 0; i < length; i++) {
                      const name = this.getNodeParameter('name', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (!additionalFields.email && !additionalFields.id) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Either email or userId must be passed in to identify the user. Please add one of both via "Additional Fields". If both are passed in, email takes precedence.', { itemIndex: i });
                      }
                      const body = {
                          eventName: name,
                      };
                      Object.assign(body, additionalFields);
                      if (body.dataFieldsUi) {
                          const dataFields = body.dataFieldsUi.dataFieldValues;
                          const data = {};
                          for (const dataField of dataFields) {
                              data[dataField.key] = dataField.value;
                          }
                          body.dataFields = data;
                          delete body.dataFieldsUi;
                      }
                      if (body.createdAt) {
                          body.createdAt = moment_timezone_1.default.tz(body.createdAt, timezone).unix();
                      }
                      events.push(body);
                  }
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/events/trackBulk', { events });
                  returnData.push(responseData);
              }
          }
          if (resource === 'user') {
              if (operation === 'upsert') {
                  for (let i = 0; i < length; i++) {
                      const identifier = this.getNodeParameter('identifier', i);
                      const value = this.getNodeParameter('value', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      if (identifier === 'email') {
                          body.email = value;
                      }
                      else {
                          body.preferUserId = this.getNodeParameter('preferUserId', i);
                          body.userId = value;
                      }
                      Object.assign(body, additionalFields);
                      if (body.dataFieldsUi) {
                          const dataFields = body.dataFieldsUi.dataFieldValues;
                          const data = {};
                          for (const dataField of dataFields) {
                              data[dataField.key] = dataField.value;
                          }
                          body.dataFields = data;
                          delete body.dataFieldsUi;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/users/update', body);
                      if (!this.continueOnFail()) {
                          if (responseData.code !== 'Success') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Iterable error response [400]: ${responseData.msg}`, { itemIndex: i });
                          }
                      }
                      returnData.push(responseData);
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const by = this.getNodeParameter('by', i);
                      let endpoint;
                      if (by === 'email') {
                          const email = this.getNodeParameter('email', i);
                          endpoint = `/users/${email}`;
                      }
                      else {
                          const userId = this.getNodeParameter('userId', i);
                          endpoint = `/users/byUserId/${userId}`;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'DELETE', endpoint);
                      if (!this.continueOnFail()) {
                          if (responseData.code !== 'Success') {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                          }
                      }
                      returnData.push(responseData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const by = this.getNodeParameter('by', i);
                      let endpoint;
                      if (by === 'email') {
                          const email = this.getNodeParameter('email', i);
                          endpoint = '/users/getByEmail';
                          qs.email = email;
                      }
                      else {
                          const userId = this.getNodeParameter('userId', i);
                          endpoint = `/users/byUserId/${userId}`;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'GET', endpoint, {}, qs);
                      if (!this.continueOnFail()) {
                          if (Object.keys(responseData).length === 0) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData, {
                                  message: 'User not found',
                                  httpCode: '404',
                              });
                          }
                      }
                      responseData = responseData.user || {};
                      returnData.push(responseData);
                  }
              }
          }
          if (resource === 'userList') {
              if (operation === 'add') {
                  const listId = this.getNodeParameter('listId', 0);
                  const identifier = this.getNodeParameter('identifier', 0);
                  const body = {
                      listId: parseInt(listId, 10),
                      subscribers: [],
                  };
                  const subscribers = [];
                  for (let i = 0; i < length; i++) {
                      const value = this.getNodeParameter('value', i);
                      if (identifier === 'email') {
                          subscribers.push({ email: value });
                      }
                      else {
                          subscribers.push({ userId: value });
                      }
                  }
                  body.subscribers = subscribers;
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/lists/subscribe', body);
                  returnData.push(responseData);
              }
              if (operation === 'remove') {
                  const listId = this.getNodeParameter('listId', 0);
                  const identifier = this.getNodeParameter('identifier', 0);
                  const additionalFields = this.getNodeParameter('additionalFields', 0);
                  const body = {
                      listId: parseInt(listId, 10),
                      subscribers: [],
                      campaignId: additionalFields.campaignId,
                      channelUnsubscribe: additionalFields.channelUnsubscribe,
                  };
                  const subscribers = [];
                  for (let i = 0; i < length; i++) {
                      const value = this.getNodeParameter('value', i);
                      if (identifier === 'email') {
                          subscribers.push({ email: value });
                      }
                      else {
                          subscribers.push({ userId: value });
                      }
                  }
                  body.subscribers = subscribers;
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/lists/unsubscribe', body);
                  returnData.push(responseData);
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Iterable = Iterable;
  //# sourceMappingURL=Iterable.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Jenkins
name: Jenkins
package_name: n8n-nodes-base
display_name: Jenkins
description: Consume Jenkins API
code_hash: f2cc66998d1891568379ae5503e6ad1467a505ba3e06e5df8209d990381c015e
source_location: node_modules/n8n-nodes-base/dist/nodes/Jenkins/Jenkins.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Jenkins = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Jenkins {
      constructor() {
          this.description = {
              displayName: 'Jenkins',
              name: 'jenkins',
              icon: 'file:jenkins.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Jenkins API',
              defaults: {
                  name: 'Jenkins',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'jenkinsApi',
                      required: true,
                      testedBy: 'jenkinApiCredentialTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'Build',
                              value: 'build',
                          },
                          {
                              name: 'Instance',
                              value: 'instance',
                          },
                          {
                              name: 'Job',
                              value: 'job',
                          },
                      ],
                      default: 'job',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                          },
                      },
                      options: [
                          {
                              name: 'Copy',
                              value: 'copy',
                              description: 'Copy a specific job',
                              action: 'Copy a job',
                          },
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new job',
                              action: 'Create a job',
                          },
                          {
                              name: 'Trigger',
                              value: 'trigger',
                              description: 'Trigger a specific job',
                              action: 'Trigger a job',
                          },
                          {
                              name: 'Trigger with Parameters',
                              value: 'triggerParams',
                              description: 'Trigger a specific job',
                              action: 'Trigger a job with parameters',
                          },
                      ],
                      default: 'trigger',
                      description: 'Possible operations',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Make sure the job is setup to support triggering with parameters. <a href="https://wiki.jenkins.io/display/JENKINS/Parameterized+Build" target="_blank">More info</a>',
                      name: 'triggerParamsNotice',
                      type: 'notice',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['triggerParams'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Job Name or ID',
                      name: 'job',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getJobs',
                      },
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['trigger', 'triggerParams', 'copy'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Parameters',
                      name: 'param',
                      type: 'fixedCollection',
                      placeholder: 'Add Parameter',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['triggerParams'],
                          },
                      },
                      required: true,
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      options: [
                          {
                              name: 'params',
                              displayName: 'Parameters',
                              values: [
                                  {
                                      displayName: 'Name or ID',
                                      name: 'name',
                                      type: 'options',
                                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                      typeOptions: {
                                          loadOptionsMethod: 'getJobParameters',
                                          loadOptionsDependsOn: ['job'],
                                      },
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                      description: 'Parameters for Jenkins job',
                  },
                  {
                      displayName: 'New Job Name',
                      name: 'newJob',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['copy', 'create'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the new Jenkins job',
                  },
                  {
                      displayName: 'XML',
                      name: 'xml',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['create'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'XML of Jenkins config',
                  },
                  {
                      displayName: 'To get the XML of an existing job, add ‘config.xml’ to the end of the job URL',
                      name: 'createNotice',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['create'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                          },
                      },
                      options: [
                          {
                              name: 'Cancel Quiet Down',
                              value: 'cancelQuietDown',
                              description: 'Cancel quiet down state',
                              action: 'Cancel Quiet Down an instance',
                          },
                          {
                              name: 'Quiet Down',
                              value: 'quietDown',
                              description: 'Put Jenkins in quiet mode, no builds can be started, Jenkins is ready for shutdown',
                              action: 'Quiet Down an instance',
                          },
                          {
                              name: 'Restart',
                              value: 'restart',
                              description: 'Restart Jenkins immediately on environments where it is possible',
                              action: 'Restart an instance',
                          },
                          {
                              name: 'Safely Restart',
                              value: 'safeRestart',
                              description: 'Restart Jenkins once no jobs are running on environments where it is possible',
                              action: 'Safely Restart an instance',
                          },
                          {
                              name: 'Safely Shutdown',
                              value: 'safeExit',
                              description: 'Shutdown once no jobs are running',
                              action: 'Safely Shutdown an instance',
                          },
                          {
                              name: 'Shutdown',
                              value: 'exit',
                              description: 'Shutdown Jenkins immediately',
                              action: 'Shutdown an instance',
                          },
                      ],
                      default: 'safeRestart',
                      description: 'Jenkins instance operations',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Reason',
                      name: 'reason',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                              operation: ['quietDown'],
                          },
                      },
                      default: '',
                      description: 'Freeform reason for quiet down mode',
                  },
                  {
                      displayName: 'Instance operation can shutdown Jenkins instance and make it unresponsive. Some commands may not be available depending on instance implementation.',
                      name: 'instanceNotice',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['build'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'List Builds',
                              action: 'Get many builds',
                          },
                      ],
                      default: 'getAll',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Job Name or ID',
                      name: 'job',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getJobs',
                      },
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                          },
                      },
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      description: 'Max number of results to return',
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async jenkinApiCredentialTest(credential) {
                      const { baseUrl, username, apiKey } = credential.data;
                      const url = (0, GenericFunctions_1.tolerateTrailingSlash)(baseUrl);
                      const endpoint = '/api/json';
                      const options = {
                          auth: {
                              username,
                              password: apiKey,
                          },
                          method: 'GET',
                          body: {},
                          qs: {},
                          uri: `${url}${endpoint}`,
                          json: true,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
              loadOptions: {
                  async getJobs() {
                      const returnData = [];
                      const endpoint = '/api/json';
                      const { jobs } = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                      for (const job of jobs) {
                          returnData.push({
                              name: job.name,
                              value: job.name,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getJobParameters() {
                      const job = this.getCurrentNodeParameter('job');
                      const returnData = [];
                      const endpoint = `/job/${job}/api/json?tree=actions[parameterDefinitions[*]]`;
                      const { actions } = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                      for (const { _class, parameterDefinitions } of actions) {
                          if (_class === null || _class === void 0 ? void 0 : _class.includes('ParametersDefinitionProperty')) {
                              for (const { name, type } of parameterDefinitions) {
                                  returnData.push({
                                      name: `${name} - (${type})`,
                                      value: name,
                                  });
                              }
                          }
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'job') {
                      if (operation === 'trigger') {
                          const job = this.getNodeParameter('job', i);
                          const endpoint = `/job/${job}/build`;
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'triggerParams') {
                          const job = this.getNodeParameter('job', i);
                          const params = this.getNodeParameter('param.params', i, []);
                          let form = {};
                          if (params.length) {
                              form = params.reduce((body, param) => {
                                  body[param.name] = param.value;
                                  return body;
                              }, {});
                          }
                          const endpoint = `/job/${job}/buildWithParameters`;
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, {}, {}, {
                              form,
                              headers: {
                                  'content-type': 'application/x-www-form-urlencoded',
                              },
                          });
                          responseData = { success: true };
                      }
                      if (operation === 'copy') {
                          const job = this.getNodeParameter('job', i);
                          const name = this.getNodeParameter('newJob', i);
                          const queryParams = {
                              name,
                              mode: 'copy',
                              from: job,
                          };
                          const endpoint = '/createItem';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams);
                              responseData = { success: true };
                          }
                          catch (error) {
                              if (error.httpCode === '302') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'create') {
                          const name = this.getNodeParameter('newJob', i);
                          const queryParams = {
                              name,
                          };
                          const headers = {
                              'content-type': 'application/xml',
                          };
                          const body = this.getNodeParameter('xml', i);
                          const endpoint = '/createItem';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams, body, {
                              headers,
                              json: false,
                          });
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'instance') {
                      if (operation === 'quietDown') {
                          const reason = this.getNodeParameter('reason', i);
                          let queryParams;
                          if (reason) {
                              queryParams = {
                                  reason,
                              };
                          }
                          const endpoint = '/quietDown';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams);
                          responseData = { success: true };
                      }
                      if (operation === 'cancelQuietDown') {
                          const endpoint = '/cancelQuietDown';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'restart') {
                          const endpoint = '/restart';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          }
                          catch (error) {
                              if (error.httpCode === '503') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'safeRestart') {
                          const endpoint = '/safeRestart';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          }
                          catch (error) {
                              if (error.httpCode === '503') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'exit') {
                          const endpoint = '/exit';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'safeExit') {
                          const endpoint = '/safeExit';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'build') {
                      if (operation === 'getAll') {
                          const job = this.getNodeParameter('job', i);
                          let endpoint = `/job/${job}/api/json?tree=builds[*]`;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              endpoint += `{0,${limit}}`;
                          }
                          responseData = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.builds;
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Jenkins = Jenkins;
  //# sourceMappingURL=Jenkins.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Jira
name: Jira
package_name: n8n-nodes-base
display_name: Jira Software
description: Consume Jira Software API
code_hash: 4e93fa0d77ac1881853591e98dea6a0effa65338c59c3a2097a06ff8c8d34278
source_location: node_modules/n8n-nodes-base/dist/nodes/Jira/Jira.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Jira = void 0;
  const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const IssueAttachmentDescription_1 = require("./IssueAttachmentDescription");
  const IssueCommentDescription_1 = require("./IssueCommentDescription");
  const IssueDescription_1 = require("./IssueDescription");
  const UserDescription_1 = require("./UserDescription");
  class Jira {
      constructor() {
          this.description = {
              displayName: 'Jira Software',
              name: 'jira',
              icon: 'file:jira.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Jira Software API',
              defaults: {
                  name: 'Jira Software',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'jiraSoftwareCloudApi',
                      required: true,
                      displayOptions: {
                          show: {
                              jiraVersion: ['cloud'],
                          },
                      },
                  },
                  {
                      name: 'jiraSoftwareServerApi',
                      required: true,
                      displayOptions: {
                          show: {
                              jiraVersion: ['server'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Jira Version',
                      name: 'jiraVersion',
                      type: 'options',
                      options: [
                          {
                              name: 'Cloud',
                              value: 'cloud',
                          },
                          {
                              name: 'Server (Self Hosted)',
                              value: 'server',
                          },
                      ],
                      default: 'cloud',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Issue',
                              value: 'issue',
                              description: 'Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask',
                          },
                          {
                              name: 'Issue Attachment',
                              value: 'issueAttachment',
                              description: 'Add, remove, and get an attachment from an issue',
                          },
                          {
                              name: 'Issue Comment',
                              value: 'issueComment',
                              description: 'Get, create, update, and delete a comment from an issue',
                          },
                          {
                              name: 'User',
                              value: 'user',
                              description: 'Get, create and delete a user',
                          },
                      ],
                      default: 'issue',
                  },
                  ...IssueDescription_1.issueOperations,
                  ...IssueDescription_1.issueFields,
                  ...IssueAttachmentDescription_1.issueAttachmentOperations,
                  ...IssueAttachmentDescription_1.issueAttachmentFields,
                  ...IssueCommentDescription_1.issueCommentOperations,
                  ...IssueCommentDescription_1.issueCommentFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
              ],
          };
          this.methods = {
              listSearch: {
                  async getProjects(filter) {
                      const returnData = [];
                      const jiraVersion = this.getCurrentNodeParameter('jiraVersion');
                      let endpoint = '';
                      let projects;
                      if (jiraVersion === 'server') {
                          endpoint = '/api/2/project';
                          projects = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, endpoint, 'GET');
                      }
                      else {
                          endpoint = '/api/2/project/search';
                          projects = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'values', endpoint, 'GET');
                      }
                      if (projects.values && Array.isArray(projects.values)) {
                          projects = projects.values;
                      }
                      for (const project of projects) {
                          const projectName = project.name;
                          const projectId = project.id;
                          returnData.push({
                              name: projectName,
                              value: projectId,
                          });
                      }
                      return { results: (0, GenericFunctions_1.filterSortSearchListItems)(returnData, filter) };
                  },
                  async getIssueTypes() {
                      const projectId = this.getCurrentNodeParameter('project', { extractValue: true });
                      const returnData = [];
                      const { issueTypes } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/project/${projectId}`, 'GET');
                      for (const issueType of issueTypes) {
                          const issueTypeName = issueType.name;
                          const issueTypeId = issueType.id;
                          returnData.push({
                              name: issueTypeName,
                              value: issueTypeId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getUsers(filter) {
                      const users = await GenericFunctions_1.getUsers.call(this);
                      return { results: (0, GenericFunctions_1.filterSortSearchListItems)(users, filter) };
                  },
                  async getPriorities() {
                      const returnData = [];
                      const priorities = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/priority', 'GET');
                      for (const priority of priorities) {
                          const priorityName = priority.name;
                          const priorityId = priority.id;
                          returnData.push({
                              name: priorityName,
                              value: priorityId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getTransitions() {
                      const returnData = [];
                      const issueKey = this.getCurrentNodeParameter('issueKey');
                      const transitions = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'GET');
                      for (const transition of transitions.transitions) {
                          returnData.push({
                              name: transition.name,
                              value: transition.id,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getCustomFields() {
                      const returnData = [];
                      const operation = this.getCurrentNodeParameter('operation');
                      let projectId;
                      let issueTypeId;
                      if (operation === 'create') {
                          projectId = this.getCurrentNodeParameter('project', { extractValue: true });
                          issueTypeId = this.getCurrentNodeParameter('issueType', { extractValue: true });
                      }
                      else {
                          const issueKey = this.getCurrentNodeParameter('issueKey');
                          const res = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, {});
                          projectId = res.fields.project.id;
                          issueTypeId = res.fields.issuetype.id;
                      }
                      const res = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/createmeta?projectIds=${projectId}&issueTypeIds=${issueTypeId}&expand=projects.issuetypes.fields`, 'GET');
                      const fields = res.projects
                          .find((o) => o.id === projectId)
                          .issuetypes.find((o) => o.id === issueTypeId).fields;
                      for (const key of Object.keys(fields)) {
                          const field = fields[key];
                          if (field.schema && Object.keys(field.schema).includes('customId')) {
                              returnData.push({
                                  name: field.name,
                                  value: field.key || field.fieldId,
                              });
                          }
                      }
                      return { results: returnData };
                  },
              },
              loadOptions: {
                  async getLabels() {
                      const returnData = [];
                      const labels = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/label', 'GET');
                      for (const label of labels.values) {
                          const labelName = label;
                          const labelId = label;
                          returnData.push({
                              name: labelName,
                              value: labelId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getUsers() {
                      return GenericFunctions_1.getUsers.call(this);
                  },
                  async getGroups() {
                      const returnData = [];
                      const groups = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/groups/picker', 'GET');
                      for (const group of groups.groups) {
                          const groupName = group.name;
                          const groupId = group.name;
                          returnData.push({
                              name: groupName,
                              value: groupId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getProjectComponents() {
                      const returnData = [];
                      const project = this.getCurrentNodeParameter('project', { extractValue: true });
                      const { values: components } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/project/${project}/component`, 'GET');
                      for (const component of components) {
                          returnData.push({
                              name: component.name,
                              value: component.id,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const jiraVersion = this.getNodeParameter('jiraVersion', 0);
          if (resource === 'issue') {
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      const summary = this.getNodeParameter('summary', i);
                      const projectId = this.getNodeParameter('project', i, '', {
                          extractValue: true,
                      });
                      const issueTypeId = this.getNodeParameter('issueType', i, '', {
                          extractValue: true,
                      });
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const assignee = this.getNodeParameter('additionalFields.assignee', i, '', {
                          extractValue: true,
                      });
                      if (assignee)
                          additionalFields.assignee = assignee;
                      const reporter = this.getNodeParameter('additionalFields.reporter', i, '', {
                          extractValue: true,
                      });
                      if (reporter)
                          additionalFields.reporter = reporter;
                      const priority = this.getNodeParameter('additionalFields.priority', i, '', {
                          extractValue: true,
                      });
                      if (priority)
                          additionalFields.priority = priority;
                      const body = {};
                      const fields = {
                          summary,
                          project: {
                              id: projectId,
                          },
                          issuetype: {
                              id: issueTypeId,
                          },
                      };
                      if (additionalFields.labels) {
                          fields.labels = additionalFields.labels;
                      }
                      if (additionalFields.serverLabels) {
                          fields.labels = additionalFields.serverLabels;
                      }
                      if (additionalFields.priority) {
                          fields.priority = {
                              id: additionalFields.priority,
                          };
                      }
                      if (additionalFields.assignee) {
                          if (jiraVersion === 'server') {
                              fields.assignee = {
                                  name: additionalFields.assignee,
                              };
                          }
                          else {
                              fields.assignee = {
                                  id: additionalFields.assignee,
                              };
                          }
                      }
                      if (additionalFields.reporter) {
                          if (jiraVersion === 'server') {
                              fields.reporter = {
                                  name: additionalFields.reporter,
                              };
                          }
                          else {
                              fields.reporter = {
                                  id: additionalFields.reporter,
                              };
                          }
                      }
                      if (additionalFields.description) {
                          fields.description = additionalFields.description;
                      }
                      if (additionalFields.updateHistory) {
                          qs.updateHistory = additionalFields.updateHistory;
                      }
                      if (additionalFields.componentIds) {
                          fields.components = additionalFields.componentIds.map((id) => ({ id }));
                      }
                      if (additionalFields.customFieldsUi) {
                          const customFields = additionalFields.customFieldsUi
                              .customFieldsValues;
                          if (customFields) {
                              customFields.forEach((cf) => {
                                  if (typeof cf.fieldId !== 'string') {
                                      cf.fieldId = cf.fieldId.value.trim();
                                  }
                              });
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                              Object.assign(fields, data);
                          }
                      }
                      const issueTypes = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body, qs);
                      const subtaskIssues = [];
                      for (const issueType of issueTypes) {
                          if (issueType.subtask) {
                              subtaskIssues.push(issueType.id);
                          }
                      }
                      if (!additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i });
                      }
                      else if (additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) {
                          fields.parent = {
                              key: additionalFields.parentIssueKey.toUpperCase(),
                          };
                      }
                      body.fields = fields;
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issue', 'POST', body);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const assignee = this.getNodeParameter('updateFields.assignee', i, '', {
                          extractValue: true,
                      });
                      if (assignee)
                          updateFields.assignee = assignee;
                      const reporter = this.getNodeParameter('updateFields.reporter', i, '', {
                          extractValue: true,
                      });
                      if (reporter)
                          updateFields.reporter = reporter;
                      const priority = this.getNodeParameter('updateFields.priority', i, '', {
                          extractValue: true,
                      });
                      if (priority)
                          updateFields.priority = priority;
                      const statusId = this.getNodeParameter('updateFields.statusId', i, '', {
                          extractValue: true,
                      });
                      if (statusId)
                          updateFields.statusId = statusId;
                      const body = {};
                      const fields = {};
                      if (updateFields.summary) {
                          fields.summary = updateFields.summary;
                      }
                      if (updateFields.issueType) {
                          fields.issuetype = {
                              id: updateFields.issueType,
                          };
                      }
                      if (updateFields.labels) {
                          fields.labels = updateFields.labels;
                      }
                      if (updateFields.serverLabels) {
                          fields.labels = updateFields.serverLabels;
                      }
                      if (updateFields.priority) {
                          fields.priority = {
                              id: updateFields.priority,
                          };
                      }
                      if (updateFields.assignee) {
                          if (jiraVersion === 'server') {
                              fields.assignee = {
                                  name: updateFields.assignee,
                              };
                          }
                          else {
                              fields.assignee = {
                                  id: updateFields.assignee,
                              };
                          }
                      }
                      if (updateFields.reporter) {
                          if (jiraVersion === 'server') {
                              fields.reporter = {
                                  name: updateFields.reporter,
                              };
                          }
                          else {
                              fields.reporter = {
                                  id: updateFields.reporter,
                              };
                          }
                      }
                      if (updateFields.description) {
                          fields.description = updateFields.description;
                      }
                      if (updateFields.customFieldsUi) {
                          const customFields = updateFields.customFieldsUi
                              .customFieldsValues;
                          if (customFields) {
                              customFields.forEach((cf) => {
                                  if (typeof cf.fieldId !== 'string') {
                                      cf.fieldId = cf.fieldId.value.trim();
                                  }
                              });
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                              Object.assign(fields, data);
                          }
                      }
                      const issueTypes = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body);
                      const subtaskIssues = [];
                      for (const issueType of issueTypes) {
                          if (issueType.subtask) {
                              subtaskIssues.push(issueType.id);
                          }
                      }
                      if (!updateFields.parentIssueKey && subtaskIssues.includes(updateFields.issueType)) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i });
                      }
                      else if (updateFields.parentIssueKey &&
                          subtaskIssues.includes(updateFields.issueType)) {
                          fields.parent = {
                              key: updateFields.parentIssueKey.toUpperCase(),
                          };
                      }
                      body.fields = fields;
                      if (updateFields.statusId) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'POST', { transition: { id: updateFields.statusId } });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'PUT', body);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const simplifyOutput = this.getNodeParameter('simplifyOutput', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (additionalFields.fields) {
                          qs.fields = additionalFields.fields;
                      }
                      if (additionalFields.fieldsByKey) {
                          qs.fieldsByKey = additionalFields.fieldsByKey;
                      }
                      if (additionalFields.expand) {
                          qs.expand = additionalFields.expand;
                      }
                      if (simplifyOutput) {
                          qs.expand = `${qs.expand || ''},names`;
                      }
                      if (additionalFields.properties) {
                          qs.properties = additionalFields.properties;
                      }
                      if (additionalFields.updateHistory) {
                          qs.updateHistory = additionalFields.updateHistory;
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
                      if (simplifyOutput) {
                          qs.expand = qs.expand || '';
                          if (qs.expand.toLowerCase().indexOf('renderedfields') !== -1 &&
                              responseData.renderedFields &&
                              Object.keys(responseData.renderedFields).length) {
                              responseData.fields = (0, mergeWith_1.default)(responseData.fields, responseData.renderedFields, (a, b) => (b === null ? a : b));
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray((0, GenericFunctions_1.simplifyIssueOutput)(responseData)), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      if (options.fields) {
                          body.fields = options.fields.split(',');
                      }
                      if (options.jql) {
                          body.jql = options.jql;
                      }
                      if (options.expand) {
                          if (typeof options.expand === 'string') {
                              body.expand = options.expand.split(',');
                          }
                          else {
                              body.expand = options.expand;
                          }
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'issues', '/api/2/search', 'POST', body);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          body.maxResults = limit;
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/search', 'POST', body);
                          responseData = responseData.issues;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'changelog') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'values', `/api/2/issue/${issueKey}/changelog`, 'GET');
                      }
                      else {
                          qs.maxResults = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/changelog`, 'GET', {}, qs);
                          responseData = responseData.values;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'notify') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', 0);
                      const body = {};
                      if (additionalFields.textBody) {
                          body.textBody = additionalFields.textBody;
                      }
                      if (additionalFields.htmlBody) {
                          body.htmlBody = additionalFields.htmlBody;
                      }
                      if (!jsonActive) {
                          const notificationRecipientsValues = this.getNodeParameter('notificationRecipientsUi', i).notificationRecipientsValues;
                          const notificationRecipients = {};
                          if (notificationRecipientsValues) {
                              if (notificationRecipientsValues.reporter) {
                                  notificationRecipients.reporter = notificationRecipientsValues.reporter;
                              }
                              if (notificationRecipientsValues.assignee) {
                                  notificationRecipients.assignee = notificationRecipientsValues.assignee;
                              }
                              if (notificationRecipientsValues.assignee) {
                                  notificationRecipients.watchers = notificationRecipientsValues.watchers;
                              }
                              if (notificationRecipientsValues.voters) {
                                  notificationRecipients.watchers = notificationRecipientsValues.voters;
                              }
                              if ((notificationRecipientsValues.users || []).length > 0) {
                                  notificationRecipients.users = notificationRecipientsValues.users.map((user) => {
                                      return {
                                          accountId: user,
                                      };
                                  });
                              }
                              if ((notificationRecipientsValues.groups || []).length > 0) {
                                  notificationRecipients.groups = notificationRecipientsValues.groups.map((group) => {
                                      return {
                                          name: group,
                                      };
                                  });
                              }
                          }
                          body.to = notificationRecipients;
                          const notificationRecipientsRestrictionsValues = this.getNodeParameter('notificationRecipientsRestrictionsUi', i).notificationRecipientsRestrictionsValues;
                          const notificationRecipientsRestrictions = {};
                          if (notificationRecipientsRestrictionsValues) {
                              if ((notificationRecipientsRestrictionsValues.groups || []).length >
                                  0) {
                                  notificationRecipientsRestrictions.groups = notificationRecipientsRestrictionsValues.groups.map((group) => {
                                      return {
                                          name: group,
                                      };
                                  });
                              }
                          }
                          body.restrict = notificationRecipientsRestrictions;
                      }
                      else {
                          const notificationRecipientsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('notificationRecipientsJson', i));
                          if (notificationRecipientsJson) {
                              body.to = notificationRecipientsJson;
                          }
                          const notificationRecipientsRestrictionsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('notificationRecipientsRestrictionsJson', i));
                          if (notificationRecipientsRestrictionsJson) {
                              body.restrict = notificationRecipientsRestrictionsJson;
                          }
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/notify`, 'POST', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'transitions') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (additionalFields.transitionId) {
                          qs.transitionId = additionalFields.transitionId;
                      }
                      if (additionalFields.expand) {
                          qs.expand = additionalFields.expand;
                      }
                      if (additionalFields.skipRemoteOnlyCondition) {
                          qs.skipRemoteOnlyCondition = additionalFields.skipRemoteOnlyCondition;
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'GET', {}, qs);
                      responseData = responseData.transitions;
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const deleteSubtasks = this.getNodeParameter('deleteSubtasks', i);
                      qs.deleteSubtasks = deleteSubtasks;
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          if (resource === 'issueAttachment') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'add') {
                  for (let i = 0; i < length; i++) {
                      const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                      let uploadData;
                      if (binaryData.id) {
                          uploadData = await this.helpers.getBinaryStream(binaryData.id);
                      }
                      else {
                          uploadData = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/attachments`, 'POST', {}, {}, undefined, {
                          formData: {
                              file: {
                                  value: uploadData,
                                  options: {
                                      filename: binaryData.fileName,
                                  },
                              },
                          },
                      });
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'remove') {
                  for (let i = 0; i < length; i++) {
                      const attachmentId = this.getNodeParameter('attachmentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/attachment/${attachmentId}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  const download = this.getNodeParameter('download', 0);
                  for (let i = 0; i < length; i++) {
                      const attachmentId = this.getNodeParameter('attachmentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/attachment/${attachmentId}`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  if (download) {
                      const binaryPropertyName = this.getNodeParameter('binaryProperty', 0);
                      for (const [index, attachment] of returnData.entries()) {
                          returnData[index].binary = {};
                          const buffer = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment === null || attachment === void 0 ? void 0 : attachment.json.content, { json: false, encoding: null, useStream: true });
                          returnData[index].binary[binaryPropertyName] =
                              await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
                      }
                  }
              }
              if (operation === 'getAll') {
                  const download = this.getNodeParameter('download', 0);
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const { fields: { attachment }, } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
                      responseData = attachment;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.slice(0, limit);
                      }
                      responseData = responseData.map((data) => ({ json: data }));
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  if (download) {
                      const binaryPropertyName = this.getNodeParameter('binaryProperty', 0);
                      for (const [index, attachment] of returnData.entries()) {
                          returnData[index].binary = {};
                          const buffer = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment.json.content, { json: false, encoding: null, useStream: true });
                          returnData[index].binary[binaryPropertyName] =
                              await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
                      }
                  }
              }
          }
          if (resource === 'issueComment') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'add') {
                  for (let i = 0; i < length; i++) {
                      const jsonParameters = this.getNodeParameter('jsonParameters', 0);
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      if (options.expand) {
                          qs.expand = options.expand;
                          delete options.expand;
                      }
                      Object.assign(body, options);
                      if (!jsonParameters) {
                          const comment = this.getNodeParameter('comment', i);
                          if (jiraVersion === 'server') {
                              Object.assign(body, { body: comment });
                          }
                          else {
                              Object.assign(body, {
                                  body: {
                                      type: 'doc',
                                      version: 1,
                                      content: [
                                          {
                                              type: 'paragraph',
                                              content: [
                                                  {
                                                      type: 'text',
                                                      text: comment,
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              });
                          }
                      }
                      else {
                          const commentJson = this.getNodeParameter('commentJson', i);
                          const json = (0, GenericFunctions_1.validateJSON)(commentJson);
                          if (json === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', {
                                  itemIndex: i,
                              });
                          }
                          Object.assign(body, { body: json });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment`, 'POST', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      const options = this.getNodeParameter('options', i);
                      Object.assign(qs, options);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      Object.assign(qs, options);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'comments', `/api/${apiVersion}/issue/${issueKey}/comment`, 'GET', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          body.maxResults = limit;
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment`, 'GET', body, qs);
                          responseData = responseData.comments;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'remove') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonParameters = this.getNodeParameter('jsonParameters', 0);
                      const body = {};
                      if (options.expand) {
                          qs.expand = options.expand;
                          delete options.expand;
                      }
                      Object.assign(qs, options);
                      if (!jsonParameters) {
                          const comment = this.getNodeParameter('comment', i);
                          if (jiraVersion === 'server') {
                              Object.assign(body, { body: comment });
                          }
                          else {
                              Object.assign(body, {
                                  body: {
                                      type: 'doc',
                                      version: 1,
                                      content: [
                                          {
                                              type: 'paragraph',
                                              content: [
                                                  {
                                                      type: 'text',
                                                      text: comment,
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              });
                          }
                      }
                      else {
                          const commentJson = this.getNodeParameter('commentJson', i);
                          const json = (0, GenericFunctions_1.validateJSON)(commentJson);
                          if (json === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', {
                                  itemIndex: i,
                              });
                          }
                          Object.assign(body, { body: json });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'PUT', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          if (resource === 'user') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      const body = {
                          name: this.getNodeParameter('username', i),
                          emailAddress: this.getNodeParameter('emailAddress', i),
                          displayName: this.getNodeParameter('displayName', i),
                      };
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'POST', body, {});
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              else if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      qs.accountId = this.getNodeParameter('accountId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              else if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      qs.accountId = this.getNodeParameter('accountId', i);
                      const { expand } = this.getNodeParameter('additionalFields', i);
                      if (expand) {
                          qs.expand = expand.join(',');
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          return [returnData];
      }
  }
  exports.Jira = Jira;
  //# sourceMappingURL=Jira.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Kafka
name: Kafka
package_name: n8n-nodes-base
display_name: Kafka
description: Sends messages to a Kafka topic
code_hash: 74c45cee3cedf2f42356b732d5025dcedca4654fe4a2c472ffc62e2d27715f7f
source_location: node_modules/n8n-nodes-base/dist/nodes/Kafka/Kafka.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Kafka = void 0;
  const kafkajs_1 = require("kafkajs");
  const confluent_schema_registry_1 = require("@kafkajs/confluent-schema-registry");
  const n8n_workflow_1 = require("n8n-workflow");
  const utilities_1 = require("../../utils/utilities");
  class Kafka {
      constructor() {
          this.description = {
              displayName: 'Kafka',
              name: 'kafka',
              icon: 'file:kafka.svg',
              group: ['transform'],
              version: 1,
              description: 'Sends messages to a Kafka topic',
              defaults: {
                  name: 'Kafka',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'kafka',
                      required: true,
                      testedBy: 'kafkaConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Topic',
                      name: 'topic',
                      type: 'string',
                      default: '',
                      placeholder: 'topic-name',
                      description: 'Name of the queue of topic to publish to',
                  },
                  {
                      displayName: 'Send Input Data',
                      name: 'sendInputData',
                      type: 'boolean',
                      default: true,
                      description: 'Whether to send the the data the node receives as JSON to Kafka',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sendInputData: [false],
                          },
                      },
                      default: '',
                      description: 'The message to be sent',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                  },
                  {
                      displayName: 'Use Schema Registry',
                      name: 'useSchemaRegistry',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to use Confluent Schema Registry',
                  },
                  {
                      displayName: 'Schema Registry URL',
                      name: 'schemaRegistryUrl',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useSchemaRegistry: [true],
                          },
                      },
                      placeholder: 'https://schema-registry-domain:8081',
                      default: '',
                      description: 'URL of the schema registry',
                  },
                  {
                      displayName: 'Use Key',
                      name: 'useKey',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to use a message key',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useKey: [true],
                          },
                      },
                      placeholder: '',
                      default: '',
                      description: 'The message key',
                  },
                  {
                      displayName: 'Event Name',
                      name: 'eventName',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useSchemaRegistry: [true],
                          },
                      },
                      default: '',
                      description: 'Namespace and Name of Schema in Schema Registry (namespace.name)',
                  },
                  {
                      displayName: 'Headers',
                      name: 'headersUi',
                      placeholder: 'Add Header',
                      type: 'fixedCollection',
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      typeOptions: {
                          multipleValues: true,
                      },
                      default: {},
                      options: [
                          {
                              name: 'headerValues',
                              displayName: 'Header',
                              values: [
                                  {
                                      displayName: 'Key',
                                      name: 'key',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Headers (JSON)',
                      name: 'headerParametersJson',
                      type: 'json',
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                      description: 'Header parameters as JSON (flat object)',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Acks',
                              name: 'acks',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not producer must wait for acknowledgement from all replicas',
                          },
                          {
                              displayName: 'Compression',
                              name: 'compression',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to send the data in a compressed format using the GZIP codec',
                          },
                          {
                              displayName: 'Timeout',
                              name: 'timeout',
                              type: 'number',
                              default: 30000,
                              description: 'The time to await a response in ms',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async kafkaConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const brokers = (credentials.brokers || '')
                              .split(',')
                              .map((item) => item.trim());
                          const clientId = credentials.clientId;
                          const ssl = credentials.ssl;
                          const config = {
                              clientId,
                              brokers,
                              ssl,
                          };
                          if (credentials.authentication === true) {
                              if (!(credentials.username && credentials.password)) {
                                  throw Error('Username and password are required for authentication');
                              }
                              config.sasl = {
                                  username: credentials.username,
                                  password: credentials.password,
                                  mechanism: credentials.saslMechanism,
                              };
                          }
                          const kafka = new kafkajs_1.Kafka(config);
                          await kafka.admin().connect();
                          await kafka.admin().disconnect();
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const itemData = (0, utilities_1.generatePairedItemData)(items.length);
          const length = items.length;
          const topicMessages = [];
          let responseData;
          try {
              const options = this.getNodeParameter('options', 0);
              const sendInputData = this.getNodeParameter('sendInputData', 0);
              const useSchemaRegistry = this.getNodeParameter('useSchemaRegistry', 0);
              const timeout = options.timeout;
              let compression = kafkajs_1.CompressionTypes.None;
              const acks = options.acks === true ? 1 : 0;
              if (options.compression === true) {
                  compression = kafkajs_1.CompressionTypes.GZIP;
              }
              const credentials = await this.getCredentials('kafka');
              const brokers = (credentials.brokers || '').split(',').map((item) => item.trim());
              const clientId = credentials.clientId;
              const ssl = credentials.ssl;
              const config = {
                  clientId,
                  brokers,
                  ssl,
              };
              if (credentials.authentication === true) {
                  if (!(credentials.username && credentials.password)) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Username and password are required for authentication');
                  }
                  config.sasl = {
                      username: credentials.username,
                      password: credentials.password,
                      mechanism: credentials.saslMechanism,
                  };
              }
              const kafka = new kafkajs_1.Kafka(config);
              const producer = kafka.producer();
              await producer.connect();
              let message;
              for (let i = 0; i < length; i++) {
                  if (sendInputData) {
                      message = JSON.stringify(items[i].json);
                  }
                  else {
                      message = this.getNodeParameter('message', i);
                  }
                  if (useSchemaRegistry) {
                      try {
                          const schemaRegistryUrl = this.getNodeParameter('schemaRegistryUrl', 0);
                          const eventName = this.getNodeParameter('eventName', 0);
                          const registry = new confluent_schema_registry_1.SchemaRegistry({ host: schemaRegistryUrl });
                          const id = await registry.getLatestSchemaId(eventName);
                          message = await registry.encode(id, JSON.parse(message));
                      }
                      catch (exception) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Verify your Schema Registry configuration');
                      }
                  }
                  const topic = this.getNodeParameter('topic', i);
                  const jsonParameters = this.getNodeParameter('jsonParameters', i);
                  const useKey = this.getNodeParameter('useKey', i);
                  const key = useKey ? this.getNodeParameter('key', i) : null;
                  let headers;
                  if (jsonParameters) {
                      headers = this.getNodeParameter('headerParametersJson', i);
                      try {
                          headers = JSON.parse(headers);
                      }
                      catch (exception) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Headers must be a valid json');
                      }
                  }
                  else {
                      const values = this.getNodeParameter('headersUi', i)
                          .headerValues;
                      headers = {};
                      if (values !== undefined) {
                          for (const value of values) {
                              headers[value.key] = value.value;
                          }
                      }
                  }
                  topicMessages.push({
                      topic,
                      messages: [
                          {
                              value: message,
                              headers,
                              key,
                          },
                      ],
                  });
              }
              responseData = await producer.sendBatch({
                  topicMessages,
                  timeout,
                  compression,
                  acks,
              });
              if (responseData.length === 0) {
                  responseData.push({
                      success: true,
                  });
              }
              await producer.disconnect();
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
              return [executionData];
          }
          catch (error) {
              if (this.continueOnFail()) {
                  return [[{ json: { error: error.message }, pairedItem: itemData }]];
              }
              else {
                  throw error;
              }
          }
      }
  }
  exports.Kafka = Kafka;
  //# sourceMappingURL=Kafka.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Keap
name: Keap
package_name: n8n-nodes-base
display_name: Keap
description: Consume Keap API
code_hash: 6edbc9075b37a91bd9f057729c08aa0d1296fdd8316a1790b34ba81da790c32e
source_location: node_modules/n8n-nodes-base/dist/nodes/Keap/Keap.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Keap = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const ContactDescription_1 = require("./ContactDescription");
  const ContactNoteDescription_1 = require("./ContactNoteDescription");
  const ContactTagDescription_1 = require("./ContactTagDescription");
  const EcommerceOrderDescripion_1 = require("./EcommerceOrderDescripion");
  const EcommerceProductDescription_1 = require("./EcommerceProductDescription");
  const EmailDescription_1 = require("./EmailDescription");
  const FileDescription_1 = require("./FileDescription");
  const CompanyDescription_1 = require("./CompanyDescription");
  const change_case_1 = require("change-case");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Keap {
      constructor() {
          this.description = {
              displayName: 'Keap',
              name: 'keap',
              icon: 'file:keap.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Keap API',
              defaults: {
                  name: 'Keap',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'keapOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'Contact Note',
                              value: 'contactNote',
                          },
                          {
                              name: 'Contact Tag',
                              value: 'contactTag',
                          },
                          {
                              name: 'Ecommerce Order',
                              value: 'ecommerceOrder',
                          },
                          {
                              name: 'Ecommerce Product',
                              value: 'ecommerceProduct',
                          },
                          {
                              name: 'Email',
                              value: 'email',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                      ],
                      default: 'company',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...CompanyDescription_1.companyFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...ContactNoteDescription_1.contactNoteOperations,
                  ...ContactNoteDescription_1.contactNoteFields,
                  ...ContactTagDescription_1.contactTagOperations,
                  ...ContactTagDescription_1.contactTagFields,
                  ...EcommerceOrderDescripion_1.ecommerceOrderOperations,
                  ...EcommerceOrderDescripion_1.ecommerceOrderFields,
                  ...EcommerceProductDescription_1.ecommerceProductOperations,
                  ...EcommerceProductDescription_1.ecommerceProductFields,
                  ...EmailDescription_1.emailOperations,
                  ...EmailDescription_1.emailFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTags() {
                      const returnData = [];
                      const tags = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'tags', 'GET', '/tags');
                      for (const tag of tags) {
                          const tagName = tag.name;
                          const tagId = tag.id;
                          returnData.push({
                              name: tagName,
                              value: tagId,
                          });
                      }
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const users = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'users', 'GET', '/users');
                      for (const user of users) {
                          const userName = user.given_name;
                          const userId = user.id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      return returnData;
                  },
                  async getCountries() {
                      const returnData = [];
                      const { countries } = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/locales/countries');
                      for (const key of Object.keys(countries)) {
                          const countryName = countries[key];
                          const countryId = key;
                          returnData.push({
                              name: countryName,
                              value: countryId,
                          });
                      }
                      return returnData;
                  },
                  async getProvinces() {
                      const countryCode = this.getCurrentNodeParameter('countryCode');
                      const returnData = [];
                      const { provinces } = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/locales/countries/${countryCode}/provinces`);
                      for (const key of Object.keys(provinces)) {
                          const provinceName = provinces[key];
                          const provinceId = key;
                          returnData.push({
                              name: provinceName,
                              value: provinceId,
                          });
                      }
                      return returnData;
                  },
                  async getContactTypes() {
                      const returnData = [];
                      const types = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/setting/contact/optionTypes');
                      for (const type of types.value.split(',')) {
                          const typeName = type;
                          const typeId = type;
                          returnData.push({
                              name: typeName,
                              value: typeId,
                          });
                      }
                      return returnData;
                  },
                  async getTimezones() {
                      const returnData = [];
                      for (const timezone of moment_timezone_1.default.tz.names()) {
                          const timezoneName = timezone;
                          const timezoneId = timezone;
                          returnData.push({
                              name: timezoneName,
                              value: timezoneId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'company') {
                  if (operation === 'create') {
                      const addresses = this.getNodeParameter('addressesUi', i)
                          .addressesValues;
                      const faxes = this.getNodeParameter('faxesUi', i)
                          .faxesValues;
                      const phones = this.getNodeParameter('phonesUi', i)
                          .phonesValues;
                      const companyName = this.getNodeParameter('companyName', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          company_name: companyName,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      if (addresses) {
                          body.address = (0, GenericFunctions_1.keysToSnakeCase)(addresses)[0];
                      }
                      if (faxes) {
                          body.fax_number = faxes[0];
                      }
                      if (phones) {
                          body.phone_number = phones[0];
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/companies', body);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(options);
                      Object.assign(qs, options);
                      if (qs.fields) {
                          qs.optional_properties = qs.fields;
                          delete qs.fields;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'companies', 'GET', '/companies', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/companies', {}, qs);
                          responseData = responseData.companies;
                      }
                  }
              }
              if (resource === 'contact') {
                  if (operation === 'upsert') {
                      const duplicateOption = this.getNodeParameter('duplicateOption', i);
                      const addresses = this.getNodeParameter('addressesUi', i)
                          .addressesValues;
                      const emails = this.getNodeParameter('emailsUi', i)
                          .emailsValues;
                      const faxes = this.getNodeParameter('faxesUi', i)
                          .faxesValues;
                      const socialAccounts = this.getNodeParameter('socialAccountsUi', i)
                          .socialAccountsValues;
                      const phones = this.getNodeParameter('phonesUi', i)
                          .phonesValues;
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          duplicate_option: (0, change_case_1.pascalCase)(duplicateOption),
                      };
                      if (additionalFields.anniversary) {
                          body.anniversary = additionalFields.anniversary;
                      }
                      if (additionalFields.contactType) {
                          body.contact_type = additionalFields.contactType;
                      }
                      if (additionalFields.familyName) {
                          body.family_name = additionalFields.familyName;
                      }
                      if (additionalFields.givenName) {
                          body.given_name = additionalFields.givenName;
                      }
                      if (additionalFields.jobTitle) {
                          body.job_title = additionalFields.jobTitle;
                      }
                      if (additionalFields.leadSourceId) {
                          body.lead_source_id = additionalFields.leadSourceId;
                      }
                      if (additionalFields.middleName) {
                          body.middle_name = additionalFields.middleName;
                      }
                      if (additionalFields.middleName) {
                          body.middle_name = additionalFields.middleName;
                      }
                      if (additionalFields.OptInReason) {
                          body.opt_in_reason = additionalFields.OptInReason;
                      }
                      if (additionalFields.ownerId) {
                          body.owner_id = additionalFields.ownerId;
                      }
                      if (additionalFields.preferredLocale) {
                          body.preferred_locale = additionalFields.preferredLocale;
                      }
                      if (additionalFields.preferredName) {
                          body.preferred_name = additionalFields.preferredName;
                      }
                      if (additionalFields.sourceType) {
                          body.source_type = additionalFields.sourceType;
                      }
                      if (additionalFields.spouseName) {
                          body.spouse_name = additionalFields.spouseName;
                      }
                      if (additionalFields.timezone) {
                          body.time_zone = additionalFields.timezone;
                      }
                      if (additionalFields.website) {
                          body.website = additionalFields.website;
                      }
                      if (additionalFields.ipAddress) {
                          body.origin = { ip_address: additionalFields.ipAddress };
                      }
                      if (additionalFields.companyId) {
                          body.company = { id: additionalFields.companyId };
                      }
                      if (additionalFields.optInReason) {
                          body.opt_in_reason = additionalFields.optInReason;
                      }
                      if (addresses) {
                          body.addresses = (0, GenericFunctions_1.keysToSnakeCase)(addresses);
                      }
                      if (emails) {
                          body.email_addresses = emails;
                      }
                      if (faxes) {
                          body.fax_numbers = faxes;
                      }
                      if (socialAccounts) {
                          body.social_accounts = socialAccounts;
                      }
                      if (phones) {
                          body.phone_numbers = phones;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'PUT', '/contacts', body);
                  }
                  if (operation === 'delete') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const options = this.getNodeParameter('options', i);
                      if (options.fields) {
                          qs.optional_properties = options.fields;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/contacts/${contactId}`, {}, qs);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.email) {
                          qs.email = options.email;
                      }
                      if (options.givenName) {
                          qs.given_name = options.givenName;
                      }
                      if (options.familyName) {
                          qs.family_name = options.familyName;
                      }
                      if (options.order) {
                          qs.order = options.order;
                      }
                      if (options.orderDirection) {
                          qs.order_direction = options.orderDirection;
                      }
                      if (options.since) {
                          qs.since = options.since;
                      }
                      if (options.until) {
                          qs.until = options.until;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'contacts', 'GET', '/contacts', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/contacts', {}, qs);
                          responseData = responseData.contacts;
                      }
                  }
              }
              if (resource === 'contactNote') {
                  if (operation === 'create') {
                      const userId = this.getNodeParameter('userId', i);
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          user_id: userId,
                          contact_id: contactId,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      if (additionalFields.type) {
                          additionalFields.type = (0, change_case_1.pascalCase)(additionalFields.type);
                      }
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/notes', body);
                  }
                  if (operation === 'delete') {
                      const noteId = this.getNodeParameter('noteId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const noteId = this.getNodeParameter('noteId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/notes/${noteId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'notes', 'GET', '/notes', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/notes', {}, qs);
                          responseData = responseData.notes;
                      }
                  }
                  if (operation === 'update') {
                      const noteId = this.getNodeParameter('noteId', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      if (additionalFields.type) {
                          additionalFields.type = (0, change_case_1.pascalCase)(additionalFields.type);
                      }
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'PATCH', `/notes/${noteId}`, body);
                  }
              }
              if (resource === 'contactTag') {
                  if (operation === 'create') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const tagIds = this.getNodeParameter('tagIds', i);
                      const body = {
                          tagIds,
                      };
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', `/contacts/${contactId}/tags`, body);
                  }
                  if (operation === 'delete') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const tagIds = this.getNodeParameter('tagIds', i);
                      qs.ids = tagIds;
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}/tags`, {}, qs);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'tags', 'GET', `/contacts/${contactId}/tags`, {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/contacts/${contactId}/tags`, {}, qs);
                          responseData = responseData.tags;
                      }
                  }
              }
              if (resource === 'ecommerceOrder') {
                  if (operation === 'create') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const orderDate = this.getNodeParameter('orderDate', i);
                      const orderTitle = this.getNodeParameter('orderTitle', i);
                      const orderType = this.getNodeParameter('orderType', i);
                      const orderItems = this.getNodeParameter('orderItemsUi', i)
                          .orderItemsValues;
                      const shippingAddress = this.getNodeParameter('addressUi', i)
                          .addressValues;
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          contact_id: contactId,
                          order_date: orderDate,
                          order_title: orderTitle,
                          order_type: (0, change_case_1.pascalCase)(orderType),
                      };
                      if (additionalFields.promoCodes) {
                          additionalFields.promoCodes = additionalFields.promoCodes.split(',');
                      }
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      body.order_items = (0, GenericFunctions_1.keysToSnakeCase)(orderItems);
                      if (shippingAddress) {
                          body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shippingAddress)[0];
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/orders', body);
                  }
                  if (operation === 'delete') {
                      const orderId = parseInt(this.getNodeParameter('orderId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/orders/${orderId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const orderId = parseInt(this.getNodeParameter('orderId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'get', `/orders/${orderId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(options);
                      Object.assign(qs, options);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'orders', 'GET', '/orders', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/orders', {}, qs);
                          responseData = responseData.orders;
                      }
                  }
              }
              if (resource === 'ecommerceProduct') {
                  if (operation === 'create') {
                      const productName = this.getNodeParameter('productName', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          product_name: productName,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/products', body);
                  }
                  if (operation === 'delete') {
                      const productId = this.getNodeParameter('productId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/products/${productId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const productId = this.getNodeParameter('productId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'get', `/products/${productId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'products', 'GET', '/products', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/products', {}, qs);
                          responseData = responseData.products;
                      }
                  }
              }
              if (resource === 'email') {
                  if (operation === 'createRecord') {
                      const sentFromAddress = this.getNodeParameter('sentFromAddress', i);
                      const sendToAddress = this.getNodeParameter('sentToAddress', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          sent_to_address: sendToAddress,
                          sent_from_address: sentFromAddress,
                      };
                      Object.assign(body, additionalFields);
                      (0, GenericFunctions_1.keysToSnakeCase)(body);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/emails', body);
                  }
                  if (operation === 'deleteRecord') {
                      const emailRecordId = parseInt(this.getNodeParameter('emailRecordId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/emails/${emailRecordId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'emails', 'GET', '/emails', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/emails', {}, qs);
                          responseData = responseData.emails;
                      }
                  }
                  if (operation === 'send') {
                      const userId = this.getNodeParameter('userId', i);
                      const contactIds = this.getNodeParameter('contactIds', i)
                          .split(',')
                          .map((e) => parseInt(e, 10));
                      const subject = this.getNodeParameter('subject', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          user_id: userId,
                          contacts: contactIds,
                          subject,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      const attachmentsUi = this.getNodeParameter('attachmentsUi', i);
                      let attachments = [];
                      if (attachmentsUi) {
                          if (attachmentsUi.attachmentsValues) {
                              (0, GenericFunctions_1.keysToSnakeCase)(attachmentsUi.attachmentsValues);
                              attachments = attachmentsUi.attachmentsValues;
                          }
                          const attachmentsBinary = attachmentsUi.attachmentsBinary;
                          if (attachmentsBinary === null || attachmentsBinary === void 0 ? void 0 : attachmentsBinary.length) {
                              for (const { property } of attachmentsBinary) {
                                  const binaryData = this.helpers.assertBinaryData(i, property);
                                  attachments.push({
                                      file_data: binaryData.data,
                                      file_name: binaryData.fileName,
                                  });
                              }
                          }
                          body.attachments = attachments;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/emails/queue', body);
                      responseData = { success: true };
                  }
              }
              if (resource === 'file') {
                  if (operation === 'delete') {
                      const fileId = parseInt(this.getNodeParameter('fileId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/files/${fileId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (qs.permission) {
                          qs.permission = qs.permission.toUpperCase();
                      }
                      if (qs.type) {
                          qs.type = (0, change_case_1.capitalCase)(qs.type);
                      }
                      if (qs.viewable) {
                          qs.viewable = qs.viewable.toUpperCase();
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'files', 'GET', '/files', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/files', {}, qs);
                          responseData = responseData.files;
                      }
                  }
                  if (operation === 'upload') {
                      const fileAssociation = this.getNodeParameter('fileAssociation', i);
                      const isPublic = this.getNodeParameter('isPublic', i);
                      const body = {
                          is_public: isPublic,
                          file_association: fileAssociation.toUpperCase(),
                      };
                      if (fileAssociation === 'contact') {
                          const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                          body.contact_id = contactId;
                      }
                      if (this.getNodeParameter('binaryData', i)) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                          body.file_data = binaryData.data;
                          body.file_name = binaryData.fileName;
                      }
                      else {
                          const fileName = this.getNodeParameter('fileName', i);
                          const fileData = this.getNodeParameter('fileData', i);
                          body.file_name = fileName;
                          body.file_data = fileData;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/files', body);
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Keap = Keap;
  //# sourceMappingURL=Keap.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Kitemaker
name: Kitemaker
package_name: n8n-nodes-base
display_name: Kitemaker
description: Consume the Kitemaker GraphQL API
code_hash: d77a6740a8ec5ce77b62d5069a0e2bd6349891c973f38cf5d4fc6242c854c0ba
source_location: node_modules/n8n-nodes-base/dist/nodes/Kitemaker/Kitemaker.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Kitemaker = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const queries_1 = require("./queries");
  const mutations_1 = require("./mutations");
  class Kitemaker {
      constructor() {
          this.description = {
              displayName: 'Kitemaker',
              name: 'kitemaker',
              icon: 'file:kitemaker.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume the Kitemaker GraphQL API',
              defaults: {
                  name: 'Kitemaker',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'kitemakerApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Organization',
                              value: 'organization',
                          },
                          {
                              name: 'Space',
                              value: 'space',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                          {
                              name: 'Work Item',
                              value: 'workItem',
                          },
                      ],
                      default: 'workItem',
                      required: true,
                  },
                  ...descriptions_1.organizationOperations,
                  ...descriptions_1.spaceOperations,
                  ...descriptions_1.spaceFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
                  ...descriptions_1.workItemOperations,
                  ...descriptions_1.workItemFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLabels() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getLabels });
                      const { data: { organization: { spaces }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(spaces[0].labels);
                  },
                  async getSpaces() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getSpaces });
                      const { data: { organization: { spaces }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(spaces);
                  },
                  async getStatuses() {
                      const spaceId = this.getNodeParameter('spaceId', 0);
                      if (!spaceId.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please choose a space to set for the work item to create.');
                      }
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getStatuses });
                      const { data: { organization: { spaces }, }, } = responseData;
                      const space = spaces.find((e) => e.id === spaceId);
                      return (0, GenericFunctions_1.createLoadOptions)(space.statuses);
                  },
                  async getUsers() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getUsers });
                      const { data: { organization: { users }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(users);
                  },
                  async getWorkItems() {
                      const spaceId = this.getNodeParameter('spaceId', 0);
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getWorkItems,
                          variables: { spaceId },
                      });
                      const { data: { workItems: { workItems }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(workItems);
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          for (let i = 0; i < items.length; i++) {
              if (resource === 'organization') {
                  if (operation === 'get') {
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getOrganization,
                      });
                      responseData = responseData.data.organization;
                  }
              }
              else if (resource === 'space') {
                  if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllSpaces,
                          variables: {},
                      });
                      responseData = allItems;
                  }
              }
              else if (resource === 'user') {
                  if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllUsers,
                          variables: {},
                      });
                      responseData = allItems;
                  }
              }
              else if (resource === 'workItem') {
                  if (operation === 'create') {
                      const input = {
                          title: this.getNodeParameter('title', i),
                          statusId: this.getNodeParameter('statusId', i),
                      };
                      if (!input.statusId.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter a status to set for the work item to create.', { itemIndex: i });
                      }
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (Object.keys(additionalFields).length) {
                          Object.assign(input, additionalFields);
                      }
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: mutations_1.createWorkItem,
                          variables: { input },
                      });
                      responseData = responseData.data.createWorkItem.workItem;
                  }
                  else if (operation === 'get') {
                      const workItemId = this.getNodeParameter('workItemId', i);
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getWorkItem,
                          variables: { workItemId },
                      });
                      responseData = responseData.data.workItem;
                  }
                  else if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllWorkItems,
                          variables: {
                              spaceId: this.getNodeParameter('spaceId', i),
                          },
                      });
                      responseData = allItems;
                  }
                  else if (operation === 'update') {
                      const input = {
                          id: this.getNodeParameter('workItemId', i),
                      };
                      const updateFields = this.getNodeParameter('updateFields', i);
                      if (!Object.keys(updateFields).length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter at least one field to update for the work item.', { itemIndex: i });
                      }
                      Object.assign(input, updateFields);
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: mutations_1.editWorkItem,
                          variables: { input },
                      });
                      responseData = responseData.data.editWorkItem.workItem;
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Kitemaker = Kitemaker;
  //# sourceMappingURL=Kitemaker.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.KoBoToolbox
name: KoBoToolbox
package_name: n8n-nodes-base
display_name: KoBoToolbox
description: Work with KoBoToolbox forms and submissions
code_hash: c9c4bb6871c6b52d5ab1470bb539737a94680fae02acf480bc6fb2b8b8c57a7f
source_location: node_modules/n8n-nodes-base/dist/nodes/KoBoToolbox/KoBoToolbox.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.KoBoToolbox = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const FormDescription_1 = require("./FormDescription");
  const SubmissionDescription_1 = require("./SubmissionDescription");
  const HookDescription_1 = require("./HookDescription");
  const FileDescription_1 = require("./FileDescription");
  class KoBoToolbox {
      constructor() {
          this.description = {
              displayName: 'KoBoToolbox',
              name: 'koBoToolbox',
              icon: 'file:koBoToolbox.svg',
              group: ['transform'],
              version: 1,
              description: 'Work with KoBoToolbox forms and submissions',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'KoBoToolbox',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'koBoToolboxApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Form',
                              value: 'form',
                          },
                          {
                              name: 'Hook',
                              value: 'hook',
                          },
                          {
                              name: 'Submission',
                              value: 'submission',
                          },
                      ],
                      default: 'submission',
                      required: true,
                  },
                  ...FormDescription_1.formOperations,
                  ...FormDescription_1.formFields,
                  ...HookDescription_1.hookOperations,
                  ...HookDescription_1.hookFields,
                  ...SubmissionDescription_1.submissionOperations,
                  ...SubmissionDescription_1.submissionFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  loadForms: GenericFunctions_1.loadForms,
              },
          };
      }
      async execute() {
          var _a, _b, _c, _d, _e, _f;
          let responseData;
          let returnData = [];
          const binaryItems = [];
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              if (resource === 'form') {
                  if (operation === 'get') {
                      const formId = this.getNodeParameter('formId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}`,
                          }),
                      ];
                  }
                  if (operation === 'getAll') {
                      const formQueryOptions = this.getNodeParameter('options', i);
                      const formFilterOptions = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: '/api/v2/assets/',
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                              ...(formFilterOptions.filter && { q: formFilterOptions.filter }),
                              ...(((_b = (_a = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.ordering) && {
                                  ordering: (((_d = (_c = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.descending) ? '-' : '') +
                                      ((_f = (_e = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.ordering),
                              }),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                  }
                  if (operation === 'redeploy') {
                      const formId = this.getNodeParameter('formId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/deployment/`,
                          }),
                      ];
                  }
              }
              if (resource === 'submission') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      const submissionQueryOptions = this.getNodeParameter('options', i);
                      const filterJson = this.getNodeParameter('filterJson', i, null);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/data/`,
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                              ...(filterJson && { query: filterJson }),
                              ...(submissionQueryOptions.sort && { sort: submissionQueryOptions.sort }),
                              ...(submissionQueryOptions.fields && {
                                  fields: JSON.stringify((0, GenericFunctions_1.parseStringList)(submissionQueryOptions.fields)),
                              }),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                      if (submissionQueryOptions.reformat) {
                          responseData = responseData.map((submission) => {
                              return (0, GenericFunctions_1.formatSubmission)(submission, (0, GenericFunctions_1.parseStringList)(submissionQueryOptions.selectMask), (0, GenericFunctions_1.parseStringList)(submissionQueryOptions.numberMask));
                          });
                      }
                      if (submissionQueryOptions.download) {
                          for (const submission of responseData) {
                              binaryItems.push(await GenericFunctions_1.downloadAttachments.call(this, submission, submissionQueryOptions));
                          }
                      }
                  }
                  if (operation === 'get') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      const options = this.getNodeParameter('options', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/data/${submissionId}`,
                              qs: {
                                  ...(options.fields && {
                                      fields: JSON.stringify((0, GenericFunctions_1.parseStringList)(options.fields)),
                                  }),
                              },
                          }),
                      ];
                      if (options.reformat) {
                          responseData = responseData.map((submission) => {
                              return (0, GenericFunctions_1.formatSubmission)(submission, (0, GenericFunctions_1.parseStringList)(options.selectMask), (0, GenericFunctions_1.parseStringList)(options.numberMask));
                          });
                      }
                      if (options.download) {
                          for (const submission of responseData) {
                              binaryItems.push(await GenericFunctions_1.downloadAttachments.call(this, submission, options));
                          }
                      }
                  }
                  if (operation === 'delete') {
                      const id = this.getNodeParameter('submissionId', i);
                      await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          method: 'DELETE',
                          url: `/api/v2/assets/${formId}/data/${id}`,
                      });
                      responseData = [
                          {
                              success: true,
                          },
                      ];
                  }
                  if (operation === 'getValidation') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/data/${submissionId}/validation_status/`,
                          }),
                      ];
                  }
                  if (operation === 'setValidation') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      const status = this.getNodeParameter('validationStatus', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/data/${submissionId}/validation_status/`,
                              body: {
                                  'validation_status.uid': status,
                              },
                          }),
                      ];
                  }
              }
              if (resource === 'hook') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/hooks/`,
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                  }
                  if (operation === 'get') {
                      const hookId = this.getNodeParameter('hookId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/hooks/${hookId}`,
                          }),
                      ];
                  }
                  if (operation === 'retryAll') {
                      const hookId = this.getNodeParameter('hookId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/hooks/${hookId}/retry/`,
                          }),
                      ];
                  }
                  if (operation === 'getLogs') {
                      const hookId = this.getNodeParameter('hookId', i);
                      const startDate = this.getNodeParameter('startDate', i, null);
                      const endDate = this.getNodeParameter('endDate', i, null);
                      const status = this.getNodeParameter('status', i, null);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/hooks/${hookId}/logs/`,
                          qs: {
                              ...(startDate && { start: startDate }),
                              ...(endDate && { end: endDate }),
                              ...(status && { status }),
                          },
                      });
                  }
                  if (operation === 'retryOne') {
                      const hookId = this.getNodeParameter('hookId', i);
                      const logId = this.getNodeParameter('logId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/hooks/${hookId}/logs/${logId}/retry/`,
                          }),
                      ];
                  }
              }
              if (resource === 'file') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files`,
                              qs: {
                                  file_type: 'form_media',
                              },
                              scroll: true,
                          }),
                      ];
                  }
                  if (operation === 'get') {
                      const fileId = this.getNodeParameter('fileId', i);
                      const download = this.getNodeParameter('download', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files/${fileId}`,
                          }),
                      ];
                      if ((responseData === null || responseData === void 0 ? void 0 : responseData[0]) && download) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const binaryItem = {
                              json: responseData[0],
                              binary: {},
                          };
                          const response = await GenericFunctions_1.koBoToolboxRawRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files/${fileId}/content`,
                              encoding: 'arraybuffer',
                          });
                          console.dir(response);
                          binaryItem.binary[binaryPropertyName] = await this.helpers.prepareBinaryData(response, responseData[0].metadata.filename);
                          binaryItems.push(binaryItem);
                      }
                  }
                  if (operation === 'delete') {
                      const fileId = this.getNodeParameter('fileId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'DELETE',
                              url: `/api/v2/assets/${formId}/files/${fileId}`,
                          }),
                      ];
                  }
                  if (operation === 'create') {
                      const fileMode = this.getNodeParameter('fileMode', i);
                      const body = {
                          description: 'Uploaded file',
                          file_type: 'form_media',
                      };
                      if ('binary' === fileMode) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const item = items[i].binary;
                          const binaryData = item[binaryPropertyName];
                          body.base64Encoded = 'data:' + binaryData.mimeType + ';base64,' + binaryData.data;
                          body.metadata = {
                              filename: binaryData.fileName,
                          };
                      }
                      else {
                          const fileUrl = this.getNodeParameter('fileUrl', i);
                          body.metadata = {
                              redirect_url: fileUrl,
                          };
                      }
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'POST',
                              url: `/api/v2/assets/${formId}/files/`,
                              body,
                          }),
                      ];
                  }
              }
              returnData = returnData.concat(responseData);
          }
          return binaryItems.length > 0 ? [binaryItems] : [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.KoBoToolbox = KoBoToolbox;
  //# sourceMappingURL=KoBoToolbox.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Ldap
name: Ldap
package_name: n8n-nodes-base
display_name: Ldap
description: Interact with LDAP servers
code_hash: d672264081d30d100685786ddec6cc77a4750dd916eb833f83d2f27dd6ef18b2
source_location: node_modules/n8n-nodes-base/dist/nodes/Ldap/Ldap.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Ldap = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const ldapts_1 = require("ldapts");
  const LdapDescription_1 = require("./LdapDescription");
  const Helpers_1 = require("./Helpers");
  class Ldap {
      constructor() {
          this.description = {
              displayName: 'Ldap',
              name: 'ldap',
              icon: 'file:ldap.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Interact with LDAP servers',
              defaults: {
                  name: 'LDAP',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'ldap',
                      required: true,
                      testedBy: 'ldapConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Compare',
                              value: 'compare',
                              description: 'Compare an attribute',
                              action: 'Compare an attribute',
                          },
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new entry',
                              action: 'Create a new entry',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete an entry',
                              action: 'Delete an entry',
                          },
                          {
                              name: 'Rename',
                              value: 'rename',
                              description: 'Rename the DN of an existing entry',
                              action: 'Rename the DN of an existing entry',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search LDAP',
                              action: 'Search LDAP',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update attributes',
                              action: 'Update attributes',
                          },
                      ],
                      default: 'search',
                  },
                  {
                      displayName: 'Debug',
                      name: 'nodeDebug',
                      type: 'boolean',
                      isNodeSetting: true,
                      default: false,
                      noDataExpression: true,
                  },
                  ...LdapDescription_1.ldapFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async ldapConnectionTest(credential) {
                      const credentials = credential.data;
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      finally {
                          await client.unbind();
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
              loadOptions: {
                  async getAttributes() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      let results;
                      const baseDN = this.getNodeParameter('baseDN', 0);
                      try {
                          results = await client.search(baseDN, { sizeLimit: 200, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const unique = Object.keys(Object.assign({}, ...results.searchEntries));
                      return unique.map((x) => ({
                          name: x,
                          value: x,
                      }));
                  },
                  async getObjectClasses() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      const baseDN = this.getNodeParameter('baseDN', 0);
                      let results;
                      try {
                          results = await client.search(baseDN, { sizeLimit: 10, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const objects = [];
                      for (const entry of results.searchEntries) {
                          if (typeof entry.objectClass === 'string') {
                              objects.push(entry.objectClass);
                          }
                          else {
                              objects.push(...entry.objectClass);
                          }
                      }
                      const unique = [...new Set(objects)];
                      unique.push('custom');
                      const result = [];
                      for (const value of unique) {
                          if (value === 'custom') {
                              result.push({ name: 'custom', value: 'custom' });
                          }
                          else
                              result.push({ name: value, value: `(objectclass=${value})` });
                      }
                      return result;
                  },
                  async getAttributesForDn() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      let results;
                      const baseDN = this.getNodeParameter('dn', 0);
                      try {
                          results = await client.search(baseDN, { sizeLimit: 1, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const unique = Object.keys(Object.assign({}, ...results.searchEntries));
                      return unique.map((x) => ({
                          name: x,
                          value: x,
                      }));
                  },
              },
          };
      }
      async execute() {
          const nodeDebug = this.getNodeParameter('nodeDebug', 0);
          const items = this.getInputData();
          const returnItems = [];
          if (nodeDebug) {
              n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Starting with ${items.length} input items`);
          }
          const credentials = await this.getCredentials('ldap');
          const client = await (0, Helpers_1.createLdapClient)(credentials, nodeDebug, this.getNode().type, this.getNode().name);
          try {
              await client.bind(credentials.bindDN, credentials.bindPassword);
          }
          catch (error) {
              delete error.cert;
              await client.unbind();
              if (this.continueOnFail()) {
                  return [
                      items.map((x) => {
                          x.json.error = error.reason || 'LDAP connection error occurred';
                          return x;
                      }),
                  ];
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {});
              }
          }
          const operation = this.getNodeParameter('operation', 0);
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  if (operation === 'compare') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributeId = this.getNodeParameter('id', itemIndex);
                      const value = this.getNodeParameter('value', itemIndex, '');
                      const res = await client.compare(dn, attributeId, value);
                      returnItems.push({
                          json: { dn, attribute: attributeId, result: res },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'create') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributeFields = this.getNodeParameter('attributes', itemIndex);
                      const attributes = {};
                      if (Object.keys(attributeFields).length) {
                          attributeFields.attribute.map((attr) => {
                              attributes[attr.id] = attr.value;
                          });
                      }
                      await client.add(dn, attributes);
                      returnItems.push({
                          json: { dn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'delete') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      await client.del(dn);
                      returnItems.push({
                          json: { dn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'rename') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const targetDn = this.getNodeParameter('targetDn', itemIndex);
                      await client.modifyDN(dn, targetDn);
                      returnItems.push({
                          json: { dn: targetDn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'update') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributes = this.getNodeParameter('attributes', itemIndex, {});
                      const changes = [];
                      for (const [action, attrs] of Object.entries(attributes)) {
                          attrs.map((attr) => changes.push(new ldapts_1.Change({
                              operation: action,
                              modification: new ldapts_1.Attribute({
                                  type: attr.id,
                                  values: [attr.value],
                              }),
                          })));
                      }
                      await client.modify(dn, changes);
                      returnItems.push({
                          json: { dn, result: 'success', changes },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'search') {
                      const baseDN = this.getNodeParameter('baseDN', itemIndex);
                      let searchFor = this.getNodeParameter('searchFor', itemIndex);
                      const returnAll = this.getNodeParameter('returnAll', itemIndex);
                      const limit = this.getNodeParameter('limit', itemIndex, 0);
                      const options = this.getNodeParameter('options', itemIndex);
                      const pageSize = this.getNodeParameter('options.pageSize', itemIndex, 1000);
                      delete options.pageSize;
                      options.sizeLimit = returnAll ? 0 : limit;
                      if (pageSize) {
                          options.paged = { pageSize };
                      }
                      if (typeof options.attributes === 'string') {
                          options.attributes = options.attributes.split(',').map((attribute) => attribute.trim());
                      }
                      options.explicitBufferAttributes = Helpers_1.BINARY_AD_ATTRIBUTES;
                      if (searchFor === 'custom') {
                          searchFor = this.getNodeParameter('customFilter', itemIndex);
                      }
                      else {
                          const searchText = this.getNodeParameter('searchText', itemIndex);
                          const attribute = this.getNodeParameter('attribute', itemIndex);
                          searchFor = `(&${searchFor}(${attribute}=${searchText}))`;
                      }
                      searchFor = searchFor.replace(/\\\\/g, '\\5c');
                      searchFor = searchFor.replace(/\\\*/g, '\\2a');
                      searchFor = searchFor.replace(/\\\(/g, '\\28');
                      searchFor = searchFor.replace(/\\\)/g, '\\29');
                      options.filter = searchFor;
                      if (nodeDebug) {
                          n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Search Options ${JSON.stringify(options, null, 2)}`);
                      }
                      const results = await client.search(baseDN, options);
                      if (!returnAll) {
                          results.searchEntries = results.searchEntries.slice(0, limit);
                      }
                      (0, Helpers_1.resolveBinaryAttributes)(results.searchEntries);
                      returnItems.push.apply(returnItems, results.searchEntries.map((result) => ({
                          json: result,
                          pairedItem: { item: itemIndex },
                      })));
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnItems.push({ json: items[itemIndex].json, error, pairedItem: itemIndex });
                  }
                  else {
                      await client.unbind();
                      if (error.context) {
                          error.context.itemIndex = itemIndex;
                          throw error;
                      }
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
                          itemIndex,
                      });
                  }
              }
          }
          if (nodeDebug) {
              n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Finished`);
          }
          await client.unbind();
          return [returnItems];
      }
  }
  exports.Ldap = Ldap;
  //# sourceMappingURL=Ldap.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Lemlist
name: Lemlist
package_name: n8n-nodes-base
display_name: Lemlist
description: Consume the Lemlist API
code_hash: 874dd1c1de4d3bc41d4acb8e78a610448f7e2fbf0025090f94cbed80261b1fa8
source_location: node_modules/n8n-nodes-base/dist/nodes/Lemlist/Lemlist.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Lemlist = void 0;
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  const omit_1 = __importDefault(require("lodash/omit"));
  class Lemlist {
      constructor() {
          this.description = {
              displayName: 'Lemlist',
              name: 'lemlist',
              icon: 'file:lemlist.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Lemlist API',
              defaults: {
                  name: 'Lemlist',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lemlistApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Activity',
                              value: 'activity',
                          },
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'Lead',
                              value: 'lead',
                          },
                          {
                              name: 'Team',
                              value: 'team',
                          },
                          {
                              name: 'Unsubscribe',
                              value: 'unsubscribe',
                          },
                      ],
                      default: 'activity',
                  },
                  ...descriptions_1.activityOperations,
                  ...descriptions_1.activityFields,
                  ...descriptions_1.campaignOperations,
                  ...descriptions_1.campaignFields,
                  ...descriptions_1.leadOperations,
                  ...descriptions_1.leadFields,
                  ...descriptions_1.teamOperations,
                  ...descriptions_1.teamFields,
                  ...descriptions_1.unsubscribeOperations,
                  ...descriptions_1.unsubscribeFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCampaigns() {
                      const campaigns = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/campaigns');
                      return campaigns.map(({ _id, name }) => ({
                          name,
                          value: _id,
                      }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'activity') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (!(0, isEmpty_1.default)(filters)) {
                              Object.assign(qs, filters);
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/activities', qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/activities', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'campaign') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/campaigns', {});
                          }
                          else {
                              const qs = {
                                  limit: this.getNodeParameter('limit', i),
                              };
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/campaigns', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'lead') {
                      if (operation === 'create') {
                          const qs = {};
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.deduplicate !== undefined) {
                              qs.deduplicate = additionalFields.deduplicate;
                          }
                          const body = {};
                          const remainingAdditionalFields = (0, omit_1.default)(additionalFields, 'deduplicate');
                          if (!(0, isEmpty_1.default)(remainingAdditionalFields)) {
                              Object.assign(body, remainingAdditionalFields);
                          }
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'POST', endpoint, body, qs);
                      }
                      else if (operation === 'delete') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', endpoint, {}, { action: 'remove' });
                      }
                      else if (operation === 'get') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', `/leads/${email}`);
                      }
                      else if (operation === 'unsubscribe') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', endpoint);
                      }
                  }
                  else if (resource === 'team') {
                      if (operation === 'get') {
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/team');
                      }
                  }
                  else if (resource === 'unsubscribe') {
                      if (operation === 'add') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'POST', `/unsubscribes/${email}`);
                      }
                      else if (operation === 'delete') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', `/unsubscribes/${email}`);
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/unsubscribes', {});
                          }
                          else {
                              const qs = {
                                  limit: this.getNodeParameter('limit', i),
                              };
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/unsubscribes', {}, qs);
                          }
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Lemlist = Lemlist;
  //# sourceMappingURL=Lemlist.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Line
name: Line
package_name: n8n-nodes-base
display_name: Line
description: Consume Line API
code_hash: c8d8b4834af3201e0b176fa5da6263bbb5882a92e7a82b42f8d86470310e9fda
source_location: node_modules/n8n-nodes-base/dist/nodes/Line/Line.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Line = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const NotificationDescription_1 = require("./NotificationDescription");
  class Line {
      constructor() {
          this.description = {
              displayName: 'Line',
              name: 'line',
              icon: 'file:line.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Line API',
              defaults: {
                  name: 'Line',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lineNotifyOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['notification'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Notification',
                              value: 'notification',
                          },
                      ],
                      default: 'notification',
                  },
                  ...NotificationDescription_1.notificationOperations,
                  ...NotificationDescription_1.notificationFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'notification') {
                      if (operation === 'send') {
                          const message = this.getNodeParameter('message', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              message,
                          };
                          Object.assign(body, additionalFields);
                          if (body.hasOwnProperty('notificationDisabled')) {
                              body.notificationDisabled = body.notificationDisabled ? 'true' : 'false';
                          }
                          if (body.stickerUi) {
                              const sticker = body.stickerUi.stickerValue;
                              if (sticker) {
                                  body.stickerId = sticker.stickerId;
                                  body.stickerPackageId = sticker.stickerPackageId;
                              }
                              delete body.stickerUi;
                          }
                          if (body.imageUi) {
                              const image = body.imageUi.imageValue;
                              if (image && image.binaryData === true) {
                                  const binaryProperty = image.binaryProperty;
                                  const binaryData = this.helpers.assertBinaryData(i, binaryProperty);
                                  const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
                                  body.imageFile = {
                                      value: binaryDataBuffer,
                                      options: {
                                          filename: binaryData.fileName,
                                      },
                                  };
                              }
                              else {
                                  body.imageFullsize = image.imageFullsize;
                                  body.imageThumbnail = image.imageThumbnail;
                              }
                              delete body.imageUi;
                          }
                          responseData = await GenericFunctions_1.lineApiRequest.call(this, 'POST', '', {}, {}, 'https://notify-api.line.me/api/notify', { formData: body });
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Line = Line;
  //# sourceMappingURL=Line.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Linear
name: Linear
package_name: n8n-nodes-base
display_name: Linear
description: Consume Linear API
code_hash: 03a0ceb98ba3b2007d39314f83e4819bde871064bef40846749d33477a352ed5
source_location: node_modules/n8n-nodes-base/dist/nodes/Linear/Linear.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Linear = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const IssueDescription_1 = require("./IssueDescription");
  const Queries_1 = require("./Queries");
  class Linear {
      constructor() {
          this.description = {
              displayName: 'Linear',
              name: 'linear',
              icon: 'file:linear.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Linear API',
              defaults: {
                  name: 'Linear',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'linearApi',
                      required: true,
                      testedBy: 'linearApiTest',
                      displayOptions: {
                          show: {
                              authentication: ['apiToken'],
                          },
                      },
                  },
                  {
                      name: 'linearOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'API Token',
                              value: 'apiToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'apiToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                      ],
                      default: 'issue',
                  },
                  ...IssueDescription_1.issueOperations,
                  ...IssueDescription_1.issueFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async linearApiTest(credential) {
                      try {
                          await GenericFunctions_1.validateCredentials.call(this, credential.data);
                      }
                      catch (error) {
                          const { error: err } = error;
                          const errors = err.errors;
                          const authenticationError = Boolean(errors.filter((e) => e.extensions.code === 'AUTHENTICATION_ERROR').length);
                          if (authenticationError) {
                              return {
                                  status: 'Error',
                                  message: 'The security token included in the request is invalid',
                              };
                          }
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
              loadOptions: {
                  async getTeams() {
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getTeams(),
                          variables: {
                              $first: 10,
                          },
                      };
                      const teams = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.teams', body);
                      for (const team of teams) {
                          returnData.push({
                              name: team.name,
                              value: team.id,
                          });
                      }
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getUsers(),
                          variables: {
                              $first: 10,
                          },
                      };
                      const users = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.users', body);
                      for (const user of users) {
                          returnData.push({
                              name: user.name,
                              value: user.id,
                          });
                      }
                      return returnData;
                  },
                  async getStates() {
                      var _a, _b, _c;
                      let teamId = this.getNodeParameter('teamId', null);
                      if (!teamId) {
                          const updateFields = this.getNodeParameter('updateFields', null);
                          if (!updateFields.teamId) {
                              const issueId = this.getNodeParameter('issueId');
                              const body = {
                                  query: Queries_1.query.getIssueTeam(),
                                  variables: {
                                      issueId,
                                  },
                              };
                              const responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                              teamId = (_c = (_b = (_a = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _a === void 0 ? void 0 : _a.issue) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id;
                          }
                          else {
                              teamId = updateFields.teamId;
                          }
                      }
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getStates(),
                          variables: {
                              $first: 10,
                              filter: {
                                  team: {
                                      id: {
                                          eq: teamId,
                                      },
                                  },
                              },
                          },
                      };
                      const states = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.workflowStates', body);
                      for (const state of states) {
                          returnData.push({
                              name: state.name,
                              value: state.id,
                          });
                      }
                      return returnData.sort(GenericFunctions_1.sort);
                  },
              },
          };
      }
      async execute() {
          var _a, _b, _c, _d;
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'issue') {
                      if (operation === 'create') {
                          const teamId = this.getNodeParameter('teamId', i);
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              query: Queries_1.query.createIssue(),
                              variables: {
                                  teamId,
                                  title,
                                  ...additionalFields,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_a = responseData.data.issueCreate) === null || _a === void 0 ? void 0 : _a.issue;
                      }
                      if (operation === 'delete') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const body = {
                              query: Queries_1.query.deleteIssue(),
                              variables: {
                                  issueId,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _b === void 0 ? void 0 : _b.issueDelete;
                      }
                      if (operation === 'get') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const body = {
                              query: Queries_1.query.getIssue(),
                              variables: {
                                  issueId,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = responseData.data.issue;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const body = {
                              query: Queries_1.query.getIssues(),
                              variables: {
                                  first: 50,
                              },
                          };
                          if (returnAll) {
                              responseData = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.issues', body);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', 0);
                              body.variables.first = limit;
                              responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                              responseData = responseData.data.issues.nodes;
                          }
                      }
                      if (operation === 'update') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              query: Queries_1.query.updateIssue(),
                              variables: {
                                  issueId,
                                  ...updateFields,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _c === void 0 ? void 0 : _c.issueUpdate) === null || _d === void 0 ? void 0 : _d.issue;
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Linear = Linear;
  //# sourceMappingURL=Linear.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.LingvaNex
name: LingvaNex
package_name: n8n-nodes-base
display_name: LingvaNex
description: Consume LingvaNex API
code_hash: 29d29315fd6ef3b4f9454e49bfcd822bf94f31464bab1c11b494288d33fce502
source_location: node_modules/n8n-nodes-base/dist/nodes/LingvaNex/LingvaNex.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LingvaNex = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class LingvaNex {
      constructor() {
          this.description = {
              displayName: 'LingvaNex',
              name: 'lingvaNex',
              icon: 'file:lingvanex.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume LingvaNex API',
              defaults: {
                  name: 'LingvaNex',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lingvaNexApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Translate',
                              value: 'translate',
                              description: 'Translate data',
                              action: 'Translate data',
                          },
                      ],
                      default: 'translate',
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      default: '',
                      description: 'The input text to translate',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                  },
                  {
                      displayName: 'Translate To',
                      name: 'translateTo',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLanguages',
                      },
                      default: '',
                      description: 'The language to use for translation of the input text, set to one of the language codes listed in <a href="https://cloud.google.com/translate/docs/languages">Language Support</a>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                      options: [
                          {
                              displayName: 'From',
                              name: 'from',
                              type: 'options',
                              typeOptions: {
                                  loadOptionsMethod: 'getLanguages',
                              },
                              default: '',
                              description: 'The language code in the format “language code_code of the country”. If this parameter is not present, the auto-detect language mode is enabled. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Platform',
                              name: 'platform',
                              type: 'string',
                              default: 'api',
                          },
                          {
                              displayName: 'Translate Mode',
                              name: 'translateMode',
                              type: 'string',
                              default: '',
                              description: 'Describe the input text format. Possible value is "html" for translating and preserving html structure. If value is not specified or is other than "html" than plain text is translating.',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLanguages() {
                      const returnData = [];
                      const data = await GenericFunctions_1.lingvaNexApiRequest.call(this, 'GET', '/getLanguages', {}, { platform: 'api' });
                      for (const language of data.result) {
                          returnData.push({
                              name: language.englishName,
                              value: language.full_code,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const operation = this.getNodeParameter('operation', 0);
          const responseData = [];
          for (let i = 0; i < length; i++) {
              if (operation === 'translate') {
                  const text = this.getNodeParameter('text', i);
                  const translateTo = this.getNodeParameter('translateTo', i);
                  const options = this.getNodeParameter('options', i);
                  const body = {
                      data: text,
                      to: translateTo,
                      platform: 'api',
                  };
                  Object.assign(body, options);
                  const response = await GenericFunctions_1.lingvaNexApiRequest.call(this, 'POST', '/translate', body);
                  responseData.push(response);
              }
          }
          return [this.helpers.returnJsonArray(responseData)];
      }
  }
  exports.LingvaNex = LingvaNex;
  //# sourceMappingURL=LingvaNex.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.LinkedIn
name: LinkedIn
package_name: n8n-nodes-base
display_name: LinkedIn
description: Consume LinkedIn API
code_hash: 1148fe37efdd5c3bbaee912c4f44399c3e83f8a16501e9aaa0ad2ba84214b8ef
source_location: node_modules/n8n-nodes-base/dist/nodes/LinkedIn/LinkedIn.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LinkedIn = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const PostDescription_1 = require("./PostDescription");
  class LinkedIn {
      constructor() {
          this.description = {
              displayName: 'LinkedIn',
              name: 'linkedIn',
              icon: 'file:linkedin.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume LinkedIn API',
              defaults: {
                  name: 'LinkedIn',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'linkedInOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Post',
                              value: 'post',
                          },
                      ],
                      default: 'post',
                  },
                  ...PostDescription_1.postOperations,
                  ...PostDescription_1.postFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getPersonUrn() {
                      const returnData = [];
                      const person = await GenericFunctions_1.linkedInApiRequest.call(this, 'GET', '/me', {});
                      returnData.push({
                          name: `${person.localizedFirstName} ${person.localizedLastName}`,
                          value: person.id,
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let body = {};
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'post') {
                      if (operation === 'create') {
                          const text = this.getNodeParameter('text', i);
                          const shareMediaCategory = this.getNodeParameter('shareMediaCategory', i);
                          const postAs = this.getNodeParameter('postAs', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let authorUrn = '';
                          let visibility = 'PUBLIC';
                          if (postAs === 'person') {
                              const personUrn = this.getNodeParameter('person', i);
                              visibility = additionalFields.visibility || 'PUBLIC';
                              authorUrn = `urn:li:person:${personUrn}`;
                          }
                          else {
                              const organizationUrn = this.getNodeParameter('organization', i);
                              authorUrn = `urn:li:organization:${organizationUrn}`;
                          }
                          let description = '';
                          let title = '';
                          let originalUrl = '';
                          body = {
                              author: authorUrn,
                              lifecycleState: 'PUBLISHED',
                              distribution: {
                                  feedDistribution: 'MAIN_FEED',
                                  thirdPartyDistributionChannels: [],
                              },
                              visibility,
                          };
                          if (shareMediaCategory === 'IMAGE') {
                              if (additionalFields.title) {
                                  title = additionalFields.title;
                              }
                              const registerRequest = {
                                  initializeUploadRequest: {
                                      owner: authorUrn,
                                  },
                              };
                              const registerObject = await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', '/images?action=initializeUpload', registerRequest);
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              this.helpers.assertBinaryData(i, binaryPropertyName);
                              const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              const { uploadUrl, image } = registerObject.value;
                              await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', uploadUrl, buffer, true);
                              const imageBody = {
                                  content: {
                                      media: {
                                          title,
                                          id: image,
                                      },
                                  },
                                  commentary: text,
                              };
                              Object.assign(body, imageBody);
                          }
                          else if (shareMediaCategory === 'ARTICLE') {
                              if (additionalFields.description) {
                                  description = additionalFields.description;
                              }
                              if (additionalFields.title) {
                                  title = additionalFields.title;
                              }
                              if (additionalFields.originalUrl) {
                                  originalUrl = additionalFields.originalUrl;
                              }
                              const articleBody = {
                                  content: {
                                      article: {
                                          title,
                                          description,
                                          source: originalUrl,
                                      },
                                  },
                                  commentary: text,
                              };
                              Object.assign(body, articleBody);
                              if (description === '') {
                                  delete body.description;
                              }
                              if (title === '') {
                                  delete body.title;
                              }
                          }
                          else {
                              Object.assign(body, { commentary: text });
                          }
                          const endpoint = '/posts';
                          responseData = await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', endpoint, body);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.LinkedIn = LinkedIn;
  //# sourceMappingURL=LinkedIn.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.LocalFileTrigger
name: LocalFileTrigger
package_name: n8n-nodes-base
display_name: Local File Trigger
description: Triggers a workflow on file system changes
code_hash: 0b091f165d93567d21a8b943d4cab4e6fd20ccf85e00e1d733456047688a0737
source_location: node_modules/n8n-nodes-base/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LocalFileTrigger = void 0;
  const chokidar_1 = require("chokidar");
  class LocalFileTrigger {
      constructor() {
          this.description = {
              displayName: 'Local File Trigger',
              name: 'localFileTrigger',
              icon: 'fa:folder-open',
              group: ['trigger'],
              version: 1,
              subtitle: '=Path: {{$parameter["path"]}}',
              description: 'Triggers a workflow on file system changes',
              eventTriggerDescription: '',
              defaults: {
                  name: 'Local File Trigger',
                  color: '#404040',
              },
              triggerPanel: {
                  header: '',
                  executionsHelp: {
                      inactive: "<b>While building your workflow</b>, click the 'listen' button, then make a change to your watched file or folder. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                      active: "<b>While building your workflow</b>, click the 'listen' button, then make a change to your watched file or folder. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                  },
                  activationHint: "Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).",
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Trigger On',
                      name: 'triggerOn',
                      type: 'options',
                      options: [
                          {
                              name: 'Changes to a Specific File',
                              value: 'file',
                          },
                          {
                              name: 'Changes Involving a Specific Folder',
                              value: 'folder',
                          },
                      ],
                      required: true,
                      default: '',
                  },
                  {
                      displayName: 'File to Watch',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              triggerOn: ['file'],
                          },
                      },
                      default: '',
                      placeholder: '/data/invoices/1.pdf',
                  },
                  {
                      displayName: 'Folder to Watch',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              triggerOn: ['folder'],
                          },
                      },
                      default: '',
                      placeholder: '/data/invoices',
                  },
                  {
                      displayName: 'Watch for',
                      name: 'events',
                      type: 'multiOptions',
                      displayOptions: {
                          show: {
                              triggerOn: ['folder'],
                          },
                      },
                      options: [
                          {
                              name: 'File Added',
                              value: 'add',
                              description: 'Triggers whenever a new file was added',
                          },
                          {
                              name: 'File Changed',
                              value: 'change',
                              description: 'Triggers whenever a file was changed',
                          },
                          {
                              name: 'File Deleted',
                              value: 'unlink',
                              description: 'Triggers whenever a file was deleted',
                          },
                          {
                              name: 'Folder Added',
                              value: 'addDir',
                              description: 'Triggers whenever a new folder was added',
                          },
                          {
                              name: 'Folder Deleted',
                              value: 'unlinkDir',
                              description: 'Triggers whenever a folder was deleted',
                          },
                      ],
                      required: true,
                      default: [],
                      description: 'The events to listen to',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Include Linked Files/Folders',
                              name: 'followSymlinks',
                              type: 'boolean',
                              default: true,
                              description: 'Whether linked files/folders will also be watched (this includes symlinks, aliases on MacOS and shortcuts on Windows). Otherwise only the links themselves will be monitored).',
                          },
                          {
                              displayName: 'Ignore',
                              name: 'ignored',
                              type: 'string',
                              default: '',
                              placeholder: '**/*.txt',
                              description: 'Files or paths to ignore. The whole path is tested, not just the filename. Supports <a href="https://github.com/micromatch/anymatch">Anymatch</a>- syntax.',
                          },
                          {
                              displayName: 'Max Folder Depth',
                              name: 'depth',
                              type: 'options',
                              options: [
                                  {
                                      name: '1 Levels Down',
                                      value: 1,
                                  },
                                  {
                                      name: '2 Levels Down',
                                      value: 2,
                                  },
                                  {
                                      name: '3 Levels Down',
                                      value: 3,
                                  },
                                  {
                                      name: '4 Levels Down',
                                      value: 4,
                                  },
                                  {
                                      name: '5 Levels Down',
                                      value: 5,
                                  },
                                  {
                                      name: 'Top Folder Only',
                                      value: 0,
                                  },
                                  {
                                      name: 'Unlimited',
                                      value: -1,
                                  },
                              ],
                              default: -1,
                              description: 'How deep into the folder structure to watch for changes',
                          },
                      ],
                  },
              ],
          };
      }
      async trigger() {
          const triggerOn = this.getNodeParameter('triggerOn');
          const path = this.getNodeParameter('path');
          const options = this.getNodeParameter('options', {});
          let events;
          if (triggerOn === 'file') {
              events = ['change'];
          }
          else {
              events = this.getNodeParameter('events', []);
          }
          const watcher = (0, chokidar_1.watch)(path, {
              ignored: options.ignored === '' ? undefined : options.ignored,
              persistent: true,
              ignoreInitial: true,
              followSymlinks: options.followSymlinks === undefined ? true : options.followSymlinks,
              depth: [-1, undefined].includes(options.depth)
                  ? undefined
                  : options.depth,
          });
          const executeTrigger = (event, pathString) => {
              this.emit([this.helpers.returnJsonArray([{ event, path: pathString }])]);
          };
          for (const eventName of events) {
              watcher.on(eventName, (pathString) => executeTrigger(eventName, pathString));
          }
          async function closeFunction() {
              return watcher.close();
          }
          return {
              closeFunction,
          };
      }
  }
  exports.LocalFileTrigger = LocalFileTrigger;
  //# sourceMappingURL=LocalFileTrigger.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.LoneScale
name: LoneScale
package_name: n8n-nodes-base
display_name: LoneScale
description: Create List, add / delete items
code_hash: 87192faf002fbba84590b3c3dd0d367a26378865321adb7fd5cf70349fec00e3
source_location: node_modules/n8n-nodes-base/dist/nodes/LoneScale/LoneScale.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LoneScale = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class LoneScale {
      constructor() {
          this.description = {
              displayName: 'LoneScale',
              name: 'loneScale',
              group: ['transform'],
              icon: 'file:lonescale-logo.svg',
              version: 1,
              description: 'Create List, add / delete items',
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              defaults: {
                  name: 'LoneScale',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'loneScaleApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'List',
                              value: 'list',
                              description: 'Manipulate list',
                          },
                          {
                              name: 'Item',
                              value: 'item',
                              description: 'Manipulate item',
                          },
                      ],
                      default: 'list',
                      noDataExpression: true,
                      required: true,
                      description: 'Create a new list',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['list'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a list',
                              action: 'Create a list',
                          },
                      ],
                      default: 'create',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'add',
                              description: 'Create an item',
                              action: 'Create a item',
                          },
                      ],
                      default: 'add',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Type',
                      name: 'type',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      options: [
                          {
                              name: 'Company',
                              value: 'COMPANY',
                              description: 'List of company',
                          },
                          {
                              name: 'Contact',
                              value: 'PEOPLE',
                              description: 'List of contact',
                          },
                      ],
                      default: 'PEOPLE',
                      description: 'Type of your list',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                          loadOptionsDependsOn: ['type'],
                      },
                      default: '',
                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                      required: true,
                  },
                  {
                      displayName: 'First Name',
                      name: 'first_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      default: '',
                      description: 'Contact first name',
                      required: true,
                  },
                  {
                      displayName: 'Last Name',
                      name: 'last_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      default: '',
                      description: 'Contact last name',
                      required: true,
                  },
                  {
                      displayName: 'Company Name',
                      name: 'company_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['COMPANY'],
                          },
                      },
                      default: '',
                      description: 'Contact company name',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'peopleAdditionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Full Name',
                              name: 'full_name',
                              type: 'string',
                              default: '',
                              description: 'Contact full name',
                          },
                          {
                              displayName: 'Contact Email',
                              name: 'email',
                              type: 'string',
                              placeholder: 'name@email.com',
                              default: '',
                          },
                          {
                              displayName: 'Company Name',
                              name: 'company_name',
                              type: 'string',
                              default: '',
                              description: 'Contact company name',
                          },
                          {
                              displayName: 'Current Position',
                              name: 'current_position',
                              type: 'string',
                              default: '',
                              description: 'Contact current position',
                          },
                          {
                              displayName: 'Company Domain',
                              name: 'domain',
                              type: 'string',
                              default: '',
                              description: 'Contact company domain',
                          },
                          {
                              displayName: 'Linkedin Url',
                              name: 'linkedin_url',
                              type: 'string',
                              default: '',
                              description: 'Contact Linkedin URL',
                          },
                          {
                              displayName: 'Contact Location',
                              name: 'location',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Contact ID',
                              name: 'contact_id',
                              type: 'string',
                              default: '',
                              description: 'Contact ID from your source',
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'companyAdditionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['COMPANY'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Linkedin Url',
                              name: 'linkedin_url',
                              type: 'string',
                              default: '',
                              description: 'Company Linkedin URL',
                          },
                          {
                              displayName: 'Company Domain',
                              name: 'domain',
                              type: 'string',
                              default: '',
                              description: 'Company company domain',
                          },
                          {
                              displayName: 'Contact Location',
                              name: 'location',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Contact ID',
                              name: 'contact_id',
                              type: 'string',
                              default: '',
                              description: 'Contact ID from your source',
                          },
                      ],
                  },
                  {
                      displayName: 'Name',
                      name: 'name',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['list'],
                          },
                      },
                      default: '',
                      placeholder: 'list name',
                      description: 'Name of your list',
                  },
                  {
                      displayName: 'Type',
                      name: 'type',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['list'],
                          },
                      },
                      options: [
                          {
                              name: 'Company',
                              value: 'COMPANY',
                              description: 'Create a list of companies',
                              action: 'Create a list of companies',
                          },
                          {
                              name: 'Contact',
                              value: 'PEOPLE',
                              description: 'Create a list of contacts',
                              action: 'Create a list of contacts',
                          },
                      ],
                      default: 'COMPANY',
                      description: 'Type of your list',
                      noDataExpression: true,
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      var _a;
                      const type = this.getNodeParameter('type');
                      const data = await GenericFunctions_1.lonescaleApiRequest.call(this, 'GET', '/lists', {}, { entity: type });
                      return (_a = data === null || data === void 0 ? void 0 : data.list) === null || _a === void 0 ? void 0 : _a.filter((l) => l.entity === type).map((d) => ({
                          name: d.name,
                          value: d.id,
                      }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          let responseData;
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'list') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const entity = this.getNodeParameter('type', i);
                          const body = {
                              name,
                              entity,
                          };
                          responseData = await GenericFunctions_1.lonescaleApiRequest.call(this, 'POST', '/lists', body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'item') {
                      if (operation === 'add') {
                          let firstName = '';
                          let lastName = '';
                          let currentPosition = '';
                          let fullName = '';
                          let email = '';
                          let linkedinUrl = '';
                          let companyName = '';
                          let domain = '';
                          let location = '';
                          let contactId = '';
                          const entity = this.getNodeParameter('type', i);
                          const listId = this.getNodeParameter('list', i);
                          if (entity === 'PEOPLE') {
                              const peopleAdditionalFields = this.getNodeParameter('peopleAdditionalFields', i);
                              firstName = this.getNodeParameter('first_name', i);
                              lastName = this.getNodeParameter('last_name', i);
                              fullName = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.full_name;
                              currentPosition = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.current_position;
                              email = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.email;
                              linkedinUrl = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.linkedin_url;
                              companyName = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.company_name;
                              domain = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.domain;
                              location = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.location;
                              contactId = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.contact_id;
                          }
                          if (entity === 'COMPANY') {
                              const companyAdditionalFields = this.getNodeParameter('companyAdditionalFields', i);
                              companyName = this.getNodeParameter('company_name', i);
                              linkedinUrl = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.linkedin_url;
                              domain = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.domain;
                              location = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.location;
                              contactId = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.contact_id;
                          }
                          const body = {
                              ...(firstName && { first_name: firstName }),
                              ...(lastName && { last_name: lastName }),
                              ...(fullName && { full_name: fullName }),
                              ...(linkedinUrl && { linkedin_url: linkedinUrl }),
                              ...(companyName && { company_name: companyName }),
                              ...(currentPosition && { current_position: currentPosition }),
                              ...(domain && { domain }),
                              ...(location && { location }),
                              ...(email && { email }),
                              ...(contactId && { contact_id: contactId }),
                          };
                          responseData = await GenericFunctions_1.lonescaleApiRequest.call(this, 'POST', `/lists/${listId}/item`, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.LoneScale = LoneScale;
  //# sourceMappingURL=LoneScale.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Mailcheck
name: Mailcheck
package_name: n8n-nodes-base
display_name: Mailcheck
description: Consume Mailcheck API
code_hash: fafaa5f9e5c5d8581945d83f9a43dc10f497291843cc011649f4f65d84a2fcdc
source_location: node_modules/n8n-nodes-base/dist/nodes/Mailcheck/Mailcheck.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Mailcheck = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Mailcheck {
      constructor() {
          this.description = {
              displayName: 'Mailcheck',
              name: 'mailcheck',
              icon: 'file:mailcheck.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mailcheck API',
              defaults: {
                  name: 'Mailcheck',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailcheckApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Email',
                              value: 'email',
                          },
                      ],
                      default: 'email',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['email'],
                          },
                      },
                      options: [
                          {
                              name: 'Check',
                              value: 'check',
                              action: 'Check an email',
                          },
                      ],
                      default: 'check',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['email'],
                              operation: ['check'],
                          },
                      },
                      default: '',
                      description: 'Email address to check',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'email') {
                      if (operation === 'check') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.mailCheckApiRequest.call(this, 'POST', '/singleEmail:check', {
                              email,
                          });
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
              if (Array.isArray(responseData)) {
                  returnData.push.apply(returnData, responseData);
              }
              else {
                  returnData.push(responseData);
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Mailcheck = Mailcheck;
  //# sourceMappingURL=Mailcheck.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Mailchimp
name: Mailchimp
package_name: n8n-nodes-base
display_name: Mailchimp
description: Consume Mailchimp API
code_hash: f2caad087950dacb0627fb1424523c92a542b7bedb79535d47eb21809f69f722
source_location: node_modules/n8n-nodes-base/dist/nodes/Mailchimp/Mailchimp.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Mailchimp = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_1 = __importDefault(require("moment"));
  var Status;
  (function (Status) {
      Status["subscribe"] = "subscribe";
      Status["unsubscribed"] = "unsubscribe";
      Status["cleaned"] = "cleaned";
      Status["pending"] = "pending";
      Status["transactional"] = "transactional";
  })(Status || (Status = {}));
  class Mailchimp {
      constructor() {
          this.description = {
              displayName: 'Mailchimp',
              name: 'mailchimp',
              icon: 'file:mailchimp.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mailchimp API',
              defaults: {
                  name: 'Mailchimp',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailchimpApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['apiKey'],
                          },
                      },
                  },
                  {
                      name: 'mailchimpOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'API Key',
                              value: 'apiKey',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'apiKey',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'List Group',
                              value: 'listGroup',
                          },
                          {
                              name: 'Member',
                              value: 'member',
                          },
                          {
                              name: 'Member Tag',
                              value: 'memberTag',
                          },
                      ],
                      default: 'member',
                      required: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new member on list',
                              action: 'Create a member',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a member on list',
                              action: 'Delete a member',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a member on list',
                              action: 'Get a member',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many members on a list',
                              action: 'Get many members',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a new member on list',
                              action: 'Update a member',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Add tags from a list member',
                              action: 'Create a member tag',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Remove tags from a list member',
                              action: 'Delete a member tag',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many groups',
                              action: 'Get many list groups',
                          },
                      ],
                      default: 'getAll',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                          },
                      },
                      options: [
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a campaign',
                              action: 'Delete a campaign',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a campaign',
                              action: 'Get a campaign',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many campaigns',
                              action: 'Get many campaigns',
                          },
                          {
                              name: 'Replicate',
                              value: 'replicate',
                              description: 'Replicate a campaign',
                              action: 'Replicate a campaign',
                          },
                          {
                              name: 'Resend',
                              value: 'resend',
                              description: 'Creates a Resend to Non-Openers version of this campaign',
                              action: 'Resend a campaign',
                          },
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send a campaign',
                              action: 'Send a campaign',
                          },
                      ],
                      default: 'getAll',
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      description: 'Email address for a subscriber',
                  },
                  {
                      displayName: 'Status',
                      name: 'status',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Cleaned',
                              value: 'cleaned',
                          },
                          {
                              name: 'Pending',
                              value: 'pending',
                          },
                          {
                              name: 'Subscribed',
                              value: 'subscribed',
                          },
                          {
                              name: 'Transactional',
                              value: 'transactional',
                          },
                          {
                              name: 'Unsubscribed',
                              value: 'unsubscribed',
                          },
                      ],
                      default: '',
                      description: "Subscriber's current status",
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Language',
                              name: 'language',
                              type: 'string',
                              default: '',
                              description: "If set/detected, the subscriber's language",
                          },
                          {
                              displayName: 'Opt-in IP',
                              name: 'ipOptIn',
                              type: 'string',
                              default: '',
                              description: 'The IP address the subscriber used to confirm their opt-in status',
                          },
                          {
                              displayName: 'Signup IP',
                              name: 'ipSignup',
                              type: 'string',
                              default: '',
                              description: 'IP address the subscriber signed up from',
                          },
                          {
                              displayName: 'Signup Timestamp',
                              name: 'timestampSignup',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscriber signed up for the list in ISO 8601 format',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'string',
                              default: '',
                              description: 'The tags that are associated with a member separeted by ,',
                          },
                          {
                              displayName: 'Vip',
                              name: 'vip',
                              type: 'boolean',
                              default: false,
                              description: 'Vip status for subscribers',
                          },
                          {
                              displayName: 'Opt-in Timestamp',
                              name: 'timestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscribe confirmed their opt-in status in ISO 8601 format',
                          },
                      ],
                  },
                  {
                      displayName: 'Location',
                      name: 'locationFieldsUi',
                      type: 'fixedCollection',
                      placeholder: 'Add Location',
                      default: {},
                      description: 'Subscriber location information.n',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'locationFieldsValues',
                              displayName: 'Location',
                              values: [
                                  {
                                      displayName: 'Latitude',
                                      name: 'latitude',
                                      type: 'string',
                                      required: true,
                                      description: 'The location latitude',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Longitude',
                                      name: 'longitude',
                                      type: 'string',
                                      required: true,
                                      description: 'The location longitude',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsUi',
                      placeholder: 'Add Merge Fields',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      description: 'An individual merge var and value for a member',
                      options: [
                          {
                              name: 'mergeFieldsValues',
                              displayName: 'Field',
                              typeOptions: {
                                  multipleValueButtonText: 'Add Field',
                              },
                              values: [
                                  {
                                      displayName: 'Field Name or ID',
                                      name: 'name',
                                      type: 'options',
                                      typeOptions: {
                                          loadOptionsMethod: 'getMergeFields',
                                          loadOptionsDependsOn: ['list'],
                                      },
                                      required: true,
                                      description: 'Merge Field name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Field Value',
                                      name: 'value',
                                      required: true,
                                      type: 'string',
                                      default: '',
                                      description: 'Merge field value',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Location',
                      name: 'locationJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupsUi',
                      placeholder: 'Add Interest Group',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'groupsValues',
                              displayName: 'Group',
                              typeOptions: {
                                  multipleValueButtonText: 'Add Interest Group',
                              },
                              values: [
                                  {
                                      displayName: 'Category Name or ID',
                                      name: 'categoryId',
                                      type: 'options',
                                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                      typeOptions: {
                                          loadOptionsMethod: 'getGroupCategories',
                                          loadOptionsDependsOn: ['list'],
                                      },
                                      default: '',
                                  },
                                  {
                                      displayName: 'Category Field ID',
                                      name: 'categoryFieldId',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'boolean',
                                      default: false,
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "Member's email",
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "Member's email",
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Fields',
                              name: 'fields',
                              type: 'string',
                              default: '',
                              description: 'A comma-separated list of fields to return',
                          },
                          {
                              displayName: 'Exclude Fields',
                              name: 'excludeFields',
                              type: 'string',
                              default: '',
                              description: 'A comma-separated list of fields to exclude',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 500,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Before Last Changed',
                              name: 'beforeLastChanged',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers whose information changed before the set timeframe',
                          },
                          {
                              displayName: 'Before Timestamp Opt',
                              name: 'beforeTimestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers who opted-in before the set timeframe',
                          },
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Cleaned',
                                      value: 'cleaned',
                                  },
                                  {
                                      name: 'Pending',
                                      value: 'pending',
                                  },
                                  {
                                      name: 'Subscribed',
                                      value: 'subscribed',
                                  },
                                  {
                                      name: 'Transactional',
                                      value: 'transactional',
                                  },
                                  {
                                      name: 'Unsubscribed',
                                      value: 'unsubscribed',
                                  },
                              ],
                              default: '',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Since Last Changed',
                              name: 'sinceLastChanged',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers whose information changed after the set timeframe',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                      description: 'Email address of the subscriber',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                  },
                  {
                      displayName: 'Update Fields',
                      name: 'updateFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Interest Groups',
                              name: 'groupsUi',
                              placeholder: 'Add Interest Group',
                              type: 'fixedCollection',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              options: [
                                  {
                                      name: 'groupsValues',
                                      displayName: 'Group',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Interest Group',
                                      },
                                      values: [
                                          {
                                              displayName: 'Category Name or ID',
                                              name: 'categoryId',
                                              type: 'options',
                                              description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                              typeOptions: {
                                                  loadOptionsMethod: 'getGroupCategories',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              default: '',
                                          },
                                          {
                                              displayName: 'Category Field ID',
                                              name: 'categoryFieldId',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'boolean',
                                              default: false,
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Language',
                              name: 'language',
                              type: 'string',
                              default: '',
                              description: "If set/detected, the subscriber's language",
                          },
                          {
                              displayName: 'Merge Fields',
                              name: 'mergeFieldsUi',
                              placeholder: 'Add Merge Fields',
                              type: 'fixedCollection',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              description: 'An individual merge var and value for a member',
                              options: [
                                  {
                                      name: 'mergeFieldsValues',
                                      displayName: 'Field',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Field',
                                      },
                                      values: [
                                          {
                                              displayName: 'Field Name or ID',
                                              name: 'name',
                                              type: 'options',
                                              typeOptions: {
                                                  loadOptionsMethod: 'getMergeFields',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              required: true,
                                              description: 'Merge Field name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Field Value',
                                              name: 'value',
                                              required: true,
                                              type: 'string',
                                              default: '',
                                              description: 'Merge field value',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Opt-in IP',
                              name: 'ipOptIn',
                              type: 'string',
                              default: '',
                              description: 'The IP address the subscriber used to confirm their opt-in status',
                          },
                          {
                              displayName: 'Signup IP',
                              name: 'ipSignup',
                              type: 'string',
                              default: '',
                              description: 'IP address the subscriber signed up from',
                          },
                          {
                              displayName: 'Signup Timestamp',
                              name: 'timestampSignup',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscriber signed up for the list in ISO 8601 format',
                          },
                          {
                              displayName: 'Skip Merge Validation',
                              name: 'skipMergeValidation',
                              type: 'boolean',
                              default: false,
                              description: 'Whether member data will be accepted without merge field values, even if the merge field is usually required',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Cleaned',
                                      value: 'cleaned',
                                  },
                                  {
                                      name: 'Pending',
                                      value: 'pending',
                                  },
                                  {
                                      name: 'Subscribed',
                                      value: 'subscribed',
                                  },
                                  {
                                      name: 'Transactional',
                                      value: 'transactional',
                                  },
                                  {
                                      name: 'Unsubscribed',
                                      value: 'unsubscribed',
                                  },
                              ],
                              default: '',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Vip',
                              name: 'vip',
                              type: 'boolean',
                              default: false,
                              description: 'Vip status for subscribers',
                          },
                          {
                              displayName: 'Location',
                              name: 'locationFieldsUi',
                              type: 'fixedCollection',
                              placeholder: 'Add Location',
                              default: {},
                              description: 'Subscriber location information.n',
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              options: [
                                  {
                                      name: 'locationFieldsValues',
                                      displayName: 'Location',
                                      values: [
                                          {
                                              displayName: 'Latitude',
                                              name: 'latitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location latitude',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Longitude',
                                              name: 'longitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location longitude',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Opt-in Timestamp',
                              name: 'timestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscribe confirmed their opt-in status in ISO 8601 format',
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Location',
                      name: 'locationJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: '',
                      description: 'Email address of the subscriber',
                  },
                  {
                      displayName: 'Tags',
                      name: 'tags',
                      type: 'string',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Tag',
                      },
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: [],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Is Syncing',
                              name: 'isSyncing',
                              type: 'boolean',
                              default: false,
                              description: 'Whether automations based on the tags in the request will not fire',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Group Category Name or ID',
                      name: 'groupCategory',
                      type: 'options',
                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                      typeOptions: {
                          loadOptionsMethod: 'getGroupCategories',
                          loadOptionsDependsOn: ['list'],
                      },
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 500,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 10,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Before Create Time',
                              name: 'beforeCreateTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns created before the set time',
                          },
                          {
                              displayName: 'Before Send Time',
                              name: 'beforeSendTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns sent before the set time',
                          },
                          {
                              displayName: 'Exclude Field Names or IDs',
                              name: 'excludeFields',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getCampaignsFields',
                              },
                              default: [],
                              description: 'A comma-separated list of fields to exclude. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Field Names or IDs',
                              name: 'fields',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getCampaignsFields',
                              },
                              default: [
                                  'campaigns.id',
                                  'campaigns.status',
                                  'campaigns.tracking',
                                  'campaigns.settings.from_name',
                                  'campaigns.settings.reply_to',
                                  'campaigns.settings.title',
                              ],
                              description: 'A comma-separated list of fields to return. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'List Name or ID',
                              name: 'listId',
                              type: 'options',
                              typeOptions: {
                                  loadOptionsMethod: 'getLists',
                              },
                              default: '',
                              description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Since Create Time',
                              name: 'sinceCreateTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns created after the set time',
                          },
                          {
                              displayName: 'Since Send Time',
                              name: 'sinceSendTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns sent after the set time',
                          },
                          {
                              displayName: 'Sort Direction',
                              name: 'sortDirection',
                              type: 'options',
                              options: [
                                  {
                                      name: 'ASC',
                                      value: 'ASC',
                                  },
                                  {
                                      name: 'DESC',
                                      value: 'DESC',
                                  },
                              ],
                              default: '',
                              description: 'Determines the order direction for sorted results',
                          },
                          {
                              displayName: 'Sort Field',
                              name: 'sortField',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Create Time',
                                      value: 'create_time',
                                  },
                                  {
                                      name: 'Send Time',
                                      value: 'send_time',
                                  },
                              ],
                              default: '',
                              description: 'Returns files sorted by the specified field',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Save',
                                      value: 'save',
                                  },
                                  {
                                      name: 'Sending',
                                      value: 'sending',
                                  },
                                  {
                                      name: 'Sent',
                                      value: 'sent',
                                  },
                                  {
                                      name: 'Schedule',
                                      value: 'schedule',
                                  },
                              ],
                              default: '',
                              description: 'The status of the campaign',
                          },
                      ],
                  },
                  {
                      displayName: 'Campaign ID',
                      name: 'campaignId',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['send', 'get', 'delete', 'replicate', 'resend'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'List of Campaigns',
                      options: [],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      const returnData = [];
                      const lists = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/lists', 'GET', 'lists');
                      for (const list of lists) {
                          const listName = list.name;
                          const listId = list.id;
                          returnData.push({
                              name: listName,
                              value: listId,
                          });
                      }
                      return returnData;
                  },
                  async getMergeFields() {
                      const returnData = [];
                      const listId = this.getCurrentNodeParameter('list');
                      const { merge_fields } = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/merge-fields`, 'GET');
                      for (const mergeField of merge_fields) {
                          const mergeFieldName = mergeField.name;
                          const mergeFieldId = mergeField.tag;
                          returnData.push({
                              name: mergeFieldName,
                              value: mergeFieldId,
                          });
                      }
                      return returnData;
                  },
                  async getGroupCategories() {
                      const returnData = [];
                      const listId = this.getCurrentNodeParameter('list');
                      const { categories } = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/interest-categories`, 'GET');
                      for (const category of categories) {
                          const categoryName = category.title;
                          const categoryId = category.id;
                          returnData.push({
                              name: categoryName,
                              value: categoryId,
                          });
                      }
                      return returnData;
                  },
                  async getCampaigns() {
                      const returnData = [];
                      const campaigns = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/campaigns', 'GET', 'campaigns');
                      for (const campaign of campaigns) {
                          const campaignName = campaign.settings.title;
                          const campaignId = campaign.id;
                          returnData.push({
                              name: campaignName,
                              value: campaignId,
                          });
                      }
                      return returnData;
                  },
                  async getCampaignsFields() {
                      const returnData = [];
                      for (const campaignFields of GenericFunctions_1.campaignFieldsMetadata) {
                          returnData.push({
                              name: campaignFields,
                              value: campaignFields,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'listGroup') {
                      if (operation === 'getAll') {
                          const listId = this.getNodeParameter('list', i);
                          const categoryId = this.getNodeParameter('groupCategory', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, `/lists/${listId}/interest-categories/${categoryId}/interests`, 'GET', 'interests', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/interest-categories/${categoryId}/interests`, 'GET', {}, qs);
                              responseData = responseData.interests;
                          }
                      }
                  }
                  if (resource === 'member') {
                      if (operation === 'create') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const status = this.getNodeParameter('status', i);
                          const options = this.getNodeParameter('options', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              listId,
                              email_address: email,
                              status,
                          };
                          if (options.emailType) {
                              body.email_type = options.emailType;
                          }
                          if (options.language) {
                              body.language = options.language;
                          }
                          if (options.vip) {
                              body.vip = options.vip;
                          }
                          if (options.ipSignup) {
                              body.ip_signup = options.ipSignup;
                          }
                          if (options.ipOptIn) {
                              body.ip_opt = options.ipOptIn;
                          }
                          if (options.timestampOpt) {
                              body.timestamp_opt = (0, moment_1.default)(options.timestampOpt).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (options.timestampSignup) {
                              body.timestamp_signup = (0, moment_1.default)(options.timestampSignup).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (options.tags) {
                              body.tags = options.tags.split(',');
                          }
                          if (!jsonActive) {
                              const locationValues = this.getNodeParameter('locationFieldsUi', i)
                                  .locationFieldsValues;
                              if (locationValues) {
                                  const location = {};
                                  for (const key of Object.keys(locationValues)) {
                                      if (key === 'latitude') {
                                          location.latitude = parseFloat(locationValues[key]);
                                      }
                                      else if (key === 'longitude') {
                                          location.longitude = parseFloat(locationValues[key]);
                                      }
                                  }
                                  body.location = location;
                              }
                              const mergeFieldsValues = this.getNodeParameter('mergeFieldsUi', i)
                                  .mergeFieldsValues;
                              if (mergeFieldsValues) {
                                  const mergeFields = {};
                                  for (let index = 0; index < mergeFieldsValues.length; index++) {
                                      mergeFields[mergeFieldsValues[index].name] = mergeFieldsValues[index].value;
                                  }
                                  body.merge_fields = mergeFields;
                              }
                              const groupsValues = this.getNodeParameter('groupsUi', i)
                                  .groupsValues;
                              if (groupsValues) {
                                  const groups = {};
                                  for (let index = 0; index < groupsValues.length; index++) {
                                      groups[groupsValues[index].categoryFieldId] = groupsValues[index].value;
                                  }
                                  body.interests = groups;
                              }
                          }
                          else {
                              const locationJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('locationJson', i));
                              const mergeFieldsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('mergeFieldsJson', i));
                              const groupJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('groupJson', i));
                              if (locationJson) {
                                  body.location = locationJson;
                              }
                              if (mergeFieldsJson) {
                                  body.merge_fields = mergeFieldsJson;
                              }
                              if (groupJson) {
                                  body.interests = groupJson;
                              }
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members`, 'POST', body);
                      }
                      if (operation === 'delete') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/actions/delete-permanent`, 'POST');
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          if (options.excludeFields) {
                              qs.exclude_fields = options.excludeFields;
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}`, 'GET', {}, qs);
                      }
                      if (operation === 'getAll') {
                          const listId = this.getNodeParameter('list', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.beforeLastChanged) {
                              qs.before_last_changed = options.beforeLastChanged;
                          }
                          if (options.beforeTimestampOpt) {
                              qs.before_timestamp_opt = options.beforeTimestampOpt;
                          }
                          if (options.emailType) {
                              qs.email_type = options.emailType;
                          }
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.sinceLastChanged) {
                              qs.since_last_changed = options.sinceLastChanged;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, `/lists/${listId}/members`, 'GET', 'members', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members`, 'GET', {}, qs);
                              responseData = responseData.members;
                          }
                      }
                      if (operation === 'update') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              listId,
                              email_address: email,
                          };
                          if (updateFields.skipMergeValidation) {
                              qs.skip_merge_validation = updateFields.skipMergeValidation;
                          }
                          if (updateFields.status) {
                              body.status = updateFields.status;
                          }
                          if (updateFields.emailType) {
                              body.email_type = updateFields.emailType;
                          }
                          if (updateFields.language) {
                              body.language = updateFields.language;
                          }
                          if (updateFields.vip) {
                              body.vip = updateFields.vip;
                          }
                          if (updateFields.ipSignup) {
                              body.ip_signup = updateFields.ipSignup;
                          }
                          if (updateFields.ipOptIn) {
                              body.ip_opt = updateFields.ipOptIn;
                          }
                          if (updateFields.timestampOpt) {
                              body.timestamp_opt = (0, moment_1.default)(updateFields.timestampOpt).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (updateFields.timestampSignup) {
                              body.timestamp_signup = (0, moment_1.default)(updateFields.timestampSignup).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (!jsonActive) {
                              if (updateFields.locationFieldsUi) {
                                  const locationValues = updateFields.locationFieldsUi
                                      .locationFieldsValues;
                                  if (locationValues) {
                                      const location = {};
                                      for (const key of Object.keys(locationValues)) {
                                          if (key === 'latitude') {
                                              location.latitude = parseFloat(locationValues[key]);
                                          }
                                          else if (key === 'longitude') {
                                              location.longitude = parseFloat(locationValues[key]);
                                          }
                                      }
                                      body.location = location;
                                  }
                              }
                              if (updateFields.mergeFieldsUi) {
                                  const mergeFieldsValues = updateFields.mergeFieldsUi
                                      .mergeFieldsValues;
                                  if (mergeFieldsValues) {
                                      const mergeFields = {};
                                      for (let index = 0; index < mergeFieldsValues.length; index++) {
                                          mergeFields[mergeFieldsValues[index].name] = mergeFieldsValues[index].value;
                                      }
                                      body.merge_fields = mergeFields;
                                  }
                              }
                              if (updateFields.groupsUi) {
                                  const groupsValues = updateFields.groupsUi
                                      .groupsValues;
                                  if (groupsValues) {
                                      const groups = {};
                                      for (let index = 0; index < groupsValues.length; index++) {
                                          groups[groupsValues[index].categoryFieldId] = groupsValues[index].value;
                                      }
                                      body.interests = groups;
                                  }
                              }
                          }
                          else {
                              const locationJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('locationJson', i));
                              const mergeFieldsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('mergeFieldsJson', i));
                              const groupJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('groupJson', i));
                              if (locationJson) {
                                  body.location = locationJson;
                              }
                              if (mergeFieldsJson) {
                                  body.merge_fields = mergeFieldsJson;
                              }
                              if (groupJson) {
                                  body.interests = groupJson;
                              }
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}`, 'PUT', body);
                      }
                  }
                  if (resource === 'memberTag') {
                      if (operation === 'create') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const tags = this.getNodeParameter('tags', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              tags: [],
                          };
                          if (options.isSyncing) {
                              body.is_syncing = options.isSyncing;
                          }
                          for (const tag of tags) {
                              body.tags.push({
                                  name: tag,
                                  status: 'active',
                              });
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/tags`, 'POST', body);
                          responseData = { success: true };
                      }
                      if (operation === 'delete') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const tags = this.getNodeParameter('tags', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              tags: [],
                          };
                          if (options.isSyncing) {
                              body.is_syncing = options.isSyncing;
                          }
                          for (const tag of tags) {
                              body.tags.push({
                                  name: tag,
                                  status: 'inactive',
                              });
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/tags`, 'POST', body);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'campaign') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.beforeCreateTime) {
                              qs.before_create_time = options.beforeCreateTime;
                          }
                          if (options.beforeSendTime) {
                              qs.before_send_time = options.beforeSendTime;
                          }
                          if (options.excludeFields) {
                              qs.exclude_fields = options.exclude_fields.join(',');
                          }
                          if (options.fields) {
                              qs.fields = options.fields.join(',');
                              if (options.fields.includes('*')) {
                                  qs.fields = GenericFunctions_1.campaignFieldsMetadata.join(',');
                              }
                          }
                          else {
                              qs.fields = [
                                  'campaigns.id',
                                  'campaigns.status',
                                  'campaigns.tracking',
                                  'campaigns.settings.from_name',
                                  'campaigns.settings.title',
                                  'campaigns.settings.reply_to',
                              ].join(',');
                          }
                          if (options.listId) {
                              qs.list_id = options.listId;
                          }
                          if (options.sinceCreateTime) {
                              qs.since_create_time = options.sinceCreateTime;
                          }
                          if (options.sinceSendTime) {
                              qs.since_send_time = options.sinceSendTime;
                          }
                          if (options.sortDirection) {
                              qs.sort_dir = options.sortDirection;
                          }
                          if (options.sortField) {
                              qs.sort_field = options.sortField;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/campaigns', 'GET', 'campaigns', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, '/campaigns', 'GET', {}, qs);
                              responseData = responseData.campaigns;
                          }
                      }
                      if (operation === 'send') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/send`, 'POST', {});
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'GET', {});
                      }
                      if (operation === 'delete') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'DELETE', {});
                          responseData = { success: true };
                      }
                      if (operation === 'replicate') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/replicate`, 'POST', {});
                      }
                      if (operation === 'resend') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/create-resend`, 'POST', {});
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ json: { error: error.message } });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Mailchimp = Mailchimp;
  //# sourceMappingURL=Mailchimp.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.MailerLite
name: MailerLite
package_name: n8n-nodes-base
display_name: MailerLite
description: Consume Mailer Lite API
code_hash: 0af5a52cc8e0d27ceca5f43ceaaa2ad33788a2b44bba34875a96dc54014452fb
source_location: node_modules/n8n-nodes-base/dist/nodes/MailerLite/MailerLite.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.MailerLite = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const SubscriberDescription_1 = require("./SubscriberDescription");
  class MailerLite {
      constructor() {
          this.description = {
              displayName: 'MailerLite',
              name: 'mailerLite',
              icon: 'file:mailerLite.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mailer Lite API',
              defaults: {
                  name: 'MailerLite',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailerLiteApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Subscriber',
                              value: 'subscriber',
                          },
                      ],
                      default: 'subscriber',
                  },
                  ...SubscriberDescription_1.subscriberOperations,
                  ...SubscriberDescription_1.subscriberFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCustomFields() {
                      const returnData = [];
                      const fields = await GenericFunctions_1.mailerliteApiRequest.call(this, 'GET', '/fields');
                      for (const field of fields) {
                          returnData.push({
                              name: field.key,
                              value: field.key,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'subscriber') {
                      if (operation === 'create') {
                          const email = this.getNodeParameter('email', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              email,
                              fields: [],
                          };
                          Object.assign(body, additionalFields);
                          if (additionalFields.customFieldsUi) {
                              const customFieldsValues = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFieldsValues) {
                                  const fields = {};
                                  for (const customFieldValue of customFieldsValues) {
                                      fields[customFieldValue.fieldId] = customFieldValue.value;
                                  }
                                  body.fields = fields;
                                  delete body.customFieldsUi;
                              }
                          }
                          responseData = await GenericFunctions_1.mailerliteApiRequest.call(this, 'POST', '/subscribers', body);
                      }
                      if (operation === 'get') {
                          const subscriberId = this.getNodeParameter('subscriberId', i);
                          responseData = await GenericFunctions_1.mailerliteApiRequest.call(this, 'GET', `/subscribers/${subscriberId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          Object.assign(qs, filters);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailerliteApiRequestAllItems.call(this, 'GET', '/subscribers', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailerliteApiRequest.call(this, 'GET', '/subscribers', {}, qs);
                          }
                      }
                      if (operation === 'update') {
                          const subscriberId = this.getNodeParameter('subscriberId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          Object.assign(body, updateFields);
                          if (updateFields.customFieldsUi) {
                              const customFieldsValues = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFieldsValues) {
                                  const fields = {};
                                  for (const customFieldValue of customFieldsValues) {
                                      fields[customFieldValue.fieldId] = customFieldValue.value;
                                  }
                                  body.fields = fields;
                                  delete body.customFieldsUi;
                              }
                          }
                          responseData = await GenericFunctions_1.mailerliteApiRequest.call(this, 'PUT', `/subscribers/${subscriberId}`, body);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.MailerLite = MailerLite;
  //# sourceMappingURL=MailerLite.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Mailgun
name: Mailgun
package_name: n8n-nodes-base
display_name: Mailgun
description: Sends an email via Mailgun
code_hash: c3138d05def2613a2fc1ee670a81307bc48fc7a70ed95b0077f03a6ebd69f044
source_location: node_modules/n8n-nodes-base/dist/nodes/Mailgun/Mailgun.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Mailgun = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class Mailgun {
      constructor() {
          this.description = {
              displayName: 'Mailgun',
              name: 'mailgun',
              icon: 'file:mailgun.svg',
              group: ['output'],
              version: 1,
              description: 'Sends an email via Mailgun',
              defaults: {
                  name: 'Mailgun',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailgunApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'From Email',
                      name: 'fromEmail',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: 'Admin <admin@example.com>',
                      description: 'Email address of the sender optional with name',
                  },
                  {
                      displayName: 'To Email',
                      name: 'toEmail',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: 'info@example.com',
                      description: 'Email address of the recipient. Multiple ones can be separated by comma.',
                  },
                  {
                      displayName: 'Cc Email',
                      name: 'ccEmail',
                      type: 'string',
                      default: '',
                      placeholder: '',
                      description: 'Cc Email address of the recipient. Multiple ones can be separated by comma.',
                  },
                  {
                      displayName: 'Bcc Email',
                      name: 'bccEmail',
                      type: 'string',
                      default: '',
                      placeholder: '',
                      description: 'Bcc Email address of the recipient. Multiple ones can be separated by comma.',
                  },
                  {
                      displayName: 'Subject',
                      name: 'subject',
                      type: 'string',
                      default: '',
                      placeholder: 'My subject line',
                      description: 'Subject line of the email',
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                      },
                      default: '',
                      description: 'Plain text message of email',
                  },
                  {
                      displayName: 'HTML',
                      name: 'html',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                          editor: 'htmlEditor',
                      },
                      default: '',
                      description: 'HTML text message of email',
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachments',
                      type: 'string',
                      default: '',
                      description: 'Name of the binary properties which contain data which should be added to email as attachment. Multiple ones can be comma-separated.',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let item;
          for (let itemIndex = 0; itemIndex < length; itemIndex++) {
              try {
                  item = items[itemIndex];
                  const fromEmail = this.getNodeParameter('fromEmail', itemIndex);
                  const toEmail = this.getNodeParameter('toEmail', itemIndex);
                  const ccEmail = this.getNodeParameter('ccEmail', itemIndex);
                  const bccEmail = this.getNodeParameter('bccEmail', itemIndex);
                  const subject = this.getNodeParameter('subject', itemIndex);
                  const text = this.getNodeParameter('text', itemIndex);
                  const html = this.getNodeParameter('html', itemIndex);
                  const attachmentPropertyString = this.getNodeParameter('attachments', itemIndex);
                  const credentials = await this.getCredentials('mailgunApi');
                  const formData = {
                      from: fromEmail,
                      to: toEmail,
                      subject,
                      text,
                      html,
                  };
                  if (ccEmail.length !== 0) {
                      formData.cc = ccEmail;
                  }
                  if (bccEmail.length !== 0) {
                      formData.bcc = bccEmail;
                  }
                  if (attachmentPropertyString && item.binary) {
                      const attachments = [];
                      const attachmentProperties = attachmentPropertyString
                          .split(',')
                          .map((propertyName) => {
                          return propertyName.trim();
                      });
                      for (const propertyName of attachmentProperties) {
                          const binaryData = this.helpers.assertBinaryData(itemIndex, propertyName);
                          const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, propertyName);
                          attachments.push({
                              value: binaryDataBuffer,
                              options: {
                                  filename: binaryData.fileName || 'unknown',
                              },
                          });
                      }
                      if (attachments.length) {
                          formData.attachment = attachments;
                      }
                  }
                  const options = {
                      method: 'POST',
                      formData,
                      uri: `https://${credentials.apiDomain}/v3/${credentials.emailDomain}/messages`,
                      json: true,
                  };
                  let responseData;
                  try {
                      responseData = await this.helpers.requestWithAuthentication.call(this, 'mailgunApi', options);
                  }
                  catch (error) {
                      throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: itemIndex } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: itemIndex } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Mailgun = Mailgun;
  //# sourceMappingURL=Mailgun.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Mailjet
name: Mailjet
package_name: n8n-nodes-base
display_name: Mailjet
description: Consume Mailjet API
code_hash: 9a100847b669fd304f2adac69dade7b637bd6b0910312a076e1061b42b66f35c
source_location: node_modules/n8n-nodes-base/dist/nodes/Mailjet/Mailjet.node.js
extracted_at: 2025-06-07 19:36:38
updated_at: 2025-06-07 19:36:38
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Mailjet = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const EmailDescription_1 = require("./EmailDescription");
  const SmsDescription_1 = require("./SmsDescription");
  class Mailjet {
      constructor() {
          this.description = {
              displayName: 'Mailjet',
              name: 'mailjet',
              icon: 'file:mailjet.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mailjet API',
              defaults: {
                  name: 'Mailjet',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailjetEmailApi',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['email'],
                          },
                      },
                  },
                  {
                      name: 'mailjetSmsApi',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['sms'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Email',
                              value: 'email',
                          },
                          {
                              name: 'SMS',
                              value: 'sms',
                          },
                      ],
                      default: 'email',
                  },
                  ...EmailDescription_1.emailOperations,
                  ...EmailDescription_1.emailFields,
                  ...SmsDescription_1.smsOperations,
                  ...SmsDescription_1.smsFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTemplates() {
                      const returnData = [];
                      const { Data: templates } = await GenericFunctions_1.mailjetApiRequest.call(this, 'GET', '/v3/REST/template');
                      for (const template of templates) {
                          returnData.push({
                              name: template.Name,
                              value: template.ID,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          var _a;
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'email') {
                      if (operation === 'send') {
                          const fromEmail = this.getNodeParameter('fromEmail', i);
                          const htmlBody = this.getNodeParameter('html', i);
                          const textBody = this.getNodeParameter('text', i);
                          const subject = this.getNodeParameter('subject', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const toEmail = this.getNodeParameter('toEmail', i).split(',');
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              From: {
                                  Email: fromEmail,
                              },
                              Subject: subject,
                              To: [],
                              Cc: [],
                              Bcc: [],
                              Variables: {},
                          };
                          for (const email of toEmail) {
                              (_a = body.To) === null || _a === void 0 ? void 0 : _a.push({
                                  Email: email,
                              });
                          }
                          if (jsonParameters) {
                              const variablesJson = this.getNodeParameter('variablesJson', i);
                              const parsedJson = (0, GenericFunctions_1.validateJSON)(variablesJson);
                              if (parsedJson === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Parameter 'Variables (JSON)' has a invalid JSON", { itemIndex: i });
                              }
                              body.Variables = parsedJson;
                          }
                          else {
                              const variables = this.getNodeParameter('variablesUi', i)
                                  .variablesValues || [];
                              for (const variable of variables) {
                                  body.Variables[variable.name] = variable.value;
                              }
                          }
                          if (htmlBody) {
                              body.HTMLPart = htmlBody;
                          }
                          if (textBody) {
                              body.TextPart = textBody;
                          }
                          if (additionalFields.bccEmail) {
                              const bccEmail = additionalFields.bccEmail.split(',');
                              for (const email of bccEmail) {
                                  body.Bcc.push({
                                      Email: email,
                                  });
                              }
                          }
                          if (additionalFields.ccAddresses) {
                              const ccEmail = additionalFields.ccAddresses.split(',');
                              for (const email of ccEmail) {
                                  body.Cc.push({
                                      Email: email,
                                  });
                              }
                          }
                          if (additionalFields.trackOpens) {
                              body.TrackOpens = additionalFields.trackOpens;
                          }
                          if (additionalFields.replyTo) {
                              const replyTo = additionalFields.replyTo;
                              body.ReplyTo = {
                                  Email: replyTo,
                              };
                          }
                          if (additionalFields.trackClicks) {
                              body.TrackClicks = additionalFields.trackClicks;
                          }
                          if (additionalFields.fromName) {
                              body.From.Name = additionalFields.fromName;
                          }
                          if (additionalFields.templateLanguage) {
                              body.TemplateLanguage = additionalFields.templateLanguage;
                          }
                          if (additionalFields.priority) {
                              body.Priority = additionalFields.priority;
                          }
                          responseData = await GenericFunctions_1.mailjetApiRequest.call(this, 'POST', '/v3.1/send', {
                              Messages: [body],
                          });
                          responseData = responseData.Messages;
                      }
                      if (operation === 'sendTemplate') {
                          const fromEmail = this.getNodeParameter('fromEmail', i);
                          const templateId = parseInt(this.getNodeParameter('templateId', i), 10);
                          const subject = this.getNodeParameter('subject', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const toEmail = this.getNodeParameter('toEmail', i).split(',');
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              From: {
                                  Email: fromEmail,
                              },
                              Subject: subject,
                              To: [],
                              Cc: [],
                              Bcc: [],
                              Variables: {},
                              TemplateID: templateId,
                          };
                          for (const email of toEmail) {
                              body.To.push({
                                  Email: email,
                              });
                          }
                          if (jsonParameters) {
                              const variablesJson = this.getNodeParameter('variablesJson', i);
                              const parsedJson = (0, GenericFunctions_1.validateJSON)(variablesJson);
                              if (parsedJson === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Parameter 'Variables (JSON)' has a invalid JSON", { itemIndex: i });
                              }
                              body.Variables = parsedJson;
                          }
                          else {
                              const variables = this.getNodeParameter('variablesUi', i)
                                  .variablesValues || [];
                              for (const variable of variables) {
                                  body.Variables[variable.name] = variable.value;
                              }
                          }
                          if (additionalFields.bccEmail) {
                              const bccEmail = additionalFields.bccEmail.split(',');
                              for (const email of bccEmail) {
                                  body.Bcc.push({
                                      Email: email,
                                  });
                              }
                          }
                          if (additionalFields.ccEmail) {
                              const ccEmail = additionalFields.ccEmail.split(',');
                              for (const email of ccEmail) {
                                  body.Cc.push({
                                      Email: email,
                                  });
                              }
                          }
                          if (additionalFields.replyTo) {
                              const replyTo = additionalFields.replyTo;
                              body.ReplyTo = {
                                  Email: replyTo,
                              };
                          }
                          if (additionalFields.trackOpens) {
                              body.TrackOpens = additionalFields.trackOpens;
                          }
                          if (additionalFields.trackClicks) {
                              body.TrackClicks = additionalFields.trackClicks;
                          }
                          if (additionalFields.fromName) {
                              body.From.Name = additionalFields.fromName;
                          }
                          if (additionalFields.templateLanguage) {
                              body.TemplateLanguage = additionalFields.templateLanguage;
                          }
                          if (additionalFields.priority) {
                              body.Priority = additionalFields.priority;
                          }
                          responseData = await GenericFunctions_1.mailjetApiRequest.call(this, 'POST', '/v3.1/send', {
                              Messages: [body],
                          });
                          responseData = responseData.Messages;
                      }
                  }
                  if (resource === 'sms') {
                      if (operation === 'send') {
                          const from = this.getNodeParameter('from', i);
                          const to = this.getNodeParameter('to', i);
                          const text = this.getNodeParameter('text', i);
                          const body = {
                              From: from,
                              To: to,
                              Text: text,
                          };
                          responseData = await GenericFunctions_1.mailjetApiRequest.call(this, 'POST', '/v4/sms-send', body);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Mailjet = Mailjet;
  //# sourceMappingURL=Mailjet.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


node_type: n8n-nodes-base.Mandrill
name: Mandrill
package_name: n8n-nodes-base
display_name: Mandrill
description: Consume Mandrill API
code_hash: 657483f4909d3e32f7e699bcb912c62b28ebb22b51a309fd9b7b73c498f6680b
source_location: node_modules/n8n-nodes-base/dist/nodes/Mandrill/Mandrill.node.js
extracted_at: 2025-06-07 19:36:39
updated_at: 2025-06-07 19:36:39
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Mandrill = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_1 = __importDefault(require("moment"));
  const map_1 = __importDefault(require("lodash/map"));
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  class Mandrill {
      constructor() {
          this.description = {
              displayName: 'Mandrill',
              name: 'mandrill',
              icon: 'file:mandrill.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mandrill API',
              defaults: {
                  name: 'Mandrill',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mandrillApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Message',
                              value: 'message',
                              description: 'Send a message',
                          },
                      ],
                      default: 'message',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Send Template',
                              value: 'sendTemplate',
                              description: 'Send message based on template',
                              action: 'Send a message based on a template',
                          },
                          {
                              name: 'Send HTML',
                              value: 'sendHtml',
                              description: 'Send message based on HTML',
                              action: 'Send a message based on HTML',
                          },
                      ],
                      default: 'sendTemplate',
                  },
                  {
                      displayName: 'Template Name or ID',
                      name: 'template',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getTemplates',
                      },
                      displayOptions: {
                          show: {
                              operation: ['sendTemplate'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'The template you want to send. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'From Email',
                      name: 'fromEmail',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: 'Admin <example@yourdomain.com>',
                      description: 'Email address of the sender optional with name',
                      displayOptions: {
                          show: {
                              operation: ['sendHtml', 'sendTemplate'],
                          },
                      },
                  },
                  {
                      displayName: 'To Email',
                      name: 'toEmail',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: 'info@example.com',
                      description: 'Email address of the recipient. Multiple ones can be separated by comma.',
                      displayOptions: {
                          show: {
                              operation: ['sendHtml', 'sendTemplate'],
                          },
                      },
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              operation: ['sendHtml', 'sendTemplate'],
                          },
                      },
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['sendHtml', 'sendTemplate'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Async',
                              name: 'async',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the \'reject\' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async.',
                          },
                          {
                              displayName: 'Auto Text',
                              name: 'autoText',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to automatically generate a text part for messages that are not given text',
                          },
                          {
                              displayName: 'Auto HTML',
                              name: 'autoHtml',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to automatically generate an HTML part for messages that are not given HTML',
                          },
                          {
                              displayName: 'BCC Address',
                              name: 'bccAddress',
                              type: 'string',
                              default: '',
                              placeholder: 'message.bcc_address@example.com',
                              description: "An optional address to receive an exact copy of each recipient's email",
                          },
                          {
                              displayName: 'From Name',
                              name: 'fromName',
                              type: 'string',
                              default: '',
                              placeholder: 'John Doe',
                              description: 'Optional from name to be used',
                          },
                          {
                              displayName: 'Google Analytics Campaign',
                              name: 'googleAnalyticsCampaign',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: "Optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.",
                          },
                          {
                              displayName: 'Google Analytics Domains',
                              name: 'googleAnalyticsDomains',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'An array of strings separated by a comma (,) indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically',
                          },
                          {
                              displayName: 'HTML',
                              name: 'html',
                              type: 'string',
                              default: '',
                              typeOptions: {
                                  rows: 5,
                              },
                              options: [],
                              description: 'The html you want to send',
                          },
                          {
                              displayName: 'Important',
                              name: 'important',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not this message is important, and should be delivered ahead of non-important messages',
                          },
                          {
                              displayName: 'Inline CSS',
                              name: 'inlineCss',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size',
                          },
                          {
                              displayName: 'Ip Pool',
                              name: 'ipPool',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'The name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.',
                          },
                          {
                              displayName: 'Preserve Recipients',
                              name: 'preserveRecipients',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to expose all recipients in to "To" header for each email',
                          },
                          {
                              displayName: 'Return Path Domain',
                              name: 'returnPathDomain',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: "A custom domain to use for the messages's return-path",
                          },
                          {
                              displayName: 'Sent At',
                              name: 'sendAt',
                              type: 'dateTime',
                              default: '',
                              placeholder: '',
                              description: 'When this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance.',
                          },
                          {
                              displayName: 'Signing Domain',
                              name: 'signingDomain',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'A custom domain to use for SPF/DKIM signing instead of mandrill(for "via" or "on behalf of" in email clients)',
                          },
                          {
                              displayName: 'Subaccount',
                              name: 'subAccount',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'The unique ID of a subaccount for this message - must already exist or will fail with an error',
                          },
                          {
                              displayName: 'Subject',
                              name: 'subject',
                              type: 'string',
                              default: '',
                              placeholder: 'My subject line',
                              description: 'Subject line of the email',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'An array of string separated by a comma (,) to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              typeOptions: {
                                  rows: 5,
                              },
                              options: [],
                              description: 'Example text content',
                          },
                          {
                              displayName: 'Track Clicks',
                              name: 'trackClicks',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to turn on click tracking for the message',
                          },
                          {
                              displayName: 'Track Opens',
                              name: 'trackOpens',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to turn on open tracking for the message',
                          },
                          {
                              displayName: 'Tracking Domain',
                              name: 'trackingDomain',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'A custom domain to use for tracking opens and clicks instead of mandrillapp.com',
                          },
                          {
                              displayName: 'Url Strip Qs',
                              name: 'urlStripQs',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to strip the query string from URLs when aggregating tracked URL data',
                          },
                          {
                              displayName: 'View Content Link',
                              name: 'viewContentLink',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to remove content logging for sensitive emails',
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Vars',
                      name: 'mergeVarsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      placeholder: `[
  	{
  		{ "name": "name", "content": "content" }
  	}
  ]`,
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      description: 'Global merge variables',
                  },
                  {
                      displayName: 'Merge Vars',
                      name: 'mergeVarsUi',
                      placeholder: 'Add Merge Vars',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      description: 'Per-recipient merge variables',
                      options: [
                          {
                              name: 'mergeVarsValues',
                              displayName: 'Vars',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Content',
                                      name: 'content',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Metadata',
                      name: 'metadataUi',
                      placeholder: 'Add Metadata',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      description: 'Metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.',
                      options: [
                          {
                              name: 'metadataValues',
                              displayName: 'Metadata',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: 'Name of the metadata key to add.',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                      description: 'Value to set for the metadata key',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Metadata',
                      name: 'metadataJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                      placeholder: `{
  	"website": "www.example.com"
  }`,
                      description: 'Metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.',
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachmentsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                      placeholder: `[
  	{
  		"type": "text/plain" (the MIME type of the attachment),
  		"name": "myfile.txt" (the file name of the attachment),
  		"content": "ZXhhbXBsZSBmaWxl" (the content of the attachment as a base64-encoded string)
  	}
  ]`,
                      description: 'An array of supported attachments to add to the message',
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachmentsUi',
                      placeholder: 'Add Attachments',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'attachmentsValues',
                              displayName: 'Attachments Values',
                              values: [
                                  {
                                      displayName: 'Type',
                                      name: 'type',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'text/plain',
                                      description: 'The MIME type of the attachment',
                                  },
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'myfile.txt',
                                      description: 'The file name of the attachment',
                                  },
                                  {
                                      displayName: 'Content',
                                      name: 'content',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'ZXhhbXBsZSBmaWxl',
                                      description: 'The content of the attachment as a base64-encoded string',
                                  },
                              ],
                          },
                          {
                              name: 'attachmentsBinary',
                              displayName: 'Attachments Binary',
                              values: [
                                  {
                                      displayName: 'Property',
                                      name: 'property',
                                      type: 'string',
                                      default: '',
                                      description: 'Name of the binary properties which contain data which should be added to email as attachment',
                                  },
                              ],
                          },
                      ],
                      default: {},
                      description: 'Array of supported attachments to add to the message',
                  },
                  {
                      displayName: 'Headers',
                      name: 'headersJson',
                      type: 'json',
                      default: '',
                      placeholder: `{
  	"Reply-To": "replies@example.com"
  }`,
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      description: 'Optional extra headers to add to the message (most headers are allowed)',
                  },
                  {
                      displayName: 'Headers',
                      name: 'headersUi',
                      placeholder: 'Add Headers',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'headersValues',
                              displayName: 'Values',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                      description: 'Optional extra headers to add to the message (most headers are allowed)',
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTemplates() {
                      const returnData = [];
                      let templates;
                      try {
                          templates = await GenericFunctions_1.mandrillApiRequest.call(this, '/templates', 'POST', '/list');
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                      }
                      for (const template of templates) {
                          const templateName = template.name;
                          const templateSlug = template.slug;
                          returnData.push({
                              name: templateName,
                              value: templateSlug,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const returnData = [];
          const items = this.getInputData();
          let responseData;
          let emailSentResponse;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'message') {
                      const options = this.getNodeParameter('options', i);
                      const fromEmail = this.getNodeParameter('fromEmail', i);
                      const toEmail = this.getNodeParameter('toEmail', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      const toEmailArray = (0, GenericFunctions_1.getToEmailArray)(toEmail);
                      const message = {
                          html: options.html ? options.html : '',
                          text: options.text ? options.text : '',
                          subject: options.subject ? options.subject : '',
                          from_email: fromEmail,
                          to: toEmailArray,
                          important: options.important ? options.important : false,
                          track_opens: options.trackOpens ? options.trackOpens : false,
                          track_clicks: options.trackClicks ? options.trackClicks : false,
                          auto_text: options.autoText ? options.autoText : false,
                          auto_html: options.autoHtml ? options.autoHtml : false,
                          inline_css: options.inlineCss ? options.inlineCss : false,
                          url_strip_qs: options.urlStripQs ? options.urlStripQs : false,
                          preserve_recipients: options.preserveRecipients ? options.preserveRecipients : false,
                          view_content_link: options.viewContentLink ? options.viewContentLink : false,
                          async: options.async ? options.async : false,
                          google_analytics_campaign: options.googleAnalyticsCampaign
                              ? options.googleAnalyticsCampaign
                              : '',
                          ip_pool: options.ipPool ? options.ipPool : '',
                          bcc_address: options.bccAddress ? options.bccAddress : '',
                          tracking_domain: options.trackingDomain ? options.trackingDomain : '',
                          signing_domain: options.signingDomain ? options.signingDomain : '',
                          return_path_domain: options.returnPathDomain ? options.returnPathDomain : '',
                      };
                      if (options.googleAnalyticsDomains) {
                          message.google_analytics_domains = (0, GenericFunctions_1.getGoogleAnalyticsDomainsArray)(options.googleAnalyticsDomains);
                      }
                      if (options.tags) {
                          message.tags = (0, GenericFunctions_1.getTags)(options.tags);
                      }
                      if (options.fromName) {
                          message.from_name = options.fromName;
                      }
                      if (options.subaccount) {
                          message.subaccount = options.subaccount;
                      }
                      const body = {
                          template_content: [],
                          message,
                      };
                      if (options.sendAt) {
                          body.send_at = (0, moment_1.default)(options.sendAt).utc().format('YYYY-MM-DD HH:mm:ss');
                      }
                      if (jsonActive) {
                          body.message.headers = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('headersJson', i));
                          body.message.metadata = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('metadataJson', i));
                          body.message.global_merge_vars = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('mergeVarsJson', i));
                          body.message.attachments = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('attachmentsJson', i));
                      }
                      else {
                          const headersUi = this.getNodeParameter('headersUi', i);
                          if (!(0, isEmpty_1.default)(headersUi)) {
                              body.message.headers = (0, map_1.default)(headersUi.headersValues, (o) => {
                                  const aux = {};
                                  aux[o.name] = o.value;
                                  return aux;
                              });
                          }
                          const metadataUi = this.getNodeParameter('metadataUi', i);
                          if (!(0, isEmpty_1.default)(metadataUi)) {
                              body.message.metadata = (0, map_1.default)(metadataUi.metadataValues, (o) => {
                                  const aux = {};
                                  aux[o.name] = o.value;
                                  return aux;
                              });
                          }
                          const mergeVarsUi = this.getNodeParameter('mergeVarsUi', i);
                          if (!(0, isEmpty_1.default)(mergeVarsUi)) {
                              body.message.global_merge_vars = (0, map_1.default)(mergeVarsUi.mergeVarsValues, (o) => {
                                  const aux = {};
                                  aux.name = o.name;
                                  aux.content = o.content;
                                  return aux;
                              });
                          }
                          const attachmentsUi = this.getNodeParameter('attachmentsUi', i);
                          let attachmentsBinary = [], attachmentsValues = [];
                          if (!(0, isEmpty_1.default)(attachmentsUi)) {
                              if (attachmentsUi.hasOwnProperty('attachmentsValues') &&
                                  !(0, isEmpty_1.default)(attachmentsUi.attachmentsValues)) {
                                  attachmentsValues = (0, map_1.default)(attachmentsUi.attachmentsValues, (o) => {
                                      const aux = {};
                                      aux.name = o.name;
                                      aux.content = o.content;
                                      aux.type = o.type;
                                      return aux;
                                  });
                              }
                              if (attachmentsUi.hasOwnProperty('attachmentsBinary') &&
                                  !(0, isEmpty_1.default)(attachmentsUi.attachmentsBinary) &&
                                  items[i].binary) {
                                  attachmentsBinary = (0, map_1.default)(attachmentsUi.attachmentsBinary, (o) => {
                                      if (items[i].binary.hasOwnProperty(o.property)) {
                                          const aux = {};
                                          aux.name = items[i].binary[o.property].fileName || 'unknown';
                                          aux.content = items[i].binary[o.property].data;
                                          aux.type = items[i].binary[o.property].mimeType;
                                          return aux;
                                      }
                                  });
                              }
                          }
                          body.message.attachments = attachmentsBinary.concat(attachmentsValues);
                      }
                      if (operation === 'sendTemplate') {
                          const template = this.getNodeParameter('template', i);
                          body.template_name = template;
                          emailSentResponse = GenericFunctions_1.mandrillApiRequest.call(this, '/messages', 'POST', '/send-template', body);
                      }
                      else if (operation === 'sendHtml') {
                          emailSentResponse = GenericFunctions_1.mandrillApiRequest.call(this, '/messages', 'POST', '/send', body);
                      }
                      responseData = await emailSentResponse;
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Mandrill = Mandrill;
  //# sourceMappingURL=Mandrill.node.js.map

package_info:
[cell repeats an earlier one in this file: 36903 characters]


